Function 1Fh Get Default DPB

mov ah, 1Fh ;Get Default DPB

int 21h

cmp al, 0FFh ;0FFh means error

jz error_handler

mov word ptr [defaultDPB], bx

mov word ptr [defaultDPB+2], ds ;ds:bx points to default DPB

Get Default DPB (Function 1Fh) retrieves drive parameters for the default drive.

Parameters

This function has no parameters.

Return Value

If the function is successful, the AL register contains zero and the DS:BX registers point to a DPB structure that contains the drive parameters. The DS register contains the segment address, and the BX register contains the offset. Otherwise, if the default drive was invalid or a disk error occurred, the AL register contains 0FFh.

Comments

If Get Default DPB is successful, the DS:BX registers point to a DPB structure, which has the following form:

DPB STRUC

dpbDrive db ? ;drive number (0 = A, 1 = B, etc.)

dpbUnit db ? ;unit number for driver

dpbSectorSize dw ? ;sector size, in bytes

dpbClusterMask db ? ;sectors per cluster - 1

dpbClusterShift db ? ;sectors per cluster, as power of 2

dpbFirstFAT dw ? ;first sector containing FAT

dpbFATCount db ? ;number of FATs

dpbRootEntries dw ? ;number of root-directory entries

dpbFirstSector dw ? ;first sector of first cluster

dpbMaxCluster dw ? ;number of clusters on drive + 1

dpbFATSize dw ? ;number of sectors occupied by FAT

dpbDirSector dw ? ;first sector containing directory

dpbDriverAddr dd ? ;address of device driver

dpbMedia db ? ;media descriptor

dpbFirstAccess db ? ;indicates access to drive

dpbNextDPB dd ? ;address of next drive parameter block

dpbNextFree dw ? ;last allocated cluster

dpbFreeCnt dw ? ;number of free clusters

DPB ENDS

For more information about the DPB structure, see Chapter 3, “File System.”

See Also

Function 32h Get DPB