The answer provided here is a pretty awesome trick. Just for my own edification, I'd like to learn to create that type of program.
Is there a nice library that I can use to ensure my output is entirely ASCII? Or what tools would I begin to use to generate that type of output? I understand that I would likely be creating a 16-bit application, but can I generate 32-bit applications as well?
I've found MSFT's debug.exe
program has an assembler that works with this, but the output I receive from that is not entirely ASCII. Also, when disassembling the program provided in 谢继雷'Lenik's answer I don't see where he calls int 21
to write to the screen. Is there more documentation somewhere for this type of program?
Can anyone else me sort out these mysteries, please?
The text-to-com file is a very neat trick. It takes advantage of the fact that the 16-bit loader will load the image at offset 0x0100 and start executing at that address.
An exe file includes a binary header that cannot be represented as text. As a result, you can't create a 32-bit or 64-bit executable that is strictly text.
A classical example of a .COM file using only printable characters is EICAR, a file used to test antivirus. Some time ago, there was a discussion thread about EICAR at bugtraq.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With