Function 1Bh Get Default Drive Data

mov ah, 1Bh ;Get Default Drive Data

int 21h

cmp al, 0FFh ;0FFh means error

je error_handler

mov SecPerCluster, al ;sectors per cluster

mov BytesPerSector, cx ;bytes per sector

mov NumClusters, dx ;number of clusters

mov al, byte ptr [bx] ;ds:bx points to media descriptor

mov MediaDesc, al

Get Default Drive Data (1Bh) retrieves information about the disk in the default drive.

This function has been superseded by Get Disk Free Space (Function 36h).

Parameters

This function has no parameters.

Return Values

If the function is successful, the AL, CX, DX, and DS:BX registers contain the following information:

Register Contents

AL Number of sectors in a cluster.
CX Number of bytes in a sector.
DX Number of clusters on the disk.
DS:BX Points to the media descriptor.

Otherwise, the AL register contains 0FFh.

Comments

If Get Default Drive Data fails, the default drive was invalid or a disk error occurred. A program must check the return values from this function to determine whether it has valid disk information.

Following are the most commonly used media descriptors and their corresponding media:

Value Type of medium

0F0h 3.5-inch, 2 sides, 18 sectors/track (1.44 MB); 3.5-inch, 2 sides, 36 sectors/track (2.88 MB); 5.25-inch, 2 sides, 15 sectors/track (1.2 MB). This value is also used to describe other media types.
0F8h Hard disk, any capacity.
0F9h 3.5-inch, 2 sides, 9 sectors/track, 80 tracks/side (720K); 5.25-inch, 2 sides, 15 sectors/track, 40 tracks/side (1.2 MB).
0FAh 5.25-inch, 1 side, 8 sectors/track, (320K).
0FBh 3.5-inch, 2 sides, 8 sectors/track (640K).
0FCh 5.25-inch, 1 side, 9 sectors/track, 40 tracks/side (180K).
0FDh 5.25-inch, 2 sides, 9 sectors/track, 40 tracks/side (360K). This value is also used for 8-inch disks.
0FEh 5.25-inch, 1 side, 8 sectors/track, 40 tracks/side (160K). This value is also used for 8-inch disks.
0FFh 5.25-inch, 2 sides, 8 sectors/track, 40 tracks/side (320K).

Get Default Drive Data modifies the DS register. A program should save the contents of the register before calling this function and restore the contents of the register after retrieving the media descriptor.

See Also

Function 1Ch Get Drive Data
Function 36h Get Disk Free Space