shithub: pokecrystal

Download patch

ref: 98af69691d8994b07c19ef4e86f3f903da6091ed
parent: 9433b5a75294a76527bfcb661ee57a43202d7185
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Jun 21 08:21:47 EDT 2020

Remove some more raw addresses

--- a/constants/battle_tower_constants.asm
+++ b/constants/battle_tower_constants.asm
@@ -25,10 +25,10 @@
 	const BATTLETOWERACTION_0D ; more time stuff in SRAM bank 5
 	const BATTLETOWERACTION_EGGTICKET
 	const BATTLETOWERACTION_0F ; check w3_d090
-	const BATTLETOWERACTION_10 ; dw based on 5:a800
-	const BATTLETOWERACTION_11 ; store 0 in 5:aa8d
-	const BATTLETOWERACTION_12 ; store 1 in 5:aa8d
-	const BATTLETOWERACTION_13 ; check 5:aa8d
+	const BATTLETOWERACTION_10 ; dw based on s5_a800
+	const BATTLETOWERACTION_11 ; store 0 in s5_aa8d
+	const BATTLETOWERACTION_12 ; store 1 in s5_aa8d
+	const BATTLETOWERACTION_13 ; check s5_aa8d
 	const BATTLETOWERACTION_14 ; if save file is yours: bit 0, [sBattleTowerSaveFileFlags]
 	const BATTLETOWERACTION_15 ; set 0, [sBattleTowerSaveFileFlags]
 	const BATTLETOWERACTION_16 ; update time in SRAM bank 5
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -8050,11 +8050,11 @@
 	ld b, SCGB_BATTLE_GRAYSCALE
 	call GetSGBLayout
 	ld hl, rLCDC
-	res rLCDC_WINDOW_TILEMAP, [hl] ; select 9800-9BFF
+	res rLCDC_WINDOW_TILEMAP, [hl] ; select vBGMap0/vBGMap2
 	call InitBattleDisplay
 	call BattleStartMessage
 	ld hl, rLCDC
-	set rLCDC_WINDOW_TILEMAP, [hl] ; select 9C00-9FFF
+	set rLCDC_WINDOW_TILEMAP, [hl] ; select vBGMap1/vBGMap3
 	xor a
 	ldh [hBGMapMode], a
 	call EmptyBattleTextbox
--- a/engine/events/battle_tower/battle_tower.asm
+++ b/engine/events/battle_tower/battle_tower.asm
@@ -68,7 +68,7 @@
 	ret
 
 Function170139:
-; Convert the 4-digit decimal number at 5:aa41 into binary
+; Convert the 4-digit decimal number at s5_aa41 into binary
 	ld a, BANK(s5_aa41)
 	call OpenSRAM
 	ld de, s5_aa41
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -826,7 +826,7 @@
 	call CopyBytes
 
 	; This block originally had some mobile functionality, but since we're still in
-	; BANK(sCrystalData), it instead overwrites the sixteen wEventFlags starting at 1:a603 with
+	; BANK(sCrystalData), it instead overwrites the sixteen wEventFlags starting at 1:s4_a60e with
 	; garbage from wd479. This isn't an issue, since ErasePreviousSave is followed by a regular
 	; save that unwrites the garbage.
 
--- a/engine/printer/printer.asm
+++ b/engine/printer/printer.asm
@@ -506,7 +506,7 @@
 
 CheckPrinterStatus:
 ; Check for printer errors
-; If [ca88] == -1, we're disconnected
+; If [wPrinterHandshake] == -1, we're disconnected
 	ld a, [wPrinterHandshake]
 	cp -1
 	jr nz, .printer_connected
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -126,7 +126,6 @@
 ENDM
 
 channel_struct: MACRO
-; Addreses are wChannel1 (c101).
 \1MusicID::           dw
 \1MusicBank::         db
 \1Flags1::            db ; 0:on/off 1:subroutine 2:looping 3:sfx 4:noise 5:rest
--- a/mobile/mobile_41.asm
+++ b/mobile/mobile_41.asm
@@ -247,9 +247,9 @@
 
 Unreferenced_StubbedTrainerRankings_BattleTowerWins:
 	ret
-	ld a, $5
+	ld a, BANK(s5_aa8d)
 	call OpenSRAM
-	ld a, [$aa8d]
+	ld a, [s5_aa8d]
 	and a
 	call CloseSRAM
 	ret nz
@@ -790,16 +790,16 @@
 
 Stubbed_Function106314:
 	ret
-	ld a, $4
+	ld a, BANK(s4_b000)
 	call OpenSRAM
 	ld a, c
 	cpl
-	ld [$b000], a
+	ld [s4_b000], a
 	call CloseSRAM
-	ld a, $7
+	ld a, BANK(s7_a800)
 	call OpenSRAM
 	ld a, c
-	ld [$a800], a
+	ld [s7_a800], a
 	call CloseSRAM
 	ret
 
@@ -809,16 +809,16 @@
 
 Function106331:
 ; called by Mobile_DummyReturnFalse in Crystal-J
-	; check ~[4:b000] == [7:a800]
-	ld a, $4
+	; check ~[s4_b000] == [s7_a800]
+	ld a, BANK(s4_b000)
 	call OpenSRAM
-	ld a, [$b000]
+	ld a, [s4_b000]
 	cpl
 	ld b, a
 	call CloseSRAM
-	ld a, $7
+	ld a, BANK(s7_a800)
 	call OpenSRAM
-	ld a, [$a800]
+	ld a, [s7_a800]
 	ld c, a
 	call CloseSRAM
 	ld a, c
@@ -825,11 +825,11 @@
 	cp b
 	jr nz, .nope
 
-	; check [7:a800] != 0
+	; check [s7_a800] != 0
 	and a
 	jr z, .nope
 
-	; check !([7:a800] & %01110000)
+	; check !([s7_a800] & %01110000)
 	and %10001111
 	cp c
 	jr nz, .nope
@@ -1023,7 +1023,7 @@
 	call Get2bpp
 	ld de, $40b0
 	ld hl, vTiles2 tile $6b
-	ld b, $f ; XXX no graphics at 0f:40b0
+	ld b, $0f ; XXX no graphics at 0f:40b0
 	call Get2bpp
 	farcall LoadFrame
 	ret
--- a/mobile/mobile_5e.asm
+++ b/mobile/mobile_5e.asm
@@ -25,7 +25,7 @@
 	ld hl, $d088
 	bit 5, [hl]
 	jr z, .asm_17a6a6
-	ld de, wStringBuffer1 ; $d073
+	ld de, wStringBuffer1
 	push de
 	call Function17a721
 	pop de
@@ -39,7 +39,7 @@
 Function17a6a8:
 	push de
 	push bc
-	ld hl, wStringBuffer2 ; $d086
+	ld hl, wStringBuffer2
 	ld bc, $a
 	xor a
 	call ByteFill
@@ -531,7 +531,7 @@
 	db   "@"
 
 Function17a9cb:
-	ld de, wVirtualOAM ; $c400
+	ld de, wVirtualOAM
 	ld hl, $d088
 	bit 6, [hl]
 	jr nz, .bit_6_set
@@ -773,7 +773,7 @@
 	ldh [rSVBK], a
 
 	ld hl, Palette_17ac55
-	ld de, wBGPals1 ; $d000
+	ld de, wBGPals1
 	ld bc, 6 palettes
 	call CopyBytes
 
--- a/sram.asm
+++ b/sram.asm
@@ -253,7 +253,11 @@
 
 sMobileBattleTimer:: ds 3
 
+	ds $7fd
 
+s4_b000:: db
+
+
 SECTION "SRAM Mobile 2", SRAM
 
 	ds 1 ; former location for sMobileEventIndex, moved to 1:BE3C in English
@@ -407,3 +411,7 @@
 SECTION "SRAM Mobile 4", SRAM
 
 s7_a000::
+
+	ds $800
+
+s7_a800:: db