Go Back   nV News Forums > Software Forums > Software Development

Newegg Daily Deals

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

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


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.

4.3 MB GIF:
ALobpreis is offline   Reply With Quote
Old 04-10-11, 11:10 AM   #2
Join Date: Mar 2004
Posts: 15,488
Default Re: OMG! Pixel coding

That is amazing.
ViN86 is offline   Reply With Quote
Old 04-11-11, 09:37 PM   #3
Dethklok Returns!
t3hl33td4rg0n's Avatar
Join Date: Dec 2004
Location: Kent, OH
Posts: 2,142
Send a message via AIM to t3hl33td4rg0n Send a message via MSN to t3hl33td4rg0n Send a message via Yahoo to t3hl33td4rg0n
Default Re: OMG! Pixel coding

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                                        ; 

Intel QX9650 @ 3.83GHzXFX 780ieVGA GTX 560Ti8GB GSkill DDR800Creative Sound Blaster X-Fi Titanium PCI-ESeagate 1.5TB . 4x Samsung 2TB

Originally Posted by MowTin View Post
....it's so clear how government makes things worse not better...
t3hl33td4rg0n is offline   Reply With Quote
Old 04-12-11, 05:39 AM   #4
Registered User
Join Date: Mar 2006
Posts: 532
Default Re: OMG! Pixel coding

It's nice to see the old good tunnel effect as well.
jlippo is offline   Reply With Quote
Old 04-12-11, 09:46 AM   #5
Registered Knight
LydianKnight's Avatar
Join Date: Jan 2009
Location: Mlaga, Spain
Posts: 977
Default Re: OMG! Pixel coding

All I can say is... WOW
LydianKnight is offline   Reply With Quote
Old 05-19-11, 04:46 AM   #6
Registered User
Join Date: May 2011
Location: England
Posts: 1
Default Re: OMG! Pixel coding

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.
Husk is offline   Reply With Quote
Old 05-28-11, 12:24 PM   #7
XDanger's Avatar
Join Date: Nov 2005
Posts: 5,729
Default Re: OMG! Pixel coding

My programming is limited to 10 Print "hello"

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.
2500K 4.7ghz,P8P67Pro,120gb Force3, 8gb Vengeance,GTX970,TX850v2,W7HP,LaCie Blue 22" crt COMMODORE 64 Silver Label 1Mhz/128D 4Mhz(Z80)
XDanger is offline   Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 04:16 PM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.