home *** CD-ROM | disk | FTP | other *** search
- 0 rem << rr54-1 >>
- 1 rem===================================
- 2 rem
- 3 rem directory scanner
- 4 rem
- 5 rem rupert report #54
- 6 rem
- 7 rem==== c-64/128 ==== 1541/1571 ======
- 8 print""
- 10 rem
- 20 rem read and display directory
- 30 rem using dos direct access commands
- 40 rem
- 100 gosub 1000 :rem initialize
- 110 open 15,dvc,15 :rem command channel
- 120 gosub 7000 :rem check disk status
- 130 :rem open data channel 2; set up a disk buffer for it
- 140 open 1,dvc,2,"#"
- 150 gosub 7000 :rem check disk status
- 160 :rem -- read sector into channel 2's buffer in disk drive :
- 170 print# 15,rd$;2;dvc;tk;sc
- 180 gosub 7000 :rem check disk status
- 190 gosub 2000 :rem read disk buffer into computer
- 200 :rem -- interpret data bytes --
- 210 for fil=0 to 7
- 220 gosub 3000 :rem display dir entries
- 230 rem >>> gosub 5000 :rem select undeletion
- 240 next fil
- 250 print l$
- 260 rem >>>> if udflg then goto 6000:rem undelete & end
- 270 gosub 4000 :rem continue or end?
- 280 goto 170 :rem continue
- 290 rem --------------------------------
- 1000 rem ======== initialize =========
- 1010 print chr$(147); "==directory scanner==": print
- 1020 false=0: true=not false: z$=chr$(0)
- 1030 nul$=z$: sp$=" ": l$="--"
- 1040 for n=1 to 4: nul$=nul$+nul$: sp$=sp$+sp$: l$=l$+l$: next
- 1050 sp$="[145] " + sp$ + " [145]"
- 1060 for n=0 to 4: read typ$(n): next n
- 1070 data del, seq, prg, usr, rel
- 1080 rd$="u1": wr$="u2"
- 1090 tk=18: sc=1 :rem 1st dir trk/sector
- 1100 dvc=8
- 1110 return
- 1120 rem -------------------------------
- 2000 rem ======== read sector =========
- 2010 b$=""
- 2020 print "reading track, sector :"; tk; sc
- 2030 print "================================="
- 2040 print "file name.......type: tk sc len"
- 2050 print "================================="
- 2060 print# 15,"b-p";2;0 :rem point to byte 0 of chnl 2 buffer
- 2065 :rem get next dir track & sector
- 2070 get# 1,tk$: if tk$="" then tk$=z$
- 2080 get# 1,sc$: if sc$="" then sc$=z$
- 2090 for n=2 to 255
- 2100 get# 1,d$
- 2110 if d$="" then d$=z$
- 2120 b$=b$+d$ :rem read buffer into b$
- 2130 next n
- 2140 return
- 2150 rem -------------------------------
- 3000 rem ======= interpret data ======
- 3010 ptr=fil*32+1
- 3020 ff=asc(mid$(b$,ptr,1)) :rem file status
- 3030 md=ff and 192 :rem closure mode
- 3040 typ=ff and 7 :rem file type
- 3050 :rem -- first tk & sector of file
- 3060 ftk=asc(mid$(b$,ptr+1,1))
- 3070 fsc=asc(mid$(b$,ptr+2,1))
- 3080 nm$=mid$(b$,ptr+3,16) :rem filename
- 3090 nulflg=false: if nm$=nul$ then nm$="( unused entry )": nulflg=true
- 3100 blk=asc(mid$(b$,ptr+28,1))+asc(mid$(b$,ptr+29,1))*256 :rem file length
- 3110 print nm$;: if nulflg then print: goto 3130
- 3120 print ","; typ$(typ); ": "; ftk; fsc; blk
- 3130 if md=192 then print " ( file locked )"
- 3140 if md=0 and typ>0 then print "> file not properly closed <"
- 3150 return
- 3160 rem -------------------------------
- 4000 rem ======= continue ============
- 4010 print: print "q to quit; any other key to continue"
- 4020 get k$: if k$>"" then 4020 :rem empty kybd buffer
- 4030 get k$: if k$="" then 4030
- 4040 print sp$
- 4050 if k$="q" then 4100
- 4060 rem -- next track & sector of dir :
- 4070 tk=asc(tk$+z$): sc=asc(sc$+z$)
- 4080 if tk=18 then goto 4110
- 4090 print "no more files in directory"
- 4100 close 1: close 15: end
- 4110 return
- 4120 rem -------------------------------
- 5000 rem ==== select for undeletion ====
- 5010 if typ>0 or nulflg then 5100
- 5020 print " press u to undelete this file[146]"
- 5030 get k$: if k$>"" then 5030: rem clear kybd
- 5040 get k$: if k$="" then 5040
- 5050 print sp$:if k$<>"u" then goto 5100
- 5060 udflg=true : ct=ct+1
- 5070 print "[145]"; tab(35); "*"
- 5080 print " (- to be undeleted -)"
- 5090 b$=left$(b$,ptr-1)+chr$(128+2)+mid$(b$,ptr+1)
- 5100 return
- 5110 rem -------------------------------
- 6000 rem ========= undelete ============
- 6010 print# 15,"b-p";2;0
- 6020 print# 1,tk$;sc$;b$;
- 6030 gosub 7000
- 6040 print# 15,wr$;2;dvc;tk;sc
- 6050 gosub 7000
- 6060 print# 15,"v0" :rem validate
- 6070 print "validating disk..."
- 6080 gosub 7000
- 6090 print ct; "file(s) undeleted"
- 6100 close 1: close 15: end
- 6110 rem -------------------------------
- 7000 rem ====== check disk status ====
- 7010 if ds$="" then goto 7050 :rem (for c-64 only)
- 7020 if ds<20 then return
- 7030 print "disk error :"; ds$ : close 1: close 15: end
- 7040 rem === c-64 only ===
- 7050 input# 15,en,em$,et,es
- 7060 if en<20 then return
- 7070 print "disk error :"; en;em$;et;es
- 7080 close 1: close 15: end
- 7090 rem -------------------------------
-