8-Bit Software Online Conversion
:0.S.Merge - Listing
10REM MERGE utility V.2.1
20REM by M.Bobrowski 4'90
30:
40fptr=&A8:osfblock=&2EE:ptr=&70:line
no=&72
50osargs=&FFDA:osfile=&FFDD:osword=&F
FF1:osbyte=&FFF4
60:
70FOR pass=0 TO 3 STEP 3
80P%=&900
90[OPT pass
100.read`filename
110LDA #1:LDX #fptr:LDY #0:JSR osargs
120LDA #5:LDX #fptr:LDY #0:JSR osword
130LDA fptr+4:CMP #13:BNE set`params
140BRK:EQUB 128:EQUS "Syntax: *APPEND
<fsp>":BRK
150:
160.set`params
170LDY #&12:LDA #0
180.zeroloop
190STA osfblock-1,Y
200DEY:BNE zeroloop
210LDA fptr:STA osfblock:LDA fptr+1:ST
A osfblock+1
220½calculate TOP-2 address and use it
as load address
230SEC:LDA &12:SBC #2:STA osfblock+2
240LDA &13:SBC #0:STA osfblock+3
250:
260½load file using OSFILE with A=&FF
270LDA #&FF:LDX #&EE:LDY #&02:JSR osfi
le
280:
290½perform RENUMBER instruction and s
et new TOP value
300LDA &18:STA ptr+1:LDA #0:STA ptr:ST
A lineno:STA lineno+1
310.renloop
320LDY #1:LDA (ptr),Y:CMP #&FF:BEQ set
top
330CLC:LDA lineno:ADC #10:STA lineno
340LDA lineno+1:ADC #0:STA lineno+1
350STA (ptr),Y:INY:LDA lineno:STA (ptr
),Y:INY
360CLC:LDA ptr:ADC (ptr),Y:STA ptr
370LDA ptr+1:ADC #0:STA ptr+1
380JMP renloop
390.settop
400CLC:LDA ptr:ADC #&02:STA &12:STA &0
0
410LDA ptr+1:ADC #0:STA &13:STA &01
420RTS
430]:NEXT
440:
450PRINT'"To save object code press CO
PY";:REPEAT UNTIL INKEY-106:PRINT
460OSCLI"SAVE MERGE 900 "+STR$÷P%
470END