Mail Archives: djgpp/1998/01/03/08:15:23
QlowN wrote:
> what is the difference between .com and .exe ?
> why would it be preferable to use one over the other?
> how do i make one (.com) with djgpp ?
A .COM file is limited to 64K total size (slightly less,
actually) on disk. The entire file is loaded into memory.
There are no fixups and there is no header. This format
is suitable for small real-mode-only DOS-only utilities.
A .EXE file has an unlimited size on disk (AFAIK) and has a
header which specifies how much of the file is to be loaded
into memory and where control is to be transferred. It's
easy to make an EXE file which contains a small real-mode
stub, which is the only part loaded by DOS. This stub can
set up the operating environment and read other parts of
the EXE file into memory. This is what happens with a
DJGPP executable (or any DOS protected-mode executable).
DOS recognises an EXE file by the first two bytes which
should be 'M' and 'Z' (for Mark Zbikowski, the main
designer of DOS 2.0 which introduced the EXE format
(I think) and many other important features. You can
rename an EXE file to COM, and vice versa, with no
affect on their behaviour, since DOS uses this signature
to determine the file type.
HTH
Kris
--
Kris Heidenstrom Electronic designer, programmer, bass player
kheidens AT clear DOT net DOT nz http://home.clear.net.nz/pages/kheidens/
- Raw text -