ref: f4907040c9f757960dd1e37c3c02a3c01824b1e1
parent: 7111ae8e582996f2b6ef36427cf54e0c168593ae
author: mid-kid <esteve.varela@gmail.com>
date: Sat Apr 27 15:50:24 EDT 2019
Label some more WRAM/SRAM things This should be all of the memory locations that are actually used, and some more. Removal of all addresses when?
--- a/engine/menus/intro_menu.asm
+++ b/engine/menus/intro_menu.asm
@@ -957,6 +957,8 @@
jr c, StartTitleScreen
farcall CrystalIntro
+ ; fallthrough
+
StartTitleScreen:
ldh a, [rSVBK]
push af
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -391,11 +391,10 @@
jp CloseSRAM
Unreferenced_Function14d18:
-; copy .Data to SRA4:a007
- ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
+ ld a, BANK(s4_a007)
call GetSRAMBank
ld hl, .Data
- ld de, $a007 ; address of MBC30 bank
+ ld de, s4_a007
ld bc, .DataEnd - .Data
call CopyBytes
jp CloseSRAM
@@ -833,9 +832,9 @@
ld hl, wd479
ld a, [hli]
- ld [$a60e + 0], a
+ ld [s4_a60e + 0], a
ld a, [hli]
- ld [$a60e + 1], a
+ ld [s4_a60e + 1], a
jp CloseSRAM
@@ -851,9 +850,9 @@
; (harmlessly) writes the aforementioned wEventFlags to the unused wd479.
ld hl, wd479
- ld a, [$a60e + 0]
+ ld a, [s4_a60e + 0]
ld [hli], a
- ld a, [$a60e + 1]
+ ld a, [s4_a60e + 1]
ld [hli], a
jp CloseSRAM
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -2657,9 +2657,9 @@
ret
Function1011f1:
- ld a, $04
+ ld a, BANK(s4_a60c)
call GetSRAMBank
- ld a, [$a60c]
+ ld a, [s4_a60c]
ld [wdc41], a
call CloseSRAM
ld hl, wdc41
@@ -3456,7 +3456,7 @@
ld a, e
ld [wcd3b], a
ld a, d
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, c
ld [wcd40], a
ld a, b
@@ -6933,10 +6933,10 @@
ld bc, 10
xor a
call ByteFill
- ld a, $04
+ ld a, BANK(s4_a60c)
call GetSRAMBank
ld a, [wdc41]
- ld [$a60c], a
+ ld [s4_a60c], a
ld [wBuffer1], a
call CloseSRAM
call Function1035c6
@@ -6985,10 +6985,10 @@
ld hl, wBuffer2
bit 6, [hl]
jr z, .asm_103398
- ld a, $04
+ ld a, BANK(s4_a60c)
call GetSRAMBank
ld a, [wBuffer1]
- ld [$a60c], a
+ ld [s4_a60c], a
ld [wdc41], a
call CloseSRAM
xor a
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -24,11 +24,11 @@
.loop
call JoyTextDelay
call Function118473
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $1b
jr c, .skip
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
.skip
call Function1184a5
@@ -36,7 +36,7 @@
farcall Function115dd3
farcall Function11619d
call DelayFrame
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
ld hl, wcd33
cp [hl]
jr nz, .loop
@@ -64,11 +64,11 @@
.asm_11807d
call JoyTextDelay
call Function118473
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $1b
jr c, .asm_118090
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
.asm_118090
call Function11857c
@@ -76,7 +76,7 @@
farcall Function115dd3
farcall Function11619d
call DelayFrame
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
ld hl, wcd33
cp [hl]
jr nz, .asm_11807d
@@ -101,14 +101,14 @@
.asm_1180d1
call JoyTextDelay
call Function118473
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $28
jr c, .asm_1180e4
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
.asm_1180e4
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $10
jr c, .asm_1180f2
cp $16
@@ -121,7 +121,7 @@
farcall Function115dd3
farcall Function11619d
call DelayFrame
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
ld hl, wcd33
cp [hl]
jr nz, .asm_1180d1
@@ -154,11 +154,11 @@
.loop
call JoyTextDelay
call Function118473
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $f
jr c, .skip
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
.skip
call BattleTowerRoomMenu_Jumptable
call BattleTowerRoomMenu_WriteMessage
@@ -165,7 +165,7 @@
farcall Function115dd3
farcall Function11619d
call DelayFrame
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
ld hl, wcd33
cp [hl]
jr nz, .loop
@@ -185,16 +185,16 @@
ld a, [wcd38]
and a
ret z
- ld a, $5
+ ld a, BANK(s5_a89c) ; and BANK(s5_a8b2)
call GetSRAMBank
ld hl, wcd69
- ld de, $a89c
- ld bc, $0016
+ ld de, s5_a89c
+ ld bc, 22
call CopyBytes
ldh a, [rSVBK]
push af
- ld a, $3
+ ld a, BANK(w3_d202)
ldh [rSVBK], a
ld de, w3_d202
@@ -208,8 +208,8 @@
jr c, .return_d3
ld hl, w3_d202
- ld de, $a8b2
- ld bc, $0096
+ ld de, s5_a8b2
+ ld bc, 150
call CopyBytes
.reset_banks
pop af
@@ -240,11 +240,11 @@
.asm_1181f8
call JoyTextDelay
call Function118473
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $28
jr c, .asm_11820b
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
.asm_11820b
call Function1185c3
@@ -252,7 +252,7 @@
farcall Function115dd3
farcall Function11619d
call DelayFrame
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
ld hl, wcd33
cp [hl]
jr nz, .asm_1181f8
@@ -277,11 +277,11 @@
.asm_11824c
call JoyTextDelay
call Function118473
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $1e
jr c, .asm_11825f
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
.asm_11825f
call Function118624
@@ -289,7 +289,7 @@
farcall Function115dd3
farcall Function11619d
call DelayFrame
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
ld hl, wcd33
cp [hl]
jr nz, .asm_11824c
@@ -313,11 +313,11 @@
.asm_11829d
call JoyTextDelay
call Function118473
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $20
jr c, .asm_1182b0
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
.asm_1182b0
call Function1186f5
call BattleTowerRoomMenu_WriteMessage
@@ -324,7 +324,7 @@
farcall Function115dd3
farcall Function11619d
call DelayFrame
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
ld hl, wcd33
cp [hl]
jr nz, .asm_11829d
@@ -348,11 +348,11 @@
.asm_1182ee
call JoyTextDelay
call Function118473
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $1b
jr c, .asm_118301
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
.asm_118301
call Function118746
@@ -360,7 +360,7 @@
farcall Function115dd3
farcall Function11619d
call DelayFrame
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
ld hl, wcd33
cp [hl]
jr nz, .asm_1182ee
@@ -385,11 +385,11 @@
.asm_118342
call JoyTextDelay
call Function118473
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $18
jr c, .asm_118355
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
.asm_118355
call Function118671
@@ -397,7 +397,7 @@
farcall Function115dd3
farcall Function11619d
call DelayFrame
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
ld hl, wcd33
cp [hl]
jr nz, .asm_118342
@@ -421,11 +421,11 @@
.asm_118393
call JoyTextDelay
call Function118473
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
cp $19
jr c, .asm_1183a6
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
.asm_1183a6
call Function1186b2
@@ -433,7 +433,7 @@
farcall Function115dd3
farcall Function11619d
call DelayFrame
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
ld hl, wcd33
cp [hl]
jr nz, .asm_118393
@@ -457,7 +457,7 @@
ld [wcd66], a
ld [wcd67], a
ld [wcd68], a
- ld [$c31a], a
+ ld [wc31a], a
ld [wcd89], a
ld [wcd8a], a
ld [wcd8b], a
@@ -479,20 +479,20 @@
farcall Function106464
farcall Function115d99
farcall Function11615a
- ld a, $5
+ ld a, BANK(s5_bfff)
call GetSRAMBank
xor a
- ld [$bfff], a
+ ld [s5_bfff], a
call CloseSRAM
ret
Function118440:
push af
- ld a, $5
+ ld a, BANK(s5_bfff)
call GetSRAMBank
- ld a, [$bfff]
+ ld a, [s5_bfff]
inc a
- ld [$bfff], a
+ ld [s5_bfff], a
call CloseSRAM
pop af
ret
@@ -546,7 +546,7 @@
ret
Function1184a5:
- jumptable .Jumptable, wcf66
+ jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
.Jumptable:
dw Function11886e
@@ -579,7 +579,7 @@
dw Function118e76
Function1184ec:
- jumptable .Jumptable, wcf66
+ jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
.Jumptable:
dw Function11886e
@@ -625,7 +625,7 @@
dw Function118e76
BattleTowerRoomMenu_Jumptable:
- jumptable .Jumptable, wcf66
+ jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
.Jumptable:
dw BattleTowerRoomMenu_PickLevelMessage
@@ -646,7 +646,7 @@
dw Function118e76 ; mobile
Function11857c:
- jumptable .Jumptable, wcf66
+ jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
.Jumptable:
dw Function11886e
@@ -679,7 +679,7 @@
dw Function118e76
Function1185c3:
- jumptable .Jumptable, wcf66
+ jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
.Jumptable:
dw Function11886e
@@ -725,7 +725,7 @@
dw Function118e76
Function118624:
- jumptable .Jumptable, wcf66
+ jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
.Jumptable:
dw Function118866
@@ -761,7 +761,7 @@
dw Function118e76
Function118671:
- jumptable .Jumptable, wcf66
+ jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
.Jumptable:
dw Function118866
@@ -791,7 +791,7 @@
dw Function118e76
Function1186b2:
- jumptable .Jumptable, wcf66
+ jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
.Jumptable:
dw Function118866
@@ -822,7 +822,7 @@
dw Function118e76
Function1186f5:
- jumptable .Jumptable, wcf66
+ jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
.Jumptable:
dw Function11886a
@@ -860,7 +860,7 @@
dw Function118e76
Function118746:
- jumptable .Jumptable, wcf66
+ jumptable .Jumptable, wBattleTowerRoomMenuJumptableIndex
.Jumptable:
dw Function11886e
@@ -922,9 +922,9 @@
ld a, $a
call Function3e32
ld a, [wc3f0]
- ld [$c319], a
+ ld [wc319], a
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ret
.asm_1187d1
ld hl, wcd89
@@ -931,9 +931,9 @@
bit 0, [hl]
jr nz, .asm_118803
set 0, [hl]
- ld a, $6
+ ld a, BANK(w6_d000)
ldh [rSVBK], a
- ld de, $d000
+ ld de, w6_d000
ld bc, $1000
ld a, [hl]
sla a
@@ -966,13 +966,13 @@
ld a, $a
call Function3e32
ld a, [wc3f0]
- ld [$c319], a
+ ld [wc319], a
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ret
Function118821:
- ld a, [$c319]
+ ld a, [wc319]
cp $3
jr c, .asm_11884a
cp $4
@@ -985,9 +985,9 @@
ld a, $a
ld [wMobileErrorCodeBuffer], a
ld a, [wc3f0]
- ld [$c319], a
+ ld [wc319], a
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
scf
ret
.asm_11884a
@@ -1003,7 +1003,7 @@
ld a, $a
ld [wMobileErrorCodeBuffer], a
ld a, [wcd34]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
scf
ret
@@ -1025,7 +1025,7 @@
asm_11886f:
ld [wBGMapPalBuffer], a
ld a, $0
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu_IncrementJumptable
ld a, [wcd33]
ld [wMobileInactivityTimerSeconds], a
@@ -1059,7 +1059,7 @@
jp BattleTowerRoomMenu_IncrementJumptable
Function1188b0:
- ld de, $c346
+ ld de, wc346
ld a, $c
jp Function119e2b
@@ -1077,7 +1077,7 @@
ld a, $1
ld [wcd65], a
call Function1188e7
- ld hl, $c708
+ ld hl, wc708
.asm_1188d3
ld a, [de]
inc de
@@ -1086,15 +1086,15 @@
jr nz, .asm_1188d3
call Function119eb4
call Function119ec2
- ld hl, $c708
+ ld hl, wc708
ld a, $6
jp Function119e2b
Function1188e7:
- ld de, $c346
- ld a, $5
+ ld de, wc346
+ ld a, BANK(s5_aa4a)
call GetSRAMBank
- ld a, [$aa4a]
+ ld a, [s5_aa4a]
call CloseSRAM
and a
ret z
@@ -1111,11 +1111,11 @@
Function118903:
ld a, [wc3f0]
- ld [$c319], a
+ ld [wc319], a
ld c, $1
farcall Function115e18
ld a, $8
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
jp BattleTowerRoomMenu_IncrementJumptable
@@ -1138,7 +1138,7 @@
call BattleTowerRoomMenu_IncrementJumptable
BattleTowerRoomMenu_PlacePickLevelMenu:
- ld a, [$c31a]
+ ld a, [wc31a]
and a
ret nz
ld hl, MenuHeader_119cf7
@@ -1299,7 +1299,7 @@
pop af
ldh [rSVBK], a
ld a, $7
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ld a, $0
ld [wMobileInactivityTimerFrames], a
ret
@@ -1374,7 +1374,7 @@
push de
push hl
ld a, $8
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
pop hl
ld c, $0
@@ -1403,7 +1403,7 @@
push de
push bc
ld a, $8
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
call Function118b24
pop bc
@@ -1412,7 +1412,7 @@
jp Function119e2b
Function118b24:
- ld hl, $c346
+ ld hl, wc346
ld a, $8
ld [hli], a
ld a, $c7
@@ -1425,7 +1425,7 @@
call Function119ec2
ld a, $80
ld [wcd89], a
- ld hl, $c346
+ ld hl, wc346
ret
Function118b42:
@@ -1519,10 +1519,10 @@
sla a
add b
ld b, a
- ld a, $5
+ ld a, BANK(s5_b2fb)
call GetSRAMBank
ld a, b
- ld [$b2fb], a
+ ld [s5_b2fb], a
call CloseSRAM
farcall Function170be4
farcall Function1700c4
@@ -1553,7 +1553,7 @@
.asm_118d8e
ld a, $9
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, $12
ld [wMobileInactivityTimerSeconds], a
call BattleTowerRoomMenu_IncrementJumptable
@@ -1563,7 +1563,7 @@
ret c
asm_118d9f:
- ld hl, $c608
+ ld hl, wc608
call Function119940
ld a, [wcd38]
and a
@@ -1599,8 +1599,8 @@
ld a, $40
ld [wcd89], a
ld hl, w3_d800
- ld de, $de00
- ld bc, $0200
+ ld de, w3_de00
+ ld bc, $200
ld a, $2c
jp Function119e2b
@@ -1702,7 +1702,7 @@
Function118e76:
; Call $c in BattleTowerRoomMenu2
ld a, $c
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
jp BattleTowerRoomMenu_IncrementJumptable
Function118e7e:
@@ -1715,7 +1715,7 @@
call BattleTowerRoomMenu2
ret c
ld a, [wcd33]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ret
Function118e92:
@@ -1734,7 +1734,7 @@
Function118eb0:
call Function118440
- ld hl, $d802
+ ld hl, w3_d802
ld de, wBGMapBuffer
ld bc, $000c
call CopyBytes
@@ -1745,25 +1745,25 @@
Function118ec6:
call Function118440
call SpeechTextbox
- ld hl, $d80e
- ld de, $c320
+ ld hl, w3_d80e
+ ld de, wc320
ld bc, $0026
call CopyBytes
xor a
- ld [$c31f], a
+ ld [wc31f], a
ld a, $20
- ld [$c31b], a
+ ld [wc31b], a
ld a, $c3
- ld [$c31c], a
+ ld [wc31c], a
hlcoord 1, 14
ld a, l
- ld [$c31d], a
+ ld [wc31d], a
ld a, h
- ld [$c31e], a
+ ld [wc31e], a
ld a, $2
- ld [$c31a], a
+ ld [wc31a], a
ld a, $1d
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, $24
ld [wMobileInactivityTimerSeconds], a
ld a, $11
@@ -1803,7 +1803,7 @@
ld hl, wcc60
call Function118e39
ld a, $9
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, $24
ld [wMobileInactivityTimerSeconds], a
ld a, $13
@@ -1832,7 +1832,7 @@
ld a, [wcc60]
and a
jr z, .asm_118fba
- ld hl, $c346
+ ld hl, wc346
ld a, LOW($c608)
ld [hli], a
ld a, HIGH($c608)
@@ -1853,9 +1853,9 @@
call Function119ec2
ld a, $40
ld [wcd89], a
- ld hl, $c346
- ld de, $de00
- ld bc, $0200
+ ld hl, wc346
+ ld de, w3_de00
+ ld bc, $200
ld a, $2c
jp Function119e2b
@@ -1912,7 +1912,7 @@
ld de, wcc60
call Function1191ad
ret c
- ld hl, $c346
+ ld hl, wc346
ld a, $8
ld [hli], a
ld a, $c6
@@ -1933,7 +1933,7 @@
call Function119ec2
ld a, $40
ld [wcd89], a
- ld hl, $c346
+ ld hl, wc346
ld de, w3_d000
ld bc, $1000
ld a, $2c
@@ -1968,27 +1968,27 @@
.asm_11908a
call CloseSRAM
- ld a, $3
+ ld a, $3 ; ???
ldh [rSVBK], a
- ld a, $5
+ ld a, BANK(s5_b1b3) ; aka BANK(s5_b1b4) and BANK(s5_aa7f) and BANK(s5_b2f3) and BANK(s5_b2f4)
call GetSRAMBank
ld a, [wcd4f]
- ld [$b1b3], a
+ ld [s5_b1b3], a
ld a, [wcd50]
- ld [$b1b4], a
- ld hl, wBGMapBuffer
- ld de, $aa7f
- ld bc, $000c
+ ld [s5_b1b4], a
+ ld hl, wcd20
+ ld de, s5_aa7f
+ ld bc, 12
call CopyBytes
ldh a, [rSVBK]
push af
- ld a, $1
+ ld a, BANK(wd474) ; aka BANK(wd475)
ldh [rSVBK], a
ld a, [wd474]
- ld [$b2f3], a
+ ld [s5_b2f3], a
ld hl, wd475
- ld de, $b2f4
- ld bc, $0004
+ ld de, s5_b2f4
+ ld bc, 4
call CopyBytes
pop af
ldh [rSVBK], a
@@ -1996,7 +1996,7 @@
jp BattleTowerRoomMenu_IncrementJumptable
Function1190d0:
- ld a, $3
+ ld a, BANK(w3_d000)
ldh [rSVBK], a
ld a, [wcd57]
ld l, a
@@ -2010,19 +2010,19 @@
jp Function118b10
Function1190ec:
- ld a, $5
+ ld a, BANK(s5_aa73)
call GetSRAMBank
ld hl, wBGMapBuffer
- ld de, $aa73
- ld bc, $000c
+ ld de, s5_aa73
+ ld bc, 12
call CopyBytes
call CloseSRAM
- ld a, $5
+ ld a, BANK(s5_aa72)
call GetSRAMBank
ld a, $1
- ld [$aa72], a
+ ld [s5_aa72], a
call CloseSRAM
- ld a, $6
+ ld a, BANK(s6_a000)
call GetSRAMBank
ld a, [w3_d000]
ld c, a
@@ -2029,24 +2029,24 @@
ld a, [w3_d000 + 1]
ld b, a
ld hl, wd002
- ld de, $a000
+ ld de, s6_a000
call Function119192
ret c
ld a, [wcd89]
and $1
jr z, .asm_11913e
- ld a, $6
+ ld a, BANK(w6_d000)
ldh [rSVBK], a
- ld a, [w3_d000]
+ ld a, [w6_d000]
ld c, a
- ld a, [w3_d000 + 1]
+ ld a, [w6_d000 + 1]
ld b, a
- ld hl, wd002
+ ld hl, w6_d000 + 2
call Function119192
ret c
.asm_11913e
- ld a, $3
+ ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
call CloseSRAM
ld hl, Text_ReceivedNews
@@ -2057,21 +2057,21 @@
call BattleTowerRoomMenu2
ret c
ld a, $1c
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ld a, $a
ld [wMobileErrorCodeBuffer], a
ret
Function11915d:
- ld hl, $d802
- ld de, wBGMapBuffer
- ld bc, $000c
+ ld hl, w3_d802
+ ld de, wcd20
+ ld bc, 12
call CopyBytes
- ld a, $5
+ ld a, BANK(s5_aa7f)
call GetSRAMBank
ld hl, wBGMapBuffer
- ld de, $aa7f
- ld c, $c
+ ld de, s5_aa7f
+ ld c, 12
.asm_119176
ld a, [de]
inc de
@@ -2085,7 +2085,7 @@
.asm_119184
ld a, $16
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ld a, $b
ld [wMobileErrorCodeBuffer], a
@@ -2137,7 +2137,7 @@
jr c, .asm_1191b4
ld a, $da
call Function118805
- ld a, $3
+ ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
pop bc
scf
@@ -2144,7 +2144,7 @@
ret
.asm_1191cc
- ld a, $3
+ ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
pop bc
and a
@@ -2199,16 +2199,16 @@
xor a
ld [wcd4b], a
ld [wcd4c], a
- ld a, $5
+ ld a, BANK(s5_b092) ; aka BANK(s5_b1b1) and BANK(s5_b1b2) and BANK(s5_b1d3)
call GetSRAMBank
ld hl, wc3cd
- ld de, $b092
- ld bc, $001f
+ ld de, s5_b092
+ ld bc, 31
call CopyBytes
dec de
xor a
ld [de], a
- ld hl, $d810
+ ld hl, w3_d810
.asm_119241
ld a, [hli]
cp $50
@@ -2218,17 +2218,17 @@
ld a, [hli]
ld [wcd50], a
ld a, [hli]
- ld [$b1b1], a
+ ld [s5_b1b1], a
ld c, a
ld a, [hli]
- ld [$b1b2], a
+ ld [s5_b1b2], a
ld b, a
- ld de, $b1d3
+ ld de, s5_b1d3
call CopyBytes
call CloseSRAM
ld e, l
ld d, h
- ld hl, $c608
+ ld hl, wc608
.asm_119266
ld a, [de]
inc de
@@ -2306,15 +2306,15 @@
ret
Function1192cc:
- ld a, $5
+ ld a, BANK(s5_aa73)
call GetSRAMBank
- ld hl, $aa73
- ld de, $c608
- ld bc, $000c
+ ld hl, s5_aa73
+ ld de, wc608
+ ld bc, 12
call CopyBytes
call CloseSRAM
- ld hl, $c608
- ld de, wBGMapBuffer
+ ld hl, wc608
+ ld de, wcd20
ld c, $c
.asm_1192e8
ld a, [de]
@@ -2326,9 +2326,9 @@
dec c
jr nz, .asm_1192e8
ld a, $1f
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, $27
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
scf
ret
@@ -2344,7 +2344,7 @@
ld e, a
ld a, [wcd4e]
ld d, a
- ld hl, $c608
+ ld hl, wc608
ld a, [wcd4b]
ld c, a
ld a, [wcd4c]
@@ -2434,7 +2434,7 @@
ld hl, wcc60
call Function118e39
ld a, $9
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, $10
ld [wMobileInactivityTimerSeconds], a
call BattleTowerRoomMenu_IncrementJumptable
@@ -2444,20 +2444,20 @@
ret c
call DelayFrame
ld a, $8
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
- ld hl, $c346
- ld a, LOW($d000)
+ ld hl, wc346
+ ld a, LOW(w3_d000)
ld [hli], a
- ld a, HIGH($d000)
+ ld a, HIGH(w3_d000)
ld [hli], a
ld a, [wcd3b]
ld [hli], a
xor a
ld [hli], a
- ld a, LOW($c708)
+ ld a, LOW(wc708)
ld [hli], a
- ld a, HIGH($c708)
+ ld a, HIGH(wc708)
ld [hli], a
ld a, $60
ld [hli], a
@@ -2467,9 +2467,9 @@
call Function119ec2
ld a, $40
ld [wcd89], a
- ld hl, $c346
- ld de, $de00
- ld bc, $0200
+ ld hl, wc346
+ ld de, w3_de00
+ ld bc, $200
ld a, $2c
jp Function119e2b
@@ -2480,7 +2480,7 @@
ld hl, wcc60
call Function118e39
ld a, $9
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, $11
ld [wMobileInactivityTimerSeconds], a
call BattleTowerRoomMenu_IncrementJumptable
@@ -2490,7 +2490,7 @@
ret c
call DelayFrame
ld a, $8
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
ld de, w3_d000
ld bc, $1000
@@ -2497,7 +2497,7 @@
jp Function118b10
Function119413:
- ld a, $6
+ ld a, $6 ; ???
call GetSRAMBank
ld a, [w3_d000]
ld c, a
@@ -2515,18 +2515,18 @@
ld a, [wcd89]
and $1
jr z, .asm_119447
- ld a, $6
+ ld a, BANK(w6_d000)
ldh [rSVBK], a
- ld a, [w3_d000]
+ ld a, [w6_d000]
ld c, a
- ld a, [w3_d000 + 1]
+ ld a, [w6_d000 + 1]
ld b, a
- ld hl, wd002
+ ld hl, w6_d000 + 2
call Function119192
ret c
.asm_119447
- ld a, $3
+ ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
call CloseSRAM
jp BattleTowerRoomMenu_IncrementJumptable
@@ -2550,25 +2550,25 @@
Function119471:
push af
ld a, [hli]
- ld [$c608], a
+ ld [wc608], a
ld a, [hli]
- ld [$c608 + 3], a
+ ld [wc608 + 3], a
ld a, [hli]
- ld [$c608 + 1], a
+ ld [wc608 + 1], a
ld a, [hli]
- ld [$c608 + 2], a
+ ld [wc608 + 2], a
ld a, [hli]
- ld [$c608 + 4], a
+ ld [wc608 + 4], a
ld a, [hli]
- ld [$c608 + 5], a ; $c608 + 5
+ ld [wc608 + 5], a
push hl
- ld a, [$c608]
+ ld a, [wc608]
cp $ff
jr z, .asm_1194a7
- ld a, [$c608 + 2]
+ ld a, [wc608 + 2]
cp $ff
jr z, .asm_1194a7
- ld a, [$c608 + 1]
+ ld a, [wc608 + 1]
cp $ff
jr nz, .asm_1194a7
call Function119584
@@ -2575,8 +2575,8 @@
jr c, .asm_11950c
jr .asm_1194f0
.asm_1194a7
- ld hl, $c608
- ld de, $c608 + 3
+ ld hl, wc608
+ ld de, wc608 + 3
ld c, $3
.asm_1194af
ld a, [de]
@@ -2592,7 +2592,7 @@
.asm_1194bc
ld c, $3
ld hl, wcd49
- ld de, $c608
+ ld de, wc608
.asm_1194c4
ld a, [de]
inc de
@@ -2609,7 +2609,7 @@
.asm_1194d5
ld c, $3
ld hl, wcd49
- ld de, $c608 + 3
+ ld de, wc608 + 3
.asm_1194dd
ld a, [de]
inc de
@@ -2630,7 +2630,7 @@
.asm_1194f3
ld c, $3
ld hl, wcd49
- ld de, $c608
+ ld de, wc608
.asm_1194fb
ld a, [de]
inc de
@@ -2649,9 +2649,9 @@
ld a, $1
ld [wcd50], a
ld a, l
- ld [$c608], a
+ ld [wc608], a
ld a, h
- ld [$c608 + 1], a
+ ld [wc608 + 1], a
ld de, wcd69
ld c, $10
ld b, $0
@@ -2712,7 +2712,7 @@
and a
jr z, .asm_119571
ld a, $1a
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ret
.asm_119571
ld a, $d8
@@ -2723,15 +2723,15 @@
.asm_11957a
ld a, $f
.asm_11957c
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
pop af
call Function1195c4
ret
Function119584:
- ld a, [$c608]
+ ld a, [wc608]
ld b, a
- ld a, [$c608 + 3]
+ ld a, [wc608 + 3]
ld c, a
cp b
jr c, .asm_11959c
@@ -2748,9 +2748,9 @@
cp b
jr c, .asm_119595
.asm_1195a2
- ld a, [$c608 + 2]
+ ld a, [wc608 + 2]
ld b, a
- ld a, [$c608 + 5] ; $c608 + 5
+ ld a, [wc608 + 5]
ld c, a
cp b
jr c, .asm_1195ba
@@ -2794,9 +2794,9 @@
call CopyBytes
xor a
ld [de], a
- ld a, [$c608]
+ ld a, [wc608]
ld l, a
- ld a, [$c608 + 1]
+ ld a, [wc608 + 1]
ld h, a
ld de, wcd69
ld bc, $10
@@ -2808,7 +2808,7 @@
Function1195f8:
ld a, $11
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, $1c
ld [wMobileInactivityTimerSeconds], a
ld a, $f
@@ -2820,7 +2820,7 @@
Function119612:
ld a, $14
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, $1c
ld [wMobileInactivityTimerSeconds], a
ld a, $10
@@ -2838,7 +2838,7 @@
ld h, a
call Function118e39
ld a, $9
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, $1c
ld [wMobileInactivityTimerSeconds], a
ld a, $14
@@ -2850,7 +2850,7 @@
ret c
call DelayFrame
ld a, $8
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
call Function118b24
ld de, w3_d000
@@ -2860,7 +2860,7 @@
Function119665:
ld a, $1a
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu_IncrementJumptable
Function11966d:
@@ -2867,7 +2867,7 @@
call BattleTowerRoomMenu2
ret c
ld a, [wcd47]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ld a, $a
ld [wMobileErrorCodeBuffer], a
ret
@@ -2874,7 +2874,7 @@
Function11967d:
ld a, $18
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu_IncrementJumptable
Function119685:
@@ -2881,7 +2881,7 @@
call BattleTowerRoomMenu2
ret c
ld a, $14
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ld a, $a
ld [wMobileErrorCodeBuffer], a
ret
@@ -2890,7 +2890,7 @@
ld b, 0
ld hl, Unknown_1196b8
.asm_119699
- ld de, $c708
+ ld de, wc708
ld a, [de]
inc de
cp [hl]
@@ -2932,7 +2932,7 @@
; A hack to use ascii above.
Function1196cd:
- ld de, $c719
+ ld de, wc719
call Function1196de
ld [wcd4a], a
inc de
@@ -3126,7 +3126,7 @@
ld hl, wd002
call Function118e39
ld a, $9
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
ld a, $12
ld [wMobileInactivityTimerSeconds], a
call BattleTowerRoomMenu_IncrementJumptable
@@ -3150,7 +3150,7 @@
Function119800:
ld a, $fd
- ld [$c6d0], a
+ ld [wc6d0], a
ld [wOTTrademonSpecies], a
ld a, [wcd81]
ld [wc74e], a
@@ -3160,7 +3160,7 @@
push af
ld a, [wcf65]
push af
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
push af
ld a, $1
ldh [rSVBK], a
@@ -3168,10 +3168,10 @@
farcall Function10803d
call Function11a9ce
call RestartMapMusic
- ld a, $3
+ ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
pop af
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
pop af
ld [wcf65], a
pop af
@@ -3195,7 +3195,7 @@
push af
ld a, [wcf65]
push af
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
push af
ld a, $1
ldh [rSVBK], a
@@ -3203,10 +3203,10 @@
farcall MobileTradeAnimation_SendGivemonToGTS
call Function11a9ce
call RestartMapMusic
- ld a, $3
+ ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
pop af
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
pop af
ld [wcf65], a
pop af
@@ -3229,7 +3229,7 @@
push af
ld a, [wcf65]
push af
- ld a, [wcf66]
+ ld a, [wBattleTowerRoomMenuJumptableIndex]
push af
ld a, $1
ldh [rSVBK], a
@@ -3237,10 +3237,10 @@
farcall MobileTradeAnimation_RetrieveGivemonFromGTS
call Function11a9ce
call RestartMapMusic
- ld a, $3
+ ld a, BANK("Battle Tower RAM")
ldh [rSVBK], a
pop af
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
pop af
ld [wcf65], a
pop af
@@ -3256,23 +3256,23 @@
call BattleTowerRoomMenu_IncrementJumptable
Function1198f7:
- ld a, [$c31a]
+ ld a, [wc31a]
and a
ret nz
- ld hl, $c608 + 2
+ ld hl, wc608 + 2
call Function119940
ld hl, w3_d800
- ld a, LOW($c608)
+ ld a, LOW(wc608)
ld [hli], a
- ld a, HIGH($c608)
+ ld a, HIGH(wc608)
ld [hli], a
ld a, $f6
ld [hli], a
xor a
ld [hli], a
- ld a, LOW($c708)
+ ld a, LOW(wc708)
ld [hli], a
- ld a, HIGH($c708)
+ ld a, HIGH(wc708)
ld [hli], a
ld a, [wcd51]
ld [hli], a
@@ -3283,8 +3283,8 @@
ld a, $40
ld [wcd89], a
ld hl, w3_d800
- ld de, $de00
- ld bc, $0200
+ ld de, w3_de00
+ ld bc, $200
ld a, $2c
jp Function119e2b
@@ -3314,9 +3314,9 @@
Function119954:
ld a, $1c
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
- ld hl, $c608
+ ld hl, wc608
ld de, wc3cd
.asm_119962
ld a, [de]
@@ -3325,7 +3325,7 @@
and a
jr nz, .asm_119962
call Function119ec2
- ld hl, $c608
+ ld hl, wc608
ld a, $1e
jp Function119e2b
@@ -3357,12 +3357,12 @@
and a
jr z, .asm_1199ae
ld a, $16
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
jp Function119b0d
.asm_1199ae
ld a, $1b
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ret
Function1199b4:
@@ -3436,7 +3436,7 @@
ld [w3_d8a2], a
ld [w3_d8a3], a
ld hl, w3_d8a0
- ld bc, $d889
+ ld bc, w3_d889
call Function119e98
call Function119e98
ld hl, w3_d8a0
@@ -3461,9 +3461,9 @@
ld [w3_d8a2], a
ld [w3_d8a3], a
ld hl, w3_d8a0
- ld bc, $d88e
+ ld bc, w3_d88e
call Function119e98
- ld bc, $d893
+ ld bc, w3_d893
call Function119e98
ld hl, w3_d8a0
ld a, [wcd2f]
@@ -3484,7 +3484,7 @@
.asm_119aa7
ld a, $25
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
jp Function119b45
.asm_119aaf
@@ -3519,7 +3519,7 @@
ld a, h
ld [wcf65], a
ld a, $10
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ret
XGameCode:
@@ -3529,13 +3529,13 @@
Function119b0d:
ld a, $8
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu2
ld a, [w3_d090]
cp $1
jr z, .asm_119b23
ld a, $19
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
jr Function119b3b
.asm_119b23
@@ -3670,7 +3670,7 @@
.asm_119be3
ld a, $19
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ld a, BANK(s5_a800)
call GetSRAMBank
ld a, $1
@@ -3691,22 +3691,22 @@
ld a, h
cp HIGH(w3_d869)
jr nz, .asm_119be3
- ld a, $5
+ ld a, BANK(s5_b090) ; aka BANK(s5_b091) and BANK(s5_b023)
call GetSRAMBank
ld a, [wcf64]
- ld [$b090], a
+ ld [s5_b090], a
ld a, [wcf65]
- ld [$b091], a
+ ld [s5_b091], a
ld hl, w3_d800
- ld de, $b023
- ld bc, $0069
+ ld de, s5_b023
+ ld bc, 105
call CopyBytes
ld a, $3
- ld [$a800], a
+ ld [s5_a800], a
call CloseSRAM
ld hl, w3_d800
- ld de, $c608
- ld bc, $0069
+ ld de, wc608
+ ld bc, 105
call CopyBytes
jp BattleTowerRoomMenu_IncrementJumptable
@@ -3735,7 +3735,7 @@
.asm_119c68
ld a, $19
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ld a, BANK(s5_a800)
call GetSRAMBank
ld a, $1
@@ -3788,7 +3788,7 @@
call BattleTowerRoomMenu_IncrementJumptable
BattleTowerRoomMenu_WaitForMessage:
- ld a, [$c31a]
+ ld a, [wc31a]
and a
ret nz
ld a, $80
@@ -3803,7 +3803,7 @@
dec [hl]
ret nz
ld a, $0
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ret
BattleTowerRoomMenu_QuitMessage:
@@ -3827,19 +3827,19 @@
call BattleTowerRoomMenu_IncrementJumptable
BattleTowerRoomMenu_PlaceYesNoMenu:
- ld a, [$c31a]
+ ld a, [wc31a]
and a
ret nz
ld a, $f
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
call BattleTowerRoomMenu_IncrementJumptable
BattleTowerRoomMenu_UpdateYesNoMenu:
- ; Only ever called when [wcd3c] is $10
+ ; Only ever called when [wBattleTowerRoomMenu2JumptableIndex] is $10
call BattleTowerRoomMenu2
ret c
ld a, [wMobileInactivityTimerFrames]
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
ret
MenuHeader_119cf7:
@@ -3883,7 +3883,7 @@
BattleTower_LevelCheck:
ldh a, [rSVBK]
push af
- ld a, $1
+ ld a, BANK(wPartyMons)
ldh [rSVBK], a
ld a, [wcd4f]
ld c, 10
@@ -3918,7 +3918,7 @@
.exceeds
pop af
ld a, $4
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
pop af
ldh [rSVBK], a
scf
@@ -3930,7 +3930,7 @@
ld a, [wcd4f]
cp 70 / 10
jr nc, .level_70_or_more
- ld a, $1
+ ld a, BANK(wPartyMons)
ldh [rSVBK], a
ld hl, wPartyMon1Level
ld bc, PARTYMON_STRUCT_LENGTH
@@ -3973,7 +3973,7 @@
ld bc, MON_NAME_LENGTH
call CopyBytes
ld a, $a
- ld [wcf66], a
+ ld [wBattleTowerRoomMenuJumptableIndex], a
pop af
ldh [rSVBK], a
scf
@@ -3983,7 +3983,7 @@
call Function3e32
BattleTowerRoomMenu_IncrementJumptable:
- ld hl, wcf66
+ ld hl, wBattleTowerRoomMenuJumptableIndex
inc [hl]
ret
@@ -4133,7 +4133,7 @@
ret
.RunJumptable:
- jumptable .Jumptable, wcd3c
+ jumptable .Jumptable, wBattleTowerRoomMenu2JumptableIndex
.Jumptable:
dw Function119f3f
@@ -4293,11 +4293,11 @@
jp Function11a0ca
.asm_11a039
- ld a, $3
+ ld a, BANK(w3_d800)
ldh [rSVBK], a
- ld hl, $c608
+ ld hl, wc608
ld de, w3_d800
- ld bc, $00f6
+ ld bc, 246
call CopyBytes
ld a, $1
ldh [rSVBK], a
@@ -4304,11 +4304,11 @@
call FadeToMenu
farcall Function11765d
call Function11a9ce
- ld a, $3
+ ld a, BANK(w3_d800)
ldh [rSVBK], a
ld hl, w3_d800
- ld de, $c608
- ld bc, $00f6
+ ld de, wc608
+ ld bc, 246
call CopyBytes
ld a, $1
ldh [rSVBK], a
@@ -4382,9 +4382,9 @@
ld hl, wMobileInactivityTimerMinutes
dec [hl]
ret nz
- ld a, [wcd3c]
+ ld a, [wBattleTowerRoomMenu2JumptableIndex]
inc a
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
Function11a13d:
call Function11a63c
@@ -4426,7 +4426,7 @@
call Function11a63c
call Function11a1e6
hlcoord 4, 2
- ld de, $c346
+ ld de, wc346
call PlaceString
call Function11a5f5
xor a
@@ -4477,7 +4477,7 @@
Function11a1e6:
ld hl, String_11a706
- ld de, $c346
+ ld de, wc346
call Function11a1ff
ld hl, wcd85
call Function11a1ff
@@ -4923,7 +4923,7 @@
and $80
jr nz, .asm_11a583
.asm_11a54d
- ld a, [wcd3c]
+ ld a, [wBattleTowerRoomMenu2JumptableIndex]
cp $4
jr z, .asm_11a562
call Function11a9f0
@@ -4981,9 +4981,9 @@
ret
BattleTowerRoomMenu2_IncrementJumptable:
- ld a, [wcd3c]
+ ld a, [wBattleTowerRoomMenu2JumptableIndex]
inc a
- ld [wcd3c], a
+ ld [wBattleTowerRoomMenu2JumptableIndex], a
scf
ret
@@ -5243,7 +5243,7 @@
endr
BattleTowerRoomMenu_WriteMessage:
- jumptable .Jumptable, $c31a
+ jumptable .Jumptable, wc31a
.Jumptable:
dw BattleTowerRoomMenu_WriteMessage_DoNothing
@@ -5255,14 +5255,14 @@
ldh [rSVBK], a
call SpeechTextbox
ld a, $50
- ld hl, $c320
+ ld hl, wc320
ld bc, $008c
call ByteFill
- ld a, [$c31b]
+ ld a, [wc31b]
ld l, a
- ld a, [$c31c]
+ ld a, [wc31c]
ld h, a
- ld de, $c320
+ ld de, wc320
.asm_11a92c
ld a, [hli]
cp $57
@@ -5293,17 +5293,17 @@
.asm_11a94f
xor a
- ld [$c31f], a
- ld a, LOW($c320)
- ld [$c31b], a
- ld a, HIGH($c320)
- ld [$c31c], a
+ ld [wc31f], a
+ ld a, LOW(wc320)
+ ld [wc31b], a
+ ld a, HIGH(wc320)
+ ld [wc31c], a
hlcoord 1, 14
ld a, l
- ld [$c31d], a
+ ld [wc31d], a
ld a, h
- ld [$c31e], a
- ld hl, $c31a
+ ld [wc31e], a
+ ld hl, wc31a
inc [hl]
ld a, $3
ldh [rSVBK], a
@@ -5312,7 +5312,7 @@
ret
Function11a971:
- ld hl, $c31f
+ ld hl, wc31f
ldh a, [hJoyDown]
and a
jr nz, .asm_11a97f
@@ -5327,34 +5327,34 @@
and $7
ld [hl], a
ld hl, wcd8d
- ld a, [$c31b]
+ ld a, [wc31b]
ld e, a
- ld a, [$c31c]
+ ld a, [wc31c]
ld d, a
ld a, [de]
inc de
ld [hli], a
ld a, e
- ld [$c31b], a
+ ld [wc31b], a
ld a, d
- ld [$c31c], a
+ ld [wc31c], a
ld a, $50
ld [hl], a
- ld a, [$c31d]
+ ld a, [wc31d]
ld l, a
- ld a, [$c31e]
+ ld a, [wc31e]
ld h, a
ld de, wcd8d
call PlaceString
ld a, c
- ld [$c31d], a
+ ld [wc31d], a
ld a, b
- ld [$c31e], a
+ ld [wc31e], a
ld a, [wcd8d]
cp $50
jr nz, .asm_11a9bf
xor a
- ld [$c31a], a
+ ld [wc31a], a
.asm_11a9bf
ret
@@ -5361,11 +5361,11 @@
BattleTowerRoomMenu_SetMessage:
ld a, l
- ld [$c31b], a
+ ld [wc31b], a
ld a, h
- ld [$c31c], a
+ ld [wc31c], a
ld a, $1
- ld [$c31a], a
+ ld [wc31a], a
ret
Function11a9ce:
--- a/pokecrystal.link
+++ b/pokecrystal.link
@@ -331,6 +331,7 @@
WRAMX 3
"Battle Tower RAM"
WRAMX 5
+ align 8
"GBC Video"
org $d300
"Battle Animations"
@@ -365,5 +366,7 @@
"SRAM Mobile 1"
SRAM $05
"SRAM Mobile 2"
+SRAM $06
+ "SRAM Mobile 3"
HRAM
"HRAM"
--- a/sram.asm
+++ b/sram.asm
@@ -239,12 +239,26 @@
sBox13:: box sBox13
sBox14:: box sBox14
+
SECTION "SRAM Mobile 1", SRAM
- ds $13
+ ds $7
+s4_a007:: ; struct size $30 ; a007
+
+ ds $c
+
s4_a013:: ds 36 ; a013
+ ds $5d5
+
+s4_a60c:: db ; a60c
+
+ ds $1
+
+s4_a60e:: dw ; a60e
+
+
SECTION "SRAM Mobile 2", SRAM
ds 1 ; former location for sMobileEventIndex, moved to 1:BE3C in English
@@ -328,8 +342,10 @@
s5_aa47:: db ; aa47
s5_aa48:: db ; aa48
- ds $2
+ ds $1
+s5_aa4a:: db ; aa4a
+
sMobileLoginPassword:: ds MOBILE_LOGIN_PASSWORD_LENGTH ; aa4b
ds $1
@@ -336,8 +352,12 @@
s5_aa5d:: ds MOBILE_LOGIN_PASSWORD_LENGTH ; aa5d
- ds $1d
+ ds $4
+s5_aa72:: db ; aa72
+s5_aa73:: ds 12 ; aa73
+s5_aa7f:: ds 12 ; aa7f
+
s5_aa8b:: db ; aa8b
s5_aa8c:: db ; aa8c
s5_aa8d:: db ; aa8d
@@ -347,13 +367,27 @@
s5_b023:: ds 105 ; b023
s5_b08c:: ds 4 ; b08c
+s5_b090:: db ; b090
+s5_b091:: db ; b091
+s5_b092:: ds 31 ; b092
- ds $263
+ ds $100
+s5_b1b1:: db ; b1b1
+s5_b1b2:: db ; b1b2
+s5_b1b3:: db ; b1b3
+s5_b1b4:: db ; b1b4
+
+ ds $1e
+
+s5_b1d3:: ; b1d3
+
+ ds $120
+
s5_b2f3:: db ; b2f3
-s5_b2f4:: db ; b2f4
+s5_b2f4:: ds 4 ; b2f4
- ds 4
+ ds $1
s5_b2f9:: db ; b2f9
s5_b2fa:: db ; b2fa
@@ -363,3 +397,12 @@
s5_be45:: db ; be45
s5_be46:: db ; be46
+
+ ds $1b8
+
+s5_bfff:: db ; bfff
+
+
+SECTION "SRAM Mobile 3", SRAM
+
+s6_a000:: ; a000
--- a/wram.asm
+++ b/wram.asm
@@ -255,7 +255,16 @@
wc311:: ds 1
wc312:: ds 1
wc313:: ds 1
-wc314:: ds 152
+wc314:: ds 5
+wc319:: db
+wc31a:: db
+wc31b:: db
+wc31c:: db
+wc31d:: db
+wc31e:: db
+wc31f:: db
+wc320:: ds 38
+wc346:: ds 102
wc3ac:: ds 8
ENDU ; c3b4
@@ -898,7 +907,8 @@
wc70f:: db
wc710:: db
wc711:: db
-wc712:: ds 60
+wc712:: ds 7
+wc719:: ds 53
wc74e:: ds 107
wc7b9:: ds 1
wc7ba:: ds 1
@@ -1206,7 +1216,7 @@
wcd39:: ds 1
wcd3a:: ds 1
wcd3b:: ds 1
-wcd3c:: ds 1
+wBattleTowerRoomMenu2JumptableIndex:: ds 1
wcd3d:: ds 1
wcd3e:: ds 1
wcd3f:: ds 1
@@ -1419,6 +1429,11 @@
wUnownPuzzleHeldPiece:: db
NEXTU ; cf64
+; battle tower
+ ds $2
+wBattleTowerRoomMenuJumptableIndex:: db
+
+NEXTU ; cf64
; miscellaneous
wFrameCounter::
wNrOfBeatenBattleTowerTrainers::
@@ -3013,24 +3028,33 @@
NEXTU ; d742
ds $be
-wBTChoiceOfLvlGroup:: db
- ds $68
-w3_d869:: ds $17
-w3_d880:: ds 1
-w3_d881:: ds 9
-w3_d88a:: ds 5
-w3_d88f:: ds 5
-w3_d894:: ds 1
-w3_d895:: ds 11
-w3_d8a0:: ds 1
-w3_d8a1:: ds 1
-w3_d8a2:: ds 1
-w3_d8a3:: ds 1
+wBTChoiceOfLvlGroup:: db ; d800
+ ds $1
+w3_d802:: ds 12 ; d802
+w3_d80e:: db ; d80e
+ ds $1
+w3_d810:: ; d810
+ ds $59
+w3_d869:: ds $17 ; d869
+w3_d880:: ds 1 ; d880
+w3_d881:: ds 8 ; d881
+w3_d889:: ds 1 ; d889
+w3_d88a:: ds 4 ; d88a
+w3_d88e:: ds 1 ; d88e
+w3_d88f:: ds 4 ; d88f
+w3_d893:: ds 1 ; d893
+w3_d894:: ds 1 ; d894
+w3_d895:: ds 11 ; d895
+w3_d8a0:: ds 1 ; d8a0
+w3_d8a1:: ds 1 ; d8a1
+w3_d8a2:: ds 1 ; d8a2
+w3_d8a3:: ds 1 ; d8a3
ENDU ; d8a4
ds $1c0
w3_dc00:: ds SCREEN_WIDTH * SCREEN_HEIGHT
+UNION ; dd68
w3_dd68:: ds SCREEN_WIDTH * SCREEN_HEIGHT
ds $11c
@@ -3037,10 +3061,14 @@
w3_dfec:: ds $10
w3_dffc:: ds 4
+NEXTU ; dd68
+ ds $98
+w3_de00:: ds $200
+ENDU ; e000
+SECTION "GBC Video", WRAMX, ALIGN[8]
+; LCD expects wLYOverrides to have an alignment of $100
-SECTION "GBC Video", WRAMX
-
; eight 4-color palettes each
wGBCPalettes:: ; used only for BANK(wGBCPalettes)
wBGPals1:: ds 8 palettes ; d000
@@ -3159,6 +3187,10 @@
NEXTU ; d000
wDecompressScratch:: ds $80 tiles
wDecompressEnemyFrontpic:: ds $80 tiles
+
+NEXTU ; d000
+; unidentified uses
+w6_d000:: ds $1000
ENDU ; e000