You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Use more assertions to ensure correct code and data
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
channel_count: MACRO
|
||||
assert 0 < (\1) && (\1) <= NUM_MUSIC_CHANS, \
|
||||
"channel_count must be 1-{d:NUM_MUSIC_CHANS}"
|
||||
_num_channels = \1 - 1
|
||||
ENDM
|
||||
|
||||
channel: MACRO
|
||||
assert 0 < (\1) && (\1) <= NUM_CHANNELS, \
|
||||
"channel id must be 1-{d:NUM_CHANNELS}"
|
||||
dn (_num_channels << 2), \1 - 1 ; channel id
|
||||
dw \2 ; address
|
||||
_num_channels = 0
|
||||
@@ -46,6 +50,7 @@ FIRST_MUSIC_CMD EQU const_value
|
||||
|
||||
const octave_cmd ; $d0
|
||||
octave: MACRO
|
||||
assert 0 < (\1) && (\1) < 8, "octave must be 1-8"
|
||||
db octave_cmd | 8 - (\1) ; octave
|
||||
ENDM
|
||||
|
||||
|
@@ -1,7 +1,5 @@
|
||||
anim_wait: MACRO
|
||||
if \1 >= $d0
|
||||
fail "anim_wait argument must be less than $d0."
|
||||
endc
|
||||
assert (\1) < $d0, "anim_wait argument must be less than $d0"
|
||||
db \1
|
||||
ENDM
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
map_id: MACRO
|
||||
;\1: map id
|
||||
assert DEF(GROUP_\1) && DEF(MAP_\1), \
|
||||
"Missing 'map_const \1' in constants/map_constants.asm"
|
||||
db GROUP_\1, MAP_\1
|
||||
ENDM
|
||||
|
||||
|
Reference in New Issue
Block a user