RGBDS syntax updates (#905)

New MACRO and DEF syntax
This commit is contained in:
vulcandth
2022-06-06 16:25:42 -05:00
committed by GitHub
parent a4d346cc8c
commit 3648afda16
179 changed files with 2546 additions and 2545 deletions

View File

@@ -1,24 +1,24 @@
; used in data/pokemon/base_stats/*.asm
tmhm: MACRO
; initialize bytes to 0
for n, (NUM_TM_HM_TUTOR + 7) / 8
_tm{d:n} = 0
endr
; set bits of bytes
rept _NARG
if DEF(\1_TMNUM)
n = (\1_TMNUM - 1) / 8
i = (\1_TMNUM - 1) % 8
_tm{d:n} |= 1 << i
else
fail "\1 is not a TM, HM, or tutor move"
endc
shift
endr
; output bytes
for n, (NUM_TM_HM_TUTOR + 7) / 8
db _tm{d:n}
endr
MACRO tmhm
; initialize bytes to 0
for n, (NUM_TM_HM_TUTOR + 7) / 8
DEF _tm{d:n} = 0
endr
; set bits of bytes
rept _NARG
if DEF(\1_TMNUM)
DEF n = (\1_TMNUM - 1) / 8
DEF i = (\1_TMNUM - 1) % 8
DEF _tm{d:n} |= 1 << i
else
fail "\1 is not a TM, HM, or tutor move"
endc
shift
endr
; output bytes
for n, (NUM_TM_HM_TUTOR + 7) / 8
db _tm{d:n}
endr
ENDM
BaseData::

View File

@@ -1,4 +1,4 @@
mon_cry: MACRO
MACRO mon_cry
; index, pitch, length
dw \1, \2, \3
ENDM

View File

@@ -1,4 +1,4 @@
unownword: MACRO
MACRO unownword
for n, CHARLEN(\1)
db CHARSUB(\1, n + 1) - "A" + FIRST_UNOWN_CHAR
endr