From: Kris Heidenstrom Newsgroups: comp.os.msdos.djgpp Subject: Re: .com's--what,why,how Date: Sun, 04 Jan 1998 02:09:22 +1300 Organization: CLEAR Net, http://www.clear.net.nz/ Lines: 34 Message-ID: <34AE3882.403ED39C@clear.net.nz> References: <34ADA1CB DOT 55B18C44 AT compu DOT net> NNTP-Posting-Host: d1-u42.wgtn.clear.net.nz Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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/