summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEldred Habert <eldredhabert0@gmail.com>2018-06-06 17:19:29 +0200
committerGitHub <noreply@github.com>2018-06-06 17:19:29 +0200
commit530e3e80691d27d0c65c1f91ce79bb65e39d4283 (patch)
tree3245f62a48f97b3720104fcfa1dfcc5a5b658156
parentea2d9e25e15f45169bff9b769244812f10f42929 (diff)
parent1d70c1e4ca11ecdf21beaebcfbc3eedc2b6dea95 (diff)
Merge pull request #13 from PikalaxALT/rtc_fade
Time of day palettes and fade functions
-rw-r--r--audio/engine.asm26
-rw-r--r--constants/misc_constants.asm6
-rw-r--r--data/predef_pointers.inc166
-rw-r--r--home/copy2.asm17
-rw-r--r--home/fade.asm95
-rw-r--r--home/init.asm14
-rw-r--r--home/joypad.asm10
-rw-r--r--home/rtc.asm20
-rw-r--r--home/serial.asm299
-rw-r--r--home/text.asm366
-rw-r--r--home/time.asm138
-rw-r--r--home/unknown.asm15
-rw-r--r--home/vcopy.asm2
-rw-r--r--home/window.asm266
-rw-r--r--hram.asm12
-rw-r--r--macros/farcall.asm12
-rw-r--r--shim.sym430
-rw-r--r--sram.asm3
-rw-r--r--wram.asm62
19 files changed, 1636 insertions, 323 deletions
diff --git a/audio/engine.asm b/audio/engine.asm
index 0d1d065..8d66a08 100644
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -74,7 +74,7 @@ _UpdateSound:: ; 3a:4037
cp NUM_CHANNELS
jr nz, .loop
- call Function_e82f0
+ call Functione82f0
ret
UpdateChannel: ; 3a:4061
@@ -94,10 +94,10 @@ UpdateChannel: ; 3a:4061
.noteover
call DisablePitchWheel
- call Function_e884f
+ call Functione884f
.continue_sound_update
- call Function_e80b6
+ call Functione80b6
ret
DisablePitchWheel: ; 3a:4061
@@ -106,7 +106,7 @@ DisablePitchWheel: ; 3a:4061
res SOUND_PITCH_WHEEL, [hl]
ret
-Unreferenced_Function_e8081: ; 3a:4081
+Unreferenced_Functione8081: ; 3a:4081
ld a, [wMapMusic]
bit 0, a
jr nz, .disable_music
@@ -153,7 +153,7 @@ GetChannelRegisters: ; 3a:40a4
.registers
db LOW(rNR10), LOW(rNR20), LOW(rNR30), LOW(rNR40)
-Function_e80b6: ; 3a:40b6
+Functione80b6: ; 3a:40b6
ld hl, CHANNEL_DUTY_CYCLE
add hl, bc
ld a, [hl]
@@ -172,13 +172,13 @@ Function_e80b6: ; 3a:40b6
ld [wCurTrackFrequency + 1], a
ld a, $3f
ld [wc195], a
- call Function_e85d8
- call Function_e87f9
- call Function_e8839
+ call Functione85d8
+ call Functione87f9
+ call Functione8839
call IsChannelSFXOn
jr nc, .end
- call Function_e80fa
+ call Functione80fa
ld hl, CHANNEL_TRACKS
add hl, bc
ld a, [wSoundOutput]
@@ -192,7 +192,7 @@ Function_e80b6: ; 3a:40b6
ld [hl], a
ret
-Function_e80fa: ; 3a:40fa
+Functione80fa: ; 3a:40fa
ld hl, .jumptable
ld a, [wCurChannel]
maskbits NUM_CHANNELS
@@ -249,12 +249,12 @@ IsAnySFXOn: ; 3a:42d0
scf
ret
-SECTION "Function_e82f0", ROMX[$42f0], BANK[$3a]
-Function_e82f0: ; 3a:42f0
+SECTION "Functione82f0", ROMX[$42f0], BANK[$3a]
+Functione82f0: ; 3a:42f0
call IncrementTempo
call PlayDanger
call FadeMusic
- call Function_e841d
+ call Functione841d
ld a, [wVolume]
ld [rNR50], a
ld a, [wSoundOutput]
diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm
index 19deb8e..39f2769 100644
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -21,4 +21,8 @@ D_UP EQU 1 << D_UP_F
D_DOWN EQU 1 << D_DOWN_F
BUTTONS EQU A_BUTTON | B_BUTTON | SELECT | START
-D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN \ No newline at end of file
+D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN
+
+; Boolean values
+FALSE EQU 0
+TRUE EQU 1
diff --git a/data/predef_pointers.inc b/data/predef_pointers.inc
index 691a072..de14d19 100644
--- a/data/predef_pointers.inc
+++ b/data/predef_pointers.inc
@@ -11,91 +11,91 @@ PredefPointers:: ; 1:62d3
; Please be a peach and nuke the hell out of these:
; WE NEED LABELS!
; Thank youu~
- add_predef Function_6445
- add_predef Function_5d27
- add_predef Function_6713
- add_predef Function_66b1
- add_predef Function_4031
- add_predef Function_ce10
- add_predef Function_cd6f
- add_predef Function_cde3
- add_predef Function_cde3_2
- add_predef Function_cde3_3
- add_predef Function_cdf9
- add_predef Function_ce10_2
- add_predef Function_cd33
+ add_predef Function6445
+ add_predef Function5d27
+ add_predef Function6713
+ add_predef Function66b1
+ add_predef Function4031
+ add_predef Functionce10
+ add_predef Functioncd6f
+ add_predef Functioncde3
+ add_predef Functioncde3_2
+ add_predef Functioncde3_3
+ add_predef Functioncdf9
+ add_predef Functionce10_2
+ add_predef Functioncd33
GiveItemPredef::
dbw 3, GiveItem
- add_predef Function_ce3c
- add_predef Function_da28
- add_predef Function_d886
- add_predef Function_da4f
- add_predef Function_dac8
- add_predef Function_dcfc
- add_predef Function_dc16
- add_predef Function_dd5c
- add_predef Function_de79
- add_predef Function_ce7c
- add_predef Function_df7d
- add_predef Function_df91
- add_predef Function_1128f
- add_predef Function_112c1
- add_predef Function_28c98
- add_predef Function_2d663
- add_predef Function_3d5ce
- add_predef Function_3f019
- add_predef Function_3f068
- add_predef Function_3f04a
- add_predef Function_3d08c
- add_predef Function_3d67c
- add_predef Function_3e1a4
- add_predef Function_3ef19
- add_predef Function_3e874
- add_predef Function_3e91e
- add_predef Function_3e963
- add_predef Function_421f8
- add_predef Function_42252
- add_predef Function_41fa1
- add_predef Function_28da4
- add_predef Function_28d6e
- add_predef Function_40ac7
- add_predef Function_40000
- add_predef Function_40b5c
- add_predef Function_50000
- add_predef Function_50bfe
- add_predef Function_50bcd
- add_predef Function_50b92
- add_predef Function_508c4
- add_predef Function_50771
- add_predef Function_50774
- add_predef Function_5081f
- add_predef Function_506d4
- add_predef Function_5069e
- add_predef Function_502b5
- add_predef Function_50244
- add_predef Function_50248
- add_predef Function_500c6
- add_predef Function_500a0
- add_predef Function_50073
- add_predef Function_50ed9
- add_predef Function_cb6ff
- add_predef Function_cb710
- add_predef Function_cb733
- add_predef Function_145b8
- add_predef Function_146dc
- add_predef Function_145de
+ add_predef Functionce3c
+ add_predef Functionda28
+ add_predef Functiond886
+ add_predef Functionda4f
+ add_predef Functiondac8
+ add_predef Functiondcfc
+ add_predef Functiondc16
+ add_predef Functiondd5c
+ add_predef Functionde79
+ add_predef Functionce7c
+ add_predef Functiondf7d
+ add_predef Functiondf91
+ add_predef Function1128f
+ add_predef Function112c1
+ add_predef Function28c98
+ add_predef Function2d663
+ add_predef Function3d5ce
+ add_predef Function3f019
+ add_predef Function3f068
+ add_predef Function3f04a
+ add_predef Function3d08c
+ add_predef Function3d67c
+ add_predef Function3e1a4
+ add_predef Function3ef19
+ add_predef Function3e874
+ add_predef Function3e91e
+ add_predef Function3e963
+ add_predef Function421f8
+ add_predef Function42252
+ add_predef Function41fa1
+ add_predef Function28da4
+ add_predef Function28d6e
+ add_predef Function40ac7
+ add_predef Function40000
+ add_predef Function40b5c
+ add_predef Function50000
+ add_predef Function50bfe
+ add_predef Function50bcd
+ add_predef Function50b92
+ add_predef Function508c4
+ add_predef Function50771
+ add_predef Function50774
+ add_predef Function5081f
+ add_predef Function506d4
+ add_predef Function5069e
+ add_predef Function502b5
+ add_predef Function50244
+ add_predef Function50248
+ add_predef Function500c6
+ add_predef Function500a0
+ add_predef Function50073
+ add_predef Function50ed9
+ add_predef Functioncb6ff
+ add_predef Functioncb710
+ add_predef Functioncb733
+ add_predef Function145b8
+ add_predef Function146dc
+ add_predef Function145de
add_predef ExecuteBGEffects
- add_predef Function_1457a
- add_predef Function_143e0
+ add_predef Function1457a
+ add_predef Function143e0
add_predef CheckSGB
- add_predef Function_928b
- add_predef Function_8786
- add_predef Function_8c4be
- add_predef Function_8c9c6
- add_predef Function_8c940
- add_predef Function_cc001
- add_predef Function_cc000
- add_predef Function_cc000_2
- add_predef Function_fdb66
- add_predef Function_1240b
+ add_predef Function928b
+ add_predef Function8786
+ add_predef Function8c4be
+ add_predef Function8c9c6
+ add_predef Function8c940
+ add_predef Functioncc001
+ add_predef Functioncc000
+ add_predef Functioncc000_2
+ add_predef Functionfdb66
+ add_predef Function1240b
dbw $ff, InexplicablyEmptyFunction
diff --git a/home/copy2.asm b/home/copy2.asm
index 5d3afe2..7cc4696 100644
--- a/home/copy2.asm
+++ b/home/copy2.asm
@@ -1,6 +1,21 @@
INCLUDE "constants.asm"
-SECTION "Video Copy functions", ROM0[$0D2A]
+SECTION "Video Copy functions", ROM0[$0D02]
+
+Function0d02::
+ jpab Function14000
+
+LoadFont:: ; 00:0d0a
+ jpab LoadFontGraphics
+
+LoadFontsBattleExtra::
+ jpab LoadPokemonMenuGraphics
+
+LoadFontExtra:: ; 00:0d1a
+ jpab LoadFontExtraGraphicsWithCursor
+
+LoadFontExtra2::
+ jpab LoadHexadecimalFontOrHUDGraphics
FarCopyData: ; d2a (0:d2a)
; Identical to FarCopyBytes except for tail call optimization
diff --git a/home/fade.asm b/home/fade.asm
new file mode 100644
index 0000000..e39bd83
--- /dev/null
+++ b/home/fade.asm
@@ -0,0 +1,95 @@
+include "constants.asm"
+
+if DEBUG
+SECTION "DMG Palette Fade Effect", ROM0 [$0343]
+else
+SECTION "DMG Palette Fade Effect", ROM0 [$0307]
+endc
+
+Function0343:: ; 0343
+ ld a, [wTimeOfDayPal]
+ ld b, a
+ ld hl, IncGradGBPalTable_11 ; $39f
+ ld a, l
+ sub b
+ ld l, a
+ jr nc, .okay
+ dec h
+.okay
+ ld a, [hli]
+ ld [rBGP], a
+ ld a, [hli]
+ ld [rOBP0], a
+ ld a, [hli]
+ ld [rOBP1], a
+ ret
+
+RotateFourPalettesRight::
+ ld hl, IncGradGBPalTable_08 ; $396
+ ld b, $4
+ jr RotatePalettesRight
+
+RotateThreePalettesRight::
+ ld hl, IncGradGBPalTable_13 ; $3a5
+ ld b, $3
+RotatePalettesRight:: ; 0366
+; Rotate palettes to the right and fill with loaded colors from the left
+; If we're already at the leftmost color, fill with the leftmost color
+.loop
+ ld a, [hli]
+ ld [rBGP], a
+ ld a, [hli]
+ ld [rOBP0], a
+ ld a, [hli]
+ ld [rOBP1], a
+ ld c, $8
+ call DelayFrames
+ dec b
+ jr nz, .loop
+ ret
+
+RotateFourPalettesLeft::
+ ld hl, IncGradGBPalTable_12 - 1 ; $3a1
+ ld b, $4
+ jr RotatePalettesLeft
+
+RotateThreePalettesLeft::
+ ld hl, IncGradGBPalTable_15 - 1 ; $3aa
+ ld b, $3
+RotatePalettesLeft:: ; 0384
+; Rotate palettes to the left and fill with loaded colors from the right
+; If we're already at the rightmost color, fill with the rightmost color
+.loop
+ ld a, [hld]
+ ld [rOBP1], a
+ ld a, [hld]
+ ld [rOBP0], a
+ ld a, [hld]
+ ld [rBGP], a
+ ld c, $8
+ call DelayFrames
+ dec b
+ jr nz, .loop
+ ret
+
+; IncGradGBPalTable_00:: db %11111111, %11111111, %11111111
+; IncGradGBPalTable_01:: db %11111110, %11111110, %11111110
+; IncGradGBPalTable_02:: db %11111001, %11111001, %11111001
+; IncGradGBPalTable_03:: db %11100100, %11100100, %11100100
+
+; IncGradGBPalTable_04:: db %11100100, %11100100, %11100100
+; IncGradGBPalTable_05:: db %10010000, %10010000, %10010000
+; IncGradGBPalTable_06:: db %01000000, %01000000, %01000000
+
+; IncGradGBPalTable_07:: db %00000000, %00000000, %00000000
+; bgp obp1 obp2
+IncGradGBPalTable_08:: db %11111111, %11111111, %11111111
+IncGradGBPalTable_09:: db %11111110, %11111110, %11111000
+IncGradGBPalTable_10:: db %11111001, %11100100, %11100100
+IncGradGBPalTable_11:: db %11100100, %11010000, %11100000
+
+IncGradGBPalTable_12:: db %11100100, %11010000, %11100000
+IncGradGBPalTable_13:: db %10010000, %10000000, %10010000
+IncGradGBPalTable_14:: db %01000000, %01000000, %01000000
+
+IncGradGBPalTable_15:: db %00000000, %00000000, %00000000
diff --git a/home/init.asm b/home/init.asm
index ef4b745..515ce84 100644
--- a/home/init.asm
+++ b/home/init.asm
@@ -21,8 +21,20 @@ else
endc
endc
+SECTION "Init", ROM0[$51C]
-SECTION "Init", ROM0[$52F]
+Reset: ; 51c (0:051c)
+ call DisableAudio
+ call ClearPalettes
+ ei
+
+ ld hl, wJoypadFlags
+ set 7, [hl]
+
+ ld c, 32
+ call DelayFrames
+
+ jr Init
Init: ; 052f
di
diff --git a/home/joypad.asm b/home/joypad.asm
index 5a4e549..faa7cf0 100644
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -1,6 +1,14 @@
INCLUDE "constants.asm"
-SECTION "Joypad functions", ROM0[$07FE]
+SECTION "Joypad functions", ROM0[$07F8]
+
+ClearJoypad::
+ xor a
+; Pressed this frame (delta)
+ ldh [hJoyDown], a
+; Currently pressed
+ ldh [hJoyState], a
+ ret
Joypad:: ; 7fe (0:7fe)
; Read the joypad register and translate it to something more
diff --git a/home/rtc.asm b/home/rtc.asm
new file mode 100644
index 0000000..6179278
--- /dev/null
+++ b/home/rtc.asm
@@ -0,0 +1,20 @@
+include "constants.asm"
+
+if DEBUG
+SECTION "Time Of Day Palettes", ROM0 [$032B]
+else
+SECTION "Time Of Day Palettes", ROM0 [$02EF]
+endc
+
+UpdateTimeOfDayPalettes: ; 32b (0:032b)
+ ld a, [wVramState]
+ bit 0, a
+ ret z
+TimeOfDayPals::
+ callab _TimeOfDayPals ; Func_8c2e3
+ ret
+
+UpdateTimePals:: ; 33a
+ callab _UpdateTimePals ; Func_8c335
+ ret
+
diff --git a/home/serial.asm b/home/serial.asm
index 48d6832..d51e5a6 100644
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -16,7 +16,7 @@ Serial::
ldh a, [hSerialSend]
ld [rSB], a
ldh a, [hLinkPlayerNumber]
- cp 2
+ cp USING_INTERNAL_CLOCK
jr z, .done
ld a, 1 << rSC_ON
ld [rSC], a
@@ -26,7 +26,7 @@ Serial::
ld a, [rSB]
ldh [hSerialReceive], a
ldh [hLinkPlayerNumber], a
- cp 2
+ cp USING_INTERNAL_CLOCK
jr z, .master
xor a
ld [rSB], a
@@ -43,7 +43,7 @@ Serial::
xor a
ld [rSB], a
.done
- ld a, 1
+ ld a, TRUE
ldh [hSerialReceived], a
ld a, SERIAL_NO_DATA_BYTE
ldh [hSerialSend], a
@@ -52,3 +52,296 @@ Serial::
pop bc
pop af
reti
+
+Serial_ExchangeBytes:: ; 64c
+ ld a, $1
+ ldh [hSerialIgnoringInitialData], a
+.loop
+ ld a, [hl]
+ ldh [hSerialSend], a
+ call Serial_ExchangeByte
+ push bc
+ ld b, a
+ inc hl
+ ld a, $30
+.wait
+ dec a
+ jr nz, .wait
+ ldh a, [hSerialIgnoringInitialData]
+ and a
+ ld a, b
+ pop bc
+ jr z, .load
+ dec hl
+ cp SERIAL_PREAMBLE_BYTE
+ jr nz, .loop
+ xor a
+ ldh [hSerialIgnoringInitialData], a
+ jr .loop
+
+.load
+ ld [de], a
+ inc de
+ dec bc
+ ld a, b
+ or c
+ jr nz, .loop
+ ret
+
+Serial_ExchangeByte:: ; 677 (0:0677)
+.loop
+ xor a
+ ldh [hSerialReceived], a
+ ldh a, [hLinkPlayerNumber]
+ cp USING_INTERNAL_CLOCK
+ jr nz, .not_player_2
+ ld a, (1 << rSC_ON) | 1
+ ldh [rSC], a
+.not_player_2
+.loop2
+ ldh a, [hSerialReceived]
+ and a
+ jr nz, .reset_ffca
+ ldh a, [hLinkPlayerNumber]
+ cp $1
+ jr nz, .not_player_1_or_wLinkTimeoutFrames_zero
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, .not_player_1_or_wLinkTimeoutFrames_zero
+ call .delay_15_cycles
+ push hl
+ ld hl, wLinkTimeoutFrames + 1
+ inc [hl]
+ jr nz, .no_rollover_up
+ dec hl
+ inc [hl]
+
+.no_rollover_up
+ pop hl
+ call CheckwLinkTimeoutFramesNonzero
+ jr nz, .loop2
+ jp SerialDisconnected
+
+.not_player_1_or_wLinkTimeoutFrames_zero
+ ldh a, [rIE]
+ and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
+ cp 1 << SERIAL
+ jr nz, .loop2
+ ld a, [wcb58]
+ dec a
+ ld [wcb58], a
+ jr nz, .loop2
+ ld a, [wcb58 + 1]
+ dec a
+ ld [wcb58 + 1], a
+ jr nz, .loop2
+ ldh a, [hLinkPlayerNumber]
+ cp USING_EXTERNAL_CLOCK
+ jr z, .reset_ffca
+
+ ld a, 255
+.delay_255_cycles
+ dec a
+ jr nz, .delay_255_cycles
+
+.reset_ffca
+ xor a
+ ldh [hSerialReceived], a
+ ldh a, [rIE]
+ and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
+ sub 1 << SERIAL
+ jr nz, .rIE_not_equal_8
+
+ ; LOW($5000)
+ ld [wcb58], a
+ ld a, HIGH($5000)
+ ld [wcb58 + 1], a
+
+.rIE_not_equal_8
+ ldh a, [hSerialReceive]
+ cp SERIAL_NO_DATA_BYTE
+ ret nz
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, .linkTimeoutFrames_zero
+ push hl
+ ld hl, wLinkTimeoutFrames + 1
+ ld a, [hl]
+ dec a
+ ld [hld], a
+ inc a
+ jr nz, .no_rollover
+ dec [hl]
+
+.no_rollover
+ pop hl
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, SerialDisconnected
+
+.linkTimeoutFrames_zero
+ ldh a, [rIE]
+ and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
+ cp 1 << SERIAL
+ ld a, SERIAL_NO_DATA_BYTE
+ ret z
+ ld a, [hl]
+ ldh [hSerialSend], a
+ call DelayFrame
+ jp .loop
+
+.delay_15_cycles: ; 70e (0:070e)
+ ld a, 15
+.delay_cycles
+ dec a
+ jr nz, .delay_cycles
+ ret
+
+CheckwLinkTimeoutFramesNonzero: ; 714 (0:0714)
+ push hl
+ ld hl, wLinkTimeoutFrames
+ ld a, [hli]
+ or [hl]
+ pop hl
+ ret
+
+SerialDisconnected: ; 71c (0:071c)
+ dec a
+ ld [wLinkTimeoutFrames], a
+ ld [wLinkTimeoutFrames + 1], a
+ ret
+
+; This is used to exchange the button press and selected menu item on the link menu.
+; The data is sent thrice and read twice to increase reliability.
+Serial_ExchangeLinkMenuSelection::
+ ld hl, wPlayerLinkAction
+ ld de, wOtherPlayerLinkMode
+ ld c, 2
+ ld a, TRUE
+ ldh [hSerialIgnoringInitialData], a
+.asm_0730
+ call DelayFrame
+ ld a, [hl]
+ ldh [hSerialSend], a
+ call Serial_ExchangeByte
+ ld b, a
+ inc hl
+ ldh a, [hSerialIgnoringInitialData]
+ and a
+ ld a, FALSE
+ ldh [hSerialIgnoringInitialData], a
+ jr nz, .asm_0730
+ ld a, b
+ ld [de], a
+ inc de
+ dec c
+ jr nz, .asm_0730
+ ret
+
+Serial_PrintWaitingTextAndSyncAndExchangeNybble::
+ call BackUpTilesToBuffer
+ callab PlaceWaitingText
+ call WaitLinkTransfer
+ jp ReloadTilesFromBuffer
+
+WaitLinkTransfer:: ; 75c (0:075c)
+ ld a, $ff
+ ld [wOtherPlayerLinkAction], a
+.loop
+ call LinkTransfer
+ call DelayFrame
+ call CheckwLinkTimeoutFramesNonzero
+ jr z, .check
+ push hl
+ ld hl, wLinkTimeoutFrames + 1
+ dec [hl]
+ jr nz, .skip
+ dec hl
+ dec [hl]
+ jr nz, .skip
+ ; We might be disconnected
+ pop hl
+ xor a
+ jp SerialDisconnected
+
+.skip
+ pop hl
+.check
+ ld a, [wOtherPlayerLinkAction]
+ inc a
+ jr z, .loop
+
+ ld b, 10
+.receive
+ call DelayFrame
+ call LinkTransfer
+ dec b
+ jr nz, .receive
+
+ ld b, 10
+.acknowledge
+ call DelayFrame
+ call LinkDataReceived
+ dec b
+ jr nz, .acknowledge
+
+ ld a, [wOtherPlayerLinkAction]
+ ld [wOtherPlayerLinkMode], a
+ ret
+
+LinkTransfer:: ; 7a0 (0:07a0)
+ push bc
+ ld b, $60
+ ld a, [wLinkMode]
+ cp $2
+ jr c, .asm_07ac
+ ld b, $70
+
+.asm_07ac
+ call .Receive
+ ld a, [wPlayerLinkAction]
+ add b
+ ldh [hSerialSend], a
+ ldh a, [hLinkPlayerNumber]
+ cp USING_INTERNAL_CLOCK
+ jr nz, .player_1
+ ld a, (1 << rSC_ON) | 1
+ ldh [rSC], a
+
+.player_1
+ call .Receive
+ pop bc
+ ret
+
+.Receive: ; 7c4 (0:07c4)
+ ldh a, [hSerialReceive]
+ ld [wOtherPlayerLinkMode], a
+ and $f0
+ cp b
+ ret nz
+ xor a
+ ldh [hSerialReceive], a
+ ld a, [wOtherPlayerLinkMode]
+ and $f
+ ld [wOtherPlayerLinkAction], a
+ ret
+
+LinkDataReceived:: ; 7d9 (0:07d9)
+; Let the other system know that the data has been received.
+ xor a
+ ldh [hSerialSend], a
+ ldh a, [hLinkPlayerNumber]
+ cp USING_INTERNAL_CLOCK
+ ret nz
+ ld a, (1 << rSC_ON) | 1
+ ldh [rSC], a
+ ret
+
+Unreferenced_Function7e6::
+ ld a, [wLinkMode]
+ and a
+ ret nz
+ ld a, USING_INTERNAL_CLOCK
+ ldh [rSB], a
+ xor a
+ ldh [hSerialReceive], a
+ ld a, (1 << rSC_ON)
+ ldh [rSC], a
+ ret
diff --git a/home/text.asm b/home/text.asm
index 83bbd42..3fb2cc3 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -1,6 +1,370 @@
INCLUDE "constants.asm"
-SECTION "Text Commands", ROM0[$107e]
+SECTION "Text Printing Functions", ROM0[$0e18]
+
+ClearBox:: ; 00:0e18
+; Fill a c*b box at hl with blank tiles.
+ ld a, " "
+ ; fallthrough
+
+FillBoxWithByte::
+ ld de, SCREEN_WIDTH
+.asm_0e1d: ; 00:0e1d
+ push hl
+ push bc
+.asm_0e1f: ; 00:0e1f
+ ld [hli], a
+ dec c
+ jr nz, .asm_0e1f
+ pop bc
+ pop hl
+ add hl, de
+ dec b
+ jr nz, .asm_0e1d
+ ret
+
+ClearTileMap:: ; 00:0e2a
+; Fill wTileMap with blank tiles.
+
+ hlcoord 0, 0
+ ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
+ ld a, " "
+ call ByteFill
+ ldh a, [rLCDC]
+ bit 7, a
+ ret z
+ jp WaitBGMap
+
+DrawTextBox:: ; 00:0e3d
+
+ ; Top
+ push hl
+ ld a, "┌"
+ ld [hli], a
+ inc a ; "─"
+ call .PlaceChars
+ inc a ; "┐"
+ ld [hl], a
+ pop hl
+
+ ; Middle
+ ld de, SCREEN_WIDTH
+ add hl, de
+.row
+ push hl
+ ld a, "│"
+ ld [hli], a
+ ld a, " "
+ call .PlaceChars
+ ld [hl], "│"
+ pop hl
+
+ ld de, SCREEN_WIDTH
+ add hl, de
+ dec b
+ jr nz, .row
+
+ ; Bottom
+ ld a, "└"
+ ld [hli], a
+ ld a, "─"
+ call .PlaceChars
+ ld [hl], "┘"
+
+ ret
+; e6a
+
+.PlaceChars: ; e6a
+; Place char a c times.
+ ld d, c
+.loop
+ ld [hli], a
+ dec d
+ jr nz, .loop
+ ret
+; e70
+
+PrintText::
+ push hl
+ hlcoord TEXTBOX_X, TEXTBOX_Y
+ ld b, TEXTBOX_INNERH
+ ld c, TEXTBOX_INNERW
+ call DrawTextBox
+ call Function17a8
+ call WaitBGMap
+ pop hl
+PrintTextBoxText::
+ bccoord TEXTBOX_INNERX, TEXTBOX_INNERY
+ call TextCommandProcessor
+ ret
+
+SpeechTextBox::
+; Standard textbox.
+ hlcoord TEXTBOX_X, TEXTBOX_Y
+ ld b, TEXTBOX_INNERH
+ ld c, TEXTBOX_INNERW
+ jp DrawTextBox
+
+PlaceString:: ; 00:0e93
+ push hl
+PlaceNextChar:: ; 00:0e94
+ ld a, [de]
+ cp "@"
+ jr nz, CheckDict
+ ld b, h
+ ld c, l
+ pop hl
+ ret
+
+CheckDict:: ; 00:0e9d
+dict: MACRO
+if \1 == 0
+ and a
+else
+ cp \1
+endc
+ jp z, \2
+ENDM
+
+ cp "<NEXT>"
+ jr nz, .asm_0eaa
+ pop hl
+ ld bc, 2 * SCREEN_WIDTH
+ add hl, bc
+ push hl
+ jp NextChar
+
+.asm_0eaa: ; 00:0eaa
+ cp "<LINE>"
+ jr nz, .asm_0eb6
+ pop hl
+ hlcoord 1, 16
+ push hl
+ jp NextChar
+
+.asm_0eb6: ; 00:0eb6
+ dict 0, NullChar
+ dict "<SCROLL>", _ContTextNoPause
+ dict "<_CONT>", _ContText
+ dict "<PARA>", Paragraph
+ dict "<MOM>", PrintMomsName
+ dict "<PLAYER>", PrintPlayerName
+ dict "<RIVAL>", PrintRivalName
+ dict "#", PlacePOKe
+ dict "<PC>", PCChar
+ dict "<ROCKET>", RocketChar
+ dict "<TM>", TMChar
+ dict "<TRAINER>", TrainerChar
+ dict "<CONT>", ContText
+ dict "<……>", SixDotsChar
+ dict "<DONE>", DoneText
+ dict "<PROMPT>", PromptText
+ dict "<GA>", GaCharacter
+ dict "<DEXEND>", PlaceDexEnd
+ dict "<TARGET>", PlaceMoveTargetsName
+ dict "<USER>", PlaceMoveUsersName
+
+ cp "゚"
+ jr z, .diacritic
+ cp "゙"
+ jr nz, .not_diacritic
+.diacritic: ; 00:0f21
+ push hl
+ ld bc, -SCREEN_WIDTH
+ add hl, bc
+ ld [hl], a
+ pop hl
+ jr NextChar
+
+.not_diacritic: ; 00:0f2a
+ cp FIRST_REGULAR_TEXT_CHAR
+ jr nc, .place
+ cp "パ"
+ jr nc, .handakuten
+ cp FIRST_HIRAGANA_DAKUTEN_CHAR
+ jr nc, .hiragana_dakuten
+ add "カ" - "ガ"
+ jr .katakana_dakuten
+
+.hiragana_dakuten: ; 00:0f3a
+ add "か" - "が"
+.katakana_dakuten: ; 00:0f3c
+ push af
+ ld a, "゙"
+ push hl
+ ld bc, -SCREEN_WIDTH
+ add hl, bc
+ ld [hl], a
+ pop hl
+ pop af
+ jr .place
+
+.handakuten: ; 00:0f49
+ cp "ぱ"
+ jr nc, .hiragana_handakuten
+ add "ハ" - "パ"
+ jr .katakana_handakuten
+
+.hiragana_handakuten: ; 00:0f51
+ add "は" - "ぱ"
+.katakana_handakuten: ; 00:0f53
+ push af
+ ld a, "゚"
+ push hl
+ ld bc, -SCREEN_WIDTH
+ add hl, bc
+ ld [hl], a
+ pop hl
+ pop af
+.place: ; 00:0f5e
+ ld [hli], a
+ call PrintLetterDelay
+NextChar:: ; 00:0f62
+ inc de
+ jp PlaceNextChar
+
+NullChar:: ; 00:0f66
+ ld b, h
+ ld c, l
+ pop hl
+ ld de, .Text
+ dec de
+ ret
+
+.Text:
+ deciram hTextErrno, 1, 2
+ text "エラー"
+ done
+
+print_name: MACRO
+ push de
+ ld de, \1
+ jr PlaceCommandCharacter
+ENDM
+
+PrintMomsName:: print_name wMomsName
+PrintPlayerName:: print_name wPlayerName
+PrintRivalName:: print_name wRivalsName
+
+TrainerChar:: print_name TrainerCharText
+TMChar:: print_name TMCharText
+PCChar:: print_name PCCharText
+RocketChar:: print_name RocketCharText
+PlacePOKe:: print_name POKeCharText
+SixDotsChar:: print_name SixDotsCharText
+GaCharacter:: print_name GaCharacterTExt
+
+PlaceMoveTargetsName:: ; 00:0fb3
+ ldh a, [hBattleTurn]
+ xor $1
+ jr asm_0fbb
+
+PlaceMoveUsersName:: ; 00:0fb9
+ ldh a, [hBattleTurn]
+asm_0fbb: ; 00:0fbb
+ push de
+ and a
+ jr nz, .asm_0fc4
+ ld de, wEnemyMonNickname
+ jr PlaceCommandCharacter
+
+.asm_0fc4: ; 00:0fc4
+ ld de, EnemyText
+ call PlaceString
+ ld h, b
+ ld l, c
+ ld de, wBattleMonNickname
+PlaceCommandCharacter: ; 00:0fcf
+ call PlaceString
+ ld h, b
+ ld l, c
+ pop de
+ inc de
+ jp PlaceNextChar
+
+TMCharText:: db "わざマシン@"
+TrainerCharText:: db "トレーナー@"
+PCCharText:: db "パソコン@"
+RocketCharText:: db "ロケットだん@"
+POKeCharText:: db "ポケモン@"
+SixDotsCharText:: db "……@"
+EnemyText:: db "てきの @"
+GaCharacterTExt:: db "が @"
+
+ContText:: ; 00:1001
+ push de
+ ld b, h
+ ld c, l
+ ld hl, .Text
+ call TextCommandProcessor
+ ld h, b
+ ld l, c
+ pop de
+ inc de
+ jp PlaceNextChar
+
+.Text:
+ text "<_CONT>@"
+ db "@"
+
+PlaceDexEnd:: ; 00:1015
+ ld [hl], "。"
+ pop hl
+ ret
+
+PromptText:: ; 00:1019
+ ld a, [wLinkMode]
+ cp $3
+ jp z, Function1026
+ ld a, "▼"
+ ldcoord_a 18, 17
+Function1026:: ; 00:1026
+ call ProtectedWaitBGMap
+ call ButtonSound
+ ld a, "─"
+ ldcoord_a 18, 17
+DoneText:: ; 00:1031
+ pop hl
+ ld de, .Text
+ dec de
+ ret
+
+.Text:: ; 00:1037
+ db "@"
+
+Paragraph:: ; 00:1038
+ push de
+ ld a, "▼"
+ ldcoord_a 18, 17
+ call ProtectedWaitBGMap
+ call ButtonSound
+ hlcoord 1, 13
+ lb bc, 4, 18
+ call ClearBox
+ ld a, "─"
+ ldcoord_a 18, 17
+ ld c, 20
+ call DelayFrames
+ pop de
+ hlcoord 1, 14
+ jp NextChar
+
+_ContText:: ; 00:105e
+ ld a, "▼"
+ ldcoord_a 18, 17
+ call ProtectedWaitBGMap
+ push de
+ call ButtonSound
+ pop de
+ ld a, "─"
+ ldcoord_a 18, 17
+_ContTextNoPause:: ; 00:1070
+ push de
+ call ScrollTextUpOneLine
+ call ScrollTextUpOneLine
+ hlcoord 1, 16
+ pop de
+ jp NextChar
ScrollTextUpOneLine:: ; 107e (0:107e)
; move both rows of text in the normal text box up one row
diff --git a/home/time.asm b/home/time.asm
new file mode 100644
index 0000000..3eba96c
--- /dev/null
+++ b/home/time.asm
@@ -0,0 +1,138 @@
+include "constants.asm"
+
+SECTION "RTC and Time Functions", ROM0 [$042B]
+
+LatchClock: ; 42b (0:042b)
+ ld a, 0
+ ld [MBC3LatchClock], a
+ ld a, 1
+ ld [MBC3LatchClock], a
+ ret
+
+UpdateTime:: ; 436 (0:0436)
+ ldh a, [hRTCStatusFlags]
+ bit 0, a
+ ret nz
+ ld a, SRAM_ENABLE
+ ld [MBC3SRamEnable], a
+ call LatchClock
+ ld a, RTC_S
+ ld [MBC3SRamBank], a
+ ld a, [MBC3RTC]
+ and $7f
+ ldh [hRTCSeconds], a
+ ld a, RTC_M
+ ld [MBC3SRamBank], a
+ ld a, [MBC3RTC]
+ and $7f
+ ldh [hRTCMinutes], a
+ ld a, RTC_H
+ ld [MBC3SRamBank], a
+ ld a, [MBC3RTC]
+ and $1f
+ ldh [hRTCHours], a
+ call CloseSRAM
+ ld a, [wce63]
+ bit 1, a
+ jr z, .asm_0478
+ ld a, [wd153]
+ bit 7, a
+ jr nz, .asm_048a
+.asm_0478
+ ldh a, [hRTCHours]
+ ld b, a
+ ld hl, .Data_049c
+.asm_047e
+ ld a, [hli]
+ cp b
+ jr nc, .asm_0485
+ inc hl
+ jr .asm_047e
+
+.asm_0485
+ ld a, [hl]
+ ld [wTimeOfDay], a
+ ret
+
+.asm_048a
+ ldh a, [hRTCSeconds]
+ ld b, a
+ ld hl, .Data_04a4
+.asm_0490
+ ld a, [hli]
+ cp b
+ jr nc, .asm_0497
+ inc hl
+ jr .asm_0490
+
+.asm_0497
+ ld a, [hl]
+ ld [wTimeOfDay], a
+ ret
+
+.Data_049c:
+ db $06, $01
+ db $09, $03
+ db $0f, $00
+ db $18, $01
+
+.Data_04a4:
+ db $1e, $00
+ db $23, $01
+ db $32, $02
+ db $3b, $03
+
+Function04ac::
+ ld hl, hRTCStatusFlags
+ set 0, [hl]
+ call Function04ea
+ ld a, SRAM_ENABLE
+ ld [MBC3SRamEnable], a
+ call LatchClock
+
+ ld a, RTC_S
+ ld [MBC3SRamBank], a
+ ld a, 0
+ ld [MBC3RTC], a
+
+ ld a, RTC_M
+ ld [MBC3SRamBank], a
+ ld a, [wStartMinute]
+ ld [MBC3RTC], a
+
+ ld a, RTC_H
+ ld [MBC3SRamBank], a
+ ld a, [wStartHour]
+ ld [MBC3RTC], a
+
+ ld a, [wStartDay]
+ ldh [hRTCDays], a
+
+ call CloseSRAM
+ ld hl, hRTCStatusFlags
+ res 0, [hl]
+ ret
+
+Function04ea:: ; 4ea (0:04ea)
+ ld a, SRAM_ENABLE
+ ld [MBC3SRamEnable], a
+ call LatchClock
+ ld a, RTC_DH
+ ld [MBC3SRamBank], a
+ ld a, [MBC3RTC]
+ set 6, a
+ ld [MBC3RTC], a
+ call CloseSRAM
+ ret
+
+Function0502:: ; 0502
+ ld a, SRAM_ENABLE
+ ld [MBC3SRamEnable], a
+ call LatchClock
+ ld a, RTC_DH
+ ld [MBC3SRamBank], a
+ ld a, [MBC3RTC]
+ res 6, a
+ ld [MBC3RTC], a
+ call CloseSRAM
+ ret
diff --git a/home/unknown.asm b/home/unknown.asm
index 5b9a6e1..e2cc5cd 100644
--- a/home/unknown.asm
+++ b/home/unknown.asm
@@ -121,3 +121,18 @@ _20F1:: ; 20f1
ld [de], a
inc de
ret
+
+SECTION "Unknown_094c", ROM0 [$094C]
+
+Function094c::
+ ldh a, [hROMBank]
+ push af
+ ld a, BANK(Functionfe255)
+ call Bankswitch
+
+ call Functionfe255
+
+ pop af
+ call Bankswitch
+
+ jp Function4031
diff --git a/home/vcopy.asm b/home/vcopy.asm
index a453da5..8e916f2 100644
--- a/home/vcopy.asm
+++ b/home/vcopy.asm
@@ -545,7 +545,7 @@ EnableSprites:: ; 1531 (0:1531)
ret
; 0x1538
-Function_1538: ; 1538 (0:1538)
+Function1538: ; 1538 (0:1538)
ld a, [$d14f]
bit 0, a
ret z
diff --git a/home/window.asm b/home/window.asm
new file mode 100644
index 0000000..da1c838
--- /dev/null
+++ b/home/window.asm
@@ -0,0 +1,266 @@
+include "constants.asm"
+
+SECTION "Window related functions", ROM0 [$1E58]
+
+OpenMenu:: ; 00:1e58
+ call Function1c96
+ call GetMenuIndexSet
+ push de
+ ld a, [wMenuCursorBuffer]
+ push af
+ call Function1e8a
+ pop af
+ ld [wMenuCursorBuffer], a
+ call AutomaticGetMenuBottomCoord
+ call Function1bf4
+ call Function1ceb
+ pop de
+ call GetMenuIndexSet
+ push de
+ call RunMenuItemPrintingFunction
+ ld a, $1
+ ldh [hBGMapMode], a
+ call Function17a8
+ call GetMenuIndexSet
+ pop de
+ call Function1f27
+ ret
+
+Function1e8a:: ; 00:1e8a
+ xor a
+ ldh [hBGMapMode], a
+ xor a
+ call OpenSRAM
+ call Function1cae
+ ld a, l
+ ld [wWindowStackPointer], a
+ ld a, h
+ ld [wWindowStackPointer + 1], a
+ call Function1c7a
+ ld d, h
+ ld e, l
+ call Function1c60
+ call CloseSRAM
+ ld hl, wWindowStackSize
+ dec [hl]
+ ret
+
+AutomaticGetMenuBottomCoord:: ; 00:1eac
+ ld a, [wMenuBorderLeftCoord]
+ ld c, a
+ ld a, [wMenuBorderRightCoord]
+ sub c
+ ld c, a
+ ld a, [wMenuDataItems]
+ add a
+ inc a
+ ld b, a
+ ld a, [wMenuBorderTopCoord]
+ add b
+ ld [wMenuBorderBottomCoord], a
+ ret
+
+GetMenuIndexSet:: ; 00:1ec3
+ ld hl, wMenuDataIndicesPointer
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [wWhichIndexSet]
+ and a
+ jr z, .asm_1ed9
+ ld b, a
+ ld c, -1
+.asm_1ed2: ; 00:1ed2
+ ld a, [hli]
+ cp c
+ jr nz, .asm_1ed2
+ dec b
+ jr nz, .asm_1ed2
+.asm_1ed9: ; 00:1ed9
+ ld d, h
+ ld e, l
+ inc hl
+ ld c, $ff
+.asm_1ede: ; 00:1ede
+ inc c
+ ld a, [hli]
+ cp $ff
+ jr nz, .asm_1ede
+ ld a, c
+ ld [wMenuDataItems], a
+ ret
+
+Function1ee9:: ; 1ee9
+ call MenuBoxCoord2Tile
+ call Function1c86
+ ld a, [wMenuDataItems]
+ add a
+ cp b
+ jr nc, .asm_1ef9
+ ld b, a
+ dec c
+ ret
+
+.asm_1ef9: ; 00:1ef9
+ ld a, b
+ srl a
+ dec a
+ ld [wMenuDataItems], a
+ dec c
+ ret
+
+RunMenuItemPrintingFunction:: ; 00:1f02
+ call MenuBoxCoord2Tile
+ ld bc, 2 * SCREEN_WIDTH + 2
+ add hl, bc
+.asm_1f09: ; 00:1f09
+ inc de
+ ld a, [de]
+ cp -1
+ ret z
+ ld [wMenuSelection], a
+ push de
+ push hl
+ ld d, h
+ ld e, l
+ ld hl, wMenuDataDisplayFunctionPointer
+ call ._hl_
+ pop hl
+ ld de, 2 * SCREEN_WIDTH
+ add hl, de
+ pop de
+ jr .asm_1f09
+
+._hl_:
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp hl
+
+Function1f27:: ; 00:1f27
+; Combines Crystal functions "InitMenuCursorAndButtonPermissions" and "GetStaticMenuJoypad"
+ push de
+ call InitVerticalMenuCursor
+ ld hl, wMenuJoypadFilter
+ ld a, [wMenuData2]
+ bit 3, a
+ jr z, .asm_1f37
+ set 3, [hl]
+.asm_1f37: ; 00:1f37
+ bit 2, a
+ jr z, .asm_1f3f
+ ld a, [hl]
+ or D_LEFT | D_RIGHT
+ ld [hl], a
+.asm_1f3f: ; 00:1f3f
+ call Function1a7c
+ pop de
+ bit 0, a
+ jr nz, .asm_1f66
+ bit 1, a
+ jr nz, .asm_1f7e
+ bit 3, a
+ jr nz, .asm_1f7e
+ bit 4, a
+ jr nz, .asm_1f58
+ bit 5, a
+ jr nz, .asm_1f5f
+ ret
+
+.asm_1f58: ; 00:1f58
+ ld a, D_RIGHT
+ ld [wMenuJoypad], a
+ jr .asm_1f6b
+
+.asm_1f5f: ; 00:1f5f
+ ld a, D_LEFT
+ ld [wMenuJoypad], a
+ jr .asm_1f6b
+
+.asm_1f66: ; 00:1f66
+ ld a, A_BUTTON
+ ld [wMenuJoypad], a
+.asm_1f6b: ; 00:1f6b
+ ld a, [wMenuCursorY]
+ ld l, a
+ ld h, $0
+ add hl, de
+ ld a, [hl]
+ ld [wMenuSelection], a
+ ld a, [wMenuCursorY]
+ ld [wMenuCursorBuffer], a
+ and a
+ ret
+
+.asm_1f7e: ; 00:1f7e
+ ld a, B_BUTTON
+ ld [wMenuJoypad], a
+ ld a, -1
+ ld [wMenuSelection], a
+ scf
+ ret
+
+PlaceMenuStrings::
+ push de
+ ld hl, wMenuDataPointerTableAddr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [wMenuSelection]
+ call GetNthString
+ ld d, h
+ ld e, l
+ pop hl
+ call PlaceString
+ ret
+
+ClearWindowData:: ; 00:1f9e
+ ld hl, wWindowStackPointer
+ call .bytefill
+ ld hl, wMenuDataHeader
+ call .bytefill
+ ld hl, wMenuData2
+ call .bytefill
+ ld hl, wMenuData3
+ call .bytefill
+
+ xor a
+ call OpenSRAM
+
+ xor a
+ ld hl, sWindowStackTop + 1
+ ld [hld], a
+ ld [hld], a
+ ld a, l
+ ld [wWindowStackPointer], a
+ ld a, h
+ ld [wWindowStackPointer + 1], a
+
+ call CloseSRAM
+ ret
+
+.bytefill: ; 00:1fcc
+ ld bc, 16
+ xor a
+ call ByteFill
+ ret
+
+RefreshScreen::
+ call ClearWindowData
+ ldh a, [hROMBank]
+ push af
+ ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; and BANK(LoadFonts_NoOAMUpdate)
+ call Bankswitch
+
+ call ReanchorBGMap_NoOAMUpdate
+ call LoadFonts_NoOAMUpdate
+
+ pop af
+ call Bankswitch
+ ret
+
+Function1fea::
+ call Function3171
+ call ClearWindowData
+ call Function202c
+ ret
diff --git a/hram.asm b/hram.asm
index 8e59150..8e49ad5 100644
--- a/hram.asm
+++ b/hram.asm
@@ -9,7 +9,9 @@ hRTCHours:: db ; ff8d
hRTCMinutes:: db ; ff8e
hRTCSeconds:: db ; ff8f
hRTCDays:: db ; ff90
- ds 6 ; TODO
+ ds 2 ; TODO
+hRTCStatusFlags:: db ; ff93
+ ds 3 ; TODO
hVBlankCounter:: ; ff97
db
@@ -62,6 +64,10 @@ UNION
hTextBoxCursorBlinkInterval:: ds 2 ; ffaf
NEXTU
+ ds 1 ; TODO
+hTextErrno:: db ; ffb0
+
+NEXTU
hSpriteWidth:: ; ffaf
hSpriteInterlaceCounter:: ; ffaf
@@ -112,8 +118,8 @@ hSerialReceived:: ; ffd4
hLinkPlayerNumber:: ; ffd5
db
-
- db ; TODO
+hSerialIgnoringInitialData::
+ db
hSerialSend:: ; ffd7
diff --git a/macros/farcall.asm b/macros/farcall.asm
index 50bb232..05bb7b1 100644
--- a/macros/farcall.asm
+++ b/macros/farcall.asm
@@ -20,3 +20,15 @@ homecall: MACRO
pop af
call Bankswitch
ENDM
+
+jpba: MACRO
+ ld a, BANK(\1)
+ ld hl, \1
+ jp FarCall_hl
+ENDM
+
+jpab: MACRO
+ ld hl, \1
+ ld a, BANK(\1)
+ jp FarCall_hl
+ENDM
diff --git a/shim.sym b/shim.sym
index 1a6cac0..995cbd7 100644
--- a/shim.sym
+++ b/shim.sym
@@ -1,26 +1,25 @@
; ROM0
-00:032b UpdateTimeOfDayPalettes
-00:0436 UpdateTime
-00:051C Reset
-00:0D0A LoadFont
-00:0D1A LoadFontExtra
-00:0E18 ClearBox
-00:0E2A ClearTileMap
-00:0E3D DrawTextBox
-00:0E93 PlaceString
-00:0E94 PlaceNextChar
-00:0E9D CheckDict
-00:15be GetMapObject
+00:15BE GetMapObject
00:1720 CheckObjectVisibility
-00:17bf GetObjectStruct
-00:1d49 LoadMenuHeader
-00:1e58 OpenMenu
-00:1F9E ClearWindowData
-00:1FCC ClearWindowData.bytefill
+00:17A8 Function17a8
+00:17BF GetObjectStruct
+00:1A7C Function1a7c
+00:1BF4 Function1bf4
+00:1C44 InitVerticalMenuCursor
+00:1C60 Function1c60 ; PopWindow?
+00:1C7A Function1c7a ; HandleWindow?
+00:1C86 Function1c86
+00:1C96 Function1c96 ; CopyMenuData?
+00:1CAE Function1cae ; PushWindow?
+00:1CEB Function1ceb
+00:1D2D MenuBoxCoord2Tile
+00:1D49 LoadMenuHeader
+00:202C Function202c
-00:23dc LoadWildMons
-00:23e5 FadeIn ; This is not OverworldFadeIn, but I don't know what it is
+00:23DC LoadWildMons
+00:23E5 FadeIn ; This is not OverworldFadeIn, but I don't know what it is
00:2C05 StartMenuCheck
+00:3171 Function3171
00:3621 WaitBGMap
00:362B SetPalettes
00:3634 ClearPalettes
@@ -47,196 +46,141 @@
00:3E32 Unk_3E32
-01:4031 Function_4031
+01:4031 Function4031
01:53CC MainMenu
-01:5D27 Function_5d27
+01:5D27 Function5d27
01:6114 TitleScreenInputAndTimeout
-01:6445 Function_6445
-01:66B1 Function_66b1
-01:6713 Function_6713
+01:63D8 ReanchorBGMap_NoOAMUpdate
+01:6437 LoadFonts_NoOAMUpdate
+01:6445 Function6445
+01:66B1 Function66b1
+01:6713 Function6713
01:68F3 ItemAttributes
-02:4786 Function_8786
+02:4000 Function8000
02:4098 _InitializeVisibleSprites
+02:4786 Function8786
02:4856 DecompTownMapTilemap
02:48DA DecompTownMapTilemap.tilemap
02:4C7C DrawMap
02:4DC2 TownMapGfx
02:4F32 PokegearRadioGfx
-02:528B Function_928b
+02:528B Function928b
02:5695 CheckSGB
03:4791 DebugWarp
03:479F DebugWarp.Destinations
-03:4D33 Function_cd33
-03:4D6F Function_cd6f
-03:4DE3 Function_cde3
-03:4DE3 Function_cde3_2
-03:4DE3 Function_cde3_3
-03:4DF9 Function_cdf9
-03:4E10 Function_ce10
-03:4E10 Function_ce10_2
-03:4E3C Function_ce3c
-03:4E7C Function_ce7c
-03:5886 Function_d886
-03:5A28 Function_da28
-03:5A4F Function_da4f
-03:5AC8 Function_dac8
-03:5C16 Function_dc16
-03:5CFC Function_dcfc
-03:5D5C Function_dd5c
-03:5E79 Function_de79
-03:5F7D Function_df7d
-03:5F91 Function_df91
+03:4D33 Functioncd33
+03:4D6F Functioncd6f
+03:4DE3 Functioncde3
+03:4DE3 Functioncde3_2
+03:4DE3 Functioncde3_3
+03:4DF9 Functioncdf9
+03:4E10 Functionce10
+03:4E10 Functionce10_2
+03:4E3C Functionce3c
+03:4E7C Functionce7c
+03:5886 Functiond886
+03:5A28 Functionda28
+03:5A4F Functionda4f
+03:5AC8 Functiondac8
+03:5C16 Functiondc16
+03:5CFC Functiondcfc
+03:5D5C Functiondd5c
+03:5E79 Functionde79
+03:5F7D Functiondf7d
+03:5F91 Functiondf91
-04:528F Function_1128f
-04:52C1 Function_112c1
+04:528F Function1128f
+04:52C1 Function112c1
04:5677 DoPlayerMovement
04:5DBE DisplayStartMenu
-04:640B Function_1240b
+04:640B Function1240b
04:6C58 CheckRegisteredItem
-05:400a GetPlayerSprite
+05:4000 Function14000
+05:400A GetPlayerSprite
05:4036 AddMapSprites
-05:404c CheckInteriorMap
-05:405b AddIndoorSprites
-05:40aa AddOutdoorSprites
-05:40fb LoadUsedSpritesGfx ; TODO: maybe there's a better name
-05:43E0 Function_143e0
-05:457A Function_1457a
-05:45B8 Function_145b8
-05:45DE Function_145de
-05:46DC Function_146dc
+05:404C CheckInteriorMap
+05:405B AddIndoorSprites
+05:40AA AddOutdoorSprites
+05:40FB LoadUsedSpritesGfx ; TODO: maybe there's a better name
+05:43E0 Function143e0
+05:457A Function1457a
+05:45B8 Function145b8
+05:45DE Function145de
+05:46DC Function146dc
; Structure:
; byte Map group ($ff = end)
; byte Map ID
; ptr Copied to c5e9, also byte pointed to written at wMapScriptNumber
; ptr Copied to c5eb
; word Unknown (2 bytes)
-05:470e UnknownMapBufferPointers
+05:470E UnknownMapBufferPointers
-0A:4C98 Function_28c98
-0A:4D6E Function_28d6e
-0A:4DA4 Function_28da4
+0A:4C98 Function28c98
+0A:4D6E Function28d6e
+0A:4DA4 Function28da4
-0B:5663 Function_2d663
+0B:5663 Function2d663
-0e:4b78 LoadTrainerClassName
-0e:4ba0 LoadTrainerClassName.got_name
-0e:4ba9 LoadTrainerClass
+0E:4B78 LoadTrainerClassName
+0E:4BA0 LoadTrainerClassName.got_name
+0E:4BA9 LoadTrainerClass
-0F:508C Function_3d08c
-0F:55CE Function_3d5ce
-0F:567C Function_3d67c
-0F:61A4 Function_3e1a4
-0F:6874 Function_3e874
-0F:691E Function_3e91e
-0F:6963 Function_3e963
-0f:69a9 _LoadWildMons
-0F:6F19 Function_3ef19
-0F:7019 Function_3f019
-0F:704A Function_3f04a
-0F:7068 Function_3f068
+0F:508C Function3d08c
+0F:55CE Function3d5ce
+0F:567C Function3d67c
+0F:61A4 Function3e1a4
+0F:6874 Function3e874
+0F:691E Function3e91e
+0F:6963 Function3e963
+0F:69A9 _LoadWildMons
+0F:6F19 Function3ef19
+0F:7019 Function3f019
+0F:704A Function3f04a
+0F:7068 Function3f068
-10:4000 Function_40000
+10:4000 Function40000
10:40A6 ShowPokedexMenu
-10:4AC7 Function_40ac7
-10:4B5C Function_40b5c
-10:5FA1 Function_41fa1
-10:61F8 Function_421f8
-10:6252 Function_42252
+10:4AC7 Function40ac7
+10:4B5C Function40b5c
+10:5FA1 Function41fa1
+10:61F8 Function421f8
+10:6252 Function42252
-14:4000 Function_50000
-14:4073 Function_50073
-14:40A0 Function_500a0
-14:40C6 Function_500c6
-14:4244 Function_50244
-14:4248 Function_50248
-14:42B5 Function_502b5
-14:469E Function_5069e
-14:46D4 Function_506d4
-14:4771 Function_50771
-14:4774 Function_50774
-14:481F Function_5081f
-14:48C4 Function_508c4
-14:4B92 Function_50b92
-14:4BCD Function_50bcd
-14:4BFE Function_50bfe
-14:4ED9 Function_50ed9
+14:4000 Function50000
+14:4073 Function50073
+14:40A0 Function500a0
+14:40C6 Function500c6
+14:4244 Function50244
+14:4248 Function50248
+14:42B5 Function502b5
+14:469E Function5069e
+14:46D4 Function506d4
+14:4771 Function50771
+14:4774 Function50774
+14:481F Function5081f
+14:48C4 Function508c4
+14:4B92 Function50b92
+14:4BCD Function50bcd
+14:4BFE Function50bfe
+14:4ED9 Function50ed9
23:4000 AnimateTilesetImpl
-23:42dc UpdateTimeOfDayPal
+23:42DC UpdateTimeOfDayPal
+23:42E3 _TimeOfDayPals
+23:4335 _UpdateTimePals
23:4354 ReplaceTimeOfDayPals
23:4370 GetTimePalette
-23:44BE Function_8c4be
-23:4940 Function_8c940
-23:49C6 Function_8c9c6
-23:60cc MenuMonIconGfx
+23:44BE Function8c4be
+23:4940 Function8c940
+23:49C6 Function8c9c6
+23:60CC MenuMonIconGfx
24:4000 SetClockDialog
24:4239 SlotMachineGame
-32:76FF Function_cb6ff
-32:7710 Function_cb710
-32:7733 Function_cb733
-33:4000 Function_cc000
-33:4000 Function_cc000_2
-33:4001 Function_cc001
-33:467B QueueBattleAnimation
-33:625D BattleAnim_Sine_e
-33:6263 BattleAnim_Cosine_e
-3A:441D Function_e841d
-3A:45D8 Function_e85d8
-3A:47F9 Function_e87f9
-3A:4839 Function_e8839
-3A:484F Function_e884f
-3A:4D9D _PlayCryHeader
-3A:4E22 _PlaySFX
-3A:4F11 LoadChannel
-3A:4F6C LoadMusicByte
-3A:52C7 Music
-3F:40E9 InGameDebugMenu
-3F:5B66 Function_fdb66
-3F:64CE MonsterTest
-3F:654E PicTest
-3F:6750 PicTestMenu
-3F:6755 PicTestMenu.loop
-
-00:CBF2 wWindowData
-00:CBF2 wWindowStackPointer
-00:CC02 wMenuDataHeader
-00:CC12 wMenuData2
-00:CC22 wMenuData3
-00:ce67 wPlayerName
-
-01:d165 wTMCounts
-01:d19e wItems
-01:d258 wRivalName
-01:D264 wPlayerBikeSurfState
-; The starting house's map script number is stored at d29a. Others are probably nearby.
-01:d35f wOptions
-01:d656 wMapGroup
-01:d657 wMapId
-01:D7D2 wPartyMonOT
-01:DA3B wOTPartyMonOT
-; MapAttributes
-36:59DF Route1P1_MapAttributes
-36:5ABE Route1P2_MapAttributes
-36:724D RouteSilentEast_MapAttributes
-36:4014 SilentHill_MapAttributes
-26:4000 Route1Gate1F_MapAttributes
-26:40DA Route1Gate2F_MapAttributes
-34:4000 RouteSilentEastGate_MapAttributes
-34:4042 PlayerHouse1F_MapAttributes
-34:4132 PlayerHouse2F_MapAttributes
-34:45FF SilentPokecenter_MapAttributes
-34:47D5 SilentHillHouse_MapAttributes
-34:4AAC SilentHillLab_MapAttributes
-34:5BE6 SilentHillLab2_MapAttributes
-34:605D Unused13_MapAttributes
-2F:53DD ShizukanaOka_MapAttributes
-36:5BD4 Route2_MapAttributes
-36:410D OldCity_MapAttributes
25:4000 Route2Gate1F_MapAttributes
25:407C Route2Gate2F_MapAttributes
25:40DC Route2House_MapAttributes
@@ -257,7 +201,9 @@
25:492F OldCityPokecenterTimeMachine_MapAttributes
25:49AC OldCityKurtsHouse_MapAttributes
25:4A26 OldCitySchool_MapAttributes
-36:4372 West_MapAttributes
+
+26:4000 Route1Gate1F_MapAttributes
+26:40DA Route1Gate2F_MapAttributes
26:4224 WestMart1F_MapAttributes
26:42A0 WestMart2F_MapAttributes
26:4374 WestMart3F_MapAttributes
@@ -276,9 +222,7 @@
26:4B5E WestGym_MapAttributes
26:4C1A WestHouse1_MapAttributes
26:4C9E WestHouse2_MapAttributes
-36:5CC6 HaitekuWestRoute_MapAttributes
-36:5DD1 HaitekuWestRouteOcean_MapAttributes
-36:45D2 Haiteku_MapAttributes
+
27:4000 HaitekuWestRouteGate_MapAttributes
27:405B HaitekuPokecenter1F_MapAttributes
27:40EF HaitekuPokecenter2F_MapAttributes
@@ -290,13 +234,6 @@
27:43DD HaitekuImposterOakHouse_MapAttributes
27:4444 HaitekuAquarium1F_MapAttributes
27:44CB HaitekuAquarium2F_MapAttributes
-36:5F17 FontoRoute1_MapAttributes
-36:61E8 FontoRoute2_MapAttributes
-36:63B2 FontoRoute3_MapAttributes
-36:62C6 FontoRoute4_MapAttributes
-36:7444 FontoRoute5_MapAttributes
-36:6083 FontoRoute6_MapAttributes
-36:47F8 Fonto_MapAttributes
27:4537 FontoRouteGate1_MapAttributes
27:4592 FontoRouteGate2_MapAttributes
27:45ED FontoRouteGate3_MapAttributes
@@ -306,12 +243,6 @@
27:47AF FontoPokecenter1F_MapAttributes
27:4843 FontoPokecenter2F_MapAttributes
27:48BC FontoLab_MapAttributes
-36:64BD BaadonRoute1_MapAttributes
-36:6603 BaadonRoute2_MapAttributes
-36:67EF BaadonRoute3_MapAttributes
-36:48F3 Baadon_MapAttributes
-27:4CDD BaadonRouteGateWest_MapAttributes
-27:4D38 BaadonRouteGateNewtype_MapAttributes
27:4923 BaadonMart_MapAttributes
27:49A3 BaadonPokecenter1F_MapAttributes
27:4A2A BaadonPokecenter2F_MapAttributes
@@ -320,15 +251,8 @@
27:4B42 BaadonHouse2_MapAttributes
27:4B9C BaadonLeague1F_MapAttributes
27:4C3D BaadonLeague2F_MapAttributes
-36:68DB Route15_MapAttributes
-36:69BD NewtypeRoute_MapAttributes
-36:6A6E Route18_MapAttributes
-36:49F9 Newtype_MapAttributes
-27:52E0 Route15Pokecenter1F_MapAttributes
-27:5374 Route15Pokecenter2F_MapAttributes
-27:53C6 NewtypeRouteGate_MapAttributes
-27:5421 Route18Pokecenter1F_MapAttributes
-27:54B5 Route18Pokecenter2F_MapAttributes
+27:4CDD BaadonRouteGateWest_MapAttributes
+27:4D38 BaadonRouteGateNewtype_MapAttributes
27:4D93 NewtypePokecenter1F_MapAttributes
27:4E27 NewtypePokecenter2F_MapAttributes
27:4EA0 NewtypeLeague1F_MapAttributes
@@ -340,18 +264,17 @@
27:51AF NewtypeDiner_MapAttributes
27:522C NewtypeHouse2_MapAttributes
27:5286 NewtypeHouse3_MapAttributes
-36:6D8F SugarRoute_MapAttributes
-36:4C3A Sugar_MapAttributes
+27:52E0 Route15Pokecenter1F_MapAttributes
+27:5374 Route15Pokecenter2F_MapAttributes
+27:53C6 NewtypeRouteGate_MapAttributes
+27:5421 Route18Pokecenter1F_MapAttributes
+27:54B5 Route18Pokecenter2F_MapAttributes
27:5507 SugarRouteGate_MapAttributes
27:5562 SugarHouse_MapAttributes
27:55E2 SugarHouse2_MapAttributes
27:5638 SugarMart_MapAttributes
27:56B8 SugarPokecenter1F_MapAttributes
27:574C SugarPokecenter2F_MapAttributes
-36:6C6F BullForestRoute1_MapAttributes
-36:6ED5 BullForestRoute2_MapAttributes
-36:7530 BullForestRoute3_MapAttributes
-36:4D05 BullForest_MapAttributes
27:57C5 BullForestRoute1House_MapAttributes
27:581F BullForestRouteGateStand_MapAttributes
27:587A BullMart_MapAttributes
@@ -363,8 +286,6 @@
27:5B11 BullLeague1F_MapAttributes
27:5BB2 BullLeague2F_MapAttributes
27:5C52 BullHouse4_MapAttributes
-36:701B StandRoute_MapAttributes
-36:4F28 Stand_MapAttributes
27:5C9F StandRouteGateKanto_MapAttributes
27:5CFA StandLab_MapAttributes
27:5D50 StandPokecenter1F_MapAttributes
@@ -376,8 +297,6 @@
27:6024 StandRocketHouse2F_MapAttributes
27:6083 StandLeague1F_MapAttributes
27:6124 StandLeague2F_MapAttributes
-36:7161 KantoEastRoute_MapAttributes
-36:519D Kanto_MapAttributes
27:61C4 KantoCeruleanHouse_MapAttributes
27:621E KantoPokecenter1F_MapAttributes
27:62B2 KantoPokecenter2F_MapAttributes
@@ -414,22 +333,17 @@
27:713B KantoLeague21F_MapAttributes
27:71DC KantoLeague22F_MapAttributes
27:727C KantoFishingGuru_MapAttributes
-36:738C PrinceRoute_MapAttributes
-36:55F3 Prince_MapAttributes
-36:73E8 MtFujiRoute_MapAttributes
-36:5677 MtFuji_MapAttributes
-36:56EF South_MapAttributes
27:72D6 SouthHouse1_MapAttributes
27:7330 SouthPokecenter1F_MapAttributes
27:73C4 SouthPokecenter2F_MapAttributes
27:743D SouthMart_MapAttributes
27:74BD SouthHouse2_MapAttributes
-36:5914 North_MapAttributes
27:7517 NorthHouse1_MapAttributes
27:7571 NorthMart_MapAttributes
27:75F1 NorthHouse2_MapAttributes
27:764B NorthPokecenter1F_MapAttributes
27:76DF NorthPokecenter2F_MapAttributes
+
2F:4000 PowerPlant1_MapAttributes
2F:407D PowerPlant2_MapAttributes
2F:40FA PowerPlant3_MapAttributes
@@ -448,3 +362,99 @@
2F:51B2 Office3_MapAttributes
2F:5289 SlowpokeWellEntrance_MapAttributes
2F:5306 SlowpokeWellMain_MapAttributes
+2F:53DD ShizukanaOka_MapAttributes
+
+32:76FF Functioncb6ff
+32:7710 Functioncb710
+32:7733 Functioncb733
+
+33:4000 Functioncc000
+33:4000 Functioncc000_2
+33:4001 Functioncc001
+33:467B QueueBattleAnimation
+33:625D BattleAnim_Sine_e
+33:6263 BattleAnim_Cosine_e
+
+34:4000 RouteSilentEastGate_MapAttributes
+34:4042 PlayerHouse1F_MapAttributes
+34:4132 PlayerHouse2F_MapAttributes
+34:45FF SilentPokecenter_MapAttributes
+34:47D5 SilentHillHouse_MapAttributes
+34:4AAC SilentHillLab_MapAttributes
+34:5BE6 SilentHillLab2_MapAttributes
+34:605D Unused13_MapAttributes
+
+36:4014 SilentHill_MapAttributes
+36:410D OldCity_MapAttributes
+36:4372 West_MapAttributes
+36:45D2 Haiteku_MapAttributes
+36:47F8 Fonto_MapAttributes
+36:48F3 Baadon_MapAttributes
+36:49F9 Newtype_MapAttributes
+36:4C3A Sugar_MapAttributes
+36:4D05 BullForest_MapAttributes
+36:4F28 Stand_MapAttributes
+36:519D Kanto_MapAttributes
+36:55F3 Prince_MapAttributes
+36:5677 MtFuji_MapAttributes
+36:56EF South_MapAttributes
+36:5914 North_MapAttributes
+36:59DF Route1P1_MapAttributes
+36:5ABE Route1P2_MapAttributes
+36:5BD4 Route2_MapAttributes
+36:5CC6 HaitekuWestRoute_MapAttributes
+36:5DD1 HaitekuWestRouteOcean_MapAttributes
+36:5F17 FontoRoute1_MapAttributes
+36:6083 FontoRoute6_MapAttributes
+36:61E8 FontoRoute2_MapAttributes
+36:62C6 FontoRoute4_MapAttributes
+36:63B2 FontoRoute3_MapAttributes
+36:64BD BaadonRoute1_MapAttributes
+36:6603 BaadonRoute2_MapAttributes
+36:67EF BaadonRoute3_MapAttributes
+36:68DB Route15_MapAttributes
+36:69BD NewtypeRoute_MapAttributes
+36:6A6E Route18_MapAttributes
+36:6C6F BullForestRoute1_MapAttributes
+36:6D8F SugarRoute_MapAttributes
+36:6ED5 BullForestRoute2_MapAttributes
+36:701B StandRoute_MapAttributes
+36:7161 KantoEastRoute_MapAttributes
+36:724D RouteSilentEast_MapAttributes
+36:738C PrinceRoute_MapAttributes
+36:73E8 MtFujiRoute_MapAttributes
+36:7444 FontoRoute5_MapAttributes
+36:7530 BullForestRoute3_MapAttributes
+
+3A:441D Functione841d
+3A:45D8 Functione85d8
+3A:47F9 Functione87f9
+3A:4839 Functione8839
+3A:484F Functione884f
+3A:4D9D _PlayCryHeader
+3A:4E22 _PlaySFX
+3A:4F11 LoadChannel
+3A:4F6C LoadMusicByte
+3A:52C7 Music
+
+3F:40E9 InGameDebugMenu
+3F:5B66 Functionfdb66
+3F:6255 Functionfe255
+3F:64CE MonsterTest
+3F:654E PicTest
+3F:6750 PicTestMenu
+3F:6755 PicTestMenu.loop
+
+00:CC22 wMenuData3
+00:CE67 wPlayerName
+
+01:D165 wTMCounts
+01:D19E wItems
+01:D258 wRivalName
+01:D264 wPlayerBikeSurfState
+; The starting house's map script number is stored at d29a. Others are probably nearby.
+01:D35F wOptions
+01:D656 wMapGroup
+01:D657 wMapId
+01:D7D2 wPartyMonOT
+01:DA3B wOTPartyMonOT
diff --git a/sram.asm b/sram.asm
index 6d8ebd3..b619fa1 100644
--- a/sram.asm
+++ b/sram.asm
@@ -10,3 +10,6 @@ SECTION "Unknown, bank 0", SRAM[$A600],BANK[0]
s0_a600:: ; TODO: properly label this
ds 7 ; TODO: figure out exact size
+
+SECTION "Window Stack Top", SRAM[$BFFE], BANK[0]
+sWindowStackTop:: dw
diff --git a/wram.asm b/wram.asm
index f98b66c..5e7cd17 100644
--- a/wram.asm
+++ b/wram.asm
@@ -166,8 +166,12 @@ ENDU ; c813
ds $32
wBattleAnimEnd::
; c845
+ ds $1b1 ; TODO
- ds $1f8 ; TODO
+wBattleMonNickname:: ds 6 ; c9f6
+wEnemyMonNickname:: ds 6 ; c9fc
+; ca02
+ ds $3b ; TODO
wPlayerSubStatus3:: db ; ca3d
ds $4
@@ -201,7 +205,18 @@ wRedrawFlashlightWidthHeight:: db ; cb20
; in units of two tiles (people event meta tile)
ENDU
-SECTION "CB5B", WRAM0[$CB5B]
+SECTION "CB56", WRAM0[$CB4C]
+wOtherPlayerLinkMode:: db ; cb4c
+wOtherPlayerLinkAction:: db ; cb4d
+ ds 3 ; TODO
+
+wPlayerLinkAction:: db ; cb51
+ ds 4 ; TODO
+
+wLinkTimeoutFrames:: dw ; cb56
+wcb58:: ds 2 ; cb58
+; cb5a
+ ds 1 ; TODO
wCurSpecies:: db ; cb5b
wNamedObjectTypeBuffer:: db ; cb5c
@@ -231,18 +246,43 @@ wTileRight:: db ; cb93
SECTION "CBD2", WRAM0[$CBD2]
wcbd2:: ; cbd2
ds $14
+; cbe6
-SECTION "CBF7", WRAM0[$CBF7]
+SECTION "CBF2", WRAM0[$CBF2]
+wWindowData::
+wWindowStackPointer:: dw ; cbf2
+wMenuJoypad:: db ; cbf4
+wMenuSelection:: db ; cbf5
+wMenuSelectionQuantity:: db ; cbf6
wWhichIndexSet::
wActiveBackpackPocket:: db ; cbf7
+wScrollingMenuCursorPosition:: db ; cbf8
+wWindowStackSize:: db ; cbf9
-SECTION "CC09", WRAM0[$CC09]
+SECTION "CC09", WRAM0[$CC02]
+wMenuDataHeader::
+ db ; cc02
+wMenuBorderTopCoord:: db ; cc03
+wMenuBorderLeftCoord:: db ; cc04
+wMenuBorderBottomCoord:: db ; cc05
+wMenuBorderRightCoord:: db ; cc06
+ ds 2 ; TODO
wMenuCursorBuffer:: db ; cc09
+; cc0a
+ ds 8 ; TODO
-SECTION "CC2A", WRAM0[$CC2A]
+wMenuData2::
+ db ; cc12
+wMenuDataItems:: db ; cc13
+wMenuDataIndicesPointer:: dw ; cc14
+wMenuDataDisplayFunctionPointer:: dw ; cc16
+wMenuDataPointerTableAddr:: dw ; cc18
+SECTION "CC2A", WRAM0[$CC29]
+
+wMenuJoypadFilter:: db ; cc29
wMenuCursorY:: db ; cc2a
SECTION "CC32", WRAM0[$CC32] ; Please merge when more is disassembled
@@ -309,9 +349,13 @@ wStringBuffer1:: ds 1 ; How long is this? ; cd26
SECTION "CD31", WRAM0[$CD31]
+wStartDay::
wcd31:: ; cd31
db
+wStartHour:: db
+wStartMinute:: db
+
SECTION "CD3E", WRAM0[$CD3D]
wRegularItemsCursor:: db ; cd3d
@@ -340,6 +384,9 @@ wPredefBC:: ; cd54
wFarCallBCBuffer:: ; cd54
dw
+ ds 3 ; TODO
+wVramState:: db
+
SECTION "CD72", WRAM0[$CD72]
wcd72:: dw ; cd72
@@ -481,6 +528,8 @@ wce63:: db ; ce63
; 76543210
; \-- global debug enable
+SECTION "Mom's Name", WRAM0[$CE6D]
+wMomsName:: ds 6 ; ce6d
SECTION "CE7F", WRAM0[$CE76]
@@ -566,6 +615,9 @@ SECTION "D1DE", WRAM0[$D1DE]
wNumBallItems:: db ; d1de
wBallQuantities:: db ; d1df
+SECTION "Rival's Name", WRAM0[$D258]
+wRivalsName:: ds 6 ; d258
+
SECTION "D4AB", WRAM0[$D4AB]
wJoypadFlags:: db ; d4ab