NOTE: The program can be either .COM or .EXE. A .COM program is useful as a small utility program or as a resident program (one that is installed in memory and is available while other programs run). In real mode, an .EXE program consists of separate code, data and stack segments and is the method used for more serious programs.
When you double click on an .EXE program (when you request the system to load an .EXE program from disk into memory for execution), the System Program Loader performs following steps
- Accesses the .EXE program from disk
- Constructs a 256-byte (100H) Program Segment Prefix (PSP) on a paragraph boundary in available internal memory (NOTE: PSP is a data structure used in DOS systems to store the state of a program)
- Stores the program in memory immediately following PSP
- Loads the address of PSP in DS and ES registers
- Loads the address of code segment in CS register and sets the IP register to the offset of the first instruction (usually zero) in the code segment
- Loads the address of the stack in SS register and sets the SP register to the size of the stack
- Transfers control to the program for execution, beginning usually with the first instruction in the code segment
No comments:
Post a Comment