home *** CD-ROM | disk | FTP | other *** search
-
- rem disk.bas all system info on specified disk drive
- integer i,directory.entries
- real total.space,available.space
- string disk.free.space,percent.used
-
- %include cbc
-
- i= match(";",command$,1)
- if i>0 then operation$=ucase$(right$(command$,len(command$)-i))
- if i<1 then print.options%=-1
-
- disk$=ucase$(left$(command$,1))
- if disk$<"A" or disk$>"P" then disk$=seldsk("")
- disk%=asc(disk$)-65
-
- rem main code
- if match("L",operation$,1) then lprinter
-
- print "DISK v1.1 "
- print tab(10);
- print using "Drive &: Characteristics";disk$:print
- print tab(10);
- print "Drive Status: ";
-
- call asm(050h,0,21,(-1*256)+disk%,0) rem T21 get/set drive status
- l%=mod(gethl,256)
- if l%=0 then\
- print "Not ready.":stop
-
- h%=gethl/256
- if h%=-1 then print " :Read Only";
- if h%= 0 then print " :Read/Write";
-
- call asm(050h,0,19,disk%,0) rem allocation info
- s%=mod(getpsw,256)
- fixed%=s%>=80h
- s%=mod(s%,80h)
- directory.blocks%=mod(getbc,256)
- blocks.unused%=getde
- total.blocks%=gethl
- blocks.used%=total.blocks%-blocks.unused%
-
- block.size%=4 rem default
- if s%=3 then block.size%=1
- if s%=4 then block.size%=2
- if s%=5 then block.size%=4
- if s%=6 then block.size%=8
- if s%=7 then block.size%=16
-
- total.space=float(total.blocks%)*float(block.size%)
- directory.entries=directory.blocks%*block.size%
- directory.entries=directory.entries*32
-
- DISK.FREE.SPACE=STR$(float(blocks.unused%)*float(block.size%))
-
- call asm(050h,0,20,(-1*256)+disk%,0) rem sector size call
-
- sx%=mod(getpsw,256)
- if sx%=0 then sector.size%=128
- if sx%=1 then sector.size%=256
- if sx%=2 then sector.size%=512
- if sx%=3 then sector.size%=1024
- if sx%=4 then sector.size%=2048
- if sx%=5 then sector.size%=4096
- if sx%=6 then sector.size%=8192
- if sx%=7 then sector.size%=16384
- reserved.tracks%=getbc
- num.tracks%=getde
- num.sectors%=gethl
- percent.used = str$(int(100-(blocks.used%/total.space*100)))
- available.space=total.space-(block.size%*directory.blocks%)
-
- print tab(55);
- if fixed% then print "(Fixed media)" else print "(Removable media)"
-
- print tab(10);
- print "Total space :";str$(total.space)+"k"
- print tab(10);
- print "Useable file space :";str$(available.space)+"k"
- print tab(10);
- print "Free space :";disk.free.space+"k"
- print
- print tab(10);
- print "Sector size :";str$(sector.size%)
- print tab(10);
- print "Reserved tracks :";str$(reserved.tracks%)
- print tab(10);
- print "Tracks on disk :";str$(num.tracks%)
- print tab(10);
- print "Sectors/track :";str$(num.sectors%)
- print tab(10);
- print "Block size :";str$(block.size%)+"k"
- print tab(10);
- print "Directory blocks :";str$(directory.blocks%)
- print tab(10);
- print "Directory entries :";str$(directory.entries)
- print tab(10);
- print "Allocation Blocks :";str$(total.blocks%)
- print tab(10);
- print "Allocation blks used:";str$(blocks.used%)+" ("+percent.used+"%)"
- print tab(10);
- print "Allocation blks left:";str$(total.blocks%-blocks.used%)
- print
-
- console
- if match("L",operation$,1) then \
- print "Disk characteristics sent to printer."
- if match("M",operation$,1) then gosub fixmap
- if match("F",operation$,1) then gosub fixdir
-
- if print.options% then\
- print "Options ;L (send to printer)":\
- print " ;M (rebuild disk map)":\
- print " ;F (fix directory)"
- stop rem end prog
-
- fixmap:
- print
- print "OK to regenerate disk map on drive ";disk$;":? (Y/N) ";
- input "";line answer$: answer$=ucase$(answer$)
- if left$(answer$,1)<>"Y" then return
- print "Regenerating map on drive ";disk$;":"
- call asm(050h,0,11,(-1*256)+disk%,0) rem regenerate map
- a%=mod(getpsw,256)
- if a%<>0 then print "Unable to regenerate disk map.": return
-
- if a%=0 then print "Disk map regenerated."
-
- call asm(050h,0,19,disk%,0) rem allocation info
- new.blocks.unused%=getde
- new.blocks.used%=total.blocks%-new.blocks.unused%
- if new.blocks.used%=blocks.used% then return
- if new.blocks.used%>blocks.used% then a$="gained" else a$="lost"
- print abs(blocks.used%-new.blocks.used%);" allocation blocks ";a$
- return
-
-
- fixdir:
- print
- print "It would be good to BACK UP drive ";+disk$+": before starting."
- print "OK to reorganize directory on drive ";disk$;" (Y/N) ";
- input "";line answer$:answer$=ucase$(answer$)
- if left$(answer$,1)<>"Y" then return
- print "Reorganizing directory on drive ";disk$;"- DO NOT INTERRUPT!";
- call asm(050h,0,42,(-1*256)+disk%,0) rem regenerate map
- a%=mod(getpsw,256)
- if a%<>0 then print "Unable to reorganize directory.": return
-
- if a%=0 then print "Directory reorganized."
-
- return
-
-
-
-
- rem ******************************