summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpikalaxalt <PikalaxALT@gmail.com>2016-05-27 10:41:59 -0400
committerpikalaxalt <PikalaxALT@gmail.com>2016-05-27 10:41:59 -0400
commit789ebc73042e07b5e50b3cc3c17ebd1df141f000 (patch)
tree4b8ef20101e73ba626751ec76d86888274b84486
parentbfe2f6d52e035ea03a372cabb18ba5cf57823bf9 (diff)
Port homecall macro
-rw-r--r--home.asm24
-rw-r--r--home/copy.asm16
-rw-r--r--home/handshake.asm9
-rw-r--r--home/math.asm10
-rw-r--r--home/palettes.asm18
-rw-r--r--home/sine.asm10
-rw-r--r--items/item_effects.asm2
-rw-r--r--macros.asm12
8 files changed, 24 insertions, 77 deletions
diff --git a/home.asm b/home.asm
index ede76f847..850fe6b24 100644
--- a/home.asm
+++ b/home.asm
@@ -386,28 +386,12 @@ CopyDataUntil:: ; 318c
; 0x3198
PrintNum:: ; 3198
- ld a, [hROMBank]
- push af
- ld a, BANK(_PrintNum)
- rst Bankswitch
-
- call _PrintNum
-
- pop af
- rst Bankswitch
+ homecall _PrintNum
ret
; 31a4
MobilePrintNum:: ; 31a4
- ld a, [hROMBank]
- push af
- ld a, BANK(_MobilePrintNum)
- rst Bankswitch
-
- call _MobilePrintNum
-
- pop af
- rst Bankswitch
+ homecall _MobilePrintNum
ret
; 31b0
@@ -737,10 +721,10 @@ GetHPPal:: ; 3353
ld d, HP_GREEN
ld a, e
- cp 24
+ cp (50 * 48 / 100)
ret nc
inc d ; yellow
- cp 10
+ cp (21 * 48 / 100)
ret nc
inc d ; red
ret
diff --git a/home/copy.asm b/home/copy.asm
index bf2dee3fb..8a307b3df 100644
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -6,13 +6,7 @@ Get2bpp_2:: ; dc9
bit 7, a
jp z, Copy2bpp
- ld a, [hROMBank]
- push af
- ld a, BANK(_Get2bpp)
- rst Bankswitch
- call _Get2bpp
- pop af
- rst Bankswitch
+ homecall _Get2bpp
ret
; ddc
@@ -22,13 +16,7 @@ Get1bpp_2:: ; ddc
bit 7, a
jp z, Copy1bpp
- ld a, [hROMBank]
- push af
- ld a, BANK(_Get1bpp)
- rst Bankswitch
- call _Get1bpp
- pop af
- rst Bankswitch
+ homecall _Get1bpp
ret
; def
diff --git a/home/handshake.asm b/home/handshake.asm
index e4ca27c92..14daf08a7 100644
--- a/home/handshake.asm
+++ b/home/handshake.asm
@@ -1,12 +1,5 @@
PrinterReceive:: ; 2057
- ld a, [hROMBank]
- push af
- ld a, BANK(_PrinterReceive)
- rst Bankswitch
-
- call _PrinterReceive
- pop af
- rst Bankswitch
+ homecall _PrinterReceive
ret
; 2063
diff --git a/home/math.asm b/home/math.asm
index c320fd15c..01aea6b72 100644
--- a/home/math.asm
+++ b/home/math.asm
@@ -59,15 +59,7 @@ Divide:: ; 3124
push hl
push de
push bc
- ld a, [hROMBank]
- push af
- ld a, BANK(_Divide)
- rst Bankswitch
-
- call _Divide
-
- pop af
- rst Bankswitch
+ homecall _Divide
pop bc
pop de
pop hl
diff --git a/home/palettes.asm b/home/palettes.asm
index 1d060dbb4..4eec68b5d 100644
--- a/home/palettes.asm
+++ b/home/palettes.asm
@@ -341,25 +341,11 @@ Special_ReloadSpritesNoPalettes:: ; d91
FarCallSwapTextboxPalettes:: ; db1
- ld a, [hROMBank]
- push af
- ld a, BANK(SwapTextboxPalettes)
- rst Bankswitch
- call SwapTextboxPalettes
- pop af
- rst Bankswitch
+ homecall SwapTextboxPalettes
ret
; dbd
FarCallScrollBGMapPalettes:: ; dbd
- ld a, [hROMBank]
- push af
- ld a, BANK(ScrollBGMapPalettes)
- rst Bankswitch
-
- call ScrollBGMapPalettes
-
- pop af
- rst Bankswitch
+ homecall ScrollBGMapPalettes
ret
; dc9
diff --git a/home/sine.asm b/home/sine.asm
index e1552db24..810845860 100644
--- a/home/sine.asm
+++ b/home/sine.asm
@@ -8,14 +8,6 @@ Sine:: ; 1b11
ld e, a
- ld a, [hROMBank]
- push af
- ld a, BANK(_Sine)
- rst Bankswitch
-
- call _Sine
-
- pop af
- rst Bankswitch
+ homecall _Sine
ret
; 1b1e
diff --git a/items/item_effects.asm b/items/item_effects.asm
index b2ec6d0be..21707e3e3 100644
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -2929,7 +2929,7 @@ Play_SFX_FULL_HEAL: ; f780
ret
; f789
-UseItemText ; f789
+UseItemText: ; f789
ld hl, UsedItemText
call PrintText
call Play_SFX_FULL_HEAL
diff --git a/macros.asm b/macros.asm
index e72d2ee66..c4fd73b3e 100644
--- a/macros.asm
+++ b/macros.asm
@@ -302,3 +302,15 @@ ENDC
endr
endm
+homecall: MACRO
+ ld a, [hROMBank]
+ push af
+ ld a, BANK(\1)
+ rst Bankswitch
+
+ call \1
+
+ pop af
+ rst Bankswitch
+ENDM
+