Int 21H [1.0] Function 1BH (27) Get default drive data

Obtains selected information about the default disk drive and a pointer to the media identification byte from its file allocation table.

Call with:

AH = 1BH

Returns:

If function successful

AL = sectors per cluster

DS:BX = segment:offset of media ID byte

CX = size of physical sector (bytes)

DX = number of clusters for default drive

If function unsuccessful (invalid drive or critical error)

AL = FFH

Notes:

The media ID byte has the following meanings:

0F0H 3.5-inch double-sided, 18 sectors or "other"

0F8H fixed disk

0F9H 5.25-inch double-sided, 15 sectors or 3.5-inch double-sided, 9 sectors

0FCH 5.25-inch single-sided, 9 sectors

0FDH 5.25-inch double-sided, 9 sectors

0FEH 5.25-inch single-sided, 8 sectors

0FFH 5.25-inch double-sided, 8 sectors

To obtain information about disks other than the one in the default drive, use Int 21H Function 1CH or 36H.

[1] The address returned in DS:BX points to a copy of the first sector of the actual FAT, with the media ID byte in the first byte.

[2.0+] The address returned in DS:BX points only to a copy of the media ID byte from the disk's FAT; the memory above that address cannot be assumed to contain the FAT or any other useful information. If direct access to the FAT is required, use Int 25H to read it into memory.

Example:

Determine whether the current disk drive is fixed or removable.

.

.

.

mov ah,1bh ; function number

int 21h ; transfer to MS-DOS

; check media ID byte

cmp byte ptr [bx],0f8h

je fixed ; jump if fixed disk

jmp floppy ; else assume floppy

.

.

.