home *** CD-ROM | disk | FTP | other *** search
- ; Function to find the existance of a drive.
- ; int drivePresent(int drive)
- ; drive : 0 = A, 1 = B, 2 = C etc...
- ; Returns:
- ; 0 - drive not present
- ; 40h (64) - logical/physical drive
- ; 50h (80) - SUBST drive
- ; For Turbo C 2.0, small/tiny model.
- ; Written and tested with Turbo Assembler 1.0
- ; By Goh King Hwa, 20 Dec 1989.
-
- LASTDRIVE EQU 33
- DPATH EQU 22
- PATHSIZE EQU 81
- DFLAG EQU 68
-
- _TEXT segment byte public 'CODE'
- assume cs:_TEXT
-
- _drivePresent proc near
- push bp
- mov bp,sp
- mov ah,52h ;DOS get list of lists
- int 21h
- xor ax,ax ;zero AX
- mov cx,[bp+4] ;get the drive specified
- cmp cl,es:[bx+LASTDRIVE] ;check to see if it's too big
- jb Check
- NoDrive:
- jmp short exitFunc ;exit, if so
- Check:
- push ds
- push si
-
- lds si,es:[bx+DPATH] ;get the address for path table
- jcxz done ;if CX zero, drive found
- findDrive:
- add si,PATHSIZE ;next entry
- jnc doLoop ;did we overshoot one segment?
- mov dx,ds
- add dx,1000h ;adjust to next segment
- mov ds,dx
- doLoop:
- loop findDrive
- done:
- mov al,[si+DFLAG] ;get the current drive flag
- pop si
- pop ds
- exitFunc:
- pop bp
- ret
- _drivePresent endp
- _TEXT ends
-
- public _drivePresent
- end
-