1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-10-27 07:29:00 +00:00
6502bench/SourceGen/SGTestData/Source/20212-reloc-data-main.S
Andy McFadden 4e70edc90c Add 20212-reloc-data test
This test exercises the relocation data feature.  The test file is
generated from a multi-segment OMF file that was hex-edited to have
specific attributes (see 20212-reloc-data-lnk.S for instructions).
The test also serves as a way to exercise the OMF converter.

Also, implement the Bank Relative flag.
2020-07-05 17:17:44 -07:00

81 lines
1.8 KiB
ArmAsm

; Copyright 2020 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Assembler: Merlin 32
;
; Segment #1 : code; main segment, loads anywhere
BANK2_START EXT
BANK2_MOV_DST EXT
BANK8_START EXT
BANK8_ADDR EXT
BANK8_MOV_SRC EXT
ADDR_FFE0 EXT
REL ;generate relocatable code
start
clc
xce
sep #$30
mx %11
ldal start
nop
jsl BANK2_START
jsl BANK8_START
ldal BANK2_START
lda BANK2_START
lda #<BANK2_START
lda #>BANK2_START
lda #^BANK2_START
ldal BANK8_ADDR
lda BANK8_ADDR
lda #<BANK8_ADDR
lda #>BANK8_ADDR
lda #^BANK8_ADDR
nop
; Do some stuff with 16-bit registers. Merlin 32 treats <>^ as shift
; operations rather than byte selectors.
rep #$30
mx %00
lda #<BANK8_ADDR
lda #>BANK8_ADDR
lda #^BANK8_ADDR
nop
; Check MVN/MVP. Handing them correctly requires having two different
; symbol refs on a single instruction.
lda #15
ldx #BANK8_MOV_SRC
ldy #BANK2_MOV_DST
mvn #^BANK8_MOV_SRC,#^BANK2_MOV_DST
nop
check_pea
pea $0000
pea $f000
pea BANK8_ADDR
pea ^BANK8_ADDR
pea check_pea
pea >check_pea
pea ^check_pea
pea check_pea+18
pea check_pea+$1000
nop
jmp :skipdata
; Generate 2/3/4-byte refs. The OMF reloc entry generated by Merlin32
; for ADRL is only 3 bytes wide.
dw ADDR_FFE0
adr ADDR_FFE0
adrl ADDR_FFE0
:skipdata
rts