1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-13 14:29:23 +00:00
6502bench/SourceGen/SGTestData/Source/20060-target-adjustment.S
Andy McFadden b7d3e3cfdf Refactor 2006x-target-adjustment
Split into 6502/65816 portions.  The 6502 version is the original
with a few in-place substitutions (e.g. JMP for BRL).  The 65816
version is only needed to exercise special handling of PEA/PER.
2020-10-19 15:46:05 -07:00

108 lines
3.1 KiB
ArmAsm

; Copyright 2018 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Assembler: Merlin 32
org $1000
load11 lda #$11 ;EDIT: set label=load11
load22 ldx #$22
load33 ldy #$33 ;EDIT: set label=load33
load44 lda #$44
predat bne skipdat ;EDIT: set label=predat
dat0 dw $0123
dat1 dw $4567 ;EDIT: set label=dat1
dat2 dw $89ab
dat3 dw $cdef
dat4 dw $0011
dat5 dw $2233
dfb $80
asc 'The quick brown fox'
dfb $80
dw skipdat ;EDIT: format these as addresses
dw skipdat-1
dw skipdat+1
fill0 ds 4 ;EDIT: set label=fill0
fill1 ds 4
fill2 ds 4
fill3 ds 4
postfill dfb $80
skipdat ;EDIT: set label=skipdat
lda dat0 ;this should get mapped to predat+2
lda postfill
asl dat1 ;these should coalesce to dat1
rol dat2
ror dat3 ;these should be auto-labeled
and dat4
ora dat5
lda fill0 ;EDIT: set all labels to fill0
sta fill1 ; and confirm that auto-labels vanish
lda fill2 ; and we get a single 16-byte .fill
sta fill3
jsr load22 ;should get auto label
lda load44 ;should get auto label
; PEA/PER may want to push addr-1; make sure that works
; (note: 65816-specific code replaced, PEA/PER now BIT/ORA)
caddr
bit caddr-1 ;should base off caddr
ora caddr-1 ;should base off caddr
lda caddr+1 ;should base off caddr
lda caddr+2 ;should base off caddr
; self-referential, self-modifying code (edge case for xrefs)
lda #$ea
srop1 sta srop1
srop2 sta srop2+1
srop3 sta srop3+2 ;EDIT: set operand to non-existent symbol
jmp skipdat1
dfb $80
dat81 dfb $81 ;EDIT: set label dat81
org $2000
dat82 dfb $82
dfb $83
skipdat1
nop
nop
lda dat81
lda dat82 ;this should NOT use dat81
;
; Test the precise extent to which we associate a label with nearby elements.
;
jmp skipmore
dfb $7c
dfb $7d
dfb $7e
dfb $7f
nearby dfb $80 ;EDIT: label this
dfb $81
dfb $82
dfb $83
dfb $84
dfb $85
dfb $86
skipmore
lda nearby-4
lda nearby-3
lda nearby-2
lda nearby-1
lda nearby
lda nearby+1
lda nearby+2
lda nearby+3
lda nearby+4
lda nearby+5
lda nearby+6
rts