ref: f030315b1fd797aa6765ac8cd8c35c0cd9b600a0
parent: 2bd45ca574aab251b91c24837b102c9c2a5e76a0
author: PikalaxALT <[email protected]>
date: Sat Dec 26 16:59:03 EST 2015
jumptable macro repurposed
--- a/battle/anim_objects.asm
+++ b/battle/anim_objects.asm
@@ -3,7 +3,7 @@
INCLUDE "battle/objects/engine.asm"
INCLUDE "battle/objects/data.asm"
INCLUDE "battle/objects/functions.asm"
-INCLUDE "battle/objects/library.asm"
+INCLUDE "battle/objects/helpers.asm"
INCLUDE "battle/objects/framesets.asm"
INCLUDE "battle/objects/oam.asm"
INCLUDE "battle/objects/gfx_headers.asm"
--- a/battle/bg_effects.asm
+++ b/battle/bg_effects.asm
@@ -70,9 +70,8 @@
ld e, [hl]
ld d, 0
ld hl, BattleBGEffects
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -227,55 +226,63 @@
ret
BattleBGEffect_WhiteHues: ; c812d (32:412d)
- ld de, Unknown_c813d
- call Functionc8d57
- jr c, .asm_c8139
+ ld de, .Pals
+ call BattleBGEffect_GetNthDMGPal
+ jr c, .quit
ld [wBGP], a
ret
-.asm_c8139
+.quit
call EndBattleBGEffect
ret
-; c813d (32:413d)
-
-Unknown_c813d:
- db $e4, $e0, $d0, $ff
+.Pals
+ db %11100100
+ db %11100000
+ db %11010000
+ db -1
; c8141
BattleBGEffect_BlackHues: ; c8141 (32:4141)
- ld de, Unknown_c8151
- call Functionc8d57
- jr c, .asm_c814d
+ ld de, .Pals
+ call BattleBGEffect_GetNthDMGPal
+ jr c, .quit
ld [wBGP], a
ret
-.asm_c814d
+.quit
call EndBattleBGEffect
ret
-; c8151 (32:4151)
-
-Unknown_c8151:
- db $e4, $f4, $f8, $ff
+.Pals
+ db %11100100
+ db %11110100
+ db %11111000
+ db -1
; c8155
BattleBGEffect_AlternateHues: ; c8155 (32:4155)
- ld de, Unknown_c8168
- call Functionc8d57
- jr c, .asm_c8164
+ ld de, .Pals
+ call BattleBGEffect_GetNthDMGPal
+ jr c, .quit
ld [wBGP], a
ld [wOBP1], a
ret
-.asm_c8164
+.quit
call EndBattleBGEffect
ret
-; c8168 (32:4168)
-
-Unknown_c8168:
- db $e4, $f8, $fc, $f8, $e4, $90, $40, $90, $fe
+.Pals
+ db %11100100
+ db %11111000
+ db %11111100
+ db %11111000
+ db %11100100
+ db %10010000
+ db %01000000
+ db %10010000
+ db -2
; c8171
BattleBGEffect_06: ; c8171 (32:4171)
@@ -287,14 +294,19 @@
.sgb
ld de, .PalsSGB
.okay
- call Functionc8d57
+ call BattleBGEffect_GetNthDMGPal
ld [wOBP0], a
ret
.PalsCGB
- db $e4, $90, $fe
+ db %11100100
+ db %10010000
+ db -2
+
.PalsSGB
- db $f0, $c0, $fe
+ db %11110000
+ db %11000000
+ db -2
; c818b
BattleBGEffect_07: ; c818b (32:418b)
@@ -306,29 +318,37 @@
.sgb
ld de, .PalsSGB
.okay
- call Functionc8d57
+ call BattleBGEffect_GetNthDMGPal
ld [wOBP0], a
ret
.PalsCGB
- db $e4, $d8, $fe
+ db %11100100
+ db %11011000
+ db -2
+
.PalsSGB
- db $f0, $cc, $fe
+ db %11110000
+ db %11001100
+ db -2
; c81a5
BattleBGEffect_08: ; c81a5 (32:41a5)
ld de, .Pals
- call Functionc8d57
+ call BattleBGEffect_GetNthDMGPal
ld [wBGP], a
ret
.Pals
- db $1b, $63, $87, $fe
+ db %00011011
+ db %01100011
+ db %10000111
+ db -2
; c81b3
BattleBGEffect_HideMon: ; c81b3 (32:41b3)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw BattleBGEffects_IncrementJumptable
dw BattleBGEffects_IncrementJumptable
@@ -395,7 +415,7 @@
BattleBGEffect_FeetFollow: ; c8214 (32:4214)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw BattleBGEffects_IncrementJumptable
@@ -417,13 +437,13 @@
push bc
call BGEffect_CheckBattleTurn
jr nz, .player_turn
- ld a, ANIM_OBJ_B8
+ ld a, ANIM_OBJ_PLAYERFEETFOLLOW
ld [wBattleAnimTemp0], a
ld a, 16 * 8 + 4
jr .okay
.player_turn
- ld a, ANIM_OBJ_B9
+ ld a, ANIM_OBJ_ENEMYFEETFOLLOW
ld [wBattleAnimTemp0], a
ld a, 6 * 8
.okay
@@ -463,7 +483,7 @@
BattleBGEffect_HeadFollow: ; c8281 (32:4281)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw BattleBGEffects_IncrementJumptable
@@ -535,7 +555,7 @@
BattleBGEffect_27: ; c82f5 (32:42f5)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw BattleBGEffects_IncrementJumptable
@@ -700,7 +720,7 @@
BattleBGEffect_RunPicResizeScript: ; c83ed (32:43ed)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw BattleBGEffects_IncrementJumptable
dw BattleBGEffects_IncrementJumptable
@@ -769,9 +789,8 @@
ld e, [hl]
ld d, 0
ld hl, .Coords
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -811,9 +830,8 @@
ld e, [hl]
ld d, 0
ld hl, .Coords
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -903,7 +921,7 @@
BattleBGEffect_Surf: ; c8545 (32:4545)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -915,7 +933,7 @@
call InitSurfWaves
.one
- ld a, [hLCDStatCustom]
+ ld a, [hFFC6]
and a
ret z
push bc
@@ -945,7 +963,7 @@
ld hl, wSurfWaveBGEffect
ld bc, $0
.loop2
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
cp e
jr nc, .load_zero
push hl
@@ -970,7 +988,7 @@
BattleBGEffect_Whirlpool: ; c8599 (32:4599)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -980,11 +998,11 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
xor a
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ld a, $5e
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
lb de, 2, 2
call Functionc8f2e
ret
@@ -1000,7 +1018,7 @@
BattleBGEffect_30: ; c85c2 (32:45c2)
call BattleBGEffects_ClearLYOverrides
ld a, $42
- call Functionc8ede
+ call BattleBGEffect_SetLCDStatCustoms1
call EndBattleBGEffect
ret
@@ -1028,9 +1046,8 @@
ld a, [hl]
cp $20
jr nc, .done
-rept 2
inc [hl]
-endr
+ inc [hl]
call Functionc8f9a
ret
@@ -1045,7 +1062,7 @@
BattleBGEffect_Psychic: ; c8607 (32:4607)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1055,11 +1072,11 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
xor a
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ld a, $5f
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
lb de, 6, 5
call Functionc8f2e
ld hl, BG_EFFECT_STRUCT_03
@@ -1083,7 +1100,7 @@
BattleBGEffect_Teleport: ; c863f (32:463f)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1093,7 +1110,7 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- call Functionc8ede
+ call BattleBGEffect_SetLCDStatCustoms1
lb de, 6, 5
call Functionc8f2e
ret
@@ -1108,7 +1125,7 @@
BattleBGEffect_NightShade: ; c8662 (32:4662)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1118,7 +1135,7 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
- call Functionc8ede
+ call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld e, [hl]
@@ -1136,7 +1153,7 @@
BattleBGEffect_DoubleTeam: ; c8689 (32:4689)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1149,10 +1166,10 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- call Functionc8ede
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms1
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $0
@@ -1207,9 +1224,9 @@
inc a
ld d, a
ld h, LYOverridesBackup / $100
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
ld l, a
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
sub l
srl a
push af
@@ -1231,7 +1248,7 @@
BattleBGEffect_AcidArmor: ; c8709 (32:4709)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1241,7 +1258,7 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
- call Functionc8ede
+ call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld e, [hl]
@@ -1248,7 +1265,7 @@
ld d, 2
call Functionc8f2e
ld h, $d2
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
ld l, a
ld [hl], $0
dec l
@@ -1256,7 +1273,7 @@
ret
.one
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
ld l, a
ld h, $d2
ld e, l
@@ -1266,11 +1283,11 @@
ld a, [de]
dec de
ld [hld], a
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
cp l
jr nz, .loop
ld [hl], $90
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
ld l, a
ld a, [hl]
cp $1
@@ -1294,7 +1311,7 @@
BattleBGEffect_21: ; c8761 (32:4761)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1304,10 +1321,10 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
- call Functionc8ede
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms1
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -1343,7 +1360,7 @@
BattleBGEffect_Dig: ; c87a7 (32:47a7)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1354,10 +1371,10 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
- call Functionc8ede
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms1
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $2
@@ -1379,9 +1396,9 @@
ld [hl], $10
call BattleBGEffects_IncrementJumptable
.two
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
ld l, a
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
sub l
dec a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
@@ -1400,9 +1417,8 @@
call Functionc901b
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
-rept 2
inc [hl]
-endr
+ inc [hl]
ret
.three
@@ -1411,7 +1427,7 @@
BattleBGEffect_Tackle: ; c8805 (32:4805)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw Tackle_BGEffect25_2d_one
dw Tackle_BGEffect25_2d_two
@@ -1422,10 +1438,10 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- call Functionc8ede
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms1
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1446,7 +1462,7 @@
BattleBGEffect_25: ; c8837 (32:4837)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw Tackle_BGEffect25_2d_one
dw Tackle_BGEffect25_2d_two
@@ -1457,10 +1473,10 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- call Functionc8ef4
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms2
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1533,9 +1549,9 @@
jp Functionc900b
.rollout
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
ld d, a
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
sub d
ld d, a
ld h, LYOverridesBackup / $100
@@ -1542,7 +1558,7 @@
ld a, [hSCY]
or a
jr nz, .skip1
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
or a
jr z, .skip2
dec a
@@ -1551,7 +1567,7 @@
jr .skip2
.skip1
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
dec a
ld l, a
ld [hl], $0
@@ -1558,7 +1574,7 @@
.skip2
ld a, [hSCY]
ld l, a
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
sub l
jr nc, .skip3
xor a
@@ -1574,7 +1590,7 @@
BattleBGEffect_2d: ; c88e7 (32:48e7)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw BGEffect2d_2f_zero
dw Tackle_BGEffect25_2d_one
dw Tackle_BGEffect25_2d_two
@@ -1589,10 +1605,10 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- call Functionc8ede
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms1
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1609,7 +1625,7 @@
BattleBGEffect_2f: ; c8919 (32:4919)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw BGEffect2d_2f_zero
dw Tackle_BGEffect25_2d_one
dw .two
@@ -1623,7 +1639,7 @@
BattleBGEffect_26: ; c892a (32:492a)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1633,10 +1649,10 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- call Functionc8ede
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms1
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -1662,7 +1678,7 @@
BattleBGEffect_2c: ; c8964 (32:4964)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1672,10 +1688,10 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- call Functionc8ede
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms1
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
xor a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
@@ -1717,7 +1733,7 @@
BattleBGEffect_28: ; c89b5 (32:49b5)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1727,7 +1743,7 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- call Functionc8ede
+ call BattleBGEffect_SetLCDStatCustoms1
ret
.one
@@ -1760,7 +1776,7 @@
BattleBGEffect_BounceDown: ; c89ee (32:49ee)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1770,10 +1786,10 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
- call Functionc8ef4
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms2
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -1801,9 +1817,8 @@
call Functionc901b
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
-rept 2
inc [hl]
-endr
+ inc [hl]
ret
.two
@@ -1812,7 +1827,7 @@
BattleBGEffect_2a: ; c8a3a (32:4a3a)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1825,15 +1840,15 @@
ld a, $e4
call BattleBGEffects_SetLYOverrides
ld a, $47
- call Functionc8ede
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms1
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
- ld a, [hLCDStatCustom + 1]
+ ld [hFFC8], a
+ ld a, [hFFC7]
ld l, a
ld h, $d2
.loop
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
cp l
jr z, .done
xor a
@@ -1858,9 +1873,9 @@
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
inc a
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
call BattleBGEffects_IncrementJumptable
ret
@@ -1868,7 +1883,7 @@
call .GetLYOverride
jr nc, .finish
call .SetLYOverridesBackup
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
dec a
ld l, a
ld [hl], e
@@ -1880,23 +1895,22 @@
.SetLYOverridesBackup
ld e, a
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
ld l, a
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
sub l
srl a
ld h, LYOverridesBackup / $100
.loop2
ld [hl], e
-rept 2
inc hl
-endr
+ inc hl
dec a
jr nz, .loop2
ret
.five
- call Functionc8f19
+ call BattleBGEffects_ResetVideoHRAM
ret
.GetLYOverride
@@ -1922,7 +1936,7 @@
BattleBGEffect_2b: ; c8acc (32:4acc)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
@@ -1931,7 +1945,7 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- call Functionc8ede
+ call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $40
@@ -1942,7 +1956,7 @@
add hl, bc
ld a, [hl]
and a
- jr z, .asm_c8afc
+ jr z, .done
dec [hl]
srl a
srl a
@@ -1953,7 +1967,7 @@
call Functionc8f2e
ret
-.asm_c8afc
+.done
call BattleAnim_ResetLCDStatCustom
ret
@@ -1962,7 +1976,7 @@
and a
jr nz, .cgb
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -1973,11 +1987,11 @@
ld a, $e4
call BattleBGEffects_SetLYOverrides
ld a, $47
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
xor a
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ld a, $60
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ret
.one
@@ -2022,7 +2036,7 @@
ret
.two
- call Functionc8f19
+ call BattleBGEffects_ResetVideoHRAM
ld a, $e4
ld [wBGP], a
ld [wOBP1], a
@@ -2199,7 +2213,7 @@
BattleBGEffect_VibrateMon: ; c8c61 (32:4c61)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
@@ -2208,10 +2222,10 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- call Functionc8ede
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms1
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@@ -2244,7 +2258,7 @@
BattleBGEffect_WobbleMon: ; c8ca2 (32:4ca2)
call BattleBGEffects_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -2254,11 +2268,11 @@
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
xor a
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ld a, $37
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@@ -2376,18 +2390,17 @@
ld [hSCX], a
ret
-Functionc8d57: ; c8d57 (32:4d57)
+BattleBGEffect_GetNthDMGPal: ; c8d57 (32:4d57)
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
ld a, [hl]
and a
jr z, .zero
-
dec [hl]
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
- call Functionc8eb2
+ call BattleBGEffect_GetNextDMGPal
ret
.zero
@@ -2397,7 +2410,7 @@
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
ld [hl], a
- call Functionc8eac
+ call BattleBGEffect_GetFirstDMGPal
ret
BGEffect_RapidCyclePals: ; c8d77 (32:4d77)
@@ -2421,10 +2434,10 @@
ld a, $e4
call BattleBGEffects_SetLYOverrides
ld a, $47
- call Functionc8ede
- ld a, [hLCDStatCustom + 2]
+ call BattleBGEffect_SetLCDStatCustoms1
+ ld a, [hFFC8]
inc a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@@ -2448,7 +2461,7 @@
swap a
or [hl]
ld [hl], a
- call Functionc8eac
+ call BattleBGEffect_GetFirstDMGPal
jr c, .okay_2_dmg
call Functionc900b
ret
@@ -2460,8 +2473,8 @@
ret
.two_dmg: ; c8dc9 (32:4dc9)
- call Functionc8f19
- ld a, $e4
+ call BattleBGEffects_ResetVideoHRAM
+ ld a, %11100100
ld [rBGP], a
call EndBattleBGEffect
ret
@@ -2511,7 +2524,7 @@
swap a
or [hl]
ld [hl], a
- call Functionc8eac
+ call BattleBGEffect_GetFirstDMGPal
jr c, .okay_2_cgb
call BGEffects_LoadBGPal0_OBPal1
ret
@@ -2542,7 +2555,7 @@
swap a
or [hl]
ld [hl], a
- call Functionc8eac
+ call BattleBGEffect_GetFirstDMGPal
jr c, .okay_4_cgb
call BGEffects_LoadBGPal1_OBPal0
ret
@@ -2613,30 +2626,29 @@
ld [hCGBPalUpdate], a
ret
-Functionc8eac: ; c8eac (32:4eac)
+BattleBGEffect_GetFirstDMGPal: ; c8eac (32:4eac)
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
inc [hl]
-
-Functionc8eb2: ; c8eb2 (32:4eb2)
+BattleBGEffect_GetNextDMGPal: ; c8eb2 (32:4eb2)
ld l, a
ld h, $0
add hl, de
ld a, [hl]
- cp $ff
- jr z, .asm_c8ec8
- cp $fe
- jr nz, .asm_c8ec6
+ cp -1
+ jr z, .quit
+ cp -2
+ jr nz, .repeat
ld a, [de]
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
-.asm_c8ec6
+.repeat
and a
ret
-.asm_c8ec8
+.quit
scf
ret
@@ -2657,57 +2669,57 @@
jr nz, .loop2
ret
-Functionc8ede: ; c8ede (32:4ede)
- ld [hLCDStatCustom], a
+BattleBGEffect_SetLCDStatCustoms1: ; c8ede (32:4ede)
+ ld [hFFC6], a
call BGEffect_CheckBattleTurn
- jr nz, .asm_c8eea
- ld de, $36
+ jr nz, .player_turn
+ lb de, $00, $36
jr .okay
-.asm_c8eea
- ld de, $2f5e
+.player_turn
+ lb de, $2f, $5e
.okay
ld a, d
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ld a, e
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ret
-Functionc8ef4: ; c8ef4 (32:4ef4)
- ld [hLCDStatCustom], a
+BattleBGEffect_SetLCDStatCustoms2: ; c8ef4 (32:4ef4)
+ ld [hFFC6], a
call BGEffect_CheckBattleTurn
- jr nz, .asm_c8f00
- ld de, $36
- jr .asm_c8f03
+ jr nz, .player_turn
+ lb de, $00, $36
+ jr .okay
-.asm_c8f00
- ld de, $2d5e
-.asm_c8f03
+.player_turn
+ lb de, $2d, $5e
+.okay
ld a, d
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ld a, e
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ret
BattleAnim_ResetLCDStatCustom: ; c8f0a (32:4f0a)
xor a
- ld [hLCDStatCustom + 1], a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC7], a
+ ld [hFFC8], a
call BattleBGEffects_ClearLYOverrides
xor a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
call EndBattleBGEffect
ret
-Functionc8f19: ; c8f19 (32:4f19)
+BattleBGEffects_ResetVideoHRAM: ; c8f19 (32:4f19)
xor a
- ld [hLCDStatCustom], a
- ld a, $e4
+ ld [hFFC6], a
+ ld a, %11100100
ld [rBGP], a
ld [wBGP], a
ld [wOBP1], a
- ld [hLCDStatCustom + 1], a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC7], a
+ ld [hFFC8], a
call BattleBGEffects_ClearLYOverrides
ret
@@ -2723,10 +2735,10 @@
ld [wBattleAnimTemp3], a
ld bc, LYOverridesBackup
.loop
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
cp c
jr nc, .next
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
cp c
jr c, .next
ld a, [wBattleAnimTemp2]
@@ -2800,7 +2812,7 @@
call BattleBGEffects_Sine
ld e, a
pop hl
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
cp c
jr c, .skip1
ld a, e
@@ -2807,7 +2819,7 @@
ld [bc], a
inc bc
.skip1
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
cp l
jr nc, .skip2
ld [hl], e
@@ -2825,7 +2837,7 @@
ret
.GetLYOverrideBackupAddrOffset
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
ld e, a
ld a, [wBattleAnimTemp0]
add e
@@ -2835,13 +2847,13 @@
BattleBGEffect_WavyScreenFX: ; c8fef (32:4fef)
push bc
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
ld l, a
inc a
ld e, a
ld h, $d2
ld d, h
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
sub l
and a
jr z, .done
@@ -2863,9 +2875,9 @@
Functionc900b: ; c900b (32:500b)
push af
ld h, $d2
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
ld l, a
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
sub l
ld d, a
pop af
@@ -2878,14 +2890,14 @@
Functionc901b: ; c901b (32:501b)
push af
ld e, a
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
ld l, a
- ld a, [hLCDStatCustom + 2]
+ ld a, [hFFC8]
sub l
sub e
ld d, a
ld h, $d2
- ld a, [hLCDStatCustom + 1]
+ ld a, [hFFC7]
ld l, a
ld a, $90
.asm_c902c
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -1849,9 +1849,8 @@
dec a
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2575,9 +2574,8 @@
dec a
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2615,9 +2613,8 @@
rl [hl]
ret nc
ld a, $ff
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ret
; 3d0ab
@@ -4747,9 +4744,8 @@
ld a, [hli]
cp $ff
jr z, .finish
-rept 2
inc hl
-endr
+ inc hl
cp b
jr nz, .loop
pop bc
@@ -4756,9 +4752,8 @@
ld a, [bc]
ld [wd265], a
push bc
-rept 2
dec hl
-endr
+ dec hl
ld a, [hli]
ld h, [hl]
ld l, a
@@ -5822,9 +5817,8 @@
ld a, [wMenuCursorY]
ld b, a
ld a, [wNumMoves]
-rept 2
inc a
-endr
+ inc a
cp b
jp nz, .menu_loop
ld a, $1
@@ -6008,9 +6002,8 @@
lb bc, 1, 2
call PrintNum
pop hl
-rept 2
inc hl
-endr
+ inc hl
ld [hl], "/"
inc hl
ld de, wNamedObjectIndexBuffer
@@ -6818,9 +6811,8 @@
.next
; Make sure we haven't gone past the end of the table
-rept 2
inc e
-endr
+ inc e
ld a, e
cp a, .Set1 - .LetterSets
jr c, .loop
@@ -7176,9 +7168,8 @@
; Swap badges 3 (PlainBadge) and 5 (MineralBadge).
ld d, a
and (1 << PLAINBADGE)
-rept 2
add a
-endr
+ add a
ld b, a
ld a, d
and (1 << MINERALBADGE)
@@ -7197,9 +7188,8 @@
ld a, b
srl b
call c, BoostStat
-rept 2
inc hl
-endr
+ inc hl
; Check every other badge.
srl b
dec c
@@ -7328,9 +7318,8 @@
; a * 5 + 1
ld c, a
-rept 2
add a
-endr
+ add a
add c
inc a
@@ -7467,9 +7456,8 @@
ld [de], a
.skip
-rept 2
inc de
-endr
+ inc de
dec c
jr nz, .loop1
xor a
@@ -7544,9 +7532,8 @@
inc [hl]
jr nz, .skip2
ld a, $ff
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
.skip2
@@ -7881,9 +7868,8 @@
inc [hl]
jr nz, .asm_3f186
ld a, $ff
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
.asm_3f186
@@ -8800,9 +8786,8 @@
rl [hl]
jr nc, .okay
ld a, $ff
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
.okay
@@ -9202,13 +9187,11 @@
ld d, 5
.loop
push hl
-rept 2
inc hl
-endr
+ inc hl
ld a, [hl]
-rept 2
dec hl
-endr
+ dec hl
and a
jr z, .copy
push de
@@ -9308,9 +9291,8 @@
ld c, $1
.loop2
ld a, b
-rept 2
add b
-endr
+ add b
ld e, a
ld d, $0
ld hl, wd002
@@ -9317,9 +9299,8 @@
add hl, de
push hl
ld a, c
-rept 2
add c
-endr
+ add c
ld e, a
ld d, $0
ld hl, wd002
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -51,9 +51,8 @@
ld c, a
ld b, 0
ld hl, MoveEffectsPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, BANK(MoveEffectsPointers)
call GetFarHalfword
@@ -102,9 +101,8 @@
ld c, a
ld b, 0
ld hl, BattleCommandPointers
-rept 2
add hl, bc
-endr
+ add hl, bc
pop bc
ld a, BANK(BattleCommandPointers)
@@ -1076,9 +1074,8 @@
jp nz, EndMoveEffect
; SubStatus5
-rept 2
inc de
-endr
+ inc de
ld a, [de]
bit SUBSTATUS_TRANSFORMED, a
@@ -1276,9 +1273,8 @@
jr nc, .ScopeLens
; +2 critical level
-rept 2
inc c
-endr
+ inc c
.ScopeLens
push bc
@@ -1522,9 +1518,8 @@
pop hl
.SkipType
-rept 2
inc hl
-endr
+ inc hl
jr .TypesLoop
.end
@@ -2741,9 +2736,8 @@
ld a, [BattleScriptBufferLoc + 1]
ld h, a
ld a, $ff
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ret
@@ -3457,9 +3451,8 @@
xor a
ld hl, hDividend
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
; Level * 2
@@ -3480,9 +3473,8 @@
pop bc
; + 2
-rept 2
inc [hl]
-endr
+ inc [hl]
; * bp
inc hl
@@ -4075,9 +4067,8 @@
ld [Buffer3], a
ld a, [hl]
ld [Buffer4], a
-rept 2
dec de
-endr
+ dec de
ld a, [de]
dec de
add b
@@ -4587,9 +4578,8 @@
call GetMoveName
call BattleRandom
and 3
-rept 2
inc a
-endr
+ inc a
ld b, a
ld a, [hl]
and $3f
@@ -6380,9 +6370,8 @@
dec c
ld b, 0
ld hl, StatLevelMultipliers
-rept 2
add hl, bc
-endr
+ add hl, bc
xor a
ld [hMultiplicand + 0], a
@@ -6538,9 +6527,8 @@
ld [wEnemyMoveStruct + MOVE_EFFECT], a
call BattleRandom
and 1
-rept 2
inc a
-endr
+ inc a
ld [bc], a
ld a, 1
ld [wKickCounter], a
@@ -6579,9 +6567,8 @@
set SUBSTATUS_CONFUSED, [hl]
call BattleRandom
and %00000001
-rept 2
inc a
-endr
+ inc a
inc de ; ConfuseCount
ld [de], a
.continue_rampage
@@ -7464,9 +7451,8 @@
ld a, [hli]
cp b
jr z, .found_trap_text
-rept 2
inc hl
-endr
+ inc hl
jr .find_trap_text
.found_trap_text
@@ -7552,9 +7538,8 @@
ld [Buffer2], a
ld a, [hl]
ld [Buffer1], a
-rept 2
dec hl
-endr
+ dec hl
ld a, [hl]
ld [Buffer3], a
sub c
@@ -7651,9 +7636,8 @@
set SUBSTATUS_CONFUSED, [hl]
call BattleRandom
and 3
-rept 2
inc a
-endr
+ inc a
ld [bc], a
ld a, BATTLE_VARS_MOVE_EFFECT
@@ -7844,9 +7828,8 @@
rr b
srl a
rr b
-rept 2
dec hl
-endr
+ dec hl
ld a, b
ld [de], a
ld a, [hld]
@@ -8457,9 +8440,8 @@
ld a, [hli]
ld [de], a
inc hl
-rept 2
inc de
-endr
+ inc de
ld bc, NUM_MOVES
call CopyBytes
ld a, [hBattleTurn]
@@ -9125,9 +9107,8 @@
ld a, [hli]
cp b
jr nc, .ok
-rept 2
inc hl
-endr
+ inc hl
jr .loop
.ok
@@ -9528,16 +9509,14 @@
inc c
cp WEATHER_SUN
jr z, .Heal
-rept 2
dec c
-endr
+ dec c
.Heal
ld b, 0
ld hl, .Multipliers
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
--- a/battle/objects/data.asm
+++ b/battle/objects/data.asm
@@ -558,10 +558,10 @@
; ANIM_OBJ_COTTON
battleanimobj $01, $ff, BATTLEANIMFRAMESET_89, BATTLEANIMFUNC_4F, $04, $1f
-; ANIM_OBJ_B8
+; ANIM_OBJ_PLAYERFEETFOLLOW
battleanimobj $00, $00, BATTLEANIMFRAMESET_B5, BATTLEANIMFUNC_00, $00, $28
-; ANIM_OBJ_B9
+; ANIM_OBJ_ENEMYFEETFOLLOW
battleanimobj $00, $00, BATTLEANIMFRAMESET_B6, BATTLEANIMFUNC_00, $01, $29
; ANIM_OBJ_BA
--- a/battle/objects/functions.asm
+++ b/battle/objects/functions.asm
@@ -96,13 +96,11 @@
BattleAnimFunction_00: ; cd06e (33:506e)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
-
.one
call DeinitBattleAnimation
-
.zero
ret
@@ -179,10 +177,9 @@
BattleAnimFunction_03: ; cd0e3 (33:50e3)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
-
.zero
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
@@ -200,7 +197,6 @@
ld a, [hl]
and $7f
ld [hl], a
-
.one
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -227,10 +223,9 @@
BattleAnimFunction_01: ; cd12a (33:512a)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
-
.one
call DeinitBattleAnimation
ret
@@ -265,7 +260,7 @@
BattleAnimFunction_12: ; cd15c (33:515c)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -278,7 +273,6 @@
dw .nine
dw .ten
dw .eleven
-
.zero
call GetBallAnimFunction
call BattleAnim_IncAnonJumptableIndex
@@ -308,7 +302,6 @@
ld [hl], $0
inc hl
ld [hl], $10
-
.four
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -384,11 +377,10 @@
BattleAnimFunction_13: ; cd212 (33:5212)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
-
.zero
call GetBallAnimFunction
call BattleAnim_IncAnonJumptableIndex
@@ -448,8 +440,8 @@
add hl, bc
ld [hl], a
ret
-; cd26c (33:526c)
+; cd26c (33:526c)
.balls
db MASTER_BALL, 5
db ULTRA_BALL, 3
@@ -464,16 +456,14 @@
db LOVE_BALL, 4
db -1, 2
; cd284
-
BattleAnimFunction_10: ; cd284 (33:5284)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
dw .three
dw .four
-
.zero
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -510,10 +500,9 @@
BattleAnimFunction_07: ; cd2be (33:52be)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
-
.zero
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -558,12 +547,11 @@
BattleAnimFunction_08: ; cd306 (33:5306)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
dw .three
-
.zero
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
@@ -633,7 +621,6 @@
.finish
call BattleAnim_IncAnonJumptableIndex
-
.three
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
@@ -672,11 +659,10 @@
BattleAnimFunction_09: ; cd3ae (33:53ae)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
-
.zero
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -689,7 +675,6 @@
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
-
.one
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -722,7 +707,7 @@
BattleAnimFunction_0A: ; cd3f2 (33:53f2)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -733,7 +718,6 @@
dw .seven
dw .eight
dw .nine
-
.zero
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -800,7 +784,6 @@
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
inc [hl]
-
.two
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
@@ -811,18 +794,16 @@
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
inc [hl]
-
.three
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
inc [hl]
-
.six
ret
BattleAnimFunction_0B: ; cd478 (33:5478)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
@@ -832,13 +813,11 @@
dw .six
dw .seven
dw .eight
-
.zero
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $40
-
.one
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -952,7 +931,6 @@
ld hl, BATTLEANIMSTRUCT_01
add hl, bc
res 5, [hl]
-
.four
.five
.six
@@ -1010,10 +988,9 @@
BattleAnimFunction_4E: ; cd58a (33:558a)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
-
.zero
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -1073,11 +1050,10 @@
BattleAnimFunction_0C: ; cd5e9 (33:55e9)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
-
.zero
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -1103,7 +1079,6 @@
ld [hl], $0
ld a, $22
call ReinitBattleAnimFrameset
-
.two
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
@@ -1159,21 +1134,20 @@
BattleAnimFunction_0D: ; cd66a (33:566a)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw .zero
dw .one
dw .two
dw .three
dw .four
-
.zero
call BattleAnim_IncAnonJumptableIndex
ld a, $42
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ld a, $58
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ld a, $5e
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
ret
.one
@@ -1187,7 +1161,7 @@
jr nc, .asm_cd69b
call BattleAnim_IncAnonJumptableIndex
xor a
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ret
.asm_cd69b
@@ -1206,7 +1180,7 @@
add [hl]
sub $10
ret c
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
@@ -1227,10 +1201,9 @@
cp $70
jr c, asm_cd6da
xor a
- ld [hLCDStatCustom], a
- ld [hLCDStatCustom + 1], a
- ld [hLCDStatCustom + 2], a
-
+ ld [hFFC6], a
+ ld [hFFC7], a
+ ld [hFFC8], a
.four
call DeinitBattleAnimation
ret
@@ -1241,15 +1214,14 @@
ld [hl], a
sub $10
ret c
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ret
BattleAnimFunction_0E: ; cd6e3 (33:56e3)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncd6ea
dw Functioncd6f7
-
Functioncd6ea: ; cd6ea (33:56ea)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
@@ -1257,7 +1229,6 @@
ld a, $24
add [hl]
call ReinitBattleAnimFrameset
-
Functioncd6f7: ; cd6f7 (33:56f7)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
@@ -1283,15 +1254,13 @@
BattleAnimFunction_0F: ; cd71a (33:571a)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncd725
dw Functioncd728
dw Functioncd763
dw Functioncd776
-
Functioncd725: ; cd725 (33:5725)
call BattleAnim_IncAnonJumptableIndex
-
Functioncd728: ; cd728 (33:5728)
ld hl, BATTLEANIMSTRUCT_YCOORD
add hl, bc
@@ -1326,7 +1295,6 @@
ld a, [hl]
and $1
ld [hl], a
-
Functioncd763: ; cd763 (33:5763)
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -1340,7 +1308,6 @@
call BattleAnim_IncAnonJumptableIndex
ld a, $29
call ReinitBattleAnimFrameset
-
Functioncd776: ; cd776 (33:5776)
ret
@@ -1378,10 +1345,9 @@
BattleAnimFunction_14: ; cd7a4 (33:57a4)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncd7ab
dw Functioncd7d2
-
Functioncd7ab: ; cd7ab (33:57ab)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
@@ -1404,7 +1370,6 @@
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld [hl], $1
-
Functioncd7d2: ; cd7d2 (33:57d2)
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
@@ -1447,17 +1412,15 @@
BattleAnimFunction_15: ; cd80c (33:580c)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncd81f
dw Functioncd817
dw Functioncd81f
dw Functioncd820
-
Functioncd817: ; cd817 (33:5817)
call BattleAnim_IncAnonJumptableIndex
ld a, $35
call ReinitBattleAnimFrameset
-
Functioncd81f: ; cd81f (33:581f)
ret
@@ -1467,7 +1430,7 @@
BattleAnimFunction_16: ; cd824 (33:5824)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncd835
dw Functioncd860
dw Functioncd88f
@@ -1475,7 +1438,6 @@
dw Functioncd88f
dw Functioncd88f
dw Functioncd893
-
Functioncd835: ; cd835 (33:5835)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
@@ -1503,7 +1465,6 @@
ld a, [hl]
and $7f
ld [hl], a
-
Functioncd860: ; cd860 (33:5860)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -1535,7 +1496,6 @@
ld a, [hl]
and $1f
ret nz
-
Functioncd88f: ; cd88f (33:588f)
call BattleAnim_IncAnonJumptableIndex
ret
@@ -1548,7 +1508,7 @@
BattleAnimFunction_17: ; cd89a (33:589a)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncd8ab
dw Functioncd8cc
dw Functioncd8f5
@@ -1556,7 +1516,6 @@
dw Functioncd8f5
dw Functioncd8f5
dw Functioncd8f9
-
Functioncd8ab: ; cd8ab (33:58ab)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
@@ -1578,7 +1537,6 @@
ld a, [hl]
and $7f
ld [hl], a
-
Functioncd8cc: ; cd8cc (33:58cc)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -1606,7 +1564,6 @@
ld a, [hl]
and $1f
ret nz
-
Functioncd8f5: ; cd8f5 (33:58f5)
call BattleAnim_IncAnonJumptableIndex
ret
@@ -1619,10 +1576,9 @@
BattleAnimFunction_18: ; cd900 (33:5900)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncd907
dw Functioncd913
-
Functioncd907: ; cd907 (33:5907)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -1630,7 +1586,6 @@
ld [hl], $28
inc hl
ld [hl], $0
-
Functioncd913: ; cd913 (33:5913)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -1677,19 +1632,17 @@
BattleAnimFunction_19: ; cd954 (33:5954)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncd961
dw Functioncd96a
dw Functioncd96e
dw Functioncd96a
dw Functioncd97b
-
Functioncd961: ; cd961 (33:5961)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
ld [hl], $0
-
Functioncd96a: ; cd96a (33:596a)
call Functioncd99a
ret
@@ -1794,12 +1747,11 @@
add hl, de
ld d, [hl]
ret
-; cda01 (33:5a01)
+; cda01 (33:5a01)
Unknown_cda01: ; cda01
db 8, 6, 5, 4, 5, 6, 8, 12, 16
; cda0a
-
BattleAnimFunction_1C: ; cda0a (33:5a0a)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
@@ -1831,11 +1783,10 @@
BattleAnimFunction_1F: ; cda31 (33:5a31)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncda4c
dw Functioncda3a
dw Functioncda4c
-
Functioncda3a: ; cda3a (33:5a3a)
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
@@ -1846,18 +1797,16 @@
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $8
-
Functioncda4c: ; cda4c (33:5a4c)
ret
BattleAnimFunction_20: ; cda4d (33:5a4d)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncda58
dw Functioncda62
dw Functioncda7a
dw Functioncda8c
-
Functioncda58: ; cda58 (33:5a58)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
@@ -1894,7 +1843,6 @@
call BattleAnim_IncAnonJumptableIndex
ld a, $58
call ReinitBattleAnimFrameset
-
Functioncda8c: ; cda8c (33:5a8c)
ret
@@ -1948,11 +1896,10 @@
BattleAnimFunction_3F: ; cdad6 (33:5ad6)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncdadf
dw Functioncdae9
dw Functioncdaf9
-
Functioncdadf: ; cdadf (33:5adf)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10
@@ -1971,7 +1918,6 @@
.asm_cdaf6
call BattleAnim_IncAnonJumptableIndex
-
Functioncdaf9: ; cdaf9 (33:5af9)
ret
@@ -1986,13 +1932,12 @@
BattleAnimFunction_1B: ; cdb06 (33:5b06)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncdb13
dw Functioncdb14
dw Functioncdb28
dw Functioncdb50
dw Functioncdb65
-
Functioncdb13: ; cdb13 (33:5b13)
ret
@@ -2048,7 +1993,6 @@
ld hl, BATTLEANIMSTRUCT_DURATION
add hl, bc
ld [hl], $80
-
Functioncdb65: ; cdb65 (33:5b65)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
@@ -2070,7 +2014,7 @@
BattleAnimFunction_1D: ; cdb80 (33:5b80)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncdb9f
dw Functioncdbb3
dw Functioncdbcf
@@ -2085,7 +2029,6 @@
dw Functioncdc48
dw Functioncdc57
dw Functioncdc74
-
Functioncdb9f: ; cdb9f (33:5b9f)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -2236,7 +2179,6 @@
.asm_cdc71
call BattleAnim_IncAnonJumptableIndex
-
Functioncdc74: ; cdc74 (33:5c74)
ret
@@ -2296,10 +2238,9 @@
BattleAnimFunction_21: ; cdcc3 (33:5cc3)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncdcca
dw Functioncdced
-
Functioncdcca: ; cdcca (33:5cca)
ld a, [hBattleTurn]
and a
@@ -2371,10 +2312,9 @@
BattleAnimFunction_22: ; cdd2a (33:5d2a)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncdd31
dw Functioncdd4f
-
Functioncdd31: ; cdd31 (33:5d31)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
@@ -2439,10 +2379,9 @@
BattleAnimFunction_23: ; cdd90 (33:5d90)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncdd97
dw Functioncddbc
-
Functioncdd97: ; cdd97 (33:5d97)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
@@ -2465,7 +2404,6 @@
ld a, [hl]
and $7f
ld [hl], a
-
Functioncddbc: ; cddbc (33:5dbc)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -2509,11 +2447,10 @@
BattleAnimFunction_24: ; cddf9 (33:5df9)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncde02
dw Functioncde20
dw Functioncde21
-
Functioncde02: ; cde02 (33:5e02)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
@@ -2531,7 +2468,6 @@
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], a
-
Functioncde20: ; cde20 (33:5e20)
ret
@@ -2538,12 +2474,11 @@
Functioncde21: ; cde21 (33:5e21)
call DeinitBattleAnimation
ret
-; cde25 (33:5e25)
+; cde25 (33:5e25)
Unknown_cde25: ; cde25
db $ec, $f8, $00
; cde28
-
BattleAnimFunction_25: ; cde28 (33:5e28)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -2591,10 +2526,9 @@
BattleAnimFunction_27: ; cde6b (33:5e6b)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncde72
dw Functioncde88
-
Functioncde72: ; cde72 (33:5e72)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
@@ -2608,16 +2542,14 @@
.asm_cde83
add $6a
call ReinitBattleAnimFrameset
-
Functioncde88: ; cde88 (33:5e88)
ret
BattleAnimFunction_28: ; cde89 (33:5e89)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncde90
dw Functioncdebf
-
Functioncde90: ; cde90 (33:5e90)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -2758,10 +2690,9 @@
BattleAnimFunction_2A: ; cdf59 (33:5f59)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functioncdf60
dw BattleAnimFunction_29
-
Functioncdf60: ; cdf60 (33:5f60)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
@@ -2879,11 +2810,10 @@
BattleAnimFunction_35: ; ce00b (33:600b)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce014
dw Functionce023
dw Functionce05f
-
Functionce014: ; ce014 (33:6014)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -2892,7 +2822,6 @@
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], $10
-
Functionce023: ; ce023 (33:6023)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
@@ -2938,12 +2867,11 @@
BattleAnimFunction_2B: ; ce063 (33:6063)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce06e
dw Functionce083
dw Functionce091
dw Functionce09e
-
Functionce06e: ; ce06e (33:606e)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -3005,11 +2933,10 @@
BattleAnimFunction_2C: ; ce0c5 (33:60c5)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce0ce
dw Functionce0f8
dw Functionce0dd
-
Functionce0ce: ; ce0ce (33:60ce)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -3038,7 +2965,6 @@
ld a, [hl]
sub $4
ld [hl], a
-
Functionce0f8: ; ce0f8 (33:60f8)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
@@ -3057,10 +2983,9 @@
BattleAnimFunction_2E: ; ce10e (33:610e)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce115
dw Functionce12a
-
Functionce115: ; ce115 (33:6115)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -3073,7 +2998,6 @@
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], a
-
Functionce12a: ; ce12a (33:612a)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -3207,10 +3131,9 @@
BattleAnimFunction_30: ; ce1e7 (33:61e7)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce1ee
dw Functionce1fb
-
Functionce1ee: ; ce1ee (33:61ee)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_YCOORD
@@ -3219,7 +3142,6 @@
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], a
-
Functionce1fb: ; ce1fb (33:61fb)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -3248,10 +3170,9 @@
BattleAnimFunction_31: ; ce226 (33:6226)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce22d
dw Functionce254
-
Functionce22d: ; ce22d (33:622d)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
@@ -3273,18 +3194,16 @@
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld [hl], $f
-
Functionce254: ; ce254 (33:6254)
ret
BattleAnimFunction_32: ; ce255 (33:6255)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce260
dw Functionce274
dw Functionce278
dw Functionce289
-
Functionce260: ; ce260 (33:6260)
call BattleAnim_IncAnonJumptableIndex
ld a, [hBattleTurn]
@@ -3356,14 +3275,13 @@
and [hl]
ld [wOBP0], a
ret
-; ce2c4 (33:62c4)
+; ce2c4 (33:62c4)
Unknown_ce2c4: ; ce2c4
db $ff, $aa, $55, $aa
Unknown_ce2c8: ; ce2c8
db $ff, $ff, $00, $00
; ce2cc
-
BattleAnimFunction_33: ; ce2cc (33:62cc)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -3396,11 +3314,10 @@
BattleAnimFunction_36: ; ce2fd (33:62fd)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce306
dw Functionce330
dw Functionce34c
-
Functionce306: ; ce306 (33:6306)
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -3469,10 +3386,9 @@
BattleAnimFunction_37: ; ce35f (33:635f)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce366
dw Functionce375
-
Functionce366: ; ce366 (33:6366)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
@@ -3481,7 +3397,6 @@
and $7f
add $81
call ReinitBattleAnimFrameset
-
Functionce375: ; ce375 (33:6375)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -3500,11 +3415,10 @@
BattleAnimFunction_38: ; ce389 (33:6389)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce392
dw Functionce39c
dw Functionce3ae
-
Functionce392: ; ce392 (33:6392)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -3525,7 +3439,6 @@
call BattleAnim_IncAnonJumptableIndex
ld a, $20
call ReinitBattleAnimFrameset
-
Functionce3ae: ; ce3ae (33:63ae)
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -3584,10 +3497,9 @@
BattleAnimFunction_3B: ; ce3ff (33:63ff)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce406
dw Functionce412
-
Functionce406: ; ce406 (33:6406)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -3628,11 +3540,10 @@
BattleAnimFunction_3E: ; ce43a (33:643a)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce443
dw Functionce465
dw Functionce490
-
Functionce443: ; ce443 (33:6443)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F
@@ -3652,7 +3563,6 @@
and $f0
or $8
ld [hl], a
-
Functionce465: ; ce465 (33:6465)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -3682,7 +3592,6 @@
.asm_ce48b
ld [hl], $10
call BattleAnim_IncAnonJumptableIndex
-
Functionce490: ; ce490 (33:6490)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -3695,10 +3604,9 @@
BattleAnimFunction_40: ; ce49c (33:649c)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce4a3
dw Functionce4b0
-
Functionce4a3: ; ce4a3 (33:64a3)
call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B
@@ -3706,7 +3614,6 @@
ld a, $24
add [hl]
call ReinitBattleAnimFrameset
-
Functionce4b0: ; ce4b0 (33:64b0)
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -3828,11 +3735,10 @@
BattleAnimFunction_45: ; ce55b (33:655b)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce564
dw Functionce56e
dw Functionce577
-
Functionce564: ; ce564 (33:6564)
ld d, $18
ld hl, BATTLEANIMSTRUCT_0B
@@ -3846,7 +3752,6 @@
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld [hl], $18
-
Functionce577: ; ce577 (33:6577)
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
@@ -3871,10 +3776,9 @@
BattleAnimFunction_46: ; ce593 (33:6593)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce5b3
dw Functionce59a
-
Functionce59a: ; ce59a (33:659a)
ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc
@@ -3893,7 +3797,6 @@
.asm_ce5b0
call DeinitBattleAnimation
-
Functionce5b3: ; ce5b3 (33:65b3)
ret
@@ -3941,12 +3844,11 @@
BattleAnimFunction_49: ; ce5ee (33:65ee)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce5f9
dw Functionce60a
dw Functionce622
dw Functionce618
-
Functionce5f9: ; ce5f9 (33:65f9)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -3957,7 +3859,6 @@
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
ld [hl], $ec
-
Functionce60a: ; ce60a (33:660a)
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -3976,7 +3877,6 @@
asm_ce61c: ; ce61c (33:661c)
call BattleAnim_IncAnonJumptableIndex
call BattleAnim_IncAnonJumptableIndex
-
Functionce622: ; ce622 (33:6622)
ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc
@@ -3990,12 +3890,11 @@
BattleAnimFunction_4A: ; ce62f (33:662f)
call BattleAnim_AnonJumptable
-.anon_jumptable
+.anon_dw
dw Functionce63a
dw Functionce648
dw Functionce65c
dw Functionce672
-
Functionce63a: ; ce63a (33:663a)
ld hl, BATTLEANIMSTRUCT_0B
add hl, bc
@@ -4234,8 +4133,8 @@
call BattleAnim_Cosine
ld e, a
ret
-; ce771 (33:6771)
+; ce771 (33:6771)
BattleAnim_AbsSinePrecise: ; ce771
ld a, e
call BattleAnim_Sine
@@ -4242,8 +4141,8 @@
ld e, l
ld d, h
ret
-; ce778
+; ce778
BattleAnim_AbsCosinePrecise: ; ce778
ld a, e
call BattleAnim_Cosine
@@ -4250,8 +4149,8 @@
ld e, l
ld d, h
ret
-; ce77f
+; ce77f
BattleAnimSineWave: ; ce77f
sine_wave $100
; ce7bf
--- /dev/null
+++ b/battle/objects/helpers.asm
@@ -1,0 +1,130 @@
+ReinitBattleAnimFrameset: ; ce7bf (33:67bf)
+ ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
+ add hl, bc
+ ld [hl], a
+ ld hl, BATTLEANIMSTRUCT_DURATION
+ add hl, bc
+ ld [hl], 0
+ ld hl, BATTLEANIMSTRUCT_FRAME
+ add hl, bc
+ ld [hl], -1
+ ret
+
+GetBattleAnimFrame: ; ce7d1
+.loop
+ ld hl, BATTLEANIMSTRUCT_DURATION
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .next_frame
+ dec [hl]
+ call .GetPointer
+ ld a, [hli]
+ push af
+ jr .okay
+
+.next_frame
+ ld hl, BATTLEANIMSTRUCT_FRAME
+ add hl, bc
+ inc [hl]
+ call .GetPointer
+ ld a, [hli]
+ cp -2
+ jr z, .restart
+ cp -1
+ jr z, .repeat_last
+ push af
+ ld a, [hl]
+ push hl
+ and $3f
+ ld hl, BATTLEANIMSTRUCT_DURATION
+ add hl, bc
+ ld [hl], a
+ pop hl
+
+.okay
+ ld a, [hl]
+ and $c0
+ srl a
+ ld [wBattleAnimTemp7], a
+ pop af
+ ret
+
+.repeat_last
+ xor a
+ ld hl, BATTLEANIMSTRUCT_DURATION
+ add hl, bc
+ ld [hl], a
+ ld hl, BATTLEANIMSTRUCT_FRAME
+ add hl, bc
+ dec [hl]
+ dec [hl]
+ jr .loop
+
+.restart
+ xor a
+ ld hl, BATTLEANIMSTRUCT_DURATION
+ add hl, bc
+ ld [hl], a
+ dec a
+ ld hl, BATTLEANIMSTRUCT_FRAME
+ add hl, bc
+ ld [hl], a
+ jr .loop
+
+; ce823
+
+.GetPointer: ; ce823
+ ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
+ add hl, bc
+ ld e, [hl]
+ ld d, 0
+ ld hl, BattleAnimFrameData
+ add hl, de
+ add hl, de
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ ld hl, BATTLEANIMSTRUCT_FRAME
+ add hl, bc
+ ld l, [hl]
+ ld h, $0
+ add hl, hl
+ add hl, de
+ ret
+
+; ce83c
+
+GetBattleAnimOAMPointer: ; ce83c
+ ld l, a
+ ld h, 0
+ ld de, BattleAnimOAMData
+ add hl, hl
+ add hl, hl
+ add hl, de
+ ret
+
+; ce846
+
+LoadBattleAnimObj: ; ce846 (33:6846)
+ push hl
+ ld l, a
+ ld h, 0
+ add hl, hl
+ add hl, hl
+ ld de, AnimObjGFX
+ add hl, de
+ ld c, [hl]
+ inc hl
+ ld b, [hl]
+ inc hl
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ pop de
+ push bc
+ call DecompressRequest2bpp
+ pop bc
+ ret
+
+; ce85e (33:685e)
--- a/battle/objects/library.asm
+++ /dev/null
@@ -1,130 +1,0 @@
-ReinitBattleAnimFrameset: ; ce7bf (33:67bf)
- ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
- add hl, bc
- ld [hl], a
- ld hl, BATTLEANIMSTRUCT_DURATION
- add hl, bc
- ld [hl], 0
- ld hl, BATTLEANIMSTRUCT_FRAME
- add hl, bc
- ld [hl], -1
- ret
-
-GetBattleAnimFrame: ; ce7d1
-.loop
- ld hl, BATTLEANIMSTRUCT_DURATION
- add hl, bc
- ld a, [hl]
- and a
- jr z, .next_frame
- dec [hl]
- call .GetPointer
- ld a, [hli]
- push af
- jr .okay
-
-.next_frame
- ld hl, BATTLEANIMSTRUCT_FRAME
- add hl, bc
- inc [hl]
- call .GetPointer
- ld a, [hli]
- cp -2
- jr z, .restart
- cp -1
- jr z, .repeat_last
- push af
- ld a, [hl]
- push hl
- and $3f
- ld hl, BATTLEANIMSTRUCT_DURATION
- add hl, bc
- ld [hl], a
- pop hl
-
-.okay
- ld a, [hl]
- and $c0
- srl a
- ld [wBattleAnimTemp7], a
- pop af
- ret
-
-.repeat_last
- xor a
- ld hl, BATTLEANIMSTRUCT_DURATION
- add hl, bc
- ld [hl], a
- ld hl, BATTLEANIMSTRUCT_FRAME
- add hl, bc
- dec [hl]
- dec [hl]
- jr .loop
-
-.restart
- xor a
- ld hl, BATTLEANIMSTRUCT_DURATION
- add hl, bc
- ld [hl], a
- dec a
- ld hl, BATTLEANIMSTRUCT_FRAME
- add hl, bc
- ld [hl], a
- jr .loop
-
-; ce823
-
-.GetPointer: ; ce823
- ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
- add hl, bc
- ld e, [hl]
- ld d, 0
- ld hl, BattleAnimFrameData
- add hl, de
- add hl, de
- ld e, [hl]
- inc hl
- ld d, [hl]
- ld hl, BATTLEANIMSTRUCT_FRAME
- add hl, bc
- ld l, [hl]
- ld h, $0
- add hl, hl
- add hl, de
- ret
-
-; ce83c
-
-GetBattleAnimOAMPointer: ; ce83c
- ld l, a
- ld h, 0
- ld de, BattleAnimOAMData
- add hl, hl
- add hl, hl
- add hl, de
- ret
-
-; ce846
-
-LoadBattleAnimObj: ; ce846 (33:6846)
- push hl
- ld l, a
- ld h, 0
- add hl, hl
- add hl, hl
- ld de, AnimObjGFX
- add hl, de
- ld c, [hl]
- inc hl
- ld b, [hl]
- inc hl
- ld a, [hli]
- ld h, [hl]
- ld l, a
- pop de
- push bc
- call DecompressRequest2bpp
- pop bc
- ret
-
-; ce85e (33:685e)
--- a/battle/sliding_intro.asm
+++ b/battle/sliding_intro.asm
@@ -5,10 +5,10 @@
ld [rSVBK], a
call .subfunction1
ld a, rSCX - $ff00
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
call .subfunction2
xor a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
pop af
ld [rSVBK], a
ret
--- a/constants/animation_constants.asm
+++ b/constants/animation_constants.asm
@@ -210,8 +210,8 @@
const ANIM_OBJ_B5
const ANIM_OBJ_FLOWER
const ANIM_OBJ_COTTON
- const ANIM_OBJ_B8
- const ANIM_OBJ_B9
+ const ANIM_OBJ_PLAYERFEETFOLLOW
+ const ANIM_OBJ_ENEMYFEETFOLLOW
const ANIM_OBJ_BA
const ANIM_OBJ_BB
--- a/constants/battle_tower_constants.asm
+++ b/constants/battle_tower_constants.asm
@@ -15,7 +15,7 @@
const BATTLETOWERACTION_0D ; more time stuff in SRAM bank 5
const BATTLETOWERACTION_EGGTICKET ; egg ticket
const BATTLETOWERACTION_0F ; check w3_d090
- const BATTLETOWERACTION_10 ; jumptable based on 5:a800
+ const BATTLETOWERACTION_10 ; dw based on 5:a800
const BATTLETOWERACTION_11 ; store 0 in 5:aa8d
const BATTLETOWERACTION_12 ; store 1 in 5:aa8d
const BATTLETOWERACTION_13 ; check 5:aa8d
--- a/engine/battle_start.asm
+++ b/engine/battle_start.asm
@@ -39,9 +39,9 @@
call DmgToCgbBGPals
call DelayFrame
xor a
- ld [hLCDStatCustom], a
- ld [hLCDStatCustom + 1], a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC6], a
+ ld [hFFC7], a
+ ld [hFFC8], a
ld [hSCY], a
ld a, $1
@@ -74,9 +74,8 @@
ld [hBGMapMode], a
ld hl, wJumptableIndex
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
call WipeLYOverrides
ret
@@ -146,20 +145,10 @@
FlashyTransitionToBattle: ; 8c314
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .dw, wJumptableIndex
; 8c323
-.jumptable: ; 8c323 (23:4323)
+.dw: ; 8c323 (23:4323)
dw StartTrainerBattle_DetermineWhichAnimation ; 00
; Animation 1: cave
@@ -314,11 +303,11 @@
call StartTrainerBattle_NextScene
ld a, $43
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
xor a
- ld [hLCDStatCustom + 1], a
+ ld [hFFC7], a
ld a, $90
- ld [hLCDStatCustom + 2], a
+ ld [hFFC8], a
xor a
ld [wcf64], a
ld [wcf65], a
@@ -784,9 +773,8 @@
ld a, d
ld d, 0
ld hl, .sinewave
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
--- a/engine/billspc.asm
+++ b/engine/billspc.asm
@@ -42,12 +42,12 @@
jp [hl]
.Jumptable: ; e23df (38:63df)
- jumptable_start
- jumptable .Init
- jumptable .HandleJoypad
- jumptable .WhatsUp
- jumptable .Submenu
- jumptable BillsPC_EndJumptableLoop
+
+ dw .Init
+ dw .HandleJoypad
+ dw .WhatsUp
+ dw .Submenu
+ dw BillsPC_EndJumptableLoop
.Init: ; e23e9 (38:63e9)
@@ -151,11 +151,11 @@
jp [hl]
BillsPCDepositJumptable: ; e24a1 (38:64a1)
- jumptable_start
- jumptable BillsPCDepositFuncDeposit ; Deposit Pokemon
- jumptable BillsPCDepositFuncStats ; Pokemon Stats
- jumptable BillsPCDepositFuncRelease ; Release Pokemon
- jumptable BillsPCDepositFuncCancel ; Cancel
+
+ dw BillsPCDepositFuncDeposit ; Deposit Pokemon
+ dw BillsPCDepositFuncStats ; Pokemon Stats
+ dw BillsPCDepositFuncRelease ; Release Pokemon
+ dw BillsPCDepositFuncCancel ; Cancel
BillsPCDepositFuncDeposit: ; e24a9 (38:64a9)
@@ -310,12 +310,12 @@
jp [hl]
.Jumptable: ; e25d2 (38:65d2)
- jumptable_start
- jumptable .Init
- jumptable .Joypad
- jumptable .PrepSubmenu
- jumptable BillsPC_Withdraw
- jumptable BillsPC_EndJumptableLoop
+
+ dw .Init
+ dw .Joypad
+ dw .PrepSubmenu
+ dw BillsPC_Withdraw
+ dw BillsPC_EndJumptableLoop
.Init: ; e25dc (38:65dc)
@@ -410,7 +410,7 @@
and 3
ld e, a
ld d, 0
- ld hl, .jumptable
+ ld hl, .dw
rept 2
add hl, de
endr
@@ -419,7 +419,7 @@
ld l, a
jp [hl]
-.jumptable: ; e2699 (38:6699) #mark
+.dw: ; e2699 (38:6699) #mark
dw .withdraw ; Withdraw
dw .stats ; Stats
dw .release ; Release
@@ -562,14 +562,14 @@
; e27ac
.Jumptable: ; e27ac
- jumptable_start
- jumptable .Init
- jumptable .Joypad
- jumptable .PrepSubmenu
- jumptable .MoveMonWOMailSubmenu
- jumptable .PrepInsertCursor
- jumptable .Joypad2
- jumptable BillsPC_EndJumptableLoop
+
+ dw .Init
+ dw .Joypad
+ dw .PrepSubmenu
+ dw .MoveMonWOMailSubmenu
+ dw .PrepInsertCursor
+ dw .Joypad2
+ dw BillsPC_EndJumptableLoop
; e27ba
.Init: ; e27ba
@@ -2016,12 +2016,12 @@
ld a, [hli]
ld h, [hl]
ld l, a
- ld de, .jumptable_return
+ ld de, .dw_return
push de
jp [hl]
; e322a
-.jumptable_return: ; e322a
+.dw_return: ; e322a
pop af
ld e, a
callba Function14ad5
@@ -2033,11 +2033,11 @@
; e3245
.Jumptable: ; e3245
- jumptable_start
- jumptable .BoxToBox
- jumptable .PartyToBox
- jumptable .BoxToParty
- jumptable .PartyToParty
+
+ dw .BoxToBox
+ dw .PartyToBox
+ dw .BoxToParty
+ dw .PartyToParty
; e324d
.BoxToBox: ; e324d
--- a/engine/card_flip.asm
+++ b/engine/card_flip.asm
@@ -81,15 +81,15 @@
; e01a0 (38:41a0)
.Jumptable: ; e01a0
- jumptable_start
- jumptable .AskPlayWithThree
- jumptable .DeductCoins
- jumptable .ChooseACard
- jumptable .PlaceYourBet
- jumptable .CheckTheCard
- jumptable .TabulateTheResult
- jumptable .PlayAgain
- jumptable .Quit
+
+ dw .AskPlayWithThree
+ dw .DeductCoins
+ dw .ChooseACard
+ dw .PlaceYourBet
+ dw .CheckTheCard
+ dw .TabulateTheResult
+ dw .PlayAgain
+ dw .Quit
; e01b0
.Increment: ; e01b0
@@ -108,7 +108,7 @@
ret
.SaidNo
- ld a, 7 ; .QuitTableIndex
+ ld a, 7
ld [wJumptableIndex], a
ret
; e01cd
@@ -132,7 +132,7 @@
jr nc, .deduct ; You have at least 3 coins.
ld hl, .NotEnoughCoinsText
call CardFlip_UpdateCoinBalanceDisplay
- ld a, 7 ; .QuitTableIndex
+ ld a, 7
ld [wJumptableIndex], a
ret
@@ -329,7 +329,7 @@
call CardFlip_BlankDiscardedCardSlot
.LoopAround
- ld a, 1 ; .DeductCoinsTableIndex
+ ld a, 1
ld [wJumptableIndex], a
ret
; e0356
@@ -659,13 +659,13 @@
; e0553
.Jumptable: ; e0553
- jumptable_start
- jumptable .Level1
- jumptable .Level2
- jumptable .Level3
- jumptable .Level4
- jumptable .Level5
- jumptable .Level6
+
+ dw .Level1
+ dw .Level2
+ dw .Level3
+ dw .Level4
+ dw .Level5
+ dw .Level6
; e055f
.Level1: ; e055f
@@ -848,62 +848,62 @@
; e0643
.Jumptable: ; e0643
- jumptable_start
- jumptable .Impossible
- jumptable .Impossible
- jumptable .PikaJiggly
- jumptable .PikaJiggly
- jumptable .PoliOddish
- jumptable .PoliOddish
+
+ dw .Impossible
+ dw .Impossible
+ dw .PikaJiggly
+ dw .PikaJiggly
+ dw .PoliOddish
+ dw .PoliOddish
- jumptable .Impossible
- jumptable .Impossible
- jumptable .Pikachu
- jumptable .Jigglypuff
- jumptable .Poliwag
- jumptable .Oddish
+ dw .Impossible
+ dw .Impossible
+ dw .Pikachu
+ dw .Jigglypuff
+ dw .Poliwag
+ dw .Oddish
- jumptable .OneTwo
- jumptable .One
- jumptable .PikaOne
- jumptable .JigglyOne
- jumptable .PoliOne
- jumptable .OddOne
+ dw .OneTwo
+ dw .One
+ dw .PikaOne
+ dw .JigglyOne
+ dw .PoliOne
+ dw .OddOne
- jumptable .OneTwo
- jumptable .Two
- jumptable .PikaTwo
- jumptable .JigglyTwo
- jumptable .PoliTwo
- jumptable .OddTwo
+ dw .OneTwo
+ dw .Two
+ dw .PikaTwo
+ dw .JigglyTwo
+ dw .PoliTwo
+ dw .OddTwo
- jumptable .ThreeFour
- jumptable .Three
- jumptable .PikaThree
- jumptable .JigglyThree
- jumptable .PoliThree
- jumptable .OddThree
+ dw .ThreeFour
+ dw .Three
+ dw .PikaThree
+ dw .JigglyThree
+ dw .PoliThree
+ dw .OddThree
- jumptable .ThreeFour
- jumptable .Four
- jumptable .PikaFour
- jumptable .JigglyFour
- jumptable .PoliFour
- jumptable .OddFour
+ dw .ThreeFour
+ dw .Four
+ dw .PikaFour
+ dw .JigglyFour
+ dw .PoliFour
+ dw .OddFour
- jumptable .FiveSix
- jumptable .Five
- jumptable .PikaFive
- jumptable .JigglyFive
- jumptable .PoliFive
- jumptable .OddFive
+ dw .FiveSix
+ dw .Five
+ dw .PikaFive
+ dw .JigglyFive
+ dw .PoliFive
+ dw .OddFive
- jumptable .FiveSix
- jumptable .Six
- jumptable .PikaSix
- jumptable .JigglySix
- jumptable .PoliSix
- jumptable .OddSix
+ dw .FiveSix
+ dw .Six
+ dw .PikaSix
+ dw .JigglySix
+ dw .PoliSix
+ dw .OddSix
; e06a3
.Impossible: ; e06a3
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -367,9 +367,8 @@
.okay
ld l, c
ld h, $0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld bc, Palettes_a8be
add hl, bc
ld bc, 4
@@ -405,9 +404,8 @@
ld hl, StatsScreenPals
ld b, 0
dec c
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [rSVBK]
push af
ld a, $5
@@ -441,9 +439,8 @@
ld bc, PALPACKET_LENGTH
call CopyBytes
pop hl
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld [wSGBPals + 3], a
ld a, [hli]
@@ -818,9 +815,8 @@
GetTrainerPalettePointer: ; 976b
ld l, a
ld h, 0
-rept 2
add hl,hl
-endr
+ add hl,hl
ld bc, TrainerPalettes
add hl, bc
ret
@@ -1152,9 +1148,8 @@
jr nz, .asm_99a6
ld a, $20
ld [rJOYP], a
-rept 2
ld a, [rJOYP]
-endr
+ ld a, [rJOYP]
call SGBDelayCycles
call SGBDelayCycles
ld a, $30
@@ -1962,9 +1957,8 @@
ld e, a
ld d, 0
ld hl, .TilesetColorsPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
--- a/engine/credits.asm
+++ b/engine/credits.asm
@@ -183,7 +183,7 @@
call ByteFill
ld a, rSCX - $ff00
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
call GetCreditsPalette
call SetPalettes
@@ -211,7 +211,7 @@
.exit_credits
call ClearBGPalettes
xor a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ld [hBGMapAddress], a
pop af
ld [hVBlank], a
@@ -269,20 +269,20 @@
.Jumptable: ; 109937 (42:5937)
- jumptable_start
- jumptable ParseCredits
- jumptable Credits_Next
- jumptable Credits_Next
- jumptable Credits_PrepBGMapUpdate
- jumptable Credits_UpdateGFXRequestPath
- jumptable Credits_RequestGFX
- jumptable Credits_LYOverride
- jumptable Credits_Next
- jumptable Credits_Next
- jumptable Credits_Next
- jumptable Credits_UpdateGFXRequestPath
- jumptable Credits_RequestGFX
- jumptable Credits_LoopBack
+
+ dw ParseCredits
+ dw Credits_Next
+ dw Credits_Next
+ dw Credits_PrepBGMapUpdate
+ dw Credits_UpdateGFXRequestPath
+ dw Credits_RequestGFX
+ dw Credits_LYOverride
+ dw Credits_Next
+ dw Credits_Next
+ dw Credits_Next
+ dw Credits_UpdateGFXRequestPath
+ dw Credits_RequestGFX
+ dw Credits_LoopBack
Credits_Next: ; 109951 (42:5951)
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -119,7 +119,7 @@
ld a, [wJumptableIndex]
ld e, a
ld d, 0
- ld hl, .jumptable
+ ld hl, .dw
rept 2
add hl, de
endr
@@ -129,7 +129,7 @@
jp [hl]
; e467f
-.jumptable: ; e467f
+.dw: ; e467f
dw PlaceGameFreakPresents_0
dw PlaceGameFreakPresents_1
dw PlaceGameFreakPresents_2
@@ -625,7 +625,7 @@
call ClearTileMap
xor a
ld [hBGMapMode], a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap005
@@ -819,7 +819,7 @@
IntroScene9: ; e4c04 (39:4c04)
; Set up the next scene (same bg).
xor a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
call ClearSprites
hlcoord 0, 0, AttrMap
; first 12 rows have palette 1
@@ -893,7 +893,7 @@
call ClearTileMap
xor a
ld [hBGMapMode], a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap007
@@ -2103,7 +2103,7 @@
pop af
ld [rSVBK], a
ld a, $43
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ret
Intro_PerspectiveScrollBG: ; e552f (39:552f)
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -1355,7 +1355,7 @@
and 3
ld e, a
ld d, 0
- ld hl, .jumptable
+ ld hl, .dw
rept 2
add hl, de
endr
@@ -1365,7 +1365,7 @@
jp [hl]
; 82301
-.jumptable: ; 82301
+.dw: ; 82301
dw Function82309
dw Function82339
dw Function8234b
--- a/engine/decorations.asm
+++ b/engine/decorations.asm
@@ -104,7 +104,7 @@
ret
.FindOwndDecos: ; 2683a (9:683a)
- ld hl, .jumptable
+ ld hl, .dw
.loop
ld a, [hli]
ld e, a
@@ -127,7 +127,7 @@
ret
; 26855 (9:6855)
-.jumptable: ; 26855
+.dw: ; 26855
dwb FindOwnedBeds, 0 ; bed
dwb FindOwnedCarpets, 1 ; carpet
dwb FindOwnedPlants, 2 ; plant
--- a/engine/engine_flags.asm
+++ b/engine/engine_flags.asm
@@ -37,9 +37,8 @@
.read
ld hl, EngineFlags
; location
-rept 2
add hl, de
-endr
+ add hl, de
; bit
add hl, de
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -771,9 +771,8 @@
push hl
call PlayTalkObject
pop hl
-rept 2
inc hl
-endr
+ inc hl
call GetMapScriptHeaderBank
call GetFarHalfword
call GetMapScriptHeaderBank
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -514,7 +514,7 @@
CmdQueue_Type4: ; 97ebc
call CmdQueueAnonymousJumptable
- ; anonymous jumptable
+ ; anonymous dw
dw .zero
dw .one
; 97ec3
@@ -560,7 +560,7 @@
CmdQueue_Type3: ; 97ef9
call CmdQueueAnonymousJumptable
- ; anonymous jumptable
+ ; anonymous dw
dw .zero
dw .one
dw .two
--- a/engine/events_3.asm
+++ b/engine/events_3.asm
@@ -55,7 +55,7 @@
ld [rWY], a
ld [hWY], a
xor a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ret
; b8064
@@ -126,7 +126,7 @@
ld [rWY], a
ld [hWY], a
xor a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ret
--- a/engine/intro_menu.asm
+++ b/engine/intro_menu.asm
@@ -1041,7 +1041,7 @@
call ClearScreen
call WaitBGMap2
xor a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ld [hSCX], a
ld [hSCY], a
ld a, $7
@@ -1058,10 +1058,9 @@
.ok
ld e, a
ld d, 0
- ld hl, .jumptable
-rept 2
+ ld hl, .dw
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1068,7 +1067,7 @@
jp [hl]
; 626a
-.jumptable
+.dw
dw _MainMenu
dw DeleteSaveData
dw CrystalIntroSequence
@@ -1113,9 +1112,8 @@
ld e, a
ld d, 0
ld hl, .scenes
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1174,7 +1172,7 @@
ld hl, wJumptableIndex
inc [hl]
xor a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
; Play the title screen music.
ld de, MUSIC_TITLE
@@ -1343,22 +1341,19 @@
add hl, bc ; over-the-top compicated way to load wc3ae into hl
ld l, [hl]
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, Data63ca
add hl, de
; If bit 2 of [wcf65] is set, get the second dw; else, get the first dw
ld a, [wcf65]
and %00000100
-rept 2
srl a
-endr
+ srl a
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
and a
ret z
--- a/engine/main_menu.asm
+++ b/engine/main_menu.asm
@@ -54,13 +54,13 @@
db "MOBILE STUDIUM@"
.Jumptable: ; 0x49d60
- jumptable_start
- jumptable MainMenu_Continue
- jumptable MainMenu_NewGame
- jumptable MainMenu_Options
- jumptable MainMenu_MysteryGift
- jumptable MainMenu_Mobile
- jumptable MainMenu_MobileStudium
+
+ dw MainMenu_Continue
+ dw MainMenu_NewGame
+ dw MainMenu_Options
+ dw MainMenu_MysteryGift
+ dw MainMenu_Mobile
+ dw MainMenu_MobileStudium
; 0x49d6c
CONTINUE EQU 0
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -233,9 +233,8 @@
ld a, [hl]
ld l, a
ld h, 0
-rept 2
add hl,hl
-endr
+ add hl,hl
add hl, de
ld a, [hli]
ld h, [hl]
@@ -676,9 +675,8 @@
add hl, bc
bit FIXED_FACING, [hl]
jr nz, GetNextTile
-rept 2
add a
-endr
+ add a
and %00001100
ld hl, OBJECT_FACING
add hl, bc
@@ -746,9 +744,8 @@
add hl, bc
ld a, [hl]
and %00001111
-rept 2
add a
-endr
+ add a
ld l, a
ld h, 0
ld de, StepVectors
@@ -888,7 +885,7 @@
; 47a8
Object28AnonymousJumptable: ; 47a8
-; anonymous jumptable
+; anonymous dw
ld hl, OBJECT_28
add hl, bc
ld a, [hl]
@@ -942,35 +939,35 @@
; 47e9
.Pointers ; 47e9
- jumptable_start
- jumptable .Null_00 ; 00
- jumptable .RandomWalkY ; 01
- jumptable .RandomWalkX ; 02
- jumptable .RandomWalkXY ; 03
- jumptable .RandomSpin1 ; 04
- jumptable .RandomSpin2 ; 05
- jumptable .Standing ; 06
- jumptable .ObeyDPad ; 07
- jumptable .Movement08 ; 08
- jumptable .Movement09 ; 09
- jumptable .Movement0a ; 0a
- jumptable .Movement0b ; 0b
- jumptable .Movement0c ; 0c
- jumptable .Movement0d ; 0d
- jumptable .Movement0e ; 0e
- jumptable .Follow ; 0f
- jumptable .Script ; 10
- jumptable .Strength ; 11
- jumptable .FollowNotExact ; 12
- jumptable .MovementShadow ; 13
- jumptable .MovementEmote ; 14
- jumptable .MovementBigStanding ; 15
- jumptable .MovementBouncing ; 16
- jumptable .MovementScreenShake ; 17
- jumptable .MovementSpinClockwise ; 18
- jumptable .MovementSpinCounterclockwise ; 19
- jumptable .MovementBoulderDust ; 1a
- jumptable .MovementShakingGrass ; 1b
+
+ dw .Null_00 ; 00
+ dw .RandomWalkY ; 01
+ dw .RandomWalkX ; 02
+ dw .RandomWalkXY ; 03
+ dw .RandomSpin1 ; 04
+ dw .RandomSpin2 ; 05
+ dw .Standing ; 06
+ dw .ObeyDPad ; 07
+ dw .Movement08 ; 08
+ dw .Movement09 ; 09
+ dw .Movement0a ; 0a
+ dw .Movement0b ; 0b
+ dw .Movement0c ; 0c
+ dw .Movement0d ; 0d
+ dw .Movement0e ; 0e
+ dw .Follow ; 0f
+ dw .Script ; 10
+ dw .Strength ; 11
+ dw .FollowNotExact ; 12
+ dw .MovementShadow ; 13
+ dw .MovementEmote ; 14
+ dw .MovementBigStanding ; 15
+ dw .MovementBouncing ; 16
+ dw .MovementScreenShake ; 17
+ dw .MovementSpinClockwise ; 18
+ dw .MovementSpinCounterclockwise ; 19
+ dw .MovementBoulderDust ; 1a
+ dw .MovementShakingGrass ; 1b
; 4821
.Null_00: ; 4821
@@ -1390,9 +1387,8 @@
ld e, a
ld d, 0
ld hl, .data_4a81
-rept 2
add hl,de
-endr
+ add hl,de
ld d, [hl]
inc hl
ld e, [hl]
@@ -1549,33 +1545,33 @@
Pointers4b45: ; 4b45
; These pointers use OBJECT_STEP_TYPE. See constants/sprite_constants.asm
- jumptable_start
- jumptable ObjectMovementReset ; 00
- jumptable MapObjectMovementPattern ; 01
- jumptable NPCStep ; 02 npc walk
- jumptable Function4ddd ; 03
- jumptable Function4e21 ; 04
- jumptable Function4e0c ; 05
- jumptable PlayerStep ; 06 player walk
- jumptable Function4e47 ; 07
- jumptable NPCJump ; 08 npc jump step
- jumptable PlayerJump ; 09 player jump step
- jumptable PlayerOrNPCHalfStep ; 0a half step
- jumptable Function4dff ; 0b
- jumptable TeleportFrom ; 0c teleport from
- jumptable TeleportTo ; 0d teleport to
- jumptable Skyfall ; 0e skyfall
- jumptable Function4ecd ; 0f
- jumptable GotBiteStep ; 10
- jumptable RockSmashStep ; 11
- jumptable ReturnDigStep ; 12
- jumptable Function4f04 ; 13
- jumptable Function4f33 ; 14
- jumptable Function4f33 ; 15
- jumptable Function4f77 ; 16
- jumptable Function4f7a ; 17
- jumptable Function4df0 ; 18
- jumptable SkyfallTop ; 19
+
+ dw ObjectMovementReset ; 00
+ dw MapObjectMovementPattern ; 01
+ dw NPCStep ; 02 npc walk
+ dw Function4ddd ; 03
+ dw Function4e21 ; 04
+ dw Function4e0c ; 05
+ dw PlayerStep ; 06 player walk
+ dw Function4e47 ; 07
+ dw NPCJump ; 08 npc jump step
+ dw PlayerJump ; 09 player jump step
+ dw PlayerOrNPCHalfStep ; 0a half step
+ dw Function4dff ; 0b
+ dw TeleportFrom ; 0c teleport from
+ dw TeleportTo ; 0d teleport to
+ dw Skyfall ; 0e skyfall
+ dw Function4ecd ; 0f
+ dw GotBiteStep ; 10
+ dw RockSmashStep ; 11
+ dw ReturnDigStep ; 12
+ dw Function4f04 ; 13
+ dw Function4f33 ; 14
+ dw Function4f33 ; 15
+ dw Function4f77 ; 16
+ dw Function4f7a ; 17
+ dw Function4df0 ; 18
+ dw SkyfallTop ; 19
; 4b79
Function4b79: ; 4b79
@@ -1591,7 +1587,7 @@
NPCJump: ; 4b86
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw Function4b8d
dw Function4ba9
; 4b8d
@@ -1628,7 +1624,7 @@
PlayerJump: ; 4bbf
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw .initjump
dw .stepjump
dw .initland
@@ -1680,7 +1676,7 @@
TeleportFrom: ; 4c18
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw Function4c23
dw Function4c32
dw Function4c42
@@ -1751,7 +1747,7 @@
TeleportTo: ; 4c89
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw Function4c9a
dw Function4caa
dw Function4cb3
@@ -1843,7 +1839,7 @@
Skyfall: ; 4d14
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw Function4d1f
dw Function4d2e
dw Function4d4f
@@ -1908,7 +1904,7 @@
GotBiteStep: ; 4d7e
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw Function4d85
dw Function4d94
; 4d85
@@ -2015,7 +2011,7 @@
Function4e0c: ; 4e0c
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw Function4e13
dw Function4e21
; 4e13
@@ -2065,7 +2061,7 @@
PlayerStep: ; 4e56
; AnimateStep?
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw .init
dw .step
; 4e5d
@@ -2095,7 +2091,7 @@
PlayerOrNPCHalfStep: ; 4e83
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw .init1
dw .step1
dw .init2
@@ -2211,7 +2207,7 @@
Function4f33: ; 4f33
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw Function4f3a
dw Function4f43
; 4f3a
@@ -2266,7 +2262,7 @@
Function4f7a: ; 4f7a
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw SkyfallTop
dw SkyfallTop
dw SkyfallTop
@@ -2274,7 +2270,7 @@
SkyfallTop: ; 4f83
call Object28AnonymousJumptable
-; anonymous jumptable
+; anonymous dw
dw Function4f8a
dw Function4f99
; 4f8a
@@ -3060,9 +3056,8 @@
ret z
ld a, [wPlayerSpriteSetupFlags]
and 3
-rept 2
add a
-endr
+ add a
jr ContinueSpawnFacing
; 57d9
@@ -3650,9 +3645,8 @@
ld c, a
ld b, 0
ld hl, .Addresses
-rept 2
add hl,bc
-endr
+ add hl,bc
ld c, [hl]
inc hl
ld b, [hl]
--- a/engine/map_setup.asm
+++ b/engine/map_setup.asm
@@ -6,9 +6,8 @@
ld c, a
ld b, 0
ld hl, MapSetupScripts
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
--- a/engine/mart.asm
+++ b/engine/mart.asm
@@ -841,12 +841,12 @@
.TryToSellItem: ; 15ee0
callba CheckItemMenu
ld a, [wItemAttributeParamBuffer]
- ld hl, .jumptable
+ ld hl, .dw
rst JumpTable
ret
; 15eee
-.jumptable: ; 15eee
+.dw: ; 15eee
dw .try_sell
dw .cant_buy
dw .cant_buy
--- a/engine/mon_icons.asm
+++ b/engine/mon_icons.asm
@@ -27,7 +27,7 @@
Function8e849: ; 8e849
ld d, 0
- ld hl, .jumptable
+ ld hl, .dw
rept 2
add hl, de
endr
@@ -38,7 +38,7 @@
; 8e854
-.jumptable: ; 8e854 (23:6854)
+.dw: ; 8e854 (23:6854)
dw Function8e8d5 ; init
dw Function8e961
dw Function8e97d
--- a/engine/move_mon.asm
+++ b/engine/move_mon.asm
@@ -193,9 +193,8 @@
inc de
push hl
push de
-rept 2
inc hl
-endr
+ inc hl
call FillPP
pop de
pop hl
@@ -636,9 +635,8 @@
ld a, [CurPartySpecies]
cp EGG
jr z, .egg
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld [de], a
ld a, [hl]
@@ -1423,9 +1421,8 @@
ld a, c
cp STAT_SDEF
jr nz, .not_spdef
-rept 2
dec hl
-endr
+ dec hl
.not_spdef
sla c
@@ -1469,9 +1466,8 @@
ld b, a
ld a, [hli]
and $1
-rept 2
add a
-endr
+ add a
add b
ld b, a
ld a, [hl]
@@ -1673,9 +1669,8 @@
ld a, [ScriptBank]
call FarCopyBytes
pop hl
-rept 2
inc hl
-endr
+ inc hl
ld a, [ScriptBank]
call GetFarHalfword
pop bc
--- a/engine/mysterygift.asm
+++ b/engine/mysterygift.asm
@@ -211,9 +211,8 @@
ld hl, sDailyMysteryGiftPartnerIDs ; inc hl
ld e, a
ld d, $0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wMysteryGiftPartnerID]
ld [hli], a
ld a, [wMysteryGiftPartnerID + 1]
@@ -1062,9 +1061,8 @@
Function105038: ; 105038 (41:5038)
ld a, $20
ld [rJOYP], a
-rept 2
ld a, [rJOYP]
-endr
+ ld a, [rJOYP]
cpl
and $f
swap a
--- a/engine/pack.asm
+++ b/engine/pack.asm
@@ -28,18 +28,18 @@
; 10030
.Jumptable: ; 10030 (4:4030)
- jumptable_start
- jumptable .InitGFX ; 0
- jumptable .InitItemsPocket ; 1
- jumptable .ItemsPocketMenu ; 2
- jumptable .InitBallsPocket ; 3
- jumptable .BallsPocketMenu ; 4
- jumptable .InitKeyItemsPocket ; 5
- jumptable .KeyItemsPocketMenu ; 6
- jumptable .InitTMHMPocket ; 7
- jumptable .TMHMPocketMenu ; 8
- jumptable Pack_QuitNoScript ; 9
- jumptable Pack_QuitRunScript ; 10
+
+ dw .InitGFX ; 0
+ dw .InitItemsPocket ; 1
+ dw .ItemsPocketMenu ; 2
+ dw .InitBallsPocket ; 3
+ dw .BallsPocketMenu ; 4
+ dw .InitKeyItemsPocket ; 5
+ dw .KeyItemsPocketMenu ; 6
+ dw .InitTMHMPocket ; 7
+ dw .TMHMPocketMenu ; 8
+ dw Pack_QuitNoScript ; 9
+ dw Pack_QuitRunScript ; 10
.InitGFX: ; 10046 (4:4046)
xor a
@@ -163,9 +163,9 @@
; 0x10137
.Jumptable1: ; 10137
- jumptable_start
- jumptable .UseItem
- jumptable QuitItemSubmenu
+
+ dw .UseItem
+ dw QuitItemSubmenu
; 1013b
@@ -328,12 +328,12 @@
; 0x1026a
Jumptable_UseGiveTossRegisterQuit: ; 1026a
- jumptable_start
- jumptable UseItem
- jumptable GiveItem
- jumptable TossMenu
- jumptable RegisterItem
- jumptable QuitItemSubmenu
+
+ dw UseItem
+ dw GiveItem
+ dw TossMenu
+ dw RegisterItem
+ dw QuitItemSubmenu
; 10274
MenuDataHeader_UsableItem: ; 0x10274
@@ -354,11 +354,11 @@
; 0x10291
Jumptable_UseGiveTossQuit: ; 10291
- jumptable_start
- jumptable UseItem
- jumptable GiveItem
- jumptable TossMenu
- jumptable QuitItemSubmenu
+
+ dw UseItem
+ dw GiveItem
+ dw TossMenu
+ dw QuitItemSubmenu
; 10299
MenuDataHeader_UnusableItem: ; 0x10299
@@ -377,9 +377,9 @@
; 0x102ac
Jumptable_UseQuit: ; 102ac
- jumptable_start
- jumptable UseItem
- jumptable QuitItemSubmenu
+
+ dw UseItem
+ dw QuitItemSubmenu
; 102b0
MenuDataHeader_UnusableKeyItem: ; 0x102b0
@@ -399,10 +399,10 @@
; 0x102c7
Jumptable_UseRegisterQuit: ; 102c7
- jumptable_start
- jumptable UseItem
- jumptable RegisterItem
- jumptable QuitItemSubmenu
+
+ dw UseItem
+ dw RegisterItem
+ dw QuitItemSubmenu
; 102cd
MenuDataHeader_HoldableKeyItem: ; 0x102cd
@@ -423,11 +423,11 @@
; 0x102ea
Jumptable_GiveTossRegisterQuit: ; 102ea
- jumptable_start
- jumptable GiveItem
- jumptable TossMenu
- jumptable RegisterItem
- jumptable QuitItemSubmenu
+
+ dw GiveItem
+ dw TossMenu
+ dw RegisterItem
+ dw QuitItemSubmenu
; 102f2
MenuDataHeader_HoldableItem: ; 0x102f2
@@ -447,10 +447,10 @@
; 0x1030b
Jumptable_GiveTossQuit: ; 1030b
- jumptable_start
- jumptable GiveItem
- jumptable TossMenu
- jumptable QuitItemSubmenu
+
+ dw GiveItem
+ dw TossMenu
+ dw QuitItemSubmenu
; 10311
@@ -457,20 +457,20 @@
UseItem: ; 10311
callba CheckItemMenu
ld a, [wItemAttributeParamBuffer]
- ld hl, .jumptable
+ ld hl, .dw
rst JumpTable
ret
; 1031f
-.jumptable: ; 1031f (4:431f)
- jumptable_start
- jumptable .Oak
- jumptable .Oak
- jumptable .Oak
- jumptable .Oak
- jumptable .Current
- jumptable .Party
- jumptable .Field
+.dw: ; 1031f (4:431f)
+
+ dw .Oak
+ dw .Oak
+ dw .Oak
+ dw .Oak
+ dw .Current
+ dw .Party
+ dw .Field
; 1035c
.Oak: ; 1032d (4:432d)
@@ -694,18 +694,18 @@
; 104c3
.Jumptable: ; 104c3 (4:44c3)
- jumptable_start
- jumptable .InitGFX ; 0
- jumptable .InitItemsPocket ; 1
- jumptable .ItemsPocketMenu ; 2
- jumptable .InitBallsPocket ; 3
- jumptable .BallsPocketMenu ; 4
- jumptable .InitKeyItemsPocket ; 5
- jumptable .KeyItemsPocketMenu ; 6
- jumptable .InitTMHMPocket ; 7
- jumptable .TMHMPocketMenu ; 8
- jumptable Pack_QuitNoScript ; 9
- jumptable Pack_QuitRunScript ; 10
+
+ dw .InitGFX ; 0
+ dw .InitItemsPocket ; 1
+ dw .ItemsPocketMenu ; 2
+ dw .InitBallsPocket ; 3
+ dw .BallsPocketMenu ; 4
+ dw .InitKeyItemsPocket ; 5
+ dw .KeyItemsPocketMenu ; 6
+ dw .InitTMHMPocket ; 7
+ dw .TMHMPocketMenu ; 8
+ dw Pack_QuitNoScript ; 9
+ dw Pack_QuitRunScript ; 10
.InitGFX: ; 104d9 (4:44d9)
xor a
@@ -865,9 +865,9 @@
; 0x10614
.UsableJumptable: ; 10614
- jumptable_start
- jumptable .Use
- jumptable .Quit
+
+ dw .Use
+ dw .Quit
; 10618
.UnusableMenuDataHeader: ; 0x10618
@@ -885,8 +885,8 @@
; 0x10627
.UnusableJumptable: ; 10627
- jumptable_start
- jumptable .Quit
+
+ dw .Quit
; 10629
.Use: ; 10629
@@ -897,14 +897,14 @@
ret
.ItemFunctionJumptable: ; 10637 (4:4637)
- jumptable_start
- jumptable .Oak
- jumptable .Oak
- jumptable .Oak
- jumptable .Oak
- jumptable .Unused
- jumptable .BattleField
- jumptable .BattleOnly
+
+ dw .Oak
+ dw .Oak
+ dw .Oak
+ dw .Oak
+ dw .Unused
+ dw .BattleField
+ dw .BattleOnly
.Oak: ; 10645 (4:4645)
ld hl, Text_ThisIsntTheTime
@@ -942,7 +942,7 @@
cp $2
jr z, .didnt_use_item
.quit_run_script: ; 1067e (4:467e)
- ld a, Pack_QuitRunScriptTableIndex
+ ld a, 10
ld [wJumptableIndex], a
ret
@@ -1002,11 +1002,11 @@
; 106d1
.Jumptable: ; 106d1 (4:46d1)
- jumptable_start
- jumptable .ItemsPocket
- jumptable .BallsPocket
- jumptable .KeyItemsPocket
- jumptable .TMHMPocket
+
+ dw .ItemsPocket
+ dw .BallsPocket
+ dw .KeyItemsPocket
+ dw .TMHMPocket
.ItemsPocket: ; 106d9 (4:46d9)
xor a
call InitPocket
@@ -1142,18 +1142,18 @@
.RunJumptable: ; 107d7
ld a, [wJumptableIndex]
- ld hl, .jumptable
+ ld hl, .dw
call Pack_GetJumptablePointer
jp [hl]
; 107e1
-.jumptable: ; 107e1 (4:47e1)
- jumptable_start
- jumptable .Items
- jumptable .Balls
- jumptable .KeyItems
- jumptable .TMHM
+.dw: ; 107e1 (4:47e1)
+
+ dw .Items
+ dw .Balls
+ dw .KeyItems
+ dw .TMHM
.Items: ; 107e9 (4:47e9)
xor a
@@ -1351,7 +1351,7 @@
ret
.b_button
- ld a, Pack_QuitNoScriptTableIndex
+ ld a, 9
ld [wJumptableIndex], a
scf
ret
--- a/engine/player_step.asm
+++ b/engine/player_step.asm
@@ -59,19 +59,19 @@
ret
.Jumptable: ; d4f2 (3:54f2)
- jumptable_start
- jumptable GetMovementPermissions
- jumptable BufferScreen
- jumptable .mobile
- jumptable .fail2
+
+ dw GetMovementPermissions
+ dw BufferScreen
+ dw .mobile
+ dw .fail2
; The rest are never used. Ever.
- jumptable .fail1
- jumptable .fail1
- jumptable .fail1
- jumptable .fail1
- jumptable .fail1
- jumptable .fail1
- jumptable .fail1
+ dw .fail1
+ dw .fail1
+ dw .fail1
+ dw .fail1
+ dw .fail1
+ dw .fail1
+ dw .fail1
.fail1: ; d508 (3:5508)
ret
--- a/engine/pokecenter_pc.asm
+++ b/engine/pokecenter_pc.asm
@@ -472,7 +472,7 @@
ld [wSpriteUpdatesEnabled], a
callba CheckItemMenu
ld a, [wItemAttributeParamBuffer]
- ld hl, .jumptable
+ ld hl, .dw
rst JumpTable
pop af
ld [wSpriteUpdatesEnabled], a
@@ -479,7 +479,7 @@
ret
; 0x158e7
-.jumptable: ; 0x158e7
+.dw: ; 0x158e7
dw .tossable
dw .no_toss
dw .no_toss
--- a/engine/printer.asm
+++ b/engine/printer.asm
@@ -32,27 +32,27 @@
.Jumptable: ; 84031 (21:4031)
- jumptable_start
- jumptable Function84077
- jumptable Function84143
- jumptable Function84120
- jumptable Function84099
- jumptable Function84180
- jumptable Function8412e
- jumptable Function840c5
- jumptable Function84180
- jumptable Function84120
- jumptable Function840de
- jumptable Function84180
- jumptable Function84120
- jumptable Function841a1
- jumptable Function84063
- jumptable Function8406d
- jumptable Function84120
- jumptable Function84103
- jumptable Function84071
- jumptable Function841b0
- jumptable Function841b3
+
+ dw Function84077
+ dw Function84143
+ dw Function84120
+ dw Function84099
+ dw Function84180
+ dw Function8412e
+ dw Function840c5
+ dw Function84180
+ dw Function84120
+ dw Function840de
+ dw Function84180
+ dw Function84120
+ dw Function841a1
+ dw Function84063
+ dw Function8406d
+ dw Function84120
+ dw Function84103
+ dw Function84071
+ dw Function841b0
+ dw Function841b3
Function84059: ; 84059 (21:4059)
@@ -443,39 +443,39 @@
.Jumptable: ; 842ea (21:42ea)
- jumptable_start
- jumptable Function8432f
- jumptable Function84330
- jumptable Function84339
- jumptable Function84343
- jumptable Function8434d
- jumptable Function84357
- jumptable Function84361
- jumptable Function8438b
- jumptable Function84395
- jumptable Function8439f
- jumptable Function843a8
- jumptable Function843b6
- jumptable Function84330
- jumptable Function843c0
- jumptable Function843c9
- jumptable Function843c9
- jumptable Function843c9
- jumptable Function843c0
- jumptable Function843c9
- jumptable Function8439f
- jumptable Function843a8
- jumptable Function843e6
- jumptable Function84330
- jumptable Function843d2
- jumptable Function843c9
- jumptable Function843c9
- jumptable Function843c9
- jumptable Function843d2
- jumptable Function843c9
- jumptable Function8439f
- jumptable Function843a8
- jumptable Function843b6
+
+ dw Function8432f
+ dw Function84330
+ dw Function84339
+ dw Function84343
+ dw Function8434d
+ dw Function84357
+ dw Function84361
+ dw Function8438b
+ dw Function84395
+ dw Function8439f
+ dw Function843a8
+ dw Function843b6
+ dw Function84330
+ dw Function843c0
+ dw Function843c9
+ dw Function843c9
+ dw Function843c9
+ dw Function843c0
+ dw Function843c9
+ dw Function8439f
+ dw Function843a8
+ dw Function843e6
+ dw Function84330
+ dw Function843d2
+ dw Function843c9
+ dw Function843c9
+ dw Function843c9
+ dw Function843d2
+ dw Function843c9
+ dw Function8439f
+ dw Function843a8
+ dw Function843b6
Function8432a: ; 8432a (21:432a)
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -862,9 +862,8 @@
ld c, a
ld b, 0
ld hl, WalkingX
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1127,9 +1126,8 @@
ld e, a
callba GetRelativeFacing
ld a, d
-rept 2
add a
-endr
+ add a
ld e, a
ld a, [hLastTalked]
ld d, a
@@ -1162,9 +1160,8 @@
pop bc
ret c
ld a, d
-rept 2
add a
-endr
+ add a
ld e, a
ld d, c
call ApplyPersonFacing
@@ -1185,9 +1182,8 @@
.ok
ld d, a
call GetScriptByte
-rept 2
add a
-endr
+ add a
ld e, a
call ApplyPersonFacing
ret
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -211,43 +211,29 @@
; 92844
SlotsJumptable: ; 92844 (24:6844)
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wJumptableIndex
-; 92853 (24:6853)
+.Jumptable
+ dw Slots_Init ; 00
+ dw Slots_BetAndStart ; 01
+ dw Slots_WaitStart ; 02
+ dw Slots_WaitReel1 ; 03
+ dw Slots_WaitStopReel1 ; 04
+ dw Slots_WaitReel2 ; 05
+ dw Slots_WaitStopReel2 ; 06
+ dw Slots_WaitReel3 ; 07
+ dw Slots_WaitStopReel3 ; 08
+ dw Slots_Next ; 09
+ dw Slots_Next ; 0a
+ dw Slots_Next ; 0b
+ dw Slots_FlashIfWin ; 0c
+ dw Slots_FlashScreen ; 0d
+ dw Slots_GiveEarnedCoins ; 0e
+ dw Slots_PayoutTextAndAnim ; 0f
+ dw Slots_PayoutAnim ; 10
+ dw Slots_RestartOrQuit ; 11
+ dw Slots_Quit ; 12
-
-.Jumptable: ; 92853 (24:6853)
- jumptable_start
- jumptable Slots_Init ; 00
- jumptable Slots_BetAndStart ; 01
- jumptable Slots_WaitStart ; 02
- jumptable Slots_WaitReel1 ; 03
- jumptable Slots_WaitStopReel1 ; 04
- jumptable Slots_WaitReel2 ; 05
- jumptable Slots_WaitStopReel2 ; 06
- jumptable Slots_WaitReel3 ; 07
- jumptable Slots_WaitStopReel3 ; 08
- jumptable Slots_Next ; 09
- jumptable Slots_Next ; 0a
- jumptable Slots_Next ; 0b
- jumptable Slots_FlashIfWin ; 0c
- jumptable Slots_FlashScreen ; 0d
- jumptable Slots_GiveEarnedCoins ; 0e
- jumptable Slots_PayoutTextAndAnim ; 0f
- jumptable Slots_PayoutAnim ; 10
- jumptable Slots_RestartOrQuit ; 11
- jumptable Slots_Quit ; 12
-
Slots_Next: ; 92879 (24:6879)
ld hl, wJumptableIndex
inc [hl]
@@ -265,7 +251,7 @@
Slots_BetAndStart: ; 9288e (24:688e)
call Slots_AskBet
jr nc, .proceed
- ld a, Slots_QuitTableIndex
+ ld a, 18
ld [wJumptableIndex], a
ret
@@ -275,7 +261,7 @@
call Slots_InitBias
ld a, 32
ld [wcf64], a
- ld a, 4 ; ReelAction_NormalRateTableIndex
+ ld a, 4
ld [wReel1ReelAction], a
ld [wReel2ReelAction], a
ld [wReel3ReelAction], a
@@ -455,12 +441,12 @@
call WaitPressAorB_BlinkCursor
call Slots_AskPlayAgain
jr c, .exit_slots
- ld a, Slots_InitTableIndex
+ ld a, 0
ld [wJumptableIndex], a
ret
.exit_slots
- ld a, Slots_QuitTableIndex
+ ld a, 18
ld [wJumptableIndex], a
ret
@@ -804,10 +790,9 @@
add hl, bc
ld e, [hl]
ld d, 0
- ld hl, .jumptable
-rept 2
+ ld hl, .dw
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -815,40 +800,33 @@
; 92be4 (24:6be4)
-.jumptable: ; 92be4
- jumptable_start
- jumptable ReelAction_DoNothing ; 00
- jumptable Slots_StopReelIgnoreJoypad ; 01
-
- jumptable ReelAction_QuadrupleRate ; 02
- jumptable ReelAction_DoubleRate ; 03
- jumptable ReelAction_NormalRate ; 04
- jumptable ReelAction_HalfRate ; 05
- jumptable ReelAction_QuarterRate ; 06
-
- jumptable ReelAction_StopReel1 ; 07
- jumptable ReelAction_StopReel2 ; 08
- jumptable ReelAction_StopReel3 ; 09
-
- jumptable ReelAction_SetUpReel2SkipTo7 ; 0a
- jumptable ReelAction_WaitReel2SkipTo7 ; 0b
- jumptable ReelAction_FastSpinReel2UntilLinedUp7s ; 0c
-
- jumptable ReelAction_BoringReelDrops ; 0d
- jumptable ReelAction_CheckDropReel ; 0e
- jumptable ReelAction_WaitDropReel ; 0f
-
- jumptable ReelAction_StartSlowAdvanceReel3 ; 10
- jumptable ReelAction_WaitSlowAdvanceReel3 ; 11
-
- jumptable ReelAction_InitGolem ; 12
- jumptable ReelAction_WaitGolem ; 13
- jumptable ReelAction_EndGolem ; 14
-
- jumptable Slots_InitChansey ; 15
- jumptable ReelAction_WaitChansey ; 16
- jumptable ReelAction_WaitEgg ; 17
- jumptable ReelAction_DropReel ; 18
+.dw: ; 92be4
+
+ dw ReelAction_DoNothing ; 00
+ dw Slots_StopReelIgnoreJoypad ; 01
+ dw ReelAction_QuadrupleRate ; 02
+ dw ReelAction_DoubleRate ; 03
+ dw ReelAction_NormalRate ; 04
+ dw ReelAction_HalfRate ; 05
+ dw ReelAction_QuarterRate ; 06
+ dw ReelAction_StopReel1 ; 07
+ dw ReelAction_StopReel2 ; 08
+ dw ReelAction_StopReel3 ; 09
+ dw ReelAction_SetUpReel2SkipTo7 ; 0a
+ dw ReelAction_WaitReel2SkipTo7 ; 0b
+ dw ReelAction_FastSpinReel2UntilLinedUp7s ; 0c
+ dw ReelAction_BoringReelDrops ; 0d
+ dw ReelAction_CheckDropReel ; 0e
+ dw ReelAction_WaitDropReel ; 0f
+ dw ReelAction_StartSlowAdvanceReel3 ; 10
+ dw ReelAction_WaitSlowAdvanceReel3 ; 11
+ dw ReelAction_InitGolem ; 12
+ dw ReelAction_WaitGolem ; 13
+ dw ReelAction_EndGolem ; 14
+ dw Slots_InitChansey ; 15
+ dw ReelAction_WaitChansey ; 16
+ dw ReelAction_WaitEgg ; 17
+ dw ReelAction_DropReel ; 18
; 92c16
ReelAction_DoNothing: ; 92c16
@@ -1205,9 +1183,8 @@
ld [hl], $0
ld hl, wReel1ReelAction - wReel1
add hl, bc
-rept 2
dec [hl]
-endr
+ dec [hl]
ld a, $1
ld [wcf64], a
ret
@@ -1327,9 +1304,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1347,11 +1323,11 @@
; 92ebd
.Jumptable: ; 92ebd
- jumptable_start
- jumptable .zero
- jumptable .one
- jumptable .two
- jumptable .three
+
+ dw .zero
+ dw .one
+ dw .two
+ dw .three
; 92ec5
.three: ; 92ec5
@@ -1439,9 +1415,8 @@
ld e, a
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1463,11 +1438,11 @@
; 92f48
.Jumptable: ; 92f48
- jumptable_start
- jumptable .zero
- jumptable .one
- jumptable .two
- jumptable .three
+
+ dw .zero
+ dw .one
+ dw .two
+ dw .three
; 92f50
.three: ; 92f50
@@ -1978,9 +1953,8 @@
ld e, [hl]
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1987,10 +1961,10 @@
jp [hl]
.Jumptable: ; 9322d (24:722d)
- jumptable_start
- jumptable .init
- jumptable .fall
- jumptable .roll
+
+ dw .init
+ dw .fall
+ dw .roll
.init: ; 93233 (24:7233)
@@ -2051,9 +2025,8 @@
ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
-rept 2
inc [hl]
-endr
+ inc [hl]
cp 9 * 8
jr nc, .restart
and $3
@@ -2081,9 +2054,8 @@
ld e, [hl]
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2090,10 +2062,10 @@
jp [hl]
.Jumptable: ; 932bc (24:72bc)
- jumptable_start
- jumptable .walk
- jumptable .one
- jumptable .two
+
+ dw .walk
+ dw .one
+ dw .two
.walk: ; 932c2 (24:72c2)
--- a/engine/sprite_anims.asm
+++ b/engine/sprite_anims.asm
@@ -4,9 +4,8 @@
ld e, [hl]
ld d, 0
ld hl, .Jumptable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -13,44 +12,43 @@
jp [hl]
; 8d25b
-
.Jumptable: ; 8d25b (23:525b)
- jumptable_start
- jumptable .Null ; null
- jumptable .one ; bouncing mon icon
- jumptable .two ; bouncing mon icon, selected
- jumptable .three ; bouncing mon icon, menu open
- jumptable .four
- jumptable .five
- jumptable .GameFreakLogo ; Game Freak logo
- jumptable .seven
- jumptable .eight
- jumptable .SlotsGolem ; Something to do with slots
- jumptable .SlotsChansey ; Something to do with slots
- jumptable .SlotsChanseyEgg ; Something to do with slots
- jumptable .twelve ; blinking cursor
- jumptable .thirteen
- jumptable .fourteen
- jumptable .fifteen
- jumptable .sixteen
- jumptable .seventeen
- jumptable .eighteen
- jumptable .EggShell ; finish egg hatching animation
- jumptable .RadioTuningKnob ; radio tuning knob
- jumptable .twentyone ; cut grass leaves
- jumptable .FlyFrom ; flying sprite
- jumptable .FlyLeaf ; flying leaves
- jumptable .FlyTo ; fly to
- jumptable .twentyfive
- jumptable .twentysix
- jumptable .twentyseven
- jumptable .twentyeight
- jumptable .twentynine ; intro suicune
- jumptable .thirty ; intro pichu wooper
- jumptable .thirtyone ; celebi
- jumptable .thirtytwo ; intro unown
- jumptable .thirtythree ; intro unown F with suicune leaping up
- jumptable .thirtyfour ; intro suicune facing away from us
+
+ dw .Null ; null
+ dw .one ; bouncing mon icon
+ dw .two ; bouncing mon icon, selected
+ dw .three ; bouncing mon icon, menu open
+ dw .four
+ dw .five
+ dw .GameFreakLogo ; Game Freak logo
+ dw .seven
+ dw .eight
+ dw .SlotsGolem ; Something to do with slots
+ dw .SlotsChansey ; Something to do with slots
+ dw .SlotsChanseyEgg ; Something to do with slots
+ dw .twelve ; blinking cursor
+ dw .thirteen
+ dw .fourteen
+ dw .fifteen
+ dw .sixteen
+ dw .seventeen
+ dw .eighteen
+ dw .EggShell ; finish egg hatching animation
+ dw .RadioTuningKnob ; radio tuning knob
+ dw .twentyone ; cut grass leaves
+ dw .FlyFrom ; flying sprite
+ dw .FlyLeaf ; flying leaves
+ dw .FlyTo ; fly to
+ dw .twentyfive
+ dw .twentysix
+ dw .twentyseven
+ dw .twentyeight
+ dw .twentynine ; intro suicune
+ dw .thirty ; intro pichu wooper
+ dw .thirtyone ; celebi
+ dw .thirtytwo ; intro unown
+ dw .thirtythree ; intro unown F with suicune leaping up
+ dw .thirtyfour ; intro suicune facing away from us
.Null: ; 8d2a1 (23:52a1)
@@ -135,11 +133,11 @@
ret
.four: ; 8d302 (23:5302)
- call .anonymous_jumptable
+ call .anonymous_dw
jp [hl]
; 8d306 (23:5306)
-; Anonymous jumptable (see .anonymous_jumptable)
+; Anonymous dw (see .anonymous_dw)
dw .four_zero
dw .four_one
; 8d30a
@@ -237,9 +235,8 @@
ld a, [hl]
and a
jr z, .asm_8d3ba
-rept 2
dec [hl]
-endr
+ dec [hl]
ld d, a
and $1f
jr nz, .asm_8d395
@@ -420,11 +417,11 @@
ret
.sixteen: ; 8d483 (23:5483)
- call .anonymous_jumptable
+ call .anonymous_dw
jp [hl]
; 8d487 (23:5487)
-; Anonymous jumptable (see .anonymous_jumptable)
+; Anonymous dw (see .anonymous_dw)
dw .sixteen_zero
dw .sixteen_one
dw .sixteen_two
@@ -554,9 +551,8 @@
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [hl]
-rept 2
inc [hl]
-endr
+ inc [hl]
cp $b0
jr nc, .asm_8d53f
and $3
@@ -669,9 +665,8 @@
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
-rept 2
dec [hl]
-endr
+ dec [hl]
ld hl, SPRITEANIMSTRUCT_0F
add hl, bc
@@ -699,9 +694,8 @@
ld a, [hl]
cp -9 * 8
jr nc, .delete_leaf
-rept 2
inc [hl]
-endr
+ inc [hl]
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
@@ -732,9 +726,8 @@
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
-rept 2
inc [hl]
-endr
+ inc [hl]
ld hl, SPRITEANIMSTRUCT_0F
add hl, bc
@@ -861,7 +854,7 @@
callba UpdateCelebiPosition
ret
-.anonymous_jumptable: ; 8d6c5 (23:56c5)
+.anonymous_dw: ; 8d6c5 (23:56c5)
ld hl, [sp+$0]
ld e, [hl]
inc hl
--- a/engine/sprites.asm
+++ b/engine/sprites.asm
@@ -46,7 +46,7 @@
ld b, h
push hl
push de
- call DoAnimFrame ; Uses a massive jumptable
+ call DoAnimFrame ; Uses a massive dw
call UpdateAnimFrame
pop de
pop hl
@@ -86,7 +86,7 @@
ld b, h
push hl
push de
- call DoAnimFrame ; Uses a massive jumptable
+ call DoAnimFrame ; Uses a massive dw
call UpdateAnimFrame
pop de
pop hl
@@ -188,13 +188,11 @@
ld [hli], a
; load 0 into the next four fields
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
; load -1 into the next field
dec a
ld [hli], a
@@ -478,9 +476,8 @@
ld hl, SPRITEANIMSTRUCT_FRAME
add hl, bc
-rept 2
dec [hl]
-endr
+ dec [hl]
jr .loop
.restart
@@ -505,9 +502,8 @@
ld e, [hl]
ld d, 0
ld hl, SpriteAnimFrameData
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -536,9 +532,8 @@
push hl
ld l, a
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld de, BrokenStdGFXPointers ; broken 2bpp pointers
add hl, de
ld c, [hl]
@@ -635,9 +630,8 @@
ld a, d
ld d, 0
ld hl, .sinewave
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -677,9 +671,8 @@
call .AnimateFrame
call DelayFrame
pop bc
-rept 2
inc d
-endr
+ inc d
dec c
jr nz, .loop
call ClearSprites
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -50,9 +50,8 @@
ld hl, .MenuReturns
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -235,9 +234,8 @@
push de
ld a, [MenuSelection]
call .GetMenuAccountTextPointer
-rept 2
inc hl
-endr
+ inc hl
ld a, [hli]
ld d, [hl]
ld e, a
--- a/engine/stats_screen.asm
+++ b/engine/stats_screen.asm
@@ -100,15 +100,15 @@
; 4dd2a
StatsScreenPointerTable: ; 4dd2a
- jumptable_start
- jumptable MonStatsInit ; regular pokémon
- jumptable EggStatsInit ; egg
- jumptable StatsScreenWaitCry
- jumptable EggStatsJoypad
- jumptable StatsScreen_LoadPage
- jumptable StatsScreenWaitCry
- jumptable MonStatsJoypad
- jumptable StatsScreen_Exit
+
+ dw MonStatsInit ; regular pokémon
+ dw EggStatsInit ; egg
+ dw StatsScreenWaitCry
+ dw EggStatsJoypad
+ dw StatsScreen_LoadPage
+ dw StatsScreenWaitCry
+ dw MonStatsJoypad
+ dw StatsScreen_Exit
; 4dd3a
@@ -157,12 +157,12 @@
call StatsScreen_InitUpperHalf
ld hl, wcf64
set 4, [hl]
- ld h, StatsScreen_LoadPageTableIndex
+ ld h, 4
call StatsScreen_SetJumptableIndex
ret
.egg
- ld h, EggStatsInitTableIndex
+ ld h, 1
call StatsScreen_SetJumptableIndex
ret
@@ -178,7 +178,7 @@
EggStatsJoypad: ; 4ddac (13:5dac)
call StatsScreen_GetJoypad
jr nc, .check
- ld h, MonStatsInitTableIndex
+ ld h, 0
call StatsScreen_SetJumptableIndex
ret
@@ -189,7 +189,7 @@
jp StatsScreen_JoypadAction
.quit
- ld h, StatsScreen_ExitTableIndex
+ ld h, 7
call StatsScreen_SetJumptableIndex
ret
@@ -205,7 +205,7 @@
MonStatsJoypad: ; 4ddd6 (13:5dd6)
call StatsScreen_GetJoypad
jr nc, .next
- ld h, MonStatsInitTableIndex
+ ld h, 0
call StatsScreen_SetJumptableIndex
ret
@@ -360,17 +360,17 @@
and %11111100
or c
ld [wcf64], a
- ld h, StatsScreen_LoadPageTableIndex
+ ld h, 4
call StatsScreen_SetJumptableIndex
ret
.load_mon
- ld h, MonStatsInitTableIndex
+ ld h, 0
call StatsScreen_SetJumptableIndex
ret
.b_button: ; 4dee4 (13:5ee4)
- ld h, StatsScreen_ExitTableIndex
+ ld h, 7
call StatsScreen_SetJumptableIndex
ret
@@ -535,10 +535,10 @@
ret
.Jumptable: ; 4e00d (13:600d)
- jumptable_start
- jumptable .PinkPage
- jumptable .GreenPage
- jumptable .BluePage
+
+ dw .PinkPage
+ dw .GreenPage
+ dw .BluePage
.PinkPage: ; 4e013 (13:6013)
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -189,7 +189,7 @@
; Let LCD Stat know we're messing around with SCX
ld a, rSCX - rJOYP
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
pop af
ld [rSVBK], a
--- a/engine/unown_puzzle.asm
+++ b/engine/unown_puzzle.asm
@@ -188,8 +188,8 @@
; e12d9
.Jumptable: ; e12d9
- jumptable_start
- jumptable .Function
+
+ dw .Function
; e12db
.Function: ; e12db
--- a/event/daycare.asm
+++ b/event/daycare.asm
@@ -273,9 +273,8 @@
ld e, a
ld d, 0
ld hl, .TextTable
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -780,9 +779,8 @@
ld hl, wEggMonHappiness
ld [hli], a
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ld a, [CurPartyLevel]
ld [wEggMonLevel], a
--- a/event/field_moves.asm
+++ b/event/field_moves.asm
@@ -163,7 +163,7 @@
ld a, [wJumptableIndex]
ld e, a
ld d, 0
- ld hl, .jumptable
+ ld hl, .dw
rept 2
add hl, de
endr
@@ -174,7 +174,7 @@
; 8ca1b
-.jumptable: ; 8ca1b (23:4a1b)
+.dw: ; 8ca1b (23:4a1b)
dw Cut_SpawnAnimateTree
dw Cut_SpawnAnimateLeaves
dw Cut_StartWaiting
--- a/event/magnet_train.asm
+++ b/event/magnet_train.asm
@@ -61,9 +61,9 @@
ld [hVBlank], a
call ClearBGPalettes
xor a
- ld [hLCDStatCustom], a
- ld [hLCDStatCustom + 1], a
- ld [hLCDStatCustom + 2], a
+ ld [hFFC6], a
+ ld [hFFC7], a
+ ld [hFFC8], a
ld [hSCX], a
ld [Requested2bppSource], a
ld [Requested2bppSource + 1], a
@@ -254,7 +254,7 @@
ld a, [wMagnetTrainInitPosition]
call ByteFill
ld a, $43
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ret
; 8cdc3
@@ -306,14 +306,14 @@
; 8ce06
.Jumptable: ; 8ce06
- jumptable_start
- jumptable .InitPlayerSpriteAnim
- jumptable .WaitScene
- jumptable .MoveTrain1
- jumptable .WaitScene
- jumptable .MoveTrain2
- jumptable .WaitScene
- jumptable .TrainArrived
+
+ dw .InitPlayerSpriteAnim
+ dw .WaitScene
+ dw .MoveTrain1
+ dw .WaitScene
+ dw .MoveTrain2
+ dw .WaitScene
+ dw .TrainArrived
; 8ce14
.Next: ; 8ce14
--- a/event/mom.asm
+++ b/event/mom.asm
@@ -22,7 +22,7 @@
ld a, [wJumptableIndex]
ld e, a
ld d, 0
- ld hl, .jumptable
+ ld hl, .dw
rept 2
add hl, de
endr
@@ -32,17 +32,17 @@
jp [hl]
; 16242
-.jumptable: ; 16242
- jumptable_start
- jumptable .CheckIfBankInitialized
- jumptable .InitializeBank
- jumptable .IsThisAboutYourMoney
- jumptable .AccessBankOfMom
- jumptable .StoreMoney
- jumptable .TakeMoney
- jumptable .StopOrStartSavingMoney
- jumptable .AskDST
- jumptable .JustDoWhatYouCan
+.dw: ; 16242
+
+ dw .CheckIfBankInitialized
+ dw .InitializeBank
+ dw .IsThisAboutYourMoney
+ dw .AccessBankOfMom
+ dw .StoreMoney
+ dw .TakeMoney
+ dw .StopOrStartSavingMoney
+ dw .AskDST
+ dw .JustDoWhatYouCan
; 16254
.CheckIfBankInitialized: ; 16254
--- a/home.asm
+++ b/home.asm
@@ -926,9 +926,8 @@
ld e, a
ld h, 0
ld l, a
-rept 2
add hl, hl ; hl = hl * 4
-endr
+ add hl, hl ; hl = hl * 4
add hl, de ; hl = (hl*4) + de
add hl, hl ; hl = (5*hl) + (5*hl)
ld de, PokemonNames
@@ -1295,9 +1294,8 @@
inc hl
.next_inc2
-rept 2
inc hl
-endr
+ inc hl
jr .loop2
.nope3
@@ -1929,7 +1927,7 @@
Function3b0c:: ; 3b0c
- ld a, [hLCDStatCustom]
+ ld a, [hFFC6]
and a
ret z
@@ -1992,12 +1990,10 @@
push bc
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
inc c
-endr
+ inc c
call Function3f35
pop bc
pop hl
@@ -2021,12 +2017,10 @@
push bc
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
inc c
-endr
+ inc c
call Function3f35
pop bc
pop hl
@@ -2147,9 +2141,8 @@
ld c, $8
.asm_3fa5
ld a, [de]
-rept 2
inc de
-endr
+ inc de
cpl
ld [hl], $0
inc hl
--- a/home/lcd.asm
+++ b/home/lcd.asm
@@ -3,7 +3,7 @@
Function547:: ; 547
; Unreferenced
- ld a, [hLCDStatCustom]
+ ld a, [hFFC6]
cp rSCX - $ff00
ret nz
ld c, a
@@ -15,7 +15,7 @@
LCD:: ; 552
push af
- ld a, [hLCDStatCustom]
+ ld a, [hFFC6]
and a
jr z, .done
@@ -26,7 +26,7 @@
ld b, LYOverrides >> 8
ld a, [bc]
ld b, a
- ld a, [hLCDStatCustom]
+ ld a, [hFFC6]
ld c, a
ld a, b
ld [$ff00+c], a
--- a/home/tilemap.asm
+++ b/home/tilemap.asm
@@ -214,13 +214,11 @@
ld a, c
ld b, h
ld c, l
-rept 2
add hl, hl
-endr
+ add hl, hl
add hl, bc
-rept 2
add hl, hl
-endr
+ add hl, hl
ld c, a
xor a
ld b, a
@@ -244,13 +242,11 @@
ld a, c
ld b, h
ld c, l
-rept 2
add hl, hl
-endr
+ add hl, hl
add hl, bc
-rept 2
add hl, hl
-endr
+ add hl, hl
ld c, a
xor a
ld b, a
--- a/home/video.asm
+++ b/home/video.asm
@@ -77,9 +77,8 @@
; We've done 2 16x8 blocks
ld a, [hFFDC]
-rept 2
dec a
-endr
+ dec a
ld [hFFDC], a
jr nz, .next
--- a/hram.asm
+++ b/hram.asm
@@ -76,8 +76,9 @@
hFFC2 EQU $ffc2
hMoneyTemp EQU $ffc3
-hLCDStatCustom EQU $ffc6
-
+hFFC6 EQU $ffc6
+hFFC7 EQU $ffc7
+hFFC8 EQU $ffc8
hMobileReceive EQU $ffc9
hFFCA EQU $ffca
hLinkPlayerNumber EQU $ffcb
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -1614,11 +1614,11 @@
; f09e
StatusHealer_Jumptable: ; f09e (3:709e)
- ld hl, .jumptable
+ ld hl, .dw
rst JumpTable
ret
-.jumptable: ; f0a3 (3:70a3)
+.dw: ; f0a3 (3:70a3)
dw StatusHealer_ClearPalettes
dw StatusHealer_NoEffect
dw StatusHealer_ExitMenu
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -74,7 +74,7 @@
Function110030:: ; 110030 (44:4030)
; Use the byte at $c988 as a parameter
-; for a jumptable.
+; for a dw.
; If [$c988] in {12, 14, 16},
; clear [$c835].
push de
@@ -91,7 +91,7 @@
.noreset
ld d, $0
ld e, a
- ld hl, .jumptable
+ ld hl, .dw
add hl, de
ld a, [hli]
ld [$c988], a
@@ -114,10 +114,10 @@
ld a, [hli]
ld h, [hl]
ld l, a
- ret ; indirectly jump to the function loaded from the jumptable, which returns to Function3e60.
+ ret ; indirectly jump to the function loaded from the dw, which returns to Function3e60.
; 110070 (44:4070)
-.jumptable: ; 110070
+.dw: ; 110070
dw Function110115
dw Function110236
dw Function110291
--- a/macros.asm
+++ b/macros.asm
@@ -257,25 +257,15 @@
endc
endm
-jumptable_start: MACRO
-; Use the declare opname you want to use,
-; either "dw", "dba", or "dab".
-if def(__far)
- purge __far
-endc
-if _NARG == 0
-__far EQUS "dw"
-else
-__far EQUS "\1"
-endc
- enum_start
-endm
-
jumptable: MACRO
-if DEF(\1TableIndex)
-__enum__ = __enum__ + 1
-else
- enum \1TableIndex
-endc
- __far \1
+ ld a, [\2]
+ ld e, a
+ ld d, 0
+ ld hl, \1
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
endm
--- a/main.asm
+++ b/main.asm
@@ -81,7 +81,7 @@
.Function6473
xor a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
@@ -1045,12 +1045,12 @@
ld a, [wPlayerStepDirection]
cp STANDING
ret z
- ld hl, .jumptable
+ ld hl, .dw
rst JumpTable
ret
; 81d6
-.jumptable: ; 81d6
+.dw: ; 81d6
dw .Down
dw .Up
dw .Left
@@ -1657,9 +1657,8 @@
ld a, d
ld d, 0
ld hl, .sinewave
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -2061,9 +2060,8 @@
; bc = MON_HP
ld b, h
ld c, l
-rept 2
dec bc
-endr
+ dec bc
ld a, [hli]
ld [bc], a
@@ -2274,10 +2272,10 @@
; c796
.Jumptable: ; c796 (3:4796)
- jumptable_start
- jumptable .CheckAble
- jumptable .DoCut
- jumptable .FailCut
+
+ dw .CheckAble
+ dw .DoCut
+ dw .FailCut
.CheckAble: ; c79c (3:479c)
ld de, ENGINE_HIVEBADGE
@@ -4457,9 +4455,8 @@
jr nc, .ok ; memory
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [CurItem]
cp [hl]
inc hl
@@ -4493,9 +4490,8 @@
dec hl
ld b, h
ld c, l
-rept 2
inc hl
-endr
+ inc hl
.loop2
ld a, [hli]
ld [bc], a
@@ -6115,9 +6111,8 @@
ld a, [hl]
call .addtobuffer
.nope
-rept 2
inc hl
-endr
+ inc hl
jr .loop
.done
@@ -7397,9 +7392,8 @@
ld d, l
ld e, h
pop hl
-rept 2
inc hl
-endr
+ inc hl
ld a, d
or e
jr z, .skip_height
@@ -7505,9 +7499,8 @@
dec a
ld d, 0
ld e, a
-rept 2
add hl, de
-endr
+ add hl, de
ld e, [hl]
inc hl
ld d, [hl]
@@ -7583,9 +7576,8 @@
DrawKrisPackGFX: ; 48e81
ld hl, PackFGFXPointers
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
@@ -8068,9 +8060,8 @@
ld a, [wMetatileStandingX]
and a
jr z, .left_column
-rept 2
inc hl
-endr
+ inc hl
.left_column
decoord 0, 0
@@ -8221,12 +8212,10 @@
pop bc
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
inc c
-endr
+ inc c
ld a, $7
.row
push bc
@@ -9384,11 +9373,10 @@
ld a, [BattleType]
dec a
ld c, a
- ld hl, .jumptable
+ ld hl, .dw
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -9395,7 +9383,7 @@
jp [hl]
; 4e564
-.jumptable: ; 4e564 (13:6564)
+.dw: ; 4e564 (13:6564)
dw .DudeTutorial
dw .DudeTutorial
dw .DudeTutorial
@@ -9453,9 +9441,8 @@
ld a, 1
ld [hli], a
ld a, POKE_BALL ; 5
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], -1
ret
; 4e5da (13:65da)
@@ -9881,9 +9868,8 @@
dec a
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -9899,7 +9885,6 @@
Strings50a42: ; 50a42
; Untranslated trainer class names from Red.
-
dw .Youngster
dw .BugCatcher
dw .Lass
@@ -10346,9 +10331,8 @@
PlaceStatusString: ; 50d0a
push de
-rept 2
inc de
-endr
+ inc de
ld a, [de]
ld b, a
inc de
@@ -10565,9 +10549,8 @@
CalcExpAtLevel: ; 50e47
; (a/b)*n**3 + c*n**2 + d*n - e
ld a, [BaseGrowthRate]
-rept 2
add a
-endr
+ add a
ld c, a
ld b, 0
ld hl, GrowthRates
@@ -11991,9 +11974,8 @@
ld e, a
ld d, 0
ld hl, .Steps
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -13088,9 +13070,8 @@
call .Decompress
ld hl, Unknown_e008b
pop bc
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
--- a/misc/battle_tower_5c.asm
+++ b/misc/battle_tower_5c.asm
@@ -203,7 +203,7 @@
_BattleTowerBattle: ; 17022c
.loop
- call .do_jumptable
+ call .do_dw
call DelayFrame
ld a, [wBattleTowerBattleEnded]
cp $1
@@ -211,11 +211,11 @@
ret
; 17023a
-.do_jumptable: ; 17023a
+.do_dw: ; 17023a
ld a, [wBattleTowerBattleEnded]
ld e, a
ld d, 0
- ld hl, .jumptable
+ ld hl, .dw
rept 2
add hl, de
endr
@@ -225,7 +225,7 @@
jp [hl]
; 170249
-.jumptable: ; 170249
+.dw: ; 170249
dw RunBattleTowerTrainer
dw SkipBattleTowerTrainer
; 17024d
@@ -688,7 +688,7 @@
ld a, [wJumptableIndex]
ld e, a
ld d, 0
- ld hl, .jumptable
+ ld hl, .dw
rept 2
add hl, de
endr
@@ -698,7 +698,7 @@
jp [hl]
; 17051f
-.jumptable: ; 17051f
+.dw: ; 17051f
dw .Jumptable_0
dw .Jumptable_1
dw .Jumptable_2
@@ -945,7 +945,7 @@
ld a, [ScriptVar]
ld e, a
ld d, 0
- ld hl, .jumptable
+ ld hl, .dw
rept 2
add hl, de
endr
@@ -956,7 +956,7 @@
; 170696
-.jumptable: ; 170696 (5c:4696)
+.dw: ; 170696 (5c:4696)
dw Function17075f ; 0x00
dw Function170788 ; 0x01
dw Function170778 ; 0x02
--- a/misc/fixed_words.asm
+++ b/misc/fixed_words.asm
@@ -281,9 +281,9 @@
ld [wcf65], a
ld [wcf66], a
ld [wcd23], a
- ld [BGMapBuffer], a
+ ld [wcd20], a
ld [wcd21], a
- ld [CreditsTimer], a
+ ld [wcd22], a
ld [wcd35], a
ld [wcd2b], a
ld a, $ff
@@ -373,17 +373,7 @@
; 11c2ac
.DoJumptableFunction: ; 11c2ac
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wJumptableIndex
; 11c2bb
@@ -470,12 +460,10 @@
Function11c35f: ; 11c35f (47:435f)
ld hl, wcd2f
-rept 2
inc [hl]
-endr
-rept 2
+ inc [hl]
dec hl
-endr
+ dec hl
dec [hl]
push af
ld de, wcd2d
@@ -486,12 +474,10 @@
Function11c373: ; 11c373 (47:4373)
ld hl, wcd30
-rept 2
inc [hl]
-endr
-rept 2
+ inc [hl]
dec hl
-endr
+ dec hl
dec [hl]
push af
ld de, wcd2d
@@ -563,7 +549,7 @@
call Function11cfb5
Function11c3ed: ; 11c3ed (47:43ed)
- ld hl, BGMapBuffer ; wcd20 (aliases: CreditsPos)
+ ld hl, wcd20 ; wcd20 (aliases: CreditsPos)
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and $8
@@ -597,10 +583,10 @@
jr .asm_11c475
.asm_11c426
ld a, $8
- ld [BGMapBuffer], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20 (aliases: CreditsPos)
ret
.asm_11c42c
- ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
cp $6
jr c, .asm_11c472
sub $6
@@ -689,7 +675,7 @@
ret
.asm_11c4b7
xor a
- ld [CreditsTimer], a
+ ld [wcd22], a
ld a, $15
ret
@@ -780,7 +766,7 @@
ld hl, wcd24
set 0, [hl]
ld a, $8
- ld [BGMapBuffer], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20 (aliases: CreditsPos)
.b
ld a, $4
@@ -808,7 +794,7 @@
ret
.asm_11c5ab
- ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
call Function11ca6a
call PlayClickSFX
ret
@@ -1131,12 +1117,11 @@
jr .asm_11c795
.asm_11c7ab
ld hl, $c68a + 30
- ld a, [CreditsTimer]
+ ld a, [wcd22]
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hl]
ld [wcd28], a
jr .asm_11c79f
@@ -1211,9 +1196,8 @@
ld a, [wcd22]
ld e, a
ld d, $0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
@@ -1223,9 +1207,8 @@
ld a, [wcd26]
ld e, a
ld d, $0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wcd26]
ld e, a
.asm_11c831
@@ -1368,7 +1351,7 @@
; 11c8f6
Function11c8f6: ; 11c8f6 (47:48f6)
- ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
call Function11c95d
push hl
ld a, [wcd2b]
@@ -1388,13 +1371,12 @@
push de
call Function11c05d
pop de
- ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
ld c, a
ld b, $0
ld hl, wcd36
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], e
inc hl
ld [hl], d
@@ -1414,9 +1396,8 @@
ld a, [wcd22]
ld e, a
ld d, $0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
@@ -1426,14 +1407,12 @@
ld a, [wcd26]
ld e, a
ld d, $0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wcd25]
ld e, a
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
@@ -1534,7 +1513,7 @@
jr nz, .asm_11c9e9
call Function11ca5e
xor a
- ld [BGMapBuffer], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20 (aliases: CreditsPos)
.asm_11c9e9
ld hl, wcd24
set 4, [hl]
@@ -1621,9 +1600,8 @@
ld hl, wcd36
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld [hl], b
inc hl
ld [hl], b
@@ -1737,9 +1715,8 @@
.asm_11cb58
dec a
jr z, .asm_11cb5f
-rept 2
inc hl
-endr
+ inc hl
jr .asm_11cb58
.asm_11cb5f
ld a, [hli]
@@ -1798,9 +1775,8 @@
.asm_11cbba
dec a
jr z, .asm_11cbc1
-rept 2
inc hl
-endr
+ inc hl
jr .asm_11cbba
.asm_11cbc1
ld a, [hli]
@@ -2044,7 +2020,7 @@
call Function11cfb5
Function11ce2b: ; 11ce2b (47:4e2b)
- ld a, [CreditsTimer]
+ ld a, [wcd22]
sla a
sla a
ld c, a
@@ -2083,7 +2059,7 @@
ret
.a
- ld a, [CreditsTimer]
+ ld a, [wcd22]
cp NUM_KANA
jr c, .place
sub NUM_KANA
@@ -2096,7 +2072,7 @@
ld hl, wcd24
set 0, [hl]
ld a, $8
- ld [BGMapBuffer], a ; wcd20 (aliases: CreditsPos)
+ ld [wcd20], a ; wcd20 (aliases: CreditsPos)
.b
ld a, $4
jr .load
@@ -2122,7 +2098,7 @@
ret
.asm_11cea4
- ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos)
+ ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
call Function11ca6a
call PlayClickSFX
ret
@@ -2137,7 +2113,7 @@
ld a, [hl]
cp $ff
ret z
- ld [CreditsTimer], a
+ ld [wcd22], a
ret
; 11ceb9 (47:4eb9)
@@ -2253,9 +2229,8 @@
ld [hli], a
ld a, [de]
inc de
-rept 2
dec a
-endr
+ dec a
jr z, .asm_11cff6
ld c, a
ld a, $7a
@@ -2271,9 +2246,8 @@
add hl, bc
ld a, [de]
dec de
-rept 2
dec a
-endr
+ dec a
jr z, .asm_11d022
ld b, a
.asm_11d005
@@ -2281,9 +2255,8 @@
ld a, $7c
ld [hli], a
ld a, [de]
-rept 2
dec a
-endr
+ dec a
jr z, .asm_11d015
ld c, a
ld a, $7f
@@ -2305,9 +2278,8 @@
ld a, $7d
ld [hli], a
ld a, [de]
-rept 2
dec a
-endr
+ dec a
jr z, .asm_11d031
ld c, a
ld a, $7a
@@ -2369,9 +2341,8 @@
ld a, [de]
cp $2
jr z, .asm_11d082
-rept 2
dec a
-endr
+ dec a
.asm_11d078
push af
ld a, $7a
@@ -2397,9 +2368,8 @@
cp $2
ret z
push bc
-rept 2
dec a
-endr
+ dec a
ld c, a
ld b, a
ld de, $14
@@ -2429,71 +2399,69 @@
ret
Function11d0b6: ; 11d0b6 (47:50b6)
- ld hl, $c
+ ld hl, SPRITEANIMSTRUCT_0C
add hl, bc
ld a, [hl]
ld e, a
ld d, 0
- ld hl, Jumptable_11d0c7
-rept 2
+ ld hl, .Jumptable
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
-Jumptable_11d0c7: ; 11d0c7 (47:50c7)
- dw Function11d0dd
- dw Function11d0e9
- dw Function11d0f5
- dw Function11d10f
- dw Function11d134
- dw Function11d145
- dw Function11d156
- dw Function11d175
- dw Function11d1d7
- dw Function11d1d1
- dw Function11d1fc
+.Jumptable
+ dw .zero
+ dw .one
+ dw .two
+ dw .three
+ dw .four
+ dw .five
+ dw .six
+ dw .seven
+ dw .eight
+ dw .nine
+ dw .ten
-Function11d0dd: ; 11d0dd (47:50dd)
- ld a, [BGMapBuffer] ; wcd20 (aliases: CreditsPos)
+.zero: ; 11d0dd (47:50dd)
+ ld a, [wcd20] ; wcd20 (aliases: CreditsPos)
sla a
ld hl, Unknown_11d208
ld e, $1
- jr asm_11d11e
+ jr .load
-Function11d0e9: ; 11d0e9 (47:50e9)
+.one: ; 11d0e9 (47:50e9)
ld a, [wcd21]
sla a
ld hl, Unknown_11d21a
ld e, $2
- jr asm_11d11e
+ jr .load
-Function11d0f5: ; 11d0f5 (47:50f5)
+.two: ; 11d0f5 (47:50f5)
ld hl, Unknown_11d2be
- ld a, [CreditsTimer]
+ ld a, [wcd22]
ld e, a
ld d, $0
add hl, de
ld a, [hl]
call ReinitSpriteAnimFrame
- ld a, [CreditsTimer]
+ ld a, [wcd22]
sla a
ld hl, Unknown_11d23e
ld e, $4
- jr asm_11d11e
+ jr .load
-Function11d10f: ; 11d10f (47:510f)
- ld a, $27
+.three: ; 11d10f (47:510f)
+ ld a, SPRITE_ANIM_FRAMESET_27
call ReinitSpriteAnimFrame
ld a, [wcd25]
sla a
ld hl, Unknown_11d29e
ld e, $8
-
-asm_11d11e: ; 11d11e (47:511e)
+.load: ; 11d11e (47:511e)
push de
ld e, a
ld d, $0
@@ -2500,7 +2468,7 @@
add hl, de
push hl
pop de
- ld hl, $4
+ ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, [de]
inc de
@@ -2512,26 +2480,26 @@
call Function11d2ee
ret
-Function11d134: ; 11d134 (47:5134)
- ld a, $27
+.four: ; 11d134 (47:5134)
+ ld a, SPRITE_ANIM_FRAMESET_27
call ReinitSpriteAnimFrame
ld a, [wcd2a]
sla a
ld hl, Unknown_11d2b6
ld e, $10
- jr asm_11d11e
+ jr .load
-Function11d145: ; 11d145 (47:5145)
- ld a, $27
+.five: ; 11d145 (47:5145)
+ ld a, SPRITE_ANIM_FRAMESET_27
call ReinitSpriteAnimFrame
ld a, [wcd2c]
sla a
ld hl, Unknown_11d2ba
ld e, $20
- jr asm_11d11e
+ jr .load
-Function11d156: ; 11d156 (47:5156)
- ld a, $2a
+.six: ; 11d156 (47:5156)
+ ld a, SPRITE_ANIM_FRAMESET_2A
call ReinitSpriteAnimFrame
ld a, [wcd4a]
sla a
@@ -2548,14 +2516,14 @@
call Function11d2ee
ret
-Function11d175: ; 11d175 (47:5175)
+.seven: ; 11d175 (47:5175)
ld a, [wcd4d]
cp $4
jr z, .asm_11d180
- ld a, $28
+ ld a, SPRITE_ANIM_FRAMESET_28
jr .asm_11d182
.asm_11d180
- ld a, $26
+ ld a, SPRITE_ANIM_FRAMESET_26
.asm_11d182
call ReinitSpriteAnimFrame
ld a, [wcd4d]
@@ -2566,7 +2534,7 @@
sla a
sla a
add $20
- ld hl, $4
+ ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
ld a, [wcd4d]
@@ -2590,7 +2558,7 @@
sla a
add e
add $18
- ld hl, $4
+ ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld [hli], a
ld a, $8a
@@ -2600,16 +2568,15 @@
call Function11d2ee
ret
-Function11d1d1: ; 11d1d1 (47:51d1)
- ld d, $98
- ld a, $2c
- jr asm_11d1db
+.nine: ; 11d1d1 (47:51d1)
+ ld d, -13 * 8
+ ld a, SPRITE_ANIM_FRAMESET_2C
+ jr .eight_nine_load
-Function11d1d7: ; 11d1d7 (47:51d7)
- ld d, $10
- ld a, $2b
-
-asm_11d1db: ; 11d1db (47:51db)
+.eight: ; 11d1d7 (47:51d7)
+ ld d, 2 * 8
+ ld a, SPRITE_ANIM_FRAMESET_2B
+.eight_nine_load: ; 11d1db (47:51db)
push de
call ReinitSpriteAnimFrame
ld a, [wcd4a]
@@ -2619,8 +2586,8 @@
ld e, a
sla a
add e
- add $40
- ld hl, $5
+ add 8 * 8
+ ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld [hld], a
pop af
@@ -2630,8 +2597,8 @@
call Function11d2ee
ret
-Function11d1fc: ; 11d1fc (47:51fc)
- ld a, $26
+.ten: ; 11d1fc (47:51fc)
+ ld a, SPRITE_ANIM_FRAMESET_26
call ReinitSpriteAnimFrame
ld a, $8
ld e, a
@@ -3119,9 +3086,8 @@
ld hl, $0005
add hl, de
ld a, [bc]
-rept 2
inc bc
-endr
+ inc bc
push bc
.asm_11d4cf
push af
@@ -3162,7 +3128,6 @@
SortedPokemon:
; Pokemon sorted by kana.
; Notably, Rhydon is missing.
-
dw .a
dw .i
dw .u
--- a/misc/mobile_12.asm
+++ b/misc/mobile_12.asm
@@ -519,9 +519,8 @@
.loop
and a
jr z, .got_string
-rept 2
inc hl
-endr
+ inc hl
dec a
jr .loop
.got_string
@@ -746,9 +745,8 @@
pop af
ld [hli], a
ld a, $1
-rept 2
ld [hli], a
-endr
+ ld [hli], a
xor a
rept 3
ld [hli], a
@@ -1673,12 +1671,10 @@
pop bc
ld de, AttrMap - TileMap
add hl, de
-rept 2
inc b
-endr
-rept 2
+ inc b
inc c
-endr
+ inc c
ld a, $0
.asm_48ced
push bc
--- a/misc/mobile_22_2.asm
+++ b/misc/mobile_22_2.asm
@@ -1,6 +1,6 @@
Function8b342:: ; 8b342
; Loads the secondary map header pointer, then runs through a
-; jumptable with three dummy functions. Spends a lot of energy
+; dw with three dummy functions. Spends a lot of energy
; doing pretty much nothing.
call GetSecondaryMapHeaderPointer
ld d, h
@@ -10,7 +10,7 @@
xor a
.loop
push af
- ld hl, .jumptable
+ ld hl, .dw
rst JumpTable
pop af
inc a
@@ -19,7 +19,7 @@
ret
; 8b354
-.jumptable: ; 8b354
+.dw: ; 8b354
dw .zero
dw .one
dw .two
--- a/misc/mobile_40.asm
+++ b/misc/mobile_40.asm
@@ -67,7 +67,7 @@
ld [BGMapBuffer], a
xor a
ld [hMapAnims], a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ret
; 100082
@@ -84,7 +84,7 @@
ld [rIE], a
xor a
ld [hMapAnims], a
- ld [hLCDStatCustom], a
+ ld [hFFC6], a
ld a, $1
ld [hMobileReceive], a
ld [hMobile], a
@@ -118,9 +118,8 @@
ld a, [wcd25]
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wcd22]
call GetFarHalfword
ld a, [wcd22]
@@ -1912,9 +1911,8 @@
ld a, [wMenuCursorY]
ld b, a
ld a, [wNumMoves]
-rept 2
inc a
-endr
+ inc a
cp b
jp nz, .asm_100bcb
ld a, $1
@@ -4746,9 +4744,8 @@
Function101ee4: ; 101ee4
ld d, 0
ld hl, Unknown_101ef5
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
@@ -7228,9 +7225,8 @@
inc hl
push hl
-rept 2
add a
-endr
+ add a
add Unknown_10327a % $100
ld l, a
@@ -7693,9 +7689,8 @@
callba Function10138b
ld b, 0
ld hl, Unknown_1035d7
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -7708,7 +7703,6 @@
dw Unknown_103608
dw Unknown_103608
dw Unknown_1035fe
-
dw AskMobileOrCable
dw AskMobileOrCable
dw AskMobileOrCable
@@ -8096,9 +8090,8 @@
ld [wdc60], a
xor a
ld hl, wdc5c
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ld [hl], a
ld hl, UnknownText_0x103876
call PrintText
--- a/misc/mobile_42.asm
+++ b/misc/mobile_42.asm
@@ -382,27 +382,27 @@
; 10828a
.Jumptable: ; 10828a
- jumptable_start
- jumptable GetMobileTradeAnimByte ; 00
- jumptable MobileTradeAnim_ShowPlayerMonToBeSent ; 01
- jumptable MobileTradeAnim_02 ; 02
- jumptable MobileTradeAnim_GiveTrademon1 ; 03
- jumptable MobileTradeAnim_GiveTrademon2 ; 04
- jumptable MobileTradeAnim_05 ; 05
- jumptable MobileTradeAnim_06 ; 06
- jumptable MobileTradeAnim_07 ; 07
- jumptable MobileTradeAnim_GetTrademon1 ; 08
- jumptable MobileTradeAnim_GetTrademon2 ; 09
- jumptable MobileTradeAnim_GetTrademon3 ; 0a
- jumptable MobileTradeAnim_ShowOTMonFromTrade ; 0b
- jumptable EndMobileTradeAnim ; 0c
- jumptable MobileTradeAnim_ShowPlayerMonForGTS ; 0d
- jumptable MobileTradeAnim_ShowOTMonFromGTS ; 0e
- jumptable MobileTradeAnim_0f ; 0f
- jumptable MobileTradeAnim_10 ; 10
- jumptable MobileTradeAnim_11 ; 11
- jumptable MobileTradeAnim_FadeToBlack ; 12
- jumptable MobileTradeAnim_GetOddEgg ; 13 get odd egg
+
+ dw GetMobileTradeAnimByte ; 00
+ dw MobileTradeAnim_ShowPlayerMonToBeSent ; 01
+ dw MobileTradeAnim_02 ; 02
+ dw MobileTradeAnim_GiveTrademon1 ; 03
+ dw MobileTradeAnim_GiveTrademon2 ; 04
+ dw MobileTradeAnim_05 ; 05
+ dw MobileTradeAnim_06 ; 06
+ dw MobileTradeAnim_07 ; 07
+ dw MobileTradeAnim_GetTrademon1 ; 08
+ dw MobileTradeAnim_GetTrademon2 ; 09
+ dw MobileTradeAnim_GetTrademon3 ; 0a
+ dw MobileTradeAnim_ShowOTMonFromTrade ; 0b
+ dw EndMobileTradeAnim ; 0c
+ dw MobileTradeAnim_ShowPlayerMonForGTS ; 0d
+ dw MobileTradeAnim_ShowOTMonFromGTS ; 0e
+ dw MobileTradeAnim_0f ; 0f
+ dw MobileTradeAnim_10 ; 10
+ dw MobileTradeAnim_11 ; 11
+ dw MobileTradeAnim_FadeToBlack ; 12
+ dw MobileTradeAnim_GetOddEgg ; 13 get odd egg
; 1082b2
MobileTradeAnim_Next: ; 1082b2
--- a/misc/mobile_46.asm
+++ b/misc/mobile_46.asm
@@ -564,17 +564,7 @@
; 1184a5
Function1184a5: ; 1184a5
- ld a, [wcf66]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wcf66
; 1184b4
.Jumptable: ; 1184b4
@@ -609,17 +599,7 @@
; 1184ec
Function1184ec: ; 1184ec
- ld a, [wcf66]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wcf66
; 1184fb
.Jumptable: ; 1184fb
@@ -667,17 +647,7 @@
; 11854d
Function11854d: ; 11854d
- ld a, [wcf66]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wcf66
; 11855c
.Jumptable: ; 11855c
@@ -700,17 +670,7 @@
; 11857c
Function11857c: ; 11857c
- ld a, [wcf66]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wcf66
; 11858b
.Jumptable: ; 11858b
@@ -745,17 +705,7 @@
; 1185c3
Function1185c3: ; 1185c3
- ld a, [wcf66]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wcf66
; 1185d2
.Jumptable: ; 1185d2
@@ -803,17 +753,7 @@
; 118624
Function118624: ; 118624
- ld a, [wcf66]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wcf66
; 118633
.Jumptable: ; 118633
@@ -851,17 +791,7 @@
; 118671
Function118671: ; 118671
- ld a, [wcf66]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wcf66
; 118680
.Jumptable: ; 118680
@@ -893,17 +823,7 @@
; 1186b2
Function1186b2: ; 1186b2
- ld a, [wcf66]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wcf66
; 1186c1
.Jumptable: ; 1186c1
@@ -936,17 +856,7 @@
; 1186f5
Function1186f5: ; 1186f5 (46:46f5)
- ld a, [wcf66]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wcf66
; 118704 (46:4704)
.Jumptable: ; 118704 (46:4704)
@@ -986,17 +896,7 @@
; 118746 (46:4746)
Function118746: ; 118746
- ld a, [wcf66]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, wcf66
; 118755
.Jumptable: ; 118755
@@ -1627,9 +1527,8 @@
jr nz, .asm_118b8c
dec hl
xor a
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ret
; 118b9a
@@ -1830,9 +1729,8 @@
ld a, [hld]
cp $2f
jr nz, .asm_118e3e
-rept 2
inc hl
-endr
+ inc hl
ld de, wcd85
ld c, $4
.asm_118e4a
@@ -2691,9 +2589,8 @@
ld c, a
ld a, [w3_d000 + 1]
ld b, a
-rept 2
dec bc
-endr
+ dec bc
ld hl, wd002
ld a, [hli]
ld e, a
@@ -2883,9 +2780,8 @@
.asm_119552
inc hl
.asm_119553
-rept 2
inc hl
-endr
+ inc hl
jr .asm_11955b
.asm_119557
ld de, $14
@@ -3230,9 +3126,8 @@
ld a, [hld]
cp $58
jr z, .asm_11975b
-rept 2
inc hl
-endr
+ inc hl
ld a, d
dec a
jr z, .asm_11978e
@@ -3815,9 +3710,8 @@
ld a, [de]
cp $d
jr nz, .asm_119b85
-rept 2
inc de
-endr
+ inc de
.asm_119b93
ld a, [de]
inc de
@@ -4349,7 +4243,9 @@
ld [wcd8c], a
ld a, $1
ld [rSVBK], a
- call Function119eee
+
+ call .RunJumptable
+
ld a, [wcd8c]
ld [rSVBK], a
ld a, $1
@@ -4356,21 +4252,10 @@
ld [hBGMapMode], a
ret
-Function119eee: ; 119eee (46:5eee)
- ld a, [wcd3c]
- ld e, a
- ld d, 0
- ld hl, Jumptable_119efd
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 119efd (46:5efd)
+.RunJumptable
+ jumptable .Jumptable, wcd3c
-Jumptable_119efd: ; 119efd
+.Jumptable
dw Function119f3f
dw Function119f45
dw Function119f56
@@ -5553,17 +5438,7 @@
; 11a8fa
Function11a8fa: ; 11a8fa
- ld a, [$c31a]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable .Jumptable, $c31a
; 11a909
.Jumptable: ; 11a909
@@ -6328,9 +6203,8 @@
dec a
ld c, a
ld b, 0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, e
ld e, [hl]
inc hl
@@ -6803,9 +6677,8 @@
Function11b239: ; 11b239
ld e, a
ld d, 0
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -7210,20 +7083,9 @@
; 11b46a
Function11b46a: ; 11b46a
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, Jumptable_11b479
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 11b479
+ jumptable .Jumptable, wJumptableIndex
-Jumptable_11b479: ; 11b479
+.Jumptable
dw Function11b483
dw Function11b570
dw Function11b5c0
@@ -7232,7 +7094,7 @@
; 11b483
Function11b483: ; 11b483
- call Function11b538
+ call .InitRAM
ld hl, PlayerName
ld a, $5 ; Japanese Name Length
.loop1
@@ -7291,9 +7153,8 @@
pop de
ld h, d
ld l, e
-rept 2
dec hl
-endr
+ dec hl
ld a, [de]
ld [hli], a
inc de
@@ -7369,9 +7230,8 @@
jr nz, .loop9
call CloseSRAM
jp Function11ad8a
-; 11b538
-Function11b538: ; 11b538
+.InitRAM
ld bc, wc626
ld a, [PlayerID]
ld [wcd2a], a
@@ -7416,7 +7276,7 @@
ld a, [ScriptVar]
and a
jr nz, .exit
- call Function11b585
+ call .SaveData
jp Function11ad8a
.exit
@@ -7423,19 +7283,21 @@
ld a, $4
ld [wJumptableIndex], a
ret
-; 11b585
-Function11b585: ; 11b585
+.SaveData
ld a, $3
ld [rSVBK], a
+
ld hl, w3_d800
ld de, $c608
ld bc, w3_d88f - w3_d800
call CopyBytes
+
ld a, $1
ld [rSVBK], a
ld a, $5
call GetSRAMBank
+
ld de, $a800
ld a, $1
ld [de], a
@@ -7443,8 +7305,10 @@
ld hl, $c608
ld bc, w3_d88f - w3_d800
call CopyBytes
+
push de
pop hl
+
ld a, [hRTCMinutes]
ld [hli], a
ld a, [hRTCHours]
@@ -7453,6 +7317,7 @@
ld [hli], a
ld a, [hRTCDayHi]
ld [hl], a
+
call CloseSRAM
ret
; 11b5c0
@@ -7484,7 +7349,7 @@
call GetSRAMBank
ld hl, wRTC
ld de, $c608
- ld bc, $0004
+ ld bc, 4
call CopyBytes
call CloseSRAM
ld a, $5
@@ -7491,7 +7356,7 @@
call GetSRAMBank
ld hl, $c608
ld de, $b08c
- ld bc, $0004
+ ld bc, 4
call CopyBytes
ld a, $2
ld [$a800], a
@@ -7513,35 +7378,20 @@
ld [wcd31], a
call CloseSRAM
call Function11b44b
- call Function11b64c
+ call .loop
ret
-; 11b64c
-Function11b64c: ; 11b64c
-.asm_11b64c
- call Function11b65a
+.loop
+ call .RunJumptable
call DelayFrame
ld a, [wJumptableIndex]
cp $1
- jr nz, .asm_11b64c
+ jr nz, .loop
ret
-; 11b65a
-Function11b65a: ; 11b65a
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, Jumptable_11b669
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 11b669
-
-Jumptable_11b669: ; 11b669
+.RunJumptable
+ jumptable .Jumptable, wJumptableIndex
+.Jumptable
dw Function11b66d
dw Function11b6b3
; 11b66d
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -733,17 +733,7 @@
; 17d474
Function17d474: ; 17d474
- ld a, [wcd77]
- ld e, a
- ld d, 0
- ld hl, Jumptable_17d483
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable Jumptable_17d483, wcd77
; 17d483
Jumptable_17d483: ; 17d483
@@ -920,16 +910,14 @@
ld a, [wcd42]
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, l
ld [wcd4b], a
ld a, h
ld [wcd4c], a
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, l
ld [wcd4d], a
ld a, h
@@ -955,9 +943,8 @@
.loop
srl a
jr c, .got_button
-rept 2
inc c
-endr
+ inc c
jr .loop
.got_button
@@ -1044,12 +1031,10 @@
ld [wcd4c], a
pop de
pop hl
-rept 2
inc b
-endr
-rept 2
+ inc b
dec c
-endr
+ dec c
jr z, .asm_17d684
push bc
push de
@@ -1095,17 +1080,15 @@
ld a, $5
call GetSRAMBank
ld hl, $b1d3
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld [wcd47], a
ld a, [hl]
ld [BGMapPalBuffer], a
ld hl, $b1b3
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
@@ -1121,9 +1104,8 @@
ld de, wcd60
ld bc, $0004
call CopyBytes
-rept 2
inc hl
-endr
+ inc hl
ld de, wcd64
ld bc, $0004
call CopyBytes
@@ -1159,9 +1141,8 @@
ld e, a
ld d, 0
ld hl, Jumptable17d72a
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -2015,9 +1996,8 @@
ld a, [wcd2e]
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
@@ -2432,9 +2412,8 @@
jr .asm_17df7b
.asm_17df79
-rept 2
inc hl
-endr
+ inc hl
.asm_17df7b
bit 4, b
@@ -2487,9 +2466,8 @@
jr .asm_17dfd2
.asm_17dfd0
-rept 2
inc hl
-endr
+ inc hl
.asm_17dfd2
bit 5, b
@@ -2614,9 +2592,8 @@
jr .asm_17e0a4
.asm_17e0a2
-rept 2
inc hl
-endr
+ inc hl
.asm_17e0a4
bit 4, b
@@ -2632,9 +2609,8 @@
jr .asm_17e0b6
.asm_17e0b4
-rept 2
inc hl
-endr
+ inc hl
.asm_17e0b6
bit 5, b
@@ -2656,9 +2632,8 @@
call CloseSRAM
pop hl
pop bc
-rept 2
inc hl
-endr
+ inc hl
jr asm_17e0ee
.asm_17e0e1
@@ -2703,9 +2678,8 @@
call ReceiveItem
pop hl
jr c, .asm_17e127
-rept 2
inc hl
-endr
+ inc hl
.asm_17e127
ld a, [hli]
@@ -2735,9 +2709,8 @@
callba MobileCheckOwnMonAnywhere
pop hl
jr c, .asm_17e159
-rept 2
inc hl
-endr
+ inc hl
.asm_17e159
ld a, [hli]
@@ -2773,9 +2746,8 @@
call CheckItem
pop hl
jr c, .asm_17e195
-rept 2
inc hl
-endr
+ inc hl
.asm_17e195
ld a, [hli]
@@ -3240,9 +3212,8 @@
ld [wcd2e], a
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
push hl
hlcoord 0, 0
ld bc, $0014
@@ -3467,9 +3438,8 @@
ld l, a
ld a, [wcd4e]
ld h, a
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld e, a
ld a, [hli]
@@ -3534,9 +3504,8 @@
ld [hli], a
ld a, [de]
inc de
-rept 2
dec a
-endr
+ dec a
jr z, .asm_17e63f
ld c, a
ld a, [wcd53]
@@ -3555,9 +3524,8 @@
add hl, bc
ld a, [de]
dec de
-rept 2
dec a
-endr
+ dec a
jr z, .asm_17e674
ld b, a
.asm_17e651
@@ -3566,9 +3534,8 @@
add $3
ld [hli], a
ld a, [de]
-rept 2
dec a
-endr
+ dec a
jr z, .asm_17e664
ld c, a
ld a, $7f
@@ -3594,9 +3561,8 @@
add $5
ld [hli], a
ld a, [de]
-rept 2
dec a
-endr
+ dec a
jr z, .asm_17e689
ld c, a
ld a, [wcd53]
@@ -3622,9 +3588,8 @@
inc de
push af
ld a, [de]
-rept 2
inc de
-endr
+ inc de
and a
.asm_17e69f
jr z, .asm_17e6a5
@@ -3776,9 +3741,8 @@
ld e, a
ld d, 0
ld hl, Jumptable_17f061
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
@@ -3815,9 +3779,8 @@
ld de, $0004
add hl, de
ld a, [hli]
-rept 2
inc hl
-endr
+ inc hl
ld e, l
ld d, h
ld l, c
@@ -3960,9 +3923,8 @@
pop hl
call Function17f524
jr c, .asm_17f167
-rept 2
inc hl
-endr
+ inc hl
ld e, l
ld d, h
ld a, [de]
@@ -4150,9 +4112,8 @@
ld e, a
ld d, 0
ld hl, .Genders
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
@@ -4414,9 +4375,8 @@
ld a, [de]
ld c, a
ld b, $0
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld e, a
ld a, [hli]
@@ -4431,9 +4391,8 @@
ld e, a
ld d, $0
pop hl
-rept 2
add hl, de
-endr
+ add hl, de
rept 3
inc hl
endr
@@ -4497,9 +4456,8 @@
ld de, $0005
add hl, de
ld a, [hli]
-rept 2
inc hl
-endr
+ inc hl
ld e, l
ld d, h
ld l, c
@@ -4738,17 +4696,7 @@
; 17f5ae
Function17f5ae: ; 17f5ae
- ld a, [wc303]
- ld e, a
- ld d, 0
- ld hl, Table17f5bd
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
+ jumptable Table17f5bd, wc303
; 17f5bd
Table17f5bd: ; 17f5bd
@@ -4818,9 +4766,8 @@
ld e, a
ld d, $0
ld hl, Table_17f706
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [wc301]
ld e, a
ld a, [wc302]
@@ -4858,9 +4805,8 @@
jr .asm_17f67d
.asm_17f674
-rept 2
inc hl
-endr
+ inc hl
dec c
jr nz, .asm_17f65d
@@ -4878,9 +4824,8 @@
ld e, a
ld d, 0
ld hl, Table_17f699
-rept 2
add hl, de
-endr
+ add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
--- a/misc/mobile_menu.asm
+++ b/misc/mobile_menu.asm
@@ -162,9 +162,8 @@
add B_BUTTON
ld [hli], a ; wMenuJoypadFilter
ld a, 1
-rept 2
ld [hli], a ; wMenuCursorY, wMenuCursorX
-endr
+ ld [hli], a ; wMenuCursorY, wMenuCursorX
ret
Function4a098: ; 4a098 (12:6098)
@@ -246,9 +245,8 @@
add $2
ld [hli], a
ld a, $1
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ret
Function4a13b: ; 4a13b (12:613b)
@@ -523,9 +521,8 @@
add $2
ld [hli], a
ld a, $1
-rept 2
ld [hli], a
-endr
+ ld [hli], a
ret
; 4a39a (12:639a)
@@ -836,9 +833,8 @@
add $2
ld [hli], a
ld a, $1
-rept 2
ld [hli], a
-endr
+ ld [hli], a
xor a
rept 3
ld [hli], a
--- a/predef/cgb.asm
+++ b/predef/cgb.asm
@@ -18,7 +18,7 @@
ld l, a
ld h, 0
add hl, hl
- ld de, .jumptable
+ ld de, .dw
add hl, de
ld a, [hli]
ld h, [hl]
@@ -32,7 +32,7 @@
ret
; 8d7a
-.jumptable: ; 8d7a
+.dw: ; 8d7a
dw _CGB00
dw _CGB01
dw _CGB02
@@ -92,9 +92,8 @@
ld a, [EnemyHPPal]
ld l, a
ld h, $0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld bc, Palettes_a8be
add hl, bc
call LoadPalette_White_Col1_Col2_Black
@@ -101,9 +100,8 @@
ld a, [PlayerHPPal]
ld l, a
ld h, $0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld bc, Palettes_a8be
add hl, bc
call LoadPalette_White_Col1_Col2_Black
@@ -209,9 +207,8 @@
ld a, [wcda1]
ld l, a
ld h, $0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld bc, Palettes_a8be
add hl, bc
call LoadPalette_White_Col1_Col2_Black
@@ -489,9 +486,8 @@
_CGB07: ; 9122
ld b, 0
ld hl, Jumptable_912d
-rept 2
add hl, bc
-endr
+ add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
@@ -797,9 +793,8 @@
ld a, [PlayerHPPal]
ld l, a
ld h, 0
-rept 2
add hl, hl
-endr
+ add hl, hl
ld bc, Palettes_a8be
add hl, bc
call LoadPalette_White_Col1_Col2_Black
--- a/predef/crystal.asm
+++ b/predef/crystal.asm
@@ -10,7 +10,7 @@
ld l, a
ld h, 0
add hl, hl
- ld de, .jumptable
+ ld de, .dw
add hl, de
ld a, [hli]
ld h, [hl]
@@ -22,11 +22,11 @@
ret
; 49330 (12:5330)
-.jumptable: ; 49330
- jumptable_start
- jumptable MG_Mobile_Layout00
- jumptable MG_Mobile_Layout01
- jumptable MG_Mobile_Layout02
+.dw: ; 49330
+
+ dw MG_Mobile_Layout00
+ dw MG_Mobile_Layout01
+ dw MG_Mobile_Layout02
; 49336
MG_Mobile_Layout_FillBox: ; 49336