pokegold/macros/farcall.asm

28 lines
507 B
NASM

; Far calls to another bank
; There is no difference between `farcall` and `callfar`, except the arbitrary
; order in which they set `a` and `hl` before calling `FarCall`.
; We use the more natural name "farcall" for the more common order.
MACRO farcall ; bank, address
ld a, BANK(\1)
ld hl, \1
rst FarCall
ENDM
MACRO callfar ; address, bank
ld hl, \1
ld a, BANK(\1)
rst FarCall
ENDM
MACRO homecall
ldh a, [hROMBank]
push af
ld a, BANK(\1)
rst Bankswitch
call \1
pop af
rst Bankswitch
ENDM