8-Bit Software Online Conversion

Merge Program - Listing

5MODE7 10REM Program MERGE 20REM by D. Ambrose 100 110T%=TOP:B%=T%:LOMEM=&5000 120DIM P$(16) 130CLS:VDU15 135PRINT"Press any key when the progra m/disc drive stops" 140PRINT "PROCovly appended by PROCjoi n" 150PROCjoin("OVLY"):T%=TOP:C%=T% 155A=GET 160PRINT "DATA blocks D1-D4 appended b y PROCjoin":PRINT 170FOR J%=1 TO 4 180f$="D"+STR$(J%):PROCjoin(f$):T%=TOP 190NEXT 200FOR I%=1 TO 16:READ P$(I%):NEXT 210FOR I%=1 TO 13 STEP 4:PRINTTAB(4) P $(I%):NEXT 220PRINT 225A=GET 230PRINT "Clear memory, and start agai n with PROCovly":PRINT 240FOR I%=C% TO T%:?I%=0:NEXT 250T%=C% 260FOR J%=1 TO 4 270f$="D"+STR$(J%):PROCovly(f$):T%=FNe nd+1 280NEXT 290RESTORE:FOR I%=1 TO 16:READ P$(I%): NEXT 300FOR I%=2 TO 14 STEP 4:PRINTTAB(4) P $(I%):NEXT 310PRINT 315A=GET 320PRINT "LOAD and READ DATA blocks on e after the other" 330PRINT "first with PROCjoin":PRINT 340FOR J%=1 TO 4 350f$="D"+STR$(J%):T%=C%:PROCjoin(f$) 360RESTORE:FOR I%=1 TO 4:READ P$(I%):N EXT:PRINTTAB(4) P$(3) 370NEXT:PRINT 380A=GET 390PRINT "and now with PROCovly":PRINT 400FOR J%=1 TO 4 410f$="D"+STR$(J%):PROCovly(f$) 420RESTORE:FOR I%=1 TO 4:READ P$(I%):N EXT:PRINTTAB(4) P$(4) 430NEXT 435A=GET 440PRINT:PRINT "Program ends at origin al length" 450?(B%-1)=&FF 460VDU14:END 470 1000DEF PROCjoin(f$):LOCAL N%,X%,Y% 1010DIM N% 9,ctrlblk% 17 1020$N%=f$+CHR$&0D 1030REM Put address of file in ctrlblk 1040?ctrlblk%=N%MOD&100:?(ctrlblk%+1)=N %DIV&100 1050A%=&FF:REM A%=&FF to LOAD, A%=0 to SAVE 1060REM Put address of ctrlblk in X and Y registers 1070X%=ctrlblk%MOD&100:Y%=ctrlblk%DIV&1 00 1080REM If ctrlblk%+6=0 file is LOADed at address in ctrlblk%+2 1090?(ctrlblk%+6)=0 1100!(ctrlblk%+2)=&0000+T%-2 1110CALL &FFDD 1120REM RESET TOP 1130?&12=(T%+ctrlblk%!&0A-2)MOD&100 1140?&13=(T%+ctrlblk%!&0A-2)DIV&100 1150ENDPROC 1160 1170DEF FNN="MERGE"