DOS executable (.com)

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name DOS executable (.com)
Extension(s) .com

COM ("command file") is the native executable format of CP/M. The format was inherited by the DOS family of operating systems; MS-DOS 1.0 introduced MZ as a replacement. COM files are raw, flat binaries without relocations; there are no identifying headers or magic numbers, except for a variant introduced in CP/M 3 which contains a 256-byte header.

On PC computers, COM files are loaded at fixed offset 0x100 in an arbitrary real mode memory segment. The entry point is located at the start of the file. Many COM files start with a jump instruction (opcode 0xe9 or 0xeb), but this isn't required. Since the executable is limited to a single segment, the maximum size of a COM file is 65280 (0xff00) bytes.

Some files carrying the .com extension are in fact in the MZ format: for example, the COMMAND.COM and EDIT.COM binaries distributed with Windows 95 and later are MZ executables. The DOS loader can detect this and load the file appropriately.

See also

Sample files


Personal tools