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