From 2f4a0179feb846ac2eba945ba5365d0ebf6a6179 Mon Sep 17 00:00:00 2001 From: JimB16 Date: Wed, 26 Aug 2015 01:40:34 +0200 Subject: [PATCH] changed constants to SRAMLabels --- data/battle_tower.asm | 4 +-- main.asm | 9 +++--- misc/mobile_45.asm | 73 ++++++++++++++++++++++--------------------- misc/mobile_5f.asm | 12 +++---- wram.asm | 5 +-- 5 files changed, 53 insertions(+), 50 deletions(-) diff --git a/data/battle_tower.asm b/data/battle_tower.asm index a204920f5..e10a47a96 100644 --- a/data/battle_tower.asm +++ b/data/battle_tower.asm @@ -54,12 +54,12 @@ ENDC 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 diff --git a/main.asm b/main.asm index 17777b541..63468d8af 100644 --- a/main.asm +++ b/main.asm @@ -8803,7 +8803,7 @@ Functionde44: ; de44 Functionde6e: ; de6e - ld a, 1 ; BANK(sBoxCount) + ld a, BANK(sBoxCount) call GetSRAMBank ld de, sBoxCount ld a, [de] @@ -9067,7 +9067,7 @@ Functione039: ; e039 and a jr z, .asm_e04a - ld a, 1 ; BANK(sBoxCount) + ld a, BANK(sBoxCount) call GetSRAMBank ld hl, sBoxCount @@ -51399,7 +51399,7 @@ Function806ff: ; 806ff 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 @@ INCLUDE "text/battle_tower.asm" 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" diff --git a/misc/mobile_45.asm b/misc/mobile_45.asm index 95bf8e9fc..ff04cb52f 100644 --- a/misc/mobile_45.asm +++ b/misc/mobile_45.asm @@ -22852,9 +22852,9 @@ Function17024d: ; 17024d 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 @@ Function1704a2: ; 1704a2 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 @@ Jumptable_170696: ; 170696 (5c:4696) 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 @@ Function1706ee: ; 1706ee (5c:46ee) 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 @@ Function17073e: ; 17073e (5c:473e) 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,17 +23619,17 @@ Function17075f: ; 17075f (5c:475f) 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 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 @@ Function170778: ; 170778 (5c:4778) 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 @@ Function170799: ; 170799 (5c:4799) 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,27 +23764,27 @@ Function17081d: ; 17081d (5c:481d) ret Function170868: ; 170868 (5c:4868) - 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, [wd000 + $800] - ld [$be47], a + ld [sbe47], a pop af ld [rSVBK], a ; $ff00+$70 call CloseSRAM 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 @@ Function1708b1: ; 1708b1 (5c:48b1) 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,20 +24122,20 @@ Function170abe: ; 170abe (5c:4abe) 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 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 diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm index 15224c404..c8a2d1092 100644 --- a/misc/mobile_5f.asm +++ b/misc/mobile_5f.asm @@ -2544,7 +2544,7 @@ endr ; 17e026 Function17e026: ; 17e026 - ld a, $1 + ld a, BANK(sBoxCount) call GetSRAMBank ld a, [sBoxCount] call CloseSRAM @@ -2559,7 +2559,7 @@ Function17e026: ; 17e026 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 @@ Function17f334: ; 17f334 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 @@ Function17f382: ; 17f382 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 diff --git a/wram.asm b/wram.asm index 9a29cb950..82294c9da 100644 --- a/wram.asm +++ b/wram.asm @@ -2795,9 +2795,10 @@ sbe47:: ds 1 ; 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