home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 1 / 001.d81 / discan (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  4KB  |  85 lines

  1. 5 o=1:z=0:n$=chr$(z):c=15:d=8:openc,d,c:poke53281,.:poke646,1
  2. 10 print"[147]joel rea's disk scanner":print"do you want instructions?[160]";
  3. 11 poke198,.:wait198,1:geta$:ifa$="y"thenprint"yeah!":goto200
  4. 12 print"[145]"
  5. 14 print"insert disk and press any key to start":fori=1to100:next
  6. 15 poke198,.:wait198,1:poke198,.
  7. 16 print"[145]                                      "
  8. 20 print#c,"i":opend,d,d,"#":fort=oto35:readm:fors=ztom:poke56329,z:poke56328,z
  9. 21 data20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,18,18,18,18,18,18,18
  10. 22 data17,17,17,17,17,17,16,16,16,16,16
  11. 25 print"[145]"t"[157] "s"[157] ":print#c,"ua:"d;d;t;s:gosub100:ife>19then50
  12. 27 ifpeek(56329)thenprint"[145]","marginal!":ma=ma+1
  13. 30 nexts,t:printbb"bad blocks found.":printcb"corrected.":printab"allocated."
  14. 32 printma"marginal blocks found."
  15. 33 print"insert program disk and press a key:":poke198,.:wait198,1:poke198,.
  16. 35 closec:closed:print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
  17. 40 poke631,13:poke632,13:poke198,2:end
  18. 50 bb=bb+1:print"[145]",e$e:ec=e:print#c,"b-a:"d;t;s:gosub100:ife<>65then57
  19. 55 print"warning![146]  block is part of a file!":w%=-1
  20. 57 ifec=23then70
  21. 58 ife=65thenprint:goto30
  22. 60 print"allocate?[160]";:gosub110:ifr%=0thenprint#c,"b-f:"d;t;s:print:goto30
  23. 65 ab=ab+1:print:goto30
  24. 70 print"attempt fix? ";:gosub110:ifr%then75
  25. 72 ifw%thenw%=0:print:goto30
  26. 73 goto60
  27. 75 print#c,"ub:"d;d;t;s:gosub100:ife>19then90
  28. 80 print"write succeded.":print#c,"ua:"d;d;t;s:gosub100:ife>19then90
  29. 82 print"re-read succeded!"
  30. 85 print"block okay";:ifw%thenprint", but data corrupted";
  31. 87 ifw%=0thenprint#c,"b-f:"d;t;s
  32. 88 print"!":cb=cb+1:w%=0:goto30
  33. 90 print"fix failed!":ifw%thenw%=0:print:goto30
  34. 95 goto60
  35. 100 input#c,e,e$,et,es:return
  36. 110 geta$:ifa$="y"thenprint"yeah!":r%=-1:return
  37. 115 ifa$="n"thenprint"nope.":r%=0:return
  38. 117 goto110
  39. 200 print"this program scans a disk, searching for";
  40. 205 print"bad and marginal sectors.  it does not"
  41. 210 print"harm data on a disk unless the 'fix'"
  42. 215 print"option is used (see below).  when asked,";
  43. 220 print"simply insert the disk you want scanned"
  44. 225 print"and press a key.  that will start the"
  45. 230 print"scan.  as the scan progresses, two num-"
  46. 235 print"bers will be displayed, and will cons-"
  47. 240 print"tantly change.  the first number is the"
  48. 245 print"current track, and the second number is"
  49. 250 print"the current block (or 'sector') on that"
  50. 255 print"track.  if the program finds a bad sec-"
  51. 260 print"tor, it will check to see if the block"
  52. 265 print"is in use.  if not, it will give you"
  53. 270 print"an opportunity to 'lock-out' or 'allo-"
  54. 275 print"cate' the block so that the disk drive"
  55. 280 print"will think that block is already in use!";
  56. 285 print"(warning!  if you later use the 1541's"
  57. 290 print"in use!  (warning!  if you later use"
  58. 295 print"de-allocated!  just re-scan the disk.)"
  59. 300 print"press a key to continue instructions:"
  60. 305 poke198,0:wait197,64,64:poke198,0
  61. 310 print"[145]if the bad block is fixable, the pro-"
  62. 315 print"gram will give you an opportunity to"
  63. 320 print"fix it.  this is done by writing the"
  64. 325 print"block back out then re-reading it.  us-"
  65. 330 print"ually, the block itself will be fixed,"
  66. 335 print"but the current contents of the block"
  67. 340 print"will almost always be corrupted!  if the";
  68. 345 print"block was already in use, use the fix"
  69. 350 print"option with care!  the fix is to allow"
  70. 355 print"the block to be re-used!  if the disk"
  71. 360 print"drive does not actually return an er-"
  72. 365 print"error, but takes a second or longer to"
  73. 370 print"successfully read the block, that block"
  74. 375 print"is graded as 'marginal' and the scan"
  75. 380 print"continues.  at the end of the scan, a"
  76. 385 print"count is given of all bad blocks found,"
  77. 390 print"how many of those were allocated, and"
  78. 395 print"and how many were fixed.  also, the #"
  79. 400 print"of marginal blocks is displayed.  if"
  80. 405 print"there are many marginal blocks, or any"
  81. 410 print"track 18 marginal blocks, its time for"
  82. 415 print"a backup!!!  that's all there is to us-"
  83. 420 print"ing 'discan'!":print"press any key to continue:";
  84. 425 poke198,0:wait197,64,64:poke198,0:goto10
  85.