during the last 5 years i’ve been explaining people that it takes less space to write a 3 minutes HD animated video and music clip than than it takes to store a 32×32 pixel icon. it’s all about replacing content by algorithms. i often have shown binary/disassembled code of such animations in an attempt to prove it, but never I really managed to find a way to make my point ridiculously obvious to understand (at least for programmers).

the other day my friend 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.

This is the image, upscaled 10 times in each direction: