The environment of an EXE program run by DOS is found in its
Program Segment Prefix. EXE files normally have separate segments for the code, data, and stack. Program execution begins at address 0 of the
code segment, and the stack pointer register is set to whatever value is contained in the header information (thus if the header specifies a 512 byte stack, the stack pointer is set to 200h). It is possible to not use a separate stack segment and simply use the code segment for the stack if desired. The DS (
data segment) register normally contains the same value as the CS (code segment) register and is not loaded with the actual segment address of the data segment when an EXE file is initialized; it is necessary for the programmer to set it themselves, generally done via the following instructions: MOV AX, @DATA MOV DS, AX == Termination ==