Files
pokegold-spaceworld/home/farcall.asm
luckytyphlosion e1659ecd41 Introduce linkerscript.
Addresses of sections will now be added to the linkerscript via `org`, and the section name will be the path/to/file. If there is more than one section in the file, then add a @SectionName after the path/to/file to describe the section.
2018-07-03 17:07:05 -04:00

42 lines
599 B
NASM

INCLUDE "constants.asm"
; if DEBUG
SECTION "home/farcall.asm", ROM0
; else
; SECTION "FarCall", ROM0[$2F6C]
; endc
FarCall_hl:: ; 2fa8
push af
ld a, b
ld [wFarCallBCBuffer], a
ld a, c
ld [wFarCallBCBuffer + 1], a
pop af
ld b, a
ldh a, [hROMBank]
push af
ld a, b
call Bankswitch
ld bc, .return
push bc
push hl
ld a, [wFarCallBCBuffer]
ld b, a
ld a, [wFarCallBCBuffer + 1]
ld c, a
ret
.return
ld a, b
ld [wFarCallBCBuffer], a
ld a, c
ld [wFarCallBCBuffer + 1], a
pop bc
ld a, b
call Bankswitch
ld a, [wFarCallBCBuffer]
ld b, a
ld a, [wFarCallBCBuffer + 1]
ld c, a
ret