'=========================================================================== ' Subject: DRIVE LIST FUNCTION Date: 05-21-98 (05:11) ' Author: Andrew S. Gibson Code: QB, PDS ' Origin: zapf_dingbat@juno.com Packet: DISK.ABC '=========================================================================== DEFINT A-Z 'Yet another drive listing function... 'OK. You'll like this because it doesn't wreck your screen as other routines 'might, no screen/BIOS interruption, um this took 15 minutes because 'because I had to refresh my memory, debug and comment this for all of you & 'others. I used two dos functions. Please read the comments, I fluffed this 'file so you could read it better, you can condense it... :> Users will have 'to parse the string if desired. Note: if your computer has one floppy 'drive it will be detected as two, hey it's Dos :> 'Quickly and accurately coded by Zapf_DingBat@JUNO.COM 'no warranties are implied or guaranteed ! (except that I know it 'to function as desired.) DECLARE FUNCTION DriveList$ () TYPE RegType AX AS INTEGER BX AS INTEGER CX AS INTEGER DX AS INTEGER BP AS INTEGER SI AS INTEGER DI AS INTEGER FLAGS AS INTEGER DS AS INTEGER ES AS INTEGER END TYPE DIM SHARED Registers AS RegType 'The proof CLS PRINT DriveList$ END FUNCTION DriveList$ DL$ = "" 'fresh string OldAX = 0 'inint this, we need it ' get the current disk because we'll have to change drives to ' verify them.. Registers.AX = &H1900 ' function 19h (25) Get Current Disk CALL InterruptX(&H21, Registers, Registers) ' dos function umbrella CurrentDisk = Registers.AX MOD 256 FOR DRVget = 0 TO 25 'loop to verify drives Registers.AX = &HE00 ' function 0Eh (14) Select Disk, remember BASIC parses out leading zeroes - it's ok :> Registers.DX = DRVget ' 0=A, 1=B, 2=C, etc. CALL InterruptX(&H21, Registers, Registers) ' dos function umbrella 'Stuff returned in the Registers if successful: 'AL = number of logical drives in system 'this isn't what we want since this call can or will return 5 or the LASTDRIVE= 'entry in config.sys which ever is greater... Registers.AX = &H1900 ' function 19h (25) Get Current Disk CALL InterruptX(&H21, Registers, Registers) ' dos function umbrella 'Stuff returned in the Registers if successful: 'AL = drive code 0=A, 1=B, 2=C, etc. IF OldAX = Registers.AX THEN EXIT FOR 'test to avoid adding the last detected 'drive 21 or less times DL$ = DL$ + CHR$((Registers.AX MOD 256) + 65) 'put into drive list string :> OldAX = Registers.AX 'retain the old number for testing purposes NEXT DRVget ' do another ' return to the drive in use at the start of this function. Registers.AX = &HE00 ' function 0Eh (14) Select Disk, remember BASIC parses out leading zeroes - it's ok :> Registers.DX = CurrentDisk ' saved drive number of the origin drive. CALL InterruptX(&H21, Registers, Registers) ' dos function umbrella Registers.AX = 0 'no need to retain the output... DriveList$ = DL$ 'pass list back to main caller END FUNCTION