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 >
BASIC Source File  |  1993-03-01  |  3KB  |  83 lines

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