mov bl, Drive ;0 = default, 1 = A, 2 = B, etc.
mov ax, 440Eh ;Get Logical Drive Map
int 21h
jc error_handler ;carry set means error
Get Logical Drive Map (Function 440Eh) determines whether a physical drive has more than one logical drive number and returns the active drive number if it does.
Drive
Specifies the drive number to check (0 = default drive, 1 = A, 2 = B, etc.). The function checks the physical drive that corresponds to this logical drive number.
If the function is successful, the carry flag is clear and the AL register contains the active drive number for the corresponding physical drive. If the physical drive has only one drive number, the AL register contains 00h.
If the function is not successful, 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 |
0005h | ERROR_ACCESS_DENIED |
000Fh | ERROR_INVALID_DRIVE |
If a program attempts to access the drive by using an inactive drive number, MS-DOS prompts the user with the message “Insert diskette for drive x: and press any key when ready.”
Function 440Fh Set Logical Drive Map