3 ms·
This is cool. Could somebody please explain how this works? From what I can currently guess, the .midi image encoding with the 2D array of color values, when ch
by jztein 14y ago
This is cool. Could somebody please explain how this works? From what I can currently guess, the .midi image encoding with the 2D array of color values, when changed to an .com executable becomes assembly code that generates graphics? Thanks.
- cthackers 14y agoInitially is a 2d array but when saved without a image header to give it width and height (and other meta data) it becomes just an array of bytes. A color is encoded in 3 bytes, so with each pixel he can write one, two or three opcodes. If you google opcode tables you'll find plenty of examples of how assembly instructions are encoded in bytes. For example (this is 16 bit but for the sake of demonstration) byte A1 (10100001) means ADD AX, BX. 101(add)00(ax)001(bx). [Edit] Found a cool image showing x86 opcodes. http://i.imgur.com/69Lli.png http://i.imgur.com/69Lli.png And even a cooler one with windows exe description (not DOS .com as he used) http://i.imgur.com/tnUca.jpg http://i.imgur.com/tnUca.jpg Look at the right side of the image where it sais x86 Assembly where it colors and explains each byte. His .com was only that part since .com didn't need headers and imports and it was just code.
- jztein 14y agoThanks for the explanation and images cthackers:) I guess that the tunnel is an infinite loop from JMPs. I think I'll try to make one.