Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site wateng.UUCP
Path: utzoo!watmath!wateng!broehl
From: broehl@wateng.UUCP (Bernie Roehl)
Newsgroups: net.micro.pc
Subject: Re: Com vs. Exe files
Message-ID: <2672@wateng.UUCP>
Date: Tue, 16-Jul-85 09:31:05 EDT
Article-I.D.: wateng.2672
Posted: Tue Jul 16 09:31:05 1985
Date-Received: Wed, 17-Jul-85 07:48:31 EDT
References: <1932@sunybcs.UUCP>
Reply-To: broehl@wateng.UUCP (Bernie Roehl)
Distribution: net
Organization: U of Waterloo, Ontario
Lines: 27

There are a number of differences.

.COM files are smaller, and load slightly faster since they don't require
relocation.  They are essentially memory-image files; they get loaded in
pretty well as-is starting at offset 100h in your program segment.  They
have all four segment registers pointing at the PSP when they start running;
if you don't know what this means, it doesn't really matter.

.EXE files are bigger (they have relocation information in them) and load
a little slower.  They have a header at the start that contains information
about stack space requirements and stuff like that.

.COM files must be position independent.  In other words, they must be able
to execute *anywhere* in memory without change.  .EXE files can be loaded
anywhere, even if they're not position-independent, since the DOS loader
is smart enough to handle the relocation.

The reason Turbo Pascal can produce .COM files is that the code it generates
is position-independent; this is not the case for most other compilers.
(My Turbo Pascal arrived weeks ago, and it's still in the box... I've been
really busy lately).

Speaking of being busy, I've gotta go... hope this helps.

-- 
        -Bernie Roehl    (University of Waterloo)
	...decvax!watmath!wateng!broehl