shithub: pokecrystal

Download patch

ref: d3cc861d334c8b773c1b6c662ed9924c43cef009
parent: 81fff9bb80af3db0ee381c824261b8963e1cc221
author: mid-kid <[email protected]>
date: Wed Apr 4 18:26:07 EDT 2018

Fix snake_case filenames

Renamed a bunch of files, most of them one-off functions, to better fit
the general snake_case naming scheme. Also renamed some awfully long filenames.

--- /dev/null
+++ b/engine/battle/check_battle_scene.asm
@@ -1,0 +1,47 @@
+CheckBattleScene: ; 4ea44
+; Return carry if battle scene is turned off.
+
+	ld a, BANK(wLinkMode)
+	ld hl, wLinkMode
+	call GetFarWRAMByte
+	cp LINK_MOBILE
+	jr z, .mobile
+
+	ld a, [wOptions]
+	bit BATTLE_SCENE, a
+	jr nz, .off
+
+	and a
+	ret
+
+.mobile
+	ld a, [wcd2f]
+	and a
+	jr nz, .from_wram
+
+	ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
+	call GetSRAMBank
+	ld a, [$a60c] ; address of MBC30 bank
+	ld c, a
+	call CloseSRAM
+
+	ld a, c
+	bit 0, c
+	jr z, .off
+
+	and a
+	ret
+
+.from_wram
+	ld a, BANK(w5_dc00)
+	ld hl, w5_dc00
+	call GetFarWRAMByte
+	bit 0, a
+	jr z, .off
+
+	and a
+	ret
+
+.off
+	scf
+	ret
--- a/engine/battle/checkbattlescene.asm
+++ /dev/null
@@ -1,47 +1,0 @@
-CheckBattleScene: ; 4ea44
-; Return carry if battle scene is turned off.
-
-	ld a, BANK(wLinkMode)
-	ld hl, wLinkMode
-	call GetFarWRAMByte
-	cp LINK_MOBILE
-	jr z, .mobile
-
-	ld a, [wOptions]
-	bit BATTLE_SCENE, a
-	jr nz, .off
-
-	and a
-	ret
-
-.mobile
-	ld a, [wcd2f]
-	and a
-	jr nz, .from_wram
-
-	ld a, 4 ; MBC30 bank used by JP Crystal; inaccessible by MBC3
-	call GetSRAMBank
-	ld a, [$a60c] ; address of MBC30 bank
-	ld c, a
-	call CloseSRAM
-
-	ld a, c
-	bit 0, c
-	jr z, .off
-
-	and a
-	ret
-
-.from_wram
-	ld a, BANK(w5_dc00)
-	ld hl, w5_dc00
-	call GetFarWRAMByte
-	bit 0, a
-	jr z, .off
-
-	and a
-	ret
-
-.off
-	scf
-	ret
--- /dev/null
+++ b/engine/battle/consume_held_item.asm
@@ -1,0 +1,57 @@
+ConsumeHeldItem: ; 27192
+	push hl
+	push de
+	push bc
+	ld a, [hBattleTurn]
+	and a
+	ld hl, wOTPartyMon1Item
+	ld de, wEnemyMonItem
+	ld a, [wCurOTMon]
+	jr z, .theirturn
+	ld hl, wPartyMon1Item
+	ld de, wBattleMonItem
+	ld a, [wCurBattleMon]
+
+.theirturn
+	push hl
+	push af
+	ld a, [de]
+	ld b, a
+	farcall GetItemHeldEffect
+	ld hl, ConsumableEffects
+.loop
+	ld a, [hli]
+	cp b
+	jr z, .ok
+	inc a
+	jr nz, .loop
+	pop af
+	pop hl
+	pop bc
+	pop de
+	pop hl
+	ret
+
+.ok
+	xor a
+	ld [de], a
+	pop af
+	pop hl
+	call GetPartyLocation
+	ld a, [hBattleTurn]
+	and a
+	jr nz, .ourturn
+	ld a, [wBattleMode]
+	dec a
+	jr z, .done
+
+.ourturn
+	ld [hl], NO_ITEM
+
+.done
+	pop bc
+	pop de
+	pop hl
+	ret
+
+INCLUDE "data/battle/held_consumables.asm"
--- a/engine/battle/consumehelditem.asm
+++ /dev/null
@@ -1,57 +1,0 @@
-ConsumeHeldItem: ; 27192
-	push hl
-	push de
-	push bc
-	ld a, [hBattleTurn]
-	and a
-	ld hl, wOTPartyMon1Item
-	ld de, wEnemyMonItem
-	ld a, [wCurOTMon]
-	jr z, .theirturn
-	ld hl, wPartyMon1Item
-	ld de, wBattleMonItem
-	ld a, [wCurBattleMon]
-
-.theirturn
-	push hl
-	push af
-	ld a, [de]
-	ld b, a
-	farcall GetItemHeldEffect
-	ld hl, ConsumableEffects
-.loop
-	ld a, [hli]
-	cp b
-	jr z, .ok
-	inc a
-	jr nz, .loop
-	pop af
-	pop hl
-	pop bc
-	pop de
-	pop hl
-	ret
-
-.ok
-	xor a
-	ld [de], a
-	pop af
-	pop hl
-	call GetPartyLocation
-	ld a, [hBattleTurn]
-	and a
-	jr nz, .ourturn
-	ld a, [wBattleMode]
-	dec a
-	jr z, .done
-
-.ourturn
-	ld [hl], NO_ITEM
-
-.done
-	pop bc
-	pop de
-	pop hl
-	ret
-
-INCLUDE "data/battle/held_consumables.asm"
--- /dev/null
+++ b/engine/battle/update_battle_huds.asm
@@ -1,0 +1,9 @@
+_UpdateBattleHUDs:
+	farcall DrawPlayerHUD
+	ld hl, wPlayerHPPal
+	call SetHPPal
+	farcall DrawEnemyHUD
+	ld hl, wEnemyHPPal
+	call SetHPPal
+	farcall FinishBattleAnim
+	ret
--- a/engine/battle/updatebattlehuds.asm
+++ /dev/null
@@ -1,9 +1,0 @@
-_UpdateBattleHUDs:
-	farcall DrawPlayerHUD
-	ld hl, wPlayerHPPal
-	call SetHPPal
-	farcall DrawEnemyHUD
-	ld hl, wEnemyHPPal
-	call SetHPPal
-	farcall FinishBattleAnim
-	ret
--- a/engine/battle_anims/getpokeballwobble.asm
+++ /dev/null
@@ -1,62 +1,0 @@
-GetPokeBallWobble: ; f971 (3:7971)
-; Returns whether a Poke Ball will wobble in the catch animation.
-; Whether a Pokemon is caught is determined beforehand.
-
-	push de
-
-	ld a, [rSVBK]
-	ld d, a
-	push de
-
-	ld a, BANK(wBuffer2)
-	ld [rSVBK], a
-
-	ld a, [wBuffer2]
-	inc a
-	ld [wBuffer2], a
-
-; Wobble up to 3 times.
-	cp 3 + 1
-	jr z, .finished
-
-	ld a, [wWildMon]
-	and a
-	ld c, 0 ; next
-	jr nz, .done
-
-	ld hl, WobbleProbabilities
-	ld a, [wBuffer1]
-	ld b, a
-.loop
-	ld a, [hli]
-	cp b
-	jr nc, .checkwobble
-	inc hl
-	jr .loop
-
-.checkwobble
-	ld b, [hl]
-	call Random
-	cp b
-	ld c, 0 ; next
-	jr c, .done
-	ld c, 2 ; escaped
-	jr .done
-
-.finished
-	ld a, [wWildMon]
-	and a
-	ld c, 1 ; caught
-	jr nz, .done
-	ld c, 2 ; escaped
-
-.done
-	pop de
-	ld e, a
-	ld a, d
-	ld [rSVBK], a
-	ld a, e
-	pop de
-	ret
-
-INCLUDE "data/battle/wobble_probabilities.asm"
--- /dev/null
+++ b/engine/battle_anims/pokeball_wobble.asm
@@ -1,0 +1,62 @@
+GetPokeBallWobble: ; f971 (3:7971)
+; Returns whether a Poke Ball will wobble in the catch animation.
+; Whether a Pokemon is caught is determined beforehand.
+
+	push de
+
+	ld a, [rSVBK]
+	ld d, a
+	push de
+
+	ld a, BANK(wBuffer2)
+	ld [rSVBK], a
+
+	ld a, [wBuffer2]
+	inc a
+	ld [wBuffer2], a
+
+; Wobble up to 3 times.
+	cp 3 + 1
+	jr z, .finished
+
+	ld a, [wWildMon]
+	and a
+	ld c, 0 ; next
+	jr nz, .done
+
+	ld hl, WobbleProbabilities
+	ld a, [wBuffer1]
+	ld b, a
+.loop
+	ld a, [hli]
+	cp b
+	jr nc, .checkwobble
+	inc hl
+	jr .loop
+
+.checkwobble
+	ld b, [hl]
+	call Random
+	cp b
+	ld c, 0 ; next
+	jr c, .done
+	ld c, 2 ; escaped
+	jr .done
+
+.finished
+	ld a, [wWildMon]
+	and a
+	ld c, 1 ; caught
+	jr nz, .done
+	ld c, 2 ; escaped
+
+.done
+	pop de
+	ld e, a
+	ld a, d
+	ld [rSVBK], a
+	ld a, e
+	pop de
+	ret
+
+INCLUDE "data/battle/wobble_probabilities.asm"
--- /dev/null
+++ b/engine/events/fishing_gfx.asm
@@ -1,0 +1,46 @@
+LoadFishingGFX: ; b84b3
+	ld a, [rVBK]
+	push af
+	ld a, $1
+	ld [rVBK], a
+
+	ld de, FishingGFX
+	ld a, [wPlayerGender]
+	bit PLAYERGENDER_FEMALE_F, a
+	jr z, .got_gender
+	ld de, KrisFishingGFX
+.got_gender
+
+	ld hl, vTiles0 tile $02
+	call .LoadGFX
+	ld hl, vTiles0 tile $06
+	call .LoadGFX
+	ld hl, vTiles0 tile $0a
+	call .LoadGFX
+	ld hl, vTiles1 tile $7c
+	call .LoadGFX
+
+	pop af
+	ld [rVBK], a
+	ret
+; b84e3
+
+.LoadGFX: ; b84e3
+	lb bc, BANK(FishingGFX), 2
+	push de
+	call Get2bpp
+	pop de
+	ld hl, 2 tiles
+	add hl, de
+	ld d, h
+	ld e, l
+	ret
+; b84f2
+
+FishingGFX: ; b84f2
+INCBIN "gfx/overworld/chris_fish.2bpp"
+; b8582
+
+KrisFishingGFX: ; b8582
+INCBIN "gfx/overworld/kris_fish.2bpp"
+; b8612
--- /dev/null
+++ b/engine/events/haircut.asm
@@ -1,0 +1,82 @@
+BillsGrandfather: ; 73f7
+	farcall SelectMonFromParty
+	jr c, .cancel
+	ld a, [wCurPartySpecies]
+	ld [wScriptVar], a
+	ld [wNamedObjectIndexBuffer], a
+	call GetPokemonName
+	jp CopyPokemonName_Buffer1_Buffer3
+
+.cancel
+	xor a
+	ld [wScriptVar], a
+	ret
+
+YoungerHaircutBrother: ; 7413
+	ld hl, HappinessData_YoungerHaircutBrother
+	jr HaircutOrGrooming
+
+OlderHaircutBrother: ; 7418
+	ld hl, HappinessData_OlderHaircutBrother
+	jr HaircutOrGrooming
+
+DaisysGrooming: ; 741d
+	ld hl, HappinessData_DaisysGrooming
+	; fallthrough
+
+HaircutOrGrooming: ; 7420
+	push hl
+	farcall SelectMonFromParty
+	pop hl
+	jr c, .nope
+	ld a, [wCurPartySpecies]
+	cp EGG
+	jr z, .egg
+	push hl
+	call GetCurNick
+	call CopyPokemonName_Buffer1_Buffer3
+	pop hl
+	call Random
+; Bug: Subtracting $ff from $ff fails to set c.
+; This can result in overflow into the next data array.
+; In the case of getting a grooming from Daisy, we bleed
+; into CopyPokemonName_Buffer1_Buffer3, which passes
+; $d0 to ChangeHappiness and returns $73 to the script.
+; The end result is that there is a 0.4% chance your
+; Pokemon's happiness will not change at all.
+.loop
+	sub [hl]
+	jr c, .ok
+	inc hl
+	inc hl
+	inc hl
+	jr .loop
+
+.ok
+	inc hl
+	ld a, [hli]
+	ld [wScriptVar], a
+	ld c, [hl]
+	call ChangeHappiness
+	ret
+
+.nope
+	xor a
+	ld [wScriptVar], a
+	ret
+
+.egg
+	ld a, 1
+	ld [wScriptVar], a
+	ret
+
+INCLUDE "data/events/happiness_probabilities.asm"
+
+CopyPokemonName_Buffer1_Buffer3: ; 746e
+	ld hl, wStringBuffer1
+	ld de, wStringBuffer3
+	ld bc, MON_NAME_LENGTH
+	jp CopyBytes
+
+DummyPredef1: ; 747a
+	ret
--- a/engine/events/loadfishinggfx.asm
+++ /dev/null
@@ -1,46 +1,0 @@
-LoadFishingGFX: ; b84b3
-	ld a, [rVBK]
-	push af
-	ld a, $1
-	ld [rVBK], a
-
-	ld de, FishingGFX
-	ld a, [wPlayerGender]
-	bit PLAYERGENDER_FEMALE_F, a
-	jr z, .got_gender
-	ld de, KrisFishingGFX
-.got_gender
-
-	ld hl, vTiles0 tile $02
-	call .LoadGFX
-	ld hl, vTiles0 tile $06
-	call .LoadGFX
-	ld hl, vTiles0 tile $0a
-	call .LoadGFX
-	ld hl, vTiles1 tile $7c
-	call .LoadGFX
-
-	pop af
-	ld [rVBK], a
-	ret
-; b84e3
-
-.LoadGFX: ; b84e3
-	lb bc, BANK(FishingGFX), 2
-	push de
-	call Get2bpp
-	pop de
-	ld hl, 2 tiles
-	add hl, de
-	ld d, h
-	ld e, l
-	ret
-; b84f2
-
-FishingGFX: ; b84f2
-INCBIN "gfx/overworld/chris_fish.2bpp"
-; b8582
-
-KrisFishingGFX: ; b8582
-INCBIN "gfx/overworld/kris_fish.2bpp"
-; b8612
--- /dev/null
+++ b/engine/events/play_slow_cry.asm
@@ -1,0 +1,31 @@
+PlaySlowCry: ; fb841
+	ld a, [wScriptVar]
+	call LoadCry
+	jr c, .done
+
+	ld hl, wCryPitch
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld bc, -$140
+	add hl, bc
+	ld a, l
+	ld [wCryPitch], a
+	ld a, h
+	ld [wCryPitch + 1], a
+	ld hl, wCryLength
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld bc, $60
+	add hl, bc
+	ld a, l
+	ld [wCryLength], a
+	ld a, h
+	ld [wCryLength + 1], a
+	farcall _PlayCry
+	call WaitSFX
+
+.done
+	ret
+; fb877
--- a/engine/events/playslowcry.asm
+++ /dev/null
@@ -1,31 +1,0 @@
-PlaySlowCry: ; fb841
-	ld a, [wScriptVar]
-	call LoadCry
-	jr c, .done
-
-	ld hl, wCryPitch
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld bc, -$140
-	add hl, bc
-	ld a, l
-	ld [wCryPitch], a
-	ld a, h
-	ld [wCryPitch + 1], a
-	ld hl, wCryLength
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld bc, $60
-	add hl, bc
-	ld a, l
-	ld [wCryLength], a
-	ld a, h
-	ld [wCryLength + 1], a
-	farcall _PlayCry
-	call WaitSFX
-
-.done
-	ret
-; fb877
--- /dev/null
+++ b/engine/events/shuckle.asm
@@ -1,0 +1,142 @@
+MANIA_OT_ID EQU 00518
+
+GiveShuckle: ; 7305
+
+; Adding to the party.
+	xor a
+	ld [wMonType], a
+
+; Level 15 Shuckle.
+	ld a, SHUCKLE
+	ld [wCurPartySpecies], a
+	ld a, 15
+	ld [wCurPartyLevel], a
+
+	predef TryAddMonToParty
+	jr nc, .NotGiven
+
+; Caught data.
+	ld b, 0
+	farcall SetGiftPartyMonCaughtData
+
+; Holding a Berry.
+	ld bc, PARTYMON_STRUCT_LENGTH
+	ld a, [wPartyCount]
+	dec a
+	push af
+	push bc
+	ld hl, wPartyMon1Item
+	call AddNTimes
+	ld [hl], BERRY
+	pop bc
+	pop af
+
+; OT ID.
+	ld hl, wPartyMon1ID
+	call AddNTimes
+	ld a, HIGH(MANIA_OT_ID)
+	ld [hli], a
+	ld [hl], LOW(MANIA_OT_ID)
+
+; Nickname.
+	ld a, [wPartyCount]
+	dec a
+	ld hl, wPartyMonNicknames
+	call SkipNames
+	ld de, SpecialShuckleNick
+	call CopyName2
+
+; OT.
+	ld a, [wPartyCount]
+	dec a
+	ld hl, wPartyMonOT
+	call SkipNames
+	ld de, SpecialShuckleOT
+	call CopyName2
+
+; Engine flag for this event.
+	ld hl, wDailyFlags
+	set DAILYFLAGS_GOT_SHUCKIE_TODAY_F, [hl]
+	ld a, 1
+	ld [wScriptVar], a
+	ret
+
+.NotGiven:
+	xor a
+	ld [wScriptVar], a
+	ret
+
+SpecialShuckleOT:
+	db "MANIA@"
+SpecialShuckleNick:
+	db "SHUCKIE@"
+
+ReturnShuckle: ; 737e
+	farcall SelectMonFromParty
+	jr c, .refused
+
+	ld a, [wCurPartySpecies]
+	cp SHUCKLE
+	jr nz, .DontReturn
+
+	ld a, [wCurPartyMon]
+	ld hl, wPartyMon1ID
+	ld bc, PARTYMON_STRUCT_LENGTH
+	call AddNTimes
+
+; OT ID
+	ld a, [hli]
+	cp HIGH(MANIA_OT_ID)
+	jr nz, .DontReturn
+	ld a, [hl]
+	cp LOW(MANIA_OT_ID)
+	jr nz, .DontReturn
+
+; OT
+	ld a, [wCurPartyMon]
+	ld hl, wPartyMonOT
+	call SkipNames
+	ld de, SpecialShuckleOT
+.CheckOT:
+	ld a, [de]
+	cp [hl]
+	jr nz, .DontReturn
+	cp "@"
+	jr z, .done
+	inc de
+	inc hl
+	jr .CheckOT
+
+.done
+	farcall CheckCurPartyMonFainted
+	jr c, .fainted
+	ld a, [wCurPartyMon]
+	ld hl, wPartyMon1Happiness
+	ld bc, PARTYMON_STRUCT_LENGTH
+	call AddNTimes
+	ld a, [hl]
+	cp 150
+	ld a, SHUCKIE_HAPPY
+	jr nc, .HappyToStayWithYou
+	xor a ; REMOVE_PARTY
+	ld [wPokemonWithdrawDepositParameter], a
+	callfar RemoveMonFromPartyOrBox
+	ld a, SHUCKIE_RETURNED
+.HappyToStayWithYou:
+	ld [wScriptVar], a
+	ret
+
+.refused
+	ld a, SHUCKIE_REFUSED
+	ld [wScriptVar], a
+	ret
+
+.DontReturn:
+	xor a ; SHUCKIE_WRONG_MON
+	ld [wScriptVar], a
+	ret
+
+.fainted
+	ld a, SHUCKIE_FAINTED
+	ld [wScriptVar], a
+	ret
--- a/engine/events/specials_2.asm
+++ /dev/null
@@ -1,225 +1,0 @@
-MANIA_OT_ID EQU 00518
-
-GiveShuckle: ; 7305
-
-; Adding to the party.
-	xor a
-	ld [wMonType], a
-
-; Level 15 Shuckle.
-	ld a, SHUCKLE
-	ld [wCurPartySpecies], a
-	ld a, 15
-	ld [wCurPartyLevel], a
-
-	predef TryAddMonToParty
-	jr nc, .NotGiven
-
-; Caught data.
-	ld b, 0
-	farcall SetGiftPartyMonCaughtData
-
-; Holding a Berry.
-	ld bc, PARTYMON_STRUCT_LENGTH
-	ld a, [wPartyCount]
-	dec a
-	push af
-	push bc
-	ld hl, wPartyMon1Item
-	call AddNTimes
-	ld [hl], BERRY
-	pop bc
-	pop af
-
-; OT ID.
-	ld hl, wPartyMon1ID
-	call AddNTimes
-	ld a, HIGH(MANIA_OT_ID)
-	ld [hli], a
-	ld [hl], LOW(MANIA_OT_ID)
-
-; Nickname.
-	ld a, [wPartyCount]
-	dec a
-	ld hl, wPartyMonNicknames
-	call SkipNames
-	ld de, SpecialShuckleNick
-	call CopyName2
-
-; OT.
-	ld a, [wPartyCount]
-	dec a
-	ld hl, wPartyMonOT
-	call SkipNames
-	ld de, SpecialShuckleOT
-	call CopyName2
-
-; Engine flag for this event.
-	ld hl, wDailyFlags
-	set DAILYFLAGS_GOT_SHUCKIE_TODAY_F, [hl]
-	ld a, 1
-	ld [wScriptVar], a
-	ret
-
-.NotGiven:
-	xor a
-	ld [wScriptVar], a
-	ret
-
-SpecialShuckleOT:
-	db "MANIA@"
-SpecialShuckleNick:
-	db "SHUCKIE@"
-
-ReturnShuckle: ; 737e
-	farcall SelectMonFromParty
-	jr c, .refused
-
-	ld a, [wCurPartySpecies]
-	cp SHUCKLE
-	jr nz, .DontReturn
-
-	ld a, [wCurPartyMon]
-	ld hl, wPartyMon1ID
-	ld bc, PARTYMON_STRUCT_LENGTH
-	call AddNTimes
-
-; OT ID
-	ld a, [hli]
-	cp HIGH(MANIA_OT_ID)
-	jr nz, .DontReturn
-	ld a, [hl]
-	cp LOW(MANIA_OT_ID)
-	jr nz, .DontReturn
-
-; OT
-	ld a, [wCurPartyMon]
-	ld hl, wPartyMonOT
-	call SkipNames
-	ld de, SpecialShuckleOT
-.CheckOT:
-	ld a, [de]
-	cp [hl]
-	jr nz, .DontReturn
-	cp "@"
-	jr z, .done
-	inc de
-	inc hl
-	jr .CheckOT
-
-.done
-	farcall CheckCurPartyMonFainted
-	jr c, .fainted
-	ld a, [wCurPartyMon]
-	ld hl, wPartyMon1Happiness
-	ld bc, PARTYMON_STRUCT_LENGTH
-	call AddNTimes
-	ld a, [hl]
-	cp 150
-	ld a, SHUCKIE_HAPPY
-	jr nc, .HappyToStayWithYou
-	xor a ; REMOVE_PARTY
-	ld [wPokemonWithdrawDepositParameter], a
-	callfar RemoveMonFromPartyOrBox
-	ld a, SHUCKIE_RETURNED
-.HappyToStayWithYou:
-	ld [wScriptVar], a
-	ret
-
-.refused
-	ld a, SHUCKIE_REFUSED
-	ld [wScriptVar], a
-	ret
-
-.DontReturn:
-	xor a ; SHUCKIE_WRONG_MON
-	ld [wScriptVar], a
-	ret
-
-.fainted
-	ld a, SHUCKIE_FAINTED
-	ld [wScriptVar], a
-	ret
-
-BillsGrandfather: ; 73f7
-	farcall SelectMonFromParty
-	jr c, .cancel
-	ld a, [wCurPartySpecies]
-	ld [wScriptVar], a
-	ld [wNamedObjectIndexBuffer], a
-	call GetPokemonName
-	jp CopyPokemonName_Buffer1_Buffer3
-
-.cancel
-	xor a
-	ld [wScriptVar], a
-	ret
-
-YoungerHaircutBrother: ; 7413
-	ld hl, HappinessData_YoungerHaircutBrother
-	jr HaircutOrGrooming
-
-OlderHaircutBrother: ; 7418
-	ld hl, HappinessData_OlderHaircutBrother
-	jr HaircutOrGrooming
-
-DaisysGrooming: ; 741d
-	ld hl, HappinessData_DaisysGrooming
-	; fallthrough
-
-HaircutOrGrooming: ; 7420
-	push hl
-	farcall SelectMonFromParty
-	pop hl
-	jr c, .nope
-	ld a, [wCurPartySpecies]
-	cp EGG
-	jr z, .egg
-	push hl
-	call GetCurNick
-	call CopyPokemonName_Buffer1_Buffer3
-	pop hl
-	call Random
-; Bug: Subtracting $ff from $ff fails to set c.
-; This can result in overflow into the next data array.
-; In the case of getting a grooming from Daisy, we bleed
-; into CopyPokemonName_Buffer1_Buffer3, which passes
-; $d0 to ChangeHappiness and returns $73 to the script.
-; The end result is that there is a 0.4% chance your
-; Pokemon's happiness will not change at all.
-.loop
-	sub [hl]
-	jr c, .ok
-	inc hl
-	inc hl
-	inc hl
-	jr .loop
-
-.ok
-	inc hl
-	ld a, [hli]
-	ld [wScriptVar], a
-	ld c, [hl]
-	call ChangeHappiness
-	ret
-
-.nope
-	xor a
-	ld [wScriptVar], a
-	ret
-
-.egg
-	ld a, 1
-	ld [wScriptVar], a
-	ret
-
-INCLUDE "data/events/happiness_probabilities.asm"
-
-CopyPokemonName_Buffer1_Buffer3: ; 746e
-	ld hl, wStringBuffer1
-	ld de, wStringBuffer3
-	ld bc, MON_NAME_LENGTH
-	jp CopyBytes
-
-DummyPredef1: ; 747a
-	ret
--- a/engine/gfx/drawkrispackgfx.asm
+++ /dev/null
@@ -1,20 +1,0 @@
-DrawKrisPackGFX: ; 48e81
-	ld hl, PackFGFXPointers
-	add hl, de
-	add hl, de
-	ld a, [hli]
-	ld e, a
-	ld d, [hl]
-	ld hl, vTiles2 tile $50
-	lb bc, BANK(PackFGFX), 15
-	call Request2bpp
-	ret
-
-PackFGFXPointers: ; 48e93
-	dw PackFGFX + (15 tiles) * 1 ; ITEM_POCKET
-	dw PackFGFX + (15 tiles) * 3 ; BALL_POCKET
-	dw PackFGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET
-	dw PackFGFX + (15 tiles) * 2 ; TM_HM_POCKET
-
-PackFGFX: ; 48e9b
-INCBIN "gfx/pack/pack_f.2bpp"
--- /dev/null
+++ b/engine/gfx/load_overworld_font.asm
@@ -1,0 +1,17 @@
+LoadOverworldFont:: ; 106594
+	ld de, .OverworldFontGFX
+	ld hl, vTiles1
+	lb bc, BANK(.OverworldFontGFX), $80
+	call Get2bpp
+	ld de, .OverworldFontSpaceGFX
+	ld hl, vTiles2 tile " "
+	lb bc, BANK(.OverworldFontSpaceGFX), 1
+	call Get2bpp
+	ret
+; 1065ad
+
+.OverworldFontGFX:
+INCBIN "gfx/font/overworld.2bpp"
+
+.OverworldFontSpaceGFX:
+INCBIN "gfx/font/overworld_space.2bpp"
--- /dev/null
+++ b/engine/gfx/load_push_oam.asm
@@ -1,0 +1,21 @@
+WriteOAMDMACodeToHRAM:: ; 4031
+	ld c, hTransferVirtualOAM - $ff00
+	ld b, .PushOAMEnd - .PushOAM
+	ld hl, .PushOAM
+.loop
+	ld a, [hli]
+	ld [$ff00+c], a
+	inc c
+	dec b
+	jr nz, .loop
+	ret
+
+.PushOAM: ; 403f
+	ld a, HIGH(wVirtualOAM)
+	ld [rDMA], a
+	ld a, NUM_SPRITE_OAM_STRUCTS
+.pushoam_loop
+	dec a
+	jr nz, .pushoam_loop
+	ret
+.PushOAMEnd
--- a/engine/gfx/loadoverworldfont.asm
+++ /dev/null
@@ -1,17 +1,0 @@
-LoadOverworldFont:: ; 106594
-	ld de, .OverworldFontGFX
-	ld hl, vTiles1
-	lb bc, BANK(.OverworldFontGFX), $80
-	call Get2bpp
-	ld de, .OverworldFontSpaceGFX
-	ld hl, vTiles2 tile " "
-	lb bc, BANK(.OverworldFontSpaceGFX), 1
-	call Get2bpp
-	ret
-; 1065ad
-
-.OverworldFontGFX:
-INCBIN "gfx/font/overworld.2bpp"
-
-.OverworldFontSpaceGFX:
-INCBIN "gfx/font/overworld_space.2bpp"
--- a/engine/gfx/loadpushoam.asm
+++ /dev/null
@@ -1,21 +1,0 @@
-WriteOAMDMACodeToHRAM:: ; 4031
-	ld c, hTransferVirtualOAM - $ff00
-	ld b, .PushOAMEnd - .PushOAM
-	ld hl, .PushOAM
-.loop
-	ld a, [hli]
-	ld [$ff00+c], a
-	inc c
-	dec b
-	jr nz, .loop
-	ret
-
-.PushOAM: ; 403f
-	ld a, HIGH(wVirtualOAM)
-	ld [rDMA], a
-	ld a, NUM_SPRITE_OAM_STRUCTS
-.pushoam_loop
-	dec a
-	jr nz, .pushoam_loop
-	ret
-.PushOAMEnd
--- /dev/null
+++ b/engine/gfx/place_graphic.asm
@@ -1,0 +1,55 @@
+PlaceGraphic: ; 2ef6e
+; Fill wBoxAlignment-aligned box width b height c
+; with iterating tile starting from hGraphicStartTile at hl.
+
+	ld de, SCREEN_WIDTH
+
+	ld a, [wBoxAlignment]
+	and a
+	jr nz, .right
+
+	ld a, [hGraphicStartTile]
+.x1
+	push bc
+	push hl
+
+.y1
+	ld [hl], a
+	add hl, de
+	inc a
+	dec c
+	jr nz, .y1
+
+	pop hl
+	inc hl
+	pop bc
+	dec b
+	jr nz, .x1
+	ret
+
+.right
+; Right-aligned.
+	push bc
+	ld b, 0
+	dec c
+	add hl, bc
+	pop bc
+
+	ld a, [hGraphicStartTile]
+.x2
+	push bc
+	push hl
+
+.y2
+	ld [hl], a
+	add hl, de
+	inc a
+	dec c
+	jr nz, .y2
+
+	pop hl
+	dec hl
+	pop bc
+	dec b
+	jr nz, .x2
+	ret
--- a/engine/gfx/placegraphic.asm
+++ /dev/null
@@ -1,55 +1,0 @@
-PlaceGraphic: ; 2ef6e
-; Fill wBoxAlignment-aligned box width b height c
-; with iterating tile starting from hGraphicStartTile at hl.
-
-	ld de, SCREEN_WIDTH
-
-	ld a, [wBoxAlignment]
-	and a
-	jr nz, .right
-
-	ld a, [hGraphicStartTile]
-.x1
-	push bc
-	push hl
-
-.y1
-	ld [hl], a
-	add hl, de
-	inc a
-	dec c
-	jr nz, .y1
-
-	pop hl
-	inc hl
-	pop bc
-	dec b
-	jr nz, .x1
-	ret
-
-.right
-; Right-aligned.
-	push bc
-	ld b, 0
-	dec c
-	add hl, bc
-	pop bc
-
-	ld a, [hGraphicStartTile]
-.x2
-	push bc
-	push hl
-
-.y2
-	ld [hl], a
-	add hl, de
-	inc a
-	dec c
-	jr nz, .y2
-
-	pop hl
-	dec hl
-	pop bc
-	dec b
-	jr nz, .x2
-	ret
--- /dev/null
+++ b/engine/gfx/trademon_frontpic.asm
@@ -1,0 +1,38 @@
+GetTrademonFrontpic: ; 4d7fd
+	ld a, [wOTTrademonSpecies]
+	ld hl, wOTTrademonDVs
+	ld de, vTiles2
+	push de
+	push af
+	predef GetUnownLetter
+	pop af
+	ld [wCurPartySpecies], a
+	ld [wCurSpecies], a
+	call GetBaseData
+	pop de
+	predef GetAnimatedFrontpic
+	ret
+
+AnimateTrademonFrontpic: ; 4d81e
+	ld a, [wOTTrademonSpecies]
+	call IsAPokemon
+	ret c
+	farcall ShowOTTrademonStats
+	ld a, [wOTTrademonSpecies]
+	ld [wCurPartySpecies], a
+	ld a, [wOTTrademonDVs]
+	ld [wTempMonDVs], a
+	ld a, [wOTTrademonDVs + 1]
+	ld [wTempMonDVs + 1], a
+	ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
+	call GetSGBLayout
+	ld a, %11100100 ; 3,2,1,0
+	call DmgToCgbBGPals
+	farcall TradeAnim_ShowGetmonFrontpic
+	ld a, [wOTTrademonSpecies]
+	ld [wCurPartySpecies], a
+	hlcoord 7, 2
+	ld d, $0
+	ld e, ANIM_MON_TRADE
+	predef AnimateFrontpic
+	ret
--- a/engine/gfx/trademonfrontpic.asm
+++ /dev/null
@@ -1,38 +1,0 @@
-GetTrademonFrontpic: ; 4d7fd
-	ld a, [wOTTrademonSpecies]
-	ld hl, wOTTrademonDVs
-	ld de, vTiles2
-	push de
-	push af
-	predef GetUnownLetter
-	pop af
-	ld [wCurPartySpecies], a
-	ld [wCurSpecies], a
-	call GetBaseData
-	pop de
-	predef GetAnimatedFrontpic
-	ret
-
-AnimateTrademonFrontpic: ; 4d81e
-	ld a, [wOTTrademonSpecies]
-	call IsAPokemon
-	ret c
-	farcall ShowOTTrademonStats
-	ld a, [wOTTrademonSpecies]
-	ld [wCurPartySpecies], a
-	ld a, [wOTTrademonDVs]
-	ld [wTempMonDVs], a
-	ld a, [wOTTrademonDVs + 1]
-	ld [wTempMonDVs + 1], a
-	ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
-	call GetSGBLayout
-	ld a, %11100100 ; 3,2,1,0
-	call DmgToCgbBGPals
-	farcall TradeAnim_ShowGetmonFrontpic
-	ld a, [wOTTrademonSpecies]
-	ld [wCurPartySpecies], a
-	hlcoord 7, 2
-	ld d, $0
-	ld e, ANIM_MON_TRADE
-	predef AnimateFrontpic
-	ret
--- /dev/null
+++ b/engine/items/pack_kris.asm
@@ -1,0 +1,20 @@
+DrawKrisPackGFX: ; 48e81
+	ld hl, PackFGFXPointers
+	add hl, de
+	add hl, de
+	ld a, [hli]
+	ld e, a
+	ld d, [hl]
+	ld hl, vTiles2 tile $50
+	lb bc, BANK(PackFGFX), 15
+	call Request2bpp
+	ret
+
+PackFGFXPointers: ; 48e93
+	dw PackFGFX + (15 tiles) * 1 ; ITEM_POCKET
+	dw PackFGFX + (15 tiles) * 3 ; BALL_POCKET
+	dw PackFGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET
+	dw PackFGFX + (15 tiles) * 2 ; TM_HM_POCKET
+
+PackFGFX: ; 48e9b
+INCBIN "gfx/pack/pack_f.2bpp"
--- /dev/null
+++ b/engine/items/print_item_description.asm
@@ -1,0 +1,31 @@
+PrintItemDescription: ; 0x1c8955
+; Print the description for item [wCurSpecies] at de.
+
+	ld a, [wCurSpecies]
+	cp TM01
+	jr c, .not_a_tm
+
+	ld [wCurItem], a
+	push de
+	farcall GetTMHMItemMove
+	pop hl
+	ld a, [wd265]
+	ld [wCurSpecies], a
+	predef PrintMoveDesc
+	ret
+
+.not_a_tm
+	push de
+	ld hl, ItemDescriptions
+	ld a, [wCurSpecies]
+	dec a
+	ld c, a
+	ld b, 0
+	add hl, bc
+	add hl, bc
+	ld e, [hl]
+	inc hl
+	ld d, [hl]
+	pop hl
+	jp PlaceString
+; 0x1c8987
--- a/engine/items/printitemdescription.asm
+++ /dev/null
@@ -1,31 +1,0 @@
-PrintItemDescription: ; 0x1c8955
-; Print the description for item [wCurSpecies] at de.
-
-	ld a, [wCurSpecies]
-	cp TM01
-	jr c, .not_a_tm
-
-	ld [wCurItem], a
-	push de
-	farcall GetTMHMItemMove
-	pop hl
-	ld a, [wd265]
-	ld [wCurSpecies], a
-	predef PrintMoveDesc
-	ret
-
-.not_a_tm
-	push de
-	ld hl, ItemDescriptions
-	ld a, [wCurSpecies]
-	dec a
-	ld c, a
-	ld b, 0
-	add hl, bc
-	add hl, bc
-	ld e, [hl]
-	inc hl
-	ld d, [hl]
-	pop hl
-	jp PlaceString
-; 0x1c8987
--- /dev/null
+++ b/engine/items/update_item_description.asm
@@ -1,0 +1,13 @@
+UpdateItemDescription: ; 0x244c3
+	ld a, [wMenuSelection]
+	ld [wCurSpecies], a
+	hlcoord 0, 12
+	ld b, 4
+	ld c, SCREEN_WIDTH - 2
+	call TextBox
+	ld a, [wMenuSelection]
+	cp -1
+	ret z
+	decoord 1, 14
+	farcall PrintItemDescription
+	ret
--- a/engine/items/updateitemdescription.asm
+++ /dev/null
@@ -1,13 +1,0 @@
-UpdateItemDescription: ; 0x244c3
-	ld a, [wMenuSelection]
-	ld [wCurSpecies], a
-	hlcoord 0, 12
-	ld b, 4
-	ld c, SCREEN_WIDTH - 2
-	call TextBox
-	ld a, [wMenuSelection]
-	cp -1
-	ret z
-	decoord 1, 14
-	farcall PrintItemDescription
-	ret
--- /dev/null
+++ b/engine/link/init_list.asm
@@ -1,0 +1,54 @@
+InitList: ; 50db9
+	ld a, [wInitListType]
+
+	cp INIT_ENEMYOT_LIST
+	jr nz, .check_party_ot_name
+	ld hl, wOTPartyCount
+	ld de, wOTPartyMonOT
+	ld a, ENEMY_OT_NAME
+	jr .done
+
+.check_party_ot_name
+	cp INIT_PLAYEROT_LIST
+	jr nz, .check_mon_name
+	ld hl, wPartyCount
+	ld de, wPartyMonOT
+	ld a, PARTY_OT_NAME
+	jr .done
+
+.check_mon_name
+	cp INIT_MON_LIST
+	jr nz, .check_item_name
+	ld hl, wCurMart
+	ld de, PokemonNames
+	ld a, MON_NAME
+	jr .done
+
+.check_item_name
+	cp INIT_BAG_ITEM_LIST
+	jr nz, .check_ob_item_name
+	ld hl, wNumItems
+	ld de, ItemNames
+	ld a, ITEM_NAME
+	jr .done
+
+.check_ob_item_name
+	ld hl, wCurMart
+	ld de, ItemNames
+	ld a, ITEM_NAME
+.done
+	ld [wNamedObjectTypeBuffer], a
+	ld a, l
+	ld [wListPointer], a
+	ld a, h
+	ld [wListPointer + 1], a
+	ld a, e
+	ld [wUnusedD102], a
+	ld a, d
+	ld [wUnusedD102 + 1], a
+	ld bc, ItemAttributes
+	ld a, c
+	ld [wItemAttributesPtr], a
+	ld a, b
+	ld [wItemAttributesPtr + 1], a
+	ret
--- a/engine/link/initlist.asm
+++ /dev/null
@@ -1,54 +1,0 @@
-InitList: ; 50db9
-	ld a, [wInitListType]
-
-	cp INIT_ENEMYOT_LIST
-	jr nz, .check_party_ot_name
-	ld hl, wOTPartyCount
-	ld de, wOTPartyMonOT
-	ld a, ENEMY_OT_NAME
-	jr .done
-
-.check_party_ot_name
-	cp INIT_PLAYEROT_LIST
-	jr nz, .check_mon_name
-	ld hl, wPartyCount
-	ld de, wPartyMonOT
-	ld a, PARTY_OT_NAME
-	jr .done
-
-.check_mon_name
-	cp INIT_MON_LIST
-	jr nz, .check_item_name
-	ld hl, wCurMart
-	ld de, PokemonNames
-	ld a, MON_NAME
-	jr .done
-
-.check_item_name
-	cp INIT_BAG_ITEM_LIST
-	jr nz, .check_ob_item_name
-	ld hl, wNumItems
-	ld de, ItemNames
-	ld a, ITEM_NAME
-	jr .done
-
-.check_ob_item_name
-	ld hl, wCurMart
-	ld de, ItemNames
-	ld a, ITEM_NAME
-.done
-	ld [wNamedObjectTypeBuffer], a
-	ld a, l
-	ld [wListPointer], a
-	ld a, h
-	ld [wListPointer + 1], a
-	ld a, e
-	ld [wUnusedD102], a
-	ld a, d
-	ld [wUnusedD102 + 1], a
-	ld bc, ItemAttributes
-	ld a, c
-	ld [wItemAttributesPtr], a
-	ld a, b
-	ld [wItemAttributesPtr + 1], a
-	ret
--- /dev/null
+++ b/engine/link/place_waiting_text.asm
@@ -1,0 +1,24 @@
+PlaceWaitingText:: ; 4000
+	hlcoord 3, 10
+	ld b, 1
+	ld c, 11
+
+	ld a, [wBattleMode]
+	and a
+	jr z, .notinbattle
+
+	call TextBox
+	jr .proceed
+
+.notinbattle
+	predef LinkTextboxAtHL
+
+.proceed
+	hlcoord 4, 11
+	ld de, .Waiting
+	call PlaceString
+	ld c, 50
+	jp DelayFrames
+
+.Waiting: ; 4025
+	db "Waiting...!@"
--- a/engine/link/placewaitingtext.asm
+++ /dev/null
@@ -1,24 +1,0 @@
-PlaceWaitingText:: ; 4000
-	hlcoord 3, 10
-	ld b, 1
-	ld c, 11
-
-	ld a, [wBattleMode]
-	and a
-	jr z, .notinbattle
-
-	call TextBox
-	jr .proceed
-
-.notinbattle
-	predef LinkTextboxAtHL
-
-.proceed
-	hlcoord 4, 11
-	ld de, .Waiting
-	call PlaceString
-	ld c, 50
-	jp DelayFrames
-
-.Waiting: ; 4025
-	db "Waiting...!@"
--- /dev/null
+++ b/engine/math/get_square_root.asm
@@ -1,0 +1,32 @@
+NUM_SQUARE_ROOTS EQU 255
+
+GetSquareRoot: ; 13b87
+; Return the square root of de in b.
+
+; Rather than calculating the result, we take the index of the
+; first value in a table of squares that isn't lower than de.
+
+	ld hl, .Squares
+	ld b, 0
+.loop
+; Make sure we don't go past the end of the table.
+	inc b
+	ld a, b
+	cp NUM_SQUARE_ROOTS
+	ret z
+
+; Iterate over the table until b**2 >= de.
+	ld a, [hli]
+	sub e
+	ld a, [hli]
+	sbc d
+
+	jr c, .loop
+	ret
+
+.Squares: ; 13b98
+x = 1
+rept NUM_SQUARE_ROOTS
+	dw x * x
+x = x + 1
+endr
--- a/engine/math/getsquareroot.asm
+++ /dev/null
@@ -1,32 +1,0 @@
-NUM_SQUARE_ROOTS EQU 255
-
-GetSquareRoot: ; 13b87
-; Return the square root of de in b.
-
-; Rather than calculating the result, we take the index of the
-; first value in a table of squares that isn't lower than de.
-
-	ld hl, .Squares
-	ld b, 0
-.loop
-; Make sure we don't go past the end of the table.
-	inc b
-	ld a, b
-	cp NUM_SQUARE_ROOTS
-	ret z
-
-; Iterate over the table until b**2 >= de.
-	ld a, [hli]
-	sub e
-	ld a, [hli]
-	sbc d
-
-	jr c, .loop
-	ret
-
-.Squares: ; 13b98
-x = 1
-rept NUM_SQUARE_ROOTS
-	dw x * x
-x = x + 1
-endr
--- /dev/null
+++ b/engine/math/print_num.asm
@@ -1,0 +1,300 @@
+_PrintNum:: ; c4c7
+; Print c digits of the b-byte value from de to hl.
+; Allows 2 to 7 digits. For 1-digit numbers, add
+; the value to char "0" instead of calling PrintNum.
+; Some extra flags can be given in bits 5-7 of b.
+; Bit 5: money if set (unless left-aligned without leading zeros)
+; Bit 6: right-aligned if set
+; Bit 7: print leading zeros if set
+
+	push bc
+
+	bit 5, b
+	jr z, .main
+	bit 7, b
+	jr nz, .moneyflag
+	bit 6, b
+	jr z, .main
+
+.moneyflag ; 101xxxxx or 011xxxxx
+	ld a, "¥"
+	ld [hli], a
+	res 5, b ; 100xxxxx or 010xxxxx
+
+.main
+	xor a
+	ld [hPrintNum1], a
+	ld [hPrintNum2], a
+	ld [hPrintNum3], a
+	ld a, b
+	and $f
+	cp 1
+	jr z, .byte
+	cp 2
+	jr z, .word
+; maximum 3 bytes
+.long
+	ld a, [de]
+	ld [hPrintNum2], a
+	inc de
+	ld a, [de]
+	ld [hPrintNum3], a
+	inc de
+	ld a, [de]
+	ld [hPrintNum4], a
+	jr .start
+
+.word
+	ld a, [de]
+	ld [hPrintNum3], a
+	inc de
+	ld a, [de]
+	ld [hPrintNum4], a
+	jr .start
+
+.byte
+	ld a, [de]
+	ld [hPrintNum4], a
+
+.start
+	push de
+
+	ld d, b
+	ld a, c
+	swap a
+	and $f
+	ld e, a
+	ld a, c
+	and $f
+	ld b, a
+	ld c, 0
+	cp 2
+	jr z, .two
+	cp 3
+	jr z, .three
+	cp 4
+	jr z, .four
+	cp 5
+	jr z, .five
+	cp 6
+	jr z, .six
+
+.seven
+	ld a, HIGH(1000000 >> 8)
+	ld [hPrintNum5], a
+	ld a, HIGH(1000000) ; mid
+	ld [hPrintNum6], a
+	ld a, LOW(1000000)
+	ld [hPrintNum7], a
+	call .PrintDigit
+	call .AdvancePointer
+
+.six
+	ld a, HIGH(100000 >> 8)
+	ld [hPrintNum5], a
+	ld a, HIGH(100000) ; mid
+	ld [hPrintNum6], a
+	ld a, LOW(100000)
+	ld [hPrintNum7], a
+	call .PrintDigit
+	call .AdvancePointer
+
+.five
+	xor a ; HIGH(10000 >> 8)
+	ld [hPrintNum5], a
+	ld a, HIGH(10000) ; mid
+	ld [hPrintNum6], a
+	ld a, LOW(10000)
+	ld [hPrintNum7], a
+	call .PrintDigit
+	call .AdvancePointer
+
+.four
+	xor a ; HIGH(1000 >> 8)
+	ld [hPrintNum5], a
+	ld a, HIGH(1000) ; mid
+	ld [hPrintNum6], a
+	ld a, LOW(1000)
+	ld [hPrintNum7], a
+	call .PrintDigit
+	call .AdvancePointer
+
+.three
+	xor a ; HIGH(100 >> 8)
+	ld [hPrintNum5], a
+	xor a ; HIGH(100) ; mid
+	ld [hPrintNum6], a
+	ld a, LOW(100)
+	ld [hPrintNum7], a
+	call .PrintDigit
+	call .AdvancePointer
+
+.two
+	dec e
+	jr nz, .two_skip
+	ld a, "0"
+	ld [hPrintNum1], a
+.two_skip
+
+	ld c, 0
+	ld a, [hPrintNum4]
+.mod_10
+	cp 10
+	jr c, .modded_10
+	sub 10
+	inc c
+	jr .mod_10
+.modded_10
+
+	ld b, a
+	ld a, [hPrintNum1]
+	or c
+	jr nz, .money
+	call .PrintLeadingZero
+	jr .money_leading_zero
+
+.money
+	call .PrintYen
+	push af
+	ld a, "0"
+	add c
+	ld [hl], a
+	pop af
+	ld [hPrintNum1], a
+	inc e
+	dec e
+	jr nz, .money_leading_zero
+	inc hl
+	ld [hl], "<DOT>"
+
+.money_leading_zero
+	call .AdvancePointer
+	call .PrintYen
+	ld a, "0"
+	add b
+	ld [hli], a
+
+	pop de
+	pop bc
+	ret
+
+.PrintYen: ; c5ba
+	push af
+	ld a, [hPrintNum1]
+	and a
+	jr nz, .stop
+	bit 5, d
+	jr z, .stop
+	ld a, "¥"
+	ld [hli], a
+	res 5, d
+
+.stop
+	pop af
+	ret
+
+.PrintDigit: ; c5cb (3:45cb)
+	dec e
+	jr nz, .ok
+	ld a, "0"
+	ld [hPrintNum1], a
+.ok
+	ld c, 0
+.loop
+	ld a, [hPrintNum5]
+	ld b, a
+	ld a, [hPrintNum2]
+	ld [hPrintNum8], a
+	cp b
+	jr c, .skip1
+	sub b
+	ld [hPrintNum2], a
+	ld a, [hPrintNum6]
+	ld b, a
+	ld a, [hPrintNum3]
+	ld [hPrintNum9], a
+	cp b
+	jr nc, .skip2
+	ld a, [hPrintNum2]
+	or 0
+	jr z, .skip3
+	dec a
+	ld [hPrintNum2], a
+	ld a, [hPrintNum3]
+.skip2
+	sub b
+	ld [hPrintNum3], a
+	ld a, [hPrintNum7]
+	ld b, a
+	ld a, [hPrintNum4]
+	ld [hPrintNum10], a
+	cp b
+	jr nc, .skip4
+	ld a, [hPrintNum3]
+	and a
+	jr nz, .skip5
+	ld a, [hPrintNum2]
+	and a
+	jr z, .skip6
+	dec a
+	ld [hPrintNum2], a
+	xor a
+.skip5
+	dec a
+	ld [hPrintNum3], a
+	ld a, [hPrintNum4]
+.skip4
+	sub b
+	ld [hPrintNum4], a
+	inc c
+	jr .loop
+.skip6
+	ld a, [hPrintNum9]
+	ld [hPrintNum3], a
+.skip3
+	ld a, [hPrintNum8]
+	ld [hPrintNum2], a
+.skip1
+	ld a, [hPrintNum1]
+	or c
+	jr z, .PrintLeadingZero
+	ld a, [hPrintNum1]
+	and a
+	jr nz, .done
+	bit 5, d
+	jr z, .done
+	ld a, "¥"
+	ld [hli], a
+	res 5, d
+.done
+	ld a, "0"
+	add c
+	ld [hl], a
+	ld [hPrintNum1], a
+	inc e
+	dec e
+	ret nz
+	inc hl
+	ld [hl], "<DOT>"
+	ret
+
+.PrintLeadingZero: ; c644
+; prints a leading zero unless they are turned off in the flags
+	bit 7, d ; print leading zeroes?
+	ret z
+	ld [hl], "0"
+	ret
+
+.AdvancePointer: ; c64a
+; increments the pointer unless leading zeroes are not being printed,
+; the number is left-aligned, and no nonzero digits have been printed yet
+	bit 7, d ; print leading zeroes?
+	jr nz, .inc
+	bit 6, d ; left alignment or right alignment?
+	jr z, .inc
+	ld a, [hPrintNum1]
+	and a
+	ret z
+.inc
+	inc hl
+	ret
--- a/engine/math/printnum.asm
+++ /dev/null
@@ -1,300 +1,0 @@
-_PrintNum:: ; c4c7
-; Print c digits of the b-byte value from de to hl.
-; Allows 2 to 7 digits. For 1-digit numbers, add
-; the value to char "0" instead of calling PrintNum.
-; Some extra flags can be given in bits 5-7 of b.
-; Bit 5: money if set (unless left-aligned without leading zeros)
-; Bit 6: right-aligned if set
-; Bit 7: print leading zeros if set
-
-	push bc
-
-	bit 5, b
-	jr z, .main
-	bit 7, b
-	jr nz, .moneyflag
-	bit 6, b
-	jr z, .main
-
-.moneyflag ; 101xxxxx or 011xxxxx
-	ld a, "¥"
-	ld [hli], a
-	res 5, b ; 100xxxxx or 010xxxxx
-
-.main
-	xor a
-	ld [hPrintNum1], a
-	ld [hPrintNum2], a
-	ld [hPrintNum3], a
-	ld a, b
-	and $f
-	cp 1
-	jr z, .byte
-	cp 2
-	jr z, .word
-; maximum 3 bytes
-.long
-	ld a, [de]
-	ld [hPrintNum2], a
-	inc de
-	ld a, [de]
-	ld [hPrintNum3], a
-	inc de
-	ld a, [de]
-	ld [hPrintNum4], a
-	jr .start
-
-.word
-	ld a, [de]
-	ld [hPrintNum3], a
-	inc de
-	ld a, [de]
-	ld [hPrintNum4], a
-	jr .start
-
-.byte
-	ld a, [de]
-	ld [hPrintNum4], a
-
-.start
-	push de
-
-	ld d, b
-	ld a, c
-	swap a
-	and $f
-	ld e, a
-	ld a, c
-	and $f
-	ld b, a
-	ld c, 0
-	cp 2
-	jr z, .two
-	cp 3
-	jr z, .three
-	cp 4
-	jr z, .four
-	cp 5
-	jr z, .five
-	cp 6
-	jr z, .six
-
-.seven
-	ld a, HIGH(1000000 >> 8)
-	ld [hPrintNum5], a
-	ld a, HIGH(1000000) ; mid
-	ld [hPrintNum6], a
-	ld a, LOW(1000000)
-	ld [hPrintNum7], a
-	call .PrintDigit
-	call .AdvancePointer
-
-.six
-	ld a, HIGH(100000 >> 8)
-	ld [hPrintNum5], a
-	ld a, HIGH(100000) ; mid
-	ld [hPrintNum6], a
-	ld a, LOW(100000)
-	ld [hPrintNum7], a
-	call .PrintDigit
-	call .AdvancePointer
-
-.five
-	xor a ; HIGH(10000 >> 8)
-	ld [hPrintNum5], a
-	ld a, HIGH(10000) ; mid
-	ld [hPrintNum6], a
-	ld a, LOW(10000)
-	ld [hPrintNum7], a
-	call .PrintDigit
-	call .AdvancePointer
-
-.four
-	xor a ; HIGH(1000 >> 8)
-	ld [hPrintNum5], a
-	ld a, HIGH(1000) ; mid
-	ld [hPrintNum6], a
-	ld a, LOW(1000)
-	ld [hPrintNum7], a
-	call .PrintDigit
-	call .AdvancePointer
-
-.three
-	xor a ; HIGH(100 >> 8)
-	ld [hPrintNum5], a
-	xor a ; HIGH(100) ; mid
-	ld [hPrintNum6], a
-	ld a, LOW(100)
-	ld [hPrintNum7], a
-	call .PrintDigit
-	call .AdvancePointer
-
-.two
-	dec e
-	jr nz, .two_skip
-	ld a, "0"
-	ld [hPrintNum1], a
-.two_skip
-
-	ld c, 0
-	ld a, [hPrintNum4]
-.mod_10
-	cp 10
-	jr c, .modded_10
-	sub 10
-	inc c
-	jr .mod_10
-.modded_10
-
-	ld b, a
-	ld a, [hPrintNum1]
-	or c
-	jr nz, .money
-	call .PrintLeadingZero
-	jr .money_leading_zero
-
-.money
-	call .PrintYen
-	push af
-	ld a, "0"
-	add c
-	ld [hl], a
-	pop af
-	ld [hPrintNum1], a
-	inc e
-	dec e
-	jr nz, .money_leading_zero
-	inc hl
-	ld [hl], "<DOT>"
-
-.money_leading_zero
-	call .AdvancePointer
-	call .PrintYen
-	ld a, "0"
-	add b
-	ld [hli], a
-
-	pop de
-	pop bc
-	ret
-
-.PrintYen: ; c5ba
-	push af
-	ld a, [hPrintNum1]
-	and a
-	jr nz, .stop
-	bit 5, d
-	jr z, .stop
-	ld a, "¥"
-	ld [hli], a
-	res 5, d
-
-.stop
-	pop af
-	ret
-
-.PrintDigit: ; c5cb (3:45cb)
-	dec e
-	jr nz, .ok
-	ld a, "0"
-	ld [hPrintNum1], a
-.ok
-	ld c, 0
-.loop
-	ld a, [hPrintNum5]
-	ld b, a
-	ld a, [hPrintNum2]
-	ld [hPrintNum8], a
-	cp b
-	jr c, .skip1
-	sub b
-	ld [hPrintNum2], a
-	ld a, [hPrintNum6]
-	ld b, a
-	ld a, [hPrintNum3]
-	ld [hPrintNum9], a
-	cp b
-	jr nc, .skip2
-	ld a, [hPrintNum2]
-	or 0
-	jr z, .skip3
-	dec a
-	ld [hPrintNum2], a
-	ld a, [hPrintNum3]
-.skip2
-	sub b
-	ld [hPrintNum3], a
-	ld a, [hPrintNum7]
-	ld b, a
-	ld a, [hPrintNum4]
-	ld [hPrintNum10], a
-	cp b
-	jr nc, .skip4
-	ld a, [hPrintNum3]
-	and a
-	jr nz, .skip5
-	ld a, [hPrintNum2]
-	and a
-	jr z, .skip6
-	dec a
-	ld [hPrintNum2], a
-	xor a
-.skip5
-	dec a
-	ld [hPrintNum3], a
-	ld a, [hPrintNum4]
-.skip4
-	sub b
-	ld [hPrintNum4], a
-	inc c
-	jr .loop
-.skip6
-	ld a, [hPrintNum9]
-	ld [hPrintNum3], a
-.skip3
-	ld a, [hPrintNum8]
-	ld [hPrintNum2], a
-.skip1
-	ld a, [hPrintNum1]
-	or c
-	jr z, .PrintLeadingZero
-	ld a, [hPrintNum1]
-	and a
-	jr nz, .done
-	bit 5, d
-	jr z, .done
-	ld a, "¥"
-	ld [hli], a
-	res 5, d
-.done
-	ld a, "0"
-	add c
-	ld [hl], a
-	ld [hPrintNum1], a
-	inc e
-	dec e
-	ret nz
-	inc hl
-	ld [hl], "<DOT>"
-	ret
-
-.PrintLeadingZero: ; c644
-; prints a leading zero unless they are turned off in the flags
-	bit 7, d ; print leading zeroes?
-	ret z
-	ld [hl], "0"
-	ret
-
-.AdvancePointer: ; c64a
-; increments the pointer unless leading zeroes are not being printed,
-; the number is left-aligned, and no nonzero digits have been printed yet
-	bit 7, d ; print leading zeroes?
-	jr nz, .inc
-	bit 6, d ; left alignment or right alignment?
-	jr z, .inc
-	ld a, [hPrintNum1]
-	and a
-	ret z
-.inc
-	inc hl
-	ret
--- /dev/null
+++ b/engine/menus/empty_sram.asm
@@ -1,0 +1,19 @@
+EmptyAllSRAMBanks: ; 4cf1f
+	ld a, 0
+	call .EmptyBank
+	ld a, 1
+	call .EmptyBank
+	ld a, 2
+	call .EmptyBank
+	ld a, 3
+	call .EmptyBank
+	ret
+
+.EmptyBank: ; 4cf34
+	call GetSRAMBank
+	ld hl, SRAM_Begin
+	ld bc, SRAM_End - SRAM_Begin
+	xor a
+	call ByteFill
+	call CloseSRAM
+	ret
--- a/engine/menus/emptyallsrambanks.asm
+++ /dev/null
@@ -1,19 +1,0 @@
-EmptyAllSRAMBanks: ; 4cf1f
-	ld a, 0
-	call .EmptyBank
-	ld a, 1
-	call .EmptyBank
-	ld a, 2
-	call .EmptyBank
-	ld a, 3
-	call .EmptyBank
-	ret
-
-.EmptyBank: ; 4cf34
-	call GetSRAMBank
-	ld hl, SRAM_Begin
-	ld bc, SRAM_End - SRAM_Begin
-	xor a
-	call ByteFill
-	call CloseSRAM
-	ret
--- /dev/null
+++ b/engine/overworld/load_map_part.asm
@@ -1,0 +1,36 @@
+_LoadMapPart:: ; 4d15b
+	ld hl, wMisc
+	ld a, [wMetatileStandingY]
+	and a
+	jr z, .top_row
+	ld bc, WMISC_WIDTH * 2
+	add hl, bc
+
+.top_row
+	ld a, [wMetatileStandingX]
+	and a
+	jr z, .left_column
+	inc hl
+	inc hl
+
+.left_column
+	decoord 0, 0
+	ld b, SCREEN_HEIGHT
+.loop
+	ld c, SCREEN_WIDTH
+.loop2
+	ld a, [hli]
+	ld [de], a
+	inc de
+	dec c
+	jr nz, .loop2
+	ld a, l
+	add 4
+	ld l, a
+	jr nc, .carry
+	inc h
+
+.carry
+	dec b
+	jr nz, .loop
+	ret
--- a/engine/overworld/loadmappart.asm
+++ /dev/null
@@ -1,36 +1,0 @@
-_LoadMapPart:: ; 4d15b
-	ld hl, wMisc
-	ld a, [wMetatileStandingY]
-	and a
-	jr z, .top_row
-	ld bc, WMISC_WIDTH * 2
-	add hl, bc
-
-.top_row
-	ld a, [wMetatileStandingX]
-	and a
-	jr z, .left_column
-	inc hl
-	inc hl
-
-.left_column
-	decoord 0, 0
-	ld b, SCREEN_HEIGHT
-.loop
-	ld c, SCREEN_WIDTH
-.loop2
-	ld a, [hli]
-	ld [de], a
-	inc de
-	dec c
-	jr nz, .loop2
-	ld a, l
-	add 4
-	ld l, a
-	jr nc, .carry
-	inc h
-
-.carry
-	dec b
-	jr nz, .loop
-	ret
--- /dev/null
+++ b/engine/pokedex/new_pokedex_entry.asm
@@ -1,0 +1,52 @@
+NewPokedexEntry: ; fb877
+	ld a, [hMapAnims]
+	push af
+	xor a
+	ld [hMapAnims], a
+	call LowVolume
+	call ClearBGPalettes
+	call ClearTileMap
+	call UpdateSprites
+	call ClearSprites
+	ld a, [wPokedexStatus]
+	push af
+	ld a, [hSCX]
+	add POKEDEX_SCX
+	ld [hSCX], a
+	xor a
+	ld [wPokedexStatus], a
+	farcall _NewPokedexEntry
+	call WaitPressAorB_BlinkCursor
+	ld a, 1 ; page 2
+	ld [wPokedexStatus], a
+	farcall DisplayDexEntry
+	call WaitPressAorB_BlinkCursor
+	pop af
+	ld [wPokedexStatus], a
+	call MaxVolume
+	call RotateThreePalettesRight
+	ld a, [hSCX]
+	add -POKEDEX_SCX
+	ld [hSCX], a
+	call .ReturnFromDexRegistration
+	pop af
+	ld [hMapAnims], a
+	ret
+; fb8c8
+
+.ReturnFromDexRegistration: ; fb8c8
+	call ClearTileMap
+	call LoadFontsExtra
+	call LoadStandardFont
+	farcall Pokedex_PlaceFrontpicTopLeftCorner
+	call WaitBGMap2
+	farcall GetEnemyMonDVs
+	ld a, [hli]
+	ld [wTempMonDVs], a
+	ld a, [hl]
+	ld [wTempMonDVs + 1], a
+	ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
+	call GetSGBLayout
+	call SetPalettes
+	ret
+; fb8f1
--- a/engine/pokedex/newpokedexentry.asm
+++ /dev/null
@@ -1,52 +1,0 @@
-NewPokedexEntry: ; fb877
-	ld a, [hMapAnims]
-	push af
-	xor a
-	ld [hMapAnims], a
-	call LowVolume
-	call ClearBGPalettes
-	call ClearTileMap
-	call UpdateSprites
-	call ClearSprites
-	ld a, [wPokedexStatus]
-	push af
-	ld a, [hSCX]
-	add POKEDEX_SCX
-	ld [hSCX], a
-	xor a
-	ld [wPokedexStatus], a
-	farcall _NewPokedexEntry
-	call WaitPressAorB_BlinkCursor
-	ld a, 1 ; page 2
-	ld [wPokedexStatus], a
-	farcall DisplayDexEntry
-	call WaitPressAorB_BlinkCursor
-	pop af
-	ld [wPokedexStatus], a
-	call MaxVolume
-	call RotateThreePalettesRight
-	ld a, [hSCX]
-	add -POKEDEX_SCX
-	ld [hSCX], a
-	call .ReturnFromDexRegistration
-	pop af
-	ld [hMapAnims], a
-	ret
-; fb8c8
-
-.ReturnFromDexRegistration: ; fb8c8
-	call ClearTileMap
-	call LoadFontsExtra
-	call LoadStandardFont
-	farcall Pokedex_PlaceFrontpicTopLeftCorner
-	call WaitBGMap2
-	farcall GetEnemyMonDVs
-	ld a, [hli]
-	ld [wTempMonDVs], a
-	ld a, [hl]
-	ld [wTempMonDVs + 1], a
-	ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
-	call GetSGBLayout
-	call SetPalettes
-	ret
-; fb8f1
--- /dev/null
+++ b/engine/pokemon/bills_pc.asm
@@ -1,0 +1,2618 @@
+_DepositPKMN: ; e2391 (38:6391)
+	ld hl, wOptions
+	ld a, [hl]
+	push af
+	set 4, [hl]
+	ld a, [wVramState]
+	push af
+	xor a
+	ld [wVramState], a
+	ld a, [hInMenu]
+	push af
+	ld a, $1
+	ld [hInMenu], a
+	xor a
+	ld [hMapAnims], a
+	call BillsPC_InitRAM
+	xor a
+	ld [wBillsPC_LoadedBox], a
+	call DelayFrame
+.loop
+	call JoyTextDelay
+	ld a, [wJumptableIndex]
+	bit 7, a
+	jr nz, .done
+	call .RunJumptable
+	call DelayFrame
+	jr .loop
+.done
+	call ClearSprites
+	pop af
+	ld [hInMenu], a
+	pop af
+	ld [wVramState], a
+	pop af
+	ld [wOptions], a
+	ret
+
+.RunJumptable: ; e23d5 (38:63d5)
+	ld a, [wJumptableIndex]
+	ld hl, .Jumptable
+	call BillsPC_Jumptable
+	jp hl
+
+.Jumptable: ; e23df (38:63df)
+	dw .Init
+	dw .HandleJoypad
+	dw .WhatsUp
+	dw .Submenu
+	dw BillsPC_EndJumptableLoop
+
+.Init: ; e23e9 (38:63e9)
+	xor a
+	ld [hBGMapMode], a
+	call ClearSprites
+	call CopyBoxmonSpecies
+	call BillsPC_BoxName
+	ld de, PCString_ChooseaPKMN
+	call BillsPC_PlaceString
+	ld a, $5
+	ld [wBillsPC_NumMonsOnScreen], a
+	call BillsPC_RefreshTextboxes
+	call PCMonInfo
+	ld a, $ff
+	ld [wCurPartySpecies], a
+	ld a, SCGB_BILLS_PC
+	call BillsPC_ApplyPalettes
+	call WaitBGMap
+	call BillsPC_UpdateSelectionCursor
+	call BillsPC_IncrementJumptableIndex
+	ret
+
+.HandleJoypad: ; e241a (38:641a)
+	ld hl, hJoyPressed ; $ffa7
+	ld a, [hl]
+	and B_BUTTON
+	jr nz, .b_button
+	ld a, [hl]
+	and A_BUTTON
+	jr nz, .a_button
+	call Withdraw_UpDown
+	and a
+	ret z
+	call BillsPC_UpdateSelectionCursor
+	xor a
+	ld [hBGMapMode], a
+	call BillsPC_RefreshTextboxes
+	call PCMonInfo
+	ld a, $1
+	ld [hBGMapMode], a
+	call DelayFrame
+	call DelayFrame
+	ret
+
+.a_button
+	call BillsPC_GetSelectedPokemonSpecies
+	and a
+	ret z
+	cp -1
+	jr z, .b_button
+	ld a, $2
+	ld [wJumptableIndex], a
+	ret
+; e2452 (38:6452)
+
+.go_back
+	ld hl, wJumptableIndex
+	dec [hl]
+	ret
+
+.b_button
+	ld a, $4
+	ld [wJumptableIndex], a
+	ret
+
+.WhatsUp: ; e245d (38:645d)
+	xor a
+	ld [hBGMapMode], a
+	call ClearSprites
+	call BillsPC_GetSelectedPokemonSpecies
+	ld [wCurPartySpecies], a
+	ld a, SCGB_BILLS_PC
+	call BillsPC_ApplyPalettes
+	ld de, PCString_WhatsUp
+	call BillsPC_PlaceString
+	ld a, $1
+	ld [wMenuCursorY], a
+	call BillsPC_IncrementJumptableIndex
+	ret
+
+.Submenu: ; e247d (38:647d)
+	ld hl, BillsPCDepositMenuHeader
+	call CopyMenuHeader
+	ld a, [wMenuCursorY]
+	call StoreTo_wMenuCursorBuffer
+	call VerticalMenu
+	jp c, BillsPCDepositFuncCancel
+	ld a, [wMenuCursorY]
+	dec a
+	and %11
+	ld e, a
+	ld d, 0
+	ld hl, BillsPCDepositJumptable
+	add hl, de
+	add hl, de
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	jp hl
+
+BillsPCDepositJumptable: ; e24a1 (38:64a1)
+	dw BillsPCDepositFuncDeposit ; Deposit Pokemon
+	dw BillsPCDepositFuncStats ; Pokemon Stats
+	dw BillsPCDepositFuncRelease ; Release Pokemon
+	dw BillsPCDepositFuncCancel ; Cancel
+
+
+BillsPCDepositFuncDeposit: ; e24a9 (38:64a9)
+	call BillsPC_CheckMail_PreventBlackout
+	jp c, BillsPCDepositFuncCancel
+	call DepositPokemon
+	jr c, .box_full
+	ld a, $0
+	ld [wJumptableIndex], a
+	xor a
+	ld [wBillsPC_CursorPosition], a
+	ld [wBillsPC_ScrollPosition], a
+	ret
+
+.box_full
+	ld de, PCString_WhatsUp
+	call BillsPC_PlaceString
+	ret
+
+BillsPCDepositFuncStats: ; e24c8 (38:64c8)
+	call LoadStandardMenuHeader
+	call BillsPC_StatsScreen
+	call ExitMenu
+	call PCMonInfo
+	call BillsPC_GetSelectedPokemonSpecies
+	ld [wCurPartySpecies], a
+	ld a, SCGB_BILLS_PC
+	call BillsPC_ApplyPalettes
+	ret
+
+BillsPCDepositFuncRelease: ; e24e0 (38:64e0)
+	call BillsPC_CheckMail_PreventBlackout
+	jr c, BillsPCDepositFuncCancel
+	call BillsPC_IsMonAnEgg
+	jr c, BillsPCDepositFuncCancel
+	ld a, [wMenuCursorY]
+	push af
+	ld de, PCString_ReleasePKMN
+	call BillsPC_PlaceString
+	call LoadStandardMenuHeader
+	lb bc, 14, 11
+	call PlaceYesNoBox
+	ld a, [wMenuCursorY]
+	dec a
+	call ExitMenu
+	and a
+	jr nz, .failed_release
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld [wCurPartyMon], a
+	xor a ; REMOVE_PARTY
+	ld [wPokemonWithdrawDepositParameter], a
+	farcall RemoveMonFromPartyOrBox
+	call ReleasePKMN_ByePKMN
+	ld a, $0
+	ld [wJumptableIndex], a
+	xor a
+	ld [wBillsPC_CursorPosition], a
+	ld [wBillsPC_ScrollPosition], a
+	pop af
+	ret
+
+.failed_release
+	ld de, PCString_WhatsUp
+	call BillsPC_PlaceString
+	pop af
+	ld [wMenuCursorY], a
+	ret
+
+BillsPCDepositFuncCancel: ; e2537 (38:6537)
+	ld a, $0
+	ld [wJumptableIndex], a
+	ret
+; e253d (38:653d)
+
+BillsPCDepositMenuHeader: ; 0xe253d (38:653d)
+	db MENU_BACKUP_TILES ; flags
+	menu_coords 9, 4, SCREEN_WIDTH - 1, 13
+	dw .MenuData
+	db 1 ; default option
+; 0xe2545
+
+.MenuData: ; 0xe2545 (38:6545)
+	db STATICMENU_CURSOR ; flags
+	db 4 ; items
+	db "DEPOSIT@"
+	db "STATS@"
+	db "RELEASE@"
+	db "CANCEL@"
+; 0xe2564 (38:6564)
+
+Unreferenced_BillsPCClearThreeBoxes: ; e2564
+	hlcoord 0, 0
+	ld b,  4
+	ld c,  8
+	call ClearBox
+	hlcoord 0, 4
+	ld b, 10
+	ld c,  9
+	call ClearBox
+	hlcoord 0, 14
+	ld b,  2
+	ld c,  8
+	call ClearBox
+	ret
+; e2583
+
+_WithdrawPKMN: ; e2583 (38:6583)
+	ld hl, wOptions
+	ld a, [hl]
+	push af
+	set 4, [hl]
+	ld a, [wVramState]
+	push af
+	xor a
+	ld [wVramState], a
+	ld a, [hInMenu]
+	push af
+	ld a, $1
+	ld [hInMenu], a
+	xor a
+	ld [hMapAnims], a
+	call BillsPC_InitRAM
+	ld a, NUM_BOXES + 1
+	ld [wBillsPC_LoadedBox], a
+	call DelayFrame
+.loop
+	call JoyTextDelay
+	ld a, [wJumptableIndex]
+	bit 7, a
+	jr nz, .done
+	call .RunJumptable
+	call DelayFrame
+	jr .loop
+.done
+	call ClearSprites
+	pop af
+	ld [hInMenu], a
+	pop af
+	ld [wVramState], a
+	pop af
+	ld [wOptions], a
+	ret
+
+.RunJumptable: ; e25c8 (38:65c8)
+	ld a, [wJumptableIndex]
+	ld hl, .Jumptable
+	call BillsPC_Jumptable
+	jp hl
+
+.Jumptable: ; e25d2 (38:65d2)
+	dw .Init
+	dw .Joypad
+	dw .PrepSubmenu
+	dw BillsPC_Withdraw
+	dw BillsPC_EndJumptableLoop
+
+.Init: ; e25dc (38:65dc)
+	ld a, NUM_BOXES + 1
+	ld [wBillsPC_LoadedBox], a
+	xor a
+	ld [hBGMapMode], a
+	call ClearSprites
+	call CopyBoxmonSpecies
+	call BillsPC_BoxName
+	ld de, PCString_ChooseaPKMN
+	call BillsPC_PlaceString
+	ld a, $5
+	ld [wBillsPC_NumMonsOnScreen], a
+	call BillsPC_RefreshTextboxes
+	call PCMonInfo
+	ld a, $ff
+	ld [wCurPartySpecies], a
+	ld a, SCGB_BILLS_PC
+	call BillsPC_ApplyPalettes
+	call WaitBGMap
+	call BillsPC_UpdateSelectionCursor
+	call BillsPC_IncrementJumptableIndex
+	ret
+
+.Joypad: ; e2612 (38:6612)
+	ld hl, hJoyPressed ; $ffa7
+	ld a, [hl]
+	and B_BUTTON
+	jr nz, .b_button
+	ld a, [hl]
+	and A_BUTTON
+	jr nz, .a_button
+	call Withdraw_UpDown
+	and a
+	ret z
+	call BillsPC_UpdateSelectionCursor
+	xor a
+	ld [hBGMapMode], a
+	call BillsPC_RefreshTextboxes
+	call PCMonInfo
+	ld a, $1
+	ld [hBGMapMode], a
+	call DelayFrame
+	call DelayFrame
+	ret
+.a_button
+	call BillsPC_GetSelectedPokemonSpecies
+	and a
+	ret z
+	cp -1
+	jr z, .b_button
+	ld a, $2
+	ld [wJumptableIndex], a
+	ret ; e264a (38:664a)
+
+.unused
+	ld hl, wJumptableIndex
+	dec [hl]
+	ret
+
+.b_button
+	ld a, $4
+	ld [wJumptableIndex], a
+	ret
+; e2655
+
+.PrepSubmenu: ; e2655 (38:6655)
+	xor a
+	ld [hBGMapMode], a
+	call ClearSprites
+	call BillsPC_GetSelectedPokemonSpecies
+	ld [wCurPartySpecies], a
+	ld a, SCGB_BILLS_PC
+	call BillsPC_ApplyPalettes
+	ld de, PCString_WhatsUp
+	call BillsPC_PlaceString
+	ld a, $1
+	ld [wMenuCursorY], a
+	call BillsPC_IncrementJumptableIndex
+	ret
+
+BillsPC_Withdraw: ; e2675 (38:6675)
+	ld hl, .MenuHeader
+	call CopyMenuHeader
+	ld a, [wMenuCursorY]
+	call StoreTo_wMenuCursorBuffer
+	call VerticalMenu
+	jp c, .cancel
+	ld a, [wMenuCursorY]
+	dec a
+	and %11
+	ld e, a
+	ld d, 0
+	ld hl, .dw
+	add hl, de
+	add hl, de
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	jp hl
+
+.dw ; e2699 (38:6699) #mark
+	dw .withdraw ; Withdraw
+	dw .stats ; Stats
+	dw .release ; Release
+	dw .cancel ; Cancel
+
+
+.withdraw ; e26a1 (38:66a1)
+	call BillsPC_CheckMail_PreventBlackout
+	jp c, .cancel
+	call TryWithdrawPokemon
+	jr c, .FailedWithdraw
+	ld a, $0
+	ld [wJumptableIndex], a
+	xor a
+	ld [wBillsPC_CursorPosition], a
+	ld [wBillsPC_ScrollPosition], a
+	ret
+.FailedWithdraw:
+	ld de, PCString_WhatsUp
+	call BillsPC_PlaceString
+	ret
+
+.stats ; e26c0 (38:66c0)
+	call LoadStandardMenuHeader
+	call BillsPC_StatsScreen
+	call ExitMenu
+	call PCMonInfo
+	call BillsPC_GetSelectedPokemonSpecies
+	ld [wCurPartySpecies], a
+	ld a, SCGB_BILLS_PC
+	call BillsPC_ApplyPalettes
+	ret
+
+.release ; e26d8 (38:66d8)
+	ld a, [wMenuCursorY]
+	push af
+	call BillsPC_IsMonAnEgg
+	jr c, .FailedRelease
+	ld de, PCString_ReleasePKMN
+	call BillsPC_PlaceString
+	call LoadStandardMenuHeader
+	lb bc, 14, 11
+	call PlaceYesNoBox
+	ld a, [wMenuCursorY]
+	dec a
+	call ExitMenu
+	and a
+	jr nz, .FailedRelease
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld [wCurPartyMon], a
+	ld a, REMOVE_BOX
+	ld [wPokemonWithdrawDepositParameter], a
+	farcall RemoveMonFromPartyOrBox
+	call ReleasePKMN_ByePKMN
+	ld a, $0
+	ld [wJumptableIndex], a
+	xor a
+	ld [wBillsPC_CursorPosition], a
+	ld [wBillsPC_ScrollPosition], a
+	pop af
+	ret
+.FailedRelease:
+	ld de, PCString_WhatsUp
+	call BillsPC_PlaceString
+	pop af
+	ld [wMenuCursorY], a
+	ret
+
+.cancel ; e272b (38:672b)
+	ld a, $0
+	ld [wJumptableIndex], a
+	ret
+; e2731 (38:6731)
+
+.MenuHeader: ; 0xe2731
+	db MENU_BACKUP_TILES ; flags
+	menu_coords 9, 4, SCREEN_WIDTH - 1, 13
+	dw .MenuData
+	db 1 ; default option
+; 0xe2739
+
+.MenuData: ; 0xe2739
+	db STATICMENU_CURSOR ; flags
+	db 4 ; items
+	db "WITHDRAW@"
+	db "STATS@"
+	db "RELEASE@"
+	db "CANCEL@"
+; 0xe2759
+
+_MovePKMNWithoutMail: ; e2759
+	ld hl, wOptions
+	ld a, [hl]
+	push af
+	set 4, [hl]
+	ld a, [wVramState]
+	push af
+	xor a
+	ld [wVramState], a
+	ld a, [hInMenu]
+	push af
+	ld a, $1
+	ld [hInMenu], a
+	xor a
+	ld [hMapAnims], a
+	call BillsPC_InitRAM
+	ld a, [wCurBox]
+	and $f
+	inc a
+	ld [wBillsPC_LoadedBox], a
+	call DelayFrame
+.asm_e2781
+	call JoyTextDelay
+	ld a, [wJumptableIndex]
+	bit 7, a
+	jr nz, .asm_e2793
+	call .RunJumptable
+	call DelayFrame
+	jr .asm_e2781
+
+.asm_e2793
+	call ClearSprites
+	pop af
+	ld [hInMenu], a
+	pop af
+	ld [wVramState], a
+	pop af
+	ld [wOptions], a
+	ret
+; e27a2
+
+.RunJumptable: ; e27a2
+	ld a, [wJumptableIndex]
+	ld hl, .Jumptable
+	call BillsPC_Jumptable
+	jp hl
+; e27ac
+
+.Jumptable: ; e27ac
+	dw .Init
+	dw .Joypad
+	dw .PrepSubmenu
+	dw .MoveMonWOMailSubmenu
+	dw .PrepInsertCursor
+	dw .Joypad2
+	dw BillsPC_EndJumptableLoop
+; e27ba
+
+.Init: ; e27ba
+	xor a
+	ld [hBGMapMode], a
+	call ClearSprites
+	call CopyBoxmonSpecies
+	ld de, PCString_ChooseaPKMN
+	call BillsPC_PlaceString
+	ld a, 5
+	ld [wBillsPC_NumMonsOnScreen], a
+	call BillsPC_RefreshTextboxes
+	call BillsPC_MoveMonWOMail_BoxNameAndArrows
+	call PCMonInfo
+	ld a, $ff
+	ld [wCurPartySpecies], a
+	ld a, SCGB_BILLS_PC
+	call BillsPC_ApplyPalettes
+	call WaitBGMap
+	call BillsPC_UpdateSelectionCursor
+	call BillsPC_IncrementJumptableIndex
+	ret
+; e27eb
+
+.Joypad: ; e27eb
+	ld hl, hJoyPressed
+	ld a, [hl]
+	and B_BUTTON
+	jr nz, .b_button
+	ld a, [hl]
+	and A_BUTTON
+	jr nz, .a_button
+	call MoveMonWithoutMail_DPad
+	jr c, .d_pad
+	and a
+	ret z
+	call BillsPC_UpdateSelectionCursor
+	xor a
+	ld [hBGMapMode], a
+	call BillsPC_RefreshTextboxes
+	call PCMonInfo
+	ld a, $1
+	ld [hBGMapMode], a
+	call DelayFrame
+	call DelayFrame
+	ret
+
+.d_pad
+	xor a
+	ld [wBillsPC_CursorPosition], a
+	ld [wBillsPC_ScrollPosition], a
+	ld a, $0
+	ld [wJumptableIndex], a
+	ret
+
+.a_button
+	call BillsPC_GetSelectedPokemonSpecies
+	and a
+	ret z
+	cp -1
+	jr z, .b_button
+	ld a, $2
+	ld [wJumptableIndex], a
+	ret
+
+.unused
+	ld hl, wJumptableIndex
+	dec [hl]
+	ret
+
+.b_button
+	ld a, $6
+	ld [wJumptableIndex], a
+	ret
+; e283d
+
+.PrepSubmenu: ; e283d
+	xor a
+	ld [hBGMapMode], a
+	call ClearSprites
+	call BillsPC_GetSelectedPokemonSpecies
+	ld [wCurPartySpecies], a
+	ld a, SCGB_BILLS_PC
+	call BillsPC_ApplyPalettes
+	ld de, PCString_WhatsUp
+	call BillsPC_PlaceString
+	ld a, $1
+	ld [wMenuCursorY], a
+	call BillsPC_IncrementJumptableIndex
+	ret
+; e285d
+
+.MoveMonWOMailSubmenu: ; e285d
+	ld hl, .MenuHeader
+	call CopyMenuHeader
+	ld a, [wMenuCursorY]
+	call StoreTo_wMenuCursorBuffer
+	call VerticalMenu
+	jp c, .Cancel
+	ld a, [wMenuCursorY]
+	dec a
+	and %11
+	ld e, a
+	ld d, 0
+	ld hl, .Jumptable2
+	add hl, de
+	add hl, de
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	jp hl
+; e2881
+
+.Jumptable2: ; e2881
+	dw .Move
+	dw .Stats
+	dw .Cancel
+; e2887
+
+.Move: ; e2887
+	call BillsPC_CheckMail_PreventBlackout
+	jp c, .Cancel
+	ld a, [wBillsPC_ScrollPosition]
+	ld [wBillsPC_BackupScrollPosition], a
+	ld a, [wBillsPC_CursorPosition]
+	ld [wBillsPC_BackupCursorPosition], a
+	ld a, [wBillsPC_LoadedBox]
+	ld [wBillsPC_BackupLoadedBox], a
+	ld a, $4
+	ld [wJumptableIndex], a
+	ret
+; e28a5
+
+.Stats: ; e28a5
+	call LoadStandardMenuHeader
+	call BillsPC_StatsScreen
+	call ExitMenu
+	call PCMonInfo
+	call BillsPC_GetSelectedPokemonSpecies
+	ld [wCurPartySpecies], a
+	ld a, SCGB_BILLS_PC
+	call BillsPC_ApplyPalettes
+	ret
+; e28bd
+
+.Cancel: ; e28bd
+	ld a, $0
+	ld [wJumptableIndex], a
+	ret
+; e28c3
+
+.MenuHeader: ; 0xe28c3
+	db MENU_BACKUP_TILES ; flags
+	menu_coords 9, 4, SCREEN_WIDTH - 1, 13
+	dw .MenuData
+	db 1 ; default option
+; 0xe28cb
+
+.MenuData: ; 0xe28cb
+	db STATICMENU_CURSOR ; flags
+	db 3 ; items
+	db "MOVE@"
+	db "STATS@"
+	db "CANCEL@"
+; 0xe28df
+
+.PrepInsertCursor: ; e28df
+	xor a
+	ld [hBGMapMode], a
+	call CopyBoxmonSpecies
+	ld de, PCString_MoveToWhere
+	call BillsPC_PlaceString
+	ld a, $5
+	ld [wBillsPC_NumMonsOnScreen], a
+	call BillsPC_RefreshTextboxes
+	call BillsPC_MoveMonWOMail_BoxNameAndArrows
+	call ClearSprites
+	call BillsPC_UpdateInsertCursor
+	call WaitBGMap
+	call BillsPC_IncrementJumptableIndex
+	ret
+; e2903
+
+.Joypad2: ; e2903
+	ld hl, hJoyPressed
+	ld a, [hl]
+	and B_BUTTON
+	jr nz, .b_button_2
+	ld a, [hl]
+	and A_BUTTON
+	jr nz, .a_button_2
+	call MoveMonWithoutMail_DPad_2
+	jr c, .dpad_2
+	and a
+	ret z
+	call BillsPC_UpdateInsertCursor
+	xor a
+	ld [hBGMapMode], a
+	call BillsPC_RefreshTextboxes
+	ld a, $1
+	ld [hBGMapMode], a
+	call DelayFrame
+	call DelayFrame
+	ret
+
+.dpad_2
+	xor a
+	ld [wBillsPC_CursorPosition], a
+	ld [wBillsPC_ScrollPosition], a
+	ld a, $4
+	ld [wJumptableIndex], a
+	ret
+
+.a_button_2
+	call BillsPC_CheckSpaceInDestination
+	jr c, .no_space
+	call MovePKMNWitoutMail_InsertMon
+	ld a, $0
+	ld [wJumptableIndex], a
+	ret
+
+.no_space
+	ld hl, wJumptableIndex
+	dec [hl]
+	ret
+
+.b_button_2
+	ld a, [wBillsPC_BackupScrollPosition]
+	ld [wBillsPC_ScrollPosition], a
+	ld a, [wBillsPC_BackupCursorPosition]
+	ld [wBillsPC_CursorPosition], a
+	ld a, [wBillsPC_BackupLoadedBox]
+	ld [wBillsPC_LoadedBox], a
+	ld a, $0
+	ld [wJumptableIndex], a
+	ret
+; e2963
+
+BillsPC_InitRAM: ; e2963 (38:6963)
+	call ClearBGPalettes
+	call ClearSprites
+	call ClearTileMap
+	call BillsPC_InitGFX
+	ld hl, wBillsPCPokemonList
+	ld bc, $338
+	xor a
+	call ByteFill
+	xor a
+	ld [wJumptableIndex], a
+	ld [wcf64], a
+	ld [wcf65], a
+	ld [wcf66], a
+	ld [wBillsPC_CursorPosition], a
+	ld [wBillsPC_ScrollPosition], a
+	ret
+
+BillsPC_IncrementJumptableIndex: ; e298d (38:698d)
+	ld hl, wJumptableIndex
+	inc [hl]
+	ret
+
+BillsPC_EndJumptableLoop: ; e2992 (38:6992)
+	ld hl, wJumptableIndex
+	set 7, [hl]
+	ret
+
+_StatsScreenDPad: ; e2998 (38:6998)
+	ld a, [wBillsPC_NumMonsOnScreen]
+	ld d, a
+	ld a, [wBillsPC_NumMonsInBox]
+	and a
+	jr z, .empty
+	dec a
+	cp $1
+	jr z, .empty
+	ld e, a
+	ld a, [hl]
+	and D_UP
+	jr nz, BillsPC_PressUp
+	ld a, [hl]
+	and D_DOWN
+	jr nz, BillsPC_PressDown
+.empty
+	jp BillsPC_JoypadDidNothing
+
+Withdraw_UpDown: ; e29b5 (38:69b5)
+	ld hl, hJoyLast
+	ld a, [wBillsPC_NumMonsOnScreen]
+	ld d, a
+	ld a, [wBillsPC_NumMonsInBox]
+	ld e, a
+	and a
+	jr z, .empty
+	ld a, [hl]
+	and D_UP
+	jr nz, BillsPC_PressUp
+	ld a, [hl]
+	and D_DOWN
+	jr nz, BillsPC_PressDown
+.empty
+	jp BillsPC_JoypadDidNothing
+; e29d0 (38:69d0)
+
+MoveMonWithoutMail_DPad: ; e29d0
+	ld hl, hJoyLast
+	ld a, [wBillsPC_NumMonsOnScreen]
+	ld d, a
+	ld a, [wBillsPC_NumMonsInBox]
+	ld e, a
+	and a
+	jr z, .check_left_right
+	ld a, [hl]
+	and D_UP
+	jr nz, BillsPC_PressUp
+	ld a, [hl]
+	and D_DOWN
+	jr nz, BillsPC_PressDown
+
+.check_left_right
+	ld a, [hl]
+	and D_LEFT
+	jr nz, BillsPC_PressLeft
+	ld a, [hl]
+	and D_RIGHT
+	jr nz, BillsPC_PressRight
+	jr BillsPC_JoypadDidNothing
+
+MoveMonWithoutMail_DPad_2: ; e29f4
+	ld hl, hJoyLast
+	ld a, [wBillsPC_NumMonsOnScreen]
+	ld d, a
+	ld a, [wBillsPC_NumMonsInBox]
+	ld e, a
+	and a
+	jr z, .check_left_right
+
+	ld a, [hl]
+	and D_UP
+	jr nz, BillsPC_PressUp
+	ld a, [hl]
+	and D_DOWN
+	jr nz, BillsPC_PressDown
+
+.check_left_right
+	ld a, [hl]
+	and D_LEFT
+	jr nz, BillsPC_PressLeft
+	ld a, [hl]
+	and D_RIGHT
+	jr nz, BillsPC_PressRight
+	jr BillsPC_JoypadDidNothing
+
+BillsPC_PressUp: ; e2a18 (38:6a18)
+	ld hl, wBillsPC_CursorPosition
+	ld a, [hl]
+	and a
+	jr z, .top
+	dec [hl]
+	jr BillsPC_UpDownDidSomething
+
+.top
+	ld hl, wBillsPC_ScrollPosition
+	ld a, [hl]
+	and a
+	jr z, BillsPC_JoypadDidNothing
+	dec [hl]
+	jr BillsPC_UpDownDidSomething
+
+BillsPC_PressDown: ; e2a2c (38:6a2c)
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	inc a
+	cp e
+	jr nc, BillsPC_JoypadDidNothing
+
+	ld hl, wBillsPC_CursorPosition
+	ld a, [hl]
+	inc a
+	cp d
+	jr nc, .not_bottom
+	inc [hl]
+	jr BillsPC_UpDownDidSomething
+
+.not_bottom
+	ld hl, wBillsPC_ScrollPosition
+	inc [hl]
+	jr BillsPC_UpDownDidSomething
+; e2a48 (38:6a48)
+
+BillsPC_PressLeft: ; e2a48
+	ld hl, wBillsPC_LoadedBox
+	ld a, [hl]
+	and a
+	jr z, .wrap_around
+	dec [hl]
+	jr BillsPC_LeftRightDidSomething
+
+.wrap_around
+	ld [hl], NUM_BOXES
+	jr BillsPC_LeftRightDidSomething
+
+BillsPC_PressRight: ; e2a56
+	ld hl, wBillsPC_LoadedBox
+	ld a, [hl]
+	cp NUM_BOXES
+	jr z, .wrap_around
+	inc [hl]
+	jr BillsPC_LeftRightDidSomething
+
+.wrap_around
+	ld [hl], 0
+	jr BillsPC_LeftRightDidSomething
+
+BillsPC_JoypadDidNothing: ; e2a65 (38:6a65)
+	xor a
+	and a
+	ret
+
+BillsPC_UpDownDidSomething: ; e2a68 (38:6a68)
+	ld a, TRUE
+	and a
+	ret
+; e2a6c (38:6a6c)
+
+BillsPC_LeftRightDidSomething: ; e2a6c
+	scf
+	ret
+; e2a6e
+
+BillsPC_PlaceString: ; e2a6e (38:6a6e)
+	push de
+	hlcoord 0, 15
+	lb bc, 1, 18
+	call TextBox
+	pop de
+	hlcoord 1, 16
+	call PlaceString
+	ret
+; e2a80 (38:6a80)
+
+BillsPC_MoveMonWOMail_BoxNameAndArrows: ; e2a80
+	call BillsPC_BoxName
+	hlcoord 8, 1
+	ld [hl], $5f
+	hlcoord 19, 1
+	ld [hl], $5e
+	ret
+; e2a8e
+
+BillsPC_BoxName: ; e2a8e (38:6a8e)
+	hlcoord 8, 0
+	lb bc, 1, 10
+	call TextBox
+
+	ld a, [wBillsPC_LoadedBox]
+	and a
+	jr z, .party
+
+	cp NUM_BOXES + 1
+	jr nz, .gotbox
+
+	ld a, [wCurBox]
+	inc a
+.gotbox
+	dec a
+	ld hl, wBoxNames
+	ld bc, BOX_NAME_LENGTH
+	call AddNTimes
+	ld e, l
+	ld d, h
+	jr .print
+
+.party
+	ld de, .PartyPKMN
+.print
+	hlcoord 10, 1
+	call PlaceString
+	ret
+; e2abd (38:6abd)
+
+.PartyPKMN:
+	db "PARTY <PK><MN>@"
+; e2ac6
+
+PCMonInfo: ; e2ac6 (38:6ac6)
+; Display a monster's pic and
+; attributes when highlighting
+; it in a PC menu.
+
+; Includes the neat cascading
+; effect when showing the pic.
+
+; Example: Species, level, gender,
+; whether it's holding an item.
+
+	hlcoord 0, 0
+	lb bc, 15, 8
+	call ClearBox
+
+	hlcoord 8, 14
+	lb bc, 1, 3
+	call ClearBox
+
+	call BillsPC_GetSelectedPokemonSpecies
+	and a
+	ret z
+	cp -1
+	ret z
+
+	ld [wd265], a
+	hlcoord 1, 4
+	xor a
+	ld b, 7
+.row
+	ld c, 7
+	push af
+	push hl
+.col
+	ld [hli], a
+	add 7
+	dec c
+	jr nz, .col
+	pop hl
+	ld de, SCREEN_WIDTH
+	add hl, de
+	pop af
+	inc a
+	dec b
+	jr nz, .row
+
+	call BillsPC_LoadMonStats
+	ld a, [wd265]
+	ld [wCurPartySpecies], a
+	ld [wCurSpecies], a
+	ld hl, wTempMonDVs
+	predef GetUnownLetter
+	call GetBaseData
+	ld de, vTiles2 tile $00
+	predef GetMonFrontpic
+	xor a
+	ld [wBillsPC_MonHasMail], a
+	ld a, [wCurPartySpecies]
+	ld [wd265], a
+	cp EGG
+	ret z
+
+	call GetBasePokemonName
+	hlcoord 1, 14
+	call PlaceString
+
+	hlcoord 1, 12
+	call PrintLevel
+
+	ld a, $3
+	ld [wMonType], a
+	farcall GetGender
+	jr c, .skip_gender
+	ld a, "♂"
+	jr nz, .printgender
+	ld a, "♀"
+.printgender
+	hlcoord 5, 12
+	ld [hl], a
+.skip_gender
+
+	ld a, [wTempMonItem]
+	and a
+	ret z
+
+	ld d, a
+	callfar ItemIsMail
+	jr c, .mail
+	ld a, $5d ; item icon
+	jr .printitem
+.mail
+	ld a, $1
+	ld [wBillsPC_MonHasMail], a
+	ld a, $5c ; mail icon
+.printitem
+	hlcoord 7, 12
+	ld [hl], a
+	ret
+
+BillsPC_LoadMonStats: ; e2b6d (38:6b6d)
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld e, a
+	ld d, $0
+	ld hl, wBillsPCPokemonList + 1 ; box number
+	add hl, de
+	add hl, de
+	add hl, de
+	ld a, [hl]
+	and a
+	jr z, .party
+	cp NUM_BOXES + 1
+	jr z, .sBox
+	ld b, a
+	call GetBoxPointer
+	ld a, b
+	call GetSRAMBank
+	push hl
+	ld bc, sBoxMon1Level - sBox
+	add hl, bc
+	ld bc, BOXMON_STRUCT_LENGTH
+	ld a, e
+	call AddNTimes
+	ld a, [hl]
+	ld [wTempMonLevel], a
+	pop hl
+	push hl
+	ld bc, sBoxMon1Item - sBox
+	add hl, bc
+	ld bc, BOXMON_STRUCT_LENGTH
+	ld a, e
+	call AddNTimes
+	ld a, [hl]
+	ld [wTempMonItem], a
+	pop hl
+	ld bc, sBoxMon1DVs - sBox
+	add hl, bc
+	ld bc, BOXMON_STRUCT_LENGTH
+	ld a, e
+	call AddNTimes
+	ld de, wTempMonDVs
+	ld a, [hli]
+	ld [de], a
+	inc de
+	ld a, [hl]
+	ld [de], a
+	call CloseSRAM
+	ret
+
+.party
+	ld hl, wPartyMon1Level
+	ld bc, PARTYMON_STRUCT_LENGTH
+	ld a, e
+	call AddNTimes
+	ld a, [hl]
+	ld [wTempMonLevel], a
+	ld hl, wPartyMon1Item
+	ld bc, PARTYMON_STRUCT_LENGTH
+	ld a, e
+	call AddNTimes
+	ld a, [hl]
+	ld [wTempMonItem], a
+	ld hl, wPartyMon1DVs
+	ld bc, PARTYMON_STRUCT_LENGTH
+	ld a, e
+	call AddNTimes
+	ld de, wTempMonDVs
+	ld a, [hli]
+	ld [de], a
+	inc de
+	ld a, [hl]
+	ld [de], a
+	ret
+
+.sBox
+	ld a, BANK(sBox)
+	call GetSRAMBank
+	ld hl, sBoxMon1Level
+	ld bc, BOXMON_STRUCT_LENGTH
+	ld a, e
+	call AddNTimes
+	ld a, [hl]
+	ld [wTempMonLevel], a
+
+	ld hl, sBoxMon1Item
+	ld bc, BOXMON_STRUCT_LENGTH
+	ld a, e
+	call AddNTimes
+	ld a, [hl]
+	ld [wTempMonItem], a
+
+	ld hl, sBoxMon1DVs
+	ld bc, BOXMON_STRUCT_LENGTH
+	ld a, e
+	call AddNTimes
+	ld de, wTempMonDVs
+	ld a, [hli]
+	ld [de], a
+	inc de
+	ld a, [hl]
+	ld [de], a
+
+	call CloseSRAM
+	ret
+
+BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c)
+	hlcoord 8, 2
+	lb bc, 10, 10
+	call TextBox
+
+	hlcoord 8, 2
+	ld [hl], "└"
+	hlcoord 19, 2
+	ld [hl], "┘"
+
+	ld a, [wBillsPC_ScrollPosition]
+	ld e, a
+	ld d, 0
+	ld hl, wBillsPCPokemonList
+	add hl, de
+	add hl, de
+	add hl, de
+	ld e, l
+	ld d, h
+	hlcoord 9, 4
+	ld a, [wBillsPC_NumMonsOnScreen]
+.loop
+	push af
+	push de
+	push hl
+	call .PlaceNickname
+	pop hl
+	ld de, 2 * SCREEN_WIDTH
+	add hl, de
+	pop de
+	inc de
+	inc de
+	inc de
+	pop af
+	dec a
+	jr nz, .loop
+	ret
+; e2c67 (38:6c67)
+
+.CancelString:
+	db "CANCEL@"
+; e2c6e
+
+.PlaceNickname: ; e2c6e (38:6c6e)
+	ld a, [de]
+	and a
+	ret z
+	cp -1
+	jr nz, .get_nickname
+	ld de, .CancelString
+	call PlaceString
+	ret
+
+.get_nickname
+	inc de
+	ld a, [de]
+	ld b, a
+	inc de
+	ld a, [de]
+	ld e, a
+	ld a, b
+	and a
+	jr z, .party
+	cp NUM_BOXES + 1
+	jr z, .sBox
+	push hl
+	call GetBoxPointer
+	ld a, b
+	call GetSRAMBank
+	push hl
+	ld bc, sBoxMons - sBox
+	add hl, bc
+	ld bc, BOXMON_STRUCT_LENGTH
+	ld a, e
+	call AddNTimes
+	ld a, [hl]
+	pop hl
+	and a
+	jr z, .boxfail
+	ld bc, sBoxMonNicknames - sBox
+	add hl, bc
+	ld bc, MON_NAME_LENGTH
+	ld a, e
+	call AddNTimes
+	ld de, wStringBuffer1
+	ld bc, MON_NAME_LENGTH
+	call CopyBytes
+	call CloseSRAM
+	pop hl
+	ld de, wStringBuffer1
+	call PlaceString
+	ret
+
+.boxfail
+	call CloseSRAM
+	pop hl
+	jr .placeholder_string
+
+.party
+	push hl
+	ld hl, wPartySpecies
+	ld d, $0
+	add hl, de
+	ld a, [hl]
+	and a
+	jr z, .partyfail
+	ld hl, wPartyMonNicknames
+	ld bc, MON_NAME_LENGTH
+	ld a, e
+	call AddNTimes
+	ld de, wStringBuffer1
+	ld bc, MON_NAME_LENGTH
+	call CopyBytes
+	pop hl
+	ld de, wStringBuffer1
+	call PlaceString
+	ret
+
+.partyfail
+	pop hl
+	jr .placeholder_string
+
+.sBox
+	push hl
+	ld a, BANK(sBox)
+	call GetSRAMBank
+	ld hl, sBoxSpecies
+	ld d, $0
+	add hl, de
+	ld a, [hl]
+	and a
+	jr z, .sBoxFail
+	ld hl, sBoxMonNicknames
+	ld bc, MON_NAME_LENGTH
+	ld a, e
+	call AddNTimes
+	ld de, wStringBuffer1
+	ld bc, MON_NAME_LENGTH
+	call CopyBytes
+	call CloseSRAM
+	pop hl
+	ld de, wStringBuffer1
+	call PlaceString
+	ret
+
+.sBoxFail
+	call CloseSRAM
+	pop hl
+.placeholder_string
+	ld de, .Placeholder
+	call PlaceString
+	ret
+; e2d2a (38:6d2a)
+
+.Placeholder:
+	db "-----@"
+; e2d30
+
+copy_box_data: MACRO
+.loop\@
+	ld a, [hl]
+	cp -1
+	jr z, .done\@
+	and a
+	jr z, .done\@
+	ld [de], a
+	inc de
+	ld a, [wBillsPC_LoadedBox]
+	ld [de], a
+	inc de
+	ld a, [wd003]
+	ld [de], a
+	inc a
+	ld [wd003], a
+	inc de
+	inc hl
+	ld a, [wd004]
+	inc a
+	ld [wd004], a
+	jr .loop\@
+
+.done\@
+if \1
+	call CloseSRAM
+endc
+	ld a, -1
+	ld [de], a
+	ld a, [wd004]
+	inc a
+	ld [wBillsPC_NumMonsInBox], a
+ENDM
+
+CopyBoxmonSpecies: ; e2d30 (38:6d30)
+	xor a
+	ld hl, wBillsPCPokemonList
+	ld bc, 3 * 30
+	call ByteFill
+	ld de, wBillsPCPokemonList
+	xor a
+	ld [wd003], a
+	ld [wd004], a
+	ld a, [wBillsPC_LoadedBox]
+	and a
+	jr z, .party
+	cp NUM_BOXES + 1
+	jr z, .sBox
+	ld b, a
+	call GetBoxPointer
+	ld a, b
+	call GetSRAMBank
+	inc hl
+	copy_box_data 1
+	ret
+
+.party
+	ld hl, wPartySpecies
+	copy_box_data 0
+	ret
+
+.sBox
+	ld a, BANK(sBox)
+	call GetSRAMBank
+	ld hl, sBoxSpecies
+	copy_box_data 1
+	ret
+
+BillsPC_GetSelectedPokemonSpecies: ; e2def (38:6def)
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld e, a
+	ld d, $0
+	ld hl, wBillsPCPokemonList
+	add hl, de
+	add hl, de
+	add hl, de
+	ld a, [hl]
+	ret
+
+BillsPC_UpdateSelectionCursor: ; e2e01 (38:6e01)
+	ld a, [wBillsPC_NumMonsInBox]
+	and a
+	jr nz, .place_cursor
+	call ClearSprites
+	ret
+
+.place_cursor
+	ld hl, .OAM
+	ld de, wVirtualOAMSprite00
+.loop
+	ld a, [hl]
+	cp -1
+	ret z
+	ld a, [wBillsPC_CursorPosition]
+	and $7
+	swap a
+	add [hl]
+	inc hl
+	ld [de], a ; y
+	inc de
+rept SPRITEOAMSTRUCT_LENGTH + -1
+	ld a, [hli]
+	ld [de], a
+	inc de
+endr
+	jr .loop
+; e2e2b (38:6e2b)
+
+.OAM: ; e2e2b
+	dsprite 4, 6, 10, 0, $00, 0
+	dsprite 4, 6, 11, 0, $00, 0
+	dsprite 4, 6, 12, 0, $00, 0
+	dsprite 4, 6, 13, 0, $00, 0
+	dsprite 4, 6, 14, 0, $00, 0
+	dsprite 4, 6, 15, 0, $00, 0
+	dsprite 4, 6, 16, 0, $00, 0
+	dsprite 4, 6, 17, 0, $00, 0
+	dsprite 4, 6, 18, 0, $00, 0
+	dsprite 4, 6, 18, 7, $00, 0
+	dsprite 7, 1, 10, 0, $00, 0 | Y_FLIP
+	dsprite 7, 1, 11, 0, $00, 0 | Y_FLIP
+	dsprite 7, 1, 12, 0, $00, 0 | Y_FLIP
+	dsprite 7, 1, 13, 0, $00, 0 | Y_FLIP
+	dsprite 7, 1, 14, 0, $00, 0 | Y_FLIP
+	dsprite 7, 1, 15, 0, $00, 0 | Y_FLIP
+	dsprite 7, 1, 16, 0, $00, 0 | Y_FLIP
+	dsprite 7, 1, 17, 0, $00, 0 | Y_FLIP
+	dsprite 7, 1, 18, 0, $00, 0 | Y_FLIP
+	dsprite 7, 1, 18, 7, $00, 0 | Y_FLIP
+	dsprite 5, 6,  9, 6, $01, 0
+	dsprite 6, 1,  9, 6, $01, 0 | Y_FLIP
+	dsprite 5, 6, 19, 1, $01, 0 | X_FLIP
+	dsprite 6, 1, 19, 1, $01, 0 | X_FLIP | Y_FLIP
+	db -1
+; e2e8c
+
+BillsPC_UpdateInsertCursor: ; e2e8c
+	ld hl, .OAM
+	ld de, wVirtualOAMSprite00
+.loop
+	ld a, [hl]
+	cp -1
+	ret z
+	ld a, [wBillsPC_CursorPosition]
+	and $7
+	swap a
+	add [hl]
+	inc hl
+	ld [de], a ; y
+	inc de
+rept SPRITEOAMSTRUCT_LENGTH + -1
+	ld a, [hli]
+	ld [de], a
+	inc de
+endr
+	jr .loop
+; e2eac
+
+.OAM: ; e2eac
+	dsprite 4, 7, 10, 0, $06, 0
+	dsprite 5, 3, 11, 0, $00, 0 | Y_FLIP
+	dsprite 5, 3, 12, 0, $00, 0 | Y_FLIP
+	dsprite 5, 3, 13, 0, $00, 0 | Y_FLIP
+	dsprite 5, 3, 14, 0, $00, 0 | Y_FLIP
+	dsprite 5, 3, 15, 0, $00, 0 | Y_FLIP
+	dsprite 5, 3, 16, 0, $00, 0 | Y_FLIP
+	dsprite 5, 3, 17, 0, $00, 0 | Y_FLIP
+	dsprite 5, 3, 18, 0, $00, 0 | Y_FLIP
+	dsprite 4, 7, 19, 0, $07, 0
+	db -1
+; e2ed5
+
+Unreferenced_BillsPC_FillBox: ; e2ed5
+.row
+	push bc
+	push hl
+.col
+	ld [hli], a
+	dec c
+	jr nz, .col
+	pop hl
+	ld bc, SCREEN_WIDTH
+	add hl, bc
+	pop bc
+	dec b
+	jr nz, .row
+	ret
+; e2ee5
+
+BillsPC_CheckSpaceInDestination: ; e2ee5
+; If moving within a box, no need to be here.
+	ld hl, wBillsPC_LoadedBox
+	ld a, [wBillsPC_BackupLoadedBox]
+	cp [hl]
+	jr z, .same_box
+
+; Exceeding box or party capacity is a big no-no.
+	ld a, [wBillsPC_LoadedBox]
+	and a
+	jr z, .party
+	ld e, MONS_PER_BOX + 1
+	jr .compare
+
+.party
+	ld e, PARTY_LENGTH + 1
+.compare
+	ld a, [wBillsPC_NumMonsInBox]
+	cp e
+	jr nc, .no_room
+.same_box
+	and a
+	ret
+
+.no_room
+	ld de, PCString_TheresNoRoom
+	call BillsPC_PlaceString
+	ld de, SFX_WRONG
+	call WaitPlaySFX
+	call WaitSFX
+	ld c, 50
+	call DelayFrames
+	scf
+	ret
+; e2f18
+
+BillsPC_CheckMail_PreventBlackout: ; e2f18 (38:6f18)
+	ld a, [wBillsPC_LoadedBox]
+	and a
+	jr nz, .Okay
+	ld a, [wBillsPC_NumMonsInBox]
+	cp $3
+	jr c, .ItsYourLastPokemon
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld [wCurPartyMon], a
+	farcall CheckCurPartyMonFainted
+	jr c, .AllOthersFainted
+	ld a, [wBillsPC_MonHasMail]
+	and a
+	jr nz, .HasMail
+.Okay:
+	and a
+	ret
+
+.HasMail:
+	ld de, PCString_RemoveMail
+	jr .NotOkay
+
+.AllOthersFainted:
+	ld de, PCString_NoMoreUsablePKMN
+	jr .NotOkay
+
+.ItsYourLastPokemon:
+	ld de, PCString_ItsYourLastPKMN
+.NotOkay:
+	call BillsPC_PlaceString
+	ld de, SFX_WRONG
+	call WaitPlaySFX
+	call WaitSFX
+	ld c, 50
+	call DelayFrames
+	scf
+	ret
+
+BillsPC_IsMonAnEgg: ; e2f5f (38:6f5f)
+	ld a, [wCurPartySpecies]
+	cp EGG
+	jr z, .egg
+	and a
+	ret
+
+.egg
+	ld de, PCString_NoReleasingEGGS
+	call BillsPC_PlaceString
+	ld de, SFX_WRONG
+	call WaitPlaySFX
+	call WaitSFX
+	ld c, 50
+	call DelayFrames
+	scf
+	ret
+
+BillsPC_StatsScreen: ; e2f7e (38:6f7e)
+	call LowVolume
+	call BillsPC_CopyMon
+	ld a, $3
+	ld [wMonType], a
+	predef StatsScreenInit
+	call BillsPC_InitGFX
+	call MaxVolume
+	ret
+
+StatsScreenDPad: ; e2f95 (38:6f95)
+	ld hl, hJoyPressed ; $ffa7
+	ld a, [hl]
+	and A_BUTTON | B_BUTTON | D_RIGHT | D_LEFT
+	ld [wMenuJoypad], a
+	jr nz, .pressed_a_b_right_left
+	ld a, [hl]
+	and D_DOWN | D_UP
+	ld [wMenuJoypad], a
+	jr nz, .pressed_down_up
+	jr .pressed_a_b_right_left
+
+.pressed_down_up
+	call _StatsScreenDPad
+	and a
+	jr z, .did_nothing
+	call BillsPC_GetSelectedPokemonSpecies
+	ld [wd265], a
+	call BillsPC_LoadMonStats
+	ld a, [wd265]
+	ld [wCurPartySpecies], a
+	ld [wCurSpecies], a
+	ld hl, wTempMonDVs
+	predef GetUnownLetter
+	call GetBaseData
+	call BillsPC_CopyMon
+.pressed_a_b_right_left
+	ret
+
+.did_nothing
+	xor a
+	ld [wMenuJoypad], a
+	ret
+
+BillsPC_CopyMon: ; e2fd6 (38:6fd6)
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld [wCurPartyMon], a
+	ld a, [wBillsPC_LoadedBox]
+	and a
+	jr z, .party
+	cp NUM_BOXES + 1
+	jr nz, .box
+	ld a, BANK(sBox)
+	call GetSRAMBank
+	ld hl, sBoxSpecies
+	call CopySpeciesToTemp
+	ld hl, sBoxMonNicknames
+	call CopyNicknameToTemp
+	ld hl, sBoxMonOT
+	call CopyOTNameToTemp
+	ld hl, sBoxMons
+	ld bc, BOXMON_STRUCT_LENGTH
+	ld a, [wCurPartyMon]
+	call AddNTimes
+	ld de, wBufferMon
+	ld bc, PARTYMON_STRUCT_LENGTH
+	call CopyBytes
+	call CloseSRAM
+	farcall CalcBufferMonStats
+	ret
+
+.party
+	ld hl, wPartySpecies
+	call CopySpeciesToTemp
+	ld hl, wPartyMonNicknames
+	call CopyNicknameToTemp
+	ld hl, wPartyMonOT
+	call CopyOTNameToTemp
+	ld hl, wPartyMon1
+	ld bc, PARTYMON_STRUCT_LENGTH
+	ld a, [wCurPartyMon]
+	call AddNTimes
+	ld de, wBufferMon
+	ld bc, PARTYMON_STRUCT_LENGTH
+	call CopyBytes
+	ret
+
+.box
+	ld b, a
+	call GetBoxPointer
+	ld a, b
+	call GetSRAMBank
+	push hl
+	inc hl
+	call CopySpeciesToTemp
+	pop hl
+	push hl
+	ld bc, sBoxMonNicknames - sBox
+	add hl, bc
+	call CopyNicknameToTemp
+	pop hl
+	push hl
+	ld bc, sBoxMonOT - sBox
+	add hl, bc
+	call CopyOTNameToTemp
+	pop hl
+	ld bc, sBoxMons - sBox
+	add hl, bc
+	ld bc, BOXMON_STRUCT_LENGTH
+	call CopyMonToTemp
+	call CloseSRAM
+	farcall CalcBufferMonStats
+	ret
+
+DepositPokemon: ; e307c (38:707c)
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld [wCurPartyMon], a
+	ld hl, wPartyMonNicknames
+	ld a, [wCurPartyMon]
+	call GetNick
+	ld a, PC_DEPOSIT
+	ld [wPokemonWithdrawDepositParameter], a
+	predef SendGetMonIntoFromBox
+	jr c, .asm_boxisfull
+	xor a ; REMOVE_PARTY
+	ld [wPokemonWithdrawDepositParameter], a
+	farcall RemoveMonFromPartyOrBox
+	ld a, [wCurPartySpecies]
+	call PlayMonCry
+	hlcoord 0, 0
+	lb bc, 15, 8
+	call ClearBox
+	hlcoord 8, 14
+	lb bc, 1, 3
+	call ClearBox
+	hlcoord 0, 15
+	lb bc, 1, 18
+	call TextBox
+	call WaitBGMap
+	hlcoord 1, 16
+	ld de, PCString_Stored
+	call PlaceString
+	ld l, c
+	ld h, b
+	ld de, wStringBuffer1
+	call PlaceString
+	ld a, "!"
+	ld [bc], a
+	ld c, 50
+	call DelayFrames
+	and a
+	ret
+
+.asm_boxisfull
+	ld de, PCString_BoxFull
+	call BillsPC_PlaceString
+	ld de, SFX_WRONG
+	call WaitPlaySFX
+	call WaitSFX
+	ld c, 50
+	call DelayFrames
+	scf
+	ret
+
+TryWithdrawPokemon: ; e30fa (38:70fa)
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld [wCurPartyMon], a
+	ld a, BANK(sBoxMonNicknames)
+	call GetSRAMBank
+	ld a, [wCurPartyMon]
+	ld hl, sBoxMonNicknames
+	call GetNick
+	call CloseSRAM
+	xor a
+	ld [wPokemonWithdrawDepositParameter], a
+	predef SendGetMonIntoFromBox
+	jr c, .PartyFull
+	ld a, REMOVE_BOX
+	ld [wPokemonWithdrawDepositParameter], a
+	farcall RemoveMonFromPartyOrBox
+	ld a, [wCurPartySpecies]
+	call PlayMonCry
+	hlcoord 0, 0
+	lb bc, 15, 8
+	call ClearBox
+	hlcoord 8, 14
+	lb bc, 1, 3
+	call ClearBox
+	hlcoord 0, 15
+	lb bc, 1, 18
+	call TextBox
+	call WaitBGMap
+	hlcoord 1, 16
+	ld de, PCString_Got
+	call PlaceString
+	ld l, c
+	ld h, b
+	ld de, wStringBuffer1
+	call PlaceString
+	ld a, $e7
+	ld [bc], a
+	ld c, 50
+	call DelayFrames
+	and a
+	ret
+
+.PartyFull:
+	ld de, PCString_PartyFull
+	call BillsPC_PlaceString
+	ld de, SFX_WRONG
+	call WaitPlaySFX
+	call WaitSFX
+	ld c, 50
+	call DelayFrames
+	scf
+	ret
+
+
+ReleasePKMN_ByePKMN: ; e3180 (38:7180)
+	hlcoord 0, 0
+	lb bc, 15, 8
+	call ClearBox
+	hlcoord 8, 14
+	lb bc, 1, 3
+	call ClearBox
+	hlcoord 0, 15
+	lb bc, 1, 18
+	call TextBox
+
+	call WaitBGMap
+	ld a, [wCurPartySpecies]
+	call GetCryIndex
+	jr c, .skip_cry
+	ld e, c
+	ld d, b
+	call PlayCry
+.skip_cry
+
+	ld a, [wCurPartySpecies]
+	ld [wd265], a
+	call GetPokemonName
+	hlcoord 1, 16
+	ld de, PCString_ReleasedPKMN
+	call PlaceString
+	ld c, 80
+	call DelayFrames
+	hlcoord 0, 15
+	lb bc, 1, 18
+	call TextBox
+	hlcoord 1, 16
+	ld de, PCString_Bye
+	call PlaceString
+	ld l, c
+	ld h, b
+	inc hl
+	ld de, wStringBuffer1
+	call PlaceString
+	ld l, c
+	ld h, b
+	ld [hl], $e7
+	ld c, 50
+	call DelayFrames
+	ret
+; e31e7 (38:71e7)
+
+MovePKMNWitoutMail_InsertMon: ; e31e7
+	push hl
+	push de
+	push bc
+	push af
+	hlcoord 0, 15
+	lb bc, 1, 18
+	call TextBox
+	hlcoord 1, 16
+	ld de, .Saving_LeaveOn
+	call PlaceString
+	ld c, 20
+	call DelayFrames
+	pop af
+	pop bc
+	pop de
+	pop hl
+	ld a, [wCurBox]
+	push af
+	ld bc, 0
+	ld a, [wBillsPC_BackupLoadedBox]
+	and a
+	jr nz, .moving_from_box
+	set 0, c
+
+.moving_from_box
+	ld a, [wBillsPC_LoadedBox]
+	and a
+	jr nz, .moving_to_box
+	set 1, c
+
+.moving_to_box
+	ld hl, .Jumptable
+	add hl, bc
+	add hl, bc
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld de, .dw_return
+	push de
+	jp hl
+; e322a
+
+.dw_return ; e322a
+	pop af
+	ld e, a
+	farcall MoveMonWOMail_InsertMon_SaveGame
+	ret
+; e3233
+
+.Saving_LeaveOn:
+	db "Saving… Leave ON!@"
+; e3245
+
+.Jumptable: ; e3245
+	dw .BoxToBox
+	dw .PartyToBox
+	dw .BoxToParty
+	dw .PartyToParty
+; e324d
+
+.BoxToBox: ; e324d
+	ld hl, wBillsPC_BackupLoadedBox
+	ld a, [wBillsPC_LoadedBox]
+	cp [hl]
+	jr z, .same_box
+	call .CopyFromBox
+	call .CopyToBox
+	ret
+
+.same_box
+	call .CopyFromBox
+	call .CheckTrivialMove
+	call .CopyToBox
+	ret
+; e3267
+
+.PartyToBox: ; e3267
+	call .CopyFromParty
+	ld a, $1
+	ld [wGameLogicPaused], a
+	farcall SaveGameData
+	xor a
+	ld [wGameLogicPaused], a
+	call .CopyToBox
+	ret
+; e327d
+
+.BoxToParty: ; e327d
+	call .CopyFromBox
+	call .CopyToParty
+	ret
+; e3284
+
+.PartyToParty: ; e3284
+	call .CopyFromParty
+	call .CheckTrivialMove
+	call .CopyToParty
+	ret
+; e328e
+
+.CheckTrivialMove: ; e328e
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld e, a
+	ld a, [wBillsPC_BackupCursorPosition]
+	ld hl, wBillsPC_BackupScrollPosition
+	add [hl]
+	cp e
+	ret nc
+	ld hl, wBillsPC_CursorPosition
+	ld a, [hl]
+	and a
+	jr z, .top_of_screen
+	dec [hl]
+	ret
+
+.top_of_screen
+	ld hl, wBillsPC_ScrollPosition
+	ld a, [hl]
+	and a
+	ret z
+	dec [hl]
+	ret
+; e32b0
+
+.CopyFromBox: ; e32b0
+	ld a, [wBillsPC_BackupLoadedBox]
+	dec a
+	ld e, a
+	farcall MoveMonWOMail_SaveGame
+	ld a, [wBillsPC_BackupCursorPosition]
+	ld hl, wBillsPC_BackupScrollPosition
+	add [hl]
+	ld [wCurPartyMon], a
+	ld a, BANK(sBox)
+	call GetSRAMBank
+	ld hl, sBoxSpecies
+	call CopySpeciesToTemp
+	ld hl, sBoxMonNicknames
+	call CopyNicknameToTemp
+	ld hl, sBoxMonOT
+	call CopyOTNameToTemp
+	ld hl, sBoxMons
+	ld bc, BOXMON_STRUCT_LENGTH
+	call CopyMonToTemp
+	call CloseSRAM
+	farcall CalcBufferMonStats
+	ld a, REMOVE_BOX
+	ld [wPokemonWithdrawDepositParameter], a
+	farcall RemoveMonFromPartyOrBox
+	ret
+; e32fa
+
+.CopyToBox: ; e32fa
+	ld a, [wBillsPC_LoadedBox]
+	dec a
+	ld e, a
+	farcall MoveMonWOMail_SaveGame
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld [wCurPartyMon], a
+	farcall InsertPokemonIntoBox
+	ret
+; e3316
+
+.CopyFromParty: ; e3316
+	ld a, [wBillsPC_BackupCursorPosition]
+	ld hl, wBillsPC_BackupScrollPosition
+	add [hl]
+	ld [wCurPartyMon], a
+	ld hl, wPartySpecies
+	call CopySpeciesToTemp
+	ld hl, wPartyMonNicknames
+	call CopyNicknameToTemp
+	ld hl, wPartyMonOT
+	call CopyOTNameToTemp
+	ld hl, wPartyMon1Species
+	ld bc, PARTYMON_STRUCT_LENGTH
+	call CopyMonToTemp
+	xor a ; REMOVE_PARTY
+	ld [wPokemonWithdrawDepositParameter], a
+	farcall RemoveMonFromPartyOrBox
+	ret
+; e3346
+
+.CopyToParty: ; e3346
+	ld a, [wBillsPC_CursorPosition]
+	ld hl, wBillsPC_ScrollPosition
+	add [hl]
+	ld [wCurPartyMon], a
+	farcall InsertPokemonIntoParty
+	ret
+; e3357
+
+CopySpeciesToTemp: ; e3357 (38:7357)
+	ld a, [wCurPartyMon]
+	ld c, a
+	ld b, $0
+	add hl, bc
+	ld a, [hl]
+	ld [wCurPartySpecies], a
+	ret
+
+CopyNicknameToTemp: ; e3363 (38:7363)
+	ld bc, MON_NAME_LENGTH
+	ld a, [wCurPartyMon]
+	call AddNTimes
+	ld de, wBufferMonNick
+	ld bc, MON_NAME_LENGTH
+	call CopyBytes
+	ret
+
+CopyOTNameToTemp: ; e3376 (38:7376)
+	ld bc, NAME_LENGTH
+	ld a, [wCurPartyMon]
+	call AddNTimes
+	ld de, wBufferMonOT
+	ld bc, NAME_LENGTH
+	call CopyBytes
+	ret
+
+CopyMonToTemp: ; e3389 (38:7389)
+	ld a, [wCurPartyMon]
+	call AddNTimes
+	ld de, wBufferMon
+	call CopyBytes
+	ret
+
+GetBoxPointer: ; e3396 (38:7396)
+	dec b
+	ld c, b
+	ld b, 0
+	ld hl, .boxes
+	add hl, bc
+	add hl, bc
+	add hl, bc
+	ld a, [hli]
+	ld b, a
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ret
+; e33a6 (38:73a6)
+
+.boxes ; e33a6
+	;  bank, address
+	dba sBox1
+	dba sBox2
+	dba sBox3
+	dba sBox4
+	dba sBox5
+	dba sBox6
+	dba sBox7
+	dba sBox8
+	dba sBox9
+	dba sBox10
+	dba sBox11
+	dba sBox12
+	dba sBox13
+	dba sBox14
+; e33d0
+
+BillsPC_ApplyPalettes: ; e33d0 (38:73d0)
+	ld b, a
+	call GetSGBLayout
+	ld a, %11100100
+	call DmgToCgbBGPals
+	ld a, %11111100
+	call DmgToCgbObjPal0
+	ret
+
+BillsPC_Jumptable: ; e33df (38:73df)
+	ld e, a
+	ld d, $0
+	add hl, de
+	add hl, de
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ret
+
+BillsPC_InitGFX: ; e33e8 (38:73e8)
+	call DisableLCD
+	ld hl, vTiles2 tile $00
+	ld bc, $31 tiles
+	xor a
+	call ByteFill
+	call LoadStandardFont
+	call LoadFontsBattleExtra
+	ld hl, PCMailGFX
+	ld de, vTiles2 tile $5c
+	ld bc, 4 tiles
+	call CopyBytes
+	ld hl, PCSelectLZ
+	ld de, vTiles0 tile $00
+	call Decompress
+	ld a, 6
+	call SkipMusic
+	call EnableLCD
+	ret
+; e3419 (38:7419)
+
+PCSelectLZ: INCBIN "gfx/pc/pc.2bpp.lz"
+PCMailGFX:  INCBIN "gfx/pc/pc_mail.2bpp"
+; e34dd
+
+PCString_ChooseaPKMN: db "Choose a <PK><MN>.@"
+PCString_WhatsUp: db "What's up?@"
+PCString_ReleasePKMN: db "Release <PK><MN>?@"
+PCString_MoveToWhere: db "Move to where?@"
+PCString_ItsYourLastPKMN: db "It's your last <PK><MN>!@"
+PCString_TheresNoRoom: db "There's no room!@"
+PCString_NoMoreUsablePKMN: db "No more usable <PK><MN>!@"
+PCString_RemoveMail: db "Remove MAIL.@"
+PCString_ReleasedPKMN: db "Released <PK><MN>.@"
+PCString_Bye: db "Bye,@"
+PCString_Stored: db "Stored @"
+PCString_Got: db "Got @"
+PCString_Non: db "Non.@"
+PCString_BoxFull: db "The BOX is full.@"
+PCString_PartyFull: db "The party's full!@"
+PCString_NoReleasingEGGS: db "No releasing EGGS!@"
+; e35aa
+
+
+_ChangeBox: ; e35aa (38:75aa)
+	call LoadStandardMenuHeader
+	call BillsPC_ClearTilemap
+.loop
+	xor a
+	ld [hBGMapMode], a
+	call BillsPC_PrintBoxName
+	call BillsPC_PlaceChooseABoxString
+	ld hl, _ChangeBox_MenuHeader
+	call CopyMenuHeader
+	xor a
+	ld [wMenuScrollPosition], a
+	hlcoord 0, 4
+	lb bc, 8, 9
+	call TextBox
+	call ScrollingMenu
+	ld a, [wMenuJoypad]
+	cp B_BUTTON
+	jr z, .done
+	call BillsPC_PlaceWhatsUpString
+	call BillsPC_ChangeBoxSubmenu
+	jr .loop
+.done
+	call CloseWindow
+	ret
+
+BillsPC_ClearTilemap: ; e35e2 (38:75e2)
+	xor a
+	ld [hBGMapMode], a
+	hlcoord 0, 0
+	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+	ld a, " "
+	call ByteFill
+	ret
+; e35f1 (38:75f1)
+
+_ChangeBox_MenuHeader: ; 0xe35f1
+	db MENU_BACKUP_TILES ; flags
+	menu_coords 1, 5, 9, 12
+	dw .MenuData
+	db 1 ; default option
+; 0xe35f9
+
+.MenuData ; 0xe35f9
+	db MENU_UNUSED_1 | MENU_UNUSED_3 ; flags
+	db 4, 0
+	db 1
+	dba .boxes
+	dba .boxnames
+	dba NULL
+	dba BillsPC_PrintBoxCountAndCapacity
+; e3609
+
+.boxes ; e3609
+	db NUM_BOXES
+x = 1
+rept NUM_BOXES
+	db x
+x = x + 1
+endr
+	db -1
+; e3619
+
+.boxnames ; e3619
+	push de
+	ld a, [wMenuSelection]
+	dec a
+	call GetBoxName
+	pop hl
+	call PlaceString
+	ret
+; e3626
+
+GetBoxName: ; e3626 (38:7626)
+	ld bc, BOX_NAME_LENGTH
+	ld hl, wBoxNames
+	call AddNTimes
+	ld d, h
+	ld e, l
+	ret
+; e3632 (38:7632)
+
+BillsPC_PrintBoxCountAndCapacity: ; e3632
+	hlcoord 11, 7
+	lb bc, 5, 7
+	call TextBox
+	ld a, [wMenuSelection]
+	cp -1
+	ret z
+	hlcoord 12, 9
+	ld de, .Pokemon
+	call PlaceString
+	call GetBoxCount
+	ld [wd265], a
+	hlcoord 13, 11
+	ld de, wd265
+	lb bc, 1, 2
+	call PrintNum
+	ld de, .out_of_20
+	call PlaceString
+	ret
+; e3663
+
+.Pokemon: ; e3663
+	db "#MON@"
+; e3668
+
+.out_of_20 ; e3668
+	; db "/20@"
+	db "/"
+	db "0" + MONS_PER_BOX / 10 ; "2"
+	db "0" + MONS_PER_BOX % 10 ; "0"
+	db "@"
+; e366c
+
+GetBoxCount: ; e366c (38:766c)
+	ld a, [wCurBox]
+	ld c, a
+	ld a, [wMenuSelection]
+	dec a
+	cp c
+	jr z, .activebox
+	ld c, a
+	ld b, 0
+	ld hl, .boxbanks
+	add hl, bc
+	add hl, bc
+	add hl, bc
+	ld a, [hli]
+	ld b, a
+	call GetSRAMBank
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	ld a, [hl]
+	call CloseSRAM
+	ld c, a
+	ld a, [wSavedAtLeastOnce]
+	and a
+	jr z, .newfile
+	ld a, c
+	ret
+
+.newfile
+	xor a
+	ret
+
+.activebox
+	ld a, BANK(sBoxCount)
+	ld b, a
+	call GetSRAMBank
+	ld hl, sBoxCount
+	ld a, [hl]
+	call CloseSRAM
+	ret
+; e36a5 (38:76a5)
+
+.boxbanks ; e36a5
+	dba sBox1
+	dba sBox2
+	dba sBox3
+	dba sBox4
+	dba sBox5
+	dba sBox6
+	dba sBox7
+	dba sBox8
+	dba sBox9
+	dba sBox10
+	dba sBox11
+	dba sBox12
+	dba sBox13
+	dba sBox14
+; e36cf
+
+BillsPC_PrintBoxName: ; e36cf (38:76cf)
+	hlcoord 0, 0
+	ld b, 2
+	ld c, 18
+	call TextBox
+	hlcoord 1, 2
+	ld de, .Current
+	call PlaceString
+	ld a, [wCurBox]
+	and $f
+	call GetBoxName
+	hlcoord 11, 2
+	call PlaceString
+	ret
+; e36f1 (38:76f1)
+
+.Current: ; e36f1
+	db "CURRENT@"
+; e36f9
+
+BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9)
+	ld hl, .MenuHeader
+	call LoadMenuHeader
+	call VerticalMenu
+	call ExitMenu
+	ret c
+	ld a, [wMenuCursorY]
+	cp $1
+	jr z, .Switch
+	cp $2
+	jr z, .Name
+	cp $3
+	jr z, .Print
+	and a
+	ret
+
+.Print:
+	call GetBoxCount
+	and a
+	jr z, .EmptyBox
+	ld e, l
+	ld d, h
+	ld a, [wMenuSelection]
+	dec a
+	ld c, a
+	farcall PrintPCBox
+	call BillsPC_ClearTilemap
+	and a
+	ret
+
+.EmptyBox:
+	call BillsPC_PlaceEmptyBoxString_SFX
+	and a
+	ret
+
+.Switch:
+	ld a, [wMenuSelection]
+	dec a
+	ld e, a
+	ld a, [wCurBox]
+	cp e
+	ret z
+	farcall ChangeBoxSaveGame
+	ret
+
+.Name:
+	ld b, $4 ; box
+	ld de, wd002
+	farcall NamingScreen
+	call ClearTileMap
+	call LoadStandardFont
+	call LoadFontsBattleExtra
+	ld a, [wMenuSelection]
+	dec a
+	call GetBoxName
+	ld e, l
+	ld d, h
+	ld hl, wd002
+	ld c, BOX_NAME_LENGTH - 1
+	call InitString
+	ld a, [wMenuSelection]
+	dec a
+	call GetBoxName
+	ld de, wd002
+	call CopyName2
+	ret
+; e3778 (38:7778)
+
+	hlcoord 11, 7 ; unused
+
+.MenuHeader: ; 0xe377b
+	db MENU_BACKUP_TILES ; flags
+	menu_coords 11, 4, SCREEN_WIDTH - 1, 13
+	dw .MenuData
+	db 1 ; default option
+; 0xe3783
+
+.MenuData: ; 0xe3783
+	db STATICMENU_CURSOR ; flags
+	db 4 ; items
+	db "SWITCH@"
+	db "NAME@"
+	db "PRINT@"
+	db "QUIT@"
+; 0xe379c
+
+BillsPC_PlaceChooseABoxString: ; e379c (38:779c)
+	ld de, .ChooseABox
+	jr BillsPC_PlaceChangeBoxString
+; e37a1 (38:77a1)
+
+.ChooseABox: ; e37a1
+	db "Choose a BOX.@"
+; e37af
+
+BillsPC_PlaceWhatsUpString: ; e37af (38:77af)
+	ld de, .WhatsUp
+	jr BillsPC_PlaceChangeBoxString
+; e37b4 (38:77b4)
+
+.WhatsUp: ; e37b4
+	db "What's up?@"
+; e37be
+
+BillsPC_PlaceEmptyBoxString_SFX: ; e37be (38:77be)
+	ld de, .NoMonString
+	call BillsPC_PlaceChangeBoxString
+	ld de, SFX_WRONG
+	call WaitPlaySFX
+	call WaitSFX
+	ld c, 50
+	call DelayFrames
+	ret
+; e37d3 (38:77d3)
+
+.NoMonString: ; e37d3
+	db "There's no #MON.@"
+; e37e3
+
+BillsPC_PlaceChangeBoxString: ; e37e3 (38:77e3)
+	push de
+	hlcoord 0, 14
+	lb bc, 2, 18
+	call TextBox
+	pop de
+	hlcoord 1, 16
+	call PlaceString
+	ld a, $1
+	ld [hBGMapMode], a
+	ret
--- /dev/null
+++ b/engine/pokemon/bills_pc_top.asm
@@ -1,0 +1,387 @@
+_BillsPC: ; e3fd
+	call .CheckCanUsePC
+	ret c
+	call .LogIn
+	call .UseBillsPC
+	jp .LogOut
+
+.CheckCanUsePC: ; e40a (3:640a)
+	ld a, [wPartyCount]
+	and a
+	ret nz
+	ld hl, .Text_GottaHavePokemon
+	call MenuTextBoxBackup
+	scf
+	ret
+
+.Text_GottaHavePokemon: ; 0xe417
+	; You gotta have #MON to call!
+	text_jump UnknownText_0x1c1006
+	db "@"
+
+.LogIn: ; e41c (3:641c)
+	xor a
+	ld [hBGMapMode], a
+	call LoadStandardMenuHeader
+	call ClearPCItemScreen
+	ld hl, wOptions
+	ld a, [hl]
+	push af
+	set NO_TEXT_SCROLL, [hl]
+	ld hl, .Text_What
+	call PrintText
+	pop af
+	ld [wOptions], a
+	call LoadFontsBattleExtra
+	ret
+
+.Text_What: ; 0xe43a
+	; What?
+	text_jump UnknownText_0x1c1024
+	db "@"
+
+.LogOut: ; e43f (3:643f)
+	call CloseSubmenu
+	ret
+
+.UseBillsPC: ; e443 (3:6443)
+	ld hl, .MenuHeader
+	call LoadMenuHeader
+	ld a, $1
+.loop
+	ld [wMenuCursorBuffer], a
+	call SetPalettes
+	xor a
+	ld [wWhichIndexSet], a
+	ld [hBGMapMode], a
+	call DoNthMenu
+	jr c, .cancel
+	ld a, [wMenuCursorBuffer]
+	push af
+	ld a, [wMenuSelection]
+	ld hl, .Jumptable
+	rst JumpTable
+	pop bc
+	ld a, b
+	jr nc, .loop
+.cancel
+	call CloseWindow
+	ret
+
+.MenuHeader: ; 0xe46f
+	db MENU_BACKUP_TILES ; flags
+	menu_coords 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
+	dw .MenuData
+	db 1 ; default option
+
+.MenuData: ; 0xe477
+	db STATICMENU_CURSOR ; flags
+	db 0 ; items
+	dw .items
+	dw PlaceMenuStrings
+	dw .strings
+
+.strings ; e47f
+	db "WITHDRAW <PK><MN>@"
+	db "DEPOSIT <PK><MN>@"
+	db "CHANGE BOX@"
+	db "MOVE <PK><MN> W/O MAIL@"
+	db "SEE YA!@"
+
+.Jumptable: ; e4ba (3:64ba)
+	dw BillsPC_WithdrawMenu
+	dw BillsPC_DepositMenu
+	dw BillsPC_ChangeBoxMenu
+	dw BillsPC_MovePKMNMenu
+	dw BillsPC_SeeYa
+
+.items ; e4c4
+	db 5
+	db 0 ; WITHDRAW
+	db 1;  DEPOSIT
+	db 2 ; CHANGE BOX
+	db 3 ; MOVE PKMN
+	db 4 ; SEE YA!
+	db -1
+
+BillsPC_SeeYa: ; e4cb
+	scf
+	ret
+
+BillsPC_MovePKMNMenu: ; e4cd
+	call LoadStandardMenuHeader
+	farcall IsAnyMonHoldingMail
+	jr nc, .no_mail
+	ld hl, .Text_MonHoldingMail
+	call PrintText
+	jr .quit
+
+.no_mail
+	farcall StartMoveMonWOMail_SaveGame
+	jr c, .quit
+	farcall _MovePKMNWithoutMail
+	call ReturnToMapFromSubmenu
+	call ClearPCItemScreen
+
+.quit
+	call CloseWindow
+	and a
+	ret
+
+.Text_MonHoldingMail: ; 0xe4f9
+	; There is a #MON holding MAIL. Please remove the MAIL.
+	text_jump UnknownText_0x1c102b
+	db "@"
+
+BillsPC_DepositMenu: ; e4fe (3:64fe)
+	call LoadStandardMenuHeader
+	farcall _DepositPKMN
+	call ReturnToMapFromSubmenu
+	call ClearPCItemScreen
+	call CloseWindow
+	and a
+	ret
+
+Unreferenced_Functione512:
+	ld a, [wPartyCount]
+	and a
+	jr z, .no_mon
+	cp 2
+	jr c, .only_one_mon
+	and a
+	ret
+
+.no_mon
+	ld hl, .Text_NoMon
+	call MenuTextBoxBackup
+	scf
+	ret
+
+.only_one_mon
+	ld hl, .Text_ItsYourLastMon
+	call MenuTextBoxBackup
+	scf
+	ret
+
+.Text_NoMon: ; 0xe52e
+	; You don't have a single #MON!
+	text_jump UnknownText_0x1c1062
+	db "@"
+
+.Text_ItsYourLastMon: ; 0xe533
+	; You can't deposit your last #MON!
+	text_jump UnknownText_0x1c1080
+	db "@"
+
+CheckCurPartyMonFainted: ; e538
+	ld hl, wPartyMon1HP
+	ld de, PARTYMON_STRUCT_LENGTH
+	ld b, $0
+.loop
+	ld a, [wCurPartyMon]
+	cp b
+	jr z, .skip
+	ld a, [hli]
+	or [hl]
+	jr nz, .notfainted
+	dec hl
+
+.skip
+	inc b
+	ld a, [wPartyCount]
+	cp b
+	jr z, .done
+	add hl, de
+	jr .loop
+
+.done
+	scf
+	ret
+
+.notfainted
+	and a
+	ret
+
+BillsPC_WithdrawMenu: ; e559 (3:6559)
+	call LoadStandardMenuHeader
+	farcall _WithdrawPKMN
+	call ReturnToMapFromSubmenu
+	call ClearPCItemScreen
+	call CloseWindow
+	and a
+	ret
+
+Unreferenced_Functione56d:
+	ld a, [wPartyCount]
+	cp PARTY_LENGTH
+	jr nc, .asm_e576
+	and a
+	ret
+
+.asm_e576
+	ld hl, UnknownText_0xe57e
+	call MenuTextBoxBackup
+	scf
+	ret
+
+UnknownText_0xe57e: ; 0xe57e
+	; You can't take any more #MON.
+	text_jump UnknownText_0x1c10a2
+	db "@"
+
+BillsPC_ChangeBoxMenu: ; e583 (3:6583)
+	farcall _ChangeBox
+	and a
+	ret
+
+ClearPCItemScreen: ; e58b
+	call DisableSpriteUpdates
+	xor a
+	ld [hBGMapMode], a
+	call ClearBGPalettes
+	call ClearSprites
+	hlcoord 0, 0
+	ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
+	ld a, " "
+	call ByteFill
+	hlcoord 0, 0
+	lb bc, 10, 18
+	call TextBox
+	hlcoord 0, 12
+	lb bc, 4, 18
+	call TextBox
+	call WaitBGMap2
+	call SetPalettes ; load regular palettes?
+	ret
+
+CopyBoxmonToTempMon: ; e5bb
+	ld a, [wCurPartyMon]
+	ld hl, sBoxMon1Species
+	ld bc, BOXMON_STRUCT_LENGTH
+	call AddNTimes
+	ld de, wTempMonSpecies
+	ld bc, BOXMON_STRUCT_LENGTH
+	ld a, BANK(sBoxMon1Species)
+	call GetSRAMBank
+	call CopyBytes
+	call CloseSRAM
+	ret
+
+Unreferenced_Functione5d9:
+	ld a, [wCurBox]
+	cp b
+	jr z, .same_box
+	ld a, b
+	ld hl, .BoxAddrs
+	ld bc, 3
+	call AddNTimes
+	ld a, [hli]
+	push af
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	pop af
+	jr .okay
+
+.same_box
+	ld a, BANK(sBoxCount)
+	ld hl, sBoxCount
+
+.okay
+	call GetSRAMBank
+	ld a, [hl]
+	ld bc, 1 + MONS_PER_BOX + 1
+	add hl, bc
+	ld b, a
+	ld c, $0
+	ld de, wc608
+	ld a, b
+	and a
+	jr z, .empty_box
+.loop
+	push hl
+	push bc
+	ld a, c
+	ld bc, 0
+	add hl, bc
+	ld bc, BOXMON_STRUCT_LENGTH
+	call AddNTimes
+	ld a, [hl]
+	ld [de], a
+	inc de
+	ld [wCurSpecies], a
+	call GetBaseData
+	pop bc
+	pop hl
+
+	push hl
+	push bc
+	ld a, c
+	ld bc, MONS_PER_BOX * (BOXMON_STRUCT_LENGTH + NAME_LENGTH)
+	add hl, bc
+	call SkipNames
+	call CopyBytes
+	pop bc
+	pop hl
+
+	push hl
+	push bc
+	ld a, c
+	ld bc, MON_LEVEL
+	add hl, bc
+	ld bc, BOXMON_STRUCT_LENGTH
+	call AddNTimes
+	ld a, [hl]
+	ld [de], a
+	inc de
+	pop bc
+	pop hl
+
+	push hl
+	push bc
+	ld a, c
+	ld bc, MON_DVS
+	add hl, bc
+	ld bc, BOXMON_STRUCT_LENGTH
+	call AddNTimes
+	ld a, [hli]
+	and $f0
+	ld b, a
+	ld a, [hl]
+	and $f0
+	swap a
+	or b
+	ld b, a
+	ld a, [wBaseGender]
+	cp b
+	ld a, $1
+	jr c, .okay2
+	xor a
+.okay2
+	ld [de], a
+	inc de
+	pop bc
+	pop hl
+
+	inc c
+	dec b
+	jr nz, .loop
+.empty_box
+	call CloseSRAM
+	ret
+
+.BoxAddrs: ; e66e
+	dba sBox1
+	dba sBox2
+	dba sBox3
+	dba sBox4
+	dba sBox5
+	dba sBox6
+	dba sBox7
+	dba sBox8
+	dba sBox9
+	dba sBox10
+	dba sBox11
+	dba sBox12
+	dba sBox13
+	dba sBox14
--- a/engine/pokemon/billspc.asm
+++ /dev/null
@@ -1,2618 +1,0 @@
-_DepositPKMN: ; e2391 (38:6391)
-	ld hl, wOptions
-	ld a, [hl]
-	push af
-	set 4, [hl]
-	ld a, [wVramState]
-	push af
-	xor a
-	ld [wVramState], a
-	ld a, [hInMenu]
-	push af
-	ld a, $1
-	ld [hInMenu], a
-	xor a
-	ld [hMapAnims], a
-	call BillsPC_InitRAM
-	xor a
-	ld [wBillsPC_LoadedBox], a
-	call DelayFrame
-.loop
-	call JoyTextDelay
-	ld a, [wJumptableIndex]
-	bit 7, a
-	jr nz, .done
-	call .RunJumptable
-	call DelayFrame
-	jr .loop
-.done
-	call ClearSprites
-	pop af
-	ld [hInMenu], a
-	pop af
-	ld [wVramState], a
-	pop af
-	ld [wOptions], a
-	ret
-
-.RunJumptable: ; e23d5 (38:63d5)
-	ld a, [wJumptableIndex]
-	ld hl, .Jumptable
-	call BillsPC_Jumptable
-	jp hl
-
-.Jumptable: ; e23df (38:63df)
-	dw .Init
-	dw .HandleJoypad
-	dw .WhatsUp
-	dw .Submenu
-	dw BillsPC_EndJumptableLoop
-
-.Init: ; e23e9 (38:63e9)
-	xor a
-	ld [hBGMapMode], a
-	call ClearSprites
-	call CopyBoxmonSpecies
-	call BillsPC_BoxName
-	ld de, PCString_ChooseaPKMN
-	call BillsPC_PlaceString
-	ld a, $5
-	ld [wBillsPC_NumMonsOnScreen], a
-	call BillsPC_RefreshTextboxes
-	call PCMonInfo
-	ld a, $ff
-	ld [wCurPartySpecies], a
-	ld a, SCGB_BILLS_PC
-	call BillsPC_ApplyPalettes
-	call WaitBGMap
-	call BillsPC_UpdateSelectionCursor
-	call BillsPC_IncrementJumptableIndex
-	ret
-
-.HandleJoypad: ; e241a (38:641a)
-	ld hl, hJoyPressed ; $ffa7
-	ld a, [hl]
-	and B_BUTTON
-	jr nz, .b_button
-	ld a, [hl]
-	and A_BUTTON
-	jr nz, .a_button
-	call Withdraw_UpDown
-	and a
-	ret z
-	call BillsPC_UpdateSelectionCursor
-	xor a
-	ld [hBGMapMode], a
-	call BillsPC_RefreshTextboxes
-	call PCMonInfo
-	ld a, $1
-	ld [hBGMapMode], a
-	call DelayFrame
-	call DelayFrame
-	ret
-
-.a_button
-	call BillsPC_GetSelectedPokemonSpecies
-	and a
-	ret z
-	cp -1
-	jr z, .b_button
-	ld a, $2
-	ld [wJumptableIndex], a
-	ret
-; e2452 (38:6452)
-
-.go_back
-	ld hl, wJumptableIndex
-	dec [hl]
-	ret
-
-.b_button
-	ld a, $4
-	ld [wJumptableIndex], a
-	ret
-
-.WhatsUp: ; e245d (38:645d)
-	xor a
-	ld [hBGMapMode], a
-	call ClearSprites
-	call BillsPC_GetSelectedPokemonSpecies
-	ld [wCurPartySpecies], a
-	ld a, SCGB_BILLS_PC
-	call BillsPC_ApplyPalettes
-	ld de, PCString_WhatsUp
-	call BillsPC_PlaceString
-	ld a, $1
-	ld [wMenuCursorY], a
-	call BillsPC_IncrementJumptableIndex
-	ret
-
-.Submenu: ; e247d (38:647d)
-	ld hl, BillsPCDepositMenuHeader
-	call CopyMenuHeader
-	ld a, [wMenuCursorY]
-	call StoreTo_wMenuCursorBuffer
-	call VerticalMenu
-	jp c, BillsPCDepositFuncCancel
-	ld a, [wMenuCursorY]
-	dec a
-	and %11
-	ld e, a
-	ld d, 0
-	ld hl, BillsPCDepositJumptable
-	add hl, de
-	add hl, de
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	jp hl
-
-BillsPCDepositJumptable: ; e24a1 (38:64a1)
-	dw BillsPCDepositFuncDeposit ; Deposit Pokemon
-	dw BillsPCDepositFuncStats ; Pokemon Stats
-	dw BillsPCDepositFuncRelease ; Release Pokemon
-	dw BillsPCDepositFuncCancel ; Cancel
-
-
-BillsPCDepositFuncDeposit: ; e24a9 (38:64a9)
-	call BillsPC_CheckMail_PreventBlackout
-	jp c, BillsPCDepositFuncCancel
-	call DepositPokemon
-	jr c, .box_full
-	ld a, $0
-	ld [wJumptableIndex], a
-	xor a
-	ld [wBillsPC_CursorPosition], a
-	ld [wBillsPC_ScrollPosition], a
-	ret
-
-.box_full
-	ld de, PCString_WhatsUp
-	call BillsPC_PlaceString
-	ret
-
-BillsPCDepositFuncStats: ; e24c8 (38:64c8)
-	call LoadStandardMenuHeader
-	call BillsPC_StatsScreen
-	call ExitMenu
-	call PCMonInfo
-	call BillsPC_GetSelectedPokemonSpecies
-	ld [wCurPartySpecies], a
-	ld a, SCGB_BILLS_PC
-	call BillsPC_ApplyPalettes
-	ret
-
-BillsPCDepositFuncRelease: ; e24e0 (38:64e0)
-	call BillsPC_CheckMail_PreventBlackout
-	jr c, BillsPCDepositFuncCancel
-	call BillsPC_IsMonAnEgg
-	jr c, BillsPCDepositFuncCancel
-	ld a, [wMenuCursorY]
-	push af
-	ld de, PCString_ReleasePKMN
-	call BillsPC_PlaceString
-	call LoadStandardMenuHeader
-	lb bc, 14, 11
-	call PlaceYesNoBox
-	ld a, [wMenuCursorY]
-	dec a
-	call ExitMenu
-	and a
-	jr nz, .failed_release
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld [wCurPartyMon], a
-	xor a ; REMOVE_PARTY
-	ld [wPokemonWithdrawDepositParameter], a
-	farcall RemoveMonFromPartyOrBox
-	call ReleasePKMN_ByePKMN
-	ld a, $0
-	ld [wJumptableIndex], a
-	xor a
-	ld [wBillsPC_CursorPosition], a
-	ld [wBillsPC_ScrollPosition], a
-	pop af
-	ret
-
-.failed_release
-	ld de, PCString_WhatsUp
-	call BillsPC_PlaceString
-	pop af
-	ld [wMenuCursorY], a
-	ret
-
-BillsPCDepositFuncCancel: ; e2537 (38:6537)
-	ld a, $0
-	ld [wJumptableIndex], a
-	ret
-; e253d (38:653d)
-
-BillsPCDepositMenuHeader: ; 0xe253d (38:653d)
-	db MENU_BACKUP_TILES ; flags
-	menu_coords 9, 4, SCREEN_WIDTH - 1, 13
-	dw .MenuData
-	db 1 ; default option
-; 0xe2545
-
-.MenuData: ; 0xe2545 (38:6545)
-	db STATICMENU_CURSOR ; flags
-	db 4 ; items
-	db "DEPOSIT@"
-	db "STATS@"
-	db "RELEASE@"
-	db "CANCEL@"
-; 0xe2564 (38:6564)
-
-Unreferenced_BillsPCClearThreeBoxes: ; e2564
-	hlcoord 0, 0
-	ld b,  4
-	ld c,  8
-	call ClearBox
-	hlcoord 0, 4
-	ld b, 10
-	ld c,  9
-	call ClearBox
-	hlcoord 0, 14
-	ld b,  2
-	ld c,  8
-	call ClearBox
-	ret
-; e2583
-
-_WithdrawPKMN: ; e2583 (38:6583)
-	ld hl, wOptions
-	ld a, [hl]
-	push af
-	set 4, [hl]
-	ld a, [wVramState]
-	push af
-	xor a
-	ld [wVramState], a
-	ld a, [hInMenu]
-	push af
-	ld a, $1
-	ld [hInMenu], a
-	xor a
-	ld [hMapAnims], a
-	call BillsPC_InitRAM
-	ld a, NUM_BOXES + 1
-	ld [wBillsPC_LoadedBox], a
-	call DelayFrame
-.loop
-	call JoyTextDelay
-	ld a, [wJumptableIndex]
-	bit 7, a
-	jr nz, .done
-	call .RunJumptable
-	call DelayFrame
-	jr .loop
-.done
-	call ClearSprites
-	pop af
-	ld [hInMenu], a
-	pop af
-	ld [wVramState], a
-	pop af
-	ld [wOptions], a
-	ret
-
-.RunJumptable: ; e25c8 (38:65c8)
-	ld a, [wJumptableIndex]
-	ld hl, .Jumptable
-	call BillsPC_Jumptable
-	jp hl
-
-.Jumptable: ; e25d2 (38:65d2)
-	dw .Init
-	dw .Joypad
-	dw .PrepSubmenu
-	dw BillsPC_Withdraw
-	dw BillsPC_EndJumptableLoop
-
-.Init: ; e25dc (38:65dc)
-	ld a, NUM_BOXES + 1
-	ld [wBillsPC_LoadedBox], a
-	xor a
-	ld [hBGMapMode], a
-	call ClearSprites
-	call CopyBoxmonSpecies
-	call BillsPC_BoxName
-	ld de, PCString_ChooseaPKMN
-	call BillsPC_PlaceString
-	ld a, $5
-	ld [wBillsPC_NumMonsOnScreen], a
-	call BillsPC_RefreshTextboxes
-	call PCMonInfo
-	ld a, $ff
-	ld [wCurPartySpecies], a
-	ld a, SCGB_BILLS_PC
-	call BillsPC_ApplyPalettes
-	call WaitBGMap
-	call BillsPC_UpdateSelectionCursor
-	call BillsPC_IncrementJumptableIndex
-	ret
-
-.Joypad: ; e2612 (38:6612)
-	ld hl, hJoyPressed ; $ffa7
-	ld a, [hl]
-	and B_BUTTON
-	jr nz, .b_button
-	ld a, [hl]
-	and A_BUTTON
-	jr nz, .a_button
-	call Withdraw_UpDown
-	and a
-	ret z
-	call BillsPC_UpdateSelectionCursor
-	xor a
-	ld [hBGMapMode], a
-	call BillsPC_RefreshTextboxes
-	call PCMonInfo
-	ld a, $1
-	ld [hBGMapMode], a
-	call DelayFrame
-	call DelayFrame
-	ret
-.a_button
-	call BillsPC_GetSelectedPokemonSpecies
-	and a
-	ret z
-	cp -1
-	jr z, .b_button
-	ld a, $2
-	ld [wJumptableIndex], a
-	ret ; e264a (38:664a)
-
-.unused
-	ld hl, wJumptableIndex
-	dec [hl]
-	ret
-
-.b_button
-	ld a, $4
-	ld [wJumptableIndex], a
-	ret
-; e2655
-
-.PrepSubmenu: ; e2655 (38:6655)
-	xor a
-	ld [hBGMapMode], a
-	call ClearSprites
-	call BillsPC_GetSelectedPokemonSpecies
-	ld [wCurPartySpecies], a
-	ld a, SCGB_BILLS_PC
-	call BillsPC_ApplyPalettes
-	ld de, PCString_WhatsUp
-	call BillsPC_PlaceString
-	ld a, $1
-	ld [wMenuCursorY], a
-	call BillsPC_IncrementJumptableIndex
-	ret
-
-BillsPC_Withdraw: ; e2675 (38:6675)
-	ld hl, .MenuHeader
-	call CopyMenuHeader
-	ld a, [wMenuCursorY]
-	call StoreTo_wMenuCursorBuffer
-	call VerticalMenu
-	jp c, .cancel
-	ld a, [wMenuCursorY]
-	dec a
-	and %11
-	ld e, a
-	ld d, 0
-	ld hl, .dw
-	add hl, de
-	add hl, de
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	jp hl
-
-.dw ; e2699 (38:6699) #mark
-	dw .withdraw ; Withdraw
-	dw .stats ; Stats
-	dw .release ; Release
-	dw .cancel ; Cancel
-
-
-.withdraw ; e26a1 (38:66a1)
-	call BillsPC_CheckMail_PreventBlackout
-	jp c, .cancel
-	call TryWithdrawPokemon
-	jr c, .FailedWithdraw
-	ld a, $0
-	ld [wJumptableIndex], a
-	xor a
-	ld [wBillsPC_CursorPosition], a
-	ld [wBillsPC_ScrollPosition], a
-	ret
-.FailedWithdraw:
-	ld de, PCString_WhatsUp
-	call BillsPC_PlaceString
-	ret
-
-.stats ; e26c0 (38:66c0)
-	call LoadStandardMenuHeader
-	call BillsPC_StatsScreen
-	call ExitMenu
-	call PCMonInfo
-	call BillsPC_GetSelectedPokemonSpecies
-	ld [wCurPartySpecies], a
-	ld a, SCGB_BILLS_PC
-	call BillsPC_ApplyPalettes
-	ret
-
-.release ; e26d8 (38:66d8)
-	ld a, [wMenuCursorY]
-	push af
-	call BillsPC_IsMonAnEgg
-	jr c, .FailedRelease
-	ld de, PCString_ReleasePKMN
-	call BillsPC_PlaceString
-	call LoadStandardMenuHeader
-	lb bc, 14, 11
-	call PlaceYesNoBox
-	ld a, [wMenuCursorY]
-	dec a
-	call ExitMenu
-	and a
-	jr nz, .FailedRelease
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld [wCurPartyMon], a
-	ld a, REMOVE_BOX
-	ld [wPokemonWithdrawDepositParameter], a
-	farcall RemoveMonFromPartyOrBox
-	call ReleasePKMN_ByePKMN
-	ld a, $0
-	ld [wJumptableIndex], a
-	xor a
-	ld [wBillsPC_CursorPosition], a
-	ld [wBillsPC_ScrollPosition], a
-	pop af
-	ret
-.FailedRelease:
-	ld de, PCString_WhatsUp
-	call BillsPC_PlaceString
-	pop af
-	ld [wMenuCursorY], a
-	ret
-
-.cancel ; e272b (38:672b)
-	ld a, $0
-	ld [wJumptableIndex], a
-	ret
-; e2731 (38:6731)
-
-.MenuHeader: ; 0xe2731
-	db MENU_BACKUP_TILES ; flags
-	menu_coords 9, 4, SCREEN_WIDTH - 1, 13
-	dw .MenuData
-	db 1 ; default option
-; 0xe2739
-
-.MenuData: ; 0xe2739
-	db STATICMENU_CURSOR ; flags
-	db 4 ; items
-	db "WITHDRAW@"
-	db "STATS@"
-	db "RELEASE@"
-	db "CANCEL@"
-; 0xe2759
-
-_MovePKMNWithoutMail: ; e2759
-	ld hl, wOptions
-	ld a, [hl]
-	push af
-	set 4, [hl]
-	ld a, [wVramState]
-	push af
-	xor a
-	ld [wVramState], a
-	ld a, [hInMenu]
-	push af
-	ld a, $1
-	ld [hInMenu], a
-	xor a
-	ld [hMapAnims], a
-	call BillsPC_InitRAM
-	ld a, [wCurBox]
-	and $f
-	inc a
-	ld [wBillsPC_LoadedBox], a
-	call DelayFrame
-.asm_e2781
-	call JoyTextDelay
-	ld a, [wJumptableIndex]
-	bit 7, a
-	jr nz, .asm_e2793
-	call .RunJumptable
-	call DelayFrame
-	jr .asm_e2781
-
-.asm_e2793
-	call ClearSprites
-	pop af
-	ld [hInMenu], a
-	pop af
-	ld [wVramState], a
-	pop af
-	ld [wOptions], a
-	ret
-; e27a2
-
-.RunJumptable: ; e27a2
-	ld a, [wJumptableIndex]
-	ld hl, .Jumptable
-	call BillsPC_Jumptable
-	jp hl
-; e27ac
-
-.Jumptable: ; e27ac
-	dw .Init
-	dw .Joypad
-	dw .PrepSubmenu
-	dw .MoveMonWOMailSubmenu
-	dw .PrepInsertCursor
-	dw .Joypad2
-	dw BillsPC_EndJumptableLoop
-; e27ba
-
-.Init: ; e27ba
-	xor a
-	ld [hBGMapMode], a
-	call ClearSprites
-	call CopyBoxmonSpecies
-	ld de, PCString_ChooseaPKMN
-	call BillsPC_PlaceString
-	ld a, 5
-	ld [wBillsPC_NumMonsOnScreen], a
-	call BillsPC_RefreshTextboxes
-	call BillsPC_MoveMonWOMail_BoxNameAndArrows
-	call PCMonInfo
-	ld a, $ff
-	ld [wCurPartySpecies], a
-	ld a, SCGB_BILLS_PC
-	call BillsPC_ApplyPalettes
-	call WaitBGMap
-	call BillsPC_UpdateSelectionCursor
-	call BillsPC_IncrementJumptableIndex
-	ret
-; e27eb
-
-.Joypad: ; e27eb
-	ld hl, hJoyPressed
-	ld a, [hl]
-	and B_BUTTON
-	jr nz, .b_button
-	ld a, [hl]
-	and A_BUTTON
-	jr nz, .a_button
-	call MoveMonWithoutMail_DPad
-	jr c, .d_pad
-	and a
-	ret z
-	call BillsPC_UpdateSelectionCursor
-	xor a
-	ld [hBGMapMode], a
-	call BillsPC_RefreshTextboxes
-	call PCMonInfo
-	ld a, $1
-	ld [hBGMapMode], a
-	call DelayFrame
-	call DelayFrame
-	ret
-
-.d_pad
-	xor a
-	ld [wBillsPC_CursorPosition], a
-	ld [wBillsPC_ScrollPosition], a
-	ld a, $0
-	ld [wJumptableIndex], a
-	ret
-
-.a_button
-	call BillsPC_GetSelectedPokemonSpecies
-	and a
-	ret z
-	cp -1
-	jr z, .b_button
-	ld a, $2
-	ld [wJumptableIndex], a
-	ret
-
-.unused
-	ld hl, wJumptableIndex
-	dec [hl]
-	ret
-
-.b_button
-	ld a, $6
-	ld [wJumptableIndex], a
-	ret
-; e283d
-
-.PrepSubmenu: ; e283d
-	xor a
-	ld [hBGMapMode], a
-	call ClearSprites
-	call BillsPC_GetSelectedPokemonSpecies
-	ld [wCurPartySpecies], a
-	ld a, SCGB_BILLS_PC
-	call BillsPC_ApplyPalettes
-	ld de, PCString_WhatsUp
-	call BillsPC_PlaceString
-	ld a, $1
-	ld [wMenuCursorY], a
-	call BillsPC_IncrementJumptableIndex
-	ret
-; e285d
-
-.MoveMonWOMailSubmenu: ; e285d
-	ld hl, .MenuHeader
-	call CopyMenuHeader
-	ld a, [wMenuCursorY]
-	call StoreTo_wMenuCursorBuffer
-	call VerticalMenu
-	jp c, .Cancel
-	ld a, [wMenuCursorY]
-	dec a
-	and %11
-	ld e, a
-	ld d, 0
-	ld hl, .Jumptable2
-	add hl, de
-	add hl, de
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	jp hl
-; e2881
-
-.Jumptable2: ; e2881
-	dw .Move
-	dw .Stats
-	dw .Cancel
-; e2887
-
-.Move: ; e2887
-	call BillsPC_CheckMail_PreventBlackout
-	jp c, .Cancel
-	ld a, [wBillsPC_ScrollPosition]
-	ld [wBillsPC_BackupScrollPosition], a
-	ld a, [wBillsPC_CursorPosition]
-	ld [wBillsPC_BackupCursorPosition], a
-	ld a, [wBillsPC_LoadedBox]
-	ld [wBillsPC_BackupLoadedBox], a
-	ld a, $4
-	ld [wJumptableIndex], a
-	ret
-; e28a5
-
-.Stats: ; e28a5
-	call LoadStandardMenuHeader
-	call BillsPC_StatsScreen
-	call ExitMenu
-	call PCMonInfo
-	call BillsPC_GetSelectedPokemonSpecies
-	ld [wCurPartySpecies], a
-	ld a, SCGB_BILLS_PC
-	call BillsPC_ApplyPalettes
-	ret
-; e28bd
-
-.Cancel: ; e28bd
-	ld a, $0
-	ld [wJumptableIndex], a
-	ret
-; e28c3
-
-.MenuHeader: ; 0xe28c3
-	db MENU_BACKUP_TILES ; flags
-	menu_coords 9, 4, SCREEN_WIDTH - 1, 13
-	dw .MenuData
-	db 1 ; default option
-; 0xe28cb
-
-.MenuData: ; 0xe28cb
-	db STATICMENU_CURSOR ; flags
-	db 3 ; items
-	db "MOVE@"
-	db "STATS@"
-	db "CANCEL@"
-; 0xe28df
-
-.PrepInsertCursor: ; e28df
-	xor a
-	ld [hBGMapMode], a
-	call CopyBoxmonSpecies
-	ld de, PCString_MoveToWhere
-	call BillsPC_PlaceString
-	ld a, $5
-	ld [wBillsPC_NumMonsOnScreen], a
-	call BillsPC_RefreshTextboxes
-	call BillsPC_MoveMonWOMail_BoxNameAndArrows
-	call ClearSprites
-	call BillsPC_UpdateInsertCursor
-	call WaitBGMap
-	call BillsPC_IncrementJumptableIndex
-	ret
-; e2903
-
-.Joypad2: ; e2903
-	ld hl, hJoyPressed
-	ld a, [hl]
-	and B_BUTTON
-	jr nz, .b_button_2
-	ld a, [hl]
-	and A_BUTTON
-	jr nz, .a_button_2
-	call MoveMonWithoutMail_DPad_2
-	jr c, .dpad_2
-	and a
-	ret z
-	call BillsPC_UpdateInsertCursor
-	xor a
-	ld [hBGMapMode], a
-	call BillsPC_RefreshTextboxes
-	ld a, $1
-	ld [hBGMapMode], a
-	call DelayFrame
-	call DelayFrame
-	ret
-
-.dpad_2
-	xor a
-	ld [wBillsPC_CursorPosition], a
-	ld [wBillsPC_ScrollPosition], a
-	ld a, $4
-	ld [wJumptableIndex], a
-	ret
-
-.a_button_2
-	call BillsPC_CheckSpaceInDestination
-	jr c, .no_space
-	call MovePKMNWitoutMail_InsertMon
-	ld a, $0
-	ld [wJumptableIndex], a
-	ret
-
-.no_space
-	ld hl, wJumptableIndex
-	dec [hl]
-	ret
-
-.b_button_2
-	ld a, [wBillsPC_BackupScrollPosition]
-	ld [wBillsPC_ScrollPosition], a
-	ld a, [wBillsPC_BackupCursorPosition]
-	ld [wBillsPC_CursorPosition], a
-	ld a, [wBillsPC_BackupLoadedBox]
-	ld [wBillsPC_LoadedBox], a
-	ld a, $0
-	ld [wJumptableIndex], a
-	ret
-; e2963
-
-BillsPC_InitRAM: ; e2963 (38:6963)
-	call ClearBGPalettes
-	call ClearSprites
-	call ClearTileMap
-	call BillsPC_InitGFX
-	ld hl, wBillsPCPokemonList
-	ld bc, $338
-	xor a
-	call ByteFill
-	xor a
-	ld [wJumptableIndex], a
-	ld [wcf64], a
-	ld [wcf65], a
-	ld [wcf66], a
-	ld [wBillsPC_CursorPosition], a
-	ld [wBillsPC_ScrollPosition], a
-	ret
-
-BillsPC_IncrementJumptableIndex: ; e298d (38:698d)
-	ld hl, wJumptableIndex
-	inc [hl]
-	ret
-
-BillsPC_EndJumptableLoop: ; e2992 (38:6992)
-	ld hl, wJumptableIndex
-	set 7, [hl]
-	ret
-
-_StatsScreenDPad: ; e2998 (38:6998)
-	ld a, [wBillsPC_NumMonsOnScreen]
-	ld d, a
-	ld a, [wBillsPC_NumMonsInBox]
-	and a
-	jr z, .empty
-	dec a
-	cp $1
-	jr z, .empty
-	ld e, a
-	ld a, [hl]
-	and D_UP
-	jr nz, BillsPC_PressUp
-	ld a, [hl]
-	and D_DOWN
-	jr nz, BillsPC_PressDown
-.empty
-	jp BillsPC_JoypadDidNothing
-
-Withdraw_UpDown: ; e29b5 (38:69b5)
-	ld hl, hJoyLast
-	ld a, [wBillsPC_NumMonsOnScreen]
-	ld d, a
-	ld a, [wBillsPC_NumMonsInBox]
-	ld e, a
-	and a
-	jr z, .empty
-	ld a, [hl]
-	and D_UP
-	jr nz, BillsPC_PressUp
-	ld a, [hl]
-	and D_DOWN
-	jr nz, BillsPC_PressDown
-.empty
-	jp BillsPC_JoypadDidNothing
-; e29d0 (38:69d0)
-
-MoveMonWithoutMail_DPad: ; e29d0
-	ld hl, hJoyLast
-	ld a, [wBillsPC_NumMonsOnScreen]
-	ld d, a
-	ld a, [wBillsPC_NumMonsInBox]
-	ld e, a
-	and a
-	jr z, .check_left_right
-	ld a, [hl]
-	and D_UP
-	jr nz, BillsPC_PressUp
-	ld a, [hl]
-	and D_DOWN
-	jr nz, BillsPC_PressDown
-
-.check_left_right
-	ld a, [hl]
-	and D_LEFT
-	jr nz, BillsPC_PressLeft
-	ld a, [hl]
-	and D_RIGHT
-	jr nz, BillsPC_PressRight
-	jr BillsPC_JoypadDidNothing
-
-MoveMonWithoutMail_DPad_2: ; e29f4
-	ld hl, hJoyLast
-	ld a, [wBillsPC_NumMonsOnScreen]
-	ld d, a
-	ld a, [wBillsPC_NumMonsInBox]
-	ld e, a
-	and a
-	jr z, .check_left_right
-
-	ld a, [hl]
-	and D_UP
-	jr nz, BillsPC_PressUp
-	ld a, [hl]
-	and D_DOWN
-	jr nz, BillsPC_PressDown
-
-.check_left_right
-	ld a, [hl]
-	and D_LEFT
-	jr nz, BillsPC_PressLeft
-	ld a, [hl]
-	and D_RIGHT
-	jr nz, BillsPC_PressRight
-	jr BillsPC_JoypadDidNothing
-
-BillsPC_PressUp: ; e2a18 (38:6a18)
-	ld hl, wBillsPC_CursorPosition
-	ld a, [hl]
-	and a
-	jr z, .top
-	dec [hl]
-	jr BillsPC_UpDownDidSomething
-
-.top
-	ld hl, wBillsPC_ScrollPosition
-	ld a, [hl]
-	and a
-	jr z, BillsPC_JoypadDidNothing
-	dec [hl]
-	jr BillsPC_UpDownDidSomething
-
-BillsPC_PressDown: ; e2a2c (38:6a2c)
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	inc a
-	cp e
-	jr nc, BillsPC_JoypadDidNothing
-
-	ld hl, wBillsPC_CursorPosition
-	ld a, [hl]
-	inc a
-	cp d
-	jr nc, .not_bottom
-	inc [hl]
-	jr BillsPC_UpDownDidSomething
-
-.not_bottom
-	ld hl, wBillsPC_ScrollPosition
-	inc [hl]
-	jr BillsPC_UpDownDidSomething
-; e2a48 (38:6a48)
-
-BillsPC_PressLeft: ; e2a48
-	ld hl, wBillsPC_LoadedBox
-	ld a, [hl]
-	and a
-	jr z, .wrap_around
-	dec [hl]
-	jr BillsPC_LeftRightDidSomething
-
-.wrap_around
-	ld [hl], NUM_BOXES
-	jr BillsPC_LeftRightDidSomething
-
-BillsPC_PressRight: ; e2a56
-	ld hl, wBillsPC_LoadedBox
-	ld a, [hl]
-	cp NUM_BOXES
-	jr z, .wrap_around
-	inc [hl]
-	jr BillsPC_LeftRightDidSomething
-
-.wrap_around
-	ld [hl], 0
-	jr BillsPC_LeftRightDidSomething
-
-BillsPC_JoypadDidNothing: ; e2a65 (38:6a65)
-	xor a
-	and a
-	ret
-
-BillsPC_UpDownDidSomething: ; e2a68 (38:6a68)
-	ld a, TRUE
-	and a
-	ret
-; e2a6c (38:6a6c)
-
-BillsPC_LeftRightDidSomething: ; e2a6c
-	scf
-	ret
-; e2a6e
-
-BillsPC_PlaceString: ; e2a6e (38:6a6e)
-	push de
-	hlcoord 0, 15
-	lb bc, 1, 18
-	call TextBox
-	pop de
-	hlcoord 1, 16
-	call PlaceString
-	ret
-; e2a80 (38:6a80)
-
-BillsPC_MoveMonWOMail_BoxNameAndArrows: ; e2a80
-	call BillsPC_BoxName
-	hlcoord 8, 1
-	ld [hl], $5f
-	hlcoord 19, 1
-	ld [hl], $5e
-	ret
-; e2a8e
-
-BillsPC_BoxName: ; e2a8e (38:6a8e)
-	hlcoord 8, 0
-	lb bc, 1, 10
-	call TextBox
-
-	ld a, [wBillsPC_LoadedBox]
-	and a
-	jr z, .party
-
-	cp NUM_BOXES + 1
-	jr nz, .gotbox
-
-	ld a, [wCurBox]
-	inc a
-.gotbox
-	dec a
-	ld hl, wBoxNames
-	ld bc, BOX_NAME_LENGTH
-	call AddNTimes
-	ld e, l
-	ld d, h
-	jr .print
-
-.party
-	ld de, .PartyPKMN
-.print
-	hlcoord 10, 1
-	call PlaceString
-	ret
-; e2abd (38:6abd)
-
-.PartyPKMN:
-	db "PARTY <PK><MN>@"
-; e2ac6
-
-PCMonInfo: ; e2ac6 (38:6ac6)
-; Display a monster's pic and
-; attributes when highlighting
-; it in a PC menu.
-
-; Includes the neat cascading
-; effect when showing the pic.
-
-; Example: Species, level, gender,
-; whether it's holding an item.
-
-	hlcoord 0, 0
-	lb bc, 15, 8
-	call ClearBox
-
-	hlcoord 8, 14
-	lb bc, 1, 3
-	call ClearBox
-
-	call BillsPC_GetSelectedPokemonSpecies
-	and a
-	ret z
-	cp -1
-	ret z
-
-	ld [wd265], a
-	hlcoord 1, 4
-	xor a
-	ld b, 7
-.row
-	ld c, 7
-	push af
-	push hl
-.col
-	ld [hli], a
-	add 7
-	dec c
-	jr nz, .col
-	pop hl
-	ld de, SCREEN_WIDTH
-	add hl, de
-	pop af
-	inc a
-	dec b
-	jr nz, .row
-
-	call BillsPC_LoadMonStats
-	ld a, [wd265]
-	ld [wCurPartySpecies], a
-	ld [wCurSpecies], a
-	ld hl, wTempMonDVs
-	predef GetUnownLetter
-	call GetBaseData
-	ld de, vTiles2 tile $00
-	predef GetMonFrontpic
-	xor a
-	ld [wBillsPC_MonHasMail], a
-	ld a, [wCurPartySpecies]
-	ld [wd265], a
-	cp EGG
-	ret z
-
-	call GetBasePokemonName
-	hlcoord 1, 14
-	call PlaceString
-
-	hlcoord 1, 12
-	call PrintLevel
-
-	ld a, $3
-	ld [wMonType], a
-	farcall GetGender
-	jr c, .skip_gender
-	ld a, "♂"
-	jr nz, .printgender
-	ld a, "♀"
-.printgender
-	hlcoord 5, 12
-	ld [hl], a
-.skip_gender
-
-	ld a, [wTempMonItem]
-	and a
-	ret z
-
-	ld d, a
-	callfar ItemIsMail
-	jr c, .mail
-	ld a, $5d ; item icon
-	jr .printitem
-.mail
-	ld a, $1
-	ld [wBillsPC_MonHasMail], a
-	ld a, $5c ; mail icon
-.printitem
-	hlcoord 7, 12
-	ld [hl], a
-	ret
-
-BillsPC_LoadMonStats: ; e2b6d (38:6b6d)
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld e, a
-	ld d, $0
-	ld hl, wBillsPCPokemonList + 1 ; box number
-	add hl, de
-	add hl, de
-	add hl, de
-	ld a, [hl]
-	and a
-	jr z, .party
-	cp NUM_BOXES + 1
-	jr z, .sBox
-	ld b, a
-	call GetBoxPointer
-	ld a, b
-	call GetSRAMBank
-	push hl
-	ld bc, sBoxMon1Level - sBox
-	add hl, bc
-	ld bc, BOXMON_STRUCT_LENGTH
-	ld a, e
-	call AddNTimes
-	ld a, [hl]
-	ld [wTempMonLevel], a
-	pop hl
-	push hl
-	ld bc, sBoxMon1Item - sBox
-	add hl, bc
-	ld bc, BOXMON_STRUCT_LENGTH
-	ld a, e
-	call AddNTimes
-	ld a, [hl]
-	ld [wTempMonItem], a
-	pop hl
-	ld bc, sBoxMon1DVs - sBox
-	add hl, bc
-	ld bc, BOXMON_STRUCT_LENGTH
-	ld a, e
-	call AddNTimes
-	ld de, wTempMonDVs
-	ld a, [hli]
-	ld [de], a
-	inc de
-	ld a, [hl]
-	ld [de], a
-	call CloseSRAM
-	ret
-
-.party
-	ld hl, wPartyMon1Level
-	ld bc, PARTYMON_STRUCT_LENGTH
-	ld a, e
-	call AddNTimes
-	ld a, [hl]
-	ld [wTempMonLevel], a
-	ld hl, wPartyMon1Item
-	ld bc, PARTYMON_STRUCT_LENGTH
-	ld a, e
-	call AddNTimes
-	ld a, [hl]
-	ld [wTempMonItem], a
-	ld hl, wPartyMon1DVs
-	ld bc, PARTYMON_STRUCT_LENGTH
-	ld a, e
-	call AddNTimes
-	ld de, wTempMonDVs
-	ld a, [hli]
-	ld [de], a
-	inc de
-	ld a, [hl]
-	ld [de], a
-	ret
-
-.sBox
-	ld a, BANK(sBox)
-	call GetSRAMBank
-	ld hl, sBoxMon1Level
-	ld bc, BOXMON_STRUCT_LENGTH
-	ld a, e
-	call AddNTimes
-	ld a, [hl]
-	ld [wTempMonLevel], a
-
-	ld hl, sBoxMon1Item
-	ld bc, BOXMON_STRUCT_LENGTH
-	ld a, e
-	call AddNTimes
-	ld a, [hl]
-	ld [wTempMonItem], a
-
-	ld hl, sBoxMon1DVs
-	ld bc, BOXMON_STRUCT_LENGTH
-	ld a, e
-	call AddNTimes
-	ld de, wTempMonDVs
-	ld a, [hli]
-	ld [de], a
-	inc de
-	ld a, [hl]
-	ld [de], a
-
-	call CloseSRAM
-	ret
-
-BillsPC_RefreshTextboxes: ; e2c2c (38:6c2c)
-	hlcoord 8, 2
-	lb bc, 10, 10
-	call TextBox
-
-	hlcoord 8, 2
-	ld [hl], "└"
-	hlcoord 19, 2
-	ld [hl], "┘"
-
-	ld a, [wBillsPC_ScrollPosition]
-	ld e, a
-	ld d, 0
-	ld hl, wBillsPCPokemonList
-	add hl, de
-	add hl, de
-	add hl, de
-	ld e, l
-	ld d, h
-	hlcoord 9, 4
-	ld a, [wBillsPC_NumMonsOnScreen]
-.loop
-	push af
-	push de
-	push hl
-	call .PlaceNickname
-	pop hl
-	ld de, 2 * SCREEN_WIDTH
-	add hl, de
-	pop de
-	inc de
-	inc de
-	inc de
-	pop af
-	dec a
-	jr nz, .loop
-	ret
-; e2c67 (38:6c67)
-
-.CancelString:
-	db "CANCEL@"
-; e2c6e
-
-.PlaceNickname: ; e2c6e (38:6c6e)
-	ld a, [de]
-	and a
-	ret z
-	cp -1
-	jr nz, .get_nickname
-	ld de, .CancelString
-	call PlaceString
-	ret
-
-.get_nickname
-	inc de
-	ld a, [de]
-	ld b, a
-	inc de
-	ld a, [de]
-	ld e, a
-	ld a, b
-	and a
-	jr z, .party
-	cp NUM_BOXES + 1
-	jr z, .sBox
-	push hl
-	call GetBoxPointer
-	ld a, b
-	call GetSRAMBank
-	push hl
-	ld bc, sBoxMons - sBox
-	add hl, bc
-	ld bc, BOXMON_STRUCT_LENGTH
-	ld a, e
-	call AddNTimes
-	ld a, [hl]
-	pop hl
-	and a
-	jr z, .boxfail
-	ld bc, sBoxMonNicknames - sBox
-	add hl, bc
-	ld bc, MON_NAME_LENGTH
-	ld a, e
-	call AddNTimes
-	ld de, wStringBuffer1
-	ld bc, MON_NAME_LENGTH
-	call CopyBytes
-	call CloseSRAM
-	pop hl
-	ld de, wStringBuffer1
-	call PlaceString
-	ret
-
-.boxfail
-	call CloseSRAM
-	pop hl
-	jr .placeholder_string
-
-.party
-	push hl
-	ld hl, wPartySpecies
-	ld d, $0
-	add hl, de
-	ld a, [hl]
-	and a
-	jr z, .partyfail
-	ld hl, wPartyMonNicknames
-	ld bc, MON_NAME_LENGTH
-	ld a, e
-	call AddNTimes
-	ld de, wStringBuffer1
-	ld bc, MON_NAME_LENGTH
-	call CopyBytes
-	pop hl
-	ld de, wStringBuffer1
-	call PlaceString
-	ret
-
-.partyfail
-	pop hl
-	jr .placeholder_string
-
-.sBox
-	push hl
-	ld a, BANK(sBox)
-	call GetSRAMBank
-	ld hl, sBoxSpecies
-	ld d, $0
-	add hl, de
-	ld a, [hl]
-	and a
-	jr z, .sBoxFail
-	ld hl, sBoxMonNicknames
-	ld bc, MON_NAME_LENGTH
-	ld a, e
-	call AddNTimes
-	ld de, wStringBuffer1
-	ld bc, MON_NAME_LENGTH
-	call CopyBytes
-	call CloseSRAM
-	pop hl
-	ld de, wStringBuffer1
-	call PlaceString
-	ret
-
-.sBoxFail
-	call CloseSRAM
-	pop hl
-.placeholder_string
-	ld de, .Placeholder
-	call PlaceString
-	ret
-; e2d2a (38:6d2a)
-
-.Placeholder:
-	db "-----@"
-; e2d30
-
-copy_box_data: MACRO
-.loop\@
-	ld a, [hl]
-	cp -1
-	jr z, .done\@
-	and a
-	jr z, .done\@
-	ld [de], a
-	inc de
-	ld a, [wBillsPC_LoadedBox]
-	ld [de], a
-	inc de
-	ld a, [wd003]
-	ld [de], a
-	inc a
-	ld [wd003], a
-	inc de
-	inc hl
-	ld a, [wd004]
-	inc a
-	ld [wd004], a
-	jr .loop\@
-
-.done\@
-if \1
-	call CloseSRAM
-endc
-	ld a, -1
-	ld [de], a
-	ld a, [wd004]
-	inc a
-	ld [wBillsPC_NumMonsInBox], a
-ENDM
-
-CopyBoxmonSpecies: ; e2d30 (38:6d30)
-	xor a
-	ld hl, wBillsPCPokemonList
-	ld bc, 3 * 30
-	call ByteFill
-	ld de, wBillsPCPokemonList
-	xor a
-	ld [wd003], a
-	ld [wd004], a
-	ld a, [wBillsPC_LoadedBox]
-	and a
-	jr z, .party
-	cp NUM_BOXES + 1
-	jr z, .sBox
-	ld b, a
-	call GetBoxPointer
-	ld a, b
-	call GetSRAMBank
-	inc hl
-	copy_box_data 1
-	ret
-
-.party
-	ld hl, wPartySpecies
-	copy_box_data 0
-	ret
-
-.sBox
-	ld a, BANK(sBox)
-	call GetSRAMBank
-	ld hl, sBoxSpecies
-	copy_box_data 1
-	ret
-
-BillsPC_GetSelectedPokemonSpecies: ; e2def (38:6def)
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld e, a
-	ld d, $0
-	ld hl, wBillsPCPokemonList
-	add hl, de
-	add hl, de
-	add hl, de
-	ld a, [hl]
-	ret
-
-BillsPC_UpdateSelectionCursor: ; e2e01 (38:6e01)
-	ld a, [wBillsPC_NumMonsInBox]
-	and a
-	jr nz, .place_cursor
-	call ClearSprites
-	ret
-
-.place_cursor
-	ld hl, .OAM
-	ld de, wVirtualOAMSprite00
-.loop
-	ld a, [hl]
-	cp -1
-	ret z
-	ld a, [wBillsPC_CursorPosition]
-	and $7
-	swap a
-	add [hl]
-	inc hl
-	ld [de], a ; y
-	inc de
-rept SPRITEOAMSTRUCT_LENGTH + -1
-	ld a, [hli]
-	ld [de], a
-	inc de
-endr
-	jr .loop
-; e2e2b (38:6e2b)
-
-.OAM: ; e2e2b
-	dsprite 4, 6, 10, 0, $00, 0
-	dsprite 4, 6, 11, 0, $00, 0
-	dsprite 4, 6, 12, 0, $00, 0
-	dsprite 4, 6, 13, 0, $00, 0
-	dsprite 4, 6, 14, 0, $00, 0
-	dsprite 4, 6, 15, 0, $00, 0
-	dsprite 4, 6, 16, 0, $00, 0
-	dsprite 4, 6, 17, 0, $00, 0
-	dsprite 4, 6, 18, 0, $00, 0
-	dsprite 4, 6, 18, 7, $00, 0
-	dsprite 7, 1, 10, 0, $00, 0 | Y_FLIP
-	dsprite 7, 1, 11, 0, $00, 0 | Y_FLIP
-	dsprite 7, 1, 12, 0, $00, 0 | Y_FLIP
-	dsprite 7, 1, 13, 0, $00, 0 | Y_FLIP
-	dsprite 7, 1, 14, 0, $00, 0 | Y_FLIP
-	dsprite 7, 1, 15, 0, $00, 0 | Y_FLIP
-	dsprite 7, 1, 16, 0, $00, 0 | Y_FLIP
-	dsprite 7, 1, 17, 0, $00, 0 | Y_FLIP
-	dsprite 7, 1, 18, 0, $00, 0 | Y_FLIP
-	dsprite 7, 1, 18, 7, $00, 0 | Y_FLIP
-	dsprite 5, 6,  9, 6, $01, 0
-	dsprite 6, 1,  9, 6, $01, 0 | Y_FLIP
-	dsprite 5, 6, 19, 1, $01, 0 | X_FLIP
-	dsprite 6, 1, 19, 1, $01, 0 | X_FLIP | Y_FLIP
-	db -1
-; e2e8c
-
-BillsPC_UpdateInsertCursor: ; e2e8c
-	ld hl, .OAM
-	ld de, wVirtualOAMSprite00
-.loop
-	ld a, [hl]
-	cp -1
-	ret z
-	ld a, [wBillsPC_CursorPosition]
-	and $7
-	swap a
-	add [hl]
-	inc hl
-	ld [de], a ; y
-	inc de
-rept SPRITEOAMSTRUCT_LENGTH + -1
-	ld a, [hli]
-	ld [de], a
-	inc de
-endr
-	jr .loop
-; e2eac
-
-.OAM: ; e2eac
-	dsprite 4, 7, 10, 0, $06, 0
-	dsprite 5, 3, 11, 0, $00, 0 | Y_FLIP
-	dsprite 5, 3, 12, 0, $00, 0 | Y_FLIP
-	dsprite 5, 3, 13, 0, $00, 0 | Y_FLIP
-	dsprite 5, 3, 14, 0, $00, 0 | Y_FLIP
-	dsprite 5, 3, 15, 0, $00, 0 | Y_FLIP
-	dsprite 5, 3, 16, 0, $00, 0 | Y_FLIP
-	dsprite 5, 3, 17, 0, $00, 0 | Y_FLIP
-	dsprite 5, 3, 18, 0, $00, 0 | Y_FLIP
-	dsprite 4, 7, 19, 0, $07, 0
-	db -1
-; e2ed5
-
-Unreferenced_BillsPC_FillBox: ; e2ed5
-.row
-	push bc
-	push hl
-.col
-	ld [hli], a
-	dec c
-	jr nz, .col
-	pop hl
-	ld bc, SCREEN_WIDTH
-	add hl, bc
-	pop bc
-	dec b
-	jr nz, .row
-	ret
-; e2ee5
-
-BillsPC_CheckSpaceInDestination: ; e2ee5
-; If moving within a box, no need to be here.
-	ld hl, wBillsPC_LoadedBox
-	ld a, [wBillsPC_BackupLoadedBox]
-	cp [hl]
-	jr z, .same_box
-
-; Exceeding box or party capacity is a big no-no.
-	ld a, [wBillsPC_LoadedBox]
-	and a
-	jr z, .party
-	ld e, MONS_PER_BOX + 1
-	jr .compare
-
-.party
-	ld e, PARTY_LENGTH + 1
-.compare
-	ld a, [wBillsPC_NumMonsInBox]
-	cp e
-	jr nc, .no_room
-.same_box
-	and a
-	ret
-
-.no_room
-	ld de, PCString_TheresNoRoom
-	call BillsPC_PlaceString
-	ld de, SFX_WRONG
-	call WaitPlaySFX
-	call WaitSFX
-	ld c, 50
-	call DelayFrames
-	scf
-	ret
-; e2f18
-
-BillsPC_CheckMail_PreventBlackout: ; e2f18 (38:6f18)
-	ld a, [wBillsPC_LoadedBox]
-	and a
-	jr nz, .Okay
-	ld a, [wBillsPC_NumMonsInBox]
-	cp $3
-	jr c, .ItsYourLastPokemon
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld [wCurPartyMon], a
-	farcall CheckCurPartyMonFainted
-	jr c, .AllOthersFainted
-	ld a, [wBillsPC_MonHasMail]
-	and a
-	jr nz, .HasMail
-.Okay:
-	and a
-	ret
-
-.HasMail:
-	ld de, PCString_RemoveMail
-	jr .NotOkay
-
-.AllOthersFainted:
-	ld de, PCString_NoMoreUsablePKMN
-	jr .NotOkay
-
-.ItsYourLastPokemon:
-	ld de, PCString_ItsYourLastPKMN
-.NotOkay:
-	call BillsPC_PlaceString
-	ld de, SFX_WRONG
-	call WaitPlaySFX
-	call WaitSFX
-	ld c, 50
-	call DelayFrames
-	scf
-	ret
-
-BillsPC_IsMonAnEgg: ; e2f5f (38:6f5f)
-	ld a, [wCurPartySpecies]
-	cp EGG
-	jr z, .egg
-	and a
-	ret
-
-.egg
-	ld de, PCString_NoReleasingEGGS
-	call BillsPC_PlaceString
-	ld de, SFX_WRONG
-	call WaitPlaySFX
-	call WaitSFX
-	ld c, 50
-	call DelayFrames
-	scf
-	ret
-
-BillsPC_StatsScreen: ; e2f7e (38:6f7e)
-	call LowVolume
-	call BillsPC_CopyMon
-	ld a, $3
-	ld [wMonType], a
-	predef StatsScreenInit
-	call BillsPC_InitGFX
-	call MaxVolume
-	ret
-
-StatsScreenDPad: ; e2f95 (38:6f95)
-	ld hl, hJoyPressed ; $ffa7
-	ld a, [hl]
-	and A_BUTTON | B_BUTTON | D_RIGHT | D_LEFT
-	ld [wMenuJoypad], a
-	jr nz, .pressed_a_b_right_left
-	ld a, [hl]
-	and D_DOWN | D_UP
-	ld [wMenuJoypad], a
-	jr nz, .pressed_down_up
-	jr .pressed_a_b_right_left
-
-.pressed_down_up
-	call _StatsScreenDPad
-	and a
-	jr z, .did_nothing
-	call BillsPC_GetSelectedPokemonSpecies
-	ld [wd265], a
-	call BillsPC_LoadMonStats
-	ld a, [wd265]
-	ld [wCurPartySpecies], a
-	ld [wCurSpecies], a
-	ld hl, wTempMonDVs
-	predef GetUnownLetter
-	call GetBaseData
-	call BillsPC_CopyMon
-.pressed_a_b_right_left
-	ret
-
-.did_nothing
-	xor a
-	ld [wMenuJoypad], a
-	ret
-
-BillsPC_CopyMon: ; e2fd6 (38:6fd6)
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld [wCurPartyMon], a
-	ld a, [wBillsPC_LoadedBox]
-	and a
-	jr z, .party
-	cp NUM_BOXES + 1
-	jr nz, .box
-	ld a, BANK(sBox)
-	call GetSRAMBank
-	ld hl, sBoxSpecies
-	call CopySpeciesToTemp
-	ld hl, sBoxMonNicknames
-	call CopyNicknameToTemp
-	ld hl, sBoxMonOT
-	call CopyOTNameToTemp
-	ld hl, sBoxMons
-	ld bc, BOXMON_STRUCT_LENGTH
-	ld a, [wCurPartyMon]
-	call AddNTimes
-	ld de, wBufferMon
-	ld bc, PARTYMON_STRUCT_LENGTH
-	call CopyBytes
-	call CloseSRAM
-	farcall CalcBufferMonStats
-	ret
-
-.party
-	ld hl, wPartySpecies
-	call CopySpeciesToTemp
-	ld hl, wPartyMonNicknames
-	call CopyNicknameToTemp
-	ld hl, wPartyMonOT
-	call CopyOTNameToTemp
-	ld hl, wPartyMon1
-	ld bc, PARTYMON_STRUCT_LENGTH
-	ld a, [wCurPartyMon]
-	call AddNTimes
-	ld de, wBufferMon
-	ld bc, PARTYMON_STRUCT_LENGTH
-	call CopyBytes
-	ret
-
-.box
-	ld b, a
-	call GetBoxPointer
-	ld a, b
-	call GetSRAMBank
-	push hl
-	inc hl
-	call CopySpeciesToTemp
-	pop hl
-	push hl
-	ld bc, sBoxMonNicknames - sBox
-	add hl, bc
-	call CopyNicknameToTemp
-	pop hl
-	push hl
-	ld bc, sBoxMonOT - sBox
-	add hl, bc
-	call CopyOTNameToTemp
-	pop hl
-	ld bc, sBoxMons - sBox
-	add hl, bc
-	ld bc, BOXMON_STRUCT_LENGTH
-	call CopyMonToTemp
-	call CloseSRAM
-	farcall CalcBufferMonStats
-	ret
-
-DepositPokemon: ; e307c (38:707c)
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld [wCurPartyMon], a
-	ld hl, wPartyMonNicknames
-	ld a, [wCurPartyMon]
-	call GetNick
-	ld a, PC_DEPOSIT
-	ld [wPokemonWithdrawDepositParameter], a
-	predef SendGetMonIntoFromBox
-	jr c, .asm_boxisfull
-	xor a ; REMOVE_PARTY
-	ld [wPokemonWithdrawDepositParameter], a
-	farcall RemoveMonFromPartyOrBox
-	ld a, [wCurPartySpecies]
-	call PlayMonCry
-	hlcoord 0, 0
-	lb bc, 15, 8
-	call ClearBox
-	hlcoord 8, 14
-	lb bc, 1, 3
-	call ClearBox
-	hlcoord 0, 15
-	lb bc, 1, 18
-	call TextBox
-	call WaitBGMap
-	hlcoord 1, 16
-	ld de, PCString_Stored
-	call PlaceString
-	ld l, c
-	ld h, b
-	ld de, wStringBuffer1
-	call PlaceString
-	ld a, "!"
-	ld [bc], a
-	ld c, 50
-	call DelayFrames
-	and a
-	ret
-
-.asm_boxisfull
-	ld de, PCString_BoxFull
-	call BillsPC_PlaceString
-	ld de, SFX_WRONG
-	call WaitPlaySFX
-	call WaitSFX
-	ld c, 50
-	call DelayFrames
-	scf
-	ret
-
-TryWithdrawPokemon: ; e30fa (38:70fa)
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld [wCurPartyMon], a
-	ld a, BANK(sBoxMonNicknames)
-	call GetSRAMBank
-	ld a, [wCurPartyMon]
-	ld hl, sBoxMonNicknames
-	call GetNick
-	call CloseSRAM
-	xor a
-	ld [wPokemonWithdrawDepositParameter], a
-	predef SendGetMonIntoFromBox
-	jr c, .PartyFull
-	ld a, REMOVE_BOX
-	ld [wPokemonWithdrawDepositParameter], a
-	farcall RemoveMonFromPartyOrBox
-	ld a, [wCurPartySpecies]
-	call PlayMonCry
-	hlcoord 0, 0
-	lb bc, 15, 8
-	call ClearBox
-	hlcoord 8, 14
-	lb bc, 1, 3
-	call ClearBox
-	hlcoord 0, 15
-	lb bc, 1, 18
-	call TextBox
-	call WaitBGMap
-	hlcoord 1, 16
-	ld de, PCString_Got
-	call PlaceString
-	ld l, c
-	ld h, b
-	ld de, wStringBuffer1
-	call PlaceString
-	ld a, $e7
-	ld [bc], a
-	ld c, 50
-	call DelayFrames
-	and a
-	ret
-
-.PartyFull:
-	ld de, PCString_PartyFull
-	call BillsPC_PlaceString
-	ld de, SFX_WRONG
-	call WaitPlaySFX
-	call WaitSFX
-	ld c, 50
-	call DelayFrames
-	scf
-	ret
-
-
-ReleasePKMN_ByePKMN: ; e3180 (38:7180)
-	hlcoord 0, 0
-	lb bc, 15, 8
-	call ClearBox
-	hlcoord 8, 14
-	lb bc, 1, 3
-	call ClearBox
-	hlcoord 0, 15
-	lb bc, 1, 18
-	call TextBox
-
-	call WaitBGMap
-	ld a, [wCurPartySpecies]
-	call GetCryIndex
-	jr c, .skip_cry
-	ld e, c
-	ld d, b
-	call PlayCry
-.skip_cry
-
-	ld a, [wCurPartySpecies]
-	ld [wd265], a
-	call GetPokemonName
-	hlcoord 1, 16
-	ld de, PCString_ReleasedPKMN
-	call PlaceString
-	ld c, 80
-	call DelayFrames
-	hlcoord 0, 15
-	lb bc, 1, 18
-	call TextBox
-	hlcoord 1, 16
-	ld de, PCString_Bye
-	call PlaceString
-	ld l, c
-	ld h, b
-	inc hl
-	ld de, wStringBuffer1
-	call PlaceString
-	ld l, c
-	ld h, b
-	ld [hl], $e7
-	ld c, 50
-	call DelayFrames
-	ret
-; e31e7 (38:71e7)
-
-MovePKMNWitoutMail_InsertMon: ; e31e7
-	push hl
-	push de
-	push bc
-	push af
-	hlcoord 0, 15
-	lb bc, 1, 18
-	call TextBox
-	hlcoord 1, 16
-	ld de, .Saving_LeaveOn
-	call PlaceString
-	ld c, 20
-	call DelayFrames
-	pop af
-	pop bc
-	pop de
-	pop hl
-	ld a, [wCurBox]
-	push af
-	ld bc, 0
-	ld a, [wBillsPC_BackupLoadedBox]
-	and a
-	jr nz, .moving_from_box
-	set 0, c
-
-.moving_from_box
-	ld a, [wBillsPC_LoadedBox]
-	and a
-	jr nz, .moving_to_box
-	set 1, c
-
-.moving_to_box
-	ld hl, .Jumptable
-	add hl, bc
-	add hl, bc
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld de, .dw_return
-	push de
-	jp hl
-; e322a
-
-.dw_return ; e322a
-	pop af
-	ld e, a
-	farcall MoveMonWOMail_InsertMon_SaveGame
-	ret
-; e3233
-
-.Saving_LeaveOn:
-	db "Saving… Leave ON!@"
-; e3245
-
-.Jumptable: ; e3245
-	dw .BoxToBox
-	dw .PartyToBox
-	dw .BoxToParty
-	dw .PartyToParty
-; e324d
-
-.BoxToBox: ; e324d
-	ld hl, wBillsPC_BackupLoadedBox
-	ld a, [wBillsPC_LoadedBox]
-	cp [hl]
-	jr z, .same_box
-	call .CopyFromBox
-	call .CopyToBox
-	ret
-
-.same_box
-	call .CopyFromBox
-	call .CheckTrivialMove
-	call .CopyToBox
-	ret
-; e3267
-
-.PartyToBox: ; e3267
-	call .CopyFromParty
-	ld a, $1
-	ld [wGameLogicPaused], a
-	farcall SaveGameData
-	xor a
-	ld [wGameLogicPaused], a
-	call .CopyToBox
-	ret
-; e327d
-
-.BoxToParty: ; e327d
-	call .CopyFromBox
-	call .CopyToParty
-	ret
-; e3284
-
-.PartyToParty: ; e3284
-	call .CopyFromParty
-	call .CheckTrivialMove
-	call .CopyToParty
-	ret
-; e328e
-
-.CheckTrivialMove: ; e328e
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld e, a
-	ld a, [wBillsPC_BackupCursorPosition]
-	ld hl, wBillsPC_BackupScrollPosition
-	add [hl]
-	cp e
-	ret nc
-	ld hl, wBillsPC_CursorPosition
-	ld a, [hl]
-	and a
-	jr z, .top_of_screen
-	dec [hl]
-	ret
-
-.top_of_screen
-	ld hl, wBillsPC_ScrollPosition
-	ld a, [hl]
-	and a
-	ret z
-	dec [hl]
-	ret
-; e32b0
-
-.CopyFromBox: ; e32b0
-	ld a, [wBillsPC_BackupLoadedBox]
-	dec a
-	ld e, a
-	farcall MoveMonWOMail_SaveGame
-	ld a, [wBillsPC_BackupCursorPosition]
-	ld hl, wBillsPC_BackupScrollPosition
-	add [hl]
-	ld [wCurPartyMon], a
-	ld a, BANK(sBox)
-	call GetSRAMBank
-	ld hl, sBoxSpecies
-	call CopySpeciesToTemp
-	ld hl, sBoxMonNicknames
-	call CopyNicknameToTemp
-	ld hl, sBoxMonOT
-	call CopyOTNameToTemp
-	ld hl, sBoxMons
-	ld bc, BOXMON_STRUCT_LENGTH
-	call CopyMonToTemp
-	call CloseSRAM
-	farcall CalcBufferMonStats
-	ld a, REMOVE_BOX
-	ld [wPokemonWithdrawDepositParameter], a
-	farcall RemoveMonFromPartyOrBox
-	ret
-; e32fa
-
-.CopyToBox: ; e32fa
-	ld a, [wBillsPC_LoadedBox]
-	dec a
-	ld e, a
-	farcall MoveMonWOMail_SaveGame
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld [wCurPartyMon], a
-	farcall InsertPokemonIntoBox
-	ret
-; e3316
-
-.CopyFromParty: ; e3316
-	ld a, [wBillsPC_BackupCursorPosition]
-	ld hl, wBillsPC_BackupScrollPosition
-	add [hl]
-	ld [wCurPartyMon], a
-	ld hl, wPartySpecies
-	call CopySpeciesToTemp
-	ld hl, wPartyMonNicknames
-	call CopyNicknameToTemp
-	ld hl, wPartyMonOT
-	call CopyOTNameToTemp
-	ld hl, wPartyMon1Species
-	ld bc, PARTYMON_STRUCT_LENGTH
-	call CopyMonToTemp
-	xor a ; REMOVE_PARTY
-	ld [wPokemonWithdrawDepositParameter], a
-	farcall RemoveMonFromPartyOrBox
-	ret
-; e3346
-
-.CopyToParty: ; e3346
-	ld a, [wBillsPC_CursorPosition]
-	ld hl, wBillsPC_ScrollPosition
-	add [hl]
-	ld [wCurPartyMon], a
-	farcall InsertPokemonIntoParty
-	ret
-; e3357
-
-CopySpeciesToTemp: ; e3357 (38:7357)
-	ld a, [wCurPartyMon]
-	ld c, a
-	ld b, $0
-	add hl, bc
-	ld a, [hl]
-	ld [wCurPartySpecies], a
-	ret
-
-CopyNicknameToTemp: ; e3363 (38:7363)
-	ld bc, MON_NAME_LENGTH
-	ld a, [wCurPartyMon]
-	call AddNTimes
-	ld de, wBufferMonNick
-	ld bc, MON_NAME_LENGTH
-	call CopyBytes
-	ret
-
-CopyOTNameToTemp: ; e3376 (38:7376)
-	ld bc, NAME_LENGTH
-	ld a, [wCurPartyMon]
-	call AddNTimes
-	ld de, wBufferMonOT
-	ld bc, NAME_LENGTH
-	call CopyBytes
-	ret
-
-CopyMonToTemp: ; e3389 (38:7389)
-	ld a, [wCurPartyMon]
-	call AddNTimes
-	ld de, wBufferMon
-	call CopyBytes
-	ret
-
-GetBoxPointer: ; e3396 (38:7396)
-	dec b
-	ld c, b
-	ld b, 0
-	ld hl, .boxes
-	add hl, bc
-	add hl, bc
-	add hl, bc
-	ld a, [hli]
-	ld b, a
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ret
-; e33a6 (38:73a6)
-
-.boxes ; e33a6
-	;  bank, address
-	dba sBox1
-	dba sBox2
-	dba sBox3
-	dba sBox4
-	dba sBox5
-	dba sBox6
-	dba sBox7
-	dba sBox8
-	dba sBox9
-	dba sBox10
-	dba sBox11
-	dba sBox12
-	dba sBox13
-	dba sBox14
-; e33d0
-
-BillsPC_ApplyPalettes: ; e33d0 (38:73d0)
-	ld b, a
-	call GetSGBLayout
-	ld a, %11100100
-	call DmgToCgbBGPals
-	ld a, %11111100
-	call DmgToCgbObjPal0
-	ret
-
-BillsPC_Jumptable: ; e33df (38:73df)
-	ld e, a
-	ld d, $0
-	add hl, de
-	add hl, de
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ret
-
-BillsPC_InitGFX: ; e33e8 (38:73e8)
-	call DisableLCD
-	ld hl, vTiles2 tile $00
-	ld bc, $31 tiles
-	xor a
-	call ByteFill
-	call LoadStandardFont
-	call LoadFontsBattleExtra
-	ld hl, PCMailGFX
-	ld de, vTiles2 tile $5c
-	ld bc, 4 tiles
-	call CopyBytes
-	ld hl, PCSelectLZ
-	ld de, vTiles0 tile $00
-	call Decompress
-	ld a, 6
-	call SkipMusic
-	call EnableLCD
-	ret
-; e3419 (38:7419)
-
-PCSelectLZ: INCBIN "gfx/pc/pc.2bpp.lz"
-PCMailGFX:  INCBIN "gfx/pc/pc_mail.2bpp"
-; e34dd
-
-PCString_ChooseaPKMN: db "Choose a <PK><MN>.@"
-PCString_WhatsUp: db "What's up?@"
-PCString_ReleasePKMN: db "Release <PK><MN>?@"
-PCString_MoveToWhere: db "Move to where?@"
-PCString_ItsYourLastPKMN: db "It's your last <PK><MN>!@"
-PCString_TheresNoRoom: db "There's no room!@"
-PCString_NoMoreUsablePKMN: db "No more usable <PK><MN>!@"
-PCString_RemoveMail: db "Remove MAIL.@"
-PCString_ReleasedPKMN: db "Released <PK><MN>.@"
-PCString_Bye: db "Bye,@"
-PCString_Stored: db "Stored @"
-PCString_Got: db "Got @"
-PCString_Non: db "Non.@"
-PCString_BoxFull: db "The BOX is full.@"
-PCString_PartyFull: db "The party's full!@"
-PCString_NoReleasingEGGS: db "No releasing EGGS!@"
-; e35aa
-
-
-_ChangeBox: ; e35aa (38:75aa)
-	call LoadStandardMenuHeader
-	call BillsPC_ClearTilemap
-.loop
-	xor a
-	ld [hBGMapMode], a
-	call BillsPC_PrintBoxName
-	call BillsPC_PlaceChooseABoxString
-	ld hl, _ChangeBox_MenuHeader
-	call CopyMenuHeader
-	xor a
-	ld [wMenuScrollPosition], a
-	hlcoord 0, 4
-	lb bc, 8, 9
-	call TextBox
-	call ScrollingMenu
-	ld a, [wMenuJoypad]
-	cp B_BUTTON
-	jr z, .done
-	call BillsPC_PlaceWhatsUpString
-	call BillsPC_ChangeBoxSubmenu
-	jr .loop
-.done
-	call CloseWindow
-	ret
-
-BillsPC_ClearTilemap: ; e35e2 (38:75e2)
-	xor a
-	ld [hBGMapMode], a
-	hlcoord 0, 0
-	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
-	ld a, " "
-	call ByteFill
-	ret
-; e35f1 (38:75f1)
-
-_ChangeBox_MenuHeader: ; 0xe35f1
-	db MENU_BACKUP_TILES ; flags
-	menu_coords 1, 5, 9, 12
-	dw .MenuData
-	db 1 ; default option
-; 0xe35f9
-
-.MenuData ; 0xe35f9
-	db MENU_UNUSED_1 | MENU_UNUSED_3 ; flags
-	db 4, 0
-	db 1
-	dba .boxes
-	dba .boxnames
-	dba NULL
-	dba BillsPC_PrintBoxCountAndCapacity
-; e3609
-
-.boxes ; e3609
-	db NUM_BOXES
-x = 1
-rept NUM_BOXES
-	db x
-x = x + 1
-endr
-	db -1
-; e3619
-
-.boxnames ; e3619
-	push de
-	ld a, [wMenuSelection]
-	dec a
-	call GetBoxName
-	pop hl
-	call PlaceString
-	ret
-; e3626
-
-GetBoxName: ; e3626 (38:7626)
-	ld bc, BOX_NAME_LENGTH
-	ld hl, wBoxNames
-	call AddNTimes
-	ld d, h
-	ld e, l
-	ret
-; e3632 (38:7632)
-
-BillsPC_PrintBoxCountAndCapacity: ; e3632
-	hlcoord 11, 7
-	lb bc, 5, 7
-	call TextBox
-	ld a, [wMenuSelection]
-	cp -1
-	ret z
-	hlcoord 12, 9
-	ld de, .Pokemon
-	call PlaceString
-	call GetBoxCount
-	ld [wd265], a
-	hlcoord 13, 11
-	ld de, wd265
-	lb bc, 1, 2
-	call PrintNum
-	ld de, .out_of_20
-	call PlaceString
-	ret
-; e3663
-
-.Pokemon: ; e3663
-	db "#MON@"
-; e3668
-
-.out_of_20 ; e3668
-	; db "/20@"
-	db "/"
-	db "0" + MONS_PER_BOX / 10 ; "2"
-	db "0" + MONS_PER_BOX % 10 ; "0"
-	db "@"
-; e366c
-
-GetBoxCount: ; e366c (38:766c)
-	ld a, [wCurBox]
-	ld c, a
-	ld a, [wMenuSelection]
-	dec a
-	cp c
-	jr z, .activebox
-	ld c, a
-	ld b, 0
-	ld hl, .boxbanks
-	add hl, bc
-	add hl, bc
-	add hl, bc
-	ld a, [hli]
-	ld b, a
-	call GetSRAMBank
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	ld a, [hl]
-	call CloseSRAM
-	ld c, a
-	ld a, [wSavedAtLeastOnce]
-	and a
-	jr z, .newfile
-	ld a, c
-	ret
-
-.newfile
-	xor a
-	ret
-
-.activebox
-	ld a, BANK(sBoxCount)
-	ld b, a
-	call GetSRAMBank
-	ld hl, sBoxCount
-	ld a, [hl]
-	call CloseSRAM
-	ret
-; e36a5 (38:76a5)
-
-.boxbanks ; e36a5
-	dba sBox1
-	dba sBox2
-	dba sBox3
-	dba sBox4
-	dba sBox5
-	dba sBox6
-	dba sBox7
-	dba sBox8
-	dba sBox9
-	dba sBox10
-	dba sBox11
-	dba sBox12
-	dba sBox13
-	dba sBox14
-; e36cf
-
-BillsPC_PrintBoxName: ; e36cf (38:76cf)
-	hlcoord 0, 0
-	ld b, 2
-	ld c, 18
-	call TextBox
-	hlcoord 1, 2
-	ld de, .Current
-	call PlaceString
-	ld a, [wCurBox]
-	and $f
-	call GetBoxName
-	hlcoord 11, 2
-	call PlaceString
-	ret
-; e36f1 (38:76f1)
-
-.Current: ; e36f1
-	db "CURRENT@"
-; e36f9
-
-BillsPC_ChangeBoxSubmenu: ; e36f9 (38:76f9)
-	ld hl, .MenuHeader
-	call LoadMenuHeader
-	call VerticalMenu
-	call ExitMenu
-	ret c
-	ld a, [wMenuCursorY]
-	cp $1
-	jr z, .Switch
-	cp $2
-	jr z, .Name
-	cp $3
-	jr z, .Print
-	and a
-	ret
-
-.Print:
-	call GetBoxCount
-	and a
-	jr z, .EmptyBox
-	ld e, l
-	ld d, h
-	ld a, [wMenuSelection]
-	dec a
-	ld c, a
-	farcall PrintPCBox
-	call BillsPC_ClearTilemap
-	and a
-	ret
-
-.EmptyBox:
-	call BillsPC_PlaceEmptyBoxString_SFX
-	and a
-	ret
-
-.Switch:
-	ld a, [wMenuSelection]
-	dec a
-	ld e, a
-	ld a, [wCurBox]
-	cp e
-	ret z
-	farcall ChangeBoxSaveGame
-	ret
-
-.Name:
-	ld b, $4 ; box
-	ld de, wd002
-	farcall NamingScreen
-	call ClearTileMap
-	call LoadStandardFont
-	call LoadFontsBattleExtra
-	ld a, [wMenuSelection]
-	dec a
-	call GetBoxName
-	ld e, l
-	ld d, h
-	ld hl, wd002
-	ld c, BOX_NAME_LENGTH - 1
-	call InitString
-	ld a, [wMenuSelection]
-	dec a
-	call GetBoxName
-	ld de, wd002
-	call CopyName2
-	ret
-; e3778 (38:7778)
-
-	hlcoord 11, 7 ; unused
-
-.MenuHeader: ; 0xe377b
-	db MENU_BACKUP_TILES ; flags
-	menu_coords 11, 4, SCREEN_WIDTH - 1, 13
-	dw .MenuData
-	db 1 ; default option
-; 0xe3783
-
-.MenuData: ; 0xe3783
-	db STATICMENU_CURSOR ; flags
-	db 4 ; items
-	db "SWITCH@"
-	db "NAME@"
-	db "PRINT@"
-	db "QUIT@"
-; 0xe379c
-
-BillsPC_PlaceChooseABoxString: ; e379c (38:779c)
-	ld de, .ChooseABox
-	jr BillsPC_PlaceChangeBoxString
-; e37a1 (38:77a1)
-
-.ChooseABox: ; e37a1
-	db "Choose a BOX.@"
-; e37af
-
-BillsPC_PlaceWhatsUpString: ; e37af (38:77af)
-	ld de, .WhatsUp
-	jr BillsPC_PlaceChangeBoxString
-; e37b4 (38:77b4)
-
-.WhatsUp: ; e37b4
-	db "What's up?@"
-; e37be
-
-BillsPC_PlaceEmptyBoxString_SFX: ; e37be (38:77be)
-	ld de, .NoMonString
-	call BillsPC_PlaceChangeBoxString
-	ld de, SFX_WRONG
-	call WaitPlaySFX
-	call WaitSFX
-	ld c, 50
-	call DelayFrames
-	ret
-; e37d3 (38:77d3)
-
-.NoMonString: ; e37d3
-	db "There's no #MON.@"
-; e37e3
-
-BillsPC_PlaceChangeBoxString: ; e37e3 (38:77e3)
-	push de
-	hlcoord 0, 14
-	lb bc, 2, 18
-	call TextBox
-	pop de
-	hlcoord 1, 16
-	call PlaceString
-	ld a, $1
-	ld [hBGMapMode], a
-	ret
--- a/engine/pokemon/billspctop.asm
+++ /dev/null
@@ -1,387 +1,0 @@
-_BillsPC: ; e3fd
-	call .CheckCanUsePC
-	ret c
-	call .LogIn
-	call .UseBillsPC
-	jp .LogOut
-
-.CheckCanUsePC: ; e40a (3:640a)
-	ld a, [wPartyCount]
-	and a
-	ret nz
-	ld hl, .Text_GottaHavePokemon
-	call MenuTextBoxBackup
-	scf
-	ret
-
-.Text_GottaHavePokemon: ; 0xe417
-	; You gotta have #MON to call!
-	text_jump UnknownText_0x1c1006
-	db "@"
-
-.LogIn: ; e41c (3:641c)
-	xor a
-	ld [hBGMapMode], a
-	call LoadStandardMenuHeader
-	call ClearPCItemScreen
-	ld hl, wOptions
-	ld a, [hl]
-	push af
-	set NO_TEXT_SCROLL, [hl]
-	ld hl, .Text_What
-	call PrintText
-	pop af
-	ld [wOptions], a
-	call LoadFontsBattleExtra
-	ret
-
-.Text_What: ; 0xe43a
-	; What?
-	text_jump UnknownText_0x1c1024
-	db "@"
-
-.LogOut: ; e43f (3:643f)
-	call CloseSubmenu
-	ret
-
-.UseBillsPC: ; e443 (3:6443)
-	ld hl, .MenuHeader
-	call LoadMenuHeader
-	ld a, $1
-.loop
-	ld [wMenuCursorBuffer], a
-	call SetPalettes
-	xor a
-	ld [wWhichIndexSet], a
-	ld [hBGMapMode], a
-	call DoNthMenu
-	jr c, .cancel
-	ld a, [wMenuCursorBuffer]
-	push af
-	ld a, [wMenuSelection]
-	ld hl, .Jumptable
-	rst JumpTable
-	pop bc
-	ld a, b
-	jr nc, .loop
-.cancel
-	call CloseWindow
-	ret
-
-.MenuHeader: ; 0xe46f
-	db MENU_BACKUP_TILES ; flags
-	menu_coords 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
-	dw .MenuData
-	db 1 ; default option
-
-.MenuData: ; 0xe477
-	db STATICMENU_CURSOR ; flags
-	db 0 ; items
-	dw .items
-	dw PlaceMenuStrings
-	dw .strings
-
-.strings ; e47f
-	db "WITHDRAW <PK><MN>@"
-	db "DEPOSIT <PK><MN>@"
-	db "CHANGE BOX@"
-	db "MOVE <PK><MN> W/O MAIL@"
-	db "SEE YA!@"
-
-.Jumptable: ; e4ba (3:64ba)
-	dw BillsPC_WithdrawMenu
-	dw BillsPC_DepositMenu
-	dw BillsPC_ChangeBoxMenu
-	dw BillsPC_MovePKMNMenu
-	dw BillsPC_SeeYa
-
-.items ; e4c4
-	db 5
-	db 0 ; WITHDRAW
-	db 1;  DEPOSIT
-	db 2 ; CHANGE BOX
-	db 3 ; MOVE PKMN
-	db 4 ; SEE YA!
-	db -1
-
-BillsPC_SeeYa: ; e4cb
-	scf
-	ret
-
-BillsPC_MovePKMNMenu: ; e4cd
-	call LoadStandardMenuHeader
-	farcall IsAnyMonHoldingMail
-	jr nc, .no_mail
-	ld hl, .Text_MonHoldingMail
-	call PrintText
-	jr .quit
-
-.no_mail
-	farcall StartMoveMonWOMail_SaveGame
-	jr c, .quit
-	farcall _MovePKMNWithoutMail
-	call ReturnToMapFromSubmenu
-	call ClearPCItemScreen
-
-.quit
-	call CloseWindow
-	and a
-	ret
-
-.Text_MonHoldingMail: ; 0xe4f9
-	; There is a #MON holding MAIL. Please remove the MAIL.
-	text_jump UnknownText_0x1c102b
-	db "@"
-
-BillsPC_DepositMenu: ; e4fe (3:64fe)
-	call LoadStandardMenuHeader
-	farcall _DepositPKMN
-	call ReturnToMapFromSubmenu
-	call ClearPCItemScreen
-	call CloseWindow
-	and a
-	ret
-
-Unreferenced_Functione512:
-	ld a, [wPartyCount]
-	and a
-	jr z, .no_mon
-	cp 2
-	jr c, .only_one_mon
-	and a
-	ret
-
-.no_mon
-	ld hl, .Text_NoMon
-	call MenuTextBoxBackup
-	scf
-	ret
-
-.only_one_mon
-	ld hl, .Text_ItsYourLastMon
-	call MenuTextBoxBackup
-	scf
-	ret
-
-.Text_NoMon: ; 0xe52e
-	; You don't have a single #MON!
-	text_jump UnknownText_0x1c1062
-	db "@"
-
-.Text_ItsYourLastMon: ; 0xe533
-	; You can't deposit your last #MON!
-	text_jump UnknownText_0x1c1080
-	db "@"
-
-CheckCurPartyMonFainted: ; e538
-	ld hl, wPartyMon1HP
-	ld de, PARTYMON_STRUCT_LENGTH
-	ld b, $0
-.loop
-	ld a, [wCurPartyMon]
-	cp b
-	jr z, .skip
-	ld a, [hli]
-	or [hl]
-	jr nz, .notfainted
-	dec hl
-
-.skip
-	inc b
-	ld a, [wPartyCount]
-	cp b
-	jr z, .done
-	add hl, de
-	jr .loop
-
-.done
-	scf
-	ret
-
-.notfainted
-	and a
-	ret
-
-BillsPC_WithdrawMenu: ; e559 (3:6559)
-	call LoadStandardMenuHeader
-	farcall _WithdrawPKMN
-	call ReturnToMapFromSubmenu
-	call ClearPCItemScreen
-	call CloseWindow
-	and a
-	ret
-
-Unreferenced_Functione56d:
-	ld a, [wPartyCount]
-	cp PARTY_LENGTH
-	jr nc, .asm_e576
-	and a
-	ret
-
-.asm_e576
-	ld hl, UnknownText_0xe57e
-	call MenuTextBoxBackup
-	scf
-	ret
-
-UnknownText_0xe57e: ; 0xe57e
-	; You can't take any more #MON.
-	text_jump UnknownText_0x1c10a2
-	db "@"
-
-BillsPC_ChangeBoxMenu: ; e583 (3:6583)
-	farcall _ChangeBox
-	and a
-	ret
-
-ClearPCItemScreen: ; e58b
-	call DisableSpriteUpdates
-	xor a
-	ld [hBGMapMode], a
-	call ClearBGPalettes
-	call ClearSprites
-	hlcoord 0, 0
-	ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
-	ld a, " "
-	call ByteFill
-	hlcoord 0, 0
-	lb bc, 10, 18
-	call TextBox
-	hlcoord 0, 12
-	lb bc, 4, 18
-	call TextBox
-	call WaitBGMap2
-	call SetPalettes ; load regular palettes?
-	ret
-
-CopyBoxmonToTempMon: ; e5bb
-	ld a, [wCurPartyMon]
-	ld hl, sBoxMon1Species
-	ld bc, BOXMON_STRUCT_LENGTH
-	call AddNTimes
-	ld de, wTempMonSpecies
-	ld bc, BOXMON_STRUCT_LENGTH
-	ld a, BANK(sBoxMon1Species)
-	call GetSRAMBank
-	call CopyBytes
-	call CloseSRAM
-	ret
-
-Unreferenced_Functione5d9:
-	ld a, [wCurBox]
-	cp b
-	jr z, .same_box
-	ld a, b
-	ld hl, .BoxAddrs
-	ld bc, 3
-	call AddNTimes
-	ld a, [hli]
-	push af
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	pop af
-	jr .okay
-
-.same_box
-	ld a, BANK(sBoxCount)
-	ld hl, sBoxCount
-
-.okay
-	call GetSRAMBank
-	ld a, [hl]
-	ld bc, 1 + MONS_PER_BOX + 1
-	add hl, bc
-	ld b, a
-	ld c, $0
-	ld de, wc608
-	ld a, b
-	and a
-	jr z, .empty_box
-.loop
-	push hl
-	push bc
-	ld a, c
-	ld bc, 0
-	add hl, bc
-	ld bc, BOXMON_STRUCT_LENGTH
-	call AddNTimes
-	ld a, [hl]
-	ld [de], a
-	inc de
-	ld [wCurSpecies], a
-	call GetBaseData
-	pop bc
-	pop hl
-
-	push hl
-	push bc
-	ld a, c
-	ld bc, MONS_PER_BOX * (BOXMON_STRUCT_LENGTH + NAME_LENGTH)
-	add hl, bc
-	call SkipNames
-	call CopyBytes
-	pop bc
-	pop hl
-
-	push hl
-	push bc
-	ld a, c
-	ld bc, MON_LEVEL
-	add hl, bc
-	ld bc, BOXMON_STRUCT_LENGTH
-	call AddNTimes
-	ld a, [hl]
-	ld [de], a
-	inc de
-	pop bc
-	pop hl
-
-	push hl
-	push bc
-	ld a, c
-	ld bc, MON_DVS
-	add hl, bc
-	ld bc, BOXMON_STRUCT_LENGTH
-	call AddNTimes
-	ld a, [hli]
-	and $f0
-	ld b, a
-	ld a, [hl]
-	and $f0
-	swap a
-	or b
-	ld b, a
-	ld a, [wBaseGender]
-	cp b
-	ld a, $1
-	jr c, .okay2
-	xor a
-.okay2
-	ld [de], a
-	inc de
-	pop bc
-	pop hl
-
-	inc c
-	dec b
-	jr nz, .loop
-.empty_box
-	call CloseSRAM
-	ret
-
-.BoxAddrs: ; e66e
-	dba sBox1
-	dba sBox2
-	dba sBox3
-	dba sBox4
-	dba sBox5
-	dba sBox6
-	dba sBox7
-	dba sBox8
-	dba sBox9
-	dba sBox10
-	dba sBox11
-	dba sBox12
-	dba sBox13
-	dba sBox14
--- /dev/null
+++ b/engine/pokemon/breedmon_level_growth.asm
@@ -1,0 +1,27 @@
+GetBreedMon1LevelGrowth: ; e698
+	ld hl, wBreedMon1Stats
+	ld de, wTempMon
+	ld bc, BOXMON_STRUCT_LENGTH
+	call CopyBytes
+	callfar CalcLevel
+	ld a, [wBreedMon1Level]
+	ld b, a
+	ld a, d
+	ld e, a
+	sub b
+	ld d, a
+	ret
+
+GetBreedMon2LevelGrowth: ; e6b3
+	ld hl, wBreedMon2Stats
+	ld de, wTempMon
+	ld bc, BOXMON_STRUCT_LENGTH
+	call CopyBytes
+	callfar CalcLevel
+	ld a, [wBreedMon2Level]
+	ld b, a
+	ld a, d
+	ld e, a
+	sub b
+	ld d, a
+	ret
--- /dev/null
+++ b/engine/pokemon/check_nick_errors.asm
@@ -1,0 +1,74 @@
+CheckNickErrors:: ; 669f
+; error-check monster nick before use
+; must be a peace offering to gamesharkers
+
+; input: de = nick location
+
+	push bc
+	push de
+	ld b, MON_NAME_LENGTH
+
+.checkchar
+; end of nick?
+	ld a, [de]
+	cp "@" ; terminator
+	jr z, .end
+
+; check if this char is a text command
+	ld hl, .textcommands
+	dec hl
+.loop
+; next entry
+	inc hl
+; reached end of commands table?
+	ld a, [hl]
+	cp -1
+	jr z, .done
+
+; is the current char between this value (inclusive)...
+	ld a, [de]
+	cp [hl]
+	inc hl
+	jr c, .loop
+; ...and this one?
+	cp [hl]
+	jr nc, .loop
+
+; replace it with a "?"
+	ld a, "?"
+	ld [de], a
+	jr .loop
+
+.done
+; next char
+	inc de
+; reached end of nick without finding a terminator?
+	dec b
+	jr nz, .checkchar
+
+; change nick to "?@"
+	pop de
+	push de
+	ld a, "?"
+	ld [de], a
+	inc de
+	ld a, "@"
+	ld [de], a
+.end
+; if the nick has any errors at this point it's out of our hands
+	pop de
+	pop bc
+	ret
+
+.textcommands ; 66cf
+; table defining which characters are actually text commands
+; format:
+	;      ≥           <
+	db TX_START,   TX_BOX    + 1
+	db "<PLAY_G>", "<JP_18>" + 1
+	db "<NI>",     "<NO>"    + 1
+	db "<ROUTE>",  "<GREEN>" + 1
+	db "<ENEMY>",  "<ENEMY>" + 1
+	db "<MOM>",    "<TM>"    + 1
+	db "<ROCKET>", "┘"       + 1
+	db -1 ; end
--- a/engine/pokemon/checknickerrors.asm
+++ /dev/null
@@ -1,74 +1,0 @@
-CheckNickErrors:: ; 669f
-; error-check monster nick before use
-; must be a peace offering to gamesharkers
-
-; input: de = nick location
-
-	push bc
-	push de
-	ld b, MON_NAME_LENGTH
-
-.checkchar
-; end of nick?
-	ld a, [de]
-	cp "@" ; terminator
-	jr z, .end
-
-; check if this char is a text command
-	ld hl, .textcommands
-	dec hl
-.loop
-; next entry
-	inc hl
-; reached end of commands table?
-	ld a, [hl]
-	cp -1
-	jr z, .done
-
-; is the current char between this value (inclusive)...
-	ld a, [de]
-	cp [hl]
-	inc hl
-	jr c, .loop
-; ...and this one?
-	cp [hl]
-	jr nc, .loop
-
-; replace it with a "?"
-	ld a, "?"
-	ld [de], a
-	jr .loop
-
-.done
-; next char
-	inc de
-; reached end of nick without finding a terminator?
-	dec b
-	jr nz, .checkchar
-
-; change nick to "?@"
-	pop de
-	push de
-	ld a, "?"
-	ld [de], a
-	inc de
-	ld a, "@"
-	ld [de], a
-.end
-; if the nick has any errors at this point it's out of our hands
-	pop de
-	pop bc
-	ret
-
-.textcommands ; 66cf
-; table defining which characters are actually text commands
-; format:
-	;      ≥           <
-	db TX_START,   TX_BOX    + 1
-	db "<PLAY_G>", "<JP_18>" + 1
-	db "<NI>",     "<NO>"    + 1
-	db "<ROUTE>",  "<GREEN>" + 1
-	db "<ENEMY>",  "<ENEMY>" + 1
-	db "<MOM>",    "<TM>"    + 1
-	db "<ROCKET>", "┘"       + 1
-	db -1 ; end
--- /dev/null
+++ b/engine/pokemon/correct_party_errors.asm
@@ -1,0 +1,229 @@
+Unreferenced_CorrectPartyErrors:
+	ld hl, wPartyCount
+	ld a, [hl]
+	and a
+	ret z
+
+	cp PARTY_LENGTH + 1
+	jr c, .party_length_okay
+	ld a, PARTY_LENGTH
+	ld [hl], a
+.party_length_okay
+	inc hl
+
+	ld b, a
+	ld c, 0
+.loop1
+	ld a, [hl]
+	and a
+	jr z, .invalid_species
+	cp NUM_POKEMON + 1
+	jr z, .invalid_species
+	cp EGG + 1
+	jr c, .next_species
+
+.invalid_species
+	ld [hl], SMEARGLE
+	push hl
+	push bc
+	ld a, c
+	ld hl, wPartyMon1Species
+	call GetPartyLocation
+	ld [hl], SMEARGLE
+	pop bc
+	pop hl
+
+.next_species
+	inc hl
+	inc c
+	dec b
+	jr nz, .loop1
+	ld [hl], $ff
+
+	ld hl, wPartyMon1
+	ld a, [wPartyCount]
+	ld d, a
+	ld e, 0
+.loop2
+	push de
+	push hl
+	ld b, h
+	ld c, l
+	ld a, [hl]
+	and a
+	jr z, .invalid_species_2
+	cp NUM_POKEMON + 1
+	jr c, .check_level
+
+.invalid_species_2
+	ld [hl], SMEARGLE
+	push de
+	ld d, 0
+	ld hl, wPartySpecies
+	add hl, de
+	pop de
+	ld a, SMEARGLE
+	ld [hl], a
+
+.check_level
+	ld [wCurSpecies], a
+	call GetBaseData
+	ld hl, MON_LEVEL
+	add hl, bc
+	ld a, [hl]
+	cp MIN_LEVEL
+	ld a, MIN_LEVEL
+	jr c, .invalid_level
+	ld a, [hl]
+	cp MAX_LEVEL
+	jr c, .load_level
+	ld a, MAX_LEVEL
+.invalid_level
+	ld [hl], a
+.load_level
+	ld [wCurPartyLevel], a
+
+	ld hl, MON_MAXHP
+	add hl, bc
+	ld d, h
+	ld e, l
+	ld hl, MON_STAT_EXP - 1
+	add hl, bc
+	ld b, TRUE
+	predef CalcMonStats
+	pop hl
+	ld bc, PARTYMON_STRUCT_LENGTH
+	add hl, bc
+	pop de
+	inc e
+	dec d
+	jr nz, .loop2
+
+	ld de, wPartyMonNicknames
+	ld a, [wPartyCount]
+	ld b, a
+	ld c, 0
+.loop3
+	push bc
+	call .GetLengthOfStringWith6CharCap
+	push de
+	farcall CheckStringForErrors
+	pop hl
+	pop bc
+	jr nc, .valid_nickname
+
+	push bc
+	push hl
+	ld hl, wPartySpecies
+	push bc
+	ld b, 0
+	add hl, bc
+	pop bc
+	ld a, [hl]
+	cp EGG
+	ld hl, .TAMAGO
+	jr z, .got_nickname
+	ld [wd265], a
+	call GetPokemonName
+	ld hl, wStringBuffer1
+.got_nickname
+	pop de
+	ld bc, MON_NAME_LENGTH
+	call CopyBytes
+	pop bc
+
+.valid_nickname
+	inc c
+	dec b
+	jr nz, .loop3
+
+	ld de, wPartyMonOT
+	ld a, [wPartyCount]
+	ld b, a
+	ld c, 0
+.loop4
+	push bc
+	call .GetLengthOfStringWith6CharCap
+	push de
+	farcall CheckStringForErrors
+	pop hl
+	jr nc, .valid_ot_name
+	ld d, h
+	ld e, l
+	ld hl, wPlayerName
+	ld bc, NAME_LENGTH
+	call CopyBytes
+.valid_ot_name
+	pop bc
+	inc c
+	dec b
+	jr nz, .loop4
+
+	ld hl, wPartyMon1Moves
+	ld a, [wPartyCount]
+	ld b, a
+.loop5
+	push hl
+	ld c, NUM_MOVES
+	ld a, [hl]
+	and a
+	jr z, .invalid_move
+	cp NUM_ATTACKS + 1
+	jr c, .moves_loop
+.invalid_move
+	ld [hl], POUND
+
+.moves_loop
+	ld a, [hl]
+	and a
+	jr z, .fill_invalid_moves
+	cp NUM_ATTACKS + 1
+	jr c, .next_move
+
+.fill_invalid_moves
+	xor a
+	ld [hli], a
+	dec c
+	jr nz, .fill_invalid_moves
+	jr .next_pokemon
+
+.next_move
+	inc hl
+	dec c
+	jr nz, .moves_loop
+
+.next_pokemon
+	pop hl
+	push bc
+	ld bc, PARTYMON_STRUCT_LENGTH
+	add hl, bc
+	pop bc
+	dec b
+	jr nz, .loop5
+	ret
+; 13b6b
+
+.TAMAGO: ; 13b6b
+	db "タマゴ@@@"
+; 13b71
+
+.GetLengthOfStringWith6CharCap: ; 13b71
+	push de
+	ld c, 1
+	ld b, NAME_LENGTH_JAPANESE
+.search_loop
+	ld a, [de]
+	cp "@"
+	jr z, .done
+	inc de
+	inc c
+	dec b
+	jr nz, .search_loop
+	dec c
+	dec de
+	ld a, "@"
+	ld [de], a
+.done
+	pop de
+	ret
+; 13b87
--- a/engine/pokemon/correcterrorsinplayerparty.asm
+++ /dev/null
@@ -1,229 +1,0 @@
-Unreferenced_CorrectErrorsInPlayerParty:
-	ld hl, wPartyCount
-	ld a, [hl]
-	and a
-	ret z
-
-	cp PARTY_LENGTH + 1
-	jr c, .party_length_okay
-	ld a, PARTY_LENGTH
-	ld [hl], a
-.party_length_okay
-	inc hl
-
-	ld b, a
-	ld c, 0
-.loop1
-	ld a, [hl]
-	and a
-	jr z, .invalid_species
-	cp NUM_POKEMON + 1
-	jr z, .invalid_species
-	cp EGG + 1
-	jr c, .next_species
-
-.invalid_species
-	ld [hl], SMEARGLE
-	push hl
-	push bc
-	ld a, c
-	ld hl, wPartyMon1Species
-	call GetPartyLocation
-	ld [hl], SMEARGLE
-	pop bc
-	pop hl
-
-.next_species
-	inc hl
-	inc c
-	dec b
-	jr nz, .loop1
-	ld [hl], $ff
-
-	ld hl, wPartyMon1
-	ld a, [wPartyCount]
-	ld d, a
-	ld e, 0
-.loop2
-	push de
-	push hl
-	ld b, h
-	ld c, l
-	ld a, [hl]
-	and a
-	jr z, .invalid_species_2
-	cp NUM_POKEMON + 1
-	jr c, .check_level
-
-.invalid_species_2
-	ld [hl], SMEARGLE
-	push de
-	ld d, 0
-	ld hl, wPartySpecies
-	add hl, de
-	pop de
-	ld a, SMEARGLE
-	ld [hl], a
-
-.check_level
-	ld [wCurSpecies], a
-	call GetBaseData
-	ld hl, MON_LEVEL
-	add hl, bc
-	ld a, [hl]
-	cp MIN_LEVEL
-	ld a, MIN_LEVEL
-	jr c, .invalid_level
-	ld a, [hl]
-	cp MAX_LEVEL
-	jr c, .load_level
-	ld a, MAX_LEVEL
-.invalid_level
-	ld [hl], a
-.load_level
-	ld [wCurPartyLevel], a
-
-	ld hl, MON_MAXHP
-	add hl, bc
-	ld d, h
-	ld e, l
-	ld hl, MON_STAT_EXP - 1
-	add hl, bc
-	ld b, TRUE
-	predef CalcMonStats
-	pop hl
-	ld bc, PARTYMON_STRUCT_LENGTH
-	add hl, bc
-	pop de
-	inc e
-	dec d
-	jr nz, .loop2
-
-	ld de, wPartyMonNicknames
-	ld a, [wPartyCount]
-	ld b, a
-	ld c, 0
-.loop3
-	push bc
-	call .GetLengthOfStringWith6CharCap
-	push de
-	farcall CheckStringForErrors
-	pop hl
-	pop bc
-	jr nc, .valid_nickname
-
-	push bc
-	push hl
-	ld hl, wPartySpecies
-	push bc
-	ld b, 0
-	add hl, bc
-	pop bc
-	ld a, [hl]
-	cp EGG
-	ld hl, .TAMAGO
-	jr z, .got_nickname
-	ld [wd265], a
-	call GetPokemonName
-	ld hl, wStringBuffer1
-.got_nickname
-	pop de
-	ld bc, MON_NAME_LENGTH
-	call CopyBytes
-	pop bc
-
-.valid_nickname
-	inc c
-	dec b
-	jr nz, .loop3
-
-	ld de, wPartyMonOT
-	ld a, [wPartyCount]
-	ld b, a
-	ld c, 0
-.loop4
-	push bc
-	call .GetLengthOfStringWith6CharCap
-	push de
-	farcall CheckStringForErrors
-	pop hl
-	jr nc, .valid_ot_name
-	ld d, h
-	ld e, l
-	ld hl, wPlayerName
-	ld bc, NAME_LENGTH
-	call CopyBytes
-.valid_ot_name
-	pop bc
-	inc c
-	dec b
-	jr nz, .loop4
-
-	ld hl, wPartyMon1Moves
-	ld a, [wPartyCount]
-	ld b, a
-.loop5
-	push hl
-	ld c, NUM_MOVES
-	ld a, [hl]
-	and a
-	jr z, .invalid_move
-	cp NUM_ATTACKS + 1
-	jr c, .moves_loop
-.invalid_move
-	ld [hl], POUND
-
-.moves_loop
-	ld a, [hl]
-	and a
-	jr z, .fill_invalid_moves
-	cp NUM_ATTACKS + 1
-	jr c, .next_move
-
-.fill_invalid_moves
-	xor a
-	ld [hli], a
-	dec c
-	jr nz, .fill_invalid_moves
-	jr .next_pokemon
-
-.next_move
-	inc hl
-	dec c
-	jr nz, .moves_loop
-
-.next_pokemon
-	pop hl
-	push bc
-	ld bc, PARTYMON_STRUCT_LENGTH
-	add hl, bc
-	pop bc
-	dec b
-	jr nz, .loop5
-	ret
-; 13b6b
-
-.TAMAGO: ; 13b6b
-	db "タマゴ@@@"
-; 13b71
-
-.GetLengthOfStringWith6CharCap: ; 13b71
-	push de
-	ld c, 1
-	ld b, NAME_LENGTH_JAPANESE
-.search_loop
-	ld a, [de]
-	cp "@"
-	jr z, .done
-	inc de
-	inc c
-	dec b
-	jr nz, .search_loop
-	dec c
-	dec de
-	ld a, "@"
-	ld [de], a
-.done
-	pop de
-	ret
-; 13b87
--- a/engine/pokemon/getbreedmonlevelgrowth.asm
+++ /dev/null
@@ -1,27 +1,0 @@
-GetBreedMon1LevelGrowth: ; e698
-	ld hl, wBreedMon1Stats
-	ld de, wTempMon
-	ld bc, BOXMON_STRUCT_LENGTH
-	call CopyBytes
-	callfar CalcLevel
-	ld a, [wBreedMon1Level]
-	ld b, a
-	ld a, d
-	ld e, a
-	sub b
-	ld d, a
-	ret
-
-GetBreedMon2LevelGrowth: ; e6b3
-	ld hl, wBreedMon2Stats
-	ld de, wTempMon
-	ld bc, BOXMON_STRUCT_LENGTH
-	call CopyBytes
-	callfar CalcLevel
-	ld a, [wBreedMon2Level]
-	ld b, a
-	ld a, d
-	ld e, a
-	sub b
-	ld d, a
-	ret
--- /dev/null
+++ b/engine/pokemon/knows_move.asm
@@ -1,0 +1,25 @@
+KnowsMove: ; f9ea
+	ld a, MON_MOVES
+	call GetPartyParamLocation
+	ld a, [wPutativeTMHMMove]
+	ld b, a
+	ld c, NUM_MOVES
+.loop
+	ld a, [hli]
+	cp b
+	jr z, .knows_move
+	dec c
+	jr nz, .loop
+	and a
+	ret
+
+.knows_move
+	ld hl, .Text_knows
+	call PrintText
+	scf
+	ret
+
+.Text_knows: ; 0xfa06
+	; knows @ .
+	text_jump UnknownText_0x1c5ea8
+	db "@"
--- a/engine/pokemon/knowsmove.asm
+++ /dev/null
@@ -1,25 +1,0 @@
-KnowsMove: ; f9ea
-	ld a, MON_MOVES
-	call GetPartyParamLocation
-	ld a, [wPutativeTMHMMove]
-	ld b, a
-	ld c, NUM_MOVES
-.loop
-	ld a, [hli]
-	cp b
-	jr z, .knows_move
-	dec c
-	jr nz, .loop
-	and a
-	ret
-
-.knows_move
-	ld hl, .Text_knows
-	call PrintText
-	scf
-	ret
-
-.Text_knows: ; 0xfa06
-	; knows @ .
-	text_jump UnknownText_0x1c5ea8
-	db "@"
--- /dev/null
+++ b/engine/pokemon/level_up_happiness.asm
@@ -1,0 +1,20 @@
+LevelUpHappinessMod: ; 2709e
+	ld a, [wCurPartyMon]
+	ld hl, wPartyMon1CaughtLocation
+	call GetPartyLocation
+	ld a, [hl]
+	and $7f
+	ld d, a
+	ld a, [wMapGroup]
+	ld b, a
+	ld a, [wMapNumber]
+	ld c, a
+	call GetWorldMapLocation
+	cp d
+	ld c, HAPPINESS_GAINLEVEL
+	jr nz, .ok
+	ld c, HAPPINESS_GAINLEVELATHOME
+
+.ok
+	callfar ChangeHappiness
+	ret
--- a/engine/pokemon/leveluphappinessmod.asm
+++ /dev/null
@@ -1,20 +1,0 @@
-LevelUpHappinessMod: ; 2709e
-	ld a, [wCurPartyMon]
-	ld hl, wPartyMon1CaughtLocation
-	call GetPartyLocation
-	ld a, [hl]
-	and $7f
-	ld d, a
-	ld a, [wMapGroup]
-	ld b, a
-	ld a, [wMapNumber]
-	ld c, a
-	call GetWorldMapLocation
-	cp d
-	ld c, HAPPINESS_GAINLEVEL
-	jr nz, .ok
-	ld c, HAPPINESS_GAINLEVELATHOME
-
-.ok
-	callfar ChangeHappiness
-	ret
--- /dev/null
+++ b/engine/rtc/print_hours_mins.asm
@@ -1,0 +1,63 @@
+Unreferenced_Function1dd6a9: ; 1dd6a9
+	ld a, b
+	ld b, c
+	ld c, a
+	push bc
+	push de
+	ld hl, sp+$2
+	ld d, h
+	ld e, l
+	pop hl
+	lb bc, PRINTNUM_LEADINGZEROS | 2, 5
+	call PrintNum
+	pop bc
+	ret
+
+PrintHoursMins: ; 1dd6bb (77:56bb)
+; Hours in b, minutes in c
+	ld a, b
+	cp 12
+	push af
+	jr c, .AM
+	jr z, .PM
+	sub 12
+	jr .PM
+.AM:
+	or a
+	jr nz, .PM
+	ld a, 12
+.PM:
+	ld b, a
+; Crazy stuff happening with the stack
+	push bc
+	ld hl, sp+$1
+	push de
+	push hl
+	pop de
+	pop hl
+	ld [hl], " "
+	lb bc, 1, 2
+	call PrintNum
+	ld [hl], ":"
+	inc hl
+	ld d, h
+	ld e, l
+	ld hl, sp+$0
+	push de
+	push hl
+	pop de
+	pop hl
+	lb bc, PRINTNUM_LEADINGZEROS | 1, 2
+	call PrintNum
+	pop bc
+	ld de, String_AM
+	pop af
+	jr c, .place_am_pm
+	ld de, String_PM
+.place_am_pm
+	inc hl
+	call PlaceString
+	ret
+
+String_AM: db "AM@" ; 1dd6fc
+String_PM: db "PM@" ; 1dd6ff
--- a/engine/rtc/printhoursmins.asm
+++ /dev/null
@@ -1,63 +1,0 @@
-Unreferenced_Function1dd6a9: ; 1dd6a9
-	ld a, b
-	ld b, c
-	ld c, a
-	push bc
-	push de
-	ld hl, sp+$2
-	ld d, h
-	ld e, l
-	pop hl
-	lb bc, PRINTNUM_LEADINGZEROS | 2, 5
-	call PrintNum
-	pop bc
-	ret
-
-PrintHoursMins: ; 1dd6bb (77:56bb)
-; Hours in b, minutes in c
-	ld a, b
-	cp 12
-	push af
-	jr c, .AM
-	jr z, .PM
-	sub 12
-	jr .PM
-.AM:
-	or a
-	jr nz, .PM
-	ld a, 12
-.PM:
-	ld b, a
-; Crazy stuff happening with the stack
-	push bc
-	ld hl, sp+$1
-	push de
-	push hl
-	pop de
-	pop hl
-	ld [hl], " "
-	lb bc, 1, 2
-	call PrintNum
-	ld [hl], ":"
-	inc hl
-	ld d, h
-	ld e, l
-	ld hl, sp+$0
-	push de
-	push hl
-	pop de
-	pop hl
-	lb bc, PRINTNUM_LEADINGZEROS | 1, 2
-	call PrintNum
-	pop bc
-	ld de, String_AM
-	pop af
-	jr c, .place_am_pm
-	ld de, String_PM
-.place_am_pm
-	inc hl
-	call PlaceString
-	ret
-
-String_AM: db "AM@" ; 1dd6fc
-String_PM: db "PM@" ; 1dd6ff
--- /dev/null
+++ b/engine/tilesets/timeofday_pals.asm
@@ -1,0 +1,415 @@
+DummyPredef35: ; 8c000
+DummyPredef36:
+	ret
+
+UpdateTimeOfDayPal:: ; 8c001
+	call UpdateTime
+	ld a, [wTimeOfDay]
+	ld [wCurTimeOfDay], a
+	call GetTimePalette
+	ld [wTimeOfDayPal], a
+	ret
+; 8c011
+
+
+_TimeOfDayPals:: ; 8c011
+; return carry if pals are changed
+
+; forced pals?
+	ld hl, wTimeOfDayPalFlags
+	bit 7, [hl]
+	jr nz, .dontchange
+
+; do we need to bother updating?
+	ld a, [wTimeOfDay]
+	ld hl, wCurTimeOfDay
+	cp [hl]
+	jr z, .dontchange
+
+; if so, the time of day has changed
+	ld a, [wTimeOfDay]
+	ld [wCurTimeOfDay], a
+
+; get palette id
+	call GetTimePalette
+
+; same palette as before?
+	ld hl, wTimeOfDayPal
+	cp [hl]
+	jr z, .dontchange
+
+; update palette id
+	ld [wTimeOfDayPal], a
+
+; save bg palette 7
+	ld hl, wBGPals1 palette PAL_BG_TEXT
+
+; save wram bank
+	ld a, [rSVBK]
+	ld b, a
+
+	ld a, BANK(wBGPals1)
+	ld [rSVBK], a
+
+; push palette
+	ld c, NUM_PAL_COLORS
+.push
+	ld d, [hl]
+	inc hl
+	ld e, [hl]
+	inc hl
+	push de
+	dec c
+	jr nz, .push
+
+; restore wram bank
+	ld a, b
+	ld [rSVBK], a
+
+
+; update sgb pals
+	ld b, SCGB_MAPPALS
+	call GetSGBLayout
+
+
+; restore bg palette 7
+	ld hl, wOBPals1 - 1 ; last byte in wBGPals1
+
+; save wram bank
+	ld a, [rSVBK]
+	ld d, a
+
+	ld a, BANK(wOBPals1)
+	ld [rSVBK], a
+
+; pop palette
+	ld e, NUM_PAL_COLORS
+.pop
+	pop bc
+	ld [hl], c
+	dec hl
+	ld [hl], b
+	dec hl
+	dec e
+	jr nz, .pop
+
+; restore wram bank
+	ld a, d
+	ld [rSVBK], a
+
+; update palettes
+	call _UpdateTimePals
+	call DelayFrame
+
+; successful change
+	scf
+	ret
+
+.dontchange
+; no change occurred
+	and a
+	ret
+; 8c070
+
+
+_UpdateTimePals:: ; 8c070
+	ld c, $9 ; normal
+	call GetTimePalFade
+	call DmgToCgbTimePals
+	ret
+; 8c079
+
+FadeInPalettes:: ; 8c079
+	ld c, $12
+	call GetTimePalFade
+	ld b, $4
+	call ConvertTimePalsDecHL
+	ret
+; 8c084
+
+FadeOutPalettes:: ; 8c084
+	call FillWhiteBGColor
+	ld c, $9
+	call GetTimePalFade
+	ld b, $4
+	call ConvertTimePalsIncHL
+	ret
+; 8c092
+
+BattleTowerFade: ; 8c092
+	call FillWhiteBGColor
+	ld c, $9
+	call GetTimePalFade
+	ld b, $4
+.asm_8c09c
+	call DmgToCgbTimePals
+	inc hl
+	inc hl
+	inc hl
+	ld c, $7
+	call DelayFrames
+	dec b
+	jr nz, .asm_8c09c
+	ret
+; 8c0ab
+
+FadeInQuickly: ; 8c0ab
+	ld c, $0
+	call GetTimePalFade
+	ld b, $4
+	call ConvertTimePalsIncHL
+	ret
+; 8c0b6
+
+FadeBlackQuickly: ; 8c0b6
+	ld c, $9
+	call GetTimePalFade
+	ld b, $4
+	call ConvertTimePalsDecHL
+	ret
+; 8c0c1
+
+
+FillWhiteBGColor: ; 8c0c1
+	ld a, [rSVBK]
+	push af
+	ld a, BANK(wBGPals1)
+	ld [rSVBK], a
+
+	ld hl, wBGPals1
+	ld a, [hli]
+	ld e, a
+	ld a, [hli]
+	ld d, a
+	ld hl, wBGPals1 + 1 palettes
+	ld c, 6
+.loop
+	ld a, e
+	ld [hli], a
+	ld a, d
+	ld [hli], a
+rept 6
+	inc hl
+endr
+	dec c
+	jr nz, .loop
+
+	pop af
+	ld [rSVBK], a
+	ret
+; 8c0e5
+
+ReplaceTimeOfDayPals: ; 8c0e5
+	ld hl, .BrightnessLevels
+	ld a, [wMapTimeOfDay]
+	cp $4 ; Dark cave, needs Flash
+	jr z, .DarkCave
+	and $7
+	add l
+	ld l, a
+	ld a, $0
+	adc h
+	ld h, a
+	ld a, [hl]
+	ld [wTimeOfDayPalset], a
+	ret
+
+.DarkCave:
+	ld a, [wStatusFlags]
+	bit STATUSFLAGS_FLASH_F, a
+	jr nz, .UsedFlash
+	ld a, %11111111 ; 3, 3, 3, 3
+	ld [wTimeOfDayPalset], a
+	ret
+
+.UsedFlash:
+	ld a, %10101010 ; 2, 2, 2, 2
+	ld [wTimeOfDayPalset], a
+	ret
+; 8c10f (23:410f)
+
+.BrightnessLevels: ; 8c10f
+	dc 3, 2, 1, 0
+	dc 1, 1, 1, 1
+	dc 2, 2, 2, 2
+	dc 0, 0, 0, 0
+	dc 3, 3, 3, 3
+	dc 3, 2, 1, 0
+	dc 3, 2, 1, 0
+	dc 3, 2, 1, 0
+; 8c117
+
+GetTimePalette: ; 8c117
+	ld a, [wTimeOfDay]
+	ld e, a
+	ld d, 0
+	ld hl, .TimePalettes
+	add hl, de
+	add hl, de
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	jp hl
+; 8c126
+
+.TimePalettes:
+	dw .MorningPalette
+	dw .DayPalette
+	dw .NitePalette
+	dw .DarknessPalette
+
+.MorningPalette:
+	ld a, [wTimeOfDayPalset]
+	and %00000011 ; 0
+	ret
+
+.DayPalette:
+	ld a, [wTimeOfDayPalset]
+	and %00001100 ; 1
+	srl a
+	srl a
+	ret
+
+.NitePalette:
+	ld a, [wTimeOfDayPalset]
+	and %00110000 ; 2
+	swap a
+	ret
+
+.DarknessPalette:
+	ld a, [wTimeOfDayPalset]
+	and %11000000 ; 3
+	rlca
+	rlca
+	ret
+; 8c14e
+
+
+DmgToCgbTimePals: ; 8c14e
+	push hl
+	push de
+	ld a, [hli]
+	call DmgToCgbBGPals
+	ld a, [hli]
+	ld e, a
+	ld a, [hli]
+	ld d, a
+	call DmgToCgbObjPals
+	pop de
+	pop hl
+	ret
+; 8c15e
+
+ConvertTimePalsIncHL: ; 8c15e
+.loop
+	call DmgToCgbTimePals
+	inc hl
+	inc hl
+	inc hl
+	ld c, 2
+	call DelayFrames
+	dec b
+	jr nz, .loop
+	ret
+; 8c16d
+
+ConvertTimePalsDecHL: ; 8c16d
+.loop
+	call DmgToCgbTimePals
+	dec hl
+	dec hl
+	dec hl
+	ld c, 2
+	call DelayFrames
+	dec b
+	jr nz, .loop
+	ret
+; 8c17c
+
+
+GetTimePalFade: ; 8c17c
+; check cgb
+	ld a, [hCGB]
+	and a
+	jr nz, .cgb
+
+; else: dmg
+
+; index
+	ld a, [wTimeOfDayPal]
+	and %11
+
+; get fade table
+	push bc
+	ld c, a
+	ld b, $0
+	ld hl, .dmgfades
+	add hl, bc
+	add hl, bc
+	ld a, [hli]
+	ld h, [hl]
+	ld l, a
+	pop bc
+
+; get place in fade table
+	ld b, $0
+	add hl, bc
+	ret
+
+.cgb
+	ld hl, .cgbfade
+	ld b, $0
+	add hl, bc
+	ret
+
+.dmgfades
+	dw .morn
+	dw .day
+	dw .nite
+	dw .darkness
+
+.morn
+	db %11111111, %11111111, %11111111
+	db %11111110, %11111110, %11111110
+	db %11111001, %11100100, %11100100
+	db %11100100, %11010000, %11010000
+	db %10010000, %10000000, %10000000
+	db %01000000, %01000000, %01000000
+	db %00000000, %00000000, %00000000
+
+.day
+	db %11111111, %11111111, %11111111
+	db %11111110, %11111110, %11111110
+	db %11111001, %11100100, %11100100
+	db %11100100, %11010000, %11010000
+	db %10010000, %10000000, %10000000
+	db %01000000, %01000000, %01000000
+	db %00000000, %00000000, %00000000
+
+.nite
+	db %11111111, %11111111, %11111111
+	db %11111110, %11111110, %11111110
+	db %11111001, %11100100, %11100100
+	db %11101001, %11010000, %11010000
+	db %10010000, %10000000, %10000000
+	db %01000000, %01000000, %01000000
+	db %00000000, %00000000, %00000000
+
+.darkness
+	db %11111111, %11111111, %11111111
+	db %11111110, %11111110, %11111111
+	db %11111110, %11100100, %11111111
+	db %11111101, %11010000, %11111111
+	db %11111101, %10000000, %11111111
+	db %00000000, %01000000, %00000000
+	db %00000000, %00000000, %00000000
+
+.cgbfade
+	db %11111111, %11111111, %11111111
+	db %11111110, %11111110, %11111110
+	db %11111001, %11111001, %11111001
+	db %11100100, %11100100, %11100100
+	db %10010000, %10010000, %10010000
+	db %01000000, %01000000, %01000000
+	db %00000000, %00000000, %00000000
+; 8c20f
--- a/engine/tilesets/timeofdaypals.asm
+++ /dev/null
@@ -1,415 +1,0 @@
-DummyPredef35: ; 8c000
-DummyPredef36:
-	ret
-
-UpdateTimeOfDayPal:: ; 8c001
-	call UpdateTime
-	ld a, [wTimeOfDay]
-	ld [wCurTimeOfDay], a
-	call GetTimePalette
-	ld [wTimeOfDayPal], a
-	ret
-; 8c011
-
-
-_TimeOfDayPals:: ; 8c011
-; return carry if pals are changed
-
-; forced pals?
-	ld hl, wTimeOfDayPalFlags
-	bit 7, [hl]
-	jr nz, .dontchange
-
-; do we need to bother updating?
-	ld a, [wTimeOfDay]
-	ld hl, wCurTimeOfDay
-	cp [hl]
-	jr z, .dontchange
-
-; if so, the time of day has changed
-	ld a, [wTimeOfDay]
-	ld [wCurTimeOfDay], a
-
-; get palette id
-	call GetTimePalette
-
-; same palette as before?
-	ld hl, wTimeOfDayPal
-	cp [hl]
-	jr z, .dontchange
-
-; update palette id
-	ld [wTimeOfDayPal], a
-
-; save bg palette 7
-	ld hl, wBGPals1 palette PAL_BG_TEXT
-
-; save wram bank
-	ld a, [rSVBK]
-	ld b, a
-
-	ld a, BANK(wBGPals1)
-	ld [rSVBK], a
-
-; push palette
-	ld c, NUM_PAL_COLORS
-.push
-	ld d, [hl]
-	inc hl
-	ld e, [hl]
-	inc hl
-	push de
-	dec c
-	jr nz, .push
-
-; restore wram bank
-	ld a, b
-	ld [rSVBK], a
-
-
-; update sgb pals
-	ld b, SCGB_MAPPALS
-	call GetSGBLayout
-
-
-; restore bg palette 7
-	ld hl, wOBPals1 - 1 ; last byte in wBGPals1
-
-; save wram bank
-	ld a, [rSVBK]
-	ld d, a
-
-	ld a, BANK(wOBPals1)
-	ld [rSVBK], a
-
-; pop palette
-	ld e, NUM_PAL_COLORS
-.pop
-	pop bc
-	ld [hl], c
-	dec hl
-	ld [hl], b
-	dec hl
-	dec e
-	jr nz, .pop
-
-; restore wram bank
-	ld a, d
-	ld [rSVBK], a
-
-; update palettes
-	call _UpdateTimePals
-	call DelayFrame
-
-; successful change
-	scf
-	ret
-
-.dontchange
-; no change occurred
-	and a
-	ret
-; 8c070
-
-
-_UpdateTimePals:: ; 8c070
-	ld c, $9 ; normal
-	call GetTimePalFade
-	call DmgToCgbTimePals
-	ret
-; 8c079
-
-FadeInPalettes:: ; 8c079
-	ld c, $12
-	call GetTimePalFade
-	ld b, $4
-	call ConvertTimePalsDecHL
-	ret
-; 8c084
-
-FadeOutPalettes:: ; 8c084
-	call FillWhiteBGColor
-	ld c, $9
-	call GetTimePalFade
-	ld b, $4
-	call ConvertTimePalsIncHL
-	ret
-; 8c092
-
-BattleTowerFade: ; 8c092
-	call FillWhiteBGColor
-	ld c, $9
-	call GetTimePalFade
-	ld b, $4
-.asm_8c09c
-	call DmgToCgbTimePals
-	inc hl
-	inc hl
-	inc hl
-	ld c, $7
-	call DelayFrames
-	dec b
-	jr nz, .asm_8c09c
-	ret
-; 8c0ab
-
-FadeInQuickly: ; 8c0ab
-	ld c, $0
-	call GetTimePalFade
-	ld b, $4
-	call ConvertTimePalsIncHL
-	ret
-; 8c0b6
-
-FadeBlackQuickly: ; 8c0b6
-	ld c, $9
-	call GetTimePalFade
-	ld b, $4
-	call ConvertTimePalsDecHL
-	ret
-; 8c0c1
-
-
-FillWhiteBGColor: ; 8c0c1
-	ld a, [rSVBK]
-	push af
-	ld a, BANK(wBGPals1)
-	ld [rSVBK], a
-
-	ld hl, wBGPals1
-	ld a, [hli]
-	ld e, a
-	ld a, [hli]
-	ld d, a
-	ld hl, wBGPals1 + 1 palettes
-	ld c, 6
-.loop
-	ld a, e
-	ld [hli], a
-	ld a, d
-	ld [hli], a
-rept 6
-	inc hl
-endr
-	dec c
-	jr nz, .loop
-
-	pop af
-	ld [rSVBK], a
-	ret
-; 8c0e5
-
-ReplaceTimeOfDayPals: ; 8c0e5
-	ld hl, .BrightnessLevels
-	ld a, [wMapTimeOfDay]
-	cp $4 ; Dark cave, needs Flash
-	jr z, .DarkCave
-	and $7
-	add l
-	ld l, a
-	ld a, $0
-	adc h
-	ld h, a
-	ld a, [hl]
-	ld [wTimeOfDayPalset], a
-	ret
-
-.DarkCave:
-	ld a, [wStatusFlags]
-	bit STATUSFLAGS_FLASH_F, a
-	jr nz, .UsedFlash
-	ld a, %11111111 ; 3, 3, 3, 3
-	ld [wTimeOfDayPalset], a
-	ret
-
-.UsedFlash:
-	ld a, %10101010 ; 2, 2, 2, 2
-	ld [wTimeOfDayPalset], a
-	ret
-; 8c10f (23:410f)
-
-.BrightnessLevels: ; 8c10f
-	dc 3, 2, 1, 0
-	dc 1, 1, 1, 1
-	dc 2, 2, 2, 2
-	dc 0, 0, 0, 0
-	dc 3, 3, 3, 3
-	dc 3, 2, 1, 0
-	dc 3, 2, 1, 0
-	dc 3, 2, 1, 0
-; 8c117
-
-GetTimePalette: ; 8c117
-	ld a, [wTimeOfDay]
-	ld e, a
-	ld d, 0
-	ld hl, .TimePalettes
-	add hl, de
-	add hl, de
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	jp hl
-; 8c126
-
-.TimePalettes:
-	dw .MorningPalette
-	dw .DayPalette
-	dw .NitePalette
-	dw .DarknessPalette
-
-.MorningPalette:
-	ld a, [wTimeOfDayPalset]
-	and %00000011 ; 0
-	ret
-
-.DayPalette:
-	ld a, [wTimeOfDayPalset]
-	and %00001100 ; 1
-	srl a
-	srl a
-	ret
-
-.NitePalette:
-	ld a, [wTimeOfDayPalset]
-	and %00110000 ; 2
-	swap a
-	ret
-
-.DarknessPalette:
-	ld a, [wTimeOfDayPalset]
-	and %11000000 ; 3
-	rlca
-	rlca
-	ret
-; 8c14e
-
-
-DmgToCgbTimePals: ; 8c14e
-	push hl
-	push de
-	ld a, [hli]
-	call DmgToCgbBGPals
-	ld a, [hli]
-	ld e, a
-	ld a, [hli]
-	ld d, a
-	call DmgToCgbObjPals
-	pop de
-	pop hl
-	ret
-; 8c15e
-
-ConvertTimePalsIncHL: ; 8c15e
-.loop
-	call DmgToCgbTimePals
-	inc hl
-	inc hl
-	inc hl
-	ld c, 2
-	call DelayFrames
-	dec b
-	jr nz, .loop
-	ret
-; 8c16d
-
-ConvertTimePalsDecHL: ; 8c16d
-.loop
-	call DmgToCgbTimePals
-	dec hl
-	dec hl
-	dec hl
-	ld c, 2
-	call DelayFrames
-	dec b
-	jr nz, .loop
-	ret
-; 8c17c
-
-
-GetTimePalFade: ; 8c17c
-; check cgb
-	ld a, [hCGB]
-	and a
-	jr nz, .cgb
-
-; else: dmg
-
-; index
-	ld a, [wTimeOfDayPal]
-	and %11
-
-; get fade table
-	push bc
-	ld c, a
-	ld b, $0
-	ld hl, .dmgfades
-	add hl, bc
-	add hl, bc
-	ld a, [hli]
-	ld h, [hl]
-	ld l, a
-	pop bc
-
-; get place in fade table
-	ld b, $0
-	add hl, bc
-	ret
-
-.cgb
-	ld hl, .cgbfade
-	ld b, $0
-	add hl, bc
-	ret
-
-.dmgfades
-	dw .morn
-	dw .day
-	dw .nite
-	dw .darkness
-
-.morn
-	db %11111111, %11111111, %11111111
-	db %11111110, %11111110, %11111110
-	db %11111001, %11100100, %11100100
-	db %11100100, %11010000, %11010000
-	db %10010000, %10000000, %10000000
-	db %01000000, %01000000, %01000000
-	db %00000000, %00000000, %00000000
-
-.day
-	db %11111111, %11111111, %11111111
-	db %11111110, %11111110, %11111110
-	db %11111001, %11100100, %11100100
-	db %11100100, %11010000, %11010000
-	db %10010000, %10000000, %10000000
-	db %01000000, %01000000, %01000000
-	db %00000000, %00000000, %00000000
-
-.nite
-	db %11111111, %11111111, %11111111
-	db %11111110, %11111110, %11111110
-	db %11111001, %11100100, %11100100
-	db %11101001, %11010000, %11010000
-	db %10010000, %10000000, %10000000
-	db %01000000, %01000000, %01000000
-	db %00000000, %00000000, %00000000
-
-.darkness
-	db %11111111, %11111111, %11111111
-	db %11111110, %11111110, %11111111
-	db %11111110, %11100100, %11111111
-	db %11111101, %11010000, %11111111
-	db %11111101, %10000000, %11111111
-	db %00000000, %01000000, %00000000
-	db %00000000, %00000000, %00000000
-
-.cgbfade
-	db %11111111, %11111111, %11111111
-	db %11111110, %11111110, %11111110
-	db %11111001, %11111001, %11111001
-	db %11100100, %11100100, %11100100
-	db %10010000, %10010000, %10010000
-	db %01000000, %01000000, %01000000
-	db %00000000, %00000000, %00000000
-; 8c20f
--- a/main.asm
+++ b/main.asm
@@ -3,18 +3,19 @@
 
 SECTION "bank1", ROMX
 
-INCLUDE "engine/link/placewaitingtext.asm"
-INCLUDE "engine/gfx/loadpushoam.asm"
+INCLUDE "engine/link/place_waiting_text.asm"
+INCLUDE "engine/gfx/load_push_oam.asm"
 INCLUDE "engine/overworld/map_objects.asm"
 INCLUDE "engine/menus/intro_menu.asm"
 INCLUDE "engine/overworld/init_map.asm"
 INCLUDE "engine/pokemon/learn.asm"
-INCLUDE "engine/pokemon/checknickerrors.asm"
+INCLUDE "engine/pokemon/check_nick_errors.asm"
 INCLUDE "engine/math/math.asm"
 INCLUDE "data/items/attributes.asm"
 INCLUDE "engine/overworld/npc_movement.asm"
 INCLUDE "engine/events/happiness_egg.asm"
-INCLUDE "engine/events/specials_2.asm"
+INCLUDE "engine/events/shuckle.asm"
+INCLUDE "engine/events/haircut.asm"
 
 
 SECTION "bank2", ROMX
@@ -29,7 +30,7 @@
 
 INCLUDE "engine/events/checktime.asm"
 INCLUDE "engine/events/specials.asm"
-INCLUDE "engine/math/printnum.asm"
+INCLUDE "engine/math/print_num.asm"
 INCLUDE "engine/pokemon/health.asm"
 INCLUDE "engine/events/overworld.asm"
 INCLUDE "engine/items/items.asm"
@@ -36,12 +37,12 @@
 INCLUDE "engine/overworld/player_step.asm"
 INCLUDE "engine/battle/anim_hp_bar.asm"
 INCLUDE "engine/pokemon/move_mon.asm"
-INCLUDE "engine/pokemon/billspctop.asm"
-INCLUDE "engine/pokemon/getbreedmonlevelgrowth.asm"
+INCLUDE "engine/pokemon/bills_pc_top.asm"
+INCLUDE "engine/pokemon/breedmon_level_growth.asm"
 INCLUDE "engine/events/bug_contest/caught_mon.asm"
 INCLUDE "engine/items/item_effects.asm"
-INCLUDE "engine/battle_anims/getpokeballwobble.asm"
-INCLUDE "engine/pokemon/knowsmove.asm"
+INCLUDE "engine/battle_anims/pokeball_wobble.asm"
+INCLUDE "engine/pokemon/knows_move.asm"
 
 
 SECTION "bank4", ROMX
@@ -64,8 +65,8 @@
 INCLUDE "engine/events/bug_contest/judging.asm"
 INCLUDE "engine/events/pokerus/apply_pokerus_tick.asm"
 INCLUDE "engine/events/bug_contest/contest_2.asm"
-INCLUDE "engine/pokemon/correcterrorsinplayerparty.asm"
-INCLUDE "engine/math/getsquareroot.asm"
+INCLUDE "engine/pokemon/correct_party_errors.asm"
+INCLUDE "engine/math/get_square_root.asm"
 
 
 SECTION "bank5", ROMX
@@ -102,7 +103,7 @@
 
 INCLUDE "data/text_buffers.asm"
 INCLUDE "engine/menus/menu.asm"
-INCLUDE "engine/items/updateitemdescription.asm"
+INCLUDE "engine/items/update_item_description.asm"
 INCLUDE "engine/events/pokepic.asm"
 INCLUDE "engine/overworld/map_objects_2.asm"
 INCLUDE "engine/menus/scrolling_menu.asm"
@@ -114,11 +115,11 @@
 INCLUDE "engine/menus/trainer_card.asm"
 INCLUDE "engine/events/prof_oaks_pc.asm"
 INCLUDE "engine/overworld/decorations.asm"
-INCLUDE "engine/pokemon/leveluphappinessmod.asm"
+INCLUDE "engine/pokemon/level_up_happiness.asm"
 INCLUDE "engine/battle/read_trainer_dvs.asm"
 INCLUDE "data/trainers/dvs.asm"
 INCLUDE "engine/battle/returntobattle_useball.asm"
-INCLUDE "engine/battle/consumehelditem.asm"
+INCLUDE "engine/battle/consume_held_item.asm"
 INCLUDE "data/moves/effects_pointers.asm"
 INCLUDE "data/moves/effects.asm"
 INCLUDE "engine/events/kurt_selectquantity_interpretjoypad.asm"
@@ -148,7 +149,7 @@
 INCLUDE "data/moves/descriptions.asm"
 INCLUDE "engine/events/pokerus/pokerus.asm"
 INCLUDE "engine/battle/start_battle.asm"
-INCLUDE "engine/gfx/placegraphic.asm"
+INCLUDE "engine/gfx/place_graphic.asm"
 
 
 SECTION "Effect Commands", ROMX
@@ -192,7 +193,7 @@
 SECTION "Crystal Features 1", ROMX
 
 INCLUDE "engine/menus/init_gender.asm"
-INCLUDE "engine/gfx/drawkrispackgfx.asm"
+INCLUDE "engine/items/pack_kris.asm"
 INCLUDE "engine/events/move_tutor.asm"
 INCLUDE "engine/gfx/crystal_layouts.asm"
 INCLUDE "engine/events/celebi.asm"
@@ -208,11 +209,11 @@
 INCLUDE "engine/tilesets/map_palettes.asm"
 INCLUDE "gfx/tileset_palette_maps.asm"
 INCLUDE "data/collision_permissions.asm"
-INCLUDE "engine/menus/emptyallsrambanks.asm"
+INCLUDE "engine/menus/empty_sram.asm"
 INCLUDE "engine/menus/savemenu_copytilemapatonce.asm"
 INCLUDE "engine/events/checksave.asm"
 INCLUDE "data/maps/scenes.asm"
-INCLUDE "engine/overworld/loadmappart.asm"
+INCLUDE "engine/overworld/load_map_part.asm"
 INCLUDE "engine/phone/phonering_copytilemapatonce.asm"
 
 Shrink1Pic: ; 4d249
@@ -226,7 +227,7 @@
 INCLUDE "engine/menus/delete_save.asm"
 INCLUDE "data/tilesets.asm"
 INCLUDE "engine/smallflag.asm"
-INCLUDE "engine/gfx/trademonfrontpic.asm"
+INCLUDE "engine/gfx/trademon_frontpic.asm"
 INCLUDE "engine/events/pokerus/check_pokerus.asm"
 INCLUDE "engine/events/lucky_number.asm"
 INCLUDE "engine/pokemon/caught_data.asm"
@@ -238,7 +239,7 @@
 INCLUDE "engine/events/battle_tower/get_trainer_class.asm"
 INCLUDE "engine/battle/sliding_intro.asm"
 INCLUDE "mobile/print_opp_message.asm"
-INCLUDE "engine/battle/checkbattlescene.asm"
+INCLUDE "engine/battle/check_battle_scene.asm"
 INCLUDE "engine/movie/gbc_only.asm"
 INCLUDE "engine/events/poke_seer.asm"
 
@@ -256,7 +257,7 @@
 INCLUDE "engine/pokemon/types.asm"
 INCLUDE "engine/battle/unreferenced_getgen1trainerclassname.asm"
 INCLUDE "engine/pokemon/mon_stats.asm"
-INCLUDE "engine/link/initlist.asm"
+INCLUDE "engine/link/init_list.asm"
 INCLUDE "engine/pokemon/experience.asm"
 INCLUDE "engine/pokemon/switchpartymons.asm"
 INCLUDE "engine/gfx/load_pics.asm"
@@ -305,7 +306,7 @@
 
 SECTION "bank23", ROMX
 
-INCLUDE "engine/tilesets/timeofdaypals.asm"
+INCLUDE "engine/tilesets/timeofday_pals.asm"
 INCLUDE "engine/battle/battle_transition.asm"
 INCLUDE "engine/events/field_moves.asm"
 INCLUDE "engine/events/magnet_train.asm"
@@ -356,7 +357,7 @@
 INCLUDE "engine/events/map_name_sign.asm"
 INCLUDE "engine/events/checkforhiddenitems.asm"
 INCLUDE "engine/events/treemons.asm"
-INCLUDE "engine/events/loadfishinggfx.asm"
+INCLUDE "engine/events/fishing_gfx.asm"
 INCLUDE "engine/pokegear/radio.asm"
 INCLUDE "engine/pokemon/mail_2.asm"
 
@@ -434,7 +435,7 @@
 INCLUDE "engine/games/card_flip.asm"
 INCLUDE "engine/games/unown_puzzle.asm"
 INCLUDE "engine/games/dummy_game.asm"
-INCLUDE "engine/pokemon/billspc.asm"
+INCLUDE "engine/pokemon/bills_pc.asm"
 
 
 SECTION "bank39", ROMX
@@ -451,8 +452,8 @@
 INCLUDE "engine/gfx/load_font.asm"
 INCLUDE "engine/link/time_capsule.asm"
 INCLUDE "engine/events/name_rater.asm"
-INCLUDE "engine/events/playslowcry.asm"
-INCLUDE "engine/pokedex/newpokedexentry.asm"
+INCLUDE "engine/events/play_slow_cry.asm"
+INCLUDE "engine/pokedex/new_pokedex_entry.asm"
 INCLUDE "engine/link/time_capsule_2.asm"
 INCLUDE "engine/pokedex/unown_dex.asm"
 INCLUDE "engine/events/magikarp.asm"
@@ -478,7 +479,7 @@
 INCLUDE "engine/link/mystery_gift.asm"
 INCLUDE "engine/battle/used_move_text.asm"
 INCLUDE "mobile/mobile_41.asm"
-INCLUDE "engine/gfx/loadoverworldfont.asm"
+INCLUDE "engine/gfx/load_overworld_font.asm"
 
 
 SECTION "Mobile 42", ROMX
@@ -527,7 +528,7 @@
 
 SECTION "UpdateBattleHUDs", ROMX
 
-INCLUDE "engine/battle/updatebattlehuds.asm"
+INCLUDE "engine/battle/update_battle_huds.asm"
 
 
 SECTION "Mobile 5E", ROMX
@@ -567,7 +568,7 @@
 SECTION "Miscellaneous Text", ROMX
 
 INCLUDE "data/items/names.asm"
-INCLUDE "engine/items/printitemdescription.asm"
+INCLUDE "engine/items/print_item_description.asm"
 INCLUDE "data/items/descriptions.asm"
 INCLUDE "data/moves/names.asm"
 INCLUDE "engine/overworld/landmarks.asm"
@@ -583,7 +584,7 @@
 
 SECTION "bank77_2", ROMX
 
-INCLUDE "engine/rtc/printhoursmins.asm"
+INCLUDE "engine/rtc/print_hours_mins.asm"
 INCLUDE "engine/events/diploma.asm"
 INCLUDE "engine/pokedex/pokedex_3.asm"
 INCLUDE "engine/events/catch_tutorial_input.asm"