mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 18:52:07 +00:00
Add link-time RST instruction
This allows using a label as the argument to a `rst` instruction Fixes rednex#448
This commit is contained in:
3
test/link/rst-bad.asm
Normal file
3
test/link/rst-bad.asm
Normal file
@@ -0,0 +1,3 @@
|
||||
SECTION "bad", ROM0[0]
|
||||
rst bad
|
||||
bad: ; This is not at a RST vector!
|
||||
1
test/link/rst-bad.out
Normal file
1
test/link/rst-bad.out
Normal file
@@ -0,0 +1 @@
|
||||
error: rst-bad.asm(2): Value 1 is not a RST vector
|
||||
31
test/link/rst.asm
Normal file
31
test/link/rst.asm
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
SECTION "calls", ROM0[0]
|
||||
|
||||
; The values are not known at this point, forcing the assembler to emit an
|
||||
; expression
|
||||
rst rst00
|
||||
rst rst08
|
||||
rst rst10
|
||||
rst rst18
|
||||
rst rst20
|
||||
rst rst28
|
||||
rst rst30
|
||||
rst rst38
|
||||
|
||||
|
||||
defRST: MACRO
|
||||
; FIXME: This is required, otherwise the lexer does not paste the two tokens
|
||||
ADDR equs "$\1"
|
||||
SECTION "rst\1", ROM0[ADDR]
|
||||
|
||||
rst\1:
|
||||
PURGE ADDR
|
||||
ENDM
|
||||
defRST 00
|
||||
defRST 08
|
||||
defRST 10
|
||||
defRST 18
|
||||
defRST 20
|
||||
defRST 28
|
||||
defRST 30
|
||||
defRST 38
|
||||
0
test/link/rst.out
Normal file
0
test/link/rst.out
Normal file
1
test/link/rst.out.bin
Normal file
1
test/link/rst.out.bin
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Reference in New Issue
Block a user