8-Bit Software Online Conversion
DFS Backup - Listing
10REM >BACKUP
20REM Backup program
30REM V1.15 28-12-97: More display, t
idier program
40REM V1.16 11-01-98: Countdown count
s down (not up!)
50MODE&87:PROCinit:PRINT"BACKUP PROGR
AM 1.16. Buffer size: &";÷maxlen%'
60PROCparams:PROCbackup:REM PROCend
70END
80:
90DEFPROCinit:*K.10O.|MCLOSE#0:RUN|M
100OSWORD=&FFF1:maxlen%=(HIMEM-LOMEM-3
000)AND&FFFF00
110DIM ctrl%30,data%maxlen%:X%=ctrl%:Y
%=X%DIV256
120ENDPROC
130:
140DEFFNh(A%,N%)=RIGHT$("0000000"+STR$
÷A%,N%)
150DEFPROCDrd(Ad%,Dv%,Sc%,Nm%):PROCdsk
(&53):ENDPROC
160DEFPROCDwr(Ad%,Dv%,Sc%,Nm%):PROCdsk
(&4B):ENDPROC
170:
180DEFPROCdsk(Cmd%):Nm0%=Nm%:A%=&7F:RE
PEAT
190Num%=Nm%DIV256:IFNum%+(Sc%MOD10)>10
:Num%=10-(Sc%MOD10)
200try%=tries%:REPEAT
210?X%=Dv%:X%!1=Ad%:X%?5=3:X%?6=Cmd%:X
%?7=Sc%DIV10:X%?8=Sc%MOD10
220X%!9=Num%:IFX%?7>79:X%?7=X%?7-80:?X
%=?X% OR 2:REM Side 2
230VDU13:IFCmd%=&53:PRINT"Read "; ELSE
PRINT"Write";
240PRINT" "FNh(Dv%,1)":"FNh(Sc%,6)"+"F
Nh(Nm%DIV256,2)" "FNh(tries%-try%,1)" ";
250CALL OSWORD:Derr%=X%?10:try%=try%-1
:UNTILDerr%=0 OR try%=0
260IFDerr%:PRINTFNerr(Derr%);SPC(39-PO
S);:IFNm%=&100:PRINT
270IFCmd%=&53 ANDDerr%=0:PRINT;read%+N
m0%-Nm%;" bytes read"; ELSE IFCmd%=&4B A
NDDerr%=0 PRINT;write%-Nm0%+Nm%;" bytes
left";
280PRINTSPC(39-POS);:Ad%=Ad%+Num%*256:
Sc%=Sc%+Num%:Nm%=Nm%-Num%*256
290UNTILNm%<1 OR Derr%:ENDPROC
300:
310DEFFNerr(A%):IFA%<&08 ORA%>&18:="Er
ror "+FNh(A%,2)
320=MID$("Clock errorID CRC errorData
CRC errorNot readyWrite protectedTrack 0
not foundSector not found",VALMID$("010
012243847620079",A%-7,2),VALMID$("110012
140915170016",A%-7,2))
330:
340DEFPROCseek
350?X%=Dv%:X%?5=1:X%?6=&69:X%?7=(Sc%DI
V10)AND(Sc%>10)
360CALL OSWORD:ENDPROC
370:
380DEFPROCparams
390INPUT"Source drive: "sdrv%
400INPUT"Dest. drive: "ddrv%
410same%=sdrv%=ddrv%:IFsame%:PRINT"Usi
ng same drive."
420INPUT"Number of tracks (80) "trk%:I
Ftrk%=0:trk%=80
430INPUT"Number of sides (2) "sides%:I
Fsides%<>1:sides%=2
440INPUT"Sectors/track (10) "sps%:IFsp
s%=0:sps%=10
450IFsps%<>10:sps%=10:PRINTCHR$11;STRI
NG$(19,CHR$9);" 10 "
460INPUT"Number of tries (10) "tries%:
IFtries%<2:tries%=10
470ENDPROC
480:
490DEFPROCbackup
500IF NOTsame% PRINT"Press a key to ba
ckup from :";sdrv%;" to :";ddrv%;:IFGETO
R1 PRINT'
510read%=0:write%=2560*trk%*sides%:FOR
s%=0TO(sides%-1)*2 STEP2
520sect%=0:length%=trk%*2560:REPEAT:nu
m%=maxlen%:IFnum%>length%:num%=length%
530:
540IFsame%:PRINTCHR$13"Insert source d
isk and press a key";:IFGETOR1:PRINTCHR$
13;SPC(39);CHR$13;
550REPEATPROCDrd(data%,sdrv%+s%,sect%,
num%)
560IFDerr%:num%=(num%AND&FFFE00)DIV2
570UNTILDerr%=0 ORnum%<&100:IFnum%<&10
0:num%=&100
580IFDerr%=0 ORnum%=&100:read%=read%+n
um%
590:
600IFsame%:PRINTCHR$13"Insert dest. di
sk and press a key";:IFGETOR1:PRINTCHR$1
3;SPC(39);CHR$13;
610REPEATPROCDwr(data%,ddrv%+s%,sect%,
num%)
620IFDerr%:num%=(num%AND&FFFE00)DIV2
630UNTILDerr%=0 ORDerr%=&12 ORnum%<&10
0:IFnum%<&100:num%=&100
640IFDerr%=0 ORnum%=&100:write%=write%
-num%
650IFDerr%=&12:PRINT'"Destination disk
write protected":length%=0:s%=99
660:
670sect%=sect%+num%DIV256:length%=leng
th%-num%
680UNTILlength%<1 ORDerr%=&12:NEXTs%:P
RINTCHR$13;SPC(39)
690ENDPROC