tags:

views:

66

answers:

2

Hii,

I have com across an article which states that COM files are better for small application than .EXE files. What are .COM files? How do we create a .COM file ... ?? How is it better than .EXE files .. ???

Any Suggestions .. :)

+7  A: 

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...

SvenW
That's 64K for code *and* data, if I recall correctly. And I was thinking "old magazine" as well.
Dennis Williamson
Exchange 2010 comes with a setup.com, so they're not *that* dead!
Ben
Ben, are the first two byte of this setup.com 'MZ' by chance? This would mean it's really an exe file.
SvenW
@SvenW - yes they are in fact, I stand corrected. At the time I did think it was a bit odd and outdated (especially since Server 2008 R2 and Exchange 2010 are both only 64 bit) but I didn't really think that much more of it.
Ben
A: 

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.

谢继雷