In DOS, interrupt 21H provides the main interface to the operating system, and most system calls are invoked through it. This page describes
DOS 1.0 Functions
AH=00h - Terminate
Parameters
Return
None (the program terminates).
Description
Legacy exit system call. This function resets the terminate, ctrl-break, and critical error addresses in the PSP. All buffers are flushed, memory used by the application is freed, and the process is terminated via INT 22h.
Notes
This is a legacy function and should be mostly avoided unless its specific behavior is required.
AH=02h - Character Output
AH=04h - Auxilliary Output
AH=05h - Printer Output
AH=06h - Direct Console I/O
AH=09h - Display Cash-Terminated String
AH=0Ch - Clear Keyboard Buffer and Invoke Keyboard Function
AH=0Dh - Disk Reset
AH=0Eh - Select Disk
AH=0Fh - Open FCB
Parameters
- DS:DX - far pointer to an unopened FCB
Return
- AL - 00h on success; otherwise, FFh.
Description
This function is the DOS 1.0 method of opening a file. The FCB shall have been previously initialized with valid device number, filename, and extension values; it must also refer to a file that already exists prior to invocation. On success, the FCB refers to an open file and will have its fields set accordingly.
Note
This is a legacy function and should be avoided. FCBs are a holdover from CP/M which were replaced with proper file handles in DOS 2.0. The responsibility of managing FCBs is delegated to the programmer and the FCBs themselves must reside in conventional memory, making them inconvenient for the programmer. Additionally, neither function AH=00h or AH=4Ch will close open FCBs, leading to the possibility that these files will remain open.
This function yields version-specific behavior that must be taken into account when working with this function. In particular, DOS 2.0 will allow directories to be opened (which DOS 3.0 later forbids) and the values in the reserved area change between DOS versions.
AH=10h - Close FCB
AH=11h - Search for First Entry with FCB
AH=12h - Search for Next Entry with FCB
AH=13h - Delete File with FCB
AH=14h - Sequential Read with FCB
AH=15h - Sequential Write with FCB
AH=16h - Create a File with FCB
AH=17h - Rename a File with FCB
AH=19h - Get Current Default Drive
AH=1Ah - Set Disk Transfer Address
AH=1Bh - Get Allocation Table for Default Drive
AH=1Ch - Get Allocation Table for Specified Drive
AH=1Fh - Get Current Drive Parameter Table
AH=21h - Random Read with FCB
AH=22h - Random Write with FCB
AH=23h - Get File Size with FCB
AH=24h - Set Relative Record Field for FCB
AH=25h - Set Interrupt Vector
AH=26h - Create PSP
AH=27h - Random Block Read with FCB
AH=28h - Random Block Write with FCB
AH=29h - Parse Filename with FCB
AH=2Ah - Get Date
AH=2Bh - Set Date
AH=2Ch - Get Time
AH=2Dh - Set Time
AH=2Eh - Set Verify Flag
DOS 2.0 Functions
AH=2Fh - Get Disk Transfer Address
AH=30h - Get DOS Version
AH=31h - Terminate and Stay Resident
AH=32h - Get Drive Parameter Table
AH=33h - Manipulate System Values
AH=34h - Get Address of Critical Flag
AH=35h - Get Interrupt Vector
AH=36h - Get Free Disk Space
AH=37h - Manipulate Switch Dispatcher
AH=39h - Create Subdirectory
AH=3Ah - Delete Subdirectory
AH=3Bh - Change Subdirectory
AH=3Ch - Create File Handle
AH=3Dh - Open File Handle
AH=3Eh - Close File Handle
AH=3Fh - Read File Handle
AH=40h - Write File Handle
AH=41h - Delete File
AH=42h - Seek File Handle
AH=43h - Change File Mode
AH=44h - Handle I/O Control
AH=45h - Duplicate Handle
AH=46h - Redirect Handle
AH=47h - Get Current Directory
AH=48h - Allocate Memory
AH=49h - Free Memory
AH=4Ah - Reallocate Memory
AH=4Bh - Execute Process
AH=4Ch - Terminate Process with Return Code
AH=4Dh - Get Return Code
AH=4Eh - Find First Matching File with Handle
AH=4Fh - Find Next Matching File with Handle
AH=50h - Set PSP
AH=51h - Get PSP
AH=52h - Get SYSVARS
AH=53h - Generate Drive Parameter Table
AH=54h - Get Verification Flag
AH=55h - Create PSP
AH=56h - Rename File
AH=57h - Get or Set File Timestamp
DOS 2.11 Functions
AH=58h - Get or Set Memory Allocation Strategy
DOS 3.0 Functions
AH=5Ah - Create Temporary File
AH=5Bh - Create New File (DOS 3.0)
AH=5Ch - Lock or Unlock File
AH=5Eh - Network Services
AH=5Fh - Network Redirection
AH=60h - Get Fully-Qualified File Name
AH=62h - Get Address of Current PSP
AH=63h - Get Lead Byte Table
DOS 3.2 Functions
AH=64h - Set External Event Flag
DOS 3.3 Functions
AH=65h - Get Extended Country Info
AH=66h - Manipulate Global Code Page
AH=67h - Set Handle Limit
AH=68h - Flush Buffer
DOS 4.0 Functions
AH=69H - Manipulate Disk Serial Number
AH=6Ah - Commit File
AH=6Ch - Extended Open