diff options
author | yenatch <yenatch@gmail.com> | 2014-06-16 11:20:01 -0700 |
---|---|---|
committer | yenatch <yenatch@gmail.com> | 2014-06-16 11:20:01 -0700 |
commit | 8639fcd29b0e929ec6cc236a209d0e07a495db14 (patch) | |
tree | c5021a1842b931ff41b63a884739342fa31f0a9e /macros.asm | |
parent | 0b7dfeb9b208a16682e92de9cf15e19fb8cf8a94 (diff) |
Use a predef macro that takes labels instead of juggling constants.
Besides making predefs convenient, naming a predef no longer requires
adding or renaming a predef constant. This also lets predefs be rearranged at will.
Diffstat (limited to 'macros.asm')
-rw-r--r-- | macros.asm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/macros.asm b/macros.asm index efd43318a..5973de043 100644 --- a/macros.asm +++ b/macros.asm @@ -196,3 +196,25 @@ x = x + \1 * $40000 endr ENDM + +add_predef: MACRO +\1Predef:: + dw \1 + db BANK(\1) +ENDM + +predef_id: MACRO +; Some functions load the predef id +; without immediately calling Predef. + ld a, (\1Predef - PredefPointers) / 3 +ENDM + +predef: MACRO + predef_id \1 + call Predef +ENDM + +predef_jump: MACRO + predef_id \1 + jp Predef +ENDM |