Article View: comp.sys.ibm.pc
Article #14653Re: number of DOS drives
From: Jim "Jack" Frost
Date: Fri, 05 Dec 1986 04:29
Date: Fri, 05 Dec 1986 04:29
58 lines
3334 bytes
3334 bytes
In article <1450@isis.UUCP> dragheb@isis.UUCP (Darius "OPRDRT" Ragheb) writes:
>In article <623@bucsb.bu.edu.UUCP> madd@bucsb.bu.edu.UUCP (Jim Frost) writes:
>>>
>>>In article <1441@isis.UUCP> dragheb@isis.UUCP (Darius "OPRDRT" Ragheb) writes:
>>>>
>>>>I think this might work (I have not tried it):
>>>>use function (_FUNCTION_, not interrupt) call Eh. It will do two things:
>>>>make the drive selected in DL the current drive, and
>>>>return the number of drives in AL.
>>>>
>>>If you had tried it, you would have found out it *doesn't* work :-) :-)
>
>I think we have it licked now! I wrote the following program and tested
>it on a PC with 1 drive and a PC with 2 drives and it returned
>the correct number of floppies:
[ C program deleted ]
>
>What it does is call INT 11h and check bits 6 and 7 in the ax
>register. (0 means 1 drive, etc).
>
>(BTW REGS is a struct of ints)
>
That's great, but I assumed that they may have at least one hard
drive. Also, it's at least theoretically possible to have more than 4
floppies (why would you do that? no idea, but...) so you really can't
trust the configuration bits, which are limited to 4. Because DOS
allows you to install odd devices (RAM drives, etc) which you might
like to use, you'd probably want to see if there is one available.
I really wish I had my DOS manual, but here is the general idea of how
I would do it (expanded slightly from last time):
* Call DOS to find out how many drives it CAN have (ie LASTDRIVE
setting).
* Start at LASTDRIVE and request the volume label for all drives down to
C:.
* If you don't find a drive higher than C:, you could test the
configuration bits. This would take care of the nasty "Drive not
ready error. Abort, Retry, Ignore?" when you don't have a floppy
installed.
Come to think of it, you might want to check the bits first to see if
you have an installed floppy that is higher than B:. This isn't
common, but it's possible. As for systems with 4+ floppies, well,
tough luck. Get a hard drive :-).
This is really easy to write if you have the DOS Tech Ref manual
handy, which I don't. I think that is about as accurate as you could
get without explicitly asking "how many drives/psuedo drives do you
have?"
--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- Jim Frost * The Madd Hacker -
UUCP: ..!harvard!bu-cs!bucsb!madd | ARPANET: madd@bucsb.bu.edu
CSNET: madd%bucsb@bu-cs | BITNET: cscc71c@bostonu
-------------------------------+---+------------------------------------
"Oh beer, oh beer." -- Me | [=(BEER) <- Bud the Beer (cheers!)
Technical Details
Message-ID:
<630@bucsb.bu.edu.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!husc6!bu-cs!bucsb.bu.edu!maddReferences:
<2268@sdcsvax.UCSD.EDU> <623@bucsb.bu.edu.UUCP> <1450@isis.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!husc6!bu-cs!bucsb.bu.edu!madd From: madd@bucsb.bu.edu.UUCP (Jim "Jack" Frost) Newsgroups: comp.sys.ibm.pc Subject: Re: number of DOS drives Message-ID: <630@bucsb.bu.edu.UUCP> Date: Thu, 4-Dec-86 23:29:32 EST Article-I.D.: bucsb.630 Posted: Thu Dec 4 23:29:32 1986 Date-Received: Fri, 5-Dec-86 06:23:16 EST References: <2268@sdcsvax.UCSD.EDU> <623@bucsb.bu.edu.UUCP> <1450@isis.UUCP> Reply-To: madd@bucsb.bu.edu.UUCP (Jim "Jack" Frost) Organization: ODO (Organization for the Disorganization of Organization) Lines: 57 Mood: Relatively happy