DPB: Drive Parameter Block

 The DPB information is obtained via DOS Fns 32H and 1fH.  It describes a
 drive and the medium in the drive.

 Virtually all this information can be obtained by reading the boot sector
 and invoking a series of other DOS function calls and performing
 calculations (see FAT), but the DPB has all the data in one place.

DPBRec
  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
   +0      1  bDrvNo       drive number (0=A, 1=B, etc.)
   +1      1  bUnitNo      sub-unit number
   +2      2  wSectSize    bytes per sector
   +4      1  bClustMask   sectors per cluster-1 (max sector in cluster)
   +5      1  bClustShift  cluster-to-sector shift (cluster is 2ⁿ sectors)
   +6      2  wFirstFAT    sector number of first start of first FAT
   +8      1  bFatCnt      number of FATs
   +9      2  wRootEntries number of entries allowed in root directory
  +0bH     2  wFirstData   sector number of cluster #2 (first data cluster)
  +0dH     2  wHiClust     total clusters+1 (number of highest cluster)
  +0fH     1  bFatSects    sectors needed by a FAT
  +10H     2  wRootSec     sector # of start of root directory
  +12H     4  pfrDevHdr    address of DevHdrRec for this device driver
  +16H     1  bMedia       media descriptor byte
  +17H     1  bFirstAccess ffH=medium in drive has not been accessed
  +18H     4  pfrNextDPB   Address of next DPBRec (0ffffH if last)
  +1CH     2  wNextFree    last allocated cluster
  +1EH     2  wFreeCnt     number of free clusters
          32               size of a DPBRec

 Many of these fields are exactly as in BootSectorRec and BPBRec (which
 see).  Notable fields are:

     bUnitNo  identifies the drive sub-unit, for device drivers which
              support multiple drive types.

   wFirstFAT  is the sector number of the first copy of the FAT for this
              drive.  It is also the number of "reserved" sectors on the
              disk, since the first FAT always follows the last reserved
              sector.

  wFirstData  saves some calculations when converting a cluster number (from
              the FAT or a DirEntryRec) into a cluster number.  Data for a
              FAT entry of (0)002H starts at this sector number.  In
              general, the data for cluster number n starts at sector number
              wFirstData + ((n-2)*(bClustMask+1)).

bFirstAccess  00H means this DPB has been accessed.
              ffH means this DPB has NOT been accessed and must be rebuilt.

  pfrNextDPB  is the FAR address of the next DPBRec in the chain; this
              address is FFFF:FFFF in the last DPBRec.  The address of the
              first DBPRec can be found via 52H (get ListOfLists).

   wNextFree  is used by DOS in allocating clusters.  DOS will attempt to
              allocate at this cluster (and then bump wNextFree up) in the
              hopes of making contiguous allocations.  This field was not
              documented before 5.0.

    wFreeCnt  MAY contain the current number of unallocated clusters.  But
              DOS is NOT required to maintain a correct calculation here.
              Use fn 36H to learn how much space is available (that fn
              triggers ram-resident Undelete Delete Sentry to purge old
              files).  If this field is ffffH, it has not been calculated
              yet.  This field was not documented before 5.0.

   Notes: The undocumented DOS fn 53H converts a BPB (as supplied by a
          device driver) into a DPB.

See Also: DOS fn 53H (translate BPB to DPB)
          Disk Drive Functions
          Device Drivers
          BPB: BIOS Parameter Block
          Boot Sector Layout
          File Allocation Table
                                    -♦-