diff options
author | mid-kid <esteve.varela@gmail.com> | 2020-09-13 00:07:05 +0200 |
---|---|---|
committer | mid-kid <esteve.varela@gmail.com> | 2020-09-13 00:07:05 +0200 |
commit | 2e590367aa3248ae6fda00638ce09e7b052e3a75 (patch) | |
tree | 93147aca0b50b550183dc93b25be5733bc99bb61 /include/macros.inc | |
parent | c8d5687ac4fa64396104da4f3f04f0594c38dc6c (diff) | |
parent | 24d95f7de2da127a5d9ee71372c61be20a522549 (diff) |
Merge branch 'master' of github.com:mid-kid/pokepicross
Diffstat (limited to 'include/macros.inc')
-rw-r--r-- | include/macros.inc | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/macros.inc b/include/macros.inc index 2b5b6b8..86c3fb3 100644 --- a/include/macros.inc +++ b/include/macros.inc @@ -21,3 +21,64 @@ farjp: macro pop af jp _farjp endm + + +lb: macro + ld \1, ((\2) & $ff) << 8 | ((\3) & $ff) +endm + +ln: macro + ld \1, ((\2) & $f) << 4 | ((\3) & $f) +endm + +ld16: macro + ld a, LOW(\2) + ld [\1 + 0], a + ld a, HIGH(\2) + ld [\1 + 1], a +endm + + +const_def: macro +if _NARG >= 1 +const_value = \1 +else +const_value = 0 +endc +if _NARG >= 2 +const_inc = \2 +else +const_inc = 1 +endc +endm + +const: macro +\1 EQU const_value +const_value = const_value + const_inc +endm + +shift_const: macro +\1 EQU (1 << const_value) +const_value = const_value + const_inc +endm + +const_skip: macro +if _NARG >= 1 +const_value = const_value + const_inc * (\1) +else +const_value = const_value + const_inc +endc +endm + +const_next: macro +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 +const_value = \1 +endc +endm + +const_dw: macro + const \1 + dw \2 +endm |