10 REM 'RESCUE' Program for
20 REM saving deleted files
30 :
40 ON ERROR PROCerror:END
50 MODE7
60 DIM block% 12 :REM data block for
disk operations
70 :
80 REM Change the beep
90 *FX213,30
100 *FX214,1
110 HIMEM=&2FFF:B%=&3000 :REM File is
stored in RAM starting at &3000
120 :
130 PRINT CHR$(141);" DISC PROGR
AM RESCUE"
140 PRINT CHR$(141);" DISC PROGR
AM RESCUE"
150 VDU28,0,24,39,5,12,15,3
160 Q$=STRING$(60," ")
170 :
180 REPEAT *FX15,0
190 INPUT TAB(0,1)"Please enter drive
number (0 to 3) "drive%
200 UNTIL drive%>-1 AND drive%<4
210 :
220 REPEAT *FX15,0
230 INPUT TAB(0,4)"How many sectors do
you wish to save (maximum = 70) "F%
240 UNTIL F%>0 AND F%<71
250 PRINT TAB(0,11)Q$
260 :
270 REPEAT *FX15,0
280 INPUT TAB(0,8)"Please enter the nu
mber of the first sector "G%
290 UNTIL G%>-1 AND G%<800
300 IF F%+G%>799 PRINT TAB(0,11)"Total
exceeds 799, Re-enter details ": PRINT
TAB(0,8)Q$:VDU7:GOTO 220
310 Track%=G% DIV 10
320 Sector%=G% MOD 10
330 :
340 FOR E%=1 TO F%
350 PROCrescue :REM see PROCrescue
360 Sector%=Sector%+1:IF Sector%>9 Sec
tor%=0:Track%=Track%+1
370 NEXT
380 :
390 INPUT TAB(0,12)"Please enter new f
ilename (7 characters maximum) :"name$
400 CLS
410 PRINT''" *SAVE "name$" 3000 ";÷B%;
" 8023 1900"
420 PRINT''"File may now be saved by c
opying the above line by using the up
-arrow key, the COPY key, and finally
<RETURN>"
430 PRINT'"You may change to another d
rive before copying the '*SAVE' line if
you wish."
440 PRINT'"If the file is not a BASIC
program do not copy the last two group
s (8023 1900)"
450 PRINT"(Additional copies of this f
ile can be made by changing the drive a
nd/or disk and recopying the '*SAVE' li
ne)"''
460 END
470 :
480 DEF PROCrescue :REM recover one se
ctor from disk
490 ?block%=drive%
500 block%!1=B% :REM Address of destin
ation in RAM
510 block%?5=3 :REM Number of command
parameters
520 block%?6=&53 :REM 'Read' command b
yte
530 block%?7=Track%
540 block%?8=Sector%
550 block%?9=&21 :REM one block of 256
bytes
560 A%=&7F :REM Read/Write operation r
equired
570 X%=block% MOD 256 :REM Tells disk
controller-
580 Y%=block% DIV 256 :REM the address
of block%
590 CALL&FFF1 :REM call disk operation
600 B%=B%+&100 :REM move up one page i
n RAM ready for next sector
610 ENDPROC
620 :
630 DEF PROCerror
640 CLOSE#0
650 REPORT:PRINT'" at line ";ERL
660 ENDPROC