Mail Archives: djgpp/1995/10/26/09:06:50
On Thu, 26 Oct 1995, A.Appleyard wrote:
> Where anywhere at all can I find information on the internal format and layout
> of .COM and .EXE etc files?
Look in the Ralph Brown's Interrupt List (where else?), under the DOS
Exec function (4Bh). There is a large table there which explains the
structure of all the executables.
> If a .COM file did start with `MZ' or `ZM', would that correspond with any
> legal or likely PC instructions?
The first instruction of .COM file is at offset 100h. DOS checks if the
first 2 bytes are "MZ" or "ZM", and if not, it assumes it's a .COM
program. DOS ignores the file extension (but COMMAND.COM and other
shells don't, but that's another story). So if a .COM starts with "MZ",
DOS will treat it as a .EXE program (actually, a few such ``hidden'' .EXE
programs come with DOS itself, so this behavior is intended).
- Raw text -