DOS executable
Encyclopedia
The DOS MZ executable format is the executable
Executable
In computing, an executable file causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a data file that must be parsed by a program to be meaningful. These instructions are traditionally machine code instructions for a physical CPU...

 file format
File format
A file format is a particular way that information is encoded for storage in a computer file.Since a disk drive, or indeed any computer storage, can store only bits, the computer must have some way of converting information to 0s and 1s and vice-versa. There are different kinds of formats for...

 used for .EXE
EXE
EXE is the common filename extension denoting an executable file in the DOS, OpenVMS, Microsoft Windows, Symbian, and OS/2 operating systems....

 files in DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

.

The file can be identified by the ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

 string "MZ" or the hexadecimal
Hexadecimal
In mathematics and computer science, hexadecimal is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen...

 4D 5A (or "ZM" 5A 4D) at the beginning of the file (the "magic number
Magic number (programming)
In computer programming, the term magic number has multiple meanings. It could refer to one or more of the following:* A constant numerical or text value used to identify a file format or protocol; for files, see List of file signatures...

"). "MZ" are the initials of Mark Zbikowski
Mark Zbikowski
Mark "Zibo" Joseph Zbikowski is a former Microsoft Architect and an early computer hacker. He started working at the company only a few years after its inception, leading efforts in MS-DOS, OS/2, Cairo and Windows NT. In 2006 he was honored for 25 years of service with the company, the third...

, one of the developers of MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

. This is used partly because it disassembles as "dec bp; pop dx" (intel syntax), which no .com will contain as it is an unpredictable result (could crash) and just doesn't do anything useful. You may say at this point "but no .com is going to be a MZ!", but an MZ file can have a ".com" extension, as command.com (the command interpreter on MS-DOS) exceded the 64k limit, but numerous applications executed "command.com"; so microsoft added to their loader a function that checked if the .com was actually an MZ.

The MZ DOS executable file is newer than the COM
COM file
In many computer operating systems, a COM file is a type of executable file; the name is derived from the file name extension .COM. Originally, the term stood for "Command file", a text file containing commands to be issued to the operating system , on many of the Digital Equipment Corporation mini...

 executable format and differs from it. The DOS executable header contains relocation information, which allows multiple segments to be loaded at arbitrary memory addresses, and it supports executables larger than 64 KiB; however, the format still requires relatively low memory limits. These limits were later bypassed using DOS extender
DOS extender
A DOS extender is a computer software program which enables software to run under a protected mode environment even though the host operating system is only capable of operating in real mode....

s.

The environment of an EXE program run by DOS is found in its Program Segment Prefix
Program Segment Prefix
The Program Segment Prefix is a data structure used in DOS systems to store the state of a program. It resembles the Zero Page in the CP/M operating system...

.

Compatibility

MZ DOS executables can be run from DOS and Windows 9x
Windows 9x
Windows 9x is a generic term referring to a series of Microsoft Windows computer operating systems produced since 1995, which were based on the original and later modified Windows 95 kernel...

-based operating systems. 32-bit Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

-based operating systems can execute them using their built-in Virtual DOS machine
Virtual DOS machine
Virtual DOS machine is Microsoft's technology that allows running legacy DOS and 16-bit Windows programs on Intel 80386 or higher computers when there is already another operating system running and controlling the hardware.-Overview:...

 (although some graphics modes are unsupported). 64-bit versions of Windows cannot execute them. Alternative ways to run these executables include DOSBox
DOSBox
DOSBox is emulator software that emulates an IBM PC compatible computer running MS-DOS. It is intended especially for use with old PC games. DOSBox is free software....

, DOSEMU
DOSEMU
DOSEMU, alternatively rendered dosemu, is a compatibility layer software package that enables MS-DOS systems, DOS clones such as FreeDOS, and DOS software to run under Linux on x86-based PCs ....

 and Wine
Wine (software)
Wine is a free software application that aims to allow computer programs written for Microsoft Windows to run on Unix-like operating systems. Wine also provides a software library, known as Winelib, against which developers can compile Windows applications to help port them to Unix-like...

.

MZ DOS executables can be created by linkers, like Digital Mars
Digital Mars
Digital Mars is a small American software company owned by Walter Bright that makes C and C++ compilers for Windows and DOS. They also distribute the compilers for free on their web site....

 Optlink, MS linker, VALX or Open Watcom's WLINK; additionally, FASM
FASM
FASM in computing is an assembler. It supports programming in Intel-style assembly language on the IA-32 and x86-64 computer architectures. It claims high speed, size optimizations, operating system portability, and macro abilities. It is a low-level assembler and intentionally uses very few...

 can create them directly.

See also

  • DOS
    DOS
    DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

  • DOS extender
    DOS extender
    A DOS extender is a computer software program which enables software to run under a protected mode environment even though the host operating system is only capable of operating in real mode....

  • Comparison of executable file formats
    Comparison of executable file formats
    This is a comparison of executable file formats.Among the above formats, the ones in most common use are PE , ELF and Mach-O .- References :...

  • MS-DOS API
    MS-DOS API
    The MS-DOS API is an API used originally in MS-DOS/PC-DOS, and later by other DOS systems. Most calls to the DOS API invoke software interrupt 21h . By calling INT 21h with a subfunction number in the AH processor register and other parameters in other registers, one invokes various DOS services...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK