tjr@ihnet.ATT.COM (Tom Roberts) (09/29/87)
Before your program can EXEC another program, your program must free up some memory for it to use. Remember, a program gets the largest free block of memory to run in, so there usually is no memory available for the other program. Thus it MUST use dos function 4A to modify ITS OWN memory block, reducing its length to just what is needed. There are two cases, depending upon what type of program your program is (the type of the EXEC-ed program doesn't matter): .COM your single segment starts at your PSP, and the stack is 64kB above it. You can just modify your memory block to keep 64kB, or you can move your stack down to ~2kB above the end of your program, and modify your memory block accordingly (your memory block segment address is in CS&DS&SS). This is usually done during program startup, when the stack is empty. .EXE you (or LINK) specified all of the program segments, including STACK. You will need a label at the end of the last one; simply reduce the size of your memory block to the appropriate length (your memory block segment address is that of your program's PSP, but I forget where that is kept for an .EXE program). Good luck! Tom Roberts ihnp4!ihnet!tjr