mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Allow binary AND to be sometimes constant (#976)
This commit is contained in:
17
test/asm/const-and.asm
Normal file
17
test/asm/const-and.asm
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
println @ & 0 ; This should produce an error, but not crash
|
||||
|
||||
SECTION "Test", ROM0,ALIGN[4,2]
|
||||
|
||||
ds 40
|
||||
Aligned:
|
||||
|
||||
println Aligned & $0f
|
||||
println ~$fffc & Aligned
|
||||
println Aligned & $1f ; Not constant
|
||||
println @ & $0f
|
||||
|
||||
SECTION "Unaligned", ROM0
|
||||
|
||||
println @ & 0
|
||||
println @ & 1 ; Nope
|
||||
7
test/asm/const-and.err
Normal file
7
test/asm/const-and.err
Normal file
@@ -0,0 +1,7 @@
|
||||
error: const-and.asm(2):
|
||||
PC has no value outside a section
|
||||
error: const-and.asm(11):
|
||||
Expected constant expression: 'Aligned' is not constant at assembly time
|
||||
error: const-and.asm(17):
|
||||
Expected constant expression: PC is not constant at assembly time
|
||||
error: Assembly aborted (3 errors)!
|
||||
7
test/asm/const-and.out
Normal file
7
test/asm/const-and.out
Normal file
@@ -0,0 +1,7 @@
|
||||
$0
|
||||
$A
|
||||
$A
|
||||
$0
|
||||
$A
|
||||
$0
|
||||
$0
|
||||
@@ -1,11 +1,9 @@
|
||||
|
||||
SECTION "test", ROM0
|
||||
|
||||
ds 123
|
||||
|
||||
FloatingBase:
|
||||
assert WARN, FloatingBase & 0, "Worry about me, but not too much."
|
||||
assert FAIL, FloatingBase & 0, "Okay, this is getting serious!"
|
||||
assert FATAL, FloatingBase & 0, "It all ends now."
|
||||
assert FAIL, FloatingBase & 0, "Not even time to roll credits!"
|
||||
assert WARN, FloatingBase, "Worry about me, but not too much."
|
||||
assert FAIL, FloatingBase, "Okay, this is getting serious!"
|
||||
assert FATAL, FloatingBase, "It all ends now."
|
||||
assert FAIL, FloatingBase, "Not even time to roll credits!"
|
||||
assert WARN, 0, "Still can finish the film, though!"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
warning: assert.asm(7): Worry about me, but not too much.
|
||||
error: assert.asm(8): Okay, this is getting serious!
|
||||
FATAL: assert.asm(9): It all ends now.
|
||||
warning: assert.asm(5): Worry about me, but not too much.
|
||||
error: assert.asm(6): Okay, this is getting serious!
|
||||
FATAL: assert.asm(7): It all ends now.
|
||||
Linking aborted after 2 errors
|
||||
|
||||
Reference in New Issue
Block a user