Skip to main content

EXE and COM programs

Differentiate between EXE and COM programs.

Both are executable programs of DOS. A .COM file is an exact memory image of the program that fits in one 64 KB segment; an .EXE file has a header with relocation information and can use many segments.

Point.COM program.EXE program
SizeMax 64 KB (one segment)Larger than 64 KB possible
SegmentsCode, data and stack share one segmentSeparate code, data and stack segments
File formatPure binary image, no headerHas a header (starts with "MZ") with relocation table
OriginMust start with ORG 100H (after the 256-byte PSP)No ORG needed
StackSet up automatically by DOS (SP = FFFEH)Defined by programmer (.STACK)
Data segment initNot required, DS = CSProgrammer loads DS (MOV AX,@DATA, MOV DS,AX)
LoadingFast, loaded as isSlower, relocation applied by loader
Disk spaceSmallerLarger because of the header
CreationLINK then EXE2BIN, or TLINK /tLINK / TLINK
Memory useOccupies whole segmentUses only what it needs

COM programs suit small utilities; EXE programs suit large applications with several segments.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Microprocessor chapter 3 questions →