shithub: pokecrystal

Download patch

ref: 95c0c31c8ff8e1149a9b959e04ea27e337e929b4
parent: 23f2c056e8286f2a5d43b88eeb84c6afa229c134
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Wed Jan 17 20:25:19 EST 2018

Eliminate wd000

--- a/engine/color.asm
+++ b/engine/color.asm
@@ -891,13 +891,13 @@
 	call CheckCGB
 	ret z
 ; CGB only
-	ld a, $1
+	ld a, BANK(vTiles3)
 	ld [rVBK], a
-	ld hl, vTiles0
+	ld hl, vTiles3
 	ld bc, $200 tiles
 	xor a
 	call ByteFill
-	ld a, $0
+	ld a, BANK(vTiles0)
 	ld [rVBK], a
 	ld a, 1 << rBGPI_AUTO_INCREMENT
 	ld [rBGPI], a
--- a/engine/gbc_only.asm
+++ b/engine/gbc_only.asm
@@ -10,16 +10,16 @@
 	call ClearTileMap
 
 	ld hl, GBCOnlyGFX
-	ld de, wd000
+	ld de, wDecompressBuffer
 	ld a, [rSVBK]
 	push af
-	ld a, 0 ; this has the same effect as selecting bank 1 (http://gbdev.gg8.se/files/docs/mirrors/pandocs.html#videodisplay)
+	ld a, 0 ; this has the same effect as selecting bank 1
 	ld [rSVBK], a
 	call Decompress
 	pop af
 	ld [rSVBK], a
 
-	ld de, wd000
+	ld de, wDecompressBuffer
 	ld hl, vTiles2
 	lb bc, BANK(GBCOnlyGFX), $54
 	call Get2bpp
--- a/home/init.asm
+++ b/home/init.asm
@@ -96,7 +96,7 @@
 	ld [hCGB], a
 
 	call ClearWRAM
-	ld a, BANK(wd000)
+	ld a, 1
 	ld [rSVBK], a
 	call ClearVRAM
 	call ClearSprites
@@ -182,11 +182,11 @@
 	ld [rVBK], a
 	call .clear
 
-	xor a
+	xor a ; 0
 	ld [rVBK], a
 .clear
-	ld hl, vTiles0
-	ld bc, $2000
+	ld hl, VRAM_Begin
+	ld bc, VRAM_End - VRAM_Begin
 	xor a
 	call ByteFill
 	ret
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -2529,9 +2529,9 @@
 	ld [wcd3c], a
 	call BattleTowerRoomMenu2
 	ld hl, $c346
-	ld a, LOW(wd000)
+	ld a, LOW($d000)
 	ld [hli], a
-	ld a, HIGH(wd000)
+	ld a, HIGH($d000)
 	ld [hli], a
 	ld a, [wcd3b]
 	ld [hli], a
@@ -3467,10 +3467,10 @@
 ; 1199b4
 
 Function1199b4: ; 1199b4
-	ld a, [wd000 + 130]
+	ld a, [w3_d081+1]
 	and a
 	jr nz, .asm_1199c7
-	ld a, [wd000 + 129]
+	ld a, [w3_d081]
 	cp $7
 	jr nc, .asm_1199c7
 	call BattleTowerRoomMenu_IncrementJumptable
--- a/mobile/mobile_5c.asm
+++ b/mobile/mobile_5c.asm
@@ -272,7 +272,7 @@
 	call Decompress
 	ld a, $1
 	ld [rVBK], a
-	ld de, wd000
+	ld de, wDecompressBuffer
 	ld hl, vTiles0
 	lb bc, $6, $c1
 	call Get2bpp
@@ -279,7 +279,7 @@
 	xor a
 	ld [rVBK], a
 	ld hl, LZ_1715a4
-	ld de, wd000
+	ld de, wDecompressBuffer
 	call Decompress
 	ld de, wBGPals1
 	ld hl, vTiles0
--- a/wram.asm
+++ b/wram.asm
@@ -1565,7 +1565,7 @@
 
 SECTION "WRAM 1", WRAMX
 
-wd000:: ds 1
+wDecompressBuffer:: ds 1
 
 DefaultSpawnpoint:: db
 
@@ -2887,7 +2887,8 @@
 w3_d000:: ds 1 ; d000
 w3_d001:: ds 1
 w3_d002:: ds $7e
-w3_d080:: ds $10
+w3_d080:: ds 1
+w3_d081:: ds $f
 w3_d090:: ds $70
 
 w3_d100::