shithub: pokecrystal

Download patch

ref: 38850df63d98b5a6eb816ca7b0c2b75c8d23cd61
parent: 83537048fbef1da0129e630aaafa242d8f47c0ce
author: yenatch <[email protected]>
date: Sat Mar 1 16:43:16 EST 2014

Lots of SGB incbins in bank 2.

Palette/block packets, border tilemap, more palettes etc.

--- a/engine/color.asm
+++ b/engine/color.asm
@@ -97,7 +97,7 @@
 	ld [$cdaf], a
 	ld hl, $cda9
 	call Function9809
-	ld hl, $5a86
+	ld hl, BlkPacket_9a86
 	call Function9809
 	ret
 ; 8ad1
@@ -180,7 +180,7 @@
 	ld a, [hSGB]
 	and a
 	ret z
-	ld hl, $5a86
+	ld hl, BlkPacket_9a86
 	jp Function9809
 ; 8b4d
 
@@ -361,7 +361,7 @@
 	ld h, $0
 	add hl, hl
 	add hl, hl
-	ld bc, $68be
+	ld bc, Palettes_a8be
 	add hl, bc
 	ld bc, $0004
 	ld a, $5
@@ -421,7 +421,7 @@
 	add hl, hl
 	add hl, hl
 	add hl, hl
-	ld de, Data8d05
+	ld de, Palettes_8d05
 	add hl, de
 	call CheckCGB
 	jr nz, .asm_8cf0
@@ -443,7 +443,7 @@
 	ld [$cdaf], a
 	ld hl, $cda9
 	call Function9809
-	ld hl, $5a86
+	ld hl, BlkPacket_9a86
 	call Function9809
 	ret
 
@@ -458,16 +458,81 @@
 	ret
 ; 8d05
 
-Data8d05: ; 8d05
-INCBIN "baserom.gbc", $8d05, $8d55 - $8d05
+Palettes_8d05: ; 8d05
+	RGB 20, 31, 11
+	RGB 31, 19, 00
+	RGB 31, 10, 09
+	RGB 00, 00, 00
+
+	RGB 15, 20, 31
+	RGB 30, 26, 00
+	RGB 31, 12, 00
+	RGB 00, 00, 00
+
+	RGB 24, 17, 31
+	RGB 30, 26, 00
+	RGB 08, 11, 31
+	RGB 00, 00, 00
+
+	RGB 31, 25, 17
+	RGB 31, 18, 04
+	RGB 28, 12, 05
+	RGB 00, 00, 00
+
+	RGB 19, 26, 31
+	RGB 31, 05, 08
+	RGB 31, 09, 31
+	RGB 00, 00, 00
+
+	RGB 31, 19, 28
+	RGB 31, 21, 00
+	RGB 12, 22, 00
+	RGB 00, 00, 00
+
+	RGB 19, 17, 23
+	RGB 30, 26, 00
+	RGB 31, 12, 00
+	RGB 00, 00, 00
+
+	RGB 07, 26, 31
+	RGB 26, 26, 27
+	RGB 31, 11, 11
+	RGB 00, 00, 00
+
+	RGB 21, 31, 21
+	RGB 30, 26, 00
+	RGB 31, 12, 00
+	RGB 00, 00, 00
+
+	RGB 07, 26, 31
+	RGB 31, 31, 00
+	RGB 00, 21, 00
+	RGB 00, 00, 00
 ; 8d55
 
 INCLUDE "predef/cgb.asm"
 
 
-INCBIN "baserom.gbc", $95f0, $9610 - $95f0
+Function95f0: ; 95f0
+	ld hl, Palette_9608
+	ld de, Unkn1Pals
+	ld bc, $0008
+	ld a, $5
+	call FarCopyWRAM
+	call Function96a4
+	call Function9699
+	call Function96b3
+	ret
+; 9608
 
+Palette_9608: ; 9608
+	RGB 31, 31, 31
+	RGB 09, 31, 31
+	RGB 10, 12, 31
+	RGB 00, 03, 19
+; 9610
 
+
 Function9610: ; 9610
 	ld de, $d000
 	ld c, $4
@@ -723,11 +788,11 @@
 	ld a, [PlayerGender]
 	and a
 	jr z, .asm_9760
-	ld hl, FalknerPalette
+	ld hl, KrisPalette
 	ret
 
 .asm_9760
-	ld hl, $70ce
+	ld hl, PlayerPalette
 	ret
 ; 9764
 
@@ -738,10 +803,10 @@
 
 Function976b: ; 976b
 	ld l, a
-	ld h, $0
+	ld h, 0
 	add hl, hl
 	add hl, hl
-	ld bc, $70ce
+	ld bc, TrainerPalettes
 	add hl, bc
 	ret
 ; 9775
@@ -751,8 +816,81 @@
 	ret
 ; 9779
 
-INCBIN "baserom.gbc", $9779, $97ee - $9779
+Function9779: ; 9779
+	ret
+; 977a
 
+Function977a: ; 977a
+	call CheckCGB
+	ret z
+	ld hl, Palettes_979c
+	ld a, $90
+	ld [rOBPI], a
+	ld c, $30
+.asm_9787
+	ld a, [hli]
+	ld [rOBPD], a
+	dec c
+	jr nz, .asm_9787
+	ld hl, Palettes_979c
+	ld de, $d050
+	ld bc, $0010
+	ld a, $5
+	call FarCopyWRAM
+	ret
+; 979c
+
+Palettes_979c: ; 979c
+	RGB 31, 31, 31
+	RGB 25, 25, 25
+	RGB 13, 13, 13
+	RGB 00, 00, 00
+	RGB 31, 31, 31
+	RGB 31, 31, 07
+	RGB 31, 16, 01
+	RGB 00, 00, 00
+	RGB 31, 31, 31
+	RGB 31, 19, 24
+	RGB 30, 10, 06
+	RGB 00, 00, 00
+	RGB 31, 31, 31
+	RGB 12, 25, 01
+	RGB 05, 14, 00
+	RGB 00, 00, 00
+	RGB 31, 31, 31
+	RGB 08, 12, 31
+	RGB 01, 04, 31
+	RGB 00, 00, 00
+	RGB 31, 31, 31
+	RGB 24, 18, 07
+	RGB 20, 15, 03
+	RGB 00, 00, 00
+; 97cc
+
+Function97cc: ; 97cc
+	call CheckCGB
+	ret z
+	ld a, $90
+	ld [rOBPI], a
+	ld a, $1c
+	call Function9625
+	call Function97e5
+	ld a, $21
+	call Function9625
+	call Function97e5
+	ret
+; 97e5
+
+Function97e5: ; 97e5
+	ld c, $8
+.asm_97e7
+	ld a, [hli]
+	ld [rOBPD], a
+	dec c
+	jr nz, .asm_97e7
+	ret
+; 97ee
+
 Function97ee: ; 97ee
 	ld l, a
 	ld h, $0
@@ -922,7 +1060,7 @@
 ; 98eb
 
 Function98eb: ; 98eb
-	ld hl, $58ff
+	ld hl, Unknown_98ff
 	ld c, $9
 .asm_98f0
 	push bc
@@ -939,8 +1077,33 @@
 	ret
 ; 98ff
 
-INCBIN "baserom.gbc", $98ff, $992c - $98ff
+Unknown_98ff: ; 98ff
+	dw $5d56
+	dw $5d76
+	dw $5d86
+	dw $5d96
+	dw $5da6
+	dw $5db6
+	dw $5dc6
+	dw $5dd6
+	dw $5de6
+; 9911
 
+Function9911: ; 9911
+	di
+	xor a
+	ld [rJOYP], a
+	ld hl, $5d56
+	call Function981a
+	call Function992c
+	call Function9a7a
+	call Function993f
+	ld hl, $5d66
+	call Function981a
+	ei
+	ret
+; 992c
+
 Function992c: ; 992c
 	call Function9938
 	push de
@@ -952,7 +1115,7 @@
 
 Function9938: ; 9938
 	ld hl, SGBBorder
-	ld de, $606e
+	ld de, SGBBorderMap
 	ret
 ; 993f
 
@@ -1154,20 +1317,550 @@
 	ret
 ; 9a86
 
-INCBIN "baserom.gbc", $9a86, $a51e - $9a86
+BlkPacket_9a86: ; 9a86
+	db $21, $01, $03, $00, $00, $00, $13, $11, $00, $00, $00, $00, $00, $00, $00, $00
 
-SGBBorder:
+BlkPacket_9a96: ; 9a96
+	db $21, $01, $07, $05, $00, $0a, $13, $0d, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9aa6: ; 9a86
+	db $22, $05, $07, $0a, $00, $0c, $13, $11, $03, $05, $01, $00, $0a, $03, $03, $00
+	db $0a, $08, $13, $0a, $03, $0a, $00, $04, $08, $0b, $03, $0f, $0b, $00, $13, $07
+
+BlkPacket_9ac6: ; 9a86
+	db $21, $01, $07, $05, $00, $01, $07, $07, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9ad6: ; 9a86
+	db $21, $01, $07, $05, $0b, $01, $13, $02, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9ae6: ; 9a86
+	db $21, $01, $07, $05, $01, $01, $08, $08, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9af6: ; 9a86
+	db $21, $01, $07, $05, $07, $05, $0d, $0b, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9b06: ; 9a86
+	db $22, $05, $03, $05, $00, $00, $13, $0b, $03, $0a, $00, $04, $13, $09, $02, $0f
+	db $00, $06, $13, $07, $03, $00, $04, $04, $0f, $09, $03, $00, $00, $0c, $13, $11
+
+BlkPacket_9b26: ; 9a86
+	db $23, $07, $07, $10, $00, $00, $02, $0c, $02, $00, $0c, $00, $12, $01, $02, $00
+	db $0c, $02, $12, $03, $02, $00, $0c, $04, $12, $05, $02, $00, $0c, $06, $12, $07
+	db $02, $00, $0c, $08, $12, $09, $02, $00, $0c, $0a, $12, $0b, $00, $00, $00, $00
+
+BlkPacket_9b56: ; 9a86
+	db $22, $03, $07, $20, $00, $00, $13, $04, $03, $0f, $00, $06, $13, $11, $03, $05
+	db $0f, $01, $12, $04, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9b76: ; 9a86
+	db $21, $01, $07, $10, $00, $00, $13, $05, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9b86: ; 9a86
+	db $21, $02, $07, $0a, $00, $04, $13, $0d, $03, $05, $00, $06, $13, $0b, $00, $00
+; 9b96
+
+; 9b96
+PalPacket_9b96:	db $51, $48, $00, $49, $00, $4a, $00, $4b, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9ba6:	db $51, $2b, $00, $24, $00, $20, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9bb6:	db $51, $41, $00, $42, $00, $43, $00, $44, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9bc6:	db $51, $4c, $00, $4c, $00, $4c, $00, $4c, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9bd6:	db $51, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9be6:	db $51, $36, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9bf6:	db $51, $37, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9c06:	db $51, $38, $00, $39, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9c16:	db $51, $3a, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9c26:	db $51, $3b, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9c36:	db $51, $3c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9c46:	db $51, $39, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9c56:	db $51, $2e, $00, $2f, $00, $30, $00, $31, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9c66:	db $51, $1a, $00, $1a, $00, $1a, $00, $1a, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9c76:	db $51, $32, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9c86:	db $51, $3c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9c96:	db $51, $3d, $00, $3e, $00, $3f, $00, $40, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9ca6:	db $51, $33, $00, $34, $00, $1b, $00, $1f, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9cb6:	db $51, $1b, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9cc6:	db $51, $1c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9cd6:	db $51, $35, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9ce6:	db $01, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9cf6:	db $09, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9d06:	db $59, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9d16:	db $89, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9d26:	db $89, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9d36:	db $99, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9d46:	db $a1, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9d56:	db $b9, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9d66:	db $b9, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9d76:	db $79, $5d, $08, $00, $0b, $8c, $d0, $f4, $60, $00, $00, $00, $00, $00, $00, $00
+PalPacket_9d86:	db $79, $52, $08, $00, $0b, $a9, $e7, $9f, $01, $c0, $7e, $e8, $e8, $e8, $e8, $e0
+PalPacket_9d96:	db $79, $47, $08, $00, $0b, $c4, $d0, $16, $a5, $cb, $c9, $05, $d0, $10, $a2, $28
+PalPacket_9da6:	db $79, $3c, $08, $00, $0b, $f0, $12, $a5, $c9, $c9, $c8, $d0, $1c, $a5, $ca, $c9
+PalPacket_9db6:	db $79, $31, $08, $00, $0b, $0c, $a5, $ca, $c9, $7e, $d0, $06, $a5, $cb, $c9, $7e
+PalPacket_9dc6:	db $79, $26, $08, $00, $0b, $39, $cd, $48, $0c, $d0, $34, $a5, $c9, $c9, $80, $d0
+PalPacket_9dd6:	db $79, $1b, $08, $00, $0b, $ea, $ea, $ea, $ea, $ea, $a9, $01, $cd, $4f, $0c, $d0
+PalPacket_9de6:	db $79, $10, $08, $00, $0b, $4c, $20, $08, $ea, $ea, $ea, $ea, $ea, $60, $ea, $ea
+; 9df6
+
+Palettes_9df6: ; 9df6
+	RGB 31, 31, 31
+	RGB 22, 25, 19
+	RGB 16, 21, 30
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 27, 28, 31
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 24, 28, 19
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 24, 24, 24
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 21, 23, 31
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 24, 21, 27
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 24, 16
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 25, 30, 26
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 25, 31
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 20, 19
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 26, 19
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 27, 28, 27
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 24, 30, 23
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 29, 24, 29
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 26, 23, 29
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 25, 23, 20
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 29, 26, 18
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 21, 18
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 26, 25, 31
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 22, 21, 31
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 22, 25, 21
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 21, 21, 22
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 20, 20
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 26, 26, 26
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 21, 14, 09
+	RGB 15, 20, 20
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 12, 28, 22
+	RGB 15, 20, 20
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 07, 07, 07
+	RGB 02, 03, 03
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 30, 22, 17
+	RGB 16, 14, 19
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 18, 20, 27
+	RGB 11, 15, 23
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 20, 10
+	RGB 26, 10, 06
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 21, 25, 29
+	RGB 14, 19, 25
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 27, 22, 24
+	RGB 21, 15, 23
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 28, 20, 15
+	RGB 21, 14, 09
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 20, 26, 16
+	RGB 09, 20, 11
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 30, 22, 24
+	RGB 28, 15, 21
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 28, 14
+	RGB 26, 20, 00
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 26, 21, 22
+	RGB 15, 15, 18
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 23, 19, 13
+	RGB 14, 12, 17
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 16, 18, 21
+	RGB 10, 12, 18
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 22, 15, 16
+	RGB 17, 02, 05
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 15, 20, 20
+	RGB 05, 16, 16
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 23, 15, 19
+	RGB 14, 04, 12
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 20, 17, 18
+	RGB 18, 13, 11
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 23, 21, 16
+	RGB 12, 12, 10
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 21, 25, 29
+	RGB 30, 22, 24
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 26, 23, 16
+	RGB 29, 14, 09
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 18, 18, 18
+	RGB 10, 10, 10
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 30, 26, 15
+	RGB 00, 23, 00
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 30, 26, 15
+	RGB 31, 23, 00
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 30, 26, 15
+	RGB 31, 00, 00
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 29, 26, 19
+	RGB 27, 20, 14
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 24, 20, 10
+	RGB 21, 00, 04
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 20, 10
+	RGB 21, 00, 04
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 30, 26, 16
+	RGB 16, 12, 09
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 15, 28, 26
+	RGB 12, 22, 26
+	RGB 03, 16, 14
+
+	RGB 31, 31, 31
+	RGB 15, 28, 26
+	RGB 23, 24, 24
+	RGB 00, 00, 00
+
+	RGB 31, 31, 24
+	RGB 07, 27, 19
+	RGB 26, 20, 10
+	RGB 19, 12, 08
+
+	RGB 31, 31, 31
+	RGB 31, 28, 14
+	RGB 31, 13, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 16, 18, 21
+	RGB 10, 12, 18
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 23, 21, 16
+	RGB 12, 12, 10
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 14, 00
+	RGB 07, 11, 15
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 26, 21, 22
+	RGB 26, 10, 06
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 30, 27, 04
+	RGB 24, 20, 11
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 13, 25
+	RGB 24, 20, 11
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 16, 19, 29
+	RGB 24, 20, 11
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 30, 22, 24
+	RGB 18, 18, 18
+	RGB 16, 10, 07
+
+	RGB 31, 31, 31
+	RGB 21, 25, 29
+	RGB 18, 18, 18
+	RGB 16, 10, 07
+
+	RGB 31, 31, 31
+	RGB 20, 26, 16
+	RGB 18, 18, 18
+	RGB 16, 10, 07
+
+	RGB 31, 31, 31
+	RGB 31, 28, 14
+	RGB 18, 18, 18
+	RGB 16, 10, 07
+
+	RGB 31, 31, 31
+	RGB 18, 18, 18
+	RGB 26, 10, 06
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 30, 22, 24
+	RGB 28, 15, 21
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 26, 20, 00
+	RGB 16, 19, 29
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 16, 02, 30
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 16, 13, 04
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 28, 04, 02
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 18, 23, 31
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 24, 20, 11
+	RGB 18, 13, 11
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 31, 31
+	RGB 25, 30, 00
+	RGB 25, 30, 00
+
+	RGB 00, 00, 00
+	RGB 08, 11, 11
+	RGB 21, 21, 21
+	RGB 31, 31, 31
+; a06e
+
+SGBBorderMap: ; a06e
+	db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $14,$14, $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54, $14,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
+	db $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54, $24,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$54, $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54
+	db $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54, $10,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $34,$14, $35,$14, $35,$54, $34,$54, $33,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $10,$14, $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54
+	db $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54, $20,$54, $07,$14, $08,$14, $09,$14, $0a,$14, $0b,$14, $0c,$14, $0d,$14, $07,$14, $07,$14, $18,$14, $09,$14, $1a,$14, $1b,$14, $0d,$14, $0c,$14, $1c,$14, $29,$14, $07,$14, $20,$14, $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54
+	db $31,$14, $32,$14, $07,$14, $07,$14, $32,$54, $36,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $38,$10, $27,$10, $32,$14, $07,$54, $07,$54, $32,$54, $31,$54
+	db $05,$14, $06,$14, $07,$14, $07,$54, $06,$54, $1f,$10,                                                                                                                                                                                     $37,$10, $06,$14, $07,$14, $07,$54, $06,$54, $05,$54
+	db $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $1f,$10,                                                                                                                                                                                     $37,$10, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54
+	db $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $1f,$10,                                                                                                                                                                                     $37,$10, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54
+	db $33,$14, $34,$14, $35,$14, $35,$54, $34,$54, $1f,$10,                                                                                                                                                                                     $37,$10, $34,$14, $35,$14, $35,$54, $34,$54, $33,$54
+	db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $1f,$10,                                                                                                                                                                                     $37,$10, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
+	db $02,$54, $01,$54, $07,$54, $07,$14, $07,$14, $1f,$10,                                                                                                                                                                                     $37,$10, $07,$14, $07,$14, $07,$14, $01,$14, $02,$14
+	db $12,$54, $11,$54, $10,$54, $07,$14, $07,$14, $1f,$10,                                                                                                                                                                                     $37,$10, $07,$14, $07,$14, $10,$14, $11,$14, $12,$14
+	db $22,$54, $21,$54, $20,$54, $07,$14, $07,$14, $1f,$10,                                                                                                                                                                                     $37,$10, $07,$14, $07,$14, $20,$14, $21,$14, $22,$14
+	db $32,$54, $31,$54, $30,$54, $07,$14, $07,$14, $1f,$10,                                                                                                                                                                                     $37,$10, $07,$14, $07,$14, $30,$14, $31,$14, $32,$14
+	db $06,$54, $05,$54, $04,$54, $07,$14, $07,$14, $1f,$10,                                                                                                                                                                                     $37,$10, $07,$14, $07,$14, $04,$14, $05,$14, $06,$14
+	db $16,$54, $15,$54, $14,$54, $07,$14, $07,$14, $1f,$10,                                                                                                                                                                                     $37,$10, $07,$14, $07,$14, $14,$14, $15,$14, $16,$14
+	db $26,$54, $25,$54, $24,$54, $07,$14, $07,$14, $1f,$10,                                                                                                                                                                                     $37,$10, $07,$14, $07,$14, $24,$14, $25,$14, $26,$14
+	db $34,$54, $33,$54, $07,$54, $07,$14, $07,$14, $1f,$10,                                                                                                                                                                                     $37,$10, $07,$14, $07,$14, $07,$14, $33,$14, $34,$14
+	db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $1f,$10,                                                                                                                                                                                     $37,$10, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
+	db $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $1f,$10,                                                                                                                                                                                     $37,$10, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54
+	db $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $1f,$10,                                                                                                                                                                                     $37,$10, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54
+	db $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $1f,$10,                                                                                                                                                                                     $37,$10, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54
+	db $31,$14, $32,$14, $07,$14, $07,$14, $32,$54, $1f,$10,                                                                                                                                                                                     $37,$10, $32,$14, $07,$54, $07,$54, $32,$54, $31,$54
+	db $05,$14, $06,$14, $07,$14, $07,$54, $06,$54, $2e,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2f,$10, $2d,$10, $06,$14, $07,$14, $07,$54, $06,$54, $05,$54
+	db $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54, $14,$54, $07,$14, $07,$14, $39,$14, $0e,$14, $09,$14, $0f,$14, $28,$14, $07,$14, $19,$14, $0c,$14, $1c,$14, $29,$14, $2a,$14, $2b,$14, $2c,$14, $39,$14, $07,$14, $07,$14, $14,$14, $15,$14, $16,$14, $17,$14, $17,$54, $16,$54, $15,$54
+	db $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54, $24,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $01,$14, $02,$14, $03,$14, $03,$54, $02,$54, $01,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $25,$14, $26,$14, $07,$14, $07,$54, $26,$54, $25,$54
+	db $33,$14, $34,$14, $35,$14, $35,$54, $34,$54, $24,$54, $07,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $10,$14, $11,$14, $12,$14, $13,$14, $13,$54, $12,$54, $11,$54, $10,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $24,$14, $34,$14, $35,$14, $35,$54, $34,$54, $33,$54
+	db $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $20,$14, $21,$14, $22,$14, $23,$14, $23,$54, $22,$54, $21,$54, $20,$54, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14, $07,$14
+; a49e
+
+INCBIN "baserom.gbc", $a49e, $a51e - $a49e
+
+SGBBorder: ; a51e
 INCBIN "gfx/misc/sgb_border.2bpp"
+; a8be
 
-INCBIN "baserom.gbc", $a8be, $a8d6 - $a8be
+Palettes_a8be: ; a8be
+	RGB 30, 26, 15
+	RGB 00, 23, 00
 
-PokemonPalettes:
-INCLUDE "gfx/pics/palette_pointers.asm"
+	RGB 30, 26, 15
+	RGB 31, 21, 00
 
-INCBIN "baserom.gbc", $b0ae, $b0d2 - $b0ae
+	RGB 30, 26, 15
+	RGB 31, 00, 00
 
-TrainerPalettes:
+	RGB 30, 26, 15
+	RGB 04, 17, 31
+
+	RGB 30, 22, 17
+	RGB 16, 14, 19
+
+	RGB 30, 22, 17
+	RGB 16, 14, 19
+; a8d6
+
+; a8d6
+INCLUDE "gfx/pics/palette_pointers.asm"
+; b0ce
+
+; b0ce
 INCLUDE "gfx/trainers/palette_pointers.asm"
+; b1de
 
 Functionb1de: ; b1de
 	callba Function494ac
--- a/gfx/pics/palette_pointers.asm
+++ b/gfx/pics/palette_pointers.asm
@@ -1,3 +1,5 @@
+PokemonPalettes: ; a8d6
+
 BulbasaurPalette:       INCLUDE "gfx/pics/001/normal.pal"
 BulbasaurShinyPalette:  INCLUDE "gfx/pics/001/shiny.pal"
 IvysaurPalette:         INCLUDE "gfx/pics/002/normal.pal"
@@ -500,3 +502,34 @@
 HoOhShinyPalette:       INCLUDE "gfx/pics/250/shiny.pal"
 CelebiPalette:          INCLUDE "gfx/pics/251/normal.pal"
 CelebiShinyPalette:     INCLUDE "gfx/pics/251/shiny.pal"
+
+; 252
+	RGB 30, 26, 11
+	RGB 23, 16, 00
+; 252 shiny
+	RGB 30, 26, 11
+	RGB 23, 16, 00
+
+; Egg
+	RGB 30, 26, 11
+	RGB 23, 16, 00
+; Egg shiny
+	RGB 30, 26, 11
+	RGB 23, 16, 00
+
+; 254
+	RGB 30, 26, 11
+	RGB 23, 16, 00
+; 254 shiny
+	RGB 30, 26, 11
+	RGB 23, 16, 00
+
+; 255
+	RGB 23, 23, 23
+	RGB 17, 17, 17
+; 255 shiny
+	RGB 23, 23, 23
+	RGB 17, 17, 17
+
+; b0ce
+
--- a/gfx/trainers/palette_pointers.asm
+++ b/gfx/trainers/palette_pointers.asm
@@ -1,3 +1,16 @@
+
+TrainerPalettes: ; b0ce
+
+PlayerPalette: ; b0ce
+; The player's palette
+	RGB 25, 18, 12
+	RGB 22, 09, 05
+
+KrisPalette: ; b0d0
+; Apparently Kris uses Falkner's palette
+;	RGB 27, 17, 14
+;	RGB 07, 05, 31
+
 FalknerPalette:      INCLUDE "gfx/trainers/000.pal"
 WhitneyPalette:      INCLUDE "gfx/trainers/001.pal"
 BugsyPalette:        INCLUDE "gfx/trainers/002.pal"
@@ -65,3 +78,5 @@
 OfficerPalette:      INCLUDE "gfx/trainers/064.pal"
 GruntfPalette:       INCLUDE "gfx/trainers/065.pal"
 MysticalmanPalette:  INCLUDE "gfx/trainers/066.pal"
+; b1de
+
--- a/predef/sgb.asm
+++ b/predef/sgb.asm
@@ -59,7 +59,7 @@
 ; 86ad
 
 Function86ad: ; 86ad
-	ld hl, $5c66
+	ld hl, PalPacket_9c66
 	ld de, $5aa6
 	ret
 ; 86b4
@@ -67,7 +67,7 @@
 Function86b4: ; 86b4
 	ld hl, $5aa6
 	call Function9809
-	ld hl, $5ce6
+	ld hl, PalPacket_9ce6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -101,7 +101,7 @@
 	ld [$cdb4], a
 	ld a, [hl]
 	ld [$cdb5], a
-	ld hl, $5cf6
+	ld hl, PalPacket_9cf6
 	ld de, $cdb9
 	ld bc, $0010
 	call CopyBytes
@@ -131,7 +131,7 @@
 ; 873c
 
 Function873c: ; 873c
-	ld hl, $5bd6
+	ld hl, PalPacket_9bd6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -148,13 +148,13 @@
 ; 875c
 
 Function875c: ; 875c
-	ld hl, $5c76
-	ld de, $5a86
+	ld hl, PalPacket_9c76
+	ld de, BlkPacket_9a86
 	ret
 ; 8763
 
 Function8763: ; 8763
-	ld hl, $5ce6
+	ld hl, PalPacket_9ce6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -190,13 +190,13 @@
 ; 87ab
 
 Function87ab: ; 87ab
-	ld hl, $5c56
+	ld hl, PalPacket_9c56
 	ld de, $cdaa
 	ret
 ; 87b2
 
 Function87b2: ; 87b2
-	ld hl, $5ce6
+	ld hl, PalPacket_9ce6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -224,7 +224,7 @@
 ; 87e9
 
 Function87e9: ; 87e9
-	ld hl, $5ce6
+	ld hl, PalPacket_9ce6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -259,7 +259,7 @@
 ; 882a
 
 Function882a: ; 882a
-	ld hl, $5ce6
+	ld hl, PalPacket_9ce6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -272,31 +272,31 @@
 	inc hl
 	ld [hl], $19
 	ld hl, $cda9
-	ld de, $5a86
+	ld de, BlkPacket_9a86
 	ret
 ; 884b
 
 Function884b: ; 884b
-	ld hl, $5c36
-	ld de, $5a86
+	ld hl, PalPacket_9c36
+	ld de, BlkPacket_9a86
 	ret
 ; 8852
 
 Function8852: ; 8852
-	ld hl, $5c96
+	ld hl, PalPacket_9c96
 	ld de, $5b06
 	ret
 ; 8859
 
 Function8859: ; 8859
-	ld hl, $5ca6
+	ld hl, PalPacket_9ca6
 	ld de, $5b76
 	ret
 ; 8860
 
 Function8860: ; 8860
-	ld hl, $5cb6
-	ld de, $5a86
+	ld hl, PalPacket_9cb6
+	ld de, BlkPacket_9a86
 	ret
 ; 8867
 
@@ -320,7 +320,7 @@
 INCBIN "baserom.gbc", $8878, $8884 - $8878
 
 Function8884: ; 8884
-	ld hl, $5b96
+	ld hl, PalPacket_9b96
 	ld de, $5b56
 	ld a, $8
 	ld [SGBPredef], a
@@ -328,29 +328,29 @@
 ; 8890
 
 Function8890: ; 8890
-	ld hl, $5ba6
+	ld hl, PalPacket_9ba6
 	ld de, $5b86
 	ret
 ; 8897
 
 Function8897: ; 8897
-	ld hl, $5c46
-	ld de, $5a86
+	ld hl, PalPacket_9c46
+	ld de, BlkPacket_9a86
 	ret
 ; 889e
 
 Function889e: ; 889e
-	ld hl, $5a86
+	ld hl, BlkPacket_9a86
 	ld de, PlayerLightScreenCount
 	ld bc, $0010
 	call CopyBytes
-	ld hl, $5bb6
-	ld de, $5a86
+	ld hl, PalPacket_9bb6
+	ld de, BlkPacket_9a86
 	ret
 ; 88b1
 
 Function88b1: ; 88b1
-	ld hl, $5bd6
+	ld hl, PalPacket_9bd6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -357,7 +357,7 @@
 	call Function8a0c
 	ld hl, $cdaa
 	ld [hld], a
-	ld de, $5a86
+	ld de, BlkPacket_9a86
 	ld a, $9
 	ld [SGBPredef], a
 	ret
@@ -365,7 +365,7 @@
 
 Function88cd: ; 88cd
 	push bc
-	ld hl, $5ce6
+	ld hl, PalPacket_9ce6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -403,28 +403,28 @@
 
 .asm_8913
 	ld hl, $cda9
-	ld de, $5a86
+	ld de, BlkPacket_9a86
 	ret
 ; 891a
 
 Function891a: ; 891a
-	ld hl, $5cb6
-	ld de, $5a86
+	ld hl, PalPacket_9cb6
+	ld de, BlkPacket_9a86
 	ret
 ; 8921
 
 Function8921: ; 8921
-	ld hl, $5bc6
-	ld de, $5a86
+	ld hl, PalPacket_9bc6
+	ld de, BlkPacket_9a86
 	ret
 ; 8928
 
 Function8928: ; 8928
-	ld hl, $5bd6
+	ld hl, PalPacket_9bd6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
-	ld hl, $5a86
+	ld hl, BlkPacket_9a86
 	ld de, $cdb9
 	ld bc, $0010
 	call CopyBytes
@@ -450,7 +450,7 @@
 ; 8969
 
 Function8969: ; 8969
-	ld hl, $5ce6
+	ld hl, PalPacket_9ce6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -478,18 +478,18 @@
 	ld a, [hl]
 	ld [$cdaf], a
 	ld hl, $cda9
-	ld de, $5a86
+	ld de, BlkPacket_9a86
 	ret
 ; 89a6
 
 Function89a6: ; 89a6
-	ld hl, $5cd6
-	ld de, $5a86
+	ld hl, PalPacket_9cd6
+	ld de, BlkPacket_9a86
 	ret
 ; 89ad
 
 Function89ad: ; 89ad
-	ld hl, $5ce6
+	ld hl, PalPacket_9ce6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -505,18 +505,18 @@
 	ld a, [hl]
 	ld [$cdaf], a
 	ld hl, $cda9
-	ld de, $5a86
+	ld de, BlkPacket_9a86
 	ret
 ; 89d9
 
 Function89d9: ; 89d9
-	ld hl, $5cc6
-	ld de, $5a86
+	ld hl, PalPacket_9cc6
+	ld de, BlkPacket_9a86
 	ret
 ; 89e0
 
 Function89e0: ; 89e0
-	ld hl, $5ce6
+	ld hl, PalPacket_9ce6
 	ld de, $cda9
 	ld bc, $0010
 	call CopyBytes
@@ -532,7 +532,7 @@
 	ld a, [hl]
 	ld [$cdaf], a
 	ld hl, $cda9
-	ld de, $5a86
+	ld de, BlkPacket_9a86
 	ret
 ; 8a0c