Implement ISCONST, reporting compile-time constness

This commit is contained in:
ISSOtm
2020-03-08 16:52:54 +01:00
parent 55b911654c
commit 8fcdcb1731
8 changed files with 64 additions and 1 deletions

29
test/asm/isconst.asm Normal file
View File

@@ -0,0 +1,29 @@
TEST_NUM = 0
test_expr: MACRO
TEST_NUM = TEST_NUM + 1
IS_CONST = ISCONST(\1)
PRINTT "Test #{d:TEST_NUM}: ISCONST reports {IS_CONST}\n"
IF (\1) || 1 ; Only test if the expression can be evaluated
WARN "Test #{d:TEST_NUM}: Compile-time constant"
ENDC
ENDM
test_expr 1
test_expr UnknownLabel
SECTION "fixed", WRAM0[$CAFE]
FixedLabel:
ds 42
test_expr FixedLabel
test_expr @ - FixedLabel
SECTION "floating", WRAMX
FloatingLabel:
ds 69
test_expr FloatingLabel
test_expr @ - FloatingLabel