10
20
30 :
40 max%=((HIMEM-LOMEM)DIV1024)*256
50 DIM ctrl% 31,memin% max%-1,memout% max%*2-1:X%=ctrl%:Y%=X%DIV256
60 INPUT"Source file: "in$:in%=OPENIN(in$):IFin%=0:PRINT"File '"in$"' not found":END
70 INPUT"Dest. file: "out$:out%=OPENOUT(out$):IFout%=0:PROCCloseAll:PRINT"Can't open '"out$"'":END
80 ON ERROR REPORT:PROCCloseAll:END
90 REPEAT:PRINTCHR$13;100*PTR#in%DIVEXT#in%;"%: ";PTR#in%DIV1024;"K of ";EXT#in%DIV1024;"K";
100 PROCgbpb(3,in%,memin%,max%,PTR#in%)
110 FOR A%=0 TO max%-1:memout%?(A%*2)=memin%?A%:memout%?(A%*2+1)=memin%?A%:NEXT
120 PROCgbpb(1,out%,memout%,max%*2,PTR#out%)
130 UNTILEOF#in%
140 PTR#out%=0:EXT#out%=EXT#in%*2
150 CLOSE#out%:out%=0
160 CLOSE#in%:in%=0
170 PRINT
180 END
190 DEFPROCCloseAll
200 in%=in%:IFin%:A%=in%:in%=0:CLOSE#A%
210 out%=out%:IFout%:A%=out%:out%=0:CLOSE#A%
220 ENDPROC
230 DEFPROCgbpb(A%,chn%,addr%,num%,ptr%):?X%=chn%:X%!1=addr%:X%!5=num%:X%!9=ptr%:CALL&FFD1:ENDPROC