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.
This commit is contained in:
22
macros.asm
22
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
|
||||
|
Reference in New Issue
Block a user