DOS API: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Mtbanger (talk | contribs)
No edit summary
RCX (talk | contribs)
m Wikilinking
Line 1: Line 1:
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 the subfunction in AH and the 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.
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 the subfunction in AH and the 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.


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


The [[DOS Protected Mode Interface]] extends the DOS API to 32-bits. The MS-DOS API is partially dependent on x86 code, hence DOS cannot be ported to other chip architectures.
The [[DOS Protected Mode Interface]] extends the DOS API to 32-bits. The MS-DOS API is partially dependent on x86 code, hence DOS cannot be ported to other chip architectures.

Revision as of 21:00, 15 August 2009

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 the subfunction in AH and the 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.

There are various implementations of the DOS API, including MS-DOS, PC-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.

The DOS Protected Mode Interface extends the DOS API to 32-bits. The MS-DOS API is partially dependent on x86 code, hence DOS cannot be ported to other chip architectures.

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 an emulation of the DOS API for programs running within a command shell window, including several new subfunctions for dealing with LFNs. These DOS LFN subfunctions were not included in Windows NT, but in later versions such as Windows XP.

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 1.0:

Subfunction Parameters Returns Service
AH=0h never TERMINATE PROGRAM
AH=1h AL=character read READ CHARACTER FROM STDIN
AH=2h DL=character WRITE CHARACTER TO STDOUT
AH=9h DS:DX=pointer to '$' terminated string WRITE STRING

Operating systems with support for the MS-DOS API

Programs with support for the MS-DOS API

See also

References

  • Description of MS-DOS services
  • The New Peter Norton Programmer's Guide to the IBM PC & PS/2 by Peter Norton and Richard Wilton, Microsoft Press, 1987 ISBN 1-55615-131-4.