diff options
| author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2024-12-27 12:52:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-27 12:52:24 -0500 |
| commit | cd647df3b551cea154317a572ace9052727aa72b (patch) | |
| tree | 01c6fbdd9d3a6a3e21232799793f6afeaf80b40a /macros/asserts.asm | |
| parent | Use RGBDS 0.9.0 (#482) (diff) | |
| download | pokeyellow-cd647df3b551cea154317a572ace9052727aa72b.tar.gz pokeyellow-cd647df3b551cea154317a572ace9052727aa72b.tar.xz pokeyellow-cd647df3b551cea154317a572ace9052727aa72b.zip | |
Don't pass redundant label names to `table_width` and `list_start` (#484)
Diffstat (limited to 'macros/asserts.asm')
| -rw-r--r-- | macros/asserts.asm | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/macros/asserts.asm b/macros/asserts.asm index bc5b2582..7fb7f96b 100644 --- a/macros/asserts.asm +++ b/macros/asserts.asm @@ -1,13 +1,29 @@ ; Macros to verify assumptions about the data or code +MACRO _redef_current_label + IF DEF(\1) + PURGE \1 + ENDC + IF _NARG == 3 + (\3) + DEF \1 EQUS "\<_NARG>" + ELIF DEF(..) + IF .. - @ == 0 + DEF \1 EQUS "{..}" + ENDC + ELIF DEF(.) + if . - @ == 0 + DEF \1 EQUS "{.}" + ENDC + ENDC + if !DEF(\1) + DEF \1 EQUS \2 + {\1}: + ENDC +ENDM + MACRO table_width DEF CURRENT_TABLE_WIDTH = \1 - IF _NARG == 2 - REDEF CURRENT_TABLE_START EQUS "\2" - ELSE - REDEF CURRENT_TABLE_START EQUS "._table_width\@" - {CURRENT_TABLE_START}: - ENDC + _redef_current_label CURRENT_TABLE_START, "._table_width\@", 2, \# ENDM MACRO assert_table_length @@ -24,12 +40,7 @@ ENDM MACRO list_start DEF list_index = 0 - IF _NARG == 1 - REDEF CURRENT_LIST_START EQUS "\1" - ELSE - REDEF CURRENT_LIST_START EQUS "._list_start\@" - {CURRENT_LIST_START}: - ENDC + _redef_current_label CURRENT_LIST_START, "._list_start\@", 1, \# ENDM MACRO li |
