ref: 02bd91b7076165653a900a8e39c12a92a9bd2976
parent: 64b4cf624fe2175e2c7539b91bc41b6dae28a00e
author: YamaArashi <shadow962@live.com>
date: Sun Jul 19 07:56:13 EDT 2015
jpab/jpba macros
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -187,9 +187,7 @@
ld b, $1
call GoPAL_SET
call HideSprites
- ld hl, PrintBeginningBattleText
- ld b, BANK(PrintBeginningBattleText)
- jp Bankswitch
+ jpab PrintBeginningBattleText
; when a battle is starting, silhouettes of the player's pic and the enemy's pic are slid onto the screen
; the lower of the player's pic (his body) is part of the background, but his head is a sprite
@@ -359,9 +357,7 @@
call PlaySoundWaitForCurrent
xor a
ld [H_WHOSETURN], a
- ld hl, AnimationSlideEnemyMonOut
- ld b, BANK(AnimationSlideEnemyMonOut)
- jp Bankswitch
+ jpab AnimationSlideEnemyMonOut
WildRanText: ; 3c229 (f:4229)
TX_FAR _WildRanText
@@ -938,9 +934,7 @@
jr nz, .gainExpFlagsLoop
ld a, b
ld [wPartyGainExpFlags], a
- ld hl, GainExperience
- ld b, BANK(GainExperience)
- jp Bankswitch
+ jpab GainExperience
EnemyMonFaintedText: ; 0x3c63e
TX_FAR _EnemyMonFaintedText
@@ -6462,14 +6456,10 @@
; does nothing since no stats are ever selected (barring glitches)
DoubleOrHalveSelectedStats: ; 3ed02 (f:6d02)
callab DoubleSelectedStats
- ld hl, HalveSelectedStats
- ld b, BANK(HalveSelectedStats)
- jp Bankswitch
+ jpab HalveSelectedStats
ScrollTrainerPicAfterBattle: ; 3ed12 (f:6d12)
- ld hl, _ScrollTrainerPicAfterBattle
- ld b, BANK(_ScrollTrainerPicAfterBattle)
- jp Bankswitch
+ jpab _ScrollTrainerPicAfterBattle
ApplyBurnAndParalysisPenaltiesToPlayer: ; 3ed1a (f:6d1a)
ld a, $1
@@ -7372,9 +7362,7 @@
db "@"
DrainHPEffect: ; 3f2e9 (f:72e9)
- ld hl, DrainHPEffect_
- ld b, BANK(DrainHPEffect_)
- jp Bankswitch
+ jpab DrainHPEffect_
ExplodeEffect: ; 3f2f1 (f:72f1)
ld hl, wBattleMonHP
@@ -8209,9 +8197,7 @@
ret
OneHitKOEffect: ; 3f884 (f:7884)
- ld hl, OneHitKOEffect_
- ld b, BANK(OneHitKOEffect_)
- jp Bankswitch
+ jpab OneHitKOEffect_
ChargeEffect: ; 3f88c (f:788c)
ld hl, W_PLAYERBATTSTATUS1
@@ -8321,19 +8307,13 @@
ret
MistEffect: ; 3f941 (f:7941)
- ld hl, MistEffect_
- ld b, BANK(MistEffect_)
- jp Bankswitch
+ jpab MistEffect_
FocusEnergyEffect: ; 3f949 (f:7949)
- ld hl, FocusEnergyEffect_
- ld b, BANK(FocusEnergyEffect_)
- jp Bankswitch
+ jpab FocusEnergyEffect_
RecoilEffect: ; 3f951 (f:7951)
- ld hl, RecoilEffect_
- ld b, BANK(RecoilEffect_)
- jp Bankswitch
+ jpab RecoilEffect_
ConfusionSideEffect: ; 3f959 (f:7959)
call BattleRandom
@@ -8387,14 +8367,10 @@
jp ConditionalPrintButItFailed
ParalyzeEffect: ; 3f9b1 (f:79b1)
- ld hl, ParalyzeEffect_
- ld b, BANK(ParalyzeEffect_)
- jp Bankswitch
+ jpab ParalyzeEffect_
SubstituteEffect: ; 3f9b9 (f:79b9)
- ld hl, SubstituteEffect_
- ld b, BANK(SubstituteEffect_)
- jp Bankswitch
+ jpab SubstituteEffect_
HyperBeamEffect: ; 3f9c1 (f:79c1)
ld hl, W_PLAYERBATTSTATUS2
@@ -8505,9 +8481,7 @@
db "@"
LeechSeedEffect: ; 3fa7c (f:7a7c)
- ld hl, LeechSeedEffect_
- ld b, BANK(LeechSeedEffect_)
- jp Bankswitch
+ jpab LeechSeedEffect_
SplashEffect: ; 3fa84 (f:7a84)
call PlayCurrentMoveAnimation
@@ -8601,34 +8575,22 @@
db "@"
PayDayEffect: ; 3fb0e (f:7b0e)
- ld hl, PayDayEffect_
- ld b, BANK(PayDayEffect_)
- jp Bankswitch
+ jpab PayDayEffect_
ConversionEffect: ; 3fb16 (f:7b16)
- ld hl, ConversionEffect_
- ld b, BANK(ConversionEffect_)
- jp Bankswitch
+ jpab ConversionEffect_
HazeEffect: ; 3fb1e (f:7b1e)
- ld hl, HazeEffect_
- ld b, BANK(HazeEffect_)
- jp Bankswitch
+ jpab HazeEffect_
HealEffect: ; 3fb26 (f:7b26)
- ld hl, HealEffect_
- ld b, BANK(HealEffect_)
- jp Bankswitch
+ jpab HealEffect_
TransformEffect: ; 3fb2e (f:7b2e)
- ld hl, TransformEffect_
- ld b, BANK(TransformEffect_)
- jp Bankswitch
+ jpab TransformEffect_
ReflectLightScreenEffect: ; 3fb36 (f:7b36)
- ld hl, ReflectLightScreenEffect_
- ld b, BANK(ReflectLightScreenEffect_)
- jp Bankswitch
+ jpab ReflectLightScreenEffect_
NothingHappenedText: ; 3fb3e (f:7b3e)
TX_FAR _NothingHappenedText
--- a/engine/battle/init_battle_variables.asm
+++ b/engine/battle/init_battle_variables.asm
@@ -35,6 +35,4 @@
ld a, $2 ; safari battle
ld [W_BATTLETYPE], a
.notSafariBattle
- ld hl, PlayBattleMusic
- ld b, BANK(PlayBattleMusic)
- jp Bankswitch
+ jpab PlayBattleMusic
--- a/engine/battle/moveEffects/focus_energy_effect.asm
+++ b/engine/battle/moveEffects/focus_energy_effect.asm
@@ -14,9 +14,7 @@
.alreadyUsing
ld c, 50
call DelayFrames
- ld hl, PrintButItFailedText_
- ld b, BANK(PrintButItFailedText_)
- jp Bankswitch
+ jpab PrintButItFailedText_
GettingPumpedText: ; 27fb3 (9:7fb3)
db $0a
--- a/engine/battle/moveEffects/mist_effect.asm
+++ b/engine/battle/moveEffects/mist_effect.asm
@@ -12,9 +12,7 @@
ld hl, ShroudedInMistText
jp PrintText
.mistAlreadyInUse
- ld hl, PrintButItFailedText_
- ld b, BANK(PrintButItFailedText_)
- jp Bankswitch
+ jpab PrintButItFailedText_
ShroudedInMistText: ; 33f52 (c:7f52)
TX_FAR _ShroudedInMistText
--- a/engine/battle/moveEffects/paralyze_effect.asm
+++ b/engine/battle/moveEffects/paralyze_effect.asm
@@ -36,18 +36,12 @@
ld c, 30
call DelayFrames
callab PlayCurrentMoveAnimation
- ld hl, PrintMayNotAttackText
- ld b, BANK(PrintMayNotAttackText)
- jp Bankswitch
+ jpab PrintMayNotAttackText
.didntAffect
ld c, 50
call DelayFrames
- ld hl, PrintDidntAffectText
- ld b, BANK(PrintDidntAffectText)
- jp Bankswitch
+ jpab PrintDidntAffectText
.doesntAffect
ld c, 50
call DelayFrames
- ld hl, PrintDoesntAffectText
- ld b, BANK(PrintDoesntAffectText)
- jp Bankswitch
+ jpab PrintDoesntAffectText
--- a/engine/battle/moveEffects/substitute_effect.asm
+++ b/engine/battle/moveEffects/substitute_effect.asm
@@ -55,9 +55,7 @@
call Bankswitch ; jump to routine depending on animation setting
ld hl, SubstituteText
call PrintText
- ld hl, DrawHUDsAndHPBars
- ld b, BANK(DrawHUDsAndHPBars)
- jp Bankswitch
+ jpab DrawHUDsAndHPBars
.alreadyHasSubstitute
ld hl, HasSubstituteText
jr .printText
--- a/engine/hidden_object_functions3.asm
+++ b/engine/hidden_object_functions3.asm
@@ -34,9 +34,7 @@
.noMatch
ld a, $ff
ld [$ffdb], a
- ld b, BANK(PrintCardKeyText)
- ld hl, PrintCardKeyText
- jp Bankswitch
+ jpba PrintCardKeyText
; format: db tileset id, bookshelf tile id, text id
BookshelfTileIDs: ; fb8b (3:7b8b)
--- a/engine/in_game_trades.asm
+++ b/engine/in_game_trades.asm
@@ -159,9 +159,7 @@
call LoadGBPal
ld c, 10
call DelayFrames
- ld b, BANK(LoadWildData)
- ld hl, LoadWildData
- jp Bankswitch
+ jpba LoadWildData
InGameTrade_PrepareTradeData: ; 71cc1 (1c:5cc1)
ld hl, wTradedPlayerMonSpecies
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -499,9 +499,7 @@
ld a,[W_ISINBATTLE]
and a
jp nz,ItemUseNotTime
- ld b, BANK(DisplayTownMap)
- ld hl, DisplayTownMap
- jp Bankswitch ; display Town Map
+ jpba DisplayTownMap
ItemUseBicycle: ; d977 (3:5977)
ld a,[W_ISINBATTLE]
--- a/engine/menu/league_pc.asm
+++ b/engine/menu/league_pc.asm
@@ -110,9 +110,7 @@
ld de, wHoFTeamNo
ld bc, $0103
call PrintNumber
- ld b, BANK(HoFDisplayMonInfo)
- ld hl, HoFDisplayMonInfo
- jp Bankswitch
+ jpba HoFDisplayMonInfo
HallOfFameNoText: ; 76670 (1d:6670)
db "HALL OF FAME No @"
--- a/engine/menu/naming_screen.asm
+++ b/engine/menu/naming_screen.asm
@@ -172,9 +172,7 @@
ld a, [W_ISINBATTLE]
and a
jp z, LoadTextBoxTilePatterns
- ld hl, LoadHudTilePatterns
- ld b, BANK(LoadHudTilePatterns)
- jp Bankswitch
+ jpab LoadHudTilePatterns
.namingScreenButtonFunctions
dw .dPadReturnPoint
--- a/engine/overworld/cable_club_npc.asm
+++ b/engine/overworld/cable_club_npc.asm
@@ -111,9 +111,7 @@
xor a
ld [hld], a
ld [hl], a
- ld hl, LinkMenu
- ld b, BANK(LinkMenu)
- jp Bankswitch
+ jpab LinkMenu
CableClubNPCAreaReservedFor2FriendsLinkedByCableText: ; 72b3 (1:72b3)
TX_FAR _CableClubNPCAreaReservedFor2FriendsLinkedByCableText
--- a/engine/overworld/saffron_guards.asm
+++ b/engine/overworld/saffron_guards.asm
@@ -10,9 +10,7 @@
call IsItemInBag
pop hl
jr z, .drinkLoop
- ld b, BANK(RemoveItemByID)
- ld hl, RemoveItemByID
- jp Bankswitch
+ jpba RemoveItemByID
GuardDrinksList: ; 5a5b7 (16:65b7)
db FRESH_WATER, SODA_POP, LEMONADE, $00
--- a/engine/titlescreen.asm
+++ b/engine/titlescreen.asm
@@ -262,9 +262,7 @@
jp MainMenu
.doClearSaveDialogue
- ld b, BANK(DoClearSaveDialogue)
- ld hl, DoClearSaveDialogue
- jp Bankswitch
+ jpba DoClearSaveDialogue
TitleScreenPickNewMon: ; 4496 (1:4496)
ld a, vBGMap0 / $100
--- a/engine/trade.asm
+++ b/engine/trade.asm
@@ -199,9 +199,7 @@
Trade_LoadMonPartySpriteGfx: ; 4120b (10:520b)
ld a, %11010000
ld [rOBP1], a
- ld b, BANK(LoadMonPartySpriteGfx)
- ld hl, LoadMonPartySpriteGfx
- jp Bankswitch
+ jpba LoadMonPartySpriteGfx
Trade_SwapNames: ; 41217 (10:5217)
ld hl, wPlayerName
--- a/home.asm
+++ b/home.asm
@@ -253,9 +253,7 @@
; wLoadedMon = base address of pokemon data
; W_MONHDEXNUM = base address of base stats
LoadMonData:: ; 1372 (0:1372)
- ld hl, LoadMonData_
- ld b, BANK(LoadMonData_)
- jp Bankswitch
+ jpab LoadMonData_
OverwritewMoves:: ; 137a (0:137a)
@@ -1317,9 +1315,7 @@
; subtracts the amount the player paid from their money
; sets carry flag if there is enough money and unsets carry flag if not
SubtractAmountPaidFromMoney:: ; 2b96 (0:2b96)
- ld b,BANK(SubtractAmountPaidFromMoney_)
- ld hl,SubtractAmountPaidFromMoney_
- jp Bankswitch
+ jpba SubtractAmountPaidFromMoney_
; adds the amount the player sold to their money
AddAmountSoldToMoney:: ; 2b9e (0:2b9e)
@@ -2077,9 +2073,7 @@
ChooseFlyDestination:: ; 30a9 (0:30a9)
ld hl,wd72e
res 4,[hl]
- ld b, BANK(LoadTownMap_Fly)
- ld hl, LoadTownMap_Fly
- jp Bankswitch
+ jpba LoadTownMap_Fly
; causes the text box to close without waiting for a button press after displaying text
DisableWaitingAfterTextDisplay:: ; 30b6 (0:30b6)
@@ -2097,9 +2091,7 @@
; 01: successful
; 02: not able to be used right now, no extra menu displayed (only certain items use this)
UseItem:: ; 30bc (0:30bc)
- ld b,BANK(UseItem_)
- ld hl,UseItem_
- jp Bankswitch
+ jpba UseItem_
; confirms the item toss and then tosses the item
; INPUT:
@@ -2201,14 +2193,10 @@
dw PewterMuseumGuyMovementScriptPointerTable
dw PewterGymGuyMovementScriptPointerTable
.playerStepOutFromDoor
- ld b, BANK(PlayerStepOutFromDoor)
- ld hl, PlayerStepOutFromDoor
- jp Bankswitch
+ jpba PlayerStepOutFromDoor
EndNPCMovementScript:: ; 314e (0:314e)
- ld b, BANK(_EndNPCMovementScript)
- ld hl, _EndNPCMovementScript
- jp Bankswitch
+ jpba _EndNPCMovementScript
EmptyFunc2:: ; 3156 (0:3156)
ret
@@ -2434,9 +2422,7 @@
; calls TrainerWalkUpToPlayer
TrainerWalkUpToPlayer_Bank0:: ; 32cf (0:32cf)
- ld b, BANK(TrainerWalkUpToPlayer)
- ld hl, TrainerWalkUpToPlayer
- jp Bankswitch
+ jpba TrainerWalkUpToPlayer
; sets opponent type and mon set/lvl based on the engaging trainer data
InitBattleEnemyParameters:: ; 32d7 (0:32d7)
@@ -2726,9 +2712,7 @@
DisplayPokedex:: ; 349b (0:349b)
ld [wd11e], a
- ld b, BANK(_DisplayPokedex)
- ld hl, _DisplayPokedex
- jp Bankswitch
+ jpba _DisplayPokedex
SetSpriteFacingDirectionAndDelay:: ; 34a6 (0:34a6)
call SetSpriteFacingDirection
@@ -2937,9 +2921,7 @@
ret
GetTrainerName:: ; 359e (0:359e)
- ld b, BANK(GetTrainerName_)
- ld hl, GetTrainerName_
- jp Bankswitch
+ jpba GetTrainerName_
HasEnoughMoney::
@@ -3604,9 +3586,7 @@
; [wRemoveMonFromBox] == 0 specifies the party.
; [wRemoveMonFromBox] != 0 specifies the current box.
RemovePokemon:: ; 391f (0:391f)
- ld hl, _RemovePokemon
- ld b, BANK(_RemovePokemon)
- jp Bankswitch
+ jpab _RemovePokemon
AddPartyMon:: ; 3927 (0:3927)
push hl
@@ -4590,9 +4570,7 @@
ld [W_CURENEMYLVL], a
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
- ld b, BANK(_GivePokemon)
- ld hl, _GivePokemon
- jp Bankswitch
+ jpba _GivePokemon
Random::
@@ -4613,9 +4591,7 @@
Func_3ead:: ; 3ead (0:3ead)
- ld b, BANK(CinnabarGymQuiz_1eb0a)
- ld hl, CinnabarGymQuiz_1eb0a
- jp Bankswitch
+ jpba CinnabarGymQuiz_1eb0a
CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: ; 3eb5 (0:3eb5)
ld a, [H_LOADEDROMBANK]
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -1,9 +1,7 @@
HandleMidJump::
; Handle the player jumping down
; a ledge in the overworld.
- ld b, BANK(_HandleMidJump)
- ld hl, _HandleMidJump
- jp Bankswitch
+ jpba _HandleMidJump
EnterMap::
; Load a new map.
@@ -355,9 +353,7 @@
ld a,[wd72e]
bit 4,a
jr nz,.noBattle
- ld b, BANK(InitBattle)
- ld hl, InitBattle
- jp Bankswitch
+ jpba InitBattle
.noBattle
and a
ret
@@ -783,9 +779,7 @@
jp SpecialEnterMap
LeaveMapAnim::
- ld b, BANK(_LeaveMapAnim)
- ld hl, _LeaveMapAnim
- jp Bankswitch
+ jpba _LeaveMapAnim
LoadPlayerSpriteGraphics::
; Load sprite graphics based on whether the player is standing, biking, or surfing.
--- a/macros.asm
+++ b/macros.asm
@@ -53,6 +53,18 @@
call Bankswitch
ENDM
+jpba: MACRO
+ ld b, BANK(\1)
+ ld hl, \1
+ jp Bankswitch
+ ENDM
+
+jpab: MACRO
+ ld hl, \1
+ ld b, BANK(\1)
+ jp Bankswitch
+ ENDM
+
bcd2: MACRO
dn ((\1) / 1000) % 10, ((\1) / 100) % 10
dn ((\1) / 10) % 10, (\1) % 10
--- a/scripts/celadonmartelevator.asm
+++ b/scripts/celadonmartelevator.asm
@@ -55,9 +55,7 @@
db $02, CELADON_MART_5
CeladonMartElevatorScript_48654: ; 48654 (12:4654)
- ld b, BANK(ShakeElevator)
- ld hl, ShakeElevator
- jp Bankswitch
+ jpba ShakeElevator
CeladonMartElevatorTextPointers: ; 4865c (12:465c)
dw CeladonMartElevatorText1
--- a/scripts/celadonmartroof.asm
+++ b/scripts/celadonmartroof.asm
@@ -135,9 +135,7 @@
jp PrintText
RemoveItemByIDBank12: ; 484e6 (12:44e6)
- ld b, BANK(RemoveItemByID)
- ld hl, RemoveItemByID
- jp Bankswitch
+ jpba RemoveItemByID
CeladonMartRoofText_484ee: ; 484ee (12:44ee)
TX_FAR _CeladonMartRoofText_484ee
--- a/scripts/lab4.asm
+++ b/scripts/lab4.asm
@@ -112,6 +112,4 @@
jp TextScriptEnd
LoadFossilItemAndMonNameBank1D: ; 75de8 (1d:5de8)
- ld b, BANK(LoadFossilItemAndMonName)
- ld hl, LoadFossilItemAndMonName
- jp Bankswitch
+ jpba LoadFossilItemAndMonName
--- a/scripts/viridiangym.asm
+++ b/scripts/viridiangym.asm
@@ -128,9 +128,7 @@
ld [W_CURMAPSCRIPT], a
ret
.asm_74980
- ld b, BANK(LoadSpinnerArrowTiles)
- ld hl, LoadSpinnerArrowTiles
- jp Bankswitch
+ jpba LoadSpinnerArrowTiles
ViridianGymScript3: ; 74988 (1d:4988)
ld a, [W_ISINBATTLE]