ref: 956b990cd23bb821d665d56775e946ea07091690
parent: c0c081d60fa2e23fdfbd938994506ca63fd44780
author: yenatch <[email protected]>
date: Tue Feb 10 13:21:38 EST 2015
Fix a bunch of palette copying errors and wram bank conflicts. There are probably a bunch more labels with wrong banks. This takes care of the most noticeable ones.
--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -1428,13 +1428,13 @@
ld a, $5
ld [rSVBK], a
ld hl, BGPals
- ld de, wd000
+ ld de, Unkn1Pals
ld a, [rBGP]
ld b, a
ld c, $7
call CopyPals
ld hl, OBPals
- ld de, MartPointer
+ ld de, Unkn2Pals
ld a, [rBGP]
ld b, a
ld c, $2
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -8449,7 +8449,7 @@
push af
ld a, $6
ld [rSVBK], a
- ld hl, wd000
+ ld hl, w6_d000
ld bc, $400
ld a, $2
call ByteFill
@@ -8457,7 +8457,7 @@
push af
ld a, $1
ld [rVBK], a
- ld de, wd000
+ ld de, w6_d000
ld hl, VBGMap0
ld bc, $0f40
call Request2bpp
@@ -9329,11 +9329,11 @@
push af
ld a, $6
ld [rSVBK], a
- ld hl, wd000
+ ld hl, w6_d000
ld bc, $400
ld a, $7f
call ByteFill
- ld de, wd000
+ ld de, w6_d000
ld hl, VBGMap0
lb bc, BANK(Function3fbd6), $40
call Request2bpp
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -406,10 +406,10 @@
ld [rSVBK], a
ld a, [hli]
ld [Unkn1Pals], a
- ld [wd010], a
+ ld [Unkn1Pals + 8 * 2], a
ld a, [hl]
- ld [wd001], a
- ld [wd011], a
+ ld [Unkn1Pals + 1], a
+ ld [Unkn1Pals + 8 * 2 + 1], a
pop af
ld [rSVBK], a
call Function96a4
@@ -835,7 +835,7 @@
dec c
jr nz, .asm_9787
ld hl, Palettes_979c
- ld de, wd050
+ ld de, Unkn2Pals + 8 * 2
ld bc, $0010
ld a, $5
call FarCopyWRAM
@@ -2031,7 +2031,7 @@
inc hl
.asm_b26d
- ld de, wd032
+ ld de, Unkn1Pals + 8 * 6 + 2
ld bc, $0004
ld a, $5
call FarCopyWRAM
--- a/home.asm
+++ b/home.asm
@@ -218,7 +218,7 @@
ld a, 2
ld [rSVBK], a
ld hl, TileMap
- ld de, wd000
+ ld de, w2_d000
ld bc, TileMapEnd - TileMap
call CopyBytes
pop af
@@ -240,7 +240,7 @@
push af
ld a, 2
ld [rSVBK], a
- ld hl, wd000
+ ld hl, w2_d000
ld de, TileMap
ld bc, TileMapEnd - TileMap
call CopyBytes
@@ -2226,7 +2226,7 @@
; 3f88
Function3f88:: ; 3f88
- ld hl, wd000
+ ld hl, w6_d000
ld b, $0
.asm_3f8d
push bc
@@ -2247,7 +2247,7 @@
; 3f9f
Function3f9f:: ; 3f9f
- ld hl, wd000
+ ld hl, w6_d000
.asm_3fa2
push bc
ld c, $8
--- a/main.asm
+++ b/main.asm
@@ -5235,16 +5235,16 @@
ld a, $6
ld [rSVBK], a
ld a, $60
- ld hl, wd000
+ ld hl, w6_d000
ld bc, $400
call ByteFill
- ld a, $d0
+ ld a, w6_d000 / $100
ld [rHDMA1], a
- ld a, $0
+ ld a, w6_d000 % $100
ld [rHDMA2], a
- ld a, $18
+ ld a, ($9800 % $8000) / $100
ld [rHDMA3], a
- ld a, $0
+ ld a, ($9800 % $8000) % $100
ld [rHDMA4], a
ld a, $3f
ld [hDMATransfer], a
@@ -29508,7 +29508,7 @@
ld [rSVBK], a
ld a, $0
call GetSRAMBank
- ld de, Unkn1Pals
+ ld de, w6_d000
ld hl, $a000
ld a, [hROMBank]
ld b, a
@@ -57457,12 +57457,12 @@
push af
ld a, $6
ld [rSVBK], a
- ld hl, wd000
+ ld hl, w6_d000
ld bc, $400
ld a, $7f
call ByteFill
ld hl, VBGMap0
- ld de, wd000
+ ld de, w6_d000
ld b, $0
ld c, $40
call Request2bpp
@@ -60336,15 +60336,15 @@
ld a, $6
ld [rSVBK], a
ld a, b
- ld de, wd000 + $800
+ ld de, w6_d000 + $800
call FarDecompress
pop bc
- ld hl, wd000
- ld de, wd000 + $800
+ ld hl, w6_d000
+ ld de, w6_d000 + $800
call Function512ab
pop hl
push hl
- ld de, wd000
+ ld de, w6_d000
ld c, 7 * 7
ld a, [hROMBank]
ld b, a
@@ -60387,7 +60387,7 @@
ld a, $1
ld [rVBK], a
push hl
- ld de, wd000
+ ld de, w6_d000
ld c, 7 * 7
ld a, [hROMBank]
ld b, a
@@ -60401,15 +60401,15 @@
call GetFarWRAMByte
pop hl
and $f
- ld de, wd000 + $800 + 5 * 5 * $10
+ ld de, w6_d000 + $800 + 5 * 5 * $10
ld c, 5 * 5
cp 5
jr z, .asm_5113b
- ld de, wd000 + $800 + 6 * 6 * $10
+ ld de, w6_d000 + $800 + 6 * 6 * $10
ld c, 6 * 6
cp 6
jr z, .asm_5113b
- ld de, wd000 + $800 + 7 * 7 * $10
+ ld de, w6_d000 + $800 + 7 * 7 * $10
ld c, 7 * 7
.asm_5113b
@@ -60418,7 +60418,7 @@
call Function5114f
pop bc
pop hl
- ld de, wd000
+ ld de, w6_d000
ld a, [hROMBank]
ld b, a
call Get2bpp
@@ -60428,7 +60428,7 @@
; 5114f
Function5114f: ; 5114f
- ld hl, Unkn1Pals
+ ld hl, w6_d000
swap c
ld a, c
and $f
@@ -60487,14 +60487,14 @@
inc hl
ld a, d
call GetFarHalfword
- ld de, wd000
+ ld de, w6_d000
pop af
call FarDecompress
- ld hl, wd000
+ ld hl, w6_d000
ld c, 6 * 6
call Function5127c
pop hl
- ld de, wd000
+ ld de, w6_d000
ld a, [hROMBank]
ld b, a
call Get2bpp
@@ -60593,10 +60593,10 @@
ld a, BANK(TrainerPicPointers)
call GetFarHalfword
pop af
- ld de, wd000
+ ld de, w6_d000
call FarDecompress
pop hl
- ld de, wd000
+ ld de, w6_d000
ld c, 7 * 7
ld a, [hROMBank]
ld b, a
@@ -60622,10 +60622,10 @@
push de
push bc
ld a, b
- ld de, wd000
+ ld de, w6_d000
call FarDecompress
pop bc
- ld de, wd000
+ ld de, w6_d000
pop hl
ld a, [hROMBank]
ld b, a
@@ -73058,12 +73058,12 @@
push af
ld a, $5
ld [rSVBK], a
- ld hl, wd000
+ ld hl, Unkn1Pals
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
- ld hl, wd008
+ ld hl, Unkn1Pals + 8
ld c, $6
.asm_8c0d4
ld a, e
@@ -73408,7 +73408,7 @@
ld a, $6
ld [rSVBK], a
push hl
- ld hl, wd000
+ ld hl, w6_d000
ld bc, $28 * $10
.asm_8c2dd
ld [hl], $ff
@@ -73418,7 +73418,7 @@
or b
jr nz, .asm_8c2dd
pop hl
- ld de, wd000
+ ld de, w6_d000
ld b, BANK(Function8c2cf) ; BANK(@)
ld c, $28
call Request2bpp
@@ -96024,15 +96024,15 @@
ld a, $6
ld [rSVBK], a
ld hl, IntroLogoGFX
- ld de, wd000
+ ld de, w6_d000
ld a, BANK(IntroLogoGFX)
call FarDecompress
ld hl, VTiles0
- ld de, wd000
+ ld de, w6_d000
ld bc, $0180
call Request2bpp
ld hl, VTiles1
- ld de, wd000 + $800
+ ld de, w6_d000 + $800
ld bc, $0180
call Request2bpp
pop af
@@ -100501,7 +100501,7 @@
and a
ret nz
xor a
- ld [wd000 + $c18], a
+ ld [wdc18], a
call Functionfd044
ret nc
call Functionfd0c3
@@ -100521,7 +100521,7 @@
Functionfd017: ; fd017
call Functionfd0a6
call Functionfd0eb
- ld a, [wd000 + $c18]
+ ld a, [wdc18]
and a
jr nz, .asm_fd027
ld hl, wdc17
@@ -100594,7 +100594,7 @@
ld a, 5
call RandomRange
inc a
- ld [wd000 + $c18], a
+ ld [wdc18], a
scf
ret
; fd099
@@ -100678,7 +100678,7 @@
Functionfd117: ; fd117
- ld a, [wd000 + $c18]
+ ld a, [wdc18]
and a
jr z, .asm_fd123
dec a
@@ -108860,18 +108860,18 @@
Function104006: ; 104006
ld de, AttrMap
- ld hl, $d400
+ ld hl, w6_d000 + $400
call Function104263
- ld de, SpritesEnd
- ld hl, Unkn1Pals
+ ld de, TileMap
+ ld hl, w6_d000
call Function10425f
ld a, $0
ld [rVBK], a
- ld hl, Unkn1Pals
+ ld hl, w6_d000
call Function10419d
ld a, $1
ld [rVBK], a
- ld hl, $d400
+ ld hl, w6_d000 + $400
call Function10419d
ret
; 10402d
@@ -108883,11 +108883,11 @@
Function104033: ; 104033
ld de, TileMap
- ld hl, Unkn1Pals
+ ld hl, w6_d000
call Function10425f
ld a, $0
ld [rVBK], a ; $ff00+$4f
- ld hl, Unkn1Pals
+ ld hl, w6_d000
call Function10419d
ret
; 104047
@@ -108918,7 +108918,7 @@
ld hl, $d400
call Function104263
ld de, TileMap
- ld hl, Unkn1Pals
+ ld hl, w6_d000
call Function10425f
call DelayFrame
di
@@ -108930,7 +108930,7 @@
call Function1041ad
ld a, $0
ld [rVBK], a ; $ff00+$4f
- ld hl, Unkn1Pals
+ ld hl, w6_d000
call Function1041ad
pop af
ld [rVBK], a ; $ff00+$4f
@@ -108947,8 +108947,8 @@
ld de, AttrMap
ld hl, $d400
call Function104263
- ld de, SpritesEnd
- ld hl, Unkn1Pals
+ ld de, TileMap
+ ld hl, w6_d000
call Function10425f
call DelayFrame
di
@@ -108960,7 +108960,7 @@
call Function1041c1
ld a, $0
ld [rVBK], a
- ld hl, Unkn1Pals
+ ld hl, w6_d000
call Function1041c1
pop af
ld [rVBK], a
@@ -109018,7 +109018,7 @@
ld hl, $d400
call Function104263
ld de, TileMap
- ld hl, Unkn1Pals
+ ld hl, w6_d000
call Function10425f
call DelayFrame
di
@@ -109030,7 +109030,7 @@
call Function1041b7
ld a, $0
ld [rVBK], a ; $ff00+$4f
- ld hl, Unkn1Pals
+ ld hl, w6_d000
call Function1041b7
pop af
ld [rVBK], a ; $ff00+$4f
@@ -109048,8 +109048,8 @@
ld hl, $d400
call Function104263
ld c, $ff
- ld de, SpritesEnd
- ld hl, Unkn1Pals
+ ld de, TileMap
+ ld hl, w6_d000
call Function104265
ld a, $1
ld [rVBK], a
@@ -109057,7 +109057,7 @@
call Function1041ad
ld a, $0
ld [rVBK], a
- ld hl, Unkn1Pals
+ ld hl, w6_d000
call Function1041ad
ret
; 104177
@@ -109292,7 +109292,7 @@
ld c, l
ld h, d
ld l, e
- ld de, wd000
+ ld de, w6_d000
call FarCopyBytes
pop hl
pop bc
@@ -109301,7 +109301,7 @@
pop bc
ld d, h
ld e, l
- ld hl, wd000
+ ld hl, w6_d000
call Function104209
pop af
ld [rSVBK], a
@@ -109351,7 +109351,7 @@
ld b, h
ld h, d
ld l, e
- ld de, wd000
+ ld de, w6_d000
call Functiondef
pop hl
pop bc
@@ -109360,7 +109360,7 @@
pop bc
ld d, h
ld e, l
- ld hl, wd000
+ ld hl, w6_d000
call Function104209
pop af
ld [rSVBK], a
@@ -109373,22 +109373,22 @@
; 104309
Function104309:
- ld hl, Unkn1Pals
+ ld hl, w6_d000
ld de, TileMap
call Function10433a
- ld hl, BGPals
+ ld hl, w6_d000 + $80
ld de, AttrMap
call Function10433a
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld c, $8
- ld hl, BGPals
+ ld hl, w6_d000 + $80
ld de, $9c00
call Function104209
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld c, $8
- ld hl, Unkn1Pals
+ ld hl, w6_d000
ld de, $9c00
call Function104209
ret
@@ -112951,7 +112951,7 @@
jr asm_1064ed
asm_1064ed
- ld de, Unkn1Pals
+ ld de, w6_d000
ld b, $0
ld a, [rSVBK]
push af
@@ -121163,7 +121163,7 @@
ld a, $6
ld [rSVBK], a
ld hl, Unknown_117356
- ld de, wd000
+ ld de, w6_d000
ld bc, $0300
call CopyBytes
di
--- a/predef/cgb.asm
+++ b/predef/cgb.asm
@@ -166,7 +166,7 @@
ld hl, Palette_b309
.asm_8e93
- ld de, wd038
+ ld de, Unkn1Pals + 8 * 7
ld bc, $0008
ld a, $5
call FarCopyWRAM
@@ -225,7 +225,7 @@
ld hl, Palettes_a8ca
call Function9643
ld hl, Palette8f52
- ld de, wd018
+ ld de, Unkn1Pals + 8 * 3
ld bc, $0018
ld a, $5
call FarCopyWRAM