home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
pcmagazi
/
1989
/
06
/
diskinfo.bas
< prev
next >
Wrap
BASIC Source File
|
1989-02-16
|
2KB
|
44 lines
10 '----- DiskInfo.Bas
20 DEFINT A-Z : CLS 'SYSINT requires integers
30 DIM REG.IN(7), REG.OUT(7) 'dim register arrays
40 AX=0:BX=1:CX=2:DX=3:SI=4:DI=5:DS=6:ES=7 'define register elements
50 SYSINT$ = SPACE$(116) 'load SYSINT into a string
60 FOR X=1 TO 116
70 READ A$ : MID$(SYSINT$, X, 1) = CHR$(VAL("&H" + A$))
80 NEXT
90 '
100 INPUT "Which drive - <Enter> for default"; D$
110 IF D$ = "" THEN DRIVE = 0 : GOTO 140 '0 = default drive
120 IF D$ < "A" OR D$ > "Z" THEN 100
130 DRIVE = ASC(D$) - 64 '1 = A, 2 = B, etc.
140 REG.IN(AX) = 256 * &H36 'Function 36h goes in AH
150 REG.IN(DX) = DRIVE 'drive number goes in DL
160 INT.NO = &H21 'Int 21h for DOS
170 '
180 DEF SEG : X = VARPTR(SYSINT$) 'get SYSINT address
190 SYSINT! = PEEK(X+1) + 256 * PEEK(X+2)
200 CALL SYSINT!(INT.NO, REG.IN(0), REG.OUT(0))
210 IF REG.OUT(AX) = -1 THEN PRINT "Invalid drive" : GOTO 100 'AX = FFFFh
220 SPC = REG.OUT(AX) : FRC = REG.OUT(BX) 'sectors/clusters, free clusters
230 BPS = REG.OUT(CX) : CPD = REG.OUT(DX) 'bytes/sector, clusters/disk
240 '
250 PRINT : PRINT "Logical Disk Setup"
260 PRINT "------------------------------"
270 PRINT "Bytes per sector :" BPS
280 PRINT "Sectors per cluster :" SPC
290 PRINT "Clusters per disk :" CPD
300 PRINT "------------------------------"
310 PRINT "Total disk space : ";: PRINT USING "#########,"; BPS * SPC * CPD
320 PRINT "Disk free space : ";: PRINT USING "#########,"; BPS * SPC * FRC
330 '
1000 DATA 55, 8B, EC, 8B, 5E, 0A, 8B, 07, 8B, 5E, 06, 8B, CB
1010 DATA 8B, 5E, 08, 06, 1E, E8, 05, 00, 00, 00, CD, 00, C3
1020 DATA 5D, 88, 46, 03, 89, 4E, 00, 8B, 4F, 04, 8B, 57, 06
1030 DATA 8B, 77, 08, 8B, 7F, 0A, 8B, 47, 0E, 3D, FF, FF, 74
1040 DATA 02, 8E, C0, 8B, 47, 0C, 3D, FF, FF, 74, 02, 8E, D8
1050 DATA 36, 8B, 07, 36, 8B, 5F, 02, E8, CC, FF, 53, 8B, 5E
1060 DATA 00, 36, 89, 07, 36, 8F, 47, 02, 8C, D8, 36, 89, 47
1070 DATA 0C, 1F, 8C, C0, 89, 47, 0E, 07, 89, 4F, 04, 89, 57
1080 DATA 06, 89, 77, 08, 89, 7F, 0A, 5D, CA, 06, 00, 00