8-Bit Software Online Conversion
ADFS Backup (Master) - Listing
10REM
20REM Public Domain Software 1990
30REM
40*TV255
50MODE7
60*ADFS
70HIMEM=&2C00
80PRINTCHR$(141);" Master Series -
ADFS Backup"
90PRINTCHR$(141);" Master Series -
ADFS Backup"
100PRINTTAB(11,3);"Version 2.33."
110PRINTTAB(6,5);"For floppy drives on
ly."
120DIM BLOCK% 15,RAM% 4
130data%=&2C00
140PRINTTAB(0,8);"Enter source drive n
umber (0-5) ?";
150REPEAT:SOURCE%=(GET AND 207):UNTIL
SOURCE%<5:PRINT" ";SOURCE%
160PRINTTAB(0,10);"Enter destination d
rive number (0-5) ?";
170REPEAT:DEST%=(GET AND 207):UNTIL DE
ST%<5:PRINT" ";DEST%
180IFSOURCE%=0 THEN SOURCE%=4
190IFSOURCE%=1 THEN SOURCE%=5
200IFDEST%=0 THEN DEST%=4
210IFDEST%=1 THEN DEST%=5
220IF SOURCE%=DEST% THEN CHANGE%= TRUE
ELSE CHANGE%=FALSE
230FAST=TRUE:REM Fast disk access
240:
250I%=0:BANKS%=0
260ON ERROR GOTO 1440
270:
280OSCLI"SRDATA "+STR$(4+I%)
290BANKS%=BANKS%+1
300RAM%?I%=TRUE
310:
320I%=I%+1
330IF I%<4 THEN 280
340:
350ON ERROR OFF
360CLS:PRINTTAB(0,10);"Insert DESTINAT
ION disk and press SPACE"
370PROCSPACE
380OSCLI"MOUNT "+STR$(DEST%)
390IF FNCHECKFORMATTED(DEST%,"D")<>0 T
HEN PRINT''"Disk not formatted":END
400CLS:PRINTTAB(0,10);"Insert SOURCE d
isk and press SPACE"
410PROCSPACE
420IF FNCHECKFORMATTED(SOURCE%,"S")<>0
THEN PRINT''"Disk not formatted":END
430IF DEST`SIZE%<SOURCE`SIZE% THEN PRI
NT''"Disk capacity insufficient":END
440I%=0:BLOCKDONE%=0
450MAXBLOCKS%=2+BANKS%*&4000 DIV &5000
460REPEAT
470PRINTTAB(0,10);"Reading... "
480IF BLOCKDONE%+MAXBLOCKS%>SOURCE`SIZ
E%/20 THEN MAXBLOCKS%=SOURCE`SIZE%/20-BL
OCKDONE%
490PROCMOUNT(SOURCE%)
500FORJ%=0 TO MAXBLOCKS%-1
510PROCLOADBLOCK(I%*4+J%*20*4,J%)
520PROCMOVEBLOCK`UP(J%)
530NEXT
540IF CHANGE% THEN CLS:PRINTTAB(0,10);
"Insert DESTINATION disk and press SPACE
":PROCSPACE
550PRINTTAB(0,10);"Writing..."
560PROCMOUNT(DEST%)
570FORJ%=MAXBLOCKS%-1 TO FNMAX(0,MAXBL
OCKS%-2) STEP -1
580PROCMOVEBLOCK`DOWN(J%)
590PROCWRITEBLOCK(I%*4+J%*20*4,J%)
600NEXT
610IF MAXBLOCKS%<=2 THEN 660
620FOR J%=0 TO MAXBLOCKS%-3
630PROCMOVEBLOCK`DOWN(J%)
640PROCWRITEBLOCK(I%*4+J%*20*4,J%)
650NEXT
660I%=I%+MAXBLOCKS%*20
670IF I%<SOURCE`SIZE% AND CHANGE% THEN
CLS:PRINTTAB(0,10);"Insert SOURCE disk
and press SPACE":PROCSPACE
680UNTIL BLOCKDONE%*20>=SOURCE`SIZE%
690PROCRESTORE`RAMSTATUS
700END
710DEFFNMAX(A,B)
720IF A>B THEN =A ELSE =B
730DEFPROCLOADBLOCK(ST%,BLOCKNO%)
740OSET%=0
750IF BLOCKNO%=MAXBLOCKS%-2 AND MAXBLO
CKS%>1 THEN OSCLI"FX 108,1":OSET%=&400
760IF BLOCKNO%=MAXBLOCKS%-1 THEN OSCLI
"FX 108,0"
770PROCload`DISK(SOURCE%,ST%,data%+OSE
T%,&5000)
780IF BLOCKNO%=MAXBLOCKS%-2 AND MAXBLO
CKS%>1 THEN OSCLI"FX108,0"
790ENDPROC
800DEFPROCMOVEBLOCK`UP(BLOCKNO%)
810IF BLOCKNO%=MAXBLOCKS%-2 OR BLOCKNO
%=MAXBLOCKS%-1 THEN ENDPROC
820OSCLI"SRWRITE "+STR$÷(data%)+"+5000
"+STR$÷(BLOCKNO%*&5000)
830ENDPROC
840DEFPROCMOVEBLOCK`DOWN(BLOCKNO%)
850IF BLOCKNO%=MAXBLOCKS%-2 OR BLOCKNO
%=MAXBLOCKS%-1 THEN ENDPROC
860OSCLI"SRREAD "+STR$÷(data%)+"+5000
"+STR$÷(BLOCKNO%*&5000)
870ENDPROC
880DEFPROCWRITEBLOCK(ST%,BLOCKNO%)
890OSET%=0
900IF BLOCKNO%=MAXBLOCKS%-2 AND MAXBLO
CKS%>1 THEN OSCLI"FX 108,1":OSET%=&400
910IF BLOCKNO%=MAXBLOCKS%-1 THEN OSCLI
"FX 108,0"
920IF FAST THEN PROCFASTSAVE ELSE PROC
SLOWSAVE
930IF BLOCKNO%=MAXBLOCKS%-2 AND MAXBLO
CKS%>1 THEN OSCLI"FX 108,0"
940BLOCKDONE%=BLOCKDONE%+1
950PRINTTAB(0,10);SPC(30)
960PRINTTAB(0,10);"";BLOCKDONE%*20;" K
bytes saved"
970ENDPROC
980DEFPROCOSW`72(DR%,CMD%,START`TRACK%
,ADDRESS%,NO`OF`BYTES%):LOCALT%:RETRY%=F
ALSE
990?BLOCK%=0
1000!(BLOCK%+1)=ADDRESS%:BLOCK%?9=0:BLO
CK%?&A=0
1010BLOCK%!&B=NO`OF`BYTES%
1020BLOCK%?5=CMD%
1030T%=START`TRACK%
1040BLOCK%?8=T% MOD 256:T%=T% DIV 256
1050BLOCK%?7=T% MOD 256
1060BLOCK%?6=DR%*2^5+T% DIV 256
1070A%=&72:X%=BLOCK% MOD 256:Y%=BLOCK%
DIV 256:CALL&FFF1
1080SUCCESS%=?BLOCK%
1090IF SUCCESS%<>0 THEN HPOS%=POS:vpos%
=VPOS:PRINT TAB(11,18);CHR$(129);"Error
number ";SUCCESS%:PRINTTAB(HPOS%,vpos%);
1100ENDPROC
1110DEFPROCload`DISK(DR%,START`TRACK%,L
ORESS%,NO`OF`BYTES%)
1120CMD%=&08
1130PROCOSW`72(DR%,CMD%,START`TRACK%,LO
RESS%,NO`OF`BYTES%)
1140ENDPROC
1150DEFPROCsave`DISK(DR%,START`TRACK%,s
ave`ADDRESS%,NO`OF`BYTES%)
1160CMD%=&0A
1170PROCOSW`72(DR%,CMD%,START`TRACK%,sa
ve`ADDRESS%,NO`OF`BYTES%)
1180ENDPROC
1190DEFPROCSPACE
1200REPEAT UNTIL GET=32:CLS
1210ENDPROC
1220DEFFNCHECKFORMATTED(DRIVE%,T$)
1230PROCMOUNT(DRIVE%)
1240PROCload`DISK(DRIVE%,0,data%,&200)
1250SIZE%=(data%?252+data%?253*256+ dat
a%?254*256^3)/4
1260IF T$="S" THEN SOURCE`SIZE%=SIZE% E
LSE DEST`SIZE%=SIZE%
1270=SUCCESS%
1280DEFPROCRESTORE`RAMSTATUS
1290FORI%=4TO7
1300OSCLI"SRROM "+STR$(I%)
1310NEXT
1320ENDPROC
1330DEFPROCMOUNT(DR%)
1340OSCLI"MOUNT "+STR$(DR%)
1350ENDPROC
1360DEFPROCFASTSAVE
1370PROCsave`DISK(DEST%,ST%,data%+OSET%
,&5000)
1380ENDPROC
1390DEFPROCSLOWSAVE
1400FOR E%=0 TO 4
1410PROCsave`DISK(DEST%,ST%+E%*16,data%
+OSET%+E%*&1000,&1000)
1420NEXT
1430ENDPROC
1440IF ERL<>230 THEN REPORT:PRINT ERL:E
ND
1450RAM%?I%=FALSE
1460GOTO 320