shithub: pokecrystal

Download patch

ref: 295604cbb51b0664c92f1a3a675ea7ffc3dc63ca
parent: 76819398a9a32aa5487624f0c7964ececbfe22a0
author: pikalaxalt <[email protected]>
date: Wed May 11 05:49:03 EDT 2016

Placeholder non-generic names for engine/color functions

--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -1800,8 +1800,10 @@
 ; e88bd
 
 Music_SlidePitchTo: ; e88bd
-; ????
+; set the target for pitch wheel
 ; params: 2
+; note duration
+; target note
 	call GetMusicByte
 	ld [wCurNoteDuration], a
 
@@ -1830,7 +1832,7 @@
 
 Music_Tone: ; e88e4
 ; tone
-; params: 2
+; params: 1 (dw)
 	ld hl, Channel1Flags2 - Channel1
 	add hl, bc
 	set SOUND_CRY_PITCH, [hl]
@@ -1859,9 +1861,8 @@
 ; e8906
 
 Music_SoundDuty: ; e8906
-; ???? + duty cycle
-; params: 1
-	;
+; sequence of 4 duty cycles to be looped
+; params: 1 (4 2-bit duty cycle arguments)
 	ld hl, Channel1Flags2 - Channel1
 	add hl, bc
 	set SOUND_DUTY, [hl] ; duty cycle
--- a/engine/battle_start.asm
+++ b/engine/battle_start.asm
@@ -84,7 +84,7 @@
 .NonMobile_LoadPokeballTiles: ; 8c2a0
 	call LoadTrainerBattlePokeballTiles
 	hlbgcoord 0, 0
-	call Function8c2cf
+	call ConvertTrainerBattlePokeballTilesTo2bpp
 	ret
 ; 8c2aa
 
@@ -113,7 +113,7 @@
 	ret
 ; 8c2cf
 
-Function8c2cf: ; 8c2cf
+ConvertTrainerBattlePokeballTilesTo2bpp: ; 8c2cf
 	ld a, [rSVBK]
 	push af
 	ld a, $6
@@ -132,7 +132,7 @@
 
 	pop hl
 	ld de, wDecompressScratch
-	ld b, BANK(Function8c2cf) ; BANK(@)
+	ld b, BANK(ConvertTrainerBattlePokeballTilesTo2bpp) ; BANK(@)
 	ld c, $28
 	call Request2bpp
 	pop af
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -79,6 +79,7 @@
 	ret
 
 Function8aa4:
+; XXX
 	push de
 	push bc
 	ld hl, PalPacket_9ce6
@@ -96,9 +97,9 @@
 	ld a, d
 	ld [wSGBPals + 6], a
 	ld hl, wSGBPals
-	call Function9809
+	call PushSGBPals_
 	ld hl, BlkPacket_9a86
-	call Function9809
+	call PushSGBPals_
 	ret
 
 InitPartyMenuPalettes:
@@ -176,9 +177,10 @@
 	and a
 	ret z
 	ld hl, BlkPacket_9a86
-	jp Function9809
+	jp PushSGBPals_
 
 Function8b4d:
+; XXX
 	call CheckCGB
 	jr nz, .cgb
 	ld a, [hSGB]
@@ -185,7 +187,7 @@
 	and a
 	ret z
 	ld hl, PalPacket_9c26
-	jp Function9809
+	jp PushSGBPals_
 
 .cgb
 	ld de, UnknOBPals
@@ -194,6 +196,7 @@
 	jp LoadHLPaletteIntoDE
 
 Function8b67:
+; XXX
 	call CheckCGB
 	jr nz, .cgb
 	ld a, [hSGB]
@@ -200,7 +203,7 @@
 	and a
 	ret z
 	ld hl, PalPacket_9c36
-	jp Function9809
+	jp PushSGBPals_
 
 .cgb
 	ld de, UnknOBPals
@@ -209,8 +212,9 @@
 	jp LoadHLPaletteIntoDE
 
 Function8b81:
+; XXX
 	call CheckCGB
-	jr nz, .asm_8bb2
+	jr nz, .cgb
 	ld a, [hSGB]
 	and a
 	ret z
@@ -231,9 +235,9 @@
 	ld a, [hl]
 	ld [wSGBPals + 6], a
 	ld hl, wSGBPals
-	jp Function9809
+	jp PushSGBPals_
 
-.asm_8bb2
+.cgb
 	ld de, UnknOBPals
 	ld a, c
 	call GetMonPalettePointer_
@@ -240,36 +244,36 @@
 	call LoadPalette_White_Col1_Col2_Black
 	ret
 
-Function8bbd:
+LoadTrainerClassPaletteAsNthBGPal:
 	ld a, [TrainerClass]
 	call GetTrainerPalettePointer
 	ld a, e
-	jr asm_8bd7
+	jr got_palette_pointer_8bd7
 
-Function8bc6:
+LoadMonPaletteAsNthBGPal:
 	ld a, [CurPartySpecies]
 	call GetMonPalettePointer
 	ld a, e
 	bit 7, a
-	jr z, .asm_8bd7
+	jr z, got_palette_pointer_8bd7
 	and $7f
-rept 4
 	inc hl
-endr
-.asm_8bd7
+	inc hl
+	inc hl
+	inc hl
 
-asm_8bd7
+got_palette_pointer_8bd7
 	push hl
 	ld hl, UnknBGPals
-	ld de, $8
-.asm_8bde
+	ld de, 1 palettes
+.loop
 	and a
-	jr z, .asm_8be5
+	jr z, .got_addr
 	add hl, de
 	dec a
-	jr .asm_8bde
+	jr .loop
 
-.asm_8be5
+.got_addr
 	ld e, l
 	ld d, h
 	pop hl
@@ -277,30 +281,31 @@
 	ret
 
 Function8bec:
+; XXX
 	ld a, [hCGB]
 	and a
-	jr nz, .asm_8bf7
+	jr nz, .cgb
 	ld hl, PlayerLightScreenCount
-	jp Function9809
+	jp PushSGBPals_
 
-.asm_8bf7
-	ld a, [EnemyLightScreenCount]
+.cgb
+	ld a, [EnemyLightScreenCount] ; col
 	ld c, a
-	ld a, [EnemyReflectCount]
+	ld a, [EnemyReflectCount] ; row
 	hlcoord 0, 0, AttrMap
-	ld de, $14
-.asm_8c04
+	ld de, SCREEN_WIDTH
+.loop
 	and a
-	jr z, .asm_8c0b
+	jr z, .done
 	add hl, de
 	dec a
-	jr .asm_8c04
+	jr .loop
 
-.asm_8c0b
+.done
 	ld b, $0
 	add hl, bc
 	lb bc, 6, 4
-	ld a, [EnemySafeguardCount]
+	ld a, [EnemySafeguardCount] ; value
 	and $3
 	call FillBoxCGB
 	call LoadEDTile
@@ -402,16 +407,16 @@
 	ld a, $1
 	ret
 
-Function8cb4:
+LoadMailPalettes:
 	ld l, e
 	ld h, 0
 	add hl, hl
 	add hl, hl
 	add hl, hl
-	ld de, Palettes_8d05
+	ld de, .MailPals
 	add hl, de
 	call CheckCGB
-	jr nz, .asm_8cf0
+	jr nz, .cgb
 	push hl
 	ld hl, PalPacket_9ce6
 	ld de, wSGBPals
@@ -429,12 +434,12 @@
 	ld a, [hli]
 	ld [wSGBPals + 6], a
 	ld hl, wSGBPals
-	call Function9809
+	call PushSGBPals_
 	ld hl, BlkPacket_9a86
-	call Function9809
+	call PushSGBPals_
 	ret
 
-.asm_8cf0
+.cgb
 	ld de, UnknBGPals
 	ld bc, 1 palettes
 	ld a, $5
@@ -444,7 +449,7 @@
 	call ApplyAttrMap
 	ret
 
-Palettes_8d05:
+.MailPals:
 	RGB 20, 31, 11
 	RGB 31, 19, 00
 	RGB 31, 10, 09
@@ -498,7 +503,8 @@
 INCLUDE "predef/cgb.asm"
 
 Function95f0:
-	ld hl, Palette_9608
+; XXX
+	ld hl, .Palette
 	ld de, UnknBGPals
 	ld bc, 8
 	ld a, $5
@@ -508,7 +514,7 @@
 	call ApplyAttrMap
 	ret
 
-Palette_9608:
+.Palette:
 	RGB 31, 31, 31
 	RGB 09, 31, 31
 	RGB 10, 12, 31
@@ -605,30 +611,36 @@
 	jr nz, .row
 	ret
 
-Function9673:
+ResetBGPals:
 	push af
 	push bc
 	push de
 	push hl
+
 	ld a, [rSVBK]
 	push af
 	ld a, $5
 	ld [rSVBK], a
+
 	ld hl, UnknBGPals
 	ld c, 8
 .loop
 	ld a, $ff
-rept 4
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
+	ld [hli], a
 	xor a
-rept 4
 	ld [hli], a
-endr
+	ld [hli], a
+	ld [hli], a
+	ld [hli], a
 	dec c
 	jr nz, .loop
+
 	pop af
 	ld [rSVBK], a
+
 	pop hl
 	pop de
 	pop bc
@@ -770,8 +782,8 @@
 GetTrainerPalettePointer:
 	ld l, a
 	ld h, 0
-	add hl,hl
-	add hl,hl
+	add hl, hl
+	add hl, hl
 	ld bc, TrainerPalettes
 	add hl, bc
 	ret
@@ -831,6 +843,7 @@
 	RGB 00, 00, 00
 
 Function97cc:
+; XXX
 	call CheckCGB
 	ret z
 	ld a, $90
@@ -837,13 +850,13 @@
 	ld [rOBPI], a
 	ld a, $1c
 	call GetPredefPal
-	call Function97e5
+	call .PushPalette
 	ld a, $21
 	call GetPredefPal
-	call Function97e5
+	call .PushPalette
 	ret
 
-Function97e5:
+.PushPalette:
 	ld c, 1 palettes
 .loop
 	ld a, [hli]
@@ -875,7 +888,7 @@
 endr
 	ret
 
-Function9809:
+PushSGBPals_:
 	ld a, [wcfbe]
 	push af
 	set 7, a
@@ -937,17 +950,17 @@
 	xor a
 	ld [rJOYP], a
 	ld [hSGB], a
-	call Function994a
+	call PushSGBBorderPalsAndWait
 	jr nc, .skip
 	ld a, $1
 	ld [hSGB], a
-	call Function98eb
-	call Function99b4
+	call _InitSGBBorderPals
+	call SGBBorder_PushBGPals
 	call SGBDelayCycles
-	call Function993f
-	call Function992c
+	call SGB_ClearVRAM
+	call PushSGBBorder
 	call SGBDelayCycles
-	call Function993f
+	call SGB_ClearVRAM
 	ld hl, PalPacket_9d66
 	call PushSGBPals
 
@@ -1012,7 +1025,7 @@
 	jr nz, .loop
 	ret
 
-Function98eb:
+_InitSGBBorderPals:
 	ld hl, .PalPacketPointerTable
 	ld c, 9
 .loop
@@ -1041,25 +1054,26 @@
 	dw PalPacket_9de6
 
 Function9911:
+; XXX
 	di
 	xor a
 	ld [rJOYP], a
 	ld hl, PalPacket_9d56
 	call PushSGBPals
-	call Function992c
+	call PushSGBBorder
 	call SGBDelayCycles
-	call Function993f
+	call SGB_ClearVRAM
 	ld hl, PalPacket_9d66
 	call PushSGBPals
 	ei
 	ret
 
-Function992c:
+PushSGBBorder:
 	call .LoadSGBBorderPointers
 	push de
-	call Function9a24
+	call SGBBorder_YetMorePalPushing
 	pop hl
-	call Function99d8
+	call SGBBorder_MorePalPushing
 	ret
 
 .LoadSGBBorderPointers:
@@ -1067,7 +1081,7 @@
 	ld de, SGBBorderMap
 	ret
 
-Function993f:
+SGB_ClearVRAM:
 	ld hl, VTiles0
 	ld bc, $2000
 	xor a
@@ -1074,7 +1088,7 @@
 	call ByteFill
 	ret
 
-Function994a:
+PushSGBBorderPalsAndWait:
 	ld hl, PalPacket_9d26
 	call PushSGBPals
 	call SGBDelayCycles
@@ -1081,7 +1095,7 @@
 	ld a, [rJOYP]
 	and $3
 	cp $3
-	jr nz, .asm_99a6
+	jr nz, .carry
 	ld a, $20
 	ld [rJOYP], a
 	ld a, [rJOYP]
@@ -1109,22 +1123,22 @@
 	ld a, [rJOYP]
 	and $3
 	cp $3
-	jr nz, .asm_99a6
-	call Function99ab
+	jr nz, .carry
+	call .FinalPush
 	and a
 	ret
 
-.asm_99a6
-	call Function99ab
+.carry
+	call .FinalPush
 	scf
 	ret
 
-Function99ab:
+.FinalPush:
 	ld hl, PalPacket_9d16
 	call PushSGBPals
 	jp SGBDelayCycles
 
-Function99b4:
+SGBBorder_PushBGPals:
 	call DisableLCD
 	ld a, %11100100
 	ld [rBGP], a
@@ -1141,7 +1155,7 @@
 	ld [rBGP], a
 	ret
 
-Function99d8:
+SGBBorder_MorePalPushing:
 	call DisableLCD
 	ld a, $e4
 	ld [rBGP], a
@@ -1149,7 +1163,7 @@
 	ld bc, 20 tiles
 	call CopyData
 	ld b, 18
-.asm_99ea
+.loop
 	push bc
 	ld bc, $c
 	call CopyData
@@ -1159,7 +1173,7 @@
 	call CopyData
 	pop bc
 	dec b
-	jr nz, .asm_99ea
+	jr nz, .loop
 	ld bc, $140
 	call CopyData
 	ld bc, Start
@@ -1175,13 +1189,13 @@
 	ld [rBGP], a
 	ret
 
-Function9a24:
+SGBBorder_YetMorePalPushing:
 	call DisableLCD
 	ld a, %11100100
 	ld [rBGP], a
 	ld de, VTiles1
 	ld b, $80
-.asm_9a30
+.loop
 	push bc
 	ld bc, 1 tiles
 	call CopyData
@@ -1189,7 +1203,7 @@
 	call ClearBytes
 	pop bc
 	dec b
-	jr nz, .asm_9a30
+	jr nz, .loop
 	call DrawDefaultTiles
 	ld a, $e3
 	ld [rLCDC], a
@@ -1734,34 +1748,34 @@
 	RGB 31, 31, 31
 
 SGBBorderMap:
-	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
+	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
 
 SGBBorderPalettes:
 	RGB 24, 06, 06
@@ -1946,9 +1960,9 @@
 	ld a, [MapGroup]
 	ld l, a
 	ld h, 0
-	add hl,hl
-	add hl,hl
-	add hl,hl
+	add hl, hl
+	add hl, hl
+	add hl, hl
 	ld de, RoofPals
 	add hl, de
 	ld a, [TimeOfDayPal]
--- a/engine/sprites.asm
+++ b/engine/sprites.asm
@@ -582,7 +582,7 @@
 	db SPRITE_ANIM_FRAMESET_25, SPRITE_ANIM_SEQ_NULL, $00 ; 1b headbutt
 	db SPRITE_ANIM_FRAMESET_20, SPRITE_ANIM_SEQ_13, $00 ; 1c
 	db SPRITE_ANIM_FRAMESET_26, SPRITE_ANIM_SEQ_1A, $00 ; 1d
-	db SPRITE_ANIM_FRAMESET_2D, SPRITE_ANIM_SEQ_NULL, $00 ; 1e
+	db SPRITE_ANIM_FRAMESET_2D, SPRITE_ANIM_SEQ_NULL, $00 ; 1e kris on map
 	db SPRITE_ANIM_FRAMESET_2E, SPRITE_ANIM_SEQ_NULL, $00 ; 1f kris on magnet train
 	db SPRITE_ANIM_FRAMESET_2F, SPRITE_ANIM_SEQ_NULL, $00 ; 20
 	db SPRITE_ANIM_FRAMESET_30, SPRITE_ANIM_SEQ_NULL, $00 ; 21
--- a/gfx/mail.asm
+++ b/gfx/mail.asm
@@ -37,7 +37,7 @@
 	call WaitBGMap
 	ld a, [Buffer3]
 	ld e, a
-	callba Function8cb4
+	callba LoadMailPalettes
 	call SetPalettes
 	xor a
 	ld [hJoyPressed], a
--- a/misc/mobile_5f.asm
+++ b/misc/mobile_5f.asm
@@ -1492,7 +1492,7 @@
 	ld [CurPartySpecies], a
 	ld a, [$c70c]
 	ld e, a
-	callba Function8bc6
+	callba LoadMonPaletteAsNthBGPal
 	call SetPalettes
 	ld a, [$c708]
 	ld l, a
@@ -1528,7 +1528,7 @@
 	ld [TrainerClass], a
 	ld a, [$c70b]
 	ld e, a
-	callba Function8bbd
+	callba LoadTrainerClassPaletteAsNthBGPal
 	call SetPalettes
 	ld a, [$c708]
 	ld e, a
--- a/predef/cgb.asm
+++ b/predef/cgb.asm
@@ -14,7 +14,7 @@
 .not_ram
 	cp SCGB_PARTY_MENU_HP_PALS
 	jp z, CGB_ApplyPartyMenuHPPals
-	call Function9673
+	call ResetBGPals
 	ld l, a
 	ld h, 0
 	add hl, hl
--- a/predef/crystal.asm
+++ b/predef/crystal.asm
@@ -5,7 +5,7 @@
 	ld a, [SGBPredef]
 .not_ram
 	push af
-	callba Function9673
+	callba ResetBGPals
 	pop af
 	ld l, a
 	ld h, 0
--- a/predef/sgb.asm
+++ b/predef/sgb.asm
@@ -65,7 +65,7 @@
 
 .SGB_BattleColors: ; 86b4
 	ld hl, BlkPacket_9aa6
-	call Function9809
+	call PushSGBPals_
 
 	ld hl, PalPacket_9ce6
 	ld de, wSGBPals
@@ -627,7 +627,7 @@
 
 .Finish: ; 8a60
 	push de
-	call Function9809
+	call PushSGBPals_
 	pop hl
-	jp Function9809
+	jp PushSGBPals_
 ; 8a68