10 REM 'FINDEM'
20 REM Program for finding deleted fi
les
30 ON ERROR PROCerror:END
40 MODE7
50 DIM block% 12 :REM data block for
disk operations
60 :
70 REM Change the beep
80 *FX213,30
90 *FX214,1
100 :
110 PRINT CHR$(141);" DELETED FIL
E FINDER"
120 PRINT CHR$(141);" DELETED FIL
E FINDER"
130 PRINT''"Write-Protection advised f
or disk."
140 VDU28,0,24,39,6,12,15,3
150 Flag=0
160 :
170 INPUT'"What is the disk title? "t
itle$
180 REPEAT:*FX15,0
190 INPUT TAB(0,4);"Please enter drive
number (0 to 3) "drive%
200 UNTIL drive%>-1 AND drive%<4
210 :
220 REPEAT:*FX15,0
230 INPUT TAB(0,7);"Do you want a prin
ted output? (Y/N) "Print$
240 PR=INSTR("YyNn",Print$)
250 UNTIL PR>0:CLS
260 IF PR<3 VDU2 ELSE VDU14
270 PRINT'" Disc: ";title$;TAB(24)"Dri
ve: ";drive%
280 :
290 REM Load disk catalogue to &0900
300 R%=1 :REM sector 1
310 PROCread`disk(R%)
320 :
330 REM Find beginning of file entries
340 A%=?&0905:B%=&0904+A%
350 Newsector=2 :REM First file should
begin at sector 2
360 Calcsector=(B%?2 AND &3)*&100+B%?3
:REM Calculate sector number
370 IF Newsector<>Calcsector PROCrepor
t
380 IF A%=8 GOTO 420
390 REPEAT
400 PROCcheck :REM See PROCcheck
410 UNTIL B%=&090C
420 IF Flag=0 PRINT''"There are no unl
isted files on this"'"drive"
430 :
440 REM Calculate highest sector used
plus one
450 R%=(B%?2/&10 AND &3)*256+(B%?1)+AB
S(?B%>0)+(B%?2 AND &3)*256+(B%?3)
460 PROCtop(R%) :REM See PROCtop
470 VDU3
480 :
490 PRINT''"Do you want to check anoth
er drive(Y/N)":VDU7
500 repeat$=GET$
510 IF repeat$="Y" OR repeat$="y" RUN
ELSE PRINT''"Thank you"
520 END
530 :
540 DEF PROCcheck :REM Checking disk c
atalogue looking for gaps
550 Calcsector=(B%?2/&10 AND &3)*256+(
B%?1)+ABS(?B%>0)+(B%?2 AND &3)*256+(B%?3
)
560 C%=B%-6
570 Newsector=(?C% AND &3)*&100+C%?1
580 IF Calcsector<>Newsector PROCrepor
t
590 B%=B%-8
600 ENDPROC
610 :
620 DEFPROCread`disk(R%) :REM Load dis
k sector R% to &0900
630 ?block%=drive%
640 block%!1=&0900
650 block%?5=3 :REM number of command
parameters
660 block%?6=&53 :REM 'Read' command b
yte
670 block%?7=R% DIV 10 :REM Track No.
680 block%?8=R% MOD 10 :REM Sector No.
690 block%?9=&21 :REM one block of 256
bytes
700 A%=&7F :REM Read/write operation r
equired
710 X%=block% MOD 256 :REM Tells disk
controller-
720 Y%=block% DIV 256 :REM the address
of block%
730 CALL&FFF1 :REM call disk operation
740 ENDPROC
750 :
760 DEF PROCreport
770 IF Flag=0 PRINT'"Uncatalogued file
s are as follows:":PRINT''"From Sector";
TAB(14)"To Sector";TAB(26)"No. of Sector
s":Flag=1
780 PRINTTAB(5);Calcsector;TAB(17);New
sector-1;TAB(31);Newsector-Calcsector
790 ENDPROC
800 :
810 DEF PROCtop(R%) :REM checking area
of disk beyond catalogue entries
820 PROCread`disk(R%) :REM load next s
ector after last listed file
830 FOR byte%=&0900 TO &09FF :REM chec
k for presence of data
840 IF ?byte%<>&E5 PRINT'"Advise check
ing sector ";R%;" for data":byte%=&09FF
850 NEXT
860 ENDPROC
870 :
880 DEF PROCerror
890 CLOSE#0
900 REPORT:PRINT" at line ";ERL
910 ENDPROC