🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #1059

Re: .com and .exe files

#1059
From: M.E. Edwards
Date: Thu, 28 Jan 1993 10:15
45 lines
2450 bytes
fprince@cwis.unomaha.edu (Frank E. Prince) writes:

>Could anyone tell me the difference between .com and .exe files. The
>most I've come up with is that a com file is an "executable memory image"
>but that definition was somewhat out of context, and I don't really
>understand it. I've done some assembly language programming with MASM so
>I do understand instruction sets, stacks, registers etc. Any information
>regarding this is much appreciated.
>			Thanks,
>				Frank

I've posted this since it may be of general interest to others as well.

As far as I understand, a .com file is a direct memory dump (ie no code
relocation can take place) whereas an .exe file contains offsets and indirection
allowing it to be run from (more or less) any location in memory.

Thus, a .com file can be loaded and executed slightly faster than an.exe file
since the processor only has to load the code to a set area (usually the base
of user memory) and jump straight to it.

The only problem with .com files is that there is no separation between the
code segments.  Thus the stack and data segments share the same memory area.
Thus some compilers may throw out the code.

Using Borland Turbo C++, I find that the tiny memory model will suffice,
so compile your code with that and as long as the executable file is less than
64k in length then quit to dos and type :

			exe2bin <filename>.exe <filename>.com

and this will transform your .exe file into a .com file (so now we all know what
this little DOS utility is for :-) ).


So, hope this helps?

Cheers,  Mark...



   Snail Mail : M.E.Edwards,204 Farndale Road, Benwell, Newcastle-Upon-Tyne.
   Email : M.E.Edwards@uk.ac.newcastle                  Phone : 091-273 4932
           "Do not adjust your mind ... there is a fault in reality"
						      #include <StdDisclaimer.h>
Technical Details
Message-ID: <C1K75q.E99@newcastle.ac.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!batcomputer!rpi!usc!howland.reston.ans.net!spool.mu.edu!agate!netsys!ibmpcug!pipex!pavo.csi.cam.ac.uk!warwick!uknet!newcastle.ac.uk!newton!n1z0s
References: <1993Jan25.231026.6514@news.unomaha.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!batcomputer!rpi!usc!howland.reston.ans.net!spool.mu.edu!agate!netsys!ibmpcug!pipex!pavo.csi.cam.ac.uk!warwick!uknet!newcastle.ac.uk!newton!n1z0s
From: M.E.Edwards@newcastle.ac.uk (M.E. Edwards)
Newsgroups: alt.msdos.programmer
Subject: Re: .com and .exe files
Message-ID: <C1K75q.E99@newcastle.ac.uk>
Date: 28 Jan 93 10:15:25 GMT
References: <1993Jan25.231026.6514@news.unomaha.edu>
Organization: University of Newcastle upon Tyne, UK, NE1 7RU
Lines: 45
Nntp-Posting-Host: newton