UMBCCMSC 211Fall 1999

CSEE| 211| 211 F'99| lectures| news| help


CMSC211 Assembly Language Programming

Interrupt 21 Functions

FuncPurpose InputOutputDescriptionComments
00h Program TerminationAH = 00h
CS = segment address of PSP
nothingTerminates execution of the current process and returns control of the parent process.COM programs store the segment address of the Program Segment Prefix (PSP) in the CS register automatically. For an EXE program, do not use this function, use Function 31H or 4Ch instead.
01h Keyboard Input AH = 01hAL = character readReads a character from a standard input device and displays it on the standard output device. When the function is called, it waits until a character is available. This can be redirected.This function must be called twice to read extended ASCII codes on IBM and compatible PCs. The first call returns 0 in the AL register. If the character being read is the Ctrl-C character and input is not redirected, this function calls interrupt 23h. If standard input has been redirected, a Ctrl-C character is read and BREAK is ON, then this function calls interrupt 23h.
02h Display Output AH = 02h
DL = character to send to standard output
nothingDisplays a character on the standard output device. This can be redirected.If standard output has not been redirected, then control codes such as backspace, carriage return and linefeed are preformed when this function sends characters to the screen. If output has been redirected, these codes are sent to the file as ordinary ASCII codes.
03h Auxiliary Input AH = 03hAL = character readReads a character from the serial port. The default is the COM1. The MODE command can redirect serial access.In most systems, the serial device has no internal buffer and is not interrupt driven. This means that it can send data faster than programs can read them. All unread characters may be lost.
Before calling this function, you must initialize the serial port by performing the MODE command. When starting up, the serial port is initialized to 2400 baud, one stop bit, no parity, and 8 data bits
The ROM BIOS functions of INT 14h are more efficient for accessing the serial port. This interrupt can be used to obrtain the status of the auxiliary device, which make them more flexible.
04h Auxiliary Output AH = 04h
DL = character to send
nothingSends a character to the serial port. The default is the COM1. The MODE command can redirect serial access.See comments for 03h.
05h Printer Output AH = 05h
DL = character to print
nothingSends a character to the standard list device. By default, this is LPT1:. The MODE command allows you to redirect printer access.The function transmits the character only when the output device is ready to accept it.
The functions of the ROM BIOS IN 17h are more efficient for accessing the printer.
06h Direct Console Character I/OAH = 06h
DL = 00h - FEh sends a character
DL = FFh - reads a character
Character output: nothing
Character input:
no character ready:

ZF = 1: No character ready
Character received:
ZF = 0 ; Character received
AL = character read
Reads a character from the standard input device and writes a character to the standard output device. This function is used to read and write all poissible characters and control codes without examining them (e.g., Ctrl-C has not effect on the program). Input and output for standard devices can be redirected. This funtion does not test whether the floppy disk or hard disk is full when it is writing. Neither can it tell whether all the characters have been read from the input device.This function must be called twice to read extended ASCII codes on PCs. The first call returns 0 in the AL register (this indicates presence of an extended code).
This function cannot display blanks (ASCII code 255) because it interprets that value as a command to input a character.
If a character is receceived, it is oched to STDOUT.
Ctrl-C or Crtl-Break are not checked.
07h Unfiltered Character Input Without EchoAH = 07hAL = CharacterReads a character from the standard input device without displaying it on the standard output device. If the character is not ready when the function is called it waits until a character is available. Input to a standard device can be redirected. The OS does not test the input character.To read extended ASCII codes, the function must be called twice. The first call returns 0 in the AL register, indicating an extended code.
08h Character Input Without EchoAH = 08hAL = CharacterReads a character from the standard input device without displaying it on the standard output device. If the character is not ready, it waits until a character is available.To read extended ASCII codes, the function must be called twice. The first call returns 0 in the AL register, indicating an extended code.
09h Display ASCIIZ StringAH = 09h
DS:DX = segment:offset of the string
nothingDisplays a character string to the standard output device. The string must be terminated with the dollar sign character '$'. Control codes such as carriage return, linefeed, and backspace can be embedded within the string.
0Ah Buffered Keyboard InputAH = 0Ah
DS:DX = segment:offset of the buffer
nothingReads a string of bytes from the standard input device and sends the characters to a buffer. This function echoes characters to the standard output device. The input ends when it receives a carriage return code.Uses the buffer in the following format:
OffsetSizeDescription
00h1maximum number of characters (including the carriage return) buffer can hold
01h1number of characters
02hnactual characters read from input including the carriage return which terminated the string
0Bh Check Input StatusAH = 0BhAL = 00h if no character is available
AL = FFh one or more characters available
Determines whether standard input device has a character available for readingIf this function detects Ctrl-C and Ctrl-Break it calls INT 23h
0Ch Flush Input Buffer and Read Standard InputAH = 0Ch
AL = function to be called after clearing buffer
DS:DX = segment:offset of input buffer (if AL = 0Ah)
AL = input character (if called with AL = 01h, 06h, 07h, 08h)Clears the type-ahead input buffer and then performs one of the character input functions 01h, 06h, 07h, 08h, or 0Ah.If AL is not 01h, 06h, 07h, 08h, or 0Ah, this function flushes the buffer and passes control to the calling function.
0Dh Disk Reset AH = 0DhnothingWrites all data stored in the internal DOS buffers to the disk.This function prevents access to new data, as it does not update the directory for all open files.
0Eh Select Default Disk DriveAH = 0Eh
DL = Drive number
(00h = A, 01h = B ,etc)
AL = number of logical drivesDefines the current or default disk and returns the number of available drives.With DOS 3.0 and later, this function returns the number 5 or the drive code corresponding to the LASTDRIVE value in AL.
19h Get Current Disk AH = 19hAL = drive (01h = A:, 02h = B:, etc)Determines the number of the current or default disk drive 
1Ah Set Data Transfer Address (DTA)AH = 1Ah
DS:DX = segment:offset of DTA
nothingEstablishes the address of buffer area in memory to use as the current DTA for FCB-related function calls.When the program starts, the DTA is set to a 128 byte buffer at offset 0080h in the PSP.
It is recognized as an error and aborts a disk transfer if DTA is at the end of a segment and disk transfer exceeds the end of the segment.
DOS does not test the length of the DTA. You must create a DTA of any size, less than 64K, that is large enough for any disk operation that will use it.
1Bh Get Default Drive DataAH = 1BhAL = sector/cluster
CX = bytes/sector
DX = number of clusters
DS:BX = segment:offset of media ID byte
values: DS/SS, sectors/track
FFh = DS, 8
FEh = SS, 8
FDh = DS, 9
FCh = SS, 9
F9h = DS, 15
F8h = hard disk
F0h = other
Get the information about the size of the default disk drive. 
1Ch Get Disk Data AH = 1Ch
DL = drive (00h = default, 01h = A:, etc)
AL = sector/cluster
CX = bytes/sector
DX = number of clusters
DS:BX = segment:offset of media ID byte
Get informat about the size of a specified disk drive.Identical to Fucntion 1B except the any drive can be specified.
1Fh Get Drive Parameter Block (DPB) for current driveAH = 1FhAL = 00h if function successful
DS:BX = segment:offset of DPB
AL = FFH, if invalid drive
Gets information about the disk parameters for the current drive.For DOS 4.0 - 5.0, the DPB has the following format:
OffsetSizeDescription
00h1Drive number (0=A:,1=B:,etc)
01h1unit number within device driver
02h2bytes per sector
04h1highest sector number within cluster
05h1shift count to convert clusters into sectors
06h2number of reserved sectors at beginning of drive
08h1number of FATs
09h2number of root directory entries
0Bh2number of first sector containing user data
0Dh2highest cluster number (number of clusters + 1)
0Fh2number of sectors per FAT
11h2sector number of first directory sector
13h2address of device driver header
17h1media ID byte
18h100h if disk is accessed, FF if not
19h4pointer to next DPB
1Dh2cluster at which to start search for free space when writing
1Fh2number of free clusters on drive, FFFFh = not known
25h Set Interrupt VectorAH = 25h
AL = interrupt number
DS:DX = segment:offset address of new interrupt handler
nothingSets a specfied interrupt vector to point to another handling routine.This function is a better way to change interrupt handlers than direct modification ofjwinga@mindspring.com the interrupt vector table
Before this function is called, the initial contents of the interrupt vector table must be retreived using Function 35h, and saved. Later, the original interrupt vector should be restored.
26h Create new PSPAH = 26h
DX = segment address of new PSP
nothingCopies the PSP from the PSP of the executing program to a specified address in the memory.This function is obsolete. Use Function 4Bh instead.
29h Parse Filename into FCBAH = 29h
AL = parsing option:
bitmeaning
00: skip leading separators
11: set driver specifier in FCB only if the filename is specified on the command line
10: the drive specifier will be changed anyway; if no drive specified on the command line, FCB drive code is set to 0 (default).
21: set filename only if filename is specified on command line
20: the filename will be changed; if the filename is not present, FCB filename is set to blanks
31: set extension only if extension specified on the command line
30: the extension will be changed

DS:SI = segment:offset of string
ES:DI = segment:offset of file control block (FCB)
AL = return status (00h - no wildcards encountered, 01h - wildcard present, FFh - invalid drive specifier)
DS:SI = segment:offset of first unparsed character
ES:DI = segment:offset of buffer with unopened FCB
Parses a character string and copies into the appropriate fields of an FCB. The string can include drive, filename and file extension.If the filename or extension contain asterisks, then they are changed to question marks in the FCB.
The filename must terminate with a null byte (ASCII code 0).
This function cannot be used with a file specification which includes a path.
2Ah Get DateAH = 2AhCX = year (1980 - 2099)
DH = month (1-12)
DL = day
AL = day of the week (0 = Sunday, 1 = Monday, etc)
Gets the current system date from the system calendar 
2Bh Set DateAH = 2Bh
CX = year (1980 - 2099)
DH = month (1 - 12)
DL = day
AL = 00h if date set successful
= FFh if invalid date.
Changes the current system date to a specific date.This function does not change the system time.
2Ch Get TimeAH = 2ChCH = hours (0 - 23)
CL = minutes (0 - 59)
DH = seconds (0 -59)
DL = 1/100 seconds (0 - 99)
Reads the current system time.Resolution may be 5/100 of a second.
2Dh Set TimeAH = 2Dh
CH = hours (0 - 24)
CL = minutes (0 - 59)
DH = seconds (0 - 59)
DL = 1/100 seconds
AL = 00h if function is successful
= FFh if invalid time (ignored)
Sets the current system time 
2Eh Set Verify FlatAH = 01h
AL = 00h Do not verify data
= 01h Verify data
nothingToggles the disk write verification flag. This flag determines that data must be verified once it has been written.The default flag is OFF because this is a slow disk operation.
2Fh Get Disk Transfer Address (DTA)AH = 2FhES:BX = segment:offset of DTADetermines the address of a current disk data buffer for all FCB file read and write operations.The default DTA starts at offset 80h in the PSP and has a length of 128 bytes.
30h Get MSDOS Version NumberAH = 30h
AL = Determines information returned in BH
= 00h - Manufacturers ID
= 01 - Flag
AL = major version number
AH = minor version number
BH = OEM's serial number
= 00h IBM PC DOS
= FFh MSDOS
BH = version flag
= 08 DOS in ROM
= 10h DOS in XMA
Determines the MSDOS version number 
31h Terminate and Stay Resident (TSR)AH = 31h
AL = return code
DX = number of paragraph to be kep resident
nothingTerminates the program currently being executed and passes control to the calling program, withing releasing resources allocated to the current process. The current process stays resident in the memory and waits for another call.The parent process can read the return code in the AL register with Function 4Dh. Alternatively it can can be tested in a batch file by the ERRORLEVEL and IF statements. A non-zero return code usually indicates an error. The number of the 16-bit paragraph in the DX register indicates the initial memory allocation block, beginning with the PSP. This memory cannot be released for use by Function 48h. This memory can only be relased by Function 49h.
32h Get DOS Driver Parameter Block (DPB) for Specific DriveAH = 32h
DL = drive (0 = current, 1 = A; etc)
AL = 00h if function is successful
DS:BX = segment:offset of DPB
AL = FFh invalid drive
Get information about disk parameters for a specific drive
OffsetSizeDescription
00h1Drive number (0=A:,1=B:,etc)
01h1unit number within device driver
02h2bytes per sector
04h1highest sector number within cluster
05h1shift count to convert clusters into sectors
06h2number of reserved sectors at beginning of drive
08h1number of FATs
09h2number of root directory entries
0Bh2number of first sector containing user data
0Dh2highest cluster number (number of clusters + 1)
0Fh2number of sectors per FAT
11h2sector number of first directory sector
13h2address of device driver header
17h1media ID byte
18h100h if disk is accessed, FF if not
19h4pointer to next DPB
1Dh2cluster at which to start search for free space when writing
1Fh2number of free clusters on drive, FFFFh = not known
33h/00h or 01hGet or Set Break FlagAH = 33h
AL = 00h if getting break flag
= 01 if setting break flag
DL = 00h if turn break flag OFF
= 01 if truning break flag ON
DL = current state
00h - break flag is OFF
01h - break flag is ON
Reads and chages the state of the Ctrl-Break check flag.When the system break flag is on, this function determines whether DOS should check the keyboard to see if the Ctrl-C or Ctrl-Break keys have been pressed. When this flag is off, it checks for traditional character input/output.
Since the Ctrl-Break flag is not part of the environment block of the current program, it affects all programs which use DOS functions fo character input/output and which check Ctrl-C and Ctrl-Break.
33h/02h Get and Set Extended Control-Break Checking StateAH = 33h
AL = 02h
DL = 00 if checking OFF
01 if checking is ON
DL = old state of extended break checkingObtains an changes the state of the Control-Break flag.This function is full re-entrant.
33h/05h Determine Boot Drive NumberAH = 33h
AL = 05h
DL = boot drive (1=A, 2+=B, etc)Reads the system boot drive 
33h/06h Get Acutal Version Number AH = 33h
AL = 06h
BL = major version
BH = minor version
DL = revision
DH = version flag
bit 3=1 DOS is in ROM
bit 4 = DOS is in HMA
Reads the actual version of MS-DOS.This function returns the actual version of MS-DOS even if the DOS command SETVER has changed the version.
34h Get Address of InDOS FlagAH = 34hES:BX = segment:offset of InDOS flagReads the address of Critical Section (InDOS) flag. This indicates that INT 21h Function is working.The value of the InDOS flag is incremented when an INT 21h fucntion begins to work and decremented when it is completed.
During INT 28h, call the falue in InDOS flag may be 01h instead of zero. Burt in this case the functions from 01h to 0Ch INT 21 only may be calledl There may, however be occasions when DOS is busy but the InDOS flag is zero. This is possible because during its operation, the critical error handler decrements InDOS and increments the critical error flag.
The Critical error flag is the byte before the InDOS flag in DOS 3+.
This function may be called once at the beginning of a program only.
35h Get Interrupt VectorAH = 35h
AL = interrupt number
ES:BX = segment:offset of interrupt handlerGets the address of the interrupt service routine for a specific interrupt vector.This function must be used to ensure compatability with future versions of DOS.
38h Get or Set Country Specific InformationAH = 38h
AL = 1-0FE for specific country with code < 255
0FFh for specific code >= 255
BX = country code, if AL=0FFh
DX = 0FFFFH
CF = 0 function is successful
BX = country code
DS:DX = segment:offset of buffer filled with info as follows:
OffsetSizeDescription
00h2date format
0=USA mm dd yy
1=Europe dd mm yy
2=Japan yy mm dd
02h5ASCIIZ currency symbol string
07h1Thousand separator character
08h100h
09h1decimal separator character
0A 100h
0B1date separator character
0Ch100h
0Dh1time separator character
0Eh100h
0Fh1currency format
bit 0=0 if currency symbol precedes value
1 if currency symbol follows value
bit 1=0 if no space between value and currency symbol
1 if one space between value and currency symbol
bit 2=0 if currency symbol and decimal are separate
=1 if currency symbol replaces decimal separator
10h1number of digits after decimal in currency value
11h1 time format:
bit 0 = 0 if 12-hour clock
= 1 if 24-hour clock
12h4address of case map routine
16h1data list separator character
17h100h
18h10reserved

CF = 1 if unsuccessful
AX = error code
Obtains country specific information or sets the current country parametersThe case map address in 12-15h is the segment:offset address of the FAR procedure which is used for performing country specific conversions of character codes from 80h through 0FFh. This procedure must be called with the character to be converted to a capital letter in the AL register. If a capital letter already exists for the character in the AL register, it is returned in AL after the function call, otherwise the contents of AL remain unchanged.
39h Create DirectoryAH = 39h
DS:DX = segment:offset of ASCIIZ pathname
CF = 0 if successful
CF = 1 if unsuccessful
AX = error code
= 03h Path not found
= 05h Access denied
Creates a new subdirectory in a specified drive.An error will occur if:
Any element of the pathname does not exist.
A subdirectory with the same name already exists
A subdirectory is to be created in a root directory which is alread full.
3Ah Delete DirectoryAH = 3Ah
segment:offset of ASCIIZ pathname
CF = 0 if successful
CF = 1 if unsuccessful
AX = error code
= 03h if path not found
= 05 if Access denied
= 10h if attempt to remove current directory
Deletes a subdirectory on a specified drive.An error will occur if:
Any element of the pathname does not exist.
The specified directory is the current directory.
The specified directory contains no files.
3Bh Set Current DirectoryAH = 3Bh
DS:DX = segment:offset of ASCIIZ pathname
CF = 0 if successful
CF = 1 if unsuccessful
AX = error code
= 03 if path not found
Changes current or default directory for a specified path and drive.An error will occur if any element of pathname does not exist. If the new pathname includes a drive letter, the default drive will not be changed.
3Ch Create FileAH = 3Ch
CS = file attribute
bit 0: read-only file
bit 1: hidden file
bit 2: system file
bit 3: volume label (ignored)
bit 4: reserved
bit 5: archive bit
bit 6: reserved
DS:CS = segment:offset of ASCIIZ pathname
CF = 0
if successful
AX = handle
CF = 1 if unsuccessful
= 03 Path not found
= 04 No available handle
Access denied
Creates a new empty file on a specified drive with a specified with a specified pathname.Wildcards are not permitted in the filename.
An error will occur if any element of pathname does not exist; the file is to be created in a root directory which is full; or a file with the same name and read-only attribute exists in the current directory.
If a file with the same name exists, it is truncated to zero length.
3Dh Open FileAH = 3Dh
AL = access mode
bits 0-2: access mode:
000 = read only
010 = write only
010 = read/write
bit 3: reserved (0)
bits 4-6: Sharing mode:
= 000 compatibility mode
= 001 deny all (only current program can access file)
= 010 deny write (other program can only read from file)
= 011 deny read (other programs can only write into file)
= 100 deny none (other programs can read and write the file)
DS:DX = segment of ASCIIZ pathname
CF = 0 if successful
AX = handle
CF = 1 if unsuccessful
AX = error code
= 01h missing file sharing software
= 02h file not found
= 03h path not found or file does not exist
= 04h no handle available
=05 access denied
= 0Ch access mode not permitted
Opens an existing file for reading, writing or appending on the specified drive and specified pathname.Wildcards are not permitted in the filename. If the drive or path are omitted in the filename, DOS accesses the current drive or directory.
An error will occur if any element of pathname does not exist, or if the file has the read-only attribute set and is opened in the read/write access mode.
The file pointer is set to the first byte of file.
File handlers which are inherited from a parent process also inherit all sharing and access restrictions.
3Eh Close FileAH = 3Eh
BX = handle
CF = 0 if successful
AX is destroyed
CF = 1 if unsuccessful
AX = error code
= 06 File not opened or unauthorized handle
Writes all information in internal DOS buffers associated with the file to disk and updates directory information, then closes the file.Do not call this function with a zero handle (standard input) and you won't be able to enter characters from the keyboard.
3Fh Read File or DeviceAH = 3Fh
BX = handle
CX = number of bytes to be read
DS:DX = segment:offset of buffer
CF = 0 if successful
AX = number of bytes read
CF = 1 if unsuccessful
AX = error code
= 05h access denied
06 illegal handle or file not opened
Reads a given number of bytes at the current file pointer position, from a previously opened file, with a given valid handle or device, to a buffer.If the CF is clear after the function call and AX = 0, it means that the file pointer was already at the end of the file and the file cannot be read.
If the CF is clear after the function call and the value in AX is small than the value in CX, it means that only part of a record was read, either because the end of file was reached or an error occurred.
If the call is successful, the file pointer position is updated after the function call.
If this function is used to read from a file with handle 0 (standard input device -- keyboard ), it stops reading after the first CR, or once a specified number of characters have been read.
40h Write File or DeviceAH = 40h
BX = handle
CX = number of bytes to write
DS:DX = segment:offset of buffer
CF = 0 if successful
number of bytes written
CF = 1 if unsuccessful
AX = Error Code
= 05 Access denied
= 06 Illegal handle of a file which is not opened
Writes a given number of bytes at the current file pointer position, to a previously opened file, with a given valide handle or deviceThis function writes to a file with a valid handle or to a stardand output device. If CF = 0 and AX< CX, only a partial record was written, either because EOF was reached, or there was a DOS error (disk full).
If CF = 0 and CX = 0 it means that no data is written and the file is truncated or extended to the current position of the file.
If successful, the file pointer is updated after the function.
41h Delete FileAH = 41h
DS:DX = segment:offset of ASCIIZ pathname
CF = 0 if successful
CF = 1 if unsuccessful
AX = Error Code
= 02h file not found
= 03h path not found or file does not exist
= 05h access denied
Erases a specified fileThis function cannot delete subdirectories or volume names. This function does not erase data in a file. It only replaces the first symbol in the filename in the directory with the hex code 0E5h and marks the FAT Chain for this file as "free".
Wildcards are not permitted in file specification.
An error occurs if an element in the pathname does not exist, or the file has the Read-Only Attribute set.
42h Set File PointerAH = 42h
AL = offset code
= 00h absolute offset from start of file
= 01 signed offset from current file pointer
= 02h signed offset from end of file.
BX = handle
CS = most significant part of offset
least significant part of offset
CF = 0 if successful
DX = high word of file pointer
AX = low word of file pointer
CF = 1 if unsuccessful
AX = error code
= 01h illegal offset code
= 06 illegal handle or file not open
Moves the file location pointer to a specified position in the file.This function always return the result absolute byte offset from the start of the file in DX:AX.
For offset codes 01h and 02h, the file pointer may be position before the start of the file. The file pointer can also be set after the end of th file. No error will be returned at this point, but a subsequent attempt to read or write will create errors.
YOu can get the size of the file using the offfset code 06 and offset of 0. After callint, examine the file pointer location.
43h/01-02hGet or Set File AttributesAH = 43h
AL = 00h to get attributes
= 001 to set attributes
CS = file attributes (if AL = 01h)
= bit 0: read-only
= bit 1: hidden
= bit2: system
= bit 3: volume label
= bit 4: directory
= bit 5: archive
bits 6-15: reserved
DS:DX = segment:offset of ASCIIZ pathname
CF = 0 if successful
CX = file attribute
= bit 0: read-only
= bit 1: hidden
= bit2: system
= bit 3: volume label
= bit 4: directory
= bit 5: archive
bits 6-15: reserved
CF = 0 if unsuccessful
AX = error code
= 01h unknown function code
= 02 file not found
= 03h path not found
attribute cannot be changed.
Determines or sets file attributes for a specified file.Wildcards are not permitted in the pathname. This function can not change the volume label or directory attributes.
An error occurs if an element in the pathname does not exists.
44h/00h Get Device InformationAH = 44h
AL = 00h
BX = handle
CF = 0 if successful
DX = device information word
character device if bit 7 is set:
bit 0if standard input
bit 1if standard output
bit 2if NUL device
bit 3if clock device
bit 4reserved
bit 50 if handle is in the ASCII mode, else binary mode
bit 60 if EOF on input
bit 8 - 10reserved
bit 111 drive supports Open/Close calls
bit 12 - 13reserved
bit 14if IOCTL subfunctions are supported
bit 15reserved
disk file if bit 7 is clear
bit 0 - 5drive number (0 = A, 1 = B, etc.)
bit 6if file has not been written
bit 8 - 15reserved
CF = 1 if unsuccessful
AX = error code
01hunknown function code
05hif access denied
06hhandle not opened or does not exist
Gets information about a specified file or deviceDH corresponds to the high byte of the attribute word of the handle for the character device.
in the binary ("raw") mode MSDOS treats all characters as data. In the ASCII ("cooked" mode, MSDOS checks the character stream and performs the relevant function, if a special character Ctrl-C, Ctrl-S, Ctrl-P, Ctrl-Z or CR is detected.
44h/01h Set Device InformationAH = 44h
AL = 01h
BX = handle
DXdevice informtion word
bit 0if standard input
bit 1if standard output
bit 2if NUL device
bit 3if clock device
bit 4reserved (0)
bit 50 if ASCII (cooked)/1 if binary (raw)
bit 6reserved (0)
bit 7indicating device
bit 8- 15reserved (0)
CF = 0 if successful
CF = 1 if unsuccessful
AX= error code:
01hunknown function code
05hattribute can not be changed
06hhandle not opened or does not exist
0Dhinvalid dat
Sets specific characteristics of the character device.This function is useful for switching between ASCII (cooked) and binary (raw) modes, when the handle is associated with a character device.
44h/02h IOCTL: Read Control Data from Character Device Driver DOSAH = 44h
AL = 02
BX = handle
CX = number of bytes to be read
DS:DX = segment:offset of buffer
CF = 0 if successful
AX = number of bytes read
CF = 1
AX = error code
01h unknown function code
05haccess denied
06hhandle not opened or does not exist
0Dhinvalid data
Reads data specific to each character device driver from a character deviceThe character device driver defines the structure and type of control data.
This function can be used for reading hardware dependent information and status information of the character device, if this device supports this function. This information cannot usually be obtaned by other DOS functions.
44h/03h IOCTL: Write Control Data from Character Device Driver DOSAH = 44h
Al = 03h
BX = handle
CX = number of bytes to be written
DS:DX = segment:offset of data
CF = 0 if successful
AX = number of bytes sent
CF = 1 if unsuccessful
AX = error code
01hunknown function code
05hattribute cannot be changed
06hhandle not opened or does not exist
0Dhinvalid data
Writes control data specific to each character device from an application directly to a specified character device.If this function is support by a character device driver, it can be used to perform certain hardware dependent operations. These operations are not usually supported by other MSDOS function calls.
44h/04h IOCTL: Read Control Data from Block Device Driver DOSAH = 44h
AL = 04h
BL = drive code (0 = default, 1=A, etc.)
CX = number of bytes to be read
DS:DX = setment:offset of buffer
CF = 0 if successful
AX = number of bytes read
CF = 1 if unsuccessful
AX = error code
01hunknown function code
05hattriubte cannot be changed
06hhandle not opened or does not exist
0Dhinvalid data
Reads control data directly from the block device into the buffer.This function can be used if the block device driver supports the IOCTL call
44h/05h IOCTL: Write Control Data from Block Device Driver DOSAH = 44h
AL =05h
device code
CX = number of bytes to be written
DS:DX = segment:offset of data
CF = 0 if successful
AX = number of bytes sent
CF = 1 if unsuccessful
AX = error code
=01h unknown function code
= 05h attribute cannot be changed
= 06h handle not open or does not exist
= 0Dh invalid data
Write data specific to each character device control from an application program directly to a block device. The format and structure are specific to each device. If this function is supported by a character device driver, it can be used to perform certain hardware dependent operations. These operations are usually not supported by other MSDOS function calls.
44h/06h IOCTL: Check Input StatusAH = 44h
AL = 06h
BX = handle
CF = 0 if successful
AX = 00h device not ready or EOF on file
CF = 1 if unsuccessful
AX = error code
= 01h unknown function code
= 05h attribute cannot be changed
= 06h = handle not opened or does not exist
= 0Dh invalid data
Reads the status of the specified device to determin whether the device can read data.This function can be used to check the status of certain character devices that do not have their own MSDOS functions for status checking (for example, serial port).
44h/07h IOCTL: Check Input StatusAH = 44h
AL = 07h
BX = handle
CF = 0 if successful
AL = 00h device not ready
= 01 device is ready
CF = 1 if unsuccessful
AX = error code
= 01 unknown function code
= 05h attribute cannot be changed
= 06h handle not opend or does not exist
= 0Dh invalid data
Reads the status of a specified device that determines whether this device can write data.This function always returns the ready status indicating that all files are ready for output, even if the disk is full or there is no disk in the drive.
44h/08h IOCTL: Check if Block Device is RemovableAH = 44h
AL = 08h
BL = device number (0=default, 1=A, etc.)
CF = 0 if successful
AL = 00h if media is removable
= 01 if media is not removable
CF = 1 if unsuccessful
AX = error code
= 01h unknown function code
= 0F invalid drive
Determines where the block device media (disk, hard disk, etc.) of the specified block device can be changed. 
44h/09h IOCTL: Check if Block Device is RemoteAH = 44h
AL = 09h
BX = drive number (0=default, 1=A, etc.)
CF = 0 if successful
DX = device attribute word
bit 15=1 drive is SUBSTituted
bit 12=0 drive is local
bit 12=1 drive is remote
CF = 1 if unsuccessful
AX = error code
= 01h unknown function code
= 0Fh invalid drive
Determines whether the specified block device is local (part of the PC that is used as a workstation) or remote (part of a network server). This subfunction can be used if network software has beeen installed previously.
44h/0Ah IOCTL: Check if Handle is RemoteAH = 44h
AL = 0Ah
BX = handle
CF = 0 if successful
DX = attribute word for file or device
bit 15 = 0 if local
= 1 if remote
CF = 1 if unsuccessful
AX = error code
= 01h unknown function code
06h handle not opened or does not exist
Determines whether the specif handle refers to a file on a remote or local device. This subfunction can be used if network sofware has been install previously.
44h/0Bh IOCTL: Change Sharing Retry CountAH = 44h
AL = 0Bh
CS = pause between attemps (default = 1)
DX = number of attempts (default = 3)
CF = 0 if successful
CF = 1 if unsuccessful
AX = error code
= 01 unknown error code
Sets the number of attempts which MSDOS will perform after the SHARE utility fails to open or lock a file. This subfunction can be used if network software has been installed previously.
The value in the CX register defines the delay which perfrom by executing empty cycles:
xor cx,cx
loop $; repeat this command 65536 times
Consequently, the value of the delay depends of the processor speed.
44h/0Ch IOCTL: Generic I/O Control for Character DeviceAH = 44h
AL = 0Ch
CH =
valueCategory Code
00hunknown
01hCOM1, COM2, COM3, or COM4
03hCON
05hLPT1, LPT2, or LPT3

CL =
valuefunction
45hSet Iteration Count
4ahSelect Code Page
4chSet Code Page Preparation
40hEnd Code Page Preparation
5fhSet Display Information
65hGet Iteration Count
6ahQuery Selected Code Page
6bhQuery Prepared List
7fhGet Display List

DS:DX = segment:offset of parameter block
CF = 0 if successful
DS:DX = segment:offset of parameter block if CL = 65h, 6ah, 6bh, or 7f
CF = 1 if unsuccessful
AX = error code
Various calls for a character from an applicationThe parameter block for CL = 45h has the following format:
OffsetSizeDescription
00h2Number of times the device driver will wait before the driver assumes that the device is busy.
The parameter block for CL = 4Ah and 6Ah has the following format:
OffsetSizeDescription
00h2length of data
02h2code page ID
04h2N bytesDCBS (Double Byte Character Set) lead byte range start/end for each N range
The parameter block for CL = 4Ch has the following format:
OffsetSizeDescription
00h2font type bit 0 = 0 downloaded
= 1 cartridge
bits 1-5 reserved (0)
44h/0Dh IOCTL: Generic I/O Control for Block DeviceAH = 44h
AL = 0Dh
BX = drive number (00h=default, 01h=A, etc)
CH =
valuecategory code
08hdisk drive

CL =
valuefunction
40hset device parameters
41hwrite logical device track
42hformat and verify track
46hset volume serial number
47hset access flag
60hget device parameters
61hread track
62hverify track
67hget access flag
CF = 0 if successful
DS:DX = segment:offset of parameter block if CL=60h or 61h
CF = 1 if unsuccessful
= error code
Transfers miscellaneous requests from application programs to block device drivers The parameter block for functions 40h and 60 has the following format:
OffsetSizeDescription
00h1
bitspecial functions
0= 0 device BIOS Parameter Block (BPB) contains a new default BPB
0= 1 function uses current BPB
1= 0 Functions used all field in the parameter block (if CL=60h)
1= 1 function uses track layout field
2= 0 sectors in track may be different sizes
2= 1 sectors in track are all the same size
3-7 reserved (0)
01h2
valuedevice type
00h320/360k disk
01h1.2M 5.25 inch disk
02h720K 3.5 inch disk
03hsingle density 8-inch disk
04hdouble-density 8-inch disk
05hfixed disk
06htape drive
07h1.44M 3.5 inch disk
08hother type of block device
02h2
bitdevice attributes
0= 0 removable storage medium
0= 1 nonremovable storage medium
1= 0 door lock is not supported
1= 1 door lock is supported
2-15reserved (0)
04h2number of cylinders
06h1
valuemedia type
00h1.2M 5.25 inch disk (default)
01h320/360k 5.25 inch disk
07h31device BPB
26h2number of sectors per track
28h2Nnumber, size of each sector per track
The parameter bock for functions 41h and 61h has the following format:
OffsetSizeDescription
00h1special function (must be zero)
01h2number of disk head
03h2number of disk cylinder
05h2number of first sector to read/write
07h2number of sector to transfer
09h4transfer buffer address
The parameter bock for functions 42h and 62h has the following format:
OffsetSizeDescription
00h1bit 0 = 0 format/verify track
bit 0 = 1 format status call
bits 1-7 = reserved (0)
01h2number of disk head parameters
03h2number of disk cylinders
The parameter bock for functions 46h and 66h has the following format:
OffsetSizeDescription
00h2info level (00h)
02h4disk serial number (binary)
06h11volume label or "NONAME"
11h8file system type "FAT12" or "FAT16" (CL = 66 only)
The parameter bock for functions 47h and 67h has the following format:
OffsetSizeDescription
00h1special function field must be zero
01h1disk access flag
The device BPB field has the following format:
OffsetSizeDescription
00h2number of bytes per sector
02h1number of sectors per cluster
03h2number of reserved sectors at start of disk
05h1number of FATs
06h2number of entries in root directory
08h2total number of sectors
0Ah1media ID byte
0Bh2number of sectors per FAT
0Dh2number of sectors per track
0Fh2number of heads
11h4number of hidden sectors
15h4total number of sectors if word at 08h contains 0
19h6unknown
1Fh2number of cylinders
21h1device type
22h2device attribute (removable or not, etc)
44h/0Eh IOCTL: Get Logical Drive MapAH = 44h
AL = 0Eh
BL = drive number (00h=default, 01h=A, etc)
CF = 0 if successful
AL = 00h block device has only one logical drive assigned,
= 1 - 26: letter corresponding to the last logical device on the drive (1 = A, etc)
CF = 1 if unsuccessful
AX =
valueerror code
01hinvalid function number
0Fhinvalid disk drive
Reads the last logical drive used to reference a specific block device 
44h/0Fh IOCTL: Set Logical Drive MapAH = 44hCF = 0 if successful
AL =
valuemapping code
00 block device has only one logical drive assigned 1-26 the last letter used to reference the drive (1=A, etc)
01h - 0Ahlogical code drive (1 = A, 2 = B, etc) mapped to the block device

CF = 1 if unsuccessful
AX =
valueerror code
01hinvalid function number
0Fhinvalid drive number
Assigns the drive letter to a specified block deviceThis function treats a single physicall drove as both A: and B:.
44h/10h Query Generic IOCTL Capability (Handle)AH = 44h
AL = 10h
BX = handle for device
CH =
valuecategory code
00h unknown
01h COMn:
02h CON
01h LPTn:

CL =
valuefunction code
45h set iteration count
25h get iteration count
CF = 0
AX = 0000h specified IOCTL function is supported
CF = 1 if unsuccessful
AL = IOCTL capability not available
Tests whether a character device will support a miscellaneous IOCTL request to character device driver.Character device must support a Generic IOCTL Check call.
44h/11h Query Generic IOCTL Capability (Drive)AH = 44h
AL = 11h
BL = driver number (0=default, 1=A, etc)
CH =
valuecategory code
08hdisk drive

CL = function code
CF = 0 if successful
AX = 0000h specified IOCTL function is supported
CF = 1 function is unsucessful
CL = IOCTL capability not available
Tests whether a block device supports a miscellaneous IOCTL request.A block device driver must support a Generic IOCTL Check call.
This function may be used if you wish to use a Generic IOCTL call beyond the set of called defined for DOS 3.2
45h Duplicate HandleAH = 45h
BX = file handle
CF = 0 if successful
AX = new handle
CF = 1 if unsuccessful
AX =
valueerror code
04no additional handle available
06hhandle not opened or does not exist
Creates a new file handle that refers to the same currently operating device or file as an exist file handleThis function is used to force DOS to clear the file buffers by closing the duplicate handle. It is faster than closing and reopening a disk file. A better way of doing this is using Function 68h.
This function can also be used for updating the directory entry of a file that has changed in length without closing and reopening a file.
46h Force Duplicate File HandleAH = 46h
BX = first file handle
CX = second file handle
CF = 0 if successful
CF = 1 if unsuccessful
AX =
valueerror code
04hno additional handle available
06hhandle not opened or does not exist
Forces a second handle to become a duplicate of the first handle.This function closes the first file handle if it is still open.
This function associates an existing open file with a different file, or device. It is particularly useful for redirecting standard input or output to a different file or device by software (i.e., without using piping or redirection on the command line).
47h Get Current DirectoryAH = 47h
DL = drive number (0=default, 1=A, etc)
offset:segment of a 64 byte long buffer with ASCIIZ pathname
CF = 0 if successful
CF = 1 if unsuccessful
AX =
valueerror code
0Fhinvalid drive specification
Gets current working of a specified device.This function returns the path description without the drive letter and the initial backslash.
48h Allocate MemoryAH = 48h
BX = number of paragraphs to be requested
CF = 0 if function successful
AX = pointer to allocated block
CF = 1 if unsuccessful
AX =
valueerror code
07hmemory control block destroyed
08hinsufficient memory

BX = size of largest available memory block in paragraphs
Allocates memory to the current programThis function always fails when it is executed within COM-format programs. This is because they initially occupy the largest avaiable block of memory. Therefore you must free some memory before using this function.
49h Release MemoryAH = 49h
ES = segment of block to be freed
CF = 0 if function successful
CF = 1 if unsuccessful
AX =
valueerror code
07hmemory control block destroyed
09hincorrect memory block address
Releases memory blocks previously obtained using function 48h 
4Ah Modify Allocated Memory BlockAH = 4Ah
BX = new memory size in paragraphs
ES = segment of block address
CF = 0 if function successful
CF = 1 if unsuccessful
AX =
valueerror code
07hmemory control block destroyed
08hinsufficient memory
09hincorrect memory block address
BX = maximum number of paragraphs available
Changes the size of a memory block previously allocated by function 48h. 
4Bh/00-03h Load and/or ExecuteAH = 4Bh
AL =
valuefunction code
00hload and execute
01hload but do not execute
03hload overlay

DS:DX = ASCIIZ string of pathname
ES:BX = segment:offset of parameter block
CF = 0 if successful
BX = destroyed
DX = destroyed
CF = 1 if unsuccessful
AX =
valueerror code
01h invalid function number
02h file not found
03h path not found
05h access denied
08h insufficient memory
10h invalid environment block
11h invalid format
Loads and executes (optionally) another programThis function loads a sub-program, creates PSP and runs the sub-program. The parameter block for AL=00h, 01h has the following format:
OffsetSizeDescription
00h2segment pointer to environment block
02h4pointer to command line tail
06h4pointer to first FCB to be copied into new PSP
0Ah4pointer to second FCB to be copied into new PSP

The parameter block for AL=03h has the following format:
OffsetSizeDescription
00h2segment address in which to load overlay
02h2relocation factor to apply to overlay

If the segment address of the environment block is 0, then a child process has the same environment block as the parent process.
The environment strings must be paragraph aligned and consist of a sequence of ASCIIZ strings. The strongs must be followed by the byte 00h. The command tail parameter string contains a count byte which represents the number of characters in the command string. This is followed by ASCII characters. The string ends with a carriage return (which is not included in count). The first character of the string should be a blank. Before using this function, you must ensure that there is enough unallocated memory availabe for the child process. If necessary, you must release all memory to load the child process.
When this function loads and runs a sub-program, all open files of the parent process are available to the child process; therefore, if the parent process redirects standard input or output, it also affects the child process.
4Bh/05h Set Execution StateAH = 4Bh
AL = 05h
DS:DX = segment offset of execution state
CF = 0 if successful
AX = 00h
CF = 1 if unsuccessful
AX = error code
Prepares new programs for executionThis function may be used by programs which want to bypass the normal EXEC function. All DOS, BIOS and other software interrupts cannot be used after returning from this function and before the start of the child process.
4Ch Terminate with Output CodeAH = 4Ch AL = return code NothingEnds the current process and passes an exit code to the parent processThis function is the proper method for terminating programs in DOS. It releases all the memory belonging to the parent process, flushes all the file buffers and closes all open file handles of the parent process. It also restores the contents of the interrupt vecotrs for the terminate handler (INT 22h), the Ctrol-C handler (INT 23h) and the critical error handler (INT 24h). AFter this, control is passed to the parent process. All files that have been opened using FCBs must be closed before executing this function. All network files locks should be removed before this function is performed. Batch files can test the exit code with an ErrorLevel and IF statement. The exit code zero indicates that the function was successful. code with an Error
4Dh Get Output CodeAH = 4DhAH =
valueterminate type
01h normal termination (INT 20h, INT 21h Function 00h, or INT 21 Function 4Ch)
02h Ctrl-C or Ctrl-Break abort
03h termination by critical error handler
04h terminate and stay resident (INT 21h Function or INT 27h)

AL = return code
Reads the exit cod and termination type of the child process after execution of the EXEC call.This function can only retrieve the return code once, because the word where DOS stores this coded is cleared once the function has read it.
4Eh Find First Matching FileAH = 4Eh
bitattribute mask (if set)
0 read-only
1 hidden
2 system
3 volume label
4 directory
5 archive
6-15 reserved (0)

DS:DX = segment:offset of ASCIIZ pathname
CF = 0 if successful
[DTA] Disk Transfer Area = FindFirst data block

The DTA has the following format:
OffsetSizeDescription
00h1drive letter
01h11search template
0Ch1search attribute
0Dh2entry count within directory
0Fh2cluster number of the start of the parent directory
11H4reserved
15h1attribute of file found
16h2file time:
bitdescription
0-4 seconds / 2 (0 - 29)
5-10 minutes (0-59)
11-15 hours (0-23)
18h2file date:
bitdescription
0-4 day (1-31)
5-8 month (1-12)
9-15 year - 1980
1Ah4file size
1Eh13ASCIIZ filename and extension
CF = 1 if unsucessful (no matching fiile)
AX =
valueerror code
02h file not found
08h path not found
12h no file with same attribute is found

Searches for the first file that matches a specified filename in the default or specified directory on the default or specified drive.This function allows the use of wildcards in the filename. If a wildcard character is included in the filename, only the first matching filename is returned.
If the attribute byte is other than 08h, this functions returns all the specified combination of attribute bits. If the attribute is 08h (the volume label), the function returns the volume label only.
4Fh Find Next Matching FileAH = 4Fh
DTA points to the data block from the previous FirstFind or FindNext call
CF = 0 if successful
CF = 1 if unsuccessful
AX =
valueerror code
12h no file with same attribute is found
Search for the next file that matches a specified filename in the default or specified directory on the default or specified drive, if the previous call of Function 4Eh was successful.This function is used after the function fEh. The function 4Fh continues the search performed by the function 4Eh if that function leaves the DTA unchanged.
The original file specification must contain wildcard characters.
50h Set Current Process If (Set PSP address)AH = 50h
BX = segment address of new PSP
NothingSets a new value of PID into "current process" variable This function does not use any internal stacks and is thus fully re-entrant.
51h Get Current Process If (Get PSP address)AH = 51hBX = segment address of new PSPReads the segment address of the current PSPThis function does not use any internal stacks and is thus fully re-entrant.
53h Translate BIOS Parameter Block to Drive Parameter Block DOSAH = 53h
DS:SI = segment:offset BPB
ES:DI = segment:offset buffer for DPB
ES:BP = address of buffer with information-Transforms drive parameter informatin from the BIOS Parameter Block (BPB) which is stored on the disk to the format used by DOS.The BPB has the following format:
OffsetSizeDescription
00h2number of bytes per sector
02h1number of sectors per cluster
03h2number of reserved sectors at start of disk
05h1number of FATs
06h2number of entries in root directory
08h2total number of sectors
0Ah1media ID byte
0Bh2number of sectors per FAT
0Dh2number of sectors per track
0Fh2number of heads
11h4number of hidden sectors
15h4total number of sectors if word at 08h contains 0
19h6unknown
1Fh2number of cylinders
21h1device type
22h2device attribute (removable or not, etc)
54h Get Verify FlagAH = 54hAl = 0 if OFF, else 1 if onGets the current value of the MSDOS "verify" flag (read after write) 
56h Rename FileAH = 56h
?
?Changes the name of a file or moves a file from one directory to another on the same logical drive.This function does not allow the wildcard character in any pathname specification
This function cannot rename open files. It also allows you to rename directories but not to move them.
An error occurs if the file is moved in the root directory and it is full, or a file with a new pathname exists.
57h/00h Get File's Date and TimeAH = 57h
AL = 00h
BX = file handle
CF = 0 if successful
CX = file's time
bitsdescription
0-4seconds/2 (0-29)
5-10minutes (0-59)
11-15hours (0-23)

DX = file's date
bitsdescription
0-4day (1-31)
5-8month (1-12)
9-15year - 1980

CF = 1 if unscuccessful
AX =
valueerror code
01hinvalid function
06hinvalid
Reads the date and time of the creation or last modification of a file.This function can only be called after the file has been created or opened using one of the handle functions.
57h/01h Set File's Date and TimeAH = 57h
AL = 01h
BX = file handle
CX = new time
bitsdescription
0-4seconds/2 (0-29)
5-10minutes (0-59)
11-15hours (0-23)
DX =
bitsdescription
0-4day (1-31)
5-8month (1-12)
9-15year - 1980
CF = 0 if successful
CF = 1 if unsuccessful
AX =
valueerror code
01hinvalid function
06hinvalid
Modifies the date and time information of a file to given values.This function can only be called after the file has been created or opened using one of the handle functions.
58h/00h Get Allocation StrategyAH = 58h
AL = 00h
CF = 0 if successful
AX =
valuestrategy
00hfirst fit
01hbest fit
02hlast fit

CF = 1 if unsuccessful
AX =
valueerror code
01hfunction number is invalid
Reads the control byte which indicates the current MSDOS method for allocating memory blocksDOS has three methods of allocating memory blocks:
First fit: DOS begins searching the available memory blocks at the start of the memory and allocates the first block which is large enough.
Best fit: DOS searches all available memory blocks and allocates the smallest memory block which meets the requested size.
Last fit: DOS begins searching the available memory at the end of the memory and allocates the first block which is large enough.
The default strategy is the last fit.
58h/01h Set Allocated StrategyAH = 58h
AL = 01h
BX =
valuestrategy
00hfirst fit
01hbest fit
02hlast fit
CF = 0 if successful
CF = 1 if unsuccessful
AX =
valueerror code
01hfunction number is invalid
Write the control byte which indicates the current MSDOS strategy for allocating memory blocks. 
58h/02h Get Upper-Memory LinkAH = 58h
AL = 02h
AL =
valueDescription
00hUMB is not part of DOS memory chain
01hUMB is in DOS memory chain
Defines whether use of Upper Memory Blocks is enabled or disabled. 
58h/03h Set Upper-Memory LinkAH = 58h
AL = 03h
BX =
valueDescription
00hremove UMBs from DOS memory chain
01hadd UMBs to memory chain
? Sets the indicator that enables/disables use of UMBsBefore using this function, you must save the indicator of aloocation of UMBs and before termination of process, restore it.
59h Get Extended Error InformationAH = 59h
BX = 00h
AX =
valueextended error code
01hfunction number invalid
02hfile not found
03hpath not found
04htoo many open files
05haccess denied
06hhandle invalid
07hmemory control block destroyed
08hinsufficient memory
09hinvalid memory address
0Ahenvironment invalid
0Bhformat invalid
0Chaccess code invalid
0Dhdata invalid
0Ehunknown unit
0Fhdisk drive invalid
10hcurrent directory cannot be removed
11hdifferent device
12hno more files
13hdisk write-protected
14hunknown unit
15hdrive not ready
16hunknown command
17hdata error (CRC)
18hbad request structure length
19hseek error
1Ahunknown media type
1Bhsector not found
1Chprinter out of paper
1Dhwrite fault
1Ehread fault
1Fhgeneral failure
20hsharing violation
21hlock violation
22hdisk change invalid
50hfile already exists
52hcannot make directory
53hfail on INT 24h (critical error)
54htoo many redirections
55hduplicate redirection
56hinvalid password
57hinvalid parameter
5Ahrequired system component not installed

BH=
valueerror class
01hout of resource (storage or handles)
02htemporary problems than can be expected to end
03hauthorization problem
04hinternal error in system software
05hhardware problems
06hsystem software failure (bad ro missing CONFIG.SYS)
07happlication error
08hfile or other item not found
09hfile or other item of invalid type or format
0Ahfile or other item locked
0Bhmedia problem (wrong disk in drive, etc.)
0Chitem already exists
0Dhunknown error

BL =
valuesuggested action
01hretry a few times
02hpause, then retry
03hask user to resupply input
04habort application with cleanup
05himmediate abort without cleanup
06hignore error
07hretry after user intervention

CH =
valuesource of error
01hunknown
02hblock device (disk)
03hnetwork
04hserial device
05hmemory

ES:DI = ASCIIZ volume label of disk to insert if AX = 022h
Gets information about errors that occur after an unsuccessful INT 21 function call. 
5Ah Create TemporaryAH = 5Ah
CX = file attribute (bits may be combined)
DS:DX = segment:offset of ASCIIZ path ending with at least 13 zero bytes
CF = 0 if successful
AX = handle
DS:DX = segment:offset of complete ASCIIZ pathname
CF = 1 if unsuccessful
AX =
valueerror code
03hpath not found
04htoo many open files
05haccess denied
Creates a temporary file with a unique name using the current date and time.The ASCIIZ pathname may contain a drive specification and a path designatin. If the pathname does not include either a drive specification or a path designation, this function creates a temporary file in the current directory of the default drive.
This function is used by COMMAND.COM for creating a temporary "piping" file, used for redirection of input/output.
5Bh Create New FileAH = 5Bh
CX =
valuefile attribute (bits may be combined
0read-only
1hidden
2system
3volume label
4reserved (0)
5archive
6-15reserved (0)

DS:DX = segment:offset of ASCIIZ pathname
CF = 0 if successful
AX = handle
CF = 1 if unsuccessful
AX =
valueerror code
03hpath not found
04htoo many open files
50hfile exists.
Creates a file in the specified or default directory if it does not already exist.An error occurs when:
Any element of the path does not exist.
A filename already exists in the specified directory.
The file is to be created in the root directory, but this is already full.

When a file is created, it usually has a normal read/write attribute (0).

5Ch Lock or Unlock File RegionAH = 5Ch AL =
valuedescription
00hlock region of a file
01hunlock region of a file

BX = file handle
CX = high word of region offset
DX = low word of region offset
SI = high word of region length
DI = low word of region length
CF = 0 if successful
CF = 1 if unsuccessful
AX =
valueerror code
01hinvalid function code
06hinvalid handle
21hall or part of region already locked
Prevents or allows access to the specified region of a file.Every call to a lock region must be followed by a call to unlock the same region.
A child process created by an EXEC system call does not inherit access to the locked region of a file which has been locked by its parent. If a program is terminated by INT 23h or INT 24h, you must release the locked regions of the open file, otherwise the result is undefined.
5Eh/00h Get Machine NameAH = 5Eh
AL = 00h
DS:DX = segment:offset of buffer (16 bytes) with computer name
CF = 0 if successful
CH =
valuedescription
00hname not defined
<>00hname is defined

CL = netBIOS name number (if CH <> 0) DS:DX = segment:offset of computer name (if CH <> 0)
CF = 1 if unsuccessful
AX =
valueerror code
01hinvalid function code
Returns the ASCIIZ name of a local computer within a Microsoft Network.The computer name is a 16-byte ASCIIZ string. Spaces are added to make it this length.
5Eh/01h Set Redirection ModeAH = 5Eh
AL = 01h
?
?Sets current redirection mode (printer/disk).?
5Eh/02h Set Printer Setup StringAH = 5Eh
AL = 02h
BX = redirection list index
CX = length of setup string
DS:DI = segment:offset of setup string
CF = 0 if successful
CF = 1 if unsuccessful
AX =
valueerror code
01hinvalid function code
Specifies the printer setup string which precedes all output to a network printer. This string allows network users to specify their own individual mode to the network printer.System redirection list assigns local names to network printers, files and directories.
5Eh/03h Get Printer Setup StringAH = 5Eh
AL = 03h
BX = redirection list index
ES:DI = segment:offset 9f 64-byte setup string
CF = 0 if successful
CX = print setup string length
ES:DI = segment:offset of buffer with Setup String CF = 1 if unsuccessful
AX =
valueerror code
01hinvalid function code
Gets the printer setup string used by a network printer which is running in the Microsoft Network. 
5Fh/00h Get Redirection ModeAH = 5Fh
AL = 00h
BL =
valuedescription
03hprinter
04hdisk driver
CF = 0 if successful
BH =
valuedescription
00hoff
01hon

CF = 1 if unsuccessful
AX = error code
Gets the current redirection mode (printer/disk).This function is available when Microsoft Network is installed.
5Fh/01h Set Redirection ModeAH = 5Fh
AL = 00h
BL =
valuedescription
03hprinter
04hdisk driver

BH =
valuedescription
00hoff
01hon
CF = 0 if successfull
CF = 1 if unsuccessful
AX = error code
Sets the current redirection mode (printer/disk).This function is available when Microsoft Network is installed. If redirection is off, then local device is used.
5Fh/02h Get Redirection List EntryAH = 5Fh
AL = 02h
BX = redirection list index
DS:SI = 16-byte buffer for ASCIIZ device name
ES:DI = 128-byte buffer for ASCIIZ network name
CF = 0 if succssful
BH =
valuedevice status flag
00hvalid
01hinvalid

BL =
valuedevice type
03hprinter
04hdisk drive

CX = parameter value stored in memory
DX = destroyed
BP = destroyed
DS:SI = segment: offset of ASCIIZ local device name
ES:DI = segment:offset of ASCIIZ network name
CF = 1 if unsuccessful
AX =
valueerror code
01hinvalid function code
12hno more files available
Reads the system redirection list. This list assigns local names to network files, directories or printers. 
5Fh/03h Redirect DeviceAH = 5Fh
AL = 03h
BL =
valuedevice type
03hprinter
04hdisk drive
CX = user data to save
DS:DI = segment:offset of ASCIIZ local device name
ES:SI = segment:offset of ASCIIZ network name and ASCIIZ password
CF = 0 if successful
CF = 1 if unsuccessful
AX =
valueerror code
01hinvalid function code
03hpath not found
05haccess denied
08hinsufficient memory
0Fhinvalid drive
12hno more files available
Redirects a specified device to a specific network name.Device names can be drive specifiers (such as "D:"), printer names (LPT1, PRN, LPT2 or LPT3) or null string. If the the device name is a null string and password, then DOS attempts to gain access to the network directory with the specified password.
5Fh/04h Cancel Device RedirectionAH = 5Fh AL = 04h
DS:DI of ASCIIZ local device name
CF = 0 if successful
CF = 1 if unsuccessful
AX =
valueerror code
01hinvalid function code
03hpath not found
05haccess denied
08hinsufficient memory
0Fhinvalid drive
12hno more files available
Cancels the current redirection for the specified local device with a network of printers, files or directoriesThis function is available when Microsoft Network is running. Device names can be specifiers such as ("D:"), printer names (LPT1, LPT22, LPT3 or PRN) or a string beginning with two back slashes which terminates the connection between the local computer and the network directory.
62h Get Current PSP AddressAH = 62hBX = segment of PSP for current process Reads the segment address of the PSP for the current program.This function is identical to the undocumented function 51h.
65h Get Extended Country InformationAH = 65h
AL =
valuesubfunction
01hget general international information
02hget pointer to uppercase table
04hget pointer to filename uppercase table
05hget pointer to filename terminator table
06hget pointer to collating table
07hget pointer to Double-byte Character Set (DBCS) Vector

BX = code page (-1 = active CON device)
CX = size of buffer to receive information
DX = country ID (-1 = default)
ES:DI = address of buffer to receive information
CF = 0 if successful
CX = size of country information returned
ES:DI = address of country information
CF = 1 if unsuccessful
AX = error code
Reads country-dependent informationThis function returns an extended version of the information which is returned by INT 21h function 38h.
65/20-22hCountry Dependent Character CapitalizationAH = 65h
AL =
valuesubfunctioin
20hCapitalize characer
DL = character to capitalize
21hCaptialize string
DS:DX = segment:offset of the string to capitalize
CX = length of the string
22hCapitalize ASCIIZ string
DS:DX = segment;offset of ASCIIZ string to capitalize
CF = 0 if successful
DL = capitalized character if AL = 20h
CF = 1 if unsuccessful
AX = error code
Capitalizes a text in a country dependent fashion. 
65/23 Determine if Character Represents Yes/No REsponseAH = 65h
AL = 23h
CF = 0 if successful
valuetype
00hno
01hyes
02hneither yes or no

CF = 1 if unsuccessful
Determines a typed character is a "yes/no" response for current country. 
66h Get or Set Code PageAH = 66h
AL =
valuesubfunction
01hGet code page
02hselect code page

BX = select code page (if AL = 02h)
CF = 0 if successful
if AL = 01h
BX = active code page
DX = default code page
CF = 1 if unsuccessful
AX = error code
DOS reads or sets the current code page.MSDOX, via the function COUNTRY.SYS, supplies a new code page if AL = 02, but the device must be prepared for this by the directive DEVICE in CONFIG.SYS and NLSFUNC and MODE CP PREPARE commands in AUTOEXEC.BAT
67h Set Handle CountAH = 67h
BX = number of desired handles
CF = 0 if successful
CF = 1 if unsuccessful
AX =
Sets the maximum number of handles currently available to the calling programs.The default table of the PSP for the current process can control only 20 handles.
An error occures if the number of handles in the BX register is greater than 20 and there is no free memory available to allocate a block for the enlarged table.

If the number of requested files in the BX register is greater than the available number of entries controlled by the FILES entry in CONFIG.SYS file, no error occurs.
However an attempt to open a file or device will fail if all file entries are in use, even if not all the file handles have been used byy the program.

68h Commit FileAH = 68h
handle
CF = 0 if successful
CF = 1 if unsuccessful
AX = error code
Forces all data in DOS buffers associated with a specific handle to be written immediately to the specified device. If the handle points to a file which has been updated, the file's directory is also updated.This function closes and reopens a file or duplicates a handle and then closes it. This function maintain control of the file in multitasking and networking applications. Although this function does not perform any actions when it accesses a character device, it sets the Carry Flag.
69h Get/Set Disk Serial NumberAH = 69h
AL =
valuesubfunction
00hGet serial number
01hSet serial number

BL = drive (0 = default, 1=A,2=B, etc
DS:DX = segment:offset disk serial number info
CF = 0 if successful
AX = destroyed
AL =
valuedescription
00hbuffer is filled with value from extended DPB
01hextended DPB on disk set to values from buffer

CF = 1 if unsuccessful
AX =
valueerror code
01hfunction number invalid (network driver)
05haccess denied (no extended DPB on disk)
This function does not generate critical errors.
This function does not work on network drivers.
The format on disk serial number infor has the following format:info level (zero)disk serial number (binary)volume label (or "NO NAME")"FAT12 " or "FAT16 "
OffsetSizeDescription
00h2
02h4
06h11
11h8
6Ch Extended Open/Create NumberAH = 6Ch
AL = 00h
BL =
bitaccess type
0-2
valueopen mode
000read-only
001write-only
010reserved
3reserved
4-6
valuesharing mode
000compatibility
001deny all
010deny write
011deny read
100deny none
7inheritance

BH =
bitflags
0-4reserved
5
valuecritical error handling
0execute INT 24h
1return error to process
6
valueauto commit on write
0write may be buffered
1physical write at request time
7reserved

CX =
bitcreate attribute (bits may be combined)
0read-only
1hidden
2system
3volume label
4reserved
5archive
6-15reserved

DX =
bitopen flag
0-3
valueaction if file exists
0000hfail
0001hopen file
0010hreplace file
4-7
valueaction if file does not exist exists
0000hfail
0001hcreate

DS:SI = segment:offset of ASCIIZ filename
CF = 0 if successful
AX = file handle
CX =
valueDescription
1file opened
2file created
3file replaced

CF = 1 if unsuccessful
AX = error code
Combines functions "create", "open", and "commit" into a common function. 
This page is based on material from:


CSEE| 211| 211 F'99| lectures| news| help

Monday, 15-Nov-1999 09:28:14 EST