home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / alt / msdos / programm / 3281 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.3 KB

  1. Path: 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
  2. From: M.E.Edwards@newcastle.ac.uk (M.E. Edwards)
  3. Newsgroups: alt.msdos.programmer
  4. Subject: Re: .com and .exe files
  5. Message-ID: <C1K75q.E99@newcastle.ac.uk>
  6. Date: 28 Jan 93 10:15:25 GMT
  7. References: <1993Jan25.231026.6514@news.unomaha.edu>
  8. Organization: University of Newcastle upon Tyne, UK, NE1 7RU
  9. Lines: 45
  10. Nntp-Posting-Host: newton
  11.  
  12. fprince@cwis.unomaha.edu (Frank E. Prince) writes:
  13.  
  14. >Could anyone tell me the difference between .com and .exe files. The
  15. >most I've come up with is that a com file is an "executable memory image"
  16. >but that definition was somewhat out of context, and I don't really
  17. >understand it. I've done some assembly language programming with MASM so
  18. >I do understand instruction sets, stacks, registers etc. Any information
  19. >regarding this is much appreciated.
  20. >            Thanks,
  21. >                Frank
  22.  
  23. I've posted this since it may be of general interest to others as well.
  24.  
  25. As far as I understand, a .com file is a direct memory dump (ie no code
  26. relocation can take place) whereas an .exe file contains offsets and indirection
  27. allowing it to be run from (more or less) any location in memory.
  28.  
  29. Thus, a .com file can be loaded and executed slightly faster than an.exe file
  30. since the processor only has to load the code to a set area (usually the base
  31. of user memory) and jump straight to it.
  32.  
  33. The only problem with .com files is that there is no separation between the
  34. code segments.  Thus the stack and data segments share the same memory area.
  35. Thus some compilers may throw out the code.
  36.  
  37. Using Borland Turbo C++, I find that the tiny memory model will suffice,
  38. so compile your code with that and as long as the executable file is less than
  39. 64k in length then quit to dos and type :
  40.  
  41.             exe2bin <filename>.exe <filename>.com
  42.  
  43. and this will transform your .exe file into a .com file (so now we all know what
  44. this little DOS utility is for :-) ).
  45.  
  46.  
  47. So, hope this helps?
  48.  
  49. Cheers,  Mark...
  50.  
  51.  
  52.  
  53.    Snail Mail : M.E.Edwards,204 Farndale Road, Benwell, Newcastle-Upon-Tyne.
  54.    Email : M.E.Edwards@uk.ac.newcastle                  Phone : 091-273 4932
  55.            "Do not adjust your mind ... there is a fault in reality"
  56.                               #include <StdDisclaimer.h>
  57.