o Predecessor of MS-DOS: in order to provide for the availability of an application software base, MS-DOS was designed to enable the execution of CP/M programs with little or no modifications. o CP/M based on the 8008 processor with a 16-bit addressable memory. o The first 100(hex.)/256(dec.) bytes of memory formed a "resident" portion of the Operating System; application programs started in memory at address 100(hex.) o Standard application program termination was by "jumping" to address 0, the beginning of the Operating System. PSP structure o 100(hex) / 256(dec) bytes o INT 20h - at offset addresses 0 and 1; an MS-DOS service call to terminate the current (.COM-style) program o formatted data area - offsets 2 to 7F; includes, for example, a formatted version of up to 2 file paths that were entered on the same line as the command used to run the program o length of "command tail" - offset 80h - number of characters typed on the same line as the command used to run this program, following the actual command. o command tail - ASCII codes of actual characters typed after the command used to run this program (terminated with a "carriage return" code); this makes argument values (typically file paths) available to programs during execution. PSP access o DS and ES segment registers initially point to a PSP for every program run under MS-DOS. .COM-Style Programs Single 64K-byte Segment o All segment registers initialized to point to PSP when program is initially dispatched o Note that this causes a warning message when "linking" your "assembler" mnemonic programs with the standard LINK program (to be discussed later); since the standard LINK program assumes that you should have a separate segment for the stack (as a minimum). Execution Always Begins At Offset 100h o IP set to 0100h for initial dispatch o .COM-style programs must have their initial instructions at this location o Note that the system supplied PSP takes up the first 100h bytes, so that no portion of the program may precede this address. o An ORG 100h pseudo-mnemonic instruction is required to force the initial instructions to be treated as occurring at offset 100h Stack Pointer Initialized to FFFEh o stack is constructed backwards (towards the program code and data) starting from the last even address within the (single) program segment. o o if the program and data are quite large (within the 64K-byte segment), problems may occur is the stack fills up overtop of instructions or data Real Mode Execution Only o .COM programs must be loaded to run within the first Megabyte of memory. o .COM program addresses are not "memory range" checked and .COM programs can access and modify any (RAM) portion of the first Megabyte of memory (including the Operating System and its tables. .EXE-Style Programs Multiple Segments o DS and ES registers initially point to the PSP. Program code is required to modify their contents to point to program data segments (after any command tail processing has been done). o CS initially points to the first segment containing instructions within the program code. o SS initially points to the first "stack" segment within the program code. At least one segment should be identified (with the STACK option) as being a data area for the stack. Initial Execution Offset o Execution normally starts with the IP set to 0000, at the first instruction of the (first) code segment. However, the actual offset is determined by a label reference on the END statement which marks the end of the source program. Initial Stack Pointer o The SP register is set to the length of the supplied "stack" segment. o In rare cases, there may be several "stack" segments. In such cases, all segments with the STACK option are combined into a single stack and the SP is set to the total length of this combined segment.
The Advanced Roblox Coding Book: An Unofficial Guide, Updated Edition: Learn How to Script Games, Code Objects and Settings, and Create Your Own World!
NES Classic: The Ultimate Guide to Super Mario Bros.: A look inside the pipes?. At The History, Super Cheats & Secret Levels of one of the most iconic videos games in history