1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-14 05:28:55 +00:00
6502bench/SourceGen/SGTestData/Expected/2008-address-changes_acme.S
Andy McFadden 4981c3cdbb Fix ACME code gen "overflow"
ACME has a "real" PC and a "pseudo" PC.  The "real" PC determines the
initial position in a 64KB buffer used to hold assembler output.  If
the amount of code generated runs off the end, the assembler fails
with "produced too much code".

The source code generator in SourceGen was outputting a "real" PC
for the first address range and "psuedo" PCs for any address ranges
that followed.  This produced nice results for code with a single
range, but caused problems for multi-range sources if the initial
range was high in memory and a later range was lower in memory.
While the assembler isn't actually generating more than 64KB of code,
ACME's buffer management was detecting an overflow.

Now, if a source file has multiple address ranges, we set the "real"
PC to $0000 and use a "pseudo" PC for all ranges.  Output for projects
with a single address range is unmodified.
2020-05-14 16:37:33 -07:00

126 lines
2.4 KiB
ArmAsm

!cpu 65816
* = $0000
!pseudopc $1000 {
!as
!rs
clc
xce
sep #$ff
jsr L1100
jsr L1107
jmp L2000
} ;!pseudopc
!pseudopc $1100 {
L1100 bit L1100
L1103 lda #$11
ldx #$11
L1107 ldy #$11
per L1103
bra L1103
} ;!pseudopc
!pseudopc $1100 {
@L1100_0 bit @L1100_0
lda #$22
@L1105 ldx #$22
ldy #$22
per @L1105
jmp @L1105
} ;!pseudopc
!pseudopc $1100 {
@L1100_1 bit @L1100_1
lda #$33
ldx #$33
@L1107_0 ldy #$33
per @L1107_0
bra @L1107_0
} ;!pseudopc
!pseudopc $2000 {
L2000 bit L2000
beq $2018
bra @L2020
} ;!pseudopc
!pseudopc $2020 {
@L2020 bit @L2020
beq $2029
brl @L2080
@offend nop
} ;!pseudopc
!pseudopc $2080 {
@L2080 bit @L2080
lda @offend
jsr @offend
lda $2029
jsr $2029
lda @L2080-1
jsr @L2080-1
lda @L2080
jsr @L2080
lda $00
beq @L2100
!byte $ad
} ;!pseudopc
!pseudopc $2100 {
@L2100 nop
nop
jmp @L3000
} ;!pseudopc
!pseudopc $2800 {
!byte $00
!byte $28
!fill 14,$00
} ;!pseudopc
!pseudopc $2820 {
!fill 18,$00
} ;!pseudopc
!pseudopc $3000 {
@L3000 bit @L3000
lda #$44
ldx #$44
ldy #$44
brl @fwd
@ulabel !byte $00
!byte $01
} ;!pseudopc
!pseudopc $3100 {
!byte $02
@fwd bit @fwd
lda @ulabel
lda @ulabel+1
lda $300e
lda $300f
lda @fwd-1
beq @L3182
!byte $ea
!byte $ea
} ;!pseudopc
!pseudopc $3180 {
!byte $00
!byte $01
@L3182 bit @L3182
lda @label1
lda @label1+1
lda @label1+112
bra @L3200
@label1 !byte $ea
!byte $ea
} ;!pseudopc
!pseudopc $3200 {
@L3200 bit @L3200
!byte $00
!byte $01
} ;!pseudopc