Difference between .COM and .EXE
I have com across an article which states that .COM
files are bett开发者_StackOverflow社区er for small application than .EXE
files. What are .COM
files? How do we create a .COM
file? How are they better than .EXE
files? I also want to know whether .COM
files are still widely used?
Any Suggestions.
Did this article come from 1985? COM files are long dead, as they are DOS only, may only be 64 KiB big and have many other issues.
They used to be a much simpler format then EXE, as you could create a valid com executable with a few lines in debug.exe or an assembler. I am getting a little bit nostalgic here...
COM files is great, because you can convert executable magically to text files. EXE files does always have a MZ header while COM doesn't. As you can generate code dynamically in x86 arch, you can generate binary opcodes using opcodes in printable chars.
Here is an example, program README.COM:
P5CQ5sPP[X5iK4iH4]P_1?CC5IQ5CBP_1?SX4v4pPZ5iH5i@okey
Text2COM example by 谢继雷 (Lenik).
$
In this example, the bootstrap opcodes generate a DOS INT 21H interrupt to display a string terminated by '$'.
Some old time compilers may have some options to support .COM file, but since it's 16-bit executable, they haven't been supported for many years.
精彩评论