home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_10_1986_Transactor_Publishing.d64 / un-scratch (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  1KB  |  31 lines

  1. 100 rem save"0:un-scratch",8: rem ** rte/85
  2. 110 z$=chr$(0): cr$=chr$(13): sc=1: dr=0: rem dirsec + drvnum
  3. 120 print "** disk file un-scratcher **"cr$"enter drive type"
  4. 130 print " a) 1541/2031"cr$" b) 2040/4040"cr$" c) 8050/8250"
  5. 140 input "your choice ";dt$: if dt$<"a" or dt$>"c" then 140
  6. 150 dt=18: bh=3: if dt$=>"b" then bh=17: if dt$="c" then dt=39
  7. 160 open 15,8,15: open 8,8,8,"#0"
  8. 170 print#15,"u1:"8;dr;dt;sc: rem read dir sector
  9. 180 print#15,"m-r"chr$(0)chr$(bh)chr$(2): get#15,nt$,ns$: rem next trk/sec
  10. 190 flag=1: for lk=0 to 7: ps=lk*32: print#15,"m-r"chr$(2+ps)chr$(bh)chr$(19)
  11. 200 get#15,sb$,ft$,fs$: if len(sb$) or len(ft$)=0 then 310
  12. 210 print "1st data track"asc(ft$)"sector"asc(fs$+z$)
  13. 220 print "filename ";: for name=1 to 16: get#15,n$: print n$;: next
  14. 230 print#15,"m-r"chr$(30+ps)chr$(bh)chr$(2): get#15,l$,h$: rem file size
  15. 240 print: print "size"asc(l$+z$)+256*asc(h$+z$)"block(s)"
  16. 250 input "un-scratch (y/n) ";us$: if us$<>"y" then 310: rem * nope
  17. 260 input "file type: s, p, u, r ";ft$: us=0
  18. 270 for chk=1 to 4: if ft$=mid$("spur",chk,1) then us=chk+128
  19. 280 next chk: if us=0 then 260: rem incorrect reply
  20. 290 print#15,"m-w"chr$(2+ps)chr$(bh)chr$(1)chr$(us)
  21. 300 print "done !!": print: flag=0
  22. 310 next lk
  23. 320 if flag then 350: rem no change in sector
  24. 330 input "write block to disk (y/n) ";yn$: if yn$<>"y" then 350
  25. 340 print#15,"u2:"8;dr;dt;sc
  26. 350 dt=asc(nt$+z$): sc=asc(ns$+z$): if dt then 170: rem more to go
  27. 360 if us=0 then 390: rem nothing to un-scratch
  28. 370 input "validate the diskette (y/n) ";yn$: if yn$<>"y" then 390
  29. 380 print#15,"v"+str$(dr): print ">> validating disk <<"
  30. 390 close8: close15: end
  31.