pete@octopus.UUCP (04/05/87)
Thanks to information supplied by various people, and some sleuthing on my
part, I present for your interest some documentation for the undocumented
MS-DOS Int 21H functions. There are gaps in what we know- any corrections
or additions would be greatly appreciated!
Thanks again for all the help - there's more interest in this than I expected!
----------- cut here -------------
Undocumented DOS INT 21H Functions, Rev 1.0: 4/4/87
Compiled by Pete Holzmann ({pyramid}!octopus!pete)
Octopus Enterprises 408/996-7746
19611 La Mar Court
Cupertino, CA 95014
Many of the details for this list were compiled (thank you!!!) by
Mike Morearty (...!ucbvax!cory!morearty), with a few more added
by Ed Nather (ut-sally!nather) and myself.
Some functions are still unknown. Portions of others (especially 52) are
also unknown. Please send updates to me (octopus!pete). This information
has been checked in general for DOS versions 2.0 through 3.2.
18 Function unknown. (Function numbers are in hex).
1D Function unknown.
1E Function unknown.
1F Same as function call 32h (below), except that the table is
accessed from the default drive, and under DOS 1, the table
format is slightly different. Returns AL=0 if no error,
DS:BX points to DOS Disk Block for default drive.
20 Function unknown.
32 Read DOS Disk Block. DL contains drive (0=default, 1=A,
etc.). On return, AL=00 if drive exists, FF otherwise;
DS:BX points to DOS Disk Block. Format of block:
Bytes Value
00 Drive: 0=A, 1=B, etc.
01 Unit within drive (0, 1, 2, etc.)
02-03 Bytes per sector
04 Sectors per cluster - 1
05 Cluster to sector shift (i.e., how far to
shift-left the bytes/sector to get
bytes/cluster)
06-07 Number of reserved (boot) sectors
08 Number of FATs
09-0A Number of root directory entries
0B-0C Sector # of 1st data. Should be same as # sectors/track.
0D-0E # of clusters + 1 (=last cluster #)
0F Sectors for FAT
10-11 Sector number of directory
12-15 (Dword) address of device header
16 Media Descriptor Byte
17 Zero if disk has been accessed
18-1B (Dword) address of next DOS Disk
Block (FFFF means last in chain)
34 Returns ES:BX pointing to Critical Section Flag, byte
indicating whether DOS calls are OK now (0 means safe).
Reportedly NOT completely reliable. The byte at ES:BX+1 is
used by the Print program for this same purpose, so it's
probably safer to check the WORD at ES:BX.
37 Get/set option marking character (i.e. usually "/"). AL=0
to return character in DL, 1 to set from DL. In DOS 2, also can get/set
forced-/DEV flag (if set, /DEV/ must preceed device names; otherwise
it is optional): AL=2 to return flag in DL, AL=3 to set from DL (0 = set,
1 = not set).
50 Set new current Program Segment Prefix (PSP) from segment
number in BX.
51 Gets current PSP into BX.
52 Returns ES:BX pointing to the DOS list of lists, for disk
information. Does not access the disk, so information in
tables might be incorrect if the disk has been switched.
Returns a pointer to the following array of longword pointers:
Bytes Value
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 Partially Unknown. Pointer to a device driver. Maybe first
resident character device driver?
C-F Pointer to actual CON: device driver, whether installable
or resident
10-11 Unknown. 0200H. A byte/blocksize value???
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 Unknown. May be number of block devices.
21 Unknown. May be number of resident devices or ??? (5 always)
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.
53 Translates BPB (Bios Parameter Block, see below)
into a DOS Disk Block (see function call 32h). Pass DS:SI
pointing to BPB, ES:BP pointing to area for DOS Disk Block.
55 Create PSP: similar to function 26h (which creates a new
Program Segment Prefix at segment in DX) except creates a
"child" PSP rather than copying the existing one. Input:
DX=segment number at which to create new PSP.
5D Function unknown.
60 Function unknown.
61 Function unknown.
Note: Function 53h converts a BPB to a DOS Disk Block. To go the other
way, use the following algorithm:
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
---- End Of List ----
--
OOO __| ___ Peter Holzmann, Octopus Enterprises
OOOOOOO___/ _______ USPS: 19611 La Mar Court, Cupertino, CA 95014
OOOOO \___/ UUCP: {hplabs!hpdsd,pyramid}!octopus!pete
___| \_____ Phone: 408/996-7746