Assembler Programming : .COM and .EXE Program Structures


There are two basic forms of executable programs in MS-DOS: the .COM format and the .EXE format. High level languages hide these differences from the programmer and (except for languages like C where the "memory model" selection can affect the format) generate code in only one format (normally the .EXE format). When programming in low level assembler, however, these differences have a major impact on the source code that needs to be written; it therefore becomes critical to understand the differences between these two forms.


The Program Segment Prefix (PSP)





.COM-Style Programs




MASM Source for .COM-Style Programs




.EXE-Style Programs




MASM Source for .EXE-Style Programs