10
20
30 :
40 INPUT "Number of ROMs to merge: "num%
50 DIM in$(num%-1),in%(num%-1)
60 FOR rom%=0 TO num%-1
70 PRINT "ROM ";rom%;": ";:INPUT ""in$(rom%)
80 NEXT
90 INPUT "Save ROM: "out$
100 ON ERROR REPORT:PROCclose:PRINT " at line ";ERL:END
110 rom%=-1:REPEAT:rom%=rom%+1
120 in%=OPENINin$(rom%):in%(rom%)=in%
130 UNTIL rom%=num%-1 OR in%=0
140 IF in%=0:PRINT"File '"in$(rom%)"' not found":PROCclose:END
150 size%=num%*EXT#in%(0):DIM mem% size%-1
160 FOR A%=0 TO size%-1 STEP num%
170 FOR rom%=0 TO num%-1
180 mem%?(A%+rom%)=BGET#in%(rom%)
190 NEXT:NEXT
200 PROCclose
210 OSCLI"Save "+out$+" "+STR$~mem%+"+"+STR$~size%+" 0 0"
220 END
230 DEFPROCclose
240 FOR rom%=num%-1 TO 0 STEP -1
250 IF A%=in%(rom%):IF A%:in%(rom%)=0:CLOSE#A%
260 NEXT:ENDPROC