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 (INT 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. DOS services include keyboard input, video output, disk file access, executing programs, memory allocation, and various other things. The subfunctions provided in the first release of MS-DOS in 1981 were strongly oriented to compatibility with CP/M. A major revamp of the DOS API (partially influenced by certain Unix concepts) was undertaken for the release of MS-DOS 2.0 in 1983, adding numerous new subfunctions to deal with file I/O using abstract "handles" and support for subdirectories. In these new subfunctions, strings are usually terminated by a NUL byte (ASCIIZ). In MS-DOS version 3.1 (released in 1985), several subfunctions were added for dealing with networks. In MS-DOS version 4, calls were introduced to manage expanded memory according to the Lotus-Intel-Microsoft specification.

There are various implementations of the DOS API, including PC-DOS, MS-DOS, DR-DOS, FreeDOS, PTS-DOS, and others. The DOS API is based on the BIOS, and DOS routines often internally access BIOS interrupt calls.

DOS extenders along with the DOS Protected Mode Interface (DPMI) extend the DOS API to either 16-bit or 32-bit protected mode. The MS-DOS API is partially dependent on x86 code, hence DOS cannot be ported to other processor architectures.

Contents

The MS-DOS API and Windows

Microsoft Windows versions 1.0 through 3.1 were graphical shells that ran on MS-DOS and relied on the MS-DOS API (though using its own API for Windows programs). Windows 9x was also DOS-based, but used a custom version of MS-DOS, mainly as a bootloader. It did not use the MS-DOS API much after booting. However, Windows 9x provided the DOS API to programs running within a command shell window. Earlier Windows 9x versions (at least through the first edition of Windows 98) also can be booted into plain CLI "DOS mode" with no GUI and no Windows system services, for running pure DOS programs. The Windows 9x DOS versions (numbered 7.0 and above) include several new service subfunctions for dealing with long filenames (LFNs).

Windows NT and the systems based on it (e.g. Windows XP and Windows Vista) are not based on MS-DOS, but use a virtual machine, NTVDM, to handle the DOS API. NTVDM works by running a DOS program in virtual 8086 mode (an emulation of real mode within protected mode available on 80386 and higher processors). DOSEMU for Linux uses a similar approach.

Common DOS services

Some basic INT 21h function calls present since DOS version 2.0:

Subfunction
(hex)
Service Parameters Returns
AH = 00 DOS 1+
Terminate program
Never [1]
AH = 01 DOS 1+
Read character from STDIN
AL=character read [2]
AH = 02 DOS 1+
Write character to STDOUT
DL=character [3]
AH = 09 DOS 1+
Write string to STDOUT
DS:DX=pointer to '$' terminated string [4]
AH = 3C DOS 2+
Create or truncate file
CX=file attributes ; DS:DX->ASCIIZ filename CF=1 on error ; AX=error code ; AX=file handle [5]
AH = 3D DOS 2+
Open existing file
AL=access and sharing modes ; DS:DX->ASCIIZ ; CL=attribute mask CF=1 on error ; AX=error code ; AX=file handle [6]
AH = 3F DOS 2+
Read from file or device
BX=file handle ; CX=bytes to read ; DS:DX->data CF=1 on error ; AX=error code or bytes read [7]
AH = 40 DOS 2+
Write to file or device
BX=file handle ; CX=bytes to write ; DS:DX->data CF=1 on error ; AX=error code or bytes written [8]
AH = 3E DOS 2+
Close file
BX=file handle CF=1 on error ; AX=error code [9]
AH = 42 DOS 2+
Set file position
AL=origin of move, 0-start, 1-current, 2-end ; BX=file handle ; CX:DX=(signed) offset CF=1 on error ; AX=error code ; DX:AX=position from beginning [10]

Operating systems with support for the MS-DOS API

  • MS-DOS - Most widespread incarnation
  • PC-DOS - IBM version
  • DR-DOS - Digital Research clone
  • ROM-DOS - Read only memory version
  • FreeDOS - Free, open source
  • Microsoft Windows - 1.x, 2.x, 3.x, and 9x were based on DOS

Programs with support for the MS-DOS API

See also

References


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • DOS/4G — Developer(s) Tenberry Software Stable release 2.01 / April 3, 1996; 15 years ago (1996 04 03) …   Wikipedia

  • DOS MZ executable — Filename extension .exe Magic number MZ Type of format Binary, executable Extended to New Executable Linear Executable Portable Executable The DOS MZ executable f …   Wikipedia

  • DOS/4GW — is a 32 bit DOS extender that allows DOS programs to eliminate the 640 KB conventional memory limit by addressing up to 32 MB of extended memory on Intel 80386 and above machines. It can operate within MS DOS, PC DOS, DR DOS and other DOS clones …   Wikipedia

  • API del MS DOS — El API del MS DOS o MS DOS API es un API usado originalmente en MS DOS/PC DOS, y más adelante por otros sistemas DOS. La mayoría de las llamadas al DOS API invocan la interrupción de software 21h (INT 21h). Llamando la INT 21h con un número de… …   Wikipedia Español

  • DOS Protected Mode Interface — In computing, the DOS Protected Mode Interface (DPMI) is a specification introduced in 1989 which allows a DOS program to run in protected mode, giving access to many features of the processor not available in real mode. It was initially… …   Wikipedia

  • DOS extender — Tenberry Software s DOS/4GW startup banner 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. DOS… …   Wikipedia

  • DOS — This article is about the family of operating systems for IBM PC compatible computers. For other uses, see DOS (disambiguation). FreeDOS screenshot showing the command line interface, directory structure and version information. DOS, short for… …   Wikipedia

  • DOS — Dieser Artikel behandelt Betriebssysteme. Weitere Bedeutungen der Abkürzung DOS findet man unter Dos. Als Disk Operating System [dɪsk ˈɒpəɹeɪtɪŋ ˈsɪstəm] (kurz DOS) werden kleine und einfache Betriebssysteme für Computer bezeichnet, deren… …   Deutsch Wikipedia

  • DOS Protected Mode Interface — DOS Protected Mode Interface, kurz DPMI, ist eine API zur Entwicklung von DOS basierten Anwendungen, die mehr als den sogenannten „konventionellen Speicher“ von 640 KB (655.360 Byte, siehe auch UMB) direkt nutzen, ohne Umwege über Bank… …   Deutsch Wikipedia

  • DOS-Extender — DOS Protected Mode Interface, kurz DPMI, ist eine API zur Entwicklung von DOS basierten Anwendungen, die mehr als den sogenannten „konventionellen Speicher“ von 640 KB (655.360 Byte, siehe auch UMB) direkt nutzen, ohne Umwege über Bank Switching …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”