Detect the available drives on DOS (Developers)
You set the default disk (function 0Eh) and then check if the default is the one you set (function 19h).
function DriveValid(Drive:Char):Boolean;
assembler;asm
MOV CL,Drive
MOV AH,$19
INT $21
MOV BL,AL
MOV DL,CL
SUB DL,'A'
MOV AH,$0E
INT $21
MOV AH,$19
INT $21
XOR CL,CL
CMP AL,DL
JNE @@1
MOV CL,1
MOV DL,BL
MOV AH,$0E
INT $21
@@1: XCHG EAX,ECX
end;
--------D-2119-------------------------------
INT 21 - DOS 1+ - GET CURRENT DEFAULT DRIVE
AH = 19h
Return: AL = drive (00h = A:, 01h = B:, etc)
Note: Novell NetWare uses the fact that DOS 2.x COMMAND.COM issues this call
from a particular location every time it starts a command to
determine when to issue an automatic EOJ
--------D-210E-------------------------------
INT 21 - DOS 1+ - SELECT DEFAULT DRIVE
AH = 0Eh
DL = new default drive (00h = A:, 01h = B:, etc)
Return: AL = number of potentially valid drive letters
Notes: under Novell NetWare, the return value is always 32, the number of
drives that NetWare supports
under DOS 3.0+, the return value is the greatest of 5, the value of
LASTDRIVE= in CONFIG.SYS, and the number of drives actually present
on a DOS 1.x/2.x single-floppy system, AL returns 2 since the floppy
may be accessed as either A: or B:
otherwise, the return value is the highest drive actually present
DOS 1.x supports a maximum of 16 drives, 2.x a maximum of 63 drives,
and 3+ a maximum of 26 drives
under Novell DOS 7, this function returns the correct LASTDRIVE value
even when the undocumented LASTDRIVE=27..32 directive was used in
CONFIG.SYS
"parse FCB" (see AH=29h) can be used to determine whether a drive
letter is valid
Complete thread:
- Detect the available drives on DOS - SuperIlu, 07.07.2023, 21:14
- Detect the available drives on DOS - CandyMan, 07.07.2023, 21:41
- Detect the available drives on DOS - SuperIlu, 07.07.2023, 23:04
- Detect the available drives on DOS - Laaca, 08.07.2023, 10:36
- Detect the available drives on DOS - SuperIlu, 09.07.2023, 00:11
- Detect the available drives on DOS - Laaca, 08.07.2023, 10:36
- Detect the available drives on DOS - SuperIlu, 07.07.2023, 23:04
- Detect the available drives on DOS - ecm, 07.07.2023, 22:02
- Detect the available drives on DOS - Rugxulo, 08.07.2023, 07:56
- Detect the available drives on DOS - marcov, 09.07.2023, 23:18
- Detect the available drives on DOS - SuperIlu, 10.07.2023, 18:15
- Detect the available drives on DOS - CandyMan, 07.07.2023, 21:41