aboutsummaryrefslogtreecommitdiffstats
path: root/macros/asserts.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2026-01-17 22:38:33 -0600
committerdannye <33dannye@gmail.com>2026-01-17 22:38:33 -0600
commitbc2354dd6626ce28bb9561547ed2107cfa56c18e (patch)
tree5902d4c3389253c76b7c3351e0d7dfecb551c28d /macros/asserts.asm
parentIdentify characters in `_OakSpeechText2B` and `Printer_GetMonStats.IDNo` (#144) (diff)
parentUse macros for `WildMonEncounterSlotChances` (#562) (diff)
downloadpokeyellow-bc2354dd6626ce28bb9561547ed2107cfa56c18e.tar.gz
pokeyellow-bc2354dd6626ce28bb9561547ed2107cfa56c18e.tar.xz
pokeyellow-bc2354dd6626ce28bb9561547ed2107cfa56c18e.zip
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'macros/asserts.asm')
-rw-r--r--macros/asserts.asm18
1 files changed, 14 insertions, 4 deletions
diff --git a/macros/asserts.asm b/macros/asserts.asm
index e2de1505..11e0ee99 100644
--- a/macros/asserts.asm
+++ b/macros/asserts.asm
@@ -4,8 +4,8 @@ MACRO? _redef_current_label
IF DEF(\1)
PURGE \1
ENDC
- IF _NARG == 3 + (\3)
- DEF \1 EQUS "\<_NARG>"
+ IF _NARG > 2
+ DEF \1 EQUS "\3"
ELIF STRLEN(#__SCOPE__)
IF {{__SCOPE__}} - @ == 0
DEF \1 EQUS #{__SCOPE__}
@@ -19,7 +19,8 @@ ENDM
MACRO? table_width
DEF CURRENT_TABLE_WIDTH = \1
- _redef_current_label CURRENT_TABLE_START, "._table_width\@", 2, \#
+ SHIFT
+ _redef_current_label CURRENT_TABLE_START, "._table_width\@", \#
ENDM
MACRO? assert_table_length
@@ -40,11 +41,20 @@ ENDM
MACRO? list_start
DEF list_index = 0
- _redef_current_label CURRENT_LIST_START, "._list_start\@", 1, \#
+ DEF list_item_length = 0
+ IF _NARG > 0
+ DEF list_item_length = \1
+ SHIFT
+ ENDC
+ _redef_current_label CURRENT_LIST_START, "._list_start\@", \#
ENDM
MACRO? li
ASSERT STRFIND(\1, "@") == -1, "String terminator \"@\" in list entry: \1"
+ IF list_item_length
+ ASSERT CHARLEN(\1) <= list_item_length, \
+ "List entry longer than {d:list_item_length} characters: \1"
+ ENDC
db \1, "@"
DEF list_index += 1
ENDM