# Of Disk Drives

 BBS: Inland Empire Archive
Date: 04-13-92 (12:10)             Number: 123
From: MATT HART                    Refer#: NONE
  To: RICH GELDREICH                Recvd: NO  
Subj: # Of Disk Drives               Conf: (2) Quik_Bas
 RG> Does anyone know the particular does function(s) on how to get the
 RG> number of drives on a DOS system? For instance, If I bring QB to the

You can do multiple call's to this routine to see available drives:

     Drives$ = ""
     FOR i = 1 TO 26
          IF DiskSize&(i) > 0& THEN
               Drives$ = Drives$ + CHR$(i+64)
          ENDIF
     NEXT

     PRINT "Available drives : ";Drives$


' DISKSIZE.BAS  Matt Hart
'
' Uses Int 21h Function 1Ch to get the disk size
' DriveNum% is 0 for current drive, or
' A: = 1 to Z: = 26

    '$INCLUDE: 'qb.bi'
    DEFINT A-Z
    DECLARE FUNCTION DiskSize&(DriveNum)


    DIM SHARED InRegs AS RegTypeX
    DIM SHARED OutRegs AS RegTypeX

    PRINT DiskSize&(0)

    END

FUNCTION DiskSize&(DriveNum)
    InRegs.AX = &H1C00
    InRegs.DX = DriveNum

    CALL InterruptX(&H21, InRegs, OutRegs)

    SecPerClu& = OutRegs.AX MOD 256
    BytPerSec& = OutRegs.CX
    CluPerDis& = OutRegs.DX

    DiskSize& = (SecPerClu& * BytPerSec& * CluPerDis&)
END FUNCTION

---
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET