home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 13 / 013.d81 / q&g unscratcher (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1985-01-01  |  3.7 KB  |  150 lines

  1. 0 a$="":iflf=1then2
  2. 1 gosub10000:dimp$(145),a$(255):iflf=0thenlf=1:load"input 1-255.o",8,1
  3. 2 q$=chr$(34):zz$=chr$(0)
  4. 4 :
  5. 5 print"[147][144]";:poke53281,44:poke53280,125
  6. 10 gosub 20000:poke198,0:rem instructions
  7. 11 getk$:ifk$<>" "then11
  8. 12 gosub 30000:ifsc=0then800
  9. 13 print"[213]n-scratch which file? <'quit' to exit>":inputf$:print"[145]  "f$"*"
  10. 14 iff$="quit"then60002
  11. 20 fd=0:open15,8,15
  12. 30 open2,8,2,"#"
  13. 35 :
  14. 40 tr=18:se=1:bp=2:tt=0
  15. 42 rem  tr and se are track and sector
  16. 43 rem      they start at 18-1
  17. 44 :
  18. 50 print#15,"u1:"2;0;tr;se
  19. 52 rem  read a block from the directory
  20. 54 :
  21. 60 get#2,x$:get#2,z$:x=0
  22. 62 rem  get next track/sector link
  23. 63 :
  24. 64 ot=tr:tr=asc(x$+zz$)
  25. 65 os=se:se=asc(z$+zz$)
  26. 70 x=x+1
  27. 75 print#15,"b-p:"2;bp
  28. 79 :
  29. 80 sys828,2,19:ty=asc(mid$(a$,1,1)):ifty<>0andty<>128then90
  30. 81 rem   read a name & check type
  31. 82 :
  32. 83 qd$=mid$(a$,4)
  33. 84 iff$=mid$(a$,4,len(f$))thenprintq$qd$q$" found!!":fd=1:goto500
  34. 90 bp=bp+32
  35. 91 :
  36. 92 ifx<8then70
  37. 93 rem    8 files per directory block
  38. 94 :
  39. 96 iftr<>0andse<>255thenbp=2:tt=tt+1:goto50
  40. 98 forp=0toc
  41. 99 printp$(p):next
  42. 100 close2:close15
  43. 500 rem    time to try un-newing
  44. 501 iffd=0thenprint"[212]hat file is not there!":goto800
  45. 502 print"[215]hat kind of file do you think it was?"
  46. 503 print:print" 1 = [211][197][209]":print" 2 = [208][210][199]":print" 3 = [213][211][210]"
  47. 504 getk$:ifk$<"1"ork$>"3"then504
  48. 505 tz=val(k$)+128
  49. 506 printk$"... [200]ere goes!"
  50. 510 tr=ot:se=os
  51. 520 :
  52. 530 :
  53. 540 print#15,"b-p:"2;bp
  54. 550 forx=bptobp+29:get#2,a$(x):next
  55. 559 :
  56. 560 a$(bp)=chr$(tz)
  57. 561 rem    change type of file
  58. 562 :
  59. 620 print#15,"b-p:"2;bp
  60. 630 print#2,a$(bp);
  61. 631 print#15,"b-p:"2;1
  62. 632 print#15,"u2:"2;0;tr;se
  63. 633 rem  write the next directory block
  64. 640 :
  65. 641 nt=asc(a$(bp+1)+zz$)
  66. 642 ns=asc(a$(bp+2)+zz$)
  67. 643 lb=asc(a$(bp+28)+zz$)
  68. 644 hb=asc(a$(bp+29)+zz$)
  69. 645 nb=lb+hb*256
  70. 646 :
  71. 647 rem the next section tries to
  72. 648 rem re-allocate the blocks used by
  73. 649 rem the unscratched file.
  74. 650 forx=1tonb
  75. 660 print#15,"u1:"2;0;nt;ns
  76. 670 print#15,"b-a:"0;nt;ns
  77. 672 input#15,er,er$,tr,se
  78. 674 ifer=65 thenprint"[211]orry...can't un-new this file!":x=nb+10:fl=10
  79. 675 :
  80. 676 rem   get link again
  81. 680 get#2,a$:get#2,b$
  82. 690 nt=asc(a$+zz$)
  83. 700 ns=asc(b$+zz$)
  84. 740 nextx
  85. 745 iffl<>10then790
  86. 750 forqd=15to1step-1:ifright$(qd$,1)=chr$(160)thenqd$=left$(qd$,qd)
  87. 751 next
  88. 760 iffl=10thenprint#15,"s0:"qd$:print#15,"v0"
  89. 770 print"[202]ust to clean things up, we need to "
  90. 780 print"validate.  [208]lease wait while [201] do so."
  91. 790 close15:close2
  92. 800 close15:print"finished..":goto60000
  93. 10000 t$="                         ":c=0:c$="":print"[147]":poke53281,0
  94. 10030 printspc(7)""t$:printspc(7)" 1541 [198]ile [213]n-scratcher. [146]"
  95. 10051 printspc(7)""t$:print:printtab(18)"by"
  96. 10060 print:printspc(13)"[193]lan [199]ardner"
  97. 10065 print:printspc(10)"&  [202]ames [199]. [215]eiler"
  98. 10070 print:printspc(12)"[195]opyright 1985"
  99. 10080 print:print:print:print"     [204][207][193][196][211][212][193][210] is not public domain."
  100. 10090 print:print"  [208]lease respect the author's rights."
  101. 10100 print:print"      [208]ress space bar to continue."
  102. 10110 forcc=1to48:getk$:ifk$=" "then10130
  103. 10120 ifcc=1thenprintmid$(c$,c+2,1)"[145][145]";:c=not(c)
  104. 10125 next:goto10100
  105. 10130 printc$:return
  106. 20000 print"[147] [202]ust give me a file name."
  107. 20005 print:print"[201]f that file has been scratched, or if"
  108. 20006 print:print"a file whose name starts with what you"
  109. 20007 print:print"typed has been scratched, [201] will un-"
  110. 20020 print:print"scratch it if [201] can find it all."
  111. 20030 print:print:print"  [206]ow, put the disk with the scratched"
  112. 20040 print:print"file on it in your disk drive"
  113. 20050 print:print"and press the space bar."
  114. 20090 return
  115. 30000 sc=0:print"[147][211]cratched files on this disk:"
  116. 30005 open15,8,15
  117. 30010 open2,8,2,"#"
  118. 30020 tr=18:se=1:bp=2:tt=0
  119. 30030 print#15,"u1:"2;0;tr;se
  120. 30040 get#2,x$:get#2,z$:x=0
  121. 30050 ot=tr:tr=asc(x$+zz$)
  122. 30060 os=se:se=asc(z$+zz$)
  123. 30070 x=x+1
  124. 30080 print#15,"b-p:"2;bp
  125. 30090 sys828,2,19:ty=asc(mid$(a$,1,1)):ifty<>0andty<>128then30110
  126. 30100 ifmid$(a$,4,1)<>zz$thenprintq$mid$(a$,4)q$:sc=sc+1
  127. 30110 bp=bp+32
  128. 30120 ifx<8then30070
  129. 30130 iftr<>0andse<>255thenbp=2:tt=tt+1:goto30030
  130. 30140 forp=0toc
  131. 30150 printp$(p):next
  132. 30160 close2:close15
  133. 30165 ifsc=0thenprint"[212]here are no scratched files there!"
  134. 30170 return
  135. 50000 open15,8,15
  136. 50010 input#15,a$,b$,c$,d$
  137. 50020 printa$,b$,c$,d$:close15
  138. 60000 print""spc(14)"<press a key>"
  139. 60001 poke198,0:wait198,1:geta$
  140. 60002 print"[147][215]ould you like to try another?"
  141. 60003 poke198,0:wait198,1:geta$:ifa$<>"y"anda$<>"n"thenpoke53280,rnd(1)*15:goto60003
  142. 60004 ifa$="y"then0
  143. 60006 goto63000
  144. 60010 :
  145. 63000 print"[147][208]lease put the [204][207][193][196][211][212][193][210] disk back in thedrive and press a key.
  146. 63002 [151]198,0:[146]198,1:[161]a$
  147. 63003 [151]927,0:  [143]   _ menu.sp1
  148. 63005 [153]"loadload"[199](34)"hello"[199](34)",8":[153]"run"
  149. 63010 [151]631,13:[151]632,13:[151]198,2:[128]
  150.