Use ? to silence nodes in warning/error location backtraces

This commit is contained in:
Rangi 2025-11-13 15:10:28 -05:00
parent c01ec87032
commit 26e6c465df
7 changed files with 50 additions and 50 deletions

View File

@ -1,6 +1,6 @@
; Macros to verify assumptions about the data or code
MACRO table_width
MACRO? table_width
DEF CURRENT_TABLE_WIDTH = \1
if _NARG == 2
REDEF CURRENT_TABLE_START EQUS "\2"
@ -10,13 +10,13 @@ MACRO table_width
endc
ENDM
MACRO assert_table_length
MACRO? assert_table_length
DEF x = \1
assert x * CURRENT_TABLE_WIDTH == @ - {CURRENT_TABLE_START}, \
"{CURRENT_TABLE_START}: expected {d:x} entries, each {d:CURRENT_TABLE_WIDTH} bytes"
ENDM
MACRO list_start
MACRO? list_start
DEF list_index = 0
if _NARG == 1
REDEF CURRENT_LIST_START EQUS "\1"
@ -26,19 +26,19 @@ MACRO list_start
endc
ENDM
MACRO li
MACRO? li
assert STRFIND(\1, "@") == -1, "String terminator \"@\" in list entry: \1"
db \1, "@"
DEF list_index += 1
ENDM
MACRO assert_list_length
MACRO? assert_list_length
DEF x = \1
assert x == list_index, \
"{CURRENT_LIST_START}: expected {d:x} entries, got {d:list_index}"
ENDM
MACRO def_grass_wildmons
MACRO? def_grass_wildmons
;\1: map id
REDEF CURRENT_GRASS_WILDMONS_MAP EQUS "\1"
REDEF CURRENT_GRASS_WILDMONS_LABEL EQUS "._def_grass_wildmons_\1"
@ -46,12 +46,12 @@ MACRO def_grass_wildmons
map_id \1
ENDM
MACRO end_grass_wildmons
MACRO? end_grass_wildmons
assert GRASS_WILDDATA_LENGTH == @ - {CURRENT_GRASS_WILDMONS_LABEL}, \
"def_grass_wildmons {CURRENT_GRASS_WILDMONS_MAP}: expected {d:GRASS_WILDDATA_LENGTH} bytes"
ENDM
MACRO def_water_wildmons
MACRO? def_water_wildmons
;\1: map id
REDEF CURRENT_WATER_WILDMONS_MAP EQUS "\1"
REDEF CURRENT_WATER_WILDMONS_LABEL EQUS "._def_water_wildmons_\1"
@ -59,7 +59,7 @@ MACRO def_water_wildmons
map_id \1
ENDM
MACRO end_water_wildmons
MACRO? end_water_wildmons
assert WATER_WILDDATA_LENGTH == @ - {CURRENT_WATER_WILDMONS_LABEL}, \
"def_water_wildmons {CURRENT_WATER_WILDMONS_MAP}: expected {d:WATER_WILDDATA_LENGTH} bytes"
ENDM

View File

@ -1,14 +1,14 @@
; Syntactic sugar macros
MACRO lb ; r, hi, lo
MACRO? lb ; r, hi, lo
ld \1, (((\2) & $ff) << 8) | (((\3) & $ff))
ENDM
MACRO ln ; r, hi, lo
MACRO? ln ; r, hi, lo
ld \1, (((\2) & $f) << 4) | (((\3) & $f))
ENDM
MACRO ldpixel
MACRO? ldpixel
if _NARG >= 5
lb \1, \2 * 8 + \4, \3 * 8 + \5
else

View File

@ -1,6 +1,6 @@
; Enumerate constants
MACRO const_def
MACRO? const_def
if _NARG >= 1
DEF const_value = \1
else
@ -13,17 +13,17 @@ MACRO const_def
endc
ENDM
MACRO const
MACRO? const
DEF \1 EQU const_value
DEF const_value += const_inc
ENDM
MACRO shift_const
MACRO? shift_const
DEF \1 EQU (1 << const_value)
const \1_F
ENDM
MACRO const_skip
MACRO? const_skip
if _NARG >= 1
DEF const_value += const_inc * (\1)
else
@ -31,7 +31,7 @@ MACRO const_skip
endc
ENDM
MACRO const_next
MACRO? const_next
if (const_value > 0 && \1 < const_value) || (const_value < 0 && \1 > const_value)
fail "const_next cannot go backwards from {const_value} to \1"
else
@ -39,7 +39,7 @@ MACRO const_next
endc
ENDM
MACRO rb_skip
MACRO? rb_skip
if _NARG == 1
rsset _RS + \1
else

View File

@ -2,7 +2,7 @@ DEF hlcoord EQUS "coord hl,"
DEF bccoord EQUS "coord bc,"
DEF decoord EQUS "coord de,"
MACRO coord
MACRO? coord
; register, x, y[, origin]
if _NARG < 4
ld \1, (\3) * SCREEN_WIDTH + (\2) + wTileMap
@ -15,7 +15,7 @@ DEF hlbgcoord EQUS "bgcoord hl,"
DEF bcbgcoord EQUS "bgcoord bc,"
DEF debgcoord EQUS "bgcoord de,"
MACRO bgcoord
MACRO? bgcoord
; register, x, y[, origin]
if _NARG < 4
ld \1, (\3) * BG_MAP_WIDTH + (\2) + vBGMap0
@ -24,7 +24,7 @@ MACRO bgcoord
endc
ENDM
MACRO dwcoord
MACRO? dwcoord
; x, y
rept _NARG / 2
dw (\2) * SCREEN_WIDTH + (\1) + wTileMap
@ -33,7 +33,7 @@ rept _NARG / 2
endr
ENDM
MACRO ldcoord_a
MACRO? ldcoord_a
; x, y[, origin]
if _NARG < 3
ld [(\2) * SCREEN_WIDTH + (\1) + wTileMap], a
@ -42,7 +42,7 @@ MACRO ldcoord_a
endc
ENDM
MACRO ldbgcoord_a
MACRO? ldbgcoord_a
; x, y[, origin]
if _NARG < 3
ld [(\2) * BG_MAP_WIDTH + (\1) + vBGMap0], a
@ -51,7 +51,7 @@ MACRO ldbgcoord_a
endc
ENDM
MACRO lda_coord
MACRO? lda_coord
; x, y[, origin]
if _NARG < 3
ld a, [(\2) * SCREEN_WIDTH + (\1) + wTileMap]
@ -60,7 +60,7 @@ MACRO lda_coord
endc
ENDM
MACRO lda_bgcoord
MACRO? lda_bgcoord
; x, y[, origin]
if _NARG < 3
ld a, [(\2) * BG_MAP_WIDTH + (\1) + vBGMap0]

View File

@ -5,39 +5,39 @@ DEF percent EQUS "* $ff / 100"
; Constant data (db, dw, dl) macros
MACRO dwb
MACRO? dwb
dw \1
db \2
ENDM
MACRO dbw
MACRO? dbw
db \1
dw \2
ENDM
MACRO dbbw
MACRO? dbbw
db \1, \2
dw \3
ENDM
MACRO dbww
MACRO? dbww
db \1
dw \2, \3
ENDM
MACRO dbwww
MACRO? dbwww
db \1
dw \2, \3, \4
ENDM
MACRO dn ; nybbles
MACRO? dn ; nybbles
rept _NARG / 2
db ((\1) << 4) | (\2)
shift 2
endr
ENDM
MACRO nybble_array
MACRO? nybble_array
DEF CURRENT_NYBBLE_ARRAY_VALUE = 0
DEF CURRENT_NYBBLE_ARRAY_LENGTH = 0
IF _NARG == 1
@ -48,7 +48,7 @@ MACRO nybble_array
ENDC
ENDM
MACRO nybble ; For vertical lists of nybbles
MACRO? nybble ; For vertical lists of nybbles
ASSERT 0 <= (\1) && (\1) < $10, "nybbles must be 0-15"
DEF CURRENT_NYBBLE_ARRAY_VALUE = (\1) | (CURRENT_NYBBLE_ARRAY_VALUE << 4)
DEF CURRENT_NYBBLE_ARRAY_LENGTH += 1
@ -58,7 +58,7 @@ MACRO nybble ; For vertical lists of nybbles
ENDC
ENDM
MACRO end_nybble_array
MACRO? end_nybble_array
IF CURRENT_NYBBLE_ARRAY_LENGTH % 2
db CURRENT_NYBBLE_ARRAY_VALUE << 4
ENDC
@ -72,14 +72,14 @@ MACRO end_nybble_array
ENDC
ENDM
MACRO dc ; "crumbs"
MACRO? dc ; "crumbs"
rept _NARG / 4
db ((\1) << 6) | ((\2) << 4) | ((\3) << 2) | (\4)
shift 4
endr
ENDM
MACRO dx
MACRO? dx
DEF x = 8 * ((\1) - 1)
rept \1
db LOW((\2) >> x)
@ -87,39 +87,39 @@ DEF x = x - 8
endr
ENDM
MACRO dt ; three-byte (big-endian)
MACRO? dt ; three-byte (big-endian)
dx 3, \1
ENDM
MACRO dd ; four-byte (big-endian)
MACRO? dd ; four-byte (big-endian)
dx 4, \1
ENDM
MACRO bigdw ; big-endian word
MACRO? bigdw ; big-endian word
dx 2, \1
ENDM
MACRO dba ; dbw bank, address
MACRO? dba ; dbw bank, address
rept _NARG
dbw BANK(\1), \1
shift
endr
ENDM
MACRO dab ; dwb address, bank
MACRO? dab ; dwb address, bank
rept _NARG
dwb \1, BANK(\1)
shift
endr
ENDM
MACRO dba_pic ; dbw bank, address
MACRO? dba_pic ; dbw bank, address
db BANK(\1) - PICS_FIX
dw \1
ENDM
MACRO dbpixel
MACRO? dbpixel
if _NARG >= 4
; x tile, x pxl, y tile, y pxl
db \1 * 8 + \3, \2 * 8 + \4
@ -129,20 +129,20 @@ else
endc
ENDM
MACRO dsprite
MACRO? dsprite
; y tile, y pxl, x tile, x pxl, vtile offset, flags, attributes
db LOW(\1 * 8) + \2, LOW(\3 * 8) + \4, \5, \6
ENDM
MACRO menu_coords
MACRO? menu_coords
; x1, y1, x2, y2
db \2, \1 ; start coords
db \4, \3 ; end coords
ENDM
MACRO bcd
MACRO? bcd
rept _NARG
dn LOW(\1) / 10, (\1) % 10
shift
@ -150,7 +150,7 @@ endr
ENDM
MACRO sine_table
MACRO? sine_table
; \1 samples of sin(x) from x=0 to x<32768 (pi radians)
DEF x = 0
rept \1

View File

@ -1,4 +1,4 @@
MACRO RGB
MACRO? RGB
rept _NARG / 3
dw palred (\1) + palgreen (\2) + palblue (\3)
shift 3
@ -16,7 +16,7 @@ DEF color EQUS "+ PAL_COLOR_SIZE *"
DEF tiles EQUS "* LEN_2BPP_TILE"
DEF tile EQUS "+ LEN_2BPP_TILE *"
MACRO dbsprite
MACRO? dbsprite
; x tile, y tile, x pixel, y pixel, vtile offset, attributes
db (\2 * TILE_WIDTH) % $100 + \4, (\1 * TILE_WIDTH) % $100 + \3, \5, \6
ENDM

View File

@ -1,4 +1,4 @@
MACRO flag_array
MACRO? flag_array
ds ((\1) + 7) / 8
ENDM