PDA

View Full Version : OMG! Pixel coding


ALobpreis
04-09-11, 01:49 PM
Not anywhere near something comfortable, but it's interesting. :D

http://www.iquilezles.org/blog/?p=1426

the other day my colleague Ernest Delgado from sexyvisuals sent me a link to this funny video, where somebody was writing a text file (with some C++ code as content) by drawing pixels in an image file.

so i thought i could kill two births with one stone if i applied the build content by putting color pixels idea. for one hand, i would go beyond writing source code (which btw wouldnt compile due the header of the bitmap being interpreted as garbage by the source parser of the compiler) and write actual native x86 executable binary code, that would actually run in the computer as any other application. in the other hand, i would show that indeed, couple of hundred bytes are enough to build a realtime animation (who needs C++, DirectX or OpenGL?).

anyway, this is the video. what you can see is: (1) the creation of an empty 99 image. (2) the filling of the pixels with carefully chosen colors. (3) saving the file in raw format (ie, without header). (4) renaming it to .com, so that Windows (XP) recognizes it as an executable file (as an application). (6) running the executable/application, which opens a window and runs an infinite moving tunnel with a gray colored texture.

the binary content itself is a x86 real mode com file that basically opens the oldschool 13h graphics mode (320200 pixels, 256 colors remember monkey island and those old games?), creates a texture with an XOR pattern, blurs it, and uses a plane deformation technique to produce the animation.

cfYTZBJ2N9g

4.3 MB GIF:
http://i.min.us/ikq8hS.gif

ViN86
04-10-11, 12:10 PM
That is amazing. :eek:

t3hl33td4rg0n
04-11-11, 10:37 PM
Thats really awesome!

Doesn't run on windows 7 though lol (being a 16-bit executable)

EDIT: x64

00000000h: B7 10 B4 4A CD 21 B4 48 CD 21 8E E8 B7 20 B4 48 ; .J!H! H
00000010h: CD 21 8E E0 8E C0 BD DD 01 B1 C8 31 FF BB 60 FF ; !.1`
00000020h: 89 C8 2D 64 00 89 46 03 89 5E 05 DF 46 05 DF 46 ; -d.F.^.F.F
00000030h: 03 D9 C0 DC C8 D9 C2 DC C8 DE C1 D9 FA DE 7E 01 ; .~.
00000040h: 26 DF 1D D9 F3 DE 4E 00 26 DF 5D 01 47 47 43 81 ; &.N.&].GGC
00000050h: FB 9F 00 7E CB 8C C0 05 28 00 8E C0 E2 BD 88 C8 ; .~ˌ.(.⽈
00000060h: 30 E8 89 CB 65 88 07 E2 F5 B1 10 65 8A 07 FE CB ; 0e..e.
00000070h: 65 02 07 FE C3 FE C7 65 02 07 80 EF 02 65 02 07 ; e..e...e..
00000080h: FE C7 C1 E8 02 65 88 07 43 75 E0 E2 DE B0 13 CD ; .e.Cuް.
00000090h: 10 68 00 A0 07 88 C8 BA C8 03 EE 42 EE EE EE E2 ; .h.*.Ⱥ.B
000000a0h: F4 45 B2 DA EC A8 08 74 FB EC A8 08 75 FB 0F A0 ; E.t.u.*
000000b0h: 31 FF B1 C8 31 F6 64 8B 1C 01 EB 65 8A 07 AA AD ; 11d..e.*
000000c0h: 81 FE 80 02 7C F0 8C E0 05 28 00 8E E0 E2 E5 0F ; .|.(..
000000d0h: A1 B4 11 CD 16 74 CA B8 03 00 CD 10 C3 29 00 0A ; ..tʸ...)..
000000e0h: 0A FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ; .
000000f0h: FF FF FF ;

jlippo
04-12-11, 06:39 AM
Sweet.
It's nice to see the old good tunnel effect as well. :D

LydianKnight
04-12-11, 10:46 AM
All I can say is... WOW :)

Husk
05-19-11, 05:46 AM
That is quite crazy, I do remember years ago there was an app that let you "store" files in images. I believe that just appended the info onto the image thou.

XDanger
05-28-11, 01:24 PM
My programming is limited to 10 Print "hello" :D

So it uses the hex numbers of the colors and when you change the extension those numbers become the x86 binary language or what?

Would be cool video to scan a hardcopy of the image then end up with the demo, Its a bit like a punch card eh.