Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!tektronix!tekcrl!tekgvs!toma From: toma@tekgvs.LABS.TEK.COM (Tom Almy) Newsgroups: comp.sys.ibm.pc Subject: Re: TSRs in Microsoft C Message-ID: <4737@tekgvs.LABS.TEK.COM> Date: 8 Mar 89 23:01:58 GMT References: <148@wbcs.UUCP> <101000044@hpcvlx.HP.COM> Reply-To: toma@tekgvs.LABS.TEK.COM (Tom Almy) Organization: Tektronix, Inc., Beaverton, OR. Lines: 26 In article <101000044@hpcvlx.HP.COM> everett@hpcvlx.HP.COM (Everett Kaser) writes: >Your TSR program doesn't HAVE to be .COM, it can stay as .EXE, so you can >have multiple segments. ... Actually .COM vs .EXE has nothing to do with number of segments. While a .COM file starts executing with DS=CS=SS=ES, the program itself can change the segment registers and utilize the entire memory space. I have written many programs (and a compiler) which do this. The .EXE file offers four possible advantages, only the first cannot be avoided in assembler or within the compiler design: 1. Size of the loaded image can be greater than 64k; .COM files are arbitrarily limited to 64k (is this to make them CP/M compatible? :-) ) 2. The loader does a simple relocation, adding the starting segment to locations given in a table at the start of the file. Thus segments can be treated as constants by the compiler. But the program could do this itself if the loader didn't. 3. The .EXE header specifies initial values for the stack registers and the instruction pointer (registers CS, IP, SS, and SP). 4. The header specifies the quantity of memory to allocate beyond the end of the image. In a .COM file, all memory goes to the program and any not needed must be freed. Tom Almy toma@tekgvs.labs.tek.com Standard Disclaimers Apply