mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Allow negative values to count macro arguments from the end (#1670)
This commit is contained in:
21
test/asm/negative-macro-args.asm
Normal file
21
test/asm/negative-macro-args.asm
Normal file
@@ -0,0 +1,21 @@
|
||||
MACRO mac
|
||||
for i, -1, -_NARG - 1, -1
|
||||
println "{d:i}: \<i> == \<{d:i}>"
|
||||
endr
|
||||
; error cases
|
||||
def i = 0
|
||||
println "{d:i}: \<i> == \<{d:i}>"
|
||||
def i = -_NARG - 1
|
||||
println "{d:i}: \<i> == \<{d:i}>"
|
||||
def i = $7fff_ffff
|
||||
println "{d:i}: \<i> == \<{d:i}>"
|
||||
; signed/unsigned difference error cases
|
||||
def i = $8000_0000
|
||||
println "{d:i}: \<i> == \<{d:i}>"
|
||||
println "{u:i}: \<i> == \<{u:i}>"
|
||||
def i = $ffff_ffff
|
||||
println "{d:i}: \<i> == \<{d:i}>"
|
||||
println "{u:i}: \<i> == \<{u:i}>"
|
||||
ENDM
|
||||
|
||||
mac A, B, C, D, E, F, G
|
||||
26
test/asm/negative-macro-args.err
Normal file
26
test/asm/negative-macro-args.err
Normal file
@@ -0,0 +1,26 @@
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(7):
|
||||
Invalid bracketed macro argument '\<0>'
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(7):
|
||||
Invalid bracketed macro argument '\<0>'
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(9):
|
||||
Macro argument '\<-8>' not defined
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(9):
|
||||
Macro argument '\<-8>' not defined
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(11):
|
||||
Macro argument '\<2147483647>' not defined
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(11):
|
||||
Macro argument '\<2147483647>' not defined
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(14):
|
||||
Macro argument '\<-2147483648>' not defined
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(14):
|
||||
Number in bracketed macro argument is too large
|
||||
while expanding symbol "-2147483648"
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(15):
|
||||
Macro argument '\<-2147483648>' not defined
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(15):
|
||||
Number in bracketed macro argument is too large
|
||||
while expanding symbol "2147483648"
|
||||
error: negative-macro-args.asm(21) -> negative-macro-args.asm::mac(18):
|
||||
Number in bracketed macro argument is too large
|
||||
while expanding symbol "4294967295"
|
||||
error: Assembly aborted (11 errors)!
|
||||
14
test/asm/negative-macro-args.out
Normal file
14
test/asm/negative-macro-args.out
Normal file
@@ -0,0 +1,14 @@
|
||||
-1: G == G
|
||||
-2: F == F
|
||||
-3: E == E
|
||||
-4: D == D
|
||||
-5: C == C
|
||||
-6: B == B
|
||||
-7: A == A
|
||||
0: ==
|
||||
-8: ==
|
||||
2147483647: ==
|
||||
-2147483648: == >
|
||||
2147483648: == >
|
||||
-1: G == G
|
||||
4294967295: G == >
|
||||
Reference in New Issue
Block a user