mov bx, Drive ;0 = default, 1 = A, 2 = B, etc.
mov ch, 08h ;device category (must be 08h)
mov cl, 40h ;Set Device Parameters
mov dx, seg DriveDP
mov ds, dx
mov dx, offset DriveDP ;ds:dx points to DEVICEPARAMS structure
mov ax, 440Dh ;IOCTL for Block Device
int 21h
jc error_handler ;carry set means error
Set Device Parameters (Function 440Dh Minor Code 40h) sets the device parameters for the specified block device.
Drive
Specifies the drive that parameters are being set for (0 = default drive, 1 = A, 2 = B, etc.).
DriveDP
Points to a DEVICEPARAMS structure that contains the parameters for the specified block device. The DEVICEPARAMS structure has the following form:
DEVICEPARAMS STRUC
dpSpecFunc db ? ;special functions
dpDevType db ? ;device type
dpDevAttr dw ? ;device attributes
dpCylinders dw ? ;number of cylinders
dpMediaType db ? ;media type
;Start of BIOS parameter block (BPB)
dpBytesPerSec dw ? ;bytes per sector
dpSecPerClust db ? ;sectors per cluster
dpResSectors dw ? ;number of reserved sectors
dpFATs db ? ;number of file allocation tables
dpRootDirEnts dw ? ;number of root-directory entries
dpSectors dw ? ;total number of sectors
dpMedia db ? ;media descriptor
dpFATsecs dw ? ;number of sectors per FAT
dpSecPerTrack dw ? ;sectors per track
dpHeads dw ? ;number of heads
dpHiddenSecs dd ? ;number of hidden sectors
dpHugeSectors dd ? ;number of sectors if dpSectors = 0
;End of BIOS parameter block (BPB)
DEVICEPARAMS ENDS
For a full description of the DEVICEPARAMS structure, see Chapter 3, “File System.”
If the function is successful, the carry flag is clear. Otherwise, the carry flag is set and the AX register contains an error value, which may be one of the following:
Value | Name |
0001h | ERROR_INVALID_FUNCTION |
0002h | ERROR_FILE_NOT_FOUND |
0005h | ERROR_ACCESS_DENIED |
Set Device Parameters returns 0002h (ERROR_FILE_NOT_FOUND) if the specified drive number is invalid.
Function 440Dh Minor Code 60h Get Device Parameters