summaryrefslogtreecommitdiff
path: root/home/farcall.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/farcall.asm')
-rw-r--r--home/farcall.asm17
1 files changed, 14 insertions, 3 deletions
diff --git a/home/farcall.asm b/home/farcall.asm
index f42133b3..1c8b6f3f 100644
--- a/home/farcall.asm
+++ b/home/farcall.asm
@@ -1,22 +1,33 @@
-FarCall_hl:: ; 2e27 (0:2e27)
+FarCall_hl::
+; Call a:hl.
+; Preserves other registers.
+
ld [wBuffer], a
ldh a, [hROMBank]
push af
ld a, [wBuffer]
rst Bankswitch
- call ._hl_
+ call FarCall_JumpToHL
+
+ReturnFarCall::
+; We want to retain the contents of f.
+; To do this, we can pop to bc instead of af.
+
ld a, b
ld [wFarCallBCBuffer], a
ld a, c
ld [wFarCallBCBuffer + 1], a
+
+; Restore the working bank.
pop bc
ld a, b
rst Bankswitch
+
ld a, [wFarCallBCBuffer]
ld b, a
ld a, [wFarCallBCBuffer + 1]
ld c, a
ret
-._hl_
+FarCall_JumpToHL::
jp hl