summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/items/mom_phone.asm2
-rw-r--r--engine/events/battle_tower/battle_tower.asm33
-rw-r--r--engine/events/field_moves.asm11
-rw-r--r--engine/events/magnet_train.asm11
-rw-r--r--engine/events/mom.asm20
-rw-r--r--engine/events/mom_phone.asm2
-rw-r--r--engine/games/card_flip.asm11
-rw-r--r--engine/games/unown_puzzle.asm11
-rw-r--r--engine/menus/debug.asm11
-rw-r--r--engine/menus/naming_screen.asm22
-rw-r--r--engine/menus/options_menu.asm11
-rw-r--r--engine/movie/intro.asm11
-rw-r--r--engine/movie/trade_animation.asm11
-rw-r--r--engine/pokegear/pokegear.asm11
-rw-r--r--engine/pokegear/radio.asm11
-rw-r--r--engine/printer/printer_serial.asm11
-rw-r--r--engine/tilesets/timeofday_pals.asm11
-rw-r--r--home/init.asm2
-rw-r--r--home/map_objects.asm8
-rw-r--r--macros/code.asm4
-rw-r--r--mobile/fixed_words.asm11
-rw-r--r--mobile/mobile_42.asm11
-rw-r--r--mobile/mobile_45_sprite_engine.asm11
-rw-r--r--mobile/mobile_45_stadium.asm22
-rw-r--r--mobile/mobile_5c.asm11
-rw-r--r--wram.asm3
26 files changed, 41 insertions, 253 deletions
diff --git a/data/items/mom_phone.asm b/data/items/mom_phone.asm
index 407a9a016..27b795f2c 100644
--- a/data/items/mom_phone.asm
+++ b/data/items/mom_phone.asm
@@ -25,3 +25,5 @@ MomItems_2:
momitem 50000, 8000, MOM_DOLL, DECO_PIKACHU_DOLL
momitem 100000, 22800, MOM_DOLL, DECO_BIG_SNORLAX_DOLL
.End
+
+ dt 0 ; unused
diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm
index bba5ae3a5..f335a83c9 100644
--- a/engine/events/battle_tower/battle_tower.asm
+++ b/engine/events/battle_tower/battle_tower.asm
@@ -204,16 +204,7 @@ _BattleTowerBattle:
ret
.do_dw
- ld a, [wBattleTowerBattleEnded]
- ld e, a
- ld d, 0
- ld hl, .dw
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .dw, wBattleTowerBattleEnded
.dw
dw RunBattleTowerTrainer
@@ -625,16 +616,7 @@ Function1704e1:
ret
.DoJumptable:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .dw
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .dw, wJumptableIndex
.dw
dw .Jumptable_0
@@ -869,16 +851,7 @@ Function1704e1:
db "れきだいりーダーいちらん@"
BattleTowerAction:
- ld a, [wScriptVar]
- ld e, a
- ld d, 0
- ld hl, .dw
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .dw, wScriptVar
.dw
dw BattleTowerAction_CheckExplanationRead
diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm
index 1cc14bf27..efba9e879 100644
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -154,16 +154,7 @@ CutGrassGFX:
INCBIN "gfx/overworld/cut_grass.2bpp"
OWCutJumptable:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .dw
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .dw, wJumptableIndex
.dw
dw Cut_SpawnAnimateTree
diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm
index 2f4c1dca4..14ccb02ba 100644
--- a/engine/events/magnet_train.asm
+++ b/engine/events/magnet_train.asm
@@ -272,16 +272,7 @@ SetMagnetTrainPals:
ret
MagnetTrain_Jumptable:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, wJumptableIndex
.Jumptable:
dw .InitPlayerSpriteAnim
diff --git a/engine/events/mom.asm b/engine/events/mom.asm
index 5d62a1693..194bae270 100644
--- a/engine/events/mom.asm
+++ b/engine/events/mom.asm
@@ -18,19 +18,9 @@ BankOfMom:
ret
.RunJumptable:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .dw
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .dw, wJumptableIndex
.dw
-
dw .CheckIfBankInitialized
dw .InitializeBank
dw .IsThisAboutYourMoney
@@ -98,7 +88,7 @@ BankOfMom:
ld hl, MomBankWhatDoYouWantToDoText
call PrintText
call LoadStandardMenuHeader
- ld hl, MenuHeader_0x166b5
+ ld hl, BankOfMom_MenuHeader
call CopyMenuHeader
call VerticalMenu
call CloseWindow
@@ -659,13 +649,13 @@ Mom_DepositString:
Mom_HeldString:
db "HELD@"
-MenuHeader_0x166b5:
+BankOfMom_MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 0, 10, 10
- dw MenuData_0x166bd
+ dw .MenuData
db 1 ; default option
-MenuData_0x166bd:
+.MenuData:
db STATICMENU_CURSOR ; flags
db 4 ; items
db "GET@"
diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm
index aa26fd5c0..f18685df8 100644
--- a/engine/events/mom_phone.asm
+++ b/engine/events/mom_phone.asm
@@ -204,8 +204,6 @@ endr
INCLUDE "data/items/mom_phone.asm"
- db 0, 0, 0 ; unused
-
MomHiHowAreYouText:
text_far _MomHiHowAreYouText
text_end
diff --git a/engine/games/card_flip.asm b/engine/games/card_flip.asm
index 499d8a1af..93929fbde 100644
--- a/engine/games/card_flip.asm
+++ b/engine/games/card_flip.asm
@@ -75,16 +75,7 @@ _CardFlip:
ret
.CardFlip:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, wJumptableIndex
.Jumptable:
dw .AskPlayWithThree
diff --git a/engine/games/unown_puzzle.asm b/engine/games/unown_puzzle.asm
index 93305dab9..871cb4541 100644
--- a/engine/games/unown_puzzle.asm
+++ b/engine/games/unown_puzzle.asm
@@ -169,16 +169,7 @@ PlaceStartCancelBoxBorder:
ret
UnownPuzzleJumptable:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, wJumptableIndex
.Jumptable:
dw .Function
diff --git a/engine/menus/debug.asm b/engine/menus/debug.asm
index 24bd75fb8..6062e71aa 100644
--- a/engine/menus/debug.asm
+++ b/engine/menus/debug.asm
@@ -230,16 +230,7 @@ Function81a74:
jr nz, .asm_81aab
.asm_81a8b
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, Jumptable_81acf
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable Jumptable_81acf, wJumptableIndex
.asm_81a9a
call Function81eca
diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm
index 791ae5e02..f9413a6ee 100644
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -363,16 +363,7 @@ NamingScreenJoypadLoop:
ret
.RunJumptable:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, $0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, wJumptableIndex
.Jumptable:
dw .InitCursor
@@ -1050,16 +1041,7 @@ INCBIN "gfx/icons/mail_big.2bpp"
ret
.DoJumptable:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, wJumptableIndex
.Jumptable:
dw .init_blinking_cursor
diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm
index 7ac305bd9..4ceb24a24 100644
--- a/engine/menus/options_menu.asm
+++ b/engine/menus/options_menu.asm
@@ -91,16 +91,7 @@ StringOptions:
db "CANCEL@"
GetOptionPointer:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Pointers
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Pointers, wJumptableIndex
.Pointers:
; entries correspond to OPT_* constants
diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm
index 2c7a9c68a..b923f4862 100644
--- a/engine/movie/intro.asm
+++ b/engine/movie/intro.asm
@@ -384,16 +384,7 @@ CrystalIntro:
ret
IntroSceneJumper:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, IntroScenes
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable IntroScenes, wJumptableIndex
IntroScenes:
dw IntroScene1
diff --git a/engine/movie/trade_animation.asm b/engine/movie/trade_animation.asm
index 4295ce282..32ab0fa8c 100644
--- a/engine/movie/trade_animation.asm
+++ b/engine/movie/trade_animation.asm
@@ -228,16 +228,7 @@ DoTradeAnimation:
ret
.DoTradeAnimCommand:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .JumpTable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .JumpTable, wJumptableIndex
.JumpTable:
; entries correspond to macros/scripts/trade_anims.asm enumeration
diff --git a/engine/pokegear/pokegear.asm b/engine/pokegear/pokegear.asm
index 05700fa2d..4dd5b2660 100644
--- a/engine/pokegear/pokegear.asm
+++ b/engine/pokegear/pokegear.asm
@@ -432,16 +432,7 @@ Pokegear_FinishTilemap:
ret
PokegearJumptable:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, wJumptableIndex
.Jumptable:
; entries correspond to POKEGEARSTATE_* constants
diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm
index d92bc02fa..c5961bea8 100644
--- a/engine/pokegear/radio.asm
+++ b/engine/pokegear/radio.asm
@@ -16,16 +16,7 @@ PlayRadioShow:
ld [wCurRadioLine], a
.ok
; Jump to the currently loaded station. The index to which we need to jump is in wCurRadioLine.
- ld a, [wCurRadioLine]
- ld e, a
- ld d, 0
- ld hl, RadioJumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable RadioJumptable, wCurRadioLine
RadioJumptable:
; entries correspond to constants/radio_constants.asm
diff --git a/engine/printer/printer_serial.asm b/engine/printer/printer_serial.asm
index d047418e0..9d0bd907d 100644
--- a/engine/printer/printer_serial.asm
+++ b/engine/printer/printer_serial.asm
@@ -16,16 +16,7 @@ Printer_StartTransmission:
ret
PrinterJumptableIteration:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, wJumptableIndex
.Jumptable:
dw Print_InitPrinterHandshake ; 00
diff --git a/engine/tilesets/timeofday_pals.asm b/engine/tilesets/timeofday_pals.asm
index 27172a213..e890607d4 100644
--- a/engine/tilesets/timeofday_pals.asm
+++ b/engine/tilesets/timeofday_pals.asm
@@ -224,16 +224,7 @@ ReplaceTimeOfDayPals:
dc 3, 2, 1, 0
GetTimePalette:
- ld a, [wTimeOfDay]
- ld e, a
- ld d, 0
- ld hl, .TimePalettes
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .TimePalettes, wTimeOfDay
.TimePalettes:
dw .MorningPalette
diff --git a/home/init.asm b/home/init.asm
index eb8453b51..76dc28422 100644
--- a/home/init.asm
+++ b/home/init.asm
@@ -50,7 +50,7 @@ Init::
ldh [rOBP1], a
ldh [rTMA], a
ldh [rTAC], a
- ld [WRAM1_Begin], a
+ ld [wd000], a
ld a, %100 ; Start timer at 4096Hz
ldh [rTAC], a
diff --git a/home/map_objects.asm b/home/map_objects.asm
index d91b2ab84..a13aa9769 100644
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -237,7 +237,7 @@ CheckObjectTime::
ld a, [hl]
cp -1
jr z, .timeofday_always
- ld hl, .TimeOfDayValues_191e
+ ld hl, .TimesOfDay
ld a, [wTimeOfDay]
add l
ld l, a
@@ -257,7 +257,7 @@ CheckObjectTime::
and a
ret
-.TimeOfDayValues_191e:
+.TimesOfDay:
; entries correspond to TimeOfDay values
db MORN
db DAY
@@ -362,7 +362,7 @@ CopyPlayerObjectTemplate::
call CopyBytes
ret
-Function19b8: ; unreferenced
+DeleteFollowerMapObject: ; unreferenced
call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
@@ -376,7 +376,7 @@ Function19b8: ; unreferenced
pop af
cp -1
ret z
- cp $d
+ cp NUM_OBJECT_STRUCTS
ret nc
ld b, a
ld a, [wObjectFollow_Leader]
diff --git a/macros/code.asm b/macros/code.asm
index c92e7132f..9de3dd1ec 100644
--- a/macros/code.asm
+++ b/macros/code.asm
@@ -11,7 +11,11 @@ ENDM
; Design patterns
jumptable: MACRO
+if "\2" == "hl"
+ ld a, [hl]
+else
ld a, [\2]
+endc
ld e, a
ld d, 0
ld hl, \1
diff --git a/mobile/fixed_words.asm b/mobile/fixed_words.asm
index 3b4c0878d..5394b6b4e 100644
--- a/mobile/fixed_words.asm
+++ b/mobile/fixed_words.asm
@@ -2455,16 +2455,7 @@ Function11d035:
AnimateEZChatCursor:
ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
- ld a, [hl]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, hl
.Jumptable:
dw .zero
diff --git a/mobile/mobile_42.asm b/mobile/mobile_42.asm
index 3a00dd591..c4a0a450e 100644
--- a/mobile/mobile_42.asm
+++ b/mobile/mobile_42.asm
@@ -351,16 +351,7 @@ MobileTradeAnim_JumptableLoop:
ret
.ExecuteMobileTradeAnimCommand:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, wJumptableIndex
.Jumptable:
dw GetMobileTradeAnimByte ; 00
diff --git a/mobile/mobile_45_sprite_engine.asm b/mobile/mobile_45_sprite_engine.asm
index 28b5b611b..54ecede02 100644
--- a/mobile/mobile_45_sprite_engine.asm
+++ b/mobile/mobile_45_sprite_engine.asm
@@ -354,16 +354,7 @@ Function11619d:
ret
Function1161b8:
- ld a, [wc319]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, wc319
.Jumptable:
dw Function1161d5
diff --git a/mobile/mobile_45_stadium.asm b/mobile/mobile_45_stadium.asm
index 860984aea..a2760c10a 100644
--- a/mobile/mobile_45_stadium.asm
+++ b/mobile/mobile_45_stadium.asm
@@ -81,16 +81,7 @@ Function1176ee:
ret
Function117719:
- ld a, [wcd49]
- ld e, a
- ld d, 0
- ld hl, Jumptable_117728
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable Jumptable_117728, wcd49
Jumptable_117728:
dw Function117738
@@ -553,16 +544,7 @@ Function117acd:
ret
Function117ae9:
- ld a, [wJumptableIndex]
- ld e, a
- ld d, $0
- ld hl, .Jumptable
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable .Jumptable, wJumptableIndex
.Jumptable:
dw Function117b06
diff --git a/mobile/mobile_5c.asm b/mobile/mobile_5c.asm
index ea43accc8..ae2ce1b11 100644
--- a/mobile/mobile_5c.asm
+++ b/mobile/mobile_5c.asm
@@ -346,16 +346,7 @@ Function171a11:
ret
Function171a36:
- ld a, [wcd49]
- ld e, a
- ld d, 0
- ld hl, Jumptable_171a45
- add hl, de
- add hl, de
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp hl
+ jumptable Jumptable_171a45, wcd49
Jumptable_171a45:
dw Function171a95
diff --git a/wram.asm b/wram.asm
index ac2101b08..3308a2fc4 100644
--- a/wram.asm
+++ b/wram.asm
@@ -1661,8 +1661,9 @@ wDaysSince:: db
SECTION "WRAM 1", WRAMX
-wGBCOnlyDecompressBuffer:: ds 1 ; also uses the next $53f bytes for $540 total
+wGBCOnlyDecompressBuffer:: ; a $540-byte buffer that continues past this SECTION
+wd000:: db
wDefaultSpawnpoint:: db
UNION