home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
b
/
butl.zip
/
BOOTREC.BAS
< prev
next >
Wrap
BASIC Source File
|
1993-03-01
|
3KB
|
83 lines
100 ' BOOTREC.BAS -- Checks Boot Record -- Paul Somerson
110 ' (c) 1987 Ziff Communications Co.
120 '
130 ' --- Setup ---
140 '
150 SCREEN 0:COLOR 7,1:KEY OFF:CLS:DIM B(30):CLS
160 F$="5-1/4 inch, ":T$="3-1/2 inch, ":B$=STRING$(35,205)
170 S$="Sectors/Track":S1$="1 Side,":S2$="2 Sides,"
180 '
190 ' --- Ask which drive to check and create script ---
200 '
210 PRINT "Which drive to examine (A/B/C/D/E/F)? ";
220 J$=INKEY$:IF J$="" THEN 220
230 K=CINT(INSTR("AaBbCcDdEeFf",J$)/2)
240 IF K=0 THEN 210 ELSE PRINT CHR$(K+64)
250 OPEN "SCRIPT.FIL" FOR OUTPUT AS #1
260 PRINT #1,"L 100";K-1;"0 1":PRINT #1,"D 100 L 20"
270 PRINT #1,"Q":CLOSE
280 SHELL "DEBUG < SCRIPT.FIL > RAW.FIL
290 '
300 ' --- Read raw bytes into array D$() ---
310 '
320 OPEN "RAW.FIL" FOR INPUT AS #1
330 WHILE NOT EOF(1)
340 LINE INPUT #1,A$
350 IF LEFT$(A$,4)<>"Disk" THEN 370
360 BEEP:CLS:PRINT "Invalid disk -- ";:CLOSE:GOTO 210
370 IF LEN(A$)<70 THEN 390
380 D$(A)=MID$(A$,12,48):A=1
390 WEND
400 IF MID$(D$(0),38,1)="2" THEN 420
410 PRINT "Why are you using DOS 1.x ?? Upgrade!":CLOSE:END
420 D$=D$(0)+MID$(D$(1),1,41)
430 FOR A=0 TO 29
440 B(A+1)=VAL("&H"+MID$(D$,3*A+1,2))
450 NEXT:CLOSE
460 '
470 ' --- Figure things out ---
480 '
490 TS=B(21)*256+B(20)
500 BS=B(13)*256+B(12)
510 SC=B(14)
520 ST=B(26)*256+B(25)
530 NS=B(28)*256+B(27)
540 SF=B(24)*256+B(23)*B(17)
550 RD=B(19)*256+B(18)
560 SD=RD*32/BS
570 TB#=TS*BS
580 DS#=(TS-SD-SF-1)*BS
590 '
600 ' --- And print report ---
610 '
620 CLS:PRINT B$;" Drive ";CHR$(64+K);": " ;B$
630 PRINT "OEM Name and version: ";TAB(38);
640 FOR A=4 TO 11:PRINT CHR$(B(A));:NEXT
650 PRINT:PRINT "Total sectors: ";TAB(37);TS
660 PRINT "Bytes per sector: ";TAB(37);BS
670 PRINT "Sectors per cluster: ";TAB(37);SC
680 PRINT "Bytes per cluster: ";TAB(37);SC*BS
690 PRINT "Reserved (boot record) sectors: ";TAB(37);B(16)*256+B(15)
700 PRINT "Sectors per track: ";TAB(37);ST
710 PRINT "Number of hidden sectors: ";TAB(37);B(30)*256+B(29)
720 PRINT "Number of heads (sides): ";TAB(37);NS
730 PRINT "Tracks per side: ";TAB(37);FIX(TS/NS/ST)
740 PRINT "Number of File Allocation Tables: ";TAB(37);B(17)
750 PRINT "Sectors per File Allocation Table: ";TAB(37);B(24)*256+B(23)
760 PRINT "Total sectors used by FATs: ";TAB(37);SF
770 PRINT "Maximum root directory entries: ";TAB(37);RD
780 PRINT "Sectors used by root directory: ";TAB(37);SD
790 PRINT "Total bytes available on disk: ";TAB(37);TB#;"--";TB#/1024;CHR$(29);"K"
800 PRINT "Total bytes available for data: ";TAB(37);DS#
810 PRINT "Media descriptor byte: ";TAB(38);
820 IF B(22)=248 THEN PRINT "Fixed disk or RAMdisk":GOTO 910
830 IF B(22)<>249 THEN 850
840 PRINT F$;S2$;15;S$:PRINT TAB(38);"or "T$;S2$;9;S$:GOTO 910
850 IF B(22)=0 THEN PRINT T$;S2$;18;S$:GOTO 910
860 IF B(22)=252 THEN PRINT F$;S1$;9;S$:GOTO 910
870 IF B(22)=253 THEN PRINT F$;S2$;9;S$:GOTO 910
880 IF B(22)=254 THEN PRINT F$;S1$;8;S$:GOTO 910
890 IF B(22)=255 THEN PRINT F$;S2$;8;S$:GOTO 910
900 PRINT "(Unknown)"
910 KILL "RAW.FIL":KILL "SCRIPT.FIL"