Readablewiki

DOS MZ executable

Content sourced from Wikipedia, licensed under CC BY-SA 3.0.

DOS MZ executable

The DOS MZ executable is the standard format for .EXE files used by DOS. The name MZ comes from Mark Zbikowski, one of the original developers of MS-DOS, and every MZ file starts with the ASCII letters “MZ.”

What it is and why it matters
- It’s the executable file format that replaced the older COM format for DOS programs.
- The MZ header includes relocation information, which lets a program be loaded at different memory addresses and supports larger programs than 64 KB. Later, DOS extenders allowed even bigger programs.

How it’s laid out
- An MZ file is organized into segments for code, data, and stack. When a program runs, execution starts at the beginning of the code segment. The DS register is usually set to the data segment so the program can access its data.

How programs end
- In DOS 1.x, the CS register pointed to the PSP (Program Segment Prefix) at termination, and a sequence involving RETF and INT 20h was used to exit.
- DOS 2.x introduced a newer exit method using INT 21h with function 4Ch, which does not require saving the PSP address, and Microsoft recommended using this method instead of the older approach.

Compatibility
- MZ executables run on DOS and on Windows 9x systems.
- 32-bit Windows NT-based systems can run them via a built-in Virtual DOS Machine, though some graphics modes may not work.
- They do not run on 64-bit Windows without emulation.
- You can also run them with DOS emulators such as DOSBox or DOSEMU.

Creating MZ executables
- They are produced by linkers such as Digital Mars Optlink, MS’s linker, VALX, or Open Watcom’s WLINK. Some assemblers like FASM can create them directly.

See also
- DOS, DOS extenders, Portable Executable, DOS API, Executable compression.


This page was last edited on 28 January 2026, at 16:55 (CET).