Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: $Revision: 1.6.2.16 $; site ima.UUCP
Path: utzoo!linus!decvax!cca!ima!johnl
From: johnl@ima.UUCP
Newsgroups: net.micro.pc
Subject: Re: Com vs. Exe files
Message-ID: <38700016@ima.UUCP>
Date: Mon, 22-Jul-85 21:39:00 EDT
Article-I.D.: ima.38700016
Posted: Mon Jul 22 21:39:00 1985
Date-Received: Tue, 20-Aug-85 00:27:57 EDT
References: <1932@sunybcs.UUCP>
Lines: 24
Nf-ID: #R:sunybcs:-193200:ima:38700016:000:1310
Nf-From: ima!johnl    Jul 22 21:39:00 1985


[The question at hand is what the difference is between .COM and .EXE files.]

A .COM file is merely a sequence of bytes.  MS-DOS runs it by loading the
whole thing into memory and starting it at the beginning.  If your program
doesn't fit into one segment, .COM files make life hard for you because there
is no provision for relocating segment numbers within the loaded file to agree
with where the program is actually loaded in memory.  Practically speaking,
this means that .COM programs are limited to 64K of code and 64K of static
data.  (In response to another message, most C compilers are happy to let you
make .COM files of their object code.  I have done it myself with Lattice and
Wizard, and have heard it's easy with most other compilers.)

A .EXE file has a somewhat more complicated format, with a header that tells
how large the code is and how the various segment registers should be set up
when the program starts.  It also has provision for relocating addresses in
the program, which means that the program can be as large as all of memory.

Traditional folklore claimed that .COM files are better than .EXE files,
because they loaded faster or something.  Since DOS 2.1, at least, that
hasn't been true and making your programs into .COM files is of neglible
value.

John Levine, ima!johnl