View Single Post
Old 04-09-11, 12:49 PM   #1
ALobpreis
 
ALobpreis's Avatar
 
Join Date: Jul 2002
Location: Ramos
Posts: 412
Exclamation OMG! Pixel coding

Not anywhere near something comfortable, but it's interesting.

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

Quote:
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 wouldn’t 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 9×9 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 (320×200 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.


4.3 MB GIF:
ALobpreis is offline   Reply With Quote