Obtains selected information about a disk drive, from which the drive's capacity and remaining free space can be calculated.
Call with:
AH = 36H
DL = drive code (0 = default, 1 = A, etc.)
Returns:
If function successful
AX = sectors per cluster
BX = number of available clusters
CX = bytes per sector
DX = clusters per drive
If function unsuccessful (drive invalid)
AX = FFFFH
Notes:
This function regards "lost" clusters as being in use and does not report them as part of the number of available clusters, even though they are not assigned to a file.
Similar information is returned by Int 21H Functions 1BH and 1CH.
Example:
Calculate the capacity of disk drive C in bytes, leaving the result in the variable drvsize. (This code assumes that the product of sectors/cluster * bytes/sector will not overflow 16 bits.)
drvsize dd ? ; drive C size in bytes . . . mov ah,36h ; function number mov dl,3 ; drive C = 3 int 21h ; transfer to MS-DOS
mul cx ; sectors/cluster
; * bytes/sector
mul dx ; * total clusters
; result now in DX:AX
; store low word
mov word ptr drvsize,ax
; store high word
mov word ptr drvsize+2,dx
.
.
.