home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / DOS_HELP / DOS21H.ZIP / DOS.TXT
Encoding:
Text File  |  1987-04-06  |  6.1 KB  |  123 lines

  1.  
  2.               Undocumented DOS INT 21H Functions, Rev 1.0: 4/4/87
  3.  
  4. Compiled by     Pete Holzmann          ({pyramid}!octopus!pete)
  5.                 Octopus Enterprises    408/996-7746
  6.                 19611 La Mar Court
  7.                 Cupertino, CA 95014
  8.  
  9. Many of the details for this list were compiled (thank you!!!) by
  10.         Mike Morearty (...!ucbvax!cory!morearty), with a few more added
  11.         by Ed Nather (ut-sally!nather) and myself.
  12.  
  13. Some functions are still unknown. Portions of others (especially 52) are
  14. also unknown. Please send updates to me (octopus!pete). This information
  15. has been checked in general for DOS versions 2.0 through 3.2.
  16.  
  17. 18   Function unknown.  (Function numbers are in hex).
  18. 1D   Function unknown.
  19. 1E   Function unknown.
  20. 1F   Same as function call 32h (below), except that the table is
  21.      accessed from the default drive, and under DOS 1, the table
  22.      format is slightly different.  Returns AL=0 if no error,
  23.      DS:BX points to DOS Disk Block for default drive.
  24. 20   Function unknown.
  25. 32   Read DOS Disk Block.  DL contains drive (0=default, 1=A,
  26.      etc.).  On return, AL=00 if drive exists, FF otherwise;
  27.      DS:BX points to DOS Disk Block.  Format of block:
  28.           Bytes     Value
  29.           00        Drive: 0=A, 1=B, etc.
  30.           01        Unit within drive (0, 1, 2, etc.)
  31.           02-03     Bytes per sector
  32.           04        Sectors per cluster - 1
  33.           05        Cluster to sector shift (i.e., how far to
  34.                     shift-left the bytes/sector to get
  35.                     bytes/cluster)
  36.           06-07     Number of reserved (boot) sectors
  37.           08        Number of FATs
  38.           09-0A     Number of root directory entries
  39.           0B-0C     Sector # of 1st data. Should be same as # sectors/track.
  40.           0D-0E     # of clusters + 1 (=last cluster #)
  41.           0F        Sectors for FAT
  42.           10-11     Sector number of directory
  43.           12-15     (Dword) address of device header
  44.           16        Media Descriptor Byte
  45.           17        Zero if disk has been accessed
  46.           18-1B     (Dword) address of next DOS Disk
  47.                     Block (FFFF means last in chain)
  48. 34   Returns ES:BX pointing to Critical Section Flag, byte
  49.      indicating whether DOS calls are OK now (0 means safe).
  50.      Reportedly NOT completely reliable.  The byte at ES:BX+1 is
  51.      used by the Print program for this same purpose, so it's
  52.      probably safer to check the WORD at ES:BX.
  53. 37   Get/set option marking character (i.e. usually "/").  AL=0
  54.      to return character in DL, 1 to set from DL. In DOS 2, also can get/set
  55.      forced-/DEV flag (if set, /DEV/ must preceed device names; otherwise
  56.      it is optional): AL=2 to return flag in DL, AL=3 to set from DL (0 = set,
  57.      1 = not set).
  58. 50   Set new current Program Segment Prefix (PSP) from segment
  59.      number in BX.
  60. 51   Gets current PSP into BX.
  61.  
  62.  
  63. 52   Returns ES:BX pointing to the DOS list of lists, for disk
  64.      information.  Does not access the disk, so information in
  65.      tables might be incorrect if the disk has been switched.
  66.         Returns a pointer to the following array of longword pointers:
  67.         Bytes   Value
  68.         0-3     Pointer to first DOS disk block (see func 36H)
  69.         4-7     Partially Unknown. Pointer to a device driver. Maybe first
  70.                         resident driver?
  71.         8-B     Partially Unknown. Pointer to a device driver. Maybe first
  72.                         resident character device driver?
  73.         C-F     Pointer to actual CON: device driver, whether installable
  74.                         or resident
  75.         10-11   Unknown. 0200H. A byte/blocksize value???
  76.         12-15   Unknown. Pointer to current directory block????
  77.         16-19   Partially Undefined: Pointer to array of drive info:
  78.                         51H bytes per drive, starting with A: ...
  79.                         00-3F Current path as ASCIIZ, starting with 'x:\'
  80.                         40-43 Unknown. I see zeros always
  81.                         44    Unknown. Flags? I see 40H, except for
  82.                                 entry after last valid entry = 00H
  83.                         45-48 Pointer to DOS Disk Block for this drive
  84.                         49-4A Unknown. Current track or block? -1 if never
  85.                                 accessed.
  86.                         4B-4E Unknown. I see -1 always
  87.                         4F-52 Unknown. I see 2 always
  88.         1A-1D   Unknown. Pointer to data area, maybe including cluster
  89.                         allocation table?
  90.         1E-1F   Unknown. I see zero always
  91.         20      Unknown. May be number of block devices.
  92.         21      Unknown. May be number of resident devices or ??? (5 always)
  93.         22      Beginning (not a pointer. The real beginning!) of NUL device
  94.                     driver. This is the first device on DOS's linked list
  95.                     of device drivers.
  96. 53   Translates BPB (Bios Parameter Block, see below)
  97.      into a DOS Disk Block (see function call 32h).  Pass DS:SI
  98.      pointing to BPB, ES:BP pointing to area for DOS Disk Block.
  99. 55   Create PSP: similar to function 26h (which creates a new
  100.      Program Segment Prefix at segment in DX) except creates a
  101.      "child" PSP rather than copying the existing one.  Input:
  102.      DX=segment number at which to create new PSP.
  103. 5D   Function unknown.
  104. 60   Function unknown.
  105. 61   Function unknown.
  106.  
  107. Note: Function 53h converts a BPB to a DOS Disk Block. To go the other
  108.         way, use the following algorithm:
  109.  
  110.          BPB     
  111.         Bytes   Value
  112.         0-1     Bytes/sector. Get from DDB bytes 2-3.
  113.         2       Sectors/cluster. Get from: (DDB byte 4) + 1
  114.         3-4     Reserved sectors. Get from: DDB bytes 6-7
  115.         5       Number of FATs. Get from: DDB byte 8
  116.         6-7     Number of root dir entries. Get from: DDB bytes 9-A
  117.         8-9     Total # of sectors. Get from: 
  118.                  ((DDB bytes D-E) - 1) * (sectors per cluster (BPB byte 2))
  119.                    + (DDB Bytes B-C)
  120.         A       Media descriptor byte. Get from: DDB byte 16
  121.         B-C     Number of sectors/FAT. Get from: DDB byte F
  122.         
  123.