summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/battle.asm34
-rw-r--r--home/copy.asm60
-rw-r--r--home/init.asm9
-rw-r--r--home/joypad.asm137
-rw-r--r--home/map.asm52
-rw-r--r--home/menu.asm119
-rw-r--r--home/mobile.asm14
-rw-r--r--home/movement.asm36
-rw-r--r--home/palettes.asm16
-rw-r--r--home/serial.asm6
-rw-r--r--home/text.asm211
-rw-r--r--home/tilemap.asm93
-rw-r--r--home/time.asm2
-rw-r--r--home/vblank.asm2
-rw-r--r--home/window.asm14
15 files changed, 412 insertions, 393 deletions
diff --git a/home/battle.asm b/home/battle.asm
index a374d59bc..37f39572a 100644
--- a/home/battle.asm
+++ b/home/battle.asm
@@ -106,7 +106,7 @@ UpdateEnemyMonInParty:: ; 39b0
; Update level, status, current HP
; No wildmons.
- ld a, [IsInBattle]
+ ld a, [wBattleMode]
dec a
ret z
@@ -194,34 +194,6 @@ endr
dw .status, .statusopp, .animation, .effect, .power, .type
dw .curmove, .lastcounter, .lastcounteropp, .lastmove, .lastmoveopp
- const_def
- const PLAYER_SUBSTATUS_1
- const ENEMY_SUBSTATUS_1
- const PLAYER_SUBSTATUS_2
- const ENEMY_SUBSTATUS_2
- const PLAYER_SUBSTATUS_3
- const ENEMY_SUBSTATUS_3
- const PLAYER_SUBSTATUS_4
- const ENEMY_SUBSTATUS_4
- const PLAYER_SUBSTATUS_5
- const ENEMY_SUBSTATUS_5
- const PLAYER_STATUS
- const ENEMY_STATUS
- const PLAYER_MOVE_ANIMATION
- const ENEMY_MOVE_ANIMATION
- const PLAYER_MOVE_EFFECT
- const ENEMY_MOVE_EFFECT
- const PLAYER_MOVE_POWER
- const ENEMY_MOVE_POWER
- const PLAYER_MOVE_TYPE
- const ENEMY_MOVE_TYPE
- const PLAYER_CUR_MOVE
- const ENEMY_CUR_MOVE
- const PLAYER_COUNTER_MOVE
- const ENEMY_COUNTER_MOVE
- const PLAYER_LAST_MOVE
- const ENEMY_LAST_MOVE
-
; player enemy
.substatus1 db PLAYER_SUBSTATUS_1, ENEMY_SUBSTATUS_1
.substatus1opp db ENEMY_SUBSTATUS_1, PLAYER_SUBSTATUS_1
@@ -293,8 +265,8 @@ CELL_PHONE_TOP EQU $5e
CELL_PHONE_BOTTOM EQU $5f
; For mobile link battles only.
- ld a, [InLinkBattle]
- cp 4
+ ld a, [wLinkMode]
+ cp LINK_MOBILE
ret c
; Draw a cell phone icon at the
diff --git a/home/copy.asm b/home/copy.asm
index bd944aa0b..d17e459ca 100644
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -117,8 +117,8 @@ Functione51:: ; e51
ret
; e58
-Functione58:: ; e58
- callba Functionfb4be
+LoadFontsBattleExtra:: ; e58
+ callba _LoadFontsBattleExtra
ret
; e5f
@@ -211,6 +211,7 @@ endr
Request2bpp:: ; eba
+; Load 2bpp at b:de to occupy c tiles of hl.
ld a, [hBGMapMode]
push af
xor a
@@ -223,19 +224,19 @@ Request2bpp:: ; eba
ld a, [$ffd3]
push af
-
ld a, $8
ld [$ffd3], a
- ld a, [InLinkBattle]
- cp $4
- jr nz, .asm_edc
- ld a, [$ffe9]
+
+ ld a, [wLinkMode]
+ cp LINK_MOBILE
+ jr nz, .NotMobile
+ ld a, [hMobile]
and a
- jr nz, .asm_edc
+ jr nz, .NotMobile
ld a, $6
ld [$ffd3], a
-.asm_edc
+.NotMobile
ld a, e
ld [Requested2bppSource], a
ld a, d
@@ -244,12 +245,11 @@ Request2bpp:: ; eba
ld [Requested2bppDest], a
ld a, h
ld [Requested2bppDest + 1], a
-
-.asm_eec
+.loop
ld a, c
ld hl, $ffd3
cp [hl]
- jr nc, .asm_f08
+ jr nc, .iterate
ld [Requested2bpp], a
.wait
@@ -268,19 +268,21 @@ Request2bpp:: ; eba
ld [hBGMapMode], a
ret
-.asm_f08
+.iterate
ld a, [$ffd3]
ld [Requested2bpp], a
-.asm_f0d
+
+.wait2
call DelayFrame
ld a, [Requested2bpp]
and a
- jr nz, .asm_f0d
+ jr nz, .wait2
+
ld a, c
ld hl, $ffd3
sub [hl]
ld c, a
- jr .asm_eec
+ jr .loop
; f1e
@@ -300,16 +302,16 @@ Request1bpp:: ; f1e
ld a, $8
ld [$ffd3], a
- ld a, [InLinkBattle]
- cp $4
- jr nz, .asm_f40
- ld a, [$ffe9]
+ ld a, [wLinkMode]
+ cp LINK_MOBILE
+ jr nz, .NotMobile
+ ld a, [hMobile]
and a
- jr nz, .asm_f40
+ jr nz, .NotMobile
ld a, $6
ld [$ffd3], a
-.asm_f40
+.NotMobile
ld a, e
ld [Requested1bppSource], a
ld a, d
@@ -318,11 +320,11 @@ Request1bpp:: ; f1e
ld [Requested1bppDest], a
ld a, h
ld [Requested1bppDest + 1], a
-.asm_f50
+.loop
ld a, c
ld hl, $ffd3
cp [hl]
- jr nc, .asm_f6c
+ jr nc, .iterate
ld [Requested1bpp], a
.wait
@@ -341,19 +343,21 @@ Request1bpp:: ; f1e
ld [hBGMapMode], a
ret
-.asm_f6c
+.iterate
ld a, [$ffd3]
ld [Requested1bpp], a
-.asm_f71
+
+.wait2
call DelayFrame
ld a, [Requested1bpp]
and a
- jr nz, .asm_f71
+ jr nz, .wait2
+
ld a, c
ld hl, $ffd3
sub [hl]
ld c, a
- jr .asm_f50
+ jr .loop
; f82
diff --git a/home/init.asm b/home/init.asm
index 6ada3e267..8325f6294 100644
--- a/home/init.asm
+++ b/home/init.asm
@@ -136,15 +136,14 @@ Init:: ; 17d
; BG on
ld [rLCDC], a
- ld a, $ff
+ ld a, -1
ld [$ffcb], a
callba Function9890
- ld a, $9c
- ld [$ffd7], a
-
- xor a
+ ld a, VBGMap1 / $100
+ ld [hBGMapAddress + 1], a
+ xor a ; VBGMap1 % $100
ld [hBGMapAddress], a
callba StartClock
diff --git a/home/joypad.asm b/home/joypad.asm
index 572fa1216..d5bfc83f3 100644
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -39,7 +39,7 @@ Joypad:: ; 935
; We can only get four inputs at a time.
; We take d-pad first for no particular reason.
- ld a, D_PAD
+ ld a, R_DPAD
ld [rJOYP], a
; Read twice to give the request time to take.
rept 2
@@ -57,7 +57,7 @@ endr
; Buttons make 8 total inputs (A, B, Select, Start).
; We can fit this into one byte.
- ld a, BUTTONS
+ ld a, R_BUTTONS
ld [rJOYP], a
; Wait for input to stabilize.
rept 6
@@ -198,14 +198,14 @@ GetJoypad:: ; 984
.updateauto
; An input of $ff will end the stream.
ld a, [hli]
- cp a, $ff
+ cp a, -1
jr z, .stopauto
ld b, a
; A duration of $ff will end the stream indefinitely.
ld a, [hli]
ld [AutoInputLength], a
- cp a, $ff
+ cp a, -1
jr nz, .next
; The current input is overwritten.
@@ -273,42 +273,44 @@ StopAutoInput:: ; a0a
; a1b
-Functiona1b:: ; a1b
+JoyTitleScreenInput:: ; a1b
+.loop
call DelayFrame
push bc
- call Functiona57
+ call JoyTextDelay
pop bc
ld a, [hJoyDown]
cp D_UP | SELECT | B_BUTTON
- jr z, .asm_a34
+ jr z, .keycombo
- ld a, [$ffa9]
+ ld a, [hJoyLast]
and START | A_BUTTON
- jr nz, .asm_a34
+ jr nz, .keycombo
dec c
- jr nz, Functiona1b
+ jr nz, .loop
and a
ret
-.asm_a34
+.keycombo
scf
ret
; a36
-Functiona36:: ; a36
+JoyWaitAorB:: ; a36
+.loop
call DelayFrame
call GetJoypad
ld a, [hJoyPressed]
and A_BUTTON | B_BUTTON
ret nz
call RTC
- jr Functiona36
+ jr .loop
; a46
CloseText:: ; a46
@@ -317,37 +319,37 @@ CloseText:: ; a46
ld a, 1
ld [hOAMUpdate], a
call WaitBGMap
- call Functiona36
+ call JoyWaitAorB
pop af
ld [hOAMUpdate], a
ret
; a57
-Functiona57:: ; a57
+JoyTextDelay:: ; a57
call GetJoypad
- ld a, [$ffaa]
+ ld a, [hInMenu]
and a
ld a, [hJoyPressed]
- jr z, .asm_a63
+ jr z, .ok
ld a, [hJoyDown]
-.asm_a63
+.ok
ld [hJoyLast], a
ld a, [hJoyPressed]
and a
- jr z, .asm_a70
+ jr z, .checkframedelay
ld a, 15
ld [TextDelayFrames], a
ret
-.asm_a70
+.checkframedelay
ld a, [TextDelayFrames]
and a
- jr z, .asm_a7a
+ jr z, .restartframedelay
xor a
ld [hJoyLast], a
ret
-.asm_a7a
+.restartframedelay
ld a, 5
ld [TextDelayFrames], a
ret
@@ -356,90 +358,95 @@ Functiona57:: ; a57
Functiona80:: ; a80
ld a, [hConnectionStripLength]
push af
- ld a, [$ffb0]
+ ld a, [hConnectedMapWidth]
push af
xor a
ld [hConnectionStripLength], a
- ld a, $6
- ld [$ffb0], a
-.asm_a8d
+ ld a, 6
+ ld [hConnectedMapWidth], a
+
+.loop
push hl
hlcoord 18, 17
call Functionb06
pop hl
- call Functiona57
- ld a, [$ffa9]
- and $3
- jr z, .asm_a8d
+
+ call JoyTextDelay
+ ld a, [hJoyLast]
+ and A_BUTTON | B_BUTTON
+ jr z, .loop
+
pop af
- ld [$ffb0], a
+ ld [hConnectedMapWidth], a
pop af
ld [hConnectionStripLength], a
ret
; aa5
Functionaa5:: ; aa5
- call Functiona57
- ld a, [$ffa9]
+.loop
+ call JoyTextDelay
+ ld a, [hJoyLast]
and A_BUTTON | B_BUTTON
- jr z, Functionaa5
+ jr z, .loop
ret
; aaf
KeepTextOpen:: ; aaf
- ld a, [InLinkBattle]
+ ld a, [wLinkMode]
and a
- jr nz, .asm_ac1
- call Functionac6
+ jr nz, .link
+ call .wait_input
push de
ld de, SFX_READ_TEXT_2
call PlaySFX
pop de
ret
-.asm_ac1
+.link
ld c, 65
jp DelayFrames
; ac6
-Functionac6:: ; ac6
+.wait_input: ; ac6
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
ld a, [InputType]
or a
- jr z, .asm_ad9
- callba Start_DudeAutoInput_A
-.asm_ad9
- call Functionaf5
- call Functiona57
+ jr z, .input_wait_loop
+ callba _DudeAutoInput_A
+
+.input_wait_loop
+ call .blink_cursor
+ call JoyTextDelay
ld a, [hJoyPressed]
- and $3
- jr nz, .asm_af1
+ and A_BUTTON | B_BUTTON
+ jr nz, .received_input
call RTC
ld a, $1
ld [hBGMapMode], a
call DelayFrame
- jr .asm_ad9
+ jr .input_wait_loop
-.asm_af1
+.received_input
pop af
ld [hOAMUpdate], a
ret
; af5
-Functionaf5:: ; af5
+.blink_cursor: ; af5
ld a, [$ff9b]
- and $10
- jr z, .asm_aff
- ld a, $ee
- jr .asm_b02
+ and %00010000 ; bit 4, a
+ jr z, .cursor_off
+ ld a, "▼"
+ jr .load_cursor_state
-.asm_aff
+.cursor_off
ld a, [TileMap + 17 + 17 * SCREEN_WIDTH]
-.asm_b02
+.load_cursor_state
ld [TileMap + 18 + 17 * SCREEN_WIDTH], a
ret
; b06
@@ -448,7 +455,7 @@ Functionb06:: ; b06
push bc
ld a, [hl]
ld b, a
- ld a, $ee
+ ld a, "▼"
cp b
pop bc
jr nz, .asm_b27
@@ -456,16 +463,16 @@ Functionb06:: ; b06
dec a
ld [hConnectionStripLength], a
ret nz
- ld a, [$ffb0]
+ ld a, [hConnectedMapWidth]
dec a
- ld [$ffb0], a
+ ld [hConnectedMapWidth], a
ret nz
- ld a, $7a
+ ld a, "─"
ld [hl], a
- ld a, $ff
+ ld a, -1
ld [hConnectionStripLength], a
- ld a, $6
- ld [$ffb0], a
+ ld a, 6
+ ld [hConnectedMapWidth], a
ret
.asm_b27
@@ -477,12 +484,12 @@ Functionb06:: ; b06
ret nz
dec a
ld [hConnectionStripLength], a
- ld a, [$ffb0]
+ ld a, [hConnectedMapWidth]
dec a
- ld [$ffb0], a
+ ld [hConnectedMapWidth], a
ret nz
ld a, $6
- ld [$ffb0], a
+ ld [hConnectedMapWidth], a
ld a, $ee
ld [hl], a
ret
diff --git a/home/map.asm b/home/map.asm
index 9d145f3ed..f72c74ac2 100644
--- a/home/map.asm
+++ b/home/map.asm
@@ -214,7 +214,7 @@ Function222a:: ; 222a
ret
; 2238
-Function2238:: ; 2238
+CheckWarpTile:: ; 2238
call Function2252
ret nc
push bc
@@ -258,11 +258,11 @@ Function2266:: ; 2266
ld a, [MapX]
sub $4
ld d, a
- ld a, [wdbfb]
+ ld a, [wCurrMapWarpCount]
and a
ret z
ld c, a
- ld hl, wdbfc
+ ld hl, wCurrMapWarpHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
@@ -294,7 +294,7 @@ Function2266:: ; 2266
pop hl
call Function22a3
ret nc
- ld a, [wdbfb]
+ ld a, [wCurrMapWarpCount]
inc a
sub c
ld c, a
@@ -325,7 +325,7 @@ Function22a7:: ; 22a7
Function22b4:: ; 22b4
push bc
- ld hl, wdbfc
+ ld hl, wCurrMapWarpHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
@@ -439,8 +439,8 @@ Function234f:: ; 234f
ld a, [hli]
ld h, [hl]
ld l, a
- call Function23ac
- call Function23c3
+ call ReadMapTriggers
+ call ReadMapCallbacks
ret
; 235c
@@ -507,34 +507,36 @@ GetMapConnection:: ; 23a3
; 23ac
-Function23ac:: ; 23ac
- ld a, [hli]
+ReadMapTriggers:: ; 23ac
+ ld a, [hli] ; trigger count
ld c, a
- ld [wdc07], a
+ ld [wCurrMapTriggerCount], a ; current map trigger count
ld a, l
- ld [wdc07 + 1], a
+ ld [wCurrMapTriggerHeaderPointer], a ; map trigger pointer
ld a, h
ld [wdc09], a
ld a, c
and a
ret z
- ld bc, $0004
+
+ ld bc, 4 ; size of a map trigger header entry
call AddNTimes
ret
; 23c3
-Function23c3:: ; 23c3
+ReadMapCallbacks:: ; 23c3
ld a, [hli]
ld c, a
- ld [wdc0a], a
+ ld [wCurrMapCallbackCount], a
ld a, l
- ld [wdc0b], a
+ ld [wCurrMapCallbackHeaderPointer], a
ld a, h
- ld [wdc0b + 1], a
+ ld [wCurrMapCallbackHeaderPointer + 1], a
ld a, c
and a
ret z
- ld bc, $0003
+
+ ld bc, 3
call AddNTimes
ret
; 23da
@@ -542,9 +544,9 @@ Function23c3:: ; 23c3
ReadWarps:: ; 23da
ld a, [hli]
ld c, a
- ld [wdbfb], a
+ ld [wCurrMapWarpCount], a
ld a, l
- ld [wdbfc], a
+ ld [wCurrMapWarpHeaderPointer], a
ld a, h
ld [wdbfd], a
ld a, c
@@ -560,7 +562,7 @@ ReadCoordEvents:: ; 23f1
ld c, a
ld [wCurrentMapXYTriggerCount], a
ld a, l
- ld [wdbff], a
+ ld [wCurrentMapXYTriggerHeaderPointer], a
ld a, h
ld [wdc00], a
ld a, c
@@ -1000,11 +1002,11 @@ RunMapCallback:: ; 263b
; 2653
Function2653:: ; 2653
- ld a, [wdc0a]
+ ld a, [wCurrMapCallbackCount]
ld c, a
and a
ret z
- ld hl, wdc0b
+ ld hl, wCurrMapCallbackHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1896,7 +1898,7 @@ CheckCurrentMapXYTriggers:: ; 2ad4
CheckStandingOnXYTrigger:: ; 2ae7
; Checks to see if you are standing on an xy-trigger. If yes, copies the trigger to EngineBuffer1 and sets carry.
- ld hl, wdbff
+ ld hl, wCurrentMapXYTriggerHeaderPointer
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1958,7 +1960,7 @@ FadeToMenu:: ; 2b29
call LoadMenuDataHeader_0x1d75
callba FadeBlackBGMap
call ClearSprites
- call Function2ed3
+ call DisableSpriteUpdates
ret
; 2b3c
@@ -1986,7 +1988,7 @@ Function2b5c:: ; 2b5c
callba Function49409
call Function3200
callba FadeInBGMap
- call Function2ee4
+ call EnableSpriteUpdates
ret
; 2b74
diff --git a/home/menu.asm b/home/menu.asm
index e299505dd..9dcbdff47 100644
--- a/home/menu.asm
+++ b/home/menu.asm
@@ -1,14 +1,14 @@
; Functions used in displaying and handling menus.
-LoadMenuDataHeader:: ; 0x1d35
+LoadMenuDataHeader::
call CopyMenuDataHeader
- call Function1c00
+ call BackUpTiles
ret
-CopyMenuDataHeader:: ; 0x1d3c
+CopyMenuDataHeader::
ld de, wcf81
- ld bc, $0010
+ ld bc, 16
call CopyBytes
ld a, [hROMBank]
ld [wcf8a], a
@@ -16,7 +16,7 @@ CopyMenuDataHeader:: ; 0x1d3c
; 0x1d4b
Function1d4b:: ; 1d4b
- ld [wcf88], a
+ ld [wPocketCursorBuffer], a
ret
; 1d4f
@@ -71,7 +71,7 @@ Call_ExitMenu:: ; 1d7d
ret
; 1d81
-InterpretMenu2:: ; 0x1d81
+InterpretMenu2::
xor a
ld [hBGMapMode], a
call Function1cbb
@@ -81,16 +81,16 @@ InterpretMenu2:: ; 0x1d81
call Function1c66
ld a, [wcf91]
bit 7, a
- jr z, .asm_1da7 ; 0x1d98 $d
+ jr z, .cancel
call Function1c10
call Function1bc9
call Function1ff8
bit 1, a
- jr z, .asm_1da9 ; 0x1da5 $2
-.asm_1da7
+ jr z, .okay
+.cancel
scf
ret
-.asm_1da9
+.okay
and a
ret
; 0x1dab
@@ -103,7 +103,7 @@ GetMenu2:: ; 1dab
ret
; 1db8
-Function1db8:: ; 0x1db8
+Function1db8::
push hl
push bc
push af
@@ -131,9 +131,9 @@ YesNoBox:: ; 1dcf
PlaceYesNoBox:: ; 1dd2
jr _YesNoBox
-Function1dd4:: ; 1dd4
+PlaceGenericTwoOptionBox:: ; 1dd4
call LoadMenuDataHeader
- jr Function1dfe
+ jr InterpretTwoOptionMenu
_YesNoBox:: ; 1dd9
; Return nc (yes) or c (no).
@@ -141,39 +141,41 @@ _YesNoBox:: ; 1dd9
ld hl, YesNoMenuDataHeader
call CopyMenuDataHeader
pop bc
+; This seems to be an overflow prevention, but
+; it was coded wrong.
ld a, b
- cp $e
- jr nz, .asm_1de9
- ld a, $e
+ cp SCREEN_WIDTH - 6
+ jr nz, .okay ; should this be "jr nc"?
+ ld a, SCREEN_WIDTH - 6
ld b, a
-.asm_1de9
+.okay
ld a, b
- ld [wcf83], a
+ ld [wMenuBorderLeftCoord], a
add $5
- ld [wcf85], a
+ ld [wMenuBorderRightCoord], a
ld a, c
- ld [wcf82], a
+ ld [wMenuBorderTopCoord], a
add $4
- ld [wcf84], a
- call Function1c00
+ ld [wMenuBorderBottomCoord], a
+ call BackUpTiles
-Function1dfe:: ; 1dfe
+InterpretTwoOptionMenu:: ; 1dfe
call InterpretMenu2
push af
ld c, $f
call DelayFrames
call WriteBackup
pop af
- jr c, .asm_1e16
+ jr c, .no
ld a, [wcfa9]
cp 2 ; no
- jr z, .asm_1e16
+ jr z, .no
and a
ret
-.asm_1e16
- ld a, $2
+.no
+ ld a, 2
ld [wcfa9], a
scf
ret
@@ -196,7 +198,7 @@ YesNoMenuData2:: ; 1e25
Function1e2e:: ; 1e2e
call Function1e35
- call Function1c00
+ call BackUpTiles
ret
; 1e35
@@ -204,24 +206,24 @@ Function1e35:: ; 1e35
push de
call CopyMenuDataHeader
pop de
- ld a, [wcf83]
+ ld a, [wMenuBorderLeftCoord]
ld h, a
- ld a, [wcf85]
+ ld a, [wMenuBorderRightCoord]
sub h
ld h, a
ld a, d
- ld [wcf83], a
+ ld [wMenuBorderLeftCoord], a
add h
- ld [wcf85], a
- ld a, [wcf82]
+ ld [wMenuBorderRightCoord], a
+ ld a, [wMenuBorderTopCoord]
ld l, a
- ld a, [wcf84]
+ ld a, [wMenuBorderBottomCoord]
sub l
ld l, a
ld a, e
- ld [wcf82], a
+ ld [wMenuBorderTopCoord], a
add l
- ld [wcf84], a
+ ld [wMenuBorderBottomCoord], a
ret
; 1e5d
@@ -243,14 +245,14 @@ SetUpMenu:: ; 1e70
set 7, [hl]
ret
-MenuFunc_1e7f:: ; 0x1e7f
+MenuFunc_1e7f::
call Function1c66
call Function1ebd
call Function1ea6
call Function1cbb
ret
-MenuWriteText:: ; 0x1e8c
+MenuWriteText::
xor a
ld [hBGMapMode], a
call Function1ebd ; sort out the text
@@ -267,18 +269,18 @@ MenuWriteText:: ; 0x1e8c
; 0x1ea6
Function1ea6:: ; 1ea6
- ld a, [wcf83]
+ ld a, [wMenuBorderLeftCoord]
ld c, a
- ld a, [wcf85]
+ ld a, [wMenuBorderRightCoord]
sub c
ld c, a
ld a, [wcf92]
add a
inc a
ld b, a
- ld a, [wcf82]
+ ld a, [wMenuBorderTopCoord]
add b
- ld [wcf84], a
+ ld [wMenuBorderBottomCoord], a
ret
; 1ebd
@@ -308,7 +310,7 @@ Function1ebd:: ; 1ebd
; 1eda
Function1eda:: ; 1eda
- call Function1cfd
+ call GetMemTileCoord
ld bc, $002a
add hl, bc
.asm_1ee1
@@ -408,7 +410,7 @@ Function1f2a:: ; 1f2a
ld a, [hl]
ld [MenuSelection], a
ld a, [wcfa9]
- ld [wcf88], a
+ ld [wPocketCursorBuffer], a
and a
ret
@@ -484,21 +486,23 @@ endr
ret
; 1fbf
-Function1fbf:: ; 1fbf
+ResetTextRelatedRAM:: ; 1fbf
ld hl, wcf71
- call Function1ff0
+ call .bytefill
ld hl, wcf81
- call Function1ff0
+ call .bytefill
ld hl, wcf91
- call Function1ff0
+ call .bytefill
ld hl, wcfa1
- call Function1ff0
+ call .bytefill
+
ld a, [rSVBK]
push af
ld a, $7
ld [rSVBK], a
+
xor a
- ld hl, $dfff
+ ld hl, w7_dfff
rept 2
ld [hld], a
endr
@@ -506,12 +510,13 @@ endr
ld [wcf71], a
ld a, h
ld [wcf72], a
+
pop af
ld [rSVBK], a
ret
; 1ff0
-Function1ff0:: ; 1ff0
+.bytefill: ; 1ff0
ld bc, $0010
xor a
call ByteFill
@@ -521,13 +526,13 @@ Function1ff0:: ; 1ff0
Function1ff8:: ; 1ff8
push af
and $3
- jr z, .asm_2007
+ jr z, .nosound
ld hl, wcf81
bit 3, [hl]
- jr nz, .asm_2007
+ jr nz, .nosound
call PlayClickSFX
-.asm_2007
+.nosound
pop af
ret
; 2009
@@ -566,7 +571,7 @@ InterpretMenu:: ; 202a
ld a, [hROMBank]
ld [wcf94], a
callba Function2400e
- ld a, [wcf88]
+ ld a, [wPocketCursorBuffer]
ret
; 2039
@@ -574,7 +579,7 @@ Function2039:: ; 2039
ld a, [hROMBank]
ld [wcf94], a
callba Function24022
- ld a, [wcf88]
+ ld a, [wPocketCursorBuffer]
ret
; 2048
@@ -582,7 +587,7 @@ Function2048:: ; 2048
ld a, [hROMBank]
ld [wcf94], a
callba Function2403c
- ld a, [wcf88]
+ ld a, [wPocketCursorBuffer]
ret
; 2057
diff --git a/home/mobile.asm b/home/mobile.asm
index c6c225dc8..dbf982d72 100644
--- a/home/mobile.asm
+++ b/home/mobile.asm
@@ -74,9 +74,9 @@ Timer:: ; 3e93
push de
push hl
- ld a, [$ffe9]
+ ld a, [hMobile]
and a
- jr z, .asm_3ed2
+ jr z, .pop_ret
xor a
ld [rTAC], a
@@ -88,15 +88,15 @@ Timer:: ; 3e93
ld a, [$c86a]
or a
- jr z, .asm_3ed2
+ jr z, .pop_ret
ld a, [$c822]
bit 1, a
- jr nz, .asm_3eca
+ jr nz, .skip_Function1118de
ld a, [rSC]
and 1 << rSC_ON
- jr nz, .asm_3eca
+ jr nz, .skip_Function1118de
ld a, [hROMBank]
push af
@@ -111,14 +111,14 @@ Timer:: ; 3e93
ld [$c981], a
rst Bankswitch
-.asm_3eca
+.skip_Function1118de
ld a, [rTMA]
ld [rTIMA], a
ld a, 1 << rTAC_ON | rTAC_65536_HZ
ld [rTAC], a
-.asm_3ed2
+.pop_ret
pop hl
pop de
pop bc
diff --git a/home/movement.asm b/home/movement.asm
index 87f28f5ca..82486b5c1 100644
--- a/home/movement.asm
+++ b/home/movement.asm
@@ -159,11 +159,11 @@ Function1bd3:: ; 1bd3
Function1bdd:: ; 1bdd
push bc
push af
- ld a, [$ffa9]
- and $f0
+ ld a, [hJoyLast]
+ and D_PAD
ld b, a
ld a, [hJoyPressed]
- and $f
+ and BUTTONS
or b
ld b, a
pop af
@@ -190,33 +190,3 @@ Function1bf7:: ; 1bf7
ret
; 1c00
-Function1c00:: ; 1c00
- callab Function24374
- ret
-; 1c07
-
-ExitMenu:: ; 0x1c07
- push af
- callab Function243e8
- pop af
- ret
-
-Function1c10:: ; 0x1c10
- callab Function2446d
- ret
-
-WriteBackup:: ; 0x1c17
- push af
- call ExitMenu
- call Function321c
- call UpdateSprites
- pop af
- ret
-
-Function1c23:: ; 0x1c23
- call Function1cfd
- call Function1c30
- call Function1d19
- call Function1c30
- ret
-; 0x1c30
diff --git a/home/palettes.asm b/home/palettes.asm
index 32ef29057..93498aedd 100644
--- a/home/palettes.asm
+++ b/home/palettes.asm
@@ -79,6 +79,7 @@ DmgToCgbBGPals:: ; c9f
ld [rBGP], a
push af
+; Don't need to be here if CGB
ld a, [hCGB]
and a
jr z, .end
@@ -89,7 +90,7 @@ DmgToCgbBGPals:: ; c9f
ld a, [rSVBK]
push af
- ld a, 5
+ ld a, 5 ; gfx
ld [rSVBK], a
; copy & reorder bg pal buffer
@@ -165,16 +166,21 @@ DmgToCgbObjPals:: ; ccb
Functioncf8:: ; cf8
ld [rOBP0], a
push af
+
+; Don't need to be here if CGB
ld a, [hCGB]
and a
- jr z, .asm_d22
+ jr z, .done
+
push hl
push de
push bc
+
ld a, [rSVBK]
push af
- ld a, $5
+ ld a, 5 ; gfx
ld [rSVBK], a
+
ld hl, OBPals
ld de, Unkn2Pals
ld a, [rOBP0]
@@ -183,13 +189,15 @@ Functioncf8:: ; cf8
call CopyPals
ld a, $1
ld [hCGBPalUpdate], a
+
pop af
ld [rSVBK], a
+
pop bc
pop de
pop hl
-.asm_d22
+.done
pop af
ret
; d24
diff --git a/home/serial.asm b/home/serial.asm
index 8b848bbe2..1ebf00389 100644
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -15,7 +15,7 @@ Serial:: ; 6ef
jr nz, .asm_721
ld a, [$ffcb]
- inc a
+ inc a ; is it equal to -1?
jr z, .asm_726
ld a, [rSB]
@@ -334,7 +334,7 @@ Function87d:: ; 87d
Function8c1:: ; 8c1
push bc
ld b, $60
- ld a, [InLinkBattle]
+ ld a, [wLinkMode]
cp $1
jr z, .asm_8d7
ld b, $60
@@ -391,7 +391,7 @@ Function908:: ; 908
; 919
Function919:: ; 919
- ld a, [InLinkBattle]
+ ld a, [wLinkMode]
and a
ret nz
ld a, $2
diff --git a/home/text.asm b/home/text.asm
index 79f85d38b..1445aa5ef 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -17,19 +17,19 @@ ClearBox:: ; fb6
ld a, " "
FillBoxWithByte::
-.col
+.row
push bc
push hl
-.row
+.col
ld [hli], a
dec c
- jr nz, .row
+ jr nz, .col
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
- jr nz, .col
+ jr nz, .row
ret
; fc8
@@ -61,8 +61,11 @@ ClearScreen:: ; fdb
TextBox:: ; fe8
-; Draw a text box width c height b at hl.
-; Dimensions do not include the border.
+; Draw a text box at hl with room for
+; b lines of c characters each.
+; Places a border around the textbox,
+; then switches the palette to the
+; text black-and-white scheme.
push bc
push hl
call TextBoxBorder
@@ -263,14 +266,14 @@ endm
dict "<ROCKET>", RocketChar
dict "<TM>", TMChar
dict "<TRNER>", TrainerChar
- dict $23, Char23
- dict $22, Char22
+ dict $23, PlaceKougeki
+ dict "<LNBRK>", Char22
dict "<CONT>", ContText
dict "<......>", SixDotsChar
dict "<DONE>", DoneText
dict "<PROMPT>", PromptText
dict "<PKMN>", PlacePKMN
- dict $24, PlacePOKE
+ dict "<POKE>", PlacePOKE
dict $25, NextChar
dict2 $1f, " "
dict "<DEXEND>", PlaceDexEnd
@@ -349,7 +352,7 @@ TMChar: print_name TMCharText ; 11b0
PCChar: print_name PCCharText ; 11b7
RocketChar: print_name RocketCharText ; 11be
PlacePOKe: print_name PlacePOKeText ; 11c5
-Char23: print_name Char23Text ; 11cc
+PlaceKougeki: print_name KougekiText ; 11cc
SixDotsChar: print_name SixDotsCharText ; 11d3
PlacePKMN: print_name PlacePKMNText ; 11da
PlacePOKE: print_name PlacePOKEText ; 11e1
@@ -386,7 +389,7 @@ PlaceMoveTargetsName_5A: ; 1205
PlaceEnemysName:: ; 121b
push de
- ld a, [InLinkBattle]
+ ld a, [wLinkMode]
and a
jr nz, .linkbattle
@@ -425,9 +428,9 @@ PlaceGenderedPlayerName:: ; 1252
ld l, c
ld a, [PlayerGender]
bit 0, a
- ld de, String12a5
+ ld de, String_kun
jr z, PlaceCommandCharacter
- ld de, String12a6
+ ld de, String_chan
jr PlaceCommandCharacter
@@ -444,7 +447,7 @@ TrainerCharText:: db "TRAINER@" ; 1276
PCCharText:: db "PC@" ; 127e
RocketCharText:: db "ROCKET@" ; 1281
PlacePOKeText:: db "POKé@" ; 1288
-Char23Text:: db "こうげき@" ; 128d
+KougekiText:: db "こうげき@" ; 128d
SixDotsCharText:: db "……@" ; 1292
EnemyText:: db "Enemy @" ; 1295
PlacePKMNText:: db "<PK><MN>@" ; PK MN ; 129c
@@ -453,8 +456,8 @@ String12a2:: db " @" ; 12a2
Char35Text::
Char36Text::
Char37Text:: db "@" ; 12a4
-String12a5:: db "@" ; 12a5
-String12a6:: db "@" ; 12a6
+String_kun:: db "@" ; 12a5
+String_chan:: db "@" ; 12a6
; 12a7
NextLineChar:: ; 12a7
@@ -480,31 +483,31 @@ TextFar:: ; 12b9
add hl, bc
ld de, -SCREEN_WIDTH
ld c, 1
-.asm_12c4
+.loop
ld a, h
and a
- jr nz, .asm_12cd
+ jr nz, .next
ld a, l
cp SCREEN_WIDTH
- jr c, .asm_12d1
+ jr c, .done
-.asm_12cd
+.next
add hl, de
inc c
- jr .asm_12c4
+ jr .loop
-.asm_12d1
+.done
hlcoord 0, 0
ld de, SCREEN_WIDTH
ld a, c
-.asm_12d8
+.loop2
and a
- jr z, .asm_12df
+ jr z, .done2
add hl, de
dec a
- jr .asm_12d8
+ jr .loop2
-.asm_12df
+.done2
pop de
inc de
ld a, [de]
@@ -526,20 +529,20 @@ LineChar:: ; 12ea
Paragraph:: ; 12f2
push de
- ld a, [InLinkBattle]
- cp $3
- jr z, .asm_1301
- cp $4
- jr z, .asm_1301
- call Function13c7
-.asm_1301
+ ld a, [wLinkMode]
+ cp LINK_COLOSSEUM
+ jr z, .linkbattle
+ cp LINK_MOBILE
+ jr z, .linkbattle
+ call LoadBlinkingCursor
+.linkbattle
call Function13b6
call KeepTextOpen
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW
call ClearBox
- call Function13cd
+ call UnloadBlinkingCursor
ld c, 20
call DelayFrames
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
@@ -549,26 +552,26 @@ Paragraph:: ; 12f2
Char4B:: ; 131f
- ld a, [InLinkBattle]
+ ld a, [wLinkMode]
or a
- jr nz, .asm_1328
- call Function13c7
-.asm_1328
+ jr nz, .communication
+ call LoadBlinkingCursor
+.communication
call Function13b6
push de
call KeepTextOpen
pop de
- ld a, [InLinkBattle]
+ ld a, [wLinkMode]
or a
- call z, Function13cd
+ call z, UnloadBlinkingCursor
Char4C:: ; 1337
push de
- call Function138c
- call Function138c
+ call TextScroll
+ call TextScroll
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
pop de
jp NextChar
@@ -599,22 +602,22 @@ PlaceDexEnd:: ; 1356
; 135a
PromptText:: ; 135a
- ld a, [InLinkBattle]
- cp $3
+ ld a, [wLinkMode]
+ cp LINK_COLOSSEUM
jr z, .ok
- cp $4
+ cp LINK_MOBILE
jr z, .ok
- call Function13c7
-.ok
+ call LoadBlinkingCursor
+.ok
call Function13b6
call KeepTextOpen
- ld a, [InLinkBattle]
- cp $3
+ ld a, [wLinkMode]
+ cp LINK_COLOSSEUM
jr z, DoneText
- cp $4
+ cp LINK_MOBILE
jr z, DoneText
- call Function13cd
+ call UnloadBlinkingCursor
DoneText:: ; 137c
pop hl
@@ -631,19 +634,22 @@ NullChar:: ; 1383
jp NextChar
; 138c
-Function138c:: ; 138c
+TextScroll:: ; 138c
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY
decoord TEXTBOX_INNERX, TEXTBOX_INNERY - 1
ld a, TEXTBOX_INNERH - 1
+
.col
push af
ld c, TEXTBOX_INNERW
+
.row
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .row
+
rept 2
inc de
endr
@@ -653,6 +659,7 @@ endr
pop af
dec a
jr nz, .col
+
hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ld a, " "
ld bc, TEXTBOX_INNERW
@@ -668,7 +675,9 @@ Function13b6:: ; 13b6
push af
ld a, 1
ld [hOAMUpdate], a
+
call WaitBGMap
+
pop af
ld [hOAMUpdate], a
pop bc
@@ -679,15 +688,15 @@ Diacritic:: ; 13c6
ret
; 13c7
-Function13c7:: ; 13c7
+LoadBlinkingCursor:: ; 13c7
ld a, "▼"
- ld [TileMap + 18 + 17 * SCREEN_WIDTH], a
+ ldcoord_a 18, 17
ret
; 13cd
-Function13cd:: ; 13cd
- ld a, [TileMap + 17 + 17 * SCREEN_WIDTH]
- ld [TileMap + 18 + 17 * SCREEN_WIDTH], a
+UnloadBlinkingCursor:: ; 13cd
+ lda_coord 17, 17
+ ldcoord_a 18, 17
ret
; 13d4
@@ -719,19 +728,19 @@ PlaceWholeStringInBoxAtOnce:: ; 13e5
set 1, a
ld [TextBoxFrame + 1], a
- call Function13f6
+ call DoTextUntilTerminator
pop af
ld [TextBoxFrame + 1], a
ret
; 13f6
-Function13f6:: ; 13f6
+DoTextUntilTerminator:: ; 13f6
ld a, [hli]
cp "@"
ret z
call .TextCommand
- jr Function13f6
+ jr DoTextUntilTerminator
.TextCommand:
push hl
@@ -754,19 +763,19 @@ endr
; 1410
TextCommands:: ; 1410
- dw Text_00
- dw Text_01
- dw Text_02
- dw Text_03
- dw Text_04
- dw Text_05
- dw Text_06
- dw Text_07
- dw Text_08
- dw Text_09
- dw Text_0A
+ dw Text_TX
+ dw Text_TX_RAM
+ dw Text_TX_BCD
+ dw Text_TX_MOVE
+ dw Text_TX_BOX
+ dw Text_TX_LOW
+ dw Text_WAIT_BUTTON
+ dw Text_TX_SCROLL
+ dw Text_START_ASM
+ dw Text_TX_NUM
+ dw Text_TX_EXIT
dw Text_PlaySound ; $0b
- dw Text_0C
+ dw Text_TX_DOTS
dw Text_0D
dw Text_PlaySound ; $0e
dw Text_PlaySound ; $0f
@@ -774,12 +783,12 @@ TextCommands:: ; 1410
dw Text_PlaySound ; $11
dw Text_PlaySound ; $12
dw Text_PlaySound ; $13
- dw Text_14
- dw Text_15
- dw Text_16
+ dw Text_TX_STRINGBUFFER
+ dw Text_TX_DAY
+ dw Text_TX_FAR
; 143e
-Text_00:: ; 143e
+Text_TX:: ; 143e
; TX
; write text until "@"
; [$00]["...@"]
@@ -795,7 +804,7 @@ Text_00:: ; 143e
ret
; 1449
-Text_01:: ; 1449
+Text_TX_RAM:: ; 1449
; text_from_ram
; write text from a ram address
; little endian
@@ -813,7 +822,7 @@ Text_01:: ; 1449
ret
; 1455
-Text_16:: ; 1455
+Text_TX_FAR:: ; 1455
; text_jump
; write text from a different bank
; little endian
@@ -834,7 +843,7 @@ Text_16:: ; 1455
push hl
ld h, d
ld l, e
- call Function13f6
+ call DoTextUntilTerminator
pop hl
pop af
@@ -843,7 +852,7 @@ Text_16:: ; 1455
ret
; 1470
-Text_02:: ; 1470
+Text_TX_BCD:: ; 1470
; TX_BCD
; write bcd from address, typically ram
; [$02][addr][flags]
@@ -865,7 +874,7 @@ Text_02:: ; 1470
ret
; 1480
-Text_03:: ; 1480
+Text_TX_MOVE:: ; 1480
; TX_MOVE
; move to a new tile
; [$03][addr]
@@ -879,7 +888,7 @@ Text_03:: ; 1480
ret
; 148b
-Text_04:: ; 148b
+Text_TX_BOX:: ; 148b
; TX_BOX
; draw a box
; little endian
@@ -901,7 +910,7 @@ Text_04:: ; 148b
ret
; 149b
-Text_05:: ; 149b
+Text_TX_LOW:: ; 149b
; TX_LOW
; write text at (1,16)
; [$05]
@@ -910,39 +919,41 @@ Text_05:: ; 149b
ret
; 149f
-Text_06:: ; 149f
+Text_WAIT_BUTTON:: ; 149f
; TX_WAITBUTTON
; wait for button press
; show arrow
; [06]
- ld a, [InLinkBattle]
- cp $3
+ ld a, [wLinkMode]
+ cp LINK_COLOSSEUM
jp z, Text_0D
- cp $4
+ cp LINK_MOBILE
jp z, Text_0D
push hl
- call Function13c7
+ call LoadBlinkingCursor
push bc
call KeepTextOpen
pop bc
- call Function13cd
+ call UnloadBlinkingCursor
pop hl
ret
; 14ba
-Text_07:: ; 14ba
+Text_TX_SCROLL:: ; 14ba
+; pushes text up two lines and sets the BC cursor to the border tile
+; below the first character column of the text box.
push hl
- call Function13cd
- call Function138c
- call Function138c
+ call UnloadBlinkingCursor
+ call TextScroll
+ call TextScroll
pop hl
bccoord TEXTBOX_INNERX, TEXTBOX_INNERY + 2
ret
; 14c9
-Text_08:: ; 14c9
+Text_START_ASM:: ; 14c9
; TX_ASM
bit 7, h
@@ -955,7 +966,7 @@ Text_08:: ; 14c9
ret
; 14d2
-Text_09:: ; 14d2
+Text_TX_NUM:: ; 14d2
; TX_NUM
; [$09][addr][hi:bytes lo:digits]
ld a, [hli]
@@ -981,7 +992,7 @@ Text_09:: ; 14d2
ret
; 14ed
-Text_0A:: ; 14ed
+Text_TX_EXIT:: ; 14ed
push hl
push bc
call GetJoypad
@@ -1056,13 +1067,14 @@ TextSFX:: ; 152d
db -1
; 1543
-Text_0C:: ; 1543
+Text_TX_DOTS:: ; 1543
; [$0C][num]
ld a, [hli]
ld d, a
push hl
ld h, b
ld l, c
+
.loop
push de
ld a, "…"
@@ -1077,6 +1089,7 @@ Text_0C:: ; 1543
pop de
dec d
jr nz, .loop
+
ld b, h
ld c, l
pop hl
@@ -1094,7 +1107,7 @@ Text_0D:: ; 1562
ret
; 156a
-Text_14:: ; 156a
+Text_TX_STRINGBUFFER:: ; 156a
; Print a string from one of the following:
; 0: StringBuffer3
; 1: StringBuffer4
@@ -1124,7 +1137,7 @@ endr
ret
; 1582
-Text_15:: ; 1582
+Text_TX_DAY:: ; 1582
; TX_DAY
call GetWeekday
diff --git a/home/tilemap.asm b/home/tilemap.asm
index d0875c37b..d6a8f31b1 100644
--- a/home/tilemap.asm
+++ b/home/tilemap.asm
@@ -1,44 +1,79 @@
-Function1c30:: ; 0x1c30
- call Function1c53
+BackUpTiles:: ; 1c00
+ callab _BackUpTiles
+ ret
+; 1c07
+
+ExitMenu:: ; 0x1c07
+ push af
+ callab Function243e8
+ pop af
+ ret
+
+Function1c10:: ; 0x1c10
+ callab Function2446d
+ ret
+
+WriteBackup:: ; 0x1c17
+ push af
+ call ExitMenu
+ call Function321c
+ call UpdateSprites
+ pop af
+ ret
+
+RestoreTileBackup:: ; 0x1c23
+ call GetMemTileCoord
+ call .copy
+ call GetMemAttrCoord
+ call .copy
+ ret
+; 0x1c30
+
+.copy: ; 0x1c30
+ call GetMenuBoxDims
inc b
inc c
-.asm_1c35
+
+.row
push bc
push hl
-.asm_1c37
+
+.col
ld a, [de]
ld [hli], a
dec de
dec c
- jr nz, .asm_1c37 ; 0x1c3b $fa
+ jr nz, .col ; 0x1c3b $fa
+
pop hl
- ld bc, $0014
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
- jr nz, .asm_1c35 ; 0x1c44 $ef
+ jr nz, .row ; 0x1c44 $ef
+
ret
Function1c47:: ; 0x1c47
ld b, $10
ld de, wcf81
-.asm_1c4c
+.loop
ld a, [hld]
ld [de], a
inc de
dec b
- jr nz, .asm_1c4c ; 0x1c50 $fa
+ jr nz, .loop ; 0x1c50 $fa
ret
-Function1c53:: ; 0x1c53
- ld a, [wcf82]
+GetMenuBoxDims:: ; 0x1c53
+ ld a, [wMenuBorderTopCoord] ; top
ld b, a
- ld a, [wcf84]
+ ld a, [wMenuBorderBottomCoord] ; bottom
sub b
ld b, a
- ld a, [wcf83]
+ ld a, [wMenuBorderLeftCoord] ; left
ld c, a
- ld a, [wcf85]
+ ld a, [wMenuBorderRightCoord] ; right
sub c
ld c, a
ret
@@ -99,7 +134,7 @@ Function1c89:: ; 1c89
ld a, [wcf91]
bit 4, a
ret z
- call Function1cfd
+ call GetMemTileCoord
ld a, [de]
ld c, a
inc de
@@ -109,18 +144,18 @@ Function1c89:: ; 1c89
; 1cbb
Function1cbb:: ; 1cbb
- call Function1cfd
- call Function1c53
+ call GetMemTileCoord
+ call GetMenuBoxDims
dec b
dec c
jp TextBox
; 1cc6
Function1cc6:: ; 1cc6
- ld a, [wcf82]
+ ld a, [wMenuBorderTopCoord]
ld b, a
inc b
- ld a, [wcf83]
+ ld a, [wMenuBorderLeftCoord]
ld c, a
inc c
ld a, [wcf91]
@@ -139,10 +174,10 @@ Function1cc6:: ; 1cc6
; 1ce1
Function1ce1:: ; 1ce1
- call Function1cfd
+ call GetMemTileCoord
ld bc, $0015
add hl, bc
- call Function1c53
+ call GetMenuBoxDims
dec b
dec c
call ClearBox
@@ -150,8 +185,8 @@ Function1ce1:: ; 1ce1
; 1cf1
Function1cf1:: ; 1cf1
- call Function1cfd
- call Function1c53
+ call GetMemTileCoord
+ call GetMenuBoxDims
inc c
inc b
call ClearBox
@@ -159,10 +194,10 @@ Function1cf1:: ; 1cf1
; 1cfd
-Function1cfd:: ; 1cfd
- ld a, [wcf83]
+GetMemTileCoord:: ; 1cfd
+ ld a, [wMenuBorderLeftCoord]
ld c, a
- ld a, [wcf82]
+ ld a, [wMenuBorderTopCoord]
ld b, a
; 1d05
@@ -191,10 +226,10 @@ endr
ret
; 1d19
-Function1d19:: ; 1d19
- ld a, [wcf83]
+GetMemAttrCoord:: ; 1d19
+ ld a, [wMenuBorderLeftCoord]
ld c, a
- ld a, [wcf82]
+ ld a, [wMenuBorderTopCoord]
ld b, a
GetAttrCoord:: ; 1d21
diff --git a/home/time.asm b/home/time.asm
index 609e466fc..173ea573c 100644
--- a/home/time.asm
+++ b/home/time.asm
@@ -3,7 +3,7 @@
AskTimer:: ; 591
push af
- ld a, [$ffe9]
+ ld a, [hMobile]
and a
jr z, .asm_59a
call Timer
diff --git a/home/vblank.asm b/home/vblank.asm
index b8b8b0efb..870ef4808 100644
--- a/home/vblank.asm
+++ b/home/vblank.asm
@@ -146,7 +146,7 @@ VBlank0:: ; 2b1
rst Bankswitch
ld a, [hSeconds]
- ld [$ffe3], a
+ ld [hSecondsBackup], a
ret
; 325
diff --git a/home/window.asm b/home/window.asm
index 0d30cfbdd..1198cfbe1 100644
--- a/home/window.asm
+++ b/home/window.asm
@@ -1,6 +1,6 @@
ResetWindow:: ; 2dba
- call Function1fbf
+ call ResetTextRelatedRAM
ld a, [hROMBank]
push af
ld a, BANK(Function6454) ; and BANK(Function64bf)
@@ -16,12 +16,14 @@ ResetWindow:: ; 2dba
; 2dcf
-Function2dcf:: ; 2dcf
+LoadMoveSprites:: ; 2dcf
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
+
call Function2de2
+
pop af
ld [hOAMUpdate], a
ld hl, VramState
@@ -30,7 +32,7 @@ Function2dcf:: ; 2dcf
; 2de2
Function2de2:: ; 2de2
- call Function1fbf
+ call ResetTextRelatedRAM
xor a
ld [hBGMapMode], a
call Function2173
@@ -46,8 +48,8 @@ Function2de2:: ; 2de2
ret
; 2e08
-Function2e08:: ; 2e08
- call Function1fbf
+LoadFont:: ; 2e08
+ call ResetTextRelatedRAM
ld a, [hROMBank]
push af
ld a, BANK(Function6454) ; and BANK(Function64bf)
@@ -68,7 +70,9 @@ Function2e20:: ; 2e20
push af
ld a, $1
ld [hOAMUpdate], a
+
callba Function104110
+
pop af
ld [hOAMUpdate], a
ret