shithub: pokecrystal

Download patch

ref: 2f4a0179feb846ac2eba945ba5365d0ebf6a6179
parent: b9c1d1b61e529ccda59cafda037c54964af544f3
author: JimB16 <f1@jimb.de>
date: Tue Aug 25 21:40:34 EDT 2015

changed constants to SRAMLabels

--- a/data/battle_tower.asm
+++ b/data/battle_tower.asm
@@ -54,12 +54,12 @@
 	call CopyBytes
 	call Function_LoadRandomBattleTowerPkmn
 	pop af
-	ld hl, Unknown_1f0000
+	ld hl, BattleTowerTrainerData
 	ld bc, $0024
 	call AddNTimes
 	ld bc, $0024
 .asm_1f8070
-	ld a, BANK(Unknown_1f0000)
+	ld a, BANK(BattleTowerTrainerData)
 	call GetFarByte
 	ld [de], a
 	inc hl
--- a/main.asm
+++ b/main.asm
@@ -8803,7 +8803,7 @@
 
 
 Functionde6e: ; de6e
-	ld a, 1 ; BANK(sBoxCount)
+	ld a, BANK(sBoxCount)
 	call GetSRAMBank
 	ld de, sBoxCount
 	ld a, [de]
@@ -9067,7 +9067,7 @@
 	and a
 	jr z, .asm_e04a
 
-	ld a, 1 ; BANK(sBoxCount)
+	ld a, BANK(sBoxCount)
 	call GetSRAMBank
 	ld hl, sBoxCount
 
@@ -51399,7 +51399,7 @@
 
 Function80715: ; 80715
 ; Remaining slots in the current box.
-	ld a, 1 ; BANK(sBoxCount)
+	ld a, BANK(sBoxCount)
 	call GetSRAMBank
 	ld hl, sBoxCount
 	ld a, MONS_PER_BOX
@@ -93532,7 +93532,8 @@
 
 SECTION "bank7C", ROMX, BANK[$7C]
 
-Unknown_1f0000::
+BattleTowerTrainerData:: ; What exactly it is, I don't know
+; Size is 70 (Nr of Trainers in BattleTower) * 0x24 (Nr of Bytes that are copied)
 INCBIN "unknown/1f0000.bin"
 
 
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -22852,9 +22852,9 @@
 	ld [ScriptVar], a
 	and a
 	jr nz, .asm_1702a9
-	ld a, $1
+	ld a, BANK(sbe46)
 	call GetSRAMBank
-	ld a, [$be46]
+	ld a, [sbe46]
 	ld [wcf64], a
 	call CloseSRAM
 	ld hl, StringBuffer3
@@ -23176,11 +23176,11 @@
 	call CopyBytes
 	pop af
 	ld [rSVBK], a
-	ld a, $1
+	ld a, BANK(s1_be45)
 	call GetSRAMBank
 	ld a, $2
-	ld [$be45], a
-	ld hl, $be46
+	ld [s1_be45], a
+	ld hl, sbe46
 	inc [hl]
 	call CloseSRAM
 Function1704c9:
@@ -23534,22 +23534,23 @@
 	dw Function170737 ; 0x1f
 
 
+; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes)
 Function1706d6: ; 1706d6 (5c:46d6)
-	ld a, $1
+	ld a, BANK(sBTTrainers)
 	call GetSRAMBank
 	ld a, $ff
-	ld hl, $be48
+	ld hl, sBTTrainers
 	ld bc, $7
 	call ByteFill
 	xor a
-	ld [$be46], a
+	ld [sbe46], a
 	call CloseSRAM
 	ret
 
 Function1706ee: ; 1706ee (5c:46ee)
-	ld a, $1
+	ld a, BANK(sbe50)
 	call GetSRAMBank
-	ld a, [$be50]
+	ld a, [sbe50]
 	call CloseSRAM
 	ld [ScriptVar], a
 	ld hl, NumItems
@@ -23575,18 +23576,18 @@
 	ret
 
 Function17071b: ; 17071b (5c:471b)
-	ld a, $1
+	ld a, BANK(s1_be45)
 	call GetSRAMBank
 	ld a, $3
-	ld [$be45], a
+	ld [s1_be45], a
 	call CloseSRAM
 	ret
 
 Function170729: ; 170729 (5c:4729)
-	ld a, $1
+	ld a, BANK(s1_be45)
 	call GetSRAMBank
 	ld a, $4
-	ld [$be45], a
+	ld [s1_be45], a
 	call CloseSRAM
 	ret
 
@@ -23606,10 +23607,10 @@
 	cp $1e
 	jr z, Function17073e
 	push af
-	ld a, $1
+	ld a, BANK(sbe50)
 	call GetSRAMBank
 	pop af
-	ld [$be50], a
+	ld [sbe50], a
 	call CloseSRAM
 	ret
 
@@ -23618,9 +23619,9 @@
 	ld a, [ScriptVar]
 	and a
 	ret z
-	ld a, $1
+	ld a, BANK(sbe4f)
 	call GetSRAMBank
-	ld a, [$be4f]
+	ld a, [sbe4f]
 	and $2
 	ld [ScriptVar], a
 	call CloseSRAM
@@ -23627,8 +23628,8 @@
 	ret
 
 Function170778: ; 170778 (5c:4778)
-	ld hl, $be45
-	ld a, $1
+	ld hl, s1_be45
+	ld a, BANK(s1_be45)
 	call GetSRAMBank
 	ld a, [hl]
 	ld [ScriptVar], a
@@ -23636,11 +23637,11 @@
 	ret
 
 Function170788: ; 170788 (5c:4788)
-	ld a, $1
+	ld a, BANK(sbe4f)
 	call GetSRAMBank
-	ld a, [$be4f]
+	ld a, [sbe4f]
 	or $2
-	ld [$be4f], a
+	ld [sbe4f], a
 	call CloseSRAM
 	ret
 
@@ -23651,10 +23652,10 @@
 Function17079d: ; 17079d (5c:479d)
 	ld c, $0
 asm_17079f: ; 17079f (5c:479f)
-	ld a, $1
+	ld a, BANK(s1_be45)
 	call GetSRAMBank
 	ld a, c
-	ld [$be45], a
+	ld [s1_be45], a
 	call CloseSRAM
 	ret
 
@@ -23763,7 +23764,7 @@
 	ret
 
 Function170868: ; 170868 (5c:4868)
-	ld a, $1
+	ld a, BANK(sbe47)
 	call GetSRAMBank
 	ld a, [rSVBK] ; $ff00+$70
 	push af
@@ -23770,7 +23771,7 @@
 	ld a, $3
 	ld [rSVBK], a ; $ff00+$70
 	ld a, [wd000 + $800]
-	ld [$be47], a
+	ld [sbe47], a
 	pop af
 	ld [rSVBK], a ; $ff00+$70
 	call CloseSRAM
@@ -23777,13 +23778,13 @@
 	ret
 
 Function170881: ; 170881 (5c:4881)
-	ld a, $1
+	ld a, BANK(sbe47)
 	call GetSRAMBank
 	ld a, [rSVBK] ; $ff00+$70
 	push af
 	ld a, $3
 	ld [rSVBK], a ; $ff00+$70
-	ld a, [$be47]
+	ld a, [sbe47]
 	ld [wd000 + $800], a
 	pop af
 	ld [rSVBK], a ; $ff00+$70
@@ -23815,9 +23816,9 @@
 	ret
 
 Function1708b9: ; 1708b9 (5c:48b9)
-	ld a, $1
+	ld a, BANK(s1_be3c)
 	call GetSRAMBank
-	ld a, [$be3c]
+	ld a, [s1_be3c]
 	ld [ScriptVar], a
 	call CloseSRAM
 	ret
@@ -24121,9 +24122,9 @@
 	ld a, [ScriptVar]
 	and a
 	ret z
-	ld a, $1
+	ld a, BANK(sbe4f)
 	call GetSRAMBank
-	ld a, [$be4f]
+	ld a, [sbe4f]
 	and $1
 	ld [ScriptVar], a
 	call CloseSRAM
@@ -24130,11 +24131,11 @@
 	ret
 
 Function170ad7: ; 170ad7 (5c:4ad7)
-	ld a, $1
+	ld a, BANK(sbe4f)
 	call GetSRAMBank
-	ld a, [$be4f]
+	ld a, [sbe4f]
 	or $1
-	ld [$be4f], a
+	ld [sbe4f], a
 	call CloseSRAM
 	ret
 
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -2544,7 +2544,7 @@
 ; 17e026
 
 Function17e026: ; 17e026
-	ld a, $1
+	ld a, BANK(sBoxCount)
 	call GetSRAMBank
 	ld a, [sBoxCount]
 	call CloseSRAM
@@ -2559,7 +2559,7 @@
 	callba Function4db83
 	pop hl
 	pop bc
-	ld a, $1
+	ld a, BANK(sBoxMonNicknames)
 	call GetSRAMBank
 	bit 1, b
 	jr z, .asm_17e067
@@ -4304,9 +4304,9 @@
 	ld a, [wcd55]
 	bit 7, a
 	jr nz, .asm_17f355
-	ld a, $1
+	ld a, BANK(sCrystalData)
 	call GetSRAMBank
-	ld a, [$be3f]
+	ld a, [sCrystalData + 2]
 	jr .asm_17f35d
 
 .asm_17f355
@@ -4348,9 +4348,9 @@
 	ld a, [wcd55]
 	bit 7, a
 	jr nz, .asm_17f3a3
-	ld a, $1
+	ld a, BANK(sCrystalData)
 	call GetSRAMBank
-	ld de, $be40
+	ld de, sCrystalData + 3
 	jr .asm_17f3ab
 
 .asm_17f3a3
--- a/wram.asm
+++ b/wram.asm
@@ -2795,9 +2795,10 @@
 ; The 7 trainers of the BattleTower are saved here, so nobody appears more than once
 sBTTrainers:: ; sbe48
 	ds 7
-sbe4f:: ds 2
+sbe4f:: ds 1
+sbe50:: ds 1
 ; Pkmn of previous trainer
-sBTPkmnOfTrainers::
+sBTPkmnOfTrainers:: ; 0xbe51
 sBTPkmnPrevTrainer1::
 	ds 1
 sBTPkmnPrevTrainer2:: ds 1