Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!comp.vuw.ac.nz!virtue!canterbury.ac.nz!phys169 From: phys169@canterbury.ac.nz Newsgroups: comp.os.msdos.programmer Subject: Re: Checking for disk characteristics Message-ID: <1990Sep20.105840.9191@canterbury.ac.nz> Date: 20 Sep 90 01:15:15 GMT References: <6302@emory.mathcs.emory.edu> <90257.135612PA163514@tecmtyvm.mty.itesm.mx> Organization: University of Canterbury Lines: 32 In article <90257.135612PA163514@tecmtyvm.mty.itesm.mx>, PA163514@tecmtyvm.mty.itesm.mx writes: > Arasmith, > > TOPIC: How many disk drives are in your PC? > > These are the steps: : > 4. Get value in Port 60h ..etc... That isn't always going to solve the original problem, of finding the number of hard drives without waiting for a floppy, but it does find the number of diskettes from the dip switches on a PC okay, although int 11h would be much better, as far as compatibility is concerned, or even peeking at location 410h, i.e. NumberOfDiskettes:=(memw[$40:$10] and 1)*(1+(mem[$40:$10]and 3) shr 6). The number of *physical* hard drives can be found in most PC/XT/AT compatibles at byte 475h (mem[$40:$75] in Turbo Pascal), but that doesn't allow for logical drives, nor does using int 13h with AH=15h, DL=80h+each drive number to test. The "proper" method is to ask DOS via int 21h, AX=4408, and BL varying from 1 to the highest likely drive number (say 26); the result is: carry flag on means an invalid drive, otherwise AX=1 means a fixed disk - which might be a network drive, so you could test if bit 12 of DX is 0 (DOS call 4409h), if that is a possibility you need to check. Unfortunately, this requires DOS 3 or above. If you must use DOS 2, use the number at location 475h, rememberring the first hard drive letter will be "C" in DOS if you are on a PC, or higher on a PC/XT if the number of diskettes is >2, or lower if running on a DG10 with only one diskette drive (but who uses them nowadays??). Hope this helps, Mark Aitchison, Physics, University of Canterbury, New Zealand.