ralf@B.GP.CS.CMU.EDU (Ralf Brown) (12/06/87)
Remove headers and trailers and sandwich between parts 1 and 3. This part continues INT 21/AH=25 *-*-*-------cut-----------cut--------------cut--------------*-*-* AL = interrupt number DS:DX = new vector to be used for specified interrupt ----------------------------------------------------------- INT 21 - Create PSP AH = 26h DX = Segment number to set up PSP at Current PSP is copied to specified segment ----------------------------------------------------------- INT 21 - RANDOM BLOCK READ AH = 27h DS:DX = address of FCB CX = number of records to be read Return: AL = 0 = successful read 1 = end of file 2 = data transfer area too small 3 = partial record, EOF ----------------------------------------------------------- INT 21 - RANDOM BLOCK WRITE AH = 28h DS:DX = address of FCB CX = number of records to be written if zero, truncate file to current random file position Return: AL = 0 = successful write 1 = disk full 2 = data transfer area too small ----------------------------------------------------------- INT 21 - Parse Filename AH = 29h DS:SI = pointer to string to parse ES:DI = pointer to memory to fill with unopened FCB AL = bit mask to control parsing 0 = 0: parsing stops if file separator found 1: leading separator ignored 1 = 0: drive number in FCB set to default drive if not present in string 1: drive number in FCB not changed 2 = 0: filename in FCB set to blanks if no filename in string 1: filename in FCB not changed if string does not contain a filename 3 = 0: extension in FCB set to blanks if no extension in string 1: extension left unchanged Return: AL = 00: no wildcards in name or extension 01: wildcards appeared DS:SI = pointer to first byte after parsed string ES:DI = unopened FCB ----------------------------------------------------------- INT 21 - GET CURRENT DATE AH = 2Ah Return: DL = day DH = month CX = year AL = day of the week (0=Sunday, 1=Monday, etc.) ----------------------------------------------------------- INT 21 - Set CURRENT DATE AH = 2Bh DL = day DH = month CX = year Return: AL = 0 if no error AL = 0FFh if bad value sent to routine (DOS 3.3 also sets CMOS clock) (DESQview also accepts CX = 4445h and DX = 5351h, i.e. 'DESQ' as valid) ----------------------------------------------------------- INT 21 - 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 - Set CURRENT TIME AH = 2Dh CH = hours CL = minutes DH = seconds DL = hundredths of seconds Return: AL = 0 if no error AL = 0ffH if bad value sent to routine (DOS 3.3 also sets CMOS clock) ----------------------------------------------------------- INT 21 - Set Verify Flag AH = 2Eh DL = 0 AL = 1 if VERIFY on AL = 0 if VERIFY off ----------------------------------------------------------- INT 21 - Get Disk Transfer Area Address AH = 2Fh Return: ES:BX = address of DTA ----------------------------------------------------------- INT 21 - Get DOS Version AH = 30h Return: AL = Major Version number AH = Minor Version number BH = OEM number BL:CX = 24-bit user number ----------------------------------------------------------- INT 21 - TERMINATE BUT STAY RESIDENT AH = 31h AL = exit code DX = program size, in paragraphs ----------------------------------------------------------- INT 21 - 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 = address of drive parameter block. STRUCTURE OF DOS DRIVE PARAMETER BLOCK: DPBLOCK STRUCT ;OFFSET DISK_OFFSET DB ? ; 0. drive number (0 = A, etc.) UNIT_OFFSET DB ? ; 1. unit number within device driver SECTOR_SIZE DW ? ; 2. number of bytes per sector MAX_CLUSTER DB ? ; 4. largest sector number in cluster ; add one for number of sectors/cluster LOG2_SECTORS DB ? ; 5. log base two of the cluster size RESERVED DW ? ; 6. number of reserved (boot) sectors FAT_COUNT DB ? ; 8. number of copies of the FAT ROOT_COUNT DW ? ; 9. number of root directory entries DATA_START DW ? ; 11. first data sector on medium MAX_NUMBER DW ? ; 13. largest possible cluster number ; subtract one for number of data clusters FAT_SECTORS DB ? ; 15. number of sectors in one FAT copy ROOT_START DW ? ; 16. first sector of root directory DEVICE_ADDR DD ? ; 18. address of device driver for this drive DESCRIPTOR DB ? ; 22. media descriptor byte for medium VALID_BYTE DB ? ; 23. 0FFh indicates block must be rebuilt NEXT_BLOCK DD ? ; 24. address of next device block in list ; FROM THIS POINT ON, DOS 3 DIFFERS FROM 2: IF DOS2 DIR_START DW ? ; 28. starting cluster of current directory ; zero indicates the root directory PATH_NAME DB 64 DUP (?) ; 30. ASCIIZ current directory path string ELSE DOS3 ; on my XT, this was always: DW 0 DW 0FFFFh ENDIF DPBLOCK ENDS ----------------------------------------------------------- INT 21 - Get or Set CONTROL-BREAK AH = 33h AL = subfunction 00h Get 01h Put DL = 0 for OFF or 1 for ON 02h internal, called by PRINT.COM (DOS 3.1) Return: DL = current BREAK setting if AL = 00h 0 BREAK=OFF 1 BREAK=ON AL = FFh if error ----------------------------------------------------------- INT 21 - Internal - Return CritSectFlag Pointer AH = 34h Return: ES:BX points to DOS "Critical Section Flag" Notes: When byte pointed to is zero, DOS is supposed to be safe to interrupt. NOT RELIABLE according to Chris Dunford. Examination of DOS 2.10 code in this area indicates that the byte immediately FOLLOWING this "Critical Section Flag" must be 00 to permit the PRINT.COM interrupt to be called. For DOS 3.0 and 3.1 (except COMPAQ DOS 3.0), the byte BEFORE the "Critical Section Flag" must be zero, and for COMPAQ DOS 3.0, the byte 01AAh before it must be zero. ----------------------------------------------------------- INT 21 - Get Interrupt Vector AH = 35h AL = interrupt number Return: ES:BX = value of interrupt vector ----------------------------------------------------------- INT 21 - 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 x CX x BX for free space on disk multiply AX x CX x DX for total disk space ----------------------------------------------------------- INT 21 - 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: DL = Switch character (if AL=0 or 1) Device availability flag (if AL=2 or 3) AL=0FFh means the value in AL was not in the range 0-3. ----------------------------------------------------------- INT 21 - 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) BX = country code DS:DX filled in: bytes 0-1 = date format (see above) bytes 2-6 = currency symbol string, ASCIZ byte 7 = thousands seaprator char byte 8 = 00h byte 9 = decimal separator char byte 0Ah = 00h byte 0Bh = date separator char byte 0Ch = 00h byte 0Dh = time separator char byte 0Eh = 00h byte 0Fh = currency format 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 10h = number of digits after decimal in currency byte 11h = time format bit 0 = 0 if 12-hour clock 1 if 24-hour clock bytes 12h-15h = address of case map routine (FAR CALL) byte 16h = data-list separator char byte 17h = 00h bytes 18h-21h reserved If error: CF set AX = error code ----------------------------------------------------------- INT 21 - CREATE A SUBDIRECTORY (MKDIR) AH = 39h DS:DX = address of ASCIIZ pathname Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - REMOVE A DIRECTORY ENTRY (RMDIR) AH = 3Ah DS:DX = address of ASCIIZ pathname Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - CHANGE THE CURRENT DIRECTORY (CHDIR) AH = 3Bh DS:DX = address of ASCIIZ directory name Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - CREATE A FILE WITH HANDLE (CREAT) AH = 3Ch CX = attributes for file DS:DX = address of ASCIZ filename Return: CF = 1 if error AX = Error Code CF = 0 successful AX = file handle ----------------------------------------------------------- INT 21 - 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 DX = OFFSET ADDRESS OF ASCIIZ Return: CF = 1 if error AX = Error Code CF = 0 successful AX = file handle ----------------------------------------------------------- INT 21 - CLOSE A FILE WITH HANDLE AH = 3Eh BX = file handle Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - READ FROM FILE WITH HANDLE AH = 3Fh BX = file handle CX = number of bytes to read DS:DX = address of buffer Return: CF = 1 if error AX = Error Code CF = 0 successful AX = number of bytes read ----------------------------------------------------------- INT 21 - WRITE TO FILE WITH HANDLE AH = 40h BX = file handle CX = number of bytes to write DS:DX = pointer to buffer Return: CF = 1 if error AX = Error Code CF = 0 successful AX = number of bytes written ----------------------------------------------------------- INT 21 - DELETE A FILE (UNLINK) AH = 41h DS:DX = pointer to ASCIIZ name of file to delete Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - 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 = 1 if error AX = Error Code CF = 0 successful DX:AX = new offset ----------------------------------------------------------- INT 21 - 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 DX = pointer to ASCIIZ file name Return: CF = 1 if error AX = Error Code if any CX = file attributes on get ----------------------------------------------------------- INT 21 - IOCTL AH = 44h AL = 0 = Get device information (DX) 1 = Set device information (DL, DH = 0) DX BITS = 0 = console input device 1 = console output device 2 = null device 3 = clock device 5 = binary mode 6 = EOF 7 = device is character device if set if not, EOF = 0 if channel has been written bits 0-5 are block device number 12 = network device 14 = can process control strings (AL=2-5, can only be read) 15 reserved 2 = Read CX bytes to DS:DX from BX control chan 3 = Write CX bytes from DS:DX from BX control chan 4 = as 2 but for drive BL 5 = as 3 but for drive BL AX = number of bytes transfered 6 = Get input status 7 = Get output status AX = FFH for ready or 00h for not ready 8 = Is block device BL changeable? (DOS 3) AX = 0 = yes 9 = Is logical device BL local? (DOS 3) DX (attribute word) bit 12 (1000h) = 0 = yes 10 = Is handle BX local? (DOS 3) DX (attribute word) bit 15 (8000h) = 0 = yes 11 = Change sharing retry count to DX (def 3), (DOS 3.x) delay CX (def 1) 12 = General IOCTL (DOS 3.3 [3.2?]) BX = file handle (or BL = drive number w/0 = default) Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - Create Duplicate Handle (DUP) AH = 45h BX = file handle to duplicate Return: CF = 1 if error AX = Error Code CF = 0 successful AX = new file handle ----------------------------------------------------------- INT 21 - Force Duplicate Handle (FORCDUP) (DUP2) AH = 46h BX = Existing file handle CX = new file handle Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - Get Current Directory AH = 47h DL = drive (0=default, 1=A, etc.) DS:SI points to 64-byte buffer area Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - Allocate Memory AH = 48h BX = number of 16-byte paragraphs desired Return: CF = 1 if error AX = Error Code BX = Maximum available CF = 0 successful AX = segment of allocated memory block ----------------------------------------------------------- INT 21 - Free Memory AH = 49h ES = Segment address of area to be freed Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - Adjust Block Size (SETBLOCK) AH = 4Ah ES = Segment address of block to change BX = New size in paragraphs Return: CF = 1 if error AX = Error Code BX = Maximum size possible for the block ----------------------------------------------------------- INT 21 - Load or Execute (EXEC) AH = 4Bh AL = subfunction 0 = load and execute program 2 = load (Internal) but do not execute 3 = load overlay; do not create PSP DS:DX = filename ES:BX = parameter block AL = 0 => word segment environment pointer dword command line pointer dword FCB 1 dword FCB 2 3 => word segment load address word segment relocation factor Return: CF = 1 if error AX = Error Code struct exec { unsigned exec_magic; /* 0x4d, 0x5a signature */ unsigned exec_isr; /* image size remainder (mod 512) */ unsigned exec_size; /* file size in pages (512) */ unsigned exec_nrel; /* number of relocation items */ unsigned exec_hsize; /* header size in paragraphs */ unsigned exec_min; /* minimum extra paragraphs */ unsigned exec_max; /* maximum extra paragraphs */ unsigned exec_ss; /* stack segment */ unsigned exec_sp; /* stack offset */ unsigned exec_cksum; /* word checksum of entire file */ unsigned exec_pc; /* initial pc */ unsigned exec_cs; /* code segment */ unsigned exec_orel; /* offset of relocation table */ unsigned exec_ovno; /* overlay number */ }; ----------------------------------------------------------- INT 21 - Quit With Exit Code (EXIT) AH = 4Ch AL = exit code Return: never returns ----------------------------------------------------------- INT 21 - 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 - Find First ASCIIZ (FIND FIRST) AH = 4Eh CX = search attributes DS:DX = pointer to ASCIIZ filename Return: CF = 1 if error AX = Error Code if any (DTA) = data block ----------------------------------------------------------- INT 21 - Find Next ASCIIZ (FIND NEXT) AH = 4Fh Return: CF = 1 if error AX = Error Code (DTA) = data block ----------------------------------------------------------- INT 21 - 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 ----------------------------------------------------------- INT 21 - Internal - Get PSP Segment AH = 51h Return: BX = Current PSP Segment struct psp { char psp_int20[2]; /* 00h: exit */ unsigned psp_msize; /* 02h: memory size in paragraphs */ char psp_res0[1]; /* 04h: XXX (0) */ char psp_dos[5]; /* 05h: far call to dos */ int (*psp_term)(); /* 0ah: terminate address */ unsigned psp_tseg; /* 0ch: terminate segment */ int (*psp_break)(); /* 0eh: break address */ unsigned psp_bseg; /* 10h: break segment */ int (*psp_error)(); /* 12h: error address */ unsigned psp_eseg; /* 14h: error segment */ unsigned psp_ppsp; /* 16h: parent psp segment */ char psp_ofile[20]; /* 18h: open files, 0xff = unused */ unsigned psp_envp; /* 2ch: environment segment */ char psp_res2[4]; /* 2eh: XXX */ int psp_nfiles; /* 32h: max open files */ char *psp_aofile; /* 34h: ofile address */ unsigned psp_aoseg; /* 36h: ofile segment */ char psp_res3[24]; /* 38h: XXX */ char psp_int21[3]; /* 50h: int 21, far return */ char psp_res4[2]; /* 53h: XXX */ char psp_xfcb1[7]; /* 55h: FCB #1 extension */ char psp_fcb1[9]; /* 5ch: FCB #1 */ char psp_xfcb2[7]; /* 65h: FCB #2 extension */ char psp_fcb2[20]; /* 6ch: FCB #2 */ char psp_dma[128]; /* 80h: Command Tail */ }; Note: under DOS 2.xx, this function cannot be invoked inside an INT 28h handler ----------------------------------------------------------- INT 21 - Internal - Get Disk List AH = 52h Return: ES:BX points to DOS list of lists List of Lists: Bytes Value -2&-1 Segment of first memory control block 0-3 Pointer to first DOS disk block (see func 36h) 4-7 Partially Unknown. Pointer to a device driver. Maybe first resident driver? 8-B Pointer to CLOCK$ device driver, whether installable or resident C-F Pointer to actual CON: device driver, whether installable or resident -----DOS 2.x 10 Number of logical drives in system 11-12 Maximum bytes/block of any block device 13-16 unknown 17 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 10-11 Maximum bytes/block of any block device (0200h) 12-15 Unknown. Pointer to current directory block???? 16-19 Partially Undefined: Pointer to array of drive info: 51h bytes per drive, starting with A: ... 00-3F Current path as ASCIIZ, starting with 'x:\' 40-43 Unknown. I see zeros always 44 Unknown. Flags? I see 40h, except for entry after last valid entry = 00h 45-48 Pointer to DOS Disk Block for this drive 49-4A Unknown. Current track or block? -1 if never accessed. 4B-4E Unknown. I see -1 always 4F-52 Unknown. I see 2 always 1A-1D Unknown. Pointer to data area, maybe including cluster allocation table? 1E-1F Unknown. I see zero always 20 Number of block devices. 21 Value of LASTDRIVE command in CONFIG.SYS (default 5) 22 Beginning (not a pointer. The real beginning!) of NUL device driver. This is the first device on DOS's linked list of device drivers. ----------------------------------------------------------- INT 21 - Internal - Translate BPB AH = 53h DS:SI points to BPB (Bios Parameter Block) ES:BP points to area for DOS Disk Block Translates BPB (Bios Parameter Block, see below) into a DOS Disk Block (see function call 32h). BPB Bytes Value 0-1 Bytes/sector. Get from DDB bytes 2-3. 2 Sectors/cluster. Get from: (DDB byte 4) + 1 3-4 Reserved sectors. Get from: DDB bytes 6-7 5 Number of FATs. Get from: DDB byte 8 6-7 Number of root dir entries. Get from: DDB bytes 9-A 8-9 Total # of sectors. Get from: ((DDB bytes D-E) - 1) * (sectors per cluster (BPB byte 2)) + (DDB Bytes B-C) A Media descriptor byte. Get from: DDB byte 16 B-C Number of sectors/FAT. Get from: DDB byte F ----------------------------------------------------------- INT 21 - Get Verify Flag AH = 54h Return: AL = 0 if flag OFF AL = 1 if flag ON ----------------------------------------------------------- INT 21 - Internal - Create PSP AH = 55h DX = Segment number to set up PSP at Note: Like FN 26h but creates "child" PSP rather than copying existing one. ----------------------------------------------------------- INT 21 - RENAME A FILE AH = 56h DS:DX = pointer to ASCIZ old name ES:DI = pointer to ASCIZ new name Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - Get/Put Date/Time AH = 57h AL = function code 0 = get date and time 1 = set date and time CX = time to be set DX = date to be set BX = file handle Return: CF = 1 if error AX = Error Code CX = time of last write (if AL = 0) DX = date of last write (if AL = 0) ----------------------------------------------------------- INT 21 - Get/Set allocation strategy (DOS 3.x) 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 = 1 error AX = Error Code CF = 0 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 - GET EXTENDED ERROR CODE (DOS 3.X) AH = 59h BX = version code (0000 for DOS 3.0) Return: AX = extended error code BH = class of error BL = suggested action code CH = locus (where error occurred) Error codes: 01 function number invalid 02 file not found 03 path not found 04 too many open files 05 access denied 06 invalid handle 07 memory control block destroyed 08 insufficient memory 09 memory block address invalid 0A environment invalid 0B format invalid 0C access code invalid 0D data invalid 0F invalid drive 10 attempted to remove current directory 11 not same device 12 no more files 13 disk write-protected 14 unknown unit 15 drive not ready 16 unknown command 17 data error (CRC) 18 bad request structure length 19 seek error 1A unknwon media type 1B sector not found 1C printer out of paper 1D write fault 1E read fault 1F general failure 20 sharing violation 21 lock violation 22 disk change invalid 23 FCB unavailable 24-31 reserved 32 Network request not supported (DOS 3.1 + MS Networks) 33 Remote computer not listening 34 Duplicate name on network 35 Network name not found 36 Network busy 37 Network device no longer exists 38 Network BIOS command limit exceeded 39 Network adapter hardware error 3A Incorrect response from network 3B Unexpected network error 3C Incompatible remote adapter 3D Print queue full 3E Queue not full 3F Not enough space to print file 40 Network name was deleted 41 Network: Access denied 42 Network device type incorrect 43 Network name not found 44 Network name limit exceeded 45 Network BIOS session limit exceeded 46 Temporarily paused 47 Network request not accepted 48 Print/disk redirection paused (DOS 3.1 + MS Networks) 49-4F reserved 50 file exists 51 reserved 52 cannot make directory 53 fail on INT 24h Error Classes: 01 out of resource 02 temporary situation 03 authorization (denied access) 04 internal 05 hardware failure 06 system failure 07 application program error 08 not found 09 bad format 0A locked 0B media error 0C already exists 0D unknown Suggested Action: 01 retry 02 delayed retry 03 prompt user 04 abort after cleanup 05 immediate abort 06 ignore 07 retry after user intervention Error Locus: 01 unknown or not appropriate 02 block device 03 network related 04 serial device 05 memory related ----------------------------------------------------------- INT 21 - CREATE TMEPORARY FILE (DOS 3.x) AH = 5Ah DS:DX = pointer to ASCIZ directory path name CX = file attribute Return: CF = 1 if error AX = Error Code if any DS:DX = path name Note: The file created is not truly "temporary". It MUST be removed by the user. ----------------------------------------------------------- INT 21 - CREATE NEW FILE (DOS 3.x) AH = 5Bh DS:DX = pointer to ASCIZ directory path name CX = file attribute Return: CF = 1 if error AX = Error Code if any DS:DX = path name Note: Unlike function 3Ch, function 5Bh will fail if the file already exists. ----------------------------------------------------------- INT 21 - LOCK/UNLOCK FILE ACCESS (DOS 3.x) AH = 5Ch AL = 0 if lock 1 if unlock BX = file handle CX:DX = starting offset of region to lock SI:DI = size of region to lock Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - Internal - Get address of critical error flag AX = 5D06h Return: DS:SI = pointer to critical error flag CX = ??? DX = ??? Note: this call also does a lot of other work in addition to returning the pointer ----------------------------------------------------------- INT 21 - Internal - Unknown AH = 5Dh AL = subfunction 07h: ??? 08h: (used by COMMAND.COM) 09h: (used by COMMAND.COM) ----------------------------------------------------------- INT 21 - Get Machine Name (DOS 3.1 + Microsoft Networks) AX = 5E00h DS:DX -> buffer for ASCIIZ name Return: CF = 1 if error AX = Error Code CH = 0 if name not defined CL = NETBIOS name number DS:DX -> pointer to identifier if CH <> 0 ----------------------------------------------------------- INT 21 - Set Printer Setup (DOS 3.1 + Microsoft Networks) AX = 5E02h BX = Redirection list index CX = length of setup string <= 64 DS:SI -> string buffer Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - Get Printer Setup (DOS 3.1 + Microsoft Networks) AX = 5E03h BX = Redirection list index ES:DI -> string buffer Return: CF = 1 if error AX = Error Code CX = length of setup string <= 64 ----------------------------------------------------------- INT 21 - Get Redirection List Entry (DOS 3.1 + Microsoft Networks) AX = 5F02h BX = Redirection list index DS:SI -> 16 char local device name buffer ES:DI -> 128 char network name buffer Return: CF = 1 if error AX = Error Code BH = Device status flag (BIT 0 = 0 if valid) BL = device type (03 if printer, 04 if drive) CX = stored parameter value Note: DX and BP are destroyed by this call! ----------------------------------------------------------- INT 21 - Redirect Device (DOS 3.1 + Microsoft Networks) AX = 5F03h BL = device type 03 = printer device 04 = file device CX = stored parameter value DS:SI -> source device name ES:DI -> destination ASCIIZ network path + ASCIIZ password Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - Cancel Redirection (DOS 3.1 + Microsoft Networks) AX = 5F04h DS:SI -> device name or network path Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 21 - Internal - Resolve path string to fully qualified path string AH = 60h DI:SI = relative path strings ES:DI = buffer for fully qualified name Return: buffer filled with qualified name may return error code, unknown. ----------------------------------------------------------- INT 21 - Internal - Unused (DOS 3.x) AH = 61h Return: AL = 0 ----------------------------------------------------------- INT 21 - GET PSP ADDRESS (DOS 3.x) AH = 62h Return: BX = segment address of PSP ----------------------------------------------------------- INT 21 - GET LEAD BYTE TABLE (DOS 2.25 only) 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: DS:SI -> lead byte table (AL = 0) DL = interim console flag (AL = 2) ----------------------------------------------------------- INT 21 - Internal - unknown (DOS 3.3) AH = 64h ----------------------------------------------------------- INT 21 - GET EXTENDED COUNTRY INFORMATION (DOS 3.3) AH = 65h AL = info ID (1 - 6) BX = code page (-1=global code page) DX = country ID (-1=current country) ES:DI = pointer to country information buffer CX = size of buffer Return: AX = error code if carry set, otherwise CX = size of country information returned ES:DI = pointer to country information: 1 BYTE info ID if info ID <> 1 1 DWORD pointer to information if info ID == 1 1 WORD size 1 WORD country ID 1 WORD code page 34 BYTE see function 38h ----------------------------------------------------------- INT 21 - GET/SET GLOBAL CODE PAGE TABLE (DOS 3.3) AH = 66h AL = 00h get global code page Return: AX = error code if carry flag set BX = active code page DX = system code page = 01h set global page BX = active code page DX = system code page (active page at boot time) Return: AX = error code if carry flag set ----------------------------------------------------------- INT 21 - SET HANDLE COUNT (DOS 3.3) AH = 67h BX = desired number of handles (max 255) Return: Carry clear if ok Carry set if error (and error code in AX) ----------------------------------------------------------- INT 21 - COMMIT FILE - WRITE ALL BUFFERED DATA TO DISK (DOS 3.3) AH = 68h BX = file handle Return: carry flag set on error (and error code in AX) ----------------------------------------------------------- INT 21 - DoubleDos - AX = E400h Return: AL <> 0 if DoubleDos is active ----------------------------------------------------------- INT 21 - DoubleDos - Turn off Task Switching AH = EAh Return: task switching turned off ----------------------------------------------------------- INT 21 - DoubleDos - Turn on Task Switching AH = EBh Return: task switching turned on ----------------------------------------------------------- INT 21 - DoubleDos - Get Virtual Screen Address AH = ECh Return: ES = segment of virtual screen Note: Screen address can change if task-switching is on!! ----------------------------------------------------------- INT 21 - DoubleDos - Give away time to other tasks AH = EEh AL = number of 55ms time slices to give away Return: returns after giving away time slices ----------------------------------------------------------- INT 21 - CED installable commands AH = 0FFh AL = 0 add installable command BL = mode - bit 0 = 1 callable from DOS prompt bit 1 = 1 callable from application DS:SI pointer to CR-terminated command name ES:DI pointer to FAR routine entry point AL = 1 remove installable command DS:SI pointer to CR-terminated command name AL = 2 reserved, may be used to test for CED installation Return: CF set on error AX = 01h invalid function 02h command not found (subfunction 1 only) 08h insufficient memory (subfunction 0 only) 0Eh bad data (subfunction 0 only) AH = 0FFh if CED not installed ----------------------------------------------------------- INT 22 - TERMINATE ADDRESS FAR (DWORD) address of routine to be executed when program "returns to DOS". Should NEVER be called directly. ----------------------------------------------------------- INT 23 - CONTROL "C" EXIT ADDRESS Automatically called from keyboard scanner when CTRL-C or CTRL-BREAK is detected. Normally aborts program and returns to DOS, but may be changed. ----------------------------------------------------------- INT 24 - FATAL ERROR ABORT ADDRESS Automatically called upon detection of unrecoverable disk error. Normally prints "Abort, Retry, or Ignore?" message and takes the reply, but may be changed if desired. Provides the following values in registers on entry to interrupt handler: AH: bit 7 = 0 disk I/O error = 1 other error -- if block device, bad FAT -- if char device, code in DI bit 6 unused bit 5 = 1 if Ignore allowed, 0 if not (DOS 3.2?) bit 4 = 1 if Retry allowed, 0 if not (DOS 3.2?) bit 3 = 1 if Fail allowed, 0 if not (DOS 3.2+) bit 2 \ disk area of error 00 = DOS area 01 = FAT bit 1 / 10 = root dir 11 = data area bit 0 = 1 if write, 0 if read AL = drive number if AH bit 7 = 1, otherwise undefined BP:SI = address of device header for which error occurred block device if high bit of BP:SI+4 = 1 low byte of DI: 00h write-protect error 01h unknown unit 02h drive not ready 03h unknown command 04h data error (bad CRC) 05h bad request structure length 06h seek error 07h unknown media type 08h sector not found 09h printer out of paper 0Ah write fault 0Bh read fault 0Ch general failure 0Fh invalid disk change (DOS 3.x) Handler must return AL = 00 ignore error = 01 retry operation = 02 terminate program through INT 22h = 03 fail system call in progress (DOS 3.2+) ----------------------------------------------------------- INT 25 - ABSOLUTE DISK READ AL = Drive number (0=A, 1=B, etc) DS:BX = Disk Transfer Address (buffer) CX = Number of sectors to read DX = First relative sector to read Return: CF = 1 if error AL = error code issued to INT 24h in low half of DI AH = 80h if attachment failed to respond 40h if seek operation failed 20h if controller failed 10h if data error (bad CRC) 08h if DMA failure 04h if requested sector not found 03h if write-protected disk 02h if bad address mark 01h if bad command Note: ORIGINAL FLAGS ON STACK! ----------------------------------------------------------- INT 26 - ABSOLUTE DISK WRITE AL = Drive number (0=A, 1=B, etc) DS:BX = Disk Transfer Address (buffer) CX = Number of sectors to write DX = First relative sector to write Return: CF = 1 if error AL = error code issued to INT 24h in low half of DI AH = same error codes as for INT 25h Note: ORIGINAL FLAGS ON STACK! ----------------------------------------------------------- INT 27 - TERMINATE BUT STAY RESIDENT CS = current program segment DX = last program byte + 1 ----------------------------------------------------------- INT 28 - Internal - Keyboard Busy Loop This interrupt is called from inside the "get input from keyboard" routine in DOS, if and only if it is safe to use INT 21 to access the disk at that time. It is used primarily by the PRINT.COM routines and TSR programs, but any number of other routines could be chained to it by saving the original vector, and calling it with a FAR call (or just JMPing to it) at the end of the new routine. The INT 28h handler may invoke any INT 21h function except functions 00h through 0Ch (and 50h/51h under DOS 2.xx). Until some program installs its own routine, this interrupt vector simply points to an IRET opcode. ----------------------------------------------------------- INT 29 - Internal - Fast Putchar This interrupt is called from the DOS output routines if output is going to a device rather than a file, and the device driver's attribute word has bit 3 (04h) set to "1". ----------------------------------------------------------- INT 2A - Network Installation Check (Microsoft Networks) AH = 00h Return: AH <> 0 if installed ----------------------------------------------------------- INT 2A - Check Direct I/O (Microsoft Networks) AX = 0300h DS:SI -> ASCIIZ disk device name Return: CF == 0 if allowed ----------------------------------------------------------- INT 2A - Execute NETBIOS (Microsoft Networks) AH = 04h AL = 0 for error retry, 1 for no retry ES:BX -> NCB Return: AX = 0 for no error AH = 1, AL = error code ----------------------------------------------------------- INT 2A - Get Network Resource Information (Microsoft Networks) AX = 0500h Return: AX = reserved BX = number of network names CX = number of commands DX = number of sessions ----------------------------------------------------------- INT 2A - Unknown AH = 82h Return: ??? Note: Called by the INT 21h function dispatcher in DOS 3.10 ----------------------------------------------------------- INT 2B - Internal routine for MSDOS (IRET) ----------------------------------------------------------- INT 2C - Internal routine for MSDOS (IRET) ----------------------------------------------------------- INT 2D - Internal routine for MSDOS (IRET) ----------------------------------------------------------- INT 2E - Internal - Execute Command ES:SI -> counted CR-terminated command string The top-level command.com executes the command; all registers are destroyed as in exec. ----------------------------------------------------------- INT 2F - Multiplexor - PRINT Installation Check AX = 0100h Return: AL = FFh installed 01h not installed, not OK to install 00h not installed, OK to install ----------------------------------------------------------- INT 2F - Multiplexor - PRINT Submit file AX = 0101h DS:DX -> packet of one byte level and DWORD file pointer Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 2F - Multiplexor - PRINT Remove file AX = 0102h DS:DX -> file name (wildcards allowed) Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 2F - Multiplexor - PRINT Remove all files AX = 0103h Return: CF = 1 if error AX = Error Code ----------------------------------------------------------- INT 2F - Multiplexor - PRINT Hold queue/Get status AX = 0104h Return: CF = 1 if error AX = Error Code 01h function invalid 02h file not found 03h path not found 04h too many open files 05h access denied 08h queue full 09h spooler busy 0Ch name too long 0Fh drive invalid DX = Error count DS:SI -> print queue (null-string terminated list of 64-byte ASCIZ file names) ----------------------------------------------------------- INT 2F - Multiplexor - PRINT Restart queue AX = 0105h Return: Flag CF = 1 if error AX = Error Code if any ----------------------------------------------------------- INT 2F - Multiplexor - ASSIGN Installation Check AX = 0600h Return: AH <> 0 if installed ----------------------------------------------------------- INT 2F - Multiplexor - ASSIGN AX = 0601h XXX ----------------------------------------------------------- INT 2F - Multiplexor - MSDOS Internal AH = 10h XXX ----------------------------------------------------------- INT 2F - Multiplexor - MSDOS Internal AH = 11h XXX ----------------------------------------------------------- INT 2F - Multiplexor - MSDOS Internal AH = 12h XXX ----------------------------------------------------------- INT 2F - Multiplexor - APPEND Installation Check AX = B700h Return: AH <> 0 if installed ----------------------------------------------------------- INT 2F - Multiplexor - APPEND AX = B701h XXX ----------------------------------------------------------- INT 2F - Multiplexor - Network Program Installation Check AX = B800h Return: AH <> 0 if installed ----------------------------------------------------------- INT 2F - Multiplexor - Get Current Post Address AX = B803h Return: ES:BX = post address ----------------------------------------------------------- INT 2F - Multiplexor - Set New Post Address AX = B804h ES:BX = new post address ----------------------------------------------------------- INT 30 -> (NOT A VECTOR!) FAR jump instruction for CP/M-style calls INT 31 ----------------------------------------------------------- INT 32 -> not used ----------------------------------------------------------- INT 33 -> USED BY MICROSOFT MOUSE ----------------------------------------------------------- INT 40 -> Relocated (by fixed disk) Floppy Handler (original INT 13h) ----------------------------------------------------------- INT 41 -> Fixed Disk Params dw cylinders db heads dw 0 dw write pre-comp db 0 db 0 "control byte" db 0, 0, 0 dw landing zone db sectors/track db 0 ----------------------------------------------------------- INT 42 -> Relocated (by EGA) Video Handler (original INT 10h) ----------------------------------------------------------- INT 43 -> EGA Initialization Params ----------------------------------------------------------- INT 44 -> EGA/PCjr fonts ----------------------------------------------------------- INT 45 -> reserved ----------------------------------------------------------- INT 46 -> Secondary Fixed Disk Params (see INT 41h) ----------------------------------------------------------- INT 47 -> reserved ----------------------------------------------------------- INT 48 -> PCjr Cordless Keyboard Translation ----------------------------------------------------------- INT 49 -> PCjr Non-keyboard Scan Code Translation Table ----------------------------------------------------------- INT 4A -> AT User Alarm ----------------------------------------------------------- INT 4B -> reserved ----------------------------------------------------------- INT 4C -> reserved ----------------------------------------------------------- INT 4D -> reserved ----------------------------------------------------------- INT 4E -> reserved ----------------------------------------------------------- INT 4F -> reserved ----------------------------------------------------------- INT 50-57 -> IRQ0-IRQ7 relocated by DESQview ----------------------------------------------------------- INT 58 -> reserved ----------------------------------------------------------- INT 59 -> reserved ----------------------------------------------------------- INT 5A -> reserved ----------------------------------------------------------- INT 5B -> reserved ----------------------------------------------------------- INT 5C - NETBIOS interface ES:BX -> Network Control Block ----------------------------------------------------------- INT 5D -> reserved ----------------------------------------------------------- INT 5E -> reserved ----------------------------------------------------------- INT 5F -> reserved ----------------------------------------------------------- INT 60-67 -> reserved for user interrupts ----------------------------------------------------------- INT 67 - LIM EMS - Get Manager Status AH = 40h Return: AH = status 00h successful 80h internal error 81h hardware malfunction 84h undefined function requested by application Note: this call can be used only after establishing that the EMS driver is in fact present ----------------------------------------------------------- INT 67 - LIM EMS - Get Page Frame Segment AH = 41h Return: AH = 00h function successful BX = segment of page frame AH = error code (see AH=40h above) ----------------------------------------------------------- INT 67 - LIM EMS - Get Number of Pages AH = 42h Return: AH = 00h function successful BX = number of unallocated pages DX = total number of pages AH = error code (see AH=40h above) ----------------------------------------------------------- INT 67 - LIM EMS - Get Handle and Allocate Memory AH = 43h BX = number of logical pages to allocate Return: AH = status 00h function successful DX = handle 80h internal error 81h hardware malfunction 84h undefined function requested 85h no more handles available 87h more pages requested than physically exist 88h more pages requested than currently available 89h zero pages requested ----------------------------------------------------------- INT 67 - LIM EMS - Map Memory AH = 44h AL = physical page number (0-3) BX = logical page number DX = handle Return: AH = status 00h function successful 80h internal error 81h hardware malfunction 83h invalid handle 84h undefined function requested 8Ah invalid logical page number 8Bh illegal physical-page number ----------------------------------------------------------- INT 67 - LIM EMS - Release Handle and Memory AH = 45h DX = EMM handle Return: AH = status 00h successful 80h internal error 81h hardware malfunction 83h invalid handle 84h undefined function requested 86h error in save or restore of mapping context ----------------------------------------------------------- INT 67 - LIM EMS - Get EMM Version AH = 46h Return: AH = status 00h successful AL = EMM version number 80h internal error 81h hardware malfunction 84h undefined function requested ----------------------------------------------------------- INT 67 - LIM EMS - Save Mapping Context AH = 47h DX = handle Return: AH = status 00h successful 80h internal error 81h hardware malfunction 83h invalid handle 84h undefined function requested 8Ch page-mapping hardware state save area is full 8Dh save of mapping context failed ----------------------------------------------------------- INT 67 - LIM EMS - Restore Maping Context AH = 48h DX = handle Return: AH = status 00h successful 80h internal error 81h hardware malfunction 83h invalid handle 84h undefined function requested 8Eh restore of mapping context failed ----------------------------------------------------------- INT 67 - LIM EMS - reserved AH = 49h Note: defined in EMS 3.0, but undocumented in EMS 3.2 ----------------------------------------------------------- INT 67 - LIM EMS - reserved AH = 4Ah Note: defined in EMS 3.0, but undocumented in EMS 3.2 ----------------------------------------------------------- INT 67 - LIM EMS - Get Number of EMM Handles AH = 4Bh Return: AH = status 00h successful BX = number of EMM handles 80h internal error 81h hardware malfunction 83h invalid handle 84h undefined function requested ----------------------------------------------------------- INT 67 - LIM EMS - Get Pages Owned by Handle AH = 4Ch DX = EMM handle Return: AH = status 00h successful BX = number of logical pages 80h internal error 81h hardware malfunction 83h invalid handle 84h undefined function requested ----------------------------------------------------------- INT 67 - LIM EMS - Get Pages for All Handles AH = 4Dh ES:DI = pointer to array to receive information Return: AH = status 00h successful BX = number of active EMM handles array filled with 2-word entries, consisting of a handle and the number of pages allocated to that handle 80h internal error 81h hardware malfunction 84h undefined function requested ----------------------------------------------------------- INT 67 - LIM EMS - Get or Set Page Map AH = 4Eh AL = 00h if getting mapping registers 01h if setting mapping registers 02h if getting and setting mapping registers at once 03h if getting size of page-mapping array DS:SI = pointer to array holding information (AL=01/02) ES:DI = pointer to array to receive information (AL=00/02) Return: AH = status 00h successful AL = bytes in page-mapping array (subfunction 03h only) array pointed to by ES:DI receives mapping info (AL=00/02) 80h internal error 81h hardware malfunction 84h undefined function requested 8Fh undefined subfunction parameter A3h contents of source array corrupted (EMS 4.0?) Note: this function was designed to be used by multitasking operating systems and should not ordinarily be used by appplication software. ----------------------------------------------------------- INT 67 - LIM EMS 4.0 - Get/Set Partial Page Map AH = 4Fh AL = subfunction 00h get partial page map DS:SI = pointer to structure containing list of segments whose mapping contexts are to be saved ES:DI = pointer to array to receive page map 01h set partial page map DS:SI = pointer to structure containing saved partial page map 02h get size of partial page map BX = number of mappable segments in the partial map to be saved Return: AH = status 00h successful 80h internal error 81h hardware malfunction 84h undefined function requested 8Bh one of specified segments is not mappable 8Fh undefined subfunction parameter A3h contents of partial page map corrupted or count of mappable segments exceeds total number of mappable segments in system AL = size of partial page map for subfunction 02h ----------------------------------------------------------- INT 67 - LIM EMS 4.0 - Map/Unmap Multiple Handle Pages AH = 50h AL = subfunction 00h 01h DX = handle CX = number of entries in array DS:SI = pointer to mapping array Return: AH = status 00h successful 80h internal error 81h hardware malfunction 83h invalid handle 84h undefined function requested 8Ah one or more logical pages are invalid 8Bh one or more physical pages are invalid 8Fh invalid subfunction ----------------------------------------------------------- INT 67 - LIM EMS 4.0 - Reallocate Pages AH = 51h DX = handle BX = number of pages to be allocated to handle Return: BX = actual number of pages allocated to handle AH = status 00h successful 80h internal error 81h hardware malfunction 83h invalid handle 84h undefined function requested 87h more pages requested than present in system 88h more pages requested than currently available ----------------------------------------------------------- INT 67 - LIM EMS 4.0 - Get/Set Handle Attributes AH = 52h AL = subfunction 00h get handle attributes 01h set handle attributes BL = new attribute (see returned AL) 02h get attribute capability DX = handle Return: AL = attribute (for subfunction 00h) 00h handle is volatile 01h handle is nonvolatile AL = attribute capability (for subfunction 02h) 00h only volatile handles supported 01h both volatile and non-volatile supported AH = status 00h successful 80h internal error 81h hardware malfunction 83h invalid handle 84h undefined function requested 8Fh undefined subfunction 90h undefined attribute type 91h feature not supported ----------------------------------------------------------- INT 67 - LIM EMS 4.0 - Get/Set Handle Name *-*-*---------cut-----------cut----------------cut--------------*-*-* Append part 3 here. -- {harvard,uunet,ucbvax}!b.gp.cs.cmu.edu!ralf -=-=- AT&T: (412)268-3053 (school) ARPA: RALF@B.GP.CS.CMU.EDU |"Tolerance means excusing the mistakes others make. FIDO: Ralf Brown at 129/31 | Tact means not noticing them." --Arthur Schnitzler BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA -=-=- DISCLAIMER? I claimed something?