mov bx, Drive ;0 = default, 1 = A, 2 = B, etc.
mov ch, 08h ;device category (must be 08h)
mov cl, 42h ;Format Track on Logical Drive
mov dx, seg FormatBlock
mov ds, dx
mov dx, offset FormatBlock ;ds:dx points to FVBLOCK structure
mov ax, 440Dh ;IOCTL for Block Device
int 21h
jc error_handler ;carry set means error
Format Track on Logical Drive (Function 440Dh Minor Code 42h) formats and verifies a track on the specified device.
Drive
Specifies the drive on which the track is to be formatted and verified (0 = default drive, 1 = A, 2 = B, etc.).
FormatBlock
Points to an FVBLOCK structure that specifies the head and cylinder to format. The FVBLOCK structure has the following form:
FVBLOCK STRUC
fvSpecFunc db 0 ;special functions (must be zero)
fvHead dw ? ;head to format/verify
fvCylinder dw ? ;cylinder to format/verify
FVBLOCK ENDS
For a full description of the FVBLOCK 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 |
Format Track on Logical Drive returns 0002h (ERROR_FILE_NOT_FOUND) if the specified drive number is invalid.
Function 440Dh Minor Code 62h Verify Track on Logical Drive