ralf@b.gp.cs.cmu.edu (Ralf Brown) (12/18/88)
whether or not DESQview was loaded
---------------------------------------------
INT 21 - DOS - GET CURRENT TIME
AH = 2Ch
Return: CH = hours
CL = minutes
DH = seconds
DL = hundredths of seconds
Note: time is updated approximately every 5/100 second
---------------------------------------------
INT 21 - DOS - SET CURRENT TIME
AH = 2Dh
CH = hours
CL = minutes
DH = seconds
DL = hundredths of seconds
Return: AL = 00h if no error
= FFh if bad value sent to routine
Note: DOS 3.3 also sets CMOS clock
---------------------------------------------
INT 21 - DOS - SET VERIFY FLAG
AH = 2Eh
DL = 0
AL = 1 VERIFY on
0 VERIFY off
---------------------------------------------
INT 21 - DOS 2+ - GET DISK TRANSFER AREA ADDRESS
AH = 2Fh
Return: ES:BX = address of DTA
---------------------------------------------
INT 21 - DOS 2+ - GET DOS VERSION
AH = 30h
Return: AL = Major Version number (0 for DOS 1.x)
AH = Minor Version number
BH = OEM number
00h IBM
16h DEC
BL:CX = 24-bit user number
---------------------------------------------
INT 21 - DOS 2+ - TERMINATE BUT STAY RESIDENT
AH = 31h
AL = exit code
DX = program size, in paragraphs
---------------------------------------------
INT 21 - DOS 2+ internal - GET DRIVE PARAMETER BLOCK
AH = 32h
DL = drive number
0 = default, 1 = A, etc.
Return: AL = 0FFh if invalid drive number, else
DS:BX -> drive parameter block.
Structure of DOS Drive Parameter Block:
Offset Size Description
00h BYTE drive number (0 = A, etc.)
01h BYTE unit number within device driver
02h WORD number of bytes per sector
04h BYTE largest sector number in cluster (one less than sect/clust)
05h BYTE log base two of the cluster size
06h WORD number of reserved (boot) sectors
08h BYTE number of copies of the FAT
09h WORD number of root directory entries
0Bh WORD first data sector on medium
0Dh WORD largest possible cluster number (one more than # data clust)
0Fh BYTE number of sectors in one FAT copy
10h WORD first sector of root directory
12h DWORD address of device driver for this drive
16h BYTE media descriptor byte for medium
17h BYTE FFh indicates block must be rebuilt
(DOS 3.x) 00h indicates block accessed
18h DWORD address of next device block, offset = FFFFh indicates last
---DOS 2.x only---
1Ch WORD starting cluster of current directory (0 = root directory)
1Eh 64 BYTEs ASCIZ current directory path string
---DOS 3.x---
; this was always:
1Ch WORD = 0 probably unused, values left from before
1Eh WORD = 0FFFFh block was built
---------------------------------------------
INT 21 - DOS 2+ - EXTENDED CONTROL-BREAK CHECKING
AH = 33h
AL = subfunction
00h get state
01h set state
DL = 0 for OFF or 1 for ON
02h internal, called by PRINT.COM (DOS 3.1)
05h internal, return boot drive in DL (1=A:) (not in DOS 3.1)
Return: DL = current BREAK setting if AL = 00h
0 BREAK=OFF
1 BREAK=ON
AL = FFh if error
---------------------------------------------
INT 21 - DOS 2+ internal - RETURN CritSectFlag POINTER
AH = 34h
Return: ES:BX -> 1-byte DOS "Critical Section Flag", also known as InDOS flag
Notes: when the critical section flag is nonzero, code within DOS is being
executed. It is safe to enter DOS when both the critical section flag
and the critical error flag are zero.
The critical error flag is the byte after the critical section flag in
DOS 2.x, and the byte BEFORE the critical section flag in DOS 3.x
(except COMPAQ DOS 3.0, where the critical error flag is located 1AAh
bytes BEFORE the critical section flag)
---------------------------------------------
INT 21 - DOS 2+ - GET INTERRUPT VECTOR
AH = 35h
AL = interrupt number
Return: ES:BX = value of interrupt vector
---------------------------------------------
INT 21 - DOS 2+ - GET DISK SPACE
AH = 36h
DL = drive code (0 = default, 1 = A, 2 = B, etc.)
Return: AX = number of sectors per cluster
or 0FFFFh if invalid drive
BX = number of available clusters
CX = bytes per sector
DX = total clusters
Note: multiply AX * CX * BX for free space on disk
multiply AX * CX * DX for total disk space
---------------------------------------------
INT 21 - DOS 2+ internal - SWITCHAR/AVAILDEV
AH = 37h
AL = subfunction
0 Read switch character (returns current character in DL)
1 Set switch character (specify new character in DL)
2 (DOS 2.x only) Read device availability (as set by function AL=3)
3 (DOS 2.x only) Set device availability, where:
DL = 0 means \DEV\ must preceed device names
DL <> 0 means \DEV\ need not preceed device names
Return: AL = FFh means the value in AL was not in the range 0-3.
DL = Switch character (if AL=0 or 1)
Device availability flag (if AL=2 or 3)
---------------------------------------------
INT 21 - DOS 2+ - GET COUNTRY-DEPENDENT INFORMATION
AH = 38h
--DOS 2.x--
AL = 0 get current-country info
DS:DX = segment:offset of buffer for returned info
Return: BX = country code
buffer at DS:DX filled as follows:
bytes 0-1 = date format 0 = USA mm dd yy
1 = Europe dd mm yy
2 = Japan yy mm dd
byte 2 = currency symbol
byte 3 = 00h
byte 4 = thousands separator char
byte 5 = 00h
byte 6 = decimal separator char
byte 7 = 00h
bytes 8-1Fh reserved
--DOS 3.x--
AL = 0 for current country
AL = 01h thru 0FEh for specific country with code <255
AL = 0FFh for specific country with code >= 255
BX = 16-bit country code
DS:DX = segment:offset of buffer for returned info
DX = 0FFFFh if setting country code, rather than getting info
Return: (if DX <> 0FFFFh)
CF set on error
AX = error code (02h)
CF clear if successful
BX = country code
DS:DX filled in:
WORD date format (see above)
5 BYTEs currency symbol string, ASCIZ
BYTE thousands separator char
BYTE 00h
BYTE decimal separator char
BYTE 00h
BYTE date separator char
BYTE 00h
BYTE time separator char
BYTE 00h
BYTE currency format
bit 2 = set if currency symbol replaces decimal pt
bit 1 = number of spaces between value and curr sym
bit 0 = 0 if currency symbol precedes value
1 if currency symbol follows value
BYTE number of digits after decimal in currency
BYTE time format
bit 0 = 0 if 12-hour clock
1 if 24-hour clock
DWORD address of case map routine (FAR CALL, AL = char to map)
BYTE data-list separator char
BYTE 00h
10 BYTEs reserved
---------------------------------------------
INT 21 - DOS 2+ - CREATE A SUBDIRECTORY (MKDIR)
AH = 39h
DS:DX = address of ASCIZ pathname
Return: CF set on error
AX = error code (03h,05h)
---------------------------------------------
INT 21 - DOS 2+ - REMOVE A DIRECTORY ENTRY (RMDIR)
AH = 3Ah
DS:DX = address of ASCIZ pathname
Return: CF set on error
AX = error code (03h,05h,06h,10h)
---------------------------------------------
INT 21 - DOS 2+ - CHANGE THE CURRENT DIRECTORY (CHDIR)
AH = 3Bh
DS:DX = address of ASCIZ directory name
Return: CF set on error
AX = error code (03h)
---------------------------------------------
INT 21 - DOS 2+ - CREATE A FILE WITH HANDLE (CREAT)
AH = 3Ch
CX = attributes for file
bit 0: read-only
1: hidden
2: system
3: volume label
4: reserved, must be zero (directory)
5: archive bit
7: if set, file is shareable under Novell NetWare
DS:DX = address of ASCIZ filename
Return: CF set on error
AX = error code (03h,04h,05h)
CF clear if successful
AX = file handle
---------------------------------------------
INT 21 - DOS 2+ - OPEN DISK FILE WITH HANDLE
AH = 3Dh
AL = access code
0 = Read Only
1 = Write Only
2 = Read/Write
AL bits 7-3 = file-sharing modes (DOS 3.x)
bit 7 = inheritance flag, set for no inheritance
bits 4-6 = sharing mode
000 compatibility mode
001 exclusive (deny all)
010 write access denied (deny write)
011 read access denied (deny read)
100 full access permitted (deny none)
bit 3 = reserved, should be zero
DS:DX = address of ASCIZ filename
Return: CF set on error
AX = error code (01h,02h,03h,04h,05h,0Ch)
CF clear if successful
AX = file handle
---------------------------------------------
INT 21 - DOS 2+ - CLOSE A FILE WITH HANDLE
AH = 3Eh
BX = file handle
Return: CF set on error
AX = error code (06h)
---------------------------------------------
INT 21 - DOS 2+ - READ FROM FILE WITH HANDLE
AH = 3Fh
BX = file handle
CX = number of bytes to read
DS:DX = address of buffer
Return: CF set on error
AX = error code (05h,06h)
CF clear if successful
AX = number of bytes read (0 if at EOF before call)
---------------------------------------------
INT 21 - DOS 2+ - WRITE TO FILE WITH HANDLE
AH = 40h
BX = file handle
CX = number of bytes to write
DS:DX -> buffer
Return: CF set on error
AX = error code (05h,06h)
CF clear if successful
AX = number of bytes actually written
Note: if CX is zero, no data is written, and the file is truncated or extended
to the current position
---------------------------------------------
INT 21 - DOS 2+ - DELETE A FILE (UNLINK)
AH = 41h
DS:DX -> ASCIZ name of file to delete
Return: CF set on error
AX = error code (02h,05h)
---------------------------------------------
INT 21 - DOS 2+ - MOVE FILE READ/WRITE POINTER (LSEEK)
AH = 42h
AL = method value
0 = offset from beginning of file
1 = offset from present location
2 = offset from end of file
BX = file handle
CX:DX = offset in bytes
Return: CF set on error
AX = error code (01h,06h)
CF clear if successful
DX:AX = new offset
---------------------------------------------
INT 21 - DOS 2+ - GET/PUT FILE ATTRIBUTES (CHMOD)
AH = 43h
AL =
0 = get file attributes
1 = put file attributes
CX = file attribute bits
0 = read only
1 = hidden file
2 = system file
3 = volume label
4 = subdirectory
5 = written since backup
8 = shareable (Novell NetWare)
DS:DX -> ASCIZ file name
Return: CF set on error
AX = error code (01h,02h,03h,05h)
CX = file attributes on get
---------------------------------------------
INT 21 - DOS 2+ - IOCTL - GET DEVICE INFORMATION
AX = 4400h
BX = file or device handle
Return: CF set on error
AX = error code
CF clear if successful
DX = device info
If bit 7 set: (character device)
bit 0: console input device
1: console output device
2: NUL device
3: CLOCK$ device
4: device is special
5: binary (raw) mode
6: Not EOF
12: network device (DOS 3.x)
14: can process IOCTL control strings (func 2-5)
If bit 7 clear: (file)
bits 0-5 are block device number
6: file has not been written
12: network device (DOS 3.x)
14: ??? (DOS 3.x)
15: file is remote (DOS 3.x)
---------------------------------------------
INT 21 - DOS 2+ - IOCTL - SET DEVICE INFORMATION
AX = 4401h
BX = device handle
DH = 0
DL = device information to set (bits 0-7 from function 0)
Return: CF set on error
AX = error code
---------------------------------------------
INT 21 - DOS 2+ - IOCTL - READ CHARACTER DEVICE CONTROL STRING
AX = 4402h
BX = device handle
CX = number of bytes to read
DS:DX -> buffer
Return: CF set on error
AX = error code
CF clear if successful
AX = number of bytes read
---------------------------------------------
INT 21 - DOS 2+ - IOCTL - WRITE CHARACTER DEVICE CONTROL STRING
AX = 4403h
BX = device handle
CX = number of bytes to write
DS:DX -> buffer
Return: CF set on error
AX = error code
CF clear if successful
AX = number of bytes written
---------------------------------------------
INT 21 - DOS 2+ - IOCTL - READ BLOCK DEVICE CONTROL STRING
AX = 4404h
BL = drive number (0=default)
CX = number of bytes to read
DS:DX -> buffer
Return: CF set on error
AX = error code
CF clear if successful
AX = number of bytes read
---------------------------------------------
INT 21 - DOS 2+ - IOCTL - WRITE BLOCK DEVICE CONTROL STRING
AX = 4405h
BL = drive number (0=default)
CX = number of bytes to write
DS:DX -> buffer
Return: CF set on error
AX = error code
CF clear if successful
AX = number of bytes written
---------------------------------------------
INT 21 - DOS 2+ - IOCTL - GET INPUT STATUS
AX = 4406h
BX = file or device handle
Return: AL = FFh device ready
00h device not ready
---------------------------------------------
INT 21 - DOS 2+ - IOCTL - GET OUTPUT STATUS
AX = 4407h
BX = file or device handle
Return: AL = FFh device ready
00h device not ready
Note: for DOS 2.x, files are always ready for output
---------------------------------------------
INT 21 - DOS 3.x - IOCTL - BLOCK DEVICE CHANGEABLE
AX = 4408h
BL = drive number (0=default)
Return: AX = 00h removable
01h fixed
0Fh invalid drive
---------------------------------------------
INT 21 - DOS 3.x - IOCTL - BLOCK DEVICE LOCAL
AX = 4409h
BL = drive number (0=default)
Return: DX = attribute word, bit 12 set if device is remote
---------------------------------------------
INT 21 - DOS 3.x - IOCTL - HANDLE LOCAL
AX = 440Ah
BX = file handle
Return: DX = attribute word, bit 15 set if file is remote
Note: if file is remote, Novell Advanced NetWare 2.0 returns the number of
the file server on which the handle is located in CX
---------------------------------------------
INT 21 - DOS 3.x - IOCTL - SET SHARING RETRY COUNT
AX = 440Bh
CX = delay (default 1)
DX = retry count (default 3)
Return: CF set on error
AX = error code
---------------------------------------------
INT 21 - DOS 3.2 - IOCTL - GENERIC
AX = 440Ch
BX = device handle
CH = category code
00h unknown (DOS 3.3)
01h COMn: (DOS 3.3)
03h CON (DOS 3.3)
05h LPTn:
CL = function
45h set iteration count
4Ah select code page
4Ch start code-page preparation
4Dh end code-page preparation
65h get iteration count
6Ah query selected code page
6Bh query prepare list
DS:DX -> parameter block
for CL=45h WORD iteration count
for CL=4Ah,4Dh,6Ah WORD length of data
WORD code page ID
for CL=4Ch WORD flags
WORD length of remainder of parameter block
WORD number of code pages following
N WORDs code page 1,...,N
for CL=6Bh WORD length of following data
WORD number of hardware code pages
N WORDs hardware code pages 1,...,N
WORD number of prepared code pages
N WORDs prepared code pages 1,...,N
Return: CF set on error
AX = error code
---------------------------------------------
INT 21 - DOS 3.2 - IOCTL - BLOCK DEVICE REQUEST
AX = 440Dh
BL = drive number (0=default)
CH = category code
08h disk drive
CL = function
40h set device parameters
41h write logical device track
42h format and verify logical device track
60h get device parameters
61h read logical device track
62h verify logical device track
DS:DX -> parameter block
for functions 40h, 60h
BYTE special functions
bit 0 set if function to use current BPB, clear if Device BIOS
Parameter Block field contains new default BPB
bit 1 set if function to use track layout fields only
must be clear if CL=60h
bit 2 set if all sectors in track same size (should be set)
bits 3-7 reserved
BYTE device type
00h 320K/360K disk
01h 1.2M disk
02h 720K disk
03h single-density 8-inch disk
04h double-density 8-inch disk
05h fixed disk
06h tape drive
07h other type of block device
WORD device attributes
bit 0 set if nonremovable medium
bit 1 set if door lock supported
bits 2-15 reserved
WORD number of cylinders
BYTE media type
00h 1.2M disk (default)
01h 320K/360K disk
31 BYTEs device BPB (see function 53h)
WORD number of sectors per track (start of track layout field)
N word pairs: number,size of each sector in track
for functions 41h, 61h
BYTE reserved, must be zero
WORD number of disk head
WORD number of disk cylinder
WORD number of first sector to read/write
WORD number of sectors
DWORD transfer address
for functions 42h, 62h
BYTE reserved, must be zero
WORD number of disk head
WORD number of disk cylinder
Return: CF set on error
AX = error code
---------------------------------------------
INT 21 - DOS 3.2 - IOCTL - GET LOGICAL DRIVE MAP
AX = 440Eh
BL = drive number (0=default)
Return: CF set on error
AX = error code
CF clear if successful
AL = 0 block device has only one logical drive assigned
1..26 the last letter used to reference the drive (1=A:,etc)
---------------------------------------------
INT 21 - DOS 3.2 - IOCTL - SET LOGICAL DRIVE MAP
AX = 440Fh
BL = physical drive number (0=default)
Return: CF set on error
AX = error code
Note: maps logical drives to physical drives, similar to DOS's treatment of
a single physical floppy drive as both A: and B:
---------------------------------------------
INT 21 - DOS 2+ - CREATE DUPLICATE HANDLE (DUP)
AH = 45h
BX = file handle to duplicate
Return: CF set on error
AX = error code (04h,06h)
CF clear if successful
AX = new file handle
---------------------------------------------
INT 21 - DOS 2+ - FORCE DUPLICATE HANDLE (FORCDUP,DUP2)
AH = 46h
BX = existing file handle
CX = new file handle
Return: CF set on error
AX = error code (04h,06h)
Note: closes file with handle BX if it is still open
---------------------------------------------
INT 21 - DOS 2+ - GET CURRENT DIRECTORY
AH = 47h
DL = drive (0=default, 1=A, etc.)
DS:SI points to 64-byte buffer area
Return: CF set on error
AX = error code (0Fh)
Note: the returned path does not include the initial backslash
---------------------------------------------
INT 21 - DOS 2+ - ALLOCATE MEMORY
AH = 48h
BX = number of 16-byte paragraphs desired
Return: CF set on error
AX = error code (07h,08h)
BX = maximum available
CF clear if successful
AX = segment of allocated memory block
---------------------------------------------
INT 21 - DOS 2+ - FREE MEMORY
AH = 49h
ES = segment address of area to be freed
Return: CF set on error
AX = error code (07h,09h)
---------------------------------------------
INT 21 - DOS 2+ - ADJUST MEMORY BLOCK SIZE (SETBLOCK)
AH = 4Ah
ES = segment address of block to change
BX = new size in paragraphs
Return: CF set on error
AX = error code (07h,08h,09h)
BX = maximum size possible for the block
---------------------------------------------
INT 21 - DOS 2+ - LOAD OR EXECUTE (EXEC)
AH = 4Bh
AL = subfunction
0 = load and execute program
1 = load but do not execute (internal)
3 = load overlay; do not create PSP
DS:DX = filename
ES:BX = parameter block
AL =
0: WORD segment of environment (0 = use current)
DWORD -> command line
DWORD -> FCB 1
DWORD -> FCB 2
1: WORD segment of environment (0 = use current)
DWORD -> command line
DWORD -> FCB 1
DWORD -> FCB 2
DWORD (DOS 3.x) will hold SS:SP on return
DWORD (DOS 3.x) will hold entry point (CS:IP) on return
3: WORD segment load address
WORD segment relocation factor
Return: CF set on error
AX = error code (01h,02h,05h,08h,0Ah,0Bh)
CF clear if successful
if function 1 and DOS 3.x or DESQview, process ID set to new
program's PSP; get with function 62h
if function 1 and DOS 2.x, new program's initial stack and
entry point returned in registers
Note: DOS 2.x destroys all registers, including SS:SP
Structure of .EXE file header:
00h WORD 4Dh, 5Ah signature (sometimes 5Ah, 4Dh)
02h WORD image size remainder (program size mod 512)
04h WORD file size in pages (program size div 512)
06h WORD number of relocation items
08h WORD header size in paragraphs
0Ah WORD minimum extra paragraphs needed
0Ch WORD maximum extra paragraphs needed
0Eh WORD stack segment
10h WORD stack offset
12h WORD word checksum of entire file
14h DWORD initial CS:IP
18h WORD offset of relocation table
1Ah WORD overlay number
---------------------------------------------
INT 21 - DOS 2+ - QUIT WITH EXIT CODE (EXIT)
AH = 4Ch
AL = exit code
Return: never returns
---------------------------------------------
INT 21 - DOS 2+ - GET EXIT CODE OF SUBPROGRAM (WAIT)
AH = 4Dh
Return: AL = exit code of subprogram (functions 31h or 4Ch)
AH = circumstance which caused termination
0 = Terminate/abort
1 = Control-C
2 = Hard error
3 = Terminate and stay resident
---------------------------------------------
INT 21 - DOS 2+ - FIND FIRST ASCIZ (FIND FIRST)
AH = 4Eh
CX = search attributes
DS:DX -> ASCIZ filename
Return: CF set on error
AX = error code (02h,12h)
[DTA] = data block
undocumented fields, 21 bytes total
---PCDOS 3.10---
BYTE drive letter
11 BYTEs search template
BYTE search attributes
---DOS 2.x (and DOS 3.x except 3.1???)---
BYTE search attributes
BYTE drive letter
11 BYTEs search template
---both 2.x and 3.x---
WORD entry count within directory
4 BYTEs reserved
WORD cluster number of parent directory
BYTE attribute of file found
WORD file time
WORD file date
DWORD file size
13 BYTEs ASCIZ filename+extension
---------------------------------------------
INT 21 - DOS 2+ - FIND NEXT ASCIZ (FIND NEXT)
AH = 4Fh
[DTA] = data block from last AH = 4Eh/4Fh call
Return: CF set on error
AX = error code (12h)
[DTA] = data block, see AH = 4Eh above
---------------------------------------------
INT 21 - DOS 2+ internal - SET PSP SEGMENT
AH = 50h
BX = segment address of new PSP
Note: under DOS 2.xx, this function cannot be invoked inside an INT 28h handler
without setting the Critical Error flag
---------------------------------------------
INT 21 - DOS 2+ internal - GET PSP SEGMENT
AH = 51h
Return: BX = current PSP segment
Note: under DOS 2.xx, this function cannot be invoked inside an INT 28h handler
without setting the Critical Error flag
Structure of PSP:
00h 2 BYTEs program exit point
02h WORD memory size in paragraphs
04h BYTE unused
05h 5 BYTEs CP/M entry point
0Ah DWORD terminate address (old INT 22h)
0Eh DWORD break address (old INT 23h)
12h DWORD critical error handler (old INT 24h)
16h WORD parent PSP segment
18h 20 BYTEs DOS 2+ open file table, FFh = unused
2Ch WORD DOS 2+ environment segment
2Eh DWORD DOS 2+ process's SS:SP on entry to last INT 21 call
32h WORD DOS 3.x max open files
36h DWORD DOS 3.x open file table address
38h 24 BYTEs unused by DOS versions <= 3.3
50h 3 BYTEs DOS function dispatcher (FAR routine)
53h 9 BYTEs unused
5Ch 16 BYTEs FCB #1, filled in from first commandline argument
6Ch 20 BYTEs FCB #2, filled in from second commandline argument
80h 128 BYTEs command tail / default DTA buffer
---------------------------------------------
INT 21 - DOS 2+ internal - GET LIST OF LISTS
AH = 52h
Return: ES:BX points to DOS list of lists
List of Lists:
Bytes Value
-2&-1 segment of first memory control block
00h-03h pointer to first DOS Device Control Block (see function 32h)
04h-07h pointer to list of DOS file tables
DWORD pointer to next file table
WORD number of files in this table
35h bytes per file
00h-01h number of file handles referring to this file
02h access mode (see function 3Dh)
03h-04h ???
05h-06h device info word (see function 44h/AL=00h)
07h-0Ah pointer to device driver header if character device
pointer to DOS Device Control Block if block device (see
func 32h for format)
0Bh-0Ch starting cluster of file
0Dh-0Eh file time in packed format
0Fh-10h file date in packed format
11h-14h file size
15h-18h current offset in file
19h-1Ah ???
1Bh-1Ch last cluster read
1Dh-1Eh number of sector containing directory entry
1Fh offset of directory entry within sector (byte offset/32)
20h-2Ah filename in FCB format (no path, no period, blank-padded)
2Bh-30h unused??? I see 0 always
31h-32h PSP segment of file's owner
33h-34h unused??? I see 0 always
08h-0Bh pointer to CLOCK$ device driver, whether installable or resident
0Ch-0Fh pointer to actual CON: device driver, whether installable or resident
-----DOS 2.x
10h number of logical drives in system
11h-12h maximum bytes/block of any block device
13h-16h pointer to first disk buffer
10h bytes control info followed by the 512-byte buffer
DWORD pointer to next disk buffer, FFFFh if last
4 BYTEs ???
WORD logical sector number
2 BYTEs ???
DWORD pointer to DOS Device Control Block (see function 32h)
17h Beginning (not a pointer--the real beginning!) of NUL device driver.
This is the first device on DOS's linked list of device drivers.
-----DOS 3.x
10h-11h maximum bytes/block of any block device
12h-15h pointer to first disk buffer
10h bytes control info per disk buffer, followed by 512-byte buffer
DWORD pointer to next disk buffer, FFFFh if last
BYTE drive (0=A:)
BYTE flags
bit 7: ???
bit 6: ???
bit 5: contents may be overwritten if set (buffer not dirty)
bit 4: ???
bit 3: sector in data area
bit 2: sector in root directory
bit 1: sector in FAT
bit 0: ???
WORD logical sector number
BYTE ???
BYTE ???
DWORD pointer to DOS Device Control Block (see function 32h)
WORD unused??? (almost always 0)
16h-19h pointer to array of drive info:
51h bytes per drive, starting with A: ...
00h-42h current path as ASCIZ, starting with 'x:\'
43h ??? I see zero always
44h ??? I see 40h always
45h-48h pointer to DOS Disk Block for this drive
49h-4Ah starting cluster of current dir, 0 = root, -1 never accessed
4Bh-4Ch ??? I see FFFFh always
4Dh-4Eh ??? I see FFFFh always
4Fh-50h ??? I see 2 always
1Ah-1Dh pointer to FCB table (if CONFIG.SYS contains FCBS=)
1Eh-1Fh size of FCB table
20h number of block devices
21h value of LASTDRIVE command in CONFIG.SYS (default 5)
22h Beginning (not a pointer--the real beginning!) of NUL device driver.
This is the first device on DOS's linked list of device drivers.
device driver header format:
DWORD pointer to next driver or -1 if last driver
WORD device attributes
bit 15 character device if set, block if clear
bit 14 IOCTL supported
bit 13 output until busy (character device)
non-IBM format (block devices)
bit 12 reserved
bit 11 OPEN/CLOSE/RM calls supported
bit 10-5 reserved
bit 4 device is special (uses INT 29 for fast console output)
bit 3 device is CLOCK
bit 2 device is NUL
bit 1 device is standard output
bit 0 device is standard input
WORD device strategy entry point
WORD device interrupt entry point
8 BYTEs blank-padded character device name
WORD (CD-ROM driver) 0
BYTE (CD-ROM driver) drive letter
BYTE (CD-ROM driver) number of units
---------------------------------------------
INT 21 - DOS 2+ internal - TRANSLATE BPB
AH = 53h
DS:SI -> BPB (Bios Parameter Block)
ES:BP -> buffer for DOS Disk Block
Note: Translates BPB (Bios Parameter Block, see below) into a DOS Disk Block
(see function 32h).
BPB structure:
00h WORD bytes/sector. Get from DDB bytes 2-3.
02h BYTE sectors/cluster. Get from (DDB byte 4) + 1
03h WORD reserved sectors. Get from DDB bytes 6-7
05h BYTE number of FATs. Get from DDB byte 8
06h WORD number of root dir entries. Get from DDB bytes 09h-0Ah
08h WORD total number of sectors. Get from:
((DDB bytes D-E) - 1) * (sectors per cluster (BPB byte 2))
+ (DDB Bytes B-C)
0Ah BYTE media descriptor byte. Get from DDB byte 16h
0Bh WORD number of sectors/FAT. Get from DDB byte 0Fh
---DOS 3.x---
0Dh WORD number of sectors per track
0Fh WORD number of heads
11h DWORD number of hidden sectors
15h 11 BYTEs reserved
---------------------------------------------
INT 21 - DOS 2+ - GET VERIFY FLAG
AH = 54h
Return: AL = 0 if flag OFF
AL = 1 if flag ON
---------------------------------------------
INT 21 - DOS 2+ internal - CREATE PSP
AH = 55h
DX = segment number at which to set up PSP
Note: Like func 26h but creates "child" PSP rather than copying existing one.
---------------------------------------------
INT 21 - DOS 2+ - RENAME A FILE
AH = 56h
DS:DX -> ASCIZ old name
ES:DI -> ASCIZ new name
Return: CF set on error
AX = error code (02h,03h,05h,11h
Note: allows move between directories on same logical volume
(DOS 3.x) allows renaming of directories
---------------------------------------------
INT 21 - DOS 2+ - GET FILE'S DATE/TIME
AX = 5700h
BX = file handle
Return: CF set on error
AX = error code (01h,06h)
CF clear if successful
CX = time of last write
DX = date of last write
---------------------------------------------
INT 21 - DOS 2+ - SET FILE'S DATE/TIME
AX = 5701h
BX = file handle
CX = time to be set
DX = date to be set
Return: CF set on error
AX = error code (01h,06h)
---------------------------------------------
INT 21 - DOS 3.x - GET/SET MEMORY ALLOCATION STRATEGY
AH = 58h
AL = function code
0 = get allocation strategy
1 = set allocation strategy
BL = strategy code
0 first fit (use first memory block large enough)
1 best fit (use smallest memory block large enough)
2 last fit (use high part of last usable memory block)
Return: CF set on error
AX = error code (01h)
CF clear if successful
AX = strategy code
Note: the Set subfunction accepts any value in BL; 2 or greater means last fit.
the Get subfunction returns the last value set, so programs should check
whether the value is >= 2, not just equal to 2.
---------------------------------------------
INT 21 - DOS 3.x - GET EXTENDED ERROR CODE
AH = 59h
BX = version code (0000 for DOS 3.x)
Return: AX = extended error code
BH = class of error
BL = suggested action code
CH = locus (where error occurred)
CL, DX, SI, DI, BP, DS, and ES destroyed
Error codes:
01h function number invalid
02h file not found
03h path not found
04h too many open files (no handles available)
05h access denied
06h invalid handle
07h memory control block destroyed
08h insufficient memory
09h memory block address invalid
0Ah environment invalid
0Bh format invalid
0Ch access code invalid
0Dh data invalid
0Fh invalid drive
10h attempted to remove current directory
11h not same device
12h no more files
13h disk write-protected
14h unknown unit
15h drive not ready
16h unknown command
17h data error (CRC)
18h bad request structure length
19h seek error
1Ah unknwon media type (non-DOS disk)
1Bh sector not found
1Ch printer out of paper
1Dh write fault
1Eh read fault
1Fh general failure
20h sharing violation
21h lock violation
22h disk change invalid
ES:DI -> ASCIZ volume label of required disk
23h FCB unavailable
24h sharing buffer overflow
25h-31h reserved
32h Network request not supported (DOS 3.1 + MS Networks)
33h Remote computer not listening
34h Duplicate name on network
35h Network name not found
36h Network busy
37h Network device no longer exists
38h Network BIOS command limit exceeded
39h Network adapter hardware error
3Ah Incorrect response from network
3Bh Unexpected network error
3Ch Incompatible remote adapter
3Dh Print queue full
3Eh Queue not full
3Fh Not enough space to print file
40h Network name was deleted
41h Network: Access denied
42h Network device type incorrect
43h Network name not found
44h Network name limit exceeded
45h Network BIOS session limit exceeded
46h Temporarily paused
47h Network request not accepted
48h Print/disk redirection paused (DOS 3.1 + MS Networks)
49h-4Fh reserved
50h file exists
51h reserved
52h cannot make directory
53h fail on INT 24h
54h (DOS 3.3) too many redirections
55h (DOS 3.3) duplicate redirection
56h (DOS 3.3) invalid password
57h (DOS 3.3) invalid parameter
58h (DOS 3.3) network write fault
Error Classes:
01h out of resource (storage space or I/O channels)
02h temporary situation (file or record lock)
03h authorization (denied access)
04h internal (system software bug)
05h hardware failure
06h system failure (configuration file missing or incorrect)
07h application program error
08h not found
09h bad format
0Ah locked
0Bh media error
0Ch already exists
0Dh unknown
Suggested Action:
01h retry
02h delayed retry
03h prompt user to reenter input
04h abort after cleanup
05h immediate abort
06h ignore
07h retry after user intervention
Error Locus:
01h unknown or not appropriate
02h block device (disk error)
03h network related
04h serial device (timeout)
05h memory related
---------------------------------------------
INT 21 - DOS 3.x - CREATE UNIQUE FILE
AH = 5Ah
DS:DX -> ASCIZ directory path name ending with a '\' + 13 bytes to
receive generated filename
CX = file attribute
Return: CF set on error
AX = error code (03h,05h)
CF clear if successful
AX = file handle
DS:DX -> path name
Note: The file created is not truly "temporary". It MUST be removed by the
user.
---------------------------------------------
INT 21 - DOS 3.x - CREATE NEW FILE
AH = 5Bh
DS:DX -> ASCIZ directory path name
CX = file attribute
Return: CF set on error
AX = error code (03h,04h,05h,50h)
CF clear if successful
DS:DX -> path name
Note: Unlike function 3Ch, function 5Bh will fail if the file already exists.
---------------------------------------------
INT 21 - DOS 3.x - LOCK/UNLOCK FILE ACCESS
AH = 5Ch
AL = 00h lock
01h unlock
BX = file handle
CX:DX = starting offset of region to lock
SI:DI = size of region to lock
Return: CF set on error
AX = error code (01h,06h,21h)
---------------------------------------------
INT 21 - DOS 3.1 internal - INDIRECT FUNCTION CALL
AX = 5D00h
DS:DX -> buffer containing register values
AX, BX, CX, DX, SI, DI, DS, ES
for a call to INT 21h
Return: as appropriate for function being called
Notes: does not check AH. Out of range values will crash the system
---------------------------------------------
INT 21 - DOS 3.1 internal - SYNC???
AX = 5D01h
???
Return: ???
Note: does something to each disk file in the System File Table which has been
written to; if remote file, calls INT 2F/AX=1107h
seems to update the time stamp of all open files which have been written
---------------------------------------------
INT 21 - DOS 3.1 internal - network - ???
AX = 5D02h
???
Return: ???
Note: error unless network is loaded
---------------------------------------------
INT 21 - DOS 3.1 internal - network - ???
AX = 5D03h
???
Return: ???
Note: error unless network is loaded
---------------------------------------------
INT 21 - DOS 3.1 internal - network - ???
AX = 5D04h
???
Return: ???
Note: error unless network is loaded
---------------------------------------------
INT 21 - DOS 3.1 internal - network - ???
AX = 5D05h
???
Return: ES:DI = ???
BX = ???
CX = ???
Note: error unless network is loaded
---------------------------------------------
INT 21 - DOS 3.x internal - GET ADDRESS OF CRITICAL ERROR FLAG
AX = 5D06h
Return: DS:SI -> critical error flag
BX = ???
CX = ???
Notes: this call does a lot of other work in addition to returning the pointer
setting CritErr flag allows use of functions 50h/51h from INT 28h under
DOS 2.x by forcing use of correct stack
---------------------------------------------
INT 21 - DOS 3.x internal - ???
AH = 5Dh
AL = subfunction
07h: ???
08h: ??? (used by COMMAND.COM)
09h: ??? (used by COMMAND.COM)
Return: ???
Note: in DOS 3.10, these are identical, and call INT 2F/AX=1125h
---------------------------------------------
INT 21 - DOS 3.1+ internal - SET EXTENDED ERROR INFORMATION
AX = 5D0Ah
DS:DX = address of 11-word error information
words 0 to 7: values of AX,BX,CX,DX,SI,DI,DS,ES that func 59h
will return
words 8 to 10: zero (reserved)
---------------------------------------------
INT 21 - DOS 3.1 + Microsoft Networks - GET MACHINE NAME
AX = 5E00h
DS:DX -> buffer for ASCIZ name (16 bytes)
Return: CF set on error
AX = error code (01h)
CH = 0 if name not defined
<> 0 defined
CL = NETBIOS name number
DS:DX -> ASCIZ machine name
---------------------------------------------
INT 21 - DOS 3.1 + Microsoft Networks - SET MACHINE NAME
AX = 5E01h
DS:DX -> ASCIZ name
CL = name number
CH = ???
---------------------------------------------
INT 21 - DOS 3.1 + Microsoft Networks - SET PRINTER SETUP
AX = 5E02h
BX = Redirection list index
CX = length of setup string (<= 64)
DS:SI -> string buffer
Return: CF set on error
AX = error code (01h)
---------------------------------------------
INT 21 - DOS 3.1 + Microsoft Networks - GET PRINTER SETUP
AX = 5E03h
BX = Redirection list index
ES:DI -> string buffer
Return: CF set on error
AX = error code (01h)
CX = length of setup string (<= 64)
---------------------------------------------
INT 21 - DOS 3.1 + Microsoft Networks - GET REDIRECTION LIST ENTRY
AX = 5F02h
BX = Redirection list index
DS:SI -> 16 char local device name buffer
ES:DI -> 128 char network name buffer
Return: CF set on error
AX = error code (01h,12h)
BH = Device status flag (BIT 0 = 0 if valid)
BL = device type (03 if printer, 04 if drive)
CX = stored parameter value (user data)
Note: DX and BP are destroyed by this call!
---------------------------------------------
INT 21 - DOS 3.1 + Microsoft Networks - REDIRECT DEVICE
AX = 5F03h
BL = device type
03 = printer device
04 = file device
CX = stored parameter value
DS:SI -> ASCIZ source device name
ES:DI -> destination ASCIZ network path + ASCIZ password
Return: CF set on error
AX = error code (01h,03h,05h,08h)
---------------------------------------------
INT 21 - DOS 3.1 + Microsoft Networks - CANCEL REDIRECTION
AX = 5F04h
DS:SI -> ASCIZ device name or network path
Return: CF set on error
AX = error code (01h,0Fh)
---------------------------------------------
INT 21 - DOS 3.x internal - RESOLVE PATH STRING TO FULLY QUALIFIED PATH STRING
AH = 60h
DS:SI = relative path string
ES:DI = buffer for fully qualified name
Return: buffer filled with qualified name; may return error code, unknown.
---------------------------------------------
INT 21 - DOS 3.x internal - UNUSED
AH = 61h
Return: AL = 0
---------------------------------------------
INT 21 - DOS 3.x - GET PSP ADDRESS
AH = 62h
Return: BX = segment address of PSP
---------------------------------------------
INT 21 - DOS 2.25 only - GET LEAD BYTE TABLE
AH = 63h
AL = subfunction
0 = get system lead byte table
1 = set/clear interim console flag
DL = 1/0 to set/clear interim console flag
2 = get interim console flag
Return: CF set on error
AX = error code
DS:SI -> lead byte table (AL = 0)
DL = interim console flag (AL = 2)
Note: does not preserve any registers other than SS:SP
---------------------------------------------
INT 21 - DOS 3.2 internal - ???
AH = 64h
AL = subfunction
00h get ???
Return: DL = ???
01h set ???
DL = ???
02h get and set ???
DL = new ???
Return: DL = old ???
---------------------------------------------
INT 21 - DOS 3.3 internal - ???
AH = 64h
AL = flag
0 ???
non-0 ???
Return: nothing
Note: seems to have something to do with the network
---------------------------------------------
INT 21 - DOS 3.3 - GET EXTENDED COUNTRY INFORMATION
AH = 65h
AL = info ID
01h get general internationalization info
02h get pointer to uppercase table
04h get pointer to filename uppercase table
06h get pointer to collating sequence table
BX = code page (-1=global code page)
DX = country ID (-1=current country)
ES:DI -> country information buffer
CX = size of buffer (>= 5)
Return: CF set on error
AX = error code
CF clear if succesful
CX = size of country information returned
ES:DI -> country information:
BYTE info ID
if info ID == 1
WORD size
WORD country ID
WORD code page
34 BYTEs see function 38h
if info ID == 2
DWORD pointer to uppercase table
WORD table size
128 BYTEs uppercase equivalents (if any) of chars 80h-FFh
if info ID == 4
DWORD pointer to collating table
WORD table size
256 BYTEs values used to sort characters 00h-FFh
if info ID == 6
DWORD pointer to filename uppercase table
WORD table size
128 BYTEs uppercase equivalents (if any) of chars 80h-FFh
---------------------------------------------
INT 21 - DOS 3.3 - GET GLOBAL CODE PAGE TABLE
AH = 6601h
Return: CF set on error
AX = error code
CF clear if successful
BX = active code page
DX = system code page
---------------------------------------------
INT 21 - DOS 3.3 - SET GLOBAL CODE PAGE TABLE
AX = 6602h
BX = active code page
437 US
850 Multilingual
860 Portugal
863 Canada (French)
865 Norway/Denmark
DX = system code page (active page at boot time)
Return: CF set on error
AX = error code
---------------------------------------------
INT 21 - DOS 3.3 - SET HANDLE COUNT
AH = 67h
BX = desired number of handles (max 255)
Return: CF set if error (and error code in AX)
---------------------------------------------
INT 21 - DOS 3.3 - COMMIT FILE, WRITE ALL BUFFERED DATA TO DISK
AH = 68h
BX = file handle
Return: CF set on error (and error code in AX)
Note: if BX <= 20, no action is taken
---------------------------------------------
INT 21 - DOS 4.0 internal - GET DISK SERIAL NUMBER
AH = 69h
AL = subfunction???
0
DS:DX -> buffer
WORD ??? (zero)
DWORD disk serial number (binary)
11 BYTEs volume label or "NO NAME " if none present
8 BYTEs FAT type--string "FAT12 " or "FAT16 "
Return: buffer filled with appropriate values
---------------------------------------------
INT 21 - DOS 4.0 internal - ???
AH = 6Ah
???
Return: ???
---------------------------------------------
INT 21 - DOS 4.0 internal - ???
AH = 6Bh
???
Return: ???
---------------------------------------------
INT 21 - DOS 4.0 - EXTENDED OPEN/CREATE
AX = 6C00h
BL = open mode as in AL for normal open
BH = 0WF00000
W = auto commit on write
F = return error rather than doing INT 24h
CX = create attribute
DL = action if file exists/does not exists
bits 7-4 action if file does not exist
0000 fail
0001 create
bits 3-0 action if file exists
0000 fail
0001 open
0010 replace/open
DH = 0
DS:SI -> ASCIZ file name
Return: CF set on error
AX = error code
CF clear if successful
AX = file handle
CX = 1 file opened
2 file created
3 file replaced
---------------------------------------------
INT 21 - ???
AH = 89h
???
Note: called by Microsoft C 4.0 startup code
---------------------------------------------
INT 21 - Novell NetWare SFT Level II - EXTENDED FILE ATTRIBUTES
AH = B6h
AL = subfunction
00h get extended file attributes
01h set extended file attributes
CL = attributes
bit 4: transaction tracking file
5: indexing file (to be implemented)
6: read audit (to be implemented)
7: write audit (to be implemented)
DS:DX -> ASCIZ pathname
Return: CF set on error
AL = error code
FFh file not found
8Ch caller lacks privileges
CL = current extended file attributes
---------------------------------------------
INT 21 - Novell Advanced NetWare 2.0+ - PRINT JOBS
AH = B8h
AL = subfunction
00h get default print job flags
01h set default capture flags
02h get specific capture flags
03h set specific print job flags
04h get default local printer
05h set default local printer
06h set capture print queue
07h set capture print job
08h get banner user name
09h set banner user name
CX = buffer size
ES:BX -> buffer
Return: none
---------------------------------------------
INT 21 - Novell NetWare 4.0 - SET END OF JOB STATUS
AH = BBh
AL = new EOJ flag
00h disable EOJs
otherwise enable EOJs
Return: AL = old EOJ flag
---------------------------------------------
INT 21 - Novell NetWare 4.6 - LOG PHYSICAL RECORD
AH = BCh
AL = flags
bit 0: lock as well as log record
1: non-exclusive lock
BX = file handle
CX:DX = offset
BP = timeout in timer ticks (1/18 sec)
SI:DI = length
Return: AL = error code
---------------------------------------------
INT 21 - Novell NetWare 4.6 - RELEASE PHYSICAL RECORD
AH = BDh
BX = file handle
CX:DX = offset
Return: AL = error code
---------------------------------------------
INT 21 - Novell NetWare 4.6 - CLEAR PHYSICAL RECORD
AH = BEh
BX = file handle
CX:DX = offset
Return: AL = error code
---------------------------------------------
INT 21 - Novell NetWare 4.6 - LOG RECORD (FCB)
AH = BFh
AL = flags
bit 0: lock as well as log record
1: non-exclusive lock
DS:DX -> FCB
BX:CX = offset
BP = timeout in timer ticks (1/18 sec)
SI:DI = length
Return: AL = error code
---------------------------------------------
INT 21 - Novell NetWare 4.6 - RELEASE RECORD (FCB)
AH = C0h
DS:DX -> FCB
BX:CX = offset
Return: AL = error code
---------------------------------------------
INT 21 - Novell NetWare 4.6 - CLEAR RECORD (FCB)
AH = C1h
DS:DX -> FCB
BX:CX = offset
Return: AL = error code
---------------------------------------------
INT 21 - Novell NetWare 4.6 - LOCK PHYSICAL RECORD SET
AH = C2h
AL = flags
bit 1: non-exclusive lock
BP = timeout in timer ticks (1/18 sec)
--