mov bl, Drive ;0 = default, 1 = A, 2 = B, etc.
mov ax, 440Fh ;Set Logical Drive Map
int 21h
jc error_handler ;carry set means error
Set Logical Drive Map (Function 440Fh) sets the active drive number for a physical drive that has more than one logical drive number.
Drive
Specifies the drive number to set (0 = default drive, 1 = A, 2 = B, etc.).
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 | Meaning |
0001h | ERROR_INVALID_FUNCTION |
0005h | ERROR_ACCESS_DENIED |
000Fh | ERROR_INVALID_DRIVE |
Programs that set the active drive prevent MS-DOS from prompting the user with the message “Insert diskette for drive x: and press any key when ready.”
Function 440Eh Get Logical Drive Map