COM: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
→‎Introduction: An executable in .com format can manipulate the segment registers and use additional memory once it is running, but the size of the binary itself is limited, and it is loaded as described.
Line 8: Line 8:
COM files were used by MS-DOS. They are raw binaries, meaning there is no header data. Also, COM files are restricted to the size of one segment (a real-address mode segment, 64kb), minus 256 bytes. When a COM file is loaded, it is assumed that all code and data fits in one segment, and it is loaded to offset 0x100.
COM files were used by MS-DOS. They are raw binaries, meaning there is no header data. Also, COM files are restricted to the size of one segment (a real-address mode segment, 64kb), minus 256 bytes. When a COM file is loaded, it is assumed that all code and data fits in one segment, and it is loaded to offset 0x100.


MS-DOS creates and stores an info structure starting at offset 0 and ending just before 0x100, called the Program Segment Prefix (PSP). The PSP is made just before starting the COM program. More info about the PSP can be found [http://heim.ifi.uio.no/~stanisls/helppc/program_segment_prefix.html here]. PSP is only required for running DOS programs.
MS-DOS creates and stores an info structure starting at offset 0 and ending just before 0x100, called the Program Segment Prefix (PSP). The PSP is made just before starting the COM program. More info about the PSP can be found [https://web.archive.org/web/20061101031637/http://heim.ifi.uio.no/~stanisls/helppc/program_segment_prefix.html here]. PSP is only required for running DOS programs.


COM files usually terminate with a RET instruction. On DOS, the RET pops a empty word from the stack, which results in a interrupt 0x20 (DOS API Exit) being called.
COM files usually terminate with a RET instruction. On DOS, the RET pops a empty word from the stack, which results in a interrupt 0x20 (DOS API Exit) being called.