Int 21H [1.0] Function 0EH (14) Select disk

Selects the specified drive to be the current, or default, disk drive and returns the total number of logical drives in the system.

Call with:

AH = 0EH

DL = drive code (0 = A, 1 = B, etc.)

Returns:

AL = number of logical drives in system

Notes:

[1] 16 drive designators (0 through 0FH) are available.

[2] 63 drive designators (0 through 3FH) are available.

[3.0+] 26 drive designators (0 through 19H) are available.

To preserve upward compatibility, new applications should limit themselves to the drive letters A—Z (0 = A, 1 = B, etc.).

Logical drives means the total number of block devices: floppy disks, simulated disk drives (RAMdisks), and hard-disk drives. A single physical hard-disk drive is frequently partitioned into two or more logical drives.

[1] [2] In single-drive IBM PC—compatible systems, the value 2 is returned in AL, because PC-DOS supports two logical drives (A: and B:) on the single physical floppy-disk drive. The actual number of physical drives in the system can be determined with ROM BIOS Int 11H.

[3.0+] The value returned in AL is either 5 or the drive code corresponding to the LASTDRIVE entry (if any) in CONFIG.SYS, whichever is greater.

Example:

Make drive B the current (default) disk drive. Save the total number of logical drives in the system in the variable drives.

drives db 0

.

.

.

mov ah,0eh ; function number

mov dl,1 ; drive 1 = B

int 21h ; transfer to MS-DOS

mov drives,al ; save total drives

.

.

.