Let RGBASM write JR offsets in floating sections

This requires some special-casing for `jr @` because the `jr` opcode has
already been emitted, but not the operand, so PC points to the middle.
Moved the RGBLINK test to RGBASM's folder, and created a new RGBLINK test.
This commit is contained in:
ISSOtm
2020-07-27 18:11:42 +02:00
parent b1adbcc77c
commit 762474d3ac
13 changed files with 47 additions and 25 deletions

7
test/asm/jr-@.asm Normal file
View File

@@ -0,0 +1,7 @@
SECTION "fixed", ROM0[0]
jr @
; We need this section to be floating because RGBASM can know the value of PC
; otherwise, leading to different behavior
; FIXME: we rely on this landing at address 2, which isn't *guaranteed*...
SECTION "floating", ROM0
jr @

0
test/asm/jr-@.err Normal file
View File

0
test/asm/jr-@.out Normal file
View File

1
test/asm/jr-@.out.bin Normal file
View File

@@ -0,0 +1 @@
<18><18>

5
test/asm/jr-section.asm Normal file
View File

@@ -0,0 +1,5 @@
SECTION "Test", ROM0
Label:
jr Label
PRINTV Label - @

0
test/asm/jr-section.err Normal file
View File

1
test/asm/jr-section.out Normal file
View File

@@ -0,0 +1 @@
$FFFFFFFE

View File

@@ -0,0 +1 @@
<18>

View File

@@ -1,7 +1,3 @@
SECTION "fixed", ROM0[0]
jr @
; We need this section to be floating because RGBASM can know the value of PC
; otherwise, leading to different behavior
; FIXME: we rely on this landing at address 2, which isn't *guaranteed*...
SECTION "floating", ROM0
jr @
SECTION "Floating", ROM0
; RGBASM knows how to compute `jr @` by itself, but this will evade it
jr @ - 1 + 1

View File

@@ -1 +1 @@
<18><18>
<18>