shithub: pokered

ref: 9387e9ab15eb4f45878d4aeb856ed93acbf2c379
dir: /main.asm/

View raw version
INCLUDE "constants.asm"

; the rst vectors are unused
SECTION "rst00",ROM0[0]
	db $FF
SECTION "rst08",ROM0[8]
	db $FF
SECTION "rst10",ROM0[$10]
	db $FF
SECTION "rst18",ROM0[$18]
	db $FF
SECTION "rst20",ROM0[$20]
	db $FF
SECTION "rst28",ROM0[$28]
	db $FF
SECTION "rst30",ROM0[$30]
	db $FF
SECTION "rst38",ROM0[$38]
	db $FF

; interrupts
SECTION "vblank",ROM0[$40]
	jp VBlankHandler
SECTION "lcdc",ROM0[$48]
	db $FF
SECTION "timer",ROM0[$50]
	jp TimerHandler
SECTION "serial",ROM0[$58]
	jp SerialInterruptHandler
SECTION "joypad",ROM0[$60]
	reti

SECTION "bank0",ROM0[$61]

DisableLCD: ; 0061 (0:0061)
	xor a
	ld [$ff0f],a
	ld a,[$ffff]
	ld b,a
	res 0,a
	ld [$ffff],a
.waitVBlank
	ld a,[$ff44]
	cp a,$91
	jr nz,.waitVBlank
	ld a,[$ff40]
	and a,$7f	; res 7,a
	ld [$ff40],a
	ld a,b
	ld [$ffff],a
	ret

EnableLCD: ; 007b (0:007b)
	ld a,[$ff40]
	set 7,a
	ld [$ff40],a
	ret

CleanLCD_OAM: ; 0082 (0:0082)
	xor a
	ld hl,W_OAMBUFFER
	ld b,$a0
.loop
	ld [hli],a
	dec b
	jr nz,.loop
	ret

ResetLCD_OAM: ; 008d (0:008d)
	ld a,$a0
	ld hl,W_OAMBUFFER
	ld de,$0004
	ld b,$28
.loop
	ld [hl],a
	add hl,de
	dec b
	jr nz,.loop
	ret

FarCopyData: ; 009d (0:009d)
; copy bc bytes of data from a:hl to de
	ld [$CEE9],a ; save future bank # for later
	ld a,[H_LOADEDROMBANK] ; get current bank #
	push af
	ld a,[$CEE9] ; get future bank #, switch
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call CopyData
	pop af       ; okay, done, time to switch back
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret
CopyData: ; 00b5 (0:00b5)
; copy bc bytes of data from hl to de
	ld a,[hli]
	ld [de],a
	inc de
	dec bc
	ld a,c
	or b
	jr nz,CopyData
	ret

SECTION "romheader",ROM0[$100]
nop
jp Start

Section "start",ROM0[$150]
Start: ; 0150 (0:0150)
	cp $11 ; value that indicates Gameboy Color
	jr z,.gbcDetected
	xor a
	jr .storeValue
.gbcDetected
	ld a,$00
.storeValue
	ld [$cf1a],a ; same value ($00) either way
	jp InitGame

; this function directly reads the joypad I/O register
; it reads many times in order to give the joypad a chance to stabilize
; it saves a result in [$fff8] in the following format
; (set bit indicates pressed button)
; bit 0 - A button
; bit 1 - B button
; bit 2 - Select button
; bit 3 - Start button
; bit 4 - Right
; bit 5 - Left
; bit 6 - Up
; bit 7 - Down
ReadJoypadRegister: ; 015f (0:015f)
	ld a,%00100000 ; select direction keys
	ld c,$00
	ld [rJOYP],a
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	cpl ; complement the result so that a set bit indicates a pressed key
	and a,%00001111
	swap a ; put direction keys in upper nibble
	ld b,a
	ld a,%00010000 ; select button keys
	ld [rJOYP],a
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	ld a,[rJOYP]
	cpl ; complement the result so that a set bit indicates a pressed key
	and a,%00001111
	or b ; put button keys in lower nibble
	ld [H_JOYPADSTATE],a ; save joypad state
	ld a,%00110000 ; unselect all keys
	ld [rJOYP],a
	ret

; function to update the joypad state variables
; output:
; [H_NEWLYRELEASEDBUTTONS] = keys released since last time
; [H_NEWLYPRESSEDBUTTONS] = keys pressed since last time
; [H_CURRENTPRESSEDBUTTONS] = currently pressed keys
GetJoypadState: ; 019a (0:019a)
	ld a, [H_LOADEDROMBANK]
	push af
	ld a,$3
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call _GetJoypadState
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; see also MapHeaderBanks
MapHeaderPointers: ; 01ae (0:01ae)
	dw PalletTown_h
	dw ViridianCity_h
	dw PewterCity_h
	dw CeruleanCity_h
	dw LavenderTown_h
	dw VermilionCity_h
	dw CeladonCity_h
	dw FuchsiaCity_h
	dw CinnabarIsland_h
	dw IndigoPlateau_h
	dw SaffronCity_h
	dw SaffronCity_h
	dw Route1_h
	dw Route2_h
	dw Route3_h
	dw Route4_h
	dw Route5_h
	dw Route6_h
	dw Route7_h
	dw Route8_h
	dw Route9_h
	dw Route10_h
	dw Route11_h
	dw Route12_h
	dw Route13_h
	dw Route14_h
	dw Route15_h
	dw Route16_h
	dw Route17_h
	dw Route18_h
	dw Route19_h
	dw Route20_h
	dw Route21_h
	dw Route22_h
	dw Route23_h
	dw Route24_h
	dw Route25_h
	dw RedsHouse1F_h
	dw RedsHouse2F_h
	dw BluesHouse_h
	dw OaksLab_h ;id=40
	dw ViridianPokecenter_h
	dw ViridianMart_h
	dw School_h
	dw ViridianHouse_h
	dw ViridianGym_h
	dw DiglettsCaveRoute2_h
	dw ViridianForestexit_h
	dw Route2House_h
	dw Route2Gate_h
	dw ViridianForestEntrance_h ;id=50
	dw ViridianForest_h
	dw MuseumF1_h
	dw MuseumF2_h
	dw PewterGym_h
	dw PewterHouse1_h
	dw PewterMart_h
	dw PewterHouse2_h
	dw PewterPokecenter_h
	dw MtMoon1_h
	dw MtMoon2_h ;id=60
	dw MtMoon3_h
	dw CeruleanHouseTrashed_h
	dw CeruleanHouse2_h
	dw CeruleanPokecenter_h
	dw CeruleanGym_h
	dw BikeShop_h
	dw CeruleanMart_h
	dw MtMoonPokecenter_h
	dw CeruleanHouseTrashed_h ; copy
	dw Route5Gate_h
	dw UndergroundTunnelEntranceRoute5_h
	dw DayCareM_h
	dw Route6Gate_h
	dw UndergroundTunnelEntranceRoute6_h
	dw UndergroundTunnelEntranceRoute6_h ; unused
	dw Route7Gate_h
	dw UndergroundPathEntranceRoute7_h
	dw $575d
	dw Route8Gate_h
	dw UndergroundPathEntranceRoute8_h ;id=80
	dw RockTunnelPokecenter_h
	dw RockTunnel1_h
	dw PowerPlant_h
	dw Route11Gate_h
	dw DiglettsCaveEntranceRoute11_h
	dw Route11GateUpstairs_h
	dw Route12Gate_h
	dw BillsHouse_h
	dw VermilionPokecenter_h
	dw FanClub_h ;id=90
	dw VermilionMart_h
	dw VermilionGym_h
	dw VermilionHouse1_h
	dw VermilionDock_h
	dw SSAnne1_h
	dw SSAnne2_h
	dw SSAnne3_h
	dw SSAnne4_h
	dw SSAnne5_h
	dw SSAnne6_h ;id=100
	dw SSAnne7_h
	dw SSAnne8_h
	dw SSAnne9_h
	dw SSAnne10_h
	dw Lance_h ; unused
	dw Lance_h ; unused
	dw Lance_h ; unused
	dw VictoryRoad1_h
	dw Lance_h ; unused
	dw Lance_h ; unused ;id=110
	dw Lance_h ; unused
	dw Lance_h ; unused
	dw Lance_h
	dw Lance_h ; unused
	dw Lance_h ; unused
	dw Lance_h ; unused
	dw Lance_h ; unused
	dw HallofFameRoom_h
	dw UndergroundPathNS_h
	dw Gary_h ;id=120
	dw UndergroundPathWE_h
	dw CeladonMart1_h
	dw CeladonMart2_h
	dw CeladonMart3_h
	dw CeladonMart4_h
	dw CeladonMartRoof_h
	dw CeladonMartElevator_h
	dw CeladonMansion1_h
	dw CeladonMansion2_h
	dw CeladonMansion3_h ;id=130
	dw CeladonMansion4_h
	dw CeladonMansion5_h
	dw CeladonPokecenter_h
	dw CeladonGym_h
	dw CeladonGameCorner_h
	dw CeladonMart5_h
	dw CeladonPrizeRoom_h
	dw CeladonDiner_h
	dw CeladonHouse_h
	dw CeladonHotel_h ;id=140
	dw LavenderPokecenter_h
	dw PokemonTower1_h
	dw PokemonTower2_h
	dw PokemonTower3_h
	dw PokemonTower4_h
	dw PokemonTower5_h
	dw PokemonTower6_h
	dw PokemonTower7_h
	dw LavenderHouse1_h
	dw LavenderMart_h ;id=150
	dw LavenderHouse2_h
	dw FuchsiaMart_h
	dw FuchsiaHouse1_h
	dw FuchsiaPokecenter_h
	dw FuchsiaHouse2_h
	dw SafariZoneEntrance_h
	dw FuchsiaGym_h
	dw FuchsiaMeetingRoom_h
	dw SeafoamIslands2_h
	dw SeafoamIslands3_h ;id=160
	dw SeafoamIslands4_h
	dw SeafoamIslands5_h
	dw VermilionHouse2_h
	dw FuchsiaHouse3_h
	dw Mansion1_h
	dw CinnabarGym_h
	dw Lab1_h
	dw Lab2_h
	dw Lab3_h
	dw Lab4_h ;id=170
	dw CinnabarPokecenter_h
	dw CinnabarMart_h
	dw CinnabarMart_h ; unused
	dw IndigoPlateauLobby_h
	dw CopycatsHouseF1_h
	dw CopycatsHouseF2_h
	dw FightingDojo_h
	dw SaffronGym_h
	dw SaffronHouse1_h
	dw SaffronMart_h ;id=180
	dw SilphCo1_h
	dw SaffronPokecenter_h
	dw SaffronHouse2_h
	dw Route15Gate_h
	dw Route15GateUpstairs_h
	dw Route16GateMap_h
	dw Route16GateUpstairs_h
	dw Route16House_h
	dw Route12House_h
	dw Route18Gate_h ;id=190
	dw Route18GateHeader_h
	dw SeafoamIslands1_h
	dw Route22Gate_h
	dw VictoryRoad2_h
	dw Route12GateUpstairs_h
	dw VermilionHouse3_h
	dw DiglettsCave_h
	dw VictoryRoad3_h
	dw RocketHideout1_h
	dw RocketHideout2_h ;200
	dw RocketHideout3_h
	dw RocketHideout4_h
	dw RocketHideoutElevator_h
	dw RocketHideoutElevator_h ; unused
	dw RocketHideoutElevator_h ; unused
	dw RocketHideoutElevator_h ; unused
	dw SilphCo2_h
	dw SilphCo3_h
	dw SilphCo4_h
	dw SilphCo5_h ;210
	dw SilphCo6_h
	dw SilphCo7_h
	dw SilphCo8_h
	dw Mansion2_h
	dw Mansion3_h
	dw Mansion4_h
	dw SafariZoneEast_h
	dw SafariZoneNorth_h
	dw SafariZoneWest_h
	dw SafariZoneCenter_h ;220
	dw SafariZoneRestHouse1_h
	dw SafariZoneSecretHouse_h
	dw SafariZoneRestHouse2_h
	dw SafariZoneRestHouse3_h
	dw SafariZoneRestHouse4_h
	dw UnknownDungeon2_h
	dw UnknownDungeon3_h
	dw UnknownDungeon1_h
	dw NameRater_h
	dw CeruleanHouse3_h
	dw Route16GateMap_h ; unused
	dw RockTunnel2_h
	dw SilphCo9_h
	dw SilphCo10_h
	dw SilphCo11_h
	dw SilphCoElevator_h
	dw SilphCo2_h ; unused
	dw SilphCo2_h ; unused
	dw BattleCenterM_h
	dw TradeCenterM_h
	dw SilphCo2_h ; unused
	dw SilphCo2_h ; unused
	dw SilphCo2_h ; unused
	dw SilphCo2_h ; unused
	dw Lorelei_h
	dw Bruno_h
	dw Agatha_h ;247

; this function calls a function that takes necessary actions
; at the beginning of each overworld loop iteration as the player jumps
; down a ledge
; it also ends the jump when it's completed
HandleMidJump: ; 039e (0:039e)
	ld b, BANK(_HandleMidJump)
	ld hl, _HandleMidJump
	jp Bankswitch

; this is jumped to immediately after loading a save / starting a new game / loading a new map
EnterMap: ; 03a6 (0:03a6)
	ld a,$ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK],a
	call LoadMapData ; load map data
	ld b,BANK(Func_c335)
	ld hl,Func_c335
	call Bankswitch ; initialize some variables
	ld hl,$d72c
	bit 0,[hl]
	jr z,.doNotCountSteps
	ld a,$03
	ld [$d13c],a ; some kind of step counter (counts up to 3 steps?)
.doNotCountSteps
	ld hl,$d72e
	bit 5,[hl] ; did a battle happen immediately before this?
	res 5,[hl] ; unset the "battle just happened" flag
	call z,Func_12e7
	call nz,MapEntryAfterBattle
	ld hl,$d732
	ld a,[hl]
	and a,$18
	jr z,.didNotFlyOrTeleportIn
	res 3,[hl]
	ld b,BANK(Func_70510)
	ld hl,Func_70510
	call Bankswitch ; display fly/teleport in graphical effect
	call UpdateSprites ; move sprites
.didNotFlyOrTeleportIn
	ld b,BANK(CheckForceBikeOrSurf)
	ld hl,CheckForceBikeOrSurf
	call Bankswitch ; handle currents in SF islands and forced bike riding in cycling road
	ld hl,$d72d
	res 5,[hl]
	call UpdateSprites ; move sprites
	ld hl,$d126
	set 5,[hl]
	set 6,[hl]
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK],a

OverworldLoop: ; 03ff (0:03ff)
	call DelayFrame
OverworldLoopLessDelay: ; 0402 (0:0402)
	call DelayFrame
	call LoadGBPal
	ld a,[$d736]
	bit 6,a ; jumping down a ledge?
	call nz, HandleMidJump
	ld a,[W_WALKCOUNTER]
	and a
	jp nz,.moveAhead ; if the player sprite has not yet completed the walking animation
	call GetJoypadStateOverworld ; get joypad state (which is possibly simulated)
	ld b, BANK(Func_1e988)
	ld hl, Func_1e988
	call Bankswitch
	ld a,[$da46]
	and a
	jp nz,WarpFound2
	ld hl,$d72d
	bit 3,[hl]
	res 3,[hl]
	jp nz,WarpFound2
	ld a,[$d732]
	and a,$18
	jp nz,HandleFlyOrTeleportAway
	ld a,[W_CUROPPONENT]
	and a
	jp nz,.newBattle
	ld a,[$d730]
	bit 7,a ; are we simulating button presses?
	jr z,.notSimulating
	ld a,[H_CURRENTPRESSEDBUTTONS]
	jr .checkIfStartIsPressed
.notSimulating
	ld a,[H_NEWLYPRESSEDBUTTONS]
.checkIfStartIsPressed
	bit 3,a ; start button
	jr z,.startButtonNotPressed
; if START is pressed
	xor a
	ld [$ff8c],a ; the $2920 ID for the start menu is 0
	jp .displayDialogue
.startButtonNotPressed
	bit 0,a ; A button
	jp z,.checkIfDownButtonIsPressed
; if A is pressed
	ld a,[$d730]
	bit 2,a
	jp nz,.noDirectionButtonsPressed
	call Func_30fd
	jr nz,.checkForOpponent
	call Func_3eb5 ; check for hidden items, PC's, etc.
	ld a,[$ffeb]
	and a
	jp z,OverworldLoop
	call IsSpriteOrSignInFrontOfPlayer ; check for sign or sprite in front of the player
	ld a,[$ff8c] ; $2920 ID for NPC/sign text, if any
	and a
	jp z,OverworldLoop
.displayDialogue
	ld a,$35
	call Predef ; check what is in front of the player
	call UpdateSprites ; move sprites
	ld a,[W_FLAGS_CD60]
	bit 2,a
	jr nz,.checkForOpponent
	bit 0,a
	jr nz,.checkForOpponent
	FuncCoord 8, 9 ; $c45c
	ld a,[Coord]
	ld [$cf0e],a
	call DisplayTextID ; display either the start menu or the NPC/sign text
	ld a,[$cc47]
	and a
	jr z,.checkForOpponent
	dec a
	ld a,$00
	ld [$cc47],a
	jr z,.changeMap
	ld a,$52
	call Predef
	ld a,[W_CURMAP]
	ld [$d71a],a
	call Function62CE
	ld a,[W_CURMAP]
	call SwitchToMapRomBank ; switch to the ROM bank of the current map
	ld hl,$d367
	set 7,[hl]
.changeMap
	jp EnterMap
.checkForOpponent
	ld a,[W_CUROPPONENT]
	and a
	jp nz,.newBattle
	jp OverworldLoop
.noDirectionButtonsPressed
	ld hl,W_FLAGS_CD60
	res 2,[hl]
	call UpdateSprites ; move sprites
	ld a,$01
	ld [$cc4b],a
	ld a,[$d528] ; the direction that was pressed last time
	and a
	jp z,OverworldLoop
; if a direction was pressed last time
	ld [$d529],a ; save the last direction
	xor a
	ld [$d528],a ; zero the direction
	jp OverworldLoop
.checkIfDownButtonIsPressed
	ld a,[H_CURRENTPRESSEDBUTTONS] ; current joypad state
	bit 7,a ; down button
	jr z,.checkIfUpButtonIsPressed
	ld a,$01
	ld [$c103],a
	ld a,$04
	jr .handleDirectionButtonPress
.checkIfUpButtonIsPressed
	bit 6,a ; up button
	jr z,.checkIfLeftButtonIsPressed
	ld a,$ff
	ld [$c103],a
	ld a,$08
	jr .handleDirectionButtonPress
.checkIfLeftButtonIsPressed
	bit 5,a ; left button
	jr z,.checkIfRightButtonIsPressed
	ld a,$ff
	ld [$c105],a
	ld a,$02
	jr .handleDirectionButtonPress
.checkIfRightButtonIsPressed
	bit 4,a ; right button
	jr z,.noDirectionButtonsPressed
	ld a,$01
	ld [$c105],a
.handleDirectionButtonPress
	ld [$d52a],a ; new direction
	ld a,[$d730]
	bit 7,a ; are we simulating button presses?
	jr nz,.noDirectionChange ; ignore direction changes if we are
	ld a,[$cc4b]
	and a
	jr z,.noDirectionChange
	ld a,[$d52a] ; new direction
	ld b,a
	ld a,[$d529] ; old direction
	cp b
	jr z,.noDirectionChange
; the code below is strange
; it computes whether or not the player did a 180 degree turn, but then overwrites the result
; also, it does a seemingly pointless loop afterwards
	swap a ; put old direction in upper half
	or b ; put new direction in lower half
	cp a,$48 ; change dir from down to up
	jr nz,.notDownToUp
	ld a,$02
	ld [$d528],a
	jr .oddLoop
.notDownToUp
	cp a,$84 ; change dir from up to down
	jr nz,.notUpToDown
	ld a,$01
	ld [$d528],a
	jr .oddLoop
.notUpToDown
	cp a,$12 ; change dir from right to left
	jr nz,.notRightToLeft
	ld a,$04
	ld [$d528],a
	jr .oddLoop
.notRightToLeft
	cp a,$21 ; change dir from left to right
	jr nz,.oddLoop
	ld a,$08
	ld [$d528],a
.oddLoop
	ld hl,W_FLAGS_CD60
	set 2,[hl]
	ld hl,$cc4b
	dec [hl]
	jr nz,.oddLoop
	ld a,[$d52a]
	ld [$d528],a
	call NewBattle
	jp c,.battleOccurred
	jp OverworldLoop
.noDirectionChange
	ld a,[$d52a] ; current direction
	ld [$d528],a ; save direction
	call UpdateSprites ; move sprites
	ld a,[$d700]
	cp a,$02 ; surfing
	jr z,.surfing
; not surfing
	call CollisionCheckOnLand
	jr nc,.noCollision
	push hl
	ld hl,$d736
	bit 2,[hl]
	pop hl
	jp z,OverworldLoop
	push hl
	call ExtraWarpCheck ; sets carry if there is a potential to warp
	pop hl
	jp c,CheckWarpsCollision
	jp OverworldLoop
.surfing
	call CollisionCheckOnWater
	jp c,OverworldLoop
.noCollision
	ld a,$08
	ld [W_WALKCOUNTER],a
	jr .moveAhead2
.moveAhead
	ld a,[$d736]
	bit 7,a
	jr z,.noSpinning
	ld b, BANK(Func_44fd7)
	ld hl, Func_44fd7
	call Bankswitch ; spin while moving
.noSpinning
	call UpdateSprites ; move sprites
.moveAhead2
	ld hl,W_FLAGS_CD60
	res 2,[hl]
	ld a,[$d700]
	dec a ; riding a bike?
	jr nz,.normalPlayerSpriteAdvancement
	ld a,[$d736]
	bit 6,a ; jumping a ledge?
	jr nz,.normalPlayerSpriteAdvancement
	call BikeSpeedup ; if riding a bike and not jumping a ledge
.normalPlayerSpriteAdvancement
	call AdvancePlayerSprite
	ld a,[W_WALKCOUNTER]
	and a
	jp nz,CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished
	ld a,[$d730]
	bit 7,a
	jr nz,.doneStepCounting ; if button presses are being simulated, don't count steps
; step counting
	ld hl,$d13b ; step counter
	dec [hl]
	ld a,[$d72c]
	bit 0,a
	jr z,.doneStepCounting
	ld hl,$d13c
	dec [hl]
	jr nz,.doneStepCounting
	ld hl,$d72c
	res 0,[hl]
.doneStepCounting
	ld a,[$d790]
	bit 7,a ; in the safari zone?
	jr z,.notSafariZone
	ld b, BANK(Func_1e997)
	ld hl, Func_1e997
	call Bankswitch
	ld a,[$da46]
	and a
	jp nz,WarpFound2
.notSafariZone
	ld a,[W_ISINBATTLE]
	and a
	jp nz,CheckWarpsNoCollision
	ld a,$13
	call Predef ; decrement HP of poisoned pokemon
	ld a,[$d12d]
	and a
	jp nz,HandleBlackOut ; if all pokemon fainted
.newBattle
	call NewBattle
	ld hl,$d736
	res 2,[hl]
	jp nc,CheckWarpsNoCollision ; check for warps if there was no battle
.battleOccurred
	ld hl,$d72d
	res 6,[hl]
	ld hl,W_FLAGS_D733
	res 3,[hl]
	ld hl,$d126
	set 5,[hl]
	set 6,[hl]
	xor a
	ld [H_CURRENTPRESSEDBUTTONS],a ; clear joypad state
	ld a,[W_CURMAP]
	cp a,CINNABAR_GYM
	jr nz,.notCinnabarGym
	ld hl,$d79b
	set 7,[hl]
.notCinnabarGym
	ld hl,$d72e
	set 5,[hl]
	ld a,[W_CURMAP]
	cp a,OAKS_LAB
	jp z,.noFaintCheck
	ld hl, AnyPokemonAliveCheck
	ld b, BANK(AnyPokemonAliveCheck)
	call Bankswitch ; check if all the player's pokemon fainted
	ld a,d
	and a
	jr z,.allPokemonFainted
.noFaintCheck
	ld c,$0a
	call DelayFrames
	jp EnterMap
.allPokemonFainted
	ld a,$ff
	ld [$d057],a
	call RunMapScript
	jp HandleBlackOut

; function to determine if there will be a battle and execute it (either a trainer battle or wild battle)
; sets carry if a battle occurred and unsets carry if not
NewBattle: ; 0683 (0:0683)
	ld a,[$d72d]
	bit 4,a
	jr nz,.noBattle
	call Func_30fd
	jr nz,.noBattle
	ld a,[$d72e]
	bit 4,a
	jr nz,.noBattle
	ld b, BANK(Func_3ef12)
	ld hl, Func_3ef12
	jp Bankswitch ; determines if a battle will occurr and runs the battle if so
.noBattle
	and a
	ret

; function to make bikes twice as fast as walking
BikeSpeedup: ; 06a0 (0:06a0)
	ld a,[$cc57]
	and a
	ret nz
	ld a,[W_CURMAP]
	cp a,ROUTE_17 ; Cycling Road
	jr nz,.goFaster
	ld a,[H_CURRENTPRESSEDBUTTONS] ; current joypad state
	and a,%01110000 ; bit mask for up, left, right buttons
	ret nz
.goFaster
	jp AdvancePlayerSprite

; check if the player has stepped onto a warp after having not collided
CheckWarpsNoCollision: ; 06b4 (0:06b4)
	ld a,[$d3ae] ; number of warps
	and a
	jp z,CheckMapConnections
	ld a,[$d3ae] ; number of warps
	ld b,$00
	ld c,a
	ld a,[W_YCOORD]
	ld d,a
	ld a,[W_XCOORD]
	ld e,a
	ld hl,$d3af ; start of warp entries
CheckWarpsNoCollisionLoop: ; 06cc (0:06cc)
	ld a,[hli] ; check if the warp's Y position matches
	cp d
	jr nz,CheckWarpsNoCollisionRetry1
	ld a,[hli] ; check if the warp's X position matches
	cp e
	jr nz,CheckWarpsNoCollisionRetry2
; if a match was found
	push hl
	push bc
	ld hl,$d736
	set 2,[hl]
	ld b, BANK(Func_c49d)
	ld hl, Func_c49d
	call Bankswitch ; check if the player sprite is standing on a "door" tile
	pop bc
	pop hl
	jr c,WarpFound1 ; if it is, go to 0735
	push hl
	push bc
	call ExtraWarpCheck ; sets carry if the warp is confirmed
	pop bc
	pop hl
	jr nc,CheckWarpsNoCollisionRetry2
; if the extra check passed
	ld a,[W_FLAGS_D733]
	bit 2,a
	jr nz,WarpFound1
	push de
	push bc
	call GetJoypadState
	pop bc
	pop de
	ld a,[H_CURRENTPRESSEDBUTTONS] ; current joypad state
	and a,%11110000 ; bit mask for directional buttons
	jr z,CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp
	jr WarpFound1

; check if the player has stepped onto a warp after having collided
CheckWarpsCollision: ; 0706 (0:0706)
	ld a,[$d3ae] ; number of warps
	ld c,a
	ld hl,$d3af ; start of warp entries
.loop
	ld a,[hli] ; Y coordinate of warp
	ld b,a
	ld a,[W_YCOORD]
	cp b
	jr nz,.retry1
	ld a,[hli] ; X coordinate of warp
	ld b,a
	ld a,[W_XCOORD]
	cp b
	jr nz,.retry2
	ld a,[hli]
	ld [$d42f],a ; save target warp ID
	ld a,[hl]
	ld [$ff8b],a ; save target map
	jr WarpFound2
.retry1
	inc hl
.retry2
	inc hl
	inc hl
	dec c
	jr nz,.loop
	jp OverworldLoop

CheckWarpsNoCollisionRetry1: ; 072f (0:072f)
	inc hl
CheckWarpsNoCollisionRetry2: ; 0730 (0:0730)
	inc hl
	inc hl
	jp ContinueCheckWarpsNoCollisionLoop

WarpFound1: ; 0735 (0:0735)
	ld a,[hli]
	ld [$d42f],a ; save target warp ID
	ld a,[hli]
	ld [$ff8b],a ; save target map

WarpFound2: ; 073c (0:073c)
	ld a,[$d3ae] ; number of warps
	sub c
	ld [$d73b],a ; save ID of used warp
	ld a,[W_CURMAP]
	ld [$d73c],a
	call CheckIfInOutsideMap ; check if the tileset number is 0 or the map is Route 12
	jr nz,.indoorMaps
; this is for handling "outside" maps that can't have the 0xFF destination map
	ld a,[W_CURMAP]
	ld [$d365],a ; save current map as previous map
	ld a,[W_CURMAPWIDTH]
	ld [$d366],a
	ld a,[$ff8b] ; destination map number
	ld [W_CURMAP],a ; change current map to destination map
	cp a,ROCK_TUNNEL_1
	jr nz,.notRockTunnel
	ld a,$06
	ld [$d35d],a
	call GBFadeIn1
.notRockTunnel
	call PlayMapChangeSound
	jr .done
; for maps that can have the 0xFF destination map, which means to return to the outside map; not all these maps are necessarily indoors, though
.indoorMaps
	ld a,[$ff8b] ; destination map
	cp a,$ff
	jr z,.goBackOutside
; if not going back to the previous map
	ld [W_CURMAP],a ; current map number
	ld b, BANK(Func_70787)
	ld hl, Func_70787
	call Bankswitch ; check if the warp was a Silph Co. teleporter
	ld a,[$cd5b]
	dec a
	jr nz,.notTeleporter
; if it's a Silph Co. teleporter
	ld hl,$d732
	set 3,[hl]
	call DoFlyOrTeleportAwayGraphics
	jr .skipMapChangeSound
.notTeleporter
	call PlayMapChangeSound
.skipMapChangeSound
	ld hl,$d736
	res 0,[hl]
	res 1,[hl]
	jr .done
.goBackOutside
	ld a,[$d365] ; previous map
	ld [W_CURMAP],a
	call PlayMapChangeSound
	xor a
	ld [$d35d],a
.done
	ld hl,$d736
	set 0,[hl]
	call Func_12da
	jp EnterMap

ContinueCheckWarpsNoCollisionLoop: ; 07b5 (0:07b5)
	inc b ; increment warp number
	dec c ; decrement number of warps
	jp nz,CheckWarpsNoCollisionLoop

; if no matching warp was found
CheckMapConnections: ; 07ba (0:07ba)
.checkWestMap
	ld a,[W_XCOORD]
	cp a,$ff
	jr nz,.checkEastMap
	ld a,[$d387]
	ld [W_CURMAP],a
	ld a,[$d38f] ; new X coordinate upon entering west map
	ld [W_XCOORD],a
	ld a,[W_YCOORD]
	ld c,a
	ld a,[$d38e] ; Y adjustment upon entering west map
	add c
	ld c,a
	ld [W_YCOORD],a
	ld a,[$d390] ; pointer to upper left corner of map without adjustment for Y position
	ld l,a
	ld a,[$d391]
	ld h,a
	srl c
	jr z,.savePointer1
.pointerAdjustmentLoop1
	ld a,[$d38d] ; width of connected map
	add a,$06
	ld e,a
	ld d,$00
	ld b,$00
	add hl,de
	dec c
	jr nz,.pointerAdjustmentLoop1
.savePointer1
	ld a,l
	ld [$d35f],a ; pointer to upper left corner of current tile block map section
	ld a,h
	ld [$d360],a
	jp .loadNewMap
.checkEastMap
	ld b,a
	ld a,[$d525] ; map width
	cp b
	jr nz,.checkNorthMap
	ld a,[$d392]
	ld [W_CURMAP],a
	ld a,[$d39a] ; new X coordinate upon entering east map
	ld [W_XCOORD],a
	ld a,[W_YCOORD]
	ld c,a
	ld a,[$d399] ; Y adjustment upon entering east map
	add c
	ld c,a
	ld [W_YCOORD],a
	ld a,[$d39b] ; pointer to upper left corner of map without adjustment for Y position
	ld l,a
	ld a,[$d39c]
	ld h,a
	srl c
	jr z,.savePointer2
.pointerAdjustmentLoop2
	ld a,[$d398]
	add a,$06
	ld e,a
	ld d,$00
	ld b,$00
	add hl,de
	dec c
	jr nz,.pointerAdjustmentLoop2
.savePointer2
	ld a,l
	ld [$d35f],a ; pointer to upper left corner of current tile block map section
	ld a,h
	ld [$d360],a
	jp .loadNewMap
.checkNorthMap
	ld a,[W_YCOORD]
	cp a,$ff
	jr nz,.checkSouthMap
	ld a,[$d371]
	ld [W_CURMAP],a
	ld a,[$d378] ; new Y coordinate upon entering north map
	ld [W_YCOORD],a
	ld a,[W_XCOORD]
	ld c,a
	ld a,[$d379] ; X adjustment upon entering north map
	add c
	ld c,a
	ld [W_XCOORD],a
	ld a,[$d37a] ; pointer to upper left corner of map without adjustment for X position
	ld l,a
	ld a,[$d37b]
	ld h,a
	ld b,$00
	srl c
	add hl,bc
	ld a,l
	ld [$d35f],a ; pointer to upper left corner of current tile block map section
	ld a,h
	ld [$d360],a
	jp .loadNewMap
.checkSouthMap
	ld b,a
	ld a,[$d524]
	cp b
	jr nz,.didNotEnterConnectedMap
	ld a,[$d37c]
	ld [W_CURMAP],a
	ld a,[$d383] ; new Y coordinate upon entering south map
	ld [W_YCOORD],a
	ld a,[W_XCOORD]
	ld c,a
	ld a,[$d384] ; X adjustment upon entering south map
	add c
	ld c,a
	ld [W_XCOORD],a
	ld a,[$d385] ; pointer to upper left corner of map without adjustment for X position
	ld l,a
	ld a,[$d386]
	ld h,a
	ld b,$00
	srl c
	add hl,bc
	ld a,l
	ld [$d35f],a ; pointer to upper left corner of current tile block map section
	ld a,h
	ld [$d360],a
.loadNewMap ; load the connected map that was entered
	call LoadMapHeader
	call Func_2312 ; music
	ld b,$09
	call GoPAL_SET
; Since the sprite set shouldn't change, this will just update VRAM slots at
; $C2XE without loading any tile patterns.
	ld b,BANK(InitMapSprites)
	ld hl,InitMapSprites
	call Bankswitch
	call LoadTileBlockMap
	jp OverworldLoopLessDelay
.didNotEnterConnectedMap
	jp OverworldLoop

; function to play a sound when changing maps
PlayMapChangeSound: ; 08c9 (0:08c9)
	FuncCoord 8, 8 ; $c448
	ld a,[Coord] ; upper left tile of the 4x4 square the player's sprite is standing on
	cp a,$0b ; door tile in tileset 0
	jr nz,.didNotGoThroughDoor
	ld a,$ad
	jr .playSound
.didNotGoThroughDoor
	ld a,$b5
.playSound
	call PlaySound
	ld a,[$d35d]
	and a
	ret nz
	jp GBFadeIn1

; function to set the Z flag if the tileset number is 0 or the map is Route 12
; strangely, Route 12 has tileset 0, so the check is redundant
CheckIfInOutsideMap: ; 08e1 (0:08e1)
	ld a,[W_CURMAPTILESET]
	and a
	ret z
	cp a,ROUTE_12
	ret

; this function is an extra check that sometimes has to pass in order to warp, beyond just standing on a warp
; the "sometimes" qualification is necessary because of CheckWarpsNoCollision's behavior
; depending on the map, either "function 1" or "function 2" is used for the check
; "function 1" passes when the player is at the edge of the map and is facing towards the outside of the map
; "function 2" passes when the the tile in front of the player is among a certain set
; sets carry if the check passes, otherwise clears carry
ExtraWarpCheck: ; 08e9 (0:08e9)
	ld a,[W_CURMAP]
	cp a,SS_ANNE_3
	jr z,.useFunction1
	cp a,ROCKET_HIDEOUT_1
	jr z,.useFunction2
	cp a,ROCKET_HIDEOUT_2
	jr z,.useFunction2
	cp a,ROCKET_HIDEOUT_4
	jr z,.useFunction2
	cp a,ROCK_TUNNEL_1
	jr z,.useFunction2
	ld a,[W_CURMAPTILESET]
	and a ; outside tileset
	jr z,.useFunction2
	cp a,$0d ; S.S. Anne tileset
	jr z,.useFunction2
	cp a,$0e ; Vermilion Port tileset
	jr z,.useFunction2
	cp a,$17 ; Indigo Plateau tileset
	jr z,.useFunction2
.useFunction1
	ld hl,Func_c3ff
	jr .doBankswitch
.useFunction2
	ld hl, Func_c44e
.doBankswitch
	ld b, BANK(Func_c44e)
	jp Bankswitch

MapEntryAfterBattle: ; 091f (0:091f)
	ld b, BANK(Func_c35f)
	ld hl, Func_c35f
	call Bankswitch ; function that appears to disable warp testing after collisions if the player is standing on a warp
	ld a,[$d35d]
	and a
	jp z,GBFadeIn2
	jp LoadGBPal

; for when all the player's pokemon faint
; other code prints the "you blacked out" message before this is called
HandleBlackOut: ; 0931 (0:0931)
	call GBFadeIn1
	ld a,$08
	call StopMusic
	ld hl,$d72e
	res 5,[hl]
	ld a,$01
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call Func_40b0
	call Function62CE
	call Func_2312
	jp Func_5d5f

StopMusic: ; 0951 (0:0951)
	ld [$cfc7],a
	ld a,$ff
	ld [$c0ee],a
	call PlaySound
.waitLoop
	ld a,[$cfc7]
	and a
	jr nz,.waitLoop
	jp StopAllSounds

HandleFlyOrTeleportAway: ; 0965 (0:0965)
	call UpdateSprites ; move sprites
	call Delay3
	xor a
	ld [$cf0b],a
	ld [$d700],a
	ld [$d057],a
	ld [$d35d],a
	ld hl,$d732
	set 2,[hl]
	res 5,[hl]
	call DoFlyOrTeleportAwayGraphics
	ld a,$01
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call Function62CE
	jp Func_5d5f

; function that calls a function to do fly away or teleport away graphics
DoFlyOrTeleportAwayGraphics: ; 098f (0:098f)
	ld b, BANK(_DoFlyOrTeleportAwayGraphics)
	ld hl, _DoFlyOrTeleportAwayGraphics
	jp Bankswitch

; load sprite graphics based on whether the player is standing, biking, or surfing
LoadPlayerSpriteGraphics: ; 0997 (0:0997)
	ld a,[$d700]
	dec a
	jr z,.ridingBike
	ld a,[$ffd7]
	and a
	jr nz,.determineGraphics
	jr .startWalking
.ridingBike
	call IsBikeRidingAllowed
	jr c,.determineGraphics ; don't start walking if bike riding is allowed
.startWalking
	xor a
	ld [$d700],a
	ld [$d11a],a
	jp LoadWalkingPlayerSpriteGraphics
.determineGraphics
	ld a,[$d700]
	and a
	jp z,LoadWalkingPlayerSpriteGraphics
	dec a
	jp z,LoadBikePlayerSpriteGraphics
	dec a
	jp z,LoadSurfingPlayerSpriteGraphics
	jp LoadWalkingPlayerSpriteGraphics

; function to check if bike riding is allowed on the current map
; sets carry if bike is allowed, clears carry otherwise
IsBikeRidingAllowed: ; 09c5 (0:09c5)
	ld a,[W_CURMAP]
	cp a,ROUTE_23
	jr z,.allowed
	cp a,INDIGO_PLATEAU
	jr z,.allowed
	ld a,[W_CURMAPTILESET]
	ld b,a
	ld hl,BikeRidingTilesets
.loop
	ld a,[hli]
	cp b
	jr z,.allowed
	inc a
	jr nz,.loop
	and a
	ret
.allowed
	scf
	ret

BikeRidingTilesets: ; 09e2 (0:09e2)
db $00, $03, $0B, $0E, $11, $FF

; load the tile pattern data of the current tileset into VRAM
LoadTilesetTilePatternData: ; 09e8 (0:09e8)
	ld a,[$d52e]
	ld l,a
	ld a,[$d52f]
	ld h,a
	ld de,$9000
	ld bc,$0600
	ld a,[$d52b]
	jp FarCopyData2

; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8
; it can also load partial tile maps of connected maps into a border of length 3 around the current map
LoadTileBlockMap: ; 09fc (0:09fc)
; fill C6E8-CBFB with the background tile
	ld hl,$c6e8
	ld a,[$d3ad] ; background tile number
	ld d,a
	ld bc,$0514
.backgroundTileLoop
	ld a,d
	ld [hli],a
	dec bc
	ld a,c
	or b
	jr nz,.backgroundTileLoop
; load tile map of current map (made of tile block IDs)
; a 3-byte border at the edges of the map is kept so that there is space for map connections
	ld hl,$c6e8
	ld a,[W_CURMAPWIDTH]
	ld [$ff8c],a
	add a,$06 ; border (east and west)
	ld [$ff8b],a ; map width + border
	ld b,$00
	ld c,a
; make space for north border (next 3 lines)
	add hl,bc
	add hl,bc
	add hl,bc
	ld c,$03
	add hl,bc ; this puts us past the (west) border
	ld a,[$d36a] ; tile map pointer
	ld e,a
	ld a,[$d36b]
	ld d,a ; de = tile map pointer
	ld a,[W_CURMAPHEIGHT]
	ld b,a
.rowLoop ; copy one row each iteration
	push hl
	ld a,[$ff8c] ; map width (without border)
	ld c,a
.rowInnerLoop
	ld a,[de]
	inc de
	ld [hli],a
	dec c
	jr nz,.rowInnerLoop
; add the map width plus the border to the base address of the current row to get the next row's address
	pop hl
	ld a,[$ff8b] ; map width + border
	add l
	ld l,a
	jr nc,.noCarry
	inc h
.noCarry
	dec b
	jr nz,.rowLoop
.northConnection
	ld a,[$d371]
	cp a,$ff
	jr z,.southConnection
	call SwitchToMapRomBank
	ld a,[$d372]
	ld l,a
	ld a,[$d373]
	ld h,a
	ld a,[$d374]
	ld e,a
	ld a,[$d375]
	ld d,a
	ld a,[$d376]
	ld [$ff8b],a
	ld a,[$d377]
	ld [$ff8c],a
	call LoadNorthSouthConnectionsTileMap
.southConnection
	ld a,[$d37c]
	cp a,$ff
	jr z,.westConnection
	call SwitchToMapRomBank
	ld a,[$d37d]
	ld l,a
	ld a,[$d37e]
	ld h,a
	ld a,[$d37f]
	ld e,a
	ld a,[$d380]
	ld d,a
	ld a,[$d381]
	ld [$ff8b],a
	ld a,[$d382]
	ld [$ff8c],a
	call LoadNorthSouthConnectionsTileMap
.westConnection
	ld a,[$d387]
	cp a,$ff
	jr z,.eastConnection
	call SwitchToMapRomBank
	ld a,[$d388]
	ld l,a
	ld a,[$d389]
	ld h,a
	ld a,[$d38a]
	ld e,a
	ld a,[$d38b]
	ld d,a
	ld a,[$d38c]
	ld b,a
	ld a,[$d38d]
	ld [$ff8b],a
	call LoadEastWestConnectionsTileMap
.eastConnection
	ld a,[$d392]
	cp a,$ff
	jr z,.done
	call SwitchToMapRomBank
	ld a,[$d393]
	ld l,a
	ld a,[$d394]
	ld h,a
	ld a,[$d395]
	ld e,a
	ld a,[$d396]
	ld d,a
	ld a,[$d397]
	ld b,a
	ld a,[$d398]
	ld [$ff8b],a
	call LoadEastWestConnectionsTileMap
.done
	ret

LoadNorthSouthConnectionsTileMap: ; 0ade (0:0ade)
	ld c,$03
.loop
	push de
	push hl
	ld a,[$ff8b] ; width of connection
	ld b,a
.innerLoop
	ld a,[hli]
	ld [de],a
	inc de
	dec b
	jr nz,.innerLoop
	pop hl
	pop de
	ld a,[$ff8c] ; width of connected map
	add l
	ld l,a
	jr nc,.noCarry1
	inc h
.noCarry1
	ld a,[W_CURMAPWIDTH]
	add a,$06
	add e
	ld e,a
	jr nc,.noCarry2
	inc d
.noCarry2
	dec c
	jr nz,.loop
	ret

LoadEastWestConnectionsTileMap: ; 0b02 (0:0b02)
	push hl
	push de
	ld c,$03
.innerLoop
	ld a,[hli]
	ld [de],a
	inc de
	dec c
	jr nz,.innerLoop
	pop de
	pop hl
	ld a,[$ff8b] ; width of connected map
	add l
	ld l,a
	jr nc,.noCarry1
	inc h
.noCarry1
	ld a,[W_CURMAPWIDTH]
	add a,$06
	add e
	ld e,a
	jr nc,.noCarry2
	inc d
.noCarry2
	dec b
	jr nz,LoadEastWestConnectionsTileMap
	ret

; function to check if there is a sign or sprite in front of the player
; if so, it is stored in [$FF8C]
; if not, [$FF8C] is set to 0
IsSpriteOrSignInFrontOfPlayer: ; 0b23 (0:0b23)
	xor a
	ld [$ff8c],a
	ld a,[$d4b0] ; number of signs in the map
	and a
	jr z,.extendRangeOverCounter
; if there are signs
	ld a,$35
	call Predef ; get the coordinates in front of the player in de
	ld hl,$d4b1 ; start of sign coordinates
	ld a,[$d4b0] ; number of signs in the map
	ld b,a
	ld c,$00
.signLoop
	inc c
	ld a,[hli] ; sign Y
	cp d
	jr z,.yCoordMatched
	inc hl
	jr .retry
.yCoordMatched
	ld a,[hli] ; sign X
	cp e
	jr nz,.retry
.xCoordMatched
; found sign
	push hl
	push bc
	ld hl,$d4d1 ; start of sign text ID's
	ld b,$00
	dec c
	add hl,bc
	ld a,[hl]
	ld [$ff8c],a ; store sign text ID
	pop bc
	pop hl
	ret
.retry
	dec b
	jr nz,.signLoop
; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC
.extendRangeOverCounter
	ld a,$35
	call Predef ; get the tile in front of the player in c
	ld hl,$d532 ; list of tiles that extend talking range (counter tiles)
	ld b,$03
	ld d,$20 ; talking range in pixels (long range)
.counterTilesLoop
	ld a,[hli]
	cp c
	jr z,IsSpriteInFrontOfPlayer2 ; jumps if the tile in front of the player is a counter tile
	dec b
	jr nz,.counterTilesLoop

; part of the above function, but sometimes its called on its own, when signs are irrelevant
; the caller must zero [$FF8C]
IsSpriteInFrontOfPlayer: ; 0b6b (0:0b6b)
	ld d,$10 ; talking range in pixels (normal range)
IsSpriteInFrontOfPlayer2: ; 0b6d (0:0b6d)
	ld bc,$3c40 ; Y and X position of player sprite
	ld a,[$c109] ; direction the player is facing
.checkIfPlayerFacingUp
	cp a,$04
	jr nz,.checkIfPlayerFacingDown
; facing up
	ld a,b
	sub d
	ld b,a
	ld a,$08
	jr .doneCheckingDirection
.checkIfPlayerFacingDown
	cp a,$00
	jr nz,.checkIfPlayerFacingRight
; facing down
	ld a,b
	add d
	ld b,a
	ld a,$04
	jr .doneCheckingDirection
.checkIfPlayerFacingRight
	cp a,$0c
	jr nz,.playerFacingLeft
; facing right
	ld a,c
	add d
	ld c,a
	ld a,$01
	jr .doneCheckingDirection
.playerFacingLeft
; facing left
	ld a,c
	sub d
	ld c,a
	ld a,$02
.doneCheckingDirection
	ld [$d52a],a
	ld a,[$d4e1] ; number of sprites
	and a
	ret z
; if there are sprites
	ld hl,$c110
	ld d,a
	ld e,$01
.spriteLoop
	push hl
	ld a,[hli] ; image (0 if no sprite)
	and a
	jr z,.nextSprite
	inc l
	ld a,[hli] ; sprite visibility
	inc a
	jr z,.nextSprite
	inc l
	ld a,[hli] ; Y location
	cp b
	jr nz,.nextSprite
	inc l
	ld a,[hl] ; X location
	cp c
	jr z,.foundSpriteInFrontOfPlayer
.nextSprite
	pop hl
	ld a,l
	add a,$10
	ld l,a
	inc e
	dec d
	jr nz,.spriteLoop
	ret
.foundSpriteInFrontOfPlayer
	pop hl
	ld a,l
	and a,$f0
	inc a
	ld l,a
	set 7,[hl]
	ld a,e
	ld [$ff8c],a ; store sprite ID
	ret

; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing)
; sets the carry flag if there is a collision, and unsets it if there isn't a collision
CollisionCheckOnLand: ; 0bd1 (0:0bd1)
	ld a,[$d736]
	bit 6,a ; is the player jumping?
	jr nz,.noCollision
; if not jumping a ledge
	ld a,[$cd38]
	and a
	jr nz,.noCollision
	ld a,[$d52a] ; the direction that the player is trying to go in
	ld d,a
	ld a,[$c10c] ; the player sprite's collision data (bit field) (set in the sprite movement code)
	and d ; check if a sprite is in the direction the player is trying to go
	jr nz,.collision
	xor a
	ld [$ff8c],a
	call IsSpriteInFrontOfPlayer ; check for sprite collisions again? when does the above check fail to detect a sprite collision?
	ld a,[$ff8c]
	and a ; was there a sprite collision?
	jr nz,.collision
; if no sprite collision
	ld hl,TilePairCollisionsLand
	call CheckForJumpingAndTilePairCollisions
	jr c,.collision
	call CheckTilePassable
	jr nc,.noCollision
.collision
	ld a,[$c02a]
	cp a,$b4 ; check if collision sound is already playing
	jr z,.setCarry
	ld a,$b4
	call PlaySound ; play collision sound (if it's not already playing)
.setCarry
	scf
	ret
.noCollision
	and a
	ret

; function that checks if the tile in front of the player is passable
; clears carry if it is, sets carry if not
CheckTilePassable: ; 0c10 (0:0c10)
	ld a,$35
	call Predef ; get tile in front of player
	ld a,[$cfc6] ; tile in front of player
	ld c,a
	ld hl,$d530 ; pointer to list of passable tiles
	ld a,[hli]
	ld h,[hl]
	ld l,a ; hl now points to passable tiles
.loop
	ld a,[hli]
	cp a,$ff
	jr z,.tileNotPassable
	cp c
	ret z
	jr .loop
.tileNotPassable
	scf
	ret

; check if the player is going to jump down a small ledge
; and check for collisions that only occur between certain pairs of tiles
; Input: hl - address of directional collision data
; sets carry if there is a collision and unsets carry if not
CheckForJumpingAndTilePairCollisions: ; 0c2a (0:0c2a)
	push hl
	ld a,$35
	call Predef ; get the tile in front of the player
	push de
	push bc
	ld b, BANK(Func_1a672)
	ld hl, Func_1a672
	call Bankswitch ; check if the player is trying to jump a ledge
	pop bc
	pop de
	pop hl
	and a
	ld a,[$d736]
	bit 6,a ; is the player jumping?
	ret nz
; if not jumping

Func_c44: ; 0c44 (0:0c44)
	FuncCoord 8, 9 ; $c45c
	ld a,[Coord] ; tile the player is on
	ld [$cf0e],a

CheckForTilePairCollisions: ; 0c4a (0:0c4a)
	ld a,[$cfc6] ; tile in front of the player
	ld c,a
.tilePairCollisionLoop
	ld a,[W_CURMAPTILESET] ; tileset number
	ld b,a
	ld a,[hli]
	cp a,$ff
	jr z,.noMatch
	cp b
	jr z,.tilesetMatches
	inc hl
.retry
	inc hl
	jr .tilePairCollisionLoop
.tilesetMatches
	ld a,[$cf0e] ; tile the player is on
	ld b,a
	ld a,[hl]
	cp b
	jr z,.currentTileMatchesFirstInPair
	inc hl
	ld a,[hl]
	cp b
	jr z,.currentTileMatchesSecondInPair
	jr .retry
.currentTileMatchesFirstInPair
	inc hl
	ld a,[hl]
	cp c
	jr z,.foundMatch
	jr .tilePairCollisionLoop
.currentTileMatchesSecondInPair
	dec hl
	ld a,[hli]
	cp c
	inc hl
	jr nz,.tilePairCollisionLoop
.foundMatch
	scf
	ret
.noMatch
	and a
	ret

; FORMAT: tileset number, tile 1, tile 2
; terminated by 0xFF
; these entries indicate that the player may not cross between tile 1 and tile 2
; it's mainly used to simulate differences in elevation

TilePairCollisionsLand: ; 0c7e (0:0c7e)
db $11, $20, $05;
db $11, $41, $05;
db $03, $30, $2E;
db $11, $2A, $05;
db $11, $05, $21;
db $03, $52, $2E;
db $03, $55, $2E;
db $03, $56, $2E;
db $03, $20, $2E;
db $03, $5E, $2E;
db $03, $5F, $2E;
db $FF;

TilePairCollisionsWater: ; 0ca0 (0:0ca0)
db $03, $14, $2E;
db $03, $48, $2E;
db $11, $14, $05;
db $FF;

; this builds a tile map from the tile block map based on the current X/Y coordinates of the player's character
LoadCurrentMapView: ; 0caa (0:0caa)
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,[$d52b] ; tile data ROM bank
	ld [H_LOADEDROMBANK],a
	ld [$2000],a ; switch to ROM bank that contains tile data
	ld a,[$d35f] ; address of upper left corner of current map view
	ld e,a
	ld a,[$d360]
	ld d,a
	ld hl,W_SCREENTILESBACKBUFFER
	ld b,$05
.rowLoop ; each loop iteration fills in one row of tile blocks
	push hl
	push de
	ld c,$06
.rowInnerLoop ; loop to draw each tile block of the current row
	push bc
	push de
	push hl
	ld a,[de]
	ld c,a ; tile block number
	call DrawTileBlock
	pop hl
	pop de
	pop bc
	inc hl
	inc hl
	inc hl
	inc hl
	inc de
	dec c
	jr nz,.rowInnerLoop
; update tile block map pointer to next row's address
	pop de
	ld a,[W_CURMAPWIDTH]
	add a,$06
	add e
	ld e,a
	jr nc,.noCarry
	inc d
.noCarry
; update tile map pointer to next row's address
	pop hl
	ld a,$60
	add l
	ld l,a
	jr nc,.noCarry2
	inc h
.noCarry2
	dec b
	jr nz,.rowLoop
	ld hl,W_SCREENTILESBACKBUFFER
	ld bc,$0000
.adjustForYCoordWithinTileBlock
	ld a,[W_YBLOCKCOORD]
	and a
	jr z,.adjustForXCoordWithinTileBlock
	ld bc,$0030
	add hl,bc
.adjustForXCoordWithinTileBlock
	ld a,[W_XBLOCKCOORD]
	and a
	jr z,.copyToVisibleAreaBuffer
	ld bc,$0002
	add hl,bc
.copyToVisibleAreaBuffer
	ld de,W_SCREENTILESBUFFER ; base address for the tiles that are directly transfered to VRAM during V-blank
	ld b,$12
.rowLoop2
	ld c,$14
.rowInnerLoop2
	ld a,[hli]
	ld [de],a
	inc de
	dec c
	jr nz,.rowInnerLoop2
	ld a,$04
	add l
	ld l,a
	jr nc,.noCarry3
	inc h
.noCarry3
	dec b
	jr nz,.rowLoop2
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a ; restore previous ROM bank
	ret

AdvancePlayerSprite: ; 0d27 (0:0d27)
	ld a,[$c103] ; delta Y
	ld b,a
	ld a,[$c105] ; delta X
	ld c,a
	ld hl,W_WALKCOUNTER ; walking animation counter
	dec [hl]
	jr nz,.afterUpdateMapCoords
; if it's the end of the animation, update the player's map coordinates
	ld a,[W_YCOORD]
	add b
	ld [W_YCOORD],a
	ld a,[W_XCOORD]
	add c
	ld [W_XCOORD],a
.afterUpdateMapCoords
	ld a,[W_WALKCOUNTER] ; walking animation counter
	cp a,$07
	jp nz,.scrollBackgroundAndSprites
; if this is the first iteration of the animation
	ld a,c
	cp a,$01
	jr nz,.checkIfMovingWest
; moving east
	ld a,[$d526]
	ld e,a
	and a,$e0
	ld d,a
	ld a,e
	add a,$02
	and a,$1f
	or d
	ld [$d526],a
	jr .adjustXCoordWithinBlock
.checkIfMovingWest
	cp a,$ff
	jr nz,.checkIfMovingSouth
; moving west
	ld a,[$d526]
	ld e,a
	and a,$e0
	ld d,a
	ld a,e
	sub a,$02
	and a,$1f
	or d
	ld [$d526],a
	jr .adjustXCoordWithinBlock
.checkIfMovingSouth
	ld a,b
	cp a,$01
	jr nz,.checkIfMovingNorth
; moving south
	ld a,[$d526]
	add a,$40
	ld [$d526],a
	jr nc,.adjustXCoordWithinBlock
	ld a,[$d527]
	inc a
	and a,$03
	or a,$98
	ld [$d527],a
	jr .adjustXCoordWithinBlock
.checkIfMovingNorth
	cp a,$ff
	jr nz,.adjustXCoordWithinBlock
; moving north
	ld a,[$d526]
	sub a,$40
	ld [$d526],a
	jr nc,.adjustXCoordWithinBlock
	ld a,[$d527]
	dec a
	and a,$03
	or a,$98
	ld [$d527],a
.adjustXCoordWithinBlock
	ld a,c
	and a
	jr z,.pointlessJump ; mistake?
.pointlessJump
	ld hl,W_XBLOCKCOORD
	ld a,[hl]
	add c
	ld [hl],a
	cp a,$02
	jr nz,.checkForMoveToWestBlock
; moved into the tile block to the east
	xor a
	ld [hl],a
	ld hl,$d4e3
	inc [hl]
	ld de,$d35f
	call MoveTileBlockMapPointerEast
	jr .updateMapView
.checkForMoveToWestBlock
	cp a,$ff
	jr nz,.adjustYCoordWithinBlock
; moved into the tile block to the west
	ld a,$01
	ld [hl],a
	ld hl,$d4e3
	dec [hl]
	ld de,$d35f
	call MoveTileBlockMapPointerWest
	jr .updateMapView
.adjustYCoordWithinBlock
	ld hl,W_YBLOCKCOORD
	ld a,[hl]
	add b
	ld [hl],a
	cp a,$02
	jr nz,.checkForMoveToNorthBlock
; moved into the tile block to the south
	xor a
	ld [hl],a
	ld hl,$d4e2
	inc [hl]
	ld de,$d35f
	ld a,[W_CURMAPWIDTH]
	call MoveTileBlockMapPointerSouth
	jr .updateMapView
.checkForMoveToNorthBlock
	cp a,$ff
	jr nz,.updateMapView
; moved into the tile block to the north
	ld a,$01
	ld [hl],a
	ld hl,$d4e2
	dec [hl]
	ld de,$d35f
	ld a,[W_CURMAPWIDTH]
	call MoveTileBlockMapPointerNorth
.updateMapView
	call LoadCurrentMapView
	ld a,[$c103] ; delta Y
	cp a,$01
	jr nz,.checkIfMovingNorth2
; if moving south
	call ScheduleSouthRowRedraw
	jr .scrollBackgroundAndSprites
.checkIfMovingNorth2
	cp a,$ff
	jr nz,.checkIfMovingEast2
; if moving north
	call ScheduleNorthRowRedraw
	jr .scrollBackgroundAndSprites
.checkIfMovingEast2
	ld a,[$c105] ; delta X
	cp a,$01
	jr nz,.checkIfMovingWest2
; if moving east
	call ScheduleEastColumnRedraw
	jr .scrollBackgroundAndSprites
.checkIfMovingWest2
	cp a,$ff
	jr nz,.scrollBackgroundAndSprites
; if moving west
	call ScheduleWestColumnRedraw
.scrollBackgroundAndSprites
	ld a,[$c103] ; delta Y
	ld b,a
	ld a,[$c105] ; delta X
	ld c,a
	sla b
	sla c
	ld a,[$ffaf]
	add b
	ld [$ffaf],a ; update background scroll Y
	ld a,[$ffae]
	add c
	ld [$ffae],a ; update background scroll X
; shift all the sprites in the direction opposite of the player's motion
; so that the player appears to move relative to them
	ld hl,$c114
	ld a,[$d4e1] ; number of sprites
	and a ; are there any sprites?
	jr z,.done
	ld e,a
.spriteShiftLoop
	ld a,[hl]
	sub b
	ld [hli],a
	inc l
	ld a,[hl]
	sub c
	ld [hl],a
	ld a,$0e
	add l
	ld l,a
	dec e
	jr nz,.spriteShiftLoop
.done
	ret

; the following four functions are used to move the pointer to the upper left
; corner of the tile block map in the direction of motion

MoveTileBlockMapPointerEast: ; 0e65 (0:0e65)
	ld a,[de]
	add a,$01
	ld [de],a
	ret nc
	inc de
	ld a,[de]
	inc a
	ld [de],a
	ret

MoveTileBlockMapPointerWest: ; 0e6f (0:0e6f)
	ld a,[de]
	sub a,$01
	ld [de],a
	ret nc
	inc de
	ld a,[de]
	dec a
	ld [de],a
	ret

MoveTileBlockMapPointerSouth: ; 0e79 (0:0e79)
	add a,$06
	ld b,a
	ld a,[de]
	add b
	ld [de],a
	ret nc
	inc de
	ld a,[de]
	inc a
	ld [de],a
	ret

MoveTileBlockMapPointerNorth: ; 0e85 (0:0e85)
	add a,$06
	ld b,a
	ld a,[de]
	sub b
	ld [de],a
	ret nc
	inc de
	ld a,[de]
	dec a
	ld [de],a
	ret

; the following 6 functions are used to tell the V-blank handler to redraw
; the portion of the map that was newly exposed due to the player's movement

ScheduleNorthRowRedraw: ; 0e91 (0:0e91)
	FuncCoord 0, 0
	ld hl,Coord
	call ScheduleRowRedrawHelper
	ld a,[$d526]
	ld [H_SCREENEDGEREDRAWADDR],a
	ld a,[$d527]
	ld [H_SCREENEDGEREDRAWADDR + 1],a
	ld a,REDRAWROW
	ld [H_SCREENEDGEREDRAW],a
	ret

ScheduleRowRedrawHelper: ; 0ea6 (0:0ea6)
	ld de,W_SCREENEDGETILES
	ld c,$28
.loop
	ld a,[hli]
	ld [de],a
	inc de
	dec c
	jr nz,.loop
	ret

ScheduleSouthRowRedraw: ; 0eb2 (0:0eb2)
	FuncCoord 0,16
	ld hl,Coord
	call ScheduleRowRedrawHelper
	ld a,[$d526]
	ld l,a
	ld a,[$d527]
	ld h,a
	ld bc,$0200
	add hl,bc
	ld a,h
	and a,$03
	or a,$98
	ld [H_SCREENEDGEREDRAWADDR + 1],a
	ld a,l
	ld [H_SCREENEDGEREDRAWADDR],a
	ld a,REDRAWROW
	ld [H_SCREENEDGEREDRAW],a
	ret

ScheduleEastColumnRedraw: ; 0ed3 (0:0ed3)
	FuncCoord 18,0
	ld hl,Coord
	call ScheduleColumnRedrawHelper
	ld a,[$d526]
	ld c,a
	and a,$e0
	ld b,a
	ld a,c
	add a,18
	and a,$1f
	or b
	ld [H_SCREENEDGEREDRAWADDR],a
	ld a,[$d527]
	ld [H_SCREENEDGEREDRAWADDR + 1],a
	ld a,REDRAWCOL
	ld [H_SCREENEDGEREDRAW],a
	ret

ScheduleColumnRedrawHelper: ; 0ef2 (0:0ef2)
	ld de,W_SCREENEDGETILES
	ld c,$12
.loop
	ld a,[hli]
	ld [de],a
	inc de
	ld a,[hl]
	ld [de],a
	inc de
	ld a,19
	add l
	ld l,a
	jr nc,.noCarry
	inc h
.noCarry
	dec c
	jr nz,.loop
	ret

ScheduleWestColumnRedraw: ; 0f08 (0:0f08)
	FuncCoord 0,0
	ld hl,Coord
	call ScheduleColumnRedrawHelper
	ld a,[$d526]
	ld [H_SCREENEDGEREDRAWADDR],a
	ld a,[$d527]
	ld [H_SCREENEDGEREDRAWADDR + 1],a
	ld a,REDRAWCOL
	ld [H_SCREENEDGEREDRAW],a
	ret

; function to write the tiles that make up a tile block to memory
; Input: c = tile block ID, hl = destination address
DrawTileBlock: ; 0f1d (0:0f1d)
	push hl
	ld a,[$d52c] ; pointer to tiles
	ld l,a
	ld a,[$d52d]
	ld h,a
	ld a,c
	swap a
	ld b,a
	and a,$f0
	ld c,a
	ld a,b
	and a,$0f
	ld b,a ; bc = tile block ID * 0x10
	add hl,bc
	ld d,h
	ld e,l ; de = address of the tile block's tiles
	pop hl
	ld c,$04 ; 4 loop iterations
.loop ; each loop iteration, write 4 tile numbers
	push bc
	ld a,[de]
	ld [hli],a
	inc de
	ld a,[de]
	ld [hli],a
	inc de
	ld a,[de]
	ld [hli],a
	inc de
	ld a,[de]
	ld [hl],a
	inc de
	ld bc,$0015
	add hl,bc
	pop bc
	dec c
	jr nz,.loop
	ret

; function to update joypad state and simulate button presses
GetJoypadStateOverworld: ; 0f4d (0:0f4d)
	xor a
	ld [$c103],a
	ld [$c105],a
	call RunMapScript
	call GetJoypadState
	ld a,[W_FLAGS_D733]
	bit 3,a ; check if a trainer wants a challenge
	jr nz,.notForcedDownwards
	ld a,[W_CURMAP]
	cp a,ROUTE_17 ; Cycling Road
	jr nz,.notForcedDownwards
	ld a,[H_CURRENTPRESSEDBUTTONS] ; current joypad state
	and a,%11110011 ; bit mask for all directions and A/B
	jr nz,.notForcedDownwards
	ld a,%10000000 ; down pressed
	ld [H_CURRENTPRESSEDBUTTONS],a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press
.notForcedDownwards
	ld a,[$d730]
	bit 7,a
	ret z
; if simulating button presses
	ld a,[H_CURRENTPRESSEDBUTTONS] ; current joypad state
	ld b,a
	ld a,[$cd3b] ; bit mask for button presses that override simulated ones
	and b
	ret nz ; return if the simulated button presses are overridden
	ld hl,$cd38 ; index of current simulated button press
	dec [hl]
	ld a,[hl]
	cp a,$ff
	jr z,.doneSimulating ; if the end of the simulated button presses has been reached
	ld hl,$ccd3 ; base address of simulated button presses
; add offset to base address
	add l
	ld l,a
	jr nc,.noCarry
	inc h
.noCarry
	ld a,[hl]
	ld [H_CURRENTPRESSEDBUTTONS],a ; store simulated button press in joypad state
	and a
	ret nz
	ld [H_NEWLYPRESSEDBUTTONS],a
	ld [H_NEWLYRELEASEDBUTTONS],a
	ret
; if done simulating button presses
.doneSimulating
	xor a
	ld [$cd3a],a
	ld [$cd38],a
	ld [$ccd3],a
	ld [W_JOYPADFORBIDDENBUTTONSMASK],a
	ld [H_CURRENTPRESSEDBUTTONS],a
	ld hl,$d736
	ld a,[hl]
	and a,$f8
	ld [hl],a
	ld hl,$d730
	res 7,[hl]
	ret

; function to check the tile ahead to determine if the character should get on land or keep surfing
; sets carry if there is a collision and clears carry otherwise
; It seems that this function has a bug in it, but due to luck, it doesn't
; show up. After detecting a sprite collision, it jumps to the code that
; checks if the next tile is passable instead of just directly jumping to the
; "collision detected" code. However, it doesn't store the next tile in c,
; so the old value of c is used. 2429 is always called before this function,
; and 2429 always sets c to 0xF0. There is no 0xF0 background tile, so it
; is considered impassable and it is detected as a collision.
CollisionCheckOnWater: ; 0fb7 (0:0fb7)
	ld a,[$d730]
	bit 7,a
	jp nz,.noCollision ; return and clear carry if button presses are being simulated
	ld a,[$d52a] ; the direction that the player is trying to go in
	ld d,a
	ld a,[$c10c] ; the player sprite's collision data (bit field) (set in the sprite movement code)
	and d ; check if a sprite is in the direction the player is trying to go
	jr nz,.checkIfNextTileIsPassable ; bug?
	ld hl,TilePairCollisionsWater
	call CheckForJumpingAndTilePairCollisions
	jr c,.collision
	ld a,$35
	call Predef ; get tile in front of player (puts it in c and [$CFC6])
	ld a,[$cfc6] ; tile in front of player
	cp a,$14 ; water tile
	jr z,.noCollision ; keep surfing if it's a water tile
	cp a,$32 ; either the left tile of the S.S. Anne boarding platform or the tile on eastern coastlines (depending on the current tileset)
	jr z,.checkIfVermilionDockTileset
	cp a,$48 ; tile on right on coast lines in Safari Zone
	jr z,.noCollision ; keep surfing
; check if the [land] tile in front of the player is passable
.checkIfNextTileIsPassable
	ld hl,$d530 ; pointer to list of passable tiles
	ld a,[hli]
	ld h,[hl]
	ld l,a
.loop
	ld a,[hli]
	cp a,$ff
	jr z,.collision
	cp c
	jr z,.stopSurfing ; stop surfing if the tile is passable
	jr .loop
.collision
	ld a,[$c02a]
	cp a,$b4 ; check if collision sound is already playing
	jr z,.setCarry
	ld a,$b4
	call PlaySound ; play collision sound (if it's not already playing)
.setCarry
	scf
	jr .done
.noCollision
	and a
.done
	ret
.stopSurfing
	xor a
	ld [$d700],a
	call LoadPlayerSpriteGraphics
	call Func_2307
	jr .noCollision
.checkIfVermilionDockTileset
	ld a,[W_CURMAPTILESET] ; tileset
	cp a,$0e ; Vermilion Dock tileset
	jr nz,.noCollision ; keep surfing if it's not the boarding platform tile
	jr .stopSurfing ; if it is the boarding platform tile, stop surfing

; function to run the current map's script
RunMapScript: ; 101b (0:101b)
	push hl
	push de
	push bc
	ld b, BANK(Func_f225)
	ld hl, Func_f225
	call Bankswitch ; check if the player is pushing a boulder
	ld a,[W_FLAGS_CD60]
	bit 1,a ; is the player pushing a boulder?
	jr z,.afterBoulderEffect
	ld b, BANK(Func_f2b5)
	ld hl, Func_f2b5
	call Bankswitch ; displays dust effect when pushing a boulder
.afterBoulderEffect
	pop bc
	pop de
	pop hl
	call Func_310e
	ld a,[W_CURMAP] ; current map number
	call SwitchToMapRomBank ; change to the ROM bank the map's data is in
	ld hl,W_MAPSCRIPTPTR
	ld a,[hli]
	ld h,[hl]
	ld l,a
	ld de,.return
	push de
	jp [hl] ; jump to script
.return
	ret

LoadWalkingPlayerSpriteGraphics: ; 104d (0:104d)
	ld de,RedSprite ; $4180
	ld hl,$8000
	jr LoadPlayerSpriteGraphicsCommon

LoadSurfingPlayerSpriteGraphics: ; 1055 (0:1055)
	ld de,SeelSprite
	ld hl,$8000
	jr LoadPlayerSpriteGraphicsCommon

LoadBikePlayerSpriteGraphics: ; 105d (0:105d)
	ld de,RedCyclingSprite
	ld hl,$8000

LoadPlayerSpriteGraphicsCommon: ; 1063 (0:1063)
	push de
	push hl
	ld bc,(BANK(RedSprite) << 8) + $0c
	call CopyVideoData
	pop hl
	pop de
	ld a,$c0
	add e
	ld e,a
	jr nc,.noCarry
	inc d
.noCarry
	set 3,h
	ld bc,$050c
	jp CopyVideoData

; function to load data from the map header
LoadMapHeader: ; 107c (0:107c)
	ld b, BANK(Func_f113)
	ld hl, Func_f113
	call Bankswitch
	ld a,[W_CURMAPTILESET]
	ld [$d119],a
	ld a,[W_CURMAP]
	call SwitchToMapRomBank
	ld a,[W_CURMAPTILESET]
	ld b,a
	res 7,a
	ld [W_CURMAPTILESET],a
	ld [$ff8b],a
	bit 7,b
	ret nz
	ld hl,MapHeaderPointers
	ld a,[W_CURMAP]
	sla a
	jr nc,.noCarry1
	inc h
.noCarry1
	add l
	ld l,a
	jr nc,.noCarry2
	inc h
.noCarry2
	ld a,[hli]
	ld h,[hl]
	ld l,a ; hl = base of map header
; copy the first 10 bytes (the fixed area) of the map data to D367-D370
	ld de,$d367
	ld c,$0a
.copyFixedHeaderLoop
	ld a,[hli]
	ld [de],a
	inc de
	dec c
	jr nz,.copyFixedHeaderLoop
; initialize all the connected maps to disabled at first, before loading the actual values
	ld a,$ff
	ld [$d371],a
	ld [$d37c],a
	ld [$d387],a
	ld [$d392],a
; copy connection data (if any) to WRAM
	ld a,[W_MAPCONNECTIONS]
	ld b,a
.checkNorth
	bit 3,b
	jr z,.checkSouth
	ld de,W_MAPCONN1PTR
	call CopyMapConnectionHeader
.checkSouth
	bit 2,b
	jr z,.checkWest
	ld de,W_MAPCONN2PTR
	call CopyMapConnectionHeader
.checkWest
	bit 1,b
	jr z,.checkEast
	ld de,W_MAPCONN3PTR
	call CopyMapConnectionHeader
.checkEast
	bit 0,b
	jr z,.getObjectDataPointer
	ld de,W_MAPCONN4PTR
	call CopyMapConnectionHeader
.getObjectDataPointer
	ld a,[hli]
	ld [$d3a9],a
	ld a,[hli]
	ld [$d3aa],a
	push hl
	ld a,[$d3a9]
	ld l,a
	ld a,[$d3aa]
	ld h,a ; hl = base of object data
	ld de,$d3ad ; background tile ID
	ld a,[hli]
	ld [de],a ; save background tile ID
.loadWarpData
	ld a,[hli] ; number of warps
	ld [$d3ae],a ; save the number of warps
	and a ; are there any warps?
	jr z,.loadSignData ; if not, skip this
	ld c,a
	ld de,$d3af ; base address of warps
.warpLoop ; one warp per loop iteration
	ld b,$04
.warpInnerLoop
	ld a,[hli]
	ld [de],a
	inc de
	dec b
	jr nz,.warpInnerLoop
	dec c
	jr nz,.warpLoop
.loadSignData
	ld a,[hli] ; number of signs
	ld [$d4b0],a ; save the number of signs
	and a ; are there any signs?
	jr z,.loadSpriteData ; if not, skip this
	ld c,a
	ld de,$d4d1 ; base address of sign text IDs
	ld a,d
	ld [$ff95],a
	ld a,e
	ld [$ff96],a
	ld de,$d4b1 ; base address of sign coordinates
.signLoop
	ld a,[hli]
	ld [de],a
	inc de
	ld a,[hli]
	ld [de],a
	inc de
	push de
	ld a,[$ff95]
	ld d,a
	ld a,[$ff96]
	ld e,a
	ld a,[hli]
	ld [de],a
	inc de
	ld a,d
	ld [$ff95],a
	ld a,e
	ld [$ff96],a
	pop de
	dec c
	jr nz,.signLoop
.loadSpriteData
	ld a,[$d72e]
	bit 5,a ; did a battle happen immediately before this?
	jp nz,.finishUp ; if so, skip this because battles don't destroy this data
	ld a,[hli]
	ld [$d4e1],a ; save the number of sprites
	push hl
; zero C110-C1FF and C210-C2FF
	ld hl,$c110
	ld de,$c210
	xor a
	ld b,$f0
.zeroSpriteDataLoop
	ld [hli],a
	ld [de],a
	inc e
	dec b
	jr nz,.zeroSpriteDataLoop
; initialize all C100-C1FF sprite entries to disabled (other than player's)
	ld hl,$c112
	ld de,$0010
	ld c,$0f
.disableSpriteEntriesLoop
	ld [hl],$ff
	add hl,de
	dec c
	jr nz,.disableSpriteEntriesLoop
	pop hl
	ld de,$c110
	ld a,[$d4e1] ; number of sprites
	and a ; are there any sprites?
	jp z,.finishUp ; if there are no sprites, skip the rest
	ld b,a
	ld c,$00
.loadSpriteLoop
	ld a,[hli]
	ld [de],a ; store picture ID at C1X0
	inc d
	ld a,$04
	add e
	ld e,a
	ld a,[hli]
	ld [de],a ; store Y position at C2X4
	inc e
	ld a,[hli]
	ld [de],a ; store X position at C2X5
	inc e
	ld a,[hli]
	ld [de],a ; store movement byte 1 at C2X6
	ld a,[hli]
	ld [$ff8d],a ; save movement byte 2
	ld a,[hli]
	ld [$ff8e],a ; save text ID and flags byte
	push bc
	push hl
	ld b,$00
	ld hl,W_MAPSPRITEDATA
	add hl,bc
	ld a,[$ff8d]
	ld [hli],a ; store movement byte 2 in byte 0 of sprite entry
	ld a,[$ff8e]
	ld [hl],a ; this appears pointless, since the value is overwritten immediately after
	ld a,[$ff8e]
	ld [$ff8d],a
	and a,$3f
	ld [hl],a ; store text ID in byte 1 of sprite entry
	pop hl
	ld a,[$ff8d]
	bit 6,a
	jr nz,.trainerSprite
	bit 7,a
	jr nz,.itemBallSprite
	jr .regularSprite
.trainerSprite
	ld a,[hli]
	ld [$ff8d],a ; save trainer class
	ld a,[hli]
	ld [$ff8e],a ; save trainer number (within class)
	push hl
	ld hl,W_MAPSPRITEEXTRADATA
	add hl,bc
	ld a,[$ff8d]
	ld [hli],a ; store trainer class in byte 0 of the entry
	ld a,[$ff8e]
	ld [hl],a ; store trainer number in byte 1 of the entry
	pop hl
	jr .nextSprite
.itemBallSprite
	ld a,[hli]
	ld [$ff8d],a ; save item number
	push hl
	ld hl,W_MAPSPRITEEXTRADATA
	add hl,bc
	ld a,[$ff8d]
	ld [hli],a ; store item number in byte 0 of the entry
	xor a
	ld [hl],a ; zero byte 1, since it is not used
	pop hl
	jr .nextSprite
.regularSprite
	push hl
	ld hl,W_MAPSPRITEEXTRADATA
	add hl,bc
; zero both bytes, since regular sprites don't use this extra space
	xor a
	ld [hli],a
	ld [hl],a
	pop hl
.nextSprite
	pop bc
	dec d
	ld a,$0a
	add e
	ld e,a
	inc c
	inc c
	dec b
	jp nz,.loadSpriteLoop
.finishUp
	ld a,$19
	call Predef ; load tileset data
	ld hl, LoadWildData
	ld b, BANK(LoadWildData)
	call Bankswitch ; load wild pokemon data
	pop hl ; restore hl from before going to the warp/sign/sprite data (this value was saved for seemingly no purpose)
	ld a,[W_CURMAPHEIGHT] ; map height in 4x4 tile blocks
	add a ; double it
	ld [$d524],a ; store map height in 2x2 tile blocks
	ld a,[W_CURMAPWIDTH] ; map width in 4x4 tile blocks
	add a ; double it
	ld [$d525],a ; map width in 2x2 tile blocks
	ld a,[W_CURMAP]
	ld c,a
	ld b,$00
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,$03
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ld hl,$404d
	add hl,bc
	add hl,bc
	ld a,[hli]
	ld [$d35b],a ; music 1
	ld a,[hl]
	ld [$d35c],a ; music 2
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; function to copy map connection data from ROM to WRAM
; Input: hl = source, de = destination
CopyMapConnectionHeader: ; 1238 (0:1238)
	ld c,$0b
.loop
	ld a,[hli]
	ld [de],a
	inc de
	dec c
	jr nz,.loop
	ret

; function to load map data
LoadMapData: ; 1241 (0:1241)
	ld a,[H_LOADEDROMBANK]
	push af
	call DisableLCD
	ld a,$98
	ld [$d527],a
	xor a
	ld [$d526],a
	ld [$ffaf],a
	ld [$ffae],a
	ld [W_WALKCOUNTER],a
	ld [$d119],a
	ld [$d11a],a
	ld [$d3a8],a
	call LoadTextBoxTilePatterns
	call LoadMapHeader
	ld b,BANK(InitMapSprites)
	ld hl,InitMapSprites
	call Bankswitch ; load tile pattern data for sprites
	call LoadTileBlockMap
	call LoadTilesetTilePatternData
	call LoadCurrentMapView
; copy current map view to VRAM
	ld hl,W_SCREENTILESBUFFER
	ld de,$9800
	ld b,$12
.vramCopyLoop
	ld c,$14
.vramCopyInnerLoop
	ld a,[hli]
	ld [de],a
	inc e
	dec c
	jr nz,.vramCopyInnerLoop
	ld a,$0c
	add e
	ld e,a
	jr nc,.noCarry
	inc d
.noCarry
	dec b
	jr nz,.vramCopyLoop
	ld a,$01
	ld [$cfcb],a
	call EnableLCD
	ld b,$09
	call GoPAL_SET
	call LoadPlayerSpriteGraphics
	ld a,[$d732]
	and a,$18 ; did the player fly or teleport in?
	jr nz,.restoreRomBank
	ld a,[W_FLAGS_D733]
	bit 1,a
	jr nz,.restoreRomBank
	call Func_235f ; music related
	call Func_2312 ; music related
.restoreRomBank
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; function to switch to the ROM bank that a map is stored in
; Input: a = map number
SwitchToMapRomBank: ; 12bc (0:12bc)
	push hl
	push bc
	ld c,a
	ld b,$00
	ld a,$03
	call BankswitchHome ; switch to ROM bank 3
	ld hl,MapHeaderBanks
	add hl,bc
	ld a,[hl]
	ld [$ffe8],a ; save map ROM bank
	call BankswitchBack
	ld a,[$ffe8]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a ; switch to map ROM bank
	pop bc
	pop hl
	ret

; known jump sources: 7af (0:7af)
Func_12da: ; 12da (0:12da)
	ld a, $1e
	ld [$d13a], a
	ld hl, $d730
	ld a, [hl]
	or $26
	ld [hl], a
	ret

; known jump sources: 3c9 (0:3c9)
Func_12e7: ; 12e7 (0:12e7)
	ld hl, $d728
	res 0, [hl]
	ret
; 12ed (0:12ed)
;appears to be called twice inside function $C38B
;if $d700,$d11a == $1 then biking
;if $d700,$d11a == $2 then surfing
ForceBikeOrSurf: ; 12ed (0:12ed)
	ld b,5 ;graphics bank 5
	ld hl,LoadPlayerSpriteGraphics ;load player sprite graphics
	call Bankswitch ;loads bank 5 and then calls LoadPlayerSpriteGraphics
	jp Func_2307 ;update map/player state?

; this is used to check if the player wants to interrupt the opening sequence at several points
; XXX is this used anywhere else?
; INPUT:
; c = number of frames to wait
; sets carry if Up+Select+B, Start, or A is pressed within c frames
; unsets carry otherwise
CheckForUserInterruption: ; 12f8 (0:12f8)
	call DelayFrame
	push bc
	call GetJoypadStateLowSensitivity
	pop bc
	ld a,[H_CURRENTPRESSEDBUTTONS] ; currently pressed buttons
	cp a,%01000110 ; Up, Select button, B button
	jr z,.setCarry ; if all three keys are pressed
	ld a,[$ffb5] ; either newly pressed buttons or currently pressed buttons at low sampling rate
	and a,%00001001 ; Start button, A button
	jr nz,.setCarry ; if either key is pressed
	dec c
	jr nz,CheckForUserInterruption
.unsetCarry
	and a
	ret
.setCarry
	scf
	ret

; function to load position data for destination warp when switching maps
; INPUT:
; a = ID of destination warp within destination map
LoadDestinationWarpPosition: ; 1313 (0:1313)
	ld b,a
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,[$cf12]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ld a,b
	add a
	add a
	ld c,a
	ld b,0
	add hl,bc
	ld bc,4
	ld de,$d35f
	call CopyData
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; INPUT:
; c: if nonzero, show at least a sliver of health
; d = number of HP bar sections (normally 6)
; e = health (in eighths of bar sections) (normally out of 48)
DrawHPBar: ; 1336 (0:1336)
	push hl
	push de
	push bc
	ld a,$71 ; left of HP bar tile 1
	ld [hli],a
	ld a,$62 ; left of HP bar tile 2
	ld [hli],a
	push hl
	ld a,$63 ; empty bar section tile
.drawEmptyBarLoop
	ld [hli],a
	dec d
	jr nz,.drawEmptyBarLoop
	ld a,[$cf94]
	dec a ; what should the right of HP bar tile be?
	ld a,$6d ; right of HP bar tile, in status screen and battles
	jr z,.writeTile
	dec a ; right of HP bar tile, in pokemon menu
.writeTile
	ld [hl],a
	pop hl
	ld a,e
	and a ; is there enough health to show up on the HP bar?
	jr nz,.loop ; if so, draw the HP bar
	ld a,c
	and a ; should a sliver of health be shown no matter what?
	jr z,.done
	ld e,1 ; if so, fill one eighth of a bar section
; loop to draw every full bar section
.loop
	ld a,e
	sub a,8
	jr c,.drawPartialBarSection
	ld e,a
	ld a,$6b ; filled bar section tile
	ld [hli],a
	ld a,e
	and a
	jr z,.done
	jr .loop
; draws a partial bar section at the end (if necessary)
; there are 7 possible partial bar sections from 1/8 to 7/8 full
.drawPartialBarSection
	ld a,$63 ; empty bar section tile
	add e ; add e to get the appropriate partial bar section tile
	ld [hl],a ; write the tile
.done
	pop bc
	pop de
	pop hl
	ret

; loads pokemon data from one of multiple sources to $cf98
; loads base stats to $d0b8
; INPUT:
; [$cf92] = index of pokemon within party/box
; [$cc49] = source
; 00: player's party
; 01: enemy's party
; 02: current box
; 03: daycare
; OUTPUT:
; [$cf91] = pokemon ID
; $cf98 = base address of pokemon data
; $d0b8 = base address of base stats
LoadMonData: ; 1372 (0:1372)
	ld hl,LoadMonData_
	ld b,BANK(LoadMonData_)
	jp Bankswitch

; no known jump sources
; writes c to $d0dc+b
Func_137a: ; 137a (0:137a)
	ld hl, $d0dc
	ld e, b
	ld d, $0
	add hl, de
	ld a, c
	ld [hl], a
	ret

; known jump sources: 617a (1:617a), 12a6e (4:6a6e), 403b0 (10:43b0), 415c0 (10:55c0), 7bebf (1e:7ebf)
LoadFlippedFrontSpriteByMonIndex: ; 1384 (0:1384)
	ld a, $1
	ld [W_SPRITEFLIPPED], a

; known jump sources: 4530 (1:4530), 702a3 (1c:42a3), 740ec (1d:40ec), 76643 (1d:6643), 797ab (1e:57ab)
LoadFrontSpriteByMonIndex: ; 1389 (0:1389)
	push hl
	ld a, [$d11e]
	push af
	ld a, [$cf91]
	ld [$d11e], a
	ld a, $3a
	call Predef ; indirect jump to IndexToPokedex (41010 (10:5010))
	ld hl, $d11e
	ld a, [hl]
	pop bc
	ld [hl], b
	and a
	pop hl
	jr z, .invalidDexNumber  ; dex #0 invalid
	cp $98
	jr c, .validDexNumber    ; dex >#151 invalid
.invalidDexNumber
	ld a, RHYDON ; $1
	ld [$cf91], a
	ret
.validDexNumber
	push hl
	ld de, $9000
	call LoadMonFrontSprite
	pop hl
	ld a, [H_LOADEDROMBANK]
	push af
	ld a, $f
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	xor a
	ld [$FF00+$e1], a
	call asm_3f0d0
	xor a
	ld [W_SPRITEFLIPPED], a
	pop af
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ret
; 13d0 (0:13d0)

; plays the cry of a pokemon
; INPUT:
; a = pokemon ID
PlayCry: ; 13d0 (0:13d0)
	call GetCryData
	call PlaySound ; play cry
	jp WaitForSoundToFinish ; wait for sound to be done playing

; gets a pokemon's cry data
; INPUT:
; a = pokemon ID
GetCryData: ; 13d9 (0:13d9)
	dec a
	ld c,a
	ld b,0
	ld hl,CryData
	add hl,bc
	add hl,bc
	add hl,bc
	ld a,Bank(CryData)
	call BankswitchHome
	ld a,[hli]
	ld b,a
	ld a,[hli]
	ld [$c0f1],a
	ld a,[hl]
	ld [$c0f2],a
	call BankswitchBack
	ld a,b ; a = cryID
	ld c,$14 ; base sound ID for pokemon cries
	rlca
	add b ; a = cryID * 3
	add c ; a = $14 + cryID * 3
	ret

DisplayPartyMenu: ; 13fc (0:13fc)
	ld a,[$ffd7]
	push af
	xor a
	ld [$ffd7],a
	call GBPalWhiteOutWithDelay3
	call CleanLCD_OAM
	call PartyMenuInit
	call DrawPartyMenu
	jp HandlePartyMenuInput

GoBackToPartyMenu: ; 1411 (0:1411)
	ld a,[$ffd7]
	push af
	xor a
	ld [$ffd7],a
	call PartyMenuInit
	call RedrawPartyMenu
	jp HandlePartyMenuInput

PartyMenuInit: ; 1420 (0:1420)
	ld a,$01
	call BankswitchHome
	call LoadHpBarAndStatusTilePatterns
	ld hl,$d730
	set 6,[hl] ; turn off letter printing delay
	xor a
	ld [$cc49],a
	ld [$cc37],a
	ld hl,W_TOPMENUITEMY
	inc a
	ld [hli],a ; top menu item Y
	xor a
	ld [hli],a ; top menu item X
	ld a,[$cc2b]
	push af
	ld [hli],a ; current menu item ID
	inc hl
	ld a,[W_NUMINPARTY]
	and a ; are there more than 0 pokemon in the party?
	jr z,.storeMaxMenuItemID
	dec a
; if party is not empty, the max menu item ID is ([W_NUMINPARTY] - 1)
; otherwise, it is 0
.storeMaxMenuItemID
	ld [hli],a ; max menu item ID
	ld a,[$d11f]
	and a
	ld a,%00000011 ; A button and B button
	jr z,.next
	xor a
	ld [$d11f],a
	inc a
.next
	ld [hli],a ; menu watched keys
	pop af
	ld [hl],a ; old menu item ID
	ret

HandlePartyMenuInput: ; 145a (0:145a)
	ld a,1
	ld [$cc4a],a
	ld a,$40
	ld [$d09b],a
	call HandleMenuInputPokemonSelection
	call PlaceUnfilledArrowMenuCursor
	ld b,a
	xor a
	ld [$d09b],a
	ld a,[W_CURMENUITEMID]
	ld [$cc2b],a
	ld hl,$d730
	res 6,[hl] ; turn on letter printing delay
	ld a,[$cc35]
	and a
	jp nz,.swappingPokemon
	pop af
	ld [$ffd7],a
	bit 1,b
	jr nz,.noPokemonChosen
	ld a,[W_NUMINPARTY]
	and a
	jr z,.noPokemonChosen
	ld a,[W_CURMENUITEMID]
	ld [$cf92],a
	ld hl,W_PARTYMON1
	ld b,0
	ld c,a
	add hl,bc
	ld a,[hl]
	ld [$cf91],a
	ld [$cfd9],a
	call BankswitchBack
	and a
	ret
.noPokemonChosen
	call BankswitchBack
	scf
	ret
.swappingPokemon
	bit 1,b ; was the B button pressed?
	jr z,.handleSwap ; if not, handle swapping the pokemon
.cancelSwap ; if the B button was pressed
	ld b,BANK(ErasePartyMenuCursors)
	ld hl,ErasePartyMenuCursors
	call Bankswitch
	xor a
	ld [$cc35],a
	ld [$d07d],a
	call RedrawPartyMenu
	jr HandlePartyMenuInput
.handleSwap
	ld a,[W_CURMENUITEMID]
	ld [$cf92],a
	ld b, BANK(Func_13613)
	ld hl, Func_13613
	call Bankswitch
	jr HandlePartyMenuInput

DrawPartyMenu: ; 14d4 (0:14d4)
	ld hl,$6cd2
	jr DrawPartyMenuCommon

RedrawPartyMenu: ; 14d9 (0:14d9)
	ld hl, RedrawPartyMenu_

DrawPartyMenuCommon: ; 14dc (0:14dc)
	ld b, BANK(RedrawPartyMenu_)
	jp Bankswitch

; prints a pokemon's status condition
; INPUT:
; de = address of status condition
; hl = destination address
PrintStatusCondition: ; 14e1 (0:14e1)
	push de
	dec de
	dec de ; de = address of current HP
	ld a,[de]
	ld b,a
	dec de
	ld a,[de]
	or b ; is the pokemon's HP zero?
	pop de
	jr nz,PrintStatusConditionNotFainted
; if the pokemon's HP is 0, print "FNT"
	ld a,"F"
	ld [hli],a
	ld a,"N"
	ld [hli],a
	ld [hl],"T"
	and a
	ret
PrintStatusConditionNotFainted ; 14f6
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,BANK(Unknown_747de)
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call Unknown_747de ; print status condition
	pop bc
	ld a,b
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; function to print pokemon level, leaving off the ":L" if the level is at least 100
; INPUT:
; hl = destination address
; [$cfb9] = level
PrintLevel: ; 150b (0:150b)
	ld a,$6e ; ":L" tile ID
	ld [hli],a
	ld c,2 ; number of digits
	ld a,[$cfb9] ; level
	cp a,100
	jr c,PrintLevelCommon
; if level at least 100, write over the ":L" tile
	dec hl
	inc c ; increment number of digits to 3
	jr PrintLevelCommon

; prints the level without leaving off ":L" regardless of level
; INPUT:
; hl = destination address
; [$cfb9] = level
PrintLevelFull: ; 151b (0:151b)
	ld a,$6e ; ":L" tile ID
	ld [hli],a
	ld c,3 ; number of digits
	ld a,[$cfb9] ; level

PrintLevelCommon: ; 1523 (0:1523)
	ld [$d11e],a
	ld de,$d11e
	ld b,$41 ; no leading zeroes, left-aligned, one byte
	jp PrintNumber

; XXX does anything call this?
Unknown152E: ; 152e (0:152e)
	ld hl,$d0dc
	ld c,a
	ld b,0
	add hl,bc
	ld a,[hl]
	ret

; copies the base stat data of a pokemon to $D0B8 (W_MONHEADER)
; INPUT:
; [$D0B5] = pokemon ID
GetMonHeader: ; 1537 (0:1537)
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,BANK(BulbasaurBaseStats)
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	push bc
	push de
	push hl
	ld a,[$d11e]
	push af
	ld a,[$d0b5]
	ld [$d11e],a
	ld de,FossilKabutopsPic
	ld b,$66 ; size of Kabutops fossil and Ghost sprites
	cp a,FOSSIL_KABUTOPS ; Kabutops fossil
	jr z,.specialID
	ld de,GhostPic
	cp a,MON_GHOST ; Ghost
	jr z,.specialID
	ld de,FossilAerodactylPic
	ld b,$77 ; size of Aerodactyl fossil sprite
	cp a,FOSSIL_AERODACTYL ; Aerodactyl fossil
	jr z,.specialID
	cp a,MEW
	jr z,.mew
	ld a,$3a
	call Predef   ; convert pokemon ID in [$D11E] to pokedex number
	ld a,[$d11e]
	dec a
	ld bc,28
	ld hl,BulbasaurBaseStats
	call AddNTimes
	ld de,W_MONHEADER
	ld bc,28
	call CopyData
	jr .done
.specialID
	ld hl,W_MONHSPRITEDIM
	ld [hl],b ; write sprite dimensions
	inc hl
	ld [hl],e ; write front sprite pointer
	inc hl
	ld [hl],d
	jr .done
.mew
	ld hl,MewBaseStats
	ld de,W_MONHEADER
	ld bc,28
	ld a,BANK(MewBaseStats)
	call FarCopyData
.done
	ld a,[$d0b5]
	ld [$d0b8],a
	pop af
	ld [$d11e],a
	pop hl
	pop de
	pop bc
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; copy party pokemon's name to $CD6D
GetPartyMonName2: ; 15b4 (0:15b4)
	ld a,[$cf92] ; index within party
	ld hl,W_PARTYMON1NAME

; this is called more often
GetPartyMonName: ; 15ba (0:15ba)
	push hl
	push bc
	call SkipFixedLengthTextEntries ; add 11 to hl, a times
	ld de,$cd6d
	push de
	ld bc,11
	call CopyData
	pop de
	pop bc
	pop hl
	ret

; function to print a BCD (Binary-coded decimal) number
; de = address of BCD number
; hl = destination address
; c = flags and length
; bit 7: if set, do not print leading zeroes
;        if unset, print leading zeroes
; bit 6: if set, left-align the string (do not pad empty digits with spaces)
;        if unset, right-align the string
; bit 5: if set, print currency symbol at the beginning of the string
;        if unset, do not print the currency symbol
; bits 0-4: length of BCD number in bytes
; Note that bits 5 and 7 are modified during execution. The above reflects
; their meaning at the beginning of the functions's execution.
PrintBCDNumber: ; 15cd (0:15cd)
	ld b,c ; save flags in b
	res 7,c
	res 6,c
	res 5,c ; c now holds the length
	bit 5,b
	jr z,.loop
	bit 7,b
	jr nz,.loop
	ld [hl],"¥"
	inc hl
.loop
	ld a,[de]
	swap a
	call PrintBCDDigit ; print upper digit
	ld a,[de]
	call PrintBCDDigit ; print lower digit
	inc de
	dec c
	jr nz,.loop
	bit 7,b ; were any non-zero digits printed?
	jr z,.done ; if so, we are done
.numberEqualsZero ; if every digit of the BCD number is zero
	bit 6,b ; left or right alignment?
	jr nz,.skipRightAlignmentAdjustment
	dec hl ; if the string is right-aligned, it needs to be moved back one space
.skipRightAlignmentAdjustment
	bit 5,b
	jr z,.skipCurrencySymbol
	ld [hl],"¥"
	inc hl
.skipCurrencySymbol
	ld [hl],"0"
	call PrintLetterDelay
	inc hl
.done
	ret

PrintBCDDigit: ; 1604 (0:1604)
	and a,%00001111
	and a
	jr z,.zeroDigit
.nonzeroDigit
	bit 7,b ; have any non-space characters been printed?
	jr z,.outputDigit
; if bit 7 is set, then no numbers have been printed yet
	bit 5,b ; print the currency symbol?
	jr z,.skipCurrencySymbol
	ld [hl],"¥"
	inc hl
	res 5,b
.skipCurrencySymbol
	res 7,b ; unset 7 to indicate that a nonzero digit has been reached
.outputDigit
	add a,"0"
	ld [hli],a
	jp PrintLetterDelay
.zeroDigit
	bit 7,b ; either printing leading zeroes or already reached a nonzero digit?
	jr z,.outputDigit ; if so, print a zero digit
	bit 6,b ; left or right alignment?
	ret nz
	inc hl ; if right-aligned, "print" a space by advancing the pointer
	ret

; uncompresses the front or back sprite of the specified mon
; assumes the corresponding mon header is already loaded
; hl contains offset to sprite pointer ($b for front or $d for back)
UncompressMonSprite: ; 1627 (0:1627)
	ld bc,W_MONHEADER
	add hl,bc
	ld a,[hli]
	ld [W_SPRITEINPUTPTR],a    ; fetch sprite input pointer
	ld a,[hl]
	ld [W_SPRITEINPUTPTR+1],a
; define (by index number) the bank that a pokemon's image is in
; index = Mew, bank 1
; index = Kabutops fossil, bank $B
;	index < $1F, bank 9
; $1F ≤ index < $4A, bank $A
; $4A ≤ index < $74, bank $B
; $74 ≤ index < $99, bank $C
; $99 ≤ index,       bank $D
	ld a,[$CF91] ; XXX name for this ram location
	ld b,a
	cp MEW
	ld a,BANK(MewPicFront)
	jr z,.GotBank
	ld a,b
	cp FOSSIL_KABUTOPS
	ld a,BANK(FossilKabutopsPic)
	jr z,.GotBank
	ld a,b
	cp TANGELA + 1
	ld a,BANK(TangelaPicFront)
	jr c,.GotBank
	ld a,b
	cp MOLTRES + 1
	ld a,BANK(MoltresPicFront)
	jr c,.GotBank
	ld a,b
	cp BEEDRILL + 2
	ld a,BANK(BeedrillPicFront)
	jr c,.GotBank
	ld a,b
	cp STARMIE + 1
	ld a,BANK(StarmiePicFront)
	jr c,.GotBank
	ld a,BANK(VictreebelPicFront)
.GotBank
	jp UncompressSpriteData

; known jump sources: 13b1 (0:13b1), 3ca4f (f:4a4f), 3d17d (f:517d), 3efce (f:6fce), 3efda (f:6fda), 5dbfd (17:5bfd)
; de: destination location
LoadMonFrontSprite: ; 1665 (0:1665)
	push de
	ld hl, W_MONHFRONTSPRITE - W_MONHEADER
	call UncompressMonSprite
	ld hl, W_MONHSPRITEDIM
	ld a, [hli]
	ld c, a
	pop de
	; fall through

; known jump sources: 3f066 (f:7066)
; postprocesses uncompressed sprite chunks to a 2bpp sprite and loads it into video ram
; calculates alignment parameters to place both sprite chunks in the center of the 7*7 tile sprite buffers
; de: destination location
; a,c:  sprite dimensions (in tiles of 8x8 each)
LoadUncompressedSpriteData: ; 1672 (0:1672)
	push de
	and $f
	ld [H_SPRITEWIDTH], a ; each byte contains 8 pixels (in 1bpp), so tiles=bytes for width
	ld b, a
	ld a, $7
	sub b      ; 7-w
	inc a      ; 8-w
	srl a      ; (8-w)/2     ; horizontal center (in tiles, rounded up)
	ld b, a
	add a
	add a
	add a
	sub b      ; 7*((8-w)/2) ; skip for horizontal center (in tiles)
	ld [H_SPRITEOFFSET], a
	ld a, c
	swap a
	and $f
	ld b, a
	add a
	add a
	add a     ; 8*tiles is height in bytes
	ld [H_SPRITEHEIGHT], a ; $FF00+$8c
	ld a, $7
	sub b      ; 7-h         ; skip for vertical center (in tiles, relative to current column)
	ld b, a
	ld a, [H_SPRITEOFFSET]
	add b     ; 7*((8-w)/2) + 7-h ; combined overall offset (in tiles)
	add a
	add a
	add a     ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes)
	ld [H_SPRITEOFFSET], a
	xor a
	ld [$4000], a
	ld hl, S_SPRITEBUFFER0
	call ZeroSpriteBuffer   ; zero buffer 0
	ld de, S_SPRITEBUFFER1
	ld hl, S_SPRITEBUFFER0
	call AlignSpriteDataCentered    ; copy and align buffer 1 to 0 (containing the MSB of the 2bpp sprite)
	ld hl, S_SPRITEBUFFER1
	call ZeroSpriteBuffer   ; zero buffer 1
	ld de, S_SPRITEBUFFER2
	ld hl, S_SPRITEBUFFER1
	call AlignSpriteDataCentered    ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite)
	pop de
	jp InterlaceMergeSpriteBuffers

; known jump sources: 16ac (0:16ac), 16bb (0:16bb)
; copies and aligns the sprite data properly inside the sprite buffer
; sprite buffers are 7*7 tiles in size, the loaded sprite is centered within this area
AlignSpriteDataCentered: ; 16c2 (0:16c2)
	ld a, [H_SPRITEOFFSET]
	ld b, $0
	ld c, a
	add hl, bc
	ld a, [H_SPRITEWIDTH] ; $FF00+$8b
.columnLoop
	push af
	push hl
	ld a, [H_SPRITEHEIGHT] ; $FF00+$8c
	ld c, a
.columnInnerLoop
	ld a, [de]
	inc de
	ld [hli], a
	dec c
	jr nz, .columnInnerLoop
	pop hl
	ld bc, 7*8    ; 7 tiles
	add hl, bc    ; advance one full column
	pop af
	dec a
	jr nz, .columnLoop
	ret

; fills the sprite buffer (pointed to in hl) with zeros
ZeroSpriteBuffer: ; 16df (0:16df)
	ld bc, SPRITEBUFFERSIZE
.nextByteLoop
	xor a
	ld [hli], a
	dec bc
	ld a, b
	or c
	jr nz, .nextByteLoop
	ret

; known jump sources: 16bf (0:16bf), 62b8 (1:62b8), 3ecd8 (f:6cd8), 3f121 (f:7121), 70355 (1c:4355), 70368 (1c:4368)
; combines the (7*7 tiles, 1bpp) sprite chunks in buffer 0 and 1 into a 2bpp sprite located in buffer 1 through 2
; in the resulting sprite, the rows of the two source sprites are interlaced
; de: output address
InterlaceMergeSpriteBuffers: ; 16ea (0:16ea)
	xor a
	ld [$4000], a
	push de
	ld hl, S_SPRITEBUFFER2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2
	ld de, S_SPRITEBUFFER1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1
	ld bc, S_SPRITEBUFFER0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0
	ld a, SPRITEBUFFERSIZE/2 ; $c4
	ld [H_SPRITEINTERLACECOUNTER], a ; $FF00+$8b
.interlaceLoop
	ld a, [de]
	dec de
	ld [hld], a   ; write byte of source 2
	ld a, [bc]
	dec bc
	ld [hld], a   ; write byte of source 1
	ld a, [de]
	dec de
	ld [hld], a   ; write byte of source 2
	ld a, [bc]
	dec bc
	ld [hld], a   ; write byte of source 1
	ld a, [H_SPRITEINTERLACECOUNTER] ; $FF00+$8b
	dec a
	ld [H_SPRITEINTERLACECOUNTER], a ; $FF00+$8b
	jr nz, .interlaceLoop
	ld a, [W_SPRITEFLIPPED]
	and a
	jr z, .notFlipped
	ld bc, 2*SPRITEBUFFERSIZE
	ld hl, S_SPRITEBUFFER1
.swapLoop
	swap [hl]    ; if flipped swap nybbles in all bytes
	inc hl
	dec bc
	ld a, b
	or c
	jr nz, .swapLoop
.notFlipped
	pop hl
	ld de, S_SPRITEBUFFER1
	ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied
	ld a, [H_LOADEDROMBANK]
	ld b, a
	jp CopyVideoData
; 172f (0:172f)

Tset0B_Coll: ; 172f (0:172f)
	INCBIN "gfx/tilesets/0b.tilecoll"
Tset00_Coll: ; 1735 (0:1735)
	INCBIN "gfx/tilesets/00.tilecoll"
Tset01_Coll: ; 1749 (0:1749)
	INCBIN "gfx/tilesets/01.tilecoll"
Tset02_Coll: ; 1753 (0:1753)
	INCBIN "gfx/tilesets/02.tilecoll"
Tset05_Coll: ; 1759 (0:1759)
	INCBIN "gfx/tilesets/05.tilecoll"
Tset03_Coll: ; 1765 (0:1765)
	INCBIN "gfx/tilesets/03.tilecoll"
Tset08_Coll: ; 1775 (0:1775)
	INCBIN "gfx/tilesets/08.tilecoll"
Tset09_Coll: ; 177f (0:177f)
	INCBIN "gfx/tilesets/09.tilecoll"
Tset0D_Coll: ; 178a (0:178a)
	INCBIN "gfx/tilesets/0d.tilecoll"
Tset0E_Coll: ; 1795 (0:1795)
	INCBIN "gfx/tilesets/0e.tilecoll"
Tset0F_Coll: ; 179a (0:179a)
	INCBIN "gfx/tilesets/0f.tilecoll"
Tset10_Coll: ; 17a2 (0:17a2)
	INCBIN "gfx/tilesets/10.tilecoll"
Tset11_Coll: ; 17ac (0:17ac)
	INCBIN "gfx/tilesets/11.tilecoll"
Tset12_Coll: ; 17b8 (0:17b8)
	INCBIN "gfx/tilesets/12.tilecoll"
Tset13_Coll: ; 17c0 (0:17c0)
	INCBIN "gfx/tilesets/13.tilecoll"
Tset14_Coll: ; 17ca (0:17ca)
	INCBIN "gfx/tilesets/14.tilecoll"
Tset15_Coll: ; 17d1 (0:17d1)
	INCBIN "gfx/tilesets/15.tilecoll"
Tset16_Coll: ; 17dd (0:17dd)
	INCBIN "gfx/tilesets/16.tilecoll"
Tset17_Coll: ; 17f0 (0:17f0)
	INCBIN "gfx/tilesets/17.tilecoll"
;Tile Collision ends 0x17f7

; does the same thing as FarCopyData at 009D
; only difference is that it uses [$ff8b] instead of [$cee9] for a temp value
; copy bc bytes of data from a:hl to de
FarCopyData2: ; 17f7 (0:17f7)
	ld [$ff8b],a
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,[$ff8b]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call CopyData
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; does a far copy but the source is de and the destination is hl
; copy bc bytes of data from a:de to hl
FarCopyData3: ; 180d (0:180d)
	ld [$ff8b],a
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,[$ff8b]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	push hl
	push de
	push de
	ld d,h
	ld e,l
	pop hl
	call CopyData
	pop de
	pop hl
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; copies each source byte to the destination twice (next to each other)
; copy bc source bytes from a:hl to de
FarCopyDataDouble: ; 182b (0:182b)
	ld [$ff8b],a
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,[$ff8b]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
.loop
	ld a,[hli]
	ld [de],a
	inc de
	ld [de],a
	inc de
	dec bc
	ld a,c
	or b
	jr nz,.loop
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; copy (c * 16) bytes from b:de to hl during V-blank
; transfers up to 128 bytes per V-blank
CopyVideoData: ; 1848 (0:1848)
	ld a,[H_AUTOBGTRANSFERENABLED] ; save auto-transfer enabled flag
	push af
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer while copying
	ld a,[H_LOADEDROMBANK]
	ld [$ff8b],a
	ld a,b
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ld a,e
	ld [H_VBCOPYSRC],a
	ld a,d
	ld [H_VBCOPYSRC + 1],a
	ld a,l
	ld [H_VBCOPYDEST],a
	ld a,h
	ld [H_VBCOPYDEST + 1],a
.loop
	ld a,c
	cp a,8 ; are there more than 128 bytes left to copy?
	jr nc,.copyMaxSize ; only copy up to 128 bytes at a time
.copyRemainder
	ld [H_VBCOPYSIZE],a
	call DelayFrame ; wait for V-blank handler to perform the copy
	ld a,[$ff8b]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	pop af
	ld [H_AUTOBGTRANSFERENABLED],a ; restore original auto-transfer enabled flag
	ret
.copyMaxSize
	ld a,8 ; 128 bytes
	ld [H_VBCOPYSIZE],a
	call DelayFrame ; wait for V-blank handler to perform the copy
	ld a,c
	sub a,8
	ld c,a
	jr .loop

; copy (c * 8) source bytes from b:de to hl during V-blank
; copies each source byte to the destination twice (next to each other)
; transfers up to 64 source bytes per V-blank
CopyVideoDataDouble: ; 1886 (0:1886)
	ld a,[H_AUTOBGTRANSFERENABLED] ; save auto-transfer enabled flag
	push af
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer while copying
	ld a,[H_LOADEDROMBANK]
	ld [$ff8b],a
	ld a,b
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ld a,e
	ld [H_VBCOPYDOUBLESRC],a
	ld a,d
	ld [H_VBCOPYDOUBLESRC + 1],a
	ld a,l
	ld [H_VBCOPYDOUBLEDEST],a
	ld a,h
	ld [H_VBCOPYDOUBLEDEST + 1],a
.loop
	ld a,c
	cp a,8 ; are there more than 64 source bytes left to copy?
	jr nc,.copyMaxSize ; only copy up to 64 source bytes at a time
.copyRemainder
	ld [H_VBCOPYDOUBLESIZE],a
	call DelayFrame ; wait for V-blank handler to perform the copy
	ld a,[$ff8b]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	pop af
	ld [H_AUTOBGTRANSFERENABLED],a ; restore original auto-transfer enabled flag
	ret
.copyMaxSize
	ld a,8 ; 64 source bytes
	ld [H_VBCOPYDOUBLESIZE],a
	call DelayFrame ; wait for V-blank handler to perform the copy
	ld a,c
	sub a,8
	ld c,a
	jr .loop

; clears an area of the screen
; INPUT:
; hl = address of upper left corner of the area
; b = height
; c = width
ClearScreenArea: ; 18c4 (0:18c4)
	ld   a,$7F ; blank tile
	ld   de,20 ; screen width
.loop
	push hl
	push bc
.innerLoop
	ld [hli],a
	dec c
	jr nz,.innerLoop
	pop bc
	pop hl
	add hl,de
	dec b
	jr nz,.loop
	ret

; known jump sources: 70fd (1:70fd), 1dbc2 (7:5bc2), 41265 (10:5265), 4129d (10:529d), 41324 (10:5324)
; copies the screen tile buffer from WRAM to VRAM
; copying is done in 3 chunks of 6 rows each
; b: high byte of VRAM destination address ($98 or $9c for window tile map 0 or 1 resp.)
CopyScreenTileBufferToVRAM: ; 18d6 (0:18d6)
	ld c, $6
	ld hl, $0000
	ld de, W_SCREENTILESBUFFER
	call InitScreenTileBufferTransferParameters
	call DelayFrame
	ld hl, $600
	ld de, W_SCREENTILESBUFFER + 20 * 6 ; $c418
	call InitScreenTileBufferTransferParameters
	call DelayFrame
	ld hl, $c00
	ld de, W_SCREENTILESBUFFER + 20 * 12 ; $c490
	call InitScreenTileBufferTransferParameters
	jp DelayFrame

InitScreenTileBufferTransferParameters: ; 18fc (0:18fc)
	ld a, d
	ld [H_VBCOPYBGSRC+1], a
	call GetRowColAddressBgMap
	ld a, l
	ld [H_VBCOPYBGDEST], a ; $FF00+$c3
	ld a, h
	ld [H_VBCOPYBGDEST+1], a
	ld a, c
	ld [H_VBCOPYBGNUMROWS], a ; $FF00+$c5
	ld a, e
	ld [H_VBCOPYBGSRC], a ; $FF00+$c1
	ret
; 190f (0:190f)
ClearScreen: ; 190f (0:190f)
; clears all tiles in the tilemap,
; then wait three frames
	ld bc,$0168 ; tilemap size
	inc b
	ld hl,W_SCREENTILESBUFFER ; TILEMAP_START
	ld a,$7F    ; $7F is blank tile
.loop
	ld [hli],a
	dec c
	jr nz,.loop
	dec b
	jr nz,.loop
	jp Delay3

TextBoxBorder: ; 1922 (0:1922)
; draw a text box
; upper-left corner at coordinates hl
; height b
; width c

	; first row
	push hl
	ld a,"┌"
	ld [hli],a
	inc a    ; horizontal border ─
	call NPlaceChar
	inc a    ; upper-right border ┐
	ld [hl],a

	; middle rows
	pop hl
	ld de,20
	add hl,de ; skip the top row

.PlaceRow
	push hl
	ld a,"│"
	ld [hli],a
	ld a," "
	call NPlaceChar
	ld [hl],"│"

	pop hl
	ld de,20
	add hl,de ; move to next row
	dec b
	jr nz,.PlaceRow

	; bottom row
	ld a,"└"
	ld [hli],a
	ld a,"─"
	call NPlaceChar
	ld [hl],"┘"
	ret
;
NPlaceChar: ; 194f (0:194f)
; place a row of width c of identical characters
	ld d,c
.loop
	ld [hli],a
	dec d
	jr nz,.loop
	ret

PlaceString: ; 1955 (0:1955)
	push hl
PlaceNextChar: ; 1956 (0:1956)
	ld a,[de]

	cp "@"
	jr nz,.PlaceText
	ld b,h
	ld c,l
	pop hl
	ret

.PlaceText
	cp $4E
	jr nz,.next
	ld bc,$0028
	ld a,[$FFF6]
	bit 2,a
	jr z,.next2
	ld bc,$14
.next2
	pop hl
	add hl,bc
	push hl
	jp Next19E8

.next
	cp $4F
	jr nz,.next3
	pop hl
	FuncCoord 1, 16 ; $c4e1
	ld hl,Coord
	push hl
	jp Next19E8

.next3 ; Check against a dictionary
	and a
	jp z,Char00
	cp $4C
	jp z,Char4C
	cp $4B
	jp z,Char4B
	cp $51
	jp z,Char51
	cp $49
	jp z,Char49
	cp $52
	jp z,Char52
	cp $53
	jp z,Char53
	cp $54
	jp z,Char54
	cp $5B
	jp z,Char5B
	cp $5E
	jp z,Char5E
	cp $5C
	jp z,Char5C
	cp $5D
	jp z,Char5D
	cp $55
	jp z,Char55
	cp $56
	jp z,Char56
	cp $57
	jp z,Char57
	cp $58
	jp z,Char58
	cp $4A
	jp z,Char4A
	cp $5F
	jp z,Char5F
	cp $59
	jp z,Char59
	cp $5A
	jp z,Char5A
	ld [hli],a
	call PrintLetterDelay
Next19E8: ; 19e8 (0:19e8)
	inc de
	jp PlaceNextChar

Char00: ; 19ec (0:19ec)
	ld b,h
	ld c,l
	pop hl
	ld de,Char00Text
	dec de
	ret

Char00Text: ; 0x19f4 “%d ERROR.”
	TX_FAR _Char00Text
	db "@"

Char52: ; 0x19f9 player’s name
	push de
	ld de,W_PLAYERNAME
	jr FinishDTE

Char53: ; 19ff (0:19ff) ; rival’s name
	push de
	ld de,W_RIVALNAME
	jr FinishDTE

Char5D: ; 1a05 (0:1a05) ; TRAINER
	push de
	ld de,Char5DText
	jr FinishDTE

Char5C: ; 1a0b (0:1a0b) ; TM
	push de
	ld de,Char5CText
	jr FinishDTE

Char5B: ; 1a11 (0:1a11) ; PC
	push de
	ld de,Char5BText
	jr FinishDTE

Char5E: ; 1a17 (0:1a17) ; ROCKET
	push de
	ld de,Char5EText
	jr FinishDTE

Char54: ; 1a1d (0:1a1d) ; POKé
	push de
	ld de,Char54Text
	jr FinishDTE

Char56: ; 1a23 (0:1a23) ; ……
	push de
	ld de,Char56Text
	jr FinishDTE

Char4A: ; 1a29 (0:1a29) ; PKMN
	push de
	ld de,Char4AText
	jr FinishDTE

Char59: ; 1a2f (0:1a2f)
; depending on whose turn it is, print
; enemy active monster’s name, prefixed with “Enemy ”
; or
; player active monster’s name
; (like Char5A but flipped)
	ld a,[H_WHOSETURN]
	xor 1
	jr MonsterNameCharsCommon

Char5A: ; 1a35 (0:1a35)
; depending on whose turn it is, print
; player active monster’s name
; or
; enemy active monster’s name, prefixed with “Enemy ”
	ld a,[H_WHOSETURN]
MonsterNameCharsCommon: ; 1a37 (0:1a37)
	push de
	and a
	jr nz,.Enemy
	ld de,W_PLAYERMONNAME ; player active monster name
	jr FinishDTE

.Enemy ; 1A40
	; print “Enemy ”
	ld de,Char5AText
	call PlaceString

	ld h,b
	ld l,c
	ld de,W_ENEMYMONNAME ; enemy active monster name

FinishDTE: ; 1a4b (0:1a4b)
	call PlaceString
	ld h,b
	ld l,c
	pop de
	inc de
	jp PlaceNextChar

Char5CText: ; 1a55 (0:1a55)
	db "TM@"
Char5DText: ; 1a58 (0:1a58)
	db "TRAINER@"
Char5BText: ; 1a60 (0:1a60)
	db "PC@"
Char5EText: ; 1a63 (0:1a63)
	db "ROCKET@"
Char54Text: ; 1a6a (0:1a6a)
	db "POKé@"
Char56Text: ; 1a6f (0:1a6f)
	db "……@"
Char5AText: ; 1a72 (0:1a72)
	db "Enemy @"
Char4AText: ; 1a79 (0:1a79)
	db $E1,$E2,"@" ; PKMN

Char55: ; 1a7c (0:1a7c)
	push de
	ld b,h
	ld c,l
	ld hl,Char55Text
	call TextCommandProcessor
	ld h,b
	ld l,c
	pop de
	inc de
	jp PlaceNextChar

Char55Text: ; 1a8c (0:1a8c)
; equivalent to Char4B
	TX_FAR _Char55Text
	db "@"

Char5F: ; 1a91 (0:1a91)
; ends a Pokédex entry
	ld [hl],"."
	pop hl
	ret

Char58: ; 1a95 (0:1a95)
	ld a,[$D12B]
	cp 4
	jp z,Next1AA2
	ld a,$EE
	FuncCoord 18, 16 ; $c4f2
	ld [Coord],a
Next1AA2: ; 1aa2 (0:1aa2)
	call ProtectedDelay3
	call ManualTextScroll
	ld a,$7F
	FuncCoord 18, 16 ; $c4f2
	ld [Coord],a
Char57: ; 1aad (0:1aad)
	pop hl
	ld de,Char58Text
	dec de
	ret

Char58Text: ; 1ab3 (0:1ab3)
	db "@"

Char51: ; 1ab4 (0:1ab4)
	push de
	ld a,$EE
	FuncCoord 18, 16 ; $c4f2
	ld [Coord],a
	call ProtectedDelay3
	call ManualTextScroll
	FuncCoord 1, 13 ; $c4a5
	ld hl,Coord
	ld bc,$0412
	call ClearScreenArea
	ld c,$14
	call DelayFrames
	pop de
	FuncCoord 1, 14 ; $c4b9
	ld hl,Coord
	jp Next19E8

Char49: ; 1ad5 (0:1ad5)
	push de
	ld a,$EE
	FuncCoord 18, 16 ; $c4f2
	ld [Coord],a
	call ProtectedDelay3
	call ManualTextScroll
	FuncCoord 1, 10 ; $c469
	ld hl,Coord
	ld bc,$0712
	call ClearScreenArea
	ld c,$14
	call DelayFrames
	pop de
	pop hl
	FuncCoord 1, 11 ; $c47d
	ld hl,Coord
	push hl
	jp Next19E8

Char4B: ; 1af8 (0:1af8)
	ld a,$EE
	FuncCoord 18, 16 ; $c4f2
	ld [Coord],a
	call ProtectedDelay3
	push de
	call ManualTextScroll
	pop de
	ld a,$7F
	FuncCoord 18, 16 ; $c4f2
	ld [Coord],a
	;fall through
Char4C: ; 1b0a (0:1b0a)
	push de
	call Next1B18
	call Next1B18
	FuncCoord 1, 16 ; $c4e1
	ld hl,Coord
	pop de
	jp Next19E8

Next1B18: ; 1b18 (0:1b18)
	FuncCoord 0, 14 ; $c4b8
	ld hl,Coord
	FuncCoord 0, 13 ; $c4a4
	ld de,Coord
	ld b,$3C
.next
	ld a,[hli]
	ld [de],a
	inc de
	dec b
	jr nz,.next
	FuncCoord 1, 16 ; $c4e1
	ld hl,Coord
	ld a,$7F
	ld b,$12
.next2
	ld [hli],a
	dec b
	jr nz,.next2

	; wait five frames
	ld b,5
.WaitFrame
	call DelayFrame
	dec b
	jr nz,.WaitFrame

	ret

ProtectedDelay3: ; 1b3a (0:1b3a)
	push bc
	call Delay3
	pop bc
	ret

TextCommandProcessor: ; 1b40 (0:1b40)
	ld a,[$d358]
	push af
	set 1,a
	ld e,a
	ld a,[$fff4]
	xor e
	ld [$d358],a
	ld a,c
	ld [$cc3a],a
	ld a,b
	ld [$cc3b],a

NextTextCommand: ; 1b55 (0:1b55)
	ld a,[hli]
	cp a,$50 ; terminator
	jr nz,.doTextCommand
	pop af
	ld [$d358],a
	ret
.doTextCommand
	push hl
	cp a,$17
	jp z,TextCommand17
	cp a,$0e
	jp nc,TextCommand0B ; if a != 0x17 and a >= 0xE, go to command 0xB
; if a < 0xE, use a jump table
	ld hl,TextCommandJumpTable
	push bc
	add a
	ld b,$00
	ld c,a
	add hl,bc
	pop bc
	ld a,[hli]
	ld h,[hl]
	ld l,a
	jp [hl]

; draw box
; 04AAAABBCC
; AAAA = address of upper left corner
; BB = height
; CC = width
TextCommand04: ; 1b78 (0:1b78)
	pop hl
	ld a,[hli]
	ld e,a
	ld a,[hli]
	ld d,a
	ld a,[hli]
	ld b,a
	ld a,[hli]
	ld c,a
	push hl
	ld h,d
	ld l,e
	call TextBoxBorder
	pop hl
	jr NextTextCommand

; place string inline
; 00{string}
TextCommand00: ; 1b8a (0:1b8a)
	pop hl
	ld d,h
	ld e,l
	ld h,b
	ld l,c
	call PlaceString
	ld h,d
	ld l,e
	inc hl
	jr NextTextCommand

; place string from RAM
; 01AAAA
; AAAA = address of string
TextCommand01: ; 1b97 (0:1b97)
	pop hl
	ld a,[hli]
	ld e,a
	ld a,[hli]
	ld d,a
	push hl
	ld h,b
	ld l,c
	call PlaceString
	pop hl
	jr NextTextCommand

; print BCD number
; 02AAAABB
; AAAA = address of BCD number
; BB
; bits 0-4 = length in bytes
; bits 5-7 = unknown flags
TextCommand02: ; 1ba5 (0:1ba5)
	pop hl
	ld a,[hli]
	ld e,a
	ld a,[hli]
	ld d,a
	ld a,[hli]
	push hl
	ld h,b
	ld l,c
	ld c,a
	call PrintBCDNumber
	ld b,h
	ld c,l
	pop hl
	jr NextTextCommand

; repoint destination address
; 03AAAA
; AAAA = new destination address
TextCommand03: ; 1bb7 (0:1bb7)
	pop hl
	ld a,[hli]
	ld [$cc3a],a
	ld c,a
	ld a,[hli]
	ld [$cc3b],a
	ld b,a
	jp NextTextCommand

; repoint destination to second line of dialogue text box
; 05
; (no arguments)
TextCommand05: ; 1bc5 (0:1bc5)
	pop hl
	FuncCoord 1, 16 ; $c4e1
	ld bc,Coord ; address of second line of dialogue text box
	jp NextTextCommand

; blink arrow and wait for A or B to be pressed
; 06
; (no arguments)
TextCommand06: ; 1bcc (0:1bcc)
	ld a,[W_ISLINKBATTLE]
	cp a,$04
	jp z,TextCommand0D
	ld a,$ee ; down arrow
	FuncCoord 18, 16 ; $c4f2
	ld [Coord],a ; place down arrow in lower right corner of dialogue text box
	push bc
	call ManualTextScroll ; blink arrow and wait for A or B to be pressed
	pop bc
	ld a," "
	FuncCoord 18, 16 ; $c4f2
	ld [Coord],a ; overwrite down arrow with blank space
	pop hl
	jp NextTextCommand

; scroll text up one line
; 07
; (no arguments)
TextCommand07: ; 1be7 (0:1be7)
	ld a," "
	FuncCoord 18, 16 ; $c4f2
	ld [Coord],a ; place blank space in lower right corner of dialogue text box
	call Next1B18 ; scroll up text
	call Next1B18
	pop hl
	FuncCoord 1, 16 ; $c4e1
	ld bc,Coord ; address of second line of dialogue text box
	jp NextTextCommand

; execute asm inline
; 08{code}
TextCommand08: ; 1bf9 (0:1bf9)
	pop hl
	ld de,NextTextCommand
	push de ; return address
	jp [hl]

; print decimal number (converted from binary number)
; 09AAAABB
; AAAA = address of number
; BB
; bits 0-3 = how many digits to display
; bits 4-7 = how long the number is in bytes
TextCommand09: ; 1bff (0:1bff)
	pop hl
	ld a,[hli]
	ld e,a
	ld a,[hli]
	ld d,a
	ld a,[hli]
	push hl
	ld h,b
	ld l,c
	ld b,a
	and a,$0f
	ld c,a
	ld a,b
	and a,$f0
	swap a
	set 6,a
	ld b,a
	call PrintNumber
	ld b,h
	ld c,l
	pop hl
	jp NextTextCommand

; wait half a second if the user doesn't hold A or B
; 0A
; (no arguments)
TextCommand0A: ; 1c1d (0:1c1d)
	push bc
	call GetJoypadState
	ld a,[H_CURRENTPRESSEDBUTTONS]
	and a,%00000011 ; A and B buttons
	jr nz,.skipDelay
	ld c,30
	call DelayFrames
.skipDelay
	pop bc
	pop hl
	jp NextTextCommand

; plays sounds
; this actually handles various command ID's, not just 0B
; (no arguments)
TextCommand0B: ; 1c31 (0:1c31)
	pop hl
	push bc
	dec hl
	ld a,[hli]
	ld b,a ; b = command number that got us here
	push hl
	ld hl,TextCommandSounds
.loop
	ld a,[hli]
	cp b
	jr z,.matchFound
	inc hl
	jr .loop
.matchFound
	cp a,$14
	jr z,.pokemonCry
	cp a,$15
	jr z,.pokemonCry
	cp a,$16
	jr z,.pokemonCry
	ld a,[hl]
	call PlaySound
	call WaitForSoundToFinish
	pop hl
	pop bc
	jp NextTextCommand
.pokemonCry
	push de
	ld a,[hl]
	call PlayCry
	pop de
	pop hl
	pop bc
	jp NextTextCommand

; format: text command ID, sound ID or cry ID
TextCommandSounds: ; 1c64 (0:1c64)
db $0B,$86
db $12,$9A
db $0E,$91
db $0F,$86
db $10,$89
db $11,$94
db $13,$98
db $14,$A8
db $15,$97
db $16,$78

; draw ellipses
; 0CAA
; AA = number of ellipses to draw
TextCommand0C: ; 1c78 (0:1c78)
	pop hl
	ld a,[hli]
	ld d,a
	push hl
	ld h,b
	ld l,c
.loop
	ld a,$75 ; ellipsis
	ld [hli],a
	push de
	call GetJoypadState
	pop de
	ld a,[H_CURRENTPRESSEDBUTTONS] ; joypad state
	and a,%00000011 ; is A or B button pressed?
	jr nz,.skipDelay ; if so, skip the delay
	ld c,10
	call DelayFrames
.skipDelay
	dec d
	jr nz,.loop
	ld b,h
	ld c,l
	pop hl
	jp NextTextCommand

; wait for A or B to be pressed
; 0D
; (no arguments)
TextCommand0D: ; 1c9a (0:1c9a)
	push bc
	call ManualTextScroll ; wait for A or B to be pressed
	pop bc
	pop hl
	jp NextTextCommand

; process text commands in another ROM bank
; 17AAAABB
; AAAA = address of text commands
; BB = bank
TextCommand17: ; 1ca3 (0:1ca3)
	pop hl
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,[hli]
	ld e,a
	ld a,[hli]
	ld d,a
	ld a,[hli]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	push hl
	ld l,e
	ld h,d
	call TextCommandProcessor
	pop hl
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	jp NextTextCommand

TextCommandJumpTable: ; 1cc1 (0:1cc1)
dw TextCommand00
dw TextCommand01
dw TextCommand02
dw TextCommand03
dw TextCommand04
dw TextCommand05
dw TextCommand06
dw TextCommand07
dw TextCommand08
dw TextCommand09
dw TextCommand0A
dw TextCommand0B
dw TextCommand0C
dw TextCommand0D

; this function seems to be used only once
; it store the address of a row and column of the VRAM background map in hl
; INPUT: h - row, l - column, b - high byte of background tile map address in VRAM
GetRowColAddressBgMap: ; 1cdd (0:1cdd)
	xor a
	srl h
	rr a
	srl h
	rr a
	srl h
	rr a
	or l
	ld l,a
	ld a,b
	or h
	ld h,a
	ret

; clears a VRAM background map with blank space tiles
; INPUT: h - high byte of background tile map address in VRAM
ClearBgMap: ; 1cf0 (0:1cf0)
	ld a," "
	jr .next
	ld a,l ; XXX does anything call this?
.next
	ld de,$400 ; size of VRAM background map
	ld l,e
.loop
	ld [hli],a
	dec e
	jr nz,.loop
	dec d
	jr nz,.loop
	ret

; When the player takes a step, a row or column of 2x2 tile blocks at the edge
; of the screen toward which they moved is exposed and has to be redrawn.
; This function does the redrawing.
RedrawExposedScreenEdge: ; 1d01 (0:1d01)
	ld a,[H_SCREENEDGEREDRAW]
	and a
	ret z
	ld b,a
	xor a
	ld [H_SCREENEDGEREDRAW],a
	dec b
	jr nz,.redrawRow
.redrawColumn
	ld hl,W_SCREENEDGETILES
	ld a,[H_SCREENEDGEREDRAWADDR]
	ld e,a
	ld a,[H_SCREENEDGEREDRAWADDR + 1]
	ld d,a
	ld c,18 ; screen height
.loop1
	ld a,[hli]
	ld [de],a
	inc de
	ld a,[hli]
	ld [de],a
	ld a,31
	add e
	ld e,a
	jr nc,.noCarry
	inc d
.noCarry
; the following 4 lines wrap us from bottom to top if necessary
	ld a,d
	and a,$03
	or a,$98
	ld d,a
	dec c
	jr nz,.loop1
	xor a
	ld [H_SCREENEDGEREDRAW],a
	ret
.redrawRow
	ld hl,W_SCREENEDGETILES
	ld a,[H_SCREENEDGEREDRAWADDR]
	ld e,a
	ld a,[H_SCREENEDGEREDRAWADDR + 1]
	ld d,a
	push de
	call .drawHalf ; draw upper half
	pop de
	ld a,32 ; width of VRAM background map
	add e
	ld e,a
	                 ; draw lower half
.drawHalf
	ld c,10
.loop2
	ld a,[hli]
	ld [de],a
	inc de
	ld a,[hli]
	ld [de],a
	ld a,e
	inc a
; the following 6 lines wrap us from the right edge to the left edge if necessary
	and a,$1f
	ld b,a
	ld a,e
	and a,$e0
	or b
	ld e,a
	dec c
	jr nz,.loop2
	ret

; This function automatically transfers tile number data from the tile map at
; C3A0 to VRAM during V-blank. Note that it only transfers one third of the
; background per V-blank. It cycles through which third it draws.
; This transfer is turned off when walking around the map, but is turned
; on when talking to sprites, battling, using menus, etc. This is because
; the above function, RedrawExposedScreenEdge, is used when walking to
; improve efficiency.
AutoBgMapTransfer: ; 1d57 (0:1d57)
	ld a,[H_AUTOBGTRANSFERENABLED]
	and a
	ret z
	ld hl,[sp + 0]
	ld a,h
	ld [H_SPTEMP],a
	ld a,l
	ld [H_SPTEMP + 1],a ; save stack pinter
	ld a,[H_AUTOBGTRANSFERPORTION]
	and a
	jr z,.transferTopThird
	dec a
	jr z,.transferMiddleThird
.transferBottomThird
	FuncCoord 0,12
	ld hl,Coord
	ld sp,hl
	ld a,[H_AUTOBGTRANSFERDEST + 1]
	ld h,a
	ld a,[H_AUTOBGTRANSFERDEST]
	ld l,a
	ld de,(12 * 32)
	add hl,de
	xor a ; TRANSFERTOP
	jr .doTransfer
.transferTopThird
	FuncCoord 0,0
	ld hl,Coord
	ld sp,hl
	ld a,[H_AUTOBGTRANSFERDEST + 1]
	ld h,a
	ld a,[H_AUTOBGTRANSFERDEST]
	ld l,a
	ld a,TRANSFERMIDDLE
	jr .doTransfer
.transferMiddleThird
	FuncCoord 0,6
	ld hl,Coord
	ld sp,hl
	ld a,[H_AUTOBGTRANSFERDEST + 1]
	ld h,a
	ld a,[H_AUTOBGTRANSFERDEST]
	ld l,a
	ld de,(6 * 32)
	add hl,de
	ld a,TRANSFERBOTTOM
.doTransfer
	ld [H_AUTOBGTRANSFERPORTION],a ; store next portion
	ld b,6

; unrolled loop and using pop for speed
TransferBgRows: ; 1d9e (0:1d9e)
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	ld a,13
	add l
	ld l,a
	jr nc,.noCarry
	inc h
.noCarry
	dec b
	jr nz,TransferBgRows
	ld a,[H_SPTEMP]
	ld h,a
	ld a,[H_SPTEMP + 1]
	ld l,a
	ld sp,hl ; restore stack pointer
	ret

; Copies [H_VBCOPYBGNUMROWS] rows from H_VBCOPYBGSRC to H_VBCOPYBGDEST.
; If H_VBCOPYBGSRC is XX00, the transfer is disabled.
VBlankCopyBgMap: ; 1de1 (0:1de1)
	ld a,[H_VBCOPYBGSRC] ; doubles as enabling byte
	and a
	ret z
	ld hl,[sp + 0]
	ld a,h
	ld [H_SPTEMP],a
	ld a,l
	ld [H_SPTEMP + 1],a ; save stack pointer
	ld a,[H_VBCOPYBGSRC]
	ld l,a
	ld a,[H_VBCOPYBGSRC + 1]
	ld h,a
	ld sp,hl
	ld a,[H_VBCOPYBGDEST]
	ld l,a
	ld a,[H_VBCOPYBGDEST + 1]
	ld h,a
	ld a,[H_VBCOPYBGNUMROWS]
	ld b,a
	xor a
	ld [H_VBCOPYBGSRC],a ; disable transfer so it doesn't continue next V-blank
	jr TransferBgRows

; This function copies ([H_VBCOPYDOUBLESIZE] * 8) source bytes
; from H_VBCOPYDOUBLESRC to H_VBCOPYDOUBLEDEST.
; It copies each source byte to the destination twice (next to each other).
; The function updates the source and destination addresses, so the transfer
; can be continued easily by repeatingly calling this function.
VBlankCopyDouble: ; 1e02 (0:1e02)
	ld a,[H_VBCOPYDOUBLESIZE]
	and a ; are there any bytes to copy?
	ret z
	ld hl,[sp + 0]
	ld a,h
	ld [H_SPTEMP],a
	ld a,l
	ld [H_SPTEMP + 1],a ; save stack pointer
	ld a,[H_VBCOPYDOUBLESRC]
	ld l,a
	ld a,[H_VBCOPYDOUBLESRC + 1]
	ld h,a
	ld sp,hl
	ld a,[H_VBCOPYDOUBLEDEST]
	ld l,a
	ld a,[H_VBCOPYDOUBLEDEST + 1]
	ld h,a
	ld a,[H_VBCOPYDOUBLESIZE]
	ld b,a
	xor a
	ld [H_VBCOPYDOUBLESIZE],a ; disable transfer so it doesn't continue next V-blank
.loop
	pop de
	ld [hl],e
	inc l
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	ld [hl],d
	inc hl
	dec b
	jr nz,.loop
	ld a,l
	ld [H_VBCOPYDOUBLEDEST],a
	ld a,h
	ld [H_VBCOPYDOUBLEDEST + 1],a ; update destination address
	ld hl,[sp + 0]
	ld a,l
	ld [H_VBCOPYDOUBLESRC],a
	ld a,h
	ld [H_VBCOPYDOUBLESRC + 1],a ; update source address
	ld a,[H_SPTEMP]
	ld h,a
	ld a,[H_SPTEMP + 1]
	ld l,a
	ld sp,hl ; restore stack pointer
	ret

; Copies ([H_VBCOPYSIZE] * 16) bytes from H_VBCOPYSRC to H_VBCOPYDEST.
; The function updates the source and destination addresses, so the transfer
; can be continued easily by repeatingly calling this function.
VBlankCopy: ; 1e5e (0:1e5e)
	ld a,[H_VBCOPYSIZE]
	and a ; are there any bytes to copy?
	ret z
	ld hl,[sp + 0]
	ld a,h
	ld [H_SPTEMP],a
	ld a,l
	ld [H_SPTEMP + 1],a ; save stack pointer
	ld a,[H_VBCOPYSRC]
	ld l,a
	ld a,[H_VBCOPYSRC + 1]
	ld h,a
	ld sp,hl
	ld a,[H_VBCOPYDEST]
	ld l,a
	ld a,[H_VBCOPYDEST + 1]
	ld h,a
	ld a,[H_VBCOPYSIZE]
	ld b,a
	xor a
	ld [H_VBCOPYSIZE],a ; disable transfer so it doesn't continue next V-blank
.loop
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc l
	pop de
	ld [hl],e
	inc l
	ld [hl],d
	inc hl
	dec b
	jr nz,.loop
	ld a,l
	ld [H_VBCOPYDEST],a
	ld a,h
	ld [H_VBCOPYDEST + 1],a
	ld hl,[sp + 0]
	ld a,l
	ld [H_VBCOPYSRC],a
	ld a,h
	ld [H_VBCOPYSRC + 1],a
	ld a,[H_SPTEMP]
	ld h,a
	ld a,[H_SPTEMP + 1]
	ld l,a
	ld sp,hl ; restore stack pointer
	ret

; This function updates the moving water and flower background tiles.
UpdateMovingBgTiles: ; 1ebe (0:1ebe)
	ld a,[$ffd7]
	and a
	ret z
	ld a,[$ffd8]
	inc a
	ld [$ffd8],a
	cp a,20
	ret c
	cp a,21
	jr z,.updateFlowerTile
	ld hl,$9140 ; water tile pattern VRAM location
	ld c,16 ; number of bytes in a tile pattern
	ld a,[$d085]
	inc a
	and a,$07
	ld [$d085],a
	and a,$04
	jr nz,.rotateWaterLeftLoop
.rotateWaterRightloop
	ld a,[hl]
	rrca
	ld [hli],a
	dec c
	jr nz,.rotateWaterRightloop
	jr .done
.rotateWaterLeftLoop
	ld a,[hl]
	rlca
	ld [hli],a
	dec c
	jr nz,.rotateWaterLeftLoop
.done
	ld a,[$ffd7]
	rrca
	ret nc
	xor a
	ld [$ffd8],a
	ret
.updateFlowerTile
	xor a
	ld [$ffd8],a
	ld a,[$d085]
	and a,$03
	cp a,2
	ld hl,FlowerTilePattern1
	jr c,.writeTilePatternToVram
	ld hl,FlowerTilePattern2
	jr z,.writeTilePatternToVram
	ld hl,FlowerTilePattern3
.writeTilePatternToVram
	ld de,$9030 ; flower tile pattern VRAM location
	ld c,16 ; number of bytes in a tile pattern
.flowerTileLoop
	ld a,[hli]
	ld [de],a
	inc de
	dec c
	jr nz,.flowerTileLoop
	ret

FlowerTilePattern1: ; 1f19 (0:1f19)
INCBIN "gfx/tilesets/flower/flower1.2bpp"

FlowerTilePattern2: ; 1f29 (0:1f29)
INCBIN "gfx/tilesets/flower/flower2.2bpp"

FlowerTilePattern3: ; 1f39 (0:1f39)
INCBIN "gfx/tilesets/flower/flower3.2bpp"

; known jump sources: c047 (3:4047)
SoftReset: ; 1f49 (0:1f49)
	call StopAllSounds
	call GBPalWhiteOut
	ld c, $20
	call DelayFrames
	;fall through

; 1f54 (0:1f54)
; initialization code
; explanation for %11100011 (value stored in rLCDC)
; * LCD enabled
; * Window tile map at $9C00
; * Window display enabled
; * BG and window tile data at $8800
; * BG tile map at $9800
; * 8x8 OBJ size
; * OBJ display enabled
; * BG display enabled
InitGame: ; 1f54 (0:1f54)
	di
; zero I/O registers
	xor a
	ld [$ff0f],a
	ld [$ffff],a
	ld [$ff43],a
	ld [$ff42],a
	ld [$ff01],a
	ld [$ff02],a
	ld [$ff4b],a
	ld [$ff4a],a
	ld [$ff06],a
	ld [$ff07],a
	ld [$ff47],a
	ld [$ff48],a
	ld [$ff49],a
	ld a,%10000000 ; enable LCD
	ld [rLCDC],a
	call DisableLCD ; why enable then disable?
	ld sp,$dfff ; initialize stack pointer
	ld hl,$c000 ; start of WRAM
	ld bc,$2000 ; size of WRAM
.zeroWramLoop
	ld [hl],0
	inc hl
	dec bc
	ld a,b
	or c
	jr nz,.zeroWramLoop
	call ZeroVram
	ld hl,$ff80
	ld bc,$007f
	call FillMemory ; zero HRAM
	call CleanLCD_OAM ; this is unnecessary since it was already cleared above
	ld a,$01
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call WriteDMACodeToHRAM ; copy DMA code to HRAM
	xor a
	ld [$ffd7],a
	ld [$ff41],a
	ld [$ffae],a
	ld [$ffaf],a
	ld [$ff0f],a
	ld a,%00001101 ; enable V-blank, timer, and serial interrupts
	ld [rIE],a
	ld a,$90 ; put the window off the screen
	ld [$ffb0],a
	ld [rWY],a
	ld a,$07
	ld [rWX],a
	ld a,$ff
	ld [$ffaa],a
	ld h,$98
	call ClearBgMap ; fill $9800-$9BFF (BG tile map) with $7F tiles
	ld h,$9c
	call ClearBgMap ; fill $9C00-$9FFF (Window tile map) with $7F tiles
	ld a,%11100011
	ld [rLCDC],a ; enabled LCD
	ld a,$10
	ld [H_SOFTRESETCOUNTER],a
	call StopAllSounds
	ei
	ld a,$40
	call Predef ; SGB border
	ld a,$1f
	ld [$c0ef],a
	ld [$c0f0],a
	ld a,$9c
	ld [$ffbd],a
	xor a
	ld [$ffbc],a
	dec a
	ld [$cfcb],a
	ld a,$32
	call Predef ; display the copyrights, GameFreak logo, and battle animation
	call DisableLCD
	call ZeroVram
	call GBPalNormal
	call CleanLCD_OAM
	ld a,%11100011
	ld [rLCDC],a ; enable LCD
	jp Func_42b7

; zeroes all VRAM
ZeroVram: ; 2004 (0:2004)
	ld hl,$8000
	ld bc,$2000
	xor a
	jp FillMemory

; known jump sources: 962 (0:962), 1f49 (0:1f49), 1fd0 (0:1fd0)
; immediately stops all sounds
StopAllSounds: ; 200e (0:200e)
	ld a, $2
	ld [$c0ef], a
	ld [$c0f0], a
	xor a
	ld [$cfc7], a
	ld [$c0ee], a
	ld [$cfca], a
	dec a
	jp PlaySound
; 2024 (0:2024)

VBlankHandler: ; 2024 (0:2024)
	push af
	push bc
	push de
	push hl
	ld a,[H_LOADEDROMBANK] ; current ROM bank
	ld [$d122],a
	ld a,[$ffae]
	ld [rSCX],a
	ld a,[$ffaf]
	ld [rSCY],a
	ld a,[$d0a0]
	and a
	jr nz,.doVramTransfers
	ld a,[$ffb0]
	ld [rWY],a
.doVramTransfers
	call AutoBgMapTransfer
	call VBlankCopyBgMap
	call RedrawExposedScreenEdge
	call VBlankCopy
	call VBlankCopyDouble
	call UpdateMovingBgTiles
	call $ff80 ; OAM DMA
	ld a,$01
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call PrepareOAMData ; update OAM buffer with current sprite data
	call GenRandom
	ld a,[H_VBLANKOCCURRED]
	and a
	jr z,.next
	xor a
	ld [H_VBLANKOCCURRED],a
.next
	ld a,[H_FRAMECOUNTER]
	and a
	jr z,.handleMusic
	dec a
	ld [H_FRAMECOUNTER],a
.handleMusic
	call Func_28cb
	ld a,[$c0ef] ; music ROM bank
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	cp a,$02
	jr nz,.checkIfBank08
.bank02
	call Func_9103
	jr .afterMusic
.checkIfBank08
	cp a,$08
	jr nz,.bank1F
.bank08
	call Func_2136e
	call Func_21879
	jr .afterMusic
.bank1F
	call Func_7d177
.afterMusic
	ld b, BANK(Func_18dee)
	ld hl, Func_18dee
	call Bankswitch ; keep track of time played
	ld a,[$fff9]
	and a
	call z,ReadJoypadRegister
	ld a,[$d122]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	pop hl
	pop de
	pop bc
	pop af
	reti

DelayFrame: ; 20af (0:20af)
; delay for one frame
	ld a,1
	ld [H_VBLANKOCCURRED],a

; wait for the next Vblank, halting to conserve battery
.halt
	db $76 ; XXX this is a hack--rgbasm adds a nop after this instr even when ints are enabled
	ld a,[H_VBLANKOCCURRED]
	and a
	jr nz,.halt

	ret

; These routines manage gradual fading
; (e.g., entering a doorway)
LoadGBPal: ; 20ba (0:20ba)
	ld a,[$d35d] ;tells if cur.map is dark (requires HM5_FLASH?)
	ld b,a
	ld hl,GBPalTable_00	;16
	ld a,l
	sub b
	ld l,a
	jr nc,.jr0
	dec h
.jr0
	ld a,[hli]
	ld [rBGP],a
	ld a,[hli]
	ld [rOBP0],a
	ld a,[hli]
	ld [rOBP1],a
	ret

GBFadeOut1: ; 20d1 (0:20d1)
	ld hl,IncGradGBPalTable_01	;0d
	ld b,$04
	jr GBFadeOutCommon

GBFadeOut2: ; 20d8 (0:20d8)
	ld hl,IncGradGBPalTable_02	;1c
	ld b,$03

GBFadeOutCommon: ; 20dd (0:20dd)
	ld a,[hli]
	ld [rBGP],a
	ld a,[hli]
	ld [rOBP0],a
	ld a,[hli]
	ld [rOBP1],a
	ld c,8
	call DelayFrames
	dec b
	jr nz,GBFadeOutCommon
	ret

GBFadeIn1: ; 20ef (0:20ef)
	ld hl,DecGradGBPalTable_01	;18
	ld b,$04
	jr GBFadeInCommon

GBFadeIn2: ; 20f6 (0:20f6)
	ld hl,DecGradGBPalTable_02	;21
	ld b,$03

GBFadeInCommon: ; 20fb (0:20fb)
	ld a,[hld]
	ld [rOBP1],a
	ld a,[hld]
	ld [rOBP0],a
	ld a,[hld]
	ld [rBGP],a
	ld c,8
	call DelayFrames
	dec b
	jr nz,GBFadeInCommon
	ret

IncGradGBPalTable_01: ; 210d (0:210d)
	db %11111111 ;BG Pal
	db %11111111 ;OBJ Pal 1
	db %11111111 ;OBJ Pal 2
	             ;and so on...
	db %11111110
	db %11111110
	db %11111000

	db %11111001
	db %11100100
	db %11100100
GBPalTable_00: ; 2116 (0:2116)
	db %11100100
	db %11010000
DecGradGBPalTable_01: ; 2118 (0:2118)
	db %11100000
	;19
	db %11100100
	db %11010000
	db %11100000
IncGradGBPalTable_02: ; 211c (0:211c)
	db %10010000
	db %10000000
	db %10010000

	db %01000000
	db %01000000
DecGradGBPalTable_02: ; 2121 (0:2121)
	db %01000000

	db %00000000
	db %00000000
	db %00000000

; known jump sources: 58 (0:58)
SerialInterruptHandler: ; 2125 (0:2125)
	push af
	push bc
	push de
	push hl
	ld a, [$FF00+$aa]
	inc a
	jr z, .asm_2142
	ld a, [$FF00+$1]
	ld [$FF00+$ad], a
	ld a, [$FF00+$ac]
	ld [$FF00+$1], a
	ld a, [$FF00+$aa]
	cp $2
	jr z, .asm_2162
	ld a, $80
	ld [$FF00+$2], a
	jr .asm_2162
.asm_2142
	ld a, [$FF00+$1]
	ld [$FF00+$ad], a
	ld [$FF00+$aa], a
	cp $2
	jr z, .asm_215f
	xor a
	ld [$FF00+$1], a
	ld a, $3
	ld [rDIV], a ; $FF00+$4
.asm_2153
	ld a, [rDIV] ; $FF00+$4
	bit 7, a
	jr nz, .asm_2153
	ld a, $80
	ld [$FF00+$2], a
	jr .asm_2162
.asm_215f
	xor a
	ld [$FF00+$1], a
.asm_2162
	ld a, $1
	ld [$FF00+$a9], a
	ld a, $fe
	ld [$FF00+$ac], a
	pop hl
	pop de
	pop bc
	pop af
	reti

; known jump sources: 53e2 (1:53e2), 53f1 (1:53f1), 5400 (1:5400)
Func_216f: ; 216f (0:216f)
	ld a, $1
	ld [$FF00+$ab], a
.asm_2173
	ld a, [hl]
	ld [$FF00+$ac], a
	call Func_219a
	push bc
	ld b, a
	inc hl
	ld a, $30
.asm_217e
	dec a
	jr nz, .asm_217e
	ld a, [$FF00+$ab]
	and a
	ld a, b
	pop bc
	jr z, .asm_2192
	dec hl
	cp $fd
	jr nz, .asm_2173
	xor a
	ld [$FF00+$ab], a
	jr .asm_2173
.asm_2192
	ld [de], a
	inc de
	dec bc
	ld a, b
	or c
	jr nz, .asm_2173
	ret

; known jump sources: 2176 (0:2176), 222e (0:222e), 2259 (0:2259)
Func_219a: ; 219a (0:219a)
	xor a
	ld [$FF00+$a9], a
	ld a, [$FF00+$aa]
	cp $2
	jr nz, .asm_21a7
	ld a, $81
	ld [$FF00+$2], a
.asm_21a7
	ld a, [$FF00+$a9]
	and a
	jr nz, .asm_21f1
	ld a, [$FF00+$aa]
	cp $1
	jr nz, .asm_21cc
	call Func_2237
	jr z, .asm_21cc
	call Func_2231
	push hl
	ld hl, $cc48
	inc [hl]
	jr nz, .asm_21c3
	dec hl
	inc [hl]
.asm_21c3
	pop hl
	call Func_2237
	jr nz, .asm_21a7
	jp Func_223f
.asm_21cc
	ld a, [rIE] ; $FF00+$ff
	and $f
	cp $8
	jr nz, .asm_21a7
	ld a, [W_NUMHITS] ; $d074
	dec a
	ld [W_NUMHITS], a ; $d074
	jr nz, .asm_21a7
	ld a, [$d075]
	dec a
	ld [$d075], a
	jr nz, .asm_21a7
	ld a, [$FF00+$aa]
	cp $1
	jr z, .asm_21f1
	ld a, $ff
.asm_21ee
	dec a
	jr nz, .asm_21ee
.asm_21f1
	xor a
	ld [$FF00+$a9], a
	ld a, [rIE] ; $FF00+$ff
	and $f
	sub $8
	jr nz, .asm_2204
	ld [W_NUMHITS], a ; $d074
	ld a, $50
	ld [$d075], a
.asm_2204
	ld a, [$FF00+$ad]
	cp $fe
	ret nz
	call Func_2237
	jr z, .asm_221f
	push hl
	ld hl, $cc48
	ld a, [hl]
	dec a
	ld [hld], a
	inc a
	jr nz, .asm_2219
	dec [hl]
.asm_2219
	pop hl
	call Func_2237
	jr z, Func_223f
.asm_221f
	ld a, [rIE] ; $FF00+$ff
	and $f
	cp $8
	ld a, $fe
	ret z
	ld a, [hl]
	ld [$FF00+$ac], a
	call DelayFrame
	jp Func_219a

; known jump sources: 21b7 (0:21b7)
Func_2231: ; 2231 (0:2231)
	ld a, $f
.asm_2233
	dec a
	jr nz, .asm_2233
	ret

; known jump sources: 21b2 (0:21b2), 21c4 (0:21c4), 2209 (0:2209), 221a (0:221a), 228a (0:228a)
Func_2237: ; 2237 (0:2237)
	push hl
	ld hl, $cc47
	ld a, [hli]
	or [hl]
	pop hl
	ret

; known jump sources: 21c9 (0:21c9), 221d (0:221d), 229c (0:229c)
Func_223f: ; 223f (0:223f)
	dec a
	ld [$cc47], a
	ld [$cc48], a
	ret

; known jump sources: 5c66 (1:5c66)
Func_2247: ; 2247 (0:2247)
	ld hl, $cc42
	ld de, $cc3d
	ld c, $2
	ld a, $1
	ld [$FF00+$ab], a
.asm_2253
	call DelayFrame
	ld a, [hl]
	ld [$FF00+$ac], a
	call Func_219a
	ld b, a
	inc hl
	ld a, [$FF00+$ab]
	and a
	ld a, $0
	ld [$FF00+$ab], a
	jr nz, .asm_2253
	ld a, b
	ld [de], a
	inc de
	dec c
	jr nz, .asm_2253
	ret

; no known jump sources (dead code?)
Func_226e: ; 226e (0:226e)
	call SaveScreenTilesToBuffer1
	ld hl, Func_4c05
	ld b, BANK(Func_4c05)
	call Bankswitch
	call Func_227f
	jp LoadScreenTilesFromBuffer1

; known jump sources: 53b5 (1:53b5), 7263 (1:7263)
Func_227f: ; 227f (0:227f)
	ld a, $ff
	ld [$cc3e], a
.asm_2284
	call Func_22c3
	call DelayFrame
	call Func_2237
	jr z, .asm_22a0
	push hl
	ld hl, $cc48
	dec [hl]
	jr nz, .asm_229f
	dec hl
	dec [hl]
	jr nz, .asm_229f
	pop hl
	xor a
	jp Func_223f
.asm_229f
	pop hl
.asm_22a0
	ld a, [$cc3e]
	inc a
	jr z, .asm_2284
	ld b, $a
.asm_22a8
	call DelayFrame
	call Func_22c3
	dec b
	jr nz, .asm_22a8
	ld b, $a
.asm_22b3
	call DelayFrame
	call Func_22ed
	dec b
	jr nz, .asm_22b3
	ld a, [$cc3e]
	ld [$cc3d], a
	ret

; known jump sources: 2284 (0:2284), 22ab (0:22ab), 3d63b (f:563b), 3d64c (f:564c)
Func_22c3: ; 22c3 (0:22c3)
	call asm_22d7
	ld a, [$cc42]
	add $60
	ld [$FF00+$ac], a
	ld a, [$FF00+$aa]
	cp $2
	jr nz, asm_22d7
	ld a, $81
	ld [$FF00+$2], a
asm_22d7: ; 22d7 (0:22d7)
	ld a, [$FF00+$ad]
	ld [$cc3d], a
	and $f0
	cp $60
	ret nz
	xor a
	ld [$FF00+$ad], a
	ld a, [$cc3d]
	and $f
	ld [$cc3e], a
	ret

; known jump sources: 22b6 (0:22b6), 721a (1:721a), 7220 (1:7220), 7276 (1:7276), 3d657 (f:5657)
Func_22ed: ; 22ed (0:22ed)
	xor a
	ld [$FF00+$ac], a
	ld a, [$FF00+$aa]
	cp $2
	ret nz
	ld a, $81
	ld [$FF00+$2], a
	ret

; known jump sources: 19c5b (6:5c5b), 4425d (11:425d), 488b8 (12:48b8), 492cf (12:52cf), 493ba (12:53ba), 5c587 (17:4587), 5c645 (17:4645), 5c8da (17:48da), 5c98f (17:498f), 5d535 (17:5535), 75063 (1d:5063), 75e2c (1d:5e2c)
Func_22fa: ; 22fa (0:22fa)
	ld a, $2
	ld [$FF00+$1], a
	xor a
	ld [$FF00+$ad], a
	ld a, $80
	ld [$FF00+$2], a
	ret

; timer interrupt is apparently not invoked anyway
TimerHandler: ; 2306 (0:2306)
	reti

; known jump sources: 100d (0:100d), 12f5 (0:12f5), d993 (3:5993), d9ae (3:59ae), d9da (3:59da), da22 (3:5a22), e234 (3:6234), 17daa (5:7daa), 19624 (6:5624), 1cbf4 (7:4bf4), 1ce82 (7:4e82), 1cf1b (7:4f1b), 1cfda (7:4fda), 1ebc9 (7:6bc9), 3aef3 (e:6ef3), 51165 (14:5165), 51d35 (14:5d35), 605cf (18:45cf), 614d2 (18:54d2), 61917 (18:5917), 70558 (1c:4558), 7bf61 (1e:7f61), 7d15f (1f:515f)
Func_2307: ; 2307 (0:2307)
	call WaitForSoundToFinish
	xor a
	ld c, a
	ld d, a
	ld [$cfca], a
	jr asm_2324

; known jump sources: 8b0 (0:8b0), 94b (0:94b), 12b2 (0:12b2)
Func_2312: ; 2312 (0:2312)
	ld c, $a
	ld d, $0
	ld a, [$d72e]
	bit 5, a
	jr z, asm_2324
	xor a
	ld [$cfca], a
	ld c, $8
	ld d, c
asm_2324: ; 2324 (0:2324)
	ld a, [$d700]
	and a
	jr z, .asm_2343
	cp $2
	jr z, .asm_2332
	ld a, $d2
	jr .asm_2334
.asm_2332
	ld a, $d6
.asm_2334
	ld b, a
	ld a, d
	and a
	ld a, $1f
	jr nz, .asm_233e
	ld [$c0ef], a
.asm_233e
	ld [$c0f0], a
	jr .asm_234c
.asm_2343
	ld a, [$d35b]
	ld b, a
	call Func_2385
	jr c, .asm_2351
.asm_234c
	ld a, [$cfca]
	cp b
	ret z
.asm_2351
	ld a, c
	ld [$cfc7], a
	ld a, b
	ld [$cfca], a
	ld [$c0ee], a
	jp PlaySound

; known jump sources: 12af (0:12af)
Func_235f: ; 235f (0:235f)
	ld a, [$c0ef]
	ld b, a
	cp $2
	jr nz, .checkForBank08
.bank02
	ld hl, Func_9103
	jr .asm_2378
.checkForBank08
	cp $8
	jr nz, .bank1F
.bank08
	ld hl, Func_21879
	jr .asm_2378
.bank1F
	ld hl, Func_7d177
.asm_2378
	ld c, $6
.asm_237a
	push bc
	push hl
	call Bankswitch
	pop hl
	pop bc
	dec c
	jr nz, .asm_237a
	ret

; known jump sources: 2347 (0:2347)
Func_2385: ; 2385 (0:2385)
	ld a, [$d35c]
	ld e, a
	ld a, [$c0ef]
	cp e
	jr nz, .asm_2394
	ld [$c0f0], a
	and a
	ret
.asm_2394
	ld a, c
	and a
	ld a, e
	jr nz, .asm_239c
	ld [$c0ef], a
.asm_239c
	ld [$c0f0], a
	scf
	ret

PlayMusic: ; 23a1 (0:23a1)
	ld b, a
	ld [$c0ee], a
	xor a
	ld [$cfc7], a
	ld a, c
	ld [$c0ef], a
	ld [$c0f0], a
	ld a, b

; plays music specified by a. If value is $ff, music is stopped
PlaySound: ; 23b1 (0:23b1)
	push hl
	push de
	push bc
	ld b, a
	ld a, [$c0ee]
	and a
	jr z, .asm_23c8
	xor a
	ld [$c02a], a
	ld [$c02b], a
	ld [$c02c], a
	ld [$c02d], a
.asm_23c8
	ld a, [$cfc7]
	and a
	jr z, .asm_23e3
	ld a, [$c0ee]
	and a
	jr z, .asm_2425
	xor a
	ld [$c0ee], a
	ld a, [$cfca]
	cp $ff
	jr nz, .asm_2414
	xor a
	ld [$cfc7], a
.asm_23e3
	xor a
	ld [$c0ee], a
	ld a, [H_LOADEDROMBANK]
	ld [$FF00+$b9], a
	ld a, [$c0ef]
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	cp $2
	jr nz, .checkForBank08
.bank02
	ld a, b
	call Func_9876
	jr .asm_240b
.checkForBank08
	cp $8
	jr nz, .bank1F
.bank08
	ld a, b
	call Func_22035
	jr .asm_240b
.bank1F
	ld a, b
	call Func_7d8ea
.asm_240b
	ld a, [$FF00+$b9]
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	jr .asm_2425
.asm_2414
	ld a, b
	ld [$cfca], a
	ld a, [$cfc7]
	ld [$cfc8], a
	ld [$cfc9], a
	ld a, b
	ld [$cfc7], a
.asm_2425
	pop bc
	pop de
	pop hl
	ret

UpdateSprites: ; 2429 (0:2429)
	ld a, [$cfcb]
	dec a
	ret nz
	ld a, [H_LOADEDROMBANK]
	push af
	ld a, $1
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	call _UpdateSprites
	pop af
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ret
; 2442 (0:2442)

; mart inventories are below
; they are texts
; first byte $FE, next byte # of items, last byte $FF

; Viridian
ViridianMartText6: ; 2442 (0:2442)
	db $FE,4,POKE_BALL,ANTIDOTE,PARLYZ_HEAL,BURN_HEAL,$FF

; Pewter
PewterMartText1: ; 2449 (0:2449)
	db $FE,7,POKE_BALL,POTION,ESCAPE_ROPE,ANTIDOTE,BURN_HEAL,AWAKENING
	db PARLYZ_HEAL,$FF

; Cerulean
CeruleanMartText1: ; 2453 (0:2453)
	db $FE,7,POKE_BALL,POTION,REPEL,ANTIDOTE,BURN_HEAL,AWAKENING
	db PARLYZ_HEAL,$FF

; Bike shop
	db $FE,1,BICYCLE,$FF

; Vermilion
VermilionMartText1: ; 2461 (0:2461)
	db $FE,6,POKE_BALL,SUPER_POTION,ICE_HEAL,AWAKENING,PARLYZ_HEAL
	db REPEL,$FF

; Lavender
LavenderMartText1: ; 246a (0:246a)
	db $FE,9,GREAT_BALL,SUPER_POTION,REVIVE,ESCAPE_ROPE,SUPER_REPEL
	db ANTIDOTE,BURN_HEAL,ICE_HEAL,PARLYZ_HEAL,$FF

; Celadon Dept. Store 2F (1)
CeladonMart2Text1: ; 2476 (0:2476)
	db $FE,9,GREAT_BALL,SUPER_POTION,REVIVE,SUPER_REPEL,ANTIDOTE
	db BURN_HEAL,ICE_HEAL,AWAKENING,PARLYZ_HEAL,$FF

; Celadon Dept. Store 2F (2)
CeladonMart2Text2: ; 2482 (0:2482)
	db $FE,9,TM_32,TM_33,TM_02,TM_07,TM_37,TM_01,TM_05,TM_09,TM_17,$FF

; Celadon Dept. Store 4F
CeladonMart4Text1: ; 248e (0:248e)
	db $FE,5,POKE_DOLL,FIRE_STONE,THUNDER_STONE,WATER_STONE,LEAF_STONE,$FF

; Celadon Dept. Store 5F (1)
CeladonMart5Text3: ; 2496 (0:2496)
	db $FE,7,X_ACCURACY,GUARD_SPEC_,DIRE_HIT,X_ATTACK,X_DEFEND,X_SPEED
	db X_SPECIAL,$FF

; Celadon Dept. Store 5F (2)
CeladonMart5Text4: ; 24a0 (0:24a0)
	db $FE,5,HP_UP,PROTEIN,IRON,CARBOS,CALCIUM,$FF

; Fuchsia
FuchsiaMartText1: ; 24a8 (0:24a8)
	db $FE,6,ULTRA_BALL,GREAT_BALL,SUPER_POTION,REVIVE,FULL_HEAL
	db SUPER_REPEL,$FF

; unused? 24b1
	db $FE,5,GREAT_BALL,HYPER_POTION,SUPER_POTION,FULL_HEAL,REVIVE,$FF

; Cinnabar
CinnabarMartText1: ; 24b9 (0:24b9)
	db $FE,7,ULTRA_BALL,GREAT_BALL,HYPER_POTION,MAX_REPEL,ESCAPE_ROPE
	db FULL_HEAL,REVIVE,$FF

; Saffron
SaffronMartText1: ; 24c3 (0:24c3)
	db $FE,6,GREAT_BALL,HYPER_POTION,MAX_REPEL,ESCAPE_ROPE,FULL_HEAL
	db REVIVE,$FF

; Indigo
IndigoPlateauLobbyText4: ; 24cc (0:24cc)
	db $FE,7,ULTRA_BALL,GREAT_BALL,FULL_RESTORE,MAX_POTION,FULL_HEAL
	db REVIVE,MAX_REPEL,$FF

TextScriptEndingChar: ; 24d6 (0:24d6)
	db "@"
TextScriptEnd: ; 24d7 (0:24d7)
	ld hl,TextScriptEndingChar
	ret

UnnamedText_24db: ; 24db (0:24db)
	TX_FAR _UnnamedText_24db
	db "@"
; 0x24db + 5 bytes

UnnamedText_24e0: ; 24e0 (0:24e0)
	TX_FAR _UnnamedText_24e0
	db "@"
; 0x24e0 + 5 bytes

BoulderText: ; 24e5 (0:24e5)
	TX_FAR _BoulderText
	db "@"

MartSignText: ; 24ea (0:24ea)
	TX_FAR _MartSignText
	db "@"

PokeCenterSignText: ; 24ef (0:24ef)
	TX_FAR _PokeCenterSignText
	db "@"

Predef5CText: ; 24f4 (0:24f4)
; XXX better label (what does predef $5C do?)
	db $08 ; asm
	ld a, $5c
	call Predef
	jp TextScriptEnd

; bankswitches and runs _UncompressSpriteData
; bank is given in a, sprite input stream is pointed to in W_SPRITEINPUTPTR
UncompressSpriteData: ; 24fd (0:24fd)
	ld b, a
	ld a, [H_LOADEDROMBANK]
	push af
	ld a, b
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ld a, $a
	ld [$0], a
	xor a
	ld [$4000], a
	call _UncompressSpriteData
	pop af
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ret

; initializes necessary data to load a sprite and runs UncompressSpriteDataLoop
_UncompressSpriteData: ; 251a (0:251a)
	ld hl, S_SPRITEBUFFER1
	ld c, (2*SPRITEBUFFERSIZE) % $100
	ld b, (2*SPRITEBUFFERSIZE) / $100
	xor a
	call FillMemory           ; clear sprite buffer 1 and 2
	ld a, $1
	ld [W_SPRITEINPUTBITCOUNTER], a
	ld a, $3
	ld [W_SPRITEOUTPUTBITOFFSET], a
	xor a
	ld [W_SPRITECURPOSX], a
	ld [W_SPRITECURPOSY], a
	ld [W_SPRITELOADFLAGS], a ; $d0a8
	call ReadNextInputByte    ; first byte of input determines sprite width (high nybble) and height (low nybble) in tiles (8x8 pixels)
	ld b, a
	and $f
	add a
	add a
	add a
	ld [W_SPRITEHEIGHT], a
	ld a, b
	swap a
	and $f
	add a
	add a
	add a
	ld [W_SPRITEWITDH], a
	call ReadNextInputBit
	ld [W_SPRITELOADFLAGS], a ; initialite bit1 to 0 and bit0 to the first input bit
	                          ; this will load two chunks of data to S_SPRITEBUFFER1 and S_SPRITEBUFFER2
	                          ; bit 0 decides in which one the first chunk is placed
	; fall through

; uncompresses a chunk from the sprite input data stream (pointed to at $d0da) into S_SPRITEBUFFER1 or S_SPRITEBUFFER2
; each chunk is a 1bpp sprite. A 2bpp sprite consist of two chunks which are merged afterwards
; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack
UncompressSpriteDataLoop: ; 2556 (0:2556)
	ld hl, S_SPRITEBUFFER1
	ld a, [W_SPRITELOADFLAGS]  ; $d0a8
	bit 0, a
	jr z, .useSpriteBuffer1    ; check which buffer to use
	ld hl, S_SPRITEBUFFER2
.useSpriteBuffer1
	call StoreSpriteOutputPointer
	ld a, [W_SPRITELOADFLAGS]  ; $d0a8
	bit 1, a
	jr z, .startDecompression  ; check if last iteration
	call ReadNextInputBit      ; if last chunk, read 1-2 bit unpacking mode
	and a
	jr z, .unpackingMode0      ; 0   -> mode 0
	call ReadNextInputBit      ; 1 0 -> mode 1
	inc a                      ; 1 1 -> mode 2
.unpackingMode0
	ld [W_SPRITEUNPACKMODE], a
.startDecompression
	call ReadNextInputBit     
	and a
	jr z, .readRLEncodedZeros ; if first bit is 0, the input starts with zeroes, otherwise with (non-zero) input
.readNextInput
	call ReadNextInputBit
	ld c, a
	call ReadNextInputBit
	sla c
	or c                       ; read next two bits into c
	and a
	jr z, .readRLEncodedZeros ; 00 -> RLEncoded zeroes following
	call WriteSpriteBitsToBuffer  ; otherwise write input to output and repeat
	call MoveToNextBufferPosition
	jr .readNextInput
.readRLEncodedZeros
	ld c, $0                   ; number of zeroes it length encoded, the number
.countConsecutiveOnesLoop      ; of consecutive ones determines the number of bits the number has
	call ReadNextInputBit
	and a
	jr z, .countConsecutiveOnesFinished
	inc c
	jr .countConsecutiveOnesLoop
.countConsecutiveOnesFinished
	ld a, c
	add a
	ld hl, LengthEncodingOffsetList
	add l
	ld l, a
	jr nc, .noCarry
	inc h
.noCarry
	ld a, [hli]                ; read offset that is added to the number later on
	ld e, a                    ; adding an offset of 2^length - 1 makes every integer uniquely 
	ld d, [hl]                 ; representable in the length encoding and saves bits
	push de
	inc c
	ld e, $0
	ld d, e
.readNumberOfZerosLoop        ; reads the next c+1 bits of input
	call ReadNextInputBit
	or e
	ld e, a
	dec c
	jr z, .readNumberOfZerosDone
	sla e
	rl d
	jr .readNumberOfZerosLoop
.readNumberOfZerosDone
	pop hl                     ; add the offset
	add hl, de
	ld e, l
	ld d, h
.writeZerosLoop
	ld b, e
	xor a                      ; write 00 to buffer
	call WriteSpriteBitsToBuffer
	ld e, b
	call MoveToNextBufferPosition
	dec de
	ld a, d
	and a
	jr nz, .continueLoop
	ld a, e
	and a
.continueLoop
	jr nz, .writeZerosLoop
	jr .readNextInput

; moves output pointer to next position
; also cancels the calling function if the all output is done (by removing the return pointer from stack)
; and calls postprocessing functions according to the unpack mode
MoveToNextBufferPosition: ; 25d8 (0:25d8)
	ld a, [W_SPRITEHEIGHT]
	ld b, a
	ld a, [W_SPRITECURPOSY]
	inc a
	cp b
	jr z, .curColumnDone
	ld [W_SPRITECURPOSY], a
	ld a, [W_SPRITEOUTPUTPTR]
	inc a
	ld [W_SPRITEOUTPUTPTR], a
	ret nz
	ld a, [W_SPRITEOUTPUTPTR+1]
	inc a
	ld [W_SPRITEOUTPUTPTR+1], a
	ret
.curColumnDone
	xor a
	ld [W_SPRITECURPOSY], a
	ld a, [W_SPRITEOUTPUTBITOFFSET]
	and a
	jr z, .bitOffsetsDone
	dec a
	ld [W_SPRITEOUTPUTBITOFFSET], a
	ld hl, W_SPRITEOUTPUTPTRCACHED
	ld a, [hli]
	ld [W_SPRITEOUTPUTPTR], a
	ld a, [hl]
	ld [W_SPRITEOUTPUTPTR+1], a
	ret
.bitOffsetsDone
	ld a, $3
	ld [W_SPRITEOUTPUTBITOFFSET], a
	ld a, [W_SPRITECURPOSX]
	add $8
	ld [W_SPRITECURPOSX], a
	ld b, a
	ld a, [W_SPRITEWITDH]
	cp b
	jr z, .allColumnsDone
	ld a, [W_SPRITEOUTPUTPTR]
	ld l, a
	ld a, [W_SPRITEOUTPUTPTR+1]
	ld h, a
	inc hl
	jp StoreSpriteOutputPointer
.allColumnsDone
	pop hl
	xor a
	ld [W_SPRITECURPOSX], a
	ld a, [W_SPRITELOADFLAGS] ; $d0a8
	bit 1, a
	jr nz, .done            ; test if there is one more sprite to go
	xor $1
	set 1, a
	ld [W_SPRITELOADFLAGS], a ; $d0a8
	jp UncompressSpriteDataLoop
.done
	jp UnpackSprite

; writes 2 bits (from a) to the output buffer (pointed to from W_SPRITEOUTPUTPTR)
WriteSpriteBitsToBuffer: ; 2649 (0:2649)
	ld e, a
	ld a, [W_SPRITEOUTPUTBITOFFSET]
	and a
	jr z, .offset0
	cp $2
	jr c, .offset1
	jr z, .offset2
	rrc e ; offset 3
	rrc e
	jr .offset0
.offset1
	sla e
	sla e
	jr .offset0
.offset2
	swap e
.offset0
	ld a, [W_SPRITEOUTPUTPTR]
	ld l, a
	ld a, [W_SPRITEOUTPUTPTR+1]
	ld h, a
	ld a, [hl]
	or e
	ld [hl], a
	ret

; reads next bit from input stream and returns it in a
ReadNextInputBit: ; 2670 (0:2670)
	ld a, [W_SPRITEINPUTBITCOUNTER]
	dec a
	jr nz, .curByteHasMoreBitsToRead
	call ReadNextInputByte
	ld [W_SPRITEINPUTCURBYTE], a
	ld a, $8
.curByteHasMoreBitsToRead
	ld [W_SPRITEINPUTBITCOUNTER], a
	ld a, [W_SPRITEINPUTCURBYTE]
	rlca
	ld [W_SPRITEINPUTCURBYTE], a
	and $1
	ret

; reads next byte from input stream and returns it in a
ReadNextInputByte: ; 268b (0:268b)
	ld a, [W_SPRITEINPUTPTR]
	ld l, a
	ld a, [W_SPRITEINPUTPTR+1]
	ld h, a
	ld a, [hli]
	ld b, a
	ld a, l
	ld [W_SPRITEINPUTPTR], a
	ld a, h
	ld [W_SPRITEINPUTPTR+1], a
	ld a, b
	ret

; the nth item is 2^n - 1
LengthEncodingOffsetList: ; 269f (0:269f)
	dw $0001
	dw $0003
	dw $0007
	dw $000F
	dw $001F
	dw $003F
	dw $007F
	dw $00FF
	dw $01FF
	dw $03FF
	dw $07FF
	dw $0FFF
	dw $1FFF
	dw $3FFF
	dw $7FFF
	dw $FFFF

; unpacks the sprite data depending on the unpack mode
UnpackSprite: ; 26bf (0:26bf)
	ld a, [W_SPRITEUNPACKMODE]
	cp $2
	jp z, UnpackSpriteMode2
	and a
	jp nz, XorSpriteChunks
	ld hl, S_SPRITEBUFFER1
	call SpriteDifferentialDecode
	ld hl, S_SPRITEBUFFER2
	; fall through

; decodes differential encoded sprite data
; input bit value 0 preserves the current bit value and input bit value 1 toggles it (starting from initial value 0).
SpriteDifferentialDecode: ; 26d4 (0:26d4)
	xor a
	ld [W_SPRITECURPOSX], a
	ld [W_SPRITECURPOSY], a
	call StoreSpriteOutputPointer
	ld a, [W_SPRITEFLIPPED]
	and a
	jr z, .notFlipped
	ld hl, DecodeNybble0TableFlipped
	ld de, DecodeNybble1TableFlipped
	jr .storeDecodeTablesPointers
.notFlipped
	ld hl, DecodeNybble0Table
	ld de, DecodeNybble1Table
.storeDecodeTablesPointers
	ld a, l
	ld [W_SPRITEDECODETABLE0PTR], a
	ld a, h
	ld [W_SPRITEDECODETABLE0PTR+1], a
	ld a, e
	ld [W_SPRITEDECODETABLE1PTR], a
	ld a, d
	ld [W_SPRITEDECODETABLE1PTR+1], a
	ld e, $0                          ; last decoded nybble, initialized to 0
.decodeNextByteLoop
	ld a, [W_SPRITEOUTPUTPTR]
	ld l, a
	ld a, [W_SPRITEOUTPUTPTR+1]
	ld h, a
	ld a, [hl]
	ld b, a
	swap a
	and $f
	call DifferentialDecodeNybble     ; decode high nybble
	swap a
	ld d, a
	ld a, b
	and $f
	call DifferentialDecodeNybble     ; decode low nybble
	or d
	ld b, a
	ld a, [W_SPRITEOUTPUTPTR]
	ld l, a
	ld a, [W_SPRITEOUTPUTPTR+1]
	ld h, a
	ld a, b
	ld [hl], a                        ; write back decoded data
	ld a, [W_SPRITEHEIGHT]
	add l                             ; move on to next column
	jr nc, .noCarry
	inc h
.noCarry
	ld [W_SPRITEOUTPUTPTR], a
	ld a, h
	ld [W_SPRITEOUTPUTPTR+1], a
	ld a, [W_SPRITECURPOSX]
	add $8
	ld [W_SPRITECURPOSX], a
	ld b, a
	ld a, [W_SPRITEWITDH]
	cp b
	jr nz, .decodeNextByteLoop        ; test if current row is done
	xor a
	ld e, a
	ld [W_SPRITECURPOSX], a
	ld a, [W_SPRITECURPOSY]           ; move on to next row
	inc a
	ld [W_SPRITECURPOSY], a
	ld b, a
	ld a, [W_SPRITEHEIGHT]
	cp b
	jr z, .done                       ; test if all rows finished
	ld a, [W_SPRITEOUTPUTPTRCACHED]
	ld l, a
	ld a, [W_SPRITEOUTPUTPTRCACHED+1]
	ld h, a
	inc hl
	call StoreSpriteOutputPointer
	jr .decodeNextByteLoop
.done
	xor a
	ld [W_SPRITECURPOSY], a
	ret

; decodes the nybble stored in a. Last decoded data is assumed to be in e (needed to determine if initial value is 0 or 1)
DifferentialDecodeNybble: ; 276d (0:276d)
	srl a               ; c=a%2, a/=2
	ld c, $0
	jr nc, .evenNumber
	ld c, $1
.evenNumber
	ld l, a
	ld a, [W_SPRITEFLIPPED]
	and a
	jr z, .notFlipped     ; determine if initial value is 0 or one
	bit 3, e              ; if flipped, consider MSB of last data
	jr .selectLookupTable
.notFlipped
	bit 0, e              ; else consider LSB
.selectLookupTable
	ld e, l
	jr nz, .initialValue1 ; load the appropriate table
	ld a, [W_SPRITEDECODETABLE0PTR]
	ld l, a
	ld a, [W_SPRITEDECODETABLE0PTR+1]
	jr .tableLookup
.initialValue1
	ld a, [W_SPRITEDECODETABLE1PTR]
	ld l, a
	ld a, [W_SPRITEDECODETABLE1PTR+1]
.tableLookup
	ld h, a
	ld a, e
	add l
	ld l, a
	jr nc, .noCarry
	inc h
.noCarry
	ld a, [hl]
	bit 0, c
	jr nz, .selectLowNybble
	swap a  ; select high nybble
.selectLowNybble
	and $f
	ld e, a ; update last decoded data
	ret

DecodeNybble0Table: ; 27a7 (0:27a7)
	dn $0, $1
	dn $3, $2
	dn $7, $6
	dn $4, $5
	dn $f, $e
	dn $c, $d
	dn $8, $9
	dn $b, $a
DecodeNybble1Table: ; 27af (0:27af)
	dn $f, $e
	dn $c, $d
	dn $8, $9
	dn $b, $a
	dn $0, $1
	dn $3, $2
	dn $7, $6
	dn $4, $5
DecodeNybble0TableFlipped: ; 27b7 (0:27b7)
	dn $0, $8
	dn $c, $4
	dn $e, $6
	dn $2, $a
	dn $f, $7
	dn $3, $b
	dn $1, $9
	dn $d, $5
DecodeNybble1TableFlipped: ; 27bf (0:27bf)
	dn $f, $7
	dn $3, $b
	dn $1, $9
	dn $d, $5
	dn $0, $8
	dn $c, $4
	dn $e, $6
	dn $2, $a

; combines the two loaded chunks with xor (the chunk loaded second is the destination). The source chunk is differeintial decoded beforehand.
XorSpriteChunks: ; 27c7 (0:27c7)
	xor a
	ld [W_SPRITECURPOSX], a
	ld [W_SPRITECURPOSY], a
	call ResetSpriteBufferPointers
	ld a, [W_SPRITEOUTPUTPTR]          ; points to buffer 1 or 2, depending on flags
	ld l, a
	ld a, [W_SPRITEOUTPUTPTR+1]
	ld h, a
	call SpriteDifferentialDecode      ; decode buffer 1 or 2, depending on flags
	call ResetSpriteBufferPointers
	ld a, [W_SPRITEOUTPUTPTR]          ; source buffer, points to buffer 1 or 2, depending on flags
	ld l, a
	ld a, [W_SPRITEOUTPUTPTR+1]
	ld h, a
	ld a, [W_SPRITEOUTPUTPTRCACHED]    ; destination buffer, points to buffer 2 or 1, depending on flags
	ld e, a
	ld a, [W_SPRITEOUTPUTPTRCACHED+1]
	ld d, a
.xorChunksLoop
	ld a, [W_SPRITEFLIPPED]
	and a
	jr z, .notFlipped
	push de
	ld a, [de]
	ld b, a
	swap a
	and $f
	call ReverseNybble                 ; if flipped reverse the nybbles in the destination buffer
	swap a
	ld c, a
	ld a, b
	and $f
	call ReverseNybble
	or c
	pop de
	ld [de], a
.notFlipped
	ld a, [hli]
	ld b, a
	ld a, [de]
	xor b
	ld [de], a
	inc de
	ld a, [W_SPRITECURPOSY]
	inc a
	ld [W_SPRITECURPOSY], a             ; go to next row
	ld b, a
	ld a, [W_SPRITEHEIGHT]
	cp b
	jr nz, .xorChunksLoop               ; test if column finished
	xor a
	ld [W_SPRITECURPOSY], a
	ld a, [W_SPRITECURPOSX]
	add $8
	ld [W_SPRITECURPOSX], a             ; go to next column
	ld b, a
	ld a, [W_SPRITEWITDH]
	cp b
	jr nz, .xorChunksLoop               ; test if all columns finished
	xor a
	ld [W_SPRITECURPOSX], a
	ret

; reverses the bits in the nybble given in register a
ReverseNybble: ; 2837 (0:2837)
	ld de, NybbleReverseTable
	add e
	ld e, a
	jr nc, .asm_283f
	inc d
.asm_283f
	ld a, [de]
	ret

; resets sprite buffer pointers to buffer 1 and 2, depending on W_SPRITELOADFLAGS
ResetSpriteBufferPointers: ; 2841 (0:2841)
	ld a, [W_SPRITELOADFLAGS] ; $d0a8
	bit 0, a
	jr nz, .buffer2Selected
	ld de, S_SPRITEBUFFER1
	ld hl, S_SPRITEBUFFER2
	jr .storeBufferPointers
.buffer2Selected
	ld de, S_SPRITEBUFFER2
	ld hl, S_SPRITEBUFFER1
.storeBufferPointers
	ld a, l
	ld [W_SPRITEOUTPUTPTR], a
	ld a, h
	ld [W_SPRITEOUTPUTPTR+1], a
	ld a, e
	ld [W_SPRITEOUTPUTPTRCACHED], a
	ld a, d
	ld [W_SPRITEOUTPUTPTRCACHED+1], a
	ret

; maps each nybble to its reverse
NybbleReverseTable: ; 2867 (0:2867)
	db $0, $8, $4, $c, $2, $a, $6 ,$e, $1, $9, $5, $d, $3, $b, $7 ,$f

; combines the two loaded chunks with xor (the chunk loaded second is the destination). Both chunks are differeintial decoded beforehand.
UnpackSpriteMode2: ; 2877 (0:2877)
	call ResetSpriteBufferPointers
	ld a, [W_SPRITEFLIPPED]
	push af
	xor a
	ld [W_SPRITEFLIPPED], a            ; temporarily clear flipped flag for decoding the destination chunk
	ld a, [W_SPRITEOUTPUTPTRCACHED]
	ld l, a
	ld a, [W_SPRITEOUTPUTPTRCACHED+1]
	ld h, a
	call SpriteDifferentialDecode
	call ResetSpriteBufferPointers
	pop af
	ld [W_SPRITEFLIPPED], a
	jp XorSpriteChunks

; stores hl into the output pointers
StoreSpriteOutputPointer: ; 2897 (0:2897)
	ld a, l
	ld [W_SPRITEOUTPUTPTR], a
	ld [W_SPRITEOUTPUTPTRCACHED], a
	ld a, h
	ld [W_SPRITEOUTPUTPTR+1], a
	ld [W_SPRITEOUTPUTPTRCACHED+1], a
	ret

; known jump sources: 5d6e (1:5d6e), 6210 (1:6210)
ResetPlayerSpriteData: ; 28a6 (0:28a6)
	ld hl, $c100
	call ResetPlayerSpriteData_ClearSpriteData
	ld hl, $c200
	call ResetPlayerSpriteData_ClearSpriteData
	ld a, $1
	ld [$c100], a
	ld [$c20e], a
	ld hl, $c104
	ld [hl], $3c     ; set Y screen pos
	inc hl
	inc hl
	ld [hl], $40     ; set X screen pos
	ret

; known jump sources: 28a9 (0:28a9), 28af (0:28af)
; overwrites sprite data with zeroes
ResetPlayerSpriteData_ClearSpriteData: ; 28c4 (0:28c4)
	ld bc, $10
	xor a
	jp FillMemory

; known jump sources: 2071 (0:2071)
Func_28cb: ; 28cb (0:28cb)
	ld a, [$cfc7]
	and a
	jr nz, .asm_28dc
	ld a, [$d72c]
	bit 1, a
	ret nz
	ld a, $77
	ld [$FF00+$24], a
	ret
.asm_28dc
	ld a, [$cfc9]
	and a
	jr z, .asm_28e7
	dec a
	ld [$cfc9], a
	ret
.asm_28e7
	ld a, [$cfc8]
	ld [$cfc9], a
	ld a, [$FF00+$24]
	and a
	jr z, .asm_2903
	ld b, a
	and $f
	dec a
	ld c, a
	ld a, b
	and $f0
	swap a
	dec a
	swap a
	or c
	ld [$FF00+$24], a
	ret
.asm_2903
	ld a, [$cfc7]
	ld b, a
	xor a
	ld [$cfc7], a
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld a, [$c0f0]
	ld [$c0ef], a
	ld a, b
	ld [$c0ee], a
	jp PlaySound

; 2920 (0:2920)
; this function is used to display sign messages, sprite dialog, etc.
; INPUT: [$ff8c] = sprite ID or text ID
DisplayTextID: ; 2920 (0:2920)
	ld a,[H_LOADEDROMBANK]
	push af
	ld b,BANK(DisplayTextIDInit)
	ld hl,DisplayTextIDInit ; initialization
	call Bankswitch
	ld hl,$cf11
	bit 0,[hl]
	res 0,[hl]
	jr nz,.skipSwitchToMapBank
	ld a,[W_CURMAP]
	call SwitchToMapRomBank
.skipSwitchToMapBank
	ld a,30 ; half a second
	ld [H_FRAMECOUNTER],a ; used as joypad poll timer
	ld hl,W_MAPTEXTPTR
	ld a,[hli]
	ld h,[hl]
	ld l,a ; hl = map text pointer
	ld d,$00
	ld a,[$ff8c] ; text ID
	ld [$cf13],a
	and a
	jp z,DisplayStartMenu
	cp a,$d3 ; safari game over
	jp z,DisplaySafariGameOverText
	cp a,$d0 ; fainted
	jp z,DisplayPokemonFaintedText
	cp a,$d1 ; blacked out
	jp z,DisplayPlayerBlackedOutText
	cp a,$d2 ; repel wore off
	jp z,DisplayRepelWoreOffText
	ld a,[$d4e1] ; number of sprites
	ld e,a
	ld a,[$ff8c] ; sprite ID
	cp e
	jr z,.spriteHandling
	jr nc,.skipSpriteHandling
.spriteHandling
; get the text ID of the sprite
	push hl
	push de
	push bc
	ld b, BANK(Func_13074)
	ld hl, Func_13074
	call Bankswitch ; update the graphics of the sprite the player is talking to (to face the right direction)
	pop bc
	pop de
	ld hl,W_MAPSPRITEDATA ; NPC text entries
	ld a,[$ff8c]
	dec a
	add a
	add l
	ld l,a
	jr nc,.noCarry
	inc h
.noCarry
	inc hl
	ld a,[hl] ; a = text ID of the sprite
	pop hl
.skipSpriteHandling
; look up the address of the text in the map's text entries
	dec a
	ld e,a
	sla e
	add hl,de
	ld a,[hli]
	ld h,[hl]
	ld l,a ; hl = address of the text
	ld a,[hl] ; a = first byte of text
; check first byte of text for special cases
	cp a,$fe   ; Pokemart NPC
	jp z,DisplayPokemartDialogue
	cp a,$ff   ; Pokemon Center NPC
	jp z,DisplayPokemonCenterDialogue
	cp a,$fc   ; Item Storage PC
	jp z,FuncTX_ItemStoragePC
	cp a,$fd   ; Bill's PC
	jp z,FuncTX_BillsPC
	cp a,$f9   ; Pokemon Center PC
	jp z,FuncTX_PokemonCenterPC
	cp a,$f5   ; Vending Machine
	jr nz,.notVendingMachine
	ld b,BANK(Unknown_74ee0)
	ld hl,Unknown_74ee0
	call Bankswitch
	jr AfterDisplayingTextID
.notVendingMachine
	cp a,$f7   ; slot machine
	jp z,FuncTX_SlotMachine
	cp a,$f6   ; cable connection NPC in Pokemon Center
	jr nz,.notSpecialCase
	ld hl, Unknown_71c5
	ld b, BANK(Unknown_71c5)
	call Bankswitch
	jr AfterDisplayingTextID
.notSpecialCase
	call Func_3c59 ; display the text
	ld a,[$cc3c]
	and a
	jr nz,HoldTextDisplayOpen

AfterDisplayingTextID: ; 29d6 (0:29d6)
	ld a,[$cc47]
	and a
	jr nz,HoldTextDisplayOpen
	call WaitForTextScrollButtonPress ; wait for a button press after displaying all the text

; loop to hold the dialogue box open as long as the player keeps holding down the A button
HoldTextDisplayOpen: ; 29df (0:29df)
	call GetJoypadState
	ld a,[H_CURRENTPRESSEDBUTTONS]
	bit 0,a ; is the A button being pressed?
	jr nz,HoldTextDisplayOpen

CloseTextDisplay: ; 29e8 (0:29e8)
	ld a,[W_CURMAP]
	call SwitchToMapRomBank
	ld a,$90
	ld [$ffb0],a ; move the window off the screen
	call DelayFrame
	call LoadGBPal
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a ; disable continuous WRAM to VRAM transfer each V-blank
; loop to make sprites face the directions they originally faced before the dialogue
	ld hl,$c219
	ld c,$0f
	ld de,$0010
.restoreSpriteFacingDirectionLoop
	ld a,[hl]
	dec h
	ld [hl],a
	inc h
	add hl,de
	dec c
	jr nz,.restoreSpriteFacingDirectionLoop
	ld a,BANK(InitMapSprites)
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns)
	ld hl,$cfc4
	res 0,[hl]
	ld a,[$d732]
	bit 3,a
	call z,LoadPlayerSpriteGraphics
	call LoadCurrentMapView
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	jp UpdateSprites ; move sprites

DisplayPokemartDialogue: ; 2a2e (0:2a2e)
	push hl
	ld hl,PokemartGreetingText
	call PrintText
	pop hl
	inc hl
	call LoadItemList
	ld a,$02
	ld [$cf94],a ; selects between subtypes of menus
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,$01
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call DisplayPokemartDialogue_
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	jp AfterDisplayingTextID

PokemartGreetingText: ; 2a55 (0:2a55)
	TX_FAR _PokemartGreetingText
	db $50

LoadItemList: ; 2a5a (0:2a5a)
	ld a,$01
	ld [$cfcb],a
	ld a,h
	ld [$d128],a
	ld a,l
	ld [$d129],a
	ld de,$cf7b
.loop
	ld a,[hli]
	ld [de],a
	inc de
	cp a,$ff
	jr nz,.loop
	ret

DisplayPokemonCenterDialogue: ; 2a72 (0:2a72)
	xor a
	ld [$ff8b],a
	ld [$ff8c],a
	ld [$ff8d],a
	inc hl
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,$01
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call DisplayPokemonCenterDialogue_
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	jp AfterDisplayingTextID

DisplaySafariGameOverText: ; 2a90 (0:2a90)
	ld hl, Func_1e9ed
	ld b, BANK(Func_1e9ed)
	call Bankswitch
	jp AfterDisplayingTextID

DisplayPokemonFaintedText: ; 2a9b (0:2a9b)
	ld hl,PokemonFaintedText
	call PrintText
	jp AfterDisplayingTextID

PokemonFaintedText: ; 2aa4 (0:2aa4)
	TX_FAR _PokemonFaintedText
	db $50

DisplayPlayerBlackedOutText: ; 2aa9 (0:2aa9)
	ld hl,PlayerBlackedOutText
	call PrintText
	ld a,[$d732]
	res 5,a
	ld [$d732],a
	jp HoldTextDisplayOpen

PlayerBlackedOutText: ; 2aba (0:2aba)
	TX_FAR _PlayerBlackedOutText
	db $50

DisplayRepelWoreOffText: ; 2abf (0:2abf)
	ld hl,RepelWoreOffText
	call PrintText
	jp AfterDisplayingTextID

RepelWoreOffText: ; 2ac8 (0:2ac8)
	TX_FAR _RepelWoreOffText
	db $50

DisplayStartMenu: ; 2acd (0:2acd)
	ld a,$04
	ld [H_LOADEDROMBANK],a
	ld [$2000],a ; ROM bank 4
	ld a,[$d700] ; walking/biking/surfing
	ld [$d11a],a
	ld a,$8f ; Start menu sound
	call PlaySound

RedisplayStartMenu: ; 2adf (0:2adf)
	ld b,BANK(DrawStartMenu)
	ld hl,DrawStartMenu
	call Bankswitch
	ld b, BANK(Func_c52f)
	ld hl, Func_c52f
	call Bankswitch ; print Safari Zone info, if in Safari Zone
	call UpdateSprites ; move sprites
.loop
	call HandleMenuInput
	ld b,a
.checkIfUpPressed
	bit 6,a ; was Up pressed?
	jr z,.checkIfDownPressed
	ld a,[W_CURMENUITEMID] ; menu selection
	and a
	jr nz,.loop
	ld a,[W_OLDMENUITEMID]
	and a
	jr nz,.loop
; if the player pressed tried to go past the top item, wrap around to the bottom
	ld a,[$d74b]
	bit 5,a ; does the player have the pokedex?
	ld a,6 ; there are 7 menu items with the pokedex, so the max index is 6
	jr nz,.wrapMenuItemId
	dec a ; there are only 6 menu items without the pokedex
.wrapMenuItemId
	ld [W_CURMENUITEMID],a
	call EraseMenuCursor
	jr .loop
.checkIfDownPressed
	bit 7,a
	jr z,.buttonPressed
; if the player pressed tried to go past the bottom item, wrap around to the top
	ld a,[$d74b]
	bit 5,a ; does the player have the pokedex?
	ld a,[W_CURMENUITEMID]
	ld c,7 ; there are 7 menu items with the pokedex
	jr nz,.checkIfPastBottom
	dec c ; there are only 6 menu items without the pokedex
.checkIfPastBottom
	cp c
	jr nz,.loop
; the player went past the bottom, so wrap to the top
	xor a
	ld [W_CURMENUITEMID],a
	call EraseMenuCursor
	jr .loop
.buttonPressed ; A, B, or Start button pressed
	call PlaceUnfilledArrowMenuCursor
	ld a,[W_CURMENUITEMID]
	ld [$cc2d],a ; save current menu item ID
	ld a,b
	and a,%00001010 ; was the Start button or B button pressed?
	jp nz,CloseStartMenu
	call SaveScreenTilesToBuffer2 ; copy background from W_SCREENTILESBUFFER to W_SCREENTILESBACKBUFFER2
	ld a,[$d74b]
	bit 5,a ; does the player have the pokedex?
	ld a,[W_CURMENUITEMID]
	jr nz,.displayMenuItem
	inc a ; adjust position to account for missing pokedex menu item
.displayMenuItem
	cp a,0
	jp z,StartMenu_Pokedex
	cp a,1
	jp z,StartMenu_Pokemon
	cp a,2
	jp z,StartMenu_Item
	cp a,3
	jp z,StartMenu_TrainerInfo
	cp a,4
	jp z,StartMenu_SaveReset
	cp a,5
	jp z,StartMenu_Option

; EXIT falls through to here
CloseStartMenu: ; 2b70 (0:2b70)
	call GetJoypadState
	ld a,[H_NEWLYPRESSEDBUTTONS]
	bit 0,a ; was A button newly pressed?
	jr nz,CloseStartMenu
	call LoadTextBoxTilePatterns
	jp CloseTextDisplay

; function to count how many bits are set in a string of bytes
; INPUT:
; hl = address of string of bytes
; b = length of string of bytes
; OUTPUT:
; [$D11E] = number of set bits
CountSetBits: ; 2b7f (0:2b7f)
	ld c,0
.loop
	ld a,[hli]
	ld e,a
	ld d,8
.innerLoop ; count how many bits are set in the current byte
	srl e
	ld a,0
	adc c
	ld c,a
	dec d
	jr nz,.innerLoop
	dec b
	jr nz,.loop
	ld a,c
	ld [$d11e],a ; store number of set bits
	ret

; subtracts the amount the player paid from their money
; sets carry flag if there is enough money and unsets carry flag if not
SubtractAmountPaidFromMoney: ; 2b96 (0:2b96)
	ld b,BANK(SubtractAmountPaidFromMoney_)
	ld hl,SubtractAmountPaidFromMoney_
	jp Bankswitch

; adds the amount the player sold to their money
AddAmountSoldToMoney: ; 2b9e (0:2b9e)
	ld de,W_PLAYERMONEY1
	ld hl,$ffa1 ; total price of items
	ld c,3 ; length of money in bytes
	ld a,$0b
	call Predef ; add total price to money
	ld a,$13
	ld [$d125],a
	call DisplayTextBoxID ; redraw money text box
	ld a,$b2
	call PlaySoundWaitForCurrent ; play sound
	jp WaitForSoundToFinish ; wait until sound is done playing

; function to remove an item (in varying quantities) from the player's bag or PC box
; INPUT:
; HL = address of inventory (either W_NUMBAGITEMS or W_NUMBOXITEMS)
; [$CF92] = index (within the inventory) of the item to remove
; [$CF96] = quantity to remove
RemoveItemFromInventory: ; 2bbb (0:2bbb)
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,BANK(RemoveItemFromInventory_)
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call RemoveItemFromInventory_
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; function to add an item (in varying quantities) to the player's bag or PC box
; INPUT:
; HL = address of inventory (either W_NUMBAGITEMS or W_NUMBOXITEMS)
; [$CF91] = item ID
; [$CF96] = item quantity
; sets carry flag if successful, unsets carry flag if unsuccessful
AddItemToInventory: ; 2bcf (0:2bcf)
	push bc
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,BANK(AddItemToInventory_)
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call AddItemToInventory_
	pop bc
	ld a,b
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	pop bc
	ret

; INPUT:
; [W_LISTMENUID] = list menu ID
; [$cf8b] = address of the list (2 bytes)
DisplayListMenuID: ; 2be6 (0:2be6)
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer
	ld a,1
	ld [$ffb7],a ; joypad state update flag
	ld a,[W_BATTLETYPE]
	and a ; is it the Old Man battle?
	jr nz,.specialBattleType
	ld a,$01
	jr .bankswitch
.specialBattleType ; Old Man battle
	ld a,$0f
.bankswitch
	call BankswitchHome
	ld hl,$d730
	set 6,[hl] ; turn off letter printing delay
	xor a
	ld [$cc35],a ; 0 means no item is currently being swapped
	ld [$d12a],a
	ld a,[$cf8b]
	ld l,a
	ld a,[$cf8c]
	ld h,a ; hl = address of the list
	ld a,[hl]
	ld [$d12a],a ; [$d12a] = number of list entries
	ld a,$0d ; list menu text box ID
	ld [$d125],a
	call DisplayTextBoxID ; draw the menu text box
	call UpdateSprites ; move sprites
	FuncCoord 4,2 ; coordinates of upper left corner of menu text box
	ld hl,Coord
	ld de,$090e ; height and width of menu text box
	ld a,[W_LISTMENUID]
	and a ; is it a PC pokemon list?
	jr nz,.skipMovingSprites
	call UpdateSprites ; move sprites
.skipMovingSprites
	ld a,1 ; max menu item ID is 1 if the list has less than 2 entries
	ld [$cc37],a
	ld a,[$d12a]
	cp a,2 ; does the list have less than 2 entries?
	jr c,.setMenuVariables
	ld a,2 ; max menu item ID is 2 if the list has at least 2 entries
.setMenuVariables
	ld [W_MAXMENUITEMID],a
	ld a,4
	ld [W_TOPMENUITEMY],a
	ld a,5
	ld [W_TOPMENUITEMX],a
	ld a,%00000111 ; A button, B button, Select button
	ld [W_MENUWATCHEDKEYS],a
	ld c,10
	call DelayFrames

DisplayListMenuIDLoop: ; 2c53 (0:2c53)
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a ; disable transfer
	call PrintListMenuEntries
	ld a,1
	ld [H_AUTOBGTRANSFERENABLED],a ; enable transfer
	call Delay3
	ld a,[W_BATTLETYPE]
	and a ; is it the Old Man battle?
	jr z,.notOldManBattle
.oldManBattle
	ld a,"▶"
	FuncCoord 5,4
	ld [Coord],a ; place menu cursor in front of first menu entry
	ld c,80
	call DelayFrames
	xor a
	ld [W_CURMENUITEMID],a
	ld hl,Coord
	ld a,l
	ld [W_MENUCURSORLOCATION],a
	ld a,h
	ld [W_MENUCURSORLOCATION + 1],a
	jr .buttonAPressed
.notOldManBattle
	call LoadGBPal
	call HandleMenuInput
	push af
	call PlaceMenuCursor
	pop af
	bit 0,a ; was the A button pressed?
	jp z,.checkOtherKeys
.buttonAPressed
	ld a,[W_CURMENUITEMID]
	call PlaceUnfilledArrowMenuCursor
	ld a,$01
	ld [$d12e],a
	ld [$d12d],a
	xor a
	ld [$cc37],a
	ld a,[W_CURMENUITEMID]
	ld c,a
	ld a,[W_LISTSCROLLOFFSET]
	add c
	ld c,a
	ld a,[$d12a] ; number of list entries
	and a ; is the list empty?
	jp z,ExitListMenu ; if so, exit the menu
	dec a
	cp c ; did the player select Cancel?
	jp c,ExitListMenu ; if so, exit the menu
	ld a,c
	ld [$cf92],a
	ld a,[W_LISTMENUID]
	cp a,ITEMLISTMENU
	jr nz,.skipMultiplying
; if it's an item menu
	sla c ; item entries are 2 bytes long, so multiply by 2
.skipMultiplying
	ld a,[$cf8b]
	ld l,a
	ld a,[$cf8c]
	ld h,a
	inc hl ; hl = beginning of list entries
	ld b,0
	add hl,bc
	ld a,[hl]
	ld [$cf91],a
	ld a,[W_LISTMENUID]
	and a ; is it a PC pokemon list?
	jr z,.pokemonList
	push hl
	call GetItemPrice
	pop hl
	ld a,[W_LISTMENUID]
	cp a,ITEMLISTMENU
	jr nz,.skipGettingQuantity
; if it's an item menu
	inc hl
	ld a,[hl] ; a = item quantity
	ld [$cf97],a
.skipGettingQuantity
	ld a,[$cf91]
	ld [$d0b5],a
	ld a,$01
	ld [$d0b7],a
	call GetName
	jr .storeChosenEntry
.pokemonList
	ld hl,W_NUMINPARTY
	ld a,[$cf8b]
	cp l ; is it a list of party pokemon or box pokemon?
	ld hl,W_PARTYMON1NAME
	jr z,.getPokemonName
	ld hl,$de06 ; box pokemon names
.getPokemonName
	ld a,[$cf92]
	call GetPartyMonName
.storeChosenEntry ; store the menu entry that the player chose and return
	ld de,$cd6d
	call CopyStringToCF4B ; copy name to $cf4b
	ld a,$01
	ld [$d12e],a
	ld a,[W_CURMENUITEMID]
	ld [$d12d],a
	xor a
	ld [$ffb7],a ; joypad state update flag
	ld hl,$d730
	res 6,[hl] ; turn on letter printing delay
	jp BankswitchBack
.checkOtherKeys ; check B, SELECT, Up, and Down keys
	bit 1,a ; was the B button pressed?
	jp nz,ExitListMenu ; if so, exit the menu
	bit 2,a ; was the select button pressed?
	jp nz,HandleItemListSwapping ; if so, allow the player to swap menu entries
	ld b,a
	bit 7,b ; was Down pressed?
	ld hl,W_LISTSCROLLOFFSET
	jr z,.upPressed
.downPressed
	ld a,[hl]
	add a,3
	ld b,a
	ld a,[$d12a] ; number of list entries
	cp b ; will going down scroll past the Cancel button?
	jp c,DisplayListMenuIDLoop
	inc [hl] ; if not, go down
	jp DisplayListMenuIDLoop
.upPressed
	ld a,[hl]
	and a
	jp z,DisplayListMenuIDLoop
	dec [hl]
	jp DisplayListMenuIDLoop

DisplayChooseQuantityMenu: ; 2d57 (0:2d57)
; text box dimensions/coordinates for just quantity
	FuncCoord 15,9
	ld hl,Coord
	ld b,1 ; height
	ld c,3 ; width
	ld a,[W_LISTMENUID]
	cp a,PRICEDITEMLISTMENU
	jr nz,.drawTextBox
; text box dimensions/coordinates for quantity and price
	FuncCoord 7,9
	ld hl,Coord
	ld b,1  ; height
	ld c,11 ; width
.drawTextBox
	call TextBoxBorder
	FuncCoord 16,10
	ld hl,Coord
	ld a,[W_LISTMENUID]
	cp a,PRICEDITEMLISTMENU
	jr nz,.printInitialQuantity
	FuncCoord 8,10
	ld hl,Coord
.printInitialQuantity
	ld de,InitialQuantityText
	call PlaceString
	xor a
	ld [$cf96],a ; initialize current quantity to 0
	jp .incrementQuantity
.waitForKeyPressLoop
	call GetJoypadStateLowSensitivity
	ld a,[H_NEWLYPRESSEDBUTTONS] ; newly pressed buttons
	bit 0,a ; was the A button pressed?
	jp nz,.buttonAPressed
	bit 1,a ; was the B button pressed?
	jp nz,.buttonBPressed
	bit 6,a ; was Up pressed?
	jr nz,.incrementQuantity
	bit 7,a ; was Down pressed?
	jr nz,.decrementQuantity
	jr .waitForKeyPressLoop
.incrementQuantity
	ld a,[$cf97] ; max quantity
	inc a
	ld b,a
	ld hl,$cf96 ; current quantity
	inc [hl]
	ld a,[hl]
	cp b
	jr nz,.handleNewQuantity
; wrap to 1 if the player goes above the max quantity
	ld a,1
	ld [hl],a
	jr .handleNewQuantity
.decrementQuantity
	ld hl,$cf96 ; current quantity
	dec [hl]
	jr nz,.handleNewQuantity
; wrap to the max quantity if the player goes below 1
	ld a,[$cf97] ; max quantity
	ld [hl],a
.handleNewQuantity
	FuncCoord 17,10
	ld hl,Coord
	ld a,[W_LISTMENUID]
	cp a,PRICEDITEMLISTMENU
	jr nz,.printQuantity
.printPrice
	ld c,$03
	ld a,[$cf96]
	ld b,a
	ld hl,$ff9f ; total price
; initialize total price to 0
	xor a
	ld [hli],a
	ld [hli],a
	ld [hl],a
.addLoop ; loop to multiply the individual price by the quantity to get the total price
	ld de,$ffa1
	ld hl,$ff8d
	push bc
	ld a,$0b
	call Predef ; add the individual price to the current sum
	pop bc
	dec b
	jr nz,.addLoop
	ld a,[$ff8e]
	and a ; should the price be halved (for selling items)?
	jr z,.skipHalvingPrice
	xor a
	ld [$ffa2],a
	ld [$ffa3],a
	ld a,$02
	ld [$ffa4],a
	ld a,$0d
	call Predef ; halves the price
; store the halved price
	ld a,[$ffa2]
	ld [$ff9f],a
	ld a,[$ffa3]
	ld [$ffa0],a
	ld a,[$ffa4]
	ld [$ffa1],a
.skipHalvingPrice
	FuncCoord 12,10
	ld hl,Coord
	ld de,SpacesBetweenQuantityAndPriceText
	call PlaceString
	ld de,$ff9f ; total price
	ld c,$a3
	call PrintBCDNumber
	FuncCoord 9,10
	ld hl,Coord
.printQuantity
	ld de,$cf96 ; current quantity
	ld bc,$8102 ; print leading zeroes, 1 byte, 2 digits
	call PrintNumber
	jp .waitForKeyPressLoop
.buttonAPressed ; the player chose to make the transaction
	xor a
	ld [$cc35],a ; 0 means no item is currently being swapped
	ret
.buttonBPressed ; the player chose to cancel the transaction
	xor a
	ld [$cc35],a ; 0 means no item is currently being swapped
	ld a,$ff
	ret

InitialQuantityText: ; 2e30 (0:2e30)
	db "×01@"

SpacesBetweenQuantityAndPriceText: ; 2e34 (0:2e34)
	db "      @"

ExitListMenu: ; 2e3b (0:2e3b)
	ld a,[W_CURMENUITEMID]
	ld [$d12d],a
	ld a,$02
	ld [$d12e],a
	ld [$cc37],a
	xor a
	ld [$ffb7],a
	ld hl,$d730
	res 6,[hl]
	call BankswitchBack
	xor a
	ld [$cc35],a ; 0 means no item is currently being swapped
	scf
	ret

PrintListMenuEntries: ; 2e5a (0:2e5a)
	FuncCoord 5, 3 ; $c3e1
	ld hl,Coord
	ld b,$09
	ld c,$0e
	call ClearScreenArea
	ld a,[$cf8b]
	ld e,a
	ld a,[$cf8c]
	ld d,a
	inc de ; de = beginning of list entries
	ld a,[W_LISTSCROLLOFFSET]
	ld c,a
	ld a,[W_LISTMENUID]
	cp a,ITEMLISTMENU
	ld a,c
	jr nz,.skipMultiplying
; if it's an item menu
; item entries are 2 bytes long, so multiply by 2
	sla a
	sla c
.skipMultiplying
	add e
	ld e,a
	jr nc,.noCarry
	inc d
.noCarry
	FuncCoord 6,4 ; coordinates of first list entry name
	ld hl,Coord
	ld b,4 ; print 4 names
.loop
	ld a,b
	ld [$cf92],a
	ld a,[de]
	ld [$d11e],a
	cp a,$ff
	jp z,.printCancelMenuItem
	push bc
	push de
	push hl
	push hl
	push de
	ld a,[W_LISTMENUID]
	and a
	jr z,.pokemonPCMenu
	cp a,$01
	jr z,.movesMenu
.itemMenu
	call GetItemName
	jr .placeNameString
.pokemonPCMenu
	push hl
	ld hl,W_NUMINPARTY
	ld a,[$cf8b]
	cp l ; is it a list of party pokemon or box pokemon?
	ld hl,W_PARTYMON1NAME
	jr z,.getPokemonName
	ld hl,$de06 ; box pokemon names
.getPokemonName
	ld a,[$cf92]
	ld b,a
	ld a,4
	sub b
	ld b,a
	ld a,[W_LISTSCROLLOFFSET]
	add b
	call GetPartyMonName
	pop hl
	jr .placeNameString
.movesMenu
	call GetMoveName
.placeNameString
	call PlaceString
	pop de
	pop hl
	ld a,[$cf93]
	and a ; should prices be printed?
	jr z,.skipPrintingItemPrice
.printItemPrice
	push hl
	ld a,[de]
	ld de,ItemPrices
	ld [$cf91],a
	call GetItemPrice ; get price
	pop hl
	ld bc,20 + 5 ; 1 row down and 5 columns right
	add hl,bc
	ld c,$a3 ; no leading zeroes, right-aligned, print currency symbol, 3 bytes
	call PrintBCDNumber
.skipPrintingItemPrice
	ld a,[W_LISTMENUID]
	and a
	jr nz,.skipPrintingPokemonLevel
.printPokemonLevel
	ld a,[$d11e]
	push af
	push hl
	ld hl,W_NUMINPARTY
	ld a,[$cf8b]
	cp l ; is it a list of party pokemon or box pokemon?
	ld a,$00
	jr z,.next
	ld a,$02
.next
	ld [$cc49],a
	ld hl,$cf92
	ld a,[hl]
	ld b,a
	ld a,$04
	sub b
	ld b,a
	ld a,[W_LISTSCROLLOFFSET]
	add b
	ld [hl],a
	call LoadMonData ; load pokemon info
	ld a,[$cc49]
	and a ; is it a list of party pokemon or box pokemon?
	jr z,.skipCopyingLevel
.copyLevel
	ld a,[$cf9b]
	ld [$cfb9],a
.skipCopyingLevel
	pop hl
	ld bc,$001c
	add hl,bc
	call PrintLevel ; print level
	pop af
	ld [$d11e],a
.skipPrintingPokemonLevel
	pop hl
	pop de
	inc de
	ld a,[W_LISTMENUID]
	cp a,ITEMLISTMENU
	jr nz,.nextListEntry
.printItemQuantity
	ld a,[$d11e]
	ld [$cf91],a
	call IsKeyItem ; check if item is unsellable
	ld a,[$d124]
	and a ; is the item unsellable?
	jr nz,.skipPrintingItemQuantity ; if so, don't print the quantity
	push hl
	ld bc,20 + 8 ; 1 row down and 8 columns right
	add hl,bc
	ld a,"×"
	ldi [hl],a
	ld a,[$d11e]
	push af
	ld a,[de]
	ld [$cf97],a
	push de
	ld de,$d11e
	ld [de],a
	ld bc,$0102
	call PrintNumber
	pop de
	pop af
	ld [$d11e],a
	pop hl
.skipPrintingItemQuantity
	inc de
	pop bc
	inc c
	push bc
	inc c
	ld a,[$cc35] ; ID of item chosen for swapping (counts from 1)
	and a ; is an item being swapped?
	jr z,.nextListEntry
	sla a
	cp c ; is it this item?
	jr nz,.nextListEntry
	dec hl
	ld a,$ec ; unfilled right arrow menu cursor to indicate an item being swapped
	ld [hli],a
.nextListEntry
	ld bc,2 * 20 ; 2 rows
	add hl,bc
	pop bc
	inc c
	dec b
	jp nz,.loop
	ld bc,-8
	add hl,bc
	ld a,$ee ; down arrow
	ld [hl],a
	ret
.printCancelMenuItem
	ld de,ListMenuCancelText
	jp PlaceString

ListMenuCancelText: ; 2f97 (0:2f97)
	db "CANCEL@"

GetMonName: ; 2f9e (0:2f9e)
	push hl
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,BANK(MonsterNames) ; 07
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ld a,[$d11e]
	dec a
	ld hl,MonsterNames ; 421E
	ld c,10
	ld b,0
	call AddNTimes
	ld de,$cd6d
	push de
	ld bc,10
	call CopyData
	ld hl,$cd77
	ld [hl],$50
	pop de
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	pop hl
	ret

GetItemName: ; 2fcf (0:2fcf)
; given an item ID at [$D11E], store the name of the item into a string
;     starting at $CD6D
	push hl
	push bc
	ld a,[$D11E]
	cp HM_01 ; is this a TM/HM?
	jr nc,.Machine

	ld [$D0B5],a
	ld a,ITEM_NAME
	ld [W_LISTTYPE],a
	ld a,BANK(ItemNames)
	ld [$D0B7],a
	call GetName
	jr .Finish

.Machine
	call GetMachineName
.Finish
	ld de,$CD6D ; pointer to where item name is stored in RAM
	pop bc
	pop hl
	ret

GetMachineName: ; 2ff3 (0:2ff3)
; copies the name of the TM/HM in [$D11E] to $CD6D
	push hl
	push de
	push bc
	ld a,[$D11E]
	push af
	cp TM_01 ; is this a TM? [not HM]
	jr nc,.WriteTM
; if HM, then write "HM" and add 5 to the item ID, so we can reuse the
; TM printing code
	add 5
	ld [$D11E],a
	ld hl,HiddenPrefix ; points to "HM"
	ld bc,2
	jr .WriteMachinePrefix
.WriteTM
	ld hl,TechnicalPrefix ; points to "TM"
	ld bc,2
.WriteMachinePrefix
	ld de,$CD6D
	call CopyData

; now get the machine number and convert it to text
	ld a,[$D11E]
	sub TM_01 - 1
	ld b,$F6 ; "0"
.FirstDigit
	sub 10
	jr c,.SecondDigit
	inc b
	jr .FirstDigit
.SecondDigit
	add 10
	push af
	ld a,b
	ld [de],a
	inc de
	pop af
	ld b,$F6 ; "0"
	add b
	ld [de],a
	inc de
	ld a,"@"
	ld [de],a

	pop af
	ld [$D11E],a
	pop bc
	pop de
	pop hl
	ret

TechnicalPrefix: ; 303c (0:303c)
	db "TM"
HiddenPrefix: ; 303e (0:303e)
	db "HM"

; sets carry if item is HM, clears carry if item is not HM
; Input: a = item ID
IsItemHM: ; 3040 (0:3040)
	cp a,HM_01
	jr c,.notHM
	cp a,TM_01
	ret
.notHM
	and a
	ret

; sets carry if move is an HM, clears carry if move is not an HM
; Input: a = move ID
IsMoveHM: ; 3049 (0:3049)
	ld hl,HMMoves
	ld de,1
	jp IsInArray

HMMoves: ; 3052 (0:3052)
	db CUT,FLY,SURF,STRENGTH,FLASH
	db $ff ; terminator

GetMoveName: ; 3058 (0:3058)
	push hl
	ld a,MOVE_NAME
	ld [W_LISTTYPE],a
	ld a,[$d11e]
	ld [$d0b5],a
	ld a,BANK(MoveNames)
	ld [$d0b7],a
	call GetName
	ld de,$cd6d ; pointer to where move name is stored in RAM
	pop hl
	ret

; reloads text box tile patterns, current map view, and tileset tile patterns
ReloadMapData: ; 3071 (0:3071)
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,[W_CURMAP]
	call SwitchToMapRomBank
	call DisableLCD
	call LoadTextBoxTilePatterns
	call LoadCurrentMapView
	call LoadTilesetTilePatternData
	call EnableLCD
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; reloads tileset tile patterns
ReloadTilesetTilePatterns: ; 3090 (0:3090)
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,[W_CURMAP]
	call SwitchToMapRomBank
	call DisableLCD
	call LoadTilesetTilePatternData
	call EnableLCD
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; shows the town map and lets the player choose a destination to fly to
ChooseFlyDestination: ; 30a9 (0:30a9)
	ld hl,$d72e
	res 4,[hl]
	ld b, BANK(Func_70f90)
	ld hl, Func_70f90
	jp Bankswitch

; causes the text box to close waithout waiting for a button press after displaying text
DisableWaitingAfterTextDisplay: ; 30b6 (0:30b6)
	ld a,$01
	ld [$cc3c],a
	ret

; uses an item
; UseItem is used with dummy items to perform certain other functions as well
; INPUT:
; [$cf91] = item ID
; OUTPUT:
; [$cd6a] = success
; 00: unsucessful
; 01: successful
; 02: not able to be used right now, no extra menu displayed (only certain items use this)
UseItem: ; 30bc (0:30bc)
	ld b,BANK(UseItem_)
	ld hl,UseItem_
	jp Bankswitch

; confirms the item toss and then tosses the item
; INPUT:
; hl = address of inventory (either W_NUMBAGITEMS or W_NUMBOXITEMS)
; [$cf91] = item ID
; [$cf92] = index of item within inventory
; [$cf96] = quantity to toss
; OUTPUT:
; clears carry flag if the item is tossed, sets carry flag if not
TossItem: ; 30c4 (0:30c4)
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,BANK(TossItem_)
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call TossItem_
	pop de
	ld a,d
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; checks if an item is a key item
; INPUT:
; [$cf91] = item ID
; OUTPUT:
; [$d124] = result
; 00: item is not key item
; 01: item is key item
IsKeyItem: ; 30d9 (0:30d9)
	push hl
	push de
	push bc
	ld b,BANK(IsKeyItem_)
	ld hl,IsKeyItem_
	call Bankswitch
	pop bc
	pop de
	pop hl
	ret

; function to draw various text boxes
; INPUT:
; [$D125] = text box ID
DisplayTextBoxID: ; 30e8 (0:30e8)
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,BANK(DisplayTextBoxID_)
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call DisplayTextBoxID_
	pop bc
	ld a,b
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; known jump sources: 466 (0:466), 68a (0:68a)
Func_30fd: ; 30fd (0:30fd)
	ld a, [$cc57]
	and a
	ret nz
	ld a, [$d736]
	bit 1, a
	ret nz
	ld a, [$d730]
	and $80
	ret

; known jump sources: 1038 (0:1038)
Func_310e: ; 310e (0:310e)
	ld hl, $d736
	bit 0, [hl]
	res 0, [hl]
	jr nz, .asm_3146
	ld a, [$cc57]
	and a
	ret z
	dec a
	add a
	ld d, $0
	ld e, a
	ld hl, .unknown_3140
	add hl, de
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld a, [H_LOADEDROMBANK]
	push af
	ld a, [$cc58]
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ld a, [$cf10]
	call CallFunctionInTable
	pop af
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ret
.unknown_3140 ; 0x3140
	dw Unknown_1a442
	dw Unknown_1a510
	dw Unknown_1a57d
.asm_3146
	ld b, BANK(Func_1a3e0)
	ld hl, Func_1a3e0
	jp Bankswitch ; indirect jump to Func_1a3e0 (1a3e0 (6:63e0))

; known jump sources: 1a50d (6:650d)
Func_314e: ; 314e (0:314e)
	ld b, BANK(Func_1a41d)
	ld hl, Func_1a41d
	jp Bankswitch ; indirect jump to Func_1a41d (1a41d (6:641d))

; no known jump sources
Func_3156: ; 3156 (0:3156)
	ret

; stores hl in [W_TRAINERHEADERPTR]
StoreTrainerHeaderPointer: ; 3157 (0:3157)
	ld a, h
	ld [W_TRAINERHEADERPTR], a
	ld a, l
	ld [W_TRAINERHEADERPTR+1], a
	ret

; executes the current map script from the function pointer array provided in hl.
; a: map script index to execute (unless overridden by [$d733] bit 4)
ExecuteCurMapScriptInTable: ; 3160 (0:3160)
	push af
	push de
	call StoreTrainerHeaderPointer
	pop hl
	pop af
	push hl
	ld hl, W_FLAGS_D733
	bit 4, [hl]
	res 4, [hl]
	jr z, .useProvidedIndex   ; test if map script index was overridden manually
	ld a, [W_CURMAPSCRIPT]
.useProvidedIndex
	pop hl
	ld [W_CURMAPSCRIPT], a
	call CallFunctionInTable
	ld a, [W_CURMAPSCRIPT]
	ret

LoadGymLeaderAndCityName: ; 317f (0:317f)
	push de
	ld de, W_GYMCITYNAME
	ld bc, $11
	call CopyData   ; load city name
	pop hl
	ld de, W_GYMLEADERNAME
	ld bc, $b
	jp CopyData     ; load gym leader name

; reads specific information from trainer header (pointed to at W_TRAINERHEADERPTR)
; a: offset in header data
;    0 -> flag's bit (into W_TRAINERHEADERFLAGBIT)
;    2 -> flag's byte ptr (into hl)
;    4 -> before battle text (into hl)
;    6 -> after battle text (into hl)
;    8 -> end battle text (into hl)
ReadTrainerHeaderInfo: ; 3193 (0:3193)
	push de
	push af
	ld d, $0
	ld e, a
	ld hl, W_TRAINERHEADERPTR
	ld a, [hli]
	ld l, [hl]
	ld h, a
	add hl, de
	pop af
	and a
	jr nz, .nonZeroOffset
	ld a, [hl]
	ld [W_TRAINERHEADERFLAGBIT], a  ; store flag's bit
	jr .done
.nonZeroOffset
	cp $2
	jr z, .readPointer ; read flag's byte ptr
	cp $4
	jr z, .readPointer ; read before battle text
	cp $6
	jr z, .readPointer ; read after battle text
	cp $8
	jr z, .readPointer ; read end battle text
	cp $a
	jr nz, .done
	ld a, [hli]        ; read end battle text (2) but override the result afterwards (XXX why, bug?)
	ld d, [hl]
	ld e, a
	jr .done
.readPointer
	ld a, [hli]
	ld h, [hl]
	ld l, a
.done
	pop de
	ret

; calls HandleBitArray
HandleBitArray_Bank0: ; 31c7 (0:31c7)
	ld a, $10
	jp Predef ; indirect jump to HandleBitArray (f666 (3:7666))
; 31cc (0:31cc)

; direct talking to a trainer (rather than getting seen by one)
TalkToTrainer: ; 31cc (0:31cc)
	call StoreTrainerHeaderPointer
	xor a
	call ReadTrainerHeaderInfo     ; read flag's bit
	ld a, $2
	call ReadTrainerHeaderInfo     ; read flag's byte ptr
	ld a, [W_TRAINERHEADERFLAGBIT]
	ld c, a
	ld b, $2
	call HandleBitArray_Bank0      ; read trainer's flag
	ld a, c
	and a
	jr z, .trainerNotYetFought     ; test trainer's flag
	ld a, $6
	call ReadTrainerHeaderInfo     ; print after battle text
	jp PrintText
.trainerNotYetFought ; 0x31ed
	ld a, $4
	call ReadTrainerHeaderInfo     ; print before battle text
	call PrintText
	ld a, $a
	call ReadTrainerHeaderInfo     ; (?) does nothing apparently (maybe bug in ReadTrainerHeaderInfo)
	push de
	ld a, $8
	call ReadTrainerHeaderInfo     ; read end battle text
	pop de
	call PreBattleSaveRegisters
	ld hl, W_FLAGS_D733
	set 4, [hl]                    ; activate map script index override (index is set below)
	ld hl, W_FLAGS_CD60
	bit 0, [hl]                    ; test if player is already being engaged by another trainer
	ret nz
	call EngageMapTrainer
	ld hl, W_CURMAPSCRIPT
	inc [hl]      ; progress map script index (assuming it was 0 before) to start pre-battle routines
	jp Func_325d

; checks if any trainers are seeing the player and wanting to fight
CheckFightingMapTrainers: ; 3219 (0:3219)
	call CheckForEngagingTrainers
	ld a, [$cf13]
	cp $ff
	jr nz, .trainerEngaging
	xor a
	ld [$cf13], a
	ld [W_TRAINERHEADERFLAGBIT], a
	ret
.trainerEngaging
	ld hl, W_FLAGS_D733
	set 3, [hl]
	ld [$cd4f], a
	xor a
	ld [$cd50], a
	ld a, $4c
	call Predef
	ld a, BTN_RIGHT | BTN_LEFT | BTN_UP | BTN_DOWN
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	xor a
	ldh [$b4], a
	call TrainerWalkUpToPlayer_Bank0
	ld hl, W_CURMAPSCRIPT
	inc [hl]      ; progress to battle phase 1 (engaging)
	ret

Func_324c: ; 324c (0:324c)
	ld a, [$d730]
	and $1
	ret nz
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, [$cf13]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID

; known jump sources: 3216 (0:3216)
Func_325d: ; 325d (0:325d)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	call InitBattleEnemyParameters
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, $d72e
	set 1, [hl]
	ld hl, W_CURMAPSCRIPT
	inc [hl]        ; progress to battle phase 2 (battling)
	ret

; known jump sources: 5a349 (16:6349), 60d3a (18:4d3a), 7623f (1d:623f), 76396 (1d:6396), 764ed (1d:64ed)
EndTrainerBattle: ; 3275 (0:3275)
	ld hl, $d126
	set 5, [hl]
	set 6, [hl]
	ld hl, $d72d
	res 7, [hl]
	ld hl, W_FLAGS_CD60
	res 0, [hl]                  ; player is no longer engaged by any trainer
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, ResetButtonPressedAndMapScript
	ld a, $2
	call ReadTrainerHeaderInfo
	ld a, [W_TRAINERHEADERFLAGBIT]
	ld c, a
	ld b, $1
	call HandleBitArray_Bank0   ; flag trainer as fought
	ld a, [W_ENEMYMONORTRAINERCLASS]
	cp $c8
	jr nc, .skipRemoveSprite    ; test if trainer was fought (in that case skip removing the corresponding sprite)
	ld hl, W_MISSABLEOBJECTLIST
	ld de, $2
	ld a, [$cf13]
	call IsInArray              ; search for sprite ID
	inc hl
	ld a, [hl]
	ld [$cc4d], a               ; load corresponding missable object index and remove it
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
.skipRemoveSprite
	ld hl, $d730
	bit 4, [hl]
	res 4, [hl]
	ret nz

; known jump sources: 328b (0:328b)
ResetButtonPressedAndMapScript: ; 32c1 (0:32c1)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [H_NEWLYPRESSEDBUTTONS], a
	ld [H_NEWLYRELEASEDBUTTONS], a
	ld [W_CURMAPSCRIPT], a               ; reset battle status
	ret

; calls TrainerWalkUpToPlayer
TrainerWalkUpToPlayer_Bank0: ; 32cf (0:32cf)
	ld b, BANK(TrainerWalkUpToPlayer)
	ld hl, TrainerWalkUpToPlayer
	jp Bankswitch ; indirect jump to TrainerWalkUpToPlayer (56881 (15:6881))

; sets opponent type and mon set/lvl based on the engaging trainer data
InitBattleEnemyParameters: ; 32d7 (0:32d7)
	ld a, [W_ENGAGEDTRAINERCLASS]
	ld [W_CUROPPONENT], a ; $d059
	ld [W_ENEMYMONORTRAINERCLASS], a
	cp $c8
	ld a, [W_ENGAGEDTRAINERSETNUM] ; $cd2e
	jr c, .noTrainer
	ld [W_TRAINERNO], a ; $d05d
	ret
.noTrainer
	ld [W_CURENEMYLVL], a ; $d127
	ret

; known jump sources: 1cde1 (7:4de1)
Func_32ef: ; 32ef (0:32ef)
	ld hl, Func_567f9
	jr asm_3301

Func_32f4: ; 32f4 (0:32f4)
	ld hl, Func_56819
	jr asm_3301 ; 0x32f7 $8

; known jump sources: 1ce15 (7:4e15), 1d072 (7:5072), 1e7e5 (7:67e5)
Func_32f9: ; 32f9 (0:32f9)
	ld hl, Func_5683d
	jr asm_3301

Func_32fe: ; 32fe (0:32fe)
	ld hl, Func_5685d
asm_3301: ; 3301 (0:3301)
	ld b, $15
	jp Bankswitch ; indirect jump to one of the four functions

; known jump sources: 3219 (0:3219)
CheckForEngagingTrainers: ; 3306 (0:3306)
	xor a
	call ReadTrainerHeaderInfo       ; read trainer flag's bit (unused)
	ld d, h                          ; store trainer header address in de
	ld e, l
.trainerLoop
	call StoreTrainerHeaderPointer   ; set trainer header pointer to current trainer
	ld a, [de]
	ld [$cf13], a                     ; store trainer flag's bit
	ld [W_TRAINERHEADERFLAGBIT], a
	cp $ff
	ret z
	ld a, $2
	call ReadTrainerHeaderInfo       ; read trainer flag's byte ptr
	ld b, $2
	ld a, [W_TRAINERHEADERFLAGBIT]
	ld c, a
	call HandleBitArray_Bank0        ; read trainer flag
	ld a, c
	and a
	jr nz, .trainerAlreadyFought
	push hl
	push de
	push hl
	xor a
	call ReadTrainerHeaderInfo       ; get trainer header pointer
	inc hl
	ld a, [hl]                       ; read trainer engage distance
	pop hl
	ld [W_TRAINERENGAGEDISTANCE], a
	ld a, [$cf13]
	swap a
	ld [W_TRAINERSPRITEOFFSET], a ; $cd3d
	ld a, $39
	call Predef ; indirect jump to CheckEngagePlayer (5690f (15:690f))
	pop de
	pop hl
	ld a, [W_TRAINERSPRITEOFFSET] ; $cd3d
	and a
	ret nz        ; break if the trainer is engaging
.trainerAlreadyFought
	ld hl, $c
	add hl, de
	ld d, h
	ld e, l
	jr .trainerLoop

; saves loaded rom bank and hl as well as de registers
PreBattleSaveRegisters: ; 3354 (0:3354)
	ld a, [H_LOADEDROMBANK]
	ld [W_PBSTOREDROMBANK], a
	ld a, h
	ld [W_PBSTOREDREGISTERH], a
	ld a, l
	ld [W_PBSTOREDREGISTERL], a
	ld a, d
	ld [W_PBSTOREDREGISTERD], a
	ld a, e
	ld [W_PBSTOREDREGISTERE], a
	ret

; loads data of some trainer on the current map and plays pre-battle music
; [$cf13]: sprite ID of trainer who is engaged
EngageMapTrainer: ; 336a (0:336a)
	ld hl, W_MAPSPRITEEXTRADATA
	ld d, $0
	ld a, [$cf13]
	dec a
	add a
	ld e, a
	add hl, de     ; seek to engaged trainer data
	ld a, [hli]    ; load trainer class
	ld [W_ENGAGEDTRAINERCLASS], a
	ld a, [hl]     ; load trainer mon set
	ld [W_ENEMYMONATTACKMOD], a ; $cd2e
	jp PlayTrainerMusic

; known jump sources: 3c6ce (f:46ce)
Func_3381: ; 3381 (0:3381)
	push hl
	ld hl, $d72d
	bit 7, [hl]
	res 7, [hl]
	pop hl
	ret z
	ld a, [H_LOADEDROMBANK]
	push af
	ld a, [W_PBSTOREDROMBANK]
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	push hl
	ld b, BANK(SaveTrainerName)
	ld hl, SaveTrainerName
	call Bankswitch ; indirect jump to SaveTrainerName (27e4a (9:7e4a))
	ld hl, UnnamedText_33cf
	call PrintText
	pop hl
	pop af
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ld b, BANK(Func_1a5e7)
	ld hl, Func_1a5e7
	call Bankswitch ; indirect jump to Func_1a5e7 (1a5e7 (6:65e7))
	jp WaitForSoundToFinish

; known jump sources: 33d4 (0:33d4)
Func_33b7: ; 33b7 (0:33b7)
	ld a, [$cf0b]
	and a
	jr nz, .asm_33c6
	ld a, [W_PBSTOREDREGISTERH]
	ld h, a
	ld a, [W_PBSTOREDREGISTERL]
	ld l, a
	ret
.asm_33c6
	ld a, [W_PBSTOREDREGISTERD]
	ld h, a
	ld a, [W_PBSTOREDREGISTERE]
	ld l, a
	ret

UnnamedText_33cf: ; 33cf (0:33cf)
	TX_FAR _UnnamedText_33cf
	db $08

Func_33d4: ; 33d4 (0:33d4)
	call Func_33b7
	call TextCommandProcessor
	jp TextScriptEnd

; no known jump sources
Func_33dd: ; 33dd (0:33dd)
	ld a, [W_FLAGS_CD60]
	bit 0, a
	ret nz
	call EngageMapTrainer
	xor a
	ret
; 0x33e8

; known jump sources: 337e (0:337e)
PlayTrainerMusic: ; 33e8 (0:33e8)
	ld a, [W_ENGAGEDTRAINERCLASS]
	cp $c8 + SONY1
	ret z
	cp $c8 + SONY2
	ret z
	cp $c8 + SONY3
	ret z
	ld a, [W_LONEATTACKNO] ; $d05c
	and a
	ret nz
	xor a
	ld [$cfc7], a
	ld a, $ff
	call PlaySound      ; stop music
	ld a, $1f
	ld [$c0ef], a
	ld [$c0f0], a
	ld a, [W_ENGAGEDTRAINERCLASS]
	ld b, a
	ld hl, EvilTrainerList
.evilTrainerListLoop
	ld a, [hli]
	cp $ff
	jr z, .noEvilTrainer
	cp b
	jr nz, .evilTrainerListLoop
	ld a, $f6
	jr .PlaySound
.noEvilTrainer
	ld hl, FemaleTrainerList
.femaleTrainerListLoop
	ld a, [hli]
	cp $ff
	jr z, .maleTrainer
	cp b
	jr nz, .femaleTrainerListLoop
	ld a, $f9
	jr .PlaySound
.maleTrainer
	ld a, $fc
.PlaySound
	ld [$c0ee], a
	jp PlaySound

FemaleTrainerList: ; 3434 (0:3434)
db $c8+LASS
db $c8+JR__TRAINER_F
db $c8+BEAUTY
db $c8+COOLTRAINER_F
db $FF

EvilTrainerList: ; 3439 (0:3439)
db $c8+JUGGLER_X
db $c8+GAMBLER
db $c8+ROCKER
db $c8+JUGGLER
db $c8+CHIEF
db $c8+SCIENTIST
db $c8+GIOVANNI
db $c8+ROCKET
db $FF

; known jump sources: 345e (0:345e), 748f6 (1d:48f6)
Func_3442: ; 3442 (0:3442)
	ld a, [hli]
	cp $ff
	ret z
	cp b
	jr nz, .asm_345b
	ld a, [hli]
	cp c
	jr nz, .asm_345c
	ld a, [hli]
	ld d, [hl]
	ld e, a
	ld hl, $ccd3
	call DecodeRLEList
	dec a
	ld [$cd38], a
	ret
.asm_345b
	inc hl
.asm_345c
	inc hl
	inc hl
	jr Func_3442

; known jump sources: 299f (0:299f)
FuncTX_ItemStoragePC: ; 3460 (0:3460)
	call SaveScreenTilesToBuffer2
	ld b, BANK(Func_78e6)
	ld hl, Func_78e6
	jr bankswitchAndContinue

; known jump sources: 29a4 (0:29a4)
FuncTX_BillsPC: ; 346a (0:346a)
	call SaveScreenTilesToBuffer2
	ld b, BANK(Func_214c2)
	ld hl, Func_214c2
	jr bankswitchAndContinue
; 3474 (0:3474)

FuncTX_SlotMachine: ; 3474 (0:3474)
; XXX find a better name for this function
; special_F7
	ld b,BANK(CeladonPrizeMenu)
	ld hl,CeladonPrizeMenu
bankswitchAndContinue: ; 3479 (0:3479)
	call Bankswitch
	jp HoldTextDisplayOpen        ; continue to main text-engine function

; known jump sources: 29a9 (0:29a9)
FuncTX_PokemonCenterPC: ; 347f (0:347f)
	ld b, BANK(ActivatePC)
	ld hl, ActivatePC
	jr bankswitchAndContinue

; known jump sources: 190cf (6:50cf), 1981a (6:581a), 19845 (6:5845), 1a402 (6:6402), 1a6b7 (6:66b7), 1ca63 (7:4a63), 1cbb2 (7:4bb2), 1cc64 (7:4c64), 1d4b2 (7:54b2), 1e6ca (7:66ca), 49705 (12:5705), 498bd (12:58bd), 512e9 (14:52e9), 51402 (14:5402), 5a36d (16:636d), 5a51f (16:651f), 5c1ea (17:41ea), 748fe (1d:48fe), 752b1 (1d:52b1), 75f5a (1d:5f5a), 760ab (1d:60ab), 761d6 (1d:61d6), 76217 (1d:6217), 7632d (1d:632d), 7636e (1d:636e), 76484 (1d:6484), 764c5 (1d:64c5)
Func_3486: ; 3486 (0:3486)
	xor a
	ld [$cd3b], a
	ld [$c206], a
	ld hl, $d730
	set 7, [hl]
	ret
; 3493 (0:3493)

IsItemInBag: ; 3493 (0:3493)
; given an item_id in b
; set zero flag if item isn't in player's bag
; else reset zero flag
; related to Pokémon Tower and ghosts
	ld a,$1C
	call Predef
	ld a,b
	and a
	ret

DisplayPokedex: ; 349b (0:349b)
	ld [$d11e], a
	ld b, BANK(Func_7c18)
	ld hl, Func_7c18
	jp Bankswitch
; 0x34a6

; known jump sources: 18eda (6:4eda), 19564 (6:5564), 1cbbc (7:4bbc), 1cbc6 (7:4bc6), 1cbe9 (7:4be9), 1cc43 (7:4c43), 1cc4d (7:4c4d), 1cd13 (7:4d13), 1cd54 (7:4d54), 1cd7a (7:4d7a), 1ce1f (7:4e1f), 1cf05 (7:4f05), 1cf0f (7:4f0f), 1cf7a (7:4f7a), 50ef8 (14:4ef8), 510aa (14:50aa), 51104 (14:5104), 51ce7 (14:5ce7), 5a540 (16:6540), 6054e (18:454e), 6142d (18:542d), 62224 (18:6224), 7602d (1d:602d), 76037 (1d:6037), 7604f (1d:604f), 76066 (1d:6066)
Func_34a6: ; 34a6 (0:34a6)
	call Func_34ae
	ld c, $6
	jp DelayFrames

; known jump sources: 34a6 (0:34a6)
Func_34ae: ; 34ae (0:34ae)
	ld a, $9
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	call Func_34fc
	ld a, [$FF00+$8d]
	ld [hl], a
	ret

Func_34b9: ; 34b9 (0:34b9)
	ld de, $fff9
	add hl, de
	ld [hl], a
	ret
; 0x34bf

; tests if the player's coordinates are in a specified array
; INPUT:
; hl = address of array
; OUTPUT:
; [$cd3d] = if there is match, the matching array index
; sets carry if the coordinates are in the array, clears carry if not
ArePlayerCoordsInArray: ; 34bf (0:34bf)
	ld a,[W_YCOORD]
	ld b,a
	ld a,[W_XCOORD]
	ld c,a
	; fallthrough

CheckCoords: ; 34c7 (0:34c7)
	xor a
	ld [$cd3d],a
.loop
	ld a,[hli]
	cp a,$ff ; reached terminator?
	jr z,.notInArray
	push hl
	ld hl,$cd3d
	inc [hl]
	pop hl
.compareYCoord
	cp b
	jr z,.compareXCoord
	inc hl
	jr .loop
.compareXCoord
	ld a,[hli]
	cp c
	jr nz,.loop
.inArray
	scf
	ret
.notInArray
	and a
	ret

; tests if a boulder's coordinates are in a specified array
; INPUT:
; hl = address of array
; ff8c = which boulder to check? XXX
; OUTPUT:
; [$cd3d] = if there is match, the matching array index
; sets carry if the coordinates are in the array, clears carry if not
CheckBoulderCoords: ; 34e4 (0:34e4)
	push hl
	ld hl, $c204
	ld a, [$ff00+$8c]
	swap a
	ld d, $0
	ld e, a
	add hl, de
	ld a, [hli]
	sub $4 ; because sprite coordinates are offset by 4
	ld b, a
	ld a, [hl]
	sub $4 ; because sprite coordinates are offset by 4
	ld c, a
	pop hl
	jp CheckCoords
; 0x34fc

; known jump sources: 34b2 (0:34b2), 1ccd8 (7:4cd8), 1d15f (7:515f), 1d16c (7:516c), 1d235 (7:5235)
Func_34fc: ; 34fc (0:34fc)
	ld h, $c1
	jr asm_3502

; known jump sources: 19530 (6:5530)
Func_3500: ; 3500 (0:3500)
	ld h, $c2
asm_3502: ; 3502 (0:3502)
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	ld b, a
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	swap a
	add b
	ld l, a
	ret

; known jump sources: 3453 (0:3453), 1a4bc (6:64bc), 1a4c9 (6:64c9), 1cbab (7:4bab), 1d4ab (7:54ab), 5a366 (16:6366), 5a518 (16:6518), 75f53 (1d:5f53), 760a4 (1d:60a4)
; decodes a $ff-terminated RLEncoded list
; each entry is a pair of bytes <byte value> <repetitions>
; the final $ff will be replicated in the output list and a contains the number of bytes written
; de: input list
; hl: output list
DecodeRLEList: ; 350c (0:350c)
	xor a
	ld [W_RLEBYTECOUNTER], a     ; count written bytes here
.listLoop
	ld a, [de]
	cp $ff
	jr z, .endOfList
	ld [H_DOWNARROWBLINKCNT1], a ; store byte value to be written
	inc de
	ld a, [de]
	ld b, $0
	ld c, a                      ; number of bytes to be written
	ld a, [W_RLEBYTECOUNTER]
	add c
	ld [W_RLEBYTECOUNTER], a     ; update total number of written bytes
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	call FillMemory              ; write a c-times to output
	inc de
	jr .listLoop
.endOfList
	ld a, $ff
	ld [hl], a                   ; write final $ff
	ld a, [W_RLEBYTECOUNTER]
	inc a                        ; include sentinel in counting
	ret

; sets movement byte 1 for sprite [$FF8C] to $FE and byte 2 to [$FF8D]
SetSpriteMovementBytesToFE: ; 3533 (0:3533)
	push hl
	call GetSpriteMovementByte1Pointer
	ld [hl], $fe
	call GetSpriteMovementByte2Pointer
	ld a, [$ff00+$8d]
	ld [hl], a
	pop hl
	ret
; 0x3541

; sets both movement bytes for sprite [$FF8C] to $FF
SetSpriteMovementBytesToFF: ; 3541 (0:3541)
	push hl
	call GetSpriteMovementByte1Pointer
	ld [hl],$FF
	call GetSpriteMovementByte2Pointer
	ld [hl],$FF ; prevent person from walking?
	pop hl
	ret

; returns the sprite movement byte 1 pointer for sprite [$FF8C] in hl
GetSpriteMovementByte1Pointer: ; 354e (0:354e)
	ld h,$C2
	ld a,[$FF8C] ; the sprite to move
	swap a
	add a,6
	ld l,a
	ret

; returns the sprite movement byte 2 pointer for sprite [$FF8C] in hl
GetSpriteMovementByte2Pointer: ; 3558 (0:3558)
	push de
	ld hl,W_MAPSPRITEDATA
	ld a,[$FF8C] ; the sprite to move
	dec a
	add a
	ld d,0
	ld e,a
	add hl,de
	pop de
	ret

; known jump sources: 3ef5b (f:6f5b)
Func_3566: ; 3566 (0:3566)
	call Func_359e
	ld a, [W_ISLINKBATTLE] ; $d12b
	and a
	jr nz, .asm_3594
	ld a, $e
	call BankswitchHome
	ld a, [W_TRAINERCLASS] ; $d031
	dec a
	ld hl, $5914
	ld bc, $5
	call AddNTimes
	ld de, $d033
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hli]
	ld [de], a
	ld de, $d046
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hli]
	ld [de], a
	jp BankswitchBack
.asm_3594
	ld hl, $d033
	ld de, $6ede
	ld [hl], e
	inc hl
	ld [hl], d
	ret

; known jump sources: 3566 (0:3566)
Func_359e: ; 359e (0:359e)
	ld b, BANK(Func_13a58)
	ld hl, Func_13a58
	jp Bankswitch ; indirect jump to Func_13a58 (13a58 (4:7a58))

; tests if player's money are at least as much as [$ff9f]
; sets carry flag if not enough money
; sets zero flag if amounts match exactly
HasEnoughMoney: ; 35a6 (0:35a6)
	ld de, W_PLAYERMONEY3 ; $d347
	ld hl, $ff9f
	ld c, $3
	jp StringCmp

; tests if player's game corner coins are at least as many as [$ffa0]
; sets carry flag if not enough coins
; sets zero flag if amounts match exactly
HasEnoughCoins: ; 35b1 (0:35b1)
	ld de, W_PLAYERCOINS1
	ld hl, $ffa0
	ld c, $2
	jp StringCmp
; 0x35bc

BankswitchHome: ; 35bc (0:35bc)
; switches to bank # in a
; Only use this when in the home bank!
	ld [$CF09],a
	ld a,[H_LOADEDROMBANK]
	ld [$CF08],a
	ld a,[$CF09]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

BankswitchBack: ; 35cd (0:35cd)
; returns from BankswitchHome
	ld a,[$CF08]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

Bankswitch: ; 35d6 (0:35d6)
; self-contained bankswitch, use this when not in the home bank
; switches to the bank in b
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,b
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ld bc,.Return
	push bc
	jp [hl]
.Return
	pop bc
	ld a,b
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; displays yes/no choice
; yes -> set carry
YesNoChoice: ; 35ec (0:35ec)
	call SaveScreenTilesToBuffer1
	call InitYesNoTextBoxParameters
	jr DisplayYesNoChoice

; no known jump sources
Func_35f4: ; 35f4 (0:35f4)
	ld a, $14
	ld [$d125], a
	call InitYesNoTextBoxParameters
	jp DisplayTextBoxID
; 0x35ff

InitYesNoTextBoxParameters: ; 35ff (0:35ff)
	xor a
	ld [$d12c], a
	FuncCoord 14, 7 ; $c43a
	ld hl, Coord
	ld bc, $80f
	ret

; known jump sources: 7000 (1:7000)
YesNoChoicePokeCenter: ; 360a (0:360a)
	call SaveScreenTilesToBuffer1
	ld a, $6
	ld [$d12c], a
	FuncCoord 11, 6 ; $c423
	ld hl, Coord
	ld bc, $80c
	jr DisplayYesNoChoice

; no known jump sources
Func_361a: ; 361a (0:361a)
	call SaveScreenTilesToBuffer1
	ld a, $3
	ld [$d12c], a
	FuncCoord 12, 7 ; $c438
	ld hl, Coord
	ld bc, $080d
DisplayYesNoChoice: ; 3628 (0:3628)
	ld a, $14
	ld [$d125], a
	call DisplayTextBoxID
	jp LoadScreenTilesFromBuffer1

; calculates the difference |a-b|, setting carry flag if a<b
CalcDifference: ; 3633 (0:3633)
	sub b
	ret nc
	cpl
	add $1
	scf
	ret
; 363a (0:363a)

MoveSprite: ; 363a (0:363a)
; move the sprite [$FF8C] with the movement pointed to by de
; actually only copies the movement data to $CC5B for later
	call SetSpriteMovementBytesToFF
MoveSprite_: ; 363d (0:363d)
	push hl
	push bc
	call GetSpriteMovementByte1Pointer
	xor a
	ld [hl],a
	ld hl,$CC5B
	ld c,0

.loop
	ld a,[de]
	ld [hli],a
	inc de
	inc c
	cp a,$FF ; have we reached the end of the movement data?
	jr nz,.loop

	ld a,c
	ld [$CF0F],a ; number of steps taken

	pop bc
	ld hl,$D730
	set 0,[hl]
	pop hl
	xor a
	ld [$CD3B],a
	ld [$CCD3],a
	dec a
	ld [W_JOYPADFORBIDDENBUTTONSMASK],a
	ld [$CD3A],a
	ret

; known jump sources: f964 (3:7964), f98d (3:798d)
Func_366b: ; 366b (0:366b)
	push hl
	ld hl, $ffe7
	xor a
	ld [hld], a
	ld a, [hld]
	and a
	jr z, .asm_367e
	ld a, [hli]
.asm_3676
	sub [hl]
	jr c, .asm_367e
	inc hl
	inc [hl]
	dec hl
	jr .asm_3676
.asm_367e
	pop hl
	ret
; 3680 (0:3680)
; copies the tile patterns for letters and numbers into VRAM
LoadFontTilePatterns: ; 3680 (0:3680)
	ld a,[rLCDC]
	bit 7,a ; is the LCD enabled?
	jr nz,.lcdEnabled
.lcdDisabled
	ld hl,FontGraphics
	ld de,$8800
	ld bc,$400
	ld a,BANK(FontGraphics)
	jp FarCopyDataDouble ; if LCD is off, transfer all at once
.lcdEnabled
	ld de,FontGraphics
	ld hl,$8800
	ld bc,(BANK(FontGraphics) << 8 | $80)
	jp CopyVideoDataDouble ; if LCD is on, transfer during V-blank

; copies the text box tile patterns into VRAM
LoadTextBoxTilePatterns: ; 36a0 (0:36a0)
	ld a,[rLCDC]
	bit 7,a ; is the LCD enabled?
	jr nz,.lcdEnabled
.lcdDisabled
	ld hl,TextBoxGraphics
	ld de,$9600
	ld bc,$0200
	ld a,BANK(TextBoxGraphics)
	jp FarCopyData2 ; if LCD is off, transfer all at once
.lcdEnabled
	ld de,TextBoxGraphics
	ld hl,$9600
	ld bc,(BANK(TextBoxGraphics) << 8 | $20)
	jp CopyVideoData ; if LCD is on, transfer during V-blank

; copies HP bar and status display tile patterns into VRAM
LoadHpBarAndStatusTilePatterns: ; 36c0 (0:36c0)
	ld a,[rLCDC]
	bit 7,a ; is the LCD enabled?
	jr nz,.lcdEnabled
.lcdDisabled
	ld hl,HpBarAndStatusGraphics
	ld de,$9620
	ld bc,$01e0
	ld a,BANK(HpBarAndStatusGraphics)
	jp FarCopyData2 ; if LCD is off, transfer all at once
.lcdEnabled
	ld de,HpBarAndStatusGraphics
	ld hl,$9620
	ld bc,(BANK(HpBarAndStatusGraphics) << 8 | $1e)
	jp CopyVideoData ; if LCD is on, transfer during V-blank

;Fills memory range with the specified byte.
;input registers a = fill_byte, bc = length, hl = address
FillMemory: ; 36e0 (0:36e0)
	push de
	ld d, a
.loop
	ld a, d
	ldi [hl], a
	dec bc
	ld a, b
	or c
	jr nz, .loop 
	pop de
	ret

; known jump sources: 62a6 (1:62a6), 3eca0 (f:6ca0), 3f05d (f:705d), 70343 (1c:4343), 7035d (1c:435d)
; loads sprite that de points to
UncompressSpriteFromDE: ; 36eb (0:36eb)
	ld hl, W_SPRITEINPUTPTR
	ld [hl], e
	inc hl
	ld [hl], d
	jp UncompressSpriteData

SaveScreenTilesToBuffer2: ; 36f4 (0:36f4)
	ld hl, W_SCREENTILESBUFFER
	ld de, W_SCREENTILESBACKBUFFER2
	ld bc, $168
	call CopyData
	ret

LoadScreenTilesFromBuffer2: ; 3701 (0:3701)
	call LoadScreenTilesFromBuffer2DisableBGTransfer
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ret

; loads screen tiles stored in W_SCREENTILESBACKBUFFER2 but leaves H_AUTOBGTRANSFERENABLED disabled
LoadScreenTilesFromBuffer2DisableBGTransfer: ; 3709 (0:3709)
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld hl, W_SCREENTILESBACKBUFFER2
	ld de, W_SCREENTILESBUFFER
	ld bc, $168
	call CopyData
	ret

SaveScreenTilesToBuffer1: ; 3719 (0:3719)
	ld hl, W_SCREENTILESBUFFER
	ld de, W_SCREENTILESBACKBUFFER
	ld bc, $168
	jp CopyData

LoadScreenTilesFromBuffer1: ; 3725 (0:3725)
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld hl, W_SCREENTILESBACKBUFFER
	ld de, W_SCREENTILESBUFFER
	ld bc, $168
	call CopyData
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ret
; 3739 (0:3739)

DelayFrames: ; 3739 (0:3739)
; wait n frames, where n is the value in c
	call DelayFrame
	dec c
	jr nz,DelayFrames
	ret

PlaySoundWaitForCurrent: ; 3740 (0:3740)
	push af
	call WaitForSoundToFinish
	pop af
	jp PlaySound

; Wait for sound to finish playing
WaitForSoundToFinish: ; 3748 (0:3748)
	ld a, [$d083]
	and $80
	ret nz
	push hl
.asm_374f
	ld hl, $c02a
	xor a
	or [hl]
	inc hl
	or [hl]
	inc hl
	inc hl
	or [hl]
	jr nz, .asm_374f
	pop hl
	ret
; 375d (0:375d)

NamePointers: ; 375d (0:375d)
	dw MonsterNames
	dw MoveNames
	dw UnusedNames
	dw ItemNames
	dw $D273 ; player's OT names list
	dw $D9AC ; enemy's OT names list
	dw TrainerNames

GetName: ; 376b (0:376b)
; arguments:
; [$D0B5] = which name
; [$D0B6] = which list (W_LISTTYPE)
; [$D0B7] = bank of list
;
; returns pointer to name in de
	ld a,[$d0b5]
	ld [$d11e],a
	cp a,$C4        ;it's TM/HM
	jp nc,GetMachineName
	ld a,[H_LOADEDROMBANK]
	push af
	push hl
	push bc
	push de
	ld a,[W_LISTTYPE]    ;List3759_entrySelector
	dec a
	jr nz,.otherEntries
	;1 = MON_NAMES
	call GetMonName
	ld hl,11
	add hl,de
	ld e,l
	ld d,h
	jr .gotPtr
.otherEntries ; $378d
	;2-7 = OTHER ENTRIES
	ld a,[$d0b7]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ld a,[W_LISTTYPE]    ;VariousNames' entryID
	dec a
	add a
	ld d,0
	ld e,a
	jr nc,.skip
	inc d
.skip ; $37a0
	ld hl,NamePointers
	add hl,de
	ld a,[hli]
	ld [$ff96],a
	ld a,[hl]
	ld [$ff95],a
	ld a,[$ff95]
	ld h,a
	ld a,[$ff96]
	ld l,a
	ld a,[$d0b5]
	ld b,a
	ld c,0
.nextName
	ld d,h
	ld e,l
.nextChar
	ld a,[hli]
	cp a,$50
	jr nz,.nextChar
	inc c           ;entry counter
	ld a,b          ;wanted entry
	cp c
	jr nz,.nextName
	ld h,d
	ld l,e
	ld de,$cd6d
	ld bc,$0014
	call CopyData
.gotPtr ; $37cd
	ld a,e
	ld [$cf8d],a
	ld a,d
	ld [$cf8e],a
	pop de
	pop bc
	pop hl
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

; known jump sources: 2cdc (0:2cdc), 2ee0 (0:2ee0)
GetItemPrice: ; 37df (0:37df)
	ld a, [H_LOADEDROMBANK]
	push af
	ld a, [W_LISTMENUID] ; $cf94
	cp $1
	ld a, $1
	jr nz, .asm_37ed
	ld a, $f
.asm_37ed
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ld hl, $cf8f
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld a, [$cf91]
	cp HM_01
	jr nc, .asm_3812
	ld bc, $3
.asm_3802
	add hl, bc
	dec a
	jr nz, .asm_3802
	dec hl
	ld a, [hld]
	ld [$FF00+$8d], a
	ld a, [hld]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	ld a, [hl]
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	jr .asm_381c
.asm_3812
	ld a, $1e
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	call GetMachinePrice
.asm_381c
	ld de, H_DOWNARROWBLINKCNT1 ; $ff8b
	pop af
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ret

; copies a string from [de] to [$cf4b]
CopyStringToCF4B: ; 3826 (0:3826)
	ld hl, $cf4b
	; fall through

; copies a string from [de] to [hl]
CopyString ; 3829 (0:3829)
	ld a, [de]
	inc de
	ld [hli], a
	cp $50
	jr nz, CopyString
	ret
; 3831 (0:3831)

; this function is used when lower button sensitivity is wanted (e.g. menus)
; OUTPUT: [$ffb5] = pressed buttons in usual format
; there are two flags that control its functionality, [$ffb6] and [$ffb7]
; there are esentially three modes of operation
; 1. Get newly pressed buttons only
;    ([$ffb7] == 0, [$ffb6] == any)
;    Just copies [H_NEWLYPRESSEDBUTTONS] to [$ffb5].
; 2. Get currently pressed buttons at low sample rate with delay
;    ([$ffb7] == 1, [$ffb6] != 0)
;    If the user holds down buttons for more than half a second,
;    report buttons as being pressed up to 12 times per second thereafter.
;    If the user holds down buttons for less than half a second,
;    report only one button press.
; 3. Same as 2, but report no buttons as pressed if A or B is held down.
;    ([$ffb7] == 1, [$ffb6] == 0)
GetJoypadStateLowSensitivity: ; 3831 (0:3831)
	call GetJoypadState
	ld a,[$ffb7] ; flag
	and a ; get all currently pressed buttons or only newly pressed buttons?
	ld a,[H_NEWLYPRESSEDBUTTONS] ; newly pressed buttons
	jr z,.storeButtonState
	ld a,[H_CURRENTPRESSEDBUTTONS] ; all currently pressed buttons
.storeButtonState
	ld [$ffb5],a
	ld a,[H_NEWLYPRESSEDBUTTONS] ; newly pressed buttons
	and a ; have any buttons been newly pressed since last check?
	jr z,.noNewlyPressedButtons
.newlyPressedButtons
	ld a,30 ; half a second delay
	ld [H_FRAMECOUNTER],a
	ret
.noNewlyPressedButtons
	ld a,[H_FRAMECOUNTER]
	and a ; is the delay over?
	jr z,.delayOver
.delayNotOver
	xor a
	ld [$ffb5],a ; report no buttons as pressed
	ret
.delayOver
; if [$ffb6] = 0 and A or B is pressed, report no buttons as pressed
	ld a,[H_CURRENTPRESSEDBUTTONS]
	and a,%00000011 ; A and B buttons
	jr z,.setShortDelay
	ld a,[$ffb6] ; flag
	and a
	jr nz,.setShortDelay
	xor a
	ld [$ffb5],a             
.setShortDelay
	ld a,5 ; 1/12 of a second delay
	ld [H_FRAMECOUNTER],a
	ret

WaitForTextScrollButtonPress: ; 3865 (0:3865)
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	push af
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	push af
	xor a
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld a, $6
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
.asm_3872
	push hl
	ld a, [$d09b]
	and a
	jr z, .asm_387c
	call Func_716c6
.asm_387c
	FuncCoord 18, 16 ; $c4f2
	ld hl, Coord
	call HandleDownArrowBlinkTiming
	pop hl
	call GetJoypadStateLowSensitivity
	ld a, $2d
	call Predef ; indirect jump to Func_5a5f (5a5f (1:5a5f))
	ld a, [$FF00+$b5]
	and BTN_A | BTN_B ; $3
	jr z, .asm_3872
	pop af
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	pop af
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ret

; (unlass in link battle) waits for A or B being pressed and outputs the scrolling sound effect
ManualTextScroll: ; 3898 (0:3898)
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr z, .inLinkBattle
	call WaitForTextScrollButtonPress
	ld a, $90
	jp PlaySound
.inLinkBattle
	ld c, $41
	jp DelayFrames
; 38ac (0:38ac)

; function to do multiplication
; all values are big endian
; INPUT
; FF96-FF98 =  multiplicand
; FF99 = multiplier
; OUTPUT
; FF95-FF98 = product
Multiply: ; 38ac (0:38ac)
	push hl
	push bc
	ld hl, _Multiply
	ld b, BANK(_Multiply)
	call Bankswitch
	pop bc
	pop hl
	ret

; function to do division
; all values are big endian
; INPUT
; FF95-FF98 = dividend
; FF99 = divisor
; b = number of bytes in the dividend (starting from FF95)
; OUTPUT
; FF95-FF98 = quotient
; FF99 = remainder
Divide: ; 38b9 (0:38b9)
	push hl
	push de
	push bc
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,$0d
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call _Divide
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	pop bc
	pop de
	pop hl
	ret

; This function is used to wait a short period after printing a letter to the
; screen unless the player presses the A/B button or the delay is turned off
; through the [$d730] or [$d358] flags.
PrintLetterDelay: ; 38d3 (0:38d3)
	ld a,[$d730]
	bit 6,a
	ret nz
	ld a,[$d358]
	bit 1,a
	ret z
	push hl
	push de
	push bc
	ld a,[$d358]
	bit 0,a
	jr z,.waitOneFrame
	ld a,[$d355]
	and a,$0f
	ld [H_FRAMECOUNTER],a
	jr .checkButtons
.waitOneFrame
	ld a,1
	ld [H_FRAMECOUNTER],a
.checkButtons
	call GetJoypadState
	ld a,[H_CURRENTPRESSEDBUTTONS]
.checkAButton
	bit 0,a ; is the A button pressed?
	jr z,.checkBButton
	jr .endWait
.checkBButton
	bit 1,a ; is the B button pressed?
	jr z,.buttonsNotPressed
.endWait
	call DelayFrame
	jr .done
.buttonsNotPressed ; if neither A nor B is pressed
	ld a,[H_FRAMECOUNTER]
	and a
	jr nz,.checkButtons
.done
	pop bc
	pop de
	pop hl
	ret

; Copies [hl, bc) to [de, bc - hl).
; In other words, the source data is from hl up to but not including bc,
; and the destination is de.
CopyDataUntil: ; 3913 (0:3913)
	ld a,[hli]
	ld [de],a
	inc de
	ld a,h
	cp b
	jr nz,CopyDataUntil
	ld a,l
	cp c
	jr nz,CopyDataUntil
	ret

; Function to remove a pokemon from the party or the current box.
; W_WHICHPOKEMON determines the pokemon.
; [$cf95] == 0 specifies the party.
; [$cf95] != 0 specifies the current box.
RemovePokemon: ; 391f (0:391f)
	ld hl, _RemovePokemon
	ld b, BANK(_RemovePokemon)
	jp Bankswitch

AddPokemonToParty: ; 3927 (0:3927)
	push hl
	push de
	push bc
	ld b, BANK(_AddPokemonToParty)
	ld hl, _AddPokemonToParty
	call Bankswitch
	pop bc
	pop de
	pop hl
	ret

; calculates all 5 stats of current mon and writes them to [de]
CalcStats: ; 3936 (0:3936)
	ld c, $0
.statsLoop
	inc c
	call CalcStat
	ld a, [H_MULTIPLICAND+1]
	ld [de], a
	inc de
	ld a, [H_MULTIPLICAND+2]
	ld [de], a
	inc de
	ld a, c
	cp $5
	jr nz, .statsLoop
	ret

; calculates stat c of current mon
; c: stat to calc (HP=1,Atk=2,Def=3,Spd=4,Spc=5)
; b: consider stat exp?
; hl: base ptr to stat exp values ([hl + 2*c - 1] and [hl + 2*c])
CalcStat: ; 394a (0:394a)
	push hl
	push de
	push bc
	ld a, b
	ld d, a
	push hl
	ld hl, W_MONHEADER
	ld b, $0
	add hl, bc
	ld a, [hl]          ; read base value of stat
	ld e, a
	pop hl
	push hl
	sla c
	ld a, d
	and a
	jr z, .statExpDone  ; consider stat exp?
	add hl, bc          ; skip to corresponding stat exp value
.statExpLoop            ; calculates ceil(Sqrt(stat exp)) in b
	xor a
	ld [H_MULTIPLICAND], a
	ld [H_MULTIPLICAND+1], a
	inc b               ; increment current stat exp bonus
	ld a, b
	cp $ff
	jr z, .statExpDone
	ld [H_MULTIPLICAND+2], a
	ld [H_MULTIPLIER], a
	call Multiply
	ld a, [hld]
	ld d, a
	ld a, [$FF00+$98]
	sub d
	ld a, [hli]
	ld d, a
	ld a, [$FF00+$97]
	sbc d               ; test if (current stat exp bonus)^2 < stat exp
	jr c, .statExpLoop
.statExpDone
	srl c
	pop hl
	push bc
	ld bc, $b           ; skip to stat IV values
	add hl, bc
	pop bc
	ld a, c
	cp $2
	jr z, .getAttackIV
	cp $3
	jr z, .getDefenseIV
	cp $4
	jr z, .getSpeedIV
	cp $5
	jr z, .getSpecialIV
.getHpIV
	push bc
	ld a, [hl]  ; Atk IV
	swap a
	and $1
	sla a
	sla a
	sla a
	ld b, a
	ld a, [hli] ; Def IV
	and $1
	sla a
	sla a
	add b
	ld b, a
	ld a, [hl] ; Spd IV
	swap a
	and $1
	sla a
	add b
	ld b, a
	ld a, [hl] ; Spc IV
	and $1
	add b      ; HP IV: LSB of the other 4 IVs
	pop bc
	jr .calcStatFromIV
.getAttackIV
	ld a, [hl]
	swap a
	and $f
	jr .calcStatFromIV
.getDefenseIV
	ld a, [hl]
	and $f
	jr .calcStatFromIV
.getSpeedIV
	inc hl
	ld a, [hl]
	swap a
	and $f
	jr .calcStatFromIV
.getSpecialIV
	inc hl
	ld a, [hl]
	and $f
.calcStatFromIV
	ld d, $0
	add e
	ld e, a
	jr nc, .noCarry
	inc d                     ; de = Base + IV
.noCarry
	sla e
	rl d                      ; de = (Base + IV) * 2
	srl b
	srl b                     ; b = ceil(Sqrt(stat exp)) / 4
	ld a, b
	add e
	jr nc, .noCarry2
	inc d                     ; da = (Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4
.noCarry2
	ld [H_MULTIPLICAND+2], a
	ld a, d
	ld [H_MULTIPLICAND+1], a
	xor a
	ld [H_MULTIPLICAND], a
	ld a, [W_CURENEMYLVL] ; $d127
	ld [H_MULTIPLIER], a
	call Multiply            ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level
	ld a, [H_MULTIPLICAND]
	ld [H_DIVIDEND], a
	ld a, [H_MULTIPLICAND+1]
	ld [H_DIVIDEND+1], a
	ld a, [H_MULTIPLICAND+2]
	ld [H_DIVIDEND+2], a
	ld a, $64
	ld [H_DIVISOR], a
	ld a, $3
	ld b, a
	call Divide             ; (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100
	ld a, c
	cp $1
	ld a, $5
	jr nz, .notHPStat
	ld a, [W_CURENEMYLVL] ; $d127
	ld b, a
	ld a, [H_MULTIPLICAND+2]
	add b
	ld [H_MULTIPLICAND+2], a
	jr nc, .noCarry3
	ld a, [H_MULTIPLICAND+1]
	inc a
	ld [H_MULTIPLICAND+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level
.noCarry3
	ld a, $a
.notHPStat
	ld b, a
	ld a, [H_MULTIPLICAND+2]
	add b
	ld [H_MULTIPLICAND+2], a
	jr nc, .noCarry4
	ld a, [H_MULTIPLICAND+1]
	inc a                    ; non-HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + 5
	ld [H_MULTIPLICAND+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10
.noCarry4
	ld a, [H_MULTIPLICAND+1] ; check for overflow (>999)
	cp $4
	jr nc, .overflow
	cp $3
	jr c, .noOverflow
	ld a, [H_MULTIPLICAND+2]
	cp $e8
	jr c, .noOverflow
.overflow
	ld a, $3                 ; overflow: cap at 999
	ld [H_MULTIPLICAND+1], a
	ld a, $e7
	ld [H_MULTIPLICAND+2], a
.noOverflow
	pop bc
	pop de
	pop hl
	ret

; no known jump sources
AddEnemyMonToPlayerParty: ; 3a53 (0:3a53)
	ld a, [H_LOADEDROMBANK]
	push af
	ld a, BANK(_AddEnemyMonToPlayerParty)
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	call _AddEnemyMonToPlayerParty
	pop bc
	ld a, b
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ret
; 0x3a68

; known jump sources: 215e8 (8:55e8), 2165c (8:565c)
Func_3a68: ; 3a68 (0:3a68)
	ld a, [H_LOADEDROMBANK]
	push af
	ld a, BANK(Func_f51e)
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	call Func_f51e
	pop bc
	ld a, b
	ld [H_LOADEDROMBANK], a
	ld [$2000], a
	ret

; skips a text entries, each of size $b (like trainer name, OT name, rival name, ...)
; hl: base pointer, will be incremented by $b * a
SkipFixedLengthTextEntries: ; 3a7d (0:3a7d)
	and a
	ret z
	ld bc, $b
.skipLoop
	add hl, bc
	dec a
	jr nz, .skipLoop
	ret
; 3a87 (0:3a87)

AddNTimes: ; 3a87 (0:3a87)
; add bc to hl a times
	and a
	ret z
.loop
	add hl,bc
	dec a
	jr nz,.loop
	ret

; Compare strings, c bytes in length, at de and hl.
; Often used to compare big endian numbers in battle calculations.
StringCmp: ; 3a8e (0:3a8e)
	ld a,[de]
	cp [hl]
	ret nz
	inc de
	inc hl
	dec c
	jr nz,StringCmp
	ret

; INPUT:
; a = oam block index (each block is 4 oam entries)
; b = Y coordinate of upper left corner of sprite
; c = X coordinate of upper left corner of sprite
; de = base address of 4 tile number and attribute pairs
WriteOAMBlock: ; 3a97 (0:3a97)
	ld h,$c3
	swap a ; multiply by 16
	ld l,a
	call .writeOneEntry ; upper left
	push bc
	ld a,8
	add c
	ld c,a
	call .writeOneEntry ; upper right
	pop bc
	ld a,8
	add b
	ld b,a
	call .writeOneEntry ; lower left
	ld a,8
	add c
	ld c,a
	                      ; lower right
.writeOneEntry
	ld [hl],b ; Y coordinate
	inc hl
	ld [hl],c ; X coordinate
	inc hl
	ld a,[de] ; tile number
	inc de
	ld [hli],a
	ld a,[de] ; attribute
	inc de
	ld [hli],a
	ret

HandleMenuInput: ; 3abe (0:3abe)
	xor a
	ld [$d09b],a

HandleMenuInputPokemonSelection: ; 3ac2 (0:3ac2)
	ld a,[H_DOWNARROWBLINKCNT1]
	push af
	ld a,[H_DOWNARROWBLINKCNT2]
	push af ; save existing values on stack
	xor a
	ld [H_DOWNARROWBLINKCNT1],a ; blinking down arrow timing value 1
	ld a,$06
	ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2
.loop1
	xor a
	ld [$d08b],a ; counter for pokemon shaking animation
	call PlaceMenuCursor
	call Delay3
.loop2
	push hl
	ld a,[$d09b]
	and a ; is it a pokemon selection menu?
	jr z,.getJoypadState
	ld b, BANK(Func_716ff)
	ld hl, Func_716ff ; shake mini sprite of selected pokemon
	call Bankswitch
.getJoypadState
	pop hl
	call GetJoypadStateLowSensitivity
	ld a,[$ffb5]
	and a ; was a key pressed?
	jr nz,.keyPressed
	push hl
	FuncCoord 18,11 ; coordinates of blinking down arrow in some menus
	ld hl,Coord
	call HandleDownArrowBlinkTiming ; blink down arrow (if any)
	pop hl
	ld a,[W_MENUJOYPADPOLLCOUNT]
	dec a
	jr z,.giveUpWaiting
	jr .loop2
.giveUpWaiting
; if a key wasn't pressed within the specified number of checks
	pop af
	ld [H_DOWNARROWBLINKCNT2],a
	pop af
	ld [H_DOWNARROWBLINKCNT1],a ; restore previous values
	xor a
	ld [W_MENUWRAPPINGENABLED],a ; disable menu wrapping
	ret
.keyPressed
	xor a
	ld [$cc4b],a
	ld a,[$ffb5]
	ld b,a
	bit 6,a ; pressed Up key?
	jr z,.checkIfDownPressed
.upPressed
	ld a,[W_CURMENUITEMID] ; selected menu item
	and a ; already at the top of the menu?
	jr z,.alreadyAtTop
.notAtTop
	dec a
	ld [W_CURMENUITEMID],a ; move selected menu item up one space
	jr .checkOtherKeys
.alreadyAtTop
	ld a,[W_MENUWRAPPINGENABLED]
	and a ; is wrapping around enabled?
	jr z,.noWrappingAround
	ld a,[W_MAXMENUITEMID]
	ld [W_CURMENUITEMID],a ; wrap to the bottom of the menu
	jr .checkOtherKeys
.checkIfDownPressed
	bit 7,a
	jr z,.checkOtherKeys
.downPressed
	ld a,[W_CURMENUITEMID]
	inc a
	ld c,a
	ld a,[W_MAXMENUITEMID]
	cp c
	jr nc,.notAtBottom
.alreadyAtBottom
	ld a,[W_MENUWRAPPINGENABLED]
	and a ; is wrapping around enabled?
	jr z,.noWrappingAround
	ld c,$00 ; wrap from bottom to top
.notAtBottom
	ld a,c
	ld [W_CURMENUITEMID],a
.checkOtherKeys
	ld a,[W_MENUWATCHEDKEYS]
	and b ; does the menu care about any of the pressed keys?
	jp z,.loop1
.checkIfAButtonOrBButtonPressed
	ld a,[$ffb5]
	and a,%00000011 ; pressed A button or B button?
	jr z,.skipPlayingSound
.AButtonOrBButtonPressed
	push hl
	ld hl,W_FLAGS_CD60
	bit 5,[hl]
	pop hl
	jr nz,.skipPlayingSound
	ld a,$90
	call PlaySound ; play sound
.skipPlayingSound
	pop af
	ld [H_DOWNARROWBLINKCNT2],a
	pop af
	ld [H_DOWNARROWBLINKCNT1],a ; restore previous values
	xor a
	ld [W_MENUWRAPPINGENABLED],a ; disable menu wrapping
	ld a,[$ffb5]
	ret
.noWrappingAround
	ld a,[$cc37]
	and a ; should we return if the user tried to go past the top or bottom?
	jr z,.checkOtherKeys
	jr .checkIfAButtonOrBButtonPressed

PlaceMenuCursor: ; 3b7c (0:3b7c)
	ld a,[W_TOPMENUITEMY]
	and a ; is the y coordinate 0?
	jr z,.adjustForXCoord
	ld hl,W_SCREENTILESBUFFER
	ld bc,20 ; screen width
.topMenuItemLoop
	add hl,bc
	dec a
	jr nz,.topMenuItemLoop
.adjustForXCoord
	ld a,[W_TOPMENUITEMX]
	ld b,$00
	ld c,a
	add hl,bc
	push hl
	ld a,[W_OLDMENUITEMID]
	and a ; was the previous menu id 0?
	jr z,.checkForArrow1
	push af
	ld a,[$fff6]
	bit 1,a ; is the menu double spaced?
	jr z,.doubleSpaced1
	ld bc,20
	jr .getOldMenuItemScreenPosition
.doubleSpaced1
	ld bc,40
.getOldMenuItemScreenPosition
	pop af
.oldMenuItemLoop
	add hl,bc
	dec a
	jr nz,.oldMenuItemLoop
.checkForArrow1
	ld a,[hl]
	cp a,"▶" ; was an arrow next to the previously selected menu item?
	jr nz,.skipClearingArrow
.clearArrow
	ld a,[W_TILEBEHINDCURSOR]
	ld [hl],a
.skipClearingArrow
	pop hl
	ld a,[W_CURMENUITEMID]
	and a
	jr z,.checkForArrow2
	push af
	ld a,[$fff6]
	bit 1,a ; is the menu double spaced?
	jr z,.doubleSpaced2
	ld bc,20
	jr .getCurrentMenuItemScreenPosition
.doubleSpaced2
	ld bc,40
.getCurrentMenuItemScreenPosition
	pop af
.currentMenuItemLoop
	add hl,bc
	dec a
	jr nz,.currentMenuItemLoop
.checkForArrow2
	ld a,[hl]
	cp a,"▶" ; has the right arrow already been placed?
	jr z,.skipSavingTile ; if so, don't lose the saved tile
	ld [W_TILEBEHINDCURSOR],a ; save tile before overwriting with right arrow
.skipSavingTile
	ld a,"▶" ; place right arrow
	ld [hl],a
	ld a,l
	ld [W_MENUCURSORLOCATION],a
	ld a,h
	ld [W_MENUCURSORLOCATION + 1],a
	ld a,[W_CURMENUITEMID]
	ld [W_OLDMENUITEMID],a
	ret

; This is used to mark a menu cursor other than the one currently being
; manipulated. In the case of submenus, this is used to show the location of
; the menu cursor in the parent menu. In the case of swapping items in list,
; this is used to mark the item that was first chosen to be swapped.
PlaceUnfilledArrowMenuCursor: ; 3bec (0:3bec)
	ld b,a
	ld a,[W_MENUCURSORLOCATION]
	ld l,a
	ld a,[W_MENUCURSORLOCATION + 1]
	ld h,a
	ld [hl],$ec ; outline of right arrow
	ld a,b
	ret

; Replaces the menu cursor with a blank space.
EraseMenuCursor: ; 3bf9 (0:3bf9)
	ld a,[W_MENUCURSORLOCATION]
	ld l,a
	ld a,[W_MENUCURSORLOCATION + 1]
	ld h,a
	ld [hl]," "
	ret

; This toggles a blinking down arrow at hl on and off after a delay has passed.
; This is often called even when no blinking is occurring.
; The reason is that most functions that call this initialize H_DOWNARROWBLINKCNT1 to 0.
; The effect is that if the tile at hl is initialized with a down arrow,
; this function will toggle that down arrow on and off, but if the tile isn't
; initliazed with a down arrow, this function does nothing.
; That allows this to be called without worrying about if a down arrow should
; be blinking.
HandleDownArrowBlinkTiming: ; 3c04 (0:3c04)
	ld a,[hl]
	ld b,a
	ld a,$ee ; down arrow
	cp b
	jr nz,.downArrowOff
.downArrowOn
	ld a,[H_DOWNARROWBLINKCNT1]
	dec a
	ld [H_DOWNARROWBLINKCNT1],a
	ret nz
	ld a,[H_DOWNARROWBLINKCNT2]
	dec a
	ld [H_DOWNARROWBLINKCNT2],a
	ret nz
	ld a," "
	ld [hl],a
	ld a,$ff
	ld [H_DOWNARROWBLINKCNT1],a
	ld a,$06
	ld [H_DOWNARROWBLINKCNT2],a
	ret
.downArrowOff
	ld a,[H_DOWNARROWBLINKCNT1]
	and a
	ret z
	dec a
	ld [H_DOWNARROWBLINKCNT1],a
	ret nz
	dec a
	ld [H_DOWNARROWBLINKCNT1],a
	ld a,[H_DOWNARROWBLINKCNT2]
	dec a
	ld [H_DOWNARROWBLINKCNT2],a
	ret nz
	ld a,$06
	ld [H_DOWNARROWBLINKCNT2],a
	ld a,$ee ; down arrow
	ld [hl],a
	ret

; The following code either enables or disables the automatic drawing of
; text boxes by DisplayTextID. Both functions cause DisplayTextID to wait
; for a button press after displaying text (unless [$cc47] is set).

EnableAutoTextBoxDrawing: ; 3c3c (0:3c3c)
	xor a
	jr AutoTextBoxDrawingCommon

DisableAutoTextBoxDrawing: ; 3c3f (0:3c3f)
	ld a,$01

AutoTextBoxDrawingCommon: ; 3c41 (0:3c41)
	ld [$cf0c],a ; control text box drawing
	xor a
	ld [$cc3c],a ; make DisplayTextID wait for button press
	ret

PrintText: ; 3c49 (0:3c49)
; given a pointer in hl, print the text there
	push hl
	ld a,1
	ld [$D125],a
	call DisplayTextBoxID
	call UpdateSprites
	call Delay3
	pop hl
Func_3c59: ; 3c59 (0:3c59)
	FuncCoord 1,14
	ld bc,Coord ;$C4B9
	jp TextCommandProcessor

; converts a big-endian binary number into decimal and prints it
; INPUT:
; b = flags and number of bytes
; bit 7: if set, print leading zeroes
;        if unset, do not print leading zeroes
; bit 6: if set, left-align the string (do not pad empty digits with spaces)
;        if unset, right-align the string
; bits 4-5: unused
; bits 0-3: number of bytes (only 1 - 3 bytes supported)
; c = number of decimal digits
; de = address of the number (big-endian)
PrintNumber: ; 3c5f (0:3c5f)
	push bc
	xor a
	ld [H_PASTLEADINGZEROES],a
	ld [H_NUMTOPRINT],a
	ld [H_NUMTOPRINT + 1],a
	ld a,b
	and a,%00001111
	cp a,1
	jr z,.oneByte
	cp a,2
	jr z,.twoBytes
.threeBytes
	ld a,[de]
	ld [H_NUMTOPRINT],a
	inc de
	ld a,[de]
	ld [H_NUMTOPRINT + 1],a
	inc de
	ld a,[de]
	ld [H_NUMTOPRINT + 2],a
	jr .checkNumDigits
.twoBytes
	ld a,[de]
	ld [H_NUMTOPRINT + 1],a
	inc de
	ld a,[de]
	ld [H_NUMTOPRINT + 2],a
	jr .checkNumDigits
.oneByte
	ld a,[de]
	ld [H_NUMTOPRINT + 2],a
.checkNumDigits
	push de
	ld d,b
	ld a,c
	ld b,a
	xor a
	ld c,a
	ld a,b ; a = number of decimal digits
	cp a,2
	jr z,.tensPlace
	cp a,3
	jr z,.hundredsPlace
	cp a,4
	jr z,.thousandsPlace
	cp a,5
	jr z,.tenThousandsPlace
	cp a,6
	jr z,.hundredThousandsPlace
.millionsPlace
	ld a,1000000 >> 16
	ld [H_POWEROFTEN],a
	ld a,(1000000 >> 8) & $FF
	ld [H_POWEROFTEN + 1],a
	ld a,1000000 & $FF
	ld [H_POWEROFTEN + 2],a
	call PrintNumber_PrintDigit
	call PrintNumber_AdvancePointer
.hundredThousandsPlace
	ld a,100000 >> 16
	ld [H_POWEROFTEN],a
	ld a,(100000 >> 8) & $FF
	ld [H_POWEROFTEN + 1],a
	ld a,100000 & $FF
	ld [H_POWEROFTEN + 2],a
	call PrintNumber_PrintDigit
	call PrintNumber_AdvancePointer
.tenThousandsPlace
	xor a
	ld [H_POWEROFTEN],a
	ld a,10000 >> 8
	ld [H_POWEROFTEN + 1],a
	ld a,10000 & $FF
	ld [H_POWEROFTEN + 2],a
	call PrintNumber_PrintDigit
	call PrintNumber_AdvancePointer
.thousandsPlace
	xor a
	ld [H_POWEROFTEN],a
	ld a,1000 >> 8
	ld [H_POWEROFTEN + 1],a
	ld a,1000 & $FF
	ld [H_POWEROFTEN + 2],a
	call PrintNumber_PrintDigit
	call PrintNumber_AdvancePointer
.hundredsPlace
	xor a
	ld [H_POWEROFTEN],a
	xor a
	ld [H_POWEROFTEN + 1],a
	ld a,100
	ld [H_POWEROFTEN + 2],a
	call PrintNumber_PrintDigit
	call PrintNumber_AdvancePointer
.tensPlace
	ld c,00
	ld a,[H_NUMTOPRINT + 2]
.loop
	cp a,10
	jr c,.underflow
	sub a,10
	inc c
	jr .loop
.underflow
	ld b,a
	ld a,[H_PASTLEADINGZEROES]
	or c
	ld [H_PASTLEADINGZEROES],a
	jr nz,.pastLeadingZeroes
	call PrintNumber_PrintLeadingZero
	jr .advancePointer
.pastLeadingZeroes
	ld a,"0"
	add c
	ld [hl],a
.advancePointer
	call PrintNumber_AdvancePointer
.onesPlace
	ld a,"0"
	add b
	ld [hli],a
	pop de
	dec de
	pop bc
	ret

; prints a decimal digit
; This works by repeatedely subtracting a power of ten until the number becomes negative.
; The number of subtractions it took in order to make the number negative is the digit for the current number place.
; The last value that the number had before becoming negative is kept as the new value of the number.
; A more succinct description is that the number is divided by a power of ten
; and the quotient becomes the digit while the remainder is stored as the new value of the number.
PrintNumber_PrintDigit: ; 3d25 (0:3d25)
	ld c,0 ; counts number of loop iterations to determine the decimal digit
.loop
	ld a,[H_POWEROFTEN]
	ld b,a
	ld a,[H_NUMTOPRINT]
	ld [H_SAVEDNUMTOPRINT],a
	cp b
	jr c,.underflow0
	sub b
	ld [H_NUMTOPRINT],a
	ld a,[H_POWEROFTEN + 1]
	ld b,a
	ld a,[H_NUMTOPRINT + 1]
	ld [H_SAVEDNUMTOPRINT + 1],a
	cp b
	jr nc,.noBorrowForByte1
.byte1BorrowFromByte0
	ld a,[H_NUMTOPRINT]
	or a,0
	jr z,.underflow1
	dec a
	ld [H_NUMTOPRINT],a
	ld a,[H_NUMTOPRINT + 1]
.noBorrowForByte1
	sub b
	ld [H_NUMTOPRINT + 1],a
	ld a,[H_POWEROFTEN + 2]
	ld b,a
	ld a,[H_NUMTOPRINT + 2]
	ld [H_SAVEDNUMTOPRINT + 2],a
	cp b
	jr nc,.noBorrowForByte2
.byte2BorrowFromByte1
	ld a,[H_NUMTOPRINT + 1]
	and a
	jr nz,.finishByte2BorrowFromByte1
.byte2BorrowFromByte0
	ld a,[H_NUMTOPRINT]
	and a
	jr z,.underflow2
	dec a
	ld [H_NUMTOPRINT],a
	xor a
.finishByte2BorrowFromByte1
	dec a
	ld [H_NUMTOPRINT + 1],a
	ld a,[H_NUMTOPRINT + 2]
.noBorrowForByte2
	sub b
	ld [H_NUMTOPRINT + 2],a
	inc c
	jr .loop
.underflow2
	ld a,[H_SAVEDNUMTOPRINT + 1]
	ld [H_NUMTOPRINT + 1],a
.underflow1
	ld a,[H_SAVEDNUMTOPRINT]
	ld [H_NUMTOPRINT],a
.underflow0
	ld a,[H_PASTLEADINGZEROES]
	or c
	jr z,PrintNumber_PrintLeadingZero
	ld a,"0"
	add c
	ld [hl],a
	ld [H_PASTLEADINGZEROES],a
	ret

; prints a leading zero unless they are turned off in the flags
PrintNumber_PrintLeadingZero: ; 3d83 (0:3d83)
	bit 7,d ; print leading zeroes?
	ret z
	ld [hl],"0"
	ret

; increments the pointer unless leading zeroes are not being printed,
; the number is left-aligned, and no nonzero digits have been printed yet
PrintNumber_AdvancePointer: ; 3d89 (0:3d89)
	bit 7,d ; print leading zeroes?
	jr nz,.incrementPointer
	bit 6,d ; left alignment or right alignment?
	jr z,.incrementPointer
	ld a,[H_PASTLEADINGZEROES]
	and a
	ret z
.incrementPointer
	inc hl
	ret

; calls a function from a table of function pointers
; INPUT:
; a = index within table
; hl = address of function pointer table
CallFunctionInTable: ; 3d97 (0:3d97)
	push hl
	push de
	push bc
	add a
	ld d,0
	ld e,a
	add hl,de
	ld a,[hli]
	ld h,[hl]
	ld l,a
	ld de,.returnAddress
	push de
	jp [hl]
.returnAddress
	pop bc
	pop de
	pop hl
	ret

; searches an array at hl for the value in a.
; skips (de − 1) bytes between reads, so to check every byte, de should be 1.
; if found, returns count in b and sets carry.
IsInArray: ; 3dab (0:3dab)
	ld b,0
	; fall through

IsInArrayCummulativeCount: ; 3dad (0:3dad)
	ld c,a
.loop
	ld a,[hl]
	cp a,$FF
	jr z,.NotInArray
	cp c
	jr z,.InArray
	inc b
	add hl,de
	jr .loop
.NotInArray
	and a
	ret
.InArray
	scf
	ret

; known jump sources: 656e (1:656e), ef9e (3:6f9e), 130ce (4:70ce), 132d9 (4:72d9), 133f9 (4:73f9), 1da79 (7:5a79), 71ca5 (1c:5ca5)
Func_3dbe: ; 3dbe (0:3dbe)
	call CleanLCD_OAM
	ld a, $1
	ld [$cfcb], a
	call Func_3e08
	call LoadScreenTilesFromBuffer2
	call LoadTextBoxTilePatterns
	call GoPAL_SET_CF1C
	jr Delay3
; 3dd4 (0:3dd4)
; calls GBPalWhiteOut and then Delay3
GBPalWhiteOutWithDelay3: ; 3dd4 (0:3dd4)
	call GBPalWhiteOut

Delay3: ; 3dd7 (0:3dd7)
; call Delay with a parameter of 3
	ld c,3
	jp DelayFrames

; resets BGP and OBP0 to their usual colors
GBPalNormal: ; 3ddc (0:3ddc)
	ld a,%11100100
	ld [rBGP],a
	ld a,%11010000
	ld [rOBP0],a
	ret

; makes all palette colors white
GBPalWhiteOut: ; 3de5 (0:3de5)
	xor a
	ld [rBGP],a
	ld [rOBP0],a
	ld [rOBP1],a
	ret

GoPAL_SET_CF1C: ; 3ded (0:3ded)
	ld b,$ff
GoPAL_SET: ; 3def (0:3def)
	ld a,[$cf1b]
	and a
	ret z
	ld a,$45
	jp Predef

; known jump sources: 129eb (4:69eb), 12ed1 (4:6ed1), 3ce91 (f:4e91)
Func_3df9: ; 3df9 (0:3df9)
	ld a, e
	cp $1b
	ld d, $0
	jr nc, .asm_3e06
	cp $a
	inc d
	jr nc, .asm_3e06
	inc d
.asm_3e06
	ld [hl], d
	ret

; known jump sources: 3dc6 (0:3dc6), 653b (1:653b)
Func_3e08: ; 3e08 (0:3e08)
	ld hl, $cfc4
	ld a, [hl]
	push af
	res 0, [hl]
	push hl
	xor a
	ld [W_SPRITESETID], a ; $d3a8
	call DisableLCD
	ld b, BANK(InitMapSprites)
	ld hl, InitMapSprites
	call Bankswitch ; indirect jump to InitMapSprites (1785b (5:785b))
	call EnableLCD
	pop hl
	pop af
	ld [hl], a
	call LoadPlayerSpriteGraphics
	call LoadFontTilePatterns
	jp UpdateSprites
; 3e2e (0:3e2e)

GiveItem: ; 3e2e (0:3e2e)
; Give player quantity c of item b, and copy item name to $cf4b.
; Set carry on success. If no room in bag, reset carry.
	ld a, b
	ld [$d11e], a
	ld [$cf91], a
	ld a, c
	ld [$cf96], a
	ld hl,W_NUMBAGITEMS
	call AddItemToInventory
	ret nc
	call GetItemName ; $2fcf
	call CopyStringToCF4B
	scf
	ret

GivePokemon: ; 3e48 (0:3e48)
	ld a, b
	ld [$cf91], a
	ld a, c
	ld [$d127], a
	xor a
	ld [$cc49], a
	ld b, BANK(Func_4fda5)
	ld hl, Func_4fda5
	jp Bankswitch

GenRandom: ; 3e5c (0:3e5c)
; store a random 8-bit value in a
	push hl
	push de
	push bc
	ld b,BANK(GenRandom_)
	ld hl,GenRandom_
	call Bankswitch
	ld a,[H_RAND1]
	pop bc
	pop de
	pop hl
	ret

Predef: ; 3e6d (0:3e6d)
; runs a predefined ASM command, where the command ID is read from $D0B7
; $3E6D grabs the ath pointer from PredefPointers and executes it

	ld [$CC4E],a ; save the predef routine's ID for later

	ld a,[H_LOADEDROMBANK]
	ld [$CF12],a

	; save bank and call 13:7E49
	push af
	ld a,BANK(GetPredefPointer)
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	call GetPredefPointer

	; call the predef function
	; ($D0B7 has the bank of the predef routine)
	ld a,[$D0B7]
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ld de,.Return
	push de
	jp [hl]
	; after the predefined function finishes it returns here
.Return
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ret

;loads hl from cc4f, de from cc51, and bc from cc53

Load16BitRegisters: ; 3e94 (0:3e94)
	ld a, [$cc4f]
	ld h, a
	ld a, [$cc50]
	ld l, a
	ld a, [$cc51]
	ld d, a
	ld a, [$cc52]
	ld e, a
	ld a, [$cc53]
	ld b, a
	ld a, [$cc54]
	ld c, a
	ret
; 0x3ead

; known jump sources: 75769 (1d:5769), 75837 (1d:5837)
Func_3ead: ; 3ead (0:3ead)
	ld b, BANK(Func_1eb0a)
	ld hl, Func_1eb0a
	jp Bankswitch ; indirect jump to Func_1eb0a (1eb0a (7:6b0a))

; known jump sources: 46b (0:46b)
Func_3eb5: ; 3eb5 (0:3eb5)
	ld a, [H_LOADEDROMBANK]
	push af
	ld a, [H_CURRENTPRESSEDBUTTONS]
	bit 0, a
	jr z, .asm_3eea
	ld a, $11
	ld [$2000], a
	ld [H_LOADEDROMBANK], a
	call Func_469a0
	ld a, [$FF00+$ee]
	and a
	jr nz, .asm_3edd
	ld a, [$cd3e]
	ld [$2000], a
	ld [H_LOADEDROMBANK], a
	ld de, $3eda
	push de
	jp [hl]
	xor a
	jr .asm_3eec
.asm_3edd
	ld b, BANK(Func_fb50)
	ld hl, Func_fb50
	call Bankswitch ; indirect jump to Func_fb50 (fb50 (3:7b50))
	ld a, [$FF00+$db]
	and a
	jr z, .asm_3eec
.asm_3eea
	ld a, $ff
.asm_3eec
	ld [$FF00+$eb], a
	pop af
	ld [$2000], a
	ld [H_LOADEDROMBANK], a
	ret

; known jump sources: fb74 (3:7b74), 1ea22 (7:6a22), 1eb88 (7:6b88), 1eb92 (7:6b92), 1ebd9 (7:6bd9), 526ab (14:66ab), 526e0 (14:66e0), 5dbba (17:5bba), 5dbd0 (17:5bd0), 5de0e (17:5e0e), 5de7a (17:5e7a), 62526 (18:6526), 766b5 (1d:66b5)
Func_3ef5: ; 3ef5 (0:3ef5)
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	ld hl, $3f22
	call Func_3f0f
	ld hl, $cf11
	set 0, [hl]
	call DisplayTextID

; known jump sources: 738f4 (1c:78f4)
Func_3f05: ; 3f05 (0:3f05)
	ld hl, W_MAPTEXTPTR ; $d36c
	ld a, [$FF00+$ec]
	ld [hli], a
	ld a, [$FF00+$ed]
	ld [hl], a
	ret

; known jump sources: 3efa (0:3efa), 738fd (1c:78fd)
Func_3f0f: ; 3f0f (0:3f0f)
	ld a, [W_MAPTEXTPTR] ; $d36c
	ld [$FF00+$ec], a
	ld a, [$d36d]
	ld [$FF00+$ed], a
	ld a, l
	ld [W_MAPTEXTPTR], a ; $d36c
	ld a, h
	ld [$d36d], a
	ret
; 3f22 (0:3f22)
; 0x3F22
	dw $66ee
	dw $66f8
	dw $5b8e
	dw $5b81
	dw $6960
	dw $697e
	dw $6983
	dw $6cbd
	dw $5bbe
	dw $5ba8
	dw $5bd4
	dw $6453
	dw $6458
	dw $6511
	dw $64a3
	dw $64a8
	dw $64ad
	dw $64b2
	dw $64d0
	dw $64d5
	dw $6502
	dw $64da
	dw $64df
	dw $64e4
	dw $64b7
	dw $64bc
	dw $64c1
	dw $64c6
	dw $64cb
	dw $6508
	dw $6529
	dw $69aa
	dw $5ced
	dw $5865
	dw $5878
	dw FoundHiddenItemText
	dw HiddenItemBagFullText
	dw $5df7
	dw $6a3d
	dw $7e79
	dw $7e7e
	dw $7e83
	dw FoundHiddenCoinsText
	dw DroppedHiddenCoinsText
	dw $6bdd
	dw $6be2
	dw $6c05
	dw $6b69
	dw $6a25
	dw $7f37
	dw $7f32
	dw $5c29
	dw $69a4
	dw $6a2a
	dw $6a10
	dw $6a1d
	dw $6953
	dw $7bbf
	dw $5ec8
	dw $5edb
	dw $5eef
	dw $5f02
	dw $7c12
	dw $7be8
	dw $7c0d
	dw $7c45

SECTION "bank1",ROMX,BANK[$1]

SpriteFacingAndAnimationTable: ; 4000 (1:4000)
dw SpriteFacingDownAndStanding, SpriteOAMParameters        ; facing down, walk animation frame 0
dw SpriteFacingDownAndWalking, SpriteOAMParameters         ; facing down, walk animation frame 1
dw SpriteFacingDownAndStanding, SpriteOAMParameters        ; facing down, walk animation frame 2
dw SpriteFacingDownAndWalking, SpriteOAMParametersFlipped  ; facing down, walk animation frame 3
dw SpriteFacingUpAndStanding, SpriteOAMParameters          ; facing up, walk animation frame 0
dw SpriteFacingUpAndWalking, SpriteOAMParameters           ; facing up, walk animation frame 1
dw SpriteFacingUpAndStanding, SpriteOAMParameters          ; facing up, walk animation frame 2
dw SpriteFacingUpAndWalking, SpriteOAMParametersFlipped    ; facing up, walk animation frame 3
dw SpriteFacingLeftAndStanding, SpriteOAMParameters        ; facing left, walk animation frame 0
dw SpriteFacingLeftAndWalking, SpriteOAMParameters         ; facing left, walk animation frame 1
dw SpriteFacingLeftAndStanding, SpriteOAMParameters        ; facing left, walk animation frame 2
dw SpriteFacingLeftAndWalking, SpriteOAMParameters         ; facing left, walk animation frame 3
dw SpriteFacingLeftAndStanding, SpriteOAMParametersFlipped ; facing right, walk animation frame 0
dw SpriteFacingLeftAndWalking, SpriteOAMParametersFlipped  ; facing right, walk animation frame 1
dw SpriteFacingLeftAndStanding, SpriteOAMParametersFlipped ; facing right, walk animation frame 2
dw SpriteFacingLeftAndWalking, SpriteOAMParametersFlipped  ; facing right, walk animation frame 3
dw SpriteFacingDownAndStanding, SpriteOAMParameters        ; ---
dw SpriteFacingDownAndStanding, SpriteOAMParameters        ; This table is used for sprites $a and $b.
dw SpriteFacingDownAndStanding, SpriteOAMParameters        ; All orientation and animation parameters
dw SpriteFacingDownAndStanding, SpriteOAMParameters        ; lead to the same result. Used for immobile
dw SpriteFacingDownAndStanding, SpriteOAMParameters        ; sprites like items on the ground
dw SpriteFacingDownAndStanding, SpriteOAMParameters        ; ---
dw SpriteFacingDownAndStanding, SpriteOAMParameters
dw SpriteFacingDownAndStanding, SpriteOAMParameters
dw SpriteFacingDownAndStanding, SpriteOAMParameters
dw SpriteFacingDownAndStanding, SpriteOAMParameters
dw SpriteFacingDownAndStanding, SpriteOAMParameters
dw SpriteFacingDownAndStanding, SpriteOAMParameters
dw SpriteFacingDownAndStanding, SpriteOAMParameters
dw SpriteFacingDownAndStanding, SpriteOAMParameters
dw SpriteFacingDownAndStanding, SpriteOAMParameters
dw SpriteFacingDownAndStanding, SpriteOAMParameters

SpriteFacingDownAndStanding: ; 4080 (1:4080)
	db $00,$01,$02,$03
SpriteFacingDownAndWalking: ; 4084 (1:4084)
	db $80,$81,$82,$83
SpriteFacingUpAndStanding: ; 4088 (1:4088)
	db $04,$05,$06,$07
SpriteFacingUpAndWalking: ; 408c (1:408c)
	db $84,$85,$86,$87
SpriteFacingLeftAndStanding: ; 4090 (1:4090)
	db $08,$09,$0a,$0b
SpriteFacingLeftAndWalking: ; 4094 (1:4094)
	db $88,$89,$8a,$8b

SpriteOAMParameters: ; 4098 (1:4098)
	db $00,$00, $00                                      ; top left
	db $00,$08, $00                                      ; top right
	db $08,$00, OAMFLAG_CANBEMASKED                      ; bottom left
	db $08,$08, OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA  ; bottom right
SpriteOAMParametersFlipped: ; 40a4 (1:40a4)
	db $00,$08, OAMFLAG_VFLIPPED
	db $00,$00, OAMFLAG_VFLIPPED
	db $08,$08, OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED
	db $08,$00, OAMFLAG_VFLIPPED | OAMFLAG_CANBEMASKED | OAMFLAG_ENDOFDATA

; known jump sources: 945 (0:945)
Func_40b0: ; 40b0 (1:40b0)
	xor a
	ld [$cf0b], a
	ld [$d700], a
	ld [W_ISINBATTLE], a ; $d057
	ld [$d35d], a
	ld [$cf10], a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [$cc57], a
	ld [W_FLAGS_CD60], a
	ld [$FF00+$9f], a
	ld [$FF00+$a0], a
	ld [$FF00+$a1], a
	call HasEnoughMoney
	jr c, .asm_40ff
	ld a, [W_PLAYERMONEY3] ; $d347
	ld [$FF00+$9f], a
	ld a, [W_PLAYERMONEY2] ; $d348
	ld [$FF00+$a0], a
	ld a, [W_PLAYERMONEY1] ; $d349
	ld [$FF00+$a1], a
	xor a
	ld [$FF00+$a2], a
	ld [$FF00+$a3], a
	ld a, $2
	ld [$FF00+$a4], a
	ld a, $d
	call Predef ; indirect jump to Func_f71e (f71e (3:771e))
	ld a, [$FF00+$a2]
	ld [W_PLAYERMONEY3], a ; $d347
	ld a, [$FF00+$a3]
	ld [W_PLAYERMONEY2], a ; $d348
	ld a, [$FF00+$a4]
	ld [W_PLAYERMONEY1], a ; $d349
.asm_40ff
	ld hl, $d732
	set 2, [hl]
	res 3, [hl]
	set 6, [hl]
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $7
	jp Predef ; indirect jump to HealParty (f6a5 (3:76a5))
; 4112 (1:4112)
MewPicFront: ; 4112 (1:4112)
	INCBIN "pic/bmon/mew.pic"
MewPicBack: ; 4205 (1:4205)
	INCBIN "pic/monback/mewb.pic"
; 0x425b

MewBaseStats: ; 425b (1:425b)
	db DEX_MEW ; pokedex id
	db 100 ; base hp
	db 100 ; base attack
	db 100 ; base defense
	db 100 ; base speed
	db 100 ; base special

	db PSYCHIC ; species type 1
	db PSYCHIC ; species type 2

	db 45 ; catch rate
	db 64 ; base exp yield
	db $55 ; sprite dimensions

	dw MewPicFront
	dw MewPicBack
	
	; attacks known at lvl 0
	db POUND
	db 0
	db 0
	db 0

	db 3 ; growth rate
	
	; include learnset directly
	db %11111111
	db %11111111
	db %11111111
	db %11111111
	db %11111111
	db %11111111
	db %11111111
	db %11111111 ; usually spacing

; known jump sources: 3c17f (f:417f)
Func_4277: ; 4277 (1:4277)
	ld hl, $cce9
	ld a, [hl]
	and a
	jr z, .asm_4284
	dec [hl]
	ld hl, UnnamedText_42a7 ; $42a7
	jr .asm_429f
.asm_4284
	dec hl
	ld a, [hl]
	and a
	ret z
	dec [hl]
	ld hl, UnnamedText_42ac ; $42ac
	jr nz, .asm_429f
	push hl
	ld a, [$cfe5]
	ld [$d0b5], a
	call GetMonHeader
	ld a, [W_MONHCATCHRATE]
	ld [$d007], a
	pop hl
.asm_429f
	push hl
	call LoadScreenTilesFromBuffer1
	pop hl
	jp PrintText
; 42a7 (1:42a7)
UnnamedText_42a7: ; 42a7 (1:42a7)
	TX_FAR SafariZoneEatingText
	db $50
; 0x42a7 + 5 bytes

UnnamedText_42ac: ; 42ac (1:42ac)
	TX_FAR SafariZoneAngryText
	db $50
; 0x42ac + 5 bytes

; copy text of fixed length $b (like player name, rival name, mon names, ...)
CopyFixedLengthText: ; 42b1 (1:42b1)
	ld bc, $b
	jp CopyData

Func_42b7: ; 42b7 (1:42b7)
	ld hl, NintenText
	ld de, W_PLAYERNAME ; $d158
	call CopyFixedLengthText
	ld hl, SonyText
	ld de, W_RIVALNAME ; $d34a
	call CopyFixedLengthText
	xor a
	ld [$FF00+$b0], a
	ld [$d358], a
	ld hl, $d732
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld a, $1f
	ld [$c0ef], a
	ld [$c0f0], a

; known jump sources: 5526 (1:5526), 5b89 (1:5b89)
Func_42dd: ; 42dd (1:42dd)
	call GBPalWhiteOut
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	xor a
	ld [$FF00+$d7], a
	ld [$FF00+$ae], a
	ld a, $40
	ld [$FF00+$af], a
	ld a, $90
	ld [$FF00+$b0], a
	call ClearScreen
	call DisableLCD
	call LoadFontTilePatterns
	ld hl, NintendoCopyrightLogoGraphics ; $60c8
	ld de, $9410
	ld bc, $50
	ld a, BANK(NintendoCopyrightLogoGraphics)
	call FarCopyData2
	ld hl, GamefreakLogoGraphics ; $61f8
	ld de, $9460
	ld bc, $90
	ld a, BANK(GamefreakLogoGraphics)
	call FarCopyData2
	ld hl, PokemonLogoGraphics ; $5380
	ld de, $8800
	ld bc, $600
	ld a, BANK(PokemonLogoGraphics)
	call FarCopyData2          ; first chunk
	ld hl, PokemonLogoGraphics+$600 ; $5980
	ld de, $9310
	ld bc, $100
	ld a, BANK(PokemonLogoGraphics)
	call FarCopyData2          ; second chunk
	ld hl, Version_GFX ; $402f
; 4335 (1:4335)
; 0x4335
IF _RED
	ld de,$9600 ; where to put redgreenversion.2bpp in the VRAM
	ld bc,$50 ; how big that file is
ENDC
IF _BLUE
	ld de,$9610 ; where to put blueversion.2bpp in the VRAM
	ld bc,$40 ; how big that file is
ENDC

	ld a, BANK(Version_GFX)
	call FarCopyDataDouble
	call Func_4519
	FuncCoord 2, 1 ; $c3b6
	ld hl, Coord
	ld a, $80
	ld de, $14
	ld c, $6
.asm_434d
	ld b, $10
	push hl
.asm_4350
	ld [hli], a
	inc a
	dec b
	jr nz, .asm_4350
	pop hl
	add hl, de
	dec c
	jr nz, .asm_434d
	FuncCoord 2, 7 ; $c42e
	ld hl, Coord
	ld a, $31
	ld b, $10
.asm_4361
	ld [hli], a
	inc a
	dec b
	jr nz, .asm_4361
	call Func_44dd
	ld hl, $c328
	ld a, $74
	ld [hl], a
	FuncCoord 2, 17 ; $c4f6
	ld hl, Coord
	ld de, .unknown_437f ; $437f
	ld b, $10
.asm_4377
	ld a, [de]
	ld [hli], a
	inc de
	dec b
	jr nz, .asm_4377
	jr .asm_438f

.unknown_437f ; 437f (1:437f)
INCBIN "baserom.gbc",$437f,$438f - $437f

.asm_438f
	call SaveScreenTilesToBuffer2
	call LoadScreenTilesFromBuffer2
	call EnableLCD
; 4398 (1:4398)
IF _RED
	ld a,CHARMANDER ; which Pokemon to show first on the title screen
ENDC
IF _BLUE
	ld a,SQUIRTLE ; which Pokemon to show first on the title screen
ENDC

	ld [W_WHICHTRADE], a ; $cd3d
	call Func_4524
	ld a, $9b
	call Func_4533
	call SaveScreenTilesToBuffer1
	ld a, $40
	ld [$FF00+$b0], a
	call LoadScreenTilesFromBuffer2
	ld a, $98
	call Func_4533
	ld b, $6
	call GoPAL_SET
	call GBPalNormal
	ld a, $e4
	ld [rOBP0], a ; $FF00+$48
	ld bc, $ffaf
	ld hl, .unknown_43db ; $43db
.asm_43c6
	ld a, [hli]
	and a
	jr z, .asm_43f4
	ld d, a
	cp $fd
	jr nz, .asm_43d4
	ld a, $bc
	call PlaySound
.asm_43d4
	ld a, [hli]
	ld e, a
	call .asm_43ea
	jr .asm_43c6

.unknown_43db: ; 43db (1:43db)
INCBIN "baserom.gbc",$43db,$43ea - $43db

.asm_43ea
	call DelayFrame
	ld a, [bc]
	add d
	ld [bc], a
	dec e
	jr nz, .asm_43ea
	ret
.asm_43f4
	call LoadScreenTilesFromBuffer1
	ld c, $24
	call DelayFrames
	ld a, $bd
	call PlaySound
	call PrintGameVersionOnTitleScreen
	ld a, $90
	ld [$FF00+$b0], a
	ld d, $90
.asm_440a
	ld h, d
	ld l, $40
	call Func_44cf
	ld h, $0
	ld l, $50
	call Func_44cf
	ld a, d
	add $4
	ld d, a
	and a
	jr nz, .asm_440a
	ld a, $9c
	call Func_4533
	call LoadScreenTilesFromBuffer2
	call PrintGameVersionOnTitleScreen
	call Delay3
	call WaitForSoundToFinish
	ld a, $c3
	ld [$c0ee], a
	call PlaySound
	xor a
	ld [$cc5b], a
.asm_443b
	ld c, $c8
	call CheckForUserInterruption
	jr c, .asm_4459
	call Func_44c1
	ld c, $1
	call CheckForUserInterruption
	jr c, .asm_4459
	ld b, BANK(Func_372ac)
	ld hl, Func_372ac
	call Bankswitch ; indirect jump to Func_372ac (372ac (d:72ac))
	call Func_4496
	jr .asm_443b
.asm_4459
	ld a, [W_WHICHTRADE] ; $cd3d
	call PlayCry
	call WaitForSoundToFinish
	call GBPalWhiteOutWithDelay3
	call CleanLCD_OAM
	xor a
	ld [$FF00+$b0], a
	inc a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call ClearScreen
	ld a, $98
	call Func_4533
	ld a, $9c
	call Func_4533
	call Delay3
	call LoadGBPal
	ld a, [H_CURRENTPRESSEDBUTTONS]
	ld b, a
	and $46
	cp $46
	jp z, Func_448e
	jp MainMenu

; known jump sources: 4488 (1:4488)
Func_448e: ; 448e (1:448e)
	ld b, BANK(Func_1c98a)
	ld hl, Func_1c98a
	jp Bankswitch ; indirect jump to Func_1c98a (1c98a (7:498a))

; known jump sources: 4454 (1:4454)
Func_4496: ; 4496 (1:4496)
	ld a, $98
	call Func_4533
.asm_449b
	call GenRandom
	and $f
	ld c, a
	ld b, $0
	ld hl, TitleMons ; $4588
	add hl, bc
	ld a, [hl]
	ld hl, W_WHICHTRADE ; $cd3d
	cp [hl]
	jr z, .asm_449b
	ld [hl], a
	call Func_4524
	ld a, $90
	ld [$FF00+$b0], a
	ld d, $1
	ld b, BANK(LoadScreenTilesFromBuffer18)
	ld hl, LoadScreenTilesFromBuffer18
	call Bankswitch ; indirect jump to LoadScreenTilesFromBuffer18 (37258 (d:7258))
	ret

; known jump sources: 4442 (1:4442)
Func_44c1: ; 44c1 (1:44c1)
	ld d, $0
	ld b, BANK(LoadScreenTilesFromBuffer18)
	ld hl, LoadScreenTilesFromBuffer18
	call Bankswitch ; indirect jump to LoadScreenTilesFromBuffer18 (37258 (d:7258))
	xor a
	ld [$FF00+$b0], a
	ret

; known jump sources: 440d (1:440d), 4414 (1:4414), 44d2 (1:44d2)
Func_44cf: ; 44cf (1:44cf)
	ld a, [$FF00+$44]
	cp l
	jr nz, Func_44cf
	ld a, h
	ld [rSCX], a ; $FF00+$43
.asm_44d7
	ld a, [$FF00+$44]
	cp h
	jr z, .asm_44d7
	ret

; known jump sources: 4366 (1:4366)
Func_44dd: ; 44dd (1:44dd)
	ld hl, PlayerCharacterTitleGraphics ; $66a8
	ld de, $8000
	ld bc, $230
	ld a, BANK(PlayerCharacterTitleGraphics)
	call FarCopyData2
	call CleanLCD_OAM
	xor a
	ld [W_WHICHTRADE], a ; $cd3d
	ld hl, W_OAMBUFFER
	ld de, $605a
	ld b, $7
.asm_44fa
	push de
	ld c, $5
.asm_44fd
	ld a, d
	ld [hli], a
	ld a, e
	ld [hli], a
	add $8
	ld e, a
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [hli], a
	inc a
	ld [W_WHICHTRADE], a ; $cd3d
	inc hl
	dec c
	jr nz, .asm_44fd
	pop de
	ld a, $8
	add d
	ld d, a
	dec b
	jr nz, .asm_44fa
	ret

; known jump sources: 4340 (1:4340)
Func_4519: ; 4519 (1:4519)
	ld hl, $9800
	ld bc, $800
	ld a, $7f
	jp FillMemory

; known jump sources: 439d (1:439d), 44af (1:44af)
Func_4524: ; 4524 (1:4524)
	ld [$cf91], a
	ld [$d0b5], a
	FuncCoord 5, 10 ; $c46d
	ld hl, Coord
	call GetMonHeader
	jp LoadFrontSpriteByMonIndex

; known jump sources: 43a2 (1:43a2), 43b1 (1:43b1), 4420 (1:4420), 4473 (1:4473), 4478 (1:4478), 4498 (1:4498)
Func_4533: ; 4533 (1:4533)
	ld [$FF00+$bd], a
	jp Delay3

; known jump sources: 41894 (10:5894)
Func_4538: ; 4538 (1:4538)
	xor a
	ld [$FF00+$b0], a
	call ClearScreen
	call LoadTextBoxTilePatterns

; known jump sources: 741fa (1d:41fa)
Func_4541: ; 4541 (1:4541)
	ld de, NintendoCopyrightLogoGraphics ; $60c8
	ld hl, $9600
	ld bc, (BANK(NintendoCopyrightLogoGraphics) << 8) + $1c
	call CopyVideoData
	FuncCoord 2, 7 ; $c42e
	ld hl, Coord
	ld de, Unknown_4556 ; $4556
	jp PlaceString

Unknown_4556: ; 4556 (1:4556)
INCBIN "baserom.gbc",$4556,$4588 - $4556

TitleMons: ; 4588 (1:4588)
; mons on the title screen are randomly chosen from here
IF _RED
	db CHARMANDER
	db SQUIRTLE
	db BULBASAUR
	db WEEDLE
	db NIDORAN_M
	db SCYTHER
	db PIKACHU
	db CLEFAIRY
	db RHYDON
	db ABRA
	db GASTLY
	db DITTO
	db PIDGEOTTO
	db ONIX
	db PONYTA
	db MAGIKARP
ENDC
IF _GREEN
	db BULBASAUR
	db CHARMANDER
	db SQUIRTLE
	db CATERPIE
	db NIDORAN_F
	db PINSIR
	db PIKACHU
	db CLEFAIRY
	db RHYDON
	db ABRA
	db GASTLY
	db DITTO
	db PIDGEOTTO
	db ONIX
	db PONYTA
	db MAGIKARP
ENDC
IF _BLUE
	db SQUIRTLE
	db CHARMANDER
	db BULBASAUR
	db MANKEY
	db HITMONLEE
	db VULPIX
	db CHANSEY
	db AERODACTYL
	db JOLTEON
	db SNORLAX
	db GLOOM
	db POLIWAG
	db DODUO
	db PORYGON
	db GENGAR
	db RAICHU
ENDC

; prints version text (red, blue)
PrintGameVersionOnTitleScreen: ; 4598 (1:4598)
	FuncCoord 7, 8 ; $c447
	ld hl, Coord
	ld de, VersionOnTitleScreenText ; $45a1
	jp PlaceString
; 45a1 (1:45a1)

; these point to special tiles specifically loaded for that purpose ad are no usual text
VersionOnTitleScreenText: ; 45a1 (1:45a1)
IF _RED
	db $60,$61,$7F,$65,$66,$67,$68,$69,$50 ; "Red Version"
ENDC
IF _BLUE
	db $61,$62,$63,$64,$65,$66,$67,$68,$50 ; "Blue Version"
ENDC

NintenText: ; 45aa (1:45aa)
	db "NINTEN@"

SonyText: ; 45b1 (1:45b1)
	db "SONY@"

; loads pokemon data from one of multiple sources to $cf98
; loads base stats to $d0b8
; INPUT:
; [$cf92] = index of pokemon within party/box
; [$cc49] = source
; 00: player's party
; 01: enemy's party
; 02: current box
; 03: daycare
; OUTPUT:
; [$cf91] = pokemon ID
; $cf98 = base address of pokemon data
; $d0b8 = base address of base stats
LoadMonData_: ; 45b6 (1:45b6)
	ld a,[$da5f] ; daycare pokemon ID
	ld [$cf91],a
	ld a,[$cc49]
	cp a,$03
	jr z,.GetMonHeader
	ld a,[$cf92]
	ld e,a
	ld hl, Func_39c37
	ld b, BANK(Func_39c37)
	call Bankswitch ; get pokemon ID
.GetMonHeader
	ld a,[$cf91]
	ld [$d0b5],a ; input for GetMonHeader
	call GetMonHeader ; load base stats to $d0b8
	ld hl,W_PARTYMON1DATA
	ld bc,44
	ld a,[$cc49]
	cp a,$01
	jr c,.getMonEntry
	ld hl,$d8a4 ; enemy pokemon 1 data
	jr z,.getMonEntry
	cp a,$02
	ld hl,W_BOXMON1DATA ; box pokemon 1 data
	ld bc,33
	jr z,.getMonEntry
	ld hl,$da5f ; daycare pokemon data
	jr .copyMonData
.getMonEntry ; add the product of the index and the size of each entry
	ld a,[$cf92]
	call AddNTimes
.copyMonData
	ld de,$cf98
	ld bc,44
	jp CopyData

ItemPrices: ; 4608 (1:4608)
	db $00,$00,$00
	db $00,$12,$00
	db $00,$06,$00
	db $00,$02,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$10,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$01,$00
	db $00,$02,$50
	db $00,$02,$50
	db $00,$02,$00
	db $00,$02,$00
	db $00,$30,$00
	db $00,$25,$00
	db $00,$15,$00
	db $00,$07,$00
	db $00,$03,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$05,$50
	db $00,$03,$50
	db $00,$00,$00
	db $00,$21,$00
	db $00,$21,$00
	db $00,$21,$00
	db $00,$98,$00
	db $00,$98,$00
	db $00,$98,$00
	db $00,$98,$00
	db $00,$98,$00
	db $00,$48,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$09,$50
	db $00,$21,$00
	db $00,$00,$00
	db $01,$00,$00
	db $00,$98,$00
	db $00,$10,$00
	db $00,$06,$00
	db $00,$15,$00
	db $00,$40,$00
	db $00,$07,$00
	db $00,$05,$00
	db $00,$07,$00
	db $00,$06,$50
	db $00,$00,$10
	db $00,$02,$00
	db $00,$03,$00
	db $00,$03,$50
	db $00,$00,$00
	db $00,$00,$00
	db $00,$05,$00
	db $00,$05,$50
	db $00,$03,$50
	db $00,$03,$50
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00
	db $00,$00,$00

ItemNames: ; 472b (1:472b)
	db "MASTER BALL@"
	db "ULTRA BALL@"
	db "GREAT BALL@"
	db "POKé BALL@"
	db "TOWN MAP@"
	db "BICYCLE@"
	db "?????@"
	db "SAFARI BALL@"
	db "POKéDEX@"
	db "MOON STONE@"
	db "ANTIDOTE@"
	db "BURN HEAL@"
	db "ICE HEAL@"
	db "AWAKENING@"
	db "PARLYZ HEAL@"
	db "FULL RESTORE@"
	db "MAX POTION@"
	db "HYPER POTION@"
	db "SUPER POTION@"
	db "POTION@"
	db "BOULDERBADGE@"
	db "CASCADEBADGE@"
	db "THUNDERBADGE@"
	db "RAINBOWBADGE@"
	db "SOULBADGE@"
	db "MARSHBADGE@"
	db "VOLCANOBADGE@"
	db "EARTHBADGE@"
	db "ESCAPE ROPE@"
	db "REPEL@"
	db "OLD AMBER@"
	db "FIRE STONE@"
	db "THUNDERSTONE@"
	db "WATER STONE@"
	db "HP UP@"
	db "PROTEIN@"
	db "IRON@"
	db "CARBOS@"
	db "CALCIUM@"
	db "RARE CANDY@"
	db "DOME FOSSIL@"
	db "HELIX FOSSIL@"
	db "SECRET KEY@"
	db "?????@"
	db "BIKE VOUCHER@"
	db "X ACCURACY@"
	db "LEAF STONE@"
	db "CARD KEY@"
	db "NUGGET@"
	db "PP UP@"
	db "POKé DOLL@"
	db "FULL HEAL@"
	db "REVIVE@"
	db "MAX REVIVE@"
	db "GUARD SPEC.@"
	db "SUPER REPEL@"
	db "MAX REPEL@"
	db "DIRE HIT@"
	db "COIN@"
	db "FRESH WATER@"
	db "SODA POP@"
	db "LEMONADE@"
	db "S.S.TICKET@"
	db "GOLD TEETH@"
	db "X ATTACK@"
	db "X DEFEND@"
	db "X SPEED@"
	db "X SPECIAL@"
	db "COIN CASE@"
	db "OAK's PARCEL@"
	db "ITEMFINDER@"
	db "SILPH SCOPE@"
	db "POKé FLUTE@"
	db "LIFT KEY@"
	db "EXP.ALL@"
	db "OLD ROD@"
	db "GOOD ROD@"
	db "SUPER ROD@"
	db "PP UP@"
	db "ETHER@"
	db "MAX ETHER@"
	db "ELIXER@"
	db "MAX ELIXER@"
	db "B2F@"
	db "B1F@"
	db "1F@"
	db "2F@"
	db "3F@"
	db "4F@"
	db "5F@"
	db "6F@"
	db "7F@"
	db "8F@"
	db "9F@"
	db "10F@"
	db "11F@"
	db "B4F@"

UnusedNames: ; 4a92 (1:4a92)
	db "かみなりバッヂ@"
	db "かいがらバッヂ@"
	db "おじぞうバッヂ@"
	db "はやぶさバッヂ@"
	db "ひんやりバッヂ@"
	db "なかよしバッヂ@"
	db "バラバッヂ@"
	db "ひのたまバッヂ@"
	db "ゴールドバッヂ@"
	db "たまご@"
	db "ひよこ@"
	db "ブロンズ@"
	db "シルバー@"
	db "ゴールド@"
	db "プチキャプテン@"
	db "キャプテン@"
	db "プチマスター@"
	db "マスター@"

INCBIN "baserom.gbc",$4b09,$4b0f - $4b09

; calculates the OAM data for all currently visible sprites and writes it to W_OAMBUFFER
PrepareOAMData: ; 4b0f (1:4b0f)
	ld a, [$cfcb]
	dec a
	jr z, .asm_4b1e
	cp $ff
	ret nz
	ld [$cfcb], a
	jp ResetLCD_OAM
.asm_4b1e
	xor a
	ld [$FF00+$90], a
.asm_4b21
	ld [$FF00+$8f], a
	ld d, $c1
	ld a, [$FF00+$8f]
	ld e, a
	ld a, [de]         ; c1x0
	and a
	jp z, .asm_4bad
	inc e
	inc e
	ld a, [de]         ; c1x2 read combined orientation and animation info
	ld [$d5cd], a
	cp $ff
	jr nz, .spriteVisible   ; $ff -> offscreen, don't draw
	call Func_4bd1
	jr .asm_4bad
.spriteVisible
	cp $a0
	jr c, .considerOrientation ; if >= $a0, ignore the sprite orientation and animation (by using a different conversion table)
	and $f
	add $10
	jr .asm_4b48
.considerOrientation
	and $f                     ; the lower nybble contains orientation and animation info
.asm_4b48
	ld l, a
	push de
	inc d
	ld a, e
	add $5
	ld e, a
	ld a, [de]         ; c2x7
	and $80
	ld [$FF00+$94], a          ; temp store bit 7 for later use in OAM flags (draws sprite behind background (used for grass))
	pop de
	ld h, $0
	ld bc, SpriteFacingAndAnimationTable
	add hl, hl
	add hl, hl
	add hl, bc                 ; skip to the table location determined by orientation and animation
	ld a, [hli]
	ld c, a
	ld a, [hli]
	ld b, a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	call Func_4bd1
	ld a, [$FF00+$90]
	ld e, a
	ld d, $c3                ; W_OAMBUFFER+x is buffer for OAM data
.spriteTilesLoop             ; loops 4 times for the 4 tiles a sprite consists of
	ld a, [$FF00+$92]        ; temp for sprite Y position
	add $10                  ; Y=16 is top of screen (Y=0 is invisible)
	add [hl]                 ; add Y offset from table
	ld [de], a               ; write new sprite OAM Y position
	inc hl
	ld a, [$FF00+$91]        ; temp for sprite X position
	add $8                   ; X=8 is left of screen (X=0 is invisible)
	add [hl]                 ; add X offset from table
	inc e
	ld [de], a               ; write new sprite OAM X position
	inc e
	ld a, [bc]               ; read pattern number offset (accomodates orientation (offset 0,4 or 8) and animation (offset 0 or $80))
	inc bc
	push bc
	ld b, a
	ld a, [$d5cd]            ; temp copy of c1x2
	swap a                   ; high nybble determines sprite used (0 is always player sprite, next are some npcs)
	and $f
	cp $b                    ; sprites $a and $b have no orientation or animation and therefore only 4 tiles
	jr nz, .calcTileOffset   ; (instead of 12), so tile b's offset is a special case
	ld a, $7c                ; = $a * 12 + 4
	jr .doneCalcTileOffset
.calcTileOffset
	sla a
	sla a
	ld c, a
	sla a
	add c                    ; a *= 12 (each sprite consists of 12 tiles)
.doneCalcTileOffset
	add b                    ; add orientation and animation offset
	pop bc
	ld [de], a               ; write OAM sprite pattern number
	inc hl
	inc e
	ld a, [hl]
	bit 1, a                 ; bit 1 is ignored for OAM, it's used here as an "always in foregroud" flag.
	jr z, .alwaysInForeground
	ld a, [$FF00+$94]        ; load bit 7 (set to $80 if sprite is in grass and should be drawn behind it)
	or [hl]
.alwaysInForeground
	inc hl
	ld [de], a               ; write OAM sprite flags
	inc e
	bit 0, a                 ; test for OAMFLAG_ENDOFDATA
	jr z, .spriteTilesLoop
	ld a, e
	ld [$FF00+$90], a
.asm_4bad
	ld a, [$FF00+$8f]
	add $10
	cp $0
	jp nz, .asm_4b21
	ld a, [$FF00+$90]
	ld l, a
	ld h, $c3
	ld de, $4
	ld b, $a0
	ld a, [$d736]
	bit 6, a
	ld a, $a0
	jr z, .clearUnusedOAMEntriesLoop
	ld a, $90
.clearUnusedOAMEntriesLoop
	cp l
	ret z
	ld [hl], b
	add hl, de
	jr .clearUnusedOAMEntriesLoop

; known jump sources: 4b37 (1:4b37), 4b64 (1:4b64)
Func_4bd1: ; 4bd1 (1:4bd1)
	inc e
	inc e
	ld a, [de]            ; c1x4
	ld [$FF00+$92], a
	inc e
	inc e
	ld a, [de]            ; c1x6
	ld [$FF00+$91], a
	ld a, $4
	add e
	ld e, a
	ld a, [$FF00+$92]
	add $4
	and $f0
	ld [de], a            ; c1xa (sprite Y pos (snapped to whole steps (?))
	inc e
	ld a, [$FF00+$91]
	and $f0
	ld [de], a            ; c1xb (sprite X pos (snapped to whole steps (?))
	ret

; known jump sources: 1f9e (0:1f9e)
; copies DMA routine to HRAM. By GB specifications, all DMA needs to be done in HRAM (no other memory section is available during DMA)
WriteDMACodeToHRAM: ; 4bed (1:4bed)
	ld c, $80
	ld b, $a
	ld hl, DMARoutine
.copyLoop
	ld a, [hli]
	ld [$ff00+c], a
	inc c
	dec b
	jr nz, .copyLoop
	ret

; this routine is copied to HRAM and executed there on every VBlank
DMARoutine: ; 4bfb (1:4bfb)
	ld a, $c3
	ld [$ff00+$46], a   ; start DMA
	ld a, $28
.waitLoop               ; wait for DMA to finish
	dec a
	jr nz, .waitLoop
	ret
; 0x4c05

; known jump sources: 3d638 (f:5638)
Func_4c05: ; 4c05 (1:4c05)
	FuncCoord 3, 10 ; $c46b
	ld hl, Coord
	ld b, $1
	ld c, $b
	ld a, [W_ISINBATTLE] ; $d057
	and a
	jr z, .asm_4c17
	call TextBoxBorder
	jr .asm_4c1a
.asm_4c17
	call Func_5ab3
.asm_4c1a
	FuncCoord 4, 11 ; $c480
	ld hl, Coord
	ld de, Unknown_4c28 ; $4c28
	call PlaceString
	ld c, $32
	jp DelayFrames

Unknown_4c28: ; 4c28 (1:4c28)
INCBIN "baserom.gbc",$4c28,$4c34 - $4c28

; known jump sources: 2438 (0:2438)
_UpdateSprites: ; 4c34 (1:4c34)
	ld h, $c1
	inc h
	ld a, $e    ; $c20e
.spriteLoop
	ld l, a
	sub $e
	ld c, a
	ld [H_CURRENTSPRITEOFFSET], a
	ld a, [hl]
	and a
	jr z, .skipSprite   ; tests $c2Xe
	push hl
	push de
	push bc
	call .updateCurrentSprite
	pop bc
	pop de
	pop hl
.skipSprite
	ld a, l
	add $10             ; move to next sprite
	cp $e               ; test for overflow (back at $0e)
	jr nz, .spriteLoop
	ret
.updateCurrentSprite ; 4c54 (1:4c54)
	cp $1
	jp nz, UpdateNonPlayerSprite
	jp UpdatePlayerSprite

; known jump sources: 4c56 (1:4c56)
UpdateNonPlayerSprite: ; 4c5c (1:4c5c)
	dec a
	swap a
	ld [$FF00+$93], a  ; $10 * sprite#
	ld a, [$cf17] ; some sprite offset?
	ld b, a
	ld a, [H_CURRENTSPRITEOFFSET]
	cp b
	jr nz, .unequal
	jp Func_5236
.unequal
	jp Func_4ed1

; known jump sources: 4e50 (1:4e50), 51af (1:51af)
Func_4c70: ; 4c70 (1:4c70)
	nop
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	add $0
	ld l, a
	ld a, [hl]
	and a
	ret z
	ld a, l
	add $3
	ld l, a
	ld a, [hli]
	call Func_4d72
	ld a, [hli]
	add $4
	add b
	and $f0
	or c
	ld [$FF00+$90], a
	ld a, [hli]
	call Func_4d72
	ld a, [hl]
	add b
	and $f0
	or c
	ld [$FF00+$91], a
	ld a, l
	add $7
	ld l, a
	xor a
	ld [hld], a
	ld [hld], a
	ld a, [$FF00+$91]
	ld [hld], a
	ld a, [$FF00+$90]
	ld [hl], a
	xor a

; known jump sources: 4d6e (1:4d6e)
Func_4ca5: ; 4ca5 (1:4ca5)
	ld [$FF00+$8f], a
	swap a
	ld e, a
	ld a, [H_CURRENTSPRITEOFFSET]
	cp e
	jp z, .asm_4d69
	ld d, h
	ld a, [de]
	and a
	jp z, .asm_4d69
	inc e
	inc e
	ld a, [de]
	inc a
	jp z, .asm_4d69
	ld a, [H_CURRENTSPRITEOFFSET]
	add $a
	ld l, a
	inc e
	ld a, [de]
	call Func_4d72
	inc e
	ld a, [de]
	add $4
	add b
	and $f0
	or c
	sub [hl]
	jr nc, .asm_4cd4
	cpl
	inc a
.asm_4cd4
	ld [$FF00+$90], a
	push af
	rl c
	pop af
	ccf
	rl c
	ld b, $7
	ld a, [hl]
	and $f
	jr z, .asm_4ce6
	ld b, $9
.asm_4ce6
	ld a, [$FF00+$90]
	sub b
	ld [$FF00+$92], a
	ld a, b
	ld [$FF00+$90], a
	jr c, .asm_4d01
	ld b, $7
	dec e
	ld a, [de]
	inc e
	and a
	jr z, .asm_4cfa
	ld b, $9
.asm_4cfa
	ld a, [$FF00+$92]
	sub b
	jr z, .asm_4d01
	jr nc, .asm_4d69
.asm_4d01
	inc e
	inc l
	ld a, [de]
	push bc
	call Func_4d72
	inc e
	ld a, [de]
	add b
	and $f0
	or c
	pop bc
	sub [hl]
	jr nc, .asm_4d14
	cpl
	inc a
.asm_4d14
	ld [$FF00+$91], a
	push af
	rl c
	pop af
	ccf
	rl c
	ld b, $7
	ld a, [hl]
	and $f
	jr z, .asm_4d26
	ld b, $9
.asm_4d26
	ld a, [$FF00+$91]
	sub b
	ld [$FF00+$92], a
	ld a, b
	ld [$FF00+$91], a
	jr c, .asm_4d41
	ld b, $7
	dec e
	ld a, [de]
	inc e
	and a
	jr z, .asm_4d3a
	ld b, $9
.asm_4d3a
	ld a, [$FF00+$92]
	sub b
	jr z, .asm_4d41
	jr nc, .asm_4d69
.asm_4d41
	ld a, [$FF00+$91]
	ld b, a
	ld a, [$FF00+$90]
	inc l
	cp b
	jr c, .asm_4d4e
	ld b, $c
	jr .asm_4d50
.asm_4d4e
	ld b, $3
.asm_4d50
	ld a, c
	and b
	or [hl]
	ld [hl], a
	ld a, c
	inc l
	inc l
	ld a, [$FF00+$8f]
	ld de, Unknown_4d85 ; $4d85
	add a
	add e
	ld e, a
	jr nc, .asm_4d62
	inc d
.asm_4d62
	ld a, [de]
	or [hl]
	ld [hli], a
	inc de
	ld a, [de]
	or [hl]
	ld [hl], a
.asm_4d69
	ld a, [$FF00+$8f]
	inc a
	cp $10
	jp nz, Func_4ca5
	ret

; known jump sources: 4c80 (1:4c80), 4c8d (1:4c8d), 4cc4 (1:4cc4), 4d05 (1:4d05)
Func_4d72: ; 4d72 (1:4d72)
	and a
	ld b, $0
	ld c, $0
	jr z, .asm_4d84
	ld c, $9
	cp $ff
	jr z, .asm_4d83
	ld c, $7
	ld a, $0
.asm_4d83
	ld b, a
.asm_4d84
	ret

Unknown_4d85: ; 4d85 (1:4d85)
INCBIN "baserom.gbc",$4d85,$4de1 - $4d85

; known jump sources: 24f7 (0:24f7)
PickupItem: ; 4de1 (1:4de1)
	call EnableAutoTextBoxDrawing
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	ld b, a
	ld hl, W_MISSABLEOBJECTLIST
.missableObjectsListLoop
	ld a, [hli]
	cp $ff
	ret z
	cp b
	jr z, .isMissable
	inc hl
	jr .missableObjectsListLoop
.isMissable
	ld a, [hl]
	ld [$FF00+$db], a
	ld hl, W_MAPSPRITEEXTRADATA
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	dec a
	add a
	ld d, $0
	ld e, a
	add hl, de        ; seek to item data of found item
	ld a, [hl]        ; read Item type
	ld b, a
	ld c, 1          ; quantity is 1
	call GiveItem
	jr nc, .BagFull
	ld a, [$FF00+$db]
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	ld a, $1
	ld [$cc3c], a
	ld hl, FoundItemText
	jr .printText
.BagFull
	ld hl, NoMoreRoomForItemText
.printText
	call PrintText
	ret

FoundItemText: ; 4e26 (1:4e26)
	TX_FAR _FoundItemText
	db $0B
	db $50
; 0x4e26 + 5 bytes

NoMoreRoomForItemText: ; 4e2c (1:4e2c)
	TX_FAR _NoMoreRoomForItemText
	db $50
; 0x4e2c + 5 bytes

; known jump sources: 4c59 (1:4c59)
UpdatePlayerSprite: ; 4e31 (1:4e31)
	ld a, [$c200]
	and a
	jr z, .asm_4e41
	cp $ff
	jr z, .asm_4e4a
	dec a
	ld [$c200], a
	jr .asm_4e4a
.asm_4e41
	FuncCoord 8, 9 ; $c45c
	ld a, [Coord]
	ld [$FF00+$93], a
	cp $60
	jr c, .asm_4e50
.asm_4e4a
	ld a, $ff
	ld [$c102], a
	ret
.asm_4e50
	call Func_4c70
	ld h, $c1
	ld a, [W_WALKCOUNTER] ; $cfc5
	and a
	jr nz, .asm_4e90
	ld a, [$d528]
	bit 2, a
	jr z, .asm_4e65
	xor a
	jr .asm_4e86
.asm_4e65
	bit 3, a
	jr z, .asm_4e6d
	ld a, $4
	jr .asm_4e86
.asm_4e6d
	bit 1, a
	jr z, .asm_4e75
	ld a, $8
	jr .asm_4e86
.asm_4e75
	bit 0, a
	jr z, .asm_4e7d
	ld a, $c
	jr .asm_4e86
.asm_4e7d
	xor a
	ld [$c107], a
	ld [$c108], a
	jr .asm_4eab
.asm_4e86
	ld [$c109], a
	ld a, [$cfc4]
	bit 0, a
	jr nz, .asm_4e7d
.asm_4e90
	ld a, [$d736]
	bit 7, a
	jr nz, .asm_4eb6
	ld a, [H_CURRENTSPRITEOFFSET]
	add $7
	ld l, a
	ld a, [hl]
	inc a
	ld [hl], a
	cp $4
	jr nz, .asm_4eab
	xor a
	ld [hl], a
	inc hl
	ld a, [hl]
	inc a
	and $3
	ld [hl], a
.asm_4eab
	ld a, [$c108]
	ld b, a
	ld a, [$c109]
	add b
	ld [$c102], a
.asm_4eb6
	ld a, [$FF00+$93]
	ld c, a
	ld a, [W_GRASSTILE]
	cp c
	ld a, $0
	jr nz, .asm_4ec3
	ld a, $80
.asm_4ec3
	ld [$c207], a
	ret

INCBIN "baserom.gbc",$4ec7,$4ed1 - $4ec7

; known jump sources: 4c6d (1:4c6d)
Func_4ed1: ; 4ed1 (1:4ed1)
	ld a, [H_CURRENTSPRITEOFFSET]
	swap a
	dec a
	add a
	ld hl, W_MAPSPRITEDATA ; $d4e4
	add l
	ld l, a
	ld a, [hl]        ; read movement byte 2
	ld [W_CURSPRITEMOVEMENT2], a
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	ld l, a
	inc l
	ld a, [hl]        ; c1x1
	and a
	jp z, InitializeSpriteStatus
	call CheckSpriteAvailability
	ret c             ; if sprite is invisible, on tile >=$60, in grass or player is currently walking
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	ld l, a
	inc l
	ld a, [hl]        ; c1x1
	bit 7, a
	jp nz, InitializeSpriteFacingDirection  ; c1x1 >= $80
	ld b, a
	ld a, [$cfc4]
	bit 0, a
	jp nz, notYetMoving
	ld a, b
	cp $2
	jp z, UpdateSpriteMovementDelay  ; c1x1 == 2
	cp $3
	jp z, UpdateSpriteInWalkingAnimation  ; c1x1 == 3
	ld a, [W_WALKCOUNTER] ; $cfc5
	and a
	ret nz           ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability)
	call InitializeSpriteScreenPosition
	ld h, $c2
	ld a, [H_CURRENTSPRITEOFFSET]
	add $6
	ld l, a
	ld a, [hl]       ; c2x6: movement byte 1
	inc a
	jr z, .asm_4f59  ; value $FF
	inc a
	jr z, .asm_4f59  ; value $FE
	dec a
	ld [hl], a       ; (temporarily) increment movement byte 1
	dec a
	push hl
	ld hl, $cf0f
	dec [hl]         ; decrement $cf0f
	pop hl
	ld de, $cc5b
	call LoadDEPlusA ; a = [$cc5b + movement byte 1]
	cp $e0
	jp z, ChangeFacingDirection
	cp $ff
	jr nz, .asm_4f4b
	ld [hl], a       ; reset movement byte 1 to initial value
	ld hl, $d730
	res 0, [hl]
	xor a
	ld [$cd38], a
	ld [$cd3a], a
	ret
.asm_4f4b
	cp $fe
	jr nz, .asm_4f5f
	ld [hl], $1     ; set movement byte 1 to $1
	ld de, $cc5b
	call LoadDEPlusA ; a = [$cc5b + $fe] (?)
	jr .asm_4f5f
.asm_4f59
	call getTileSpriteStandsOn
	call GenRandom
.asm_4f5f
	ld b, a
	ld a, [W_CURSPRITEMOVEMENT2]
	cp $d0
	jr z, .moveDown    ; movement byte 2 = $d0 forces down
	cp $d1
	jr z, .moveUp      ; movement byte 2 = $d1 forces up
	cp $d2
	jr z, .moveLeft    ; movement byte 2 = $d2 forces left
	cp $d3
	jr z, .moveRight   ; movement byte 2 = $d3 forces right
	ld a, b
	cp $40             ; a < $40: down (or left)
	jr nc, .notDown
	ld a, [W_CURSPRITEMOVEMENT2]
	cp $2
	jr z, .moveLeft    ; movement byte 2 = $2 only allows left or right
.moveDown
	ld de, 2*20
	add hl, de         ; move tile pointer two rows down
	ld de, $100

	ld bc, $400
	jr TryWalking
.notDown
	cp $80             ; $40 <= a < $80: up (or right)
	jr nc, .notUp
	ld a, [W_CURSPRITEMOVEMENT2]
	cp $2
	jr z, .moveRight   ; movement byte 2 = $2 only allows left or right
.moveUp
	ld de, -2*20 ; $ffd8
	add hl, de         ; move tile pointer two rows up
	ld de, $ff00
	ld bc, $804
	jr TryWalking
.notUp
	cp $c0             ; $80 <= a < $c0: left (or up)
	jr nc, .notLeft
	ld a, [W_CURSPRITEMOVEMENT2]
	cp $1
	jr z, .moveUp      ; movement byte 2 = $1 only allows up or down
.moveLeft
	dec hl
	dec hl             ; move tile pointer two columns left
	ld de, $ff
	ld bc, $208
	jr TryWalking
.notLeft              ; $c0 <= a: right (or down)
	ld a, [W_CURSPRITEMOVEMENT2]
	cp $1
	jr z, .moveDown    ; movement byte 2 = $1 only allows up or down
.moveRight
	inc hl
	inc hl             ; move tile pointer two columns right
	ld de, $1
	ld bc, $10c
	jr TryWalking

; known jump sources: 4f36 (1:4f36)
; cahnges facing direction by zeroing the movement delta and calling TryWalking
ChangeFacingDirection: ; 4fc8 (1:4fc8)
	ld de, $0
	; fall through

; b: direction (1,2,4 or 8)
; c: new facing direction (0,4,8 or $c)
; d: Y movement delta (-1, 0 or 1)
; e: X movement delta (-1, 0 or 1)
; hl: pointer to tile the sprite would wlak onto
; set carry on failure, clears carry on success
TryWalking: ; 4fcb (1:4fcb)
	push hl
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	add $9
	ld l, a
	ld [hl], c          ; c1x9 (update facing direction)
	ld a, [H_CURRENTSPRITEOFFSET]
	add $3
	ld l, a
	ld [hl], d          ; c1x3 (update Y movement delta)
	inc l
	inc l
	ld [hl], e          ; c1x5 (update X movement delta)
	pop hl
	push de
	ld c, [hl]          ; read tile to walk onto
	call CanWalkOntoTile
	pop de
	ret c               ; cannot walk there (reinitialization of delay values already done)
	ld h, $c2
	ld a, [H_CURRENTSPRITEOFFSET]
	add $4
	ld l, a
	ld a, [hl]          ; c2x4: Y position
	add d
	ld [hli], a         ; update Y position
	ld a, [hl]          ; c2x5: X position
	add e
	ld [hl], a          ; update X position
	ld a, [H_CURRENTSPRITEOFFSET]
	ld l, a
	ld [hl], $10        ; c2x0=16: walk animation counter
	dec h
	inc l
	ld [hl], $3         ; c1x1: set movement status to walking
	jp UpdateSpriteImage

; known jump sources: 4f0c (1:4f0c)
; update the walking animation parameters for a sprite that is currently walking
UpdateSpriteInWalkingAnimation: ; 4ffe (1:4ffe)
	ld a, [H_CURRENTSPRITEOFFSET]
	add $7
	ld l, a
	ld a, [hl]                       ; c1x7 (counter until next walk animation frame)
	inc a
	ld [hl], a                       ; c1x7 += 1
	cp $4
	jr nz, .noNextAnimationFrame
	xor a
	ld [hl], a                       ; c1x7 = 0
	inc l
	ld a, [hl]                       ; c1x8 (walk animation frame)
	inc a
	and $3
	ld [hl], a                       ; advance to next animation frame every 4 ticks (16 ticks total for one step)
.noNextAnimationFrame
	ld a, [H_CURRENTSPRITEOFFSET]
	add $3
	ld l, a
	ld a, [hli]                      ; c1x3 (movement Y delta)
	ld b, a
	ld a, [hl]                       ; c1x4 (screen Y position)
	add b
	ld [hli], a                      ; update screen Y position
	ld a, [hli]                      ; c1x5 (movement X delta)
	ld b, a
	ld a, [hl]                       ; c1x6 (screen X position)
	add b
	ld [hl], a                       ; update screen X position
	ld a, [H_CURRENTSPRITEOFFSET]
	ld l, a
	inc h
	ld a, [hl]                       ; c2x0 (walk animantion counter)
	dec a
	ld [hl], a                       ; update walk animantion counter
	ret nz
	ld a, $6                         ; walking finished, update state
	add l
	ld l, a
	ld a, [hl]                       ; c2x6 (movement byte 1)
	cp $fe
	jr nc, .initNextMovementCounter  ; values $fe and $ff
	ld a, [H_CURRENTSPRITEOFFSET]
	inc a
	ld l, a
	dec h
	ld [hl], $1                      ; c1x1 = 1 (movement status ready)
	ret
.initNextMovementCounter
	call GenRandom
	ld a, [H_CURRENTSPRITEOFFSET]
	add $8
	ld l, a
	ld a, [H_RAND1] ; $FF00+$d3
	and $7f
	ld [hl], a                       ; c2x8: set next movement delay to a random value in [0,$7f]
	dec h                            ;       note that value 0 actually makes the delay $100 (bug?)
	ld a, [H_CURRENTSPRITEOFFSET]
	inc a
	ld l, a
	ld [hl], $2                      ; c1x1 = 2 (movement status)
	inc l
	inc l
	xor a
	ld b, [hl]                       ; c1x3 (movement Y delta)
	ld [hli], a                      ; reset movement Y delta
	inc l
	ld c, [hl]                       ; c1x5 (movement X delta)
	ld [hl], a                       ; reset movement X delta
	ret

; known jump sources: 4f07 (1:4f07)
; update delay value (c2x8) for sprites in the delayed state (c1x1)
UpdateSpriteMovementDelay: ; 5057 (1:5057)
	ld h, $c2
	ld a, [H_CURRENTSPRITEOFFSET]
	add $6
	ld l, a
	ld a, [hl]              ; c2x6: movement byte 1
	inc l
	inc l
	cp $fe
	jr nc, .tickMoveCounter ; values $fe or $ff
	ld [hl], $0
	jr .moving
.tickMoveCounter
	dec [hl]                ; c2x8: frame counter until next movement
	jr nz, notYetMoving
.moving
	dec h
	ld a, [H_CURRENTSPRITEOFFSET]
	inc a
	ld l, a
	ld [hl], $1             ; c1x1 = 1 (mark as ready to move)
notYetMoving: ; 5073 (1:5073)
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	add $8
	ld l, a
	ld [hl], $0             ; c1x8 = 0 (walk animation frame)
	jp UpdateSpriteImage

; known jump sources: 4ef8 (1:4ef8)
InitializeSpriteFacingDirection: ; 507f (1:507f)
	ld a, [$d72d]
	bit 5, a
	jr nz, notYetMoving
	res 7, [hl]
	ld a, [$d52a]
	bit 3, a
	jr z, .notFacingDown
	ld c, $0                ; make sprite face down
	jr .facingDirectionDetermined
.notFacingDown
	bit 2, a
	jr z, .notFacingUp
	ld c, $4                ; make sprite face up
	jr .facingDirectionDetermined
.notFacingUp
	bit 1, a
	jr z, .notFacingRight
	ld c, $c                ; make sprite face right
	jr .facingDirectionDetermined
.notFacingRight
	ld c, $8                ; make sprite face left
.facingDirectionDetermined
	ld a, [H_CURRENTSPRITEOFFSET]
	add $9
	ld l, a
	ld [hl], c              ; c1x9: set facing direction
	jr notYetMoving

; known jump sources: 4ee8 (1:4ee8)
InitializeSpriteStatus: ; 50ad (1:50ad)
	ld [hl], $1   ; $c1x1: set movement status to ready
	inc l
	ld [hl], $ff  ; $c1x2: set sprite image to $ff (invisible/off screen)
	inc h
	ld a, [H_CURRENTSPRITEOFFSET]
	add $2
	ld l, a
	ld a, $8
	ld [hli], a   ; $c2x2: set Y displacement to 8
	ld [hl], a    ; $c2x3: set X displacement to 8
	ret

; known jump sources: 4f14 (1:4f14)
; calculates the spprite's scrren position form its map position and the player position
InitializeSpriteScreenPosition: ; 50bd (1:50bd)
	ld h, $c2
	ld a, [H_CURRENTSPRITEOFFSET]
	add $4
	ld l, a
	ld a, [W_YCOORD] ; $d361
	ld b, a
	ld a, [hl]      ; c2x4 (Y position + 4)
	sub b           ; relative to player position
	swap a          ; * 16
	sub $4          ; - 4
	dec h
	ld [hli], a     ; c1x4 (screen Y position)
	inc h
	ld a, [W_XCOORD] ; $d362
	ld b, a
	ld a, [hli]     ; c2x6 (X position + 4)
	sub b           ; relative to player position
	swap a          ; * 16
	dec h
	ld [hl], a      ; c1x6 (screen X position)
	ret

; known jump sources: 4eeb (1:4eeb)
; tests if sprite is off screen or otherwise unable to do anything
CheckSpriteAvailability: ; 50dc (1:50dc)
	ld a, $12
	call Predef ; indirect jump to IsMissableObjectHidden (f1a6 (3:71a6))
	ld a, [$FF00+$e5]
	and a
	jp nz, .spriteInvisible
	ld h, $c2
	ld a, [H_CURRENTSPRITEOFFSET]
	add $6
	ld l, a
	ld a, [hl]      ; c2x6: movement byte 1
	cp $fe
	jr c, .skipXVisibilityTest ; movement byte 1 < $fe
	ld a, [H_CURRENTSPRITEOFFSET]
	add $4
	ld l, a
	ld b, [hl]      ; c2x4: Y pos (+4)
	ld a, [W_YCOORD] ; $d361
	cp b
	jr z, .skipYVisibilityTest
	jr nc, .spriteInvisible ; above screen region
	add $8                  ; screen is 9 tiles high
	cp b
	jr c, .spriteInvisible  ; below screen region
.skipYVisibilityTest
	inc l
	ld b, [hl]      ; c2x5: X pos (+4)
	ld a, [W_XCOORD] ; $d362
	cp b
	jr z, .skipXVisibilityTest
	jr nc, .spriteInvisible ; left of screen region
	add $9                  ; screen is 10 tiles wide
	cp b
	jr c, .spriteInvisible  ; right of screen region
.skipXVisibilityTest
	call getTileSpriteStandsOn
	ld d, $60
	ld a, [hli]
	cp d
	jr nc, .spriteInvisible ; standing on tile with ID >=$60 (bottom left tile)
	ld a, [hld]
	cp d
	jr nc, .spriteInvisible ; standing on tile with ID >=$60 (bottom right tile)
	ld bc, -20 ; $ffec
	add hl, bc              ; go back one row of tiles
	ld a, [hli]
	cp d
	jr nc, .spriteInvisible ; standing on tile with ID >=$60 (top left tile)
	ld a, [hl]
	cp d
	jr c, .spriteVisible    ; standing on tile with ID >=$60 (top right tile)
.spriteInvisible
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	add $2
	ld l, a
	ld [hl], $ff       ; c1x2
	scf
	jr .done
.spriteVisible
	ld c, a
	ld a, [W_WALKCOUNTER] ; $cfc5
	and a
	jr nz, .done           ; if player is currently walking, we're done
	call UpdateSpriteImage
	inc h
	ld a, [H_CURRENTSPRITEOFFSET]
	add $7
	ld l, a
	ld a, [W_GRASSTILE]
	cp c
	ld a, $0
	jr nz, .notInGrass
	ld a, $80
.notInGrass
	ld [hl], a       ; c2x7
	and a
.done
	ret

; known jump sources: 4ffb (1:4ffb), 507c (1:507c), 5141 (1:5141)
UpdateSpriteImage: ; 5157 (1:5157)
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	add $8
	ld l, a
	ld a, [hli]        ; c1x8: walk animation frame
	ld b, a
	ld a, [hl]         ; c1x9: facing direction
	add b
	ld b, a
	ld a, [$FF00+$93]  ; current sprite offset
	add b
	ld b, a
	ld a, [H_CURRENTSPRITEOFFSET]
	add $2
	ld l, a
	ld [hl], b         ; c1x2: sprite to display
	ret

; known jump sources: 4fe0 (1:4fe0)
; tests if sprite can walk the specified direction
; b: direction (1,2,4 or 8)
; c: ID of tile the sprite would walk onto
; d: Y movement delta (-1, 0 or 1)
; e: X movement delta (-1, 0 or 1)
; set carry on failure, clears carry on success
CanWalkOntoTile: ; 516e (1:516e)
	ld h, $c2
	ld a, [H_CURRENTSPRITEOFFSET]
	add $6
	ld l, a
	ld a, [hl]         ; c2x6 (movement byte 1)
	cp $fe
	jr nc, .canMove    ; values $fe and $ff
	and a
	ret
.canMove
	ld a, [W_TILESETCOLLISIONPTR]
	ld l, a
	ld a, [W_TILESETCOLLISIONPTR+1]
	ld h, a
.tilePassableLoop
	ld a, [hli]
	cp $ff
	jr z, .impassable
	cp c
	jr nz, .tilePassableLoop
	ld h, $c2
	ld a, [H_CURRENTSPRITEOFFSET]
	add $6
	ld l, a
	ld a, [hl]         ; $c2x6 (movement byte 1)
	inc a
	jr z, .impassable  ; if $ff, no movement allowed (however, changing direction is)
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	add $4
	ld l, a
	ld a, [hli]        ; c1x4 (screen Y pos)
	add $4             ; align to blocks (Y pos is always 4 pixels off)
	add d              ; add Y delta
	cp $80             ; if value is >$80, the destination is off screen (either $81 or $FF underflow)
	jr nc, .impassable ; don't walk off screen
	inc l
	ld a, [hl]         ; c1x6 (screen X pos)
	add e              ; add X delta
	cp $90             ; if value is >$90, the destination is off screen (either $91 or $FF underflow)
	jr nc, .impassable ; don't walk off screen
	push de
	push bc
	call Func_4c70
	pop bc
	pop de
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	add $c
	ld l, a
	ld a, [hl]         ; c1xc (forbidden directions flags(?))
	and b              ; check against chosen direction (1,2,4 or 8)
	jr nz, .impassable ; direction forbidden, don't go there
	ld h, $c2
	ld a, [H_CURRENTSPRITEOFFSET]
	add $2
	ld l, a
	ld a, [hli]        ; c2x2 (sprite Y displacement, initialized at $8, keep track of where a sprite did go)
	bit 7, d           ; check if going upwards (d=$ff) 
	jr nz, .upwards
	add d
	cp $5
	jr c, .impassable  ; if c2x2+d < 5, don't go ;bug: this tests probably were supposed to prevent sprites
	jr .checkHorizontal                          ; from walking out too far, but this line makes sprites get stuck
.upwards                                         ; whenever they walked upwards 5 steps
	sub $1                                       ; on the other hand, the amount a sprite can walk out to the
	jr c, .impassable  ; if d2x2 == 0, don't go  ; right of bottom is not limited (until the counter overflows)
.checkHorizontal
	ld d, a
	ld a, [hl]         ; c2x3 (sprite X displacement, initialized at $8, keep track of where a sprite did go)
	bit 7, e           ; check if going left (e=$ff) 
	jr nz, .left
	add e
	cp $5              ; compare, but no conditional jump like in the vertical check above (bug?)
	jr .passable
.left
	sub $1
	jr c, .impassable  ; if d2x3 == 0, don't go
.passable
	ld [hld], a        ; update c2x3
	ld [hl], d         ; update c2x2
	and a              ; clear carry (marking success)
	ret
.impassable
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	inc a
	ld l, a
	ld [hl], $2        ; c1x1 = 2 (set movement status to delayed)
	inc l
	inc l
	xor a
	ld [hli], a        ; c1x3 = 0 (clear Y movement delta)
	inc l
	ld [hl], a         ; c1x5 = 0 (clear X movement delta)
	inc h
	ld a, [H_CURRENTSPRITEOFFSET]
	add $8
	ld l, a
	call GenRandom
	ld a, [H_RAND1] ; $FF00+$d3
	and $7f
	ld [hl], a         ; c2x8: set next movement delay to a random value in [0,$7f] (again with delay $100 if value is 0)
	scf                ; set carry (marking failure to walk)
	ret

; known jump sources: 4f59 (1:4f59), 5115 (1:5115)
; calculates the tile pointer pointing to the tile the current sprite stancs on
; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to
; hl: output pointer
getTileSpriteStandsOn: ; 5207 (1:5207)
	ld h, $c1
	ld a, [H_CURRENTSPRITEOFFSET]
	add $4
	ld l, a
	ld a, [hli]     ; c1x4: screen Y position
	add $4          ; align to 2*2 tile blocks (Y position is always off 4 pixels to the top)
	and $f0         ; in case object is currently moving
	srl a           ; screen Y tile * 4
	ld c, a
	ld b, $0
	inc l
	ld a, [hl]      ; c1x6: screen Y position
	srl a
	srl a
	srl a           ; screen X tile
	add $14         ; screen X tile + 20
	ld d, $0
	ld e, a
	ld hl, W_SCREENTILESBUFFER
	add hl, bc
	add hl, bc
	add hl, bc
	add hl, bc
	add hl, bc
	add hl, de     ; W_SCREENTILESBUFFER + 20*(screen Y tile + 1) + screen X tile
	ret

; loads [de+a] into a
LoadDEPlusA: ; 522f (1:522f)
	add e
	ld e, a
	jr nc, .noCarry
	inc d
.noCarry
	ld a, [de]
	ret

; known jump sources: 4c6a (1:4c6a)
Func_5236: ; 5236 (1:5236)
	ld a, [$d730]
	bit 7, a
	ret z
	ld hl, $d72e
	bit 7, [hl]
	set 7, [hl]
	jp z, Func_52a6
	ld hl, $cc97
	ld a, [$cd37]
	add l
	ld l, a
	jr nc, .asm_5251
	inc h
.asm_5251
	ld a, [hl]
	cp $40
	jr nz, .asm_525f
	call Func_52b2
	ld c, $4
	ld a, $fe
	jr .asm_5289
.asm_525f
	cp $0
	jr nz, .asm_526c
	call Func_52b2
	ld c, $0
	ld a, $2
	jr .asm_5289
.asm_526c
	cp $80
	jr nz, .asm_5279
	call Func_52b7
	ld c, $8
	ld a, $fe
	jr .asm_5289
.asm_5279
	cp $c0
	jr nz, .asm_5286
	call Func_52b7
	ld c, $c
	ld a, $2
	jr .asm_5289
.asm_5286
	cp $ff
	ret
.asm_5289
	ld b, a
	ld a, [hl]
	add b
	ld [hl], a
	ld a, [H_CURRENTSPRITEOFFSET]
	add $9
	ld l, a
	ld a, c
	ld [hl], a
	call Func_52c3
	ld hl, $cf18
	dec [hl]
	ret nz
	ld a, $8
	ld [$cf18], a
	ld hl, $cd37
	inc [hl]
	ret

; known jump sources: 5243 (1:5243)
Func_52a6: ; 52a6 (1:52a6)
	xor a
	ld [$cd37], a
	ld a, $8
	ld [$cf18], a
	jp Func_52c3

; known jump sources: 5256 (1:5256), 5263 (1:5263)
Func_52b2: ; 52b2 (1:52b2)
	ld a, $4
	ld b, a
	jr asm_52ba

; known jump sources: 5270 (1:5270), 527d (1:527d)
Func_52b7: ; 52b7 (1:52b7)
	ld a, $6
	ld b, a
asm_52ba: ; 52ba (1:52ba)
	ld hl, $c100
	ld a, [H_CURRENTSPRITEOFFSET]
	add l
	add b
	ld l, a
	ret

; known jump sources: 5294 (1:5294), 52af (1:52af)
Func_52c3: ; 52c3 (1:52c3)
	ld hl, $c200
	ld a, [H_CURRENTSPRITEOFFSET]
	add $e
	ld l, a
	ld a, [hl]
	dec a
	swap a
	ld b, a
	ld hl, $c100
	ld a, [H_CURRENTSPRITEOFFSET]
	add $9
	ld l, a
	ld a, [hl]
	cp $0
	jr z, .asm_52ea
	cp $4
	jr z, .asm_52ea
	cp $8
	jr z, .asm_52ea
	cp $c
	jr z, .asm_52ea
	ret
.asm_52ea
	add b
	ld b, a
	ld [$FF00+$e9], a
	call Func_5301
	ld hl, $c100
	ld a, [H_CURRENTSPRITEOFFSET]
	add $2
	ld l, a
	ld a, [$FF00+$e9]
	ld b, a
	ld a, [$FF00+$ea]
	add b
	ld [hl], a
	ret

; known jump sources: 52ee (1:52ee)
Func_5301: ; 5301 (1:5301)
	ld a, [H_CURRENTSPRITEOFFSET]
	add $7
	ld l, a
	ld a, [hl]
	inc a
	ld [hl], a
	cp $4
	ret nz
	xor a
	ld [hl], a
	inc l
	ld a, [hl]
	inc a
	and $3
	ld [hl], a
	ld [$FF00+$ea], a
	ret

; known jump sources: 5a75 (1:5a75)
Func_5317: ; 5317 (1:5317)
	ld c, $50
	call DelayFrames
	call ClearScreen
	call UpdateSprites
	call LoadFontTilePatterns
	call LoadHpBarAndStatusTilePatterns
	call Func_5ae6
	FuncCoord 3, 8 ; $c443
	ld hl, Coord
	ld b, $2
	ld c, $c
	call Func_5ab3
	FuncCoord 4, 10 ; $c46c
	ld hl, Coord
	ld de, .unknown_550f ; $550f
	call PlaceString
	ld hl, W_NUMHITS ; $d074
	xor a
	ld [hli], a
	ld [hl], $50
	ld hl, $d152
	ld a, $fd
	ld b, $6
.asm_534c
	ld [hli], a
	dec b
	jr nz, .asm_534c
	ld hl, $d141
	ld a, $fd
	ld b, $7
.asm_5357
	ld [hli], a
	dec b
	jr nz, .asm_5357
	ld b, $a
.asm_535d
	call GenRandom
	cp $fd
	jr nc, .asm_535d
	ld [hli], a
	dec b
	jr nz, .asm_535d
	ld hl, W_SCREENTILESBACKBUFFER
	ld a, $fd
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld b, $c8
	xor a
.asm_5373
	ld [hli], a
	dec b
	jr nz, .asm_5373
	ld hl, W_GRASSRATE ; $d887
	ld bc, $1a9
.asm_537d
	xor a
	ld [hli], a
	dec bc
	ld a, b
	or c
	jr nz, .asm_537d
	ld hl, W_PARTYMONEND ; $d16a
	ld de, $c512
	ld bc, $0
.asm_538d
	inc c
	ld a, c
	cp $fd
	jr z, .asm_53a9
	ld a, b
	dec a
	jr nz, .asm_539c
	ld a, c
	cp $d
	jr z, .asm_53b2
.asm_539c
	inc hl
	ld a, [hl]
	cp $fe
	jr nz, .asm_538d
	ld a, c
	ld [de], a
	inc de
	ld [hl], $ff
	jr .asm_538d
.asm_53a9
	ld a, $ff
	ld [de], a
	inc de
	ld bc, $100
	jr .asm_538d
.asm_53b2
	ld a, $ff
	ld [de], a
	call Func_227f
	ld a, [$FF00+$aa]
	cp $2
	jr nz, .asm_53d2
	call Delay3
	xor a
	ld [$FF00+$ac], a
	ld a, $81
	ld [$FF00+$2], a
	call DelayFrame
	xor a
	ld [$FF00+$ac], a
	ld a, $81
	ld [$FF00+$2], a
.asm_53d2
	call Delay3
	ld a, $8
	ld [rIE], a ; $FF00+$ff
	ld hl, $d141
	ld de, W_SCREENTILESBACKBUFFER2
	ld bc, $11
	call Func_216f
	ld a, $fe
	ld [de], a
	ld hl, $d152
	ld de, $d893
	ld bc, $1a8
	call Func_216f
	ld a, $fe
	ld [de], a
	ld hl, W_SCREENTILESBACKBUFFER
	ld de, $c5d0
	ld bc, $c8
	call Func_216f
	ld a, $d
	ld [rIE], a ; $FF00+$ff
	ld a, $ff
	call PlaySound
	ld a, [$FF00+$aa]
	cp $2
	jr z, .asm_5431
	ld hl, W_SCREENTILESBACKBUFFER2
.asm_5415
	ld a, [hli]
	and a
	jr z, .asm_5415
	cp $fd
	jr z, .asm_5415
	cp $fe
	jr z, .asm_5415
	dec hl
	ld de, $d148
	ld c, $a
.asm_5427
	ld a, [hli]
	cp $fe
	jr z, .asm_5427
	ld [de], a
	inc de
	dec c
	jr nz, .asm_5427
.asm_5431
	ld hl, $d896
.asm_5434
	ld a, [hli]
	and a
	jr z, .asm_5434
	cp $fd
	jr z, .asm_5434
	cp $fe
	jr z, .asm_5434
	dec hl
	ld de, W_GRASSRATE ; $d887
	ld c, $b
.asm_5446
	ld a, [hli]
	cp $fe
	jr z, .asm_5446
	ld [de], a
	inc de
	dec c
	jr nz, .asm_5446
	ld de, W_ENEMYMONCOUNT ; $d89c
	ld bc, $194
.asm_5456
	ld a, [hli]
	cp $fe
	jr z, .asm_5456
	ld [de], a
	inc de
	dec bc
	ld a, b
	or c
	jr nz, .asm_5456
	ld de, W_SCREENTILESBACKBUFFER
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	ld c, $2
.asm_546a
	ld a, [de]
	inc de
	and a
	jr z, .asm_546a
	cp $fd
	jr z, .asm_546a
	cp $fe
	jr z, .asm_546a
	cp $ff
	jr z, .asm_5489
	push hl
	push bc
	ld b, $0
	dec a
	ld c, a
	add hl, bc
	ld a, $fe
	ld [hl], a
	pop bc
	pop hl
	jr .asm_546a
.asm_5489
	ld hl, W_PARTYMON6_MOVE4PP ; $d267
	dec c
	jr nz, .asm_546a
	ld de, $c5d0
	ld hl, W_WATERRATE ; $d8a4
	ld c, $2
.asm_5497
	ld a, [de]
	inc de
	and a
	jr z, .asm_5497
	cp $fd
	jr z, .asm_5497
	cp $fe
	jr z, .asm_5497
	cp $ff
	jr z, .asm_54b6
	push hl
	push bc
	ld b, $0
	dec a
	ld c, a
	add hl, bc
	ld a, $fe
	ld [hl], a
	pop bc
	pop hl
	jr .asm_5497
.asm_54b6
	ld hl, $d9a0
	dec c
	jr nz, .asm_5497
	ld a, $ac
	ld [$cf8d], a
	ld a, $d9
	ld [$cf8e], a
	xor a
	ld [$cc38], a
	ld a, $ff
	call PlaySound
	ld a, [$FF00+$aa]
	cp $2
	ld c, $42
	call z, DelayFrames
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $3
	ld a, $32
	ld [W_ISLINKBATTLE], a ; $d12b
	jr nz, .asm_5506
	ld a, $4
	ld [W_ISLINKBATTLE], a ; $d12b
	ld a, $e1
	ld [W_CUROPPONENT], a ; $d059
	call ClearScreen
	call Delay3
	ld hl, W_OPTIONS ; $d355
	res 7, [hl]
	ld a, $2c
	call Predef ; indirect jump to Func_3ef18 (3ef18 (f:6f18))
	ld a, $7
	call Predef ; indirect jump to HealParty (f6a5 (3:76a5))
	jp Func_577d
.asm_5506
	ld c, $1f
	ld a, $d9
	call PlayMusic
	jr .asm_551c

.unknown_550f: ; 550f (1:550f)
INCBIN "baserom.gbc",$550f,$551c - $550f

.asm_551c
	ld hl, Unknown_5a5b ; $5a5b
	ld b, $0
	ld a, [$cc38]
	cp $ff
	jp z, Func_42dd
	add a
	ld c, a
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	jp [hl]

INCBIN "baserom.gbc",$5530,$577d - $5530

; known jump sources: 5503 (1:5503)
Func_577d: ; 577d (1:577d)
	call GBPalWhiteOutWithDelay3
	ld hl, $cfc4
	ld a, [hl]
	push af
	push hl
	res 0, [hl]
	xor a
	ld [$d72d], a
	dec a
	ld [$d42f], a
	call LoadMapData
	ld b, BANK(Func_c335)
	ld hl, Func_c335
	call Bankswitch ; indirect jump to Func_c335 (c335 (3:4335))
	pop hl
	pop af
	ld [hl], a
	call GBFadeIn2
	ret

INCBIN "baserom.gbc",$57a2,$5a24 - $57a2

SSAnne8AfterBattleText2: ; 5a24 (1:5a24)
	TX_FAR _SSAnne8AfterBattleText2
	db $50
; 0x5a24 + 5 bytes

INCBIN "baserom.gbc",$5a29,$5a5b - $5a29

Unknown_5a5b: ; 5a5b (1:5a5b)
INCBIN "baserom.gbc",$5a5b,$5a5f - $5a5b

; known jump sources: 3888 (0:3888)
Func_5a5f: ; 5a5f (1:5a5f)
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $2
	jr z, .asm_5a75
	cp $3
	jr z, .asm_5a75
	cp $5
	ret nz
	ld a, $4d
	call Predef ; indirect jump to Func_5aaf (5aaf (1:5aaf))
	jp InitGame
.asm_5a75
	call Func_5317
	ld hl, $7670
	ld a, h
	ld [$d52f], a
	ld a, l
	ld [$d52e], a
	ld a, $1b
	ld [$d52b], a
	ld hl, $17d1
	ld a, h
	ld [$d531], a
	ld a, l
	ld [$d530], a
	xor a
	ld [W_GRASSRATE], a ; $d887
	inc a
	ld [W_ISLINKBATTLE], a ; $d12b
	ld [$FF00+$b5], a
	ld a, $a
	ld [$cfc7], a
	ld a, $2
	ld [$c0f0], a
	ld a, $ca
	ld [$c0ee], a
	jp PlaySound

; known jump sources: 5a6f (1:5a6f)
Func_5aaf: ; 5aaf (1:5aaf)
	ret

INCBIN "baserom.gbc",$5ab0,$5ab3 - $5ab0

; known jump sources: 4c17 (1:4c17), 5332 (1:5332), 75b4 (1:75b4)
Func_5ab3: ; 5ab3 (1:5ab3)
	push hl
	ld a, $78
	ld [hli], a
	inc a
	call Func_5ae0
	inc a
	ld [hl], a
	pop hl
	ld de, $14
	add hl, de
.asm_5ac2
	push hl
	ld a, $7b
	ld [hli], a
	ld a, $7f
	call Func_5ae0
	ld [hl], $77
	pop hl
	ld de, $14
	add hl, de
	dec b
	jr nz, .asm_5ac2
	ld a, $7c
	ld [hli], a
	ld a, $76
	call Func_5ae0
	ld [hl], $7d
	ret

; known jump sources: 5ab8 (1:5ab8), 5ac8 (1:5ac8), 5ada (1:5ada)
Func_5ae0: ; 5ae0 (1:5ae0)
	ld d, c
.asm_5ae1
	ld [hli], a
	dec d
	jr nz, .asm_5ae1
	ret

; known jump sources: 5328 (1:5328)
Func_5ae6: ; 5ae6 (1:5ae6)
	ld de, TrainerInfoTextBoxTileGraphics ; $7b98
	ld hl, $9760
	ld bc, (BANK(TrainerInfoTextBoxTileGraphics) << 8) +$09
	jp CopyVideoData
; 5af2 (1:5af2)

MainMenu: ; 5af2 (1:5af2)
; Check save file
	call Func_5bff
	xor a
	ld [$D08A],a
	inc a
	ld [$D088],a
	call Func_609e
	jr nc,.next0

	; Predef 52 loads the save from SRAM to RAM
	ld a,$52
	call Predef

.next0
	ld c,20
	call DelayFrames
	xor a
	ld [$D12B],a
	ld hl,$CC2B
	ld [hli],a
	ld [hli],a
	ld [hli],a
	ld [hl],a
	ld [$D07C],a
	ld hl,$D72E
	res 6,[hl]
	call ClearScreen
	call GoPAL_SET_CF1C
	call LoadTextBoxTilePatterns
	call LoadFontTilePatterns
	ld hl,$D730
	set 6,[hl]
	ld a,[$D088]
	cp a,1
	jr z,.next1
	FuncCoord 0,0
	ld hl,Coord
	ld b,6
	ld c,13
	call TextBoxBorder
	FuncCoord 2,2
	ld hl,Coord
	ld de,Unknown_5d7e ; $5d7e
	call PlaceString
	jr .next2
.next1
	FuncCoord 0,0
	ld hl,Coord
	ld b,4
	ld c,13
	call TextBoxBorder
	FuncCoord 2,2
	ld hl,Coord
	ld de,Unknown_5d87 ; $5d87
	call PlaceString
.next2
	ld hl,$D730
	res 6,[hl]
	call UpdateSprites ; OAM?
	xor a
	ld [$CC26],a
	ld [$CC2A],a
	ld [$CC34],a
	inc a
	ld [$CC25],a
	inc a
	ld [$CC24],a
	ld a,$B
	ld [$CC29],a
	ld a,[$D088]
	ld [$CC28],a
	call HandleMenuInput
	bit 1,a
	jp nz,Func_42dd ; load title screen (gfx and arrangement)
	ld c,20
	call DelayFrames
	ld a,[$CC26]
	ld b,a
	ld a,[$D088]
	cp a,2
	jp z,.next3
	inc b ; adjust MenuArrow_Counter
.next3
	ld a,b
	and a
	jr z,.next4 ; if press_A on Continue
	cp a,1
	jp z,Func_5d52 ; if press_A on NewGame
	call DisplayOptionMenu ; if press_a on Options
	ld a,1
	ld [$D08A],a
	jp .next0
.next4
	call Func_5db5
	ld hl,$D126
	set 5,[hl]
.next6
	xor a
	ld [H_NEWLYPRESSEDBUTTONS],a
	ld [H_NEWLYRELEASEDBUTTONS],a
	ld [H_CURRENTPRESSEDBUTTONS],a
	call GetJoypadState
	ld a,[H_CURRENTPRESSEDBUTTONS]
	bit 0,a
	jr nz,.next5
	bit 1,a
	jp nz,.next0
	jr .next6
.next5
	call GBPalWhiteOutWithDelay3
	call ClearScreen
	ld a,4
	ld [$D52A],a
	ld c,10
	call DelayFrames
	ld a,[$D5A2]
	and a
	jp z,Func_5d5f
	ld a,[W_CURMAP] ; map ID
	cp a,HALL_OF_FAME
	jp nz,Func_5d5f
	xor a
	ld [$D71A],a
	ld hl,$D732
	set 2,[hl]
	call Function62CE
	jp Func_5d5f
Func_5bff: ; 5bff (1:5bff)
	ld a,1
	ld [$D358],a
	ld a,3
	ld [$D355],a
	ret
; 0x5c0a

; known jump sources: 72b0 (1:72b0)
Func_5c0a: ; 5c0a (1:5c0a)
	xor a
	ld [$d358], a
	ld hl, $d72e
	set 6, [hl]
	ld hl, Unknown_6b20 ; $6b20
	call PrintText
	call SaveScreenTilesToBuffer1
	ld hl, UnnamedText_5d43 ; $5d43
	call PrintText
	FuncCoord 5, 5 ; $c409
	ld hl, Coord
	ld b, $6
	ld c, $d
	call TextBoxBorder
	call UpdateSprites
	FuncCoord 7, 7 ; $c433
	ld hl, Coord
	ld de, Unknown_5d97 ; $5d97
	call PlaceString
	xor a
	ld [$cd37], a
	ld [$d72d], a
	ld hl, W_TOPMENUITEMY ; $cc24
	ld a, $7
	ld [hli], a
	ld a, $6
	ld [hli], a
	xor a
	ld [hli], a
	inc hl
	ld a, $2
	ld [hli], a
	inc a
	ld [hli], a
	xor a
	ld [hl], a
.asm_5c52
	call HandleMenuInput
	and $3
	add a
	add a
	ld b, a
	ld a, [W_CURMENUITEMID] ; $cc26
	add b
	add $d0
	ld [$cc42], a
	ld [$cc43], a
.asm_5c66
	call Func_2247
	ld a, [$cc3d]
	ld b, a
	and $f0
	cp $d0
	jr z, .asm_5c7d
	ld a, [$cc3e]
	ld b, a
	and $f0
	cp $d0
	jr nz, .asm_5c66
.asm_5c7d
	ld a, b
	and $c
	jr nz, .asm_5c8b
	ld a, [$cc42]
	and $c
	jr z, .asm_5c52
	jr .asm_5ca1
.asm_5c8b
	ld a, [$cc42]
	and $c
	jr z, .asm_5c98
	ld a, [$FF00+$aa]
	cp $2
	jr z, .asm_5ca1
.asm_5c98
	ld a, b
	ld [$cc42], a
	and $3
	ld [W_CURMENUITEMID], a ; $cc26
.asm_5ca1
	ld a, [$FF00+$aa]
	cp $2
	jr nz, .asm_5cb1
	call DelayFrame
	call DelayFrame
	ld a, $81
	ld [$FF00+$2], a
.asm_5cb1
	ld b, $7f
	ld c, $7f
	ld d, $ec
	ld a, [$cc42]
	and $8
	jr nz, .asm_5ccc
	ld a, [W_CURMENUITEMID] ; $cc26
	cp $2
	jr z, .asm_5ccc
	ld c, d
	ld d, b
	dec a
	jr z, .asm_5ccc
	ld b, c
	ld c, d
.asm_5ccc
	ld a, b
	FuncCoord 6, 7 ; $c432
	ld [Coord], a
	ld a, c
	FuncCoord 6, 9 ; $c45a
	ld [Coord], a
	ld a, d
	FuncCoord 6, 11 ; $c482
	ld [Coord], a
	ld c, $28
	call DelayFrames
	call LoadScreenTilesFromBuffer1
	ld a, [$cc42]
	and $8
	jr nz, .asm_5d2d
	ld a, [W_CURMENUITEMID] ; $cc26
	cp $2
	jr z, .asm_5d2d
	xor a
	ld [$d700], a
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	ld a, $f0
	jr nz, .asm_5cfc
	ld a, $ef
.asm_5cfc
	ld [$d72d], a
	ld hl, UnnamedText_5d48 ; $5d48
	call PrintText
	ld c, $32
	call DelayFrames
	ld hl, $d732
	res 1, [hl]
	ld a, [W_ANIMATIONID] ; $d07c
	ld [$d71a], a
	call Function62CE
	ld c, $14
	call DelayFrames
	xor a
	ld [W_MENUJOYPADPOLLCOUNT], a ; $cc34
	ld [$cc42], a
	inc a
	ld [W_ISLINKBATTLE], a ; $d12b
	ld [$cc47], a
	jr Func_5d5f
.asm_5d2d
	xor a
	ld [W_MENUJOYPADPOLLCOUNT], a ; $cc34
	call Delay3
	call Func_72d7
	ld hl, UnnamedText_5d4d ; $5d4d
	call PrintText
	ld hl, $d72e
	res 6, [hl]
	ret
; 5d43 (1:5d43)
UnnamedText_5d43: ; 5d43 (1:5d43)
	TX_FAR _UnnamedText_5d43
	db $50
; 0x5d43 + 5 bytes

UnnamedText_5d48: ; 5d48 (1:5d48)
	TX_FAR _UnnamedText_5d48
	db $50
; 0x5d48 + 5 bytes

UnnamedText_5d4d: ; 5d4d (1:5d4d)
	TX_FAR _UnnamedText_5d4d
	db $50
; 0x5d4d + 5 bytes

; known jump sources: 5ba4 (1:5ba4)
Func_5d52: ; 5d52 (1:5d52)
	ld hl, $d732
	res 1, [hl]
	call OakSpeech
	ld c, $14
	call DelayFrames

; known jump sources: 5be5 (1:5be5), 5bed (1:5bed), 5bfc (1:5bfc), 5d2b (1:5d2b)
Func_5d5f: ; 5d5f (1:5d5f)
	xor a
	ld [H_NEWLYPRESSEDBUTTONS], a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [$FF00+$b5], a
	ld [$d72d], a
	ld hl, $d732
	set 0, [hl]
	call ResetPlayerSpriteData
	ld c, $14
	call DelayFrames
	ld a, [$cc47]
	and a
	ret nz
	jp EnterMap

Unknown_5d7e: ; 5d7e (1:5d7e)
INCBIN "baserom.gbc",$5d7e,$5d87 - $5d7e

Unknown_5d87: ; 5d87 (1:5d87)
INCBIN "baserom.gbc",$5d87,$5d97 - $5d87

Unknown_5d97: ; 5d97 (1:5d97)
INCBIN "baserom.gbc",$5d97,$5db5 - $5d97

; known jump sources: 5bb2 (1:5bb2)
Func_5db5: ; 5db5 (1:5db5)
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	FuncCoord 4, 7 ; $c430
	ld hl, Coord
	ld b, $8
	ld c, $e
	call TextBoxBorder
	FuncCoord 5, 9 ; $c459
	ld hl, Coord
	ld de, Unknown_5e6a ; $5e6a
	call PlaceString
	FuncCoord 12, 9 ; $c460
	ld hl, Coord
	ld de, W_PLAYERNAME ; $d158
	call PlaceString
	FuncCoord 17, 11 ; $c48d
	ld hl, Coord
	call Func_5e2f
	FuncCoord 16, 13 ; $c4b4
	ld hl, Coord
	call Func_5e42
	FuncCoord 13, 15 ; $c4d9
	ld hl, Coord
	call Func_5e55
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld c, $1e
	jp DelayFrames

INCBIN "baserom.gbc",$5def,$5e2f - $5def

; known jump sources: 5dd7 (1:5dd7)
Func_5e2f: ; 5e2f (1:5e2f)
	push hl
	ld hl, W_OBTAINEDBADGES ; $d356
	ld b, $1
	call CountSetBits
	pop hl
	ld de, $d11e
	ld bc, $102
	jp PrintNumber

; known jump sources: 5ddd (1:5ddd)
Func_5e42: ; 5e42 (1:5e42)
	push hl
	ld hl, W_OWNEDPOKEMON ; $d2f7
	ld b, $13
	call CountSetBits
	pop hl
	ld de, $d11e
	ld bc, $103
	jp PrintNumber

; known jump sources: 5de3 (1:5de3)
Func_5e55: ; 5e55 (1:5e55)
	ld de, $da41
	ld bc, $103
	call PrintNumber
	ld [hl], $6d
	inc hl
	ld de, $da43
	ld bc, $8102
	jp PrintNumber

Unknown_5e6a: ; 5e6a (1:5e6a)
INCBIN "baserom.gbc",$5e6a,$5e8a - $5e6a

DisplayOptionMenu: ; 5e8a (1:5e8a)
	FuncCoord 0,0
	ld hl,Coord
	ld b,3
	ld c,18
	call TextBoxBorder
	FuncCoord 0,5
	ld hl,Coord
	ld b,3
	ld c,18
	call TextBoxBorder
	FuncCoord 0,10
	ld hl,Coord
	ld b,3
	ld c,18
	call TextBoxBorder
	FuncCoord 1,1
	ld hl,Coord
	ld de,TextSpeedOptionText
	call PlaceString
	FuncCoord 1,6
	ld hl,Coord
	ld de,BattleAnimationOptionText
	call PlaceString
	FuncCoord 1,11
	ld hl,Coord
	ld de,BattleStyleOptionText
	call PlaceString
	FuncCoord 2,16
	ld hl,Coord
	ld de,OptionMenuCancelText
	call PlaceString
	xor a
	ld [W_CURMENUITEMID],a
	ld [W_OLDMENUITEMID],a
	inc a
	ld [$d358],a
	ld [$cd40],a
	ld a,3 ; text speed cursor Y coordinate
	ld [W_TOPMENUITEMY],a
	call SetCursorPositionsFromOptions
	ld a,[$cd3d] ; text speed cursor X coordinate
	ld [W_TOPMENUITEMX],a
	ld a,$01
	ld [H_AUTOBGTRANSFERENABLED],a ; enable auto background transfer
	call Delay3
.loop
	call PlaceMenuCursor
	call SetOptionsFromCursorPositions
.getJoypadStateLoop
	call GetJoypadStateLowSensitivity
	ld a,[$ffb5]
	ld b,a
	and a,%11111011 ; any key besides select pressed?
	jr z,.getJoypadStateLoop
	bit 1,b ; B button pressed?
	jr nz,.exitMenu
	bit 3,b ; Start button pressed?
	jr nz,.exitMenu
	bit 0,b ; A button pressed?
	jr z,.checkDirectionKeys
	ld a,[W_TOPMENUITEMY]
	cp a,16 ; is the cursor on Cancel?
	jr nz,.loop
.exitMenu
	ld a,$90
	call PlaySound ; play sound
	ret
.eraseOldMenuCursor
	ld [W_TOPMENUITEMX],a
	call EraseMenuCursor
	jp .loop
.checkDirectionKeys
	ld a,[W_TOPMENUITEMY]
	bit 7,b ; Down pressed?
	jr nz,.downPressed
	bit 6,b ; Up pressed?
	jr nz,.upPressed
	cp a,8 ; cursor in Battle Animation section?
	jr z,.cursorInBattleAnimation
	cp a,13 ; cursor in Battle Style section?
	jr z,.cursorInBattleStyle
	cp a,16 ; cursor on Cancel?
	jr z,.loop
.cursorInTextSpeed
	bit 5,b ; Left pressed?
	jp nz,.pressedLeftInTextSpeed
	jp .pressedRightInTextSpeed
.downPressed
	cp a,16
	ld b,-13
	ld hl,$cd3d
	jr z,.updateMenuVariables
	ld b,5
	cp a,3
	inc hl
	jr z,.updateMenuVariables
	cp a,8
	inc hl
	jr z,.updateMenuVariables
	ld b,3
	inc hl
	jr .updateMenuVariables
.upPressed
	cp a,8
	ld b,-5
	ld hl,$cd3d
	jr z,.updateMenuVariables
	cp a,13
	inc hl
	jr z,.updateMenuVariables
	cp a,16
	ld b,-3
	inc hl
	jr z,.updateMenuVariables
	ld b,13
	inc hl
.updateMenuVariables
	add b
	ld [W_TOPMENUITEMY],a
	ld a,[hl]
	ld [W_TOPMENUITEMX],a
	call PlaceUnfilledArrowMenuCursor
	jp .loop
.cursorInBattleAnimation
	ld a,[$cd3e] ; battle animation cursor X coordinate
	xor a,$0b ; toggle between 1 and 10
	ld [$cd3e],a
	jp .eraseOldMenuCursor
.cursorInBattleStyle
	ld a,[$cd3f] ; battle style cursor X coordinate
	xor a,$0b ; toggle between 1 and 10
	ld [$cd3f],a
	jp .eraseOldMenuCursor
.pressedLeftInTextSpeed
	ld a,[$cd3d] ; text speed cursor X coordinate
	cp a,1
	jr z,.updateTextSpeedXCoord
	cp a,7
	jr nz,.fromSlowToMedium
	sub a,6
	jr .updateTextSpeedXCoord
.fromSlowToMedium
	sub a,7
	jr .updateTextSpeedXCoord
.pressedRightInTextSpeed
	ld a,[$cd3d] ; text speed cursor X coordinate
	cp a,14
	jr z,.updateTextSpeedXCoord
	cp a,7
	jr nz,.fromFastToMedium
	add a,7
	jr .updateTextSpeedXCoord
.fromFastToMedium
	add a,6
.updateTextSpeedXCoord
	ld [$cd3d],a ; text speed cursor X coordinate
	jp .eraseOldMenuCursor

TextSpeedOptionText: ; 5fc0 (1:5fc0)
	db "TEXT SPEED",$4E
	db " FAST  MEDIUM SLOW@"

BattleAnimationOptionText: ; 5fde (1:5fde)
	db "BATTLE ANIMATION",$4E
	db " ON       OFF@"

BattleStyleOptionText: ; 5ffd (1:5ffd)
	db "BATTLE STYLE",$4E
	db " SHIFT    SET@"

OptionMenuCancelText: ; 6018 (1:6018)
	db "CANCEL@"

; sets the options variable according to the current placement of the menu cursors in the options menu
SetOptionsFromCursorPositions: ; 601f (1:601f)
	ld hl,TextSpeedOptionData
	ld a,[$cd3d] ; text speed cursor X coordinate
	ld c,a
.loop
	ld a,[hli]
	cp c
	jr z,.textSpeedMatchFound
	inc hl
	jr .loop
.textSpeedMatchFound
	ld a,[hl]
	ld d,a
	ld a,[$cd3e] ; battle animation cursor X coordinate
	dec a
	jr z,.battleAnimationOn
.battleAnimationOff
	set 7,d
	jr .checkBattleStyle
.battleAnimationOn
	res 7,d
.checkBattleStyle
	ld a,[$cd3f] ; battle style cursor X coordinate
	dec a
	jr z,.battleStyleShift
.battleStyleSet
	set 6,d
	jr .storeOptions
.battleStyleShift
	res 6,d
.storeOptions
	ld a,d
	ld [W_OPTIONS],a
	ret

; reads the options variable and places menu cursors in the correct positions within the options menu
SetCursorPositionsFromOptions: ; 604c (1:604c)
	ld hl,TextSpeedOptionData + 1
	ld a,[W_OPTIONS]
	ld c,a
	and a,$3f
	push bc
	ld de,2
	call IsInArray
	pop bc
	dec hl
	ld a,[hl]
	ld [$cd3d],a ; text speed cursor X coordinate
	FuncCoord 0,3
	ld hl,Coord
	call .placeUnfilledRightArrow
	sla c
	ld a,1 ; On
	jr nc,.storeBattleAnimationCursorX
	ld a,10 ; Off
.storeBattleAnimationCursorX
	ld [$cd3e],a ; battle animation cursor X coordinate
	FuncCoord 0,8
	ld hl,Coord
	call .placeUnfilledRightArrow
	sla c
	ld a,1
	jr nc,.storeBattleStyleCursorX
	ld a,10
.storeBattleStyleCursorX
	ld [$cd3f],a ; battle style cursor X coordinate
	FuncCoord 0,13
	ld hl,Coord
	call .placeUnfilledRightArrow
; cursor in front of Cancel
	FuncCoord 0,16
	ld hl,Coord
	ld a,1
.placeUnfilledRightArrow
	ld e,a
	ld d,0
	add hl,de
	ld [hl],$ec ; unfilled right arrow menu cursor
	ret

; table that indicates how the 3 text speed options affect frame delays
; Format:
; 00: X coordinate of menu cursor
; 01: delay after printing a letter (in frames)
TextSpeedOptionData: ; 6096 (1:6096)
	db 14,5 ; Slow
	db  7,3 ; Medium
	db  1,1 ; Fast
	db 7 ; default X coordinate (Medium)
	db $ff ; terminator

; known jump sources: 5afd (1:5afd)
Func_609e: ; 609e (1:609e)
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	ld [$4000], a
	ld b, $b
	ld hl, $a598
.asm_60b0
	ld a, [hli]
	cp $50
	jr z, .asm_60c1
	dec b
	jr nz, .asm_60b0
	xor a
	ld [$0], a
	ld [$6000], a
	and a
	ret
.asm_60c1
	xor a
	ld [$0], a
	ld [$6000], a
	scf
	ret

; known jump sources: 6128 (1:6128)
Func_60ca: ; 60ca (1:60ca)
	ld a, [$d358]
	push af
	ld a, [W_OPTIONS] ; $d355
	push af
	ld a, [$d732]
	push af
	ld hl, W_PLAYERNAME ; $d158
	ld bc, $d8a
	xor a
	call FillMemory
	ld hl, $c100
	ld bc, $200
	xor a
	call FillMemory
	pop af
	ld [$d732], a
	pop af
	ld [W_OPTIONS], a ; $d355
	pop af
	ld [$d358], a
	ld a, [$d08a]
	and a
	call z, Func_5bff
	ld hl, NintenText ; $45aa
	ld de, W_PLAYERNAME ; $d158
	ld bc, $b
	call CopyData
	ld hl, SonyText ; $45b1
	ld de, W_RIVALNAME ; $d34a
	ld bc, $b
	jp CopyData
; 6115 (1:6115)

OakSpeech: ; 6115 (1:6115)
	ld a,$FF
	call PlaySound ; stop music
	ld a,2     ; bank of song
	ld c,a
	ld a,$EF    ; song #
	call PlayMusic  ; plays music
	call ClearScreen
	call LoadTextBoxTilePatterns
	call Func_60ca
	ld a,$18
	call Predef ; indirect jump to InitializePlayerData
	ld hl,$D53A
	ld a,POTION
	ld [$CF91],a
	ld a,1
	ld [$CF96],a
	call AddItemToInventory  ; give one potion
	ld a,[$D07C]
	ld [$D71A],a
	call Function62CE
	xor a
	ld [$FFD7],a
	ld a,[$D732]
	bit 1,a ; XXX when is bit 1 set?
	jp nz,Function61BC ; easter egg: skip the intro
	ld de,ProfOakPic
	ld bc,$1300
	call IntroPredef3B   ; displays Oak pic?
	call FadeInIntroPic
	ld hl,OakSpeechText1
	call PrintText      ; prints text box
	call GBFadeOut2
	call ClearScreen
	ld a,NIDORINO
	ld [$D0B5],a    ; pic displayed is stored at this location
	ld [$CF91],a
	call GetMonHeader      ; this is also related to the pic
	FuncCoord 6, 4 ; $c3f6
	ld hl,Coord     ; position on tilemap the pic is displayed
	call LoadFlippedFrontSpriteByMonIndex      ; displays pic?
	call MovePicLeft
	ld hl,OakSpeechText2
	call PrintText      ; Prints text box
	call GBFadeOut2
	call ClearScreen
	ld de,RedPicFront
	ld bc,$0400     ; affects the position of the player pic
	call IntroPredef3B      ; displays player pic?
	call MovePicLeft
	ld hl,IntroducePlayerText
	call PrintText
	call Func_695d ; brings up NewName/Red/etc menu
	call GBFadeOut2
	call ClearScreen
	ld de,Rival1Pic
	ld bc,$1300
	call IntroPredef3B ; displays rival pic
	call FadeInIntroPic
	ld hl,IntroduceRivalText
	call PrintText
	call Func_69a4
Function61BC: ; 61bc (1:61bc)
	call GBFadeOut2
	call ClearScreen
	ld de,RedPicFront
	ld bc,$0400
	call IntroPredef3B
	call GBFadeIn2
	ld a,[$D72D]
	and a
	jr nz,.next
	ld hl,OakSpeechText3
	call PrintText
.next	ld a,[H_LOADEDROMBANK]
	push af
	ld a,$9C
	call PlaySound
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ld c,4
	call DelayFrames
	ld de,RedSprite ; $4180
	ld hl,$8000
	ld bc,(BANK(RedSprite) << 8) +$0C
	call CopyVideoData
	ld de,ShrinkPic1
	ld bc,$0400
	call IntroPredef3B
	ld c,4
	call DelayFrames
	ld de,ShrinkPic2
	ld bc,$0400
	call IntroPredef3B
	call ResetPlayerSpriteData
	ld a,[H_LOADEDROMBANK]
	push af
	ld a,2
	ld [$C0EF],a
	ld [$C0F0],a
	ld a,$A
	ld [$CFC7],a
	ld a,$FF
	ld [$C0EE],a
	call PlaySound ; stop music
	pop af
	ld [H_LOADEDROMBANK],a
	ld [$2000],a
	ld c,$14
	call DelayFrames
	FuncCoord 6, 5 ; $c40a
	ld hl,Coord
	ld b,7
	ld c,7
	call ClearScreenArea
	call LoadTextBoxTilePatterns
	ld a,1
	ld [$CFCB],a
	ld c,$32
	call DelayFrames
	call GBFadeOut2
	jp ClearScreen
OakSpeechText1: ; 6253 (1:6253)
	TX_FAR _OakSpeechText1
	db "@"
OakSpeechText2: ; 6258 (1:6258)
	TX_FAR _OakSpeechText2A
	db $14
	TX_FAR _OakSpeechText2B
	db "@"
IntroducePlayerText: ; 6262 (1:6262)
	TX_FAR _IntroducePlayerText
	db "@"
IntroduceRivalText: ; 6267 (1:6267)
	TX_FAR _IntroduceRivalText
	db "@"
OakSpeechText3: ; 626c (1:626c)
	TX_FAR _OakSpeechText3
	db "@"

FadeInIntroPic: ; 6271 (1:6271)
	ld hl,IntroFadePalettes
	ld b,6
.next
	ld a,[hli]
	ld [rBGP],a
	ld c,10
	call DelayFrames
	dec b
	jr nz,.next
	ret

IntroFadePalettes: ; 6282 (1:6282)
	db %01010100
	db %10101000
	db %11111100
	db %11111000
	db %11110100
	db %11100100

MovePicLeft: ; 6288 (1:6288)
	ld a,119
	ld [$FF4B],a
	call DelayFrame

	ld a,$E4
	ld [rBGP],a
.next
	call DelayFrame
	ld a,[$FF4B]
	sub 8
	cp $FF
	ret z
	ld [$FF4B],a
	jr .next

Predef3B: ; 62a1 (1:62a1)
	call Load16BitRegisters
IntroPredef3B: ; 62a4 (1:62a4)
	push bc
	ld a,b
	call UncompressSpriteFromDE
	ld hl,S_SPRITEBUFFER1
	ld de,$A000
	ld bc,$0310
	call CopyData
	ld de,$9000
	call InterlaceMergeSpriteBuffers
	pop bc
	ld a,c
	and a
	FuncCoord 15, 1 ; $c3c3
	ld hl,Coord
	jr nz,.next
	FuncCoord 6, 4 ; $c3f6
	ld hl,Coord
.next
	xor a
	ld [$FFE1],a
	ld a,1
	jp Predef

Function62CE: ; 62CE XXX called by 4B2 948 989 5BF9 5D15
	call Func_62ff
	ld a,$19
	call Predef
	ld hl,$D732
	bit 2,[hl]
	res 2,[hl]
	jr z,.next
	ld a,[$D71A]
	jr .next2
.next
	bit 1,[hl]
	jr z,.next3
	call Func_64ea
.next3
	ld a,0
.next2
	ld b,a
	ld a,[$D72D]
	and a
	jr nz,.next4
	ld a,b
.next4
	ld hl,$D732
	bit 4,[hl]
	ret nz
	ld [$D365],a
	ret

; known jump sources: 62ce (1:62ce)
Func_62ff: ; 62ff (1:62ff)
	ld a, [$d72d]
	cp $ef
	jr nz, .asm_6314
	ld hl, Unknown_6428 ; $6428
	ld a, [$FF00+$aa]
	cp $2
	jr z, .asm_6334
	ld hl, Unknown_6430 ; $6430
	jr .asm_6334
.asm_6314
	cp $f0
	jr nz, .asm_6326
	ld hl, Unknown_6438 ; $6438
	ld a, [$FF00+$aa]
	cp $2
	jr z, .asm_6334
	ld hl, Unknown_6440 ; $6440
	jr .asm_6334
.asm_6326
	ld a, [$d732]
	bit 1, a
	jr nz, .asm_6346
	bit 2, a
	jr nz, .asm_6346
	ld hl, FirstMapSpec ; $6420
.asm_6334
	ld de, W_CURMAP ; $d35e
	ld c, $7
.asm_6339
	ld a, [hli]
	ld [de], a
	inc de
	dec c
	jr nz, .asm_6339
	ld a, [hli]
	ld [W_CURMAPTILESET], a ; $d367
	xor a
	jr .asm_63b3
.asm_6346
	ld a, [$d365]
	ld hl, $d732
	bit 4, [hl]
	jr nz, .asm_635b
	bit 6, [hl]
	res 6, [hl]
	jr z, .asm_638e
	ld a, [$d719]
	jr .asm_6391
.asm_635b
	ld hl, $d72d
	res 4, [hl]
	ld a, [$d71d]
	ld b, a
	ld [W_CURMAP], a ; $d35e
	ld a, [$d71e]
	ld c, a
	ld hl, Unknown_63bf ; $63bf
	ld de, $0
	ld a, $6
	ld [$d12f], a
.asm_6376
	ld a, [hli]
	cp b
	jr z, .asm_637d
	inc hl
	jr .asm_6381
.asm_637d
	ld a, [hli]
	cp c
	jr z, .asm_6388
.asm_6381
	ld a, [$d12f]
	add e
	ld e, a
	jr .asm_6376
.asm_6388
	ld hl, Unknown_63d8 ; $63d8
	add hl, de
	jr .asm_63a4
.asm_638e
	ld a, [$d71a]
.asm_6391
	ld b, a
	ld [W_CURMAP], a ; $d35e
	ld hl, FlyWarpDataPtr ; $6448
.asm_6398
	ld a, [hli]
	inc hl
	cp b
	jr z, .asm_63a1
	inc hl
	inc hl
	jr .asm_6398
.asm_63a1
	ld a, [hli]
	ld h, [hl]
	ld l, a
.asm_63a4
	ld de, $d35f
	ld c, $6
.asm_63a9
	ld a, [hli]
	ld [de], a
	inc de
	dec c
	jr nz, .asm_63a9
	xor a
	ld [W_CURMAPTILESET], a ; $d367
.asm_63b3
	ld [$d4e2], a
	ld [$d4e3], a
	ld a, $ff
	ld [$d42f], a
	ret

Unknown_63bf: ; 63bf (1:63bf)
INCBIN "baserom.gbc",$63bf,$63d8 - $63bf

Unknown_63d8: ; 63d8 (1:63d8)
INCBIN "baserom.gbc",$63d8,$6420 - $63d8

FirstMapSpec: ; 6420 (1:6420)
	db REDS_HOUSE_2F ; RedsHouse2F
; Original Format:
;   [Event Displacement][Y-block][X-block][Y-sub_block][X-sub_block]
; Macro Format:
;   FLYWARP_DATA [Map Width][Y-pos][X-pos]
	FLYWARP_DATA 4,6,3
	db $04 ;Tileset_id

Unknown_6428: ; 6428 (1:6428)
INCBIN "baserom.gbc",$6428,$6430 - $6428

Unknown_6430: ; 6430 (1:6430)
INCBIN "baserom.gbc",$6430,$6438 - $6430

Unknown_6438: ; 6438 (1:6438)
INCBIN "baserom.gbc",$6438,$6440 - $6438

Unknown_6440: ; 6440 (1:6440)
INCBIN "baserom.gbc",$6440,$6448 - $6440

FlyWarpDataPtr: ; 6448 (1:6448)
	db $00,0
	dw Map00FlyWarp
	db $01,0
	dw Map01FlyWarp
	db $02,0
	dw Map02FlyWarp
	db $03,0
	dw Map03FlyWarp
	db $04,0
	dw Map04FlyWarp
	db $05,0
	dw Map05FlyWarp
	db $06,0
	dw Map06FlyWarp
	db $07,0
	dw Map07FlyWarp
	db $08,0
	dw Map08FlyWarp
	db $09,0
	dw Map09FlyWarp
	db $0A,0
	dw Map0aFlyWarp
	db $0F,0
	dw Map0fFlyWarp
	db $15,0
	dw Map15FlyWarp

; Original Format:
;   [Event Displacement][Y-block][X-block][Y-sub_block][X-sub_block]
; Macro Format:
;   FLYWARP_DATA [Map Width][Y-pos][X-pos]
Map00FlyWarp: ; 647c (1:647c)
	FLYWARP_DATA 10,6,5
Map01FlyWarp: ; 6482 (1:6482)
	FLYWARP_DATA 20,26,23
Map02FlyWarp: ; 6488 (1:6488)
	FLYWARP_DATA 20,26,13
Map03FlyWarp: ; 648e (1:648e)
	FLYWARP_DATA 20,18,19
Map04FlyWarp: ; 6494 (1:6494)
	FLYWARP_DATA 10,6,3
Map05FlyWarp: ; 649a (1:649a)
	FLYWARP_DATA 20,4,11
Map06FlyWarp: ; 64a0 (1:64a0)
	FLYWARP_DATA 25,10,41
Map07FlyWarp: ; 64a6 (1:64a6)
	FLYWARP_DATA 20,28,19
Map08FlyWarp: ; 64ac (1:64ac)
	FLYWARP_DATA 10,12,11
Map09FlyWarp: ; 64b2 (1:64b2)
	FLYWARP_DATA 10,6,9
Map0aFlyWarp: ; 64b8 (1:64b8)
	FLYWARP_DATA 20,30,9
Map0fFlyWarp: ; 64be (1:64be)
	FLYWARP_DATA 45,6,11
Map15FlyWarp: ; 64c4 (1:64c4)
	FLYWARP_DATA 10,20,11

INCBIN "baserom.gbc",$64ca,$64ea - $64ca

; known jump sources: 62e8 (1:62e8)
Func_64ea: ; 64ea (1:64ea)
	ret

; known jump sources: e834 (3:6834), f33c (3:733c)
Func_64eb: ; 64eb (1:64eb)
	call SaveScreenTilesToBuffer1
	call Load16BitRegisters
	push hl
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	ld hl, W_SCREENTILESBUFFER
	ld b, $4
	ld c, $b
	call z, ClearScreenArea
	ld a, [$cf91]
	ld [$d11e], a
	call GetMonName
	ld hl, UnnamedText_6557 ; $6557
	call PrintText
	FuncCoord 14, 7 ; $c43a
	ld hl, Coord
	ld bc, $80f
	ld a, $14
	ld [$d125], a
	call DisplayTextBoxID
	pop hl
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jr nz, .asm_654c
	ld a, [$cfcb]
	push af
	xor a
	ld [$cfcb], a
	push hl
	ld a, $2
	ld [$d07d], a
	call Func_6596
	ld a, [W_ISINBATTLE] ; $d057
	and a
	jr nz, .asm_653e
	call Func_3e08
.asm_653e
	call LoadScreenTilesFromBuffer1
	pop hl
	pop af
	ld [$cfcb], a
	ld a, [$cf4b]
	cp $50
	ret nz
.asm_654c
	ld d, h
	ld e, l
	ld hl, $cd6d
	ld bc, $b
	jp CopyData
; 6557 (1:6557)
UnnamedText_6557: ; 6557 (1:6557)
	TX_FAR _UnnamedText_6557
	db $50
; 0x6557 + 5 bytes

; known jump sources: 1daa0 (7:5aa0)
Func_655c: ; 655c (1:655c)
	ld hl, $cee9
	xor a
	ld [$cfcb], a
	ld a, $2
	ld [$d07d], a
	call Func_6596
	call GBPalWhiteOutWithDelay3
	call Func_3dbe
	call LoadGBPal
	ld a, [$cf4b]
	cp $50
	jr z, .asm_6594
	ld hl, W_PARTYMON1NAME ; $d2b5
	ld bc, $b
	ld a, [W_WHICHPOKEMON] ; $cf92
	call AddNTimes
	ld e, l
	ld d, h
	ld hl, $cee9
	ld bc, $b
	call CopyData
	and a
	ret
.asm_6594
	scf
	ret

; known jump sources: 6532 (1:6532), 6568 (1:6568), 6981 (1:6981), 69c9 (1:69c9)
Func_6596: ; 6596 (1:6596)
	push hl
	ld hl, $d730
	set 6, [hl]
	call GBPalWhiteOutWithDelay3
	call ClearScreen
	call UpdateSprites
	ld b, $8
	call GoPAL_SET
	call LoadHpBarAndStatusTilePatterns
	call Func_675b
	ld b, BANK(Func_7176c)
	ld hl, Func_7176c
	call Bankswitch ; indirect jump to Func_7176c (7176c (1c:576c))
	FuncCoord 0, 4 ; $c3f0
	ld hl, Coord
	ld b, $9
	ld c, $12
	call TextBoxBorder
	call Func_68f8
	ld a, $3
	ld [W_TOPMENUITEMY], a ; $cc24
	ld a, $1
	ld [W_TOPMENUITEMX], a ; $cc25
	ld [W_OLDMENUITEMID], a ; $cc2a
	ld [W_CURMENUITEMID], a ; $cc26
	ld a, $ff
	ld [W_MENUWATCHEDKEYS], a ; $cc29
	ld a, $7
	ld [W_MAXMENUITEMID], a ; $cc28
	ld a, $50
	ld [$cf4b], a
	xor a
	ld hl, $ceea
	ld [hli], a
	ld [hli], a
	ld [W_SUBANIMTRANSFORM], a ; $d08b
.asm_65ed
	call Func_676f
	call GBPalNormal
	ld a, [$ceea]
	and a
	jr nz, .asm_662d
	call Func_680e
	call PlaceMenuCursor
.asm_65ff
	ld a, [W_CURMENUITEMID] ; $cc26
	push af
	ld b, BANK(Func_716f7)
	ld hl, Func_716f7
	call Bankswitch ; indirect jump to Func_716f7 (716f7 (1c:56f7))
	pop af
	ld [W_CURMENUITEMID], a ; $cc26
	call GetJoypadStateLowSensitivity
	ld a, [H_NEWLYPRESSEDBUTTONS]
	and a
	jr z, .asm_65ff
	ld hl, .unknown_665e ; $665e
.asm_661a
	sla a
	jr c, .asm_6624
	inc hl
	inc hl
	inc hl
	inc hl
	jr .asm_661a
.asm_6624
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	push de
	jp [hl]
.asm_662d
	pop de
	ld hl, $cf4b
	ld bc, $b
	call CopyData
	call GBPalWhiteOutWithDelay3
	call ClearScreen
	call CleanLCD_OAM
	call GoPAL_SET_CF1C
	call GBPalNormal
	xor a
	ld [W_SUBANIMTRANSFORM], a ; $d08b
	ld hl, $d730
	res 6, [hl]
	ld a, [W_ISINBATTLE] ; $d057
	and a
	jp z, LoadTextBoxTilePatterns
	ld hl, Func_3ee5b
	ld b, BANK(Func_3ee5b)
	jp Bankswitch ; indirect jump to Func_3ee5b (3ee5b (f:6e5b))

.unknown_665e: ; 665e (1:665e)
INCBIN "baserom.gbc",$665e,$667e - $665e

.asm_667e
	pop de
	ld de, .asm_65ed ; $65ed
	push de
	ld a, [$ceeb]
	xor $1
	ld [$ceeb], a
	ret
.asm_668c
	ld a, $1
	ld [$ceea], a
	ret
	ld a, [W_CURMENUITEMID] ; $cc26
	cp $5
	jr nz, .asm_66a0
	ld a, [W_TOPMENUITEMX] ; $cc25
	cp $11
	jr z, .asm_668c
.asm_66a0
	ld a, [W_CURMENUITEMID] ; $cc26
	cp $6
	jr nz, .asm_66ae
	ld a, [W_TOPMENUITEMX] ; $cc25
	cp $1
	jr z, .asm_667e
.asm_66ae
	ld hl, W_MENUCURSORLOCATION ; $cc30
	ld a, [hli]
	ld h, [hl]
	ld l, a
	inc hl
	ld a, [hl]
	ld [$ceed], a
	call Func_68eb
	ld a, [$ceed]
	cp $e5
	ld de, Unknown_6885 ; $6885
	jr z, .asm_66e3
	cp $e4
	ld de, Unknown_68d6 ; $68d6
	jr z, .asm_66e3
	ld a, [$d07d]
	cp $2
	jr nc, .asm_66db
	ld a, [$cee9]
	cp $7
	jr .asm_66e0
.asm_66db
	ld a, [$cee9]
	cp $a
.asm_66e0
	jr c, .asm_66ea
	ret
.asm_66e3
	push hl
	call Func_6871
	pop hl
	ret nc
	dec hl
.asm_66ea
	ld a, [$ceed]
	ld [hli], a
	ld [hl], $50
	ld a, $90
	call PlaySound
	ret
	ld a, [$cee9]
	and a
	ret z
	call Func_68eb
	dec hl
	ld [hl], $50
	ret
	ld a, [W_CURMENUITEMID] ; $cc26
	cp $6
	ret z
	ld a, [W_TOPMENUITEMX] ; $cc25
	cp $11
	jp z, Func_6714
	inc a
	inc a
	jr asm_6755

; known jump sources: 670d (1:670d)
Func_6714: ; 6714 (1:6714)
	ld a, $1
	jr asm_6755
	ld a, [W_CURMENUITEMID] ; $cc26
	cp $6
	ret z
	ld a, [W_TOPMENUITEMX] ; $cc25
	dec a
	jp z, Func_6728
	dec a
	jr asm_6755

; known jump sources: 6722 (1:6722)
Func_6728: ; 6728 (1:6728)
	ld a, $11
	jr asm_6755
	ld a, [W_CURMENUITEMID] ; $cc26
	dec a
	ld [W_CURMENUITEMID], a ; $cc26
	and a
	ret nz
	ld a, $6
	ld [W_CURMENUITEMID], a ; $cc26
	ld a, $1
	jr asm_6755
	ld a, [W_CURMENUITEMID] ; $cc26
	inc a
	ld [W_CURMENUITEMID], a ; $cc26
	cp $7
	jr nz, .asm_6750
	ld a, $1
	ld [W_CURMENUITEMID], a ; $cc26
	jr asm_6755
.asm_6750
	cp $6
	ret nz
	ld a, $1
asm_6755: ; 6755 (1:6755)
	ld [W_TOPMENUITEMX], a ; $cc25
	jp EraseMenuCursor

; known jump sources: 65ad (1:65ad)
Func_675b: ; 675b (1:675b)
	ld de, Unknown_6767 ; $6767
	ld hl, $8f00
	ld bc, $1
	jp CopyVideoDataDouble

Unknown_6767: ; 6767 (1:6767)
INCBIN "baserom.gbc",$6767,$676f - $6767

; known jump sources: 65ed (1:65ed)
Func_676f: ; 676f (1:676f)
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, [$ceeb]
	and a
	ld de, Unknown_679e ; $679e
	jr nz, .asm_677e
	ld de, Unknown_67d6 ; $67d6
.asm_677e
	FuncCoord 2, 5 ; $c406
	ld hl, Coord
	ld bc, $509
.asm_6784
	push bc
.asm_6785
	ld a, [de]
	ld [hli], a
	inc hl
	inc de
	dec c
	jr nz, .asm_6785
	ld bc, $16
	add hl, bc
	pop bc
	dec b
	jr nz, .asm_6784
	call PlaceString
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	jp Delay3

Unknown_679e: ; 679e (1:679e)
INCBIN "baserom.gbc",$679e,$67d6 - $679e

Unknown_67d6: ; 67d6 (1:67d6)
INCBIN "baserom.gbc",$67d6,$680e - $67d6

; known jump sources: 65f9 (1:65f9)
Func_680e: ; 680e (1:680e)
	call Func_68eb
	ld a, c
	ld [$cee9], a
	FuncCoord 10, 2 ; $c3d2
	ld hl, Coord
	ld bc, $10a
	call ClearScreenArea
	FuncCoord 10, 2 ; $c3d2
	ld hl, Coord
	ld de, $cf4b
	call PlaceString
	FuncCoord 10, 3 ; $c3e6
	ld hl, Coord
	ld a, [$d07d]
	cp $2
	jr nc, .asm_6835
	ld b, $7
	jr .asm_6837
.asm_6835
	ld b, $a
.asm_6837
	ld a, $76
.asm_6839
	ld [hli], a
	dec b
	jr nz, .asm_6839
	ld a, [$d07d]
	cp $2
	ld a, [$cee9]
	jr nc, .asm_684b
	cp $7
	jr .asm_684d
.asm_684b
	cp $a
.asm_684d
	jr nz, .asm_6867
	call EraseMenuCursor
	ld a, $11
	ld [W_TOPMENUITEMX], a ; $cc25
	ld a, $5
	ld [W_CURMENUITEMID], a ; $cc26
	ld a, [$d07d]
	cp $2
	ld a, $9
	jr nc, .asm_6867
	ld a, $6
.asm_6867
	ld c, a
	ld b, $0
	FuncCoord 10, 3 ; $c3e6
	ld hl, Coord
	add hl, bc
	ld [hl], $77
	ret

; known jump sources: 66e4 (1:66e4)
Func_6871: ; 6871 (1:6871)
	push de
	call Func_68eb
	dec hl
	ld a, [hl]
	pop hl
	ld de, $2
	call IsInArray
	ret nc
	inc hl
	ld a, [hl]
	ld [$ceed], a
	ret

Unknown_6885: ; 6885 (1:6885)
INCBIN "baserom.gbc",$6885,$68d6 - $6885

Unknown_68d6: ; 68d6 (1:68d6)
INCBIN "baserom.gbc",$68d6,$68eb - $68d6

; known jump sources: 66b9 (1:66b9), 66fb (1:66fb), 680e (1:680e), 6872 (1:6872)
Func_68eb: ; 68eb (1:68eb)
	ld hl, $cf4b
	ld c, $0
.asm_68f0
	ld a, [hl]
	cp $50
	ret z
	inc hl
	inc c
	jr .asm_68f0

; known jump sources: 65c2 (1:65c2)
Func_68f8: ; 68f8 (1:68f8)
	FuncCoord 0, 1 ; $c3b4
	ld hl, Coord
	ld a, [$d07d]
	ld de, Unknown_693f ; $693f
	and a
	jr z, .asm_6934
	ld de, Unknown_6945 ; $6945
	dec a
	jr z, .asm_6934
	ld a, [$cf91]
	ld [$cd5d], a
	push af
	ld b, BANK(Func_71882)
	ld hl, Func_71882
	call Bankswitch ; indirect jump to Func_71882 (71882 (1c:5882))
	pop af
	ld [$d11e], a
	call GetMonName
	FuncCoord 4, 1 ; $c3b8
	ld hl, Coord
	call PlaceString
	ld hl, $1
	add hl, bc
	ld [hl], $c9
	FuncCoord 1, 3 ; $c3dd
	ld hl, Coord
	ld de, Unknown_6953 ; $6953
	jr .asm_693c
.asm_6934
	call PlaceString
	ld l, c
	ld h, b
	ld de, Unknown_694d ; $694d
.asm_693c
	jp PlaceString

Unknown_693f: ; 693f (1:693f)
INCBIN "baserom.gbc",$693f,$6945 - $693f

Unknown_6945: ; 6945 (1:6945)
INCBIN "baserom.gbc",$6945,$694d - $6945

Unknown_694d: ; 694d (1:694d)
INCBIN "baserom.gbc",$694d,$6953 - $694d

Unknown_6953: ; 6953 (1:6953)
INCBIN "baserom.gbc",$6953,$695d - $6953

; known jump sources: 619e (1:619e)
Func_695d: ; 695d (1:695d)
	call Unnamed_6a12
	ld de, DefaultNamesPlayer ; $6aa8
	call Func_6a6c
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jr z, .asm_697a
	ld hl, DefaultNamesPlayerList ; $6af2
	call Func_6ad6
	ld de, W_PLAYERNAME ; $d158
	call Func_69ec
	jr .asm_6999
.asm_697a
	ld hl, W_PLAYERNAME ; $d158
	xor a
	ld [$d07d], a
	call Func_6596
	ld a, [$cf4b]
	cp $50
	jr z, .asm_697a
	call ClearScreen
	call Delay3
	ld de, RedPicFront ; $6ede
	ld b, $4
	call IntroPredef3B
.asm_6999
	ld hl, UnnamedText_699f ; $699f
	jp PrintText
; 699f (1:699f)
UnnamedText_699f: ; 699f (1:699f)
	TX_FAR _UnnamedText_699f
	db $50
; 0x699f + 5 bytes

Func_69a4: ; 69a4 (1:69a4)
	call Unnamed_6a12 ; 0x69a4 call 0x6a12
	ld de, DefaultNamesRival
	call Func_6a6c
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jr z, .asm_69c1
	ld hl, DefaultNamesRivalList
	call Func_6ad6
	ld de, W_RIVALNAME ; $d34a
	call Func_69ec
	jr .asm_69e1
.asm_69c1
	ld hl, W_RIVALNAME ; $d34a
	ld a, $1
	ld [$d07d], a
	call Func_6596
	ld a, [$cf4b]
	cp $50
	jr z, .asm_69c1
	call ClearScreen
	call Delay3
	ld de, Rival1Pic ; $6049
	ld b, $13
	call IntroPredef3B
.asm_69e1
	ld hl, UnnamedText_69e7 ; $69e7
	jp PrintText
; 69e7 (1:69e7)
UnnamedText_69e7: ; 69e7 (1:69e7)
	TX_FAR _UnnamedText_69e7
	db $50
; 0x69e7 + 5 bytes

; known jump sources: 6975 (1:6975), 69bc (1:69bc)
Func_69ec: ; 69ec (1:69ec)
	push de
	ld hl, W_SCREENTILESBUFFER
	ld bc, $c0b
	call ClearScreenArea
	ld c, $a
	call DelayFrames
	pop de
	ld hl, $cd6d
	ld bc, $b
	call CopyData
	call Delay3
	FuncCoord 12, 4 ; $c3fc
	ld hl, Coord
	ld de, $67d
	ld a, $ff
	jr asm_6a19
; 6a12 (1:6a12)
Unnamed_6a12: ; 6a12 (1:6a12)
	FuncCoord 5, 4 ; $c3f5
	ld hl, Coord
	ld de, $67d
	xor a
asm_6a19: ; 6a19 (1:6a19)
	push hl
	push de
	push bc
	ld [$FF00+$8d], a
	ld a, d
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld a, e
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	ld c, a
	ld a, [$FF00+$8d]
	and a
	jr nz, .asm_6a2d
	ld d, $0
	add hl, de
.asm_6a2d
	ld d, h
	ld e, l
.asm_6a2f
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, [$FF00+$8d]
	and a
	jr nz, .asm_6a3c
	ld a, [hli]
	ld [hld], a
	dec hl
	jr .asm_6a3f
.asm_6a3c
	ld a, [hld]
	ld [hli], a
	inc hl
.asm_6a3f
	dec c
	jr nz, .asm_6a2f
	ld a, [$FF00+$8d]
	and a
	jr z, .asm_6a4a
	xor a
	dec hl
	ld [hl], a
.asm_6a4a
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Delay3
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	ld c, a
	ld h, d
	ld l, e
	ld a, [$FF00+$8d]
	and a
	jr nz, .asm_6a5e
	inc hl
	jr .asm_6a5f
.asm_6a5e
	dec hl
.asm_6a5f
	ld d, h
	ld e, l
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	dec a
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	jr nz, .asm_6a2f
	pop bc
	pop de
	pop hl
	ret

; known jump sources: 6963 (1:6963), 69aa (1:69aa)
Func_6a6c: ; 6a6c (1:6a6c)
	push de
	ld hl, W_SCREENTILESBUFFER
	ld b, $a
	ld c, $9
	call TextBoxBorder
	FuncCoord 3, 0 ; $c3a3
	ld hl, Coord
	ld de, .namestring ; $6aa3
	call PlaceString
	pop de
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	call PlaceString
	call UpdateSprites
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_OLDMENUITEMID], a ; $cc2a
	inc a
	ld [W_TOPMENUITEMX], a ; $cc25
	ld [W_MENUWATCHEDKEYS], a ; $cc29
	inc a
	ld [W_TOPMENUITEMY], a ; $cc24
	inc a
	ld [W_MAXMENUITEMID], a ; $cc28
	jp HandleMenuInput

.namestring ; 6aa3 (1:6aa3)
	db "NAME@"

IF _RED
DefaultNamesPlayer: ; 6aa8 (1:6aa8)
	db "NEW NAME",$4E,"RED",$4E,"ASH",$4E,"JACK@"
DefaultNamesRival: ; 6abe (1:6abe)
	db "NEW NAME",$4E,"BLUE",$4E,"GARY",$4E,"JOHN@"
ENDC
IF _BLUE
DefaultNamesPlayer: ; 6aa8 (1:6aa8)
	db "NEW NAME",$4E,"BLUE",$4E,"GARY",$4E,"JOHN@"
DefaultNamesRival: ; 6abe (1:6abe)
	db "NEW NAME",$4E,"RED",$4E,"ASH",$4E,"JACK@"
ENDC

; known jump sources: 696f (1:696f), 69b6 (1:69b6)
Func_6ad6: ; 6ad6 (1:6ad6)
	ld b, a
	ld c, $0
.asm_6ad9
	ld d, h
	ld e, l
.asm_6adb
	ld a, [hli]
	cp $50
	jr nz, .asm_6adb
	ld a, b
	cp c
	jr z, .asm_6ae7
	inc c
	jr .asm_6ad9
.asm_6ae7
	ld h, d
	ld l, e
	ld de, $cd6d
	ld bc, $14
	jp CopyData
; 6af2 (1:6af2)
IF _RED
DefaultNamesPlayerList: ; 6af2 (1:6af2)
	db "NEW NAME@RED@ASH@JACK@"
DefaultNamesRivalList: ; 6b08 (1:6b08)
	db "NEW NAME@BLUE@GARY@JOHN@"
ENDC
IF _BLUE
DefaultNamesPlayerList: ; 6af2 (1:6af2)
	db "NEW NAME@BLUE@GARY@JOHN@"
DefaultNamesRivalList: ; 6b08 (1:6b08)
	db "NEW NAME@RED@ASH@JACK@"
ENDC

Unknown_6b20: ; 6b20 (1:6b20)
	db "@"

; subtracts the amount the player paid from their money
; sets carry flag if there is enough money and unsets carry flag if not
SubtractAmountPaidFromMoney_: ; 6b21 (1:6b21)
	ld de,W_PLAYERMONEY3
	ld hl,$ff9f ; total price of items
	ld c,3 ; length of money in bytes
	call StringCmp
	ret c
	ld de,W_PLAYERMONEY1
	ld hl,$ffa1 ; total price of items
	ld c,3 ; length of money in bytes
	ld a,$0c
	call Predef ; subtract total price from money
	ld a,$13
	ld [$d125],a
	call DisplayTextBoxID ; redraw money text box
	and a
	ret

HandleItemListSwapping: ; 6b44 (1:6b44)
	ld a,[W_LISTMENUID]
	cp a,ITEMLISTMENU
	jp nz,DisplayListMenuIDLoop ; only rearrange item list menus
	push hl
	ld hl,$cf8b
	ld a,[hli]
	ld h,[hl]
	ld l,a
	inc hl ; hl = beginning of list entries
	ld a,[W_CURMENUITEMID]
	ld b,a
	ld a,[W_LISTSCROLLOFFSET]
	add b
	add a
	ld c,a
	ld b,0
	add hl,bc ; hl = address of currently selected item entry
	ld a,[hl]
	pop hl
	inc a
	jp z,DisplayListMenuIDLoop ; ignore attempts to swap the Cancel menu item
	ld a,[$cc35] ; ID of item chosen for swapping (counts from 1)
	and a ; has the first item to swap already been chosen?
	jr nz,.swapItems
; if not, set the currently selected item as the first item
	ld a,[W_CURMENUITEMID]
	inc a
	ld b,a
	ld a,[W_LISTSCROLLOFFSET] ; index of top (visible) menu item within the list
	add b
	ld [$cc35],a ; ID of item chosen for swapping (counts from 1)
	ld c,20
	call DelayFrames
	jp DisplayListMenuIDLoop
.swapItems
	ld a,[W_CURMENUITEMID]
	inc a
	ld b,a
	ld a,[W_LISTSCROLLOFFSET]
	add b
	ld b,a
	ld a,[$cc35] ; ID of item chosen for swapping (counts from 1)
	cp b ; is the currently selected item the same as the first item to swap?
	jp z,DisplayListMenuIDLoop ; ignore attempts to swap an item with itself
	dec a
	ld [$cc35],a ; ID of item chosen for swapping (counts from 1)
	ld c,20
	call DelayFrames
	push hl
	push de
	ld hl,$cf8b
	ld a,[hli]
	ld h,[hl]
	ld l,a
	inc hl ; hl = beginning of list entries
	ld d,h
	ld e,l ; de = beginning of list entries
	ld a,[W_CURMENUITEMID]
	ld b,a
	ld a,[W_LISTSCROLLOFFSET]
	add b
	add a
	ld c,a
	ld b,0
	add hl,bc ; hl = address of currently selected item entry
	ld a,[$cc35] ; ID of item chosen for swapping (counts from 1)
	add a
	add e
	ld e,a
	jr nc,.noCarry
	inc d
.noCarry ; de = address of first item to swap
	ld a,[de]
	ld b,a
	ld a,[hli]
	cp b
	jr z,.swapSameItemType
.swapDifferentItems
	ld [$ff95],a ; [$ff95] = second item ID
	ld a,[hld]
	ld [$ff96],a ; [$ff96] = second item quantity
	ld a,[de]
	ld [hli],a ; put first item ID in second item slot
	inc de
	ld a,[de]
	ld [hl],a ; put first item quantity in second item slot
	ld a,[$ff96]
	ld [de],a ; put second item quantity in first item slot
	dec de
	ld a,[$ff95]
	ld [de],a ; put second item ID in first item slot
	xor a
	ld [$cc35],a ; 0 means no item is currently being swapped
	pop de
	pop hl
	jp DisplayListMenuIDLoop
.swapSameItemType
	inc de
	ld a,[hl]
	ld b,a
	ld a,[de]
	add b ; a = sum of both item quantities
	cp a,100 ; is the sum too big for one item slot?
	jr c,.combineItemSlots
; swap enough items from the first slot to max out the second slot if they can't be combined
	sub a,99
	ld [de],a
	ld a,99
	ld [hl],a
	jr .done
.combineItemSlots
	ld [hl],a ; put the sum in the second item slot
	ld hl,$cf8b
	ld a,[hli]
	ld h,[hl]
	ld l,a
	dec [hl] ; decrease the number of items
	ld a,[hl]
	ld [$d12a],a ; update number of items variable
	cp a,1
	jr nz,.skipSettingMaxMenuItemID
	ld [W_MAXMENUITEMID],a ; if the number of items is only one now, update the max menu item ID
.skipSettingMaxMenuItemID
	dec de
	ld h,d
	ld l,e
	inc hl
	inc hl ; hl = address of item after first item to swap
.moveItemsUpLoop ; erase the first item slot and move up all the following item slots to fill the gap
	ld a,[hli]
	ld [de],a
	inc de
	inc a ; reached the $ff terminator?
	jr z,.afterMovingItemsUp
	ld a,[hli]
	ld [de],a
	inc de
	jr .moveItemsUpLoop
.afterMovingItemsUp
	xor a
	ld [W_LISTSCROLLOFFSET],a
	ld [W_CURMENUITEMID],a
.done
	xor a
	ld [$cc35],a ; 0 means no item is currently being swapped
	pop de
	pop hl
	jp DisplayListMenuIDLoop

DisplayPokemartDialogue_: ; 6c20 (1:6c20)
	ld a,[W_LISTSCROLLOFFSET]
	ld [$d07e],a
	call UpdateSprites ; move sprites
	xor a
	ld [$cf0a],a ; flag that is set if something is sold or bought
.loop
	xor a
	ld [W_LISTSCROLLOFFSET],a
	ld [W_CURMENUITEMID],a
	ld [$cc2f],a
	inc a
	ld [$cf93],a
	ld a,$13
	ld [$d125],a
	call DisplayTextBoxID ; draw money text box
	ld a,$15
	ld [$d125],a
	call DisplayTextBoxID ; do buy/sell/quit menu
	ld hl,$d128 ; pointer to this pokemart's inventory
	ld a,[hli]
	ld l,[hl]
	ld h,a ; hl = address of inventory
	ld a,[$d12e]
	cp a,$02
	jp z,.done
	ld a,[$d12d] ; ID of the chosen menu item
	and a ; buying?
	jp z,.buyMenu
	dec a ; selling?
	jp z,.sellMenu
	dec a ; quitting?
	jp z,.done
.sellMenu
	xor a
	ld [$cf93],a
	ld a,$02
	ld [$d11b],a
	ld hl, Func_39bd5
	ld b, BANK(Func_39bd5)
	call Bankswitch
	ld a,[W_NUMBAGITEMS]
	and a
	jp z,.bagEmpty
	ld hl,PokemonSellingGreetingText
	call PrintText
	call SaveScreenTilesToBuffer1 ; save screen
.sellMenuLoop
	call LoadScreenTilesFromBuffer1 ; restore saved screen
	ld a,$13
	ld [$d125],a
	call DisplayTextBoxID ; draw money text box
	ld hl,W_NUMBAGITEMS
	ld a,l
	ld [$cf8b],a
	ld a,h
	ld [$cf8c],a
	xor a
	ld [$cf93],a
	ld [W_CURMENUITEMID],a
	ld a,ITEMLISTMENU
	ld [W_LISTMENUID],a
	call DisplayListMenuID
	jp c,.returnToMainPokemartMenu ; if the player closed the menu
.confirmItemSale ; if the player is trying to sell a specific item
	call IsKeyItem ; check if item is unsellable
	ld a,[$d124]
	and a
	jr nz,.unsellableItem
	ld a,[$cf91]
	call IsItemHM
	jr c,.unsellableItem
	ld a,PRICEDITEMLISTMENU
	ld [W_LISTMENUID],a
	ld [$ff8e],a ; halve prices when selling
	call DisplayChooseQuantityMenu
	inc a
	jr z,.sellMenuLoop ; if the player closed the choose quantity menu with the B button
	ld hl,PokemartTellSellPrice
	ld bc,$0e01
	call PrintText
	FuncCoord 14,7
	ld hl,Coord
	ld bc,$080f
	ld a,$14
	ld [$d125],a
	call DisplayTextBoxID ; yes/no menu
	ld a,[$d12e]
	cp a,$02
	jr z,.sellMenuLoop ; if the player pressed the B button
	ld a,[$d12d] ; ID of the chosen menu item
	dec a
	jr z,.sellMenuLoop ; if the player chose No
.sellItem
	ld a,[$cf0a] ; flag that is set if something is sold or bought
	and a
	jr nz,.skipSettingFlag1
	inc a
	ld [$cf0a],a
.skipSettingFlag1
	call AddAmountSoldToMoney
	ld hl,W_NUMBAGITEMS
	call RemoveItemFromInventory
	jp .sellMenuLoop
.unsellableItem
	ld hl,PokemartUnsellableItemText
	call PrintText
	jp .returnToMainPokemartMenu
.bagEmpty
	ld hl,PokemartItemBagEmptyText
	call PrintText
	call SaveScreenTilesToBuffer1 ; save screen
	jp .returnToMainPokemartMenu
.buyMenu
	ld a,$01
	ld [$cf93],a
	ld a,$03
	ld [$d11b],a
	ld hl, Func_39bd5
	ld b, BANK(Func_39bd5)
	call Bankswitch
	ld hl,PokemartBuyingGreetingText
	call PrintText
	call SaveScreenTilesToBuffer1 ; save screen
.buyMenuLoop
	call LoadScreenTilesFromBuffer1 ; restore saved screen
	ld a,$13
	ld [$d125],a
	call DisplayTextBoxID ; draw money text box
	ld hl,$cf7b
	ld a,l
	ld [$cf8b],a
	ld a,h
	ld [$cf8c],a
	xor a
	ld [W_CURMENUITEMID],a
	inc a
	ld [$cf93],a
	inc a ; a = 2 (PRICEDITEMLISTMENU)
	ld [W_LISTMENUID],a
	call DisplayListMenuID
	jr c,.returnToMainPokemartMenu ; if the player closed the menu
	ld a,$63
	ld [$cf97],a
	xor a
	ld [$ff8e],a
	call DisplayChooseQuantityMenu
	inc a
	jr z,.buyMenuLoop ; if the player closed the choose quantity menu with the B button
	ld a,[$cf91] ; item ID
	ld [$d11e],a ; store item ID for GetItemName
	call GetItemName
	call CopyStringToCF4B ; copy name to $cf4b
	ld hl,PokemartTellBuyPrice
	call PrintText
	FuncCoord 14,7
	ld hl,Coord
	ld bc,$080f
	ld a,$14
	ld [$d125],a
	call DisplayTextBoxID ; yes/no menu
	ld a,[$d12e]
	cp a,$02
	jp z,.buyMenuLoop ; if the player pressed the B button
	ld a,[$d12d] ; ID of the chosen menu item
	dec a
	jr z,.buyMenuLoop ; if the player chose No
.buyItem
	call .isThereEnoughMoney
	jr c,.notEnoughMoney
	ld hl,W_NUMBAGITEMS
	call AddItemToInventory
	jr nc,.bagFull
	call SubtractAmountPaidFromMoney
	ld a,[$cf0a] ; flag that is set if something is sold or bought
	and a
	jr nz,.skipSettingFlag2
	ld a,$01
	ld [$cf0a],a
.skipSettingFlag2
	ld a,$b2
	call PlaySoundWaitForCurrent ; play sound
	call WaitForSoundToFinish ; wait until sound is done playing
	ld hl,PokemartBoughtItemText
	call PrintText
	jp .buyMenuLoop
.returnToMainPokemartMenu
	call LoadScreenTilesFromBuffer1 ; restore save screen
	ld a,$13
	ld [$d125],a
	call DisplayTextBoxID ; draw money text box
	ld hl,PokemartAnythingElseText
	call PrintText
	jp .loop
.isThereEnoughMoney
	ld de,W_PLAYERMONEY3
	ld hl,$ff9f ; item price
	ld c,3 ; length of money in bytes
	jp StringCmp
.notEnoughMoney
	ld hl,PokemartNotEnoughMoneyText
	call PrintText
	jr .returnToMainPokemartMenu
.bagFull
	ld hl,PokemartItemBagFullText
	call PrintText
	jr .returnToMainPokemartMenu
.done
	ld hl,PokemartThankYouText
	call PrintText
	ld a,$01
	ld [$cfcb],a
	call UpdateSprites ; move sprites
	ld a,[$d07e]
	ld [W_LISTSCROLLOFFSET],a
	ret

PokemartBuyingGreetingText: ; 6e0c (1:6e0c)
	TX_FAR _PokemartBuyingGreetingText
	db $50

PokemartTellBuyPrice: ; 6e11 (1:6e11)
	TX_FAR _PokemartTellBuyPrice
	db $50

PokemartBoughtItemText: ; 6e16 (1:6e16)
	TX_FAR _PokemartBoughtItemText
	db $50

PokemartNotEnoughMoneyText: ; 6e1b (1:6e1b)
	TX_FAR _PokemartNotEnoughMoneyText
	db $50

PokemartItemBagFullText: ; 6e20 (1:6e20)
	TX_FAR _PokemartItemBagFullText
	db $50

PokemonSellingGreetingText: ; 6e25 (1:6e25)
	TX_FAR _PokemonSellingGreetingText
	db $50

PokemartTellSellPrice: ; 6e2a (1:6e2a)
	TX_FAR _PokemartTellSellPrice
	db $50

PokemartItemBagEmptyText: ; 6e2f (1:6e2f)
	TX_FAR _PokemartItemBagEmptyText
	db $50

PokemartUnsellableItemText: ; 6e34 (1:6e34)
	TX_FAR _PokemartUnsellableItemText
	db $50

PokemartThankYouText: ; 6e39 (1:6e39)
	TX_FAR _PokemartThankYouText
	db $50

PokemartAnythingElseText: ; 6e3e (1:6e3e)
	TX_FAR _PokemartAnythingElseText
	db $50

; known jump sources: e537 (3:6537), 3afae (e:6fae)
Func_6e43: ; 6e43 (1:6e43)
	call SaveScreenTilesToBuffer1
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, W_PARTYMON1NAME ; $d2b5
	call GetPartyMonName
	ld hl, $cd6d
	ld de, $d036
	ld bc, $b
	call CopyData

; known jump sources: 6ef2 (1:6ef2)
Func_6e5b: ; 6e5b (1:6e5b)
	ld hl, W_PARTYMON1_MOVE1 ; $d173
	ld bc, $2c
	ld a, [W_WHICHPOKEMON] ; $cf92
	call AddNTimes
	ld d, h
	ld e, l
	ld b, $4
.asm_6e6b
	ld a, [hl]
	and a
	jr z, .asm_6e8b
	inc hl
	dec b
	jr nz, .asm_6e6b
	push de
	call Func_6f07
	pop de
	jp c, Func_6eda
	push hl
	push de
	ld [$d11e], a
	call GetMoveName
	ld hl, UnnamedText_6fc8 ; $6fc8
	call PrintText
	pop de
	pop hl
.asm_6e8b
	ld a, [$d0e0]
	ld [hl], a
	ld bc, $15
	add hl, bc
	push hl
	push de
	dec a
	ld hl, Moves ; $4000
	ld bc, $6
	call AddNTimes
	ld de, $cee9
	ld a, BANK(Moves)
	call FarCopyData
	ld a, [$ceee]
	pop de
	pop hl
	ld [hl], a
	ld a, [W_ISINBATTLE] ; $d057
	and a
	jp z, Func_6efe
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld b, a
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	cp b
	jp nz, Func_6efe
	ld h, d
	ld l, e
	ld de, W_PLAYERMONMOVES
	ld bc, $4
	call CopyData
	ld bc, $11
	add hl, bc
	ld de, W_PLAYERMONPP ; $d02d
	ld bc, $4
	call CopyData
	jp Func_6efe

; known jump sources: 6e78 (1:6e78)
Func_6eda: ; 6eda (1:6eda)
	ld hl, UnnamedText_6fb9 ; $6fb9
	call PrintText
	FuncCoord 14, 7 ; $c43a
	ld hl, Coord
	ld bc, $80f
	ld a, $14
	ld [$d125], a
	call DisplayTextBoxID
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jp nz, Func_6e5b
	ld hl, UnnamedText_6fbe ; $6fbe
	call PrintText
	ld b, $0
	ret

; known jump sources: 6eb1 (1:6eb1), 6ebc (1:6ebc), 6ed7 (1:6ed7)
Func_6efe: ; 6efe (1:6efe)
	ld hl, UnnamedText_6fad ; $6fad
	call PrintText
	ld b, $1
	ret

; known jump sources: 6e74 (1:6e74)
Func_6f07: ; 6f07 (1:6f07)
	push hl
	ld hl, UnnamedText_6fc3 ; $6fc3
	call PrintText
	FuncCoord 14, 7 ; $c43a
	ld hl, Coord
	ld bc, $80f
	ld a, $14
	ld [$d125], a
	call DisplayTextBoxID
	pop hl
	ld a, [W_CURMENUITEMID] ; $cc26
	rra
	ret c
	ld bc, $fffc
	add hl, bc
	push hl
	ld de, $d0dc
	ld bc, $4
	call CopyData
	ld hl, Func_39b87
	ld b, BANK(Func_39b87)
	call Bankswitch ; indirect jump to Func_39b87 (39b87 (e:5b87))
	pop hl
.asm_6f39
	push hl
	ld hl, UnnamedText_6fb4 ; $6fb4
	call PrintText
	FuncCoord 4, 7 ; $c430
	ld hl, Coord
	ld b, $4
	ld c, $e
	call TextBoxBorder
	FuncCoord 6, 8 ; $c446
	ld hl, Coord
	ld de, $d0e1
	ld a, [$FF00+$f6]
	set 2, a
	ld [$FF00+$f6], a
	call PlaceString
	ld a, [$FF00+$f6]
	res 2, a
	ld [$FF00+$f6], a
	ld hl, W_TOPMENUITEMY ; $cc24
	ld a, $8
	ld [hli], a
	ld a, $5
	ld [hli], a
	xor a
	ld [hli], a
	inc hl
	ld a, [$cd6c]
	ld [hli], a
	ld a, $3
	ld [hli], a
	ld [hl], $0
	ld hl, $fff6
	set 1, [hl]
	call HandleMenuInput
	ld hl, $fff6
	res 1, [hl]
	push af
	call LoadScreenTilesFromBuffer1
	pop af
	pop hl
	bit 1, a
	jr nz, .asm_6fab
	push hl
	ld a, [W_CURMENUITEMID] ; $cc26
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
	push af
	push bc
	call IsMoveHM
	pop bc
	pop de
	ld a, d
	jr c, .asm_6fa2
	pop hl
	add hl, bc
	and a
	ret
.asm_6fa2
	ld hl, UnnamedText_6fe1 ; $6fe1
	call PrintText
	pop hl
	jr .asm_6f39
.asm_6fab
	scf
	ret

UnnamedText_6fad: ; 6fb4 (1:6fb4)
	TX_FAR UnnamedText_a273b
	db $b,6,"@"

UnnamedText_6fb4: ; 6fb4 (1:6fb4)
	TX_FAR _UnnamedText_6fb4
	db $50
; 0x6fb4 + 5 bytes

UnnamedText_6fb9: ; 6fb9 (1:6fb9)
	TX_FAR _UnnamedText_6fb9
	db $50
; 0x6fb9 + 5 bytes

UnnamedText_6fbe: ; 6fbe (1:6fbe)
	TX_FAR _UnnamedText_6fbe
	db $50
; 0x6fbe + 5 bytes

UnnamedText_6fc3: ; 6fc3 (1:6fc3)
	TX_FAR _UnnamedText_6fc3
	db $50
; 0x6fc3 + 5 bytes

UnnamedText_6fc8: ; 6fc8 (1:6fc8)
	TX_FAR _UnnamedText_6fc8 ; 0xa2819
	db $a
	db $8
	ld a, $ae
	call PlaySoundWaitForCurrent
	ld hl, UnnamedText_6fd7 ; $6fd7
	ret
; 0x6fd7

UnnamedText_6fd7: ; 6fd7 (1:6fd7)
	TX_FAR _UnnamedText_6fd7 ; 0xa2827
	db $a ; 0x6fdb
UnnamedText_6fdc: ; 6fdc (1:6fdc)
	TX_FAR _UnnamedText_6fdc
	db $50
; 0x6fe1

UnnamedText_6fe1: ; 6fe1 (1:6fe1)
	TX_FAR _UnnamedText_6fe1
	db $50
; 0x6fe1 + 5 bytes

DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6)
	call SaveScreenTilesToBuffer1 ; save screen
	ld hl, PokemonCenterWelcomeText
	call PrintText
	ld hl, $d72e
	bit 2, [hl]
	set 1, [hl]
	set 2, [hl]
	jr nz, .skipShallWeHealYourPokemon
	ld hl, ShallWeHealYourPokemonText
	call PrintText
.skipShallWeHealYourPokemon
	call YesNoChoicePokeCenter ; yes/no menu
	ld a, [W_CURMENUITEMID]
	and a
	jr nz, .declinedHealing ; if the player chose No
	call Unknown_7078
	call LoadScreenTilesFromBuffer1 ; restore screen
	ld hl, NeedYourPokemonText
	call PrintText
	ld a, $18
	ld [$c112], a ; make the nurse turn to face the machine
	call Delay3
	PREDEF HealPartyPredef
	ld b, BANK(Func_70433)
	ld hl, Func_70433
	call Bankswitch ; do the healing machine animation
	xor a
	ld [$cfc7], a
	ld a, [$c0f0]
	ld [$c0ef], a
	ld a, [$d35b]
	ld [$cfca], a
	ld [$c0ee], a
	call PlaySound
	ld hl, PokemonFightingFitText
	call PrintText
	ld a, $14
	ld [$c112], a ; make the nurse bow
	ld c, a
	call DelayFrames
	jr .done
.declinedHealing
	call LoadScreenTilesFromBuffer1 ; restore screen
.done
	ld hl, PokemonCenterFarewellText
	call PrintText
	jp UpdateSprites ; move sprites

PokemonCenterWelcomeText: ; 705d (1:705d)
	TX_FAR _PokemonCenterWelcomeText
	db $50

ShallWeHealYourPokemonText: ; 7062 (1:7062)
	db $a
	TX_FAR _ShallWeHealYourPokemonText
	db $50

NeedYourPokemonText: ; 7068 (1:7068)
	TX_FAR _NeedYourPokemonText
	db $50

PokemonFightingFitText: ; 706d (1:706d)
	TX_FAR _PokemonFightingFitText
	db $50

PokemonCenterFarewellText: ; 7072 (1:7072)
	db $a
	TX_FAR _PokemonCenterFarewellText
	db $50

Unknown_7078: ; 7078 (1:7078)
	push hl
	ld hl, SafariZoneRestHouses
	ld a, [W_CURMAP]
	ld b, a
.asm_7080
	ld a, [hli]
	cp $ff
	jr z, .asm_708a ; 0x7083 $5
	cp b
	jr nz, .asm_7080 ; 0x7086 $f8
	jr .asm_7090 ; 0x7088 $6
.asm_708a
	ld a, [$d365]
	ld [$d719], a
.asm_7090
	pop hl
	ret
; 0x7092

SafariZoneRestHouses: ; 7092 (1:7092)
	db SAFARI_ZONE_REST_HOUSE_2
	db SAFARI_ZONE_REST_HOUSE_3
	db SAFARI_ZONE_REST_HOUSE_4
	db $ff ; terminator

; function that performs initialization for DisplayTextID
DisplayTextIDInit: ; 7096 (1:7096)
	xor a
	ld [$cf94],a
	ld a,[$cf0c]
	bit 0,a
	jr nz,.skipDrawingTextBoxBorder
	ld a,[$ff8c] ; text ID (or sprite ID)
	and a
	jr nz,.notStartMenu
; if text ID is 0 (i.e. the start menu)
; Note that the start menu text border is also drawn in the function directly
; below this, so this seems unnecessary.
	ld a,[$d74b]
	bit 5,a ; does the player have the pokedex?
; start menu with pokedex
	FuncCoord 10, 0 ; $c3aa
	ld hl,Coord
	ld b,$0e
	ld c,$08
	jr nz,.drawTextBoxBorder
; start menu without pokedex
	FuncCoord 10, 0 ; $c3aa
	ld hl,Coord
	ld b,$0c
	ld c,$08
	jr .drawTextBoxBorder
; if text ID is not 0 (i.e. not the start menu) then do a standard dialogue text box
.notStartMenu
	FuncCoord 0, 12 ; $c490
	ld hl,Coord
	ld b,$04
	ld c,$12
.drawTextBoxBorder
	call TextBoxBorder
.skipDrawingTextBoxBorder
	ld hl,$cfc4
	set 0,[hl]
	ld hl,W_FLAGS_CD60
	bit 4,[hl]
	res 4,[hl]
	jr nz,.skipMovingSprites
	call UpdateSprites ; move sprites
.skipMovingSprites
; loop to copy C1X9 (direction the sprite is facing) to C2X9 for each sprite
; this is done because when you talk to an NPC, they turn to look your way
; the original direction they were facing must be restored after the dialogue is over
	ld hl,$c119
	ld c,$0f
	ld de,$0010
.spriteFacingDirectionCopyLoop
	ld a,[hl]
	inc h
	ld [hl],a
	dec h
	add hl,de
	dec c
	jr nz,.spriteFacingDirectionCopyLoop
; loop to force all the sprites in the middle of animation to stand still
; (so that they don't like they're frozen mid-step during the dialogue)
	ld hl,$c102
	ld de,$0010
	ld c,e
.spriteStandStillLoop
	ld a,[hl]
	cp a,$ff ; is the sprite visible?
	jr z,.nextSprite
; if it is visible
	and a,$fc
	ld [hl],a
.nextSprite
	add hl,de
	dec c
	jr nz,.spriteStandStillLoop
	ld b,$9c ; window background address
	call CopyScreenTileBufferToVRAM ; transfer background in WRAM to VRAM
	xor a
	ld [$ffb0],a ; put the window on the screen
	call LoadFontTilePatterns
	ld a,$01
	ld [H_AUTOBGTRANSFERENABLED],a ; enable continuous WRAM to VRAM transfer each V-blank
	ret

; function that displays the start menu
DrawStartMenu: ; 710b (1:710b)
	ld a,[$d74b]
	bit 5,a ; does the player have the pokedex?
; menu with pokedex
	FuncCoord 10, 0 ; $c3aa
	ld hl,Coord
	ld b,$0e
	ld c,$08
	jr nz,.drawTextBoxBorder
; shorter menu if the player doesn't have the pokedex
	FuncCoord 10, 0 ; $c3aa
	ld hl,Coord
	ld b,$0c
	ld c,$08
.drawTextBoxBorder
	call TextBoxBorder
	ld a,%11001011 ; bit mask for down, up, start, B, and A buttons
	ld [$cc29],a
	ld a,$02
	ld [$cc24],a ; Y position of first menu choice
	ld a,$0b
	ld [$cc25],a ; X position of first menu choice
	ld a,[$cc2d] ; remembered menu selection from last time
	ld [$cc26],a
	ld [$cc2a],a
	xor a
	ld [$cc37],a
	ld hl,$d730
	set 6,[hl] ; no pauses between printing each letter
	FuncCoord 12, 2 ; $c3d4
	ld hl,Coord
	ld a,[$d74b]
	bit 5,a ; does the player have the pokedex?
; case for not having pokdex
	ld a,$06
	jr z,.storeMenuItemCount
; case for having pokedex
	ld de,StartMenuPokedexText
	call PrintStartMenuItem
	ld a,$07
.storeMenuItemCount
	ld [$cc28],a ; number of menu items
	ld de,StartMenuPokemonText
	call PrintStartMenuItem
	ld de,StartMenuItemText
	call PrintStartMenuItem
	ld de,$d158 ; player's name
	call PrintStartMenuItem
	ld a,[$d72e]
	bit 6,a ; is the player using the link feature?
; case for not using link feature
	ld de,StartMenuSaveText
	jr z,.printSaveOrResetText
; case for using link feature
	ld de,StartMenuResetText
.printSaveOrResetText
	call PrintStartMenuItem
	ld de,StartMenuOptionText
	call PrintStartMenuItem
	ld de,StartMenuExitText
	call PlaceString
	ld hl,$d730
	res 6,[hl] ; turn pauses between printing letters back on
	ret

StartMenuPokedexText: ; 718f (1:718f)
db "POKéDEX@"

StartMenuPokemonText: ; 7197 (1:7197)
db "POKéMON@"

StartMenuItemText: ; 719f (1:719f)
db "ITEM@"

StartMenuSaveText: ; 71a4 (1:71a4)
db "SAVE@"

StartMenuResetText: ; 71a9 (1:71a9)
db "RESET@"

StartMenuExitText: ; 71af (1:71af)
db "EXIT@"

StartMenuOptionText: ; 71b4 (1:71b4)
db "OPTION@"

PrintStartMenuItem: ; 71bb (1:71bb)
	push hl
	call PlaceString
	pop hl
	ld de,$28
	add hl,de
	ret

Unknown_71c5: ; 71c5 (1:71c5)
	ld hl, UnnamedText_72b8 ; $72b8
	call PrintText
	ld a, [$d74b]
	bit 5, a
	jp nz, Unknown_71e1
	ld c, $3c
	call DelayFrames
	ld hl, UnnamedText_72d2 ; $72d2
	call PrintText
	jp Func_7298
; 0x71e1

Unknown_71e1: ; 71e1 (1:71e1)
	ld a, $1
	ld [$cc34], a
	ld a, $5a
	ld [$cc47], a
.asm_71eb
	ld a, [$ff00+$aa]
	cp $2
	jr z, .asm_721a ; 0x71ef $29
	cp $1
	jr z, .asm_721a ; 0x71f3 $25
	ld a, $ff
	ld [$ff00+$aa], a
	ld a, $2
	ld [$ff00+$1], a
	xor a
	ld [$ff00+$ad], a
	ld a, $80
	ld [$ff00+$2], a
	ld a, [$cc47]
	dec a
	ld [$cc47], a
	jr z, .asm_7287 ; 0x720b $7a
	ld a, $1
	ld [$ff00+$1], a
	ld a, $81
	ld [$ff00+$2], a
	call DelayFrame
	jr .asm_71eb ; 0x7218 $d1
.asm_721a
	call Func_22ed
	call DelayFrame
	call Func_22ed
	ld c, $32
	call DelayFrames
	ld hl, UnnamedText_72bd ; $72bd
	call PrintText
	xor a
	ld [$cc34], a
	call YesNoChoice
	ld a, $1
	ld [$cc34], a
	ld a, [$cc26]
	and a
	jr nz, .asm_728f ; 0x723e $4f
	ld hl, SaveSAVtoSRAM
	ld b, BANK(SaveSAVtoSRAM)
	call Bankswitch
	call WaitForSoundToFinish
	ld a, $b6
	call PlaySoundWaitForCurrent
	ld hl, UnnamedText_72c2 ; $72c2
	call PrintText
	ld hl, $cc47
	ld a, $3
	ld [hli], a
	xor a
	ld [hl], a
	ld [$ff00+$a9], a
	ld [$cc42], a
	call Func_227f
	ld hl, $cc47
	ld a, [hli]
	inc a
	jr nz, Func_72a8 ; 0x726b $3b
	ld a, [hl]
	inc a
	jr nz, Func_72a8 ; 0x726f $37
	ld b, $a
.asm_7273
	call DelayFrame
	call Func_22ed
	dec b
	jr nz, .asm_7273 ; 0x727a $f7
	call Func_72d7
	ld hl, UnnamedText_72c8 ; $72c8
	call PrintText
	jr Func_7298 ; 0x7285 $11
.asm_7287
	ld hl, UnnamedText_72b3 ; $72b3
	call PrintText
	jr Func_7298 ; 0x728d $9
.asm_728f
	call Func_72d7
	ld hl, UnnamedText_72cd ; $72cd
	call PrintText
	; fall through

Func_7298: ; 7298 (1:7298)
	xor a
	ld hl, $cc47
	ld [hli], a
	ld [hl], a
	ld hl, $d72e
	res 6, [hl]
	xor a
	ld [$cc34], a
	ret

Func_72a8: ; 72a8 (1:72a8)
	xor a
	ld [hld], a
	ld [hl], a
	ld hl, Func_5c0a
	ld b, BANK(Func_5c0a)
	jp Bankswitch
; 0x72b3

UnnamedText_72b3: ; 72b3 (1:72b3)
	TX_FAR _UnnamedText_72b3
	db $50
; 0x72b3 + 5 bytes

UnnamedText_72b8: ; 72b8 (1:72b8)
	TX_FAR _UnnamedText_72b8
	db $50
; 0x72b8 + 5 bytes

UnnamedText_72bd: ; 72bd (1:72bd)
	TX_FAR _UnnamedText_72bd
	db $50
; 0x72bd + 5 bytes

UnnamedText_72c2: ; 72c2 (1:72c2)
	TX_FAR UnnamedText_a29cc
	db $a, $50

UnnamedText_72c8: ; 72c8 (1:72c8)
	TX_FAR _UnnamedText_72c8
	db $50
; 0x72c8 + 5 bytes

UnnamedText_72cd: ; 72cd (1:72cd)
	TX_FAR _UnnamedText_72cd
	db $50
; 0x72cd + 5 bytes

UnnamedText_72d2: ; 72d2 (1:72d2)
	TX_FAR _UnnamedText_72d2
	db $50
; 0x72d2 + 5 bytes

; known jump sources: 5d34 (1:5d34), 727c (1:727c), 728f (1:728f)
Func_72d7: ; 72d7 (1:72d7)
	call Delay3
	ld a, $ff
	ld [$FF00+$aa], a
	ld a, $2
	ld [$FF00+$1], a
	xor a
	ld [$FF00+$ad], a
	ld a, $80
	ld [$FF00+$2], a
	ret
; 72ea (1:72ea)

; function to draw various text boxes
; INPUT:
; [$D125] = text box ID
DisplayTextBoxID_: ; 72ea (1:72ea)
	ld a,[$d125] ; a = text box ID
	cp a,$14
	jp z,DisplayYesNoTextBox
	ld c,a
	ld hl,TextBoxFunctionTable
	ld de,3
	call SearchTextBoxTable
	jr c,.functionTableMatch
	ld hl,TextBoxCoordTable
	ld de,5
	call SearchTextBoxTable
	jr c,.coordTableMatch
	ld hl,TextBoxTextAndCoordTable
	ld de,9
	call SearchTextBoxTable
	jr c,.textAndCoordTableMatch
.done
	ret
.functionTableMatch
	ld a,[hli]
	ld h,[hl]
	ld l,a ; hl = address of function
	ld de,.done
	push de
	jp [hl] ; jump to the function
.coordTableMatch
	call GetTextBoxIDCoords
	call GetAddressOfScreenCoords
	call TextBoxBorder
	ret
.textAndCoordTableMatch
	call GetTextBoxIDCoords
	push hl
	call GetAddressOfScreenCoords
	call TextBoxBorder
	pop hl
	call GetTextBoxIDText
	ld a,[$d730]
	push af
	ld a,[$d730]
	set 6,a ; no pauses between printing each letter
	ld [$d730],a
	call PlaceString
	pop af
	ld [$d730],a
	call UpdateSprites ; move sprites
	ret

; function to search a table terminated with $ff for a byte matching c in increments of de
; sets carry flag if a match is found and clears carry flag if not
SearchTextBoxTable: ; 734c (1:734c)
	dec de
.loop
	ld a,[hli]
	cp a,$ff
	jr z,.notFound
	cp c
	jr z,.found
	add hl,de
	jr .loop
.found
	scf
.notFound
	ret

; function to load coordinates from the TextBoxCoordTable or the TextBoxTextAndCoordTable
; INPUT:
; hl = address of coordinates
; OUTPUT:
; b = height
; c = width
; d = row of upper left corner
; e = column of upper left corner
GetTextBoxIDCoords: ; 735a (1:735a)
	ld a,[hli] ; column of upper left corner
	ld e,a
	ld a,[hli] ; row of upper left corner
	ld d,a
	ld a,[hli] ; column of lower right corner
	sub e
	dec a
	ld c,a     ; c = width
	ld a,[hli] ; row of lower right corner
	sub d
	dec a
	ld b,a     ; b = height
	ret

; function to load a text address and text coordinates from the TextBoxTextAndCoordTable
GetTextBoxIDText: ; 7367 (1:7367)
	ld a,[hli]
	ld e,a
	ld a,[hli]
	ld d,a ; de = address of text
	push de ; save text address
	ld a,[hli]
	ld e,a ; column of upper left corner of text
	ld a,[hl]
	ld d,a ; row of upper left corner of text
	call GetAddressOfScreenCoords
	pop de ; restore text address
	ret

; function to point hl to the screen coordinates
; INPUT:
; d = row
; e = column
; OUTPUT:
; hl = address of upper left corner of text box
GetAddressOfScreenCoords: ; 7375 (1:7375)
	push bc
	ld hl,W_SCREENTILESBUFFER
	ld bc,20
.loop ; loop to add d rows to the base address
	ld a,d
	and a
	jr z,.addedRows
	add hl,bc
	dec d
	jr .loop
.addedRows
	pop bc
	add hl,de
	ret

; Format:
; 00: text box ID
; 01-02: function address
TextBoxFunctionTable: ; 7387 (1:7387)
	db $13
	dw $74ba

	db $15
	dw $74ea

	db $04
	dw $76e1

	db $ff ; terminator

; Format:
; 00: text box ID
; 01: column of upper left corner
; 02: row of upper left corner
; 03: column of lower right corner
; 04: row of lower right corner
TextBoxCoordTable: ; 7391 (1:7391)
	db $01,  0, 12, 19, 17
	db $03,  0,  0, 19, 14
	db $07,  0,  0, 11,  6
	db $0d,  4,  2, 19, 12
	db $10,  7,  0, 19, 17
	db $11,  6,  4, 14, 13
	db $ff ; terminator

; Format:
; 00: text box ID
; 01: column of upper left corner
; 02: row of upper left corner
; 03: column of lower right corner
; 04: row of lower right corner
; 05-06: address of text
; 07: column of beginning of text
; 08: row of beginning of text
; table of window positions and corresponding text [key, start column, start row, end column, end row, text pointer [2 bytes], text column, text row]
TextBoxTextAndCoordTable: ; 73b0 (1:73b0)
	db $05 ; text box ID
	db 0,0,14,17   ; text box coordinates
	dw JapaneseMochimonoText
	db 3,0   ; text coordinates

	db $06 ; text box ID
	db 13,10,19,14 ; text box coordinates
	dw UseTossText
	db 15,11 ; text coordinates

	db $08 ; text box ID
	db 0,0,7,5     ; text box coordinates
	dw JapaneseSaveMessageText
	db 2,2   ; text coordinates

	db $09 ; text box ID
	db 0,6,5,10    ; text box coordinates
	dw JapaneseSpeedOptionsText
	db 2,7   ; text coordinates

	db $0b ; text box ID
	db 8,12,19,17  ; text box coordinates
	dw BattleMenuText
	db 10,14 ; text coordinates

	db $1b ; text box ID
	db 0,12,19,17  ; text box coordinates
	dw SafariZoneBattleMenuText
	db 2,14  ; text coordinates

	db $0c ; text box ID
	db 11,11,19,17 ; text box coordinates
	dw SwitchStatsCancelText
	db 13,12 ; text coordinates

	db $0e ; text box ID
	db 0,0,10,6    ; text box coordinates
	dw BuySellQuitText
	db 2,1   ; text coordinates

	db $0f ; text box ID
	db 11,0,19,2   ; text box coordinates
	dw MoneyText
	db 13,0  ; text coordinates

	db $12 ; text box ID
	db 7,6,11,10   ; text box coordinates
	dw JapaneseAhText
	db 8,8   ; text coordinates

	db $1a ; text box ID
	db 11,8,19,17  ; text box coordinates
	dw JapanesePokedexMenu
	db 12,10 ; text coordinates

; note that there is no terminator

BuySellQuitText: ; 7413 (1:7413)
	db "BUY",$4E
	db "SELL",$4E
	db "QUIT@@"

UseTossText: ; 7422 (1:7422)
	db "USE",$4E
	db "TOSS@"

JapaneseSaveMessageText: ; 742b (1:742b)
	db "きろく",$4E
	db "メッセージ@"

JapaneseSpeedOptionsText: ; 7435 (1:7435)
	db "はやい",$4E
	db "おそい@"

MoneyText: ; 743d (1:743d)
	db "MONEY@"

JapaneseMochimonoText: ; 7443 (1:7443)
	db "もちもの@"

JapaneseMainMenuText: ; 7448 (1:7448)
	db "つづきから",$4E
	db "さいしょから@"

BattleMenuText: ; 7455 (1:7455)
	db "FIGHT ",$E1,$E2,$4E
	db "ITEM  RUN@"

SafariZoneBattleMenuText: ; 7468 (1:7468)
	db "BALL",$F1,"       BAIT",$4E
	db "THROW ROCK  RUN@"

SwitchStatsCancelText: ; 7489 (1:7489)
	db "SWITCH",$4E
	db "STATS",$4E
	db "CANCEL@"

JapaneseAhText: ; 749d (1:749d)
	db "アッ!@"

JapanesePokedexMenu: ; 74a1 (1:74a1)
	db "データをみる",$4E
	db "なきごえ",$4E
	db "ぶんぷをみる",$4E
	db "キャンセル@"

	ld hl, $d730
	set 6, [hl]
	ld a, $f
	ld [$d125], a
	call DisplayTextBoxID
	FuncCoord 13, 1 ; $c3c1
	ld hl, Coord
	ld b, $1
	ld c, $6
	call ClearScreenArea
	FuncCoord 12, 1 ; $c3c0
	ld hl, Coord
	ld de, W_PLAYERMONEY3 ; $d347
	ld c, $a3
	call PrintBCDNumber
	ld hl, $d730
	res 6, [hl]
	ret

CurrencyString_74e2: ; 0x74e2, 1:34e2
	db "      ¥@"

Function_74ea: ; 0x74ea, 1:34ea
	ld a, [$d730]
	set 6, a
	ld [$d730], a
	xor a
	ld [$d12d], a
	ld a, $e
	ld [$d125], a
	call DisplayTextBoxID
	ld a, $3
	ld [W_MENUWATCHEDKEYS], a ; $cc29
	ld a, $2
	ld [W_MAXMENUITEMID], a ; $cc28
	ld a, $1
	ld [W_TOPMENUITEMY], a ; $cc24
	ld a, $1
	ld [W_TOPMENUITEMX], a ; $cc25
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_OLDMENUITEMID], a ; $cc2a
	ld [$cc37], a
	ld a, [$d730]
	res 6, a
	ld [$d730], a
	call HandleMenuInput
	call PlaceUnfilledArrowMenuCursor
	bit 0, a
	jr nz, .asm_7539
	bit 1, a
	jr z, .asm_7539
	ld a, $2
	ld [$d12e], a
	jr .asm_754c
.asm_7539
	ld a, $1
	ld [$d12e], a
	ld a, [W_CURMENUITEMID] ; $cc26
	ld [$d12d], a
	ld b, a
	ld a, [W_MAXMENUITEMID] ; $cc28
	cp b
	jr z, .asm_754c
	ret
.asm_754c
	ld a, $2
	ld [$d12e], a
	ld a, [W_CURMENUITEMID] ; $cc26
	ld [$d12d], a
	scf
	ret

; known jump sources: 72ef (1:72ef)
DisplayYesNoTextBox: ; 7559 (1:7559)
	push hl
	ld a, [$d730]
	set 6, a
	ld [$d730], a
	xor a
	ld [$d12d], a
	ld [$d12e], a
	ld a, $3
	ld [W_MENUWATCHEDKEYS], a ; $cc29
	ld a, $1
	ld [W_MAXMENUITEMID], a ; $cc28
	ld a, b
	ld [W_TOPMENUITEMY], a ; $cc24
	ld a, c
	ld [W_TOPMENUITEMX], a ; $cc25
	xor a
	ld [W_OLDMENUITEMID], a ; $cc2a
	ld [$cc37], a
	push hl
	ld hl, $d12c
	bit 7, [hl]
	res 7, [hl]
	jr z, .asm_758d
	inc a
.asm_758d
	ld [W_CURMENUITEMID], a ; $cc26
	pop hl
	push hl
	push hl
	call Func_763e
	ld a, [$d12c]
	ld hl, MenuStrings ; $7671
	ld e, a
	ld d, $0
	ld a, $5
.loop
	add hl, de
	dec a
	jr nz, .loop
	ld a, [hli]
	ld c, a
	ld a, [hli]
	ld b, a
	ld e, l
	ld d, h
	pop hl
	push de
	ld a, [$d12c]
	cp $5
	jr nz, .asm_75b9
	call Func_5ab3
	jr .asm_75bc
.asm_75b9
	call TextBoxBorder
.asm_75bc
	call UpdateSprites
	pop hl
	ld a, [hli]
	and a
	ld bc, $16
	jr z, .asm_75ca
	ld bc, $2a
.asm_75ca
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	pop hl
	add hl, bc
	call PlaceString
	ld hl, $d730
	res 6, [hl]
	ld a, [$d12c]
	cp $7
	jr nz, .asm_7603
	xor a
	ld [$d12c], a
	ld a, [W_FLAGS_CD60]
	push af
	push hl
	ld hl, W_FLAGS_CD60
	bit 5, [hl]
	set 5, [hl]
	pop hl
.asm_75f0
	call HandleMenuInput
	bit 1, a
	jr nz, .asm_75f0
	pop af
	pop hl
	ld [W_FLAGS_CD60], a
	ld a, $90
	call PlaySound
	jr .asm_760f
.asm_7603
	xor a
	ld [$d12c], a
	call HandleMenuInput
	pop hl
	bit 1, a
	jr nz, .asm_7627
.asm_760f
	ld a, [W_CURMENUITEMID] ; $cc26
	ld [$d12d], a
	and a
	jr nz, .asm_7627
	ld a, $1
	ld [$d12e], a
	ld c, $f
	call DelayFrames
	call Func_7656
	and a
	ret
.asm_7627
	ld a, $1
	ld [W_CURMENUITEMID], a ; $cc26
	ld [$d12d], a
	ld a, $2
	ld [$d12e], a
	ld c, $f
	call DelayFrames
	call Func_7656
	scf
	ret

; known jump sources: 7593 (1:7593)
Func_763e: ; 763e (1:763e)
	ld de, $cee9
	ld bc, $506
.asm_7644
	ld a, [hli]
	ld [de], a
	inc de
	dec c
	jr nz, .asm_7644
	push bc
	ld bc, $e
	add hl, bc
	pop bc
	ld c, $6
	dec b
	jr nz, .asm_7644
	ret

; known jump sources: 7622 (1:7622), 7639 (1:7639)
Func_7656: ; 7656 (1:7656)
	ld de, $cee9
	ld bc, $506
.asm_765c
	ld a, [de]
	inc de
	ld [hli], a
	dec c
	jr nz, .asm_765c
	push bc
	ld bc, $e
	add hl, bc
	pop bc
	ld c, $6
	dec b
	jr nz, .asm_765c
	call UpdateSprites
	ret

MenuStrings: ; 7671 (1:7671)
	db 4,3,0
	dw .YesNoMenu
	db 6,3,0
	dw .NorthWestMenu
	db 6,3,0
	dw .SouthEastMenu
	db 6,3,0
	dw .YesNoMenu
	db 6,3,0
	dw .NorthEastMenu
	db 7,3,0
	dw .TradeCancelMenu
	db 7,4,1
	dw .HealCancelMenu
	db 4,3,0
	dw .NoYesMenu

.NoYesMenu ; 0x7699, 1:3699
	db "NO",$4E,"YES@"
.YesNoMenu ; 0x76a0, 1:36a0
	db "YES",$4E,"NO@"
.NorthWestMenu ; 0x76a7, 1:36a7
	db "NORTH",$4E,"WEST@"
.SouthEastMenu ; 0x76b2, 1:36b2
	db "SOUTH",$4E,"EAST@"
.NorthEastMenu ; 0x76bd, 1:36bd
	db "NORTH",$4E,"EAST@"
.TradeCancelMenu ; 0x76c8, 1:36c8
	db "TRADE",$4E,"CANCEL@"
.HealCancelMenu ; 0x76d5, 1:36d5
	db "HEAL",$4E,"CANCEL@"

Function_76e1: ; 0x76e1, 1:36e1
	xor a
	ld hl, W_WHICHTRADE ; $cd3d
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], $c
	call Func_77d6
	ld a, [$cd41]
	and a
	jr nz, .asm_770f
	FuncCoord 11, 11 ; $c487
	ld hl, Coord
	ld b, $5
	ld c, $7
	call TextBoxBorder
	call UpdateSprites
	ld a, $c
	ld [$FF00+$f7], a
	FuncCoord 13, 12 ; $c49d
	ld hl, Coord
	ld de, PokemonMenuEntries ; $77c2
	jp PlaceString
.asm_770f
	push af
	FuncCoord 0, 11 ; $c47c
	ld hl, Coord
	ld a, [$cd42]
	dec a
	ld e, a
	ld d, $0
	add hl, de
	ld b, $5
	ld a, $12
	sub e
	ld c, a
	pop af
	ld de, $ffd8
.asm_7725
	add hl, de
	inc b
	inc b
	dec a
	jr nz, .asm_7725
	ld de, $ffec
	add hl, de
	inc b
	call TextBoxBorder
	call UpdateSprites
	FuncCoord 0, 12 ; $c490
	ld hl, Coord
	ld a, [$cd42]
	inc a
	ld e, a
	ld d, $0
	add hl, de
	ld de, $ffd8
	ld a, [$cd41]
.asm_7747
	add hl, de
	dec a
	jr nz, .asm_7747
	xor a
	ld [$cd41], a
	ld de, W_WHICHTRADE ; $cd3d
.asm_7752
	push hl
	ld hl, FieldMoveNames ; $778d
	ld a, [de]
	and a
	jr z, .asm_7776
	inc de
	ld b, a
.asm_775c
	dec b
	jr z, .asm_7766
.asm_775f
	ld a, [hli]
	cp $50
	jr nz, .asm_775f
	jr .asm_775c
.asm_7766
	ld b, h
	ld c, l
	pop hl
	push de
	ld d, b
	ld e, c
	call PlaceString
	ld bc, $28
	add hl, bc
	pop de
	jr .asm_7752
.asm_7776
	pop hl
	ld a, [$cd42]
	ld [$FF00+$f7], a
	FuncCoord 0, 12 ; $c490
	ld hl, Coord
	ld a, [$cd42]
	inc a
	ld e, a
	ld d, $0
	add hl, de
	ld de, PokemonMenuEntries ; $77c2
	jp PlaceString
; 778d (1:778d)
FieldMoveNames: ; 778d (1:778d)
	db "CUT@"
	db "FLY@"
	db "@"
	db "SURF@"
	db "STRENGTH@"
	db "FLASH@"
	db "DIG@"
	db "TELEPORT@"
	db "SOFTBOILED@"

PokemonMenuEntries: ; 77c2 (1:77c2)
	db "STATS",$4E
	db "SWITCH",$4E
	db "CANCEL@"

; known jump sources: 76ec (1:76ec)
Func_77d6: ; 77d6 (1:77d6)
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, W_PARTYMON1_MOVE1 ; $d173
	ld bc, $2c
	call AddNTimes
	ld d, h
	ld e, l
	ld c, $5
	ld hl, W_WHICHTRADE ; $cd3d
.asm_77e9
	push hl
.asm_77ea
	dec c
	jr z, .asm_7821
	ld a, [de]
	and a
	jr z, .asm_7821
	ld b, a
	inc de
	ld hl, Unknown_7823 ; $7823
.asm_77f6
	ld a, [hli]
	cp $ff
	jr z, .asm_77ea
	cp b
	jr z, .asm_7802
	inc hl
	inc hl
	jr .asm_77f6
.asm_7802
	ld a, b
	ld [$cd43], a
	ld a, [hli]
	ld b, [hl]
	pop hl
	ld [hli], a
	ld a, [$cd41]
	inc a
	ld [$cd41], a
	ld a, [$cd42]
	cp b
	jr c, .asm_781b
	ld a, b
	ld [$cd42], a
.asm_781b
	ld a, [$cd43]
	ld b, a
	jr .asm_77e9
.asm_7821
	pop hl
	ret

Unknown_7823: ; 7823 (1:7823)
INCBIN "baserom.gbc",$7823,$783f - $7823

; known jump sources: 3f2ee (f:72ee)
Func_783f: ; 783f (1:783f)
	ld hl, W_DAMAGE ; $d0d7
	ld a, [hl]
	srl a
	ld [hli], a
	ld a, [hl]
	rr a
	ld [hld], a
	or [hl]
	jr nz, .asm_784f
	inc hl
	inc [hl]
.asm_784f
	ld hl, W_PLAYERMONCURHP ; $d015
	ld de, W_PLAYERMONMAXHP ; $d023
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jp z, Func_7861
	ld hl, W_ENEMYMONCURHP ; $cfe6
	ld de, W_ENEMYMONMAXHP ; $cff4

; known jump sources: 7858 (1:7858)
Func_7861: ; 7861 (1:7861)
	ld bc, W_HPBAROLDHP+1
	ld a, [hli]
	ld [bc], a
	ld a, [hl]
	dec bc
	ld [bc], a
	ld a, [de]
	dec bc
	ld [bc], a
	inc de
	ld a, [de]
	dec bc
	ld [bc], a
	ld a, [$d0d8]
	ld b, [hl]
	add b
	ld [hld], a
	ld [W_HPBARNEWHP], a
	ld a, [W_DAMAGE] ; $d0d7
	ld b, [hl]
	adc b
	ld [hli], a
	ld [W_HPBARNEWHP+1], a
	jr c, .asm_7890
	ld a, [hld]
	ld b, a
	ld a, [de]
	dec de
	sub b
	ld a, [hli]
	ld b, a
	ld a, [de]
	inc de
	sbc b
	jr nc, .asm_789c
.asm_7890
	ld a, [de]
	ld [hld], a
	ld [W_HPBARNEWHP], a
	dec de
	ld a, [de]
	ld [hli], a
	ld [W_HPBARNEWHP+1], a
	inc de
.asm_789c
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	FuncCoord 10, 9 ; $c45e
	ld hl, Coord
	ld a, $1
	jr z, .asm_78aa
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	xor a
.asm_78aa
	ld [W_LISTMENUID], a ; $cf94
	ld a, $48
	call Predef ; indirect jump to UpdateHPBar (fa1d (3:7a1d))
	ld a, $0
	call Predef ; indirect jump to Func_3cd60 (3cd60 (f:4d60))
	ld a, $49
	call Predef ; indirect jump to Func_3cdec (3cdec (f:4dec))
	ld hl, ReadPlayerMonCurHPAndStatus
	ld b, BANK(ReadPlayerMonCurHPAndStatus)
	call Bankswitch ; indirect jump to ReadPlayerMonCurHPAndStatus (3cd43 (f:4d43))
	ld hl, UnnamedText_78dc ; $78dc
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, [W_PLAYERMOVEEFFECT] ; $cfd3
	jr z, .asm_78d2
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
.asm_78d2
	cp $8
	jr nz, .asm_78d9
	ld hl, UnnamedText_78e1 ; $78e1
.asm_78d9
	jp PrintText
; 78dc (1:78dc)
UnnamedText_78dc: ; 78dc (1:78dc)
	TX_FAR _UnnamedText_78dc
	db $50
; 0x78dc + 5 bytes

UnnamedText_78e1: ; 78e1 (1:78e1)
	TX_FAR _UnnamedText_78e1
	db $50
; 0x78e1 + 5 bytes

; known jump sources: 3479 (0:3479), 17ebb (5:7ebb)
Func_78e6: ; 78e6 (1:78e6)
	ld hl, $d730
	set 6, [hl]
	ld a, ITEM_NAME
	ld [W_LISTTYPE], a
	call SaveScreenTilesToBuffer1
	xor a
	ld [$cc2c], a
	ld [$ccd3], a
	ld a, [W_FLAGS_CD60]
	bit 3, a
	jr nz, Func_790c
	ld a, $99
	call PlaySound
	ld hl, UnnamedText_7b22 ; $7b22
	call PrintText

; known jump sources: 78ff (1:78ff), 79a8 (1:79a8), 79c8 (1:79c8), 7a25 (1:7a25), 7a45 (1:7a45), 7aa2 (1:7aa2), 7ac4 (1:7ac4)
Func_790c: ; 790c (1:790c)
	ld a, [$ccd3]
	ld [W_CURMENUITEMID], a ; $cc26
	ld hl, W_FLAGS_CD60
	set 5, [hl]
	call LoadScreenTilesFromBuffer2
	ld hl, W_SCREENTILESBUFFER
	ld b, $8
	ld c, $e
	call TextBoxBorder
	call UpdateSprites
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	ld de, PlayersPCMenuEntries ; $7af5
	call PlaceString
	ld hl, W_TOPMENUITEMY ; $cc24
	ld a, $2
	ld [hli], a
	dec a
	ld [hli], a
	inc hl
	inc hl
	ld a, $3
	ld [hli], a
	ld a, $3
	ld [hli], a
	xor a
	ld [hl], a
	ld hl, W_LISTSCROLLOFFSET ; $cc36
	ld [hli], a
	ld [hl], a
	ld [W_PLAYERMONNUMBER], a ; $cc2f
	ld hl, UnnamedText_7b27 ; $7b27
	call PrintText
	call HandleMenuInput
	bit 1, a
	jp nz, Func_796d
	call PlaceUnfilledArrowMenuCursor
	ld a, [W_CURMENUITEMID] ; $cc26
	ld [$ccd3], a
	and a
	jp z, Func_7a12
	dec a
	jp z, Func_7995
	dec a
	jp z, Func_7a8f

; known jump sources: 7955 (1:7955)
Func_796d: ; 796d (1:796d)
	ld a, [W_FLAGS_CD60]
	bit 3, a
	jr nz, .asm_797c
	ld a, $9a
	call PlaySound
	call WaitForSoundToFinish
.asm_797c
	ld hl, W_FLAGS_CD60
	res 5, [hl]
	call LoadScreenTilesFromBuffer2
	xor a
	ld [W_LISTSCROLLOFFSET], a ; $cc36
	ld [$cc2c], a
	ld hl, $d730
	res 6, [hl]
	xor a
	ld [$cc3c], a
	ret

; known jump sources: 7966 (1:7966)
Func_7995: ; 7995 (1:7995)
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_LISTSCROLLOFFSET], a ; $cc36
	ld a, [W_NUMBAGITEMS] ; $d31d
	and a
	jr nz, Func_79ab
	ld hl, UnnamedText_7b3b ; $7b3b
	call PrintText
	jp Func_790c

; known jump sources: 79a0 (1:79a0), 79e4 (1:79e4), 79f5 (1:79f5), 7a0f (1:7a0f)
Func_79ab: ; 79ab (1:79ab)
	ld hl, UnnamedText_7b2c ; $7b2c
	call PrintText
	ld hl, W_NUMBAGITEMS ; $d31d
	ld a, l
	ld [$cf8b], a
	ld a, h
	ld [$cf8c], a
	xor a
	ld [$cf93], a
	ld a, $3
	ld [W_LISTMENUID], a ; $cf94
	call DisplayListMenuID
	jp c, Func_790c
	call IsKeyItem
	ld a, $1
	ld [$cf96], a
	ld a, [$d124]
	and a
	jr nz, .asm_79e7
	ld hl, UnnamedText_7b31 ; $7b31
	call PrintText
	call DisplayChooseQuantityMenu
	cp $ff
	jp z, Func_79ab
.asm_79e7
	ld hl, W_NUMBOXITEMS ; $d53a
	call AddItemToInventory
	jr c, .asm_79f8
	ld hl, UnnamedText_7b40 ; $7b40
	call PrintText
	jp Func_79ab
.asm_79f8
	ld hl, W_NUMBAGITEMS ; $d31d
	call RemoveItemFromInventory
	call WaitForSoundToFinish
	ld a, $ab
	call PlaySound
	call WaitForSoundToFinish
	ld hl, UnnamedText_7b36 ; $7b36
	call PrintText
	jp Func_79ab

; known jump sources: 7962 (1:7962)
Func_7a12: ; 7a12 (1:7a12)
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_LISTSCROLLOFFSET], a ; $cc36
	ld a, [W_NUMBOXITEMS] ; $d53a
	and a
	jr nz, Func_7a28
	ld hl, UnnamedText_7b54 ; $7b54
	call PrintText
	jp Func_790c

; known jump sources: 7a1d (1:7a1d), 7a61 (1:7a61), 7a72 (1:7a72), 7a8c (1:7a8c)
Func_7a28: ; 7a28 (1:7a28)
	ld hl, UnnamedText_7b45 ; $7b45
	call PrintText
	ld hl, W_NUMBOXITEMS ; $d53a
	ld a, l
	ld [$cf8b], a
	ld a, h
	ld [$cf8c], a
	xor a
	ld [$cf93], a
	ld a, $3
	ld [W_LISTMENUID], a ; $cf94
	call DisplayListMenuID
	jp c, Func_790c
	call IsKeyItem
	ld a, $1
	ld [$cf96], a
	ld a, [$d124]
	and a
	jr nz, .asm_7a64
	ld hl, UnnamedText_7b4a ; $7b4a
	call PrintText
	call DisplayChooseQuantityMenu
	cp $ff
	jp z, Func_7a28
.asm_7a64
	ld hl, W_NUMBAGITEMS ; $d31d
	call AddItemToInventory
	jr c, .asm_7a75
	ld hl, UnnamedText_7b59 ; $7b59
	call PrintText
	jp Func_7a28
.asm_7a75
	ld hl, W_NUMBOXITEMS ; $d53a
	call RemoveItemFromInventory
	call WaitForSoundToFinish
	ld a, $ab
	call PlaySound
	call WaitForSoundToFinish
	ld hl, UnnamedText_7b4f ; $7b4f
	call PrintText
	jp Func_7a28

; known jump sources: 796a (1:796a)
Func_7a8f: ; 7a8f (1:7a8f)
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_LISTSCROLLOFFSET], a ; $cc36
	ld a, [W_NUMBOXITEMS] ; $d53a
	and a
	jr nz, Func_7aa5
	ld hl, UnnamedText_7b54 ; $7b54
	call PrintText
	jp Func_790c

; known jump sources: 7a9a (1:7a9a), 7aec (1:7aec), 7af2 (1:7af2)
Func_7aa5: ; 7aa5 (1:7aa5)
	ld hl, UnnamedText_7b5e ; $7b5e
	call PrintText
	ld hl, W_NUMBOXITEMS ; $d53a
	ld a, l
	ld [$cf8b], a
	ld a, h
	ld [$cf8c], a
	xor a
	ld [$cf93], a
	ld a, $3
	ld [W_LISTMENUID], a ; $cf94
	push hl
	call DisplayListMenuID
	pop hl
	jp c, Func_790c
	push hl
	call IsKeyItem
	pop hl
	ld a, $1
	ld [$cf96], a
	ld a, [$d124]
	and a
	jr nz, .asm_7aef
	ld a, [$cf91]
	call IsItemHM
	jr c, .asm_7aef
	push hl
	ld hl, UnnamedText_7b63 ; $7b63
	call PrintText
	call DisplayChooseQuantityMenu
	pop hl
	cp $ff
	jp z, Func_7aa5
.asm_7aef
	call TossItem
	jp Func_7aa5
; 7af5 (1:7af5)
PlayersPCMenuEntries: ; 7af5 (1:7af5)
	db "WITHDRAW ITEM",$4E
	db "DEPOSIT ITEM",$4E
	db "TOSS ITEM",$4E
	db "LOG OFF@"

UnnamedText_7b22: ; 7b22 (1:7b22)
	TX_FAR _UnnamedText_7b22
	db $50
; 0x7b22 + 5 bytes

UnnamedText_7b27: ; 7b27 (1:7b27)
	TX_FAR _UnnamedText_7b27
	db $50
; 0x7b27 + 5 bytes

UnnamedText_7b2c: ; 7b2c (1:7b2c)
	TX_FAR _UnnamedText_7b2c
	db $50
; 0x7b2c + 5 bytes

UnnamedText_7b31: ; 7b31 (1:7b31)
	TX_FAR _UnnamedText_7b31
	db $50
; 0x7b31 + 5 bytes

UnnamedText_7b36: ; 7b36 (1:7b36)
	TX_FAR _UnnamedText_7b36
	db $50
; 0x7b36 + 5 bytes

UnnamedText_7b3b: ; 7b3b (1:7b3b)
	TX_FAR _UnnamedText_7b3b
	db $50
; 0x7b3b + 5 bytes

UnnamedText_7b40: ; 7b40 (1:7b40)
	TX_FAR _UnnamedText_7b40
	db $50
; 0x7b40 + 5 bytes

UnnamedText_7b45: ; 7b45 (1:7b45)
	TX_FAR _UnnamedText_7b45
	db $50
; 0x7b45 + 5 bytes

UnnamedText_7b4a: ; 7b4a (1:7b4a)
	TX_FAR _UnnamedText_7b4a
	db $50
; 0x7b4a + 5 bytes

UnnamedText_7b4f: ; 7b4f (1:7b4f)
	TX_FAR _UnnamedText_7b4f
	db $50
; 0x7b4f + 5 bytes

UnnamedText_7b54: ; 7b54 (1:7b54)
	TX_FAR _UnnamedText_7b54
	db $50
; 0x7b54 + 5 bytes

UnnamedText_7b59: ; 7b59 (1:7b59)
	TX_FAR _UnnamedText_7b59
	db $50
; 0x7b59 + 5 bytes

UnnamedText_7b5e: ; 7b5e (1:7b5e)
	TX_FAR _UnnamedText_7b5e
	db $50
; 0x7b5e + 5 bytes

UnnamedText_7b63: ; 7b63 (1:7b63)
	TX_FAR _UnnamedText_7b63
	db $50
; 0x7b63 + 5 bytes

; known jump sources: 3924 (0:3924)
_RemovePokemon: ; 7b68 (1:7b68)
	ld hl, W_NUMINPARTY ; $d163
	ld a, [$cf95]
	and a
	jr z, .asm_7b74
	ld hl, W_NUMINBOX ; $da80
.asm_7b74
	ld a, [hl]
	dec a
	ld [hli], a
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld c, a
	ld b, $0
	add hl, bc
	ld e, l
	ld d, h
	inc de
.asm_7b81
	ld a, [de]
	inc de
	ld [hli], a
	inc a
	jr nz, .asm_7b81
	ld hl, W_PARTYMON1OT ; $d273
	ld d, $5
	ld a, [$cf95]
	and a
	jr z, .asm_7b97
	ld hl, $dd2a
	ld d, $13
.asm_7b97
	ld a, [W_WHICHPOKEMON] ; $cf92
	call SkipFixedLengthTextEntries
	ld a, [W_WHICHPOKEMON] ; $cf92
	cp d
	jr nz, .asm_7ba6
	ld [hl], $ff
	ret
.asm_7ba6
	ld d, h
	ld e, l
	ld bc, $b
	add hl, bc
	ld bc, W_PARTYMON1NAME ; $d2b5
	ld a, [$cf95]
	and a
	jr z, .asm_7bb8
	ld bc, $de06
.asm_7bb8
	call CopyDataUntil
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	ld bc, $2c
	ld a, [$cf95]
	and a
	jr z, .asm_7bcd
	ld hl, W_BOXMON1DATA
	ld bc, $21
.asm_7bcd
	ld a, [W_WHICHPOKEMON] ; $cf92
	call AddNTimes
	ld d, h
	ld e, l
	ld a, [$cf95]
	and a
	jr z, .asm_7be4
	ld bc, $21
	add hl, bc
	ld bc, $dd2a
	jr .asm_7beb
.asm_7be4
	ld bc, $2c
	add hl, bc
	ld bc, W_PARTYMON1OT ; $d273
.asm_7beb
	call CopyDataUntil
	ld hl, W_PARTYMON1NAME ; $d2b5
	ld a, [$cf95]
	and a
	jr z, .asm_7bfa
	ld hl, $de06
.asm_7bfa
	ld bc, $b
	ld a, [W_WHICHPOKEMON] ; $cf92
	call AddNTimes
	ld d, h
	ld e, l
	ld bc, $b
	add hl, bc
	ld bc, W_OWNEDPOKEMON ; $d2f7
	ld a, [$cf95]
	and a
	jr z, .asm_7c15
	ld bc, $dee2
.asm_7c15
	jp CopyDataUntil

Func_7c18: ; 7c18 (1:7c18)
	ld hl, $d730
	set 6, [hl]
	ld a, $3d
	call Predef
	ld hl, $d730
	res 6, [hl]
	call ReloadMapData
	ld c, $a
	call DelayFrames
	ld a, $3a
	call Predef
	ld a, [$d11e]
	dec a
	ld c, a
	ld b, $1
	ld hl, $d30a
	ld a, $10
	call Predef
	ld a, $1
	ld [$cc3c], a
	ret
; 0x7c49

SECTION "bank2",ROMX,BANK[$2]

INCBIN "baserom.gbc",$8000,$822e - $8000

;Music Headers
;Pallet Town
PalletTown_mh: ; 0x822E - 0x8236
	db $80
	dw PalletTown_md_1 ;Channel 1 ($A7C5 - $A85E)
	db $01
	dw PalletTown_md_2 ;Channel 2 ($A85f - $A8DD)
	db $02
	dw PalletTown_md_3 ;Channel 3 ($A8DE - $AA75)

;Pokemon Center
Pokecenter_mh: ; 0x8237 - 0x823F
	db $80
	dw Pokecenter_md_1 ;Channel 1 ($BE56 - $BEF8)
	db $01
	dw Pokecenter_md_2 ;Channel 2 ($BEF9 - $BF6F)
	db $02
	dw Pokecenter_md_3 ;Channel 3 ($BF70 - $BFFF)

;Gyms
Gym_mh: ; 0x8240 - 0x8248
	db $80
	dw Gym_md_1 ;Channel 1 ($BCBB - $BD6A)
	db $01
	dw Gym_md_2 ;Channel 2 ($BD6B - $BDF9)
	db $02
	dw Gym_md_3 ;Channel 3 ($BDFA - $BE55)

;Viridian City, Pewter City, Saffron City
Cities1_mh: ; 0x8249 - 0x8254
	db $C0
	dw Cities1_md_1 ;Channel 1
	db $01
	dw Cities1_md_2 ;Channel 2
	db $02
	dw Cities1_md_3 ;Channel 3
	db $03
	dw Cities1_md_4 ;Channel 4

;Cerulean City, Fuchsia City
Cities2_mh: ; 0x8255 - 0x825D
	db $80
	dw Cities2_md_1 ;Channel 1
	db $01
	dw Cities2_md_2 ;Channel 2
	db $02
	dw Cities2_md_3 ;Channel 3

;Celadon City
Celadon_mh: ; 0x825E - 0x8266
	db $80
	dw Celadon_md_1 ;Channel 1
	db $01
	dw Celadon_md_2 ;Channel 2
	db $02
	dw Celadon_md_3 ;Channel 3

;Cinnabar Island
Cinnabar_mh: ; 0x8267 - 0x826F
	db $80
	dw Cinnabar_md_1 ;Channel 1
	db $01
	dw Cinnabar_md_2 ;Channel 2
	db $02
	dw Cinnabar_md_3 ;Channel 3

;Vermilion City
Vermilion_mh: ; 0x8270 - 0x827B
	db $C0
	dw Vermilion_md_1 ;Channel 1
	db $01
	dw Vermilion_md_2 ;Channel 2
	db $02
	dw Vermilion_md_3 ;Channel 3
	db $03
	dw Vermilion_md_4 ;Channel 4

;Lavender Town
Lavender_mh: ; 0x827C - 0x8287
	db $C0
	dw Lavender_md_1 ;Channel 1
	db $01
	dw Lavender_md_2 ;Channel 2
	db $02
	dw Lavender_md_3 ;Channel 3
	db $03
	dw Lavender_md_4 ;Channel 4

;SS Anne
SSAnne_mh: ; 0x8288 - 0x8290
	db $80
	dw SSAnne_md_1 ;Channel 1
	db $01
	dw SSAnne_md_2 ;Channel 2
	db $02
	dw SSAnne_md_3 ;Channel 3

;Meet Prof. Oak
MeetProfOak_mh: ; 0x8291 - 0x8299
	db $80
	dw MeetProfOak_md_1 ;Channel 1
	db $01
	dw MeetProfOak_md_2 ;Channel 2
	db $02
	dw MeetProfOak_md_3 ;Channel 3

;Meet Rival
MeetRival_mh: ; 0x829A - 0x82A2
	db $80
	dw MeetRival_md_1 ;Channel 1
	db $01
	dw MeetRival_md_2 ;Channel 2
	db $02
	dw MeetRival_md_3 ;Channel 3

;Guy walks you to museum
MuseumGuy_mh: ; 0x82A3 - 0x82AE
	db $C0
	dw MuseumGuy_md_1 ;Channel 1
	db $01
	dw MuseumGuy_md_2 ;Channel 2
	db $02
	dw MuseumGuy_md_3 ;Channel 3
	db $03
	dw MuseumGuy_md_4 ;Channel 4

;Safari Zone
SafariZone_mh: ; 0x82AF - 0x82B7
	db $80
	dw SafariZone_md_1 ;Channel 1
	db $01
	dw SafariZone_md_2 ;Channel 2
	db $02
	dw SafariZone_md_3 ;Channel 3

;Pokemon Get Healed
PkmnHealed_mh: ; 0x82B8 - 0x82C0
	db $80
	dw PkmnHealed_md_1 ;Channel 1
	db $01
	dw PkmnHealed_md_2 ;Channel 2
	db $02
	dw PkmnHealed_md_3 ;Channel 3

;Routes 1 and 2
Routes1_mh: ; 0x82C1 - 0x82CC
	db $C0
	dw Routes1_md_1 ;Channel 1
	db $01
	dw Routes1_md_2 ;Channel 2
	db $02
	dw Routes1_md_3 ;Channel 3
	db $03
	dw Routes1_md_4 ;Channel 4

;Routes 24 and 25
Routes2_mh: ; 0x82CD - 0x82D8
	db $C0
	dw Routes2_md_1 ;Channel 1
	db $01
	dw Routes2_md_2 ;Channel 2
	db $02
	dw Routes2_md_3 ;Channel 3
	db $03
	dw Routes2_md_4 ;Channel 4

;Routes 3, 4, 5, 6, 7, 8, 9, 10, 16, 17, 18, 19, 20, 21, 22
Routes3_mh: ; 0x82D9 - 0x82E4
	db $C0
	dw Routes3_md_1 ;Channel 1
	db $01
	dw Routes3_md_2 ;Channel 2
	db $02
	dw Routes3_md_3 ;Channel 3
	db $03
	dw Routes3_md_4 ;Channel 4

;Routes 11, 12, 13, 14, 15
Routes4_mh: ; 0x82E5 - 0x82F0
	db $C0
	dw Routes4_md_1 ;Channel 1
	db $01
	dw Routes4_md_2 ;Channel 2
	db $02
	dw Routes4_md_3 ;Channel 3
	db $03
	dw Routes4_md_4 ;Channel 4

;Indigo Plateau
IndigoPlateau_mh: ; 0x82F1 - 0x82FC
	db $C0
	dw IndigoPlateau_md_1 ;Channel 1
	db $01
	dw IndigoPlateau_md_2 ;Channel 2
	db $02
	dw IndigoPlateau_md_3 ;Channel 3
	db $03
	dw IndigoPlateau_md_4 ;Channel 4

INCLUDE "music.asm"
	
SECTION "bank3",ROMX,BANK[$3]

; known jump sources: 1a4 (0:1a4)
_GetJoypadState: ; c000 (3:4000)
	ld a, [H_JOYPADSTATE]
	cp BTN_A | BTN_B | BTN_SELECT | BTN_START ; soft reset sequence
	jp z, HandleJoypadResetButtons
	ld b, a
	ld a, [H_OLDPRESSEDBUTTONS]
	ld e, a
	xor b
	ld d, a
	and e
	ld [H_NEWLYRELEASEDBUTTONS], a
	ld a, d
	and b
	ld [H_NEWLYPRESSEDBUTTONS], a
	ld a, b
	ld [H_OLDPRESSEDBUTTONS], a
	ld a, [$d730]
	bit 5, a
	jr nz, DiscardButtonPresses
	ld a, [H_OLDPRESSEDBUTTONS]
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, [W_JOYPADFORBIDDENBUTTONSMASK]
	and a
	ret z
	cpl
	ld b, a
	ld a, [H_CURRENTPRESSEDBUTTONS]
	and b
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, [H_NEWLYPRESSEDBUTTONS]
	and b
	ld [H_NEWLYPRESSEDBUTTONS], a
	ret

; clears all button presses
DiscardButtonPresses: ; c034 (3:4034)
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [H_NEWLYPRESSEDBUTTONS], a
	ld [H_NEWLYRELEASEDBUTTONS], a
	ret

; known jump sources: c004 (3:4004)
HandleJoypadResetButtons: ; c03c (3:403c)
	call DelayFrame
	ld a, $30
	ld [rJOYP], a ; reset joypad state (to enusre the user really intends to reset)
	ld hl, H_SOFTRESETCOUNTER
	dec [hl]
	jp z, SoftReset
	jp GetJoypadState

INCBIN "baserom.gbc",$c04d,$c23d - $c04d

; see also MapHeaderPointers
MapHeaderBanks: ; c23d (3:423d)
	db BANK(PalletTown_h) ;PALLET_TOWN
	db BANK(ViridianCity_h) ; VIRIDIAN_CITY
	db BANK(PewterCity_h) ; PEWTER_CITY
	db BANK(CeruleanCity_h) ; CERULEAN_CITY
	db BANK(LavenderTown_h) ; LAVENDER_TOWN
	db BANK(VermilionCity_h) ; VERMILION_CITY
	db BANK(CeladonCity_h) ; CELADON_CITY
	db BANK(FuchsiaCity_h) ; FUCHSIA_CITY
	db BANK(CinnabarIsland_h) ; CINNABAR_ISLAND
	db BANK(IndigoPlateau_h) ; INDIGO_PLATEAU
	db BANK(SaffronCity_h) ; SAFFRON_CITY
	db $1 ; unused
	db BANK(Route1_h) ; ROUTE_1
	db BANK(Route2_h) ; ROUTE_2
	db BANK(Route3_h) ; ROUTE_3
	db BANK(Route4_h) ; ROUTE_4
	db BANK(Route5_h) ; ROUTE_5
	db BANK(Route6_h) ; ROUTE_6
	db BANK(Route7_h) ; ROUTE_7
	db BANK(Route8_h) ; ROUTE_8
	db BANK(Route9_h) ; ROUTE_9
	db BANK(Route10_h) ; ROUTE_10
	db BANK(Route11_h) ; ROUTE_11
	db BANK(Route12_h) ; ROUTE_12
	db BANK(Route13_h) ; ROUTE_13
	db BANK(Route14_h) ; ROUTE_14
	db BANK(Route15_h) ; ROUTE_15
	db BANK(Route16_h) ; ROUTE_16
	db BANK(Route17_h) ; ROUTE_17
	db BANK(Route18_h) ; ROUTE_18
	db BANK(Route19_h) ; ROUTE_19
	db BANK(Route20_h) ; ROUTE_20
	db BANK(Route21_h) ; ROUTE_21
	db BANK(Route22_h) ; ROUTE_22
	db BANK(Route23_h) ; ROUTE_23
	db BANK(Route24_h) ; ROUTE_24
	db BANK(Route25_h) ; ROUTE_25
	db BANK(RedsHouse1F_h)
	db BANK(RedsHouse2F_h)
	db BANK(BluesHouse_h)
	db BANK(OaksLab_h)
	db BANK(ViridianPokecenter_h)
	db BANK(ViridianMart_h)
	db BANK(School_h)
	db BANK(ViridianHouse_h)
	db BANK(ViridianGym_h)
	db BANK(DiglettsCaveRoute2_h)
	db BANK(ViridianForestexit_h)
	db BANK(Route2House_h)
	db BANK(Route2Gate_h)
	db BANK(ViridianForestEntrance_h)
	db BANK(ViridianForest_h)
	db BANK(MuseumF1_h)
	db BANK(MuseumF2_h)
	db BANK(PewterGym_h)
	db BANK(PewterHouse1_h)
	db BANK(PewterMart_h)
	db BANK(PewterHouse2_h)
	db BANK(PewterPokecenter_h)
	db BANK(MtMoon1_h)
	db BANK(MtMoon2_h)
	db BANK(MtMoon3_h)
	db BANK(CeruleanHouseTrashed_h)
	db BANK(CeruleanHouse2_h)
	db BANK(CeruleanPokecenter_h)
	db BANK(CeruleanGym_h)
	db BANK(BikeShop_h)
	db BANK(CeruleanMart_h)
	db BANK(MtMoonPokecenter_h)
	db BANK(CeruleanHouseTrashed_h)
	db BANK(Route5Gate_h)
	db BANK(UndergroundTunnelEntranceRoute5_h)
	db BANK(DayCareM_h)
	db BANK(Route6Gate_h)
	db BANK(UndergroundTunnelEntranceRoute6_h)
	db $17 ;FREEZE
	db BANK(Route7Gate_h)
	db BANK(UndergroundPathEntranceRoute7_h)
	db $17 ;FREEZE
	db BANK(Route8Gate_h)
	db BANK(UndergroundPathEntranceRoute8_h)
	db BANK(RockTunnelPokecenter_h)
	db BANK(RockTunnel1_h)
	db BANK(PowerPlant_h)
	db BANK(Route11Gate_h)
	db BANK(DiglettsCaveEntranceRoute11_h)
	db BANK(Route11GateUpstairs_h)
	db BANK(Route12Gate_h)
	db BANK(BillsHouse_h)
	db BANK(VermilionPokecenter_h)
	db BANK(FanClub_h)
	db BANK(VermilionMart_h)
	db BANK(VermilionGym_h)
	db BANK(VermilionHouse1_h)
	db BANK(VermilionDock_h)
	db BANK(SSAnne1_h)
	db BANK(SSAnne2_h)
	db BANK(SSAnne3_h)
	db BANK(SSAnne4_h)
	db BANK(SSAnne5_h)
	db BANK(SSAnne6_h)
	db BANK(SSAnne7_h)
	db BANK(SSAnne8_h)
	db BANK(SSAnne9_h)
	db BANK(SSAnne10_h)
	db $1D ;unused
	db $1D ;unused
	db $1D ;unused
	db BANK(VictoryRoad1_h)
	db $1D ;unused
	db $1D ;unused
	db $1D ;unused
	db $1D ;unused
	db BANK(Lance_h)
	db $1D ;unused
	db $1D ;unused
	db $1D ;unused
	db $1D ;unused
	db BANK(HallofFameRoom_h)
	db BANK(UndergroundPathNS_h)
	db BANK(Gary_h)
	db BANK(UndergroundPathWE_h)
	db BANK(CeladonMart1_h)
	db BANK(CeladonMart2_h)
	db BANK(CeladonMart3_h)
	db BANK(CeladonMart4_h)
	db BANK(CeladonMartRoof_h)
	db BANK(CeladonMartElevator_h)
	db BANK(CeladonMansion1_h)
	db BANK(CeladonMansion2_h)
	db BANK(CeladonMansion3_h)
	db BANK(CeladonMansion4_h)
	db BANK(CeladonMansion5_h)
	db BANK(CeladonPokecenter_h)
	db BANK(CeladonGym_h)
	db BANK(CeladonGameCorner_h)
	db BANK(CeladonMart5_h)
	db BANK(CeladonPrizeRoom_h)
	db BANK(CeladonDiner_h)
	db BANK(CeladonHouse_h)
	db BANK(CeladonHotel_h)
	db BANK(LavenderPokecenter_h)
	db BANK(PokemonTower1_h)
	db BANK(PokemonTower2_h)
	db BANK(PokemonTower3_h)
	db BANK(PokemonTower4_h)
	db BANK(PokemonTower5_h)
	db BANK(PokemonTower6_h)
	db BANK(PokemonTower7_h)
	db BANK(LavenderHouse1_h)
	db BANK(LavenderMart_h)
	db BANK(LavenderHouse2_h)
	db BANK(FuchsiaMart_h)
	db BANK(FuchsiaHouse1_h)
	db BANK(FuchsiaPokecenter_h)
	db BANK(FuchsiaHouse2_h)
	db BANK(SafariZoneEntrance_h)
	db BANK(FuchsiaGym_h)
	db BANK(FuchsiaMeetingRoom_h)
	db BANK(SeafoamIslands2_h)
	db BANK(SeafoamIslands3_h)
	db BANK(SeafoamIslands4_h)
	db BANK(SeafoamIslands5_h)
	db BANK(VermilionHouse2_h)
	db BANK(FuchsiaHouse3_h)
	db BANK(Mansion1_h)
	db BANK(CinnabarGym_h)
	db BANK(Lab1_h)
	db BANK(Lab2_h)
	db BANK(Lab3_h)
	db BANK(Lab4_h)
	db BANK(CinnabarPokecenter_h)
	db BANK(CinnabarMart_h)
	db $1D
	db BANK(IndigoPlateauLobby_h)
	db BANK(CopycatsHouseF1_h)
	db BANK(CopycatsHouseF2_h)
	db BANK(FightingDojo_h)
	db BANK(SaffronGym_h)
	db BANK(SaffronHouse1_h)
	db BANK(SaffronMart_h)
	db BANK(SilphCo1_h)
	db BANK(SaffronPokecenter_h)
	db BANK(SaffronHouse2_h)
	db BANK(Route15Gate_h)
	db BANK(Route15GateUpstairs_h)
	db BANK(Route16GateMap_h)
	db BANK(Route16GateUpstairs_h)
	db BANK(Route16House_h)
	db BANK(Route12House_h)
	db BANK(Route18Gate_h)
	db BANK(Route18GateHeader_h)
	db BANK(SeafoamIslands1_h)
	db BANK(Route22Gate_h)
	db BANK(VictoryRoad2_h)
	db BANK(Route12GateUpstairs_h)
	db BANK(VermilionHouse3_h)
	db BANK(DiglettsCave_h)
	db BANK(VictoryRoad3_h)
	db BANK(RocketHideout1_h)
	db BANK(RocketHideout2_h)
	db BANK(RocketHideout3_h)
	db BANK(RocketHideout4_h)
	db BANK(RocketHideoutElevator_h)
	db $01
	db $01
	db $01
	db BANK(SilphCo2_h)
	db BANK(SilphCo3_h)
	db BANK(SilphCo4_h)
	db BANK(SilphCo5_h)
	db BANK(SilphCo6_h)
	db BANK(SilphCo7_h)
	db BANK(SilphCo8_h)
	db BANK(Mansion2_h)
	db BANK(Mansion3_h)
	db BANK(Mansion4_h)
	db BANK(SafariZoneEast_h)
	db BANK(SafariZoneNorth_h)
	db BANK(SafariZoneWest_h)
	db BANK(SafariZoneCenter_h)
	db BANK(SafariZoneRestHouse1_h)
	db BANK(SafariZoneSecretHouse_h)
	db BANK(SafariZoneRestHouse2_h)
	db BANK(SafariZoneRestHouse3_h)
	db BANK(SafariZoneRestHouse4_h)
	db BANK(UnknownDungeon2_h)
	db BANK(UnknownDungeon3_h)
	db BANK(UnknownDungeon1_h)
	db BANK(NameRater_h)
	db BANK(CeruleanHouse3_h)
	db $01
	db BANK(RockTunnel2_h)
	db BANK(SilphCo9_h)
	db BANK(SilphCo10_h)
	db BANK(SilphCo11_h)
	db BANK(SilphCoElevator_h)
	db $11
	db $11
	db BANK(BattleCenterM_h)
	db BANK(TradeCenterM_h)
	db $11
	db $11
	db $11
	db $11
	db BANK(Lorelei_h)
	db BANK(Bruno_h)
	db BANK(Agatha_h)

; known jump sources: 3b3 (0:3b3), 5798 (1:5798)
Func_c335: ; c335 (3:4335)
	ld a, $90
	ld [$FF00+$b0], a
	ld [rWY], a ; $FF00+$4a
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld [$d13b], a
	ld [W_LONEATTACKNO], a ; $d05c
	ld [H_NEWLYPRESSEDBUTTONS], a
	ld [H_NEWLYRELEASEDBUTTONS], a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [$cd6a], a
	ld [$d5a3], a
	ld hl, $d73f
	ld [hli], a
	ld [hl], a
	ld hl, W_WHICHTRADE ; $cd3d
	ld bc, $1e
	call FillMemory
	ret

; known jump sources: 924 (0:924)
Func_c35f: ; c35f (3:435f)
	ld a, [$d3ae]
	and a
	ret z
	ld c, a
	ld hl, $d3af
.asm_c368
	ld a, [W_YCOORD] ; $d361
	cp [hl]
	jr nz, .asm_c383
	inc hl
	ld a, [W_XCOORD] ; $d362
	cp [hl]
	jr nz, .asm_c384
	inc hl
	ld a, [hli]
	ld [$d42f], a
	ld a, [hl]
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld hl, $d736
	set 2, [hl]
	ret
.asm_c383
	inc hl
.asm_c384
	inc hl
	inc hl
	inc hl
	dec c
	jr nz, .asm_c368
	ret
; c38b (3:438b)
CheckForceBikeOrSurf: ; c38b (3:438b)
	ld hl, $D732
	bit 5, [hl]
	ret nz
	ld hl, ForcedBikeOrSurfMaps
	ld a, [W_YCOORD]
	ld b, a
	ld a, [W_XCOORD]
	ld c, a
	ld a, [W_CURMAP]
	ld d, a
.loop
	ld a, [hli]
	cp $ff
	ret z ;if we reach FF then it's not part of the list
	cp d ;compare to current map
	jr nz, .incorrectMap
	ld a, [hli]
	cp b ;compare y-coord
	jr nz, .incorrectY
	ld a, [hli]
	cp c ;compare x-coord
	jr nz, .loop ; incorrect x-coord, check next item
	ld a, [W_CURMAP]
	cp SEAFOAM_ISLANDS_4
	ld a, $2
	ld [W_SEAFOAMISLANDS4CURSCRIPT], a
	jr z, .forceSurfing
	ld a, [$d35e]
	cp SEAFOAM_ISLANDS_5
	ld a, $2
	ld [W_SEAFOAMISLANDS5CURSCRIPT], a
	jr z, .forceSurfing
	;force bike riding
	ld hl, $d732
	set 5, [hl]
	ld a, $1
	ld [$d700], a
	ld [$d11a], a
	jp ForceBikeOrSurf
.incorrectMap
	inc hl
.incorrectY
	inc hl
	jr .loop
.forceSurfing
	ld a, $2
	ld [$d700], a
	ld [$d11a], a
	jp ForceBikeOrSurf
; 0xc3e6

ForcedBikeOrSurfMaps: ; c3e6 (3:43e6)
; map id, y, x
db ROUTE_16,$0A,$11 
db ROUTE_16,$0B,$11
db ROUTE_18,$08,$21
db ROUTE_18,$09,$21
db SEAFOAM_ISLANDS_4,$07,$12 
db SEAFOAM_ISLANDS_4,$07,$13 
db SEAFOAM_ISLANDS_5,$0E,$04 
db SEAFOAM_ISLANDS_5,$0E,$05
db $FF ;end
; 0xc3ff

; known jump sources: 91c (0:91c)
Func_c3ff: ; c3ff (3:43ff)
	push hl
	push de
	push bc
	ld a, [$c109]
	srl a
	ld c, a
	ld b, $0
	ld hl, Unknown_c422 ; $4422
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld a, [W_YCOORD] ; $d361
	ld b, a
	ld a, [W_XCOORD] ; $d362
	ld c, a
	ld de, .asm_c41e ; $441e
	push de
	jp [hl]
.asm_c41e
	pop bc
	pop de
	pop hl
	ret

Unknown_c422: ; c422 (3:4422)
INCBIN "baserom.gbc",$c422,$c42a - $c422

Func_c422: ; c42a (3:442a)
	ld a, [W_CURMAPHEIGHT] ; $d368
	add a
	dec a
	cp b
	jr z, .asm_c44c
	jr .asm_c44a
	ld a, b
	and a
	jr z, .asm_c44c
	jr .asm_c44a
	ld a, c
	and a
	jr z, .asm_c44c
	jr .asm_c44a
	ld a, [W_CURMAPWIDTH] ; $d369
	add a
	dec a
	cp c
	jr z, .asm_c44c
	jr .asm_c44a
.asm_c44a
	and a
	ret
.asm_c44c
	scf
	ret

Func_c44e: ; c44e (3:444e)
	push hl
	push de
	push bc
	call Func_c589
	ld a, [W_CURMAP] ; $d35e
	cp $63
	jr z, .asm_c490
	ld a, [$c109]
	srl a
	ld c, a
	ld b, $0
	ld hl, .unknown_c477 ; $4477
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld a, [$cfc6]
	ld de, $1
	call IsInArray
.asm_c473
	pop bc
	pop de
	pop hl
	ret

.unknown_c477: ; c477 (3:4477)
INCBIN "baserom.gbc",$c477,$c490 - $c477

.asm_c490
	ld a, [$cfc6]
	cp $15
	jr nz, .asm_c49a
	scf
	jr .asm_c473
.asm_c49a
	and a
	jr .asm_c473

; known jump sources: 6e0 (0:6e0), 1387f (4:787f)
Func_c49d: ; c49d (3:449d)
	push hl
	push de
	push bc
	ld b, BANK(Func_1a609)
	ld hl, Func_1a609
	call Bankswitch ; indirect jump to Func_1a609 (1a609 (6:6609))
	jr c, .asm_c4c8
	ld a, [W_CURMAPTILESET] ; $d367
	add a
	ld c, a
	ld b, $0
	ld hl, Unknown_c4cc ; $44cc
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld de, $1
	FuncCoord 8, 9 ; $c45c
	ld a, [Coord]
	call IsInArray
	jr nc, .asm_c4c8
	ld hl, $d736
	res 2, [hl]
.asm_c4c8
	pop bc
	pop de
	pop hl
	ret

Unknown_c4cc: ; c4cc (3:44cc)
INCBIN "baserom.gbc",$c4cc,$c52f - $c4cc

; known jump sources: 2aec (0:2aec)
Func_c52f: ; c52f (3:452f)
	ld a, [W_CURMAP] ; $d35e
	cp $d9
	ret c
	cp $e2
	ret nc
	ld hl, W_SCREENTILESBUFFER
	ld b, $3
	ld c, $7
	call TextBoxBorder
	FuncCoord 1, 1 ; $c3b5
	ld hl, Coord
	ld de, W_SAFARITIMER1 ; $d70d
	ld bc, $203
	call PrintNumber
	FuncCoord 4, 1 ; $c3b8
	ld hl, Coord
	ld de, Unknown_c579 ; $4579
	call PlaceString
	FuncCoord 1, 3 ; $c3dd
	ld hl, Coord
	ld de, Unknown_c57e ; $457e
	call PlaceString
	ld a, [W_NUMSAFARIBALLS] ; $da47
	cp $a
	jr nc, .asm_c56d
	FuncCoord 5, 3 ; $c3e1
	ld hl, Coord
	ld a, $7f
	ld [hl], a
.asm_c56d
	FuncCoord 6, 3 ; $c3e2
	ld hl, Coord
	ld de, W_NUMSAFARIBALLS ; $da47
	ld bc, $102
	jp PrintNumber

Unknown_c579: ; c579 (3:4579)
INCBIN "baserom.gbc",$c579,$c57e - $c579

Unknown_c57e: ; c57e (3:457e)
INCBIN "baserom.gbc",$c57e,$c586 - $c57e

; known jump sources: 47f (0:47f), b2e (0:b2e), b5a (0:b5a), c12 (0:c12), c2d (0:c2d), fd3 (0:fd3), 1a67f (6:667f), 52683 (14:6683)
Func_c586: ; c586 (3:4586)
	call Load16BitRegisters

; known jump sources: c451 (3:4451)
Func_c589: ; c589 (3:4589)
	ld a, [W_YCOORD] ; $d361
	ld d, a
	ld a, [W_XCOORD] ; $d362
	ld e, a
	ld a, [$c109]
	and a
	jr nz, .asm_c59d
	FuncCoord 8, 11 ; $c484
	ld a, [Coord]
	inc d
	jr .asm_c5b9
.asm_c59d
	cp $4
	jr nz, .asm_c5a7
	FuncCoord 8, 7 ; $c434
	ld a, [Coord]
	dec d
	jr .asm_c5b9
.asm_c5a7
	cp $8
	jr nz, .asm_c5b1
	FuncCoord 6, 9 ; $c45a
	ld a, [Coord]
	dec e
	jr .asm_c5b9
.asm_c5b1
	cp $c
	jr nz, .asm_c5b9
	FuncCoord 10, 9 ; $c45e
	ld a, [Coord]
	inc e
.asm_c5b9
	ld c, a
	ld [$cfc6], a
	ret

; known jump sources: c60b (3:460b)
Func_c5be: ; c5be (3:45be)
	xor a
	ld [$FF00+$db], a
	ld hl, W_YCOORD ; $d361
	ld a, [hli]
	ld d, a
	ld e, [hl]
	ld a, [$c109]
	and a
	jr nz, .asm_c5d8
	ld hl, $ffdb
	set 0, [hl]
	FuncCoord 8, 13 ; $c4ac
	ld a, [Coord]
	inc d
	jr .asm_c603
.asm_c5d8
	cp $4
	jr nz, .asm_c5e7
	ld hl, $ffdb
	set 1, [hl]
	FuncCoord 8, 5 ; $c40c
	ld a, [Coord]
	dec d
	jr .asm_c603
.asm_c5e7
	cp $8
	jr nz, .asm_c5f6
	ld hl, $ffdb
	set 2, [hl]
	FuncCoord 4, 9 ; $c458
	ld a, [Coord]
	dec e
	jr .asm_c603
.asm_c5f6
	cp $c
	jr nz, .asm_c603
	ld hl, $ffdb
	set 3, [hl]
	FuncCoord 12, 9 ; $c460
	ld a, [Coord]
	inc e
.asm_c603
	ld c, a
	ld [$d71c], a
	ld [$cfc6], a
	ret

; known jump sources: f265 (3:7265)
Func_c60b: ; c60b (3:460b)
	call Func_c5be
	ld hl, $d530
	ld a, [hli]
	ld h, [hl]
	ld l, a
.asm_c614
	ld a, [hli]
	cp $ff
	jr z, .asm_c632
	cp c
	jr nz, .asm_c614
	ld hl, $c7e
	call Func_c44
	ld a, $ff
	jr c, .asm_c632
	ld a, [$d71c]
	cp $15
	ld a, $ff
	jr z, .asm_c632
	call Func_c636
.asm_c632
	ld [$d71c], a
	ret

; known jump sources: c62f (3:462f)
Func_c636: ; c636 (3:4636)
	ld a, [$d718]
	dec a
	swap a
	ld d, $0
	ld e, a
	ld hl, $c214
	add hl, de
	ld a, [hli]
	ld [$FF00+$dc], a
	ld a, [hl]
	ld [$FF00+$dd], a
	ld a, [W_NUMSPRITES] ; $d4e1
	ld c, a
	ld de, $f
	ld hl, $c214
	ld a, [$FF00+$db]
	and $3
	jr z, .asm_c678
.asm_c659
	inc hl
	ld a, [$FF00+$dd]
	cp [hl]
	jr nz, .asm_c672
	dec hl
	ld a, [hli]
	ld b, a
	ld a, [$FF00+$db]
	rrca
	jr c, .asm_c66c
	ld a, [$FF00+$dc]
	dec a
	jr .asm_c66f
.asm_c66c
	ld a, [$FF00+$dc]
	inc a
.asm_c66f
	cp b
	jr z, .asm_c697
.asm_c672
	dec c
	jr z, .asm_c69a
	add hl, de
	jr .asm_c659
.asm_c678
	ld a, [hli]
	ld b, a
	ld a, [$FF00+$dc]
	cp b
	jr nz, .asm_c691
	ld b, [hl]
	ld a, [$FF00+$db]
	bit 2, a
	jr nz, .asm_c68b
	ld a, [$FF00+$dd]
	inc a
	jr .asm_c68e
.asm_c68b
	ld a, [$FF00+$dd]
	dec a
.asm_c68e
	cp b
	jr z, .asm_c697
.asm_c691
	dec c
	jr z, .asm_c69a
	add hl, de
	jr .asm_c678
.asm_c697
	ld a, $ff
	ret
.asm_c69a
	xor a
	ret

; known jump sources: 622 (0:622)
Func_c69c: ; c69c (3:469c)
	ld a, [$d730]
	add a
	jp c, .asm_c74f
	ld a, [W_NUMINPARTY] ; $d163
	and a
	jp z, .asm_c74f
	call Func_c8de
	ld a, [$d13b]
	and $3
	jp nz, .asm_c74f
	ld [W_WHICHPOKEMON], a ; $cf92
	ld hl, W_PARTYMON1_STATUS ; $d16f
	ld de, W_PARTYMON1 ; $d164
.asm_c6be
	ld a, [hl]
	and $8
	jr z, .asm_c6fd
	dec hl
	dec hl
	ld a, [hld]
	ld b, a
	ld a, [hli]
	or b
	jr z, .asm_c6fb
	ld a, [hl]
	dec a
	ld [hld], a
	inc a
	jr nz, .asm_c6d5
	dec [hl]
	inc hl
	jr .asm_c6fb
.asm_c6d5
	ld a, [hli]
	or [hl]
	jr nz, .asm_c6fb
	push hl
	inc hl
	inc hl
	ld [hl], a
	ld a, [de]
	ld [$d11e], a
	push de
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, W_PARTYMON1NAME ; $d2b5
	call GetPartyMonName
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	call EnableAutoTextBoxDrawing
	ld a, $d0
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	pop de
	pop hl
.asm_c6fb
	inc hl
	inc hl
.asm_c6fd
	inc de
	ld a, [de]
	inc a
	jr z, .asm_c70e
	ld bc, $2c
	add hl, bc
	push hl
	ld hl, W_WHICHPOKEMON ; $cf92
	inc [hl]
	pop hl
	jr .asm_c6be
.asm_c70e
	ld hl, W_PARTYMON1_STATUS ; $d16f
	ld a, [W_NUMINPARTY] ; $d163
	ld d, a
	ld e, $0
.asm_c717
	ld a, [hl]
	and $8
	or e
	ld e, a
	ld bc, $2c
	add hl, bc
	dec d
	jr nz, .asm_c717
	ld a, e
	and a
	jr z, .asm_c733
	ld b, $2
	ld a, $1f
	call Predef ; indirect jump to Func_480eb (480eb (12:40eb))
	ld a, $97
	call PlaySound
.asm_c733
	ld a, $14
	call Predef ; indirect jump to AnyPokemonAliveCheck (3ca83 (f:4a83))
	ld a, d
	and a
	jr nz, .asm_c74f
	call EnableAutoTextBoxDrawing
	ld a, $d1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d72e
	set 5, [hl]
	ld a, $ff
	jr .asm_c750
.asm_c74f
	xor a
.asm_c750
	ld [$d12d], a
	ret

; known jump sources: 11fa (0:11fa), 62d3 (1:62d3)
Func_c754: ; c754 (3:4754)
	call Load16BitRegisters
	push hl
	ld d, $0
	ld a, [W_CURMAPTILESET] ; $d367
	add a
	add a
	ld b, a
	add a
	add b
	jr nc, .asm_c765
	inc d
.asm_c765
	ld e, a
; c766 (3:4766)
	ld hl, TilesetsHeadPtr

	add hl, de
	ld de, $d52b
	ld c, $b
.asm_c76f
	ld a, [hli]
	ld [de], a
	inc de
	dec c
	jr nz, .asm_c76f
	ld a, [hl]
	ld [$FF00+$d7], a
	xor a
	ld [$FF00+$d8], a
	pop hl
	ld a, [W_CURMAPTILESET] ; $d367
	push hl
	push de
	ld hl, Unknown_c7b2 ; $47b2
	ld de, $1
	call IsInArray
	pop de
	pop hl
	jr c, .asm_c797
	ld a, [W_CURMAPTILESET] ; $d367
	ld b, a
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	cp b
	jr z, .asm_c7b1
.asm_c797
	ld a, [$d42f]
	cp $ff
	jr z, .asm_c7b1
	call LoadDestinationWarpPosition
	ld a, [W_YCOORD] ; $d361
	and $1
	ld [W_YBLOCKCOORD], a ; $d363
	ld a, [W_XCOORD] ; $d362
	and $1
	ld [W_XBLOCKCOORD], a ; $d364
.asm_c7b1
	ret

Unknown_c7b2: ; c7b2 (3:47b2)
INCBIN "baserom.gbc",$c7b2,$c7be - $c7b2

TilesetsHeadPtr: ; c7be (3:47be)
	TSETHEAD Tset00_Block,Tset00_GFX,Tset00_Coll,$FF,$FF,$FF,$52,2
	TSETHEAD Tset01_Block,Tset01_GFX,Tset01_Coll,$FF,$FF,$FF,$FF,0
	TSETHEAD Tset02_Block,Tset02_GFX,Tset02_Coll,$18,$19,$1E,$FF,0
	TSETHEAD Tset03_Block,Tset03_GFX,Tset03_Coll,$FF,$FF,$FF,$20,1
	TSETHEAD Tset01_Block,Tset01_GFX,Tset01_Coll,$FF,$FF,$FF,$FF,0
	TSETHEAD Tset05_Block,Tset05_GFX,Tset05_Coll,$3A,$FF,$FF,$FF,2
	TSETHEAD Tset02_Block,Tset02_GFX,Tset02_Coll,$18,$19,$1E,$FF,0
	TSETHEAD Tset05_Block,Tset05_GFX,Tset05_Coll,$3A,$FF,$FF,$FF,2
	TSETHEAD Tset08_Block,Tset08_GFX,Tset08_Coll,$FF,$FF,$FF,$FF,0
	TSETHEAD Tset09_Block,Tset09_GFX,Tset09_Coll,$17,$32,$FF,$FF,0
	TSETHEAD Tset09_Block,Tset09_GFX,Tset09_Coll,$17,$32,$FF,$FF,0
	TSETHEAD Tset0B_Block,Tset0B_GFX,Tset0B_Coll,$FF,$FF,$FF,$FF,0
	TSETHEAD Tset09_Block,Tset09_GFX,Tset09_Coll,$17,$32,$FF,$FF,0
	TSETHEAD Tset0D_Block,Tset0D_GFX,Tset0D_Coll,$FF,$FF,$FF,$FF,1
	TSETHEAD Tset0E_Block,Tset0E_GFX,Tset0E_Coll,$FF,$FF,$FF,$FF,1
	TSETHEAD Tset0F_Block,Tset0F_GFX,Tset0F_Coll,$12,$FF,$FF,$FF,0
	TSETHEAD Tset10_Block,Tset10_GFX,Tset10_Coll,$FF,$FF,$FF,$FF,0
	TSETHEAD Tset11_Block,Tset11_GFX,Tset11_Coll,$FF,$FF,$FF,$FF,1
	TSETHEAD Tset12_Block,Tset12_GFX,Tset12_Coll,$15,$36,$FF,$FF,0
	TSETHEAD Tset13_Block,Tset13_GFX,Tset13_Coll,$FF,$FF,$FF,$FF,0
	TSETHEAD Tset14_Block,Tset14_GFX,Tset14_Coll,$FF,$FF,$FF,$FF,0
	TSETHEAD Tset15_Block,Tset15_GFX,Tset15_Coll,$07,$17,$FF,$FF,0
	TSETHEAD Tset16_Block,Tset16_GFX,Tset16_Coll,$12,$FF,$FF,$FF,1
	TSETHEAD Tset17_Block,Tset17_GFX,Tset17_Coll,$FF,$FF,$FF,$45,1
; 0xC8DE

; known jump sources: c6aa (3:46aa)
Func_c8de: ; c8de (3:48de)
	ld a, [$da48]
	and a
	ret z
	ld hl, $da6f
	inc [hl]
	ret nz
	dec hl
	inc [hl]
	ret nz
	dec hl
	inc [hl]
	ld a, [hl]
	cp $50
	ret c
	ld a, $50
	ld [hl], a
	ret
; c8f5 (3:48f5)
; data for default hidden/shown
; objects for each map ($00-$F8)

; Table of 2-Byte pointers, one pointer per map,
; goes up to Map_F7, ends with $FFFF.
; points to table listing all missable object in the area
MapHSPointers: ; c8f5 (3:48f5)
	dw MapHS00
	dw MapHS01
	dw MapHS02
	dw MapHS03
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS0A
	dw MapHSXX
	dw MapHSXX
	dw MapHS0D
	dw MapHSXX
	dw MapHS0F
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS14
	dw MapHSXX
	dw MapHSXX
	dw MapHS17
	dw MapHSXX
	dw MapHSXX
	dw MapHS1A
	dw MapHS1B
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS21
	dw MapHSXX
	dw MapHS23
	dw MapHS24
	dw MapHSXX
	dw MapHSXX
	dw MapHS27
	dw MapHS28
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS2D
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS33
	dw MapHS34
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS3B
	dw MapHSXX
	dw MapHS3D
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS53
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS58
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS60
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS66
	dw MapHS67
	dw MapHS68
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS6C
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS78
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS84
	dw MapHSXX
	dw MapHSXX
	dw MapHS87
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS8F
	dw MapHS90
	dw MapHS91
	dw MapHS92
	dw MapHS93
	dw MapHS94
	dw MapHS95
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS9B
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHS9F
	dw MapHSA0
	dw MapHSA1
	dw MapHSA2
	dw MapHSXX
	dw MapHSXX
	dw MapHSA5
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSB1
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSB5
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSC0
	dw MapHSXX
	dw MapHSC2
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSC6
	dw MapHSC7
	dw MapHSC8
	dw MapHSC9
	dw MapHSCA
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSCF
	dw MapHSD0
	dw MapHSD1
	dw MapHSD2
	dw MapHSD3
	dw MapHSD4
	dw MapHSD5
	dw MapHSD6
	dw MapHSD7
	dw MapHSD8
	dw MapHSD9
	dw MapHSDA
	dw MapHSDB
	dw MapHSDC
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSE2
	dw MapHSE3
	dw MapHSE4
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSE9
	dw MapHSEA
	dw MapHSEB
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw MapHSF4
	dw MapHSXX
	dw MapHSXX
	dw MapHSXX
	dw $FFFF

; Structure:
; 3 bytes per object
; [Map_ID][Object_ID][H/S]
;
; Program stops reading when either:
; a) Map_ID = $FF
; b) Map_ID ≠ currentMapID
;
; This Data is loaded into RAM at $D5CE-$D5F?. (W_MISSABLEOBJECTLIST)

; These constants come from the bytes for Predef functions:
Hide	equ $11
Show	equ $15

MapHSXX: ; cae7 (3:4ae7)
	db $FF,$FF,$FF
MapHS00: ; caea (3:4aea)
	db PALLET_TOWN,$01,Hide
MapHS01: ; caed (3:4aed)
	db VIRIDIAN_CITY,$05,Show
	db VIRIDIAN_CITY,$07,Hide
MapHS02: ; caf3 (3:4af3)
	db PEWTER_CITY,$03,Show
	db PEWTER_CITY,$05,Show
MapHS03: ; caf9 (3:4af9)
	db CERULEAN_CITY,$01,Hide
	db CERULEAN_CITY,$02,Show
	db CERULEAN_CITY,$06,Hide
	db CERULEAN_CITY,$0A,Show
	db CERULEAN_CITY,$0B,Show
MapHS0A: ; cb08 (3:4b08)
	db SAFFRON_CITY,$01,Show
	db SAFFRON_CITY,$02,Show
	db SAFFRON_CITY,$03,Show
	db SAFFRON_CITY,$04,Show
	db SAFFRON_CITY,$05,Show
	db SAFFRON_CITY,$06,Show
	db SAFFRON_CITY,$07,Show
	db SAFFRON_CITY,$08,Hide
	db SAFFRON_CITY,$09,Hide
	db SAFFRON_CITY,$0A,Hide
	db SAFFRON_CITY,$0B,Hide
	db SAFFRON_CITY,$0C,Hide
	db SAFFRON_CITY,$0D,Hide
	db SAFFRON_CITY,$0E,Show
	db SAFFRON_CITY,$0F,Hide
MapHS0D: ; cb35 (3:4b35)
	db ROUTE_2,$01,Show
	db ROUTE_2,$02,Show
MapHS0F: ; cb3b (3:4b3b)
	db ROUTE_4,$03,Show
MapHS14: ; cb3e (3:4b3e)
	db ROUTE_9,$0A,Show
MapHS17: ; cb41 (3:4b41)
	db ROUTE_12,$01,Show
	db ROUTE_12,$09,Show
	db ROUTE_12,$0A,Show
MapHS1A: ; cb4a (3:4b4a)
	db ROUTE_15,$0B,Show
MapHS1B: ; cb4d (3:4b4d)
	db ROUTE_16,$07,Show
MapHS21: ; cb50 (3:4b50)
	db ROUTE_22,$01,Hide
	db ROUTE_22,$02,Hide
MapHS23: ; cb56 (3:4b56)
	db ROUTE_24,$01,Show
	db ROUTE_24,$08,Show
MapHS24: ; cb5c (3:4b5c)
	db ROUTE_25,$0A,Show
MapHS27: ; cb5f (3:4b5f)
	db BLUES_HOUSE,$01,Show
	db BLUES_HOUSE,$02,Hide
	db BLUES_HOUSE,$03,Show
MapHS28: ; cb68 (3:4b68)
	db OAKS_LAB,$01,Show
	db OAKS_LAB,$02,Show
	db OAKS_LAB,$03,Show
	db OAKS_LAB,$04,Show
	db OAKS_LAB,$05,Hide
	db OAKS_LAB,$06,Show
	db OAKS_LAB,$07,Show
	db OAKS_LAB,$08,Hide
MapHS2D: ; cb80 (3:4b80)
	db VIRIDIAN_GYM,$01,Show
	db VIRIDIAN_GYM,$0B,Show
MapHS34: ; cb86 (3:4b86)
	db MUSEUM_1F,$05,Show
MapHSE4: ; cb89 (3:4b89)
	db UNKNOWN_DUNGEON_1,$01,Show
	db UNKNOWN_DUNGEON_1,$02,Show
	db UNKNOWN_DUNGEON_1,$03,Show
MapHS8F: ; cb92 (3:4b92)
	db POKEMONTOWER_2,$01,Show
MapHS90: ; cb95 (3:4b95)
	db POKEMONTOWER_3,$04,Show
MapHS91: ; cb98 (3:4b98)
	db POKEMONTOWER_4,$04,Show
	db POKEMONTOWER_4,$05,Show
	db POKEMONTOWER_4,$06,Show
MapHS92: ; cba1 (3:4ba1)
	db POKEMONTOWER_5,$06,Show
MapHS93: ; cba4 (3:4ba4)
	db POKEMONTOWER_6,$04,Show
	db POKEMONTOWER_6,$05,Show
MapHS94: ; cbaa (3:4baa)
	db POKEMONTOWER_7,$01,Show
	db POKEMONTOWER_7,$02,Show
	db POKEMONTOWER_7,$03,Show
	db POKEMONTOWER_7,$04,Show
MapHS95: ; cbb6 (3:4bb6)
	db LAVENDER_HOUSE_1,$05,Hide
MapHS84: ; cbb9 (3:4bb9)
	db CELADON_MANSION_5,$02,Show
MapHS87: ; cbbc (3:4bbc)
	db GAME_CORNER,$0B,Show
MapHS9B: ; cbbf (3:4bbf)
	db FUCHSIA_HOUSE_2,$02,Show
MapHSA5: ; cbc2 (3:4bc2)
	db MANSION_1,$02,Show
	db MANSION_1,$03,Show
MapHSB1: ; cbc8 (3:4bc8)
	db FIGHTINGDOJO,$06,Show
	db FIGHTINGDOJO,$07,Show
MapHSB5: ; cbce (3:4bce)
	db SILPH_CO_1F,$01,Hide
MapHS53: ; cbd1 (3:4bd1)
	db POWER_PLANT,$01,Show
	db POWER_PLANT,$02,Show
	db POWER_PLANT,$03,Show
	db POWER_PLANT,$04,Show
	db POWER_PLANT,$05,Show
	db POWER_PLANT,$06,Show
	db POWER_PLANT,$07,Show
	db POWER_PLANT,$08,Show
	db POWER_PLANT,$09,Show
	db POWER_PLANT,$0A,Show
	db POWER_PLANT,$0B,Show
	db POWER_PLANT,$0C,Show
	db POWER_PLANT,$0D,Show
	db POWER_PLANT,$0E,Show
MapHSC2: ; cbfb (3:4bfb)
	db VICTORY_ROAD_2,$06,Show
	db VICTORY_ROAD_2,$07,Show
	db VICTORY_ROAD_2,$08,Show
	db VICTORY_ROAD_2,$09,Show
	db VICTORY_ROAD_2,$0A,Show
	db VICTORY_ROAD_2,$0D,Show
MapHS58: ; cc0d (3:4c0d)
	db BILLS_HOUSE,$01,Show
	db BILLS_HOUSE,$02,Hide
	db BILLS_HOUSE,$03,Hide
MapHS33: ; cc16 (3:4c16)
	db VIRIDIAN_FOREST,$05,Show
	db VIRIDIAN_FOREST,$06,Show
	db VIRIDIAN_FOREST,$07,Show
MapHS3B: ; cc1f (3:4c1f)
	db MT_MOON_1,$08,Show
	db MT_MOON_1,$09,Show
	db MT_MOON_1,$0A,Show
	db MT_MOON_1,$0B,Show
	db MT_MOON_1,$0C,Show
	db MT_MOON_1,$0D,Show
MapHS3D: ; cc31 (3:4c31)
	db MT_MOON_3,$06,Show
	db MT_MOON_3,$07,Show
	db MT_MOON_3,$08,Show
	db MT_MOON_3,$09,Show
MapHS60: ; cc3d (3:4c3d)
	db SS_ANNE_2,$02,Hide
MapHS66: ; cc40 (3:4c40)
	db SS_ANNE_8,$0A,Show
MapHS67: ; cc43 (3:4c43)
	db SS_ANNE_9,$06,Show
	db SS_ANNE_9,$09,Show
MapHS68: ; cc49 (3:4c49)
	db SS_ANNE_10,$09,Show
	db SS_ANNE_10,$0A,Show
	db SS_ANNE_10,$0B,Show
MapHSC6: ; cc52 (3:4c52)
	db VICTORY_ROAD_3,$05,Show
	db VICTORY_ROAD_3,$06,Show
	db VICTORY_ROAD_3,$0A,Show
MapHSC7: ; cc5b (3:4c5b)
	db ROCKET_HIDEOUT_1,$06,Show
	db ROCKET_HIDEOUT_1,$07,Show
MapHSC8: ; cc61 (3:4c61)
	db ROCKET_HIDEOUT_2,$02,Show
	db ROCKET_HIDEOUT_2,$03,Show
	db ROCKET_HIDEOUT_2,$04,Show
	db ROCKET_HIDEOUT_2,$05,Show
MapHSC9: ; cc6d (3:4c6d)
	db ROCKET_HIDEOUT_3,$03,Show
	db ROCKET_HIDEOUT_3,$04,Show
MapHSCA: ; cc73 (3:4c73)
	db ROCKET_HIDEOUT_4,$01,Show
	db ROCKET_HIDEOUT_4,$05,Show
	db ROCKET_HIDEOUT_4,$06,Show
	db ROCKET_HIDEOUT_4,$07,Show
	db ROCKET_HIDEOUT_4,$08,Hide
	db ROCKET_HIDEOUT_4,$09,Hide
MapHSCF: ; cc85 (3:4c85)
	db SILPH_CO_2F,$01,Show
	db SILPH_CO_2F,$02,Show
	db SILPH_CO_2F,$03,Show
	db SILPH_CO_2F,$04,Show
	db SILPH_CO_2F,$05,Show
MapHSD0: ; cc94 (3:4c94)
	db SILPH_CO_3F,$02,Show
	db SILPH_CO_3F,$03,Show
	db SILPH_CO_3F,$04,Show
MapHSD1: ; cc9d (3:4c9d)
	db SILPH_CO_4F,$02,Show
	db SILPH_CO_4F,$03,Show
	db SILPH_CO_4F,$04,Show
	db SILPH_CO_4F,$05,Show
	db SILPH_CO_4F,$06,Show
	db SILPH_CO_4F,$07,Show
MapHSD2: ; ccaf (3:4caf)
	db SILPH_CO_5F,$02,Show
	db SILPH_CO_5F,$03,Show
	db SILPH_CO_5F,$04,Show
	db SILPH_CO_5F,$05,Show
	db SILPH_CO_5F,$06,Show
	db SILPH_CO_5F,$07,Show
	db SILPH_CO_5F,$08,Show
MapHSD3: ; ccc4 (3:4cc4)
	db SILPH_CO_6F,$06,Show
	db SILPH_CO_6F,$07,Show
	db SILPH_CO_6F,$08,Show
	db SILPH_CO_6F,$09,Show
	db SILPH_CO_6F,$0A,Show
MapHSD4: ; ccd3 (3:4cd3)
	db SILPH_CO_7F,$05,Show
	db SILPH_CO_7F,$06,Show
	db SILPH_CO_7F,$07,Show
	db SILPH_CO_7F,$08,Show
	db SILPH_CO_7F,$09,Show
	db SILPH_CO_7F,$0A,Show
	db SILPH_CO_7F,$0B,Show
	db SILPH_CO_7F,$0C,Show
MapHSD5: ; cceb (3:4ceb)
	db SILPH_CO_8F,$02,Show
	db SILPH_CO_8F,$03,Show
	db SILPH_CO_8F,$04,Show
MapHSE9: ; ccf4 (3:4cf4)
	db SILPH_CO_9F,$02,Show
	db SILPH_CO_9F,$03,Show
	db SILPH_CO_9F,$04,Show
MapHSEA: ; ccfd (3:4cfd)
	db SILPH_CO_10F,$01,Show
	db SILPH_CO_10F,$02,Show
	db SILPH_CO_10F,$03,Show
	db SILPH_CO_10F,$04,Show
	db SILPH_CO_10F,$05,Show
	db SILPH_CO_10F,$06,Show
MapHSEB: ; cd0f (3:4d0f)
	db SILPH_CO_11F,$03,Show
	db SILPH_CO_11F,$04,Show
	db SILPH_CO_11F,$05,Show
MapHSF4: ; cd18 (3:4d18)
	db $F4,$02,Show
MapHSD6: ; cd1b (3:4d1b)
	db MANSION_2,$02,Show
MapHSD7: ; cd1e (3:4d1e)
	db MANSION_3,$03,Show
	db MANSION_3,$04,Show
MapHSD8: ; cd24 (3:4d24)
	db MANSION_4,$03,Show
	db MANSION_4,$04,Show
	db MANSION_4,$05,Show
	db MANSION_4,$06,Show
	db MANSION_4,$08,Show
MapHSD9: ; cd33 (3:4d33)
	db SAFARI_ZONE_EAST,$01,Show
	db SAFARI_ZONE_EAST,$02,Show
	db SAFARI_ZONE_EAST,$03,Show
	db SAFARI_ZONE_EAST,$04,Show
MapHSDA: ; cd3f (3:4d3f)
	db SAFARI_ZONE_NORTH,$01,Show
	db SAFARI_ZONE_NORTH,$02,Show
MapHSDB: ; cd45 (3:4d45)
	db SAFARI_ZONE_WEST,$01,Show
	db SAFARI_ZONE_WEST,$02,Show
	db SAFARI_ZONE_WEST,$03,Show
	db SAFARI_ZONE_WEST,$04,Show
MapHSDC: ; cd51 (3:4d51)
	db SAFARI_ZONE_CENTER,$01,Show
MapHSE2: ; cd54 (3:4d54)
	db UNKNOWN_DUNGEON_2,$01,Show
	db UNKNOWN_DUNGEON_2,$02,Show
	db UNKNOWN_DUNGEON_2,$03,Show
MapHSE3: ; cd5d (3:4d5d)
	db UNKNOWN_DUNGEON_3,$01,Show
	db UNKNOWN_DUNGEON_3,$02,Show
	db UNKNOWN_DUNGEON_3,$03,Show
MapHS6C: ; cd66 (3:4d66)
	db VICTORY_ROAD_1,$03,Show
	db VICTORY_ROAD_1,$04,Show
MapHS78: ; cd6c (3:4d6c)
	db CHAMPIONS_ROOM,$02,Hide
MapHSC0: ; cd6f (3:4d6f)
	db SEAFOAM_ISLANDS_1,$01,Show
	db SEAFOAM_ISLANDS_1,$02,Show
MapHS9F: ; cd75 (3:4d75)
	db SEAFOAM_ISLANDS_2,$01,Hide
	db SEAFOAM_ISLANDS_2,$02,Hide
MapHSA0: ; cd7b (3:4d7b)
	db SEAFOAM_ISLANDS_3,$01,Hide
	db SEAFOAM_ISLANDS_3,$02,Hide
MapHSA1: ; cd81 (3:4d81)
	db SEAFOAM_ISLANDS_4,$02,Show
	db SEAFOAM_ISLANDS_4,$03,Show
	db SEAFOAM_ISLANDS_4,$05,Hide
	db SEAFOAM_ISLANDS_4,$06,Hide
MapHSA2: ; cd8d (3:4d8d)
	db SEAFOAM_ISLANDS_5,$01,Hide
	db SEAFOAM_ISLANDS_5,$02,Hide
	db SEAFOAM_ISLANDS_5,$03,Show

	db $FF,$01,Show

; known jump sources: 1320a (4:720a)
Func_cd99: ; cd99 (3:4d99)
	ld hl, $d728
	set 0, [hl]
	ld hl, Unknown_cdaa ; $4daa
	call PrintText
	ld hl, UnnamedText_cdbb ; $4dbb
	jp PrintText

Unknown_cdaa: ; cdaa (3:4daa)
INCBIN "baserom.gbc",$cdaa,$cdaf - $cdaa
	ld a, [$cf91]
	call PlayCry
	call Delay3
	jp TextScriptEnd
; cdbb (3:4dbb)
UnnamedText_cdbb: ; cdbb (3:4dbb)
	TX_FAR _UnnamedText_cdbb
	db $50
; 0xcdbb + 5 bytes

; known jump sources: 131de (4:71de)
Func_cdc0: ; cdc0 (3:4dc0)
	ld hl, $d728
	set 1, [hl]
	ld a, [$d732]
	bit 5, a
	jr nz, .asm_cdec
	ld a, [W_CURMAP] ; $d35e
	cp $a2
	ret nz
	ld a, [$d881]
	and $3
	cp $3
	ret z
	ld hl, Unknown_cdf7 ; $4df7
	call ArePlayerCoordsInArray
	ret nc
	ld hl, $d728
	res 1, [hl]
	ld hl, UnnamedText_cdfa ; $4dfa
	jp PrintText
.asm_cdec
	ld hl, $d728
	res 1, [hl]
	ld hl, UnnamedText_cdff ; $4dff
	jp PrintText

Unknown_cdf7: ; cdf7 (3:4df7)
INCBIN "baserom.gbc",$cdf7,$cdfa - $cdf7

UnnamedText_cdfa: ; cdfa (3:4dfa)
	TX_FAR _UnnamedText_cdfa
	db $50
; 0xcdfa + 5 bytes

UnnamedText_cdff: ; cdff (3:4dff)
	TX_FAR _UnnamedText_cdff
	db $50
; 0xcdff + 5 bytes


; function to add an item (in varying quantities) to the player's bag or PC box
; INPUT:
; hl = address of inventory (either W_NUMBAGITEMS or W_NUMBOXITEMS)
; [$CF91] = item ID
; [$CF96] = item quantity
; sets carry flag if successful, unsets carry flag if unsuccessful
AddItemToInventory_: ; ce04 (3:4e04)
	ld a,[$cf96] ; a = item quantity
	push af
	push bc
	push de
	push hl
	push hl
	ld d,50 ; PC box can hold 50 items
	ld a,W_NUMBAGITEMS & $FF
	cp l
	jr nz,.checkIfInventoryFull
	ld a,W_NUMBAGITEMS >> 8
	cp h
	jr nz,.checkIfInventoryFull
; if the destination is the bag
	ld d,20 ; bag can hold 20 items
.checkIfInventoryFull
	ld a,[hl]
	sub d
	ld d,a
	ld a,[hli]
	and a
	jr z,.addNewItem
.loop
	ld a,[hli]
	ld b,a ; b = ID of current item in table
	ld a,[$cf91] ; a = ID of item being added
	cp b ; does the current item in the table match the item being added?
	jp z,.increaseItemQuantity ; if so, increase the item's quantity
	inc hl
	ld a,[hl]
	cp a,$ff ; is it the end of the table?
	jr nz,.loop
.addNewItem ; add an item not yet in the inventory
	pop hl
	ld a,d
	and a ; is there room for a new item slot?
	jr z,.done
; if there is room
	inc [hl] ; increment the number of items in the inventory
	ld a,[hl] ; the number of items will be the index of the new item
	add a
	dec a
	ld c,a
	ld b,0
	add hl,bc ; hl = address to store the item
	ld a,[$cf91]
	ld [hli],a ; store item ID
	ld a,[$cf96]
	ld [hli],a ; store item quantity
	ld [hl],$ff ; store terminator
	jp .success
.increaseItemQuantity ; increase the quantity of an item already in the inventory
	ld a,[$cf96]
	ld b,a ; b = quantity to add
	ld a,[hl] ; a = existing item quantity
	add b ; a = new item quantity
	cp a,100
	jp c,.storeNewQuantity ; if the new quantity is less than 100, store it
; if the new quantity is greater than or equal to 100,
; try to max out the current slot and add the rest in a new slot
	sub a,99
	ld [$cf96],a ; a = amount left over (to put in the new slot)
	ld a,d
	and a ; is there room for a new item slot?
	jr z,.increaseItemQuantityFailed
; if so, store 99 in the current slot and store the rest in a new slot
	ld a,99
	ld [hli],a
	jp .loop
.increaseItemQuantityFailed
	pop hl
	and a
	jr .done
.storeNewQuantity
	ld [hl],a
	pop hl
.success
	scf
.done
	pop hl
	pop de
	pop bc
	pop bc
	ld a,b
	ld [$cf96],a ; restore the initial value from when the function was called
	ret

; function to remove an item (in varying quantities) from the player's bag or PC box
; INPUT:
; hl = address of inventory (either W_NUMBAGITEMS or W_NUMBOXITEMS)
; [$CF92] = index (within the inventory) of the item to remove
; [$CF96] = quantity to remove
RemoveItemFromInventory_: ; ce74 (3:4e74)
	push hl
	inc hl
	ld a,[$cf92] ; index (within the inventory) of the item being removed
	sla a
	add l
	ld l,a
	jr nc,.noCarry
	inc h
.noCarry
	inc hl
	ld a,[$cf96] ; quantity being removed
	ld e,a
	ld a,[hl] ; a = current quantity
	sub e
	ld [hld],a ; store new quantity
	ld [$cf97],a
	and a
	jr nz,.skipMovingUpSlots
; if the remaining quantity is 0,
; remove the emptied item slot and move up all the following item slots
.moveSlotsUp
	ld e,l
	ld d,h
	inc de
	inc de ; de = address of the slot following the emptied one
.loop ; loop to move up the following slots
	ld a,[de]
	inc de
	ld [hli],a
	cp a,$ff
	jr nz,.loop
; update menu info
	xor a
	ld [W_LISTSCROLLOFFSET],a
	ld [W_CURMENUITEMID],a
	ld [$cc2c],a
	ld [$d07e],a
	pop hl
	ld a,[hl] ; a = number of items in inventory
	dec a ; decrement the number of items
	ld [hl],a ; store new number of items
	ld [$d12a],a
	cp a,2
	jr c,.done
	ld [W_MAXMENUITEMID],a
	jr .done
.skipMovingUpSlots
	pop hl
.done
	ret

; wild pokemon data: from 4EB8 to 55C7

LoadWildData: ; ceb8 (3:4eb8)
	ld hl,WildDataPointers
	ld a,[W_CURMAP]

	; get wild data for current map
	ld c,a
	ld b,0
	add hl,bc
	add hl,bc
	ld a,[hli]
	ld h,[hl]
	ld l,a       ; hl now points to wild data for current map
	ld a,[hli]
	ld [W_GRASSRATE],a
	and a
	jr z,.NoGrassData ; if no grass data, skip to surfing data
	push hl
	ld de,W_GRASSMONS ; otherwise, load grass data
	ld bc,$0014
	call CopyData
	pop hl
	ld bc,$0014
	add hl,bc
.NoGrassData
	ld a,[hli]
	ld [W_WATERRATE],a
	and a
	ret z        ; if no water data, we're done
	ld de,W_WATERMONS  ; otherwise, load surfing data
	ld bc,$0014
	jp CopyData

WildDataPointers: ; ceeb (3:4eeb)
	dw NoMons      ; PALLET_TOWN
	dw NoMons      ; VIRIDIAN_CITY
	dw NoMons      ; PEWTER_CITY
	dw NoMons      ; CERULEAN_CITY
	dw NoMons      ; LAVENDER_TOWN
	dw NoMons      ; VERMILION_CITY
	dw NoMons      ; CELADON_CITY
	dw NoMons      ; FUCHSIA_CITY
	dw NoMons      ; CINNABAR_ISLAND
	dw NoMons      ; INDIGO_PLATEAU
	dw NoMons      ; SAFFRON_CITY
	dw NoMons      ; unused
	dw Route1Mons  ; ROUTE_1
	dw Route2Mons  ; ROUTE_2
	dw Route3Mons  ; ROUTE_3
	dw Route4Mons  ; ROUTE_4
	dw Route5Mons  ; ROUTE_5
	dw Route6Mons  ; ROUTE_6
	dw Route7Mons  ; ROUTE_7
	dw Route8Mons  ; ROUTE_8
	dw Route9Mons  ; ROUTE_9
	dw Route10Mons ; ROUTE_10
	dw Route11Mons ; ROUTE_11
	dw Route12Mons ; ROUTE_12
	dw Route13Mons ; ROUTE_13
	dw Route14Mons ; ROUTE_14
	dw Route15Mons ; ROUTE_15
	dw Route16Mons ; ROUTE_16
	dw Route17Mons ; ROUTE_17
	dw Route18Mons ; ROUTE_18
	dw WaterMons   ; ROUTE_19
	dw WaterMons   ; ROUTE_20
	dw Route21Mons ; ROUTE_21
	dw Route22Mons ; ROUTE_22
	dw Route23Mons ; ROUTE_23
	dw Route24Mons ; ROUTE_24
	dw Route25Mons ; ROUTE_25
	dw NoMons      ; REDS_HOUSE_1F
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw ForestMons ; ViridianForest
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw MoonMons1
	dw MoonMonsB1
	dw MoonMonsB2
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw TunnelMonsB1
	dw PowerPlantMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw PlateauMons1
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw TowerMons1
	dw TowerMons2
	dw TowerMons3
	dw TowerMons4
	dw TowerMons5
	dw TowerMons6
	dw TowerMons7
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw IslandMonsB1
	dw IslandMonsB2
	dw IslandMonsB3
	dw IslandMonsB4
	dw NoMons
	dw NoMons
	dw MansionMons1
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw IslandMons1
	dw NoMons
	dw PlateauMons2
	dw NoMons
	dw NoMons
	dw CaveMons
	dw PlateauMons3
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw MansionMons2
	dw MansionMons3
	dw MansionMonsB1
	dw ZoneMons1
	dw ZoneMons2
	dw ZoneMons3
	dw ZoneMonsCenter
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw DungeonMons2
	dw DungeonMonsB1
	dw DungeonMons1
	dw NoMons
	dw NoMons
	dw NoMons
	dw TunnelMonsB2
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw NoMons
	dw $FFFF

; wild pokemon data is divided into two parts.
; first part:  pokemon found in grass
; second part: pokemon found while surfing
; each part goes as follows:
	; if first byte == 00, then
		; no wild pokemon on this map
	; if first byte != 00, then
		; first byte is encounter rate
		; followed by 20 bytes:
		; level, species (ten times)

IF _RED
NoMons: ; d0dd (3:50dd)
	db $00

	db $00

Route1Mons: ; d0df (3:50df)
	db $19
	db 3,PIDGEY
	db 3,RATTATA
	db 3,RATTATA
	db 2,RATTATA
	db 2,PIDGEY
	db 3,PIDGEY
	db 3,PIDGEY
	db 4,RATTATA
	db 4,PIDGEY
	db 5,PIDGEY

	db $00

Route2Mons: ; d0f5 (3:50f5)
	db $19
	db 3,RATTATA
	db 3,PIDGEY
	db 4,PIDGEY
	db 4,RATTATA
	db 5,PIDGEY
	db 3,WEEDLE
	db 2,RATTATA
	db 5,RATTATA
	db 4,WEEDLE
	db 5,WEEDLE

	db $00

Route22Mons: ; d10b (3:510b)
	db $19
	db 3,RATTATA
	db 3,NIDORAN_M
	db 4,RATTATA
	db 4,NIDORAN_M
	db 2,RATTATA
	db 2,NIDORAN_M
	db 3,SPEAROW
	db 5,SPEAROW
	db 3,NIDORAN_F
	db 4,NIDORAN_F

	db $00

ForestMons: ; d121 (3:5121)
	db $08
	db 4,WEEDLE
	db 5,KAKUNA
	db 3,WEEDLE
	db 5,WEEDLE
	db 4,KAKUNA
	db 6,KAKUNA
	db 4,METAPOD
	db 3,CATERPIE
	db 3,PIKACHU
	db 5,PIKACHU

	db $00

Route3Mons: ; d137 (3:5137)
	db $14
	db 6,PIDGEY
	db 5,SPEAROW
	db 7,PIDGEY
	db 6,SPEAROW
	db 7,SPEAROW
	db 8,PIDGEY
	db 8,SPEAROW
	db 3,JIGGLYPUFF
	db 5,JIGGLYPUFF
	db 7,JIGGLYPUFF

	db $00

MoonMons1: ; d14d (3:514d)
	db $0A
	db 8,ZUBAT
	db 7,ZUBAT
	db 9,ZUBAT
	db 8,GEODUDE
	db 6,ZUBAT
	db 10,ZUBAT
	db 10,GEODUDE
	db 8,PARAS
	db 11,ZUBAT
	db 8,CLEFAIRY

	db $00

MoonMonsB1: ; d163 (3:5163)
	db $0A
	db 8,ZUBAT
	db 7,ZUBAT
	db 7,GEODUDE
	db 8,GEODUDE
	db 9,ZUBAT
	db 10,PARAS
	db 10,ZUBAT
	db 11,ZUBAT
	db 9,CLEFAIRY
	db 9,GEODUDE

	db $00

MoonMonsB2: ; d179 (3:5179)
	db $0A
	db 9,ZUBAT
	db 9,GEODUDE
	db 10,ZUBAT
	db 10,GEODUDE
	db 11,ZUBAT
	db 10,PARAS
	db 12,PARAS
	db 10,CLEFAIRY
	db 12,ZUBAT
	db 12,CLEFAIRY

	db $00

Route4Mons: ; d18f (3:518f)
	db $14
	db 10,RATTATA
	db 10,SPEAROW
	db 8,RATTATA
	db 6,EKANS
	db 8,SPEAROW
	db 10,EKANS
	db 12,RATTATA
	db 12,SPEAROW
	db 8,EKANS
	db 12,EKANS

	db $00

Route24Mons: ; d1a5 (3:51a5)
	db $19
	db 7,WEEDLE
	db 8,KAKUNA
	db 12,PIDGEY
	db 12,ODDISH
	db 13,ODDISH
	db 10,ABRA
	db 14,ODDISH
	db 13,PIDGEY
	db 8,ABRA
	db 12,ABRA

	db $00

Route25Mons: ; d1bb (3:51bb)
	db $0F
	db 8,WEEDLE
	db 9,KAKUNA
	db 13,PIDGEY
	db 12,ODDISH
	db 13,ODDISH
	db 12,ABRA
	db 14,ODDISH
	db 10,ABRA
	db 7,METAPOD
	db 8,CATERPIE

	db $00

Route9Mons: ; d1d1 (3:51d1)
	db $0F
	db 16,RATTATA
	db 16,SPEAROW
	db 14,RATTATA
	db 11,EKANS
	db 13,SPEAROW
	db 15,EKANS
	db 17,RATTATA
	db 17,SPEAROW
	db 13,EKANS
	db 17,EKANS

	db $00

Route5Mons: ; d1e7 (3:51e7)
	db $0F
	db 13,ODDISH
	db 13,PIDGEY
	db 15,PIDGEY
	db 10,MANKEY
	db 12,MANKEY
	db 15,ODDISH
	db 16,ODDISH
	db 16,PIDGEY
	db 14,MANKEY
	db 16,MANKEY

	db $00

Route6Mons: ; d1fd (3:51fd)
	db $0F
	db 13,ODDISH
	db 13,PIDGEY
	db 15,PIDGEY
	db 10,MANKEY
	db 12,MANKEY
	db 15,ODDISH
	db 16,ODDISH
	db 16,PIDGEY
	db 14,MANKEY
	db 16,MANKEY

	db $00

Route11Mons: ; d213 (3:5213)
	db $0F
	db 14,EKANS
	db 15,SPEAROW
	db 12,EKANS
	db 9,DROWZEE
	db 13,SPEAROW
	db 13,DROWZEE
	db 15,EKANS
	db 17,SPEAROW
	db 11,DROWZEE
	db 15,DROWZEE

	db $00

TunnelMonsB1: ; d229 (3:5229)
	db $0F
	db 16,ZUBAT
	db 17,ZUBAT
	db 17,GEODUDE
	db 15,MACHOP
	db 16,GEODUDE
	db 18,ZUBAT
	db 15,ZUBAT
	db 17,MACHOP
	db 13,ONIX
	db 15,ONIX

	db $00

TunnelMonsB2: ; d23f (3:523f)
	db $0F
	db 16,ZUBAT
	db 17,ZUBAT
	db 17,GEODUDE
	db 15,MACHOP
	db 16,GEODUDE
	db 18,ZUBAT
	db 17,MACHOP
	db 17,ONIX
	db 13,ONIX
	db 18,GEODUDE

	db $00

Route10Mons: ; d255 (3:5255)
	db $0F
	db 16,VOLTORB
	db 16,SPEAROW
	db 14,VOLTORB
	db 11,EKANS
	db 13,SPEAROW
	db 15,EKANS
	db 17,VOLTORB
	db 17,SPEAROW
	db 13,EKANS
	db 17,EKANS

	db $00

Route12Mons: ; d26b (3:526b)
	db $0F
	db 24,ODDISH
	db 25,PIDGEY
	db 23,PIDGEY
	db 24,VENONAT
	db 22,ODDISH
	db 26,VENONAT
	db 26,ODDISH
	db 27,PIDGEY
	db 28,GLOOM
	db 30,GLOOM

	db $00

Route8Mons: ; d281 (3:5281)
	db $0F
	db 18,PIDGEY
	db 18,MANKEY
	db 17,EKANS
	db 16,GROWLITHE
	db 20,PIDGEY
	db 20,MANKEY
	db 19,EKANS
	db 17,GROWLITHE
	db 15,GROWLITHE
	db 18,GROWLITHE

	db $00

Route7Mons: ; d297 (3:5297)
	db $0F
	db 19,PIDGEY
	db 19,ODDISH
	db 17,MANKEY
	db 22,ODDISH
	db 22,PIDGEY
	db 18,MANKEY
	db 18,GROWLITHE
	db 20,GROWLITHE
	db 19,MANKEY
	db 20,MANKEY

	db $00

TowerMons1: ; d2ad (3:52ad)
	db $00

	db $00

TowerMons2: ; d2af (3:52af)
	db $00

	db $00

TowerMons3: ; d2b1 (3:52b1)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 24,GASTLY
	db 20,CUBONE
	db 22,CUBONE
	db 25,HAUNTER

	db $00

TowerMons4: ; d2c7 (3:52c7)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 25,HAUNTER
	db 20,CUBONE
	db 22,CUBONE
	db 24,GASTLY

	db $00

TowerMons5: ; d2dd (3:52dd)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 25,HAUNTER
	db 20,CUBONE
	db 22,CUBONE
	db 24,GASTLY

	db $00

TowerMons6: ; d2f3 (3:52f3)
	db $0F
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 24,GASTLY
	db 20,GASTLY
	db 19,GASTLY
	db 26,HAUNTER
	db 22,CUBONE
	db 24,CUBONE
	db 28,HAUNTER

	db $00

TowerMons7: ; d309 (3:5309)
	db $0F
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 24,GASTLY
	db 20,GASTLY
	db 28,HAUNTER
	db 22,CUBONE
	db 24,CUBONE
	db 28,HAUNTER
	db 30,HAUNTER

	db $00

Route13Mons: ; d31f (3:531f)
	db $14
	db 24,ODDISH
	db 25,PIDGEY
	db 27,PIDGEY
	db 24,VENONAT
	db 22,ODDISH
	db 26,VENONAT
	db 26,ODDISH
	db 25,DITTO
	db 28,GLOOM
	db 30,GLOOM

	db $00

Route14Mons: ; d335 (3:5335)
	db $0F
	db 24,ODDISH
	db 26,PIDGEY
	db 23,DITTO
	db 24,VENONAT
	db 22,ODDISH
	db 26,VENONAT
	db 26,ODDISH
	db 30,GLOOM
	db 28,PIDGEOTTO
	db 30,PIDGEOTTO

	db $00

Route15Mons: ; d34b (3:534b)
	db $0F
	db 24,ODDISH
	db 26,DITTO
	db 23,PIDGEY
	db 26,VENONAT
	db 22,ODDISH
	db 28,VENONAT
	db 26,ODDISH
	db 30,GLOOM
	db 28,PIDGEOTTO
	db 30,PIDGEOTTO

	db $00

Route16Mons: ; d361 (3:5361)
	db $19
	db 20,SPEAROW
	db 22,SPEAROW
	db 18,RATTATA
	db 20,DODUO
	db 20,RATTATA
	db 18,DODUO
	db 22,DODUO
	db 22,RATTATA
	db 23,RATICATE
	db 25,RATICATE

	db $00

Route17Mons: ; d377 (3:5377)
	db $19
	db 20,SPEAROW
	db 22,SPEAROW
	db 25,RATICATE
	db 24,DODUO
	db 27,RATICATE
	db 26,DODUO
	db 28,DODUO
	db 29,RATICATE
	db 25,FEAROW
	db 27,FEAROW

	db $00

Route18Mons: ; d38d (3:538d)
	db $19
	db 20,SPEAROW
	db 22,SPEAROW
	db 25,RATICATE
	db 24,DODUO
	db 25,FEAROW
	db 26,DODUO
	db 28,DODUO
	db 29,RATICATE
	db 27,FEAROW
	db 29,FEAROW

	db $00

ZoneMonsCenter: ; d3a3 (3:53a3)
	db $1E
	db 22,NIDORAN_M
	db 25,RHYHORN
	db 22,VENONAT
	db 24,EXEGGCUTE
	db 31,NIDORINO
	db 25,EXEGGCUTE
	db 31,NIDORINA
	db 30,PARASECT
	db 23,SCYTHER
	db 23,CHANSEY

	db $00

ZoneMons1: ; d3b9 (3:53b9)
	db $1E
	db 24,NIDORAN_M
	db 26,DODUO
	db 22,PARAS
	db 25,EXEGGCUTE
	db 33,NIDORINO
	db 23,EXEGGCUTE
	db 24,NIDORAN_F
	db 25,PARASECT
	db 25,KANGASKHAN
	db 28,SCYTHER

	db $00

ZoneMons2: ; d3cf (3:53cf)
	db $1E
	db 22,NIDORAN_M
	db 26,RHYHORN
	db 23,PARAS
	db 25,EXEGGCUTE
	db 30,NIDORINO
	db 27,EXEGGCUTE
	db 30,NIDORINA
	db 32,VENOMOTH
	db 26,CHANSEY
	db 28,TAUROS

	db $00

ZoneMons3: ; d3e5 (3:53e5)
	db $1E
	db 25,NIDORAN_M
	db 26,DODUO
	db 23,VENONAT
	db 24,EXEGGCUTE
	db 33,NIDORINO
	db 26,EXEGGCUTE
	db 25,NIDORAN_F
	db 31,VENOMOTH
	db 26,TAUROS
	db 28,KANGASKHAN

	db $00

WaterMons: ; d3fb (3:53fb)
	db $00

	db $05
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 20,TENTACOOL
	db 30,TENTACOOL
	db 35,TENTACOOL
	db 40,TENTACOOL

IslandMons1: ; d411 (3:5411)
	db $0F
	db 30,SEEL
	db 30,SLOWPOKE
	db 30,SHELLDER
	db 30,HORSEA
	db 28,HORSEA
	db 21,ZUBAT
	db 29,GOLBAT
	db 28,PSYDUCK
	db 28,SHELLDER
	db 38,GOLDUCK

	db $00

IslandMonsB1: ; d427 (3:5427)
	db $0A
	db 30,STARYU
	db 30,HORSEA
	db 32,SHELLDER
	db 32,HORSEA
	db 28,SLOWPOKE
	db 30,SEEL
	db 30,SLOWPOKE
	db 28,SEEL
	db 38,DEWGONG
	db 37,SEADRA

	db $00

IslandMonsB2: ; d43d (3:543d)
	db $0A
	db 30,SEEL
	db 30,SLOWPOKE
	db 32,SEEL
	db 32,SLOWPOKE
	db 28,HORSEA
	db 30,STARYU
	db 30,HORSEA
	db 28,SHELLDER
	db 30,GOLBAT
	db 37,SLOWBRO

	db $00

IslandMonsB3: ; d453 (3:5453)
	db $0A
	db 31,SLOWPOKE
	db 31,SEEL
	db 33,SLOWPOKE
	db 33,SEEL
	db 29,HORSEA
	db 31,SHELLDER
	db 31,HORSEA
	db 29,SHELLDER
	db 39,SEADRA
	db 37,DEWGONG

	db $00

IslandMonsB4: ; d469 (3:5469)
	db $0A
	db 31,HORSEA
	db 31,SHELLDER
	db 33,HORSEA
	db 33,SHELLDER
	db 29,SLOWPOKE
	db 31,SEEL
	db 31,SLOWPOKE
	db 29,SEEL
	db 39,SLOWBRO
	db 32,GOLBAT

	db $00

MansionMons1: ; d47f (3:547f)
	db $0A
	db 32,KOFFING
	db 30,KOFFING
	db 34,PONYTA
	db 30,PONYTA
	db 34,GROWLITHE
	db 32,PONYTA
	db 30,GRIMER
	db 28,PONYTA
	db 37,WEEZING
	db 39,MUK

	db $00

MansionMons2: ; d495 (3:5495)
	db $0A
	db 32,GROWLITHE
	db 34,KOFFING
	db 34,KOFFING
	db 30,PONYTA
	db 30,KOFFING
	db 32,PONYTA
	db 30,GRIMER
	db 28,PONYTA
	db 39,WEEZING
	db 37,MUK

	db $00

MansionMons3: ; d4ab (3:54ab)
	db $0A
	db 31,KOFFING
	db 33,GROWLITHE
	db 35,KOFFING
	db 32,PONYTA
	db 34,PONYTA
	db 40,WEEZING
	db 34,GRIMER
	db 38,WEEZING
	db 36,PONYTA
	db 42,MUK

	db $00

MansionMonsB1: ; d4c1 (3:54c1)
	db $0A
	db 33,KOFFING
	db 31,KOFFING
	db 35,GROWLITHE
	db 32,PONYTA
	db 31,KOFFING
	db 40,WEEZING
	db 34,PONYTA
	db 35,GRIMER
	db 42,WEEZING
	db 42,MUK

	db $00

Route21Mons: ; d4d7 (3:54d7)
	db $19
	db 21,RATTATA
	db 23,PIDGEY
	db 30,RATICATE
	db 23,RATTATA
	db 21,PIDGEY
	db 30,PIDGEOTTO
	db 32,PIDGEOTTO
	db 28,TANGELA
	db 30,TANGELA
	db 32,TANGELA

	db $05
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 20,TENTACOOL
	db 30,TENTACOOL
	db 35,TENTACOOL
	db 40,TENTACOOL

DungeonMons1: ; d501 (3:5501)
	db $0A
	db 46,GOLBAT
	db 46,HYPNO
	db 46,MAGNETON
	db 49,DODRIO
	db 49,VENOMOTH
	db 52,ARBOK
	db 49,KADABRA
	db 52,PARASECT
	db 53,RAICHU
	db 53,DITTO

	db $00

DungeonMons2: ; d517 (3:5517)
	db $0F
	db 51,DODRIO
	db 51,VENOMOTH
	db 51,KADABRA
	db 52,RHYDON
	db 52,MAROWAK
	db 52,ELECTRODE
	db 56,CHANSEY
	db 54,WIGGLYTUFF
	db 55,DITTO
	db 60,DITTO

	db $00

DungeonMonsB1: ; d52d (3:552d)
	db $19
	db 55,RHYDON
	db 55,MAROWAK
	db 55,ELECTRODE
	db 64,CHANSEY
	db 64,PARASECT
	db 64,RAICHU
	db 57,ARBOK
	db 65,DITTO
	db 63,DITTO
	db 67,DITTO

	db $00

PowerPlantMons: ; d543 (3:5543)
	db $0A
	db 21,VOLTORB
	db 21,MAGNEMITE
	db 20,PIKACHU
	db 24,PIKACHU
	db 23,MAGNEMITE
	db 23,VOLTORB
	db 32,MAGNETON
	db 35,MAGNETON
	db 33,ELECTABUZZ
	db 36,ELECTABUZZ

	db $00

Route23Mons: ; d559 (3:5559)
	db $0A
	db 26,EKANS
	db 33,DITTO
	db 26,SPEAROW
	db 38,FEAROW
	db 38,DITTO
	db 38,FEAROW
	db 41,ARBOK
	db 43,DITTO
	db 41,FEAROW
	db 43,FEAROW

	db $00

PlateauMons2: ; d56f (3:556f)
	db $0A
	db 22,MACHOP
	db 24,GEODUDE
	db 26,ZUBAT
	db 36,ONIX
	db 39,ONIX
	db 42,ONIX
	db 41,MACHOKE
	db 40,GOLBAT
	db 40,MAROWAK
	db 43,GRAVELER

	db $00

PlateauMons3: ; d585 (3:5585)
	db $0F
	db 24,MACHOP
	db 26,GEODUDE
	db 22,ZUBAT
	db 42,ONIX
	db 40,VENOMOTH
	db 45,ONIX
	db 43,GRAVELER
	db 41,GOLBAT
	db 42,MACHOKE
	db 45,MACHOKE

	db $00

PlateauMons1: ; d59b (3:559b)
	db $0F
	db 24,MACHOP
	db 26,GEODUDE
	db 22,ZUBAT
	db 36,ONIX
	db 39,ONIX
	db 42,ONIX
	db 41,GRAVELER
	db 41,GOLBAT
	db 42,MACHOKE
	db 43,MAROWAK

	db $00

CaveMons: ; d5b1 (3:55b1)
	db $14
	db 18,DIGLETT
	db 19,DIGLETT
	db 17,DIGLETT
	db 20,DIGLETT
	db 16,DIGLETT
	db 15,DIGLETT
	db 21,DIGLETT
	db 22,DIGLETT
	db 29,DUGTRIO
	db 31,DUGTRIO

	db $00

ENDC
IF _GREEN || !_JAPAN && _BLUE
NoMons: ; d0dd (3:50dd)
	db $00

	db $00

Route1Mons: ; d0df (3:50df)
	db $19
	db 3,PIDGEY
	db 3,RATTATA
	db 3,RATTATA
	db 2,RATTATA
	db 2,PIDGEY
	db 3,PIDGEY
	db 3,PIDGEY
	db 4,RATTATA
	db 4,PIDGEY
	db 5,PIDGEY

	db $00

Route2Mons: ; d0f5 (3:50f5)
	db $19
	db 3,RATTATA
	db 3,PIDGEY
	db 4,PIDGEY
	db 4,RATTATA
	db 5,PIDGEY
	db 3,CATERPIE
	db 2,RATTATA
	db 5,RATTATA
	db 4,CATERPIE
	db 5,CATERPIE

	db $00

Route22Mons: ; d10b (3:510b)
	db $19
	db 3,RATTATA
	db 3,NIDORAN_F
	db 4,RATTATA
	db 4,NIDORAN_F
	db 2,RATTATA
	db 2,NIDORAN_F
	db 3,SPEAROW
	db 5,SPEAROW
	db 3,NIDORAN_M
	db 4,NIDORAN_M

	db $00

ForestMons: ; d121 (3:5121)
	db $08
	db 4,CATERPIE
	db 5,METAPOD
	db 3,CATERPIE
	db 5,CATERPIE
	db 4,METAPOD
	db 6,METAPOD
	db 4,KAKUNA
	db 3,WEEDLE
	db 3,PIKACHU
	db 5,PIKACHU

	db $00

Route3Mons: ; d137 (3:5137)
	db $14
	db 6,PIDGEY
	db 5,SPEAROW
	db 7,PIDGEY
	db 6,SPEAROW
	db 7,SPEAROW
	db 8,PIDGEY
	db 8,SPEAROW
	db 3,JIGGLYPUFF
	db 5,JIGGLYPUFF
	db 7,JIGGLYPUFF

	db $00

MoonMons1: ; d14d (3:514d)
	db $0A
	db 8,ZUBAT
	db 7,ZUBAT
	db 9,ZUBAT
	db 8,GEODUDE
	db 6,ZUBAT
	db 10,ZUBAT
	db 10,GEODUDE
	db 8,PARAS
	db 11,ZUBAT
	db 8,CLEFAIRY

	db $00

MoonMonsB1: ; d163 (3:5163)
	db $0A
	db 8,ZUBAT
	db 7,ZUBAT
	db 7,GEODUDE
	db 8,GEODUDE
	db 9,ZUBAT
	db 10,PARAS
	db 10,ZUBAT
	db 11,ZUBAT
	db 9,CLEFAIRY
	db 9,GEODUDE

	db $00

MoonMonsB2: ; d179 (3:5179)
	db $0A
	db 9,ZUBAT
	db 9,GEODUDE
	db 10,ZUBAT
	db 10,GEODUDE
	db 11,ZUBAT
	db 10,PARAS
	db 12,PARAS
	db 10,CLEFAIRY
	db 12,ZUBAT
	db 12,CLEFAIRY

	db $00

Route4Mons: ; d18f (3:518f)
	db $14
	db 10,RATTATA
	db 10,SPEAROW
	db 8,RATTATA
	db 6,SANDSHREW
	db 8,SPEAROW
	db 10,SANDSHREW
	db 12,RATTATA
	db 12,SPEAROW
	db 8,SANDSHREW
	db 12,SANDSHREW

	db $00

Route24Mons: ; d1a5 (3:51a5)
	db $19
	db 7,CATERPIE
	db 8,METAPOD
	db 12,PIDGEY
	db 12,BELLSPROUT
	db 13,BELLSPROUT
	db 10,ABRA
	db 14,BELLSPROUT
	db 13,PIDGEY
	db 8,ABRA
	db 12,ABRA

	db $00

Route25Mons: ; d1bb (3:51bb)
	db $0F
	db 8,CATERPIE
	db 9,METAPOD
	db 13,PIDGEY
	db 12,BELLSPROUT
	db 13,BELLSPROUT
	db 12,ABRA
	db 14,BELLSPROUT
	db 10,ABRA
	db 7,KAKUNA
	db 8,WEEDLE

	db $00

Route9Mons: ; d1d1 (3:51d1)
	db $0F
	db 16,RATTATA
	db 16,SPEAROW
	db 14,RATTATA
	db 11,SANDSHREW
	db 13,SPEAROW
	db 15,SANDSHREW
	db 17,RATTATA
	db 17,SPEAROW
	db 13,SANDSHREW
	db 17,SANDSHREW

	db $00

Route5Mons: ; d1e7 (3:51e7)
	db $0F
	db 13,BELLSPROUT
	db 13,PIDGEY
	db 15,PIDGEY
	db 10,MEOWTH
	db 12,MEOWTH
	db 15,BELLSPROUT
	db 16,BELLSPROUT
	db 16,PIDGEY
	db 14,MEOWTH
	db 16,MEOWTH

	db $00

Route6Mons: ; d1fd (3:51fd)
	db $0F
	db 13,BELLSPROUT
	db 13,PIDGEY
	db 15,PIDGEY
	db 10,MEOWTH
	db 12,MEOWTH
	db 15,BELLSPROUT
	db 16,BELLSPROUT
	db 16,PIDGEY
	db 14,MEOWTH
	db 16,MEOWTH

	db $00

Route11Mons: ; d213 (3:5213)
	db $0F
	db 14,SANDSHREW
	db 15,SPEAROW
	db 12,SANDSHREW
	db 9,DROWZEE
	db 13,SPEAROW
	db 13,DROWZEE
	db 15,SANDSHREW
	db 17,SPEAROW
	db 11,DROWZEE
	db 15,DROWZEE

	db $00

TunnelMonsB1: ; d229 (3:5229)
	db $0F
	db 16,ZUBAT
	db 17,ZUBAT
	db 17,GEODUDE
	db 15,MACHOP
	db 16,GEODUDE
	db 18,ZUBAT
	db 15,ZUBAT
	db 17,MACHOP
	db 13,ONIX
	db 15,ONIX

	db $00

TunnelMonsB2: ; d23f (3:523f)
	db $0F
	db 16,ZUBAT
	db 17,ZUBAT
	db 17,GEODUDE
	db 15,MACHOP
	db 16,GEODUDE
	db 18,ZUBAT
	db 17,MACHOP
	db 17,ONIX
	db 13,ONIX
	db 18,GEODUDE

	db $00

Route10Mons: ; d255 (3:5255)
	db $0F
	db 16,VOLTORB
	db 16,SPEAROW
	db 14,VOLTORB
	db 11,SANDSHREW
	db 13,SPEAROW
	db 15,SANDSHREW
	db 17,VOLTORB
	db 17,SPEAROW
	db 13,SANDSHREW
	db 17,SANDSHREW

	db $00

Route12Mons: ; d26b (3:526b)
	db $0F
	db 24,BELLSPROUT
	db 25,PIDGEY
	db 23,PIDGEY
	db 24,VENONAT
	db 22,BELLSPROUT
	db 26,VENONAT
	db 26,BELLSPROUT
	db 27,PIDGEY
	db 28,WEEPINBELL
	db 30,WEEPINBELL

	db $00

Route8Mons: ; d281 (3:5281)
	db $0F
	db 18,PIDGEY
	db 18,MEOWTH
	db 17,SANDSHREW
	db 16,VULPIX
	db 20,PIDGEY
	db 20,MEOWTH
	db 19,SANDSHREW
	db 17,VULPIX
	db 15,VULPIX
	db 18,VULPIX

	db $00

Route7Mons: ; d297 (3:5297)
	db $0F
	db 19,PIDGEY
	db 19,BELLSPROUT
	db 17,MEOWTH
	db 22,BELLSPROUT
	db 22,PIDGEY
	db 18,MEOWTH
	db 18,VULPIX
	db 20,VULPIX
	db 19,MEOWTH
	db 20,MEOWTH

	db $00

TowerMons1: ; d2ad (3:52ad)
	db $00

	db $00

TowerMons2: ; d2af (3:52af)
	db $00

	db $00

TowerMons3: ; d2b1 (3:52b1)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 24,GASTLY
	db 20,CUBONE
	db 22,CUBONE
	db 25,HAUNTER

	db $00

TowerMons4: ; d2c7 (3:52c7)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 25,HAUNTER
	db 20,CUBONE
	db 22,CUBONE
	db 24,GASTLY

	db $00

TowerMons5: ; d2dd (3:52dd)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 25,HAUNTER
	db 20,CUBONE
	db 22,CUBONE
	db 24,GASTLY

	db $00

TowerMons6: ; d2f3 (3:52f3)
	db $0F
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 24,GASTLY
	db 20,GASTLY
	db 19,GASTLY
	db 26,HAUNTER
	db 22,CUBONE
	db 24,CUBONE
	db 28,HAUNTER

	db $00

TowerMons7: ; d309 (3:5309)
	db $0F
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 24,GASTLY
	db 20,GASTLY
	db 28,HAUNTER
	db 22,CUBONE
	db 24,CUBONE
	db 28,HAUNTER
	db 30,HAUNTER

	db $00

Route13Mons: ; d31f (3:531f)
	db $14
	db 24,BELLSPROUT
	db 25,PIDGEY
	db 27,PIDGEY
	db 24,VENONAT
	db 22,BELLSPROUT
	db 26,VENONAT
	db 26,BELLSPROUT
	db 25,DITTO
	db 28,WEEPINBELL
	db 30,WEEPINBELL

	db $00

Route14Mons: ; d335 (3:5335)
	db $0F
	db 24,BELLSPROUT
	db 26,PIDGEY
	db 23,DITTO
	db 24,VENONAT
	db 22,BELLSPROUT
	db 26,VENONAT
	db 26,BELLSPROUT
	db 30,WEEPINBELL
	db 28,PIDGEOTTO
	db 30,PIDGEOTTO

	db $00

Route15Mons: ; d34b (3:534b)
	db $0F
	db 24,BELLSPROUT
	db 26,DITTO
	db 23,PIDGEY
	db 26,VENONAT
	db 22,BELLSPROUT
	db 28,VENONAT
	db 26,BELLSPROUT
	db 30,WEEPINBELL
	db 28,PIDGEOTTO
	db 30,PIDGEOTTO

	db $00

Route16Mons: ; d361 (3:5361)
	db $19
	db 20,SPEAROW
	db 22,SPEAROW
	db 18,RATTATA
	db 20,DODUO
	db 20,RATTATA
	db 18,DODUO
	db 22,DODUO
	db 22,RATTATA
	db 23,RATICATE
	db 25,RATICATE

	db $00

Route17Mons: ; d377 (3:5377)
	db $19
	db 20,SPEAROW
	db 22,SPEAROW
	db 25,RATICATE
	db 24,DODUO
	db 27,RATICATE
	db 26,DODUO
	db 28,DODUO
	db 29,RATICATE
	db 25,FEAROW
	db 27,FEAROW

	db $00

Route18Mons: ; d38d (3:538d)
	db $19
	db 20,SPEAROW
	db 22,SPEAROW
	db 25,RATICATE
	db 24,DODUO
	db 25,FEAROW
	db 26,DODUO
	db 28,DODUO
	db 29,RATICATE
	db 27,FEAROW
	db 29,FEAROW

	db $00

ZoneMonsCenter: ; d3a3 (3:53a3)
	db $1E
	db 22,NIDORAN_F
	db 25,RHYHORN
	db 22,VENONAT
	db 24,EXEGGCUTE
	db 31,NIDORINA
	db 25,EXEGGCUTE
	db 31,NIDORINO
	db 30,PARASECT
	db 23,PINSIR
	db 23,CHANSEY

	db $00

ZoneMons1: ; d3b9 (3:53b9)
	db $1E
	db 24,NIDORAN_F
	db 26,DODUO
	db 22,PARAS
	db 25,EXEGGCUTE
	db 33,NIDORINA
	db 23,EXEGGCUTE
	db 24,NIDORAN_M
	db 25,PARASECT
	db 25,KANGASKHAN
	db 28,PINSIR

	db $00

ZoneMons2: ; d3cf (3:53cf)
	db $1E
	db 22,NIDORAN_F
	db 26,RHYHORN
	db 23,PARAS
	db 25,EXEGGCUTE
	db 30,NIDORINA
	db 27,EXEGGCUTE
	db 30,NIDORINO
	db 32,VENOMOTH
	db 26,CHANSEY
	db 28,TAUROS

	db $00

ZoneMons3: ; d3e5 (3:53e5)
	db $1E
	db 25,NIDORAN_F
	db 26,DODUO
	db 23,VENONAT
	db 24,EXEGGCUTE
	db 33,NIDORINA
	db 26,EXEGGCUTE
	db 25,NIDORAN_M
	db 31,VENOMOTH
	db 26,TAUROS
	db 28,KANGASKHAN

	db $00

WaterMons: ; d3fb (3:53fb)
	db $00

	db $05
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 20,TENTACOOL
	db 30,TENTACOOL
	db 35,TENTACOOL
	db 40,TENTACOOL

IslandMons1: ; d411 (3:5411)
	db $0F
	db 30,SEEL
	db 30,PSYDUCK
	db 30,STARYU
	db 30,KRABBY
	db 28,KRABBY
	db 21,ZUBAT
	db 29,GOLBAT
	db 28,SLOWPOKE
	db 28,STARYU
	db 38,SLOWBRO

	db $00

IslandMonsB1: ; d427 (3:5427)
	db $0A
	db 30,SHELLDER
	db 30,KRABBY
	db 32,STARYU
	db 32,KRABBY
	db 28,PSYDUCK
	db 30,SEEL
	db 30,PSYDUCK
	db 28,SEEL
	db 38,DEWGONG
	db 37,KINGLER

	db $00

IslandMonsB2: ; d43d (3:543d)
	db $0A
	db 30,SEEL
	db 30,PSYDUCK
	db 32,SEEL
	db 32,PSYDUCK
	db 28,KRABBY
	db 30,SHELLDER
	db 30,KRABBY
	db 28,STARYU
	db 30,GOLBAT
	db 37,GOLDUCK

	db $00

IslandMonsB3: ; d453 (3:5453)
	db $0A
	db 31,PSYDUCK
	db 31,SEEL
	db 33,PSYDUCK
	db 33,SEEL
	db 29,KRABBY
	db 31,STARYU
	db 31,KRABBY
	db 29,STARYU
	db 39,KINGLER
	db 37,DEWGONG

	db $00

IslandMonsB4: ; d469 (3:5469)
	db $0A
	db 31,KRABBY
	db 31,STARYU
	db 33,KRABBY
	db 33,STARYU
	db 29,PSYDUCK
	db 31,SEEL
	db 31,PSYDUCK
	db 29,SEEL
	db 39,GOLDUCK
	db 32,GOLBAT

	db $00

MansionMons1: ; d47f (3:547f)
	db $0A
	db 32,GRIMER
	db 30,GRIMER
	db 34,PONYTA
	db 30,PONYTA
	db 34,VULPIX
	db 32,PONYTA
	db 30,KOFFING
	db 28,PONYTA
	db 37,MUK
	db 39,WEEZING

	db $00

MansionMons2: ; d495 (3:5495)
	db $0A
	db 32,VULPIX
	db 34,GRIMER
	db 34,GRIMER
	db 30,PONYTA
	db 30,GRIMER
	db 32,PONYTA
	db 30,KOFFING
	db 28,PONYTA
	db 39,MUK
	db 37,WEEZING

	db $00

MansionMons3: ; d4ab (3:54ab)
	db $0A
	db 31,GRIMER
	db 33,VULPIX
	db 35,GRIMER
	db 32,PONYTA
	db 34,MAGMAR
	db 40,MUK
	db 34,KOFFING
	db 38,MUK
	db 36,PONYTA
	db 42,WEEZING

	db $00

MansionMonsB1: ; d4c1 (3:54c1)
	db $0A
	db 33,GRIMER
	db 31,GRIMER
	db 35,VULPIX
	db 32,PONYTA
	db 31,GRIMER
	db 40,MUK
	db 34,PONYTA
	db 35,KOFFING
	db 38,MAGMAR
	db 42,WEEZING

	db $00

Route21Mons: ; d4d7 (3:54d7)
	db $19
	db 21,RATTATA
	db 23,PIDGEY
	db 30,RATICATE
	db 23,RATTATA
	db 21,PIDGEY
	db 30,PIDGEOTTO
	db 32,PIDGEOTTO
	db 28,TANGELA
	db 30,TANGELA
	db 32,TANGELA

	db $05
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 20,TENTACOOL
	db 30,TENTACOOL
	db 35,TENTACOOL
	db 40,TENTACOOL

DungeonMons1: ; d501 (3:5501)
	db $0A
	db 46,GOLBAT
	db 46,HYPNO
	db 46,MAGNETON
	db 49,DODRIO
	db 49,VENOMOTH
	db 52,SANDSLASH
	db 49,KADABRA
	db 52,PARASECT
	db 53,RAICHU
	db 53,DITTO

	db $00

DungeonMons2: ; d517 (3:5517)
	db $0F
	db 51,DODRIO
	db 51,VENOMOTH
	db 51,KADABRA
	db 52,RHYDON
	db 52,MAROWAK
	db 52,ELECTRODE
	db 56,CHANSEY
	db 54,WIGGLYTUFF
	db 55,DITTO
	db 60,DITTO

	db $00

DungeonMonsB1: ; d52d (3:552d)
	db $19
	db 55,RHYDON
	db 55,MAROWAK
	db 55,ELECTRODE
	db 64,CHANSEY
	db 64,PARASECT
	db 64,RAICHU
	db 57,SANDSLASH
	db 65,DITTO
	db 63,DITTO
	db 67,DITTO

	db $00

PowerPlantMons: ; d543 (3:5543)
	db $0A
	db 21,VOLTORB
	db 21,MAGNEMITE
	db 20,PIKACHU
	db 24,PIKACHU
	db 23,MAGNEMITE
	db 23,VOLTORB
	db 32,MAGNETON
	db 35,MAGNETON
	db 33,RAICHU
	db 36,RAICHU

	db $00

Route23Mons: ; d559 (3:5559)
	db $0A
	db 26,SANDSHREW
	db 33,DITTO
	db 26,SPEAROW
	db 38,FEAROW
	db 38,DITTO
	db 38,FEAROW
	db 41,SANDSLASH
	db 43,DITTO
	db 41,FEAROW
	db 43,FEAROW

	db $00

PlateauMons2: ; d56f (3:556f)
	db $0A
	db 22,MACHOP
	db 24,GEODUDE
	db 26,ZUBAT
	db 36,ONIX
	db 39,ONIX
	db 42,ONIX
	db 41,MACHOKE
	db 40,GOLBAT
	db 40,MAROWAK
	db 43,GRAVELER

	db $00

PlateauMons3: ; d585 (3:5585)
	db $0F
	db 24,MACHOP
	db 26,GEODUDE
	db 22,ZUBAT
	db 42,ONIX
	db 40,VENOMOTH
	db 45,ONIX
	db 43,GRAVELER
	db 41,GOLBAT
	db 42,MACHOKE
	db 45,MACHOKE

	db $00

PlateauMons1: ; d59b (3:559b)
	db $0F
	db 24,MACHOP
	db 26,GEODUDE
	db 22,ZUBAT
	db 36,ONIX
	db 39,ONIX
	db 42,ONIX
	db 41,GRAVELER
	db 41,GOLBAT
	db 42,MACHOKE
	db 43,MAROWAK

	db $00

CaveMons: ; d5b1 (3:55b1)
	db $14
	db 18,DIGLETT
	db 19,DIGLETT
	db 17,DIGLETT
	db 20,DIGLETT
	db 16,DIGLETT
	db 15,DIGLETT
	db 21,DIGLETT
	db 22,DIGLETT
	db 29,DUGTRIO
	db 31,DUGTRIO

	db $00

ENDC
IF _JAPAN && _BLUE
NoMons: ; d0dd (3:50dd)
	db $00

	db $00

Route1Mons: ; d0df (3:50df)
	db $19
	db 3,PIDGEY
	db 3,RATTATA
	db 3,RATTATA
	db 2,RATTATA
	db 2,PIDGEY
	db 3,PIDGEY
	db 3,PIDGEY
	db 4,RATTATA
	db 4,PIDGEY
	db 5,PIDGEY

	db $00

Route2Mons: ; d0f5 (3:50f5)
	db $19
	db 3,RATTATA
	db 3,PIDGEY
	db 4,PIDGEY
	db 4,RATTATA
	db 5,PIDGEY
	db 3,CATERPIE
	db 2,RATTATA
	db 5,RATTATA
	db 4,CATERPIE
	db 5,CATERPIE

	db $00

Route22Mons: ; d10b (3:510b)
	db $19
	db 3,RATTATA
	db 3,NIDORAN_M
	db 4,RATTATA
	db 4,NIDORAN_M
	db 2,RATTATA
	db 2,NIDORAN_M
	db 3,SPEAROW
	db 5,SPEAROW
	db 3,NIDORAN_F
	db 4,NIDORAN_F

	db $00

ForestMons: ; d121 (3:5121)
	db $08
	db 4,CATERPIE
	db 5,METAPOD
	db 3,CATERPIE
	db 5,CATERPIE
	db 4,METAPOD
	db 6,METAPOD
	db 4,KAKUNA
	db 3,WEEDLE
	db 3,PIKACHU
	db 5,PIKACHU

	db $00

Route3Mons: ; d137 (3:5137)
	db $14
	db 6,PIDGEY
	db 5,SPEAROW
	db 7,PIDGEY
	db 6,SPEAROW
	db 7,SPEAROW
	db 8,PIDGEY
	db 8,SPEAROW
	db 3,JIGGLYPUFF
	db 5,JIGGLYPUFF
	db 7,JIGGLYPUFF

	db $00

MoonMons1: ; d14d (3:514d)
	db $0A
	db 8,ZUBAT
	db 7,ZUBAT
	db 9,ZUBAT
	db 8,GEODUDE
	db 6,ZUBAT
	db 10,ZUBAT
	db 10,GEODUDE
	db 8,PARAS
	db 11,ZUBAT
	db 8,CLEFAIRY

	db $00

MoonMonsB1: ; d163 (3:5163)
	db $0A
	db 8,ZUBAT
	db 7,ZUBAT
	db 7,GEODUDE
	db 8,GEODUDE
	db 9,ZUBAT
	db 10,PARAS
	db 10,ZUBAT
	db 11,ZUBAT
	db 9,CLEFAIRY
	db 9,GEODUDE

	db $00

MoonMonsB2: ; d179 (3:5179)
	db $0A
	db 9,ZUBAT
	db 9,GEODUDE
	db 10,ZUBAT
	db 10,GEODUDE
	db 11,ZUBAT
	db 10,PARAS
	db 12,PARAS
	db 10,CLEFAIRY
	db 12,ZUBAT
	db 12,CLEFAIRY

	db $00

Route4Mons: ; d18f (3:518f)
	db $14
	db 10,RATTATA
	db 10,SPEAROW
	db 8,RATTATA
	db 6,SANDSHREW
	db 8,SPEAROW
	db 10,SANDSHREW
	db 12,RATTATA
	db 12,SPEAROW
	db 8,SANDSHREW
	db 12,SANDSHREW

	db $00

Route24Mons: ; d1a5 (3:51a5)
	db $19
	db 7,CATERPIE
	db 8,METAPOD
	db 12,PIDGEY
	db 12,ODDISH
	db 13,ODDISH
	db 10,ABRA
	db 14,ODDISH
	db 13,PIDGEY
	db 8,ABRA
	db 12,ABRA

	db $00

Route25Mons: ; d1bb (3:51bb)
	db $0F
	db 8,CATERPIE
	db 9,METAPOD
	db 13,PIDGEY
	db 12,ODDISH
	db 13,ODDISH
	db 12,ABRA
	db 14,ODDISH
	db 10,ABRA
	db 7,KAKUNA
	db 8,WEEDLE

	db $00

Route9Mons: ; d1d1 (3:51d1)
	db $0F
	db 16,RATTATA
	db 16,SPEAROW
	db 14,RATTATA
	db 11,SANDSHREW
	db 13,SPEAROW
	db 15,SANDSHREW
	db 17,RATTATA
	db 17,SPEAROW
	db 13,SANDSHREW
	db 17,SANDSHREW

	db $00

Route5Mons: ; d1e7 (3:51e7)
	db $0F
	db 13,ODDISH
	db 13,PIDGEY
	db 15,PIDGEY
	db 10,MEOWTH
	db 12,MEOWTH
	db 15,ODDISH
	db 16,ODDISH
	db 16,PIDGEY
	db 14,MEOWTH
	db 16,MEOWTH

	db $00

Route6Mons: ; d1fd (3:51fd)
	db $0F
	db 13,ODDISH
	db 13,PIDGEY
	db 15,PIDGEY
	db 10,MEOWTH
	db 12,MEOWTH
	db 15,ODDISH
	db 16,ODDISH
	db 16,PIDGEY
	db 14,MEOWTH
	db 16,MEOWTH

	db $00

Route11Mons: ; d213 (3:5213)
	db $0F
	db 14,SANDSHREW
	db 15,SPEAROW
	db 12,SANDSHREW
	db 9,DROWZEE
	db 13,SPEAROW
	db 13,DROWZEE
	db 15,SANDSHREW
	db 17,SPEAROW
	db 11,DROWZEE
	db 15,DROWZEE

	db $00

TunnelMonsB1: ; d229 (3:5229)
	db $0F
	db 16,ZUBAT
	db 17,ZUBAT
	db 17,GEODUDE
	db 15,MACHOP
	db 16,GEODUDE
	db 18,DITTO
	db 15,ZUBAT
	db 17,MACHOP
	db 13,ONIX
	db 15,ONIX

	db $00

TunnelMonsB2: ; d23f (3:523f)
	db $0F
	db 16,ZUBAT
	db 17,ZUBAT
	db 17,GEODUDE
	db 15,MACHOP
	db 16,GEODUDE
	db 18,DITTO
	db 17,MACHOP
	db 17,ONIX
	db 13,ONIX
	db 18,GEODUDE

	db $00

Route10Mons: ; d255 (3:5255)
	db $0F
	db 16,VOLTORB
	db 16,SPEAROW
	db 14,VOLTORB
	db 11,SANDSHREW
	db 13,SPEAROW
	db 15,SANDSHREW
	db 17,VOLTORB
	db 17,SPEAROW
	db 13,SANDSHREW
	db 17,SANDSHREW

	db $00

Route12Mons: ; d26b (3:526b)
	db $0F
	db 24,ODDISH
	db 25,PIDGEY
	db 23,PIDGEY
	db 24,VENONAT
	db 22,ODDISH
	db 26,VENONAT
	db 26,ODDISH
	db 27,PIDGEY
	db 28,GLOOM
	db 30,GLOOM

	db $00

Route8Mons: ; d281 (3:5281)
	db $0F
	db 18,PIDGEY
	db 18,MEOWTH
	db 17,SANDSHREW
	db 16,GROWLITHE
	db 20,PIDGEY
	db 20,MEOWTH
	db 19,SANDSHREW
	db 17,GROWLITHE
	db 15,GROWLITHE
	db 18,GROWLITHE

	db $00

Route7Mons: ; d297 (3:5297)
	db $0F
	db 19,PIDGEY
	db 19,ODDISH
	db 17,MEOWTH
	db 22,ODDISH
	db 22,PIDGEY
	db 18,MEOWTH
	db 18,GROWLITHE
	db 20,GROWLITHE
	db 19,MEOWTH
	db 20,MEOWTH

	db $00

TowerMons1: ; d2ad (3:52ad)
	db $00

	db $00

TowerMons2: ; d2af (3:52af)
	db $00

	db $00

TowerMons3: ; d2b1 (3:52b1)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 24,GASTLY
	db 20,CUBONE
	db 22,CUBONE
	db 25,HAUNTER

	db $00

TowerMons4: ; d2c7 (3:52c7)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 25,HAUNTER
	db 20,CUBONE
	db 22,CUBONE
	db 24,GASTLY

	db $00

TowerMons5: ; d2dd (3:52dd)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 25,HAUNTER
	db 20,CUBONE
	db 22,CUBONE
	db 24,GASTLY

	db $00

TowerMons6: ; d2f3 (3:52f3)
	db $0F
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 24,GASTLY
	db 20,GASTLY
	db 19,GASTLY
	db 26,HAUNTER
	db 22,CUBONE
	db 24,CUBONE
	db 28,HAUNTER

	db $00

TowerMons7: ; d309 (3:5309)
	db $0F
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 24,GASTLY
	db 20,GASTLY
	db 28,HAUNTER
	db 22,CUBONE
	db 24,CUBONE
	db 28,HAUNTER
	db 30,HAUNTER

	db $00

Route13Mons: ; d31f (3:531f)
	db $14
	db 24,ODDISH
	db 25,PIDGEY
	db 27,PIDGEY
	db 24,VENONAT
	db 22,ODDISH
	db 26,VENONAT
	db 26,ODDISH
	db 25,DITTO
	db 28,GLOOM
	db 30,GLOOM

	db $00

Route14Mons: ; d335 (3:5335)
	db $0F
	db 24,ODDISH
	db 26,PIDGEY
	db 23,DITTO
	db 24,VENONAT
	db 22,ODDISH
	db 26,VENONAT
	db 26,ODDISH
	db 30,GLOOM
	db 28,PIDGEOTTO
	db 30,PIDGEOTTO

	db $00

Route15Mons: ; d34b (3:534b)
	db $0F
	db 24,ODDISH
	db 26,DITTO
	db 23,PIDGEY
	db 26,VENONAT
	db 22,ODDISH
	db 28,VENONAT
	db 26,ODDISH
	db 30,GLOOM
	db 28,PIDGEOTTO
	db 30,PIDGEOTTO

	db $00

Route16Mons: ; d361 (3:5361)
	db $19
	db 20,SPEAROW
	db 22,SPEAROW
	db 18,RATTATA
	db 20,DODUO
	db 20,RATTATA
	db 18,DODUO
	db 22,DODUO
	db 22,RATTATA
	db 23,RATICATE
	db 25,RATICATE

	db $00

Route17Mons: ; d377 (3:5377)
	db $19
	db 20,SPEAROW
	db 22,SPEAROW
	db 25,RATICATE
	db 24,DODUO
	db 27,RATICATE
	db 26,DODUO
	db 28,DODUO
	db 29,RATICATE
	db 25,FEAROW
	db 27,FEAROW

	db $00

Route18Mons: ; d38d (3:538d)
	db $19
	db 20,SPEAROW
	db 22,SPEAROW
	db 25,RATICATE
	db 24,DODUO
	db 25,FEAROW
	db 26,DODUO
	db 28,DODUO
	db 29,RATICATE
	db 27,FEAROW
	db 29,FEAROW

	db $00

ZoneMonsCenter: ; d3a3 (3:53a3)
	db $1E
	db 22,NIDORAN_M
	db 25,RHYHORN
	db 22,VENONAT
	db 24,EXEGGCUTE
	db 31,NIDORINO
	db 25,EXEGGCUTE
	db 31,NIDORINA
	db 30,PARASECT
	db 23,SCYTHER
	db 23,CHANSEY

	db $00

ZoneMons1: ; d3b9 (3:53b9)
	db $1E
	db 24,NIDORAN_M
	db 26,DODUO
	db 22,PARAS
	db 25,EXEGGCUTE
	db 33,NIDORINO
	db 23,EXEGGCUTE
	db 24,NIDORAN_F
	db 25,PARASECT
	db 25,LICKITUNG
	db 28,SCYTHER

	db $00

ZoneMons2: ; d3cf (3:53cf)
	db $1E
	db 22,NIDORAN_M
	db 26,RHYHORN
	db 23,PARAS
	db 25,EXEGGCUTE
	db 30,NIDORINO
	db 27,EXEGGCUTE
	db 30,NIDORINA
	db 32,VENOMOTH
	db 26,CHANSEY
	db 28,PINSIR

	db $00

ZoneMons3: ; d3e5 (3:53e5)
	db $1E
	db 25,NIDORAN_M
	db 26,DODUO
	db 23,VENONAT
	db 24,EXEGGCUTE
	db 33,NIDORINO
	db 26,EXEGGCUTE
	db 25,NIDORAN_F
	db 31,VENOMOTH
	db 26,PINSIR
	db 28,LICKITUNG

	db $00

WaterMons: ; d3fb (3:53fb)
	db $00

	db $05
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 20,TENTACOOL
	db 30,TENTACOOL
	db 35,TENTACOOL
	db 40,TENTACOOL

WaterMons: ; d3fb (3:53fb)
	db $00

	db $05
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 20,TENTACOOL
	db 30,TENTACOOL
	db 35,TENTACOOL
	db 40,TENTACOOL

IslandMons1: ; d411 (3:5411)
	db $0F
	db 30,SEEL
	db 30,HORSEA
	db 30,STARYU
	db 30,KRABBY
	db 28,KRABBY
	db 21,ZUBAT
	db 29,GOLBAT
	db 28,SLOWPOKE
	db 28,STARYU
	db 38,SLOWBRO

	db $00

IslandMonsB1: ; d427 (3:5427)
	db $0A
	db 30,SHELLDER
	db 30,KRABBY
	db 32,STARYU
	db 32,KRABBY
	db 28,HORSEA
	db 30,SEEL
	db 30,HORSEA
	db 28,SEEL
	db 38,DEWGONG
	db 37,KINGLER

	db $00

IslandMonsB2: ; d43d (3:543d)
	db $0A
	db 30,SEEL
	db 30,HORSEA
	db 32,SEEL
	db 32,HORSEA
	db 28,KRABBY
	db 30,SHELLDER
	db 30,KRABBY
	db 28,STARYU
	db 30,GOLBAT
	db 37,JYNX

	db $00

IslandMonsB3: ; d453 (3:5453)
	db $0A
	db 31,HORSEA
	db 31,SEEL
	db 33,HORSEA
	db 33,SEEL
	db 29,KRABBY
	db 31,STARYU
	db 31,KRABBY
	db 29,STARYU
	db 39,KINGLER
	db 37,DEWGONG

	db $00

IslandMonsB4: ; d469 (3:5469)
	db $0A
	db 31,KRABBY
	db 31,STARYU
	db 33,KRABBY
	db 33,STARYU
	db 29,HORSEA
	db 31,SEEL
	db 31,HORSEA
	db 29,SEEL
	db 39,JYNX
	db 32,GOLBAT

	db $00

MansionMons1: ; d47f (3:547f)
	db $0A
	db 32,GRIMER
	db 30,GRIMER
	db 34,PONYTA
	db 30,PONYTA
	db 34,GROWLITHE
	db 32,PONYTA
	db 30,KOFFING
	db 28,PONYTA
	db 37,MUK
	db 39,WEEZING

	db $00

MansionMons2: ; d495 (3:5495)
	db $0A
	db 32,GROWLITHE
	db 34,GRIMER
	db 34,GRIMER
	db 30,PONYTA
	db 30,GRIMER
	db 32,PONYTA
	db 30,KOFFING
	db 28,PONYTA
	db 39,MUK
	db 37,WEEZING

	db $00

MansionMons3: ; d4ab (3:54ab)
	db $0A
	db 31,GRIMER
	db 33,GROWLITHE
	db 35,GRIMER
	db 32,PONYTA
	db 34,PONYTA
	db 40,MUK
	db 34,KOFFING
	db 38,MUK
	db 36,PONYTA
	db 42,WEEZING

	db $00

MansionMonsB1: ; d4c1 (3:54c1)
	db $0A
	db 33,GRIMER
	db 31,GRIMER
	db 35,GROWLITHE
	db 32,PONYTA
	db 31,GRIMER
	db 40,MUK
	db 34,PONYTA
	db 35,KOFFING
	db 38,MUK
	db 42,WEEZING

	db $00

Route21Mons: ; d4d7 (3:54d7)
	db $19
	db 21,RATTATA
	db 23,PIDGEY
	db 30,RATICATE
	db 23,RATTATA
	db 21,PIDGEY
	db 30,PIDGEOTTO
	db 32,PIDGEOTTO
	db 28,TANGELA
	db 30,TANGELA
	db 32,TANGELA

	db $05
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 20,TENTACOOL
	db 30,TENTACOOL
	db 35,TENTACOOL
	db 40,TENTACOOL

DungeonMons1: ; d501 (3:5501)
	db $0A
	db 46,GOLBAT
	db 46,HYPNO
	db 46,MAGNETON
	db 49,RAPIDASH
	db 49,VENOMOTH
	db 52,SANDSLASH
	db 49,KADABRA
	db 52,PARASECT
	db 53,RAICHU
	db 53,DITTO

	db $00

DungeonMons2: ; d517 (3:5517)
	db $0F
	db 51,DODRIO
	db 51,VENOMOTH
	db 51,KADABRA
	db 52,RHYDON
	db 52,RATICATE
	db 52,ELECTRODE
	db 56,CHANSEY
	db 54,WIGGLYTUFF
	db 55,DITTO
	db 60,DITTO

	db $00

DungeonMonsB1: ; d52d (3:552d)
	db $19
	db 55,RHYDON
	db 55,MAROWAK
	db 55,ELECTRODE
	db 64,CLEFAIRY
	db 64,PARASECT
	db 64,RAICHU
	db 57,SANDSLASH
	db 65,DITTO
	db 63,DITTO
	db 67,DITTO

	db $00

PowerPlantMons: ; d543 (3:5543)
	db $0A
	db 21,VOLTORB
	db 21,MAGNEMITE
	db 20,PIKACHU
	db 24,PIKACHU
	db 23,MAGNEMITE
	db 23,VOLTORB
	db 32,MAGNETON
	db 35,MAGNETON
	db 33,RAICHU
	db 36,RAICHU

	db $00

Route23Mons: ; d559 (3:5559)
	db $0A
	db 26,SANDSHREW
	db 33,DITTO
	db 26,SPEAROW
	db 38,FEAROW
	db 38,DITTO
	db 38,FEAROW
	db 41,SANDSLASH
	db 43,DITTO
	db 41,FEAROW
	db 43,FEAROW

	db $00

PlateauMons2: ; d56f (3:556f)
	db $0A
	db 22,MACHOP
	db 24,GEODUDE
	db 26,ZUBAT
	db 36,ONIX
	db 39,ONIX
	db 42,ONIX
	db 41,MACHOKE
	db 40,GOLBAT
	db 40,MAROWAK
	db 43,GRAVELER

	db $00

PlateauMons3: ; d585 (3:5585)
	db $0F
	db 24,MACHOP
	db 26,GEODUDE
	db 22,ZUBAT
	db 42,ONIX
	db 40,VENOMOTH
	db 45,ONIX
	db 43,GRAVELER
	db 41,GOLBAT
	db 42,MACHOKE
	db 45,MACHOKE

	db $00

PlateauMons1: ; d59b (3:559b)
	db $0F
	db 24,MACHOP
	db 26,GEODUDE
	db 22,ZUBAT
	db 36,ONIX
	db 39,ONIX
	db 42,ONIX
	db 41,GRAVELER
	db 41,GOLBAT
	db 42,MACHOKE
	db 43,MAROWAK

	db $00

CaveMons: ; d5b1 (3:55b1)
	db $14
	db 18,DIGLETT
	db 19,DIGLETT
	db 17,DIGLETT
	db 20,DIGLETT
	db 16,DIGLETT
	db 15,DIGLETT
	db 21,DIGLETT
	db 22,DIGLETT
	db 29,DUGTRIO
	db 31,DUGTRIO

	db $00

ENDC
IF _YELLOW
NoMons: ; d0dd (3:50dd)
	db $00

	db $00

Route1Mons: ; d0df (3:50df)
	db $19
	db 3,PIDGEY
	db 4,PIDGEY
	db 2,RATTATA
	db 3,RATTATA
	db 2,PIDGEY
	db 3,PIDGEY
	db 5,PIDGEY
	db 4,RATTATA
	db 6,PIDGEY
	db 7,PIDGEY

	db $00

Route2Mons: ; d0f5 (3:50f5)
	db $19
	db 3,RATTATA
	db 3,PIDGEY
	db 4,RATTATA
	db 4,NIDORAN_M
	db 4,NIDORAN_F
	db 5,PIDGEY
	db 6,NIDORAN_M
	db 6,NIDORAN_F
	db 7,PIDGEY
	db 7,PIDGEY

	db $00

Route22Mons: ; d10b (3:510b)
	db $19
	db 2,NIDORAN_M
	db 2,NIDORAN_F
	db 3,MANKEY
	db 3,RATTATA
	db 4,NIDORAN_M
	db 4,NIDORAN_F
	db 5,MANKEY
	db 2,SPEAROW
	db 4,SPEAROW
	db 6,SPEAROW

	db $00

ForestMons: ; d121 (3:5121)
	db $19
	db 3,CATERPIE
	db 4,METAPOD
	db 4,CATERPIE
	db 5,CATERPIE
	db 4,PIDGEY
	db 6,PIDGEY
	db 6,CATERPIE
	db 6,METAPOD
	db 8,PIDGEY
	db 9,PIDGEOTTO

	db $00

Route3Mons: ; d137 (3:5137)
	db $14
	db 8,SPEAROW
	db 9,SPEAROW
	db 9,MANKEY
	db 10,SPEAROW
	db 8,SANDSHREW
	db 10,RATTATA
	db 10,SANDSHREW
	db 12,RATTATA
	db 11,SPEAROW
	db 12,SPEAROW

	db $00

MoonMons1: ; d14d (3:514d)
	db $0A
	db 8,ZUBAT
	db 9,ZUBAT
	db 10,GEODUDE
	db 6,ZUBAT
	db 7,ZUBAT
	db 10,ZUBAT
	db 10,GEODUDE
	db 11,ZUBAT
	db 12,SANDSHREW
	db 11,CLEFAIRY

	db $00

MoonMonsB1: ; d163 (3:5163)
	db $0A
	db 8,ZUBAT
	db 9,ZUBAT
	db 10,ZUBAT
	db 10,GEODUDE
	db 11,GEODUDE
	db 11,ZUBAT
	db 9,PARAS
	db 11,PARAS
	db 10,CLEFAIRY
	db 12,CLEFAIRY

	db $00

MoonMonsB2: ; d179 (3:5179)
	db $0A
	db 10,ZUBAT
	db 11,GEODUDE
	db 13,PARAS
	db 11,ZUBAT
	db 11,ZUBAT
	db 12,ZUBAT
	db 13,ZUBAT
	db 9,CLEFAIRY
	db 11,CLEFAIRY
	db 13,CLEFAIRY

	db $00

Route4Mons: ; d18f (3:518f)
	db $14
	db 8,SPEAROW
	db 9,SPEAROW
	db 9,MANKEY
	db 10,SPEAROW
	db 8,SANDSHREW
	db 10,RATTATA
	db 10,SANDSHREW
	db 12,RATTATA
	db 11,SPEAROW
	db 12,SPEAROW

	db $00

Route24Mons: ; d1a5 (3:51a5)
	db $19
	db 12,ODDISH
	db 12,BELLSPROUT
	db 13,PIDGEY
	db 14,ODDISH
	db 14,BELLSPROUT
	db 15,PIDGEY
	db 13,VENONAT
	db 16,VENONAT
	db 17,PIDGEY
	db 17,PIDGEOTTO

	db $00

Route25Mons: ; d1bb (3:51bb)
	db $0F
	db 12,ODDISH
	db 12,BELLSPROUT
	db 13,PIDGEY
	db 14,ODDISH
	db 14,BELLSPROUT
	db 15,PIDGEY
	db 13,VENONAT
	db 16,VENONAT
	db 17,PIDGEY
	db 17,PIDGEOTTO

	db $00

Route9Mons: ; d1d1 (3:51d1)
	db $0F
	db 16,NIDORAN_M
	db 16,NIDORAN_F
	db 18,RATTATA
	db 18,NIDORAN_M
	db 18,NIDORAN_F
	db 17,SPEAROW
	db 18,NIDORINO
	db 18,NIDORINA
	db 20,RATICATE
	db 19,FEAROW

	db $00

Route5Mons: ; d1e7 (3:51e7)
	db $0F
	db 15,PIDGEY
	db 14,RATTATA
	db 7,ABRA
	db 16,PIDGEY
	db 16,RATTATA
	db 17,PIDGEY
	db 17,PIDGEOTTO
	db 3,JIGGLYPUFF
	db 5,JIGGLYPUFF
	db 7,JIGGLYPUFF

	db $00

Route6Mons: ; d1fd (3:51fd)
	db $0F
	db 15,PIDGEY
	db 14,RATTATA
	db 7,ABRA
	db 16,PIDGEY
	db 16,RATTATA
	db 17,PIDGEY
	db 17,PIDGEOTTO
	db 3,JIGGLYPUFF
	db 5,JIGGLYPUFF
	db 7,JIGGLYPUFF

	db $03
	db 15,PSYDUCK
	db 15,PSYDUCK
	db 15,PSYDUCK
	db 15,PSYDUCK
	db 15,PSYDUCK
	db 15,PSYDUCK
	db 15,PSYDUCK
	db 15,PSYDUCK
	db 15,GOLDUCK
	db 20,GOLDUCK

Route11Mons: ; d213 (3:5213)
	db $0F
	db 16,PIDGEY
	db 15,RATTATA
	db 18,PIDGEY
	db 15,DROWZEE
	db 17,RATTATA
	db 17,DROWZEE
	db 18,PIDGEOTTO
	db 20,PIDGEOTTO
	db 19,DROWZEE
	db 17,RATICATE

	db $00

TunnelMonsB1: ; d229 (3:5229)
	db $0F
	db 15,ZUBAT
	db 16,GEODUDE
	db 17,ZUBAT
	db 19,ZUBAT
	db 18,GEODUDE
	db 20,GEODUDE
	db 21,ZUBAT
	db 17,MACHOP
	db 19,MACHOP
	db 21,MACHOP

	db $00

TunnelMonsB2: ; d23f (3:523f)
	db $0F
	db 20,ZUBAT
	db 17,GEODUDE
	db 18,MACHOP
	db 21,ZUBAT
	db 22,ZUBAT
	db 21,GEODUDE
	db 20,MACHOP
	db 14,ONIX
	db 18,ONIX
	db 22,ONIX

	db $00

Route10Mons: ; d255 (3:5255)
	db $0F
	db 16,MAGNEMITE
	db 18,RATTATA
	db 18,MAGNEMITE
	db 20,MAGNEMITE
	db 17,NIDORAN_M
	db 17,NIDORAN_F
	db 22,MAGNEMITE
	db 20,RATICATE
	db 16,MACHOP
	db 18,MACHOP

	db $00

Route12Mons: ; d26b (3:526b)
	db $0F
	db 25,ODDISH
	db 25,BELLSPROUT
	db 28,PIDGEY
	db 28,PIDGEOTTO
	db 27,ODDISH
	db 27,BELLSPROUT
	db 29,GLOOM
	db 29,WEEPINBELL
	db 26,FARFETCH_D
	db 31,FARFETCH_D

	db $03
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWBRO
	db 20,SLOWBRO

Route8Mons: ; d281 (3:5281)
	db $0F
	db 20,PIDGEY
	db 22,PIDGEY
	db 20,RATTATA
	db 15,ABRA
	db 19,ABRA
	db 24,PIDGEOTTO
	db 19,JIGGLYPUFF
	db 24,JIGGLYPUFF
	db 20,KADABRA
	db 27,KADABRA

	db $00

Route7Mons: ; d297 (3:5297)
	db $0F
	db 20,PIDGEY
	db 22,PIDGEY
	db 20,RATTATA
	db 15,ABRA
	db 19,ABRA
	db 24,PIDGEOTTO
	db 26,ABRA
	db 19,JIGGLYPUFF
	db 24,JIGGLYPUFF
	db 24,JIGGLYPUFF

	db $00

TowerMons1: ; d2ad (3:52ad)
	db $00

	db $00

TowerMons2: ; d2af (3:52af)
	db $00

	db $00

TowerMons3: ; d2b1 (3:52b1)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 24,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 25,GASTLY
	db 20,HAUNTER
	db 25,HAUNTER

	db $00

TowerMons4: ; d2c7 (3:52c7)
	db $0A
	db 20,GASTLY
	db 21,GASTLY
	db 22,GASTLY
	db 23,GASTLY
	db 24,GASTLY
	db 19,GASTLY
	db 18,GASTLY
	db 25,GASTLY
	db 20,HAUNTER
	db 25,HAUNTER

	db $00

TowerMons5: ; d2dd (3:52dd)
	db $0F
	db 22,GASTLY
	db 23,GASTLY
	db 24,GASTLY
	db 25,GASTLY
	db 26,GASTLY
	db 21,GASTLY
	db 20,CUBONE
	db 27,GASTLY
	db 22,HAUNTER
	db 27,HAUNTER

	db $00

TowerMons6: ; d2f3 (3:52f3)
	db $0F
	db 22,GASTLY
	db 23,GASTLY
	db 24,GASTLY
	db 25,GASTLY
	db 26,GASTLY
	db 21,GASTLY
	db 22,CUBONE
	db 27,GASTLY
	db 22,HAUNTER
	db 27,HAUNTER

	db $00

TowerMons7: ; d309 (3:5309)
	db $14
	db 24,GASTLY
	db 25,GASTLY
	db 26,GASTLY
	db 27,GASTLY
	db 28,GASTLY
	db 23,GASTLY
	db 24,CUBONE
	db 29,GASTLY
	db 24,HAUNTER
	db 29,HAUNTER

	db $00

Route13Mons: ; d31f (3:531f)
	db $0F
	db 25,ODDISH
	db 25,BELLSPROUT
	db 28,PIDGEOTTO
	db 28,PIDGEY
	db 27,ODDISH
	db 27,BELLSPROUT
	db 29,GLOOM
	db 29,WEEPINBELL
	db 26,FARFETCH_D
	db 31,FARFETCH_D

	db $03
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWPOKE
	db 15,SLOWBRO
	db 20,SLOWBRO

Route14Mons: ; d335 (3:5335)
	db $0F
	db 26,ODDISH
	db 26,BELLSPROUT
	db 24,VENONAT
	db 30,PIDGEOTTO
	db 28,ODDISH
	db 28,BELLSPROUT
	db 30,GLOOM
	db 30,WEEPINBELL
	db 27,VENONAT
	db 30,VENOMOTH

	db $00

Route15Mons: ; d34b (3:534b)
	db $0F
	db 26,ODDISH
	db 26,BELLSPROUT
	db 24,VENONAT
	db 32,PIDGEOTTO
	db 28,ODDISH
	db 28,BELLSPROUT
	db 30,GLOOM
	db 30,WEEPINBELL
	db 27,VENONAT
	db 30,VENOMOTH

	db $00

Route16Mons: ; d361 (3:5361)
	db $19
	db 22,SPEAROW
	db 22,DODUO
	db 23,RATTATA
	db 24,DODUO
	db 24,RATTATA
	db 26,DODUO
	db 23,SPEAROW
	db 24,FEAROW
	db 25,RATICATE
	db 26,RATICATE

	db $00

Route17Mons: ; d377 (3:5377)
	db $19
	db 26,DODUO
	db 27,FEAROW
	db 27,DODUO
	db 28,DODUO
	db 28,PONYTA
	db 30,PONYTA
	db 29,FEAROW
	db 28,DODUO
	db 32,PONYTA
	db 29,DODRIO

	db $00

Route18Mons: ; d38d (3:538d)
	db $19
	db 22,SPEAROW
	db 22,DODUO
	db 23,RATTATA
	db 24,DODUO
	db 24,RATTATA
	db 26,DODUO
	db 23,SPEAROW
	db 24,FEAROW
	db 25,RATICATE
	db 26,RATICATE

	db $00

ZoneMonsCenter: ; d3a3 (3:53a3)
	db $1E
	db 14,NIDORAN_M
	db 36,NIDORAN_F
	db 24,EXEGGCUTE
	db 20,RHYHORN
	db 23,NIDORINO
	db 27,PARASECT
	db 27,PARAS
	db 32,PARASECT
	db 22,TANGELA
	db 7,CHANSEY

	db $00

ZoneMons1: ; d3b9 (3:53b9)
	db $1E
	db 21,NIDORAN_M
	db 29,NIDORAN_F
	db 22,EXEGGCUTE
	db 21,TAUROS
	db 32,NIDORINA
	db 19,CUBONE
	db 26,EXEGGCUTE
	db 24,MAROWAK
	db 21,CHANSEY
	db 15,SCYTHER

	db $00

ZoneMons2: ; d3cf (3:53cf)
	db $1E
	db 36,NIDORAN_M
	db 14,NIDORAN_F
	db 20,EXEGGCUTE
	db 25,RHYHORN
	db 23,NIDORINA
	db 28,KANGASKHAN
	db 16,CUBONE
	db 33,KANGASKHAN
	db 25,SCYTHER
	db 15,PINSIR

	db $00

ZoneMons3: ; d3e5 (3:53e5)
	db $1E
	db 29,NIDORAN_M
	db 21,NIDORAN_F
	db 22,EXEGGCUTE
	db 21,TAUROS
	db 32,NIDORINO
	db 19,CUBONE
	db 26,EXEGGCUTE
	db 24,MAROWAK
	db 25,PINSIR
	db 27,TANGELA

	db $00

WaterMons: ; d3fb (3:53fb)
	db $00

	db $05
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 20,TENTACOOL
	db 30,TENTACOOL
	db 35,TENTACOOL
	db 40,TENTACOOL

WaterMons: ; d3fb (3:53fb)
	db $00

	db $05
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 20,TENTACOOL
	db 30,TENTACOOL
	db 35,TENTACOOL
	db 40,TENTACOOL

IslandMons1: ; d411 (3:5411)
	db $0F
	db 18,ZUBAT
	db 25,KRABBY
	db 27,KRABBY
	db 27,ZUBAT
	db 36,ZUBAT
	db 28,SLOWPOKE
	db 30,SLOWPOKE
	db 9,ZUBAT
	db 27,GOLBAT
	db 36,GOLBAT

	db $00

IslandMonsB1: ; d427 (3:5427)
	db $0A
	db 27,ZUBAT
	db 26,KRABBY
	db 36,ZUBAT
	db 28,KRABBY
	db 27,GOLBAT
	db 29,SLOWPOKE
	db 18,ZUBAT
	db 28,KINGLER
	db 22,SEEL
	db 26,SEEL

	db $00

IslandMonsB2: ; d43d (3:543d)
	db $0A
	db 27,ZUBAT
	db 27,KRABBY
	db 36,ZUBAT
	db 27,GOLBAT
	db 28,KINGLER
	db 24,SEEL
	db 29,KRABBY
	db 36,GOLBAT
	db 31,SLOWPOKE
	db 31,SLOWBRO

	db $00

IslandMonsB3: ; d453 (3:5453)
	db $0A
	db 27,GOLBAT
	db 36,ZUBAT
	db 29,KRABBY
	db 27,ZUBAT
	db 30,KINGLER
	db 26,SEEL
	db 31,KRABBY
	db 30,SEEL
	db 28,DEWGONG
	db 32,DEWGONG

	db $05
	db 25,TENTACOOL
	db 30,TENTACOOL
	db 20,TENTACOOL
	db 30,STARYU
	db 35,TENTACOOL
	db 30,STARYU
	db 40,TENTACOOL
	db 30,STARYU
	db 30,STARYU
	db 30,STARYU

IslandMonsB4: ; d469 (3:5469)
	db $0A
	db 36,GOLBAT
	db 36,ZUBAT
	db 30,KRABBY
	db 32,KINGLER
	db 28,SEEL
	db 32,SEEL
	db 27,GOLBAT
	db 45,ZUBAT
	db 30,DEWGONG
	db 34,DEWGONG

	db $05
	db 25,TENTACOOL
	db 30,TENTACOOL
	db 20,TENTACOOL
	db 30,STARYU
	db 35,TENTACOOL
	db 30,STARYU
	db 40,TENTACOOL
	db 30,STARYU
	db 30,STARYU
	db 30,STARYU

MansionMons1: ; d47f (3:547f)
	db $0A
	db 34,RATTATA
	db 34,RATICATE
	db 23,GRIMER
	db 26,GROWLITHE
	db 37,RATTATA
	db 37,RATICATE
	db 30,GROWLITHE
	db 26,GRIMER
	db 34,GROWLITHE
	db 38,GROWLITHE

	db $00

MansionMons2: ; d495 (3:5495)
	db $0A
	db 37,RATTATA
	db 37,RATICATE
	db 26,GRIMER
	db 29,GRIMER
	db 40,RATTATA
	db 40,RATICATE
	db 32,GRIMER
	db 35,GRIMER
	db 35,MUK
	db 38,MUK

	db $00

MansionMons3: ; d4ab (3:54ab)
	db $0A
	db 40,RATTATA
	db 40,RATICATE
	db 32,GRIMER
	db 35,GRIMER
	db 43,RATTATA
	db 43,RATICATE
	db 38,GRIMER
	db 38,GRIMER
	db 38,MUK
	db 41,MUK

	db $00

MansionMonsB1: ; d4c1 (3:54c1)
	db $0A
	db 35,GRIMER
	db 38,GRIMER
	db 37,RATICATE
	db 40,RATICATE
	db 41,MUK
	db 43,RATICATE
	db 24,DITTO
	db 46,RATICATE
	db 18,DITTO
	db 12,DITTO

	db $00

Route21Mons: ; d4d7 (3:54d7)
	db $19
	db 15,PIDGEY
	db 13,RATTATA
	db 13,PIDGEY
	db 11,PIDGEY
	db 17,PIDGEY
	db 15,RATTATA
	db 15,RATICATE
	db 17,PIDGEOTTO
	db 19,PIDGEOTTO
	db 15,PIDGEOTTO

	db $05
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 5,TENTACOOL
	db 10,TENTACOOL
	db 15,TENTACOOL
	db 20,TENTACOOL
	db 30,TENTACOOL
	db 35,TENTACOOL
	db 40,TENTACOOL

DungeonMons1: ; d501 (3:5501)
	db $0A
	db 50,GOLBAT
	db 55,GOLBAT
	db 45,GRAVELER
	db 55,GLOOM
	db 55,WEEPINBELL
	db 52,SANDSLASH
	db 54,VENOMOTH
	db 54,PARASECT
	db 55,DITTO
	db 60,DITTO

	db $00

DungeonMons2: ; d517 (3:5517)
	db $0F
	db 52,GOLBAT
	db 57,GOLBAT
	db 50,GRAVELER
	db 56,SANDSLASH
	db 50,RHYHORN
	db 60,DITTO
	db 58,GLOOM
	db 58,WEEPINBELL
	db 60,RHYDON
	db 58,RHYDON

	db $00

DungeonMonsB1: ; d52d (3:552d)
	db $19
	db 54,GOLBAT
	db 59,GOLBAT
	db 55,GRAVELER
	db 52,RHYHORN
	db 62,RHYDON
	db 60,DITTO
	db 56,CHANSEY
	db 65,DITTO
	db 55,LICKITUNG
	db 50,LICKITUNG

	db $00

PowerPlantMons: ; d543 (3:5543)
	db $0A
	db 30,MAGNEMITE
	db 35,MAGNEMITE
	db 33,MAGNETON
	db 33,VOLTORB
	db 37,VOLTORB
	db 33,GRIMER
	db 37,GRIMER
	db 38,MAGNETON
	db 33,MUK
	db 37,MUK

	db $00

Route23Mons: ; d559 (3:5559)
	db $0A
	db 41,NIDORINO
	db 41,NIDORINA
	db 36,MANKEY
	db 44,NIDORINO
	db 44,NIDORINA
	db 40,FEAROW
	db 41,MANKEY
	db 45,FEAROW
	db 41,PRIMEAPE
	db 46,PRIMEAPE

	db $00

PlateauMons2: ; d56f (3:556f)
	db $0A
	db 31,GEODUDE
	db 36,GEODUDE
	db 41,GEODUDE
	db 44,ZUBAT
	db 39,GOLBAT
	db 44,GRAVELER
	db 45,ONIX
	db 47,ONIX
	db 39,MACHOKE
	db 42,MACHOKE

	db $00

PlateauMons3: ; d585 (3:5585)
	db $0F
	db 36,GEODUDE
	db 44,GOLBAT
	db 41,GEODUDE
	db 49,ONIX
	db 46,GEODUDE
	db 41,GRAVELER
	db 42,MACHOKE
	db 45,MACHOKE
	db 47,GRAVELER
	db 47,GRAVELER

	db $00

PlateauMons1: ; d59b (3:559b)
	db $0F
	db 26,GEODUDE
	db 31,GEODUDE
	db 36,GEODUDE
	db 39,ZUBAT
	db 44,ZUBAT
	db 41,GEODUDE
	db 43,ONIX
	db 45,ONIX
	db 41,GRAVELER
	db 47,GRAVELER

	db $00

CaveMons: ; d5b1 (3:55b1)
	db $14
	db 18,DIGLETT
	db 19,DIGLETT
	db 17,DIGLETT
	db 20,DIGLETT
	db 16,DIGLETT
	db 15,DIGLETT
	db 21,DIGLETT
	db 22,DIGLETT
	db 29,DUGTRIO
	db 31,DUGTRIO

	db $00

ENDC

UseItem_: ; d5c7 (3:55c7)
	ld a,1
	ld [$cd6a],a
	ld a,[$cf91]	;contains item_ID
	cp a,HM_01
	jp nc,ItemUseTMHM
	ld hl,ItemUsePtrTable
	dec a
	add a
	ld c,a
	ld b,0
	add hl,bc
	ld a,[hli]
	ld h,[hl]
	ld l,a
	jp [hl]

ItemUsePtrTable: ; d5e1 (3:55e1)
	dw ItemUseBall       ; MASTER_BALL
	dw ItemUseBall       ; ULTRA_BALL
	dw ItemUseBall       ; GREAT_BALL
	dw ItemUseBall       ; POKE_BALL
	dw ItemUseTownMap    ; TOWN_MAP
	dw ItemUseBicycle    ; BICYCLE
	dw ItemUseSurfboard  ; out-of-battle Surf effect
	dw ItemUseBall       ; SAFARI_BALL
	dw ItemUsePokedex    ; POKEDEX
	dw ItemUseEvoStone   ; MOON_STONE
	dw ItemUseMedicine   ; ANTIDOTE
	dw ItemUseMedicine   ; BURN_HEAL
	dw ItemUseMedicine   ; ICE_HEAL
	dw ItemUseMedicine   ; AWAKENING
	dw ItemUseMedicine   ; PARLYZ_HEAL
	dw ItemUseMedicine   ; FULL_RESTORE
	dw ItemUseMedicine   ; MAX_POTION
	dw ItemUseMedicine   ; HYPER_POTION
	dw ItemUseMedicine   ; SUPER_POTION
	dw ItemUseMedicine   ; POTION
	dw ItemUseBait       ; BOULDERBADGE
	dw ItemUseRock       ; CASCADEBADGE
	dw UnusableItem      ; THUNDERBADGE
	dw UnusableItem      ; RAINBOWBADGE
	dw UnusableItem      ; SOULBADGE
	dw UnusableItem      ; MARSHBADGE
	dw UnusableItem      ; VOLCANOBADGE
	dw UnusableItem      ; EARTHBADGE
	dw ItemUseEscapeRope ; ESCAPE_ROPE
	dw ItemUseRepel      ; REPEL
	dw UnusableItem      ; OLD_AMBER
	dw ItemUseEvoStone   ; FIRE_STONE
	dw ItemUseEvoStone   ; THUNDER_STONE
	dw ItemUseEvoStone   ; WATER_STONE
	dw ItemUseVitamin    ; HP_UP
	dw ItemUseVitamin    ; PROTEIN
	dw ItemUseVitamin    ; IRON
	dw ItemUseVitamin    ; CARBOS
	dw ItemUseVitamin    ; CALCIUM
	dw ItemUseVitamin    ; RARE_CANDY
	dw UnusableItem      ; DOME_FOSSIL
	dw UnusableItem      ; HELIX_FOSSIL
	dw UnusableItem      ; SECRET_KEY
	dw UnusableItem
	dw UnusableItem      ; BIKE_VOUCHER
	dw ItemUseXAccuracy  ; X_ACCURACY
	dw ItemUseEvoStone   ; LEAF_STONE
	dw ItemUseCardKey    ; CARD_KEY
	dw UnusableItem      ; NUGGET
	dw UnusableItem      ; ??? PP_UP
	dw ItemUsePokedoll   ; POKE_DOLL
	dw ItemUseMedicine   ; FULL_HEAL
	dw ItemUseMedicine   ; REVIVE
	dw ItemUseMedicine   ; MAX_REVIVE
	dw ItemUseGuardSpec  ; GUARD_SPEC_
	dw ItemUseSuperRepel ; SUPER_REPL
	dw ItemUseMaxRepel   ; MAX_REPEL
	dw ItemUseDireHit    ; DIRE_HIT
	dw UnusableItem      ; COIN
	dw ItemUseMedicine   ; FRESH_WATER
	dw ItemUseMedicine   ; SODA_POP
	dw ItemUseMedicine   ; LEMONADE
	dw UnusableItem      ; S_S__TICKET
	dw UnusableItem      ; GOLD_TEETH
	dw ItemUseXStat      ; X_ATTACK
	dw ItemUseXStat      ; X_DEFEND
	dw ItemUseXStat      ; X_SPEED
	dw ItemUseXStat      ; X_SPECIAL
	dw ItemUseCoinCase   ; COIN_CASE
	dw ItemUseOaksParcel ; OAKS_PARCEL
	dw ItemUseItemfinder ; ITEMFINDER
	dw UnusableItem      ; SILPH_SCOPE
	dw ItemUsePokeflute  ; POKE_FLUTE
	dw UnusableItem      ; LIFT_KEY
	dw UnusableItem      ; EXP__ALL
	dw OldRodCode        ; OLD_ROD
	dw GoodRodCode       ; GOOD_ROD
	dw SuperRodCode      ; SUPER_ROD
	dw ItemUsePPUp       ; PP_UP (real one)
	dw ItemUsePPRestore  ; ETHER
	dw ItemUsePPRestore  ; MAX_ETHER
	dw ItemUsePPRestore  ; ELIXER
	dw ItemUsePPRestore  ; MAX_ELIXER

ItemUseBall: ; d687 (3:5687)
	ld a,[W_ISINBATTLE]
	and a
	jp z,ItemUseNotTime ; not in battle
	dec a
	jp nz,ThrowBallAtTrainerMon
	ld a,[W_BATTLETYPE]
	dec a
	jr z,.UseBall
	ld a,[W_NUMINPARTY]	;is Party full?
	cp a,6
	jr nz,.UseBall
	ld a,[W_NUMINBOX]	;is Box full?
	cp a,20
	jp z,BoxFullCannotThrowBall
.UseBall	;$56a7
;ok, you can use a ball
	xor a
	ld [$d11c],a
	ld a,[W_BATTLETYPE]
	cp a,2		;SafariBattle
	jr nz,.skipSafariZoneCode
.safariZone
	; remove a Safari Ball from inventory
	ld hl,W_NUMSAFARIBALLS
	dec [hl]
.skipSafariZoneCode	;$56b6
	call GoPAL_SET_CF1C
	ld a,$43
	ld [$d11e],a
	call LoadScreenTilesFromBuffer1	;restore screenBuffer from Backup
	ld hl,ItemUseText00
	call PrintText
	ld hl, Function583A
	ld b, BANK(Function583A)
	call Bankswitch
	ld b,$10
	jp z,.next12
	ld a,[W_BATTLETYPE]
	dec a
	jr nz,.notOldManBattle
.oldManBattle
	ld hl,W_GRASSRATE
	ld de,W_PLAYERNAME
	ld bc,11
	call CopyData ; save the player's name in the Wild Monster data (part of the Cinnabar Island Missingno glitch)
	jp .BallSuccess	;$578b
.notOldManBattle	;$56e9
	ld a,[W_CURMAP]
	cp a,POKEMONTOWER_6
	jr nz,.loop
	ld a,[W_ENEMYMONID]
	cp a,MAROWAK
	ld b,$10
	jp z,.next12
; if not fighting ghost Marowak, loop until a random number in the current
; pokeball's allowed range is found
.loop	;$56fa
	call GenRandom
	ld b,a
	ld hl,$cf91
	ld a,[hl]
	cp a,MASTER_BALL
	jp z,.BallSuccess	;$578b
	cp a,POKE_BALL
	jr z,.checkForAilments
	ld a,200
	cp b
	jr c,.loop	;get only numbers <= 200 for Great Ball
	ld a,[hl]
	cp a,GREAT_BALL
	jr z,.checkForAilments
	ld a,150	;get only numbers <= 150 for Ultra Ball
	cp b
	jr c,.loop
.checkForAilments	;$571a
; pokemon can be caught more easily with any (primary) status ailment
; Frozen/Asleep pokemon are relatively even easier to catch
; for Frozen/Asleep pokemon, any random number from 0-24 ensures a catch.
; for the others, a random number from 0-11 ensures a catch.
	ld a,[W_ENEMYMONSTATUS]	;status ailments
	and a
	jr z,.noAilments
	and a,(FRZ + SLP)	;is frozen and/or asleep?
	ld c,12
	jr z,.notFrozenOrAsleep
	ld c,25
.notFrozenOrAsleep	;$5728
	ld a,b
	sub c
	jp c,.BallSuccess	;$578b
	ld b,a
.noAilments	;$572e
	push bc		;save RANDOM number
	xor a
	ld [H_MULTIPLICAND],a
	ld hl,W_ENEMYMONMAXHP
	ld a,[hli]
	ld [H_MULTIPLICAND + 1],a
	ld a,[hl]
	ld [H_MULTIPLICAND + 2],a
	ld a,255
	ld [H_MULTIPLIER],a
	call Multiply	; MaxHP * 255
	ld a,[$cf91]
	cp a,GREAT_BALL
	ld a,12		;any other BallFactor
	jr nz,.next7
	ld a,8
.next7	;$574d
	ld [H_DIVISOR],a
	ld b,4		; number of bytes in dividend
	call Divide
	ld hl,W_ENEMYMONCURHP
	ld a,[hli]
	ld b,a
	ld a,[hl]

; explanation: we have a 16-bit value equal to [b << 8 | a].
; This number is divided by 4. The result is 8 bit (reg. a).
; Always bigger than zero.
	srl b
	rr a
	srl b
	rr a ; a = current HP / 4
	and a
	jr nz,.next8
	inc a
.next8	;$5766
	ld [H_DIVISOR],a
	ld b,4
	call Divide	; ((MaxHP * 255) / BallFactor) / (CurHP / 4)
	ld a,[H_QUOTIENT + 2]
	and a
	jr z,.next9
	ld a,255
	ld [H_QUOTIENT + 3],a
.next9	;$5776
	pop bc
	ld a,[$d007]	;enemy: Catch Rate
	cp b
	jr c,.next10
	ld a,[H_QUOTIENT + 2]
	and a
	jr nz,.BallSuccess ; if ((MaxHP * 255) / BallFactor) / (CurHP / 4) > 0x255, automatic success
	call GenRandom
	ld b,a
	ld a,[H_QUOTIENT + 3]
	cp b
	jr c,.next10
.BallSuccess	;$578b
	jr .BallSuccess2
.next10	;$578d
	ld a,[H_QUOTIENT + 3]
	ld [$d11e],a
	xor a
	ld [H_MULTIPLICAND],a
	ld [H_MULTIPLICAND + 1],a
	ld a,[$d007]	;enemy: Catch Rate
	ld [H_MULTIPLICAND + 2],a
	ld a,100
	ld [H_MULTIPLIER],a
	call Multiply	; CatchRate * 100
	ld a,[$cf91]
	ld b,255
	cp a,POKE_BALL
	jr z,.next11
	ld b,200
	cp a,GREAT_BALL
	jr z,.next11
	ld b,150
	cp a,ULTRA_BALL
	jr z,.next11
.next11	;$57b8
	ld a,b
	ld [H_DIVISOR],a
	ld b,4
	call Divide
	ld a,[H_QUOTIENT + 2]
	and a
	ld b,$63
	jr nz,.next12
	ld a,[$d11e]
	ld [H_MULTIPLIER],a
	call Multiply
	ld a,255
	ld [H_DIVISOR],a
	ld b,4
	call Divide
	ld a,[W_ENEMYMONSTATUS]	;status ailments
	and a
	jr z,.next13
	and a,(FRZ + SLP)
	ld b,5
	jr z,.next14
	ld b,10
.next14	;$57e6
	ld a,[H_QUOTIENT + 3]
	add b
	ld [H_QUOTIENT + 3],a
.next13	;$57eb
	ld a,[H_QUOTIENT + 3]
	cp a,10
	ld b,$20
	jr c,.next12
	cp a,30
	ld b,$61
	jr c,.next12
	cp a,70
	ld b,$62
	jr c,.next12
	ld b,$63
.next12	;$5801
	ld a,b
	ld [$d11e],a
.BallSuccess2	;$5805
	ld c,20
	call DelayFrames
	ld a,TOSS_ANIM
	ld [W_ANIMATIONID],a
	xor a
	ld [$fff3],a
	ld [$cc5b],a
	ld [$d05b],a
	ld a,[$cf92]
	push af
	ld a,[$cf91]
	push af
	ld a,$08	;probably animations
	call Predef
	pop af
	ld [$cf91],a
	pop af
	ld [$cf92],a
	ld a,[$d11e]
	cp a,$10
	ld hl,ItemUseBallText00
	jp z,.printText0
	cp a,$20
	ld hl,ItemUseBallText01
	jp z,.printText0
	cp a,$61
	ld hl,ItemUseBallText02
	jp z,.printText0
	cp a,$62
	ld hl,ItemUseBallText03
	jp z,.printText0
	cp a,$63
	ld hl,ItemUseBallText04
	jp z,.printText0
	ld hl,$cfe6	;current HP
	ld a,[hli]
	push af
	ld a,[hli]
	push af		;backup currentHP...
	inc hl
	ld a,[hl]
	push af		;...and status ailments
	push hl
	ld hl,$d069
	bit 3,[hl]
	jr z,.next15
	ld a,$4c
	ld [W_ENEMYMONID],a
	jr .next16
.next15	;$5871
	set 3,[hl]
	ld hl,$cceb
	ld a,[$cff1]
	ld [hli],a
	ld a,[$cff2]
	ld [hl],a
.next16	;$587e
	ld a,[$cf91]
	push af
	ld a,[W_ENEMYMONID]
	ld [$cf91],a
	ld a,[$cff3]
	ld [$d127],a
	ld hl, Func_3eb01
	ld b, BANK(Func_3eb01)
	call Bankswitch
	pop af
	ld [$cf91],a
	pop hl
	pop af
	ld [hld],a
	dec hl
	pop af
	ld [hld],a
	pop af
	ld [hl],a
	ld a,[$cfe5]	;enemy
	ld [$d11c],a
	ld [$cf91],a
	ld [$d11e],a
	ld a,[W_BATTLETYPE]
	dec a
	jr z,.printText1
	ld hl,ItemUseBallText05
	call PrintText
	ld a,$3a	;convert order: Internal->Dex
	call Predef
	ld a,[$d11e]
	dec a
	ld c,a
	ld b,2
	ld hl,$d2f7	;Dex_own_flags (pokemon)
	ld a,$10
	call Predef	;check Dex flag (own already or not)
	ld a,c
	push af
	ld a,[$d11e]
	dec a
	ld c,a
	ld b,1
	ld a,$10	;set Dex_own_flag?
	call Predef
	pop af
	and a
	jr nz,.checkParty
	ld hl,ItemUseBallText06
	call PrintText
	call CleanLCD_OAM
	ld a,[$cfe5]	;caught mon_ID
	ld [$d11e],a
	ld a,$3d
	call Predef
.checkParty	;$58f4
	ld a,[W_NUMINPARTY]
	cp a,6		;is party full?
	jr z,.sendToBox
	xor a
	ld [$cc49],a
	call CleanLCD_OAM
	call AddPokemonToParty	;add mon to Party
	jr .End
.sendToBox	;$5907
	call CleanLCD_OAM
	call Func_e7a4
	ld hl,ItemUseBallText07
	ld a,[$d7f1]
	bit 0,a		;already met Bill?
	jr nz,.sendToBox2
	ld hl,ItemUseBallText08
.sendToBox2	;$591a
	call PrintText
	jr .End
.printText1	;$591f
	ld hl,ItemUseBallText05
.printText0	;$5922
	call PrintText
	call CleanLCD_OAM
.End	;$5928
	ld a,[W_BATTLETYPE]
	and a
	ret nz
	ld hl,$d31d
	inc a
	ld [$cf96],a
	jp RemoveItemFromInventory	;remove ITEM (XXX)
ItemUseBallText00: ; d937 (3:5937)
;"It dodged the thrown ball!"
;"This pokemon can't be caught"
	TX_FAR _ItemUseBallText00
	db "@"
ItemUseBallText01: ; d93c (3:593c)
;"You missed the pokemon!"
	TX_FAR _ItemUseBallText01
	db "@"
ItemUseBallText02: ; d941 (3:5941)
;"Darn! The pokemon broke free!"
	TX_FAR _ItemUseBallText02
	db "@"
ItemUseBallText03: ; d946 (3:5946)
;"Aww! It appeared to be caught!"
	TX_FAR _ItemUseBallText03
	db "@"
ItemUseBallText04: ; d94b (3:594b)
;"Shoot! It was so close too!"
	TX_FAR _ItemUseBallText04
	db "@"
ItemUseBallText05: ; d950 (3:5950)
;"All right! {MonName} was caught!"
;play sound
	TX_FAR _ItemUseBallText05
	db $12,$06
	db "@"
ItemUseBallText07: ; d957 (3:5957)
;"X was transferred to Bill's PC"
	TX_FAR _ItemUseBallText07
	db "@"
ItemUseBallText08: ; d95c (3:595c)
;"X was transferred to someone's PC"
	TX_FAR _ItemUseBallText08
	db "@"

ItemUseBallText06: ; d961 (3:5961)
;"New DEX data will be added..."
;play sound
	TX_FAR _ItemUseBallText06
	db $13,$06
	db "@"

ItemUseTownMap: ; d968 (3:5968)
	ld a,[W_ISINBATTLE]
	and a
	jp nz,ItemUseNotTime
	ld b, BANK(Func_70e3e)
	ld hl, Func_70e3e
	jp Bankswitch ; display Town Map

ItemUseBicycle: ; d977 (3:5977)
	ld a,[W_ISINBATTLE]
	and a
	jp nz,ItemUseNotTime
	ld a,[$d700]
	ld [$d11a],a
	cp a,2 ; is the player surfing?
	jp z,ItemUseNotTime
	dec a ; is player already bicycling?
	jr nz,.tryToGetOnBike
.getOffBike
	call ItemUseReloadOverworldData
	xor a
	ld [$d700],a ; change player state to walking
	call Func_2307 ; play walking music
	ld hl,GotOffBicycleText
	jr .printText
.tryToGetOnBike
	call IsBikeRidingAllowed
	jp nc,NoCyclingAllowedHere
	call ItemUseReloadOverworldData
	xor a ; no keys pressed
	ld [H_CURRENTPRESSEDBUTTONS],a ; current joypad state
	inc a
	ld [$d700],a ; change player state to bicycling
	ld hl,GotOnBicycleText
	call Func_2307 ; play bike riding music
.printText
	jp PrintText

; used for Surf out-of-battle effect
ItemUseSurfboard: ; d9b4 (3:59b4)
	ld a,[$d700]
	ld [$d11a],a
	cp a,2 ; is the player already surfing?
	jr z,.tryToStopSurfing
.tryToSurf
	call IsNextTileShoreOrWater
	jp c,SurfingAttemptFailed
	ld hl,TilePairCollisionsWater
	call CheckForTilePairCollisions
	jp c,SurfingAttemptFailed
.surf
	call .makePlayerMoveForward
	ld hl,$d730
	set 7,[hl]
	ld a,2
	ld [$d700],a ; change player state to surfing
	call Func_2307 ; play surfing music
	ld hl,SurfingGotOnText
	jp PrintText
.tryToStopSurfing
	xor a
	ld [$ff8c],a
	ld d,16 ; talking range in pixels (normal range)
	call IsSpriteInFrontOfPlayer2
	res 7,[hl]
	ld a,[$ff8c]
	and a ; is there a sprite in the way?
	jr nz,.cannotStopSurfing
	ld hl,TilePairCollisionsWater
	call CheckForTilePairCollisions
	jr c,.cannotStopSurfing
	ld hl,$d530 ; pointer to list of passable tiles
	ld a,[hli]
	ld h,[hl]
	ld l,a ; hl now points to passable tiles
	ld a,[$cfc6] ; tile in front of the player
	ld b,a
.passableTileLoop
	ld a,[hli]
	cp b
	jr z,.stopSurfing
	cp a,$ff
	jr nz,.passableTileLoop
.cannotStopSurfing
	ld hl,SurfingNoPlaceToGetOffText
	jp PrintText
.stopSurfing
	call .makePlayerMoveForward
	ld hl,$d730
	set 7,[hl]
	xor a
	ld [$d700],a ; change player state to walking
	dec a
	ld [W_JOYPADFORBIDDENBUTTONSMASK],a
	call Func_2307 ; play walking music
	jp LoadWalkingPlayerSpriteGraphics
; uses a simulated button press to make the player move forward
.makePlayerMoveForward
	ld a,[$d52a] ; direction the player is going
	bit 3,a
	ld b,%01000000 ; Up key
	jr nz,.storeSimulatedButtonPress
	bit 2,a
	ld b,%10000000 ; Down key
	jr nz,.storeSimulatedButtonPress
	bit 1,a
	ld b,%00100000 ; Left key
	jr nz,.storeSimulatedButtonPress
	ld b,%00010000 ; Right key
.storeSimulatedButtonPress
	ld a,b
	ld [$ccd3],a ; base address of simulated button presses
	xor a
	ld [$cd39],a
	inc a
	ld [$cd38],a ; index of current simulated button press
	ret

SurfingGotOnText: ; da4c (3:5a4c)
	TX_FAR _SurfingGotOnText
	db $50

SurfingNoPlaceToGetOffText: ; da51 (3:5a51)
	TX_FAR _SurfingNoPlaceToGetOffText
	db $50

ItemUsePokedex: ; da56 (3:5a56)
	ld a,$29
	jp Predef

ItemUseEvoStone: ; da5b (3:5a5b)
	ld a,[W_ISINBATTLE]
	and a
	jp nz,ItemUseNotTime
	ld a,[$cf92]
	push af
	ld a,[$cf91]
	ld [$d156],a
	push af
	ld a,$05 ; evolution stone party menu
	ld [$d07d],a
	ld a,$ff
	ld [$cfcb],a
	call DisplayPartyMenu
	pop bc
	jr c,.canceledItemUse
	ld a,b
	ld [$cf91],a
	ld a,$01
	ld [$ccd4],a
	ld a,$8e
	call PlaySoundWaitForCurrent ; play sound
	call WaitForSoundToFinish ; wait for sound to end
	ld hl, Func_3ad0e
	ld b, BANK(Func_3ad0e)
	call Bankswitch ; try to evolve pokemon
	ld a,[$d121]
	and a
	jr z,.noEffect
	pop af
	ld [$cf92],a
	ld hl,W_NUMBAGITEMS
	ld a,1 ; remove 1 stone
	ld [$cf96],a
	jp RemoveItemFromInventory
.noEffect
	call ItemUseNoEffect
.canceledItemUse
	xor a
	ld [$cd6a],a
	pop af
	ret

ItemUseVitamin: ; dab4 (3:5ab4)
	ld a,[W_ISINBATTLE]
	and a
	jp nz,ItemUseNotTime

ItemUseMedicine: ; dabb (3:5abb)
	ld a,[W_NUMINPARTY]
	and a
	jp z,.emptyParty
	ld a,[$cf92]
	push af
	ld a,[$cf91]
	push af
	ld a,$01
	ld [$d07d],a ; item use party menu
	ld a,$ff
	ld [$cfcb],a
	ld a,[$d152]
	and a ; using Softboiled?
	jr z,.notUsingSoftboiled
; if using softboiled
	call GoBackToPartyMenu
	jr .getPartyMonDataAddress
.emptyParty
	ld hl,.emptyPartyText
	xor a
	ld [$cd6a],a ; item use failed
	jp PrintText
.emptyPartyText
	db $0,"You don't have",$4F
	db "any #MON!",$58
.notUsingSoftboiled
	call DisplayPartyMenu
.getPartyMonDataAddress
	jp c,.canceledItemUse
	ld hl,W_PARTYMON1DATA
	ld bc,44
	ld a,[$cf92]
	call AddNTimes
	ld a,[$cf92]
	ld [$cf06],a
	ld d,a
	ld a,[$cf91]
	ld e,a
	ld [$d0b5],a
	pop af
	ld [$cf91],a
	pop af
	ld [$cf92],a
	ld a,[$d152]
	and a ; using Softboiled?
	jr z,.checkItemType
; if using softboiled
	ld a,[$cf92]
	cp d ; is the pokemon trying to use softboiled on itself?
	jr z,ItemUseMedicine ; if so, force another choice
.checkItemType
	ld a,[$cf91]
	cp a,REVIVE
	jr nc,.healHP ; if it's a Revive or Max Revive
	cp a,FULL_HEAL
	jr z,.cureStatusAilment ; if it's a Full Heal
	cp a,HP_UP
	jp nc,.useVitamin ; if it's a vitamin or Rare Candy
	cp a,FULL_RESTORE
	jr nc,.healHP ; if it's a Full Restore or one of the potions
; fall through if it's one of the status-specifc healing items
.cureStatusAilment
	ld bc,4
	add hl,bc ; hl now points to status
	ld a,[$cf91]
	ld bc,$f008
	cp a,ANTIDOTE
	jr z,.checkMonStatus
	ld bc,$f110
	cp a,BURN_HEAL
	jr z,.checkMonStatus
	ld bc,$f220
	cp a,ICE_HEAL
	jr z,.checkMonStatus
	ld bc,$f307
	cp a,AWAKENING
	jr z,.checkMonStatus
	ld bc,$f440
	cp a,PARLYZ_HEAL
	jr z,.checkMonStatus
	ld bc,$f6ff ; Full Heal
.checkMonStatus
	ld a,[hl] ; pokemon's status
	and c ; does the pokemon have a status ailment the item can cure?
	jp z,.healingItemNoEffect
; if the pokemon has a status the item can heal
	xor a
	ld [hl],a ; remove the status ailment in the party data
	ld a,b
	ld [$d07d],a ; the message to display for the item used
	ld a,[W_PLAYERMONNUMBER]
	cp d ; is pokemon the item was used on active in battle?
	jp nz,.doneHealing
; if it is active in battle
	xor a
	ld [W_PLAYERMONSTATUS],a ; remove the status ailment in the in-battle pokemon data
	push hl
	ld hl,W_PLAYERBATTSTATUS3
	res 0,[hl] ; heal Toxic status
	pop hl
	ld bc,30
	add hl,bc ; hl now points to party stats
	ld de,W_PLAYERMONMAXHP
	ld bc,10
	call CopyData ; copy party stats to in-battle stat data
	ld a,$28
	call Predef
	jp .doneHealing
.healHP
	inc hl ; hl = address of current HP
	ld a,[hli]
	ld b,a
	ld [W_HPBAROLDHP+1],a
	ld a,[hl]
	ld c,a
	ld [W_HPBAROLDHP],a ; current HP stored at $ceeb (2 bytes, big-endian)
	or b
	jr nz,.notFainted
.fainted
	ld a,[$cf91]
	cp a,REVIVE
	jr z,.updateInBattleFaintedData
	cp a,MAX_REVIVE
	jr z,.updateInBattleFaintedData
	jp .healingItemNoEffect
.updateInBattleFaintedData
	ld a,[W_ISINBATTLE]
	and a
	jr z,.compareCurrentHPToMaxHP
	push hl
	push de
	push bc
	ld a,[$cf06]
	ld c,a
	ld hl,$ccf5
	ld b,$02
	ld a,$10
	call Predef
	ld a,c
	and a
	jr z,.next
	ld a,[$cf06]
	ld c,a
	ld hl,W_PLAYERMONSALIVEFLAGS
	ld b,$01
	ld a,$10
	call Predef
.next
	pop bc
	pop de
	pop hl
	jr .compareCurrentHPToMaxHP
.notFainted
	ld a,[$cf91]
	cp a,REVIVE
	jp z,.healingItemNoEffect
	cp a,MAX_REVIVE
	jp z,.healingItemNoEffect
.compareCurrentHPToMaxHP
	push hl
	push bc
	ld bc,32
	add hl,bc ; hl now points to max HP
	pop bc
	ld a,[hli]
	cp b
	jr nz,.skipComparingLSB ; no need to compare the LSB's if the MSB's don't match
	ld a,[hl]
	cp c
.skipComparingLSB
	pop hl
	jr nz,.notFullHP
.fullHP ; if the pokemon's current HP equals its max HP
	ld a,[$cf91]
	cp a,FULL_RESTORE
	jp nz,.healingItemNoEffect
	inc hl
	inc hl
	ld a,[hld] ; status ailment
	and a ; does the pokemon have a status ailment?
	jp z,.healingItemNoEffect
	ld a,FULL_HEAL
	ld [$cf91],a
	dec hl
	dec hl
	dec hl
	jp .cureStatusAilment
.notFullHP ; if the pokemon's current HP doesn't equal its max HP
	xor a
	ld [$d083],a
	ld [$c02a],a
	push hl
	push de
	ld bc,32
	add hl,bc ; hl now points to max HP
	ld a,[hli]
	ld [W_HPBARMAXHP+1],a
	ld a,[hl]
	ld [W_HPBARMAXHP],a ; max HP stored at $cee9 (2 bytes, big-endian)
	ld a,[$d152]
	and a ; using Softboiled?
	jp z,.notUsingSoftboiled2
; if using softboiled
	ld hl,W_HPBARMAXHP
	ld a,[hli]
	push af
	ld a,[hli]
	push af
	ld a,[hli]
	push af
	ld a,[hl]
	push af
	ld hl,W_PARTYMON1_MAXHP
	ld a,[$cf92]
	ld bc,44
	call AddNTimes
	ld a,[hli]
	ld [$ceea],a
	ld [H_DIVIDEND],a
	ld a,[hl]
	ld [W_HPBARMAXHP],a
	ld [H_DIVIDEND + 1],a
	ld a,5
	ld [H_DIVISOR],a
	ld b,2 ; number of bytes
	call Divide ; get 1/5 of max HP of pokemon that used Softboiled
	ld bc,-33
	add hl,bc ; hl now points to LSB of current HP of pokemon that used Softboiled
; subtract 1/5 of max HP from current HP of pokemon that used Softboiled
	ld a,[H_QUOTIENT + 3]
	push af
	ld b,a
	ld a,[hl]
	ld [W_HPBAROLDHP],a
	sub b
	ld [hld],a
	ld [W_HPBARNEWHP],a
	ld a,[H_QUOTIENT + 2]
	ld b,a
	ld a,[hl]
	ld [W_HPBAROLDHP+1],a
	sbc b
	ld [hl],a
	ld [W_HPBARNEWHP+1],a
	FuncCoord 4, 1 ; $c3b8
	ld hl,Coord
	ld a,[$cf92]
	ld bc,2 * 20
	call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled
	ld a,$8d
	call PlaySoundWaitForCurrent ; play sound
	ld a,[$fff6]
	set 0,a
	ld [$fff6],a
	ld a,$02
	ld [$cf94],a
	ld a,$48
	call Predef ; animate HP bar decrease of pokemon that used Softboiled
	ld a,[$fff6]
	res 0,a
	ld [$fff6],a
	pop af
	ld b,a ; store heal amount (1/5 of max HP)
	ld hl,$ceec
	pop af
	ld [hld],a
	pop af
	ld [hld],a
	pop af
	ld [hld],a
	pop af
	ld [hl],a
	jr .addHealAmount
.notUsingSoftboiled2
	ld a,[$cf91]
	cp a,SODA_POP
	ld b,60 ; Soda Pop heal amount
	jr z,.addHealAmount
	ld b,80 ; Lemonade heal amount
	jr nc,.addHealAmount
	cp a,FRESH_WATER
	ld b,50 ; Fresh Water heal amount
	jr z,.addHealAmount
	cp a,SUPER_POTION
	ld b,200 ; Hyper Potion heal amount
	jr c,.addHealAmount
	ld b,50 ; Super Potion heal amount
	jr z,.addHealAmount
	ld b,20 ; Potion heal amount
.addHealAmount
	pop de
	pop hl
	ld a,[hl]
	add b
	ld [hld],a
	ld [W_HPBARNEWHP],a
	ld a,[hl]
	ld [W_HPBARNEWHP+1],a
	jr nc,.noCarry
	inc [hl]
	ld a,[hl]
	ld [$ceee],a
.noCarry
	push de
	inc hl
	ld d,h
	ld e,l ; de now points to current HP
	ld hl,33
	add hl,de ; hl now points to max HP
	ld a,[$cf91]
	cp a,REVIVE
	jr z,.setCurrentHPToHalfMaxHP
	ld a,[hld]
	ld b,a
	ld a,[de]
	sub b
	dec de
	ld b,[hl]
	ld a,[de]
	sbc b
	jr nc,.setCurrentHPToMaxHp ; if current HP exceeds max HP after healing
	ld a,[$cf91]
	cp a,HYPER_POTION
	jr c,.setCurrentHPToMaxHp ; if using a Full Restore or Max Potion
	cp a,MAX_REVIVE
	jr z,.setCurrentHPToMaxHp ; if using a Max Revive
	jr .updateInBattleData
.setCurrentHPToHalfMaxHP
	dec hl
	dec de
	ld a,[hli]
	srl a
	ld [de],a
	ld [W_HPBARNEWHP+1],a
	ld a,[hl]
	rr a
	inc de
	ld [de],a
	ld [W_HPBARNEWHP],a
	dec de
	jr .doneHealingPartyHP
.setCurrentHPToMaxHp
	ld a,[hli]
	ld [de],a
	ld [W_HPBARNEWHP+1],a
	inc de
	ld a,[hl]
	ld [de],a
	ld [W_HPBARNEWHP],a
	dec de
.doneHealingPartyHP ; done updating the pokemon's current HP in the party data structure
	ld a,[$cf91]
	cp a,FULL_RESTORE
	jr nz,.updateInBattleData
	ld bc,-31
	add hl,bc
	xor a
	ld [hl],a ; remove the status ailment in the party data
.updateInBattleData
	ld h,d
	ld l,e
	pop de
	ld a,[W_PLAYERMONNUMBER]
	cp d ; is pokemon the item was used on active in battle?
	jr nz,.calculateHPBarCoords
; copy party HP to in-battle HP
	ld a,[hli]
	ld [W_PLAYERMONCURHP],a
	ld a,[hld]
	ld [W_PLAYERMONCURHP + 1],a
	ld a,[$cf91]
	cp a,FULL_RESTORE
	jr nz,.calculateHPBarCoords
	xor a
	ld [W_PLAYERMONSTATUS],a ; remove the status ailment in the in-battle pokemon data
.calculateHPBarCoords
	ld hl,$c390
	ld bc,2 * 20
	inc d
.calculateHPBarCoordsLoop
	add hl,bc
	dec d
	jr nz,.calculateHPBarCoordsLoop
	jr .doneHealing
.healingItemNoEffect
	call ItemUseNoEffect
	jp .done
.doneHealing
	ld a,[$d152]
	and a ; using Softboiled?
	jr nz,.skipRemovingItem ; no item to remove if using Softboiled
	push hl
	call RemoveUsedItem
	pop hl
.skipRemovingItem
	ld a,[$cf91]
	cp a,FULL_RESTORE
	jr c,.playStatusAilmentCuringSound
	cp a,FULL_HEAL
	jr z,.playStatusAilmentCuringSound
	ld a,$8d ; HP healing sound
	call PlaySoundWaitForCurrent ; play sound
	ld a,[$fff6]
	set 0,a
	ld [$fff6],a
	ld a,$02
	ld [$cf94],a
	ld a,$48
	call Predef ; animate the HP bar lengthening
	ld a,[$fff6]
	res 0,a
	ld [$fff6],a
	ld a,$f7 ; revived message
	ld [$d07d],a
	ld a,[$cf91]
	cp a,REVIVE
	jr z,.showHealingItemMessage
	cp a,MAX_REVIVE
	jr z,.showHealingItemMessage
	ld a,$f5 ; standard HP healed message
	ld [$d07d],a
	jr .showHealingItemMessage
.playStatusAilmentCuringSound
	ld a,$8e ; status ailment curing sound
	call PlaySoundWaitForCurrent ; play sound
.showHealingItemMessage
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a
	call ClearScreen
	dec a
	ld [$cfcb],a
	call RedrawPartyMenu ; redraws the party menu and displays the message
	ld a,1
	ld [H_AUTOBGTRANSFERENABLED],a
	ld c,50
	call DelayFrames
	call WaitForTextScrollButtonPress ; wait for a button press
	jr .done
.canceledItemUse
	xor a
	ld [$cd6a],a ; item use failed
	pop af
	pop af
.done
	ld a,[$d152]
	and a ; using Softboiled?
	ret nz ; if so, return
	call GBPalWhiteOut
	call z,GoPAL_SET_CF1C
	ld a,[W_ISINBATTLE]
	and a
	ret nz
	jp ReloadMapData ; restore saved screen
.useVitamin
	push hl
	ld a,[hl]
	ld [$d0b5],a
	ld [$d11e],a
	ld bc,33
	add hl,bc ; hl now points to level
	ld a,[hl] ; a = level
	ld [$d127],a ; store level
	call GetMonHeader
	push de
	ld a,d
	ld hl,W_PARTYMON1NAME
	call GetPartyMonName
	pop de
	pop hl
	ld a,[$cf91]
	cp a,RARE_CANDY
	jp z,.useRareCandy
	push hl
	sub a,HP_UP
	add a
	ld bc,17
	add hl,bc
	add l
	ld l,a
	jr nc,.noCarry2
	inc h
.noCarry2
	ld a,10
	ld b,a
	ld a,[hl] ; a = MSB of stat experience of the appropriate stat
	cp a,100 ; is there already at least 25600 (256 * 100) stat experience?
	jr nc,.vitaminNoEffect ; if so, vitamins can't add any more
	add b ; add 2560 (256 * 10) stat experience
	jr nc,.noCarry3 ; a carry should be impossible here, so this will always jump
	ld a,255
.noCarry3
	ld [hl],a
	pop hl
	call .recalculateStats
	ld hl,VitaminText
	ld a,[$cf91]
	sub a,HP_UP - 1
	ld c,a
.statNameLoop ; loop to get the address of the name of the stat the vitamin increases
	dec c
	jr z,.gotStatName
.statNameInnerLoop
	ld a,[hli]
	ld b,a
	ld a,$50
	cp b
	jr nz,.statNameInnerLoop
	jr .statNameLoop
.gotStatName
	ld de,$cf4b
	ld bc,10
	call CopyData ; copy the stat's name to $cf4b
	ld a,$8e
	call PlaySound ; play sound
	ld hl,VitaminStatRoseText
	call PrintText
	jp RemoveUsedItem
.vitaminNoEffect
	pop hl
	ld hl,VitaminNoEffectText
	call PrintText
	jp GBPalWhiteOut
.recalculateStats
	ld bc,34
	add hl,bc
	ld d,h
	ld e,l ; de now points to stats
	ld bc,-18
	add hl,bc ; hl now points to byte 3 of experience
	ld b,1
	jp CalcStats ; recalculate stats
.useRareCandy
	push hl
	ld bc,33
	add hl,bc ; hl now points to level
	ld a,[hl] ; a = level
	cp a,100
	jr z,.vitaminNoEffect ; can't raise level above 100
	inc a
	ld [hl],a ; store incremented level
	ld [$d127],a
	push hl
	push de
	ld d,a
	ld hl, CalcExperience
	ld b, BANK(CalcExperience)
	call Bankswitch ; calculate experience for next level and store it at $ff96
	pop de
	pop hl
	ld bc,-19
	add hl,bc ; hl now points to experience
; update experience to minimum for new level
	ld a,[$ff96]
	ld [hli],a
	ld a,[$ff97]
	ld [hli],a
	ld a,[$ff98]
	ld [hl],a
	pop hl
	ld a,[$cf92]
	push af
	ld a,[$cf91]
	push af
	push de
	push hl
	ld bc,34
	add hl,bc ; hl now points to MSB of max HP
	ld a,[hli]
	ld b,a
	ld c,[hl]
	pop hl
	push bc
	push hl
	call .recalculateStats
	pop hl
	ld bc,35 ; hl now points to LSB of max HP
	add hl,bc
	pop bc
	ld a,[hld]
	sub c
	ld c,a
	ld a,[hl]
	sbc b
	ld b,a ; bc = the amount of max HP gained from leveling up
; add the amount gained to the current HP
	ld de,-32
	add hl,de ; hl now points to MSB of current HP
	ld a,[hl]
	add c
	ld [hld],a
	ld a,[hl]
	adc b
	ld [hl],a
	ld a,$f8 ; level up message
	ld [$d07d],a
	call RedrawPartyMenu
	pop de
	ld a,d
	ld [$cf92],a
	ld a,e
	ld [$d11e],a
	xor a
	ld [$cc49],a ; load from player's party
	call LoadMonData
	ld d,$01
	ld hl, PrintStatsBox
	ld b, BANK(PrintStatsBox)
	call Bankswitch ; display new stats text box
	call WaitForTextScrollButtonPress ; wait for button press
	xor a
	ld [$cc49],a
	ld a,$1a
	call Predef ; learn level up move, if any
	xor a
	ld [$ccd4],a
	ld hl, Func_3ad0e
	ld b, BANK(Func_3ad0e)
	call Bankswitch ; evolve pokemon, if appropriate
	ld a,$01
	ld [$cfcb],a
	pop af
	ld [$cf91],a
	pop af
	ld [$cf92],a
	jp RemoveUsedItem

VitaminStatRoseText: ; df24 (3:5f24)
	TX_FAR _VitaminStatRoseText
	db $50

VitaminNoEffectText: ; df29 (3:5f29)
	TX_FAR _VitaminNoEffectText
	db $50

VitaminText: ; df2e (3:5f2e)
	db "HEALTH@"
	db "ATTACK@"
	db "DEFENSE@"
	db "SPEED@"
	db "SPECIAL@"

ItemUseBait: ; df52 (3:5f52)
	ld hl,ThrewBaitText
	call PrintText
	ld hl,$d007 ; catch rate
	srl [hl] ; halve catch rate
	ld a,BAIT_ANIM
	ld hl,$cce9 ; bait factor
	ld de,$cce8 ; escape factor
	jr BaitRockCommon

ItemUseRock: ; df67 (3:5f67)
	ld hl,ThrewRockText
	call PrintText
	ld hl,$d007 ; catch rate
	ld a,[hl]
	add a ; double catch rate
	jr nc,.noCarry
	ld a,$ff
.noCarry
	ld [hl],a
	ld a,ROCK_ANIM
	ld hl,$cce8 ; escape factor
	ld de,$cce9 ; bait factor

BaitRockCommon: ; df7f (3:5f7f)
	ld [W_ANIMATIONID],a
	xor a
	ld [$cc5b],a
	ld [H_WHOSETURN],a
	ld [de],a ; zero escape factor (for bait), zero bait factor (for rock)
.randomLoop ; loop until a random number less than 5 is generated
	call GenRandom
	and a,7
	cp a,5
	jr nc,.randomLoop
	inc a ; increment the random number, giving a range from 1 to 5 inclusive
	ld b,a
	ld a,[hl]
	add b ; increase bait factor (for bait), increase escape factor (for rock)
	jr nc,.noCarry
	ld a,$ff
.noCarry
	ld [hl],a
	ld a,$08
	call Predef ; do animation
	ld c,70
	jp DelayFrames

ThrewBaitText: ; dfa5 (3:5fa5)
	TX_FAR _ThrewBaitText
	db $50

ThrewRockText: ; dfaa (3:5faa)
	TX_FAR _ThrewRockText
	db $50

; also used for Dig out-of-battle effect
ItemUseEscapeRope: ; dfaf (3:5faf)
	ld a,[W_ISINBATTLE]
	and a
	jr nz,.notUsable
	ld a,[W_CURMAP]
	cp a,AGATHAS_ROOM
	jr z,.notUsable
	ld a,[W_CURMAPTILESET]
	ld b,a
	ld hl,EscapeRopeTilesets
.loop
	ld a,[hli]
	cp a,$ff
	jr z,.notUsable
	cp b
	jr nz,.loop
	ld hl,$d732
	set 3,[hl]
	set 6,[hl]
	ld hl,$d72e
	res 4,[hl]
	ld hl,$d790
	res 7,[hl] ; unset Safari Zone bit
	xor a
	ld [$da47],a
	ld [W_SAFARIZONEENTRANCECURSCRIPT],a
	inc a
	ld [$d078],a
	ld [$cd6a],a ; item used
	ld a,[$d152]
	and a ; using Dig?
	ret nz ; if so, return
	call ItemUseReloadOverworldData
	ld c,30
	call DelayFrames
	jp RemoveUsedItem
.notUsable
	jp ItemUseNotTime

EscapeRopeTilesets: ; dffd (3:5ffd)
	db $03,$0f,$11,$16,$10
	db $ff ; terminator

ItemUseRepel: ; e003 (3:6003)
	ld b,100

ItemUseRepelCommon: ; e005 (3:6005)
	ld a,[W_ISINBATTLE]
	and a
	jp nz,ItemUseNotTime
	ld a,b
	ld [$d0db],a
	jp PrintItemUseTextAndRemoveItem

; handles X Accuracy item
ItemUseXAccuracy: ; e013 (3:6013)
	ld a,[W_ISINBATTLE]
	and a
	jp z,ItemUseNotTime
	ld hl,W_PLAYERBATTSTATUS2
	set 0,[hl] ; X Accuracy bit
	jp PrintItemUseTextAndRemoveItem

; This function is bugged and never works. It always jumps to ItemUseNotTime.
; The Card Key is handled in a different way.
ItemUseCardKey: ; e022 (3:6022)
	xor a
	ld [$d71f],a
	call Func_c586
	ld a,[Func_c586] ; $4586
	cp a,$18
	jr nz,.next0
	ld hl,CardKeyTable1
	jr .next1
.next0
	cp a,$24
	jr nz,.next2
	ld hl,CardKeyTable2
	jr .next1
.next2
	cp a,$5e
	jp nz,ItemUseNotTime
	ld hl,CardKeyTable3
.next1
	ld a,[W_CURMAP]
	ld b,a
.loop
	ld a,[hli]
	cp a,$ff
	jp z,ItemUseNotTime
	cp b
	jr nz,.nextEntry1
	ld a,[hli]
	cp d
	jr nz,.nextEntry2
	ld a,[hli]
	cp e
	jr nz,.nextEntry3
	ld a,[hl]
	ld [$d71f],a
	jr .done
.nextEntry1
	inc hl
.nextEntry2
	inc hl
.nextEntry3
	inc hl
	jr .loop
.done
	ld hl,ItemUseText00
	call PrintText
	ld hl,$d728
	set 7,[hl]
	ret

; These tables are probably supposed to be door locations in Silph Co.,
; but they are unused.
; The reason there are 3 tables is unknown.

; Format:
; 00: Map ID
; 01: Y
; 02: X
; 03: ID?

CardKeyTable1: ; e072 (3:6072)
	db  SILPH_CO_2F,$04,$04,$00
	db  SILPH_CO_2F,$04,$05,$01
	db  SILPH_CO_4F,$0C,$04,$02
	db  SILPH_CO_4F,$0C,$05,$03
	db  SILPH_CO_7F,$06,$0A,$04
	db  SILPH_CO_7F,$06,$0B,$05
	db  SILPH_CO_9F,$04,$12,$06
	db  SILPH_CO_9F,$04,$13,$07
	db SILPH_CO_10F,$08,$0A,$08
	db SILPH_CO_10F,$08,$0B,$09
	db $ff

CardKeyTable2: ; e09b (3:609b)
	db SILPH_CO_3F,$08,$09,$0A
	db SILPH_CO_3F,$09,$09,$0B
	db SILPH_CO_5F,$04,$07,$0C
	db SILPH_CO_5F,$05,$07,$0D
	db SILPH_CO_6F,$0C,$05,$0E
	db SILPH_CO_6F,$0D,$05,$0F
	db SILPH_CO_8F,$08,$07,$10
	db SILPH_CO_8F,$09,$07,$11
	db SILPH_CO_9F,$08,$03,$12
	db SILPH_CO_9F,$09,$03,$13
	db $ff

CardKeyTable3: ; e0c4 (3:60c4)
	db SILPH_CO_11F,$08,$09,$14
	db SILPH_CO_11F,$09,$09,$15
	db $ff

ItemUsePokedoll: ; e0cd (3:60cd)
	ld a,[W_ISINBATTLE]
	dec a
	jp nz,ItemUseNotTime
	ld a,$01
	ld [$d078],a
	jp PrintItemUseTextAndRemoveItem

ItemUseGuardSpec: ; e0dc (3:60dc)
	ld a,[W_ISINBATTLE]
	and a
	jp z,ItemUseNotTime
	ld hl,W_PLAYERBATTSTATUS2
	set 1,[hl] ; Mist bit
	jp PrintItemUseTextAndRemoveItem

ItemUseSuperRepel: ; e0eb (3:60eb)
	ld b,200
	jp ItemUseRepelCommon

ItemUseMaxRepel: ; e0f0 (3:60f0)
	ld b,250
	jp ItemUseRepelCommon

ItemUseDireHit: ; e0f5 (3:60f5)
	ld a,[W_ISINBATTLE]
	and a
	jp z,ItemUseNotTime
	ld hl,W_PLAYERBATTSTATUS2
	set 2,[hl] ; Focus Energy bit
	jp PrintItemUseTextAndRemoveItem

ItemUseXStat: ; e104 (3:6104)
	ld a,[W_ISINBATTLE]
	and a
	jr nz,.inBattle
	call ItemUseNotTime
	ld a,2
	ld [$cd6a],a ; item not used
	ret
.inBattle
	ld hl,W_PLAYERMOVENUM
	ld a,[hli]
	push af ; save [W_PLAYERMOVENUM]
	ld a,[hl]
	push af ; save [W_PLAYERMOVEEFFECT]
	push hl
	ld a,[$cf91]
	sub a,X_ATTACK - ATTACK_UP1_EFFECT
	ld [hl],a ; store player move effect
	call PrintItemUseTextAndRemoveItem
	ld a,XSTATITEM_ANIM ; X stat item animation ID
	ld [W_PLAYERMOVENUM],a
	call LoadScreenTilesFromBuffer1 ; restore saved screen
	call Delay3
	xor a
	ld [H_WHOSETURN],a ; set turn to player's turn
	ld b, BANK(Func_3f428)
	ld hl, Func_3f428
	call Bankswitch ; do stat increase move
	pop hl
	pop af
	ld [hld],a ; restore [W_PLAYERMOVEEFFECT]
	pop af
	ld [hl],a ; restore [W_PLAYERMOVENUM]
	ret

ItemUsePokeflute: ; e140 (3:6140)
	ld a,[W_ISINBATTLE]
	and a
	jr nz,.inBattle
; if not in battle
	call ItemUseReloadOverworldData
	ld a,[W_CURMAP]
	cp a,ROUTE_12
	jr nz,.notRoute12
	ld a,[$d7d8]
	bit 7,a ; has the player beaten Route 12 Snorlax yet?
	jr nz,.noSnorlaxToWakeUp
; if the player hasn't beaten Route 12 Snorlax
	ld hl,Route12SnorlaxFluteCoords
	call ArePlayerCoordsInArray
	jr nc,.noSnorlaxToWakeUp
	ld hl,PlayedFluteHadEffectText
	call PrintText
	ld hl,$d7d8
	set 6,[hl] ; trigger Snorlax fight (handled by map script)
	ret
.notRoute12
	cp a,ROUTE_16
	jr nz,.noSnorlaxToWakeUp
	ld a,[$d7e0]
	bit 1,a ; has the player beaten Route 16 Snorlax yet?
	jr nz,.noSnorlaxToWakeUp
; if the player hasn't beaten Route 16 Snorlax
	ld hl,Route16SnorlaxFluteCoords
	call ArePlayerCoordsInArray
	jr nc,.noSnorlaxToWakeUp
	ld hl,PlayedFluteHadEffectText
	call PrintText
	ld hl,$d7e0
	set 0,[hl] ; trigger Snorlax fight (handled by map script)
	ret
.noSnorlaxToWakeUp
	ld hl,PlayedFluteNoEffectText
	jp PrintText
.inBattle
	xor a
	ld [$cd3d],a ; initialize variable that indicates if any pokemon were woken up to zero
	ld b,~SLP & $FF
	ld hl,W_PARTYMON1_STATUS
	call WakeUpEntireParty
	ld a,[W_ISINBATTLE]
	dec a ; is it a trainer battle?
	jr z,.skipWakingUpEnemyParty
; if it's a trainer battle
	ld hl,$d8a8 ; enemy party pokemon 1 status
	call WakeUpEntireParty
.skipWakingUpEnemyParty
	ld hl,W_PLAYERMONSTATUS
	ld a,[hl]
	and b ; remove Sleep status
	ld [hl],a
	ld hl,W_ENEMYMONSTATUS
	ld a,[hl]
	and b ; remove Sleep status
	ld [hl],a
	call LoadScreenTilesFromBuffer2 ; restore saved screen
	ld a,[$cd3d]
	and a ; were any pokemon asleep before playing the flute?
	ld hl,PlayedFluteNoEffectText
	jp z,PrintText ; if no pokemon were asleep
; if some pokemon were asleep
	ld hl,PlayedFluteHadEffectText
	call PrintText
	ld a,[$d083]
	and a,$80
	jr nz,.skipMusic
	call WaitForSoundToFinish ; wait for sound to end
	ld b, BANK(Func_22306)
	ld hl, Func_22306
	call Bankswitch ; play in-battle pokeflute music
.musicWaitLoop ; wait for music to finish playing
	ld a,[$c02c]
	and a ; music off?
	jr nz,.musicWaitLoop
.skipMusic
	ld hl,FluteWokeUpText
	jp PrintText

; wakes up all party pokemon
; INPUT:
; hl must point to status of first pokemon in party (player's or enemy's)
; b must equal ~SLP
; [$cd3d] should be initialized to 0
; OUTPUT:
; [$cd3d]: set to 1 if any pokemon were asleep
WakeUpEntireParty: ; e1e5 (3:61e5)
	ld de,44
	ld c,6
.loop
	ld a,[hl]
	push af
	and a,SLP ; is pokemon asleep?
	jr z,.notAsleep
	ld a,1
	ld [$cd3d],a ; indicate that a pokemon had to be woken up
.notAsleep
	pop af
	and b ; remove Sleep status
	ld [hl],a
	add hl,de
	dec c
	jr nz,.loop
	ret

; Format:
; 00: Y
; 01: X
Route12SnorlaxFluteCoords: ; e1fd (3:61fd)
	db 62,9  ; one space West of Snorlax
	db 61,10 ; one space North of Snorlax
	db 63,10 ; one space South of Snorlax
	db 62,11 ; one space East of Snorlax
	db $ff ; terminator

; Format:
; 00: Y
; 01: X
Route16SnorlaxFluteCoords: ; e206 (3:6206)
	db 10,27 ; one space East of Snorlax
	db 10,25 ; one space West of Snorlax
	db $ff ; terminator

PlayedFluteNoEffectText: ; e20b (3:620b)
	TX_FAR _PlayedFluteNoEffectText
	db $50

FluteWokeUpText: ; e210 (3:6210)
	TX_FAR _FluteWokeUpText
	db $50

PlayedFluteHadEffectText: ; e215 (3:6215)
	TX_FAR _PlayedFluteHadEffectText
	db $06
	db $08
	ld a,[W_ISINBATTLE]
	and a
	jr nz,.done
; play out-of-battle pokeflute music
	ld a,$ff
	call PlaySound ; turn off music
	ld a,$b8
	ld c,$02
	call PlayMusic ; play music
.musicWaitLoop ; wait for music to finish playing
	ld a,[$c028]
	cp a,$b8
	jr z,.musicWaitLoop 
	call Func_2307 ; start playing normal music again
.done
	jp TextScriptEnd ; end text

ItemUseCoinCase: ; e23a (3:623a)
	ld a,[W_ISINBATTLE]
	and a
	jp nz,ItemUseNotTime
	ld hl,CoinCaseNumCoinsText
	jp PrintText

CoinCaseNumCoinsText: ; e247 (3:6247)
	TX_FAR _CoinCaseNumCoinsText
	db $50

OldRodCode: ; e24c (3:624c)
	call FishingInit
	jp c, ItemUseNotTime
	ld bc, (5 << 8) | MAGIKARP
	ld a, $1 ; set bite
	jr RodResponse ; 0xe257 $34

GoodRodCode: ; e259 (3:6259)
	call FishingInit
	jp c,ItemUseNotTime
.RandomLoop
	call GenRandom
	srl a
	jr c, .SetBite
	and %11
	cp 2
	jr nc, .RandomLoop
	; choose which monster appears
	ld hl,GoodRodMons
	add a,a
	ld c,a
	ld b,0
	add hl,bc
	ld b,[hl]
	inc hl
	ld c,[hl]
	and a
.SetBite
	ld a,0
	rla
	xor 1
	jr RodResponse

GoodRodMons: ; e27f (3:627f)
	db 10,GOLDEEN
	db 10,POLIWAG

SuperRodCode: ; e283 (3:6283)
	call FishingInit
	jp c, ItemUseNotTime
	call ReadSuperRodData ; 0xe8ea
	ld a, e
RodResponse: ; e28d (3:628d)
	ld [$CD3D], a

	dec a ; is there a bite?
	jr nz, .next
	; if yes, store level and species data
	ld a, 1
	ld [$D05F], a
	ld a, b ; level
	ld [W_CURENEMYLVL], a
	ld a, c ; species
	ld [W_CUROPPONENT], a

.next
	ld hl, $D700
	ld a, [hl] ; store the value in a
	push af
	push hl
	ld [hl], 0
	ld b, BANK(Func_707b6)
	ld hl, Func_707b6
	call Bankswitch
	pop hl
	pop af
	ld [hl], a
	ret

; checks if fishing is possible and if so, runs initialization code common to all rods
; unsets carry if fishing is possible, sets carry if not
FishingInit: ; e2b4 (3:62b4)
	ld a,[W_ISINBATTLE]
	and a
	jr z,.notInBattle
	scf ; can't fish during battle
	ret
.notInBattle
	call IsNextTileShoreOrWater
	ret c
	ld a,[$d700]
	cp a,2 ; Surfing?
	jr z,.surfing
	call ItemUseReloadOverworldData
	ld hl,ItemUseText00
	call PrintText
	ld a,$8e
	call PlaySound ; play sound
	ld c,80
	call DelayFrames
	and a
	ret
.surfing
	scf ; can't fish when surfing
	ret

ItemUseOaksParcel: ; e2de (3:62de)
	jp ItemUseNotYoursToUse

ItemUseItemfinder: ; e2e1 (3:62e1)
	ld a,[W_ISINBATTLE]
	and a
	jp nz,ItemUseNotTime
	call ItemUseReloadOverworldData
	ld b,BANK(Unknown_7481f)
	ld hl,Unknown_7481f
	call Bankswitch ; check for hidden items
	ld hl,ItemfinderFoundNothingText
	jr nc,.printText ; if no hidden items
	ld c,4
.loop
	ld a,$9e
	call PlaySoundWaitForCurrent ; play sound
	ld a,$b2
	call PlaySoundWaitForCurrent ; play sound
	dec c
	jr nz,.loop
	ld hl,ItemfinderFoundItemText
.printText
	jp PrintText

ItemfinderFoundItemText: ; e30d (3:630d)
	TX_FAR _ItemfinderFoundItemText
	db $50

ItemfinderFoundNothingText: ; e312 (3:6312)
	TX_FAR _ItemfinderFoundNothingText
	db $50

ItemUsePPUp: ; e317 (3:6317)
	ld a,[W_ISINBATTLE]
	and a
	jp nz,ItemUseNotTime

ItemUsePPRestore: ; e31e (3:631e)
	ld a,[$cf92]
	push af
	ld a,[$cf91]
	ld [$cd3d],a
.chooseMon
	xor a
	ld [$cfcb],a
	ld a,$01 ; item use party menu
	ld [$d07d],a
	call DisplayPartyMenu
	jr nc,.chooseMove
	jp .itemNotUsed
.chooseMove
	ld a,[$cd3d]
	cp a,ELIXER
	jp nc,.useElixir ; if Elixir or Max Elixir
	ld a,$02
	ld [W_MOVEMENUTYPE],a
	ld hl,RaisePPWhichTechniqueText
	ld a,[$cd3d]
	cp a,ETHER ; is it a PP Up?
	jr c,.printWhichTechniqueMessage ; if so, print the raise PP message
	ld hl,RestorePPWhichTechniqueText ; otherwise, print the restore PP message
.printWhichTechniqueMessage
	call PrintText
	xor a
	ld [$cc2e],a
	ld hl, MoveSelectionMenu
	ld b, BANK(MoveSelectionMenu)
	call Bankswitch ; move selection menu
	ld a,0
	ld [$cc2e],a
	jr nz,.chooseMon
	ld hl,W_PARTYMON1_MOVE1
	ld bc,44
	call GetSelectedMoveOffset
	push hl
	ld a,[hl]
	ld [$d11e],a
	call GetMoveName
	call CopyStringToCF4B ; copy name to $cf4b
	pop hl
	ld a,[$cd3d]
	cp a,ETHER
	jr nc,.useEther ; if Ether or Max Ether
.usePPUp
	ld bc,21
	add hl,bc
	ld a,[hl] ; move PP
	cp a,3 << 6 ; have 3 PP Ups already been used?
	jr c,.PPNotMaxedOut
	ld hl,PPMaxedOutText
	call PrintText
	jr .chooseMove
.PPNotMaxedOut
	ld a,[hl]
	add a,1 << 6 ; increase PP Up count by 1
	ld [hl],a
	ld a,1 ; 1 PP Up used
	ld [$d11e],a
	call RestoreBonusPP ; add the bonus PP to current PP
	ld hl,PPIncreasedText
	call PrintText
.done
	pop af
	ld [$cf92],a
	call GBPalWhiteOut
	call GoPAL_SET_CF1C
	jp RemoveUsedItem
.afterRestoringPP ; after using a (Max) Ether/Elixir
	ld a,[$cf92]
	ld b,a
	ld a,[W_PLAYERMONNUMBER]
	cp b ; is the pokemon whose PP was restored active in battle?
	jr nz,.skipUpdatingInBattleData
	ld hl,W_PARTYMON1_MOVE1PP
	ld bc,44
	call AddNTimes
	ld de,W_PLAYERMONPP
	ld bc,4
	call CopyData ; copy party data to in-battle data
.skipUpdatingInBattleData
	ld a,$8e
	call PlaySound
	ld hl,PPRestoredText
	call PrintText
	jr .done
.useEther
	call .restorePP
	jr nz,.afterRestoringPP
	jp .noEffect
; unsets zero flag if PP was restored, sets zero flag if not
; however, this is bugged for Max Ethers and Max Elixirs (see below)
.restorePP
	xor a
	ld [$cc49],a ; party pokemon
	call GetMaxPP
	ld hl,W_PARTYMON1_MOVE1
	ld bc,44
	call GetSelectedMoveOffset
	ld bc,21
	add hl,bc ; hl now points to move's PP
	ld a,[$d11e]
	ld b,a ; b = max PP
	ld a,[$cd3d]
	cp a,MAX_ETHER
	jr z,.fullyRestorePP
	ld a,[hl] ; move PP
	and a,%00111111 ; lower 6 bit bits store current PP
	cp b ; does current PP equal max PP?
	ret z ; if so, return
	add a,10 ; increase current PP by 10
; b holds the max PP amount and b will hold the new PP amount.
; So, if the new amount meets or exceeds the max amount,
; cap the amount to the max amount by leaving b unchanged.
; Otherwise, store the new amount in b.
	cp b ; does the new amount meet or exceed the maximum?
	jr nc,.storeNewAmount
	ld b,a
.storeNewAmount
	ld a,[hl] ; move PP
	and a,%11000000 ; PP Up counter bits
	add b
	ld [hl],a
	ret
.fullyRestorePP
	ld a,[hl] ; move PP
; Note that this code has a bug. It doesn't mask out the upper two bits, which
; are used to count how many PP Ups have been used on the move. So, Max Ethers
; and Max Elixirs will not be detected as having no effect on a move with full
; PP if the move has had any PP Ups used on it.
	cp b ; does current PP equal max PP?
	ret z
	jr .storeNewAmount
.useElixir
; decrement the item ID so that ELIXER becomes ETHER and MAX_ELIXER becomes MAX_ETHER
	ld hl,$cd3d
	dec [hl]
	dec [hl]
	xor a
	ld hl,W_CURMENUITEMID
	ld [hli],a
	ld [hl],a ; zero the counter for number of moves that had their PP restored
	ld b,4
; loop through each move and restore PP
.elixirLoop
	push bc
	ld hl,W_PARTYMON1_MOVE1
	ld bc,44
	call GetSelectedMoveOffset
	ld a,[hl]
	and a ; does the current slot have a move?
	jr z,.nextMove
	call .restorePP
	jr z,.nextMove
; if some PP was restored
	ld hl,$cc27 ; counter for number of moves that had their PP restored
	inc [hl]
.nextMove
	ld hl,W_CURMENUITEMID
	inc [hl]
	pop bc
	dec b
	jr nz,.elixirLoop
	ld a,[$cc27]
	and a ; did any moves have their PP restored?
	jp nz,.afterRestoringPP
.noEffect
	call ItemUseNoEffect
.itemNotUsed
	call GBPalWhiteOut
	call GoPAL_SET_CF1C
	pop af
	xor a
	ld [$cd6a],a ; item use failed
	ret

RaisePPWhichTechniqueText: ; e45d (3:645d)
	TX_FAR _RaisePPWhichTechniqueText
	db $50

RestorePPWhichTechniqueText: ; e462 (3:6462)
	TX_FAR _RestorePPWhichTechniqueText
	db $50

PPMaxedOutText: ; e467 (3:6467)
	TX_FAR _PPMaxedOutText
	db $50

PPIncreasedText: ; e46c (3:646c)
	TX_FAR _PPIncreasedText
	db $50

PPRestoredText: ; e471 (3:6471)
	TX_FAR _PPRestoredText
	db $50

; for items that can't be used from the Item menu
UnusableItem: ; e476 (3:6476)
	jp ItemUseNotTime

ItemUseTMHM: ; e479 (3:6479)
	ld a,[W_ISINBATTLE]
	and a
	jp nz,ItemUseNotTime
	ld a,[$cf91]
	sub a,TM_01
	push af
	jr nc,.skipAdding
	add a,55 ; if item is an HM, add 55
.skipAdding
	inc a
	ld [$d11e],a
	ld a,$44
	call Predef ; get move ID from TM/HM ID
	ld a,[$d11e]
	ld [$d0e0],a
	call GetMoveName
	call CopyStringToCF4B ; copy name to $cf4b
	pop af
	ld hl,BootedUpTMText
	jr nc,.printBootedUpMachineText
	ld hl,BootedUpHMText
.printBootedUpMachineText
	call PrintText
	ld hl,TeachMachineMoveText
	call PrintText
	FuncCoord 14,7
	ld hl,Coord
	ld bc,$080f
	ld a,$14
	ld [$d125],a
	call DisplayTextBoxID ; yes/no menu
	ld a,[W_CURMENUITEMID]
	and a
	jr z,.useMachine
	ld a,2
	ld [$cd6a],a ; item not used
	ret
.useMachine
	ld a,[$cf92]
	push af
	ld a,[$cf91]
	push af
.chooseMon
	ld hl,$cf4b
	ld de,$d036
	ld bc,14
	call CopyData
	ld a,$ff
	ld [$cfcb],a
	ld a,$03 ; teach TM/HM party menu
	ld [$d07d],a
	call DisplayPartyMenu
	push af
	ld hl,$d036
	ld de,$cf4b
	ld bc,14
	call CopyData
	pop af
	jr nc,.checkIfAbleToLearnMove
; if the player canceled teaching the move
	pop af
	pop af
	call GBPalWhiteOutWithDelay3
	call CleanLCD_OAM
	call GoPAL_SET_CF1C
	jp LoadScreenTilesFromBuffer1 ; restore saved screen
.checkIfAbleToLearnMove
	ld a,$43
	call Predef ; check if the pokemon can learn the move
	push bc
	ld a,[$cf92]
	ld hl,W_PARTYMON1NAME
	call GetPartyMonName
	pop bc
	ld a,c
	and a ; can the pokemon learn the move?
	jr nz,.checkIfAlreadyLearnedMove
; if the pokemon can't learn the move
	ld a,$a5
	call PlaySoundWaitForCurrent ; play sound
	ld hl,MonCannotLearnMachineMoveText
	call PrintText
	jr .chooseMon
.checkIfAlreadyLearnedMove
	ld hl, Func_2fe18
	ld b, BANK(Func_2fe18)
	call Bankswitch ; check if the pokemon already knows the move
	jr c,.chooseMon
	ld a,$1b
	call Predef ; teach move
	pop af
	ld [$cf91],a
	pop af
	ld [$cf92],a
	ld a,b
	and a
	ret z
	ld a,[$cf91]
	call IsItemHM
	ret c
	jp RemoveUsedItem

BootedUpTMText: ; e54f (3:654f)
	TX_FAR _BootedUpTMText
	db $50

BootedUpHMText: ; e554 (3:6554)
	TX_FAR _BootedUpHMText
	db $50

TeachMachineMoveText: ; e559 (3:6559)
	TX_FAR _TeachMachineMoveText
	db $50

MonCannotLearnMachineMoveText: ; e55e (3:655e)
	TX_FAR _MonCannotLearnMachineMoveText
	db $50

PrintItemUseTextAndRemoveItem: ; e563 (3:6563)
	ld hl,ItemUseText00
	call PrintText
	ld a,$8e
	call PlaySound ; play sound
	call WaitForTextScrollButtonPress ; wait for button press

RemoveUsedItem: ; e571 (3:6571)
	ld hl,W_NUMBAGITEMS
	ld a,1 ; one item
	ld [$cf96],a ; store quantity
	jp RemoveItemFromInventory

ItemUseNoEffect: ; e57c (3:657c)
	ld hl,ItemUseNoEffectText
	jr ItemUseFailed

ItemUseNotTime: ; e581 (3:6581)
	ld hl,ItemUseNotTimeText
	jr ItemUseFailed

ItemUseNotYoursToUse: ; e586 (3:6586)
	ld hl,ItemUseNotYoursToUseText
	jr ItemUseFailed

ThrowBallAtTrainerMon: ; e58b (3:658b)
	call GoPAL_SET_CF1C
	call LoadScreenTilesFromBuffer1 ; restore saved screen
	call Delay3
	ld a,TOSS_ANIM
	ld [W_ANIMATIONID],a
	ld a,$08
	call Predef ; do animation
	ld hl,ThrowBallAtTrainerMonText1
	call PrintText
	ld hl,ThrowBallAtTrainerMonText2
	call PrintText
	jr RemoveUsedItem

NoCyclingAllowedHere: ; e5ac (3:65ac)
	ld hl,NoCyclingAllowedHereText
	jr ItemUseFailed

BoxFullCannotThrowBall: ; e5b1 (3:65b1)
	ld hl,BoxFullCannotThrowBallText
	jr ItemUseFailed

SurfingAttemptFailed: ; e5b6 (3:65b6)
	ld hl,NoSurfingHereText

ItemUseFailed: ; e5b9 (3:65b9)
	xor a
	ld [$cd6a],a ; item use failed
	jp PrintText

ItemUseNotTimeText: ; e5c0 (3:65c0)
	TX_FAR _ItemUseNotTimeText
	db $50

ItemUseNotYoursToUseText: ; e5c5 (3:65c5)
	TX_FAR _ItemUseNotYoursToUseText
	db $50

ItemUseNoEffectText: ; e5ca (3:65ca)
	TX_FAR _ItemUseNoEffectText
	db $50

ThrowBallAtTrainerMonText1: ; e5cf (3:65cf)
	TX_FAR _ThrowBallAtTrainerMonText1
	db $50

ThrowBallAtTrainerMonText2: ; e5d4 (3:65d4)
	TX_FAR _ThrowBallAtTrainerMonText2
	db $50

NoCyclingAllowedHereText: ; e5d9 (3:65d9)
	TX_FAR _NoCyclingAllowedHereText
	db $50

NoSurfingHereText: ; e5de (3:65de)
	TX_FAR _NoSurfingHereText
	db $50

BoxFullCannotThrowBallText: ; e5e3 (3:65e3)
	TX_FAR _BoxFullCannotThrowBallText
	db $50

ItemUseText00: ; e5e8 (3:65e8)
	TX_FAR _ItemUseText001
	db $05
	TX_FAR _ItemUseText002
	db $50

GotOnBicycleText: ; e5f2 (3:65f2)
	TX_FAR _GotOnBicycleText1
	db $05
	TX_FAR _GotOnBicycleText2
	db $50

GotOffBicycleText: ; e5fc (3:65fc)
	TX_FAR _GotOffBicycleText1
	db $05
	TX_FAR _GotOffBicycleText2
	db $50

; restores bonus PP (from PP Ups) when healing at a pokemon center
; also, when a PP Up is used, it increases the current PP by one PP Up bonus
; INPUT:
; [$cf92] = index of pokemon in party
; [$d11e] = mode
; 0: Pokemon Center healing
; 1: using a PP Up
; [CURMENUITEMID] = index of move (when using a PP Up)
RestoreBonusPP: ; e606 (3:6606)
	ld hl,W_PARTYMON1_MOVE1
	ld bc,44
	ld a,[$cf92]
	call AddNTimes
	push hl
	ld de,$cd78 - 1
	ld a,$5e
	call Predef ; loads the normal max PP of each of the pokemon's moves to $cd78
	pop hl
	ld c,21
	ld b,0
	add hl,bc ; hl now points to move 1 PP
	ld de,$cd78
	ld b,0 ; initialize move counter to zero
; loop through the pokemon's moves
.loop
	inc b
	ld a,b
	cp a,5 ; reached the end of the pokemon's moves?
	ret z ; if so, return
	ld a,[$d11e]
	dec a ; using a PP Up?
	jr nz,.skipMenuItemIDCheck
; if using a PP Up, check if this is the move it's being used on
	ld a,[W_CURMENUITEMID]
	inc a
	cp b
	jr nz,.nextMove
.skipMenuItemIDCheck
	ld a,[hl]
	and a,%11000000 ; have any PP Ups been used?
	call nz,AddBonusPP ; if so, add bonus PP
.nextMove
	inc hl
	inc de
	jr .loop

; adds bonus PP from PP Ups to current PP
; 1/5 of normal max PP (capped at 7) is added for each PP Up
; INPUT:
; [de] = normal max PP
; [hl] = move PP
; [$d11e] = max number of times to add bonus
; set to 1 when using a PP Up, set to 255 otherwise
AddBonusPP: ; e642 (3:6642)
	push bc
	ld a,[de] ; normal max PP of move
	ld [H_DIVIDEND + 3],a
	xor a
	ld [H_DIVIDEND],a
	ld [H_DIVIDEND + 1],a
	ld [H_DIVIDEND + 2],a
	ld a,5
	ld [H_DIVISOR],a
	ld b,4
	call Divide
	ld a,[hl] ; move PP
	ld b,a
	swap a
	and a,%00001111
	srl a
	srl a
	ld c,a ; c = number of PP Ups used
.loop
	ld a,[H_QUOTIENT + 3]
	cp a,8 ; is the amount greater than or equal to 8?
	jr c,.addAmount
	ld a,7 ; cap the amount at 7
.addAmount
	add b
	ld b,a
	ld a,[$d11e]
	dec a
	jr z,.done
	dec c
	jr nz,.loop
.done
	ld [hl],b
	pop bc
	ret

; gets max PP of a pokemon's move (including PP from PP Ups)
; INPUT:
; [$cf92] = index of pokemon within party/box
; [$cc49] = pokemon source
; 00: player's party
; 01: enemy's party
; 02: current box
; 03: daycare
; 04: player's in-battle pokemon
; [W_CURMENUITEMID] = move index
; OUTPUT:
; [$d11e] = max PP
GetMaxPP: ; e677 (3:6677)
	ld a,[$cc49]
	and a
	ld hl,W_PARTYMON1_MOVE1
	ld bc,44
	jr z,.sourceWithMultipleMon
	ld hl,$d8ac ; enemy party
	dec a
	jr z,.sourceWithMultipleMon
	ld hl,$da9e ; current box
	ld bc,33
	dec a
	jr z,.sourceWithMultipleMon
	ld hl,$da67 ; daycare
	dec a
	jr z,.sourceWithOneMon
	ld hl,W_PLAYERMONMOVES ; player's in-battle pokemon
.sourceWithOneMon
	call GetSelectedMoveOffset2
	jr .next
.sourceWithMultipleMon
	call GetSelectedMoveOffset
.next
	ld a,[hl]
	dec a
	push hl
	ld hl,Moves
	ld bc,6
	call AddNTimes
	ld de,$cd6d
	ld a,BANK(Moves)
	call FarCopyData
	ld de,$cd72
	ld a,[de]
	ld b,a ; b = normal max PP
	pop hl
	push bc
	ld bc,21 ; PP offset if not player's in-battle pokemon data
	ld a,[$cc49]
	cp a,4 ; player's in-battle pokemon?
	jr nz,.addPPOffset
	ld bc,17 ; PP offset if player's in-battle pokemon data
.addPPOffset
	add hl,bc
	ld a,[hl] ; a = current PP
	and a,%11000000 ; get PP Up count
	pop bc
	or b ; place normal max PP in 6 lower bits of a
	ld h,d
	ld l,e
	inc hl ; hl = $cd73
	ld [hl],a
	xor a
	ld [$d11e],a ; no limit on PP Up amount
	call AddBonusPP ; add bonus PP from PP Ups
	ld a,[hl]
	and a,%00111111 ; mask out the PP Up count
	ld [$d11e],a ; store max PP
	ret

GetSelectedMoveOffset: ; e6e3 (3:66e3)
	ld a,[$cf92]
	call AddNTimes

GetSelectedMoveOffset2: ; e6e9 (3:66e9)
	ld a,[W_CURMENUITEMID]
	ld c,a
	ld b,0
	add hl,bc
	ret

; confirms the item toss and then tosses the item
; INPUT:
; hl = address of inventory (either W_NUMBAGITEMS or W_NUMBOXITEMS)
; [$cf91] = item ID
; [$cf92] = index of item within inventory
; [$cf96] = quantity to toss
; OUTPUT:
; clears carry flag if the item is tossed, sets carry flag if not
TossItem_: ; e6f1 (3:66f1)
	push hl
	ld a,[$cf91]
	call IsItemHM
	pop hl
	jr c,.tooImportantToToss
	push hl
	call IsKeyItem_
	ld a,[$d124]
	pop hl
	and a
	jr nz,.tooImportantToToss
	push hl
	ld a,[$cf91]
	ld [$d11e],a
	call GetItemName
	call CopyStringToCF4B ; copy name to $cf4b
	ld hl,IsItOKToTossItemText
	call PrintText
	FuncCoord 14,7
	ld hl,Coord
	ld bc,$080f
	ld a,$14
	ld [$d125],a
	call DisplayTextBoxID ; yes/no menu
	ld a,[$d12e]
	cp a,2
	pop hl
	scf
	ret z
; if the player chose Yes
	push hl
	ld a,[$cf92]
	call RemoveItemFromInventory
	ld a,[$cf91]
	ld [$d11e],a
	call GetItemName
	call CopyStringToCF4B ; copy name to $cf4b
	ld hl,ThrewAwayItemText
	call PrintText
	pop hl
	and a
	ret
.tooImportantToToss
	push hl
	ld hl,TooImportantToTossText
	call PrintText
	pop hl
	scf
	ret

ThrewAwayItemText: ; e755 (3:6755)
	TX_FAR _ThrewAwayItemText
	db $50

IsItOKToTossItemText: ; e75a (3:675a)
	TX_FAR _IsItOKToTossItemText
	db $50

TooImportantToTossText: ; e75f (3:675f)
	TX_FAR _TooImportantToTossText
	db $50

; checks if an item is a key item
; INPUT:
; [$cf91] = item ID
; OUTPUT:
; [$d124] = result
; 00: item is not key item
; 01: item is key item
IsKeyItem_: ; e764 (3:6764)
	ld a,$01
	ld [$d124],a
	ld a,[$cf91]
	cp a,HM_01 ; is the item an HM or TM?
	jr nc,.checkIfItemIsHM
; if the item is not an HM or TM
	push af
	ld hl,KeyItemBitfield
	ld de,$cee9
	ld bc,15 ; only 11 bytes are actually used
	call CopyData
	pop af
	dec a
	ld c,a
	ld hl,$cee9
	ld b,$02 ; test bit
	ld a,$10
	call Predef ; bitfield operation function
	ld a,c
	and a
	ret nz
.checkIfItemIsHM
	ld a,[$cf91]
	call IsItemHM
	ret c
	xor a
	ld [$d124],a
	ret

KeyItemBitfield: ; e799 (3:6799)
	db %11110000
	db %00000001
	db %11110000
	db %01001111
	db %00000000
	db %10011111
	db %00000000
	db %11000000
	db %11110000
	db %00111011
	db %00000000

; known jump sources: d90a (3:590a), 4fdd4 (13:7dd4)
Func_e7a4: ; e7a4 (3:67a4)
	ld de, W_NUMINBOX ; $da80
	ld a, [de]
	inc a
	ld [de], a
	ld a, [$cf91]
	ld [$d0b5], a
	ld c, a
.asm_e7b1
	inc de
	ld a, [de]
	ld b, a
	ld a, c
	ld c, b
	ld [de], a
	cp $ff
	jr nz, .asm_e7b1
	call GetMonHeader
	ld hl, $dd2a
	ld bc, $b
	ld a, [W_NUMINBOX] ; $da80
	dec a
	jr z, .asm_e7ee
	dec a
	call AddNTimes
	push hl
	ld bc, $b
	add hl, bc
	ld d, h
	ld e, l
	pop hl
	ld a, [W_NUMINBOX] ; $da80
	dec a
	ld b, a
.asm_e7db
	push bc
	push hl
	ld bc, $b
	call CopyData
	pop hl
	ld d, h
	ld e, l
	ld bc, $fff5
	add hl, bc
	pop bc
	dec b
	jr nz, .asm_e7db
.asm_e7ee
	ld hl, W_PLAYERNAME ; $d158
	ld de, $dd2a
	ld bc, $b
	call CopyData
	ld a, [W_NUMINBOX] ; $da80
	dec a
	jr z, .asm_e82a
	ld hl, $de06
	ld bc, $b
	dec a
	call AddNTimes
	push hl
	ld bc, $b
	add hl, bc
	ld d, h
	ld e, l
	pop hl
	ld a, [W_NUMINBOX] ; $da80
	dec a
	ld b, a
.asm_e817
	push bc
	push hl
	ld bc, $b
	call CopyData
	pop hl
	ld d, h
	ld e, l
	ld bc, $fff5
	add hl, bc
	pop bc
	dec b
	jr nz, .asm_e817
.asm_e82a
	ld hl, $de06
	ld a, $2
	ld [$d07d], a
	ld a, $4e
	call Predef ; indirect jump to Func_64eb (64eb (1:64eb))
	ld a, [W_NUMINBOX] ; $da80
	dec a
	jr z, .asm_e867
	ld hl, W_BOXMON1DATA
	ld bc, $21
	dec a
	call AddNTimes
	push hl
	ld bc, $21
	add hl, bc
	ld d, h
	ld e, l
	pop hl
	ld a, [W_NUMINBOX] ; $da80
	dec a
	ld b, a
.asm_e854
	push bc
	push hl
	ld bc, $21
	call CopyData
	pop hl
	ld d, h
	ld e, l
	ld bc, $ffdf
	add hl, bc
	pop bc
	dec b
	jr nz, .asm_e854
.asm_e867
	ld a, [W_ENEMYMONLEVEL] ; $cff3
	ld [W_ENEMYMONNUMBER], a ; $cfe8
	ld hl, $cfe5
	ld de, W_BOXMON1DATA
	ld bc, $c
	call CopyData
	ld hl, W_PLAYERIDHI ; $d359
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hl]
	ld [de], a
	inc de
	push de
	ld a, [W_CURENEMYLVL] ; $d127
	ld d, a
	ld hl, CalcExperience
	ld b, BANK(CalcExperience)
	call Bankswitch ; indirect jump to CalcExperience (58f6a (16:4f6a))
	pop de
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld [de], a
	inc de
	ld a, [$FF00+$97]
	ld [de], a
	inc de
	ld a, [$FF00+$98]
	ld [de], a
	inc de
	xor a
	ld b, $a
.asm_e89f
	ld [de], a
	inc de
	dec b
	jr nz, .asm_e89f
	ld hl, $cff1
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hli]
	ld [de], a
	ld hl, W_ENEMYMONPP ; $cffe
	ld b, $4
.asm_e8b1
	ld a, [hli]
	inc de
	ld [de], a
	dec b
	jr nz, .asm_e8b1
	ret
; e8b8 (3:68b8)
; checks if the tile in front of the player is a shore or water tile
; used for surfing and fishing
; unsets carry if it is, sets carry if not
IsNextTileShoreOrWater: ; e8b8 (3:68b8)
	ld a,[W_CURMAPTILESET]
	ld hl,WaterTilesets
	ld de,1
	call IsInArray
	jr nc,.notShoreOrWater
	ld a,[W_CURMAPTILESET]
	cp a,$0e ; Vermilion Dock tileset
	ld a,[$cfc6] ; tile in front of player
	jr z,.skipShoreTiles ; if it's the Vermilion Dock tileset
	cp a,$48 ; eastern shore tile in Safari Zone
	jr z,.shoreOrWater
	cp a,$32 ; usual eastern shore tile
	jr z,.shoreOrWater
.skipShoreTiles
	cp a,$14 ; water tile
	jr z,.shoreOrWater
.notShoreOrWater
	scf
	ret
.shoreOrWater
	and a
	ret

; tilesets with water
WaterTilesets: ; e8e0 (3:68e0)
	db $00,$03,$05,$07,$0d,$0e,$11,$16,$17
	db $ff ; terminator

; 68EA 0xe8ea
ReadSuperRodData: ; e8ea (3:68ea)
; return e = 2 if no fish on this map
; return e = 1 if a bite, bc = level,species
; return e = 0 if no bite
	ld a, [W_CURMAP]
	ld de, 3 ; each fishing group is three bytes wide
	ld hl, SuperRodData
	call IsInArray
	jr c, .ReadFishingGroup
	ld e, $2 ; $2 if no fishing groups found
	ret

.ReadFishingGroup ; 0xe8f6
; hl points to the fishing group entry in the index
	inc hl ; skip map id

	; read fishing group address
	ld a, [hli]
	ld h, [hl]
	ld l, a

	ld b, [hl] ; how many mons in group
	inc hl ; point to data
	ld e, $0 ; no bite yet

.RandomLoop ; 0xe90c
	call GenRandom
	srl a
	ret c ; 50% chance of no battle

	and %11 ; 2-bit random number
	cp b
	jr nc, .RandomLoop ; if a is greater than the number of mons, regenerate

	; get the mon
	add a
	ld c, a
	ld b, $0
	add hl, bc
	ld b, [hl] ; level
	inc hl
	ld c, [hl] ; species
	ld e, $1 ; $1 if there's a bite
	ret
; 0xe919

; super rod data
; format: map, pointer to fishing group
SuperRodData: ; e919 (3:6919)
	dbw PALLET_TOWN, FishingGroup1
	dbw VIRIDIAN_CITY, FishingGroup1
	dbw CERULEAN_CITY, FishingGroup3
	dbw VERMILION_CITY, FishingGroup4
	dbw CELADON_CITY, FishingGroup5
	dbw FUCHSIA_CITY, FishingGroup10
	dbw CINNABAR_ISLAND, FishingGroup8
	dbw ROUTE_4, FishingGroup3
	dbw ROUTE_6, FishingGroup4
	dbw ROUTE_10, FishingGroup5
	dbw ROUTE_11, FishingGroup4
	dbw ROUTE_12, FishingGroup7
	dbw ROUTE_13, FishingGroup7
	dbw ROUTE_17, FishingGroup7
	dbw ROUTE_18, FishingGroup7
	dbw ROUTE_19, FishingGroup8
	dbw ROUTE_20, FishingGroup8
	dbw ROUTE_21, FishingGroup8
	dbw ROUTE_22, FishingGroup2
	dbw ROUTE_23, FishingGroup9
	dbw ROUTE_24, FishingGroup3
	dbw ROUTE_25, FishingGroup3
	dbw CERULEAN_GYM, FishingGroup3
	dbw VERMILION_DOCK, FishingGroup4
;XXX syntax errors on the rest?
	dbw $A1, FishingGroup8 ; SEAFOAM_ISLANDS_4
	dbw $A2, FishingGroup8 ; SEAFOAM_ISLANDS_5
	dbw SAFARI_ZONE_EAST, FishingGroup6
	dbw $DA, FishingGroup6 ; SAFARI_ZONE_NORTH
	dbw SAFARI_ZONE_WEST, FishingGroup6 
	dbw $DC, FishingGroup6 ; SAFARI_ZONE_CENTER
	dbw $E2, FishingGroup9 ; UNKNOWN_DUNGEON_2
	dbw $E3, FishingGroup9 ; UNKNOWN_DUNGEON_3
	dbw $E4, FishingGroup9 ; UNKNOWN_DUNGEON_1
	db $FF

; fishing groups
; number of monsters, followed by level/monster pairs
FishingGroup1: ; e97d (3:697d)
	db 2
	db 15,TENTACOOL
	db 15,POLIWAG

FishingGroup2: ; e982 (3:6982)
	db 2
	db 15,GOLDEEN
	db 15,POLIWAG

FishingGroup3: ; e987 (3:6987)
	db 3
	db 15,PSYDUCK
	db 15,GOLDEEN
	db 15,KRABBY

FishingGroup4: ; e98e (3:698e)
	db 2
	db 15,KRABBY
	db 15,SHELLDER

FishingGroup5: ; e993 (3:6993)
	db 2
	db 23,POLIWHIRL
	db 15,SLOWPOKE

FishingGroup6: ; e998 (3:6998)
	db 4
	db 15,DRATINI
	db 15,KRABBY
	db 15,PSYDUCK
	db 15,SLOWPOKE

FishingGroup7: ; e9a1 (3:69a1)
	db 4
	db 5,TENTACOOL
	db 15,KRABBY
	db 15,GOLDEEN
	db 15,MAGIKARP

FishingGroup8: ; e9aa (3:69aa)
	db 4
	db 15,STARYU
	db 15,HORSEA
	db 15,SHELLDER
	db 15,GOLDEEN

FishingGroup9: ; e9b3 (3:69b3)
	db 4
	db 23,SLOWBRO
	db 23,SEAKING
	db 23,KINGLER
	db 23,SEADRA

FishingGroup10: ; e9bc (3:69bc)
	db 4
	db 23,SEAKING
	db 15,KRABBY
	db 15,GOLDEEN
	db 15,MAGIKARP

; reloads map view and processes sprite data
; for items that cause the overworld to be displayed
ItemUseReloadOverworldData: ; e9c5 (3:69c5)
	call LoadCurrentMapView
	jp UpdateSprites

; known jump sources: 711f4 (1c:51f4)
Func_e9cb: ; e9cb (3:69cb)
	ld hl, WildDataPointers ; $4eeb
	ld de, $cee9
	ld c, $0
.asm_e9d3
	inc hl
	ld a, [hld]
	inc a
	jr z, .asm_e9ec
	push hl
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld a, [hli]
	and a
	call nz, Func_e9f0
	ld a, [hli]
	and a
	call nz, Func_e9f0
	pop hl
	inc hl
	inc hl
	inc c
	jr .asm_e9d3
.asm_e9ec
	ld a, $ff
	ld [de], a
	ret

; known jump sources: e9de (3:69de), e9e3 (3:69e3)
Func_e9f0: ; e9f0 (3:69f0)
	inc hl
	ld b, $a
.asm_e9f3
	ld a, [$d11e]
	cp [hl]
	jr nz, .asm_e9fc
	ld a, c
	ld [de], a
	inc de
.asm_e9fc
	inc hl
	inc hl
	dec b
	jr nz, .asm_e9f3
	dec hl
	ret


DrawBadges: ; ea03 (3:6a03)
; Draw 4x2 gym leader faces, with the faces replaced by
; badges if they are owned. Used in the player status screen.

; In Japanese versions, names are displayed above faces.
; Instead of removing relevant code, the name graphics were erased.

; Tile ids for face/badge graphics.
	ld de, $cd3f
	ld hl, .FaceBadgeTiles
	ld bc, 8
	call CopyData

; Booleans for each badge.
	ld hl, $cd49
	ld bc, 8
	xor a
	call FillMemory

; Alter these based on owned badges.
	ld de, $cd49
	ld hl, $cd3f
	ld a, [W_OBTAINEDBADGES]
	ld b, a
	ld c, 8
.CheckBadge
	srl b
	jr nc, .NextBadge
	ld a, [hl]
	add 4 ; Badge graphics are after each face
	ld [hl], a
	ld a, 1
	ld [de], a
.NextBadge
	inc hl
	inc de
	dec c
	jr nz, .CheckBadge

; Draw two rows of badges.
	ld hl, $cd3d
	ld a, $d8 ; [1]
	ld [hli], a
	ld [hl], $60 ; First name

	FuncCoord 2, 11
	ld hl, Coord
	ld de, $cd49
	call .DrawBadgeRow

	FuncCoord 2, 14
	ld hl, Coord
	ld de, $cd49 + 4
;	call .DrawBadgeRow
;	ret
; ea4c

.DrawBadgeRow ; ea4c (3:6a4c)
; Draw 4 badges.

	ld c, 4
.DrawBadge
	push de
	push hl

; Badge no.
	ld a, [$cd3d]
	ld [hli], a
	inc a
	ld [$cd3d], a

; Names aren't printed if the badge is owned.
	ld a, [de]
	and a
	ld a, [$cd3e]
	jr nz, .SkipName
	call .PlaceTiles
	jr .PlaceBadge

.SkipName
	inc a
	inc a
	inc hl

.PlaceBadge
	ld [$cd3e], a
	ld de, 20 - 1
	add hl, de
	ld a, [$cd3f]
	call .PlaceTiles
	add hl, de
	call .PlaceTiles

; Shift badge array back one byte.
	push bc
	ld hl, $cd3f + 1
	ld de, $cd3f
	ld bc, 8
	call CopyData
	pop bc

	pop hl
	ld de, 4
	add hl, de

	pop de
	inc de
	dec c
	jr nz, .DrawBadge
	ret

.PlaceTiles
	ld [hli], a
	inc a
	ld [hl], a
	inc a
	ret

.FaceBadgeTiles
	db $20, $28, $30, $38, $40, $48, $50, $58
; ea9e

GymLeaderFaceAndBadgeTileGraphics: ; ea9e (3:6a9e)
INCBIN "gfx/badges.2bpp"

; known jump sources: 19f70 (6:5f70), 19f83 (6:5f83), 19f94 (6:5f94), 1a1e0 (6:61e0), 1eb3e (7:6b3e), 44312 (11:4312), 449ae (11:49ae), 517e7 (14:57e7), 51b9a (14:5b9a), 51bad (14:5bad), 51bbe (14:5bbe), 52034 (14:6034), 526cf (14:66cf), 5653b (15:653b), 59f94 (16:5f94), 59fa5 (16:5fa5), 5a170 (16:6170), 5a2f2 (16:62f2), 5ca87 (17:4a87), 5d7f4 (17:57f4), 5d807 (17:5807), 5d81a (17:581a), 5d82b (17:582b), 5da37 (17:5a37), 62131 (18:6131), 761b3 (1d:61b3), 7630a (1d:630a), 76461 (1d:6461)
Func_ee9e: ; ee9e (3:6e9e)
	call Load16BitRegisters
	ld hl, $c6e8
	ld a, [W_CURMAPWIDTH] ; $d369
	add $6
	ld e, a
	ld d, $0
	add hl, de
	add hl, de
	add hl, de
	ld e, $3
	add hl, de
	ld e, a
	ld a, b
	and a
	jr z, .asm_eebb
.asm_eeb7
	add hl, de
	dec b
	jr nz, .asm_eeb7
.asm_eebb
	add hl, bc
	ld a, [$d09f]
	ld [hl], a
	ld a, [$d35f]
	ld c, a
	ld a, [$d360]
	ld b, a
	call Func_ef4e
	ret c
	push hl
	ld l, e
	ld h, $0
	ld e, $6
	ld d, h
	add hl, hl
	add hl, hl
	add hl, de
	add hl, bc
	pop bc
	call Func_ef4e
	ret c

; known jump sources: efd3 (3:6fd3), efef (3:6fef), 71c95 (1c:5c95)
Func_eedc: ; eedc (3:6edc)
	ld a, [W_ISINBATTLE] ; $d057
	inc a
	ret z
	ld a, [H_AUTOBGTRANSFERENABLED] ; $FF00+$ba
	push af
	ld a, [$FF00+$d7]
	push af
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld [$FF00+$d7], a
	call LoadCurrentMapView
	call GoPAL_SET_CF1C
	ld hl, $d526
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld de, $ffc0
	add hl, de
	ld a, h
	and $3
	or $98
	ld a, l
	ld [$cee9], a
	ld a, h
	ld [$ceea], a
	ld a, $2
	ld [$FF00+$be], a
	ld c, $9
.asm_ef0f
	push bc
	push hl
	push hl
	ld hl, $c378
	ld de, $14
	ld a, [$FF00+$be]
.asm_ef1a
	add hl, de
	dec a
	jr nz, .asm_ef1a
	call ScheduleRowRedrawHelper
	pop hl
	ld de, $20
	ld a, [$FF00+$be]
	ld c, a
.asm_ef28
	add hl, de
	ld a, h
	and $3
	or $98
	dec c
	jr nz, .asm_ef28
	ld [$FF00+$d2], a
	ld a, l
	ld [H_SCREENEDGEREDRAWADDR], a ; $FF00+$d1
	ld a, $2
	ld [H_SCREENEDGEREDRAW], a ; $FF00+$d0
	call DelayFrame
	ld hl, $ffbe
	inc [hl]
	inc [hl]
	pop hl
	pop bc
	dec c
	jr nz, .asm_ef0f
	pop af
	ld [$FF00+$d7], a
	pop af
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ret

; known jump sources: eec8 (3:6ec8), eed8 (3:6ed8)
Func_ef4e: ; ef4e (3:6f4e)
	ld a, h
	sub b
	ret nz
	ld a, l
	sub c
	ret

; known jump sources: 131c7 (4:71c7)
Func_ef54: ; ef54 (3:6f54)
	xor a
	ld [$cd6a], a
	ld a, [W_CURMAPTILESET] ; $d367
	and a
	jr z, .asm_ef6b
	cp $7
	jr nz, .asm_ef77
	ld a, [$cfc6]
	cp $50
	jr nz, .asm_ef77
	jr asm_ef82
.asm_ef6b
	dec a
	ld a, [$cfc6]
	cp $3d
	jr z, asm_ef82
	cp $52
	jr z, asm_ef82
.asm_ef77
	ld hl, _UnnamedText_ef7d ; $6f7d
	jp PrintText
; ef7d (3:6f7d)
_UnnamedText_ef7d: ; ef7d (3:6f7d)
	db $17, $f8, $42, $2a
	db $50
; 0xef7d + 5 bytes

asm_ef82: ; ef82 (3:6f82)
	ld [$cd4d], a
	ld a, $1
	ld [$cd6a], a
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, W_PARTYMON1NAME ; $d2b5
	call GetPartyMonName
	ld hl, $d730
	set 6, [hl]
	call GBPalWhiteOutWithDelay3
	call CleanLCD_OAM
	call Func_3dbe
	ld a, $90
	ld [$FF00+$b0], a
	call Delay3
	call LoadGBPal
	call LoadCurrentMapView
	call SaveScreenTilesToBuffer2
	call Delay3
	xor a
	ld [$FF00+$b0], a
	ld hl, Unknown_eff2 ; $6ff2
	call PrintText
	call LoadScreenTilesFromBuffer2
	ld hl, $d730
	res 6, [hl]
	ld a, $ff
	ld [$cfcb], a
	call Func_eff7
	ld de, Unknown_f100 ; $7100
	call Func_f09f
	call Func_eedc
	ld b, BANK(Func_79e96)
	ld hl, Func_79e96
	call Bankswitch ; indirect jump to Func_79e96 (79e96 (1e:5e96))
	ld a, $1
	ld [$cfcb], a
	ld a, $ac
	call PlaySound
	ld a, $90
	ld [$FF00+$b0], a
	call UpdateSprites
	jp Func_eedc

Unknown_eff2: ; eff2 (3:6ff2)
INCBIN "baserom.gbc",$eff2,$eff7 - $eff2

; known jump sources: efca (3:6fca)
Func_eff7: ; eff7 (3:6ff7)
	xor a
	ld [$cd50], a
	ld a, $e4
	ld [rOBP1], a ; $FF00+$49
	ld a, [$cd4d]
	cp $52
	jr z, .asm_f020
	ld de, Tset00_GFX + $2d0 ; $42d0 ; cuttable tree sprite top row
	ld hl, $8fc0
	ld bc, (BANK(Tset00_GFX) << 8) + $02
	call CopyVideoData
	ld de, Tset00_GFX + $3d0 ; $43d0 ; cuttable tree sprite bottom row
	ld hl, $8fe0
	ld bc, (BANK(Tset00_GFX) << 8) + $02
	call CopyVideoData
	jr asm_f055
.asm_f020
	ld hl, $8fc0
	call Func_f04c
	ld hl, $8fd0
	call Func_f04c
	ld hl, $8fe0
	call Func_f04c
	ld hl, $8ff0
	call Func_f04c
	call asm_f055
	ld hl, $c393
	ld de, $4
	ld a, $30
	ld c, e
.asm_f044
	ld [hl], a
	add hl, de
	xor $60
	dec c
	jr nz, .asm_f044
	ret

; known jump sources: f023 (3:7023), f029 (3:7029), f02f (3:702f), f035 (3:7035)
Func_f04c: ; f04c (3:704c)
	ld de, AnimationTileset2 + $60 ; $474e ; tile depicting a leaf
	ld bc, (BANK(AnimationTileset2) << 8) + $01
	jp CopyVideoData
asm_f055: ; f055 (3:7055)
	call Func_f068
	ld a, $9
	ld de, Unknown_f060 ; $7060
	jp WriteOAMBlock

Unknown_f060: ; f060 (3:7060)
INCBIN "baserom.gbc",$f060,$f068 - $f060

; known jump sources: f055 (3:7055)
Func_f068: ; f068 (3:7068)
	ld hl, $c104
	ld a, [hli]
	ld b, a
	inc hl
	ld a, [hli]
	ld c, a
	inc hl
	inc hl
	ld a, [hl]
	srl a
	ld e, a
	ld d, $0
	ld a, [$cd50]
	and a
	ld hl, Unknown_f08f ; $708f
	jr z, .asm_f084
	ld hl, Unknown_f097 ; $7097
.asm_f084
	add hl, de
	ld e, [hl]
	inc hl
	ld d, [hl]
	ld a, b
	add d
	ld b, a
	ld a, c
	add e
	ld c, a
	ret

Unknown_f08f: ; f08f (3:708f)
INCBIN "baserom.gbc",$f08f,$f097 - $f08f

Unknown_f097: ; f097 (3:7097)
INCBIN "baserom.gbc",$f097,$f09f - $f097

; known jump sources: efd0 (3:6fd0)
Func_f09f: ; f09f (3:709f)
	push de
	ld a, [W_CURMAPWIDTH] ; $d369
	add $6
	ld c, a
	ld b, $0
	ld d, $0
	ld hl, $d35f
	ld a, [hli]
	ld h, [hl]
	ld l, a
	add hl, bc
	ld a, [$c109]
	and a
	jr z, .asm_f0c7
	cp $4
	jr z, .asm_f0cf
	cp $8
	jr z, .asm_f0d7
	ld a, [W_XBLOCKCOORD] ; $d364
	and a
	jr z, .asm_f0e0
	jr .asm_f0ec
.asm_f0c7
	ld a, [W_YBLOCKCOORD] ; $d363
	and a
	jr z, .asm_f0e0
	jr .asm_f0df
.asm_f0cf
	ld a, [W_YBLOCKCOORD] ; $d363
	and a
	jr z, .asm_f0e1
	jr .asm_f0e0
.asm_f0d7
	ld a, [W_XBLOCKCOORD] ; $d364
	and a
	jr z, .asm_f0e6
	jr .asm_f0e0
.asm_f0df
	add hl, bc
.asm_f0e0
	add hl, bc
.asm_f0e1
	ld e, $2
	add hl, de
	jr .asm_f0f0
.asm_f0e6
	ld e, $1
	add hl, bc
	add hl, de
	jr .asm_f0f0
.asm_f0ec
	ld e, $3
	add hl, bc
	add hl, de
.asm_f0f0
	pop de
	ld a, [hl]
	ld c, a
.asm_f0f3
	ld a, [de]
	inc de
	inc de
	cp $ff
	ret z
	cp c
	jr nz, .asm_f0f3
	dec de
	ld a, [de]
	ld [hl], a
	ret

Unknown_f100: ; f100 (3:7100)
INCBIN "baserom.gbc",$f100,$f113 - $f100

; known jump sources: 1081 (0:1081)
Func_f113: ; f113 (3:7113)
	ld a, [W_CURMAP] ; $d35e
	cp ROUTE_1
	jr nc, .notInTown
	ld c, a
	ld b, $1
	ld hl, W_TOWNVISITEDFLAG   ; mark town as visited (for flying)
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
.notInTown
	ld hl, MapHSPointers
	ld a, [W_CURMAP] ; $d35e
	ld b, $0
	ld c, a
	add hl, bc
	add hl, bc
	ld a, [hli]                ; load missable objects pointer in hl
	ld h, [hl]
	ld l, a
	push hl
	ld de, MapHS00             ; calculate difference between out pointer and the base pointer
	ld a, l
	sub e
	jr nc, .asm_f13c
	dec h
.asm_f13c
	ld l, a
	ld a, h
	sub d
	ld h, a
	ld a, h
	ld [H_DIVIDEND], a
	ld a, l
	ld [H_DIVIDEND+1], a
	xor a
	ld [H_DIVIDEND+2], a
	ld [H_DIVIDEND+3], a
	ld a, $3
	ld [H_DIVISOR], a
	ld b, $2
	call Divide                ; divide difference by 3, resulting in the global offset (number of missable items before ours)
	ld a, [W_CURMAP] ; $d35e
	ld b, a
	ld a, [H_DIVIDEND+3]
	ld c, a                    ; store global offset in c
	ld de, W_MISSABLEOBJECTLIST
	pop hl
.writeMissableObjectsListLoop
	ld a, [hli]
	cp $ff
	jr z, .done     ; end of list
	cp b
	jr nz, .done    ; not for current map anymore
	ld a, [hli]
	inc hl
	ld [de], a                 ; write (map-local) sprite ID
	inc de
	ld a, c
	inc c
	ld [de], a                 ; write (global) missable object index
	inc de
	jr .writeMissableObjectsListLoop
.done
	ld a, $ff
	ld [de], a                 ; write sentinel
	ret

; known jump sources: f89d (3:789d)
InitializeMissableObjectsFlags: ; f175 (3:7175)
	ld hl, W_MISSABLEOBJECTFLAGS
	ld bc, $20
	xor a
	call FillMemory ; clear missable objects flags
	ld hl, MapHS00
	xor a
	ld [$d048], a
.missableObjectsLoop
	ld a, [hli]
	cp $ff          ; end of list
	ret z
	push hl
	inc hl
	ld a, [hl]
	cp Hide
	jr nz, .asm_f19d
	ld hl, W_MISSABLEOBJECTFLAGS
	ld a, [$d048]
	ld c, a
	ld b, $1
	call HandleBitArray2 ; set flag iff Item is hidden
.asm_f19d
	ld hl, $d048
	inc [hl]
	pop hl
	inc hl
	inc hl
	jr .missableObjectsLoop

; known jump sources: 50de (1:50de)

; tests if current sprite is a missable object that is hidden/has been removed
IsMissableObjectHidden: ; f1a6 (3:71a6)
	ld a, [H_CURRENTSPRITEOFFSET]
	swap a
	ld b, a
	ld hl, W_MISSABLEOBJECTLIST
.loop
	ld a, [hli]
	cp $ff
	jr z, .notHidden ; not missable -> not hidden
	cp b
	ld a, [hli]
	jr nz, .loop
	ld c, a
	ld b, $2
	ld hl, W_MISSABLEOBJECTFLAGS
	call HandleBitArray2
	ld a, c
	and a
	jr nz, .hidden
.notHidden
	xor a
.hidden
	ld [$FF00+$e5], a
	ret

; adds missable object (items, leg. pokemon, etc.) to the map
; [$cc4d]: index of the missable object to be added (global index)
AddMissableObject: ; f1c8 (3:71c8)
	ld hl, W_MISSABLEOBJECTFLAGS
	ld a, [$cc4d]
	ld c, a
	ld b, $0
	call HandleBitArray2   ; reset "removed" flag
	jp UpdateSprites

; removes missable object (items, leg. pokemon, etc.) from the map
; [$cc4d]: index of the missable object to be removed (global index)
RemoveMissableObject: ; f1d7 (3:71d7)
	ld hl, W_MISSABLEOBJECTFLAGS
	ld a, [$cc4d]
	ld c, a
	ld b, $1
	call HandleBitArray2   ; set "removed" flag
	jp UpdateSprites

; known jump sources: f19a (3:719a), f1bd (3:71bd), f1d1 (3:71d1), f1e0 (3:71e0)
; functionally identical to _HandleBitArray, but with less optimized instructions
; executes operations on a field of bits
; b = 0 -> reset bit
; b = 1 -> set bit
; b = 2 -> read bit (into c and z-flag)
; hl: base address
; c: bit index
HandleBitArray2: ; f1e6 (3:71e6)
	push hl
	push de
	push bc
	ld a, c
	ld d, a
	and $7
	ld e, a        ; store bit offset in e
	ld a, d
	srl a
	srl a
	srl a          ; calc byte offset
	add l
	ld l, a
	jr nc, .noCarry
	inc h
.noCarry
	inc e
	ld d, $1
.shiftLeftLoop     ; d = 1 << e, bitmask for the used bit
	dec e
	jr z, .operationSelect
	sla d
	jr .shiftLeftLoop
.operationSelect
	ld a, b
	and a
	jr z, .resetBit
	cp $2
	jr z, .readBit
	ld a, [hl] ; set bit
	ld b, a
	ld a, d
	or b
	ld [hl], a
	jr .done
.resetBit
	ld a, [hl]
	ld b, a
	ld a, d
	xor $ff
	and b
	ld [hl], a
	jr .done
.readBit
	ld a, [hl]
	ld b, a
	ld a, d
	and b
.done
	pop bc
	pop de
	pop hl
	ld c, a
	ret

; known jump sources: 1023 (0:1023)
Func_f225: ; f225 (3:7225)
	ld a, [$d728]
	bit 0, a
	ret z
	ld a, [W_FLAGS_CD60]
	bit 1, a
	ret nz
	xor a
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call IsSpriteInFrontOfPlayer
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	ld [$d718], a
	and a
	jp z, Func_f2dd
	ld hl, $c101
	ld d, $0
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	swap a
	ld e, a
	add hl, de
	res 7, [hl]
	call GetSpriteMovementByte2Pointer
	ld a, [hl]
	cp $10
	jp nz, Func_f2dd
	ld hl, W_FLAGS_CD60
	bit 6, [hl]
	set 6, [hl]
	ret z
	ld a, [H_CURRENTPRESSEDBUTTONS]
	and $f0
	ret z
	ld a, $5a
	call Predef ; indirect jump to Func_c60b (c60b (3:460b))
	ld a, [$d71c]
	and a
	jp nz, Func_f2dd
	ld a, [H_CURRENTPRESSEDBUTTONS]
	ld b, a
	ld a, [$c109]
	cp $4
	jr z, .asm_f289
	cp $8
	jr z, .asm_f291
	cp $c
	jr z, .asm_f299
	bit 7, b
	ret z
	ld de, Unknown_f2af ; $72af
	jr .asm_f29f
.asm_f289
	bit 6, b
	ret z
	ld de, Unknown_f2ad ; $72ad
	jr .asm_f29f
.asm_f291
	bit 5, b
	ret z
	ld de, Unknown_f2b1 ; $72b1
	jr .asm_f29f
.asm_f299
	bit 4, b
	ret z
	ld de, Unknown_f2b3 ; $72b3
.asm_f29f
	call MoveSprite
	ld a, $a8
	call PlaySound
	ld hl, W_FLAGS_CD60
	set 1, [hl]
	ret

Unknown_f2ad: ; f2ad (3:72ad)
INCBIN "baserom.gbc",$f2ad,$f2af - $f2ad

Unknown_f2af: ; f2af (3:72af)
INCBIN "baserom.gbc",$f2af,$f2b1 - $f2af

Unknown_f2b1: ; f2b1 (3:72b1)
INCBIN "baserom.gbc",$f2b1,$f2b3 - $f2b1

Unknown_f2b3: ; f2b3 (3:72b3)
INCBIN "baserom.gbc",$f2b3,$f2b5 - $f2b3

; known jump sources: 1032 (0:1032)
Func_f2b5: ; f2b5 (3:72b5)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld hl, Func_79f54
	ld b, BANK(Func_79f54)
	call Bankswitch ; indirect jump to Func_79f54 (79f54 (1e:5f54))
	call DiscardButtonPresses
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	call Func_f2dd
	set 7, [hl]
	ld a, [$d718]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call GetSpriteMovementByte2Pointer
	ld [hl], $10
	ld a, $ac
	jp PlaySound

; known jump sources: f23d (3:723d), f253 (3:7253), f26c (3:726c), f2c9 (3:72c9)
Func_f2dd: ; f2dd (3:72dd)
	ld hl, W_FLAGS_CD60
	res 1, [hl]
	res 6, [hl]
	ret

; known jump sources: 392f (0:392f)
_AddPokemonToParty: ; f2e5 (3:72e5)
	ld de, W_NUMINPARTY ; $d163
	ld a, [$cc49]
	and $f
	jr z, .asm_f2f2
	ld de, W_ENEMYMONCOUNT ; $d89c
.asm_f2f2
	ld a, [de]
	inc a
	cp $7
	ret nc
	ld [de], a
	ld a, [de]
	ld [$FF00+$e4], a
	add e
	ld e, a
	jr nc, .asm_f300
	inc d
.asm_f300
	ld a, [$cf91]
	ld [de], a
	inc de
	ld a, $ff
	ld [de], a
	ld hl, W_PARTYMON1OT ; $d273
	ld a, [$cc49]
	and $f
	jr z, .asm_f315
	ld hl, $d9ac
.asm_f315
	ld a, [$FF00+$e4]
	dec a
	call SkipFixedLengthTextEntries
	ld d, h
	ld e, l
	ld hl, W_PLAYERNAME ; $d158
	ld bc, $b
	call CopyData
	ld a, [$cc49]
	and a
	jr nz, .asm_f33f
	ld hl, W_PARTYMON1NAME ; $d2b5
	ld a, [$FF00+$e4]
	dec a
	call SkipFixedLengthTextEntries
	ld a, $2
	ld [$d07d], a
	ld a, $4e
	call Predef ; indirect jump to Func_64eb (64eb (1:64eb))
.asm_f33f
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	ld a, [$cc49]
	and $f
	jr z, .asm_f34c
	ld hl, W_WATERRATE ; $d8a4
.asm_f34c
	ld a, [$FF00+$e4]
	dec a
	ld bc, $2c
	call AddNTimes
	ld e, l
	ld d, h
	push hl
	ld a, [$cf91]
	ld [$d0b5], a
	call GetMonHeader
	ld hl, W_MONHEADER
	ld a, [hli]
	ld [de], a
	inc de
	pop hl
	push hl
	ld a, [$cc49]
	and $f
	ld a, $98     ; set enemy trainer mon IVs to fixed average values
	ld b, $88
	jr nz, .writeFreshMonData
	ld a, [$cf91]
	ld [$d11e], a
	push de
	ld a, $3a
	call Predef ; indirect jump to IndexToPokedex (41010 (10:5010))
	pop de
	ld a, [$d11e]
	dec a
	ld c, a
	ld b, $2
	ld hl, W_OWNEDPOKEMON ; $d2f7
	call _HandleBitArray
	ld a, c
	ld [$d153], a
	ld a, [$d11e]
	dec a
	ld c, a
	ld b, $1
	push bc
	call _HandleBitArray
	pop bc
	ld hl, W_SEENPOKEMON ; $d30a
	call _HandleBitArray
	pop hl
	push hl
	ld a, [W_ISINBATTLE] ; $d057
	and a
	jr nz, .copyEnemyMonData
	call GenRandom     ; generate random IVs
	ld b, a
	call GenRandom
.writeFreshMonData ; f3b3
	push bc
	ld bc, $1b
	add hl, bc
	pop bc
	ld [hli], a
	ld [hl], b         ; write IVs
	ld bc, $fff4
	add hl, bc
	ld a, $1
	ld c, a
	xor a
	ld b, a
	call CalcStat      ; calc HP stat (set cur Hp to max HP)
	ld a, [H_MULTIPLICAND+1]
	ld [de], a
	inc de
	ld a, [H_MULTIPLICAND+2]
	ld [de], a
	inc de
	xor a
	ld [de], a         ; level (?)
	inc de
	ld [de], a         ; status ailments
	inc de
	jr .copyMonTypesAndMoves
.copyEnemyMonData
	ld bc, $1b
	add hl, bc
	ld a, [W_ENEMYMONATKDEFIV] ; copy IVs from cur enemy mon
	ld [hli], a
	ld a, [W_ENEMYMONSPDSPCIV]
	ld [hl], a
	ld a, [W_ENEMYMONCURHP]    ; copy HP from cur enemy mon
	ld [de], a
	inc de
	ld a, [W_ENEMYMONCURHP+1]
	ld [de], a
	inc de
	xor a
	ld [de], a                 ; level (?)
	inc de
	ld a, [W_ENEMYMONSTATUS]   ; copy status ailments from cur enemy mon
	ld [de], a
	inc de
.copyMonTypesAndMoves
	ld hl, W_MONHTYPES
	ld a, [hli]       ; type 1
	ld [de], a
	inc de
	ld a, [hli]       ; type 2
	ld [de], a
	inc de
	ld a, [hli]       ; unused (?)
	ld [de], a
	ld hl, W_MONHMOVES
	ld a, [hli]
	inc de
	push de
	ld [de], a
	ld a, [hli]
	inc de
	ld [de], a
	ld a, [hli]
	inc de
	ld [de], a
	ld a, [hli]
	inc de
	ld [de], a
	push de
	dec de
	dec de
	dec de
	xor a
	ld [$cee9], a
	ld a, $3e
	call Predef ; indirect jump to WriteMonMoves (3afb8 (e:6fb8))
	pop de
	ld a, [W_PLAYERIDHI]  ; set trainer ID to player ID
	inc de
	ld [de], a
	ld a, [W_PLAYERIDLO]
	inc de
	ld [de], a
	push de
	ld a, [W_CURENEMYLVL]
	ld d, a
	ld hl, CalcExperience
	ld b, BANK(CalcExperience)
	call Bankswitch ; indirect jump to CalcExperience (58f6a (16:4f6a))
	pop de
	inc de
	ld a, [H_MULTIPLICAND] ; write experience
	ld [de], a
	inc de
	ld a, [H_MULTIPLICAND+1]
	ld [de], a
	inc de
	ld a, [H_MULTIPLICAND+2]
	ld [de], a
	xor a
	ld b, $a
.writeEVsLoop              ; set all EVs to 0
	inc de
	ld [de], a
	dec b
	jr nz, .writeEVsLoop
	inc de
	inc de
	pop hl
	call AddPokemonToParty_WriteMovePP
	inc de
	ld a, [W_CURENEMYLVL] ; $d127
	ld [de], a
	inc de
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	jr nz, .calcFreshStats
	ld hl, W_ENEMYMONMAXHP ; $cff4
	ld bc, $a
	call CopyData          ; copy stats of cur enemy mon
	pop hl
	jr .done
.calcFreshStats
	pop hl
	ld bc, $10
	add hl, bc
	ld b, $0
	call CalcStats         ; calculate fresh set of stats
.done
	scf
	ret

; known jump sources: e618 (3:6618), 3ebd2 (f:6bd2)
LoadMovePPs: ; f473 (3:7473)
	call Load16BitRegisters
	; fallthrough
; known jump sources: f44c (3:744c)
AddPokemonToParty_WriteMovePP: ; f476 (3:7476)
	ld b, $4
.pploop
	ld a, [hli]     ; read move ID
	and a
	jr z, .empty
	dec a
	push hl
	push de
	push bc
	ld hl, Moves
	ld bc, $6
	call AddNTimes
	ld de, $cd6d
	ld a, BANK(Moves)
	call FarCopyData
	pop bc
	pop de
	pop hl
	ld a, [$cd72] ; sixth move byte = pp
.empty
	inc de
	ld [de], a
	dec b
	jr nz, .pploop ; there are still moves to read
	ret

; adds enemy mon [$cf91] (at position [$cf92] in enemy list) to own party
; no known uses in the game
_AddEnemyMonToPlayerParty: ; f49d (3:749d)
	ld hl, W_NUMINPARTY
	ld a, [hl]
	cp $6
	scf
	ret z            ; party full, return failure
	inc a
	ld [hl], a       ; add 1 to party members
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [$cf91]
	ld [hli], a      ; add mon as last list entry
	ld [hl], $ff     ; write new sentinel
	ld hl, W_PARTYMON1DATA
	ld a, [W_NUMINPARTY]
	dec a
	ld bc, W_PARTYMON2DATA - W_PARTYMON1DATA
	call AddNTimes
	ld e, l
	ld d, h
	ld hl, $cf98
	call CopyData    ; write new mon's data (from $cf98)
	ld hl, W_PARTYMON1OT
	ld a, [W_NUMINPARTY]
	dec a
	call SkipFixedLengthTextEntries
	ld d, h
	ld e, l
	ld hl, W_ENEMYMON1OT
	ld a, [$cf92]
	call SkipFixedLengthTextEntries
	ld bc, $000b
	call CopyData    ; write new mon's OT name (from an enemy mon)
	ld hl, W_PARTYMON1NAME
	ld a, [W_NUMINPARTY]
	dec a
	call SkipFixedLengthTextEntries
	ld d, h
	ld e, l
	ld hl, W_ENEMYMON1NAME
	ld a, [$cf92]
	call SkipFixedLengthTextEntries
	ld bc, $000b
	call CopyData    ; write new mon's nickname (from an enemy mon)
	ld a, [$cf91]
	ld [$d11e], a
	ld a, $3a
	call Predef
	ld a, [$d11e]
	dec a
	ld c, a
	ld b, $1
	ld hl, W_OWNEDPOKEMON
	push bc
	call _HandleBitArray ; add to owned pokemon
	pop bc
	ld hl, W_SEENPOKEMON
	call _HandleBitArray ; add to seen pokemon
	and a
	ret                  ; return success
; 0xf51e

; known jump sources: 3a72 (0:3a72)
Func_f51e: ; f51e (3:751e)
	ld a, [$cf95]
	and a
	jr z, .checkPartyMonSlots
	cp $2
	jr z, .checkPartyMonSlots
	cp $3
	ld hl, $da5f
	jr z, .asm_f575
	ld hl, W_NUMINBOX ; $da80
	ld a, [hl]
	cp $14
	jr nz, .partyOrBoxNotFull
	jr .boxFull
.checkPartyMonSlots
	ld hl, W_NUMINPARTY ; $d163
	ld a, [hl]
	cp $6
	jr nz, .partyOrBoxNotFull
.boxFull
	scf
	ret
.partyOrBoxNotFull
	inc a
	ld [hl], a           ; increment number of mons in party/box
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [$cf95]
	cp $2
	ld a, [$da5f]
	jr z, .asm_f556
	ld a, [$cf91]
.asm_f556
	ld [hli], a          ; write new mon ID
	ld [hl], $ff         ; write new sentinel
	ld a, [$cf95]
	dec a
	ld hl, W_PARTYMON1DATA ; $d16b
	ld bc, W_PARTYMON2DATA - W_PARTYMON1DATA ; $2c
	ld a, [W_NUMINPARTY] ; $d163
	jr nz, .skipToNewMonEntry
	ld hl, W_BOXMON1DATA
	ld bc, W_BOXMON2DATA - W_BOXMON1DATA ; $21
	ld a, [W_NUMINBOX] ; $da80
.skipToNewMonEntry
	dec a
	call AddNTimes
.asm_f575
	push hl
	ld e, l
	ld d, h
	ld a, [$cf95]
	and a
	ld hl, W_BOXMON1DATA
	ld bc, W_BOXMON2DATA - W_BOXMON1DATA ; $21
	jr z, .asm_f591
	cp $2
	ld hl, $da5f
	jr z, .asm_f597
	ld hl, W_PARTYMON1DATA ; $d16b
	ld bc, W_PARTYMON2DATA - W_PARTYMON1DATA ; $2c
.asm_f591
	ld a, [W_WHICHPOKEMON] ; $cf92
	call AddNTimes
.asm_f597
	push hl
	push de
	ld bc, $21
	call CopyData
	pop de
	pop hl
	ld a, [$cf95]
	and a
	jr z, .asm_f5b4
	cp $2
	jr z, .asm_f5b4
	ld bc, $21
	add hl, bc
	ld a, [hl]
	inc de
	inc de
	inc de
	ld [de], a
.asm_f5b4
	ld a, [$cf95]
	cp $3
	ld de, $da54
	jr z, .asm_f5d3
	dec a
	ld hl, W_PARTYMON1OT ; $d273
	ld a, [W_NUMINPARTY] ; $d163
	jr nz, .asm_f5cd
	ld hl, $dd2a
	ld a, [W_NUMINBOX] ; $da80
.asm_f5cd
	dec a
	call SkipFixedLengthTextEntries
	ld d, h
	ld e, l
.asm_f5d3
	ld hl, $dd2a
	ld a, [$cf95]
	and a
	jr z, .asm_f5e6
	ld hl, $da54
	cp $2
	jr z, .asm_f5ec
	ld hl, W_PARTYMON1OT ; $d273
.asm_f5e6
	ld a, [W_WHICHPOKEMON] ; $cf92
	call SkipFixedLengthTextEntries
.asm_f5ec
	ld bc, $b
	call CopyData
	ld a, [$cf95]
	cp $3
	ld de, $da49
	jr z, .asm_f611
	dec a
	ld hl, W_PARTYMON1NAME ; $d2b5
	ld a, [W_NUMINPARTY] ; $d163
	jr nz, .asm_f60b
	ld hl, $de06
	ld a, [W_NUMINBOX] ; $da80
.asm_f60b
	dec a
	call SkipFixedLengthTextEntries
	ld d, h
	ld e, l
.asm_f611
	ld hl, $de06
	ld a, [$cf95]
	and a
	jr z, .asm_f624
	ld hl, $da49
	cp $2
	jr z, .asm_f62a
	ld hl, W_PARTYMON1NAME ; $d2b5
.asm_f624
	ld a, [W_WHICHPOKEMON] ; $cf92
	call SkipFixedLengthTextEntries
.asm_f62a
	ld bc, $b
	call CopyData
	pop hl
	ld a, [$cf95]
	cp $1
	jr z, .asm_f664
	cp $3
	jr z, .asm_f664
	push hl
	srl a
	add $2
	ld [$cc49], a
	call LoadMonData
	ld b, BANK(Func_58f43)
	ld hl, Func_58f43
	call Bankswitch ; indirect jump to Func_58f43 (58f43 (16:4f43))
	ld a, d
	ld [W_CURENEMYLVL], a ; $d127
	pop hl
	ld bc, $21
	add hl, bc
	ld [hli], a
	ld d, h
	ld e, l
	ld bc, $ffee
	add hl, bc
	ld b, $1
	call CalcStats
.asm_f664
	and a
	ret

; predef $10
; executes operations on a field of bits
; b = 0 -> reset bit
; b = 1 -> set bit
; b = 2 -> read bit (into c and z-flag)
; hl: base address
; c: bit index
HandleBitArray: ; f666 (3:7666)
	call Load16BitRegisters

; known jump sources: f38b (3:738b), f39a (3:739a), f3a1 (3:73a1)
_HandleBitArray: ; f669 (3:7669)
	push hl
	push de
	push bc
	ld a, c
	ld d, a
	and $7
	ld e, a        ; store bit offset in e
	ld a, d
	srl a
	srl a
	srl a          ; calc byte offset
	add l
	ld l, a
	jr nc, .noCarry
	inc h
.noCarry
	inc e
	ld d, $1
.shiftLeftLoop     ; d = 1 << e, bitmask for the used bit
	dec e
	jr z, .operationSelect
	sla d
	jr .shiftLeftLoop
.operationSelect
	ld a, b
	and a
	jr z, .resetBit
	cp $2
	jr z, .readBit
	ld b, [hl] ; set bit
	ld a, d
	or b
	ld [hl], a
	jr .done
.resetBit
	ld b, [hl]
	ld a, d
	xor $ff
	and b
	ld [hl], a
	jr .done
.readBit
	ld b, [hl]
	ld a, d
	and b
.done
	pop bc
	pop de
	pop hl
	ld c, a
	ret
; f6a5 (3:76a5)

HealParty: ; f6a5 (3:76a5)
	ld hl, W_PARTYMON1
	ld de, W_PARTYMON1_HP
.HealPokemon: ; f6ab (3:76ab)
	ld a, [hli]
	cp $ff
	jr z, .DoneHealing ; End if there's no Pokémon
	push hl
	push de
	ld hl, $0003 ; Status offset
	add hl, de
	xor a
	ld [hl], a ; Clean status conditions
	push de
	ld b, $4 ; A Pokémon has 4 moves
.RestorePP: ; f6bb (3:76bb)
	ld hl, $0007 ; Move offset
	add hl, de
	ld a, [hl]
	and a
	jr z, .HealNext ; Skip if there's no move here
	dec a
	ld hl, $001c ; PP offset
	add hl, de
	push hl
	push de
	push bc
	ld hl, Moves
	ld bc, $0006
	call AddNTimes
	ld de, $cd6d
	ld a, BANK(Moves)
	call FarCopyData ; copy move header to memory
	ld a, [$cd72] ; get default PP
	pop bc
	pop de
	pop hl
	inc de
	push bc
	ld b, a
	ld a, [hl]
	and $c0
	add b
	ld [hl], a
	pop bc
.HealNext: ; f6eb (3:76eb)
	dec b
	jr nz, .RestorePP ; Continue if there's still moves
	pop de
	ld hl, $0021 ; Max HP offset
	add hl, de
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hl]
	ld [de], a ; Restore full HP
	pop de
	pop hl
	push hl
	ld bc, $002c
	ld h, d
	ld l, e
	add hl, bc
	ld d, h
	ld e, l
	pop hl
	jr .HealPokemon ; Next Pokémon
.DoneHealing
	xor a
	ld [$cf92], a
	ld [$d11e], a
	ld a, [W_NUMINPARTY]
	ld b, a
.restoreBonusPPLoop ; loop to restore bonus PP from PP Ups
	push bc
	call RestoreBonusPP
	pop bc
	ld hl, $cf92
	inc [hl]
	dec b
	jr nz,.restoreBonusPPLoop
	ret

; predef $9
; predef $a
; predef $d
; predef $e
; known jump sources: 2df5 (0:2df5), 40ed (1:40ed)
Func_f71e: ; f71e (3:771e)
	call Load16BitRegisters
	xor a
	ld [$FF00+$a5], a
	ld [$FF00+$a6], a
	ld [$FF00+$a7], a
	ld d, $1
.asm_f72a
	ld a, [$FF00+$a2]
	and $f0
	jr nz, .asm_f75b
	inc d
	ld a, [$FF00+$a2]
	swap a
	and $f0
	ld b, a
	ld a, [$FF00+$a3]
	swap a
	ld [$FF00+$a3], a
	and $f
	or b
	ld [$FF00+$a2], a
	ld a, [$FF00+$a3]
	and $f0
	ld b, a
	ld a, [$FF00+$a4]
	swap a
	ld [$FF00+$a4], a
	and $f
	or b
	ld [$FF00+$a3], a
	ld a, [$FF00+$a4]
	and $f0
	ld [$FF00+$a4], a
	jr .asm_f72a
.asm_f75b
	push de
	push de
	call Func_f800
	pop de
	ld a, b
	swap a
	and $f0
	ld [$FF00+$a5], a
	dec d
	jr z, .asm_f7bc
	push de
	call Func_f7d7
	call Func_f800
	pop de
	ld a, [$FF00+$a5]
	or b
	ld [$FF00+$a5], a
	dec d
	jr z, .asm_f7bc
	push de
	call Func_f7d7
	call Func_f800
	pop de
	ld a, b
	swap a
	and $f0
	ld [$FF00+$a6], a
	dec d
	jr z, .asm_f7bc
	push de
	call Func_f7d7
	call Func_f800
	pop de
	ld a, [$FF00+$a6]
	or b
	ld [$FF00+$a6], a
	dec d
	jr z, .asm_f7bc
	push de
	call Func_f7d7
	call Func_f800
	pop de
	ld a, b
	swap a
	and $f0
	ld [$FF00+$a7], a
	dec d
	jr z, .asm_f7bc
	push de
	call Func_f7d7
	call Func_f800
	pop de
	ld a, [$FF00+$a7]
	or b
	ld [$FF00+$a7], a
.asm_f7bc
	ld a, [$FF00+$a5]
	ld [$FF00+$a2], a
	ld a, [$FF00+$a6]
	ld [$FF00+$a3], a
	ld a, [$FF00+$a7]
	ld [$FF00+$a4], a
	pop de
	ld a, $6
	sub d
	and a
	ret z
.asm_f7ce
	push af
	call Func_f7d7
	pop af
	dec a
	jr nz, .asm_f7ce
	ret

; known jump sources: f76c (3:776c), f77c (3:777c), f78e (3:778e), f79e (3:779e), f7b0 (3:77b0), f7cf (3:77cf)
Func_f7d7: ; f7d7 (3:77d7)
	ld a, [$FF00+$a4]
	swap a
	and $f
	ld b, a
	ld a, [$FF00+$a3]
	swap a
	ld [$FF00+$a3], a
	and $f0
	or b
	ld [$FF00+$a4], a
	ld a, [$FF00+$a3]
	and $f
	ld b, a
	ld a, [$FF00+$a2]
	swap a
	ld [$FF00+$a2], a
	and $f0
	or b
	ld [$FF00+$a3], a
	ld a, [$FF00+$a2]
	and $f
	ld [$FF00+$a2], a
	ret

; known jump sources: f75d (3:775d), f76f (3:776f), f77f (3:777f), f791 (3:7791), f7a1 (3:77a1), f7b3 (3:77b3)
Func_f800: ; f800 (3:7800)
	ld bc, $3
.asm_f803
	ld de, $ff9f
	ld hl, $ffa2
	push bc
	call StringCmp
	pop bc
	ret c
	inc b
	ld de, $ffa1
	ld hl, $ffa4
	push bc
	call Func_f839
	pop bc
	jr .asm_f803

; known jump sources: 2ba8 (0:2ba8), 2dde (0:2dde), 13801 (4:7801), 39d18 (e:5d18), 3c6e1 (f:46e1)
Func_f81d: ; f81d (3:781d)
	call Load16BitRegisters
	and a
	ld b, c
.asm_f822
	ld a, [de]
	adc [hl]
	daa
	ld [de], a
	dec de
	dec hl
	dec c
	jr nz, .asm_f822
	jr nc, .asm_f835
	ld a, $99
	inc de
.asm_f830
	ld [de], a
	inc de
	dec b
	jr nz, .asm_f830
.asm_f835
	ret

; known jump sources: 6b37 (1:6b37), 5c1c5 (17:41c5), 74f82 (1d:4f82), 75311 (1d:5311)
Func_f836: ; f836 (3:7836)
	call Load16BitRegisters

; known jump sources: f817 (3:7817)
Func_f839: ; f839 (3:7839)
	and a
	ld b, c
.asm_f83b
	ld a, [de]
	sbc [hl]
	daa
	ld [de], a
	dec de
	dec hl
	dec c
	jr nz, .asm_f83b
	jr nc, .asm_f84f
	ld a, $0
	inc de
.asm_f849
	ld [de], a
	inc de
	dec b
	jr nz, .asm_f849
	scf
.asm_f84f
	ret

; known jump sources: 612d (1:612d)
InitializePlayerData: ; f850 (3:7850)
	call GenRandom
	ld a, [H_RAND2]
	ld [W_PLAYERIDHI], a          ; set player trainer id
	call GenRandom
	ld a, [H_RAND1]
	ld [W_PLAYERIDLO], a
	ld a, $ff
	ld [$d71b], a                 ; XXX what's this?
	ld hl, W_NUMINPARTY ; $d163
	call InitializeEmptyList      ; no party mons
	ld hl, W_NUMINBOX ; $da80
	call InitializeEmptyList      ; no boxed mons
	ld hl, W_NUMBAGITEMS ; $d31d
	call InitializeEmptyList      ; no items
	ld hl, W_NUMBOXITEMS ; $d53a
	call InitializeEmptyList      ; no boxed items
	ld hl, W_PLAYERMONEY2 ; $d348
	ld a, $30
	ld [hld], a                   ; set money to 00 30 00 (3000)
	xor a
	ld [hli], a
	inc hl
	ld [hl], a
	ld [$cc49], a                 ; XXX what's this?
	ld hl, W_OBTAINEDBADGES ; $d356
	ld [hli], a                   ; no badges obtained
	ld [hl], a                    ; XXX what's this?
	ld hl, W_PLAYERCOINS1 ; $d5a4
	ld [hli], a                   ; no coins
	ld [hl], a
	ld hl, W_GAMEPROGRESSFLAGS ; $d5f0
	ld bc, $c8
	call FillMemory               ; clear all game progress flags
	jp InitializeMissableObjectsFlags

; writes two bytes $00 $ff to hl
InitializeEmptyList: ; f8a0 (3:78a0)
	xor a
	ld [hli], a
	dec a
	ld [hl], a
	ret

; known jump sources: 3495 (0:3495), 1980a (6:580a), 198da (6:58da), 483ee (12:43ee), 75d4e (1d:5d4e)
Func_f8a5: ; f8a5 (3:78a5)
	call Load16BitRegisters
	ld hl, W_NUMBAGITEMS ; $d31d
.asm_f8ab
	inc hl
	ld a, [hli]
	cp $ff
	jr z, .asm_f8b7
	cp b
	jr nz, .asm_f8ab
	ld a, [hl]
	ld b, a
	ret
.asm_f8b7
	ld b, $0
	ret

; known jump sources: 18efa (6:4efa), 1cda6 (7:4da6)
Func_f8ba: ; f8ba (3:78ba)
	xor a
	ld hl, $ff97
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld hl, $cc97
	ld de, $0

; known jump sources: f923 (3:7923)
Func_f8c8: ; f8c8 (3:78c8)
	ld a, [H_REMAINDER] ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld b, a
	ld a, [H_DIVIDEND] ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	call CalcDifference
	ld d, a
	and a
	jr nz, .asm_f8da
	ld a, [$FF00+$98]
	set 0, a
	ld [$FF00+$98], a
.asm_f8da
	ld a, [$FF00+$9a]
	ld b, a
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	call CalcDifference
	ld e, a
	and a
	jr nz, .asm_f8ec
	ld a, [$FF00+$98]
	set 1, a
	ld [$FF00+$98], a
.asm_f8ec
	ld a, [$FF00+$98]
	cp $3
	jr z, .asm_f926
	ld a, e
	cp d
	jr c, .asm_f90a
	ld a, [$FF00+$9d]
	bit 1, a
	jr nz, .asm_f900
	ld d, $c0
	jr .asm_f902
.asm_f900
	ld d, $80
.asm_f902
	ld a, [$FF00+$9a]
	add $1
	ld [$FF00+$9a], a
	jr .asm_f91c
.asm_f90a
	ld a, [$FF00+$9d]
	bit 0, a
	jr nz, .asm_f914
	ld d, $0
	jr .asm_f916
.asm_f914
	ld d, $40
.asm_f916
	ld a, [H_REMAINDER] ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	add $1
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
.asm_f91c
	ld a, d
	ld [hli], a
	ld a, [$FF00+$97]
	inc a
	ld [$FF00+$97], a
	jp Func_f8c8
.asm_f926
	ld [hl], $ff
	ret

; known jump sources: 18ef1 (6:4ef1), 1cd9c (7:4d9c)
Func_f929: ; f929 (3:7929)
	xor a
	ld [$FF00+$9d], a
	ld a, [$c104]
	ld d, a
	ld a, [$c106]
	ld e, a
	ld hl, $c100
	ld a, [H_DIVIDEND] ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	add l
	add $4
	ld l, a
	jr nc, .asm_f940
	inc h
.asm_f940
	ld a, d
	ld b, a
	ld a, [hli]
	call CalcDifference
	jr nc, .asm_f953
	push hl
	ld hl, $ff9d
	bit 0, [hl]
	set 0, [hl]
	pop hl
	jr .asm_f95c
.asm_f953
	push hl
	ld hl, $ff9d
	bit 0, [hl]
	res 0, [hl]
	pop hl
.asm_f95c
	push hl
	ld hl, $ffe5
	ld [hli], a
	ld a, $10
	ld [hli], a
	call Func_366b
	ld a, [hl]
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	pop hl
	inc hl
	ld b, e
	ld a, [hl]
	call CalcDifference
	jr nc, .asm_f97e
	push hl
	ld hl, $ff9d
	bit 1, [hl]
	set 1, [hl]
	pop hl
	jr .asm_f987
.asm_f97e
	push hl
	ld hl, $ff9d
	bit 1, [hl]
	res 1, [hl]
	pop hl
.asm_f987
	ld [$FF00+$e5], a
	ld a, $10
	ld [$FF00+$e6], a
	call Func_366b
	ld a, [$FF00+$e7]
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [$FF00+$9b]
	and a
	ret z
	ld a, [$FF00+$9d]
	cpl
	and $3
	ld [$FF00+$9d], a
	ret

INCBIN "baserom.gbc",$f9a0,$f9dc - $f9a0

; known jump sources: 1291d (4:691d)
Func_f9dc: ; f9dc (3:79dc)
	call Load16BitRegisters

; calculates bc * 48 / de, the number of pixels the HP bar has
; the result is always at least 1
UpdateHPBar_CalcNumberOfHPBarPixels: ; f9df (3:79df)
	push hl
	xor a
	ld hl, H_MULTIPLICAND
	ld [hli], a
	ld a, b
	ld [hli], a
	ld a, c
	ld [hli], a
	ld [hl], $30
	call Multiply      ; 48 * bc (hp bar is 48 pixels long)
	ld a, d
	and a
	jr z, .maxHPSmaller256
	srl d              ; make HP in de fit into 1 byte by dividing by 4
	rr e
	srl d
	rr e
	ld a, [H_MULTIPLICAND+1]
	ld b, a
	ld a, [H_MULTIPLICAND+2]
	srl b              ; divide multiplication result as well
	rr a
	srl b
	rr a
	ld [H_MULTIPLICAND+2], a
	ld a, b
	ld [H_MULTIPLICAND+1], a
.maxHPSmaller256
	ld a, e
	ld [H_DIVISOR], a
	ld b, $4
	call Divide
	ld a, [H_MULTIPLICAND+2]
	ld e, a            ; e = bc * 48 / de (num of pixels of HP bar)
	pop hl
	and a
	ret nz
	ld e, $1           ; make result at least 1
	ret

; known jump sources: 78af (1:78af), dcad (3:5cad), dda1 (3:5da1), 13995 (4:7995), 3a724 (e:6724), 3ba88 (e:7a88), 3c50a (f:450a), 3e19a (f:619a), 3e258 (f:6258)
; predef $48
UpdateHPBar: ; fa1d (3:7a1d)
	push hl
	ld hl, W_HPBAROLDHP
	ld a, [hli]
	ld c, a      ; old HP into bc
	ld a, [hli]
	ld b, a
	ld a, [hli]
	ld e, a      ; new HP into de
	ld d, [hl]
	pop hl
	push de
	push bc
	call UpdateHPBar_CalcHPDifference
	ld a, e
	ld [W_HPBARHPDIFFERENCE+1], a
	ld a, d
	ld [W_HPBARHPDIFFERENCE], a
	pop bc
	pop de
	call UpdateHPBar_CompareNewHPToOldHP
	ret z
	ld a, $ff
	jr c, .HPdecrease
	ld a, $1
.HPdecrease
	ld [W_HPBARDELTA], a
	call Load16BitRegisters
	ld a, [W_HPBARNEWHP]
	ld e, a
	ld a, [W_HPBARNEWHP+1]
	ld d, a
.animateHPBarLoop
	push de
	ld a, [W_HPBAROLDHP]
	ld c, a
	ld a, [W_HPBAROLDHP+1]
	ld b, a
	call UpdateHPBar_CompareNewHPToOldHP
	jr z, .animateHPBarDone
	jr nc, .HPIncrease
	dec bc        ; subtract 1 HP
	ld a, c
	ld [W_HPBARNEWHP], a
	ld a, b
	ld [W_HPBARNEWHP+1], a
	call UpdateHPBar_CalcOldNewHPBarPixels
	ld a, e
	sub d         ; calc pixel difference
	jr .asm_fa7e
.HPIncrease
	inc bc        ; add 1 HP
	ld a, c
	ld [W_HPBARNEWHP], a
	ld a, b
	ld [W_HPBARNEWHP+1], a
	call UpdateHPBar_CalcOldNewHPBarPixels
	ld a, d
	sub e         ; calc pixel difference
.asm_fa7e
	call UpdateHPBar_PrintHPNumber
	and a
	jr z, .noPixelDifference
	call UpdateHPBar_AnimateHPBar
.noPixelDifference
	ld a, [W_HPBARNEWHP]
	ld [W_HPBAROLDHP], a
	ld a, [W_HPBARNEWHP+1]
	ld [W_HPBAROLDHP+1], a
	pop de
	jr .animateHPBarLoop
.animateHPBarDone
	pop de
	ld a, e
	ld [W_HPBAROLDHP], a
	ld a, d
	ld [W_HPBAROLDHP+1], a
	or e
	jr z, .monFainted
	call UpdateHPBar_CalcOldNewHPBarPixels
	ld d, e
.monFainted
	call UpdateHPBar_PrintHPNumber
	ld a, $1
	call UpdateHPBar_AnimateHPBar
	jp Delay3

; known jump sources: fa84 (3:7a84), faab (3:7aab)
; animates the HP bar going up or down for (a) ticks (two waiting frames each)
; stops prematurely if bar is filled up
; e: current health (in pixels) to start with
UpdateHPBar_AnimateHPBar: ; fab1 (3:7ab1)
	push hl
.barAnimationLoop
	push af
	push de
	ld d, $6
	call DrawHPBar
	ld c, $2
	call DelayFrames
	pop de
	ld a, [W_HPBARDELTA] ; +1 or -1
	add e
	cp $31
	jr nc, .barFilledUp
	ld e, a
	pop af
	dec a
	jr nz, .barAnimationLoop
	pop hl
	ret
.barFilledUp
	pop af
	pop hl
	ret

; compares old HP and new HP and sets c and z flags accordingly
UpdateHPBar_CompareNewHPToOldHP: ; fad1 (3:7ad1)
	ld a, d
	sub b
	ret nz
	ld a, e
	sub c
	ret

; known jump sources: fa2b (3:7a2b)
; calcs HP difference between bc and de (into de)
UpdateHPBar_CalcHPDifference: ; fad7 (3:7ad7)
	ld a, d
	sub b
	jr c, .oldHPGreater
	jr z, .testLowerByte
.newHPGreater
	ld a, e
	sub c
	ld e, a
	ld a, d
	sbc b
	ld d, a
	ret
.oldHPGreater
	ld a, c
	sub e
	ld e, a
	ld a, b
	sbc d
	ld d, a
	ret
.testLowerByte
	ld a, e
	sub c
	jr c, .oldHPGreater
	jr nz, .newHPGreater
	ld de, $0
	ret

; known jump sources: fa7e (3:7a7e), faa6 (3:7aa6)
UpdateHPBar_PrintHPNumber: ; faf5 (3:7af5)
	push af
	push de
	ld a, [W_LISTMENUID] ; $cf94
	and a
	jr z, .asm_fb2d
	ld a, [W_HPBAROLDHP]
	ld [$cef1], a
	ld a, [W_HPBAROLDHP+1]
	ld [$cef0], a
	push hl
	ld a, [$FF00+$f6]
	bit 0, a
	jr z, .asm_fb15
	ld de, $9
	jr .asm_fb18
.asm_fb15
	ld de, $15
.asm_fb18
	add hl, de
	push hl
	ld a, $7f
	ld [hli], a
	ld [hli], a
	ld [hli], a
	pop hl
	ld de, $cef0
	ld bc, $203
	call PrintNumber
	call DelayFrame
	pop hl
.asm_fb2d
	pop de
	pop af
	ret

; known jump sources: fa69 (3:7a69), fa79 (3:7a79), faa2 (3:7aa2)
; calcs number of HP bar pixels for old and new HP value
; d: new pixels
; e: old pixels
UpdateHPBar_CalcOldNewHPBarPixels: ; fb30 (3:7b30)
	push hl
	ld hl, W_HPBARMAXHP
	ld a, [hli]  ; max HP into de
	ld e, a
	ld a, [hli]
	ld d, a
	ld a, [hli]  ; old HP into bc
	ld c, a
	ld a, [hli]
	ld b, a
	ld a, [hli]  ; new HP into hl
	ld h, [hl]
	ld l, a
	push hl
	push de
	call UpdateHPBar_CalcNumberOfHPBarPixels ; calc num pixels for old HP
	ld a, e
	pop de
	pop bc
	push af
	call UpdateHPBar_CalcNumberOfHPBarPixels ; calc num pixels for new HP
	pop af
	ld d, e
	ld e, a
	pop hl
	ret

; known jump sources: 3ee2 (0:3ee2)
Func_fb50: ; fb50 (3:7b50)
	ld a, [$c109]
	cp $4
	jr nz, .asm_fb7f
	ld a, [W_CURMAPTILESET] ; $d367
	ld b, a
	FuncCoord 8, 7 ; $c434
	ld a, [Coord]
	ld c, a
	ld hl, Unknown_fb8b ; $7b8b
.asm_fb62
	ld a, [hli]
	cp $ff
	jr z, .asm_fb7f
	cp b
	jr nz, .asm_fb7b
	ld a, [hli]
	cp c
	jr nz, .asm_fb7c
	ld a, [hl]
	push af
	call EnableAutoTextBoxDrawing
	pop af
	call Func_3ef5
	xor a
	ld [$FF00+$db], a
	ret
.asm_fb7b
	inc hl
.asm_fb7c
	inc hl
	jr .asm_fb62
.asm_fb7f
	ld a, $ff
	ld [$FF00+$db], a
	ld b, BANK(Func_52673)
	ld hl, Func_52673
	jp Bankswitch ; indirect jump to Func_52673 (52673 (14:6673))

Unknown_fb8b: ; fb8b (3:7b8b)
INCBIN "baserom.gbc",$fb8b,$fbd9 - $fb8b

UnnamedText_fbd9: ; fbd9 (3:7bd9)
	TX_FAR _UnnamedText_fbd9
	db $50
; 0xfbd9 + 5 bytes

UnnamedText_fbde: ; fbde (3:7bde)
	TX_FAR _UnnamedText_fbde
	db $50
; 0xfbde + 5 bytes

UnnamedText_fbe3: ; fbe3 (3:7be3)
	TX_FAR _UnnamedText_fbe3
	db $50
; 0xfbe3 + 5 bytes

INCBIN "baserom.gbc",$fbe8,$fc03 - $fbe8

UnnamedText_fc03: ; fc03 (3:7c03)
	TX_FAR _UnnamedText_fc03
	db $50
; 0xfc03 + 5 bytes

UnnamedText_fc08: ; fc08 (3:7c08)
	TX_FAR _UnnamedText_fc08
	db $50
; 0xfc08 + 5 bytes

UnnamedText_fc0d: ; fc0d (3:7c0d)
	TX_FAR _UnnamedText_fc0d
	db $50
; 0xfc0d + 5 bytes

INCBIN "baserom.gbc",$fc12,$fc45 - $fc12

UnnamedText_fc45: ; fc45 (3:7c45)
	TX_FAR _UnnamedText_fc45
	db $50
; 0xfc45 + 5 bytes

SECTION "bank4",ROMX,BANK[$4]

OakAideSprite: ; 10000 (4:4000)
	INCBIN "gfx/sprites/oak_aide.2bpp" ; was $10000
RockerSprite: ; 10180 (4:4180)
	INCBIN "gfx/sprites/rocker.2bpp" ; was $10180
SwimmerSprite: ; 10300 (4:4300)
	INCBIN "gfx/sprites/swimmer.2bpp" ; was $10300
WhitePlayerSprite: ; 10480 (4:4480)
	INCBIN "gfx/sprites/white_player.2bpp" ; was $10480
GymHelperSprite: ; 10540 (4:4540)
	INCBIN "gfx/sprites/gym_helper.2bpp" ; was $10540
OldPersonSprite: ; 10600 (4:4600)
	INCBIN "gfx/sprites/old_person.2bpp" ; was $10600
MartGuySprite: ; 106c0 (4:46c0)
	INCBIN "gfx/sprites/mart_guy.2bpp" ; was $106c0
FisherSprite: ; 10780 (4:4780)
	INCBIN "gfx/sprites/fisher.2bpp" ; was $10780
OldMediumWomanSprite: ; 10840 (4:4840)
	INCBIN "gfx/sprites/old_medium_woman.2bpp" ; was $10840
NurseSprite: ; 10900 (4:4900)
	INCBIN "gfx/sprites/nurse.2bpp" ; was $10900
CableClubWomanSprite: ; 109c0 (4:49c0)
	INCBIN "gfx/sprites/cable_club_woman.2bpp" ; was $109c0
MrMasterballSprite: ; 10a80 (4:4a80)
	INCBIN "gfx/sprites/mr_masterball.2bpp" ; was $10a80
LaprasGiverSprite: ; 10b40 (4:4b40)
	INCBIN "gfx/sprites/lapras_giver.2bpp" ; was $10b40
WardenSprite: ; 10c00 (4:4c00)
	INCBIN "gfx/sprites/warden.2bpp" ; was $10c00
SsCaptainSprite: ; 10cc0 (4:4cc0)
	INCBIN "gfx/sprites/ss_captain.2bpp" ; was $10cc0
Fisher2Sprite: ; 10d80 (4:4d80)
	INCBIN "gfx/sprites/fisher2.2bpp" ; was $10d80
BlackbeltSprite: ; 10f00 (4:4f00)
	INCBIN "gfx/sprites/blackbelt.2bpp" ; was $10f00
GuardSprite: ; 11080 (4:5080)
	INCBIN "gfx/sprites/guard.2bpp" ; was $11080
BallSprite: ; 11140 (4:5140)
	INCBIN "gfx/sprites/ball.2bpp" ; was $11140
OmanyteSprite: ; 11180 (4:5180)
	INCBIN "gfx/sprites/omanyte.2bpp" ; was $11180
BoulderSprite: ; 111c0 (4:51c0)
	INCBIN "gfx/sprites/boulder.2bpp" ; was $111c0
PaperSheetSprite: ; 11200 (4:5200)
	INCBIN "gfx/sprites/paper_sheet.2bpp" ; was $11200
BookMapDexSprite: ; 11240 (4:5240)
	INCBIN "gfx/sprites/book_map_dex.2bpp" ; was $11240
ClipboardSprite: ; 11280 (4:5280)
	INCBIN "gfx/sprites/clipboard.2bpp" ; was $11280
SnorlaxSprite: ; 112c0 (4:52c0)
	INCBIN "gfx/sprites/snorlax.2bpp" ; was $112c0
OldAmberSprite: ; 11300 (4:5300)
	INCBIN "gfx/sprites/old_amber.2bpp" ; was $11300
LyingOldManSprite: ; 11340 (4:5340)
	INCBIN "gfx/sprites/lying_old_man.2bpp" ; was $11340
	
PokemonLogoGraphics: ; 11380 (4:5380)
	INCBIN "gfx/pokemon_logo.2bpp"
FontGraphics: ; 11a80 (4:5a80)
	INCBIN "gfx/font.1bpp"

ABTiles: ; 11e80 (4:5e80)
	INCBIN "gfx/AB.2bpp"

HpBarAndStatusGraphics: ; 11ea0 (4:5ea0)
	INCBIN "gfx/hp_bar_and_status.2bpp"

BattleHudTiles1: ; 12080 (4:6080)
INCBIN "gfx/battle_hud1.1bpp"

BattleHudTiles2: ; 12098 (4:6098)
INCBIN "gfx/battle_hud2.1bpp"

BattleHudTiles3: ; 120b0 (4:60b0)
INCBIN "gfx/battle_hud3.1bpp"

NintendoCopyrightLogoGraphics: ; 120c8 (4:60c8)
INCBIN "gfx/copyright.2bpp"

GamefreakLogoGraphics: ; 121f8 (4:61f8)
INCBIN "gfx/gamefreak.2bpp"

TextBoxGraphics: ; 12288 (4:6288)
	INCBIN "gfx/text_box.2bpp"

PokedexTileGraphics: ; 12488 (4:6488)
INCBIN "gfx/pokedex.2bpp"

WorldMapTileGraphics: ; 125a8 (4:65a8)
INCBIN "gfx/town_map.2bpp"

PlayerCharacterTitleGraphics: ; 126a8 (4:66a8)
INCBIN "gfx/player_title.2bpp"

; known jump sources: 1388d (4:788d)
Func_128d8: ; 128d8 (4:68d8)
	ld a, [W_YCOORD] ; $d361
	ld b, a
	ld a, [W_CURMAPHEIGHT] ; $d368
	call Func_128ea
	ret z
	ld a, [W_XCOORD] ; $d362
	ld b, a
	ld a, [W_CURMAPWIDTH] ; $d369

; known jump sources: 128df (4:68df)
Func_128ea: ; 128ea (4:68ea)
	add a
	cp b
	ret z
	inc b
	ret

; known jump sources: 129e5 (4:69e5), 3cdb9 (f:4db9)
Func_128ef: ; 128ef (4:68ef)
	call Load16BitRegisters
	ld a, $1
	jr asm_128fb

; known jump sources: 12d67 (4:6d67)
Func_128f6: ; 128f6 (4:68f6)
	call Load16BitRegisters
	ld a, $2
asm_128fb: ; 128fb (4:68fb)
	ld [W_LISTMENUID], a ; $cf94
	push hl
	ld a, [$cf99]
	ld b, a
	ld a, [$cf9a]
	ld c, a
	or b
	jr nz, .asm_12913
	xor a
	ld c, a
	ld e, a
	ld a, $6
	ld d, a
	jp Func_12924
.asm_12913
	ld a, [$cfba]
	ld d, a
	ld a, [$cfbb]
	ld e, a
	ld a, $26
	call Predef ; indirect jump to Func_f9dc (f9dc (3:79dc))
	ld a, $6
	ld d, a
	ld c, a

; known jump sources: 12910 (4:6910)
Func_12924: ; 12924 (4:6924)
	pop hl
	push de
	push hl
	push hl
	call DrawHPBar
	pop hl
	ld a, [$FF00+$f6]
	bit 0, a
	jr z, .asm_12937
	ld bc, $9
	jr .asm_1293a
.asm_12937
	ld bc, $15
.asm_1293a
	add hl, bc
	ld de, $cf99
	ld bc, $203
	call PrintNumber
	ld a, $f3
	ld [hli], a
	ld de, $cfba
	ld bc, $203
	call PrintNumber
	pop hl
	pop de
	ret
; 12953 (4:6953)
; Predef 0x37
StatusScreen: ; 12953 (4:6953)
	call LoadMonData
	ld a, [$cc49]
	cp $2 ; 2 means we're in a PC box
	jr c, .DontRecalculate ; 0x1295b $14
	ld a, [$cf9b]
	ld [$cfb9], a
	ld [$d127], a
	ld hl, $cfa8
	ld de, $cfba
	ld b, $1
	call CalcStats ; Recalculate stats
.DontRecalculate
	ld hl, $d72c
	set 1, [hl]
	ld a, $33
	ld [$ff00+$24], a ; Reduce the volume
	call GBPalWhiteOutWithDelay3
	call ClearScreen
	call UpdateSprites ; move sprites (?)
	call LoadHpBarAndStatusTilePatterns
	ld de, BattleHudTiles1  ; $6080 ; source
	ld hl, $96d0 ; dest
	ld bc, (BANK(BattleHudTiles1) << 8) + $03 ; bank bytes/8
	call CopyVideoDataDouble ; ·│ :L and halfarrow line end
	ld de, BattleHudTiles2 ; $6098
	ld hl, $9780
	ld bc, (BANK(BattleHudTiles2) << 8) + $01
	call CopyVideoDataDouble ; │
	ld de, BattleHudTiles3 ; $60b0
	ld hl, $9760
	ld bc, (BANK(BattleHudTiles3) << 8) + $02
	call CopyVideoDataDouble ; ─┘
	ld de, PTile
	ld hl, $9720
	ld bc,(BANK(PTile) << 8 | $01)
	call CopyVideoDataDouble ; P (for PP), inline
	ld a, [$ff00+$d7]
	push af
	xor a
	ld [$ff00+$d7], a
	FuncCoord 19,1
	ld hl, Coord
	ld bc, $060a
	call DrawLineBox ; Draws the box around name, HP and status
	ld de, $fffa
	add hl, de
	ld [hl], $f2 ; . after No ("." is a different one)
	dec hl
	ld [hl], $74 ; No
	FuncCoord 19,9
	ld hl, Coord
	ld bc, $0806
	call DrawLineBox ; Draws the box around types, ID No. and OT
	FuncCoord 10,9
	ld hl, Coord
	ld de, Type1Text
	call PlaceString ; "TYPE1/"
	FuncCoord 11,3
	ld hl, Coord
	PREDEF DrawHPBarPredef ; predef $5f
	ld hl, $cf25
	call Func_3df9
	ld b, $3
	call GoPAL_SET ; SGB palette
	FuncCoord 16,6
	ld hl, Coord
	ld de, $cf9c
	call PrintStatusCondition
	jr nz, .StatusWritten ; 0x129fc $9
	FuncCoord 16,6
	ld hl, Coord
	ld de, OKText
	call PlaceString ; "OK"
.StatusWritten
	FuncCoord 9,6
	ld hl, Coord
	ld de, StatusText
	call PlaceString ; "STATUS/"
	FuncCoord 14,2
	ld hl, Coord
	call PrintLevel ; Pokémon level
	ld a, [$d0b8]
	ld [$d11e], a
	ld [$d0b5], a
	ld a, $3a
	call Predef
	FuncCoord 3,7
	ld hl, Coord
	ld de, $d11e
	ld bc, $8103 ; Zero-padded, 3
	call PrintNumber ; Pokémon no.
	FuncCoord 11,10
	ld hl, Coord
	ld a, $4b
	call Predef ; Prints the type (?)
	ld hl, Unknown_12a9d ; $6a9d
	call .unk_12a7e
	ld d, h
	ld e, l
	FuncCoord 9,1
	ld hl, Coord
	call PlaceString ; Pokémon name
	ld hl, Unknown_12a95 ; $6a95
	call .unk_12a7e
	ld d, h
	ld e, l
	FuncCoord 12,16
	ld hl, Coord
	call PlaceString ; OT
	FuncCoord 12,14
	ld hl, Coord
	ld de, $cfa4
	ld bc, $8205 ; 5
	call PrintNumber ; ID Number
	ld d, $0
	call PrintStatsBox
	call Delay3
	call GBPalNormal
	FuncCoord 1, 0 ; $c3a1
	ld hl, Coord
	call LoadFlippedFrontSpriteByMonIndex ; draw Pokémon picture
	ld a, [$cf91]
	call PlayCry ; play Pokémon cry
	call WaitForTextScrollButtonPress ; wait for button
	pop af
	ld [$ff00+$d7], a
	ret
.unk_12a7e ; 0x12a7e ; I don't know what this does, iterates over pointers?
	ld a, [$cc49]
	add a
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld a, [$cc49]
	cp $3
	ret z
	ld a, [W_WHICHPOKEMON]
	jp SkipFixedLengthTextEntries
; 0x12a95

Unknown_12a95: ; 12a95 (4:6a95)
INCBIN "baserom.gbc",$12a95,$12a9d - $12a95

Unknown_12a9d: ; 12a9d (4:6a9d)
INCBIN "baserom.gbc",$12a9d,$12aa5 - $12a9d

Type1Text: ; 12aa5 (4:6aa5)
	db "TYPE1/", $4e

Type2Text: ; 12aac (4:6aac)
	db "TYPE2/", $4e

IDNoText: ; 12ab3 (4:6ab3)
	db $73, $74, "/", $4e

OTText: ; 12ab7 (4:6ab7)
	db "OT/", $4e, "@"

StatusText: ; 12abc (4:6abc)
	db "STATUS/@"

OKText: ; 12ac4 (4:6ac4)
	db "OK@"

; Draws a line starting from hl high b and wide c
DrawLineBox ; 0x12ac7
	ld de, $0014 ; New line
.PrintVerticalLine
	ld [hl], $78 ; │
	add hl, de
	dec b
	jr nz, .PrintVerticalLine ; 0x12ace $fa
	ld [hl], $77 ; ┘
	dec hl
.PrintHorizLine
	ld [hl], $76 ; ─
	dec hl
	dec c
	jr nz, .PrintHorizLine ; 0x12ad7 $fa
	ld [hl], $6f ; ← (halfarrow ending)
	ret

PTile: ; 12adc (4:6adc) ; This is a single 1bpp "P" tile
	INCBIN "gfx/p_tile.1bpp"

PrintStatsBox: ; 12ae4 (4:6ae4)
	ld a, d
	and a ; a is 0 from the status screen
	jr nz, .DifferentBox ; 0x12ae6 $12
	FuncCoord 0,8
	ld hl, Coord
	ld b, $8
	ld c, $8
	call TextBoxBorder ; Draws the box
	FuncCoord 1,9 ; Start printing stats from here
	ld hl, Coord
	ld bc, $0019 ; Number offset
	jr .PrintStats ; 0x12af8 $10
.DifferentBox
	FuncCoord 9,2
	ld hl, Coord
	ld b, $8
	ld c, $9
	call TextBoxBorder
	FuncCoord 11, 3 ; $c3e7
	ld hl, Coord
	ld bc, $0018
.PrintStats
	push bc
	push hl
	ld de, StatsText
	call PlaceString
	pop hl
	pop bc
	add hl, bc
	ld de, $cfbc
	ld bc, $0203 ; three digits
	call PrintStat
	ld de, $cfbe
	call PrintStat
	ld de, $cfc0
	call PrintStat
	ld de, $cfc2
	jp PrintNumber
PrintStat
	push hl
	call PrintNumber
	pop hl
	ld de, $0028
	add hl, de
	ret

StatsText: ; 12b3a (4:6b3a)
	db "ATTACK", $4e
	db "DEFENSE", $4e
	db "SPEED", $4e
	db "SPECIAL", $50

StatusScreen2: ; 12b57 (4:6b57)
	ld a, [$ff00+$d7]
	push af
	xor a
	ld [$ff00+$d7], a
	ld [$ff00+$ba], a
	ld bc, $0005
	ld hl, $d0dc
	call FillMemory
	ld hl, $cfa0
	ld de, $d0dc
	ld bc, $0004
	call CopyData
	ld hl, Func_39b87
	ld b, BANK(Func_39b87)
	call Bankswitch
	FuncCoord 9,2
	ld hl, Coord
	ld bc, $050a
	call ClearScreenArea ; Clear under name
	FuncCoord 19, 3 ; $c3ef
	ld hl, Coord
	ld [hl], $78
	FuncCoord 0,8
	ld hl, Coord
	ld b, $8
	ld c, $12
	call TextBoxBorder ; Draw move container
	FuncCoord 2,9
	ld hl, Coord
	ld de, $d0e1
	call PlaceString ; Print moves
	ld a, [$cd6c]
	inc a
	ld c, a
	ld a, $4
	sub c
	ld b, a ; Number of moves ?
	FuncCoord 11,10
	ld hl, Coord
	ld de, $0028
	ld a, $72
	call Func_12ccb ; Print "PP"
	ld a, b
	and a
	jr z, .InitPP ; 0x12bb3 $6
	ld c, a
	ld a, $e3
	call Func_12ccb ; Fill the rest with --
.InitPP ; 12bbb
	ld hl, $cfa0
	FuncCoord 14,10
	ld de, Coord
	ld b, $0
.PrintPP ; 12bc3
	ld a, [hli]
	and a
	jr z, .PPDone ; 0x12bc5 $4a
	push bc
	push hl
	push de
	ld hl, W_CURMENUITEMID
	ld a, [hl]
	push af
	ld a, b
	ld [hl], a
	push hl
	ld hl, GetMaxPP
	ld b, BANK(GetMaxPP)
	call Bankswitch
	pop hl
	pop af
	ld [hl], a
	pop de
	pop hl
	push hl
	ld bc, $0014
	add hl, bc
	ld a, [hl]
	and $3f
	ld [$cd71], a
	ld h, d
	ld l, e
	push hl
	ld de, $cd71
	ld bc, $0102
	call PrintNumber
	ld a, "/"
	ld [hli], a
	ld de, $d11e
	ld bc, $0102
	call PrintNumber
	pop hl
	ld de, $0028
	add hl, de
	ld d, h
	ld e, l
	pop hl
	pop bc
	inc b
	ld a, b
	cp $4
	jr nz, .PrintPP ; 0x12c0f $b2
.PPDone
	FuncCoord 9,3
	ld hl, Coord
	ld de, EXPPointsText
	call PlaceString
	ld a, [$cfb9] ; level
	push af
	cp $64
	jr z, .Level100 ; 0x12c20 $4
	inc a
	ld [$cfb9], a ; Increase temporarily if not 100
.Level100
	FuncCoord 14,6
	ld hl, Coord
	ld [hl], $70 ; 1-tile "to"
	inc hl
	inc hl
	call PrintLevel
	pop af
	ld [$cfb9], a
	ld de, $cfa6
	FuncCoord 12,4
	ld hl, Coord
	ld bc, $0307
	call PrintNumber ; exp
	call .asm_12c86
	ld de, $cfa6
	FuncCoord 7,6
	ld hl, Coord
	ld bc, $0307
	call PrintNumber
	FuncCoord 9,0
	ld hl, Coord
	call Func_12cc3
	FuncCoord 9,1
	ld hl, Coord
	call Func_12cc3
	ld a, [$d0b8]
	ld [$d11e], a
	call GetMonName
	FuncCoord 9,1
	ld hl, Coord
	call PlaceString
	ld a, $1
	ld [$ff00+$ba], a
	call Delay3
	call WaitForTextScrollButtonPress ; wait for button
	pop af
	ld [$ff00+$d7], a
	ld hl, $d72c
	res 1, [hl]
	ld a, $77
	ld [$ff00+$24], a
	call GBPalWhiteOut
	jp ClearScreen
.asm_12c86 ; This does some magic with lvl/exp?
	ld a, [$cfb9] ; Load level
	cp $64
	jr z, .asm_12ca7 ; 0x12c8b $1a ; If 100
	inc a
	ld d, a
	ld hl, CalcExperience
	ld b, BANK(CalcExperience)
	call Bankswitch
	ld hl, $cfa8
	ld a, [$ff00+$98]
	sub [hl]
	ld [hld], a
	ld a, [$ff00+$97]
	sbc [hl]
	ld [hld], a
	ld a, [$ff00+$96]
	sbc [hl]
	ld [hld], a
	ret
.asm_12ca7
	ld hl, $cfa6
	xor a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ret

EXPPointsText: ; 12caf (4:6caf)
	db "EXP POINTS", $4e

LevelUpText: ; 12cba (4:6cba)
	db "LEVEL UP", $50

; known jump sources: 12c52 (4:6c52), 12c58 (4:6c58)
Func_12cc3: ; 12cc3 (4:6cc3)
	ld bc, $a
	ld a, $7f
	jp FillMemory

; known jump sources: 12bae (4:6bae), 12bb8 (4:6bb8), 12ccf (4:6ccf)
Func_12ccb: ; 12ccb (4:6ccb)
	ld [hli], a
	ld [hld], a
	add hl, de
	dec c
	jr nz, Func_12ccb
	ret
; 12cd2 (4:6cd2)
; [$D07D] = menu type / message ID
; if less than $F0, it is a menu type
; menu types:
; 00: normal pokemon menu (e.g. Start menu)
; 01: use healing item on pokemon menu
; 02: in-battle switch pokemon menu
; 03: learn TM/HM menu
; 04: swap pokemon positions menu
; 05: use evolution stone on pokemon menu
; otherwise, it is a message ID
; f0: poison healed
; f1: burn healed
; f2: freeze healed
; f3: sleep healed
; f4: paralysis healed
; f5: HP healed
; f6: health returned
; f7: revitalized
; f8: leveled up
DrawPartyMenu_: ; 12cd2 (4:6cd2)
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a
	call ClearScreen
	call UpdateSprites ; move sprites
	ld b, BANK(Func_71791)
	ld hl, Func_71791
	call Bankswitch ; load pokemon icon graphics

RedrawPartyMenu_: ; 12ce3 (4:6ce3)
	ld a,[$D07D]
	cp a,$04
	jp z,.printMessage
	call ErasePartyMenuCursors
	ld b, BANK(Func_71fb6)
	ld hl, Func_71fb6
	call Bankswitch ; loads some data to $cf2e
	FuncCoord 3,0
	ld hl,Coord
	ld de,W_PARTYMON1
	xor a
	ld c,a
	ld [$FF8C],a ; loop counter
	ld [$CF2D],a
.loop
	ld a,[de]
	cp a,$FF ; reached the terminator?
	jp z,.afterDrawingMonEntries
	push bc
	push de
	push hl
	ld a,c
	push hl
	ld hl,W_PARTYMON1NAME
	call GetPartyMonName
	pop hl
	call PlaceString ; print the pokemon's name
	ld b, BANK(Func_71868)
	ld hl, Func_71868
	call Bankswitch ; place the appropriate pokemon icon
	ld a,[$FF8C] ; loop counter
	ld [$CF92],a
	inc a
	ld [$FF8C],a
	call LoadMonData
	pop hl
	push hl
	ld a,[$CC35]
	and a ; is the player swapping pokemon positions?
	jr z,.skipUnfilledRightArrow
; if the player is swapping pokemon positions
	dec a
	ld b,a
	ld a,[$CF92]
	cp b ; is the player swapping the current pokemon in the list?
	jr nz,.skipUnfilledRightArrow
; the player is swapping the current pokemon in the list
	dec hl
	dec hl
	dec hl
	ld a,$EC ; unfilled right arrow menu cursor
	ld [hli],a ; place the cursor
	inc hl
	inc hl
.skipUnfilledRightArrow
	ld a,[$D07D] ; menu type
	cp a,$03
	jr z,.teachMoveMenu
	cp a,$05
	jr z,.evolutionStoneMenu
	push hl
	ld bc,14 ; 14 columns to the right
	add hl,bc
	ld de,$CF9C
	call PrintStatusCondition
	pop hl
	push hl
	ld bc,20 + 1 ; down 1 row and right 1 column
	ld a,[$FFF6]
	set 0,a
	ld [$FFF6],a
	add hl,bc
	ld a,$60
	call Predef ; draw HP bar and prints current / max HP
	ld a,[$FFF6]
	res 0,a
	ld [$FFF6],a
	call Func_12ec7 ; color the HP bar (on SGB)
	pop hl
	jr .printLevel
.teachMoveMenu
	push hl
	ld a,$43
	call Predef ; check if the pokemon can learn the move
	pop hl
	ld de,.ableToLearnMoveText
	ld a,c
	and a
	jr nz,.placeMoveLearnabilityString
	ld de,.notAbleToLearnMoveText
.placeMoveLearnabilityString
	ld bc,20 + 9 ; down 1 row and right 9 columns
	push hl
	add hl,bc
	call PlaceString
	pop hl
.printLevel
	ld bc,10 ; move 10 columns to the right
	add hl,bc
	call PrintLevel
	pop hl
	pop de
	inc de
	ld bc,2 * 20
	add hl,bc
	pop bc
	inc c
	jp .loop
.ableToLearnMoveText
	db "ABLE@"
.notAbleToLearnMoveText
	db "NOT ABLE@"
.evolutionStoneMenu
	push hl
	ld hl,EvosMovesPointerTable
	ld b,0
	ld a,[$CF98] ; pokemon ID
	dec a
	add a
	rl b
	ld c,a
	add hl,bc
	ld de,$CD6D
	ld a,BANK(EvosMovesPointerTable)
	ld bc,2
	call FarCopyData
	ld hl,$CD6D
	ld a,[hli]
	ld h,[hl]
	ld l,a
	ld de,$CD6D
	ld a,BANK(EvosMovesPointerTable)
	ld bc,13
	call FarCopyData
	ld hl,$CD6D
	ld de,.notAbleToEvolveText
; loop through the pokemon's evolution entries
.checkEvolutionsLoop
	ld a,[hli]
	and a ; reached terminator?
	jr z,.placeEvolutionStoneString ; if so, place the "NOT ABLE" string
	inc hl
	inc hl
	cp a,EV_ITEM
	jr nz,.checkEvolutionsLoop
; if it's a stone evolution entry
	dec hl
	dec hl
	ld b,[hl]
	ld a,[$D156] ; evolution stone item ID
	inc hl
	inc hl
	inc hl
	cp b ; does the player's stone match this evolution entry's stone?
	jr nz,.checkEvolutionsLoop
; if it does match
	ld de,.ableToEvolveText
.placeEvolutionStoneString
	ld bc,20 + 9 ; down 1 row and right 9 columns
	pop hl
	push hl
	add hl,bc
	call PlaceString
	pop hl
	jr .printLevel
.ableToEvolveText
	db "ABLE@"
.notAbleToEvolveText
	db "NOT ABLE@"
.afterDrawingMonEntries
	ld b,$0A
	call GoPAL_SET
.printMessage
	ld hl,$D730
	ld a,[hl]
	push af
	push hl
	set 6,[hl] ; turn off letter printing delay
	ld a,[$D07D] ; message ID
	cp a,$F0
	jr nc,.printItemUseMessage
	add a
	ld hl,PartyMenuMessagePointers
	ld b,0
	ld c,a
	add hl,bc
	ld a,[hli]
	ld h,[hl]
	ld l,a
	call PrintText
.done
	pop hl
	pop af
	ld [hl],a
	ld a,1
	ld [H_AUTOBGTRANSFERENABLED],a
	call Delay3
	jp GBPalNormal
.printItemUseMessage
	and a,$0F
	ld hl,PartyMenuItemUseMessagePointers
	add a
	ld c,a
	ld b,0
	add hl,bc
	ld a,[hli]
	ld h,[hl]
	ld l,a
	push hl
	ld a,[$CF06]
	ld hl,W_PARTYMON1NAME
	call GetPartyMonName
	pop hl
	call PrintText
	jr .done

PartyMenuItemUseMessagePointers: ; 12e61 (4:6e61)
	dw AntidoteText
	dw BurnHealText
	dw IceHealText
	dw AwakeningText
	dw ParlyzHealText
	dw PotionText
	dw FullHealText
	dw ReviveText
	dw RareCandyText

PartyMenuMessagePointers: ; 12e73 (4:6e73)
	dw PartyMenuNormalText
	dw PartyMenuItemUseText
	dw PartyMenuBattleText
	dw PartyMenuUseTMText
	dw PartyMenuSwapMonText
	dw PartyMenuItemUseText

PartyMenuNormalText: ; 12e7f (4:6e7f)
	TX_FAR _PartyMenuNormalText
	db $50

PartyMenuItemUseText: ; 12e84 (4:6e84)
	TX_FAR _PartyMenuItemUseText
	db $50

PartyMenuBattleText: ; 12e89 (4:6e89)
	TX_FAR _PartyMenuBattleText
	db $50

PartyMenuUseTMText: ; 12e8e (4:6e8e)
	TX_FAR _PartyMenuUseTMText
	db $50

PartyMenuSwapMonText: ; 12e93 (4:6e93)
	TX_FAR _PartyMenuSwapMonText
	db $50

PotionText: ; 12e98 (4:6e98)
	TX_FAR _PotionText
	db $50

AntidoteText: ; 12e9d (4:6e9d)
	TX_FAR _AntidoteText
	db $50

ParlyzHealText: ; 12ea2 (4:6ea2)
	TX_FAR _ParlyzHealText
	db $50

BurnHealText: ; 12ea7 (4:6ea7)
	TX_FAR _BurnHealText
	db $50

IceHealText: ; 12eac (4:6eac)
	TX_FAR _IceHealText
	db $50

AwakeningText: ; 12eb1 (4:6eb1)
	TX_FAR _AwakeningText
	db $50

FullHealText: ; 12eb6 (4:6eb6)
	TX_FAR _FullHealText
	db $50

ReviveText: ; 12ebb (4:6ebb)
	TX_FAR _ReviveText
	db $50

RareCandyText: ; 12ec0 (4:6ec0)
	TX_FAR _RareCandyText
	db $0B
	db $06
	db $50

; known jump sources: 12d70 (4:6d70)
Func_12ec7: ; 12ec7 (4:6ec7)
	ld hl, $cf1f
	ld a, [$cf2d]
	ld c, a
	ld b, $0
	add hl, bc
	call Func_3df9
	ld b, $fc
	call GoPAL_SET
	ld hl, $cf2d
	inc [hl]
	ret
; 12ede (4:6ede)

RedPicFront: ; 12ede (4:6ede)
	INCBIN "pic/trainer/red.pic"
ShrinkPic1: ; 12fe8 (4:6fe8)
	INCBIN "pic/trainer/shrink1.pic"
ShrinkPic2: ; 13042 (4:7042)
	INCBIN "pic/trainer/shrink2.pic"

; known jump sources: 2976 (0:2976)
Func_13074: ; 13074 (4:7074)
	ld h, $c2
	ld a, [H_CURRENTSPRITEOFFSET]
	add $8
	ld l, a
	ld a, $7f
	ld [hl], a
	dec h
	ld a, [H_CURRENTSPRITEOFFSET]
	add $9
	ld l, a
	ld a, [hld]
	ld b, a
	xor a
	ld [hld], a
	ld [hl], a
	ld a, [H_CURRENTSPRITEOFFSET]
	add $2
	ld l, a
	ld a, [hl]
	or b
	ld [hld], a
	ld a, $2
	ld [hl], a
	ret
; 13095 (4:7095)
StartMenu_Pokedex: ; 13095 (4:7095)
	ld a,$29
	call Predef
	call LoadScreenTilesFromBuffer2 ; restore saved screen
	call Delay3
	call LoadGBPal
	call UpdateSprites
	jp RedisplayStartMenu

StartMenu_Pokemon: ; 130a9 (4:70a9)
	ld a,[W_NUMINPARTY]
	and a
	jp z,RedisplayStartMenu
	xor a
	ld [$cc35],a
	ld [$d07d],a
	ld [$cfcb],a
	call DisplayPartyMenu
	jr .checkIfPokemonChosen
.loop
	xor a
	ld [$cc35],a
	ld [$d07d],a
	call GoBackToPartyMenu
.checkIfPokemonChosen
	jr nc,.chosePokemon
.exitMenu
	call GBPalWhiteOutWithDelay3
	call Func_3dbe
	call LoadGBPal
	jp RedisplayStartMenu
.chosePokemon
	call SaveScreenTilesToBuffer1 ; save screen
	ld a,$04
	ld [$d125],a
	call DisplayTextBoxID ; display pokemon menu options
	ld hl,$cd3d
	ld bc,$020c ; max menu item ID, top menu item Y
	ld e,5
.adjustMenuVariablesLoop
	dec e
	jr z,.storeMenuVariables
	ld a,[hli]
	and a
	jr z,.storeMenuVariables
	inc b
	dec c
	dec c
	jr .adjustMenuVariablesLoop
.storeMenuVariables
	ld hl,W_TOPMENUITEMY
	ld a,c
	ld [hli],a ; top menu item Y
	ld a,[$fff7]
	ld [hli],a ; top menu item X
	xor a
	ld [hli],a ; current menu item ID
	inc hl
	ld a,b
	ld [hli],a ; max menu item ID
	ld a,%00000011 ; A button, B button
	ld [hli],a ; menu watched keys
	xor a
	ld [hl],a
	call HandleMenuInput
	push af
	call LoadScreenTilesFromBuffer1 ; restore saved screen
	pop af
	bit 1,a ; was the B button pressed?
	jp nz,.loop
; if the B button wasn't pressed
	ld a,[W_MAXMENUITEMID]
	ld b,a
	ld a,[W_CURMENUITEMID] ; menu selection
	cp b
	jp z,.exitMenu ; if the player chose Cancel
	dec b
	cp b
	jr z,.choseSwitch
	dec b
	cp b
	jp z,.choseStats
	ld c,a
	ld b,0
	ld hl,$cd3d
	add hl,bc
	jp .choseOutOfBattleMove
.choseSwitch
	ld a,[W_NUMINPARTY]
	cp a,2 ; is there more than one pokemon in the party?
	jp c,StartMenu_Pokemon ; if not, no switching
	call Func_13653
	ld a,$04 ; swap pokemon positions menu
	ld [$d07d],a
	call GoBackToPartyMenu
	jp .checkIfPokemonChosen
.choseStats
	call CleanLCD_OAM
	xor a
	ld [$cc49],a
	ld a,$36
	call Predef
	ld a,$37
	call Predef
	call ReloadMapData
	jp StartMenu_Pokemon
.choseOutOfBattleMove
	push hl
	ld a,[$cf92]
	ld hl,W_PARTYMON1NAME
	call GetPartyMonName
	pop hl
	ld a,[hl]
	dec a
	add a
	ld b,0
	ld c,a
	ld hl,.outOfBattleMovePointers
	add hl,bc
	ld a,[hli]
	ld h,[hl]
	ld l,a
	ld a,[W_OBTAINEDBADGES] ; badges obtained
	jp [hl]
.outOfBattleMovePointers
	dw .cut
	dw .fly
	dw .surf
	dw .surf
	dw .strength
	dw .flash
	dw .dig
	dw .teleport
	dw .softboiled
.fly
	bit 2,a ; does the player have the Thunder Badge?
	jp z,.newBadgeRequired
	call CheckIfInOutsideMap
	jr z,.canFly
	ld a,[$cf92]
	ld hl,W_PARTYMON1NAME
	call GetPartyMonName
	ld hl,.cannotFlyHereText
	call PrintText
	jp .loop
.canFly
	call ChooseFlyDestination
	ld a,[$d732]
	bit 3,a ; did the player decide to fly?
	jp nz,.goBackToMap
	call LoadFontTilePatterns
	ld hl,$d72e
	set 1,[hl]
	jp StartMenu_Pokemon
.cut
	bit 1,a ; does the player have the Cascade Badge?
	jp z,.newBadgeRequired
	ld a,$3c
	call Predef
	ld a,[$cd6a]
	and a
	jp z,.loop
	jp CloseTextDisplay
.surf
	bit 4,a ; does the player have the Soul Badge?
	jp z,.newBadgeRequired
	ld b, BANK(Func_cdc0)
	ld hl, Func_cdc0
	call Bankswitch
	ld hl,$d728
	bit 1,[hl]
	res 1,[hl]
	jp z,.loop
	ld a,SURFBOARD
	ld [$cf91],a
	ld [$d152],a
	call UseItem
	ld a,[$cd6a]
	and a
	jp z,.loop
	call GBPalWhiteOutWithDelay3
	jp .goBackToMap
.strength
	bit 3,a ; does the player have the Rainbow Badge?
	jp z,.newBadgeRequired
	ld a,$5b
	call Predef
	call GBPalWhiteOutWithDelay3
	jp .goBackToMap
.flash
	bit 0,a ; does the player have the Boulder Badge?
	jp z,.newBadgeRequired
	xor a
	ld [$d35d],a
	ld hl,.flashLightsAreaText
	call PrintText
	call GBPalWhiteOutWithDelay3
	jp .goBackToMap
.flashLightsAreaText
	TX_FAR _FlashLightsAreaText
	db $50
.dig
	ld a,ESCAPE_ROPE
	ld [$cf91],a
	ld [$d152],a
	call UseItem
	ld a,[$cd6a]
	and a
	jp z,.loop
	call GBPalWhiteOutWithDelay3
	jp .goBackToMap
.teleport
	call CheckIfInOutsideMap
	jr z,.canTeleport
	ld a,[$cf92]
	ld hl,W_PARTYMON1NAME
	call GetPartyMonName
	ld hl,.cannotUseTeleportNowText
	call PrintText
	jp .loop
.canTeleport
	ld hl,.warpToLastPokemonCenterText
	call PrintText
	ld hl,$d732
	set 3,[hl]
	set 6,[hl]
	ld hl,$d72e
	set 1,[hl]
	res 4,[hl]
	ld c,60
	call DelayFrames
	call GBPalWhiteOutWithDelay3 ; zero all three palettes and wait 3 V-blanks
	jp .goBackToMap
.warpToLastPokemonCenterText
	TX_FAR _WarpToLastPokemonCenterText
	db $50
.cannotUseTeleportNowText
	TX_FAR _CannotUseTeleportNowText
	db $50
.cannotFlyHereText
	TX_FAR _CannotFlyHereText
	db $50
.softboiled
	ld hl,W_PARTYMON1_MAXHP
	ld a,[$cf92]
	ld bc,44
	call AddNTimes
	ld a,[hli]
	ld [H_DIVIDEND],a
	ld a,[hl]
	ld [H_DIVIDEND + 1],a
	ld a,5
	ld [H_DIVISOR],a
	ld b,2 ; number of bytes
	call Divide
	ld bc,-33
	add hl,bc
	ld a,[hld]
	ld b,a
	ld a,[H_QUOTIENT + 3]
	sub b
	ld b,[hl]
	ld a,[H_QUOTIENT + 2]
	sbc b
	jp nc,.notHealthyEnough
	ld a,[$cc2b]
	push af
	ld a,POTION
	ld [$cf91],a
	ld [$d152],a
	call UseItem
	pop af
	ld [$cc2b],a
	jp .loop
.notHealthyEnough ; if current HP is less than 1/5 of max HP
	ld hl,.notHealthyEnoughText
	call PrintText
	jp .loop
.notHealthyEnoughText
	TX_FAR _NotHealthyEnoughText
	db $50
.goBackToMap
	call Func_3dbe
	jp CloseTextDisplay
.newBadgeRequired
	ld hl,.newBadgeRequiredText
	call PrintText
	jp .loop
.newBadgeRequiredText
	TX_FAR _NewBadgeRequiredText
	db $50

; writes a blank tile to all possible menu cursor positions on the party menu
ErasePartyMenuCursors: ; 132ed (4:72ed)
	FuncCoord 0,1
	ld hl,Coord
	ld bc,2 * 20 ; menu cursor positions are 2 rows apart
	ld a,6 ; 6 menu cursor positions
.loop
	ld [hl]," "
	add hl,bc
	dec a
	jr nz,.loop
	ret

ItemMenuLoop: ; 132fc (4:72fc)
	call LoadScreenTilesFromBuffer2DisableBGTransfer ; restore saved screen
	call GoPAL_SET_CF1C

StartMenu_Item: ; 13302 (4:7302)
	ld a,[W_ISLINKBATTLE]
	dec a
	jr nz,.notInLinkBattle
	ld hl,CannotUseItemsHereText
	call PrintText
	jr .exitMenu
.notInLinkBattle
	ld bc,W_NUMBAGITEMS
	ld hl,$cf8b
	ld a,c
	ld [hli],a
	ld [hl],b ; store item bag pointer at $cf8b (for DisplayListMenuID)
	xor a
	ld [$cf93],a
	ld a,ITEMLISTMENU
	ld [W_LISTMENUID],a
	ld a,[$cc2c]
	ld [W_CURMENUITEMID],a
	call DisplayListMenuID
	ld a,[W_CURMENUITEMID]
	ld [$cc2c],a
	jr nc,.choseItem
.exitMenu
	call LoadScreenTilesFromBuffer2 ; restore saved screen
	call LoadTextBoxTilePatterns
	call UpdateSprites ; move sprites
	jp RedisplayStartMenu
.choseItem
; erase menu cursor (blank each tile in front of an item name)
	ld a," "
	FuncCoord 5,4
	ld [Coord],a
	FuncCoord 5,6
	ld [Coord],a
	FuncCoord 5,8
	ld [Coord],a
	FuncCoord 5,10
	ld [Coord],a
	call PlaceUnfilledArrowMenuCursor
	xor a
	ld [$cc35],a
	ld a,[$cf91]
	cp a,BICYCLE
	jp z,.useOrTossItem
.notBicycle1
	ld a,$06 ; use/toss menu
	ld [$d125],a
	call DisplayTextBoxID
	ld hl,W_TOPMENUITEMY
	ld a,11
	ld [hli],a ; top menu item Y
	ld a,14
	ld [hli],a ; top menu item X
	xor a
	ld [hli],a ; current menu item ID
	inc hl
	inc a ; a = 1
	ld [hli],a ; max menu item ID
	ld a,%00000011 ; A button, B button
	ld [hli],a ; menu watched keys
	xor a
	ld [hl],a ; old menu item id
	call HandleMenuInput
	call PlaceUnfilledArrowMenuCursor
	bit 1,a ; was the B button pressed?
	jr z,.useOrTossItem
	jp ItemMenuLoop
.useOrTossItem ; if the player made the choice to use or toss the item
	ld a,[$cf91]
	ld [$d11e],a
	call GetItemName
	call CopyStringToCF4B ; copy name to $cf4b
	ld a,[$cf91]
	cp a,BICYCLE
	jr nz,.notBicycle2
	ld a,[$d732]
	bit 5,a
	jr z,.useItem_closeMenu
	ld hl,CannotGetOffHereText
	call PrintText
	jp ItemMenuLoop
.notBicycle2
	ld a,[W_CURMENUITEMID]
	and a
	jr nz,.tossItem
.useItem
	ld [$d152],a
	ld a,[$cf91]
	cp a,HM_01
	jr nc,.useItem_partyMenu
	ld hl,UsableItems_CloseMenu
	ld de,1
	call IsInArray
	jr c,.useItem_closeMenu
	ld a,[$cf91]
	ld hl,UsableItems_PartyMenu
	ld de,1
	call IsInArray
	jr c,.useItem_partyMenu
	call UseItem
	jp ItemMenuLoop
.useItem_closeMenu
	xor a
	ld [$d152],a
	call UseItem
	ld a,[$cd6a]
	and a
	jp z,ItemMenuLoop
	jp CloseStartMenu
.useItem_partyMenu
	ld a,[$cfcb]
	push af
	call UseItem
	ld a,[$cd6a]
	cp a,$02
	jp z,.partyMenuNotDisplayed
	call GBPalWhiteOutWithDelay3
	call Func_3dbe
	pop af
	ld [$cfcb],a
	jp StartMenu_Item
.partyMenuNotDisplayed
	pop af
	ld [$cfcb],a
	jp ItemMenuLoop
.tossItem
	call IsKeyItem
	ld a,[$d124]
	and a
	jr nz,.skipAskingQuantity
	ld a,[$cf91]
	call IsItemHM
	jr c,.skipAskingQuantity
	call DisplayChooseQuantityMenu
	inc a
	jr z,.tossZeroItems
.skipAskingQuantity
	ld hl,W_NUMBAGITEMS
	call TossItem
.tossZeroItems
	jp ItemMenuLoop

CannotUseItemsHereText: ; 1342a (4:742a)
	TX_FAR _CannotUseItemsHereText
	db $50

CannotGetOffHereText: ; 1342f (4:742f)
	TX_FAR _CannotGetOffHereText
	db $50

; items which bring up the party menu when used
UsableItems_PartyMenu: ; 13434 (4:7434)
	db MOON_STONE
	db ANTIDOTE
	db BURN_HEAL
	db ICE_HEAL
	db AWAKENING
	db PARLYZ_HEAL
	db FULL_RESTORE
	db MAX_POTION
	db HYPER_POTION
	db SUPER_POTION
	db POTION
	db FIRE_STONE
	db THUNDER_STONE
	db WATER_STONE
	db HP_UP
	db PROTEIN
	db IRON
	db CARBOS
	db CALCIUM
	db RARE_CANDY
	db LEAF_STONE
	db FULL_HEAL
	db REVIVE
	db MAX_REVIVE
	db FRESH_WATER
	db SODA_POP
	db LEMONADE
	db X_ATTACK
	db X_DEFEND
	db X_SPEED
	db X_SPECIAL
	db PP_UP
	db ETHER
	db MAX_ETHER
	db ELIXER
	db MAX_ELIXER
	db $ff

; items which close the item menu when used
UsableItems_CloseMenu: ; 13459 (4:7459)
	db ESCAPE_ROPE
	db ITEMFINDER
	db POKE_FLUTE
	db OLD_ROD
	db GOOD_ROD
	db SUPER_ROD
	db $ff

StartMenu_TrainerInfo: ; 13460 (4:7460)
	call GBPalWhiteOut
	call ClearScreen
	call UpdateSprites ; move sprites
	ld a,[$ffd7]
	push af
	xor a
	ld [$ffd7],a
	call DrawTrainerInfo
	ld a,$2e
	call Predef ; draw badges
	ld b,$0d
	call GoPAL_SET
	call GBPalNormal
	call WaitForTextScrollButtonPress ; wait for button press
	call GBPalWhiteOut
	call LoadFontTilePatterns
	call LoadScreenTilesFromBuffer2 ; restore saved screen
	call GoPAL_SET_CF1C
	call ReloadMapData
	call LoadGBPal
	pop af
	ld [$ffd7],a
	jp RedisplayStartMenu

; loads tile patterns and draws everything except for gym leader faces / badges
DrawTrainerInfo: ; 1349a (4:749a)
	ld de,RedPicFront
	ld bc,$0401
	ld a,$3b
	call Predef
	call DisableLCD
	FuncCoord 0,2
	ld hl,Coord
	ld a," "
	call TrainerInfo_DrawVerticalLine
	FuncCoord 1,2
	ld hl,Coord
	call TrainerInfo_DrawVerticalLine
	ld hl,$9070
	ld de,$9000
	ld bc,$01c0
	call CopyData
	ld hl,TrainerInfoTextBoxTileGraphics ; $7b98 ; trainer info text box tile patterns
	ld de,$9770
	ld bc,$0080
	push bc
	call TrainerInfo_FarCopyData
	ld hl,BlankLeaderNames ; $7c28
	ld de,$9600
	ld bc,$0170
	call TrainerInfo_FarCopyData
	pop bc
	ld hl,BadgeNumbersTileGraphics  ; $7d98 ; badge number tile patterns
	ld de,$8d80
	call TrainerInfo_FarCopyData
	ld hl,GymLeaderFaceAndBadgeTileGraphics  ; $6a9e ; gym leader face and badge tile patterns
	ld de,$9200
	ld bc,$0400
	ld a,$03
	call FarCopyData2
	ld hl,TextBoxGraphics ; $6288
	ld de,$00d0
	add hl,de ; hl = colon tile pattern
	ld de,$8d60
	ld bc,$0010
	ld a,$04
	push bc
	call FarCopyData2
	pop bc
	ld hl,TrainerInfoTextBoxTileGraphics + $80  ; $7c18 ; background tile pattern
	ld de,$8d70
	call TrainerInfo_FarCopyData
	call EnableLCD
	ld hl,$cd3d
	ld a,18 + 1
	ld [hli],a
	dec a
	ld [hli],a
	ld [hl],1
	FuncCoord 0,0
	ld hl,Coord
	call TrainerInfo_DrawTextBox
	ld hl,$cd3d
	ld a,16 + 1
	ld [hli],a
	dec a
	ld [hli],a
	ld [hl],3
	FuncCoord 1,10
	ld hl,Coord
	call TrainerInfo_DrawTextBox
	FuncCoord 0,10
	ld hl,Coord
	ld a,$d7
	call TrainerInfo_DrawVerticalLine
	FuncCoord 19,10
	ld hl,Coord
	call TrainerInfo_DrawVerticalLine
	FuncCoord 6,9
	ld hl,Coord
	ld de,TrainerInfo_BadgesText
	call PlaceString
	FuncCoord 2,2
	ld hl,Coord
	ld de,TrainerInfo_NameMoneyTimeText
	call PlaceString
	FuncCoord 7,2
	ld hl,Coord
	ld de,W_PLAYERNAME
	call PlaceString
	FuncCoord 8,4
	ld hl,Coord
	ld de,W_PLAYERMONEY3
	ld c,$e3
	call PrintBCDNumber
	FuncCoord 9,6
	ld hl,Coord
	ld de,$da41 ; hours
	ld bc,$4103
	call PrintNumber
	ld [hl],$d6 ; colon tile ID
	inc hl
	ld de,$da43 ; minutes
	ld bc,$8102
	jp PrintNumber

TrainerInfo_FarCopyData: ; 1357f (4:757f)
	ld a,$0b
	jp FarCopyData2

TrainerInfo_NameMoneyTimeText: ; 13584 (4:7584)
	db "NAME/",$4E
	db "MONEY/",$4E
	db "TIME/@"

; $76 is a circle tile
TrainerInfo_BadgesText: ; 13597 (4:7597)
	db $76,"BADGES",$76,"@"

; draws a text box on the trainer info screen
; height is always 6
; INPUT:
; hl = destination address
; [$cd3d] = width + 1
; [$cd3e] = width
; [$cd3f] = distance from the end of a text box row to the start of the next
TrainerInfo_DrawTextBox: ; 135a0 (4:75a0)
	ld a,$79 ; upper left corner tile ID
	ld de,$7a7b ; top edge and upper right corner tile ID's
	call TrainerInfo_DrawHorizontalEdge ; draw top edge
	call TrainerInfo_NextTextBoxRow
	ld a,[$cd3d] ; width of the text box plus one
	ld e,a
	ld d,0
	ld c,6 ; height of the text box
.loop
	ld [hl],$7c ; left edge tile ID
	add hl,de
	ld [hl],$78 ; right edge tile ID
	call TrainerInfo_NextTextBoxRow
	dec c
	jr nz,.loop
	ld a,$7d ; lower left corner tile ID
	ld de,$777e ; bottom edge and lower right corner tile ID's

TrainerInfo_DrawHorizontalEdge: ; 135c3 (4:75c3)
	ld [hli],a ; place left corner tile
	ld a,[$cd3e] ; width of the text box
	ld c,a
	ld a,d
.loop
	ld [hli],a ; place edge tile
	dec c
	jr nz,.loop
	ld a,e
	ld [hl],a ; place right corner tile
	ret

TrainerInfo_NextTextBoxRow: ; 135d0 (4:75d0)
	ld a,[$cd3f] ; distance to the start of the next row
.loop
	inc hl
	dec a
	jr nz,.loop
	ret

; draws a vertical line
; INPUT:
; hl = address of top tile in the line
; a = tile ID
TrainerInfo_DrawVerticalLine: ; 135d8 (4:75d8)
	ld de,20
	ld c,8
.loop
	ld [hl],a
	add hl,de
	dec c
	jr nz,.loop
	ret

StartMenu_SaveReset: ; 135e3 (4:75e3)
	ld a,[$d72e]
	bit 6,a ; is the player using the link feature?
	jp nz,InitGame
	ld a,$3f
	call Predef ; save the game
	call LoadScreenTilesFromBuffer2 ; restore saved screen
	jp HoldTextDisplayOpen

StartMenu_Option: ; 135f6 (4:75f6)
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a
	call ClearScreen
	call UpdateSprites
	ld hl,DisplayOptionMenu
	ld b,BANK(DisplayOptionMenu)
	call Bankswitch
	call LoadScreenTilesFromBuffer2 ; restore saved screen
	call LoadTextBoxTilePatterns
	call UpdateSprites
	jp RedisplayStartMenu

; known jump sources: 14cf (0:14cf)
Func_13613: ; 13613 (4:7613)
	call Func_13653
	ld a, [W_WHICHTRADE] ; $cd3d
	call Func_13625
	ld a, [W_CURMENUITEMID] ; $cc26
	call Func_13625
	jp RedrawPartyMenu_

; known jump sources: 13619 (4:7619), 1361f (4:761f)
Func_13625: ; 13625 (4:7625)
	push af
	ld hl, W_SCREENTILESBUFFER
	ld bc, $28
	call AddNTimes
	ld c, $28
	ld a, $7f
.asm_13633
	ld [hli], a
	dec c
	jr nz, .asm_13633
	pop af
	ld hl, W_OAMBUFFER
	ld bc, $10
	call AddNTimes
	ld de, $4
	ld c, e
.asm_13645
	ld [hl], $a0
	add hl, de
	dec c
	jr nz, .asm_13645
	call WaitForSoundToFinish
	ld a, $ae
	jp PlaySound

; known jump sources: 1313b (4:713b), 13613 (4:7613)
Func_13653: ; 13653 (4:7653)
	ld a, [$cc35]
	and a
	jr nz, .asm_13661
	ld a, [W_WHICHPOKEMON] ; $cf92
	inc a
	ld [$cc35], a
	ret
.asm_13661
	xor a
	ld [$d07d], a
	ld a, [$cc35]
	dec a
	ld b, a
	ld a, [W_CURMENUITEMID] ; $cc26
	ld [W_WHICHTRADE], a ; $cd3d
	cp b
	jr nz, .asm_1367b
	xor a
	ld [$cc35], a
	ld [$d07d], a
	ret
.asm_1367b
	ld a, b
	ld [$cc35], a
	push hl
	push de
	ld hl, W_PARTYMON1 ; $d164
	ld d, h
	ld e, l
	ld a, [W_CURMENUITEMID] ; $cc26
	add l
	ld l, a
	jr nc, .asm_1368e
	inc h
.asm_1368e
	ld a, [$cc35]
	add e
	ld e, a
	jr nc, .asm_13696
	inc d
.asm_13696
	ld a, [hl]
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ld a, [de]
	ld [hl], a
	ld a, [H_DIVIDEND] ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ld [de], a
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	ld bc, $2c
	ld a, [W_CURMENUITEMID] ; $cc26
	call AddNTimes
	push hl
	ld de, $cc97
	ld bc, $2c
	call CopyData
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	ld bc, $2c
	ld a, [$cc35]
	call AddNTimes
	pop de
	push hl
	ld bc, $2c
	call CopyData
	pop de
	ld hl, $cc97
	ld bc, $2c
	call CopyData
	ld hl, W_PARTYMON1OT ; $d273
	ld a, [W_CURMENUITEMID] ; $cc26
	call SkipFixedLengthTextEntries
	push hl
	ld de, $cc97
	ld bc, $b
	call CopyData
	ld hl, W_PARTYMON1OT ; $d273
	ld a, [$cc35]
	call SkipFixedLengthTextEntries
	pop de
	push hl
	ld bc, $b
	call CopyData
	pop de
	ld hl, $cc97
	ld bc, $b
	call CopyData
	ld hl, W_PARTYMON1NAME ; $d2b5
	ld a, [W_CURMENUITEMID] ; $cc26
	call SkipFixedLengthTextEntries
	push hl
	ld de, $cc97
	ld bc, $b
	call CopyData
	ld hl, W_PARTYMON1NAME ; $d2b5
	ld a, [$cc35]
	call SkipFixedLengthTextEntries
	pop de
	push hl
	ld bc, $b
	call CopyData
	pop de
	ld hl, $cc97
	ld bc, $b
	call CopyData
	ld a, [$cc35]
	ld [W_WHICHTRADE], a ; $cd3d
	xor a
	ld [$cc35], a
	ld [$d07d], a
	pop de
	pop hl
	ret

; known jump sources: e50c (3:650c), 12d79 (4:6d79)
; tests if mon [$cf91] can learn move [$d0e0]
TestMonMoveCompatibility: ; 1373e (4:773e)
	ld a, [$cf91]
	ld [$d0b5], a
	call GetMonHeader
	ld hl, W_MONHLEARNSET
	push hl
	ld a, [$d0e0]
	ld b, a
	ld c, $0
	ld hl, TechnicalMachines
.findTMloop
	ld a, [hli]
	cp b
	jr z, .TMfoundLoop
	inc c
	jr .findTMloop
.TMfoundLoop
	pop hl
	ld b, $2  ; read corresponding bit from TM compatibility array
	ld a, $10
	jp Predef ; indirect jump to HandleBitArray (f666 (3:7666))

; known jump sources: e490 (3:6490)
; converts TM/HM number in $d11e into move number
; HMs start at 51
TMToMove: ; 13763 (4:7763)
	ld a, [$d11e]
	dec a
	ld hl, TechnicalMachines
	ld b, $0
	ld c, a
	add hl, bc
	ld a, [hl]
	ld [$d11e], a
	ret
; 13773 (4:7773)

TechnicalMachines: ; 13773 (4:7773)
	db MEGA_PUNCH
	db RAZOR_WIND
	db SWORDS_DANCE
	db WHIRLWIND
	db MEGA_KICK
	db TOXIC
	db HORN_DRILL
	db BODY_SLAM
	db TAKE_DOWN
	db DOUBLE_EDGE
	db BUBBLEBEAM
	db WATER_GUN
	db ICE_BEAM
	db BLIZZARD
	db HYPER_BEAM
	db PAY_DAY
	db SUBMISSION
	db COUNTER
	db SEISMIC_TOSS
	db RAGE
	db MEGA_DRAIN
	db SOLARBEAM
	db DRAGON_RAGE
	db THUNDERBOLT
	db THUNDER
	db EARTHQUAKE
	db FISSURE
	db DIG
	db PSYCHIC_M
	db TELEPORT
	db MIMIC
	db DOUBLE_TEAM
	db REFLECT
	db BIDE
	db METRONOME
	db SELFDESTRUCT
	db EGG_BOMB
	db FIRE_BLAST
	db SWIFT
	db SKULL_BASH
	db SOFTBOILED
	db DREAM_EATER
	db SKY_ATTACK
	db REST
	db THUNDER_WAVE
	db PSYWAVE
	db EXPLOSION
	db ROCK_SLIDE
	db TRI_ATTACK
	db SUBSTITUTE
	db CUT
	db FLY
	db SURF
	db STRENGTH
	db FLASH

; known jump sources: 3f038 (f:7038)
Func_137aa: ; 137aa (4:77aa)
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr nz, .asm_137eb
	ld a, [W_ENEMYMONNUMBER] ; $cfe8
	ld hl, $d8a8
	ld bc, $2c
	call AddNTimes
	ld a, [W_ENEMYMONSTATUS] ; $cfe9
	ld [hl], a
	call ClearScreen
	ld hl, Func_372d6
	ld b, BANK(Func_372d6)
	call Bankswitch ; indirect jump to Func_372d6 (372d6 (d:72d6))
	ld a, [$cf0b]
	cp $1
	ld de, Unknown_13853 ; $7853
	jr c, .asm_137de
	ld de, Unknown_1385b ; $785b
	jr z, .asm_137de
	ld de, Unknown_13864 ; $7864
.asm_137de
	FuncCoord 6, 8 ; $c446
	ld hl, Coord
	call PlaceString
	ld c, $c8
	call DelayFrames
	jr .asm_1380a
.asm_137eb
	ld a, [$cf0b]
	and a
	jr nz, .asm_13813
	ld hl, $cce5
	ld a, [hli]
	or [hl]
	inc hl
	or [hl]
	jr z, .asm_1380a
	ld de, W_PLAYERMONEY1 ; $d349
	ld c, $3
	ld a, $b
	call Predef ; indirect jump to Func_f81d (f81d (3:781d))
	ld hl, UnnamedText_1386b ; $786b
	call PrintText
.asm_1380a
	xor a
	ld [$ccd4], a
	ld a, $2a
	call Predef ; indirect jump to Func_3ad1c (3ad1c (e:6d1c))
.asm_13813
	xor a
	ld [$d083], a
	ld [$c02a], a
	ld [W_ISINBATTLE], a ; $d057
	ld [W_BATTLETYPE], a ; $d05a
	ld [W_MOVEMISSED], a ; $d05f
	ld [W_CUROPPONENT], a ; $d059
	ld [$d11f], a
	ld [$d120], a
	ld [$d078], a
	ld hl, $cc2b
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld [W_LISTSCROLLOFFSET], a ; $cc36
	ld hl, $d060
	ld b, $18
.asm_1383e
	ld [hli], a
	dec b
	jr nz, .asm_1383e
	ld hl, $d72c
	set 0, [hl]
	call WaitForSoundToFinish
	call GBPalWhiteOut
	ld a, $ff
	ld [$d42f], a
	ret

Unknown_13853: ; 13853 (4:7853)
INCBIN "baserom.gbc",$13853,$1385b - $13853

Unknown_1385b: ; 1385b (4:785b)
INCBIN "baserom.gbc",$1385b,$13864 - $1385b

Unknown_13864: ; 13864 (4:7864)
INCBIN "baserom.gbc",$13864,$1386b - $13864

UnnamedText_1386b: ; 1386b (4:786b)
	TX_FAR _UnnamedText_1386b
	db $50
; 0x1386b + 5 bytes

; known jump sources: 3ef39 (f:6f39)
Func_13870: ; 13870 (4:7870)
	ld a, [$cc57]
	and a
	ret nz
	ld a, [$d736]
	and a
	ret nz
	ld hl, Func_c49d
	ld b, BANK(Func_c49d)
	call Bankswitch ; indirect jump to Func_c49d (c49d (3:449d))
	jr nc, .asm_13888
.asm_13884
	ld a, $1
	and a
	ret
.asm_13888
	ld hl, Func_128d8
	ld b, BANK(Func_128d8)
	call Bankswitch ; indirect jump to Func_128d8 (128d8 (4:68d8))
	jr z, .asm_13884
	ld a, [$d0db]
	and a
	jr z, .asm_1389e
	dec a
	jr z, .asm_13905
	ld [$d0db], a
.asm_1389e
	FuncCoord 9, 9 ; $c45d
	ld hl, Coord
	ld c, [hl]
	ld a, [W_GRASSTILE]
	cp c
	ld a, [W_GRASSRATE] ; $d887
	jr z, .asm_138c4
	ld a, $14
	cp c
	ld a, [W_WATERRATE] ; $d8a4
	jr z, .asm_138c4
	ld a, [W_CURMAP] ; $d35e
	cp $25
	jr c, .asm_13912
	ld a, [W_CURMAPTILESET] ; $d367
	cp $3
	jr z, .asm_13912
	ld a, [W_GRASSRATE] ; $d887
.asm_138c4
	ld b, a
	ld a, [H_RAND1] ; $FF00+$d3
	cp b
	jr nc, .asm_13912
	ld a, [H_RAND2] ; $FF00+$d4
	ld b, a
	ld hl, Unknown_13918 ; $7918
.asm_138d0
	ld a, [hli]
	cp b
	jr nc, .asm_138d7
	inc hl
	jr .asm_138d0
.asm_138d7
	ld c, [hl]
	ld hl, W_GRASSMONS ; $d888
	FuncCoord 8, 9 ; $c45c
	ld a, [Coord]
	cp $14
	jr nz, .asm_138e5
	ld hl, W_WATERMONS ; $d8a5 (aliases: W_ENEMYMON1HP)
.asm_138e5
	ld b, $0
	add hl, bc
	ld a, [hli]
	ld [W_CURENEMYLVL], a ; $d127
	ld a, [hl]
	ld [$cf91], a
	ld [W_ENEMYMONID], a
	ld a, [$d0db]
	and a
	jr z, .asm_13916
	ld a, [W_PARTYMON1_LEVEL] ; $d18c
	ld b, a
	ld a, [W_CURENEMYLVL] ; $d127
	cp b
	jr c, .asm_13912
	jr .asm_13916
.asm_13905
	ld [$d0db], a
	ld a, $d2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call EnableAutoTextBoxDrawing
	call DisplayTextID
.asm_13912
	ld a, $1
	and a
	ret
.asm_13916
	xor a
	ret

Unknown_13918: ; 13918 (4:7918)
INCBIN "baserom.gbc",$13918,$1392c - $13918

; known jump sources: 3f956 (f:7956)
Func_1392c: ; 1392c (4:792c)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, [W_PLAYERMOVENUM] ; $cfd2
	ld hl, W_PLAYERMONMAXHP ; $d023
	jr z, .asm_1393d
	ld a, [W_ENEMYMOVENUM] ; $cfcc
	ld hl, W_ENEMYMONMAXHP ; $cff4
.asm_1393d
	ld d, a
	ld a, [W_DAMAGE] ; $d0d7
	ld b, a
	ld a, [$d0d8]
	ld c, a
	srl b
	rr c
	ld a, d
	cp $a5
	jr z, .asm_13953
	srl b
	rr c
.asm_13953
	ld a, b
	or c
	jr nz, .asm_13958
	inc c
.asm_13958
	ld a, [hli]
	ld [W_HPBARMAXHP+1], a
	ld a, [hl]
	ld [W_HPBARMAXHP], a
	push bc
	ld bc, $fff2
	add hl, bc
	pop bc
	ld a, [hl]
	ld [W_HPBAROLDHP], a
	sub c
	ld [hld], a
	ld [W_HPBARNEWHP], a
	ld a, [hl]
	ld [W_HPBAROLDHP+1], a
	sbc b
	ld [hl], a
	ld [W_HPBARNEWHP+1], a
	jr nc, .asm_13982
	xor a
	ld [hli], a
	ld [hl], a
	ld hl, W_HPBARNEWHP
	ld [hli], a
	ld [hl], a
.asm_13982
	FuncCoord 10, 9 ; $c45e
	ld hl, Coord
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, $1
	jr z, .asm_13990
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	xor a
.asm_13990
	ld [W_LISTMENUID], a ; $cf94
	ld a, $48
	call Predef ; indirect jump to UpdateHPBar (fa1d (3:7a1d))
	ld hl, UnnamedText_1399e ; $799e
	jp PrintText
; 1399e (4:799e)
UnnamedText_1399e: ; 1399e (4:799e)
	TX_FAR _UnnamedText_1399e
	db $50
; 0x1399e + 5 bytes

INCBIN "baserom.gbc",$139a3,$139cd - $139a3

UnnamedText_139cd: ; 139cd (4:79cd)
	TX_FAR _UnnamedText_139cd
	db $50
; 0x139cd + 5 bytes

INCBIN "baserom.gbc",$139d2,$13a53 - $139d2

UnnamedText_13a53: ; 13a53 (4:7a53)
	TX_FAR _UnnamedText_13a53
	db $50
; 0x13a53 + 5 bytes

; known jump sources: 35a3 (0:35a3)
Func_13a58: ; 13a58 (4:7a58)
	ld hl, W_GRASSRATE ; $d887
	ld a, [W_ISLINKBATTLE] ; $d12b
	and a
	jr nz, .asm_13a86
	ld hl, W_RIVALNAME ; $d34a
	ld a, [W_TRAINERCLASS] ; $d031
	cp $19
	jr z, .asm_13a86
	cp $2a
	jr z, .asm_13a86
	cp $2b
	jr z, .asm_13a86
	ld [$d0b5], a
	ld a, TRAINER_NAME
	ld [W_LISTTYPE], a
	ld a, $e
	ld [$d0b7], a
	call GetName
	ld hl, $cd6d
.asm_13a86
	ld de, $d04a
	ld bc, $d
	jp CopyData
; 13a8f (4:7a8f)
GenRandom_: ; 13a8f (4:7a8f)
; generate a random 16-bit integer and store it at $FFD3,$FFD4
	ld a,[rDIV]
	ld b,a
	ld a,[H_RAND1]
	adc b
	ld [H_RAND1],a
	ld a,[rDIV]
	ld b,a
	ld a,[H_RAND2]
	sbc b
	ld [H_RAND2],a
	ret

SECTION "bank5",ROMX,BANK[$5]

RedCyclingSprite: ; 14000 (5:4000)
	INCBIN "gfx/sprites/cycling.2bpp" ; was $14000
RedSprite: ; 14180 (5:4180)
	INCBIN "gfx/sprites/red.2bpp" ; was $14180
BlueSprite: ; 14300 (5:4300)
	INCBIN "gfx/sprites/blue.2bpp" ; was $14300
OakSprite: ; 14480 (5:4480)
	INCBIN "gfx/sprites/oak.2bpp" ; was $14480
BugCatcherSprite: ; 14600 (5:4600)
	INCBIN "gfx/sprites/bug_catcher.2bpp" ; was $14600
SlowbroSprite: ; 14780 (5:4780)
	INCBIN "gfx/sprites/slowbro.2bpp" ; was $14780
LassSprite: ; 14900 (5:4900)
	INCBIN "gfx/sprites/lass.2bpp" ; was $14900
BlackHairBoy1Sprite: ; 14a80 (5:4a80)
	INCBIN "gfx/sprites/black_hair_boy_1.2bpp" ; was $14a80
LittleGirlSprite: ; 14c00 (5:4c00)
	INCBIN "gfx/sprites/little_girl.2bpp" ; was $14c00
BirdSprite: ; 14d80 (5:4d80)
	INCBIN "gfx/sprites/bird.2bpp" ; was $14d80
FatBaldGuySprite: ; 14f00 (5:4f00)
	INCBIN "gfx/sprites/fat_bald_guy.2bpp" ; was $14f00
GamblerSprite: ; 15080 (5:5080)
	INCBIN "gfx/sprites/gambler.2bpp" ; was $15080
BlackHairBoy2Sprite: ; 15200 (5:5200)
	INCBIN "gfx/sprites/black_hair_boy_2.2bpp" ; was $15200
GirlSprite: ; 15380 (5:5380)
	INCBIN "gfx/sprites/girl.2bpp" ; was $15380
HikerSprite: ; 15500 (5:5500)
	INCBIN "gfx/sprites/hiker.2bpp" ; was $15500
FoulardWomanSprite: ; 15680 (5:5680)
	INCBIN "gfx/sprites/foulard_woman.2bpp" ; was $15680
GentlemanSprite: ; 15800 (5:5800)
	INCBIN "gfx/sprites/gentleman.2bpp" ; was $15800
DaisySprite: ; 15980 (5:5980)
	INCBIN "gfx/sprites/daisy.2bpp" ; was $15980
BikerSprite: ; 15b00 (5:5b00)
	INCBIN "gfx/sprites/biker.2bpp" ; was $15b00
SailorSprite: ; 15c80 (5:5c80)
	INCBIN "gfx/sprites/sailor.2bpp" ; was $15c80
CookSprite: ; 15e00 (5:5e00)
	INCBIN "gfx/sprites/cook.2bpp" ; was $15e00
BikeShopGuySprite: ; 15f80 (5:5f80)
	INCBIN "gfx/sprites/bike_shop_guy.2bpp" ; was $15f80
MrFujiSprite: ; 16040 (5:6040)
	INCBIN "gfx/sprites/mr_fuji.2bpp" ; was $16040
GiovanniSprite: ; 161c0 (5:61c0)
	INCBIN "gfx/sprites/giovanni.2bpp" ; was $161c0
RocketSprite: ; 16340 (5:6340)
	INCBIN "gfx/sprites/rocket.2bpp" ; was $16340
MediumSprite: ; 164c0 (5:64c0)
	INCBIN "gfx/sprites/medium.2bpp" ; was $164c0
WaiterSprite: ; 16640 (5:6640)
	INCBIN "gfx/sprites/waiter.2bpp" ; was $16640
ErikaSprite: ; 167c0 (5:67c0)
	INCBIN "gfx/sprites/erika.2bpp" ; was $167c0
MomGeishaSprite: ; 16940 (5:6940)
	INCBIN "gfx/sprites/mom_geisha.2bpp" ; was $16940
BrunetteGirlSprite: ; 16ac0 (5:6ac0)
	INCBIN "gfx/sprites/brunette_girl.2bpp" ; was $16ac0
LanceSprite: ; 16c40 (5:6c40)
	INCBIN "gfx/sprites/lance.2bpp" ; was $16c40
MomSprite: ; 16dc0 (5:6dc0)
	INCBIN "gfx/sprites/mom.2bpp" ; was $16dc0
BaldingGuySprite: ; 16e80 (5:6e80)
	INCBIN "gfx/sprites/balding_guy.2bpp" ; was $16e80
YoungBoySprite: ; 16f40 (5:6f40)
	INCBIN "gfx/sprites/young_boy.2bpp" ; was $16f40
GameboyKidSprite: ; 17000 (5:7000)
	INCBIN "gfx/sprites/gameboy_kid.2bpp" ; was $17000
ClefairySprite: ; 170c0 (5:70c0)
	INCBIN "gfx/sprites/clefairy.2bpp" ; was $170c0
AgathaSprite: ; 17240 (5:7240)
	INCBIN "gfx/sprites/agatha.2bpp" ; was $17240
BrunoSprite: ; 173c0 (5:73c0)
	INCBIN "gfx/sprites/bruno.2bpp" ; was $173c0
LoreleiSprite: ; 17540 (5:7540)
	INCBIN "gfx/sprites/lorelei.2bpp" ; was $17540
SeelSprite: ; 176c0 (5:76c0)
	INCBIN "gfx/sprites/seel.2bpp" ; was $176c0

; Loads tile patterns for tiles used in the pokedex.
LoadPokedexTilePatterns: ; 17840 (5:7840)
	call LoadHpBarAndStatusTilePatterns
	ld de,PokedexTileGraphics ; $6488
	ld hl,$9600
	ld bc,(BANK(PokedexTileGraphics) << 8) + $12 
	call CopyVideoData
	ld de,PokeballTileGraphics ; $697e
	ld hl,$9720
	ld bc,(BANK(PokeballTileGraphics) << 8) + $01
	jp CopyVideoData ; load pokeball tile for marking cought mons

; Loads tile patterns for map's sprites.
; For outside maps, it loads one of several fixed sets of sprites.
; For inside maps, it loads each sprite picture ID used in the map header.
; This is also called after displaying text because loading
; text tile patterns overwrites half of the sprite tile pattern data.
; Note on notation:
; $C1X* and $C2X* are used to denote $C100-$C1FF and $C200-$C2FF sprite slot
; fields, respectively, within loops. The X is the loop index.
; If there is an inner loop, Y is the inner loop index, i.e. $C1Y* and $C2Y*
; denote fields of the sprite slots interated over in the inner loop.
InitMapSprites: ; 1785b (5:785b)
	call InitOutsideMapSprites
	ret c ; return if the map is an outside map (already handled by above call)
; if the map is an inside map (i.e. mapID >= $25)
	ld hl,$c100
	ld de,$c20d
; Loop to copy picture ID's from $C1X0 to $C2XD for LoadMapSpriteTilePatterns.
.copyPictureIDLoop
	ld a,[hl] ; $C1X0 (picture ID)
	ld [de],a ; $C2XD
	ld a,$10
	add e
	ld e,a
	ld a,$10
	add l
	ld l,a
	jr nz,.copyPictureIDLoop

; This is used for both inside and outside maps, since it is called by
; InitOutsideMapSprites.
; Loads tile pattern data for sprites into VRAM.
LoadMapSpriteTilePatterns: ; 17871 (5:7871)
	ld a,[W_NUMSPRITES]
	and a ; are there any sprites?
	jr nz,.spritesExist
	ret
.spritesExist
	ld c,a ; c = [W_NUMSPRITES]
	ld b,$10 ; number of sprite slots
	ld hl,$c20d
	xor a
	ld [$ff8e],a ; 4-tile sprite counter
.copyPictureIDLoop ; loop to copy picture ID from $C2XD to $C2XE
	ld a,[hli] ; $C2XD (sprite picture ID)
	ld [hld],a ; $C2XE
	ld a,l
	add a,$10
	ld l,a
	dec b
	jr nz,.copyPictureIDLoop
	ld hl,$c21e
.loadTilePatternLoop
	ld de,$c21d
; Check if the current picture ID has already had its tile patterns loaded.
; This done by looping through the previous sprite slots and seeing if any of
; their picture ID's match that of the current sprite slot.
.checkIfAlreadyLoadedLoop
	ld a,e
	and a,$f0
	ld b,a ; b = offset of the $c200 sprite slot being checked against
	ld a,l
	and a,$f0 ; a = offset of current $c200 sprite slot
	cp b ; done checking all previous sprite slots?
	jr z,.notAlreadyLoaded
	ld a,[de] ; picture ID of the $c200 sprite slot being checked against
	cp [hl] ; do the picture ID's match?
	jp z,.alreadyLoaded
	ld a,e
	add a,$10
	ld e,a
	jr .checkIfAlreadyLoadedLoop
.notAlreadyLoaded
	ld de,$c20e
	ld b,$01
; loop to find the highest tile pattern VRAM slot (among the first 10 slots) used by a previous sprite slot
; this is done in order to find the first free VRAM slot available
.findNextVRAMSlotLoop
	ld a,e
	add a,$10
	ld e,a
	ld a,l
	cp e ; reached current slot?
	jr z,.foundNextVRAMSlot
	ld a,[de] ; $C2YE (VRAM slot)
	cp a,11 ; is it one of the first 10 slots?
	jr nc,.findNextVRAMSlotLoop
	cp b ; compare the slot being checked to the current max
	jr c,.findNextVRAMSlotLoop ; if the slot being checked is less than the current max
; if the slot being checked is greater than or equal to the current max
	ld b,a ; store new max VRAM slot
	jr .findNextVRAMSlotLoop
.foundNextVRAMSlot
	inc b ; increment previous max value to get next VRAM tile pattern slot
	ld a,b ; a = next VRAM tile pattern slot
	push af
	ld a,[hl] ; $C2XE (sprite picture ID)
	ld b,a ; b = current sprite picture ID
	cp a,SPRITE_BALL ; is it a 4-tile sprite?
	jr c,.notFourTileSprite
	pop af
	ld a,[$ff8e] ; 4-tile sprite counter
	add a,11
	jr .storeVRAMSlot
.notFourTileSprite
	pop af
.storeVRAMSlot
	ld [hl],a ; store VRAM slot at $C2XE
	ld [$ff8d],a ; used to determine if it's 4-tile sprite later
	ld a,b ; a = current sprite picture ID
	dec a
	add a
	add a
	push bc
	push hl
	ld hl,SpriteSheetPointerTable
	jr nc,.noCarry
	inc h
.noCarry
	add l
	ld l,a
	jr nc,.noCarry2
	inc h
.noCarry2
	push hl
	call ReadSpriteSheetData
	push af
	push de
	push bc
	ld hl,$8000 ; VRAM base address
	ld bc,$c0 ; number of bytes per VRAM slot
	ld a,[$ff8d]
	cp a,11 ; is it a 4-tile sprite?
	jr nc,.fourTileSpriteVRAMAddr
	ld d,a
	dec d
; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM
; slot and adding the result to $8000 (the VRAM base address).
.calculateVRAMAddrLoop
	add hl,bc
	dec d
	jr nz,.calculateVRAMAddrLoop
	jr .loadStillTilePattern
.fourTileSpriteVRAMAddr
	ld hl,$87c0 ; address for second 4-tile sprite
	ld a,[$ff8e] ; 4-tile sprite counter
	and a ; is it the first 4-tile sprite?
	jr nz,.loadStillTilePattern
; if it's the first 4-tile sprite
	ld hl,$8780 ; address for first 4-tile sprite
	inc a
	ld [$ff8e],a ; 4-tile sprite counter
.loadStillTilePattern
	pop bc
	pop de
	pop af
	push hl
	push hl
	ld h,d
	ld l,e
	pop de
	ld b,a
	ld a,[$cfc4]
	bit 0,a ; reloading upper half of tile patterns after displaying text?
	jr nz,.skipFirstLoad ; if so, skip loading data into the lower half
	ld a,b
	ld b,0
	call FarCopyData2 ; load tile pattern data for sprite when standing still
.skipFirstLoad
	pop de
	pop hl
	ld a,[$ff8d]
	cp a,11 ; is it a 4-tile sprite?
	jr nc,.skipSecondLoad ; if so, there is no second block
	push de
	call ReadSpriteSheetData
	push af
	ld a,$c0
	add e
	ld e,a
	jr nc,.noCarry3
	inc d
.noCarry3
	ld a,[$cfc4]
	bit 0,a ; reloading upper half of tile patterns after displaying text?
	jr nz,.loadWhileLCDOn
	pop af
	pop hl
	set 3,h ; add $800 to hl
	push hl
	ld h,d
	ld l,e
	pop de
	call FarCopyData2 ; load tile pattern data for sprite when walking
	jr .skipSecondLoad
; When reloading the upper half of tile patterns after diplaying text, the LCD
; will be on, so CopyVideoData (which writes to VRAM only during V-blank) must
; be used instead of FarCopyData2.
.loadWhileLCDOn
	pop af
	pop hl
	set 3,h ; add $800 to hl
	ld b,a
	swap c
	call CopyVideoData ; load tile pattern data for sprite when walking
.skipSecondLoad
	pop hl
	pop bc
	jr .nextSpriteSlot
.alreadyLoaded ; if the current picture ID has already had its tile patterns loaded
	inc de
	ld a,[de] ; a = VRAM slot for the current picture ID (from $C2YE)
	ld [hl],a ; store VRAM slot in current $c200 sprite slot (at $C2XE)
.nextSpriteSlot
	ld a,l
	add a,$10
	ld l,a
	dec c
	jp nz,.loadTilePatternLoop
	ld hl,$c20d
	ld b,$10
; the pictures ID's stored at $C2XD are no longer needed, so zero them
.zeroStoredPictureIDLoop
	xor a
	ld [hl],a ; $C2XD
	ld a,$10
	add l
	ld l,a
	dec b
	jr nz,.zeroStoredPictureIDLoop
	ret

; reads data from SpriteSheetPointerTable
; INPUT:
; hl = address of sprite sheet entry
; OUTPUT:
; de = pointer to sprite sheet
; bc = length in bytes
; a = ROM bank
ReadSpriteSheetData: ; 17971 (5:7971)
	ld a,[hli]
	ld e,a
	ld a,[hli]
	ld d,a
	ld a,[hli]
	ld c,a
	xor a
	ld b,a
	ld a,[hli]
	ret

; Loads sprite set for outside maps (cities and routes) and sets VRAM slots.
; sets carry if the map is a city or route, unsets carry if not
InitOutsideMapSprites: ; 1797b (5:797b)
	ld a,[W_CURMAP]
	cp a,$25 ; is the map a city or a route (map ID less than $25)?
	ret nc ; if not, return
	ld hl,MapSpriteSets
	add l
	ld l,a
	jr nc,.noCarry
	inc h
.noCarry
	ld a,[hl] ; a = spriteSetID
	cp a,$f0 ; does the map have 2 sprite sets?
	call nc,GetSplitMapSpriteSetID ; if so, choose the appropriate one
	ld b,a ; b = spriteSetID
	ld a,[$cfc4]
	bit 0,a ; reloading upper half of tile patterns after displaying text?
	jr nz,.loadSpriteSet ; if so, forcibly reload the sprite set
	ld a,[W_SPRITESETID]
	cp b ; has the sprite set ID changed?
	jr z,.skipLoadingSpriteSet ; if not, don't load it again
.loadSpriteSet
	ld a,b
	ld [W_SPRITESETID],a
	dec a
	ld b,a
	sla a
	ld c,a
	sla a
	sla a
	add c
	add b ; a = (spriteSetID - 1) * 11
	ld de,SpriteSets
; add a to de to get offset of sprite set
	add e
	ld e,a
	jr nc,.noCarry2
	inc d
.noCarry2
	ld hl,$c20d
	ld a,SPRITE_RED
	ld [hl],a
	ld bc,W_SPRITESET
; Load the sprite set into RAM.
; This loop also fills $C2XD (sprite picture ID) where X is from $0 to $A
; with picture ID's. This is done so that LoadMapSpriteTilePatterns will
; load tile patterns for all sprite pictures in the sprite set.
.loadSpriteSetLoop
	ld a,$10
	add l
	ld l,a
	ld a,[de] ; sprite picture ID from sprite set
	ld [hl],a ; $C2XD (sprite picture ID)
	ld [bc],a
	inc de
	inc bc
	ld a,l
	cp a,$bd ; reached 11th sprite slot?
	jr nz,.loadSpriteSetLoop
	ld b,4 ; 4 remaining sprite slots
.zeroRemainingSlotsLoop ; loop to zero the picture ID's of the remaining sprite slots
	ld a,$10
	add l
	ld l,a
	xor a
	ld [hl],a ; $C2XD (sprite picture ID)
	dec b
	jr nz,.zeroRemainingSlotsLoop
	ld a,[W_NUMSPRITES]
	push af ; save number of sprites
	ld a,11 ; 11 sprites in sprite set
	ld [W_NUMSPRITES],a
	call LoadMapSpriteTilePatterns
	pop af
	ld [W_NUMSPRITES],a ; restore number of sprites
	ld hl,$c21e
	ld b,$0f
; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the
; order of the map's sprite set, not the order of the actual sprites loaded
; for the current map. So, they are not needed and are zeroed by this loop.
.zeroVRAMSlotsLoop
	xor a
	ld [hl],a ; $C2XE (VRAM slot)
	ld a,$10
	add l
	ld l,a
	dec b
	jr nz,.zeroVRAMSlotsLoop
.skipLoadingSpriteSet
	ld hl,$c110
; This loop stores the correct VRAM tile pattern slots according the sprite
; data from the map's header. Since the VRAM tile pattern slots are filled in
; the order of the sprite set, in order to find the VRAM tile pattern slot
; for a sprite slot, the picture ID for the sprite is looked up within the
; sprite set. The index of the picture ID within the sprite set plus one
; (since the Red sprite always has the first VRAM tile pattern slot) is the
; VRAM tile pattern slot.
.storeVRAMSlotsLoop
	ld c,0
	ld a,[hl] ; $C1X0 (picture ID) (zero if sprite slot is not used)
	and a ; is the sprite slot used?
	jr z,.skipGettingPictureIndex ; if the sprite slot is not used
	ld b,a ; b = picture ID
	ld de,W_SPRITESET
; Loop to find the index of the sprite's picture ID within the sprite set.
.getPictureIndexLoop
	inc c
	ld a,[de]
	inc de
	cp b ; does the picture ID match?
	jr nz,.getPictureIndexLoop
	inc c
.skipGettingPictureIndex
	push hl
	inc h
	ld a,$0e
	add l
	ld l,a
	ld a,c ; a = VRAM slot (zero if sprite slot is not used)
	ld [hl],a ; $C2XE (VRAM slot)
	pop hl
	ld a,$10
	add l
	ld l,a
	and a
	jr nz,.storeVRAMSlotsLoop
	scf
	ret

; Chooses the correct sprite set ID depending on the player's position within
; the map for maps with two sprite sets.
GetSplitMapSpriteSetID: ; 17a1a (5:7a1a)
	cp a,$f8
	jr z,.route20
	ld hl,SplitMapSpriteSets
	and a,$0f
	dec a
	sla a
	sla a
	add l
	ld l,a
	jr nc,.noCarry
	inc h
.noCarry
	ld a,[hli] ; determines whether the map is split East/West or North/South
	cp a,$01
	ld a,[hli] ; position of dividing line
	ld b,a
	jr z,.eastWestDivide
.northSouthDivide
	ld a,[W_YCOORD]
	jr .compareCoord
.eastWestDivide
	ld a,[W_XCOORD]
.compareCoord
	cp b
	jr c,.loadSpriteSetID
; if in the East side or South side
	inc hl
.loadSpriteSetID
	ld a,[hl]
	ret
; Uses sprite set $01 for West side and $0A for East side.
; Route 20 is a special case because the two map sections have a more complex
; shape instead of the map simply being split horizontally or vertically.
.route20
	ld hl,W_XCOORD
	ld a,[hl]
	cp a,$2b
	ld a,$01
	ret c
	ld a,[hl]
	cp a,$3e
	ld a,$0a
	ret nc
	ld a,[hl]
	cp a,$37
	ld b,$08
	jr nc,.next
	ld b,$0d
.next
	ld a,[W_YCOORD]
	cp b
	ld a,$0a
	ret c
	ld a,$01
	ret

MapSpriteSets: ; 17a64 (5:7a64)
	db $01 ; PALLET_TOWN
	db $01 ; VIRIDIAN_CITY
	db $02 ; PEWTER_CITY
	db $02 ; CERULEAN_CITY
	db $03 ; LAVENDER_TOWN
	db $04 ; VERMILION_CITY
	db $05 ; CELADON_CITY
	db $0a ; FUCHSIA_CITY
	db $01 ; CINNABAR_ISLAND
	db $06 ; INDIGO_PLATEAU
	db $07 ; SAFFRON_CITY
	db $01 ; unused map ID
	db $01 ; ROUTE_1
	db $f1 ; ROUTE_2
	db $02 ; ROUTE_3
	db $02 ; ROUTE_4
	db $f9 ; ROUTE_5
	db $fa ; ROUTE_6
	db $fb ; ROUTE_7
	db $fc ; ROUTE_8
	db $02 ; ROUTE_9
	db $f2 ; ROUTE_10
	db $f3 ; ROUTE_11
	db $f4 ; ROUTE_12
	db $08 ; ROUTE_13
	db $08 ; ROUTE_14
	db $f5 ; ROUTE_15
	db $f6 ; ROUTE_16
	db $09 ; ROUTE_17
	db $f7 ; ROUTE_18
	db $0a ; ROUTE_19
	db $f8 ; ROUTE_20
	db $01 ; ROUTE_21
	db $01 ; ROUTE_22
	db $06 ; ROUTE_23
	db $02 ; ROUTE_24
	db $02 ; ROUTE_25

; Format:
; 00: determines whether the map is split East/West or North/South
; $01 = East/West divide
; $02 = North/South divide
; 01: coordinate of dividing line
; 02: sprite set ID if in the West or North side
; 03: sprite set ID if in the East or South side
SplitMapSpriteSets: ; 17a89 (5:7a89)
	db $02,$25,$02,$01 ; $f1
	db $02,$32,$02,$03 ; $f2
	db $01,$39,$04,$08 ; $f3
	db $02,$15,$03,$08 ; $f4
	db $01,$08,$0A,$08 ; $f5
	db $01,$18,$09,$05 ; $f6
	db $01,$22,$09,$0A ; $f7
	db $01,$35,$01,$0A ; $f8
	db $02,$21,$02,$07 ; $f9
	db $02,$02,$07,$04 ; $fa
	db $01,$11,$05,$07 ; $fb
	db $01,$03,$07,$03 ; $fc

SpriteSets: ; 17ab9 (5:7ab9)
; sprite set $01
	db SPRITE_BLUE
	db SPRITE_BUG_CATCHER
	db SPRITE_GIRL
	db SPRITE_FISHER2
	db SPRITE_BLACK_HAIR_BOY_1
	db SPRITE_GAMBLER
	db SPRITE_SEEL
	db SPRITE_OAK
	db SPRITE_SWIMMER
	db SPRITE_BALL
	db SPRITE_LYING_OLD_MAN

; sprite set $02
	db SPRITE_BUG_CATCHER
	db SPRITE_ROCKET
	db SPRITE_BLACK_HAIR_BOY_2
	db SPRITE_HIKER
	db SPRITE_SLOWBRO
	db SPRITE_BLUE
	db SPRITE_GUARD
	db SPRITE_LASS
	db SPRITE_BLACK_HAIR_BOY_1
	db SPRITE_BALL
	db SPRITE_LYING_OLD_MAN_UNUSED_2

; sprite set $03
	db SPRITE_LITTLE_GIRL
	db SPRITE_GIRL
	db SPRITE_BLACK_HAIR_BOY_2
	db SPRITE_HIKER
	db SPRITE_GAMBLER
	db SPRITE_SLOWBRO
	db SPRITE_LASS
	db SPRITE_BLACK_HAIR_BOY_1
	db SPRITE_GUARD
	db SPRITE_BALL
	db SPRITE_LYING_OLD_MAN_UNUSED_2

; sprite set $04
	db SPRITE_FOULARD_WOMAN
	db SPRITE_BLACK_HAIR_BOY_2
	db SPRITE_BUG_CATCHER
	db SPRITE_GAMBLER
	db SPRITE_SLOWBRO
	db SPRITE_GUARD
	db SPRITE_SAILOR
	db SPRITE_LASS
	db SPRITE_BLACK_HAIR_BOY_1
	db SPRITE_BALL
	db SPRITE_LYING_OLD_MAN_UNUSED_2

; sprite set $05
	db SPRITE_LITTLE_GIRL
	db SPRITE_YOUNG_BOY
	db SPRITE_GIRL
	db SPRITE_FISHER2
	db SPRITE_FAT_BALD_GUY
	db SPRITE_OLD_PERSON
	db SPRITE_SLOWBRO
	db SPRITE_GUARD
	db SPRITE_ROCKET
	db SPRITE_BALL
	db SPRITE_SNORLAX

; sprite set $06
	db SPRITE_BUG_CATCHER
	db SPRITE_GYM_HELPER
	db SPRITE_SLOWBRO
	db SPRITE_BLUE
	db SPRITE_LASS
	db SPRITE_BLACK_HAIR_BOY_1
	db SPRITE_SWIMMER
	db SPRITE_GUARD
	db SPRITE_GAMBLER
	db SPRITE_BALL
	db SPRITE_LYING_OLD_MAN_UNUSED_2

; sprite set $07
	db SPRITE_ROCKET
	db SPRITE_OAK_AIDE
	db SPRITE_LAPRAS_GIVER
	db SPRITE_ERIKA
	db SPRITE_GENTLEMAN
	db SPRITE_BIRD
	db SPRITE_ROCKER
	db SPRITE_BLACK_HAIR_BOY_1
	db SPRITE_SLOWBRO
	db SPRITE_BALL
	db SPRITE_LYING_OLD_MAN_UNUSED_2

; sprite set $08
	db SPRITE_BIKER
	db SPRITE_BLACK_HAIR_BOY_2
	db SPRITE_FAT_BALD_GUY
	db SPRITE_LASS
	db SPRITE_BLACK_HAIR_BOY_1
	db SPRITE_FOULARD_WOMAN
	db SPRITE_FISHER2
	db SPRITE_ROCKER
	db SPRITE_SLOWBRO
	db SPRITE_BALL
	db SPRITE_SNORLAX

; sprite set $09
	db SPRITE_BIKER
	db SPRITE_BLACK_HAIR_BOY_1
	db SPRITE_LAPRAS_GIVER
	db SPRITE_FISHER2
	db SPRITE_ROCKER
	db SPRITE_HIKER
	db SPRITE_GAMBLER
	db SPRITE_FAT_BALD_GUY
	db SPRITE_BLACK_HAIR_BOY_2
	db SPRITE_BALL
	db SPRITE_SNORLAX

; sprite set $0a
	db SPRITE_BIRD
	db SPRITE_BLACK_HAIR_BOY_1
	db SPRITE_CLEFAIRY
	db SPRITE_FISHER2
	db SPRITE_GAMBLER
	db SPRITE_SLOWBRO
	db SPRITE_SEEL
	db SPRITE_SWIMMER
	db SPRITE_BUG_CATCHER
	db SPRITE_BALL
	db SPRITE_OMANYTE

SpriteSheetPointerTable: ; 17b27 (5:7b27)
	; SPRITE_RED
	dw RedSprite
	db $c0 ; byte count
	db BANK(RedSprite)

	; SPRITE_BLUE
	dw BlueSprite
	db $c0 ; byte count
	db BANK(BlueSprite)

	; SPRITE_OAK
	dw OakSprite
	db $c0 ; byte count
	db BANK(OakSprite)

	; SPRITE_BUG_CATCHER
	dw BugCatcherSprite
	db $c0 ; byte count
	db BANK(BugCatcherSprite)

	; SPRITE_SLOWBRO
	dw SlowbroSprite
	db $c0 ; byte count
	db BANK(SlowbroSprite)

	; SPRITE_LASS
	dw LassSprite
	db $c0 ; byte count
	db BANK(LassSprite)

	; SPRITE_BLACK_HAIR_BOY_1
	dw BlackHairBoy1Sprite
	db $c0 ; byte count
	db BANK(BlackHairBoy1Sprite)

	; SPRITE_LITTLE_GIRL
	dw LittleGirlSprite
	db $c0 ; byte count
	db BANK(LittleGirlSprite)

	; SPRITE_BIRD
	dw BirdSprite
	db $c0 ; byte count
	db BANK(BirdSprite)

	; SPRITE_FAT_BALD_GUY
	dw FatBaldGuySprite
	db $c0 ; byte count
	db BANK(FatBaldGuySprite)

	; SPRITE_GAMBLER
	dw GamblerSprite
	db $c0 ; byte count
	db BANK(GamblerSprite)

	; SPRITE_BLACK_HAIR_BOY_2
	dw BlackHairBoy2Sprite
	db $c0 ; byte count
	db BANK(BlackHairBoy2Sprite)

	; SPRITE_GIRL
	dw GirlSprite
	db $c0 ; byte count
	db BANK(GirlSprite)

	; SPRITE_HIKER
	dw HikerSprite
	db $c0 ; byte count
	db BANK(HikerSprite)

	; SPRITE_FOULARD_WOMAN
	dw FoulardWomanSprite
	db $c0 ; byte count
	db BANK(FoulardWomanSprite)

	; SPRITE_GENTLEMAN
	dw GentlemanSprite
	db $c0 ; byte count
	db BANK(GentlemanSprite)

	; SPRITE_DAISY
	dw DaisySprite
	db $c0 ; byte count
	db BANK(DaisySprite)

	; SPRITE_BIKER
	dw BikerSprite
	db $c0 ; byte count
	db BANK(BikerSprite)

	; SPRITE_SAILOR
	dw SailorSprite
	db $c0 ; byte count
	db BANK(SailorSprite)

	; SPRITE_COOK
	dw CookSprite
	db $c0 ; byte count
	db BANK(CookSprite)

	; SPRITE_BIKE_SHOP_GUY
	dw BikeShopGuySprite
	db $c0 ; byte count
	db BANK(BikeShopGuySprite)

	; SPRITE_MR_FUJI
	dw MrFujiSprite
	db $c0 ; byte count
	db BANK(MrFujiSprite)

	; SPRITE_GIOVANNI
	dw GiovanniSprite
	db $c0 ; byte count
	db BANK(GiovanniSprite)

	; SPRITE_ROCKET
	dw RocketSprite
	db $c0 ; byte count
	db BANK(RocketSprite)

	; SPRITE_MEDIUM
	dw MediumSprite
	db $c0 ; byte count
	db BANK(MediumSprite)

	; SPRITE_WAITER
	dw WaiterSprite
	db $c0 ; byte count
	db BANK(WaiterSprite)

	; SPRITE_ERIKA
	dw ErikaSprite
	db $c0 ; byte count
	db BANK(ErikaSprite)

	; SPRITE_MOM_GEISHA
	dw MomGeishaSprite
	db $c0 ; byte count
	db BANK(MomGeishaSprite)

	; SPRITE_BRUNETTE_GIRL
	dw BrunetteGirlSprite
	db $c0 ; byte count
	db BANK(BrunetteGirlSprite)

	; SPRITE_LANCE
	dw LanceSprite
	db $c0 ; byte count
	db BANK(LanceSprite)

	; SPRITE_OAK_SCIENTIST_AIDE
	dw OakAideSprite
	db $c0 ; byte count
	db BANK(OakAideSprite)

	; SPRITE_OAK_AIDE
	dw OakAideSprite
	db $c0 ; byte count
	db BANK(OakAideSprite)

	; SPRITE_ROCKER
	dw RockerSprite
	db $c0 ; byte count
	db BANK(RockerSprite)

	; SPRITE_SWIMMER
	dw SwimmerSprite
	db $c0 ; byte count
	db BANK(SwimmerSprite)

	; SPRITE_WHITE_PLAYER
	dw WhitePlayerSprite
	db $c0 ; byte count
	db BANK(WhitePlayerSprite)

	; SPRITE_GYM_HELPER
	dw GymHelperSprite
	db $c0 ; byte count
	db BANK(GymHelperSprite)

	; SPRITE_OLD_PERSON
	dw OldPersonSprite
	db $c0 ; byte count
	db BANK(OldPersonSprite)

	; SPRITE_MART_GUY
	dw MartGuySprite
	db $c0 ; byte count
	db BANK(MartGuySprite)

	; SPRITE_FISHER
	dw FisherSprite
	db $c0 ; byte count
	db BANK(FisherSprite)

	; SPRITE_OLD_MEDIUM_WOMAN
	dw OldMediumWomanSprite
	db $c0 ; byte count
	db BANK(OldMediumWomanSprite)

	; SPRITE_NURSE
	dw NurseSprite
	db $c0 ; byte count
	db BANK(NurseSprite)

	; SPRITE_CABLE_CLUB_WOMAN
	dw CableClubWomanSprite
	db $c0 ; byte count
	db BANK(CableClubWomanSprite)

	; SPRITE_MR_MASTERBALL
	dw MrMasterballSprite
	db $c0 ; byte count
	db BANK(MrMasterballSprite)

	; SPRITE_LAPRAS_GIVER
	dw LaprasGiverSprite
	db $c0 ; byte count
	db BANK(LaprasGiverSprite)

	; SPRITE_WARDEN
	dw WardenSprite
	db $c0 ; byte count
	db BANK(WardenSprite)

	; SPRITE_SS_CAPTAIN
	dw SsCaptainSprite
	db $c0 ; byte count
	db BANK(SsCaptainSprite)

	; SPRITE_FISHER2
	dw Fisher2Sprite
	db $c0 ; byte count
	db BANK(Fisher2Sprite)

	; SPRITE_BLACKBELT
	dw BlackbeltSprite
	db $c0 ; byte count
	db BANK(BlackbeltSprite)

	; SPRITE_GUARD
	dw GuardSprite
	db $c0 ; byte count
	db BANK(GuardSprite)

	; $32
	dw GuardSprite
	db $c0 ; byte count
	db BANK(GuardSprite)

	; SPRITE_MOM
	dw MomSprite
	db $c0 ; byte count
	db BANK(MomSprite)

	; SPRITE_BALDING_GUY
	dw BaldingGuySprite
	db $c0 ; byte count
	db BANK(BaldingGuySprite)

	; SPRITE_YOUNG_BOY
	dw YoungBoySprite
	db $c0 ; byte count
	db BANK(YoungBoySprite)

	; SPRITE_GAMEBOY_KID
	dw GameboyKidSprite
	db $c0 ; byte count
	db BANK(GameboyKidSprite)

	; SPRITE_GAMEBOY_KID_COPY
	dw GameboyKidSprite
	db $c0 ; byte count
	db BANK(GameboyKidSprite)

	; SPRITE_CLEFAIRY
	dw ClefairySprite
	db $c0 ; byte count
	db BANK(ClefairySprite)

	; SPRITE_AGATHA
	dw AgathaSprite
	db $c0 ; byte count
	db BANK(AgathaSprite)

	; SPRITE_BRUNO
	dw BrunoSprite
	db $c0 ; byte count
	db BANK(BrunoSprite)

	; SPRITE_LORELEI
	dw LoreleiSprite
	db $c0 ; byte count
	db BANK(LoreleiSprite)

	; SPRITE_SEEL
	dw SeelSprite
	db $c0 ; byte count
	db BANK(SeelSprite)

	; SPRITE_BALL
	dw BallSprite
	db $40 ; byte count
	db BANK(BallSprite)

	; SPRITE_OMANYTE
	dw OmanyteSprite
	db $40 ; byte count
	db BANK(OmanyteSprite)

	; SPRITE_BOULDER
	dw BoulderSprite
	db $40 ; byte count
	db BANK(BoulderSprite)

	; SPRITE_PAPER_SHEET
	dw PaperSheetSprite
	db $40 ; byte count
	db BANK(PaperSheetSprite)

	; SPRITE_BOOK_MAP_DEX
	dw BookMapDexSprite
	db $40 ; byte count
	db BANK(BookMapDexSprite)

	; SPRITE_CLIPBOARD
	dw ClipboardSprite
	db $40 ; byte count
	db BANK(ClipboardSprite)

	; SPRITE_SNORLAX
	dw SnorlaxSprite
	db $40 ; byte count
	db BANK(SnorlaxSprite)

	; SPRITE_OLD_AMBER_COPY
	dw OldAmberSprite
	db $40 ; byte count
	db BANK(OldAmberSprite)

	; SPRITE_OLD_AMBER
	dw OldAmberSprite
	db $40 ; byte count
	db BANK(OldAmberSprite)

	; SPRITE_LYING_OLD_MAN_UNUSED_1
	dw LyingOldManSprite
	db $40 ; byte count
	db BANK(LyingOldManSprite)

	; SPRITE_LYING_OLD_MAN_UNUSED_2
	dw LyingOldManSprite
	db $40 ; byte count
	db BANK(LyingOldManSprite)

	; SPRITE_LYING_OLD_MAN
	dw LyingOldManSprite
	db $40 ; byte count
	db BANK(LyingOldManSprite)
; 0x17c47

; known jump sources: 3239 (0:3239), 18fc3 (6:4fc3), 50f3d (14:4f3d), 51059 (14:5059), 70824 (1c:4824)
Func_17c47: ; 17c47 (5:7c47)
	ld a, [$cd50]
	ld c, a
	ld b, $0
	ld hl, Unknown_17caf ; $7caf
	add hl, bc
	add hl, bc
	ld e, [hl]
	inc hl
	ld d, [hl]
	ld hl, $8f80
	ld bc, (BANK(Unknown_17caf) << 8) + $04
	call CopyVideoData
	ld a, [$cfcb]
	push af
	ld a, $ff
	ld [$cfcb], a
	ld a, [$d736]
	bit 6, a
	ld hl, $c38f
	ld de, $c39f
	jr z, .asm_17c7a
	ld hl, $c37f
	ld de, $c38f
.asm_17c7a
	ld bc, $90
.asm_17c7d
	ld a, [hl]
	ld [de], a
	dec hl
	dec de
	dec bc
	ld a, c
	or b
	jr nz, .asm_17c7d
	ld hl, $c104
	ld a, [$cd4f]
	swap a
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hli]
	ld b, a
	inc hl
	ld a, [hl]
	add $8
	ld c, a
	ld de, EmotionBubbles ; $7cb5
	xor a
	call WriteOAMBlock
	ld c, $3c
	call DelayFrames
	pop af
	ld [$cfcb], a
	call DelayFrame
	jp UpdateSprites

Unknown_17caf: ; 17caf (5:7caf)
INCBIN "baserom.gbc",$17caf,$17cb5 - $17caf

EmotionBubbles: ; 17cb5 (5:7cb5)
INCBIN "gfx/emotion_bubbles.2bpp"

; known jump sources: 71c87 (1c:5c87)
Func_17d7d: ; 17d7d (5:7d7d)
	ld a, [W_PLAYERMONACCURACYMOD] ; $cd1e
	cp $86
	jr z, .asm_17d8d
	cp $92
	ret nz
	ld a, [W_PLAYERMONEVASIONMOD] ; $cd1f
	cp $8f
	ret nz
.asm_17d8d
	ld a, [W_NUMINPARTY] ; $d163
	dec a
	ld [W_WHICHPOKEMON], a ; $cf92
	ld a, $1
	ld [$ccd4], a
	ld a, $32
	ld [W_ISLINKBATTLE], a ; $d12b
	ld hl, Func_3ad0e
	ld b, BANK(Func_3ad0e)
	call Bankswitch ; indirect jump to Func_3ad0e (3ad0e (e:6d0e))
	xor a
	ld [W_ISLINKBATTLE], a ; $d12b
	jp Func_2307
; 17dad (5:7dad)
SubstituteEffectHandler: ; 17dad (5:7dad)
	ld c, 50
	call DelayFrames		
	ld hl, W_PLAYERMONMAXHP		
	ld de, W_PLAYERSUBSITUTEHP
	ld bc, W_PLAYERBATTSTATUS2
	ld a, [$ff00+$f3]  ;whose turn?
	and a
	jr z, .notEnemy
	ld hl, W_ENEMYMONMAXHP
	ld de, W_ENEMYSUBSITUTEHP
	ld bc, W_ENEMYBATTSTATUS2
.notEnemy
	ld a, [bc]                    ;load flags
	bit 4, a                      ;user already has substitute?
	jr nz, .alreadyHasSubstitute  ;skip this code if so
	                              ;user doesn't have a substitute [yet]
	push bc
	ld a, [hli]  ;load max hp
	ld b, [hl]
	srl a        ;max hp / 4, [quarter health to remove from user]
	rr b
	srl a
	rr b
	push de
	ld de, $fff2  ;subtract 8 to point to [current hp] instead of [max hp]
	add hl, de    ;HL -= 8
	pop de
	ld a, b
	ld [de], a    ;save copy of HP to subtract in ccd7/ccd8 [how much HP substitute has]
	ld a, [hld]   ;load current hp
	sub b         ;subtract [max hp / 4]
	ld d, a       ;save low byte result in D
	ld a, [hl]
	sbc a, 0      ;borrow from high byte if needed
	pop bc
	jr c, .notEnoughHP  ;underflow means user would be left with negative health
                        ;bug: note since it only brances on carry, it will possibly leave user with 0HP
.userHasZeroOrMoreHP
	ldi [hl], a  ;store high byte HP
	ld [hl], d   ;store low byte HP
	ld h, b
	ld l, c
	set 4, [hl]    ;set bit 4 of flags, user now has substitute
	ld a, [$d355]  ;load options
	bit 7, a       ;battle animation is enabled?
	ld hl, Func_3fba8    ; $7ba8 ;animation enabled: 0F:7BA8
	ld b, BANK(Func_3fba8)
	jr z, .animationEnabled
	ld hl, Func_796e0   ;animation disabled: 1E:56E0
	ld b, BANK(Func_796e0)
.animationEnabled
	call Bankswitch           ;jump to routine depending on animation setting
	ld hl, UnnamedText_17e1d  ;"it created a substitute"
	call PrintText
	ld hl, Func_3cd5a
	ld b, BANK(Func_3cd5a)
	jp Bankswitch
.alreadyHasSubstitute
	ld hl, UnnamedText_17e22  ;"x has a substitute"
	jr .printText
.notEnoughHP
	ld hl, UnnamedText_17e27  ;"too weak to make substitute"
.printText
	jp PrintText

UnnamedText_17e1d: ; 17e1d (5:7e1d)
	TX_FAR _UnnamedText_17e1d
	db $50
; 0x17e1d + 5 bytes

UnnamedText_17e22: ; 17e22 (5:7e22)
	TX_FAR _UnnamedText_17e22
	db $50
; 0x17e22 + 5 bytes

UnnamedText_17e27: ; 17e27 (5:7e27)
	TX_FAR _UnnamedText_17e27
	db $50
; 0x17e27 + 5 bytes

ActivatePC: ; 17e2c (5:7e2c)
	call SaveScreenTilesToBuffer2  ;XXX: copy background from W_SCREENTILESBUFFER to W_SCREENTILESBACKBUFFER2
	ld a, $99
	call PlaySound  ;XXX: play sound or stop music
	ld hl, UnnamedText_17f23  ;player turned on PC
	call PrintText
	call WaitForSoundToFinish  ;XXX: wait for sound to be done
	ld hl, W_FLAGS_CD60
	set 3, [hl]
	call LoadScreenTilesFromBuffer2  ;XXX: restore saved screen
	call Delay3
PCMainMenu: ; 17e48 (5:7e48)
	ld b, BANK(Func_213c8)
	ld hl, Func_213c8
	call Bankswitch
	ld hl, W_FLAGS_CD60
	set 5, [hl]
	call HandleMenuInput
	bit 1, a              ;if player pressed B
	jp nz, LogOff
	ld a, [W_MAXMENUITEMID]
	cp a, 2
	jr nz, .next ;if not 2 menu items (not counting log off) (2 occurs before you get the pokedex)
	ld a, [W_CURMENUITEMID]
	and a
	jp z, BillsPC    ;if current menu item id is 0, it's bills pc
	cp a, 1
	jr z, .playersPC ;if current menu item id is 1, it's players pc
	jp LogOff        ;otherwise, it's 2, and you're logging off
.next
	cp a, 3
	jr nz, .next2 ;if not 3 menu items (not counting log off) (3 occurs after you get the pokedex, before you beat the pokemon league)
	ld a, [W_CURMENUITEMID]
	and a
	jp z, BillsPC    ;if current menu item id is 0, it's bills pc
	cp a, 1
	jr z, .playersPC ;if current menu item id is 1, it's players pc
	cp a, 2
	jp z, OaksPC     ;if current menu item id is 2, it's oaks pc
	jp LogOff        ;otherwise, it's 3, and you're logging off
.next2
	ld a, [W_CURMENUITEMID]
	and a
	jp z, BillsPC    ;if current menu item id is 0, it's bills pc
	cp a, 1
	jr z, .playersPC ;if current menu item id is 1, it's players pc
	cp a, 2
	jp z, OaksPC     ;if current menu item id is 2, it's oaks pc
	cp a, 3
	jp z, PKMNLeague ;if current menu item id is 3, it's pkmnleague
	jp LogOff        ;otherwise, it's 4, and you're logging off
.playersPC
	ld hl, W_FLAGS_CD60
	res 5, [hl]
	set 3, [hl]
	ld a, $9B
	call PlaySound  ;XXX: play sound or stop music
	call WaitForSoundToFinish  ;XXX: wait for sound to be done
	ld hl, UnnamedText_17f32  ;accessed players pc
	call PrintText
	ld b, BANK(Func_78e6)
	ld hl, Func_78e6
	call Bankswitch
	jr ReloadMainMenu
OaksPC: ; 17ec0 (5:7ec0)
	ld a, $9B
	call PlaySound  ;XXX: play sound or stop music
	call WaitForSoundToFinish  ;XXX: wait for sound to be done
	ld b, BANK(Func_1e915)
	ld hl, Func_1e915
	call Bankswitch
	jr ReloadMainMenu
PKMNLeague: ; 17ed2 (5:7ed2)
	ld a, $9B
	call PlaySound  ;XXX: play sound or stop music
	call WaitForSoundToFinish  ;XXX: wait for sound to be done
	ld b, BANK(Unknown_7657e)
	ld hl, Unknown_7657e
	call Bankswitch
	jr ReloadMainMenu
BillsPC: ; 17ee4 (5:7ee4)
	ld a, $9B
	call PlaySound    ;XXX: play sound or stop music
	call WaitForSoundToFinish    ;XXX: wait for sound to be done
	ld a, [$D7F1] ;has to do with having met Bill
	bit 0, a
	jr nz, .billsPC ;if you've met bill, use that bill's instead of someone's
	ld hl, UnnamedText_17f2d ;accessed someone's pc
	jr .printText
.billsPC
	ld hl, UnnamedText_17f28 ;accessed bill's pc
.printText
	call PrintText
	ld b, BANK(Func_214c2)
	ld hl, Func_214c2
	call Bankswitch
ReloadMainMenu: ; 17f06 (5:7f06)
	xor a
	ld [$CC3C], a
	call ReloadMapData
	call UpdateSprites  ;XXX: moves sprites
	jp PCMainMenu
LogOff: ; 17f13 (5:7f13)
	ld a, $9A
	call PlaySound  ;XXX: play sound or stop music
	call WaitForSoundToFinish  ;XXX: wait for sound to be done
	ld hl, W_FLAGS_CD60
	res 3, [hl]
	res 5, [hl]
	ret

UnnamedText_17f23: ; 17f23 (5:7f23)
	TX_FAR _UnnamedText_17f23
	db $50
; 0x17f23 + 5 bytes

UnnamedText_17f28: ; 17f28 (5:7f28)
	TX_FAR _UnnamedText_17f28
	db $50
; 0x17f28 + 5 bytes

UnnamedText_17f2d: ; 17f2d (5:7f2d)
	TX_FAR _UnnamedText_17f2d
	db $50
; 0x17f2d + 5 bytes

UnnamedText_17f32: ; 17f32 (5:7f32)
	TX_FAR _UnnamedText_17f32
	db $50
; 0x17f32 + 5 bytes

; known jump sources: 1d774 (7:5774), 484eb (12:44eb), 5a5b4 (16:65b4), 61096 (18:5096), 75101 (1d:5101)
; removes one of the specified item ID [$FFdb] from bag (if existent)
RemoveItemByID: ; 17f37 (5:7f37)
	ld hl, W_BAGITEM01 ; $d31e
	ld a, [$FF00+$db]
	ld b, a
	xor a
	ld [$FF00+$dc], a
.asm_17f40
	ld a, [hli]
	cp $ff
	ret z
	cp b
	jr z, .asm_17f4f
	inc hl
	ld a, [$FF00+$dc]
	inc a
	ld [$FF00+$dc], a
	jr .asm_17f40
.asm_17f4f
	ld a, $1
	ld [$cf96], a
	ld a, [$FF00+$dc]
	ld [W_WHICHPOKEMON], a ; $cf92
	ld hl, W_NUMBAGITEMS ; $d31d
	jp RemoveItemFromInventory
; 17f5f (5:7f5f)
SECTION "bank6",ROMX,BANK[$6]

CeladonCity_h: ; 18000 (6:4000)
	db $00 ; tileset
	db CELADON_CITY_HEIGHT, CELADON_CITY_WIDTH ; dimensions (y, x)
	dw CeladonCityBlocks, CeladonCityTexts, CeladonCityScript ; blocks, texts, scripts
	db WEST | EAST ; connections

	; connections data

	db ROUTE_16
	dw $4B95, $C7C1 ; pointers (connected, current) (strip)
	db $09, $14 ; bigness, width
	db $F8, $27 ; alignments (y, x)
	dw $C716 ; window

	db ROUTE_7
	dw $4051, $C7DD ; pointers (connected, current) (strip)
	db $09, $0A ; bigness, width
	db $F8, $00 ; alignments (y, x)
	dw $C6F9 ; window

	; end connections data

	dw CeladonCityObject ; objects

CeladonCityObject: ; 0x18022 (size=189)
	db $f ; border tile

	db $d ; warps
	db $d, $8, $0, CELADON_MART_1
	db $d, $a, $2, CELADON_MART_1
	db $9, $18, $0, CELADON_MANSION_1
	db $3, $18, $2, CELADON_MANSION_1
	db $3, $19, $2, CELADON_MANSION_1
	db $9, $29, $0, CELADON_POKECENTER
	db $1b, $c, $0, CELADON_GYM
	db $13, $1c, $0, GAME_CORNER
	db $13, $27, $0, CELADON_MART_5 ; beta warp! no longer used
	db $13, $21, $0, CELADONPRIZE_ROOM
	db $1b, $1f, $0, CELADON_DINER
	db $1b, $23, $0, CELADON_HOUSE
	db $1b, $2b, $0, CELADON_HOTEL

	db $9 ; signs
	db $f, $1b, $a ; CeladonCityText10
	db $f, $13, $b ; CeladonCityText11
	db $9, $2a, $c ; PokeCenterSignText
	db $1d, $d, $d ; CeladonCityText13
	db $9, $15, $e ; CeladonCityText14
	db $d, $c, $f ; CeladonCityText15
	db $15, $27, $10 ; CeladonCityText16
	db $15, $21, $11 ; CeladonCityText17
	db $15, $1b, $12 ; CeladonCityText18

	db $9 ; people
	db SPRITE_LITTLE_GIRL, $11 + 4, $8 + 4, $fe, $0, $1 ; person
	db SPRITE_OLD_PERSON, $1c + 4, $b + 4, $ff, $d1, $2 ; person
	db SPRITE_GIRL, $13 + 4, $e + 4, $fe, $1, $3 ; person
	db SPRITE_OLD_PERSON, $16 + 4, $19 + 4, $ff, $d0, $4 ; person
	db SPRITE_OLD_PERSON, $10 + 4, $16 + 4, $ff, $d0, $5 ; person
	db SPRITE_FISHER2, $c + 4, $20 + 4, $ff, $d2, $6 ; person
	db SPRITE_SLOWBRO, $c + 4, $1e + 4, $ff, $d3, $7 ; person
	db SPRITE_ROCKET, $1d + 4, $20 + 4, $fe, $2, $8 ; person
	db SPRITE_ROCKET, $e + 4, $2a + 4, $fe, $2, $9 ; person

	; warp-to
	EVENT_DISP $19, $d, $8 ; CELADON_MART_1
	EVENT_DISP $19, $d, $a ; CELADON_MART_1
	EVENT_DISP $19, $9, $18 ; CELADON_MANSION_1
	EVENT_DISP $19, $3, $18 ; CELADON_MANSION_1
	EVENT_DISP $19, $3, $19 ; CELADON_MANSION_1
	EVENT_DISP $19, $9, $29 ; CELADON_POKECENTER
	EVENT_DISP $19, $1b, $c ; CELADON_GYM
	EVENT_DISP $19, $13, $1c ; GAME_CORNER
	EVENT_DISP $19, $13, $27 ; CELADON_MART_5
	EVENT_DISP $19, $13, $21 ; CELADONPRIZE_ROOM
	EVENT_DISP $19, $1b, $1f ; CELADON_DINER
	EVENT_DISP $19, $1b, $23 ; CELADON_HOUSE
	EVENT_DISP $19, $1b, $2b ; CELADON_HOTEL

CeladonCityBlocks: ; 180df (6:40df)
	INCBIN "maps/celadoncity.blk"

PalletTown_h: ; 182a1 (6:42a1)
	db $00 ; tileset
	db PALLET_TOWN_HEIGHT, PALLET_TOWN_WIDTH ; dimensions
	dw PalletTownBlocks, PalletTownTexts, PalletTownScript
	db NORTH | SOUTH ; connections

	db ROUTE_1
	dw Route1Blocks + ((ROUTE_1_WIDTH * 15) + 0) ;y, x Strip Starting Point
	dw $C6EB + 0 ;Strip X-Offset to current map
	db ROUTE_1_WIDTH ;"Bigness" (Unsure) ;Something to do with MapData
	db ROUTE_1_WIDTH ;"Map Width" (Unsure) ;Something to do with TileSet
	db (ROUTE_1_HEIGHT * 2) - 1 ;Player's new Y-Coordinates
	db (0 * -2) ;Player's new X-Coordinates
	dw $C6E9 + ROUTE_1_HEIGHT * (ROUTE_1_WIDTH + 6) ;New UL Block Pos (Window)

	db ROUTE_21
	dw Route21Blocks,$C7AB ; pointers
	db $0A,$0A ; bigness, width
	db $00,$00 ; alignments
	dw $C6F9 ; window

	dw PalletTownObject

PalletTownObject: ; 0x182c3 (size=58)
	db $b ; border tile

	db $3 ; warps
	db $5, $5, $0, REDS_HOUSE_1F
	db $5, $d, $0, BLUES_HOUSE
	db $b, $c, $1, OAKS_LAB

	db $4 ; signs
	db $d, $d, $4 ; PalletTownText4
	db $9, $7, $5 ; PalletTownText5
	db $5, $3, $6 ; PalletTownText6
	db $5, $b, $7 ; PalletTownText7

	db $3 ; people
	db SPRITE_OAK, $5 + 4, $8 + 4, $ff, $ff, $1 ; person
	db SPRITE_GIRL, $8 + 4, $3 + 4, $fe, $0, $2 ; person
	db SPRITE_FISHER2, $e + 4, $b + 4, $fe, $0, $3 ; person

	; warp-to
	EVENT_DISP $a, $5, $5 ; REDS_HOUSE_1F
	EVENT_DISP $a, $5, $d ; BLUES_HOUSE
	EVENT_DISP $a, $b, $c ; OAKS_LAB

PalletTownBlocks: ; 182fd (6:42fd)
	INCBIN "maps/pallettown.blk"

ViridianCity_h: ; 0x18357 to 0x18384 (45 bytes) (bank=6) (id=1)
	db $00 ; tileset
	db VIRIDIAN_CITY_HEIGHT, VIRIDIAN_CITY_WIDTH ; dimensions (y, x)
	dw ViridianCityBlocks, ViridianCityTexts, ViridianCityScript ; blocks, texts, scripts
	db NORTH | SOUTH | WEST ; connections

	; connections data

	db ROUTE_2
	dw Route2Blocks + (ROUTE_2_HEIGHT - 3) * ROUTE_2_WIDTH ; connection strip location
	dw $C6EB + 5 ; current map position
	db ROUTE_2_WIDTH, ROUTE_2_WIDTH ; bigness, width
	db (ROUTE_2_HEIGHT * 2) - 1, (5 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_2_HEIGHT * (ROUTE_2_WIDTH + 6) ; window

	db ROUTE_1
	dw Route1Blocks ; connection strip location
	dw $C6EB + (VIRIDIAN_CITY_HEIGHT + 3) * (VIRIDIAN_CITY_WIDTH + 6) + 5 ; current map position
	db ROUTE_1_WIDTH, ROUTE_1_WIDTH ; bigness, width
	db 0, (5 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_1_WIDTH ; window

	db ROUTE_22
	dw Route22Blocks - 3 + (ROUTE_22_WIDTH) ; connection strip location
	dw $C6E8 + (VIRIDIAN_CITY_WIDTH + 6) * (4 + 3) ; current map position
	db ROUTE_22_HEIGHT, ROUTE_22_WIDTH ; bigness, width
	db (4 * -2), (ROUTE_22_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_22_WIDTH ; window

	; end connections data

	dw ViridianCityObject ; objects

ViridianCityObject: ; 0x18384 (size=104)
	db $f ; border tile

	db $5 ; warps
	db $19, $17, $0, VIRIDIAN_POKECENTER
	db $13, $1d, $0, VIRIDIAN_MART
	db $f, $15, $0, VIRIDIAN_SCHOOL
	db $9, $15, $0, VIRIDIAN_HOUSE
	db $7, $20, $0, VIRIDIAN_GYM

	db $6 ; signs
	db $11, $11, $8 ; ViridianCityText8
	db $1, $13, $9 ; ViridianCityText9
	db $1d, $15, $a ; ViridianCityText10
	db $13, $1e, $b ; MartSignText
	db $19, $18, $c ; PokeCenterSignText
	db $7, $1b, $d ; ViridianCityText13

	db $7 ; people
	db SPRITE_BUG_CATCHER, $14 + 4, $d + 4, $fe, $0, $1 ; person
	db SPRITE_GAMBLER, $8 + 4, $1e + 4, $ff, $ff, $2 ; person
	db SPRITE_BUG_CATCHER, $19 + 4, $1e + 4, $fe, $0, $3 ; person
	db SPRITE_GIRL, $9 + 4, $11 + 4, $ff, $d3, $4 ; person
	db SPRITE_LYING_OLD_MAN, $9 + 4, $12 + 4, $ff, $ff, $5 ; person
	db SPRITE_FISHER2, $17 + 4, $6 + 4, $ff, $d0, $6 ; person
	db SPRITE_GAMBLER, $5 + 4, $11 + 4, $fe, $2, $7 ; person

	; warp-to
	EVENT_DISP $14, $19, $17 ; VIRIDIAN_POKECENTER
	EVENT_DISP $14, $13, $1d ; VIRIDIAN_MART
	EVENT_DISP $14, $f, $15 ; VIRIDIAN_SCHOOL
	EVENT_DISP $14, $9, $15 ; VIRIDIAN_HOUSE
	EVENT_DISP $14, $7, $20 ; VIRIDIAN_GYM

ViridianCityBlocks: ; 183ec (6:43ec)
	INCBIN "maps/viridiancity.blk"

PewterCity_h: ; 0x18554 to 0x18576 (34 bytes) (bank=6) (id=2)
	db $00 ; tileset
	db PEWTER_CITY_HEIGHT, PEWTER_CITY_WIDTH ; dimensions (y, x)
	dw PewterCityBlocks, PewterCityTexts, PewterCityScript ; blocks, texts, scripts
	db SOUTH | EAST ; connections

	; connections data

	db ROUTE_2
	dw Route2Blocks ; connection strip location
	dw $C6EB + (PEWTER_CITY_HEIGHT + 3) * (PEWTER_CITY_WIDTH + 6) + 5 ; current map position
	db ROUTE_2_WIDTH, ROUTE_2_WIDTH ; bigness, width
	db 0, (5 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_2_WIDTH ; window

	db ROUTE_3
	dw Route3Blocks + (ROUTE_3_WIDTH * 0) ; connection strip location
	dw $C6E5 + (PEWTER_CITY_WIDTH + 6) * (4 + 4) ; current map position
	db ROUTE_3_HEIGHT, ROUTE_3_WIDTH ; bigness, width
	db (4 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_3_WIDTH ; window

	; end connections data

	dw PewterCityObject ; objects

; 0x18576
db $0

PewterCityObject: ; 0x18577 (size=111)
	db $a ; border tile

	db $7 ; warps
	db $7, $e, $0, MUSEUM_1F
	db $5, $13, $2, MUSEUM_1F
	db $11, $10, $0, PEWTER_GYM
	db $d, $1d, $0, PEWTER_HOUSE_1
	db $11, $17, $0, PEWTER_MART
	db $1d, $7, $0, PEWTER_HOUSE_2
	db $19, $d, $0, PEWTER_POKECENTER

	db $7 ; signs
	db $1d, $13, $6 ; PewterCityText6
	db $13, $21, $7 ; PewterCityText7
	db $11, $18, $8 ; MartSignText
	db $19, $e, $9 ; PokeCenterSignText
	db $9, $f, $a ; PewterCityText10
	db $11, $b, $b ; PewterCityText11
	db $17, $19, $c ; PewterCityText12

	db $5 ; people
	db SPRITE_LASS, $f + 4, $8 + 4, $ff, $ff, $1 ; person
	db SPRITE_BLACK_HAIR_BOY_1, $19 + 4, $11 + 4, $ff, $ff, $2 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $11 + 4, $1b + 4, $ff, $ff, $3 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $19 + 4, $1a + 4, $fe, $2, $4 ; person
	db SPRITE_BUG_CATCHER, $10 + 4, $23 + 4, $ff, $d0, $5 ; person

	; warp-to
	EVENT_DISP $14, $7, $e ; MUSEUM_1F
	EVENT_DISP $14, $5, $13 ; MUSEUM_1F
	EVENT_DISP $14, $11, $10 ; PEWTER_GYM
	EVENT_DISP $14, $d, $1d ; PEWTER_HOUSE_1
	EVENT_DISP $14, $11, $17 ; PEWTER_MART
	EVENT_DISP $14, $1d, $7 ; PEWTER_HOUSE_2
	EVENT_DISP $14, $19, $d ; PEWTER_POKECENTER

PewterCityBlocks: ; 185e6 (6:45e6)
	INCBIN "maps/pewtercity.blk"

CeruleanCity_h: ; 0x1874e to 0x18786 (56 bytes) (bank=6) (id=3)
	db $00 ; tileset
	db CERULEAN_CITY_HEIGHT, CERULEAN_CITY_WIDTH ; dimensions (y, x)
	dw CeruleanCityBlocks, CeruleanCityTexts, CeruleanCityScript ; blocks, texts, scripts
	db NORTH | SOUTH | WEST | EAST ; connections

	; connections data

	db ROUTE_24
	dw Route24Blocks + (ROUTE_24_HEIGHT - 3) * ROUTE_24_WIDTH ; connection strip location
	dw $C6EB + 5 ; current map position
	db ROUTE_24_WIDTH, ROUTE_24_WIDTH ; bigness, width
	db (ROUTE_24_HEIGHT * 2) - 1, (5 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_24_HEIGHT * (ROUTE_24_WIDTH + 6) ; window

	db ROUTE_5
	dw Route5Blocks ; connection strip location
	dw $C6EB + (CERULEAN_CITY_HEIGHT + 3) * (CERULEAN_CITY_WIDTH + 6) + 5 ; current map position
	db ROUTE_5_WIDTH, ROUTE_5_WIDTH ; bigness, width
	db 0, (5 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_5_WIDTH ; window

	db ROUTE_4
	dw Route4Blocks - 3 + (ROUTE_4_WIDTH) ; connection strip location
	dw $C6E8 + (CERULEAN_CITY_WIDTH + 6) * (4 + 3) ; current map position
	db ROUTE_4_HEIGHT, ROUTE_4_WIDTH ; bigness, width
	db (4 * -2), (ROUTE_4_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_4_WIDTH ; window

	db ROUTE_9
	dw Route9Blocks + (ROUTE_9_WIDTH * 0) ; connection strip location
	dw $C6E5 + (CERULEAN_CITY_WIDTH + 6) * (4 + 4) ; current map position
	db ROUTE_9_HEIGHT, ROUTE_9_WIDTH ; bigness, width
	db (4 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_9_WIDTH ; window

	; end connections data

	dw CeruleanCityObject ; objects

CeruleanCityObject: ; 0x18786 (size=170)
	db $f ; border tile

	db $a ; warps
	db $b, $1b, $0, TRASHED_HOUSE
	db $f, $d, $0, CERULEAN_HOUSE
	db $11, $13, $0, CERULEAN_POKECENTER
	db $13, $1e, $0, CERULEAN_GYM
	db $19, $d, $0, BIKE_SHOP
	db $19, $19, $0, CERULEAN_MART
	db $b, $4, $0, UNKNOWN_DUNGEON_1
	db $9, $1b, $2, TRASHED_HOUSE
	db $b, $9, $1, CERULEAN_HOUSE_3
	db $9, $9, $0, CERULEAN_HOUSE_3

	db $6 ; signs
	db $13, $17, $c ; CeruleanCityText12
	db $1d, $11, $d ; CeruleanCityText13
	db $19, $1a, $e ; MartSignText
	db $11, $14, $f ; PokeCenterSignText
	db $19, $b, $10 ; CeruleanCityText16
	db $15, $1b, $11 ; CeruleanCityText17

	db $b ; people
	db SPRITE_BLUE, $2 + 4, $14 + 4, $ff, $d0, $1 ; person
	db SPRITE_ROCKET, $8 + 4, $1e + 4, $ff, $ff, $42, ROCKET + $C8, $5 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $14 + 4, $1f + 4, $ff, $d0, $3 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $12 + 4, $f + 4, $fe, $1, $4 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $15 + 4, $9 + 4, $fe, $2, $5 ; person
	db SPRITE_GUARD, $c + 4, $1c + 4, $ff, $d0, $6 ; person
	db SPRITE_LASS, $1a + 4, $1d + 4, $ff, $d2, $7 ; person
	db SPRITE_SLOWBRO, $1a + 4, $1c + 4, $ff, $d0, $8 ; person
	db SPRITE_LASS, $1b + 4, $9 + 4, $fe, $2, $9 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $c + 4, $4 + 4, $ff, $d0, $a ; person
	db SPRITE_GUARD, $c + 4, $1b + 4, $ff, $d0, $b ; person

	; warp-to
	EVENT_DISP $14, $b, $1b ; TRASHED_HOUSE
	EVENT_DISP $14, $f, $d ; CERULEAN_HOUSE
	EVENT_DISP $14, $11, $13 ; CERULEAN_POKECENTER
	EVENT_DISP $14, $13, $1e ; CERULEAN_GYM
	EVENT_DISP $14, $19, $d ; BIKE_SHOP
	EVENT_DISP $14, $19, $19 ; CERULEAN_MART
	EVENT_DISP $14, $b, $4 ; UNKNOWN_DUNGEON_1
	EVENT_DISP $14, $9, $1b ; TRASHED_HOUSE
	EVENT_DISP $14, $b, $9 ; CERULEAN_HOUSE_3
	EVENT_DISP $14, $9, $9 ; CERULEAN_HOUSE_3

CeruleanCityBlocks: ; 18830 (6:4830)
	INCBIN "maps/ceruleancity.blk"

VermilionCity_h: ; 0x18998 to 0x189ba (34 bytes) (bank=6) (id=5)
	db $00 ; tileset
	db VERMILION_CITY_HEIGHT, VERMILION_CITY_WIDTH ; dimensions (y, x)
	dw VermilionCityBlocks, VermilionCityTexts, VermilionCityScript ; blocks, texts, scripts
	db NORTH | EAST ; connections

	; connections data

	db ROUTE_6
	dw Route6Blocks + (ROUTE_6_HEIGHT - 3) * ROUTE_6_WIDTH ; connection strip location
	dw $C6EB + 5 ; current map position
	db ROUTE_6_WIDTH, ROUTE_6_WIDTH ; bigness, width
	db (ROUTE_6_HEIGHT * 2) - 1, (5 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_6_HEIGHT * (ROUTE_6_WIDTH + 6) ; window

	db ROUTE_11
	dw Route11Blocks + (ROUTE_11_WIDTH * 0) ; connection strip location
	dw $C6E5 + (VERMILION_CITY_WIDTH + 6) * (4 + 4) ; current map position
	db ROUTE_11_HEIGHT, ROUTE_11_WIDTH ; bigness, width
	db (4 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_11_WIDTH ; window

	; end connections data

	dw VermilionCityObject ; objects

VermilionCityObject: ; 0x189ba (size=133)
	db $43 ; border tile

	db $9 ; warps
	db $3, $b, $0, VERMILION_POKECENTER
	db $d, $9, $0, POKEMON_FAN_CLUB
	db $d, $17, $0, VERMILION_MART
	db $13, $c, $0, VERMILION_GYM
	db $13, $17, $0, VERMILION_HOUSE_1
	db $1f, $12, $0, VERMILION_DOCK
	db $1f, $13, $0, VERMILION_DOCK
	db $d, $f, $0, VERMILION_HOUSE_3
	db $3, $7, $0, VERMILION_HOUSE_2

	db $7 ; signs
	db $3, $1b, $7 ; VermilionCityText7
	db $d, $25, $8 ; VermilionCityText8
	db $d, $18, $9 ; MartSignText
	db $3, $c, $a ; PokeCenterSignText
	db $d, $7, $b ; VermilionCityText11
	db $13, $7, $c ; VermilionCityText12
	db $f, $1d, $d ; VermilionCityText13

	db $6 ; people
	db SPRITE_FOULARD_WOMAN, $7 + 4, $13 + 4, $fe, $2, $1 ; person
	db SPRITE_GAMBLER, $6 + 4, $e + 4, $ff, $ff, $2 ; person
	db SPRITE_SAILOR, $1e + 4, $13 + 4, $ff, $d1, $3 ; person
	db SPRITE_GAMBLER, $7 + 4, $1e + 4, $ff, $ff, $4 ; person
	db SPRITE_SLOWBRO, $9 + 4, $1d + 4, $fe, $1, $5 ; person
	db SPRITE_SAILOR, $1b + 4, $19 + 4, $fe, $2, $6 ; person

	; warp-to
	EVENT_DISP $14, $3, $b ; VERMILION_POKECENTER
	EVENT_DISP $14, $d, $9 ; POKEMON_FAN_CLUB
	EVENT_DISP $14, $d, $17 ; VERMILION_MART
	EVENT_DISP $14, $13, $c ; VERMILION_GYM
	EVENT_DISP $14, $13, $17 ; VERMILION_HOUSE_1
	EVENT_DISP $14, $1f, $12 ; VERMILION_DOCK
	EVENT_DISP $14, $1f, $13 ; VERMILION_DOCK
	EVENT_DISP $14, $d, $f ; VERMILION_HOUSE_3
	EVENT_DISP $14, $3, $7 ; VERMILION_HOUSE_2

VermilionCityBlocks: ; 18a3f (6:4a3f)
	INCBIN "maps/vermilioncity.blk"

FuchsiaCity_h: ; 0x18ba7 to 0x18bd4 (45 bytes) (bank=6) (id=7)
	db $00 ; tileset
	db FUCHSIA_CITY_HEIGHT, FUCHSIA_CITY_WIDTH ; dimensions (y, x)
	dw FuchsiaCityBlocks, FuchsiaCityTexts, FuchsiaCityScript ; blocks, texts, scripts
	db SOUTH | WEST | EAST ; connections

	; connections data

	db ROUTE_19
	dw Route19Blocks ; connection strip location
	dw $C6EB + (FUCHSIA_CITY_HEIGHT + 3) * (FUCHSIA_CITY_WIDTH + 6) + 5 ; current map position
	db ROUTE_19_WIDTH, ROUTE_19_WIDTH ; bigness, width
	db 0, (5 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_19_WIDTH ; window

	db ROUTE_18
	dw Route18Blocks - 3 + (ROUTE_18_WIDTH) ; connection strip location
	dw $C6E8 + (FUCHSIA_CITY_WIDTH + 6) * (4 + 3) ; current map position
	db ROUTE_18_HEIGHT, ROUTE_18_WIDTH ; bigness, width
	db (4 * -2), (ROUTE_18_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_18_WIDTH ; window

	db ROUTE_15
	dw Route15Blocks + (ROUTE_15_WIDTH * 0) ; connection strip location
	dw $C6E5 + (FUCHSIA_CITY_WIDTH + 6) * (4 + 4) ; current map position
	db ROUTE_15_HEIGHT, ROUTE_15_WIDTH ; bigness, width
	db (4 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_15_WIDTH ; window

	; end connections data

	dw FuchsiaCityObject ; objects

FuchsiaCityObject: ; 0x18bd4 (size=178)
	db $f ; border tile

	db $9 ; warps
	db $d, $5, $0, FUCHSIA_MART
	db $1b, $b, $0, FUCHSIA_HOUSE_1
	db $1b, $13, $0, FUCHSIA_POKECENTER
	db $1b, $1b, $0, FUCHSIA_HOUSE_2
	db $3, $12, $0, SAFARIZONEENTRANCE
	db $1b, $5, $0, FUCHSIA_GYM
	db $d, $16, $0, FUCHSIAMEETINGROOM
	db $1b, $1f, $1, FUCHSIA_HOUSE_3
	db $18, $1f, $0, FUCHSIA_HOUSE_3

	db $e ; signs
	db $17, $f, $b ; FuchsiaCityText11
	db $f, $19, $c ; FuchsiaCityText12
	db $5, $11, $d ; FuchsiaCityText13
	db $d, $6, $e ; MartSignText
	db $1b, $14, $f ; PokeCenterSignText
	db $1d, $1b, $10 ; FuchsiaCityText16
	db $f, $15, $11 ; FuchsiaCityText17
	db $1d, $5, $12 ; FuchsiaCityText18
	db $7, $21, $13 ; FuchsiaCityText19
	db $7, $1b, $14 ; FuchsiaCityText20
	db $7, $d, $15 ; FuchsiaCityText21
	db $d, $1f, $16 ; FuchsiaCityText22
	db $f, $d, $17 ; FuchsiaCityText23
	db $7, $7, $18 ; FuchsiaCityText24

	db $a ; people
	db SPRITE_BUG_CATCHER, $c + 4, $a + 4, $fe, $2, $1 ; person
	db SPRITE_GAMBLER, $11 + 4, $1c + 4, $fe, $2, $2 ; person
	db SPRITE_FISHER2, $e + 4, $1e + 4, $ff, $d0, $3 ; person
	db SPRITE_BUG_CATCHER, $8 + 4, $18 + 4, $ff, $d1, $4 ; person
	db SPRITE_CLEFAIRY, $5 + 4, $1f + 4, $fe, $0, $5 ; person
	db SPRITE_BALL, $6 + 4, $19 + 4, $ff, $ff, $6 ; person
	db SPRITE_SLOWBRO, $6 + 4, $c + 4, $fe, $2, $7 ; person
	db SPRITE_SLOWBRO, $c + 4, $1e + 4, $fe, $2, $8 ; person
	db SPRITE_SEEL, $11 + 4, $8 + 4, $fe, $0, $9 ; person
	db SPRITE_OMANYTE, $5 + 4, $6 + 4, $ff, $ff, $a ; person

	; warp-to
	EVENT_DISP $14, $d, $5 ; FUCHSIA_MART
	EVENT_DISP $14, $1b, $b ; FUCHSIA_HOUSE_1
	EVENT_DISP $14, $1b, $13 ; FUCHSIA_POKECENTER
	EVENT_DISP $14, $1b, $1b ; FUCHSIA_HOUSE_2
	EVENT_DISP $14, $3, $12 ; SAFARIZONEENTRANCE
	EVENT_DISP $14, $1b, $5 ; FUCHSIA_GYM
	EVENT_DISP $14, $d, $16 ; FUCHSIAMEETINGROOM
	EVENT_DISP $14, $1b, $1f ; FUCHSIA_HOUSE_3
	EVENT_DISP $14, $18, $1f ; FUCHSIA_HOUSE_3

FuchsiaCityBlocks: ; 18c86 (6:4c86)
	INCBIN "maps/fuchsiacity.blk"

; known jump sources: 2099 (0:2099)
Func_18dee: ; 18dee (6:4dee)
	call Func_18e36
	ld a, [$d732]
	bit 0, a
	ret z
	ld a, [W_PLAYTIMEMINUTES] ; $da42
	and a
	ret nz
	ld a, [W_PLAYTIMEFRAMES] ; $da45
	inc a
	ld [W_PLAYTIMEFRAMES], a ; $da45
	cp $3c
	ret nz
	xor a
	ld [W_PLAYTIMEFRAMES], a ; $da45
	ld a, [W_PLAYTIMESECONDS] ; $da44
	inc a
	ld [W_PLAYTIMESECONDS], a ; $da44
	cp $3c
	ret nz
	xor a
	ld [W_PLAYTIMESECONDS], a ; $da44
	ld a, [$da43]
	inc a
	ld [$da43], a
	cp $3c
	ret nz
	xor a
	ld [$da43], a
	ld a, [$da41]
	inc a
	ld [$da41], a
	cp $ff
	ret nz
	ld a, $ff
	ld [W_PLAYTIMEMINUTES], a ; $da42
	ret

; known jump sources: 18dee (6:4dee)
Func_18e36: ; 18e36 (6:4e36)
	ld a, [$d13a]
	and a
	jr nz, .asm_18e40
	ld a, $ff
	jr .asm_18e41
.asm_18e40
	dec a
.asm_18e41
	ld [$d13a], a
	and a
	ret nz
	ld a, [$d730]
	res 1, a
	res 2, a
	bit 5, a
	res 5, a
	ld [$d730], a
	ret z
	xor a
	ld [H_NEWLYPRESSEDBUTTONS], a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ret
; 18e5b (6:4e5b)
PalletTownScript: ; 18e5b (6:4e5b)
	ld a,[$D74B]
	bit 4,a
	jr z,.next
	ld hl,$D747
	set 6,[hl]
.next
	call EnableAutoTextBoxDrawing
	ld hl,PalletTownScriptPointers
	ld a,[W_PALLETTOWNCURSCRIPT]
	jp CallFunctionInTable
; 0x18e73

PalletTownScriptPointers: ; 18e73 (6:4e73)
	dw PalletTownScript1,PalletTownScript2,PalletTownScript3,PalletTownScript4,PalletTownScript5,PalletTownScript6,PalletTownScript7

PalletTownScript1: ; 18e81 (6:4e81)
	ld a,[$D747]
	bit 0,a
	ret nz
	ld a,[W_YCOORD]
	cp 1 ; is player near north exit?
	ret nz
	xor a
	ld [H_CURRENTPRESSEDBUTTONS],a
	ld a,4
	ld [$D528],a
	ld a,$FF
	call PlaySound ; stop music
	ld a,2
	ld c,a ; song bank
	ld a,$DB ; “oak appears” music
	call PlayMusic ; plays music
	ld a,$FC
	ld [W_JOYPADFORBIDDENBUTTONSMASK],a
	ld hl,$D74B
	set 7,[hl]

	; trigger the next script
	ld a,1
	ld [W_PALLETTOWNCURSCRIPT],a
	ret

PalletTownScript2: ; 18eb2 (6:4eb2)
	xor a
	ld [$CF0D],a
	ld a,1
	ld [$FF8C],a
	call DisplayTextID
	ld a,$FF
	ld [W_JOYPADFORBIDDENBUTTONSMASK],a
	ld a,0
	ld [$CC4D],a
	ld a,$15
	call Predef

	; trigger the next script
	ld a,2
	ld [W_PALLETTOWNCURSCRIPT],a
	ret

PalletTownScript3: ; 18ed2 (6:4ed2)
	ld a,1
	ld [$FF8C],a
	ld a,4
	ld [$FF8D],a
	call Func_34a6
	call Delay3
	ld a,1
	ld [W_YCOORD],a
	ld a,1
	ld [$FF9B],a
	ld a,1
	swap a
	ld [$FF95],a
	ld a,$22
	call Predef
	ld hl,$FF95
	dec [hl]
	ld a,$20
	call Predef ; load Oak’s movement into $CC97
	ld de,$CC97
	ld a,1 ; oak
	ld [$FF8C],a
	call MoveSprite
	ld a,$FF
	ld [W_JOYPADFORBIDDENBUTTONSMASK],a

	; trigger the next script
	ld a,3
	ld [W_PALLETTOWNCURSCRIPT],a
	ret

PalletTownScript4: ; 18f12 (6:4f12)
	ld a,[$D730]
	bit 0,a
	ret nz
	xor a
	ld [$C109],a
	ld a,1
	ld [$CF0D],a
	ld a,$FC
	ld [W_JOYPADFORBIDDENBUTTONSMASK],a
	ld a,1
	ld [$FF8C],a
	call DisplayTextID
	ld a,$FF
	ld [W_JOYPADFORBIDDENBUTTONSMASK],a
	ld a,1
	ld [$CF13],a
	xor a
	ld [$CF10],a
	ld a,1
	ld [$CC57],a
	ld a,[H_LOADEDROMBANK]
	ld [$CC58],a

	; trigger the next script
	ld a,4
	ld [W_PALLETTOWNCURSCRIPT],a
	ret

PalletTownScript5: ; 18f4b (6:4f4b)
	ld a,[$CC57]
	and a
	ret nz

	; trigger the next script
	ld a,5
	ld [W_PALLETTOWNCURSCRIPT],a
	ret

PalletTownScript6: ; 18f56 (6:4f56)
	ld a,[$D74A]
	bit 2,a
	jr nz,.next
	and 3
	cp 3
	jr nz,.next
	ld hl,$D74A
	set 2,[hl]
	ld a,$27
	ld [$CC4D],a
	ld a,$11
	call Predef
	ld a,$28
	ld [$CC4D],a
	ld a,$15
	jp Predef
.next
	ld a,[$D74B]
	bit 4,a
	ret z
	ld hl,$D74B
	set 6,[hl]
PalletTownScript7: ; 18f87 (6:4f87)
	ret

PalletTownTexts: ; 18f88 (6:4f88)
	dw PalletTownText1,PalletTownText2,PalletTownText3,PalletTownText4,PalletTownText5,PalletTownText6,PalletTownText7

PalletTownText1: ; 18f96 (6:4f96)
	db 8
	ld a,[$CF0D]
	and a
	jr nz,.next
	ld a,1
	ld [$CC3C],a
	ld hl,OakAppearsText
	jr .done
.next
	ld hl,OakWalksUpText
.done
	call PrintText
	jp TextScriptEnd

OakAppearsText: ; 18fb0 (6:4fb0)
	TX_FAR _OakAppearsText
	db 8
	ld c,10
	call DelayFrames
	xor a
	ld [$CD4F],a
	ld [$CD50],a
	ld a,$4C
	call Predef ; display ! over head
	ld a,4
	ld [$D528],a
	jp TextScriptEnd

OakWalksUpText: ; 18fce (6:4fce)
	TX_FAR _OakWalksUpText
	db "@"

PalletTownText2: ; 0x18fd3 girl
	TX_FAR _PalletTownText2 ; dc 42 29 pointing to 0xa42dc
	db "@"
; 0x18fd8

PalletTownText3: ; 0x18fd8 fat man
	TX_FAR _PalletTownText3
	db "@"
; 0x18fdd

PalletTownText4: ; 0x18fdd sign by lab
	TX_FAR _PalletTownText4
	db "@"
; 0x18fe2

PalletTownText5: ; 0x18fe2 sign by fence
	TX_FAR _PalletTownText5
	db "@"
; 0x18fe7

PalletTownText6: ; 0x18fe7 sign by Red’s house
	TX_FAR _PalletTownText6
	db "@"
; 0x18fec

PalletTownText7: ; 0x18fec sign by Blue’s house
	TX_FAR _PalletTownText7
	db "@"

ViridianCityScript: ; 18ff1 (6:4ff1)
	call EnableAutoTextBoxDrawing
	ld hl, ViridianCityScripts
	ld a, [W_VIRIDIANCITYCURSCRIPT]
	jp CallFunctionInTable
; 0x18ffd

ViridianCityScripts: ; 18ffd (6:4ffd)
	dw ViridianCityScript0
	dw ViridianCityScript1
	dw ViridianCityScript2
	dw ViridianCityScript3

ViridianCityScript0: ; 19005 (6:5005)
	call Function1900b
	jp Function1903d

Function1900b: ; 1900b (6:500b)
	ld a, [$d74c]
	bit 0, a
	ret nz
	ld a, [W_OBTAINEDBADGES]
	cp %01111111
	jr nz, .asm_1901e ; 0x19016 $6
	ld hl, $d74c
	set 0, [hl]
	ret
.asm_1901e
	ld a, [W_YCOORD]
	cp $8
	ret nz
	ld a, [W_XCOORD]
	cp $20
	ret nz
	ld a, $e
	ld [$ff00+$8c], a
	call DisplayTextID
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	call Function190cf
	ld a, $3
	ld [W_VIRIDIANCITYCURSCRIPT], a
	ret

Function1903d: ; 1903d (6:503d)
	ld a, [$d74b]
	bit 5, a
	ret nz
	ld a, [W_YCOORD]
	cp $9
	ret nz
	ld a, [W_XCOORD]
	cp $13
	ret nz
	ld a, $5
	ld [$ff00+$8c], a
	call DisplayTextID
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	call Function190cf
	ld a, $3
	ld [W_VIRIDIANCITYCURSCRIPT], a
	ret

ViridianCityScript1: ; 19062 (6:5062)
	ld a, [$c134]
	ld [$ff00+$eb], a
	ld a, [$c136]
	ld [$ff00+$ec], a
	ld a, [$c234]
	ld [$ff00+$ed], a
	ld a, [$c235]
	ld [$ff00+$ee], a
	xor a
	ld [W_LISTSCROLLOFFSET], a

	; set up battle for Old Man
	ld a, $1
	ld [W_BATTLETYPE], a
	ld a, 5
	ld [W_CURENEMYLVL], a
	ld a, WEEDLE
	ld [W_CUROPPONENT], a
	ld a, $2
	ld [W_VIRIDIANCITYCURSCRIPT], a ; XXX what is this
	ret

ViridianCityScript2: ; 1908f (6:508f)
	ld a, [$ff00+$eb]
	ld [$c134], a
	ld a, [$ff00+$ec]
	ld [$c136], a
	ld a, [$ff00+$ed]
	ld [$c234], a
	ld a, [$ff00+$ee]
	ld [$c235], a
	call UpdateSprites
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $f
	ld [$ff00+$8c], a
	call DisplayTextID
	xor a
	ld [W_BATTLETYPE], a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $0
	ld [W_VIRIDIANCITYCURSCRIPT], a
	ret

ViridianCityScript3: ; 190c1 (6:50c1)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	ld a, 0
	ld [W_VIRIDIANCITYCURSCRIPT], a
	ret

Function190cf: ; 190cf (6:50cf)
	call Func_3486
	ld a, $1
	ld [$cd38], a
	ld a, $80
	ld [$ccd3], a
	xor a
	ld [$c109], a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ret

ViridianCityTexts: ; 190e4 (6:50e4)
	dw ViridianCityText1, ViridianCityText2, ViridianCityText3, ViridianCityText4, ViridianCityText5, ViridianCityText6, ViridianCityText7, ViridianCityText8, ViridianCityText9, ViridianCityText10, MartSignText, PokeCenterSignText, ViridianCityText13, ViridianCityText14, ViridianCityText15

ViridianCityText1: ; 19102 (6:5102)
	TX_FAR _ViridianCityText1
	db $50

ViridianCityText2: ; 19107 (6:5107)
	db $08 ; asm
	ld a, [$d356]
	cp $7f
	ld hl, UnnamedText_19127
	jr z, .asm_ae9fe ; 0x19110
	ld a, [$d751]
	bit 1, a
	jr nz, .asm_ae9fe ; 0x19117
	ld hl, UnnamedText_19122
.asm_ae9fe ; 0x1911c
	call PrintText
	jp TextScriptEnd

UnnamedText_19122: ; 19122 (6:5122)
	TX_FAR _UnnamedText_19122
	db $50
; 0x19122 + 5 bytes

UnnamedText_19127: ; 19127 (6:5127)
	TX_FAR _UnnamedText_19127
	db $50
; 0x19127 + 5 bytes

ViridianCityText3: ; 1912c (6:512c)
	db $08 ; asm
	ld hl, UnnamedText_1914d
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_6dfea ; 0x1913a
	ld hl, UnnamedText_19157
	call PrintText
	jr .asm_d611f ; 0x19142
.asm_6dfea ; 0x19144
	ld hl, UnnamedText_19152
	call PrintText
.asm_d611f ; 0x1914a
	jp TextScriptEnd

UnnamedText_1914d: ; 1914d (6:514d)
	TX_FAR _UnnamedText_1914d
	db $50
; 0x1914d + 5 bytes

UnnamedText_19152: ; 19152 (6:5152)
	TX_FAR _UnnamedText_19152
	db $50
; 0x19152 + 5 bytes

UnnamedText_19157: ; 19157 (6:5157)
	TX_FAR _UnnamedText_19157
	db $50
; 0x19157 + 5 bytes

ViridianCityText4: ; 1915c (6:515c)
	db $08 ; asm
	ld a, [$d74b]
	bit 5, a
	jr nz, .asm_83894 ; 0x19162
	ld hl, UnnamedText_19175
	call PrintText
	jr .asm_700a6 ; 0x1916a
.asm_83894 ; 0x1916c
	ld hl, UnnamedText_1917a
	call PrintText
.asm_700a6 ; 0x19172
	jp TextScriptEnd

UnnamedText_19175: ; 19175 (6:5175)
	TX_FAR _UnnamedText_19175
	db $50
; 0x19175 + 5 bytes

UnnamedText_1917a: ; 1917a (6:517a)
	TX_FAR _UnnamedText_1917a
	db $50
; 0x1917a + 5 bytes

ViridianCityText5: ; 1917f (6:517f)
	db $08 ; asm
	ld hl, UnnamedText_19191
	call PrintText
	call Function190cf
	ld a, $3
	ld [W_VIRIDIANCITYCURSCRIPT], a
	jp TextScriptEnd

UnnamedText_19191: ; 19191 (6:5191)
	TX_FAR _UnnamedText_19191
	db $50
; 0x19191 + 5 bytes

ViridianCityText6: ; 19196 (6:5196)
	db $08 ; asm
	ld a, [$d74c]
	bit 1, a
	jr nz, .asm_4e5a0 ; 0x1919c
	ld hl, UnnamedText_191ca
	call PrintText
	ld bc, (TM_42 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedTM42Text
	call PrintText
	ld hl, $d74c
	set 1, [hl]
	jr .asm_3c73c ; 0x191b7
.BagFull
	ld hl, TM42NoRoomText
	call PrintText
	jr .asm_3c73c ; 0x191bf
.asm_4e5a0 ; 0x191c1
	ld hl, TM42Explanation
	call PrintText
.asm_3c73c ; 0x191c7
	jp TextScriptEnd

UnnamedText_191ca: ; 191ca (6:51ca)
	TX_FAR _UnnamedText_191ca
	db $50
; 0x191ca + 5 bytes

ReceivedTM42Text: ; 191cf (6:51cf)
	TX_FAR _ReceivedTM42Text ; 0xa469a
	db $10, $50
; 0x191cf + 6 bytes = 0x191d5

TM42Explanation: ; 191d5 (6:51d5)
	TX_FAR _TM42Explanation
	db $50
; 0x191d5 + 5 bytes

TM42NoRoomText: ; 191da (6:51da)
	TX_FAR _TM42NoRoomText
	db $50
; 0x191da + 5 bytes

ViridianCityText7: ; 191df (6:51df)
	db $08 ; asm
	ld hl, UnnamedText_1920a
	call PrintText
	ld c, $2
	call DelayFrames
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr z, .asm_42f68 ; 0x191f2
	ld hl, UnnamedText_1920f
	call PrintText
	ld a, $1
	ld [W_VIRIDIANCITYCURSCRIPT], a
	jr .asm_2413a ; 0x191ff
.asm_42f68 ; 0x19201
	ld hl, UnnamedText_19214
	call PrintText
.asm_2413a ; 0x19207
	jp TextScriptEnd

UnnamedText_1920a: ; 1920a (6:520a)
	TX_FAR _UnnamedText_1920a
	db $50
; 0x1920a + 5 bytes

UnnamedText_1920f: ; 1920f (6:520f)
	TX_FAR _UnnamedText_1920f
	db $50
; 0x1920f + 5 bytes

UnnamedText_19214: ; 19214 (6:5214)
	TX_FAR _UnnamedText_19214
	db $50
; 0x19214 + 5 bytes

ViridianCityText15: ; 19219 (6:5219)
	TX_FAR _UnnamedText_19219
	db $50
; 0x19219 + 5 bytes

ViridianCityText8: ; 1921e (6:521e)
	TX_FAR _ViridianCityText8
	db $50

ViridianCityText9: ; 19223 (6:5223)
	TX_FAR _ViridianCityText9
	db $50

ViridianCityText10: ; 19228 (6:5228)
	TX_FAR _ViridianCityText10
	db $50

ViridianCityText13: ; 1922d (6:522d)
	TX_FAR _ViridianCityText13
	db $50

ViridianCityText14: ; 19232 (6:5232)
	TX_FAR _ViridianCityText14
	db $50
; 0x19232 + 5 bytes

PewterCityScript: ; 19237 (6:5237)
	call EnableAutoTextBoxDrawing
	ld hl, PewterCityScripts
	ld a, [W_PEWTERCITYCURSCRIPT]
	jp CallFunctionInTable
; 0x19243

PewterCityScripts: ; 19243 (6:5243)
	dw PewterCityScript0
	dw PewterCityScript1
	dw PewterCityScript2
	dw PewterCityScript3
	dw PewterCityScript4
	dw PewterCityScript5
	dw PewterCityScript6

PewterCityScript0: ; 19251 (6:5251)
	xor a
	ld [W_MUSEUMF1CURSCRIPT], a
	ld hl, $d754
	res 0, [hl]
	call Function1925e
	ret
; 0x1925e

Function1925e: ; 1925e (6:525e)
	ld a, [$d755]
	bit 7, a
	ret nz
	ld hl, CoordsData19277
	call ArePlayerCoordsInArray
	ret nc
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $5
	ld [$ff00+$8c], a
	jp DisplayTextID

CoordsData19277: ; 19277 (6:5277)
	db $11,$23
	db $11,$24
	db $12,$25
	db $13,$25
	db $ff

PewterCityScript1: ; 19280 (6:5280)
	ld a, [$cc57]
	and a
	ret nz
	ld a, $3
	ld [$ff00+$8c], a
	ld a, $4
	ld [$ff00+$8d], a
	call Func_34a6
	ld a, $34
	ld [$ff00+$8d], a
	call Func_34b9
	call Func_2307
	ld hl, W_FLAGS_CD60
	set 4, [hl]
	ld a, $d
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $3c
	ld [$ff00+$eb], a
	ld a, $30
	ld [$ff00+$ec], a
	ld a, $c
	ld [$ff00+$ed], a
	ld a, $11
	ld [$ff00+$ee], a
	ld a, $3
	ld [$cf13], a
	call Func_32f9
	ld a, $3
	ld [$ff00+$8c], a
	ld de, MovementData192ce ; $52ce
	call MoveSprite
	ld a, $2
	ld [W_PEWTERCITYCURSCRIPT], a
	ret
; 0x192ce

MovementData192ce: ; 192ce (6:52ce)
	db 0,0,0,0,$ff

PewterCityScript2: ; 192d3 (6:52d3)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $3
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, $3
	ld [W_PEWTERCITYCURSCRIPT], a
	ret

PewterCityScript3: ; 192e9 (6:52e9)
	ld a, $3
	ld [$cf13], a
	call Func_32fe
	ld a, $3
	ld [$cc4d], a
	ld a, $15
	call Predef
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $0
	ld [W_PEWTERCITYCURSCRIPT], a
	ret

PewterCityScript4: ; 19305 (6:5305)
	ld a, [$cc57]
	and a
	ret nz
	ld a, $5
	ld [$ff00+$8c], a
	ld a, $8
	ld [$ff00+$8d], a
	call Func_34a6
	ld a, $18
	ld [$ff00+$8d], a
	call Func_34b9
	call Func_2307
	ld hl, W_FLAGS_CD60
	set 4, [hl]
	ld a, $e
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $3c
	ld [$ff00+$eb], a
	ld a, $40
	ld [$ff00+$ec], a
	ld a, $16
	ld [$ff00+$ed], a
	ld a, $10
	ld [$ff00+$ee], a
	ld a, $5
	ld [$cf13], a
	call Func_32f9
	ld a, $5
	ld [$ff00+$8c], a
	ld de, MovementData19353
	call MoveSprite
	ld a, $5
	ld [W_PEWTERCITYCURSCRIPT], a
	ret

MovementData19353: ; 19353 (6:5353)
	db $c0,$c0,$c0,$c0,$c0,$ff

PewterCityScript5: ; 19359 (6:5359)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $4
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, $6
	ld [W_PEWTERCITYCURSCRIPT], a
	ret

PewterCityScript6: ; 1936f (6:536f)
	ld a, $5
	ld [$cf13], a
	call Func_32fe
	ld a, $4
	ld [$cc4d], a
	ld a, $15
	call Predef
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $0
	ld [W_PEWTERCITYCURSCRIPT], a
	ret

PewterCityTexts: ; 1938b (6:538b)
	dw PewterCityText1, PewterCityText2, PewterCityText3, PewterCityText4, PewterCityText5, PewterCityText6, PewterCityText7, MartSignText, PokeCenterSignText, PewterCityText10, PewterCityText11, PewterCityText12, PewterCityText13, PewterCityText14

PewterCityText1: ; 193a7 (6:53a7)
	TX_FAR _PewterCityText1
	db $50

PewterCityText2: ; 193ac (6:53ac)
	TX_FAR _PewterCityText2
	db $50

PewterCityText3: ; 193b1 (6:53b1)
	db $08 ; asm
	ld hl, UnnamedText_193f1
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_f46a9 ; 0x193bf
	ld hl, UnnamedText_193f6
	call PrintText
	jr .asm_ac429 ; 0x193c7
.asm_f46a9 ; 0x193c9
	ld hl, UnnamedText_193fb
	call PrintText
	xor a
	ldh [$b3], a
	ldh [$b4], a
	ld [$cf10], a
	ld a, $2
	ld [$cc57], a
	ldh a, [$b8]
	ld [$cc58], a
	ld a, $3
	ld [$cf13], a
	call Func_32f4
	ld a, $1
	ld [W_PEWTERCITYCURSCRIPT], a
.asm_ac429 ; 0x193ee
	jp TextScriptEnd

UnnamedText_193f1: ; 193f1 (6:53f1)
	TX_FAR _UnnamedText_193f1
	db $50
; 0x193f1 + 5 bytes

UnnamedText_193f6: ; 193f6 (6:53f6)
	TX_FAR _UnnamedText_193f6
	db $50
; 0x193f6 + 5 bytes

UnnamedText_193fb: ; 193fb (6:53fb)
	TX_FAR _UnnamedText_193fb
	db $50
; 0x193fb + 5 bytes

PewterCityText13: ; 19400 (6:5400)

UnnamedText_19400: ; 19400 (6:5400)
	TX_FAR _UnnamedText_19400
	db $50
; 0x19400 + 5 bytes

PewterCityText4: ; 19405 (6:5405)
	db $8
	ld hl, UnnamedText_19427
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	cp $0
	jr nz, .asm_e4603
	ld hl, UnnamedText_1942c
	call PrintText
	jr .asm_e4604 ; 0x1941c $6
.asm_e4603
	ld hl, UnnamedText_19431
	call PrintText
.asm_e4604 ; 0x19424
	jp TextScriptEnd
; 0x19427

UnnamedText_19427: ; 19427 (6:5427)
	TX_FAR _UnnamedText_19427
	db $50
; 0x19427 + 5 bytes

UnnamedText_1942c: ; 1942c (6:542c)
	TX_FAR _UnnamedText_1942c
	db $50
; 0x1942c + 5 bytes

UnnamedText_19431: ; 19431 (6:5431)
	TX_FAR _UnnamedText_19431
	db $50
; 0x19431 + 5 bytes

PewterCityText5: ; 19436 (6:5436)
	db $08 ; asm
	ld hl, UnnamedText_1945d
	call PrintText
	xor a
	ldh [$b4], a
	ld [$cf10], a
	ld a, $3
	ld [$cc57], a
	ldh a, [$b8]
	ld [$cc58], a
	ld a, $5
	ld [$cf13], a
	call Func_32f4
	ld a, $4
	ld [W_PEWTERCITYCURSCRIPT], a
	jp TextScriptEnd

UnnamedText_1945d: ; 1945d (6:545d)
	TX_FAR _UnnamedText_1945d
	db $50
; 0x1945d + 5 bytes

PewterCityText14: ; 19462 (6:5462)

UnnamedText_19462: ; 19462 (6:5462)
	TX_FAR _UnnamedText_19462
	db $50
; 0x19462 + 5 bytes

PewterCityText6: ; 19467 (6:5467)
	TX_FAR _PewterCityText6
	db $50

PewterCityText7: ; 1946c (6:546c)
	TX_FAR _PewterCityText7
	db $50

PewterCityText10: ; 19471 (6:5471)
	TX_FAR _PewterCityText10
	db $50

PewterCityText11: ; 19476 (6:5476)
	TX_FAR _PewterCityText11
	db $50

PewterCityText12: ; 1947b (6:547b)
	TX_FAR _PewterCityText12
	db $50

CeruleanCityScript: ; 19480 (6:5480)
	call EnableAutoTextBoxDrawing
	ld hl, CeruleanCityScripts
	ld a, [W_CERULEANCITYCURSCRIPT]
	jp CallFunctionInTable
; 0x1948c

CeruleanCity_Unknown1948c: ; 1948c (6:548c)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_CERULEANCITYCURSCRIPT], a
	ld a, $5
	ld [$cc4d], a
	ld a, $11
	jp Predef
; 0x1949d

CeruleanCityScripts: ; 1949d (6:549d)
	dw CeruleanCityScript0
	dw CeruleanCityScript1
	dw CeruleanCityScript2
	dw CeruleanCityScript3
	dw CeruleanCityScript4

CeruleanCityScript4: ; 194a7 (6:54a7)
	ld a, [W_ISINBATTLE]
	cp $ff
	jp z, CeruleanCity_Unknown1948c
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d75b
	set 7, [hl]
	ld a, $2
	ld [$ff00+$8c], a
	call DisplayTextID
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_CERULEANCITYCURSCRIPT], a
	ret

CeruleanCityScript0: ; 194c8 (6:54c8)
	ld a, [$d75b]
	bit 7, a
	jr nz, .asm_194f7 ; 0x194cd $28
	ld hl, CeruleanCityCoords1
	call ArePlayerCoordsInArray
	jr nc, .asm_194f7 ; 0x194d5 $20
	ld a, [$cd3d]
	cp $1
	ld a, $8
	ld b, $0
	jr nz, .asm_194e6 ; 0x194e0 $4
	ld a, $4
	ld b, $4
.asm_194e6
	ld [$d528], a
	ld a, b
	ld [$c129], a
	call Delay3
	ld a, $2
	ld [$ff00+$8c], a
	jp DisplayTextID
.asm_194f7
	ld a, [$d75a]
	bit 0, a
	ret nz
	ld hl, CeruleanCityCoords2
	call ArePlayerCoordsInArray
	ret nc
	ld a, [$d700]
	and a
	jr z, .asm_19512 ; 0x19508 $8
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
.asm_19512
	ld c, $2
	ld a, $de
	call PlayMusic
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, [$d362]
	cp $14
	jr z, .asm_19535 ; 0x19526 $d
	ld a, $1
	ld [$ff00+$8c], a
	ld a, $5
	ld [$ff00+$8b], a
	call Func_3500
	ld [hl], $19
.asm_19535
	ld a, $5
	ld [$cc4d], a
	ld a, $15
	call Predef
	ld de, CeruleanCityMovement1
	ld a, $1
	ld [$ff00+$8c], a
	call MoveSprite
	ld a, $1
	ld [W_CERULEANCITYCURSCRIPT], a
	ret
; 0x1954f

CeruleanCityCoords1: ; 1954f (6:554f)
	db $07,$1e
	db $09,$1e
	db $ff

CeruleanCityCoords2: ; 19554 (6:5554)
	db $06,$14
	db $06,$15
	db $ff

CeruleanCityMovement1: ; 19559 (6:5559)
	db 0,0,0,$ff

CeruleanCityFunction1955d: ; 1955d (6:555d)
	ld a,1
	ld [$ff8c],a
	xor a
	ld [$ff8d],a
	jp Func_34a6 ; face object

CeruleanCityScript1: ; 19567 (6:5567)
	ld a, [$d730]
	bit 0, a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $1
	ld [$ff00+$8c], a
	call DisplayTextID
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_1966d
	ld de, UnnamedText_19672
	call PreBattleSaveRegisters
	ld a, $e1
	ld [$d059], a

	; select which team to use during the encounter
	ld a, [W_RIVALSTARTER]
	cp SQUIRTLE
	jr nz, .NotSquirtle ; 0x19592 $4
	ld a, $7
	jr .done
.NotSquirtle
	cp BULBASAUR
	jr nz, .Charmander ; 0x1959a $4
	ld a, $8
	jr .done
.Charmander
	ld a, $9
.done
	ld [W_TRAINERNO], a

	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	call CeruleanCityFunction1955d
	ld a, $2
	ld [W_CERULEANCITYCURSCRIPT], a
	ret
; 0x195b1

CeruleanCityScript2: ; 195b1 (6:55b1)
	ld a, [$d057]
	cp $ff
	jp z, CeruleanCity_Unknown1948c
	call CeruleanCityFunction1955d
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d75a
	set 0, [hl]
	ld a, $1
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld b, BANK(Func_9b47)
	ld hl, Func_9b47
	call Bankswitch
	ld a, $1
	ld [$ff00+$8c], a
	call SetSpriteMovementBytesToFF
	ld a, [$d362]
	cp $14
	jr nz, .asm_195f0 ; 0x195e9 $5
	ld de, CeruleanCityMovement4
	jr .asm_195f3 ; 0x195ee $3
.asm_195f0
	ld de, CeruleanCityMovement3
.asm_195f3
	ld a, $1
	ld [$ff00+$8c], a
	call MoveSprite
	ld a, $3
	ld [W_CERULEANCITYCURSCRIPT], a
	ret

CeruleanCityMovement3: ; 19600 (6:5600)
	db $80, $00, $00, $00, $00, $00, $00, $ff

CeruleanCityMovement4: ; 19608 (6:5608)
	db $c0, $00, $00, $00, $00, $00, $00, $ff

CeruleanCityScript3: ; 19610 (6:5610)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $5
	ld [$cc4d], a
	ld a, $11
	call Predef
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	call Func_2307
	ld a, $0
	ld [W_CERULEANCITYCURSCRIPT], a
	ret
; 0x1962d

CeruleanCityTexts: ; 1962d (6:562d)
	dw CeruleanCityText1, CeruleanCityText2, CeruleanCityText3, CeruleanCityText4, CeruleanCityText5, CeruleanCityText6, CeruleanCityText7, CeruleanCityText8, CeruleanCityText9, CeruleanCityText10, CeruleanCityText11, CeruleanCityText12, CeruleanCityText13, MartSignText, PokeCenterSignText, CeruleanCityText16, CeruleanCityText17

CeruleanCityText1: ; 1964f (6:564f)
	db $08 ; asm
	ld a, [$d75a] ; rival battle flag
	bit 0, a
	; do pre-battle text
	jr z, .PreBattleText
	; or talk about bill
	ld hl, UnnamedText_19677
	call PrintText
	jr .end ; 0x1965d
.PreBattleText ; 0x1965f
	ld hl, UnnamedText_19668
	call PrintText
.end ; 0x19665
	jp TextScriptEnd

UnnamedText_19668: ; 19668 (6:5668)
	TX_FAR _UnnamedText_19668
	db $50
; 0x19668 + 5 bytes

UnnamedText_1966d: ; 1966d (6:566d)
	TX_FAR _UnnamedText_1966d
	db $50
; 0x1966d + 5 bytes

UnnamedText_19672: ; 19672 (6:5672)
	TX_FAR _UnnamedText_19672
	db $50
; 0x19672 + 5 bytes

UnnamedText_19677: ; 19677 (6:5677)
	TX_FAR _UnnamedText_19677
	db $50
; 0x19677 + 5 bytes

CeruleanCityText2: ; 1967c (6:567c)
	db $8
	ld a, [$d75b]
	bit 7, a
	jr nz, .asm_4ca20 ; 0x19682 $29
	ld hl, UnnamedText_196d9
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_196ee
	ld de, UnnamedText_196ee
	call PreBattleSaveRegisters
	ld a, [$ff00+$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $4
	ld [W_CERULEANCITYCURSCRIPT], a
	jp TextScriptEnd
.asm_4ca20 ; 0x196ad
	ld hl, UnnamedText_196f3
	call PrintText
	ld bc, $e401
	call GiveItem
	jr c, .Success
	ld hl, TM28NoRoomText
	call PrintText
	jr .Done
.Success
	ld a, $1
	ld [$cc3c], a
	ld hl, ReceivedTM28Text
	call PrintText
	ld b, BANK(Unnamed_ASM_74872)
	ld hl, Unnamed_ASM_74872
	call Bankswitch
.Done
	jp TextScriptEnd
; 0x196d9

UnnamedText_196d9: ; 196d9 (6:56d9)
	TX_FAR _UnnamedText_196d9
	db $50
; 0x196d9 + 5 bytes

ReceivedTM28Text: ; 196de (6:56de)
	TX_FAR _ReceivedTM28Text ; 0xa4f82
	db $0B
	TX_FAR _ReceivedTM28Text2 ; 0xa4f96
	db $0D, $50
; 0x196e9

TM28NoRoomText: ; 196e9 (6:56e9)
	TX_FAR _TM28NoRoomText
	db $50
; 0x196e9 + 5 bytes

UnnamedText_196ee: ; 196ee (6:56ee)
	TX_FAR _UnnamedText_196ee
	db $50
; 0x196ee + 5 bytes

UnnamedText_196f3: ; 196f3 (6:56f3)
	TX_FAR _UnnamedText_196f3
	db $50
; 0x196f3 + 5 bytes

CeruleanCityText3: ; 196f8 (6:56f8)
	TX_FAR _CeruleanCityText3
	db $50

CeruleanCityText4: ; 196fd (6:56fd)
	TX_FAR _CeruleanCityText4
	db $50

CeruleanCityText5: ; 19702 (6:5702)
	TX_FAR _CeruleanCityText5
	db $50

CeruleanCityText11: ; 19707 (6:5707)
CeruleanCityText6: ; 19707 (6:5707)
	TX_FAR _CeruleanCityText6
	db $50

CeruleanCityText7: ; 1970c (6:570c)
	db $08 ; asm
	ldh a, [$d3]
	cp $b4
	jr c, .asm_e9fc9 ; 0x19711
	ld hl, UnnamedText_19730
	call PrintText
	jr .asm_d486e ; 0x19719
.asm_e9fc9 ; 0x1971b
	cp $64
	jr c, .asm_df99b ; 0x1971d
	ld hl, UnnamedText_19735
	call PrintText
	jr .asm_d486e ; 0x19725
.asm_df99b ; 0x19727
	ld hl, UnnamedText_1973a
	call PrintText
.asm_d486e ; 0x1972d
	jp TextScriptEnd

UnnamedText_19730: ; 19730 (6:5730)
	TX_FAR _UnnamedText_19730
	db $50
; 0x19730 + 5 bytes

UnnamedText_19735: ; 19735 (6:5735)
	TX_FAR _UnnamedText_19735
	db $50
; 0x19735 + 5 bytes

UnnamedText_1973a: ; 1973a (6:573a)
	TX_FAR _UnnamedText_1973a
	db $50
; 0x1973a + 5 bytes

CeruleanCityText8: ; 1973f (6:573f)
	db $08 ; asm
	ldh a, [$d3]
	cp $b4
	jr c, .asm_e28da ; 0x19744
	ld hl, UnnamedText_1976f
	call PrintText
	jr .asm_f2f38 ; 0x1974c
.asm_e28da ; 0x1974e
	cp $78
	jr c, .asm_15d08 ; 0x19750
	ld hl, UnnamedText_19774
	call PrintText
	jr .asm_f2f38 ; 0x19758
.asm_15d08 ; 0x1975a
	cp $3c
	jr c, .asm_d7fea ; 0x1975c
	ld hl, UnnamedText_19779
	call PrintText
	jr .asm_f2f38 ; 0x19764
.asm_d7fea ; 0x19766
	ld hl, UnnamedText_1977e
	call PrintText
.asm_f2f38 ; 0x1976c
	jp TextScriptEnd

UnnamedText_1976f: ; 1976f (6:576f)
	TX_FAR _UnnamedText_1976f
	db $50
; 0x1976f + 5 bytes

UnnamedText_19774: ; 19774 (6:5774)
	TX_FAR _UnnamedText_19774
	db $50
; 0x19774 + 5 bytes

UnnamedText_19779: ; 19779 (6:5779)
	TX_FAR _UnnamedText_19779
	db $50
; 0x19779 + 5 bytes

UnnamedText_1977e: ; 1977e (6:577e)
	TX_FAR _UnnamedText_1977e
	db $50
; 0x1977e + 5 bytes

CeruleanCityText9: ; 19783 (6:5783)
	TX_FAR _CeruleanCityText9
	db $50

CeruleanCityText10: ; 19788 (6:5788)
	TX_FAR _CeruleanCityText10
	db $50

CeruleanCityText12: ; 1978d (6:578d)
	TX_FAR _CeruleanCityText12
	db $50

CeruleanCityText13: ; 19792 (6:5792)
	TX_FAR _CeruleanCityText13
	db $50

CeruleanCityText16: ; 19797 (6:5797)
	TX_FAR _CeruleanCityText16
	db $50

CeruleanCityText17: ; 1979c (6:579c)
	TX_FAR _CeruleanCityText17
	db $50

VermilionCityScript: ; 197a1 (6:57a1)
	call EnableAutoTextBoxDrawing
	ld hl, $d126
	bit 6, [hl]
	res 6, [hl]
	push hl
	call nz, Function197cb
	pop hl
	bit 5, [hl]
	res 5, [hl]
	call nz, VermilionCityScript_Unknown197c0
	ld hl, VermilionCityScripts
	ld a, [W_VERMILIONCITYCURSCRIPT]
	jp CallFunctionInTable
; 0x197c0

VermilionCityScript_Unknown197c0: ; 197c0 (6:57c0)
	call GenRandom
	ld a, [$ff00+$d4]
	and $e
	ld [$d743], a
	ret

Function197cb: ; 197cb (6:57cb)
	ld hl, $d803
	bit 2, [hl]
	ret z
	bit 3, [hl]
	set 3, [hl]
	ret nz
	ld a, $2
	ld [W_VERMILIONCITYCURSCRIPT], a
	ret

VermilionCityScripts: ; 197dc (6:57dc)
	dw VermilionCityScript0
	dw VermilionCityScript1
	dw VermilionCityScript2
	dw VermilionCityScript3
	dw VermilionCityScript4

VermilionCityScript0: ; 197e6 (6:57e6)
	ld a, [$c109]
	and a
	ret nz
	ld hl, Coords19823
	call ArePlayerCoordsInArray
	ret nc
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [$cf0d], a
	ld a, $3
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, [$d803]
	bit 2, a
	jr nz, .asm_19810 ; 0x19804 $a
	ld b, $3f
	ld a, $1c
	call Predef
	ld a, b
	and a
	ret nz
.asm_19810
	ld a, $40
	ld [$ccd3], a
	ld a, $1
	ld [$cd38], a
	call Func_3486
	ld a, $1
	ld [W_VERMILIONCITYCURSCRIPT], a
	ret

Coords19823: ; 19823 (6:5823)
	db $1e,$12
	db $ff

VermilionCityScript4: ; 19826 (6:5826)
	ld hl, Coords19823
	call ArePlayerCoordsInArray
	ret c
	ld a, $0
	ld [W_VERMILIONCITYCURSCRIPT], a
	ret

VermilionCityScript2: ; 19833 (6:5833)
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $40
	ld [$ccd3], a
	ld [$ccd4], a
	ld a, $2
	ld [$cd38], a
	call Func_3486
	ld a, $3
	ld [W_VERMILIONCITYCURSCRIPT], a
	ret

VermilionCityScript3: ; 1984e (6:584e)
	ld a, [$cd38]
	and a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $0
	ld [W_VERMILIONCITYCURSCRIPT], a
	ret

VermilionCityScript1: ; 1985f (6:585f)
	ld a, [$cd38]
	and a
	ret nz
	ld c, $a
	call DelayFrames
	ld a, $0
	ld [W_VERMILIONCITYCURSCRIPT], a
	ret
; 0x1986f

VermilionCityTexts: ; 1986f (6:586f)
	dw VermilionCityText1, VermilionCityText2, VermilionCityText3, VermilionCityText4, VermilionCityText5, VermilionCityText6, VermilionCityText7, VermilionCityText8, MartSignText, PokeCenterSignText, VermilionCityText11, VermilionCityText12, VermilionCityText13

VermilionCityText1: ; 19889 (6:5889)
	TX_FAR _VermilionCityText1
	db $50

VermilionCityText2: ; 1988e (6:588e)
	db $08 ; asm
	ld a, [$d803]
	bit 2, a
	jr nz, .asm_359bd ; 0x19894
	ld hl, UnnamedText_198a7
	call PrintText
	jr .asm_735d9 ; 0x1989c
.asm_359bd ; 0x1989e
	ld hl, UnnamedText_198ac
	call PrintText
.asm_735d9 ; 0x198a4
	jp TextScriptEnd

UnnamedText_198a7: ; 198a7 (6:58a7)
	TX_FAR _UnnamedText_198a7
	db $50
; 0x198a7 + 5 bytes

UnnamedText_198ac: ; 198ac (6:58ac)
	TX_FAR _UnnamedText_198ac
	db $50
; 0x198ac + 5 bytes

VermilionCityText3: ; 198b1 (6:58b1)
	db $08 ; asm
	ld a, [$d803]
	bit 2, a
	jr nz, .asm_3e0e9 ; 0x198b7
	ld a, [$c109]
	cp $c
	jr z, .asm_07af3 ; 0x198be
	ld hl, VermilionCityCoords1
	call ArePlayerCoordsInArray
	jr nc, .asm_57b73 ; 0x198c6
.asm_07af3 ; 0x198c8
	ld hl, SSAnneWelcomeText4
	call PrintText
	jr .asm_79bd1 ; 0x198ce
.asm_57b73 ; 0x198d0
	ld hl, SSAnneWelcomeText9
	call PrintText
	ld b, $3f
	ld a, $1c
	call Predef
	ld a, b
	and a
	jr nz, .asm_0419b ; 0x198df
	ld hl, SSAnneNoTicketText
	call PrintText
	jr .asm_79bd1 ; 0x198e7
.asm_0419b ; 0x198e9
	ld hl, SSAnneFlashedTicketText
	call PrintText
	ld a, $4
	ld [W_VERMILIONCITYCURSCRIPT], a
	jr .asm_79bd1 ; 0x198f4
.asm_3e0e9 ; 0x198f6
	ld hl, SSAnneNotHereText
	call PrintText
.asm_79bd1 ; 0x198fc
	jp TextScriptEnd

VermilionCityCoords1: ; 198ff (6:58ff)
	db $1d,$13
	db $1f,$13
	db $ff

SSAnneWelcomeText4: ; 19904 (6:5904)
	TX_FAR _SSAnneWelcomeText4
	db $50
; 0x19904 + 5 bytes

SSAnneWelcomeText9: ; 19909 (6:5909)
	TX_FAR _SSAnneWelcomeText9
	db $50
; 0x19909 + 5 bytes

SSAnneFlashedTicketText: ; 1990e (6:590e)
	TX_FAR _SSAnneFlashedTicketText
	db $50
; 0x1990e + 5 bytes

SSAnneNoTicketText: ; 19913 (6:5913)
	TX_FAR _SSAnneNoTicketText
	db $50
; 0x19913 + 5 bytes

SSAnneNotHereText: ; 19918 (6:5918)
	TX_FAR _SSAnneNotHereText
	db $50
; 0x19918 + 5 bytes

VermilionCityText4: ; 1991d (6:591d)
	TX_FAR _VermilionCityText4
	db $50

VermilionCityText5: ; 19922 (6:5922)
	TX_FAR _VermilionCityText5
	db $08 ; asm
	ld a, MACHOP
	call PlayCry
	call WaitForSoundToFinish
	ld hl, VermilionCityText14 ; $5933
	ret

VermilionCityText14: ; 19933 (6:5933)
	TX_FAR _VermilionCityText14
	db $50

VermilionCityText6: ; 19938 (6:5938)
	TX_FAR _VermilionCityText6
	db $50

VermilionCityText7: ; 1993d (6:593d)
	TX_FAR _VermilionCityText7
	db $50

VermilionCityText8: ; 19942 (6:5942)
	TX_FAR _VermilionCityText8
	db $50

VermilionCityText11: ; 19947 (6:5947)
	TX_FAR _VermilionCityText11
	db $50

VermilionCityText12: ; 1994c (6:594c)
	TX_FAR _VermilionCityText12
	db $50

VermilionCityText13: ; 19951 (6:5951)
	TX_FAR _VermilionCityText13
	db $50

CeladonCityScript: ; 19956 (6:5956)
	call EnableAutoTextBoxDrawing
	ld hl, $d77e
	res 0, [hl]
	res 7, [hl]
	ld hl, $d816
	res 7, [hl]
	ret
; 0x19966

CeladonCityTexts: ; 19966 (6:5966)
	dw CeladonCityText1, CeladonCityText2, CeladonCityText3, CeladonCityText4, CeladonCityText5, CeladonCityText6, CeladonCityText7, CeladonCityText8, CeladonCityText9, CeladonCityText10, CeladonCityText11, PokeCenterSignText, CeladonCityText13, CeladonCityText14, CeladonCityText15, CeladonCityText16, CeladonCityText17, CeladonCityText18

CeladonCityText1: ; 1998a (6:598a)
	TX_FAR _CeladonCityText1
	db $50

CeladonCityText2: ; 1998f (6:598f)
	TX_FAR _CeladonCityText2
	db $50

CeladonCityText3: ; 19994 (6:5994)
	TX_FAR _CeladonCityText3
	db $50

CeladonCityText4: ; 19999 (6:5999)
	TX_FAR _CeladonCityText4
	db $50

CeladonCityText5: ; 1999e (6:599e)
	db $08 ; asm
	ld a, [$d777]
	bit 0, a
	jr nz, .asm_7053f ; 0x199a4
	ld hl, TM41PreText
	call PrintText
	ld bc, (TM_41 << 8) | 1
	call GiveItem
	jr c, .Success
	ld hl, TM41NoRoomText
	call PrintText
	jr .Done
.Success
	ld hl, ReceivedTM41Text
	call PrintText
	ld hl, $d777
	set 0, [hl]
	jr .Done
.asm_7053f ; 0x199c9
	ld hl, TM41ExplanationText
	call PrintText
.Done
	jp TextScriptEnd

TM41PreText: ; 199d2 (6:59d2)
	TX_FAR _TM41PreText
	db $50
; 0x199d2 + 5 bytes

ReceivedTM41Text: ; 199d7 (6:59d7)
	TX_FAR _ReceivedTM41Text ; 0xa5b5a
	db $0B, $50
; 0x199d7 + 6 bytes = 0x199dd

TM41ExplanationText: ; 199dd (6:59dd)
	TX_FAR _TM41ExplanationText
	db $50
; 0x199dd + 5 bytes

TM41NoRoomText: ; 199e2 (6:59e2)
	TX_FAR _TM41NoRoomText
	db $50
; 0x199e2 + 5 bytes

CeladonCityText6: ; 199e7 (6:59e7)
	TX_FAR _CeladonCityText6
	db $50

CeladonCityText7: ; 199ec (6:59ec)
	TX_FAR _CeladonCityText7
	db $08 ; asm
	ld a, POLIWRATH
	call PlayCry
	jp TextScriptEnd

CeladonCityText8: ; 199f9 (6:59f9)
	TX_FAR _CeladonCityText8
	db $50

CeladonCityText9: ; 199fe (6:59fe)
	TX_FAR _CeladonCityText9
	db $50

CeladonCityText10: ; 19a03 (6:5a03)
	TX_FAR _CeladonCityText10
	db $50

CeladonCityText11: ; 19a08 (6:5a08)
	TX_FAR _CeladonCityText11
	db $50

CeladonCityText13: ; 19a0d (6:5a0d)
	TX_FAR _CeladonCityText13
	db $50

CeladonCityText14: ; 19a12 (6:5a12)
	TX_FAR _CeladonCityText14
	db $50

CeladonCityText15: ; 19a17 (6:5a17)
	TX_FAR _CeladonCityText15
	db $50

CeladonCityText16: ; 19a1c (6:5a1c)
	TX_FAR _CeladonCityText16
	db $50

CeladonCityText17: ; 19a21 (6:5a21)
	TX_FAR _CeladonCityText17
	db $50

CeladonCityText18: ; 19a26 (6:5a26)
	TX_FAR _CeladonCityText18
	db $50

FuchsiaCityScript: ; 19a2b (6:5a2b)
	jp EnableAutoTextBoxDrawing
; 0x19a2e

FuchsiaCityTexts: ; 19a2e (6:5a2e)
	dw FuchsiaCityText1, FuchsiaCityText2, FuchsiaCityText3, FuchsiaCityText4, FuchsiaCityText5, FuchsiaCityText6, FuchsiaCityText7, FuchsiaCityText8, FuchsiaCityText9, FuchsiaCityText10, FuchsiaCityText11, FuchsiaCityText12, FuchsiaCityText13, MartSignText, PokeCenterSignText, FuchsiaCityText16, FuchsiaCityText17, FuchsiaCityText18, FuchsiaCityText19, FuchsiaCityText20, FuchsiaCityText21, FuchsiaCityText22, FuchsiaCityText23, FuchsiaCityText24

FuchsiaCityText1: ; 19a5e (6:5a5e)
	TX_FAR _FuchsiaCityText1
	db $50

FuchsiaCityText2: ; 19a63 (6:5a63)
	TX_FAR _FuchsiaCityText2
	db $50

FuchsiaCityText3: ; 19a68 (6:5a68)
	TX_FAR _FuchsiaCityText3
	db $50

FuchsiaCityText4: ; 19a6d (6:5a6d)
	TX_FAR _FuchsiaCityText4
	db $50

FuchsiaCityText5: ; 19a72 (6:5a72)
FuchsiaCityText6: ; 19a72 (6:5a72)
FuchsiaCityText7: ; 19a72 (6:5a72)
FuchsiaCityText8: ; 19a72 (6:5a72)
FuchsiaCityText9: ; 19a72 (6:5a72)
FuchsiaCityText10: ; 19a72 (6:5a72)
	TX_FAR _FuchsiaCityText5
	db $50

FuchsiaCityText12: ; 19a77 (6:5a77)
FuchsiaCityText11: ; 19a77 (6:5a77)
	TX_FAR _FuchsiaCityText11
	db $50

FuchsiaCityText13: ; 19a7c (6:5a7c)
	TX_FAR _FuchsiaCityText13
	db $50

FuchsiaCityText16: ; 19a81 (6:5a81)
	TX_FAR _FuchsiaCityText16
	db $50

FuchsiaCityText17: ; 19a86 (6:5a86)
	TX_FAR _FuchsiaCityText17
	db $50

FuchsiaCityText18: ; 19a8b (6:5a8b)
	TX_FAR _FuchsiaCityText18
	db $50

FuchsiaCityText19: ; 19a90 (6:5a90)
	db $08 ; asm
	ld hl, FuchsiaCityChanseyText
	call PrintText
	ld a, CHANSEY
	call DisplayPokedex
	jp TextScriptEnd

FuchsiaCityChanseyText: ; 19a9f (6:5a9f)
	TX_FAR _FuchsiaCityChanseyText
	db $50
; 0x19a9f + 5 bytes

FuchsiaCityText20: ; 19aa4 (6:5aa4)
	db $08 ; asm
	ld hl, FuchsiaCityVoltorbText
	call PrintText
	ld a, VOLTORB
	call DisplayPokedex
	jp TextScriptEnd

FuchsiaCityVoltorbText: ; 19ab3 (6:5ab3)
	TX_FAR _FuchsiaCityVoltorbText
	db $50
; 0x19ab3 + 5 bytes

FuchsiaCityText21: ; 19ab8 (6:5ab8)
	db $08 ; asm
	ld hl, FuchsiaCityKangaskhanText
	call PrintText
	ld a, KANGASKHAN
	call DisplayPokedex
	jp TextScriptEnd

FuchsiaCityKangaskhanText: ; 19ac7 (6:5ac7)
	TX_FAR _FuchsiaCityKangaskhanText
	db $50
; 0x19ac7 + 5 bytes

FuchsiaCityText22: ; 19acc (6:5acc)
	db $08 ; asm
	ld hl, FuchsiaCitySlowpokeText
	call PrintText
	ld a, SLOWPOKE
	call DisplayPokedex
	jp TextScriptEnd

FuchsiaCitySlowpokeText: ; 19adb (6:5adb)
	TX_FAR _FuchsiaCitySlowpokeText
	db $50
; 0x19adb + 5 bytes

FuchsiaCityText23: ; 19ae0 (6:5ae0)
	db $08 ; asm
	ld hl, FuchsiaCityLaprasText
	call PrintText
	ld a, LAPRAS
	call DisplayPokedex
	jp TextScriptEnd

FuchsiaCityLaprasText: ; 19aef (6:5aef)
	TX_FAR _FuchsiaCityLaprasText
	db $50
; 0x19aef + 5 bytes

FuchsiaCityText24: ; 19af4 (6:5af4)
	db $08 ; asm
	ld a, [$d7f6]
	bit 6, a
	jr nz, .asm_3b4e8 ; 0x19afa
	bit 7, a
	jr nz, .asm_667d5 ; 0x19afe
	ld hl, UnnamedText_19b2a
	call PrintText
	jr .asm_4343f ; 0x19b06
.asm_3b4e8 ; 0x19b08
	ld hl, FuchsiaCityOmanyteText
	call PrintText
	ld a, $62
	jr .asm_81556 ; 0x19b10
.asm_667d5 ; 0x19b12
	ld hl, FuchsiaCityKabutoText
	call PrintText
	ld a, KABUTO
.asm_81556 ; 0x19b1a
	call DisplayPokedex
.asm_4343f ; 0x19b1d
	jp TextScriptEnd

FuchsiaCityOmanyteText: ; 19b20 (6:5b20)
	TX_FAR _FuchsiaCityOmanyteText
	db $50
; 0x19b20 + 5 bytes

FuchsiaCityKabutoText: ; 19b25 (6:5b25)
	TX_FAR _FuchsiaCityKabutoText
	db $50
; 0x19b25 + 5 bytes

UnnamedText_19b2a: ; 19b2a (6:5b2a)
	TX_FAR _UnnamedText_19b2a
	db $50
; 0x19b2a + 5 bytes

BluesHouse_h: ; 0x19b2f id=39
	db $08 ; tileset
	db BLUES_HOUSE_HEIGHT, BLUES_HOUSE_WIDTH ; dimensions
	dw BluesHouseBlocks, BluesHouseTexts, BluesHouseScript
	db 0
	dw BluesHouseObject

BluesHouseScript: ; 19b3b (6:5b3b)
	call EnableAutoTextBoxDrawing
	ld hl,BluesHouseScriptPointers
	ld a,[W_BLUESHOUSECURSCRIPT]
	jp CallFunctionInTable

BluesHouseScriptPointers: ; 19b47 (6:5b47)
	dw BluesHouseScript1,BluesHouseScript2

BluesHouseScript1: ; 19b4b (6:5b4b)
	ld hl,$D74A
	set 1,[hl]

	; trigger the next script
	ld a,1
	ld [W_BLUESHOUSECURSCRIPT],a
	ret

BluesHouseScript2: ; 19b56 (6:5b56)
	ret

BluesHouseTexts: ; 19b57 (6:5b57)
	dw BluesHouseText1,BluesHouseText2,BluesHouseText3

BluesHouseText1: ; 19b5d (6:5b5d)
	db 8
	ld a,[$D74A]
	bit 0,a
	jr nz,.GotMap
	ld a,[$D74B]
	bit 5,a
	jr nz,.GiveMap
	ld hl,DaisyInitialText
	call PrintText
	jr .done
.GiveMap
	ld hl,DaisyOfferMapText
	call PrintText
	ld bc,(TOWN_MAP << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a,$29
	ld [$CC4D],a
	ld a,$11
	call Predef ; hide table map object
	ld hl,GotMapText
	call PrintText
	ld hl,$D74A
	set 0,[hl]
	jr .done
.GotMap
	ld hl,DaisyUseMapText
	call PrintText
	jr .done
.BagFull
	ld hl,DaisyBagFullText
	call PrintText
.done
	jp TextScriptEnd

DaisyInitialText: ; 19baa (6:5baa)
	TX_FAR _DaisyInitialText
	db "@"

DaisyOfferMapText: ; 19baf (6:5baf)
	TX_FAR _DaisyOfferMapText
	db "@"

GotMapText: ; 19bb4 (6:5bb4)
	TX_FAR _GotMapText
	db $11,"@"

DaisyBagFullText: ; 19bba (6:5bba)
	TX_FAR _DaisyBagFullText
	db "@"

DaisyUseMapText: ; 19bbf (6:5bbf)
	TX_FAR _DaisyUseMapText
	db "@"

BluesHouseText2: ; 0x19bc4 Daisy, walking around
	TX_FAR _BluesHouseText2
	db "@"

BluesHouseText3: ; 0x19bc9 map on table
	TX_FAR _BluesHouseText3
	db "@"

BluesHouseObject: ; 19bce (6:5bce)
	db $0A ; border tile

	db 2 ; warps
	db 7,2,1,$FF
	db 7,3,1,$FF

	db 0 ; signs

	db 3 ; people
	db $11,4+3,4+2,$FF,$D3,1 ; Daisy, sitting by map
	db $11,4+4,4+6,$FE,1,ITEM|2,0 ; map on table
	db $41,4+3,4+3,$FF,$FF,ITEM|3,0 ; Daisy, walking around

	; warp-to
	dw $C712
	db 7,2

	dw $C712
	db 7,3

BluesHouseBlocks: ; 19bf6 (6:5bf6)
	INCBIN "maps/blueshouse.blk"

VermilionHouse3_h: ; 0x19c06 to 0x19c12 (12 bytes) (bank=6) (id=196)
	db $08 ; tileset
	db VERMILION_HOUSE_3_HEIGHT, VERMILION_HOUSE_3_WIDTH ; dimensions (y, x)
	dw VermilionHouse3Blocks, VermilionHouse3Texts, VermilionHouse3Script ; blocks, texts, scripts
	db $00 ; connections

	dw VermilionHouse3Object ; objects

VermilionHouse3Script: ; 19c12 (6:5c12)
	jp EnableAutoTextBoxDrawing
; 0x19c15

VermilionHouse3Texts: ; 19c15 (6:5c15)
	dw VermilionHouse3Text1

VermilionHouse3Text1: ; 19c17 (6:5c17)
	db $08 ; asm
	ld a, $4
	ld [W_WHICHTRADE], a
	ld a, $54
	call Predef
	jp TextScriptEnd

VermilionHouse3Object: ; 0x19c25 (size=26)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $7, $ff
	db $7, $3, $7, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_LITTLE_GIRL, $5 + 4, $3 + 4, $ff, $d1, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

VermilionHouse3Blocks: ; 19c3f (6:5c3f)
	INCBIN "maps/vermilionhouse3.blk"

IndigoPlateauLobby_h: ; 0x19c4f to 0x19c5b (12 bytes) (bank=6) (id=174)
	db $02 ; tileset
	db INDIGO_PLATEAU_LOBBY_HEIGHT, INDIGO_PLATEAU_LOBBY_WIDTH ; dimensions (y, x)
	dw IndigoPlateauLobbyBlocks, IndigoPlateauLobbyTexts, IndigoPlateauLobbyScript ; blocks, texts, scripts
	db $00 ; connections

	dw IndigoPlateauLobbyObject ; objects

IndigoPlateauLobbyScript: ; 19c5b (6:5c5b)
	call Func_22fa
	call EnableAutoTextBoxDrawing
	ld hl, $d126
	bit 6, [hl]
	res 6, [hl]
	ret z
	ld hl, $d869
	res 7, [hl]
	ld hl, $d734
	bit 1, [hl]
	res 1, [hl]
	ret z
	ld hl, $d863
	xor a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ret
; 0x19c7f

IndigoPlateauLobbyTexts: ; 19c7f (6:5c7f)
	dw IndigoPlateauLobbyText1, IndigoPlateauLobbyText2, IndigoPlateauLobbyText3, IndigoPlateauLobbyText4, IndigoPlateauLobbyText5

IndigoPlateauLobbyText1: ; 19c89 (6:5c89)
	db $ff

IndigoPlateauLobbyText2: ; 19c8a (6:5c8a)
	TX_FAR _IndigoPlateauLobbyText1
	db $50

IndigoPlateauLobbyText3: ; 19c8f (6:5c8f)
	TX_FAR _IndigoPlateauLobbyText3
	db $50

IndigoPlateauLobbyText5: ; 19c94 (6:5c94)
	db $f6

IndigoPlateauLobbyObject: ; 0x19c95 (size=58)
	db $0 ; border tile

	db $3 ; warps
	db $b, $7, $0, $ff
	db $b, $8, $1, $ff
	db $0, $8, $0, LORELEIS_ROOM

	db $0 ; signs

	db $5 ; people
	db SPRITE_NURSE, $5 + 4, $7 + 4, $ff, $d0, $1 ; person
	db SPRITE_GYM_HELPER, $9 + 4, $4 + 4, $ff, $d3, $2 ; person
	db SPRITE_LASS, $1 + 4, $5 + 4, $ff, $d0, $3 ; person
	db SPRITE_MART_GUY, $5 + 4, $0 + 4, $ff, $d3, $4 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $6 + 4, $d + 4, $ff, $d0, $5 ; person

	; warp-to
	EVENT_DISP $8, $b, $7
	EVENT_DISP $8, $b, $8
	EVENT_DISP $8, $0, $8 ; LORELEIS_ROOM

IndigoPlateauLobbyBlocks: ; 19ccf (6:5ccf)
	INCBIN "maps/indigoplateaulobby.blk"

SilphCo4_h: ; 0x19cff to 0x19d0b (12 bytes) (bank=6) (id=209)
	db $16 ; tileset
	db SILPH_CO_4F_HEIGHT, SILPH_CO_4F_WIDTH ; dimensions (y, x)
	dw SilphCo4Blocks, SilphCo4Texts, SilphCo4Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo4Object ; objects

SilphCo4Script: ; 19d0b (6:5d0b)
	call SilphCo4Script_Unknown19d21
	call EnableAutoTextBoxDrawing
	ld hl, SilphCo4TrainerHeaders
	ld de, SilphCo4ScriptPointers
	ld a, [W_SILPHCO4CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SILPHCO4CURSCRIPT], a
	ret
; 0x19d21

SilphCo4Script_Unknown19d21: ; 19d21 (6:5d21)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, SilphCo4Data19d58
	call SilphCo4Function19d5d
	call SilphCo4Function19d89
	ld a, [$d82a]
	bit 0, a
	jr nz, .asm_19d48
	push af
	ld a, $54
	ld [$d09f], a
	ld bc, $0602
	ld a, $17
	call Predef
	pop af
.asm_19d48
	bit 1, a
	ret nz
	ld a, $54
	ld [$d09f], a
	ld bc, $0406
	ld a, $17
	jp Predef

SilphCo4Data19d58: ; 19d58 (6:5d58)
	db $06, $02, $04, $06, $ff

SilphCo4Function19d5d: ; 19d5d (6:5d5d)
	push hl
	ld hl, $d73f
	ld a, [hli]
	ld b, a
	ld a, [hl]
	ld c, a
	xor a
	ld [$ff00+$e0], a
	pop hl
.asm_19d69
	ld a, [hli]
	cp $ff
	jr z, .asm_19d85 ; 0x19d6c $17
	push hl
	ld hl, $ffe0
	inc [hl]
	pop hl
	cp b
	jr z, .asm_19d7a ; 0x19d75 $3
	inc hl
	jr .asm_19d69 ; 0x19d78 $ef
.asm_19d7a
	ld a, [hli]
	cp c
	jr nz, .asm_19d69 ; 0x19d7c $eb
	ld hl, $d73f
	xor a
	ld [hli], a
	ld [hl], a
	ret
.asm_19d85
	xor a
	ld [$ff00+$e0], a
	ret

SilphCo4Function19d89: ; 19d89 (6:5d89)
	ld hl, $d82a
	ld a, [$ff00+$e0]
	and a
	ret z
	cp $1
	jr nz, .asm_19d97 ; 0x19d92 $3
	set 0, [hl]
	ret
.asm_19d97
	set 1, [hl]
	ret

SilphCo4ScriptPointers: ; 19d9a (6:5d9a)
	dw CheckFightingMapTrainers
	dw Func_324c
	dw EndTrainerBattle

SilphCo4Texts: ; 19da0 (6:5da0)
	dw SilphCo4Text1, SilphCo4Text2, SilphCo4Text3, SilphCo4Text4, Predef5CText, Predef5CText, Predef5CText

SilphCo4TrainerHeaders: ; 19dae (6:5dae)
SilphCo4TrainerHeader0: ; 19dae (6:5dae)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d829 ; flag's byte
	dw SilphCo4BattleText2 ; 0x5df4 TextBeforeBattle
	dw SilphCo4AfterBattleText2 ; 0x5dfe TextAfterBattle
	dw SilphCo4EndBattleText2 ; 0x5df9 TextEndBattle
	dw SilphCo4EndBattleText2 ; 0x5df9 TextEndBattle
; 0x19dba

SilphCo4TrainerHeader2: ; 19dba (6:5dba)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d829 ; flag's byte
	dw SilphCo4BattleText3 ; 0x5e0d TextBeforeBattle
	dw SilphCo4AfterBattleText3 ; 0x5e17 TextAfterBattle
	dw SilphCo4EndBattleText3 ; 0x5e12 TextEndBattle
	dw SilphCo4EndBattleText3 ; 0x5e12 TextEndBattle
; 0x19dc4

SilphCo4TrainerHeader3: ; 19dc6 (6:5dc6)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d829 ; flag's byte
	dw SilphCo4BattleText4 ; 0x5e26 TextBeforeBattle
	dw SilphCo4AfterBattleText4 ; 0x5e30 TextAfterBattle
	dw SilphCo4EndBattleText4 ; 0x5e2b TextEndBattle
	dw SilphCo4EndBattleText4 ; 0x5e2b TextEndBattle
; 0x19dd2

db $ff

SilphCo4Text1: ; 19dd3 (6:5dd3)
	db $08 ; asm
	ld hl, UnnamedText_19de0 ; $5de0
	ld de, UnnamedText_19de5 ; $5de5
	call Unnamed_622f
	jp TextScriptEnd

UnnamedText_19de0: ; 19de0 (6:5de0)
	TX_FAR _UnnamedText_19de0
	db $50
; 0x19de0 + 5 bytes

UnnamedText_19de5: ; 19de5 (6:5de5)
	TX_FAR _UnnamedText_19de5
	db $50
; 0x19de5 + 5 bytes

SilphCo4Text2: ; 19dea (6:5dea)
	db $08 ; asm
	ld hl, SilphCo4TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SilphCo4BattleText2: ; 19df4 (6:5df4)
	TX_FAR _SilphCo4BattleText2
	db $50
; 0x19df4 + 5 bytes

SilphCo4EndBattleText2: ; 19df9 (6:5df9)
	TX_FAR _SilphCo4EndBattleText2
	db $50
; 0x19df9 + 5 bytes

SilphCo4AfterBattleText2: ; 19dfe (6:5dfe)
	TX_FAR _SilphCo4AfterBattleText2
	db $50
; 0x19dfe + 5 bytes

SilphCo4Text3: ; 19e03 (6:5e03)
	db $08 ; asm
	ld hl, SilphCo4TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SilphCo4BattleText3: ; 19e0d (6:5e0d)
	TX_FAR _SilphCo4BattleText3
	db $50
; 0x19e0d + 5 bytes

SilphCo4EndBattleText3: ; 19e12 (6:5e12)
	TX_FAR _SilphCo4EndBattleText3
	db $50
; 0x19e12 + 5 bytes

SilphCo4AfterBattleText3: ; 19e17 (6:5e17)
	TX_FAR _SilphCo4AfterBattleText3
	db $50
; 0x19e17 + 5 bytes

SilphCo4Text4: ; 19e1c (6:5e1c)
	db $08 ; asm
	ld hl, SilphCo4TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

SilphCo4BattleText4: ; 19e26 (6:5e26)
	TX_FAR _SilphCo4BattleText4
	db $50
; 0x19e26 + 5 bytes

SilphCo4EndBattleText4: ; 19e2b (6:5e2b)
	TX_FAR _SilphCo4EndBattleText4
	db $50
; 0x19e2b + 5 bytes

SilphCo4AfterBattleText4: ; 19e30 (6:5e30)
	TX_FAR _SilphCo4AfterBattleText4
	db $50
; 0x19e30 + 5 bytes

SilphCo4Object: ; 0x19e35 (size=111)
	db $2e ; border tile

	db $7 ; warps
	db $0, $18, $1, SILPH_CO_3F
	db $0, $1a, $1, SILPH_CO_5F
	db $0, $14, $0, SILPH_CO_ELEVATOR
	db $7, $b, $3, SILPH_CO_10F
	db $3, $11, $3, SILPH_CO_6F
	db $f, $3, $4, SILPH_CO_10F
	db $b, $11, $5, SILPH_CO_10F

	db $0 ; signs

	db $7 ; people
	db SPRITE_LAPRAS_GIVER, $2 + 4, $6 + 4, $ff, $ff, $1 ; person
	db SPRITE_ROCKET, $e + 4, $9 + 4, $ff, $d3, $42, ROCKET + $C8, $1a ; trainer
	db SPRITE_OAK_AIDE, $6 + 4, $e + 4, $ff, $d2, $43, SCIENTIST + $C8, $5 ; trainer
	db SPRITE_ROCKET, $a + 4, $1a + 4, $ff, $d1, $44, ROCKET + $C8, $1b ; trainer
	db SPRITE_BALL, $9 + 4, $3 + 4, $ff, $ff, $85, FULL_HEAL ; item
	db SPRITE_BALL, $7 + 4, $4 + 4, $ff, $ff, $86, MAX_REVIVE ; item
	db SPRITE_BALL, $8 + 4, $5 + 4, $ff, $ff, $87, ESCAPE_ROPE ; item

	; warp-to
	EVENT_DISP $f, $0, $18 ; SILPH_CO_3F
	EVENT_DISP $f, $0, $1a ; SILPH_CO_5F
	EVENT_DISP $f, $0, $14 ; SILPH_CO_ELEVATOR
	EVENT_DISP $f, $7, $b ; SILPH_CO_10F
	EVENT_DISP $f, $3, $11 ; SILPH_CO_6F
	EVENT_DISP $f, $f, $3 ; SILPH_CO_10F
	EVENT_DISP $f, $b, $11 ; SILPH_CO_10F

SilphCo4Blocks: ; 19ea4 (6:5ea4)
	INCBIN "maps/silphco4.blk"

SilphCo5_h: ; 0x19f2b to 0x19f37 (12 bytes) (bank=6) (id=210)
	db $16 ; tileset
	db SILPH_CO_5F_HEIGHT, SILPH_CO_5F_WIDTH ; dimensions (y, x)
	dw SilphCo5Blocks, SilphCo5Texts, SilphCo5Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo5Object ; objects

SilphCo5Script: ; 19f37 (6:5f37)
	call Unnamed_19f4d
	call EnableAutoTextBoxDrawing
	ld hl, SilphCo5TrainerHeaders
	ld de, SilphCo5ScriptPointers
	ld a, [W_SILPHCO5CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SILPHCO5CURSCRIPT], a
	ret
; 0x19f4d

Unnamed_19f4d: ; 19f4d (6:5f4d)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, SilphCo5Coords
	call SilphCo4Function19d5d
	call SilphCo5Function19f9e
	ld a, [$d82c]
	bit 0, a
	jr nz, .asm_19f74 ; 0x19f63 $f
	push af
	ld a, $5f
	ld [$d09f], a
	ld bc, $0203
	ld a, $17
	call Predef
	pop af
.asm_19f74
	bit 1, a
	jr nz, .asm_19f87 ; 0x19f76 $f
	push af
	ld a, $5f
	ld [$d09f], a
	ld bc, $0603
	ld a, $17
	call Predef
	pop af
.asm_19f87
	bit 2, a
	ret nz
	ld a, $5f
	ld [$d09f], a
	ld bc, $0507
	ld a, $17
	jp Predef
; 0x19f97

SilphCo5Coords: ; 19f97 (6:5f97) ; coords?
	db $02, $03, $06, $03, $05, $07, $ff

SilphCo5Function19f9e: ; 19f9e (6:5f9e)
	ld hl, $d82c
	ld a, [$ff00+$e0]
	and a
	ret z
	cp $1
	jr nz, .asm_19fac ; 0x19fa7 $3
	set 0, [hl]
	ret
.asm_19fac
	cp $2
	jr nz, .asm_19fb3 ; 0x19fae $3
	set 1, [hl]
	ret
.asm_19fb3
	set 2, [hl]
	ret

SilphCo5ScriptPointers: ; 19fb6 (6:5fb6)
	dw CheckFightingMapTrainers
	dw Func_324c
	dw EndTrainerBattle

SilphCo5Texts: ; 19fbc (6:5fbc)
	dw SilphCo5Text1, SilphCo5Text2, SilphCo5Text3, SilphCo5Text4, SilphCo5Text5, Predef5CText, Predef5CText, Predef5CText, SilphCo5Text9, SilphCo5Text10, SilphCo5Text11

SilphCo5TrainerHeaders: ; 19fd2 (6:5fd2)
Silphco5TrainerHeader0: ; 19fd2 (6:5fd2)
	db $2 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d82b ; flag's byte
	dw SilphCo5BattleText2 ; 0x6024 TextBeforeBattle
	dw SilphCo5AfterBattleText2 ; 0x602e TextAfterBattle
	dw SilphCo5EndBattleText2 ; 0x6029 TextEndBattle
	dw SilphCo5EndBattleText2 ; 0x6029 TextEndBattle
; 0x19fde

Silphco5TrainerHeader2: ; 19fde (6:5fde)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d82b ; flag's byte
	dw SilphCo5BattleText3 ; 0x603d TextBeforeBattle
	dw SilphCo5AfterBattleText3 ; 0x6047 TextAfterBattle
	dw SilphCo5EndBattleText3 ; 0x6042 TextEndBattle
	dw SilphCo5EndBattleText3 ; 0x6042 TextEndBattle
; 0x19fea

Silphco5TrainerHeader3: ; 19fea (6:5fea)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d82b ; flag's byte
	dw SilphCo5BattleText4 ; 0x6056 TextBeforeBattle
	dw SilphCo5AfterBattleText4 ; 0x6060 TextAfterBattle
	dw SilphCo5EndBattleText4 ; 0x605b TextEndBattle
	dw SilphCo5EndBattleText4 ; 0x605b TextEndBattle
; 0x19ff4

Silphco5TrainerHeader4: ; 19ff6 (6:5ff6)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d82b ; flag's byte
	dw SilphCo5BattleText5 ; 0x606f TextBeforeBattle
	dw SilphCo5AfterBattleText5 ; 0x6079 TextAfterBattle
	dw SilphCo5EndBattleText5 ; 0x6074 TextEndBattle
	dw SilphCo5EndBattleText5 ; 0x6074 TextEndBattle
; 0x1a002

db $ff

SilphCo5Text1: ; 1a003 (6:6003)
	db $08 ; asm
	ld hl, UnnamedText_1a010 ; $6010
	ld de, UnnamedText_1a015 ; $6015
	call Unnamed_622f
	jp TextScriptEnd

UnnamedText_1a010: ; 1a010 (6:6010)
	TX_FAR _UnnamedText_1a010
	db $50
; 0x1a010 + 5 bytes

UnnamedText_1a015: ; 1a015 (6:6015)
	TX_FAR _UnnamedText_1a015
	db $50
; 0x1a015 + 5 bytes

SilphCo5Text2: ; 1a01a (6:601a)
	db $08 ; asm
	ld hl, Silphco5TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SilphCo5BattleText2: ; 1a024 (6:6024)
	TX_FAR _SilphCo5BattleText2
	db $50
; 0x1a024 + 5 bytes

SilphCo5EndBattleText2: ; 1a029 (6:6029)
	TX_FAR _SilphCo5EndBattleText2
	db $50
; 0x1a029 + 5 bytes

SilphCo5AfterBattleText2: ; 1a02e (6:602e)
	TX_FAR _SilphCo5AfterBattleText2
	db $50
; 0x1a02e + 5 bytes

SilphCo5Text3: ; 1a033 (6:6033)
	db $08 ; asm
	ld hl, Silphco5TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SilphCo5BattleText3: ; 1a03d (6:603d)
	TX_FAR _SilphCo5BattleText3
	db $50
; 0x1a03d + 5 bytes

SilphCo5EndBattleText3: ; 1a042 (6:6042)
	TX_FAR _SilphCo5EndBattleText3
	db $50
; 0x1a042 + 5 bytes

SilphCo5AfterBattleText3: ; 1a047 (6:6047)
	TX_FAR _SilphCo5AfterBattleText3
	db $50
; 0x1a047 + 5 bytes

SilphCo5Text4: ; 1a04c (6:604c)
	db $08 ; asm
	ld hl, Silphco5TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

SilphCo5BattleText4: ; 1a056 (6:6056)
	TX_FAR _SilphCo5BattleText4
	db $50
; 0x1a056 + 5 bytes

SilphCo5EndBattleText4: ; 1a05b (6:605b)
	TX_FAR _SilphCo5EndBattleText4
	db $50
; 0x1a05b + 5 bytes

SilphCo5AfterBattleText4: ; 1a060 (6:6060)
	TX_FAR _SilphCo5AfterBattleText4
	db $50
; 0x1a060 + 5 bytes

SilphCo5Text5: ; 1a065 (6:6065)
	db $08 ; asm
	ld hl, Silphco5TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

SilphCo5BattleText5: ; 1a06f (6:606f)
	TX_FAR _SilphCo5BattleText5
	db $50
; 0x1a06f + 5 bytes

SilphCo5EndBattleText5: ; 1a074 (6:6074)
	TX_FAR _SilphCo5EndBattleText5
	db $50
; 0x1a074 + 5 bytes

SilphCo5AfterBattleText5: ; 1a079 (6:6079)
	TX_FAR _SilphCo5AfterBattleText5
	db $50
; 0x1a079 + 5 bytes

SilphCo5Text9: ; 1a07e (6:607e)
	TX_FAR _SilphCo5Text9
	db $50

SilphCo5Text10: ; 1a083 (6:6083)
	TX_FAR _SilphCo5Text10
	db $50

SilphCo5Text11: ; 1a088 (6:6088)
	TX_FAR _SilphCo5Text11
	db $50

SilphCo5Object: ; 0x1a08d (size=137)
	db $2e ; border tile

	db $7 ; warps
	db $0, $18, $1, SILPH_CO_6F
	db $0, $1a, $1, SILPH_CO_4F
	db $0, $14, $0, SILPH_CO_ELEVATOR
	db $3, $1b, $5, SILPH_CO_7F
	db $f, $9, $4, SILPH_CO_9F
	db $5, $b, $4, SILPH_CO_3F
	db $f, $3, $5, SILPH_CO_3F

	db $0 ; signs

	db $b ; people
	db SPRITE_LAPRAS_GIVER, $9 + 4, $d + 4, $ff, $ff, $1 ; person
	db SPRITE_ROCKET, $10 + 4, $8 + 4, $ff, $d3, $42, ROCKET + $C8, $1c ; trainer
	db SPRITE_OAK_AIDE, $3 + 4, $8 + 4, $ff, $d3, $43, SCIENTIST + $C8, $6 ; trainer
	db SPRITE_ROCKER, $a + 4, $12 + 4, $ff, $d1, $44, JUGGLER + $C8, $1 ; trainer
	db SPRITE_ROCKET, $4 + 4, $1c + 4, $ff, $d1, $45, ROCKET + $C8, $1d ; trainer
	db SPRITE_BALL, $d + 4, $2 + 4, $ff, $ff, $86, TM_09 ; item
	db SPRITE_BALL, $6 + 4, $4 + 4, $ff, $ff, $87, PROTEIN ; item
	db SPRITE_BALL, $10 + 4, $15 + 4, $ff, $ff, $88, CARD_KEY ; item
	db SPRITE_CLIPBOARD, $c + 4, $16 + 4, $ff, $ff, $9 ; person
	db SPRITE_CLIPBOARD, $a + 4, $19 + 4, $ff, $ff, $a ; person
	db SPRITE_CLIPBOARD, $6 + 4, $18 + 4, $ff, $ff, $b ; person

	; warp-to
	EVENT_DISP $f, $0, $18 ; SILPH_CO_6F
	EVENT_DISP $f, $0, $1a ; SILPH_CO_4F
	EVENT_DISP $f, $0, $14 ; SILPH_CO_ELEVATOR
	EVENT_DISP $f, $3, $1b ; SILPH_CO_7F
	EVENT_DISP $f, $f, $9 ; SILPH_CO_9F
	EVENT_DISP $f, $5, $b ; SILPH_CO_3F
	EVENT_DISP $f, $f, $3 ; SILPH_CO_3F

SilphCo5Blocks: ; 1a116 (6:6116)
	INCBIN "maps/silphco5.blk"

SilphCo6_h: ; 0x1a19d to 0x1a1a9 (12 bytes) (bank=6) (id=211)
	db $16 ; tileset
	db SILPH_CO_6F_HEIGHT, SILPH_CO_6F_WIDTH ; dimensions (y, x)
	dw SilphCo6Blocks, SilphCo6Texts, SilphCo6Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo6Object ; objects

SilphCo6Script: ; 1a1a9 (6:61a9)
	call Unnamed_1a1bf
	call EnableAutoTextBoxDrawing
	ld hl, SilphCo6TrainerHeaders
	ld de, SilphCo6ScriptPointers
	ld a, [W_SILPHCO6CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SILPHCO6CURSCRIPT], a
	ret
; 0x1a1bf

Unnamed_1a1bf: ; 1a1bf (6:61bf)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, SilphCo6Coords1
	call SilphCo4Function19d5d
	call Unknown_1a1e6
	ld a, [$d82e]
	bit 7, a
	ret nz
	ld a, $5f
	ld [$d09f], a
	ld bc, $0602
	ld a, $17
	jp Predef

SilphCo6Coords1: ; 1a1e3 (6:61e3)
	db $06, $02
	db $ff

Unknown_1a1e6: ; 1a1e6 (6:61e6)
	ld a, [$ff00+$e0]
	and a
	ret z
	ld hl, $d82e
	set 7, [hl]
	ret

SilphCo6ScriptPointers: ; 1a1f0 (6:61f0)
	dw CheckFightingMapTrainers
	dw Func_324c
	dw EndTrainerBattle

SilphCo6Texts: ; 1a1f6 (6:61f6)
	dw SilphCo6Text1, SilphCo6Text2, SilphCo6Text3, SilphCo6Text4, SilphCo6Text5, SilphCo6Text6, SilphCo6Text7, SilphCo6Text8, Predef5CText, Predef5CText

SilphCo6TrainerHeaders: ; 1a20a (6:620a)
SilphCo6TrainerHeader0: ; 1a20a (6:620a)
	db $6 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d82d ; flag's byte
	dw SilphCo6BattleText2 ; 0x62ba TextBeforeBattle
	dw SilphCo6AfterBattleText2 ; 0x62c4 TextAfterBattle
	dw SilphCo6EndBattleText2 ; 0x62bf TextEndBattle
	dw SilphCo6EndBattleText2 ; 0x62bf TextEndBattle
; 0x1a216

SilphCo6TrainerHeader2: ; 1a216 (6:6216)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d82d ; flag's byte
	dw SilphCo6BattleText3 ; 0x62d3 TextBeforeBattle
	dw SilphCo6AfterBattleText3 ; 0x62dd TextAfterBattle
	dw SilphCo6EndBattleText3 ; 0x62d8 TextEndBattle
	dw SilphCo6EndBattleText3 ; 0x62d8 TextEndBattle
; 0x1a222

SilphCo6TrainerHeader3: ; 1a222 (6:6222)
	db $8 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d82d ; flag's byte
	dw SilphCo6BattleText4 ; 0x62ec TextBeforeBattle
	dw SilphCo6AfterBattleText4 ; 0x62f6 TextAfterBattle
	dw SilphCo6EndBattleText4 ; 0x62f1 TextEndBattle
	dw SilphCo6EndBattleText4 ; 0x62f1 TextEndBattle
; 0x1a22e

db $ff

Unnamed_622f: ; 1a22f (6:622f)
	ld a, [$d838]
	bit 7, a
	jr nz, .asm_1a238 ; 0x1a234 $2
	jr .asm_1a23a ; 0x1a236 $2
.asm_1a238
	ld h, d
	ld l, e
.asm_1a23a
	jp PrintText

SilphCo6Text1: ; 1a23d (6:623d)
	db $08 ; asm
	ld hl, UnnamedText_1a24a
	ld de, UnnamedText_1a24f
	call Unnamed_622f
	jp TextScriptEnd

UnnamedText_1a24a: ; 1a24a (6:624a)
	TX_FAR _UnnamedText_1a24a
	db $50
; 0x1a24a + 5 bytes

UnnamedText_1a24f: ; 1a24f (6:624f)
	TX_FAR _UnnamedText_1a24f
	db $50
; 0x1a24f + 5 bytes

SilphCo6Text2: ; 1a254 (6:6254)
	db $08 ; asm
	ld hl, UnnamedText_1a261
	ld de, UnnamedText_1a266
	call Unnamed_622f
	jp TextScriptEnd

UnnamedText_1a261: ; 1a261 (6:6261)
	TX_FAR _UnnamedText_1a261
	db $50
; 0x1a261 + 5 bytes

UnnamedText_1a266: ; 1a266 (6:6266)
	TX_FAR _UnnamedText_1a266
	db $50
; 0x1a266 + 5 bytes

SilphCo6Text3: ; 1a26b (6:626b)
	db $08 ; asm
	ld hl, UnnamedText_1a278
	ld de, UnnamedText_1a27d
	call Unnamed_622f
	jp TextScriptEnd

UnnamedText_1a278: ; 1a278 (6:6278)
	TX_FAR _UnnamedText_1a278
	db $50
; 0x1a278 + 5 bytes

UnnamedText_1a27d: ; 1a27d (6:627d)
	TX_FAR _UnnamedText_1a27d
	db $50
; 0x1a27d + 5 bytes

SilphCo6Text4: ; 1a282 (6:6282)
	db $08 ; asm
	ld hl, UnnamedText_1a28f
	ld de, UnnamedText_1a294
	call Unnamed_622f
	jp TextScriptEnd

UnnamedText_1a28f: ; 1a28f (6:628f)
	TX_FAR _UnnamedText_1a28f
	db $50
; 0x1a28f + 5 bytes

UnnamedText_1a294: ; 1a294 (6:6294)
	TX_FAR _UnnamedText_1a294
	db $50
; 0x1a294 + 5 bytes

SilphCo6Text5: ; 1a299 (6:6299)
	db $08 ; asm
	ld hl, UnnamedText_1a2a6
	ld de, UnnamedText_1a2ab
	call Unnamed_622f
	jp TextScriptEnd

UnnamedText_1a2a6: ; 1a2a6 (6:62a6)
	TX_FAR _UnnamedText_1a2a6
	db $50
; 0x1a2a6 + 5 bytes

UnnamedText_1a2ab: ; 1a2ab (6:62ab)
	TX_FAR _UnnamedText_1a2ab
	db $50
; 0x1a2ab + 5 bytes

SilphCo6Text6: ; 1a2b0 (6:62b0)
	db $08 ; asm
	ld hl, SilphCo6TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SilphCo6BattleText2: ; 1a2ba (6:62ba)
	TX_FAR _SilphCo6BattleText2
	db $50
; 0x1a2ba + 5 bytes

SilphCo6EndBattleText2: ; 1a2bf (6:62bf)
	TX_FAR _SilphCo6EndBattleText2
	db $50
; 0x1a2bf + 5 bytes

SilphCo6AfterBattleText2: ; 1a2c4 (6:62c4)
	TX_FAR _SilphCo6AfterBattleText2
	db $50
; 0x1a2c4 + 5 bytes

SilphCo6Text7: ; 1a2c9 (6:62c9)
	db $08 ; asm
	ld hl, SilphCo6TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SilphCo6BattleText3: ; 1a2d3 (6:62d3)
	TX_FAR _SilphCo6BattleText3
	db $50
; 0x1a2d3 + 5 bytes

SilphCo6EndBattleText3: ; 1a2d8 (6:62d8)
	TX_FAR _SilphCo6EndBattleText3
	db $50
; 0x1a2d8 + 5 bytes

SilphCo6AfterBattleText3: ; 1a2dd (6:62dd)
	TX_FAR _SilphCo6AfterBattleText3
	db $50
; 0x1a2dd + 5 bytes

SilphCo6Text8: ; 1a2e2 (6:62e2)
	db $08 ; asm
	ld hl, SilphCo6TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

SilphCo6BattleText4: ; 1a2ec (6:62ec)
	TX_FAR _SilphCo6BattleText4
	db $50
; 0x1a2ec + 5 bytes

SilphCo6EndBattleText4: ; 1a2f1 (6:62f1)
	TX_FAR _SilphCo6EndBattleText4
	db $50
; 0x1a2f1 + 5 bytes

SilphCo6AfterBattleText4: ; 1a2f6 (6:62f6)
	TX_FAR _SilphCo6AfterBattleText4
	db $50
; 0x1a2f6 + 5 bytes

SilphCo6Object: ; 0x1a2fb (size=112)
	db $2e ; border tile

	db $5 ; warps
	db $0, $10, $1, SILPH_CO_7F
	db $0, $e, $0, SILPH_CO_5F
	db $0, $12, $0, SILPH_CO_ELEVATOR
	db $3, $3, $4, SILPH_CO_4F
	db $3, $17, $6, SILPH_CO_2F

	db $0 ; signs

	db $a ; people
	db SPRITE_LAPRAS_GIVER, $6 + 4, $a + 4, $ff, $ff, $1 ; person
	db SPRITE_LAPRAS_GIVER, $6 + 4, $14 + 4, $ff, $ff, $2 ; person
	db SPRITE_ERIKA, $6 + 4, $15 + 4, $ff, $d0, $3 ; person
	db SPRITE_ERIKA, $a + 4, $b + 4, $ff, $d3, $4 ; person
	db SPRITE_LAPRAS_GIVER, $d + 4, $12 + 4, $ff, $d1, $5 ; person
	db SPRITE_ROCKET, $3 + 4, $11 + 4, $ff, $d3, $46, ROCKET + $C8, $1e ; trainer
	db SPRITE_OAK_AIDE, $8 + 4, $7 + 4, $ff, $d0, $47, SCIENTIST + $C8, $7 ; trainer
	db SPRITE_ROCKET, $f + 4, $e + 4, $ff, $d2, $48, ROCKET + $C8, $1f ; trainer
	db SPRITE_BALL, $c + 4, $3 + 4, $ff, $ff, $89, HP_UP ; item
	db SPRITE_BALL, $f + 4, $2 + 4, $ff, $ff, $8a, X_ACCURACY ; item

	; warp-to
	EVENT_DISP $d, $0, $10 ; SILPH_CO_7F
	EVENT_DISP $d, $0, $e ; SILPH_CO_5F
	EVENT_DISP $d, $0, $12 ; SILPH_CO_ELEVATOR
	EVENT_DISP $d, $3, $3 ; SILPH_CO_4F
	EVENT_DISP $d, $3, $17 ; SILPH_CO_2F

SilphCo6Blocks: ; 1a36b (6:636b)
	INCBIN "maps/silphco6.blk"

; known jump sources: 314b (0:314b)
Func_1a3e0: ; 1a3e0 (6:63e0)
	ld hl, $d730
	res 1, [hl]
	call Func_1a609
	jr nc, .asm_1a406
	ld a, $fc
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d736
	set 1, [hl]
	ld a, $1
	ld [$cd38], a
	ld a, $80
	ld [$ccd3], a
	xor a
	ld [$c102], a
	call Func_3486
	ret
.asm_1a406
	xor a
	ld [$cd3a], a
	ld [$cd38], a
	ld [$ccd3], a
	ld hl, $d736
	res 0, [hl]
	res 1, [hl]
	ld hl, $d730
	res 7, [hl]
	ret

; known jump sources: 3153 (0:3153)
Func_1a41d: ; 1a41d (6:641d)
	ld hl, $d730
	res 7, [hl]
	ld hl, $d72e
	res 7, [hl]
	ld hl, $d736
	res 0, [hl]
	res 1, [hl]
	xor a
	ld [$cf17], a
	ld [$cc57], a
	ld [$cf10], a
	ld [$cd3a], a
	ld [$cd38], a
	ld [$ccd3], a
	ret

Unknown_1a442: ; 1a442 (6:6442)
	dw Func_1a44c
	dw Func_1a485
	dw Func_1a4a1
	dw Func_1a4a6
	dw Func_1a4f4

Func_1a44c: ; 1a44c (6:644c)
	ld a, [W_XCOORD] ; $d362
	sub $a
	ld [$cca1], a
	jr z, .asm_1a475
	ld b, $0
	ld c, a
	ld hl, $cc97
	ld a, $80
	call FillMemory
	ld [hl], $ff
	ld a, [$cf13]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	ld de, $cc97
	call MoveSprite
	ld a, $1
	ld [$cf10], a
	jr .asm_1a47a
.asm_1a475
	ld a, $3
	ld [$cf10], a
.asm_1a47a
	ld hl, W_FLAGS_D733
	set 1, [hl]
	ld a, $fc
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ret

Func_1a485: ; 1a485 (6:6485)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, [$cca1]
	ld [$cd38], a
	ld [$ff00+$95], a
	ld a, $23
	call Predef
	call Func_3486
	ld a, $2
	ld [$cf10], a
	ret
; 0x1a4a1

Func_1a4a1: ; 1a4a1 (6:64a1)
	ld a, [$cd38]
	and a
	ret nz

Func_1a4a6: ; 1a4a6 (6:64a6)
	xor a
	ld [$cd3b], a
	ld a, [$cf13]
	swap a
	ld [$cf17], a
	xor a
	ld [$c206], a
	ld hl, $ccd3
	ld de, RLEList_1a4e9
	call DecodeRLEList
	dec a
	ld [$cd38], a
	ld hl, $cc97
	ld de, RLEList_1a4dc
	call DecodeRLEList
	ld hl, $d72e
	res 7, [hl]
	ld hl, $d730
	set 7, [hl]
	ld a, $4
	ld [$cf10], a
	ret

RLEList_1a4dc: ; 1a4dc (6:64dc)
db $00, $05
db $80, $01
db $00, $05
db $C0, $03
db $40, $01
db $E0, $01
db $FF

RLEList_1a4e9: ; 1a4e9 (6:64e9)
db $40, $02
db $10, $03
db $80, $05
db $20, $01
db $80, $06
db $FF

Func_1a4f4: ; 1a4f4 (6:64f4)
	ld a, [$cd38]
	and a
	ret nz
	ld a, $0
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	ld hl, $d730
	res 7, [hl]
	ld hl, $d72e
	res 7, [hl]
	jp Func_314e

Unknown_1a510: ; 1a510 (6:6510)
	dw Func_1a514
	dw Func_1a56b

Func_1a514: ; 1a514 (6:6514)
	ld a, $2
	ld [$c0ef], a
	ld [$c0f0], a
	ld a, $e1
	ld [$c0ee], a
	call PlaySound
	ld a, [$cf13]
	swap a
	ld [$cf17], a
	call Func_3486
	ld hl, $ccd3
	ld de, RLEList_1a559
	call DecodeRLEList
	dec a
	ld [$cd38], a
	xor a
	ld [$d12f], a
	ld a, $4f
	call Predef
	ld hl, $cc97
	ld de, RLEList_1a562
	call DecodeRLEList
	ld hl, $d72e
	res 7, [hl]
	ld a, $1
	ld [$cf10], a
	ret
; 0x1a559

RLEList_1a559: ; 1a559 (6:6559)
db $00, $01
db $40, $03
db $20, $0D
db $40, $06
db $FF

RLEList_1a562: ; 1a562 (6:6562)
db $40, $06
db $80, $0D
db $40, $03
db $80, $01
db $FF

Func_1a56b: ; 1a56b (6:656b)
	ld a, [$cd38]
	and a
	ret nz
	ld hl, $d730
	res 7, [hl]
	ld hl, $d72e
	res 7, [hl]
	jp Func_314e
; 0x1a57d

Unknown_1a57d: ; 1a57d (6:657d)
	dw Func_1a581
	dw Func_1a56b

Func_1a581: ; 1a581 (6:6581)
	ld a, $2
	ld [$c0ef], a
	ld [$c0f0], a
	ld a, $e1
	ld [$c0ee], a
	call PlaySound
	ld a, [$cf13]
	swap a
	ld [$cf17], a
	xor a
	ld [$c206], a
	ld hl, $ccd3
	ld de, RLEList_1a5cd
	call DecodeRLEList
	dec a
	ld [$cd38], a
	ld a, $1
	ld [$d12f], a
	ld a, $4f
	call Predef
	ld hl, $cc97
	ld de, RLEList_1a5da
	call DecodeRLEList
	ld hl, $d72e
	res 7, [hl]
	ld hl, $d730
	set 7, [hl]
	ld a, $1
	ld [$cf10], a
	ret
; 0x1a5cd

RLEList_1a5cd: ; 1a5cd (6:65cd)
db $00, $01
db $10, $02
db $80, $05
db $20, $0B
db $40, $05
db $20, $0F
db $FF

RLEList_1a5da: ; 1a5da (6:65da)
db $00, $02
db $80, $0F
db $40, $05
db $80, $0B
db $00, $05
db $C0, $03
db $FF

; known jump sources: 33b1 (0:33b1)
Func_1a5e7: ; 1a5e7 (6:65e7)
	ld a, [W_CURMAP] ; $d35e
	cp $94
	ret z
	ld hl, Unknown_1a605 ; $6605
	ld a, [W_ENGAGEDTRAINERCLASS]
	ld b, a
.asm_1a5f4
	ld a, [hli]
	cp $ff
	jr z, .asm_1a5fd
	cp b
	ret z
	jr .asm_1a5f4
.asm_1a5fd
	ld a, [$cf13]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp SetSpriteMovementBytesToFF

Unknown_1a605: ; 1a605 (6:6605)
INCBIN "baserom.gbc",$1a605,$1a609 - $1a605

; known jump sources: c4a5 (3:44a5), 1a3e5 (6:63e5)
Func_1a609: ; 1a609 (6:6609)
	push de
	ld hl, Unknown_1a62c ; $662c
	ld a, [W_CURMAPTILESET] ; $d367
	ld de, $3
	call IsInArray
	pop de
	jr nc, .asm_1a62a
	inc hl
	ld a, [hli]
	ld h, [hl]
	ld l, a
	FuncCoord 8, 9 ; $c45c
	ld a, [Coord]
	ld b, a
.asm_1a621
	ld a, [hli]
	and a
	jr z, .asm_1a62a
	cp b
	jr nz, .asm_1a621
	scf
	ret
.asm_1a62a
	and a
	ret

Unknown_1a62c: ; 1a62c (6:662c)
INCBIN "baserom.gbc",$1a62c,$1a672 - $1a62c

; known jump sources: c37 (0:c37)
Func_1a672: ; 1a672 (6:6672)
	ld a, [$d736]
	bit 6, a
	ret nz
	ld a, [W_CURMAPTILESET] ; $d367
	and a
	ret nz
	ld a, $35
	call Predef ; indirect jump to Func_c586 (c586 (3:4586))
	ld a, [$c109]
	ld b, a
	FuncCoord 8, 9 ; $c45c
	ld a, [Coord]
	ld c, a
	ld a, [$cfc6]
	ld d, a
	ld hl, Unknown_1a6cf ; $66cf
.asm_1a691
	ld a, [hli]
	cp $ff
	ret z
	cp b
	jr nz, .asm_1a6a4
	ld a, [hli]
	cp c
	jr nz, .asm_1a6a5
	ld a, [hli]
	cp d
	jr nz, .asm_1a6a6
	ld a, [hl]
	ld e, a
	jr .asm_1a6a9
.asm_1a6a4
	inc hl
.asm_1a6a5
	inc hl
.asm_1a6a6
	inc hl
	jr .asm_1a691
.asm_1a6a9
	ld a, [H_CURRENTPRESSEDBUTTONS]
	and e
	ret z
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d736
	set 6, [hl]
	call Func_3486
	ld a, e
	ld [$ccd3], a
	ld [$ccd4], a
	ld a, $2
	ld [$cd38], a
	call Func_1a6f0
	ld a, $a2
	call PlaySound
	ret

Unknown_1a6cf: ; 1a6cf (6:66cf)
INCBIN "baserom.gbc",$1a6cf,$1a6f0 - $1a6cf

; known jump sources: 1a6c6 (6:66c6)
Func_1a6f0: ; 1a6f0 (6:66f0)
	ld hl, $8ff0
	ld de, Unknown_1a708 ; $6708
	ld bc, (BANK(Unknown_1a708) << 8) + $01
	call CopyVideoDataDouble
	ld a, $9
	ld bc, $5448
	ld de, Unknown_1a710 ; $6710
	call WriteOAMBlock
	ret

Unknown_1a708: ; 1a708 (6:6708)
INCBIN "baserom.gbc",$1a708,$1a710 - $1a708

Unknown_1a710: ; 1a710 (6:6710)
INCBIN "baserom.gbc",$1a710,$1bcc8 - $1a710

SECTION "bank7",ROMX,BANK[$7]

CinnabarIsland_h: ; 0x1c000 to 0x1c022 (34 bytes) (bank=7) (id=8)
	db $00 ; tileset
	db CINNABAR_ISLAND_HEIGHT, CINNABAR_ISLAND_WIDTH ; dimensions (y, x)
	dw CinnabarIslandBlocks, CinnabarIslandTexts, CinnabarIslandScript ; blocks, texts, scripts
	db NORTH | EAST ; connections

	; connections data

	db ROUTE_21
	dw Route21Blocks + (ROUTE_21_HEIGHT - 3) * ROUTE_21_WIDTH ; connection strip location
	dw $C6EB + 0 ; current map position
	db ROUTE_21_WIDTH, ROUTE_21_WIDTH ; bigness, width
	db (ROUTE_21_HEIGHT * 2) - 1, (0 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_21_HEIGHT * (ROUTE_21_WIDTH + 6) ; window

	db ROUTE_20
	dw Route20Blocks + (ROUTE_20_WIDTH * 0) ; connection strip location
	dw $C6E5 + (CINNABAR_ISLAND_WIDTH + 6) * (0 + 4) ; current map position
	db ROUTE_20_HEIGHT, ROUTE_20_WIDTH ; bigness, width
	db (0 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_20_WIDTH ; window

	; end connections data

	dw CinnabarIslandObject ; objects

CinnabarIslandObject: ; 0x1c022 (size=71)
	db $43 ; border tile

	db $5 ; warps
	db $3, $6, $1, MANSION_1
	db $3, $12, $0, CINNABAR_GYM
	db $9, $6, $0, CINNABAR_LAB_1
	db $b, $b, $0, CINNABAR_POKECENTER
	db $b, $f, $0, CINNABAR_MART

	db $5 ; signs
	db $5, $9, $3 ; CinnabarIslandText3
	db $b, $10, $4 ; MartSignText
	db $b, $c, $5 ; PokeCenterSignText
	db $b, $9, $6 ; CinnabarIslandText6
	db $3, $d, $7 ; CinnabarIslandText7

	db $2 ; people
	db SPRITE_GIRL, $5 + 4, $c + 4, $fe, $2, $1 ; person
	db SPRITE_GAMBLER, $6 + 4, $e + 4, $ff, $ff, $2 ; person

	; warp-to
	EVENT_DISP $a, $3, $6 ; MANSION_1
	EVENT_DISP $a, $3, $12 ; CINNABAR_GYM
	EVENT_DISP $a, $9, $6 ; CINNABAR_LAB_1
	EVENT_DISP $a, $b, $b ; CINNABAR_POKECENTER
	EVENT_DISP $a, $b, $f ; CINNABAR_MART

CinnabarIslandBlocks: ; 1c069 (7:4069)
	INCBIN "maps/cinnabarisland.blk"

Route1_h: ; 0x1c0c3 to 0x1c0e5 (34 bytes) (bank=7) (id=12)
	db $00 ; tileset
	db ROUTE_1_HEIGHT, ROUTE_1_WIDTH ; dimensions (y, x)
	dw Route1Blocks, Route1Texts, Route1Script ; blocks, texts, scripts
	db NORTH | SOUTH ; connections

	; connections data

	db VIRIDIAN_CITY
	dw ViridianCityBlocks + (VIRIDIAN_CITY_HEIGHT - 3) * VIRIDIAN_CITY_WIDTH + 2, $c6e8 ; pointers (connected, current) (strip)
	db $10, $14 ; bigness, width
	db $23, $0a ; alignments (y, x)
	dw $c8bd ; window

	db PALLET_TOWN
	dw PalletTownBlocks, $c83b ; pointers (connected, current) (strip)
	db $0a, $0a ; bigness, width
	db $00, $00 ; alignments (y, x)
	dw $c6f9 ; window

	; end connections data

	dw Route1Object ; objects

Route1Object: ; 0x1c0e5 (size=19)
	db $b ; border tile

	db $0 ; warps

	db $1 ; signs
	db $1b, $9, $3 ; Route1Text3

	db $2 ; people
	db SPRITE_BUG_CATCHER, $18 + 4, $5 + 4, $fe, $1, $1 ; person
	db SPRITE_BUG_CATCHER, $d + 4, $f + 4, $fe, $2, $2 ; person

; XXX what is this?
Unknown_1c0f8: ; 1c0f8 (7:40f8)
	db $12, $c7, $7, $2

Route1Blocks: ; 1c0fc (7:40fc)
	INCBIN "maps/route1.blk"

UndergroundPathEntranceRoute8Blocks: ; 1c1b0 (7:41b0)
	INCBIN "maps/undergroundpathentranceroute8.blk"

OaksLabBlocks: ; 1c1c0 (7:41c0)
	INCBIN "maps/oakslab.blk"

Route16HouseBlocks: ; 1c1de (7:41de)
Route2HouseBlocks: ; 1c1de (7:41de)
SaffronHouse1Blocks: ; 1c1de (7:41de)
SaffronHouse2Blocks: ; 1c1de (7:41de)
VermilionHouse1Blocks: ; 1c1de (7:41de)
NameRaterBlocks: ; 1c1de (7:41de)
LavenderHouse1Blocks: ; 1c1de (7:41de)
LavenderHouse2Blocks: ; 1c1de (7:41de)
CeruleanHouse2Blocks: ; 1c1de (7:41de)
PewterHouse1Blocks: ; 1c1de (7:41de)
PewterHouse2Blocks: ; 1c1de (7:41de)
ViridianHouseBlocks: ; 0x1c1de 41DE size=16
	INCBIN "maps/viridianhouse.blk"

CeladonMansion5Blocks: ; 1c1ee (7:41ee)
SchoolBlocks: ; 0x1c1ee 41EE size=16
	INCBIN "maps/school.blk"

CeruleanHouseTrashedBlocks: ; 0x1c1fe size=16
	INCBIN "maps/ceruleanhousetrashed.blk"

DiglettsCaveEntranceRoute11Blocks: ; 1c20e (7:420e)
DiglettsCaveRoute2Blocks: ; 0x1c20e size=16
	INCBIN "maps/diglettscaveroute2.blk"

MonsterNames: ; 1c21e (7:421e)
	db "RHYDON@@@@"
	db "KANGASKHAN"
	db "NIDORAN♂@@"
	db "CLEFAIRY@@"
	db "SPEAROW@@@"
	db "VOLTORB@@@"
	db "NIDOKING@@"
	db "SLOWBRO@@@"
	db "IVYSAUR@@@"
	db "EXEGGUTOR@"
	db "LICKITUNG@"
	db "EXEGGCUTE@"
	db "GRIMER@@@@"
	db "GENGAR@@@@"
	db "NIDORAN♀@@"
	db "NIDOQUEEN@"
	db "CUBONE@@@@"
	db "RHYHORN@@@"
	db "LAPRAS@@@@"
	db "ARCANINE@@"
	db "MEW@@@@@@@"
	db "GYARADOS@@"
	db "SHELLDER@@"
	db "TENTACOOL@"
	db "GASTLY@@@@"
	db "SCYTHER@@@"
	db "STARYU@@@@"
	db "BLASTOISE@"
	db "PINSIR@@@@"
	db "TANGELA@@@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "GROWLITHE@"
	db "ONIX@@@@@@"
	db "FEAROW@@@@"
	db "PIDGEY@@@@"
	db "SLOWPOKE@@"
	db "KADABRA@@@"
	db "GRAVELER@@"
	db "CHANSEY@@@"
	db "MACHOKE@@@"
	db "MR.MIME@@@"
	db "HITMONLEE@"
	db "HITMONCHAN"
	db "ARBOK@@@@@"
	db "PARASECT@@"
	db "PSYDUCK@@@"
	db "DROWZEE@@@"
	db "GOLEM@@@@@"
	db "MISSINGNO."
	db "MAGMAR@@@@"
	db "MISSINGNO."
	db "ELECTABUZZ"
	db "MAGNETON@@"
	db "KOFFING@@@"
	db "MISSINGNO."
	db "MANKEY@@@@"
	db "SEEL@@@@@@"
	db "DIGLETT@@@"
	db "TAUROS@@@@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "MISSINGNO."
	db "FARFETCH'D"
	db "VENONAT@@@"
	db "DRAGONITE@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "MISSINGNO."
	db "DODUO@@@@@"
	db "POLIWAG@@@"
	db "JYNX@@@@@@"
	db "MOLTRES@@@"
	db "ARTICUNO@@"
	db "ZAPDOS@@@@"
	db "DITTO@@@@@"
	db "MEOWTH@@@@"
	db "KRABBY@@@@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "MISSINGNO."
	db "VULPIX@@@@"
	db "NINETALES@"
	db "PIKACHU@@@"
	db "RAICHU@@@@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "DRATINI@@@"
	db "DRAGONAIR@"
	db "KABUTO@@@@"
	db "KABUTOPS@@"
	db "HORSEA@@@@"
	db "SEADRA@@@@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "SANDSHREW@"
	db "SANDSLASH@"
	db "OMANYTE@@@"
	db "OMASTAR@@@"
	db "JIGGLYPUFF"
	db "WIGGLYTUFF"
	db "EEVEE@@@@@"
	db "FLAREON@@@"
	db "JOLTEON@@@"
	db "VAPOREON@@"
	db "MACHOP@@@@"
	db "ZUBAT@@@@@"
	db "EKANS@@@@@"
	db "PARAS@@@@@"
	db "POLIWHIRL@"
	db "POLIWRATH@"
	db "WEEDLE@@@@"
	db "KAKUNA@@@@"
	db "BEEDRILL@@"
	db "MISSINGNO."
	db "DODRIO@@@@"
	db "PRIMEAPE@@"
	db "DUGTRIO@@@"
	db "VENOMOTH@@"
	db "DEWGONG@@@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "CATERPIE@@"
	db "METAPOD@@@"
	db "BUTTERFREE"
	db "MACHAMP@@@"
	db "MISSINGNO."
	db "GOLDUCK@@@"
	db "HYPNO@@@@@"
	db "GOLBAT@@@@"
	db "MEWTWO@@@@"
	db "SNORLAX@@@"
	db "MAGIKARP@@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "MUK@@@@@@@"
	db "MISSINGNO."
	db "KINGLER@@@"
	db "CLOYSTER@@"
	db "MISSINGNO."
	db "ELECTRODE@"
	db "CLEFABLE@@"
	db "WEEZING@@@"
	db "PERSIAN@@@"
	db "MAROWAK@@@"
	db "MISSINGNO."
	db "HAUNTER@@@"
	db "ABRA@@@@@@"
	db "ALAKAZAM@@"
	db "PIDGEOTTO@"
	db "PIDGEOT@@@"
	db "STARMIE@@@"
	db "BULBASAUR@"
	db "VENUSAUR@@"
	db "TENTACRUEL"
	db "MISSINGNO."
	db "GOLDEEN@@@"
	db "SEAKING@@@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "MISSINGNO."
	db "MISSINGNO."
	db "PONYTA@@@@"
	db "RAPIDASH@@"
	db "RATTATA@@@"
	db "RATICATE@@"
	db "NIDORINO@@"
	db "NIDORINA@@"
	db "GEODUDE@@@"
	db "PORYGON@@@"
	db "AERODACTYL"
	db "MISSINGNO."
	db "MAGNEMITE@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "CHARMANDER"
	db "SQUIRTLE@@"
	db "CHARMELEON"
	db "WARTORTLE@"
	db "CHARIZARD@"
	db "MISSINGNO."
	db "MISSINGNO."
	db "MISSINGNO."
	db "MISSINGNO."
	db "ODDISH@@@@"
	db "GLOOM@@@@@"
	db "VILEPLUME@"
	db "BELLSPROUT"
	db "WEEPINBELL"
	db "VICTREEBEL"

; known jump sources: 4493 (1:4493)
Func_1c98a: ; 1c98a (7:498a)
	call ClearScreen
	call GoPAL_SET_CF1C
	call LoadFontTilePatterns
	call LoadTextBoxTilePatterns
	ld hl, UnnamedText_1c9c1 ; $49c1
	call PrintText
	FuncCoord 14, 7 ; $c43a
	ld hl, Coord
	ld bc, $80f
	ld a, $7
	ld [$d12c], a
	ld a, $14
	ld [$d125], a
	call DisplayTextBoxID
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jp z, InitGame
	ld b, BANK(Func_73b6a)
	ld hl, Func_73b6a
	call Bankswitch ; indirect jump to Func_73b6a (73b6a (1c:7b6a))
	jp InitGame
; 1c9c1 (7:49c1)
UnnamedText_1c9c1: ; 1c9c1 (7:49c1)
	TX_FAR _UnnamedText_1c9c1
	db $50
; 0x1c9c1 + 5 bytes

; known jump sources: 4583e (11:583e)
Func_1c9c6: ; 1c9c6 (7:49c6)
	ld hl, UnnamedText_1ca14 ; $4a14
	call PrintText
	ld hl, $cf7b
	ld a, l
	ld [$cf8b], a
	ld a, h
	ld [$cf8c], a
	ld a, [W_LISTSCROLLOFFSET] ; $cc36
	push af
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_LISTSCROLLOFFSET], a ; $cc36
	ld [$cf93], a
	ld a, $4
	ld [W_LISTMENUID], a ; $cf94
	call DisplayListMenuID
	pop bc
	ld a, b
	ld [W_LISTSCROLLOFFSET], a ; $cc36
	ret c
	ld hl, $d126
	set 7, [hl]
	ld hl, $cc5b
	ld a, [W_WHICHPOKEMON] ; $cf92
	add a
	ld d, $0
	ld e, a
	add hl, de
	ld a, [hli]
	ld b, a
	ld a, [hl]
	ld c, a
	ld hl, $d3af
	call Func_1ca0d

; known jump sources: 1ca0a (7:4a0a)
Func_1ca0d: ; 1ca0d (7:4a0d)
	inc hl
	inc hl
	ld a, b
	ld [hli], a
	ld a, c
	ld [hli], a
	ret
; 1ca14 (7:4a14)
UnnamedText_1ca14: ; 1ca14 (7:4a14)
	TX_FAR _UnnamedText_1ca14
	db $50
; 0x1ca14 + 5 bytes

CinnabarIslandScript: ; 1ca19 (7:4a19)
	call EnableAutoTextBoxDrawing
	ld hl, $d126
	set 5, [hl]
	ld hl, $d796
	res 0, [hl]
	ld hl, $d7a3
	res 1, [hl]
	ld hl, CinnabarIslandScripts
	ld a, [W_CINNABARISLANDCURSCRIPT]
	jp CallFunctionInTable
; 0x1ca34

CinnabarIslandScripts: ; 1ca34 (7:4a34)
	dw CinnabarIslandScript0, CinnabarIslandScript1

CinnabarIslandScript0: ; 1ca38 (7:4a38)
	ld b, $2b
	call IsItemInBag
	ret nz
	ld a, [$d361]
	cp $4
	ret nz
	ld a, [$d362]
	cp $12
	ret nz
	ld a, $8
	ld [$d528], a
	ld a, $8
	ld [$ff00+$8c], a
	call DisplayTextID
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $1
	ld [$cd38], a
	ld a, $80
	ld [$ccd3], a
	call Func_3486
	xor a
	ld [$c109], a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $1
	ld [W_CINNABARISLANDCURSCRIPT], a
	ret
; 0x1ca73

CinnabarIslandScript1: ; 1ca73 (7:4a73)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	ld a, $0
	ld [W_CINNABARISLANDCURSCRIPT], a
	ret
; 0x1ca81

CinnabarIslandTexts: ; 1ca81 (7:4a81)
	dw CinnabarIslandText1, CinnabarIslandText2, CinnabarIslandText3, MartSignText, PokeCenterSignText, CinnabarIslandText6, CinnabarIslandText7, CinnabarIslandText8

CinnabarIslandText8: ; 1ca91 (7:4a91)
	TX_FAR _CinnabarIslandText8
	db $50
; 0x1ca91 + 5 bytes

CinnabarIslandText1: ; 1ca96 (7:4a96)
	TX_FAR _CinnabarIslandText1
	db $50

CinnabarIslandText2: ; 1ca9b (7:4a9b)
	TX_FAR _CinnabarIslandText2
	db $50

CinnabarIslandText3: ; 1caa0 (7:4aa0)
	TX_FAR _CinnabarIslandText3
	db $50

CinnabarIslandText6: ; 1caa5 (7:4aa5)
	TX_FAR _CinnabarIslandText6
	db $50

CinnabarIslandText7: ; 1caaa (7:4aaa)
	TX_FAR _CinnabarIslandText7
	db $50

Route1Script: ; 1caaf (7:4aaf)
	jp EnableAutoTextBoxDrawing
; 0x1cab2

Route1Texts: ; 1cab2 (7:4ab2)
	dw Route1Text1, Route1Text2, Route1Text3

Route1Text1: ; 1cab8 (7:4ab8)
	db $08 ; asm
	ld hl, $d7bf
	bit 0, [hl]
	set 0, [hl]
	jr nz, .asm_02840 ; 0x1cac0
	ld hl, Route1ViridianMartSampleText
	call PrintText 
	ld bc, (POTION << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, Unknown_1cae8 ; $4ae8
	jr .asm_46d43 ; 0x1cad3
.BagFull
	ld hl, UnnamedText_1caf3 ; $4af3
	jr .asm_46d43 ; 0x1cad8
.asm_02840 ; 0x1cada
	ld hl, UnnamedText_1caee ; $4aee
.asm_46d43 ; 0x1cadd
	call PrintText
	jp TextScriptEnd

Route1ViridianMartSampleText: ; 1cae3 (7:4ae3)
	TX_FAR _Route1ViridianMartSampleText
	db $50
; 0x1cae3 + 5 bytes

Unknown_1cae8: ; 1cae8 (7:4ae8)
INCBIN "baserom.gbc",$1cae8,$1caee - $1cae8

UnnamedText_1caee: ; 1caee (7:4aee)
	TX_FAR _UnnamedText_1caee
	db $50
; 0x1caee + 5 bytes

UnnamedText_1caf3: ; 1caf3 (7:4af3)
	TX_FAR _UnnamedText_1caf3
	db $50
; 0x1caf3 + 5 bytes

Route1Text2: ; 1caf8 (7:4af8)
	TX_FAR _Route1Text2
	db $50

Route1Text3: ; 1cafd (7:4afd)
	TX_FAR _Route1Text3
	db $50

OaksLab_h: ; 0x1cb02 to 0x1cb0e (12 bytes) (bank=7) (id=40)
	db $05 ; tileset
	db OAKS_LAB_HEIGHT, OAKS_LAB_WIDTH ; dimensions (y, x)
	dw OaksLabBlocks, OaksLabTexts, OaksLabScript ; blocks, texts, scripts
	db $00 ; connections

	dw OaksLabObject ; objects

OaksLabScript: ; 1cb0e (7:4b0e)
	ld a, [$d74b]
	bit 6, a
	call nz, Unknown_1d076
	ld a, $1
	ld [$cf0c], a
	xor a
	ld [$cc3c], a
	ld hl, OaksLabScripts
	ld a, [W_OAKSLABCURSCRIPT]
	jp CallFunctionInTable
; 0x1cb28

OaksLabScripts: ; 1cb28 (7:4b28)
	dw OaksLabScript0, OaksLabScript1, OaksLabScript2, OaksLabScript3, OaksLabScript4, OaksLabScript5, OaksLabScript6, OaksLabScript7, OaksLabScript8, OaksLabScript9, OaksLabScript10, OaksLabScript11, OaksLabScript12, OaksLabScript13, OaksLabScript14, OaksLabScript15, OaksLabScript16, OaksLabScript17, OaksLabScript18

OaksLabScript0: ; 1cb4e (7:4b4e)
	ld a, [$d74b]
	bit 7, a
	ret z
	ld a, [$cf10]
	and a
	ret nz
	ld a, $31
	ld [$cc4d], a
	ld a, $15
	call Predef
	ld hl, $d72e
	res 4, [hl]

	ld a, $1
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cb6e

OaksLabScript1: ; 1cb6e (7:4b6e)
	ld a, $8
	ld [$ff00+$8c], a
	ld de, OakEntryMovement
	call MoveSprite

	ld a, $2
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cb7e

OakEntryMovement: ; 1cb7e (7:4b7e)
	db $40, $40, $40, $ff

OaksLabScript2: ; 1cb82 (7:4b82)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $31
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, $2e
	ld [$cc4d], a
	ld a, $15
	call Predef

	ld a, $3
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cba2

OaksLabScript3: ; 1cba2 (7:4ba2)
	call Delay3
	ld hl, $ccd3
	ld de, PlayerEntryMovementRLE
	call DecodeRLEList
	dec a
	ld [$cd38], a
	call Func_3486
	ld a, $1
	ld [$ff00+$8c], a
	xor a
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	ld a, $5
	ld [$ff00+$8c], a
	xor a
	ld [$ff00+$8d], a
	call Func_34a6 ; face object

	ld a, $4
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cbcf

PlayerEntryMovementRLE: ; 1cbcf (7:4bcf)
	db $40, $8, $ff

OaksLabScript4: ; 1cbd2 (7:4bd2)
	ld a, [$cd38]
	and a
	ret nz
	ld hl, $d747
	set 0, [hl]
	ld hl, $d74b
	set 0, [hl]
	ld a, $1
	ld [$ff00+$8c], a
	ld a, $4
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	call UpdateSprites
	ld hl, W_FLAGS_D733
	res 1, [hl]
	call Func_2307

	ld a, $5
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cbfd

OaksLabScript5: ; 1cbfd (7:4bfd)
	ld a, $fc
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $11
	ld [$ff00+$8c], a
	call DisplayTextID
	call Delay3
	ld a, $12
	ld [$ff00+$8c], a
	call DisplayTextID
	call Delay3
	ld a, $13
	ld [$ff00+$8c], a
	call DisplayTextID
	call Delay3
	ld a, $14
	ld [$ff00+$8c], a
	call DisplayTextID
	ld hl, $d74b
	set 1, [hl]
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a

	ld a, $6
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cc36

OaksLabScript6: ; 1cc36 (7:4c36)
	ld a, [W_YCOORD]
	cp $6
	ret nz
	ld a, $5
	ld [$ff00+$8c], a
	xor a
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	ld a, $1
	ld [$ff00+$8c], a
	xor a
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	call UpdateSprites
	ld a, $c
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $1
	ld [$cd38], a
	ld a, $40
	ld [$ccd3], a
	call Func_3486
	ld a, $8
	ld [$d528], a

	ld a, $7
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cc72

OaksLabScript7: ; 1cc72 (7:4c72)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3

	ld a, $6
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cc80

OaksLabScript8: ; 1cc80 (7:4c80)
	ld a, [W_PLAYERSTARTER]
	cp CHARMANDER
	jr z, .Charmander ; 0x1cc85 $6
	cp SQUIRTLE
	jr z, .Squirtle ; 0x1cc89 $1d
	jr .Bulbasaur ; 0x1cc8b $38
.Charmander
	ld de, .MiddleBallMovement1
	ld a, [W_YCOORD]
	cp $4 ; is the player standing below the table?
	jr z, .asm_1ccf3 ; 0x1cc95 $5c
	ld de, .MiddleBallMovement2
	jr .asm_1ccf3 ; 0x1cc9a $57

.MiddleBallMovement1
	db 0,0,$C0,$C0,$C0,$40,$FF
.MiddleBallMovement2
	db 0,$C0,$C0,$C0,$FF

.Squirtle
	ld de, .RightBallMovement1
	ld a, [W_YCOORD]
	cp $4 ; is the player standing below the table?
	jr z, .asm_1ccf3 ; 0x1ccb0 $41
	ld de, .RightBallMovement2
	jr .asm_1ccf3 ; 0x1ccb5 $3c

.RightBallMovement1
	db 0,0,$C0,$C0,$C0,$C0,$40,$FF
.RightBallMovement2
	db 0,$C0,$C0,$C0,$C0,$FF

.Bulbasaur
	ld de, .LeftBallMovement1
	ld a, [W_XCOORD]
	cp $9 ; is the player standing to the right of the table?
	jr nz, .asm_1ccf3 ; 0x1cccd $24
	push hl
	ld a, $1
	ld [$ff00+$8c], a
	ld a, $4
	ld [$ff00+$8b], a
	call Func_34fc
	push hl
	ld [hl], $4c
	inc hl
	inc hl
	ld [hl], $0
	pop hl
	inc h
	ld [hl], $8
	inc hl
	ld [hl], $9
	ld de, .LeftBallMovement2 ; the rival is not currently onscreen, so account for that
	pop hl
	jr .asm_1ccf3 ; 0x1cced $4

.LeftBallMovement1
	db 0,$C0 ; not yet terminated!
.LeftBallMovement2
	db $C0,$FF

.asm_1ccf3
	ld a, $1
	ld [$ff00+$8c], a
	call MoveSprite

	ld a, $9
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cd00

OaksLabScript9: ; 1cd00 (7:4d00)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $fc
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $1
	ld [$ff00+$8c], a
	ld a, $4
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	ld a, $d
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, [$cd3e]
	cp $2
	jr nz, .asm_1cd28 ; 0x1cd22 $4
	ld a, $2b
	jr .asm_1cd32 ; 0x1cd26 $a
.asm_1cd28
	cp $3
	jr nz, .asm_1cd30 ; 0x1cd2a $4
	ld a, $2c
	jr .asm_1cd32 ; 0x1cd2e $2
.asm_1cd30
	ld a, $2d
.asm_1cd32
	ld [$cc4d], a
	ld a, $11
	call Predef
	call Delay3
	ld a, [$cd3d]
	ld [W_RIVALSTARTER], a
	ld [$cf91], a
	ld [$d11e], a
	call GetMonName
	ld a, $1
	ld [$ff00+$8c], a
	ld a, $4
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	ld a, $e
	ld [$ff00+$8c], a
	call DisplayTextID
	ld hl, $d74b
	set 2, [hl]
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a

	ld a, $a
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cd6d

OaksLabScript10: ; 1cd6d (7:4d6d)
	ld a, [W_YCOORD]
	cp $6
	ret nz
	ld a, $1
	ld [$ff00+$8c], a
	xor a
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	ld a, $8
	ld [$d528], a
	ld c, $2
	ld a, $de
	call PlayMusic ; play music
	ld a, $f
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $1
	ld [$ff00+$9b], a
	ld a, $1
	swap a
	ld [$ff00+$95], a
	ld a, $22
	call Predef
	ld a, [$ff00+$95]
	dec a
	ld [$ff00+$95], a
	ld a, $20
	call Predef
	ld de, $cc97
	ld a, $1
	ld [$ff00+$8c], a
	call MoveSprite

	ld a, $b
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cdb9

OaksLabScript11: ; 1cdb9 (7:4db9)
	ld a, [$d730]
	bit 0, a
	ret nz

	; define which team rival uses, and fight it
	ld a, SONY1 + 200
	ld [W_CUROPPONENT], a
	ld a, [W_RIVALSTARTER]
	cp SQUIRTLE
	jr nz, .NotSquirtle ; 0x1cdc9 $4
	ld a, $1
	jr .done ; 0x1cdcd $a
.NotSquirtle
	cp BULBASAUR
	jr nz, .Charmander ; 0x1cdd1 $4
	ld a, $2
	jr .done ; 0x1cdd5 $2
.Charmander
	ld a, $3
.done
	ld [W_TRAINERNO], a
	ld a, $1
	ld [$cf13], a
	call Func_32ef
	ld hl, UnnamedText_1d3be
	ld de, UnnamedText_1d3c3
	call PreBattleSaveRegisters
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $8
	ld [$d528], a

	ld a, $c
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1ce03

OaksLabScript12: ; 1ce03 (7:4e03)
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $8
	ld [$d528], a
	call UpdateSprites
	ld a, $1
	ld [$cf13], a
	call Func_32f9
	ld a, $1
	ld [$ff00+$8c], a
	xor a
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	ld a, $7
	call Predef
	ld hl, $d74b
	set 3, [hl]

	ld a, $d
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1ce32

OaksLabScript13: ; 1ce32 (7:4e32)
	ld c, $14
	call DelayFrames
	ld a, $10
	ld [$ff00+$8c], a
	call DisplayTextID
	ld b, BANK(Func_9b47)
	ld hl, Func_9b47
	call Bankswitch
	ld a, $1
	ld [$ff00+$8c], a
	ld de, .RivalExitMovement
	call MoveSprite
	ld a, [W_XCOORD]
	cp $4
	; move left or right depending on where the player is standing
	jr nz, .asm_1ce5b ; 0x1ce55 $4
	ld a, $c0
	jr .asm_1ce5d ; 0x1ce59 $2
.asm_1ce5b
	ld a, $80
.asm_1ce5d
	ld [$cc5b], a

	ld a, $e
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1ce66

.RivalExitMovement
	db $E0,0,0,0,0,0,$FF

OaksLabScript14: ; 1ce6d (7:4e6d)
	ld a, [$d730]
	bit 0, a
	jr nz, .asm_1ce8c ; 0x1ce72 $18
	ld a, $2a
	ld [$cc4d], a
	ld a, $11
	call Predef
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	call Func_2307 ; reset to map music
	ld a, $12
	ld [W_OAKSLABCURSCRIPT], a
	jr .done ; 0x1ce8a $23
.asm_1ce8c
	ld a, [$cf0f]
	cp $5
	jr nz, .asm_1cea8 ; 0x1ce91 $15
	ld a, [$d362]
	cp $4
	jr nz, .asm_1cea1 ; 0x1ce98 $7
	ld a, $c
	ld [$c109], a
	jr .done ; 0x1ce9f $e
.asm_1cea1
	ld a, $8
	ld [$c109], a
	jr .done ; 0x1cea6 $7
.asm_1cea8
	cp $4
	ret nz
	xor a
	ld [$c109], a
.done
	ret
; 0x1ceb0

OaksLabScript15: ; 1ceb0 (7:4eb0)
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	call EnableAutoTextBoxDrawing
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld b, BANK(Func_9b47)
	ld hl, Func_9b47
	call Bankswitch
	ld a, $15
	ld [$ff00+$8c], a
	call DisplayTextID
	call Unknown_1d02b
	ld a, $2a
	ld [$cc4d], a
	ld a, $15
	call Predef
	ld a, [$cd37]
	ld [$d157], a
	ld b, $0
	ld c, a
	ld hl, $cc97
	ld a, $40
	call FillMemory
	ld [hl], $ff
	ld a, $1
	ld [$ff00+$8c], a
	ld de, $cc97
	call MoveSprite

	ld a, $10
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cefd

Function1CEFD ; 0x1cefd
	ld a, $1
	ld [$ff00+$8c], a
	ld a, $4
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	ld a, $8
	ld [$ff00+$8c], a
	xor a
	ld [$ff00+$8d], a
	jp Func_34a6 ; face object
; 0x1cf12

OaksLabScript16: ; 1cf12 (7:4f12)
	ld a, [$d730]
	bit 0, a
	ret nz
	call EnableAutoTextBoxDrawing
	call Func_2307
	ld a, $fc
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	call Function1CEFD
	ld a, $16
	ld [$ff00+$8c], a
	call DisplayTextID
	call DelayFrame
	call Function1CEFD
	ld a, $17
	ld [$ff00+$8c], a
	call DisplayTextID
	call DelayFrame
	call Function1CEFD
	ld a, $18
	ld [$ff00+$8c], a
	call DisplayTextID
	call DelayFrame
	ld a, $19
	ld [$ff00+$8c], a
	call DisplayTextID
	call Delay3
	ld a, $2f
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, $30
	ld [$cc4d], a
	ld a, $11
	call Predef
	call Function1CEFD
	ld a, $1a
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $1
	ld [$ff00+$8c], a
	ld a, $c
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	call Delay3
	ld a, $1b
	ld [$ff00+$8c], a
	call DisplayTextID
	ld hl, $d74b
	set 5, [hl]
	ld hl, $d74e
	set 0, [hl]
	ld a, $1
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, $2
	ld [$cc4d], a
	ld a, $15
	call Predef
	ld a, [$d157]
	ld b, $0
	ld c, a
	ld hl, $cc97
	xor a
	call FillMemory
	ld [hl], $ff
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld b, BANK(Func_9b47)
	ld hl, Func_9b47
	call Bankswitch
	ld a, $1
	ld [$ff00+$8c], a
	ld de, $cc97
	call MoveSprite

	ld a, $11
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1cfd4

OaksLabScript17: ; 1cfd4 (7:4fd4)
	ld a, [$d730]
	bit 0, a
	ret nz
	call Func_2307
	ld a, $2a
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld hl, $d7eb
	set 0, [hl]
	res 1, [hl]
	set 7, [hl]
	ld a, $22
	ld [$cc4d], a
	ld a, $15
	call Predef
	ld a, $5
	ld [W_PALLETTOWNCURSCRIPT], a
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a

	ld a, $12
	ld [W_OAKSLABCURSCRIPT], a
	ret
; 0x1d009

OaksLabScript18: ; 1d009 (7:5009)
	ret
; 0x1d00a

Function1D00A: ; 1d00a (7:500a)
	ld hl, W_BAGITEM01
	ld bc, $0000
.asm_1d010
	ld a, [hli]
	cp $ff
	ret z
	cp OAKS_PARCEL
	jr z, .GotParcel ; 0x1d016 $4
	inc hl
	inc c
	jr .asm_1d010 ; 0x1d01a $f4
.GotParcel
	ld hl, $d31d
	ld a, c
	ld [$cf92], a
	ld a, $1
	ld [$cf96], a
	jp RemoveItemFromInventory

Unknown_1d02b: ; 1d02b (7:502b)
	ld a, $7c
	ld [$ff00+$eb], a
	ld a, $8
	ld [$ff00+$ee], a
	ld a, [$d361]
	cp $3
	jr nz, .asm_1d045 ; 0x1d038 $b
	ld a, $4
	ld [$cd37], a
	ld a, $30
	ld b, $b
	jr .asm_1d068 ; 0x1d043 $23
.asm_1d045
	cp $1
	jr nz, .asm_1d054 ; 0x1d047 $b
	ld a, $2
	ld [$cd37], a
	ld a, $30
	ld b, $9
	jr .asm_1d068 ; 0x1d052 $14
.asm_1d054
	ld a, $3
	ld [$cd37], a
	ld b, $a
	ld a, [$d362]
	cp $4
	jr nz, .asm_1d066 ; 0x1d060 $4
	ld a, $40
	jr .asm_1d068 ; 0x1d064 $2
.asm_1d066
	ld a, $20
.asm_1d068
	ld [$ff00+$ec], a
	ld a, b
	ld [$ff00+$ed], a
	ld a, $1
	ld [$cf13], a
	call Func_32f9
	ret

Unknown_1d076: ; 1d076 (7:5076)
	ld hl, OaksLabTexts + $36 ; $50b8 ; starts at OaksLabText28
	ld a, l
	ld [W_MAPTEXTPTR], a
	ld a, h
	ld [W_MAPTEXTPTR+1], a
	ret

OaksLabTexts: ; 1d082 (7:5082)
	dw OaksLabText1, OaksLabText2, OaksLabText3, OaksLabText4, OaksLabText5, OaksLabText6, OaksLabText7, OaksLabText8, OaksLabText9, OaksLabText10, OaksLabText11, OaksLabText12, OaksLabText13, OaksLabText14, OaksLabText15, OaksLabText16, OaksLabText17, OaksLabText18, OaksLabText19, OaksLabText20, OaksLabText21, OaksLabText22, OaksLabText23, OaksLabText24, OaksLabText25, OaksLabText26, OaksLabText27, OaksLabText28, OaksLabText29, OaksLabText30, OaksLabText31, OaksLabText32, OaksLabText33, OaksLabText34, OaksLabText35, OaksLabText36, OaksLabText37, OaksLabText38

OaksLabText28: ; 1d0ce (7:50ce)
OaksLabText1: ; 1d0ce (7:50ce)
	db $08 ; asm
	ld a, [$d74b]
	bit 0, a
	jr nz, .asm_1d0de ; 0x1d0d4
	ld hl, OaksLabGaryText1
	call PrintText
	jr .asm_1d0f0 ; 0x1d0dc
.asm_1d0de ; 0x1d0de
	bit 2, a
	jr nz, .asm_1d0ea ; 0x1d0e0
	ld hl, OaksLabText40
	call PrintText
	jr .asm_1d0f0 ; 0x1d0e8
.asm_1d0ea ; 0x1d0ea
	ld hl, OaksLabText41
	call PrintText
.asm_1d0f0 ; 0x1d0f0
	jp TextScriptEnd

OaksLabGaryText1: ; 1d0f3 (7:50f3)
	TX_FAR _OaksLabGaryText1
	db $50
; 0x1d0f8

OaksLabText40: ; 1d0f8 (7:50f8)
	TX_FAR _OaksLabText40
	db $50
; 0x1d0f8 + 5 bytes

OaksLabText41: ; 1d0fd (7:50fd)
	TX_FAR _OaksLabText41
	db $50
; 0x1d0fd + 5 bytes

OaksLabText29: ; 1d102 (7:5102)
OaksLabText2: ; 1d102 (7:5102)
	db $8
	ld a, $b1
	ld [$cd3d], a
	ld a, $3
	ld [$cd3e], a
	ld a, $b0
	ld b, $2
	jr asm_1d133 ; 0x1d111 $20

OaksLabText30: ; 1d113 (7:5113)
OaksLabText3: ; 1d113 (7:5113)
	db $8
	ld a, $99
	ld [$cd3d], a
	ld a, $4
	ld [$cd3e], a
	ld a, $b1
	ld b, $3
	jr asm_1d133 ; 0x1d122 $f

OaksLabText31: ; 1d124 (7:5124)
OaksLabText4: ; 1d124 (7:5124)
	db $8
	ld a, $b0
	ld [$cd3d], a
	ld a, $2
	ld [$cd3e], a
	ld a, $99
	ld b, $4

asm_1d133: ; 1d133 (7:5133)
	ld [$cf91], a
	ld [$d11e], a
	ld a, b
	ld [$cf13], a
	ld a, [$d74b]
	bit 2, a
	jp nz, Unknown_1d22d
	bit 1, a
	jr nz, asm_1d157 ; 0x1d147 $e
	ld hl, OaksLabText39
	call PrintText
	jp TextScriptEnd
; 0x1d152

OaksLabText39: ; 1d152 (7:5152)
	TX_FAR _OaksLabText39
	db $50

asm_1d157: ; 1d157 (7:5157)
	ld a, $5
	ld [$ff00+$8c], a
	ld a, $9
	ld [$ff00+$8b], a
	call Func_34fc
	ld [hl], $0
	; manually fixed some disassembler issues around here
	ld a, $1
	ld [$FF8c], a
	ld a, $9
	ld [$ff00+$8b], a
	call Func_34fc
	ld [hl], $c
	ld hl, $d730
	set 6, [hl]
	ld a, $46
	call Predef
	ld hl, $d730
	res 6, [hl]
	call ReloadMapData
	ld c, $a
	call DelayFrames
	ld a, [$cf13]
	cp $2
	jr z, OaksLabLookAtCharmander
	cp $3
	jr z, OaksLabLookAtSquirtle
	jr OaksLabLookAtBulbasaur

OaksLabLookAtCharmander ; 0x1d195
	ld hl, OaksLabCharmanderText
	jr OaksLabMonChoiceMenu
OaksLabCharmanderText: ; 1d19a (7:519a)
	TX_FAR _OaksLabCharmanderText ; 0x94e06
	db $50
; 0x1d19f

OaksLabLookAtSquirtle: ; 1d19f (7:519f)
	ld hl, OaksLabSquirtleText
	jr OaksLabMonChoiceMenu
OaksLabSquirtleText: ; 1d1a4 (7:51a4)
	TX_FAR _OaksLabSquirtleText ; 0x94e2f
	db $50
; 0x1d1a9

OaksLabLookAtBulbasaur: ; 1d1a9 (7:51a9)
	ld hl, OaksLabBulbasaurText
	jr OaksLabMonChoiceMenu
OaksLabBulbasaurText: ; 1d1ae (7:51ae)
	TX_FAR _OaksLabBulbasaurText ; 0x94e57
	db $50
; 0x1d1b3

OaksLabMonChoiceMenu: ; 1d1b3 (7:51b3)
	call PrintText
	ld a, $1
	ld [$cc3c], a
	call YesNoChoice ; yes/no menu
	ld a, [$cc26]
	and a
	jr nz, OaksLabMonChoiceEnd
	ld a, [$cf91]
	ld [$d717], a
	ld [$d11e], a
	call GetMonName
	ld a, [$cf13]
	cp $2
	jr nz, asm_1d1db ; 0x1d1d5 $4
	ld a, $2b
	jr asm_1d1e5 ; 0x1d1d9 $a
asm_1d1db: ; 1d1db (7:51db)
	cp $3
	jr nz, asm_1d1e3 ; 0x1d1dd $4
	ld a, $2c
	jr asm_1d1e5 ; 0x1d1e1 $2
asm_1d1e3: ; 1d1e3 (7:51e3)
	ld a, $2d
asm_1d1e5: ; 1d1e5 (7:51e5)
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, $1
	ld [$cc3c], a
	ld hl, OaksLabMonEnergeticText
	call PrintText
	ld hl, OaksLabReceivedMonText
	call PrintText
	xor a
	ld [$cc49], a
	ld a, $5
	ld [$d127], a
	ld a, [$cf91]
	ld [$d11e], a
	call AddPokemonToParty
	ld hl, $d72e
	set 3, [hl]
	ld a, $fc
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $8
	ld [W_OAKSLABCURSCRIPT], a
OaksLabMonChoiceEnd: ; 1d21f (7:521f)
	jp TextScriptEnd
; 0x1d222

OaksLabMonEnergeticText: ; 1d222 (7:5222)
	TX_FAR _OaksLabMonEnergeticText
	db $50
; 0x1d222 + 5 bytes

OaksLabReceivedMonText: ; 1d227 (7:5227)
	TX_FAR _OaksLabReceivedMonText ; 0x94ea0
	db $11, $50
; 0x1d22d

Unknown_1d22d: ; 1d22d (7:522d)
	ld a, $5
	ld [$ff00+$8c], a
	ld a, $9
	ld [$ff00+$8b], a
	call Func_34fc
	ld [hl], $0
	ld hl, OaksLabLastMonText ; $5243
	call PrintText
	jp TextScriptEnd

OaksLabLastMonText: ; 1d243 (7:5243)
	TX_FAR _OaksLabLastMonText
	db $50
; 0x1d248

OaksLabText32: ; 1d248 (7:5248)
OaksLabText5: ; 1d248 (7:5248)
	db $08 ; asm
	ld a, [$d747]
	bit 6, a
	jr nz, .asm_50e81 ; 0x1d24e
	ld hl, $d2f7
	ld b, $13
	call CountSetBits
	ld a, [$d11e]
	cp $2
	jr c, .asm_b28b0 ; 0x1d25d
	ld a, [$d74b]
	bit 5, a
	jr z, .asm_b28b0 ; 0x1d264
.asm_50e81 ; 0x1d266
	ld hl, UnnamedText_1d31d
	call PrintText
	ld a, $1
	ld [$cc3c], a
	ld a, $56
	call Predef
	jp .asm_0f042
.asm_b28b0 ; 0x1d279
	ld b,POKE_BALL
	call IsItemInBag
	jr nz, .asm_17c30 ; 0x1d27e
	ld a, [$d7eb]
	bit 5, a
	jr nz, .asm_f1adc ; 0x1d285
	ld a, [$d74b]
	bit 5, a
	jr nz, .asm_333a2 ; 0x1d28c
	bit 3, a
	jr nz, .asm_76269 ; 0x1d290
	ld a, [$d72e]
	bit 3, a
	jr nz, .asm_4a5e0 ; 0x1d297
	ld hl, UnnamedText_1d2f0
	call PrintText
	jr .asm_0f042 ; 0x1d29f
.asm_4a5e0 ; 0x1d2a1
	ld hl, UnnamedText_1d2f5
	call PrintText
	jr .asm_0f042 ; 0x1d2a7
.asm_76269 ; 0x1d2a9
	ld b, OAKS_PARCEL
	call IsItemInBag
	jr nz, .asm_a8fcf ; 0x1d2ae
	ld hl, UnnamedText_1d2fa
	call PrintText
	jr .asm_0f042 ; 0x1d2b6
.asm_a8fcf ; 0x1d2b8
	ld hl, OaksLabDeliverParcelText
	call PrintText
	call Function1D00A
	ld a, $f
	ld [W_OAKSLABCURSCRIPT], a
	jr .asm_0f042 ; 0x1d2c6
.asm_333a2 ; 0x1d2c8
	ld hl, OaksLabAroundWorldText
	call PrintText
	jr .asm_0f042 ; 0x1d2ce
.asm_f1adc ; 0x1d2d0
	ld hl, $d74b
	bit 4, [hl]
	set 4, [hl]
	jr nz, .asm_17c30 ; 0x1d2d7
	ld bc, (POKE_BALL << 8) | 5
	call GiveItem
	ld hl, OaksLabGivePokeballsText
	call PrintText
	jr .asm_0f042 ; 0x1d2e5
.asm_17c30 ; 0x1d2e7
	ld hl, OaksLabPleaseVisitText
	call PrintText
.asm_0f042 ; 0x1d2ed
	jp TextScriptEnd
; 0x1d2f0

UnnamedText_1d2f0: ; 1d2f0 (7:52f0)
	TX_FAR _UnnamedText_1d2f0
	db $50
; 0x1d2f5

UnnamedText_1d2f5: ; 1d2f5 (7:52f5)
	TX_FAR _UnnamedText_1d2f5
	db $50
; 0x1d2fa

UnnamedText_1d2fa: ; 1d2fa (7:52fa)
	TX_FAR _UnnamedText_1d2fa
	db $50
; 0x1d2ff

OaksLabDeliverParcelText: ; 1d2ff (7:52ff)
	TX_FAR _OaksLabDeliverParcelText1 ; 0x94f69
	db $11
	TX_FAR _OaksLabDeliverParcelText2
	db $50
; 0x1d309

OaksLabAroundWorldText: ; 1d309 (7:5309)
	TX_FAR _OaksLabAroundWorldText
	db $50
; 0x1d30e

OaksLabGivePokeballsText: ; 1d30e (7:530e)
	TX_FAR _OaksLabGivePokeballsText1 ; 0x9506d
	db $11
	TX_FAR _OaksLabGivePokeballsText2
	db $50
; 0x1d318

OaksLabPleaseVisitText: ; 1d318 (7:5318)
	TX_FAR _OaksLabPleaseVisitText
	db $50
; 0x1d318 + 5 bytes

UnnamedText_1d31d: ; 1d31d (7:531d)
	TX_FAR _UnnamedText_1d31d
	db $50
; 0x1d31d + 5 bytes

OaksLabText34: ; 1d322 (7:5322)
OaksLabText33: ; 1d322 (7:5322)
OaksLabText7: ; 1d322 (7:5322)
OaksLabText6: ; 1d322 (7:5322)
	db $08 ; asm
	ld hl, UnnamedText_1d32c
	call PrintText
	jp TextScriptEnd

UnnamedText_1d32c: ; 1d32c (7:532c)
	TX_FAR _UnnamedText_1d32c
	db $50
; 0x1d32c + 5 bytes

OaksLabText35: ; 1d331 (7:5331)
OaksLabText8: ; 1d331 (7:5331)
	TX_FAR _OaksLabText8
	db $50

OaksLabText36: ; 1d336 (7:5336)
OaksLabText9: ; 1d336 (7:5336)
	db $08 ; asm
	ld hl, UnnamedText_1d340
	call PrintText
	jp TextScriptEnd

UnnamedText_1d340: ; 1d340 (7:5340)
	TX_FAR _UnnamedText_1d340
	db $50
; 0x1d340 + 5 bytes

OaksLabText17: ; 1d345 (7:5345)
	db $8
	ld hl, OaksLabRivalWaitingText
	call PrintText
	jp TextScriptEnd
; 0x1d34f

OaksLabRivalWaitingText: ; 1d34f (7:534f)
	TX_FAR _OaksLabRivalWaitingText
	db $50
; 0x1d34f + 5 bytes

OaksLabText18: ; 1d354 (7:5354)
	db $8
	ld hl, OaksLabChooseMonText
	call PrintText
	jp TextScriptEnd
; 0x1d35e

OaksLabChooseMonText: ; 1d35e (7:535e)
	TX_FAR _OaksLabChooseMonText
	db $50
; 0x1d35e + 5 bytes

OaksLabText19: ; 1d363 (7:5363)
	db $8
	ld hl, OaksLabRivalInterjectionText
	call PrintText
	jp TextScriptEnd
; 0x1d36d

OaksLabRivalInterjectionText: ; 1d36d (7:536d)
	TX_FAR _OaksLabRivalInterjectionText
	db $50
; 0x1d36d + 5 bytes

OaksLabText20: ; 1d372 (7:5372)
	db $8
	ld hl, OaksLabBePatientText
	call PrintText
	jp TextScriptEnd
; 0x1d37c

OaksLabBePatientText: ; 1d37c (7:537c)
	TX_FAR _OaksLabBePatientText
	db $50
; 0x1d37c + 5 bytes

OaksLabText12: ; 1d381 (7:5381)
	db $8
	ld hl, OaksLabLeavingText
	call PrintText
	jp TextScriptEnd
; 0x1d38b

OaksLabLeavingText: ; 1d38b (7:538b)
	TX_FAR _OaksLabLeavingText
	db $50
; 0x1d38b + 5 bytes

OaksLabText13: ; 1d390 (7:5390)
	db $8
	ld hl, OaksLabRivalPickingMonText
	call PrintText
	jp TextScriptEnd
; 0x1d39a

OaksLabRivalPickingMonText: ; 1d39a (7:539a)
	TX_FAR _OaksLabRivalPickingMonText
	db $50
; 0x1d39f

OaksLabText14: ; 1d39f (7:539f)
	db $8
	ld hl, OaksLabRivalReceivedMonText
	call PrintText
	jp TextScriptEnd
; 0x1d3a9

OaksLabRivalReceivedMonText: ; 1d3a9 (7:53a9)
	TX_FAR _OaksLabRivalReceivedMonText ; 0x95461
	db $11, $50
; 0x1d3af

OaksLabText15: ; 1d3af (7:53af)
	db $8
	ld hl, OaksLabRivalChallengeText
	call PrintText
	jp TextScriptEnd
; 0x1d3b9

OaksLabRivalChallengeText: ; 1d3b9 (7:53b9)
	TX_FAR _OaksLabRivalChallengeText
	db $50
; 0x1d3be

UnnamedText_1d3be: ; 1d3be (7:53be)
	TX_FAR _UnnamedText_1d3be
	db $50
; 0x1d3c3

UnnamedText_1d3c3: ; 1d3c3 (7:53c3)
	TX_FAR _UnnamedText_1d3c3
	db $50
; 0x1d3c8

OaksLabText16: ; 1d3c8 (7:53c8)
	db $8
	ld hl, OaksLabRivalToughenUpText
	call PrintText
	jp TextScriptEnd
; 0x1d3d2

OaksLabRivalToughenUpText: ; 1d3d2 (7:53d2)
	TX_FAR _OaksLabRivalToughenUpText
	db $50
; 0x1d3d7

OaksLabText21: ; 1d3d7 (7:53d7)
	TX_FAR _OaksLabText21
	db $50
; 0x1d3dc

OaksLabText22: ; 1d3dc (7:53dc)
	TX_FAR _OaksLabText22
	db $50
; 0x1d3e1

OaksLabText23: ; 1d3e1 (7:53e1)
	TX_FAR _OaksLabText23
	db $50
; 0x1d3e6

OaksLabText24: ; 1d3e6 (7:53e6)
	TX_FAR _OaksLabText24
	db $50
; 0x1d3eb

OaksLabText25: ; 1d3eb (7:53eb)
	TX_FAR _OaksLabText25
	db $11, $50
; 0x1d3f1

OaksLabText26: ; 1d3f1 (7:53f1)
	TX_FAR _OaksLabText26
	db $50
; 0x1d3f6

OaksLabText27: ; 1d3f6 (7:53f6)
	TX_FAR _OaksLabText27
	db $50
; 0x1d3fb

OaksLabText38: ; 1d3fb (7:53fb)
OaksLabText37: ; 1d3fb (7:53fb)
OaksLabText11: ; 1d3fb (7:53fb)
OaksLabText10: ; 1d3fb (7:53fb)
	db $08 ; asm
	ld hl, UnnamedText_1d405
	call PrintText
	jp TextScriptEnd

UnnamedText_1d405: ; 1d405 (7:5405)
	TX_FAR _UnnamedText_1d405
	db $50
; 0x1d405 + 5 bytes

OaksLabObject: ; 0x1d40a (size=88)
	db $3 ; border tile

	db $2 ; warps
	db $b, $4, $2, $ff
	db $b, $5, $2, $ff

	db $0 ; signs

	db $b ; people
	db SPRITE_BLUE, $3 + 4, $4 + 4, $ff, $ff, $41, SONY1 + $C8, $1 ; trainer
	db SPRITE_BALL, $3 + 4, $6 + 4, $ff, $ff, $2 ; person
	db SPRITE_BALL, $3 + 4, $7 + 4, $ff, $ff, $3 ; person
	db SPRITE_BALL, $3 + 4, $8 + 4, $ff, $ff, $4 ; person
	db SPRITE_OAK, $2 + 4, $5 + 4, $ff, $d0, $5 ; person
	db SPRITE_BOOK_MAP_DEX, $1 + 4, $2 + 4, $ff, $ff, $6 ; person
	db SPRITE_BOOK_MAP_DEX, $1 + 4, $3 + 4, $ff, $ff, $7 ; person
	db SPRITE_OAK, $a + 4, $5 + 4, $ff, $d1, $8 ; person
	db SPRITE_GIRL, $9 + 4, $1 + 4, $fe, $1, $9 ; person
	db SPRITE_OAK_AIDE, $a + 4, $2 + 4, $ff, $ff, $a ; person
	db SPRITE_OAK_AIDE, $a + 4, $8 + 4, $ff, $ff, $b ; person

	; warp-to
	EVENT_DISP $5, $b, $4
	EVENT_DISP $5, $b, $5

ViridianMart_h: ; 0x1d462 to 0x1d46e (12 bytes) (bank=7) (id=42)
	db $02 ; tileset
	db VIRIDIAN_MART_HEIGHT, VIRIDIAN_MART_WIDTH ; dimensions (y, x)
	dw ViridianMartBlocks, ViridianMartTexts, ViridianMartScript ; blocks, texts, scripts
	db $00 ; connections

	dw ViridianMartObject ; objects

ViridianMartScript: ; 1d46e (7:546e)
	call ViridianMartScript_Unknown1d47d
	call EnableAutoTextBoxDrawing
	ld hl, ViridianMartScriptPointers
	ld a, [W_VIRIDIANMARKETCURSCRIPT]
	jp CallFunctionInTable
; 0x1d47d

ViridianMartScript_Unknown1d47d: ; 1d47d (7:547d)
	ld a, [$d74e]
	bit 0, a
	jr nz, .asm_1d489 ; 0x1d482 $5
	ld hl, ViridianMartTexts ; $54e0
	jr .asm_1d48c ; 0x1d487 $3
.asm_1d489
	ld hl, ViridianMartTexts + $a ; $54ea ; starts at ViridianMartText6
.asm_1d48c
	ld a, l
	ld [W_MAPTEXTPTR], a
	ld a, h
	ld [W_MAPTEXTPTR+1], a
	ret

ViridianMartScriptPointers: ; 1d495 (7:5495)
	dw ViridianMartScript0
	dw ViridianMartScript1
	dw ViridianMartScript2

ViridianMartScript0: ; 1d49b (7:549b)
	call UpdateSprites
	ld a, $4
	ld [$ff00+$8c], a
	call DisplayTextID
	ld hl, $ccd3
	ld de, RLEMovement1d4bb
	call DecodeRLEList
	dec a
	ld [$cd38], a
	call Func_3486
	ld a, $1
	ld [W_VIRIDIANMARKETCURSCRIPT], a
	ret

RLEMovement1d4bb: ; 1d4bb (7:54bb)
	db $20
	TX_RAM $0240
	db $ff

ViridianMartScript1: ; 1d4c0 (7:54c0)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	ld a, $5
	ld [$ff00+$8c], a
	call DisplayTextID
	ld bc, (OAKS_PARCEL << 8) + 1
	call GiveItem
	ld hl, $d74e
	set 1, [hl]
	ld a, $2
	ld [W_VIRIDIANMARKETCURSCRIPT], a
	; fallthrough
ViridianMartScript2: ; 1d4df (7:54df)
	ret
; 0x1d4e0

ViridianMartTexts: ; 1d4e0 (7:54e0)
	dw ViridianMartText1
	dw ViridianMartText2
	dw ViridianMartText3
	dw ViridianMartText4
	dw ViridianMartText5
	dw ViridianMartText6
	dw ViridianMartText2
	dw ViridianMartText3

ViridianMartText1: ; 1d4f0 (7:54f0)
	TX_FAR _ViridianMartText1
	db $50

ViridianMartText4: ; 1d4f5 (7:54f5)
	TX_FAR _ViridianMartText4
	db $50

ViridianMartText5: ; 1d4fa (7:54fa)
	TX_FAR ViridianMartParcelQuestText
	db $11
	db $50

ViridianMartText2: ; 1d500 (7:5500)
	TX_FAR _ViridianMartText2
	db $50

ViridianMartText3: ; 1d505 (7:5505)
	TX_FAR _ViridianMartText3
	db $50

ViridianMartObject: ; 0x1d50a (size=38)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $1, $ff
	db $7, $4, $1, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_MART_GUY, $5 + 4, $0 + 4, $ff, $d3, $1 ; person
	db SPRITE_BUG_CATCHER, $5 + 4, $5 + 4, $fe, $1, $2 ; person
	db SPRITE_BLACK_HAIR_BOY_1, $3 + 4, $3 + 4, $ff, $ff, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4

ViridianMartBlocks: ; 1d530 (7:5530)
	INCBIN "maps/viridianmart.blk"

School_h: ; 0x1d540 to 0x1d54c (12 bytes) (bank=7) (id=43)
	db $08 ; tileset
	db VIRIDIAN_SCHOOL_HEIGHT, VIRIDIAN_SCHOOL_WIDTH ; dimensions (y, x)
	dw SchoolBlocks, SchoolTexts, SchoolScript ; blocks, texts, scripts
	db $00 ; connections

	dw SchoolObject ; objects

SchoolScript: ; 1d54c (7:554c)
	jp EnableAutoTextBoxDrawing
; 0x1d54f

SchoolTexts: ; 1d54f (7:554f)
	dw SchoolText1, SchoolText2

SchoolText1: ; 1d553 (7:5553)
	TX_FAR _SchoolText1
	db $50

SchoolText2: ; 1d558 (7:5558)
	TX_FAR _SchoolText2
	db $50

SchoolObject: ; 0x1d55d (size=32)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $2, $ff
	db $7, $3, $2, $ff

	db $0 ; signs

	db $2 ; people
	db SPRITE_BRUNETTE_GIRL, $5 + 4, $3 + 4, $ff, $d1, $1 ; person
	db SPRITE_LASS, $1 + 4, $4 + 4, $ff, $d0, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

ViridianHouse_h: ; 0x1d57d to 0x1d589 (12 bytes) (bank=7) (id=44)
	db $08 ; tileset
	db VIRIDIAN_HOUSE_HEIGHT, VIRIDIAN_HOUSE_WIDTH ; dimensions (y, x)
	dw ViridianHouseBlocks, ViridianHouseTexts, ViridianHouseScript ; blocks, texts, scripts
	db $00 ; connections

	dw ViridianHouseObject ; objects

; 0x1d589
db $0

ViridianHouseScript: ; 1d58a (7:558a)
	jp EnableAutoTextBoxDrawing
; 0x1d58d

ViridianHouseTexts: ; 1d58d (7:558d)
	dw ViridianHouseText1, ViridianHouseText2, ViridianHouseText3, ViridianHouseText4

ViridianHouseText1: ; 1d595 (7:5595)
	TX_FAR _ViridianHouseText1
	db $50

ViridianHouseText2: ; 1d59a (7:559a)
	TX_FAR _ViridianHouseText2
	db $50

ViridianHouseText3: ; 1d59f (7:559f)
	db $08 ; asm
	ld hl, UnnamedText_1d5b1
	call PrintText
	ld a, SPEAROW
	call PlayCry
	call WaitForSoundToFinish
	jp TextScriptEnd

UnnamedText_1d5b1: ; 1d5b1 (7:55b1)
	TX_FAR _UnnamedText_1d5b1
	db $50
; 0x1d5b1 + 5 bytes

ViridianHouseText4: ; 1d5b6 (7:55b6)
	TX_FAR _ViridianHouseText4
	db $50

ViridianHouseObject: ; 0x1d5bb (size=44)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $3, $ff
	db $7, $3, $3, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_BALDING_GUY, $3 + 4, $5 + 4, $ff, $ff, $1 ; person
	db SPRITE_LITTLE_GIRL, $4 + 4, $1 + 4, $fe, $1, $2 ; person
	db SPRITE_BIRD, $5 + 4, $5 + 4, $fe, $2, $3 ; person
	db SPRITE_CLIPBOARD, $0 + 4, $4 + 4, $ff, $ff, $4 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

PewterHouse1_h: ; 0x1d5e7 to 0x1d5f3 (12 bytes) (bank=7) (id=55)
	db $08 ; tileset
	db PEWTER_HOUSE_1_HEIGHT, PEWTER_HOUSE_1_WIDTH ; dimensions (y, x)
	dw PewterHouse1Blocks, PewterHouse1Texts, PewterHouse1Script ; blocks, texts, scripts
	db $00 ; connections

	dw PewterHouse1Object ; objects

PewterHouse1Script: ; 1d5f3 (7:55f3)
	jp EnableAutoTextBoxDrawing
; 0x1d5f6

PewterHouse1Texts: ; 1d5f6 (7:55f6)
	dw PewterHouse1Text1, PewterHouse1Text2, PewterHouse1Text3

PewterHouse1Text1: ; 1d5fc (7:55fc)
	TX_FAR _PewterHouse1Text1
	db $08 ; asm
	ld a, NIDORAN_M
	call PlayCry
	call WaitForSoundToFinish
	jp TextScriptEnd

PewterHouse1Text2: ; 1d60c (7:560c)
	TX_FAR _PewterHouse1Text2
	db $50

PewterHouse1Text3: ; 1d611 (7:5611)
	TX_FAR _PewterHouse1Text3
	db $50

PewterHouse1Object: ; 0x1d616 (size=38)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $3, $ff
	db $7, $3, $3, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_SLOWBRO, $5 + 4, $4 + 4, $ff, $d2, $1 ; person
	db SPRITE_YOUNG_BOY, $5 + 4, $3 + 4, $ff, $d3, $2 ; person
	db SPRITE_FAT_BALD_GUY, $2 + 4, $1 + 4, $ff, $ff, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

PewterHouse2_h: ; 0x1d63c to 0x1d648 (12 bytes) (bank=7) (id=57)
	db $08 ; tileset
	db PEWTER_HOUSE_2_HEIGHT, PEWTER_HOUSE_2_WIDTH ; dimensions (y, x)
	dw PewterHouse2Blocks, PewterHouse2Texts, PewterHouse2Script ; blocks, texts, scripts
	db $00 ; connections

	dw PewterHouse2Object ; objects

PewterHouse2Script: ; 1d648 (7:5648)
	jp EnableAutoTextBoxDrawing
; 0x1d64b

PewterHouse2Texts: ; 1d64b (7:564b)
	dw PewterHouse2Text1, PewterHouse2Text2

PewterHouse2Text1: ; 1d64f (7:564f)
	TX_FAR _PewterHouse2Text1
	db $50

PewterHouse2Text2: ; 1d654 (7:5654)
	TX_FAR _PewterHouse2Text2
	db $50

PewterHouse2Object: ; 0x1d659 (size=32)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $5, $ff
	db $7, $3, $5, $ff

	db $0 ; signs

	db $2 ; people
	db SPRITE_GAMBLER, $3 + 4, $2 + 4, $ff, $d3, $1 ; person
	db SPRITE_BUG_CATCHER, $5 + 4, $4 + 4, $ff, $ff, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

CeruleanHouseTrashed_h: ; 0x1d679 to 0x1d685 (12 bytes) (bank=7) (id=62)
	db $08 ; tileset
	db TRASHED_HOUSE_HEIGHT, TRASHED_HOUSE_WIDTH ; dimensions (y, x)
	dw CeruleanHouseTrashedBlocks, CeruleanHouseTrashedTexts, CeruleanHouseTrashedScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeruleanHouseTrashedObject ; objects

CeruleanHouseTrashedScript: ; 1d685 (7:5685)
	call EnableAutoTextBoxDrawing
	ret
; 0x1d689

CeruleanHouseTrashedTexts: ; 1d689 (7:5689)
	dw CeruleanHouseTrashedText1, CeruleanHouseTrashedText2, CeruleanHouseTrashedText3

CeruleanHouseTrashedText1: ; 1d68f (7:568f)
	db $08 ; asm
	ld b, $e4
	ld a, $1c
	call Predef
	and b
	jr z, .asm_f8734 ; 0x1d698
	ld hl, UnnamedText_1d6b0
	call PrintText
	jr .asm_8dfe9 ; 0x1d6a0
.asm_f8734 ; 0x1d6a2
	ld hl, UnnamedText_1d6ab
	call PrintText
.asm_8dfe9 ; 0x1d6a8
	jp TextScriptEnd

UnnamedText_1d6ab: ; 1d6ab (7:56ab)
	TX_FAR _UnnamedText_1d6ab
	db $50
; 0x1d6ab + 5 bytes

UnnamedText_1d6b0: ; 1d6b0 (7:56b0)
	TX_FAR _UnnamedText_1d6b0
	db $50
; 0x1d6b0 + 5 bytes

CeruleanHouseTrashedText2: ; 1d6b5 (7:56b5)
	TX_FAR _CeruleanHouseTrashedText2
	db $50

CeruleanHouseTrashedText3: ; 1d6ba (7:56ba)
	TX_FAR _CeruleanHouseTrashedText3
	db $50

CeruleanHouseTrashedObject: ; 0x1d6bf (size=43)
	db $a ; border tile

	db $3 ; warps
	db $7, $2, $0, $ff
	db $7, $3, $0, $ff
	db $0, $3, $7, $ff

	db $1 ; signs
	db $0, $3, $3 ; CeruleanHouseTrashedText3

	db $2 ; people
	db SPRITE_FISHER, $1 + 4, $2 + 4, $ff, $d0, $1 ; person
	db SPRITE_GIRL, $6 + 4, $5 + 4, $fe, $2, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $0, $3

CeruleanHouse2_h: ; 0x1d6ea to 0x1d6f6 (12 bytes) (bank=7) (id=63)
	db $08 ; tileset
	db CERULEAN_HOUSE_HEIGHT, CERULEAN_HOUSE_WIDTH ; dimensions (y, x)
	dw CeruleanHouse2Blocks, CeruleanHouse2Texts, CeruleanHouse2Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeruleanHouse2Object ; objects

CeruleanHouse2Script: ; 1d6f6 (7:56f6)
	jp EnableAutoTextBoxDrawing
; 0x1d6f9

CeruleanHouse2Texts: ; 1d6f9 (7:56f9)
	dw CeruleanHouse2Text1, CeruleanHouse2Text2

CeruleanHouse2Text1: ; 1d6fd (7:56fd)
	TX_FAR _CeruleanHouse2Text1
	db $50

CeruleanHouse2Text2: ; 1d702 (7:5702)
	db $08 ; asm
	ld a, $6
	ld [W_WHICHTRADE], a
	ld a, $54
	call Predef
	jp TextScriptEnd

CeruleanHouse2Object: ; 0x1d710 (size=32)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $1, $ff
	db $7, $3, $1, $ff

	db $0 ; signs

	db $2 ; people
	db SPRITE_OLD_MEDIUM_WOMAN, $4 + 4, $5 + 4, $ff, $d2, $1 ; person
	db SPRITE_GAMBLER, $2 + 4, $1 + 4, $ff, $ff, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

BikeShop_h: ; 0x1d730 to 0x1d73c (12 bytes) (bank=7) (id=66)
	db $15 ; tileset
	db BIKE_SHOP_HEIGHT, BIKE_SHOP_WIDTH ; dimensions (y, x)
	dw BikeShopBlocks, BikeShopTexts, BikeShopScript ; blocks, texts, scripts
	db $00 ; connections

	dw BikeShopObject ; objects

BikeShopScript: ; 1d73c (7:573c)
	jp EnableAutoTextBoxDrawing
; 0x1d73f

BikeShopTexts: ; 1d73f (7:573f)
	dw BikeShopText1, BikeShopText2, BikeShopText3

BikeShopText1: ; 1d745 (7:5745)
	db $08 ; asm
	ld a, [$d75f]
	bit 0, a
	jr z, .asm_260d4 ; 0x1d74b
	ld hl, UnnamedText_1d82f
	call PrintText
	jp .Done
.asm_260d4 ; 0x1d756
	ld b, BIKE_VOUCHER
	call IsItemInBag
	jr z, .asm_41190 ; 0x1d75b
	ld hl, UnnamedText_1d81f
	call PrintText
	ld bc, (BICYCLE << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a, BIKE_VOUCHER
	ldh [$db], a
	ld b, BANK(RemoveItemByID)
	ld hl, RemoveItemByID
	call Bankswitch
	ld hl, $d75f
	set 0, [hl]
	ld hl, UnnamedText_1d824
	call PrintText
	jr .Done
.BagFull
	ld hl, UnnamedText_1d834
	call PrintText
	jr .Done
.asm_41190 ; 0x1d78c
	ld hl, UnnamedText_1d810
	call PrintText
	xor a
	ld [$cc26], a
	ld [$cc2a], a
	ld a, $3
	ld [$cc29], a
	ld a, $1
	ld [$cc28], a
	ld a, $2
	ld [$cc24], a
	ld a, $1
	ld [$cc25], a
	ld hl, $d730
	set 6, [hl]
	ld hl, W_SCREENTILESBUFFER
	ld b, $4
	ld c, $f
	call TextBoxBorder
	call UpdateSprites
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	ld de, BikeShopMenuText
	call PlaceString
	FuncCoord 8, 3 ; $c3e4
	ld hl, Coord
	ld de, BikeShopMenuPrice
	call PlaceString
	ld hl, UnnamedText_1d815
	call PrintText
	call HandleMenuInput
	bit 1, a
	jr nz, .asm_b7579 ; 0x1d7dc
	ld hl, $d730
	res 6, [hl]
	ld a, [$cc26]
	and a
	jr nz, .asm_b7579 ; 0x1d7e7
	ld hl, UnnamedText_1d81a
	call PrintText
.asm_b7579 ; 0x1d7ef
	ld hl, UnnamedText_1d82a
	call PrintText
.Done
	jp TextScriptEnd

BikeShopMenuText: ; 1d7f8 (7:57f8)
	db "BICYCLE", $4e
	db "CANCEL@"

BikeShopMenuPrice: ; 1d807 (7:5807)
	db "¥1000000@"

UnnamedText_1d810: ; 1d810 (7:5810)
	TX_FAR _UnnamedText_1d810
	db $50
; 0x1d810 + 5 bytes

UnnamedText_1d815: ; 1d815 (7:5815)
	TX_FAR _UnnamedText_1d815
	db $50
; 0x1d815 + 5 bytes

UnnamedText_1d81a: ; 1d81a (7:581a)
	TX_FAR _UnnamedText_1d81a
	db $50
; 0x1d81a + 5 bytes

UnnamedText_1d81f: ; 1d81f (7:581f)
	TX_FAR _UnnamedText_1d81f
	db $50
; 0x1d81f + 5 bytes

UnnamedText_1d824: ; 1d824 (7:5824)
	TX_FAR _UnnamedText_1d824 ; 0x98eb2
	db $11, $50

UnnamedText_1d82a: ; 1d82a (7:582a)
	TX_FAR _UnnamedText_1d82a
	db $50
; 0x1d82a + 5 bytes

UnnamedText_1d82f: ; 1d82f (7:582f)
	TX_FAR _UnnamedText_1d82f
	db $50
; 0x1d82f + 5 bytes

UnnamedText_1d834: ; 1d834 (7:5834)
	TX_FAR _UnnamedText_1d834
	db $50
; 0x1d834 + 5 bytes

BikeShopText2: ; 1d839 (7:5839)
	db $08 ; asm
	ld hl, UnnamedText_1d843
	call PrintText
	jp TextScriptEnd

UnnamedText_1d843: ; 1d843 (7:5843)
	TX_FAR _UnnamedText_1d843
	db $50
; 0x1d843 + 5 bytes

BikeShopText3: ; 1d848 (7:5848)
	db $08 ; asm
	ld a, [$d75f]
	bit 0, a
	ld hl, UnnamedText_1d861
	jr nz, .asm_34d2d ; 0x1d851
	ld hl, UnnamedText_1d85c
.asm_34d2d ; 0x1d856
	call PrintText
	jp TextScriptEnd

UnnamedText_1d85c: ; 1d85c (7:585c)
	TX_FAR _UnnamedText_1d85c
	db $50
; 0x1d85c + 5 bytes

UnnamedText_1d861: ; 1d861 (7:5861)
	TX_FAR _UnnamedText_1d861
	db $50
; 0x1d861 + 5 bytes

BikeShopObject: ; 0x1d866 (size=38)
	db $e ; border tile

	db $2 ; warps
	db $7, $2, $4, $ff
	db $7, $3, $4, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_BIKE_SHOP_GUY, $2 + 4, $6 + 4, $ff, $ff, $1 ; person
	db SPRITE_MOM_GEISHA, $6 + 4, $5 + 4, $fe, $1, $2 ; person
	db SPRITE_BUG_CATCHER, $3 + 4, $1 + 4, $ff, $d1, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

BikeShopBlocks: ; 1d88c (7:588c)
	INCBIN "maps/bikeshop.blk"

LavenderHouse1_h: ; 0x1d89c to 0x1d8a8 (12 bytes) (bank=7) (id=149)
	db $08 ; tileset
	db LAVENDER_HOUSE_1_HEIGHT, LAVENDER_HOUSE_1_WIDTH ; dimensions (y, x)
	dw LavenderHouse1Blocks, LavenderHouse1Texts, LavenderHouse1Script ; blocks, texts, scripts
	db $00 ; connections

	dw LavenderHouse1Object ; objects

LavenderHouse1Script: ; 1d8a8 (7:58a8)
	call EnableAutoTextBoxDrawing
	ret
; 0x1d8ac

LavenderHouse1Texts: ; 1d8ac (7:58ac)
	dw LavenderHouse1Text1, LavenderHouse1Text2, LavenderHouse1Text3, LavenderHouse1Text4, LavenderHouse1Text5, LavenderHouse1Text6

LavenderHouse1Text1: ; 1d8b8 (7:58b8)
	db $08 ; asm
	ld a, [$d7e0]
	bit 7, a
	jr nz, .asm_72e5d ; 0x1d8be
	ld hl, UnnamedText_1d8d1
	call PrintText
	jr .asm_6957f ; 0x1d8c6
.asm_72e5d ; 0x1d8c8
	ld hl, UnnamedText_1d8d6
	call PrintText
.asm_6957f ; 0x1d8ce
	jp TextScriptEnd

UnnamedText_1d8d1: ; 1d8d1 (7:58d1)
	TX_FAR _UnnamedText_1d8d1
	db $50
; 0x1d8d1 + 5 bytes

UnnamedText_1d8d6: ; 1d8d6 (7:58d6)
	TX_FAR _UnnamedText_1d8d6
	db $50
; 0x1d8d6 + 5 bytes

LavenderHouse1Text2: ; 1d8db (7:58db)
	db $08 ; asm
	ld a, [$d7e0]
	bit 7, a
	jr nz, .asm_06470 ; 0x1d8e1
	ld hl, UnnamedText_1d8f4
	call PrintText
	jr .asm_3d208 ; 0x1d8e9
.asm_06470 ; 0x1d8eb
	ld hl, UnnamedText_1d8f9
	call PrintText
.asm_3d208 ; 0x1d8f1
	jp TextScriptEnd

UnnamedText_1d8f4: ; 1d8f4 (7:58f4)
	TX_FAR _UnnamedText_1d8f4
	db $50
; 0x1d8f4 + 5 bytes

UnnamedText_1d8f9: ; 1d8f9 (7:58f9)
	TX_FAR _UnnamedText_1d8f9
	db $50
; 0x1d8f9 + 5 bytes

LavenderHouse1Text3: ; 1d8fe (7:58fe)
	TX_FAR _LavenderHouse1Text3
	db $8
	ld a, PSYDUCK
	call PlayCry
	jp TextScriptEnd

LavenderHouse1Text4: ; 1d90b (7:590b)
	TX_FAR _LavenderHouse1Text4
	db $8
	ld a, NIDORINO
	call PlayCry
	jp TextScriptEnd
; 0x1d918

LavenderHouse1Text5: ; 1d918 (7:5918)
	db $08 ; asm
	ld a, [$d76c]
	bit 0, a
	jr nz, .asm_15ac2 ; 0x1d91e
	ld hl, UnnamedText_1d94c
	call PrintText
	ld bc, (POKE_FLUTE << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedFluteText
	call PrintText
	ld hl, $d76c
	set 0, [hl]
	jr .asm_da749 ; 0x1d939
.BagFull
	ld hl, FluteNoRoomText
	call PrintText
	jr .asm_da749 ; 0x1d941
.asm_15ac2 ; 0x1d943
	ld hl, MrFujiAfterFluteText
	call PrintText
.asm_da749 ; 0x1d949
	jp TextScriptEnd

UnnamedText_1d94c: ; 1d94c (7:594c)
	TX_FAR _UnnamedText_1d94c
	db $50
; 0x1d94c + 5 bytes

ReceivedFluteText: ; 1d951 (7:5951)
	TX_FAR _ReceivedFluteText ; 0x99ffb
	db $11
	TX_FAR _FluteExplanationText ; 0x9a011
	db $50
; 0x1d95b

FluteNoRoomText: ; 1d95b (7:595b)
	TX_FAR _FluteNoRoomText
	db $50
; 0x1d95b + 5 bytes

MrFujiAfterFluteText: ; 1d960 (7:5960)
	TX_FAR _MrFujiAfterFluteText
	db $50
; 0x1d960 + 5 bytes

LavenderHouse1Text6: ; 1d965 (7:5965)
	TX_FAR _LavenderHouse1Text6
	db $50

LavenderHouse1Object: ; 0x1d96a (size=56)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $2, $ff
	db $7, $3, $2, $ff

	db $0 ; signs

	db $6 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $5 + 4, $3 + 4, $ff, $ff, $1 ; person
	db SPRITE_LITTLE_GIRL, $3 + 4, $6 + 4, $ff, $d0, $2 ; person
	db SPRITE_SLOWBRO, $4 + 4, $6 + 4, $ff, $d1, $3 ; person
	db SPRITE_SLOWBRO, $3 + 4, $1 + 4, $ff, $ff, $4 ; person
	db SPRITE_MR_FUJI, $1 + 4, $3 + 4, $ff, $ff, $5 ; person
	db SPRITE_BOOK_MAP_DEX, $3 + 4, $3 + 4, $ff, $ff, $6 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

LavenderHouse2_h: ; 0x1d9a2 to 0x1d9ae (12 bytes) (bank=7) (id=151)
	db $08 ; tileset
	db LAVENDER_HOUSE_2_HEIGHT, LAVENDER_HOUSE_2_WIDTH ; dimensions (y, x)
	dw LavenderHouse2Blocks, LavenderHouse2Texts, LavenderHouse2Script ; blocks, texts, scripts
	db $00 ; connections

	dw LavenderHouse2Object ; objects

LavenderHouse2Script: ; 1d9ae (7:59ae)
	call EnableAutoTextBoxDrawing
	ret
; 0x1d9b2

LavenderHouse2Texts: ; 1d9b2 (7:59b2)
	dw LavenderHouse2Text1, LavenderHouse2Text2

LavenderHouse2Text1: ; 1d9b6 (7:59b6)
	TX_FAR _LavenderHouse2Text1
	db $8
	ld a, CUBONE
	call PlayCry
	jp TextScriptEnd
; 0x1d9c3

LavenderHouse2Text2: ; 1d9c3 (7:59c3)
	db $08 ; asm
	ld a, [$d7e0]
	bit 7, a
	jr nz, .asm_65711 ; 0x1d9c9
	ld hl, UnnamedText_1d9dc
	call PrintText
	jr .asm_64be1 ; 0x1d9d1
.asm_65711 ; 0x1d9d3
	ld hl, UnnamedText_1d9e1
	call PrintText
.asm_64be1 ; 0x1d9d9
	jp TextScriptEnd

UnnamedText_1d9dc: ; 1d9dc (7:59dc)
	TX_FAR _UnnamedText_1d9dc
	db $50
; 0x1d9dc + 5 bytes

UnnamedText_1d9e1: ; 1d9e1 (7:59e1)
	TX_FAR _UnnamedText_1d9e1
	db $50
; 0x1d9e1 + 5 bytes

LavenderHouse2Object: ; 0x1d9e6 (size=32)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $4, $ff
	db $7, $3, $4, $ff

	db $0 ; signs

	db $2 ; people
	db SPRITE_SLOWBRO, $5 + 4, $3 + 4, $ff, $d1, $1 ; person
	db SPRITE_BRUNETTE_GIRL, $4 + 4, $2 + 4, $ff, $d3, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

NameRater_h: ; 0x1da06 to 0x1da12 (12 bytes) (bank=7) (id=229)
	db $08 ; tileset
	db NAME_RATERS_HOUSE_HEIGHT, NAME_RATERS_HOUSE_WIDTH ; dimensions (y, x)
	dw NameRaterBlocks, NameRaterTexts, NameRaterScript ; blocks, texts, scripts
	db $00 ; connections

	dw NameRaterObject ; objects

NameRaterScript: ; 1da12 (7:5a12)
	jp EnableAutoTextBoxDrawing
; 0x1da15

Unknown_1da15: ; 1da15 (7:5a15)
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	ret

Unknown_1da20: ; 1da20 (7:5a20)
	ld hl, $d273
	ld bc, $000b
	ld a, [$cf92]
	call AddNTimes
	ld de, $d158
	ld c, $b
	call .asm_1da47
	jr c, .asm_1da52 ; 0x1da34 $1c
	ld hl, $d177
	ld bc, $002c
	ld a, [$cf92]
	call AddNTimes
	ld de, $d359
	ld c, $2
.asm_1da47
	ld a, [de]
	cp [hl]
	jr nz, .asm_1da52 ; 0x1da49 $7
	inc hl
	inc de
	dec c
	jr nz, .asm_1da47 ; 0x1da4e $f7
	and a
	ret
.asm_1da52
	scf
	ret

NameRaterTexts: ; 1da54 (7:5a54)
	dw NameRaterText1

NameRaterText1: ; 1da56 (7:5a56)
	db $8
	call SaveScreenTilesToBuffer2
	ld hl, UnnamedText_1dab3
	call Unknown_1da15
	jr nz, .asm_1daae ; 0x1da60 $4c
	ld hl, UnnamedText_1dab8
	call PrintText
	xor a
	ld [$d07d], a
	ld [$cfcb], a
	ld [$cc35], a
	call DisplayPartyMenu
	push af
	call GBPalWhiteOutWithDelay3
	call Func_3dbe
	call LoadGBPal
	pop af
	jr c, .asm_1daae ; 0x1da80 $2c
	call GetPartyMonName2
	call Unknown_1da20
	ld hl, UnnamedText_1dad1
	jr c, .asm_1daa8 ; 0x1da8b $1b
	ld hl, UnnamedText_1dabd
	call Unknown_1da15
	jr nz, .asm_1daae ; 0x1da93 $19
	ld hl, UnnamedText_1dac2
	call PrintText
	ld b, BANK(Func_655c)
	ld hl, Func_655c
	call Bankswitch
	jr c, .asm_1daae ; 0x1daa3 $9
	ld hl, UnnamedText_1dac7
.asm_1daa8
	call PrintText
	jp TextScriptEnd
.asm_1daae
	ld hl, UnnamedText_1dacc
	jr .asm_1daa8 ; 0x1dab1 $f5
; 0x1dab3

UnnamedText_1dab3: ; 1dab3 (7:5ab3)
	TX_FAR _UnnamedText_1dab3
	db $50
; 0x1dab3 + 5 bytes

UnnamedText_1dab8: ; 1dab8 (7:5ab8)
	TX_FAR _UnnamedText_1dab8
	db $50
; 0x1dab8 + 5 bytes

UnnamedText_1dabd: ; 1dabd (7:5abd)
	TX_FAR _UnnamedText_1dabd
	db $50
; 0x1dabd + 5 bytes

UnnamedText_1dac2: ; 1dac2 (7:5ac2)
	TX_FAR _UnnamedText_1dac2
	db $50
; 0x1dac2 + 5 bytes

UnnamedText_1dac7: ; 1dac7 (7:5ac7)
	TX_FAR _UnnamedText_1dac7
	db $50
; 0x1dac7 + 5 bytes

UnnamedText_1dacc: ; 1dacc (7:5acc)
	TX_FAR _UnnamedText_1dacc
	db $50
; 0x1dacc + 5 bytes

UnnamedText_1dad1: ; 1dad1 (7:5ad1)
	TX_FAR _UnnamedText_1dad1
	db $50
; 0x1dad1 + 5 bytes

NameRaterObject: ; 0x1dad6 (size=26)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $5, $ff
	db $7, $3, $5, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_MR_MASTERBALL, $3 + 4, $5 + 4, $ff, $d2, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

VermilionHouse1_h: ; 0x1daf0 to 0x1dafc (12 bytes) (bank=7) (id=93)
	db $08 ; tileset
	db VERMILION_HOUSE_1_HEIGHT, VERMILION_HOUSE_1_WIDTH ; dimensions (y, x)
	dw VermilionHouse1Blocks, VermilionHouse1Texts, VermilionHouse1Script ; blocks, texts, scripts
	db $00 ; connections

	dw VermilionHouse1Object ; objects

VermilionHouse1Script: ; 1dafc (7:5afc)
	call EnableAutoTextBoxDrawing
	ret
; 0x1db00

VermilionHouse1Texts: ; 1db00 (7:5b00)
	dw VermilionHouse1Text1, VermilionHouse1Text2, VermilionHouse1Text3

VermilionHouse1Text1: ; 1db06 (7:5b06)
	TX_FAR _VermilionHouse1Text1
	db $50

VermilionHouse1Text2: ; 1db0b (7:5b0b)
	TX_FAR _VermilionHouse1Text2
	db $08 ; asm
	ld a, PIDGEY
	call PlayCry
	call WaitForSoundToFinish
	jp TextScriptEnd

VermilionHouse1Text3: ; 1db1b (7:5b1b)
	TX_FAR _VermilionHouse1Text3
	db $50

VermilionHouse1Object: ; 0x1db20 (size=38)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $4, $ff
	db $7, $3, $4, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_BUG_CATCHER, $3 + 4, $5 + 4, $ff, $d2, $1 ; person
	db SPRITE_BIRD, $5 + 4, $3 + 4, $fe, $2, $2 ; person
	db SPRITE_PAPER_SHEET, $3 + 4, $4 + 4, $ff, $ff, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

VermilionDock_h: ; 0x1db46 to 0x1db52 (12 bytes) (bank=7) (id=94)
	db $0e ; tileset
	db VERMILION_DOCK_HEIGHT, VERMILION_DOCK_WIDTH ; dimensions (y, x)
	dw VermilionDockBlocks, VermilionDockTexts, VermilionDockScript ; blocks, texts, scripts
	db $00 ; connections

	dw VermilionDockObject ; objects

VermilionDockScript: ; 1db52 (7:5b52)
	call EnableAutoTextBoxDrawing
	ld hl, $d803
	bit 4, [hl]
	jr nz, .asm_1db8d ; 0x1db5a $31
	bit 0, [hl]
	ret z
	ld a, [$d42f]
	cp $1
	ret nz
	bit 2, [hl]
	jp z, VermilionDock_1db9b
	set 4, [hl]
	call Delay3
	ld hl, $d730
	set 7, [hl]
	ld hl, $ccd3
	ld a, $40
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld a, $3
	ld [$cd38], a
	xor a
	ld [$c206], a
	ld [$cd3b], a
	dec a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ret
.asm_1db8d
	bit 5, [hl]
	ret nz
	ld a, [$cd38]
	and a
	ret nz
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	set 5, [hl]
	ret
; 0x1db9b

VermilionDock_1db9b: ; 1db9b (7:5b9b)
	set 2, [hl]
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [$c0ee], a
	call PlaySound
	ld c, $1f
	ld a, $d6
	call PlayMusic
	ld b, BANK(Func_79fc0)
	ld hl, Func_79fc0
	call Bankswitch
	xor a
	ld [$c102], a
	ld c, $78
	call DelayFrames
	ld b, $9c
	call CopyScreenTileBufferToVRAM
	FuncCoord 0, 10 ; $c468
	ld hl, Coord
	ld bc, $0078
	ld a, $14
	call FillMemory
	ld a, $1
	ld [$ff00+$ba], a
	call Delay3
	xor a
	ld [$ff00+$ba], a
	ld [$cd3d], a
	ld [$ff00+$49], a
	ld a, $58
	ld [$cd3e], a
	ld hl, $d526
	ld c, [hl]
	inc hl
	ld b, [hl]
	push bc
	push hl
	ld a, $a9
	call PlaySoundWaitForCurrent
	ld a, $ff
	ld [$cfcb], a
	ld d, $0
	ld e, $8
.asm_1dbfa
	ld hl, $0002
	add hl, bc
	ld a, l
	ld [$d526], a
	ld a, h
	ld [$d527], a
	push hl
	push de
	call ScheduleEastColumnRedraw
	call VermilionDock_1dc59
	pop de
	ld b, $10
.asm_1dc11
	call VermilionDock_1dc42
	ld c, $8
.asm_1dc16
	call VermilionDock_1dc7c
	dec c
	jr nz, .asm_1dc16 ; 0x1dc1a $fa
	inc d
	dec b
	jr nz, .asm_1dc11 ; 0x1dc1e $f1
	pop bc
	dec e
	jr nz, .asm_1dbfa ; 0x1dc22 $d6
	xor a
	ld [$ff00+$4a], a
	ld [$ff00+$b0], a
	call VermilionDock_1dc94
	ld a, $90
	ld [$ff00+$b0], a
	ld a, $1
	ld [$cfcb], a
	pop hl
	pop bc
	ld [hl], b
	dec hl
	ld [hl], c
	call LoadPlayerSpriteGraphics
	ld hl, $d3ae
	dec [hl]
	ret

VermilionDock_1dc42: ; 1dc42 (7:5c42)
	push bc
	push de
	ld hl, $c311
	ld a, [$cd3d]
	swap a
	ld c, a
	ld de, $0004
.asm_1dc50
	inc [hl]
	inc [hl]
	add hl, de
	dec c
	jr nz, .asm_1dc50 ; 0x1dc54 $fa
	pop de
	pop bc
	ret

VermilionDock_1dc59: ; 1dc59 (7:5c59)
	ld a, [$cd3e]
	sub $10
	ld [$cd3e], a
	ld c, a
	ld b, $64
	ld a, [$cd3d]
	inc a
	ld [$cd3d], a
	ld a, $1
	ld de, VermilionDockOAMBlock
	call WriteOAMBlock
	ret

VermilionDockOAMBlock: ; 1dc74 (7:5c74)
	db $fc, $10
	db $fd, $10
	db $fe, $10
	db $ff, $10

VermilionDock_1dc7c: ; 1dc7c (7:5c7c)
	ld h, d
	ld l, $50
	call .asm_1dc86
	ld h, $0
	ld l, $80
.asm_1dc86
	ld a, [$ff00+$44]
	cp l
	jr nz, .asm_1dc86 ; 0x1dc89 $fb
	ld a, h
	ld [$ff00+$43], a
.asm_1dc8e
	ld a, [$ff00+$44]
	cp h
	jr z, .asm_1dc8e ; 0x1dc91 $fb
	ret

VermilionDock_1dc94: ; 1dc94 (7:5c94)
	ld hl, $cc5b
	ld bc, $00b4
	ld a, $14
	call FillMemory
	ld hl, $9940
	ld de, $cc5b
	ld bc, $000c
	call CopyVideoData
	ld hl, $c754
	ld a, $d
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld a, $a9
	call PlaySound
	ld c, $78
	call DelayFrames
	ret

VermilionDockTexts: ; 1dcbf (7:5cbf)
	db $c1, $5c

UnnamedText_1dcc1: ; 1dcc1 (7:5cc1)
	TX_FAR _UnnamedText_1dcc1
	db $50
; 0x1dcc1 + 5 bytes

VermilionDockObject: ; 0x1dcc6 (size=20)
	db $f ; border tile

	db $2 ; warps
	db $0, $e, $5, $ff
	db $2, $e, $1, SS_ANNE_1

	db $0 ; signs

	db $0 ; people

	; warp-to
	EVENT_DISP $e, $0, $e
	EVENT_DISP $e, $2, $e ; SS_ANNE_1

VermilionDockBlocks: ; 1dcda (7:5cda)
	INCBIN "maps/vermiliondock.blk"

CeladonMansion5_h: ; 0x1dd2e to 0x1dd3a (12 bytes) (bank=7) (id=132)
	db $08 ; tileset
	db CELADON_MANSION_5_HEIGHT, CELADON_MANSION_5_WIDTH ; dimensions (y, x)
	dw CeladonMansion5Blocks, CeladonMansion5Texts, CeladonMansion5Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMansion5Object ; objects

CeladonMansion5Script: ; 1dd3a (7:5d3a)
	jp EnableAutoTextBoxDrawing
; 0x1dd3d

CeladonMansion5Texts: ; 1dd3d (7:5d3d)
	dw CeladonMansion5Text1, CeladonMansion5Text2

CeladonMansion5Text1: ; 1dd41 (7:5d41)
	TX_FAR _CeladonMansion5Text1
	db $50

CeladonMansion5Text2: ; 1dd46 (7:5d46)
	db $08 ; asm
	ld bc,(EEVEE << 8) | 25
	call GivePokemon
	jr nc, .asm_24365 ; 0x1dd4d
	ld a, $45
	ld [$cc4d], a
	ld a, $11
	call Predef
.asm_24365 ; 0x1dd59
	jp TextScriptEnd

CeladonMansion5Object: ; 0x1dd5c (size=32)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $2, CELADON_MANSION_4
	db $7, $3, $2, CELADON_MANSION_4

	db $0 ; signs

	db $2 ; people
	db SPRITE_HIKER, $2 + 4, $2 + 4, $ff, $d0, $1 ; person
	db SPRITE_BALL, $3 + 4, $4 + 4, $ff, $ff, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2 ; CELADON_MANSION_4
	EVENT_DISP $4, $7, $3 ; CELADON_MANSION_4

FuchsiaMart_h: ; 0x1dd7c to 0x1dd88 (12 bytes) (bank=7) (id=152)
	db $02 ; tileset
	db FUCHSIA_MART_HEIGHT, FUCHSIA_MART_WIDTH ; dimensions (y, x)
	dw FuchsiaMartBlocks, FuchsiaMartTexts, FuchsiaMartScript ; blocks, texts, scripts
	db $00 ; connections

	dw FuchsiaMartObject ; objects

FuchsiaMartScript: ; 1dd88 (7:5d88)
	jp EnableAutoTextBoxDrawing
; 0x1dd8b

FuchsiaMartTexts: ; 1dd8b (7:5d8b)
	dw FuchsiaMartText1, FuchsiaMartText2, FuchsiaMartText3

FuchsiaMartText2: ; 1dd91 (7:5d91)
	TX_FAR _FuchsiaMartText2
	db $50

FuchsiaMartText3: ; 1dd96 (7:5d96)
	TX_FAR _FuchsiaMartText3
	db $50

FuchsiaMartObject: ; 0x1dd9b (size=38)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $0, $ff
	db $7, $4, $0, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_MART_GUY, $5 + 4, $0 + 4, $ff, $d3, $1 ; person
	db SPRITE_FAT_BALD_GUY, $2 + 4, $4 + 4, $ff, $ff, $2 ; person
	db SPRITE_LASS, $5 + 4, $6 + 4, $fe, $1, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4

FuchsiaMartBlocks: ; 1ddc1 (7:5dc1)
	INCBIN "maps/fuchsiamart.blk"

SaffronHouse1_h: ; 0x1ddd1 to 0x1dddd (12 bytes) (bank=7) (id=179)
	db $08 ; tileset
	db SAFFRON_HOUSE_1_HEIGHT, SAFFRON_HOUSE_1_WIDTH ; dimensions (y, x)
	dw SaffronHouse1Blocks, SaffronHouse1Texts, SaffronHouse1Script ; blocks, texts, scripts
	db $00 ; connections

	dw SaffronHouse1Object ; objects

SaffronHouse1Script: ; 1dddd (7:5ddd)
	jp EnableAutoTextBoxDrawing
; 0x1dde0

SaffronHouse1Texts: ; 1dde0 (7:5de0)
	dw SaffronHouse1Text1, SaffronHouse1Text2, SaffronHouse1Text3, SaffronHouse1Text4

SaffronHouse1Text1: ; 1dde8 (7:5de8)
	TX_FAR _SaffronHouse1Text1
	db $50

SaffronHouse1Text2: ; 1dded (7:5ded)
	TX_FAR _SaffronHouse1Text2
	db $8
	ld a, PIDGEY
	call PlayCry
	jp TextScriptEnd
; 0x1ddfa

SaffronHouse1Text3: ; 1ddfa (7:5dfa)
	TX_FAR _SaffronHouse1Text3
	db $50

SaffronHouse1Text4: ; 1ddff (7:5dff)
	TX_FAR _SaffronHouse1Text4
	db $50

SaffronHouse1Object: ; 0x1de04 (size=44)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $3, $ff
	db $7, $3, $3, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_BRUNETTE_GIRL, $3 + 4, $2 + 4, $ff, $d3, $1 ; person
	db SPRITE_BIRD, $4 + 4, $0 + 4, $fe, $1, $2 ; person
	db SPRITE_BUG_CATCHER, $1 + 4, $4 + 4, $ff, $d0, $3 ; person
	db SPRITE_PAPER_SHEET, $3 + 4, $3 + 4, $ff, $ff, $4 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

SaffronHouse2_h: ; 0x1de30 to 0x1de3c (12 bytes) (bank=7) (id=183)
	db $08 ; tileset
	db SAFFRON_HOUSE_2_HEIGHT, SAFFRON_HOUSE_2_WIDTH ; dimensions (y, x)
	dw SaffronHouse2Blocks, SaffronHouse2Texts, SaffronHouse2Script ; blocks, texts, scripts
	db $00 ; connections

	dw SaffronHouse2Object ; objects

SaffronHouse2Script: ; 1de3c (7:5e3c)
	jp EnableAutoTextBoxDrawing
; 0x1de3f

SaffronHouse2Texts: ; 1de3f (7:5e3f)
	dw SaffronHouse2Text1

SaffronHouse2Text1: ; 1de41 (7:5e41)
	db $08 ; asm
	ld a, [$d7bd]
	bit 0, a
	jr nz, .asm_9e72b ; 0x1de47
	ld hl, TM29PreReceiveText
	call PrintText
	ld bc,(TM_29 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedTM29Text
	call PrintText
	ld hl, $d7bd
	set 0, [hl]
	jr .asm_fe4e1 ; 0x1de62
.BagFull
	ld hl, TM29NoRoomText
	call PrintText
	jr .asm_fe4e1 ; 0x1de6a
.asm_9e72b ; 0x1de6c
	ld hl, TM29ExplanationText
	call PrintText
.asm_fe4e1 ; 0x1de72
	jp TextScriptEnd

TM29PreReceiveText: ; 1de75 (7:5e75)
	TX_FAR _TM29PreReceiveText
	db $50
; 0x1de75 + 5 bytes

ReceivedTM29Text: ; 1de7a (7:5e7a)
	TX_FAR _ReceivedTM29Text ; 0xa252a
	db $0B, $50
; 0x1de80

TM29ExplanationText: ; 1de80 (7:5e80)
	TX_FAR _TM29ExplanationText
	db $50
; 0x1de80 + 5 bytes

TM29NoRoomText: ; 1de85 (7:5e85)
	TX_FAR _TM29NoRoomText
	db $50
; 0x1de85 + 5 bytes

SaffronHouse2Object: ; 0x1de8a (size=26)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $7, $ff
	db $7, $3, $7, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_FISHER, $3 + 4, $5 + 4, $ff, $d2, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

DiglettsCaveRoute2_h: ; 0x1dea4 to 0x1deb0 (12 bytes) (bank=7) (id=46)
	db $11 ; tileset
	db DIGLETTS_CAVE_EXIT_HEIGHT, DIGLETTS_CAVE_EXIT_WIDTH ; dimensions (y, x)
	dw DiglettsCaveRoute2Blocks, DiglettsCaveRoute2Texts, DiglettsCaveRoute2Script ; blocks, texts, scripts
	db $00 ; connections

	dw DiglettsCaveRoute2Object ; objects

DiglettsCaveRoute2Script: ; 1deb0 (7:5eb0)
	ld a, $d
	ld [$d365], a
	jp EnableAutoTextBoxDrawing
; 0x1deb8

DiglettsCaveRoute2Texts: ; 1deb8 (7:5eb8)
	dw DiglettsCaveRoute2Text1

DiglettsCaveRoute2Text1: ; 1deba (7:5eba)
	TX_FAR _DiglettsCaveRoute2Text1
	db $50

DiglettsCaveRoute2Object: ; 0x1debf (size=34)
	db $7d ; border tile

	db $3 ; warps
	db $7, $2, $0, $ff
	db $7, $3, $0, $ff
	db $4, $4, $0, DIGLETTS_CAVE

	db $0 ; signs

	db $1 ; people
	db SPRITE_FISHER, $3 + 4, $3 + 4, $ff, $ff, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $4, $4 ; DIGLETTS_CAVE

Route2House_h: ; 0x1dee1 to 0x1deed (12 bytes) (bank=7) (id=48)
	db $08 ; tileset
	db ROUTE_2_HOUSE_HEIGHT, ROUTE_2_HOUSE_WIDTH ; dimensions (y, x)
	dw Route2HouseBlocks, Route2HouseTexts, Route2HouseScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route2HouseObject ; objects

Route2HouseScript: ; 1deed (7:5eed)
	jp EnableAutoTextBoxDrawing
; 0x1def0

Route2HouseTexts: ; 1def0 (7:5ef0)
	dw Route2HouseText1, Route2HouseText2

Route2HouseText1: ; 1def4 (7:5ef4)
	TX_FAR _Route2HouseText1
	db $50

Route2HouseText2: ; 1def9 (7:5ef9)
	db $08 ; asm
	ld a, $1
	ld [W_WHICHTRADE], a
	ld a, $54
	call Predef
	jp TextScriptEnd

Route2HouseObject: ; 0x1df07 (size=32)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $2, $ff
	db $7, $3, $2, $ff

	db $0 ; signs

	db $2 ; people
	db SPRITE_OAK_AIDE, $4 + 4, $2 + 4, $ff, $d3, $1 ; person
	db SPRITE_GAMEBOY_KID_COPY, $1 + 4, $4 + 4, $ff, $d0, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

Route5Gate_h: ; 0x1df27 to 0x1df33 (12 bytes) (bank=7) (id=70)
	db $0c ; tileset
	db ROUTE_5_GATE_HEIGHT, ROUTE_5_GATE_WIDTH ; dimensions (y, x)
	dw Route5GateBlocks, Route5GateTexts, Route5GateScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route5GateObject ; objects

Route5GateScript: ; 1df33 (7:5f33)
	call EnableAutoTextBoxDrawing
	ld a, [W_ROUTE5GATECURSCRIPT]
	ld hl, Route5GateScripts
	jp CallFunctionInTable
; 0x1df3f

Route5GateScripts: ; 1df3f (7:5f3f)
	dw Route5GateScript0
	dw Route5GateScript1

Function1df43: ; 1df43 (7:5f43)
	ld a, $40
	ld [$ccd3], a
	ld a, $1
	ld [$cd38], a
	jp Func_3486

Route5GateScript0: ; 1df50 (7:5f50)
	ld a, [$d728]
	bit 6, a
	ret nz
	ld hl, Coords1df8f
	call ArePlayerCoordsInArray
	ret nc
	ld a, $2
	ld [$d528], a
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld b, BANK(RemoveGuardDrink)
	ld hl, RemoveGuardDrink
	call Bankswitch
	ld a, [$ff00+$db]
	and a
	jr nz, .asm_1df82 ; 0x1df70 $10
	ld a, $2
	ld [$ff00+$8c], a
	call DisplayTextID
	call Function1df43
	ld a, $1
	ld [W_ROUTE5GATECURSCRIPT], a
	ret
.asm_1df82
	ld a, $3
	ld [$ff00+$8c], a
	call DisplayTextID
	ld hl, $d728
	set 6, [hl]
	ret

Coords1df8f: ; 1df8f (7:5f8f)
	db 3,3
	db 3,4
	db $ff

Route5GateScript1: ; 1df94 (7:5f94)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_ROUTE5GATECURSCRIPT], a
	ret

Route5GateTexts: ; 1dfa4 (7:5fa4)
	dw Route5GateText1, Route5GateText2, Route5GateText3

Route8GateText1: ; 1dfaa (7:5faa)
Route7GateText1: ; 1dfaa (7:5faa)
Route6GateText1: ; 1dfaa (7:5faa)
Route5GateText1: ; 1dfaa (7:5faa)
	db $8
	ld a, [$d728]
	bit 6, a
	jr nz, .asm_88856 ; 0x1dfb0 $2c
	ld b, BANK(RemoveGuardDrink)
	ld hl, RemoveGuardDrink
	call Bankswitch
	ld a, [$ff00+$db]
	and a
	jr nz, .asm_768a2 ; 0x1dfbd $11
	ld hl, UnnamedText_1dfe7
	call PrintText
	call Function1df43
	ld a, $1
	ld [W_ROUTE5GATECURSCRIPT], a
	jp TextScriptEnd
.asm_768a2 ; 0x1dfd0
	ld hl, UnnamedText_1dfec
	call PrintText
	ld hl, $d728
	set 6, [hl]
	jp TextScriptEnd
.asm_88856 ; 0x1dfde
	ld hl, UnnamedText_1dff6
	call PrintText
	jp TextScriptEnd
; 0x1dfe7

Route8GateText2: ; 1dfe7 (7:5fe7)
Route7GateText2: ; 1dfe7 (7:5fe7)
Route6GateText2: ; 1dfe7 (7:5fe7)
Route5GateText2: ; 1dfe7 (7:5fe7)
UnnamedText_1dfe7: ; 1dfe7 (7:5fe7)
	TX_FAR _UnnamedText_1dfe7
	db $50
; 0x1dfe7 + 5 bytes

Route8GateText3: ; 1dfec (7:5fec)
Route7GateText3: ; 1dfec (7:5fec)
Route6GateText3: ; 1dfec (7:5fec)
Route5GateText3: ; 1dfec (7:5fec)
UnnamedText_1dfec: ; 1dfec (7:5fec)
	TX_FAR _UnnamedText_8aaa9 ; 0x8aaa9
	db $11
	TX_FAR _UnnamedText_1dff1 ; 0x8aaef
	db $50
; 0x1dff6

UnnamedText_1dff6: ; 1dff6 (7:5ff6)
	TX_FAR _UnnamedText_1dff6
	db $50
; 0x1dff6 + 5 bytes

Route5GateObject: ; 0x1dffb (size=42)
	db $a ; border tile

	db $4 ; warps
	db $5, $3, $2, $ff
	db $5, $4, $2, $ff
	db $0, $3, $1, $ff
	db $0, $4, $0, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_GUARD, $3 + 4, $1 + 4, $ff, $d3, $1 ; person

	; warp-to
	EVENT_DISP $4, $5, $3
	EVENT_DISP $4, $5, $4
	EVENT_DISP $4, $0, $3
	EVENT_DISP $4, $0, $4

Route5GateBlocks: ; 1e025 (7:6025)
	INCBIN "maps/route5gate.blk"

Route6Gate_h: ; 0x1e031 to 0x1e03d (12 bytes) (bank=7) (id=73)
	db $0c ; tileset
	db ROUTE_6_GATE_HEIGHT, ROUTE_6_GATE_WIDTH ; dimensions (y, x)
	dw Route6GateBlocks, Route6GateTexts, Route6GateScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route6GateObject ; objects

Route6GateScript: ; 1e03d (7:603d)
	call EnableAutoTextBoxDrawing
	ld hl, Route6GateScripts
	ld a, [W_ROUTE6GATECURSCRIPT]
	call CallFunctionInTable
	ret
; 0x1e04a

Route6GateScripts: ; 1e04a (7:604a)
	dw Route6GateScript0, Route6GateScript1

Route6GateScript0: ; 1e04e (7:604e)
	ld a, [$d728]
	bit 6, a
	ret nz
	ld hl, Unknown_1e08c
	call ArePlayerCoordsInArray
	ret nc
	ld a, $1
	ld [$d528], a
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld b, BANK(RemoveGuardDrink)
	ld hl, RemoveGuardDrink
	call Bankswitch
	ld a, [$ff00+$db]
	and a
	jr nz, .asm_1e080 ; 0x1e06e $10
	ld a, $2
	ld [$ff00+$8c], a
	call DisplayTextID
	call Unknown_1e0a1
	ld a, $1
	ld [W_ROUTE6GATECURSCRIPT], a
	ret
.asm_1e080
	ld hl, $d728
	set 6, [hl]
	ld a, $3
	ld [$ff00+$8c], a
	jp DisplayTextID
; 0x1e08c

Unknown_1e08c: ; 1e08c (7:608c)
	ld [bc], a
	inc bc
	ld [bc], a
	inc b
	rst $38

Route6GateScript1: ; 1e091 (7:6091)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_ROUTE6GATECURSCRIPT], a
	ret
; 0x1e0a1

Unknown_1e0a1: ; 1e0a1 (7:60a1)
	ld hl, $d730
	set 7, [hl]
	ld a, $80
	ld [$ccd3], a
	ld a, $1
	ld [$cd38], a
	xor a
	ld [$c206], a
	ld [$cd3b], a
	ret
; 0x1e0b8

Route6GateTexts: ; 1e0b8 (7:60b8)
	dw Route6GateText1, Route6GateText2, Route6GateText3

Route6GateObject: ; 0x1e0be (size=42)
	db $a ; border tile

	db $4 ; warps
	db $5, $3, $2, $ff
	db $5, $4, $2, $ff
	db $0, $3, $1, $ff
	db $0, $4, $1, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_GUARD, $2 + 4, $6 + 4, $ff, $d2, $1 ; person

	; warp-to
	EVENT_DISP $4, $5, $3
	EVENT_DISP $4, $5, $4
	EVENT_DISP $4, $0, $3
	EVENT_DISP $4, $0, $4

Route6GateBlocks: ; 1e0e8 (7:60e8)
	INCBIN "maps/route6gate.blk"

Route7Gate_h: ; 0x1e0f4 to 0x1e100 (12 bytes) (bank=7) (id=76)
	db $0c ; tileset
	db ROUTE_7_GATE_HEIGHT, ROUTE_7_GATE_WIDTH ; dimensions (y, x)
	dw Route7GateBlocks, Route7GateTexts, Route7GateScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route7GateObject ; objects

Route7GateScript: ; 1e100 (7:6100)
	call EnableAutoTextBoxDrawing
	ld a, [W_ROUTE7GATECURSCRIPT]
	ld hl, Route7GateScripts
	call CallFunctionInTable
	ret
; 0x1e10d

Route7GateScripts: ; 1e10d (7:610d)
	dw Route7GateScript0
	dw Route7GateScript1

Function1e111: ; 1e111 (7:6111)
	ld hl, $d730
	set 7, [hl]
	ld a, $20
	ld [$ccd3], a
	ld a, $1
	ld [$cd38], a
	xor a
	ld [$c206], a
	ld [$cd3b], a
	ret

Route7GateScript0: ; 1e128 (7:6128)
	ld a, [$d728]
	bit 6, a
	ret nz
	ld hl, Coords1e167
	call ArePlayerCoordsInArray
	ret nc
	ld a, $8
	ld [$d528], a
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld b, BANK(RemoveGuardDrink)
	ld hl, RemoveGuardDrink
	call Bankswitch
	ld a, [$ff00+$db]
	and a
	jr nz, .asm_1e15a ; 0x1e148 $10
	ld a, $2
	ld [$ff00+$8c], a
	call DisplayTextID
	call Function1e111
	ld a, $1
	ld [W_ROUTE7GATECURSCRIPT], a
	ret
.asm_1e15a
	ld a, $3
	ld [$ff00+$8c], a
	call DisplayTextID
	ld hl, $d728
	set 6, [hl]
	ret


Coords1e167: ; 1e167 (7:6167)
	db 3,3
	db 4,3
	db $ff

Route7GateScript1: ; 1e16c (7:616c)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_ROUTE7GATECURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Route7GateTexts: ; 1e17f (7:617f)
	dw Route7GateText1, Route7GateText2, Route7GateText3

Route7GateObject: ; 0x1e185 (size=42)
	db $a ; border tile

	db $4 ; warps
	db $3, $0, $3, $ff
	db $4, $0, $3, $ff
	db $3, $5, $0, $ff
	db $4, $5, $1, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_GUARD, $1 + 4, $3 + 4, $ff, $d0, $1 ; person

	; warp-to
	EVENT_DISP $3, $3, $0
	EVENT_DISP $3, $4, $0
	EVENT_DISP $3, $3, $5
	EVENT_DISP $3, $4, $5

Route7GateBlocks: ; 1e1af (7:61af)
	INCBIN "maps/route7gate.blk"

Route8Gate_h: ; 0x1e1bb to 0x1e1c7 (12 bytes) (bank=7) (id=79)
	db $0c ; tileset
	db ROUTE_8_GATE_HEIGHT, ROUTE_8_GATE_WIDTH ; dimensions (y, x)
	dw Route8GateBlocks, Route8GateTexts, Route8GateScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route8GateObject ; objects

Route8GateScript: ; 1e1c7 (7:61c7)
	call EnableAutoTextBoxDrawing
	ld hl, Route8GateScripts
	ld a, [W_ROUTE8GATECURSCRIPT]
	jp CallFunctionInTable
; 0x1e1d3

Route8GateScripts: ; 1e1d3 (7:61d3)
	dw Route8GateScript0
	dw Route8GateScript1

Function1e1d7: ; 1e1d7 (7:61d7)
	ld hl, $d730
	set 7, [hl]
	ld a, $10
	ld [$ccd3], a
	ld a, $1
	ld [$cd38], a
	xor a
	ld [$c206], a
	ld [$cd3b], a
	ret

Route8GateScript0: ; 1e1ee (7:61ee)
	ld a, [$d728]
	bit 6, a
	ret nz
	ld hl, Coords1e22c
	call ArePlayerCoordsInArray
	ret nc
	ld a, $2
	ld [$d528], a
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld b, BANK(RemoveGuardDrink)
	ld hl, RemoveGuardDrink
	call Bankswitch
	ld a, [$ff00+$db]
	and a
	jr nz, .asm_1e220 ; 0x1e20e $10
	ld a, $2
	ld [$ff00+$8c], a
	call DisplayTextID
	call Function1e1d7
	ld a, $1
	ld [W_ROUTE8GATECURSCRIPT], a
	ret
.asm_1e220
	ld hl, $d728
	set 6, [hl]
	ld a, $3
	ld [$ff00+$8c], a
	jp DisplayTextID
; 0x1e22c

Coords1e22c: ; 1e22c (7:622c)
	db 3,2
	db 4,2
	db $ff

Route8GateScript1: ; 1e231 (7:6231)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_ROUTE8GATECURSCRIPT], a
	ret

Route8GateTexts: ; 1e241 (7:6241)
	dw Route8GateText1, Route8GateText2, Route8GateText3

Route8GateObject: ; 0x1e247 (size=42)
	db $a ; border tile

	db $4 ; warps
	db $3, $0, $0, $ff
	db $4, $0, $1, $ff
	db $3, $5, $2, $ff
	db $4, $5, $3, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_GUARD, $1 + 4, $2 + 4, $ff, $d0, $1 ; person

	; warp-to
	EVENT_DISP $3, $3, $0
	EVENT_DISP $3, $4, $0
	EVENT_DISP $3, $3, $5
	EVENT_DISP $3, $4, $5

Route8GateBlocks: ; 1e271 (7:6271)
	INCBIN "maps/route8gate.blk"

UndergroundPathEntranceRoute8_h: ; 0x1e27d to 0x1e289 (12 bytes) (bank=7) (id=80)
	db $0c ; tileset
	db PATH_ENTRANCE_ROUTE_8_HEIGHT, PATH_ENTRANCE_ROUTE_8_WIDTH ; dimensions (y, x)
	dw UndergroundPathEntranceRoute8Blocks, UndergroundPathEntranceRoute8Texts, UndergroundPathEntranceRoute8Script ; blocks, texts, scripts
	db $00 ; connections

	dw UndergroundPathEntranceRoute8Object ; objects

UndergroundPathEntranceRoute8Script: ; 1e289 (7:6289)
	ld a, $13
	ld [$d365], a
	jp EnableAutoTextBoxDrawing
; 0x1e291

UndergroundPathEntranceRoute8Texts: ; 1e291 (7:6291)
	dw UndergroundPathEntranceRoute8Text1

;XXX wtf? syntax error
UndergroundPathEntranceRoute8Text1: ; 1e293 (7:6293)
	db $17, $8d, $42, $23
	;TX_FAR _UndergroundPathEntranceRoute8Text1
	db $50

UndergroundPathEntranceRoute8Object: ; 0x1e298 (size=34)
	db $a ; border tile

	db $3 ; warps
	db $7, $3, $4, $ff
	db $7, $4, $4, $ff
	db $4, $4, $1, UNDERGROUND_PATH_WE

	db $0 ; signs

	db $1 ; people
	db SPRITE_GIRL, $4 + 4, $3 + 4, $ff, $ff, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4
	EVENT_DISP $4, $4, $4 ; UNDERGROUND_PATH_WE

PowerPlant_h: ; 0x1e2ba to 0x1e2c6 (12 bytes) (bank=7) (id=83)
	db $16 ; tileset
	db POWER_PLANT_HEIGHT, POWER_PLANT_WIDTH ; dimensions (y, x)
	dw PowerPlantBlocks, PowerPlantTexts, PowerPlantScript ; blocks, texts, scripts
	db $00 ; connections

	dw PowerPlantObject ; objects

PowerPlantScript: ; 1e2c6 (7:62c6)
	call EnableAutoTextBoxDrawing
	ld hl, PowerPlantTrainerHeaders
	ld de, PowerPlantScriptPointers
	ld a, [W_POWERPLANTCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_POWERPLANTCURSCRIPT], a
	ret
; 0x1e2d9

PowerPlantScriptPointers: ; 1e2d9 (7:62d9)
	dw CheckFightingMapTrainers
	dw Func_324c
	dw EndTrainerBattle

PowerPlantTexts: ; 1e2df (7:62df)
	dw PowerPlantText1, PowerPlantText2, PowerPlantText3, PowerPlantText4, PowerPlantText5, PowerPlantText6, PowerPlantText7, PowerPlantText8, PowerPlantText9, Predef5CText, Predef5CText, Predef5CText, Predef5CText, Predef5CText

PowerPlantTrainerHeaders: ; 1e2fb (7:62fb)
PowerPlantTrainerHeader0: ; 1e2fb (7:62fb)
	db 1 ; flag's bit
	db 0 ; view range
	dw $d7d3 ; flag's byte
	dw VoltorbBattleText ; TextBeforeBattle
	dw VoltorbBattleText ; TextAfterBattle
	dw VoltorbBattleText ; TextEndBattle
	dw VoltorbBattleText ; TextEndBattle

PowerPlantTrainerHeader1: ; 1e307 (7:6307)
	db 2 ; flag's bit
	db 0 ; view range
	dw $d7d3 ; flag's byte
	dw VoltorbBattleText ; TextBeforeBattle
	dw VoltorbBattleText ; TextAfterBattle
	dw VoltorbBattleText ; TextEndBattle
	dw VoltorbBattleText ; TextEndBattle

PowerPlantTrainerHeader2: ; 1e313 (7:6313)
	db 3 ; flag's bit
	db 0 ; view range
	dw $d7d3 ; flag's byte
	dw VoltorbBattleText ; TextBeforeBattle
	dw VoltorbBattleText ; TextAfterBattle
	dw VoltorbBattleText ; TextEndBattle
	dw VoltorbBattleText ; TextEndBattle

PowerPlantTrainerHeader3: ; 1e31f (7:631f)
	db 4 ; flag's bit
	db 0 ; view range
	dw $d7d3 ; flag's byte
	dw VoltorbBattleText ; TextBeforeBattle
	dw VoltorbBattleText ; TextAfterBattle
	dw VoltorbBattleText ; TextEndBattle
	dw VoltorbBattleText ; TextEndBattle

PowerPlantTrainerHeader4: ; 1e32b (7:632b)
	db 5 ; flag's bit
	db 0 ; view range
	dw $d7d3 ; flag's byte
	dw VoltorbBattleText ; TextBeforeBattle
	dw VoltorbBattleText ; TextAfterBattle
	dw VoltorbBattleText ; TextEndBattle
	dw VoltorbBattleText ; TextEndBattle

PowerPlantTrainerHeader5: ; 1e337 (7:6337)
	db 6 ; flag's bit
	db 0 ; view range
	dw $d7d3 ; flag's byte
	dw VoltorbBattleText ; TextBeforeBattle
	dw VoltorbBattleText ; TextAfterBattle
	dw VoltorbBattleText ; TextEndBattle
	dw VoltorbBattleText ; TextEndBattle

PowerPlantTrainerHeader6: ; 1e343 (7:6343)
	db 7 ; flag's bit
	db 0 ; view range
	dw $d7d3 ; flag's byte
	dw VoltorbBattleText ; TextBeforeBattle
	dw VoltorbBattleText ; TextAfterBattle
	dw VoltorbBattleText ; TextEndBattle
	dw VoltorbBattleText ; TextEndBattle

PowerPlantTrainerHeader7: ; 1e34f (7:634f)
	db 8 ; flag's bit
	db 0 ; view range
	dw $d7d3 ; flag's byte
	dw VoltorbBattleText ; TextBeforeBattle
	dw VoltorbBattleText ; TextAfterBattle
	dw VoltorbBattleText ; TextEndBattle
	dw VoltorbBattleText ; TextEndBattle

PowerPlantTrainerHeader8: ; 1e35b (7:635b)
	db 9 ; flag's bit
	db 0 ; view range
	dw $d7d3 ; flag's byte
	dw ZapdosBattleText ; TextBeforeBattle
	dw ZapdosBattleText ; TextAfterBattle
	dw ZapdosBattleText ; TextEndBattle
	dw ZapdosBattleText ; TextEndBattle

	db $ff

asm_234cc: ; 1e368 (7:6368)
	call TalkToTrainer
	ld a, [W_CURMAPSCRIPT]
	ld [W_POWERPLANTCURSCRIPT], a
	jp TextScriptEnd
; 0x1e374

PowerPlantText1: ; 1e374 (7:6374)
	db $8 ; asm
	ld hl, PowerPlantTrainerHeader0 ; $62fb
	jr asm_234cc ; 0x1e378 $ee

PowerPlantText2: ; 1e37a (7:637a)
	db $8 ; asm
	ld hl, PowerPlantTrainerHeader1 ; $6307
	jr asm_234cc ; 0x1e37e $e8

PowerPlantText3: ; 1e380 (7:6380)
	db $8 ; asm
	ld hl, PowerPlantTrainerHeader2 ; $6313
	jr asm_234cc ; 0x1e384 $e2

PowerPlantText4: ; 1e386 (7:6386)
	db $8 ; asm
	ld hl, PowerPlantTrainerHeader3 ; $631f
	jr asm_234cc ; 0x1e38a $dc

PowerPlantText5: ; 1e38c (7:638c)
	db $8 ; asm
	ld hl, PowerPlantTrainerHeader4 ; $632b
	jr asm_234cc ; 0x1e390 $d6

PowerPlantText6: ; 1e392 (7:6392)
	db $8 ; asm
	ld hl, PowerPlantTrainerHeader5 ; $6337
	jr asm_234cc ; 0x1e396 $d0

PowerPlantText7: ; 1e398 (7:6398)
	db $8 ; asm
	ld hl, PowerPlantTrainerHeader6 ; $6343
	jr asm_234cc ; 0x1e39c $ca

PowerPlantText8: ; 1e39e (7:639e)
	db $8 ; asm
	ld hl, PowerPlantTrainerHeader7 ; $634f
	jr asm_234cc ; 0x1e3a2 $c4

PowerPlantText9: ; 1e3a4 (7:63a4)
	db $8 ; asm
	ld hl, PowerPlantTrainerHeader8 ; $635b
	jr asm_234cc ; 0x1e3a8 $be
; 0x1e3aa

VoltorbBattleText: ; 1e3aa (7:63aa)
	TX_FAR _VoltorbBattleText ; 0x8c5e2
	db $50
; 0x1e3af

ZapdosBattleText: ; 1e3af (7:63af)
	TX_FAR _ZapdosBattleText ; 0x8c5ea
	db $8
	ld a, ZAPDOS
	call PlayCry
	call WaitForSoundToFinish
	jp TextScriptEnd
; 0x1e3bf

PowerPlantObject: ; 0x1e3bf (size=135)
	db $2e ; border tile

	db $3 ; warps
	db $23, $4, $3, $ff
	db $23, $5, $3, $ff
	db $b, $0, $3, $ff

	db $0 ; signs

	db $e ; people
	db SPRITE_BALL, $14 + 4, $9 + 4, $ff, $ff, $41, VOLTORB, 40 ; trainer
	db SPRITE_BALL, $12 + 4, $20 + 4, $ff, $ff, $42, VOLTORB, 40 ; trainer
	db SPRITE_BALL, $19 + 4, $15 + 4, $ff, $ff, $43, VOLTORB, 40 ; trainer
	db SPRITE_BALL, $12 + 4, $19 + 4, $ff, $ff, $44, ELECTRODE, 43 ; trainer
	db SPRITE_BALL, $22 + 4, $17 + 4, $ff, $ff, $45, VOLTORB, 40 ; trainer
	db SPRITE_BALL, $1c + 4, $1a + 4, $ff, $ff, $46, VOLTORB, 40 ; trainer
	db SPRITE_BALL, $e + 4, $15 + 4, $ff, $ff, $47, ELECTRODE, 43 ; trainer
	db SPRITE_BALL, $20 + 4, $25 + 4, $ff, $ff, $48, VOLTORB, 40 ; trainer
	db SPRITE_BIRD, $9 + 4, $4 + 4, $ff, $d1, $49, ZAPDOS, 50 ; trainer
	db SPRITE_BALL, $19 + 4, $7 + 4, $ff, $ff, $8a, CARBOS ; item
	db SPRITE_BALL, $3 + 4, $1c + 4, $ff, $ff, $8b, HP_UP ; item
	db SPRITE_BALL, $3 + 4, $22 + 4, $ff, $ff, $8c, RARE_CANDY ; item
	db SPRITE_BALL, $20 + 4, $1a + 4, $ff, $ff, $8d, TM_25 ; item
	db SPRITE_BALL, $20 + 4, $14 + 4, $ff, $ff, $8e, TM_33 ; item

	; warp-to
	EVENT_DISP $14, $23, $4
	EVENT_DISP $14, $23, $5
	EVENT_DISP $14, $b, $0

PowerPlantBlocks: ; 1e446 (7:6446)
	INCBIN "maps/powerplant.blk"

DiglettsCaveEntranceRoute11_h: ; 0x1e5ae to 0x1e5ba (12 bytes) (bank=7) (id=85)
	db $11 ; tileset
	db DIGLETTS_CAVE_ENTRANCE_HEIGHT, DIGLETTS_CAVE_ENTRANCE_WIDTH ; dimensions (y, x)
	dw DiglettsCaveEntranceRoute11Blocks, DiglettsCaveEntranceRoute11Texts, DiglettsCaveEntranceRoute11Script ; blocks, texts, scripts
	db $00 ; connections

	dw DiglettsCaveEntranceRoute11Object ; objects

DiglettsCaveEntranceRoute11Script: ; 1e5ba (7:65ba)
	call EnableAutoTextBoxDrawing
	ld a, $16
	ld [$d365], a
	ret
; 0x1e5c3

DiglettsCaveEntranceRoute11Texts: ; 1e5c3 (7:65c3)
	dw DiglettsCaveEntranceRoute11Text1

; XXX wtf? syntax error
DiglettsCaveEntranceRoute11Text1: ; 1e5c5 (7:65c5)
	db $17, $f9, $47, $23
	;TX_FAR _DiglettsCaveEntranceRoute11Text1
	db $50

DiglettsCaveEntranceRoute11Object: ; 0x1e5ca (size=34)
	db $7d ; border tile

	db $3 ; warps
	db $7, $2, $4, $ff
	db $7, $3, $4, $ff
	db $4, $4, $1, DIGLETTS_CAVE

	db $0 ; signs

	db $1 ; people
	db SPRITE_GAMBLER, $3 + 4, $2 + 4, $ff, $ff, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $4, $4 ; DIGLETTS_CAVE

Route16House_h: ; 0x1e5ec to 0x1e5f8 (12 bytes) (bank=7) (id=188)
	db $08 ; tileset
	db ROUTE_16_HOUSE_HEIGHT, ROUTE_16_HOUSE_WIDTH ; dimensions (y, x)
	dw Route16HouseBlocks, Route16HouseTexts, Route16HouseScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route16HouseObject ; objects

Route16HouseScript: ; 1e5f8 (7:65f8)
	jp EnableAutoTextBoxDrawing
; 0x1e5fb

Route16HouseTexts: ; 1e5fb (7:65fb)
	dw Route16HouseText1, Route16HouseText2

Route16HouseText1: ; 1e5ff (7:65ff)
	db $08 ; asm
	ld a, [$d7e0]
	bit 6, a
	ld hl, HM02ExplanationText
	jr nz, .asm_13616 ; 0x1e608
	ld hl, Route16HouseText3
	call PrintText
	ld bc, (HM_02 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, $d7e0
	set 6, [hl]
	ld hl, ReceivedHM02Text
	jr .asm_13616 ; 0x1e620
.BagFull
	ld hl, HM02NoRoomText
.asm_13616 ; 0x1e625
	call PrintText
	jp TextScriptEnd

Route16HouseText3: ; 1e62b (7:662b)
	TX_FAR _Route16HouseText3
	db $50
; 0x1e62b + 5 bytes

ReceivedHM02Text: ; 1e630 (7:6630)
	TX_FAR _ReceivedHM02Text ; 0x8ce66
	db $11, $50

HM02ExplanationText: ; 1e636 (7:6636)
	TX_FAR _HM02ExplanationText
	db $50
; 0x1e636 + 5 bytes

HM02NoRoomText: ; 1e63b (7:663b)
	TX_FAR _HM02NoRoomText
	db $50
; 0x1e63b + 5 bytes

Route16HouseText2: ; 1e640 (7:6640)
	db $08 ; asm
	ld hl, UnnamedText_1e652
	call PrintText
	ld a, FEAROW
	call PlayCry
	call WaitForSoundToFinish
	jp TextScriptEnd

UnnamedText_1e652: ; 1e652 (7:6652)
	TX_FAR _UnnamedText_1e652
	db $50
; 0x1e652 + 5 bytes

Route16HouseObject: ; 0x1e657 (size=32)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $8, $ff
	db $7, $3, $8, $ff

	db $0 ; signs

	db $2 ; people
	db SPRITE_BRUNETTE_GIRL, $3 + 4, $2 + 4, $ff, $d3, $1 ; person
	db SPRITE_BIRD, $4 + 4, $6 + 4, $fe, $0, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

Route22Gate_h: ; 0x1e677 to 0x1e683 (12 bytes) (bank=7) (id=193)
	db $0c ; tileset
	db ROUTE_22_GATE_HEIGHT, ROUTE_22_GATE_WIDTH ; dimensions (y, x)
	dw Route22GateBlocks, Route22GateTexts, Route22GateScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route22GateObject ; objects

Route22GateScript: ; 1e683 (7:6683)
	call EnableAutoTextBoxDrawing
	ld hl, Route22GateScripts
	ld a, [W_ROUTE22GATECURSCRIPT]
	call CallFunctionInTable
	ld a, [$d361]
	cp $4
	ld a, $22
	jr c, .asm_1e69a ; 0x1e696 $2
	ld a, $21
.asm_1e69a
	ld [$d365], a
	ret
; 0x1e69e

Route22GateScripts: ; 1e69e (7:669e)
	dw Route22GateScript0, Route22GateScript1, Route22GateScript2

Route22GateScript0: ; 1e6a4 (7:66a4)
	ld hl, Route22GateScriptCoords
	call ArePlayerCoordsInArray
	ret nc
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $1
	ld [$ff00+$8c], a
	jp DisplayTextID
; 0x1e6b5

Route22GateScriptCoords: ; 1e6b5 (7:66b5)
	db 2,4
	db 2,5
	db $ff

Func_1e6ba: ; 1e6ba (7:66ba)
	ld a, $1
	ld [$cd38], a
	ld a, $80
	ld [$ccd3], a
	ld [$c109], a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	jp Func_3486
; 0x1e6cd

Route22GateScript1: ; 1e6cd (7:66cd)
	ld a, [$cd38]
	and a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	call Delay3
	ld a, $0
	ld [W_ROUTE22GATECURSCRIPT], a
Route22GateScript2: ; 1e6de (7:66de)
	ret
; 0x1e6df

Route22GateTexts: ; 1e6df (7:66df)
	dw Route22GateText1

Route22GateText1: ; 1e6e1 (7:66e1)
	db $8
	ld a, [$d356]
	bit 0, a
	jr nz, .asm_8a809 ; 0x1e6e7 $d
	ld hl, UnnamedText_1e704
	call PrintText
	call Func_1e6ba
	ld a, $1
	jr .asm_20f7e ; 0x1e6f4 $8
.asm_8a809 ; 0x1e6f6
	ld hl, UnnamedText_1e71a
	call PrintText
	ld a, $2
.asm_20f7e ; 0x1e6fe
	ld [W_ROUTE22GATECURSCRIPT], a
	jp TextScriptEnd
; 0x1e704

UnnamedText_1e704: ; 1e704 (7:6704)
	TX_FAR _UnnamedText_1e704 ; 0x8cfbb
	db $8
	ld a, $a5
	call PlaySoundWaitForCurrent
	call WaitForSoundToFinish
	ld hl, UnnamedText_1e715 ; $6715
	ret
; 0x1e715

UnnamedText_1e715: ; 1e715 (7:6715)
	TX_FAR _UnnamedText_1e715
	db $50
; 0x1e71a

UnnamedText_1e71a: ; 1e71a (7:671a)
	TX_FAR _UnnamedText_1e71a ; 0x8d03e
	db $0B, $50
; 0x1e720

Route22GateObject: ; 0x1e720 (size=42)
	db $a ; border tile

	db $4 ; warps
	db $7, $4, $0, $ff
	db $7, $5, $0, $ff
	db $0, $4, $0, $ff
	db $0, $5, $1, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_GUARD, $2 + 4, $6 + 4, $ff, $d2, $1 ; person

	; warp-to
	EVENT_DISP $5, $7, $4
	EVENT_DISP $5, $7, $5
	EVENT_DISP $5, $0, $4
	EVENT_DISP $5, $0, $5

Route22GateBlocks: ; 1e74a (7:674a)
	INCBIN "maps/route22gate.blk"

BillsHouse_h: ; 0x1e75e to 0x1e76a (12 bytes) (bank=7) (id=88)
	db $10 ; tileset
	db BILLS_HOUSE_HEIGHT, BILLS_HOUSE_WIDTH ; dimensions (y, x)
	dw BillsHouseBlocks, BillsHouseTexts, BillsHouseScript ; blocks, texts, scripts
	db $00 ; connections

	dw BillsHouseObject ; objects

BillsHouseScript: ; 1e76a (7:676a)
	call EnableAutoTextBoxDrawing
	ld a, [W_BILLSHOUSECURSCRIPT]
	ld hl, BillsHouseScripts
	jp CallFunctionInTable
; 0x1e776

BillsHouseScripts: ; 1e776 (7:6776)
	dw BillsHouseScript0
	dw BillsHouseScript1
	dw BillsHouseScript2
	dw BillsHouseScript3
	dw BillsHouseScript4
	dw BillsHouseScript5

BillsHouseScript0: ; 1e782 (7:6782)
	ret

BillsHouseScript1: ; 1e783 (7:6783)
	ld a, [$c109]
	and a
	ld de, MovementData1e79c
	jr nz, .asm_1e78f ; 0x1e78a $3
	ld de, MovementData1e7a0
.asm_1e78f
	ld a, $1
	ld [$ff00+$8c], a
	call MoveSprite
	ld a, $2
	ld [W_BILLSHOUSECURSCRIPT], a
	ret

MovementData1e79c: ; 1e79c (7:679c)
	db $40,$40,$40,$ff

MovementData1e7a0: ; 1e7a0 (7:67a0)
	db $c0,$40,$40,$80,$40,$ff

BillsHouseScript2: ; 1e7a6 (7:67a6)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $61
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld hl, $d7f2
	set 6, [hl]
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $3
	ld [W_BILLSHOUSECURSCRIPT], a
	ret

BillsHouseScript3: ; 1e7c5 (7:67c5)
	ld a, [$d7f2]
	bit 3, a
	ret z
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $2
	ld [$cf13], a
	ld a, $c
	ld [$ff00+$eb], a
	ld a, $40
	ld [$ff00+$ec], a
	ld a, $6
	ld [$ff00+$ed], a
	ld a, $5
	ld [$ff00+$ee], a
	call Func_32f9
	ld a, $62
	ld [$cc4d], a
	ld a, $15
	call Predef
	ld c, $8
	call DelayFrames
	ld a, $2
	ld [$ff00+$8c], a
	ld de, MovementData1e807
	call MoveSprite
	ld a, $4
	ld [W_BILLSHOUSECURSCRIPT], a
	ret

MovementData1e807: ; 1e807 (7:6807)
	db $00,$c0,$c0,$c0,$00,$ff

BillsHouseScript4: ; 1e80d (7:680d)
	ld a, [$d730]
	bit 0, a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d7f2
	set 5, [hl]
	ld hl, $d7f1
	set 0, [hl]
	ld a, $0
	ld [W_BILLSHOUSECURSCRIPT], a
	ret

BillsHouseScript5: ; 1e827 (7:6827)
	ld a, $4
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $0
	ld [W_BILLSHOUSECURSCRIPT], a
	ret

BillsHouseTexts: ; 1e834 (7:6834)
	dw BillsHouseText1, BillsHouseText2, BillsHouseText3, BillsHouseText4

BillsHouseText4: ; 1e83c (7:683c)
	db $fd

BillsHouseText1: ; 1e83d (7:683d)
	db $8
	ld hl, UnnamedText_1e865
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, asm_6b196 ; 0x1e84b $d
asm_4d03c: ; 1e84d (7:684d)
	ld hl, UnnamedText_1e86a
	call PrintText
	ld a, $1
	ld [W_BILLSHOUSECURSCRIPT], a
	jr asm_fd4e2 ; 0x1e858 $8
asm_6b196: ; 1e85a (7:685a)
	ld hl, UnnamedText_1e86f
	call PrintText
	jr asm_4d03c ; 0x1e860 $eb
asm_fd4e2 ; 0x1e862
	jp TextScriptEnd

UnnamedText_1e865: ; 1e865 (7:6865)
	TX_FAR _UnnamedText_1e865 ; 0x8d267
	db $50
; 0x1e86a

UnnamedText_1e86a: ; 1e86a (7:686a)
	TX_FAR _UnnamedText_1e86a ; 0x8d345
	db $50
; 0x1e86f

UnnamedText_1e86f: ; 1e86f (7:686f)
	TX_FAR _UnnamedText_1e86f ; 0x8d391
	db $50
; 0x1e874

BillsHouseText2: ; 1e874 (7:6874)
	db $08 ; asm
	ld a, [$d7f2]
	bit 4, a
	jr nz, .asm_5491f ; 0x1e87a
	ld hl, BillThankYouText
	call PrintText
	ld bc, (S_S__TICKET << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, SSTicketReceivedText
	call PrintText
	ld hl, $d7f2
	set 4, [hl]
	ld a, $7
	ld [$cc4d], a
	ld a, $15
	call Predef
	ld a, $9
	ld [$cc4d], a
	ld a, $11
	call Predef
.asm_5491f ; 0x1e8a9
	ld hl, UnnamedText_1e8cb
	call PrintText
	jr .asm_bd408 ; 0x1e8af
.BagFull
	ld hl, SSTicketNoRoomText
	call PrintText
.asm_bd408 ; 0x1e8b7
	jp TextScriptEnd

BillThankYouText: ; 1e8ba (7:68ba)
	TX_FAR _BillThankYouText
	db $50
; 0x1e8ba + 5 bytes

SSTicketReceivedText: ; 1e8bf (7:68bf)
	TX_FAR _SSTicketReceivedText ; 0x8d499
	db $11, $6, $50

SSTicketNoRoomText: ; 1e8c6 (7:68c6)
	TX_FAR _SSTicketNoRoomText
	db $50
; 0x1e8c6 + 5 bytes

UnnamedText_1e8cb: ; 1e8cb (7:68cb)
	TX_FAR _UnnamedText_1e8cb
	db $50
; 0x1e8cb + 5 bytes

BillsHouseText3: ; 1e8d0 (7:68d0)
	db $08 ; asm
	ld hl, UnnamedText_1e8da
	call PrintText
	jp TextScriptEnd
; 0x1e8da

UnnamedText_1e8da: ; 1e8da (7:68da)
	TX_FAR _UnnamedText_1e8da
	db $50
; 0x1e8da + 5 bytes

BillsHouseObject: ; 0x1e8df (size=38)
	db $d ; border tile

	db $2 ; warps
	db $7, $2, $0, $ff
	db $7, $3, $0, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_SLOWBRO, $5 + 4, $6 + 4, $ff, $ff, $1 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $4 + 4, $4 + 4, $ff, $ff, $2 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $5 + 4, $6 + 4, $ff, $ff, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

BillsHouseBlocks: ; 1e905 (7:6905)
	INCBIN "maps/billshouse.blk"

; known jump sources: 17ecd (5:7ecd)
Func_1e915: ; 1e915 (7:6915)
	call SaveScreenTilesToBuffer2
	ld hl, UnnamedText_1e946 ; $6946
	call PrintText
	ld hl, UnnamedText_1e93b ; $693b
	call PrintText
	call YesNoChoice
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jr nz, .asm_1e932
	ld a, $56
	call Predef ; indirect jump to DisplayDexRating (44169 (11:4169))
.asm_1e932
	ld hl, Unknown_1e940 ; $6940
	call PrintText
	jp LoadScreenTilesFromBuffer2
; 1e93b (7:693b)
UnnamedText_1e93b: ; 1e93b (7:693b)
	TX_FAR _UnnamedText_1e93b
	db $50
; 0x1e93b + 5 bytes

Unknown_1e940: ; 1e940 (7:6940)
INCBIN "baserom.gbc",$1e940,$1e946 - $1e940

UnnamedText_1e946: ; 1e946 (7:6946)
	TX_FAR _UnnamedText_1e946
	db $50
; 0x1e946 + 5 bytes

INCBIN "baserom.gbc",$1e94b,$1e953 - $1e94b

UnnamedText_1e953: ; 1e953 (7:6953)
	TX_FAR _UnnamedText_1e953
	db $50
; 0x1e953 + 5 bytes

INCBIN "baserom.gbc",$1e958,$1e960 - $1e958

UnnamedText_1e960: ; 1e960 (7:6960)
	TX_FAR _UnnamedText_1e960
	db $50
; 0x1e960 + 5 bytes

INCBIN "baserom.gbc",$1e965,$1e97e - $1e965

UnnamedText_1e97e: ; 1e97e (7:697e)
	TX_FAR _UnnamedText_1e97e
	db $50
; 0x1e97e + 5 bytes

UnnamedText_1e983: ; 1e983 (7:6983)
	TX_FAR _UnnamedText_1e983
	db $50
; 0x1e983 + 5 bytes

; known jump sources: 41f (0:41f)
Func_1e988: ; 1e988 (7:6988)
	ld hl, $d790
	bit 7, [hl]
	jr z, asm_1e9ab
	ld a, [W_NUMSAFARIBALLS] ; $da47
	and a
	jr z, asm_1e9b0
	jr asm_1e9ab

; known jump sources: 60f (0:60f)
Func_1e997: ; 1e997 (7:6997)
	ld a, [W_SAFARITIMER1] ; $d70d
	ld b, a
	ld a, [W_SAFARITIMER2] ; $d70e
	ld c, a
	or b
	jr z, asm_1e9b0
	dec bc
	ld a, b
	ld [W_SAFARITIMER1], a ; $d70d
	ld a, c
	ld [W_SAFARITIMER2], a ; $d70e
asm_1e9ab: ; 1e9ab (7:69ab)
	xor a
	ld [$da46], a
	ret
asm_1e9b0: ; 1e9b0 (7:69b0)
	call EnableAutoTextBoxDrawing
	xor a
	ld [$cfc7], a
	dec a
	call PlaySound
	ld c, $2
	ld a, $b9
	call PlayMusic
.asm_1e9c2
	ld a, [$c02a]
	cp $b9
	jr nz, .asm_1e9c2
	ld a, $d3
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	xor a
	ld [$d528], a
	ld a, $9c
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld a, $3
	ld [$d42f], a
	ld a, $5
	ld [W_SAFARIZONEENTRANCECURSCRIPT], a
	ld hl, $d790
	set 6, [hl]
	ld a, $1
	ld [$da46], a
	ret

; known jump sources: 2a95 (0:2a95)
Func_1e9ed: ; 1e9ed (7:69ed)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, Unknown_1e9f7 ; $69f7
	jp PrintText

Unknown_1e9f7: ; 1e9f7 (7:69f7)
INCBIN "baserom.gbc",$1e9f7,$1e9f8 - $1e9f7
	ld a, [W_NUMSAFARIBALLS] ; $da47
	and a
	jr z, .asm_1ea04
	ld hl, UnnamedText_1ea0d ; $6a0d
	call PrintText
.asm_1ea04
	ld hl, UnnamedText_1ea12 ; $6a12
	call PrintText
	jp TextScriptEnd
; 1ea0d (7:6a0d)
UnnamedText_1ea0d: ; 1ea0d (7:6a0d)
	TX_FAR _UnnamedText_1ea0d
	db $50
; 0x1ea0d + 5 bytes

UnnamedText_1ea12: ; 1ea12 (7:6a12)
	TX_FAR _UnnamedText_1ea12
	db $50
; 0x1ea12 + 5 bytes

	ld a, [$c109]
	cp $4
	ret nz
	call EnableAutoTextBoxDrawing
	ld a, $31
	jp Func_3ef5

INCBIN "baserom.gbc",$1ea25,$1ea26 - $1ea25
	xor a
	ld [$da38], a
	ld a, [W_WHICHTRADE] ; $cd3d
	push af
	and $f
	ld [$FF00+$db], a
	pop af
	and $f0
	swap a
	ld [$FF00+$dc], a
	ld hl, UnnamedText_1ea5b ; $6a5b
	call PrintText
	ld a, [$FF00+$db]
	dec a
	add a
	ld d, $0
	ld e, a
	ld hl, Unknown_1ea60 ; $6a60
	add hl, de
	ld a, [hli]
	ld h, [hl]
	ld l, a
	call PrintText
	ld a, $1
	ld [$cc3c], a
	call Func_1ea92
	jp TextScriptEnd
; 1ea5b (7:6a5b)
UnnamedText_1ea5b: ; 1ea5b (7:6a5b)
	TX_FAR _UnnamedText_1ea5b
	db $50
; 0x1ea5b + 5 bytes

Unknown_1ea60: ; 1ea60 (7:6a60)
INCBIN "baserom.gbc",$1ea60,$1ea6c - $1ea60

UnnamedText_1ea6c: ; 1ea6c (7:6a6c)
	TX_FAR _UnnamedText_1ea6c
	db $50
; 0x1ea6c + 5 bytes

UnnamedText_1ea71: ; 1ea71 (7:6a71)
	TX_FAR _UnnamedText_1ea71
	db $50
; 0x1ea71 + 5 bytes

UnnamedText_1ea76: ; 1ea76 (7:6a76)
	TX_FAR _UnnamedText_1ea76
	db $50
; 0x1ea76 + 5 bytes

UnnamedText_1ea7b: ; 1ea7b (7:6a7b)
	TX_FAR _UnnamedText_1ea7b
	db $50
; 0x1ea7b + 5 bytes

UnnamedText_1ea80: ; 1ea80 (7:6a80)
	TX_FAR _UnnamedText_1ea80
	db $50
; 0x1ea80 + 5 bytes

UnnamedText_1ea85: ; 1ea85 (7:6a85)
	TX_FAR _UnnamedText_1ea85
	db $50
; 0x1ea85 + 5 bytes

; known jump sources: 1eab2 (7:6ab2), 1eaef (7:6aef), 1eb2a (7:6b2a)
Func_1ea8a: ; 1ea8a (7:6a8a)
	ld hl, $d79c
	ld a, $10
	jp Predef ; indirect jump to HandleBitArray (f666 (3:7666))

; known jump sources: 1ea55 (7:6a55)
Func_1ea92: ; 1ea92 (7:6a92)
	call YesNoChoice
	ld a, [$FF00+$dc]
	ld c, a
	ld a, [W_CURMENUITEMID] ; $cc26
	cp c
	jr nz, .asm_1eab8
	ld hl, $d126
	set 5, [hl]
	ld a, [$FF00+$db]
	ld [$FF00+$e0], a
	ld hl, Unknown_1eae3 ; $6ae3
	call PrintText
	ld a, [$FF00+$e0]
	ld c, a
	ld b, $1
	call Func_1ea8a
	jp Func_1eb0a
.asm_1eab8
	call WaitForSoundToFinish
	ld a, $a5
	call PlaySound
	call WaitForSoundToFinish
	ld hl, UnnamedText_1eb05 ; $6b05
	call PrintText
	ld a, [$FF00+$db]
	add $2
	ld c, a
	ld b, $2
	ld hl, $d79a
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	ld a, c
	and a
	ret nz
	ld a, [$FF00+$db]
	add $2
	ld [$da38], a
	ret

Unknown_1eae3: ; 1eae3 (7:6ae3)
INCBIN "baserom.gbc",$1eae3,$1eaea - $1eae3
	ld a, [$FF00+$e0]
	ld c, a
	ld b, $2
	call Func_1ea8a
	ld a, c
	and a
	jp nz, TextScriptEnd
	call WaitForSoundToFinish
	ld a, $ad
	call PlaySound
	call WaitForSoundToFinish
	jp TextScriptEnd
; 1eb05 (7:6b05)
UnnamedText_1eb05: ; 1eb05 (7:6b05)
	TX_FAR _UnnamedText_1eb05
	db $50
; 0x1eb05 + 5 bytes

; known jump sources: 3eb2 (0:3eb2), 1eab5 (7:6ab5)
Func_1eb0a: ; 1eb0a (7:6b0a)
	ld a, $6
	ld [$FF00+$db], a
.asm_1eb0e
	ld a, [$FF00+$db]
	dec a
	add a
	add a
	ld d, $0
	ld e, a
	ld hl, Unknown_1eb48 ; $6b48
	add hl, de
	ld a, [hli]
	ld b, [hl]
	ld c, a
	inc hl
	ld a, [hl]
	ld [$d12f], a
	push bc
	ld a, [$FF00+$db]
	ld [$FF00+$e0], a
	ld c, a
	ld b, $2
	call Func_1ea8a
	ld a, c
	and a
	jr nz, .asm_1eb36
	ld a, [$d12f]
	jr .asm_1eb38
.asm_1eb36
	ld a, $e
.asm_1eb38
	pop bc
	ld [$d09f], a
	ld a, $17
	call Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))
	ld hl, $ffdb
	dec [hl]
	jr nz, .asm_1eb0e
	ret

Unknown_1eb48: ; 1eb48 (7:6b48)
INCBIN "baserom.gbc",$1eb48,$1eb69 - $1eb48

UnnamedText_1eb69: ; 1eb69 (7:6b69)
	TX_FAR _UnnamedText_1eb69
	db $50
; 0x1eb69 + 5 bytes

	call EnableAutoTextBoxDrawing
	ld a, [$c109]
	cp $4
	ret nz
	ld a, [$d7f2]
	bit 7, a
	jr nz, .asm_1ebd2
	bit 3, a
	jr nz, .asm_1eb86
	bit 6, a
	jr nz, .asm_1eb8b
.asm_1eb86
	ld a, $2d
	jp Func_3ef5
.asm_1eb8b
	ld a, $1
	ld [$cc3c], a
	ld a, $2e
	call Func_3ef5
	ld c, $20
	call DelayFrames
	ld a, $8c
	call PlaySound
	call WaitForSoundToFinish
	ld c, $50
	call DelayFrames
	ld a, $9c
	call PlaySound
	call WaitForSoundToFinish
	ld c, $30
	call DelayFrames
	ld a, $8c
	call PlaySound
	call WaitForSoundToFinish
	ld c, $20
	call DelayFrames
	ld a, $86
	call PlaySound
	call WaitForSoundToFinish
	call Func_2307
	ld hl, $d7f2
	set 3, [hl]
	ret
.asm_1ebd2
	ld a, $1
	ld [$cc3c], a
	ld a, $2f
	call Func_3ef5
	ret
; 1ebdd (7:6bdd)
UnnamedText_1ebdd: ; 1ebdd (7:6bdd)
	TX_FAR _UnnamedText_1ebdd
	db $50
; 0x1ebdd + 5 bytes

INCBIN "baserom.gbc",$1ebe2,$1ebe8 - $1ebe2
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld c, $10
	call DelayFrames
	ld a, $9d
	call PlaySound
	call WaitForSoundToFinish
	ld c, $3c
	call DelayFrames
	jp TextScriptEnd

INCBIN "baserom.gbc",$1ec05,$1ec7f - $1ec05

UnnamedText_1ec7f: ; 1ec7f (7:6c7f)
	TX_FAR _UnnamedText_1ec7f
	db $50
; 0x1ec7f + 5 bytes

INCBIN "baserom.gbc",$1ec84,$1ecaa - $1ec84

UnnamedText_1ecaa: ; 1ecaa (7:6caa)
	TX_FAR _UnnamedText_1ecaa
	db $50
; 0x1ecaa + 5 bytes

INCBIN "baserom.gbc",$1ecaf,$1ecbd - $1ecaf

UnnamedText_1ecbd: ; 1ecbd (7:6cbd)
	TX_FAR _UnnamedText_1ecbd
	db $50
; 0x1ecbd + 5 bytes

SECTION "bank8",ROMX,BANK[$8]

Unknown_20000: ; 20000 (8:4000)
INCBIN "baserom.gbc",$20000,$20361 - $20000

Unknown_20361: ; 20361 (8:4361)
INCBIN "baserom.gbc",$20361,$2049b - $20361

Unknown_2049b: ; 2049b (8:449b)
INCBIN "baserom.gbc",$2049b,$2136e - $2049b

Func_2136e: ; 2136e (8:536e)
	ld a, [$d083]
	cp $ff
	jr z, .asm_2139b
	bit 7, a
	ret z
	and $7f
	jr nz, .asm_21383
	call Func_213a7
	ld a, $1e
	jr .asm_21395
.asm_21383
	cp $14
	jr nz, .asm_2138a
	call Func_213ac
.asm_2138a
	ld a, $86
	ld [$c02a], a
	ld a, [$d083]
	and $7f
	dec a
.asm_21395
	set 7, a
	ld [$d083], a
	ret
.asm_2139b
	xor a
	ld [$d083], a
	ld [$c02a], a
	ld de, Unknown_213c4 ; $53c4
	jr asm_213af

; known jump sources: 2137c (8:537c)
Func_213a7: ; 213a7 (8:53a7)
	ld de, Unknown_213bc ; $53bc
	jr asm_213af

; known jump sources: 21387 (8:5387)
Func_213ac: ; 213ac (8:53ac)
	ld de, Unknown_213c0 ; $53c0
asm_213af: ; 213af (8:53af)
	ld hl, $ff10
	ld c, $5
	xor a
.asm_213b5
	ld [hli], a
	ld a, [de]
	inc de
	dec c
	jr nz, .asm_213b5
	ret

Unknown_213bc: ; 213bc (8:53bc)
INCBIN "baserom.gbc",$213bc,$213c0 - $213bc

Unknown_213c0: ; 213c0 (8:53c0)
INCBIN "baserom.gbc",$213c0,$213c4 - $213c0

Unknown_213c4: ; 213c4 (8:53c4)
INCBIN "baserom.gbc",$213c4,$213c8 - $213c4

; known jump sources: 17e4d (5:7e4d)
Func_213c8: ; 213c8 (8:53c8)
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call SaveScreenTilesToBuffer2
	ld a, [$d5a2]
	and a
	jr nz, .asm_213f3
	ld a, [$d74b]
	bit 5, a
	jr z, .asm_213ea
	ld a, [$d5a2]
	and a
	jr nz, .asm_213f3
	ld hl, W_SCREENTILESBUFFER
	ld b, $8
	ld c, $e
	jr .asm_213fa
.asm_213ea
	ld hl, W_SCREENTILESBUFFER
	ld b, $6
	ld c, $e
	jr .asm_213fa
.asm_213f3
	ld hl, W_SCREENTILESBUFFER
	ld b, $a
	ld c, $e
.asm_213fa
	call TextBoxBorder
	call UpdateSprites
	ld a, $3
	ld [W_MAXMENUITEMID], a ; $cc28
	ld a, [$d7f1]
	bit 0, a
	jr nz, .asm_21414
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	ld de, Unknown_2148b ; $548b
	jr .asm_2141a
.asm_21414
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	ld de, Unknown_21497 ; $5497
.asm_2141a
	call PlaceString
	FuncCoord 2, 4 ; $c3f2
	ld hl, Coord
	ld de, W_PLAYERNAME ; $d158
	call PlaceString
	ld l, c
	ld h, b
	ld de, Unknown_214a0 ; $54a0
	call PlaceString
	ld a, [$d74b]
	bit 5, a
	jr z, .asm_21462
	FuncCoord 2, 6 ; $c41a
	ld hl, Coord
	ld de, Unknown_214a5 ; $54a5
	call PlaceString
	ld a, [$d5a2]
	and a
	jr z, .asm_2145a
	ld a, $4
	ld [W_MAXMENUITEMID], a ; $cc28
	FuncCoord 2, 8 ; $c442
	ld hl, Coord
	ld de, Unknown_214b2 ; $54b2
	call PlaceString
	FuncCoord 2, 10 ; $c46a
	ld hl, Coord
	ld de, Unknown_214ba ; $54ba
	jr .asm_2146d
.asm_2145a
	FuncCoord 2, 8 ; $c442
	ld hl, Coord
	ld de, Unknown_214ba ; $54ba
	jr .asm_2146d
.asm_21462
	ld a, $2
	ld [W_MAXMENUITEMID], a ; $cc28
	FuncCoord 2, 6 ; $c41a
	ld hl, Coord
	ld de, Unknown_214ba ; $54ba
.asm_2146d
	call PlaceString
	ld a, $3
	ld [W_MENUWATCHEDKEYS], a ; $cc29
	ld a, $2
	ld [W_TOPMENUITEMY], a ; $cc24
	ld a, $1
	ld [W_TOPMENUITEMX], a ; $cc25
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_OLDMENUITEMID], a ; $cc2a
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ret

Unknown_2148b: ; 2148b (8:548b)
INCBIN "baserom.gbc",$2148b,$21497 - $2148b

Unknown_21497: ; 21497 (8:5497)
INCBIN "baserom.gbc",$21497,$214a0 - $21497

Unknown_214a0: ; 214a0 (8:54a0)
INCBIN "baserom.gbc",$214a0,$214a5 - $214a0

Unknown_214a5: ; 214a5 (8:54a5)
INCBIN "baserom.gbc",$214a5,$214b2 - $214a5

Unknown_214b2: ; 214b2 (8:54b2)
INCBIN "baserom.gbc",$214b2,$214ba - $214b2

Unknown_214ba: ; 214ba (8:54ba)
INCBIN "baserom.gbc",$214ba,$214c2 - $214ba

; known jump sources: 17f03 (5:7f03)
Func_214c2: ; 214c2 (8:54c2)
	ld hl, $d730
	set 6, [hl]
	xor a
	ld [$ccd3], a
	inc a               ; MONSTER_NAME
	ld [W_LISTTYPE], a
	call LoadHpBarAndStatusTilePatterns
	ld a, [W_LISTSCROLLOFFSET] ; $cc36
	push af
	ld a, [W_FLAGS_CD60]
	bit 3, a
	jr nz, Func_214e8
	ld a, $99
	call PlaySound
	ld hl, UnnamedText_217e9 ; $57e9
	call PrintText

; known jump sources: 214db (8:54db), 215b8 (8:55b8), 215c8 (8:55c8), 215d1 (8:55d1), 215d7 (8:55d7), 21615 (8:5615), 21624 (8:5624), 21634 (8:5634), 2163d (8:563d), 21643 (8:5643), 21670 (8:5670), 2167f (8:567f), 21688 (8:5688), 216b0 (8:56b0), 216bb (8:56bb)
Func_214e8: ; 214e8 (8:54e8)
	ld a, [$ccd3]
	ld [W_CURMENUITEMID], a ; $cc26
	ld hl, $9780
	ld de, PokeballTileGraphics ; $697e
	ld bc, (BANK(PokeballTileGraphics) << 8) + $01
	call CopyVideoData
	call LoadScreenTilesFromBuffer2DisableBGTransfer
	ld hl, W_SCREENTILESBUFFER
	ld b, $a
	ld c, $c
	call TextBoxBorder
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	ld de, Unknown_216e1 ; $56e1
	call PlaceString
	ld hl, W_TOPMENUITEMY ; $cc24
	ld a, $2
	ld [hli], a
	dec a
	ld [hli], a
	inc hl
	inc hl
	ld a, $4
	ld [hli], a
	ld a, $3
	ld [hli], a
	xor a
	ld [hli], a
	ld [hli], a
	ld hl, W_LISTSCROLLOFFSET ; $cc36
	ld [hli], a
	ld [hl], a
	ld [W_PLAYERMONNUMBER], a ; $cc2f
	ld hl, UnnamedText_217ee ; $57ee
	call PrintText
	FuncCoord 9, 14 ; $c4c1
	ld hl, Coord
	ld b, $2
	ld c, $9
	call TextBoxBorder
	ld a, [$d5a0]
	and $7f
	cp $9
	jr c, .asm_2154f
	sub $9
	FuncCoord 17, 16 ; $c4f1
	ld hl, Coord
	ld [hl], $f7
	add $f6
	jr .asm_21551
.asm_2154f
	add $f7
.asm_21551
	FuncCoord 18, 16 ; $c4f2
	ld [Coord], a
	FuncCoord 10, 16 ; $c4ea
	ld hl, Coord
	ld de, Unknown_21713 ; $5713
	call PlaceString
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Delay3
	call HandleMenuInput
	bit 1, a
	jp nz, Func_21588
	call PlaceUnfilledArrowMenuCursor
	ld a, [W_CURMENUITEMID] ; $cc26
	ld [$ccd3], a
	and a
	jp z, Func_21618
	cp $1
	jp z, Func_215ac
	cp $2
	jp z, Func_21673
	cp $3
	jp z, Func_216b3

; known jump sources: 21569 (8:5569)
Func_21588: ; 21588 (8:5588)
	ld a, [W_FLAGS_CD60]
	bit 3, a
	jr nz, .asm_2159a
	call LoadTextBoxTilePatterns
	ld a, $9a
	call PlaySound
	call WaitForSoundToFinish
.asm_2159a
	ld hl, W_FLAGS_CD60
	res 5, [hl]
	call LoadScreenTilesFromBuffer2
	pop af
	ld [W_LISTSCROLLOFFSET], a ; $cc36
	ld hl, $d730
	res 6, [hl]
	ret

; known jump sources: 2157b (8:557b)
Func_215ac: ; 215ac (8:55ac)
	ld a, [W_NUMINPARTY] ; $d163
	dec a
	jr nz, .asm_215bb
	ld hl, UnnamedText_217fd ; $57fd
	call PrintText
	jp Func_214e8
.asm_215bb
	ld a, [W_NUMINBOX] ; $da80
	cp $14
	jr nz, .asm_215cb
	ld hl, UnnamedText_21802 ; $5802
	call PrintText
	jp Func_214e8
.asm_215cb
	ld hl, W_NUMINPARTY ; $d163
	call Func_216be
	jp c, Func_214e8
	call Func_2174b
	jp nc, Func_214e8
	ld a, [$cf91]
	call GetCryData
	call PlaySoundWaitForCurrent
	ld a, $1
	ld [$cf95], a
	call Func_3a68
	xor a
	ld [$cf95], a
	call RemovePokemon
	call WaitForSoundToFinish
	ld hl, W_WHICHTRADE ; $cd3d
	ld a, [$d5a0]
	and $7f
	cp $9
	jr c, .asm_2160a
	sub $9
	ld [hl], $f7
	inc hl
	add $f6
	jr .asm_2160c
.asm_2160a
	add $f7
.asm_2160c
	ld [hli], a
	ld [hl], $50
	ld hl, UnnamedText_217f8 ; $57f8
	call PrintText
	jp Func_214e8

; known jump sources: 21576 (8:5576)
Func_21618: ; 21618 (8:5618)
	ld a, [W_NUMINBOX] ; $da80
	and a
	jr nz, .asm_21627
	ld hl, UnnamedText_2180c ; $580c
	call PrintText
	jp Func_214e8
.asm_21627
	ld a, [W_NUMINPARTY] ; $d163
	cp $6
	jr nz, .asm_21637
	ld hl, UnnamedText_21811 ; $5811
	call PrintText
	jp Func_214e8
.asm_21637
	ld hl, W_NUMINBOX ; $da80
	call Func_216be
	jp c, Func_214e8
	call Func_2174b
	jp nc, Func_214e8
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, $de06
	call GetPartyMonName
	ld a, [$cf91]
	call GetCryData
	call PlaySoundWaitForCurrent
	xor a
	ld [$cf95], a
	call Func_3a68
	ld a, $1
	ld [$cf95], a
	call RemovePokemon
	call WaitForSoundToFinish
	ld hl, UnnamedText_21807 ; $5807
	call PrintText
	jp Func_214e8

; known jump sources: 21580 (8:5580)
Func_21673: ; 21673 (8:5673)
	ld a, [W_NUMINBOX] ; $da80
	and a
	jr nz, .asm_21682
	ld hl, UnnamedText_2180c ; $580c
	call PrintText
	jp Func_214e8
.asm_21682
	ld hl, W_NUMINBOX ; $da80
	call Func_216be
	jp c, Func_214e8
	ld hl, UnnamedText_2181b ; $581b
	call PrintText
	call YesNoChoice
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jr nz, .asm_21682
	inc a
	ld [$cf95], a
	call RemovePokemon
	call WaitForSoundToFinish
	ld a, [$cf91]
	call PlayCry
	ld hl, UnnamedText_21820 ; $5820
	call PrintText
	jp Func_214e8

; known jump sources: 21585 (8:5585)
Func_216b3: ; 216b3 (8:56b3)
	ld b, BANK(Func_738a1)
	ld hl, Func_738a1
	call Bankswitch ; indirect jump to Func_738a1 (738a1 (1c:78a1))
	jp Func_214e8

; known jump sources: 215ce (8:55ce), 2163a (8:563a), 21685 (8:5685)
Func_216be: ; 216be (8:56be)
	ld a, l
	ld [$cf8b], a
	ld a, h
	ld [$cf8c], a
	xor a
	ld [$cf93], a
	ld [W_LISTMENUID], a ; $cf94
	inc a                ; MONSTER_NAME
	ld [W_LISTTYPE], a
	ld a, [$cc2b]
	ld [W_CURMENUITEMID], a ; $cc26
	call DisplayListMenuID
	ld a, [W_CURMENUITEMID] ; $cc26
	ld [$cc2b], a
	ret

Unknown_216e1: ; 216e1 (8:56e1)
INCBIN "baserom.gbc",$216e1,$21713 - $216e1

Unknown_21713: ; 21713 (8:5713)
INCBIN "baserom.gbc",$21713,$2171b - $21713

Func_2171b: ; 2171b (8:571b)
	ld hl, $d173
	ld bc, $002c
	jr .asm_21729 ; 0x21721 $6
	ld hl, $da9e
	ld bc, $0021
.asm_21729
	ld a, [$cf92]
	call AddNTimes
	ld b, $4
.asm_21731
	ld a, [hli]
	push hl
	push bc
	ld hl, Unknown_21745 ; $5745
	ld de, $0001
	call IsInArray
	pop bc
	pop hl
	ret c
	dec b
	jr nz, .asm_21731 ; 0x21741 $ee
	and a
	ret
; 0x21745

Unknown_21745: ; 21745 (8:5745)
INCBIN "baserom.gbc",$21745,$2174b - $21745

; known jump sources: 215d4 (8:55d4), 21640 (8:5640)
Func_2174b: ; 2174b (8:574b)
	FuncCoord 9, 10 ; $c471
	ld hl, Coord
	ld b, $6
	ld c, $9
	call TextBoxBorder
	ld a, [$ccd3]
	and a
	ld de, Unknown_217cb ; $57cb
	jr nz, .asm_21761
	ld de, Unknown_217d3 ; $57d3
.asm_21761
	FuncCoord 11, 12 ; $c49b
	ld hl, Coord
	call PlaceString
	FuncCoord 11, 14 ; $c4c3
	ld hl, Coord
	ld de, Unknown_217dc ; $57dc
	call PlaceString
	ld hl, W_TOPMENUITEMY ; $cc24
	ld a, $c
	ld [hli], a
	ld a, $a
	ld [hli], a
	xor a
	ld [hli], a
	inc hl
	ld a, $2
	ld [hli], a
	ld a, $3
	ld [hli], a
	xor a
	ld [hl], a
	ld hl, W_LISTSCROLLOFFSET ; $cc36
	ld [hli], a
	ld [hl], a
	ld [W_PLAYERMONNUMBER], a ; $cc2f
	ld [$cc2b], a
.asm_2178f
	call HandleMenuInput
	bit 1, a
	jr nz, .asm_2179f
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jr z, .asm_217a1
	dec a
	jr z, .asm_217a3
.asm_2179f
	and a
	ret
.asm_217a1
	scf
	ret
.asm_217a3
	call SaveScreenTilesToBuffer1
	ld a, [$ccd3]
	and a
	ld a, $0
	jr nz, .asm_217b0
	ld a, $2
.asm_217b0
	ld [$cc49], a
	ld a, $36
	call Predef ; indirect jump to StatusScreen (12953 (4:6953))
	ld a, $37
	call Predef ; indirect jump to StatusScreen2 (12b57 (4:6b57))
	call LoadScreenTilesFromBuffer1
	call ReloadTilesetTilePatterns
	call GoPAL_SET_CF1C
	call LoadGBPal
	jr .asm_2178f

Unknown_217cb: ; 217cb (8:57cb)
INCBIN "baserom.gbc",$217cb,$217d3 - $217cb

Unknown_217d3: ; 217d3 (8:57d3)
INCBIN "baserom.gbc",$217d3,$217dc - $217d3

Unknown_217dc: ; 217dc (8:57dc)
INCBIN "baserom.gbc",$217dc,$217e9 - $217dc

UnnamedText_217e9: ; 217e9 (8:57e9)
	TX_FAR _UnnamedText_217e9
	db $50
; 0x217e9 + 5 bytes

UnnamedText_217ee: ; 217ee (8:57ee)
	TX_FAR _UnnamedText_217ee
	db $50
; 0x217ee + 5 bytes

UnnamedText_217f3: ; 217f3 (8:57f3)
	TX_FAR _UnnamedText_217f3
	db $50
; 0x217f3 + 5 bytes

UnnamedText_217f8: ; 217f8 (8:57f8)
	TX_FAR _UnnamedText_217f8
	db $50
; 0x217f8 + 5 bytes

UnnamedText_217fd: ; 217fd (8:57fd)
	TX_FAR _UnnamedText_217fd
	db $50
; 0x217fd + 5 bytes

UnnamedText_21802: ; 21802 (8:5802)
	TX_FAR _UnnamedText_21802
	db $50
; 0x21802 + 5 bytes

UnnamedText_21807: ; 21807 (8:5807)
	TX_FAR _UnnamedText_21807
	db $50
; 0x21807 + 5 bytes

UnnamedText_2180c: ; 2180c (8:580c)
	TX_FAR _UnnamedText_2180c
	db $50
; 0x2180c + 5 bytes

UnnamedText_21811: ; 21811 (8:5811)
	TX_FAR _UnnamedText_21811
	db $50
; 0x21811 + 5 bytes

UnnamedText_21816: ; 21816 (8:5816)
	TX_FAR _UnnamedText_21816
	db $50
; 0x21816 + 5 bytes

UnnamedText_2181b: ; 2181b (8:581b)
	TX_FAR _UnnamedText_2181b
	db $50
; 0x2181b + 5 bytes

UnnamedText_21820: ; 21820 (8:5820)
	TX_FAR _UnnamedText_21820
	db $50
; 0x21820 + 5 bytes

INCBIN "baserom.gbc",$21825,$21865 - $21825

UnnamedText_21865: ; 21865 (8:5865)
	TX_FAR _UnnamedText_21865
	db $50
; 0x21865 + 5 bytes

INCBIN "baserom.gbc",$2186a,$21879 - $2186a

Func_21879: ; 21879 (8:5879)
	ld c, $0
.asm_2187b
	ld b, $0
	ld hl, $c026
	add hl, bc
	ld a, [hl]
	and a
	jr z, .asm_218a7
	ld a, c
	cp $4
	jr nc, .asm_218a4
	ld a, [$c002]
	and a
	jr z, .asm_218a4
	bit 7, a
	jr nz, .asm_218a7
	set 7, a
	ld [$c002], a
	xor a
	ld [$FF00+$25], a
	ld [$FF00+$1a], a
	ld a, $80
	ld [$FF00+$1a], a
	jr .asm_218a7
.asm_218a4
	call Func_218ae
.asm_218a7
	ld a, c
	inc c
	cp $7
	jr nz, .asm_2187b
	ret

; known jump sources: 218a4 (8:58a4)
Func_218ae: ; 218ae (8:58ae)
	ld b, $0
	ld hl, $c0b6
	add hl, bc
	ld a, [hl]
	cp $1
	jp z, Func_21946
	dec a
	ld [hl], a
	ld a, c
	cp $4
	jr nc, .asm_218ca
	ld hl, $c02a
	add hl, bc
	ld a, [hl]
	and a
	jr z, .asm_218ca
	ret
.asm_218ca
	ld hl, $c02e
	add hl, bc
	bit 6, [hl]
	jr z, .asm_218d5
	call Func_21fcc
.asm_218d5
	ld b, $0
	ld hl, $c036
	add hl, bc
	bit 0, [hl]
	jr nz, .asm_218e7
	ld hl, $c02e
	add hl, bc
	bit 2, [hl]
	jr nz, .asm_218fb
.asm_218e7
	ld hl, $c02e
	add hl, bc
	bit 4, [hl]
	jr z, .asm_218f2
	jp Func_21eb8
.asm_218f2
	ld hl, $c04e
	add hl, bc
	ld a, [hl]
	and a
	jr z, .asm_218fc
	dec [hl]
.asm_218fb
	ret
.asm_218fc
	ld hl, $c056
	add hl, bc
	ld a, [hl]
	and a
	jr nz, .asm_21905
	ret
.asm_21905
	ld d, a
	ld hl, $c05e
	add hl, bc
	ld a, [hl]
	and $f
	and a
	jr z, .asm_21912
	dec [hl]
	ret
.asm_21912
	ld a, [hl]
	swap [hl]
	or [hl]
	ld [hl], a
	ld hl, $c066
	add hl, bc
	ld e, [hl]
	ld hl, $c02e
	add hl, bc
	bit 3, [hl]
	jr z, .asm_21932
	res 3, [hl]
	ld a, d
	and $f
	ld d, a
	ld a, e
	sub d
	jr nc, .asm_21930
	ld a, $0
.asm_21930
	jr .asm_2193e
.asm_21932
	set 3, [hl]
	ld a, d
	and $f0
	swap a
	add e
	jr nc, .asm_2193e
	ld a, $ff
.asm_2193e
	ld d, a
	ld b, $3
	call Func_21ff7
	ld [hl], d
	ret

; known jump sources: 218b7 (8:58b7)
Func_21946: ; 21946 (8:5946)
	ld hl, $c06e
	add hl, bc
	ld a, [hl]
	ld hl, $c04e
	add hl, bc
	ld [hl], a
	ld hl, $c02e
	add hl, bc
	res 4, [hl]
	res 5, [hl]
	ld a, c
	cp $4
	jr nz, .asm_21963
	ld a, [$d083]
	bit 7, a
	ret nz
.asm_21963
	call Func_21967
	ret

; known jump sources: 21963 (8:5963), 219bd (8:59bd), 21a27 (8:5a27), 21a49 (8:5a49), 21a62 (8:5a62), 21aa1 (8:5aa1), 21ab3 (8:5ab3), 21aeb (8:5aeb), 21b38 (8:5b38), 21b78 (8:5b78), 21b85 (8:5b85), 21ba4 (8:5ba4), 21bc2 (8:5bc2), 21bce (8:5bce), 21bdd (8:5bdd), 21bf0 (8:5bf0), 21c59 (8:5c59)
Func_21967: ; 21967 (8:5967)
	call Func_21fe4
	ld d, a
	cp $ff
	jp nz, Func_219f5
	ld b, $0
	ld hl, $c02e
	add hl, bc
	bit 1, [hl]
	jr nz, .asm_219a5
	ld a, c
	cp $3
	jr nc, .asm_21981
	jr .asm_219c0
.asm_21981
	res 2, [hl]
	ld hl, $c036
	add hl, bc
	res 0, [hl]
	cp $6
	jr nz, .asm_21995
	ld a, $0
	ld [$FF00+$1a], a
	ld a, $80
	ld [$FF00+$1a], a
.asm_21995
	jr nz, .asm_219a3
	ld a, [$c003]
	and a
	jr z, .asm_219a3
	xor a
	ld [$c003], a
	jr .asm_219c0
.asm_219a3
	jr .asm_219c9
.asm_219a5
	res 1, [hl]
	ld d, $0
	ld a, c
	add a
	ld e, a
	ld hl, $c006
	add hl, de
	push hl
	ld hl, $c016
	add hl, de
	ld e, l
	ld d, h
	pop hl
	ld a, [de]
	ld [hli], a
	inc de
	ld a, [de]
	ld [hl], a
	jp Func_21967
.asm_219c0
	ld hl, Unknown_222de ; $62de
	add hl, bc
	ld a, [$FF00+$25]
	and [hl]
	ld [$FF00+$25], a
.asm_219c9
	ld a, [$c02a]
	cp $14
	jr nc, .asm_219d2
	jr .asm_219ef
.asm_219d2
	ld a, [$c02a]
	cp $86
	jr z, .asm_219ef
	jr c, .asm_219dd
	jr .asm_219ef
.asm_219dd
	ld a, c
	cp $4
	jr z, .asm_219e6
	call Func_21e6d
	ret c
.asm_219e6
	ld a, [$c005]
	ld [$FF00+$24], a
	xor a
	ld [$c005], a
.asm_219ef
	ld hl, $c026
	add hl, bc
	ld [hl], b
	ret

; known jump sources: 2196d (8:596d)
Func_219f5: ; 219f5 (8:59f5)
	cp $fd
	jp nz, Func_21a2a
	call Func_21fe4
	push af
	call Func_21fe4
	ld d, a
	pop af
	ld e, a
	push de
	ld d, $0
	ld a, c
	add a
	ld e, a
	ld hl, $c006
	add hl, de
	push hl
	ld hl, $c016
	add hl, de
	ld e, l
	ld d, h
	pop hl
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hld]
	ld [de], a
	pop de
	ld [hl], e
	inc hl
	ld [hl], d
	ld b, $0
	ld hl, $c02e
	add hl, bc
	set 1, [hl]
	jp Func_21967

; known jump sources: 219f7 (8:59f7)
Func_21a2a: ; 21a2a (8:5a2a)
	cp $fe
	jp nz, Func_21a65
	call Func_21fe4
	ld e, a
	and a
	jr z, .asm_21a4e
	ld b, $0
	ld hl, $c0be
	add hl, bc
	ld a, [hl]
	cp e
	jr nz, .asm_21a4c
	ld a, $1
	ld [hl], a
	call Func_21fe4
	call Func_21fe4
	jp Func_21967
.asm_21a4c
	inc a
	ld [hl], a
.asm_21a4e
	call Func_21fe4
	push af
	call Func_21fe4
	ld b, a
	ld d, $0
	ld a, c
	add a
	ld e, a
	ld hl, $c006
	add hl, de
	pop af
	ld [hli], a
	ld [hl], b
	jp Func_21967

; known jump sources: 21a2c (8:5a2c)
Func_21a65: ; 21a65 (8:5a65)
	and $f0
	cp $d0
	jp nz, Func_21aa4
	ld a, d
	and $f
	ld b, $0
	ld hl, $c0c6
	add hl, bc
	ld [hl], a
	ld a, c
	cp $3
	jr z, .asm_21aa1
	call Func_21fe4
	ld d, a
	ld a, c
	cp $2
	jr z, .asm_21a8d
	cp $6
	jr nz, .asm_21a9a
	ld hl, $c0e7
	jr .asm_21a90
.asm_21a8d
	ld hl, $c0e6
.asm_21a90
	ld a, d
	and $f
	ld [hl], a
	ld a, d
	and $30
	sla a
	ld d, a
.asm_21a9a
	ld b, $0
	ld hl, $c0de
	add hl, bc
	ld [hl], d
.asm_21aa1
	jp Func_21967

; known jump sources: 21a69 (8:5a69)
Func_21aa4: ; 21aa4 (8:5aa4)
	ld a, d
	cp $e8
	jr nz, .asm_21ab6
	ld b, $0
	ld hl, $c02e
	add hl, bc
	ld a, [hl]
	xor $1
	ld [hl], a
	jp Func_21967
.asm_21ab6
	cp $ea
	jr nz, .asm_21aee
	call Func_21fe4
	ld b, $0
	ld hl, $c04e
	add hl, bc
	ld [hl], a
	ld hl, $c06e
	add hl, bc
	ld [hl], a
	call Func_21fe4
	ld d, a
	and $f0
	swap a
	ld b, $0
	ld hl, $c056
	add hl, bc
	srl a
	ld e, a
	adc b
	swap a
	or e
	ld [hl], a
	ld a, d
	and $f
	ld d, a
	ld hl, $c05e
	add hl, bc
	swap a
	or d
	ld [hl], a
	jp Func_21967
.asm_21aee
	cp $eb
	jr nz, .asm_21b26
	call Func_21fe4
	ld b, $0
	ld hl, $c076
	add hl, bc
	ld [hl], a
	call Func_21fe4
	ld d, a
	and $f0
	swap a
	ld b, a
	ld a, d
	and $f
	call Func_22017
	ld b, $0
	ld hl, $c0a6
	add hl, bc
	ld [hl], d
	ld hl, $c0ae
	add hl, bc
	ld [hl], e
	ld b, $0
	ld hl, $c02e
	add hl, bc
	set 4, [hl]
	call Func_21fe4
	ld d, a
	jp Func_21c8b
.asm_21b26
	cp $ec
	jr nz, .asm_21b3b
	call Func_21fe4
	rrca
	rrca
	and $c0
	ld b, $0
	ld hl, $c03e
	add hl, bc
	ld [hl], a
	jp Func_21967
.asm_21b3b
	cp $ed
	jr nz, .asm_21b7b
	ld a, c
	cp $4
	jr nc, .asm_21b5f
	call Func_21fe4
	ld [$c0e8], a
	call Func_21fe4
	ld [$c0e9], a
	xor a
	ld [$c0ce], a
	ld [$c0cf], a
	ld [$c0d0], a
	ld [$c0d1], a
	jr .asm_21b78
.asm_21b5f
	call Func_21fe4
	ld [$c0ea], a
	call Func_21fe4
	ld [$c0eb], a
	xor a
	ld [$c0d2], a
	ld [$c0d3], a
	ld [$c0d4], a
	ld [$c0d5], a
.asm_21b78
	jp Func_21967
.asm_21b7b
	cp $ee
	jr nz, .asm_21b88
	call Func_21fe4
	ld [$c004], a
	jp Func_21967
.asm_21b88
	cp $ef
	jr nz, .asm_21ba7
	call Func_21fe4
	push bc
	call Func_22035
	pop bc
	ld a, [$c003]
	and a
	jr nz, .asm_21ba4
	ld a, [$c02d]
	ld [$c003], a
	xor a
	ld [$c02d], a
.asm_21ba4
	jp Func_21967
.asm_21ba7
	cp $fc
	jr nz, .asm_21bc5
	call Func_21fe4
	ld b, $0
	ld hl, $c046
	add hl, bc
	ld [hl], a
	and $c0
	ld hl, $c03e
	add hl, bc
	ld [hl], a
	ld hl, $c02e
	add hl, bc
	set 6, [hl]
	jp Func_21967
.asm_21bc5
	cp $f0
	jr nz, .asm_21bd1
	call Func_21fe4
	ld [$FF00+$24], a
	jp Func_21967
.asm_21bd1
	cp $f8
	jr nz, .asm_21be0
	ld b, $0
	ld hl, $c036
	add hl, bc
	set 0, [hl]
	jp Func_21967
.asm_21be0
	and $f0
	cp $e0
	jr nz, .asm_21bf3
	ld hl, $c0d6
	ld b, $0
	add hl, bc
	ld a, d
	and $f
	ld [hl], a
	jp Func_21967
.asm_21bf3
	cp $20
	jr nz, .asm_21c40
	ld a, c
	cp $3
	jr c, .asm_21c40
	ld b, $0
	ld hl, $c036
	add hl, bc
	bit 0, [hl]
	jr nz, .asm_21c40
	call Func_21c8b
	ld d, a
	ld b, $0
	ld hl, $c03e
	add hl, bc
	ld a, [hl]
	or d
	ld d, a
	ld b, $1
	call Func_21ff7
	ld [hl], d
	call Func_21fe4
	ld d, a
	ld b, $2
	call Func_21ff7
	ld [hl], d
	call Func_21fe4
	ld e, a
	ld a, c
	cp $7
	ld a, $0
	jr z, .asm_21c33
	push de
	call Func_21fe4
	pop de
.asm_21c33
	ld d, a
	push de
	call Func_21daa
	call Func_21d79
	pop de
	call Func_21dcc
	ret
.asm_21c40
	ld a, c
	cp $4
	jr c, .asm_21c5c
	ld a, d
	cp $10
	jr nz, .asm_21c5c
	ld b, $0
	ld hl, $c036
	add hl, bc
	bit 0, [hl]
	jr nz, .asm_21c5c
	call Func_21fe4
	ld [$FF00+$10], a
	jp Func_21967
.asm_21c5c
	ld a, c
	cp $3
	jr nz, Func_21c8b
	ld a, d
	and $f0
	cp $b0
	jr z, .asm_21c76
	jr nc, Func_21c8b
	swap a
	ld b, a
	ld a, d
	and $f
	ld d, a
	ld a, b
	push de
	push bc
	jr .asm_21c7e
.asm_21c76
	ld a, d
	and $f
	push af
	push bc
	call Func_21fe4
.asm_21c7e
	ld d, a
	ld a, [$c003]
	and a
	jr nz, .asm_21c89
	ld a, d
	call Func_22035
.asm_21c89
	pop bc
	pop de

; known jump sources: 21b23 (8:5b23), 21c06 (8:5c06), 21c5f (8:5c5f), 21c68 (8:5c68)
Func_21c8b: ; 21c8b (8:5c8b)
	ld a, d
	push af
	and $f
	inc a
	ld b, $0
	ld e, a
	ld d, b
	ld hl, $c0c6
	add hl, bc
	ld a, [hl]
	ld l, b
	call Func_22006
	ld a, c
	cp $4
	jr nc, .asm_21cac
	ld a, [$c0e8]
	ld d, a
	ld a, [$c0e9]
	ld e, a
	jr .asm_21cbf
.asm_21cac
	ld d, $1
	ld e, $0
	cp $7
	jr z, .asm_21cbf
	call Func_21e2f
	ld a, [$c0ea]
	ld d, a
	ld a, [$c0eb]
	ld e, a
.asm_21cbf
	ld a, l
	ld b, $0
	ld hl, $c0ce
	add hl, bc
	ld l, [hl]
	call Func_22006
	ld e, l
	ld d, h
	ld hl, $c0ce
	add hl, bc
	ld [hl], e
	ld a, d
	ld hl, $c0b6
	add hl, bc
	ld [hl], a
	ld hl, $c036
	add hl, bc
	bit 0, [hl]
	jr nz, .asm_21ce9
	ld hl, $c02e
	add hl, bc
	bit 2, [hl]
	jr z, .asm_21ce9
	pop hl
	ret
.asm_21ce9
	pop af
	and $f0
	cp $c0
	jr nz, .asm_21d20
	ld a, c
	cp $4
	jr nc, .asm_21cfd
	ld hl, $c02a
	add hl, bc
	ld a, [hl]
	and a
	jr nz, .asm_21d1f
.asm_21cfd
	ld a, c
	cp $2
	jr z, .asm_21d06
	cp $6
	jr nz, .asm_21d13
.asm_21d06
	ld b, $0
	ld hl, Unknown_222de ; $62de
	add hl, bc
	ld a, [$FF00+$25]
	and [hl]
	ld [$FF00+$25], a
	jr .asm_21d1f
.asm_21d13
	ld b, $2
	call Func_21ff7
	ld a, $8
	ld [hli], a
	inc hl
	ld a, $80
	ld [hl], a
.asm_21d1f
	ret
.asm_21d20
	swap a
	ld b, $0
	ld hl, $c0d6
	add hl, bc
	ld b, [hl]
	call Func_22017
	ld b, $0
	ld hl, $c02e
	add hl, bc
	bit 4, [hl]
	jr z, .asm_21d39
	call Func_21f4e
.asm_21d39
	push de
	ld a, c
	cp $4
	jr nc, .asm_21d4e
	ld hl, $c02a
	ld d, $0
	ld e, a
	add hl, de
	ld a, [hl]
	and a
	jr nz, .asm_21d4c
	jr .asm_21d4e
.asm_21d4c
	pop de
	ret
.asm_21d4e
	ld b, $0
	ld hl, $c0de
	add hl, bc
	ld d, [hl]
	ld b, $2
	call Func_21ff7
	ld [hl], d
	call Func_21daa
	call Func_21d79
	pop de
	ld b, $0
	ld hl, $c02e
	add hl, bc
	bit 0, [hl]
	jr z, .asm_21d70
	inc e
	jr nc, .asm_21d70
	inc d
.asm_21d70
	ld hl, $c066
	add hl, bc
	ld [hl], e
	call Func_21dcc
	ret

; known jump sources: 21c38 (8:5c38), 21d5e (8:5d5e)
Func_21d79: ; 21d79 (8:5d79)
	ld b, $0
	ld hl, Unknown_222e6 ; $62e6
	add hl, bc
	ld a, [$FF00+$25]
	or [hl]
	ld d, a
	ld a, c
	cp $7
	jr z, .asm_21d94
	cp $4
	jr nc, .asm_21da6
	ld hl, $c02a
	add hl, bc
	ld a, [hl]
	and a
	jr nz, .asm_21da6
.asm_21d94
	ld a, [$c004]
	ld hl, Unknown_222e6 ; $62e6
	add hl, bc
	and [hl]
	ld d, a
	ld a, [$FF00+$25]
	ld hl, Unknown_222de ; $62de
	add hl, bc
	and [hl]
	or d
	ld d, a
.asm_21da6
	ld a, d
	ld [$FF00+$25], a
	ret

; known jump sources: 21c35 (8:5c35), 21d5b (8:5d5b)
Func_21daa: ; 21daa (8:5daa)
	ld b, $0
	ld hl, $c0b6
	add hl, bc
	ld d, [hl]
	ld a, c
	cp $2
	jr z, .asm_21dc5
	cp $6
	jr z, .asm_21dc5
	ld a, d
	and $3f
	ld d, a
	ld hl, $c03e
	add hl, bc
	ld a, [hl]
	or d
	ld d, a
.asm_21dc5
	ld b, $1
	call Func_21ff7
	ld [hl], d
	ret

; known jump sources: 21c3c (8:5c3c), 21d75 (8:5d75)
Func_21dcc: ; 21dcc (8:5dcc)
	ld a, c
	cp $2
	jr z, .asm_21dd5
	cp $6
	jr nz, .asm_21e02
.asm_21dd5
	push de
	ld de, $c0e6
	cp $2
	jr z, .asm_21de0
	ld de, $c0e7
.asm_21de0
	ld a, [de]
	add a
	ld d, $0
	ld e, a
	ld hl, Unknown_20361 ; $4361
	add hl, de
	ld e, [hl]
	inc hl
	ld d, [hl]
	ld hl, $ff30
	ld b, $f
	ld a, $0
	ld [$FF00+$1a], a
.asm_21df5
	ld a, [de]
	inc de
	ld [hli], a
	ld a, b
	dec b
	and a
	jr nz, .asm_21df5
	ld a, $80
	ld [$FF00+$1a], a
	pop de
.asm_21e02
	ld a, d
	or $80
	and $c7
	ld d, a
	ld b, $3
	call Func_21ff7
	ld [hl], e
	inc hl
	ld [hl], d
	ld a, c
	cp $4
	jr c, .asm_21e18
	call Func_21e56
.asm_21e18
	ret

INCBIN "baserom.gbc",$21e19,$21e2f - $21e19

; known jump sources: 21cb4 (8:5cb4)
Func_21e2f: ; 21e2f (8:5e2f)
	call Func_21e8b
	jr c, .asm_21e39
	call Func_21e9f
	jr nc, .asm_21e4c
.asm_21e39
	ld d, $0
	ld a, [$c0f2]
	add $80
	jr nc, .asm_21e43
	inc d
.asm_21e43
	ld [$c0eb], a
	ld a, d
	ld [$c0ea], a
	jr .asm_21e55
.asm_21e4c
	xor a
	ld [$c0eb], a
	ld a, $1
	ld [$c0ea], a
.asm_21e55
	ret

; known jump sources: 21e15 (8:5e15)
Func_21e56: ; 21e56 (8:5e56)
	call Func_21e8b
	jr c, .asm_21e60
	call Func_21e9f
	jr nc, .asm_21e6c
.asm_21e60
	ld a, [$c0f1]
	add e
	jr nc, .asm_21e67
	inc d
.asm_21e67
	dec hl
	ld e, a
	ld [hl], e
	inc hl
	ld [hl], d
.asm_21e6c
	ret

; known jump sources: 219e2 (8:59e2)
Func_21e6d: ; 21e6d (8:5e6d)
	call Func_21e8b
	jr nc, .asm_21e88
	ld hl, $c006
	ld e, c
	ld d, $0
	sla e
	rl d
	add hl, de
	ld a, [hl]
	sub $1
	ld [hl], a
	inc hl
	ld a, [hl]
	sbc $0
	ld [hl], a
	scf
	ret
.asm_21e88
	scf
	ccf
	ret

; known jump sources: 21e2f (8:5e2f), 21e56 (8:5e56), 21e6d (8:5e6d)
Func_21e8b: ; 21e8b (8:5e8b)
	ld a, [$c02a]
	cp $14
	jr nc, .asm_21e94
	jr .asm_21e9a
.asm_21e94
	cp $86
	jr z, .asm_21e9a
	jr c, .asm_21e9d
.asm_21e9a
	scf
	ccf
	ret
.asm_21e9d
	scf
	ret

; known jump sources: 21e34 (8:5e34), 21e5b (8:5e5b)
Func_21e9f: ; 21e9f (8:5e9f)
	ld a, [$c02d]
	ld b, a
	ld a, [$c02a]
	or b
	cp $9d
	jr nc, .asm_21ead
	jr .asm_21eb3
.asm_21ead
	cp $ea
	jr z, .asm_21eb3
	jr c, .asm_21eb6
.asm_21eb3
	scf
	ccf
	ret
.asm_21eb6
	scf
	ret

; known jump sources: 218ef (8:58ef)
Func_21eb8: ; 21eb8 (8:5eb8)
	ld hl, $c02e
	add hl, bc
	bit 5, [hl]
	jp nz, Func_21eff
	ld hl, $c09e
	add hl, bc
	ld e, [hl]
	ld hl, $c096
	add hl, bc
	ld d, [hl]
	ld hl, $c07e
	add hl, bc
	ld l, [hl]
	ld h, b
	add hl, de
	ld d, h
	ld e, l
	ld hl, $c08e
	add hl, bc
	push hl
	ld hl, $c086
	add hl, bc
	ld a, [hl]
	pop hl
	add [hl]
	ld [hl], a
	ld a, $0
	adc e
	ld e, a
	ld a, $0
	adc d
	ld d, a
	ld hl, $c0a6
	add hl, bc
	ld a, [hl]
	cp d
	jp c, Func_21f45
	jr nz, asm_21f32
	ld hl, $c0ae
	add hl, bc
	ld a, [hl]
	cp e
	jp c, Func_21f45
	jr asm_21f32

; known jump sources: 21ebe (8:5ebe)
Func_21eff: ; 21eff (8:5eff)
	ld hl, $c09e
	add hl, bc
	ld a, [hl]
	ld hl, $c096
	add hl, bc
	ld d, [hl]
	ld hl, $c07e
	add hl, bc
	ld e, [hl]
	sub e
	ld e, a
	ld a, d
	sbc b
	ld d, a
	ld hl, $c086
	add hl, bc
	ld a, [hl]
	add a
	ld [hl], a
	ld a, e
	sbc b
	ld e, a
	ld a, d
	sbc b
	ld d, a
	ld hl, $c0a6
	add hl, bc
	ld a, d
	cp [hl]
	jr c, Func_21f45
	jr nz, asm_21f32
	ld hl, $c0ae
	add hl, bc
	ld a, e
	cp [hl]
	jr c, Func_21f45
asm_21f32: ; 21f32 (8:5f32)
	ld hl, $c09e
	add hl, bc
	ld [hl], e
	ld hl, $c096
	add hl, bc
	ld [hl], d
	ld b, $3
	call Func_21ff7
	ld a, e
	ld [hli], a
	ld [hl], d
	ret

; known jump sources: 21eef (8:5eef), 21efa (8:5efa), 21f26 (8:5f26), 21f30 (8:5f30)
Func_21f45: ; 21f45 (8:5f45)
	ld hl, $c02e
	add hl, bc
	res 4, [hl]
	res 5, [hl]
	ret

; known jump sources: 21d36 (8:5d36)
Func_21f4e: ; 21f4e (8:5f4e)
	ld hl, $c096
	add hl, bc
	ld [hl], d
	ld hl, $c09e
	add hl, bc
	ld [hl], e
	ld hl, $c0b6
	add hl, bc
	ld a, [hl]
	ld hl, $c076
	add hl, bc
	sub [hl]
	jr nc, .asm_21f66
	ld a, $1
.asm_21f66
	ld [hl], a
	ld hl, $c0ae
	add hl, bc
	ld a, e
	sub [hl]
	ld e, a
	ld a, d
	sbc b
	ld hl, $c0a6
	add hl, bc
	sub [hl]
	jr c, .asm_21f82
	ld d, a
	ld b, $0
	ld hl, $c02e
	add hl, bc
	set 5, [hl]
	jr .asm_21fa5
.asm_21f82
	ld hl, $c096
	add hl, bc
	ld d, [hl]
	ld hl, $c09e
	add hl, bc
	ld e, [hl]
	ld hl, $c0ae
	add hl, bc
	ld a, [hl]
	sub e
	ld e, a
	ld a, d
	sbc b
	ld d, a
	ld hl, $c0a6
	add hl, bc
	ld a, [hl]
	sub d
	ld d, a
	ld b, $0
	ld hl, $c02e
	add hl, bc
	res 5, [hl]
.asm_21fa5
	ld hl, $c076
	add hl, bc
.asm_21fa9
	inc b
	ld a, e
	sub [hl]
	ld e, a
	jr nc, .asm_21fa9
	ld a, d
	and a
	jr z, .asm_21fb7
	dec a
	ld d, a
	jr .asm_21fa9
.asm_21fb7
	ld a, e
	add [hl]
	ld d, b
	ld b, $0
	ld hl, $c07e
	add hl, bc
	ld [hl], d
	ld hl, $c086
	add hl, bc
	ld [hl], a
	ld hl, $c08e
	add hl, bc
	ld [hl], a
	ret

; known jump sources: 218d2 (8:58d2)
Func_21fcc: ; 21fcc (8:5fcc)
	ld b, $0
	ld hl, $c046
	add hl, bc
	ld a, [hl]
	rlca
	rlca
	ld [hl], a
	and $c0
	ld d, a
	ld b, $1
	call Func_21ff7
	ld a, [hl]
	and $3f
	or d
	ld [hl], a
	ret

; known jump sources: 21967 (8:5967), 219fa (8:59fa), 219fe (8:59fe), 21a2f (8:5a2f), 21a43 (8:5a43), 21a46 (8:5a46), 21a4e (8:5a4e), 21a52 (8:5a52), 21a7b (8:5a7b), 21aba (8:5aba), 21ac9 (8:5ac9), 21af2 (8:5af2), 21afc (8:5afc), 21b1f (8:5b1f), 21b2a (8:5b2a), 21b44 (8:5b44), 21b4a (8:5b4a), 21b5f (8:5b5f), 21b65 (8:5b65), 21b7f (8:5b7f), 21b8c (8:5b8c), 21bab (8:5bab), 21bc9 (8:5bc9), 21c19 (8:5c19), 21c23 (8:5c23), 21c2f (8:5c2f), 21c54 (8:5c54), 21c7b (8:5c7b)
Func_21fe4: ; 21fe4 (8:5fe4)
	ld d, $0
	ld a, c
	add a
	ld e, a
	ld hl, $c006
	add hl, de
	ld a, [hli]
	ld e, a
	ld a, [hld]
	ld d, a
	ld a, [de]
	inc de
	ld [hl], e
	inc hl
	ld [hl], d
	ret

; known jump sources: 21941 (8:5941), 21c15 (8:5c15), 21c1f (8:5c1f), 21d15 (8:5d15), 21d57 (8:5d57), 21dc7 (8:5dc7), 21e0a (8:5e0a), 21f3e (8:5f3e), 21fdb (8:5fdb)
Func_21ff7: ; 21ff7 (8:5ff7)
	ld a, c
	ld hl, Unknown_222d6 ; $62d6
	add l
	jr nc, .asm_21fff
	inc h
.asm_21fff
	ld l, a
	ld a, [hl]
	add b
	ld l, a
	ld h, $ff
	ret

; known jump sources: 21c9a (8:5c9a), 21cc7 (8:5cc7)
Func_22006: ; 22006 (8:6006)
	ld h, $0
.asm_22008
	srl a
	jr nc, .asm_2200d
	add hl, de
.asm_2200d
	sla e
	rl d
	and a
	jr z, .asm_22016
	jr .asm_22008
.asm_22016
	ret

; known jump sources: 21b08 (8:5b08), 21d29 (8:5d29)
Func_22017: ; 22017 (8:6017)
	ld h, $0
	ld l, a
	add hl, hl
	ld d, h
	ld e, l
	ld hl, Unknown_222ee ; $62ee
	add hl, de
	ld e, [hl]
	inc hl
	ld d, [hl]
	ld a, b
.asm_22025
	cp $7
	jr z, .asm_22030
	sra d
	rr e
	inc a
	jr .asm_22025
.asm_22030
	ld a, $8
	add d
	ld d, a
	ret

; known jump sources: 21b90 (8:5b90), 21c86 (8:5c86)
Func_22035: ; 22035 (8:6035)
	ld [$c001], a
	cp $ff
	jp z, Func_221f3
	cp $e9
	jp z, Func_2210d
	jp c, Func_2210d
	cp $fe
	jr z, .asm_2204c
	jp nc, Func_2210d
.asm_2204c
	xor a
	ld [$c000], a
	ld [$c003], a
	ld [$c0e9], a
	ld [$c0e6], a
	ld [$c0e7], a
	ld d, $8
	ld hl, $c016
	call Func_22248
	ld hl, $c006
	call Func_22248
	ld d, $4
	ld hl, $c026
	call Func_22248
	ld hl, $c02e
	call Func_22248
	ld hl, $c03e
	call Func_22248
	ld hl, $c046
	call Func_22248
	ld hl, $c04e
	call Func_22248
	ld hl, $c056
	call Func_22248
	ld hl, $c05e
	call Func_22248
	ld hl, $c066
	call Func_22248
	ld hl, $c06e
	call Func_22248
	ld hl, $c036
	call Func_22248
	ld hl, $c076
	call Func_22248
	ld hl, $c07e
	call Func_22248
	ld hl, $c086
	call Func_22248
	ld hl, $c08e
	call Func_22248
	ld hl, $c096
	call Func_22248
	ld hl, $c09e
	call Func_22248
	ld hl, $c0a6
	call Func_22248
	ld hl, $c0ae
	call Func_22248
	ld a, $1
	ld hl, $c0be
	call Func_22248
	ld hl, $c0b6
	call Func_22248
	ld hl, $c0c6
	call Func_22248
	ld [$c0e8], a
	ld a, $ff
	ld [$c004], a
	xor a
	ld [$FF00+$24], a
	ld a, $8
	ld [$FF00+$10], a
	ld a, $0
	ld [$FF00+$25], a
	xor a
	ld [$FF00+$1a], a
	ld a, $80
	ld [$FF00+$1a], a
	ld a, $77
	ld [$FF00+$24], a
	jp Func_2224e

; known jump sources: 2203f (8:603f), 22042 (8:6042), 22049 (8:6049)
Func_2210d: ; 2210d (8:610d)
	ld l, a
	ld e, a
	ld h, $0
	ld d, h
	add hl, hl
	add hl, de
	ld de, Unknown_20000 ; $4000
	add hl, de
	ld a, h
	ld [$c0ec], a
	ld a, l
	ld [$c0ed], a
	ld a, [hl]
	and $c0
	rlca
	rlca
	ld c, a

; known jump sources: 221f0 (8:61f0)
Func_22126: ; 22126 (8:6126)
	ld d, c
	ld a, c
	add a
	add c
	ld c, a
	ld b, $0
	ld a, [$c0ec]
	ld h, a
	ld a, [$c0ed]
	ld l, a
	add hl, bc
	ld c, d
	ld a, [hl]
	and $f
	ld e, a
	ld d, $0
	ld hl, $c026
	add hl, de
	ld a, [hl]
	and a
	jr z, .asm_22162
	ld a, e
	cp $7
	jr nz, .asm_22159
	ld a, [$c001]
	cp $14
	jr nc, .asm_22152
	ret
.asm_22152
	ld a, [hl]
	cp $14
	jr z, .asm_22162
	jr c, .asm_22162
.asm_22159
	ld a, [$c001]
	cp [hl]
	jr z, .asm_22162
	jr c, .asm_22162
	ret
.asm_22162
	xor a
	push de
	ld h, d
	ld l, e
	add hl, hl
	ld d, h
	ld e, l
	ld hl, $c016
	add hl, de
	ld [hli], a
	ld [hl], a
	ld hl, $c006
	add hl, de
	ld [hli], a
	ld [hl], a
	pop de
	ld hl, $c026
	add hl, de
	ld [hl], a
	ld hl, $c02e
	add hl, de
	ld [hl], a
	ld hl, $c03e
	add hl, de
	ld [hl], a
	ld hl, $c046
	add hl, de
	ld [hl], a
	ld hl, $c04e
	add hl, de
	ld [hl], a
	ld hl, $c056
	add hl, de
	ld [hl], a
	ld hl, $c05e
	add hl, de
	ld [hl], a
	ld hl, $c066
	add hl, de
	ld [hl], a
	ld hl, $c06e
	add hl, de
	ld [hl], a
	ld hl, $c076
	add hl, de
	ld [hl], a
	ld hl, $c07e
	add hl, de
	ld [hl], a
	ld hl, $c086
	add hl, de
	ld [hl], a
	ld hl, $c08e
	add hl, de
	ld [hl], a
	ld hl, $c096
	add hl, de
	ld [hl], a
	ld hl, $c09e
	add hl, de
	ld [hl], a
	ld hl, $c0a6
	add hl, de
	ld [hl], a
	ld hl, $c0ae
	add hl, de
	ld [hl], a
	ld hl, $c036
	add hl, de
	ld [hl], a
	ld a, $1
	ld hl, $c0be
	add hl, de
	ld [hl], a
	ld hl, $c0b6
	add hl, de
	ld [hl], a
	ld hl, $c0c6
	add hl, de
	ld [hl], a
	ld a, e
	cp $4
	jr nz, .asm_221ea
	ld a, $8
	ld [$FF00+$10], a
.asm_221ea
	ld a, c
	and a
	jp z, Func_2224e
	dec c
	jp Func_22126

; known jump sources: 2203a (8:603a)
Func_221f3: ; 221f3 (8:61f3)
	ld a, $80
	ld [$FF00+$26], a
	ld [$FF00+$1a], a
	xor a
	ld [$FF00+$25], a
	ld [$FF00+$1c], a
	ld a, $8
	ld [$FF00+$10], a
	ld [$FF00+$12], a
	ld [$FF00+$17], a
	ld [$FF00+$21], a
	ld a, $40
	ld [$FF00+$14], a
	ld [$FF00+$19], a
	ld [$FF00+$23], a
	ld a, $77
	ld [$FF00+$24], a
	xor a
	ld [$c000], a
	ld [$c003], a
	ld [$c002], a
	ld [$c0e9], a
	ld [$c0eb], a
	ld [$c0e6], a
	ld [$c0e7], a
	ld d, $a0
	ld hl, $c006
	call Func_22248
	ld a, $1
	ld d, $18
	ld hl, $c0b6
	call Func_22248
	ld [$c0e8], a
	ld [$c0ea], a
	ld a, $ff
	ld [$c004], a
	ret

; known jump sources: 22061 (8:6061), 22067 (8:6067), 2206f (8:606f), 22075 (8:6075), 2207b (8:607b), 22081 (8:6081), 22087 (8:6087), 2208d (8:608d), 22093 (8:6093), 22099 (8:6099), 2209f (8:609f), 220a5 (8:60a5), 220ab (8:60ab), 220b1 (8:60b1), 220b7 (8:60b7), 220bd (8:60bd), 220c3 (8:60c3), 220c9 (8:60c9), 220cf (8:60cf), 220d5 (8:60d5), 220dd (8:60dd), 220e3 (8:60e3), 220e9 (8:60e9), 2222f (8:622f), 22239 (8:6239)
Func_22248: ; 22248 (8:6248)
	ld b, d
.asm_22249
	ld [hli], a
	dec b
	jr nz, .asm_22249
	ret

; known jump sources: 2210a (8:610a), 221ec (8:61ec)
Func_2224e: ; 2224e (8:624e)
	ld a, [$c001]
	ld l, a
	ld e, a
	ld h, $0
	ld d, h
	add hl, hl
	add hl, de
	ld de, Unknown_20000 ; $4000
	add hl, de
	ld e, l
	ld d, h
	ld hl, $c006
	ld a, [de]
	ld b, a
	rlca
	rlca
	and $3
	ld c, a
	ld a, b
	and $f
	ld b, c
	inc b
	inc de
	ld c, $0
.asm_22270
	cp c
	jr z, .asm_22278
	inc c
	inc hl
	inc hl
	jr .asm_22270
.asm_22278
	push hl
	push bc
	push af
	ld b, $0
	ld c, a
	ld hl, $c026
	add hl, bc
	ld a, [$c001]
	ld [hl], a
	pop af
	cp $3
	jr c, .asm_22291
	ld hl, $c02e
	add hl, bc
	set 2, [hl]
.asm_22291
	pop bc
	pop hl
	ld a, [de]
	ld [hli], a
	inc de
	ld a, [de]
	ld [hli], a
	inc de
	inc c
	dec b
	ld a, b
	and a
	ld a, [de]
	inc de
	jr nz, .asm_22270
	ld a, [$c001]
	cp $14
	jr nc, .asm_222aa
	jr .asm_222d4
.asm_222aa
	ld a, [$c001]
	cp $86
	jr z, .asm_222d4
	jr c, .asm_222b5
	jr .asm_222d4
.asm_222b5
	ld hl, $c02a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld hl, $c012
	ld de, Unknown_222d5 ; $62d5
	ld [hl], e
	inc hl
	ld [hl], d
	ld a, [$c005]
	and a
	jr nz, .asm_222d4
	ld a, [$FF00+$24]
	ld [$c005], a
	ld a, $77
	ld [$FF00+$24], a
.asm_222d4
	ret

Unknown_222d5: ; 222d5 (8:62d5)
INCBIN "baserom.gbc",$222d5,$222d6 - $222d5

Unknown_222d6: ; 222d6 (8:62d6)
INCBIN "baserom.gbc",$222d6,$222de - $222d6

Unknown_222de: ; 222de (8:62de)
INCBIN "baserom.gbc",$222de,$222e6 - $222de

Unknown_222e6: ; 222e6 (8:62e6)
INCBIN "baserom.gbc",$222e6,$222ee - $222e6

Unknown_222ee: ; 222ee (8:62ee)
INCBIN "baserom.gbc",$222ee,$22306 - $222ee

; known jump sources: e1d6 (3:61d6)
Func_22306: ; 22306 (8:6306)
	ld a, $9a
	call PlaySoundWaitForCurrent
	ld hl, $c00e
	ld de, Unknown_22322 ; $6322
	call Func_2231d
	ld de, Unknown_22325 ; $6325
	call Func_2231d
	ld de, Unknown_2049b ; $449b

; known jump sources: 22311 (8:6311), 22317 (8:6317)
Func_2231d: ; 2231d (8:631d)
	ld a, e
	ld [hli], a
	ld a, d
	ld [hli], a
	ret

Unknown_22322: ; 22322 (8:6322)
INCBIN "baserom.gbc",$22322,$22325 - $22322

Unknown_22325: ; 22325 (8:6325)
INCBIN "baserom.gbc",$22325,$23f52 - $22325

SECTION "bank9",ROMX,BANK[$9]

RhydonPicFront: ; 24000 (9:4000)
	INCBIN "pic/bmon/rhydon.pic"
RhydonPicBack: ; 24202 (9:4202)
	INCBIN "pic/monback/rhydonb.pic"
KangaskhanPicFront: ; 2429a (9:429a)
	INCBIN "pic/bmon/kangaskhan.pic"
KangaskhanPicBack: ; 244a6 (9:44a6)
	INCBIN "pic/monback/kangaskhanb.pic"
NidoranMPicFront: ; 2453c (9:453c)
	INCBIN "pic/bmon/nidoranm.pic"
NidoranMPicBack: ; 24623 (9:4623)
	INCBIN "pic/monback/nidoranmb.pic"
ClefairyPicFront: ; 24682 (9:4682)
	INCBIN "pic/bmon/clefairy.pic"
ClefairyPicBack: ; 24785 (9:4785)
	INCBIN "pic/monback/clefairyb.pic"
SpearowPicFront: ; 247df (9:47df)
	INCBIN "pic/bmon/spearow.pic"
SpearowPicBack: ; 248c2 (9:48c2)
	INCBIN "pic/monback/spearowb.pic"
VoltorbPicFront: ; 24911 (9:4911)
	INCBIN "pic/bmon/voltorb.pic"
VoltorbPicBack: ; 2499a (9:499a)
	INCBIN "pic/monback/voltorbb.pic"
NidokingPicFront: ; 249f8 (9:49f8)
	INCBIN "pic/bmon/nidoking.pic"
NidokingPicBack: ; 24c60 (9:4c60)
	INCBIN "pic/monback/nidokingb.pic"
SlowbroPicFront: ; 24d0a (9:4d0a)
	INCBIN "pic/bmon/slowbro.pic"
SlowbroPicBack: ; 24f87 (9:4f87)
	INCBIN "pic/monback/slowbrob.pic"
IvysaurPicFront: ; 2502b (9:502b)
	INCBIN "pic/bmon/ivysaur.pic"
IvysaurPicBack: ; 25157 (9:5157)
	INCBIN "pic/monback/ivysaurb.pic"
ExeggutorPicFront: ; 251d6 (9:51d6)
	INCBIN "pic/bmon/exeggutor.pic"
ExeggutorPicBack: ; 253f8 (9:53f8)
	INCBIN "pic/monback/exeggutorb.pic"
LickitungPicFront: ; 254a7 (9:54a7)
	INCBIN "pic/bmon/lickitung.pic"
LickitungPicBack: ; 2563e (9:563e)
	INCBIN "pic/monback/lickitungb.pic"
ExeggcutePicFront: ; 256d7 (9:56d7)
	INCBIN "pic/bmon/exeggcute.pic"
ExeggcutePicBack: ; 258f0 (9:58f0)
	INCBIN "pic/monback/exeggcuteb.pic"
GrimerPicFront: ; 25973 (9:5973)
	INCBIN "pic/bmon/grimer.pic"
GrimerPicBack: ; 25ab0 (9:5ab0)
	INCBIN "pic/monback/grimerb.pic"
GengarPicFront: ; 25b76 (9:5b76)
	INCBIN "pic/bmon/gengar.pic"
GengarPicBack: ; 25cc6 (9:5cc6)
	INCBIN "pic/monback/gengarb.pic"
NidoranFPicFront: ; 25d28 (9:5d28)
	INCBIN "pic/bmon/nidoranf.pic"
NidoranFPicBack: ; 25dc2 (9:5dc2)
	INCBIN "pic/monback/nidoranfb.pic"
NidoqueenPicFront: ; 25e09 (9:5e09)
	INCBIN "pic/bmon/nidoqueen.pic"
NidoqueenPicBack: ; 25fef (9:5fef)
	INCBIN "pic/monback/nidoqueenb.pic"
CubonePicFront: ; 260a8 (9:60a8)
	INCBIN "pic/bmon/cubone.pic"
CubonePicBack: ; 26196 (9:6196)
	INCBIN "pic/monback/cuboneb.pic"
RhyhornPicFront: ; 26208 (9:6208)
	INCBIN "pic/bmon/rhyhorn.pic"
RhyhornPicBack: ; 2640f (9:640f)
	INCBIN "pic/monback/rhyhornb.pic"
LaprasPicFront: ; 264c1 (9:64c1)
	INCBIN "pic/bmon/lapras.pic"
LaprasPicBack: ; 2667c (9:667c)
	INCBIN "pic/monback/laprasb.pic"
ArcaninePicFront: ; 266ff (9:66ff)
	INCBIN "pic/bmon/arcanine.pic"
ArcaninePicBack: ; 2693d (9:693d)
	INCBIN "pic/monback/arcanineb.pic"
GyaradosPicFront: ; 269d4 (9:69d4)
	INCBIN "pic/bmon/gyarados.pic"
GyaradosPicBack: ; 26c25 (9:6c25)
	INCBIN "pic/monback/gyaradosb.pic"
ShellderPicFront: ; 26cb6 (9:6cb6)
	INCBIN "pic/bmon/shellder.pic"
ShellderPicBack: ; 26dc3 (9:6dc3)
	INCBIN "pic/monback/shellderb.pic"
TentacoolPicFront: ; 26e2a (9:6e2a)
	INCBIN "pic/bmon/tentacool.pic"
TentacoolPicBack: ; 26f1c (9:6f1c)
	INCBIN "pic/monback/tentacoolb.pic"
GastlyPicFront: ; 26f77 (9:6f77)
	INCBIN "pic/bmon/gastly.pic"
GastlyPicBack: ; 27190 (9:7190)
	INCBIN "pic/monback/gastlyb.pic"
ScytherPicFront: ; 2721c (9:721c)
	INCBIN "pic/bmon/scyther.pic"
ScytherPicBack: ; 2743c (9:743c)
	INCBIN "pic/monback/scytherb.pic"
StaryuPicFront: ; 274e0 (9:74e0)
	INCBIN "pic/bmon/staryu.pic"
StaryuPicBack: ; 275ec (9:75ec)
	INCBIN "pic/monback/staryub.pic"
BlastoisePicFront: ; 27637 (9:7637)
	INCBIN "pic/bmon/blastoise.pic"
BlastoisePicBack: ; 27851 (9:7851)
	INCBIN "pic/monback/blastoiseb.pic"
PinsirPicFront: ; 278da (9:78da)
	INCBIN "pic/bmon/pinsir.pic"
PinsirPicBack: ; 27aaa (9:7aaa)
	INCBIN "pic/monback/pinsirb.pic"
TangelaPicFront: ; 27b39 (9:7b39)
	INCBIN "pic/bmon/tangela.pic"
TangelaPicBack: ; 27ce7 (9:7ce7)
	INCBIN "pic/monback/tangelab.pic"

; known jump sources: 12a35 (4:6a35), 70320 (1c:4320)
Func_27d6b: ; 27d6b (9:7d6b)
	call Load16BitRegisters
	push hl
	call GetMonHeader
	pop hl
	push hl
	ld a, [W_MONHTYPE1]
	call Func_27d89
	ld a, [W_MONHTYPE1]
	ld b, a
	ld a, [W_MONHTYPE2]
	cp b
	pop hl
	jr z, asm_27d8c
	ld bc, $28
	add hl, bc

; known jump sources: 27d77 (9:7d77)
Func_27d89: ; 27d89 (9:7d89)
	push hl
	jr asm_27d9f
asm_27d8c: ; 27d8c (9:7d8c)
	ld a, $7f
	ld bc, $13
	add hl, bc
	ld bc, $6
	jp FillMemory

; known jump sources: 3d54b (f:554b)
Func_27d98: ; 27d98 (9:7d98)
	call Load16BitRegisters
	push hl
	ld a, [W_PLAYERMOVETYPE] ; $cfd5
asm_27d9f: ; 27d9f (9:7d9f)
	add a
	ld hl, TypeNamePointers ; $7dae
	ld e, a
	ld d, $0
	add hl, de
	ld a, [hli]
	ld e, a
	ld d, [hl]
	pop hl
	jp PlaceString
; 27dae (9:7dae)
TypeNamePointers: ; 27dae (9:7dae)
	dw Type00Name
	dw Type01Name
	dw Type02Name
	dw Type03Name
	dw Type04Name
	dw Type05Name
	dw Type06Name
	dw Type07Name
	dw Type08Name
	dw Type00Name
	dw Type00Name
	dw Type00Name
	dw Type00Name
	dw Type00Name
	dw Type00Name
	dw Type00Name
	dw Type00Name
	dw Type00Name
	dw Type00Name
	dw Type00Name
	dw Type14Name
	dw Type15Name
	dw Type16Name
	dw Type17Name
	dw Type18Name
	dw Type19Name
	dw Type1AName

Type00Name: ; 27de4 (9:7de4)
	db "NORMAL@"
Type01Name: ; 27deb (9:7deb)
	db "FIGHTING@"
Type02Name: ; 27df4 (9:7df4)
	db "FLYING@"
Type03Name: ; 27dfb (9:7dfb)
	db "POISON@"
Type14Name: ; 27e02 (9:7e02)
	db "FIRE@"
Type15Name: ; 27e07 (9:7e07)
	db "WATER@"
Type16Name: ; 27e0d (9:7e0d)
	db "GRASS@"
Type17Name: ; 27e13 (9:7e13)
	db "ELECTRIC@"
Type18Name: ; 27e1c (9:7e1c)
	db "PSYCHIC@"
Type19Name: ; 27e24 (9:7e24)
	db "ICE@"
Type04Name: ; 27e28 (9:7e28)
	db "GROUND@"
Type05Name: ; 27e2f (9:7e2f)
	db "ROCK@"
Type06Name: ; 27e34 (9:7e34)
	db "BIRD@"
Type07Name: ; 27e39 (9:7e39)
	db "BUG@"
Type08Name: ; 27e3d (9:7e3d)
	db "GHOST@"
Type1AName: ; 27e43 (9:7e43)
	db "DRAGON@"

SaveTrainerName: ; 27e4a (9:7e4a)
	ld hl,TrainerNamePointers
	ld a,[W_TRAINERCLASS]
	dec a
	ld c,a
	ld b,0
	add hl,bc
	add hl,bc
	ld a,[hli]
	ld h,[hl]
	ld l,a
	ld de,$CD6D
.CopyCharacter
	ld a,[hli]
	ld [de],a
	inc de
	cp "@"
	jr nz,.CopyCharacter
	ret

TrainerNamePointers: ; 27e64 (9:7e64)
; what is the point of these?
	dw YoungsterName
	dw BugCatcherName
	dw LassName
	dw $D04A
	dw JrTrainerMName
	dw JrTrainerFName
	dw PokemaniacName
	dw SuperNerdName
	dw $D04A
	dw $D04A
	dw BurglarName
	dw EngineerName
	dw JugglerXName
	dw $D04A
	dw SwimmerName
	dw $D04A
	dw $D04A
	dw BeautyName
	dw $D04A
	dw RockerName
	dw JugglerName
	dw $D04A
	dw $D04A
	dw BlackbeltName
	dw $D04A
	dw ProfOakName
	dw ChiefName
	dw ScientistName
	dw $D04A
	dw RocketName
	dw CooltrainerMName
	dw CooltrainerFName
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A
	dw $D04A

YoungsterName: ; 27ec2 (9:7ec2)
	db "YOUNGSTER@"
BugCatcherName: ; 27ecc (9:7ecc)
	db "BUG CATCHER@"
LassName: ; 27ed8 (9:7ed8)
	db "LASS@"
JrTrainerMName: ; 27edd (9:7edd)
	db "JR.TRAINER♂@"
JrTrainerFName: ; 27ee9 (9:7ee9)
	db "JR.TRAINER♀@"
PokemaniacName: ; 27ef5 (9:7ef5)
	db "POKéMANIAC@"
SuperNerdName: ; 27f00 (9:7f00)
	db "SUPER NERD@"
BurglarName: ; 27f0b (9:7f0b)
	db "BURGLAR@"
EngineerName: ; 27f13 (9:7f13)
	db "ENGINEER@"
JugglerXName: ; 27f1c (9:7f1c)
	db "JUGGLER@"
SwimmerName: ; 27f24 (9:7f24)
	db "SWIMMER@"
BeautyName: ; 27f2c (9:7f2c)
	db "BEAUTY@"
RockerName: ; 27f33 (9:7f33)
	db "ROCKER@"
JugglerName: ; 27f3a (9:7f3a)
	db "JUGGLER@"
BlackbeltName: ; 27f42 (9:7f42)
	db "BLACKBELT@"
ProfOakName: ; 27f4c (9:7f4c)
	db "PROF.OAK@"
ChiefName: ; 27f55 (9:7f55)
	db "CHIEF@"
ScientistName: ; 27f5b (9:7f5b)
	db "SCIENTIST@"
RocketName: ; 27f65 (9:7f65)
	db "ROCKET@"
CooltrainerMName: ; 27f6c (9:7f6c)
	db "COOLTRAINER♂@"
CooltrainerFName: ; 27f79 (9:7f79)
	db "COOLTRAINER♀@"

; known jump sources: 3f94e (f:794e)
Func_27f86: ; 27f86 (9:7f86)
	ld hl, W_PLAYERBATTSTATUS2 ; $d063
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_27f91
	ld hl, W_ENEMYBATTSTATUS2 ; $d068
.asm_27f91
	bit 2, [hl]
	jr nz, .asm_27fa5
	set 2, [hl]
	ld hl, Func_3fba8
	ld b, BANK(Func_3fba8)
	call Bankswitch ; indirect jump to Func_3fba8 (3fba8 (f:7ba8))
	ld hl, Unknown_27fb2 ; $7fb2
	jp PrintText
.asm_27fa5
	ld c, $32
	call DelayFrames
	ld hl, Func_3fb53
	ld b, BANK(Func_3fb53)
	jp Bankswitch ; indirect jump to Func_3fb53 (3fb53 (f:7b53))

Unknown_27fb2: ; 27fb2 (9:7fb2)
INCBIN "baserom.gbc",$27fb2,$27fb3 - $27fb2

UnnamedText_27fb3: ; 27fb3 (9:7fb3)
	TX_FAR _UnnamedText_27fb3
	db $50
; 0x27fb3 + 5 bytes

SECTION "bankA",ROMX,BANK[$A]
GrowlithePicFront: ; 28000 (a:4000)
	INCBIN "pic/bmon/growlithe.pic"
GrowlithePicBack: ; 28101 (a:4101)
	INCBIN "pic/monback/growlitheb.pic"
OnixPicFront: ; 28164 (a:4164)
	INCBIN "pic/bmon/onix.pic"
OnixPicBack: ; 28300 (a:4300)
	INCBIN "pic/monback/onixb.pic"
FearowPicFront: ; 28383 (a:4383)
	INCBIN "pic/bmon/fearow.pic"
FearowPicBack: ; 28529 (a:4529)
	INCBIN "pic/monback/fearowb.pic"
PidgeyPicFront: ; 285a7 (a:45a7)
	INCBIN "pic/bmon/pidgey.pic"
PidgeyPicBack: ; 2865b (a:465b)
	INCBIN "pic/monback/pidgeyb.pic"
SlowpokePicFront: ; 286a0 (a:46a0)
	INCBIN "pic/bmon/slowpoke.pic"
SlowpokePicBack: ; 287c2 (a:47c2)
	INCBIN "pic/monback/slowpokeb.pic"
KadabraPicFront: ; 28830 (a:4830)
	INCBIN "pic/bmon/kadabra.pic"
KadabraPicBack: ; 289b9 (a:49b9)
	INCBIN "pic/monback/kadabrab.pic"
GravelerPicFront: ; 28a4c (a:4a4c)
	INCBIN "pic/bmon/graveler.pic"
GravelerPicBack: ; 28c00 (a:4c00)
	INCBIN "pic/monback/gravelerb.pic"
ChanseyPicFront: ; 28cae (a:4cae)
	INCBIN "pic/bmon/chansey.pic"
ChanseyPicBack: ; 28e21 (a:4e21)
	INCBIN "pic/monback/chanseyb.pic"
MachokePicFront: ; 28e85 (a:4e85)
	INCBIN "pic/bmon/machoke.pic"
MachokePicBack: ; 29063 (a:5063)
	INCBIN "pic/monback/machokeb.pic"
MrMimePicFront: ; 290f3 (a:50f3)
	INCBIN "pic/bmon/mr.mime.pic"
MrMimePicBack: ; 29247 (a:5247)
	INCBIN "pic/monback/mr.mimeb.pic"
HitmonleePicFront: ; 292bf (a:52bf)
	INCBIN "pic/bmon/hitmonlee.pic"
HitmonleePicBack: ; 2945e (a:545e)
	INCBIN "pic/monback/hitmonleeb.pic"
HitmonchanPicFront: ; 294bc (a:54bc)
	INCBIN "pic/bmon/hitmonchan.pic"
HitmonchanPicBack: ; 29643 (a:5643)
	INCBIN "pic/monback/hitmonchanb.pic"
ArbokPicFront: ; 296b4 (a:56b4)
	INCBIN "pic/bmon/arbok.pic"
ArbokPicBack: ; 29911 (a:5911)
	INCBIN "pic/monback/arbokb.pic"
ParasectPicFront: ; 299a8 (a:59a8)
	INCBIN "pic/bmon/parasect.pic"
ParasectPicBack: ; 29b8c (a:5b8c)
	INCBIN "pic/monback/parasectb.pic"
PsyduckPicFront: ; 29c0a (a:5c0a)
	INCBIN "pic/bmon/psyduck.pic"
PsyduckPicBack: ; 29d3e (a:5d3e)
	INCBIN "pic/monback/psyduckb.pic"
DrowzeePicFront: ; 29da9 (a:5da9)
	INCBIN "pic/bmon/drowzee.pic"
DrowzeePicBack: ; 29f05 (a:5f05)
	INCBIN "pic/monback/drowzeeb.pic"
GolemPicFront: ; 29f74 (a:5f74)
	INCBIN "pic/bmon/golem.pic"
GolemPicBack: ; 2a0f2 (a:60f2)
	INCBIN "pic/monback/golemb.pic"
MagmarPicFront: ; 2a161 (a:6161)
	INCBIN "pic/bmon/magmar.pic"
MagmarPicBack: ; 2a2bf (a:62bf)
	INCBIN "pic/monback/magmarb.pic"
ElectabuzzPicFront: ; 2a367 (a:6367)
	INCBIN "pic/bmon/electabuzz.pic"
ElectabuzzPicBack: ; 2a4ef (a:64ef)
	INCBIN "pic/monback/electabuzzb.pic"
MagnetonPicFront: ; 2a588 (a:6588)
	INCBIN "pic/bmon/magneton.pic"
MagnetonPicBack: ; 2a723 (a:6723)
	INCBIN "pic/monback/magnetonb.pic"
KoffingPicFront: ; 2a7a6 (a:67a6)
	INCBIN "pic/bmon/koffing.pic"
KoffingPicBack: ; 2a974 (a:6974)
	INCBIN "pic/monback/koffingb.pic"
MankeyPicFront: ; 2aa11 (a:6a11)
	INCBIN "pic/bmon/mankey.pic"
MankeyPicBack: ; 2ab16 (a:6b16)
	INCBIN "pic/monback/mankeyb.pic"
SeelPicFront: ; 2ab84 (a:6b84)
	INCBIN "pic/bmon/seel.pic"
SeelPicBack: ; 2ace8 (a:6ce8)
	INCBIN "pic/monback/seelb.pic"
DiglettPicFront: ; 2ad33 (a:6d33)
	INCBIN "pic/bmon/diglett.pic"
DiglettPicBack: ; 2ae10 (a:6e10)
	INCBIN "pic/monback/diglettb.pic"
TaurosPicFront: ; 2ae7e (a:6e7e)
	INCBIN "pic/bmon/tauros.pic"
TaurosPicBack: ; 2b054 (a:7054)
	INCBIN "pic/monback/taurosb.pic"
FarfetchdPicFront: ; 2b0e9 (a:70e9)
	INCBIN "pic/bmon/farfetchd.pic"
FarfetchdPicBack: ; 2b2c6 (a:72c6)
	INCBIN "pic/monback/farfetchdb.pic"
VenonatPicFront: ; 2b357 (a:7357)
	INCBIN "pic/bmon/venonat.pic"
VenonatPicBack: ; 2b45c (a:745c)
	INCBIN "pic/monback/venonatb.pic"
DragonitePicFront: ; 2b4aa (a:74aa)
	INCBIN "pic/bmon/dragonite.pic"
DragonitePicBack: ; 2b67f (a:767f)
	INCBIN "pic/monback/dragoniteb.pic"
DoduoPicFront: ; 2b72c (a:772c)
	INCBIN "pic/bmon/doduo.pic"
DoduoPicBack: ; 2b80d (a:780d)
	INCBIN "pic/monback/doduob.pic"
PoliwagPicFront: ; 2b875 (a:7875)
	INCBIN "pic/bmon/poliwag.pic"
PoliwagPicBack: ; 2b947 (a:7947)
	INCBIN "pic/monback/poliwagb.pic"
JynxPicFront: ; 2b98e (a:798e)
	INCBIN "pic/bmon/jynx.pic"
JynxPicBack: ; 2bb42 (a:7b42)
	INCBIN "pic/monback/jynxb.pic"
MoltresPicFront: ; 2bbac (a:7bac)
	INCBIN "pic/bmon/moltres.pic"
MoltresPicBack: ; 2be02 (a:7e02)
	INCBIN "pic/monback/moltresb.pic"

; known jump sources: 3fa81 (f:7a81)
Func_2bea9: ; 2bea9 (a:7ea9)
	ld hl, MoveHitTest
	ld b, BANK(MoveHitTest)
	call Bankswitch ; indirect jump to MoveHitTest (3e56b (f:656b))
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	jr nz, .asm_2bee7
	ld hl, W_ENEMYBATTSTATUS2 ; $d068
	ld de, W_ENEMYMONTYPE1 ; $cfea (aliases: W_ENEMYMONTYPES)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_2bec8
	ld hl, W_PLAYERBATTSTATUS2 ; $d063
	ld de, W_PLAYERMONTYPE1 ; $d019 (aliases: W_PLAYERMONTYPES)
.asm_2bec8
	ld a, [de]
	cp $16
	jr z, .asm_2bee7
	inc de
	ld a, [de]
	cp $16
	jr z, .asm_2bee7
	bit 7, [hl]
	jr nz, .asm_2bee7
	set 7, [hl]
	ld hl, Func_3fba8
	ld b, BANK(Func_3fba8)
	call Bankswitch ; indirect jump to Func_3fba8 (3fba8 (f:7ba8))
	ld hl, UnnamedText_2bef2 ; $7ef2
	jp PrintText
.asm_2bee7
	ld c, $32
	call DelayFrames
	ld hl, UnnamedText_2bef7 ; $7ef7
	jp PrintText
; 2bef2 (a:7ef2)
UnnamedText_2bef2: ; 2bef2 (a:7ef2)
	TX_FAR _UnnamedText_2bef2
	db $50
; 0x2bef2 + 5 bytes

UnnamedText_2bef7: ; 2bef7 (a:7ef7)
	TX_FAR _UnnamedText_2bef7
	db $50
; 0x2bef7 + 5 bytes

SECTION "bankB",ROMX,BANK[$B]
ArticunoPicFront: ; 2c000 (b:4000)
	INCBIN "pic/bmon/articuno.pic"
ArticunoPicBack: ; 2c238 (b:4238)
	INCBIN "pic/monback/articunob.pic"
ZapdosPicFront: ; 2c29d (b:429d)
	INCBIN "pic/bmon/zapdos.pic"
ZapdosPicBack: ; 2c484 (b:4484)
	INCBIN "pic/monback/zapdosb.pic"
DittoPicFront: ; 2c514 (b:4514)
	INCBIN "pic/bmon/ditto.pic"
DittoPicBack: ; 2c5bd (b:45bd)
	INCBIN "pic/monback/dittob.pic"
MeowthPicFront: ; 2c609 (b:4609)
	INCBIN "pic/bmon/meowth.pic"
MeowthPicBack: ; 2c71f (b:471f)
	INCBIN "pic/monback/meowthb.pic"
KrabbyPicFront: ; 2c777 (b:4777)
	INCBIN "pic/bmon/krabby.pic"
KrabbyPicBack: ; 2c8b0 (b:48b0)
	INCBIN "pic/monback/krabbyb.pic"
VulpixPicFront: ; 2c924 (b:4924)
	INCBIN "pic/bmon/vulpix.pic"
VulpixPicBack: ; 2ca9a (b:4a9a)
	INCBIN "pic/monback/vulpixb.pic"
NinetalesPicFront: ; 2caff (b:4aff)
	INCBIN "pic/bmon/ninetales.pic"
NinetalesPicBack: ; 2ccfb (b:4cfb)
	INCBIN "pic/monback/ninetalesb.pic"
PikachuPicFront: ; 2cd7d (b:4d7d)
	INCBIN "pic/bmon/pikachu.pic"
PikachuPicBack: ; 2ce8b (b:4e8b)
	INCBIN "pic/monback/pikachub.pic"
RaichuPicFront: ; 2cf03 (b:4f03)
	INCBIN "pic/bmon/raichu.pic"
RaichuPicBack: ; 2d0c3 (b:50c3)
	INCBIN "pic/monback/raichub.pic"
DratiniPicFront: ; 2d151 (b:5151)
	INCBIN "pic/bmon/dratini.pic"
DratiniPicBack: ; 2d234 (b:5234)
	INCBIN "pic/monback/dratinib.pic"
DragonairPicFront: ; 2d297 (b:5297)
	INCBIN "pic/bmon/dragonair.pic"
DragonairPicBack: ; 2d3d9 (b:53d9)
	INCBIN "pic/monback/dragonairb.pic"
KabutoPicFront: ; 2d464 (b:5464)
	INCBIN "pic/bmon/kabuto.pic"
KabutoPicBack: ; 2d529 (b:5529)
	INCBIN "pic/monback/kabutob.pic"
KabutopsPicFront: ; 2d583 (b:5583)
	INCBIN "pic/bmon/kabutops.pic"
KabutopsPicBack: ; 2d73c (b:573c)
	INCBIN "pic/monback/kabutopsb.pic"
HorseaPicFront: ; 2d7c1 (b:57c1)
	INCBIN "pic/bmon/horsea.pic"
HorseaPicBack: ; 2d873 (b:5873)
	INCBIN "pic/monback/horseab.pic"
SeadraPicFront: ; 2d8c4 (b:58c4)
	INCBIN "pic/bmon/seadra.pic"
SeadraPicBack: ; 2da2b (b:5a2b)
	INCBIN "pic/monback/seadrab.pic"
SandshrewPicFront: ; 2dac9 (b:5ac9)
	INCBIN "pic/bmon/sandshrew.pic"
SandshrewPicBack: ; 2dbe7 (b:5be7)
	INCBIN "pic/monback/sandshrewb.pic"
SandslashPicFront: ; 2dc6b (b:5c6b)
	INCBIN "pic/bmon/sandslash.pic"
SandslashPicBack: ; 2de04 (b:5e04)
	INCBIN "pic/monback/sandslashb.pic"
OmanytePicFront: ; 2de9d (b:5e9d)
	INCBIN "pic/bmon/omanyte.pic"
OmanytePicBack: ; 2df76 (b:5f76)
	INCBIN "pic/monback/omanyteb.pic"
OmastarPicFront: ; 2dfd3 (b:5fd3)
	INCBIN "pic/bmon/omastar.pic"
OmastarPicBack: ; 2e18b (b:618b)
	INCBIN "pic/monback/omastarb.pic"
JigglypuffPicFront: ; 2e22f (b:622f)
	INCBIN "pic/bmon/jigglypuff.pic"
JigglypuffPicBack: ; 2e30f (b:630f)
	INCBIN "pic/monback/jigglypuffb.pic"
WigglytuffPicFront: ; 2e348 (b:6348)
	INCBIN "pic/bmon/wigglytuff.pic"
WigglytuffPicBack: ; 2e4bf (b:64bf)
	INCBIN "pic/monback/wigglytuffb.pic"
EeveePicFront: ; 2e531 (b:6531)
	INCBIN "pic/bmon/eevee.pic"
EeveePicBack: ; 2e625 (b:6625)
	INCBIN "pic/monback/eeveeb.pic"
FlareonPicFront: ; 2e68d (b:668d)
	INCBIN "pic/bmon/flareon.pic"
FlareonPicBack: ; 2e806 (b:6806)
	INCBIN "pic/monback/flareonb.pic"
JolteonPicFront: ; 2e88f (b:688f)
	INCBIN "pic/bmon/jolteon.pic"
JolteonPicBack: ; 2ea0a (b:6a0a)
	INCBIN "pic/monback/jolteonb.pic"
VaporeonPicFront: ; 2eaae (b:6aae)
	INCBIN "pic/bmon/vaporeon.pic"
VaporeonPicBack: ; 2ec02 (b:6c02)
	INCBIN "pic/monback/vaporeonb.pic"
MachopPicFront: ; 2ec9f (b:6c9f)
	INCBIN "pic/bmon/machop.pic"
MachopPicBack: ; 2eda2 (b:6da2)
	INCBIN "pic/monback/machopb.pic"
ZubatPicFront: ; 2ee0c (b:6e0c)
	INCBIN "pic/bmon/zubat.pic"
ZubatPicBack: ; 2ef17 (b:6f17)
	INCBIN "pic/monback/zubatb.pic"
EkansPicFront: ; 2ef6b (b:6f6b)
	INCBIN "pic/bmon/ekans.pic"
EkansPicBack: ; 2f06d (b:706d)
	INCBIN "pic/monback/ekansb.pic"
ParasPicFront: ; 2f0b4 (b:70b4)
	INCBIN "pic/bmon/paras.pic"
ParasPicBack: ; 2f177 (b:7177)
	INCBIN "pic/monback/parasb.pic"
PoliwhirlPicFront: ; 2f1ed (b:71ed)
	INCBIN "pic/bmon/poliwhirl.pic"
PoliwhirlPicBack: ; 2f35e (b:735e)
	INCBIN "pic/monback/poliwhirlb.pic"
PoliwrathPicFront: ; 2f3c1 (b:73c1)
	INCBIN "pic/bmon/poliwrath.pic"
PoliwrathPicBack: ; 2f52c (b:752c)
	INCBIN "pic/monback/poliwrathb.pic"
WeedlePicFront: ; 2f57d (b:757d)
	INCBIN "pic/bmon/weedle.pic"
WeedlePicBack: ; 2f624 (b:7624)
	INCBIN "pic/monback/weedleb.pic"
KakunaPicFront: ; 2f677 (b:7677)
	INCBIN "pic/bmon/kakuna.pic"
KakunaPicBack: ; 2f736 (b:7736)
	INCBIN "pic/monback/kakunab.pic"
BeedrillPicFront: ; 2f788 (b:7788)
	INCBIN "pic/bmon/beedrill.pic"
BeedrillPicBack: ; 2f980 (b:7980)
	INCBIN "pic/monback/beedrillb.pic"
FossilKabutopsPic: ; 2f9e8 (b:79e8)
	INCBIN "pic/bmon/fossilkabutops.pic"

DisplayEffectiveness: ; 2fb7b (b:7b7b)
	ld a, [$D05B]
	and a, $7F
	cp a, $0A
	ret z
	ld hl, UnnamedText_2fb8e	; It's super effective!
	jr nc, .done
	ld hl, UnnamedText_2fb93	; It's not very effective...
.done
	jp PrintText

UnnamedText_2fb8e: ; 2fb8e (b:7b8e)
	TX_FAR _UnnamedText_2fb8e
	db $50
; 0x2fb8e + 5 bytes

UnnamedText_2fb93: ; 2fb93 (b:7b93)
	TX_FAR _UnnamedText_2fb93
	db $50
; 0x2fb93 + 5 bytes

TrainerInfoTextBoxTileGraphics: ; 2fb98 (b:7b98)
INCBIN "gfx/trainer_info.2bpp"

; mostly empty, last tile contains circle
BlankLeaderNames: ; 2fc28 (b:7c28)
INCBIN "gfx/blank_leader_names.2bpp"

BadgeNumbersTileGraphics: ; 2fd98 (b:7d98)
INCBIN "gfx/badge_numbers.2bpp"

; known jump sources: e530 (3:6530)
Func_2fe18: ; 2fe18 (b:7e18)
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, W_PARTYMON1_MOVE1 ; $d173
	ld bc, $2c
	call AddNTimes
	ld a, [$d0e0]
	ld b, a
	ld c, $4
.asm_2fe2a
	ld a, [hli]
	cp b
	jr z, .asm_2fe33
	dec c
	jr nz, .asm_2fe2a
	and a
	ret
.asm_2fe33
	ld hl, UnnamedText_2fe3b ; $7e3b
	call PrintText
	scf
	ret
; 2fe3b (b:7e3b)
UnnamedText_2fe3b: ; 2fe3b (b:7e3b)
	TX_FAR _UnnamedText_2fe3b
	db $50
; 0x2fe3b + 5 bytes

; known jump sources: 3eca5 (f:6ca5), 3f11b (f:711b), 70362 (1c:4362)
; scales both uncompressed sprite chunks by two in every dimension (creating 2x2 output pixels per input pixel)
; assumes that input sprite chunks are 4x4 tiles, and the rightmost and bottommost 4 pixels will be ignored
; resulting in a 7*7 tile output sprite chunk
ScaleSpriteByTwo: ; 2fe40 (b:7e40)
	ld de, S_SPRITEBUFFER1 + (4*4*8) - 5          ; last byte of input data, last 4 rows already skipped
	ld hl, S_SPRITEBUFFER0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
	call ScaleLastSpriteColumnByTwo               ; last tile column is special case
	call ScaleFirstThreeSpriteColumnsByTwo        ; scale first 3 tile columns
	ld de, S_SPRITEBUFFER2 + (4*4*8) - 5          ; last byte of input data, last 4 rows already skipped
	ld hl, S_SPRITEBUFFER1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
	call ScaleLastSpriteColumnByTwo               ; last tile column is special case

; known jump sources: 2fe49 (b:7e49)
ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55)
	ld b, $3 ; 3 tile columns
.columnLoop
	ld c, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows
.columnInnerLoop
	push bc
	ld a, [de]
	ld bc, -(7*8)+1       ; $ffc9, scale lower nybble and seek to previous output column
	call ScalePixelsByTwo
	ld a, [de]
	dec de
	swap a
	ld bc, 7*8+1-2        ; $37, scale upper nybble and seek back to current output column and to the next 2 rows
	call ScalePixelsByTwo
	pop bc
	dec c
	jr nz, .columnInnerLoop
	dec de
	dec de
	dec de
	dec de
	ld a, b
	ld bc, -7*8 ; $ffc8, skip one output column (which has already been written along with the current one)
	add hl, bc
	ld b, a
	dec b
	jr nz, .columnLoop
	ret

; known jump sources: 2fe46 (b:7e46), 2fe52 (b:7e52)
ScaleLastSpriteColumnByTwo: ; 2fe7d (b:7e7d)
	ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows
	ld [H_SPRITEINTERLACECOUNTER], a ; $FF00+$8b
	ld bc, -1 ; $ffff
.columnInnerLoop
	ld a, [de]
	dec de
	swap a                    ; only high nybble contains information
	call ScalePixelsByTwo
	ld a, [H_SPRITEINTERLACECOUNTER] ; $FF00+$8b
	dec a
	ld [H_SPRITEINTERLACECOUNTER], a ; $FF00+$8b
	jr nz, .columnInnerLoop
	dec de                    ; skip last 4 rows of new column
	dec de
	dec de
	dec de
	ret

; known jump sources: 2fe5e (b:7e5e), 2fe68 (b:7e68), 2fe88 (b:7e88)
; scales the given 4 bits in a (4x1 pixels) to 2 output bytes (8x2 pixels)
; hl: destination pointer
; bc: destination pointer offset (added after the two bytes have been written)
ScalePixelsByTwo: ; 2fe97 (b:7e97)
	push hl
	and $f
	ld hl, DuplicateBitsTable
	add l
	ld l, a
	jr nc, .noCarry
	inc h
.noCarry
	ld a, [hl]
	pop hl
	ld [hld], a  ; write output byte twice to make it 2 pixels high
	ld [hl], a
	add hl, bc   ; add offset
	ret

; repeats each input bit twice
DuplicateBitsTable: ; 2fea8 (b:7ea8)
db $00, $03, $0c, $0f
db $30, $33, $3c, $3f
db $c0, $c3, $cc, $cf
db $f0, $f3, $fc, $ff

; no known jump sources
Func_2feb8 ; 0x2feb8
	xor a
	ld hl, $cd6d
	ld [hli], a
	ld a, [$ff00+$f3]
	and a
	ld a, [$d022]
	jr z, .asm_2fec8 ; 0x2fec3 $3
	ld a, [$cff3]
.asm_2fec8
	add a
	ld [$ff00+$98], a
	xor a
	ld [$ff00+$95], a
	ld [$ff00+$96], a
	ld [$ff00+$97], a
	ld a, $64
	ld [$ff00+$99], a
	ld b, $4
	call Divide
	ld a, [$ff00+$98]
	ld [hli], a
	ld a, [$ff00+$99]
	ld [$ff00+$98], a
	ld a, $a
	ld [$ff00+$99], a
	ld b, $4
	call Divide
	ld a, [$ff00+$98]
	swap a
	ld b, a
	ld a, [$ff00+$99]
	add b
	ld [hl], a
	ld de, $cce7
	ld c, $3
	ld a, $b
	call Predef
	ld hl, UnnamedText_2ff04 ; $7f04
	jp PrintText
; 0x2ff04

UnnamedText_2ff04: ; 2ff04 (b:7f04)
	TX_FAR _UnnamedText_2ff04
	db $50
; 0x2ff04 + 5 bytes

INCBIN "baserom.gbc",$2ff09,$2ff32 - $2ff09

UnnamedText_2ff32: ; 2ff32 (b:7f32)
	TX_FAR _UnnamedText_2ff32
	db $50
; 0x2ff32 + 5 bytes

UnnamedText_2ff37: ; 2ff37 (b:7f37)
	TX_FAR _UnnamedText_2ff37
	db $50
; 0x2ff37 + 5 bytes

SECTION "bankC",ROMX,BANK[$C]
DodrioPicFront: ; 30000 (c:4000)
	INCBIN "pic/bmon/dodrio.pic"
DodrioPicBack: ; 301a2 (c:41a2)
	INCBIN "pic/monback/dodriob.pic"
PrimeapePicFront: ; 30247 (c:4247)
	INCBIN "pic/bmon/primeape.pic"
PrimeapePicBack: ; 30408 (c:4408)
	INCBIN "pic/monback/primeapeb.pic"
DugtrioPicFront: ; 30480 (c:4480)
	INCBIN "pic/bmon/dugtrio.pic"
DugtrioPicBack: ; 3062a (c:462a)
	INCBIN "pic/monback/dugtriob.pic"
VenomothPicFront: ; 306a9 (c:46a9)
	INCBIN "pic/bmon/venomoth.pic"
VenomothPicBack: ; 30841 (c:4841)
	INCBIN "pic/monback/venomothb.pic"
DewgongPicFront: ; 30899 (c:4899)
	INCBIN "pic/bmon/dewgong.pic"
DewgongPicBack: ; 309e2 (c:49e2)
	INCBIN "pic/monback/dewgongb.pic"
CaterpiePicFront: ; 30a49 (c:4a49)
	INCBIN "pic/bmon/caterpie.pic"
CaterpiePicBack: ; 30ae1 (c:4ae1)
	INCBIN "pic/monback/caterpieb.pic"
MetapodPicFront: ; 30b3a (c:4b3a)
	INCBIN "pic/bmon/metapod.pic"
MetapodPicBack: ; 30bc8 (c:4bc8)
	INCBIN "pic/monback/metapodb.pic"
ButterfreePicFront: ; 30c37 (c:4c37)
	INCBIN "pic/bmon/butterfree.pic"
ButterfreePicBack: ; 30e0e (c:4e0e)
	INCBIN "pic/monback/butterfreeb.pic"
MachampPicFront: ; 30e93 (c:4e93)
	INCBIN "pic/bmon/machamp.pic"
MachampPicBack: ; 3108c (c:508c)
	INCBIN "pic/monback/machampb.pic"
GolduckPicFront: ; 31108 (c:5108)
	INCBIN "pic/bmon/golduck.pic"
GolduckPicBack: ; 312c2 (c:52c2)
	INCBIN "pic/monback/golduckb.pic"
HypnoPicFront: ; 3135d (c:535d)
	INCBIN "pic/bmon/hypno.pic"
HypnoPicBack: ; 31552 (c:5552)
	INCBIN "pic/monback/hypnob.pic"
GolbatPicFront: ; 315e0 (c:55e0)
	INCBIN "pic/bmon/golbat.pic"
GolbatPicBack: ; 3180a (c:580a)
	INCBIN "pic/monback/golbatb.pic"
MewtwoPicFront: ; 3187f (c:587f)
	INCBIN "pic/bmon/mewtwo.pic"
MewtwoPicBack: ; 31a85 (c:5a85)
	INCBIN "pic/monback/mewtwob.pic"
SnorlaxPicFront: ; 31b19 (c:5b19)
	INCBIN "pic/bmon/snorlax.pic"
SnorlaxPicBack: ; 31ce5 (c:5ce5)
	INCBIN "pic/monback/snorlaxb.pic"
MagikarpPicFront: ; 31d31 (c:5d31)
	INCBIN "pic/bmon/magikarp.pic"
MagikarpPicBack: ; 31ec3 (c:5ec3)
	INCBIN "pic/monback/magikarpb.pic"
MukPicFront: ; 31f56 (c:5f56)
	INCBIN "pic/bmon/muk.pic"
MukPicBack: ; 3215f (c:615f)
	INCBIN "pic/monback/mukb.pic"
KinglerPicFront: ; 321ec (c:61ec)
	INCBIN "pic/bmon/kingler.pic"
KinglerPicBack: ; 323de (c:63de)
	INCBIN "pic/monback/kinglerb.pic"
CloysterPicFront: ; 3247f (c:647f)
	INCBIN "pic/bmon/cloyster.pic"
CloysterPicBack: ; 326ab (c:66ab)
	INCBIN "pic/monback/cloysterb.pic"
ElectrodePicFront: ; 32760 (c:6760)
	INCBIN "pic/bmon/electrode.pic"
ElectrodePicBack: ; 32827 (c:6827)
	INCBIN "pic/monback/electrodeb.pic"
ClefablePicFront: ; 3288c (c:688c)
	INCBIN "pic/bmon/clefable.pic"
ClefablePicBack: ; 329b8 (c:69b8)
	INCBIN "pic/monback/clefableb.pic"
WeezingPicFront: ; 32a44 (c:6a44)
	INCBIN "pic/bmon/weezing.pic"
WeezingPicBack: ; 32c76 (c:6c76)
	INCBIN "pic/monback/weezingb.pic"
PersianPicFront: ; 32d1e (c:6d1e)
	INCBIN "pic/bmon/persian.pic"
PersianPicBack: ; 32f04 (c:6f04)
	INCBIN "pic/monback/persianb.pic"
MarowakPicFront: ; 32f8f (c:6f8f)
	INCBIN "pic/bmon/marowak.pic"
MarowakPicBack: ; 33101 (c:7101)
	INCBIN "pic/monback/marowakb.pic"
HaunterPicFront: ; 3318a (c:718a)
	INCBIN "pic/bmon/haunter.pic"
HaunterPicBack: ; 33345 (c:7345)
	INCBIN "pic/monback/haunterb.pic"
AbraPicFront: ; 333cc (c:73cc)
	INCBIN "pic/bmon/abra.pic"
AbraPicBack: ; 334cf (c:74cf)
	INCBIN "pic/monback/abrab.pic"
AlakazamPicFront: ; 3355a (c:755a)
	INCBIN "pic/bmon/alakazam.pic"
AlakazamPicBack: ; 33779 (c:7779)
	INCBIN "pic/monback/alakazamb.pic"
PidgeottoPicFront: ; 3380a (c:780a)
	INCBIN "pic/bmon/pidgeotto.pic"
PidgeottoPicBack: ; 3395b (c:795b)
	INCBIN "pic/monback/pidgeottob.pic"
PidgeotPicFront: ; 339c2 (c:79c2)
	INCBIN "pic/bmon/pidgeot.pic"
PidgeotPicBack: ; 33b79 (c:7b79)
	INCBIN "pic/monback/pidgeotb.pic"
StarmiePicFront: ; 33c1c (c:7c1c)
	INCBIN "pic/bmon/starmie.pic"
StarmiePicBack: ; 33dac (c:7dac)
	INCBIN "pic/monback/starmieb.pic"
RedPicBack: ; 33e0a (c:7e0a)
	INCBIN "pic/trainer/redb.pic"
OldManPic: ; 33e9a (c:7e9a)
	INCBIN "pic/trainer/oldman.pic"

INCBIN "baserom.gbc",$33f2b,$33f52 - $33f2b

UnnamedText_33f52: ; 33f52 (c:7f52)
	TX_FAR _UnnamedText_33f52
	db $50
; 0x33f52 + 5 bytes

; known jump sources: 3f889 (f:7889)
Func_33f57: ; 33f57 (c:7f57)
	ld hl, W_DAMAGE ; $d0d7
	xor a
	ld [hli], a
	ld [hl], a
	dec a
	ld [$d05e], a
	ld hl, $d02a
	ld de, $cffb
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_33f72
	ld hl, $cffb
	ld de, $d02a
.asm_33f72
	ld a, [de]
	dec de
	ld b, a
	ld a, [hld]
	sub b
	ld a, [de]
	ld b, a
	ld a, [hl]
	sbc b
	jr c, .asm_33f8a
	ld hl, W_DAMAGE ; $d0d7
	ld a, $ff
	ld [hli], a
	ld [hl], a
	ld a, $2
	ld [$d05e], a
	ret
.asm_33f8a
	ld a, $1
	ld [W_MOVEMISSED], a ; $d05f
	ret
; 33f90 (c:7f90)
SECTION "bankD",ROMX,BANK[$D]
BulbasaurPicFront: ; 34000 (d:4000)
	INCBIN "pic/bmon/bulbasaur.pic"
BulbasaurPicBack: ; 340e5 (d:40e5)
	INCBIN "pic/monback/bulbasaurb.pic"
VenusaurPicFront: ; 34162 (d:4162)
	INCBIN "pic/bmon/venusaur.pic"
VenusaurPicBack: ; 34397 (d:4397)
	INCBIN "pic/monback/venusaurb.pic"
TentacruelPicFront: ; 34455 (d:4455)
	INCBIN "pic/bmon/tentacruel.pic"
TentacruelPicBack: ; 345c3 (d:45c3)
	INCBIN "pic/monback/tentacruelb.pic"
GoldeenPicFront: ; 3466f (d:466f)
	INCBIN "pic/bmon/goldeen.pic"
GoldeenPicBack: ; 34796 (d:4796)
	INCBIN "pic/monback/goldeenb.pic"
SeakingPicFront: ; 34803 (d:4803)
	INCBIN "pic/bmon/seaking.pic"
SeakingPicBack: ; 34a03 (d:4a03)
	INCBIN "pic/monback/seakingb.pic"
PonytaPicFront: ; 34ab1 (d:4ab1)
	INCBIN "pic/bmon/ponyta.pic"
RapidashPicFront: ; 34c10 (d:4c10)
	INCBIN "pic/bmon/rapidash.pic"
PonytaPicBack: ; 34e32 (d:4e32)
	INCBIN "pic/monback/ponytab.pic"
RapidashPicBack: ; 34eba (d:4eba)
	INCBIN "pic/monback/rapidashb.pic"
RattataPicFront: ; 34f6a (d:4f6a)
	INCBIN "pic/bmon/rattata.pic"
RattataPicBack: ; 35041 (d:5041)
	INCBIN "pic/monback/rattatab.pic"
RaticatePicFront: ; 3507a (d:507a)
	INCBIN "pic/bmon/raticate.pic"
RaticatePicBack: ; 3520d (d:520d)
	INCBIN "pic/monback/raticateb.pic"
NidorinoPicFront: ; 35282 (d:5282)
	INCBIN "pic/bmon/nidorino.pic"
NidorinoPicBack: ; 353f0 (d:53f0)
	INCBIN "pic/monback/nidorinob.pic"
NidorinaPicFront: ; 3548b (d:548b)
	INCBIN "pic/bmon/nidorina.pic"
NidorinaPicBack: ; 355c8 (d:55c8)
	INCBIN "pic/monback/nidorinab.pic"
GeodudePicFront: ; 3564f (d:564f)
	INCBIN "pic/bmon/geodude.pic"
GeodudePicBack: ; 35729 (d:5729)
	INCBIN "pic/monback/geodudeb.pic"
PorygonPicFront: ; 35784 (d:5784)
	INCBIN "pic/bmon/porygon.pic"
PorygonPicBack: ; 358d1 (d:58d1)
	INCBIN "pic/monback/porygonb.pic"
AerodactylPicFront: ; 35931 (d:5931)
	INCBIN "pic/bmon/aerodactyl.pic"
AerodactylPicBack: ; 35aec (d:5aec)
	INCBIN "pic/monback/aerodactylb.pic"
MagnemitePicFront: ; 35b87 (d:5b87)
	INCBIN "pic/bmon/magnemite.pic"
MagnemitePicBack: ; 35c0d (d:5c0d)
	INCBIN "pic/monback/magnemiteb.pic"
CharmanderPicFront: ; 35c5c (d:5c5c)
	INCBIN "pic/bmon/charmander.pic"
CharmanderPicBack: ; 35d5c (d:5d5c)
	INCBIN "pic/monback/charmanderb.pic"
SquirtlePicFront: ; 35db8 (d:5db8)
	INCBIN "pic/bmon/squirtle.pic"
SquirtlePicBack: ; 35e8f (d:5e8f)
	INCBIN "pic/monback/squirtleb.pic"
CharmeleonPicFront: ; 35f0c (d:5f0c)
	INCBIN "pic/bmon/charmeleon.pic"
CharmeleonPicBack: ; 36048 (d:6048)
	INCBIN "pic/monback/charmeleonb.pic"
WartortlePicFront: ; 360b1 (d:60b1)
	INCBIN "pic/bmon/wartortle.pic"
WartortlePicBack: ; 361f1 (d:61f1)
	INCBIN "pic/monback/wartortleb.pic"
CharizardPicFront: ; 36286 (d:6286)
	INCBIN "pic/bmon/charizard.pic"
CharizardPicBack: ; 36495 (d:6495)
	INCBIN "pic/monback/charizardb.pic"
FossilAerodactylPic: ; 36536 (d:6536)
	INCBIN "pic/bmon/fossilaerodactyl.pic"
GhostPic: ; 366b5 (d:66b5)
	INCBIN "pic/other/ghost.pic"
OddishPicFront: ; 3680b (d:680b)
	INCBIN "pic/bmon/oddish.pic"
OddishPicBack: ; 368a9 (d:68a9)
	INCBIN "pic/monback/oddishb.pic"
GloomPicFront: ; 36941 (d:6941)
	INCBIN "pic/bmon/gloom.pic"
GloomPicBack: ; 36a78 (d:6a78)
	INCBIN "pic/monback/gloomb.pic"
VileplumePicFront: ; 36b21 (d:6b21)
	INCBIN "pic/bmon/vileplume.pic"
VileplumePicBack: ; 36c82 (d:6c82)
	INCBIN "pic/monback/vileplumeb.pic"
BellsproutPicFront: ; 36d00 (d:6d00)
	INCBIN "pic/bmon/bellsprout.pic"
BellsproutPicBack: ; 36dba (d:6dba)
	INCBIN "pic/monback/bellsproutb.pic"
WeepinbellPicFront: ; 36e30 (d:6e30)
	INCBIN "pic/bmon/weepinbell.pic"
WeepinbellPicBack: ; 36f6f (d:6f6f)
	INCBIN "pic/monback/weepinbellb.pic"
VictreebelPicFront: ; 36fea (d:6fea)
	INCBIN "pic/bmon/victreebel.pic"
VictreebelPicBack: ; 371b2 (d:71b2)
	INCBIN "pic/monback/victreebelb.pic"

Unknown_37244: ; 37244 (d:7244)
INCBIN "baserom.gbc",$37244,$37247 - $37244

Unknown_37247: ; 37247 (d:7247)
INCBIN "baserom.gbc",$37247,$3724f - $37247

Unknown_3724f: ; 3724f (d:724f)
INCBIN "baserom.gbc",$3724f,$37258 - $3724f

; known jump sources: 44bd (1:44bd), 44c8 (1:44c8)
LoadScreenTilesFromBuffer18: ; 37258 (d:7258)
	ld a, d
	ld bc, Unknown_37247 ; $7247
	ld d, $88
	ld e, $0
	and a
	jr nz, Func_3726a
	ld bc, Unknown_3724f ; $724f
	ld d, $0
	ld e, $0

; known jump sources: 37261 (d:7261), 37290 (d:7290), 372c1 (d:72c1)
Func_3726a: ; 3726a (d:726a)
	ld a, [bc]
	and a
	ret z
	inc bc
	push bc
	ld b, a
	and $f
	ld c, a
	ld a, b
	and $f0
	swap a
	ld b, a
.asm_37279
	ld h, d
	ld l, $48
	call Func_37292
	ld h, $0
	ld l, $88
	call Func_37292
	ld a, d
	add b
	ld d, a
	call Func_372c4
	dec c
	jr nz, .asm_37279
	pop bc
	jr Func_3726a

; known jump sources: 3727c (d:727c), 37283 (d:7283), 37295 (d:7295)
Func_37292: ; 37292 (d:7292)
	ld a, [$FF00+$44]
	cp l
	jr nz, Func_37292
	ld a, h
	ld [rSCX], a ; $FF00+$43
.asm_3729a
	ld a, [$FF00+$44]
	cp h
	jr z, .asm_3729a
	ret

Unknown_372a0: ; 372a0 (d:72a0)
INCBIN "baserom.gbc",$372a0,$372ac - $372a0

; known jump sources: 4451 (1:4451)
Func_372ac: ; 372ac (d:72ac)
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $b0
	jr z, .asm_372ba
	cp $b1
	jr z, .asm_372ba
	cp $99
	ret nz
.asm_372ba
	ld e, $1
	ld bc, Unknown_37244 ; $7244
	ld d, $0
	jp Func_3726a

; known jump sources: 37289 (d:7289)
Func_372c4: ; 372c4 (d:72c4)
	push de
	push hl
	xor a
	ld d, a
	ld hl, Unknown_372a0 ; $72a0
	add hl, de
	ld a, [hl]
	pop hl
	pop de
	and a
	ret z
	ld [$c328], a
	inc e
	ret

; known jump sources: 137c9 (4:77c9), 3ec42 (f:6c42)
Func_372d6: ; 372d6 (d:72d6)
	call LoadTextBoxTilePatterns
	FuncCoord 3, 4 ; $c3f3
	ld hl, Coord
	ld b, $7
	ld c, $c
	call TextBoxBorder
	FuncCoord 4, 5 ; $c408
	ld hl, Coord
	ld de, W_PLAYERNAME ; $d158
	call PlaceString
	FuncCoord 4, 10 ; $c46c
	ld hl, Coord
	ld de, W_GRASSRATE ; $d887
	call PlaceString
	FuncCoord 9, 8 ; $c449
	ld hl, Coord
	ld a, $69
	ld [hli], a
	ld [hl], $6a
	xor a
	ld [$cfcb], a
	ld hl, Func_3a948
	ld b, BANK(Func_3a948)
	call Bankswitch ; indirect jump to Func_3a948 (3a948 (e:6948))
	ld c, $96
	jp DelayFrames

INCBIN "baserom.gbc",$3730e,$37390 - $3730e

UnnamedText_37390: ; 37390 (d:7390)
	TX_FAR _UnnamedText_37390
	db $50
; 0x37390 + 5 bytes

INCBIN "baserom.gbc",$37395,$37467 - $37395

UnnamedText_37467: ; 37467 (d:7467)
	TX_FAR _UnnamedText_37467
	db $50
; 0x37467 + 5 bytes

UnnamedText_3746c: ; 3746c (d:746c)
	TX_FAR _UnnamedText_3746c
	db $50
; 0x3746c + 5 bytes

UnnamedText_37471: ; 37471 (d:7471)
	TX_FAR _UnnamedText_37471
	db $50
; 0x37471 + 5 bytes

UnnamedText_37476: ; 37476 (d:7476)
	TX_FAR _UnnamedText_37476
	db $50
; 0x37476 + 5 bytes

UnnamedText_3747b: ; 3747b (d:747b)
	TX_FAR _UnnamedText_3747b
	db $50
; 0x3747b + 5 bytes

INCBIN "baserom.gbc",$37480,$37673 - $37480

UnnamedText_37673: ; 37673 (d:7673)
	TX_FAR _UnnamedText_37673
	db $50
; 0x37673 + 5 bytes

INCBIN "baserom.gbc",$37678,$3769d - $37678

UnnamedText_3769d: ; 3769d (d:769d)
	TX_FAR _UnnamedText_3769d
	db $50
; 0x3769d + 5 bytes

INCBIN "baserom.gbc",$376a2,$378f5 - $376a2

SlotMachineMap: ; 378f5 (d:78f5)
INCBIN "gfx/tilemaps/slotmachine.map"

INCBIN "baserom.gbc",$379e5,$37af1 - $379e5

; 0x37af1
IF _RED
	INCBIN "gfx/red/slotmachine1.2bpp"
ENDC
IF _BLUE
	INCBIN "gfx/blue/slotmachine1.2bpp"
ENDC

INCBIN "baserom.gbc",$37ca1,$37d41 - $37ca1

; known jump sources: 38b3 (0:38b3)
_Multiply: ; 37d41 (d:7d41)
	ld a, $8
	ld b, a
	xor a
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ld [$FF00+$9b], a
	ld [H_SAVEDNUMTOPRINT], a ; $FF00+$9c
	ld [$FF00+$9d], a
	ld [$FF00+$9e], a
.asm_37d4f
	ld a, [H_REMAINDER] ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	srl a
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	jr nc, .asm_37d77
	ld a, [$FF00+$9e]
	ld c, a
	ld a, [$FF00+$98]
	add c
	ld [$FF00+$9e], a
	ld a, [$FF00+$9d]
	ld c, a
	ld a, [$FF00+$97]
	adc c
	ld [$FF00+$9d], a
	ld a, [H_SAVEDNUMTOPRINT] ; $FF00+$9c
	ld c, a
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	adc c
	ld [H_SAVEDNUMTOPRINT], a ; $FF00+$9c
	ld a, [$FF00+$9b]
	ld c, a
	ld a, [H_DIVIDEND] ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	adc c
	ld [$FF00+$9b], a
.asm_37d77
	dec b
	jr z, .asm_37d94
	ld a, [$FF00+$98]
	sla a
	ld [$FF00+$98], a
	ld a, [$FF00+$97]
	rl a
	ld [$FF00+$97], a
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	rl a
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [H_DIVIDEND] ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	rl a
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	jr .asm_37d4f
.asm_37d94
	ld a, [$FF00+$9e]
	ld [$FF00+$98], a
	ld a, [$FF00+$9d]
	ld [$FF00+$97], a
	ld a, [H_SAVEDNUMTOPRINT] ; $FF00+$9c
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [$FF00+$9b]
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ret

; known jump sources: 38c6 (0:38c6)
_Divide: ; 37da5 (d:7da5)
	xor a
	ld [$FF00+$9a], a
	ld [$FF00+$9b], a
	ld [H_SAVEDNUMTOPRINT], a ; $FF00+$9c
	ld [$FF00+$9d], a
	ld [$FF00+$9e], a
	ld a, $9
	ld e, a
.asm_37db3
	ld a, [$FF00+$9a]
	ld c, a
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	sub c
	ld d, a
	ld a, [H_REMAINDER] ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld c, a
	ld a, [H_DIVIDEND] ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	sbc c
	jr c, .asm_37dce
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ld a, d
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [$FF00+$9e]
	inc a
	ld [$FF00+$9e], a
	jr .asm_37db3
.asm_37dce
	ld a, b
	cp $1
	jr z, .asm_37e18
	ld a, [$FF00+$9e]
	sla a
	ld [$FF00+$9e], a
	ld a, [$FF00+$9d]
	rl a
	ld [$FF00+$9d], a
	ld a, [H_SAVEDNUMTOPRINT] ; $FF00+$9c
	rl a
	ld [H_SAVEDNUMTOPRINT], a ; $FF00+$9c
	ld a, [$FF00+$9b]
	rl a
	ld [$FF00+$9b], a
	dec e
	jr nz, .asm_37e04
	ld a, $8
	ld e, a
	ld a, [$FF00+$9a]
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	xor a
	ld [$FF00+$9a], a
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ld a, [$FF00+$97]
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [$FF00+$98]
	ld [$FF00+$97], a
.asm_37e04
	ld a, e
	cp $1
	jr nz, .asm_37e0a
	dec b
.asm_37e0a
	ld a, [H_REMAINDER] ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	srl a
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld a, [$FF00+$9a]
	rr a
	ld [$FF00+$9a], a
	jr .asm_37db3
.asm_37e18
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld a, [$FF00+$9e]
	ld [$FF00+$98], a
	ld a, [$FF00+$9d]
	ld [$FF00+$97], a
	ld a, [H_SAVEDNUMTOPRINT] ; $FF00+$9c
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [$FF00+$9b]
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ret

INCBIN "baserom.gbc",$37e2d,$37e79 - $37e2d

UnnamedText_37e79: ; 37e79 (d:7e79)
	TX_FAR _UnnamedText_37e79
	db $50
; 0x37e79 + 5 bytes

UnnamedText_37e7e: ; 37e7e (d:7e7e)
	TX_FAR _UnnamedText_37e7e
	db $50
; 0x37e7e + 5 bytes

UnnamedText_37e83: ; 37e83 (d:7e83)
	TX_FAR _UnnamedText_37e83
	db $50
; 0x37e83 + 5 bytes

SECTION "bankE",ROMX,BANK[$E]

Moves: ; 38000 (e:4000)
; characteristics of each move
; animation, effect, power, type, accuracy, PP
db POUND       ,NO_ADDITIONAL_EFFECT      ,$28,NORMAL,  $FF,35
db KARATE_CHOP ,NO_ADDITIONAL_EFFECT      ,$32,NORMAL,  $FF,25
db DOUBLESLAP  ,TWO_TO_FIVE_ATTACKS_EFFECT,$0F,NORMAL,  $D8,10
db COMET_PUNCH ,TWO_TO_FIVE_ATTACKS_EFFECT,$12,NORMAL,  $D8,15
db MEGA_PUNCH  ,NO_ADDITIONAL_EFFECT      ,$50,NORMAL,  $D8,20
db PAY_DAY     ,PAY_DAY_EFFECT            ,$28,NORMAL,  $FF,20
db FIRE_PUNCH  ,BURN_SIDE_EFFECT1         ,$4B,FIRE,    $FF,15
db ICE_PUNCH   ,FREEZE_SIDE_EFFECT        ,$4B,ICE,     $FF,15
db THUNDERPUNCH,PARALYZE_SIDE_EFFECT1     ,$4B,ELECTRIC,$FF,15
db SCRATCH     ,NO_ADDITIONAL_EFFECT      ,$28,NORMAL,  $FF,35
db VICEGRIP    ,NO_ADDITIONAL_EFFECT      ,$37,NORMAL,  $FF,30
db GUILLOTINE  ,OHKO_EFFECT               ,$01,NORMAL,  $4C,5
db RAZOR_WIND  ,CHARGE_EFFECT             ,$50,NORMAL,  $BF,10
db SWORDS_DANCE,ATTACK_UP2_EFFECT         ,$00,NORMAL,  $FF,30
db CUT         ,NO_ADDITIONAL_EFFECT      ,$32,NORMAL,  $F2,30
db GUST        ,NO_ADDITIONAL_EFFECT      ,$28,NORMAL,  $FF,35
db WING_ATTACK ,NO_ADDITIONAL_EFFECT      ,$23,FLYING,  $FF,35
db WHIRLWIND   ,SWITCH_AND_TELEPORT_EFFECT,$00,NORMAL,  $D8,20
db FLY         ,FLY_EFFECT                ,$46,FLYING,  $F2,15
db BIND        ,TRAPPING_EFFECT           ,$0F,NORMAL,  $BF,20
db SLAM        ,NO_ADDITIONAL_EFFECT      ,$50,NORMAL,  $BF,20
db VINE_WHIP   ,NO_ADDITIONAL_EFFECT      ,$23,GRASS,   $FF,10
db STOMP       ,FLINCH_SIDE_EFFECT2       ,$41,NORMAL,  $FF,20
db DOUBLE_KICK ,ATTACK_TWICE_EFFECT       ,$1E,FIGHTING,$FF,30
db MEGA_KICK   ,NO_ADDITIONAL_EFFECT      ,$78,NORMAL,  $BF,5
db JUMP_KICK   ,JUMP_KICK_EFFECT          ,$46,FIGHTING,$F2,25
db ROLLING_KICK,FLINCH_SIDE_EFFECT2       ,$3C,FIGHTING,$D8,15
db SAND_ATTACK ,ACCURACY_DOWN1_EFFECT     ,$00,NORMAL,  $FF,15
db HEADBUTT    ,FLINCH_SIDE_EFFECT2       ,$46,NORMAL,  $FF,15
db HORN_ATTACK ,NO_ADDITIONAL_EFFECT      ,$41,NORMAL,  $FF,25
db FURY_ATTACK ,TWO_TO_FIVE_ATTACKS_EFFECT,$0F,NORMAL,  $D8,20
db HORN_DRILL  ,OHKO_EFFECT               ,$01,NORMAL,  $4C,5
db TACKLE      ,NO_ADDITIONAL_EFFECT      ,$23,NORMAL,  $F2,35
db BODY_SLAM   ,PARALYZE_SIDE_EFFECT2     ,$55,NORMAL,  $FF,15
db WRAP        ,TRAPPING_EFFECT           ,$0F,NORMAL,  $D8,20
db TAKE_DOWN   ,RECOIL_EFFECT             ,$5A,NORMAL,  $D8,20
db THRASH      ,THRASH_PETAL_DANCE_EFFECT ,$5A,NORMAL,  $FF,20
db DOUBLE_EDGE ,RECOIL_EFFECT             ,$64,NORMAL,  $FF,15
db TAIL_WHIP   ,DEFENSE_DOWN1_EFFECT      ,$00,NORMAL,  $FF,30
db POISON_STING,POISON_SIDE_EFFECT1       ,$0F,POISON,  $FF,35
db TWINEEDLE   ,TWINEEDLE_EFFECT          ,$19,BUG,     $FF,20
db PIN_MISSILE ,TWO_TO_FIVE_ATTACKS_EFFECT,$0E,BUG,     $D8,20
db LEER        ,DEFENSE_DOWN1_EFFECT      ,$00,NORMAL,  $FF,30
db BITE        ,FLINCH_SIDE_EFFECT1       ,$3C,NORMAL,  $FF,25
db GROWL       ,ATTACK_DOWN1_EFFECT       ,$00,NORMAL,  $FF,40
db ROAR        ,SWITCH_AND_TELEPORT_EFFECT,$00,NORMAL,  $FF,20
db SING        ,SLEEP_EFFECT              ,$00,NORMAL,  $8C,15
db SUPERSONIC  ,CONFUSION_EFFECT          ,$00,NORMAL,  $8C,20
db SONICBOOM   ,SPECIAL_DAMAGE_EFFECT     ,$01,NORMAL,  $E5,20
db DISABLE     ,DISABLE_EFFECT            ,$00,NORMAL,  $8C,20
db ACID        ,DEFENSE_DOWN_SIDE_EFFECT  ,$28,POISON,  $FF,30
db EMBER       ,BURN_SIDE_EFFECT1         ,$28,FIRE,    $FF,25
db FLAMETHROWER,BURN_SIDE_EFFECT1         ,$5F,FIRE,    $FF,15
db MIST        ,MIST_EFFECT               ,$00,ICE,     $FF,30
db WATER_GUN   ,NO_ADDITIONAL_EFFECT      ,$28,WATER,   $FF,25
db HYDRO_PUMP  ,NO_ADDITIONAL_EFFECT      ,$78,WATER,   $CC,5
db SURF        ,NO_ADDITIONAL_EFFECT      ,$5F,WATER,   $FF,15
db ICE_BEAM    ,FREEZE_SIDE_EFFECT        ,$5F,ICE,     $FF,10
db BLIZZARD    ,FREEZE_SIDE_EFFECT        ,$78,ICE,     $E5,5
db PSYBEAM     ,CONFUSION_SIDE_EFFECT     ,$41,PSYCHIC, $FF,20
db BUBBLEBEAM  ,SPEED_DOWN_SIDE_EFFECT    ,$41,WATER,   $FF,20
db AURORA_BEAM ,ATTACK_DOWN_SIDE_EFFECT   ,$41,ICE,     $FF,20
db HYPER_BEAM  ,HYPER_BEAM_EFFECT         ,$96,NORMAL,  $E5,5
db PECK        ,NO_ADDITIONAL_EFFECT      ,$23,FLYING,  $FF,35
db DRILL_PECK  ,NO_ADDITIONAL_EFFECT      ,$50,FLYING,  $FF,20
db SUBMISSION  ,RECOIL_EFFECT             ,$50,FIGHTING,$CC,25
db LOW_KICK    ,FLINCH_SIDE_EFFECT2       ,$32,FIGHTING,$E5,20
db COUNTER     ,NO_ADDITIONAL_EFFECT      ,$01,FIGHTING,$FF,20
db SEISMIC_TOSS,SPECIAL_DAMAGE_EFFECT     ,$01,FIGHTING,$FF,20
db STRENGTH    ,NO_ADDITIONAL_EFFECT      ,$50,NORMAL,  $FF,15
db ABSORB      ,DRAIN_HP_EFFECT           ,$14,GRASS,   $FF,20
db MEGA_DRAIN  ,DRAIN_HP_EFFECT           ,$28,GRASS,   $FF,10
db LEECH_SEED  ,LEECH_SEED_EFFECT         ,$00,GRASS,   $E5,10
db GROWTH      ,SPECIAL_UP1_EFFECT        ,$00,NORMAL,  $FF,40
db RAZOR_LEAF  ,NO_ADDITIONAL_EFFECT      ,$37,GRASS,   $F2,25
db SOLARBEAM   ,CHARGE_EFFECT             ,$78,GRASS,   $FF,10
db POISONPOWDER,POISON_EFFECT             ,$00,POISON,  $BF,35
db STUN_SPORE  ,PARALYZE_EFFECT           ,$00,GRASS,   $BF,30
db SLEEP_POWDER,SLEEP_EFFECT              ,$00,GRASS,   $BF,15
db PETAL_DANCE ,THRASH_PETAL_DANCE_EFFECT ,$46,GRASS,   $FF,20
db STRING_SHOT ,SPEED_DOWN1_EFFECT        ,$00,BUG,     $F2,40
db DRAGON_RAGE ,SPECIAL_DAMAGE_EFFECT     ,$01,DRAGON,  $FF,10
db FIRE_SPIN   ,TRAPPING_EFFECT           ,$0F,FIRE,    $B2,15
db THUNDERSHOCK,PARALYZE_SIDE_EFFECT1     ,$28,ELECTRIC,$FF,30
db THUNDERBOLT ,PARALYZE_SIDE_EFFECT1     ,$5F,ELECTRIC,$FF,15
db THUNDER_WAVE,PARALYZE_EFFECT           ,$00,ELECTRIC,$FF,20
db THUNDER     ,PARALYZE_SIDE_EFFECT1     ,$78,ELECTRIC,$B2,10
db ROCK_THROW  ,NO_ADDITIONAL_EFFECT      ,$32,ROCK,    $A5,15
db EARTHQUAKE  ,NO_ADDITIONAL_EFFECT      ,$64,GROUND,  $FF,10
db FISSURE     ,OHKO_EFFECT               ,$01,GROUND,  $4C,5
db DIG         ,CHARGE_EFFECT             ,$64,GROUND,  $FF,10
db TOXIC       ,POISON_EFFECT             ,$00,POISON,  $D8,10
db CONFUSION   ,CONFUSION_SIDE_EFFECT     ,$32,PSYCHIC, $FF,25
db PSYCHIC_M   ,SPECIAL_DOWN_SIDE_EFFECT  ,$5A,PSYCHIC, $FF,10
db HYPNOSIS    ,SLEEP_EFFECT              ,$00,PSYCHIC, $99,20
db MEDITATE    ,ATTACK_UP1_EFFECT         ,$00,PSYCHIC, $FF,40
db AGILITY     ,SPEED_UP2_EFFECT          ,$00,PSYCHIC, $FF,30
db QUICK_ATTACK,NO_ADDITIONAL_EFFECT      ,$28,NORMAL,  $FF,30
db RAGE        ,RAGE_EFFECT               ,$14,NORMAL,  $FF,20
db TELEPORT    ,SWITCH_AND_TELEPORT_EFFECT,$00,PSYCHIC, $FF,20
db NIGHT_SHADE ,SPECIAL_DAMAGE_EFFECT     ,$00,GHOST,   $FF,15
db MIMIC       ,MIMIC_EFFECT              ,$00,NORMAL,  $FF,10
db SCREECH     ,DEFENSE_DOWN2_EFFECT      ,$00,NORMAL,  $D8,40
db DOUBLE_TEAM ,EVASION_UP1_EFFECT        ,$00,NORMAL,  $FF,15
db RECOVER     ,HEAL_EFFECT               ,$00,NORMAL,  $FF,20
db HARDEN      ,DEFENSE_UP1_EFFECT        ,$00,NORMAL,  $FF,30
db MINIMIZE    ,EVASION_UP1_EFFECT        ,$00,NORMAL,  $FF,20
db SMOKESCREEN ,ACCURACY_DOWN1_EFFECT     ,$00,NORMAL,  $FF,20
db CONFUSE_RAY ,CONFUSION_EFFECT          ,$00,GHOST,   $FF,10
db WITHDRAW    ,DEFENSE_UP1_EFFECT        ,$00,WATER,   $FF,40
db DEFENSE_CURL,DEFENSE_UP1_EFFECT        ,$00,NORMAL,  $FF,40
db BARRIER     ,DEFENSE_UP2_EFFECT        ,$00,PSYCHIC, $FF,30
db LIGHT_SCREEN,LIGHT_SCREEN_EFFECT       ,$00,PSYCHIC, $FF,30
db HAZE        ,HAZE_EFFECT               ,$00,ICE,     $FF,30
db REFLECT     ,REFLECT_EFFECT            ,$00,PSYCHIC, $FF,20
db FOCUS_ENERGY,FOCUS_ENERGY_EFFECT       ,$00,NORMAL,  $FF,30
db BIDE        ,BIDE_EFFECT               ,$00,NORMAL,  $FF,10
db METRONOME   ,METRONOME_EFFECT          ,$00,NORMAL,  $FF,10
db MIRROR_MOVE ,MIRROR_MOVE_EFFECT        ,$00,FLYING,  $FF,20
db SELFDESTRUCT,EXPLODE_EFFECT            ,$82,NORMAL,  $FF,5
db EGG_BOMB    ,NO_ADDITIONAL_EFFECT      ,$64,NORMAL,  $BF,10
db LICK        ,PARALYZE_SIDE_EFFECT2     ,$14,GHOST,   $FF,30
db SMOG        ,POISON_SIDE_EFFECT2       ,$14,POISON,  $B2,20
db SLUDGE      ,POISON_SIDE_EFFECT2       ,$41,POISON,  $FF,20
db BONE_CLUB   ,FLINCH_SIDE_EFFECT1       ,$41,GROUND,  $D8,20
db FIRE_BLAST  ,BURN_SIDE_EFFECT2         ,$78,FIRE,    $D8,5
db WATERFALL   ,NO_ADDITIONAL_EFFECT      ,$50,WATER,   $FF,15
db CLAMP       ,TRAPPING_EFFECT           ,$23,WATER,   $BF,10
db SWIFT       ,SWIFT_EFFECT              ,$3C,NORMAL,  $FF,20
db SKULL_BASH  ,CHARGE_EFFECT             ,$64,NORMAL,  $FF,15
db SPIKE_CANNON,TWO_TO_FIVE_ATTACKS_EFFECT,$14,NORMAL,  $FF,15
db CONSTRICT   ,SPEED_DOWN_SIDE_EFFECT    ,$0A,NORMAL,  $FF,35
db AMNESIA     ,SPECIAL_UP2_EFFECT        ,$00,PSYCHIC, $FF,20
db KINESIS     ,ACCURACY_DOWN1_EFFECT     ,$00,PSYCHIC, $CC,15
db SOFTBOILED  ,HEAL_EFFECT               ,$00,NORMAL,  $FF,10
db HI_JUMP_KICK,JUMP_KICK_EFFECT          ,$55,FIGHTING,$E5,20
db GLARE       ,PARALYZE_EFFECT           ,$00,NORMAL,  $BF,30
db DREAM_EATER ,DREAM_EATER_EFFECT        ,$64,PSYCHIC, $FF,15
db POISON_GAS  ,POISON_EFFECT             ,$00,POISON,  $8C,40
db BARRAGE     ,TWO_TO_FIVE_ATTACKS_EFFECT,$0F,NORMAL,  $D8,20
db LEECH_LIFE  ,DRAIN_HP_EFFECT           ,$14,BUG,     $FF,15
db LOVELY_KISS ,SLEEP_EFFECT              ,$00,NORMAL,  $BF,10
db SKY_ATTACK  ,CHARGE_EFFECT             ,$8C,FLYING,  $E5,5
db TRANSFORM   ,TRANSFORM_EFFECT          ,$00,NORMAL,  $FF,10
db BUBBLE      ,SPEED_DOWN_SIDE_EFFECT    ,$14,WATER,   $FF,30
db DIZZY_PUNCH ,NO_ADDITIONAL_EFFECT      ,$46,NORMAL,  $FF,10
db SPORE       ,SLEEP_EFFECT              ,$00,GRASS,   $FF,15
db FLASH       ,ACCURACY_DOWN1_EFFECT     ,$00,NORMAL,  $B2,20
db PSYWAVE     ,SPECIAL_DAMAGE_EFFECT     ,$01,PSYCHIC, $CC,15
db SPLASH      ,SPLASH_EFFECT             ,$00,NORMAL,  $FF,40
db ACID_ARMOR  ,DEFENSE_UP2_EFFECT        ,$00,POISON,  $FF,40
db CRABHAMMER  ,NO_ADDITIONAL_EFFECT      ,$5A,WATER,   $D8,10
db EXPLOSION   ,EXPLODE_EFFECT            ,$AA,NORMAL,  $FF,5
db FURY_SWIPES ,TWO_TO_FIVE_ATTACKS_EFFECT,$12,NORMAL,  $CC,15
db BONEMERANG  ,ATTACK_TWICE_EFFECT       ,$32,GROUND,  $E5,10
db REST        ,HEAL_EFFECT               ,$00,PSYCHIC, $FF,10
db ROCK_SLIDE  ,NO_ADDITIONAL_EFFECT      ,$4B,ROCK,    $E5,10
db HYPER_FANG  ,FLINCH_SIDE_EFFECT1       ,$50,NORMAL,  $E5,15
db SHARPEN     ,ATTACK_UP1_EFFECT         ,$00,NORMAL,  $FF,30
db CONVERSION  ,CONVERSION_EFFECT         ,$00,NORMAL,  $FF,30
db TRI_ATTACK  ,NO_ADDITIONAL_EFFECT      ,$50,NORMAL,  $FF,10
db SUPER_FANG  ,SUPER_FANG_EFFECT         ,$01,NORMAL,  $E5,10
db SLASH       ,NO_ADDITIONAL_EFFECT      ,$46,NORMAL,  $FF,20
db SUBSTITUTE  ,SUBSTITUTE_EFFECT         ,$00,NORMAL,  $FF,10
db STRUGGLE    ,RECOIL_EFFECT             ,$32,NORMAL,  $FF,10


BulbasaurBaseStats: ; 383de (e:43de)
	db DEX_BULBASAUR ; pokedex id
	db 45 ; base hp
	db 49 ; base attack
	db 49 ; base defense
	db 45 ; base speed
	db 65 ; base special

	db GRASS ; species type 1
	db POISON ; species type 2

	db 45 ; catch rate
	db 64 ; base exp yield
	db $55 ; sprite dimensions

	dw BulbasaurPicFront
	dw BulbasaurPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db GROWL
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10100100
	db %00000011
	db %00111000
	db %11000000
	db %00000011
	db %00001000
	db %00000110

	db 0 ; padding

IvysaurBaseStats: ; 383fa (e:43fa)
	db DEX_IVYSAUR ; pokedex id
	db 60 ; base hp
	db 62 ; base attack
	db 63 ; base defense
	db 60 ; base speed
	db 80 ; base special

	db GRASS ; species type 1
	db POISON ; species type 2

	db 45 ; catch rate
	db 141 ; base exp yield
	db $66 ; sprite dimensions

	dw IvysaurPicFront
	dw IvysaurPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db GROWL
	db LEECH_SEED
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10100100
	db %00000011
	db %00111000
	db %11000000
	db %00000011
	db %00001000
	db %00000110

	db 0 ; padding

VenusaurBaseStats: ; 38416 (e:4416)
	db DEX_VENUSAUR ; pokedex id
	db 80 ; base hp
	db 82 ; base attack
	db 83 ; base defense
	db 80 ; base speed
	db 100 ; base special

	db GRASS ; species type 1
	db POISON ; species type 2

	db 45 ; catch rate
	db 208 ; base exp yield
	db $77 ; sprite dimensions

	dw VenusaurPicFront
	dw VenusaurPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db GROWL
	db LEECH_SEED
	db VINE_WHIP

	db 3 ; growth rate
	
	; learnset
	db %10100100
	db %01000011
	db %00111000
	db %11000000
	db %00000011
	db %00001000
	db %00000110

	db 0 ; padding

CharmanderBaseStats: ; 38432 (e:4432)
	db DEX_CHARMANDER ; pokedex id
	db 39 ; base hp
	db 52 ; base attack
	db 43 ; base defense
	db 65 ; base speed
	db 50 ; base special

	db FIRE ; species type 1
	db FIRE ; species type 2

	db 45 ; catch rate
	db 65 ; base exp yield
	db $55 ; sprite dimensions

	dw CharmanderPicFront
	dw CharmanderPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db GROWL
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110101
	db %00000011
	db %01001111
	db %11001000
	db %11100011
	db %00001000
	db %00100110

	db 0 ; padding

CharmeleonBaseStats: ; 3844e (e:444e)
	db DEX_CHARMELEON ; pokedex id
	db 58 ; base hp
	db 64 ; base attack
	db 58 ; base defense
	db 80 ; base speed
	db 65 ; base special

	db FIRE ; species type 1
	db FIRE ; species type 2

	db 45 ; catch rate
	db 142 ; base exp yield
	db $66 ; sprite dimensions

	dw CharmeleonPicFront
	dw CharmeleonPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db GROWL
	db EMBER
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110101
	db %00000011
	db %01001111
	db %11001000
	db %11100011
	db %00001000
	db %00100110

	db 0 ; padding

CharizardBaseStats: ; 3846a (e:446a)
	db DEX_CHARIZARD ; pokedex id
	db 78 ; base hp
	db 84 ; base attack
	db 78 ; base defense
	db 100 ; base speed
	db 85 ; base special

	db FIRE ; species type 1
	db FLYING ; species type 2

	db 45 ; catch rate
	db 209 ; base exp yield
	db $77 ; sprite dimensions

	dw CharizardPicFront
	dw CharizardPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db GROWL
	db EMBER
	db LEER

	db 3 ; growth rate
	
	; learnset
	db %10110101
	db %01000011
	db %01001111
	db %11001110
	db %11100011
	db %00001000
	db %00100110

	db 0 ; padding

SquirtleBaseStats: ; 38486 (e:4486)
	db DEX_SQUIRTLE ; pokedex id
	db 44 ; base hp
	db 48 ; base attack
	db 65 ; base defense
	db 43 ; base speed
	db 50 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 45 ; catch rate
	db 66 ; base exp yield
	db $55 ; sprite dimensions

	dw SquirtlePicFront
	dw SquirtlePicBack
	
	; attacks known at lvl 0
	db TACKLE
	db TAIL_WHIP
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %00111111
	db %00001111
	db %11001000
	db %10000011
	db %00001000
	db %00110010

	db 0 ; padding

WartortleBaseStats: ; 384a2 (e:44a2)
	db DEX_WARTORTLE ; pokedex id
	db 59 ; base hp
	db 63 ; base attack
	db 80 ; base defense
	db 58 ; base speed
	db 65 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 45 ; catch rate
	db 143 ; base exp yield
	db $66 ; sprite dimensions

	dw WartortlePicFront
	dw WartortlePicBack
	
	; attacks known at lvl 0
	db TACKLE
	db TAIL_WHIP
	db BUBBLE
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %00111111
	db %00001111
	db %11001000
	db %10000011
	db %00001000
	db %00110010

	db 0 ; padding

BlastoiseBaseStats: ; 384be (e:44be)
	db DEX_BLASTOISE ; pokedex id
	db 79 ; base hp
	db 83 ; base attack
	db 100 ; base defense
	db 78 ; base speed
	db 85 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 45 ; catch rate
	db 210 ; base exp yield
	db $77 ; sprite dimensions

	dw BlastoisePicFront
	dw BlastoisePicBack
	
	; attacks known at lvl 0
	db TACKLE
	db TAIL_WHIP
	db BUBBLE
	db WATER_GUN

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %01111111
	db %00001111
	db %11001110
	db %10000011
	db %00001000
	db %00110010

	db 0 ; padding

CaterpieBaseStats: ; 384da (e:44da)
	db DEX_CATERPIE ; pokedex id
	db 45 ; base hp
	db 30 ; base attack
	db 35 ; base defense
	db 45 ; base speed
	db 20 ; base special

	db BUG ; species type 1
	db BUG ; species type 2

	db 255 ; catch rate
	db 53 ; base exp yield
	db $55 ; sprite dimensions

	dw CaterpiePicFront
	dw CaterpiePicBack
	
	; attacks known at lvl 0
	db TACKLE
	db STRING_SHOT
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000

	db 0 ; padding

MetapodBaseStats: ; 384f6 (e:44f6)
	db DEX_METAPOD ; pokedex id
	db 50 ; base hp
	db 20 ; base attack
	db 55 ; base defense
	db 30 ; base speed
	db 25 ; base special

	db BUG ; species type 1
	db BUG ; species type 2

	db 120 ; catch rate
	db 72 ; base exp yield
	db $55 ; sprite dimensions

	dw MetapodPicFront
	dw MetapodPicBack
	
	; attacks known at lvl 0
	db HARDEN
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000

	db 0 ; padding

ButterfreeBaseStats: ; 38512 (e:4512)
	db DEX_BUTTERFREE ; pokedex id
	db 60 ; base hp
	db 45 ; base attack
	db 50 ; base defense
	db 70 ; base speed
	db 80 ; base special

	db BUG ; species type 1
	db FLYING ; species type 2

	db 45 ; catch rate
	db 160 ; base exp yield
	db $77 ; sprite dimensions

	dw ButterfreePicFront
	dw ButterfreePicBack
	
	; attacks known at lvl 0
	db CONFUSION
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00101010
	db %01000011
	db %00111000
	db %11110000
	db %01000011
	db %00101000
	db %00000010

	db 0 ; padding

WeedleBaseStats: ; 3852e (e:452e)
	db DEX_WEEDLE ; pokedex id
	db 40 ; base hp
	db 35 ; base attack
	db 30 ; base defense
	db 50 ; base speed
	db 20 ; base special

	db BUG ; species type 1
	db POISON ; species type 2

	db 255 ; catch rate
	db 52 ; base exp yield
	db $55 ; sprite dimensions

	dw WeedlePicFront
	dw WeedlePicBack
	
	; attacks known at lvl 0
	db POISON_STING
	db STRING_SHOT
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000

	db 0 ; padding

KakunaBaseStats: ; 3854a (e:454a)
	db DEX_KAKUNA ; pokedex id
	db 45 ; base hp
	db 25 ; base attack
	db 50 ; base defense
	db 35 ; base speed
	db 25 ; base special

	db BUG ; species type 1
	db POISON ; species type 2

	db 120 ; catch rate
	db 71 ; base exp yield
	db $55 ; sprite dimensions

	dw KakunaPicFront
	dw KakunaPicBack
	
	; attacks known at lvl 0
	db HARDEN
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000

	db 0 ; padding

BeedrillBaseStats: ; 38566 (e:4566)
	db DEX_BEEDRILL ; pokedex id
	db 65 ; base hp
	db 80 ; base attack
	db 40 ; base defense
	db 75 ; base speed
	db 45 ; base special

	db BUG ; species type 1
	db POISON ; species type 2

	db 45 ; catch rate
	db 159 ; base exp yield
	db $77 ; sprite dimensions

	dw BeedrillPicFront
	dw BeedrillPicBack
	
	; attacks known at lvl 0
	db FURY_ATTACK
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100100
	db %01000011
	db %00011000
	db %11000000
	db %11000011
	db %00001000
	db %00000110

	db 0 ; padding

PidgeyBaseStats: ; 38582 (e:4582)
	db DEX_PIDGEY ; pokedex id
	db 40 ; base hp
	db 45 ; base attack
	db 40 ; base defense
	db 56 ; base speed
	db 35 ; base special

	db NORMAL ; species type 1
	db FLYING ; species type 2

	db 255 ; catch rate
	db 55 ; base exp yield
	db $55 ; sprite dimensions

	dw PidgeyPicFront
	dw PidgeyPicBack
	
	; attacks known at lvl 0
	db GUST
	db 0
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %00101010
	db %00000011
	db %00001000
	db %11000000
	db %01000011
	db %00001100
	db %00001010

	db 0 ; padding

PidgeottoBaseStats: ; 3859e (e:459e)
	db DEX_PIDGEOTTO ; pokedex id
	db 63 ; base hp
	db 60 ; base attack
	db 55 ; base defense
	db 71 ; base speed
	db 50 ; base special

	db NORMAL ; species type 1
	db FLYING ; species type 2

	db 120 ; catch rate
	db 113 ; base exp yield
	db $66 ; sprite dimensions

	dw PidgeottoPicFront
	dw PidgeottoPicBack
	
	; attacks known at lvl 0
	db GUST
	db SAND_ATTACK
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %00101010
	db %00000011
	db %00001000
	db %11000000
	db %01000011
	db %00001100
	db %00001010

	db 0 ; padding

PidgeotBaseStats: ; 385ba (e:45ba)
	db DEX_PIDGEOT ; pokedex id
	db 83 ; base hp
	db 80 ; base attack
	db 75 ; base defense
	db 91 ; base speed
	db 70 ; base special

	db NORMAL ; species type 1
	db FLYING ; species type 2

	db 45 ; catch rate
	db 172 ; base exp yield
	db $77 ; sprite dimensions

	dw PidgeotPicFront
	dw PidgeotPicBack
	
	; attacks known at lvl 0
	db GUST
	db SAND_ATTACK
	db QUICK_ATTACK
	db 0

	db 3 ; growth rate
	
	; learnset
	db %00101010
	db %01000011
	db %00001000
	db %11000000
	db %01000011
	db %00001100
	db %00001010

	db 0 ; padding

RattataBaseStats: ; 385d6 (e:45d6)
	db DEX_RATTATA ; pokedex id
	db 30 ; base hp
	db 56 ; base attack
	db 35 ; base defense
	db 72 ; base speed
	db 25 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 255 ; catch rate
	db 57 ; base exp yield
	db $55 ; sprite dimensions

	dw RattataPicFront
	dw RattataPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db TAIL_WHIP
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %00101111
	db %10001000
	db %11001001
	db %11000010
	db %00001000
	db %00000010

	db 0 ; padding

RaticateBaseStats: ; 385f2 (e:45f2)
	db DEX_RATICATE ; pokedex id
	db 55 ; base hp
	db 81 ; base attack
	db 60 ; base defense
	db 97 ; base speed
	db 50 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 90 ; catch rate
	db 116 ; base exp yield
	db $66 ; sprite dimensions

	dw RaticatePicFront
	dw RaticatePicBack
	
	; attacks known at lvl 0
	db TACKLE
	db TAIL_WHIP
	db QUICK_ATTACK
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %01111111
	db %10001000
	db %11001001
	db %11000010
	db %00001000
	db %00000010

	db 0 ; padding

SpearowBaseStats: ; 3860e (e:460e)
	db DEX_SPEAROW ; pokedex id
	db 40 ; base hp
	db 60 ; base attack
	db 30 ; base defense
	db 70 ; base speed
	db 31 ; base special

	db NORMAL ; species type 1
	db FLYING ; species type 2

	db 255 ; catch rate
	db 58 ; base exp yield
	db $55 ; sprite dimensions

	dw SpearowPicFront
	dw SpearowPicBack
	
	; attacks known at lvl 0
	db PECK
	db GROWL
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00101010
	db %00000011
	db %00001000
	db %11000000
	db %01000010
	db %00001100
	db %00001010

	db 0 ; padding

FearowBaseStats: ; 3862a (e:462a)
	db DEX_FEAROW ; pokedex id
	db 65 ; base hp
	db 90 ; base attack
	db 65 ; base defense
	db 100 ; base speed
	db 61 ; base special

	db NORMAL ; species type 1
	db FLYING ; species type 2

	db 90 ; catch rate
	db 162 ; base exp yield
	db $77 ; sprite dimensions

	dw FearowPicFront
	dw FearowPicBack
	
	; attacks known at lvl 0
	db PECK
	db GROWL
	db LEER
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00101010
	db %01000011
	db %00001000
	db %11000000
	db %01000010
	db %00001100
	db %00001010

	db 0 ; padding

EkansBaseStats: ; 38646 (e:4646)
	db DEX_EKANS ; pokedex id
	db 35 ; base hp
	db 60 ; base attack
	db 44 ; base defense
	db 55 ; base speed
	db 40 ; base special

	db POISON ; species type 1
	db POISON ; species type 2

	db 255 ; catch rate
	db 62 ; base exp yield
	db $55 ; sprite dimensions

	dw EkansPicFront
	dw EkansPicBack
	
	; attacks known at lvl 0
	db WRAP
	db LEER
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %00000011
	db %00011000
	db %11001110
	db %10000010
	db %10001000
	db %00100010

	db 0 ; padding

ArbokBaseStats: ; 38662 (e:4662)
	db DEX_ARBOK ; pokedex id
	db 60 ; base hp
	db 85 ; base attack
	db 69 ; base defense
	db 80 ; base speed
	db 65 ; base special

	db POISON ; species type 1
	db POISON ; species type 2

	db 90 ; catch rate
	db 147 ; base exp yield
	db $77 ; sprite dimensions

	dw ArbokPicFront
	dw ArbokPicBack
	
	; attacks known at lvl 0
	db WRAP
	db LEER
	db POISON_STING
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %01000011
	db %00011000
	db %11001110
	db %10000010
	db %10001000
	db %00100010

	db 0 ; padding

PikachuBaseStats: ; 3867e (e:467e)
	db DEX_PIKACHU ; pokedex id
	db 35 ; base hp
	db 55 ; base attack
	db 30 ; base defense
	db 90 ; base speed
	db 50 ; base special

	db ELECTRIC ; species type 1
	db ELECTRIC ; species type 2

	db 190 ; catch rate
	db 82 ; base exp yield
	db $55 ; sprite dimensions

	dw PikachuPicFront
	dw PikachuPicBack
	
	; attacks known at lvl 0
	db THUNDERSHOCK
	db GROWL
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %10000011
	db %10001101
	db %11000001
	db %11000011
	db %00011000
	db %01000010

	db 0 ; padding

RaichuBaseStats: ; 3869a (e:469a)
	db DEX_RAICHU ; pokedex id
	db 60 ; base hp
	db 90 ; base attack
	db 55 ; base defense
	db 100 ; base speed
	db 90 ; base special

	db ELECTRIC ; species type 1
	db ELECTRIC ; species type 2

	db 75 ; catch rate
	db 122 ; base exp yield
	db $77 ; sprite dimensions

	dw RaichuPicFront
	dw RaichuPicBack
	
	; attacks known at lvl 0
	db THUNDERSHOCK
	db GROWL
	db THUNDER_WAVE
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %11000011
	db %10001101
	db %11000001
	db %11000011
	db %00011000
	db %01000010

	db 0 ; padding

SandshrewBaseStats: ; 386b6 (e:46b6)
	db DEX_SANDSHREW ; pokedex id
	db 50 ; base hp
	db 75 ; base attack
	db 85 ; base defense
	db 40 ; base speed
	db 30 ; base special

	db GROUND ; species type 1
	db GROUND ; species type 2

	db 255 ; catch rate
	db 93 ; base exp yield
	db $55 ; sprite dimensions

	dw SandshrewPicFront
	dw SandshrewPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100100
	db %00000011
	db %00001101
	db %11001110
	db %11000010
	db %10001000
	db %00100110

	db 0 ; padding

SandslashBaseStats: ; 386d2 (e:46d2)
	db DEX_SANDSLASH ; pokedex id
	db 75 ; base hp
	db 100 ; base attack
	db 110 ; base defense
	db 65 ; base speed
	db 55 ; base special

	db GROUND ; species type 1
	db GROUND ; species type 2

	db 90 ; catch rate
	db 163 ; base exp yield
	db $66 ; sprite dimensions

	dw SandslashPicFront
	dw SandslashPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db SAND_ATTACK
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100100
	db %01000011
	db %00001101
	db %11001110
	db %11000010
	db %10001000
	db %00100110

	db 0 ; padding

NidoranFBaseStats: ; 386ee (e:46ee)
	db DEX_NIDORAN_F ; pokedex id
	db 55 ; base hp
	db 47 ; base attack
	db 52 ; base defense
	db 41 ; base speed
	db 40 ; base special

	db POISON ; species type 1
	db POISON ; species type 2

	db 235 ; catch rate
	db 59 ; base exp yield
	db $55 ; sprite dimensions

	dw NidoranFPicFront
	dw NidoranFPicBack
	
	; attacks known at lvl 0
	db GROWL
	db TACKLE
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10100000
	db %00100011
	db %10001000
	db %11000001
	db %10000011
	db %00001000
	db %00000010

	db 0 ; padding

NidorinaBaseStats: ; 3870a (e:470a)
	db DEX_NIDORINA ; pokedex id
	db 70 ; base hp
	db 62 ; base attack
	db 67 ; base defense
	db 56 ; base speed
	db 55 ; base special

	db POISON ; species type 1
	db POISON ; species type 2

	db 120 ; catch rate
	db 117 ; base exp yield
	db $66 ; sprite dimensions

	dw NidorinaPicFront
	dw NidorinaPicBack
	
	; attacks known at lvl 0
	db GROWL
	db TACKLE
	db SCRATCH
	db 0

	db 3 ; growth rate
	
	; learnset
	db %11100000
	db %00111111
	db %10001000
	db %11000001
	db %10000011
	db %00001000
	db %00000010

	db 0 ; padding

NidoqueenBaseStats: ; 38726 (e:4726)
	db DEX_NIDOQUEEN ; pokedex id
	db 90 ; base hp
	db 82 ; base attack
	db 87 ; base defense
	db 76 ; base speed
	db 75 ; base special

	db POISON ; species type 1
	db GROUND ; species type 2

	db 45 ; catch rate
	db 194 ; base exp yield
	db $77 ; sprite dimensions

	dw NidoqueenPicFront
	dw NidoqueenPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SCRATCH
	db TAIL_WHIP
	db BODY_SLAM

	db 3 ; growth rate
	
	; learnset
	db %11110001
	db %11111111
	db %10001111
	db %11000111
	db %10100011
	db %10001000
	db %00110010

	db 0 ; padding

NidoranMBaseStats: ; 38742 (e:4742)
	db DEX_NIDORAN_M ; pokedex id
	db 46 ; base hp
	db 57 ; base attack
	db 40 ; base defense
	db 50 ; base speed
	db 40 ; base special

	db POISON ; species type 1
	db POISON ; species type 2

	db 235 ; catch rate
	db 60 ; base exp yield
	db $55 ; sprite dimensions

	dw NidoranMPicFront
	dw NidoranMPicBack
	
	; attacks known at lvl 0
	db LEER
	db TACKLE
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %11100000
	db %00100011
	db %10001000
	db %11000001
	db %10000011
	db %00001000
	db %00000010

	db 0 ; padding

NidorinoBaseStats: ; 3875e (e:475e)
	db DEX_NIDORINO ; pokedex id
	db 61 ; base hp
	db 72 ; base attack
	db 57 ; base defense
	db 65 ; base speed
	db 55 ; base special

	db POISON ; species type 1
	db POISON ; species type 2

	db 120 ; catch rate
	db 118 ; base exp yield
	db $66 ; sprite dimensions

	dw NidorinoPicFront
	dw NidorinoPicBack
	
	; attacks known at lvl 0
	db LEER
	db TACKLE
	db HORN_ATTACK
	db 0

	db 3 ; growth rate
	
	; learnset
	db %11100000
	db %00111111
	db %10001000
	db %11000001
	db %10000011
	db %00001000
	db %00000010

	db 0 ; padding

NidokingBaseStats: ; 3877a (e:477a)
	db DEX_NIDOKING ; pokedex id
	db 81 ; base hp
	db 92 ; base attack
	db 77 ; base defense
	db 85 ; base speed
	db 75 ; base special

	db POISON ; species type 1
	db GROUND ; species type 2

	db 45 ; catch rate
	db 195 ; base exp yield
	db $77 ; sprite dimensions

	dw NidokingPicFront
	dw NidokingPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db HORN_ATTACK
	db POISON_STING
	db THRASH

	db 3 ; growth rate
	
	; learnset
	db %11110001
	db %11111111
	db %10001111
	db %11000111
	db %10100011
	db %10001000
	db %00110010

	db 0 ; padding

ClefairyBaseStats: ; 38796 (e:4796)
	db DEX_CLEFAIRY ; pokedex id
	db 70 ; base hp
	db 45 ; base attack
	db 48 ; base defense
	db 35 ; base speed
	db 60 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 150 ; catch rate
	db 68 ; base exp yield
	db $55 ; sprite dimensions

	dw ClefairyPicFront
	dw ClefairyPicBack
	
	; attacks known at lvl 0
	db POUND
	db GROWL
	db 0
	db 0

	db 4 ; growth rate
	
	; learnset
	db %10110001
	db %00111111
	db %10101111
	db %11110001
	db %10100111
	db %00111000
	db %01100011

	db 0 ; padding

ClefableBaseStats: ; 387b2 (e:47b2)
	db DEX_CLEFABLE ; pokedex id
	db 95 ; base hp
	db 70 ; base attack
	db 73 ; base defense
	db 60 ; base speed
	db 85 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 25 ; catch rate
	db 129 ; base exp yield
	db $66 ; sprite dimensions

	dw ClefablePicFront
	dw ClefablePicBack
	
	; attacks known at lvl 0
	db SING
	db DOUBLESLAP
	db MINIMIZE
	db METRONOME

	db 4 ; growth rate
	
	; learnset
	db %10110001
	db %01111111
	db %10101111
	db %11110001
	db %10100111
	db %00111000
	db %01100011

	db 0 ; padding

VulpixBaseStats: ; 387ce (e:47ce)
	db DEX_VULPIX ; pokedex id
	db 38 ; base hp
	db 41 ; base attack
	db 40 ; base defense
	db 65 ; base speed
	db 65 ; base special

	db FIRE ; species type 1
	db FIRE ; species type 2

	db 190 ; catch rate
	db 63 ; base exp yield
	db $66 ; sprite dimensions

	dw VulpixPicFront
	dw VulpixPicBack
	
	; attacks known at lvl 0
	db EMBER
	db TAIL_WHIP
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %00000011
	db %00001000
	db %11001000
	db %11100011
	db %00001000
	db %00000010

	db 0 ; padding

NinetalesBaseStats: ; 387ea (e:47ea)
	db DEX_NINETALES ; pokedex id
	db 73 ; base hp
	db 76 ; base attack
	db 75 ; base defense
	db 100 ; base speed
	db 100 ; base special

	db FIRE ; species type 1
	db FIRE ; species type 2

	db 75 ; catch rate
	db 178 ; base exp yield
	db $77 ; sprite dimensions

	dw NinetalesPicFront
	dw NinetalesPicBack
	
	; attacks known at lvl 0
	db EMBER
	db TAIL_WHIP
	db QUICK_ATTACK
	db ROAR

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %01000011
	db %00001000
	db %11001000
	db %11100011
	db %00001000
	db %00000010

	db 0 ; padding

JigglypuffBaseStats: ; 38806 (e:4806)
	db DEX_JIGGLYPUFF ; pokedex id
	db 115 ; base hp
	db 45 ; base attack
	db 20 ; base defense
	db 20 ; base speed
	db 25 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 170 ; catch rate
	db 76 ; base exp yield
	db $55 ; sprite dimensions

	dw JigglypuffPicFront
	dw JigglypuffPicBack
	
	; attacks known at lvl 0
	db SING
	db 0
	db 0
	db 0

	db 4 ; growth rate
	
	; learnset
	db %10110001
	db %00111111
	db %10101111
	db %11110001
	db %10100011
	db %00111000
	db %01100011

	db 0 ; padding

WigglytuffBaseStats: ; 38822 (e:4822)
	db DEX_WIGGLYTUFF ; pokedex id
	db 140 ; base hp
	db 70 ; base attack
	db 45 ; base defense
	db 45 ; base speed
	db 50 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 50 ; catch rate
	db 109 ; base exp yield
	db $66 ; sprite dimensions

	dw WigglytuffPicFront
	dw WigglytuffPicBack
	
	; attacks known at lvl 0
	db SING
	db DISABLE
	db DEFENSE_CURL
	db DOUBLESLAP

	db 4 ; growth rate
	
	; learnset
	db %10110001
	db %01111111
	db %10101111
	db %11110001
	db %10100011
	db %00111000
	db %01100011

	db 0 ; padding

ZubatBaseStats: ; 3883e (e:483e)
	db DEX_ZUBAT ; pokedex id
	db 40 ; base hp
	db 45 ; base attack
	db 35 ; base defense
	db 55 ; base speed
	db 40 ; base special

	db POISON ; species type 1
	db FLYING ; species type 2

	db 255 ; catch rate
	db 54 ; base exp yield
	db $55 ; sprite dimensions

	dw ZubatPicFront
	dw ZubatPicBack
	
	; attacks known at lvl 0
	db LEECH_LIFE
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00101010
	db %00000011
	db %00011000
	db %11000000
	db %01000010
	db %00001000
	db %00000010

	db 0 ; padding

GolbatBaseStats: ; 3885a (e:485a)
	db DEX_GOLBAT ; pokedex id
	db 75 ; base hp
	db 80 ; base attack
	db 70 ; base defense
	db 90 ; base speed
	db 75 ; base special

	db POISON ; species type 1
	db FLYING ; species type 2

	db 90 ; catch rate
	db 171 ; base exp yield
	db $77 ; sprite dimensions

	dw GolbatPicFront
	dw GolbatPicBack
	
	; attacks known at lvl 0
	db LEECH_LIFE
	db SCREECH
	db BITE
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00101010
	db %01000011
	db %00011000
	db %11000000
	db %01000010
	db %00001000
	db %00000010

	db 0 ; padding

OddishBaseStats: ; 38876 (e:4876)
	db DEX_ODDISH ; pokedex id
	db 45 ; base hp
	db 50 ; base attack
	db 55 ; base defense
	db 30 ; base speed
	db 75 ; base special

	db GRASS ; species type 1
	db POISON ; species type 2

	db 255 ; catch rate
	db 78 ; base exp yield
	db $55 ; sprite dimensions

	dw OddishPicFront
	dw OddishPicBack
	
	; attacks known at lvl 0
	db ABSORB
	db 0
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %00100100
	db %00000011
	db %00111000
	db %11000000
	db %00000011
	db %00001000
	db %00000110

	db 0 ; padding

GloomBaseStats: ; 38892 (e:4892)
	db DEX_GLOOM ; pokedex id
	db 60 ; base hp
	db 65 ; base attack
	db 70 ; base defense
	db 40 ; base speed
	db 85 ; base special

	db GRASS ; species type 1
	db POISON ; species type 2

	db 120 ; catch rate
	db 132 ; base exp yield
	db $66 ; sprite dimensions

	dw GloomPicFront
	dw GloomPicBack
	
	; attacks known at lvl 0
	db ABSORB
	db POISONPOWDER
	db STUN_SPORE
	db 0

	db 3 ; growth rate
	
	; learnset
	db %00100100
	db %00000011
	db %00111000
	db %11000000
	db %00000011
	db %00001000
	db %00000110

	db 0 ; padding

VileplumeBaseStats: ; 388ae (e:48ae)
	db DEX_VILEPLUME ; pokedex id
	db 75 ; base hp
	db 80 ; base attack
	db 85 ; base defense
	db 50 ; base speed
	db 100 ; base special

	db GRASS ; species type 1
	db POISON ; species type 2

	db 45 ; catch rate
	db 184 ; base exp yield
	db $77 ; sprite dimensions

	dw VileplumePicFront
	dw VileplumePicBack
	
	; attacks known at lvl 0
	db STUN_SPORE
	db SLEEP_POWDER
	db ACID
	db PETAL_DANCE

	db 3 ; growth rate
	
	; learnset
	db %10100100
	db %01000011
	db %00111000
	db %11000000
	db %00000011
	db %00001000
	db %00000110

	db 0 ; padding

ParasBaseStats: ; 388ca (e:48ca)
	db DEX_PARAS ; pokedex id
	db 35 ; base hp
	db 70 ; base attack
	db 55 ; base defense
	db 25 ; base speed
	db 55 ; base special

	db BUG ; species type 1
	db GRASS ; species type 2

	db 190 ; catch rate
	db 70 ; base exp yield
	db $55 ; sprite dimensions

	dw ParasPicFront
	dw ParasPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100100
	db %00000011
	db %00111000
	db %11001000
	db %10000011
	db %00001000
	db %00000110

	db 0 ; padding

ParasectBaseStats: ; 388e6 (e:48e6)
	db DEX_PARASECT ; pokedex id
	db 60 ; base hp
	db 95 ; base attack
	db 80 ; base defense
	db 30 ; base speed
	db 80 ; base special

	db BUG ; species type 1
	db GRASS ; species type 2

	db 75 ; catch rate
	db 128 ; base exp yield
	db $77 ; sprite dimensions

	dw ParasectPicFront
	dw ParasectPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db STUN_SPORE
	db LEECH_LIFE
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100100
	db %01000011
	db %00111000
	db %11001000
	db %10000011
	db %00001000
	db %00000110

	db 0 ; padding

VenonatBaseStats: ; 38902 (e:4902)
	db DEX_VENONAT ; pokedex id
	db 60 ; base hp
	db 55 ; base attack
	db 50 ; base defense
	db 45 ; base speed
	db 40 ; base special

	db BUG ; species type 1
	db POISON ; species type 2

	db 190 ; catch rate
	db 75 ; base exp yield
	db $55 ; sprite dimensions

	dw VenonatPicFront
	dw VenonatPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db DISABLE
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100000
	db %00000011
	db %00111000
	db %11010000
	db %00000011
	db %00101000
	db %00000010

	db 0 ; padding

VenomothBaseStats: ; 3891e (e:491e)
	db DEX_VENOMOTH ; pokedex id
	db 70 ; base hp
	db 65 ; base attack
	db 60 ; base defense
	db 90 ; base speed
	db 90 ; base special

	db BUG ; species type 1
	db POISON ; species type 2

	db 75 ; catch rate
	db 138 ; base exp yield
	db $77 ; sprite dimensions

	dw VenomothPicFront
	dw VenomothPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db DISABLE
	db POISONPOWDER
	db LEECH_LIFE

	db 0 ; growth rate
	
	; learnset
	db %00101010
	db %01000011
	db %00111000
	db %11110000
	db %01000011
	db %00101000
	db %00000010

	db 0 ; padding

DiglettBaseStats: ; 3893a (e:493a)
	db DEX_DIGLETT ; pokedex id
	db 10 ; base hp
	db 55 ; base attack
	db 25 ; base defense
	db 95 ; base speed
	db 45 ; base special

	db GROUND ; species type 1
	db GROUND ; species type 2

	db 255 ; catch rate
	db 81 ; base exp yield
	db $55 ; sprite dimensions

	dw DiglettPicFront
	dw DiglettPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %00000011
	db %00001000
	db %11001110
	db %00000010
	db %10001000
	db %00000010

	db 0 ; padding

DugtrioBaseStats: ; 38956 (e:4956)
	db DEX_DUGTRIO ; pokedex id
	db 35 ; base hp
	db 80 ; base attack
	db 50 ; base defense
	db 120 ; base speed
	db 70 ; base special

	db GROUND ; species type 1
	db GROUND ; species type 2

	db 50 ; catch rate
	db 153 ; base exp yield
	db $66 ; sprite dimensions

	dw DugtrioPicFront
	dw DugtrioPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db GROWL
	db DIG
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %01000011
	db %00001000
	db %11001110
	db %00000010
	db %10001000
	db %00000010

	db 0 ; padding

MeowthBaseStats: ; 38972 (e:4972)
	db DEX_MEOWTH ; pokedex id
	db 40 ; base hp
	db 45 ; base attack
	db 35 ; base defense
	db 90 ; base speed
	db 40 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 255 ; catch rate
	db 69 ; base exp yield
	db $55 ; sprite dimensions

	dw MeowthPicFront
	dw MeowthPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db GROWL
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %10001111
	db %10001000
	db %11000001
	db %11000010
	db %00001000
	db %00000010

	db 0 ; padding

PersianBaseStats: ; 3898e (e:498e)
	db DEX_PERSIAN ; pokedex id
	db 65 ; base hp
	db 70 ; base attack
	db 60 ; base defense
	db 115 ; base speed
	db 65 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 90 ; catch rate
	db 148 ; base exp yield
	db $77 ; sprite dimensions

	dw PersianPicFront
	dw PersianPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db GROWL
	db BITE
	db SCREECH

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %11001111
	db %10001000
	db %11000001
	db %11000010
	db %00001000
	db %00000010

	db 0 ; padding

PsyduckBaseStats: ; 389aa (e:49aa)
	db DEX_PSYDUCK ; pokedex id
	db 50 ; base hp
	db 52 ; base attack
	db 48 ; base defense
	db 55 ; base speed
	db 50 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 190 ; catch rate
	db 80 ; base exp yield
	db $55 ; sprite dimensions

	dw PsyduckPicFront
	dw PsyduckPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %10111111
	db %00001111
	db %11001000
	db %11000010
	db %00001000
	db %00110010

	db 0 ; padding

GolduckBaseStats: ; 389c6 (e:49c6)
	db DEX_GOLDUCK ; pokedex id
	db 80 ; base hp
	db 82 ; base attack
	db 78 ; base defense
	db 85 ; base speed
	db 80 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 75 ; catch rate
	db 174 ; base exp yield
	db $77 ; sprite dimensions

	dw GolduckPicFront
	dw GolduckPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db TAIL_WHIP
	db DISABLE
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %11111111
	db %00001111
	db %11001000
	db %11000010
	db %00001000
	db %00110010

	db 0 ; padding

MankeyBaseStats: ; 389e2 (e:49e2)
	db DEX_MANKEY ; pokedex id
	db 40 ; base hp
	db 80 ; base attack
	db 35 ; base defense
	db 70 ; base speed
	db 35 ; base special

	db FIGHTING ; species type 1
	db FIGHTING ; species type 2

	db 190 ; catch rate
	db 74 ; base exp yield
	db $55 ; sprite dimensions

	dw MankeyPicFront
	dw MankeyPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db LEER
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %10000011
	db %10001111
	db %11001001
	db %11000110
	db %10001000
	db %00100010

	db 0 ; padding

PrimeapeBaseStats: ; 389fe (e:49fe)
	db DEX_PRIMEAPE ; pokedex id
	db 65 ; base hp
	db 105 ; base attack
	db 60 ; base defense
	db 95 ; base speed
	db 60 ; base special

	db FIGHTING ; species type 1
	db FIGHTING ; species type 2

	db 75 ; catch rate
	db 149 ; base exp yield
	db $77 ; sprite dimensions

	dw PrimeapePicFront
	dw PrimeapePicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db LEER
	db KARATE_CHOP
	db FURY_SWIPES

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %11000011
	db %10001111
	db %11001001
	db %11000110
	db %10001000
	db %00100010

	db 0 ; padding

GrowlitheBaseStats: ; 38a1a (e:4a1a)
	db DEX_GROWLITHE ; pokedex id
	db 55 ; base hp
	db 70 ; base attack
	db 45 ; base defense
	db 60 ; base speed
	db 50 ; base special

	db FIRE ; species type 1
	db FIRE ; species type 2

	db 190 ; catch rate
	db 91 ; base exp yield
	db $55 ; sprite dimensions

	dw GrowlithePicFront
	dw GrowlithePicBack
	
	; attacks known at lvl 0
	db BITE
	db ROAR
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %10100000
	db %00000011
	db %01001000
	db %11001000
	db %11100011
	db %00001000
	db %00000010

	db 0 ; padding

ArcanineBaseStats: ; 38a36 (e:4a36)
	db DEX_ARCANINE ; pokedex id
	db 90 ; base hp
	db 110 ; base attack
	db 80 ; base defense
	db 95 ; base speed
	db 80 ; base special

	db FIRE ; species type 1
	db FIRE ; species type 2

	db 75 ; catch rate
	db 213 ; base exp yield
	db $77 ; sprite dimensions

	dw ArcaninePicFront
	dw ArcaninePicBack
	
	; attacks known at lvl 0
	db ROAR
	db EMBER
	db LEER
	db TAKE_DOWN

	db 5 ; growth rate
	
	; learnset
	db %10100000
	db %01000011
	db %01001000
	db %11101000
	db %11100011
	db %00001000
	db %00000010

	db 0 ; padding

PoliwagBaseStats: ; 38a52 (e:4a52)
	db DEX_POLIWAG ; pokedex id
	db 40 ; base hp
	db 50 ; base attack
	db 40 ; base defense
	db 90 ; base speed
	db 40 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 255 ; catch rate
	db 77 ; base exp yield
	db $55 ; sprite dimensions

	dw PoliwagPicFront
	dw PoliwagPicBack
	
	; attacks known at lvl 0
	db BUBBLE
	db 0
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10100000
	db %00111111
	db %00001000
	db %11010000
	db %10000010
	db %00101000
	db %00010010

	db 0 ; padding

PoliwhirlBaseStats: ; 38a6e (e:4a6e)
	db DEX_POLIWHIRL ; pokedex id
	db 65 ; base hp
	db 65 ; base attack
	db 65 ; base defense
	db 90 ; base speed
	db 50 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 120 ; catch rate
	db 131 ; base exp yield
	db $66 ; sprite dimensions

	dw PoliwhirlPicFront
	dw PoliwhirlPicBack
	
	; attacks known at lvl 0
	db BUBBLE
	db HYPNOSIS
	db WATER_GUN
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %00111111
	db %00001111
	db %11010110
	db %10000110
	db %00101000
	db %00110010

	db 0 ; padding

PoliwrathBaseStats: ; 38a8a (e:4a8a)
	db DEX_POLIWRATH ; pokedex id
	db 90 ; base hp
	db 85 ; base attack
	db 95 ; base defense
	db 70 ; base speed
	db 70 ; base special

	db WATER ; species type 1
	db FIGHTING ; species type 2

	db 45 ; catch rate
	db 185 ; base exp yield
	db $77 ; sprite dimensions

	dw PoliwrathPicFront
	dw PoliwrathPicBack
	
	; attacks known at lvl 0
	db HYPNOSIS
	db WATER_GUN
	db DOUBLESLAP
	db BODY_SLAM

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %01111111
	db %00001111
	db %11010110
	db %10000110
	db %00101000
	db %00110010

	db 0 ; padding

AbraBaseStats: ; 38aa6 (e:4aa6)
	db DEX_ABRA ; pokedex id
	db 25 ; base hp
	db 20 ; base attack
	db 15 ; base defense
	db 90 ; base speed
	db 105 ; base special

	db PSYCHIC ; species type 1
	db PSYCHIC ; species type 2

	db 200 ; catch rate
	db 73 ; base exp yield
	db $55 ; sprite dimensions

	dw AbraPicFront
	dw AbraPicBack
	
	; attacks known at lvl 0
	db TELEPORT
	db 0
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %00000011
	db %00001111
	db %11110000
	db %10000111
	db %00111000
	db %01000011

	db 0 ; padding

KadabraBaseStats: ; 38ac2 (e:4ac2)
	db DEX_KADABRA ; pokedex id
	db 40 ; base hp
	db 35 ; base attack
	db 30 ; base defense
	db 105 ; base speed
	db 120 ; base special

	db PSYCHIC ; species type 1
	db PSYCHIC ; species type 2

	db 100 ; catch rate
	db 145 ; base exp yield
	db $66 ; sprite dimensions

	dw KadabraPicFront
	dw KadabraPicBack
	
	; attacks known at lvl 0
	db TELEPORT
	db CONFUSION
	db DISABLE
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %00000011
	db %00001111
	db %11111000
	db %10000111
	db %00111000
	db %01000011

	db 0 ; padding

AlakazamBaseStats: ; 38ade (e:4ade)
	db DEX_ALAKAZAM ; pokedex id
	db 55 ; base hp
	db 50 ; base attack
	db 45 ; base defense
	db 120 ; base speed
	db 135 ; base special

	db PSYCHIC ; species type 1
	db PSYCHIC ; species type 2

	db 50 ; catch rate
	db 186 ; base exp yield
	db $77 ; sprite dimensions

	dw AlakazamPicFront
	dw AlakazamPicBack
	
	; attacks known at lvl 0
	db TELEPORT
	db CONFUSION
	db DISABLE
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %01000011
	db %00001111
	db %11111000
	db %10000111
	db %00111000
	db %01000011

	db 0 ; padding

MachopBaseStats: ; 38afa (e:4afa)
	db DEX_MACHOP ; pokedex id
	db 70 ; base hp
	db 80 ; base attack
	db 50 ; base defense
	db 35 ; base speed
	db 35 ; base special

	db FIGHTING ; species type 1
	db FIGHTING ; species type 2

	db 180 ; catch rate
	db 88 ; base exp yield
	db $55 ; sprite dimensions

	dw MachopPicFront
	dw MachopPicBack
	
	; attacks known at lvl 0
	db KARATE_CHOP
	db 0
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %00000011
	db %00001111
	db %11001110
	db %10100110
	db %10001000
	db %00100010

	db 0 ; padding

MachokeBaseStats: ; 38b16 (e:4b16)
	db DEX_MACHOKE ; pokedex id
	db 80 ; base hp
	db 100 ; base attack
	db 70 ; base defense
	db 45 ; base speed
	db 50 ; base special

	db FIGHTING ; species type 1
	db FIGHTING ; species type 2

	db 90 ; catch rate
	db 146 ; base exp yield
	db $77 ; sprite dimensions

	dw MachokePicFront
	dw MachokePicBack
	
	; attacks known at lvl 0
	db KARATE_CHOP
	db LOW_KICK
	db LEER
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %00000011
	db %00001111
	db %11001110
	db %10100110
	db %10001000
	db %00100010

	db 0 ; padding

MachampBaseStats: ; 38b32 (e:4b32)
	db DEX_MACHAMP ; pokedex id
	db 90 ; base hp
	db 130 ; base attack
	db 80 ; base defense
	db 55 ; base speed
	db 65 ; base special

	db FIGHTING ; species type 1
	db FIGHTING ; species type 2

	db 45 ; catch rate
	db 193 ; base exp yield
	db $77 ; sprite dimensions

	dw MachampPicFront
	dw MachampPicBack
	
	; attacks known at lvl 0
	db KARATE_CHOP
	db LOW_KICK
	db LEER
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %01000011
	db %00001111
	db %11001110
	db %10100110
	db %10001000
	db %00100010

	db 0 ; padding

BellsproutBaseStats: ; 38b4e (e:4b4e)
	db DEX_BELLSPROUT ; pokedex id
	db 50 ; base hp
	db 75 ; base attack
	db 35 ; base defense
	db 40 ; base speed
	db 70 ; base special

	db GRASS ; species type 1
	db POISON ; species type 2

	db 255 ; catch rate
	db 84 ; base exp yield
	db $55 ; sprite dimensions

	dw BellsproutPicFront
	dw BellsproutPicBack
	
	; attacks known at lvl 0
	db VINE_WHIP
	db GROWTH
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %00100100
	db %00000011
	db %00111000
	db %11000000
	db %00000011
	db %00001000
	db %00000110

	db 0 ; padding

WeepinbellBaseStats: ; 38b6a (e:4b6a)
	db DEX_WEEPINBELL ; pokedex id
	db 65 ; base hp
	db 90 ; base attack
	db 50 ; base defense
	db 55 ; base speed
	db 85 ; base special

	db GRASS ; species type 1
	db POISON ; species type 2

	db 120 ; catch rate
	db 151 ; base exp yield
	db $66 ; sprite dimensions

	dw WeepinbellPicFront
	dw WeepinbellPicBack
	
	; attacks known at lvl 0
	db VINE_WHIP
	db GROWTH
	db WRAP
	db 0

	db 3 ; growth rate
	
	; learnset
	db %00100100
	db %00000011
	db %00111000
	db %11000000
	db %00000011
	db %00001000
	db %00000110

	db 0 ; padding

VictreebelBaseStats: ; 38b86 (e:4b86)
	db DEX_VICTREEBEL ; pokedex id
	db 80 ; base hp
	db 105 ; base attack
	db 65 ; base defense
	db 70 ; base speed
	db 100 ; base special

	db GRASS ; species type 1
	db POISON ; species type 2

	db 45 ; catch rate
	db 191 ; base exp yield
	db $77 ; sprite dimensions

	dw VictreebelPicFront
	dw VictreebelPicBack
	
	; attacks known at lvl 0
	db SLEEP_POWDER
	db STUN_SPORE
	db ACID
	db RAZOR_LEAF

	db 3 ; growth rate
	
	; learnset
	db %10100100
	db %01000011
	db %00111000
	db %11000000
	db %00000011
	db %00001000
	db %00000110

	db 0 ; padding

TentacoolBaseStats: ; 38ba2 (e:4ba2)
	db DEX_TENTACOOL ; pokedex id
	db 40 ; base hp
	db 40 ; base attack
	db 35 ; base defense
	db 70 ; base speed
	db 100 ; base special

	db WATER ; species type 1
	db POISON ; species type 2

	db 190 ; catch rate
	db 105 ; base exp yield
	db $55 ; sprite dimensions

	dw TentacoolPicFront
	dw TentacoolPicBack
	
	; attacks known at lvl 0
	db ACID
	db 0
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00100100
	db %00111111
	db %00011000
	db %11000000
	db %10000011
	db %00001000
	db %00010110

	db 0 ; padding

TentacruelBaseStats: ; 38bbe (e:4bbe)
	db DEX_TENTACRUEL ; pokedex id
	db 80 ; base hp
	db 70 ; base attack
	db 65 ; base defense
	db 100 ; base speed
	db 120 ; base special

	db WATER ; species type 1
	db POISON ; species type 2

	db 60 ; catch rate
	db 205 ; base exp yield
	db $66 ; sprite dimensions

	dw TentacruelPicFront
	dw TentacruelPicBack
	
	; attacks known at lvl 0
	db ACID
	db SUPERSONIC
	db WRAP
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00100100
	db %01111111
	db %00011000
	db %11000000
	db %10000011
	db %00001000
	db %00010110

	db 0 ; padding

GeodudeBaseStats: ; 38bda (e:4bda)
	db DEX_GEODUDE ; pokedex id
	db 40 ; base hp
	db 80 ; base attack
	db 100 ; base defense
	db 20 ; base speed
	db 30 ; base special

	db ROCK ; species type 1
	db GROUND ; species type 2

	db 255 ; catch rate
	db 86 ; base exp yield
	db $55 ; sprite dimensions

	dw GeodudePicFront
	dw GeodudePicBack
	
	; attacks known at lvl 0
	db TACKLE
	db 0
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10100001
	db %00000011
	db %00001111
	db %11001110
	db %00101110
	db %11001000
	db %00100010

	db 0 ; padding

GravelerBaseStats: ; 38bf6 (e:4bf6)
	db DEX_GRAVELER ; pokedex id
	db 55 ; base hp
	db 95 ; base attack
	db 115 ; base defense
	db 35 ; base speed
	db 45 ; base special

	db ROCK ; species type 1
	db GROUND ; species type 2

	db 120 ; catch rate
	db 134 ; base exp yield
	db $66 ; sprite dimensions

	dw GravelerPicFront
	dw GravelerPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db DEFENSE_CURL
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10100001
	db %00000011
	db %00001111
	db %11001110
	db %00101110
	db %11001000
	db %00100010

	db 0 ; padding

GolemBaseStats: ; 38c12 (e:4c12)
	db DEX_GOLEM ; pokedex id
	db 80 ; base hp
	db 110 ; base attack
	db 130 ; base defense
	db 45 ; base speed
	db 55 ; base special

	db ROCK ; species type 1
	db GROUND ; species type 2

	db 45 ; catch rate
	db 177 ; base exp yield
	db $66 ; sprite dimensions

	dw GolemPicFront
	dw GolemPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db DEFENSE_CURL
	db 0
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %01000011
	db %00001111
	db %11001110
	db %00101110
	db %11001000
	db %00100010

	db 0 ; padding

PonytaBaseStats: ; 38c2e (e:4c2e)
	db DEX_PONYTA ; pokedex id
	db 50 ; base hp
	db 85 ; base attack
	db 55 ; base defense
	db 90 ; base speed
	db 65 ; base special

	db FIRE ; species type 1
	db FIRE ; species type 2

	db 190 ; catch rate
	db 152 ; base exp yield
	db $66 ; sprite dimensions

	dw PonytaPicFront
	dw PonytaPicBack
	
	; attacks known at lvl 0
	db EMBER
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %11100000
	db %00000011
	db %00001000
	db %11000000
	db %11100011
	db %00001000
	db %00000010

	db 0 ; padding

RapidashBaseStats: ; 38c4a (e:4c4a)
	db DEX_RAPIDASH ; pokedex id
	db 65 ; base hp
	db 100 ; base attack
	db 70 ; base defense
	db 105 ; base speed
	db 80 ; base special

	db FIRE ; species type 1
	db FIRE ; species type 2

	db 60 ; catch rate
	db 192 ; base exp yield
	db $77 ; sprite dimensions

	dw RapidashPicFront
	dw RapidashPicBack
	
	; attacks known at lvl 0
	db EMBER
	db TAIL_WHIP
	db STOMP
	db GROWL

	db 0 ; growth rate
	
	; learnset
	db %11100000
	db %01000011
	db %00001000
	db %11000000
	db %11100011
	db %00001000
	db %00000010

	db 0 ; padding

SlowpokeBaseStats: ; 38c66 (e:4c66)
	db DEX_SLOWPOKE ; pokedex id
	db 90 ; base hp
	db 65 ; base attack
	db 65 ; base defense
	db 15 ; base speed
	db 40 ; base special

	db WATER ; species type 1
	db PSYCHIC ; species type 2

	db 190 ; catch rate
	db 99 ; base exp yield
	db $55 ; sprite dimensions

	dw SlowpokePicFront
	dw SlowpokePicBack
	
	; attacks known at lvl 0
	db CONFUSION
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %10111111
	db %00001000
	db %11111110
	db %11100011
	db %00111000
	db %01110011

	db 0 ; padding

SlowbroBaseStats: ; 38c82 (e:4c82)
	db DEX_SLOWBRO ; pokedex id
	db 95 ; base hp
	db 75 ; base attack
	db 110 ; base defense
	db 30 ; base speed
	db 80 ; base special

	db WATER ; species type 1
	db PSYCHIC ; species type 2

	db 75 ; catch rate
	db 164 ; base exp yield
	db $77 ; sprite dimensions

	dw SlowbroPicFront
	dw SlowbroPicBack
	
	; attacks known at lvl 0
	db CONFUSION
	db DISABLE
	db HEADBUTT
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %11111111
	db %00001111
	db %11111110
	db %11100011
	db %00111000
	db %01110011

	db 0 ; padding

MagnemiteBaseStats: ; 38c9e (e:4c9e)
	db DEX_MAGNEMITE ; pokedex id
	db 25 ; base hp
	db 35 ; base attack
	db 70 ; base defense
	db 45 ; base speed
	db 95 ; base special

	db ELECTRIC ; species type 1
	db ELECTRIC ; species type 2

	db 190 ; catch rate
	db 89 ; base exp yield
	db $55 ; sprite dimensions

	dw MagnemitePicFront
	dw MagnemitePicBack
	
	; attacks known at lvl 0
	db TACKLE
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100000
	db %00000011
	db %10001000
	db %11100001
	db %01000011
	db %00011000
	db %01000010

	db 0 ; padding

MagnetonBaseStats: ; 38cba (e:4cba)
	db DEX_MAGNETON ; pokedex id
	db 50 ; base hp
	db 60 ; base attack
	db 95 ; base defense
	db 70 ; base speed
	db 120 ; base special

	db ELECTRIC ; species type 1
	db ELECTRIC ; species type 2

	db 60 ; catch rate
	db 161 ; base exp yield
	db $66 ; sprite dimensions

	dw MagnetonPicFront
	dw MagnetonPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SONICBOOM
	db THUNDERSHOCK
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100000
	db %01000011
	db %10001000
	db %11100001
	db %01000011
	db %00011000
	db %01000010

	db 0 ; padding

FarfetchdBaseStats: ; 38cd6 (e:4cd6)
	db DEX_FARFETCH_D ; pokedex id
	db 52 ; base hp
	db 65 ; base attack
	db 55 ; base defense
	db 60 ; base speed
	db 58 ; base special

	db NORMAL ; species type 1
	db FLYING ; species type 2

	db 45 ; catch rate
	db 94 ; base exp yield
	db $66 ; sprite dimensions

	dw FarfetchdPicFront
	dw FarfetchdPicBack
	
	; attacks known at lvl 0
	db PECK
	db SAND_ATTACK
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10101110
	db %00000011
	db %00001000
	db %11000000
	db %11000011
	db %00001000
	db %00001110

	db 0 ; padding

DoduoBaseStats: ; 38cf2 (e:4cf2)
	db DEX_DODUO ; pokedex id
	db 35 ; base hp
	db 85 ; base attack
	db 45 ; base defense
	db 75 ; base speed
	db 35 ; base special

	db NORMAL ; species type 1
	db FLYING ; species type 2

	db 190 ; catch rate
	db 96 ; base exp yield
	db $55 ; sprite dimensions

	dw DoduoPicFront
	dw DoduoPicBack
	
	; attacks known at lvl 0
	db PECK
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10101000
	db %00000011
	db %00001000
	db %11000000
	db %10000011
	db %00001100
	db %00001011

	db 0 ; padding

DodrioBaseStats: ; 38d0e (e:4d0e)
	db DEX_DODRIO ; pokedex id
	db 60 ; base hp
	db 110 ; base attack
	db 70 ; base defense
	db 100 ; base speed
	db 60 ; base special

	db NORMAL ; species type 1
	db FLYING ; species type 2

	db 45 ; catch rate
	db 158 ; base exp yield
	db $77 ; sprite dimensions

	dw DodrioPicFront
	dw DodrioPicBack
	
	; attacks known at lvl 0
	db PECK
	db GROWL
	db FURY_ATTACK
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10101000
	db %01000011
	db %00001000
	db %11000000
	db %10000011
	db %00001100
	db %00001011

	db 0 ; padding

SeelBaseStats: ; 38d2a (e:4d2a)
	db DEX_SEEL ; pokedex id
	db 65 ; base hp
	db 45 ; base attack
	db 55 ; base defense
	db 45 ; base speed
	db 70 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 190 ; catch rate
	db 100 ; base exp yield
	db $66 ; sprite dimensions

	dw SeelPicFront
	dw SeelPicBack
	
	; attacks known at lvl 0
	db HEADBUTT
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %11100000
	db %10111111
	db %00001000
	db %11000000
	db %10000010
	db %00001000
	db %00110010

	db 0 ; padding

DewgongBaseStats: ; 38d46 (e:4d46)
	db DEX_DEWGONG ; pokedex id
	db 90 ; base hp
	db 70 ; base attack
	db 80 ; base defense
	db 70 ; base speed
	db 95 ; base special

	db WATER ; species type 1
	db ICE ; species type 2

	db 75 ; catch rate
	db 176 ; base exp yield
	db $66 ; sprite dimensions

	dw DewgongPicFront
	dw DewgongPicBack
	
	; attacks known at lvl 0
	db HEADBUTT
	db GROWL
	db AURORA_BEAM
	db 0

	db 0 ; growth rate
	
	; learnset
	db %11100000
	db %11111111
	db %00001000
	db %11000000
	db %10000010
	db %00001000
	db %00110010

	db 0 ; padding

GrimerBaseStats: ; 38d62 (e:4d62)
	db DEX_GRIMER ; pokedex id
	db 80 ; base hp
	db 80 ; base attack
	db 50 ; base defense
	db 25 ; base speed
	db 40 ; base special

	db POISON ; species type 1
	db POISON ; species type 2

	db 190 ; catch rate
	db 90 ; base exp yield
	db $55 ; sprite dimensions

	dw GrimerPicFront
	dw GrimerPicBack
	
	; attacks known at lvl 0
	db POUND
	db DISABLE
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %00000000
	db %10011000
	db %11000001
	db %00101010
	db %01001000
	db %00000010

	db 0 ; padding

MukBaseStats: ; 38d7e (e:4d7e)
	db DEX_MUK ; pokedex id
	db 105 ; base hp
	db 105 ; base attack
	db 75 ; base defense
	db 50 ; base speed
	db 65 ; base special

	db POISON ; species type 1
	db POISON ; species type 2

	db 75 ; catch rate
	db 157 ; base exp yield
	db $77 ; sprite dimensions

	dw MukPicFront
	dw MukPicBack
	
	; attacks known at lvl 0
	db POUND
	db DISABLE
	db POISON_GAS
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %01000000
	db %10011000
	db %11000001
	db %00101010
	db %01001000
	db %00000010

	db 0 ; padding

ShellderBaseStats: ; 38d9a (e:4d9a)
	db DEX_SHELLDER ; pokedex id
	db 30 ; base hp
	db 65 ; base attack
	db 100 ; base defense
	db 40 ; base speed
	db 45 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 190 ; catch rate
	db 97 ; base exp yield
	db $55 ; sprite dimensions

	dw ShellderPicFront
	dw ShellderPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db WITHDRAW
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00100000
	db %00111111
	db %00001000
	db %11100000
	db %01001011
	db %01001000
	db %00010011

	db 0 ; padding

CloysterBaseStats: ; 38db6 (e:4db6)
	db DEX_CLOYSTER ; pokedex id
	db 50 ; base hp
	db 95 ; base attack
	db 180 ; base defense
	db 70 ; base speed
	db 85 ; base special

	db WATER ; species type 1
	db ICE ; species type 2

	db 60 ; catch rate
	db 203 ; base exp yield
	db $77 ; sprite dimensions

	dw CloysterPicFront
	dw CloysterPicBack
	
	; attacks known at lvl 0
	db WITHDRAW
	db SUPERSONIC
	db CLAMP
	db AURORA_BEAM

	db 5 ; growth rate
	
	; learnset
	db %00100000
	db %01111111
	db %00001000
	db %11100000
	db %01001011
	db %01001000
	db %00010011

	db 0 ; padding

GastlyBaseStats: ; 38dd2 (e:4dd2)
	db DEX_GASTLY ; pokedex id
	db 30 ; base hp
	db 35 ; base attack
	db 30 ; base defense
	db 80 ; base speed
	db 100 ; base special

	db GHOST ; species type 1
	db POISON ; species type 2

	db 190 ; catch rate
	db 95 ; base exp yield
	db $77 ; sprite dimensions

	dw GastlyPicFront
	dw GastlyPicBack
	
	; attacks known at lvl 0
	db LICK
	db CONFUSE_RAY
	db NIGHT_SHADE
	db 0

	db 3 ; growth rate
	
	; learnset
	db %00100000
	db %00000000
	db %10011000
	db %11010001
	db %00001010
	db %01101010
	db %00000010

	db 0 ; padding

HaunterBaseStats: ; 38dee (e:4dee)
	db DEX_HAUNTER ; pokedex id
	db 45 ; base hp
	db 50 ; base attack
	db 45 ; base defense
	db 95 ; base speed
	db 115 ; base special

	db GHOST ; species type 1
	db POISON ; species type 2

	db 90 ; catch rate
	db 126 ; base exp yield
	db $66 ; sprite dimensions

	dw HaunterPicFront
	dw HaunterPicBack
	
	; attacks known at lvl 0
	db LICK
	db CONFUSE_RAY
	db NIGHT_SHADE
	db 0

	db 3 ; growth rate
	
	; learnset
	db %00100000
	db %00000000
	db %10011000
	db %11010001
	db %00001010
	db %01101010
	db %00000010

	db 0 ; padding

GengarBaseStats: ; 38e0a (e:4e0a)
	db DEX_GENGAR ; pokedex id
	db 60 ; base hp
	db 65 ; base attack
	db 60 ; base defense
	db 110 ; base speed
	db 130 ; base special

	db GHOST ; species type 1
	db POISON ; species type 2

	db 45 ; catch rate
	db 190 ; base exp yield
	db $66 ; sprite dimensions

	dw GengarPicFront
	dw GengarPicBack
	
	; attacks known at lvl 0
	db LICK
	db CONFUSE_RAY
	db NIGHT_SHADE
	db 0

	db 3 ; growth rate
	
	; learnset
	db %10110001
	db %01000011
	db %10011111
	db %11010001
	db %10001110
	db %01101010
	db %00100010

	db 0 ; padding

OnixBaseStats: ; 38e26 (e:4e26)
	db DEX_ONIX ; pokedex id
	db 35 ; base hp
	db 45 ; base attack
	db 160 ; base defense
	db 70 ; base speed
	db 30 ; base special

	db ROCK ; species type 1
	db GROUND ; species type 2

	db 45 ; catch rate
	db 108 ; base exp yield
	db $77 ; sprite dimensions

	dw OnixPicFront
	dw OnixPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SCREECH
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %00000011
	db %00001000
	db %11001110
	db %10001010
	db %11001000
	db %00100010

	db 0 ; padding

DrowzeeBaseStats: ; 38e42 (e:4e42)
	db DEX_DROWZEE ; pokedex id
	db 60 ; base hp
	db 48 ; base attack
	db 45 ; base defense
	db 42 ; base speed
	db 90 ; base special

	db PSYCHIC ; species type 1
	db PSYCHIC ; species type 2

	db 190 ; catch rate
	db 102 ; base exp yield
	db $66 ; sprite dimensions

	dw DrowzeePicFront
	dw DrowzeePicBack
	
	; attacks known at lvl 0
	db POUND
	db HYPNOSIS
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %00000011
	db %00001111
	db %11110000
	db %10000111
	db %00111010
	db %01000011

	db 0 ; padding

HypnoBaseStats: ; 38e5e (e:4e5e)
	db DEX_HYPNO ; pokedex id
	db 85 ; base hp
	db 73 ; base attack
	db 70 ; base defense
	db 67 ; base speed
	db 115 ; base special

	db PSYCHIC ; species type 1
	db PSYCHIC ; species type 2

	db 75 ; catch rate
	db 165 ; base exp yield
	db $77 ; sprite dimensions

	dw HypnoPicFront
	dw HypnoPicBack
	
	; attacks known at lvl 0
	db POUND
	db HYPNOSIS
	db DISABLE
	db CONFUSION

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %01000011
	db %00001111
	db %11110000
	db %10000111
	db %00111010
	db %01000011

	db 0 ; padding

KrabbyBaseStats: ; 38e7a (e:4e7a)
	db DEX_KRABBY ; pokedex id
	db 30 ; base hp
	db 105 ; base attack
	db 90 ; base defense
	db 50 ; base speed
	db 25 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 225 ; catch rate
	db 115 ; base exp yield
	db $55 ; sprite dimensions

	dw KrabbyPicFront
	dw KrabbyPicBack
	
	; attacks known at lvl 0
	db BUBBLE
	db LEER
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100100
	db %00111111
	db %00001000
	db %11000000
	db %00000010
	db %00001000
	db %00110110

	db 0 ; padding

KinglerBaseStats: ; 38e96 (e:4e96)
	db DEX_KINGLER ; pokedex id
	db 55 ; base hp
	db 130 ; base attack
	db 115 ; base defense
	db 75 ; base speed
	db 50 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 60 ; catch rate
	db 206 ; base exp yield
	db $77 ; sprite dimensions

	dw KinglerPicFront
	dw KinglerPicBack
	
	; attacks known at lvl 0
	db BUBBLE
	db LEER
	db VICEGRIP
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100100
	db %01111111
	db %00001000
	db %11000000
	db %00000010
	db %00001000
	db %00110110

	db 0 ; padding

VoltorbBaseStats: ; 38eb2 (e:4eb2)
	db DEX_VOLTORB ; pokedex id
	db 40 ; base hp
	db 30 ; base attack
	db 50 ; base defense
	db 100 ; base speed
	db 55 ; base special

	db ELECTRIC ; species type 1
	db ELECTRIC ; species type 2

	db 190 ; catch rate
	db 103 ; base exp yield
	db $55 ; sprite dimensions

	dw VoltorbPicFront
	dw VoltorbPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SCREECH
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100000
	db %00000001
	db %10001000
	db %11100001
	db %01001011
	db %01011000
	db %01000010

	db 0 ; padding

ElectrodeBaseStats: ; 38ece (e:4ece)
	db DEX_ELECTRODE ; pokedex id
	db 60 ; base hp
	db 50 ; base attack
	db 70 ; base defense
	db 140 ; base speed
	db 80 ; base special

	db ELECTRIC ; species type 1
	db ELECTRIC ; species type 2

	db 60 ; catch rate
	db 150 ; base exp yield
	db $55 ; sprite dimensions

	dw ElectrodePicFront
	dw ElectrodePicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SCREECH
	db SONICBOOM
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100000
	db %01000001
	db %10001000
	db %11100001
	db %11001011
	db %01011000
	db %01000010

	db 0 ; padding

ExeggcuteBaseStats: ; 38eea (e:4eea)
	db DEX_EXEGGCUTE ; pokedex id
	db 60 ; base hp
	db 40 ; base attack
	db 80 ; base defense
	db 40 ; base speed
	db 60 ; base special

	db GRASS ; species type 1
	db PSYCHIC ; species type 2

	db 90 ; catch rate
	db 98 ; base exp yield
	db $77 ; sprite dimensions

	dw ExeggcutePicFront
	dw ExeggcutePicBack
	
	; attacks known at lvl 0
	db BARRAGE
	db HYPNOSIS
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00100000
	db %00000011
	db %00001000
	db %11110000
	db %00011011
	db %01101000
	db %00000010

	db 0 ; padding

ExeggutorBaseStats: ; 38f06 (e:4f06)
	db DEX_EXEGGUTOR ; pokedex id
	db 95 ; base hp
	db 95 ; base attack
	db 85 ; base defense
	db 55 ; base speed
	db 125 ; base special

	db GRASS ; species type 1
	db PSYCHIC ; species type 2

	db 45 ; catch rate
	db 212 ; base exp yield
	db $77 ; sprite dimensions

	dw ExeggutorPicFront
	dw ExeggutorPicBack
	
	; attacks known at lvl 0
	db BARRAGE
	db HYPNOSIS
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00100000
	db %01000011
	db %00111000
	db %11110000
	db %00011011
	db %01101000
	db %00100010

	db 0 ; padding

CuboneBaseStats: ; 38f22 (e:4f22)
	db DEX_CUBONE ; pokedex id
	db 50 ; base hp
	db 50 ; base attack
	db 95 ; base defense
	db 35 ; base speed
	db 40 ; base special

	db GROUND ; species type 1
	db GROUND ; species type 2

	db 190 ; catch rate
	db 87 ; base exp yield
	db $55 ; sprite dimensions

	dw CubonePicFront
	dw CubonePicBack
	
	; attacks known at lvl 0
	db BONE_CLUB
	db GROWL
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %00111111
	db %00001111
	db %11001110
	db %10100010
	db %00001000
	db %00100010

	db 0 ; padding

MarowakBaseStats: ; 38f3e (e:4f3e)
	db DEX_MAROWAK ; pokedex id
	db 60 ; base hp
	db 80 ; base attack
	db 110 ; base defense
	db 45 ; base speed
	db 50 ; base special

	db GROUND ; species type 1
	db GROUND ; species type 2

	db 75 ; catch rate
	db 124 ; base exp yield
	db $66 ; sprite dimensions

	dw MarowakPicFront
	dw MarowakPicBack
	
	; attacks known at lvl 0
	db BONE_CLUB
	db GROWL
	db LEER
	db FOCUS_ENERGY

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %01111111
	db %00001111
	db %11001110
	db %10100010
	db %00001000
	db %00100010

	db 0 ; padding

HitmonleeBaseStats: ; 38f5a (e:4f5a)
	db DEX_HITMONLEE ; pokedex id
	db 50 ; base hp
	db 120 ; base attack
	db 53 ; base defense
	db 87 ; base speed
	db 35 ; base special

	db FIGHTING ; species type 1
	db FIGHTING ; species type 2

	db 45 ; catch rate
	db 139 ; base exp yield
	db $77 ; sprite dimensions

	dw HitmonleePicFront
	dw HitmonleePicBack
	
	; attacks known at lvl 0
	db DOUBLE_KICK
	db MEDITATE
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %00000011
	db %00001111
	db %11000000
	db %11000110
	db %00001000
	db %00100010

	db 0 ; padding

HitmonchanBaseStats: ; 38f76 (e:4f76)
	db DEX_HITMONCHAN ; pokedex id
	db 50 ; base hp
	db 105 ; base attack
	db 79 ; base defense
	db 76 ; base speed
	db 35 ; base special

	db FIGHTING ; species type 1
	db FIGHTING ; species type 2

	db 45 ; catch rate
	db 140 ; base exp yield
	db $66 ; sprite dimensions

	dw HitmonchanPicFront
	dw HitmonchanPicBack
	
	; attacks known at lvl 0
	db COMET_PUNCH
	db AGILITY
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %00000011
	db %00001111
	db %11000000
	db %11000110
	db %00001000
	db %00100010

	db 0 ; padding

LickitungBaseStats: ; 38f92 (e:4f92)
	db DEX_LICKITUNG ; pokedex id
	db 90 ; base hp
	db 55 ; base attack
	db 75 ; base defense
	db 30 ; base speed
	db 60 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 45 ; catch rate
	db 127 ; base exp yield
	db $77 ; sprite dimensions

	dw LickitungPicFront
	dw LickitungPicBack
	
	; attacks known at lvl 0
	db WRAP
	db SUPERSONIC
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110101
	db %01111111
	db %10001111
	db %11000111
	db %10100010
	db %00001000
	db %00110110

	db 0 ; padding

KoffingBaseStats: ; 38fae (e:4fae)
	db DEX_KOFFING ; pokedex id
	db 40 ; base hp
	db 65 ; base attack
	db 95 ; base defense
	db 35 ; base speed
	db 60 ; base special

	db POISON ; species type 1
	db POISON ; species type 2

	db 190 ; catch rate
	db 114 ; base exp yield
	db $66 ; sprite dimensions

	dw KoffingPicFront
	dw KoffingPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SMOG
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100000
	db %00000000
	db %10001000
	db %11000001
	db %00101010
	db %01001000
	db %00000010

	db 0 ; padding

WeezingBaseStats: ; 38fca (e:4fca)
	db DEX_WEEZING ; pokedex id
	db 65 ; base hp
	db 90 ; base attack
	db 120 ; base defense
	db 60 ; base speed
	db 85 ; base special

	db POISON ; species type 1
	db POISON ; species type 2

	db 60 ; catch rate
	db 173 ; base exp yield
	db $77 ; sprite dimensions

	dw WeezingPicFront
	dw WeezingPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SMOG
	db SLUDGE
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100000
	db %01000000
	db %10001000
	db %11000001
	db %00101010
	db %01001000
	db %00000010

	db 0 ; padding

RhyhornBaseStats: ; 38fe6 (e:4fe6)
	db DEX_RHYHORN ; pokedex id
	db 80 ; base hp
	db 85 ; base attack
	db 95 ; base defense
	db 25 ; base speed
	db 30 ; base special

	db GROUND ; species type 1
	db ROCK ; species type 2

	db 120 ; catch rate
	db 135 ; base exp yield
	db $77 ; sprite dimensions

	dw RhyhornPicFront
	dw RhyhornPicBack
	
	; attacks known at lvl 0
	db HORN_ATTACK
	db 0
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %11100000
	db %00000011
	db %10001000
	db %11001111
	db %10100010
	db %10001000
	db %00100010

	db 0 ; padding

RhydonBaseStats: ; 39002 (e:5002)
	db DEX_RHYDON ; pokedex id
	db 105 ; base hp
	db 130 ; base attack
	db 120 ; base defense
	db 40 ; base speed
	db 45 ; base special

	db GROUND ; species type 1
	db ROCK ; species type 2

	db 60 ; catch rate
	db 204 ; base exp yield
	db $77 ; sprite dimensions

	dw RhydonPicFront
	dw RhydonPicBack
	
	; attacks known at lvl 0
	db HORN_ATTACK
	db STOMP
	db TAIL_WHIP
	db FURY_ATTACK

	db 5 ; growth rate
	
	; learnset
	db %11110001
	db %11111111
	db %10001111
	db %11001111
	db %10100010
	db %10001000
	db %00110010

	db 0 ; padding

ChanseyBaseStats: ; 3901e (e:501e)
	db DEX_CHANSEY ; pokedex id
	db 250 ; base hp
	db 5 ; base attack
	db 5 ; base defense
	db 50 ; base speed
	db 105 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 30 ; catch rate
	db 255 ; base exp yield
	db $66 ; sprite dimensions

	dw ChanseyPicFront
	dw ChanseyPicBack
	
	; attacks known at lvl 0
	db POUND
	db DOUBLESLAP
	db 0
	db 0

	db 4 ; growth rate
	
	; learnset
	db %10110001
	db %01111111
	db %10101111
	db %11110001
	db %10110111
	db %00111001
	db %01100011

	db 0 ; padding

TangelaBaseStats: ; 3903a (e:503a)
	db DEX_TANGELA ; pokedex id
	db 65 ; base hp
	db 55 ; base attack
	db 115 ; base defense
	db 60 ; base speed
	db 100 ; base special

	db GRASS ; species type 1
	db GRASS ; species type 2

	db 45 ; catch rate
	db 166 ; base exp yield
	db $66 ; sprite dimensions

	dw TangelaPicFront
	dw TangelaPicBack
	
	; attacks known at lvl 0
	db CONSTRICT
	db BIND
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100100
	db %01000011
	db %00111000
	db %11000000
	db %10000010
	db %00001000
	db %00000110

	db 0 ; padding

KangaskhanBaseStats: ; 39056 (e:5056)
	db DEX_KANGASKHAN ; pokedex id
	db 105 ; base hp
	db 95 ; base attack
	db 80 ; base defense
	db 90 ; base speed
	db 40 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 45 ; catch rate
	db 175 ; base exp yield
	db $77 ; sprite dimensions

	dw KangaskhanPicFront
	dw KangaskhanPicBack
	
	; attacks known at lvl 0
	db COMET_PUNCH
	db RAGE
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %01111111
	db %10001111
	db %11000111
	db %10100010
	db %10001000
	db %00110010

	db 0 ; padding

HorseaBaseStats: ; 39072 (e:5072)
	db DEX_HORSEA ; pokedex id
	db 30 ; base hp
	db 40 ; base attack
	db 70 ; base defense
	db 60 ; base speed
	db 70 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 225 ; catch rate
	db 83 ; base exp yield
	db $55 ; sprite dimensions

	dw HorseaPicFront
	dw HorseaPicBack
	
	; attacks known at lvl 0
	db BUBBLE
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100000
	db %00111111
	db %00001000
	db %11000000
	db %11000010
	db %00001000
	db %00010010

	db 0 ; padding

SeadraBaseStats: ; 3908e (e:508e)
	db DEX_SEADRA ; pokedex id
	db 55 ; base hp
	db 65 ; base attack
	db 95 ; base defense
	db 85 ; base speed
	db 95 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 75 ; catch rate
	db 155 ; base exp yield
	db $66 ; sprite dimensions

	dw SeadraPicFront
	dw SeadraPicBack
	
	; attacks known at lvl 0
	db BUBBLE
	db SMOKESCREEN
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100000
	db %01111111
	db %00001000
	db %11000000
	db %11000010
	db %00001000
	db %00010010

	db 0 ; padding

GoldeenBaseStats: ; 390aa (e:50aa)
	db DEX_GOLDEEN ; pokedex id
	db 45 ; base hp
	db 67 ; base attack
	db 60 ; base defense
	db 63 ; base speed
	db 50 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 225 ; catch rate
	db 111 ; base exp yield
	db $66 ; sprite dimensions

	dw GoldeenPicFront
	dw GoldeenPicBack
	
	; attacks known at lvl 0
	db PECK
	db TAIL_WHIP
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %01100000
	db %00111111
	db %00001000
	db %11000000
	db %11000010
	db %00001000
	db %00010010

	db 0 ; padding

SeakingBaseStats: ; 390c6 (e:50c6)
	db DEX_SEAKING ; pokedex id
	db 80 ; base hp
	db 92 ; base attack
	db 65 ; base defense
	db 68 ; base speed
	db 80 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 60 ; catch rate
	db 170 ; base exp yield
	db $77 ; sprite dimensions

	dw SeakingPicFront
	dw SeakingPicBack
	
	; attacks known at lvl 0
	db PECK
	db TAIL_WHIP
	db SUPERSONIC
	db 0

	db 0 ; growth rate
	
	; learnset
	db %01100000
	db %01111111
	db %00001000
	db %11000000
	db %11000010
	db %00001000
	db %00010010

	db 0 ; padding

StaryuBaseStats: ; 390e2 (e:50e2)
	db DEX_STARYU ; pokedex id
	db 30 ; base hp
	db 45 ; base attack
	db 55 ; base defense
	db 85 ; base speed
	db 70 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 225 ; catch rate
	db 106 ; base exp yield
	db $66 ; sprite dimensions

	dw StaryuPicFront
	dw StaryuPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db 0
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00100000
	db %00111111
	db %10001000
	db %11110001
	db %11000011
	db %00111000
	db %01010011

	db 0 ; padding

StarmieBaseStats: ; 390fe (e:50fe)
	db DEX_STARMIE ; pokedex id
	db 60 ; base hp
	db 75 ; base attack
	db 85 ; base defense
	db 115 ; base speed
	db 100 ; base special

	db WATER ; species type 1
	db PSYCHIC ; species type 2

	db 60 ; catch rate
	db 207 ; base exp yield
	db $66 ; sprite dimensions

	dw StarmiePicFront
	dw StarmiePicBack
	
	; attacks known at lvl 0
	db TACKLE
	db WATER_GUN
	db HARDEN
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00100000
	db %01111111
	db %10001000
	db %11110001
	db %11000011
	db %00111000
	db %01010011

	db 0 ; padding

MrMimeBaseStats: ; 3911a (e:511a)
	db DEX_MR_MIME ; pokedex id
	db 40 ; base hp
	db 45 ; base attack
	db 65 ; base defense
	db 90 ; base speed
	db 100 ; base special

	db PSYCHIC ; species type 1
	db PSYCHIC ; species type 2

	db 45 ; catch rate
	db 136 ; base exp yield
	db $66 ; sprite dimensions

	dw MrMimePicFront
	dw MrMimePicBack
	
	; attacks known at lvl 0
	db CONFUSION
	db BARRIER
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %01000011
	db %10101111
	db %11110001
	db %10000111
	db %00111000
	db %01000010

	db 0 ; padding

ScytherBaseStats: ; 39136 (e:5136)
	db DEX_SCYTHER ; pokedex id
	db 70 ; base hp
	db 110 ; base attack
	db 80 ; base defense
	db 105 ; base speed
	db 55 ; base special

	db BUG ; species type 1
	db FLYING ; species type 2

	db 45 ; catch rate
	db 187 ; base exp yield
	db $77 ; sprite dimensions

	dw ScytherPicFront
	dw ScytherPicBack
	
	; attacks known at lvl 0
	db QUICK_ATTACK
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100100
	db %01000011
	db %00001000
	db %11000000
	db %11000010
	db %00001000
	db %00000110

	db 0 ; padding

JynxBaseStats: ; 39152 (e:5152)
	db DEX_JYNX ; pokedex id
	db 65 ; base hp
	db 50 ; base attack
	db 35 ; base defense
	db 95 ; base speed
	db 95 ; base special

	db ICE ; species type 1
	db PSYCHIC ; species type 2

	db 45 ; catch rate
	db 137 ; base exp yield
	db $66 ; sprite dimensions

	dw JynxPicFront
	dw JynxPicBack
	
	; attacks known at lvl 0
	db POUND
	db LOVELY_KISS
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %01111111
	db %00001111
	db %11110000
	db %10000111
	db %00101000
	db %00000010

	db 0 ; padding

ElectabuzzBaseStats: ; 3916e (e:516e)
	db DEX_ELECTABUZZ ; pokedex id
	db 65 ; base hp
	db 83 ; base attack
	db 57 ; base defense
	db 105 ; base speed
	db 85 ; base special

	db ELECTRIC ; species type 1
	db ELECTRIC ; species type 2

	db 45 ; catch rate
	db 156 ; base exp yield
	db $66 ; sprite dimensions

	dw ElectabuzzPicFront
	dw ElectabuzzPicBack
	
	; attacks known at lvl 0
	db QUICK_ATTACK
	db LEER
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %01000011
	db %10001111
	db %11110001
	db %11000111
	db %00111000
	db %01100010

	db 0 ; padding

MagmarBaseStats: ; 3918a (e:518a)
	db DEX_MAGMAR ; pokedex id
	db 65 ; base hp
	db 95 ; base attack
	db 57 ; base defense
	db 93 ; base speed
	db 85 ; base special

	db FIRE ; species type 1
	db FIRE ; species type 2

	db 45 ; catch rate
	db 167 ; base exp yield
	db $66 ; sprite dimensions

	dw MagmarPicFront
	dw MagmarPicBack
	
	; attacks known at lvl 0
	db EMBER
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110001
	db %01000011
	db %00001111
	db %11110000
	db %10100110
	db %00101000
	db %00100010

	db 0 ; padding

PinsirBaseStats: ; 391a6 (e:51a6)
	db DEX_PINSIR ; pokedex id
	db 65 ; base hp
	db 125 ; base attack
	db 100 ; base defense
	db 85 ; base speed
	db 55 ; base special

	db BUG ; species type 1
	db BUG ; species type 2

	db 45 ; catch rate
	db 200 ; base exp yield
	db $77 ; sprite dimensions

	dw PinsirPicFront
	dw PinsirPicBack
	
	; attacks known at lvl 0
	db VICEGRIP
	db 0
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %10100100
	db %01000011
	db %00001101
	db %11000000
	db %00000010
	db %00001000
	db %00100110

	db 0 ; padding

TaurosBaseStats: ; 391c2 (e:51c2)
	db DEX_TAUROS ; pokedex id
	db 75 ; base hp
	db 100 ; base attack
	db 95 ; base defense
	db 110 ; base speed
	db 70 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 45 ; catch rate
	db 211 ; base exp yield
	db $77 ; sprite dimensions

	dw TaurosPicFront
	dw TaurosPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db 0
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %11100000
	db %01110011
	db %10001000
	db %11000111
	db %10100010
	db %00001000
	db %00100010

	db 0 ; padding

MagikarpBaseStats: ; 391de (e:51de)
	db DEX_MAGIKARP ; pokedex id
	db 20 ; base hp
	db 10 ; base attack
	db 55 ; base defense
	db 80 ; base speed
	db 20 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 255 ; catch rate
	db 20 ; base exp yield
	db $66 ; sprite dimensions

	dw MagikarpPicFront
	dw MagikarpPicBack
	
	; attacks known at lvl 0
	db SPLASH
	db 0
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000

	db 0 ; padding

GyaradosBaseStats: ; 391fa (e:51fa)
	db DEX_GYARADOS ; pokedex id
	db 95 ; base hp
	db 125 ; base attack
	db 79 ; base defense
	db 81 ; base speed
	db 100 ; base special

	db WATER ; species type 1
	db FLYING ; species type 2

	db 45 ; catch rate
	db 214 ; base exp yield
	db $77 ; sprite dimensions

	dw GyaradosPicFront
	dw GyaradosPicBack
	
	; attacks known at lvl 0
	db BITE
	db DRAGON_RAGE
	db LEER
	db HYDRO_PUMP

	db 5 ; growth rate
	
	; learnset
	db %10100000
	db %01111111
	db %11001000
	db %11000001
	db %10100011
	db %00001000
	db %00110010

	db 0 ; padding

LaprasBaseStats: ; 39216 (e:5216)
	db DEX_LAPRAS ; pokedex id
	db 130 ; base hp
	db 85 ; base attack
	db 80 ; base defense
	db 60 ; base speed
	db 95 ; base special

	db WATER ; species type 1
	db ICE ; species type 2

	db 45 ; catch rate
	db 219 ; base exp yield
	db $77 ; sprite dimensions

	dw LaprasPicFront
	dw LaprasPicBack
	
	; attacks known at lvl 0
	db WATER_GUN
	db GROWL
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %11100000
	db %01111111
	db %11101000
	db %11010001
	db %10000011
	db %00101000
	db %00110010

	db 0 ; padding

DittoBaseStats: ; 39232 (e:5232)
	db DEX_DITTO ; pokedex id
	db 48 ; base hp
	db 48 ; base attack
	db 48 ; base defense
	db 48 ; base speed
	db 48 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 35 ; catch rate
	db 61 ; base exp yield
	db $55 ; sprite dimensions

	dw DittoPicFront
	dw DittoPicBack
	
	; attacks known at lvl 0
	db TRANSFORM
	db 0
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000
	db %00000000

	db 0 ; padding

EeveeBaseStats: ; 3924e (e:524e)
	db DEX_EEVEE ; pokedex id
	db 55 ; base hp
	db 55 ; base attack
	db 50 ; base defense
	db 55 ; base speed
	db 65 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 45 ; catch rate
	db 92 ; base exp yield
	db $55 ; sprite dimensions

	dw EeveePicFront
	dw EeveePicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SAND_ATTACK
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %00000011
	db %00001000
	db %11000000
	db %11000011
	db %00001000
	db %00000010

	db 0 ; padding

VaporeonBaseStats: ; 3926a (e:526a)
	db DEX_VAPOREON ; pokedex id
	db 130 ; base hp
	db 65 ; base attack
	db 60 ; base defense
	db 65 ; base speed
	db 110 ; base special

	db WATER ; species type 1
	db WATER ; species type 2

	db 45 ; catch rate
	db 196 ; base exp yield
	db $66 ; sprite dimensions

	dw VaporeonPicFront
	dw VaporeonPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SAND_ATTACK
	db QUICK_ATTACK
	db WATER_GUN

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %01111111
	db %00001000
	db %11000000
	db %11000011
	db %00001000
	db %00010010

	db 0 ; padding

JolteonBaseStats: ; 39286 (e:5286)
	db DEX_JOLTEON ; pokedex id
	db 65 ; base hp
	db 65 ; base attack
	db 60 ; base defense
	db 130 ; base speed
	db 110 ; base special

	db ELECTRIC ; species type 1
	db ELECTRIC ; species type 2

	db 45 ; catch rate
	db 197 ; base exp yield
	db $66 ; sprite dimensions

	dw JolteonPicFront
	dw JolteonPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SAND_ATTACK
	db QUICK_ATTACK
	db THUNDERSHOCK

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %01000011
	db %10001000
	db %11000001
	db %11000011
	db %00011000
	db %01000010

	db 0 ; padding

FlareonBaseStats: ; 392a2 (e:52a2)
	db DEX_FLAREON ; pokedex id
	db 65 ; base hp
	db 130 ; base attack
	db 60 ; base defense
	db 65 ; base speed
	db 110 ; base special

	db FIRE ; species type 1
	db FIRE ; species type 2

	db 45 ; catch rate
	db 198 ; base exp yield
	db $66 ; sprite dimensions

	dw FlareonPicFront
	dw FlareonPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SAND_ATTACK
	db QUICK_ATTACK
	db EMBER

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %01000011
	db %00001000
	db %11000000
	db %11100011
	db %00001000
	db %00000010

	db 0 ; padding

PorygonBaseStats: ; 392be (e:52be)
	db DEX_PORYGON ; pokedex id
	db 65 ; base hp
	db 60 ; base attack
	db 70 ; base defense
	db 40 ; base speed
	db 75 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 45 ; catch rate
	db 130 ; base exp yield
	db $66 ; sprite dimensions

	dw PorygonPicFront
	dw PorygonPicBack
	
	; attacks known at lvl 0
	db TACKLE
	db SHARPEN
	db CONVERSION
	db 0

	db 0 ; growth rate
	
	; learnset
	db %00100000
	db %01110011
	db %10001000
	db %11110001
	db %11000011
	db %00111000
	db %01000011

	db 0 ; padding

OmanyteBaseStats: ; 392da (e:52da)
	db DEX_OMANYTE ; pokedex id
	db 35 ; base hp
	db 40 ; base attack
	db 100 ; base defense
	db 35 ; base speed
	db 90 ; base special

	db ROCK ; species type 1
	db WATER ; species type 2

	db 45 ; catch rate
	db 120 ; base exp yield
	db $55 ; sprite dimensions

	dw OmanytePicFront
	dw OmanytePicBack
	
	; attacks known at lvl 0
	db WATER_GUN
	db WITHDRAW
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %00111111
	db %00001000
	db %11000000
	db %00000011
	db %00001000
	db %00010010

	db 0 ; padding

OmastarBaseStats: ; 392f6 (e:52f6)
	db DEX_OMASTAR ; pokedex id
	db 70 ; base hp
	db 60 ; base attack
	db 125 ; base defense
	db 55 ; base speed
	db 115 ; base special

	db ROCK ; species type 1
	db WATER ; species type 2

	db 45 ; catch rate
	db 199 ; base exp yield
	db $66 ; sprite dimensions

	dw OmastarPicFront
	dw OmastarPicBack
	
	; attacks known at lvl 0
	db WATER_GUN
	db WITHDRAW
	db HORN_ATTACK
	db 0

	db 0 ; growth rate
	
	; learnset
	db %11100000
	db %01111111
	db %00001101
	db %11000000
	db %10000011
	db %00001000
	db %00010010

	db 0 ; padding

KabutoBaseStats: ; 39312 (e:5312)
	db DEX_KABUTO ; pokedex id
	db 30 ; base hp
	db 80 ; base attack
	db 90 ; base defense
	db 55 ; base speed
	db 45 ; base special

	db ROCK ; species type 1
	db WATER ; species type 2

	db 45 ; catch rate
	db 119 ; base exp yield
	db $55 ; sprite dimensions

	dw KabutoPicFront
	dw KabutoPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db HARDEN
	db 0
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10100000
	db %00111111
	db %00001000
	db %11000000
	db %00000011
	db %00001000
	db %00010010

	db 0 ; padding

KabutopsBaseStats: ; 3932e (e:532e)
	db DEX_KABUTOPS ; pokedex id
	db 60 ; base hp
	db 115 ; base attack
	db 105 ; base defense
	db 80 ; base speed
	db 70 ; base special

	db ROCK ; species type 1
	db WATER ; species type 2

	db 45 ; catch rate
	db 201 ; base exp yield
	db $66 ; sprite dimensions

	dw KabutopsPicFront
	dw KabutopsPicBack
	
	; attacks known at lvl 0
	db SCRATCH
	db HARDEN
	db ABSORB
	db 0

	db 0 ; growth rate
	
	; learnset
	db %10110110
	db %01111111
	db %00001101
	db %11000000
	db %10000011
	db %00001000
	db %00010010

	db 0 ; padding

AerodactylBaseStats: ; 3934a (e:534a)
	db DEX_AERODACTYL ; pokedex id
	db 80 ; base hp
	db 105 ; base attack
	db 65 ; base defense
	db 130 ; base speed
	db 60 ; base special

	db ROCK ; species type 1
	db FLYING ; species type 2

	db 45 ; catch rate
	db 202 ; base exp yield
	db $77 ; sprite dimensions

	dw AerodactylPicFront
	dw AerodactylPicBack
	
	; attacks known at lvl 0
	db WING_ATTACK
	db AGILITY
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00101010
	db %01000011
	db %01001000
	db %11000000
	db %01100011
	db %00001100
	db %00001010

	db 0 ; padding

SnorlaxBaseStats: ; 39366 (e:5366)
	db DEX_SNORLAX ; pokedex id
	db 160 ; base hp
	db 110 ; base attack
	db 65 ; base defense
	db 30 ; base speed
	db 65 ; base special

	db NORMAL ; species type 1
	db NORMAL ; species type 2

	db 25 ; catch rate
	db 154 ; base exp yield
	db $77 ; sprite dimensions

	dw SnorlaxPicFront
	dw SnorlaxPicBack
	
	; attacks known at lvl 0
	db HEADBUTT
	db AMNESIA
	db REST
	db 0

	db 5 ; growth rate
	
	; learnset
	db %10110001
	db %11111111
	db %10101111
	db %11010111
	db %10101111
	db %10101000
	db %00110010

	db 0 ; padding

ArticunoBaseStats: ; 39382 (e:5382)
	db DEX_ARTICUNO ; pokedex id
	db 90 ; base hp
	db 85 ; base attack
	db 100 ; base defense
	db 85 ; base speed
	db 125 ; base special

	db ICE ; species type 1
	db FLYING ; species type 2

	db 3 ; catch rate
	db 215 ; base exp yield
	db $77 ; sprite dimensions

	dw ArticunoPicFront
	dw ArticunoPicBack
	
	; attacks known at lvl 0
	db PECK
	db ICE_BEAM
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00101010
	db %01111111
	db %00001000
	db %11000000
	db %01000011
	db %00001100
	db %00001010

	db 0 ; padding

ZapdosBaseStats: ; 3939e (e:539e)
	db DEX_ZAPDOS ; pokedex id
	db 90 ; base hp
	db 90 ; base attack
	db 85 ; base defense
	db 100 ; base speed
	db 125 ; base special

	db ELECTRIC ; species type 1
	db FLYING ; species type 2

	db 3 ; catch rate
	db 216 ; base exp yield
	db $77 ; sprite dimensions

	dw ZapdosPicFront
	dw ZapdosPicBack
	
	; attacks known at lvl 0
	db THUNDERSHOCK
	db DRILL_PECK
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00101010
	db %01000011
	db %10001000
	db %11000001
	db %01000011
	db %00011100
	db %01001010

	db 0 ; padding

MoltresBaseStats: ; 393ba (e:53ba)
	db DEX_MOLTRES ; pokedex id
	db 90 ; base hp
	db 100 ; base attack
	db 90 ; base defense
	db 90 ; base speed
	db 125 ; base special

	db FIRE ; species type 1
	db FLYING ; species type 2

	db 3 ; catch rate
	db 217 ; base exp yield
	db $77 ; sprite dimensions

	dw MoltresPicFront
	dw MoltresPicBack
	
	; attacks known at lvl 0
	db PECK
	db FIRE_SPIN
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %00101010
	db %01000011
	db %00001000
	db %11000000
	db %01100011
	db %00001100
	db %00001010

	db 0 ; padding

DratiniBaseStats: ; 393d6 (e:53d6)
	db DEX_DRATINI ; pokedex id
	db 41 ; base hp
	db 64 ; base attack
	db 45 ; base defense
	db 50 ; base speed
	db 50 ; base special

	db DRAGON ; species type 1
	db DRAGON ; species type 2

	db 45 ; catch rate
	db 67 ; base exp yield
	db $55 ; sprite dimensions

	dw DratiniPicFront
	dw DratiniPicBack
	
	; attacks known at lvl 0
	db WRAP
	db LEER
	db 0
	db 0

	db 5 ; growth rate
	
	; learnset
	db %10100000
	db %00111111
	db %11001000
	db %11000001
	db %11100011
	db %00011000
	db %00010010

	db 0 ; padding

DragonairBaseStats: ; 393f2 (e:53f2)
	db DEX_DRAGONAIR ; pokedex id
	db 61 ; base hp
	db 84 ; base attack
	db 65 ; base defense
	db 70 ; base speed
	db 70 ; base special

	db DRAGON ; species type 1
	db DRAGON ; species type 2

	db 45 ; catch rate
	db 144 ; base exp yield
	db $66 ; sprite dimensions

	dw DragonairPicFront
	dw DragonairPicBack
	
	; attacks known at lvl 0
	db WRAP
	db LEER
	db THUNDER_WAVE
	db 0

	db 5 ; growth rate
	
	; learnset
	db %11100000
	db %00111111
	db %11001000
	db %11000001
	db %11100011
	db %00011000
	db %00010010

	db 0 ; padding

DragoniteBaseStats: ; 3940e (e:540e)
	db DEX_DRAGONITE ; pokedex id
	db 91 ; base hp
	db 134 ; base attack
	db 95 ; base defense
	db 80 ; base speed
	db 100 ; base special

	db DRAGON ; species type 1
	db FLYING ; species type 2

	db 45 ; catch rate
	db 218 ; base exp yield
	db $77 ; sprite dimensions

	dw DragonitePicFront
	dw DragonitePicBack
	
	; attacks known at lvl 0
	db WRAP
	db LEER
	db THUNDER_WAVE
	db AGILITY

	db 5 ; growth rate
	
	; learnset
	db %11100010
	db %01111111
	db %11001000
	db %11000001
	db %11100011
	db %00011000
	db %00110010

	db 0 ; padding

MewtwoBaseStats: ; 3942a (e:542a)
	db DEX_MEWTWO ; pokedex id
	db 106 ; base hp
	db 110 ; base attack
	db 90 ; base defense
	db 130 ; base speed
	db 154 ; base special

	db PSYCHIC ; species type 1
	db PSYCHIC ; species type 2

	db 3 ; catch rate
	db 220 ; base exp yield
	db $77 ; sprite dimensions

	dw MewtwoPicFront
	dw MewtwoPicBack
	
	; attacks known at lvl 0
	db CONFUSION
	db DISABLE
	db SWIFT
	db PSYCHIC_M

	db 5 ; growth rate
	
	; learnset
	db %10110001
	db %11111111
	db %10101111
	db %11110001
	db %10101111
	db %00111000
	db %01100011

	db 0 ; padding

CryData: ; 39446 (e:5446)
	;$BaseCry, $Pitch, $Length
	db $11, $00, $80; Rhydon
	db $03, $00, $80; Kangaskhan
	db $00, $00, $80; Nidoran♂
	db $19, $CC, $01; Clefairy
	db $10, $00, $80; Spearow
	db $06, $ED, $80; Voltorb
	db $09, $00, $80; Nidoking
	db $1F, $00, $80; Slowbro
	db $0F, $20, $80; Ivysaur
	db $0D, $00, $80; Exeggutor
	db $0C, $00, $80; Lickitung
	db $0B, $00, $80; Exeggcute
	db $05, $00, $80; Grimer
	db $07, $00, $FF; Gengar
	db $01, $00, $80; Nidoran♀
	db $0A, $00, $80; Nidoqueen
	db $19, $00, $80; Cubone
	db $04, $00, $80; Rhyhorn
	db $1B, $00, $80; Lapras
	db $15, $00, $80; Arcanine
	db $1E, $EE, $FF; Mew
	db $17, $00, $80; Gyarados
	db $18, $00, $80; Shellder
	db $1A, $00, $80; Tentacool
	db $1C, $00, $80; Gastly
	db $16, $00, $80; Scyther
	db $1E, $02, $20; Staryu
	db $13, $00, $80; Blastoise
	db $14, $00, $80; Pinsir
	db $12, $00, $80; Tangela
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $1F, $20, $40; Growlithe
	db $17, $FF, $C0; Onix
	db $18, $40, $A0; Fearow
	db $0E, $DF, $04; Pidgey
	db $02, $00, $80; Slowpoke
	db $1C, $A8, $C0; Kadabra
	db $24, $00, $80; Graveler
	db $14, $0A, $C0; Chansey
	db $1F, $48, $60; Machoke
	db $20, $08, $40; Mr.Mime
	db $12, $80, $C0; Hitmonlee
	db $0C, $EE, $C0; Hitmonchan
	db $17, $E0, $10; Arbok
	db $1E, $42, $FF; Parasect
	db $21, $20, $60; Psyduck
	db $0D, $88, $20; Drowzee
	db $12, $E0, $40; Golem
	db $00, $00, $00; MissingNo.
	db $04, $FF, $30; Magmar
	db $00, $00, $00; MissingNo.
	db $06, $8F, $FF; Electabuzz
	db $1C, $20, $C0; Magneton
	db $12, $E6, $DD; Koffing
	db $00, $00, $00; MissingNo.
	db $0A, $DD, $60; Mankey
	db $0C, $88, $C0; Seel
	db $0B, $AA, $01; Diglett
	db $1D, $11, $40; Tauros
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $10, $DD, $01; Farfetch'd
	db $1A, $44, $40; Venonat
	db $0F, $3C, $C0; Dragonite
	db $00, $80, $10; MissingNo.
	db $00, $00, $00; MissingNo.
	db $1D, $E0, $80; MissingNo.
	db $0B, $BB, $01; Doduo
	db $0E, $FF, $FF; Poliwag
	db $0D, $FF, $FF; Jynx
	db $09, $F8, $40; Moltres
	db $09, $80, $40; Articuno
	db $18, $FF, $80; Zapdos
	db $0E, $FF, $FF; Ditto
	db $19, $77, $10; Meowth
	db $20, $20, $E0; Krabby
	db $22, $FF, $40; MissingNo.
	db $00, $00, $00; MissingNo.
	db $0E, $E0, $60; MissingNo.
	db $24, $4F, $10; Vulpix
	db $24, $88, $60; Ninetales
	db $0F, $EE, $01; Pikachu
	db $09, $EE, $08; Raichu
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $0F, $60, $40; Dratini
	db $0F, $40, $80; Dragonair
	db $16, $BB, $40; Kabuto
	db $18, $EE, $01; Kabutops
	db $19, $99, $10; Horsea
	db $19, $3C, $01; Seadra
	db $0F, $40, $C0; MissingNo.
	db $0F, $20, $C0; MissingNo.
	db $00, $20, $40; Sandshrew
	db $00, $FF, $FF; Sandslash
	db $1F, $F0, $01; Omanyte
	db $1F, $FF, $40; Omastar
	db $0E, $FF, $35; Jigglypuff
	db $0E, $68, $60; Wigglytuff
	db $1A, $88, $60; Eevee
	db $1A, $10, $20; Flareon
	db $1A, $3D, $80; Jolteon
	db $1A, $AA, $FF; Vaporeon
	db $1F, $EE, $01; Machop
	db $1D, $E0, $80; Zubat
	db $17, $12, $40; Ekans
	db $1E, $20, $E0; Paras
	db $0E, $77, $60; Poliwhirl
	db $0E, $00, $FF; Poliwrath
	db $15, $EE, $01; Weedle
	db $13, $FF, $01; Kakuna
	db $13, $60, $80; Beedrill
	db $00, $00, $00; MissingNo.
	db $0B, $99, $20; Dodrio
	db $0A, $AF, $40; Primeape
	db $0B, $2A, $10; Dugtrio
	db $1A, $29, $80; Venomoth
	db $0C, $23, $FF; Dewgong
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $16, $80, $20; Caterpie
	db $1C, $CC, $01; Metapod
	db $16, $77, $40; Butterfree
	db $1F, $08, $C0; Machamp
	db $11, $20, $10; MissingNo.
	db $21, $FF, $40; Golduck
	db $0D, $EE, $40; Hypno
	db $1D, $FA, $80; Golbat
	db $1E, $99, $FF; Mewtwo
	db $05, $55, $01; Snorlax
	db $17, $80, $00; Magikarp
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $07, $EF, $FF; Muk
	db $0F, $40, $80; MissingNo.
	db $20, $EE, $E0; Kingler
	db $18, $6F, $E0; Cloyster
	db $00, $00, $00; MissingNo.
	db $06, $A8, $90; Electrode
	db $19, $AA, $20; Clefable
	db $12, $FF, $FF; Weezing
	db $19, $99, $FF; Persian
	db $08, $4F, $60; Marowak
	db $00, $00, $00; MissingNo.
	db $1C, $30, $40; Haunter
	db $1C, $C0, $01; Abra
	db $1C, $98, $FF; Alakazam
	db $14, $28, $C0; Pidgeotto
	db $14, $11, $FF; Pidgeot
	db $1E, $00, $80; Starmie
	db $0F, $80, $01; Bulbasaur
	db $0F, $00, $C0; Venusaur
	db $1A, $EE, $FF; Tentacruel
	db $00, $00, $00; MissingNo.
	db $16, $80, $40; Goldeen
	db $16, $10, $FF; Seaking
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $25, $00, $80; Ponyta
	db $25, $20, $C0; Rapidash
	db $22, $00, $80; Rattata
	db $22, $20, $FF; Raticate
	db $00, $2C, $C0; Nidorino
	db $01, $2C, $E0; Nidorina
	db $24, $F0, $10; Geodude
	db $25, $AA, $FF; Porygon
	db $23, $20, $F0; Aerodactyl
	db $00, $00, $00; MissingNo.
	db $1C, $80, $60; Magnemite
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $04, $60, $40; Charmander
	db $1D, $60, $40; Squirtle
	db $04, $20, $40; Charmeleon
	db $1D, $20, $40; Wartortle
	db $04, $00, $80; Charizard
	db $1D, $00, $80; MissingNo.
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $00, $00, $00; MissingNo.
	db $08, $DD, $01; Oddish
	db $08, $AA, $40; Gloom
	db $23, $22, $FF; Vileplume
	db $21, $55, $01; Bellsprout
	db $25, $44, $20; Weepinbell
	db $25, $66, $CC; Victreebel

; known jump sources: 3ed07 (f:6d07)
Func_39680: ; 39680 (e:5680)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, [$d060]
	ld hl, $d026
	jr z, .asm_39691
	ld a, [$d065]
	ld hl, $cff7
.asm_39691
	ld c, $4
	ld b, a
.asm_39694
	srl b
	call c, Func_3969f
	inc hl
	inc hl
	dec c
	ret z
	jr .asm_39694

; known jump sources: 39696 (e:5696)
Func_3969f: ; 3969f (e:569f)
	ld a, [hl]
	add a
	ld [hld], a
	ld a, [hl]
	rl a
	ld [hli], a
	ret

; known jump sources: 3ed0f (f:6d0f)
Func_396a7: ; 396a7 (e:56a7)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, [$d061]
	ld hl, W_PLAYERMONATK
	jr z, .asm_396b8
	ld a, [$d066]
	ld hl, W_ENEMYMONATTACK
.asm_396b8
	ld c, $4
	ld b, a
.asm_396bb
	srl b
	call c, Func_396c6
	inc hl
	inc hl
	dec c
	ret z
	jr .asm_396bb

; known jump sources: 396bd (e:56bd)
Func_396c6: ; 396c6 (e:56c6)
	ld a, [hl]
	srl a
	ld [hli], a
	rr [hl]
	or [hl]
	jr nz, .asm_396d1
	ld [hl], $1
.asm_396d1
	dec hl
	ret

; known jump sources: 3ed17 (f:6d17)
Func_396d3: ; 396d3 (e:56d3)
	xor a
	ld [W_ENEMYMONID], a
	ld b, $1
	call GoPAL_SET
	ld hl, Func_3f04b
	ld b, BANK(Func_3f04b)
	call Bankswitch ; indirect jump to Func_3f04b (3f04b (f:704b))
	FuncCoord 19, 0 ; $c3b3
	ld hl, Coord
	ld c, $0
.asm_396e9
	inc c
	ld a, c
	cp $7
	ret z
	ld d, $0
	push bc
	push hl
.asm_396f2
	call Func_39707
	inc hl
	ld a, $7
	add d
	ld d, a
	dec c
	jr nz, .asm_396f2
	ld c, $4
	call DelayFrames
	pop hl
	pop bc
	dec hl
	jr .asm_396e9

; known jump sources: 396f2 (e:56f2)
Func_39707: ; 39707 (e:5707)
	push hl
	push de
	push bc
	ld e, $7
.asm_3970c
	ld [hl], d
	ld bc, $14
	add hl, bc
	inc d
	dec e
	jr nz, .asm_3970c
	pop bc
	pop de
	pop hl
	ret
; 39719 (e:5719)
; creates a set of moves that may be used and returns its address in hl
; unused slots are filled with 0, all used slots may be chosen with equal probability
AIEnemyTrainerChooseMoves: ; 39719 (e:5719)
	ld a, $a
	ld hl, $cee9  ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end
	ld [hli], a   ; move 1
	ld [hli], a   ; move 2
	ld [hli], a   ; move 3
	ld [hl], a    ; move 4
	ld a, [W_ENEMYDISABLEDMOVE] ; forbid disabled move (if any)
	swap a
	and $f
	jr z, .noMoveDisabled
	ld hl, $cee9
	dec a
	ld c, a
	ld b, $0
	add hl, bc    ; advance pointer to forbidden move
	ld [hl], $50  ; forbid (highly discourage) disabled move
.noMoveDisabled
	ld hl, TrainerClassMoveChoiceModifications ; 589B
	ld a, [W_TRAINERCLASS]
	ld b, a
.loopTrainerClasses
	dec b
	jr z, .readTrainerClassData
.loopTrainerClassData
	ld a, [hli]
	and a
	jr nz, .loopTrainerClassData
	jr .loopTrainerClasses
.readTrainerClassData
	ld a, [hl]
	and a
	jp z, .useOriginalMoveSet
	push hl
.nextMoveChoiceModification
	pop hl
	ld a, [hli]
	and a
	jr z, .loopFindMinimumEntries
	push hl
	ld hl, AIMoveChoiceModificationFunctionPointers ; $57a3
	dec a
	add a
	ld c, a
	ld b, $0
	add hl, bc    ; skip to pointer
	ld a, [hli]   ; read pointer into hl
	ld h, [hl]
	ld l, a
	ld de, .nextMoveChoiceModification  ; set return address
	push de
	jp [hl]       ; execute modification function
.loopFindMinimumEntries ; all entries will be decremented sequentially until one of them is zero
	ld hl, $cee9  ; temp move selection array
	ld de, W_ENEMYMONMOVES  ; enemy moves
	ld c, $4
.loopDecrementEntries
	ld a, [de]
	inc de
	and a
	jr z, .loopFindMinimumEntries
	dec [hl]
	jr z, .minimumEntriesFound
	inc hl
	dec c
	jr z, .loopFindMinimumEntries
	jr .loopDecrementEntries
.minimumEntriesFound
	ld a, c
.loopUndoPartialIteration ; undo last (partial) loop iteration
	inc [hl]
	dec hl
	inc a
	cp $5
	jr nz, .loopUndoPartialIteration
	ld hl, $cee9  ; temp move selection array
	ld de, W_ENEMYMONMOVES  ; enemy moves
	ld c, $4
.filterMinimalEntries ; all minimal entries now have value 1. All other slots will be disabled (move set to 0)
	ld a, [de]
	and a
	jr nz, .moveExisting ; 0x3978a $1
	ld [hl], a
.moveExisting
	ld a, [hl]
	dec a
	jr z, .slotWithMinimalValue
	xor a
	ld [hli], a     ; disable move slot
	jr .next
.slotWithMinimalValue
	ld a, [de]
	ld [hli], a     ; enable move slot
.next
	inc de
	dec c
	jr nz, .filterMinimalEntries
	ld hl, $cee9    ; use created temporary array as move set
	ret
.useOriginalMoveSet
	ld hl, W_ENEMYMONMOVES    ; use original move set
	ret

AIMoveChoiceModificationFunctionPointers: ; 397a3 (e:57a3)
dw AIMoveChoiceModification1
dw AIMoveChoiceModification2
dw AIMoveChoiceModification3
dw AIMoveChoiceModification4 ; unused, does nothing

; discourages moves that cause no damage but only a status ailment if player's mon already has one
AIMoveChoiceModification1: ; 397ab (e:57ab)
	ld a, [W_PLAYERMONSTATUS]
	and a
	ret z       ; return if no status ailment on player's mon
	ld hl, $cee8  ; temp move selection array (-1 byte offest)
	ld de, W_ENEMYMONMOVES  ; enemy moves
	ld b, $5
.nextMove
	dec b
	ret z         ; processed all 4 moves
	inc hl
	ld a, [de]
	and a
	ret z         ; no more moves in move set
	inc de
	call ReadMove
	ld a, [W_ENEMYMOVEPOWER]
	and a
	jr nz, .nextMove
	ld a, [W_ENEMYMOVEEFFECT]
	push hl
	push de
	push bc
	ld hl, StatusAilmentMoveEffects
	ld de, $0001
	call IsInArray
	pop bc
	pop de
	pop hl
	jr nc, .nextMove
	ld a, [hl]
	add $5       ; discourage move
	ld [hl], a
	jr .nextMove

StatusAilmentMoveEffects ; 57e2
db $01 ; some sleep effect?
db SLEEP_EFFECT
db POISON_EFFECT
db PARALYZE_EFFECT
db $FF

; slightly encourage moves with specific effects
AIMoveChoiceModification2: ; 397e7 (e:57e7)
	ld a, [$ccd5]
	cp $1
	ret nz
	ld hl, $cee8  ; temp move selection array (-1 byte offest)
	ld de, W_ENEMYMONMOVES  ; enemy moves
	ld b, $5
.nextMove
	dec b
	ret z         ; processed all 4 moves
	inc hl
	ld a, [de]
	and a
	ret z         ; no more moves in move set
	inc de
	call ReadMove
	ld a, [W_ENEMYMOVEEFFECT]
	cp ATTACK_UP1_EFFECT
	jr c, .nextMove
	cp BIDE_EFFECT
	jr c, .preferMove
	cp ATTACK_UP2_EFFECT
	jr c, .nextMove
	cp POISON_EFFECT
	jr c, .preferMove
	jr .nextMove
.preferMove
	dec [hl]       ; slighly encourage this move
	jr .nextMove

; encourages moves that are effective against the player's mon
AIMoveChoiceModification3: ; 39817 (e:5817)
	ld hl, $cee8  ; temp move selection array (-1 byte offest)
	ld de, W_ENEMYMONMOVES  ; enemy moves
	ld b, $5
.nextMove
	dec b
	ret z         ; processed all 4 moves
	inc hl
	ld a, [de]
	and a
	ret z         ; no more moves in move set
	inc de
	call ReadMove
	push hl
	push bc
	push de
	ld hl, AIGetTypeEffectiveness
	ld b, BANK(AIGetTypeEffectiveness)
	call Bankswitch
	pop de
	pop bc
	pop hl
	ld a, [$d11e]
	cp $10
	jr z, .nextMove
	jr c, .notEffectiveMove
	dec [hl]       ; slighly encourage this move
	jr .nextMove
.notEffectiveMove  ; discourages non-effective moves if better moves are available
	push hl
	push de
	push bc
	ld a, [W_ENEMYMOVETYPE]
	ld d, a
	ld hl, W_ENEMYMONMOVES  ; enemy moves
	ld b, $5
	ld c, $0
.loopMoves
	dec b
	jr z, .done
	ld a, [hli]
	and a
	jr z, .done
	call ReadMove
	ld a, [W_ENEMYMOVEEFFECT]
	cp SUPER_FANG_EFFECT
	jr z, .betterMoveFound      ; Super Fang is considered to be a better move
	cp SPECIAL_DAMAGE_EFFECT
	jr z, .betterMoveFound      ; any special damage moves are considered to be better moves
	cp FLY_EFFECT
	jr z, .betterMoveFound      ; Fly is considered to be a better move
	ld a, [W_ENEMYMOVETYPE]
	cp d
	jr z, .loopMoves
	ld a, [W_ENEMYMOVEPOWER]
	and a
	jr nz, .betterMoveFound      ; damaging moves of a different type are considered to be better moves
	jr .loopMoves
.betterMoveFound
	ld c, a
.done
	ld a, c
	pop bc
	pop de
	pop hl
	and a
	jr z, .nextMove
	inc [hl]       ; slighly discourage this move
	jr .nextMove
AIMoveChoiceModification4: ; 39883 (e:5883)
	ret

ReadMove: ; 39884 (e:5884)
	push hl
	push de
	push bc
	dec a
	ld hl,Moves
	ld bc,6
	call AddNTimes
	ld de,$CFCC
	call CopyData
	pop bc
	pop de
	pop hl
	ret

; move choice modifiaction methods that are applied for each trainer class
; 0 is sentinel value
TrainerClassMoveChoiceModifications: ; 3989b (e:589b)
db 0      ; YOUNGSTER
db 1,0    ; BUG CATCHER
db 1,0    ; LASS
db 1,3,0  ; SAILOR
db 1,0    ; JR__TRAINER_M
db 1,0    ; JR__TRAINER_F
db 1,2,3,0; POKEMANIAC
db 1,2,0  ; SUPER_NERD
db 1,0    ; HIKER
db 1,0    ; BIKER
db 1,3,0  ; BURGLAR
db 1,0    ; ENGINEER
db 1,2,0  ; JUGGLER_X
db 1,3,0  ; FISHER
db 1,3,0  ; SWIMMER
db 0      ; CUE_BALL
db 1,0    ; GAMBLER
db 1,3,0  ; BEAUTY
db 1,2,0  ; PSYCHIC_TR
db 1,3,0  ; ROCKER
db 1,0    ; JUGGLER
db 1,0    ; TAMER
db 1,0    ; BIRD_KEEPER
db 1,0    ; BLACKBELT
db 1,0    ; SONY1
db 1,3,0  ; PROF_OAK
db 1,2,0  ; CHIEF
db 1,2,0  ; SCIENTIST
db 1,3,0  ; GIOVANNI
db 1,0    ; ROCKET
db 1,3,0  ; COOLTRAINER_M
db 1,3,0  ; COOLTRAINER_F
db 1,0    ; BRUNO
db 1,0    ; BROCK
db 1,3,0  ; MISTY
db 1,3,0  ; LT__SURGE
db 1,3,0  ; ERIKA
db 1,3,0  ; KOGA
db 1,3,0  ; BLAINE
db 1,3,0  ; SABRINA
db 1,2,0  ; GENTLEMAN
db 1,3,0  ; SONY2
db 1,3,0  ; SONY3
db 1,2,3,0; LORELEI
db 1,0    ; CHANNELER
db 1,0    ; AGATHA
db 1,3,0  ; LANCE


; trainer data: from 5C53 to 652E

; INCBIN "baserom.gbc",$3989e,$39914 - $3989e

; trainer pic pointers and base money.
dw YoungsterPic
db 0,$15,0

dw BugCatcherPic
db 0,$10,0

dw LassPic
db 0,$15,0

dw SailorPic
db 0,$30,0

dw JrTrainerMPic
db 0,$20,0

dw JrTrainerFPic
db 0,$20,0

dw PokemaniacPic
db 0,$50,0

dw SuperNerdPic
db 0,$25,0

dw HikerPic
db 0,$35,0

dw BikerPic
db 0,$20,0

dw BurglarPic
db 0,$90,0

dw EngineerPic
db 0,$50,0

dw JugglerPic
db 0,$35,0

dw FisherPic
db 0,$35,0

dw SwimmerPic
db 0,$05,0

dw CueBallPic
db 0,$25,0

dw GamblerPic
db 0,$70,0

dw BeautyPic
db 0,$70,0

dw PsychicPic
db 0,$10,0

dw RockerPic
db 0,$25,0

dw JugglerPic
db 0,$35,0

dw TamerPic
db 0,$40,0

dw BirdKeeperPic
db 0,$25,0

dw BlackbeltPic
db 0,$25,0

dw Rival1Pic
db 0,$35,0

dw ProfOakPic
db 0,$99,0

dw ChiefPic
db 0,$30,0

dw ScientistPic
db 0,$50,0

dw GiovanniPic
db 0,$99,0

dw RocketPic
db 0,$30,0

dw CooltrainerMPic
db 0,$35,0

dw CooltrainerFPic
db 0,$35,0

dw BrunoPic
db 0,$99,0

dw BrockPic
db 0,$99,0

dw MistyPic
db 0,$99,0

dw LtSurgePic
db 0,$99,0

dw ErikaPic
db 0,$99,0

dw KogaPic
db 0,$99,0

dw BlainePic
db 0,$99,0

dw SabrinaPic
db 0,$99,0

dw GentlemanPic
db 0,$70,0

dw Rival2Pic
db 0,$65,0

dw Rival3Pic
db 0,$99,0

dw LoreleiPic
db 0,$99,0

dw ChannelerPic
db 0,$30,0

dw AgathaPic
db 0,$99,0

dw LancePic
db 0,$99,0

TrainerNames: ; 399ff (e:59ff)
	db "YOUNGSTER@"
	db "BUG CATCHER@"
	db "LASS@"
	db "SAILOR@"
	db "JR.TRAINER♂@"
	db "JR.TRAINER♀@"
	db "POKéMANIAC@"
	db "SUPER NERD@"
	db "HIKER@"
	db "BIKER@"
	db "BURGLAR@"
	db "ENGINEER@"
	db "JUGGLER@"
	db "FISHERMAN@"
	db "SWIMMER@"
	db "CUE BALL@"
	db "GAMBLER@"
	db "BEAUTY@"
	db "PSYCHIC@"
	db "ROCKER@"
	db "JUGGLER@"
	db "TAMER@"
	db "BIRD KEEPER@"
	db "BLACKBELT@"
	db "RIVAL1@"
	db "PROF.OAK@"
	db "CHIEF@"
	db "SCIENTIST@"
	db "GIOVANNI@"
	db "ROCKET@"
	db "COOLTRAINER♂@"
	db "COOLTRAINER♀@"
	db "BRUNO@"
	db "BROCK@"
	db "MISTY@"
	db "LT.SURGE@"
	db "ERIKA@"
	db "KOGA@"
	db "BLAINE@"
	db "SABRINA@"
	db "GENTLEMAN@"
	db "RIVAL2@"
	db "RIVAL3@"
	db "LORELEI@"
	db "CHANNELER@"
	db "AGATHA@"
	db "LANCE@"

; known jump sources: 6f35 (1:6f35), 12b79 (4:6b79), 3d232 (f:5232)
Func_39b87: ; 39b87 (e:5b87)
	ld hl, $d0dc
	ld de, $d0e1
	ld b, $0
.asm_39b8f
	ld a, [hli]
	and a
	jr z, .asm_39bc1
	push hl
	ld [$d0b5], a
	ld a, $2c
	ld [$d0b7], a
	ld a, MOVE_NAME
	ld [W_LISTTYPE], a
	call GetName
	ld hl, $cd6d
.asm_39ba7
	ld a, [hli]
	cp $50
	jr z, .asm_39bb0
	ld [de], a
	inc de
	jr .asm_39ba7
.asm_39bb0
	ld a, b
	ld [$cd6c], a
	inc b
	ld a, $4e
	ld [de], a
	inc de
	pop hl
	ld a, b
	cp $4
	jr z, .asm_39bd1
	jr .asm_39b8f
.asm_39bc1
	ld a, $e3
	ld [de], a
	inc de
	inc b
	ld a, b
	cp $4
	jr z, .asm_39bd1
	ld a, $4e
	ld [de], a
	inc de
	jr .asm_39bc1
.asm_39bd1
	ld a, $50
	ld [de], a
	ret

; known jump sources: 6c76 (1:6c76), 6d2d (1:6d2d)
Func_39bd5: ; 39bd5 (e:5bd5)
	ld a, [$d11b]
	cp $1
	jr nz, .asm_39be6
	ld hl, W_ENEMYMONCOUNT ; $d89c
	ld de, $d9ac
	ld a, $6
	jr .asm_39c18
.asm_39be6
	cp $4
	jr nz, .calcAttackStat4
	ld hl, W_NUMINPARTY ; $d163
	ld de, W_PARTYMON1OT ; $d273
	ld a, $5
	jr .asm_39c18
.calcAttackStat4
	cp $5
	jr nz, .asm_39c02
	ld hl, $cf7b
	ld de, MonsterNames ; $421e
	ld a, $1
	jr .asm_39c18
.asm_39c02
	cp $2
	jr nz, .asm_39c10
	ld hl, W_NUMBAGITEMS ; $d31d
	ld de, ItemNames ; $472b
	ld a, $4
	jr .asm_39c18
.asm_39c10
	ld hl, $cf7b
	ld de, ItemNames ; $472b
	ld a, ITEM_NAME
.asm_39c18
	ld [W_LISTTYPE], a
	ld a, l
	ld [$cf8b], a
	ld a, h
	ld [$cf8c], a
	ld a, e
	ld [$cf8d], a
	ld a, d
	ld [$cf8e], a
	ld bc, ItemPrices ; $4608
	ld a, c
	ld [$cf8f], a
	ld a, b
	ld [$cf90], a
	ret

; known jump sources: 45cc (1:45cc)
Func_39c37: ; 39c37 (e:5c37)
	ld hl, W_PARTYMON1 ; $d164
	ld a, [$cc49]
	and a
	jr z, .asm_39c4b
	dec a
	jr z, .asm_39c48
	ld hl, $da81
	jr .asm_39c4b
.asm_39c48
	ld hl, $d89d
.asm_39c4b
	ld d, $0
	add hl, de
	ld a, [hl]
	ld [$cf91], a
	ret
; 39c53 (e:5c53)
ReadTrainer: ; 39c53 (e:5c53)

; don't change any moves in a link battle
	ld a,[W_ISLINKBATTLE]
	and a
	ret nz

; set [W_ENEMYMONCOUNT] to 0, [$D89D] to FF
; XXX first is total enemy pokemon?
; XXX second is species of first pokemon?
	ld hl,W_ENEMYMONCOUNT
	xor a
	ld [hli],a
	dec a
	ld [hl],a

; get the pointer to trainer data for this class
	ld a,[W_CUROPPONENT]
	sub $C9 ; convert value from pokemon to trainer
	add a,a
	ld hl,TrainerDataPointers
	ld c,a
	ld b,0
	add hl,bc ; hl points to trainer class
	ld a,[hli]
	ld h,[hl]
	ld l,a
	ld a,[W_TRAINERNO]
	ld b,a
; At this point b contains the trainer number,
; and hl points to the trainer class.
; Our next task is to iterate through the trainers,
; decrementing b each time, until we get to the right one.
.outer
	dec b
	jr z,.IterateTrainer
.inner
	ld a,[hli]
	and a
	jr nz,.inner
	jr .outer

; if the first byte of trainer data is FF,
; - each pokemon has a specific level
;      (as opposed to the whole team being of the same level)
; - if [W_LONEATTACKNO] != 0, one pokemon on the team has a special move
; else the first byte is the level of every pokemon on the team
.IterateTrainer
	ld a,[hli]
	cp $FF ; is the trainer special?
	jr z,.SpecialTrainer ; if so, check for special moves
	ld [W_CURENEMYLVL],a
.LoopTrainerData
	ld a,[hli]
	and a ; have we reached the end of the trainer data?
	jr z,.FinishUp
	ld [$CF91],a ; write species somewhere (XXX why?)
	ld a,1
	ld [$CC49],a
	push hl
	call AddPokemonToParty
	pop hl
	jr .LoopTrainerData
.SpecialTrainer
; if this code is being run:
; - each pokemon has a specific level
;      (as opposed to the whole team being of the same level)
; - if [W_LONEATTACKNO] != 0, one pokemon on the team has a special move
	ld a,[hli]
	and a ; have we reached the end of the trainer data?
	jr z,.AddLoneMove
	ld [W_CURENEMYLVL],a
	ld a,[hli]
	ld [$CF91],a
	ld a,1
	ld [$CC49],a
	push hl
	call AddPokemonToParty
	pop hl
	jr .SpecialTrainer
.AddLoneMove
; does the trainer have a single monster with a different move
	ld a,[W_LONEATTACKNO] ; Brock is 01, Misty is 02, Erika is 04, etc
	and a
	jr z,.AddTeamMove
	dec a
	add a,a
	ld c,a
	ld b,0
	ld hl,LoneMoves
	add hl,bc
	ld a,[hli]
	ld d,[hl]
	ld hl,W_ENEMYMON1MOVE3
	ld bc,W_ENEMYMON2MOVE3 - W_ENEMYMON1MOVE3
	call AddNTimes
	ld [hl],d
	jr .FinishUp
.AddTeamMove
; check if our trainer's team has special moves

; get trainer class number
	ld a,[$D059]
	sub $C8
	ld b,a
	ld hl,TeamMoves

; iterate through entries in TeamMoves, checking each for our trainer class
.IterateTeamMoves
	ld a,[hli]
	cp b
	jr z,.GiveTeamMoves ; is there a match?
	inc hl ; if not, go to the next entry
	inc a
	jr nz,.IterateTeamMoves

	; no matches found. is this trainer champion rival?
	ld a,b
	cp SONY3
	jr z,.ChampionRival
	jr .FinishUp ; nope
.GiveTeamMoves
	ld a,[hl]
	ld [$D95E],a
	jr .FinishUp
.ChampionRival ; give moves to his team

; pidgeot
	ld a,SKY_ATTACK
	ld [W_ENEMYMON1MOVE3],a

; starter
	ld a,[W_RIVALSTARTER]
	cp BULBASAUR
	ld b,MEGA_DRAIN
	jr z,.GiveStarterMove
	cp CHARMANDER
	ld b,FIRE_BLAST
	jr z,.GiveStarterMove
	ld b,BLIZZARD ; must be squirtle
.GiveStarterMove
	ld a,b
	ld [W_ENEMYMON6MOVE3],a
.FinishUp ; XXX this needs documenting
	xor a       ; clear D079-D07B
	ld de,$D079
	ld [de],a
	inc de
	ld [de],a
	inc de
	ld [de],a
	ld a,[W_CURENEMYLVL]
	ld b,a
.LastLoop
	ld hl,$D047
	ld c,2
	push bc
	ld a,$B
	call Predef
	pop bc
	inc de
	inc de
	dec b
	jr nz,.LastLoop
	ret

LoneMoves: ; 39d22 (e:5d22)
; these are used for gym leaders.
; this is not automatic! you have to write the number you want to W_LONEATTACKNO
; first. e.g., erika's script writes 4 to W_LONEATTACKNO to get mega drain,
; the fourth entry in the list.

; first byte:  pokemon in the trainer's party that gets the move
; second byte: move
; unterminated
	db 1,BIDE
	db 1,BUBBLEBEAM
	db 2,THUNDERBOLT
	db 2,MEGA_DRAIN
	db 3,TOXIC
	db 3,PSYWAVE
	db 3,FIRE_BLAST
	db 4,FISSURE

TeamMoves: ; 39d32 (e:5d32)
; these are used for elite four.
; this is automatic, based on trainer class.
; don't be confused by LoneMoves above, the two data structures are
	; _completely_ unrelated.

; first byte: trainer (all trainers in this class have this move)
; second byte: move
; ff-terminated
	db LORELEI,BLIZZARD
	db BRUNO,FISSURE
	db AGATHA,TOXIC
	db LANCE,BARRIER
	db $FF

if _YELLOW
; different format from above.

; entry ≔ trainerclass, trainerid, moveset+, 0
; moveset ≔ partymon, partymon'smove, moveid

	db BUG_CATCHER,$f
	db 2,2,TACKLE
	db 2,3,STRING_SHOT
	db 0

	db YOUNGSTER,$e
	db 1,4,FISSURE
	db 0

	db BROCK,$1
	db 2,3,BIND
	db 2,4,BIDE
	db 0

	db MISTY,$1
	db 2,4,BUBBLEBEAM
	db 0

	db LT__SURGE,$1
	db 1,1,THUNDERBOLT
	db 1,2,MEGA_PUNCH
	db 1,3,MEGA_KICK
	db 1,4,GROWL
	db 0

	db ERIKA,$1
	db 1,3,MEGA_DRAIN
	db 2,1,RAZOR_LEAF
	db 3,1,PETAL_DANCE
	db 0

	db KOGA,$1
	db 1,1,TOXIC
	db 1,2,TACKLE
	db 2,1,TOXIC
	db 2,3,SUPERSONIC
	db 3,1,TOXIC
	db 3,2,DOUBLE_EDGE
	db 4,1,LEECH_LIFE
	db 4,2,DOUBLE_TEAM
	db 4,3,PSYCHIC_M
	db 4,4,TOXIC
	db 0

	db BLAINE,$1
	db 1,1,FLAMETHROWER
	db 1,4,CONFUSE_RAY
	db 3,1,FLAMETHROWER
	db 3,2,FIRE_BLAST
	db 3,3,REFLECT
	db 0

	db SABRINA,$1
	db 1,1,FLASH
	db 2,1,KINESIS
	db 2,4,PSYWAVE
	db 3,1,PSYWAVE
	db 0

	db GIOVANNI,$3
	db 1,3,FISSURE
	db 2,2,DOUBLE_TEAM
	db 3,1,EARTHQUAKE
	db 3,3,THUNDER
	db 4,1,EARTHQUAKE
	db 4,2,LEER
	db 4,3,THUNDER
	db 5,1,ROCK_SLIDE
	db 5,4,EARTHQUAKE
	db 0

	db LORELEI,$1
	db 1,1,BUBBLEBEAM
	db 2,3,ICE_BEAM
	db 3,1,PSYCHIC_M
	db 3,2,SURF
	db 4,3,LOVELY_KISS
	db 5,3,BLIZZARD
	db 0

	db BRUNO,$1
	db 1,1,ROCK_SLIDE
	db 1,2,SCREECH
	db 1,4,DIG
	db 2,3,FIRE_PUNCH
	db 2,4,DOUBLE_TEAM
	db 3,1,DOUBLE_KICK
	db 3,2,MEGA_KICK
	db 3,4,DOUBLE_TEAM
	db 4,1,ROCK_SLIDE
	db 4,2,SCREECH
	db 4,4,EARTHQUAKE
	db 5,2,KARATE_CHOP
	db 5,3,STRENGTH
	db 0

	db AGATHA,$1
	db 1,2,SUBSTITUTE
	db 1,3,LICK
	db 1,4,MEGA_DRAIN
	db 2,2,TOXIC
	db 2,4,LEECH_LIFE
	db 3,2,LICK
	db 4,1,WRAP
	db 5,2,PSYCHIC_M
	db 0

	db LANCE,$1
	db 1,1,DRAGON_RAGE
	db 2,1,THUNDER_WAVE
	db 2,3,THUNDERBOLT
	db 3,1,BUBBLEBEAM
	db 3,2,WRAP
	db 3,3,ICE_BEAM
	db 4,1,WING_ATTACK
	db 4,2,SWIFT
	db 4,3,FLY
	db 5,1,BLIZZARD
	db 5,2,FIRE_BLAST
	db 5,3,THUNDER
	db 0

	db SONY3,$1
	db 1,3,EARTHQUAKE
	db 2,4,KINESIS
	db 3,4,LEECH_SEED
	db 4,1,ICE_BEAM
	db 5,1,CONFUSE_RAY
	db 5,4,FIRE_SPIN
	db 6,3,QUICK_ATTACK
	db 0

	db SONY3,$2
	db 1,3,EARTHQUAKE
	db 2,4,KINESIS
	db 3,4,LEECH_SEED
	db 4,1,THUNDERBOLT
	db 5,1,ICE_BEAM
	db 6,2,REFLECT
	db 6,3,QUICK_ATTACK
	db 0

	db SONY3,$3
	db 1,3,EARTHQUAKE
	db 2,4,KINESIS
	db 3,4,LEECH_SEED
	db 4,1,CONFUSE_RAY
	db 4,4,FIRE_SPIN
	db 5,1,THUNDERBOLT
	db 6,1,AURORA_BEAM
	db 6,3,QUICK_ATTACK
	db 0

	db $ff
endc

TrainerDataPointers: ; 39d3b (e:5d3b)
	dw YoungsterData,BugCatcherData,LassData,SailorData,JrTrainerMData
	dw JrTrainerFData,PokemaniacData,SuperNerdData,HikerData,BikerData
	dw BurglarData,EngineerData,Juggler1Data,FisherData,SwimmerData
	dw CueBallData,GamblerData,BeautyData,PsychicData,RockerData
	dw JugglerData,TamerData,BirdKeeperData,BlackbeltData,Green1Data
	dw ProfOakData,ChiefData,ScientistData,GiovanniData,RocketData
	dw CooltrainerMData,CooltrainerFData,BrunoData,BrockData,MistyData
	dw LtSurgeData,ErikaData,KogaData,BlaineData,SabrinaData
	dw GentlemanData,Green2Data,Green3Data,LoreleiData,ChannelerData
	dw AgathaData,LanceData

; if first byte != FF, then
	; first byte is level (of all pokemon on this team)
	; all the next bytes are pokemon species
	; null-terminated
; if first byte == FF, then
	; first byte is FF (obviously)
	; every next two bytes are a level and species
	; null-terminated

YoungsterData: ; 39d99 (e:5d99)
	db 11,RATTATA,EKANS,0
	db 14,SPEAROW,0
	db 10,RATTATA,RATTATA,ZUBAT,0
	db 14,RATTATA,EKANS,ZUBAT,0
	db 15,RATTATA,SPEAROW,0
	db 17,SLOWPOKE,0
	db 14,EKANS,SANDSHREW,0
	db 21,NIDORAN_M,0
	db 21,EKANS,0
	db 19,SANDSHREW,ZUBAT,0
	db 17,RATTATA,RATTATA,RATICATE,0
	db 18,NIDORAN_M,NIDORINO,0
	db 17,SPEAROW,RATTATA,RATTATA,SPEAROW,0
if _YELLOW
	db 24,SANDSHREW,0
endc
BugCatcherData: ; 39dce (e:5dce)
if _YELLOW
	db 7,CATERPIE,CATERPIE,0
	db 6,METAPOD,CATERPIE,METAPOD,0
	db 10,CATERPIE,0
else
	db 6,WEEDLE,CATERPIE,0
	db 7,WEEDLE,KAKUNA,WEEDLE,0
	db 9,WEEDLE,0
endc
	db 10,CATERPIE,WEEDLE,CATERPIE,0
	db 9,WEEDLE,KAKUNA,CATERPIE,METAPOD,0
	db 11,CATERPIE,METAPOD,0
	db 11,WEEDLE,KAKUNA,0
	db 10,CATERPIE,METAPOD,CATERPIE,0
	db 14,CATERPIE,WEEDLE,0
	db 16,WEEDLE,CATERPIE,WEEDLE,0
	db 20,BUTTERFREE,0
	db 18,METAPOD,CATERPIE,VENONAT,0
	db 19,BEEDRILL,BEEDRILL,0
	db 20,CATERPIE,WEEDLE,VENONAT,0
if _YELLOW
	db 8,CATERPIE,METAPOD,0
endc
LassData: ; 39e0c (e:5e0c)
	db 9,PIDGEY,PIDGEY,0
	db 10,RATTATA,NIDORAN_M,0
	db 14,JIGGLYPUFF,0
	db 31,PARAS,PARAS,PARASECT,0
	db 11,ODDISH,BELLSPROUT,0
	db 14,CLEFAIRY,0
	db 16,PIDGEY,NIDORAN_F,0
	db 14,PIDGEY,NIDORAN_F,0
	db 15,NIDORAN_M,NIDORAN_F,0
	db 13,ODDISH,PIDGEY,ODDISH,0
	db 18,PIDGEY,NIDORAN_F,0
if _YELLOW
	db 20,JIGGLYPUFF,0
else
	db 18,RATTATA,PIKACHU,0
endc
	db 23,NIDORAN_F,NIDORINA,0
	db 24,MEOWTH,MEOWTH,MEOWTH,0
if _YELLOW
	db 19,PIDGEY,RATTATA,NIDORAN_F,MEOWTH,NIDORAN_M,0
else
	db 19,PIDGEY,RATTATA,NIDORAN_M,MEOWTH,PIKACHU,0
endc
	db 22,CLEFAIRY,CLEFAIRY,0
	db 23,BELLSPROUT,WEEPINBELL,0
	db 23,ODDISH,GLOOM,0
if _YELLOW
	db 6,NIDORAN_F,NIDORAN_M,0
endc
SailorData: ; 39e58 (e:5e58)
	db 18,MACHOP,SHELLDER,0
	db 17,MACHOP,TENTACOOL,0
	db 21,SHELLDER,0
	db 17,HORSEA,SHELLDER,TENTACOOL,0
	db 18,TENTACOOL,STARYU,0
	db 17,HORSEA,HORSEA,HORSEA,0
	db 20,MACHOP,0
if _YELLOW
	db 24,MAGNEMITE,0
else
	db 21,PIKACHU,PIKACHU,0
endc
JrTrainerMData: ; 39e78 (e:5e78)
if _YELLOW
	db 9,DIGLETT,SANDSHREW,0
else
	db 11,DIGLETT,SANDSHREW,0
endc
	db 14,RATTATA,EKANS,0
	db 18,MANKEY,0
	db 20,SQUIRTLE,0
	db 16,SPEAROW,RATICATE,0
	db 18,DIGLETT,DIGLETT,SANDSHREW,0
	db 21,GROWLITHE,CHARMANDER,0
	db 19,RATTATA,DIGLETT,EKANS,SANDSHREW,0
	db 29,NIDORAN_M,NIDORINO,0
if _YELLOW
	db 16,WEEPINBELL,0
endc
JrTrainerFData: ; 39e9d (e:5e9d)
	db 19,GOLDEEN,0
if _YELLOW
	db 16,ODDISH,BELLSPROUT,0
else
	db 16,RATTATA,PIKACHU,0
endc
	db 16,PIDGEY,PIDGEY,PIDGEY,0
	db 22,BULBASAUR,0
	db 18,ODDISH,BELLSPROUT,ODDISH,BELLSPROUT,0
	db 23,MEOWTH,0
if _YELLOW
	db 20,JIGGLYPUFF,CLEFAIRY,0
else
	db 20,PIKACHU,CLEFAIRY,0
endc
	db 21,PIDGEY,PIDGEOTTO,0
	db 21,JIGGLYPUFF,PIDGEY,MEOWTH,0
	db 22,ODDISH,BULBASAUR,0
	db 24,BULBASAUR,IVYSAUR,0
if _YELLOW
	db 24,PIDGEY,MEOWTH,RATTATA,PIDGEY,MEOWTH,0
else
	db 24,PIDGEY,MEOWTH,RATTATA,PIKACHU,MEOWTH,0
endc
	db 30,POLIWAG,POLIWAG,0
	db 27,PIDGEY,MEOWTH,PIDGEY,PIDGEOTTO,0
	db 28,GOLDEEN,POLIWAG,HORSEA,0
	db 31,GOLDEEN,SEAKING,0
	db 22,BELLSPROUT,CLEFAIRY,0
	db 20,MEOWTH,ODDISH,PIDGEY,0
	db 19,PIDGEY,RATTATA,RATTATA,BELLSPROUT,0
	db 28,GLOOM,ODDISH,ODDISH,0
if _YELLOW
	db 29,PIDGEY,PIDGEOTTO,0
else
	db 29,PIKACHU,RAICHU,0
endc
	db 33,CLEFAIRY,0
	db 29,BELLSPROUT,ODDISH,TANGELA,0
	db 30,TENTACOOL,HORSEA,SEEL,0
if _YELLOW
	db 20,CUBONE,0
endc
PokemaniacData: ; 39f09 (e:5f09)
	db 30,RHYHORN,LICKITUNG,0
	db 20,CUBONE,SLOWPOKE,0
	db 20,SLOWPOKE,SLOWPOKE,SLOWPOKE,0
	db 22,CHARMANDER,CUBONE,0
	db 25,SLOWPOKE,0
	db 40,CHARMELEON,LAPRAS,LICKITUNG,0
	db 23,CUBONE,SLOWPOKE,0
SuperNerdData: ; 39f26 (e:5f26)
	db 11,MAGNEMITE,VOLTORB,0
	db 12,GRIMER,VOLTORB,KOFFING,0
	db 20,VOLTORB,KOFFING,VOLTORB,MAGNEMITE,0
	db 22,GRIMER,MUK,GRIMER,0
	db 26,KOFFING,0
	db 22,KOFFING,MAGNEMITE,WEEZING,0
	db 20,MAGNEMITE,MAGNEMITE,KOFFING,MAGNEMITE,0
	db 24,MAGNEMITE,VOLTORB,0
	db 36,VULPIX,VULPIX,NINETALES,0
	db 34,PONYTA,CHARMANDER,VULPIX,GROWLITHE,0
	db 41,RAPIDASH,0
	db 37,GROWLITHE,VULPIX,0
HikerData: ; 39f5e (e:5f5e)
	db 10,GEODUDE,GEODUDE,ONIX,0
	db 15,MACHOP,GEODUDE,0
	db 13,GEODUDE,GEODUDE,MACHOP,GEODUDE,0
	db 17,ONIX,0
	db 21,GEODUDE,ONIX,0
	db 20,GEODUDE,MACHOP,GEODUDE,0
	db 21,GEODUDE,ONIX,0
	db 19,ONIX,GRAVELER,0
	db 21,GEODUDE,GEODUDE,GRAVELER,0
	db 25,GEODUDE,0
	db 20,MACHOP,ONIX,0
	db 19,GEODUDE,MACHOP,GEODUDE,GEODUDE,0
	db 20,ONIX,ONIX,GEODUDE,0
	db 21,GEODUDE,GRAVELER,0
BikerData: ; 39f9c (e:5f9c)
	db 28,KOFFING,KOFFING,KOFFING,0
	db 29,KOFFING,GRIMER,0
	db 25,KOFFING,KOFFING,WEEZING,KOFFING,GRIMER,0
	db 28,KOFFING,GRIMER,WEEZING,0
	db 29,GRIMER,KOFFING,0
	db 33,WEEZING,0
	db 26,GRIMER,GRIMER,GRIMER,GRIMER,0
	db 28,WEEZING,KOFFING,WEEZING,0
	db 33,MUK,0
	db 29,VOLTORB,VOLTORB,0
	db 29,WEEZING,MUK,0
	db 25,KOFFING,WEEZING,KOFFING,KOFFING,WEEZING,0
	db 26,KOFFING,KOFFING,GRIMER,KOFFING,0
	db 28,GRIMER,GRIMER,KOFFING,0
	db 29,KOFFING,MUK,0
BurglarData: ; 39fe4 (e:5fe4)
	db 29,GROWLITHE,VULPIX,0
	db 33,GROWLITHE,0
	db 28,VULPIX,CHARMANDER,PONYTA,0
	db 36,GROWLITHE,VULPIX,NINETALES,0
	db 41,PONYTA,0
	db 37,VULPIX,GROWLITHE,0
	db 34,CHARMANDER,CHARMELEON,0
	db 38,NINETALES,0
	db 34,GROWLITHE,PONYTA,0
EngineerData: ; 3a007 (e:6007)
	db 21,VOLTORB,MAGNEMITE,0
	db 21,MAGNEMITE,0
	db 18,MAGNEMITE,MAGNEMITE,MAGNETON,0
Juggler1Data: ; 3a013 (e:6013)
; none
FisherData: ; 3a013 (e:6013)
	db 17,GOLDEEN,TENTACOOL,GOLDEEN,0
	db 17,TENTACOOL,STARYU,SHELLDER,0
	db 22,GOLDEEN,POLIWAG,GOLDEEN,0
	db 24,TENTACOOL,GOLDEEN,0
	db 27,GOLDEEN,0
	db 21,POLIWAG,SHELLDER,GOLDEEN,HORSEA,0
	db 28,SEAKING,GOLDEEN,SEAKING,SEAKING,0
	db 31,SHELLDER,CLOYSTER,0
	db 27,MAGIKARP,MAGIKARP,MAGIKARP,MAGIKARP,MAGIKARP,MAGIKARP,0
	db 33,SEAKING,GOLDEEN,0
	db 24,MAGIKARP,MAGIKARP,0
SwimmerData: ; 3a049 (e:6049)
	db 16,HORSEA,SHELLDER,0
	db 30,TENTACOOL,SHELLDER,0
	db 29,GOLDEEN,HORSEA,STARYU,0
	db 30,POLIWAG,POLIWHIRL,0
	db 27,HORSEA,TENTACOOL,TENTACOOL,GOLDEEN,0
	db 29,GOLDEEN,SHELLDER,SEAKING,0
	db 30,HORSEA,HORSEA,0
	db 27,TENTACOOL,TENTACOOL,STARYU,HORSEA,TENTACRUEL,0
	db 31,SHELLDER,CLOYSTER,0
	db 35,STARYU,0
	db 28,HORSEA,HORSEA,SEADRA,HORSEA,0
	db 33,SEADRA,TENTACRUEL,0
	db 37,STARMIE,0
	db 33,STARYU,WARTORTLE,0
	db 32,POLIWHIRL,TENTACOOL,SEADRA,0
CueBallData: ; 3a08d (e:608d)
	db 28,MACHOP,MANKEY,MACHOP,0
	db 29,MANKEY,MACHOP,0
	db 33,MACHOP,0
	db 29,MANKEY,PRIMEAPE,0
	db 29,MACHOP,MACHOKE,0
	db 33,MACHOKE,0
	db 26,MANKEY,MANKEY,MACHOKE,MACHOP,0
	db 29,PRIMEAPE,MACHOKE,0
	db 31,TENTACOOL,TENTACOOL,TENTACRUEL,0
GamblerData: ; 3a0b3 (e:60b3)
	db 18,POLIWAG,HORSEA,0
	db 18,BELLSPROUT,ODDISH,0
	db 18,VOLTORB,MAGNEMITE,0
	db 18,GROWLITHE,VULPIX,0
	db 22,POLIWAG,POLIWAG,POLIWHIRL,0
	db 22,ONIX,GEODUDE,GRAVELER,0
	db 24,GROWLITHE,VULPIX,0
BeautyData: ; 3a0d1 (e:60d1)
	db 21,ODDISH,BELLSPROUT,ODDISH,BELLSPROUT,0
	db 24,BELLSPROUT,BELLSPROUT,0
	db 26,EXEGGCUTE,0
if _YELLOW
	db 27,RATTATA,VULPIX,RATTATA,0
else
	db 27,RATTATA,PIKACHU,RATTATA,0
endc
	db 29,CLEFAIRY,MEOWTH,0
	db 35,SEAKING,0
	db 30,SHELLDER,SHELLDER,CLOYSTER,0
	db 31,POLIWAG,SEAKING,0
	db 29,PIDGEOTTO,WIGGLYTUFF,0
	db 29,BULBASAUR,IVYSAUR,0
	db 33,WEEPINBELL,BELLSPROUT,WEEPINBELL,0
	db 27,POLIWAG,GOLDEEN,SEAKING,GOLDEEN,POLIWAG,0
	db 30,GOLDEEN,SEAKING,0
	db 29,STARYU,STARYU,STARYU,0
	db 30,SEADRA,HORSEA,SEADRA,0
PsychicData: ; 3a115 (e:6115)
	db 31,KADABRA,SLOWPOKE,MR_MIME,KADABRA,0
	db 34,MR_MIME,KADABRA,0
	db 33,SLOWPOKE,SLOWPOKE,SLOWBRO,0
	db 38,SLOWBRO,0
RockerData: ; 3a127 (e:6127)
if _YELLOW
	db 20,VOLTORB,VOLTORB,VOLTORB,0
else
	db 20,VOLTORB,MAGNEMITE,VOLTORB,0
endc
	db 29,VOLTORB,ELECTRODE,0
JugglerData: ; 3a130 (e:6130)
	db 29,KADABRA,MR_MIME,0
	db 41,DROWZEE,HYPNO,KADABRA,KADABRA,0
	db 31,DROWZEE,DROWZEE,KADABRA,DROWZEE,0
	db 34,DROWZEE,HYPNO,0
	db 48,MR_MIME,0
	db 33,HYPNO,0
	db 38,HYPNO,0
	db 34,DROWZEE,KADABRA,0
TamerData: ; 3a151 (e:6151)
	db 34,SANDSLASH,ARBOK,0
	db 33,ARBOK,SANDSLASH,ARBOK,0
	db 43,RHYHORN,0
	db 39,ARBOK,TAUROS,0
	db 44,PERSIAN,GOLDUCK,0
	db 42,RHYHORN,PRIMEAPE,ARBOK,TAUROS,0
BirdKeeperData: ; 3a16b (e:616b)
	db 29,PIDGEY,PIDGEOTTO,0
	db 25,SPEAROW,PIDGEY,PIDGEY,SPEAROW,SPEAROW,0
	db 26,PIDGEY,PIDGEOTTO,SPEAROW,FEAROW,0
	db 33,FARFETCH_D,0
	db 29,SPEAROW,FEAROW,0
	db 26,PIDGEOTTO,FARFETCH_D,DODUO,PIDGEY,0
	db 28,DODRIO,DODUO,DODUO,0
	db 29,SPEAROW,FEAROW,0
	db 34,DODRIO,0
	db 26,SPEAROW,SPEAROW,FEAROW,SPEAROW,0
	db 30,FEAROW,FEAROW,PIDGEOTTO,0
	db 39,PIDGEOTTO,PIDGEOTTO,PIDGEY,PIDGEOTTO,0
	db 42,FARFETCH_D,FEAROW,0
	db 28,PIDGEY,DODUO,PIDGEOTTO,0
	db 26,PIDGEY,SPEAROW,PIDGEY,FEAROW,0
	db 29,PIDGEOTTO,FEAROW,0
	db 28,SPEAROW,DODUO,FEAROW,0
BlackbeltData: ; 3a1be (e:61be)
	db 37,HITMONLEE,HITMONCHAN,0
	db 31,MANKEY,MANKEY,PRIMEAPE,0
	db 32,MACHOP,MACHOKE,0
	db 36,PRIMEAPE,0
	db 31,MACHOP,MANKEY,PRIMEAPE,0
	db 40,MACHOP,MACHOKE,0
	db 43,MACHOKE,0
	db 38,MACHOKE,MACHOP,MACHOKE,0
	db 43,MACHOKE,MACHOP,MACHOKE,0
Green1Data: ; 3a1e4 (e:61e4)
if _YELLOW
	db 5,EEVEE,0
	db $FF,9,SPEAROW,8,EEVEE,0
	db $FF,18,SPEAROW,15,SANDSHREW,15,RATTATA,17,EEVEE,0
else
	db 5,SQUIRTLE,0
	db 5,BULBASAUR,0
	db 5,CHARMANDER,0
	db $FF,9,PIDGEY,8,SQUIRTLE,0
	db $FF,9,PIDGEY,8,BULBASAUR,0
	db $FF,9,PIDGEY,8,CHARMANDER,0
	db $FF,18,PIDGEOTTO,15,ABRA,15,RATTATA,17,SQUIRTLE,0
	db $FF,18,PIDGEOTTO,15,ABRA,15,RATTATA,17,BULBASAUR,0
	db $FF,18,PIDGEOTTO,15,ABRA,15,RATTATA,17,CHARMANDER,0
endc
ProfOakData: ; 3a21d (e:621d)
	db $FF,66,TAUROS,67,EXEGGUTOR,68,ARCANINE,69,BLASTOISE,70,GYARADOS,0
	db $FF,66,TAUROS,67,EXEGGUTOR,68,ARCANINE,69,VENUSAUR,70,GYARADOS,0
	db $FF,66,TAUROS,67,EXEGGUTOR,68,ARCANINE,69,CHARIZARD,70,GYARADOS,0
ChiefData: ; 3a241 (e:6241)
; none
ScientistData: ; 3a241 (e:6241)
	db 34,KOFFING,VOLTORB,0
	db 26,GRIMER,WEEZING,KOFFING,WEEZING,0
	db 28,MAGNEMITE,VOLTORB,MAGNETON,0
	db 29,ELECTRODE,WEEZING,0
	db 33,ELECTRODE,0
	db 26,MAGNETON,KOFFING,WEEZING,MAGNEMITE,0
	db 25,VOLTORB,KOFFING,MAGNETON,MAGNEMITE,KOFFING,0
	db 29,ELECTRODE,MUK,0
	db 29,GRIMER,ELECTRODE,0
	db 28,VOLTORB,KOFFING,MAGNETON,0
	db 29,MAGNEMITE,KOFFING,0
	db 33,MAGNEMITE,MAGNETON,VOLTORB,0
	db 34,MAGNEMITE,ELECTRODE,0
GiovanniData: ; 3a27e (e:627e)
if _YELLOW
	db $FF,25,ONIX,24,RHYHORN,29,PERSIAN,0
	db $FF,37,NIDORINO,35,PERSIAN,37,RHYHORN,41,NIDOQUEEN,0
	db $FF,50,DUGTRIO,53,PERSIAN,53,NIDOQUEEN,55,NIDOKING,55,RHYDON,0
else
	db $FF,25,ONIX,24,RHYHORN,29,KANGASKHAN,0
	db $FF,37,NIDORINO,35,KANGASKHAN,37,RHYHORN,41,NIDOQUEEN,0
	db $FF,45,RHYHORN,42,DUGTRIO,44,NIDOQUEEN,45,NIDOKING,50,RHYDON,0
endc
RocketData: ; 3a29c (e:629c)
	db 13,RATTATA,ZUBAT,0
	db 11,SANDSHREW,RATTATA,ZUBAT,0
	db 12,ZUBAT,EKANS,0
	db 16,RATICATE,0
	db 17,MACHOP,DROWZEE,0
	db 15,EKANS,ZUBAT,0
	db 20,RATICATE,ZUBAT,0
	db 21,DROWZEE,MACHOP,0
	db 21,RATICATE,RATICATE,0
	db 20,GRIMER,KOFFING,KOFFING,0
	db 19,RATTATA,RATICATE,RATICATE,RATTATA,0
	db 22,GRIMER,KOFFING,0
	db 17,ZUBAT,KOFFING,GRIMER,ZUBAT,RATICATE,0
	db 20,RATTATA,RATICATE,DROWZEE,0
	db 21,MACHOP,MACHOP,0
	db 23,SANDSHREW,EKANS,SANDSLASH,0
	db 23,EKANS,SANDSHREW,ARBOK,0
	db 21,KOFFING,ZUBAT,0
	db 25,ZUBAT,ZUBAT,GOLBAT,0
	db 26,KOFFING,DROWZEE,0
	db 23,ZUBAT,RATTATA,RATICATE,ZUBAT,0
	db 26,DROWZEE,KOFFING,0
	db 29,CUBONE,ZUBAT,0
	db 25,GOLBAT,ZUBAT,ZUBAT,RATICATE,ZUBAT,0
	db 28,RATICATE,HYPNO,RATICATE,0
	db 29,MACHOP,DROWZEE,0
	db 28,EKANS,ZUBAT,CUBONE,0
	db 33,ARBOK,0
	db 33,HYPNO,0
	db 29,MACHOP,MACHOKE,0
	db 28,ZUBAT,ZUBAT,GOLBAT,0
	db 26,RATICATE,ARBOK,KOFFING,GOLBAT,0
	db 29,CUBONE,CUBONE,0
	db 29,SANDSHREW,SANDSLASH,0
	db 26,RATICATE,ZUBAT,GOLBAT,RATTATA,0
	db 28,WEEZING,GOLBAT,KOFFING,0
	db 28,DROWZEE,GRIMER,MACHOP,0
	db 28,GOLBAT,DROWZEE,HYPNO,0
	db 33,MACHOKE,0
	db 25,RATTATA,RATTATA,ZUBAT,RATTATA,EKANS,0
	db 32,CUBONE,DROWZEE,MAROWAK,0
if _YELLOW
JessieJamesData:
	db 14,EKANS,MEOWTH,KOFFING,0
	db 25,KOFFING,MEOWTH,EKANS,0
	db 27,MEOWTH,ARBOK,WEEZING,0
	db 31,WEEZING,ARBOK,MEOWTH,0
	db 16,KOFFING,0
	db 27,KOFFING,0
	db 29,WEEZING,0
	db 33,WEEZING,0
endc
CooltrainerMData: ; 3a35a (e:635a)
	db 39,NIDORINO,NIDOKING,0
	db 43,EXEGGUTOR,CLOYSTER,ARCANINE,0
	db 43,KINGLER,TENTACRUEL,BLASTOISE,0
	db 45,KINGLER,STARMIE,0
	db 42,IVYSAUR,WARTORTLE,CHARMELEON,CHARIZARD,0
	db 44,IVYSAUR,WARTORTLE,CHARMELEON,0
	db 49,NIDOKING,0
	db 44,KINGLER,CLOYSTER,0
	db 39,SANDSLASH,DUGTRIO,0
	db 43,RHYHORN,0
CooltrainerFData: ; 3a385 (e:6385)
	db 24,WEEPINBELL,GLOOM,IVYSAUR,0
	db 43,BELLSPROUT,WEEPINBELL,VICTREEBEL,0
	db 43,PARASECT,DEWGONG,CHANSEY,0
	db 46,VILEPLUME,BUTTERFREE,0
	db 44,PERSIAN,NINETALES,0
	db 45,IVYSAUR,VENUSAUR,0
	db 45,NIDORINA,NIDOQUEEN,0
	db 43,PERSIAN,NINETALES,RAICHU,0
BrunoData: ; 3a3a9 (e:63a9)
	db $FF,53,ONIX,55,HITMONCHAN,55,HITMONLEE,56,ONIX,58,MACHAMP,0
BrockData: ; 3a3b5 (e:63b5)
if _YELLOW
	db $FF,10,GEODUDE,12,ONIX,0
else
	db $FF,12,GEODUDE,14,ONIX,0
endc
MistyData: ; 3a3bb (e:63bb)
	db $FF,18,STARYU,21,STARMIE,0
LtSurgeData: ; 3a3c1 (e:63c1)
if _YELLOW
	db $FF,28,RAICHU,0
else
	db $FF,21,VOLTORB,18,PIKACHU,24,RAICHU,0
endc
ErikaData: ; 3a3c9 (e:63c9)
if _YELLOW
	db $FF,30,TANGELA,32,WEEPINBELL,32,GLOOM,0
else
	db $FF,29,VICTREEBEL,24,TANGELA,29,VILEPLUME,0
endc
KogaData: ; 3a3d1 (e:63d1)
if _YELLOW
	db $FF,44,VENONAT,46,VENONAT,48,VENONAT,50,VENOMOTH,0
else
	db $FF,37,KOFFING,39,MUK,37,KOFFING,43,WEEZING,0
endc
BlaineData: ; 3a3db (e:63db)
if _YELLOW
	db $FF,48,NINETALES,50,RAPIDASH,54,ARCANINE,0
else
	db $FF,42,GROWLITHE,40,PONYTA,42,RAPIDASH,47,ARCANINE,0
endc
SabrinaData: ; 3a3e5 (e:63e5)
if _YELLOW
	db $FF,50,ABRA,50,KADABRA,50,ALAKAZAM,0
else
	db $FF,38,KADABRA,37,MR_MIME,38,VENOMOTH,43,ALAKAZAM,0
endc
GentlemanData: ; 3a3ef (e:63ef)
	db 18,GROWLITHE,GROWLITHE,0
	db 19,NIDORAN_M,NIDORAN_F,0
if _YELLOW
	db 22,VOLTORB,MAGNEMITE,0
else
	db 23,PIKACHU,0
endc
	db 48,PRIMEAPE,0
	db 17,GROWLITHE,PONYTA,0
Green2Data: ; 3a401 (e:6401)
if _YELLOW
	db $FF,19,SPEAROW,16,RATTATA,18,SANDSHREW,20,EEVEE,0
	db $FF,25,FEAROW,23,SHELLDER,22,VULPIX,20,SANDSHREW,25,EEVEE,0
	db $FF,25,FEAROW,23,MAGNEMITE,22,SHELLDER,20,SANDSHREW,25,EEVEE,0
	db $FF,25,FEAROW,23,VULPIX,22,MAGNEMITE,20,SANDSHREW,25,EEVEE,0
	db $FF,38,SANDSLASH,35,NINETALES,37,CLOYSTER,35,KADABRA,40,JOLTEON,0
	db $FF,38,SANDSLASH,35,CLOYSTER,37,MAGNETON,35,KADABRA,40,FLAREON,0
	db $FF,38,SANDSLASH,35,MAGNETON,37,NINETALES,35,KADABRA,40,VAPOREON,0
	db $FF,47,SANDSLASH,45,EXEGGCUTE,45,NINETALES,47,CLOYSTER,50,KADABRA,53,JOLTEON,0
	db $FF,47,SANDSLASH,45,EXEGGCUTE,45,CLOYSTER,47,MAGNETON,50,KADABRA,53,FLAREON,0
	db $FF,47,SANDSLASH,45,EXEGGCUTE,45,MAGNETON,47,NINETALES,50,KADABRA,53,VAPOREON,0
else
	db $FF,19,PIDGEOTTO,16,RATICATE,18,KADABRA,20,WARTORTLE,0
	db $FF,19,PIDGEOTTO,16,RATICATE,18,KADABRA,20,IVYSAUR,0
	db $FF,19,PIDGEOTTO,16,RATICATE,18,KADABRA,20,CHARMELEON,0
	db $FF,25,PIDGEOTTO,23,GROWLITHE,22,EXEGGCUTE,20,KADABRA,25,WARTORTLE,0
	db $FF,25,PIDGEOTTO,23,GYARADOS,22,GROWLITHE,20,KADABRA,25,IVYSAUR,0
	db $FF,25,PIDGEOTTO,23,EXEGGCUTE,22,GYARADOS,20,KADABRA,25,CHARMELEON,0
	db $FF,37,PIDGEOT,38,GROWLITHE,35,EXEGGCUTE,35,ALAKAZAM,40,BLASTOISE,0
	db $FF,37,PIDGEOT,38,GYARADOS,35,GROWLITHE,35,ALAKAZAM,40,VENUSAUR,0
	db $FF,37,PIDGEOT,38,EXEGGCUTE,35,GYARADOS,35,ALAKAZAM,40,CHARIZARD,0
	db $FF,47,PIDGEOT,45,RHYHORN,45,GROWLITHE,47,EXEGGCUTE,50,ALAKAZAM,53,BLASTOISE,0
	db $FF,47,PIDGEOT,45,RHYHORN,45,GYARADOS,47,GROWLITHE,50,ALAKAZAM,53,VENUSAUR,0
	db $FF,47,PIDGEOT,45,RHYHORN,45,EXEGGCUTE,47,GYARADOS,50,ALAKAZAM,53,CHARIZARD,0
endc
Green3Data: ; 3a491 (e:6491)
if _YELLOW
	db $FF,61,SANDSLASH,59,ALAKAZAM,61,EXEGGUTOR,61,CLOYSTER,63,NINETALES,65,JOLTEON,0
	db $FF,61,SANDSLASH,59,ALAKAZAM,61,EXEGGUTOR,61,MAGNETON,63,CLOYSTER,65,FLAREON,0
	db $FF,61,SANDSLASH,59,ALAKAZAM,61,EXEGGUTOR,61,NINETALES,63,MAGNETON,65,VAPOREON,0
else
	db $FF,61,PIDGEOT,59,ALAKAZAM,61,RHYDON,61,ARCANINE,63,EXEGGUTOR,65,BLASTOISE,0
	db $FF,61,PIDGEOT,59,ALAKAZAM,61,RHYDON,61,GYARADOS,63,ARCANINE,65,VENUSAUR,0
	db $FF,61,PIDGEOT,59,ALAKAZAM,61,RHYDON,61,EXEGGUTOR,63,GYARADOS,65,CHARIZARD,0
endc
LoreleiData: ; 3a4bb (e:64bb)
	db $FF,54,DEWGONG,53,CLOYSTER,54,SLOWBRO,56,JYNX,56,LAPRAS,0
ChannelerData: ; 3a4c7 (e:64c7)
	db 22,GASTLY,0
	db 24,GASTLY,0
	db 23,GASTLY,GASTLY,0
	db 24,GASTLY,0
	db 23,GASTLY,0
	db 24,GASTLY,0
	db 24,HAUNTER,0
	db 22,GASTLY,0
	db 24,GASTLY,0
	db 23,GASTLY,GASTLY,0
	db 24,GASTLY,0
	db 22,GASTLY,0
	db 24,GASTLY,0
	db 23,HAUNTER,0
	db 24,GASTLY,0
	db 22,GASTLY,0
	db 24,GASTLY,0
	db 22,HAUNTER,0
	db 22,GASTLY,GASTLY,GASTLY,0
	db 24,GASTLY,0
	db 24,GASTLY,0
	db 34,GASTLY,HAUNTER,0
	db 38,HAUNTER,0
	db 33,GASTLY,GASTLY,HAUNTER,0
AgathaData: ; 3a516 (e:6516)
	db $FF,56,GENGAR,56,GOLBAT,55,HAUNTER,58,ARBOK,60,GENGAR,0
LanceData: ; 3a522 (e:6522)
	db $FF,58,GYARADOS,56,DRAGONAIR,56,DRAGONAIR,60,AERODACTYL,62,DRAGONITE,0

TrainerAI: ; 3a52e (e:652e)
;XXX called at 34964, 3c342, 3c398
	and a
	ld a,[W_ISINBATTLE]
	dec a
	ret z ; if not a trainer, we're done here
	ld a,[W_ISLINKBATTLE]
	cp 4
	ret z
	ld a,[W_TRAINERCLASS] ; what trainer class is this?
	dec a
	ld c,a
	ld b,0
	ld hl,TrainerAIPointers
	add hl,bc
	add hl,bc
	add hl,bc
	ld a,[W_AICOUNT]
	and a
	ret z ; if no AI uses left, we're done here
	inc hl
	inc a
	jr nz,.getpointer
	dec hl
	ld a,[hli]
	ld [W_AICOUNT],a
.getpointer
	ld a,[hli]
	ld h,[hl]
	ld l,a
	call GenRandom
	jp [hl]

TrainerAIPointers: ; 3a55c (e:655c)
; one entry per trainer class
; first byte, number of times (per Pokémon) it can occur
; next two bytes, pointer to AI subroutine for trainer class
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,JugglerAI ; juggler_x
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 3,JugglerAI ; juggler
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 2,BlackbeltAI ; blackbelt
	dbw 3,GenericAI
	dbw 3,GenericAI
	dbw 1,GenericAI ; chief
	dbw 3,GenericAI
	dbw 1,GiovanniAI ; giovanni
	dbw 3,GenericAI
	dbw 2,CooltrainerMAI ; cooltrainerm
	dbw 1,CooltrainerFAI ; cooltrainerf
	dbw 2,BrunoAI ; bruno
	dbw 5,BrockAI ; brock
	dbw 1,MistyAI ; misty
	dbw 1,LtSurgeAI ; surge
	dbw 1,ErikaAI ; erika
	dbw 2,KogaAI ; koga
	dbw 2,BlaineAI ; blaine
	dbw 1,SabrinaAI ; sabrina
	dbw 3,GenericAI
	dbw 1,Sony2AI ; sony2
	dbw 1,Sony3AI ; sony3
	dbw 2,LoreleiAI ; lorelei
	dbw 3,GenericAI
	dbw 2,AgathaAI ; agatha
	dbw 1,LanceAI ; lance

JugglerAI: ; 3a5e9 (e:65e9)
	cp $40
	ret nc
	jp Function672A

BlackbeltAI: ; 3a5ef (e:65ef)
	cp $20
	ret nc
	jp AIUseXAttack

GiovanniAI: ; 3a5f5 (e:65f5)
	cp $40
	ret nc
	jp AIUseGuardSpec

CooltrainerMAI: ; 3a5fb (e:65fb)
	cp $40
	ret nc
	jp AIUseXAttack

CooltrainerFAI: ; 3a601 (e:6601)
	cp $40
	ld a,$A
	call Function67CF
	jp c,AIUseHyperPotion
	ld a,5
	call Function67CF
	ret nc
	jp Function672A

BrockAI: ; 3a614 (e:6614)
; if his active monster has a status condition, use a full heal
	ld a,[W_ENEMYMONSTATUS]
	and a
	ret z
	jp AIUseFullHeal

MistyAI: ; 3a61c (e:661c)
	cp $40
	ret nc
	jp AIUseXDefend

LtSurgeAI: ; 3a622 (e:6622)
	cp $40
	ret nc
	jp AIUseXSpeed

ErikaAI: ; 3a628 (e:6628)
	cp $80
	ret nc
	ld a,$A
	call Function67CF
	ret nc
	jp AIUseSuperPotion

KogaAI: ; 3a634 (e:6634)
	cp $40
	ret nc
	jp AIUseXAttack

BlaineAI: ; 3a63a (e:663a)
	cp $40
	ret nc
	jp AIUseSuperPotion

SabrinaAI: ; 3a640 (e:6640)
	cp $40
	ret nc
	ld a,$A
	call Function67CF
	ret nc
	jp AIUseHyperPotion

Sony2AI: ; 3a64c (e:664c)
	cp $20
	ret nc
	ld a,5
	call Function67CF
	ret nc
	jp AIUsePotion

Sony3AI: ; 3a658 (e:6658)
	cp $20
	ret nc
	ld a,5
	call Function67CF
	ret nc
	jp AIUseFullRestore

LoreleiAI: ; 3a664 (e:6664)
	cp $80
	ret nc
	ld a,5
	call Function67CF
	ret nc
	jp AIUseSuperPotion

BrunoAI: ; 3a670 (e:6670)
	cp $40
	ret nc
	jp AIUseXDefend

AgathaAI: ; 3a676 (e:6676)
	cp $14
	jp c,Function672A
	cp $80
	ret nc
	ld a,4
	call Function67CF
	ret nc
	jp AIUseSuperPotion

LanceAI: ; 3a687 (e:6687)
	cp $80
	ret nc
	ld a,5
	call Function67CF
	ret nc
	jp AIUseHyperPotion

GenericAI: ; 3a693 (e:6693)
	and a ; clear carry
	ret

; end of individual trainer AI routines

DecrementAICount: ; 3a695 (e:6695)
	ld hl,W_AICOUNT
	dec [hl]
	scf
	ret

Function669B: ; 3a69b (e:669b)
; XXX what does this do
	ld a,$8E
	jp PlaySoundWaitForCurrent

AIUseFullRestore: ; 3a6a0 (e:66a0)
	call AICureStatus
	ld a,FULL_RESTORE
	ld [$CF05],a
	ld de,W_HPBAROLDHP
	ld hl,$CFE7
	ld a,[hld]
	ld [de],a
	inc de
	ld a,[hl]
	ld [de],a
	inc de
	ld hl,$CFF5
	ld a,[hld]
	ld [de],a
	inc de
	ld [W_HPBARMAXHP],a
	ld [$CFE7],a
	ld a,[hl]
	ld [de],a
	ld [W_HPBARMAXHP+1],a
	ld [W_ENEMYMONCURHP],a
	jr Function6718
; 0x3a6ca

AIUsePotion: ; 3a6ca (e:66ca)
; enemy trainer heals his monster with a potion
	ld a,POTION
	ld b,20
	jr AIRecoverHP

AIUseSuperPotion: ; 3a6d0 (e:66d0)
; enemy trainer heals his monster with a super potion
	ld a,SUPER_POTION
	ld b,50
	jr AIRecoverHP

AIUseHyperPotion: ; 3a6d6 (e:66d6)
; enemy trainer heals his monster with a hyper potion
	ld a,HYPER_POTION
	ld b,200
	; fallthrough

AIRecoverHP: ; 3a6da (e:66da)
; heal b HP and print "trainer used $(a) on pokemon!"
	ld [$CF05],a
	ld hl,$CFE7
	ld a,[hl]
	ld [W_HPBAROLDHP],a
	add b
	ld [hld],a
	ld [W_HPBARNEWHP],a
	ld a,[hl]
	ld [W_HPBAROLDHP+1],a
	ld [W_HPBARNEWHP+1],a
	jr nc,.next
	inc a
	ld [hl],a
	ld [W_HPBARNEWHP+1],a
.next
	inc hl
	ld a,[hld]
	ld b,a
	ld de,$CFF5
	ld a,[de]
	dec de
	ld [W_HPBARMAXHP],a
	sub b
	ld a,[hli]
	ld b,a
	ld a,[de]
	ld [W_HPBARMAXHP+1],a
	sbc b
	jr nc,Function6718
	inc de
	ld a,[de]
	dec de
	ld [hld],a
	ld [W_HPBARNEWHP],a
	ld a,[de]
	ld [hl],a
	ld [W_HPBARNEWHP+1],a
	; fallthrough

Function6718: ; 3a718 (e:6718)
	call AIPrintItemUse_
	FuncCoord 2, 2 ; $c3ca
	ld hl,Coord
	xor a
	ld [$CF94],a
	ld a,$48
	call Predef
	jp DecrementAICount

Function672A: ; 3a72a (e:672a)
	ld a,[W_ENEMYMONCOUNT]
	ld c,a
	ld hl,W_ENEMYMON1HP

	ld d,0 ; keep count of unfainted monsters

	; count how many monsters haven't fainted yet
.loop
	ld a,[hli]
	ld b,a
	ld a,[hld]
	or b
	jr z,.Fainted ; has monster fainted?
	inc d
.Fainted
	push bc
	ld bc,$2C
	add hl,bc
	pop bc
	dec c
	jr nz,.loop

	ld a,d ; how many available monsters are there?
	cp 2 ; don't bother if only 1 or 2
	jp nc,Function674B ; XXX check, does this jump when a = 2?
	and a
	ret

Function674B: ; 3a74b (e:674b)

; prepare to withdraw the active monster: copy hp, number, and status to roster

	ld a,[W_ENEMYMONNUMBER]
	ld hl,W_ENEMYMON1HP
	ld bc,$2C
	call AddNTimes
	ld d,h
	ld e,l
	ld hl,W_ENEMYMONCURHP
	ld bc,4
	call CopyData

	ld hl, AIBattleWithdrawText
	call PrintText

	ld a,1
	ld [$D11D],a
	ld hl,EnemySendOut
	ld b,BANK(EnemySendOut)
	call Bankswitch
	xor a
	ld [$D11D],a

	ld a,[W_ISLINKBATTLE]
	cp 4
	ret z
	scf
	ret

AIBattleWithdrawText: ; 3a781 (e:6781)
	TX_FAR _AIBattleWithdrawText
	db "@"

AIUseFullHeal: ; 3a786 (e:6786)
	call Function669B
	call AICureStatus
	ld a,FULL_HEAL
	jp AIPrintItemUse

AICureStatus: ; 3a791 (e:6791)
; cures the status of enemy's active pokemon
	ld a,[W_ENEMYMONNUMBER]
	ld hl,$D8A8
	ld bc,$2C
	call AddNTimes
	xor a
	ld [hl],a ; clear status in enemy team roster
	ld [W_ENEMYMONSTATUS],a ; clear status of active enemy
	ld hl,$D069
	res 0,[hl]
	ret

AIUseXAccuracy: ; 0x3a7a8 unused
	call Function669B
	ld hl,$D068
	set 0,[hl]
	ld a,X_ACCURACY
	jp AIPrintItemUse

AIUseGuardSpec: ; 3a7b5 (e:67b5)
	call Function669B
	ld hl,$D068
	set 1,[hl]
	ld a,GUARD_SPEC_
	jp AIPrintItemUse

AIUseDireHit: ; 0x3a7c2 unused
	call Function669B
	ld hl,$D068
	set 2,[hl]
	ld a,DIRE_HIT
	jp AIPrintItemUse

Function67CF: ; 3a7cf (e:67cf)
	ld [H_DIVISOR],a
	ld hl,$CFF4
	ld a,[hli]
	ld [H_DIVIDEND],a
	ld a,[hl]
	ld [H_DIVIDEND + 1],a
	ld b,2
	call Divide
	ld a,[H_QUOTIENT + 3]
	ld c,a
	ld a,[H_QUOTIENT + 2]
	ld b,a
	ld hl,$CFE7
	ld a,[hld]
	ld e,a
	ld a,[hl]
	ld d,a
	ld a,d
	sub b
	ret nz
	ld a,e
	sub c
	ret

AIUseXAttack: ; 3a7f2 (e:67f2)
	ld b,$A
	ld a,X_ATTACK
	jr AIIncreaseStat

AIUseXDefend: ; 3a7f8 (e:67f8)
	ld b,$B
	ld a,X_DEFEND
	jr AIIncreaseStat

AIUseXSpeed: ; 3a7fe (e:67fe)
	ld b,$C
	ld a,X_SPEED
	jr AIIncreaseStat

AIUseXSpecial: ; 3a804 (e:6804)
	ld b,$D
	ld a,X_SPECIAL
	; fallthrough

AIIncreaseStat: ; 3a808 (e:6808)
	ld [$CF05],a
	push bc
	call AIPrintItemUse_
	pop bc
	ld hl,$CFCD
	ld a,[hld]
	push af
	ld a,[hl]
	push af
	push hl
	ld a,$AF
	ld [hli],a
	ld [hl],b
	ld hl, Func_3f428
	ld b, BANK(Func_3f428)
	call Bankswitch
	pop hl
	pop af
	ld [hli],a
	pop af
	ld [hl],a
	jp DecrementAICount

AIPrintItemUse: ; 3a82c (e:682c)
	ld [$CF05],a
	call AIPrintItemUse_
	jp DecrementAICount

AIPrintItemUse_: ; 3a835 (e:6835)
; print "x used [$CF05] on z!"
	ld a,[$CF05]
	ld [$D11E],a
	call GetItemName
	ld hl, AIBattleUseItemText
	jp PrintText

AIBattleUseItemText: ; 3a844 (e:6844)
	TX_FAR _AIBattleUseItemText
	db "@"

; known jump sources: 58dcf (16:4dcf)
Func_3a849: ; 3a849 (e:6849)
	call Func_3a85d
	call Func_3a869
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	ret z
	jp Func_3a887

; known jump sources: 3c671 (f:4671)
Func_3a857: ; 3a857 (e:6857)
	call Func_3a85d
	jp Func_3a887

; known jump sources: 3a849 (e:6849), 3a857 (e:6857), 3a948 (e:6948)
Func_3a85d: ; 3a85d (e:685d)
	ld de, PokeballTileGraphics ; $697e
	ld hl, $8310
	ld bc, (BANK(PokeballTileGraphics) << 8) + $04
	jp CopyVideoData

; known jump sources: 3a84c (e:684c)
Func_3a869: ; 3a869 (e:6869)
	call Func_3a902
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	ld de, W_NUMINPARTY ; $d163
	call Func_3a8a6
	ld a, $60
	ld hl, W_BASECOORDX ; $d081
	ld [hli], a
	ld [hl], a
	ld a, $8
	ld [$cd3e], a
	ld hl, W_OAMBUFFER
	jp Func_3a8e1

; known jump sources: 3a854 (e:6854), 3a85a (e:685a)
Func_3a887: ; 3a887 (e:6887)
	call Func_3a919
	ld hl, W_WATERRATE ; $d8a4
	ld de, W_ENEMYMONCOUNT ; $d89c
	call Func_3a8a6
	ld hl, W_BASECOORDX ; $d081
	ld a, $48
	ld [hli], a
	ld [hl], $20
	ld a, $f8
	ld [$cd3e], a
	ld hl, $c318
	jp Func_3a8e1

; known jump sources: 3a872 (e:6872), 3a890 (e:6890), 3a951 (e:6951), 3a96d (e:696d)
Func_3a8a6: ; 3a8a6 (e:68a6)
	ld a, [de]
	push af
	ld de, $cee9
	ld c, $6
	ld a, $34
.asm_3a8af
	ld [de], a
	inc de
	dec c
	jr nz, .asm_3a8af
	pop af
	ld de, $cee9
.asm_3a8b8
	push af
	call Func_3a8c2
	inc de
	pop af
	dec a
	jr nz, .asm_3a8b8
	ret

; known jump sources: 3a8b9 (e:68b9)
Func_3a8c2: ; 3a8c2 (e:68c2)
	inc hl
	ld a, [hli]
	and a
	jr nz, .asm_3a8cd
	ld a, [hl]
	and a
	ld b, $33
	jr z, .asm_3a8d8
.asm_3a8cd
	inc hl
	inc hl
	ld a, [hl]
	and a
	ld b, $32
	jr nz, .asm_3a8da
	dec b
	jr .asm_3a8da
.asm_3a8d8
	inc hl
	inc hl
.asm_3a8da
	ld a, b
	ld [de], a
	ld bc, $28
	add hl, bc
	ret

; known jump sources: 3a884 (e:6884), 3a8a3 (e:68a3), 3a964 (e:6964), 3a97b (e:697b)
Func_3a8e1: ; 3a8e1 (e:68e1)
	ld de, $cee9
	ld c, $6
.asm_3a8e6
	ld a, [W_BASECOORDY] ; $d082
	ld [hli], a
	ld a, [W_BASECOORDX] ; $d081
	ld [hli], a
	ld a, [de]
	ld [hli], a
	xor a
	ld [hli], a
	ld a, [W_BASECOORDX] ; $d081
	ld b, a
	ld a, [$cd3e]
	add b
	ld [W_BASECOORDX], a ; $d081
	inc de
	dec c
	jr nz, .asm_3a8e6
	ret

; known jump sources: 3a869 (e:6869), 3cd71 (f:4d71)
Func_3a902: ; 3a902 (e:6902)
	ld hl, Unknown_3a916 ; $6916
	ld de, $cd3f
	ld bc, $3
	call CopyData
	FuncCoord 18, 10 ; $c47a
	ld hl, Coord
	ld de, rIE ; $ffff
	jr asm_3a930

Unknown_3a916: ; 3a916 (e:6916)
INCBIN "baserom.gbc",$3a916,$3a919 - $3a916

; known jump sources: 3a887 (e:6887), 3cdfd (f:4dfd)
Func_3a919: ; 3a919 (e:6919)
	ld hl, Unknown_3a92d ; $692d
	ld de, $cd3f
	ld bc, $3
	call CopyData
	FuncCoord 1, 2 ; $c3c9
	ld hl, Coord
	ld de, $1
	jr asm_3a930

Unknown_3a92d: ; 3a92d (e:692d)
INCBIN "baserom.gbc",$3a92d,$3a930 - $3a92d
asm_3a930: ; 3a930 (e:6930)
	ld [hl], $73
	ld bc, $14
	add hl, bc
	ld a, [$cd40]
	ld [hl], a
	ld a, $8
.asm_3a93c
	add hl, de
	ld [hl], $76
	dec a
	jr nz, .asm_3a93c
	add hl, de
	ld a, [$cd41]
	ld [hl], a
	ret

; known jump sources: 37306 (d:7306)
Func_3a948: ; 3a948 (e:6948)
	call Func_3a85d
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	ld de, W_NUMINPARTY ; $d163
	call Func_3a8a6
	ld hl, W_BASECOORDX ; $d081
	ld a, $50
	ld [hli], a
	ld [hl], $40
	ld a, $8
	ld [$cd3e], a
	ld hl, W_OAMBUFFER
	call Func_3a8e1
	ld hl, W_WATERRATE ; $d8a4
	ld de, W_ENEMYMONCOUNT ; $d89c
	call Func_3a8a6
	ld hl, W_BASECOORDX ; $d081
	ld a, $50
	ld [hli], a
	ld [hl], $68
	ld hl, $c318
	jp Func_3a8e1

; four tiles: pokeball, black pokeball (status ailment), crossed out pokeball (faited) and pokeball slot (no mon)
PokeballTileGraphics: ; 3a97e (e:697e)
INCBIN "gfx/pokeball.2bpp"

; tiles for gameboy and link cable graphics used for trading sequence animation
TradingAnimationGraphics: ; 3a9be (e:69be)
INCBIN "gfx/trade.2bpp"

; 4 tiles for actual wire transfer animation (pokeball wandering inside wire)
TradingAnimationGraphics2: ; 3acce (e:6cce)
INCBIN "baserom.gbc",$3acce,$3ad0e - $3acce

; known jump sources: df11 (3:5f11), 17da3 (5:7da3)
Func_3ad0e: ; 3ad0e (e:6d0e)
	ld hl, $ccd3
	xor a
	ld [hl], a
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld c, a
	ld b, $1
	call Func_3b057

; known jump sources: 13810 (4:7810)
Func_3ad1c: ; 3ad1c (e:6d1c)
	ld a, [$FF00+$d7]
	push af
	xor a
	ld [$d121], a
	dec a
	ld [W_WHICHPOKEMON], a ; $cf92
	push hl
	push bc
	push de
	ld hl, W_NUMINPARTY ; $d163
	push hl
asm_3ad2e: ; 3ad2e (e:6d2e)
	ld hl, W_WHICHPOKEMON ; $cf92
	inc [hl]
	pop hl
	inc hl
	ld a, [hl]
	cp $ff
	jp z, Func_3aede
	ld [$cee9], a
	push hl
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld c, a
	ld hl, $ccd3
	ld b, $2
	call Func_3b057
	ld a, c
	and a
	jp z, asm_3ad2e
	ld a, [$cee9]
	dec a
	ld b, $0
	ld hl, EvosMovesPointerTable
	add a
	rl b
	ld c, a
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	push hl
	ld a, [$cf91]
	push af
	xor a
	ld [$cc49], a
	call LoadMonData
	pop af
	ld [$cf91], a
	pop hl

; known jump sources: 3aedb (e:6edb)
Func_3ad71: ; 3ad71 (e:6d71)
	ld a, [hli]
	and a
	jr z, asm_3ad2e
	ld b, a
	cp $3
	jr z, .asm_3ad91
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $32
	jr z, asm_3ad2e
	ld a, b
	cp $2
	jr z, .asm_3ada4
	ld a, [$ccd4]
	and a
	jr nz, asm_3ad2e
	ld a, b
	cp $1
	jr z, .asm_3adad
.asm_3ad91
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $32
	jp nz, Func_3aed9
	ld a, [hli]
	ld b, a
	ld a, [$cfb9]
	cp b
	jp c, asm_3ad2e
	jr .asm_3adb6
.asm_3ada4
	ld a, [hli]
	ld b, a
	ld a, [$cf91]
	cp b
	jp nz, Func_3aed9
.asm_3adad
	ld a, [hli]
	ld b, a
	ld a, [$cfb9]
	cp b
	jp c, Func_3aeda
.asm_3adb6
	ld [W_CURENEMYLVL], a ; $d127
	ld a, $1
	ld [$d121], a
	push hl
	ld a, [hl]
	ld [$ceea], a
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, W_PARTYMON1NAME ; $d2b5
	call GetPartyMonName
	call CopyStringToCF4B
	ld hl, UnnamedText_3af4d ; $6f4d
	call PrintText
	ld c, $32
	call DelayFrames
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld hl, W_SCREENTILESBUFFER
	ld bc, $c14
	call ClearScreenArea
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, $ff
	ld [$cfcb], a
	call CleanLCD_OAM
	ld hl, Func_7bde9
	ld b, BANK(Func_7bde9)
	call Bankswitch ; indirect jump to Func_7bde9 (7bde9 (1e:7de9))
	jp c, Func_3af2e
	ld hl, UnnamedText_3af3e ; $6f3e
	call PrintText
	pop hl
	ld a, [hl]
	ld [$d0b5], a
	ld [$cf98], a
	ld [$ceea], a
	ld a, MONSTER_NAME
	ld [W_LISTTYPE], a
	ld a, $e
	ld [$d0b7], a
	call GetName
	push hl
	ld hl, UnnamedText_3af43 ; $6f43
	call Func_3c59
	ld a, $89
	call PlaySoundWaitForCurrent
	call WaitForSoundToFinish
	ld c, $28
	call DelayFrames
	call ClearScreen
	call Func_3aef7
	ld a, [$d11e]
	push af
	ld a, [$d0b5]
	ld [$d11e], a
	ld a, $3a
	call Predef ; indirect jump to IndexToPokedex (41010 (10:5010))
	ld a, [$d11e]
	dec a
	ld hl, BulbasaurBaseStats ; $43de
	ld bc, $1c
	call AddNTimes
	ld de, W_MONHEADER
	call CopyData
	ld a, [$d0b5]
	ld [$d0b8], a
	pop af
	ld [$d11e], a
	ld hl, $cfa8
	ld de, $cfba
	ld b, $1
	call CalcStats
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	ld bc, $2c
	call AddNTimes
	ld e, l
	ld d, h
	push hl
	push bc
	ld bc, $22
	add hl, bc
	ld a, [hli]
	ld b, a
	ld c, [hl]
	ld hl, $cfbb
	ld a, [hld]
	sub c
	ld c, a
	ld a, [hl]
	sbc b
	ld b, a
	ld hl, $cf9a
	ld a, [hl]
	add c
	ld [hld], a
	ld a, [hl]
	adc b
	ld [hl], a
	dec hl
	pop bc
	call CopyData
	ld a, [$d0b5]
	ld [$d11e], a
	xor a
	ld [$cc49], a
	call Func_3af5b
	pop hl
	ld a, $42
	call Predef ; indirect jump to SetPartyMonTypes (5db5e (17:5b5e))
	ld a, [W_ISINBATTLE] ; $d057
	and a
	call z, Func_3af52
	ld a, $3a
	call Predef ; indirect jump to IndexToPokedex (41010 (10:5010))
	ld a, [$d11e]
	dec a
	ld c, a
	ld b, $1
	ld hl, W_OWNEDPOKEMON ; $d2f7
	push bc
	call Func_3b057
	pop bc
	ld hl, W_SEENPOKEMON ; $d30a
	call Func_3b057
	pop de
	pop hl
	ld a, [$cf98]
	ld [hl], a
	push hl
	ld l, e
	ld h, d
	jr Func_3aeda

; known jump sources: 3ad96 (e:6d96), 3adaa (e:6daa)
Func_3aed9: ; 3aed9 (e:6ed9)
	inc hl

; known jump sources: 3adb3 (e:6db3), 3aed7 (e:6ed7)
Func_3aeda: ; 3aeda (e:6eda)
	inc hl
	jp Func_3ad71

; known jump sources: 3ad37 (e:6d37)
Func_3aede: ; 3aede (e:6ede)
	pop de
	pop bc
	pop hl
	pop af
	ld [$FF00+$d7], a
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $32
	ret z
	ld a, [W_ISINBATTLE] ; $d057
	and a
	ret nz
	ld a, [$d121]
	and a
	call nz, Func_2307
	ret

; known jump sources: 3ae32 (e:6e32)
Func_3aef7: ; 3aef7 (e:6ef7)
	ld a, [$d0b5]
	push af
	ld a, [$d0b8]
	ld [$d0b5], a
	call GetName
	pop af
	ld [$d0b5], a
	ld hl, $cd6d
	ld de, $cf4b
.asm_3af0e
	ld a, [de]
	inc de
	cp [hl]
	inc hl
	ret nz
	cp $50
	jr nz, .asm_3af0e
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld bc, $b
	ld hl, W_PARTYMON1NAME ; $d2b5
	call AddNTimes
	push hl
	call GetName
	ld hl, $cd6d
	pop de
	jp CopyData

; known jump sources: 3adfa (e:6dfa)
Func_3af2e: ; 3af2e (e:6f2e)
	ld hl, UnnamedText_3af48 ; $6f48
	call PrintText
	call ClearScreen
	pop hl
	call Func_3af52
	jp asm_3ad2e
; 3af3e (e:6f3e)
UnnamedText_3af3e: ; 3af3e (e:6f3e)
	TX_FAR _UnnamedText_3af3e
	db $50
; 0x3af3e + 5 bytes

UnnamedText_3af43: ; 3af43 (e:6f43)
	TX_FAR _UnnamedText_3af43
	db $50
; 0x3af43 + 5 bytes

UnnamedText_3af48: ; 3af48 (e:6f48)
	TX_FAR _UnnamedText_3af48
	db $50
; 0x3af48 + 5 bytes

UnnamedText_3af4d: ; 3af4d (e:6f4d)
	TX_FAR _UnnamedText_3af4d
	db $50
; 0x3af4d + 5 bytes

; known jump sources: 3aeb1 (e:6eb1), 3af38 (e:6f38)
Func_3af52: ; 3af52 (e:6f52)
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $32
	ret z
	jp ReloadTilesetTilePatterns

; known jump sources: df05 (3:5f05), 3aea4 (e:6ea4), 55420 (15:5420)
Func_3af5b: ; 3af5b (e:6f5b)
	ld hl, EvosMovesPointerTable
	ld a, [$d11e]
	ld [$cf91], a
	dec a
	ld bc, $0
	ld hl, EvosMovesPointerTable
	add a
	rl b
	ld c, a
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
.asm_3af73
	ld a, [hli]
	and a
	jr nz, .asm_3af73
.asm_3af77
	ld a, [hli]
	and a
	jr z, .asm_3afb1
	ld b, a
	ld a, [W_CURENEMYLVL] ; $d127
	cp b
	ld a, [hli]
	jr nz, .asm_3af77
	ld d, a
	ld a, [$cc49]
	and a
	jr nz, .asm_3af96
	ld hl, W_PARTYMON1_MOVE1 ; $d173
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld bc, $2c
	call AddNTimes
.asm_3af96
	ld b, $4
.asm_3af98
	ld a, [hli]
	cp d
	jr z, .asm_3afb1
	dec b
	jr nz, .asm_3af98
	ld a, d
	ld [$d0e0], a
	ld [$d11e], a
	call GetMoveName
	call CopyStringToCF4B
	ld a, $1b
	call Predef ; indirect jump to Func_6e43 (6e43 (1:6e43))
.asm_3afb1
	ld a, [$cf91]
	ld [$d11e], a
	ret

; known jump sources: f419 (3:7419), 3ebc7 (f:6bc7)
; writes the moves a mon has at level [W_CURENEMYLVL] to [de]
; move slots are being filled up sequentially and shifted if all slots are full
; [$cee9]: (?)
WriteMonMoves: ; 3afb8 (e:6fb8)
	call Load16BitRegisters
	push hl
	push de
	push bc
	ld hl, EvosMovesPointerTable
	ld b, $0
	ld a, [$cf91]  ; cur mon ID
	dec a
	add a
	rl b
	ld c, a
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
.skipEvoEntriesLoop
	ld a, [hli]
	and a
	jr nz, .skipEvoEntriesLoop
	jr .firstMove
.nextMove
	pop de
.nextMove2
	inc hl
.firstMove
	ld a, [hli]       ; read level of next move in learnset
	and a
	jp z, .done       ; end of list
	ld b, a
	ld a, [W_CURENEMYLVL] ; $d127
	cp b
	jp c, .done       ; mon level < move level (assumption: learnset is sorted by level)
	ld a, [$cee9]
	and a
	jr z, .skipMinLevelCheck
	ld a, [W_WHICHTRADE] ; $cd3d (min move level)
	cp b
	jr nc, .nextMove2 ; min level >= move level
.skipMinLevelCheck
	push de
	ld c, $4
.moveAlreadyLearnedCheckLoop
	ld a, [de]
	inc de
	cp [hl]
	jr z, .nextMove
	dec c
	jr nz, .moveAlreadyLearnedCheckLoop
	pop de
	push de
	ld c, $4
.findEmptySlotLoop
	ld a, [de]
	and a
	jr z, .writeMoveToSlot2
	inc de
	dec c
	jr nz, .findEmptySlotLoop
	pop de                        ; no empty move slots found
	push de
	push hl
	ld h, d
	ld l, e
	call WriteMonMoves_ShiftMoveData ; shift all moves one up (deleting move 1)
	ld a, [$cee9]
	and a
	jr z, .writeMoveToSlot
	push de
	ld bc, $12
	add hl, bc
	ld d, h
	ld e, l
	call WriteMonMoves_ShiftMoveData ; shift all move PP data one up
	pop de
.writeMoveToSlot
	pop hl
.writeMoveToSlot2
	ld a, [hl]
	ld [de], a
	ld a, [$cee9]
	and a
	jr z, .nextMove
	push hl            ; write move PP value
	ld a, [hl]
	ld hl, $15
	add hl, de
	push hl
	dec a
	ld hl, Moves
	ld bc, $6
	call AddNTimes
	ld de, $cee9
	ld a, BANK(Moves)
	call FarCopyData
	ld a, [$ceee]
	pop hl
	ld [hl], a
	pop hl
	jr .nextMove
.done
	pop bc
	pop de
	pop hl
	ret

; shifts all move data one up (freeing 4th move slot)
WriteMonMoves_ShiftMoveData: ; 3b04e (e:704e)
	ld c, $3
.asm_3b050
	inc de
	ld a, [de]
	ld [hli], a
	dec c
	jr nz, .asm_3b050
	ret

; known jump sources: 3ad19 (e:6d19), 3ad47 (e:6d47), 3aec4 (e:6ec4), 3aecb (e:6ecb)
Func_3b057: ; 3b057 (e:7057)
	ld a, $10
	jp Predef ; indirect jump to HandleBitArray (f666 (3:7666))
; 3b05c (e:705c)

EvosMovesPointerTable: ; 3b05c (e:705c)
	dw Mon112_EvosMoves
	dw Mon115_EvosMoves
	dw Mon032_EvosMoves
	dw Mon035_EvosMoves
	dw Mon021_EvosMoves
	dw Mon100_EvosMoves
	dw Mon034_EvosMoves
	dw Mon080_EvosMoves
	dw Mon002_EvosMoves
	dw Mon103_EvosMoves
	dw Mon108_EvosMoves
	dw Mon102_EvosMoves
	dw Mon088_EvosMoves
	dw Mon094_EvosMoves
	dw Mon029_EvosMoves
	dw Mon031_EvosMoves
	dw Mon104_EvosMoves
	dw Mon111_EvosMoves
	dw Mon131_EvosMoves
	dw Mon059_EvosMoves
	dw Mon151_EvosMoves
	dw Mon130_EvosMoves
	dw Mon090_EvosMoves
	dw Mon072_EvosMoves
	dw Mon092_EvosMoves
	dw Mon123_EvosMoves
	dw Mon120_EvosMoves
	dw Mon009_EvosMoves
	dw Mon127_EvosMoves
	dw Mon114_EvosMoves
	dw Mon152_EvosMoves	;MissingNo
	dw Mon153_EvosMoves	;MissingNo
	dw Mon058_EvosMoves
	dw Mon095_EvosMoves
	dw Mon022_EvosMoves
	dw Mon016_EvosMoves
	dw Mon079_EvosMoves
	dw Mon064_EvosMoves
	dw Mon075_EvosMoves
	dw Mon113_EvosMoves
	dw Mon067_EvosMoves
	dw Mon122_EvosMoves
	dw Mon106_EvosMoves
	dw Mon107_EvosMoves
	dw Mon024_EvosMoves
	dw Mon047_EvosMoves
	dw Mon054_EvosMoves
	dw Mon096_EvosMoves
	dw Mon076_EvosMoves
	dw Mon154_EvosMoves	;MissingNo
	dw Mon126_EvosMoves
	dw Mon155_EvosMoves	;MissingNo
	dw Mon125_EvosMoves
	dw Mon082_EvosMoves
	dw Mon109_EvosMoves
	dw Mon156_EvosMoves	;MissingNo
	dw Mon056_EvosMoves
	dw Mon086_EvosMoves
	dw Mon050_EvosMoves
	dw Mon128_EvosMoves
	dw Mon157_EvosMoves	;MissingNo
	dw Mon158_EvosMoves	;MissingNo
	dw Mon159_EvosMoves	;MissingNo
	dw Mon083_EvosMoves
	dw Mon048_EvosMoves
	dw Mon149_EvosMoves
	dw Mon160_EvosMoves	;MissingNo
	dw Mon161_EvosMoves	;MissingNo
	dw Mon162_EvosMoves	;MissingNo
	dw Mon084_EvosMoves
	dw Mon060_EvosMoves
	dw Mon124_EvosMoves
	dw Mon146_EvosMoves
	dw Mon144_EvosMoves
	dw Mon145_EvosMoves
	dw Mon132_EvosMoves
	dw Mon052_EvosMoves
	dw Mon098_EvosMoves
	dw Mon163_EvosMoves	;MissingNo
	dw Mon164_EvosMoves	;MissingNo
	dw Mon165_EvosMoves	;MissingNo
	dw Mon037_EvosMoves
	dw Mon038_EvosMoves
	dw Mon025_EvosMoves
	dw Mon026_EvosMoves
	dw Mon166_EvosMoves	;MissingNo
	dw Mon167_EvosMoves	;MissingNo
	dw Mon147_EvosMoves
	dw Mon148_EvosMoves
	dw Mon140_EvosMoves
	dw Mon141_EvosMoves
	dw Mon116_EvosMoves
	dw Mon117_EvosMoves
	dw Mon168_EvosMoves	;MissingNo
	dw Mon169_EvosMoves	;MissingNo
	dw Mon027_EvosMoves
	dw Mon028_EvosMoves
	dw Mon138_EvosMoves
	dw Mon139_EvosMoves
	dw Mon039_EvosMoves
	dw Mon040_EvosMoves
	dw Mon133_EvosMoves
	dw Mon136_EvosMoves
	dw Mon135_EvosMoves
	dw Mon134_EvosMoves
	dw Mon066_EvosMoves
	dw Mon041_EvosMoves
	dw Mon023_EvosMoves
	dw Mon046_EvosMoves
	dw Mon061_EvosMoves
	dw Mon062_EvosMoves
	dw Mon013_EvosMoves
	dw Mon014_EvosMoves
	dw Mon015_EvosMoves
	dw Mon170_EvosMoves	;MissingNo
	dw Mon085_EvosMoves
	dw Mon057_EvosMoves
	dw Mon051_EvosMoves
	dw Mon049_EvosMoves
	dw Mon087_EvosMoves
	dw Mon171_EvosMoves	;MissingNo
	dw Mon172_EvosMoves	;MissingNo
	dw Mon010_EvosMoves
	dw Mon011_EvosMoves
	dw Mon012_EvosMoves
	dw Mon068_EvosMoves
	dw Mon173_EvosMoves	;MissingNo
	dw Mon055_EvosMoves
	dw Mon097_EvosMoves
	dw Mon042_EvosMoves
	dw Mon150_EvosMoves
	dw Mon143_EvosMoves
	dw Mon129_EvosMoves
	dw Mon174_EvosMoves	;MissingNo
	dw Mon175_EvosMoves	;MissingNo
	dw Mon089_EvosMoves
	dw Mon176_EvosMoves	;MissingNo
	dw Mon099_EvosMoves
	dw Mon091_EvosMoves
	dw Mon177_EvosMoves	;MissingNo
	dw Mon101_EvosMoves
	dw Mon036_EvosMoves
	dw Mon110_EvosMoves
	dw Mon053_EvosMoves
	dw Mon105_EvosMoves
	dw Mon178_EvosMoves	;MissingNo
	dw Mon093_EvosMoves
	dw Mon063_EvosMoves
	dw Mon065_EvosMoves
	dw Mon017_EvosMoves
	dw Mon018_EvosMoves
	dw Mon121_EvosMoves
	dw Mon001_EvosMoves
	dw Mon003_EvosMoves
	dw Mon073_EvosMoves
	dw Mon179_EvosMoves	;MissingNo
	dw Mon118_EvosMoves
	dw Mon119_EvosMoves
	dw Mon180_EvosMoves	;MissingNo
	dw Mon181_EvosMoves	;MissingNo
	dw Mon182_EvosMoves	;MissingNo
	dw Mon183_EvosMoves	;MissingNo
	dw Mon077_EvosMoves
	dw Mon078_EvosMoves
	dw Mon019_EvosMoves
	dw Mon020_EvosMoves
	dw Mon033_EvosMoves
	dw Mon030_EvosMoves
	dw Mon074_EvosMoves
	dw Mon137_EvosMoves
	dw Mon142_EvosMoves
	dw Mon184_EvosMoves	;MissingNo
	dw Mon081_EvosMoves
	dw Mon185_EvosMoves	;MissingNo
	dw Mon186_EvosMoves	;MissingNo
	dw Mon004_EvosMoves
	dw Mon007_EvosMoves
	dw Mon005_EvosMoves
	dw Mon008_EvosMoves
	dw Mon006_EvosMoves
	dw Mon187_EvosMoves	;MissingNo
	dw Mon188_EvosMoves	;MissingNo
	dw Mon189_EvosMoves	;MissingNo
	dw Mon190_EvosMoves	;MissingNo
	dw Mon043_EvosMoves
	dw Mon044_EvosMoves
	dw Mon045_EvosMoves
	dw Mon069_EvosMoves
	dw Mon070_EvosMoves
	dw Mon071_EvosMoves

Mon112_EvosMoves: ; 3b1d8 (e:71d8)
;RHYDON
;Evolutions
	db 0
;Learnset
	db 30,STOMP
	db 35,TAIL_WHIP
	db 40,FURY_ATTACK
	db 48,HORN_DRILL
	db 55,LEER
	db 64,TAKE_DOWN
	db 0
Mon115_EvosMoves: ; 3b1e6 (e:71e6)
;KANGASKHAN
;Evolutions
	db 0
;Learnset
	db 26,BITE
	db 31,TAIL_WHIP
	db 36,MEGA_PUNCH
	db 41,LEER
	db 46,DIZZY_PUNCH
	db 0
Mon032_EvosMoves: ; 3b1f2 (e:71f2)
;NIDORAN_M
;Evolutions
	db EV_LEVEL,16,NIDORINO
	db 0
;Learnset
	db 8,HORN_ATTACK
	db 14,POISON_STING
	db 21,FOCUS_ENERGY
	db 29,FURY_ATTACK
	db 36,HORN_DRILL
	db 43,DOUBLE_KICK
	db 0
Mon035_EvosMoves: ; 3b203 (e:7203)
;CLEFAIRY
;Evolutions
	db EV_ITEM,MOON_STONE,1,CLEFABLE
	db 0
;Learnset
	db 13,SING
	db 18,DOUBLESLAP
	db 24,MINIMIZE
	db 31,METRONOME
	db 39,DEFENSE_CURL
	db 48,LIGHT_SCREEN
	db 0
Mon021_EvosMoves: ; 3b215 (e:7215)
;SPEAROW
;Evolutions
	db EV_LEVEL,20,FEAROW
	db 0
;Learnset
	db 9,LEER
	db 15,FURY_ATTACK
	db 22,MIRROR_MOVE
	db 29,DRILL_PECK
	db 36,AGILITY
	db 0
Mon100_EvosMoves: ; 3b224 (e:7224)
;VOLTORB
;Evolutions
	db EV_LEVEL,30,ELECTRODE
	db 0
;Learnset
	db 17,SONICBOOM
	db 22,SELFDESTRUCT
	db 29,LIGHT_SCREEN
	db 36,SWIFT
	db 43,EXPLOSION
	db 0
Mon034_EvosMoves: ; 3b233 (e:7233)
;NIDOKING
;Evolutions
	db 0
;Learnset
	db 8,HORN_ATTACK
	db 14,POISON_STING
	db 23,THRASH
	db 0
Mon080_EvosMoves: ; 3b23b (e:723b)
;SLOWBRO
;Evolutions
	db 0
;Learnset
	db 18,DISABLE
	db 22,HEADBUTT
	db 27,GROWL
	db 33,WATER_GUN
	db 37,WITHDRAW
	db 44,AMNESIA
	db 55,PSYCHIC_M
	db 0
Mon002_EvosMoves: ; 3b24b (e:724b)
;IVYSAUR
;Evolutions
	db EV_LEVEL,32,VENUSAUR
	db 0
;Learnset
	db 7,LEECH_SEED
	db 13,VINE_WHIP
	db 22,POISONPOWDER
	db 30,RAZOR_LEAF
	db 38,GROWTH
	db 46,SLEEP_POWDER
	db 54,SOLARBEAM
	db 0
Mon103_EvosMoves: ; 3b25e (e:725e)
;EXEGGUTOR
;Evolutions
	db 0
;Learnset
	db 28,STOMP
	db 0
Mon108_EvosMoves: ; 3b262 (e:7262)
;LICKITUNG
;Evolutions
	db 0
;Learnset
	db 7,STOMP
	db 15,DISABLE
	db 23,DEFENSE_CURL
	db 31,SLAM
	db 39,SCREECH
	db 0
Mon102_EvosMoves: ; 3b26e (e:726e)
;EXEGGCUTE
;Evolutions
	db EV_ITEM,LEAF_STONE ,1,EXEGGUTOR
	db 0
;Learnset
	db 25,REFLECT
	db 28,LEECH_SEED
	db 32,STUN_SPORE
	db 37,POISONPOWDER
	db 42,SOLARBEAM
	db 48,SLEEP_POWDER
	db 0
Mon088_EvosMoves: ; 3b280 (e:7280)
;GRIMER
;Evolutions
	db EV_LEVEL,38,MUK
	db 0
;Learnset
	db 30,POISON_GAS
	db 33,MINIMIZE
	db 37,SLUDGE
	db 42,HARDEN
	db 48,SCREECH
	db 55,ACID_ARMOR
	db 0
Mon094_EvosMoves: ; 3b291 (e:7291)
;GENGAR
;Evolutions
	db 0
;Learnset
	db 29,HYPNOSIS
	db 38,DREAM_EATER
	db 0
Mon029_EvosMoves: ; 3b297 (e:7297)
;NIDORAN_F
;Evolutions
	db EV_LEVEL,16,NIDORINA
	db 0
;Learnset
	db 8,SCRATCH
	db 14,POISON_STING
	db 21,TAIL_WHIP
	db 29,BITE
	db 36,FURY_SWIPES
	db 43,DOUBLE_KICK
	db 0
Mon031_EvosMoves: ; 3b2a8 (e:72a8)
;NIDOQUEEN
;Evolutions
	db 0
;Learnset
	db 8,SCRATCH
	db 14,POISON_STING
	db 23,BODY_SLAM
	db 0
Mon104_EvosMoves: ; 3b2b0 (e:72b0)
;CUBONE
;Evolutions
	db EV_LEVEL,28,MAROWAK
	db 0
;Learnset
	db 25,LEER
	db 31,FOCUS_ENERGY
	db 38,THRASH
	db 43,BONEMERANG
	db 46,RAGE
	db 0
Mon111_EvosMoves: ; 3b2bf (e:72bf)
;RHYHORN
;Evolutions
	db EV_LEVEL,42,RHYDON
	db 0
;Learnset
	db 30,STOMP
	db 35,TAIL_WHIP
	db 40,FURY_ATTACK
	db 45,HORN_DRILL
	db 50,LEER
	db 55,TAKE_DOWN
	db 0
Mon131_EvosMoves: ; 3b2d0 (e:72d0)
;LAPRAS
;Evolutions
	db 0
;Learnset
	db 16,SING
	db 20,MIST
	db 25,BODY_SLAM
	db 31,CONFUSE_RAY
	db 38,ICE_BEAM
	db 46,HYDRO_PUMP
	db 0
Mon059_EvosMoves: ; 3b2de (e:72de)
;ARCANINE
;Evolutions
	db 0
;Learnset
	db 0
Mon151_EvosMoves: ; 3b2e0 (e:72e0)
;MEW
;Evolutions
	db 0
;Learnset
	db 10,TRANSFORM
	db 20,MEGA_PUNCH
	db 30,METRONOME
	db 40,PSYCHIC_M
	db 0
Mon130_EvosMoves: ; 3b2ea (e:72ea)
;GYARADOS
;Evolutions
	db 0
;Learnset
	db 20,BITE
	db 25,DRAGON_RAGE
	db 32,LEER
	db 41,HYDRO_PUMP
	db 52,HYPER_BEAM
	db 0
Mon090_EvosMoves: ; 3b2f6 (e:72f6)
;SHELLDER
;Evolutions
	db EV_ITEM,WATER_STONE ,1,CLOYSTER
	db 0
;Learnset
	db 18,SUPERSONIC
	db 23,CLAMP
	db 30,AURORA_BEAM
	db 39,LEER
	db 50,ICE_BEAM
	db 0
Mon072_EvosMoves: ; 3b306 (e:7306)
;TENTACOOL
;Evolutions
	db EV_LEVEL,30,TENTACRUEL
	db 0
;Learnset
	db 7,SUPERSONIC
	db 13,WRAP
	db 18,POISON_STING
	db 22,WATER_GUN
	db 27,CONSTRICT
	db 33,BARRIER
	db 40,SCREECH
	db 48,HYDRO_PUMP
	db 0
Mon092_EvosMoves: ; 3b31b (e:731b)
;GASTLY
;Evolutions
	db EV_LEVEL,25,HAUNTER
	db 0
;Learnset
	db 27,HYPNOSIS
	db 35,DREAM_EATER
	db 0
Mon123_EvosMoves: ; 3b324 (e:7324)
;SCYTHER
;Evolutions
	db 0
;Learnset
	db 17,LEER
	db 20,FOCUS_ENERGY
	db 24,DOUBLE_TEAM
	db 29,SLASH
	db 35,SWORDS_DANCE
	db 42,AGILITY
	db 0
Mon120_EvosMoves: ; 3b332 (e:7332)
;STARYU
;Evolutions
	db EV_ITEM,WATER_STONE ,1,STARMIE
	db 0
;Learnset
	db 17,WATER_GUN
	db 22,HARDEN
	db 27,RECOVER
	db 32,SWIFT
	db 37,MINIMIZE
	db 42,LIGHT_SCREEN
	db 47,HYDRO_PUMP
	db 0
Mon009_EvosMoves: ; 3b346 (e:7346)
;BLASTOISE
;Evolutions
	db 0
;Learnset
	db 8,BUBBLE
	db 15,WATER_GUN
	db 24,BITE
	db 31,WITHDRAW
	db 42,SKULL_BASH
	db 52,HYDRO_PUMP
	db 0
Mon127_EvosMoves: ; 3b354 (e:7354)
;PINSIR
;Evolutions
	db 0
;Learnset
	db 25,SEISMIC_TOSS
	db 30,GUILLOTINE
	db 36,FOCUS_ENERGY
	db 43,HARDEN
	db 49,SLASH
	db 54,SWORDS_DANCE
	db 0
Mon114_EvosMoves: ; 3b362 (e:7362)
;TANGELA
;Evolutions
	db 0
;Learnset
	db 29,ABSORB
	db 32,POISONPOWDER
	db 36,STUN_SPORE
	db 39,SLEEP_POWDER
	db 45,SLAM
	db 49,GROWTH
	db 0

Mon152_EvosMoves: ; 3b370 (e:7370)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon153_EvosMoves: ; 3b372 (e:7372)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon058_EvosMoves: ; 3b374 (e:7374)
;GROWLITHE
;Evolutions
	db EV_ITEM,FIRE_STONE,1,ARCANINE
	db 0
;Learnset
	db 18,EMBER
	db 23,LEER
	db 30,TAKE_DOWN
	db 39,AGILITY
	db 50,FLAMETHROWER
	db 0
Mon095_EvosMoves: ; 3b384 (e:7384)
;ONIX
;Evolutions
	db 0
;Learnset
	db 15,BIND
	db 19,ROCK_THROW
	db 25,RAGE
	db 33,SLAM
	db 43,HARDEN
	db 0
Mon022_EvosMoves: ; 3b390 (e:7390)
;FEAROW
;Evolutions
	db 0
;Learnset
	db 9,LEER
	db 15,FURY_ATTACK
	db 25,MIRROR_MOVE
	db 34,DRILL_PECK
	db 43,AGILITY
	db 0
Mon016_EvosMoves: ; 3b39c (e:739c)
;PIDGEY
;Evolutions
	db EV_LEVEL,18,PIDGEOTTO
	db 0
;Learnset
	db 5,SAND_ATTACK
	db 12,QUICK_ATTACK
	db 19,WHIRLWIND
	db 28,WING_ATTACK
	db 36,AGILITY
	db 44,MIRROR_MOVE
	db 0
Mon079_EvosMoves: ; 3b3ad (e:73ad)
;SLOWPOKE
;Evolutions
	db EV_LEVEL,37,SLOWBRO
	db 0
;Learnset
	db 18,DISABLE
	db 22,HEADBUTT
	db 27,GROWL
	db 33,WATER_GUN
	db 40,AMNESIA
	db 48,PSYCHIC_M
	db 0
Mon064_EvosMoves: ; 3b3be (e:73be)
;KADABRA
;Evolutions
	db EV_TRADE,1,ALAKAZAM
	db 0
;Learnset
	db 16,CONFUSION
	db 20,DISABLE
	db 27,PSYBEAM
	db 31,RECOVER
	db 38,PSYCHIC_M
	db 42,REFLECT
	db 0
Mon075_EvosMoves: ; 3b3cf (e:73cf)
;GRAVELER
;Evolutions
	db EV_TRADE,1,GOLEM
	db 0
;Learnset
	db 11,DEFENSE_CURL
	db 16,ROCK_THROW
	db 21,SELFDESTRUCT
	db 29,HARDEN
	db 36,EARTHQUAKE
	db 43,EXPLOSION
	db 0
Mon113_EvosMoves: ; 3b3e0 (e:73e0)
;CHANSEY
;Evolutions
	db 0
;Learnset
	db 24,SING
	db 30,GROWL
	db 38,MINIMIZE
	db 44,DEFENSE_CURL
	db 48,LIGHT_SCREEN
	db 54,DOUBLE_EDGE
	db 0
Mon067_EvosMoves: ; 3b3ee (e:73ee)
;MACHOKE
;Evolutions
	db EV_TRADE,1,MACHAMP
	db 0
;Learnset
	db 20,LOW_KICK
	db 25,LEER
	db 36,FOCUS_ENERGY
	db 44,SEISMIC_TOSS
	db 52,SUBMISSION
	db 0
Mon122_EvosMoves: ; 3b3fd (e:73fd)
;MR_MIME
;Evolutions
	db 0
;Learnset
	db 15,CONFUSION
	db 23,LIGHT_SCREEN
	db 31,DOUBLESLAP
	db 39,MEDITATE
	db 47,SUBSTITUTE
	db 0
Mon106_EvosMoves: ; 3b409 (e:7409)
;HITMONLEE
;Evolutions
	db 0
;Learnset
	db 33,ROLLING_KICK
	db 38,JUMP_KICK
	db 43,FOCUS_ENERGY
	db 48,HI_JUMP_KICK
	db 53,MEGA_KICK
	db 0
Mon107_EvosMoves: ; 3b415 (e:7415)
;HITMONCHAN
;Evolutions
	db 0
;Learnset
	db 33,FIRE_PUNCH
	db 38,ICE_PUNCH
	db 43,THUNDERPUNCH
	db 48,MEGA_PUNCH
	db 53,COUNTER
	db 0
Mon024_EvosMoves: ; 3b421 (e:7421)
;ARBOK
;Evolutions
	db 0
;Learnset
	db 10,POISON_STING
	db 17,BITE
	db 27,GLARE
	db 36,SCREECH
	db 47,ACID
	db 0
Mon047_EvosMoves: ; 3b42d (e:742d)
;PARASECT
;Evolutions
	db 0
;Learnset
	db 13,STUN_SPORE
	db 20,LEECH_LIFE
	db 30,SPORE
	db 39,SLASH
	db 48,GROWTH
	db 0
Mon054_EvosMoves: ; 3b439 (e:7439)
;PSYDUCK
;Evolutions
	db EV_LEVEL,33,GOLDUCK
	db 0
;Learnset
	db 28,TAIL_WHIP
	db 31,DISABLE
	db 36,CONFUSION
	db 43,FURY_SWIPES
	db 52,HYDRO_PUMP
	db 0
Mon096_EvosMoves: ; 3b448 (e:7448)
;DROWZEE
;Evolutions
	db EV_LEVEL,26,HYPNO
	db 0
;Learnset
	db 12,DISABLE
	db 17,CONFUSION
	db 24,HEADBUTT
	db 29,POISON_GAS
	db 32,PSYCHIC_M
	db 37,MEDITATE
	db 0
Mon076_EvosMoves: ; 3b459 (e:7459)
;GOLEM
;Evolutions
	db 0
;Learnset
	db 11,DEFENSE_CURL
	db 16,ROCK_THROW
	db 21,SELFDESTRUCT
	db 29,HARDEN
	db 36,EARTHQUAKE
	db 43,EXPLOSION
	db 0

Mon154_EvosMoves: ; 3b467 (e:7467)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon126_EvosMoves: ; 3b469 (e:7469)
;MAGMAR
;Evolutions
	db 0
;Learnset
	db 36,LEER
	db 39,CONFUSE_RAY
	db 43,FIRE_PUNCH
	db 48,SMOKESCREEN
	db 52,SMOG
	db 55,FLAMETHROWER
	db 0

Mon155_EvosMoves: ; 3b477 (e:7477)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon125_EvosMoves: ; 3b479 (e:7479)
;ELECTABUZZ
;Evolutions
	db 0
;Learnset
	db 34,THUNDERSHOCK
	db 37,SCREECH
	db 42,THUNDERPUNCH
	db 49,LIGHT_SCREEN
	db 54,THUNDER
	db 0
Mon082_EvosMoves: ; 3b485 (e:7485)
;MAGNETON
;Evolutions
	db 0
;Learnset
	db 21,SONICBOOM
	db 25,THUNDERSHOCK
	db 29,SUPERSONIC
	db 38,THUNDER_WAVE
	db 46,SWIFT
	db 54,SCREECH
	db 0
Mon109_EvosMoves: ; 3b493 (e:7493)
;KOFFING
;Evolutions
	db EV_LEVEL,35,WEEZING
	db 0
;Learnset
	db 32,SLUDGE
	db 37,SMOKESCREEN
	db 40,SELFDESTRUCT
	db 45,HAZE
	db 48,EXPLOSION
	db 0

Mon156_EvosMoves: ; 3b4a2 (e:74a2)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon056_EvosMoves: ; 3b4a4 (e:74a4)
;MANKEY
;Evolutions
	db EV_LEVEL,28,PRIMEAPE
	db 0
;Learnset
	db 15,KARATE_CHOP
	db 21,FURY_SWIPES
	db 27,FOCUS_ENERGY
	db 33,SEISMIC_TOSS
	db 39,THRASH
	db 0
Mon086_EvosMoves: ; 3b4b3 (e:74b3)
;SEEL
;Evolutions
	db EV_LEVEL,34,DEWGONG
	db 0
;Learnset
	db 30,GROWL
	db 35,AURORA_BEAM
	db 40,REST
	db 45,TAKE_DOWN
	db 50,ICE_BEAM
	db 0
Mon050_EvosMoves: ; 3b4c2 (e:74c2)
;DIGLETT
;Evolutions
	db EV_LEVEL,26,DUGTRIO
	db 0
;Learnset
	db 15,GROWL
	db 19,DIG
	db 24,SAND_ATTACK
	db 31,SLASH
	db 40,EARTHQUAKE
	db 0
Mon128_EvosMoves: ; 3b4d1 (e:74d1)
;TAUROS
;Evolutions
	db 0
;Learnset
	db 21,STOMP
	db 28,TAIL_WHIP
	db 35,LEER
	db 44,RAGE
	db 51,TAKE_DOWN
	db 0

Mon157_EvosMoves: ; 3b4dd (e:74dd)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon158_EvosMoves: ; 3b4df (e:74df)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon159_EvosMoves: ; 3b4e1 (e:74e1)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon083_EvosMoves: ; 3b4e3 (e:74e3)
;FARFETCH_D
;Evolutions
	db 0
;Learnset
	db 7,LEER
	db 15,FURY_ATTACK
	db 23,SWORDS_DANCE
	db 31,AGILITY
	db 39,SLASH
	db 0
Mon048_EvosMoves: ; 3b4ef (e:74ef)
;VENONAT
;Evolutions
	db EV_LEVEL,31,VENOMOTH
	db 0
;Learnset
	db 24,POISONPOWDER
	db 27,LEECH_LIFE
	db 30,STUN_SPORE
	db 35,PSYBEAM
	db 38,SLEEP_POWDER
	db 43,PSYCHIC_M
	db 0
Mon149_EvosMoves: ; 3b500 (e:7500)
;DRAGONITE
;Evolutions
	db 0
;Learnset
	db 10,THUNDER_WAVE
	db 20,AGILITY
	db 35,SLAM
	db 45,DRAGON_RAGE
	db 60,HYPER_BEAM
	db 0

Mon160_EvosMoves: ; 3b50c (e:750c)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon161_EvosMoves: ; 3b50e (e:750e)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon162_EvosMoves: ; 3b510 (e:7510)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon084_EvosMoves: ; 3b512 (e:7512)
;DODUO
;Evolutions
	db EV_LEVEL,31,DODRIO
	db 0
;Learnset
	db 20,GROWL
	db 24,FURY_ATTACK
	db 30,DRILL_PECK
	db 36,RAGE
	db 40,TRI_ATTACK
	db 44,AGILITY
	db 0
Mon060_EvosMoves: ; 3b523 (e:7523)
;POLIWAG
;Evolutions
	db EV_LEVEL,25,POLIWHIRL
	db 0
;Learnset
	db 16,HYPNOSIS
	db 19,WATER_GUN
	db 25,DOUBLESLAP
	db 31,BODY_SLAM
	db 38,AMNESIA
	db 45,HYDRO_PUMP
	db 0
Mon124_EvosMoves: ; 3b534 (e:7534)
;JYNX
;Evolutions
	db 0
;Learnset
	db 18,LICK
	db 23,DOUBLESLAP
	db 31,ICE_PUNCH
	db 39,BODY_SLAM
	db 47,THRASH
	db 58,BLIZZARD
	db 0
Mon146_EvosMoves: ; 3b542 (e:7542)
;MOLTRES
;Evolutions
	db 0
;Learnset
	db 51,LEER
	db 55,AGILITY
	db 60,SKY_ATTACK
	db 0
Mon144_EvosMoves: ; 3b54a (e:754a)
;ARTICUNO
;Evolutions
	db 0
;Learnset
	db 51,BLIZZARD
	db 55,AGILITY
	db 60,MIST
	db 0
Mon145_EvosMoves: ; 3b552 (e:7552)
;ZAPDOS
;Evolutions
	db 0
;Learnset
	db 51,THUNDER
	db 55,AGILITY
	db 60,LIGHT_SCREEN
	db 0
Mon132_EvosMoves: ; 3b55a (e:755a)
;DITTO
;Evolutions
	db 0
;Learnset
	db 0
Mon052_EvosMoves: ; 3b55c (e:755c)
;MEOWTH
;Evolutions
	db EV_LEVEL,28,PERSIAN
	db 0
;Learnset
	db 12,BITE
	db 17,PAY_DAY
	db 24,SCREECH
	db 33,FURY_SWIPES
	db 44,SLASH
	db 0
Mon098_EvosMoves: ; 3b56b (e:756b)
;KRABBY
;Evolutions
	db EV_LEVEL,28,KINGLER
	db 0
;Learnset
	db 20,VICEGRIP
	db 25,GUILLOTINE
	db 30,STOMP
	db 35,CRABHAMMER
	db 40,HARDEN
	db 0

Mon163_EvosMoves: ; 3b57a (e:757a)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon164_EvosMoves: ; 3b57c (e:757c)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon165_EvosMoves: ; 3b57e (e:757e)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon037_EvosMoves: ; 3b580 (e:7580)
;VULPIX
;Evolutions
	db EV_ITEM,FIRE_STONE,1,NINETALES
	db 0
;Learnset
	db 16,QUICK_ATTACK
	db 21,ROAR
	db 28,CONFUSE_RAY
	db 35,FLAMETHROWER
	db 42,FIRE_SPIN
	db 0
Mon038_EvosMoves: ; 3b590 (e:7590)
;NINETALES
;Evolutions
	db 0
;Learnset
	db 0
Mon025_EvosMoves: ; 3b592 (e:7592)
;PIKACHU
;Evolutions
	db EV_ITEM,THUNDER_STONE ,1,RAICHU
	db 0
;Learnset
	db 9,THUNDER_WAVE
	db 16,QUICK_ATTACK
	db 26,SWIFT
	db 33,AGILITY
	db 43,THUNDER
	db 0
Mon026_EvosMoves: ; 3b5a2 (e:75a2)
;RAICHU
;Evolutions
	db 0
;Learnset
	db 0

Mon166_EvosMoves: ; 3b5a4 (e:75a4)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon167_EvosMoves: ; 3b5a6 (e:75a6)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon147_EvosMoves: ; 3b5a8 (e:75a8)
;DRATINI
;Evolutions
	db EV_LEVEL,30,DRAGONAIR
	db 0
;Learnset
	db 10,THUNDER_WAVE
	db 20,AGILITY
	db 30,SLAM
	db 40,DRAGON_RAGE
	db 50,HYPER_BEAM
	db 0
Mon148_EvosMoves: ; 3b5b7 (e:75b7)
;DRAGONAIR
;Evolutions
	db EV_LEVEL,55,DRAGONITE
	db 0
;Learnset
	db 10,THUNDER_WAVE
	db 20,AGILITY
	db 35,SLAM
	db 45,DRAGON_RAGE
	db 55,HYPER_BEAM
	db 0
Mon140_EvosMoves: ; 3b5c6 (e:75c6)
;KABUTO
;Evolutions
	db EV_LEVEL,40,KABUTOPS
	db 0
;Learnset
	db 34,ABSORB
	db 39,SLASH
	db 44,LEER
	db 49,HYDRO_PUMP
	db 0
Mon141_EvosMoves: ; 3b5d3 (e:75d3)
;KABUTOPS
;Evolutions
	db 0
;Learnset
	db 34,ABSORB
	db 39,SLASH
	db 46,LEER
	db 53,HYDRO_PUMP
	db 0
Mon116_EvosMoves: ; 3b5dd (e:75dd)
;HORSEA
;Evolutions
	db EV_LEVEL,32,SEADRA
	db 0
;Learnset
	db 19,SMOKESCREEN
	db 24,LEER
	db 30,WATER_GUN
	db 37,AGILITY
	db 45,HYDRO_PUMP
	db 0
Mon117_EvosMoves: ; 3b5ec (e:75ec)
;SEADRA
;Evolutions
	db 0
;Learnset
	db 19,SMOKESCREEN
	db 24,LEER
	db 30,WATER_GUN
	db 41,AGILITY
	db 52,HYDRO_PUMP
	db 0

Mon168_EvosMoves: ; 3b5f8 (e:75f8)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon169_EvosMoves: ; 3b5fa (e:75fa)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon027_EvosMoves: ; 3b5fc (e:75fc)
;SANDSHREW
;Evolutions
	db EV_LEVEL,22,SANDSLASH
	db 0
;Learnset
	db 10,SAND_ATTACK
	db 17,SLASH
	db 24,POISON_STING
	db 31,SWIFT
	db 38,FURY_SWIPES
	db 0
Mon028_EvosMoves: ; 3b60b (e:760b)
;SANDSLASH
;Evolutions
	db 0
;Learnset
	db 10,SAND_ATTACK
	db 17,SLASH
	db 27,POISON_STING
	db 36,SWIFT
	db 47,FURY_SWIPES
	db 0
Mon138_EvosMoves: ; 3b617 (e:7617)
;OMANYTE
;Evolutions
	db EV_LEVEL,40,OMASTAR
	db 0
;Learnset
	db 34,HORN_ATTACK
	db 39,LEER
	db 46,SPIKE_CANNON
	db 53,HYDRO_PUMP
	db 0
Mon139_EvosMoves: ; 3b624 (e:7624)
;OMASTAR
;Evolutions
	db 0
;Learnset
	db 34,HORN_ATTACK
	db 39,LEER
	db 44,SPIKE_CANNON
	db 49,HYDRO_PUMP
	db 0
Mon039_EvosMoves: ; 3b62e (e:762e)
;JIGGLYPUFF
;Evolutions
	db EV_ITEM,MOON_STONE,1,WIGGLYTUFF
	db 0
;Learnset
	db 9,POUND
	db 14,DISABLE
	db 19,DEFENSE_CURL
	db 24,DOUBLESLAP
	db 29,REST
	db 34,BODY_SLAM
	db 39,DOUBLE_EDGE
	db 0
Mon040_EvosMoves: ; 3b642 (e:7642)
;WIGGLYTUFF
;Evolutions
	db 0
;Learnset
	db 0
Mon133_EvosMoves: ; 3b644 (e:7644)
;EEVEE
;Evolutions
	db EV_ITEM,FIRE_STONE,1,FLAREON
	db EV_ITEM,THUNDER_STONE ,1,JOLTEON
	db EV_ITEM,WATER_STONE ,1,VAPOREON
	db 0
;Learnset
	db 27,QUICK_ATTACK
	db 31,TAIL_WHIP
	db 37,BITE
	db 45,TAKE_DOWN
	db 0
Mon136_EvosMoves: ; 3b65a (e:765a)
;FLAREON
;Evolutions
	db 0
;Learnset
	db 27,QUICK_ATTACK
	db 31,EMBER
	db 37,TAIL_WHIP
	db 40,BITE
	db 42,LEER
	db 44,FIRE_SPIN
	db 48,RAGE
	db 54,FLAMETHROWER
	db 0
Mon135_EvosMoves: ; 3b66c (e:766c)
;JOLTEON
;Evolutions
	db 0
;Learnset
	db 27,QUICK_ATTACK
	db 31,THUNDERSHOCK
	db 37,TAIL_WHIP
	db 40,THUNDER_WAVE
	db 42,DOUBLE_KICK
	db 44,AGILITY
	db 48,PIN_MISSILE
	db 54,THUNDER
	db 0
Mon134_EvosMoves: ; 3b67e (e:767e)
;VAPOREON
;Evolutions
	db 0
;Learnset
	db 27,QUICK_ATTACK
	db 31,WATER_GUN
	db 37,TAIL_WHIP
	db 40,BITE
	db 42,ACID_ARMOR
	db 44,HAZE
	db 48,MIST
	db 54,HYDRO_PUMP
	db 0
Mon066_EvosMoves: ; 3b690 (e:7690)
;MACHOP
;Evolutions
	db EV_LEVEL,28,MACHOKE
	db 0
;Learnset
	db 20,LOW_KICK
	db 25,LEER
	db 32,FOCUS_ENERGY
	db 39,SEISMIC_TOSS
	db 46,SUBMISSION
	db 0
Mon041_EvosMoves: ; 3b69f (e:769f)
;ZUBAT
;Evolutions
	db EV_LEVEL,22,GOLBAT
	db 0
;Learnset
	db 10,SUPERSONIC
	db 15,BITE
	db 21,CONFUSE_RAY
	db 28,WING_ATTACK
	db 36,HAZE
	db 0
Mon023_EvosMoves: ; 3b6ae (e:76ae)
;EKANS
;Evolutions
	db EV_LEVEL,22,ARBOK
	db 0
;Learnset
	db 10,POISON_STING
	db 17,BITE
	db 24,GLARE
	db 31,SCREECH
	db 38,ACID
	db 0
Mon046_EvosMoves: ; 3b6bd (e:76bd)
;PARAS
;Evolutions
	db EV_LEVEL,24,PARASECT
	db 0
;Learnset
	db 13,STUN_SPORE
	db 20,LEECH_LIFE
	db 27,SPORE
	db 34,SLASH
	db 41,GROWTH
	db 0
Mon061_EvosMoves: ; 3b6cc (e:76cc)
;POLIWHIRL
;Evolutions
	db EV_ITEM,WATER_STONE ,1,POLIWRATH
	db 0
;Learnset
	db 16,HYPNOSIS
	db 19,WATER_GUN
	db 26,DOUBLESLAP
	db 33,BODY_SLAM
	db 41,AMNESIA
	db 49,HYDRO_PUMP
	db 0
Mon062_EvosMoves: ; 3b6de (e:76de)
;POLIWRATH
;Evolutions
	db 0
;Learnset
	db 16,HYPNOSIS
	db 19,WATER_GUN
	db 0
Mon013_EvosMoves: ; 3b6e4 (e:76e4)
;WEEDLE
;Evolutions
	db EV_LEVEL,7,KAKUNA
	db 0
;Learnset
	db 0
Mon014_EvosMoves: ; 3b6e9 (e:76e9)
;KAKUNA
;Evolutions
	db EV_LEVEL,10,BEEDRILL
	db 0
;Learnset
	db 0
Mon015_EvosMoves: ; 3b6ee (e:76ee)
;BEEDRILL
;Evolutions
	db 0
;Learnset
	db 12,FURY_ATTACK
	db 16,FOCUS_ENERGY
	db 20,TWINEEDLE
	db 25,RAGE
	db 30,PIN_MISSILE
	db 35,AGILITY
	db 0

Mon170_EvosMoves: ; 3b6fc (e:76fc)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon085_EvosMoves: ; 3b6fe (e:76fe)
;DODRIO
;Evolutions
	db 0
;Learnset
	db 20,GROWL
	db 24,FURY_ATTACK
	db 30,DRILL_PECK
	db 39,RAGE
	db 45,TRI_ATTACK
	db 51,AGILITY
	db 0
Mon057_EvosMoves: ; 3b70c (e:770c)
;PRIMEAPE
;Evolutions
	db 0
;Learnset
	db 15,KARATE_CHOP
	db 21,FURY_SWIPES
	db 27,FOCUS_ENERGY
	db 37,SEISMIC_TOSS
	db 46,THRASH
	db 0
Mon051_EvosMoves: ; 3b718 (e:7718)
;DUGTRIO
;Evolutions
	db 0
;Learnset
	db 15,GROWL
	db 19,DIG
	db 24,SAND_ATTACK
	db 35,SLASH
	db 47,EARTHQUAKE
	db 0
Mon049_EvosMoves: ; 3b724 (e:7724)
;VENOMOTH
;Evolutions
	db 0
;Learnset
	db 24,POISONPOWDER
	db 27,LEECH_LIFE
	db 30,STUN_SPORE
	db 38,PSYBEAM
	db 43,SLEEP_POWDER
	db 50,PSYCHIC_M
	db 0
Mon087_EvosMoves: ; 3b732 (e:7732)
;DEWGONG
;Evolutions
	db 0
;Learnset
	db 30,GROWL
	db 35,AURORA_BEAM
	db 44,REST
	db 50,TAKE_DOWN
	db 56,ICE_BEAM
	db 0

Mon171_EvosMoves: ; 3b73e (e:773e)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon172_EvosMoves: ; 3b740 (e:7740)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon010_EvosMoves: ; 3b742 (e:7742)
;CATERPIE
;Evolutions
	db EV_LEVEL,7,METAPOD
	db 0
;Learnset
	db 0
Mon011_EvosMoves: ; 3b747 (e:7747)
;METAPOD
;Evolutions
	db EV_LEVEL,10,BUTTERFREE
	db 0
;Learnset
	db 0
Mon012_EvosMoves: ; 3b74c (e:774c)
;BUTTERFREE
;Evolutions
	db 0
;Learnset
	db 12,CONFUSION
	db 15,POISONPOWDER
	db 16,STUN_SPORE
	db 17,SLEEP_POWDER
	db 21,SUPERSONIC
	db 26,WHIRLWIND
	db 32,PSYBEAM
	db 0
Mon068_EvosMoves: ; 3b75c (e:775c)
;MACHAMP
;Evolutions
	db 0
;Learnset
	db 20,LOW_KICK
	db 25,LEER
	db 36,FOCUS_ENERGY
	db 44,SEISMIC_TOSS
	db 52,SUBMISSION
	db 0

Mon173_EvosMoves: ; 3b768 (e:7768)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon055_EvosMoves: ; 3b76a (e:776a)
;GOLDUCK
;Evolutions
	db 0
;Learnset
	db 28,TAIL_WHIP
	db 31,DISABLE
	db 39,CONFUSION
	db 48,FURY_SWIPES
	db 59,HYDRO_PUMP
	db 0
Mon097_EvosMoves: ; 3b776 (e:7776)
;HYPNO
;Evolutions
	db 0
;Learnset
	db 12,DISABLE
	db 17,CONFUSION
	db 24,HEADBUTT
	db 33,POISON_GAS
	db 37,PSYCHIC_M
	db 43,MEDITATE
	db 0
Mon042_EvosMoves: ; 3b784 (e:7784)
;GOLBAT
;Evolutions
	db 0
;Learnset
	db 10,SUPERSONIC
	db 15,BITE
	db 21,CONFUSE_RAY
	db 32,WING_ATTACK
	db 43,HAZE
	db 0
Mon150_EvosMoves: ; 3b790 (e:7790)
;MEWTWO
;Evolutions
	db 0
;Learnset
	db 63,BARRIER
	db 66,PSYCHIC_M
	db 70,RECOVER
	db 75,MIST
	db 81,AMNESIA
	db 0
Mon143_EvosMoves: ; 3b79c (e:779c)
;SNORLAX
;Evolutions
	db 0
;Learnset
	db 35,BODY_SLAM
	db 41,HARDEN
	db 48,DOUBLE_EDGE
	db 56,HYPER_BEAM
	db 0
Mon129_EvosMoves: ; 3b7a6 (e:77a6)
;MAGIKARP
;Evolutions
	db EV_LEVEL,20,GYARADOS
	db 0
;Learnset
	db 15,TACKLE
	db 0

Mon174_EvosMoves: ; 3b7ad (e:77ad)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon175_EvosMoves: ; 3b7af (e:77af)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon089_EvosMoves: ; 3b7b1 (e:77b1)
;MUK
;Evolutions
	db 0
;Learnset
	db 30,POISON_GAS
	db 33,MINIMIZE
	db 37,SLUDGE
	db 45,HARDEN
	db 53,SCREECH
	db 60,ACID_ARMOR
	db 0

Mon176_EvosMoves: ; 3b7bf (e:77bf)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon099_EvosMoves: ; 3b7c1 (e:77c1)
;KINGLER
;Evolutions
	db 0
;Learnset
	db 20,VICEGRIP
	db 25,GUILLOTINE
	db 34,STOMP
	db 42,CRABHAMMER
	db 49,HARDEN
	db 0
Mon091_EvosMoves: ; 3b7cd (e:77cd)
;CLOYSTER
;Evolutions
	db 0
;Learnset
	db 50,SPIKE_CANNON
	db 0

Mon177_EvosMoves: ; 3b7d1 (e:77d1)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon101_EvosMoves: ; 3b7d3 (e:77d3)
;ELECTRODE
;Evolutions
	db 0
;Learnset
	db 17,SONICBOOM
	db 22,SELFDESTRUCT
	db 29,LIGHT_SCREEN
	db 40,SWIFT
	db 50,EXPLOSION
	db 0
Mon036_EvosMoves: ; 3b7df (e:77df)
;CLEFABLE
;Evolutions
	db 0
;Learnset
	db 0
Mon110_EvosMoves: ; 3b7e1 (e:77e1)
;WEEZING
;Evolutions
	db 0
;Learnset
	db 32,SLUDGE
	db 39,SMOKESCREEN
	db 43,SELFDESTRUCT
	db 49,HAZE
	db 53,EXPLOSION
	db 0
Mon053_EvosMoves: ; 3b7ed (e:77ed)
;PERSIAN
;Evolutions
	db 0
;Learnset
	db 12,BITE
	db 17,PAY_DAY
	db 24,SCREECH
	db 37,FURY_SWIPES
	db 51,SLASH
	db 0
Mon105_EvosMoves: ; 3b7f9 (e:77f9)
;MAROWAK
;Evolutions
	db 0
;Learnset
	db 25,LEER
	db 33,FOCUS_ENERGY
	db 41,THRASH
	db 48,BONEMERANG
	db 55,RAGE
	db 0

Mon178_EvosMoves: ; 3b805 (e:7805)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon093_EvosMoves: ; 3b807 (e:7807)
;HAUNTER
;Evolutions
	db EV_TRADE,1,GENGAR
	db 0
;Learnset
	db 29,HYPNOSIS
	db 38,DREAM_EATER
	db 0
Mon063_EvosMoves: ; 3b810 (e:7810)
;ABRA
;Evolutions
	db EV_LEVEL,16,KADABRA
	db 0
;Learnset
	db 0
Mon065_EvosMoves: ; 3b815 (e:7815)
;ALAKAZAM
;Evolutions
	db 0
;Learnset
	db 16,CONFUSION
	db 20,DISABLE
	db 27,PSYBEAM
	db 31,RECOVER
	db 38,PSYCHIC_M
	db 42,REFLECT
	db 0
Mon017_EvosMoves: ; 3b823 (e:7823)
;PIDGEOTTO
;Evolutions
	db EV_LEVEL,36,PIDGEOT
	db 0
;Learnset
	db 5,SAND_ATTACK
	db 12,QUICK_ATTACK
	db 21,WHIRLWIND
	db 31,WING_ATTACK
	db 40,AGILITY
	db 49,MIRROR_MOVE
	db 0
Mon018_EvosMoves: ; 3b834 (e:7834)
;PIDGEOT
;Evolutions
	db 0
;Learnset
	db 5,SAND_ATTACK
	db 12,QUICK_ATTACK
	db 21,WHIRLWIND
	db 31,WING_ATTACK
	db 44,AGILITY
	db 54,MIRROR_MOVE
	db 0
Mon121_EvosMoves: ; 3b842 (e:7842)
;STARMIE
;Evolutions
	db 0
;Learnset
	db 0
Mon001_EvosMoves: ; 3b844 (e:7844)
;BULBASAUR
;Evolutions
	db EV_LEVEL,16,IVYSAUR
	db 0
;Learnset
	db 7,LEECH_SEED
	db 13,VINE_WHIP
	db 20,POISONPOWDER
	db 27,RAZOR_LEAF
	db 34,GROWTH
	db 41,SLEEP_POWDER
	db 48,SOLARBEAM
	db 0
Mon003_EvosMoves: ; 3b857 (e:7857)
;VENUSAUR
;Evolutions
	db 0
;Learnset
	db 7,LEECH_SEED
	db 13,VINE_WHIP
	db 22,POISONPOWDER
	db 30,RAZOR_LEAF
	db 43,GROWTH
	db 55,SLEEP_POWDER
	db 65,SOLARBEAM
	db 0
Mon073_EvosMoves: ; 3b867 (e:7867)
;TENTACRUEL
;Evolutions
	db 0
;Learnset
	db 7,SUPERSONIC
	db 13,WRAP
	db 18,POISON_STING
	db 22,WATER_GUN
	db 27,CONSTRICT
	db 35,BARRIER
	db 43,SCREECH
	db 50,HYDRO_PUMP
	db 0

Mon179_EvosMoves: ; 3b879 (e:7879)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon118_EvosMoves: ; 3b87b (e:787b)
;GOLDEEN
;Evolutions
	db EV_LEVEL,33,SEAKING
	db 0
;Learnset
	db 19,SUPERSONIC
	db 24,HORN_ATTACK
	db 30,FURY_ATTACK
	db 37,WATERFALL
	db 45,HORN_DRILL
	db 54,AGILITY
	db 0
Mon119_EvosMoves: ; 3b88c (e:788c)
;SEAKING
;Evolutions
	db 0
;Learnset
	db 19,SUPERSONIC
	db 24,HORN_ATTACK
	db 30,FURY_ATTACK
	db 39,WATERFALL
	db 48,HORN_DRILL
	db 54,AGILITY
	db 0

Mon180_EvosMoves: ; 3b89a (e:789a)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon181_EvosMoves: ; 3b89c (e:789c)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon182_EvosMoves: ; 3b89e (e:789e)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon183_EvosMoves: ; 3b8a0 (e:78a0)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon077_EvosMoves: ; 3b8a2 (e:78a2)
;PONYTA
;Evolutions
	db EV_LEVEL,40,RAPIDASH
	db 0
;Learnset
	db 30,TAIL_WHIP
	db 32,STOMP
	db 35,GROWL
	db 39,FIRE_SPIN
	db 43,TAKE_DOWN
	db 48,AGILITY
	db 0
Mon078_EvosMoves: ; 3b8b3 (e:78b3)
;RAPIDASH
;Evolutions
	db 0
;Learnset
	db 30,TAIL_WHIP
	db 32,STOMP
	db 35,GROWL
	db 39,FIRE_SPIN
	db 47,TAKE_DOWN
	db 55,AGILITY
	db 0
Mon019_EvosMoves: ; 3b8c1 (e:78c1)
;RATTATA
;Evolutions
	db EV_LEVEL,20,RATICATE
	db 0
;Learnset
	db 7,QUICK_ATTACK
	db 14,HYPER_FANG
	db 23,FOCUS_ENERGY
	db 34,SUPER_FANG
	db 0
Mon020_EvosMoves: ; 3b8ce (e:78ce)
;RATICATE
;Evolutions
	db 0
;Learnset
	db 7,QUICK_ATTACK
	db 14,HYPER_FANG
	db 27,FOCUS_ENERGY
	db 41,SUPER_FANG
	db 0
Mon033_EvosMoves: ; 3b8d8 (e:78d8)
;NIDORINO
;Evolutions
	db EV_ITEM,MOON_STONE,1,NIDOKING
	db 0
;Learnset
	db 8,HORN_ATTACK
	db 14,POISON_STING
	db 23,FOCUS_ENERGY
	db 32,FURY_ATTACK
	db 41,HORN_DRILL
	db 50,DOUBLE_KICK
	db 0
Mon030_EvosMoves: ; 3b8ea (e:78ea)
;NIDORINA
;Evolutions
	db EV_ITEM,MOON_STONE,1,NIDOQUEEN
	db 0
;Learnset
	db 8,SCRATCH
	db 14,POISON_STING
	db 23,TAIL_WHIP
	db 32,BITE
	db 41,FURY_SWIPES
	db 50,DOUBLE_KICK
	db 0
Mon074_EvosMoves: ; 3b8fc (e:78fc)
;GEODUDE
;Evolutions
	db EV_LEVEL,25,GRAVELER
	db 0
;Learnset
	db 11,DEFENSE_CURL
	db 16,ROCK_THROW
	db 21,SELFDESTRUCT
	db 26,HARDEN
	db 31,EARTHQUAKE
	db 36,EXPLOSION
	db 0
Mon137_EvosMoves: ; 3b90d (e:790d)
;PORYGON
;Evolutions
	db 0
;Learnset
	db 23,PSYBEAM
	db 28,RECOVER
	db 35,AGILITY
	db 42,TRI_ATTACK
	db 0
Mon142_EvosMoves: ; 3b917 (e:7917)
;AERODACTYL
;Evolutions
	db 0
;Learnset
	db 33,SUPERSONIC
	db 38,BITE
	db 45,TAKE_DOWN
	db 54,HYPER_BEAM
	db 0

Mon184_EvosMoves: ; 3b921 (e:7921)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon081_EvosMoves: ; 3b923 (e:7923)
;MAGNEMITE
;Evolutions
	db EV_LEVEL,30,MAGNETON
	db 0
;Learnset
	db 21,SONICBOOM
	db 25,THUNDERSHOCK
	db 29,SUPERSONIC
	db 35,THUNDER_WAVE
	db 41,SWIFT
	db 47,SCREECH
	db 0

Mon185_EvosMoves: ; 3b934 (e:7934)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon186_EvosMoves: ; 3b936 (e:7936)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon004_EvosMoves: ; 3b938 (e:7938)
;CHARMANDER
;Evolutions
	db EV_LEVEL,16,CHARMELEON
	db 0
;Learnset
	db 9,EMBER
	db 15,LEER
	db 22,RAGE
	db 30,SLASH
	db 38,FLAMETHROWER
	db 46,FIRE_SPIN
	db 0
Mon007_EvosMoves: ; 3b949 (e:7949)
;SQUIRTLE
;Evolutions
	db EV_LEVEL,16,WARTORTLE
	db 0
;Learnset
	db 8,BUBBLE
	db 15,WATER_GUN
	db 22,BITE
	db 28,WITHDRAW
	db 35,SKULL_BASH
	db 42,HYDRO_PUMP
	db 0
Mon005_EvosMoves: ; 3b95a (e:795a)
;CHARMELEON
;Evolutions
	db EV_LEVEL,36,CHARIZARD
	db 0
;Learnset
	db 9,EMBER
	db 15,LEER
	db 24,RAGE
	db 33,SLASH
	db 42,FLAMETHROWER
	db 56,FIRE_SPIN
	db 0
Mon008_EvosMoves: ; 3b96b (e:796b)
;WARTORTLE
;Evolutions
	db EV_LEVEL,36,BLASTOISE
	db 0
;Learnset
	db 8,BUBBLE
	db 15,WATER_GUN
	db 24,BITE
	db 31,WITHDRAW
	db 39,SKULL_BASH
	db 47,HYDRO_PUMP
	db 0
Mon006_EvosMoves: ; 3b97c (e:797c)
;CHARIZARD
;Evolutions
	db 0
;Learnset
	db 9,EMBER
	db 15,LEER
	db 24,RAGE
	db 36,SLASH
	db 46,FLAMETHROWER
	db 55,FIRE_SPIN
	db 0

Mon187_EvosMoves: ; 3b98a (e:798a)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon188_EvosMoves: ; 3b98c (e:798c)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon189_EvosMoves: ; 3b98e (e:798e)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0

Mon190_EvosMoves: ; 3b990 (e:7990)
;MISSINGNO
;Evolutions
	db 0
;Learnset
	db 0
Mon043_EvosMoves: ; 3b992 (e:7992)
;ODDISH
;Evolutions
	db EV_LEVEL,21,GLOOM
	db 0
;Learnset
	db 15,POISONPOWDER
	db 17,STUN_SPORE
	db 19,SLEEP_POWDER
	db 24,ACID
	db 33,PETAL_DANCE
	db 46,SOLARBEAM
	db 0
Mon044_EvosMoves: ; 3b9a3 (e:79a3)
;GLOOM
;Evolutions
	db EV_ITEM,LEAF_STONE ,1,VILEPLUME
	db 0
;Learnset
	db 15,POISONPOWDER
	db 17,STUN_SPORE
	db 19,SLEEP_POWDER
	db 28,ACID
	db 38,PETAL_DANCE
	db 52,SOLARBEAM
	db 0
Mon045_EvosMoves: ; 3b9b5 (e:79b5)
;VILEPLUME
;Evolutions
	db 0
;Learnset
	db 15,POISONPOWDER
	db 17,STUN_SPORE
	db 19,SLEEP_POWDER
	db 0
Mon069_EvosMoves: ; 3b9bd (e:79bd)
;BELLSPROUT
;Evolutions
	db EV_LEVEL,21,WEEPINBELL
	db 0
;Learnset
	db 13,WRAP
	db 15,POISONPOWDER
	db 18,SLEEP_POWDER
	db 21,STUN_SPORE
	db 26,ACID
	db 33,RAZOR_LEAF
	db 42,SLAM
	db 0
Mon070_EvosMoves: ; 3b9d0 (e:79d0)
;WEEPINBELL
;Evolutions
	db EV_ITEM,LEAF_STONE ,1,VICTREEBEL
	db 0
;Learnset
	db 13,WRAP
	db 15,POISONPOWDER
	db 18,SLEEP_POWDER
	db 23,STUN_SPORE
	db 29,ACID
	db 38,RAZOR_LEAF
	db 49,SLAM
	db 0
Mon071_EvosMoves: ; 3b9e4 (e:79e4)
;VICTREEBEL
;Evolutions
	db 0
;Learnset
	db 13,WRAP
	db 15,POISONPOWDER
	db 18,SLEEP_POWDER
	db 0

; known jump sources: 3fb2b (f:7b2b)
Func_3b9ec: ; 3b9ec (e:79ec)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld de, W_PLAYERMONCURHP ; $d015
	ld hl, W_PLAYERMONMAXHP ; $d023
	ld a, [W_PLAYERMOVENUM] ; $cfd2
	jr z, .asm_3ba03
	ld de, W_ENEMYMONCURHP ; $cfe6
	ld hl, W_ENEMYMONMAXHP ; $cff4
	ld a, [W_ENEMYMOVENUM] ; $cfcc
.asm_3ba03
	ld b, a
	ld a, [de]
	cp [hl]
	inc de
	inc hl
	ld a, [de]
	sbc [hl]
	jp z, Func_3ba97
	ld a, b
	cp $9c
	jr nz, .asm_3ba37
	push hl
	push de
	push af
	ld c, $32
	call DelayFrames
	ld hl, W_PLAYERMONSTATUS ; $d018
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3ba25
	ld hl, W_ENEMYMONSTATUS ; $cfe9
.asm_3ba25
	ld a, [hl]
	and a
	ld [hl], $2
	ld hl, UnnamedText_3baa2 ; $7aa2
	jr z, .asm_3ba31
	ld hl, UnnamedText_3baa7 ; $7aa7
.asm_3ba31
	call PrintText
	pop af
	pop de
	pop hl
.asm_3ba37
	ld a, [hld]
	ld [W_HPBARMAXHP], a
	ld c, a
	ld a, [hl]
	ld [W_HPBARMAXHP+1], a
	ld b, a
	jr z, .asm_3ba47
	srl b
	rr c
.asm_3ba47
	ld a, [de]
	ld [W_HPBAROLDHP], a
	add c
	ld [de], a
	ld [W_HPBARNEWHP], a
	dec de
	ld a, [de]
	ld [W_HPBAROLDHP+1], a
	adc b
	ld [de], a
	ld [W_HPBARNEWHP+1], a
	inc hl
	inc de
	ld a, [de]
	dec de
	sub [hl]
	dec hl
	ld a, [de]
	sbc [hl]
	jr c, .asm_3ba6f
	ld a, [hli]
	ld [de], a
	ld [W_HPBARNEWHP+1], a
	inc de
	ld a, [hl]
	ld [de], a
	ld [W_HPBARNEWHP], a
.asm_3ba6f
	ld hl, Func_3fba8 ; $7ba8
	call BankswitchEtoF
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	FuncCoord 10, 9 ; $c45e
	ld hl, Coord
	ld a, $1
	jr z, .asm_3ba83
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	xor a
.asm_3ba83
	ld [W_LISTMENUID], a ; $cf94
	ld a, $48
	call Predef ; indirect jump to UpdateHPBar (fa1d (3:7a1d))
	ld hl, Func_3cd5a ; $4d5a
	call BankswitchEtoF
	ld hl, UnnamedText_3baac ; $7aac
	jp PrintText

; known jump sources: 3ba0a (e:7a0a)
Func_3ba97: ; 3ba97 (e:7a97)
	ld c, $32
	call DelayFrames
	ld hl, Func_3fb53
	jp BankswitchEtoF
; 3baa2 (e:7aa2)
UnnamedText_3baa2: ; 3baa2 (e:7aa2)
	TX_FAR _UnnamedText_3baa2
	db $50
; 0x3baa2 + 5 bytes

UnnamedText_3baa7: ; 3baa7 (e:7aa7)
	TX_FAR _UnnamedText_3baa7
	db $50
; 0x3baa7 + 5 bytes

UnnamedText_3baac: ; 3baac (e:7aac)
	TX_FAR _UnnamedText_3baac
	db $50
; 0x3baac + 5 bytes

; known jump sources: 3fb33 (f:7b33)
Func_3bab1: ; 3bab1 (e:7ab1)
	ld hl, W_PLAYERMONID
	ld de, $cfe5
	ld bc, W_ENEMYBATTSTATUS3 ; $d069
	ld a, [W_ENEMYBATTSTATUS1] ; $d067
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr nz, .asm_3bad1
	ld hl, $cfe5
	ld de, W_PLAYERMONID
	ld bc, W_PLAYERBATTSTATUS3 ; $d064
	ld [W_PLAYERMOVELISTINDEX], a ; $cc2e
	ld a, [W_PLAYERBATTSTATUS1] ; $d062
.asm_3bad1
	bit 6, a
	jp nz, Func_3bb8c
	push hl
	push de
	push bc
	ld hl, W_PLAYERBATTSTATUS2 ; $d063
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3bae4
	ld hl, W_ENEMYBATTSTATUS2 ; $d068
.asm_3bae4
	bit 4, [hl]
	push af
	ld hl, Func_79747
	ld b, BANK(Func_79747)
	call nz, Bankswitch
	ld a, [W_OPTIONS] ; $d355
	add a
	ld hl, Func_3fba8 ; $7ba8
	ld b, BANK(Func_3fba8)
	jr nc, .asm_3baff
	ld hl, Func_79787
	ld b, BANK(Func_79787)
.asm_3baff
	call Bankswitch
	ld hl, Func_79771
	ld b, BANK(Func_79771)
	pop af
	call nz, Bankswitch
	pop bc
	ld a, [bc]
	set 3, a
	ld [bc], a
	pop de
	pop hl
	push hl
	ld a, [hl]
	ld [de], a
	ld bc, $5
	add hl, bc
	inc de
	inc de
	inc de
	inc de
	inc de
	inc bc
	inc bc
	call CopyData
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3bb32
	ld a, [de]
	ld [$cceb], a
	inc de
	ld a, [de]
	ld [$ccec], a
	dec de
.asm_3bb32
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hli]
	ld [de], a
	inc de
	inc hl
	inc hl
	inc hl
	inc de
	inc de
	inc de
	ld bc, $8
	call CopyData
	ld bc, $ffef
	add hl, bc
	ld b, $4
.asm_3bb4a
	ld a, [hli]
	and a
	jr z, .asm_3bb57
	ld a, $5
	ld [de], a
	inc de
	dec b
	jr nz, .asm_3bb4a
	jr .asm_3bb5d
.asm_3bb57
	xor a
	ld [de], a
	inc de
	dec b
	jr nz, .asm_3bb57
.asm_3bb5d
	pop hl
	ld a, [hl]
	ld [$d11e], a
	call GetMonName
	ld hl, $cd26
	ld de, $cd12
	call Func_3bb7d
	ld hl, W_ENEMYMONATTACKMOD ; $cd2e
	ld de, W_PLAYERMONATTACKMOD ; $cd1a
	call Func_3bb7d
	ld hl, UnnamedText_3bb92 ; $7b92
	jp PrintText

; known jump sources: 3bb6b (e:7b6b), 3bb74 (e:7b74)
Func_3bb7d: ; 3bb7d (e:7b7d)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3bb86
	push hl
	ld h, d
	ld l, e
	pop de
.asm_3bb86
	ld bc, $8
	jp CopyData

; known jump sources: 3bad3 (e:7ad3)
Func_3bb8c: ; 3bb8c (e:7b8c)
	ld hl, Func_3fb53 ; $7b53
	jp BankswitchEtoF
; 3bb92 (e:7b92)
UnnamedText_3bb92: ; 3bb92 (e:7b92)
	TX_FAR _UnnamedText_3bb92
	db $50
; 0x3bb92 + 5 bytes

; known jump sources: 3fb3b (f:7b3b)
Func_3bb97: ; 3bb97 (e:7b97)
	ld hl, W_PLAYERBATTSTATUS3 ; $d064
	ld de, W_PLAYERMOVEEFFECT ; $cfd3
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3bba8
	ld hl, W_ENEMYBATTSTATUS3 ; $d069
	ld de, W_ENEMYMOVEEFFECT ; $cfcd
.asm_3bba8
	ld a, [de]
	cp $40
	jr nz, .asm_3bbb8
	bit 1, [hl]
	jr nz, .asm_3bbcc
	set 1, [hl]
	ld hl, UnnamedText_3bbd7 ; $7bd7
	jr .asm_3bbc1
.asm_3bbb8
	bit 2, [hl]
	jr nz, .asm_3bbcc
	set 2, [hl]
	ld hl, UnnamedText_3bbdc ; $7bdc
.asm_3bbc1
	push hl
	ld hl, Func_3fba8 ; $7ba8
	call BankswitchEtoF
	pop hl
	jp PrintText
.asm_3bbcc
	ld c, $32
	call DelayFrames
	ld hl, Func_3fb53 ; $7b53
	jp BankswitchEtoF
; 3bbd7 (e:7bd7)
UnnamedText_3bbd7: ; 3bbd7 (e:7bd7)
	TX_FAR _UnnamedText_3bbd7
	db $50
; 0x3bbd7 + 5 bytes

UnnamedText_3bbdc: ; 3bbdc (e:7bdc)
	TX_FAR _UnnamedText_3bbdc
	db $50
; 0x3bbdc + 5 bytes

BankswitchEtoF: ; 3bbe1 (e:7be1)
	ld b, $f
	jp Bankswitch
; 0x3bbe6

SECTION "bankF",ROMX,BANK[$F]

; These are move effects (second value from the Moves table in bank $E).
EffectsArray1: ; 3c000 (f:4000)
	db $18,$19,$1C,$2E,$2F,$31,$38,$39,$40,$41,$42,$43,$4F,$52,$54,$55,$FF
EffectsArray2: ; 3c011 (f:4011)
; moves that do damage but not through normal calculations
; e.g., Super Fang, Psywave
	db $28,$29,$FF
EffectsArray3: ; 3c014 (f:4014)
; non-damaging, stat‐affecting or status‐causing moves?
; e.g., Meditate, Bide, Hypnosis
	db $01,$0A,$0B,$0C,$0D,$0E,$0F,$12,$13,$14,$15,$16,$17,$1A,$20,$32,$33,$34,$35,$36,$37,$3A,$3B,$3C,$3D,$3E,$3F,$FF
EffectsArray4: ; 3c030 (f:4030)
	db $03,$07,$08,$10,$1D,$1E,$2C,$30,$4D,$51,$FF
EffectsArray5: ; 3c03b (f:403b)
	db $03,$07,$08,$10,$11,$1D,$1E,$27,$28,$29,$2B,$2C,$2D,$30 ; fallthru
EffectsArray5B: ; 3c049 (f:4049)
; moves that prevent the player from switching moves?
	db $1B,$2A,$FF

; known jump sources: 3eff0 (f:6ff0)
Func_3c04c: ; 3c04c (f:404c)
	call Func_3ec92
	ld a, $1
	ld [$d125], a
	call DisplayTextBoxID
	FuncCoord 1, 5 ; $c405
	ld hl, Coord
	ld bc, $307
	call ClearScreenArea
	call DisableLCD
	call LoadFontTilePatterns
	call Func_3ee58
	ld hl, $9800
	ld bc, $400
.asm_3c06f
	ld a, $7f
	ld [hli], a
	dec bc
	ld a, b
	or c
	jr nz, .asm_3c06f
	ld hl, W_SCREENTILESBUFFER
	ld de, $9800
	ld b, $12
.asm_3c07f
	ld c, $14
.asm_3c081
	ld a, [hli]
	ld [de], a
	inc e
	dec c
	jr nz, .asm_3c081
	ld a, $c
	add e
	ld e, a
	jr nc, .asm_3c08e
	inc d
.asm_3c08e
	dec b
	jr nz, .asm_3c07f
	call EnableLCD
	ld a, $90
	ld [$FF00+$b0], a
	ld [rWY], a ; $FF00+$4a
	xor a
	ld [$FF00+$d7], a
	ld [$FF00+$af], a
	dec a
	ld [$cfcb], a
	call Delay3
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld b, $70
	ld c, $90
	ld a, c
	ld [$FF00+$ae], a
	call DelayFrame
	ld a, $e4
	ld [rBGP], a ; $FF00+$47
	ld [rOBP0], a ; $FF00+$48
	ld [rOBP1], a ; $FF00+$49
.asm_3c0bb
	ld h, b
	ld l, $40
	call Func_3c110
	inc b
	inc b
	ld h, $0
	ld l, $60
	call Func_3c110
	call Func_3c0ff
	ld a, c
	ld [$FF00+$ae], a
	dec c
	dec c
	jr nz, .asm_3c0bb
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, $31
	ld [$FF00+$e1], a
	FuncCoord 1, 5 ; $c405
	ld hl, Coord
	ld a, $1
	call Predef ; indirect jump to Func_3f0c6 (3f0c6 (f:70c6))
	xor a
	ld [$FF00+$b0], a
	ld [rWY], a ; $FF00+$4a
	inc a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Delay3
	ld b, $1
	call GoPAL_SET
	call ResetLCD_OAM
	ld hl, Func_58d99
	ld b, BANK(Func_58d99)
	jp Bankswitch ; indirect jump to Func_58d99 (58d99 (16:4d99))

; known jump sources: 3c0ca (f:40ca)
Func_3c0ff: ; 3c0ff (f:40ff)
	push bc
	ld hl, $c301
	ld c, $15
	ld de, $4
.asm_3c108
	dec [hl]
	dec [hl]
	add hl, de
	dec c
	jr nz, .asm_3c108
	pop bc
	ret

; known jump sources: 3c0be (f:40be), 3c0c7 (f:40c7), 3c113 (f:4113)
Func_3c110: ; 3c110 (f:4110)
	ld a, [$FF00+$44]
	cp l
	jr nz, Func_3c110
	ld a, h
	ld [rSCX], a ; $FF00+$43
.asm_3c118
	ld a, [$FF00+$44]
	cp h
	jr z, .asm_3c118
	ret

; known jump sources: 3f030 (f:7030)
Func_3c11e: ; 3c11e (f:411e)
	xor a
	ld [W_PLAYERMONSALIVEFLAGS], a
	ld [$ccf5], a
	ld [$cd6a], a
	inc a
	ld [$d11d], a
	ld hl, W_WATERMONS ; $d8a5 (aliases: W_ENEMYMON1HP)
	ld bc, $2b
	ld d, $3
.asm_3c134
	inc d
	ld a, [hli]
	or [hl]
	jr nz, .asm_3c13c
	add hl, bc
	jr .asm_3c134
.asm_3c13c
	ld a, d
	ld [$cc3e], a
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	call nz, Func_3c92a
	ld c, $28
	call DelayFrames
	call SaveScreenTilesToBuffer1
.asm_3c14f
	call AnyPokemonAliveCheck
	ld a, d
	and a
	jp z, HandlePlayerBlackOut
	call LoadScreenTilesFromBuffer1
	ld a, [W_BATTLETYPE] ; $d05a
	and a
	jp z, Func_3c1ad
.asm_3c161
	call InitBattleMenu
	ret c
	ld a, [$cd6a]
	and a
	jr z, .asm_3c161
	ld a, [W_NUMSAFARIBALLS] ; $da47
	and a
	jr nz, .asm_3c17a
	call LoadScreenTilesFromBuffer1
	ld hl, UnnamedText_3c1a8 ; $41a8
	jp PrintText
.asm_3c17a
	ld hl, Func_4277
	ld b, BANK(Func_4277)
	call Bankswitch ; indirect jump to Func_4277 (4277 (1:4277))
	ld a, [$cffb]
	add a
	ld b, a
	jp c, asm_3c202
	ld a, [$cce9]
	and a
	jr z, .asm_3c194
	srl b
	srl b
.asm_3c194
	ld a, [$cce8]
	and a
	jr z, .asm_3c1a0
	sla b
	jr nc, .asm_3c1a0
	ld b, $ff
.asm_3c1a0
	call GenRandom
	cp b
	jr nc, .asm_3c14f
	jr asm_3c202
; 3c1a8 (f:41a8)
UnnamedText_3c1a8: ; 3c1a8 (f:41a8)
	TX_FAR _UnnamedText_3c1a8
	db $50
; 0x3c1a8 + 5 bytes

; known jump sources: 3c15e (f:415e)
Func_3c1ad: ; 3c1ad (f:41ad)
	xor a
	ld [W_WHICHPOKEMON], a ; $cf92
.asm_3c1b1
	call Func_3ca97
	jr nz, .asm_3c1bc
	ld hl, W_WHICHPOKEMON ; $cf92
	inc [hl]
	jr .asm_3c1b1
.asm_3c1bc
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld [W_PLAYERMONNUMBER], a ; $cc2f
	inc a
	ld hl, W_NUMINPARTY ; $d163
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
	ld [$cf91], a
	ld [$cfd9], a
	call LoadScreenTilesFromBuffer1
	FuncCoord 1, 5 ; $c405
	ld hl, Coord
	ld a, $9
	call Func_3c8df
	call SaveScreenTilesToBuffer1
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld c, a
	ld b, $1
	push bc
	ld hl, W_PLAYERMONSALIVEFLAGS
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	ld hl, $ccf5
	pop bc
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	call Func_3cba6
	call LoadScreenTilesFromBuffer1
	call Func_3cc91
	jr MainInBattleLoop
asm_3c202: ; 3c202 (f:4202)
	call LoadScreenTilesFromBuffer1
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	ld hl, UnnamedText_3c229 ; $4229
	jr nz, .asm_3c216
	xor a
	ld [$cf0b], a
	ld hl, UnnamedText_3c22e ; $422e
.asm_3c216
	call PrintText
	ld a, $97
	call PlaySoundWaitForCurrent
	xor a
	ld [H_WHOSETURN], a ; $FF00+$f3
	ld hl, Func_792b9
	ld b, BANK(Func_792b9)
	jp Bankswitch ; indirect jump to Func_792b9 (792b9 (1e:52b9))
; 3c229 (f:4229)
UnnamedText_3c229: ; 3c229 (f:4229)
	TX_FAR _UnnamedText_3c229
	db $50
; 0x3c229 + 5 bytes

UnnamedText_3c22e: ; 3c22e (f:422e)
	TX_FAR _UnnamedText_3c22e
	db $50
; 0x3c22e + 5 bytes


MainInBattleLoop: ; 3c233 (f:4233)
	call ReadPlayerMonCurHPAndStatus
	ld hl, W_PLAYERMONCURHP
	ld a, [hli]
	or [hl]
	jp z, HandlePlayerMonFainted  ; test if current player mon is fainted
	ld hl, $cfe6
	ld a, [hli]
	or [hl]
	jp z, Func_3c525
	call SaveScreenTilesToBuffer1
	xor a
	ld [$d11d], a
	ld a, [$d063]
	and $60
	jr nz, .asm_3c2a6 ; 0x3c252 $52
	ld hl, $d067
	res 3, [hl]
	ld hl, $d062
	res 3, [hl]
	ld a, [hl]
	and $12
	jr nz, .asm_3c2a6 ; 0x3c261 $43
	call InitBattleMenu ; show battle menu
	ret c
	ld a, [$d078]
	and a
	ret nz
	ld a, [$d018]
	and $27
	jr nz, .asm_3c2a6 ; 0x3c271 $33
	ld a, [$d062]
	and $21
	jr nz, .asm_3c2a6 ; 0x3c278 $2c
	ld a, [$d067]
	bit 5, a
	jr z, .asm_3c288 ; 0x3c27f $7
	ld a, $ff
	ld [$ccdc], a
	jr .asm_3c2a6 ; 0x3c286 $1e
.asm_3c288
	ld a, [$cd6a]
	and a
	jr nz, .asm_3c2a6 ; 0x3c28c $18
	ld [$ccdb], a
	inc a
	ld [$d07c], a
	xor a
	ld [$cc35], a
	call MoveSelectionMenu
	push af
	call LoadScreenTilesFromBuffer1
	call Func_3cd5a
	pop af
	jr nz, MainInBattleLoop
.asm_3c2a6
	call SelectEnemyMove
	ld a, [W_ISLINKBATTLE]
	cp $4
	jr nz, .noLinkBattle
	ld a, [$cc3e]
	cp $f
	jp z, asm_3c202
	cp $e
	jr z, .noLinkBattle
	cp $d
	jr z, .noLinkBattle
	sub $4
	jr c, .noLinkBattle
	ld a, [$d062]
	bit 5, a
	jr z, .asm_3c2dd ; 0x3c2c9 $12
	ld a, [$cc2e]
	ld hl, W_PLAYERMONMOVES
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
	cp $76
	jr nz, .asm_3c2dd ; 0x3c2d8 $3
	ld [W_PLAYERSELECTEDMOVE], a
.asm_3c2dd
	ld hl, Function674B
	ld b, BANK(Function674B)
	call Bankswitch
.noLinkBattle
	ld a, [W_PLAYERSELECTEDMOVE]
	cp QUICK_ATTACK
	jr nz, .playerDidNotUseQuickAttack
	ld a, [W_ENEMYSELECTEDMOVE]
	cp QUICK_ATTACK
	jr z, .compareSpeed  ; both used Quick Attack
	jp .playerMovesFirst ; player used Quick Attack
.playerDidNotUseQuickAttack
	ld a, [W_ENEMYSELECTEDMOVE]
	cp QUICK_ATTACK
	jr z, .enemyMovesFirst
	ld a, [W_PLAYERSELECTEDMOVE]
	cp COUNTER
	jr nz, .playerDidNotUseCounter
	ld a, [W_ENEMYSELECTEDMOVE]
	cp COUNTER
	jr z, .compareSpeed ; both used Counter
	jr .enemyMovesFirst ; player used Counter
.playerDidNotUseCounter
	ld a, [W_ENEMYSELECTEDMOVE]
	cp COUNTER
	jr z, .playerMovesFirst
.compareSpeed
	ld de, W_PLAYERMONSPEED ; player speed value
	ld hl, W_ENEMYMONSPEED ; enemy speed value
	ld c, $2
	call StringCmp ; compare speed values
	jr z, .speedEqual
	jr nc, .playerMovesFirst
	jr .enemyMovesFirst
.speedEqual
	ld a, [$ff00+$aa]
	cp $2
	jr z, .invertOutcome
	call GenRandomInBattle
	cp $80
	jr c, .playerMovesFirst
	jr .enemyMovesFirst
.invertOutcome
	call GenRandomInBattle
	cp $80
	jr c, .enemyMovesFirst
	jr .playerMovesFirst
.enemyMovesFirst
	ld a, $1
	ld [H_WHOSETURN], a
	ld hl, TrainerAI
	ld b, BANK(TrainerAI)
	call Bankswitch
	jr c, .AIActionUsedEnemyFirst
	call Func_3e6bc ; execute enemy move
	ld a, [$d078]
	and a
	ret nz
	ld a, b
	and a
	jp z, HandlePlayerMonFainted
.AIActionUsedEnemyFirst
	call HandlePoisonBurnLeechSeed
	jp z, Func_3c525
	call Func_3cd5a
	call Func_3d65e ; execute player move
	ld a, [$d078]
	and a
	ret nz
	ld a, b
	and a
	jp z, Func_3c525
	call HandlePoisonBurnLeechSeed
	jp z, HandlePlayerMonFainted
	call Func_3cd5a
	call Func_3c50f
	jp MainInBattleLoop
.playerMovesFirst
	call Func_3d65e ; execute player move
	ld a, [$d078]
	and a
	ret nz
	ld a, b
	and a
	jp z, Func_3c525
	call HandlePoisonBurnLeechSeed
	jp z, HandlePlayerMonFainted
	call Func_3cd5a
	ld a, $1
	ld [H_WHOSETURN], a
	ld hl, TrainerAI
	ld b, BANK(TrainerAI)
	call Bankswitch
	jr c, .AIActionUsedPlayerFirst
	call Func_3e6bc ; execute enemy move
	ld a, [$d078]
	and a
	ret nz
	ld a, b
	and a
	jp z, HandlePlayerMonFainted
.AIActionUsedPlayerFirst
	call HandlePoisonBurnLeechSeed
	jp z, Func_3c525
	call Func_3cd5a
	call Func_3c50f
	jp MainInBattleLoop

; known jump sources: 3c358 (f:4358), 3c36e (f:436e), 3c38a (f:438a), 3c3ae (f:43ae)
HandlePoisonBurnLeechSeed: ; 3c3bd (f:43bd)
	ld hl, W_PLAYERMONCURHP ; $d015
	ld de, W_PLAYERMONSTATUS ; $d018
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .playersTurn
	ld hl, W_ENEMYMONCURHP ; $cfe6
	ld de, W_ENEMYMONSTATUS ; $cfe9
.playersTurn
	ld a, [de]
	and BRN | PSN
	jr z, .notBurnedOrPoisoned
	push hl
	ld hl, HurtByPoisonText
	ld a, [de]
	and BRN
	jr z, .poisoned
	ld hl, HurtByBurnText
.poisoned
	call PrintText
	xor a
	ld [$cc5b], a
	ld a, $ba
	call PlayMoveAnimation   ; play burn/poison animation
	pop hl
	call HandlePoisonBurnLeechSeed_DecreaseOwnHP
.notBurnedOrPoisoned
	ld de, W_PLAYERBATTSTATUS2 ; $d063
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .playersTurn2
	ld de, W_ENEMYBATTSTATUS2 ; $d068
.playersTurn2
	ld a, [de]
	add a
	jr nc, .notLeechSeeded
	push hl
	ld a, [H_WHOSETURN] ; $FF00+$f3
	push af
	xor $1
	ld [H_WHOSETURN], a ; $FF00+$f3
	xor a
	ld [$cc5b], a
	ld a, $47
	call PlayMoveAnimation ; play leech seed animation (from opposing mon)
	pop af
	ld [H_WHOSETURN], a ; $FF00+$f3
	pop hl
	call HandlePoisonBurnLeechSeed_DecreaseOwnHP
	call HandlePoisonBurnLeechSeed_IncreaseEnemyHP
	push hl
	ld hl, HurtByLeechSeedText
	call PrintText
	pop hl
.notLeechSeeded
	ld a, [hli]
	or [hl]
	ret nz          ; test if fainted
	call Func_3cd5a
	ld c, $14
	call DelayFrames
	xor a
	ret
; 3c42e (f:442e)

HurtByPoisonText: ; 3c42e (f:442e)
	TX_FAR _HurtByPoisonText
	db $50
; 0x3c42e + 5 bytes

HurtByBurnText: ; 3c433 (f:4433)
	TX_FAR _HurtByBurnText
	db $50
; 0x3c433 + 5 bytes

HurtByLeechSeedText: ; 3c438 (f:4438)
	TX_FAR _HurtByLeechSeedText
	db $50
; 0x3c438 + 5 bytes

; known jump sources: 3c3ec (f:43ec), 3c413 (f:4413)
; decreases the mon's current HP by 1/16 of the Max HP (multiplied by number of toxic ticks if active)
; note that the toxic ticks are considered even if the damage is not poison (hence the Leech Seed glitch)
; hl: HP pointer
; bc (out): total damage
HandlePoisonBurnLeechSeed_DecreaseOwnHP: ; 3c43d (f:443d)
	push hl
	push hl
	ld bc, $e      ; skip to max HP
	add hl, bc
	ld a, [hli]    ; load max HP
	ld [W_HPBARMAXHP+1], a
	ld b, a
	ld a, [hl]
	ld [W_HPBARMAXHP], a
	ld c, a
	srl b
	rr c
	srl b
	rr c
	srl c
	srl c         ; c = max HP/16 (assumption: HP < 1024)
	ld a, c
	and a
	jr nz, .nonZeroDamage
	inc c         ; damage is at least 1
.nonZeroDamage
	ld hl, W_PLAYERBATTSTATUS3 ; $d064
	ld de, W_PLAYERTOXICCOUNTER ; $d06c
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .playersTurn
	ld hl, W_ENEMYBATTSTATUS3 ; $d069
	ld de, W_ENEMYTOXICCOUNTER ; $d071
.playersTurn
	bit 0, [hl]
	jr z, .noToxic
	ld a, [de]    ; increment toxic counter
	inc a
	ld [de], a
	ld hl, $0000
.toxicTicksLoop
	add hl, bc
	dec a
	jr nz, .toxicTicksLoop
	ld b, h       ; bc = damage * toxic counter
	ld c, l
.noToxic
	pop hl
	inc hl
	ld a, [hl]    ; subtract total damage from current HP
	ld [W_HPBAROLDHP], a
	sub c
	ld [hld], a
	ld [W_HPBARNEWHP], a
	ld a, [hl]
	ld [W_HPBAROLDHP+1], a
	sbc b
	ld [hl], a
	ld [W_HPBARNEWHP+1], a
	jr nc, .noOverkill
	xor a         ; overkill: zero HP
	ld [hli], a
	ld [hl], a
	ld [W_HPBARNEWHP], a
	ld [W_HPBARNEWHP+1], a
.noOverkill
	call UpdateCurMonHPBar
	pop hl
	ret

; known jump sources: 3c416 (f:4416)
; adds bc to enemy HP
HandlePoisonBurnLeechSeed_IncreaseEnemyHP: ; 3c4a3 (f:44a3)
	push hl
	ld hl, W_ENEMYMONMAXHP ; $cff4
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .playersTurn
	ld hl, W_PLAYERMONMAXHP ; $d023
.playersTurn
	ld a, [hli]
	ld [W_HPBARMAXHP+1], a
	ld a, [hl]
	ld [W_HPBARMAXHP], a
	ld de, $fff2
	add hl, de           ; skip back fomr max hp to current hp
	ld a, [hl]
	ld [W_HPBAROLDHP], a ; add bc to current HP
	add c
	ld [hld], a
	ld [W_HPBARNEWHP], a
	ld a, [hl]
	ld [W_HPBAROLDHP+1], a
	adc b
	ld [hli], a
	ld [W_HPBARNEWHP+1], a
	ld a, [W_HPBARMAXHP]
	ld c, a
	ld a, [hld]
	sub c
	ld a, [W_HPBARMAXHP+1]
	ld b, a
	ld a, [hl]
	sbc b
	jr c, .noOverfullHeal
	ld a, b                ; overfull heal, set HP to max HP
	ld [hli], a
	ld [W_HPBARNEWHP+1], a
	ld a, c
	ld [hl], a
	ld [W_HPBARNEWHP], a
.noOverfullHeal
	ld a, [H_WHOSETURN] ; $FF00+$f3
	xor $1
	ld [H_WHOSETURN], a ; $FF00+$f3
	call UpdateCurMonHPBar
	ld a, [H_WHOSETURN] ; $FF00+$f3
	xor $1
	ld [H_WHOSETURN], a ; $FF00+$f3
	pop hl
	ret

; known jump sources: 3c49e (f:449e), 3c4eb (f:44eb)
UpdateCurMonHPBar: ; 3c4f6 (f:44f6)
	FuncCoord 10, 9 ; $c45e
	ld hl, Coord    ; tile pointer to player HP bar
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, $1
	jr z, .playersTurn
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord    ; tile pointer to enemy HP bar
	xor a
.playersTurn
	push bc
	ld [W_LISTMENUID], a ; $cf94
	ld a, $48
	call Predef ; indirect jump to UpdateHPBar (fa1d (3:7a1d))
	pop bc
	ret

; known jump sources: 3c377 (f:4377), 3c3b7 (f:43b7)
Func_3c50f: ; 3c50f (f:450f)
	ld a, [$d06a]
	and a
	jr nz, .asm_3c51a
	ld hl, W_PLAYERBATTSTATUS1 ; $d062
	res 5, [hl]
.asm_3c51a
	ld a, [$d06f]
	and a
	ret nz
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	res 5, [hl]
	ret

; known jump sources: 3c243 (f:4243), 3c35b (f:435b), 3c36b (f:436b), 3c387 (f:4387), 3c3b1 (f:43b1)
Func_3c525: ; 3c525 (f:4525)
	xor a
	ld [$ccf0], a
	call Func_3c567
	call AnyPokemonAliveCheck
	ld a, d
	and a
	jp z, HandlePlayerBlackOut
	ld hl, W_PLAYERMONCURHP ; $d015
	ld a, [hli]
	or [hl]
	call nz, Func_3cd60
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	ret z
	call Func_3c64f
	jp z, TrainerBattleVictory
	ld hl, W_PLAYERMONCURHP ; $d015
	ld a, [hli]
	or [hl]
	jr nz, .asm_3c555
	call Func_3c79b
	ret c
	call Func_3c7d8
.asm_3c555
	ld a, $1
	ld [$cd6a], a
	call Func_3c664
	jp z, asm_3c202
	xor a
	ld [$cd6a], a
	jp MainInBattleLoop

; known jump sources: 3c529 (f:4529), 3c717 (f:4717)
Func_3c567: ; 3c567 (f:4567)
	call ReadPlayerMonCurHPAndStatus
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	jr z, .asm_3c57f
	ld a, [W_ENEMYMONNUMBER] ; $cfe8
	ld hl, W_WATERMONS ; $d8a5 (aliases: W_ENEMYMON1HP)
	ld bc, $2c
	call AddNTimes
	xor a
	ld [hli], a
	ld [hl], a
.asm_3c57f
	ld hl, W_PLAYERBATTSTATUS1 ; $d062
	res 2, [hl]
	xor a
	ld [W_NUMHITS], a ; $d074
	ld hl, $d065
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld [W_ENEMYDISABLEDMOVE], a ; $d072
	ld [$ccef], a
	ld [$ccf3], a
	ld hl, $ccf1
	ld [hli], a
	ld [hl], a
	FuncCoord 12, 5 ; $c410
	ld hl, Coord
	FuncCoord 12, 6 ; $c424
	ld de, Coord
	call Func_3c893
	ld hl, W_SCREENTILESBUFFER
	ld bc, $40b
	call ClearScreenArea
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	jr z, .asm_3c5d3
	xor a
	ld [$c0f1], a
	ld [$c0f2], a
	ld a, $9e
	call PlaySoundWaitForCurrent
.asm_3c5c2
	ld a, [$c02a]
	cp $9e
	jr z, .asm_3c5c2
	ld a, $95
	call PlaySound
	call WaitForSoundToFinish
	jr .asm_3c5db
.asm_3c5d3
	call Func_3c643
	ld a, $f9
	call Func_3c6ee
.asm_3c5db
	ld hl, W_PLAYERMONCURHP ; $d015
	ld a, [hli]
	or [hl]
	jr nz, .asm_3c5eb
	ld a, [$ccf0]
	and a
	jr nz, .asm_3c5eb
	call Func_3c741
.asm_3c5eb
	call AnyPokemonAliveCheck
	ld a, d
	and a
	ret z
	ld hl, UnnamedText_3c63e ; $463e
	call PrintText
	call Func_3ee94
	call SaveScreenTilesToBuffer1
	xor a
	ld [$cf0b], a
	ld b, $4b
	call IsItemInBag
	push af
	jr z, .asm_3c614
	ld hl, $d002
	ld b, $7
.asm_3c60e
	srl [hl]
	inc hl
	dec b
	jr nz, .asm_3c60e
.asm_3c614
	xor a
	ld [$cc5b], a
	ld hl, Func_5524f
	ld b, BANK(Func_5524f)
	call Bankswitch ; indirect jump to Func_5524f (5524f (15:524f))
	pop af
	ret z
	ld a, $1
	ld [$cc5b], a
	ld a, [W_NUMINPARTY] ; $d163
	ld b, $0
.asm_3c62c
	scf
	rl b
	dec a
	jr nz, .asm_3c62c
	ld a, b
	ld [W_PLAYERMONSALIVEFLAGS], a
	ld hl, Func_5524f
	ld b, BANK(Func_5524f)
	jp Bankswitch ; indirect jump to Func_5524f (5524f (15:524f))
; 3c63e (f:463e)
UnnamedText_3c63e: ; 3c63e (f:463e)
	TX_FAR _UnnamedText_3c63e
	db $50
; 0x3c63e + 5 bytes

; known jump sources: 3c5d3 (f:45d3), 3c696 (f:4696)
Func_3c643: ; 3c643 (f:4643)
	xor a
	ld [$d083], a
	ld [$c02a], a
	inc a
	ld [$ccf6], a
	ret

; known jump sources: 3c541 (f:4541), 3c71f (f:471f)
Func_3c64f: ; 3c64f (f:464f)
	ld a, [W_ENEMYMONCOUNT] ; $d89c
	ld b, a
	xor a
	ld hl, W_WATERMONS ; $d8a5 (aliases: W_ENEMYMON1HP)
	ld de, $2c
.asm_3c65a
	or [hl]
	inc hl
	or [hl]
	dec hl
	add hl, de
	dec b
	jr nz, .asm_3c65a
	and a
	ret

; known jump sources: 3c55a (f:455a), 3c734 (f:4734)
Func_3c664: ; 3c664 (f:4664)
	ld hl, $cf1e
	ld e, $30
	call Func_3ce90
	ld hl, Func_3a857
	ld b, BANK(Func_3a857)
	call Bankswitch ; indirect jump to Func_3a857 (3a857 (e:6857))
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr nz, .asm_3c687
	call Func_3d605
	ld a, [$cc3e]
	cp $f
	ret z
	call LoadScreenTilesFromBuffer1
.asm_3c687
	call EnemySendOut
	xor a
	ld [W_ENEMYMOVENUM], a ; $cfcc
	ld [$cd6a], a
	ld [$ccd5], a
	inc a
	ret

; known jump sources: 3c544 (f:4544), 3c722 (f:4722)
TrainerBattleVictory: ; 3c696 (f:4696)
	call Func_3c643
	ld b, $fc
	ld a, [W_GYMLEADERNO] ; $d05c
	and a
	jr nz, .notgymleader
	ld b, $f6 ; gym leader win music
.notgymleader
	ld a, [W_TRAINERCLASS] ; $d031
	cp SONY3 ; final battle against rival
	jr nz, .notrival
	ld b, $fc ; final rival battle win music
	ld hl, W_FLAGS_D733
	set 1, [hl]
.notrival
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	ld a, b
	call nz, Func_3c6ee
	ld hl, TrainerDefeatedText ; $46e9
	call PrintText
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	ret z
	call Func_3ed12
	ld c, $28
	call DelayFrames
	call Func_3381
	ld hl, MoneyForWinningText ; $46e4
	call PrintText
	ld de, W_PLAYERMONEY1 ; $d349
	ld hl, $d07b
	ld c, $3
	ld a, $b
	jp Predef ; indirect jump to Func_f81d (f81d (3:781d))
; 3c6e4 (f:46e4)

MoneyForWinningText: ; 3c6e4 (f:46e4)
	TX_FAR _MoneyForWinningText
	db "@"

TrainerDefeatedText: ; 3c6e9 (f:46e9)
	TX_FAR _TrainerDefeatedText
	db "@"
; 0x3c6e9 + 5 bytes

; known jump sources: 3c5d8 (f:45d8), 3c6b7 (f:46b7)
Func_3c6ee: ; 3c6ee (f:46ee)
	push af
	ld a, $ff
	ld [$c0ee], a
	call PlaySoundWaitForCurrent
	ld c, $8
	pop af
	call PlayMusic
	jp Delay3

; known jump sources: 3c23b (f:423b), 3c355 (f:4355), 3c371 (f:4371), 3c38d (f:438d), 3c3ab (f:43ab)
HandlePlayerMonFainted: ; 3c700 (f:4700)
	ld a, $1
	ld [$ccf0], a
	call Func_3c741
	call AnyPokemonAliveCheck     ; test if any more mons are alive
	ld a, d
	and a
	jp z, HandlePlayerBlackOut
	ld hl, W_ENEMYMONCURHP ; $cfe6
	ld a, [hli]
	or [hl]
	jr nz, .enemyMonNotFainted
	call Func_3c567
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	ret z            ; if wild encounter, battle is over
	call Func_3c64f
	jp z, TrainerBattleVictory
.enemyMonNotFainted
	call Func_3c79b
	ret c
	call Func_3c7d8
	jp nz, MainInBattleLoop
	ld a, $1
	ld [$cd6a], a
	call Func_3c664
	jp z, asm_3c202
	xor a
	ld [$cd6a], a
	jp MainInBattleLoop

; known jump sources: 3c5e8 (f:45e8), 3c705 (f:4705)
Func_3c741: ; 3c741 (f:4741)
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	ld c, a
	ld hl, W_PLAYERMONSALIVEFLAGS ; clear fainted mon's alive flag
	ld b, $0
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	res 2, [hl]   ; reset "attacking multiple times" flag
	ld a, [$d083]
	bit 7, a      ; skip sound flag (red bar (?))
	jr z, .skipWaitForSound
	ld a, $ff
	ld [$d083], a
	call WaitForSoundToFinish
.skipWaitForSound
	ld hl, $cd05
	ld [hli], a
	ld [hl], a
	ld [W_PLAYERMONSTATUS], a ; $d018
	call ReadPlayerMonCurHPAndStatus
	FuncCoord 9, 7 ; $c435
	ld hl, Coord
	ld bc, $50b
	call ClearScreenArea
	FuncCoord 1, 10 ; $c469
	ld hl, Coord
	FuncCoord 1, 11 ; $c47d
	ld de, Coord
	call Func_3c893
	ld a, $1
	ld [$cf0b], a
	ld a, [$ccf0]
	and a
	ret z
	ld a, [W_PLAYERMONID]
	call PlayCry
	ld hl, PlayerMonFaintedText
	jp PrintText
; 3c796 (f:4796)

PlayerMonFaintedText: ; 3c796 (f:4796)
	TX_FAR _PlayerMonFaintedText
	db $50
; 0x3c796 + 5 bytes

; known jump sources: 3c54e (f:454e), 3c725 (f:4725)
Func_3c79b: ; 3c79b (f:479b)
	call Func_3ee94
	call SaveScreenTilesToBuffer1
	ld a, [W_ISINBATTLE] ; $d057
	and a
	dec a
	ret nz
	ld hl, UnnamedText_3c7d3 ; $47d3
	call PrintText
.asm_3c7ad
	FuncCoord 13, 9 ; $c461
	ld hl, Coord
	ld bc, $a0e
	ld a, $14
	ld [$d125], a
	call DisplayTextBoxID
	ld a, [$d12e]
	cp $2
	jr z, .asm_3c7c4
	and a
	ret
.asm_3c7c4
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jr z, .asm_3c7ad
	ld hl, W_PARTYMON1_SPEED ; $d193
	ld de, W_ENEMYMONSPEED
	jp Func_3cab9
; 3c7d3 (f:47d3)
UnnamedText_3c7d3: ; 3c7d3 (f:47d3)
	TX_FAR _UnnamedText_3c7d3
	db $50
; 0x3c7d3 + 5 bytes

; known jump sources: 3c552 (f:4552), 3c729 (f:4729)
Func_3c7d8: ; 3c7d8 (f:47d8)
	ld a, $2
	ld [$d07d], a
	call DisplayPartyMenu
.asm_3c7e0
	jr nc, .asm_3c7e7
.asm_3c7e2
	call GoBackToPartyMenu
	jr .asm_3c7e0
.asm_3c7e7
	call Func_3ca97
	jr z, .asm_3c7e2
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr nz, .asm_3c7fa
	inc a
	ld [$cd6a], a
	call Func_3d605
.asm_3c7fa
	xor a
	ld [$cd6a], a
	call CleanLCD_OAM
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld [W_PLAYERMONNUMBER], a ; $cc2f
	ld c, a
	ld hl, W_PLAYERMONSALIVEFLAGS
	ld b, $1
	push bc
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	pop bc
	ld hl, $ccf5
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	call Func_3cba6
	call GBPalWhiteOut
	call Func_3ee5b
	call LoadScreenTilesFromBuffer1
	call GoPAL_SET_CF1C
	call GBPalNormal
	call Func_3cc91
	ld hl, W_ENEMYMONCURHP ; $cfe6
	ld a, [hli]
	or [hl]
	ret

; known jump sources: 3c154 (f:4154), 3c531 (f:4531), 3c70d (f:470d)
; called when player is out of usable mons.
; prints approriate lose message, sets carry flag if player blacked out (special case for initial rival fight)
HandlePlayerBlackOut: ; 3c837 (f:4837)
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr z, .notSony1Battle
	ld a, [W_CUROPPONENT] ; $d059
	cp $c8 + SONY1
	jr nz, .notSony1Battle
	ld hl, W_SCREENTILESBUFFER  ; sony 1 battle
	ld bc, $815
	call ClearScreenArea
	call Func_3ed12
	ld c, $28
	call DelayFrames
	ld hl, Sony1WinText
	call PrintText
	ld a, [W_CURMAP]
	cp OAKS_LAB
	ret z            ; starter battle in oak's lab: don't black out
.notSony1Battle
	ld b, $0
	call GoPAL_SET
	ld hl, PlayerBlackedOutText2
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr nz, .noLinkBattle
	ld hl, LinkBattleLostText
.noLinkBattle
	call PrintText
	ld a, [$d732]
	res 5, a
	ld [$d732], a
	call ClearScreen
	scf
	ret
; 3c884 (f:4884)

Sony1WinText: ; 3c884 (f:4884)
	TX_FAR _Sony1WinText
	db $50
; 0x3c884 + 5 bytes

PlayerBlackedOutText2: ; 3c889 (f:4889)
	TX_FAR _PlayerBlackedOutText2
	db $50
; 0x3c889 + 5 bytes

LinkBattleLostText: ; 3c88e (f:488e)
	TX_FAR _LinkBattleLostText
	db $50
; 0x3c88e + 5 bytes

; known jump sources: 3c5a4 (f:45a4), 3c77d (f:477d)
Func_3c893: ; 3c893 (f:4893)
	ld a, [$d730]
	push af
	set 6, a
	ld [$d730], a
	ld b, $7
.asm_3c89e
	push bc
	push de
	push hl
	ld b, $6
.asm_3c8a3
	push bc
	push hl
	push de
	ld bc, $7
	call CopyData
	pop de
	pop hl
	ld bc, $ffec
	add hl, bc
	push hl
	ld h, d
	ld l, e
	add hl, bc
	ld d, h
	ld e, l
	pop hl
	pop bc
	dec b
	jr nz, .asm_3c8a3
	ld bc, $14
	add hl, bc
	ld de, Unknown_3c8d7 ; $48d7
	call PlaceString
	ld c, $2
	call DelayFrames
	pop hl
	pop de
	pop bc
	dec b
	jr nz, .asm_3c89e
	pop af
	ld [$d730], a
	ret

Unknown_3c8d7: ; 3c8d7 (f:48d7)
INCBIN "baserom.gbc",$3c8d7,$3c8df - $3c8d7

; known jump sources: 3c1d9 (f:41d9), 3c94f (f:494f)
Func_3c8df: ; 3c8df (f:48df)
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld c, a
.asm_3c8e2
	push bc
	push hl
	ld b, $7
.asm_3c8e6
	push hl
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	ld c, a
.asm_3c8ea
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	cp $8
	jr z, .asm_3c8f5
	ld a, [hld]
	ld [hli], a
	inc hl
	jr .asm_3c8f8
.asm_3c8f5
	ld a, [hli]
	ld [hld], a
	dec hl
.asm_3c8f8
	dec c
	jr nz, .asm_3c8ea
	pop hl
	ld de, $14
	add hl, de
	dec b
	jr nz, .asm_3c8e6
	ld c, $2
	call DelayFrames
	pop hl
	pop bc
	dec c
	jr nz, .asm_3c8e2
	ret
; 3c90e (f:490e)

; XXX this needs cleaning up. it's what runs when a juggler switches pokemon
EnemySendOut: ; 3c90e (f:490e)
	ld hl,W_PLAYERMONSALIVEFLAGS
	xor a
	ld [hl],a
	ld a,[$CC2F]
	ld c,a
	ld b,1
	push bc
	ld a,$10
	call Predef
	ld hl,$CCF5
	xor a
	ld [hl],a
	pop bc
	ld a,$10
	call Predef
Func_3c92a: ; 3c92a (f:492a)
	xor a
	ld hl,$D065
	ld [hli],a
	ld [hli],a
	ld [hli],a
	ld [hli],a
	ld [hl],a
	ld [$D072],a
	ld [$CCEF],a
	ld [$CCF3],a
	ld hl,$CCF1
	ld [hli],a
	ld [hl],a
	dec a
	ld [W_AICOUNT],a
	ld hl,W_PLAYERBATTSTATUS1
	res 5,[hl]
	FuncCoord 18, 0 ; $c3b2
	ld hl,Coord
	ld a,8
	call Func_3c8df
	call Func_3ee94
	call SaveScreenTilesToBuffer1
	ld a,[$D12B]
	cp 4
	jr nz,.next
	ld a,[$CC3E]
	sub 4
	ld [$CF92],a
	jr .next3
.next
	ld b,$FF
.next2
	inc b
	ld a,[$CFE8]
	cp b
	jr z,.next2
	ld hl,$D8A4
	ld a,b
	ld [$CF92],a
	push bc
	ld bc,$2C
	call AddNTimes
	pop bc
	inc hl
	ld a,[hli]
	ld c,a
	ld a,[hl]
	or c
	jr z,.next2
.next3
	ld a,[$CF92]
	ld hl,$D8C5
	ld bc,$2C
	call AddNTimes
	ld a,[hl]
	ld [$D127],a
	ld a,[$CF92]
	inc a
	ld hl,$D89C
	ld c,a
	ld b,0
	add hl,bc
	ld a,[hl]
	ld [W_ENEMYMONID],a
	ld [$CF91],a
	call Func_3eb01
	ld hl,$CFE6
	ld a,[hli]
	ld [$CCE3],a
	ld a,[hl]
	ld [$CCE4],a
	ld a,1
	ld [$CC26],a
	ld a,[$D11D]
	dec a
	jr z,.next4
	ld a,[W_NUMINPARTY]
	dec a
	jr z,.next4
	ld a,[$D12B]
	cp 4
	jr z,.next4
	ld a,[$D355]
	bit 6,a
	jr nz,.next4
	ld hl, TrainerAboutToUseText
	call PrintText
	FuncCoord 0, 7 ; $c42c
	ld hl,Coord
	ld bc,$0801
	ld a,$14
	ld [$D125],a
	call DisplayTextBoxID
	ld a,[$CC26]
	and a
	jr nz,.next4
	ld a,2
	ld [$D07D],a
	call DisplayPartyMenu
.next9
	ld a,1
	ld [$CC26],a
	jr c,.next7
	ld hl,$CC2F
	ld a,[$CF92]
	cp [hl]
	jr nz,.next6
	ld hl,UnnamedText_3d1f5 ; $51f5
	call PrintText
.next8
	call GoBackToPartyMenu
	jr .next9
.next6
	call Func_3ca97
	jr z,.next8
	xor a
	ld [$CC26],a
.next7
	call GBPalWhiteOut
	call Func_3ee5b
	call LoadScreenTilesFromBuffer1
.next4
	call CleanLCD_OAM
	ld hl,W_SCREENTILESBUFFER
	ld bc,$040B
	call ClearScreenArea
	ld b,1
	call GoPAL_SET
	call GBPalNormal
	ld hl,TrainerSentOutText
	call PrintText
	ld a,[W_ENEMYMONID]
	ld [$CF91],a
	ld [$D0B5],a
	call GetMonHeader
	ld de,$9000
	call LoadMonFrontSprite
	ld a,$CF
	ld [$FFE1],a
	FuncCoord 15, 6 ; $c427
	ld hl,Coord
	ld a,2
	call Predef
	ld a,[W_ENEMYMONID]
	call PlayCry
	call Func_3cdec
	ld a,[$CC26]
	and a
	ret nz
	xor a
	ld [W_PLAYERMONSALIVEFLAGS],a
	ld [$CCF5],a
	call SaveScreenTilesToBuffer1
	jp Func_3d1ba

TrainerAboutToUseText: ; 3ca79 (f:4a79)
	TX_FAR _TrainerAboutToUseText
	db "@"

TrainerSentOutText: ; 3ca7e (f:4a7e)
	TX_FAR _TrainerSentOutText
	db "@"

; tests if the player has any pokemon that are not fainted
; sets d = 0 if all fainted, d != 0 if some mons are still alive
AnyPokemonAliveCheck: ; 3ca83 (f:4a83)
	ld a, [W_NUMINPARTY] ; $d163
	ld e, a
	xor a
	ld hl, W_PARTYMON1_HP ; $d16c
	ld bc, W_PARTYMON2_HP - W_PARTYMON1_HP - 1  ; $2b
.partyMonsLoop
	or [hl]
	inc hl
	or [hl]
	add hl, bc
	dec e
	jr nz, .partyMonsLoop
	ld d, a
	ret

; known jump sources: 3c1b1 (f:41b1), 3c7e7 (f:47e7), 3ca14 (f:4a14), 3d19d (f:519d)
Func_3ca97: ; 3ca97 (f:4a97)
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, W_PARTYMON1_HP ; $d16c
	ld bc, $2c
	call AddNTimes
	ld a, [hli]
	or [hl]
	ret nz
	ld a, [$d11d]
	and a
	jr nz, .asm_3cab2
	ld hl, UnnamedText_3cab4 ; $4ab4
	call PrintText
.asm_3cab2
	xor a
	ret
; 3cab4 (f:4ab4)
UnnamedText_3cab4: ; 3cab4 (f:4ab4)
	TX_FAR _UnnamedText_3cab4
	db $50
; 0x3cab4 + 5 bytes

; known jump sources: 3c7d0 (f:47d0), 3d208 (f:5208)
Func_3cab9: ; 3cab9 (f:4ab9)
	call Function583A
	jp z, .asm_3cb5c
	ld a, [W_BATTLETYPE] ; $d05a
	cp $2
	jp z, .asm_3cb5c
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jp z, .asm_3cb5c
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	jr nz, .asm_3cb4c
	ld a, [$d120]
	inc a
	ld [$d120], a
	ld a, [hli]
	ld [$FF00+$97], a
	ld a, [hl]
	ld [$FF00+$98], a
	ld a, [de]
	ld [$FF00+$8d], a
	inc de
	ld a, [de]
	ld [$FF00+$8e], a
	call LoadScreenTilesFromBuffer1
	ld de, $ff97
	ld hl, $ff8d
	ld c, $2
	call StringCmp
	jr nc, .asm_3cb5c
	xor a
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, $20
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	call Multiply
	ld a, [$FF00+$97]
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ld a, [$FF00+$98]
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [$FF00+$8d]
	ld b, a
	ld a, [$FF00+$8e]
	srl b
	rr a
	srl b
	rr a
	and a
	jr z, .asm_3cb5c
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld b, $2
	call Divide
	ld a, [$FF00+$97]
	and a
	jr nz, .asm_3cb5c
	ld a, [$d120]
	ld c, a
.asm_3cb2b
	dec c
	jr z, .asm_3cb39
	ld b, $1e
	ld a, [$FF00+$98]
	add b
	ld [$FF00+$98], a
	jr c, .asm_3cb5c
	jr .asm_3cb2b
.asm_3cb39
	call GenRandomInBattle
	ld b, a
	ld a, [$FF00+$98]
	cp b
	jr nc, .asm_3cb5c
	ld a, $1
	ld [$cd6a], a
	ld hl, UnnamedText_3cb97 ; $4b97
	jr .asm_3cb4f
.asm_3cb4c
	ld hl, UnnamedText_3cb9c ; $4b9c
.asm_3cb4f
	call PrintText
	ld a, $1
	ld [$d11f], a
	call SaveScreenTilesToBuffer1
	and a
	ret
.asm_3cb5c
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	ld a, $2
	jr nz, .asm_3cb81
	call SaveScreenTilesToBuffer1
	xor a
	ld [$cd6a], a
	ld a, $f
	ld [W_PLAYERMOVELISTINDEX], a ; $cc2e
	call Func_3d605
	call LoadScreenTilesFromBuffer1
	ld a, [$cc3e]
	cp $f
	ld a, $2
	jr z, .asm_3cb81
	dec a
.asm_3cb81
	ld [$cf0b], a
	ld a, $97
	call PlaySoundWaitForCurrent
	ld hl, UnnamedText_3cba1 ; $4ba1
	call PrintText
	call WaitForSoundToFinish
	call SaveScreenTilesToBuffer1
	scf
	ret
; 3cb97 (f:4b97)
UnnamedText_3cb97: ; 3cb97 (f:4b97)
	TX_FAR _UnnamedText_3cb97
	db $50
; 0x3cb97 + 5 bytes

UnnamedText_3cb9c: ; 3cb9c (f:4b9c)
	TX_FAR _UnnamedText_3cb9c
	db $50
; 0x3cb9c + 5 bytes

UnnamedText_3cba1: ; 3cba1 (f:4ba1)
	TX_FAR _UnnamedText_3cba1
	db $50
; 0x3cba1 + 5 bytes

; known jump sources: 3c1f7 (f:41f7), 3c81c (f:481c), 3d1e5 (f:51e5)
Func_3cba6: ; 3cba6 (f:4ba6)
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld bc, $2c
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	call AddNTimes
	ld de, W_PLAYERMONID
	ld bc, $c
	call CopyData
	ld bc, $f
	add hl, bc
	ld de, W_PLAYERMONIVS
	ld bc, $2
	call CopyData
	ld de, W_PLAYERMONPP ; $d02d
	ld bc, $4
	call CopyData
	ld de, W_PLAYERMONLEVEL ; $d022
	ld bc, $b
	call CopyData
	ld a, [$cfd9]
	ld [$d0b5], a
	call GetMonHeader
	ld hl, W_PARTYMON1NAME ; $d2b5
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	call SkipFixedLengthTextEntries
	ld de, W_PLAYERMONNAME
	ld bc, $b
	call CopyData
	ld hl, W_PLAYERMONLEVEL ; $d022
	ld de, $cd0f
	ld bc, $b
	call CopyData
	call Func_3ed1a
	call Func_3ee19
	ld a, $7
	ld b, $8
	ld hl, W_PLAYERMONATTACKMOD ; $cd1a
.asm_3cc0e
	ld [hli], a
	dec b
	jr nz, .asm_3cc0e
	ret

; known jump sources: 3eb06 (f:6b06)
Func_3cc13: ; 3cc13 (f:4c13)
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld bc, $2c
	ld hl, W_WATERRATE ; $d8a4
	call AddNTimes
	ld de, $cfe5
	ld bc, $c
	call CopyData
	ld bc, $f
	add hl, bc
	ld de, $cff1
	ld bc, $2
	call CopyData
	ld de, W_ENEMYMONPP ; $cffe
	ld bc, $4
	call CopyData
	ld de, W_ENEMYMONLEVEL ; $cff3
	ld bc, $b
	call CopyData
	ld a, [$cfe5]
	ld [$d0b5], a
	call GetMonHeader
	ld hl, $d9ee
	ld a, [W_WHICHPOKEMON] ; $cf92
	call SkipFixedLengthTextEntries
	ld de, W_ENEMYMONNAME
	ld bc, $b
	call CopyData
	ld hl, W_ENEMYMONLEVEL ; $cff3
	ld de, $cd23
	ld bc, $b
	call CopyData
	call Func_3ed1e
	ld hl, W_MONHBASESTATS
	ld de, $d002
	ld b, $5
.asm_3cc79
	ld a, [hli]
	ld [de], a
	inc de
	dec b
	jr nz, .asm_3cc79
	ld a, $7
	ld b, $8
	ld hl, W_ENEMYMONATTACKMOD ; $cd2e
.asm_3cc86
	ld [hli], a
	dec b
	jr nz, .asm_3cc86
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld [W_ENEMYMONNUMBER], a ; $cfe8
	ret

; known jump sources: 3c1fd (f:41fd), 3c82e (f:482e), 3d1e8 (f:51e8)
Func_3cc91: ; 3cc91 (f:4c91)
	ld hl, Func_58e59
	ld b, BANK(Func_58e59)
	call Bankswitch ; indirect jump to Func_58e59 (58e59 (16:4e59))
	ld hl, W_ENEMYMONCURHP ; $cfe6
	ld a, [hli]
	or [hl]
	jp z, Func_3cca4
	call Func_3cdec

; known jump sources: 3cc9e (f:4c9e)
Func_3cca4: ; 3cca4 (f:4ca4)
	call Func_3cd60
	ld a, $4
	call Predef ; indirect jump to LoadMonBackSprite (3f103 (f:7103))
	xor a
	ld [$FF00+$e1], a
	ld hl, $cc2d
	ld [hli], a
	ld [hl], a
	ld [$cc5b], a
	ld [$d05b], a
	ld [W_PLAYERMOVENUM], a ; $cfd2
	ld hl, $ccf1
	ld [hli], a
	ld [hl], a
	ld hl, $d060
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld [W_PLAYERDISABLEDMOVE], a ; $d06d
	ld [$ccee], a
	ld [$ccf7], a
	ld b, $1
	call GoPAL_SET
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	res 5, [hl]
	ld a, $1
	ld [H_WHOSETURN], a ; $FF00+$f3
	ld a, $c3
	call PlayMoveAnimation
	FuncCoord 4, 11 ; $c480
	ld hl, Coord
	ld a, $2
	call Predef ; indirect jump to Func_3f073 (3f073 (f:7073))
	ld a, [$cf91]
	call PlayCry
	call Func_3ee94
	jp SaveScreenTilesToBuffer1

; known jump sources: 3d1c7 (f:51c7)
Func_3ccfa: ; 3ccfa (f:4cfa)
	FuncCoord 1, 5 ; $c405
	ld hl, Coord
	ld bc, $707
	call ClearScreenArea
	FuncCoord 3, 7 ; $c42f
	ld hl, Coord
	ld bc, $505
	xor a
	ld [$cd6c], a
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld a, $5
	call Predef ; indirect jump to Func_79aba (79aba (1e:5aba))
	ld c, $4
	call DelayFrames
	call Func_3cd3a
	FuncCoord 4, 9 ; $c458
	ld hl, Coord
	ld bc, $303
	ld a, $1
	ld [$cd6c], a
	xor a
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld a, $5
	call Predef ; indirect jump to Func_79aba (79aba (1e:5aba))
	call Delay3
	call Func_3cd3a
	ld a, $4c
	FuncCoord 5, 11 ; $c481
	ld [Coord], a

; known jump sources: 3cd19 (f:4d19), 3cd32 (f:4d32)
Func_3cd3a: ; 3cd3a (f:4d3a)
	FuncCoord 1, 5 ; $c405
	ld hl, Coord
	ld bc, $707
	jp ClearScreenArea

; known jump sources: 78c1 (1:78c1), 3c233 (f:4233), 3c567 (f:4567), 3c76b (f:476b), 3f76e (f:776e), 3f7c1 (f:77c1)
; reads player's current mon's HP into W_PLAYERMONCURHP
ReadPlayerMonCurHPAndStatus: ; 3cd43 (f:4d43)
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	ld hl, W_PARTYMON1_HP ; $d16c
	ld bc, W_PARTYMON2_HP - W_PARTYMON1_HP ; $2c
	call AddNTimes
	ld d, h
	ld e, l
	ld hl, W_PLAYERMONCURHP ; $d015
	ld bc, $4               ; 2 bytes HP, 1 byte unknown (unused?), 1 byte status
	jp CopyData

; known jump sources: 3c2a0 (f:42a0), 3c35e (f:435e), 3c374 (f:4374), 3c390 (f:4390), 3c3b4 (f:43b4), 3c424 (f:4424), 3cebc (f:4ebc), 3d017 (f:5017), 3d0ac (f:50ac), 3e19d (f:619d), 3e25b (f:625b), 3e2a9 (f:62a9)
Func_3cd5a: ; 3cd5a (f:4d5a)
	call Func_3cd60
	jp Func_3cdec

; known jump sources: 78b4 (1:78b4), 3c539 (f:4539), 3cca4 (f:4ca4), 3cd5a (f:4d5a), 3d739 (f:5739), 3daec (f:5aec), 553e9 (15:53e9)
Func_3cd60: ; 3cd60 (f:4d60)
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	FuncCoord 9, 7 ; $c435
	ld hl, Coord
	ld bc, $50b
	call ClearScreenArea
	ld hl, Func_3a902
	ld b, BANK(Func_3a902)
	call Bankswitch ; indirect jump to Func_3a902 (3a902 (e:6902))
	FuncCoord 18, 9 ; $c466
	ld hl, Coord
	ld [hl], $73
	ld de, W_PLAYERMONNAME
	FuncCoord 10, 7 ; $c436
	ld hl, Coord
	call Func_3ce9c
	call PlaceString
	ld hl, W_PLAYERMONID
	ld de, $cf98
	ld bc, $c
	call CopyData
	ld hl, W_PLAYERMONLEVEL ; $d022
	ld de, $cfb9
	ld bc, $b
	call CopyData
	FuncCoord 14, 8 ; $c44e
	ld hl, Coord
	push hl
	inc hl
	ld de, $cf9c
	call PrintStatusConditionNotFainted
	pop hl
	jr nz, .asm_3cdae
	call PrintLevel
.asm_3cdae
	ld a, [$cf98]
	ld [$cf91], a
	FuncCoord 10, 9 ; $c45e
	ld hl, Coord
	ld a, $5f
	call Predef ; indirect jump to Func_128ef (128ef (4:68ef))
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld hl, $cf1d
	call Func_3ce90
	ld hl, W_PLAYERMONCURHP ; $d015
	ld a, [hli]
	or [hl]
	jr z, .asm_3cdd9
	ld a, [$ccf6]
	and a
	ret nz
	ld a, [$cf1d]
	cp $2
	jr z, .asm_3cde6
.asm_3cdd9
	ld hl, $d083
	bit 7, [hl]
	ld [hl], $0
	ret z
	xor a
	ld [$c02a], a
	ret
.asm_3cde6
	ld hl, $d083
	set 7, [hl]
	ret

; known jump sources: 78b9 (1:78b9), 3ca64 (f:4a64), 3cca1 (f:4ca1), 3cd5d (f:4d5d), 3e7bf (f:67bf), 3f02d (f:702d)
Func_3cdec: ; 3cdec (f:4dec)
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld hl, W_SCREENTILESBUFFER
	ld bc, $40c
	call ClearScreenArea
	ld hl, Func_3a919
	ld b, BANK(Func_3a919)
	call Bankswitch ; indirect jump to Func_3a919 (3a919 (e:6919))
	ld de, W_ENEMYMONNAME
	FuncCoord 1, 0 ; $c3a1
	ld hl, Coord
	call Func_3ce9c
	call PlaceString
	FuncCoord 4, 1 ; $c3b8
	ld hl, Coord
	push hl
	inc hl
	ld de, W_ENEMYMONSTATUS ; $cfe9
	call PrintStatusConditionNotFainted
	pop hl
	jr nz, .asm_3ce23
	ld a, [W_ENEMYMONLEVEL] ; $cff3
	ld [$cfb9], a
	call PrintLevel
.asm_3ce23
	ld hl, W_ENEMYMONCURHP ; $cfe6
	ld a, [hli]
	ld [$FF00+$97], a
	ld a, [hld]
	ld [$FF00+$98], a
	or [hl]
	jr nz, .asm_3ce36
	ld c, a
	ld e, a
	ld d, $6
	jp Func_3ce7f
.asm_3ce36
	xor a
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, $30
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	call Multiply
	ld hl, W_ENEMYMONMAXHP ; $cff4
	ld a, [hli]
	ld b, a
	ld a, [hl]
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld a, b
	and a
	jr z, .asm_3ce6a
	ld a, [H_REMAINDER] ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	srl b
	rr a
	srl b
	rr a
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld a, [$FF00+$97]
	ld b, a
	srl b
	ld a, [$FF00+$98]
	rr a
	srl b
	rr a
	ld [$FF00+$98], a
	ld a, b
	ld [$FF00+$97], a
.asm_3ce6a
	ld a, [$FF00+$97]
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ld a, [$FF00+$98]
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, $2
	ld b, a
	call Divide
	ld a, [$FF00+$98]
	ld e, a
	ld a, $6
	ld d, a
	ld c, a

; known jump sources: 3ce33 (f:4e33)
Func_3ce7f: ; 3ce7f (f:4e7f)
	xor a
	ld [W_LISTMENUID], a ; $cf94
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	call DrawHPBar
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld hl, $cf1e

; known jump sources: 3c669 (f:4669), 3cdc3 (f:4dc3)
Func_3ce90: ; 3ce90 (f:4e90)
	ld b, [hl]
	call Func_3df9
	ld a, [hl]
	cp b
	ret z
	ld b, $1
	jp GoPAL_SET

; known jump sources: 3cd7f (f:4d7f), 3ce06 (f:4e06)
Func_3ce9c: ; 3ce9c (f:4e9c)
	push de
	inc hl
	inc hl
	ld b, $2
.asm_3cea1
	inc de
	ld a, [de]
	cp $50
	jr z, .asm_3ceb1
	inc de
	ld a, [de]
	cp $50
	jr z, .asm_3ceb1
	dec hl
	dec b
	jr nz, .asm_3cea1
.asm_3ceb1
	pop de
	ret

; known jump sources: 3c161 (f:4161), 3c263 (f:4263), 3cffa (f:4ffa), 3d05c (f:505c), 3d102 (f:5102), 3d216 (f:5216)
InitBattleMenu: ; 3ceb3 (f:4eb3)
	call LoadScreenTilesFromBuffer1 ; restore saved screen
	ld a, [W_BATTLETYPE] ; $d05a
	and a
	jr nz, .nonstandardbattle
	call Func_3cd5a ; redraw names and HP bars?
	call Func_3ee94
	call SaveScreenTilesToBuffer1
.nonstandardbattle
	ld a, [W_BATTLETYPE] ; $d05a
	cp $2 ; safari
	ld a, $b ; safari menu id
	jr nz, .menuselected
	ld a, $1b ; regular menu id
.menuselected
	ld [$d125], a
	call DisplayTextBoxID
	ld a, [W_BATTLETYPE] ; $d05a
	dec a
	jp nz, RegularBattleMenu ; regular battle
	; the following happens for the old man tutorial
	ld hl, W_PLAYERNAME ; $d158
	ld de, W_GRASSRATE ; $d887
	ld bc, $b
	call CopyData  ; temporarily save the player name in unused space,
	               ; which is supposed to get overwritten when entering a
	               ; map with wild pokémon. due to an oversight, the data
	               ; may not get overwritten (cinnabar) and the infamous
	               ; missingno. glitch can show up.


	ld hl, OldManName ; $4f12
	ld de, W_PLAYERNAME ; $d158
	ld bc, $b
	call CopyData
	; the following simulates the keystrokes by drawing menus on screen
	FuncCoord 9, 14 ; $c4c1
	ld hl, Coord
	ld [hl], "▶"
	ld c, $50
	call DelayFrames
	ld [hl], $7f
	FuncCoord 9, 16 ; $c4e9
	ld hl, Coord
	ld [hl], "▶"
	ld c, $32
	call DelayFrames
	ld [hl], $ec
	ld a, $2
	jp Func_3cfe8

OldManName: ; 3cf12 (f:4f12)
	db "OLD MAN@"

RegularBattleMenu: ; 3cf1a (f:4f1a)
	ld a, [$cc2d]
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_OLDMENUITEMID], a ; $cc2a
	sub $2
	jr c, .leftcolumn
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_OLDMENUITEMID], a ; $cc2a
	jr .rightcolumn
.leftcolumn
	ld a, [W_BATTLETYPE] ; $d05a
	cp $2
	ld a, " "
	jr z, .safaribattle
	FuncCoord 15, 14 ; $c4c7
	ld [Coord], a
	FuncCoord 15, 16 ; $c4ef
	ld [Coord], a
	ld b, $9
	jr .notsafari
.safaribattle
	FuncCoord 13, 14 ; $c4c5
	ld [Coord], a
	FuncCoord 13, 16 ; $c4ed
	ld [Coord], a
	FuncCoord 7, 14 ; $c4bf
	ld hl, Coord
	ld de, W_NUMSAFARIBALLS ; $da47
	ld bc, $102
	call PrintNumber
	ld b, $1
.notsafari
	ld hl, W_TOPMENUITEMY ; $cc24
	ld a, $e
	ld [hli], a
	ld a, b
	ld [hli], a
	inc hl
	inc hl
	ld a, $1
	ld [hli], a
	ld [hl], $11
	call HandleMenuInput
	bit 4, a
	jr nz, .rightcolumn
	jr .selection
.rightcolumn
	ld a, [W_BATTLETYPE] ; $d05a
	cp $2
	ld a, " "
	jr z, .safarirightcolumn
	FuncCoord 9, 14 ; $c4c1
	ld [Coord], a
	FuncCoord 9, 16 ; $c4e9
	ld [Coord], a
	ld b, $f
	jr .notsafarirightcolumn
.safarirightcolumn
	FuncCoord 1, 14 ; $c4b9
	ld [Coord], a
	FuncCoord 1, 16 ; $c4e1
	ld [Coord], a
	FuncCoord 7, 14 ; $c4bf
	ld hl, Coord
	ld de, W_NUMSAFARIBALLS ; $da47
	ld bc, $102
	call PrintNumber
	ld b, $d
.notsafarirightcolumn
	ld hl, W_TOPMENUITEMY ; $cc24
	ld a, $e
	ld [hli], a
	ld a, b
	ld [hli], a
	inc hl
	inc hl
	ld a, $1
	ld [hli], a
	ld a, $21
	ld [hli], a
	call HandleMenuInput
	bit 5, a
	jr nz, .leftcolumn
	ld a, [W_CURMENUITEMID] ; $cc26
	add $2 ; if we're in the right column, the actual id is +2
	ld [W_CURMENUITEMID], a ; $cc26
.selection
	call PlaceUnfilledArrowMenuCursor
	ld a, [W_BATTLETYPE] ; $d05a
	cp $2
	ld a, [W_CURMENUITEMID] ; $cc26
	ld [$cc2d], a
	jr z, .asm_3cfd0
	cp $1
	jr nz, .asm_3cfcb
	inc a
	jr .asm_3cfd0
.asm_3cfcb
	cp $2 ; what
	jr nz, .asm_3cfd0
	dec a
.asm_3cfd0
	and a
	jr nz, Func_3cfe8
	; first option was selected...
	ld a, [W_BATTLETYPE] ; $d05a
	cp $2
	jr z, .safari1
	xor a
	ld [$d120], a
	jp LoadScreenTilesFromBuffer1 ; restore saved screen and return??
.safari1 ; safari first option??
	ld a, $8
	ld [$cf91], a
	jr asm_3d05f

; known jump sources: 3cf0f (f:4f0f), 3cfd1 (f:4fd1)
Func_3cfe8: ; 3cfe8 (f:4fe8)
	cp $2
	jp nz, Func_3d0ca
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr nz, .asm_3cffd
	ld hl, ItemsCantBeUsedHere
	call PrintText
	jp InitBattleMenu
.asm_3cffd ; bag?
	call SaveScreenTilesToBuffer2 ; copy bg?
	ld a, [W_BATTLETYPE] ; $d05a
	cp $2
	jr nz, asm_3d00e
	ld a, $15
	ld [$cf91], a
	jr asm_3d05f
asm_3d00e: ; 3d00e (f:500e)
	call LoadScreenTilesFromBuffer1
	ld a, [W_BATTLETYPE] ; $d05a
	and a
	jr nz, .asm_3d01a
	call Func_3cd5a
.asm_3d01a
	ld a, [W_BATTLETYPE] ; $d05a
	dec a
	jr nz, .asm_3d031
	ld hl, .list
	ld a, l
	ld [$cf8b], a
	ld a, h
	ld [$cf8c], a
	jr .asm_3d03c

.list
	db $01, $04, $32, $ff

.asm_3d031
	ld hl, W_NUMBAGITEMS ; $d31d
	ld a, l
	ld [$cf8b], a
	ld a, h
	ld [$cf8c], a
.asm_3d03c
	xor a
	ld [$cf93], a
	ld a, $3
	ld [W_LISTMENUID], a ; $cf94
	ld a, [$cc2c]
	ld [W_CURMENUITEMID], a ; $cc26
	call DisplayListMenuID
	ld a, [W_CURMENUITEMID] ; $cc26
	ld [$cc2c], a
	ld a, $0
	ld [$cc37], a
	ld [$cc35], a
	jp c, InitBattleMenu
asm_3d05f: ; 3d05f (f:505f)
	ld a, [$cf91]
	ld [$d11e], a
	call GetItemName
	call CopyStringToCF4B ; copy name
	xor a
	ld [$d152], a
	call UseItem
	call Func_3ee5b
	call CleanLCD_OAM
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld a, [W_BATTLETYPE] ; $d05a
	cp $2
	jr z, .asm_3d09c
	ld a, [$cd6a]
	and a
	jp z, asm_3d00e
	ld a, [W_PLAYERBATTSTATUS1] ; $d062
	bit 5, a
	jr z, .asm_3d09c
	ld hl, $d06a
	dec [hl]
	jr nz, .asm_3d09c
	ld hl, W_PLAYERBATTSTATUS1 ; $d062
	res 5, [hl]
.asm_3d09c
	ld a, [$d11c]
	and a
	jr nz, .asm_3d0b7
	ld a, [W_BATTLETYPE] ; $d05a
	cp $2
	jr z, .asm_3d0b2
	call LoadScreenTilesFromBuffer1
	call Func_3cd5a ; redraw name and hp bar?
	call Delay3
.asm_3d0b2
	call GBPalNormal
	and a
	ret
.asm_3d0b7
	call GBPalNormal
	xor a
	ld [$d11c], a
	ld a, $2
	ld [$cf0b], a
	scf
	ret
; 3d0c5 (f:50c5)
ItemsCantBeUsedHere: ; 3d0c5 (f:50c5)
	TX_FAR ItemsCantBeUsedHere_
	db "@"
; 0x3d0c5 + 5 bytes

; known jump sources: 3cfea (f:4fea)
Func_3d0ca: ; 3d0ca (f:50ca)
	dec a
	jp nz, Func_3d1fa
	call SaveScreenTilesToBuffer2
	ld a, [W_BATTLETYPE] ; $d05a
	cp $2
	jr nz, Func_3d0e0
	ld a, $16
	ld [$cf91], a
	jp asm_3d05f

; known jump sources: 3d0d6 (f:50d6), 3d187 (f:5187)
Func_3d0e0: ; 3d0e0 (f:50e0)
	call LoadScreenTilesFromBuffer1
	xor a
	ld [$d07d], a
	ld [$cc35], a
	call DisplayPartyMenu
asm_3d0ed: ; 3d0ed (f:50ed)
	jp nc, Func_3d119
asm_3d0f0: ; 3d0f0 (f:50f0)
	call CleanLCD_OAM
	call GBPalWhiteOut
	call Func_3ee5b
	call LoadScreenTilesFromBuffer2
	call GoPAL_SET_CF1C
	call GBPalNormal
	jp InitBattleMenu

; known jump sources: 3d138 (f:5138), 3d19a (f:519a), 3d1a0 (f:51a0)
Func_3d105: ; 3d105 (f:5105)
	FuncCoord 11, 11 ; $c487
	ld hl, Coord
	ld bc, $81
	ld a, $7f
	call FillMemory
	xor a
	ld [$d07d], a
	call GoBackToPartyMenu
	jr asm_3d0ed

; known jump sources: 3d0ed (f:50ed)
Func_3d119: ; 3d119 (f:5119)
	ld a, $c
	ld [$d125], a
	call DisplayTextBoxID
	ld hl, W_TOPMENUITEMY ; $cc24
	ld a, $c
	ld [hli], a
	ld [hli], a
	xor a
	ld [hli], a
	inc hl
	ld a, $2
	ld [hli], a
	ld a, $3
	ld [hli], a
	xor a
	ld [hl], a
	call HandleMenuInput
	bit 1, a
	jr nz, Func_3d105
	call PlaceUnfilledArrowMenuCursor
	ld a, [W_CURMENUITEMID] ; $cc26
	cp $2
	jr z, asm_3d0f0
	and a
	jr z, .asm_3d18a
	xor a
	ld [$cc49], a
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	call CleanLCD_OAM
	ld a, $36
	call Predef ; indirect jump to StatusScreen (12953 (4:6953))
	ld a, $37
	call Predef ; indirect jump to StatusScreen2 (12b57 (4:6b57))
	ld a, [W_ENEMYBATTSTATUS2] ; $d068
	bit 4, a
	ld hl, Func_796e0
	jr nz, .asm_3d182
	ld a, [$ccf3]
	and a
	ld hl, Func_7959f
	jr nz, .asm_3d182
	ld a, [$cfe5]
	ld [$cf91], a
	ld [$d0b5], a
	call GetMonHeader
	ld de, $9000
	call LoadMonFrontSprite
	jr .asm_3d187
.asm_3d182
	ld b, $1e
	call Bankswitch
.asm_3d187
	jp Func_3d0e0
.asm_3d18a
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	ld d, a
	ld a, [W_WHICHPOKEMON] ; $cf92
	cp d
	jr nz, .asm_3d19d
	ld hl, UnnamedText_3d1f5 ; $51f5
	call PrintText
	jp Func_3d105
.asm_3d19d
	call Func_3ca97
	jp z, Func_3d105
	ld a, $1
	ld [$cd6a], a
	call GBPalWhiteOut
	call CleanLCD_OAM
	call Func_3ee5b
	call LoadScreenTilesFromBuffer1
	call GoPAL_SET_CF1C
	call GBPalNormal

; known jump sources: 3ca76 (f:4a76)
Func_3d1ba: ; 3d1ba (f:51ba)
	ld hl, Func_58ed1
	ld b, BANK(Func_58ed1)
	call Bankswitch ; indirect jump to Func_58ed1 (58ed1 (16:4ed1))
	ld c, $32
	call DelayFrames
	call Func_3ccfa
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld [W_PLAYERMONNUMBER], a ; $cc2f
	ld c, a
	ld b, $1
	push bc
	ld hl, W_PLAYERMONSALIVEFLAGS
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	pop bc
	ld hl, $ccf5
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	call Func_3cba6
	call Func_3cc91
	call SaveScreenTilesToBuffer1
	ld a, $2
	ld [W_CURMENUITEMID], a ; $cc26
	and a
	ret
; 3d1f5 (f:51f5)
UnnamedText_3d1f5: ; 3d1f5 (f:51f5)
	TX_FAR _UnnamedText_3d1f5
	db $50
; 0x3d1f5 + 5 bytes

; known jump sources: 3d0cb (f:50cb)
Func_3d1fa: ; 3d1fa (f:51fa)
	call LoadScreenTilesFromBuffer1
	ld a, $3
	ld [W_CURMENUITEMID], a ; $cc26
	ld hl, W_PLAYERMONSPEED
	ld de, W_ENEMYMONSPEED
	call Func_3cab9
	ld a, $0
	ld [$d11f], a
	ret c
	ld a, [$cd6a]
	and a
	ret nz
	jp InitBattleMenu

; known jump sources: e35f (3:635f), 3c299 (f:4299), 3d3ab (f:53ab), 3d490 (f:5490), 3d4b3 (f:54b3)
MoveSelectionMenu: ; 3d219 (f:5219)
	ld a, [W_MOVEMENUTYPE]
	dec a
	jr z, .mimicmenu
	dec a
	jr z, .relearnmenu
	jr .regularmenu

; known jump sources: 3d250 (f:5250), 3d278 (f:5278), 3d29d (f:529d)
.loadmoves
	ld de, $d0dc
	ld bc, $4
	call CopyData
	ld hl, Func_39b87
	ld b, BANK(Func_39b87)
	call Bankswitch ; indirect jump to Func_39b87 (39b87 (e:5b87))
	ret

; known jump sources: 3d26c (f:526c), 3d288 (f:5288), 3d2ad (f:52ad)
.writemoves
	ld de, $d0e1
	ld a, [$FF00+$f6]
	set 2, a
	ld [$FF00+$f6], a
	call PlaceString
	ld a, [$FF00+$f6]
	res 2, a
	ld [$FF00+$f6], a
	ret

.regularmenu
	call Func_3d3f5
	ret z
	ld hl, W_PLAYERMONMOVES
	call .loadmoves
	FuncCoord 4, 12 ; $c494
	ld hl, Coord
	ld b, $4
	ld c, $e
	di
	call TextBoxBorder
	FuncCoord 4, 12 ; $c494
	ld hl, Coord
	ld [hl], $7a
	FuncCoord 10, 12 ; $c49a
	ld hl, Coord
	ld [hl], $7e
	ei
	FuncCoord 6, 13 ; $c4aa
	ld hl, Coord
	call .writemoves
	ld b, $5
	ld a, $c
	jr .menuset
.mimicmenu
	ld hl, W_ENEMYMONMOVES
	call .loadmoves
	FuncCoord 0, 7 ; $c42c
	ld hl, Coord
	ld b, $4
	ld c, $e
	call TextBoxBorder
	FuncCoord 2, 8 ; $c442
	ld hl, Coord
	call .writemoves
	ld b, $1
	ld a, $7
	jr .menuset
.relearnmenu
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, W_PARTYMON1_MOVE1 ; $d173
	ld bc, $2c
	call AddNTimes
	call .loadmoves
	FuncCoord 4, 7 ; $c430
	ld hl, Coord
	ld b, $4
	ld c, $e
	call TextBoxBorder
	FuncCoord 6, 8 ; $c446
	ld hl, Coord
	call .writemoves
	ld b, $5
	ld a, $7
.menuset
	ld hl, W_TOPMENUITEMY ; $cc24
	ld [hli], a
	ld a, b
	ld [hli], a ; W_TOPMENUITEMX
	ld a, [W_MOVEMENUTYPE]
	cp $1
	jr z, .selectedmoveknown
	ld a, $1
	jr nc, .selectedmoveknown
	ld a, [W_PLAYERMOVELISTINDEX] ; $cc2e
	inc a
.selectedmoveknown
	ld [hli], a ; W_CURMENUITEMID
	inc hl ; W_TILEBEHINDCURSOR untouched
	ld a, [$cd6c]
	inc a
	inc a
	ld [hli], a ; W_MAXMENUITEMID
	ld a, [W_MOVEMENUTYPE]
	dec a
	ld b, $c1 ; can't use B
	jr z, .matchedkeyspicked
	dec a
	ld b, $c3
	jr z, .matchedkeyspicked
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr z, .matchedkeyspicked
	ld a, [W_FLAGS_D733]
	bit 0, a
	ld b, $c7
	jr z, .matchedkeyspicked
	ld b, $ff
.matchedkeyspicked
	ld a, b
	ld [hli], a ; W_MENUWATCHEDKEYS
	ld a, [W_MOVEMENUTYPE]
	cp $1
	jr z, .movelistindex1
	ld a, [W_PLAYERMOVELISTINDEX] ; $cc2e
	inc a
.movelistindex1
	ld [hl], a ; W_OLDMENUITEMID

; known jump sources: 3d3cd (f:53cd), 3d3da (f:53da), 3d3e7 (f:53e7), 3d3f2 (f:53f2)
Func_3d2fe: ; 3d2fe (f:52fe)
	ld a, [W_MOVEMENUTYPE]
	and a
	jr z, .battleselect
	dec a
	jr nz, .select
	FuncCoord 1, 14 ; $c4b9
	ld hl, Coord
	ld de, WhichTechniqueString ; $53b8
	call PlaceString
	jr .select
.battleselect
	ld a, [W_FLAGS_D733]
	bit 0, a
	jr nz, .select
	call Func_3d4b6
	ld a, [$cc35]
	and a
	jr z, .select
	FuncCoord 5, 13 ; $c4a9
	ld hl, Coord
	dec a
	ld bc, $14
	call AddNTimes
	ld [hl], $ec
.select
	ld hl, $fff6
	set 1, [hl]
	call HandleMenuInput
	ld hl, $fff6
	res 1, [hl]
	bit 6, a
	jp nz, Func_3d3c9 ; up
	bit 7, a
	jp nz, Func_3d3dd ; down
	bit 2, a
	jp nz, Func_3d435 ; select
	bit 1, a ; B, but was it reset above?
	push af
	xor a
	ld [$cc35], a
	ld a, [W_CURMENUITEMID] ; $cc26
	dec a
	ld [W_CURMENUITEMID], a ; $cc26
	ld b, a
	ld a, [W_MOVEMENUTYPE]
	dec a ; if not mimic
	jr nz, .nob
	pop af
	ret
.nob
	dec a
	ld a, b
	ld [W_PLAYERMOVELISTINDEX], a ; $cc2e
	jr nz, .moveselected
	pop af
	ret
.moveselected
	pop af
	ret nz
	ld hl, W_PLAYERMONPP ; $d02d
	ld a, [W_CURMENUITEMID] ; $cc26
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
	and $3f
	jr z, .nopp
	ld a, [W_PLAYERDISABLEDMOVE] ; $d06d
	swap a
	and $f
	dec a
	cp c
	jr z, .disabled
	ld a, [W_PLAYERBATTSTATUS3] ; $d064
	bit 3, a ; transformed
	jr nz, .dummy ; game freak derp
.dummy
	ld a, [W_CURMENUITEMID] ; $cc26
	ld hl, W_PLAYERMONMOVES
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
	ld [W_PLAYERSELECTEDMOVE], a ; $ccdc
	xor a
	ret
.disabled
	ld hl, MoveDisabledText
	jr .print
.nopp
	ld hl, MoveNoPPText
.print
	call PrintText
	call LoadScreenTilesFromBuffer1
	jp MoveSelectionMenu

MoveNoPPText: ; 3d3ae (f:53ae)
	TX_FAR _MoveNoPPText
	db "@"

MoveDisabledText: ; 3d3b3 (f:53b3)
	TX_FAR _MoveDisabledText
	db "@"

WhichTechniqueString: ; 3d3b8 (f:53b8)
	db "WHICH TECHNIQUE?@"

; known jump sources: 3d33d (f:533d)
Func_3d3c9: ; 3d3c9 (f:53c9)
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jp nz, Func_3d2fe
	call EraseMenuCursor
	ld a, [$cd6c]
	inc a
	ld [W_CURMENUITEMID], a ; $cc26
	jp Func_3d2fe

; known jump sources: 3d342 (f:5342)
Func_3d3dd: ; 3d3dd (f:53dd)
	ld a, [W_CURMENUITEMID] ; $cc26
	ld b, a
	ld a, [$cd6c]
	inc a
	inc a
	cp b
	jp nz, Func_3d2fe
	call EraseMenuCursor
	ld a, $1
	ld [W_CURMENUITEMID], a ; $cc26
	jp Func_3d2fe

; known jump sources: 3d249 (f:5249)
Func_3d3f5: ; 3d3f5 (f:53f5)
	ld a, $a5
	ld [W_PLAYERSELECTEDMOVE], a ; $ccdc
	ld a, [W_PLAYERDISABLEDMOVE] ; $d06d
	and a
	ld hl, W_PLAYERMONPP ; $d02d
	jr nz, .asm_3d40e
	ld a, [hli]
	or [hl]
	inc hl
	or [hl]
	inc hl
	or [hl]
	and $3f
	ret nz
	jr .asm_3d423
.asm_3d40e
	swap a
	and $f
	ld b, a
	ld d, $5
	xor a
.asm_3d416
	dec d
	jr z, .asm_3d421
	ld c, [hl]
	inc hl
	dec b
	jr z, .asm_3d416
	or c
	jr .asm_3d416
.asm_3d421
	and a
	ret nz
.asm_3d423
	ld hl, UnnamedText_3d430 ; $5430
	call PrintText
	ld c, $3c
	call DelayFrames
	xor a
	ret
; 3d430 (f:5430)
UnnamedText_3d430: ; 3d430 (f:5430)
	TX_FAR _UnnamedText_3d430
	db $50
; 0x3d430 + 5 bytes

; known jump sources: 3d347 (f:5347)
Func_3d435: ; 3d435 (f:5435)
	ld a, [$cc35]
	and a
	jr z, asm_3d4ad
	ld hl, W_PLAYERMONMOVES
	call Func_3d493
	ld hl, W_PLAYERMONPP ; $d02d
	call Func_3d493
	ld hl, W_PLAYERDISABLEDMOVE ; $d06d
	ld a, [hl]
	swap a
	and $f
	ld b, a
	ld a, [W_CURMENUITEMID] ; $cc26
	cp b
	jr nz, .asm_3d463
	ld a, [hl]
	and $f
	ld b, a
	ld a, [$cc35]
	swap a
	add b
	ld [hl], a
	jr .asm_3d474
.asm_3d463
	ld a, [$cc35]
	cp b
	jr nz, .asm_3d474
	ld a, [hl]
	and $f
	ld b, a
	ld a, [W_CURMENUITEMID] ; $cc26
	swap a
	add b
	ld [hl], a
.asm_3d474
	ld hl, W_PARTYMON1_MOVE1 ; $d173
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	ld bc, $2c
	call AddNTimes
	push hl
	call Func_3d493
	pop hl
	ld bc, $15
	add hl, bc
	call Func_3d493
	xor a
	ld [$cc35], a
	jp MoveSelectionMenu

; known jump sources: 3d43e (f:543e), 3d444 (f:5444), 3d481 (f:5481), 3d489 (f:5489)
Func_3d493: ; 3d493 (f:5493)
	push hl
	ld a, [$cc35]
	dec a
	ld c, a
	ld b, $0
	add hl, bc
	ld d, h
	ld e, l
	pop hl
	ld a, [W_CURMENUITEMID] ; $cc26
	dec a
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [de]
	ld b, [hl]
	ld [hl], a
	ld a, b
	ld [de], a
	ret
asm_3d4ad: ; 3d4ad (f:54ad)
	ld a, [W_CURMENUITEMID] ; $cc26
	ld [$cc35], a
	jp MoveSelectionMenu

; known jump sources: 3d319 (f:5319)
Func_3d4b6: ; 3d4b6 (f:54b6)
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	FuncCoord 0, 8 ; $c440
	ld hl, Coord
	ld b, $3
	ld c, $9
	call TextBoxBorder
	ld a, [W_PLAYERDISABLEDMOVE] ; $d06d
	and a
	jr z, .asm_3d4df
	swap a
	and $f
	ld b, a
	ld a, [W_CURMENUITEMID] ; $cc26
	cp b
	jr nz, .asm_3d4df
	FuncCoord 1, 10 ; $c469
	ld hl, Coord
	ld de, Unknown_3d555 ; $5555
	call PlaceString
	jr .asm_3d54e
.asm_3d4df
	ld hl, W_CURMENUITEMID ; $cc26
	dec [hl]
	xor a
	ld [H_WHOSETURN], a ; $FF00+$f3
	ld hl, W_PLAYERMONMOVES
	ld a, [W_CURMENUITEMID] ; $cc26
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
	ld [W_PLAYERSELECTEDMOVE], a ; $ccdc
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	ld [W_WHICHPOKEMON], a ; $cf92
	ld a, $4
	ld [$cc49], a
	ld hl, GetMaxPP
	ld b, BANK(GetMaxPP)
	call Bankswitch ; indirect jump to GetMaxPP (e677 (3:6677))
	ld hl, W_CURMENUITEMID ; $cc26
	ld c, [hl]
	inc [hl]
	ld b, $0
	ld hl, W_PLAYERMONPP ; $d02d
	add hl, bc
	ld a, [hl]
	and $3f
	ld [$cd6d], a
	FuncCoord 1, 9 ; $c455
	ld hl, Coord
	ld de, Unknown_3d55f ; $555f
	call PlaceString
	FuncCoord 7, 11 ; $c483
	ld hl, Coord
	ld [hl], $f3
	FuncCoord 5, 9 ; $c459
	ld hl, Coord
	ld [hl], $f3
	FuncCoord 5, 11 ; $c481
	ld hl, Coord
	ld de, $cd6d
	ld bc, $102
	call PrintNumber
	FuncCoord 8, 11 ; $c484
	ld hl, Coord
	ld de, $d11e
	ld bc, $102
	call PrintNumber
	call GetCurrentMove
	FuncCoord 2, 10 ; $c46a
	ld hl, Coord
	ld a, $5d
	call Predef ; indirect jump to Func_27d98 (27d98 (9:7d98))
.asm_3d54e
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	jp Delay3

Unknown_3d555: ; 3d555 (f:5555)
INCBIN "baserom.gbc",$3d555,$3d55f - $3d555

Unknown_3d55f: ; 3d55f (f:555f)
INCBIN "baserom.gbc",$3d55f,$3d564 - $3d55f

SelectEnemyMove: ; 3d564 (f:5564)
	ld a, [W_ISLINKBATTLE]
	sub $4
	jr nz, .noLinkBattle
	call SaveScreenTilesToBuffer1
	call Func_3d605
	call LoadScreenTilesFromBuffer1
	ld a, [$cc3e]
	cp $e
	jp z, .asm_3d601
	cp $d
	jr z, .unableToMove
	cp $4
	ret nc
	ld [$cce2], a
	ld c, a
	ld hl, W_ENEMYMONMOVES
	ld b, $0
	add hl, bc
	ld a, [hl]
	jr .done
.noLinkBattle
	ld a, [W_ENEMYBATTSTATUS2]
	and $60     ; need to recharge or using rage
	ret nz
	ld hl, W_ENEMYBATTSTATUS1
	ld a, [hl]
	and $12     ; using multi-turn move or bide
	ret nz
	ld a, [W_ENEMYMONSTATUS]
	and SLP | FRZ ; sleeping or frozen
	ret nz
	ld a, [W_ENEMYBATTSTATUS1]
	and $21      ; using fly/dig or thrash/petal dance
	ret nz
	ld a, [W_PLAYERBATTSTATUS1]
	bit 5, a    ; caught in player's multi-turn move (e.g. wrap)
	jr z, .notCaughtInWrap
.unableToMove
	ld a, $ff
	jr .done
.notCaughtInWrap
	ld hl, W_ENEMYMONMOVES+1 ; 2nd enemy move
	ld a, [hld]
	and a
	jr nz, .atLeastTwoMovesAvailable
	ld a, [W_ENEMYDISABLEDMOVE]
	and a
	ld a, STRUGGLE ; struggle if the only move is disabled
	jr nz, .done
.atLeastTwoMovesAvailable
	ld a, [W_ISINBATTLE]
	dec a
	jr z, .chooseRandomMove ; wild encounter
	ld hl, AIEnemyTrainerChooseMoves
	ld b, BANK(AIEnemyTrainerChooseMoves)
	call Bankswitch
.chooseRandomMove
	push hl
	call GenRandomInBattle ; get random
	ld b, $1
	cp $3f ; select move 1 in [0,3e] (63/256 chance)
	jr c, .moveChosen
	inc hl
	inc b
	cp $7f ; select move 1 in [3f,7e] (64/256 chance)
	jr c, .moveChosen
	inc hl
	inc b
	cp $be ; select move 1 in [7f,bd] (63/256 chance)
	jr c, .moveChosen
	inc hl
	inc b ; select move 4 in [be,ff] (66/256 chance)
.moveChosen
	ld a, b
	dec a
	ld [W_ENEMYMOVELISTINDEX], a
	ld a, [W_ENEMYDISABLEDMOVE]
	swap a
	and $f
	cp b
	ld a, [hl]
	pop hl
	jr z, .chooseRandomMove ; move disabled, try again
	and a
	jr z, .chooseRandomMove ; move non-existant, try again
.done
	ld [W_ENEMYSELECTEDMOVE], a
	ret
.asm_3d601
	ld a, $a5
	jr .done

; known jump sources: 3c67b (f:467b), 3c7f7 (f:47f7), 3cb71 (f:4b71), 3d56e (f:556e)
Func_3d605: ; 3d605 (f:5605)
	ld a, $ff
	ld [$cc3e], a
	ld a, [W_PLAYERMOVELISTINDEX] ; $cc2e
	cp $f
	jr z, .asm_3d630
	ld a, [$cd6a]
	and a
	jr nz, .asm_3d629
	ld a, [W_PLAYERSELECTEDMOVE] ; $ccdc
	cp $a5
	ld b, $e
	jr z, .asm_3d62f
	dec b
	inc a
	jr z, .asm_3d62f
	ld a, [W_PLAYERMOVELISTINDEX] ; $cc2e
	jr .asm_3d630
.asm_3d629
	ld a, [W_WHICHPOKEMON] ; $cf92
	add $4
	ld b, a
.asm_3d62f
	ld a, b
.asm_3d630
	ld [$cc42], a
	ld hl, Func_4c05
	ld b, BANK(Func_4c05)
	call Bankswitch ; indirect jump to Func_4c05 (4c05 (1:4c05))
.asm_3d63b
	call Func_22c3
	call DelayFrame
	ld a, [$cc3e]
	inc a
	jr z, .asm_3d63b
	ld b, $a
.asm_3d649
	call DelayFrame
	call Func_22c3
	dec b
	jr nz, .asm_3d649
	ld b, $a
.asm_3d654
	call DelayFrame
	call Func_22ed
	dec b
	jr nz, .asm_3d654
	ret

; known jump sources: 3c361 (f:4361), 3c37d (f:437d)
Func_3d65e: ; 3d65e (f:565e)
	xor a
	ld [H_WHOSETURN], a ; $FF00+$f3
	ld a, [W_PLAYERSELECTEDMOVE] ; $ccdc
	inc a
	jp z, Function580A
	xor a
	ld [W_MOVEMISSED], a ; $d05f
	ld [$cced], a
	ld [$ccf4], a
	ld a, $a
	ld [$d05b], a
	ld a, [$cd6a]
	and a
	jp nz, Function580A
	call Function5811
	jp z, Function580A
	call Function5854
	jr nz, .asm_3d68a
	jp [hl]
.asm_3d68a
	call GetCurrentMove
	ld hl, W_PLAYERBATTSTATUS1 ; $d062
	bit 4, [hl]
	jr nz, asm_3d6a9
	call Func_3dc88
	jp z, Function580A

; known jump sources: 3d777 (f:5777), 3d781 (f:5781)
Func_3d69a: ; 3d69a (f:569a)
	ld a, [W_PLAYERMOVEEFFECT] ; $cfd3
	cp $27
	jp z, Func_3f132
	cp $2b
	jp z, Func_3f132
	jr asm_3d6b0
; 3d6a9 (f:56a9)
; in-battle stuff
asm_3d6a9: ; 3d6a9 (f:56a9)
	ld hl,W_PLAYERBATTSTATUS1
	res 4,[hl]
	res 6,[hl]
asm_3d6b0: ; 3d6b0 (f:56b0)
	call Func_3daf5
	ld hl,DecrementPP
	ld de,$CCDC ; pointer to the move just used
	ld b,BANK(DecrementPP)
	call Bankswitch
	ld a,[W_PLAYERMOVEEFFECT] ; effect of the move just used
	ld hl,EffectsArray1
	ld de,1
	call IsInArray
	jp c,Func_3f132
	ld a,[W_PLAYERMOVEEFFECT]
	ld hl,EffectsArray5B
	ld de,1
	call IsInArray
	call c,Func_3f132
asm_3d6dc: ; 3d6dc (f:56dc)
	ld a,[W_PLAYERMOVEEFFECT]
	ld hl,EffectsArray2
	ld de,1
	call IsInArray
	jp c,.asm_3d702
	call CriticalHitTest
	call HandleCounterMove
	jr z,asm_3d705
	call CalculateDamage
	call MoreCalculateDamage
	jp z,asm_3d74b
	call AdjustDamageForMoveType
	call Func_3e687
.asm_3d702
	call MoveHitTest
asm_3d705
	ld a,[W_MOVEMISSED]
	and a
	jr z,asm_3d714
	ld a,[W_PLAYERMOVEEFFECT]
	sub a,7
	jr z,asm_3d71e
	jr asm_3d74b ; 574B
asm_3d714
	ld a,[W_PLAYERMOVEEFFECT]
	and a
	ld a,4
	jr z,asm_3d71e
	ld a,5
asm_3d71e
	push af
	ld a,[W_PLAYERBATTSTATUS2]
	bit 4,a
	ld hl,Func_79747
	ld b,BANK(Func_79747)
	call nz,Bankswitch
	pop af
	ld [$CC5B],a
	ld a,[W_PLAYERMOVENUM]
	call PlayMoveAnimation
	call Func_3eed3
	call Func_3cd60
	ld a,[W_PLAYERBATTSTATUS2]
	bit 4,a
	ld hl,Func_79771
	ld b,BANK(Func_79771)
	call nz,Bankswitch
	jr asm_3d766
asm_3d74b
	ld c,$1E
	call DelayFrames
	ld a,[W_PLAYERMOVEEFFECT]
	cp a,$2B
	jr z,.next5
	cp a,$27 ; XXX SLP | FRZ ?
	jr z,.next5
	jr asm_3d766
.next5
	xor a
	ld [$CC5B],a
	ld a,$A7
	call PlayMoveAnimation
asm_3d766
	ld a,[W_PLAYERMOVEEFFECT]
	cp a,9
	jr nz,.next6 ; 577A
	call MirrorMoveCopyMove
	jp z,Function580A
	xor a
	ld [$CCED],a
	jp Func_3d69a
.next6
	cp a,$53
	jr nz,.next7 ; 5784
	call MetronomePickMove
	jp Func_3d69a
.next7
	ld a,[W_PLAYERMOVEEFFECT]
	ld hl,EffectsArray3
	ld de,1
	call IsInArray
	jp c,Func_3f132
	ld a,[W_MOVEMISSED]
	and a
	jr z,.next8 ; 57A6
	call Func_3dbe2
	ld a,[W_PLAYERMOVEEFFECT]
	cp a,7
	jr z,.next9 ; 57B9
	jp Function580A
.next8
	call ApplyAttackToEnemyPokemon
	call Func_3dc5c
	ld hl, DisplayEffectiveness ; MyFunction
	ld b, BANK(DisplayEffectiveness) ; BANK(MyFunction)
	call Bankswitch
	ld a,1
	ld [$CCF4],a
.next9
	ld a,[W_PLAYERMOVEEFFECT]
	ld hl,EffectsArray4
	ld de,1
	call IsInArray
	call c,Func_3f132
	ld hl,$CFE6
	ld a,[hli]
	ld b,[hl]
	or b
	ret z
	call HandleBuildingRage

	ld hl,W_PLAYERBATTSTATUS1
	bit 2,[hl]
	jr z,.next10 ; 57EF
	ld a,[$D06A]
	dec a
	ld [$D06A],a
	jp nz,asm_3d714

	res 2,[hl]
	ld hl,MultiHitText
	call PrintText
	xor a
	ld [W_NUMHITS],a ; reset
.next10
	ld a,[W_PLAYERMOVEEFFECT]
	and a
	jp z,Function580A
	ld hl,EffectsArray5
	ld de,1
	call IsInArray
	call nc,Func_3f132
	jp Function580A

MultiHitText: ; 3d805 (f:5805)
	TX_FAR _MultiHitText
	db "@"

Function580A: ; 3d80a (f:580a)
	xor a
	ld [$CD6A],a
	ld b,1
	ret

Function5811: ; 3d811 (f:5811)
; print the ghost battle messages
	call Function583A
	ret nz
	ld a,[H_WHOSETURN]
	and a
	jr nz,.Ghost
	ld a,[W_PLAYERMONSTATUS] ; player’s turn
	and a,SLP | FRZ
	ret nz
	ld hl,ScaredText
	call PrintText
	xor a
	ret
.Ghost ; ghost’s turn
	ld hl,GetOutText
	call PrintText
	xor a
	ret

ScaredText: ; 3d830 (f:5830)
	TX_FAR _ScaredText
	db "@"

GetOutText: ; 3d835 (f:5835)
	TX_FAR _GetOutText
	db "@"

Function583A: ; 3d83a (f:583a)
	ld a,[W_ISINBATTLE]
	dec a
	ret nz
	ld a,[W_CURMAP]
	cp a,$8E ; Lavender Town
	jr c,.next
	cp a,$95 ; Pokémon Tower
	jr nc,.next
	ld b,SILPH_SCOPE
	call IsItemInBag ; $3493
	ret z
.next
	ld a,1
	and a
	ret

Function5854: ; 3d854 (f:5854)
	ld hl,W_PLAYERMONSTATUS
	ld a,[hl]
	and a,SLP
	jr z,.FrozenCheck ; to 5884

	dec a
	ld [W_PLAYERMONSTATUS],a ; decrement sleep count
	and a
	jr z,.WakeUp ; to 5874

	xor a
	ld [$CC5B],a
	ld a,SLP_ANIM - 1
	call PlayMoveAnimation
	ld hl,FastAsleepText
	call PrintText
	jr .sleepDone
.WakeUp
	ld hl,WokeUpText
	call PrintText
.sleepDone
	xor a
	ld [$CCF1],a
	ld hl,Function580A
	jp Func_3da37

.FrozenCheck
	bit 5,[hl] ; frozen?
	jr z,.HeldInPlaceCheck ; to 5898
	ld hl,FrozenText
	call PrintText
	xor a
	ld [$CCF1],a
	ld hl,Function580A
	jp Func_3da37

.HeldInPlaceCheck
	ld a,[W_ENEMYBATTSTATUS1]
	bit 5,a
	jp z,FlinchedCheck
	ld hl,CantMoveText
	call PrintText
	ld hl,Function580A
	jp Func_3da37

FlinchedCheck: ; 3d8ac (f:58ac)
	ld hl,W_PLAYERBATTSTATUS1
	bit 3,[hl]
	jp z,HyperBeamCheck
	res 3,[hl]
	ld hl,FlinchedText
	call PrintText
	ld hl,Function580A
	jp Func_3da37

HyperBeamCheck: ; 3d8c2 (f:58c2)
	ld hl,W_PLAYERBATTSTATUS2
	bit 5,[hl]
	jr z,.next ; 58D7
	res 5,[hl]
	ld hl,MustRechargeText
	call PrintText
	ld hl,Function580A ; $580a
	jp Func_3da37
.next
	ld hl,$D06D
	ld a,[hl]
	and a
	jr z,.next2 ; 58EE
	dec a
	ld [hl],a
	and a,$F
	jr nz,.next2
	ld [hl],a
	ld [$CCEE],a
	ld hl,DisabledNoMoreText
	call PrintText
.next2
	ld a,[W_PLAYERBATTSTATUS1]
	add a
	jr nc,.next3 ; 5929
	ld hl,$D06B
	dec [hl]
	jr nz,.next4 ; 5907
	ld hl,W_PLAYERBATTSTATUS1
	res 7,[hl]
	ld hl,ConfusedNoMoreText
	call PrintText
	jr .next3
.next4
	ld hl,IsConfusedText
	call PrintText
	xor a
	ld [$CC5B],a
	ld a,CONF_ANIM - 1
	call PlayMoveAnimation
	call GenRandomInBattle
	cp a,$80
	jr c,.next3
	ld hl,W_PLAYERBATTSTATUS1
	ld a,[hl]
	and a,$80
	ld [hl],a
	call Func_3daad
	jr .next5 ; 5952
.next3
	ld a,[$CCEE]
	and a
	jr z,.ParalysisCheck ; 593E
	ld hl,$CCDC
	cp [hl]
	jr nz,.ParalysisCheck
	call Func_3da88
	ld hl,Function580A ; $580a
	jp Func_3da37
.ParalysisCheck
	ld hl,W_PLAYERMONSTATUS
	bit 6,[hl]
	jr z,.next7 ; 5975
	call GenRandomInBattle ; random number
	cp a,$3F
	jr nc,.next7
	ld hl,FullyParalyzedText
	call PrintText
.next5
	ld hl,W_PLAYERBATTSTATUS1
	ld a,[hl]
	and a,$CC
	ld [hl],a
	ld a,[W_PLAYERMOVEEFFECT]
	cp a,$2B
	jr z,.next8 ; 5966
	cp a,$27
	jr z,.next8
	jr .next9 ; 596F
.next8
	xor a
	ld [$CC5B],a
	ld a,$A7
	call PlayMoveAnimation
.next9
	ld hl,Function580A ; $580a
	jp Func_3da37
.next7
	ld hl,W_PLAYERBATTSTATUS1
	bit 0,[hl]
	jr z,.next10 ; 59D0
	xor a
	ld [W_PLAYERMOVENUM],a
	ld hl,$D0D7
	ld a,[hli]
	ld b,a
	ld c,[hl]
	ld hl,$D075
	ld a,[hl]
	add c
	ld [hld],a
	ld a,[hl]
	adc b
	ld [hl],a
	ld hl,$D06A
	dec [hl]
	jr z,.next11 ; 599B
	ld hl,Function580A ; $580a
	jp Func_3da37
.next11
	ld hl,W_PLAYERBATTSTATUS1
	res 0,[hl]
	ld hl,UnleashedEnergyText
	call PrintText
	ld a,1
	ld [$CFD4],a
	ld hl,$D075
	ld a,[hld]
	add a
	ld b,a
	ld [$D0D8],a
	ld a,[hl]
	rl a
	ld [$D0D7],a
	or b
	jr nz,.next12 ; 59C2
	ld a,1
	ld [W_MOVEMISSED],a
.next12
	xor a
	ld [hli],a
	ld [hl],a
	ld a,$75
	ld [W_PLAYERMOVENUM],a
	ld hl,asm_3d705 ; $5705
	jp Func_3da37
.next10
	bit 1,[hl]
	jr z,.next13 ; 59FF
	ld a,$25
	ld [W_PLAYERMOVENUM],a
	ld hl,ThrashingAboutText
	call PrintText
	ld hl,$D06A
	dec [hl]
	ld hl,asm_3d6dc ; $56dc
	jp nz,Func_3da37
	push hl
	ld hl,W_PLAYERBATTSTATUS1
	res 1,[hl]
	set 7,[hl]
	call GenRandomInBattle ; random number
	and a,3
	inc a
	inc a
	ld [$D06B],a
	pop hl
	jp Func_3da37
.next13
	bit 5,[hl]
	jp z,Func_3da1a
	ld hl,AttackContinuesText
	call PrintText
	ld a,[$D06A]
	dec a
	ld [$D06A],a
	ld hl,asm_3d714 ; $5714
	jp nz,Func_3da37
	jp Func_3da37

; known jump sources: 3da01 (f:5a01)
Func_3da1a: ; 3da1a (f:5a1a)
	ld a, [W_PLAYERBATTSTATUS2] ; $d063
	bit 6, a
	jp z, Func_3da39
	ld a, $63
	ld [$d11e], a
	call GetMoveName
	call CopyStringToCF4B
	xor a
	ld [W_PLAYERMOVEEFFECT], a ; $cfd3
	ld hl, asm_3d6b0 ; $56b0
	jp Func_3da37

; known jump sources: 3d881 (f:5881), 3d895 (f:5895), 3d8a9 (f:58a9), 3d8bf (f:58bf), 3d8d4 (f:58d4), 3d93b (f:593b), 3d972 (f:5972), 3d998 (f:5998), 3d9cd (f:59cd), 3d9e6 (f:59e6), 3d9fc (f:59fc), 3da14 (f:5a14), 3da17 (f:5a17), 3da34 (f:5a34)
Func_3da37: ; 3da37 (f:5a37)
	xor a
	ret

; known jump sources: 3da1f (f:5a1f)
Func_3da39: ; 3da39 (f:5a39)
	ld a, $1
	and a
	ret
; 3da3d (f:5a3d)
FastAsleepText: ; 3da3d (f:5a3d)
	TX_FAR _FastAsleepText
	db "@"

WokeUpText: ; 3da42 (f:5a42)
	TX_FAR _WokeUpText
	db "@"

FrozenText: ; 3da47 (f:5a47)
	TX_FAR _FrozenText
	db "@"

FullyParalyzedText: ; 3da4c (f:5a4c)
	TX_FAR _FullyParalyzedText
	db "@"

FlinchedText: ; 3da51 (f:5a51)
	TX_FAR _FlinchedText
	db "@"

MustRechargeText: ; 3da56 (f:5a56)
	TX_FAR _MustRechargeText
	db "@"

DisabledNoMoreText: ; 3da5b (f:5a5b)
	TX_FAR _DisabledNoMoreText
	db "@"

IsConfusedText: ; 3da60 (f:5a60)
	TX_FAR _IsConfusedText
	db "@"

HurtItselfText: ; 3da65 (f:5a65)
	TX_FAR _HurtItselfText
	db "@"

ConfusedNoMoreText: ; 3da6a (f:5a6a)
	TX_FAR _ConfusedNoMoreText
	db "@"

SavingEnergyText: ; 3da6f (f:5a6f)
	TX_FAR _SavingEnergyText
	db "@"

UnleashedEnergyText: ; 3da74 (f:5a74)
	TX_FAR _UnleashedEnergyText
	db "@"

ThrashingAboutText: ; 3da79 (f:5a79)
	TX_FAR _ThrashingAboutText
	db "@"

AttackContinuesText: ; 3da7e (f:5a7e)
	TX_FAR _AttackContinuesText
	db "@"

CantMoveText: ; 3da83 (f:5a83)
	TX_FAR _CantMoveText
	db "@"

; known jump sources: 3d935 (f:5935), 3e9b6 (f:69b6)
Func_3da88: ; 3da88 (f:5a88)
	ld hl, W_PLAYERSELECTEDMOVE ; $ccdc
	ld de, W_PLAYERBATTSTATUS1 ; $d062
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3da97
	inc hl
	ld de, W_ENEMYBATTSTATUS1 ; $d067
.asm_3da97
	ld a, [de]
	res 4, a
	ld [de], a
	ld a, [hl]
	ld [$d11e], a
	call GetMoveName
	ld hl, UnnamedText_3daa8 ; $5aa8
	jp PrintText
; 3daa8 (f:5aa8)
UnnamedText_3daa8: ; 3daa8 (f:5aa8)
	TX_FAR _UnnamedText_3daa8
	db $50
; 0x3daa8 + 5 bytes

; known jump sources: 3d924 (f:5924), 3dd08 (f:5d08)
Func_3daad: ; 3daad (f:5aad)
	ld hl, HurtItselfText ; $5a65
	call PrintText
	ld hl, W_ENEMYMONDEFENSE ; $cff8
	ld a, [hli]
	push af
	ld a, [hld]
	push af
	ld a, [W_PLAYERMONDEF]
	ld [hli], a
	ld a, [$d028]
	ld [hl], a
	ld hl, W_PLAYERMOVEEFFECT ; $cfd3
	push hl
	ld a, [hl]
	push af
	xor a
	ld [hli], a
	ld [$d05e], a
	ld a, $28
	ld [hli], a
	xor a
	ld [hl], a
	call CalculateDamage
	call MoreCalculateDamage
	pop af
	pop hl
	ld [hl], a
	ld hl, $cff9
	pop af
	ld [hld], a
	pop af
	ld [hl], a
	xor a
	ld [$cc5b], a
	inc a
	ld [H_WHOSETURN], a ; $FF00+$f3
	call PlayMoveAnimation
	call Func_3cd60
	xor a
	ld [H_WHOSETURN], a ; $FF00+$f3
	jp ApplyDamageToPlayerPokemon

; known jump sources: 3d6b0 (f:56b0), 3e72f (f:672f)
Func_3daf5: ; 3daf5 (f:5af5)
	ld hl, Unknown_3dafb ; $5afb
	jp PrintText

Unknown_3dafb: ; 3dafb (f:5afb)
INCBIN "baserom.gbc",$3dafb,$3db00 - $3dafb
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, [W_PLAYERMOVENUM] ; $cfd2
	ld hl, $ccf1
	jr z, .asm_3db11
	ld a, [W_ENEMYMOVENUM] ; $cfcc
	ld hl, $ccf2
.asm_3db11
	ld [hl], a
	ld [$d11e], a
	call Func_3db85
	ld a, [$cced]
	and a
	ld hl, Unknown_3db34 ; $5b34
	ret nz
	ld a, [$d11e]
	cp $3
	ld hl, Unknown_3db34 ; $5b34
	ret c
	ld hl, Unknown_3db2d ; $5b2d
	ret

Unknown_3db2d: ; 3db2d (f:5b2d)
INCBIN "baserom.gbc",$3db2d,$3db32 - $3db2d
	jr asm_3db39

Unknown_3db34: ; 3db34 (f:5b34)
INCBIN "baserom.gbc",$3db34,$3db39 - $3db34

asm_3db39
	ld a, [$cced]
	and a
	jr z, .asm_3db48
	ld hl, .unknown_3db43 ; $5b43
	ret

.unknown_3db43: ; 3db43 (f:5b43)
INCBIN "baserom.gbc",$3db43,$3db48 - $3db43

.asm_3db48
	ld hl, Unknown_3db4c ; $5b4c
	ret

Unknown_3db4c: ; 3db4c (f:5b4c)
INCBIN "baserom.gbc",$3db4c,$3db51 - $3db4c
	ld hl, Unknown_3db62 ; $5b62
	ld a, [$d11e]
	add a
	push bc
	ld b, $0
	ld c, a
	add hl, bc
	pop bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ret

Unknown_3db62: ; 3db62 (f:5b62)
INCBIN "baserom.gbc",$3db62,$3db6c - $3db62

UnnamedText_3db6c: ; 3db6c (f:5b6c)
	TX_FAR _UnnamedText_3db6c
	db $50
; 0x3db6c + 5 bytes

UnnamedText_3db71: ; 3db71 (f:5b71)
	TX_FAR _UnnamedText_3db71
	db $50
; 0x3db71 + 5 bytes

UnnamedText_3db76: ; 3db76 (f:5b76)
	TX_FAR _UnnamedText_3db76
	db $50
; 0x3db76 + 5 bytes

UnnamedText_3db7b: ; 3db7b (f:5b7b)
	TX_FAR _UnnamedText_3db7b
	db $50
; 0x3db7b + 5 bytes

UnnamedText_3db80: ; 3db80 (f:5b80)
	TX_FAR _UnnamedText_3db80
	db $50
; 0x3db80 + 5 bytes

; known jump sources: 3db15 (f:5b15)
Func_3db85: ; 3db85 (f:5b85)
	push bc
	ld a, [$d11e]
	ld c, a
	ld b, $0
	ld hl, Unknown_3dba3 ; $5ba3
.asm_3db8f
	ld a, [hli]
	cp $ff
	jr z, .asm_3db9d
	cp c
	jr z, .asm_3db9d
	and a
	jr nz, .asm_3db8f
	inc b
	jr .asm_3db8f
.asm_3db9d
	ld a, b
	ld [$d11e], a
	pop bc
	ret

Unknown_3dba3: ; 3dba3 (f:5ba3)
INCBIN "baserom.gbc",$3dba3,$3dbe2 - $3dba3

; known jump sources: 3d799 (f:5799), 3e81e (f:681e)
Func_3dbe2: ; 3dbe2 (f:5be2)
	ld de, W_PLAYERMOVEEFFECT ; $cfd3
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3dbed
	ld de, W_ENEMYMOVEEFFECT ; $cfcd
.asm_3dbed
	ld hl, UnnamedText_3dc57 ; $5c57
	ld a, [$d05b]
	and $7f
	jr z, .asm_3dc04
	ld hl, UnnamedText_3dc42 ; $5c42
	ld a, [$d05e]
	cp $ff
	jr nz, .asm_3dc04
	ld hl, UnnamedText_3dc4c ; $5c4c
.asm_3dc04
	push de
	call PrintText
	xor a
	ld [$d05e], a
	pop de
	ld a, [de]
	cp $2d
	ret nz
	ld hl, W_DAMAGE ; $d0d7
	ld a, [hli]
	ld b, [hl]
	srl a
	rr b
	srl a
	rr b
	srl a
	rr b
	ld [hl], b
	dec hl
	ld [hli], a
	or b
	jr nz, .asm_3dc2a
	inc a
	ld [hl], a
.asm_3dc2a
	ld hl, UnnamedText_3dc47 ; $5c47
	call PrintText
	ld b, $4
	ld a, $24
	call Predef ; indirect jump to Func_48125 (48125 (12:4125))
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr nz, .asm_3dc3f
	jp ApplyDamageToPlayerPokemon
.asm_3dc3f
	jp ApplyDamageToEnemyPokemon
; 3dc42 (f:5c42)
UnnamedText_3dc42: ; 3dc42 (f:5c42)
	TX_FAR _UnnamedText_3dc42
	db $50
; 0x3dc42 + 5 bytes

UnnamedText_3dc47: ; 3dc47 (f:5c47)
	TX_FAR _UnnamedText_3dc47
	db $50
; 0x3dc47 + 5 bytes

UnnamedText_3dc4c: ; 3dc4c (f:5c4c)
	TX_FAR _UnnamedText_3dc4c
	db $50
; 0x3dc4c + 5 bytes

; known jump sources: 52670 (14:6670)
Func_3dc51: ; 3dc51 (f:5c51)
	ld hl, UnnamedText_3dc57 ; $5c57
	jp PrintText
; 3dc57 (f:5c57)
UnnamedText_3dc57: ; 3dc57 (f:5c57)
	TX_FAR _UnnamedText_3dc57
	db $50
; 0x3dc57 + 5 bytes

; known jump sources: 3d7a9 (f:57a9), 3e82e (f:682e)
Func_3dc5c: ; 3dc5c (f:5c5c)
	ld a, [$d05e]
	and a
	jr z, .asm_3dc75
	dec a
	add a
	ld hl, Unknown_3dc7a ; $5c7a
	ld b, $0
	ld c, a
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	call PrintText
	xor a
	ld [$d05e], a
.asm_3dc75
	ld c, $14
	jp DelayFrames

Unknown_3dc7a: ; 3dc7a (f:5c7a)
INCBIN "baserom.gbc",$3dc7a,$3dc7e - $3dc7a

UnnamedText_3dc7e: ; 3dc7e (f:5c7e)
	TX_FAR _UnnamedText_3dc7e
	db $50
; 0x3dc7e + 5 bytes

UnnamedText_3dc83: ; 3dc83 (f:5c83)
	TX_FAR _UnnamedText_3dc83
	db $50
; 0x3dc83 + 5 bytes

; known jump sources: 3d694 (f:5694)
Func_3dc88: ; 3dc88 (f:5c88)
	xor a
	ld [$cced], a
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr nz, .asm_3dc97
	ld a, $1
	and a
	ret
.asm_3dc97
	ld hl, W_PARTYMON1_OTID ; $d177
	ld bc, $2c
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	call AddNTimes
	ld a, [W_PLAYERIDHI] ; $d359
	cp [hl]
	jr nz, .asm_3dcb1
	inc hl
	ld a, [W_PLAYERIDLO] ; $d35a
	cp [hl]
	jp z, Func_3ddb0
.asm_3dcb1
	ld hl, W_OBTAINEDBADGES ; $d356
	bit 7, [hl]
	ld a, $65
	jr nz, .asm_3dcce
	bit 5, [hl]
	ld a, $46
	jr nz, .asm_3dcce
	bit 3, [hl]
	ld a, $32
	jr nz, .asm_3dcce
	bit 1, [hl]
	ld a, $1e
	jr nz, .asm_3dcce
	ld a, $a
.asm_3dcce
	ld b, a
	ld c, a
	ld a, [W_PLAYERMONLEVEL] ; $d022
	ld d, a
	add b
	ld b, a
	jr nc, .asm_3dcda
	ld b, $ff
.asm_3dcda
	ld a, c
	cp d
	jp nc, Func_3ddb0
.asm_3dcdf
	call GenRandomInBattle
	swap a
	cp b
	jr nc, .asm_3dcdf
	cp c
	jp c, Func_3ddb0
.asm_3dceb
	call GenRandomInBattle
	cp b
	jr nc, .asm_3dceb
	cp c
	jr c, .asm_3dd3f
	ld a, d
	sub c
	ld b, a
	call GenRandomInBattle
	swap a
	sub b
	jr c, .asm_3dd0e
	cp b
	jr nc, .asm_3dd20
	ld hl, UnnamedText_3ddc0 ; $5dc0
	call PrintText
	call Func_3daad
	jp Func_3ddb4
.asm_3dd0e
	call GenRandomInBattle
	add a
	swap a
	and $7
	jr z, .asm_3dd0e
	ld [W_PLAYERMONSTATUS], a ; $d018
	ld hl, UnnamedText_3ddbb ; $5dbb
	jr .asm_3dd3a
.asm_3dd20
	call GenRandomInBattle
	and $3
	ld hl, UnnamedText_3ddb6 ; $5db6
	and a
	jr z, .asm_3dd3a
	ld hl, UnnamedText_3ddc0 ; $5dc0
	dec a
	jr z, .asm_3dd3a
	ld hl, UnnamedText_3ddc5 ; $5dc5
	dec a
	jr z, .asm_3dd3a
	ld hl, UnnamedText_3ddca ; $5dca
.asm_3dd3a
	call PrintText
	jr Func_3ddb4
.asm_3dd3f
	ld a, [$d01d]
	and a
	jr z, .asm_3dd20
	ld a, [$ccee]
	and a
	jr nz, .asm_3dd20
	ld a, [W_PLAYERSELECTEDMOVE] ; $ccdc
	cp $a5
	jr z, .asm_3dd20
	ld hl, W_PLAYERMONPP ; $d02d
	push hl
	ld a, [hli]
	and $3f
	ld b, a
	ld a, [hli]
	and $3f
	add b
	ld b, a
	ld a, [hli]
	and $3f
	add b
	ld b, a
	ld a, [hl]
	and $3f
	add b
	pop hl
	push af
	ld a, [W_CURMENUITEMID] ; $cc26
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
	and $3f
	ld b, a
	pop af
	cp b
	jr z, .asm_3dd20
	ld a, $1
	ld [$cced], a
	ld a, [W_MAXMENUITEMID] ; $cc28
	ld b, a
	ld a, [W_CURMENUITEMID] ; $cc26
	ld c, a
.asm_3dd86
	call GenRandomInBattle
	and $3
	cp b
	jr nc, .asm_3dd86
	cp c
	jr z, .asm_3dd86
	ld [W_CURMENUITEMID], a ; $cc26
	ld hl, W_PLAYERMONPP ; $d02d
	ld e, a
	ld d, $0
	add hl, de
	ld a, [hl]
	and a
	jr z, .asm_3dd86
	ld a, [W_CURMENUITEMID] ; $cc26
	ld c, a
	ld b, $0
	ld hl, W_PLAYERMONMOVES
	add hl, bc
	ld a, [hl]
	ld [W_PLAYERSELECTEDMOVE], a ; $ccdc
	call GetCurrentMove

; known jump sources: 3dcae (f:5cae), 3dcdc (f:5cdc), 3dce8 (f:5ce8)
Func_3ddb0: ; 3ddb0 (f:5db0)
	ld a, $1
	and a
	ret

; known jump sources: 3dd0b (f:5d0b), 3dd3d (f:5d3d)
Func_3ddb4: ; 3ddb4 (f:5db4)
	xor a
	ret
; 3ddb6 (f:5db6)
UnnamedText_3ddb6: ; 3ddb6 (f:5db6)
	TX_FAR _UnnamedText_3ddb6
	db $50
; 0x3ddb6 + 5 bytes

UnnamedText_3ddbb: ; 3ddbb (f:5dbb)
	TX_FAR _UnnamedText_3ddbb
	db $50
; 0x3ddbb + 5 bytes

UnnamedText_3ddc0: ; 3ddc0 (f:5dc0)
	TX_FAR _UnnamedText_3ddc0
	db $50
; 0x3ddc0 + 5 bytes

UnnamedText_3ddc5: ; 3ddc5 (f:5dc5)
	TX_FAR _UnnamedText_3ddc5
	db $50
; 0x3ddc5 + 5 bytes

UnnamedText_3ddca: ; 3ddca (f:5dca)
	TX_FAR _UnnamedText_3ddca
	db $50
; 0x3ddca + 5 bytes

CalculateDamage: ; 3ddcf (f:5dcf)
	xor a
	ld hl, W_DAMAGE ;damage to eventually inflict, intitialise to zero
	ldi [hl], a
	ld [hl], a
	ld hl, W_PLAYERMOVEPOWER
	ld a, [hli]     ;*read attack base power
	and a
	ld d, a         ;*D = attack base, used later
	ret z           ;return if attack is zero
	ld a, [hl]      ;*test attacking type
	cp a, $14       ;types >= $14 are all special
	jr nc, .specialAttack
.physicalAttack
	ld hl, W_ENEMYMONDEFENSE    ;opponent defense
	ld a, [hli]                 ;*BC = opponent defense used later
	ld b, a
	ld c, [hl]
	ld a, [W_ENEMYBATTSTATUS3]  ;test for reflect
	bit 2, a
	jr z, .next
.doubleDefense
	sla c  ;x2 defense if bit2 of D069 is set
	rl b
.next
	ld hl, W_PLAYERMONATK  ;attack pointer
	ld a, [$d05e]
	and a
	jr z, .next3
	ld c, 3
	call Func_3df1c
	ld a, [$ff00+$97]
	ld b, a
	ld a, [$ff00+$98]
	ld c, a
	push bc
	ld hl, $d18f
	ld a, [W_PLAYERMONNUMBER]
	ld bc, $002c
	call AddNTimes
	pop bc
	jr .next3
.specialAttack
	ld hl, W_ENEMYMONSPECIAL    ;opponent special
	ld a, [hli]                 ;*BC = opponent special defense used later
	ld b, a
	ld c, [hl]
	ld a, [W_ENEMYBATTSTATUS3]  ;test for lightscreen
	bit 1, a
	jr z, .next2
.doubleSpecialDefense
	sla c           ;x2 special defense if bit1 of D069 set
	rl b
.next2
	ld hl, W_PLAYERMONSPECIAL
	ld a, [$d05e]   ;XXX
	and a
	jr z, .next3  ;skip portion of code that pulls up inactive pokemon
.loadOtherPoke
	ld c, 5
	call Func_3df1c
	ld a, [$ff00+$97]
	ld b, a
	ld a, [$ff00+$98]
	ld c, a
	push bc
	ld hl, $d195
	ld a, [W_PLAYERMONNUMBER]
	ld bc, $002c
	call AddNTimes					
	pop bc
.next3
	ld a, [hli]  ;HL: when this was taken
	ld l, [hl]
	ld h, a      ;*HL = attacker attack
	or b         ;is either attack or defense high byte nonzero?
	jr z, .next4
	srl b  ;[defense] BC /= 4 [this is just so it fits into a single byte, 10bits max]
	rr c
	srl b
	rr c
	srl h  ;[attack] HL /= 4 [to apply equal scaling]
	rr l
	srl h
	rr l
	ld a, l
	or h
	jr nz, .next4  ;is HL result zero?
	inc l            ;minimum HL = 1
.next4
	ld b, l        ;*B = attack [possibly scaled] [C contains defense]
	ld a, [$d022]  ;*E = level
	ld e, a
	ld a, [$d05e]  ;critical hit?
	and a
	jr z, .next5
	sla e    ;double level if it was a critical hit
.next5
	ld a, 1  ;return Z = 0
	and a
	ret

; known jump sources: 3e76d (f:676d), 3e986 (f:6986)
Func_3de75: ; 3de75 (f:5e75)
	ld hl, W_DAMAGE ; $d0d7
	xor a
	ld [hli], a
	ld [hl], a
	ld hl, W_ENEMYMOVEPOWER ; $cfce
	ld a, [hli]
	ld d, a
	and a
	ret z
	ld a, [hl]
	cp $14
	jr nc, .asm_3debc
	ld hl, W_PLAYERMONDEF
	ld a, [hli]
	ld b, a
	ld c, [hl]
	ld a, [W_PLAYERBATTSTATUS3] ; $d064
	bit 2, a
	jr z, .asm_3de98
	sla c
	rl b
.asm_3de98
	ld hl, W_ENEMYMONATTACK
	ld a, [$d05e]
	and a
	jr z, .asm_3deef
	ld hl, W_PARTYMON1_DEFENSE ; $d191
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	ld bc, $2c
	call AddNTimes
	ld a, [hli]
	ld b, a
	ld c, [hl]
	push bc
	ld c, $2
	call Func_3df1c
	ld hl, $ff97
	pop bc
	jr .asm_3deef
.asm_3debc
	ld hl, W_PLAYERMONSPECIAL
	ld a, [hli]
	ld b, a
	ld c, [hl]
	ld a, [W_PLAYERBATTSTATUS3] ; $d064
	bit 1, a
	jr z, .asm_3decd
	sla c
	rl b
.asm_3decd
	ld hl, W_ENEMYMONSPECIAL ; $cffc
	ld a, [$d05e]
	and a
	jr z, .asm_3deef
	ld hl, W_PARTYMON1_SPECIAL ; $d195
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	ld bc, $2c
	call AddNTimes
	ld a, [hli]
	ld b, a
	ld c, [hl]
	push bc
	ld c, $5
	call Func_3df1c
	ld hl, $ff97
	pop bc
.asm_3deef
	ld a, [hli]
	ld l, [hl]
	ld h, a
	or b
	jr z, .asm_3df0a
	srl b
	rr c
	srl b
	rr c
	srl h
	rr l
	srl h
	rr l
	ld a, l
	or h
	jr nz, .asm_3df0a
	inc l
.asm_3df0a
	ld b, l
	ld a, [W_ENEMYMONLEVEL] ; $cff3
	ld e, a
	ld a, [$d05e]
	and a
	jr z, .asm_3df17
	sla e
.asm_3df17
	ld a, $1
	and a
	and a
	ret

; known jump sources: 3ddfd (f:5dfd), 3de32 (f:5e32), 3deb3 (f:5eb3), 3dee8 (f:5ee8)
Func_3df1c: ; 3df1c (f:5f1c)
	push de
	push bc
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr nz, .asm_3df40
	ld hl, $d8c6
	dec c
	sla c
	ld b, $0
	add hl, bc
	ld a, [W_ENEMYMONNUMBER] ; $cfe8
	ld bc, $2c
	call AddNTimes
	ld a, [hli]
	ld [$FF00+$97], a
	ld a, [hl]
	ld [$FF00+$98], a
	pop bc
	pop de
	ret
.asm_3df40
	ld a, [W_ENEMYMONLEVEL] ; $cff3
	ld [W_CURENEMYLVL], a ; $d127
	ld a, [$cfe5]
	ld [$d0b5], a
	call GetMonHeader
	ld hl, $cff1
	ld de, $cfaf
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hl]
	ld [de], a
	pop bc
	ld b, $0
	ld hl, $cfa4
	call CalcStat
	pop de
	ret
; 3df65 (f:5f65)
MoreCalculateDamage: ; 3df65 (f:5f65)
	ld a, [$ff00+$f3]  ;FFF3 decides which address to use
	and a
	ld a, [W_PLAYERMOVEEFFECT]
	jr z, .next
	ld a, [$cfcd]
.next
	cp a, 7  ;effect to halve opponent defense [suicide moves]
	jr nz, .next2
.halveDefense
	srl c  ;explosion and selfdestruct will halve the defense...
	jr nz, .next2
	inc c  ;...with a minimum value of 1 [it is used as a divisor later on]
.next2
	cp a, $1d
	jr z, .next3
	cp a, $1e
	jr z, .next3
	cp a, $26    ;OHKO?
	jp z, Func_3e016
	ld a, d      ;if attack base power zero then do nothing
	and a
	ret z
.next3
	xor a
	ld hl, $ff95  ;multiplication address
	ldi [hl], a   ;init to zero
	ldi [hl], a
	ld [hl], a
	ld a, e
	add a         ;A = level *2
	jr nc, .noCarry
.carry
	push af
	ld a, 1     ;add carry for level if needed
	ld [hl], a  ;level high byte [previously zero]
	pop af
.noCarry
	inc hl
	ldi [hl], a  ;level low byte
	ld a, 5      ;[divisor] = 5
	ldd [hl], a
	push bc
	ld b, 4
	call Divide  ;divide level by 5
	pop bc
	inc [hl]  ;+2 [?]
	inc [hl]
	inc hl    ;8bit multiplier
	ld [hl], d
	call Multiply  ;*multiply by attack base power
	ld [hl], b
	call Multiply  ;*multiply by attacker attack stat
	ld [hl], c
	ld b, 4
	call Divide    ;*divide by defender defense stat
	ld [hl], $32		
	ld b, 4
	call Divide      ;divide above result by 50
	ld hl, W_DAMAGE  ;[stuff below I never got to, was only interested in stuff above]

	ld b, [hl]
	ld a, [$FF00+$98]
	add b
	ld [$FF00+$98], a
	jr nc, .asm_3dfd0
	ld a, [$FF00+$97]
	inc a
	ld [$FF00+$97], a
	and a
	jr z, .asm_3e004
.asm_3dfd0
	ld a, [H_DIVIDEND] ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ld b, a
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	or a
	jr nz, .asm_3e004
	ld a, [$FF00+$97]
	cp $3
	jr c, .asm_3dfe8
	cp $4
	jr nc, .asm_3e004
	ld a, [$FF00+$98]
	cp $e6
	jr nc, .asm_3e004
.asm_3dfe8
	inc hl
	ld a, [$FF00+$98]
	ld b, [hl]
	add b
	ld [hld], a
	ld a, [$FF00+$97]
	ld b, [hl]
	adc b
	ld [hl], a
	jr c, .asm_3e004
	ld a, [hl]
	cp $3
	jr c, .asm_3e00a
	cp $4
	jr nc, .asm_3e004
	inc hl
	ld a, [hld]
	cp $e6
	jr c, .asm_3e00a
.asm_3e004
	ld a, $3
	ld [hli], a
	ld a, $e5
	ld [hld], a
.asm_3e00a
	inc hl
	ld a, [hl]
	add $2
	ld [hld], a
	jr nc, .asm_3e012
	inc [hl]
.asm_3e012
	ld a, $1
	and a
	ret

; known jump sources: 3df83 (f:5f83)
Func_3e016: ; 3e016 (f:6016)
	call Func_3f132
	ld a, [W_MOVEMISSED] ; $d05f
	dec a
	ret

INCBIN "baserom.gbc",$3e01e,$3e023 - $3e01e

; determines if attack is a critical hit
; azure heights claims "the fastest pokémon (who are,not coincidentally,
; among the most popular) tend to CH about 20 to 25% of the time."
CriticalHitTest: ; 3e023 (f:6023)
	xor a
	ld [$d05e], a
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, [$cfe5]
	jr nz, .asm_3e032
	ld a, [W_PLAYERMONID]
.asm_3e032
	ld [$d0b5], a
	call GetMonHeader
	ld a, [W_MONHBASESPEED]
	ld b, a
	srl b                        ; (effective (base speed/2))
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld hl, W_PLAYERMOVEPOWER ; $cfd4
	ld de, W_PLAYERBATTSTATUS2 ; $d063
	jr z, .calcCriticalHitProbability
	ld hl, W_ENEMYMOVEPOWER ; $cfce
	ld de, W_ENEMYBATTSTATUS2 ; $d068
.calcCriticalHitProbability      ; 0x3e04f
	ld a, [hld]                  ; read base power from RAM
	and a
	ret z                        ; do nothing if zero
	dec hl
	ld c, [hl]                   ; read move id
	ld a, [de]
	bit 2, a                     ; test for focus energy
	jr nz, .focusEnergyUsed      ; bug: using focus energy causes a shift to the right instead of left,
	                             ; resulting in 1/4 the usual crit chance
	sla b                        ; (effective (base speed/2)*2)
	jr nc, .noFocusEnergyUsed
	ld b, $ff                    ; cap at 255/256
	jr .noFocusEnergyUsed
.focusEnergyUsed
	srl b
.noFocusEnergyUsed
	ld hl, HighCriticalMoves      ; table of high critical hit moves
.Loop
	ld a, [hli]                  ; read move from move table
	cp c                         ; does it match the move about to be used?
	jr z, .HighCritical          ; if so, the move about to be used is a high critical hit ratio move 
	inc a                        ; move on to the next move, FF terminates loop
	jr nz, .Loop                 ; check the next move in HighCriticalMoves
	srl b                        ; /2 for regular move (effective (base speed / 2))
	jr .SkipHighCritical         ; continue as a normal move
.HighCritical
	sla b                        ; *2 for high critical hit moves
	jr nc, .noCarry
	ld b, $ff                    ; cap at 255/256
.noCarry
	sla b                        ; *4 for high critical move (effective (base speed/2)*8))
	jr nc, .SkipHighCritical
	ld b, $ff
.SkipHighCritical
	call GenRandomInBattle       ; generates a random value, in "a"
	rlc a
	rlc a
	rlc a
	cp b                         ; check a against calculated crit rate
	ret nc                       ; no critical hit if no borrow
	ld a, $1
	ld [$d05e], a                ; set critical hit flag
	ret
; 0x3e08e

; high critical hit moves
HighCriticalMoves: ; 3e08e (f:608e)
	db KARATE_CHOP
	db RAZOR_LEAF
	db CRABHAMMER
	db SLASH
	db $FF
; 0x3e093

; function to determine if Counter hits and if so, how much damage it does
HandleCounterMove: ; 3e093 (f:6093)
	ld a,[H_WHOSETURN] ; whose turn
	and a
; player's turn
	ld hl,W_ENEMYSELECTEDMOVE
	ld de,W_ENEMYMOVEPOWER
	ld a,[W_PLAYERSELECTEDMOVE]
	jr z,.next
; enemy's turn
	ld hl,W_PLAYERSELECTEDMOVE
	ld de,W_PLAYERMOVEPOWER
	ld a,[W_ENEMYSELECTEDMOVE]
.next
	cp a,COUNTER
	ret nz ; return if not using Counter
	ld a,$01
	ld [W_MOVEMISSED],a ; initialize the move missed variable to true (it is set to false below if the move hits)
	ld a,[hl]
	cp a,COUNTER
	ret z ; if the target also used Counter, miss
	ld a,[de]
	and a
	ret z ; if the move the target used has 0 power, miss
; check if the move the target used was Normal or Fighting type
	inc de
	ld a,[de]
	and a ; normal type
	jr z,.counterableType
	cp a,FIGHTING
	jr z,.counterableType
; if the move wasn't Normal or Fighting type, miss
	xor a
	ret
.counterableType
	ld hl,W_DAMAGE
	ld a,[hli]
	or [hl]
	ret z ; Counter misses if the target did no damage to the Counter user
; double the damage that the target did to the Counter user
	ld a,[hl]
	add a
	ldd [hl],a
	ld a,[hl]
	adc a
	ld [hl],a
	jr nc,.noCarry
; damage is capped at 0xFFFF
	ld a,$ff
	ld [hli],a
	ld [hl],a
.noCarry
	xor a
	ld [W_MOVEMISSED],a
	call MoveHitTest ; do the normal move hit test in addition to Counter's special rules
	xor a
	ret

ApplyAttackToEnemyPokemon: ; 3e0df (f:60df)
	ld a,[W_PLAYERMOVEEFFECT]
	cp a,OHKO_EFFECT
	jr z,ApplyDamageToEnemyPokemon
	cp a,SUPER_FANG_EFFECT
	jr z,.superFangEffect
	cp a,SPECIAL_DAMAGE_EFFECT
	jr z,.specialDamage
	ld a,[W_PLAYERMOVEPOWER]
	and a
	jp z,ApplyAttackToEnemyPokemonDone
	jr ApplyDamageToEnemyPokemon
.superFangEffect
; set the damage to half the target's HP
	ld hl,W_ENEMYMONCURHP
	ld de,W_DAMAGE
	ld a,[hli]
	srl a
	ld [de],a
	inc de
	ld b,a
	ld a,[hl]
	rr a
	ld [de],a
	or b
	jr nz,ApplyDamageToEnemyPokemon
; make sure Super Fang's damage is always at least 1
	ld a,$01
	ld [de],a
	jr ApplyDamageToEnemyPokemon
.specialDamage
	ld hl,W_PLAYERMONLEVEL
	ld a,[hl]
	ld b,a
	ld a,[W_PLAYERMOVENUM]
	cp a,SEISMIC_TOSS
	jr z,.storeDamage
	cp a,NIGHT_SHADE
	jr z,.storeDamage
	ld b,SONICBOOM_DAMAGE
	cp a,SONICBOOM
	jr z,.storeDamage
	ld b,DRAGON_RAGE_DAMAGE
	cp a,DRAGON_RAGE
	jr z,.storeDamage
; Psywave
	ld a,[hl]
	ld b,a
	srl a
	add b
	ld b,a ; b = level * 1.5
; loop until a random number in the range [1, b) is found
.loop
	call GenRandomInBattle ; random number
	and a
	jr z,.loop
	cp b
	jr nc,.loop
	ld b,a
.storeDamage
	ld hl,W_DAMAGE
	xor a
	ld [hli],a
	ld a,b
	ld [hl],a

ApplyDamageToEnemyPokemon: ; 3e142 (f:6142)
	ld hl,W_DAMAGE
	ld a,[hli]
	ld b,a
	ld a,[hl]
	or b
	jr z,ApplyAttackToEnemyPokemonDone ; we're done if damage is 0
	ld a,[W_ENEMYBATTSTATUS2]
	bit 4,a ; does the enemy have a substitute?
	jp nz,AttackSubstitute
; subtract the damage from the pokemon's current HP
; also, save the current HP at W_HPBAROLDHP
	ld a,[hld]
	ld b,a
	ld a,[W_ENEMYMONCURHP + 1]
	ld [W_HPBAROLDHP],a
	sub b
	ld [W_ENEMYMONCURHP + 1],a
	ld a,[hl]
	ld b,a
	ld a,[W_ENEMYMONCURHP]
	ld [W_HPBAROLDHP+1],a
	sbc b
	ld [W_ENEMYMONCURHP],a
	jr nc,.animateHpBar
; if more damage was done than the current HP, zero the HP and set the damage
; equal to how much HP the pokemon had before the attack
	ld a,[W_HPBAROLDHP+1]
	ld [hli],a
	ld a,[W_HPBAROLDHP]
	ld [hl],a
	xor a
	ld hl,W_ENEMYMONCURHP
	ld [hli],a
	ld [hl],a
.animateHpBar
	ld hl,W_ENEMYMONMAXHP
	ld a,[hli]
	ld [W_HPBARMAXHP+1],a
	ld a,[hl]
	ld [W_HPBARMAXHP],a
	ld hl,W_ENEMYMONCURHP
	ld a,[hli]
	ld [W_HPBARNEWHP+1],a
	ld a,[hl]
	ld [W_HPBARNEWHP],a
	FuncCoord 2, 2 ; $c3ca
	ld hl,Coord
	xor a
	ld [$cf94],a
	ld a,$48
	call Predef ; animate the HP bar shortening
ApplyAttackToEnemyPokemonDone: ; 3e19d (f:619d)
	jp Func_3cd5a ; redraw pokemon names and HP bars

ApplyAttackToPlayerPokemon: ; 3e1a0 (f:61a0)
	ld a,[W_ENEMYMOVEEFFECT]
	cp a,OHKO_EFFECT
	jr z,ApplyDamageToPlayerPokemon
	cp a,SUPER_FANG_EFFECT
	jr z,.superFangEffect
	cp a,SPECIAL_DAMAGE_EFFECT
	jr z,.specialDamage
	ld a,[W_ENEMYMOVEPOWER]
	and a
	jp z,ApplyAttackToPlayerPokemonDone
	jr ApplyDamageToPlayerPokemon
.superFangEffect
; set the damage to half the target's HP
	ld hl,W_PLAYERMONCURHP
	ld de,W_DAMAGE
	ld a,[hli]
	srl a
	ld [de],a
	inc de
	ld b,a
	ld a,[hl]
	rr a
	ld [de],a
	or b
	jr nz,ApplyDamageToPlayerPokemon
; make sure Super Fang's damage is always at least 1
	ld a,$01
	ld [de],a
	jr ApplyDamageToPlayerPokemon
.specialDamage
	ld hl,W_ENEMYMONLEVEL
	ld a,[hl]
	ld b,a
	ld a,[W_ENEMYMOVENUM]
	cp a,SEISMIC_TOSS
	jr z,.storeDamage
	cp a,NIGHT_SHADE
	jr z,.storeDamage
	ld b,SONICBOOM_DAMAGE
	cp a,SONICBOOM
	jr z,.storeDamage
	ld b,DRAGON_RAGE_DAMAGE
	cp a,DRAGON_RAGE
	jr z,.storeDamage
; Psywave
	ld a,[hl]
	ld b,a
	srl a
	add b
	ld b,a ; b = attacker's level * 1.5
; loop until a random number in the range [0, b) is found
; this differs from the range when the player attacks, which is [1, b)
; it's possible for the enemy to do 0 damage with Psywave, but the player always does at least 1 damage
.loop
	call GenRandomInBattle ; random number
	cp b
	jr nc,.loop
	ld b,a
.storeDamage
	ld hl,W_DAMAGE
	xor a
	ld [hli],a
	ld a,b
	ld [hl],a

ApplyDamageToPlayerPokemon: ; 3e200 (f:6200)
	ld hl,W_DAMAGE
	ld a,[hli]
	ld b,a
	ld a,[hl]
	or b
	jr z,ApplyAttackToPlayerPokemonDone ; we're done if damage is 0
	ld a,[W_PLAYERBATTSTATUS2]
	bit 4,a ; does the player have a substitute?
	jp nz,AttackSubstitute
; subtract the damage from the pokemon's current HP
; also, save the current HP at W_HPBAROLDHP and the new HP at W_HPBARNEWHP
	ld a,[hld]
	ld b,a
	ld a,[W_PLAYERMONCURHP + 1]
	ld [W_HPBAROLDHP],a
	sub b
	ld [W_PLAYERMONCURHP + 1],a
	ld [W_HPBARNEWHP],a
	ld b,[hl]
	ld a,[W_PLAYERMONCURHP]
	ld [W_HPBAROLDHP+1],a
	sbc b
	ld [W_PLAYERMONCURHP],a
	ld [W_HPBARNEWHP+1],a
	jr nc,.animateHpBar
; if more damage was done than the current HP, zero the HP and set the damage
; equal to how much HP the pokemon had before the attack
	ld a,[W_HPBAROLDHP+1]
	ld [hli],a
	ld a,[W_HPBAROLDHP]
	ld [hl],a
	xor a
	ld hl,W_PLAYERMONCURHP
	ld [hli],a
	ld [hl],a
	ld hl,W_HPBARNEWHP
	ld [hli],a
	ld [hl],a
.animateHpBar
	ld hl,W_PLAYERMONMAXHP
	ld a,[hli]
	ld [W_HPBARMAXHP+1],a
	ld a,[hl]
	ld [W_HPBARMAXHP],a
	FuncCoord 10, 9 ; $c45e
	ld hl,Coord
	ld a,$01
	ld [$cf94],a
	ld a,$48
	call Predef ; animate the HP bar shortening
ApplyAttackToPlayerPokemonDone
	jp Func_3cd5a ; redraw pokemon names and HP bars

AttackSubstitute: ; 3e25e (f:625e)
	ld hl,SubstituteTookDamageText
	call PrintText
; values for player turn
	ld de,W_ENEMYSUBSITUTEHP
	ld bc,W_ENEMYBATTSTATUS2
	ld a,[H_WHOSETURN]
	and a
	jr z,.applyDamageToSubstitute
; values for enemy turn
	ld de,W_PLAYERSUBSITUTEHP
	ld bc,W_PLAYERBATTSTATUS2
.applyDamageToSubstitute
	ld hl,W_DAMAGE
	ld a,[hli]
	and a
	jr nz,.substituteBroke ; damage > 0xFF always breaks substitutes
; subtract damage from HP of substitute
	ld a,[de]
	sub [hl]
	ld [de],a
	ret nc
.substituteBroke
	ld h,b
	ld l,c
	res 4,[hl] ; unset the substitute bit
	ld hl,SubstituteBrokeText
	call PrintText
; flip whose turn it is for the next function call
	ld a,[H_WHOSETURN]
	xor a,$01
	ld [H_WHOSETURN],a
	ld hl, Func_79747
	ld b, BANK(Func_79747) ; animate the substitute breaking
	call Bankswitch ; substitute
; flip the turn back to the way it was
	ld a,[H_WHOSETURN]
	xor a,$01
	ld [H_WHOSETURN],a
	ld hl,W_PLAYERMOVEEFFECT ; value for player's turn
	and a
	jr z,.nullifyEffect
	ld hl,W_ENEMYMOVEEFFECT ; value for enemy's turn
.nullifyEffect
	xor a
	ld [hl],a ; zero the effect of the attacker's move
	jp Func_3cd5a ; redraw pokemon names and HP bars

SubstituteTookDamageText: ; 3e2ac (f:62ac)
	TX_FAR _SubstituteTookDamageText
	db $50
; 0x3e2ac + 5 bytes

SubstituteBrokeText: ; 3e2b1 (f:62b1)
	TX_FAR _SubstituteBrokeText
	db $50
; 0x3e2b1 + 5 bytes

; this function raises the attack modifier of a pokemon using Rage when that pokemon is attacked
HandleBuildingRage: ; 3e2b6 (f:62b6)
; values for the player turn
	ld hl,W_ENEMYBATTSTATUS2
	ld de,W_ENEMYMONATTACKMOD
	ld bc,W_ENEMYMOVENUM
	ld a,[H_WHOSETURN]
	and a
	jr z,.next
; values for the enemy turn
	ld hl,W_PLAYERBATTSTATUS2
	ld de,W_PLAYERMONATTACKMOD
	ld bc,W_PLAYERMOVENUM
.next
	bit 6,[hl] ; is the pokemon being attacked under the effect of Rage?
	ret z ; return if not
	ld a,[de]
	cp a,$0d ; maximum stat modifier value
	ret z ; return if attack modifier is already maxed
	ld a,[H_WHOSETURN]
	xor a,$01 ; flip turn for the stat modifier raising function
	ld [H_WHOSETURN],a
; change the target pokemon's move to $00 and the effect to the one
; that causes the attack modifier to go up one stage
	ld h,b
	ld l,c
	ld [hl],$00 ; null move number
	inc hl
	ld [hl],ATTACK_UP1_EFFECT
	push hl
	ld hl,BuildingRageText
	call PrintText
	call Func_3f428 ; stat modifier raising function
	pop hl
	xor a
	ldd [hl],a ; null move effect
	ld a,RAGE
	ld [hl],a ; restore the target pokemon's move number to Rage
	ld a,[H_WHOSETURN]
	xor a,$01 ; flip turn back to the way it was
	ld [H_WHOSETURN],a
	ret

BuildingRageText: ; 3e2f8 (f:62f8)
	TX_FAR _BuildingRageText
	db $50
; 0x3e2f8 + 5 bytes

; copy last move for Mirror Move
; sets zero flag on failure and unsets zero flag on success
MirrorMoveCopyMove: ; 3e2fd (f:62fd)
	ld a,[H_WHOSETURN]
	and a
; values for player turn
	ld a,[$ccf2]
	ld hl,W_PLAYERSELECTEDMOVE
	ld de,W_PLAYERMOVENUM
	jr z,.next
; values for enemy turn
	ld a,[$ccf1]
	ld de,W_ENEMYMOVENUM
	ld hl,W_ENEMYSELECTEDMOVE
.next
	ld [hl],a
	cp a,MIRROR_MOVE ; did the target pokemon also use Mirror Move?
	jr z,.mirrorMoveFailed
	and a ; null move?
	jr nz,ReloadMoveData
.mirrorMoveFailed
; Mirror Move fails on itself and null moves
	ld hl,MirrorMoveFailedText
	call PrintText
	xor a
	ret

MirrorMoveFailedText: ; 3e324 (f:6324)
	TX_FAR _MirrorMoveFailedText
	db $50
; 0x3e324 + 5 bytes

; function used to reload move data for moves like Mirror Move and Metronome
ReloadMoveData: ; 3e329 (f:6329)
	ld [$d11e],a
	dec a
	ld hl,Moves
	ld bc,$0006
	call AddNTimes
	ld a,BANK(Moves)
	call FarCopyData ; copy the move's stats
	call IncrementMovePP
; the follow two function calls are used to reload the move name
	call GetMoveName
	call CopyStringToCF4B
	ld a,$01
	and a
	ret

; function that picks a random move for metronome
MetronomePickMove: ; 3e348 (f:6348)
	xor a
	ld [$cc5b],a
	ld a,METRONOME
	call PlayMoveAnimation ; play Metronome's animation
; values for player turn
	ld de,W_PLAYERMOVENUM
	ld hl,W_PLAYERSELECTEDMOVE
	ld a,[H_WHOSETURN]
	and a
	jr z,.pickMoveLoop
; values for enemy turn
	ld de,W_ENEMYMOVENUM
	ld hl,W_ENEMYSELECTEDMOVE
; loop to pick a random number in the range [1, $a5) to be the move used by Metronome
.pickMoveLoop
	call GenRandomInBattle ; random number
	and a
	jr z,.pickMoveLoop
	cp a,$a5 ; max normal move number + 1 (this is Struggle's move number)
	jr nc,.pickMoveLoop
	cp a,METRONOME
	jr z,.pickMoveLoop
	ld [hl],a
	jr ReloadMoveData

; this function increments the current move's PP
; it's used to prevent moves that run another move within the same turn
; (like Mirror Move and Metronome) from losing 2 PP
IncrementMovePP: ; 3e373 (f:6373)
	ld a,[H_WHOSETURN]
	and a
; values for player turn
	ld hl,W_PLAYERMONPP
	ld de,W_PARTYMON1_MOVE1PP
	ld a,[W_PLAYERMOVELISTINDEX]
	jr z,.next
; values for enemy turn
	ld hl,W_ENEMYMONPP
	ld de,$d8c1 ; enemy party pokemon 1 PP
	ld a,[W_ENEMYMOVELISTINDEX]
.next
	ld b,$00
	ld c,a
	add hl,bc
	inc [hl] ; increment PP in the currently battling pokemon memory location
	ld h,d
	ld l,e
	add hl,bc
	ld a,[H_WHOSETURN]
	and a
	ld a,[W_PLAYERMONNUMBER] ; value for player turn
	jr z,.next2
	ld a,[W_ENEMYMONNUMBER] ; value for enemy turn
.next2
	ld bc,$002c
	call AddNTimes
	inc [hl] ; increment PP in the party memory location
	ret

; function to adjust the base damage of an attack to account for type effectiveness
AdjustDamageForMoveType: ; 3e3a5 (f:63a5)
; values for player turn
	ld hl,W_PLAYERMONTYPES
	ld a,[hli]
	ld b,a    ; b = type 1 of attacker
	ld c,[hl] ; c = type 2 of attacker
	ld hl,W_ENEMYMONTYPES
	ld a,[hli]
	ld d,a    ; d = type 1 of defender
	ld e,[hl] ; e = type 2 of defender
	ld a,[W_PLAYERMOVETYPE]
	ld [$d11e],a
	ld a,[H_WHOSETURN]
	and a
	jr z,.next
; values for enemy turn
	ld hl,W_ENEMYMONTYPES
	ld a,[hli]
	ld b,a    ; b = type 1 of attacker
	ld c,[hl] ; c = type 2 of attacker
	ld hl,W_PLAYERMONTYPES
	ld a,[hli]
	ld d,a    ; d = type 1 of defender
	ld e,[hl] ; e = type 2 of defender
	ld a,[W_ENEMYMOVETYPE]
	ld [$d11e],a
.next
	ld a,[$d11e] ; move type
	cp b ; does the move type match type 1 of the attacker?
	jr z,.sameTypeAttackBonus
	cp c ; does the move type match type 2 of the attacker?
	jr z,.sameTypeAttackBonus
	jr .skipSameTypeAttackBonus
.sameTypeAttackBonus
; if the move type matches one of the attacker's types
	ld hl,W_DAMAGE + 1
	ld a,[hld]
	ld h,[hl]
	ld l,a    ; hl = damage
	ld b,h
	ld c,l    ; bc = damage
	srl b
	rr c      ; bc = floor(0.5 * damage)
	add hl,bc ; hl = floor(1.5 * damage)
; store damage
	ld a,h
	ld [W_DAMAGE],a
	ld a,l
	ld [W_DAMAGE + 1],a
	ld hl,$d05b
	set 7,[hl]
.skipSameTypeAttackBonus
	ld a,[$d11e]
	ld b,a ; b = move type
	ld hl,TypeEffects
.loop
	ld a,[hli] ; a = "attacking type" of the current type pair
	cp a,$ff
	jr z,.done
	cp b ; does move type match "attacking type"?
	jr nz,.nextTypePair
	ld a,[hl] ; a = "defending type" of the current type pair
	cp d ; does type 1 of defender match "defending type"?
	jr z,.matchingPairFound
	cp e ; does type 2 of defender match "defending type"?
	jr z,.matchingPairFound
	jr .nextTypePair
.matchingPairFound
; if the move type matches the "attacking type" and one of the defender's types matches the "defending type"
	push hl
	push bc
	inc hl
	ld a,[$d05b]
	and a,$80
	ld b,a
	ld a,[hl] ; a = damage multiplier
	ld [H_MULTIPLIER],a
	add b
	ld [$d05b],a
	xor a
	ld [H_MULTIPLICAND],a
	ld hl,W_DAMAGE
	ld a,[hli]
	ld [H_MULTIPLICAND + 1],a
	ld a,[hld]
	ld [H_MULTIPLICAND + 2],a
	call Multiply
	ld a,10
	ld [H_DIVISOR],a
	ld b,$04
	call Divide
	ld a,[H_QUOTIENT + 2]
	ld [hli],a
	ld b,a
	ld a,[H_QUOTIENT + 3]
	ld [hl],a
	or b ; is damage 0?
	jr nz,.skipTypeImmunity
.typeImmunity
; if damage is 0, make the move miss
	inc a
	ld [W_MOVEMISSED],a
.skipTypeImmunity
	pop bc
	pop hl
.nextTypePair
	inc hl
	inc hl
	jp .loop
.done
	ret

; function to tell how effective the type of an enemy attack is on the player's current pokemon
; this doesn't take into account the effects that dual types can have
; (e.g. 4x weakness / resistance, weaknesses and resistances canceling)
; the result is stored in [$D11E]
; ($05 is not very effective, $10 is neutral, $14 is super effective)
; as far is can tell, this is only used once in some AI code to help decide which move to use
AIGetTypeEffectiveness: ; 3e449 (f:6449)
	ld a,[W_ENEMYMOVETYPE]
	ld d,a                 ; d = type of enemy move
	ld hl,W_PLAYERMONTYPES
	ld b,[hl]              ; b = type 1 of player's pokemon
	inc hl
	ld c,[hl]              ; c = type 2 of player's pokemon
	ld a,$10
	ld [$d11e],a           ; initialize [$D11E] to neutral effectiveness
	ld hl,TypeEffects
.loop
	ld a,[hli]
	cp a,$ff
	ret z
	cp d                   ; match the type of the move
	jr nz,.nextTypePair1
	ld a,[hli]
	cp b                   ; match with type 1 of pokemon
	jr z,.done
	cp c                   ; or match with type 2 of pokemon
	jr z,.done
	jr .nextTypePair2
.nextTypePair1
	inc hl
.nextTypePair2
	inc hl
	jr .loop
.done
	ld a,[hl]
	ld [$d11e],a           ; store damage multiplier
	ret

TypeEffects: ; 3e474 (f:6474)
; format: attacking type, defending type, damage multiplier
; the multiplier is a (decimal) fixed-point number:
;     20 is ×2.0
;     05 is ×0.5
;     00 is ×0
	db WATER,FIRE,20
	db FIRE,GRASS,20
	db FIRE,ICE,20
	db GRASS,WATER,20
	db ELECTRIC,WATER,20
	db WATER,ROCK,20
	db GROUND,FLYING,00
	db WATER,WATER,05
	db FIRE,FIRE,05
	db ELECTRIC,ELECTRIC,05
	db ICE,ICE,05
	db GRASS,GRASS,05
	db PSYCHIC,PSYCHIC,05
	db FIRE,WATER,05
	db GRASS,FIRE,05
	db WATER,GRASS,05
	db ELECTRIC,GRASS,05
	db NORMAL,ROCK,05
	db NORMAL,GHOST,00
	db GHOST,GHOST,20
	db FIRE,BUG,20
	db FIRE,ROCK,05
	db WATER,GROUND,20
	db ELECTRIC,GROUND,00
	db ELECTRIC,FLYING,20
	db GRASS,GROUND,20
	db GRASS,BUG,05
	db GRASS,POISON,05
	db GRASS,ROCK,20
	db GRASS,FLYING,05
	db ICE,WATER,05
	db ICE,GRASS,20
	db ICE,GROUND,20
	db ICE,FLYING,20
	db FIGHTING,NORMAL,20
	db FIGHTING,POISON,05
	db FIGHTING,FLYING,05
	db FIGHTING,PSYCHIC,05
	db FIGHTING,BUG,05
	db FIGHTING,ROCK,20
	db FIGHTING,ICE,20
	db FIGHTING,GHOST,00
	db POISON,GRASS,20
	db POISON,POISON,05
	db POISON,GROUND,05
	db POISON,BUG,20
	db POISON,ROCK,05
	db POISON,GHOST,05
	db GROUND,FIRE,20
	db GROUND,ELECTRIC,20
	db GROUND,GRASS,05
	db GROUND,BUG,05
	db GROUND,ROCK,20
	db GROUND,POISON,20
	db FLYING,ELECTRIC,05
	db FLYING,FIGHTING,20
	db FLYING,BUG,20
	db FLYING,GRASS,20
	db FLYING,ROCK,05
	db PSYCHIC,FIGHTING,20
	db PSYCHIC,POISON,20
	db BUG,FIRE,05
	db BUG,GRASS,20
	db BUG,FIGHTING,05
	db BUG,FLYING,05
	db BUG,PSYCHIC,20
	db BUG,GHOST,05
	db BUG,POISON,20
	db ROCK,FIRE,20
	db ROCK,FIGHTING,05
	db ROCK,GROUND,05
	db ROCK,FLYING,20
	db ROCK,BUG,20
	db ROCK,ICE,20
	db GHOST,NORMAL,00
	db GHOST,PSYCHIC,00
	db FIRE,DRAGON,05
	db WATER,DRAGON,05
	db ELECTRIC,DRAGON,05
	db GRASS,DRAGON,05
	db ICE,DRAGON,20
	db DRAGON,DRAGON,20
	db $FF

; some tests that need to pass for a move to hit
MoveHitTest: ; 3e56b (f:656b)
; player's turn
	ld hl,W_ENEMYBATTSTATUS1
	ld de,W_PLAYERMOVEEFFECT
	ld bc,W_ENEMYMONSTATUS
	ld a,[H_WHOSETURN]
	and a
	jr z,.dreamEaterCheck
; enemy's turn
	ld hl,W_PLAYERBATTSTATUS1
	ld de,W_ENEMYMOVEEFFECT
	ld bc,W_PLAYERMONSTATUS
.dreamEaterCheck
	ld a,[de]
	cp a,DREAM_EATER_EFFECT
	jr nz,.swiftCheck
	ld a,[bc]
	and a,$07 ; is the target pokemon sleeping?
	jp z,.moveMissed
.swiftCheck
	ld a,[de]
	cp a,SWIFT_EFFECT
	ret z ; Swift never misses (interestingly, Azure Heights lists this is a myth, but it appears to be true)
	call CheckTargetSubstitute ; substitute check (note that this overwrites a)
	jr z,.checkForDigOrFlyStatus
; this code is buggy. it's supposed to prevent HP draining moves from working on substitutes.
; since $7b79 overwrites a with either $00 or $01, it never works.
	cp a,DRAIN_HP_EFFECT ; $03
	jp z,.moveMissed
	cp a,DREAM_EATER_EFFECT ; $08
	jp z,.moveMissed
.checkForDigOrFlyStatus
	bit 6,[hl]
	jp nz,.moveMissed
	ld a,[H_WHOSETURN]
	and a
	jr nz,.enemyTurn
.playerTurn
; this checks if the move effect is disallowed by mist
	ld a,[W_PLAYERMOVEEFFECT]
	cp a,$12
	jr c,.skipEnemyMistCheck
	cp a,$1a
	jr c,.enemyMistCheck
	cp a,$3a
	jr c,.skipEnemyMistCheck
	cp a,$42
	jr c,.enemyMistCheck
	jr .skipEnemyMistCheck
.enemyMistCheck
; if move effect is from $12 to $19 inclusive or $3a to $41 inclusive
; i.e. the following moves
; GROWL, TAIL WHIP, LEER, STRING SHOT, SAND-ATTACK, SMOKESCREEN, KINESIS,
; FLASH, CONVERSION, HAZE*, SCREECH, LIGHT SCREEN*, REFLECT*
; the moves that are marked with an asterisk are not affected since this
; function is not called when those moves are used
; XXX are there are any others like those three?
	ld a,[W_ENEMYBATTSTATUS2]
	bit 1,a
	jp nz,.moveMissed
.skipEnemyMistCheck
	ld a,[W_PLAYERBATTSTATUS2]
	bit 0,a ; is the player using X Accuracy?
	ret nz ; if so, always hit regardless of accuracy/evasion
	jr .calcHitChance
.enemyTurn
	ld a,[W_ENEMYMOVEEFFECT]
	cp a,$12
	jr c,.skipPlayerMistCheck
	cp a,$1a
	jr c,.playerMistCheck
	cp a,$3a
	jr c,.skipPlayerMistCheck
	cp a,$42
	jr c,.playerMistCheck
	jr .skipPlayerMistCheck
.playerMistCheck
; similar to enemy mist check
	ld a,[W_PLAYERBATTSTATUS2]
	bit 1,a
	jp nz,.moveMissed
.skipPlayerMistCheck
	ld a,[W_ENEMYBATTSTATUS2]
	bit 0,a ; is the enemy using X Accuracy?
	ret nz ; if so, always hit regardless of accuracy/evasion
.calcHitChance
	call CalcHitChance ; scale the move accuracy according to attacker's accuracy and target's evasion
	ld a,[W_PLAYERMOVEACCURACY]
	ld b,a
	ld a,[H_WHOSETURN]
	and a
	jr z,.doAccuracyCheck
	ld a,[W_ENEMYMOVEACCURACY]
	ld b,a
.doAccuracyCheck
; if the random number generated is greater than or equal to the scaled accuracy, the move misses
; note that this means that even the highest accuracy is still just a 255/256 chance, not 100%
	call GenRandomInBattle ; random number
	cp b
	jr nc,.moveMissed
	ret
.moveMissed
	xor a
	ld hl,W_DAMAGE ; zero the damage
	ld [hli],a
	ld [hl],a
	inc a
	ld [W_MOVEMISSED],a
	ld a,[H_WHOSETURN]
	and a
	jr z,.playerTurn2
.enemyTurn2
	ld hl,W_ENEMYBATTSTATUS1
	res 5,[hl] ; end multi-turn attack e.g. wrap
	ret
.playerTurn2
	ld hl,W_PLAYERBATTSTATUS1
	res 5,[hl] ; end multi-turn attack e.g. wrap
	ret

; values for player turn
CalcHitChance: ; 3e624 (f:6624)
	ld hl,W_PLAYERMOVEACCURACY
	ld a,[H_WHOSETURN]
	and a
	ld a,[W_PLAYERMONACCURACYMOD]
	ld b,a
	ld a,[W_ENEMYMONEVASIONMOD]
	ld c,a
	jr z,.next
; values for enemy turn
	ld hl,W_ENEMYMOVEACCURACY
	ld a,[W_ENEMYMONACCURACYMOD]
	ld b,a
	ld a,[W_PLAYERMONEVASIONMOD]
	ld c,a
.next
	ld a,$0e
	sub c
	ld c,a ; c = 14 - EVASIONMOD (this "reflects" the value over 7, so that an increase in the target's evasion decreases the hit chance instead of increasing the hit chance)
; zero the high bytes of the multiplicand
	xor a
	ld [H_MULTIPLICAND],a
	ld [H_MULTIPLICAND + 1],a
	ld a,[hl]
	ld [H_MULTIPLICAND + 2],a ; set multiplicand to move accuracy
	push hl
	ld d,$02 ; loop has two iterations
; loop to do the calculations, the first iteration multiplies by the accuracy ratio and the second iteration multiplies by the evasion ratio
.loop
	push bc
	ld hl,Unknown_3f6cb  ; $76cb ; stat modifier ratios
	dec b
	sla b
	ld c,b
	ld b,$00
	add hl,bc ; hl = address of stat modifier ratio
	pop bc
	ld a,[hli]
	ld [H_MULTIPLIER],a ; set multiplier to the numerator of the ratio
	call Multiply
	ld a,[hl]
	ld [H_DIVISOR],a ; set divisor to the the denominator of the ratio (the dividend is the product of the previous multiplication)
	ld b,$04 ; number of bytes in the dividend
	call Divide
	ld a,[H_QUOTIENT + 3]
	ld b,a
	ld a,[H_QUOTIENT + 2]
	or b
	jp nz,.nextCalculation
; make sure the result is always at least one
	ld [H_QUOTIENT + 2],a
	ld a,$01
	ld [H_QUOTIENT + 3],a
.nextCalculation
	ld b,c
	dec d
	jr nz,.loop
	ld a,[H_QUOTIENT + 2]
	and a ; is the calculated hit chance over 0xFF?
	ld a,[H_QUOTIENT + 3]
	jr z,.storeAccuracy
; if calculated hit chance over 0xFF
	ld a,$ff ; set the hit chance to 0xFF
.storeAccuracy
	pop hl
	ld [hl],a ; store the hit chance in the move accuracy variable
	ret

; known jump sources: 3d6ff (f:56ff), 3e77c (f:677c)
Func_3e687: ; 3e687 (f:6687)
	ld hl, W_DAMAGE ; $d0d7
	ld a, [hli]
	and a
	jr nz, .asm_3e692
	ld a, [hl]
	cp $2
	ret c
.asm_3e692
	xor a
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	dec hl
	ld a, [hli]
	ld [$FF00+$97], a
	ld a, [hl]
	ld [$FF00+$98], a
.asm_3e69c
	call GenRandomInBattle
	rrca
	cp $d9
	jr c, .asm_3e69c
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	call Multiply
	ld a, $ff
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld b, $4
	call Divide
	ld a, [$FF00+$97]
	ld hl, W_DAMAGE ; $d0d7
	ld [hli], a
	ld a, [$FF00+$98]
	ld [hl], a
	ret

; known jump sources: 3c34b (f:434b), 3c3a1 (f:43a1)
Func_3e6bc: ; 3e6bc (f:66bc)
	ld a, [W_ENEMYSELECTEDMOVE] ; $ccdd
	inc a
	jp z, Func_3e88c
	call Function5811
	jp z, Func_3e88c
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr nz, .asm_3e6dc
	ld b, $1
	ld a, [$cc3e]
	cp $e
	jr z, .asm_3e6dc
	cp $4
	ret nc
.asm_3e6dc
	ld hl, $ccd5
	inc [hl]
	xor a
	ld [W_MOVEMISSED], a ; $d05f
	ld [$ccf4], a
	ld a, $a
	ld [$d05b], a
	call Func_3e88f
	jr nz, .asm_3e6f2
	jp [hl]
.asm_3e6f2
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	bit 4, [hl]
	jr nz, asm_3e70b
	call GetCurrentMove

; known jump sources: 3e7fc (f:67fc), 3e806 (f:6806)
Func_3e6fc: ; 3e6fc (f:66fc)
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	cp $27
	jp z, Func_3f132
	cp $2b
	jp z, Func_3f132
	jr asm_3e72b
asm_3e70b: ; 3e70b (f:670b)
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	res 4, [hl]
	res 6, [hl]
	ld a, [W_ENEMYMOVENUM] ; $cfcc
	ld [$d0b5], a
	ld a, $2c
	ld [$d0b7], a
	ld a, MOVE_NAME
	ld [W_LISTTYPE], a
	call GetName
	ld de, $cd6d
	call CopyStringToCF4B
asm_3e72b: ; 3e72b (f:672b)
	xor a
	ld [$cced], a
	call Func_3daf5
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	ld hl, EffectsArray1 ; $4000
	ld de, $1
	call IsInArray
	jp c, Func_3f132
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	ld hl, EffectsArray5B ; $4049
	ld de, $1
	call IsInArray
	call c, Func_3f132
asm_3e750: ; 3e750 (f:6750)
	call Func_3ec81
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	ld hl, EffectsArray2 ; $4011
	ld de, $1
	call IsInArray
	jp c, Func_3e77f
	call CriticalHitTest
	call HandleCounterMove
	jr z, asm_3e782
	call Func_3ec81
	call Func_3de75
	call Func_3ec81
	call MoreCalculateDamage
	jp z, Func_3e7d1
	call AdjustDamageForMoveType
	call Func_3e687

; known jump sources: 3e75f (f:675f)
Func_3e77f: ; 3e77f (f:677f)
	call MoveHitTest
asm_3e782: ; 3e782 (f:6782)
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	jr z, .asm_3e791
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	cp $7
	jr z, asm_3e7a0
	jr Func_3e7d1
.asm_3e791
	call Func_3ec81

; known jump sources: 3e864 (f:6864)
Func_3e794: ; 3e794 (f:6794)
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	and a
	ld a, $1
	jr z, asm_3e7a4
	ld a, $2
	jr asm_3e7a4
asm_3e7a0: ; 3e7a0 (f:67a0)
	call Func_3ec81
	xor a
asm_3e7a4: ; 3e7a4 (f:67a4)
	push af
	ld a, [W_ENEMYBATTSTATUS2] ; $d068
	bit 4, a
	ld hl, Func_79747
	ld b, BANK(Func_79747)
	call nz, Bankswitch
	pop af
	ld [$cc5b], a
	ld a, [W_ENEMYMOVENUM] ; $cfcc
	call PlayMoveAnimation
	call Func_3eed3
	call Func_3cdec
	ld a, [W_ENEMYBATTSTATUS2] ; $d068
	bit 4, a
	ld hl, Func_79771
	ld b, BANK(Func_79771)
	call nz, Bankswitch
	jr asm_3e7ef

; known jump sources: 3e776 (f:6776), 3e78f (f:678f)
Func_3e7d1: ; 3e7d1 (f:67d1)
	call Func_3ec81
	ld c, $1e
	call DelayFrames
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	cp $2b
	jr z, .asm_3e7e6
	cp $27
	jr z, .asm_3e7e6
	jr asm_3e7ef
.asm_3e7e6
	xor a
	ld [$cc5b], a
	ld a, $a7
	call PlayMoveAnimation
asm_3e7ef: ; 3e7ef (f:67ef)
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	cp $9
	jr nz, .asm_3e7ff
	call MirrorMoveCopyMove
	jp z, Func_3e88c
	jp Func_3e6fc
.asm_3e7ff
	cp $53
	jr nz, .asm_3e809
	call MetronomePickMove
	jp Func_3e6fc
.asm_3e809
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	ld hl, EffectsArray3 ; $4014
	ld de, $1
	call IsInArray
	jp c, Func_3f132
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	jr z, .asm_3e82b
	call Func_3dbe2
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	cp $7
	jr z, .asm_3e83e
	jp Func_3e88c
.asm_3e82b
	call ApplyAttackToPlayerPokemon
	call Func_3dc5c
	ld hl, DisplayEffectiveness
	ld b, BANK(DisplayEffectiveness)
	call Bankswitch ; indirect jump to DisplayEffectiveness (2fb7b (b:7b7b))
	ld a, $1
	ld [$ccf4], a
.asm_3e83e
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	ld hl, EffectsArray4 ; $4030
	ld de, $1
	call IsInArray
	call c, Func_3f132
	ld hl, W_PLAYERMONCURHP ; $d015
	ld a, [hli]
	ld b, [hl]
	or b
	ret z
	call HandleBuildingRage
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	bit 2, [hl]
	jr z, .asm_3e873
	push hl
	ld hl, $d06f
	dec [hl]
	pop hl
	jp nz, Func_3e794
	res 2, [hl]
	ld hl, UnnamedText_3e887 ; $6887
	call PrintText
	xor a
	ld [$cd05], a
.asm_3e873
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	and a
	jr z, Func_3e88c
	ld hl, EffectsArray5 ; $403b
	ld de, $1
	call IsInArray
	call nc, Func_3f132
	jr Func_3e88c
; 3e887 (f:6887)
UnnamedText_3e887: ; 3e887 (f:6887)
	TX_FAR _UnnamedText_3e887
	db $50
; 0x3e887 + 5 bytes

; known jump sources: 3e6c0 (f:66c0), 3e6c6 (f:66c6), 3e7f9 (f:67f9), 3e828 (f:6828), 3e877 (f:6877), 3e885 (f:6885)
Func_3e88c: ; 3e88c (f:688c)
	ld b, $1
	ret

; known jump sources: 3e6ec (f:66ec)
Func_3e88f: ; 3e88f (f:688f)
	ld hl, W_ENEMYMONSTATUS ; $cfe9
	ld a, [hl]
	and $7
	jr z, .asm_3e8bf
	dec a
	ld [W_ENEMYMONSTATUS], a ; $cfe9
	and a
	jr z, .asm_3e8af
	ld hl, FastAsleepText ; $5a3d
	call PrintText
	xor a
	ld [$cc5b], a
	ld a, $bd
	call PlayMoveAnimation
	jr .asm_3e8b5
.asm_3e8af
	ld hl, WokeUpText ; $5a42
	call PrintText
.asm_3e8b5
	xor a
	ld [$ccf2], a
	ld hl, Func_3e88c ; $688c
	jp Func_3eab8
.asm_3e8bf
	bit 5, [hl]
	jr z, .asm_3e8d3
	ld hl, FrozenText ; $5a47
	call PrintText
	xor a
	ld [$ccf2], a
	ld hl, Func_3e88c ; $688c
	jp Func_3eab8
.asm_3e8d3
	ld a, [W_PLAYERBATTSTATUS1] ; $d062
	bit 5, a
	jp z, Func_3e8e7
	ld hl, CantMoveText ; $5a83
	call PrintText
	ld hl, Func_3e88c ; $688c
	jp Func_3eab8

; known jump sources: 3e8d8 (f:68d8)
Func_3e8e7: ; 3e8e7 (f:68e7)
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	bit 3, [hl]
	jp z, Func_3e8fd
	res 3, [hl]
	ld hl, FlinchedText ; $5a51
	call PrintText
	ld hl, Func_3e88c ; $688c
	jp Func_3eab8

; known jump sources: 3e8ec (f:68ec)
Func_3e8fd: ; 3e8fd (f:68fd)
	ld hl, W_ENEMYBATTSTATUS2 ; $d068
	bit 5, [hl]
	jr z, .asm_3e912
	res 5, [hl]
	ld hl, MustRechargeText ; $5a56
	call PrintText
	ld hl, Func_3e88c ; $688c
	jp Func_3eab8
.asm_3e912
	ld hl, W_ENEMYDISABLEDMOVE ; $d072
	ld a, [hl]
	and a
	jr z, .asm_3e929
	dec a
	ld [hl], a
	and $f
	jr nz, .asm_3e929
	ld [hl], a
	ld [$ccef], a
	ld hl, DisabledNoMoreText ; $5a5b
	call PrintText
.asm_3e929
	ld a, [W_ENEMYBATTSTATUS1] ; $d067
	add a
	jp nc, Func_3e9aa
	ld hl, $d070
	dec [hl]
	jr nz, .asm_3e944
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	res 7, [hl]
	ld hl, ConfusedNoMoreText ; $5a6a
	call PrintText
	jp Func_3e9aa
.asm_3e944
	ld hl, IsConfusedText ; $5a60
	call PrintText
	xor a
	ld [$cc5b], a
	ld a, $bf
	call PlayMoveAnimation
	call GenRandomInBattle
	cp $80
	jr c, Func_3e9aa
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	ld a, [hl]
	and $80
	ld [hl], a
	ld hl, HurtItselfText ; $5a65
	call PrintText
	ld hl, W_PLAYERMONDEF
	ld a, [hli]
	push af
	ld a, [hld]
	push af
	ld a, [W_ENEMYMONDEFENSE] ; $cff8
	ld [hli], a
	ld a, [$cff9]
	ld [hl], a
	ld hl, W_ENEMYMOVEEFFECT ; $cfcd
	push hl
	ld a, [hl]
	push af
	xor a
	ld [hli], a
	ld [$d05e], a
	ld a, $28
	ld [hli], a
	xor a
	ld [hl], a
	call Func_3de75
	call MoreCalculateDamage
	pop af
	pop hl
	ld [hl], a
	ld hl, $d028
	pop af
	ld [hld], a
	pop af
	ld [hl], a
	xor a
	ld [$cc5b], a
	ld [H_WHOSETURN], a ; $FF00+$f3
	ld a, $1
	call PlayMoveAnimation
	ld a, $1
	ld [H_WHOSETURN], a ; $FF00+$f3
	call ApplyDamageToEnemyPokemon
	jr asm_3e9d3

; known jump sources: 3e92d (f:692d), 3e941 (f:6941), 3e958 (f:6958)
Func_3e9aa: ; 3e9aa (f:69aa)
	ld a, [$ccef]
	and a
	jr z, .asm_3e9bf
	ld hl, W_ENEMYSELECTEDMOVE ; $ccdd
	cp [hl]
	jr nz, .asm_3e9bf
	call Func_3da88
	ld hl, Func_3e88c ; $688c
	jp Func_3eab8
.asm_3e9bf
	ld hl, W_ENEMYMONSTATUS ; $cfe9
	bit 6, [hl]
	jr z, asm_3e9f6
	call GenRandomInBattle
	cp $3f
	jr nc, asm_3e9f6
	ld hl, FullyParalyzedText ; $5a4c
	call PrintText
asm_3e9d3: ; 3e9d3 (f:69d3)
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	ld a, [hl]
	and $cc
	ld [hl], a
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
	cp $2b
	jr z, .asm_3e9e7
	cp $27
	jr z, .asm_3e9e7
	jr .asm_3e9f0
.asm_3e9e7
	xor a
	ld [$cc5b], a
	ld a, $a7
	call PlayMoveAnimation
.asm_3e9f0
	ld hl, Func_3e88c ; $688c
	jp Func_3eab8
asm_3e9f6: ; 3e9f6 (f:69f6)
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	bit 0, [hl]
	jr z, .asm_3ea54
	xor a
	ld [W_ENEMYMOVENUM], a ; $cfcc
	ld hl, W_DAMAGE ; $d0d7
	ld a, [hli]
	ld b, a
	ld c, [hl]
	ld hl, $cd06
	ld a, [hl]
	add c
	ld [hld], a
	ld a, [hl]
	adc b
	ld [hl], a
	ld hl, $d06f
	dec [hl]
	jr z, .asm_3ea1c
	ld hl, Func_3e88c ; $688c
	jp Func_3eab8
.asm_3ea1c
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	res 0, [hl]
	ld hl, UnleashedEnergyText ; $5a74
	call PrintText
	ld a, $1
	ld [W_ENEMYMOVEPOWER], a ; $cfce
	ld hl, $cd06
	ld a, [hld]
	add a
	ld b, a
	ld [$d0d8], a
	ld a, [hl]
	rl a
	ld [W_DAMAGE], a ; $d0d7
	or b
	jr nz, .asm_3ea43
	ld a, $1
	ld [W_MOVEMISSED], a ; $d05f
.asm_3ea43
	xor a
	ld [hli], a
	ld [hl], a
	ld a, $75
	ld [W_ENEMYMOVENUM], a ; $cfcc
	call Func_3ec81
	ld hl, asm_3e782 ; $6782
	jp Func_3eab8
.asm_3ea54
	bit 1, [hl]
	jr z, .asm_3ea83
	ld a, $25
	ld [W_ENEMYMOVENUM], a ; $cfcc
	ld hl, ThrashingAboutText ; $5a79
	call PrintText
	ld hl, $d06f
	dec [hl]
	ld hl, asm_3e750 ; $6750
	jp nz, Func_3eab8
	push hl
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	res 1, [hl]
	set 7, [hl]
	call GenRandomInBattle
	and $3
	inc a
	inc a
	ld [$d070], a
	pop hl
	jp Func_3eab8
.asm_3ea83
	bit 5, [hl]
	jp z, Func_3ea9b
	ld hl, AttackContinuesText ; $5a7e
	call PrintText
	ld hl, $d06f
	dec [hl]
	ld hl, Func_3e794 ; $6794
	jp nz, Func_3eab8
	jp Func_3eab8

; known jump sources: 3ea85 (f:6a85)
Func_3ea9b: ; 3ea9b (f:6a9b)
	ld a, [W_ENEMYBATTSTATUS2] ; $d068
	bit 6, a
	jp z, Func_3eaba
	ld a, $63
	ld [$d11e], a
	call GetMoveName
	call CopyStringToCF4B
	xor a
	ld [W_ENEMYMOVEEFFECT], a ; $cfcd
	ld hl, asm_3e72b ; $672b
	jp Func_3eab8

; known jump sources: 3e8bc (f:68bc), 3e8d0 (f:68d0), 3e8e4 (f:68e4), 3e8fa (f:68fa), 3e90f (f:690f), 3e9bc (f:69bc), 3e9f3 (f:69f3), 3ea19 (f:6a19), 3ea51 (f:6a51), 3ea6a (f:6a6a), 3ea80 (f:6a80), 3ea95 (f:6a95), 3ea98 (f:6a98), 3eab5 (f:6ab5)
Func_3eab8: ; 3eab8 (f:6ab8)
	xor a
	ret

; known jump sources: 3eaa0 (f:6aa0)
Func_3eaba: ; 3eaba (f:6aba)
	ld a, $1
	and a
	ret

; known jump sources: 3d543 (f:5543), 3d68a (f:568a), 3ddad (f:5dad), 3e6f9 (f:66f9)
GetCurrentMove: ; 3eabe (f:6abe)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jp z, .player
	ld de, W_ENEMYMOVENUM ; $cfcc
	ld a, [W_ENEMYSELECTEDMOVE] ; $ccdd
	jr .selected
.player
	ld de, W_PLAYERMOVENUM ; $cfd2
	ld a, [W_FLAGS_D733]
	bit 0, a
	ld a, [$ccd9]
	jr nz, .selected
	ld a, [W_PLAYERSELECTEDMOVE] ; $ccdc
.selected
	ld [$d0b5], a
	dec a
	ld hl, Moves ; $4000
	ld bc, $6
	call AddNTimes
	ld a, BANK(Moves)
	call FarCopyData
	ld a, $2c
	ld [$d0b7], a
	ld a, $2
	ld [W_LISTTYPE], a ; list type 2 = move name
	call GetName
	ld de, $cd6d
	jp CopyStringToCF4B

; known jump sources: d893 (3:5893), 3c9aa (f:49aa), 3ef90 (f:6f90), 4fdc9 (13:7dc9), 58df0 (16:4df0), 58e18 (16:4e18)
Func_3eb01: ; 3eb01 (f:6b01)
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jp z, Func_3cc13
	ld a, [W_ENEMYMONID]
	ld [$cfe5], a
	ld [$d0b5], a
	call GetMonHeader
	ld a, [W_ENEMYBATTSTATUS3] ; $d069
	bit 3, a
	ld hl, $cceb
	ld a, [hli]
	ld b, [hl]
	jr nz, .asm_3eb33
	ld a, [W_ISINBATTLE] ; $d057
	cp $2
	ld a, $98
	ld b, $88
	jr z, .asm_3eb33
	call GenRandomInBattle
	ld b, a
	call GenRandomInBattle
.asm_3eb33
	ld hl, $cff1
	ld [hli], a
	ld [hl], b
	ld de, W_ENEMYMONLEVEL ; $cff3
	ld a, [W_CURENEMYLVL] ; $d127
	ld [de], a
	inc de
	ld b, $0
	ld hl, W_ENEMYMONCURHP ; $cfe6
	push hl
	call CalcStats
	pop hl
	ld a, [W_ISINBATTLE] ; $d057
	cp $2
	jr z, .asm_3eb65
	ld a, [W_ENEMYBATTSTATUS3] ; $d069
	bit 3, a
	jr nz, .asm_3eb86
	ld a, [W_ENEMYMONMAXHP] ; $cff4
	ld [hli], a
	ld a, [W_ENEMYMONMAXHP+1]
	ld [hli], a
	xor a
	inc hl
	ld [hl], a
	jr .asm_3eb86
.asm_3eb65
	ld hl, W_ENEMYMON1HP ; $d8a5 (aliases: W_WATERMONS)
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld bc, $2c
	call AddNTimes
	ld a, [hli]
	ld [W_ENEMYMONCURHP], a ; $cfe6
	ld a, [hli]
	ld [$cfe7], a
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld [W_ENEMYMONNUMBER], a ; $cfe8
	inc hl
	ld a, [hl]
	ld [W_ENEMYMONSTATUS], a ; $cfe9
	jr .asm_3eb86
.asm_3eb86
	ld hl, W_MONHTYPES
	ld de, W_ENEMYMONTYPES ; $cfea
	ld a, [hli]            ; copy type 1
	ld [de], a
	inc de
	ld a, [hli]            ; copy type 2
	ld [de], a
	inc de
	ld a, [hli]            ; copy catch rate
	ld [de], a
	inc de
	ld a, [W_ISINBATTLE] ; $d057
	cp $2
	jr nz, .asm_3ebb0
	ld hl, $d8ac
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld bc, $2c
	call AddNTimes
	ld bc, $4
	call CopyData
	jr .asm_3ebca
.asm_3ebb0
	ld hl, W_MONHMOVES
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hl]
	ld [de], a
	dec de
	dec de
	dec de
	xor a
	ld [$cee9], a
	ld a, $3e
	call Predef ; indirect jump to WriteMonMoves (3afb8 (e:6fb8))
.asm_3ebca
	ld hl, W_ENEMYMONMOVES
	ld de, $cffd
	ld a, $5e
	call Predef ; indirect jump to LoadMovePPs (f473 (3:7473))
	ld hl, W_MONHBASESTATS
	ld de, $d002
	ld b, $5
.asm_3ebdd
	ld a, [hli]
	ld [de], a
	inc de
	dec b
	jr nz, .asm_3ebdd
	ld hl, W_MONHCATCHRATE
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hl]     ; base exp
	ld [de], a
	ld a, [W_ENEMYMONID]
	ld [$d11e], a
	call GetMonName
	ld hl, $cd6d
	ld de, W_ENEMYMONNAME
	ld bc, $b
	call CopyData
	ld a, [W_ENEMYMONID]
	ld [$d11e], a
	ld a, $3a
	call Predef ; indirect jump to IndexToPokedex (41010 (10:5010))
	ld a, [$d11e]
	dec a
	ld c, a
	ld b, $1
	ld hl, W_SEENPOKEMON ; $d30a
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	ld hl, W_ENEMYMONLEVEL ; $cff3
	ld de, $cd23
	ld bc, $b
	call CopyData
	ld a, $7
	ld b, $8
	ld hl, W_ENEMYMONATTACKMOD ; $cd2e
.asm_3ec2d
	ld [hli], a
	dec b
	jr nz, .asm_3ec2d
	ret

; known jump sources: 3ef66 (f:6f66), 3ef93 (f:6f93)
Func_3ec32: ; 3ec32 (f:6c32)
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr nz, .asm_3ec4d
	xor a
	ld [W_MENUJOYPADPOLLCOUNT], a ; $cc34
	ld hl, Func_372d6
	ld b, BANK(Func_372d6)
	call Bankswitch ; indirect jump to Func_372d6 (372d6 (d:72d6))
	ld a, $1
	ld [$cfcb], a
	call ClearScreen
.asm_3ec4d
	call DelayFrame
	ld a, $30
	call Predef ; indirect jump to Func_7096d (7096d (1c:496d))
	ld hl, Func_3ee58
	ld b, BANK(Func_3ee58)
	call Bankswitch ; indirect jump to Func_3ee58 (3ee58 (f:6e58))
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, $ff
	ld [$cfcb], a
	call CleanLCD_OAM
	call ClearScreen
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld [$FF00+$b0], a
	ld [rWY], a ; $FF00+$4a
	ld [$FF00+$d7], a
	ld hl, $d060
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld [W_PLAYERDISABLEDMOVE], a ; $d06d
	ret

; known jump sources: 3e750 (f:6750), 3e76a (f:676a), 3e770 (f:6770), 3e791 (f:6791), 3e7a0 (f:67a0), 3e7d1 (f:67d1), 3ea4b (f:6a4b)
Func_3ec81: ; 3ec81 (f:6c81)
	push bc
	ld a, [W_PLAYERMONLEVEL] ; $d022
	ld b, a
	ld a, [W_ENEMYMONLEVEL] ; $cff3
	ld [W_PLAYERMONLEVEL], a ; $d022
	ld a, b
	ld [W_ENEMYMONLEVEL], a ; $cff3
	pop bc
	ret

; known jump sources: 3c04c (f:404c)
Func_3ec92: ; 3ec92 (f:6c92)
	ld a, [W_BATTLETYPE] ; $d05a
	dec a
	ld de, RedPicBack ; $7e0a
	jr nz, .asm_3ec9e
	ld de, OldManPic ; $7e9a
.asm_3ec9e
	ld a, BANK(RedPicBack)
	call UncompressSpriteFromDE
	ld a, $3
	call Predef ; indirect jump to ScaleSpriteByTwo (2fe40 (b:7e40))
	ld hl, W_OAMBUFFER
	xor a
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld b, $7
	ld e, $a0
.asm_3ecb2
	ld c, $3
	ld d, $38
.asm_3ecb6
	ld [hl], d
	inc hl
	ld [hl], e
	ld a, $8
	add d
	ld d, a
	inc hl
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	ld [hli], a
	inc a
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	inc hl
	dec c
	jr nz, .asm_3ecb6
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	add $4
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld a, $8
	add e
	ld e, a
	dec b
	jr nz, .asm_3ecb2
	ld de, $9310
	call InterlaceMergeSpriteBuffers
	ld a, $a
	ld [$0], a
	xor a
	ld [$4000], a
	ld hl, $8000
	ld de, S_SPRITEBUFFER1
	ld a, [H_LOADEDROMBANK]
	ld b, a
	ld c, $31
	call CopyVideoData
	xor a
	ld [$0], a
	ld a, $31
	ld [$FF00+$e1], a
	FuncCoord 1, 5 ; $c405
	ld hl, Coord
	ld a, $1
	jp Predef ; indirect jump to Func_3f0c6 (3f0c6 (f:70c6))

; known jump sources: dba3 (3:5ba3)
Func_3ed02: ; 3ed02 (f:6d02)
	ld hl, Func_39680
	ld b, BANK(Func_39680)
	call Bankswitch ; indirect jump to Func_39680 (39680 (e:5680))
	ld hl, Func_396a7
	ld b, BANK(Func_396a7)
	jp Bankswitch ; indirect jump to Func_396a7 (396a7 (e:56a7))

; known jump sources: 3c6c6 (f:46c6), 3c84e (f:484e)
Func_3ed12: ; 3ed12 (f:6d12)
	ld hl, Func_396d3
	ld b, BANK(Func_396d3)
	jp Bankswitch ; indirect jump to Func_396d3 (396d3 (e:56d3))

; known jump sources: 3cc01 (f:4c01), 553d9 (15:53d9)
Func_3ed1a: ; 3ed1a (f:6d1a)
	ld a, $1
	jr asm_3ed1f

; known jump sources: 3cc6e (f:4c6e)
Func_3ed1e: ; 3ed1e (f:6d1e)
	xor a
asm_3ed1f: ; 3ed1f (f:6d1f)
	ld [H_WHOSETURN], a ; $FF00+$f3
	call Func_3ed27
	jp Func_3ed64

; known jump sources: 3ed21 (f:6d21), 3f351 (f:7351), 3f3b9 (f:73b9), 3f51a (f:751a), 3f647 (f:7647), 52641 (14:6641)
Func_3ed27: ; 3ed27 (f:6d27)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3ed48
	ld a, [W_PLAYERMONSTATUS] ; $d018
	and $40
	ret z
	ld hl, $d02a
	ld a, [hld]
	ld b, a
	ld a, [hl]
	srl a
	rr b
	srl a
	rr b
	ld [hli], a
	or b
	jr nz, .asm_3ed46
	ld b, $1
.asm_3ed46
	ld [hl], b
	ret
.asm_3ed48
	ld a, [W_ENEMYMONSTATUS] ; $cfe9
	and $40
	ret z
	ld hl, $cffb
	ld a, [hld]
	ld b, a
	ld a, [hl]
	srl a
	rr b
	srl a
	rr b
	ld [hli], a
	or b
	jr nz, .asm_3ed62
	ld b, $1
.asm_3ed62
	ld [hl], b
	ret

; known jump sources: 3ed24 (f:6d24), 3f361 (f:7361), 3f3c4 (f:73c4), 3f51d (f:751d), 3f64a (f:764a)
Func_3ed64: ; 3ed64 (f:6d64)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3ed81
	ld a, [W_PLAYERMONSTATUS] ; $d018
	and $10
	ret z
	ld hl, $d026
	ld a, [hld]
	ld b, a
	ld a, [hl]
	srl a
	rr b
	ld [hli], a
	or b
	jr nz, .asm_3ed7f
	ld b, $1
.asm_3ed7f
	ld [hl], b
	ret
.asm_3ed81
	ld a, [W_ENEMYMONSTATUS] ; $cfe9
	and $10
	ret z
	ld hl, $cff7
	ld a, [hld]
	ld b, a
	ld a, [hl]
	srl a
	rr b
	ld [hli], a
	or b
	jr nz, .asm_3ed97
	ld b, $1
.asm_3ed97
	ld [hl], b
	ret

; known jump sources: 553d1 (15:53d1)
Func_3ed99: ; 3ed99 (f:6d99)
	ld c, $0
.asm_3ed9b
	call Func_3eda5
	inc c
	ld a, c
	cp $4
	jr nz, .asm_3ed9b
	ret

; known jump sources: 3ed9b (f:6d9b)
Func_3eda5: ; 3eda5 (f:6da5)
	push bc
	push bc
	ld a, [$d11e]
	and a
	ld a, c
	ld hl, W_PLAYERMONATK
	ld de, $cd12
	ld bc, W_PLAYERMONATTACKMOD ; $cd1a
	jr z, .asm_3edc0
	ld hl, W_ENEMYMONATTACK
	ld de, $cd26
	ld bc, W_ENEMYMONATTACKMOD ; $cd2e
.asm_3edc0
	add c
	ld c, a
	jr nc, .asm_3edc5
	inc b
.asm_3edc5
	ld a, [bc]
	pop bc
	ld b, a
	push bc
	sla c
	ld b, $0
	add hl, bc
	ld a, c
	add e
	ld e, a
	jr nc, .asm_3edd4
	inc d
.asm_3edd4
	pop bc
	push hl
	ld hl, Unknown_3f6cb ; $76cb
	dec b
	sla b
	ld c, b
	ld b, $0
	add hl, bc
	xor a
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [de]
	ld [$FF00+$97], a
	inc de
	ld a, [de]
	ld [$FF00+$98], a
	ld a, [hli]
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	call Multiply
	ld a, [hl]
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld b, $4
	call Divide
	pop hl
	ld a, [$FF00+$98]
	sub $e7
	ld a, [$FF00+$97]
	sbc $3
	jp c, Func_3ee0c
	ld a, $3
	ld [$FF00+$97], a
	ld a, $e7
	ld [$FF00+$98], a

; known jump sources: 3ee01 (f:6e01)
Func_3ee0c: ; 3ee0c (f:6e0c)
	ld a, [$FF00+$97]
	ld [hli], a
	ld b, a
	ld a, [$FF00+$98]
	ld [hl], a
	or b
	jr nz, .asm_3ee17
	inc [hl]
.asm_3ee17
	pop bc
	ret

; known jump sources: 3cc04 (f:4c04), 3f511 (f:7511), 3f63e (f:763e), 553e1 (15:53e1)
Func_3ee19: ; 3ee19 (f:6e19)
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	ret z
	ld a, [W_OBTAINEDBADGES] ; $d356
	ld b, a
	ld hl, W_PLAYERMONATK
	ld c, $4
.asm_3ee28
	srl b
	call c, Func_3ee35
	inc hl
	inc hl
	srl b
	dec c
	jr nz, .asm_3ee28
	ret

; known jump sources: 3ee2a (f:6e2a)
Func_3ee35: ; 3ee35 (f:6e35)
	ld a, [hli]
	ld d, a
	ld e, [hl]
	srl d
	rr e
	srl d
	rr e
	srl d
	rr e
	ld a, [hl]
	add e
	ld [hld], a
	ld a, [hl]
	adc d
	ld [hli], a
	ld a, [hld]
	sub $e7
	ld a, [hl]
	sbc $3
	ret c
	ld a, $3
	ld [hli], a
	ld a, $e7
	ld [hld], a
	ret

; known jump sources: 3c066 (f:4066), 3ec5a (f:6c5a)
Func_3ee58: ; 3ee58 (f:6e58)
	call LoadHpBarAndStatusTilePatterns

; known jump sources: 665b (1:665b), 3c822 (f:4822), 3ca20 (f:4a20), 3d072 (f:5072), 3d0f6 (f:50f6), 3d1ae (f:51ae)
Func_3ee5b: ; 3ee5b (f:6e5b)
	ld a, [rLCDC] ; $FF00+$40
	add a
	jr c, .asm_3ee7c
	ld hl, BattleHudTiles1 ; $6080
	ld de, $96d0
	ld bc, $18
	ld a, BANK(BattleHudTiles1)
	call FarCopyDataDouble
	ld hl, BattleHudTiles2 ; $6098
	ld de, $9730
	ld bc, $30
	ld a, BANK(BattleHudTiles2)
	jp FarCopyDataDouble
.asm_3ee7c
	ld de, BattleHudTiles1 ; $6080
	ld hl, $96d0
	ld bc, (BANK(BattleHudTiles1) << 8) + $03
	call CopyVideoDataDouble
	ld de, BattleHudTiles2 ; $6098
	ld hl, $9730
	ld bc, (BANK(BattleHudTiles2) << 8) + $06
	jp CopyVideoDataDouble

; known jump sources: 3c5f7 (f:45f7), 3c79b (f:479b), 3c952 (f:4952), 3ccf4 (f:4cf4), 3cebf (f:4ebf), 553f1 (15:53f1)
Func_3ee94: ; 3ee94 (f:6e94)
	ld hl, Unknown_3ee9a ; $6e9a
	jp PrintText

Unknown_3ee9a: ; 3ee9a (f:6e9a)
INCBIN "baserom.gbc",$3ee9a,$3ee9b - $3ee9a

; generates a random number unless in link battle
; stores random number in A
GenRandomInBattle: ; 3ee9b (f:6e9b)
	ld a, [W_ISLINKBATTLE]
	cp $4
	jp nz, GenRandom
	push hl
	push bc
	ld a, [$ccde]
	ld c, a
	ld b, $0
	ld hl, $d148
	add hl, bc
	inc a
	ld [$ccde], a
	cp $9
	ld a, [hl]
	pop bc
	pop hl
	ret c
	push hl
	push bc
	push af
	xor a
	ld [$ccde], a
	ld hl, $d148
	ld b, $9
.asm_3eec5
	ld a, [hl]
	ld c, a
	add a
	add a
	add c
	inc a
	ld [hli], a
	dec b
	jr nz, .asm_3eec5 ; 0x3eecd $f6
	pop af
	pop bc
	pop hl
	ret
; 0x3eed3

; known jump sources: 3d736 (f:5736), 3e7bc (f:67bc)
Func_3eed3: ; 3eed3 (f:6ed3)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld hl, W_ENEMYMONTYPE1 ; $cfea (aliases: W_ENEMYMONTYPES)
	ld de, W_ENEMYBATTSTATUS1 ; $d067
	ld a, [W_PLAYERMOVENUM] ; $cfd2
	jr z, .asm_3eeea
	ld hl, W_PLAYERMONTYPE1 ; $d019 (aliases: W_PLAYERMONTYPES)
	ld de, W_ENEMYBATTSTATUS1 ; $d067
	ld a, [W_ENEMYMOVENUM] ; $cfcc
.asm_3eeea
	cp $78
	jr z, .asm_3eef1
	cp $99
	ret nz
.asm_3eef1
	ld a, [de]
	bit 6, a
	ret nz
	ld a, [hli]
	cp $8
	ret z
	ld a, [hl]
	cp $8
	ret z
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	ret nz
	ld a, $5
	ld [$cc5b], a
; 3ef07 (f:6f07)
PlayMoveAnimation: ; 3ef07 (f:6f07)
	ld [$D07C],a
	call Delay3
	PREDEF_JUMP MoveAnimationPredef ; predef 8

; known jump sources: 69b (0:69b)
Func_3ef12: ; 3ef12 (f:6f12)
	ld a, [W_CUROPPONENT] ; $d059
	and a
	jr z, asm_3ef23

; known jump sources: 54fb (1:54fb)
Func_3ef18: ; 3ef18 (f:6f18)
	ld a, [W_CUROPPONENT] ; $d059
	ld [$cf91], a
	ld [W_ENEMYMONID], a
	jr asm_3ef3d
asm_3ef23: ; 3ef23 (f:6f23)
	ld a, [$d732]
	bit 1, a
	jr z, .asm_3ef2f
	ld a, [H_CURRENTPRESSEDBUTTONS]
	bit 1, a
	ret nz
.asm_3ef2f
	ld a, [$d13c]
	and a
	ret nz
	ld hl, Func_13870
	ld b, BANK(Func_13870)
	call Bankswitch ; indirect jump to Func_13870 (13870 (4:7870))
	ret nz
asm_3ef3d: ; 3ef3d (f:6f3d)
	ld a, [$d35d]
	push af
	ld hl, $d358
	ld a, [hl]
	push af
	res 1, [hl]
	ld hl, Func_525af
	ld b, BANK(Func_525af)
	call Bankswitch ; indirect jump to Func_525af (525af (14:65af))
	ld a, [W_ENEMYMONID]
	sub $c8
	jp c, Func_3ef8b
	ld [W_TRAINERCLASS], a ; $d031
	call Func_3566
	ld hl, ReadTrainer
	ld b, BANK(ReadTrainer)
	call Bankswitch ; indirect jump to ReadTrainer (39c53 (e:5c53))
	call Func_3ec32
	call Func_3f04b
	xor a
	ld [W_ENEMYMONID], a
	ld [$FF00+$e1], a
	dec a
	ld [W_AICOUNT], a ; $ccdf
	FuncCoord 12, 0 ; $c3ac
	ld hl, Coord
	ld a, $1
	call Predef ; indirect jump to Func_3f0c6 (3f0c6 (f:70c6))
	ld a, $ff
	ld [W_ENEMYMONNUMBER], a ; $cfe8
	ld a, $2
	ld [W_ISINBATTLE], a ; $d057
	jp Func_3efeb

; known jump sources: 3ef55 (f:6f55)
Func_3ef8b: ; 3ef8b (f:6f8b)
	ld a, $1
	ld [W_ISINBATTLE], a ; $d057
	call Func_3eb01
	call Func_3ec32
	ld a, [W_CUROPPONENT] ; $d059
	cp MAROWAK
	jr z, .isGhost
	call Function583A
	jr nz, .isNoGhost
.isGhost
	ld hl, W_MONHSPRITEDIM
	ld a, $66
	ld [hli], a   ; write sprite dimensions
	ld bc, GhostPic ; $66b5
	ld a, c
	ld [hli], a   ; write  front sprite pointer
	ld [hl], b
	ld hl, W_ENEMYMONNAME  ; set name to "GHOST"
	ld a, "G"
	ld [hli], a
	ld a, "H"
	ld [hli], a
	ld a, "O"
	ld [hli], a
	ld a, "S"
	ld [hli], a
	ld a, "T"
	ld [hli], a
	ld [hl], $50
	ld a, [$cf91]
	push af
	ld a, MON_GHOST
	ld [$cf91], a
	ld de, $9000
	call LoadMonFrontSprite ; load ghost sprite
	pop af
	ld [$cf91], a
	jr .spriteLoaded
.isNoGhost
	ld de, $9000
	call LoadMonFrontSprite ; load mon sprite
.spriteLoaded
	xor a
	ld [W_TRAINERCLASS], a ; $d031
	ld [$FF00+$e1], a
	FuncCoord 12, 0 ; $c3ac
	ld hl, Coord
	ld a, $1
	call Predef ; indirect jump to Func_3f0c6 (3f0c6 (f:70c6))

; known jump sources: 3ef88 (f:6f88)
Func_3efeb: ; 3efeb (f:6feb)
	ld b, $0
	call GoPAL_SET
	call Func_3c04c
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld hl, Unknown_3f04a
	call PrintText
	call SaveScreenTilesToBuffer1
	call ClearScreen
	ld a, $98
	ld [$FF00+$bd], a
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Delay3
	ld a, $9c
	ld [$FF00+$bd], a
	call LoadScreenTilesFromBuffer1
	FuncCoord 9, 7 ; $c435
	ld hl, Coord
	ld bc, $50a
	call ClearScreenArea
	FuncCoord 1, 0 ; $c3a1
	ld hl, Coord
	ld bc, $40a
	call ClearScreenArea
	call CleanLCD_OAM
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	call z, Func_3cdec
	call Func_3c11e
	ld hl, Func_137aa
	ld b, BANK(Func_137aa)
	call Bankswitch ; indirect jump to Func_137aa (137aa (4:77aa))
	pop af
	ld [$d358], a
	pop af
	ld [$d35d], a
	ld a, [$d0d4]
	ld [$FF00+$d7], a
	scf
	ret

Unknown_3f04a: ; 3f04a (f:704a)
	db $50

; known jump sources: 396e1 (e:56e1), 3ef69 (f:6f69)
Func_3f04b: ; 3f04b (f:704b)
	ld a, [$d033]
	ld e, a
	ld a, [$d034]
	ld d, a
	ld a, [W_ISLINKBATTLE] ; $d12b
	and a
	ld a, $13
	jr z, .asm_3f05d
	ld a, $4
.asm_3f05d
	call UncompressSpriteFromDE
	ld de, $9000
	ld a, $77
	ld c, a
	jp LoadUncompressedSpriteData

INCBIN "baserom.gbc",$3f069,$3f073 - $3f069

; known jump sources: 3ca5b (f:4a5b), 3cceb (f:4ceb), 5dc09 (17:5c09)
Func_3f073: ; 3f073 (f:7073)
	ld a, [$cc4f]
	ld h, a
	ld a, [$cc50]
	ld l, a
	ld a, [$FF00+$e1]
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld b, $4c
	ld a, [W_ISINBATTLE] ; $d057
	and a
	jr z, .asm_3f0bc
	add b
	ld [hl], a
	call Delay3
	ld bc, $ffd7
	add hl, bc
	ld a, $1
	ld [$cd6c], a
	ld bc, $303
	ld a, $5
	call Predef ; indirect jump to Func_79aba (79aba (1e:5aba))
	ld c, $4
	call DelayFrames
	ld bc, $ffd7
	add hl, bc
	xor a
	ld [$cd6c], a
	ld bc, $505
	ld a, $5
	call Predef ; indirect jump to Func_79aba (79aba (1e:5aba))
	ld c, $5
	call DelayFrames
	ld bc, $ffd7
	jr .asm_3f0bf
.asm_3f0bc
	ld bc, $ff85
.asm_3f0bf
	add hl, bc
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	add $31
	jr asm_3f0d0

; known jump sources: 62cb (1:62cb), 3c0e1 (f:40e1), 3ecff (f:6cff), 3ef7b (f:6f7b), 3efe8 (f:6fe8)
Func_3f0c6: ; 3f0c6 (f:70c6)
	ld a, [$cc4f]
	ld h, a
	ld a, [$cc50]
	ld l, a
	ld a, [$FF00+$e1]
asm_3f0d0: ; 3f0d0 (f:70d0)
	ld bc, $707
	ld de, $14
	push af
	ld a, [W_SPRITEFLIPPED]
	and a
	jr nz, .asm_3f0ed
	pop af
.asm_3f0de
	push bc
	push hl
.asm_3f0e0
	ld [hl], a
	add hl, de
	inc a
	dec c
	jr nz, .asm_3f0e0
	pop hl
	inc hl
	pop bc
	dec b
	jr nz, .asm_3f0de
	ret
.asm_3f0ed
	push bc
	ld b, $0
	dec c
	add hl, bc
	pop bc
	pop af
.asm_3f0f4
	push bc
	push hl
.asm_3f0f6
	ld [hl], a
	add hl, de
	inc a
	dec c
	jr nz, .asm_3f0f6
	pop hl
	dec hl
	pop bc
	dec b
	jr nz, .asm_3f0f4
	ret

; known jump sources: 3cca9 (f:4ca9), 702a8 (1c:42a8), 797c2 (1e:57c2)
; loads back sprite of mon to $8000
; assumes the corresponding mon header is already loaded
LoadMonBackSprite: ; 3f103 (f:7103)
	ld a, [$cfd9]
	ld [$cf91], a
	FuncCoord 1, 5 ; $c405
	ld hl, Coord
	ld b, $7
	ld c, $8
	call ClearScreenArea
	ld hl,  W_MONHBACKSPRITE - W_MONHEADER
	call UncompressMonSprite
	ld a, $3
	call Predef ; indirect jump to ScaleSpriteByTwo (2fe40 (b:7e40))
	ld de, $9310
	call InterlaceMergeSpriteBuffers ; combine the two buffers to a single 2bpp sprite
	ld hl, $8000
	ld de, $9310
	ld c, (2*SPRITEBUFFERSIZE)/16 ; count of 16-byte chunks to be copied
	ld a, [H_LOADEDROMBANK]
	ld b, a
	jp CopyVideoData

; known jump sources: 3d69f (f:569f), 3d6a4 (f:56a4), 3d6ca (f:56ca), 3d6d9 (f:56d9), 3d790 (f:5790), 3d7c5 (f:57c5), 3d7ff (f:57ff), 3e016 (f:6016), 3e701 (f:6701), 3e706 (f:6706), 3e73e (f:673e), 3e74d (f:674d), 3e815 (f:6815), 3e84a (f:684a), 3e882 (f:6882)
Func_3f132: ; 3f132 (f:7132)
	call JumpMoveEffect
	ld b, $1
	ret
; 3f138 (f:7138)
JumpMoveEffect: ; 3f138 (f:7138)
	ld a, [$ff00+$f3]  ;whose turn?
	and a
	ld a, [W_PLAYERMOVEEFFECT]
	jr z, .next1
	ld a, [W_ENEMYMOVEEFFECT]
.next1
	dec a         ;subtract 1, there is no special effect for 00
	add a         ;x2, 16bit pointers
	ld hl, Unknown_3f150   ; $7150 ;pointer table at 7150
	ld b, 0
	ld c, a
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	jp [hl]       ;jump to special effect handler

Unknown_3f150: ; 3f150 (f:7150)
INCBIN "baserom.gbc",$3f150,$3f1fc - $3f150
	ld de, W_ENEMYMONSTATUS ; $cfe9
	ld bc, W_ENEMYBATTSTATUS2 ; $d068
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jp z, Func_3f20e
	ld de, W_PLAYERMONSTATUS ; $d018
	ld bc, W_PLAYERBATTSTATUS2 ; $d063

; known jump sources: 3f205 (f:7205)
Func_3f20e: ; 3f20e (f:720e)
	ld a, [bc]
	bit 5, a
	res 5, a
	ld [bc], a
	jr nz, .asm_3f231
	ld a, [de]
	ld b, a
	and $7
	jr z, .asm_3f222
	ld hl, UnnamedText_3f24a ; $724a
	jp PrintText
.asm_3f222
	ld a, b
	and a
	jr nz, .asm_3f242
	push de
	call MoveHitTest
	pop de
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	jr nz, .asm_3f242
.asm_3f231
	call GenRandomInBattle
	and $7
	jr z, .asm_3f231
	ld [de], a
	call Func_3fb89
	ld hl, UnnamedText_3f245 ; $7245
	jp PrintText
.asm_3f242
	jp Func_3fb5e
; 3f245 (f:7245)
UnnamedText_3f245: ; 3f245 (f:7245)
	TX_FAR _UnnamedText_3f245
	db $50
; 0x3f245 + 5 bytes

UnnamedText_3f24a: ; 3f24a (f:724a)
	TX_FAR _UnnamedText_3f24a
	db $50
; 0x3f24a + 5 bytes

	ld hl, W_ENEMYMONSTATUS ; $cfe9
	ld de, W_PLAYERMOVEEFFECT ; $cfd3
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f260
	ld hl, W_PLAYERMONSTATUS ; $d018
	ld de, W_ENEMYMOVEEFFECT ; $cfcd
.asm_3f260
	call CheckTargetSubstitute
	jr nz, .asm_3f2d3
	ld a, [hli]
	ld b, a
	and a
	jr nz, .asm_3f2d3
	ld a, [hli]
	cp $3
	jr z, .asm_3f2d3
	ld a, [hld]
	cp $3
	jr z, .asm_3f2d3
	ld a, [de]
	cp $2
	ld b, $34
	jr z, .asm_3f290
	cp $21
	ld b, $67
	jr z, .asm_3f290
	push hl
	push de
	call MoveHitTest
	pop de
	pop hl
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	jr nz, .asm_3f2d7
	jr .asm_3f295
.asm_3f290
	call GenRandomInBattle
	cp b
	ret nc
.asm_3f295
	dec hl
	set 3, [hl]
	push de
	dec de
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld b, $c7
	ld hl, W_PLAYERBATTSTATUS3 ; $d064
	ld a, [de]
	ld de, W_PLAYERTOXICCOUNTER ; $d06c
	jr nz, .asm_3f2b0
	ld b, $a9
	ld hl, W_ENEMYBATTSTATUS3 ; $d069
	ld de, W_ENEMYTOXICCOUNTER ; $d071
.asm_3f2b0
	cp $5c
	jr nz, .asm_3f2bd
	set 0, [hl]
	xor a
	ld [de], a
	ld hl, UnnamedText_3f2e4 ; $72e4
	jr .asm_3f2c0
.asm_3f2bd
	ld hl, UnnamedText_3f2df ; $72df
.asm_3f2c0
	pop de
	ld a, [de]
	cp $42
	jr z, .asm_3f2cd
	ld a, b
	call Func_3fb96
	jp PrintText
.asm_3f2cd
	call Func_3fb89
	jp PrintText
.asm_3f2d3
	ld a, [de]
	cp $42
	ret nz
.asm_3f2d7
	ld c, $32
	call DelayFrames
	jp Func_3fb5e
; 3f2df (f:72df)
UnnamedText_3f2df: ; 3f2df (f:72df)
	TX_FAR _UnnamedText_3f2df
	db $50
; 0x3f2df + 5 bytes

UnnamedText_3f2e4: ; 3f2e4 (f:72e4)
	TX_FAR _UnnamedText_3f2e4
	db $50
; 0x3f2e4 + 5 bytes

	ld hl, Func_783f
	ld b, BANK(Func_783f)
	jp Bankswitch ; indirect jump to Func_783f (783f (1:783f))
	ld hl, W_PLAYERMONCURHP ; $d015
	ld de, W_PLAYERBATTSTATUS2 ; $d063
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f302
	ld hl, W_ENEMYMONCURHP ; $cfe6
	ld de, W_ENEMYBATTSTATUS2 ; $d068
.asm_3f302
	xor a
	ld [hli], a
	ld [hli], a
	inc hl
	ld [hl], a
	ld a, [de]
	res 7, a
	ld [de], a
	ret
; 3f30c (f:730c)
FreezeBurnParalyzeEffect: ; 3f30c (f:730c)
	xor a
	ld [$cc5b], a
	call CheckTargetSubstitute         ;test bit 4 of d063/d068 flags [target has substitute flag]
	ret nz             ;return if they have a substitute, can't effect them
	ld a, [$ff00+$f3]  ;whose turn?
	and a
	jp nz, opponentAttacker
	ld a, [W_ENEMYMONSTATUS]
	and a
	jp nz, CheckDefrost
	;opponent has no existing status
	ld a, [W_PLAYERMOVETYPE]
	ld b, a
	ld a, [W_ENEMYMONTYPE1]
	cp b
	ret z  ;return if they match [can't freeze an ice type etc.]
	ld a, [W_ENEMYMONTYPE2]
	cp b
	ret z  ;return..
	ld a, [W_PLAYERMOVEEFFECT]
	cp a, 7         ;10% status effects are 04, 05, 06 so 07 will set carry for those
	ld b, $1a       ;[1A-1]/100 or [26-1]/256 = 9.8%~ chance
	jr c, .next1  ;branch ahead if this is a 10% chance effect..
	ld b, $4d       ;..or use [4D-1]/100 or [76-1]/256 = 29.7%~ chance
	sub a, $1e      ;subtract $1E to map to equivalent 10% chance effects
.next1
	push af     ;push effect...
	call GenRandomInBattle  ;get random 8bit value for probability test
	cp b        ;success?
	pop bc      ;...pop effect into C
	ret nc      ;do nothing if random value is >= 1A or 4D [no status applied]
	            ;the test passed
	ld a, b     ;what type of effect is this?
	cp a, BURN_SIDE_EFFECT1
	jr z, .burn
	cp a, FREEZE_SIDE_EFFECT
	jr z, .freeze
	ld a, PAR
	ld [W_ENEMYMONSTATUS], a
	call Func_3ed27  ;quarter speed of affected monster
	ld a, $a9
	call Func_3fbb9  ;animation
	jp Func_3fb6e    ;print paralysis text
.burn
	ld a, BRN
	ld [W_ENEMYMONSTATUS], a
	call Func_3ed64
	ld a, $a9
	call Func_3fbb9  ;animation
	ld hl, UnnamedText_3f3d8
	jp PrintText
.freeze
	call Func_3f9cf  ;resets bit 5 of the D063/D068 flags
	ld a, FRZ
	ld [W_ENEMYMONSTATUS], a
	ld a, $a9
	call Func_3fbb9  ;animation
	ld hl, UnnamedText_3f3dd
	jp PrintText
opponentAttacker: ; 3f382 (f:7382)
	ld a, [W_PLAYERMONSTATUS]  ;this appears to the same as above with addresses swapped for opponent
	and a
	jp nz, CheckDefrost
	ld a, [W_ENEMYMOVETYPE]
	ld b, a
	ld a, [W_PLAYERMONTYPE1]
	cp b
	ret z
	ld a, [W_PLAYERMONTYPE2]
	cp b
	ret z
	ld a, [W_ENEMYMOVEEFFECT]
	cp a, 7
	ld b, $1a
	jr c, .next1
	ld b, $4d
	sub a, $1e
.next1
	push af
	call GenRandomInBattle
	cp b
	pop bc
	ret nc
	ld a, b
	cp a, BURN_SIDE_EFFECT1
	jr z, .burn
	cp a, FREEZE_SIDE_EFFECT
	jr z, .freeze
	ld a, PAR
	ld [W_PLAYERMONSTATUS], a
	call Func_3ed27
	jp Func_3fb6e
.burn
	ld a, BRN
	ld [W_PLAYERMONSTATUS], a
	call Func_3ed64
	ld hl, UnnamedText_3f3d8
	jp PrintText
.freeze
	ld a, FRZ
	ld [W_PLAYERMONSTATUS], a
	ld hl, UnnamedText_3f3dd
	jp PrintText

UnnamedText_3f3d8: ; 3f3d8 (f:73d8)
	TX_FAR _UnnamedText_3f3d8
	db $50
; 0x3f3d8 + 5 bytes

UnnamedText_3f3dd: ; 3f3dd (f:73dd)
	TX_FAR _UnnamedText_3f3dd
	db $50
; 0x3f3dd + 5 bytes

CheckDefrost: ; 3f3e2 (f:73e2)
	and a, FRZ			;are they frozen?
	ret z				;return if so
						;not frozen
	ld a, [$ff00+$f3]	;whose turn?
	and a
	jr nz, .opponent
	;player [attacker]
	ld a, [W_PLAYERMOVETYPE]
	sub a, FIRE
	ret nz		;return if it isn't fire
				;type is fire
	ld [W_ENEMYMONSTATUS], a		;set opponent status to 00 ["defrost" a frozen monster]
	ld hl, $d8a8					;status of first opponent monster in their roster
	ld a, [W_ENEMYMONNUMBER]
	ld bc, $002c		;$2C bytes per roster entry
	call AddNTimes
	xor a
	ld [hl], a			;clear status in roster
	ld hl, UnnamedText_3f423
	jr .common
.opponent
	ld a, [W_ENEMYMOVETYPE]		;same as above with addresses swapped
	sub a, $14
	ret nz
	ld [W_PLAYERMONSTATUS], a
	ld hl, $d16f
	ld a, [W_PLAYERMONNUMBER]
	ld bc, $002c
	call AddNTimes
	xor a
	ld [hl], a
	ld hl, UnnamedText_3f423
.common
	jp PrintText

UnnamedText_3f423: ; 3f423 (f:7423)
	TX_FAR _UnnamedText_3f423
	db $50
; 0x3f423 + 5 bytes

; known jump sources: e137 (3:6137), 3a821 (e:6821), 3e2e8 (f:62e8)
Func_3f428: ; 3f428 (f:7428)
	ld hl, W_PLAYERMONATTACKMOD ; $cd1a
	ld de, W_PLAYERMOVEEFFECT ; $cfd3
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f439
	ld hl, W_ENEMYMONATTACKMOD ; $cd2e
	ld de, W_ENEMYMOVEEFFECT ; $cfcd
.asm_3f439
	ld a, [de]
	sub $a
	cp $8
	jr c, .asm_3f442
	sub $28
.asm_3f442
	ld c, a
	ld b, $0
	add hl, bc
	ld b, [hl]
	inc b
	ld a, $d
	cp b
	jp c, Func_3f522
	ld a, [de]
	cp $12
	jr c, .asm_3f45a
	inc b
	ld a, $d
	cp b
	jr nc, .asm_3f45a
	ld b, a
.asm_3f45a
	ld [hl], b
	ld a, c
	cp $4
	jr nc, asm_3f4ca
	push hl
	ld hl, $d026
	ld de, $cd12
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f472
	ld hl, $cff7
	ld de, $cd26
.asm_3f472
	push bc
	sla c
	ld b, $0
	add hl, bc
	ld a, c
	add e
	ld e, a
	jr nc, .asm_3f47e
	inc d
.asm_3f47e
	pop bc
	ld a, [hld]
	sub $e7
	jr nz, .asm_3f48a
	ld a, [hl]
	sbc $3
	jp z, Func_3f520
.asm_3f48a
	push hl
	push bc
	ld hl, Unknown_3f6cb ; $76cb
	dec b
	sla b
	ld c, b
	ld b, $0
	add hl, bc
	pop bc
	xor a
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [de]
	ld [$FF00+$97], a
	inc de
	ld a, [de]
	ld [$FF00+$98], a
	ld a, [hli]
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	call Multiply
	ld a, [hl]
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld b, $4
	call Divide
	pop hl
	ld a, [$FF00+$98]
	sub $e7
	ld a, [$FF00+$97]
	sbc $3
	jp c, Func_3f4c3
	ld a, $3
	ld [$FF00+$97], a
	ld a, $e7
	ld [$FF00+$98], a

; known jump sources: 3f4b8 (f:74b8)
Func_3f4c3: ; 3f4c3 (f:74c3)
	ld a, [$FF00+$97]
	ld [hli], a
	ld a, [$FF00+$98]
	ld [hl], a
	pop hl
asm_3f4ca: ; 3f4ca (f:74ca)
	ld b, c
	inc b
	call Func_3f688
	ld hl, W_PLAYERBATTSTATUS2 ; $d063
	ld de, W_PLAYERMOVENUM ; $cfd2
	ld bc, $ccf7
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f4e6
	ld hl, W_ENEMYBATTSTATUS2 ; $d068
	ld de, W_ENEMYMOVENUM ; $cfcc
	ld bc, $ccf3
.asm_3f4e6
	ld a, [de]
	cp $6b
	jr nz, .asm_3f4f9
	bit 4, [hl]
	push af
	push bc
	ld hl, Func_79747
	ld b, BANK(Func_79747)
	push de
	call nz, Bankswitch
	pop de
.asm_3f4f9
	call Func_3fba8
	ld a, [de]
	cp $6b
	jr nz, .asm_3f50e
	pop bc
	ld a, $1
	ld [bc], a
	ld hl, Func_79771
	ld b, BANK(Func_79771)
	pop af
	call nz, Bankswitch
.asm_3f50e
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	call z, Func_3ee19
	ld hl, Unknown_3f528 ; $7528
	call PrintText
	call Func_3ed27
	jp Func_3ed64

; known jump sources: 3f487 (f:7487)
Func_3f520: ; 3f520 (f:7520)
	pop hl
	dec [hl]

; known jump sources: 3f44b (f:744b)
Func_3f522: ; 3f522 (f:7522)
	ld hl, UnnamedText_3fb3e ; $7b3e
	jp PrintText

Unknown_3f528: ; 3f528 (f:7528)
INCBIN "baserom.gbc",$3f528,$3f52d - $3f528
	ld hl, Unknown_3f542 ; $7542
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, [W_PLAYERMOVEEFFECT] ; $cfd3
	jr z, .asm_3f53b
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
.asm_3f53b
	cp $12
	ret nc
	ld hl, UnnamedText_3f547 ; $7547
	ret

Unknown_3f542: ; 3f542 (f:7542)
INCBIN "baserom.gbc",$3f542,$3f547 - $3f542

UnnamedText_3f547: ; 3f547 (f:7547)
	TX_FAR _UnnamedText_3f547
	db $50
; 0x3f547 + 5 bytes

	ld hl, W_ENEMYMONATTACKMOD ; $cd2e
	ld de, W_PLAYERMOVEEFFECT ; $cfd3
	ld bc, W_ENEMYBATTSTATUS1 ; $d067
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f572
	ld hl, W_PLAYERMONATTACKMOD ; $cd1a
	ld de, W_ENEMYMOVEEFFECT ; $cfcd
	ld bc, W_PLAYERBATTSTATUS1 ; $d062
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr z, .asm_3f572
	call GenRandomInBattle
	cp $40
	jp c, Func_3f65a
.asm_3f572
	call CheckTargetSubstitute
	jp nz, Func_3f65a
	ld a, [de]
	cp $44
	jr c, .asm_3f58a
	call GenRandomInBattle
	cp $55
	jp nc, Func_3f650
	ld a, [de]
	sub $44
	jr .asm_3f5a9
.asm_3f58a
	push hl
	push de
	push bc
	call MoveHitTest
	pop bc
	pop de
	pop hl
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	jp nz, Func_3f65a
	ld a, [bc]
	bit 6, a
	jp nz, Func_3f65a
	ld a, [de]
	sub $12
	cp $8
	jr c, .asm_3f5a9
	sub $28
.asm_3f5a9
	ld c, a
	ld b, $0
	add hl, bc
	ld b, [hl]
	dec b
	jp z, Func_3f650
	ld a, [de]
	cp $24
	jr c, .asm_3f5bf
	cp $44
	jr nc, .asm_3f5bf
	dec b
	jr nz, .asm_3f5bf
	inc b
.asm_3f5bf
	ld [hl], b
	ld a, c
	cp $4
	jr nc, asm_3f62c
	push hl
	push de
	ld hl, $cff7
	ld de, $cd26
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f5d8
	ld hl, $d026
	ld de, $cd12
.asm_3f5d8
	push bc
	sla c
	ld b, $0
	add hl, bc
	ld a, c
	add e
	ld e, a
	jr nc, .asm_3f5e4
	inc d
.asm_3f5e4
	pop bc
	ld a, [hld]
	sub $1
	jr nz, .asm_3f5ef
	ld a, [hl]
	and a
	jp z, Func_3f64d
.asm_3f5ef
	push hl
	push bc
	ld hl, Unknown_3f6cb ; $76cb
	dec b
	sla b
	ld c, b
	ld b, $0
	add hl, bc
	pop bc
	xor a
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [de]
	ld [$FF00+$97], a
	inc de
	ld a, [de]
	ld [$FF00+$98], a
	ld a, [hli]
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	call Multiply
	ld a, [hl]
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld b, $4
	call Divide
	pop hl
	ld a, [$FF00+$98]
	ld b, a
	ld a, [$FF00+$97]
	or b
	jp nz, Func_3f624
	ld [$FF00+$97], a
	ld a, $1
	ld [$FF00+$98], a

; known jump sources: 3f61b (f:761b)
Func_3f624: ; 3f624 (f:7624)
	ld a, [$FF00+$97]
	ld [hli], a
	ld a, [$FF00+$98]
	ld [hl], a
	pop de
	pop hl
asm_3f62c: ; 3f62c (f:762c)
	ld b, c
	inc b
	push de
	call Func_3f688
	pop de
	ld a, [de]
	cp $44
	jr nc, .asm_3f63b
	call Func_3fb89
.asm_3f63b
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	call nz, Func_3ee19
	ld hl, Unknown_3f661 ; $7661
	call PrintText
	call Func_3ed27
	jp Func_3ed64

; known jump sources: 3f5ec (f:75ec)
Func_3f64d: ; 3f64d (f:764d)
	pop de
	pop hl
	inc [hl]

; known jump sources: 3f582 (f:7582), 3f5af (f:75af)
Func_3f650: ; 3f650 (f:7650)
	ld a, [de]
	cp $44
	ret nc
	ld hl, UnnamedText_3fb3e ; $7b3e
	jp PrintText

; known jump sources: 3f56f (f:756f), 3f575 (f:7575), 3f597 (f:7597), 3f59d (f:759d)
Func_3f65a: ; 3f65a (f:765a)
	ld a, [de]
	cp $44
	ret nc
	jp Func_3fb4e

Unknown_3f661: ; 3f661 (f:7661)
INCBIN "baserom.gbc",$3f661,$3f666 - $3f661
	ld hl, UnnamedText_3f683 ; $7683
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, [W_PLAYERMOVEEFFECT] ; $cfd3
	jr z, .asm_3f674
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
.asm_3f674
	cp $1a
	ret c
	cp $44
	ret nc
	ld hl, Unknown_3f67e ; $767e
	ret

Unknown_3f67e: ; 3f67e (f:767e)
INCBIN "baserom.gbc",$3f67e,$3f683 - $3f67e

UnnamedText_3f683: ; 3f683 (f:7683)
	TX_FAR _UnnamedText_3f683
	db $50
; 0x3f683 + 5 bytes

; known jump sources: 3f4cc (f:74cc), 3f62f (f:762f)
Func_3f688: ; 3f688 (f:7688)
	ld hl, Unknown_3f69f ; $769f
	ld c, $50
.asm_3f68d
	dec b
	jr z, .asm_3f696
.asm_3f690
	ld a, [hli]
	cp c
	jr z, .asm_3f68d
	jr .asm_3f690
.asm_3f696
	ld de, $cf4b
	ld bc, $a
	jp CopyData

Unknown_3f69f: ; 3f69f (f:769f)
INCBIN "baserom.gbc",$3f69f,$3f6cb - $3f69f

Unknown_3f6cb: ; 3f6cb (f:76cb)
INCBIN "baserom.gbc",$3f6cb,$3f717 - $3f6cb
	ld hl, W_PLAYERBATTSTATUS1 ; $d062
	ld de, $d06a
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f728
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	ld de, $d06f
.asm_3f728
	set 1, [hl]
	call GenRandomInBattle
	and $1
	inc a
	inc a
	ld [de], a
	ld a, [H_WHOSETURN] ; $FF00+$f3
	add $b0
	jp Func_3fb96
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr nz, .asm_3f791
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	jr nz, .asm_3f77e
	ld a, [W_CURENEMYLVL] ; $d127
	ld b, a
	ld a, [W_PLAYERMONLEVEL] ; $d022
	cp b
	jr nc, .asm_3f76e
	add b
	ld c, a
	inc c
.asm_3f751
	call GenRandomInBattle
	cp c
	jr nc, .asm_3f751
	srl b
	srl b
	cp b
	jr nc, .asm_3f76e
	ld c, $32
	call DelayFrames
	ld a, [W_PLAYERMOVENUM] ; $cfd2
	cp $64
	jp nz, Func_3fb5e
	jp Func_3fb53
.asm_3f76e
	call ReadPlayerMonCurHPAndStatus
	xor a
	ld [$cc5b], a
	inc a
	ld [$d078], a
	ld a, [W_PLAYERMOVENUM] ; $cfd2
	jr .asm_3f7e4
.asm_3f77e
	ld c, $32
	call DelayFrames
	ld hl, UnnamedText_3fb69 ; $7b69
	ld a, [W_PLAYERMOVENUM] ; $cfd2
	cp $64
	jp nz, PrintText
	jp Func_3fb53
.asm_3f791
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	jr nz, .asm_3f7d1
	ld a, [W_PLAYERMONLEVEL] ; $d022
	ld b, a
	ld a, [W_CURENEMYLVL] ; $d127
	cp b
	jr nc, .asm_3f7c1
	add b
	ld c, a
	inc c
.asm_3f7a4
	call GenRandomInBattle
	cp c
	jr nc, .asm_3f7a4
	srl b
	srl b
	cp b
	jr nc, .asm_3f7c1
	ld c, $32
	call DelayFrames
	ld a, [W_ENEMYMOVENUM] ; $cfcc
	cp $64
	jp nz, Func_3fb5e
	jp Func_3fb53
.asm_3f7c1
	call ReadPlayerMonCurHPAndStatus
	xor a
	ld [$cc5b], a
	inc a
	ld [$d078], a
	ld a, [W_ENEMYMOVENUM] ; $cfcc
	jr .asm_3f7e4
.asm_3f7d1
	ld c, $32
	call DelayFrames
	ld hl, UnnamedText_3fb69 ; $7b69
	ld a, [W_ENEMYMOVENUM] ; $cfcc
	cp $64
	jp nz, PrintText
	jp Func_3fb4e
.asm_3f7e4
	push af
	call Func_3fbb9
	ld c, $14
	call DelayFrames
	pop af
	ld hl, UnnamedText_3f802 ; $7802
	cp $64
	jr z, .asm_3f7ff
	ld hl, UnnamedText_3f807 ; $7807
	cp $2e
	jr z, .asm_3f7ff
	ld hl, UnnamedText_3f80c ; $780c
.asm_3f7ff
	jp PrintText
; 3f802 (f:7802)
UnnamedText_3f802: ; 3f802 (f:7802)
	TX_FAR _UnnamedText_3f802
	db $50
; 0x3f802 + 5 bytes

UnnamedText_3f807: ; 3f807 (f:7807)
	TX_FAR _UnnamedText_3f807
	db $50
; 0x3f807 + 5 bytes

UnnamedText_3f80c: ; 3f80c (f:780c)
	TX_FAR _UnnamedText_3f80c
	db $50
; 0x3f80c + 5 bytes

	ld hl, W_PLAYERBATTSTATUS1 ; $d062
	ld de, $d06a
	ld bc, W_NUMHITS ; $d074
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f828
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	ld de, $d06f
	ld bc, $cd05
.asm_3f828
	bit 2, [hl]
	ret nz
	set 2, [hl]
	ld hl, W_PLAYERMOVEEFFECT ; $cfd3
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f838
	ld hl, W_ENEMYMOVEEFFECT ; $cfcd
.asm_3f838
	ld a, [hl]
	cp $4d
	jr z, .asm_3f856
	cp $2c
	ld a, $2
	jr z, .asm_3f853
	call GenRandomInBattle
	and $3
	cp $2
	jr c, .asm_3f851
	call GenRandomInBattle
	and $3
.asm_3f851
	inc a
	inc a
.asm_3f853
	ld [de], a
	ld [bc], a
	ret
.asm_3f856
	ld a, $2
	ld [hl], a
	jr .asm_3f853
	call CheckTargetSubstitute
	ret nz
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	ld de, W_PLAYERMOVEEFFECT ; $cfd3
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f870
	ld hl, W_PLAYERBATTSTATUS1 ; $d062
	ld de, W_ENEMYMOVEEFFECT ; $cfcd
.asm_3f870
	ld a, [de]
	cp $1f
	ld b, $1a
	jr z, .asm_3f879
	ld b, $4d
.asm_3f879
	call GenRandomInBattle
	cp b
	ret nc
	set 3, [hl]
	call Func_3f9cf
	ret
	ld hl, Func_33f57
	ld b, BANK(Func_33f57)
	jp Bankswitch ; indirect jump to Func_33f57 (33f57 (c:7f57))
	ld hl, W_PLAYERBATTSTATUS1 ; $d062
	ld de, W_PLAYERMOVEEFFECT ; $cfd3
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld b, $ae
	jr z, .asm_3f8a1
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	ld de, W_ENEMYMOVEEFFECT ; $cfcd
	ld b, $af
.asm_3f8a1
	set 4, [hl]
	ld a, [de]
	dec de
	cp $2b
	jr nz, .asm_3f8ad
	set 6, [hl]
	ld b, $64
.asm_3f8ad
	ld a, [de]
	cp $5b
	jr nz, .asm_3f8b6
	set 6, [hl]
	ld b, $c0
.asm_3f8b6
	xor a
	ld [$cc5b], a
	ld a, b
	call Func_3fbb9
	ld a, [de]
	ld [W_WHICHTRADE], a ; $cd3d
	ld hl, Unknown_3f8c8 ; $78c8
	jp PrintText

Unknown_3f8c8: ; 3f8c8 (f:78c8)
INCBIN "baserom.gbc",$3f8c8,$3f8cd - $3f8c8
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $d
	ld hl, UnnamedText_3f8f9 ; $78f9
	jr z, .asm_3f8f8
	cp $4c
	ld hl, UnnamedText_3f8fe ; $78fe
	jr z, .asm_3f8f8
	cp $82
	ld hl, UnnamedText_3f903 ; $7903
	jr z, .asm_3f8f8
	cp $8f
	ld hl, UnnamedText_3f908 ; $7908
	jr z, .asm_3f8f8
	cp $13
	ld hl, UnnamedText_3f90d ; $790d
	jr z, .asm_3f8f8
	cp $5b
	ld hl, UnnamedText_3f912 ; $7912
.asm_3f8f8
	ret
; 3f8f9 (f:78f9)
UnnamedText_3f8f9: ; 3f8f9 (f:78f9)
	TX_FAR _UnnamedText_3f8f9
	db $50
; 0x3f8f9 + 5 bytes

UnnamedText_3f8fe: ; 3f8fe (f:78fe)
	TX_FAR _UnnamedText_3f8fe
	db $50
; 0x3f8fe + 5 bytes

UnnamedText_3f903: ; 3f903 (f:7903)
	TX_FAR _UnnamedText_3f903
	db $50
; 0x3f903 + 5 bytes

UnnamedText_3f908: ; 3f908 (f:7908)
	TX_FAR _UnnamedText_3f908
	db $50
; 0x3f908 + 5 bytes

UnnamedText_3f90d: ; 3f90d (f:790d)
	TX_FAR _UnnamedText_3f90d
	db $50
; 0x3f90d + 5 bytes

UnnamedText_3f912: ; 3f912 (f:7912)
	TX_FAR _UnnamedText_3f912
	db $50
; 0x3f912 + 5 bytes

	ld hl, W_PLAYERBATTSTATUS1 ; $d062
	ld de, $d06a
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f928
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	ld de, $d06f
.asm_3f928
	bit 5, [hl]
	ret nz
	call Func_3f9cf
	set 5, [hl]
	call GenRandomInBattle
	and $3
	cp $2
	jr c, .asm_3f93e
	call GenRandomInBattle
	and $3
.asm_3f93e
	inc a
	ld [de], a
	ret

INCBIN "baserom.gbc",$3f941,$3f949 - $3f941
	ld hl, Func_27f86
	ld b, BANK(Func_27f86)
	jp Bankswitch ; indirect jump to Func_27f86 (27f86 (9:7f86))
	ld hl, Func_1392c
	ld b, BANK(Func_1392c)
	jp Bankswitch ; indirect jump to Func_1392c (1392c (4:792c))
	call GenRandomInBattle
	cp $19
	ret nc
	jr .asm_3f96f
	call CheckTargetSubstitute
	jr nz, asm_3f9a6
	call MoveHitTest
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	jr nz, asm_3f9a6
.asm_3f96f
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld hl, W_ENEMYBATTSTATUS1 ; $d067
	ld bc, $d070
	ld a, [W_PLAYERMOVEEFFECT] ; $cfd3
	jr z, .asm_3f986
	ld hl, W_PLAYERBATTSTATUS1 ; $d062
	ld bc, $d06b
	ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
.asm_3f986
	bit 7, [hl]
	jr nz, asm_3f9a6
	set 7, [hl]
	push af
	call GenRandomInBattle
	and $3
	inc a
	inc a
	ld [bc], a
	pop af
	cp $4c
	call nz, Func_3fb89
	ld hl, UnnamedText_3f9a1 ; $79a1
	jp PrintText
; 3f9a1 (f:79a1)
UnnamedText_3f9a1: ; 3f9a1 (f:79a1)
	TX_FAR _UnnamedText_3f9a1
	db $50
; 0x3f9a1 + 5 bytes

asm_3f9a6: ; 3f9a6 (f:79a6)
	cp $4c
	ret z
	ld c, $32
	call DelayFrames
	jp Func_3fb4e
	ld hl, Func_52601
	ld b, BANK(Func_52601)
	jp Bankswitch ; indirect jump to Func_52601 (52601 (14:6601))

INCBIN "baserom.gbc",$3f9b9,$3f9c1 - $3f9b9
	ld hl, W_PLAYERBATTSTATUS2 ; $d063
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f9cc
	ld hl, W_ENEMYBATTSTATUS2 ; $d068
.asm_3f9cc
	set 5, [hl]
	ret

; known jump sources: 3f36f (f:736f), 3f880 (f:7880), 3f92b (f:792b)
Func_3f9cf: ; 3f9cf (f:79cf)
	push hl
	ld hl, W_ENEMYBATTSTATUS2 ; $d068
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3f9db
	ld hl, W_PLAYERBATTSTATUS2 ; $d063
.asm_3f9db
	res 5, [hl]
	pop hl
	ret

INCBIN "baserom.gbc",$3f9df,$3fa77 - $3f9df

UnnamedText_3fa77: ; 3fa77 (f:7a77)
	TX_FAR _UnnamedText_3fa77
	db $50
; 0x3fa77 + 5 bytes

	ld hl, Func_2bea9
	ld b, BANK(Func_2bea9)
	jp Bankswitch ; indirect jump to Func_2bea9 (2bea9 (a:7ea9))

INCBIN "baserom.gbc",$3fa84,$3fa8a - $3fa84
	call MoveHitTest
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	jr nz, .asm_3fb06
	ld de, W_ENEMYDISABLEDMOVE ; $d072
	ld hl, W_ENEMYMONMOVES
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_3faa4
	ld de, W_PLAYERDISABLEDMOVE ; $d06d
	ld hl, W_PLAYERMONMOVES
.asm_3faa4
	ld a, [de]
	and a
	jr nz, .asm_3fb06
.asm_3faa8
	push hl
	call GenRandomInBattle
	and $3
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
	pop hl
	and a
	jr z, .asm_3faa8
	ld [$d11e], a
	push hl
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld hl, W_PLAYERMONPP ; $d02d
	jr nz, .asm_3facf
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	pop hl
	jr nz, .asm_3fae1
	push hl
	ld hl, W_ENEMYMONPP ; $cffe
.asm_3facf
	push hl
	ld a, [hli]
	or [hl]
	inc hl
	or [hl]
	inc hl
	or [hl]
	and $3f
	pop hl
	jr z, .asm_3fb05
	add hl, bc
	ld a, [hl]
	pop hl
	and a
	jr z, .asm_3faa8
.asm_3fae1
	call GenRandomInBattle
	and $7
	inc a
	inc c
	swap c
	add c
	ld [de], a
	call Func_3fb89
	ld hl, $ccee
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr nz, .asm_3faf8
	inc hl
.asm_3faf8
	ld a, [$d11e]
	ld [hl], a
	call GetMoveName
	ld hl, UnnamedText_3fb09 ; $7b09
	jp PrintText
.asm_3fb05
	pop hl
.asm_3fb06
	jp Func_3fb53
; 3fb09 (f:7b09)
UnnamedText_3fb09: ; 3fb09 (f:7b09)
	TX_FAR _UnnamedText_3fb09
	db $50
; 0x3fb09 + 5 bytes

INCBIN "baserom.gbc",$3fb0e,$3fb26 - $3fb0e
	ld hl, Func_3b9ec
	ld b, BANK(Func_3b9ec)
	jp Bankswitch ; indirect jump to Func_3b9ec (3b9ec (e:79ec))
	ld hl, Func_3bab1
	ld b, BANK(Func_3bab1)
	jp Bankswitch ; indirect jump to Func_3bab1 (3bab1 (e:7ab1))
	ld hl, Func_3bb97
	ld b, BANK(Func_3bb97)
	jp Bankswitch ; indirect jump to Func_3bb97 (3bb97 (e:7b97))
; 3fb3e (f:7b3e)
UnnamedText_3fb3e: ; 3fb3e (f:7b3e)
	TX_FAR _UnnamedText_3fb3e
	db $50
; 0x3fb3e + 5 bytes

INCBIN "baserom.gbc",$3fb43,$3fb49 - $3fb43

UnnamedText_3fb49: ; 3fb49 (f:7b49)
	TX_FAR _UnnamedText_3fb49
	db $50
; 0x3fb49 + 5 bytes

; known jump sources: 3f65e (f:765e), 3f7e1 (f:77e1), 3f9ae (f:79ae)
Func_3fb4e: ; 3fb4e (f:7b4e)
	ld a, [$ccf4]
	and a
	ret nz

; known jump sources: 27faf (9:7faf), 3bbe3 (e:7be3), 3f76b (f:776b), 3f78e (f:778e), 3f7be (f:77be), 3fb06 (f:7b06)
Func_3fb53: ; 3fb53 (f:7b53)
	ld hl, UnnamedText_3fb59 ; $7b59
	jp PrintText
; 3fb59 (f:7b59)
UnnamedText_3fb59: ; 3fb59 (f:7b59)
	TX_FAR _UnnamedText_3fb59
	db $50
; 0x3fb59 + 5 bytes

; known jump sources: 3f242 (f:7242), 3f2dc (f:72dc), 3f768 (f:7768), 3f7bb (f:77bb), 52663 (14:6663)
Func_3fb5e: ; 3fb5e (f:7b5e)
	ld hl, UnnamedText_3fb64 ; $7b64
	jp PrintText
; 3fb64 (f:7b64)
UnnamedText_3fb64: ; 3fb64 (f:7b64)
	TX_FAR _UnnamedText_3fb64
	db $50
; 0x3fb64 + 5 bytes

UnnamedText_3fb69: ; 3fb69 (f:7b69)
	TX_FAR _UnnamedText_3fb69
	db $50
; 0x3fb69 + 5 bytes

; known jump sources: 3f359 (f:7359), 3f3bc (f:73bc), 52656 (14:6656)
Func_3fb6e: ; 3fb6e (f:7b6e)
	ld hl, UnnamedText_3fb74 ; $7b74
	jp PrintText
; 3fb74 (f:7b74)
UnnamedText_3fb74: ; 3fb74 (f:7b74)
	TX_FAR _UnnamedText_3fb74
	db $50
; 0x3fb74 + 5 bytes

CheckTargetSubstitute: ; 3fb79 (f:7b79)
	push hl
	ld hl, $d068
	ld a, [$ff00+$f3]   ;whose turn?
	and a
	jr z, .next1
	ld hl, $d063
.next1
	bit 4, [hl]         ;test bit 4 in d063/d068 flags
	pop hl
	ret

; known jump sources: 3f239 (f:7239), 3f2cd (f:72cd), 3f638 (f:7638), 3f998 (f:7998), 3faec (f:7aec)
Func_3fb89: ; 3fb89 (f:7b89)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, [W_PLAYERMOVENUM] ; $cfd2
	jr z, .asm_3fb94
	ld a, [W_ENEMYMOVENUM] ; $cfcc
.asm_3fb94
	and a
	ret z

; known jump sources: 3f2c7 (f:72c7), 3f736 (f:7736)
Func_3fb96: ; 3fb96 (f:7b96)
	ld [W_ANIMATIONID], a ; $d07c
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, $6
	jr z, .asm_3fba2
	ld a, $3
.asm_3fba2
	ld [$cc5b], a
	jp Func_3fbbc

; known jump sources: 27f9c (9:7f9c), 2bede (a:7ede), 3f4f9 (f:74f9), 5264e (14:664e)
Func_3fba8: ; 3fba8 (f:7ba8)
	xor a
	ld [$cc5b], a
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, [W_PLAYERMOVENUM] ; $cfd2
	jr z, .asm_3fbb7
	ld a, [W_ENEMYMOVENUM] ; $cfcc
.asm_3fbb7
	and a
	ret z

; known jump sources: 3f356 (f:7356), 3f366 (f:7366), 3f379 (f:7379), 3f7e5 (f:77e5), 3f8bb (f:78bb)
Func_3fbb9: ; 3fbb9 (f:7bb9)
	ld [W_ANIMATIONID], a ; $d07c

; known jump sources: 3fba5 (f:7ba5)
Func_3fbbc: ; 3fbbc (f:7bbc)
	push hl
	push de
	push bc
	ld a, $8
	call Predef ; indirect jump to MoveAnimation (78d5e (1e:4d5e))
	pop bc
	pop de
	pop hl
	ret
; 3fbc8 (f:7bc8)
SECTION "bank10",ROMX,BANK[$10]

DisplayPokedexMenu_: ; 40000 (10:4000)
	call GBPalWhiteOut
	call ClearScreen
	call UpdateSprites ; move sprites
	ld a,[W_LISTSCROLLOFFSET]
	push af
	xor a
	ld [W_CURMENUITEMID],a
	ld [W_LISTSCROLLOFFSET],a
	ld [W_OLDMENUITEMID],a
	inc a
	ld [$d11e],a
	ld [$ffb7],a
.setUpGraphics
	ld b,$08
	call GoPAL_SET
	ld hl,LoadPokedexTilePatterns
	ld b,BANK(LoadPokedexTilePatterns)
	call Bankswitch
.doPokemonListMenu
	ld hl,W_TOPMENUITEMY
	ld a,3
	ld [hli],a ; top menu item Y
	xor a
	ld [hli],a ; top menu item X
	inc a
	ld [$cc37],a
	inc hl
	inc hl
	ld a,6
	ld [hli],a ; max menu item ID
	ld [hl],%00110011 ; menu watched keys (Left, Right, B button, A  button)
	call HandlePokedexListMenu
	jr c,.goToSideMenu ; if the player chose a pokemon from the list
.exitPokedex
	xor a
	ld [$cc37],a
	ld [W_CURMENUITEMID],a
	ld [W_OLDMENUITEMID],a
	ld [$ffb7],a
	ld [$cd3a],a
	ld [$cd3b],a
	pop af
	ld [W_LISTSCROLLOFFSET],a
	call GBPalWhiteOutWithDelay3
	call GoPAL_SET_CF1C
	jp ReloadMapData
.goToSideMenu
	call HandlePokedexSideMenu
	dec b
	jr z,.exitPokedex ; if the player chose Quit
	dec b
	jr z,.doPokemonListMenu ; if pokemon not seen or player pressed B button
	jp .setUpGraphics ; if pokemon data or area was shown

; handles the menu on the lower right in the pokedex screen
; OUTPUT:
; b = reason for exiting menu
; 00: showed pokemon data or area
; 01: the player chose Quit
; 02: the pokemon has not been seen yet or the player pressed the B button
HandlePokedexSideMenu: ; 4006d (10:406d)
	call PlaceUnfilledArrowMenuCursor
	ld a,[W_CURMENUITEMID]
	push af
	ld b,a
	ld a,[W_OLDMENUITEMID]
	push af
	ld a,[W_LISTSCROLLOFFSET]
	push af
	add b
	inc a
	ld [$d11e],a
	ld a,[$d11e]
	push af
	ld a,[$cd3d]
	push af
	ld hl,W_SEENPOKEMON
	call IsPokemonBitSet
	ld b,2
	jr z,.exitSideMenu
	call PokedexToIndex
	ld hl,W_TOPMENUITEMY
	ld a,10
	ld [hli],a ; top menu item Y
	ld a,15
	ld [hli],a ; top menu item X
	xor a
	ld [hli],a ; current menu item ID
	inc hl
	ld a,3
	ld [hli],a ; max menu item ID
	ld [hli],a ; menu watched keys (A button and B button)
	xor a
	ld [hli],a ; old menu item ID
	ld [$cc37],a
.handleMenuInput
	call HandleMenuInput
	bit 1,a ; was the B button pressed?
	ld b,2
	jr nz,.buttonBPressed
	ld a,[W_CURMENUITEMID]
	and a
	jr z,.choseData
	dec a
	jr z,.choseCry
	dec a
	jr z,.choseArea
.choseQuit
	ld b,1
.exitSideMenu
	pop af
	ld [$cd3d],a
	pop af
	ld [$d11e],a
	pop af
	ld [W_LISTSCROLLOFFSET],a
	pop af
	ld [W_OLDMENUITEMID],a
	pop af
	ld [W_CURMENUITEMID],a
	push bc
	FuncCoord 0,3
	ld hl,Coord
	ld de,20
	ld bc,$7f0d ; 13 blank tiles
	call DrawTileLine ; cover up the menu cursor in the pokemon list
	pop bc
	ret
.buttonBPressed
	push bc
	FuncCoord 15,10
	ld hl,Coord
	ld de,20
	ld bc,$7f07 ; 7 blank tiles
	call DrawTileLine ; cover up the menu cursor in the side menu
	pop bc
	jr .exitSideMenu
.choseData
	call ShowPokedexDataInternal
	ld b,0
	jr .exitSideMenu
; play pokemon cry
.choseCry
	ld a,[$d11e]
	call GetCryData ; get cry data
	call PlaySound ; play sound
	jr .handleMenuInput
.choseArea
	ld a,$4a
	call Predef ; display pokemon areas
	ld b,0
	jr .exitSideMenu

; handles the list of pokemon on the left of the pokedex screen
; sets carry flag if player presses A, unsets carry flag if player presses B
HandlePokedexListMenu: ; 40111 (10:4111)
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a
; draw the horizontal line separating the seen and owned amounts from the menu
	FuncCoord 15,8
	ld hl,Coord
	ld a,$7a ; horizontal line tile
	ld [hli],a
	ld [hli],a
	ld [hli],a
	ld [hli],a
	ld [hli],a
	FuncCoord 14,0
	ld hl,Coord
	ld [hl],$71 ; vertical line tile
	FuncCoord 14,1
	ld hl,Coord
	call DrawPokedexVerticalLine
	FuncCoord 14,9
	ld hl,Coord
	call DrawPokedexVerticalLine
	ld hl,W_SEENPOKEMON
	ld b,19
	call CountSetBits
	ld de,$d11e
	FuncCoord 16,3
	ld hl,Coord
	ld bc,$0103
	call PrintNumber ; print number of seen pokemon
	ld hl,W_OWNEDPOKEMON
	ld b,19
	call CountSetBits
	ld de,$d11e
	FuncCoord 16,6
	ld hl,Coord
	ld bc,$0103
	call PrintNumber ; print number of owned pokemon
	FuncCoord 16,2
	ld hl,Coord
	ld de,PokedexSeenText
	call PlaceString
	FuncCoord 16,5
	ld hl,Coord
	ld de,PokedexOwnText
	call PlaceString
	FuncCoord 1,1
	ld hl,Coord
	ld de,PokedexContentsText
	call PlaceString
	FuncCoord 16,10
	ld hl,Coord
	ld de,PokedexMenuItemsText
	call PlaceString
; find the highest pokedex number among the pokemon the player has seen
	ld hl,W_SEENPOKEMON + 18
	ld b,153
.maxSeenPokemonLoop
	ld a,[hld]
	ld c,8
.maxSeenPokemonInnerLoop
	dec b
	sla a
	jr c,.storeMaxSeenPokemon
	dec c
	jr nz,.maxSeenPokemonInnerLoop
	jr .maxSeenPokemonLoop
.storeMaxSeenPokemon
	ld a,b
	ld [$cd3d],a ; max seen pokemon
.loop
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a
	FuncCoord 4,2
	ld hl,Coord
	ld bc,$0e0a
	call ClearScreenArea
	FuncCoord 1,3
	ld hl,Coord
	ld a,[W_LISTSCROLLOFFSET]
	ld [$d11e],a
	ld d,7
	ld a,[$cd3d]
	cp a,7
	jr nc,.printPokemonLoop
	ld d,a
	dec a
	ld [W_MAXMENUITEMID],a
; loop to print pokemon pokedex numbers and names
; if the player has owned the pokemon, it puts a pokeball beside the name
.printPokemonLoop
	ld a,[$d11e]
	inc a
	ld [$d11e],a
	push af
	push de
	push hl
	ld de,-20
	add hl,de
	ld de,$d11e
	ld bc,$8103
	call PrintNumber ; print the pokedex number
	ld de,20
	add hl,de
	dec hl
	push hl
	ld hl,W_OWNEDPOKEMON
	call IsPokemonBitSet
	pop hl
	ld a," "
	jr z,.writeTile
	ld a,$72 ; pokeball tile
.writeTile
	ld [hl],a ; put a pokeball next to pokemon that the player has owned
	push hl
	ld hl,W_SEENPOKEMON
	call IsPokemonBitSet
	jr nz,.getPokemonName ; if the player has seen the pokemon
	ld de,.dashedLine ; print a dashed line in place of the name if the player hasn't seen the pokemon
	jr .skipGettingName
.dashedLine ; for unseen pokemon in the list
	db "----------@"
.getPokemonName
	call PokedexToIndex
	call GetMonName
.skipGettingName
	pop hl
	inc hl
	call PlaceString
	pop hl
	ld bc,2 * 20
	add hl,bc
	pop de
	pop af
	ld [$d11e],a
	dec d
	jr nz,.printPokemonLoop
	ld a,01
	ld [H_AUTOBGTRANSFERENABLED],a
	call Delay3
	call GBPalNormal
	call HandleMenuInput
	bit 1,a ; was the B button pressed?
	jp nz,.buttonBPressed
.checkIfUpPressed
	bit 6,a ; was Up pressed?
	jr z,.checkIfDownPressed
.upPressed ; scroll up one row
	ld a,[W_LISTSCROLLOFFSET]
	and a
	jp z,.loop
	dec a
	ld [W_LISTSCROLLOFFSET],a
	jp .loop
.checkIfDownPressed
	bit 7,a ; was Down pressed?
	jr z,.checkIfRightPressed
.downPressed ; scroll down one row
	ld a,[$cd3d]
	cp a,7
	jp c,.loop
	sub a,7
	ld b,a
	ld a,[W_LISTSCROLLOFFSET]
	cp b
	jp z,.loop
	inc a
	ld [W_LISTSCROLLOFFSET],a
	jp .loop
.checkIfRightPressed
	bit 4,a ; was Right pressed?
	jr z,.checkIfLeftPressed
.rightPressed ; scroll down 7 rows
	ld a,[$cd3d]
	cp a,7
	jp c,.loop
	sub a,6
	ld b,a
	ld a,[W_LISTSCROLLOFFSET]
	add a,7
	ld [W_LISTSCROLLOFFSET],a
	cp b
	jp c,.loop
	dec b
	ld a,b
	ld [W_LISTSCROLLOFFSET],a
	jp .loop
.checkIfLeftPressed ; scroll up 7 rows
	bit 5,a ; was Left pressed?
	jr z,.buttonAPressed
.leftPressed
	ld a,[W_LISTSCROLLOFFSET]
	sub a,7
	ld [W_LISTSCROLLOFFSET],a
	jp nc,.loop
	xor a
	ld [W_LISTSCROLLOFFSET],a
	jp .loop
.buttonAPressed
	scf
	ret
.buttonBPressed
	and a
	ret

DrawPokedexVerticalLine: ; 4028e (10:428e)
	ld c,9 ; height of line
	ld de,20 ; width of screen
	ld a,$71 ; vertical line tile
.loop
	ld [hl],a
	add hl,de
	xor a,1 ; toggle between vertical line tile and box tile
	dec c
	jr nz,.loop
	ret

PokedexSeenText: ; 4029d (10:429d)
	db "SEEN@"

PokedexOwnText: ; 402a2 (10:42a2)
	db "OWN@"

PokedexContentsText: ; 402a6 (10:42a6)
	db "CONTENTS@"

PokedexMenuItemsText: ; 402af (10:42af)
	db "DATA",$4E
	db "CRY",$4E
	db "AREA",$4E
	db "QUIT@"

; tests if a pokemon's bit is set in the seen or owned pokemon bit fields
; INPUT:
; [$d11e] = pokedex number
; hl = address of bit field
IsPokemonBitSet: ; 402c2 (10:42c2)
	ld a,[$d11e]
	dec a
	ld c,a
	ld b,2
	ld a,$10
	call Predef
	ld a,c
	and a
	ret

; function to display pokedex data from outside the pokedex
ShowPokedexData: ; 402d1 (10:42d1)
	call GBPalWhiteOutWithDelay3
	call ClearScreen
	call UpdateSprites
	ld hl, LoadPokedexTilePatterns
	ld b, BANK(LoadPokedexTilePatterns)
	call Bankswitch ; load pokedex tiles

; function to display pokedex data from inside the pokedex
ShowPokedexDataInternal: ; 402e2 (10:42e2)
	ld hl,$d72c
	set 1,[hl]
	ld a,$33 ; 3/7 volume
	ld [$ff24],a
	call GBPalWhiteOut ; zero all palettes
	call ClearScreen
	ld a,[$d11e] ; pokemon ID
	ld [$cf91],a
	push af
	ld b,04
	call GoPAL_SET
	pop af
	ld [$d11e],a
	ld a,[$ffd7]
	push af
	xor a
	ld [$ffd7],a
	FuncCoord 0,0
	ld hl,Coord
	ld de,1
	ld bc,$6414
	call DrawTileLine ; draw top border
	FuncCoord 0,17
	ld hl,Coord
	ld b,$6f
	call DrawTileLine ; draw bottom border
	FuncCoord 0,1
	ld hl,Coord
	ld de,20
	ld bc,$6610
	call DrawTileLine ; draw left border
	FuncCoord 19,1
	ld hl,Coord
	ld b,$67
	call DrawTileLine ; draw right border
	FuncCoord 0,0
	ld a,$63 ; upper left corner tile
	ld [Coord],a
	FuncCoord 19,0
	ld a,$65 ; upper right corner tile
	ld [Coord],a
	FuncCoord 0,17
	ld a,$6c ; lower left corner tile
	ld [Coord],a
	FuncCoord 19,17
	ld a,$6e ; lower right corner tile
	ld [Coord],a
	FuncCoord 0,9
	ld hl,Coord
	ld de,PokedexDataDividerLine
	call PlaceString ; draw horizontal divider line
	FuncCoord 9,6
	ld hl,Coord
	ld de,HeightWeightText
	call PlaceString
	call GetMonName
	FuncCoord 9,2
	ld hl,Coord
	call PlaceString
	ld hl,PokedexEntryPointers
	ld a,[$d11e]
	dec a
	ld e,a
	ld d,0
	add hl,de
	add hl,de
	ld a,[hli]
	ld e,a
	ld d,[hl] ; de = address of pokedex entry
	FuncCoord 9,4
	ld hl,Coord
	call PlaceString ; print species name
	ld h,b
	ld l,c
	push de
	ld a,[$d11e]
	push af
	call IndexToPokedex
	FuncCoord 2,8
	ld hl,Coord
	ld a,$74
	ld [hli],a
	ld a,$f2
	ld [hli],a
	ld de,$d11e
	ld bc,$8103
	call PrintNumber ; print pokedex number
	ld hl,W_OWNEDPOKEMON
	call IsPokemonBitSet
	pop af
	ld [$d11e],a
	ld a,[$cf91]
	ld [$d0b5],a
	pop de
	push af
	push bc
	push de
	push hl
	call Delay3
	call GBPalNormal
	call GetMonHeader ; load pokemon picture location
	FuncCoord 1,1
	ld hl,Coord
	call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture
	ld a,[$cf91]
	call PlayCry ; play pokemon cry
	pop hl
	pop de
	pop bc
	pop af
	ld a,c
	and a
	jp z,.waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description
	inc de ; de = address of feet (height)
	ld a,[de] ; reads feet, but a is overwritten without being used
	FuncCoord 12,6
	ld hl,Coord
	ld bc,$0102
	call PrintNumber ; print feet (height)
	ld a,$60 ; feet symbol tile (one tick)
	ld [hl],a
	inc de
	inc de ; de = address of inches (height)
	FuncCoord 15,6
	ld hl,Coord
	ld bc,$8102
	call PrintNumber ; print inches (height)
	ld a,$61 ; inches symbol tile (two ticks)
	ld [hl],a
; now print the weight (note that weight is stored in tenths of pounds internally)
	inc de
	inc de
	inc de ; de = address of upper byte of weight
	push de
; put weight in big-endian order at $ff8b
	ld hl,$ff8b
	ld a,[hl] ; save existing value of [$ff8b]
	push af
	ld a,[de] ; a = upper byte of weight
	ld [hli],a ; store upper byte of weight in [$ff8b]
	ld a,[hl] ; save existing value of [$ff8c]
	push af
	dec de
	ld a,[de] ; a = lower byte of weight
	ld [hl],a ; store lower byte of weight in [$ff8c]
	FuncCoord 11,8
	ld de,$ff8b
	ld hl,Coord
	ld bc,$0205 ; no leading zeroes, right-aligned, 2 bytes, 5 digits
	call PrintNumber ; print weight
	FuncCoord 14,8
	ld hl,Coord
	ld a,[$ff8c]
	sub a,10
	ld a,[$ff8b]
	sbc a,0
	jr nc,.next
	ld [hl],"0" ; if the weight is less than 10, put a 0 before the decimal point
.next
	inc hl
	ld a,[hli]
	ld [hld],a ; make space for the decimal point by moving the last digit forward one tile
	ld [hl],$f2 ; decimal point tile
	pop af
	ld [$ff8c],a ; restore original value of [$ff8c]
	pop af
	ld [$ff8b],a ; restore original value of [$ff8b]
	pop hl
	inc hl ; hl = address of pokedex description text
	FuncCoord 1,11
	ld bc,Coord
	ld a,2
	ld [$fff4],a
	call TextCommandProcessor ; print pokedex description text
	xor a
	ld [$fff4],a
.waitForButtonPress
	call GetJoypadStateLowSensitivity
	ld a,[$ffb5]
	and a,%00000011 ; A button and B button
	jr z,.waitForButtonPress
	pop af
	ld [$ffd7],a
	call GBPalWhiteOut
	call ClearScreen
	call GoPAL_SET_CF1C
	call LoadTextBoxTilePatterns
	call GBPalNormal
	ld hl,$d72c
	res 1,[hl]
	ld a,$77 ; max volume
	ld [$ff24],a
	ret

HeightWeightText: ; 40448 (10:4448)
	db "HT  ?",$60,"??",$61,$4E,"WT   ???lb@"

; XXX does anything point to this?
Unknown4445D: ; 4045d (10:445d)
	db $54,$50

; horizontal line that divides the pokedex text description from the rest of the data
PokedexDataDividerLine: ; 4045f (10:445f)
	db $68,$69,$6B,$69,$6B
	db $69,$6B,$69,$6B,$6B
	db $6B,$6B,$69,$6B,$69
	db $6B,$69,$6B,$69,$6A
	db $50

; draws a line of tiles
; INPUT:
; b = tile ID
; c = number of tile ID's to write
; de = amount to destination address after each tile (1 for horizontal, 20 for vertical)
; hl = destination address
DrawTileLine: ; 40474 (10:4474)
	push bc
	push de
.loop
	ld [hl],b
	add hl,de
	dec c
	jr nz,.loop
	pop de
	pop bc
	ret

PokedexEntryPointers: ; 4047e (10:447e)
	dw RhydonDexEntry
	dw KangaskhanDexEntry
	dw NidoranMDexEntry
	dw ClefairyDexEntry
	dw SpearowDexEntry
	dw VoltorbDexEntry
	dw NidokingDexEntry
	dw SlowbroDexEntry
	dw IvysaurDexEntry
	dw ExeggutorDexEntry
	dw LickitungDexEntry
	dw ExeggcuteDexEntry
	dw GrimerDexEntry
	dw GengarDexEntry
	dw NidoranFDexEntry
	dw NidoqueenDexEntry
	dw CuboneDexEntry
	dw RhyhornDexEntry
	dw LaprasDexEntry
	dw ArcanineDexEntry
	dw MewDexEntry
	dw GyaradosDexEntry
	dw ShellderDexEntry
	dw TentacoolDexEntry
	dw GastlyDexEntry
	dw ScytherDexEntry
	dw StaryuDexEntry
	dw BlastoiseDexEntry
	dw PinsirDexEntry
	dw TangelaDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw GrowlitheDexEntry
	dw OnixDexEntry
	dw FearowDexEntry
	dw PidgeyDexEntry
	dw SlowpokeDexEntry
	dw KadabraDexEntry
	dw GravelerDexEntry
	dw ChanseyDexEntry
	dw MachokeDexEntry
	dw MrMimeDexEntry
	dw HitmonleeDexEntry
	dw HitmonchanDexEntry
	dw ArbokDexEntry
	dw ParasectDexEntry
	dw PsyduckDexEntry
	dw DrowzeeDexEntry
	dw GolemDexEntry
	dw MissingNoDexEntry
	dw MagmarDexEntry
	dw MissingNoDexEntry
	dw ElectabuzzDexEntry
	dw MagnetonDexEntry
	dw KoffingDexEntry
	dw MissingNoDexEntry
	dw MankeyDexEntry
	dw SeelDexEntry
	dw DiglettDexEntry
	dw TaurosDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw FarfetchdDexEntry
	dw VenonatDexEntry
	dw DragoniteDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw DoduoDexEntry
	dw PoliwagDexEntry
	dw JynxDexEntry
	dw MoltresDexEntry
	dw ArticunoDexEntry
	dw ZapdosDexEntry
	dw DittoDexEntry
	dw MeowthDexEntry
	dw KrabbyDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw VulpixDexEntry
	dw NinetalesDexEntry
	dw PikachuDexEntry
	dw RaichuDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw DratiniDexEntry
	dw DragonairDexEntry
	dw KabutoDexEntry
	dw KabutopsDexEntry
	dw HorseaDexEntry
	dw SeadraDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw SandshrewDexEntry
	dw SandslashDexEntry
	dw OmanyteDexEntry
	dw OmastarDexEntry
	dw JigglypuffDexEntry
	dw WigglytuffDexEntry
	dw EeveeDexEntry
	dw FlareonDexEntry
	dw JolteonDexEntry
	dw VaporeonDexEntry
	dw MachopDexEntry
	dw ZubatDexEntry
	dw EkansDexEntry
	dw ParasDexEntry
	dw PoliwhirlDexEntry
	dw PoliwrathDexEntry
	dw WeedleDexEntry
	dw KakunaDexEntry
	dw BeedrillDexEntry
	dw MissingNoDexEntry
	dw DodrioDexEntry
	dw PrimeapeDexEntry
	dw DugtrioDexEntry
	dw VenomothDexEntry
	dw DewgongDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw CaterpieDexEntry
	dw MetapodDexEntry
	dw ButterfreeDexEntry
	dw MachampDexEntry
	dw MissingNoDexEntry
	dw GolduckDexEntry
	dw HypnoDexEntry
	dw GolbatDexEntry
	dw MewtwoDexEntry
	dw SnorlaxDexEntry
	dw MagikarpDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw MukDexEntry
	dw MissingNoDexEntry
	dw KinglerDexEntry
	dw CloysterDexEntry
	dw MissingNoDexEntry
	dw ElectrodeDexEntry
	dw ClefableDexEntry
	dw WeezingDexEntry
	dw PersianDexEntry
	dw MarowakDexEntry
	dw MissingNoDexEntry
	dw HaunterDexEntry
	dw AbraDexEntry
	dw AlakazamDexEntry
	dw PidgeottoDexEntry
	dw PidgeotDexEntry
	dw StarmieDexEntry
	dw BulbasaurDexEntry
	dw VenusaurDexEntry
	dw TentacruelDexEntry
	dw MissingNoDexEntry
	dw GoldeenDexEntry
	dw SeakingDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw PonytaDexEntry
	dw RapidashDexEntry
	dw RattataDexEntry
	dw RaticateDexEntry
	dw NidorinoDexEntry
	dw NidorinaDexEntry
	dw GeodudeDexEntry
	dw PorygonDexEntry
	dw AerodactylDexEntry
	dw MissingNoDexEntry
	dw MagnemiteDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw CharmanderDexEntry
	dw SquirtleDexEntry
	dw CharmeleonDexEntry
	dw WartortleDexEntry
	dw CharizardDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw MissingNoDexEntry
	dw OddishDexEntry
	dw GloomDexEntry
	dw VileplumeDexEntry
	dw BellsproutDexEntry
	dw WeepinbellDexEntry
	dw VictreebelDexEntry

; string: species name
; height in feet, inches
; weight in pounds
; text entry

RhydonDexEntry: ; 405fa (10:45fa)
	db "DRILL@"
	db 6,3
	dw 2650
	TX_FAR _RhydonDexEntry
	db "@"

KangaskhanDexEntry: ; 40609 (10:4609)
	db "PARENT@"
	db 7,3
	dw 1760
	TX_FAR _KangaskhanDexEntry
	db "@"

NidoranMDexEntry: ; 40619 (10:4619)
	db "POISON PIN@"
	db 1,8
	dw 200
	TX_FAR _NidoranMDexEntry
	db "@"

ClefairyDexEntry: ; 4062d (10:462d)
	db "FAIRY@"
	db 2,0
	dw 170
	TX_FAR _ClefairyDexEntry
	db "@"

SpearowDexEntry: ; 4063c (10:463c)
	db "TINY BIRD@"
	db 1,0
	dw 40
	TX_FAR _SpearowDexEntry
	db "@"

VoltorbDexEntry: ; 4064f (10:464f)
	db "BALL@"
	db 1,8
	dw 230
	TX_FAR _VoltorbDexEntry
	db "@"

NidokingDexEntry: ; 4065d (10:465d)
	db "DRILL@"
	db 4,7
	dw 1370
	TX_FAR _NidokingDexEntry
	db "@"

SlowbroDexEntry: ; 4066c (10:466c)
	db "HERMITCRAB@"
	db 5,3
	dw 1730
	TX_FAR _SlowbroDexEntry
	db "@"

IvysaurDexEntry: ; 40680 (10:4680)
	db "SEED@"
	db 3,3
	dw 290
	TX_FAR _IvysaurDexEntry
	db "@"

ExeggutorDexEntry: ; 4068e (10:468e)
	db "COCONUT@"
	db 6,7
	dw 2650
	TX_FAR _ExeggutorDexEntry
	db "@"

LickitungDexEntry: ; 4069f (10:469f)
	db "LICKING@"
	db 3,11
	dw 1440
	TX_FAR _LickitungDexEntry
	db "@"

ExeggcuteDexEntry: ; 406b0 (10:46b0)
	db "EGG@"
	db 1,4
	dw 60
	TX_FAR _ExeggcuteDexEntry
	db "@"

GrimerDexEntry: ; 406bd (10:46bd)
	db "SLUDGE@"
	db 2,11
	dw 660
	TX_FAR _GrimerDexEntry
	db "@"

GengarDexEntry: ; 406cd (10:46cd)
	db "SHADOW@"
	db 4,11
	dw 890
	TX_FAR _GengarDexEntry
	db "@"

NidoranFDexEntry: ; 406dd (10:46dd)
	db "POISON PIN@"
	db 1,4
	dw 150
	TX_FAR _NidoranFDexEntry
	db "@"

NidoqueenDexEntry: ; 406f1 (10:46f1)
	db "DRILL@"
	db 4,3
	dw 1320
	TX_FAR _NidoqueenDexEntry
	db "@"

CuboneDexEntry: ; 40700 (10:4700)
	db "LONELY@"
	db 1,4
	dw 140
	TX_FAR _CuboneDexEntry
	db "@"

RhyhornDexEntry: ; 40710 (10:4710)
	db "SPIKES@"
	db 3,3
	dw 2540
	TX_FAR _RhyhornDexEntry
	db "@"

LaprasDexEntry: ; 40720 (10:4720)
	db "TRANSPORT@"
	db 8,2
	dw 4850
	TX_FAR _LaprasDexEntry
	db "@"

ArcanineDexEntry: ; 40733 (10:4733)
	db "LEGENDARY@"
	db 6,3
	dw 3420
	TX_FAR _ArcanineDexEntry
	db "@"

MewDexEntry: ; 40746 (10:4746)
	db "NEW SPECIE@"
	db 1,4
	dw 90
	TX_FAR _MewDexEntry
	db "@"

GyaradosDexEntry: ; 4075a (10:475a)
	db "ATROCIOUS@"
	db 21,4
	dw 5180
	TX_FAR _GyaradosDexEntry
	db "@"

ShellderDexEntry: ; 4076d (10:476d)
	db "BIVALVE@"
	db 1,0
	dw 90
	TX_FAR _ShellderDexEntry
	db "@"

TentacoolDexEntry: ; 4077e (10:477e)
	db "JELLYFISH@"
	db 2,11
	dw 1000
	TX_FAR _TentacoolDexEntry
	db "@"

GastlyDexEntry: ; 40791 (10:4791)
	db "GAS@"
	db 4,3
	dw 2
	TX_FAR _GastlyDexEntry
	db "@"

ScytherDexEntry: ; 4079e (10:479e)
	db "MANTIS@"
	db 4,11
	dw 1230
	TX_FAR _ScytherDexEntry
	db "@"

StaryuDexEntry: ; 407ae (10:47ae)
	db "STARSHAPE@"
	db 2,7
	dw 760
	TX_FAR _StaryuDexEntry
	db "@"

BlastoiseDexEntry: ; 407c1 (10:47c1)
	db "SHELLFISH@"
	db 5,3
	dw 1890
	TX_FAR _BlastoiseDexEntry
	db "@"

PinsirDexEntry: ; 407d4 (10:47d4)
	db "STAGBEETLE@"
	db 4,11
	dw 1210
	TX_FAR _PinsirDexEntry
	db "@"

TangelaDexEntry: ; 407e8 (10:47e8)
	db "VINE@"
	db 3,3
	dw 770
	TX_FAR _TangelaDexEntry
	db "@"

GrowlitheDexEntry: ; 407f6 (10:47f6)
	db "PUPPY@"
	db 2,4
	dw 420
	TX_FAR _GrowlitheDexEntry
	db "@"

OnixDexEntry: ; 40805 (10:4805)
	db "ROCK SNAKE@"
	db 28,10
	dw 4630
	TX_FAR _OnixDexEntry
	db "@"

FearowDexEntry: ; 40819 (10:4819)
	db "BEAK@"
	db 3,11
	dw 840
	TX_FAR _FearowDexEntry
	db "@"

PidgeyDexEntry: ; 40827 (10:4827)
	db "TINY BIRD@"
	db 1,0
	dw 40
	TX_FAR _PidgeyDexEntry
	db "@"

SlowpokeDexEntry: ; 4083a (10:483a)
	db "DOPEY@"
	db 3,11
	dw 790
	TX_FAR _SlowpokeDexEntry
	db "@"

KadabraDexEntry: ; 40849 (10:4849)
	db "PSI@"
	db 4,3
	dw 1250
	TX_FAR _KadabraDexEntry
	db "@"

GravelerDexEntry: ; 40856 (10:4856)
	db "ROCK@"
	db 3,3
	dw 2320
	TX_FAR _GravelerDexEntry
	db "@"

ChanseyDexEntry: ; 40864 (10:4864)
	db "EGG@"
	db 3,7
	dw 760
	TX_FAR _ChanseyDexEntry
	db "@"

MachokeDexEntry: ; 40871 (10:4871)
	db "SUPERPOWER@"
	db 4,11
	dw 1550
	TX_FAR _MachokeDexEntry
	db "@"

MrMimeDexEntry: ; 40885 (10:4885)
	db "BARRIER@"
	db 4,3
	dw 1200
	TX_FAR _MrMimeDexEntry
	db "@"

HitmonleeDexEntry: ; 40896 (10:4896)
	db "KICKING@"
	db 4,11
	dw 1100
	TX_FAR _HitmonleeDexEntry
	db "@"

HitmonchanDexEntry: ; 408a7 (10:48a7)
	db "PUNCHING@"
	db 4,7
	dw 1110
	TX_FAR _HitmonchanDexEntry
	db "@"

ArbokDexEntry: ; 408b9 (10:48b9)
	db "COBRA@"
	db 11,6
	dw 1430
	TX_FAR _ArbokDexEntry
	db "@"

ParasectDexEntry: ; 408c8 (10:48c8)
	db "MUSHROOM@"
	db 3,3
	dw 650
	TX_FAR _ParasectDexEntry
	db "@"

PsyduckDexEntry: ; 408da (10:48da)
	db "DUCK@"
	db 2,7
	dw 430
	TX_FAR _PsyduckDexEntry
	db "@"

DrowzeeDexEntry: ; 408e8 (10:48e8)
	db "HYPNOSIS@"
	db 3,3
	dw 710
	TX_FAR _DrowzeeDexEntry
	db "@"

GolemDexEntry: ; 408fa (10:48fa)
	db "MEGATON@"
	db 4,7
	dw 6620
	TX_FAR _GolemDexEntry
	db "@"

MagmarDexEntry: ; 4090b (10:490b)
	db "SPITFIRE@"
	db 4,3
	dw 980
	TX_FAR _MagmarDexEntry
	db "@"

ElectabuzzDexEntry: ; 4091d (10:491d)
	db "ELECTRIC@"
	db 3,7
	dw 660
	TX_FAR _ElectabuzzDexEntry
	db "@"

MagnetonDexEntry: ; 4092f (10:492f)
	db "MAGNET@"
	db 3,3
	dw 1320
	TX_FAR _MagnetonDexEntry
	db "@"

KoffingDexEntry: ; 4093f (10:493f)
	db "POISON GAS@"
	db 2,0
	dw 20
	TX_FAR _KoffingDexEntry
	db "@"

MankeyDexEntry: ; 40953 (10:4953)
	db "PIG MONKEY@"
	db 1,8
	dw 620
	TX_FAR _MankeyDexEntry
	db "@"

SeelDexEntry: ; 40967 (10:4967)
	db "SEA LION@"
	db 3,7
	dw 1980
	TX_FAR _SeelDexEntry
	db "@"

DiglettDexEntry: ; 40979 (10:4979)
	db "MOLE@"
	db 0,8
	dw 20
	TX_FAR _DiglettDexEntry
	db "@"

TaurosDexEntry: ; 40987 (10:4987)
	db "WILD BULL@"
	db 4,7
	dw 1950
	TX_FAR _TaurosDexEntry
	db "@"

FarfetchdDexEntry: ; 4099a (10:499a)
	db "WILD DUCK@"
	db 2,7
	dw 330
	TX_FAR _FarfetchdDexEntry
	db "@"

VenonatDexEntry: ; 409ad (10:49ad)
	db "INSECT@"
	db 3,3
	dw 660
	TX_FAR _VenonatDexEntry
	db "@"

DragoniteDexEntry: ; 409bd (10:49bd)
	db "DRAGON@"
	db 7,3
	dw 4630
	TX_FAR _DragoniteDexEntry
	db "@"

DoduoDexEntry: ; 409cd (10:49cd)
	db "TWIN BIRD@"
	db 4,7
	dw 860
	TX_FAR _DoduoDexEntry
	db "@"

PoliwagDexEntry: ; 409e0 (10:49e0)
	db "TADPOLE@"
	db 2,0
	dw 270
	TX_FAR _PoliwagDexEntry
	db "@"

JynxDexEntry: ; 409f1 (10:49f1)
	db "HUMANSHAPE@"
	db 4,7
	dw 900
	TX_FAR _JynxDexEntry
	db "@"

MoltresDexEntry: ; 40a05 (10:4a05)
	db "FLAME@"
	db 6,7
	dw 1320
	TX_FAR _MoltresDexEntry
	db "@"

ArticunoDexEntry: ; 40a14 (10:4a14)
	db "FREEZE@"
	db 5,7
	dw 1220
	TX_FAR _ArticunoDexEntry
	db "@"

ZapdosDexEntry: ; 40a24 (10:4a24)
	db "ELECTRIC@"
	db 5,3
	dw 1160
	TX_FAR _ZapdosDexEntry
	db "@"

DittoDexEntry: ; 40a36 (10:4a36)
	db "TRANSFORM@"
	db 1,0
	dw 90
	TX_FAR _DittoDexEntry
	db "@"

MeowthDexEntry: ; 40a49 (10:4a49)
	db "SCRATCHCAT@"
	db 1,4
	dw 90
	TX_FAR _MeowthDexEntry
	db "@"

KrabbyDexEntry: ; 40a5d (10:4a5d)
	db "RIVER CRAB@"
	db 1,4
	dw 140
	TX_FAR _KrabbyDexEntry
	db "@"

VulpixDexEntry: ; 40a71 (10:4a71)
	db "FOX@"
	db 2,0
	dw 220
	TX_FAR _VulpixDexEntry
	db "@"

NinetalesDexEntry: ; 40a7e (10:4a7e)
	db "FOX@"
	db 3,7
	dw 440
	TX_FAR _NinetalesDexEntry
	db "@"

PikachuDexEntry: ; 40a8b (10:4a8b)
	db "MOUSE@"
	db 1,4
	dw 130
	TX_FAR _PikachuDexEntry
	db "@"

RaichuDexEntry: ; 40a9a (10:4a9a)
	db "MOUSE@"
	db 2,7
	dw 660
	TX_FAR _RaichuDexEntry
	db "@"

DratiniDexEntry: ; 40aa9 (10:4aa9)
	db "DRAGON@"
	db 5,11
	dw 70
	TX_FAR _DratiniDexEntry
	db "@"

DragonairDexEntry: ; 40ab9 (10:4ab9)
	db "DRAGON@"
	db 13,1
	dw 360
	TX_FAR _DragonairDexEntry
	db "@"

KabutoDexEntry: ; 40ac9 (10:4ac9)
	db "SHELLFISH@"
	db 1,8
	dw 250
	TX_FAR _KabutoDexEntry
	db "@"

KabutopsDexEntry: ; 40adc (10:4adc)
	db "SHELLFISH@"
	db 4,3
	dw 890
	TX_FAR _KabutopsDexEntry
	db "@"

HorseaDexEntry: ; 40aef (10:4aef)
	db "DRAGON@"
	db 1,4
	dw 180
	TX_FAR _HorseaDexEntry
	db "@"

SeadraDexEntry: ; 40aff (10:4aff)
	db "DRAGON@"
	db 3,11
	dw 550
	TX_FAR _SeadraDexEntry
	db "@"

SandshrewDexEntry: ; 40b0f (10:4b0f)
	db "MOUSE@"
	db 2,0
	dw 260
	TX_FAR _SandshrewDexEntry
	db "@"

SandslashDexEntry: ; 40b1e (10:4b1e)
	db "MOUSE@"
	db 3,3
	dw 650
	TX_FAR _SandslashDexEntry
	db "@"

OmanyteDexEntry: ; 40b2d (10:4b2d)
	db "SPIRAL@"
	db 1,4
	dw 170
	TX_FAR _OmanyteDexEntry
	db "@"

OmastarDexEntry: ; 40b3d (10:4b3d)
	db "SPIRAL@"
	db 3,3
	dw 770
	TX_FAR _OmastarDexEntry
	db "@"

JigglypuffDexEntry: ; 40b4d (10:4b4d)
	db "BALLOON@"
	db 1,8
	dw 120
	TX_FAR _JigglypuffDexEntry
	db "@"

WigglytuffDexEntry: ; 40b5e (10:4b5e)
	db "BALLOON@"
	db 3,3
	dw 260
	TX_FAR _WigglytuffDexEntry
	db "@"

EeveeDexEntry: ; 40b6f (10:4b6f)
	db "EVOLUTION@"
	db 1,0
	dw 140
	TX_FAR _EeveeDexEntry
	db "@"

FlareonDexEntry: ; 40b82 (10:4b82)
	db "FLAME@"
	db 2,11
	dw 550
	TX_FAR _FlareonDexEntry
	db "@"

JolteonDexEntry: ; 40b91 (10:4b91)
	db "LIGHTNING@"
	db 2,7
	dw 540
	TX_FAR _JolteonDexEntry
	db "@"

VaporeonDexEntry: ; 40ba4 (10:4ba4)
	db "BUBBLE JET@"
	db 3,3
	dw 640
	TX_FAR _VaporeonDexEntry
	db "@"

MachopDexEntry: ; 40bb8 (10:4bb8)
	db "SUPERPOWER@"
	db 2,7
	dw 430
	TX_FAR _MachopDexEntry
	db "@"

ZubatDexEntry: ; 40bcc (10:4bcc)
	db "BAT@"
	db 2,7
	dw 170
	TX_FAR _ZubatDexEntry
	db "@"

EkansDexEntry: ; 40bd9 (10:4bd9)
	db "SNAKE@"
	db 6,7
	dw 150
	TX_FAR _EkansDexEntry
	db "@"

ParasDexEntry: ; 40be8 (10:4be8)
	db "MUSHROOM@"
	db 1,0
	dw 120
	TX_FAR _ParasDexEntry
	db "@"

PoliwhirlDexEntry: ; 40bfa (10:4bfa)
	db "TADPOLE@"
	db 3,3
	dw 440
	TX_FAR _PoliwhirlDexEntry
	db "@"

PoliwrathDexEntry: ; 40c0b (10:4c0b)
	db "TADPOLE@"
	db 4,3
	dw 1190
	TX_FAR _PoliwrathDexEntry
	db "@"

WeedleDexEntry: ; 40c1c (10:4c1c)
	db "HAIRY BUG@"
	db 1,0
	dw 70
	TX_FAR _WeedleDexEntry
	db "@"

KakunaDexEntry: ; 40c2f (10:4c2f)
	db "COCOON@"
	db 2,0
	dw 220
	TX_FAR _KakunaDexEntry
	db "@"

BeedrillDexEntry: ; 40c3f (10:4c3f)
	db "POISON BEE@"
	db 3,3
	dw 650
	TX_FAR _BeedrillDexEntry
	db "@"

DodrioDexEntry: ; 40c53 (10:4c53)
	db "TRIPLEBIRD@"
	db 5,11
	dw 1880
	TX_FAR _DodrioDexEntry
	db "@"

PrimeapeDexEntry: ; 40c67 (10:4c67)
	db "PIG MONKEY@"
	db 3,3
	dw 710
	TX_FAR _PrimeapeDexEntry
	db "@"

DugtrioDexEntry: ; 40c7b (10:4c7b)
	db "MOLE@"
	db 2,4
	dw 730
	TX_FAR _DugtrioDexEntry
	db "@"

VenomothDexEntry: ; 40c89 (10:4c89)
	db "POISONMOTH@"
	db 4,11
	dw 280
	TX_FAR _VenomothDexEntry
	db "@"

DewgongDexEntry: ; 40c9d (10:4c9d)
	db "SEA LION@"
	db 5,7
	dw 2650
	TX_FAR _DewgongDexEntry
	db "@"

CaterpieDexEntry: ; 40caf (10:4caf)
	db "WORM@"
	db 1,0
	dw 60
	TX_FAR _CaterpieDexEntry
	db "@"

MetapodDexEntry: ; 40cbd (10:4cbd)
	db "COCOON@"
	db 2,4
	dw 220
	TX_FAR _MetapodDexEntry
	db "@"

ButterfreeDexEntry: ; 40ccd (10:4ccd)
	db "BUTTERFLY@"
	db 3,7
	dw 710
	TX_FAR _ButterfreeDexEntry
	db "@"

MachampDexEntry: ; 40ce0 (10:4ce0)
	db "SUPERPOWER@"
	db 5,3
	dw 2870
	TX_FAR _MachampDexEntry
	db "@"

GolduckDexEntry: ; 40cf4 (10:4cf4)
	db "DUCK@"
	db 5,7
	dw 1690
	TX_FAR _GolduckDexEntry
	db "@"

HypnoDexEntry: ; 40d02 (10:4d02)
	db "HYPNOSIS@"
	db 5,3
	dw 1670
	TX_FAR _HypnoDexEntry
	db "@"

GolbatDexEntry: ; 40d14 (10:4d14)
	db "BAT@"
	db 5,3
	dw 1210
	TX_FAR _GolbatDexEntry
	db "@"

MewtwoDexEntry: ; 40d21 (10:4d21)
	db "GENETIC@"
	db 6,7
	dw 2690
	TX_FAR _MewtwoDexEntry
	db "@"

SnorlaxDexEntry: ; 40d32 (10:4d32)
	db "SLEEPING@"
	db 6,11
	dw 10140
	TX_FAR _SnorlaxDexEntry
	db "@"

MagikarpDexEntry: ; 40d44 (10:4d44)
	db "FISH@"
	db 2,11
	dw 220
	TX_FAR _MagikarpDexEntry
	db "@"

MukDexEntry: ; 40d52 (10:4d52)
	db "SLUDGE@"
	db 3,11
	dw 660
	TX_FAR _MukDexEntry
	db "@"

KinglerDexEntry: ; 40d62 (10:4d62)
	db "PINCER@"
	db 4,3
	dw 1320
	TX_FAR _KinglerDexEntry
	db "@"

CloysterDexEntry: ; 40d72 (10:4d72)
	db "BIVALVE@"
	db 4,11
	dw 2920
	TX_FAR _CloysterDexEntry
	db "@"

ElectrodeDexEntry: ; 40d83 (10:4d83)
	db "BALL@"
	db 3,11
	dw 1470
	TX_FAR _ElectrodeDexEntry
	db "@"

ClefableDexEntry: ; 40d91 (10:4d91)
	db "FAIRY@"
	db 4,3
	dw 880
	TX_FAR _ClefableDexEntry
	db "@"

WeezingDexEntry: ; 40da0 (10:4da0)
	db "POISON GAS@"
	db 3,11
	dw 210
	TX_FAR _WeezingDexEntry
	db "@"

PersianDexEntry: ; 40db4 (10:4db4)
	db "CLASSY CAT@"
	db 3,3
	dw 710
	TX_FAR _PersianDexEntry
	db "@"

MarowakDexEntry: ; 40dc8 (10:4dc8)
	db "BONEKEEPER@"
	db 3,3
	dw 990
	TX_FAR _MarowakDexEntry
	db "@"

HaunterDexEntry: ; 40ddc (10:4ddc)
	db "GAS@"
	db 5,3
	dw 2
	TX_FAR _HaunterDexEntry
	db "@"

AbraDexEntry: ; 40de9 (10:4de9)
	db "PSI@"
	db 2,11
	dw 430
	TX_FAR _AbraDexEntry
	db "@"

AlakazamDexEntry: ; 40df6 (10:4df6)
	db "PSI@"
	db 4,11
	dw 1060
	TX_FAR _AlakazamDexEntry
	db "@"

PidgeottoDexEntry: ; 40e03 (10:4e03)
	db "BIRD@"
	db 3,7
	dw 660
	TX_FAR _PidgeottoDexEntry
	db "@"

PidgeotDexEntry: ; 40e11 (10:4e11)
	db "BIRD@"
	db 4,11
	dw 870
	TX_FAR _PidgeotDexEntry
	db "@"

StarmieDexEntry: ; 40e1f (10:4e1f)
	db "MYSTERIOUS@"
	db 3,7
	dw 1760
	TX_FAR _StarmieDexEntry
	db "@"

BulbasaurDexEntry: ; 40e33 (10:4e33)
	db "SEED@"
	db 2,4
	dw 150
	TX_FAR _BulbasaurDexEntry
	db "@"

VenusaurDexEntry: ; 40e41 (10:4e41)
	db "SEED@"
	db 6,7
	dw 2210
	TX_FAR _VenusaurDexEntry
	db "@"

TentacruelDexEntry: ; 40e4f (10:4e4f)
	db "JELLYFISH@"
	db 5,3
	dw 1210
	TX_FAR _TentacruelDexEntry
	db "@"

GoldeenDexEntry: ; 40e62 (10:4e62)
	db "GOLDFISH@"
	db 2,0
	dw 330
	TX_FAR _GoldeenDexEntry
	db "@"

SeakingDexEntry: ; 40e74 (10:4e74)
	db "GOLDFISH@"
	db 4,3
	dw 860
	TX_FAR _SeakingDexEntry
	db "@"

PonytaDexEntry: ; 40e86 (10:4e86)
	db "FIRE HORSE@"
	db 3,3
	dw 660
	TX_FAR _PonytaDexEntry
	db "@"

RapidashDexEntry: ; 40e9a (10:4e9a)
	db "FIRE HORSE@"
	db 5,7
	dw 2090
	TX_FAR _RapidashDexEntry
	db "@"

RattataDexEntry: ; 40eae (10:4eae)
	db "RAT@"
	db 1,0
	dw 80
	TX_FAR _RattataDexEntry
	db "@"

RaticateDexEntry: ; 40ebb (10:4ebb)
	db "RAT@"
	db 2,4
	dw 410
	TX_FAR _RaticateDexEntry
	db "@"

NidorinoDexEntry: ; 40ec8 (10:4ec8)
	db "POISON PIN@"
	db 2,11
	dw 430
	TX_FAR _NidorinoDexEntry
	db "@"

NidorinaDexEntry: ; 40edc (10:4edc)
	db "POISON PIN@"
	db 2,7
	dw 440
	TX_FAR _NidorinaDexEntry
	db "@"

GeodudeDexEntry: ; 40ef0 (10:4ef0)
	db "ROCK@"
	db 1,4
	dw 440
	TX_FAR _GeodudeDexEntry
	db "@"

PorygonDexEntry: ; 40efe (10:4efe)
	db "VIRTUAL@"
	db 2,7
	dw 800
	TX_FAR _PorygonDexEntry
	db "@"

AerodactylDexEntry: ; 40f0f (10:4f0f)
	db "FOSSIL@"
	db 5,11
	dw 1300
	TX_FAR _AerodactylDexEntry
	db "@"

MagnemiteDexEntry: ; 40f1f (10:4f1f)
	db "MAGNET@"
	db 1,0
	dw 130
	TX_FAR _MagnemiteDexEntry
	db "@"

CharmanderDexEntry: ; 40f2f (10:4f2f)
	db "LIZARD@"
	db 2,0
	dw 190
	TX_FAR _CharmanderDexEntry
	db "@"

SquirtleDexEntry: ; 40f3f (10:4f3f)
	db "TINYTURTLE@"
	db 1,8
	dw 200
	TX_FAR _SquirtleDexEntry
	db "@"

CharmeleonDexEntry: ; 40f53 (10:4f53)
	db "FLAME@"
	db 3,7
	dw 420
	TX_FAR _CharmeleonDexEntry
	db "@"

WartortleDexEntry: ; 40f62 (10:4f62)
	db "TURTLE@"
	db 3,3
	dw 500
	TX_FAR _WartortleDexEntry
	db "@"

CharizardDexEntry: ; 40f72 (10:4f72)
	db "FLAME@"
	db 5,7
	dw 2000
	TX_FAR _CharizardDexEntry
	db "@"

OddishDexEntry: ; 40f81 (10:4f81)
	db "WEED@"
	db 1,8
	dw 120
	TX_FAR _OddishDexEntry
	db "@"

GloomDexEntry: ; 40f8f (10:4f8f)
	db "WEED@"
	db 2,7
	dw 190
	TX_FAR _GloomDexEntry
	db "@"

VileplumeDexEntry: ; 40f9d (10:4f9d)
	db "FLOWER@"
	db 3,11
	dw 410
	TX_FAR _VileplumeDexEntry
	db "@"

BellsproutDexEntry: ; 40fad (10:4fad)
	db "FLOWER@"
	db 2,4
	dw 90
	TX_FAR _BellsproutDexEntry
	db "@"

WeepinbellDexEntry: ; 40fbd (10:4fbd)
	db "FLYCATCHER@"
	db 3,3
	dw 140
	TX_FAR _WeepinbellDexEntry
	db "@"

VictreebelDexEntry: ; 40fd1 (10:4fd1)
	db "FLYCATCHER@"
	db 5,7
	dw 340
	TX_FAR _VictreebelDexEntry
	db "@"

MissingNoDexEntry: ; 40fe5 (10:4fe5)
	db "???@"
	db 10 ; 1.0 m
	db 100 ; 10.0 kg
	db 0,"コメント さくせいちゅう@" ; コメント作成中 (Comment to be written)

PokedexToIndex: ; 40ff9 (10:4ff9)
	; converts the Pokédex number at $D11E to an index
	push bc
	push hl
	ld a,[$D11E]
	ld b,a
	ld c,0
	ld hl,PokedexOrder

.loop ; go through the list until we find an entry with a matching dex number
	inc c
	ld a,[hli]
	cp b
	jr nz,.loop

	ld a,c
	ld [$D11E],a
	pop hl
	pop bc
	ret

IndexToPokedex: ; 41010 (10:5010)
	; converts the indexédex number at $D11E to a Pokédex number
	push bc
	push hl
	ld a,[$D11E]
	dec a
	ld hl,PokedexOrder
	ld b,0
	ld c,a
	add hl,bc
	ld a,[hl]
	ld [$D11E],a
	pop hl
	pop bc
	ret

PokedexOrder: ; 41024 (10:5024)
	db DEX_RHYDON
	db DEX_KANGASKHAN
	db DEX_NIDORAN_M
	db DEX_CLEFAIRY
	db DEX_SPEAROW
	db DEX_VOLTORB
	db DEX_NIDOKING
	db DEX_SLOWBRO
	db DEX_IVYSAUR
	db DEX_EXEGGUTOR
	db DEX_LICKITUNG
	db DEX_EXEGGCUTE
	db DEX_GRIMER
	db DEX_GENGAR
	db DEX_NIDORAN_F
	db DEX_NIDOQUEEN
	db DEX_CUBONE
	db DEX_RHYHORN
	db DEX_LAPRAS
	db DEX_ARCANINE
	db DEX_MEW
	db DEX_GYARADOS
	db DEX_SHELLDER
	db DEX_TENTACOOL
	db DEX_GASTLY
	db DEX_SCYTHER
	db DEX_STARYU
	db DEX_BLASTOISE
	db DEX_PINSIR
	db DEX_TANGELA
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_GROWLITHE
	db DEX_ONIX
	db DEX_FEAROW
	db DEX_PIDGEY
	db DEX_SLOWPOKE
	db DEX_KADABRA
	db DEX_GRAVELER
	db DEX_CHANSEY
	db DEX_MACHOKE
	db DEX_MR_MIME
	db DEX_HITMONLEE
	db DEX_HITMONCHAN
	db DEX_ARBOK
	db DEX_PARASECT
	db DEX_PSYDUCK
	db DEX_DROWZEE
	db DEX_GOLEM
	db 0 ; MISSINGNO.
	db DEX_MAGMAR
	db 0 ; MISSINGNO.
	db DEX_ELECTABUZZ
	db DEX_MAGNETON
	db DEX_KOFFING
	db 0 ; MISSINGNO.
	db DEX_MANKEY
	db DEX_SEEL
	db DEX_DIGLETT
	db DEX_TAUROS
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_FARFETCH_D
	db DEX_VENONAT
	db DEX_DRAGONITE
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_DODUO
	db DEX_POLIWAG
	db DEX_JYNX
	db DEX_MOLTRES
	db DEX_ARTICUNO
	db DEX_ZAPDOS
	db DEX_DITTO
	db DEX_MEOWTH
	db DEX_KRABBY
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_VULPIX
	db DEX_NINETALES
	db DEX_PIKACHU
	db DEX_RAICHU
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_DRATINI
	db DEX_DRAGONAIR
	db DEX_KABUTO
	db DEX_KABUTOPS
	db DEX_HORSEA
	db DEX_SEADRA
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_SANDSHREW
	db DEX_SANDSLASH
	db DEX_OMANYTE
	db DEX_OMASTAR
	db DEX_JIGGLYPUFF
	db DEX_WIGGLYTUFF
	db DEX_EEVEE
	db DEX_FLAREON
	db DEX_JOLTEON
	db DEX_VAPOREON
	db DEX_MACHOP
	db DEX_ZUBAT
	db DEX_EKANS
	db DEX_PARAS
	db DEX_POLIWHIRL
	db DEX_POLIWRATH
	db DEX_WEEDLE
	db DEX_KAKUNA
	db DEX_BEEDRILL
	db 0 ; MISSINGNO.
	db DEX_DODRIO
	db DEX_PRIMEAPE
	db DEX_DUGTRIO
	db DEX_VENOMOTH
	db DEX_DEWGONG
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_CATERPIE
	db DEX_METAPOD
	db DEX_BUTTERFREE
	db DEX_MACHAMP
	db 0 ; MISSINGNO.
	db DEX_GOLDUCK
	db DEX_HYPNO
	db DEX_GOLBAT
	db DEX_MEWTWO
	db DEX_SNORLAX
	db DEX_MAGIKARP
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_MUK
	db 0 ; MISSINGNO.
	db DEX_KINGLER
	db DEX_CLOYSTER
	db 0 ; MISSINGNO.
	db DEX_ELECTRODE
	db DEX_CLEFABLE
	db DEX_WEEZING
	db DEX_PERSIAN
	db DEX_MAROWAK
	db 0 ; MISSINGNO.
	db DEX_HAUNTER
	db DEX_ABRA
	db DEX_ALAKAZAM
	db DEX_PIDGEOTTO
	db DEX_PIDGEOT
	db DEX_STARMIE
	db DEX_BULBASAUR
	db DEX_VENUSAUR
	db DEX_TENTACRUEL
	db 0 ; MISSINGNO.
	db DEX_GOLDEEN
	db DEX_SEAKING
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_PONYTA
	db DEX_RAPIDASH
	db DEX_RATTATA
	db DEX_RATICATE
	db DEX_NIDORINO
	db DEX_NIDORINA
	db DEX_GEODUDE
	db DEX_PORYGON
	db DEX_AERODACTYL
	db 0 ; MISSINGNO.
	db DEX_MAGNEMITE
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_CHARMANDER
	db DEX_SQUIRTLE
	db DEX_CHARMELEON
	db DEX_WARTORTLE
	db DEX_CHARIZARD
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db 0 ; MISSINGNO.
	db DEX_ODDISH
	db DEX_GLOOM
	db DEX_VILEPLUME
	db DEX_BELLSPROUT
	db DEX_WEEPINBELL
	db DEX_VICTREEBEL

; known jump sources: 71c5c (1c:5c5c)
Func_410e2: ; 410e2 (10:50e2)
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [$cd5e], a
	ld a, [$cd3e]
	ld [$cd5f], a
	ld de, Unknown_41138 ; $5138
	jr .asm_41102

INCBIN "baserom.gbc",$410f3,$41102 - $410f3
.asm_41102
	ld a, [W_OPTIONS] ; $d355
	push af
	ld a, [$FF00+$af]
	push af
	ld a, [$FF00+$ae]
	push af
	xor a
	ld [W_OPTIONS], a ; $d355
	ld [$FF00+$af], a
	ld [$FF00+$ae], a
	push de
.asm_41115
	pop de
	ld a, [de]
	cp $ff
	jr z, .asm_4112d
	inc de
	push de
	ld hl, Unknown_4115f ; $515f
	add a
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld de, .asm_41115 ; $5115
	push de
	jp [hl]
.asm_4112d
	pop af
	ld [$FF00+$ae], a
	pop af
	ld [$FF00+$af], a
	pop af
	ld [W_OPTIONS], a ; $d355
	ret

Unknown_41138: ; 41138 (10:5138)
INCBIN "baserom.gbc",$41138,$4115f - $41138

Unknown_4115f: ; 4115f (10:515f)
INCBIN "baserom.gbc",$4115f,$41181 - $4115f

; known jump sources: 41367 (10:5367)
Func_41181: ; 41181 (10:5181)
	ld c, $64
	jp DelayFrames

; known jump sources: 412be (10:52be), 4134b (10:534b), 41398 (10:5398), 413e3 (10:53e3)
Func_41186: ; 41186 (10:5186)
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Delay3
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ret

; known jump sources: 41281 (10:5281), 41617 (10:5617), 41620 (10:5620), 41633 (10:5633), 4163c (10:563c), 41652 (10:5652)
Func_41191: ; 41191 (10:5191)
	ld c, $50
	jp DelayFrames

; known jump sources: 411a1 (10:51a1), 41298 (10:5298), 4142d (10:542d), 4145c (10:545c), 4149f (10:549f), 415f1 (10:55f1)
Func_41196: ; 41196 (10:5196)
	ld hl, W_SCREENTILESBUFFER
	ld bc, $168
	ld a, $7f
	jp FillMemory
	call Func_41196
	call DisableLCD
	ld hl, TradingAnimationGraphics ; $69be
	ld de, $9310
	ld bc, $310
	ld a, BANK(TradingAnimationGraphics)
	call FarCopyData2
	ld hl, TradingAnimationGraphics2 ; $6cce
	ld de, $87c0
	ld bc, $40
	ld a, BANK(TradingAnimationGraphics2)
	call FarCopyData2
	ld hl, $9800
	ld bc, $800
	ld a, $7f
	call FillMemory
	call CleanLCD_OAM
	ld a, $ff
	ld [$cfcb], a
	ld hl, $d730
	set 6, [hl]
	ld a, [$cf1b]
	and a
	ld a, $e4
	jr z, .asm_411e5
	ld a, $f0
.asm_411e5
	ld [rOBP0], a ; $FF00+$48
	call EnableLCD
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [$d11e], a
	call GetMonName
	ld hl, $cd6d
	ld de, $cf4b
	ld bc, $b
	call CopyData
	ld a, [$cd3e]
	ld [$d11e], a
	jp GetMonName

; known jump sources: 4141b (10:541b)
Func_4120b: ; 4120b (10:520b)
	ld a, $d0
	ld [rOBP1], a ; $FF00+$49
	ld b, BANK(Func_7176c)
	ld hl, Func_7176c
	jp Bankswitch ; indirect jump to Func_7176c (7176c (1c:576c))

INCBIN "baserom.gbc",$41217,$4123b - $41217
	xor a
	call LoadGBPal
	ld hl, $d730
	res 6, [hl]
	ret
	ld a, $ab
	ld [rLCDC], a ; $FF00+$40
	ld a, $50
	ld [$FF00+$b0], a
	ld a, $86
	ld [rWX], a ; $FF00+$4b
	ld [$FF00+$ae], a
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	FuncCoord 4, 0 ; $c3a4
	ld hl, Coord
	ld b, $6
	ld c, $a
	call TextBoxBorder
	call Func_42769
	ld b, $98
	call CopyScreenTileBufferToVRAM
	call ClearScreen
	ld a, [W_WHICHTRADE] ; $cd3d
	call Func_415a4
	ld a, $7e
.asm_41273
	push af
	call DelayFrame
	pop af
	ld [rWX], a ; $FF00+$4b
	ld [$FF00+$ae], a
	dec a
	dec a
	and a
	jr nz, .asm_41273
	call Func_41191
	ld a, $ad
	call Func_41676
	ld a, $aa
	call Func_41676
	ld a, [W_WHICHTRADE] ; $cd3d
	call PlayCry
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ret
	call Func_41196
	ld b, $98
	call CopyScreenTileBufferToVRAM
	ld b, $8
	call GoPAL_SET
	ld hl, $9c8c
	call Func_414ae
	ld a, $a0
	ld [$FF00+$ae], a
	call DelayFrame
	ld a, $8b
	ld [rLCDC], a ; $FF00+$40
	FuncCoord 6, 2 ; $c3ce
	ld hl, Coord
	ld b, $7
	call Func_41842
	call Func_41186
	ld a, $8d
	call PlaySound
	ld c, $14
.asm_412c8
	ld a, [$FF00+$ae]
	add $4
	ld [$FF00+$ae], a
	dec c
	jr nz, .asm_412c8
	ret
	ld a, $ab
	call Func_41676
	ld c, $a
	call DelayFrames
	ld a, $e4
	ld [rOBP0], a ; $FF00+$48
	xor a
	ld [$d09f], a
	ld bc, $2060
.asm_412e7
	push bc
	xor a
	ld de, Unknown_4132e ; $532e
	call WriteOAMBlock
	ld a, [$d09f]
	xor $1
	ld [$d09f], a
	add $7e
	ld hl, $c302
	ld de, $4
	ld c, e
.asm_41300
	ld [hl], a
	add hl, de
	dec c
	jr nz, .asm_41300
	call Delay3
	pop bc
	ld a, c
	add $4
	ld c, a
	cp $a0
	jr nc, .asm_41318
	ld a, $8c
	call PlaySound
	jr .asm_412e7
.asm_41318
	call CleanLCD_OAM
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call ClearScreen
	ld b, $98
	call CopyScreenTileBufferToVRAM
	call Delay3
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ret

Unknown_4132e: ; 4132e (10:532e)
INCBIN "baserom.gbc",$4132e,$41336 - $4132e
	ld a, $ac
	call Func_41676
	call Func_415c8
	FuncCoord 4, 10 ; $c46c
	ld hl, Coord
	ld b, $6
	ld c, $a
	call TextBoxBorder
	call Func_427a7
	call Func_41186
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, [$cd3e]
	call Func_415a4
	ld a, $ad
	call Func_41676
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, [$cd3e]
	call PlayCry
	call Func_41181
	FuncCoord 4, 10 ; $c46c
	ld hl, Coord
	ld bc, $80c
	call ClearScreenArea
	jp Func_4164c
	call Func_41411
	ld a, $1
	ld [$d08a], a
	ld a, $e4
	ld [rOBP0], a ; $FF00+$48
	ld a, $54
	ld [W_BASECOORDX], a ; $d081
	ld a, $1c
	ld [W_BASECOORDY], a ; $d082
	ld a, [$cd5e]
	ld [$cd5d], a
	call Func_41505
	call Func_4142d
	call Func_41186
	call Func_4149f
	ld hl, $9c8c
	call Func_414ae
	ld b, $6
	call Func_414c5
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Func_4149f
	ld b, $4
	call Func_414c5
	call Func_4145c
	ld b, $6
	call Func_414c5
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Func_41525
	jp CleanLCD_OAM
	call Func_41411
	xor a
	ld [$d08a], a
	ld a, $64
	ld [W_BASECOORDX], a ; $d081
	ld a, $44
	ld [W_BASECOORDY], a ; $d082
	ld a, [$cd5f]
	ld [$cd5d], a
	call Func_41505
	call Func_4145c
	call Func_41186
	call Func_4149f
	ld hl, $9c94
	call Func_414ae
	call Func_41525
	ld b, $6
	call Func_414c5
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Func_4149f
	ld b, $4
	call Func_414c5
	call Func_4142d
	ld b, $6
	call Func_414c5
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	jp CleanLCD_OAM

; known jump sources: 41376 (10:5376), 413c6 (10:53c6)
Func_41411: ; 41411 (10:5411)
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call ClearScreen
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Func_4120b
	call DelayFrame
	ld a, $ab
	ld [rLCDC], a ; $FF00+$40
	xor a
	ld [$FF00+$ae], a
	ld a, $90
	ld [$FF00+$b0], a
	ret

; known jump sources: 41395 (10:5395), 41403 (10:5403)
Func_4142d: ; 4142d (10:542d)
	call Func_41196
	FuncCoord 11, 4 ; $c3fb
	ld hl, Coord
	ld a, $5d
	ld [hli], a
	ld a, $5e
	ld c, $8
.asm_4143a
	ld [hli], a
	dec c
	jr nz, .asm_4143a
	FuncCoord 5, 3 ; $c3e1
	ld hl, Coord
	ld b, $6
	call Func_41842
	FuncCoord 4, 12 ; $c494
	ld hl, Coord
	ld b, $2
	ld c, $7
	call TextBoxBorder
	FuncCoord 5, 14 ; $c4bd
	ld hl, Coord
	ld de, W_PLAYERNAME ; $d158
	call PlaceString
	jp DelayFrame

; known jump sources: 413b5 (10:53b5), 413e0 (10:53e0)
Func_4145c: ; 4145c (10:545c)
	call Func_41196
	FuncCoord 0, 4 ; $c3f0
	ld hl, Coord
	ld a, $5e
	ld c, $e
.asm_41466
	ld [hli], a
	dec c
	jr nz, .asm_41466
	ld a, $5f
	ld [hl], a
	ld de, $14
	add hl, de
	ld a, $61
	ld [hl], a
	add hl, de
	ld [hl], a
	add hl, de
	ld [hl], a
	add hl, de
	ld [hl], a
	add hl, de
	ld a, $60
	ld [hld], a
	ld a, $5d
	ld [hl], a
	FuncCoord 7, 8 ; $c447
	ld hl, Coord
	ld b, $6
	call Func_41842
	FuncCoord 6, 0 ; $c3a6
	ld hl, Coord
	ld b, $2
	ld c, $7
	call TextBoxBorder
	FuncCoord 7, 2 ; $c3cf
	ld hl, Coord
	ld de, W_GRASSRATE ; $d887
	call PlaceString
	jp DelayFrame

; known jump sources: 4139b (10:539b), 413ad (10:53ad), 413e6 (10:53e6), 413fb (10:53fb)
Func_4149f: ; 4149f (10:549f)
	call Func_41196
	FuncCoord 0, 4 ; $c3f0
	ld hl, Coord
	ld a, $5e
	ld c, $14
.asm_414a9
	ld [hli], a
	dec c
	jr nz, .asm_414a9
	ret

; known jump sources: 412a8 (10:52a8), 413a1 (10:53a1), 413ec (10:53ec)
Func_414ae: ; 414ae (10:54ae)
	push hl
	FuncCoord 0, 4 ; $c3f0
	ld hl, Coord
	call ScheduleRowRedrawHelper
	pop hl
	ld a, h
	ld [$FF00+$d2], a
	ld a, l
	ld [H_SCREENEDGEREDRAWADDR], a ; $FF00+$d1
	ld a, $2
	ld [H_SCREENEDGEREDRAW], a ; $FF00+$d0
	ld c, $a
	jp DelayFrames

; known jump sources: 413a6 (10:53a6), 413b2 (10:53b2), 413ba (10:53ba), 413f4 (10:53f4), 41400 (10:5400), 41408 (10:5408), 414e5 (10:54e5)
Func_414c5: ; 414c5 (10:54c5)
	ld a, [$d08a]
	ld e, a
	ld d, $8
.asm_414cb
	ld a, e
	dec a
	jr z, .asm_414d5
	ld a, [$FF00+$ae]
	sub $2
	jr .asm_414d9
.asm_414d5
	ld a, [$FF00+$ae]
	add $2
.asm_414d9
	ld [$FF00+$ae], a
	call DelayFrame
	dec d
	jr nz, .asm_414cb
	call Func_414e8
	dec b
	jr nz, Func_414c5
	ret

; known jump sources: 414e1 (10:54e1), 4154c (10:554c)
Func_414e8: ; 414e8 (10:54e8)
	push de
	push bc
	push hl
	ld a, [rBGP] ; $FF00+$47
	xor $3c
	ld [rBGP], a ; $FF00+$47
	ld hl, $c302
	ld de, $4
	ld c, $14
.asm_414f9
	ld a, [hl]
	xor $40
	ld [hl], a
	add hl, de
	dec c
	jr nz, .asm_414f9
	pop hl
	pop bc
	pop de
	ret

; known jump sources: 41392 (10:5392), 413dd (10:53dd)
Func_41505: ; 41505 (10:5505)
	ld b, BANK(Func_71882)
	ld hl, Func_71882
	call Bankswitch ; indirect jump to Func_71882 (71882 (1c:5882))
	call Func_41558

; known jump sources: 41549 (10:5549)
Func_41510: ; 41510 (10:5510)
	ld hl, W_OAMBUFFER
	ld c, $14
.asm_41515
	ld a, [W_BASECOORDY] ; $d082
	add [hl]
	ld [hli], a
	ld a, [W_BASECOORDX] ; $d081
	add [hl]
	ld [hli], a
	inc hl
	inc hl
	dec c
	jr nz, .asm_41515
	ret

; known jump sources: 413c0 (10:53c0), 413ef (10:53ef)
Func_41525: ; 41525 (10:5525)
	ld a, [$d08a]
	and a
	jr z, .asm_41536
	ld bc, $400
	call .asm_4153f
	ld bc, $a
	jr .asm_4153f
.asm_41536
	ld bc, $f6
	call .asm_4153f
	ld bc, $fc00
.asm_4153f
	ld a, b
	ld [W_BASECOORDX], a ; $d081
	ld a, c
	ld [W_BASECOORDY], a ; $d082
	ld d, $4
.asm_41549
	call Func_41510
	call Func_414e8
	ld c, $8
	call DelayFrames
	dec d
	jr nz, .asm_41549
	ret

; known jump sources: 4150d (10:550d)
Func_41558: ; 41558 (10:5558)
	ld hl, Unknown_41574 ; $5574
	ld c, $4
	xor a
.asm_4155e
	push bc
	ld e, [hl]
	inc hl
	ld d, [hl]
	inc hl
	ld c, [hl]
	inc hl
	ld b, [hl]
	inc hl
	push hl
	inc a
	push af
	call WriteOAMBlock
	pop af
	pop hl
	pop bc
	dec c
	jr nz, .asm_4155e
	ret

Unknown_41574: ; 41574 (10:5574)
INCBIN "baserom.gbc",$41574,$415a4 - $41574

; known jump sources: 4126e (10:526e), 41355 (10:5355)
Func_415a4: ; 415a4 (10:55a4)
	ld [$cf91], a
	ld [$d0b5], a
	ld [$cf1d], a
	ld b, $b
	ld c, $0
	call GoPAL_SET
	ld a, [H_AUTOBGTRANSFERENABLED] ; $FF00+$ba
	xor $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call GetMonHeader
	FuncCoord 7, 2 ; $c3cf
	ld hl, Coord
	call LoadFlippedFrontSpriteByMonIndex
	ld c, $a
	jp DelayFrames

; known jump sources: 4133b (10:533b)
Func_415c8: ; 415c8 (10:55c8)
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call ClearScreen
	ld a, $e3
	ld [rLCDC], a ; $FF00+$40
	ld a, $7
	ld [rWX], a ; $FF00+$4b
	xor a
	ld [$FF00+$b0], a
	ld a, $90
	ld [$FF00+$ae], a
	ret

; known jump sources: 41609 (10:5609), 4163f (10:563f)
Func_415df: ; 415df (10:55df)
	ld c, $32
	call DelayFrames
.asm_415e4
	call DelayFrame
	ld a, [rWX] ; $FF00+$4b
	inc a
	inc a
	ld [rWX], a ; $FF00+$4b
	cp $a1
	jr nz, .asm_415e4
	call Func_41196
	ld c, $a
	call DelayFrames
	ld a, $7
	ld [rWX], a ; $FF00+$4b
	ret
	ld hl, UnnamedText_4160c ; $560c
	call PrintText
	ld c, $c8
	call DelayFrames
	jp Func_415df
; 4160c (10:560c)
UnnamedText_4160c: ; 4160c (10:560c)
	TX_FAR _UnnamedText_4160c
	db $50
; 0x4160c + 5 bytes

	ld hl, UnnamedText_41623 ; $5623
	call PrintText
	call Func_41191
	ld hl, UnnamedText_41628 ; $5628
	call PrintText
	jp Func_41191
; 41623 (10:5623)
UnnamedText_41623: ; 41623 (10:5623)
	TX_FAR _UnnamedText_41623
	db $50
; 0x41623 + 5 bytes

UnnamedText_41628: ; 41628 (10:5628)
	TX_FAR _UnnamedText_41628
	db $50
; 0x41628 + 5 bytes

	ld hl, UnnamedText_41642 ; $5642
	call PrintText
	call Func_41191
	ld hl, UnnamedText_41647 ; $5647
	call PrintText
	call Func_41191
	jp Func_415df
; 41642 (10:5642)
UnnamedText_41642: ; 41642 (10:5642)
	TX_FAR _UnnamedText_41642
	db $50
; 0x41642 + 5 bytes

UnnamedText_41647: ; 41647 (10:5647)
	TX_FAR _UnnamedText_41647
	db $50
; 0x41647 + 5 bytes

; known jump sources: 41373 (10:5373)
Func_4164c: ; 4164c (10:564c)
	ld hl, UnnamedText_41655 ; $5655
	call PrintText
	jp Func_41191
; 41655 (10:5655)
UnnamedText_41655: ; 41655 (10:5655)
	TX_FAR _UnnamedText_41655
	db $50
; 0x41655 + 5 bytes

INCBIN "baserom.gbc",$4165a,$4166c - $4165a

UnnamedText_4166c: ; 4166c (10:566c)
	TX_FAR _UnnamedText_4166c
	db $50
; 0x4166c + 5 bytes

UnnamedText_41671: ; 41671 (10:5671)
	TX_FAR _UnnamedText_41671
	db $50
; 0x41671 + 5 bytes

; known jump sources: 41286 (10:5286), 4128b (10:528b), 412d4 (10:52d4), 41338 (10:5338), 4135a (10:535a)
Func_41676: ; 41676 (10:5676)
	ld [W_ANIMATIONID], a ; $d07c
	xor a
	ld [$cc5b], a
	ld a, $8
	jp Predef ; indirect jump to MoveAnimation (78d5e (1e:4d5e))

; known jump sources: 1fee (0:1fee)
PlayIntro: ; 41682 (10:5682)
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	inc a
	ld [H_AUTOBGTRANSFERENABLED], a
	call Func_4188a
	call PlayIntroScene
	call GBFadeOut2
	xor a
	ld [$FF00+$ae], a
	ld [H_AUTOBGTRANSFERENABLED], a
	call CleanLCD_OAM
	call DelayFrame
	ret

PlayIntroScene: ; 4169d (10:569d)
	ld b, $7
	call GoPAL_SET
	ld a, %11100100
	ld [rBGP], a
	ld [rOBP0], a
	ld [rOBP1], a
	xor a
	ld [$FF00+$ae], a
	ld b, $3
	call Func_4183f
	ld a, 0
	ld [W_BASECOORDX], a
	ld a, 80
	ld [W_BASECOORDY], a
	ld bc, $606
	call Func_417c7
	ld de, $28ff
	call Func_4180e
	ret c

; hip
	ld a, $b9
	call PlaySound
	xor a
	ld [$d09f], a
	ld de, Unknown_41910
	call AnimateIntroNidorino
; hop
	ld a, $ba
	call PlaySound
	ld de, Unknown_4191b
	call AnimateIntroNidorino
	ld c, $a
	call CheckForUserInterruption
	ret c

; hip
	ld a, $b9
	call PlaySound
	ld de, Unknown_41910
	call AnimateIntroNidorino
; hop
	ld a, $ba
	call PlaySound
	ld de, Unknown_4191b
	call AnimateIntroNidorino
	ld c, $1e
	call CheckForUserInterruption
	ret c

; raise
	ld b, $4
	call Func_4183f
	ld a, $bb
	call PlaySound
	ld de, $401
	call Func_4180e
	ld c, $1e
	call CheckForUserInterruption
	ret c

; slash
	ld b, $5
	call Func_4183f
	ld a, $bc
	call PlaySound
	ld de, $800
	call Func_4180e
; hip
	ld a, $b9
	call PlaySound
	ld a, $24
	ld [$d09f], a
	ld de, Unknown_41926
	call AnimateIntroNidorino
	ld c, $1e
	call CheckForUserInterruption
	ret c

	ld de, $401
	call Func_4180e
	ld b, $3
	call Func_4183f
	ld c, $3c
	call CheckForUserInterruption
	ret c

; hip
	ld a, $b9
	call PlaySound
	xor a
	ld [$d09f], a
	ld de, Unknown_41931 ; $5931
	call AnimateIntroNidorino
; hop
	ld a, $ba
	call PlaySound
	ld de, Unknown_4193c ; $593c
	call AnimateIntroNidorino
	ld c, $14
	call CheckForUserInterruption
	ret c

	ld a, $24
	ld [$d09f], a
	ld de, Unknown_41947 ; $5947
	call AnimateIntroNidorino
	ld c, $1e
	call CheckForUserInterruption
	ret c

; lunge
	ld a, $b8
	call PlaySound
	ld a, $48
	ld [$d09f], a
	ld de, Unknown_41950 ; $5950
	jp AnimateIntroNidorino

AnimateIntroNidorino: ; 41793 (10:5793)
	ld a, [de]
	cp $50
	ret z
	ld [W_BASECOORDY], a ; $d082
	inc de
	ld a, [de]
	ld [W_BASECOORDX], a ; $d081
	push de
	ld c, $24
	call Func_417ae
	ld c, 5
	call DelayFrames
	pop de
	inc de
	jr AnimateIntroNidorino

; known jump sources: 417a2 (10:57a2), 41829 (10:5829)
Func_417ae: ; 417ae (10:57ae)
	ld hl, W_OAMBUFFER
	ld a, [$d09f]
	ld d, a
.asm_417b5
	ld a, [W_BASECOORDY] ; $d082
	add [hl]
	ld [hli], a
	ld a, [W_BASECOORDX] ; $d081
	add [hl]
	ld [hli], a
	ld a, d
	ld [hli], a
	inc hl
	inc d
	dec c
	jr nz, .asm_417b5
	ret

; known jump sources: 416bf (10:56bf)
Func_417c7: ; 417c7 (10:57c7)
	ld hl, W_OAMBUFFER
	ld d, $0
.asm_417cc
	push bc
	ld a, [W_BASECOORDY] ; $d082
	ld e, a
.asm_417d1
	ld a, e
	add $8
	ld e, a
	ld [hli], a
	ld a, [W_BASECOORDX] ; $d081
	ld [hli], a
	ld a, d
	ld [hli], a
	ld a, $80
	ld [hli], a
	inc d
	dec c
	jr nz, .asm_417d1
	ld a, [W_BASECOORDX] ; $d081
	add $8
	ld [W_BASECOORDX], a ; $d081
	pop bc
	dec b
	jr nz, .asm_417cc
	ret

; known jump sources: 418e9 (10:58e9)
Func_417f0: ; 417f0 (10:57f0)
	ld hl, $9c00
	ld bc, $240
	jr asm_417fe

; known jump sources: 418e0 (10:58e0)
Func_417f8: ; 417f8 (10:57f8)
	FuncCoord 0, 4 ; $c3f0
	ld hl, Coord
	ld bc, $c8
asm_417fe: ; 417fe (10:57fe)
	ld [hl], $0
	inc hl
	dec bc
	ld a, b
	or c
	jr nz, asm_417fe
	ret

; known jump sources: 418f1 (10:58f1), 418f9 (10:58f9), 41901 (10:5901), 41909 (10:5909)
Func_41807: ; 41807 (10:5807)
	ld a, $1
.asm_41809
	ld [hli], a
	dec c
	jr nz, .asm_41809
	ret

; known jump sources: 416c5 (10:56c5), 41712 (10:5712), 41728 (10:5728), 41744 (10:5744), 4183c (10:583c)
Func_4180e: ; 4180e (10:580e)
	ld a, e
	cp $ff
	jr z, .asm_4181d
	cp $1
	jr z, .asm_4182d
	ld a, [$FF00+$ae]
	dec a
	dec a
	jr .asm_41831
.asm_4181d
	push de
	ld a, $2
	ld [W_BASECOORDX], a ; $d081
	xor a
	ld [W_BASECOORDY], a ; $d082
	ld c, $24
	call Func_417ae
	pop de
.asm_4182d
	ld a, [$FF00+$ae]
	inc a
	inc a
.asm_41831
	ld [$FF00+$ae], a
	push de
	ld c, $2
	call CheckForUserInterruption
	pop de
	ret c
	dec d
	jr nz, Func_4180e
	ret

; known jump sources: 416af (10:56af), 41707 (10:5707), 4171d (10:571d), 41749 (10:5749)
Func_4183f: ; 4183f (10:583f)
	FuncCoord 13, 7 ; $c439
	ld hl, Coord

; known jump sources: 412bb (10:52bb), 41443 (10:5443), 41486 (10:5486)
Func_41842: ; 41842 (10:5842)
	ld c, $0
	ld a, $31
	jp Predef ; indirect jump to Func_79dda (79dda (1e:5dda))

INCBIN "baserom.gbc",$41849,$41852 - $41849

; known jump sources: 418ad (10:58ad)
Func_41852: ; 41852 (10:5852)
	ld hl, Unknown_41a99 ; $5a99
	ld de, $9000
	ld bc, $600
	ld a, BANK(Unknown_41a99)
	call FarCopyData2
	ld hl, Unknown_41959 ; $5959
	ld de, $9600
	ld bc, $140
	ld a, BANK(Unknown_41959)
	call FarCopyData2
	ld hl, Unknown_41959 ; $5959
	ld de, $8800
	ld bc, $140
	ld a, BANK(Unknown_41959)
	call FarCopyData2
	ld hl, Unknown_42099 ; $6099
	ld de, $8000
	ld bc, $6c0
	ld a, BANK(Unknown_42099)
	jp FarCopyData2

; known jump sources: 41688 (10:5688)
Func_4188a: ; 4188a (10:588a)
	ld b, $c
	call GoPAL_SET
	ld b, BANK(Func_4538)
	ld hl, Func_4538
	call Bankswitch ; indirect jump to Func_4538 (4538 (1:4538))
	ld a, $e4
	ld [rBGP], a ; $FF00+$47
	ld c, $b4
	call DelayFrames
	call ClearScreen
	call DisableLCD
	xor a
	ld [W_CUROPPONENT], a ; $d059
	call Func_418e9
	call Func_41852
	call EnableLCD
	ld hl, rLCDC ; $ff40
	res 5, [hl]
	set 3, [hl]
	ld c, $40
	call DelayFrames
	ld b, BANK(Func_70044)
	ld hl, Func_70044
	call Bankswitch ; indirect jump to Func_70044 (70044 (1c:4044))
	push af
	pop af
	jr c, .asm_418d0
	ld c, $28
	call DelayFrames
.asm_418d0
	ld a, $1f
	ld [$c0ef], a
	ld [$c0f0], a
	ld a, $dc
	ld [$c0ee], a
	call PlaySound
	call Func_417f8
	call CleanLCD_OAM
	jp Delay3

; known jump sources: 418aa (10:58aa)
Func_418e9: ; 418e9 (10:58e9)
	call Func_417f0
	ld hl, W_SCREENTILESBUFFER
	ld c, $50
	call Func_41807
	FuncCoord 0, 14 ; $c4b8
	ld hl, Coord
	ld c, $50
	call Func_41807
	ld hl, $9c00
	ld c, $80
	call Func_41807
	ld hl, $9dc0
	ld c, $80
	jp Func_41807

INCBIN "baserom.gbc",$4190c,$41910 - $4190c

Unknown_41910: ; 41910 (10:5910)
INCBIN "baserom.gbc",$41910,$4191b - $41910

Unknown_4191b: ; 4191b (10:591b)
INCBIN "baserom.gbc",$4191b,$41926 - $4191b

Unknown_41926: ; 41926 (10:5926)
INCBIN "baserom.gbc",$41926,$41931 - $41926

Unknown_41931: ; 41931 (10:5931)
INCBIN "baserom.gbc",$41931,$4193c - $41931

Unknown_4193c: ; 4193c (10:593c)
INCBIN "baserom.gbc",$4193c,$41947 - $4193c

Unknown_41947: ; 41947 (10:5947)
INCBIN "baserom.gbc",$41947,$41950 - $41947

Unknown_41950: ; 41950 (10:5950)
INCBIN "baserom.gbc",$41950,$41959 - $41950

Unknown_41959: ; 41959 (10:5959)
INCBIN "baserom.gbc",$41959,$41a99 - $41959

Unknown_41a99: ; 41a99 (10:5a99)
INCBIN "baserom.gbc",$41a99,$42099 - $41a99

Unknown_42099: ; 42099 (10:6099)
INCBIN "baserom.gbc",$42099,$420d9 - $42099

IF _RED
	INCBIN "gfx/red/introfight.2bpp"
ENDC
IF _BLUE
	INCBIN "gfx/blue/introfight.2bpp"
ENDC

; XXX what do these do
Func_42769: ; 42769 (10:6769)
	FuncCoord 5,0
	ld hl,Coord
	ld de,OTString67E5
	call PlaceString
	ld a,[$CD3D]
	ld [$D11E],a
	ld a,$3A
	call Predef
	FuncCoord 9, 0 ; $c3a9
	ld hl,Coord
	ld de,$D11E
	ld bc,$8103
	call PrintNumber
	FuncCoord 5,2
	ld hl,Coord
	ld de,$CF4B
	call PlaceString
	FuncCoord 8,4
	ld hl,Coord
	ld de,$CD41
	call PlaceString
	FuncCoord 8, 6 ; $c420
	ld hl,Coord
	ld de,$CD4C
	ld bc,$8205
	jp PrintNumber

Func_427a7: ; 427a7 (10:67a7)
	FuncCoord 5,10
	ld hl,Coord
	ld de,OTString67E5
	call PlaceString
	ld a,[$CD3E]
	ld [$D11E],a
	ld a,$3A
	call Predef
	FuncCoord 9, 10 ; $c471
	ld hl,Coord
	ld de,$D11E
	ld bc,$8103
	call PrintNumber
	FuncCoord 5,12
	ld hl,Coord
	ld de,$CD6D
	call PlaceString
	FuncCoord 8,14
	ld hl,Coord
	ld de,$CD4E
	call PlaceString
	FuncCoord 8, 16 ; $c4e8
	ld hl,Coord
	ld de,$CD59
	ld bc,$8205
	jp PrintNumber

OTString67E5: ; 427e5 (10:67e5)
	db "──",$74,$F2,$4E
	db $4E
	db "OT/",$4E
	db $73,"№",$F2,"@"

SECTION "bank11",ROMX,BANK[$11]

LavenderTown_h: ; 0x44000 to 0x4402d (45 bytes) (bank=11) (id=4)
	db $00 ; tileset
	db LAVENDER_TOWN_HEIGHT, LAVENDER_TOWN_WIDTH ; dimensions (y, x)
	dw LavenderTownBlocks, LavenderTownTexts, LavenderTownScript ; blocks, texts, scripts
	db NORTH | SOUTH | WEST ; connections

	; connections data

	db ROUTE_10
	dw Route10Blocks + (ROUTE_10_HEIGHT - 3) * ROUTE_10_WIDTH ; connection strip location
	dw $C6EB + 0 ; current map position
	db ROUTE_10_WIDTH, ROUTE_10_WIDTH ; bigness, width
	db (ROUTE_10_HEIGHT * 2) - 1, (0 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_10_HEIGHT * (ROUTE_10_WIDTH + 6) ; window

	db ROUTE_12
	dw Route12Blocks ; connection strip location
	dw $C6EB + (LAVENDER_TOWN_HEIGHT + 3) * (LAVENDER_TOWN_WIDTH + 6) + 0 ; current map position
	db ROUTE_12_WIDTH, ROUTE_12_WIDTH ; bigness, width
	db 0, (0 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_12_WIDTH ; window

	db ROUTE_8
	dw Route8Blocks - 3 + (ROUTE_8_WIDTH) ; connection strip location
	dw $C6E8 + (LAVENDER_TOWN_WIDTH + 6) * (0 + 3) ; current map position
	db ROUTE_8_HEIGHT, ROUTE_8_WIDTH ; bigness, width
	db (0 * -2), (ROUTE_8_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_8_WIDTH ; window

	; end connections data

	dw LavenderTownObject ; objects

LavenderTownObject: ; 0x4402d (size=88)
	db $2c ; border tile

	db $6 ; warps
	db $5, $3, $0, LAVENDER_POKECENTER
	db $5, $e, $0, POKEMONTOWER_1
	db $9, $7, $0, LAVENDER_HOUSE_1
	db $d, $f, $0, LAVENDER_MART
	db $d, $3, $0, LAVENDER_HOUSE_2
	db $d, $7, $0, NAME_RATERS_HOUSE

	db $6 ; signs
	db $9, $b, $4 ; LavenderTownText4
	db $3, $9, $5 ; LavenderTownText5
	db $d, $10, $6 ; MartSignText
	db $5, $4, $7 ; PokeCenterSignText
	db $9, $5, $8 ; LavenderTownText8
	db $7, $11, $9 ; LavenderTownText9

	db $3 ; people
	db SPRITE_LITTLE_GIRL, $9 + 4, $f + 4, $fe, $0, $1 ; person
	db SPRITE_BLACK_HAIR_BOY_1, $a + 4, $9 + 4, $ff, $ff, $2 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $7 + 4, $8 + 4, $fe, $2, $3 ; person

	; warp-to
	EVENT_DISP $a, $5, $3 ; LAVENDER_POKECENTER
	EVENT_DISP $a, $5, $e ; POKEMONTOWER_1
	EVENT_DISP $a, $9, $7 ; LAVENDER_HOUSE_1
	EVENT_DISP $a, $d, $f ; LAVENDER_MART
	EVENT_DISP $a, $d, $3 ; LAVENDER_HOUSE_2
	EVENT_DISP $a, $d, $7 ; NAME_RATERS_HOUSE

LavenderTownBlocks: ; 44085 (11:4085)
	INCBIN "maps/lavendertown.blk"

ViridianPokecenterBlocks: ; 440df (11:40df)
	INCBIN "maps/viridianpokecenter.blk"

SafariZoneRestHouse1Blocks: ; 440fb (11:40fb)
	INCBIN "maps/safarizoneresthouse1.blk"

LavenderTownScript: ; 4410b (11:410b)
	jp EnableAutoTextBoxDrawing
; 0x4410e

LavenderTownTexts: ; 4410e (11:410e)
	dw LavenderTownText1, LavenderTownText2, LavenderTownText3, LavenderTownText4, LavenderTownText5, MartSignText, PokeCenterSignText, LavenderTownText8, LavenderTownText9

LavenderTownText1: ; 44120 (11:4120)
	db $08 ; asm
	ld hl, UnnamedText_4413c
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	ld hl, UnnamedText_44146
	jr nz, .asm_40831 ; 0x44131
	ld hl, UnnamedText_44141
.asm_40831 ; 0x44136
	call PrintText
	jp TextScriptEnd

UnnamedText_4413c: ; 4413c (11:413c)
	TX_FAR _UnnamedText_4413c
	db $50
; 0x4413c + 5 bytes

UnnamedText_44141: ; 44141 (11:4141)
	TX_FAR _UnnamedText_44141
	db $50
; 0x44141 + 5 bytes

UnnamedText_44146: ; 44146 (11:4146)
	TX_FAR _UnnamedText_44146
	db $50
; 0x44146 + 5 bytes

LavenderTownText2: ; 4414b (11:414b)
	TX_FAR _LavenderTownText2
	db $50

LavenderTownText3: ; 44150 (11:4150)
	TX_FAR _LavenderTownText3
	db $50

LavenderTownText4: ; 44155 (11:4155)
	TX_FAR _LavenderTownText4
	db $50

LavenderTownText5: ; 4415a (11:415a)
	TX_FAR _LavenderTownText5
	db $50

LavenderTownText8: ; 4415f (11:415f)
	TX_FAR _LavenderTownText8
	db $50

LavenderTownText9: ; 44164 (11:4164)
	TX_FAR _LavenderTownText9
	db $50

DisplayDexRating: ; 44169 (11:4169)
	ld hl, W_SEENPOKEMON
	ld b, $13
	call CountSetBits
	ld a, [$D11E] ; result of CountSetBits (seen count)
	ld [$FFDB], a
	ld hl, W_OWNEDPOKEMON
	ld b, $13
	call CountSetBits
	ld a, [$D11E] ; result of CountSetBits (own count)
	ld [$FFDC], a
	ld hl, DexRatingsTable
.findRating
	ld a, [hli]
	ld b, a
	ld a, [$FFDC] ; number of pokemon owned
	cp b
	jr c, .foundRating
	inc hl
	inc hl
	jr .findRating
.foundRating
	ld a, [hli]
	ld h, [hl]
	ld l, a ; load text pointer into hl
	ld a, [$D747]
	bit 3, a
	res 3, a
	ld [$D747], a
	jr nz, .label3
	push hl
	ld hl, UnnamedText_441cc
	call PrintText
	pop hl
	call PrintText
	ld b, BANK(Func_7d13b)
	ld hl, Func_7d13b
	call Bankswitch
	jp WaitForTextScrollButtonPress ; wait for button press
.label3
	ld de, $CC5B
	ld a, [$FFDB]
	ld [de], a
	inc de
	ld a, [$FFDC]
	ld [de], a
	inc de
.label4
	ld a, [hli]
	cp a, $50
	jr z, .label5
	ld [de], a
	inc de
	jr .label4
.label5
	ld [de], a
	ret

UnnamedText_441cc: ; 441cc (11:41cc)
	TX_FAR _UnnamedText_441cc
	db $50
; 0x441cc + 5 bytes

DexRatingsTable: ; 441d1 (11:41d1)
	db 10
	dw UnnamedText_44201
	db 20
	dw UnnamedText_44206
	db 30
	dw UnnamedText_4420b
	db 40
	dw UnnamedText_44210
	db 50
	dw UnnamedText_44215
	db 60
	dw UnnamedText_4421a
	db 70
	dw UnnamedText_4421f
	db 80
	dw UnnamedText_44224
	db 90
	dw UnnamedText_44229
	db 100
	dw UnnamedText_4422e
	db 110
	dw UnnamedText_44233
	db 120
	dw UnnamedText_44238
	db 130
	dw UnnamedText_4423d
	db 140
	dw UnnamedText_44242
	db 150
	dw UnnamedText_44247
	db 152
	dw UnnamedText_4424c

UnnamedText_44201: ; 44201 (11:4201)
	TX_FAR _UnnamedText_44201
	db $50
; 0x44201 + 5 bytes

UnnamedText_44206: ; 44206 (11:4206)
	TX_FAR _UnnamedText_44206
	db $50
; 0x44206 + 5 bytes

UnnamedText_4420b: ; 4420b (11:420b)
	TX_FAR _UnnamedText_4420b
	db $50
; 0x4420b + 5 bytes

UnnamedText_44210: ; 44210 (11:4210)
	TX_FAR _UnnamedText_44210
	db $50
; 0x44210 + 5 bytes

UnnamedText_44215: ; 44215 (11:4215)
	TX_FAR _UnnamedText_44215
	db $50
; 0x44215 + 5 bytes

UnnamedText_4421a: ; 4421a (11:421a)
	TX_FAR _UnnamedText_4421a
	db $50
; 0x4421a + 5 bytes

UnnamedText_4421f: ; 4421f (11:421f)
	TX_FAR _UnnamedText_4421f
	db $50
; 0x4421f + 5 bytes

UnnamedText_44224: ; 44224 (11:4224)
	TX_FAR _UnnamedText_44224
	db $50
; 0x44224 + 5 bytes

UnnamedText_44229: ; 44229 (11:4229)
	TX_FAR _UnnamedText_44229
	db $50
; 0x44229 + 5 bytes

UnnamedText_4422e: ; 4422e (11:422e)
	TX_FAR _UnnamedText_4422e
	db $50
; 0x4422e + 5 bytes

UnnamedText_44233: ; 44233 (11:4233)
	TX_FAR _UnnamedText_44233
	db $50
; 0x44233 + 5 bytes

UnnamedText_44238: ; 44238 (11:4238)
	TX_FAR _UnnamedText_44238
	db $50
; 0x44238 + 5 bytes

UnnamedText_4423d: ; 4423d (11:423d)
	TX_FAR _UnnamedText_4423d
	db $50
; 0x4423d + 5 bytes

UnnamedText_44242: ; 44242 (11:4242)
	TX_FAR _UnnamedText_44242
	db $50
; 0x44242 + 5 bytes

UnnamedText_44247: ; 44247 (11:4247)
	TX_FAR _UnnamedText_44247
	db $50
; 0x44247 + 5 bytes

UnnamedText_4424c: ; 4424c (11:424c)
	TX_FAR _UnnamedText_4424c
	db $50
; 0x4424c + 5 bytes

ViridianPokecenter_h: ; 0x44251 to 0x4425d (12 bytes) (bank=11) (id=41)
	db $06 ; tileset
	db $04, $07 ; dimensions (y, x)
	dw ViridianPokecenterBlocks, ViridianPokecenterTexts, ViridianPokeCenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw ViridianPokecenterObject ; objects

ViridianPokeCenterScript: ; 4425d (11:425d)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x44263

ViridianPokecenterTexts: ; 44263 (11:4263)
	dw ViridianPokeCenterText1, ViridianPokeCenterText2, ViridianPokeCenterText3, ViridianPokeCenterText4

ViridianPokeCenterText1: ; 4426b (11:426b)
	db $ff

ViridianPokeCenterText2: ; 4426c (11:426c)
	TX_FAR _ViridianPokeCenterText1
	db $50


ViridianPokeCenterText3: ; 44271 (11:4271)
	TX_FAR _ViridianPokeCenterText3
	db $50

ViridianPokeCenterText4: ; 44276 (11:4276)
	db $f6

ViridianPokecenterObject: ; 0x44277 (size=44)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $0, $ff
	db $7, $4, $0, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_GENTLEMAN, $5 + 4, $a + 4, $fe, $1, $2 ; person
	db SPRITE_BLACK_HAIR_BOY_1, $3 + 4, $4 + 4, $ff, $ff, $3 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

Mansion1_h: ; 0x442a3 to 0x442af (12 bytes) (bank=11) (id=165)
	db $16 ; tileset
	db MANSION_1_HEIGHT, MANSION_1_WIDTH ; dimensions (y, x)
	dw Mansion1Blocks, Mansion1Texts, Mansion1Script ; blocks, texts, scripts
	db $00 ; connections

	dw Mansion1Object ; objects

Mansion1Script: ; 442af (11:42af)
	call Mansion1Subscript1
	call EnableAutoTextBoxDrawing
	ld hl, Mansion1TrainerHeaders
	ld de, Unknown_44326 ; $4326
	ld a, [W_MANSION1CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_MANSION1CURSCRIPT], a
	ret
; 0x442c5

Mansion1Subscript1: ; 442c5 (11:42c5)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld a, [$d796]
	bit 0, a
	jr nz, .asm_442ec ; 0x442d2 $18
	ld bc, $060c
	call Func_4430b
	ld bc, $0308
	call Func_44304
	ld bc, $080a
	call Func_44304
	ld bc, $0d0d
	jp Func_44304
.asm_442ec
	ld bc, $060c
	call Func_44304
	ld bc, $0308
	call Func_4430b
	ld bc, $080a
	call Func_4430b
	ld bc, $0d0d
	jp Func_4430b
; 0x44304

; known jump sources: 442dd (11:42dd), 442e3 (11:42e3), 442e9 (11:42e9), 442ef (11:42ef)
Func_44304: ; 44304 (11:4304)
	ld a, $2d
	ld [$d09f], a
	jr asm_44310

; known jump sources: 442d7 (11:42d7), 442f5 (11:42f5), 442fb (11:42fb), 44301 (11:4301)
Func_4430b: ; 4430b (11:430b)
	ld a, $e
	ld [$d09f], a
asm_44310: ; 44310 (11:4310)
	ld a, $17
	call Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))
	ret

INCBIN "baserom.gbc",$44316,$44326 - $44316

Unknown_44326: ; 44326 (11:4326)
INCBIN "baserom.gbc",$44326,$4432c - $44326

Mansion1Texts: ; 4432c (11:432c)
	dw Mansion1Text1, Predef5CText, Predef5CText, Mansion1Text4

Mansion1TrainerHeaders: ; 44334 (11:4334)
Mansion1TrainerHeader0: ; 44334 (11:4334)
	db $1 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d798 ; flag's byte
	dw Mansion1BattleText2 ; 0x434b TextBeforeBattle
	dw Mansion1AfterBattleText2 ; 0x4355 TextAfterBattle
	dw Mansion1EndBattleText2 ; 0x4350 TextEndBattle
	dw Mansion1EndBattleText2 ; 0x4350 TextEndBattle
; 0x44340

db $ff

Mansion1Text1: ; 44341 (11:4341)
	db $08 ; asm
	ld hl, Mansion1TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Mansion1BattleText2: ; 4434b (11:434b)
	TX_FAR _Mansion1BattleText2
	db $50
; 0x4434b + 5 bytes

Mansion1EndBattleText2: ; 44350 (11:4350)
	TX_FAR _Mansion1EndBattleText2
	db $50
; 0x44350 + 5 bytes

Mansion1AfterBattleText2: ; 44355 (11:4355)
	TX_FAR _Mansion1AfterBattleText2
	db $50
; 0x44355 + 5 bytes

Mansion1Text4: ; 4435a (11:435a)
	db $8
	ld hl, UnnamedText_44395
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_4438c ; 0x44368 $22
	ld a, $1
	ld [$cc3c], a
	ld hl, $d126
	set 5, [hl]
	ld hl, UnnamedText_4439a
	call PrintText
	ld a, $ad
	call PlaySound
	ld hl, $d796
	bit 0, [hl]
	set 0, [hl]
	jr z, .asm_44392 ; 0x44386 $a
	res 0, [hl]
	jr .asm_44392 ; 0x4438a $6
.asm_4438c
	ld hl, UnnamedText_4439f
	call PrintText
.asm_44392
	jp TextScriptEnd
; 0x44395

UnnamedText_44395: ; 44395 (11:4395)
	TX_FAR _UnnamedText_44395
	db $50
; 0x44395 + 5 bytes

UnnamedText_4439a: ; 4439a (11:439a)
	TX_FAR _UnnamedText_4439a
	db $50
; 0x4439a + 5 bytes

UnnamedText_4439f: ; 4439f (11:439f)
	TX_FAR _UnnamedText_4439f
	db $50
; 0x4439f + 5 bytes

Mansion1Object: ; 0x443a4 (size=90)
	db $2e ; border tile

	db $8 ; warps
	db $1b, $4, $0, $ff
	db $1b, $5, $0, $ff
	db $1b, $6, $0, $ff
	db $1b, $7, $0, $ff
	db $a, $5, $0, MANSION_2
	db $17, $15, $0, MANSION_4
	db $1b, $1a, $0, $ff
	db $1b, $1b, $0, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_OAK_AIDE, $11 + 4, $11 + 4, $ff, $d2, $41, SCIENTIST + $C8, $4 ; trainer
	db SPRITE_BALL, $3 + 4, $e + 4, $ff, $ff, $82, ESCAPE_ROPE ; item
	db SPRITE_BALL, $15 + 4, $12 + 4, $ff, $ff, $83, CARBOS ; item

	; warp-to
	EVENT_DISP $f, $1b, $4
	EVENT_DISP $f, $1b, $5
	EVENT_DISP $f, $1b, $6
	EVENT_DISP $f, $1b, $7
	EVENT_DISP $f, $a, $5 ; MANSION_2
	EVENT_DISP $f, $17, $15 ; MANSION_4
	EVENT_DISP $f, $1b, $1a
	EVENT_DISP $f, $1b, $1b

Mansion1Blocks: ; 443fe (11:43fe)
	INCBIN "maps/mansion1.blk"

RockTunnel1_h: ; 0x444d0 to 0x444dc (12 bytes) (bank=11) (id=82)
	db $11 ; tileset
	db ROCK_TUNNEL_1_HEIGHT, ROCK_TUNNEL_1_WIDTH ; dimensions (y, x)
	dw RockTunnel1Blocks, RockTunnel1Texts, RockTunnel1Script ; blocks, texts, scripts
	db $00 ; connections

	dw RockTunnel1Object ; objects

RockTunnel1Script: ; 444dc (11:44dc)
	call EnableAutoTextBoxDrawing
	ld hl, Unnamed_44505 ; $4505
	ld de, Unnamed_444ef ; $44ef
	ld a, [W_ROCKTUNNEL1CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROCKTUNNEL1CURSCRIPT], a
	ret
; 0x444ef

Unnamed_444ef: ; 444ef (11:44ef)
INCBIN "baserom.gbc",$444ef,$444f5 - $444ef

RockTunnel1Texts: ; 444f5 (11:44f5)
	dw RockTunnel1Text1, RockTunnel1Text2, RockTunnel1Text3, RockTunnel1Text4, RockTunnel1Text5, RockTunnel1Text6, RockTunnel1Text7, RockTunnel1Text8

Unnamed_44505: ; 44505 (11:4505)
INCBIN "baserom.gbc",$44505,$44511 - $44505

Unknown_44511: ; 44511 (11:4511)
INCBIN "baserom.gbc",$44511,$4451d - $44511

Unknown_4451d: ; 4451d (11:451d)
INCBIN "baserom.gbc",$4451d,$44529 - $4451d

Unknown_44529: ; 44529 (11:4529)
INCBIN "baserom.gbc",$44529,$44535 - $44529

Unknown_44535: ; 44535 (11:4535)
INCBIN "baserom.gbc",$44535,$44541 - $44535

Unknown_44541: ; 44541 (11:4541)
INCBIN "baserom.gbc",$44541,$4454d - $44541

Unknown_4454d: ; 4454d (11:454d)
INCBIN "baserom.gbc",$4454d,$4455a - $4454d

RockTunnel1Text1: ; 4455a (11:455a)
	db $8
	ld hl, Unnamed_44505 ; $4505
	jr asm_0c916 ; 0x4455e $22

RockTunnel1Text2: ; 44560 (11:4560)
	db $8
	ld hl, Unknown_44511 ; $4511
	jr asm_0c916 ; 0x44564 $1c

RockTunnel1Text3: ; 44566 (11:4566)
	db $8
	ld hl, Unknown_4451d ; $451d
	jr asm_0c916 ; 0x4456a $16

RockTunnel1Text4: ; 4456c (11:456c)
	db $8
	ld hl, Unknown_44529 ; $4529
	jr asm_0c916 ; 0x44570 $10

RockTunnel1Text5: ; 44572 (11:4572)
	db $8
	ld hl, Unknown_44535 ; $4535
	jr asm_0c916 ; 0x44576 $a

RockTunnel1Text6: ; 44578 (11:4578)
	db $8
	ld hl, Unknown_44541 ; $4541
	jr asm_0c916 ; 0x4457c $4

RockTunnel1Text7: ; 4457e (11:457e)
	db $8
	ld hl, Unknown_4454d ; $454d
asm_0c916: ; 44582 (11:4582)
	call TalkToTrainer
	jp TextScriptEnd

UnnamedText_44588: ; 44588 (11:4588)
	TX_FAR _UnnamedText_44588
	db $50
; 0x44588 + 5 bytes

UnnamedText_4458d: ; 4458d (11:458d)
	TX_FAR _UnnamedText_4458d
	db $50
; 0x4458d + 5 bytes

UnnamedText_44592: ; 44592 (11:4592)
	TX_FAR _UnnamedText_44592
	db $50
; 0x44592 + 5 bytes

UnnamedText_44597: ; 44597 (11:4597)
	TX_FAR _UnnamedText_44597
	db $50
; 0x44597 + 5 bytes

UnnamedText_4459c: ; 4459c (11:459c)
	TX_FAR _UnnamedText_4459c
	db $50
; 0x4459c + 5 bytes

UnnamedText_445a1: ; 445a1 (11:45a1)
	TX_FAR _UnnamedText_445a1
	db $50
; 0x445a1 + 5 bytes

UnnamedText_445a6: ; 445a6 (11:45a6)
	TX_FAR _UnnamedText_445a6
	db $50
; 0x445a6 + 5 bytes

UnnamedText_445ab: ; 445ab (11:45ab)
	TX_FAR _UnnamedText_445ab
	db $50
; 0x445ab + 5 bytes

UnnamedText_445b0: ; 445b0 (11:45b0)
	TX_FAR _UnnamedText_445b0
	db $50
; 0x445b0 + 5 bytes

UnnamedText_445b5: ; 445b5 (11:45b5)
	TX_FAR _UnnamedText_445b5
	db $50
; 0x445b5 + 5 bytes

UnnamedText_445ba: ; 445ba (11:45ba)
	TX_FAR _UnnamedText_445ba
	db $50
; 0x445ba + 5 bytes

UnnamedText_445bf: ; 445bf (11:45bf)
	TX_FAR _UnnamedText_445bf
	db $50
; 0x445bf + 5 bytes

UnnamedText_445c4: ; 445c4 (11:45c4)
	TX_FAR _UnnamedText_445c4
	db $50
; 0x445c4 + 5 bytes

UnnamedText_445c9: ; 445c9 (11:45c9)
	TX_FAR _UnnamedText_445c9
	db $50
; 0x445c9 + 5 bytes

UnnamedText_445ce: ; 445ce (11:45ce)
	TX_FAR _UnnamedText_445ce
	db $50
; 0x445ce + 5 bytes

UnnamedText_445d3: ; 445d3 (11:45d3)
	TX_FAR _UnnamedText_445d3
	db $50
; 0x445d3 + 5 bytes

UnnamedText_445d8: ; 445d8 (11:45d8)
	TX_FAR _UnnamedText_445d8
	db $50
; 0x445d8 + 5 bytes

UnnamedText_445dd: ; 445dd (11:45dd)
	TX_FAR _UnnamedText_445dd
	db $50
; 0x445dd + 5 bytes

UnnamedText_445e2: ; 445e2 (11:45e2)
	TX_FAR _UnnamedText_445e2
	db $50
; 0x445e2 + 5 bytes

UnnamedText_445e7: ; 445e7 (11:45e7)
	TX_FAR _UnnamedText_445e7
	db $50
; 0x445e7 + 5 bytes

UnnamedText_445ec: ; 445ec (11:45ec)
	TX_FAR _UnnamedText_445ec
	db $50
; 0x445ec + 5 bytes

RockTunnel1Text8: ; 445f1 (11:45f1)
	TX_FAR _RockTunnel1Text8
	db $50

RockTunnel1Object: ; 0x445f6 (size=127)
	db $3 ; border tile

	db $8 ; warps
	db $3, $f, $1, $ff
	db $0, $f, $1, $ff
	db $21, $f, $2, $ff
	db $23, $f, $2, $ff
	db $3, $25, $0, ROCK_TUNNEL_2
	db $3, $5, $1, ROCK_TUNNEL_2
	db $b, $11, $2, ROCK_TUNNEL_2
	db $11, $25, $3, ROCK_TUNNEL_2

	db $1 ; signs
	db $1d, $b, $8 ; RockTunnel1Text8

	db $7 ; people
	db SPRITE_HIKER, $5 + 4, $7 + 4, $ff, $d0, $41, HIKER + $C8, $c ; trainer
	db SPRITE_HIKER, $10 + 4, $5 + 4, $ff, $d0, $42, HIKER + $C8, $d ; trainer
	db SPRITE_HIKER, $f + 4, $11 + 4, $ff, $d2, $43, HIKER + $C8, $e ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $8 + 4, $17 + 4, $ff, $d2, $44, POKEMANIAC + $C8, $7 ; trainer
	db SPRITE_LASS, $15 + 4, $25 + 4, $ff, $d2, $45, JR__TRAINER_F + $C8, $11 ; trainer
	db SPRITE_LASS, $18 + 4, $16 + 4, $ff, $d0, $46, JR__TRAINER_F + $C8, $12 ; trainer
	db SPRITE_LASS, $18 + 4, $20 + 4, $ff, $d3, $47, JR__TRAINER_F + $C8, $13 ; trainer

	; warp-to
	EVENT_DISP $14, $3, $f
	EVENT_DISP $14, $0, $f
	EVENT_DISP $14, $21, $f
	EVENT_DISP $14, $23, $f
	EVENT_DISP $14, $3, $25 ; ROCK_TUNNEL_2
	EVENT_DISP $14, $3, $5 ; ROCK_TUNNEL_2
	EVENT_DISP $14, $b, $11 ; ROCK_TUNNEL_2
	EVENT_DISP $14, $11, $25 ; ROCK_TUNNEL_2

RockTunnel1Blocks: ; 44675 (11:4675)
	INCBIN "maps/rocktunnel1.blk"

SeafoamIslands1_h: ; 0x447dd to 0x447e9 (12 bytes) (bank=11) (id=192)
	db $11 ; tileset
	db SEAFOAM_ISLANDS_1_HEIGHT, SEAFOAM_ISLANDS_1_WIDTH ; dimensions (y, x)
	dw SeafoamIslands1Blocks, SeafoamIslands1Texts, SeafoamIslands1Script ; blocks, texts, scripts
	db $00 ; connections

	dw SeafoamIslands1Object ; objects

SeafoamIslands1Script: ; 447e9 (11:47e9)
	call EnableAutoTextBoxDrawing
	ld hl, $d7e7
	set 0, [hl]
	ld hl, W_FLAGS_CD60
	bit 7, [hl]
	res 7, [hl]
	jr z, .asm_4483b ; 0x447f8 $41
	ld hl, Seafoam1HolesCoords
	call CheckBoulderCoords
	ret nc
	ld hl, $d7e8
	ld a, [$cd3d]
	cp $1
	jr nz, .asm_44819 ; 0x44809 $e
	set 6, [hl]
	ld a, $d7
	ld [$d079], a
	ld a, $d9
	ld [$d07a], a
	jr .asm_44825 ; 0x44817 $c
.asm_44819
	set 7, [hl]
	ld a, $d8
	ld [$d079], a
	ld a, $da
	ld [$d07a], a
.asm_44825
	ld a, [$d079]
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, [$d07a]
	ld [$cc4d], a
	ld a, $15
	jp Predef
.asm_4483b
	ld a, $9f
	ld [$d71d], a
	ld hl, Seafoam1HolesCoords
	jp Func_46981
; 0x44846

Seafoam1HolesCoords: ; 44846 (11:4846)
	db $06,$11
	db $06,$18
	db $ff

SeafoamIslands1Texts: ; 4484b (11:484b)
	dw BoulderText, BoulderText

SeafoamIslands1Object: ; 0x4484f (size=72)
	db $7d ; border tile

	db $7 ; warps
	db $11, $4, $0, $ff
	db $11, $5, $0, $ff
	db $11, $1a, $1, $ff
	db $11, $1b, $1, $ff
	db $5, $7, $1, SEAFOAM_ISLANDS_2
	db $3, $19, $6, SEAFOAM_ISLANDS_2
	db $f, $17, $4, SEAFOAM_ISLANDS_2

	db $0 ; signs

	db $2 ; people
	db SPRITE_BOULDER, $a + 4, $12 + 4, $ff, $10, $1 ; person
	db SPRITE_BOULDER, $7 + 4, $1a + 4, $ff, $10, $2 ; person

	; warp-to
	EVENT_DISP $f, $11, $4
	EVENT_DISP $f, $11, $5
	EVENT_DISP $f, $11, $1a
	EVENT_DISP $f, $11, $1b
	EVENT_DISP $f, $5, $7 ; SEAFOAM_ISLANDS_2
	EVENT_DISP $f, $3, $19 ; SEAFOAM_ISLANDS_2
	EVENT_DISP $f, $f, $17 ; SEAFOAM_ISLANDS_2

INCBIN "baserom.gbc",$44897,$4489f - $44897

SeafoamIslands1Blocks: ; 4489f (11:489f)
	INCBIN "maps/seafoamislands1.blk"

SSAnne3_h: ; 0x44926 to 0x44932 (12 bytes) (bank=11) (id=97)
	db $0d ; tileset
	db SS_ANNE_3_HEIGHT, SS_ANNE_3_WIDTH ; dimensions (y, x)
	dw SSAnne3Blocks, SSAnne3Texts, SSAnne3Script ; blocks, texts, scripts
	db $00 ; connections

	dw SSAnne3Object ; objects

SSAnne3Script: ; 44932 (11:4932)
	jp EnableAutoTextBoxDrawing
; 0x44935

SSAnne3Texts: ; 44935 (11:4935)
	dw SSAnne3Text1

SSAnne3Text1: ; 44937 (11:4937)
	TX_FAR _SSAnne3Text1
	db $50

SSAnne3Object: ; 0x4493c (size=26)
	db $c ; border tile

	db $2 ; warps
	db $3, $0, $0, SS_ANNE_5
	db $3, $13, $7, SS_ANNE_2

	db $0 ; signs

	db $1 ; people
	db SPRITE_SAILOR, $3 + 4, $9 + 4, $fe, $2, $1 ; person

	; warp-to
	EVENT_DISP $a, $3, $0 ; SS_ANNE_5
	EVENT_DISP $a, $3, $13 ; SS_ANNE_2

SSAnne3Blocks: ; 44956 (11:4956)
	INCBIN "maps/ssanne3.blk"

VictoryRoad3_h: ; 0x44974 to 0x44980 (12 bytes) (bank=11) (id=198)
	db $11 ; tileset
	db VICTORY_ROAD_3_HEIGHT, VICTORY_ROAD_3_WIDTH ; dimensions (y, x)
	dw VictoryRoad3Blocks, VictoryRoad3Texts, VictoryRoad3Script ; blocks, texts, scripts
	db $00 ; connections

	dw VictoryRoad3Object ; objects

VictoryRoad3Script: ; 44980 (11:4980)
	call VictoryRoad3Script_Unknown44996
	call EnableAutoTextBoxDrawing
	ld hl, VictoryRoad3TrainerHeaders
	ld de, Unknown_449b1 ; $49b1
	ld a, [W_VICTORYROAD3CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_VICTORYROAD3CURSCRIPT], a
	ret
; 0x44996

VictoryRoad3Script_Unknown44996: ; 44996 (11:4996)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, $d813
	bit 0, [hl]
	ret z
	ld a, $1d
	ld [$d09f], a
	ld bc, $503
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

Unknown_449b1: ; 449b1 (11:49b1)
INCBIN "baserom.gbc",$449b1,$449b7 - $449b1
	ld hl, W_FLAGS_CD60
	bit 7, [hl]
	res 7, [hl]
	jp z, .asm_449fe
	ld hl, .unknown_449f9 ; $49f9
	call CheckBoulderCoords
	jp nc, .asm_449fe
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $1
	jr nz, .asm_449dc
	ld hl, $d126
	set 5, [hl]
	ld hl, $d813
	set 0, [hl]
	ret
.asm_449dc
	ld hl, $d813
	bit 6, [hl]
	set 6, [hl]
	jr nz, .asm_449fe
	ld a, $7a
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	ld a, $60
	ld [$cc4d], a
	ld a, $15
	jp Predef ; indirect jump to AddMissableObject (f1c8 (3:71c8))

.unknown_449f9: ; 449f9 (11:49f9)
INCBIN "baserom.gbc",$449f9,$449fe - $449f9

.asm_449fe
	ld a, $c2
	ld [$d71d], a
	ld hl, .unknown_449f9 ; $49f9
	call Func_46981
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $1
	jr nz, .asm_44a1b
	ld hl, $d72d
	res 4, [hl]
	ld hl, $d732
	res 4, [hl]
	ret
.asm_44a1b
	ld a, [$d72d]
	bit 4, a
	jp z, CheckFightingMapTrainers
	ret
; 44a24 (11:4a24)
VictoryRoad3Texts: ; 44a24 (11:4a24)
	dw VictoryRoad3Text1, VictoryRoad3Text2, VictoryRoad3Text3, VictoryRoad3Text4, Predef5CText, Predef5CText, BoulderText, BoulderText, BoulderText, BoulderText

VictoryRoad3TrainerHeaders: ; 44a38 (11:4a38)
VictoryRoad3TrainerHeader0: ; 44a38 (11:4a38)
	db $1 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d813 ; flag's byte
	dw VictoryRoad3BattleText2 ; 0x4a91 TextBeforeBattle
	dw VictoryRoad3AfterBattleText2 ; 0x4a9b TextAfterBattle
	dw VictoryRoad3EndBattleText2 ; 0x4a96 TextEndBattle
	dw VictoryRoad3EndBattleText2 ; 0x4a96 TextEndBattle
; 0x44a44

VictoryRoad3TrainerHeader2: ; 44a44 (11:4a44)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d813 ; flag's byte
	dw VictoryRoad3BattleText3 ; 0x4aa0 TextBeforeBattle
	dw VictoryRoad3AfterBattleText3 ; 0x4aaa TextAfterBattle
	dw VictoryRoad3EndBattleText3 ; 0x4aa5 TextEndBattle
	dw VictoryRoad3EndBattleText3 ; 0x4aa5 TextEndBattle
; 0x44a50

VictoryRoad3TrainerHeader3: ; 44a50 (11:4a50)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d813 ; flag's byte
	dw VictoryRoad3BattleText4 ; 0x4aaf TextBeforeBattle
	dw VictoryRoad3AfterBattleText4 ; 0x4ab9 TextAfterBattle
	dw VictoryRoad3EndBattleText4 ; 0x4ab4 TextEndBattle
	dw VictoryRoad3EndBattleText4 ; 0x4ab4 TextEndBattle
; 0x44a5c

VictoryRoad3TrainerHeader4: ; 44a5c (11:4a5c)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d813 ; flag's byte
	dw VictoryRoad3BattleText5 ; 0x4abe TextBeforeBattle
	dw VictoryRoad3AfterBattleText5 ; 0x4ac8 TextAfterBattle
	dw VictoryRoad3EndBattleText5 ; 0x4ac3 TextEndBattle
	dw VictoryRoad3EndBattleText5 ; 0x4ac3 TextEndBattle
; 0x44a68

db $ff

VictoryRoad3Text1: ; 44a69 (11:4a69)
	db $08 ; asm
	ld hl, VictoryRoad3TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad3Text2: ; 44a73 (11:4a73)
	db $08 ; asm
	ld hl, VictoryRoad3TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad3Text3: ; 44a7d (11:4a7d)
	db $08 ; asm
	ld hl, VictoryRoad3TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad3Text4: ; 44a87 (11:4a87)
	db $08 ; asm
	ld hl, VictoryRoad3TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad3BattleText2: ; 44a91 (11:4a91)
	TX_FAR _VictoryRoad3BattleText2
	db $50
; 0x44a91 + 5 bytes

VictoryRoad3EndBattleText2: ; 44a96 (11:4a96)
	TX_FAR _VictoryRoad3EndBattleText2
	db $50
; 0x44a96 + 5 bytes

VictoryRoad3AfterBattleText2: ; 44a9b (11:4a9b)
	TX_FAR _VictoryRoad3AfterBattleText2
	db $50
; 0x44a9b + 5 bytes

VictoryRoad3BattleText3: ; 44aa0 (11:4aa0)
	TX_FAR _VictoryRoad3BattleText3
	db $50
; 0x44aa0 + 5 bytes

VictoryRoad3EndBattleText3: ; 44aa5 (11:4aa5)
	TX_FAR _VictoryRoad3EndBattleText3
	db $50
; 0x44aa5 + 5 bytes

VictoryRoad3AfterBattleText3: ; 44aaa (11:4aaa)
	TX_FAR _VictoryRoad3AfterBattleText3
	db $50
; 0x44aaa + 5 bytes

VictoryRoad3BattleText4: ; 44aaf (11:4aaf)
	TX_FAR _VictoryRoad3BattleText4
	db $50
; 0x44aaf + 5 bytes

VictoryRoad3EndBattleText4: ; 44ab4 (11:4ab4)
	TX_FAR _VictoryRoad3EndBattleText4
	db $50
; 0x44ab4 + 5 bytes

VictoryRoad3AfterBattleText4: ; 44ab9 (11:4ab9)
	TX_FAR _VictoryRoad3AfterBattleText4
	db $50
; 0x44ab9 + 5 bytes

VictoryRoad3BattleText5: ; 44abe (11:4abe)
	TX_FAR _VictoryRoad3BattleText5
	db $50
; 0x44abe + 5 bytes

VictoryRoad3EndBattleText5: ; 44ac3 (11:4ac3)
	TX_FAR _VictoryRoad3EndBattleText5
	db $50
; 0x44ac3 + 5 bytes

VictoryRoad3AfterBattleText5: ; 44ac8 (11:4ac8)
	TX_FAR _VictoryRoad3AfterBattleText5
	db $50
; 0x44ac8 + 5 bytes

VictoryRoad3Object: ; 0x44acd (size=106)
	db $7d ; border tile

	db $4 ; warps
	db $7, $17, $3, VICTORY_ROAD_2
	db $8, $1a, $5, VICTORY_ROAD_2
	db $f, $1b, $4, VICTORY_ROAD_2
	db $0, $2, $6, VICTORY_ROAD_2

	db $0 ; signs

	db $a ; people
	db SPRITE_BLACK_HAIR_BOY_1, $5 + 4, $1c + 4, $ff, $d2, $41, COOLTRAINER_M + $C8, $2 ; trainer
	db SPRITE_LASS, $d + 4, $7 + 4, $ff, $d3, $42, COOLTRAINER_F + $C8, $2 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $e + 4, $6 + 4, $ff, $d2, $43, COOLTRAINER_M + $C8, $3 ; trainer
	db SPRITE_LASS, $3 + 4, $d + 4, $ff, $d3, $44, COOLTRAINER_F + $C8, $3 ; trainer
	db SPRITE_BALL, $5 + 4, $1a + 4, $ff, $ff, $85, MAX_REVIVE ; item
	db SPRITE_BALL, $7 + 4, $7 + 4, $ff, $ff, $86, TM_47 ; item
	db SPRITE_BOULDER, $3 + 4, $16 + 4, $ff, $10, $7 ; person
	db SPRITE_BOULDER, $c + 4, $d + 4, $ff, $10, $8 ; person
	db SPRITE_BOULDER, $a + 4, $18 + 4, $ff, $10, $9 ; person
	db SPRITE_BOULDER, $f + 4, $16 + 4, $ff, $10, $a ; person

	; warp-to
	EVENT_DISP $f, $7, $17 ; VICTORY_ROAD_2
	EVENT_DISP $f, $8, $1a ; VICTORY_ROAD_2
	EVENT_DISP $f, $f, $1b ; VICTORY_ROAD_2
	EVENT_DISP $f, $0, $2 ; VICTORY_ROAD_2

VictoryRoad3Blocks: ; 44b37 (11:4b37)
	INCBIN "maps/victoryroad3.blk"

RocketHideout1_h: ; 0x44bbe to 0x44bca (12 bytes) (bank=11) (id=199)
	db $16 ; tileset
	db ROCKET_HIDEOUT_1_HEIGHT, ROCKET_HIDEOUT_1_WIDTH ; dimensions (y, x)
	dw RocketHideout1Blocks, RocketHideout1Texts, RocketHideout1Script ; blocks, texts, scripts
	db $00 ; connections

	dw RocketHideout1Object ; objects

RocketHideout1Script: ; 44bca (11:4bca)
	call Unknown_44be0
	call EnableAutoTextBoxDrawing
	ld hl, RocketHideout1TrainerHeaders
	ld de, Unknown_44c0e ; $4c0e
	ld a, [W_ROCKETHIDEOUT1CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROCKETHIDEOUT1CURSCRIPT], a
	ret
; 0x44be0

Unknown_44be0: ; 44be0 (11:4be0)
INCBIN "baserom.gbc",$44be0,$44c0e - $44be0

Unknown_44c0e: ; 44c0e (11:4c0e)
INCBIN "baserom.gbc",$44c0e,$44c14 - $44c0e

RocketHideout1Texts: ; 44c14 (11:4c14)
	dw RocketHideout1Text1, RocketHideout1Text2, RocketHideout1Text3, RocketHideout1Text4, RocketHideout1Text5, Predef5CText, Predef5CText

RocketHideout1TrainerHeaders: ; 44c22 (11:4c22)
RocketHideout1TrainerHeader0: ; 44c22 (11:4c22)
	db $1 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d815 ; flag's byte
	dw RocketHideout1BattleText2 ; 0x4ca1 TextBeforeBattle
	dw RocketHideout1AfterBattleTxt2 ; 0x4cab TextAfterBattle
	dw RocketHideout1EndBattleText2 ; 0x4ca6 TextEndBattle
	dw RocketHideout1EndBattleText2 ; 0x4ca6 TextEndBattle
; 0x44c2e

RocketHideout1TrainerHeader2: ; 44c2e (11:4c2e)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d815 ; flag's byte
	dw RocketHideout1BattleText3 ; 0x4cb0 TextBeforeBattle
	dw RocketHideout1AfterBattleTxt3 ; 0x4cba TextAfterBattle
	dw RocketHideout1EndBattleText3 ; 0x4cb5 TextEndBattle
	dw RocketHideout1EndBattleText3 ; 0x4cb5 TextEndBattle
; 0x44c3a

RocketHideout1TrainerHeader3: ; 44c3a (11:4c3a)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d815 ; flag's byte
	dw RocketHideout1BattleText4 ; 0x4cbf TextBeforeBattle
	dw RocketHideout1AfterBattleTxt4 ; 0x4cc9 TextAfterBattle
	dw RocketHideout1EndBattleText4 ; 0x4cc4 TextEndBattle
	dw RocketHideout1EndBattleText4 ; 0x4cc4 TextEndBattle
; 0x44c46

RocketHideout1TrainerHeader4: ; 44c46 (11:4c46)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d815 ; flag's byte
	dw RocketHideout1BattleText5 ; 0x4cce TextBeforeBattle
	dw RocketHideout1AfterBattleTxt5 ; 0x4cd8 TextAfterBattle
	dw RocketHideout1EndBattleText5 ; 0x4cd3 TextEndBattle
	dw RocketHideout1EndBattleText5 ; 0x4cd3 TextEndBattle
; 0x44c52

RocketHideout1TrainerHeader5: ; 44c52 (11:4c52)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d815 ; flag's byte
	dw RocketHideout1BattleText6 ; 0x4cdd TextBeforeBattle
	dw RocketHideout1AfterBattleTxt6 ; 0x4ce2 TextAfterBattle
	dw RocketHideout1EndBattleText6 ; 0x4c91 TextEndBattle
	dw RocketHideout1EndBattleText6 ; 0x4c91 TextEndBattle
; 0x44c5e

db $ff

RocketHideout1Text1: ; 44c5f (11:4c5f)
	db $08 ; asm
	ld hl, RocketHideout1TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout1Text2: ; 44c69 (11:4c69)
	db $08 ; asm
	ld hl, RocketHideout1TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout1Text3: ; 44c73 (11:4c73)
	db $08 ; asm
	ld hl, RocketHideout1TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout1Text4: ; 44c7d (11:4c7d)
	db $08 ; asm
	ld hl, RocketHideout1TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout1Text5: ; 44c87 (11:4c87)
	db $08 ; asm
	ld hl, RocketHideout1TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout1EndBattleText6: ; 44c91 (11:4c91)
	TX_FAR _RocketHideout1EndBattleText6 ; 0x81f2a
	db $8
	ld hl, $d815
	set 5, [hl]
	ld hl, UnnamedText_44c9f
	ret
; 0x44c9f

UnnamedText_44c9f: ; 44c9f (11:4c9f)
	db $6, $50
; 0x44ca1

RocketHideout1BattleText2: ; 44ca1 (11:4ca1)
	TX_FAR _RocketHideout1BattleText2
	db $50
; 0x44ca1 + 5 bytes

RocketHideout1EndBattleText2: ; 44ca6 (11:4ca6)
	TX_FAR _RocketHideout1EndBattleText2
	db $50
; 0x44ca6 + 5 bytes

RocketHideout1AfterBattleTxt2: ; 44cab (11:4cab)
	TX_FAR _RocketHideout1AfterBattleTxt2
	db $50
; 0x44cab + 5 bytes

RocketHideout1BattleText3: ; 44cb0 (11:4cb0)
	TX_FAR _RocketHideout1BattleText3
	db $50
; 0x44cb0 + 5 bytes

RocketHideout1EndBattleText3: ; 44cb5 (11:4cb5)
	TX_FAR _RocketHideout1EndBattleText3
	db $50
; 0x44cb5 + 5 bytes

RocketHideout1AfterBattleTxt3: ; 44cba (11:4cba)
	TX_FAR _RocketHideout1AfterBattleTxt3
	db $50
; 0x44cba + 5 bytes

RocketHideout1BattleText4: ; 44cbf (11:4cbf)
	TX_FAR _RocketHideout1BattleText4
	db $50
; 0x44cbf + 5 bytes

RocketHideout1EndBattleText4: ; 44cc4 (11:4cc4)
	TX_FAR _RocketHideout1EndBattleText4
	db $50
; 0x44cc4 + 5 bytes

RocketHideout1AfterBattleTxt4: ; 44cc9 (11:4cc9)
	TX_FAR _RocketHideout1AfterBattleTxt4
	db $50
; 0x44cc9 + 5 bytes

RocketHideout1BattleText5: ; 44cce (11:4cce)
	TX_FAR _RocketHideout1BattleText5
	db $50
; 0x44cce + 5 bytes

RocketHideout1EndBattleText5: ; 44cd3 (11:4cd3)
	TX_FAR _RocketHideout1EndBattleText5
	db $50
; 0x44cd3 + 5 bytes

RocketHideout1AfterBattleTxt5: ; 44cd8 (11:4cd8)
	TX_FAR _RocketHideout1AfterBattleTxt5
	db $50
; 0x44cd8 + 5 bytes

RocketHideout1BattleText6: ; 44cdd (11:4cdd)
	TX_FAR _RocketHideout1BattleText6
	db $50
; 0x44cdd + 5 bytes

RocketHideout1AfterBattleTxt6: ; 44ce2 (11:4ce2)
	TX_FAR _RocketHideout1AfterBattleTxt6
	db $50
; 0x44ce2 + 5 bytes

RocketHideout1Object: ; 0x44ce7 (size=98)
	db $2e ; border tile

	db $5 ; warps
	db $2, $17, $0, ROCKET_HIDEOUT_2
	db $2, $15, $2, GAME_CORNER
	db $13, $18, $0, ROCKET_HIDEOUT_ELEVATOR
	db $18, $15, $3, ROCKET_HIDEOUT_2
	db $13, $19, $1, ROCKET_HIDEOUT_ELEVATOR

	db $0 ; signs

	db $7 ; people
	db SPRITE_ROCKET, $8 + 4, $1a + 4, $ff, $d2, $41, ROCKET + $C8, $8 ; trainer
	db SPRITE_ROCKET, $6 + 4, $c + 4, $ff, $d3, $42, ROCKET + $C8, $9 ; trainer
	db SPRITE_ROCKET, $11 + 4, $12 + 4, $ff, $d0, $43, ROCKET + $C8, $a ; trainer
	db SPRITE_ROCKET, $19 + 4, $f + 4, $ff, $d3, $44, ROCKET + $C8, $b ; trainer
	db SPRITE_ROCKET, $12 + 4, $1c + 4, $ff, $d2, $45, ROCKET + $C8, $c ; trainer
	db SPRITE_BALL, $e + 4, $b + 4, $ff, $ff, $86, ESCAPE_ROPE ; item
	db SPRITE_BALL, $11 + 4, $9 + 4, $ff, $ff, $87, HYPER_POTION ; item

	; warp-to
	EVENT_DISP $f, $2, $17 ; ROCKET_HIDEOUT_2
	EVENT_DISP $f, $2, $15 ; GAME_CORNER
	EVENT_DISP $f, $13, $18 ; ROCKET_HIDEOUT_ELEVATOR
	EVENT_DISP $f, $18, $15 ; ROCKET_HIDEOUT_2
	EVENT_DISP $f, $13, $19 ; ROCKET_HIDEOUT_ELEVATOR

RocketHideout1Blocks: ; 44d49 (11:4d49)
	INCBIN "maps/rockethideout1.blk"

RocketHideout2_h: ; 0x44e1b to 0x44e27 (12 bytes) (bank=11) (id=200)
	db $16 ; tileset
	db ROCKET_HIDEOUT_2_HEIGHT, ROCKET_HIDEOUT_2_WIDTH ; dimensions (y, x)
	dw RocketHideout2Blocks, RocketHideout2Texts, RocketHideout2Script ; blocks, texts, scripts
	db $00 ; connections

	dw RocketHideout2Object ; objects

RocketHideout2Script: ; 44e27 (11:4e27)
	call EnableAutoTextBoxDrawing
	ld hl, RocketHideout2TrainerHeaders
	ld de, RocketHideout2_Unknown44e3a
	ld a, [W_ROCKETHIDEOUT2CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROCKETHIDEOUT2CURSCRIPT], a
	ret
; 0x44e3a

RocketHideout2_Unknown44e3a: ; 44e3a (11:4e3a)
INCBIN "baserom.gbc",$44e3a,$44fd7 - $44e3a

; known jump sources: 5c1 (0:5c1), 74985 (1d:4985)
Func_44fd7: ; 44fd7 (11:4fd7)
	ld a, [$c102]
	srl a
	srl a
	ld hl, Unknown_45083 ; $5083
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
	ld [$c102], a
	ld a, [W_CURMAPTILESET] ; $d367
	cp $16
	ld hl, Unknown_45023 ; $5023
	jr z, .asm_44ff6
	ld hl, Unknown_45053 ; $5053
.asm_44ff6
	ld a, [$cd38]
	bit 0, a
	jr nz, .asm_45001
	ld de, $18
	add hl, de
.asm_45001
	ld a, $4
	ld bc, $0
.asm_45006
	push af
	push hl
	push bc
	add hl, bc
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	ld a, [hli]
	ld c, a
	ld a, [hli]
	ld b, a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	call CopyVideoData
	pop bc
	ld a, $6
	add c
	ld c, a
	pop hl
	pop af
	dec a
	jr nz, .asm_45006
	ret
; 45023 (11:5023)

Unknown_45023: ; 45023 (11:5023)
; 0x45023 XXX: it looks to me this is probably data for copying tiles into memory, maybe to mix and match a few tilesets, but I don't really know for sure
	dw UnknownGFX_45087       ;address from within tileset graphics
	db 1                      ;number of tiles to copy?
	db BANK(UnknownGFX_45087) ;bank of tileset graphics
	dw $9200                  ;where to load in VRAM
	
	dw UnknownGFX_45087 + $10
	db 1
	db BANK(UnknownGFX_45087)
	dw $9210
	
	dw UnknownGFX_45087 + $20
	db 1
	db BANK(UnknownGFX_45087)
	dw $9300
	
	dw UnknownGFX_45087 + $30
	db 1
	db BANK(UnknownGFX_45087)
	dw $9310
	
	dw Tset16_GFX + $200
	db 1
	db $1A
	dw $9200
	
	dw Tset16_GFX + $210
	db 1
	db $1A
	dw $9210
	
	dw Tset16_GFX + $300
	db 1
	db $1A
	dw $9300
	
	dw Tset16_GFX + $310
	db 1
	db $1A
	dw $9310
	
Unknown_45053: ; 45053 (11:5053)
	dw UnknownGFX_45087 + $10
	db 1
	db BANK(UnknownGFX_45087)
	dw $93C0
	
	dw UnknownGFX_45087 + $30
	db 1
	db BANK(UnknownGFX_45087)
	dw $93D0
	
	dw UnknownGFX_45087
	db 1
	db BANK(UnknownGFX_45087)
	dw $94C0
	
	dw UnknownGFX_45087 + $20
	db 1
	db BANK(UnknownGFX_45087)
	dw $94D0
	
	dw Tset05_GFX + $3C0
	db 1
	db $1A
	dw $93C0
	
	dw Tset05_GFX + $3D0
	db 1
	db $1A
	dw $93D0
	
	dw Tset05_GFX + $4C0
	db 1
	db $1A
	dw $94C0
	
	dw Tset05_GFX + $4D0
	db 1
	db $1A
	dw $94D0

Unknown_45083: ; 45083 (11:5083)
INCBIN "baserom.gbc",$45083,$45087 - $45083

; four tiles apparently forming a 2x2 diamond shaped pattern
UnknownGFX_45087: ; 45087 (11:5087)
INCBIN "baserom.gbc",$45087,$450c7 - $45087

RocketHideout2Texts: ; 450c7 (11:50c7)
	dw RocketHideout2Text1, Predef5CText, Predef5CText, Predef5CText, Predef5CText

RocketHideout2TrainerHeaders: ; 450d1 (11:50d1)
RocketHideout2TrainerHeader0: ; 450d1 (11:50d1)
	db $1 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d817 ; flag's byte
	dw RocketHideout2BattleText2 ; 0x50e8 TextBeforeBattle
	dw RocketHideout2AfterBattleTxt2 ; 0x50f2 TextAfterBattle
	dw RocketHideout2EndBattleText2 ; 0x50ed TextEndBattle
	dw RocketHideout2EndBattleText2 ; 0x50ed TextEndBattle
; 0x450dd

db $ff

RocketHideout2Text1: ; 450de (11:50de)
	db $08 ; asm
	ld hl, RocketHideout2TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout2BattleText2: ; 450e8 (11:50e8)
	TX_FAR _RocketHideout2BattleText2
	db $50
; 0x450e8 + 5 bytes

RocketHideout2EndBattleText2: ; 450ed (11:50ed)
	TX_FAR _RocketHideout2EndBattleText2
	db $50
; 0x450ed + 5 bytes

RocketHideout2AfterBattleTxt2: ; 450f2 (11:50f2)
	TX_FAR _RocketHideout2AfterBattleTxt2
	db $50
; 0x450f2 + 5 bytes

RocketHideout2Object: ; 0x450f7 (size=80)
	db $2e ; border tile

	db $5 ; warps
	db $8, $1b, $0, ROCKET_HIDEOUT_1
	db $8, $15, $0, ROCKET_HIDEOUT_3
	db $13, $18, $0, ROCKET_HIDEOUT_ELEVATOR
	db $16, $15, $3, ROCKET_HIDEOUT_1
	db $13, $19, $1, ROCKET_HIDEOUT_ELEVATOR

	db $0 ; signs

	db $5 ; people
	db SPRITE_ROCKET, $c + 4, $14 + 4, $ff, $d0, $41, ROCKET + $C8, $d ; trainer
	db SPRITE_BALL, $b + 4, $1 + 4, $ff, $ff, $82, MOON_STONE ; item
	db SPRITE_BALL, $8 + 4, $10 + 4, $ff, $ff, $83, NUGGET ; item
	db SPRITE_BALL, $c + 4, $6 + 4, $ff, $ff, $84, TM_07 ; item
	db SPRITE_BALL, $15 + 4, $3 + 4, $ff, $ff, $85, SUPER_POTION ; item

	; warp-to
	EVENT_DISP $f, $8, $1b ; ROCKET_HIDEOUT_1
	EVENT_DISP $f, $8, $15 ; ROCKET_HIDEOUT_3
	EVENT_DISP $f, $13, $18 ; ROCKET_HIDEOUT_ELEVATOR
	EVENT_DISP $f, $16, $15 ; ROCKET_HIDEOUT_1
	EVENT_DISP $f, $13, $19 ; ROCKET_HIDEOUT_ELEVATOR

RocketHideout2Blocks: ; 45147 (11:5147)
	INCBIN "maps/rockethideout2.blk"

RocketHideout3_h: ; 0x45219 to 0x45225 (12 bytes) (bank=11) (id=201)
	db $16 ; tileset
	db ROCKET_HIDEOUT_3_HEIGHT, ROCKET_HIDEOUT_3_WIDTH ; dimensions (y, x)
	dw RocketHideout3Blocks, RocketHideout3Texts, RocketHideout3Script ; blocks, texts, scripts
	db $00 ; connections

	dw RocketHideout3Object ; objects

RocketHideout3Script: ; 45225 (11:5225)
	call EnableAutoTextBoxDrawing
	ld hl, RocketHideout3TrainerHeaders
	ld de, RocketHideout3Script_Unknown45238
	ld a, [W_ROCKETHIDEOUT3CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROCKETHIDEOUT3CURSCRIPT], a
	ret
; 0x45238

RocketHideout3Script_Unknown45238: ; 45238 (11:5238)
INCBIN "baserom.gbc",$45238,$452fa - $45238

RocketHideout3Texts: ; 452fa (11:52fa)
	dw RocketHideout3Text1, RocketHideout3Text2, Predef5CText, Predef5CText

RocketHideout3TrainerHeaders: ; 45302 (11:5302)
RocketHideout3TrainerHeader0: ; 45302 (11:5302)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d819 ; flag's byte
	dw RocketHideout3BattleText2 ; 0x5325 TextBeforeBattle
	dw RocketHideout3AfterBattleTxt2 ; 0x532f TextAfterBattle
	dw RocketHideout3EndBattleText2 ; 0x532a TextEndBattle
	dw RocketHideout3EndBattleText2 ; 0x532a TextEndBattle
; 0x4530e

RocketHideout3TrainerHeader2: ; 4530e (11:530e)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d819 ; flag's byte
	dw RocketHideout3BattleTxt ; 0x533e TextBeforeBattle
	dw RocketHideout3AfterBattleText3 ; 0x5348 TextAfterBattle
	dw RocketHideout3EndBattleText3 ; 0x5343 TextEndBattle
	dw RocketHideout3EndBattleText3 ; 0x5343 TextEndBattle
; 0x4531a

db $ff

RocketHideout3Text1: ; 4531b (11:531b)
	db $08 ; asm
	ld hl, RocketHideout3TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout3BattleText2: ; 45325 (11:5325)
	TX_FAR _RocketHideout3BattleText2
	db $50
; 0x45325 + 5 bytes

RocketHideout3EndBattleText2: ; 4532a (11:532a)
	TX_FAR _RocketHideout3EndBattleText2
	db $50
; 0x4532a + 5 bytes

RocketHideout3AfterBattleTxt2: ; 4532f (11:532f)
	TX_FAR _RocketHideout3AfterBattleTxt2
	db $50
; 0x4532f + 5 bytes

RocketHideout3Text2: ; 45334 (11:5334)
	db $08 ; asm
	ld hl, RocketHideout3TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout3BattleTxt: ; 4533e (11:533e)
	TX_FAR _RocketHideout3BattleTxt
	db $50
; 0x4533e + 5 bytes

RocketHideout3EndBattleText3: ; 45343 (11:5343)
	TX_FAR _RocketHideout3EndBattleText3
	db $50
; 0x45343 + 5 bytes

RocketHideout3AfterBattleText3: ; 45348 (11:5348)
	;TX_FAR _RocketHideout3AfterBattleText3
	db $17
	dw _RocketHideout3AfterBattleText3
	db BANK(_RocketHideout3AfterBattleText3)
	db $50
; 0x45348 + 5 bytes

RocketHideout3Object: ; 0x4534d (size=50)
	db $2e ; border tile

	db $2 ; warps
	db $6, $19, $1, ROCKET_HIDEOUT_2
	db $12, $13, $0, ROCKET_HIDEOUT_4

	db $0 ; signs

	db $4 ; people
	db SPRITE_ROCKET, $16 + 4, $a + 4, $ff, $d3, $41, ROCKET + $C8, $e ; trainer
	db SPRITE_ROCKET, $c + 4, $1a + 4, $ff, $d1, $42, ROCKET + $C8, $f ; trainer
	db SPRITE_BALL, $11 + 4, $1a + 4, $ff, $ff, $83, TM_10 ; item
	db SPRITE_BALL, $e + 4, $14 + 4, $ff, $ff, $84, RARE_CANDY ; item

	; warp-to
	EVENT_DISP $f, $6, $19 ; ROCKET_HIDEOUT_2
	EVENT_DISP $f, $12, $13 ; ROCKET_HIDEOUT_4

RocketHideout3Blocks: ; 4537f (11:537f)
	INCBIN "maps/rockethideout3.blk"

RocketHideout4_h: ; 0x45451 to 0x4545d (12 bytes) (bank=11) (id=202)
	db $16 ; tileset
	db ROCKET_HIDEOUT_4_HEIGHT, ROCKET_HIDEOUT_4_WIDTH ; dimensions (y, x)
	dw RocketHideout4Blocks, RocketHideout4Texts, RocketHideout4Script ; blocks, texts, scripts
	db $00 ; connections

	dw RocketHideout4Object ; objects

RocketHideout4Script: ; 4545d (11:545d)
	call Unnamed_45473
	call EnableAutoTextBoxDrawing
	ld hl, RocketHideout4TrainerHeader0
	ld de, Unknown_454ae ; $54ae
	ld a, [W_ROCKETHIDEOUT4CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROCKETHIDEOUT4CURSCRIPT], a
	ret
; 0x45473

Unnamed_45473: ; 45473 (11:5473)
INCBIN "baserom.gbc",$45473,$454ae - $45473

Unknown_454ae: ; 454ae (11:54ae)
INCBIN "baserom.gbc",$454ae,$45501 - $454ae

RocketHideout4Texts: ; 45501 (11:5501)
	dw RocketHideout4Text1, RocketHideout4Text2, RocketHideout4Text3, RocketHideout4Text4, Predef5CText, Predef5CText, Predef5CText, Predef5CText, Predef5CText, RocketHideout4Text10

RocketHideout4TrainerHeaders: ; 45515 (11:5515)
RocketHideout4TrainerHeader0: ; 45515 (11:5515)
	db $2 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d81b ; flag's byte
	dw RocketHideout4BattleText2 ; 0x5593 TextBeforeBattle
	dw RocketHideout4AfterBattleText2 ; 0x559d TextAfterBattle
	dw RocketHideout4EndBattleText2 ; 0x5598 TextEndBattle
	dw RocketHideout4EndBattleText2 ; 0x5598 TextEndBattle
; 0x45521

RocketHideout4TrainerHeader2: ; 45521 (11:5521)
	db $3 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d81b ; flag's byte
	dw RocketHideout4BattleText3 ; 0x55ac TextBeforeBattle
	dw RocketHideout4AfterBattleText3 ; 0x55b6 TextAfterBattle
	dw RocketHideout4EndBattleText3 ; 0x55b1 TextEndBattle
	dw RocketHideout4EndBattleText3 ; 0x55b1 TextEndBattle
; 0x4552d

RocketHideout4TrainerHeader3: ; 4552d (11:552d)
	db $4 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d81b ; flag's byte
	dw RocketHideout4BattleText4 ; 0x55c5 TextBeforeBattle
	dw RocketHideout4AfterBattleText4 ; 0x55cf TextAfterBattle
	dw RocketHideout4EndBattleText4 ; 0x55ca TextEndBattle
	dw RocketHideout4EndBattleText4 ; 0x55ca TextEndBattle
; 0x45539

db $ff

RocketHideout4Text1: ; 4553a (11:553a)
	db $08 ; asm
	ld a, [$d81b]
	bit 7, a
	jp nz, .asm_545571
	ld hl, UnnamedText_4557a
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_4557f
	ld de, UnnamedText_4557f
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	xor a
	ldh [$b4], a
	ld a, $3
	ld [W_ROCKETHIDEOUT4CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	jr .asm_209f0 ; 0x4556f
.asm_545571
	ld hl, RocketHideout4Text10
	call PrintText
.asm_209f0 ; 0x45577
	jp TextScriptEnd

UnnamedText_4557a: ; 4557a (11:557a)
	TX_FAR _UnnamedText_4557a
	db $50
; 0x4557a + 5 bytes

UnnamedText_4557f: ; 4557f (11:557f)
	TX_FAR _UnnamedText_4557f
	db $50
; 0x4557f + 5 bytes

RocketHideout4Text10: ; 45584 (11:5584)
	TX_FAR _UnnamedText_45584
	db $50
; 0x45584 + 5 bytes

RocketHideout4Text2: ; 45589 (11:5589)
	db $08 ; asm
	ld hl, RocketHideout4TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout4BattleText2: ; 45593 (11:5593)
	TX_FAR _RocketHideout4BattleText2
	db $50
; 0x45593 + 5 bytes

RocketHideout4EndBattleText2: ; 45598 (11:5598)
	TX_FAR _RocketHideout4EndBattleText2
	db $50
; 0x45598 + 5 bytes

RocketHideout4AfterBattleText2: ; 4559d (11:559d)
	;TX_FAR _RocketHideout4AfterBattleText2
	db $17
	dw _RocketHideout4AfterBattleText2
	db BANK(_RocketHideout4AfterBattleText2)
	db $50
; 0x4559d + 5 bytes

RocketHideout4Text3: ; 455a2 (11:55a2)
	db $08 ; asm
	ld hl, RocketHideout4TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout4BattleText3: ; 455ac (11:55ac)
	TX_FAR _RocketHideout4BattleText3
	db $50
; 0x455ac + 5 bytes

RocketHideout4EndBattleText3: ; 455b1 (11:55b1)
	TX_FAR _RocketHideout4EndBattleText3
	db $50
; 0x455b1 + 5 bytes

RocketHideout4AfterBattleText3: ; 455b6 (11:55b6)
	;TX_FAR _RocketHideout4AfterBattleText3
	db $17
	dw _RocketHideout4AfterBattleText3
	db BANK(_RocketHideout4AfterBattleText3)
	db $50
; 0x455b6 + 5 bytes

RocketHideout4Text4: ; 455bb (11:55bb)
	db $08 ; asm
	ld hl, RocketHideout4TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

RocketHideout4BattleText4: ; 455c5 (11:55c5)
	TX_FAR _RocketHideout4BattleText4
	db $50
; 0x455c5 + 5 bytes

RocketHideout4EndBattleText4: ; 455ca (11:55ca)
	TX_FAR _RocketHideout4EndBattleText4
	db $50
; 0x455ca + 5 bytes

RocketHideout4AfterBattleText4: ; 455cf (11:55cf)
	db $8
	ld hl, UnnamedText_455ec ; $55ec
	call PrintText
	ld hl, $d81b
	bit 6, [hl]
	set 6, [hl]
	jr nz, .asm_455e9 ; 0x455dd $a
	ld a, $88
	ld [$cc4d], a
	ld a, $15
	call Predef
.asm_455e9
	jp TextScriptEnd
; 0x455ec

UnnamedText_455ec: ; 455ec (11:55ec)
	TX_FAR _UnnamedText_455ec
	db $50
; 0x455ec + 5 bytes

RocketHideout4Object: ; 0x455f1 (size=95)
	db $2e ; border tile

	db $3 ; warps
	db $a, $13, $1, ROCKET_HIDEOUT_3
	db $f, $18, $0, ROCKET_HIDEOUT_ELEVATOR
	db $f, $19, $1, ROCKET_HIDEOUT_ELEVATOR

	db $0 ; signs

	db $9 ; people
	db SPRITE_GIOVANNI, $3 + 4, $19 + 4, $ff, $d0, $41, GIOVANNI + $C8, $1 ; trainer
	db SPRITE_ROCKET, $c + 4, $17 + 4, $ff, $d0, $42, ROCKET + $C8, $10 ; trainer
	db SPRITE_ROCKET, $c + 4, $1a + 4, $ff, $d0, $43, ROCKET + $C8, $11 ; trainer
	db SPRITE_ROCKET, $2 + 4, $b + 4, $ff, $d0, $44, ROCKET + $C8, $12 ; trainer
	db SPRITE_BALL, $c + 4, $a + 4, $ff, $ff, $85, HP_UP ; item
	db SPRITE_BALL, $4 + 4, $9 + 4, $ff, $ff, $86, TM_02 ; item
	db SPRITE_BALL, $14 + 4, $c + 4, $ff, $ff, $87, IRON ; item
	db SPRITE_BALL, $2 + 4, $19 + 4, $ff, $ff, $88, SILPH_SCOPE ; item
	db SPRITE_BALL, $2 + 4, $a + 4, $ff, $ff, $89, LIFT_KEY ; item

	; warp-to
	EVENT_DISP $f, $a, $13 ; ROCKET_HIDEOUT_3
	EVENT_DISP $f, $f, $18 ; ROCKET_HIDEOUT_ELEVATOR
	EVENT_DISP $f, $f, $19 ; ROCKET_HIDEOUT_ELEVATOR

RocketHideout4Blocks: ; 45650 (11:5650)
	INCBIN "maps/rockethideout4.blk"

RocketHideoutElevator_h: ; 0x45704 to 0x45710 (12 bytes) (bank=11) (id=203)
	db $12 ; tileset
	db ROCKET_HIDEOUT_ELEVATOR_HEIGHT, ROCKET_HIDEOUT_ELEVATOR_WIDTH ; dimensions (y, x)
	dw RocketHideoutElevatorBlocks, RocketHideoutElevatorTexts, RocketHideoutElevatorScript ; blocks, texts, scripts
	db $00 ; connections

	dw RocketHideoutElevatorObject ; objects

RocketHideoutElevatorScript: ; 45710 (11:5710)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	push hl
	call nz, RocketHideoutElevatorScript_Unknown4572c
	pop hl
	bit 7, [hl]
	res 7, [hl]
	call nz, Func_4575f
	xor a
	ld [$cf0c], a
	inc a
	ld [$cc3c], a
	ret
; 0x4572c

RocketHideoutElevatorScript_Unknown4572c: ; 4572c (11:572c)
INCBIN "baserom.gbc",$4572c,$45741 - $4572c

Func_45741: ; 45741 (11:5741)
	ld hl, Unknown_45754 ; $5754
	call LoadItemList
	ld hl, Unknown_45759 ; $5759
	ld de, $cc5b
	ld bc, $0006
	call CopyData
	ret
; 0x45754

Unknown_45754: ; 45754 (11:5754)
INCBIN "baserom.gbc",$45754,$45759 - $45754

Unknown_45759: ; 45759 (11:5759)
INCBIN "baserom.gbc",$45759,$4575f - $45759

Func_4575f: ; 4575f (11:575f)
	call Delay3
	ld b, BANK(Func_7bf15)
	ld hl, Func_7bf15
	call Bankswitch
	ret
; 0x4576b

RocketHideoutElevatorTexts: ; 4576b (11:576b)
	dw RocketHideoutElevatorText1

RocketHideoutElevatorText1: ; 4576d (11:576d)
	db $08 ; asm
	ld b, LIFT_KEY
	call IsItemInBag
	jr z, .asm_8d8f0 ; 0x45773
	call Func_45741
	ld hl, Unknown_45759 ; $5759
	ld a, $61
	call Predef
	jr .asm_46c43 ; 0x45780
.asm_8d8f0 ; 0x45782
	ld hl, UnnamedText_4578b
	call PrintText
.asm_46c43 ; 0x45788
	jp TextScriptEnd

UnnamedText_4578b: ; 4578b (11:578b)
	TX_FAR _UnnamedText_4578b ; 0x82438
	db $d, $50

RocketHideoutElevatorObject: ; 0x45791 (size=23)
	db $f ; border tile

	db $2 ; warps
	db $1, $2, $2, ROCKET_HIDEOUT_1
	db $1, $3, $4, ROCKET_HIDEOUT_1

	db $1 ; signs
	db $1, $1, $1 ; RocketHideoutElevatorText1

	db $0 ; people

	; warp-to
	EVENT_DISP $3, $1, $2 ; ROCKET_HIDEOUT_1
	EVENT_DISP $3, $1, $3 ; ROCKET_HIDEOUT_1

RocketHideoutElevatorBlocks: ; 457a8 (11:57a8)
	INCBIN "maps/rockethideoutelevator.blk"

SilphCoElevator_h: ; 0x457b4 to 0x457c0 (12 bytes) (bank=11) (id=236)
	db $12 ; tileset
	db SILPH_CO_ELEVATOR_HEIGHT, SILPH_CO_ELEVATOR_WIDTH ; dimensions (y, x)
	dw SilphCoElevatorBlocks, SilphCoElevatorTexts, SilphCoElevatorScript ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCoElevatorObject ; objects

SilphCoElevatorScript: ; 457c0 (11:57c0)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	push hl
	call nz, SilphCoElevatorScript_Unknown457dc
	pop hl
	bit 7, [hl]
	res 7, [hl]
	call nz, Func_45827
	xor a
	ld [$cf0c], a
	inc a
	ld [$cc3c], a
	ret
; 0x457dc

SilphCoElevatorScript_Unknown457dc: ; 457dc (11:57dc)
	ld hl, $d3af
	ld a, [$d73b]
	ld b, a
	ld a, [$d73c]
	ld c, a
	call Func_457ea

; known jump sources: 457e7 (11:57e7)
Func_457ea: ; 457ea (11:57ea)
	inc hl
	inc hl
	ld a, b
	ld [hli], a
	ld a, c
	ld [hli], a
	ret

; known jump sources: 45836 (11:5836)
Func_457f1: ; 457f1 (11:57f1)
	ld hl, Unknown_45804 ; $5804
	call LoadItemList
	ld hl, Unknown_45811 ; $5811
	ld de, $cc5b
	ld bc, $16
	call CopyData
	ret

Unknown_45804: ; 45804 (11:5804)
INCBIN "baserom.gbc",$45804,$45811 - $45804

Unknown_45811: ; 45811 (11:5811)
INCBIN "baserom.gbc",$45811,$45827 - $45811

; known jump sources: 457d0 (11:57d0)
Func_45827: ; 45827 (11:5827)
	call Delay3
	ld b, BANK(Func_7bf15)
	ld hl, Func_7bf15
	call Bankswitch ; indirect jump to Func_7bf15 (7bf15 (1e:7f15))
	ret
; 45833 (11:5833)
SilphCoElevatorTexts: ; 45833 (11:5833)
	dw SilphCoElevatorText1

SilphCoElevatorText1: ; 45835 (11:5835)
	db $08 ; asm
	call Func_457f1
	ld hl, Unknown_45811 ; $5811
	ld a, $61
	call Predef
	jp TextScriptEnd

SilphCoElevatorObject: ; 0x45844 (size=23)
	db $f ; border tile

	db $2 ; warps
	db $3, $1, $0, $ed
	db $3, $2, $0, $ed

	db $1 ; signs
	db $0, $3, $1 ; SilphCoElevatorText1

	db $0 ; people

	; warp-to
	EVENT_DISP $2, $3, $1
	EVENT_DISP $2, $3, $2

SilphCoElevatorBlocks: ; 4585b (11:585b)
	INCBIN "maps/silphcoelevator.blk"

SafariZoneEast_h: ; 0x4585f to 0x4586b (12 bytes) (bank=11) (id=217)
	db $03 ; tileset
	db SAFARI_ZONE_EAST_HEIGHT, SAFARI_ZONE_EAST_WIDTH ; dimensions (y, x)
	dw SafariZoneEastBlocks, SafariZoneEastTexts, SafariZoneEastScript ; blocks, texts, scripts
	db $00 ; connections

	dw SafariZoneEastObject ; objects

SafariZoneEastScript: ; 4586b (11:586b)
	jp EnableAutoTextBoxDrawing
; 0x4586e

SafariZoneEastTexts: ; 4586e (11:586e)
	dw Predef5CText, Predef5CText, Predef5CText, Predef5CText, SafariZoneEastText5, SafariZoneEastText6, SafariZoneEastText7

SafariZoneEastText5: ; 4587c (11:587c)
	TX_FAR _SafariZoneEastText5
	db $50

SafariZoneEastText6: ; 45881 (11:5881)
	TX_FAR _SafariZoneEastText6
	db $50

SafariZoneEastText7: ; 45886 (11:5886)
	TX_FAR _SafariZoneEastText7
	db $50

SafariZoneEastObject: ; 0x4588b (size=81)
	db $0 ; border tile

	db $5 ; warps
	db $4, $0, $6, SAFARI_ZONE_NORTH
	db $5, $0, $7, SAFARI_ZONE_NORTH
	db $16, $0, $6, SAFARI_ZONE_CENTER
	db $17, $0, $6, SAFARI_ZONE_CENTER
	db $9, $19, $0, SAFARI_ZONE_REST_HOUSE_3

	db $3 ; signs
	db $a, $1a, $5 ; SafariZoneEastText5
	db $4, $6, $6 ; SafariZoneEastText6
	db $17, $5, $7 ; SafariZoneEastText7

	db $4 ; people
	db SPRITE_BALL, $a + 4, $15 + 4, $ff, $ff, $81, FULL_RESTORE ; item
	db SPRITE_BALL, $7 + 4, $3 + 4, $ff, $ff, $82, MAX_POTION ; item
	db SPRITE_BALL, $d + 4, $14 + 4, $ff, $ff, $83, CARBOS ; item
	db SPRITE_BALL, $c + 4, $f + 4, $ff, $ff, $84, TM_37 ; item

	; warp-to
	EVENT_DISP $f, $4, $0 ; SAFARI_ZONE_NORTH
	EVENT_DISP $f, $5, $0 ; SAFARI_ZONE_NORTH
	EVENT_DISP $f, $16, $0 ; SAFARI_ZONE_CENTER
	EVENT_DISP $f, $17, $0 ; SAFARI_ZONE_CENTER
	EVENT_DISP $f, $9, $19 ; SAFARI_ZONE_REST_HOUSE_3

SafariZoneEastBlocks: ; 458dc (11:58dc)
	INCBIN "maps/safarizoneeast.blk"

SafariZoneNorth_h: ; 0x4599f to 0x459ab (12 bytes) (bank=11) (id=218)
	db $03 ; tileset
	db SAFARI_ZONE_NORTH_HEIGHT, SAFARI_ZONE_NORTH_WIDTH ; dimensions (y, x)
	dw SafariZoneNorthBlocks, SafariZoneNorthTexts, SafariZoneNorthScript ; blocks, texts, scripts
	db $00 ; connections

	dw SafariZoneNorthObject ; objects

SafariZoneNorthScript: ; 459ab (11:59ab)
	jp EnableAutoTextBoxDrawing
; 0x459ae

SafariZoneNorthTexts: ; 459ae (11:59ae)
	dw Predef5CText, Predef5CText, SafariZoneNorthText3, SafariZoneNorthText4, SafariZoneNorthText5, SafariZoneNorthText6, SafariZoneNorthText7

SafariZoneNorthText3: ; 459bc (11:59bc)
	TX_FAR _SafariZoneNorthText3
	db $50

SafariZoneNorthText4: ; 459c1 (11:59c1)
	TX_FAR _SafariZoneNorthText4
	db $50

SafariZoneNorthText5: ; 459c6 (11:59c6)
	TX_FAR _SafariZoneNorthText5
	db $50

SafariZoneNorthText6: ; 459cb (11:59cb)
	TX_FAR _SafariZoneNorthText6
	db $50

SafariZoneNorthText7: ; 459d0 (11:59d0)
	TX_FAR _SafariZoneNorthText7
	db $50

SafariZoneNorthObject: ; 0x459d5 (size=105)
	db $0 ; border tile

	db $9 ; warps
	db $23, $2, $0, SAFARI_ZONE_WEST
	db $23, $3, $1, SAFARI_ZONE_WEST
	db $23, $8, $2, SAFARI_ZONE_WEST
	db $23, $9, $3, SAFARI_ZONE_WEST
	db $23, $14, $4, SAFARI_ZONE_CENTER
	db $23, $15, $5, SAFARI_ZONE_CENTER
	db $1e, $27, $0, SAFARI_ZONE_EAST
	db $1f, $27, $1, SAFARI_ZONE_EAST
	db $3, $23, $0, SAFARI_ZONE_REST_HOUSE_4

	db $5 ; signs
	db $4, $24, $3 ; SafariZoneNorthText3
	db $19, $4, $4 ; SafariZoneNorthText4
	db $1f, $d, $5 ; SafariZoneNorthText5
	db $21, $13, $6 ; SafariZoneNorthText6
	db $1c, $1a, $7 ; SafariZoneNorthText7

	db $2 ; people
	db SPRITE_BALL, $1 + 4, $19 + 4, $ff, $ff, $81, PROTEIN ; item
	db SPRITE_BALL, $7 + 4, $13 + 4, $ff, $ff, $82, TM_40 ; item

	; warp-to
	EVENT_DISP $14, $23, $2 ; SAFARI_ZONE_WEST
	EVENT_DISP $14, $23, $3 ; SAFARI_ZONE_WEST
	EVENT_DISP $14, $23, $8 ; SAFARI_ZONE_WEST
	EVENT_DISP $14, $23, $9 ; SAFARI_ZONE_WEST
	EVENT_DISP $14, $23, $14 ; SAFARI_ZONE_CENTER
	EVENT_DISP $14, $23, $15 ; SAFARI_ZONE_CENTER
	EVENT_DISP $14, $1e, $27 ; SAFARI_ZONE_EAST
	EVENT_DISP $14, $1f, $27 ; SAFARI_ZONE_EAST
	EVENT_DISP $14, $3, $23 ; SAFARI_ZONE_REST_HOUSE_4

SafariZoneNorthBlocks: ; 45a3e (11:5a3e)
	INCBIN "maps/safarizonenorth.blk"

SafariZoneCenter_h: ; 0x45ba6 to 0x45bb2 (12 bytes) (bank=11) (id=220)
	db $03 ; tileset
	db SAFARI_ZONE_CENTER_HEIGHT, SAFARI_ZONE_CENTER_WIDTH ; dimensions (y, x)
	dw SafariZoneCenterBlocks, SafariZoneCenterTexts, SafariZoneCenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw SafariZoneCenterObject ; objects

SafariZoneCenterScript: ; 45bb2 (11:5bb2)
	jp EnableAutoTextBoxDrawing
; 0x45bb5

SafariZoneCenterTexts: ; 45bb5 (11:5bb5)
	dw Predef5CText, SafariZoneCenterText2, SafariZoneCenterText3

SafariZoneCenterText2: ; 45bbb (11:5bbb)
	TX_FAR _SafariZoneCenterText2
	db $50

SafariZoneCenterText3: ; 45bc0 (11:5bc0)
	TX_FAR _SafariZoneCenterText3
	db $50

SafariZoneCenterObject: ; 0x45bc5 (size=89)
	db $0 ; border tile

	db $9 ; warps
	db $19, $e, $2, SAFARIZONEENTRANCE
	db $19, $f, $3, SAFARIZONEENTRANCE
	db $a, $0, $4, SAFARI_ZONE_WEST
	db $b, $0, $5, SAFARI_ZONE_WEST
	db $0, $e, $4, SAFARI_ZONE_NORTH
	db $0, $f, $5, SAFARI_ZONE_NORTH
	db $a, $1d, $2, SAFARI_ZONE_EAST
	db $b, $1d, $3, SAFARI_ZONE_EAST
	db $13, $11, $0, SAFARI_ZONE_REST_HOUSE_1

	db $2 ; signs
	db $14, $12, $2 ; SafariZoneCenterText2
	db $16, $e, $3 ; SafariZoneCenterText3

	db $1 ; people
	db SPRITE_BALL, $a + 4, $e + 4, $ff, $ff, $81, NUGGET ; item

	; warp-to
	EVENT_DISP $f, $19, $e ; SAFARIZONEENTRANCE
	EVENT_DISP $f, $19, $f ; SAFARIZONEENTRANCE
	EVENT_DISP $f, $a, $0 ; SAFARI_ZONE_WEST
	EVENT_DISP $f, $b, $0 ; SAFARI_ZONE_WEST
	EVENT_DISP $f, $0, $e ; SAFARI_ZONE_NORTH
	EVENT_DISP $f, $0, $f ; SAFARI_ZONE_NORTH
	EVENT_DISP $f, $a, $1d ; SAFARI_ZONE_EAST
	EVENT_DISP $f, $b, $1d ; SAFARI_ZONE_EAST
	EVENT_DISP $f, $13, $11 ; SAFARI_ZONE_REST_HOUSE_1

SafariZoneCenterBlocks: ; 45c1e (11:5c1e)
	INCBIN "maps/safarizonecenter.blk"

SafariZoneRestHouse1_h: ; 0x45ce1 to 0x45ced (12 bytes) (bank=11) (id=221)
	db $0c ; tileset
	db SAFARI_ZONE_REST_HOUSE_1_HEIGHT, SAFARI_ZONE_REST_HOUSE_1_WIDTH ; dimensions (y, x)
	dw SafariZoneRestHouse1Blocks, SafariZoneRestHouse1Texts, SafariZoneRestHouse1Script ; blocks, texts, scripts
	db $00 ; connections

	dw SafariZoneRestHouse1Object ; objects

SafariZoneRestHouse1Script: ; 45ced (11:5ced)
	jp EnableAutoTextBoxDrawing
; 0x45cf0

SafariZoneRestHouse1Texts: ; 45cf0 (11:5cf0)
	dw SafariZoneRestHouse1Text1, SafariZoneRestHouse1Text2

SafariZoneRestHouse1Text1: ; 45cf4 (11:5cf4)
	TX_FAR _SafariZoneRestHouse1Text1
	db $50

SafariZoneRestHouse1Text2: ; 45cf9 (11:5cf9)
	TX_FAR _SafariZoneRestHouse1Text2
	db $50

SafariZoneRestHouse1Object: ; 0x45cfe (size=32)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $8, SAFARI_ZONE_CENTER
	db $7, $3, $8, SAFARI_ZONE_CENTER

	db $0 ; signs

	db $2 ; people
	db SPRITE_GIRL, $2 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_OAK_AIDE, $4 + 4, $1 + 4, $fe, $1, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2 ; SAFARI_ZONE_CENTER
	EVENT_DISP $4, $7, $3 ; SAFARI_ZONE_CENTER

SafariZoneRestHouse2_h: ; 0x45d1e to 0x45d2a (12 bytes) (bank=11) (id=223)
	db $0c ; tileset
	db SAFARI_ZONE_REST_HOUSE_2_HEIGHT, SAFARI_ZONE_REST_HOUSE_2_WIDTH ; dimensions (y, x)
	dw $40fb, SafariZoneRestHouse2Texts, SafariZoneRestHouse2Script ; blocks, texts, scripts
	db $00 ; connections

	dw SafariZoneRestHouse2Object ; objects

SafariZoneRestHouse2Script: ; 45d2a (11:5d2a)
	call EnableAutoTextBoxDrawing
	ret
; 0x45d2e

SafariZoneRestHouse2Texts: ; 45d2e (11:5d2e)
	dw SafariZoneRestHouse2Text1, SafariZoneRestHouse2Text2, SafariZoneRestHouse2Text3

SafariZoneRestHouse2Text1: ; 45d34 (11:5d34)
	TX_FAR _SafariZoneRestHouse2Text1
	db $50

SafariZoneRestHouse2Text2: ; 45d39 (11:5d39)
	TX_FAR _SafariZoneRestHouse2Text2
	db $50

SafariZoneRestHouse2Text3: ; 45d3e (11:5d3e)
	TX_FAR _SafariZoneRestHouse2Text3
	db $50

SafariZoneRestHouse2Object: ; 0x45d43 (size=38)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $7, SAFARI_ZONE_WEST
	db $7, $3, $7, SAFARI_ZONE_WEST

	db $0 ; signs

	db $3 ; people
	db SPRITE_OAK_AIDE, $4 + 4, $4 + 4, $fe, $0, $1 ; person
	db SPRITE_BLACK_HAIR_BOY_1, $2 + 4, $0 + 4, $ff, $d3, $2 ; person
	db SPRITE_ERIKA, $2 + 4, $6 + 4, $ff, $d0, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2 ; SAFARI_ZONE_WEST
	EVENT_DISP $4, $7, $3 ; SAFARI_ZONE_WEST

SafariZoneRestHouse3_h: ; 0x45d69 to 0x45d75 (12 bytes) (bank=11) (id=224)
	db $0c ; tileset
	db SAFARI_ZONE_REST_HOUSE_3_HEIGHT, SAFARI_ZONE_REST_HOUSE_3_WIDTH ; dimensions (y, x)
	dw $40fb, SafariZoneRestHouse3Texts, SafariZoneRestHouse3Script ; blocks, texts, scripts
	db $00 ; connections

	dw SafariZoneRestHouse3Object ; objects

SafariZoneRestHouse3Script: ; 45d75 (11:5d75)
	call EnableAutoTextBoxDrawing
	ret
; 0x45d79

SafariZoneRestHouse3Texts: ; 45d79 (11:5d79)
	dw SafariZoneRestHouse3Text1, SafariZoneRestHouse3Text2, SafariZoneRestHouse3Text3

SafariZoneRestHouse3Text1: ; 45d7f (11:5d7f)
	TX_FAR _SafariZoneRestHouse3Text1
	db $50

SafariZoneRestHouse3Text2: ; 45d84 (11:5d84)
	TX_FAR _SafariZoneRestHouse3Text2
	db $50

SafariZoneRestHouse3Text3: ; 45d89 (11:5d89)
	TX_FAR _SafariZoneRestHouse3Text3
	db $50

SafariZoneRestHouse3Object: ; 0x45d8e (size=38)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $4, SAFARI_ZONE_EAST
	db $7, $3, $4, SAFARI_ZONE_EAST

	db $0 ; signs

	db $3 ; people
	db SPRITE_OAK_AIDE, $3 + 4, $1 + 4, $fe, $1, $1 ; person
	db SPRITE_ROCKER, $2 + 4, $4 + 4, $ff, $ff, $2 ; person
	db SPRITE_LAPRAS_GIVER, $2 + 4, $5 + 4, $ff, $ff, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2 ; SAFARI_ZONE_EAST
	EVENT_DISP $4, $7, $3 ; SAFARI_ZONE_EAST

SafariZoneRestHouse4_h: ; 0x45db4 to 0x45dc0 (12 bytes) (bank=11) (id=225)
	db $0c ; tileset
	db SAFARI_ZONE_REST_HOUSE_4_HEIGHT, SAFARI_ZONE_REST_HOUSE_4_WIDTH ; dimensions (y, x)
	dw $40fb, SafariZoneRestHouse4Texts, SafariZoneRestHouse4Script ; blocks, texts, scripts
	db $00 ; connections

	dw SafariZoneRestHouse4Object ; objects

SafariZoneRestHouse4Script: ; 45dc0 (11:5dc0)
	call EnableAutoTextBoxDrawing
	ret
; 0x45dc4

SafariZoneRestHouse4Texts: ; 45dc4 (11:5dc4)
	dw SafariZoneRestHouse4Text1, SafariZoneRestHouse4Text2, SafariZoneRestHouse4Text3

SafariZoneRestHouse4Text1: ; 45dca (11:5dca)
	TX_FAR _SafariZoneRestHouse4Text1
	db $50

SafariZoneRestHouse4Text2: ; 45dcf (11:5dcf)
	TX_FAR _SafariZoneRestHouse4Text2
	db $50

SafariZoneRestHouse4Text3: ; 45dd4 (11:5dd4)
	TX_FAR _SafariZoneRestHouse4Text3
	db $50

SafariZoneRestHouse4Object: ; 0x45dd9 (size=38)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $8, SAFARI_ZONE_NORTH
	db $7, $3, $8, SAFARI_ZONE_NORTH

	db $0 ; signs

	db $3 ; people
	db SPRITE_OAK_AIDE, $3 + 4, $6 + 4, $fe, $2, $1 ; person
	db SPRITE_WHITE_PLAYER, $4 + 4, $3 + 4, $ff, $ff, $2 ; person
	db SPRITE_GENTLEMAN, $5 + 4, $1 + 4, $fe, $1, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2 ; SAFARI_ZONE_NORTH
	EVENT_DISP $4, $7, $3 ; SAFARI_ZONE_NORTH

UnknownDungeon2_h: ; 0x45dff to 0x45e0b (12 bytes) (bank=11) (id=226)
	db $11 ; tileset
	db UNKNOWN_DUNGEON_2_HEIGHT, UNKNOWN_DUNGEON_2_WIDTH ; dimensions (y, x)
	dw UnknownDungeon2Blocks, UnknownDungeon2Texts, UnknownDungeon2Script ; blocks, texts, scripts
	db $00 ; connections

	dw UnknownDungeon2Object ; objects

UnknownDungeon2Script: ; 45e0b (11:5e0b)
	jp EnableAutoTextBoxDrawing
; 0x45e0e

UnknownDungeon2Texts: ; 45e0e (11:5e0e)
	dw Predef5CText, Predef5CText, Predef5CText

UnknownDungeon2Object: ; 0x45e14 (size=73)
	db $7d ; border tile

	db $6 ; warps
	db $1, $1d, $2, UNKNOWN_DUNGEON_1
	db $6, $16, $3, UNKNOWN_DUNGEON_1
	db $7, $13, $4, UNKNOWN_DUNGEON_1
	db $1, $9, $5, UNKNOWN_DUNGEON_1
	db $3, $1, $6, UNKNOWN_DUNGEON_1
	db $b, $3, $7, UNKNOWN_DUNGEON_1

	db $0 ; signs

	db $3 ; people
	db SPRITE_BALL, $9 + 4, $1d + 4, $ff, $ff, $81, PP_UP ; item
	db SPRITE_BALL, $f + 4, $4 + 4, $ff, $ff, $82, ULTRA_BALL ; item
	db SPRITE_BALL, $6 + 4, $d + 4, $ff, $ff, $83, FULL_RESTORE ; item

	; warp-to
	EVENT_DISP $f, $1, $1d ; UNKNOWN_DUNGEON_1
	EVENT_DISP $f, $6, $16 ; UNKNOWN_DUNGEON_1
	EVENT_DISP $f, $7, $13 ; UNKNOWN_DUNGEON_1
	EVENT_DISP $f, $1, $9 ; UNKNOWN_DUNGEON_1
	EVENT_DISP $f, $3, $1 ; UNKNOWN_DUNGEON_1
	EVENT_DISP $f, $b, $3 ; UNKNOWN_DUNGEON_1

UnknownDungeon2Blocks: ; 45e5d (11:5e5d)
	INCBIN "maps/unknowndungeon2.blk"

UnknownDungeon3_h: ; 0x45ee4 to 0x45ef0 (12 bytes) (bank=11) (id=227)
	db $11 ; tileset
	db UNKNOWN_DUNGEON_3_HEIGHT, UNKNOWN_DUNGEON_3_WIDTH ; dimensions (y, x)
	dw UnknownDungeon3Blocks, UnknownDungeon3Texts, UnknownDungeon3Script ; blocks, texts, scripts
	db $00 ; connections

	dw UnknownDungeon3Object ; objects

UnknownDungeon3Script: ; 45ef0 (11:5ef0)
	call EnableAutoTextBoxDrawing
	ld hl, UnknownDungeon3TrainerHeaders
	ld de, UnknownDungeon3Script_Unknown45f03
	ld a, [W_UNKNOWNDUNGEON3CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_UNKNOWNDUNGEON3CURSCRIPT], a
	ret
; 0x45f03

UnknownDungeon3Script_Unknown45f03: ; 45f03 (11:5f03)
INCBIN "baserom.gbc",$45f03,$45f09 - $45f03

UnknownDungeon3Texts: ; 45f09 (11:5f09)
	dw UnknownDungeon3Text1, Predef5CText, Predef5CText

UnknownDungeon3TrainerHeaders: ; 45f0f (11:5f0f)
UnknownDungeon3TrainerHeader0: ; 45f0f (11:5f0f)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d85f ; flag's byte
	dw UnknownDungeon3MewtwoText ; 0x5f26 TextBeforeBattle
	dw UnknownDungeon3MewtwoText ; 0x5f26 TextAfterBattle
	dw UnknownDungeon3MewtwoText ; 0x5f26 TextEndBattle
	dw UnknownDungeon3MewtwoText ; 0x5f26 TextEndBattle
; 0x45f1b

db $ff

UnknownDungeon3Text1: ; 45f1c (11:5f1c)
	db $08 ; asm
	ld hl, UnknownDungeon3TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

UnknownDungeon3MewtwoText: ; 45f26 (11:5f26)
	TX_FAR _UnknownDungeon3MewtwoText ; 0x85c72
	db $8
	ld a, MEWTWO
	call PlayCry
	call WaitForSoundToFinish
	jp TextScriptEnd
; 0x45f36

UnknownDungeon3Object: ; 0x45f36 (size=34)
	db $7d ; border tile

	db $1 ; warps
	db $6, $3, $8, UNKNOWN_DUNGEON_1

	db $0 ; signs

	db $3 ; people
	db SPRITE_SLOWBRO, $d + 4, $1b + 4, $ff, $d0, $41, MEWTWO, 70 ; trainer
	db SPRITE_BALL, $9 + 4, $10 + 4, $ff, $ff, $82, ULTRA_BALL ; item
	db SPRITE_BALL, $1 + 4, $12 + 4, $ff, $ff, $83, MAX_REVIVE ; item

	; warp-to
	EVENT_DISP $f, $6, $3 ; UNKNOWN_DUNGEON_1

UnknownDungeon3Blocks: ; 45f58 (11:5f58)
	INCBIN "maps/unknowndungeon3.blk"

RockTunnel2_h: ; 0x45fdf to 0x45feb (12 bytes) (bank=11) (id=232)
	db $11 ; tileset
	db ROCK_TUNNEL_2_HEIGHT, ROCK_TUNNEL_2_WIDTH ; dimensions (y, x)
	dw RockTunnel2Blocks, RockTunnel2Texts, RockTunnel2Script ; blocks, texts, scripts
	db $00 ; connections

	dw RockTunnel2Object ; objects

RockTunnel2Script: ; 45feb (11:5feb)
	call EnableAutoTextBoxDrawing
	ld hl, RockTunnel2TrainerHeaders
	ld de, RockTunnel2Script_Unknown45ffe
	ld a, [W_ROCKTUNNEL2CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROCKTUNNEL2CURSCRIPT], a
	ret
; 0x45ffe

RockTunnel2Script_Unknown45ffe: ; 45ffe (11:5ffe)
INCBIN "baserom.gbc",$45ffe,$46004 - $45ffe

RockTunnel2Texts: ; 46004 (11:6004)
	dw RockTunnel2Text1, RockTunnel2Text2, RockTunnel2Text3, RockTunnel2Text4, RockTunnel2Text5, RockTunnel2Text6, RockTunnel2Text7, RockTunnel2Text8

RockTunnel2TrainerHeaders: ; 46014 (11:6014)
RockTunnel2TrainerHeader0: ; 46014 (11:6014)
	db $1 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d87d ; flag's byte
	dw RockTunnel2BattleText2 ; 0x60c5 TextBeforeBattle
	dw RockTunnel2AfterBattleText2 ; 0x60cf TextAfterBattle
	dw RockTunnel2EndBattleText2 ; 0x60ca TextEndBattle
	dw RockTunnel2EndBattleText2 ; 0x60ca TextEndBattle
; 0x46020

RockTunnel2TrainerHeader2: ; 46020 (11:6020)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d87d ; flag's byte
	dw RockTunnel2BattleText3 ; 0x60d4 TextBeforeBattle
	dw RockTunnel2AfterBattleText3 ; 0x60de TextAfterBattle
	dw RockTunnel2EndBattleText3 ; 0x60d9 TextEndBattle
	dw RockTunnel2EndBattleText3 ; 0x60d9 TextEndBattle
; 0x4602c

RockTunnel2TrainerHeader3: ; 4602c (11:602c)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d87d ; flag's byte
	dw RockTunnel2BattleText4 ; 0x60e3 TextBeforeBattle
	dw RockTunnel2AfterBattleText4 ; 0x60ed TextAfterBattle
	dw RockTunnel2EndBattleText4 ; 0x60e8 TextEndBattle
	dw RockTunnel2EndBattleText4 ; 0x60e8 TextEndBattle
; 0x46038

RockTunnel2TrainerHeader4: ; 46038 (11:6038)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d87d ; flag's byte
	dw RockTunnel2BattleText5 ; 0x60f2 TextBeforeBattle
	dw RockTunnel2AfterBattleText5 ; 0x60fc TextAfterBattle
	dw RockTunnel2EndBattleText5 ; 0x60f7 TextEndBattle
	dw RockTunnel2EndBattleText5 ; 0x60f7 TextEndBattle
; 0x46044

RockTunnel2TrainerHeader5: ; 46044 (11:6044)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d87d ; flag's byte
	dw RockTunnel2BattleText6 ; 0x6101 TextBeforeBattle
	dw RockTunnel2AfterBattleText6 ; 0x610b TextAfterBattle
	dw RockTunnel2EndBattleText6 ; 0x6106 TextEndBattle
	dw RockTunnel2EndBattleText6 ; 0x6106 TextEndBattle
; 0x46050

RockTunnel2TrainerHeader6: ; 46050 (11:6050)
	db $6 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d87d ; flag's byte
	dw RockTunnel2BattleText7 ; 0x6110 TextBeforeBattle
	dw RockTunnel2AfterBattleText7 ; 0x611a TextAfterBattle
	dw RockTunnel2EndBattleText7 ; 0x6115 TextEndBattle
	dw RockTunnel2EndBattleText7 ; 0x6115 TextEndBattle
; 0x4605c

RockTunnel2TrainerHeader7: ; 4605c (11:605c)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d87d ; flag's byte
	dw RockTunnel2BattleText8 ; 0x611f TextBeforeBattle
	dw RockTunnel2AfterBattleText8 ; 0x6129 TextAfterBattle
	dw RockTunnel2EndBattleText8 ; 0x6124 TextEndBattle
	dw RockTunnel2EndBattleText8 ; 0x6124 TextEndBattle
; 0x46068

RockTunnel2TrainerHeader8: ; 46068 (11:6068)
	db $8 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d87d ; flag's byte
	dw RockTunnel2BattleText9 ; 0x612e TextBeforeBattle
	dw RockTunnel2AfterBattleText9 ; 0x6138 TextAfterBattle
	dw RockTunnel2EndBattleText9 ; 0x6133 TextEndBattle
	dw RockTunnel2EndBattleText9 ; 0x6133 TextEndBattle
; 0x46074

db $ff

RockTunnel2Text1: ; 46075 (11:6075)
	db $08 ; asm
	ld hl, RockTunnel2TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

RockTunnel2Text2: ; 4607f (11:607f)
	db $08 ; asm
	ld hl, RockTunnel2TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

RockTunnel2Text3: ; 46089 (11:6089)
	db $08 ; asm
	ld hl, RockTunnel2TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

RockTunnel2Text4: ; 46093 (11:6093)
	db $08 ; asm
	ld hl, RockTunnel2TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

RockTunnel2Text5: ; 4609d (11:609d)
	db $08 ; asm
	ld hl, RockTunnel2TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

RockTunnel2Text6: ; 460a7 (11:60a7)
	db $08 ; asm
	ld hl, RockTunnel2TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

RockTunnel2Text7: ; 460b1 (11:60b1)
	db $08 ; asm
	ld hl, RockTunnel2TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

RockTunnel2Text8: ; 460bb (11:60bb)
	db $08 ; asm
	ld hl, RockTunnel2TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

RockTunnel2BattleText2: ; 460c5 (11:60c5)
	TX_FAR _RockTunnel2BattleText2
	db $50
; 0x460c5 + 5 bytes

RockTunnel2EndBattleText2: ; 460ca (11:60ca)
	TX_FAR _RockTunnel2EndBattleText2
	db $50
; 0x460ca + 5 bytes

RockTunnel2AfterBattleText2: ; 460cf (11:60cf)
	TX_FAR _RockTunnel2AfterBattleText2
	db $50
; 0x460cf + 5 bytes

RockTunnel2BattleText3: ; 460d4 (11:60d4)
	TX_FAR _RockTunnel2BattleText3
	db $50
; 0x460d4 + 5 bytes

RockTunnel2EndBattleText3: ; 460d9 (11:60d9)
	TX_FAR _RockTunnel2EndBattleText3
	db $50
; 0x460d9 + 5 bytes

RockTunnel2AfterBattleText3: ; 460de (11:60de)
	TX_FAR _RockTunnel2AfterBattleText3
	db $50
; 0x460de + 5 bytes

RockTunnel2BattleText4: ; 460e3 (11:60e3)
	TX_FAR _RockTunnel2BattleText4
	db $50
; 0x460e3 + 5 bytes

RockTunnel2EndBattleText4: ; 460e8 (11:60e8)
	TX_FAR _RockTunnel2EndBattleText4
	db $50
; 0x460e8 + 5 bytes

RockTunnel2AfterBattleText4: ; 460ed (11:60ed)
	TX_FAR _RockTunnel2AfterBattleText4
	db $50
; 0x460ed + 5 bytes

RockTunnel2BattleText5: ; 460f2 (11:60f2)
	TX_FAR _RockTunnel2BattleText5
	db $50
; 0x460f2 + 5 bytes

RockTunnel2EndBattleText5: ; 460f7 (11:60f7)
	TX_FAR _RockTunnel2EndBattleText5
	db $50
; 0x460f7 + 5 bytes

RockTunnel2AfterBattleText5: ; 460fc (11:60fc)
	TX_FAR _RockTunnel2AfterBattleText5
	db $50
; 0x460fc + 5 bytes

RockTunnel2BattleText6: ; 46101 (11:6101)
	TX_FAR _RockTunnel2BattleText6
	db $50
; 0x46101 + 5 bytes

RockTunnel2EndBattleText6: ; 46106 (11:6106)
	TX_FAR _RockTunnel2EndBattleText6
	db $50
; 0x46106 + 5 bytes

RockTunnel2AfterBattleText6: ; 4610b (11:610b)
	TX_FAR _RockTunnel2AfterBattleText6
	db $50
; 0x4610b + 5 bytes

RockTunnel2BattleText7: ; 46110 (11:6110)
	TX_FAR _RockTunnel2BattleText7
	db $50
; 0x46110 + 5 bytes

RockTunnel2EndBattleText7: ; 46115 (11:6115)
	TX_FAR _RockTunnel2EndBattleText7
	db $50
; 0x46115 + 5 bytes

RockTunnel2AfterBattleText7: ; 4611a (11:611a)
	TX_FAR _RockTunnel2AfterBattleText7
	db $50
; 0x4611a + 5 bytes

RockTunnel2BattleText8: ; 4611f (11:611f)
	TX_FAR _RockTunnel2BattleText8
	db $50
; 0x4611f + 5 bytes

RockTunnel2EndBattleText8: ; 46124 (11:6124)
	TX_FAR _RockTunnel2EndBattleText8
	db $50
; 0x46124 + 5 bytes

RockTunnel2AfterBattleText8: ; 46129 (11:6129)
	TX_FAR _RockTunnel2AfterBattleText8
	db $50
; 0x46129 + 5 bytes

RockTunnel2BattleText9: ; 4612e (11:612e)
	TX_FAR _RockTunnel2BattleText9
	db $50
; 0x4612e + 5 bytes

RockTunnel2EndBattleText9: ; 46133 (11:6133)
	TX_FAR _RockTunnel2EndBattleText9
	db $50
; 0x46133 + 5 bytes

RockTunnel2AfterBattleText9: ; 46138 (11:6138)
	TX_FAR _RockTunnel2AfterBattleText9
	db $50
; 0x46138 + 5 bytes

RockTunnel2Object: ; 0x4613d (size=100)
	db $3 ; border tile

	db $4 ; warps
	db $19, $21, $4, ROCK_TUNNEL_1
	db $3, $1b, $5, ROCK_TUNNEL_1
	db $b, $17, $6, ROCK_TUNNEL_1
	db $3, $3, $7, ROCK_TUNNEL_1

	db $0 ; signs

	db $8 ; people
	db SPRITE_LASS, $d + 4, $b + 4, $ff, $d0, $41, JR__TRAINER_F + $C8, $9 ; trainer
	db SPRITE_HIKER, $a + 4, $6 + 4, $ff, $d0, $42, HIKER + $C8, $9 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $5 + 4, $3 + 4, $ff, $d0, $43, POKEMANIAC + $C8, $3 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $15 + 4, $14 + 4, $ff, $d3, $44, POKEMANIAC + $C8, $4 ; trainer
	db SPRITE_HIKER, $a + 4, $1e + 4, $ff, $d0, $45, HIKER + $C8, $a ; trainer
	db SPRITE_LASS, $1c + 4, $e + 4, $ff, $d3, $46, JR__TRAINER_F + $C8, $a ; trainer
	db SPRITE_HIKER, $5 + 4, $21 + 4, $ff, $d3, $47, HIKER + $C8, $b ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $1e + 4, $1a + 4, $ff, $d0, $48, POKEMANIAC + $C8, $5 ; trainer

	; warp-to
	EVENT_DISP $14, $19, $21 ; ROCK_TUNNEL_1
	EVENT_DISP $14, $3, $1b ; ROCK_TUNNEL_1
	EVENT_DISP $14, $b, $17 ; ROCK_TUNNEL_1
	EVENT_DISP $14, $3, $3 ; ROCK_TUNNEL_1

RockTunnel2Blocks: ; 461a1 (11:61a1)
	INCBIN "maps/rocktunnel2.blk"

SeafoamIslands2_h: ; 0x46309 to 0x46315 (12 bytes) (bank=11) (id=159)
	db $11 ; tileset
	db SEAFOAM_ISLANDS_2_HEIGHT, SEAFOAM_ISLANDS_2_WIDTH ; dimensions (y, x)
	dw SeafoamIslands2Blocks, SeafoamIslands2Texts, SeafoamIslands2Script ; blocks, texts, scripts
	db $00 ; connections

	dw SeafoamIslands2Object ; objects

SeafoamIslands2Script: ; 46315 (11:6315)
	call EnableAutoTextBoxDrawing
	ld hl, W_FLAGS_CD60
	bit 7, [hl]
	res 7, [hl]
	jr z, .asm_46362 ; 0x4631f $41
	ld hl, Seafoam2HolesCoords
	call CheckBoulderCoords
	ret nc
	ld hl, $d87f
	ld a, [$cd3d]
	cp $1
	jr nz, .asm_46340 ; 0x46330 $e
	set 0, [hl]
	ld a, $d9
	ld [$d079], a
	ld a, $db
	ld [$d07a], a
	jr .asm_4634c ; 0x4633e $c
.asm_46340
	set 1, [hl]
	ld a, $da
	ld [$d079], a
	ld a, $dc
	ld [$d07a], a
.asm_4634c
	ld a, [$d079]
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, [$d07a]
	ld [$cc4d], a
	ld a, $15
	jp Predef
.asm_46362
	ld a, $a0
	ld [$d71d], a
	ld hl, Seafoam2HolesCoords
	jp Func_46981
; 0x4636d

Seafoam2HolesCoords: ; 4636d (11:636d)
	db $06,$12
	db $06,$17
	db $ff

SeafoamIslands2Texts: ; 46372 (11:6372)
	dw BoulderText, BoulderText

SeafoamIslands2Object: ; 0x46376 (size=72)
	db $7d ; border tile

	db $7 ; warps
	db $2, $4, $0, SEAFOAM_ISLANDS_3
	db $5, $7, $4, SEAFOAM_ISLANDS_1
	db $7, $d, $2, SEAFOAM_ISLANDS_3
	db $f, $13, $3, SEAFOAM_ISLANDS_3
	db $f, $17, $6, SEAFOAM_ISLANDS_1
	db $b, $19, $5, SEAFOAM_ISLANDS_3
	db $3, $19, $5, SEAFOAM_ISLANDS_1

	db $0 ; signs

	db $2 ; people
	db SPRITE_BOULDER, $6 + 4, $11 + 4, $ff, $10, $1 ; person
	db SPRITE_BOULDER, $6 + 4, $16 + 4, $ff, $10, $2 ; person

	; warp-to
	EVENT_DISP $f, $2, $4 ; SEAFOAM_ISLANDS_3
	EVENT_DISP $f, $5, $7 ; SEAFOAM_ISLANDS_1
	EVENT_DISP $f, $7, $d ; SEAFOAM_ISLANDS_3
	EVENT_DISP $f, $f, $13 ; SEAFOAM_ISLANDS_3
	EVENT_DISP $f, $f, $17 ; SEAFOAM_ISLANDS_1
	EVENT_DISP $f, $b, $19 ; SEAFOAM_ISLANDS_3
	EVENT_DISP $f, $3, $19 ; SEAFOAM_ISLANDS_1

SeafoamIslands2Blocks: ; 463be (11:63be)
	INCBIN "maps/seafoamislands2.blk"

SeafoamIslands3_h: ; 0x46445 to 0x46451 (12 bytes) (bank=11) (id=160)
	db $11 ; tileset
	db SEAFOAM_ISLANDS_3_HEIGHT, SEAFOAM_ISLANDS_3_WIDTH ; dimensions (y, x)
	dw SeafoamIslands3Blocks, SeafoamIslands3Texts, SeafoamIslands3Script ; blocks, texts, scripts
	db $00 ; connections

	dw SeafoamIslands3Object ; objects

SeafoamIslands3Script: ; 46451 (11:6451)
	call EnableAutoTextBoxDrawing
	ld hl, W_FLAGS_CD60
	bit 7, [hl]
	res 7, [hl]
	jr z, .asm_4649e ; 0x4645b $41
	ld hl, Seafoam3HolesCoords
	call CheckBoulderCoords
	ret nc
	ld hl, $d880
	ld a, [$cd3d]
	cp $1
	jr nz, .asm_4647c ; 0x4646c $e
	set 0, [hl]
	ld a, $db
	ld [$d079], a
	ld a, $df
	ld [$d07a], a
	jr .asm_46488 ; 0x4647a $c
.asm_4647c
	set 1, [hl]
	ld a, $dc
	ld [$d079], a
	ld a, $e0
	ld [$d07a], a
.asm_46488
	ld a, [$d079]
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, [$d07a]
	ld [$cc4d], a
	ld a, $15
	jp Predef
.asm_4649e
	ld a, $a1
	ld [$d71d], a
	ld hl, Seafoam3HolesCoords
	jp Func_46981
; 0x464a9

Seafoam3HolesCoords: ; 464a9 (11:64a9)
	db $06,$13
	db $06,$16
	db $ff

SeafoamIslands3Texts: ; 464ae (11:64ae)
	dw BoulderText, BoulderText

SeafoamIslands3Object: ; 0x464b2 (size=72)
	db $7d ; border tile

	db $7 ; warps
	db $3, $5, $0, SEAFOAM_ISLANDS_2
	db $d, $5, $0, SEAFOAM_ISLANDS_4
	db $7, $d, $2, SEAFOAM_ISLANDS_2
	db $f, $13, $3, SEAFOAM_ISLANDS_2
	db $3, $19, $3, SEAFOAM_ISLANDS_4
	db $b, $19, $5, SEAFOAM_ISLANDS_2
	db $e, $19, $4, SEAFOAM_ISLANDS_4

	db $0 ; signs

	db $2 ; people
	db SPRITE_BOULDER, $6 + 4, $12 + 4, $ff, $10, $1 ; person
	db SPRITE_BOULDER, $6 + 4, $17 + 4, $ff, $10, $2 ; person

	; warp-to
	EVENT_DISP $f, $3, $5 ; SEAFOAM_ISLANDS_2
	EVENT_DISP $f, $d, $5 ; SEAFOAM_ISLANDS_4
	EVENT_DISP $f, $7, $d ; SEAFOAM_ISLANDS_2
	EVENT_DISP $f, $f, $13 ; SEAFOAM_ISLANDS_2
	EVENT_DISP $f, $3, $19 ; SEAFOAM_ISLANDS_4
	EVENT_DISP $f, $b, $19 ; SEAFOAM_ISLANDS_2
	EVENT_DISP $f, $e, $19 ; SEAFOAM_ISLANDS_4

SeafoamIslands3Blocks: ; 464fa (11:64fa)
	INCBIN "maps/seafoamislands3.blk"

SeafoamIslands4_h: ; 0x46581 to 0x4658d (12 bytes) (bank=11) (id=161)
	db $11 ; tileset
	db SEAFOAM_ISLANDS_4_HEIGHT, SEAFOAM_ISLANDS_4_WIDTH ; dimensions (y, x)
	dw SeafoamIslands4Blocks, SeafoamIslands4Texts, SeafoamIslands4Script ; blocks, texts, scripts
	db $00 ; connections

	dw SeafoamIslands4Object ; objects

SeafoamIslands4Script: ; 4658d (11:658d)
	call EnableAutoTextBoxDrawing
	ld hl, W_FLAGS_CD60
	bit 7, [hl]
	res 7, [hl]
	jr z, .asm_465dc ; 0x46597 $43
	ld hl, Seafoam4HolesCoords
	call CheckBoulderCoords
	ret nc
	ld hl, $d881
	ld a, [$cd3d]
	cp $1
	jr nz, .asm_465b8 ; 0x465a8 $e
	set 0, [hl]
	ld a, $dd
	ld [$d079], a
	ld a, $e1
	ld [$d07a], a
	jr .asm_465c4 ; 0x465b6 $c
.asm_465b8
	set 1, [hl]
	ld a, $de
	ld [$d079], a
	ld a, $e2
	ld [$d07a], a
.asm_465c4
	ld a, [$d079]
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, [$d07a]
	ld [$cc4d], a
	ld a, $15
	call Predef
	jr .asm_465ed ; 0x465da $11
.asm_465dc
	ld a, $a2
	ld [$d71d], a
	ld hl, Seafoam4HolesCoords
	call Func_46981
	ld a, [$d732]
	bit 4, a
	ret nz
.asm_465ed
	ld hl, SeafoamIslands4Scripts
	ld a, [W_SEAFOAMISLANDS4CURSCRIPT]
	jp CallFunctionInTable
; 0x465f6

Seafoam4HolesCoords: ; 465f6 (11:65f6)
	db $10,$03
	db $10,$06
	db $ff

SeafoamIslands4Scripts: ; 465fb (11:65fb)
	dw SeafoamIslands4Script0, SeafoamIslands4Script1, SeafoamIslands4Script2, SeafoamIslands4Script3

SeafoamIslands4Script0: ; 46603 (11:6603)
	ld a, [$d880]
	and $3
	cp $3
	ret z
	ld a, [$d361]
	cp $8
	ret nz
	ld a, [$d362]
	cp $f
	ret nz
	ld hl, $ccd3
	ld de, RLEMovement46632
	call DecodeRLEList
	dec a
	ld [$cd38], a
	call Func_3486
	ld hl, W_FLAGS_D733
	set 2, [hl]
	ld a, $1
	ld [W_SEAFOAMISLANDS4CURSCRIPT], a
	ret
; 0x46632

RLEMovement46632: ; 46632 (11:6632)
	db $80,6
	db $10,5
	db $80,3
	db $ff

SeafoamIslands4Script1: ; 46639 (11:6639)
	ld a, [$cd38]
	and a
	ret nz
	ld a, $0
	ld [W_SEAFOAMISLANDS4CURSCRIPT], a
	ret
; 0x46644

SeafoamIslands4Script2: ; 46644 (11:6644)
INCBIN "baserom.gbc",$46644,$4668f - $46644

SeafoamIslands4Script3: ; 4668f (11:668f)
	ld a, [$cd38]
	and a
	ret nz
	ld a, $0
	ld [W_SEAFOAMISLANDS4CURSCRIPT], a
	ret
; 0x4669a

SeafoamIslands4Texts: ; 4669a (11:669a)
	dw BoulderText, BoulderText, BoulderText, BoulderText, BoulderText, BoulderText

SeafoamIslands4Object: ; 0x466a6 (size=96)
	db $7d ; border tile

	db $7 ; warps
	db $c, $5, $1, SEAFOAM_ISLANDS_3
	db $6, $8, $2, SEAFOAM_ISLANDS_5
	db $4, $19, $3, SEAFOAM_ISLANDS_5
	db $3, $19, $4, SEAFOAM_ISLANDS_3
	db $e, $19, $6, SEAFOAM_ISLANDS_3
	db $11, $14, $0, SEAFOAM_ISLANDS_5
	db $11, $15, $1, SEAFOAM_ISLANDS_5

	db $0 ; signs

	db $6 ; people
	db SPRITE_BOULDER, $e + 4, $5 + 4, $ff, $10, $1 ; person
	db SPRITE_BOULDER, $f + 4, $3 + 4, $ff, $10, $2 ; person
	db SPRITE_BOULDER, $e + 4, $8 + 4, $ff, $10, $3 ; person
	db SPRITE_BOULDER, $e + 4, $9 + 4, $ff, $10, $4 ; person
	db SPRITE_BOULDER, $6 + 4, $12 + 4, $ff, $ff, $5 ; person
	db SPRITE_BOULDER, $6 + 4, $13 + 4, $ff, $ff, $6 ; person

	; warp-to
	EVENT_DISP $f, $c, $5 ; SEAFOAM_ISLANDS_3
	EVENT_DISP $f, $6, $8 ; SEAFOAM_ISLANDS_5
	EVENT_DISP $f, $4, $19 ; SEAFOAM_ISLANDS_5
	EVENT_DISP $f, $3, $19 ; SEAFOAM_ISLANDS_3
	EVENT_DISP $f, $e, $19 ; SEAFOAM_ISLANDS_3
	EVENT_DISP $f, $11, $14 ; SEAFOAM_ISLANDS_5
	EVENT_DISP $f, $11, $15 ; SEAFOAM_ISLANDS_5

SeafoamIslands4Blocks: ; 46706 (11:6706)
	INCBIN "maps/seafoamislands4.blk"

SeafoamIslands5_h: ; 0x4678d to 0x46799 (12 bytes) (bank=11) (id=162)
	db $11 ; tileset
	db SEAFOAM_ISLANDS_5_HEIGHT, SEAFOAM_ISLANDS_5_WIDTH ; dimensions (y, x)
	dw SeafoamIslands5Blocks, SeafoamIslands5Texts, SeafoamIslands5Script ; blocks, texts, scripts
	db $00 ; connections

	dw SeafoamIslands5Object ; objects

SeafoamIslands5Script: ; 46799 (11:6799)
	call EnableAutoTextBoxDrawing
	ld a, [W_SEAFOAMISLANDS5CURSCRIPT]
	ld hl, SeafoamIslands5Scripts
	jp CallFunctionInTable
; 0x467a5

INCBIN "baserom.gbc",$467a5,$467ad - $467a5

SeafoamIslands5Scripts: ; 467ad (11:67ad)
	dw SeafoamIslands5Script0, SeafoamIslands5Script1

INCBIN "baserom.gbc",$467b1,$467c7 - $467b1

SeafoamIslands5Script0: ; 467c7 (11:67c7)
	ld a, [$d880]
	and $3
	cp $3
	ret z
	ld hl, Unknown_467fe ; $67fe
	call ArePlayerCoordsInArray
	ret nc
	ld a, [$cd3d]
	cp $3
	jr nc, .asm_467e6 ; 0x467db $9
	ld a, $40
	ld [$ccd4], a
	ld a, $2
	jr .asm_467e8 ; 0x467e4 $2
.asm_467e6
	ld a, $1
.asm_467e8
	ld [$cd38], a
	ld a, $40
	ld [$ccd3], a
	call Func_3486
	ld hl, W_FLAGS_D733
	res 2, [hl]
	ld a, $1
	ld [W_SEAFOAMISLANDS5CURSCRIPT], a
	ret
; 0x467fe

Unknown_467fe: ; 467fe (11:67fe)
INCBIN "baserom.gbc",$467fe,$46807 - $467fe

SeafoamIslands5Script1: ; 46807 (11:6807)
	ld a, [$cd38]
	and a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $0
	ld [W_SEAFOAMISLANDS5CURSCRIPT], a
	ret
; 0x46816

INCBIN "baserom.gbc",$46816,$4687c - $46816

SeafoamIslands5Texts: ; 4687c (11:687c)
	dw BoulderText, BoulderText, SeafoamIslands5Text3, SeafoamIslands5Text4, SeafoamIslands5Text5

SeafoamIslands5TrainerHeaders: ; 46886 (11:6886)
SeafoamIslands5TrainerHeader0: ; 46886 (11:6886)
	db $2 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d882 ; flag's byte
	dw SeafoamIslands5BattleText2 ; 0x68a2 TextBeforeBattle
	dw SeafoamIslands5BattleText2 ; 0x68a2 TextAfterBattle
	dw SeafoamIslands5BattleText2 ; 0x68a2 TextEndBattle
	dw SeafoamIslands5BattleText2 ; 0x68a2 TextEndBattle
; 0x46892

db $ff

SeafoamIslands5Text3: ; 46893 (11:6893)
	db $08 ; asm
	ld hl, SeafoamIslands5TrainerHeader0
	call TalkToTrainer
	ld a, $4
	ld [W_SEAFOAMISLANDS5CURSCRIPT], a
	jp TextScriptEnd

SeafoamIslands5BattleText2: ; 468a2 (11:68a2)
	TX_FAR _SeafoamIslands5BattleText2 ; 0x88075
	db $8
	ld a, ARTICUNO
	call PlayCry
	call WaitForSoundToFinish
	jp TextScriptEnd
; 0x468b2

SeafoamIslands5Text4: ; 468b2 (11:68b2)
	TX_FAR _SeafoamIslands5Text4
	db $50

SeafoamIslands5Text5: ; 468b7 (11:68b7)
	TX_FAR _SeafoamIslands5Text5
	db $50

SeafoamIslands5Object: ; 0x468bc (size=62)
	db $7d ; border tile

	db $4 ; warps
	db $11, $14, $5, SEAFOAM_ISLANDS_4
	db $11, $15, $6, SEAFOAM_ISLANDS_4
	db $7, $b, $1, SEAFOAM_ISLANDS_4
	db $4, $19, $2, SEAFOAM_ISLANDS_4

	db $2 ; signs
	db $f, $9, $4 ; SeafoamIslands5Text4
	db $1, $17, $5 ; SeafoamIslands5Text5

	db $3 ; people
	db SPRITE_BOULDER, $f + 4, $4 + 4, $ff, $ff, $1 ; person
	db SPRITE_BOULDER, $f + 4, $5 + 4, $ff, $ff, $2 ; person
	db SPRITE_BIRD, $1 + 4, $6 + 4, $ff, $d0, $43, ARTICUNO, 50 ; trainer

	; warp-to
	EVENT_DISP $f, $11, $14 ; SEAFOAM_ISLANDS_4
	EVENT_DISP $f, $11, $15 ; SEAFOAM_ISLANDS_4
	EVENT_DISP $f, $7, $b ; SEAFOAM_ISLANDS_4
	EVENT_DISP $f, $4, $19 ; SEAFOAM_ISLANDS_4

SeafoamIslands5Blocks: ; 468fa (11:68fa)
	INCBIN "maps/seafoamislands5.blk"

; known jump sources: 44843 (11:4843), 44a06 (11:4a06), 4636a (11:636a)
Func_46981: ; 46981 (11:6981)
	xor a
	ld [$d71e], a
	ld a, [$d72d]
	bit 4, a
	ret nz
	call ArePlayerCoordsInArray
	ret nc
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [$d71e], a
	ld hl, $d72d
	set 4, [hl]
	ld hl, $d732
	set 4, [hl]
	ret

; known jump sources: 3ec5 (0:3ec5)
Func_469a0: ; 469a0 (11:69a0)
	ld hl, $ffeb
	xor a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld de, $0
	ld hl, HiddenObjectMaps ; $6a40
.asm_469ae
	ld a, [hli]
	ld b, a
	cp $ff
	jr z, .asm_469fc
	ld a, [W_CURMAP] ; $d35e
	cp b
	jr z, .asm_469be
	inc de
	inc de
	jr .asm_469ae
.asm_469be
	ld hl, HiddenObjectPointers ; $6a96
	add hl, de
	ld a, [hli]
	ld h, [hl]
	ld l, a
	push hl
	ld hl, W_WHICHTRADE ; $cd3d
	xor a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	pop hl
.asm_469ce
	ld a, [hli]
	cp $ff
	jr z, .asm_469fc
	ld [$cd40], a
	ld b, a
	ld a, [hli]
	ld [$cd41], a
	ld c, a
	call Func_46a01
	ld a, [$FF00+$ea]
	and a
	jr z, .asm_469f0
	inc hl
	inc hl
	inc hl
	inc hl
	push hl
	ld hl, $cd3f
	inc [hl]
	pop hl
	jr .asm_469ce
.asm_469f0
	ld a, [hli]
	ld [W_WHICHTRADE], a ; $cd3d
	ld a, [hli]
	ld [$cd3e], a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ret
.asm_469fc
	ld a, $ff
	ld [$FF00+$ee], a
	ret

; known jump sources: 469dc (11:69dc)
Func_46a01: ; 46a01 (11:6a01)
	ld a, [$c109]
	cp $4
	jr z, .asm_46a16
	cp $8
	jr z, .asm_46a25
	cp $c
	jr z, .asm_46a2b
	ld a, [W_YCOORD] ; $d361
	inc a
	jr .asm_46a1a
.asm_46a16
	ld a, [W_YCOORD] ; $d361
	dec a
.asm_46a1a
	cp b
	jr nz, .asm_46a3b
	ld a, [W_XCOORD] ; $d362
	cp c
	jr nz, .asm_46a3b
	jr .asm_46a38
.asm_46a25
	ld a, [W_XCOORD] ; $d362
	dec a
	jr .asm_46a2f
.asm_46a2b
	ld a, [W_XCOORD] ; $d362
	inc a
.asm_46a2f
	cp c
	jr nz, .asm_46a3b
	ld a, [W_YCOORD] ; $d361
	cp b
	jr nz, .asm_46a3b
.asm_46a38
	xor a
	jr .asm_46a3d
.asm_46a3b
	ld a, $ff
.asm_46a3d
	ld [$FF00+$ea], a
	ret
; 46a40 (11:6a40)
HiddenObjectMaps: ; 46a40 (11:6a40)
	db REDS_HOUSE_2F
	db BLUES_HOUSE
	db OAKS_LAB
	db VIRIDIAN_POKECENTER
	db VIRIDIAN_MART
	db VIRIDIAN_SCHOOL
	db VIRIDIAN_GYM
	db MUSEUM_1F
	db PEWTER_GYM
	db PEWTER_MART
	db PEWTER_POKECENTER
	db CERULEAN_POKECENTER
	db CERULEAN_GYM
	db CERULEAN_MART
	db LAVENDER_POKECENTER
	db VERMILION_POKECENTER
	db VERMILION_GYM
	db CELADON_MANSION_2
	db CELADON_POKECENTER
	db CELADON_GYM
	db GAME_CORNER
	db CELADON_HOTEL
	db FUCHSIA_POKECENTER
	db FUCHSIA_GYM
	db CINNABAR_GYM
	db CINNABAR_POKECENTER
	db SAFFRON_GYM
	db MT_MOON_POKECENTER
	db ROCK_TUNNEL_POKECENTER
	db BATTLE_CENTER
	db TRADE_CENTER
	db VIRIDIAN_FOREST
	db MT_MOON_3
	db INDIGO_PLATEAU
	db ROUTE_25
	db ROUTE_9
	db SS_ANNE_6
	db SS_ANNE_10
	db ROCKET_HIDEOUT_1
	db ROCKET_HIDEOUT_3
	db ROCKET_HIDEOUT_4
	db SAFFRON_POKECENTER
	db POKEMONTOWER_5
	db ROUTE_13
	db SAFARIZONEENTRANCE
	db SAFARI_ZONE_WEST
	db SILPH_CO_5F
	db SILPH_CO_9F
	db COPYCATS_HOUSE_2F
	db UNKNOWN_DUNGEON_1
	db UNKNOWN_DUNGEON_3
	db POWER_PLANT
	db SEAFOAM_ISLANDS_3
	db SEAFOAM_ISLANDS_5
	db MANSION_1
	db MANSION_3
	db ROUTE_23
	db VICTORY_ROAD_2
	db $6F
	db BILLS_HOUSE
	db VIRIDIAN_CITY
	db SAFARI_ZONE_REST_HOUSE_2
	db SAFARI_ZONE_REST_HOUSE_3
	db SAFARI_ZONE_REST_HOUSE_4
	db $B9
	db LAVENDER_HOUSE_1
	db CELADON_MANSION_5
	db FIGHTINGDOJO
	db ROUTE_10
	db INDIGO_PLATEAU_LOBBY
	db CINNABAR_LAB_4
	db BIKE_SHOP
	db ROUTE_11
	db ROUTE_12
	db MANSION_2
	db MANSION_4
	db SILPH_CO_11F
	db ROUTE_17
	db UNDERGROUND_PATH_NS
	db UNDERGROUND_PATH_WE
	db CELADON_CITY
	db SEAFOAM_ISLANDS_4
	db VERMILION_CITY
	db CERULEAN_CITY
	db ROUTE_4
	db $FF

HiddenObjectPointers: ; 46a96 (11:6a96)
; each of these pointers is for the corresponding map in HiddenObjectMaps
	dw RedsHouse2FHiddenObjects
	dw BluesHouseHiddenObjects
	dw OaksLabHiddenObjects
	dw ViridianPokecenterHiddenObjects
	dw ViridianMartHiddenObjects
	dw ViridianSchoolHiddenObjects
	dw ViridianGymHiddenObjects
	dw Museum1FHiddenObjects
	dw PewterGymHiddenObjects
	dw PewterMartHiddenObjects
	dw PewterPokecenterHiddenObjects
	dw CeruleanPokecenterHiddenObjects
	dw CeruleanGymHiddenObjects
	dw CeruleanMartHiddenObjects
	dw LavenderPokecenterHiddenObjects
	dw VermilionPokecenterHiddenObjects
	dw VermilionGymHiddenObjects
	dw CeladonMansion2HiddenObjects
	dw CeladonPokecenterHiddenObjects
	dw CeladonGymHiddenObjects
	dw GameCornerHiddenObjects
	dw CeladonHotelHiddenObjects
	dw FuchsiaPokecenterHiddenObjects
	dw FuchsiaGymHiddenObjects
	dw CinnabarGymHiddenObjects
	dw CinnabarPokecenterHiddenObjects
	dw SaffronGymHiddenObjects
	dw MtMoonPokecenterHiddenObjects
	dw RockTunnelPokecenterHiddenObjects
	dw BattleCenterHiddenObjects
	dw TradeCenterHiddenObjects
	dw ViridianForestHiddenObjects
	dw MtMoon3HiddenObjects
	dw IndigoPlateauHiddenObjects
	dw Route25HiddenObjects
	dw Route9HiddenObjects
	dw SSAnne6HiddenObjects
	dw SSAnne10HiddenObjects
	dw RocketHideout1HiddenObjects
	dw RocketHideout3HiddenObjects
	dw RocketHideout4HiddenObjects
	dw SaffronPokecenterHiddenObjects
	dw PokemonTower5HiddenObjects
	dw Route13HiddenObjects
	dw SafariZoneEntranceHiddenObjects
	dw SafariZoneWestHiddenObjects
	dw SilphCo5FHiddenObjects
	dw SilphCo9FHiddenObjects
	dw CopycatsHouse2FHiddenObjects
	dw UnknownDungeon1HiddenObjects
	dw UnknownDungeon3HiddenObjects
	dw PowerPlantHiddenObjects
	dw SeafoamIslands3HiddenObjects
	dw SeafoamIslands5HiddenObjects
	dw Mansion1HiddenObjects
	dw Mansion3HiddenObjects
	dw Route23HiddenObjects
	dw VictoryRoad2HiddenObjects
	dw Unused6FHiddenObjects
	dw BillsHouseHiddenObjects
	dw ViridianCityHiddenObjects
	dw SafariZoneRestHouse2HiddenObjects
	dw SafariZoneRestHouse3HiddenObjects
	dw SafariZoneRestHouse4HiddenObjects
	dw UnusedB9HiddenObjects
	dw LavenderHouse1HiddenObjects
	dw CeladonMansion5HiddenObjects
	dw FightingDojoHiddenObjects
	dw Route10HiddenObjects
	dw IndigoPlateauLobbyHiddenObjects
	dw CinnabarLab4HiddenObjects
	dw BikeShopHiddenObjects
	dw Route11HiddenObjects
	dw Route12HiddenObjects
	dw Mansion2HiddenObjects
	dw Mansion4HiddenObjects
	dw SilphCo11FHiddenObjects
	dw Route17HiddenObjects
	dw UndergroundPathNsHiddenObjects
	dw UndergroundPathWeHiddenObjects
	dw CeladonCityHiddenObjects
	dw SeafoamIslands4HiddenObjects
	dw VermilionCityHiddenObjects
	dw CeruleanCityHiddenObjects
	dw Route4HiddenObjects

BattleCenterHiddenObjects: ; 46b40 (11:6b40)
	db $04,$05,$d0 ; XXX, y, x
	dbw $08,$5845
	db $04,$04,$d0 ; XXX, y, x
	dbw $08,$5825
	db $FF
TradeCenterHiddenObjects: ; 46b4d (11:6b4d)
	db $04,$05,$d0 ; XXX, y, x
	dbw $08,$5845
	db $04,$04,$d0 ; XXX, y, x
	dbw $08,$5825
	db $FF
RedsHouse2FHiddenObjects: ; 46b5a (11:6b5a)
	db $01,$00,$04 ; XXX, y, x
	dbw $17,$5b86
	db $05,$03,$d0 ; XXX, y, x
	dbw $17,$5b79
	db $FF
BluesHouseHiddenObjects: ; 46b67 (11:6b67)
	db $01,$00,$04 ; XXX, y, x
	dbw $18,$6509
	db $01,$01,$04 ; XXX, y, x
	dbw $18,$6509
	db $01,$07,$04 ; XXX, y, x
	dbw $18,$6509
	db $FF
OaksLabHiddenObjects: ; 46b7a (11:6b7a)
	db $00,$04,$04 ; XXX, y, x
	dbw $07,$6958
	db $00,$05,$04 ; XXX, y, x
	dbw $07,$6965
	db $01,$00,$04 ; XXX, y, x
	dbw $07,$6caf
	db $01,$01,$04 ; XXX, y, x
	dbw $07,$6caf
	db $FF
ViridianPokecenterHiddenObjects: ; 46b93 (11:6b93)
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
ViridianMartHiddenObjects: ; 46ba0 (11:6ba0)
	db $FF
ViridianSchoolHiddenObjects: ; 46ba1 (11:6ba1)
	db $04,$03,$20 ; XXX, y, x
	dbw $14,$6996
	db $00,$03,$21 ; XXX, y, x
	dbw $17,$5c1a
	db $FF
ViridianGymHiddenObjects: ; 46bae (11:6bae)
	db $0f,$0f,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $0f,$12,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $FF
Museum1FHiddenObjects: ; 46bbb (11:6bbb)
	db $03,$02,$04 ; XXX, y, x
	dbw $17,$5bad
	db $06,$02,$04 ; XXX, y, x
	dbw $17,$5bc3
	db $FF
PewterGymHiddenObjects: ; 46bc8 (11:6bc8)
	db $0a,$03,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $0a,$06,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $FF
PewterMartHiddenObjects: ; 46bd5 (11:6bd5)
	db $FF
PewterPokecenterHiddenObjects: ; 46bd6 (11:6bd6)
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
CeruleanPokecenterHiddenObjects: ; 46be3 (11:6be3)
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
CeruleanGymHiddenObjects: ; 46bf0 (11:6bf0)
	db $0b,$03,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $0b,$06,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $FF
CeruleanMartHiddenObjects: ; 46bfd (11:6bfd)
	db $FF
LavenderPokecenterHiddenObjects: ; 46bfe (11:6bfe)
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
VermilionPokecenterHiddenObjects: ; 46c0b (11:6c0b)
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $04,$00,$04 ; XXX, y, x
	dbw $18,$645d
	db $FF
VermilionGymHiddenObjects: ; 46c18 (11:6c18)
	db $0e,$03,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $0e,$06,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $01,$06,$00 ; XXX, y, x
	dbw $17,$5def
	db $07,$01,$00 ; XXX, y, x
	dbw $17,$5dfc
	db $09,$01,$01 ; XXX, y, x
	dbw $17,$5dfc
	db $0b,$01,$02 ; XXX, y, x
	dbw $17,$5dfc
	db $07,$03,$03 ; XXX, y, x
	dbw $17,$5dfc
	db $09,$03,$04 ; XXX, y, x
	dbw $17,$5dfc
	db $0b,$03,$05 ; XXX, y, x
	dbw $17,$5dfc
	db $07,$05,$06 ; XXX, y, x
	dbw $17,$5dfc
	db $09,$05,$07 ; XXX, y, x
	dbw $17,$5dfc
	db $0b,$05,$08 ; XXX, y, x
	dbw $17,$5dfc
	db $07,$07,$09 ; XXX, y, x
	dbw $17,$5dfc
	db $09,$07,$0a ; XXX, y, x
	dbw $17,$5dfc
	db $0b,$07,$0b ; XXX, y, x
	dbw $17,$5dfc
	db $07,$09,$0c ; XXX, y, x
	dbw $17,$5dfc
	db $09,$09,$0d ; XXX, y, x
	dbw $17,$5dfc
	db $0b,$09,$0e ; XXX, y, x
	dbw $17,$5dfc
	db $FF
CeladonMansion2HiddenObjects: ; 46c85 (11:6c85)
	db $05,$00,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
CeladonPokecenterHiddenObjects: ; 46c8c (11:6c8c)
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
CeladonGymHiddenObjects: ; 46c99 (11:6c99)
	db $0f,$03,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $0f,$06,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $FF
GameCornerHiddenObjects: ; 46ca6 (11:6ca6)
	db $0f,$12,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0e,$12,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0d,$12,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0c,$12,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0b,$12,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0a,$12,$ff ; XXX, y, x
	dbw $0d,$7e2d
	db $0a,$0d,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0b,$0d,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0c,$0d,$fe ; XXX, y, x
	dbw $0d,$7e2d
	db $0d,$0d,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0e,$0d,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0f,$0d,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0f,$0c,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0e,$0c,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0d,$0c,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0c,$0c,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0b,$0c,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0a,$0c,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0a,$07,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0b,$07,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0c,$07,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0d,$07,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0e,$07,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0f,$07,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0f,$06,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0e,$06,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0d,$06,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0c,$06,$fd ; XXX, y, x
	dbw $0d,$7e2d
	db $0b,$06,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0a,$06,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0a,$01,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0b,$01,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0c,$01,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0d,$01,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0e,$01,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $0f,$01,$d0 ; XXX, y, x
	dbw $0d,$7e2d
	db $08,$00,COIN+10
	dbw BANK(HiddenCoins),HiddenCoins
	db $10,$01,COIN+10
	dbw BANK(HiddenCoins),HiddenCoins
	db $0b,$03,COIN+20
	dbw BANK(HiddenCoins),HiddenCoins
	db $0e,$03,COIN+10
	dbw BANK(HiddenCoins),HiddenCoins
	db $0c,$04,COIN+10
	dbw BANK(HiddenCoins),HiddenCoins
	db $0c,$09,COIN+20
	dbw BANK(HiddenCoins),HiddenCoins
	db $0f,$09,COIN+10
	dbw BANK(HiddenCoins),HiddenCoins
	db $0e,$10,COIN+10
	dbw BANK(HiddenCoins),HiddenCoins
	db $10,$0a,COIN+10
	dbw BANK(HiddenCoins),HiddenCoins
	db $07,$0b,COIN+40
	dbw BANK(HiddenCoins),HiddenCoins
	db $08,$0f,COIN+100
	dbw BANK(HiddenCoins),HiddenCoins
	db $0f,$0c,COIN+10
	dbw BANK(HiddenCoins),HiddenCoins
	db $FF
CeladonHotelHiddenObjects: ; 46dc7 (11:6dc7)
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $FF
FuchsiaPokecenterHiddenObjects: ; 46dd4 (11:6dd4)
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $04,$00,$04 ; XXX, y, x
	dbw $18,$645d
	db $FF
FuchsiaGymHiddenObjects: ; 46de1 (11:6de1)
	db $0f,$03,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $0f,$06,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $FF
CinnabarGymHiddenObjects: ; 46dee (11:6dee)
	db $0d,$11,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $07,$0f,$01 ; XXX, y, x
	dbw $07,$6a17
	db $01,$0a,$12 ; XXX, y, x
	dbw $07,$6a17
	db $07,$09,$13 ; XXX, y, x
	dbw $07,$6a17
	db $0d,$09,$14 ; XXX, y, x
	dbw $07,$6a17
	db $0d,$01,$05 ; XXX, y, x
	dbw $07,$6a17
	db $07,$01,$16 ; XXX, y, x
	dbw $07,$6a17
	db $FF
CinnabarPokecenterHiddenObjects: ; 46e19 (11:6e19)
	db $04,$00,$04 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
SaffronGymHiddenObjects: ; 46e26 (11:6e26)
	db $0f,$09,$04 ; XXX, y, x
	dbw BANK(GymStatues),GymStatues
	db $FF
MtMoonPokecenterHiddenObjects: ; 46e2d (11:6e2d)
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
RockTunnelPokecenterHiddenObjects: ; 46e3a (11:6e3a)
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
ViridianForestHiddenObjects: ; 46e47 (11:6e47)
	db $12,$01,POTION
	dbw BANK(HiddenItems),HiddenItems
	db $2a,$10,ANTIDOTE
	dbw BANK(HiddenItems),HiddenItems
	db $FF
MtMoon3HiddenObjects: ; 46e54 (11:6e54)
	db $0c,$12,MOON_STONE
	dbw BANK(HiddenItems),HiddenItems
	db $09,$21,ETHER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
IndigoPlateauHiddenObjects: ; 46e61 (11:6e61)
	db $0d,$08,$ff ; XXX, y, x
	dbw $14,$6a2f
	db $0d,$0b,$00 ; XXX, y, x
	dbw $14,$6a2f
	db $FF
Route25HiddenObjects: ; 46e6e (11:6e6e)
	db $03,$26,ETHER
	dbw BANK(HiddenItems),HiddenItems
	db $01,$0a,ELIXER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
Route9HiddenObjects: ; 46e7b (11:6e7b)
	db $07,$0e,ETHER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SSAnne6HiddenObjects: ; 46e82 (11:6e82)
	db $05,$0d,$00 ; XXX, y, x
	dbw $17,$5def
	db $07,$0d,$00 ; XXX, y, x
	dbw $17,$5def
	db $09,$0d,GREAT_BALL
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SSAnne10HiddenObjects: ; 46e95 (11:6e95)
	db $01,$03,HYPER_POTION
	dbw BANK(HiddenItems),HiddenItems
	db $FF
Route10HiddenObjects: ; 46e9c (11:6e9c)
	db $11,$09,SUPER_POTION
	dbw BANK(HiddenItems),HiddenItems
	db $35,$10,MAX_ETHER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
RocketHideout1HiddenObjects: ; 46ea9 (11:6ea9)
	db $0f,$15,PP_UP
	dbw BANK(HiddenItems),HiddenItems
	db $FF
RocketHideout3HiddenObjects: ; 46eb0 (11:6eb0)
	db $11,$1b,NUGGET
	dbw BANK(HiddenItems),HiddenItems
	db $FF
RocketHideout4HiddenObjects: ; 46eb7 (11:6eb7)
	db $01,$19,SUPER_POTION
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SaffronPokecenterHiddenObjects: ; 46ebe (11:6ebe)
	db $04,$00,$04 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
PokemonTower5HiddenObjects: ; 46ecb (11:6ecb)
	db $0c,$04,ELIXER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
Route13HiddenObjects: ; 46ed2 (11:6ed2)
	db $0e,$01,PP_UP
	dbw BANK(HiddenItems),HiddenItems
	db $0d,$10,CALCIUM
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SafariZoneEntranceHiddenObjects: ; 46edf (11:6edf)
	db $01,$0a,NUGGET
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SafariZoneWestHiddenObjects: ; 46ee6 (11:6ee6)
	db $05,$06,REVIVE
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SilphCo5FHiddenObjects: ; 46eed (11:6eed)
	db $03,$0c,ELIXER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SilphCo9FHiddenObjects: ; 46ef4 (11:6ef4)
	db $0f,$02,MAX_POTION
	dbw BANK(HiddenItems),HiddenItems
	db $FF
CopycatsHouse2FHiddenObjects: ; 46efb (11:6efb)
	db $01,$01,NUGGET
	dbw BANK(HiddenItems),HiddenItems
	db $FF
UnknownDungeon1HiddenObjects: ; 46f02 (11:6f02)
	db $0b,$0e,RARE_CANDY
	dbw BANK(HiddenItems),HiddenItems
	db $FF
UnknownDungeon3HiddenObjects: ; 46f09 (11:6f09)
	db $03,$1b,ULTRA_BALL
	dbw BANK(HiddenItems),HiddenItems
	db $FF
PowerPlantHiddenObjects: ; 46f10 (11:6f10)
	db $10,$11,MAX_ELIXER
	dbw BANK(HiddenItems),HiddenItems
	db $01,$0c,PP_UP
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SeafoamIslands3HiddenObjects: ; 46f1d (11:6f1d)
	db $0f,$0f,NUGGET
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SeafoamIslands5HiddenObjects: ; 46f24 (11:6f24)
	db $11,$19,ULTRA_BALL
	dbw BANK(HiddenItems),HiddenItems
	db $FF
Mansion1HiddenObjects: ; 46f2b (11:6f2b)
	db $10,$08,MOON_STONE
	dbw BANK(HiddenItems),HiddenItems
	db $05,$02,$04 ; XXX, y, x
	dbw $11,$4316
	db $FF
Mansion2HiddenObjects: ; 46f38 (11:6f38)
	db $0b,$02,$04 ; XXX, y, x
	dbw $14,$6037
	db $FF
Mansion3HiddenObjects: ; 46f3f (11:6f3f)
	db $09,$01,MAX_REVIVE
	dbw BANK(HiddenItems),HiddenItems
	db $05,$0a,$04 ; XXX, y, x
	dbw $14,$627a
	db $FF
Mansion4HiddenObjects: ; 46f4c (11:6f4c)
	db $09,$01,RARE_CANDY
	dbw BANK(HiddenItems),HiddenItems
	db $03,$14,$04 ; XXX, y, x
	dbw $14,$6420
	db $19,$12,$04 ; XXX, y, x
	dbw $14,$6420
	db $FF
Route23HiddenObjects: ; 46f5f (11:6f5f)
	db $2c,$09,FULL_RESTORE
	dbw BANK(HiddenItems),HiddenItems
	db $46,$13,ULTRA_BALL
	dbw BANK(HiddenItems),HiddenItems
	db $5a,$08,MAX_ETHER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
VictoryRoad2HiddenObjects: ; 46f72 (11:6f72)
	db $02,$05,ULTRA_BALL
	dbw BANK(HiddenItems),HiddenItems
	db $07,$1a,FULL_RESTORE
	dbw BANK(HiddenItems),HiddenItems
	db $FF
Unused6FHiddenObjects: ; 46f7f (11:6f7f)
	db $0b,$0e,MAX_ELIXER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
BillsHouseHiddenObjects: ; 46f86 (11:6f86)
	db $04,$01,$04 ; XXX, y, x
	dbw $07,$6b6e
	db $FF
ViridianCityHiddenObjects: ; 46f8d (11:6f8d)
	db $04,$0e,POTION
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SafariZoneRestHouse2HiddenObjects: ; 46f94 (11:6f94)
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
SafariZoneRestHouse3HiddenObjects: ; 46fa1 (11:6fa1)
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
SafariZoneRestHouse4HiddenObjects: ; 46fae (11:6fae)
	db $04,$00,$08 ; XXX, y, x
	dbw $18,$645d
	db $03,$0d,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
UnusedB9HiddenObjects: ; 46fbb (11:6fbb)
	db $02,$01,$04 ; XXX, y, x
	dbw $17,$5b8f
	db $FF
LavenderHouse1HiddenObjects: ; 46fc2 (11:6fc2)
	db $01,$00,$00 ; XXX, y, x
	dbw $07,$6b60
	db $01,$01,$00 ; XXX, y, x
	dbw $07,$6b60
	db $01,$07,$00 ; XXX, y, x
	dbw $07,$6b60
	db $FF
CeladonMansion5HiddenObjects: ; 46fd5 (11:6fd5)
	db $00,$03,$34 ; XXX, y, x
	dbw $17,$5c1a
	db $00,$04,$34 ; XXX, y, x
	dbw $17,$5c1a
	db $04,$03,$35 ; XXX, y, x
	dbw $14,$6996
	db $FF
FightingDojoHiddenObjects: ; 46fe8 (11:6fe8)
	db $09,$03,$04 ; XXX, y, x
	dbw $14,$6a22
	db $09,$06,$04 ; XXX, y, x
	dbw $14,$6a22
	db $00,$04,$04 ; XXX, y, x
	dbw $14,$6a08
	db $00,$05,$04 ; XXX, y, x
	dbw $14,$6a15
	db $FF
IndigoPlateauLobbyHiddenObjects: ; 47001 (11:7001)
	db $07,$0f,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
CinnabarLab4HiddenObjects: ; 47008 (11:7008)
	db $04,$00,$04 ; XXX, y, x
	dbw $18,$6516
	db $04,$02,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
BikeShopHiddenObjects: ; 47015 (11:7015)
	db $00,$01,$d0 ; XXX, y, x
	dbw $07,$694b
	db $01,$02,$d0 ; XXX, y, x
	dbw $07,$694b
	db $02,$01,$d0 ; XXX, y, x
	dbw $07,$694b
	db $02,$03,$d0 ; XXX, y, x
	dbw $07,$694b
	db $04,$00,$d0 ; XXX, y, x
	dbw $07,$694b
	db $05,$01,$d0 ; XXX, y, x
	dbw $07,$694b
	db $FF
Route11HiddenObjects: ; 4703a (11:703a)
	db $05,$30,ESCAPE_ROPE
	dbw BANK(HiddenItems),HiddenItems
	db $FF
Route12HiddenObjects: ; 47041 (11:7041)
	db $3f,$02,HYPER_POTION
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SilphCo11FHiddenObjects: ; 47048 (11:7048)
	db $0c,$0a,$04 ; XXX, y, x
	dbw $18,$6516
	db $FF
Route17HiddenObjects: ; 4704f (11:704f)
	db $0e,$0f,RARE_CANDY
	dbw BANK(HiddenItems),HiddenItems
	db $2d,$08,FULL_RESTORE
	dbw BANK(HiddenItems),HiddenItems
	db $48,$11,PP_UP
	dbw BANK(HiddenItems),HiddenItems
	db $5b,$04,MAX_REVIVE
	dbw BANK(HiddenItems),HiddenItems
	db $79,$08,MAX_ELIXER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
UndergroundPathNsHiddenObjects: ; 4706e (11:706e)
	db $04,$03,FULL_RESTORE
	dbw BANK(HiddenItems),HiddenItems
	db $22,$04,X_SPECIAL
	dbw BANK(HiddenItems),HiddenItems
	db $FF
UndergroundPathWeHiddenObjects: ; 4707b (11:707b)
	db $02,$0c,NUGGET
	dbw BANK(HiddenItems),HiddenItems
	db $05,$15,ELIXER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
CeladonCityHiddenObjects: ; 47088 (11:7088)
	db $0f,$30,PP_UP
	dbw BANK(HiddenItems),HiddenItems
	db $FF
SeafoamIslands4HiddenObjects: ; 4708f (11:708f)
	db $10,$09,MAX_ELIXER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
VermilionCityHiddenObjects: ; 47096 (11:7096)
	db $0b,$0e,MAX_ETHER
	dbw BANK(HiddenItems),HiddenItems
	db $FF
CeruleanCityHiddenObjects: ; 4709d (11:709d)
	db $08,$0f,RARE_CANDY
	dbw BANK(HiddenItems),HiddenItems
	db $FF
Route4HiddenObjects: ; 470a4 (11:70a4)
	db $03,$28,GREAT_BALL
	dbw BANK(HiddenItems),HiddenItems
	db $FF

INCBIN "baserom.gbc",$470ab,$48000 - $470ab

SECTION "bank12",ROMX,BANK[$12]

Route7_h: ; 0x48000 to 0x48022 (34 bytes) (bank=12) (id=18)
	db $00 ; tileset
	db ROUTE_7_HEIGHT, ROUTE_7_WIDTH ; dimensions (y, x)
	dw Route7Blocks, $4155, Route7Script ; blocks, texts, scripts
	db WEST | EAST ; connections

	; connections data

	db CELADON_CITY
	dw CeladonCityBlocks - 3 + (CELADON_CITY_WIDTH * 2) ; connection strip location
	dw $C6E8 + (ROUTE_7_WIDTH + 6) * (-3 + 3) ; current map position
	db $f, CELADON_CITY_WIDTH ; bigness, width
	db (-4 * -2), (CELADON_CITY_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * CELADON_CITY_WIDTH ; window

	db SAFFRON_CITY
	dw SaffronCityBlocks + (SAFFRON_CITY_WIDTH) ; connection strip location
	dw $C6E5 + (ROUTE_7_WIDTH + 6) * (-3 + 4) ; current map position
	db $f, SAFFRON_CITY_WIDTH ; bigness, width
	db (-4 * -2), 0 ; alignments (y, x)
	dw $C6EF + SAFFRON_CITY_WIDTH ; window

	; end connections data

	dw Route7Object ; objects

Route7Object: ; 0x48022 (size=47)
	db $f ; border tile

	db $5 ; warps
	db $9, $12, $2, ROUTE_7_GATE
	db $a, $12, $3, ROUTE_7_GATE
	db $9, $b, $0, ROUTE_7_GATE
	db $a, $b, $1, ROUTE_7_GATE
	db $d, $5, $0, PATH_ENTRANCE_ROUTE_7

	db $1 ; signs
	db $d, $3, $1 ; Route7Text1

	db $0 ; people

	; warp-to
	EVENT_DISP $a, $9, $12 ; ROUTE_7_GATE
	EVENT_DISP $a, $a, $12 ; ROUTE_7_GATE
	EVENT_DISP $a, $9, $b ; ROUTE_7_GATE
	EVENT_DISP $a, $a, $b ; ROUTE_7_GATE
	EVENT_DISP $a, $d, $5 ; PATH_ENTRANCE_ROUTE_7

Route7Blocks: ; 48051 (12:4051)
	INCBIN "maps/route7.blk"

CeladonPokecenterBlocks: ; 480ab (12:40ab)
RockTunnelPokecenterBlocks: ; 480ab (12:40ab)
MtMoonPokecenterBlocks: ; 480ab (12:40ab)
	INCBIN "maps/mtmoonpokecenter.blk"

Route18GateBlocks: ; 480c7 (12:40c7)
Route15GateBlocks: ; 480c7 (12:40c7)
Route11GateBlocks: ; 480c7 (12:40c7)
	INCBIN "maps/route11gate.blk"

Route18GateHeaderBlocks: ; 480db (12:40db)
Route16GateUpstairsBlocks: ; 480db (12:40db)
Route12GateUpstairsBlocks: ; 480db (12:40db)
Route15GateUpstairsBlocks: ; 480db (12:40db)
Route11GateUpstairsBlocks: ; 480db (12:40db)
	INCBIN "maps/route11gateupstairs.blk"

; known jump sources: c72b (3:472b)
Func_480eb: ; 480eb (12:40eb)
	call Load16BitRegisters
	ld a, [rBGP] ; $FF00+$47
	or b
	ld [rBGP], a ; $FF00+$47
	ld c, $4
	call DelayFrames
	ld a, [rBGP] ; $FF00+$47
	and $fc
	ld [rBGP], a ; $FF00+$47
	ret

; known jump sources: 7920b (1e:520b)
Func_480ff: ; 480ff (12:40ff)
	call Load16BitRegisters
	ld a, $1
	ld [$d0a0], a
	xor a
.asm_48108
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	call Func_48119
	call Func_48119
	dec b
	ld a, b
	jr nz, .asm_48108
	xor a
	ld [$d0a0], a
	ret

; known jump sources: 4810a (12:410a), 4810d (12:410d)
Func_48119: ; 48119 (12:4119)
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	xor b
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld [rWY], a ; $FF00+$4a
	ld c, $3
	jp DelayFrames

; known jump sources: 3dc34 (f:5c34), 79212 (1e:5212)
Func_48125: ; 48125 (12:4125)
	call Load16BitRegisters
	xor a
.asm_48129
	ld [$FF00+$97], a
	call Func_4813f
	ld c, $1
	call DelayFrames
	call Func_4813f
	dec b
	ld a, b
	jr nz, .asm_48129
	ld a, $7
	ld [rWX], a ; $FF00+$4b
	ret

; known jump sources: 4812b (12:412b), 48133 (12:4133)
Func_4813f: ; 4813f (12:413f)
	ld a, [$FF00+$97]
	xor b
	ld [$FF00+$97], a
	bit 7, a
	jr z, .asm_48149
	xor a
.asm_48149
	add $7
	ld [rWX], a ; $FF00+$4b
	ld c, $4
	jp DelayFrames
; 48152 (12:4152)
Route7Script: ; 48152 (12:4152)
	jp EnableAutoTextBoxDrawing
; 0x48155

; XXX
db $57, $41

Route7Text1: ; 48157 (12:4157)
	TX_FAR _Route7Text1
	db $50

RedsHouse1F_h: ; 4815c (12:415c)
	db $01 ; tileset
	db $04,$04 ; dimensions
	dw RedsHouse1FBlocks, RedsHouse1FTexts, RedsHouse1FScript
	db 0 ; no connections
	dw RedsHouse1FObject

RedsHouse1FScript: ; 48168 (12:4168)
	jp EnableAutoTextBoxDrawing

RedsHouse1FTexts: ; 4816b (12:416b)
	dw RedsHouse1FText1,RedsHouse1FText2

RedsHouse1FText1: ; 4816f (12:416f) ; 416F Mom
	db 8
	ld a, [$D72E]
	bit 3, a
	jr nz, .heal ; if player has received a Pokémon from Oak, heal team
	ld hl, MomWakeUpText
	call PrintText
	jr .done
.heal
	call MomHealPokemon
.done
	jp TextScriptEnd

MomWakeUpText: ; 48185 (12:4185)
	TX_FAR _MomWakeUpText
	db "@"

MomHealPokemon: ; 4818a (12:418a)
	ld hl, MomHealText1
	call PrintText
	call GBFadeOut2
	call ReloadMapData
	PREDEF HealPartyPredef
	ld a, $E8
	ld [$C0EE], a
	call PlaySound ; play sound?
.next
	ld a, [$C026]
	cp $E8
	jr z, .next
	ld a, [$D35B]
	ld [$C0EE], a
	call PlaySound
	call GBFadeIn2
	ld hl, MomHealText2
	jp PrintText

MomHealText1: ; 481bc (12:41bc)
	TX_FAR _MomHealText1
	db "@"
MomHealText2: ; 481c1 (12:41c1)
	TX_FAR _MomHealText2
	db "@"

RedsHouse1FText2: ; 0x481c6 TV
	db 8
	ld a,[$C109]
	cp 4
	ld hl,TVWrongSideText
	jr nz,.done ; if player is not facing up
	ld hl,StandByMeText
.done
	call PrintText
	jp TextScriptEnd

StandByMeText: ; 481da (12:41da)
	TX_FAR _StandByMeText
	db "@"

TVWrongSideText: ; 481df (12:41df)
	TX_FAR _TVWrongSideText
	db "@"

RedsHouse1FObject: ; 481e4 (12:41e4)
	db $0A ; border tile

	db 3 ; warps
	db 7,2,0,$FF ; exit1
	db 7,3,0,$FF ; exit2
	db 1,7,0,$26 ; staircase

	db 1 ; signs
	db 1,3,2 ; TV

	db 1 ; people
	db $33,4+4,5+4,$FF,$D2,1 ; Mom

	; warp-to

	dw $C6EF + 4 + (4 + 6) * (3) + 1
	db 7,2

	dw $C6EF + 4 + (4 + 6) * (3) + 1
	db 7,3

	dw $C6EF + 4 + (4 + 6) * (0) + 3
	db 1,7

RedsHouse1FBlocks: ; 48209 (12:4209)
	INCBIN "maps/redshouse1f.blk"

CeladonMart3_h: ; 0x48219 to 0x48225 (12 bytes) (bank=12) (id=124)
	db $12 ; tileset
	db CELADON_MART_3_HEIGHT, CELADON_MART_3_WIDTH ; dimensions (y, x)
	dw CeladonMart3Blocks, CeladonMart3Texts, CeladonMart3Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMart3Object ; objects

CeladonMart3Script: ; 48225 (12:4225)
	jp EnableAutoTextBoxDrawing
; 0x48228

CeladonMart3Texts: ; 48228 (12:4228)
	dw CeladonMart3Text1, CeladonMart3Text2, CeladonMart3Text3, CeladonMart3Text4, CeladonMart3Text5, CeladonMart3Text6, CeladonMart3Text7, CeladonMart3Text8, CeladonMart3Text9, CeladonMart3Text10, CeladonMart3Text11, CeladonMart3Text12, CeladonMart3Text13, CeladonMart3Text14, CeladonMart3Text15, CeladonMart3Text16, CeladonMart3Text17

CeladonMart3Text1: ; 4824a (12:424a)
	db $08 ; asm
	ld a, [$d778]
	bit 7, a
	jr nz, .asm_a5463 ; 0x48250
	ld hl, TM18PreReceiveText
	call PrintText
	ld bc, (TM_18 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, $d778
	set 7, [hl]
	ld hl, ReceivedTM18Text
	jr .asm_81359 ; 0x48268
.BagFull
	ld hl, TM18NoRoomText
	jr .asm_81359 ; 0x4826d
.asm_a5463 ; 0x4826f
	ld hl, TM18ExplanationText
.asm_81359 ; 0x48272
	call PrintText
	jp TextScriptEnd

TM18PreReceiveText: ; 48278 (12:4278)
	TX_FAR _TM18PreReceiveText
	db $50
; 0x48278 + 5 bytes

ReceivedTM18Text: ; 4827d (12:427d)
	TX_FAR _ReceivedTM18Text ; 0x9c85a
	db $0B, $50
; 0x48283

TM18ExplanationText: ; 48283 (12:4283)
	TX_FAR _TM18ExplanationText
	db $50
; 0x48283 + 5 bytes

TM18NoRoomText: ; 48288 (12:4288)
	TX_FAR _TM18NoRoomText
	db $50
; 0x48288 + 5 bytes

CeladonMart3Text2: ; 4828d (12:428d)
	TX_FAR _CeladonMart3Text2
	db $50

CeladonMart3Text3: ; 48292 (12:4292)
	TX_FAR _CeladonMart3Text3
	db $50

CeladonMart3Text4: ; 48297 (12:4297)
	TX_FAR _CeladonMart3Text4
	db $50

CeladonMart3Text5: ; 4829c (12:429c)
	TX_FAR _CeladonMart3Text5
	db $50

CeladonMart3Text12
CeladonMart3Text10: ; 482a1 (12:42a1)
CeladonMart3Text8: ; 482a1 (12:42a1)
CeladonMart3Text6: ; 482a1 (12:42a1)
	TX_FAR _CeladonMart3Text6
	db $50

CeladonMart3Text7: ; 482a6 (12:42a6)
	TX_FAR _CeladonMart3Text7
	db $50

CeladonMart3Text9: ; 482ab (12:42ab)
	TX_FAR _CeladonMart3Text9
	db $50

CeladonMart3Text11: ; 482b0 (12:42b0)
	TX_FAR _CeladonMart3Text11
	db $50

CeladonMart3Text13: ; 482b5 (12:42b5)
	TX_FAR _CeladonMart3Text13
	db $50

CeladonMart3Text14: ; 482ba (12:42ba)
	TX_FAR _CeladonMart3Text14
	db $50

CeladonMart3Text17: ; 482bf (12:42bf)
CeladonMart3Text16: ; 482bf (12:42bf)
CeladonMart3Text15: ; 482bf (12:42bf)
	TX_FAR _CeladonMart3Text15
	db $50

CeladonMart3Object: ; 0x482c4 (size=94)
	db $f ; border tile

	db $3 ; warps
	db $1, $c, $0, CELADON_MART_4
	db $1, $10, $1, CELADON_MART_2
	db $1, $1, $0, CELADON_MART_ELEVATOR

	db $c ; signs
	db $4, $2, $6 ; CeladonMart3Text6
	db $4, $3, $7 ; CeladonMart3Text7
	db $4, $5, $8 ; CeladonMart3Text8
	db $4, $6, $9 ; CeladonMart3Text9
	db $6, $2, $a ; CeladonMart3Text10
	db $6, $3, $b ; CeladonMart3Text11
	db $6, $5, $c ; CeladonMart3Text12
	db $6, $6, $d ; CeladonMart3Text13
	db $1, $e, $e ; CeladonMart3Text14
	db $1, $4, $f ; CeladonMart3Text15
	db $1, $6, $10 ; CeladonMart3Text16
	db $1, $a, $11 ; CeladonMart3Text17

	db $5 ; people
	db SPRITE_MART_GUY, $5 + 4, $10 + 4, $ff, $ff, $1 ; person
	db SPRITE_GAMEBOY_KID_COPY, $6 + 4, $b + 4, $ff, $d3, $2 ; person
	db SPRITE_GAMEBOY_KID_COPY, $2 + 4, $7 + 4, $ff, $d0, $3 ; person
	db SPRITE_GAMEBOY_KID_COPY, $2 + 4, $8 + 4, $ff, $d0, $4 ; person
	db SPRITE_YOUNG_BOY, $5 + 4, $2 + 4, $ff, $d1, $5 ; person

	; warp-to
	EVENT_DISP $a, $1, $c ; CELADON_MART_4
	EVENT_DISP $a, $1, $10 ; CELADON_MART_2
	EVENT_DISP $a, $1, $1 ; CELADON_MART_ELEVATOR

CeladonMart3Blocks: ; 48322 (12:4322)
	INCBIN "maps/celadonmart3.blk"

CeladonMart4_h: ; 0x4834a to 0x48356 (12 bytes) (bank=12) (id=125)
	db $12 ; tileset
	db CELADON_MART_4_HEIGHT, CELADON_MART_4_WIDTH ; dimensions (y, x)
	dw CeladonMart4Blocks, CeladonMart4Texts, CeladonMart4Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMart4Object ; objects

CeladonMart4Script: ; 48356 (12:4356)
	jp EnableAutoTextBoxDrawing
; 0x48359

CeladonMart4Texts: ; 48359 (12:4359)
	dw CeladonMart4Text1, CeladonMart4Text2, CeladonMart4Text3, CeladonMart4Text4

CeladonMart4Text2: ; 48361 (12:4361)
	TX_FAR _CeladonMart4Text2
	db $50

CeladonMart4Text3: ; 48366 (12:4366)
	TX_FAR _CeladonMart4Text3
	db $50

CeladonMart4Text4: ; 4836b (12:436b)
	TX_FAR _CeladonMart4Text4
	db $50

CeladonMart4Object: ; 0x48370 (size=49)
	db $f ; border tile

	db $3 ; warps
	db $1, $c, $0, CELADON_MART_3
	db $1, $10, $1, CELADON_MART_5
	db $1, $1, $0, CELADON_MART_ELEVATOR

	db $1 ; signs
	db $1, $e, $4 ; CeladonMart4Text4

	db $3 ; people
	db SPRITE_MART_GUY, $7 + 4, $5 + 4, $ff, $ff, $1 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $5 + 4, $f + 4, $fe, $2, $2 ; person
	db SPRITE_BUG_CATCHER, $2 + 4, $5 + 4, $fe, $2, $3 ; person

	; warp-to
	EVENT_DISP $a, $1, $c ; CELADON_MART_3
	EVENT_DISP $a, $1, $10 ; CELADON_MART_5
	EVENT_DISP $a, $1, $1 ; CELADON_MART_ELEVATOR

CeladonMart4Blocks: ; 483a1 (12:43a1)
	INCBIN "maps/celadonmart4.blk"

CeladonMartRoof_h: ; 0x483c9 to 0x483d5 (12 bytes) (bank=12) (id=126)
	db $12 ; tileset
	db CELADON_MART_5_HEIGHT, CELADON_MART_5_WIDTH ; dimensions (y, x)
	dw CeladonMartRoofBlocks, CeladonMartRoofTexts, CeladonMartRoofScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMartRoofObject ; objects

CeladonMartRoofScript: ; 483d5 (12:43d5)
	jp EnableAutoTextBoxDrawing
; 0x483d8

; known jump sources: 4856d (12:456d)
Func_483d8: ; 483d8 (12:43d8)
	xor a
	ld [$cd37], a
	ld de, $cc5b
	ld hl, Unknown_48408 ; $4408
.asm_483e2
	ld a, [hli]
	and a
	jr z, .asm_48404
	push hl
	push de
	ld [$d11e], a
	ld b, a
	ld a, $1c
	call Predef ; indirect jump to Func_f8a5 (f8a5 (3:78a5))
	pop de
	pop hl
	ld a, b
	and a
	jr z, .asm_483e2
	ld a, [$d11e]
	ld [de], a
	inc de
	push hl
	ld hl, $cd37
	inc [hl]
	pop hl
	jr .asm_483e2
.asm_48404
	ld a, $ff
	ld [de], a
	ret

Unknown_48408: ; 48408 (12:4408)
INCBIN "baserom.gbc",$48408,$4840c - $48408

; known jump sources: 4858a (12:458a)
Func_4840c: ; 4840c (12:440c)
	ld hl, $d730
	set 6, [hl]
	ld hl, UnnamedText_484ee ; $44ee
	call PrintText
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld a, $3
	ld [W_MENUWATCHEDKEYS], a ; $cc29
	ld a, [$cd37]
	dec a
	ld [W_MAXMENUITEMID], a ; $cc28
	ld a, $2
	ld [W_TOPMENUITEMY], a ; $cc24
	ld a, $1
	ld [W_TOPMENUITEMX], a ; $cc25
	ld a, [$cd37]
	dec a
	ld bc, $2
	ld hl, $3
	call AddNTimes
	dec l
	ld b, l
	ld c, $c
	ld hl, W_SCREENTILESBUFFER
	call TextBoxBorder
	call UpdateSprites
	call Func_48532
	ld hl, $d730
	res 6, [hl]
	call HandleMenuInput
	bit 1, a
	ret nz
	ld hl, $cc5b
	ld a, [W_CURMENUITEMID] ; $cc26
	ld d, $0
	ld e, a
	add hl, de
	ld a, [hl]
	ld [$FF00+$db], a
	cp FRESH_WATER
	jr z, .asm_484b6
	cp SODA_POP
	jr z, .asm_48492
	ld a, [$d778]
	bit 6, a
	jr nz, .asm_484e0
	ld hl, Unknown_48515 ; $4515
	call PrintText
	call RemoveItemByIDBank12
	ld bc, (TM_49 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, Unknown_4851b ; $451b
	call PrintText
	ld hl, $d778
	set 6, [hl]
	ret
.asm_48492
	ld a, [$d778]
	bit 5, a
	jr nz, .asm_484e0
	ld hl, Unknown_48504 ; $4504
	call PrintText
	call RemoveItemByIDBank12
	ld bc, (TM_48 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, Unknown_4850a ; $450a
	call PrintText
	ld hl, $d778
	set 5, [hl]
	ret
.asm_484b6
	ld a, [$d778]
	bit 4, a
	jr nz, .asm_484e0
	ld hl, Unknown_484f3 ; $44f3
	call PrintText
	call RemoveItemByIDBank12
	ld bc, (TM_13 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, Unknown_484f9 ; $44f9
	call PrintText
	ld hl, $d778
	set 4, [hl]
	ret
.BagFull
	ld hl, Unknown_48526 ; $4526
	jp PrintText
.asm_484e0
	ld hl, Unknown_4852c ; $452c
	jp PrintText

; known jump sources: 4847b (12:447b), 4849f (12:449f), 484c3 (12:44c3)
RemoveItemByIDBank12: ; 484e6 (12:44e6)
	ld b, BANK(RemoveItemByID)
	ld hl, RemoveItemByID
	jp Bankswitch ; indirect jump to RemoveItemByID (17f37 (5:7f37))
; 484ee (12:44ee)

UnnamedText_484ee: ; 484ee (12:44ee)
	TX_FAR _UnnamedText_484ee
	db $50
; 0x484ee + 5 bytes

Unknown_484f3: ; 484f3 (12:44f3)
INCBIN "baserom.gbc",$484f3,$484f9 - $484f3

Unknown_484f9: ; 484f9 (12:44f9)
INCBIN "baserom.gbc",$484f9,$48504 - $484f9

Unknown_48504: ; 48504 (12:4504)
INCBIN "baserom.gbc",$48504,$4850a - $48504

Unknown_4850a: ; 4850a (12:450a)
INCBIN "baserom.gbc",$4850a,$48515 - $4850a

Unknown_48515: ; 48515 (12:4515)
INCBIN "baserom.gbc",$48515,$4851b - $48515

Unknown_4851b: ; 4851b (12:451b)
INCBIN "baserom.gbc",$4851b,$48526 - $4851b

Unknown_48526: ; 48526 (12:4526)
INCBIN "baserom.gbc",$48526,$4852c - $48526

Unknown_4852c: ; 4852c (12:452c)
INCBIN "baserom.gbc",$4852c,$48532 - $4852c

; known jump sources: 4844b (12:444b)
Func_48532: ; 48532 (12:4532)
	ld hl, $cc5b
	xor a
	ld [$FF00+$db], a
.asm_48538
	ld a, [hli]
	cp $ff
	ret z
	push hl
	ld [$d11e], a
	call GetItemName
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	ld a, [$FF00+$db]
	ld bc, $28
	call AddNTimes
	ld de, $cd6d
	call PlaceString
	ld hl, $ffdb
	inc [hl]
	pop hl
	jr .asm_48538
; 4855b (12:455b)
CeladonMartRoofTexts: ; 4855b (12:455b)
	dw CeladonMartRoofText1, CeladonMartRoofText2, CeladonMartRoofText5, CeladonMartRoofText5, CeladonMartRoofText5, CeladonMartRoofText6

CeladonMartRoofText1: ; 48567 (12:4567)
	TX_FAR _CeladonMartRoofText1
	db $50

CeladonMartRoofText2: ; 4856c (12:456c)
	db $08 ; asm
	call Func_483d8
	ld a, [$cd37]
	and a
	jr z, .asm_914b9 ; 0x48574
	ld a, $1
	ld [$cc3c], a
	ld hl, CeladonMartRoofText4
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_05aa4 ; 0x48588
	call Func_4840c
	jr .asm_05aa4 ; 0x4858d
.asm_914b9 ; 0x4858f
	ld hl, CeladonMartRoofText3
	call PrintText
.asm_05aa4 ; 0x48595
	jp TextScriptEnd

CeladonMartRoofText3: ; 48598 (12:4598)
	TX_FAR _UnnamedText_48598
	db $50
; 0x48598 + 5 bytes

CeladonMartRoofText4: ; 4859d (12:459d)
UnnamedText_4859d: ; 4859d (12:459d)
	TX_FAR _UnnamedText_4859d
	db $50
; 0x4859d + 5 bytes

CeladonMartRoofText5: ; 485a2 (12:45a2)
	db $f5

CeladonMartRoofText6: ; 485a3 (12:45a3)
	TX_FAR _CeladonMartRoofText6
	db $50

CeladonMartRoofObject: ; 0x485a8 (size=36)
	db $42 ; border tile

	db $1 ; warps
	db $2, $f, $0, CELADON_MART_5

	db $4 ; signs
	db $1, $a, $3 ; CeladonMartRoofText3
	db $1, $b, $4 ; CeladonMartRoofText4
	db $2, $c, $5 ; CeladonMartRoofText5
	db $2, $d, $6 ; CeladonMartRoofText6

	db $2 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $4 + 4, $a + 4, $ff, $d2, $1 ; person
	db SPRITE_LITTLE_GIRL, $5 + 4, $5 + 4, $fe, $0, $2 ; person

	; warp-to
	EVENT_DISP $a, $2, $f ; CELADON_MART_5

CeladonMartRoofBlocks: ; 485cc (12:45cc)
	INCBIN "maps/celadonmart5.blk"

CeladonMartElevator_h: ; 0x485f4 to 0x48600 (12 bytes) (bank=12) (id=127)
	db $12 ; tileset
	db CELADON_MART_6_HEIGHT, CELADON_MART_6_WIDTH ; dimensions (y, x)
	dw CeladonMartElevatorBlocks, CeladonMartElevatorTexts, CeladonMartElevatorScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMartElevatorObject ; objects

CeladonMartElevatorScript: ; 48600 (12:4600)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	push hl
	call nz, CeladonMartElevatorScript_Unknown4861c
	pop hl
	bit 7, [hl]
	res 7, [hl]
	call nz, Func_48654
	xor a
	ld [$cf0c], a
	inc a
	ld [$cc3c], a
	ret
; 0x4861c

CeladonMartElevatorScript_Unknown4861c: ; 4861c (12:461c)
INCBIN "baserom.gbc",$4861c,$48631 - $4861c

Func_48631: ; 48631 (12:4631)
	ld hl, Unknown_48643 ; $4643
	call LoadItemList
	ld hl, Unknown_4864a ; $464a
	ld de, $cc5b
	ld bc, $000a
	jp CopyData
; 0x48643

Unknown_48643: ; 48643 (12:4643)
INCBIN "baserom.gbc",$48643,$4864a - $48643

Unknown_4864a: ; 4864a (12:464a)
INCBIN "baserom.gbc",$4864a,$48654 - $4864a

Func_48654: ; 48654 (12:4654)
	ld b, BANK(Func_7bf15)
	ld hl, Func_7bf15
	jp Bankswitch
; 0x4865c

CeladonMartElevatorTexts: ; 4865c (12:465c)
	dw CeladonMartElevatorText1

CeladonMartElevatorText1: ; 4865e (12:465e)
	db $08 ; asm
	call Func_48631
	ld hl, Unknown_4864a ; $464a
	ld a, $61
	call Predef
	jp TextScriptEnd

CeladonMartElevatorObject: ; 0x4866d (size=23)
	db $f ; border tile

	db $2 ; warps
	db $3, $1, $5, CELADON_MART_1
	db $3, $2, $5, CELADON_MART_1

	db $1 ; signs
	db $0, $3, $1 ; CeladonMartElevatorText1

	db $0 ; people

	; warp-to
	EVENT_DISP $2, $3, $1 ; CELADON_MART_1
	EVENT_DISP $2, $3, $2 ; CELADON_MART_1

CeladonMartElevatorBlocks: ; 48684 (12:4684)
	INCBIN "maps/celadonmart6.blk"

CeladonMansion1_h: ; 0x48688 to 0x48694 (12 bytes) (bank=12) (id=128)
	db $13 ; tileset
	db CELADON_MANSION_1_HEIGHT, CELADON_MANSION_1_WIDTH ; dimensions (y, x)
	dw CeladonMansion1Blocks, CeladonMansion1Texts, CeladonMansion1Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMansion1Object ; objects

CeladonMansion1Script: ; 48694 (12:4694)
	jp EnableAutoTextBoxDrawing
; 0x48697

CeladonMansion1Texts: ; 48697 (12:4697)
	dw CeladonMansion1Text1, CeladonMansion1Text2, CeladonMansion1Text3, CeladonMansion1Text4, CeladonMansion1Text5
;0x486a1

Func_486a1: ; 486a1 (12:46a1)
	call PlayCry
	jp TextScriptEnd
; 0x486a7

CeladonMansion1Text1: ; 486a7 (12:46a7)
	TX_FAR _CeladonMansion1Text1
	db $08 ; asm
	ld a, $4d
	jp Func_486a1

CeladonMansion1Text2: ; 486b1 (12:46b1)
	TX_FAR _CeladonMansion1Text2
	db $50

CeladonMansion1Text3: ; 486b6 (12:46b6)
	TX_FAR _CeladonMansion1Text3
	db $8
	ld a, $4
	jp Func_486a1
; 0x486c0

CeladonMansion1Text4: ; 486c0 (12:46c0)
	TX_FAR _CeladonMansion1Text4
	db $8
	ld a, $f
	jp Func_486a1
; 0x486ca

CeladonMansion1Text5: ; 486ca (12:46ca)
	TX_FAR _CeladonMansion1Text5
	db $50

CeladonMansion1Object: ; 0x486cf (size=71)
	db $f ; border tile

	db $5 ; warps
	db $b, $4, $2, $ff
	db $b, $5, $2, $ff
	db $0, $4, $4, $ff
	db $1, $7, $1, CELADON_MANSION_2
	db $1, $2, $2, CELADON_MANSION_2

	db $1 ; signs
	db $9, $4, $5 ; CeladonMansion1Text5

	db $4 ; people
	db SPRITE_SLOWBRO, $5 + 4, $0 + 4, $ff, $d3, $1 ; person
	db SPRITE_OLD_MEDIUM_WOMAN, $5 + 4, $1 + 4, $ff, $d0, $2 ; person
	db SPRITE_CLEFAIRY, $8 + 4, $1 + 4, $fe, $2, $3 ; person
	db SPRITE_SLOWBRO, $4 + 4, $4 + 4, $fe, $1, $4 ; person

	; warp-to
	EVENT_DISP $4, $b, $4
	EVENT_DISP $4, $b, $5
	EVENT_DISP $4, $0, $4
	EVENT_DISP $4, $1, $7 ; CELADON_MANSION_2
	EVENT_DISP $4, $1, $2 ; CELADON_MANSION_2

CeladonMansion1Blocks: ; 48716 (12:4716)
	INCBIN "maps/celadonmansion1.blk"

CeladonMansion2_h: ; 0x4872e to 0x4873a (12 bytes) (bank=12) (id=129)
	db $13 ; tileset
	db CELADON_MANSION_2_HEIGHT, CELADON_MANSION_2_WIDTH ; dimensions (y, x)
	dw CeladonMansion2Blocks, CeladonMansion2Texts, CeladonMansion2Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMansion2Object ; objects

CeladonMansion2Script: ; 4873a (12:473a)
	call EnableAutoTextBoxDrawing
	ret
; 0x4873e

CeladonMansion2Texts: ; 4873e (12:473e)
	dw CeladonMansion2Text1

CeladonMansion2Text1: ; 48740 (12:4740)
	TX_FAR _CeladonMansion2Text1
	db $50

CeladonMansion2Object: ; 0x48745 (size=39)
	db $f ; border tile

	db $4 ; warps
	db $1, $6, $0, CELADON_MANSION_3
	db $1, $7, $3, CELADON_MANSION_1
	db $1, $2, $4, CELADON_MANSION_1
	db $1, $4, $3, CELADON_MANSION_3

	db $1 ; signs
	db $9, $4, $1 ; CeladonMansion2Text1

	db $0 ; people

	; warp-to
	EVENT_DISP $4, $1, $6 ; CELADON_MANSION_3
	EVENT_DISP $4, $1, $7 ; CELADON_MANSION_1
	EVENT_DISP $4, $1, $2 ; CELADON_MANSION_1
	EVENT_DISP $4, $1, $4 ; CELADON_MANSION_3

CeladonMansion2Blocks: ; 4876c (12:476c)
	INCBIN "maps/celadonmansion2.blk"

CeladonMansion3_h: ; 0x48784 to 0x48790 (12 bytes) (bank=12) (id=130)
	db $13 ; tileset
	db CELADON_MANSION_3_HEIGHT, CELADON_MANSION_3_WIDTH ; dimensions (y, x)
	dw CeladonMansion3Blocks, CeladonMansion3Texts, CeladonMansion3Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMansion3Object ; objects

CeladonMansion3Script: ; 48790 (12:4790)
	jp EnableAutoTextBoxDrawing
; 0x48793

CeladonMansion3Texts: ; 48793 (12:4793)
	dw ProgrammerText
	dw GraphicArtistText
	dw WriterText
	dw DirectorText
	dw GameFreakPCText1
	dw GameFreakPCText2
	dw GameFreakPCText3
	dw GameFreakSignText

ProgrammerText: ; 487a3 (12:47a3)
	TX_FAR _ProgrammerText
	db $50

GraphicArtistText: ; 487a8 (12:47a8)
	TX_FAR _GraphicArtistText
	db $50

WriterText: ; 487ad (12:47ad)
	TX_FAR _WriterText
	db $50

DirectorText: ; 487b2 (12:47b2)
	db $08 ; asm

	; check pokédex
	ld hl, WPokedexOwned
	ld b, WPokedexOwnedEnd-WPokedexOwned
	call CountSetBits
	ld a, [$d11e]
	cp 150
	jr nc, .CompletedDex
	ld hl, .GameDesigner
	jr .done
.CompletedDex
	ld hl, .CompletedDexText
.done
	call PrintText
	jp TextScriptEnd

.GameDesigner ; 487d0 (12:47d0)
	TX_FAR _GameDesignerText
	db "@"
; 0x487d5

.CompletedDexText
	TX_FAR _CompletedDexText ; 0x9d0ad
	db $6
	db $8 ; asm
	ld hl, DisplayDiploma
	ld b, BANK(DisplayDiploma)
	call Bankswitch
	ld a, $1
	ld [$cc3c], a
	jp TextScriptEnd
; 0x487eb

GameFreakPCText1: ; 487eb (12:47eb)
	TX_FAR _CeladonMansion3Text5
	db $50

GameFreakPCText2: ; 487f0 (12:47f0)
	TX_FAR _CeladonMansion3Text6
	db $50

GameFreakPCText3: ; 487f5 (12:47f5)
	TX_FAR _CeladonMansion3Text7
	db $50

GameFreakSignText: ; 487fa (12:47fa)
	TX_FAR _CeladonMansion3Text8
	db $50

CeladonMansion3Object: ; 0x487ff (size=72)
	db $f ; border tile

	db $4 ; warps
	db $1, $6, $0, CELADON_MANSION_2
	db $1, $7, $0, CELADON_MANSION_4
	db $1, $2, $1, CELADON_MANSION_4
	db $1, $4, $3, CELADON_MANSION_2

	db $4 ; signs
	db $3, $1, $5 ; CeladonMansion3Text5
	db $3, $4, $6 ; CeladonMansion3Text6
	db $6, $1, $7 ; CeladonMansion3Text7
	db $9, $4, $8 ; CeladonMansion3Text8

	db $4 ; people
	db SPRITE_BIKE_SHOP_GUY, $4 + 4, $0 + 4, $ff, $d1, $1 ; person
	db SPRITE_MART_GUY, $4 + 4, $3 + 4, $ff, $d1, $2 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $7 + 4, $0 + 4, $ff, $d1, $3 ; person
	db SPRITE_LAPRAS_GIVER, $3 + 4, $2 + 4, $ff, $ff, $4 ; person

	; warp-to
	EVENT_DISP $4, $1, $6 ; CELADON_MANSION_2
	EVENT_DISP $4, $1, $7 ; CELADON_MANSION_4
	EVENT_DISP $4, $1, $2 ; CELADON_MANSION_4
	EVENT_DISP $4, $1, $4 ; CELADON_MANSION_2

CeladonMansion3Blocks: ; 48847 (12:4847)
	INCBIN "maps/celadonmansion3.blk"

CeladonMansion4_h: ; 0x4885f to 0x4886b (12 bytes) (bank=12) (id=131)
	db $13 ; tileset
	db CELADON_MANSION_4_HEIGHT, CELADON_MANSION_4_WIDTH ; dimensions (y, x)
	dw CeladonMansion4Blocks, CeladonMansion4Texts, CeladonMansion4Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMansion4Object ; objects

CeladonMansion4Script: ; 4886b (12:486b)
	jp EnableAutoTextBoxDrawing
; 0x4886e

CeladonMansion4Texts: ; 4886e (12:486e)
	dw CeladonMansion4Text1

CeladonMansion4Text1: ; 48870 (12:4870)
	TX_FAR _CeladonMansion4Text1
	db $50

CeladonMansion4Object: ; 0x48875 (size=31)
	db $9 ; border tile

	db $3 ; warps
	db $1, $6, $1, CELADON_MANSION_3
	db $1, $2, $2, CELADON_MANSION_3
	db $7, $2, $0, CELADON_MANSION_5

	db $1 ; signs
	db $7, $3, $1 ; CeladonMansion4Text1

	db $0 ; people

	; warp-to
	EVENT_DISP $4, $1, $6 ; CELADON_MANSION_3
	EVENT_DISP $4, $1, $2 ; CELADON_MANSION_3
	EVENT_DISP $4, $7, $2 ; CELADON_MANSION_5

CeladonMansion4Blocks: ; 48894 (12:4894)
	INCBIN "maps/celadonmansion4.blk"

CeladonPokecenter_h: ; 0x488ac to 0x488b8 (12 bytes) (bank=12) (id=133)
	db $06 ; tileset
	db CELADON_POKECENTER_HEIGHT, CELADON_POKECENTER_WIDTH ; dimensions (y, x)
	dw CeladonPokecenterBlocks, CeladonPokecenterTexts, CeladonPokecenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonPokecenterObject ; objects

CeladonPokecenterScript: ; 488b8 (12:48b8)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x488be

CeladonPokecenterTexts: ; 488be (12:48be)
	dw CeladonPokecenterText1, CeladonPokecenterText2, CeladonPokecenterText3, CeladonPokecenterText4

CeladonPokecenterText4: ; 488c6 (12:48c6)
	db $f6

CeladonPokecenterText1: ; 488c7 (12:48c7)
	db $ff

CeladonPokecenterText2: ; 488c8 (12:48c8)
	TX_FAR _CeladonPokecenterText2
	db $50

CeladonPokecenterText3: ; 488cd (12:48cd)
	TX_FAR _CeladonPokecenterText3
	db $50

CeladonPokecenterObject: ; 0x488d2 (size=44)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $5, $ff
	db $7, $4, $5, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_GENTLEMAN, $3 + 4, $7 + 4, $fe, $2, $2 ; person
	db SPRITE_FOULARD_WOMAN, $5 + 4, $a + 4, $fe, $0, $3 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

CeladonGym_h: ; 0x488fe to 0x4890a (12 bytes) (bank=12) (id=134)
	db $07 ; tileset
	db CELADON_GYM_HEIGHT, CELADON_GYM_WIDTH ; dimensions (y, x)
	dw CeladonGymBlocks, CeladonGymTexts, CeladonGymScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonGymObject ; objects

CeladonGymScript: ; 4890a (12:490a)
	ld hl, $d126
	bit 6, [hl]
	res 6, [hl]
	call nz, CeladonGymScript_Unknown48927
	call EnableAutoTextBoxDrawing
	ld hl, CeladonGymTrainerHeaders
	ld de, Unknown_4894e ; $494e
	ld a, [W_CELADONGYMCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_CELADONGYMCURSCRIPT], a
	ret
; 0x48927

CeladonGymScript_Unknown48927: ; 48927 (12:4927)
	ld hl, Unknown_48930 ; $4930
	ld de, Unknown_4893d ; $493d
	jp LoadGymLeaderAndCityName

Unknown_48930: ; 48930 (12:4930)
INCBIN "baserom.gbc",$48930,$4893d - $48930

Unknown_4893d: ; 4893d (12:493d)
INCBIN "baserom.gbc",$4893d,$48943 - $4893d

; known jump sources: 4895b (12:495b), 489a3 (12:49a3)
Func_48943: ; 48943 (12:4943)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_CELADONGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_4894e: ; 4894e (12:494e)
INCBIN "baserom.gbc",$4894e,$48956 - $4894e
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_48943
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a

; known jump sources: 48a1d (12:4a1d)
Func_48963: ; 48963 (12:4963)
	ld a, $9
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d77c
	set 1, [hl]
	ld bc, (TM_21 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a, $a
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d77c
	set 0, [hl]
	jr .asm_4898c
.BagFull
	ld a, $b
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
.asm_4898c
	ld hl, W_OBTAINEDBADGES ; $d356
	set 3, [hl]
	ld hl, $d72a
	set 3, [hl]
	ld a, [$d77c]
	or $fc
	ld [$d77c], a
	ld hl, $d77d
	set 0, [hl]
	jp Func_48943
; 489a6 (12:49a6)
CeladonGymTexts: ; 489a6 (12:49a6)
	dw CeladonGymText1, CeladonGymText2, CeladonGymText3, CeladonGymText4, CeladonGymText5, CeladonGymText6, CeladonGymText7, CeladonGymText8, CeladonGymText9, TM21Text, TM21NoRoomText

CeladonGymTrainerHeaders: ; 489bc (12:49bc)
CeladonGymTrainerHeader0: ; 489bc (12:49bc)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d77c ; flag's byte
	dw CeladonGymBattleText2 ; 0x4a8b TextBeforeBattle
	dw CeladonGymAfterBattleText2 ; 0x4a95 TextAfterBattle
	dw CeladonGymEndBattleText2 ; 0x4a90 TextEndBattle
	dw CeladonGymEndBattleText2 ; 0x4a90 TextEndBattle
; 0x489c8

CeladonGymTrainerHeader2: ; 489c8 (12:49c8)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d77c ; flag's byte
	dw CeladonGymBattleText3 ; 0x4aa4 TextBeforeBattle
	dw CeladonGymAfterBattleText3 ; 0x4aae TextAfterBattle
	dw CeladonGymEndBattleText3 ; 0x4aa9 TextEndBattle
	dw CeladonGymEndBattleText3 ; 0x4aa9 TextEndBattle
; 0x489d4

CeladonGymTrainerHeader3: ; 489d4 (12:49d4)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d77c ; flag's byte
	dw CeladonGymBattleText4 ; 0x4abd TextBeforeBattle
	dw CeladonGymAfterBattleText4 ; 0x4ac7 TextAfterBattle
	dw CeladonGymEndBattleText4 ; 0x4ac2 TextEndBattle
	dw CeladonGymEndBattleText4 ; 0x4ac2 TextEndBattle
; 0x489e0

CeladonGymTrainerHeader4: ; 489e0 (12:49e0)
	db $5 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d77c ; flag's byte
	dw CeladonGymBattleText5 ; 0x4ad6 TextBeforeBattle
	dw CeladonGymAfterBattleText5 ; 0x4ae0 TextAfterBattle
	dw CeladonGymEndBattleText5 ; 0x4adb TextEndBattle
	dw CeladonGymEndBattleText5 ; 0x4adb TextEndBattle
; 0x489ec

CeladonGymTrainerHeader5: ; 489ec (12:49ec)
	db $6 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d77c ; flag's byte
	dw CeladonGymBattleText6 ; 0x4aef TextBeforeBattle
	dw CeladonGymAfterBattleText6 ; 0x4af9 TextAfterBattle
	dw CeladonGymEndBattleText6 ; 0x4af4 TextEndBattle
	dw CeladonGymEndBattleText6 ; 0x4af4 TextEndBattle
; 0x489f8

CeladonGymTrainerHeader6: ; 489f8 (12:49f8)
	db $7 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d77c ; flag's byte
	dw CeladonGymBattleText7 ; 0x4b08 TextBeforeBattle
	dw CeladonGymAfterBattleText7 ; 0x4b12 TextAfterBattle
	dw CeladonGymEndBattleText7 ; 0x4b0d TextEndBattle
	dw CeladonGymEndBattleText7 ; 0x4b0d TextEndBattle
; 0x48a04

CeladonGymTrainerHeader7: ; 48a04 (12:4a04)
	db $8 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d77c ; flag's byte
	dw CeladonGymBattleText8 ; 0x4b21 TextBeforeBattle
	dw CeladonGymAfterBattleText8 ; 0x4b2b TextAfterBattle
	dw CeladonGymEndBattleText8 ; 0x4b26 TextEndBattle
	dw CeladonGymEndBattleText8 ; 0x4b26 TextEndBattle
; 0x48a10

db $ff

CeladonGymText1: ; 48a11 (12:4a11)
	db $08 ; asm
	ld a, [$d77c]
	bit 1, a
	jr z, .asm_16064 ; 0x48a17
	bit 0, a
	jr nz, .asm_3b22c ; 0x48a1b
	call z, Func_48963
	call DisableWaitingAfterTextDisplay
	jr .asm_96252 ; 0x48a23
.asm_3b22c ; 0x48a25
	ld hl, UnnamedText_48a68
	call PrintText
	jr .asm_96252 ; 0x48a2b
.asm_16064 ; 0x48a2d
	ld hl, UnnamedText_48a5e
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_48a63
	ld de, UnnamedText_48a63
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $4
	ld [$d05c], a
	ld a, $3
	ld [W_CELADONGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
.asm_96252 ; 0x48a5b
	jp TextScriptEnd

UnnamedText_48a5e: ; 48a5e (12:4a5e)
	TX_FAR _UnnamedText_48a5e
	db $50
; 0x48a5e + 5 bytes

UnnamedText_48a63: ; 48a63 (12:4a63)
	TX_FAR _UnnamedText_48a63
	db $50
; 0x48a63 + 5 bytes

UnnamedText_48a68: ; 48a68 (12:4a68)
	TX_FAR _UnnamedText_48a68
	db $50
; 0x48a68 + 5 bytes

CeladonGymText9: ; 48a6d (12:4a6d)
UnnamedText_48a6d: ; 48a6d (12:4a6d)
	TX_FAR _UnnamedText_48a6d
	db $50
; 0x48a6d + 5 bytes

TM21Text: ; 48a72 (12:4a72)
	TX_FAR _ReceivedTM21Text ; 0x9d50c
	db $0B
	TX_FAR _TM21ExplanationText ; 0x9d520
	db $50
; 0x48a7c

TM21NoRoomText: ; 48a7c (12:4a7c)
	TX_FAR _TM21NoRoomText
	db $50
; 0x48a7c + 5 bytes

CeladonGymText2: ; 48a81 (12:4a81)
	db $08 ; asm
	ld hl, CeladonGymTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

CeladonGymBattleText2: ; 48a8b (12:4a8b)
	TX_FAR _CeladonGymBattleText2
	db $50
; 0x48a8b + 5 bytes

CeladonGymEndBattleText2: ; 48a90 (12:4a90)
	TX_FAR _CeladonGymEndBattleText2
	db $50
; 0x48a90 + 5 bytes

CeladonGymAfterBattleText2: ; 48a95 (12:4a95)
	TX_FAR _CeladonGymAfterBattleText2
	db $50
; 0x48a95 + 5 bytes

CeladonGymText3: ; 48a9a (12:4a9a)
	db $08 ; asm
	ld hl, CeladonGymTrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

CeladonGymBattleText3: ; 48aa4 (12:4aa4)
	TX_FAR _CeladonGymBattleText3
	db $50
; 0x48aa4 + 5 bytes

CeladonGymEndBattleText3: ; 48aa9 (12:4aa9)
	TX_FAR _CeladonGymEndBattleText3
	db $50
; 0x48aa9 + 5 bytes

CeladonGymAfterBattleText3: ; 48aae (12:4aae)
	TX_FAR _CeladonGymAfterBattleText3
	db $50
; 0x48aae + 5 bytes

CeladonGymText4: ; 48ab3 (12:4ab3)
	db $08 ; asm
	ld hl, CeladonGymTrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

CeladonGymBattleText4: ; 48abd (12:4abd)
	TX_FAR _CeladonGymBattleText4
	db $50
; 0x48abd + 5 bytes

CeladonGymEndBattleText4: ; 48ac2 (12:4ac2)
	TX_FAR _CeladonGymEndBattleText4
	db $50
; 0x48ac2 + 5 bytes

CeladonGymAfterBattleText4: ; 48ac7 (12:4ac7)
	TX_FAR _CeladonGymAfterBattleText4
	db $50
; 0x48ac7 + 5 bytes

CeladonGymText5: ; 48acc (12:4acc)
	db $08 ; asm
	ld hl, CeladonGymTrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

CeladonGymBattleText5: ; 48ad6 (12:4ad6)
	TX_FAR _CeladonGymBattleText5
	db $50
; 0x48ad6 + 5 bytes

CeladonGymEndBattleText5: ; 48adb (12:4adb)
	TX_FAR _CeladonGymEndBattleText5
	db $50
; 0x48adb + 5 bytes

CeladonGymAfterBattleText5: ; 48ae0 (12:4ae0)
	TX_FAR _CeladonGymAfterBattleText5
	db $50
; 0x48ae0 + 5 bytes

CeladonGymText6: ; 48ae5 (12:4ae5)
	db $08 ; asm
	ld hl, CeladonGymTrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

CeladonGymBattleText6: ; 48aef (12:4aef)
	TX_FAR _CeladonGymBattleText6
	db $50
; 0x48aef + 5 bytes

CeladonGymEndBattleText6: ; 48af4 (12:4af4)
	TX_FAR _CeladonGymEndBattleText6
	db $50
; 0x48af4 + 5 bytes

CeladonGymAfterBattleText6: ; 48af9 (12:4af9)
	TX_FAR _CeladonGymAfterBattleText6
	db $50
; 0x48af9 + 5 bytes

CeladonGymText7: ; 48afe (12:4afe)
	db $08 ; asm
	ld hl, CeladonGymTrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

CeladonGymBattleText7: ; 48b08 (12:4b08)
	TX_FAR _CeladonGymBattleText7
	db $50
; 0x48b08 + 5 bytes

CeladonGymEndBattleText7: ; 48b0d (12:4b0d)
	TX_FAR _CeladonGymEndBattleText7
	db $50
; 0x48b0d + 5 bytes

CeladonGymAfterBattleText7: ; 48b12 (12:4b12)
	TX_FAR _CeladonGymAfterBattleText7
	db $50
; 0x48b12 + 5 bytes

CeladonGymText8: ; 48b17 (12:4b17)
	db $08 ; asm
	ld hl, CeladonGymTrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

CeladonGymBattleText8: ; 48b21 (12:4b21)
	TX_FAR _CeladonGymBattleText8
	db $50
; 0x48b21 + 5 bytes

CeladonGymEndBattleText8: ; 48b26 (12:4b26)
	TX_FAR _CeladonGymEndBattleText8
	db $50
; 0x48b26 + 5 bytes

CeladonGymAfterBattleText8: ; 48b2b (12:4b2b)
	TX_FAR _CeladonGymAfterBattleText8
	db $50
; 0x48b2b + 5 bytes

CeladonGymObject: ; 0x48b30 (size=84)
	db $3 ; border tile

	db $2 ; warps
	db $11, $4, $6, $ff
	db $11, $5, $6, $ff

	db $0 ; signs

	db $8 ; people
	db SPRITE_ERIKA, $3 + 4, $4 + 4, $ff, $d0, $41, ERIKA + $C8, $1 ; trainer
	db SPRITE_LASS, $b + 4, $2 + 4, $ff, $d3, $42, LASS + $C8, $11 ; trainer
	db SPRITE_FOULARD_WOMAN, $a + 4, $7 + 4, $ff, $d2, $43, BEAUTY + $C8, $1 ; trainer
	db SPRITE_LASS, $5 + 4, $9 + 4, $ff, $d0, $44, JR__TRAINER_F + $C8, $b ; trainer
	db SPRITE_FOULARD_WOMAN, $5 + 4, $1 + 4, $ff, $d0, $45, BEAUTY + $C8, $2 ; trainer
	db SPRITE_LASS, $3 + 4, $6 + 4, $ff, $d0, $46, LASS + $C8, $12 ; trainer
	db SPRITE_FOULARD_WOMAN, $3 + 4, $3 + 4, $ff, $d0, $47, BEAUTY + $C8, $3 ; trainer
	db SPRITE_LASS, $3 + 4, $5 + 4, $ff, $d0, $48, COOLTRAINER_F + $C8, $1 ; trainer

	; warp-to
	EVENT_DISP $5, $11, $4
	EVENT_DISP $5, $11, $5

CeladonGymBlocks: ; 48b84 (12:4b84)
	INCBIN "maps/celadongym.blk"

CeladonGameCorner_h: ; 0x48bb1 to 0x48bbd (12 bytes) (bank=12) (id=135)
	db $12 ; tileset
	db GAME_CORNER_HEIGHT, GAME_CORNER_WIDTH ; dimensions (y, x)
	dw CeladonGameCornerBlocks, CeladonGameCornerTexts, CeladonGameCornerScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonGameCornerObject ; objects

CeladonGameCornerScript: ; 48bbd (12:4bbd)
	call Unknown_48bcf
	call Func_48bec
	call EnableAutoTextBoxDrawing
	ld hl, CeladonGameCornerScripts
	ld a, [W_CELADONGAMECORNERCURSCRIPT]
	jp CallFunctionInTable
; 0x48bcf

Unknown_48bcf: ; 48bcf (12:4bcf)
INCBIN "baserom.gbc",$48bcf,$48bec - $48bcf

Func_48bec: ; 48bec (12:4bec)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld a, [$d77e]
	bit 1, a
	ret nz
	ld a, $2a
	ld [$d09f], a
	ld bc, $0208
	ld a, $17
	jp Predef
; 0x48c07

INCBIN "baserom.gbc",$48c07,$48c12 - $48c07

CeladonGameCornerScripts: ; 48c12 (12:4c12)
	dw CeladonGameCornerScript0, CeladonGameCornerScript1, CeladonGameCornerScript2

CeladonGameCornerScript0: ; 48c18 (12:4c18)
	ret
; 0x48c19

CeladonGameCornerScript1: ; 48c19 (12:4c19)
INCBIN "baserom.gbc",$48c19,$48c5a - $48c19
; 0x48c5a

INCBIN "baserom.gbc",$48c5a,$48c69 - $48c5a

CeladonGameCornerScript2: ; 48c69 (12:4c69)
INCBIN "baserom.gbc",$48c69,$48c8a - $48c69

CeladonGameCornerTexts: ; 48c8a (12:4c8a)
	dw CeladonGameCornerText1, CeladonGameCornerText2, CeladonGameCornerText3, CeladonGameCornerText4, CeladonGameCornerText5, CeladonGameCornerText6, CeladonGameCornerText7, CeladonGameCornerText8, CeladonGameCornerText9, CeladonGameCornerText10, CeladonGameCornerText11, CeladonGameCornerText12, CeladonGameCornerText13

CeladonGameCornerText1: ; 48ca4 (12:4ca4)
	TX_FAR _CeladonGameCornerText1
	db $50

CeladonGameCornerText2: ; 48ca9 (12:4ca9)
	db $08 ; asm
	call Func_48f1e
	ld hl, UnnamedText_48d22
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_c650b ; 0x48cba
	ld b,COIN_CASE
	call IsItemInBag
	jr z, .asm_ed086 ; 0x48cc1
	call Has9990Coins
	jr nc, .asm_31338 ; 0x48cc6
	xor a
	ldh [$9f], a
	ldh [$a1], a
	ld a, $10
	ldh [$a0], a
	call HasEnoughMoney
	jr nc, .asm_b6ef0 ; 0x48cd4
	ld hl, UnnamedText_48d31 ; $4d31
	jr .asm_e2afd ; 0x48cd9
.asm_b6ef0 ; 0x48cdb
	xor a
	ldh [$9f], a
	ldh [$a1], a
	ld a, $10
	ldh [$a0], a
	ld hl, $ffa1
	ld de, $d349
	ld c, $3
	ld a, $c
	call Predef
	xor a
	ldh [$9f], a
	ldh [$a0], a
	ld a, $50
	ldh [$a1], a
	ld de, $d5a5
	ld hl, $ffa1
	ld c, $2
	ld a, $b
	call Predef
	call Func_48f1e
	ld hl, UnnamedText_48d27
	jr .asm_e2afd ; 0x48d0d
.asm_c650b ; 0x48d0f
	ld hl, UnnamedText_48d2c
	jr .asm_e2afd ; 0x48d12
.asm_31338 ; 0x48d14
	ld hl, UnnamedText_48d36
	jr .asm_e2afd ; 0x48d17
.asm_ed086 ; 0x48d19
	ld hl, UnnamedText_48d3b
.asm_e2afd ; 0x48d1c
	call PrintText
	jp TextScriptEnd

UnnamedText_48d22: ; 48d22 (12:4d22)
	TX_FAR _UnnamedText_48d22
	db $50
; 0x48d27

UnnamedText_48d27: ; 48d27 (12:4d27)
	TX_FAR _UnnamedText_48d27
	db $50
; 0x48d2c

UnnamedText_48d2c: ; 48d2c (12:4d2c)
	TX_FAR _UnnamedText_48d2c
	db $50
; 0x48d31

UnnamedText_48d31: ; 48d31 (12:4d31)
	TX_FAR _UnnamedText_48d31
	db $50
; 0x48d36

UnnamedText_48d36: ; 48d36 (12:4d36)
	TX_FAR _UnnamedText_48d36
	db $50
; 0x48d3b

UnnamedText_48d3b: ; 48d3b (12:4d3b)
	TX_FAR _UnnamedText_48d3b
	db $50
; 0x48d40

CeladonGameCornerText3: ; 48d40 (12:4d40)
	TX_FAR _CeladonGameCornerText3
	db $50

CeladonGameCornerText4: ; 48d45 (12:4d45)
	TX_FAR _CeladonGameCornerText4
	db $50

CeladonGameCornerText5: ; 48d4a (12:4d4a)
	db $08 ; asm
	ld a, [$d77e]
	bit 2, a
	jr nz, .asm_d0957 ; 0x48d50
	ld hl, UnnamedText_48d9c
	call PrintText
	ld b, COIN_CASE
	call IsItemInBag
	jr z, .asm_5aef9 ; 0x48d5d
	call Has9990Coins
	jr nc, .asm_98546 ; 0x48d62
	xor a
	ldh [$9f], a
	ldh [$a0], a
	ld a, $10
	ldh [$a1], a
	ld de, $d5a5
	ld hl, $ffa1
	ld c, $2
	ld a, $b
	call Predef
	ld hl, $d77e
	set 2, [hl]
	ld a, $1
	ld [$cc3c], a
	ld hl, Received10CoinsText
	jr .asm_c7d1a ; 0x48d87
.asm_d0957 ; 0x48d89
	ld hl, UnnamedText_48dac
	jr .asm_c7d1a ; 0x48d8c
.asm_98546 ; 0x48d8e
	ld hl, UnnamedText_48da7
	jr .asm_c7d1a ; 0x48d91
.asm_5aef9 ; 0x48d93
	ld hl, UnnamedText_48f19
.asm_c7d1a ; 0x48d96
	call PrintText
	jp TextScriptEnd

UnnamedText_48d9c: ; 48d9c (12:4d9c)
	TX_FAR _UnnamedText_48d9c
	db $50
; 0x48d9c + 5 bytes

Received10CoinsText: ; 48da1 (12:4da1)
	TX_FAR _Received10CoinsText ; 0x9daa9
	db $0B, $50

UnnamedText_48da7: ; 48da7 (12:4da7)
	TX_FAR _UnnamedText_48da7
	db $50
; 0x48da7 + 5 bytes

UnnamedText_48dac: ; 48dac (12:4dac)
	TX_FAR _UnnamedText_48dac
	db $50
; 0x48dac + 5 bytes

CeladonGameCornerText6: ; 48db1 (12:4db1)
	TX_FAR _CeladonGameCornerText6
	db $50

CeladonGameCornerText7: ; 48db6 (12:4db6)
	db $08 ; asm
	ld a, [$d77c]
	bit 1, a
	ld hl, UnnamedText_48dca ; $4dca
	jr z, .asm_be3fd ; 0x48dbf
	ld hl, UnnamedText_48dcf ; $4dcf
.asm_be3fd ; 0x48dc4
	call PrintText
	jp TextScriptEnd

UnnamedText_48dca: ; 48dca (12:4dca)
	TX_FAR _UnnamedText_48dca
	db $50
; 0x48dca + 5 bytes

UnnamedText_48dcf: ; 48dcf (12:4dcf)
	TX_FAR _UnnamedText_48dcf
	db $50
; 0x48dcf + 5 bytes

CeladonGameCornerText8: ; 48dd4 (12:4dd4)
	TX_FAR _CeladonGameCornerText8
	db $50

CeladonGameCornerText9: ; 48dd9 (12:4dd9)
	db $08 ; asm
	ld a, [$d77e]
	bit 4, a
	jr nz, .asm_ed8bc ; 0x48ddf
	ld hl, UnnamedText_48e26
	call PrintText
	ld b, COIN_CASE
	call IsItemInBag
	jr z, .asm_df794 ; 0x48dec
	call Has9990Coins
	jr nc, .asm_f17c3 ; 0x48df1
	xor a
	ldh [$9f], a
	ldh [$a0], a
	ld a, $20
	ldh [$a1], a
	ld de, $d5a5
	ld hl, $ffa1
	ld c, $2
	ld a, $b
	call Predef
	ld hl, $d77e
	set 4, [hl]
	ld hl, Received20CoinsText
	jr .asm_0ddc2 ; 0x48e11
.asm_ed8bc ; 0x48e13
	ld hl, UnnamedText_48e36
	jr .asm_0ddc2 ; 0x48e16
.asm_f17c3 ; 0x48e18
	ld hl, UnnamedText_48e31
	jr .asm_0ddc2 ; 0x48e1b
.asm_df794 ; 0x48e1d
	ld hl, UnnamedText_48f19
.asm_0ddc2 ; 0x48e20
	call PrintText
	jp TextScriptEnd

UnnamedText_48e26: ; 48e26 (12:4e26)
	TX_FAR _UnnamedText_48e26
	db $50
; 0x48e26 + 5 bytes

Received20CoinsText: ; 48e2b (12:4e2b)
	TX_FAR _Received20CoinsText ; 0x9dc4f
	db $0B, $50
; 0x48e31

UnnamedText_48e31: ; 48e31 (12:4e31)
	TX_FAR _UnnamedText_48e31
	db $50
; 0x48e31 + 5 bytes

UnnamedText_48e36: ; 48e36 (12:4e36)
	TX_FAR _UnnamedText_48e36
	db $50
; 0x48e36 + 5 bytes

CeladonGameCornerText10: ; 48e3b (12:4e3b)
	db $08 ; asm
	ld a, [$d77e]
	bit 3, a
	jr nz, .asm_ff080 ; 0x48e41
	ld hl, UnnamedText_48e88 ; $4e88
	call PrintText
	ld b,COIN_CASE
	call IsItemInBag
	jr z, .asm_4fb0c ; 0x48e4e
	call Has9990Coins
	jr z, .asm_9505a ; 0x48e53
	xor a
	ldh [$9f], a
	ldh [$a0], a
	ld a, $20
	ldh [$a1], a
	ld de, $d5a5
	ld hl, $ffa1
	ld c, $2
	ld a, $b
	call Predef
	ld hl, $d77e
	set 3, [hl]
	ld hl, UnnamedText_48e8d
	jr .asm_78d65 ; 0x48e73
.asm_ff080 ; 0x48e75
	ld hl, UnnamedText_48e98
	jr .asm_78d65 ; 0x48e78
.asm_9505a ; 0x48e7a
	ld hl, UnnamedText_48e93
	jr .asm_78d65 ; 0x48e7d
.asm_4fb0c ; 0x48e7f
	ld hl, UnnamedText_48f19
.asm_78d65 ; 0x48e82
	call PrintText
	jp TextScriptEnd

UnnamedText_48e88: ; 48e88 (12:4e88)
	TX_FAR _UnnamedText_48e88
	db $50
; 0x48e88 + 5 bytes

UnnamedText_48e8d: ; 48e8d (12:4e8d)
	TX_FAR _UnnamedText_48e8d ; 0x9dceb
	db $0B, $50
; 0x48e93

UnnamedText_48e93: ; 48e93 (12:4e93)
	TX_FAR _UnnamedText_48e93
	db $50
; 0x48e93 + 5 bytes

UnnamedText_48e98: ; 48e98 (12:4e98)
	TX_FAR _UnnamedText_48e98
	db $50
; 0x48e98 + 5 bytes

CeladonGameCornerText11: ; 48e9d (12:4e9d)
	db $08 ; asm
	ld hl, UnnamedText_48ece
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_48ed3
	ld de, UnnamedText_48ed3
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	xor a
	ldh [$b4], a
	ldh [$b3], a
	ldh [$b2], a
	ld a, $1
	ld [W_CELADONGAMECORNERCURSCRIPT], a
	jp TextScriptEnd

UnnamedText_48ece: ; 48ece (12:4ece)
	TX_FAR _UnnamedText_48ece
	db $50
; 0x48ece + 5 bytes

UnnamedText_48ed3: ; 48ed3 (12:4ed3)
	TX_FAR _UnnamedText_48ed3
	db $50
; 0x48ed3 + 5 bytes

CeladonGameCornerText13: ; 48ed8 (12:4ed8)
	TX_FAR _UnnamedText_48ed8
	db $50
; 0x48ed8 + 5 bytes

CeladonGameCornerText12: ; 48edd (12:4edd)
	db $08 ; asm
	ld a, $1
	ld [$cc3c], a
	ld hl, UnnamedText_48f09
	call PrintText
	call WaitForSoundToFinish
	ld a, $ad
	call PlaySound
	call WaitForSoundToFinish
	ld hl, $d77e
	set 1, [hl]
	ld a, $43
	ld [$d09f], a
	ld bc, $0208
	ld a, $17
	call Predef
	jp TextScriptEnd

UnnamedText_48f09: ; 48f09 (12:4f09)
	TX_FAR _UnnamedText_48f09 ; 0x9ddb0
	db $8
	ld a, $9d
	call PlaySound
	call WaitForSoundToFinish
	jp TextScriptEnd
; 0x48f19

UnnamedText_48f19: ; 48f19 (12:4f19)
	TX_FAR _UnnamedText_48f19
	db $50
; 0x48f19 + 5 bytes

Func_48f1e: ; 48f1e (12:4f1e)
	ld hl, $d730
	set 6, [hl]
	FuncCoord 11, 0 ; $c3ab
	ld hl, Coord
	ld b, $5
	ld c, $7
	call TextBoxBorder
	call UpdateSprites
	FuncCoord 12, 1 ; $c3c0
	ld hl, Coord
	ld b, $4
	ld c, $7
	call ClearScreenArea
	FuncCoord 12, 2 ; $c3d4
	ld hl, Coord
	ld de, Unknown_48f7a ; $4f7a
	call PlaceString
	FuncCoord 12, 3 ; $c3e8
	ld hl, Coord
	ld de, Unknown_48f85 ; $4f85
	call PlaceString
	FuncCoord 12, 3 ; $c3e8
	ld hl, Coord
	ld de, $d347
	ld c, $a3
	call PrintBCDNumber
	FuncCoord 12, 4 ; $c3fc
	ld hl, Coord
	ld de, Unknown_48f80 ; $4f80
	call PlaceString
	FuncCoord 12, 5 ; $c410
	ld hl, Coord
	ld de, Unknown_48f8d ; $4f8d
	call PlaceString
	FuncCoord 15, 5 ; $c413
	ld hl, Coord
	ld de, $d5a4
	ld c, $82
	call PrintBCDNumber
	ld hl, $d730
	res 6, [hl]
	ret
; 0x48f7a

Unknown_48f7a: ; 48f7a (12:4f7a)
INCBIN "baserom.gbc",$48f7a,$48f80 - $48f7a

Unknown_48f80: ; 48f80 (12:4f80)
INCBIN "baserom.gbc",$48f80,$48f85 - $48f80

Unknown_48f85: ; 48f85 (12:4f85)
INCBIN "baserom.gbc",$48f85,$48f8d - $48f85

Unknown_48f8d: ; 48f8d (12:4f8d)
INCBIN "baserom.gbc",$48f8d,$48f95 - $48f8d

Has9990Coins: ; 48f95 (12:4f95)
	ld a, $99
	ld [$ff00+$a0], a
	ld a, $90
	ld [$ff00+$a1], a
	jp HasEnoughCoins
; 0x48fa0

CeladonGameCornerObject: ; 0x48fa0 (size=99)
	db $f ; border tile

	db $3 ; warps
	db $11, $f, $7, $ff
	db $11, $10, $7, $ff
	db $4, $11, $1, ROCKET_HIDEOUT_1

	db $1 ; signs
	db $4, $9, $c ; CeladonGameCornerText12

	db $b ; people
	db SPRITE_FOULARD_WOMAN, $6 + 4, $2 + 4, $ff, $d0, $1 ; person
	db SPRITE_MART_GUY, $6 + 4, $5 + 4, $ff, $d0, $2 ; person
	db SPRITE_FAT_BALD_GUY, $a + 4, $2 + 4, $ff, $d2, $3 ; person
	db SPRITE_FOULARD_WOMAN, $d + 4, $2 + 4, $ff, $d2, $4 ; person
	db SPRITE_FISHER, $b + 4, $5 + 4, $ff, $d3, $5 ; person
	db SPRITE_MOM_GEISHA, $b + 4, $8 + 4, $ff, $d2, $6 ; person
	db SPRITE_GYM_HELPER, $e + 4, $8 + 4, $ff, $d2, $7 ; person
	db SPRITE_GAMBLER, $f + 4, $b + 4, $ff, $d3, $8 ; person
	db SPRITE_MART_GUY, $b + 4, $e + 4, $ff, $d2, $9 ; person
	db SPRITE_GENTLEMAN, $d + 4, $11 + 4, $ff, $d3, $a ; person
	db SPRITE_ROCKET, $5 + 4, $9 + 4, $ff, $d1, $4b, ROCKET + $C8, $7 ; trainer

	; warp-to
	EVENT_DISP $a, $11, $f
	EVENT_DISP $a, $11, $10
	EVENT_DISP $a, $4, $11 ; ROCKET_HIDEOUT_1

CeladonGameCornerBlocks: ; 49003 (12:5003)
	INCBIN "maps/celadongamecorner.blk"

CeladonMart5_h: ; 0x4905d to 0x49069 (12 bytes) (bank=12) (id=136)
	db $12 ; tileset
	db CELADON_HOUSE_HEIGHT, CELADON_HOUSE_WIDTH ; dimensions (y, x)
	dw CeladonMart5Blocks, CeladonMart5Texts, CeladonMart5Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMart5Object ; objects

CeladonMart5Script: ; 49069 (12:5069)
	jp EnableAutoTextBoxDrawing
; 0x4906c

CeladonMart5Texts: ; 4906c (12:506c)
	dw CeladonMart5Text1, CeladonMart5Text2, CeladonMart5Text3, CeladonMart5Text4, CeladonMart5Text5

CeladonMart5Text1: ; 49076 (12:5076)
	TX_FAR _CeladonMart5Text1
	db $50

CeladonMart5Text2: ; 4907b (12:507b)
	TX_FAR _CeladonMart5Text2
	db $50

CeladonMart5Text5: ; 49080 (12:5080)
	TX_FAR _CeladonMart5Text5
	db $50

CeladonMart5Object: ; 0x49085 (size=55)
	db $f ; border tile

	db $3 ; warps
	db $1, $c, $0, CELADON_MART_ROOF
	db $1, $10, $1, CELADON_MART_4
	db $1, $1, $0, CELADON_MART_ELEVATOR

	db $1 ; signs
	db $1, $e, $5 ; CeladonMart5Text5

	db $4 ; people
	db SPRITE_GENTLEMAN, $5 + 4, $e + 4, $fe, $1, $1 ; person
	db SPRITE_SAILOR, $6 + 4, $2 + 4, $ff, $ff, $2 ; person
	db SPRITE_MART_GUY, $3 + 4, $5 + 4, $ff, $d0, $3 ; person
	db SPRITE_MART_GUY, $3 + 4, $6 + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $a, $1, $c ; CELADON_MART_ROOF
	EVENT_DISP $a, $1, $10 ; CELADON_MART_4
	EVENT_DISP $a, $1, $1 ; CELADON_MART_ELEVATOR

CeladonMart5Blocks: ; 490bc (12:50bc)
	INCBIN "maps/celadonhouse.blk"

CeladonPrizeRoom_h: ; 0x490e4 to 0x490f0 (12 bytes) (bank=12) (id=137)
	db $12 ; tileset
	db CELADONPRIZE_ROOM_HEIGHT, CELADONPRIZE_ROOM_WIDTH ; dimensions (y, x)
	dw CeladonPrizeRoomBlocks, CeladonPrizeRoomTexts, CeladonPrizeRoomScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonPrizeRoomObject ; objects

CeladonPrizeRoomScript: ; 490f0 (12:50f0)
	jp EnableAutoTextBoxDrawing
; 0x490f3

CeladonPrizeRoomTexts: ; 490f3 (12:50f3)
	dw CeladonPrizeRoomText1, CeladonPrizeRoomText2, CeladonPrizeRoomText3, CeladonPrizeRoomText3, CeladonPrizeRoomText3

CeladonPrizeRoomText1: ; 490fd (12:50fd)
	TX_FAR _CeladonPrizeRoomText1
	db $50

CeladonPrizeRoomText2: ; 49102 (12:5102)
	TX_FAR _CeladonPrizeRoomText2
	db $50

CeladonPrizeRoomText3: ; 49107 (12:5107)
	db $f7

CeladonPrizeRoomObject: ; 0x49108 (size=41)
	db $f ; border tile

	db $2 ; warps
	db $7, $4, $9, $ff
	db $7, $5, $9, $ff

	db $3 ; signs
	db $2, $2, $3 ; CeladonPrizeRoomText3
	db $2, $4, $4 ; CeladonPrizeRoomText4
	db $2, $6, $5 ; CeladonPrizeRoomText5

	db $2 ; people
	db SPRITE_BALDING_GUY, $4 + 4, $1 + 4, $ff, $ff, $1 ; person
	db SPRITE_GAMBLER, $3 + 4, $7 + 4, $fe, $2, $2 ; person

	; warp-to
	EVENT_DISP $5, $7, $4
	EVENT_DISP $5, $7, $5

CeladonPrizeRoomBlocks: ; 49131 (12:5131)
	INCBIN "maps/celadonprizeroom.blk"

CeladonDiner_h: ; 0x49145 to 0x49151 (12 bytes) (bank=12) (id=138)
	db $12 ; tileset
	db CELADON_DINER_HEIGHT, CELADON_DINER_WIDTH ; dimensions (y, x)
	dw CeladonDinerBlocks, CeladonDinerTexts, CeladonDinerScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonDinerObject ; objects

CeladonDinerScript: ; 49151 (12:5151)
	call EnableAutoTextBoxDrawing
	ret
; 0x49155

CeladonDinerTexts: ; 49155 (12:5155)
	dw CeladonDinerText1, CeladonDinerText2, CeladonDinerText3, CeladonDinerText4, CeladonDinerText5

CeladonDinerText1: ; 4915f (12:515f)
	TX_FAR _CeladonDinerText1
	db $50

CeladonDinerText2: ; 49164 (12:5164)
	TX_FAR _CeladonDinerText2
	db $50

CeladonDinerText3: ; 49169 (12:5169)
	TX_FAR _CeladonDinerText3
	db $50

CeladonDinerText4: ; 4916e (12:516e)
	TX_FAR _CeladonDinerText4
	db $50

CeladonDinerText5: ; 49173 (12:5173)
	db $08 ; asm
	ld a, [$d783]
	bit 0, a
	jr nz, .asm_eb14d ; 0x49179
	ld hl, UnnamedText_491a7
	call PrintText
	ld bc, (COIN_CASE << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, $d783
	set 0, [hl]
	ld hl, ReceivedCoinCaseText
	call PrintText
	jr .asm_68b61 ; 0x49194
.BagFull
	ld hl, CoinCaseNoRoomText
	call PrintText
	jr .asm_68b61 ; 0x4919c
.asm_eb14d ; 0x4919e
	ld hl, UnnamedText_491b7
	call PrintText
.asm_68b61 ; 0x491a4
	jp TextScriptEnd

UnnamedText_491a7: ; 491a7 (12:51a7)
	TX_FAR _UnnamedText_491a7
	db $50
; 0x491a7 + 5 bytes

ReceivedCoinCaseText: ; 491ac (12:51ac)
	TX_FAR _ReceivedCoinCaseText ; 0x9e07a
	db $11, $50
; 0x491b2

CoinCaseNoRoomText: ; 491b2 (12:51b2)
	TX_FAR _CoinCaseNoRoomText
	db $50
; 0x491b2 + 5 bytes

UnnamedText_491b7: ; 491b7 (12:51b7)
	TX_FAR _UnnamedText_491b7
	db $50
; 0x491b7 + 5 bytes

CeladonDinerObject: ; 0x491bc (size=50)
	db $f ; border tile

	db $2 ; warps
	db $7, $3, $a, $ff
	db $7, $4, $a, $ff

	db $0 ; signs

	db $5 ; people
	db SPRITE_COOK, $5 + 4, $8 + 4, $fe, $2, $1 ; person
	db SPRITE_MOM_GEISHA, $2 + 4, $7 + 4, $ff, $ff, $2 ; person
	db SPRITE_FAT_BALD_GUY, $4 + 4, $1 + 4, $ff, $d0, $3 ; person
	db SPRITE_FISHER2, $3 + 4, $5 + 4, $ff, $d3, $4 ; person
	db SPRITE_GYM_HELPER, $1 + 4, $0 + 4, $ff, $d0, $5 ; person

	; warp-to
	EVENT_DISP $5, $7, $3
	EVENT_DISP $5, $7, $4

CeladonDinerBlocks: ; 491ee (12:51ee)
	INCBIN "maps/celadondiner.blk"

CeladonHouse_h: ; 0x49202 to 0x4920e (12 bytes) (bank=12) (id=139)
	db $13 ; tileset
	db CELADON_HOUSE_2_HEIGHT, CELADON_HOUSE_2_WIDTH ; dimensions (y, x)
	dw CeladonHouseBlocks, CeladonHouseTexts, CeladonHouseScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonHouseObject ; objects

CeladonHouseScript: ; 4920e (12:520e)
	call EnableAutoTextBoxDrawing
	ret
; 0x49212

CeladonHouseTexts: ; 49212 (12:5212)
	dw CeladonHouseText1, CeladonHouseText2, CeladonHouseText3

CeladonHouseText1: ; 49218 (12:5218)
	TX_FAR _CeladonHouseText1
	db $50

CeladonHouseText2: ; 4921d (12:521d)
	TX_FAR _CeladonHouseText2
	db $50

CeladonHouseText3: ; 49222 (12:5222)
	TX_FAR _CeladonHouseText3
	db $50

CeladonHouseObject: ; 0x49227 (size=38)
	db $f ; border tile

	db $2 ; warps
	db $7, $2, $b, $ff
	db $7, $3, $b, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_OLD_PERSON, $2 + 4, $4 + 4, $ff, $d0, $1 ; person
	db SPRITE_ROCKET, $4 + 4, $1 + 4, $fe, $0, $2 ; person
	db SPRITE_SAILOR, $6 + 4, $5 + 4, $ff, $d2, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

CeladonHouseBlocks: ; 4924d (12:524d)
	INCBIN "maps/celadonhouse2.blk"

CeladonHotel_h: ; 0x4925d to 0x49269 (12 bytes) (bank=12) (id=140)
	db $06 ; tileset
	db CELADONHOTEL_HEIGHT, CELADONHOTEL_WIDTH ; dimensions (y, x)
	dw CeladonHotelBlocks, CeladonHotelTexts, CeladonHotelScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonHotelObject ; objects

CeladonHotelScript: ; 49269 (12:5269)
	jp EnableAutoTextBoxDrawing
; 0x4926c

CeladonHotelTexts: ; 4926c (12:526c)
	dw CeladonHotelText1, CeladonHotelText2, CeladonHotelText3

CeladonHotelText1: ; 49272 (12:5272)
	TX_FAR _CeladonHotelText1
	db $50

CeladonHotelText2: ; 49277 (12:5277)
	TX_FAR _CeladonHotelText2
	db $50

CeladonHotelText3: ; 4927c (12:527c)
	TX_FAR _CeladonHotelText3
	db $50

CeladonHotelObject: ; 0x49281 (size=38)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $c, $ff
	db $7, $4, $c, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_OLD_MEDIUM_WOMAN, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_FOULARD_WOMAN, $4 + 4, $2 + 4, $ff, $ff, $2 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $4 + 4, $8 + 4, $fe, $2, $3 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

CeladonHotelBlocks: ; 492a7 (12:52a7)
	INCBIN "maps/celadonhotel.blk"

MtMoonPokecenter_h: ; 0x492c3 to 0x492cf (12 bytes) (bank=12) (id=68)
	db $06 ; tileset
	db MT_MOON_POKECENTER_HEIGHT, MT_MOON_POKECENTER_WIDTH ; dimensions (y, x)
	dw MtMoonPokecenterBlocks, MtMoonPokecenterTexts, MtMoonPokecenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw MtMoonPokecenterObject ; objects

MtMoonPokecenterScript: ; 492cf (12:52cf)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x492d5

MtMoonPokecenterTexts: ; 492d5 (12:52d5)
	dw MtMoonPokecenterText1, MtMoonPokecenterText2, MtMoonPokecenterText3, MtMoonPokecenterText4, MtMoonPokecenterText5, MtMoonPokecenterText6

MtMoonPokecenterText1: ; 492e1 (12:52e1)
	db $ff

MtMoonPokecenterText2: ; 492e2 (12:52e2)
	TX_FAR _MtMoonPokecenterText1
	db $50

MtMoonPokecenterText3: ; 492e7 (12:52e7)
	TX_FAR _MtMoonPokecenterText3
	db $50

MtMoonPokecenterText4: ; 492ec (12:52ec)
	db $08 ; asm
	ld a, [$d7c6]
	add a
	jp c, .asm_49353
	ld hl, UnnamedText_4935c
	call PrintText
	ld a, $13
	ld [$d125], a
	call DisplayTextBoxID
	call YesNoChoice
	ld a, [$cc26]
	and a
	jp nz, .asm_4934e
	ldh [$9f], a
	ldh [$a1], a
	ld a, $5
	ldh [$a0], a
	call HasEnoughMoney
	jr nc, .asm_faa09 ; 0x49317
	ld hl, UnnamedText_49366
	jr .asm_49356 ; 0x4931c
.asm_faa09 ; 0x4931e
	ld bc,(MAGIKARP << 8) | 5
	call GivePokemon
	jr nc, .asm_49359 ; 0x49324
	xor a
	ld [W_WHICHTRADE], a
	ld [$cd3f], a
	ld a, $5
	ld [$cd3e], a
	ld hl, $cd3f
	ld de, $d349
	ld c, $3
	ld a, $c
	call Predef
	ld a, $13
	ld [$d125], a
	call DisplayTextBoxID
	ld hl, $d7c6
	set 7, [hl]
	jr .asm_49359 ; 0x4934c
.asm_4934e ; 0x4934e
	ld hl, UnnamedText_49361
	jr .asm_49356 ; 0x49351
.asm_49353 ; 0x49353
	ld hl, UnnamedText_4936b
.asm_49356 ; 0x49356
	call PrintText
.asm_49359 ; 0x49359
	jp TextScriptEnd

UnnamedText_4935c: ; 4935c (12:535c)
	TX_FAR _UnnamedText_4935c
	db $50
; 0x4935c + 5 bytes

UnnamedText_49361: ; 49361 (12:5361)
	TX_FAR _UnnamedText_49361
	db $50
; 0x49361 + 5 bytes

UnnamedText_49366: ; 49366 (12:5366)
	TX_FAR _UnnamedText_49366
	db $50
; 0x49366 + 5 bytes

UnnamedText_4936b: ; 4936b (12:536b)
	TX_FAR _UnnamedText_4936b
	db $50
; 0x4936b + 5 bytes

MtMoonPokecenterText5: ; 49370 (12:5370)
	TX_FAR _MtMoonPokecenterText5
	db $50

MtMoonPokecenterText6: ; 49375 (12:5375)
	db $f6

MtMoonPokecenterObject: ; 0x49376 (size=56)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $0, $ff
	db $7, $4, $0, $ff

	db $0 ; signs

	db $6 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_BUG_CATCHER, $3 + 4, $4 + 4, $ff, $d1, $2 ; person
	db SPRITE_GENTLEMAN, $3 + 4, $7 + 4, $ff, $d1, $3 ; person
	db SPRITE_FAT_BALD_GUY, $6 + 4, $a + 4, $fe, $2, $4 ; person
	db SPRITE_CLIPBOARD, $2 + 4, $7 + 4, $ff, $ff, $5 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $6 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

RockTunnelPokecenter_h: ; 0x493ae to 0x493ba (12 bytes) (id=81)
	db $06 ; tileset
	db ROCK_TUNNEL_POKECENTER_HEIGHT, ROCK_TUNNEL_POKECENTER_WIDTH ; dimensions (y, x)
	dw RockTunnelPokecenterBlocks, RockTunnelPokecenterTexts, RockTunnelPokecenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw RockTunnelPokecenterObject ; objects

RockTunnelPokecenterScript: ; 493ba (12:53ba)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x493c0

RockTunnelPokecenterTexts: ; 493c0 (12:53c0)
	dw RockTunnelPokecenterText1, RockTunnelPokecenterText2, RockTunnelPokecenterText3, RockTunnelPokecenterText4

RockTunnelPokecenterText1: ; 493c8 (12:53c8)
	db $ff

RockTunnelPokecenterText2: ; 493c9 (12:53c9)
	TX_FAR _RockTunnelPokecenterText1
	db $50

RockTunnelPokecenterText3: ; 493ce (12:53ce)
	TX_FAR _RockTunnelPokecenterText3
	db $50

RockTunnelPokecenterText4: ; 493d3 (12:53d3)
	db $f6

RockTunnelPokecenterObject: ; 0x493d4 (size=44)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $0, $ff
	db $7, $4, $0, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_GENTLEMAN, $3 + 4, $7 + 4, $fe, $2, $2 ; person
	db SPRITE_FISHER2, $5 + 4, $2 + 4, $ff, $ff, $3 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

Route11Gate_h: ; 0x49400 to 0x4940c (12 bytes) (id=84)
	db $0c ; tileset
	db ROUTE_11_GATE_1F_HEIGHT, ROUTE_11_GATE_1F_WIDTH ; dimensions (y, x)
	dw Route11GateBlocks, Route11GateTexts, Route11GateScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route11GateObject ; objects

Route11GateScript: ; 4940c (12:540c)
	jp EnableAutoTextBoxDrawing
; 0x4940f

Route11GateTexts: ; 4940f (12:540f)
	dw Route11GateText1

Route11GateText1: ; 49411 (12:5411)
	TX_FAR _Route11GateText1
	db $50

Route11GateObject: ; 0x49416 (size=50)
	db $a ; border tile

	db $5 ; warps
	db $4, $0, $0, $ff
	db $5, $0, $1, $ff
	db $4, $7, $2, $ff
	db $5, $7, $3, $ff
	db $8, $6, $0, ROUTE_11_GATE_2F

	db $0 ; signs

	db $1 ; people
	db SPRITE_GUARD, $1 + 4, $4 + 4, $ff, $ff, $1 ; person

	; warp-to
	EVENT_DISP $4, $4, $0
	EVENT_DISP $4, $5, $0
	EVENT_DISP $4, $4, $7
	EVENT_DISP $4, $5, $7
	EVENT_DISP $4, $8, $6 ; ROUTE_11_GATE_2F

Route11GateUpstairs_h: ; 0x49448 to 0x49454 (12 bytes) (id=86)
	db $0c ; tileset
	db ROUTE_11_GATE_2F_HEIGHT, ROUTE_11_GATE_2F_WIDTH ; dimensions (y, x)
	dw Route11GateUpstairsBlocks, Route11GateUpstairsTexts, Route11GateUpstairsScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route11GateUpstairsObject ; objects

Route11GateUpstairsScript: ; 49454 (12:5454)
	jp DisableAutoTextBoxDrawing
; 0x49457

Route11GateUpstairsTexts: ; 49457 (12:5457)
	dw Route11GateUpstairsText1, Route11GateUpstairsText2, Route11GateUpstairsText3, Route11GateUpstairsText4

Route11GateUpstairsText1: ; 4945f (12:545f)
	db $08 ; asm
	xor a
	ld [W_WHICHTRADE], a
	ld a, $54
	call Predef
asm_49469: ; 49469 (12:5469)
	jp TextScriptEnd

Route11GateUpstairsText2: ; 4946c (12:546c)
	db $8
	ld a, [$d7d6]
	add a
	jr c, .asm_4949b ; 0x49471 $28
	ld a, $1e
	ld [$ff00+$db], a
	ld a, $47
	ld [$ff00+$dc], a
	ld [$d11e], a
	call GetItemName
	ld h, d
	ld l, e
	ld de, $cc5b
	ld bc, $000d
	call CopyData
	ld a, $62
	call Predef
	ld a, [$ff00+$db]
	dec a
	jr nz, .asm_494a1 ; 0x49494 $b
	ld hl, $d7d6
	set 7, [hl]
.asm_4949b
	ld hl, UnnamedText_494a3
	call PrintText
.asm_494a1
	jr asm_49469 ; 0x494a1 $c6
; 0x494a3

UnnamedText_494a3: ; 494a3 (12:54a3)
	TX_FAR _UnnamedText_494a3
	db $50
; 0x494a3 + 5 bytes

Route11GateUpstairsText3: ; 494a8 (12:54a8)
	db $08 ; asm
	ld a, [$c109]
	cp $4
	jp nz, Unnamed_55c9
	ld a, [$d7d8]
	bit 7, a
	ld hl, UnnamedText_494c4
	jr z, .asm_5ac80 ; 0x494b9
	ld hl, UnnamedText_494c9
.asm_5ac80 ; 0x494be
	call PrintText
	jp TextScriptEnd

UnnamedText_494c4: ; 494c4 (12:54c4)
	TX_FAR _UnnamedText_494c4
	db $50
; 0x494c4 + 5 bytes

UnnamedText_494c9: ; 494c9 (12:54c9)
	TX_FAR _UnnamedText_494c9
	db $50
; 0x494c9 + 5 bytes

Route11GateUpstairsText4: ; 494ce (12:54ce)
	db $8
	ld hl, UnnamedText_494d5 ; $54d5
	jp Unnamed_55c9
; 0x494d5

UnnamedText_494d5: ; 494d5 (12:54d5)
	TX_FAR _UnnamedText_494d5
	db $50
; 0x494d5 + 5 bytes

Route11GateUpstairsObject: ; 0x494da (size=30)
	db $a ; border tile

	db $1 ; warps
	db $7, $7, $4, ROUTE_11_GATE_1F

	db $2 ; signs
	db $2, $1, $3 ; Route11GateUpstairsText3
	db $2, $6, $4 ; Route11GateUpstairsText4

	db $2 ; people
	db SPRITE_BUG_CATCHER, $2 + 4, $4 + 4, $fe, $2, $1 ; person
	db SPRITE_OAK_AIDE, $6 + 4, $2 + 4, $ff, $ff, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $7 ; ROUTE_11_GATE_1F

Route12Gate_h: ; 0x494f8 to 0x49504 (12 bytes) (id=87)
	db $0c ; tileset
	db ROUTE_12_GATE_HEIGHT, ROUTE_12_GATE_WIDTH ; dimensions (y, x)
	dw Route12GateBlocks, Route12GateTexts, Route12GateScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route12GateObject ; objects

Route12GateScript: ; 49504 (12:5504)
	jp EnableAutoTextBoxDrawing
; 0x49507

Route12GateTexts: ; 49507 (12:5507)
	dw Route12GateText1

Route12GateText1: ; 49509 (12:5509)
	TX_FAR _Route12GateText1
	db $50

Route12GateObject: ; 0x4950e (size=50)
	db $a ; border tile

	db $5 ; warps
	db $0, $4, $0, $ff
	db $0, $5, $1, $ff
	db $7, $4, $2, $ff
	db $7, $5, $2, $ff
	db $6, $8, $0, ROUTE_12_GATE_2F

	db $0 ; signs

	db $1 ; people
	db SPRITE_GUARD, $3 + 4, $1 + 4, $ff, $ff, $1 ; person

	; warp-to
	EVENT_DISP $5, $0, $4
	EVENT_DISP $5, $0, $5
	EVENT_DISP $5, $7, $4
	EVENT_DISP $5, $7, $5
	EVENT_DISP $5, $6, $8 ; ROUTE_12_GATE_2F

Route12GateBlocks: ; 49540 (12:5540)
	INCBIN "maps/route12gate.blk"

Route12GateUpstairs_h: ; 0x49554 to 0x49560 (12 bytes) (id=195)
	db $0c ; tileset
	db ROUTE_12_GATE_2F_HEIGHT, ROUTE_12_GATE_2F_WIDTH ; dimensions (y, x)
	dw Route12GateUpstairsBlocks, Route12GateUpstairsTexts, Route12GateUpstairsScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route12GateUpstairsObject ; objects

Route12GateUpstairsScript: ; 49560 (12:5560)
	jp DisableAutoTextBoxDrawing
; 0x49563

Route12GateUpstairsTexts: ; 49563 (12:5563)
	dw Route12GateUpstairsText1, Route12GateUpstairsText2, Route12GateUpstairsText3

Route12GateUpstairsText1: ; 49569 (12:5569)
	db $08 ; asm
	ld a, [$d7d7]
	rrca
	jr c, .asm_0ad3c ; 0x4956e
	ld hl, TM39PreReceiveText
	call PrintText
	ld bc, (TM_39 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedTM39Text
	call PrintText
	ld hl, $d7d7
	set 0, [hl]
	jr .asm_4ba56 ; 0x49589
.BagFull
	ld hl, TM39NoRoomText
	call PrintText
	jr .asm_4ba56 ; 0x49591
.asm_0ad3c ; 0x49593
	ld hl, TM39ExplanationText
	call PrintText
.asm_4ba56 ; 0x49599
	jp TextScriptEnd

TM39PreReceiveText: ; 4959c (12:559c)
	TX_FAR _TM39PreReceiveText
	db $50
; 0x4959c + 5 bytes

ReceivedTM39Text: ; 495a1 (12:55a1)
	TX_FAR _ReceivedTM39Text ; 0x8c8c6
	db $0B, $50
; 0x495a7

TM39ExplanationText: ; 495a7 (12:55a7)
	TX_FAR _TM39ExplanationText
	db $50
; 0x495a7 + 5 bytes

TM39NoRoomText: ; 495ac (12:55ac)
	TX_FAR _TM39NoRoomText
	db $50
; 0x495ac + 5 bytes

Route12GateUpstairsText2: ; 495b1 (12:55b1)
	db $08 ; asm
	ld hl, UnnamedText_495b8
	jp Unnamed_55c9

UnnamedText_495b8: ; 495b8 (12:55b8)
	TX_FAR _UnnamedText_495b8 ; 0x8c95a
	db $50
; 0x495bd

Route12GateUpstairsText3: ; 495bd (12:55bd)
	db $8
	ld hl, UnnamedText_495c4
	jp Unnamed_55c9
; 0x495c4

UnnamedText_495c4: ; 495c4 (12:55c4)
	TX_FAR _UnnamedText_495c4
	db $50
; 0x495c4 + 5 bytes

Unnamed_55c9: ; 495c9 (12:55c9)
	ld a, [$c109]
	cp $4
	jr z, .asm_495d4 ; 0x495ce $4
	ld a, $1
	jr .asm_495d8 ; 0x495d2 $4
.asm_495d4
	call PrintText
	xor a
.asm_495d8
	ld [$cc3c], a
	jp TextScriptEnd
; 0x495de

Route12GateUpstairsObject: ; 0x495de (size=24)
	db $a ; border tile

	db $1 ; warps
	db $7, $7, $4, ROUTE_12_GATE

	db $2 ; signs
	db $2, $1, $2 ; Route12GateUpstairsText2
	db $2, $6, $3 ; Route12GateUpstairsText3

	db $1 ; people
	db SPRITE_BRUNETTE_GIRL, $4 + 4, $3 + 4, $fe, $1, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $7 ; ROUTE_12_GATE

Route15Gate_h: ; 0x495f6 to 0x49602 (12 bytes) (id=184)
	db $0c ; tileset
	db ROUTE_15_GATE_1F_HEIGHT, ROUTE_15_GATE_1F_WIDTH ; dimensions (y, x)
	dw Route15GateBlocks, Route15GateTexts, Route15GateScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route15GateObject ; objects

Route15GateScript: ; 49602 (12:5602)
	jp EnableAutoTextBoxDrawing
; 0x49605

Route15GateTexts: ; 49605 (12:5605)
	dw Route15GateText1

Route15GateText1: ; 49607 (12:5607)
	TX_FAR _Route15GateText1
	db $50

Route15GateObject: ; 0x4960c (size=50)
	db $a ; border tile

	db $5 ; warps
	db $4, $0, $0, $ff
	db $5, $0, $1, $ff
	db $4, $7, $2, $ff
	db $5, $7, $3, $ff
	db $8, $6, $0, ROUTE_15_GATE_2F

	db $0 ; signs

	db $1 ; people
	db SPRITE_GUARD, $1 + 4, $4 + 4, $ff, $ff, $1 ; person

	; warp-to
	EVENT_DISP $4, $4, $0
	EVENT_DISP $4, $5, $0
	EVENT_DISP $4, $4, $7
	EVENT_DISP $4, $5, $7
	EVENT_DISP $4, $8, $6

Route15GateUpstairs_h: ; 4963e (12:563e)
	db $0c ; tileset
	db ROUTE_15_GATE_2F_HEIGHT, ROUTE_15_GATE_2F_WIDTH ; dimensions (y, x)
	dw Route15GateUpstairsBlocks, Route15GateUpstairsTexts, Route15GateUpstairsScript ; blocks, texts, scripts
	;dw 40db, 564d, 564a ; blocks, texts, scripts
	db $00 ; connections
	dw Route15GateUpstairsObject ; objects

Route15GateUpstairsScript: ; 4964a (12:564a)
	jp DisableAutoTextBoxDrawing

Route15GateUpstairsTexts: ; 4964d (12:564d)
	dw Route15GateUpstairsText1
	dw Route15GateUpstairsText2

Route15GateUpstairsText1: ; 49651 (12:5651)
	db $8
	ld a, [$d7dd]
	bit 0, a
	jr nz, .asm_49683 ; 0x49657 $2a
	ld a, $32
	ld [$ff00+$db], a
	ld a, $4b
	ld [$ff00+$dc], a
	ld [$d11e], a
	call GetItemName
	ld hl, $cd6d
	ld de, $cc5b
	ld bc, $000d
	call CopyData
	ld a, $62
	call Predef
	ld a, [$ff00+$db]
	cp $1
	jr nz, .asm_49689 ; 0x4967c $b
	ld hl, $d7dd
	set 0, [hl]
.asm_49683
	ld hl, UnnamedText_4968c
	call PrintText
.asm_49689
	jp TextScriptEnd
; 0x4968c

UnnamedText_4968c: ; 4968c (12:568c)
	TX_FAR _UnnamedText_4968c
	db $50
; 0x4968c + 5 bytes

Route15GateUpstairsText2: ; 49691 (12:5691)
	db $8
	ld hl, UnnamedText_49698
	jp Unnamed_55c9
; 0x49698

UnnamedText_49698: ; 49698 (12:5698)
	TX_FAR _UnnamedText_49698
	db $50
; 0x49698 + 5 bytes

Route15GateUpstairsObject: ; 4969d (12:569d)
	db $a ; border tile

	db $1 ; warps
	db $7, $7, $4, ROUTE_15_GATE_1F

	db $1 ; signs
	db $2, $6, $2 ; Route15GateUpstairsText2

	db $1 ; people
	db SPRITE_OAK_AIDE, $2 + 4, $4 + 4, $ff, $d0, $1

	; warp-to
	EVENT_DISP $4, $7, $7 ; ROUTE_15_GATE_1F

Route16GateMap_h: ; 0x496b2 to 0x496be (12 bytes) (id=186)
	db $0c ; tileset
	db ROUTE_16_GATE_1F_HEIGHT, ROUTE_16_GATE_1F_WIDTH ; dimensions (y, x)
	dw Route16GateMapBlocks, Route16GateMapTexts, Route16GateMapScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route16GateMapObject ; objects

Route16GateMapScript: ; 496be (12:56be)
	ld hl, $d732
	res 5, [hl]
	call EnableAutoTextBoxDrawing
	ld a, [W_ROUTE16GATECURSCRIPT]
	ld hl, Route16GateMapScripts
	jp CallFunctionInTable
; 0x496cf

Route16GateMapScripts: ; 496cf (12:56cf)
	dw Route16GateMapScript0

INCBIN "baserom.gbc",$496d1,$496d7 - $496d1

Route16GateMapScript0: ; 496d7 (12:56d7)
	call Func_49755
	ret nz
	ld hl, Unknown_49714 ; $5714
	call ArePlayerCoordsInArray
	ret nc
	ld a, $3
	ld [$ff00+$8c], a
	call DisplayTextID
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, [$cd3d]
	cp $1
	jr z, .asm_4970e ; 0x496f1 $1b
	ld a, [$cd3d]
	dec a
	ld [$cd38], a
	ld b, $0
	ld c, a
	ld a, $40
	ld hl, $ccd3
	call FillMemory
	call Func_3486
	ld a, $1
	ld [W_ROUTE16GATECURSCRIPT], a
	ret
.asm_4970e
	ld a, $2
	ld [W_ROUTE16GATECURSCRIPT], a
	ret
; 0x49714

Unknown_49714: ; 49714 (12:5714)
INCBIN "baserom.gbc",$49714,$49755 - $49714

; known jump sources: 496d7 (12:56d7), 4988f (12:588f)
Func_49755: ; 49755 (12:5755)
	ld b, $6
	jp IsItemInBag
; 4975a (12:575a)
Route16GateMapTexts: ; 4975a (12:575a)
	dw Route16GateMapText1, Route16GateMapText2, Route16GateMapText3

Route16GateMapText1: ; 49760 (12:5760)
	db $08 ; asm
	call Func_49755
	jr z, .asm_0bdf3 ; 0x49764
	ld hl, UnnamedText_4977c
	call PrintText
	jr .asm_56c9d ; 0x4976c
.asm_0bdf3 ; 0x4976e
	ld hl, UnnamedText_49777
	call PrintText
.asm_56c9d ; 0x49774
	jp TextScriptEnd

UnnamedText_49777: ; 49777 (12:5777)
	TX_FAR _UnnamedText_49777
	db $50
; 0x49777 + 5 bytes

UnnamedText_4977c: ; 4977c (12:577c)
	TX_FAR _UnnamedText_4977c
	db $50
; 0x4977c + 5 bytes

Route16GateMapText3: ; 49781 (12:5781)
	TX_FAR _UnnamedText_49781
	db $50
; 0x49781 + 5 bytes

Route16GateMapText2: ; 49786 (12:5786)
	TX_FAR _Route16GateMapText2
	db $50

Route16GateMapObject: ; 0x4978b (size=88)
	db $a ; border tile

	db $9 ; warps
	db $8, $0, $0, $ff
	db $9, $0, $1, $ff
	db $8, $7, $2, $ff
	db $9, $7, $2, $ff
	db $2, $0, $4, $ff
	db $3, $0, $5, $ff
	db $2, $7, $6, $ff
	db $3, $7, $7, $ff
	db $c, $6, $0, ROUTE_16_GATE_2F

	db $0 ; signs

	db $2 ; people
	db SPRITE_GUARD, $5 + 4, $4 + 4, $ff, $d0, $1 ; person
	db SPRITE_GAMBLER, $3 + 4, $4 + 4, $ff, $ff, $2 ; person

	; warp-to
	EVENT_DISP $4, $8, $0
	EVENT_DISP $4, $9, $0
	EVENT_DISP $4, $8, $7
	EVENT_DISP $4, $9, $7
	EVENT_DISP $4, $2, $0
	EVENT_DISP $4, $3, $0
	EVENT_DISP $4, $2, $7
	EVENT_DISP $4, $3, $7
	EVENT_DISP $4, $c, $6 ; ROUTE_16_GATE_2F

Route16GateMapBlocks: ; 497e3 (12:57e3)
	INCBIN "maps/route16gatemap.blk"

Route16GateUpstairs_h: ; 0x497ff to 0x4980b (12 bytes) (id=187)
	db $0c ; tileset
	db ROUTE_16_GATE_2F_HEIGHT, ROUTE_16_GATE_2F_WIDTH ; dimensions (y, x)
	dw Route16GateUpstairsBlocks, Route16GateUpstairsTexts, Route16GateUpstairsScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route16GateUpstairsObject ; objects

Route16GateUpstairsScript: ; 4980b (12:580b)
	jp DisableAutoTextBoxDrawing
; 0x4980e

Route16GateUpstairsTexts: ; 4980e (12:580e)
	dw Route16GateUpstairsText1, Route16GateUpstairsText2, Route16GateUpstairsText3, Route16GateUpstairsText4

Route16GateUpstairsText1: ; 49816 (12:5816)
	db $08 ; asm
	ld hl, UnnamedText_49820
	call PrintText
	jp TextScriptEnd

UnnamedText_49820: ; 49820 (12:5820)
	TX_FAR _UnnamedText_49820
	db $50
; 0x49820 + 5 bytes

Route16GateUpstairsText2: ; 49825 (12:5825)
	db $08 ; asm
	ld hl, UnnamedText_4982f
	call PrintText
	jp TextScriptEnd

UnnamedText_4982f: ; 4982f (12:582f)
	TX_FAR _UnnamedText_4982f
	db $50
; 0x4982f + 5 bytes

Route16GateUpstairsText3: ; 49834 (12:5834)
	db $8
	ld hl, UnnamedText_4983b
	jp Unnamed_55c9
; 0x4983b

UnnamedText_4983b: ; 4983b (12:583b)
	TX_FAR _UnnamedText_4983b
	db $50
; 0x4983b + 5 bytes

Route16GateUpstairsText4: ; 49840 (12:5840)
	db $8
	ld hl, UnnamedText_49847 ; $5847
	jp Unnamed_55c9
; 0x49847

UnnamedText_49847: ; 49847 (12:5847)
	TX_FAR _UnnamedText_49847
	db $50
; 0x49847 + 5 bytes

Route16GateUpstairsObject: ; 0x4984c (size=30)
	db $a ; border tile

	db $1 ; warps
	db $7, $7, $8, ROUTE_16_GATE_1F

	db $2 ; signs
	db $2, $1, $3 ; Route16GateUpstairsText3
	db $2, $6, $4 ; Route16GateUpstairsText4

	db $2 ; people
	db SPRITE_YOUNG_BOY, $2 + 4, $4 + 4, $ff, $ff, $1 ; person
	db SPRITE_LITTLE_GIRL, $5 + 4, $2 + 4, $fe, $2, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $7 ; ROUTE_16_GATE_1F

Route18Gate_h: ; 0x4986a to 0x49876 (12 bytes) (id=190)
	db $0c ; tileset
	db ROUTE_18_GATE_1F_HEIGHT, ROUTE_18_GATE_1F_WIDTH ; dimensions (y, x)
	dw Route18GateBlocks, Route18GateTexts, Route18GateScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route18GateObject ; objects

Route18GateScript: ; 49876 (12:5876)
	ld hl, $d732
	res 5, [hl]
	call EnableAutoTextBoxDrawing
	ld a, [W_ROUTE18GATECURSCRIPT]
	ld hl, Route18GateScripts
	jp CallFunctionInTable
; 0x49887

Route18GateScripts: ; 49887 (12:5887)
	dw Route18GateScript0

INCBIN "baserom.gbc",$49889,$4988f - $49889

Route18GateScript0: ; 4988f (12:588f)
	call Func_49755
	ret nz
	ld hl, Unknown_498cc ; $58cc
	call ArePlayerCoordsInArray
	ret nc
	ld a, $2
	ld [$ff00+$8c], a
	call DisplayTextID
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, [$cd3d]
	cp $1
	jr z, .asm_498c6 ; 0x498a9 $1b
	ld a, [$cd3d]
	dec a
	ld [$cd38], a
	ld b, $0
	ld c, a
	ld a, $40
	ld hl, $ccd3
	call FillMemory
	call Func_3486
	ld a, $1
	ld [W_ROUTE18GATECURSCRIPT], a
	ret
.asm_498c6
	ld a, $2
	ld [W_ROUTE18GATECURSCRIPT], a
	ret
; 0x498cc

Unknown_498cc: ; 498cc (12:58cc)
INCBIN "baserom.gbc",$498cc,$4990d - $498cc

Route18GateTexts: ; 4990d (12:590d)
	dw Route18GateText1, Route18GateText2

Route18GateText1: ; 49911 (12:5911)
	db $08 ; asm
	call Func_49755
	jr z, .asm_3c84d ; 0x49915
	ld hl, UnnamedText_4992d
	call PrintText
	jr .asm_a8410 ; 0x4991d
.asm_3c84d ; 0x4991f
	ld hl, UnnamedText_49928
	call PrintText
.asm_a8410 ; 0x49925
	jp TextScriptEnd

UnnamedText_49928: ; 49928 (12:5928)
	TX_FAR _UnnamedText_49928
	db $50
; 0x4992d

UnnamedText_4992d: ; 4992d (12:592d)
	TX_FAR _UnnamedText_4992d
	db $50
; 0x49932

Route18GateText2: ; 49932 (12:5932)
	TX_FAR _UnnamedText_49932
	db $50
; 0x49937

Route18GateObject: ; 0x49937 (size=50)
	db $a ; border tile

	db $5 ; warps
	db $4, $0, $0, $ff
	db $5, $0, $1, $ff
	db $4, $7, $2, $ff
	db $5, $7, $3, $ff
	db $8, $6, $0, ROUTE_18_GATE_2F

	db $0 ; signs

	db $1 ; people
	db SPRITE_GUARD, $1 + 4, $4 + 4, $ff, $d0, $1 ; person

	; warp-to
	EVENT_DISP $4, $4, $0
	EVENT_DISP $4, $5, $0
	EVENT_DISP $4, $4, $7
	EVENT_DISP $4, $5, $7
	EVENT_DISP $4, $8, $6 ; ROUTE_18_GATE_2F

Route18GateHeader_h: ; 0x49969 to 0x49975 (12 bytes) (id=191)
	db $0c ; tileset
	db ROUTE_18_GATE_2F_HEIGHT, ROUTE_18_GATE_2F_WIDTH ; dimensions (y, x)
	dw Route18GateHeaderBlocks, Route18GateHeaderTexts, Route18GateHeaderScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route18GateHeaderObject ; objects

Route18GateHeaderScript: ; 49975 (12:5975)
	jp DisableAutoTextBoxDrawing
; 0x49978

Route18GateHeaderTexts: ; 49978 (12:5978)
	dw Route18GateHeaderText1, Route18GateHeaderText2, Route18GateHeaderText3

Route18GateHeaderText1: ; 4997e (12:597e)
	db $08 ; asm
	ld a, $5
	ld [W_WHICHTRADE], a
	ld a, $54
	call Predef
	jp TextScriptEnd

Route18GateHeaderText2: ; 4998c (12:598c)
	db $8
	ld hl, UnnamedText_49993 ; $5993
	jp Unnamed_55c9
; 0x49993

UnnamedText_49993: ; 49993 (12:5993)
	TX_FAR _UnnamedText_49993
	db $50
; 0x49993 + 5 bytes

Route18GateHeaderText3: ; 49998 (12:5998)
	db $8
	ld hl, UnnamedText_4999f ; $599f
	jp Unnamed_55c9
; 0x4999f

UnnamedText_4999f: ; 4999f (12:599f)
	TX_FAR _UnnamedText_4999f
	db $50
; 0x4999f + 5 bytes

Route18GateHeaderObject: ; 0x499a4 (size=24)
	db $a ; border tile

	db $1 ; warps
	db $7, $7, $4, ROUTE_18_GATE_1F

	db $2 ; signs
	db $2, $1, $2 ; Route18GateHeaderText2
	db $2, $6, $3 ; Route18GateHeaderText3

	db $1 ; people
	db SPRITE_BUG_CATCHER, $2 + 4, $4 + 4, $fe, $2, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $7 ; ROUTE_18_GATE_1F

MtMoon1_h: ; 0x499bc to 0x499c8 (12 bytes) (id=59)
	db $11 ; tileset
	db MT_MOON_1_HEIGHT, MT_MOON_1_WIDTH ; dimensions (y, x)
	dw MtMoon1Blocks, MtMoon1Texts, MtMoon1Script ; blocks, texts, scripts
	db $00 ; connections

	dw MtMoon1Object ; objects

MtMoon1Script: ; 499c8 (12:59c8)
	call EnableAutoTextBoxDrawing
	ld hl, MtMoon1TrainerHeader0
	ld de, Unknown_59db
	ld a, [W_MTMOON1CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_MTMOON1CURSCRIPT], a
	ret
; 0x499db

Unknown_59db: ; 499db (12:59db)
INCBIN "baserom.gbc",$499db,$499e1 - $499db

MtMoon1Texts: ; 499e1 (12:59e1)
	dw MtMoon1Text1, MtMoon1Text2, MtMoon1Text3, MtMoon1Text4, MtMoon1Text5, MtMoon1Text6, MtMoon1Text7, Predef5CText, Predef5CText, Predef5CText, Predef5CText, Predef5CText, Predef5CText, MtMoon1Text14

MtMoon1TrainerHeaders: ; 499fd (12:59fd)
MtMoon1TrainerHeader0: ; 499fd (12:59fd)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7f5 ; flag's byte
	dw MtMoon1BattleText2 ; 0x5a98 TextBeforeBattle
	dw MtMoon1AfterBattleText2 ; 0x5aa2 TextAfterBattle
	dw MtMoon1EndBattleText2 ; 0x5a9d TextEndBattle
	dw MtMoon1EndBattleText2 ; 0x5a9d TextEndBattle
; 0x49a09

MtMoon1TrainerHeader2: ; 49a09 (12:5a09)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7f5 ; flag's byte
	dw MtMoon1BattleText3 ; 0x5aa7 TextBeforeBattle
	dw MtMoon1AfterBattleText3 ; 0x5ab1 TextAfterBattle
	dw MtMoon1EndBattleText3 ; 0x5aac TextEndBattle
	dw MtMoon1EndBattleText3 ; 0x5aac TextEndBattle
; 0x49a15

MtMoon1TrainerHeader3: ; 49a15 (12:5a15)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7f5 ; flag's byte
	dw MtMoon1BattleText4 ; 0x5ab6 TextBeforeBattle
	dw MtMoon1AfterBattleText4 ; 0x5ac0 TextAfterBattle
	dw MtMoon1EndBattleText4 ; 0x5abb TextEndBattle
	dw MtMoon1EndBattleText4 ; 0x5abb TextEndBattle
; 0x49a21

MtMoon1TrainerHeader4: ; 49a21 (12:5a21)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7f5 ; flag's byte
	dw MtMoon1BattleText5 ; 0x5ac5 TextBeforeBattle
	dw MtMoon1AfterBattleText5 ; 0x5acf TextAfterBattle
	dw MtMoon1EndBattleText5 ; 0x5aca TextEndBattle
	dw MtMoon1EndBattleText5 ; 0x5aca TextEndBattle
; 0x49a2d

MtMoon1TrainerHeader5: ; 49a2d (12:5a2d)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7f5 ; flag's byte
	dw MtMoon1BattleText6 ; 0x5ad4 TextBeforeBattle
	dw MtMoon1AfterBattleText6 ; 0x5ade TextAfterBattle
	dw MtMoon1EndBattleText6 ; 0x5ad9 TextEndBattle
	dw MtMoon1EndBattleText6 ; 0x5ad9 TextEndBattle
; 0x49a39

MtMoon1TrainerHeader6: ; 49a39 (12:5a39)
	db $6 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7f5 ; flag's byte
	dw MtMoon1BattleText7 ; 0x5ae3 TextBeforeBattle
	dw MtMoon1AfterBattleText7 ; 0x5aed TextAfterBattle
	dw MtMoon1EndBattleText7 ; 0x5ae8 TextEndBattle
	dw MtMoon1EndBattleText7 ; 0x5ae8 TextEndBattle
; 0x49a45

MtMoon1TrainerHeader7: ; 49a45 (12:5a45)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7f5 ; flag's byte
	dw MtMoon1BattleText8 ; 0x5af2 TextBeforeBattle
	dw MtMoon1AfterBattleText8 ; 0x5afc TextAfterBattle
	dw MtMoon1EndBattleText8 ; 0x5af7 TextEndBattle
	dw MtMoon1EndBattleText8 ; 0x5af7 TextEndBattle
; 0x49a51

db $ff

MtMoon1Text1: ; 49a52 (12:5a52)
	db $08 ; asm
	ld hl, MtMoon1TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

MtMoon1Text2: ; 49a5c (12:5a5c)
	db $08 ; asm
	ld hl, MtMoon1TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

MtMoon1Text3: ; 49a66 (12:5a66)
	db $08 ; asm
	ld hl, MtMoon1TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

MtMoon1Text4: ; 49a70 (12:5a70)
	db $08 ; asm
	ld hl, MtMoon1TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

MtMoon1Text5: ; 49a7a (12:5a7a)
	db $08 ; asm
	ld hl, MtMoon1TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

MtMoon1Text6: ; 49a84 (12:5a84)
	db $08 ; asm
	ld hl, MtMoon1TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

MtMoon1Text7: ; 49a8e (12:5a8e)
	db $08 ; asm
	ld hl, MtMoon1TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

MtMoon1BattleText2: ; 49a98 (12:5a98)
	TX_FAR _MtMoon1BattleText2
	db $50
; 0x49a98 + 5 bytes

MtMoon1EndBattleText2: ; 49a9d (12:5a9d)
	TX_FAR _MtMoon1EndBattleText2
	db $50
; 0x49a9d + 5 bytes

MtMoon1AfterBattleText2: ; 49aa2 (12:5aa2)
	TX_FAR _MtMoon1AfterBattleText2
	db $50
; 0x49aa2 + 5 bytes

MtMoon1BattleText3: ; 49aa7 (12:5aa7)
	TX_FAR _MtMoon1BattleText3
	db $50
; 0x49aa7 + 5 bytes

MtMoon1EndBattleText3: ; 49aac (12:5aac)
	TX_FAR _MtMoon1EndBattleText3
	db $50
; 0x49aac + 5 bytes

MtMoon1AfterBattleText3: ; 49ab1 (12:5ab1)
	TX_FAR _MtMoon1AfterBattleText3
	db $50
; 0x49ab1 + 5 bytes

MtMoon1BattleText4: ; 49ab6 (12:5ab6)
	TX_FAR _MtMoon1BattleText4
	db $50
; 0x49ab6 + 5 bytes

MtMoon1EndBattleText4: ; 49abb (12:5abb)
	TX_FAR _MtMoon1EndBattleText4
	db $50
; 0x49abb + 5 bytes

MtMoon1AfterBattleText4: ; 49ac0 (12:5ac0)
	TX_FAR _MtMoon1AfterBattleText4
	db $50
; 0x49ac0 + 5 bytes

MtMoon1BattleText5: ; 49ac5 (12:5ac5)
	TX_FAR _MtMoon1BattleText5
	db $50
; 0x49ac5 + 5 bytes

MtMoon1EndBattleText5: ; 49aca (12:5aca)
	TX_FAR _MtMoon1EndBattleText5
	db $50
; 0x49aca + 5 bytes

MtMoon1AfterBattleText5: ; 49acf (12:5acf)
	TX_FAR _MtMoon1AfterBattleText5
	db $50
; 0x49acf + 5 bytes

MtMoon1BattleText6: ; 49ad4 (12:5ad4)
	TX_FAR _MtMoon1BattleText6
	db $50
; 0x49ad4 + 5 bytes

MtMoon1EndBattleText6: ; 49ad9 (12:5ad9)
	TX_FAR _MtMoon1EndBattleText6
	db $50
; 0x49ad9 + 5 bytes

MtMoon1AfterBattleText6: ; 49ade (12:5ade)
	TX_FAR _MtMoon1AfterBattleText6
	db $50
; 0x49ade + 5 bytes

MtMoon1BattleText7: ; 49ae3 (12:5ae3)
	TX_FAR _MtMoon1BattleText7
	db $50
; 0x49ae3 + 5 bytes

MtMoon1EndBattleText7: ; 49ae8 (12:5ae8)
	TX_FAR _MtMoon1EndBattleText7
	db $50
; 0x49ae8 + 5 bytes

MtMoon1AfterBattleText7: ; 49aed (12:5aed)
	TX_FAR _MtMoon1AfterBattleText7
	db $50
; 0x49aed + 5 bytes

MtMoon1BattleText8: ; 49af2 (12:5af2)
	TX_FAR _MtMoon1BattleText8
	db $50
; 0x49af2 + 5 bytes

MtMoon1EndBattleText8: ; 49af7 (12:5af7)
	TX_FAR _MtMoon1EndBattleText8
	db $50
; 0x49af7 + 5 bytes

MtMoon1AfterBattleText8: ; 49afc (12:5afc)
	TX_FAR _MtMoon1AfterBattleText8
	db $50
; 0x49afc + 5 bytes

MtMoon1Text14: ; 49b01 (12:5b01)
	TX_FAR _MtMoon1Text14
	db $50

MtMoon1Object: ; 0x49b06 (size=145)
	db $3 ; border tile

	db $5 ; warps
	db $23, $e, $1, $ff
	db $23, $f, $1, $ff
	db $5, $5, $0, MT_MOON_2
	db $b, $11, $2, MT_MOON_2
	db $f, $19, $3, MT_MOON_2

	db $1 ; signs
	db $17, $f, $e ; MtMoon1Text14

	db $d ; people
	db SPRITE_HIKER, $6 + 4, $5 + 4, $ff, $d0, $41, HIKER + $C8, $1 ; trainer
	db SPRITE_BUG_CATCHER, $10 + 4, $c + 4, $ff, $d3, $42, YOUNGSTER + $C8, $3 ; trainer
	db SPRITE_LASS, $4 + 4, $1e + 4, $ff, $d0, $43, LASS + $C8, $5 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $1f + 4, $18 + 4, $ff, $d1, $44, SUPER_NERD + $C8, $1 ; trainer
	db SPRITE_LASS, $17 + 4, $10 + 4, $ff, $d0, $45, LASS + $C8, $6 ; trainer
	db SPRITE_BUG_CATCHER, $16 + 4, $7 + 4, $ff, $d0, $46, BUG_CATCHER + $C8, $7 ; trainer
	db SPRITE_BUG_CATCHER, $1b + 4, $1e + 4, $ff, $d3, $47, BUG_CATCHER + $C8, $8 ; trainer
	db SPRITE_BALL, $14 + 4, $2 + 4, $ff, $ff, $88, POTION ; item
	db SPRITE_BALL, $2 + 4, $2 + 4, $ff, $ff, $89, MOON_STONE ; item
	db SPRITE_BALL, $1f + 4, $23 + 4, $ff, $ff, $8a, RARE_CANDY ; item
	db SPRITE_BALL, $17 + 4, $24 + 4, $ff, $ff, $8b, ESCAPE_ROPE ; item
	db SPRITE_BALL, $21 + 4, $14 + 4, $ff, $ff, $8c, POTION ; item
	db SPRITE_BALL, $20 + 4, $5 + 4, $ff, $ff, $8d, TM_12 ; item

	; warp-to
	EVENT_DISP $14, $23, $e
	EVENT_DISP $14, $23, $f
	EVENT_DISP $14, $5, $5 ; MT_MOON_2
	EVENT_DISP $14, $b, $11 ; MT_MOON_2
	EVENT_DISP $14, $f, $19 ; MT_MOON_2

MtMoon1Blocks: ; 49b97 (12:5b97)
	INCBIN "maps/mtmoon1.blk"

MtMoon3_h: ; 0x49cff to 0x49d0b (12 bytes) (id=61)
	db $11 ; tileset
	db MT_MOON_3_HEIGHT, MT_MOON_3_WIDTH ; dimensions (y, x)
	dw MtMoon3Blocks, MtMoon3Texts, MtMoon3Script ; blocks, texts, scripts
	db $00 ; connections

	dw MtMoon3Object ; objects

MtMoon3Script: ; 49d0b (12:5d0b)
	call EnableAutoTextBoxDrawing
	ld hl, MtMoon3TrainerHeader0 ; $5e48
	ld de, Unknown_49d63 ; $5d63
	ld a, [W_MTMOON3CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_MTMOON3CURSCRIPT], a
	ld a, [$d7f6]
	bit 1, a
	ret z
	ld hl, Unknown_49d37 ; $5d37
	call ArePlayerCoordsInArray
	jr nc, .asm_49d31 ; 0x49d29 $6
	ld hl, $d72e
	set 4, [hl]
	ret
.asm_49d31
	ld hl, $d72e
	res 4, [hl]
	ret
; 0x49d37

Unknown_49d37: ; 49d37 (12:5d37)
INCBIN "baserom.gbc",$49d37,$49d58 - $49d37

; known jump sources: 49d9f (12:5d9f)
Func_49d58: ; 49d58 (12:5d58)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_MTMOON3CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_49d63: ; 49d63 (12:5d63)
INCBIN "baserom.gbc",$49d63,$49d6f - $49d63
	ld a, [$d7f6]
	bit 1, a
	jp nz, Func_49d91
	ld a, [W_YCOORD] ; $d361
	cp $8
	jp nz, Func_49d91
	ld a, [W_XCOORD] ; $d362
	cp $d
	jp nz, Func_49d91
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp DisplayTextID

; known jump sources: 49d74 (12:5d74), 49d7c (12:5d7c), 49d84 (12:5d84)
Func_49d91: ; 49d91 (12:5d91)
	ld a, [$d7f6]
	and $c0
	jp z, CheckFightingMapTrainers
	ret
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_49d58
	call UpdateSprites
	call Delay3
	ld hl, $d7f6
	set 1, [hl]
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $0
	ld [W_MTMOON3CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call SetSpriteMovementBytesToFF
	ld hl, Unknown_49dea ; $5dea
	call ArePlayerCoordsInArray
	jr c, .asm_49dd7
	ld hl, Unknown_49df1 ; $5df1
	call ArePlayerCoordsInArray
	jp nc, CheckFightingMapTrainers
	ld de, Unknown_49df9 ; $5df9
	jr .asm_49dda
.asm_49dd7
	ld de, Unknown_49df8 ; $5df8
.asm_49dda
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call MoveSprite
	ld a, $5
	ld [W_MTMOON3CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_49dea: ; 49dea (12:5dea)
INCBIN "baserom.gbc",$49dea,$49df1 - $49dea

Unknown_49df1: ; 49df1 (12:5df1)
INCBIN "baserom.gbc",$49df1,$49df8 - $49df1

Unknown_49df8: ; 49df8 (12:5df8)
INCBIN "baserom.gbc",$49df8,$49df9 - $49df8

Unknown_49df9: ; 49df9 (12:5df9)
INCBIN "baserom.gbc",$49df9,$49dfb - $49df9
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $1
	ld [$cc3c], a
	ld a, $a
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, [$d7f6]
	bit 6, a
	jr z, .asm_49e1d
	ld a, $6e
	jr .asm_49e1f
.asm_49e1d
	ld a, $6d
.asm_49e1f
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $0
	ld [W_MTMOON3CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 49e34 (12:5e34)
MtMoon3Texts: ; 49e34 (12:5e34)
	dw MtMoon3Text1, MtMoon3Text2, MtMoon3Text3, MtMoon3Text4, MtMoon3Text5, MtMoon3Text6, MtMoon3Text7, Predef5CText, Predef5CText, Unnamed_49f99

MtMoon3TrainerHeaders: ; 49e48 (12:5e48)
MtMoon3TrainerHeader0: ; 49e48 (12:5e48)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7f6 ; flag's byte
	dw MtMoon3BattleText2 ; 0x5f9f TextBeforeBattle
	dw MtMoon3AfterBattleText2 ; 0x5fa9 TextAfterBattle
	dw MtMoon3EndBattleText2 ; 0x5fa4 TextEndBattle
	dw MtMoon3EndBattleText2 ; 0x5fa4 TextEndBattle
; 0x49e54

MtMoon3TrainerHeader2: ; 49e54 (12:5e54)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7f6 ; flag's byte
	dw MtMoon3BattleText3 ; 0x5fae TextBeforeBattle
	dw MtMoon3AfterBattleText3 ; 0x5fb8 TextAfterBattle
	dw MtMoon3EndBattleText3 ; 0x5fb3 TextEndBattle
	dw MtMoon3EndBattleText3 ; 0x5fb3 TextEndBattle
; 0x49e60

MtMoon3TrainerHeader3: ; 49e60 (12:5e60)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7f6 ; flag's byte
	dw MtMoon3BattleText4 ; 0x5fbd TextBeforeBattle
	dw MtMoon3AfterBattleText4 ; 0x5fc7 TextAfterBattle
	dw MtMoon3EndBattleText4 ; 0x5fc2 TextEndBattle
	dw MtMoon3EndBattleText4 ; 0x5fc2 TextEndBattle
; 0x49e6c

MtMoon3TrainerHeader4: ; 49e6c (12:5e6c)
	db $5 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7f6 ; flag's byte
	dw MtMoon3BattleText5 ; 0x5fcc TextBeforeBattle
	dw MtMoon3AfterBattleText5 ; 0x5fd6 TextAfterBattle
	dw MtMoon3EndBattleText5 ; 0x5fd1 TextEndBattle
	dw MtMoon3EndBattleText5 ; 0x5fd1 TextEndBattle
; 0x49e78

db $ff

MtMoon3Text1: ; 49e79 (12:5e79)
	db $08 ; asm
	ld a, [$d7f6]
	bit 1, a
	jr z, .asm_be1e0 ; 0x49e7f
	and $c0
	jr nz, .asm_f8cd4 ; 0x49e83
	ld hl, UnnamedText_49f8f
	call PrintText
	jr .asm_f1fba ; 0x49e8b
.asm_be1e0 ; 0x49e8d
	ld hl, UnnamedText_49f85
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_49f8a
	ld de, UnnamedText_49f8a
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $3
	ld [W_MTMOON3CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	jr .asm_f1fba ; 0x49eb6
.asm_f8cd4 ; 0x49eb8
	ld hl, UnnamedText_49f94
	call PrintText
.asm_f1fba ; 0x49ebe
	jp TextScriptEnd

MtMoon3Text2: ; 49ec1 (12:5ec1)
	db $08 ; asm
	ld hl, MtMoon3TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

MtMoon3Text3: ; 49ecb (12:5ecb)
	db $08 ; asm
	ld hl, MtMoon3TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

MtMoon3Text4: ; 49ed5 (12:5ed5)
	db $08 ; asm
	ld hl, MtMoon3TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

MtMoon3Text5: ; 49edf (12:5edf)
	db $08 ; asm
	ld hl, MtMoon3TrainerHeader4 ; $5e6c
	call TalkToTrainer
	jp TextScriptEnd

MtMoon3Text6: ; 49ee9 (12:5ee9)
	db $08 ; asm
	ld a, $1
	ld [$cc3c], a
	ld hl, UnnamedText_49f24
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_1fa5e ; 0x49efc
	ld bc,(DOME_FOSSIL << 8) | 1
	call GiveItem
	jp nc, Unnamed_49f76
	call Unnamed_49f69
	ld a, $6d
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld hl, $d7f6
	set 6, [hl]
	ld a, $4
	ld [W_MTMOON3CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
.asm_1fa5e ; 0x49f21
	jp TextScriptEnd

UnnamedText_49f24: ; 49f24 (12:5f24)
	TX_FAR _UnnamedText_49f24
	db $50
; 0x49f24 + 5 bytes

MtMoon3Text7: ; 49f29 (12:5f29)
	db $08 ; asm
	ld a, $1
	ld [$cc3c], a
	ld hl, UnnamedText_49f64
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_8e988 ; 0x49f3c
	ld bc, (HELIX_FOSSIL << 8) | 1
	call GiveItem
	jp nc, Unnamed_49f76
	call Unnamed_49f69
	ld a, $6e
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld hl, $d7f6
	set 7, [hl]
	ld a, $4
	ld [W_MTMOON3CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
.asm_8e988 ; 0x49f61
	jp TextScriptEnd

UnnamedText_49f64: ; 49f64 (12:5f64)
	TX_FAR _UnnamedText_49f64
	db $50
; 0x49f64 + 5 bytes

Unnamed_49f69: ; 49f69 (12:5f69)
	ld hl, UnnamedText_49f6f
	jp PrintText
; 0x49f6f

UnnamedText_49f6f: ; 49f6f (12:5f6f)
	TX_FAR _UnnamedText_49f6f ; 0x80995
	db $11, $d, $50
; 0x49f76

Unnamed_49f76: ; 49f76 (12:5f76)
	ld hl, UnnamedText_49f7f
	call PrintText
	jp TextScriptEnd
; 0x49f7f

UnnamedText_49f7f: ; 49f7f (12:5f7f)
	TX_FAR _UnnamedText_49f7f ; 0x809a8
	db $d, $50
; 0x49f85

UnnamedText_49f85: ; 49f85 (12:5f85)
	TX_FAR _UnnamedText_49f85
	db $50
; 0x49f85 + 5 bytes

UnnamedText_49f8a: ; 49f8a (12:5f8a)
	TX_FAR _UnnamedText_49f8a
	db $50
; 0x49f8a + 5 bytes

UnnamedText_49f8f: ; 49f8f (12:5f8f)
	TX_FAR _UnnamedText_49f8f
	db $50
; 0x49f8f + 5 bytes

UnnamedText_49f94: ; 49f94 (12:5f94)
	TX_FAR _UnnamedText_49f94
	db $50
; 0x49f94 + 5 bytes

Unnamed_49f99: ; 49f99 (12:5f99)
INCBIN "baserom.gbc",$49f99,$49f9f - $49f99

MtMoon3BattleText2: ; 49f9f (12:5f9f)
	TX_FAR _MtMoon3BattleText2
	db $50
; 0x49f9f + 5 bytes

MtMoon3EndBattleText2: ; 49fa4 (12:5fa4)
	TX_FAR _MtMoon3EndBattleText2
	db $50
; 0x49fa4 + 5 bytes

MtMoon3AfterBattleText2: ; 49fa9 (12:5fa9)
	TX_FAR _MtMoon3AfterBattleText2
	db $50
; 0x49fa9 + 5 bytes

MtMoon3BattleText3: ; 49fae (12:5fae)
	TX_FAR _MtMoon3BattleText3
	db $50
; 0x49fae + 5 bytes

MtMoon3EndBattleText3: ; 49fb3 (12:5fb3)
	TX_FAR _MtMoon3EndBattleText3
	db $50
; 0x49fb3 + 5 bytes

MtMoon3AfterBattleText3: ; 49fb8 (12:5fb8)
	TX_FAR _MtMoon3AfterBattleText3
	db $50
; 0x49fb8 + 5 bytes

MtMoon3BattleText4: ; 49fbd (12:5fbd)
	TX_FAR _MtMoon3BattleText4
	db $50
; 0x49fbd + 5 bytes

MtMoon3EndBattleText4: ; 49fc2 (12:5fc2)
	TX_FAR _MtMoon3EndBattleText4
	db $50
; 0x49fc2 + 5 bytes

MtMoon3AfterBattleText4: ; 49fc7 (12:5fc7)
	TX_FAR _MtMoon3AfterBattleText4
	db $50
; 0x49fc7 + 5 bytes

MtMoon3BattleText5: ; 49fcc (12:5fcc)
	TX_FAR _MtMoon3BattleText5
	db $50
; 0x49fcc + 5 bytes

MtMoon3EndBattleText5: ; 49fd1 (12:5fd1)
	TX_FAR _MtMoon3EndBattleText5
	db $50
; 0x49fd1 + 5 bytes

MtMoon3AfterBattleText5: ; 49fd6 (12:5fd6)
	TX_FAR _MtMoon3AfterBattleText5
	db $50
; 0x49fd6 + 5 bytes

MtMoon3Object: ; 0x49fdb (size=102)
	db $3 ; border tile

	db $4 ; warps
	db $9, $19, $1, MT_MOON_2
	db $11, $15, $4, MT_MOON_2
	db $1b, $f, $5, MT_MOON_2
	db $7, $5, $6, MT_MOON_2

	db $0 ; signs

	db $9 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $8 + 4, $c + 4, $ff, $d3, $41, SUPER_NERD + $C8, $2 ; trainer
	db SPRITE_ROCKET, $10 + 4, $b + 4, $ff, $d0, $42, ROCKET + $C8, $1 ; trainer
	db SPRITE_ROCKET, $16 + 4, $f + 4, $ff, $d0, $43, ROCKET + $C8, $2 ; trainer
	db SPRITE_ROCKET, $b + 4, $1d + 4, $ff, $d1, $44, ROCKET + $C8, $3 ; trainer
	db SPRITE_ROCKET, $11 + 4, $1d + 4, $ff, $d2, $45, ROCKET + $C8, $4 ; trainer
	db SPRITE_OMANYTE, $6 + 4, $c + 4, $ff, $ff, $6 ; person
	db SPRITE_OMANYTE, $6 + 4, $d + 4, $ff, $ff, $7 ; person
	db SPRITE_BALL, $15 + 4, $19 + 4, $ff, $ff, $88, HP_UP ; item
	db SPRITE_BALL, $5 + 4, $1d + 4, $ff, $ff, $89, TM_01 ; item

	; warp-to
	EVENT_DISP $14, $9, $19 ; MT_MOON_2
	EVENT_DISP $14, $11, $15 ; MT_MOON_2
	EVENT_DISP $14, $1b, $f ; MT_MOON_2
	EVENT_DISP $14, $7, $5 ; MT_MOON_2

MtMoon3Blocks: ; 4a041 (12:6041)
	INCBIN "maps/mtmoon3.blk"

SafariZoneWest_h: ; 0x4a1a9 to 0x4a1b5 (12 bytes) (id=219)
	db $03 ; tileset
	db SAFARI_ZONE_WEST_HEIGHT, SAFARI_ZONE_WEST_WIDTH ; dimensions (y, x)
	dw SafariZoneWestBlocks, SafariZoneWestTexts, SafariZoneWestScript ; blocks, texts, scripts
	db $00 ; connections

	dw SafariZoneWestObject ; objects

SafariZoneWestScript: ; 4a1b5 (12:61b5)
	jp EnableAutoTextBoxDrawing
; 0x4a1b8

SafariZoneWestTexts: ; 4a1b8 (12:61b8)
	dw Predef5CText, Predef5CText, Predef5CText, Predef5CText, SafariZoneWestText5, SafariZoneWestText6, SafariZoneWestText7, SafariZoneWestText8

SafariZoneWestText5: ; 4a1c8 (12:61c8)
	TX_FAR _SafariZoneWestText5
	db $50

SafariZoneWestText6: ; 4a1cd (12:61cd)
	TX_FAR _SafariZoneWestText6
	db $50

SafariZoneWestText7: ; 4a1d2 (12:61d2)
	TX_FAR _SafariZoneWestText7
	db $50

SafariZoneWestText8: ; 4a1d7 (12:61d7)
	TX_FAR _SafariZoneWestText8
	db $50

SafariZoneWestObject: ; 0x4a1dc (size=108)
	db $0 ; border tile

	db $8 ; warps
	db $0, $14, $0, SAFARI_ZONE_NORTH
	db $0, $15, $1, SAFARI_ZONE_NORTH
	db $0, $1a, $2, SAFARI_ZONE_NORTH
	db $0, $1b, $3, SAFARI_ZONE_NORTH
	db $16, $1d, $2, SAFARI_ZONE_CENTER
	db $17, $1d, $3, SAFARI_ZONE_CENTER
	db $3, $3, $0, SAFARI_ZONE_SECRET_HOUSE
	db $b, $b, $0, SAFARI_ZONE_REST_HOUSE_2

	db $4 ; signs
	db $c, $c, $5 ; SafariZoneWestText5
	db $3, $11, $6 ; SafariZoneWestText6
	db $4, $1a, $7 ; SafariZoneWestText7
	db $16, $18, $8 ; SafariZoneWestText8

	db $4 ; people
	db SPRITE_BALL, $14 + 4, $8 + 4, $ff, $ff, $81, MAX_POTION ; item
	db SPRITE_BALL, $7 + 4, $9 + 4, $ff, $ff, $82, TM_32 ; item
	db SPRITE_BALL, $12 + 4, $12 + 4, $ff, $ff, $83, MAX_REVIVE ; item
	db SPRITE_BALL, $7 + 4, $13 + 4, $ff, $ff, $84, GOLD_TEETH ; item

	; warp-to
	EVENT_DISP $f, $0, $14 ; SAFARI_ZONE_NORTH
	EVENT_DISP $f, $0, $15 ; SAFARI_ZONE_NORTH
	EVENT_DISP $f, $0, $1a ; SAFARI_ZONE_NORTH
	EVENT_DISP $f, $0, $1b ; SAFARI_ZONE_NORTH
	EVENT_DISP $f, $16, $1d ; SAFARI_ZONE_CENTER
	EVENT_DISP $f, $17, $1d ; SAFARI_ZONE_CENTER
	EVENT_DISP $f, $3, $3 ; SAFARI_ZONE_SECRET_HOUSE
	EVENT_DISP $f, $b, $b ; SAFARI_ZONE_REST_HOUSE_2

SafariZoneWestBlocks: ; 4a248 (12:6248)
	INCBIN "maps/safarizonewest.blk"

SafariZoneSecretHouse_h: ; 0x4a30b to 0x4a317 (12 bytes) (id=222)
	db $14 ; tileset
	db SAFARI_ZONE_SECRET_HOUSE_HEIGHT, SAFARI_ZONE_SECRET_HOUSE_WIDTH ; dimensions (y, x)
	dw SafariZoneSecretHouseBlocks, SafariZoneSecretHouseTexts, SafariZoneSecretHouseScript ; blocks, texts, scripts
	db $00 ; connections

	dw SafariZoneSecretHouseObject ; objects

SafariZoneSecretHouseScript: ; 4a317 (12:6317)
	jp EnableAutoTextBoxDrawing
; 0x4a31a

SafariZoneSecretHouseTexts: ; 4a31a (12:631a)
	dw SafariZoneSecretHouseText1

SafariZoneSecretHouseText1: ; 4a31c (12:631c)
	db $08 ; asm
	ld a, [$d857]
	bit 0, a
	jr nz, .asm_20a9b ; 0x4a322
	ld hl, UnnamedText_4a350
	call PrintText
	ld bc, (HM_03 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedHM03Text
	call PrintText
	ld hl, $d857
	set 0, [hl]
	jr .asm_8f1fc ; 0x4a33d
.BagFull
	ld hl, HM03NoRoomText
	call PrintText
	jr .asm_8f1fc ; 0x4a345
.asm_20a9b ; 0x4a347
	ld hl, HM03ExplanationText
	call PrintText
.asm_8f1fc ; 0x4a34d
	jp TextScriptEnd

UnnamedText_4a350: ; 4a350 (12:6350)
	TX_FAR _UnnamedText_4a350
	db $50
; 0x4a350 + 5 bytes

ReceivedHM03Text: ; 4a355 (12:6355)
	TX_FAR _ReceivedHM03Text ; 0x85943
	db $0B, $50
; 0x4a35b

HM03ExplanationText: ; 4a35b (12:635b)
	TX_FAR _HM03ExplanationText
	db $50
; 0x4a35b + 5 bytes

HM03NoRoomText: ; 4a360 (12:6360)
	TX_FAR _HM03NoRoomText
	db $50
; 0x4a360 + 5 bytes

SafariZoneSecretHouseObject: ; 0x4a365 (size=26)
	db $17 ; border tile

	db $2 ; warps
	db $7, $2, $6, SAFARI_ZONE_WEST
	db $7, $3, $6, SAFARI_ZONE_WEST

	db $0 ; signs

	db $1 ; people
	db SPRITE_FISHER, $3 + 4, $3 + 4, $ff, $d0, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $2 ; SAFARI_ZONE_WEST
	EVENT_DISP $4, $7, $3 ; SAFARI_ZONE_WEST

SafariZoneSecretHouseBlocks: ; 4a37f (12:637f)
	INCBIN "maps/safarizonesecrethouse.blk"

SECTION "bank13",ROMX,BANK[$13]

YoungsterPic: ; 4c000 (13:4000)
	INCBIN "pic/trainer/youngster.pic"
BugCatcherPic: ; 4c0c6 (13:40c6)
	INCBIN "pic/trainer/bugcatcher.pic"
LassPic: ; 4c200 (13:4200)
	INCBIN "pic/trainer/lass.pic"
SailorPic: ; 4c2db (13:42db)
	INCBIN "pic/trainer/sailor.pic"
JrTrainerMPic: ; 4c450 (13:4450)
	INCBIN "pic/trainer/jr.trainerm.pic"
JrTrainerFPic: ; 4c588 (13:4588)
	INCBIN "pic/trainer/jr.trainerf.pic"
PokemaniacPic: ; 4c6c9 (13:46c9)
	INCBIN "pic/trainer/pokemaniac.pic"
SuperNerdPic: ; 4c7f1 (13:47f1)
	INCBIN "pic/trainer/supernerd.pic"
HikerPic: ; 4c8e7 (13:48e7)
	INCBIN "pic/trainer/hiker.pic"
BikerPic: ; 4cabe (13:4abe)
	INCBIN "pic/trainer/biker.pic"
BurglarPic: ; 4cc91 (13:4c91)
	INCBIN "pic/trainer/burglar.pic"
EngineerPic: ; 4ce0a (13:4e0a)
	INCBIN "pic/trainer/engineer.pic"
FisherPic: ; 4cf87 (13:4f87)
	INCBIN "pic/trainer/fisher.pic"
SwimmerPic: ; 4d133 (13:5133)
	INCBIN "pic/trainer/swimmer.pic"
CueBallPic: ; 4d24f (13:524f)
	INCBIN "pic/trainer/cueball.pic"
GamblerPic: ; 4d421 (13:5421)
	INCBIN "pic/trainer/gambler.pic"
BeautyPic: ; 4d5df (13:55df)
	INCBIN "pic/trainer/beauty.pic"
PsychicPic: ; 4d728 (13:5728)
	INCBIN "pic/trainer/psychic.pic"
RockerPic: ; 4d843 (13:5843)
	INCBIN "pic/trainer/rocker.pic"
JugglerPic: ; 4d97d (13:597d)
	INCBIN "pic/trainer/juggler.pic"
TamerPic: ; 4db4e (13:5b4e)
	INCBIN "pic/trainer/tamer.pic"
BirdKeeperPic: ; 4dcdb (13:5cdb)
	INCBIN "pic/trainer/birdkeeper.pic"
BlackbeltPic: ; 4de76 (13:5e76)
	INCBIN "pic/trainer/blackbelt.pic"
Rival1Pic: ; 4e049 (13:6049)
	INCBIN "pic/trainer/rival1.pic"
ProfOakPic: ; 4e15f (13:615f)
	INCBIN "pic/trainer/prof.oak.pic"
ChiefPic: ; 4e27d (13:627d)
ScientistPic: ; 4e27d (13:627d)
	INCBIN "pic/trainer/scientist.pic"
GiovanniPic: ; 4e3be (13:63be)
	INCBIN "pic/trainer/giovanni.pic"
RocketPic: ; 4e49f (13:649f)
	INCBIN "pic/trainer/rocket.pic"
CooltrainerMPic: ; 4e635 (13:6635)
	INCBIN "pic/trainer/cooltrainerm.pic"
CooltrainerFPic: ; 4e7be (13:67be)
	INCBIN "pic/trainer/cooltrainerf.pic"
BrunoPic: ; 4e943 (13:6943)
	INCBIN "pic/trainer/bruno.pic"
BrockPic: ; 4eb3e (13:6b3e)
	INCBIN "pic/trainer/brock.pic"
MistyPic: ; 4ec40 (13:6c40)
	INCBIN "pic/trainer/misty.pic"
LtSurgePic: ; 4ed30 (13:6d30)
	INCBIN "pic/trainer/lt.surge.pic"
ErikaPic: ; 4eeb5 (13:6eb5)
	INCBIN "pic/trainer/erika.pic"
KogaPic: ; 4efd6 (13:6fd6)
	INCBIN "pic/trainer/koga.pic"
BlainePic: ; 4f150 (13:7150)
	INCBIN "pic/trainer/blaine.pic"
SabrinaPic: ; 4f252 (13:7252)
	INCBIN "pic/trainer/sabrina.pic"
GentlemanPic: ; 4f3d0 (13:73d0)
	INCBIN "pic/trainer/gentleman.pic"
Rival2Pic: ; 4f4cf (13:74cf)
	INCBIN "pic/trainer/rival2.pic"
Rival3Pic: ; 4f623 (13:7623)
	INCBIN "pic/trainer/rival3.pic"
LoreleiPic: ; 4f779 (13:7779)
	INCBIN "pic/trainer/lorelei.pic"
ChannelerPic: ; 4f8a4 (13:78a4)
	INCBIN "pic/trainer/channeler.pic"
AgathaPic: ; 4fa71 (13:7a71)
	INCBIN "pic/trainer/agatha.pic"
LancePic: ; 4fba2 (13:7ba2)
	INCBIN "pic/trainer/lance.pic"

BattleCenterM_h: ; 0x4fd04 to 0x4fd10 (12 bytes) (id=239)
	db $15 ; tileset
	db BATTLE_CENTER_HEIGHT, BATTLE_CENTER_WIDTH ; dimensions (y, x)
	dw BattleCenterMBlocks, BattleCenterMTexts, BattleCenterMScript ; blocks, texts, scripts
	db $00 ; connections

	dw BattleCenterMObject ; objects

BattleCenterMScript: ; 4fd10 (13:7d10)
	call EnableAutoTextBoxDrawing
	ld a, [$ff00+$aa]
	cp $2
	ld a, $8
	jr z, .asm_4fd1d ; 0x4fd19 $2
	ld a, $c
.asm_4fd1d
	ld [$ff00+$8d], a
	ld a, $1
	ld [$ff00+$8c], a
	call Func_34ae
	ld hl, $d72d
	bit 0, [hl]
	set 0, [hl]
	ret nz
	ld hl, $c214
	ld a, $8
	ld [hli], a
	ld a, $a
	ld [hl], a
	ld a, $8
	ld [$c119], a
	ld a, [$ff00+$aa]
	cp $2
	ret z
	ld a, $7
	ld [$c215], a
	ld a, $c
	ld [$c119], a
	ret
; 0x4fd4c

BattleCenterMTexts: ; 4fd4c (13:7d4c)
	dw BattleCenterMText1

BattleCenterMText1: ; 4fd4e (13:7d4e)
	TX_FAR _BattleCenterMText1
	db $50

BattleCenterMObject: ; 0x4fd53 (size=10)
	db $e ; border tile

	db $0 ; warps

	db $0 ; signs

	db $1 ; people
	db SPRITE_RED, $2 + 4, $2 + 4, $ff, $0, $1 ; person

BattleCenterMBlocks: ; 4fd5d (13:7d5d)
	INCBIN "maps/battlecenterm.blk"

TradeCenterM_h: ; 0x4fd71 to 0x4fd7d (12 bytes) (id=240)
	db $15 ; tileset
	db TRADE_CENTER_HEIGHT, TRADE_CENTER_WIDTH ; dimensions (y, x)
	dw TradeCenterMBlocks, TradeCenterMTexts, TradeCenterMScript ; blocks, texts, scripts
	db $00 ; connections

	dw TradeCenterMObject ; objects

TradeCenterMScript: ; 4fd7d (13:7d7d)
	jp BattleCenterMScript
; 0x4fd80

TradeCenterMTexts: ; 4fd80 (13:7d80)
	dw TradeCenterMText1

TradeCenterMText1: ; 4fd82 (13:7d82)
	TX_FAR _TradeCenterMText1
	db $50

TradeCenterMObject: ; 0x4fd87 (size=10)
	db $e ; border tile

	db $0 ; warps

	db $0 ; signs

	db $1 ; people
	db SPRITE_RED, $2 + 4, $2 + 4, $ff, $0, $1 ; person

TradeCenterMBlocks: ; 4fd91 (13:7d91)
	INCBIN "maps/tradecenterm.blk"

; known jump sources: 3e59 (0:3e59)
Func_4fda5: ; 4fda5 (13:7da5)
	call EnableAutoTextBoxDrawing
	xor a
	ld [$ccd3], a
	ld a, [W_NUMINPARTY] ; $d163
	cp $6
	jr c, .asm_4fe01
	ld a, [W_NUMINBOX] ; $da80
	cp $14
	jr nc, .asm_4fdf9
	xor a
	ld [W_ENEMYBATTSTATUS3], a ; $d069
	ld a, [$cf91]
	ld [W_ENEMYMONID], a
	ld hl, Func_3eb01
	ld b, BANK(Func_3eb01)
	call Bankswitch ; indirect jump to Func_3eb01 (3eb01 (f:6b01))
	call Func_4fe11
	ld hl, Func_e7a4
	ld b, BANK(Func_e7a4)
	call Bankswitch ; indirect jump to Func_e7a4 (e7a4 (3:67a4))
	ld hl, $cf4b
	ld a, [$d5a0]
	and $7f
	cp $9
	jr c, .asm_4fdec
	sub $9
	ld [hl], $f7
	inc hl
	add $f6
	jr .asm_4fdee
.asm_4fdec
	add $f7
.asm_4fdee
	ld [hli], a
	ld [hl], $50
	ld hl, UnnamedText_4fe3f ; $7e3f
	call PrintText
	scf
	ret
.asm_4fdf9
	ld hl, UnnamedText_4fe44 ; $7e44
	call PrintText
	and a
	ret
.asm_4fe01
	call Func_4fe11
	call AddPokemonToParty
	ld a, $1
	ld [$cc3c], a
	ld [$ccd3], a
	scf
	ret

; known jump sources: 4fdcc (13:7dcc), 4fe01 (13:7e01)
Func_4fe11: ; 4fe11 (13:7e11)
	ld a, [$cf91]
	push af
	ld [$d11e], a
	ld a, $3a
	call Predef ; indirect jump to IndexToPokedex (41010 (10:5010))
	ld a, [$d11e]
	dec a
	ld c, a
	ld hl, W_OWNEDPOKEMON ; $d2f7
	ld b, $1
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	pop af
	ld [$d11e], a
	call GetMonName
	ld hl, Unknown_4fe39 ; $7e39
	jp PrintText

Unknown_4fe39: ; 4fe39 (13:7e39)
INCBIN "baserom.gbc",$4fe39,$4fe3f - $4fe39

UnnamedText_4fe3f: ; 4fe3f (13:7e3f)
	TX_FAR _UnnamedText_4fe3f
	db $50
; 0x4fe3f + 5 bytes

UnnamedText_4fe44: ; 4fe44 (13:7e44)
	TX_FAR _UnnamedText_4fe44
	db $50
; 0x4fe44 + 5 bytes

GetPredefPointer: ; 4fe49 (13:7e49)
; stores hl in $CC4F,$CC50
; stores de in $CC51,$CC52
; stores bc in $CC53,$CC54
; grabs a byte "n" from $CC4E,
;    and gets the nth (3-byte) pointer in PredefPointers
; stores the bank of said pointer in [$D0B7]
; stores the pointer in hl and returns
	; ld $CC4F,hl
	ld a,h
	ld [$CC4F],a
	ld a,l
	ld [$CC50],a

	; ld $CC51,de
	ld hl,$CC51
	ld a,d
	ld [hli],a
	ld a,e
	ld [hli],a

	; ld $CC53,bc
	ld a,b
	ld [hli],a
	ld [hl],c

	ld hl,PredefPointers
	ld de,0

	; de = 3 * [$CC4E]
	ld a,[$CC4E]
	ld e,a
	add a,a
	add a,e
	ld e,a
	jr nc,.next
	inc d

.next
	add hl,de
	ld d,h
	ld e,l

	; get bank of predef routine
	ld a,[de]
	ld [$D0B7],a

	; get pointer
	inc de
	ld a,[de]
	ld l,a
	inc de
	ld a,[de]
	ld h,a

	ret

PredefPointers: ; 4fe79 (13:7e79)
; these are pointers to ASM routines.
; they appear to be used in overworld map scripts.
	dbw BANK(Func_3cd60),Func_3cd60
	dbw BANK(Func_3f0c6),Func_3f0c6
	dbw BANK(Func_3f073),Func_3f073
	dbw BANK(ScaleSpriteByTwo), ScaleSpriteByTwo
	db BANK(LoadMonBackSprite) ; dbw macro gives an error for some reason
	dw LoadMonBackSprite
	dbw BANK(Func_79aba),Func_79aba
	dbw $03,$7132
HealPartyPredef: ; 4fe8e (13:7e8e)
	dbw BANK(HealParty),HealParty
MoveAnimationPredef: ; 4fe91 (13:7e91)
	dbw BANK(MoveAnimation),MoveAnimation; 08 play move animation
	dbw BANK(Func_f71e),Func_f71e
	dbw BANK(Func_f71e),Func_f71e
	dbw $03,$781D
	dbw $03,$7836
	dbw BANK(Func_f71e),Func_f71e
	dbw BANK(Func_f71e),Func_f71e
	db BANK(InitializePlayerData)
    dw InitializePlayerData
	dbw $03,$7666
	dbw $03,$71D7
	dbw $03,$71A6
	dbw $03,$469C
	dbw $0F,$4A83
	dbw $03,$71C8
	dbw $03,$71C8
	dbw $03,$6E9E
	db BANK(InitializePlayerData)
    dw InitializePlayerData
	dbw $03,$4754
	dbw $0E,$6F5B
	dbw $01,$6E43
	dbw $03,$78A5; 1C, used in Pokémon Tower
	dbw $03,$3EB5
	dbw $03,$3E2E
	dbw $12,$40EB
	dbw $03,$78BA
	dbw $12,$40FF
	dbw $03,$7929
	dbw $03,$79A0
	dbw $12,$4125
	dbw $03,$7A1D
	dbw $03,$79DC
	dbw $01,$5AB0
	dbw $0F,$6D02
	dbw $10,$4000
	dbw $0E,$6D1C
	dbw $1C,$778C
	dbw $0F,$6F18
	dbw $01,$5A5F
	dbw BANK(DrawBadges), DrawBadges
	dbw $10,$50F3
	dbw $1C,$496D
	dbw $1E,$5DDA
	dbw $10,$5682
	dbw $1E,$5869
	dbw $1C,$4B5D
	dbw $03,$4586
StatusScreenPredef: ; 4ff1b (13:7f1b)
	dbw BANK(StatusScreen),StatusScreen ; 37 0x12953
StatusSceren2Predef: ; 4ff1e (13:7f1e)
	dbw BANK(StatusScreen2),StatusScreen2 ; 38
	dbw $10,$50E2
	dbw $15,$690F
	dbw $10,$5010
Predef3BPredef: ; 4ff2a (13:7f2a)
	dbw BANK(Predef3B),Predef3B; 3B display pic?
	dbw $03,$6F54
	dbw $10,$42D1
	dbw $0E,$6FB8
	dbw $1C,$770A
	dbw $1C,$602B
	dbw $03,$7113
	dbw $17,$5B5E
	dbw $04,$773E
	dbw $04,$7763
	dbw $1C,$5DDF
	dbw $17,$40DC; 46 load dex screen
	dbw $03,$72E5
	dbw $03,$7A1D
	dbw $0F,$4DEC
	dbw $1C,$4F60
	dbw $09,$7D6B
	dbw $05,$7C47; 4C player exclamation
	dbw $01,$5AAF; return immediately
	dbw $01,$64EB
	dbw $0D,$7CA1
	dbw $1C,$780F
	dbw $1C,$76BD
	dbw $1C,$75E8
	dbw $1C,$77E2
Predef54Predef: ; 4ff75 (13:7f75)
	dbw BANK(Predef54),Predef54 ; 54 initiate trade
	dbw $1D,$405C
	dbw $11,$4169
	dbw $1E,$45BA
	dbw $1E,$4510
	dbw $03,$45BE
	dbw $03,$460B
	dbw $03,$4D99
	dbw $01,$4DE1
	dbw $09,$7D98
LoadMovePPsPredef:
	dbw BANK(LoadMovePPs),LoadMovePPs
DrawHPBarPredef: ; 4ff96 (13:7f96)
	dbw $04,$68EF ; 5F draw HP bar
	dbw $04,$68F6
	dbw $07,$49C6
	dbw $16,$5035

SECTION "bank14",ROMX,BANK[$14]

Route22_h: ; 0x50000 to 0x50022 (34 bytes) (id=33)
	db $00 ; tileset
	db ROUTE_22_HEIGHT, ROUTE_22_WIDTH ; dimensions (y, x)
	dw Route22Blocks, Route22Texts, Route22Script ; blocks, texts, scripts
	db NORTH | EAST ; connections

	; connections data

	db ROUTE_23
	dw Route23Blocks + (ROUTE_23_HEIGHT - 3) * ROUTE_23_WIDTH ; connection strip location
	dw $C6EB + 0 ; current map position
	db ROUTE_23_WIDTH, ROUTE_23_WIDTH ; bigness, width
	db (ROUTE_23_HEIGHT * 2) - 1, (0 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_23_HEIGHT * (ROUTE_23_WIDTH + 6) ; window

	db VIRIDIAN_CITY
	dw ViridianCityBlocks + (VIRIDIAN_CITY_WIDTH) ; connection strip location
	dw $C6E5 + (ROUTE_22_WIDTH + 6) * (-3 + 4) ; current map position
	db $f, VIRIDIAN_CITY_WIDTH ; bigness, width
	db (-4 * -2), 0 ; alignments (y, x)
	dw $C6EF + VIRIDIAN_CITY_WIDTH ; window

	; end connections data

	dw Route22Object ; objects

Route22Object: ; 0x50022 (size=27)
	db $2c ; border tile

	db $1 ; warps
	db $5, $8, $0, ROUTE_22_GATE

	db $1 ; signs
	db $b, $7, $3 ; Route22Text3

	db $2 ; people
	db SPRITE_BLUE, $5 + 4, $19 + 4, $ff, $ff, $1 ; person
	db SPRITE_BLUE, $5 + 4, $19 + 4, $ff, $ff, $2 ; person

	; warp-to
	EVENT_DISP $14, $5, $8 ; ROUTE_22_GATE

Route22Blocks: ; 5003d (14:403d)
	INCBIN "maps/route22.blk"

Route20_h: ; 0x500f1 to 0x50113 (34 bytes) (id=31)
	db $00 ; tileset
	db ROUTE_20_HEIGHT, ROUTE_20_WIDTH ; dimensions (y, x)
	dw Route20Blocks, Route20Texts, Route20Script ; blocks, texts, scripts
	db WEST | EAST ; connections

	; connections data

	db CINNABAR_ISLAND
	dw CinnabarIslandBlocks - 3 + (CINNABAR_ISLAND_WIDTH) ; connection strip location
	dw $C6E8 + (ROUTE_20_WIDTH + 6) * (0 + 3) ; current map position
	db CINNABAR_ISLAND_HEIGHT, CINNABAR_ISLAND_WIDTH ; bigness, width
	db (0 * -2), (CINNABAR_ISLAND_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * CINNABAR_ISLAND_WIDTH ; window

	db ROUTE_19
	dw Route19Blocks + (ROUTE_19_WIDTH * 15) ; connection strip location
	dw $C6E5 + (ROUTE_20_WIDTH + 6) * (-3 + 4) ; current map position
	db $c, ROUTE_19_WIDTH ; bigness, width
	db (-18 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_19_WIDTH ; window

	; end connections data

	dw Route20Object ; objects

Route20Object: ; 0x50113 (size=106)
	db $43 ; border tile

	db $2 ; warps
	db $5, $30, $0, SEAFOAM_ISLANDS_1
	db $9, $3a, $2, SEAFOAM_ISLANDS_1

	db $2 ; signs
	db $7, $33, $b ; Route20Text11
	db $b, $39, $c ; Route20Text12

	db $a ; people
	db SPRITE_SWIMMER, $8 + 4, $57 + 4, $ff, $d1, $41, SWIMMER + $C8, $9 ; trainer
	db SPRITE_SWIMMER, $b + 4, $44 + 4, $ff, $d1, $42, BEAUTY + $C8, $f ; trainer
	db SPRITE_SWIMMER, $a + 4, $2d + 4, $ff, $d0, $43, BEAUTY + $C8, $6 ; trainer
	db SPRITE_SWIMMER, $e + 4, $37 + 4, $ff, $d3, $44, JR__TRAINER_F + $C8, $18 ; trainer
	db SPRITE_SWIMMER, $d + 4, $26 + 4, $ff, $d0, $45, SWIMMER + $C8, $a ; trainer
	db SPRITE_SWIMMER, $d + 4, $57 + 4, $ff, $d1, $46, SWIMMER + $C8, $b ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $9 + 4, $22 + 4, $ff, $d1, $47, BIRD_KEEPER + $C8, $b ; trainer
	db SPRITE_SWIMMER, $7 + 4, $19 + 4, $ff, $d1, $48, BEAUTY + $C8, $7 ; trainer
	db SPRITE_SWIMMER, $c + 4, $18 + 4, $ff, $d0, $49, JR__TRAINER_F + $C8, $10 ; trainer
	db SPRITE_SWIMMER, $8 + 4, $f + 4, $ff, $d1, $4a, BEAUTY + $C8, $8 ; trainer

	; warp-to
	EVENT_DISP $32, $5, $30 ; SEAFOAM_ISLANDS_1
	EVENT_DISP $32, $9, $3a ; SEAFOAM_ISLANDS_1

Route20Blocks: ; 5017d (14:417d)
	INCBIN "maps/route20.blk"

Route23_h: ; 0x5033f to 0x50361 (34 bytes) (id=34)
	db $17 ; tileset
	db ROUTE_23_HEIGHT, ROUTE_23_WIDTH ; dimensions (y, x)
	dw Route23Blocks, Route23Texts, Route23Script ; blocks, texts, scripts
	db NORTH | SOUTH ; connections

	; connections data

	db INDIGO_PLATEAU
	dw IndigoPlateauBlocks + (INDIGO_PLATEAU_HEIGHT - 3) * INDIGO_PLATEAU_WIDTH ; connection strip location
	dw $C6EB + 0 ; current map position
	db INDIGO_PLATEAU_WIDTH, INDIGO_PLATEAU_WIDTH ; bigness, width
	db (INDIGO_PLATEAU_HEIGHT * 2) - 1, (0 * -2) ; alignments (y, x)
	dw $C6E9 + INDIGO_PLATEAU_HEIGHT * (INDIGO_PLATEAU_WIDTH + 6) ; window

	db ROUTE_22
	dw Route22Blocks ; connection strip location
	dw $C6EB + (ROUTE_23_HEIGHT + 3) * (ROUTE_23_WIDTH + 6) + 0 ; current map position
	db $d, ROUTE_22_WIDTH ; bigness, width
	db 0, (0 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_22_WIDTH ; window

	; end connections data

	dw Route23Object ; objects

Route23Object: ; 0x50361 (size=81)
	db $f ; border tile

	db $4 ; warps
	db $8b, $7, $2, ROUTE_22_GATE
	db $8b, $8, $3, ROUTE_22_GATE
	db $1f, $4, $0, VICTORY_ROAD_1
	db $1f, $e, $1, VICTORY_ROAD_2

	db $1 ; signs
	db $21, $3, $8 ; Route23Text8

	db $7 ; people
	db SPRITE_GUARD, $23 + 4, $4 + 4, $ff, $d0, $1 ; person
	db SPRITE_GUARD, $38 + 4, $a + 4, $ff, $d0, $2 ; person
	db SPRITE_SWIMMER, $55 + 4, $8 + 4, $ff, $d0, $3 ; person
	db SPRITE_SWIMMER, $60 + 4, $b + 4, $ff, $d0, $4 ; person
	db SPRITE_GUARD, $69 + 4, $c + 4, $ff, $d0, $5 ; person
	db SPRITE_GUARD, $77 + 4, $8 + 4, $ff, $d0, $6 ; person
	db SPRITE_GUARD, $88 + 4, $8 + 4, $ff, $d0, $7 ; person

	; warp-to
	EVENT_DISP $a, $8b, $7 ; ROUTE_22_GATE
	EVENT_DISP $a, $8b, $8 ; ROUTE_22_GATE
	EVENT_DISP $a, $1f, $4 ; VICTORY_ROAD_1
	EVENT_DISP $a, $1f, $e ; VICTORY_ROAD_2

Route23Blocks: ; 503b2 (14:43b2)
	INCBIN "maps/route23.blk"

Route24_h: ; 0x50682 to 0x506a4 (34 bytes) (id=35)
	db $00 ; tileset
	db ROUTE_24_HEIGHT, ROUTE_24_WIDTH ; dimensions (y, x)
	dw Route24Blocks, Route24Texts, Route24Script ; blocks, texts, scripts
	db SOUTH | EAST ; connections

	; connections data

	db CERULEAN_CITY
	dw CeruleanCityBlocks + 2 ; connection strip location
	dw $C6EB + (ROUTE_24_HEIGHT + 3) * (ROUTE_24_WIDTH + 6) + -3 ; current map position
	db $10, CERULEAN_CITY_WIDTH ; bigness, width
	db 0, (-5 * -2) ; alignments (y, x)
	dw $C6EF + CERULEAN_CITY_WIDTH ; window

	db ROUTE_25
	dw Route25Blocks + (ROUTE_25_WIDTH * 0) ; connection strip location
	dw $C6E5 + (ROUTE_24_WIDTH + 6) * (0 + 4) ; current map position
	db ROUTE_25_HEIGHT, ROUTE_25_WIDTH ; bigness, width
	db (0 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_25_WIDTH ; window

	; end connections data

	dw Route24Object ; objects

Route24Object: ; 0x506a4 (size=67)
	db $2c ; border tile

	db $0 ; warps

	db $0 ; signs

	db $8 ; people
	db SPRITE_BLACK_HAIR_BOY_1, $f + 4, $b + 4, $ff, $d2, $41, ROCKET + $C8, $6 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $14 + 4, $5 + 4, $ff, $d1, $42, JR__TRAINER_M + $C8, $2 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $13 + 4, $b + 4, $ff, $d2, $43, JR__TRAINER_M + $C8, $3 ; trainer
	db SPRITE_LASS, $16 + 4, $a + 4, $ff, $d3, $44, LASS + $C8, $7 ; trainer
	db SPRITE_BUG_CATCHER, $19 + 4, $b + 4, $ff, $d2, $45, YOUNGSTER + $C8, $4 ; trainer
	db SPRITE_LASS, $1c + 4, $a + 4, $ff, $d3, $46, LASS + $C8, $8 ; trainer
	db SPRITE_BUG_CATCHER, $1f + 4, $b + 4, $ff, $d2, $47, BUG_CATCHER + $C8, $9 ; trainer
	db SPRITE_BALL, $5 + 4, $a + 4, $ff, $ff, $88, TM_45 ; item

Route24Blocks: ; 506e7 (14:46e7)
	INCBIN "maps/route24.blk"

Route25_h: ; 0x5079b to 0x507b2 (23 bytes) (id=36)
	db $00 ; tileset
	db ROUTE_25_HEIGHT, ROUTE_25_WIDTH ; dimensions (y, x)
	dw Route25Blocks, Route25Texts, Route25Script ; blocks, texts, scripts
	db WEST ; connections

	; connections data

	db ROUTE_24
	dw Route24Blocks - 3 + (ROUTE_24_WIDTH) ; connection strip location
	dw $C6E8 + (ROUTE_25_WIDTH + 6) * (0 + 3) ; current map position
	db $c, ROUTE_24_WIDTH ; bigness, width
	db (0 * -2), (ROUTE_24_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_24_WIDTH ; window

	; end connections data

	dw Route25Object ; objects

Route25Object: ; 0x507b2 (size=94)
	db $2c ; border tile

	db $1 ; warps
	db $3, $2d, $0, BILLS_HOUSE

	db $1 ; signs
	db $3, $2b, $b ; Route25Text11

	db $a ; people
	db SPRITE_BUG_CATCHER, $2 + 4, $e + 4, $ff, $d0, $41, YOUNGSTER + $C8, $5 ; trainer
	db SPRITE_BUG_CATCHER, $5 + 4, $12 + 4, $ff, $d1, $42, YOUNGSTER + $C8, $6 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $4 + 4, $18 + 4, $ff, $d0, $43, JR__TRAINER_M + $C8, $2 ; trainer
	db SPRITE_LASS, $8 + 4, $12 + 4, $ff, $d3, $44, LASS + $C8, $9 ; trainer
	db SPRITE_BUG_CATCHER, $3 + 4, $20 + 4, $ff, $d2, $45, YOUNGSTER + $C8, $7 ; trainer
	db SPRITE_LASS, $4 + 4, $25 + 4, $ff, $d0, $46, LASS + $C8, $a ; trainer
	db SPRITE_HIKER, $4 + 4, $8 + 4, $ff, $d3, $47, HIKER + $C8, $2 ; trainer
	db SPRITE_HIKER, $9 + 4, $17 + 4, $ff, $d1, $48, HIKER + $C8, $3 ; trainer
	db SPRITE_HIKER, $7 + 4, $d + 4, $ff, $d3, $49, HIKER + $C8, $4 ; trainer
	db SPRITE_BALL, $2 + 4, $16 + 4, $ff, $ff, $8a, TM_19 ; item

	; warp-to
	EVENT_DISP $1e, $3, $2d ; BILLS_HOUSE

Route25Blocks: ; 50810 (14:4810)
	INCBIN "maps/route25.blk"

IndigoPlateau_h: ; 0x5091e to 0x50935 (23 bytes) (id=9)
	db $17 ; tileset
	db INDIGO_PLATEAU_HEIGHT, INDIGO_PLATEAU_WIDTH ; dimensions (y, x)
	dw IndigoPlateauBlocks, IndigoPlateauTexts, IndigoPlateauScript ; blocks, texts, scripts
	db SOUTH ; connections

	; connections data

	db ROUTE_23
	dw Route23Blocks ; connection strip location
	dw $C6EB + (INDIGO_PLATEAU_HEIGHT + 3) * (INDIGO_PLATEAU_WIDTH + 6) + 0 ; current map position
	db ROUTE_23_WIDTH, ROUTE_23_WIDTH ; bigness, width
	db 0, (0 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_23_WIDTH ; window

	; end connections data

	dw IndigoPlateauObject ; objects

IndigoPlateauScript: ; 50935 (14:4935)
	ret
; 0x50936

IndigoPlateauTexts: ; 50936 (14:4936)
IndigoPlateauObject: ; 0x50936 (size=20)
	db $e ; border tile

	db $2 ; warps
	db $5, $9, $0, INDIGO_PLATEAU_LOBBY
	db $5, $a, $0, INDIGO_PLATEAU_LOBBY

	db $0 ; signs

	db $0 ; people

	; warp-to
	EVENT_DISP $a, $5, $9 ; INDIGO_PLATEAU_LOBBY
	EVENT_DISP $a, $5, $a ; INDIGO_PLATEAU_LOBBY

IndigoPlateauBlocks: ; 5094a (14:494a)
	INCBIN "maps/indigoplateau.blk"

SaffronCity_h: ; 0x509a4 to 0x509dc (56 bytes) (id=10)
	db $00 ; tileset
	db SAFFRON_CITY_HEIGHT, SAFFRON_CITY_WIDTH ; dimensions (y, x)
	dw SaffronCityBlocks, SaffronCityTexts, SaffronCityScript ; blocks, texts, scripts
	db NORTH | SOUTH | WEST | EAST ; connections

	; connections data

	db ROUTE_5
	dw Route5Blocks + (ROUTE_5_HEIGHT - 3) * ROUTE_5_WIDTH ; connection strip location
	dw $C6EB + 5 ; current map position
	db ROUTE_5_WIDTH, ROUTE_5_WIDTH ; bigness, width
	db (ROUTE_5_HEIGHT * 2) - 1, (5 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_5_HEIGHT * (ROUTE_5_WIDTH + 6) ; window

	db ROUTE_6
	dw Route6Blocks ; connection strip location
	dw $C6EB + (SAFFRON_CITY_HEIGHT + 3) * (SAFFRON_CITY_WIDTH + 6) + 5 ; current map position
	db ROUTE_6_WIDTH, ROUTE_6_WIDTH ; bigness, width
	db 0, (5 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_6_WIDTH ; window

	db ROUTE_7
	dw Route7Blocks - 3 + (ROUTE_7_WIDTH) ; connection strip location
	dw $C6E8 + (SAFFRON_CITY_WIDTH + 6) * (4 + 3) ; current map position
	db ROUTE_7_HEIGHT, ROUTE_7_WIDTH ; bigness, width
	db (4 * -2), (ROUTE_7_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_7_WIDTH ; window

	db ROUTE_8
	dw Route8Blocks + (ROUTE_8_WIDTH * 0) ; connection strip location
	dw $C6E5 + (SAFFRON_CITY_WIDTH + 6) * (4 + 4) ; current map position
	db ROUTE_8_HEIGHT, ROUTE_8_WIDTH ; bigness, width
	db (4 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_8_WIDTH ; window

	; end connections data

	dw SaffronCityObject ; objects

SaffronCityObject: ; 0x509dc (size=188)
	db $f ; border tile

	db $8 ; warps
	db $5, $7, $0, COPYCATS_HOUSE_1F
	db $3, $1a, $0, FIGHTINGDOJO
	db $3, $22, $0, SAFFRON_GYM
	db $b, $d, $0, SAFFRON_HOUSE_1
	db $b, $19, $0, SAFFRON_MART
	db $15, $12, $0, SILPH_CO_1F
	db $1d, $9, $0, SAFFRON_POKECENTER
	db $1d, $1d, $0, SAFFRON_HOUSE_2

	db $a ; signs
	db $5, $11, $10 ; SaffronCityText16
	db $5, $1b, $11 ; SaffronCityText17
	db $5, $23, $12 ; SaffronCityText18
	db $b, $1a, $13 ; MartSignText
	db $13, $27, $14 ; SaffronCityText20
	db $15, $5, $15 ; SaffronCityText21
	db $15, $f, $16 ; SaffronCityText22
	db $1d, $a, $17 ; PokeCenterSignText
	db $1d, $1b, $18 ; SaffronCityText24
	db $13, $1, $19 ; SaffronCityText25

	db $f ; people
	db SPRITE_ROCKET, $6 + 4, $7 + 4, $ff, $ff, $1 ; person
	db SPRITE_ROCKET, $8 + 4, $14 + 4, $fe, $2, $2 ; person
	db SPRITE_ROCKET, $4 + 4, $22 + 4, $ff, $ff, $3 ; person
	db SPRITE_ROCKET, $c + 4, $d + 4, $ff, $ff, $4 ; person
	db SPRITE_ROCKET, $19 + 4, $b + 4, $fe, $2, $5 ; person
	db SPRITE_ROCKET, $d + 4, $20 + 4, $fe, $2, $6 ; person
	db SPRITE_ROCKET, $1e + 4, $12 + 4, $fe, $2, $7 ; person
	db SPRITE_OAK_AIDE, $e + 4, $8 + 4, $fe, $0, $8 ; person
	db SPRITE_LAPRAS_GIVER, $17 + 4, $17 + 4, $ff, $ff, $9 ; person
	db SPRITE_ERIKA, $1e + 4, $11 + 4, $fe, $2, $a ; person
	db SPRITE_GENTLEMAN, $c + 4, $1e + 4, $ff, $d0, $b ; person
	db SPRITE_BIRD, $c + 4, $1f + 4, $ff, $d0, $c ; person
	db SPRITE_ROCKER, $8 + 4, $12 + 4, $ff, $d1, $d ; person
	db SPRITE_ROCKET, $16 + 4, $12 + 4, $ff, $d0, $e ; person
	db SPRITE_ROCKET, $16 + 4, $13 + 4, $ff, $d0, $f ; person

	; warp-to
	EVENT_DISP $14, $5, $7 ; COPYCATS_HOUSE_1F
	EVENT_DISP $14, $3, $1a ; FIGHTINGDOJO
	EVENT_DISP $14, $3, $22 ; SAFFRON_GYM
	EVENT_DISP $14, $b, $d ; SAFFRON_HOUSE_1
	EVENT_DISP $14, $b, $19 ; SAFFRON_MART
	EVENT_DISP $14, $15, $12 ; SILPH_CO_1F
	EVENT_DISP $14, $1d, $9 ; SAFFRON_POKECENTER
	EVENT_DISP $14, $1d, $1d ; SAFFRON_HOUSE_2

SaffronCityBlocks: ; 50a98 (14:4a98)
	INCBIN "maps/saffroncity.blk"

SaffronCityScript: ; 50c00 (14:4c00)
	jp EnableAutoTextBoxDrawing
; 0x50c03

SaffronCityTexts: ; 50c03 (14:4c03)
	dw SaffronCityText1, SaffronCityText2, SaffronCityText3, SaffronCityText4, SaffronCityText5, SaffronCityText6, SaffronCityText7, SaffronCityText8, SaffronCityText9, SaffronCityText10, SaffronCityText11, SaffronCityText12, SaffronCityText13, SaffronCityText14, SaffronCityText15, SaffronCityText16, SaffronCityText17, SaffronCityText18, MartSignText, SaffronCityText20, SaffronCityText21, SaffronCityText22, PokeCenterSignText, SaffronCityText24, SaffronCityText25

SaffronCityText1: ; 50c35 (14:4c35)
	TX_FAR _SaffronCityText1
	db $50

SaffronCityText2: ; 50c3a (14:4c3a)
	TX_FAR _SaffronCityText2
	db $50

SaffronCityText3: ; 50c3f (14:4c3f)
	TX_FAR _SaffronCityText3
	db $50

SaffronCityText4: ; 50c44 (14:4c44)
	TX_FAR _SaffronCityText4
	db $50

SaffronCityText5: ; 50c49 (14:4c49)
	TX_FAR _SaffronCityText5
	db $50

SaffronCityText6: ; 50c4e (14:4c4e)
	TX_FAR _SaffronCityText6
	db $50

SaffronCityText7: ; 50c53 (14:4c53)
	TX_FAR _SaffronCityText7
	db $50

SaffronCityText8: ; 50c58 (14:4c58)
	TX_FAR _SaffronCityText8
	db $50

SaffronCityText9: ; 50c5d (14:4c5d)
	TX_FAR _SaffronCityText9
	db $50

SaffronCityText10: ; 50c62 (14:4c62)
	TX_FAR _SaffronCityText10
	db $50

SaffronCityText11: ; 50c67 (14:4c67)
	TX_FAR _SaffronCityText11
	db $50

SaffronCityText12: ; 50c6c (14:4c6c)
	TX_FAR _SaffronCityText12
	db $15, $50

SaffronCityText13: ; 50c72 (14:4c72)
	TX_FAR _SaffronCityText13
	db $50

SaffronCityText14: ; 50c77 (14:4c77)
	TX_FAR _SaffronCityText14
	db $50

SaffronCityText15: ; 50c7c (14:4c7c)
	TX_FAR _SaffronCityText15
	db $50

SaffronCityText16: ; 50c81 (14:4c81)
	TX_FAR _SaffronCityText16
	db $50

SaffronCityText17: ; 50c86 (14:4c86)
	TX_FAR _SaffronCityText17
	db $50

SaffronCityText18: ; 50c8b (14:4c8b)
	TX_FAR _SaffronCityText18
	db $50

SaffronCityText20: ; 50c90 (14:4c90)
	TX_FAR _SaffronCityText20
	db $50

SaffronCityText21: ; 50c95 (14:4c95)
	TX_FAR _SaffronCityText21
	db $50

SaffronCityText22: ; 50c9a (14:4c9a)
	TX_FAR _SaffronCityText22
	db $50

SaffronCityText24: ; 50c9f (14:4c9f)
	TX_FAR _SaffronCityText24
	db $50

SaffronCityText25: ; 50ca4 (14:4ca4)
	TX_FAR _SaffronCityText25
	db $50

Route20Script: ; 50ca9 (14:4ca9)
	ld hl, $d7e7
	bit 0, [hl]
	res 0, [hl]
	call nz, Func_50cc6
	call EnableAutoTextBoxDrawing
	ld hl, Route20TrainerHeader0 ; $4d3a
	ld de, Unknown_50d1c ; $4d1c
	ld a, [W_ROUTE20CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE20CURSCRIPT], a
	ret
; 0x50cc6

; known jump sources: 50cb0 (14:4cb0)
Func_50cc6: ; 50cc6 (14:4cc6)
	ld a, [$d880]
	and $3
	cp $3
	jr z, .asm_50cef
	ld a, $d7
	call Func_50d0c
	ld a, $d8
	call Func_50d0c
	ld hl, .unknown_50ce8 ; $4ce8
.asm_50cdc
	ld a, [hli]
	cp $ff
	jr z, .asm_50cef
	push hl
	call Func_50d14
	pop hl
	jr .asm_50cdc

.unknown_50ce8: ; 50ce8 (14:4ce8)
INCBIN "baserom.gbc",$50ce8,$50cef - $50ce8

.asm_50cef
	ld a, [$d881]
	and $3
	cp $3
	ret z
	ld a, $dd
	call Func_50d0c
	ld a, $de
	call Func_50d0c
	ld a, $e1
	call Func_50d14
	ld a, $e2
	call Func_50d14
	ret

; known jump sources: 50cd1 (14:4cd1), 50cd6 (14:4cd6), 50cf9 (14:4cf9), 50cfe (14:4cfe)
Func_50d0c: ; 50d0c (14:4d0c)
	ld [$cc4d], a
	ld a, $15
	jp Predef ; indirect jump to AddMissableObject (f1c8 (3:71c8))

; known jump sources: 50ce2 (14:4ce2), 50d03 (14:4d03), 50d08 (14:4d08)
Func_50d14: ; 50d14 (14:4d14)
	ld [$cc4d], a
	ld a, $11
	jp Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))

Unknown_50d1c: ; 50d1c (14:4d1c)
INCBIN "baserom.gbc",$50d1c,$50d22 - $50d1c

Route20Texts: ; 50d22 (14:4d22)
	dw Route20Text1, Route20Text2, Route20Text3, Route20Text4, Route20Text5, Route20Text6, Route20Text7, Route20Text8, Route20Text9, Route20Text10, Route20Text11, Route20Text12

Route20TrainerHeaders: ; 50d3a (14:4d3a)
Route20TrainerHeader0: ; 50d3a (14:4d3a)
	db $1 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e7 ; flag's byte
	dw Route20BattleText1 ; 0x4e17 TextBeforeBattle
	dw Route20AfterBattleText1 ; 0x4e21 TextAfterBattle
	dw Route20EndBattleText1 ; 0x4e1c TextEndBattle
	dw Route20EndBattleText1 ; 0x4e1c TextEndBattle
; 0x50d46

Route20TrainerHeader2: ; 50d46 (14:4d46)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e7 ; flag's byte
	dw Route20BattleText2 ; 0x4e26 TextBeforeBattle
	dw Route20AfterBattleText2 ; 0x4e30 TextAfterBattle
	dw Route20EndBattleText2 ; 0x4e2b TextEndBattle
	dw Route20EndBattleText2 ; 0x4e2b TextEndBattle
; 0x50d52

Route20TrainerHeader3: ; 50d52 (14:4d52)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7e7 ; flag's byte
	dw Route20BattleText3 ; 0x4e35 TextBeforeBattle
	dw Route20AfterBattleText3 ; 0x4e3f TextAfterBattle
	dw Route20EndBattleText3 ; 0x4e3a TextEndBattle
	dw Route20EndBattleText3 ; 0x4e3a TextEndBattle
; 0x50d5e

Route20TrainerHeader4: ; 50d5e (14:4d5e)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e7 ; flag's byte
	dw Route20BattleText4 ; 0x4e44 TextBeforeBattle
	dw Route20AfterBattleText4 ; 0x4e4e TextAfterBattle
	dw Route20EndBattleText4 ; 0x4e49 TextEndBattle
	dw Route20EndBattleText4 ; 0x4e49 TextEndBattle
; 0x50d6a

Route20TrainerHeader5: ; 50d6a (14:4d6a)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e7 ; flag's byte
	dw Route20BattleText5 ; 0x4e53 TextBeforeBattle
	dw Route20AfterBattleText5 ; 0x4e5d TextAfterBattle
	dw Route20EndBattleText5 ; 0x4e58 TextEndBattle
	dw Route20EndBattleText5 ; 0x4e58 TextEndBattle
; 0x50d76

Route20TrainerHeader6: ; 50d76 (14:4d76)
	db $6 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e7 ; flag's byte
	dw Route20BattleText6 ; 0x4e62 TextBeforeBattle
	dw Route20AfterBattleText6 ; 0x4e6c TextAfterBattle
	dw Route20EndBattleText6 ; 0x4e67 TextEndBattle
	dw Route20EndBattleText6 ; 0x4e67 TextEndBattle
; 0x50d82

Route20TrainerHeader7: ; 50d82 (14:4d82)
	db $7 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7e7 ; flag's byte
	dw Route20BattleText7 ; 0x4e71 TextBeforeBattle
	dw Route20AfterBattleText7 ; 0x4e7b TextAfterBattle
	dw Route20EndBattleText7 ; 0x4e76 TextEndBattle
	dw Route20EndBattleText7 ; 0x4e76 TextEndBattle
; 0x50d8e

Route20TrainerHeader8: ; 50d8e (14:4d8e)
	db $8 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e7 ; flag's byte
	dw Route20BattleText8 ; 0x4e80 TextBeforeBattle
	dw Route20AfterBattleText8 ; 0x4e8a TextAfterBattle
	dw Route20EndBattleText8 ; 0x4e85 TextEndBattle
	dw Route20EndBattleText8 ; 0x4e85 TextEndBattle
; 0x50d9a

Route20TrainerHeader9: ; 50d9a (14:4d9a)
	db $9 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e7 ; flag's byte
	dw Route20BattleText9 ; 0x4e8f TextBeforeBattle
	dw Route20AfterBattleText9 ; 0x4e99 TextAfterBattle
	dw Route20EndBattleText9 ; 0x4e94 TextEndBattle
	dw Route20EndBattleText9 ; 0x4e94 TextEndBattle
; 0x50da6

Route20TrainerHeader10: ; 50da6 (14:4da6)
	db $a ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e7 ; flag's byte
	dw Route20BattleText10 ; 0x4e9e TextBeforeBattle
	dw Route20AfterBattleText10 ; 0x4ea8 TextAfterBattle
	dw Route20EndBattleText10 ; 0x4ea3 TextEndBattle
	dw Route20EndBattleText10 ; 0x4ea3 TextEndBattle
; 0x50db2

db $ff

Route20Text1: ; 50db3 (14:4db3)
	db $08 ; asm
	ld hl, Route20TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route20Text2: ; 50dbd (14:4dbd)
	db $08 ; asm
	ld hl, Route20TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route20Text3: ; 50dc7 (14:4dc7)
	db $08 ; asm
	ld hl, Route20TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route20Text4: ; 50dd1 (14:4dd1)
	db $08 ; asm
	ld hl, Route20TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route20Text5: ; 50ddb (14:4ddb)
	db $08 ; asm
	ld hl, Route20TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route20Text6: ; 50de5 (14:4de5)
	db $08 ; asm
	ld hl, Route20TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route20Text7: ; 50def (14:4def)
	db $08 ; asm
	ld hl, Route20TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

Route20Text8: ; 50df9 (14:4df9)
	db $08 ; asm
	ld hl, Route20TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

Route20Text9: ; 50e03 (14:4e03)
	db $08 ; asm
	ld hl, Route20TrainerHeader9
	call TalkToTrainer
	jp TextScriptEnd

Route20Text10: ; 50e0d (14:4e0d)
	db $08 ; asm
	ld hl, Route20TrainerHeader10
	call TalkToTrainer
	jp TextScriptEnd

Route20BattleText1: ; 50e17 (14:4e17)
	TX_FAR _Route20BattleText1
	db $50
; 0x50e17 + 5 bytes

Route20EndBattleText1: ; 50e1c (14:4e1c)
	TX_FAR _Route20EndBattleText1
	db $50
; 0x50e1c + 5 bytes

Route20AfterBattleText1: ; 50e21 (14:4e21)
	TX_FAR _Route20AfterBattleText1
	db $50
; 0x50e21 + 5 bytes

Route20BattleText2: ; 50e26 (14:4e26)
	TX_FAR _Route20BattleText2
	db $50
; 0x50e26 + 5 bytes

Route20EndBattleText2: ; 50e2b (14:4e2b)
	TX_FAR _Route20EndBattleText2
	db $50
; 0x50e2b + 5 bytes

Route20AfterBattleText2: ; 50e30 (14:4e30)
	TX_FAR _Route20AfterBattleText2
	db $50
; 0x50e30 + 5 bytes

Route20BattleText3: ; 50e35 (14:4e35)
	TX_FAR _Route20BattleText3
	db $50
; 0x50e35 + 5 bytes

Route20EndBattleText3: ; 50e3a (14:4e3a)
	TX_FAR _Route20EndBattleText3
	db $50
; 0x50e3a + 5 bytes

Route20AfterBattleText3: ; 50e3f (14:4e3f)
	TX_FAR _Route20AfterBattleText3
	db $50
; 0x50e3f + 5 bytes

Route20BattleText4: ; 50e44 (14:4e44)
	TX_FAR _Route20BattleText4
	db $50
; 0x50e44 + 5 bytes

Route20EndBattleText4: ; 50e49 (14:4e49)
	TX_FAR _Route20EndBattleText4
	db $50
; 0x50e49 + 5 bytes

Route20AfterBattleText4: ; 50e4e (14:4e4e)
	TX_FAR _Route20AfterBattleText4
	db $50
; 0x50e4e + 5 bytes

Route20BattleText5: ; 50e53 (14:4e53)
	TX_FAR _Route20BattleText5
	db $50
; 0x50e53 + 5 bytes

Route20EndBattleText5: ; 50e58 (14:4e58)
	TX_FAR _Route20EndBattleText5
	db $50
; 0x50e58 + 5 bytes

Route20AfterBattleText5: ; 50e5d (14:4e5d)
	TX_FAR _Route20AfterBattleText5
	db $50
; 0x50e5d + 5 bytes

Route20BattleText6: ; 50e62 (14:4e62)
	TX_FAR _Route20BattleText6
	db $50
; 0x50e62 + 5 bytes

Route20EndBattleText6: ; 50e67 (14:4e67)
	TX_FAR _Route20EndBattleText6
	db $50
; 0x50e67 + 5 bytes

Route20AfterBattleText6: ; 50e6c (14:4e6c)
	TX_FAR _Route20AfterBattleText6
	db $50
; 0x50e6c + 5 bytes

Route20BattleText7: ; 50e71 (14:4e71)
	TX_FAR _Route20BattleText7
	db $50
; 0x50e71 + 5 bytes

Route20EndBattleText7: ; 50e76 (14:4e76)
	TX_FAR _Route20EndBattleText7
	db $50
; 0x50e76 + 5 bytes

Route20AfterBattleText7: ; 50e7b (14:4e7b)
	TX_FAR _Route20AfterBattleText7
	db $50
; 0x50e7b + 5 bytes

Route20BattleText8: ; 50e80 (14:4e80)
	TX_FAR _Route20BattleText8
	db $50
; 0x50e80 + 5 bytes

Route20EndBattleText8: ; 50e85 (14:4e85)
	TX_FAR _Route20EndBattleText8
	db $50
; 0x50e85 + 5 bytes

Route20AfterBattleText8: ; 50e8a (14:4e8a)
	TX_FAR _Route20AfterBattleText8
	db $50
; 0x50e8a + 5 bytes

Route20BattleText9: ; 50e8f (14:4e8f)
	TX_FAR _Route20BattleText9
	db $50
; 0x50e8f + 5 bytes

Route20EndBattleText9: ; 50e94 (14:4e94)
	TX_FAR _Route20EndBattleText9
	db $50
; 0x50e94 + 5 bytes

Route20AfterBattleText9: ; 50e99 (14:4e99)
	TX_FAR _Route20AfterBattleText9
	db $50
; 0x50e99 + 5 bytes

Route20BattleText10: ; 50e9e (14:4e9e)
	TX_FAR _Route20BattleText10
	db $50
; 0x50e9e + 5 bytes

Route20EndBattleText10: ; 50ea3 (14:4ea3)
	TX_FAR _Route20EndBattleText10
	db $50
; 0x50ea3 + 5 bytes

Route20AfterBattleText10: ; 50ea8 (14:4ea8)
	TX_FAR _Route20AfterBattleText10
	db $50
; 0x50ea8 + 5 bytes

Route20Text12: ; 50ead (14:4ead)
Route20Text11: ; 50ead (14:4ead)
	TX_FAR _Route20Text11
	db $50

Route22Script: ; 50eb2 (14:4eb2)
	call EnableAutoTextBoxDrawing
	ld hl, Route22Scripts
	ld a, [W_ROUTE22CURSCRIPT]
	jp CallFunctionInTable
; 0x50ebe

Route22Scripts: ; 50ebe (14:4ebe)
	dw Route22Script0, Route22Script1, Route22Script2, Route22Script3

INCBIN "baserom.gbc",$50ec6,$50ece - $50ec6

; known jump sources: 510e4 (14:50e4)
Func_50ece: ; 50ece (14:4ece)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_ROUTE22CURSCRIPT], a
	ret

; known jump sources: 510d0 (14:50d0)
Func_50ed6: ; 50ed6 (14:4ed6)
	ld a, [W_RIVALSTARTER] ; $d715
	ld b, a
.asm_50eda
	ld a, [hli]
	cp b
	jr z, .asm_50ee1
	inc hl
	jr .asm_50eda
.asm_50ee1
	ld a, [hl]
	ld [W_TRAINERNO], a ; $d05d
	ret

; known jump sources: 50f59 (14:4f59), 5107e (14:507e)
Func_50ee6: ; 50ee6 (14:4ee6)
	ld de, Unknown_50efb ; $4efb
	ld a, [$cf0d]
	cp $1
	jr z, .asm_50ef1
	inc de
.asm_50ef1
	call MoveSprite
	ld a, $c
	ld [$FF00+$8d], a
	jp Func_34a6

Unknown_50efb: ; 50efb (14:4efb)
INCBIN "baserom.gbc",$50efb,$50f00 - $50efb

Route22Script0: ; 50f00 (14:4f00)
	ld a, [$d7eb]
	bit 7, a
	ret z
	ld hl, .unknown_50f2d ; $4f2d
	call ArePlayerCoordsInArray
	ret nc
	ld a, [$cd3d]
	ld [$cf0d], a
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $2
	ld [$d528], a
	ld a, [$d7eb]
	bit 0, a
	jr nz, .asm_50f32 ; 0x50f25 $b
	bit 1, a
	jp nz, Func_5104e
	ret

.unknown_50f2d
	db $04, $1D
	db $05, $1D
	db $FF

.asm_50f32
	ld a, $1
	ld [$cd4f], a
	xor a
	ld [$cd50], a
	ld a, $4c
	call Predef
	ld a, [$d700]
	and a
	jr z, .asm_50f4e ; 0x50f44 $8
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
.asm_50f4e
	ld c, $2
	ld a, $de
	call PlayMusic
	ld a, $1
	ld [$ff00+$8c], a
	call Func_50ee6
	ld a, $1
	ld [W_ROUTE22CURSCRIPT], a
	ret
; 0x50f62

Route22Script1: ; 50f62 (14:4f62)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, [$cf0d]
	cp $1
	jr nz, .asm_50f78 ; 0x50f6d $9
	ld a, $4
	ld [$d528], a
	ld a, $4
	jr .asm_50f7a ; 0x50f76 $2
.asm_50f78
	ld a, $c
.asm_50f7a
	ld [$ff00+$8d], a
	ld a, $1
	ld [$ff00+$8c], a
	call Func_34a6
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $1
	ld [$ff00+$8c], a
	call DisplayTextID
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_511b7
	ld de, UnnamedText_511bc
	call PreBattleSaveRegisters
	ld a, $e1
	ld [$d059], a
	ld hl, Unknown_50faf ; $4faf
	call Func_50ed6
	ld a, $2
	ld [W_ROUTE22CURSCRIPT], a
	ret
; 0x50faf

Unknown_50faf: ; 50faf (14:4faf)
INCBIN "baserom.gbc",$50faf,$50fb5 - $50faf

Route22Script2: ; 50fb5 (14:4fb5)
	ld a, [$d057]
	cp $ff
	jp z, Func_50ece
	ld a, [$c109]
	and a
	jr nz, .asm_50fc7 ; 0x50fc1 $4
	ld a, $4
	jr .asm_50fc9 ; 0x50fc5 $2
.asm_50fc7
	ld a, $c
.asm_50fc9
	ld [$ff00+$8d], a
	ld a, $1
	ld [$ff00+$8c], a
	call Func_34a6
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d7eb
	set 5, [hl]
	ld a, $1
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld b, BANK(Func_9b47)
	ld hl, Func_9b47
	call Bankswitch
	ld a, [$cf0d]
	cp $1
	jr nz, .asm_50fff ; 0x50ff8 $5
	call Func_51008
	jr .asm_51002 ; 0x50ffd $3
.asm_50fff
	call Func_5100d
.asm_51002
	ld a, $3
	ld [W_ROUTE22CURSCRIPT], a
	ret
; 0x51008

Func_51008: ; 51008 (14:5008)
	ld de, Unknown_51017 ; $5017
	jr asm_51010

Func_5100d: ; 5100d (14:500d)
	ld de, Unknown_5101f ; $501f
asm_51010
	ld a, $1
	ld [H_SPRITEHEIGHT], a
	jp MoveSprite
; 0x51017

Unknown_51017: ; 51017 (14:5017)
INCBIN "baserom.gbc",$51017,$5101f - $51017

Unknown_5101f: ; 5101f (14:501f)
INCBIN "baserom.gbc",$5101f,$5102a - $5101f

Route22Script3: ; 5102a (14:502a)
	ld a, [$d730]
	bit 0, a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $22
	ld [$cc4d], a
	ld a, $11
	call Predef
	call Func_2307
	ld hl, $d7eb
	res 0, [hl]
	res 7, [hl]
	ld a, $0
	ld [W_ROUTE22CURSCRIPT], a
	ret
; 0x5104e

; known jump sources: 50f29 (14:4f29)
Func_5104e: ; 5104e (14:504e)
	ld a, $2
	ld [$cd4f], a
	xor a
	ld [$cd50], a
	ld a, $4c
	call Predef ; indirect jump to Func_17c47 (17c47 (5:7c47))
	ld a, [$d700]
	and a
	jr z, .skipYVisibilityTesta
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
.skipYVisibilityTesta
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld b, BANK(Func_9b65)
	ld hl, Func_9b65
	call Bankswitch ; indirect jump to Func_9b65 (9b65 (2:5b65))
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call Func_50ee6
	ld a, $4
	ld [W_ROUTE22CURSCRIPT], a
	ret
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	ld a, [$cf0d]
	cp $1
	jr nz, .asm_510a1
	ld a, $4
	ld [$d528], a
	ld a, $4
	jr .asm_510a8
.asm_510a1
	ld a, $2
	ld [$d528], a
	ld a, $c
.asm_510a8
	ld [$FF00+$8d], a
	call Func_34a6
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_511cb ; $51cb
	ld de, UnnamedText_511d0 ; $51d0
	call PreBattleSaveRegisters
	ld a, $f2
	ld [W_CUROPPONENT], a ; $d059
	ld hl, Unknown_510d9 ; $50d9
	call Func_50ed6
	ld a, $5
	ld [W_ROUTE22CURSCRIPT], a
	ret

Unknown_510d9: ; 510d9 (14:50d9)
INCBIN "baserom.gbc",$510d9,$510df - $510d9
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_50ece
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	ld a, [$cf0d]
	cp $1
	jr nz, .asm_510fb
	ld a, $4
	ld [$d528], a
	ld a, $4
	jr .asm_51102
.asm_510fb
	ld a, $2
	ld [$d528], a
	ld a, $c
.asm_51102
	ld [$FF00+$8d], a
	call Func_34a6
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d7eb
	set 6, [hl]
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld b, BANK(Func_9b75)
	ld hl, Func_9b75
	call Bankswitch ; indirect jump to Func_9b75 (9b75 (2:5b75))
	ld a, [$cf0d]
	cp $1
	jr nz, .asm_51134
	call Func_5113d
	jr .asm_51137
.asm_51134
	call Func_51142
.asm_51137
	ld a, $6
	ld [W_ROUTE22CURSCRIPT], a
	ret

; known jump sources: 5112f (14:512f)
Func_5113d: ; 5113d (14:513d)
	ld de, Unknown_5114c ; $514c
	jr asm_51145

; known jump sources: 51134 (14:5134)
Func_51142: ; 51142 (14:5142)
	ld de, Unknown_5114d ; $514d
asm_51145: ; 51145 (14:5145)
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp MoveSprite

Unknown_5114c: ; 5114c (14:514c)
INCBIN "baserom.gbc",$5114c,$5114d - $5114c

Unknown_5114d: ; 5114d (14:514d)
INCBIN "baserom.gbc",$5114d,$51151 - $5114d
	ld a, [$d730]
	bit 0, a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $23
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	call Func_2307
	ld hl, $d7eb
	res 1, [hl]
	res 7, [hl]
	ld a, $7
	ld [W_ROUTE22CURSCRIPT], a
	ret
; 51175 (14:5175)
Route22Texts: ; 51175 (14:5175)
	dw Route22Text1, Route22Text2, Route22Text3

Route22Text1: ; 5117b (14:517b)
	db $08 ; asm
	ld a, [$d7eb]
	bit 5, a
	jr z, .asm_a88cf ; 0x51181
	ld hl, UnnamedText_511b2
	call PrintText
	jr .asm_48088 ; 0x51189
.asm_a88cf ; 0x5118b
	ld hl, UnnamedText_511ad
	call PrintText
.asm_48088 ; 0x51191
	jp TextScriptEnd

Route22Text2: ; 51194 (14:5194)
	db $08 ; asm
	ld a, [$d7eb]
	bit 6, a
	jr z, .asm_58c0a ; 0x5119a
	ld hl, UnnamedText_511c6
	call PrintText
	jr .asm_673ee ; 0x511a2
.asm_58c0a ; 0x511a4
	ld hl, UnnamedText_511c1
	call PrintText
.asm_673ee ; 0x511aa
	jp TextScriptEnd

UnnamedText_511ad: ; 511ad (14:51ad)
	TX_FAR _UnnamedText_511ad
	db $50
; 0x511ad + 5 bytes

UnnamedText_511b2: ; 511b2 (14:51b2)
	TX_FAR _UnnamedText_511b2
	db $50
; 0x511b2 + 5 bytes

UnnamedText_511b7: ; 511b7 (14:51b7)
	TX_FAR _UnnamedText_511b7
	db $50
; 0x511b7 + 5 bytes

UnnamedText_511bc: ; 511bc (14:51bc)
	TX_FAR _UnnamedText_511bc
	db $50
; 0x511bc + 5 bytes

UnnamedText_511c1: ; 511c1 (14:51c1)
	TX_FAR _UnnamedText_511c1
	db $50
; 0x511c1 + 5 bytes

UnnamedText_511c6: ; 511c6 (14:51c6)
	TX_FAR _UnnamedText_511c6
	db $50
; 0x511c6 + 5 bytes

UnnamedText_511cb: ; 511cb (14:51cb)
	TX_FAR _UnnamedText_511cb
	db $50
; 0x511cb + 5 bytes

UnnamedText_511d0: ; 511d0 (14:51d0)
	TX_FAR _UnnamedText_511d0
	db $50
; 0x511d0 + 5 bytes

Route22Text3: ; 511d5 (14:51d5)
	TX_FAR _Route22Text3
	db $50

Route23Script: ; 511da (14:51da)
	call Func_511e9
	call EnableAutoTextBoxDrawing
	ld hl, Route23Scripts
	ld a, [W_ROUTE23CURSCRIPT]
	jp CallFunctionInTable
; 0x511e9

; known jump sources: 511da (14:51da)
Func_511e9: ; 511e9 (14:51e9)
	ld hl, $d126
	bit 6, [hl]
	res 6, [hl]
	ret z
	ld hl, $d7ee
	res 0, [hl]
	res 7, [hl]
	ld hl, $d813
	res 0, [hl]
	res 6, [hl]
	ld a, $7a
	ld [$cc4d], a
	ld a, $15
	call Predef ; indirect jump to AddMissableObject (f1c8 (3:71c8))
	ld a, $60
	ld [$cc4d], a
	ld a, $11
	jp Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
; 51213 (14:5213)
Route23Scripts: ; 51213 (14:5213)
	dw Route23Script0, Route23Script1, Route23Script2

Route23Script0: ; 51219 (14:5219)
	ld hl, Unknown_51255 ; $5255
	ld a, [$d361]
	ld b, a
	ld e, $0
	ld c, $7
.asm_51224
	ld a, [hli]
	cp $ff
	ret z
	inc e
	dec c
	cp b
	jr nz, .asm_51224 ; 0x5122b $f7
	cp $23
	jr nz, .asm_51237 ; 0x5122f $6
	ld a, [$d362]
	cp $e
	ret nc
.asm_51237
	ld a, e
	ld [$ff00+$8c], a
	ld a, c
	ld [$cd3d], a
	ld b, $2
	ld hl, $d7ed
	ld a, $10
	call Predef
	ld a, c
	and a
	ret nz
	call Func_5125d
	call DisplayTextID
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ret
; 0x51255

Unknown_51255: ; 51255 (14:5255)
INCBIN "baserom.gbc",$51255,$5125d - $51255

; known jump sources: 5124b (14:524b), 51349 (14:5349)
Func_5125d: ; 5125d (14:525d)
	ld hl, Unknown_51276 ; $5276
	ld a, [W_WHICHTRADE] ; $cd3d
	ld c, a
	ld b, $0
	add hl, bc
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld de, $cd6d
.asm_5126e
	ld a, [hli]
	ld [de], a
	inc de
	cp $50
	jr nz, .asm_5126e
	ret

Unknown_51276: ; 51276 (14:5276)
INCBIN "baserom.gbc",$51276,$512d8 - $51276

; known jump sources: 51365 (14:5365)
Func_512d8: ; 512d8 (14:52d8)
	ld a, $1
	ld [$cd38], a
	ld a, $80
	ld [$ccd3], a
	xor a
	ld [$c109], a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	jp Func_3486
; 512ec (14:52ec)
Route23Script1: ; 512ec (14:52ec)
	ld a, [$cd38]
	and a
	ret nz
Route23Script2: ; 512f1 (14:52f1)
	ld a, $0
	ld [W_ROUTE23CURSCRIPT], a
	ret
; 0x512f7

Route23Texts: ; 512f7 (14:52f7)
	dw Route23Text1, Route23Text2, Route23Text3, Route23Text4, Route23Text5, Route23Text6, Route23Text7, Route23Text8

Route23Text1: ; 51307 (14:5307)
	db $08 ; asm
	ld a, $6
	call Func_51346
	jp TextScriptEnd

Route23Text2: ; 51310 (14:5310)
	db $08 ; asm
	ld a, $5
	call Func_51346
	jp TextScriptEnd

Route23Text3: ; 51319 (14:5319)
	db $08 ; asm
	ld a, $4
	call Func_51346
	jp TextScriptEnd

Route23Text4: ; 51322 (14:5322)
	db $08 ; asm
	ld a, $3
	call Func_51346
	jp TextScriptEnd

Route23Text5: ; 5132b (14:532b)
	db $08 ; asm
	ld a, $2
	call Func_51346
	jp TextScriptEnd

Route23Text6: ; 51334 (14:5334)
	db $08 ; asm
	ld a, $1
	call Func_51346
	jp TextScriptEnd

Route23Text7: ; 5133d (14:533d)
	db $8
	ld a, $0
	call Func_51346
	jp TextScriptEnd
; 0x51346

; known jump sources: 5130a (14:530a), 51313 (14:5313), 5131c (14:531c), 51325 (14:5325), 5132e (14:532e), 51337 (14:5337), 51340 (14:5340)
Func_51346: ; 51346 (14:5346)
	ld [W_WHICHTRADE], a ; $cd3d
	call Func_5125d
	ld a, [W_WHICHTRADE] ; $cd3d
	inc a
	ld c, a
	ld b, $2
	ld hl, W_OBTAINEDBADGES ; $d356
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	ld a, c
	and a
	jr nz, .asm_5136e
	ld hl, Unknown_5138e ; $538e
	call PrintText
	call Func_512d8
	ld a, $1
	ld [W_ROUTE23CURSCRIPT], a
	ret
.asm_5136e
	ld hl, Unknown_5139e ; $539e
	call PrintText
	ld a, [W_WHICHTRADE] ; $cd3d
	ld c, a
	ld b, $1
	ld hl, $d7ed
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	ld a, $2
	ld [W_ROUTE23CURSCRIPT], a
	ret

INCBIN "baserom.gbc",$51388,$5138e - $51388

Unknown_5138e: ; 5138e (14:538e)
INCBIN "baserom.gbc",$5138e,$5139e - $5138e

Unknown_5139e: ; 5139e (14:539e)
INCBIN "baserom.gbc",$5139e,$513a3 - $5139e

UnnamedText_513a3: ; 513a3 (14:53a3)
	TX_FAR _UnnamedText_513a3
	db $50
; 0x513a3 + 5 bytes

Route23Text8: ; 513a8 (14:53a8)
	TX_FAR _Route23Text8
	db $50

Route24Script: ; 513ad (14:53ad)
	call EnableAutoTextBoxDrawing
	ld hl, Route24TrainerHeaders
	ld de, Unknown_513cb ; $53cb
	ld a, [W_ROUTE24CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE24CURSCRIPT], a
	ret
; 0x513c0

; known jump sources: 51427 (14:5427)
Func_513c0: ; 513c0 (14:53c0)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_ROUTE24CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_513cb: ; 513cb (14:53cb)
INCBIN "baserom.gbc",$513cb,$513d5 - $513cb
	ld a, [$d7ef]
	bit 0, a
	jp nz, CheckFightingMapTrainers
	ld hl, Unknown_5140e ; $540e
	call ArePlayerCoordsInArray
	jp nc, CheckFightingMapTrainers
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d7f0
	bit 1, [hl]
	res 1, [hl]
	ret z
	ld a, $80
	ld [$ccd3], a
	ld a, $1
	ld [$cd38], a
	call Func_3486
	ld a, $4
	ld [W_ROUTE24CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_5140e: ; 5140e (14:540e)
INCBIN "baserom.gbc",$5140e,$51422 - $5140e
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_513c0
	call UpdateSprites
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d7ef
	set 1, [hl]
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $0
	ld [W_ROUTE24CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 5144b (14:544b)
Route24Texts: ; 5144b (14:544b)
	dw Route24Text1, Route24Text2, Route24Text3, Route24Text4, Route24Text5, Route24Text6, Route24Text7, Predef5CText

Route24TrainerHeaders: ; 5145b (14:545b)
Route24TrainerHeader0: ; 5145b (14:545b)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7ef ; flag's byte
	dw Route24BattleText1 ; 0x5571 TextBeforeBattle
	dw Route24AfterBattleText1 ; 0x557b TextAfterBattle
	dw Route24EndBattleText1 ; 0x5576 TextEndBattle
	dw Route24EndBattleText1 ; 0x5576 TextEndBattle
; 0x51467

Route24TrainerHeader2: ; 51467 (14:5467)
	db $3 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d7ef ; flag's byte
	dw Route24BattleText2 ; 0x5580 TextBeforeBattle
	dw Route24AfterBattleText2 ; 0x558a TextAfterBattle
	dw Route24EndBattleText2 ; 0x5585 TextEndBattle
	dw Route24EndBattleText2 ; 0x5585 TextEndBattle
; 0x51473

Route24TrainerHeader3: ; 51473 (14:5473)
	db $4 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d7ef ; flag's byte
	dw Route24BattleText3 ; 0x558f TextBeforeBattle
	dw Route24AfterBattleText3 ; 0x5599 TextAfterBattle
	dw Route24EndBattleText3 ; 0x5594 TextEndBattle
	dw Route24EndBattleText3 ; 0x5594 TextEndBattle
; 0x5147f

Route24TrainerHeader4: ; 5147f (14:547f)
	db $5 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d7ef ; flag's byte
	dw Route24BattleText4 ; 0x559e TextBeforeBattle
	dw Route24AfterBattleText4 ; 0x55a8 TextAfterBattle
	dw Route24EndBattleText4 ; 0x55a3 TextEndBattle
	dw Route24EndBattleText4 ; 0x55a3 TextEndBattle
; 0x5148b

Route24TrainerHeader5: ; 5148b (14:548b)
	db $6 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d7ef ; flag's byte
	dw Route24BattleText5 ; 0x55ad TextBeforeBattle
	dw Route24AfterBattleText5 ; 0x55b7 TextAfterBattle
	dw Route24EndBattleText5 ; 0x55b2 TextEndBattle
	dw Route24EndBattleText5 ; 0x55b2 TextEndBattle
; 0x51497

Route24TrainerHeader6: ; 51497 (14:5497)
	db $7 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d7ef ; flag's byte
	dw Route24BattleText6 ; 0x55bc TextBeforeBattle
	dw Route24AfterBattleText6 ; 0x55c6 TextAfterBattle
	dw Route24EndBattleText6 ; 0x55c1 TextEndBattle
	dw Route24EndBattleText6 ; 0x55c1 TextEndBattle
; 0x514a3

db $ff

Route24Text1: ; 514a4 (14:54a4)
	db $8
	ld hl, $d7f0
	res 1, [hl]
	ld a, [$d7ef]
	bit 0, a
	jr nz, .asm_a03f5 ; 0x514af $48
	ld hl, UnnamedText_51510
	call PrintText
	ld bc, (NUGGET << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, $d7ef
	set 0, [hl]
	ld hl, UnnamedText_5151a
	call PrintText
	ld hl, UnnamedText_51526
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_5152b
	ld de, UnnamedText_5152b
	call PreBattleSaveRegisters
	ld a, [$ff00+$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $3
	ld [W_ROUTE24CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	jp TextScriptEnd
.asm_a03f5 ; 0x514f9
	ld hl, UnnamedText_51530
	call PrintText
	jp TextScriptEnd
.BagFull
	ld hl, UnnamedText_51521
	call PrintText
	ld hl, $d7f0
	set 1, [hl]
	jp TextScriptEnd
; 0x51510

UnnamedText_51510: ; 51510 (14:5510)
	TX_FAR _UnnamedText_51510 ; 0x92721
	db $0B
	TX_FAR _UnnamedText_51515 ; 0x92755
	db $50
; 0x5151a

UnnamedText_5151a: ; 5151a (14:551a)
	TX_FAR _UnnamedText_5151a ; 0x92779
	db $0B, $6, $50

UnnamedText_51521: ; 51521 (14:5521)
	TX_FAR _UnnamedText_51521
	db $50
; 0x51521 + 5 bytes

UnnamedText_51526: ; 51526 (14:5526)
	TX_FAR _UnnamedText_51526
	db $50
; 0x51526 + 5 bytes

UnnamedText_5152b: ; 5152b (14:552b)
	TX_FAR _UnnamedText_5152b
	db $50
; 0x5152b + 5 bytes

UnnamedText_51530: ; 51530 (14:5530)
	TX_FAR _UnnamedText_51530
	db $50
; 0x51530 + 5 bytes

Route24Text2: ; 51535 (14:5535)
	db $08 ; asm
	ld hl, Route24TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route24Text3: ; 5153f (14:553f)
	db $08 ; asm
	ld hl, Route24TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route24Text4: ; 51549 (14:5549)
	db $08 ; asm
	ld hl, Route24TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route24Text5: ; 51553 (14:5553)
	db $08 ; asm
	ld hl, Route24TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route24Text6: ; 5155d (14:555d)
	db $08 ; asm
	ld hl, Route24TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route24Text7: ; 51567 (14:5567)
	db $08 ; asm
	ld hl, Route24TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route24BattleText1: ; 51571 (14:5571)
	TX_FAR _Route24BattleText1
	db $50
; 0x51571 + 5 bytes

Route24EndBattleText1: ; 51576 (14:5576)
	TX_FAR _Route24EndBattleText1
	db $50
; 0x51576 + 5 bytes

Route24AfterBattleText1: ; 5157b (14:557b)
	TX_FAR _Route24AfterBattleText1
	db $50
; 0x5157b + 5 bytes

Route24BattleText2: ; 51580 (14:5580)
	TX_FAR _Route24BattleText2
	db $50
; 0x51580 + 5 bytes

Route24EndBattleText2: ; 51585 (14:5585)
	TX_FAR _Route24EndBattleText2
	db $50
; 0x51585 + 5 bytes

Route24AfterBattleText2: ; 5158a (14:558a)
	TX_FAR _Route24AfterBattleText2
	db $50
; 0x5158a + 5 bytes

Route24BattleText3: ; 5158f (14:558f)
	TX_FAR _Route24BattleText3
	db $50
; 0x5158f + 5 bytes

Route24EndBattleText3: ; 51594 (14:5594)
	TX_FAR _Route24EndBattleText3
	db $50
; 0x51594 + 5 bytes

Route24AfterBattleText3: ; 51599 (14:5599)
	TX_FAR _Route24AfterBattleText3
	db $50
; 0x51599 + 5 bytes

Route24BattleText4: ; 5159e (14:559e)
	TX_FAR _Route24BattleText4
	db $50
; 0x5159e + 5 bytes

Route24EndBattleText4: ; 515a3 (14:55a3)
	TX_FAR _Route24EndBattleText4
	db $50
; 0x515a3 + 5 bytes

Route24AfterBattleText4: ; 515a8 (14:55a8)
	TX_FAR _Route24AfterBattleText4
	db $50
; 0x515a8 + 5 bytes

Route24BattleText5: ; 515ad (14:55ad)
	TX_FAR _Route24BattleText5
	db $50
; 0x515ad + 5 bytes

Route24EndBattleText5: ; 515b2 (14:55b2)
	TX_FAR _Route24EndBattleText5
	db $50
; 0x515b2 + 5 bytes

Route24AfterBattleText5: ; 515b7 (14:55b7)
	TX_FAR _Route24AfterBattleText5
	db $50
; 0x515b7 + 5 bytes

Route24BattleText6: ; 515bc (14:55bc)
	TX_FAR _Route24BattleText6
	db $50
; 0x515bc + 5 bytes

Route24EndBattleText6: ; 515c1 (14:55c1)
	TX_FAR _Route24EndBattleText6
	db $50
; 0x515c1 + 5 bytes

Route24AfterBattleText6: ; 515c6 (14:55c6)
	TX_FAR _Route24AfterBattleText6
	db $50
; 0x515c6 + 5 bytes

Route25Script: ; 515cb (14:55cb)
	call Unknown_515e1
	call EnableAutoTextBoxDrawing
	ld hl, Route25TrainerHeaders
	ld de, Unknown_51622 ; $5622
	ld a, [W_ROUTE25CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE25CURSCRIPT], a
	ret
; 0x515e1

Unknown_515e1: ; 515e1 (14:55e1)
	ld hl, $d126
	bit 6, [hl]
	res 6, [hl]
	ret z
	ld hl, $d7f2
	bit 7, [hl]
	ret nz
	bit 5, [hl]
	jr nz, .asm_515ff
	res 6, [hl]
	ld a, $61
	ld [$cc4d], a
	ld a, $15
	jp Predef ; indirect jump to AddMissableObject (f1c8 (3:71c8))
.asm_515ff
	bit 4, [hl]
	ret z
	set 7, [hl]
	ld a, $24
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	ld a, $62
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	ld a, $63
	ld [$cc4d], a
	ld a, $15
	jp Predef ; indirect jump to AddMissableObject (f1c8 (3:71c8))

Unknown_51622: ; 51622 (14:5622)
INCBIN "baserom.gbc",$51622,$51628 - $51622

Route25Texts: ; 51628 (14:5628)
	dw Route25Text1, Route25Text2, Route25Text3, Route25Text4, Route25Text5, Route25Text6, Route25Text7, Route25Text8, Route25Text9, Predef5CText, Route25Text11

Route25TrainerHeaders: ; 5163e (14:563e)
Route25TrainerHeader0: ; 5163e (14:563e)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7f1 ; flag's byte
	dw Route25BattleText1 ; 0x5705 TextBeforeBattle
	dw Route25AfterBattleText1 ; 0x570f TextAfterBattle
	dw Route25EndBattleText1 ; 0x570a TextEndBattle
	dw Route25EndBattleText1 ; 0x570a TextEndBattle
; 0x5164a

Route25TrainerHeader2: ; 5164a (14:564a)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7f1 ; flag's byte
	dw Route25BattleText2 ; 0x5714 TextBeforeBattle
	dw Route25AfterBattleText2 ; 0x571e TextAfterBattle
	dw Route25EndBattleText2 ; 0x5719 TextEndBattle
	dw Route25EndBattleText2 ; 0x5719 TextEndBattle
; 0x51656

Route25TrainerHeader3: ; 51656 (14:5656)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7f1 ; flag's byte
	dw Route25BattleText3 ; 0x5723 TextBeforeBattle
	dw Route25AfterBattleText3 ; 0x572d TextAfterBattle
	dw Route25EndBattleText3 ; 0x5728 TextEndBattle
	dw Route25EndBattleText3 ; 0x5728 TextEndBattle
; 0x51662

Route25TrainerHeader4: ; 51662 (14:5662)
	db $4 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7f1 ; flag's byte
	dw Route25BattleText4 ; 0x5732 TextBeforeBattle
	dw Route25AfterBattleText4 ; 0x573c TextAfterBattle
	dw Route25EndBattleText4 ; 0x5737 TextEndBattle
	dw Route25EndBattleText4 ; 0x5737 TextEndBattle
; 0x5166e

Route25TrainerHeader5: ; 5166e (14:566e)
	db $5 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7f1 ; flag's byte
	dw Route25BattleText5 ; 0x5741 TextBeforeBattle
	dw Route25AfterBattleText5 ; 0x574b TextAfterBattle
	dw Route25EndBattleText5 ; 0x5746 TextEndBattle
	dw Route25EndBattleText5 ; 0x5746 TextEndBattle
; 0x5167a

Route25TrainerHeader6: ; 5167a (14:567a)
	db $6 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7f1 ; flag's byte
	dw Route25BattleText6 ; 0x5750 TextBeforeBattle
	dw Route25AfterBattleText6 ; 0x575a TextAfterBattle
	dw Route25EndBattleText6 ; 0x5755 TextEndBattle
	dw Route25EndBattleText6 ; 0x5755 TextEndBattle
; 0x51686

Route25TrainerHeader7: ; 51686 (14:5686)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7f1 ; flag's byte
	dw Route25BattleText7 ; 0x575f TextBeforeBattle
	dw Route25AfterBattleText7 ; 0x5769 TextAfterBattle
	dw Route25EndBattleText7 ; 0x5764 TextEndBattle
	dw Route25EndBattleText7 ; 0x5764 TextEndBattle
; 0x51692

Route25TrainerHeader8: ; 51692 (14:5692)
	db $8 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7f1 ; flag's byte
	dw Route25BattleText8 ; 0x576e TextBeforeBattle
	dw Route25AfterBattleText8 ; 0x5778 TextAfterBattle
	dw Route25EndBattleText8 ; 0x5773 TextEndBattle
	dw Route25EndBattleText8 ; 0x5773 TextEndBattle
; 0x5169e

Route25TrainerHeader9: ; 5169e (14:569e)
	db $9 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7f1 ; flag's byte
	dw Route25BattleText9 ; 0x577d TextBeforeBattle
	dw Route25AfterBattleText9 ; 0x5787 TextAfterBattle
	dw Route25EndBattleText9 ; 0x5782 TextEndBattle
	dw Route25EndBattleText9 ; 0x5782 TextEndBattle
; 0x516aa

db $ff

Route25Text1: ; 516ab (14:56ab)
	db $08 ; asm
	ld hl, Route25TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route25Text2: ; 516b5 (14:56b5)
	db $08 ; asm
	ld hl, Route25TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route25Text3: ; 516bf (14:56bf)
	db $08 ; asm
	ld hl, Route25TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route25Text4: ; 516c9 (14:56c9)
	db $08 ; asm
	ld hl, Route25TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route25Text5: ; 516d3 (14:56d3)
	db $08 ; asm
	ld hl, Route25TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route25Text6: ; 516dd (14:56dd)
	db $08 ; asm
	ld hl, Route25TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route25Text7: ; 516e7 (14:56e7)
	db $08 ; asm
	ld hl, Route25TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

Route25Text8: ; 516f1 (14:56f1)
	db $08 ; asm
	ld hl, Route25TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

Route25Text9: ; 516fb (14:56fb)
	db $08 ; asm
	ld hl, Route25TrainerHeader9
	call TalkToTrainer
	jp TextScriptEnd

Route25BattleText1: ; 51705 (14:5705)
	TX_FAR _Route25BattleText1
	db $50
; 0x51705 + 5 bytes

Route25EndBattleText1: ; 5170a (14:570a)
	TX_FAR _Route25EndBattleText1
	db $50
; 0x5170a + 5 bytes

Route25AfterBattleText1: ; 5170f (14:570f)
	TX_FAR _Route25AfterBattleText1
	db $50
; 0x5170f + 5 bytes

Route25BattleText2: ; 51714 (14:5714)
	TX_FAR _Route25BattleText2
	db $50
; 0x51714 + 5 bytes

Route25EndBattleText2: ; 51719 (14:5719)
	TX_FAR _Route25EndBattleText2
	db $50
; 0x51719 + 5 bytes

Route25AfterBattleText2: ; 5171e (14:571e)
	TX_FAR _Route25AfterBattleText2
	db $50
; 0x5171e + 5 bytes

Route25BattleText3: ; 51723 (14:5723)
	TX_FAR _Route25BattleText3
	db $50
; 0x51723 + 5 bytes

Route25EndBattleText3: ; 51728 (14:5728)
	TX_FAR _Route25EndBattleText3
	db $50
; 0x51728 + 5 bytes

Route25AfterBattleText3: ; 5172d (14:572d)
	TX_FAR _Route25AfterBattleText3
	db $50
; 0x5172d + 5 bytes

Route25BattleText4: ; 51732 (14:5732)
	TX_FAR _Route25BattleText4
	db $50
; 0x51732 + 5 bytes

Route25EndBattleText4: ; 51737 (14:5737)
	TX_FAR _Route25EndBattleText4
	db $50
; 0x51737 + 5 bytes

Route25AfterBattleText4: ; 5173c (14:573c)
	TX_FAR _Route25AfterBattleText4
	db $50
; 0x5173c + 5 bytes

Route25BattleText5: ; 51741 (14:5741)
	TX_FAR _Route25BattleText5
	db $50
; 0x51741 + 5 bytes

Route25EndBattleText5: ; 51746 (14:5746)
	TX_FAR _Route25EndBattleText5
	db $50
; 0x51746 + 5 bytes

Route25AfterBattleText5: ; 5174b (14:574b)
	TX_FAR _Route25AfterBattleText5
	db $50
; 0x5174b + 5 bytes

Route25BattleText6: ; 51750 (14:5750)
	TX_FAR _Route25BattleText6
	db $50
; 0x51750 + 5 bytes

Route25EndBattleText6: ; 51755 (14:5755)
	TX_FAR _Route25EndBattleText6
	db $50
; 0x51755 + 5 bytes

Route25AfterBattleText6: ; 5175a (14:575a)
	TX_FAR _Route25AfterBattleText6
	db $50
; 0x5175a + 5 bytes

Route25BattleText7: ; 5175f (14:575f)
	TX_FAR _Route25BattleText7
	db $50
; 0x5175f + 5 bytes

Route25EndBattleText7: ; 51764 (14:5764)
	TX_FAR _Route25EndBattleText7
	db $50
; 0x51764 + 5 bytes

Route25AfterBattleText7: ; 51769 (14:5769)
	TX_FAR _Route25AfterBattleText7
	db $50
; 0x51769 + 5 bytes

Route25BattleText8: ; 5176e (14:576e)
	TX_FAR _Route25BattleText8
	db $50
; 0x5176e + 5 bytes

Route25EndBattleText8: ; 51773 (14:5773)
	TX_FAR _Route25EndBattleText8
	db $50
; 0x51773 + 5 bytes

Route25AfterBattleText8: ; 51778 (14:5778)
	TX_FAR _Route25AfterBattleText8
	db $50
; 0x51778 + 5 bytes

Route25BattleText9: ; 5177d (14:577d)
	TX_FAR _Route25BattleText9
	db $50
; 0x5177d + 5 bytes

Route25EndBattleText9: ; 51782 (14:5782)
	TX_FAR _Route25EndBattleText9
	db $50
; 0x51782 + 5 bytes

Route25AfterBattleText9: ; 51787 (14:5787)
	TX_FAR _Route25AfterBattleText9
	db $50
; 0x51787 + 5 bytes

Route25Text11: ; 5178c (14:578c)
	TX_FAR _Route25Text11
	db $50

VictoryRoad2_h: ; 0x51791 to 0x5179d (12 bytes) (id=194)
	db $11 ; tileset
	db VICTORY_ROAD_2_HEIGHT, VICTORY_ROAD_2_WIDTH ; dimensions (y, x)
	dw VictoryRoad2Blocks, VictoryRoad2Texts, VictoryRoad2Script ; blocks, texts, scripts
	db $00 ; connections

	dw VictoryRoad2Object ; objects

VictoryRoad2Script: ; 5179d (14:579d)
	ld hl, $d126
	bit 6, [hl]
	res 6, [hl]
	call nz, VictoryRoad2Script_Unknown517c4
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	call nz, Func_517c9
	call EnableAutoTextBoxDrawing
	ld hl, VictoryRoad2TrainerHeaders
	ld de, Unknown_517eb ; $57eb
	ld a, [W_VICTORYROAD2CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_VICTORYROAD2CURSCRIPT], a
	ret
; 0x517c4

VictoryRoad2Script_Unknown517c4: ; 517c4 (14:57c4)
	ld hl, $d869
	res 7, [hl]

; known jump sources: 517ae (14:57ae)
Func_517c9: ; 517c9 (14:57c9)
	ld a, [$d7ee]
	bit 0, a
	jr z, .asm_517da
	push af
	ld a, $15
	ld bc, $403
	call Func_517e2
	pop af
.asm_517da
	bit 7, a
	ret z
	ld a, $1d
	ld bc, $70b

; known jump sources: 517d6 (14:57d6)
Func_517e2: ; 517e2 (14:57e2)
	ld [$d09f], a
	ld a, $17
	call Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))
	ret

Unknown_517eb: ; 517eb (14:57eb)
INCBIN "baserom.gbc",$517eb,$517f1 - $517eb
	ld hl, Unknown_51816 ; $5816
	call CheckBoulderCoords
	jp nc, CheckFightingMapTrainers
	ld hl, $d7ee
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $2
	jr z, .asm_5180b
	bit 0, [hl]
	set 0, [hl]
	ret nz
	jr .asm_51810
.asm_5180b
	bit 7, [hl]
	set 7, [hl]
	ret nz
.asm_51810
	ld hl, $d126
	set 5, [hl]
	ret

Unknown_51816: ; 51816 (14:5816)
INCBIN "baserom.gbc",$51816,$5181b - $51816

VictoryRoad2Texts: ; 5181b (14:581b)
	dw VictoryRoad2Text1, VictoryRoad2Text2, VictoryRoad2Text3, VictoryRoad2Text4, VictoryRoad2Text5, VictoryRoad2Text6, Predef5CText, Predef5CText, Predef5CText, Predef5CText, BoulderText, BoulderText, BoulderText

VictoryRoad2TrainerHeaders: ; 51835 (14:5835)
VictoryRoad2TrainerHeader0: ; 51835 (14:5835)
	db $1 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7ee ; flag's byte
	dw VictoryRoad2BattleText1 ; 0x58ca TextBeforeBattle
	dw VictoryRoad2AfterBattleText1 ; 0x58d4 TextAfterBattle
	dw VictoryRoad2EndBattleText1 ; 0x58cf TextEndBattle
	dw VictoryRoad2EndBattleText1 ; 0x58cf TextEndBattle
; 0x51841

VictoryRoad2TrainerHeader2: ; 51841 (14:5841)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7ee ; flag's byte
	dw VictoryRoad2BattleText2 ; 0x58d9 TextBeforeBattle
	dw VictoryRoad2AfterBattleText2 ; 0x58e3 TextAfterBattle
	dw VictoryRoad2EndBattleText2 ; 0x58de TextEndBattle
	dw VictoryRoad2EndBattleText2 ; 0x58de TextEndBattle
; 0x5184d

VictoryRoad2TrainerHeader3: ; 5184d (14:584d)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7ee ; flag's byte
	dw VictoryRoad2BattleText3 ; 0x58e8 TextBeforeBattle
	dw VictoryRoad2AfterBattleText3 ; 0x58f2 TextAfterBattle
	dw VictoryRoad2EndBattleText3 ; 0x58ed TextEndBattle
	dw VictoryRoad2EndBattleText3 ; 0x58ed TextEndBattle
; 0x51859

VictoryRoad2TrainerHeader4: ; 51859 (14:5859)
	db $4 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d7ee ; flag's byte
	dw VictoryRoad2BattleText4 ; 0x58f7 TextBeforeBattle
	dw VictoryRoad2AfterBattleText4 ; 0x5901 TextAfterBattle
	dw VictoryRoad2EndBattleText4 ; 0x58fc TextEndBattle
	dw VictoryRoad2EndBattleText4 ; 0x58fc TextEndBattle
; 0x51865

VictoryRoad2TrainerHeader5: ; 51865 (14:5865)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7ee ; flag's byte
	dw VictoryRoad2BattleText5 ; 0x5906 TextBeforeBattle
	dw VictoryRoad2AfterBattleText5 ; 0x5910 TextAfterBattle
	dw VictoryRoad2EndBattleText5 ; 0x590b TextEndBattle
	dw VictoryRoad2EndBattleText5 ; 0x590b TextEndBattle
; 0x51871

VictoryRoad2TrainerHeader6: ; 51871 (14:5871)
	db $6 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d7ee ; flag's byte
	dw VictoryRoad2BattleText6 ; 0x58ba TextBeforeBattle
	dw VictoryRoad2BattleText6 ; 0x58ba TextAfterBattle
	dw VictoryRoad2BattleText6 ; 0x58ba TextEndBattle
	dw VictoryRoad2BattleText6 ; 0x58ba TextEndBattle
; 0x5187d

db $ff

VictoryRoad2Text1: ; 5187e (14:587e)
	db $08 ; asm
	ld hl, VictoryRoad2TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad2Text2: ; 51888 (14:5888)
	db $08 ; asm
	ld hl, VictoryRoad2TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad2Text3: ; 51892 (14:5892)
	db $08 ; asm
	ld hl, VictoryRoad2TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad2Text4: ; 5189c (14:589c)
	db $08 ; asm
	ld hl, VictoryRoad2TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad2Text5: ; 518a6 (14:58a6)
	db $08 ; asm
	ld hl, VictoryRoad2TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad2Text6: ; 518b0 (14:58b0)
	db $08 ; asm
	ld hl, VictoryRoad2TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad2BattleText6: ; 518ba (14:58ba)
	TX_FAR _VictoryRoad2BattleText6 ; 0x8d06e
	db $8
	ld a, MOLTRES
	call PlayCry
	call WaitForSoundToFinish
	jp TextScriptEnd
; 0x518ca

VictoryRoad2BattleText1: ; 518ca (14:58ca)
	TX_FAR _VictoryRoad2BattleText1
	db $50
; 0x518ca + 5 bytes

VictoryRoad2EndBattleText1: ; 518cf (14:58cf)
	TX_FAR _VictoryRoad2EndBattleText1
	db $50
; 0x518cf + 5 bytes

VictoryRoad2AfterBattleText1: ; 518d4 (14:58d4)
	TX_FAR _VictoryRoad2AfterBattleText1
	db $50
; 0x518d4 + 5 bytes

VictoryRoad2BattleText2: ; 518d9 (14:58d9)
	TX_FAR _VictoryRoad2BattleText2
	db $50
; 0x518d9 + 5 bytes

VictoryRoad2EndBattleText2: ; 518de (14:58de)
	TX_FAR _VictoryRoad2EndBattleText2
	db $50
; 0x518de + 5 bytes

VictoryRoad2AfterBattleText2: ; 518e3 (14:58e3)
	TX_FAR _VictoryRoad2AfterBattleText2
	db $50
; 0x518e3 + 5 bytes

VictoryRoad2BattleText3: ; 518e8 (14:58e8)
	TX_FAR _VictoryRoad2BattleText3
	db $50
; 0x518e8 + 5 bytes

VictoryRoad2EndBattleText3: ; 518ed (14:58ed)
	TX_FAR _VictoryRoad2EndBattleText3
	db $50
; 0x518ed + 5 bytes

VictoryRoad2AfterBattleText3: ; 518f2 (14:58f2)
	TX_FAR _VictoryRoad2AfterBattleText3
	db $50
; 0x518f2 + 5 bytes

VictoryRoad2BattleText4: ; 518f7 (14:58f7)
	TX_FAR _VictoryRoad2BattleText4
	db $50
; 0x518f7 + 5 bytes

VictoryRoad2EndBattleText4: ; 518fc (14:58fc)
	TX_FAR _VictoryRoad2EndBattleText4
	db $50
; 0x518fc + 5 bytes

VictoryRoad2AfterBattleText4: ; 51901 (14:5901)
	TX_FAR _VictoryRoad2AfterBattleText4
	db $50
; 0x51901 + 5 bytes

VictoryRoad2BattleText5: ; 51906 (14:5906)
	TX_FAR _VictoryRoad2BattleText5
	db $50
; 0x51906 + 5 bytes

VictoryRoad2EndBattleText5: ; 5190b (14:590b)
	TX_FAR _VictoryRoad2EndBattleText5
	db $50
; 0x5190b + 5 bytes

VictoryRoad2AfterBattleText5: ; 51910 (14:5910)
	TX_FAR _VictoryRoad2AfterBattleText5
	db $50
; 0x51910 + 5 bytes

VictoryRoad2Object: ; 0x51915 (size=154)
	db $7d ; border tile

	db $7 ; warps
	db $8, $0, $2, VICTORY_ROAD_1
	db $7, $1d, $3, $ff
	db $8, $1d, $3, $ff
	db $7, $17, $0, VICTORY_ROAD_3
	db $e, $19, $2, VICTORY_ROAD_3
	db $7, $1b, $1, VICTORY_ROAD_3
	db $1, $1, $3, VICTORY_ROAD_3

	db $0 ; signs

	db $d ; people
	db SPRITE_HIKER, $9 + 4, $c + 4, $ff, $d2, $41, BLACKBELT + $C8, $9 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $d + 4, $15 + 4, $ff, $d2, $42, JUGGLER + $C8, $2 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $8 + 4, $13 + 4, $ff, $d0, $43, TAMER + $C8, $5 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $2 + 4, $4 + 4, $ff, $d0, $44, POKEMANIAC + $C8, $6 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $3 + 4, $1a + 4, $ff, $d2, $45, JUGGLER + $C8, $5 ; trainer
	db SPRITE_BIRD, $5 + 4, $b + 4, $ff, $d1, $46, MOLTRES, 50 ; trainer
	db SPRITE_BALL, $5 + 4, $1b + 4, $ff, $ff, $87, TM_17 ; item
	db SPRITE_BALL, $9 + 4, $12 + 4, $ff, $ff, $88, FULL_HEAL ; item
	db SPRITE_BALL, $b + 4, $9 + 4, $ff, $ff, $89, TM_05 ; item
	db SPRITE_BALL, $0 + 4, $b + 4, $ff, $ff, $8a, GUARD_SPEC_ ; item
	db SPRITE_BOULDER, $e + 4, $4 + 4, $ff, $10, $b ; person
	db SPRITE_BOULDER, $5 + 4, $5 + 4, $ff, $10, $c ; person
	db SPRITE_BOULDER, $10 + 4, $17 + 4, $ff, $10, $d ; person

	; warp-to
	EVENT_DISP $f, $8, $0 ; VICTORY_ROAD_1
	EVENT_DISP $f, $7, $1d
	EVENT_DISP $f, $8, $1d
	EVENT_DISP $f, $7, $17 ; VICTORY_ROAD_3
	EVENT_DISP $f, $e, $19 ; VICTORY_ROAD_3
	EVENT_DISP $f, $7, $1b ; VICTORY_ROAD_3
	EVENT_DISP $f, $1, $1 ; VICTORY_ROAD_3

VictoryRoad2Blocks: ; 519af (14:59af)
	INCBIN "maps/victoryroad2.blk"

MtMoon2_h: ; 0x51a36 to 0x51a42 (12 bytes) (id=60)
	db $11 ; tileset
	db MT_MOON_2_HEIGHT, MT_MOON_2_WIDTH ; dimensions (y, x)
	dw MtMoon2Blocks, MtMoon2Texts, MtMoon2Script ; blocks, texts, scripts
	db $00 ; connections

	dw MtMoon2Object ; objects

MtMoon2Script: ; 51a42 (14:5a42)
	call EnableAutoTextBoxDrawing
	ret
; 0x51a46

MtMoon2Texts: ; 51a46 (14:5a46)
	dw MtMoonText1

MtMoonText1: ; 51a48 (14:5a48)
	TX_FAR _UnnamedText_51a48
	db $50
; 0x51a48 + 5 bytes

MtMoon2Object: ; 0x51a4d (size=68)
	db $3 ; border tile

	db $8 ; warps
	db $5, $5, $2, MT_MOON_1
	db $b, $11, $0, MT_MOON_3
	db $9, $19, $3, MT_MOON_1
	db $f, $19, $4, MT_MOON_1
	db $11, $15, $1, MT_MOON_3
	db $1b, $d, $2, MT_MOON_3
	db $3, $17, $3, MT_MOON_3
	db $3, $1b, $2, $ff

	db $0 ; signs

	db $0 ; people

	; warp-to
	EVENT_DISP $e, $5, $5 ; MT_MOON_1
	EVENT_DISP $e, $b, $11 ; MT_MOON_3
	EVENT_DISP $e, $9, $19 ; MT_MOON_1
	EVENT_DISP $e, $f, $19 ; MT_MOON_1
	EVENT_DISP $e, $11, $15 ; MT_MOON_3
	EVENT_DISP $e, $1b, $d ; MT_MOON_3
	EVENT_DISP $e, $3, $17 ; MT_MOON_3
	EVENT_DISP $e, $3, $1b

MtMoon2Blocks: ; 51a91 (14:5a91)
	INCBIN "maps/mtmoon2.blk"

SilphCo7_h: ; 0x51b55 to 0x51b61 (12 bytes) (id=212)
	db $16 ; tileset
	db SILPH_CO_7F_HEIGHT, SILPH_CO_7F_WIDTH ; dimensions (y, x)
	dw SilphCo7Blocks, SilphCo7Texts, SilphCo7Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo7Object ; objects

SilphCo7Script: ; 51b61 (14:5b61)
	call SilphCo7Script_Unknown51b77
	call EnableAutoTextBoxDrawing
	ld hl, SilphCo7TrainerHeaders
	ld de, Unknown_51c17 ; $5c17
	ld a, [W_SILPHCO7CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SILPHCO7CURSCRIPT], a
	ret
; 0x51b77

SilphCo7Script_Unknown51b77: ; 51b77 (14:5b77)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, Unknown_51bc1 ; $5bc1
	call Func_51bc8
	call Func_51bf4
	ld a, [$d830]
	bit 4, a
	jr nz, .asm_51b9e
	push af
	ld a, $54
	ld [$d09f], a
	ld bc, $305
	ld a, $17
	call Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))
	pop af
.asm_51b9e
	bit 5, a
	jr nz, .asm_51bb1
	push af
	ld a, $54
	ld [$d09f], a
	ld bc, $20a
	ld a, $17
	call Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))
	pop af
.asm_51bb1
	bit 6, a
	ret nz
	ld a, $54
	ld [$d09f], a
	ld bc, $60a
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

Unknown_51bc1: ; 51bc1 (14:5bc1)
INCBIN "baserom.gbc",$51bc1,$51bc8 - $51bc1

; known jump sources: 51b82 (14:5b82)
Func_51bc8: ; 51bc8 (14:5bc8)
	push hl
	ld hl, $d73f
	ld a, [hli]
	ld b, a
	ld a, [hl]
	ld c, a
	xor a
	ld [$FF00+$e0], a
	pop hl
.asm_51bd4
	ld a, [hli]
	cp $ff
	jr z, .asm_51bf0
	push hl
	ld hl, $ffe0
	inc [hl]
	pop hl
	cp b
	jr z, .asm_51be5
	inc hl
	jr .asm_51bd4
.asm_51be5
	ld a, [hli]
	cp c
	jr nz, .asm_51bd4
	ld hl, $d73f
	xor a
	ld [hli], a
	ld [hl], a
	ret
.asm_51bf0
	xor a
	ld [$FF00+$e0], a
	ret

; known jump sources: 51b85 (14:5b85)
Func_51bf4: ; 51bf4 (14:5bf4)
	ld hl, $d830
	ld a, [$FF00+$e0]
	and a
	ret z
	cp $1
	jr nz, .asm_51c02
	set 4, [hl]
	ret
.asm_51c02
	cp $2
	jr nz, .asm_51c09
	set 5, [hl]
	ret
.asm_51c09
	set 6, [hl]
	ret

; known jump sources: 51ccd (14:5ccd)
Func_51c0c: ; 51c0c (14:5c0c)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a

; known jump sources: 51c75 (14:5c75), 51cc5 (14:5cc5), 51d17 (14:5d17), 51d3c (14:5d3c)
Func_51c10: ; 51c10 (14:5c10)
	ld [W_SILPHCO7CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_51c17: ; 51c17 (14:5c17)
INCBIN "baserom.gbc",$51c17,$51c23 - $51c17
	ld a, [$d82f]
	bit 0, a
	jp nz, CheckFightingMapTrainers
	ld hl, Unknown_51c78 ; $5c78
	call ArePlayerCoordsInArray
	jp nc, CheckFightingMapTrainers
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $4
	ld [$d528], a
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld c, $2
	ld a, $de
	call PlayMusic
	ld a, $9
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $9
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call SetSpriteMovementBytesToFF
	ld de, Unknown_51c7d ; $5c7d
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [$cf0d], a
	cp $1
	jr z, .asm_51c6c
	inc de
.asm_51c6c
	ld a, $9
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call MoveSprite
	ld a, $3
	jp Func_51c10

Unknown_51c78: ; 51c78 (14:5c78)
INCBIN "baserom.gbc",$51c78,$51c7d - $51c78

Unknown_51c7d: ; 51c7d (14:5c7d)
INCBIN "baserom.gbc",$51c7d,$51c82 - $51c7d
	ld a, [$d730]
	bit 0, a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $d
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	call Delay3
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, SilphCo7Text14 ; $5ec8
	ld de, UnnamedText_51ecd ; $5ecd
	call PreBattleSaveRegisters
	ld a, $f2
	ld [W_CUROPPONENT], a ; $d059
	ld a, [W_RIVALSTARTER] ; $d715
	cp $b1
	jr nz, .asm_51cb6
	ld a, $7
	jr .asm_51cc0
.asm_51cb6
	cp $99
	jr nz, .asm_51cbe
	ld a, $8
	jr .asm_51cc0
.asm_51cbe
	ld a, $9
.asm_51cc0
	ld [W_TRAINERNO], a ; $d05d
	ld a, $4
	jp Func_51c10
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_51c0c
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d82f
	set 0, [hl]
	ld a, $4
	ld [$d528], a
	ld a, $9
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	ld a, $4
	ld [$FF00+$8d], a
	call Func_34a6
	ld a, $f
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld b, BANK(Func_9b47)
	ld hl, Func_9b47
	call Bankswitch ; indirect jump to Func_9b47 (9b47 (2:5b47))
	ld de, Unknown_51d1d ; $5d1d
	ld a, [$cf0d]
	cp $1
	jr nz, .asm_51d0e
	ld de, Unknown_51d1a ; $5d1a
.asm_51d0e
	ld a, $9
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call MoveSprite
	ld a, $5
	jp Func_51c10

Unknown_51d1a: ; 51d1a (14:5d1a)
INCBIN "baserom.gbc",$51d1a,$51d1d - $51d1a

Unknown_51d1d: ; 51d1d (14:5d1d)
INCBIN "baserom.gbc",$51d1d,$51d25 - $51d1d
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $a7
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	call Func_2307
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	jp Func_51c10
; 51d3f (14:5d3f)
SilphCo7Texts: ; 51d3f (14:5d3f)
	dw SilphCo7Text1, SilphCo7Text2, SilphCo7Text3, SilphCo7Text4, SilphCo7Text5, SilphCo7Text6, SilphCo7Text7, SilphCo7Text8, SilphCo7Text9, Predef5CText, Predef5CText, Predef5CText, SilphCo7Text13, SilphCo7Text14, SilphCo7Text15

SilphCo7TrainerHeaders: ; 51d5d (14:5d5d)
SilphCo7TrainerHeader0: ; 51d5d (14:5d5d)
	db $5 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d82f ; flag's byte
	dw SilphCo7BattleText1 ; 0x5e5a TextBeforeBattle
	dw SilphCo7AfterBattleText1 ; 0x5e64 TextAfterBattle
	dw SilphCo7EndBattleText1 ; 0x5e5f TextEndBattle
	dw SilphCo7EndBattleText1 ; 0x5e5f TextEndBattle
; 0x51d69

SilphCo7TrainerHeader2: ; 51d69 (14:5d69)
	db $6 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d82f ; flag's byte
	dw SilphCo7BattleText2 ; 0x5e73 TextBeforeBattle
	dw SilphCo7AfterBattleText2 ; 0x5e7d TextAfterBattle
	dw SilphCo7EndBattleText2 ; 0x5e78 TextEndBattle
	dw SilphCo7EndBattleText2 ; 0x5e78 TextEndBattle
; 0x51d75

SilphCo7TrainerHeader3: ; 51d75 (14:5d75)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d82f ; flag's byte
	dw SilphCo7BattleText3 ; 0x5e8c TextBeforeBattle
	dw SilphCo7AfterBattleText3 ; 0x5e96 TextAfterBattle
	dw SilphCo7EndBattleText3 ; 0x5e91 TextEndBattle
	dw SilphCo7EndBattleText3 ; 0x5e91 TextEndBattle
; 0x51d81

SilphCo7TrainerHeader4: ; 51d81 (14:5d81)
	db $8 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d82f ; flag's byte
	dw SilphCo7BattleText4 ; 0x5ea5 TextBeforeBattle
	dw SilphCo7AfterBattleText4 ; 0x5eaf TextAfterBattle
	dw SilphCo7EndBattleText4 ; 0x5eaa TextEndBattle
	dw SilphCo7EndBattleText4 ; 0x5eaa TextEndBattle
; 0x51d8d

db $ff

SilphCo7Text1: ; 51d8e (14:5d8e)
	db $08 ; asm
	ld a, [$d72e]
	bit 0, a
	jr z, .asm_d7e17 ; 0x51d94
	ld a, [$d838]
	bit 7, a
	jr nz, .asm_688b4 ; 0x51d9b
	ld hl, UnnamedText_51ddd
	call PrintText
	jr .asm_b3069 ; 0x51da3
.asm_d7e17 ; 0x51da5
	ld hl, UnnamedText_51dd3
	call PrintText
	ld bc, (LAPRAS << 8) | 15
	call GivePokemon
	jr nc, .asm_b3069 ; 0x51db1
	ld a, [$ccd3]
	and a
	call z, WaitForTextScrollButtonPress
	call EnableAutoTextBoxDrawing
	ld hl, UnnamedText_51dd8
	call PrintText
	ld hl, $d72e
	set 0, [hl]
	jr .asm_b3069 ; 0x51dc8
.asm_688b4 ; 0x51dca
	ld hl, UnnamedText_51de2
	call PrintText
.asm_b3069 ; 0x51dd0
	jp TextScriptEnd

UnnamedText_51dd3: ; 51dd3 (14:5dd3)
	TX_FAR _UnnamedText_51dd3
	db $50
; 0x51dd3 + 5 bytes

UnnamedText_51dd8: ; 51dd8 (14:5dd8)
	TX_FAR _UnnamedText_51dd8
	db $50
; 0x51dd8 + 5 bytes

UnnamedText_51ddd: ; 51ddd (14:5ddd)
	TX_FAR _UnnamedText_51ddd
	db $50
; 0x51ddd + 5 bytes

UnnamedText_51de2: ; 51de2 (14:5de2)
	TX_FAR _UnnamedText_51de2
	db $50
; 0x51de2 + 5 bytes

SilphCo7Text2: ; 51de7 (14:5de7)
	db $8
	ld a, [$d838]
	bit 7, a
	jr nz, .asm_892ce ; 0x51ded $8
	ld hl, UnnamedText_51e00
	call PrintText
	jr .asm_e4d89 ; 0x51df5 $6
.asm_892ce ; 0x51df7
	ld hl, UnnamedText_51e05
	call PrintText
.asm_e4d89 ; 0x51dfd
	jp TextScriptEnd
; 0x51e00

UnnamedText_51e00: ; 51e00 (14:5e00)
	TX_FAR _UnnamedText_51e00
	db $50
; 0x51e00 + 5 bytes

UnnamedText_51e05: ; 51e05 (14:5e05)
	TX_FAR _UnnamedText_51e05
	db $50
; 0x51e05 + 5 bytes

SilphCo7Text3: ; 51e0a (14:5e0a)
	db $08 ; asm
	ld a, [$d838]
	bit 7, a
	jr nz, .asm_254aa ; 0x51e10
	ld hl, UnnamedText_51e23
	call PrintText
	jr .asm_6472b ; 0x51e18
.asm_254aa ; 0x51e1a
	ld hl, UnnamedText_51e28
	call PrintText
.asm_6472b ; 0x51e20
	jp TextScriptEnd

UnnamedText_51e23: ; 51e23 (14:5e23)
	TX_FAR _UnnamedText_51e23
	db $50
; 0x51e23 + 5 bytes

UnnamedText_51e28: ; 51e28 (14:5e28)
	TX_FAR _UnnamedText_51e28
	db $50
; 0x51e28 + 5 bytes

SilphCo7Text4: ; 51e2d (14:5e2d)
	db $08 ; asm
	ld a, [$d838]
	bit 7, a
	jr nz, .asm_0f7ee ; 0x51e33
	ld hl, UnnamedText_51e46
	call PrintText
	jr .selectLowNybble2 ; 0x51e3b
.asm_0f7ee ; 0x51e3d
	ld hl, UnnamedText_51e4b
	call PrintText
.selectLowNybble2 ; 0x51e43
	jp TextScriptEnd

UnnamedText_51e46: ; 51e46 (14:5e46)
	TX_FAR _UnnamedText_51e46
	db $50
; 0x51e46 + 5 bytes

UnnamedText_51e4b: ; 51e4b (14:5e4b)
	TX_FAR _UnnamedText_51e4b
	db $50
; 0x51e4b + 5 bytes

SilphCo7Text5: ; 51e50 (14:5e50)
	db $08 ; asm
	ld hl, SilphCo7TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SilphCo7BattleText1: ; 51e5a (14:5e5a)
	TX_FAR _SilphCo7BattleText1
	db $50
; 0x51e5a + 5 bytes

SilphCo7EndBattleText1: ; 51e5f (14:5e5f)
	TX_FAR _SilphCo7EndBattleText1
	db $50
; 0x51e5f + 5 bytes

SilphCo7AfterBattleText1: ; 51e64 (14:5e64)
	TX_FAR _SilphCo7AfterBattleText1
	db $50
; 0x51e64 + 5 bytes

SilphCo7Text6: ; 51e69 (14:5e69)
	db $08 ; asm
	ld hl, SilphCo7TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SilphCo7BattleText2: ; 51e73 (14:5e73)
	TX_FAR _SilphCo7BattleText2
	db $50
; 0x51e73 + 5 bytes

SilphCo7EndBattleText2: ; 51e78 (14:5e78)
	TX_FAR _SilphCo7EndBattleText2
	db $50
; 0x51e78 + 5 bytes

SilphCo7AfterBattleText2: ; 51e7d (14:5e7d)
	TX_FAR _SilphCo7AfterBattleText2
	db $50
; 0x51e7d + 5 bytes

SilphCo7Text7: ; 51e82 (14:5e82)
	db $08 ; asm
	ld hl, SilphCo7TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

SilphCo7BattleText3: ; 51e8c (14:5e8c)
	TX_FAR _SilphCo7BattleText3
	db $50
; 0x51e8c + 5 bytes

SilphCo7EndBattleText3: ; 51e91 (14:5e91)
	TX_FAR _SilphCo7EndBattleText3
	db $50
; 0x51e91 + 5 bytes

SilphCo7AfterBattleText3: ; 51e96 (14:5e96)
	TX_FAR _SilphCo7AfterBattleText3
	db $50
; 0x51e96 + 5 bytes

SilphCo7Text8: ; 51e9b (14:5e9b)
	db $08 ; asm
	ld hl, SilphCo7TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

SilphCo7BattleText4: ; 51ea5 (14:5ea5)
	TX_FAR _SilphCo7BattleText4
	db $50
; 0x51ea5 + 5 bytes

SilphCo7EndBattleText4: ; 51eaa (14:5eaa)
	TX_FAR _SilphCo7EndBattleText4
	db $50
; 0x51eaa + 5 bytes

SilphCo7AfterBattleText4: ; 51eaf (14:5eaf)
	TX_FAR _SilphCo7AfterBattleText4
	db $50
; 0x51eaf + 5 bytes

SilphCo7Text9: ; 51eb4 (14:5eb4)
	db $08 ; asm
	ld hl, UnnamedText_51ebe
	call PrintText
	jp TextScriptEnd

UnnamedText_51ebe: ; 51ebe (14:5ebe)
	TX_FAR _UnnamedText_51ebe
	db $50
; 0x51ebe + 5 bytes

SilphCo7Text13: ; 51ec3 (14:5ec3)
	TX_FAR _UnnamedText_51ec3
	db $50
; 0x51ec3 + 5 bytes

SilphCo7Text14: ; 51ec8 (14:5ec8)
	TX_FAR _UnnamedText_51ec8
	db $50
; 0x51ec8 + 5 bytes

UnnamedText_51ecd: ; 51ecd (14:5ecd)
	TX_FAR _UnnamedText_51ecd
	db $50
; 0x51ecd + 5 bytes

SilphCo7Text15: ; 51ed2 (14:5ed2)
	TX_FAR _UnnamedText_51ed2
	db $50
; 0x51ed2 + 5 bytes

SilphCo7Object: ; 0x51ed7 (size=128)
	db $2e ; border tile

	db $6 ; warps
	db $0, $10, $1, SILPH_CO_8F
	db $0, $16, $0, SILPH_CO_6F
	db $0, $12, $0, SILPH_CO_ELEVATOR
	db $7, $5, $3, SILPH_CO_11F
	db $3, $5, $8, SILPH_CO_3F
	db $f, $15, $3, SILPH_CO_5F

	db $0 ; signs

	db $b ; people
	db SPRITE_LAPRAS_GIVER, $5 + 4, $1 + 4, $ff, $ff, $1 ; person
	db SPRITE_LAPRAS_GIVER, $d + 4, $d + 4, $ff, $d1, $2 ; person
	db SPRITE_LAPRAS_GIVER, $a + 4, $7 + 4, $ff, $ff, $3 ; person
	db SPRITE_ERIKA, $8 + 4, $a + 4, $ff, $ff, $4 ; person
	db SPRITE_ROCKET, $1 + 4, $d + 4, $ff, $d0, $45, ROCKET + $C8, $20 ; trainer
	db SPRITE_OAK_AIDE, $d + 4, $2 + 4, $ff, $d0, $46, SCIENTIST + $C8, $8 ; trainer
	db SPRITE_ROCKET, $2 + 4, $14 + 4, $ff, $d2, $47, ROCKET + $C8, $21 ; trainer
	db SPRITE_ROCKET, $e + 4, $13 + 4, $ff, $d3, $48, ROCKET + $C8, $22 ; trainer
	db SPRITE_BLUE, $7 + 4, $3 + 4, $ff, $d1, $9 ; person
	db SPRITE_BALL, $9 + 4, $1 + 4, $ff, $ff, $8a, CALCIUM ; item
	db SPRITE_BALL, $b + 4, $18 + 4, $ff, $ff, $8b, TM_03 ; item

	; warp-to
	EVENT_DISP $d, $0, $10 ; SILPH_CO_8F
	EVENT_DISP $d, $0, $16 ; SILPH_CO_6F
	EVENT_DISP $d, $0, $12 ; SILPH_CO_ELEVATOR
	EVENT_DISP $d, $7, $5 ; SILPH_CO_11F
	EVENT_DISP $d, $3, $5 ; SILPH_CO_3F
	EVENT_DISP $d, $f, $15 ; SILPH_CO_5F

SilphCo7Blocks: ; 51f57 (14:5f57)
	INCBIN "maps/silphco7.blk"

Mansion2_h: ; 0x51fcc to 0x51fd8 (12 bytes) (id=214)
	db $16 ; tileset
	db MANSION_2_HEIGHT, MANSION_2_WIDTH ; dimensions (y, x)
	dw Mansion2Blocks, Mansion2Texts, Mansion2Script ; blocks, texts, scripts
	db $00 ; connections

	dw Mansion2Object ; objects

Mansion2Script: ; 51fd8 (14:5fd8)
	call Mansion2Script_Unknown51fee
	call EnableAutoTextBoxDrawing
	ld hl, Mansion2TrainerHeaders
	ld de, Unknown_52047 ; $6047
	ld a, [W_MANSION2CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_MANSION2CURSCRIPT], a
	ret
; 0x51fee

Mansion2Script_Unknown51fee: ; 51fee (14:5fee)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld a, [$d796]
	bit 0, a
	jr nz, .asm_52016
	ld a, $e
	ld bc, $204
	call Func_5202f
	ld a, $54
	ld bc, $409
	call Func_5202f
	ld a, $5f
	ld bc, $b03
	call Func_5202f
	ret
.asm_52016
	ld a, $5f
	ld bc, $204
	call Func_5202f
	ld a, $e
	ld bc, $409
	call Func_5202f
	ld a, $e
	ld bc, $b03
	call Func_5202f
	ret

; known jump sources: 52002 (14:6002), 5200a (14:600a), 52012 (14:6012), 5201b (14:601b), 52023 (14:6023), 5202b (14:602b), 52218 (14:6218), 52220 (14:6220), 52229 (14:6229), 52231 (14:6231), 523e3 (14:63e3), 523eb (14:63eb), 523f3 (14:63f3), 523fb (14:63fb), 52404 (14:6404), 5240c (14:640c), 52414 (14:6414), 5241c (14:641c)
Func_5202f: ; 5202f (14:602f)
	ld [$d09f], a
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

INCBIN "baserom.gbc",$52037,$52047 - $52037

Unknown_52047: ; 52047 (14:6047)
INCBIN "baserom.gbc",$52047,$5204d - $52047

Mansion2Texts: ; 5204d (14:604d)
	dw Mansion2Text1, Predef5CText, Mansion2Text3, Mansion2Text4, Mansion2Text5

Mansion2TrainerHeaders: ; 52057 (14:6057)
Mansion2TrainerHeader0: ; 52057 (14:6057)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d847 ; flag's byte
	dw Mansion2BattleText1 ; 0x606e TextBeforeBattle
	dw Mansion2AfterBattleText1 ; 0x6078 TextAfterBattle
	dw Mansion2EndBattleText1 ; 0x6073 TextEndBattle
	dw Mansion2EndBattleText1 ; 0x6073 TextEndBattle
; 0x52063

db $ff

Mansion2Text1: ; 52064 (14:6064)
	db $08 ; asm
	ld hl, Mansion2TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Mansion2BattleText1: ; 5206e (14:606e)
	TX_FAR _Mansion2BattleText1
	db $50
; 0x5206e + 5 bytes

Mansion2EndBattleText1: ; 52073 (14:6073)
	TX_FAR _Mansion2EndBattleText1
	db $50
; 0x52073 + 5 bytes

Mansion2AfterBattleText1: ; 52078 (14:6078)
	TX_FAR _Mansion2AfterBattleText1
	db $50
; 0x52078 + 5 bytes

Mansion2Text3: ; 5207d (14:607d)
	TX_FAR _Mansion2Text3
	db $50

Mansion2Text4: ; 52082 (14:6082)
	TX_FAR _Mansion2Text4
	db $50

Mansion3Text6: ; 52087 (14:6087)
Mansion2Text5: ; 52087 (14:6087)
	db $8
	ld hl, UnnamedText_520c2
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_520b9 ; 0x52095 $22
	ld a, $1
	ld [$cc3c], a
	ld hl, $d126
	set 5, [hl]
	ld hl, UnnamedText_520c7
	call PrintText
	ld a, $ad
	call PlaySound
	ld hl, $d796
	bit 0, [hl]
	set 0, [hl]
	jr z, .asm_520bf ; 0x520b3 $a
	res 0, [hl]
	jr .asm_520bf ; 0x520b7 $6
.asm_520b9
	ld hl, UnnamedText_520cc
	call PrintText
.asm_520bf
	jp TextScriptEnd
; 0x520c2

UnnamedText_520c2: ; 520c2 (14:60c2)
	TX_FAR _UnnamedText_520c2
	db $50
; 0x520c2 + 5 bytes

UnnamedText_520c7: ; 520c7 (14:60c7)
	TX_FAR _UnnamedText_520c7
	db $50
; 0x520c7 + 5 bytes

UnnamedText_520cc: ; 520cc (14:60cc)
	TX_FAR _UnnamedText_520cc
	db $50
; 0x520cc + 5 bytes

Mansion2Object: ; 0x520d1 (size=63)
	db $1 ; border tile

	db $4 ; warps
	db $a, $5, $4, MANSION_1
	db $a, $7, $0, MANSION_3
	db $e, $19, $2, MANSION_3
	db $1, $6, $1, MANSION_3

	db $0 ; signs

	db $4 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $11 + 4, $3 + 4, $fe, $2, $41, BURGLAR + $C8, $7 ; trainer
	db SPRITE_BALL, $7 + 4, $1c + 4, $ff, $ff, $82, CALCIUM ; item
	db SPRITE_BOOK_MAP_DEX, $2 + 4, $12 + 4, $ff, $ff, $3 ; person
	db SPRITE_BOOK_MAP_DEX, $16 + 4, $3 + 4, $ff, $ff, $4 ; person

	; warp-to
	EVENT_DISP $f, $a, $5 ; MANSION_1
	EVENT_DISP $f, $a, $7 ; MANSION_3
	EVENT_DISP $f, $e, $19 ; MANSION_3
	EVENT_DISP $f, $1, $6 ; MANSION_3

Mansion2Blocks: ; 52110 (14:6110)
	INCBIN "maps/mansion2.blk"

Mansion3_h: ; 0x521e2 to 0x521ee (12 bytes) (id=215)
	db $16 ; tileset
	db MANSION_3_HEIGHT, MANSION_3_WIDTH ; dimensions (y, x)
	dw Mansion3Blocks, Mansion3Texts, Mansion3Script ; blocks, texts, scripts
	db $00 ; connections

	dw Mansion3Object ; objects

Mansion3Script: ; 521ee (14:61ee)
	call Unnamed_52204
	call EnableAutoTextBoxDrawing
	ld hl, Mansion3TrainerHeader0
	ld de, Unknown_52235 ; $6235
	ld a, [W_MANSION3CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_MANSION3CURSCRIPT], a
	ret
; 0x52204

Unnamed_52204: ; 52204 (14:6204)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld a, [$d796]
	bit 0, a
	jr nz, .asm_52224
	ld a, $e
	ld bc, $207
	call Func_5202f
	ld a, $5f
	ld bc, $507
	call Func_5202f
	ret
.asm_52224
	ld a, $5f
	ld bc, $207
	call Func_5202f
	ld a, $e
	ld bc, $507
	call Func_5202f
	ret

Unknown_52235: ; 52235 (14:6235)
INCBIN "baserom.gbc",$52235,$5223b - $52235
	ld hl, Unknown_52254 ; $6254
	call Func_5225b
	ld a, [$d71e]
	and a
	jp z, CheckFightingMapTrainers
	cp $3
	ld a, $a5
	jr nz, .asm_52250
	ld a, $d6
.asm_52250
	ld [$d71d], a
	ret

Unknown_52254: ; 52254 (14:6254)
INCBIN "baserom.gbc",$52254,$5225b - $52254

; known jump sources: 5223e (14:623e)
Func_5225b: ; 5225b (14:625b)
	xor a
	ld [$d71e], a
	ld a, [$d72d]
	bit 4, a
	ret nz
	call ArePlayerCoordsInArray
	ret nc
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [$d71e], a
	ld hl, $d72d
	set 4, [hl]
	ld hl, $d732
	set 4, [hl]
	ret
	ld a, [$c109]
	cp $4
	ret nz
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $6
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp DisplayTextID
; 5228a (14:628a)
Mansion3Texts: ; 5228a (14:628a)
	dw Mansion3Text1, Mansion3Text2, Predef5CText, Predef5CText, Mansion3Text5, Mansion3Text6

Mansion3TrainerHeaders: ; 52296 (14:6296)
Mansion3TrainerHeader0: ; 52296 (14:6296)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d849 ; flag's byte
	dw Mansion3BattleText1 ; 0x62c3 TextBeforeBattle
	dw Mansion3AfterBattleText1 ; 0x62cd TextAfterBattle
	dw Mansion3EndBattleText1 ; 0x62c8 TextEndBattle
	dw Mansion3EndBattleText1 ; 0x62c8 TextEndBattle
; 0x522a2

Mansion3TrainerHeader2: ; 522a2 (14:62a2)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d849 ; flag's byte
	dw Mansion3BattleText2 ; 0x62d2 TextBeforeBattle
	dw Mansion3AfterBattleText2 ; 0x62dc TextAfterBattle
	dw Mansion3EndBattleText2 ; 0x62d7 TextEndBattle
	dw Mansion3EndBattleText2 ; 0x62d7 TextEndBattle
; 0x522ae

db $ff

Mansion3Text1: ; 522af (14:62af)
	db $08 ; asm
	ld hl, Mansion3TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Mansion3Text2: ; 522b9 (14:62b9)
	db $08 ; asm
	ld hl, Mansion3TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Mansion3BattleText1: ; 522c3 (14:62c3)
	TX_FAR _Mansion3BattleText1
	db $50
; 0x522c3 + 5 bytes

Mansion3EndBattleText1: ; 522c8 (14:62c8)
	TX_FAR _Mansion3EndBattleText1
	db $50
; 0x522c8 + 5 bytes

Mansion3AfterBattleText1: ; 522cd (14:62cd)
	TX_FAR _Mansion3AfterBattleText1
	db $50
; 0x522cd + 5 bytes

Mansion3BattleText2: ; 522d2 (14:62d2)
	TX_FAR _Mansion3BattleText2
	db $50
; 0x522d2 + 5 bytes

Mansion3EndBattleText2: ; 522d7 (14:62d7)
	TX_FAR _Mansion3EndBattleText2
	db $50
; 0x522d7 + 5 bytes

Mansion3AfterBattleText2: ; 522dc (14:62dc)
	TX_FAR _Mansion3AfterBattleText2
	db $50
; 0x522dc + 5 bytes

Mansion3Text5: ; 522e1 (14:62e1)
	TX_FAR _Mansion3Text5
	db $50

Mansion3Object: ; 0x522e6 (size=64)
	db $1 ; border tile

	db $3 ; warps
	db $a, $7, $1, MANSION_2
	db $1, $6, $3, MANSION_2
	db $e, $19, $2, MANSION_2

	db $0 ; signs

	db $5 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $b + 4, $5 + 4, $fe, $2, $41, BURGLAR + $C8, $8 ; trainer
	db SPRITE_OAK_AIDE, $b + 4, $14 + 4, $ff, $d2, $42, SCIENTIST + $C8, $c ; trainer
	db SPRITE_BALL, $10 + 4, $1 + 4, $ff, $ff, $83, MAX_POTION ; item
	db SPRITE_BALL, $5 + 4, $19 + 4, $ff, $ff, $84, IRON ; item
	db SPRITE_BOOK_MAP_DEX, $c + 4, $6 + 4, $ff, $ff, $5 ; person

	; warp-to
	EVENT_DISP $f, $a, $7 ; MANSION_2
	EVENT_DISP $f, $1, $6 ; MANSION_2
	EVENT_DISP $f, $e, $19 ; MANSION_2

Mansion3Blocks: ; 52326 (14:6326)
	INCBIN "maps/mansion3.blk"

Mansion4_h: ; 0x523ad to 0x523b9 (12 bytes) (id=216)
	db $16 ; tileset
	db MANSION_4_HEIGHT, MANSION_4_WIDTH ; dimensions (y, x)
	dw Mansion4Blocks, Mansion4Texts, Mansion4Script ; blocks, texts, scripts
	db $00 ; connections

	dw Mansion4Object ; objects

Mansion4Script: ; 523b9 (14:63b9)
	call Unknown_523cf
	call EnableAutoTextBoxDrawing
	ld hl, Mansion4TrainerHeader0
	ld de, Unknown_52430 ; $6430
	ld a, [W_MANSION4CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_MANSION4CURSCRIPT], a
	ret
; 0x523cf

Unknown_523cf: ; 523cf (14:63cf)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld a, [$d796]
	bit 0, a
	jr nz, .asm_523ff
	ld a, $e
	ld bc, $80d
	call Func_5202f
	ld a, $e
	ld bc, $b06
	call Func_5202f
	ld a, $5f
	ld bc, $304
	call Func_5202f
	ld a, $54
	ld bc, $808
	call Func_5202f
	ret
.asm_523ff
	ld a, $2d
	ld bc, $80d
	call Func_5202f
	ld a, $5f
	ld bc, $b06
	call Func_5202f
	ld a, $e
	ld bc, $304
	call Func_5202f
	ld a, $e
	ld bc, $808
	call Func_5202f
	ret
	ld a, [$c109]
	cp $4
	ret nz
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $9
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp DisplayTextID

Unknown_52430: ; 52430 (14:6430)
INCBIN "baserom.gbc",$52430,$52436 - $52430

Mansion4Texts: ; 52436 (14:6436)
INCBIN "baserom.gbc",$52436,$52448 - $52436

Mansion4TrainerHeaders: ; 52448 (14:6448)
Mansion4TrainerHeader0: ; 52448 (14:6448)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d84b ; flag's byte
	dw Mansion4BattleText1 ; 0x6475 TextBeforeBattle
	dw Mansion4AfterBattleText1 ; 0x647f TextAfterBattle
	dw Mansion4EndBattleText1 ; 0x647a TextEndBattle
	dw Mansion4EndBattleText1 ; 0x647a TextEndBattle
; 0x52454

Mansion4TrainerHeader2: ; 52454 (14:6454)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d84b ; flag's byte
	dw Mansion4BattleText2 ; 0x6484 TextBeforeBattle
	dw Mansion4AfterBattleText2 ; 0x648e TextAfterBattle
	dw Mansion4EndBattleText2 ; 0x6489 TextEndBattle
	dw Mansion4EndBattleText2 ; 0x6489 TextEndBattle
; 0x52460

db $ff

Mansion4Text1: ; 52461 (14:6461)
	db $08 ; asm
	ld hl, Mansion4TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Mansion4Text2: ; 5246b (14:646b)
	db $08 ; asm
	ld hl, Mansion4TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Mansion4BattleText1: ; 52475 (14:6475)
	TX_FAR _Mansion4BattleText1
	db $50
; 0x52475 + 5 bytes

Mansion4EndBattleText1: ; 5247a (14:647a)
	TX_FAR _Mansion4EndBattleText1
	db $50
; 0x5247a + 5 bytes

Mansion4AfterBattleText1: ; 5247f (14:647f)
	TX_FAR _Mansion4AfterBattleText1
	db $50
; 0x5247f + 5 bytes

Mansion4BattleText2: ; 52484 (14:6484)
	TX_FAR _Mansion4BattleText2
	db $50
; 0x52484 + 5 bytes

Mansion4EndBattleText2: ; 52489 (14:6489)
	TX_FAR _Mansion4EndBattleText2
	db $50
; 0x52489 + 5 bytes

Mansion4AfterBattleText2: ; 5248e (14:648e)
	TX_FAR _Mansion4AfterBattleText2
	db $50
; 0x5248e + 5 bytes

Mansion4Text7: ; 52493 (14:6493)
	TX_FAR _Mansion4Text7
	db $50

Mansion4Object: ; 0x52498 (size=69)
	db $1 ; border tile

	db $1 ; warps
	db $16, $17, $5, MANSION_1

	db $0 ; signs

	db $8 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $17 + 4, $10 + 4, $ff, $ff, $41, BURGLAR + $C8, $9 ; trainer
	db SPRITE_OAK_AIDE, $b + 4, $1b + 4, $ff, $d0, $42, SCIENTIST + $C8, $d ; trainer
	db SPRITE_BALL, $2 + 4, $a + 4, $ff, $ff, $83, RARE_CANDY ; item
	db SPRITE_BALL, $16 + 4, $1 + 4, $ff, $ff, $84, FULL_RESTORE ; item
	db SPRITE_BALL, $19 + 4, $13 + 4, $ff, $ff, $85, TM_14 ; item
	db SPRITE_BALL, $4 + 4, $5 + 4, $ff, $ff, $86, TM_22 ; item
	db SPRITE_BOOK_MAP_DEX, $14 + 4, $10 + 4, $ff, $ff, $7 ; person
	db SPRITE_BALL, $d + 4, $5 + 4, $ff, $ff, $88, SECRET_KEY ; item

	; warp-to
	EVENT_DISP $f, $16, $17 ; MANSION_1

Mansion4Blocks: ; 524dd (14:64dd)
	INCBIN "maps/mansion4.blk"

; known jump sources: 3ef4d (f:6f4d)
Func_525af: ; 525af (14:65af)
	ld a, [$FF00+$d7]
	ld [$d0d4], a
	xor a
	ld [$cd6a], a
	ld [$cf0b], a
	ld hl, $cc2b
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld [W_LISTSCROLLOFFSET], a ; $cc36
	ld [$d05e], a
	ld [W_PLAYERMONID], a
	ld [W_PLAYERMONSALIVEFLAGS], a
	ld [W_PLAYERMONNUMBER], a ; $cc2f
	ld [$d078], a
	ld [$d35d], a
	ld hl, $cf1d
	ld [hli], a
	ld [hl], a
	ld hl, $ccd3
	ld b, $3c
.asm_525e1
	ld [hli], a
	dec b
	jr nz, .asm_525e1
	inc a
	ld [$ccd9], a
	ld a, [W_CURMAP] ; $d35e
	cp $d9
	jr c, .asm_525f9
	cp $dd
	jr nc, .asm_525f9
	ld a, $2
	ld [W_BATTLETYPE], a ; $d05a
.asm_525f9
	ld hl, Func_90c6
	ld b, BANK(Func_90c6)
	jp Bankswitch ; indirect jump to Func_90c6 (90c6 (2:50c6))

; known jump sources: 3f9b6 (f:79b6)
Func_52601: ; 52601 (14:6601)
	ld hl, W_ENEMYMONSTATUS ; $cfe9
	ld de, W_PLAYERMOVETYPE ; $cfd5
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jp z, Func_52613
	ld hl, W_PLAYERMONSTATUS ; $d018
	ld de, W_ENEMYMOVETYPE ; $cfcf

; known jump sources: 5260a (14:660a)
Func_52613: ; 52613 (14:6613)
	ld a, [hl]
	and a
	jr nz, .asm_52659
	ld a, [de]
	cp $17
	jr nz, .asm_5262a
	ld b, h
	ld c, l
	inc bc
	ld a, [bc]
	cp $4
	jr z, .asm_52666
	inc bc
	ld a, [bc]
	cp $4
	jr z, .asm_52666
.asm_5262a
	push hl
	ld hl, MoveHitTest
	ld b, BANK(MoveHitTest)
	call Bankswitch ; indirect jump to MoveHitTest (3e56b (f:656b))
	pop hl
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	jr nz, .asm_52659
	set 6, [hl]
	ld hl, Func_3ed27
	ld b, BANK(Func_3ed27)
	call Bankswitch ; indirect jump to Func_3ed27 (3ed27 (f:6d27))
	ld c, $1e
	call DelayFrames
	ld hl, Func_3fba8
	ld b, BANK(Func_3fba8)
	call Bankswitch ; indirect jump to Func_3fba8 (3fba8 (f:7ba8))
	ld hl, Func_3fb6e
	ld b, BANK(Func_3fb6e)
	jp Bankswitch ; indirect jump to Func_3fb6e (3fb6e (f:7b6e))
.asm_52659
	ld c, $32
	call DelayFrames
	ld hl, Func_3fb5e
	ld b, BANK(Func_3fb5e)
	jp Bankswitch ; indirect jump to Func_3fb5e (3fb5e (f:7b5e))
.asm_52666
	ld c, $32
	call DelayFrames
	ld hl, Func_3dc51
	ld b, BANK(Func_3dc51)
	jp Bankswitch ; indirect jump to Func_3dc51 (3dc51 (f:5c51))

; known jump sources: fb88 (3:7b88)
Func_52673: ; 52673 (14:6673)
	ld hl, Unknown_526e3 ; $66e3
	ld a, [W_CURMAP] ; $d35e
	ld b, a
.asm_5267a
	ld a, [hli]
	cp $ff
	ret z
	cp b
	jr nz, .asm_5267a
	ld a, $35
	call Predef ; indirect jump to Func_c586 (c586 (3:4586))
	ld a, [$cfc6]
	cp $18
	jr z, .asm_5269c
	cp $24
	jr z, .asm_5269c
	ld b, a
	ld a, [W_CURMAP] ; $d35e
	cp $eb
	ret nz
	ld a, b
	cp $5e
	ret nz
.asm_5269c
	ld b, $30
	call IsItemInBag
	jr z, .asm_526dc
	call Func_526fd
	push de
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call Func_3ef5
	pop de
	srl d
	ld a, d
	ld b, a
	ld [$d73f], a
	srl e
	ld a, e
	ld c, a
	ld [$d740], a
	ld a, [W_CURMAP] ; $d35e
	cp $eb
	jr nz, .asm_526c8
	ld a, $3
	jr .asm_526ca
.asm_526c8
	ld a, $e
.asm_526ca
	ld [$d09f], a
	ld a, $17
	call Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))
	ld hl, $d126
	set 5, [hl]
	ld a, $ad
	jp PlaySound
.asm_526dc
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp Func_3ef5

Unknown_526e3: ; 526e3 (14:66e3)
INCBIN "baserom.gbc",$526e3,$526f3 - $526e3

UnnamedText_526f3: ; 526f3 (14:66f3)
	TX_FAR _UnnamedText_526f3
	db $50
; 0x526f3 + 5 bytes

UnnamedText_526f8: ; 526f8 (14:66f8)
	TX_FAR _UnnamedText_526f8
	db $50
; 0x526f8 + 5 bytes

; known jump sources: 526a3 (14:66a3)
Func_526fd: ; 526fd (14:66fd)
	ld a, [W_YCOORD] ; $d361
	ld d, a
	ld a, [W_XCOORD] ; $d362
	ld e, a
	ld a, [$c109]
	and a
	jr nz, .asm_5270d
	inc d
	ret
.asm_5270d
	cp $4
	jr nz, .asm_52713
	dec d
	ret
.asm_52713
	cp $8
	jr nz, .asm_52719
	dec e
	ret
.asm_52719
	inc e
	ret
; 5271b (14:671b)
CeladonPrizeMenu: ; 5271b (14:671b)
	ld b,COIN_CASE
	call IsItemInBag
	jr nz,.havingCoinCase
	ld hl,RequireCoinCaseTextPtr
	jp PrintText
.havingCoinCase
	ld hl,$D730
	set 6,[hl]
	ld hl,ExchangeCoinsForPrizesTextPtr
	call PrintText
; the following are the menu settings
	xor a
	ld [$CC26],a
	ld [$CC2A],a
	ld a,$03
	ld [$CC29],a
	ld a,$03
	ld [$CC28],a
	ld a,$04
	ld [$CC24],a
	ld a,$01
	ld [$CC25],a
	call PrintPrizePrice ; 687A
	FuncCoord 0,2
	ld hl,Coord
	ld b,$08
	ld c,$10
	call TextBoxBorder
	call GetPrizeMenuId ;678E
	call UpdateSprites
	ld hl,WhichPrizeTextPtr
	call PrintText
	call HandleMenuInput ; menu choice handler
	bit 1,a ; keypress = B (Cancel)
	jr nz,.NoChoice
	ld a,[$CC26]
	cp a,$03 ; "NO,THANKS" choice
	jr z,.NoChoice
	call HandlePrizeChoice ; 14:68C6
.NoChoice
	ld hl,$D730
	res 6,[hl]
	ret

RequireCoinCaseTextPtr: ; 5277e (14:677e)
	TX_FAR _RequireCoinCaseText ; 22:628E
	db $0D
	db "@"

ExchangeCoinsForPrizesTextPtr: ; 52784 (14:6784)
	TX_FAR _ExchangeCoinsForPrizesText ; 22:62A9
	db "@"

WhichPrizeTextPtr: ; 52789 (14:6789)
	TX_FAR _WhichPrizeText ; 22:62CD
	db "@"

GetPrizeMenuId: ; 5278e (14:678e)
; determine which one among the three
; prize-texts has been selected
; using the text ID (stored in [$FF8C])
; load the three prizes at $D13D-$D13F
; load the three prices ar $D141-$D146
; display the three prizes' names
; (distinguishing between Pokemon names
; and Items (specifically TMs) names)
	ld a,[$FF8C]
	sub a,$03       ; prize-texts' id are 3, 4 and 5
	ld [$D12F],a    ; prize-texts' id (relative, i.e. 0, 1 or 2)
	add a
	add a
	ld d,$00
	ld e,a
	ld hl,PrizeDifferentMenuPtrs
	add hl,de
	ld a,[hli]
	ld d,[hl]
	ld e,a
	inc hl
	push hl
	ld hl,W_PRIZE1
	call CopyString      ; XXX what does this do
	pop hl
	ld a,[hli]
	ld h,[hl]
	ld l,a
	ld de,$D141
	ld bc,$0006
	call CopyData
	ld a,[$D12F]
	cp a,$02        ;is TM_menu?
	jr nz,.putMonName
	ld a,[W_PRIZE1]
	ld [$D11E],a
	call GetItemName
	FuncCoord 2,4
	ld hl,Coord
	call PlaceString
	ld a,[W_PRIZE2]
	ld [$D11E],a
	call GetItemName
	FuncCoord 2,6
	ld hl,Coord
	call PlaceString
	ld a,[W_PRIZE3]
	ld [$D11E],a
	call GetItemName
	FuncCoord 2,8
	ld hl,Coord
	call PlaceString
	jr .putNoThanksText
.putMonName ; 14:67EC
	ld a,[W_PRIZE1]
	ld [$D11E],a
	call GetMonName
	FuncCoord 2,4
	ld hl,Coord
	call PlaceString
	ld a,[W_PRIZE2]
	ld [$D11E],a
	call GetMonName
	FuncCoord 2,6
	ld hl,Coord
	call PlaceString
	ld a,[W_PRIZE3]
	ld [$D11E],a
	call GetMonName
	FuncCoord 2,8
	ld hl,Coord
	call PlaceString
.putNoThanksText ; 14:6819
	FuncCoord 2,10
	ld hl,Coord
	ld de,NoThanksText
	call PlaceString
; put prices on the right side of the textbox
	ld de,$D141
	FuncCoord 13,5
	ld hl,Coord
; reg. c:
; [low nybble] number of bytes
; [bit 765 = %100] space-padding (not zero-padding)
	ld c,(1 << 7 | 2)
; Function $15CD displays BCD value (same routine
; used by text-command $02)
	call PrintBCDNumber ; Print_BCD
	ld de,$D143
	FuncCoord 13,7
	ld hl,Coord
	ld c,(%1 << 7 | 2)
	call PrintBCDNumber
	ld de,$D145
	FuncCoord 13,9
	ld hl,Coord
	ld c,(1 << 7 | 2)
	jp PrintBCDNumber

PrizeDifferentMenuPtrs: ; 52843 (14:6843)
	dw PrizeMenuMon1Entries
	dw PrizeMenuMon1Cost

	dw PrizeMenuMon2Entries
	dw PrizeMenuMon2Cost

	dw PrizeMenuTMsEntries
	dw PrizeMenuTMsCost

NoThanksText: ; 5284f (14:684f)
	db "NO THANKS@"

PrizeMenuMon1Entries: ; 52859 (14:6859)
	db ABRA
	db CLEFAIRY
IF _RED
	db NIDORINA
ENDC
IF _BLUE
	db NIDORINO
ENDC
	db "@"
PrizeMenuMon1Cost: ; 5285d (14:685d)
IF _RED
	db $01,$80
	db $05,$00
ENDC
IF _BLUE
	db $01,$20
	db $07,$50
ENDC
	db $12,$00
	db "@"

PrizeMenuMon2Entries: ; 52864 (14:6864)
IF _RED
	db DRATINI
	db SCYTHER
ENDC
IF _BLUE
	db PINSIR
	db DRATINI
ENDC
	db PORYGON
	db "@"
PrizeMenuMon2Cost: ; 52868 (14:6868)
IF _RED
	db $28,$00
	db $55,$00
	db $99,$99
ENDC
IF _BLUE
	db $25,$00
	db $46,$00
	db $65,$00
ENDC
	db "@"

PrizeMenuTMsEntries: ; 5286f (14:686f)
	db TM_23
	db TM_15
	db TM_50
	db "@"
PrizeMenuTMsCost: ; 52873 (14:6873)
	db $33,$00 ; 3300 Coins
	db $55,$00 ; 5500 Coins
	db $77,$00 ; 7700 Coins
	db "@"

PrintPrizePrice: ; 5287a (14:687a)
	FuncCoord 11,0
	ld hl,Coord
	ld b,$01
	ld c,$07
	call TextBoxBorder
	call UpdateSprites      ; XXX save OAM?
	FuncCoord 12,0
	ld hl,Coord
	ld de,.CoinText
	call PlaceString
	FuncCoord 13,1
	ld hl,Coord
	ld de,.SixSpacesText
	call PlaceString
	FuncCoord 13,1
	ld hl,Coord
	ld de,W_PLAYERCOINS1
	ld c,%10000010
	call PrintBCDNumber
	ret

.CoinText ; 14:68A5
	db "COIN@"

.SixSpacesText ; 14:68AA
	db "      @"

LoadCoinsToSubtract: ; 528b1 (14:68b1)
	ld a,[$D139] ; backup of selected menu_entry
	add a
	ld d,$00
	ld e,a
	ld hl,$D141 ; first prize's price
	add hl,de ; get selected prize's price
	xor a
	ld [$FF9F],a
	ld a,[hli]
	ld [$FFA0],a
	ld a,[hl]
	ld [$FFA1],a
	ret

HandlePrizeChoice: ; 528c6 (14:68c6)
	ld a,[$CC26] ; selected menu_entry
	ld [$D139],a
	ld d,$00
	ld e,a
	ld hl,W_PRIZE1
	add hl,de
	ld a,[hl]
	ld [$D11E],a
	ld a,[$D12F]
	cp a,$02 ; is prize a TM?
	jr nz,.GetMonName
	call GetItemName
	jr .GivePrize
.GetMonName ; 14:68E3
	call GetMonName
.GivePrize ; 14:68E6
	ld hl,SoYouWantPrizeTextPtr
	call PrintText
	call YesNoChoice ; yes/no textbox
	ld a,[$CC26] ; yes/no answer (Y=0, N=1)
	and a
	jr nz,.PrintOhFineThen
	call LoadCoinsToSubtract
	call HasEnoughCoins
	jr c,.NotEnoughCoins
	ld a,[$D12F]
	cp a,$02
	jr nz,.GiveMon
	ld a,[$D11E]
	ld b,a
	ld a,1
	ld c,a
	call GiveItem ; GiveItem
	jr nc,.BagFull
	jr .SubtractCoins
.GiveMon ; 14:6912
	ld a,[$D11E]
	ld [$CF91],a
	push af
	call GetPrizeMonLevel ; 14:6977
	ld c,a
	pop af
	ld b,a
	call GivePokemon
	push af
	ld a,[$CCD3] ; XXX is there room?
	and a
	call z,WaitForTextScrollButtonPress
	pop af
	ret nc
.SubtractCoins ; 14:692C
	call LoadCoinsToSubtract
	ld hl,$FFA1
	ld de,W_PLAYERCOINS2
	ld c,$02 ; how many bytes
	ld a,$0C
	call Predef ; subtract coins (BCD daa operations)
	jp PrintPrizePrice
.BagFull
	ld hl,PrizeRoomBagIsFullTextPtr
	jp PrintText
.NotEnoughCoins ; 14:6945
	ld hl,SorryNeedMoreCoinsTextPtr
	jp PrintText
.PrintOhFineThen ; 14:694B
	ld hl,OhFineThenTextPtr
	jp PrintText

UnknownData52951: ; 52951 (14:6951)
; XXX what's this?
	db $00,$01,$00,$01,$00,$01,$00,$00,$01

HereYouGoTextPtr: ; 5295a (14:695a)
	TX_FAR _HereYouGoText ; 22:62E7
	db $0D
	db "@"

SoYouWantPrizeTextPtr: ; 52960 (14:6960)
	TX_FAR _SoYouWantPrizeText ; 22:62F6
	db "@"

SorryNeedMoreCoinsTextPtr: ; 52965 (14:6965)
	TX_FAR _SorryNeedMoreCoins ; 22:630B
	db $0D
	db "@"

PrizeRoomBagIsFullTextPtr: ; 5296b (14:696b)
	TX_FAR _OopsYouDontHaveEnoughRoomText ; 22:6329
	db $0D
	db "@"

OhFineThenTextPtr: ; 52971 (14:6971)
	TX_FAR _OhFineThenText; 22:634C
	db $0D ; wait keypress (A/B) without blink
	db "@"

GetPrizeMonLevel: ; 52977 (14:6977)
	ld a,[$CF91]
	ld b,a
	ld hl,PrizeMonLevelDictionary
.loop ; 14:697E
	ld a,[hli]
	cp b
	jr z,.matchFound
	inc hl
	jr .loop
.matchFound ; 14:6985
	ld a,[hl]
	ld [$D127],a
	ret

PrizeMonLevelDictionary: ; 5298a (14:698a)
IF _RED
	db ABRA,9
	db CLEFAIRY,8
	db NIDORINA,17

	db DRATINI,18
	db SCYTHER,25
	db PORYGON,26
ENDC
IF _BLUE
	db ABRA,6
	db CLEFAIRY,12
	db NIDORINO,17

	db PINSIR,20
	db DRATINI,24
	db PORYGON,18
ENDC

INCBIN "baserom.gbc",$52996,$529e9 - $52996

UnnamedText_529e9: ; 529e9 (14:69e9)
	TX_FAR _UnnamedText_529e9
	db $50
; 0x529e9 + 5 bytes

INCBIN "baserom.gbc",$529ee,$529f4 - $529ee

UnnamedText_529f4: ; 529f4 (14:69f4)
	TX_FAR _UnnamedText_529f4
	db $50
; 0x529f4 + 5 bytes

UnnamedText_529f9: ; 529f9 (14:69f9)
	TX_FAR _UnnamedText_529f9
	db $50
; 0x529f9 + 5 bytes

UnnamedText_529fe: ; 529fe (14:69fe)
	TX_FAR _UnnamedText_529fe
	db $50
; 0x529fe + 5 bytes

UnnamedText_52a03: ; 52a03 (14:6a03)
	TX_FAR _UnnamedText_52a03
	db $50
; 0x52a03 + 5 bytes

INCBIN "baserom.gbc",$52a08,$52a10 - $52a08

UnnamedText_52a10: ; 52a10 (14:6a10)
	TX_FAR _UnnamedText_52a10
	db $50
; 0x52a10 + 5 bytes

INCBIN "baserom.gbc",$52a15,$52a1d - $52a15

UnnamedText_52a1d: ; 52a1d (14:6a1d)
	TX_FAR _UnnamedText_52a1d
	db $50
; 0x52a1d + 5 bytes

INCBIN "baserom.gbc",$52a22,$52a2a - $52a22

UnnamedText_52a2a: ; 52a2a (14:6a2a)
	TX_FAR _UnnamedText_52a2a
	db $50
; 0x52a2a + 5 bytes

INCBIN "baserom.gbc",$52a2f,$52a3d - $52a2f

UnnamedText_52a3d: ; 52a3d (14:6a3d)
	TX_FAR _UnnamedText_52a3d
	db $50
; 0x52a3d + 5 bytes

SECTION "bank15",ROMX,BANK[$15]

Route2_h: ; 54000 (15:4000)
	db 00 ; Tileset
	db ROUTE_2_HEIGHT,ROUTE_2_WIDTH ;Height,Width blocks (1 block = 4x4 tiles)
	dw Route2Blocks ;Map-Pointer
	dw Route2Texts ;Maps text pointer
	dw Route2Script ;Maps script pointer
	db NORTH | SOUTH ;Connection Byte

	;Connection data
	db PEWTER_CITY ;Map
	dw $4714 ;y, x Strip Starting Point
	dw $C6E8 ;Strip X-Offset to current map
	db 16 ;"Bigness" (Unsure) ;Something to do with MapData
	db 20 ;"Map Width" (Unsure) ;Something to do with TileSet
	db 35 ;Player's new Y-Coordinates
	db 10 ;Player's new X-Coordinates
	dw $C8BD ;New UL Block Pos (Window)

	db VIRIDIAN_CITY ;Map
	dw $43EE ;y, x Strip Starting Point
	dw $C958 ;Strip X-Offset to current map
	db 16 ;"Bigness" (Unsure) ;Something to do with MapData
	db 20 ;"Map Width" (Unsure) ;Something to do with TileSet
	db 0 ;Player's new Y-Coordinates
	db 10 ;Player's new X-Coordinates
	dw $C703 ;New UL Block Pos (Window)

	dw Route2Object ;Object Data Pointer

Route2Object: ; 0x54022 (size=72)
	db $f ; border tile

	db $6 ; warps
	db $9, $c, $0, DIGLETTS_CAVE_EXIT
	db $b, $3, $1, VIRIDIAN_FOREST_EXIT
	db $13, $f, $0, ROUTE_2_HOUSE
	db $23, $10, $1, ROUTE_2_GATE
	db $27, $f, $2, ROUTE_2_GATE
	db $2b, $3, $2, VIRIDIAN_FOREST_ENTRANCE

	db $2 ; signs
	db $41, $5, $3 ; Route2Text3
	db $b, $b, $4 ; Route2Text4

	db $2 ; people
	db SPRITE_BALL, $36 + 4, $d + 4, $ff, $ff, $81, MOON_STONE ; item
	db SPRITE_BALL, $2d + 4, $d + 4, $ff, $ff, $82, HP_UP ; item

	; warp-to
	EVENT_DISP $a, $9, $c ; DIGLETTS_CAVE_EXIT
	EVENT_DISP $a, $b, $3 ; VIRIDIAN_FOREST_EXIT
	EVENT_DISP $a, $13, $f ; ROUTE_2_HOUSE
	EVENT_DISP $a, $23, $10 ; ROUTE_2_GATE
	EVENT_DISP $a, $27, $f ; ROUTE_2_GATE
	EVENT_DISP $a, $2b, $3 ; VIRIDIAN_FOREST_ENTRANCE

INCBIN "baserom.gbc",$5406a,$5407e - $5406a

Route2Blocks: ; 5407e (15:407e)
	INCBIN "maps/route2.blk"

Route3_h: ; 0x541e6 to 0x54208 (34 bytes) (id=14)
	db $00 ; tileset
	db ROUTE_3_HEIGHT, ROUTE_3_WIDTH ; dimensions (y, x)
	dw Route3Blocks, Route3Texts, Route3Script ; blocks, texts, scripts
	db NORTH | WEST ; connections

	; connections data

	db ROUTE_4
	dw Route4Blocks + (ROUTE_4_HEIGHT - 3) * ROUTE_4_WIDTH ; connection strip location
	dw $C6EB + 25 ; current map position
	db $d, ROUTE_4_WIDTH ; bigness, width
	db (ROUTE_4_HEIGHT * 2) - 1, (25 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_4_HEIGHT * (ROUTE_4_WIDTH + 6) ; window

	db PEWTER_CITY
	dw PewterCityBlocks - 3 + (PEWTER_CITY_WIDTH * 2) ; connection strip location
	dw $C6E8 + (ROUTE_3_WIDTH + 6) * (-3 + 3) ; current map position
	db $f, PEWTER_CITY_WIDTH ; bigness, width
	db (-4 * -2), (PEWTER_CITY_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * PEWTER_CITY_WIDTH ; window

	; end connections data

	dw Route3Object ; objects

Route3Object: ; 0x54208 (size=77)
	db $2c ; border tile

	db $0 ; warps

	db $1 ; signs
	db $9, $3b, $a ; Route3Text10

	db $9 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $b + 4, $39 + 4, $ff, $ff, $1 ; person
	db SPRITE_BUG_CATCHER, $6 + 4, $a + 4, $ff, $d3, $42, BUG_CATCHER + $C8, $4 ; trainer
	db SPRITE_BUG_CATCHER, $4 + 4, $e + 4, $ff, $d0, $43, YOUNGSTER + $C8, $1 ; trainer
	db SPRITE_LASS, $9 + 4, $10 + 4, $ff, $d2, $44, LASS + $C8, $1 ; trainer
	db SPRITE_BUG_CATCHER, $5 + 4, $13 + 4, $ff, $d0, $45, BUG_CATCHER + $C8, $5 ; trainer
	db SPRITE_LASS, $4 + 4, $17 + 4, $ff, $d2, $46, LASS + $C8, $2 ; trainer
	db SPRITE_BUG_CATCHER, $9 + 4, $16 + 4, $ff, $d2, $47, YOUNGSTER + $C8, $2 ; trainer
	db SPRITE_BUG_CATCHER, $6 + 4, $18 + 4, $ff, $d3, $48, BUG_CATCHER + $C8, $6 ; trainer
	db SPRITE_LASS, $a + 4, $21 + 4, $ff, $d1, $49, LASS + $C8, $3 ; trainer

Route3Blocks: ; 54255 (15:4255)
	INCBIN "maps/route3.blk"

Route4_h: ; 0x54390 to 0x543b2 (34 bytes) (id=15)
	db $00 ; tileset
	db ROUTE_4_HEIGHT, ROUTE_4_WIDTH ; dimensions (y, x)
	dw Route4Blocks, Route4Texts, Route4Script; blocks, texts, scripts
	db SOUTH | EAST ; connections

	; connections data

	db ROUTE_3
	dw Route3Blocks + 22 ; connection strip location
	dw $C6EB + (ROUTE_4_HEIGHT + 3) * (ROUTE_4_WIDTH + 6) + -3 ; current map position
	db $d, ROUTE_3_WIDTH ; bigness, width
	db 0, (-25 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_3_WIDTH ; window

	db CERULEAN_CITY
	dw CeruleanCityBlocks + (CERULEAN_CITY_WIDTH) ; connection strip location
	dw $C6E5 + (ROUTE_4_WIDTH + 6) * (-3 + 4) ; current map position
	db $f, CERULEAN_CITY_WIDTH ; bigness, width
	db (-4 * -2), 0 ; alignments (y, x)
	dw $C6EF + CERULEAN_CITY_WIDTH ; window

	; end connections data

	dw Route4Object ; objects

Route4Object: ; 0x543b2 (size=58)
	db $2c ; border tile

	db $3 ; warps
	db $5, $b, $0, MT_MOON_POKECENTER
	db $5, $12, $0, MT_MOON_1
	db $5, $18, $7, MT_MOON_2

	db $3 ; signs
	db $5, $c, $4 ; PokeCenterSignText
	db $7, $11, $5 ; Route4Text5
	db $7, $1b, $6 ; Route4Text6

	db $3 ; people
	db SPRITE_LASS, $8 + 4, $9 + 4, $fe, $0, $1 ; person
	db SPRITE_LASS, $3 + 4, $3f + 4, $ff, $d3, $42, LASS + $C8, $4 ; trainer
	db SPRITE_BALL, $3 + 4, $39 + 4, $ff, $ff, $83, TM_04 ; item

	; warp-to
	EVENT_DISP $2d, $5, $b ; MT_MOON_POKECENTER
	EVENT_DISP $2d, $5, $12 ; MT_MOON_1
	EVENT_DISP $2d, $5, $18 ; MT_MOON_2

Route4Blocks: ; 543ec (15:43ec)
	INCBIN "maps/route4.blk"

Route5_h: ; 0x54581 to 0x545a3 (34 bytes) (id=16)
	db $00 ; tileset
	db ROUTE_5_HEIGHT, ROUTE_5_WIDTH ; dimensions (y, x)
	dw Route5Blocks, Route5Texts, Route5Script ; blocks, texts, scripts
	db NORTH | SOUTH ; connections

	; connections data

	db CERULEAN_CITY
	dw CeruleanCityBlocks + (CERULEAN_CITY_HEIGHT - 3) * CERULEAN_CITY_WIDTH + 2 ; connection strip location
	dw $C6EB + -3 ; current map position
	db $10, CERULEAN_CITY_WIDTH ; bigness, width
	db (CERULEAN_CITY_HEIGHT * 2) - 1, (-5 * -2) ; alignments (y, x)
	dw $C6E9 + CERULEAN_CITY_HEIGHT * (CERULEAN_CITY_WIDTH + 6) ; window

	db SAFFRON_CITY
	dw SaffronCityBlocks + 2 ; connection strip location
	dw $C6EB + (ROUTE_5_HEIGHT + 3) * (ROUTE_5_WIDTH + 6) + -3 ; current map position
	db $10, SAFFRON_CITY_WIDTH ; bigness, width
	db 0, (-5 * -2) ; alignments (y, x)
	dw $C6EF + SAFFRON_CITY_WIDTH ; window

	; end connections data

	dw Route5Object ; objects

Route5Object: ; 0x545a3 (size=47)
	db $a ; border tile

	db $5 ; warps
	db $1d, $a, $3, ROUTE_5_GATE
	db $1d, $9, $2, ROUTE_5_GATE
	db $21, $a, $0, ROUTE_5_GATE
	db $1b, $11, $0, PATH_ENTRANCE_ROUTE_5
	db $15, $a, $0, DAYCAREM

	db $1 ; signs
	db $1d, $11, $1 ; Route5Text1

	db $0 ; people

	; warp-to
	EVENT_DISP $a, $1d, $a ; ROUTE_5_GATE
	EVENT_DISP $a, $1d, $9 ; ROUTE_5_GATE
	EVENT_DISP $a, $21, $a ; ROUTE_5_GATE
	EVENT_DISP $a, $1b, $11 ; PATH_ENTRANCE_ROUTE_5
	EVENT_DISP $a, $15, $a ; DAYCAREM

Route5Blocks: ; 545d2 (15:45d2)
	INCBIN "maps/route5.blk"

Route9_h: ; 0x54686 to 0x546a8 (34 bytes) (id=20)
	db $00 ; tileset
	db ROUTE_9_HEIGHT, ROUTE_9_WIDTH ; dimensions (y, x)
	dw Route9Blocks, Route9Texts, Route9Script ; blocks, texts, scripts
	db WEST | EAST ; connections

	; connections data

	db CERULEAN_CITY
	dw CeruleanCityBlocks - 3 + (CERULEAN_CITY_WIDTH * 2) ; connection strip location
	dw $C6E8 + (ROUTE_9_WIDTH + 6) * (-3 + 3) ; current map position
	db $f, CERULEAN_CITY_WIDTH ; bigness, width
	db (-4 * -2), (CERULEAN_CITY_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * CERULEAN_CITY_WIDTH ; window

	db ROUTE_10
	dw Route10Blocks + (ROUTE_10_WIDTH * 0) ; connection strip location
	dw $C6E5 + (ROUTE_9_WIDTH + 6) * (0 + 4) ; current map position
	db $c, ROUTE_10_WIDTH ; bigness, width
	db (0 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_10_WIDTH ; window

	; end connections data

	dw Route9Object ; objects

Route9Object: ; 0x546a8 (size=86)
	db $2c ; border tile

	db $0 ; warps

	db $1 ; signs
	db $7, $19, $b ; Route9Text11

	db $a ; people
	db SPRITE_LASS, $a + 4, $d + 4, $ff, $d2, $41, JR__TRAINER_F + $C8, $5 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $7 + 4, $18 + 4, $ff, $d2, $42, JR__TRAINER_M + $C8, $7 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $7 + 4, $1f + 4, $ff, $d3, $43, JR__TRAINER_M + $C8, $8 ; trainer
	db SPRITE_LASS, $8 + 4, $30 + 4, $ff, $d3, $44, JR__TRAINER_F + $C8, $6 ; trainer
	db SPRITE_HIKER, $f + 4, $10 + 4, $ff, $d2, $45, HIKER + $C8, $b ; trainer
	db SPRITE_HIKER, $3 + 4, $2b + 4, $ff, $d2, $46, HIKER + $C8, $6 ; trainer
	db SPRITE_BUG_CATCHER, $2 + 4, $16 + 4, $ff, $d0, $47, BUG_CATCHER + $C8, $d ; trainer
	db SPRITE_HIKER, $f + 4, $2d + 4, $ff, $d3, $48, HIKER + $C8, $5 ; trainer
	db SPRITE_BUG_CATCHER, $8 + 4, $28 + 4, $ff, $d3, $49, BUG_CATCHER + $C8, $e ; trainer
	db SPRITE_BALL, $f + 4, $a + 4, $ff, $ff, $8a, TM_30 ; item

Route9Blocks: ; 546fe (15:46fe)
	INCBIN "maps/route9.blk"

Route13_h: ; 0x5480c to 0x5482e (34 bytes) (id=24)
	db $00 ; tileset
	db ROUTE_13_HEIGHT, ROUTE_13_WIDTH ; dimensions (y, x)
	dw Route13Blocks, Route13Texts, Route13Script ; blocks, texts, scripts
	db NORTH | WEST ; connections

	; connections data

	db ROUTE_12
	dw Route12Blocks + (ROUTE_12_HEIGHT - 3) * ROUTE_12_WIDTH ; connection strip location
	dw $C6EB + 20 ; current map position
	db ROUTE_12_WIDTH, ROUTE_12_WIDTH ; bigness, width
	db (ROUTE_12_HEIGHT * 2) - 1, (20 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_12_HEIGHT * (ROUTE_12_WIDTH + 6) ; window

	db ROUTE_14
	dw Route14Blocks - 3 + (ROUTE_14_WIDTH) ; connection strip location
	dw $C6E8 + (ROUTE_13_WIDTH + 6) * (0 + 3) ; current map position
	db $c, ROUTE_14_WIDTH ; bigness, width
	db (0 * -2), (ROUTE_14_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_14_WIDTH ; window

	; end connections data

	dw Route13Object ; objects

Route13Object: ; 0x5482e (size=93)
	db $43 ; border tile

	db $0 ; warps

	db $3 ; signs
	db $d, $f, $b ; Route13Text11
	db $5, $21, $c ; Route13Text12
	db $b, $1f, $d ; Route13Text13

	db $a ; people
	db SPRITE_BLACK_HAIR_BOY_1, $a + 4, $31 + 4, $ff, $d3, $41, BIRD_KEEPER + $C8, $1 ; trainer
	db SPRITE_LASS, $a + 4, $30 + 4, $ff, $d0, $42, JR__TRAINER_F + $C8, $c ; trainer
	db SPRITE_LASS, $9 + 4, $1b + 4, $ff, $d0, $43, JR__TRAINER_F + $C8, $d ; trainer
	db SPRITE_LASS, $a + 4, $17 + 4, $ff, $d2, $44, JR__TRAINER_F + $C8, $e ; trainer
	db SPRITE_LASS, $5 + 4, $32 + 4, $ff, $d0, $45, JR__TRAINER_F + $C8, $f ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $4 + 4, $c + 4, $ff, $d3, $46, BIRD_KEEPER + $C8, $2 ; trainer
	db SPRITE_FOULARD_WOMAN, $6 + 4, $21 + 4, $ff, $d0, $47, BEAUTY + $C8, $4 ; trainer
	db SPRITE_FOULARD_WOMAN, $6 + 4, $20 + 4, $ff, $d0, $48, BEAUTY + $C8, $5 ; trainer
	db SPRITE_BIKER, $7 + 4, $a + 4, $ff, $d1, $49, BIKER + $C8, $1 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $d + 4, $7 + 4, $ff, $d1, $4a, BIRD_KEEPER + $C8, $3 ; trainer

Route13Blocks: ; 5488b (15:488b)
	INCBIN "maps/route13.blk"

Route14_h: ; 0x54999 to 0x549bb (34 bytes) (id=25)
	db $00 ; tileset
	db ROUTE_14_HEIGHT, ROUTE_14_WIDTH ; dimensions (y, x)
	dw Route14Blocks, Route14Texts, Route14Script ; blocks, texts, scripts
	db WEST | EAST ; connections

	; connections data

	db ROUTE_15
	dw Route15Blocks - 3 + (ROUTE_15_WIDTH) ; connection strip location
	dw $C6E8 + (ROUTE_14_WIDTH + 6) * (18 + 3) ; current map position
	db ROUTE_15_HEIGHT, ROUTE_15_WIDTH ; bigness, width
	db (18 * -2), (ROUTE_15_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_15_WIDTH ; window

	db ROUTE_13
	dw Route13Blocks + (ROUTE_13_WIDTH * 0) ; connection strip location
	dw $C6E5 + (ROUTE_14_WIDTH + 6) * (0 + 4) ; current map position
	db ROUTE_13_HEIGHT, ROUTE_13_WIDTH ; bigness, width
	db (0 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_13_WIDTH ; window

	; end connections data

	dw Route14Object ; objects

Route14Object: ; 0x549bb (size=87)
	db $43 ; border tile

	db $0 ; warps

	db $1 ; signs
	db $d, $11, $b ; Route14Text11

	db $a ; people
	db SPRITE_BLACK_HAIR_BOY_1, $4 + 4, $4 + 4, $ff, $d0, $41, BIRD_KEEPER + $C8, $e ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $6 + 4, $f + 4, $ff, $d0, $42, BIRD_KEEPER + $C8, $f ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $b + 4, $c + 4, $ff, $d0, $43, BIRD_KEEPER + $C8, $10 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $f + 4, $e + 4, $ff, $d1, $44, BIRD_KEEPER + $C8, $11 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $1f + 4, $f + 4, $ff, $d2, $45, BIRD_KEEPER + $C8, $4 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $31 + 4, $6 + 4, $ff, $d1, $46, BIRD_KEEPER + $C8, $5 ; trainer
	db SPRITE_BIKER, $27 + 4, $5 + 4, $ff, $d0, $47, BIKER + $C8, $d ; trainer
	db SPRITE_BIKER, $1e + 4, $4 + 4, $ff, $d3, $48, BIKER + $C8, $e ; trainer
	db SPRITE_BIKER, $1e + 4, $f + 4, $ff, $d2, $49, BIKER + $C8, $f ; trainer
	db SPRITE_BIKER, $1f + 4, $4 + 4, $ff, $d3, $4a, BIKER + $C8, $2 ; trainer

Route14Blocks: ; 54a12 (15:4a12)
	INCBIN "maps/route14.blk"

Route17_h: ; 0x54b20 to 0x54b42 (34 bytes) (id=28)
	db $00 ; tileset
	db ROUTE_17_HEIGHT, ROUTE_17_WIDTH ; dimensions (y, x)
	dw Route17Blocks, Route17Texts, Route17Script ; blocks, texts, scripts
	db NORTH | SOUTH ; connections

	; connections data

	db ROUTE_16
	dw Route16Blocks + (ROUTE_16_HEIGHT - 3) * ROUTE_16_WIDTH ; connection strip location
	dw $C6EB + 0 ; current map position
	db $d, ROUTE_16_WIDTH ; bigness, width
	db (ROUTE_16_HEIGHT * 2) - 1, (0 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_16_HEIGHT * (ROUTE_16_WIDTH + 6) ; window

	db ROUTE_18
	dw Route18Blocks ; connection strip location
	dw $C6EB + (ROUTE_17_HEIGHT + 3) * (ROUTE_17_WIDTH + 6) + 0 ; current map position
	db $d, ROUTE_18_WIDTH ; bigness, width
	db 0, (0 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_18_WIDTH ; window

	; end connections data

	dw Route17Object ; objects

Route17Object: ; 0x54b42 (size=102)
	db $43 ; border tile

	db $0 ; warps

	db $6 ; signs
	db $33, $9, $b ; Route17Text11
	db $3f, $9, $c ; Route17Text12
	db $4b, $9, $d ; Route17Text13
	db $57, $9, $e ; Route17Text14
	db $6f, $9, $f ; Route17Text15
	db $8d, $9, $10 ; Route17Text16

	db $a ; people
	db SPRITE_BIKER, $13 + 4, $c + 4, $ff, $d2, $41, CUE_BALL + $C8, $4 ; trainer
	db SPRITE_BIKER, $10 + 4, $b + 4, $ff, $d3, $42, CUE_BALL + $C8, $5 ; trainer
	db SPRITE_BIKER, $12 + 4, $4 + 4, $ff, $d1, $43, BIKER + $C8, $8 ; trainer
	db SPRITE_BIKER, $20 + 4, $7 + 4, $ff, $d2, $44, BIKER + $C8, $9 ; trainer
	db SPRITE_BIKER, $22 + 4, $e + 4, $ff, $d3, $45, BIKER + $C8, $a ; trainer
	db SPRITE_BIKER, $3a + 4, $11 + 4, $ff, $d2, $46, CUE_BALL + $C8, $6 ; trainer
	db SPRITE_BIKER, $44 + 4, $2 + 4, $ff, $d3, $47, CUE_BALL + $C8, $7 ; trainer
	db SPRITE_BIKER, $62 + 4, $e + 4, $ff, $d3, $48, CUE_BALL + $C8, $8 ; trainer
	db SPRITE_BIKER, $62 + 4, $5 + 4, $ff, $d2, $49, BIKER + $C8, $b ; trainer
	db SPRITE_BIKER, $76 + 4, $a + 4, $ff, $d0, $4a, BIKER + $C8, $c ; trainer

Route17Blocks: ; 54ba8 (15:4ba8)
	INCBIN "maps/route17.blk"

Route19_h: ; 0x54e78 to 0x54e9a (34 bytes) (id=30)
	db $00 ; tileset
	db ROUTE_19_HEIGHT, ROUTE_19_WIDTH ; dimensions (y, x)
	dw Route19Blocks, Route19Texts, Route19Script ; blocks, texts, scripts
	db NORTH | WEST ; connections

	; connections data

	db FUCHSIA_CITY
	dw FuchsiaCityBlocks + (FUCHSIA_CITY_HEIGHT - 3) * FUCHSIA_CITY_WIDTH + 2 ; connection strip location
	dw $C6EB + -3 ; current map position
	db $10, FUCHSIA_CITY_WIDTH ; bigness, width
	db (FUCHSIA_CITY_HEIGHT * 2) - 1, (-5 * -2) ; alignments (y, x)
	dw $C6E9 + FUCHSIA_CITY_HEIGHT * (FUCHSIA_CITY_WIDTH + 6) ; window

	db ROUTE_20
	dw Route20Blocks - 3 + (ROUTE_20_WIDTH) ; connection strip location
	dw $C6E8 + (ROUTE_19_WIDTH + 6) * (18 + 3) ; current map position
	db ROUTE_20_HEIGHT, ROUTE_20_WIDTH ; bigness, width
	db (18 * -2), (ROUTE_20_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_20_WIDTH ; window

	; end connections data

	dw Route19Object ; objects

Route19Object: ; 0x54e9a (size=87)
	db $43 ; border tile

	db $0 ; warps

	db $1 ; signs
	db $9, $b, $b ; Route19Text11

	db $a ; people
	db SPRITE_BLACK_HAIR_BOY_1, $7 + 4, $8 + 4, $ff, $d2, $41, SWIMMER + $C8, $2 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $7 + 4, $d + 4, $ff, $d2, $42, SWIMMER + $C8, $3 ; trainer
	db SPRITE_SWIMMER, $19 + 4, $d + 4, $ff, $d2, $43, SWIMMER + $C8, $4 ; trainer
	db SPRITE_SWIMMER, $1b + 4, $4 + 4, $ff, $d3, $44, SWIMMER + $C8, $5 ; trainer
	db SPRITE_SWIMMER, $1f + 4, $10 + 4, $ff, $d1, $45, SWIMMER + $C8, $6 ; trainer
	db SPRITE_SWIMMER, $b + 4, $9 + 4, $ff, $d0, $46, SWIMMER + $C8, $7 ; trainer
	db SPRITE_SWIMMER, $2b + 4, $8 + 4, $ff, $d2, $47, BEAUTY + $C8, $c ; trainer
	db SPRITE_SWIMMER, $2b + 4, $b + 4, $ff, $d3, $48, BEAUTY + $C8, $d ; trainer
	db SPRITE_SWIMMER, $2a + 4, $9 + 4, $ff, $d1, $49, SWIMMER + $C8, $8 ; trainer
	db SPRITE_SWIMMER, $2c + 4, $a + 4, $ff, $d0, $4a, BEAUTY + $C8, $e ; trainer

Route19Blocks: ; 54ef1 (15:4ef1)
	INCBIN "maps/route19.blk"

Route21_h: ; 0x54fff to 0x55021 (34 bytes) (id=32)
	db $00 ; tileset
	db ROUTE_21_HEIGHT, ROUTE_21_WIDTH ; dimensions (y, x)
	dw Route21Blocks, Route21Texts, Route21Script ; blocks, texts, scripts
	db NORTH | SOUTH ; connections

	; connections data

	db PALLET_TOWN
	dw PalletTownBlocks + (PALLET_TOWN_HEIGHT - 3) * PALLET_TOWN_WIDTH ; connection strip location
	dw $C6EB + 0 ; current map position
	db PALLET_TOWN_WIDTH, PALLET_TOWN_WIDTH ; bigness, width
	db (PALLET_TOWN_HEIGHT * 2) - 1, (0 * -2) ; alignments (y, x)
	dw $C6E9 + PALLET_TOWN_HEIGHT * (PALLET_TOWN_WIDTH + 6) ; window

	db CINNABAR_ISLAND
	dw CinnabarIslandBlocks ; connection strip location
	dw $C6EB + (ROUTE_21_HEIGHT + 3) * (ROUTE_21_WIDTH + 6) + 0 ; current map position
	db CINNABAR_ISLAND_WIDTH, CINNABAR_ISLAND_WIDTH ; bigness, width
	db 0, (0 * -2) ; alignments (y, x)
	dw $C6EF + CINNABAR_ISLAND_WIDTH ; window

	; end connections data

	dw Route21Object ; objects

Route21Object: ; 0x55021 (size=76)
	db $43 ; border tile

	db $0 ; warps

	db $0 ; signs

	db $9 ; people
	db SPRITE_FISHER2, $18 + 4, $4 + 4, $ff, $d2, $41, FISHER + $C8, $7 ; trainer
	db SPRITE_FISHER2, $19 + 4, $6 + 4, $ff, $d0, $42, FISHER + $C8, $9 ; trainer
	db SPRITE_SWIMMER, $1f + 4, $a + 4, $ff, $d1, $43, SWIMMER + $C8, $c ; trainer
	db SPRITE_SWIMMER, $1e + 4, $c + 4, $ff, $d3, $44, CUE_BALL + $C8, $9 ; trainer
	db SPRITE_SWIMMER, $3f + 4, $10 + 4, $ff, $d0, $45, SWIMMER + $C8, $d ; trainer
	db SPRITE_SWIMMER, $47 + 4, $5 + 4, $ff, $d3, $46, SWIMMER + $C8, $e ; trainer
	db SPRITE_SWIMMER, $47 + 4, $f + 4, $ff, $d2, $47, SWIMMER + $C8, $f ; trainer
	db SPRITE_FISHER2, $38 + 4, $e + 4, $ff, $d2, $48, FISHER + $C8, $8 ; trainer
	db SPRITE_FISHER2, $39 + 4, $11 + 4, $ff, $d3, $49, FISHER + $C8, $a ; trainer

Route21Blocks: ; 5506d (15:506d)
	INCBIN "maps/route21.blk"

VermilionHouse2Blocks: ; 5522f (15:522f)
Route12HouseBlocks: ; 5522f (15:522f)
DayCareMBlocks: ; 5522f (15:522f)
	INCBIN "maps/daycarem.blk"

FuchsiaHouse3Blocks: ; 5523f (15:523f)
	INCBIN "maps/fuchsiahouse3.blk"

; known jump sources: 3c61d (f:461d), 3c63b (f:463b)
Func_5524f: ; 5524f (15:524f)
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	ret z
	call Func_5546c
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	xor a
	ld [W_WHICHPOKEMON], a ; $cf92

; known jump sources: 5544d (15:544d)
Func_5525f: ; 5525f (15:525f)
	inc hl
	ld a, [hli]
	or [hl]
	jp z, Func_55436
	push hl
	ld hl, W_PLAYERMONSALIVEFLAGS
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld c, a
	ld b, $2
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	ld a, c
	and a
	pop hl
	jp z, Func_55436
	ld de, $10
	add hl, de
	ld d, h
	ld e, l
	ld hl, $d002
	ld c, $5
.asm_55285
	ld a, [hli]
	ld b, a
	ld a, [de]
	add b
	ld [de], a
	jr nc, .asm_5529a
	dec de
	ld a, [de]
	inc a
	jr z, .asm_55295
	ld [de], a
	inc de
	jr .asm_5529a
.asm_55295
	ld a, $ff
	ld [de], a
	inc de
	ld [de], a
.asm_5529a
	dec c
	jr z, .asm_552a1
	inc de
	inc de
	jr .asm_55285
.asm_552a1
	xor a
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld [$FF00+$97], a
	ld a, [$d008]
	ld [$FF00+$98], a
	ld a, [W_ENEMYMONLEVEL] ; $cff3
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	call Multiply
	ld a, $7
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld b, $4
	call Divide
	ld hl, $fff2
	add hl, de
	ld b, [hl]
	inc hl
	ld a, [W_PLAYERIDHI] ; $d359
	cp b
	jr nz, .asm_552d1
	ld b, [hl]
	ld a, [W_PLAYERIDLO] ; $d35a
	cp b
	ld a, $0
	jr z, .asm_552d6
.asm_552d1
	call Func_5549f
	ld a, $1
.asm_552d6
	ld [$cf4d], a
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	call nz, Func_5549f
	inc hl
	inc hl
	inc hl
	ld b, [hl]
	ld a, [$FF00+$98]
	ld [$cf4c], a
	add b
	ld [hld], a
	ld b, [hl]
	ld a, [$FF00+$97]
	ld [$cf4b], a
	adc b
	ld [hl], a
	jr nc, .asm_552f8
	dec hl
	inc [hl]
	inc hl
.asm_552f8
	inc hl
	push hl
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld c, a
	ld b, $0
	ld hl, W_PARTYMON1 ; $d164
	add hl, bc
	ld a, [hl]
	ld [$d0b5], a
	call GetMonHeader
	ld d, $64
	ld hl, CalcExperience
	ld b, BANK(CalcExperience)
	call Bankswitch ; indirect jump to CalcExperience (58f6a (16:4f6a))
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld b, a
	ld a, [$FF00+$97]
	ld c, a
	ld a, [$FF00+$98]
	ld d, a
	pop hl
	ld a, [hld]
	sub d
	ld a, [hld]
	sbc c
	ld a, [hl]
	sbc b
	jr c, .asm_5532e
	ld a, b
	ld [hli], a
	ld a, c
	ld [hli], a
	ld a, d
	ld [hld], a
	dec hl
.asm_5532e
	push hl
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld hl, W_PARTYMON1NAME ; $d2b5
	call GetPartyMonName
	ld hl, Unknown_554b2 ; $54b2
	call PrintText
	xor a
	ld [$cc49], a
	call LoadMonData
	pop hl
	ld bc, $13
	add hl, bc
	push hl
	ld b, BANK(Func_58f43)
	ld hl, Func_58f43
	call Bankswitch ; indirect jump to Func_58f43 (58f43 (16:4f43))
	pop hl
	ld a, [hl]
	cp d
	jp z, Func_55436
	ld a, [W_CURENEMYLVL] ; $d127
	push af
	push hl
	ld a, d
	ld [W_CURENEMYLVL], a ; $d127
	ld [hl], a
	ld bc, $ffdf
	add hl, bc
	ld a, [hl]
	ld [$d0b5], a
	ld [$d11e], a
	call GetMonHeader
	ld bc, $23
	add hl, bc
	push hl
	ld a, [hld]
	ld c, a
	ld b, [hl]
	push bc
	ld d, h
	ld e, l
	ld bc, $ffee
	add hl, bc
	ld b, $1
	call CalcStats
	pop bc
	pop hl
	ld a, [hld]
	sub c
	ld c, a
	ld a, [hl]
	sbc b
	ld b, a
	ld de, $ffe0
	add hl, de
	ld a, [hl]
	add c
	ld [hld], a
	ld a, [hl]
	adc b
	ld [hl], a
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	ld b, a
	ld a, [W_WHICHPOKEMON] ; $cf92
	cp b
	jr nz, .asm_553f7
	ld de, W_PLAYERMONCURHP ; $d015
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hl]
	ld [de], a
	ld bc, $1f
	add hl, bc
	push hl
	ld de, W_PLAYERMONLEVEL ; $d022
	ld bc, $b
	call CopyData
	pop hl
	ld a, [W_PLAYERBATTSTATUS3] ; $d064
	bit 3, a
	jr nz, .asm_553c8
	ld de, $cd0f
	ld bc, $b
	call CopyData
.asm_553c8
	xor a
	ld [$d11e], a
	ld hl, Func_3ed99
	ld b, BANK(Func_3ed99)
	call Bankswitch ; indirect jump to Func_3ed99 (3ed99 (f:6d99))
	ld hl, Func_3ed1a
	ld b, BANK(Func_3ed1a)
	call Bankswitch ; indirect jump to Func_3ed1a (3ed1a (f:6d1a))
	ld hl, Func_3ee19
	ld b, BANK(Func_3ee19)
	call Bankswitch ; indirect jump to Func_3ee19 (3ee19 (f:6e19))
	ld hl, Func_3cd60
	ld b, BANK(Func_3cd60)
	call Bankswitch ; indirect jump to Func_3cd60 (3cd60 (f:4d60))
	ld hl, Func_3ee94
	ld b, BANK(Func_3ee94)
	call Bankswitch ; indirect jump to Func_3ee94 (3ee94 (f:6e94))
	call SaveScreenTilesToBuffer1
.asm_553f7
	ld hl, Unknown_554dd ; $54dd
	call PrintText
	xor a
	ld [$cc49], a
	call LoadMonData
	ld d, $1
	ld hl, PrintStatsBox
	ld b, BANK(PrintStatsBox)
	call Bankswitch ; indirect jump to PrintStatsBox (12ae4 (4:6ae4))
	call WaitForTextScrollButtonPress
	call LoadScreenTilesFromBuffer1
	xor a
	ld [$cc49], a
	ld a, [$d0b5]
	ld [$d11e], a
	ld a, $1a
	call Predef ; indirect jump to Func_3af5b (3af5b (e:6f5b))
	ld hl, $ccd3
	ld a, [W_WHICHPOKEMON] ; $cf92
	ld c, a
	ld b, $1
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	pop hl
	pop af
	ld [W_CURENEMYLVL], a ; $d127

; known jump sources: 55262 (15:5262), 55277 (15:5277), 55356 (15:5356)
Func_55436: ; 55436 (15:5436)
	ld a, [W_NUMINPARTY] ; $d163
	ld b, a
	ld a, [W_WHICHPOKEMON] ; $cf92
	inc a
	cp b
	jr z, .asm_55450
	ld [W_WHICHPOKEMON], a ; $cf92
	ld bc, $2c
	ld hl, W_PARTYMON1_NUM ; $d16b (aliases: W_PARTYMON1DATA)
	call AddNTimes
	jp Func_5525f
.asm_55450
	ld hl, W_PLAYERMONSALIVEFLAGS
	xor a
	ld [hl], a
	ld a, [W_PLAYERMONNUMBER] ; $cc2f
	ld c, a
	ld b, $1
	push bc
	ld a, $10
	call Predef ; indirect jump to HandleBitArray (f666 (3:7666))
	ld hl, $ccf5
	xor a
	ld [hl], a
	pop bc
	ld a, $10
	jp Predef ; indirect jump to HandleBitArray (f666 (3:7666))

; known jump sources: 55255 (15:5255)
Func_5546c: ; 5546c (15:546c)
	ld a, [W_PLAYERMONSALIVEFLAGS]
	ld b, a
	xor a
	ld c, $8
	ld d, $0
.asm_55475
	xor a
	srl b
	adc d
	ld d, a
	dec c
	jr nz, .asm_55475
	cp $2
	ret c
	ld [$d11e], a
	ld hl, $d002
	ld c, $7
.asm_55488
	xor a
	ld [H_DIVIDEND], a ; $FF00+$95 (aliases: H_PRODUCT, H_PASTLEADINGZEROES, H_QUOTIENT)
	ld a, [hl]
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld a, [$d11e]
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	ld b, $2
	call Divide
	ld a, [$FF00+$98]
	ld [hli], a
	dec c
	jr nz, .asm_55488
	ret

; known jump sources: 552d1 (15:52d1), 552dd (15:52dd)
Func_5549f: ; 5549f (15:549f)
	ld a, [$FF00+$97]
	ld b, a
	ld a, [$FF00+$98]
	ld c, a
	srl b
	rr c
	add c
	ld [$FF00+$98], a
	ld a, [$FF00+$97]
	adc b
	ld [$FF00+$97], a
	ret

Unknown_554b2: ; 554b2 (15:54b2)
INCBIN "baserom.gbc",$554b2,$554b7 - $554b2
	ld a, [$cc5b]
	ld hl, Unknown_554cb ; $54cb
	and a
	ret nz
	ld hl, UnnamedText_554d8 ; $54d8
	ld a, [$cf4d]
	and a
	ret z
	ld hl, Unknown_554d4 ; $54d4
	ret

Unknown_554cb: ; 554cb (15:54cb)
INCBIN "baserom.gbc",$554cb,$554d4 - $554cb

Unknown_554d4: ; 554d4 (15:54d4)
INCBIN "baserom.gbc",$554d4,$554d8 - $554d4

UnnamedText_554d8: ; 554d8 (15:54d8)
	TX_FAR _UnnamedText_554d8 ; 0x89bee
	db $50
; 0x554dd

Unknown_554dd: ; 554dd (15:54dd)
INCBIN "baserom.gbc",$554dd,$554e3 - $554dd

Route2Script: ; 554e3 (15:54e3)
	jp EnableAutoTextBoxDrawing
; 0x554e6

Route2Texts: ; 554e6 (15:54e6)
	dw Predef5CText, Predef5CText, Route2Text3, Route2Text4

Route2Text3: ; 554ee (15:54ee)
	TX_FAR _Route2Text3
	db $50

Route2Text4: ; 554f3 (15:54f3)
	TX_FAR _Route2Text4
	db $50

Route3Script: ; 554f8 (15:54f8)
	call EnableAutoTextBoxDrawing
	ld hl, Route3TrainerHeader0
	ld de, Unknown_5550b
	ld a, [W_ROUTE3CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE3CURSCRIPT], a
	ret
; 0x5550b

Unknown_5550b: ; 5550b (15:550b)
INCBIN "baserom.gbc",$5550b,$55511 - $5550b

Route3Texts: ; 55511 (15:5511)
	dw Route3Text1, Route3Text2, Route3Text3, Route3Text4, Route3Text5, Route3Text6, Route3Text7, Route3Text8, Route3Text9, Route3Text10

Route3TrainerHeaders: ; 55525 (15:5525)
Route3TrainerHeader0: ; 55525 (15:5525)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7c3 ; flag's byte
	dw Route3BattleText1 ; 0x5595 TextBeforeBattle
	dw Route3AfterBattleText1 ; 0x559f TextAfterBattle
	dw Route3EndBattleText1 ; 0x559a TextEndBattle
	dw Route3EndBattleText1 ; 0x559a TextEndBattle
; 0x55531

Route3TrainerHeader2: ; 55531 (15:5531)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7c3 ; flag's byte
	dw Route3BattleText2 ; 0x55ae TextBeforeBattle
	dw Route3AfterBattleText2 ; 0x55b8 TextAfterBattle
	dw Route3EndBattleText2 ; 0x55b3 TextEndBattle
	dw Route3EndBattleText2 ; 0x55b3 TextEndBattle
; 0x5553d

Route3TrainerHeader3: ; 5553d (15:553d)
	db $4 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7c3 ; flag's byte
	dw Route3BattleText3 ; 0x55c7 TextBeforeBattle
	dw Route3AfterBattleText3 ; 0x55d1 TextAfterBattle
	dw Route3EndBattleText3 ; 0x55cc TextEndBattle
	dw Route3EndBattleText3 ; 0x55cc TextEndBattle
; 0x55549

Route3TrainerHeader4: ; 55549 (15:5549)
	db $5 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d7c3 ; flag's byte
	dw Route3BattleText4 ; 0x55e0 TextBeforeBattle
	dw Route3AfterBattleText4 ; 0x55ea TextAfterBattle
	dw Route3EndBattleText4 ; 0x55e5 TextEndBattle
	dw Route3EndBattleText4 ; 0x55e5 TextEndBattle
; 0x55555

Route3TrainerHeader5: ; 55555 (15:5555)
	db $6 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7c3 ; flag's byte
	dw Route3BattleText5 ; 0x55f9 TextBeforeBattle
	dw Route3AfterBattleText5 ; 0x5603 TextAfterBattle
	dw Route3EndBattleText5 ; 0x55fe TextEndBattle
	dw Route3EndBattleText5 ; 0x55fe TextEndBattle
; 0x55561

Route3TrainerHeader6: ; 55561 (15:5561)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7c3 ; flag's byte
	dw Route3BattleText6 ; 0x5612 TextBeforeBattle
	dw Route3AfterBattleText6 ; 0x561c TextAfterBattle
	dw Route3EndBattleText6 ; 0x5617 TextEndBattle
	dw Route3EndBattleText6 ; 0x5617 TextEndBattle
; 0x5556d

Route3TrainerHeader7: ; 5556d (15:556d)
	db $8 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7c3 ; flag's byte
	dw Route3BattleText7 ; 0x562b TextBeforeBattle
	dw Route3AfterBattleText7 ; 0x5635 TextAfterBattle
	dw Route3EndBattleText7 ; 0x5630 TextEndBattle
	dw Route3EndBattleText7 ; 0x5630 TextEndBattle
; 0x55579

Route3TrainerHeader8: ; 55579 (15:5579)
	db $9 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7c3 ; flag's byte
	dw Route3BattleText8 ; 0x5644 TextBeforeBattle
	dw Route3AfterBattleText8 ; 0x564e TextAfterBattle
	dw Route3EndBattleText8 ; 0x5649 TextEndBattle
	dw Route3EndBattleText8 ; 0x5649 TextEndBattle
; 0x55585

db $ff

Route3Text1: ; 55586 (15:5586)
	TX_FAR _Route3Text1
	db $50

Route3Text2: ; 5558b (15:558b)
	db $08 ; asm
	ld hl, Route3TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route3BattleText1: ; 55595 (15:5595)
	TX_FAR _Route3BattleText1
	db $50
; 0x55595 + 5 bytes

Route3EndBattleText1: ; 5559a (15:559a)
	TX_FAR _Route3EndBattleText1
	db $50
; 0x5559a + 5 bytes

Route3AfterBattleText1: ; 5559f (15:559f)
	TX_FAR _Route3AfterBattleText1
	db $50
; 0x5559f + 5 bytes

Route3Text3: ; 555a4 (15:55a4)
	db $08 ; asm
	ld hl, Route3TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route3BattleText2: ; 555ae (15:55ae)
	TX_FAR _Route3BattleText2
	db $50
; 0x555ae + 5 bytes

Route3EndBattleText2: ; 555b3 (15:55b3)
	TX_FAR _Route3EndBattleText2
	db $50
; 0x555b3 + 5 bytes

Route3AfterBattleText2: ; 555b8 (15:55b8)
	TX_FAR _Route3AfterBattleText2
	db $50
; 0x555b8 + 5 bytes

Route3Text4: ; 555bd (15:55bd)
	db $08 ; asm
	ld hl, Route3TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route3BattleText3: ; 555c7 (15:55c7)
	TX_FAR _Route3BattleText3
	db $50
; 0x555c7 + 5 bytes

Route3EndBattleText3: ; 555cc (15:55cc)
	TX_FAR _Route3EndBattleText3
	db $50
; 0x555cc + 5 bytes

Route3AfterBattleText3: ; 555d1 (15:55d1)
	TX_FAR _Route3AfterBattleText3
	db $50
; 0x555d1 + 5 bytes

Route3Text5: ; 555d6 (15:55d6)
	db $08 ; asm
	ld hl, Route3TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route3BattleText4: ; 555e0 (15:55e0)
	TX_FAR _Route3BattleText4
	db $50
; 0x555e0 + 5 bytes

Route3EndBattleText4: ; 555e5 (15:55e5)
	TX_FAR _Route3EndBattleText4
	db $50
; 0x555e5 + 5 bytes

Route3AfterBattleText4: ; 555ea (15:55ea)
	TX_FAR _Route3AfterBattleText4
	db $50
; 0x555ea + 5 bytes

Route3Text6: ; 555ef (15:55ef)
	db $08 ; asm
	ld hl, Route3TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route3BattleText5: ; 555f9 (15:55f9)
	TX_FAR _Route3BattleText5
	db $50
; 0x555f9 + 5 bytes

Route3EndBattleText5: ; 555fe (15:55fe)
	TX_FAR _Route3EndBattleText5
	db $50
; 0x555fe + 5 bytes

Route3AfterBattleText5: ; 55603 (15:5603)
	TX_FAR _Route3AfterBattleText5
	db $50
; 0x55603 + 5 bytes

Route3Text7: ; 55608 (15:5608)
	db $08 ; asm
	ld hl, Route3TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route3BattleText6: ; 55612 (15:5612)
	TX_FAR _Route3BattleText6
	db $50
; 0x55612 + 5 bytes

Route3EndBattleText6: ; 55617 (15:5617)
	TX_FAR _Route3EndBattleText6
	db $50
; 0x55617 + 5 bytes

Route3AfterBattleText6: ; 5561c (15:561c)
	TX_FAR _Route3AfterBattleText6
	db $50
; 0x5561c + 5 bytes

Route3Text8: ; 55621 (15:5621)
	db $08 ; asm
	ld hl, Route3TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

Route3BattleText7: ; 5562b (15:562b)
	TX_FAR _Route3BattleText7
	db $50
; 0x5562b + 5 bytes

Route3EndBattleText7: ; 55630 (15:5630)
	TX_FAR _Route3EndBattleText7
	db $50
; 0x55630 + 5 bytes

Route3AfterBattleText7: ; 55635 (15:5635)
	TX_FAR _Route3AfterBattleText7
	db $50
; 0x55635 + 5 bytes

Route3Text9: ; 5563a (15:563a)
	db $08 ; asm
	ld hl, Route3TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

Route3BattleText8: ; 55644 (15:5644)
	TX_FAR _Route3BattleText8
	db $50
; 0x55644 + 5 bytes

Route3EndBattleText8: ; 55649 (15:5649)
	TX_FAR _Route3EndBattleText8
	db $50
; 0x55649 + 5 bytes

Route3AfterBattleText8: ; 5564e (15:564e)
	TX_FAR _Route3AfterBattleText8
	db $50
; 0x5564e + 5 bytes

Route3Text10: ; 55653 (15:5653)
	TX_FAR _Route3Text10
	db $50

Route4Script: ; 55658 (15:5658)
	call EnableAutoTextBoxDrawing
	ld hl, Route4TrainerHeaders
	ld de, Unknown_5566b
	ld a, [W_ROUTE4CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE4CURSCRIPT], a
	ret
; 0x5566b

Unknown_5566b: ; 5566b (15:566b)
INCBIN "baserom.gbc",$5566b,$55671 - $5566b

Route4Texts: ; 55671 (15:5671)
	dw Route4Text1, Route4Text2, Predef5CText, PokeCenterSignText, Route4Text5, Route4Text6

Route4TrainerHeaders: ; 5567d (15:567d)
Route4TrainerHeader0: ; 5567d (15:567d)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7c5 ; flag's byte
	dw Route4BattleText1 ; 0x5699 TextBeforeBattle
	dw Route4AfterBattleText1 ; 0x56a3 TextAfterBattle
	dw Route4EndBattleText1 ; 0x569e TextEndBattle
	dw Route4EndBattleText1 ; 0x569e TextEndBattle
; 0x55689

db $ff

Route4Text1: ; 5568a (15:568a)
	TX_FAR _Route4Text1
	db $50

Route4Text2: ; 5568f (15:568f)
	db $08 ; asm
	ld hl, Route4TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route4BattleText1: ; 55699 (15:5699)
	TX_FAR _Route4BattleText1
	db $50
; 0x55699 + 5 bytes

Route4EndBattleText1: ; 5569e (15:569e)
	TX_FAR _Route4EndBattleText1
	db $50
; 0x5569e + 5 bytes

Route4AfterBattleText1: ; 556a3 (15:56a3)
	TX_FAR _Route4AfterBattleText1
	db $50
; 0x556a3 + 5 bytes

Route4Text5: ; 556a8 (15:56a8)
	TX_FAR _Route4Text5
	db $50

Route4Text6: ; 556ad (15:56ad)
	TX_FAR _Route4Text6
	db $50

Route5Script: ; 556b2 (15:56b2)
	jp EnableAutoTextBoxDrawing
; 0x556b5

Route5Texts: ; 556b5 (15:56b5)
	dw Route5Text1

Route5Text1: ; 556b7 (15:56b7)
	TX_FAR _Route5Text1
	db $50

Route9Script: ; 556bc (15:56bc)
	call EnableAutoTextBoxDrawing
	ld hl, Route9TrainerHeaders
	ld de, Unknown_556cf
	ld a, [W_ROUTE9CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE9CURSCRIPT], a
	ret
; 0x556cf

Unknown_556cf: ; 556cf (15:56cf)
INCBIN "baserom.gbc",$556cf,$556d5 - $556cf

Route9Texts: ; 556d5 (15:56d5)
	dw Route9Text1, Route9Text2, Route9Text3, Route9Text4, Route9Text5, Route9Text6, Route9Text7, Route9Text8, Route9Text9, Predef5CText, Route9Text11

Route9TrainerHeaders: ; 556eb (15:56eb)
Route9TrainerHeader0: ; 556eb (15:56eb)
	db $1 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7cf ; flag's byte
	dw Route9BattleText1 ; 0x5792 TextBeforeBattle
	dw Route9AfterBattleText1 ; 0x579c TextAfterBattle
	dw Route9EndBattleText1 ; 0x5797 TextEndBattle
	dw Route9EndBattleText1 ; 0x5797 TextEndBattle
; 0x556f7

Route9TrainerHeader2: ; 556f7 (15:56f7)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7cf ; flag's byte
	dw Route9BattleText2 ; 0x57a1 TextBeforeBattle
	dw Route9AfterBattleText2 ; 0x57ab TextAfterBattle
	dw Route9EndBattleText2 ; 0x57a6 TextEndBattle
	dw Route9EndBattleText2 ; 0x57a6 TextEndBattle
; 0x55703

Route9TrainerHeader3: ; 55703 (15:5703)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7cf ; flag's byte
	dw Route9BattleText3 ; 0x57b0 TextBeforeBattle
	dw Route9AfterBattleText3 ; 0x57ba TextAfterBattle
	dw Route9EndBattleText3 ; 0x57b5 TextEndBattle
	dw Route9EndBattleText3 ; 0x57b5 TextEndBattle
; 0x5570f

Route9TrainerHeader4: ; 5570f (15:570f)
	db $4 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7cf ; flag's byte
	dw Route9BattleText4 ; 0x57bf TextBeforeBattle
	dw Route9AfterBattleText4 ; 0x57c9 TextAfterBattle
	dw Route9EndBattleText4 ; 0x57c4 TextEndBattle
	dw Route9EndBattleText4 ; 0x57c4 TextEndBattle
; 0x5571b

Route9TrainerHeader5: ; 5571b (15:571b)
	db $5 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7cf ; flag's byte
	dw Route9BattleText5 ; 0x57ce TextBeforeBattle
	dw Route9AfterBattleText5 ; 0x57d8 TextAfterBattle
	dw Route9EndBattleText5 ; 0x57d3 TextEndBattle
	dw Route9EndBattleText5 ; 0x57d3 TextEndBattle
; 0x55727

Route9TrainerHeader6: ; 55727 (15:5727)
	db $6 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7cf ; flag's byte
	dw Route9BattleText6 ; 0x57dd TextBeforeBattle
	dw Route9AfterBattleText6 ; 0x57e7 TextAfterBattle
	dw Route9EndBattleText6 ; 0x57e2 TextEndBattle
	dw Route9EndBattleText6 ; 0x57e2 TextEndBattle
; 0x55733

Route9TrainerHeader7: ; 55733 (15:5733)
	db $7 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7cf ; flag's byte
	dw Route9BattleText7 ; 0x57ec TextBeforeBattle
	dw Route9AfterBattleText7 ; 0x57f6 TextAfterBattle
	dw Route9EndBattleText7 ; 0x57f1 TextEndBattle
	dw Route9EndBattleText7 ; 0x57f1 TextEndBattle
; 0x5573f

Route9TrainerHeader8: ; 5573f (15:573f)
	db $8 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7cf ; flag's byte
	dw Route9BattleText8 ; 0x57fb TextBeforeBattle
	dw Route9AfterBattleText8 ; 0x5805 TextAfterBattle
	dw Route9EndBattleText8 ; 0x5800 TextEndBattle
	dw Route9EndBattleText8 ; 0x5800 TextEndBattle
; 0x5574b

Route9TrainerHeader9: ; 5574b (15:574b)
	db $9 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7cf ; flag's byte
	dw Route9BattleText9 ; 0x580a TextBeforeBattle
	dw Route9AfterBattleText9 ; 0x5814 TextAfterBattle
	dw Route9EndBattleText9 ; 0x580f TextEndBattle
	dw Route9EndBattleText9 ; 0x580f TextEndBattle
; 0x55757

db $ff

Route9Text1: ; 55758 (15:5758)
	db $8 ; asm
	ld hl, Route9TrainerHeader0
	jr asm_8be3d ; 0x5575c $2e

Route9Text2: ; 5575e (15:575e)
	db $8 ; asm
	ld hl, Route9TrainerHeader2
	jr asm_8be3d ; 0x55762 $28

Route9Text3: ; 55764 (15:5764)
	db $8 ; asm
	ld hl, Route9TrainerHeader3
	jr asm_8be3d ; 0x55768 $22

Route9Text4: ; 5576a (15:576a)
	db $8 ; asm
	ld hl, Route9TrainerHeader4
	jr asm_8be3d ; 0x5576e $1c

Route9Text5: ; 55770 (15:5770)
	db $8 ; asm
	ld hl, Route9TrainerHeader5
	jr asm_8be3d ; 0x55774 $16

Route9Text6: ; 55776 (15:5776)
	db $8 ; asm
	ld hl, Route9TrainerHeader6
	jr asm_8be3d ; 0x5577a $10

Route9Text7: ; 5577c (15:577c)
	db $8 ; asm
	ld hl, Route9TrainerHeader7
	jr asm_8be3d ; 0x55780 $a

Route9Text8: ; 55782 (15:5782)
	db $8 ; asm
	ld hl, Route9TrainerHeader8
	jr asm_8be3d ; 0x55786 $4

Route9Text9: ; 55788 (15:5788)
	db $8 ; asm
	ld hl, Route9TrainerHeader9
asm_8be3d: ; 5578c (15:578c)
	call TalkToTrainer
	jp TextScriptEnd
; 0x55792

Route9BattleText1: ; 55792 (15:5792)
	TX_FAR _Route9BattleText1
	db $50
; 0x55792 + 5 bytes

Route9EndBattleText1: ; 55797 (15:5797)
	TX_FAR _Route9EndBattleText1
	db $50
; 0x55797 + 5 bytes

Route9AfterBattleText1: ; 5579c (15:579c)
	TX_FAR _Route9AfterBattleText1
	db $50
; 0x5579c + 5 bytes

Route9BattleText2: ; 557a1 (15:57a1)
	TX_FAR _Route9BattleText2
	db $50
; 0x557a1 + 5 bytes

Route9EndBattleText2: ; 557a6 (15:57a6)
	TX_FAR _Route9EndBattleText2
	db $50
; 0x557a6 + 5 bytes

Route9AfterBattleText2: ; 557ab (15:57ab)
	TX_FAR _Route9AfterBattleText2
	db $50
; 0x557ab + 5 bytes

Route9BattleText3: ; 557b0 (15:57b0)
	TX_FAR _Route9BattleText3
	db $50
; 0x557b0 + 5 bytes

Route9EndBattleText3: ; 557b5 (15:57b5)
	TX_FAR _Route9EndBattleText3
	db $50
; 0x557b5 + 5 bytes

Route9AfterBattleText3: ; 557ba (15:57ba)
	TX_FAR _Route9AfterBattleText3
	db $50
; 0x557ba + 5 bytes

Route9BattleText4: ; 557bf (15:57bf)
	TX_FAR _Route9BattleText4
	db $50
; 0x557bf + 5 bytes

Route9EndBattleText4: ; 557c4 (15:57c4)
	TX_FAR _Route9EndBattleText4
	db $50
; 0x557c4 + 5 bytes

Route9AfterBattleText4: ; 557c9 (15:57c9)
	TX_FAR _Route9AfterBattleText4
	db $50
; 0x557c9 + 5 bytes

Route9BattleText5: ; 557ce (15:57ce)
	TX_FAR _Route9BattleText5
	db $50
; 0x557ce + 5 bytes

Route9EndBattleText5: ; 557d3 (15:57d3)
	TX_FAR _Route9EndBattleText5
	db $50
; 0x557d3 + 5 bytes

Route9AfterBattleText5: ; 557d8 (15:57d8)
	TX_FAR _Route9AfterBattleText5
	db $50
; 0x557d8 + 5 bytes

Route9BattleText6: ; 557dd (15:57dd)
	TX_FAR _Route9BattleText6
	db $50
; 0x557dd + 5 bytes

Route9EndBattleText6: ; 557e2 (15:57e2)
	TX_FAR _Route9EndBattleText6
	db $50
; 0x557e2 + 5 bytes

Route9AfterBattleText6: ; 557e7 (15:57e7)
	TX_FAR _Route9AfterBattleText6
	db $50
; 0x557e7 + 5 bytes

Route9BattleText7: ; 557ec (15:57ec)
	TX_FAR _Route9BattleText7
	db $50
; 0x557ec + 5 bytes

Route9EndBattleText7: ; 557f1 (15:57f1)
	TX_FAR _Route9EndBattleText7
	db $50
; 0x557f1 + 5 bytes

Route9AfterBattleText7: ; 557f6 (15:57f6)
	TX_FAR _Route9AfterBattleText7
	db $50
; 0x557f6 + 5 bytes

Route9BattleText8: ; 557fb (15:57fb)
	TX_FAR _Route9BattleText8
	db $50
; 0x557fb + 5 bytes

Route9EndBattleText8: ; 55800 (15:5800)
	TX_FAR _Route9EndBattleText8
	db $50
; 0x55800 + 5 bytes

Route9AfterBattleText8: ; 55805 (15:5805)
	TX_FAR _Route9AfterBattleText8
	db $50
; 0x55805 + 5 bytes

Route9BattleText9: ; 5580a (15:580a)
	TX_FAR _Route9BattleText9
	db $50
; 0x5580a + 5 bytes

Route9EndBattleText9: ; 5580f (15:580f)
	TX_FAR _Route9EndBattleText9
	db $50
; 0x5580f + 5 bytes

Route9AfterBattleText9: ; 55814 (15:5814)
	TX_FAR _Route9AfterBattleText9
	db $50
; 0x55814 + 5 bytes

Route9Text11: ; 55819 (15:5819)
	TX_FAR _Route9Text11
	db $50

Route13Script: ; 5581e (15:581e)
	call EnableAutoTextBoxDrawing
	ld hl, Route13TrainerHeaders
	ld de, Route13Script_Unknown55831
	ld a, [W_ROUTE13CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE13CURSCRIPT], a
	ret
; 0x55831

Route13Script_Unknown55831: ; 55831 (15:5831)
INCBIN "baserom.gbc",$55831,$55837 - $55831

Route13Texts: ; 55837 (15:5837)
	dw Route13Text1, Route13Text2, Route13Text3, Route13Text4, Route13Text5, Route13Text6, Route13Text7, Route13Text8, Route13Text9, Route13Text10, Route13Text11, Route13Text12, Route13Text13

Route13TrainerHeaders: ; 55851 (15:5851)
Route13TrainerHeader0: ; 55851 (15:5851)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7d9 ; flag's byte
	dw Route13BattleText2 ; 0x58d4 TextBeforeBattle
	dw Route13AfterBattleText2 ; 0x58de TextAfterBattle
	dw Route13EndBattleText2 ; 0x58d9 TextEndBattle
	dw Route13EndBattleText2 ; 0x58d9 TextEndBattle
; 0x5585d

Route13TrainerHeader2: ; 5585d (15:585d)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7d9 ; flag's byte
	dw Route13BattleText3 ; 0x58ed TextBeforeBattle
	dw Route13AfterBattleText3 ; 0x58f7 TextAfterBattle
	dw Route13EndBattleText3 ; 0x58f2 TextEndBattle
	dw Route13EndBattleText3 ; 0x58f2 TextEndBattle
; 0x55869

Route13TrainerHeader3: ; 55869 (15:5869)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7d9 ; flag's byte
	dw Route13BattleText4 ; 0x5906 TextBeforeBattle
	dw Route13AfterBattleText4 ; 0x5910 TextAfterBattle
	dw Route13EndBattleText4 ; 0x590b TextEndBattle
	dw Route13EndBattleText4 ; 0x590b TextEndBattle
; 0x55875

Route13TrainerHeader4: ; 55875 (15:5875)
	db $4 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7d9 ; flag's byte
	dw Route13BattleText5 ; 0x591f TextBeforeBattle
	dw Route13AfterBattleText5 ; 0x5929 TextAfterBattle
	dw Route13EndBattleText5 ; 0x5924 TextEndBattle
	dw Route13EndBattleText5 ; 0x5924 TextEndBattle
; 0x55881

Route13TrainerHeader5: ; 55881 (15:5881)
	db $5 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d9 ; flag's byte
	dw Route13BattleText6 ; 0x5938 TextBeforeBattle
	dw Route13AfterBattleText6 ; 0x5942 TextAfterBattle
	dw Route13EndBattleText6 ; 0x593d TextEndBattle
	dw Route13EndBattleText6 ; 0x593d TextEndBattle
; 0x5588d

Route13TrainerHeader6: ; 5588d (15:588d)
	db $6 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7d9 ; flag's byte
	dw Route13BattleText7 ; 0x5951 TextBeforeBattle
	dw Route13AfterBattleText7 ; 0x595b TextAfterBattle
	dw Route13EndBattleText7 ; 0x5956 TextEndBattle
	dw Route13EndBattleText7 ; 0x5956 TextEndBattle
; 0x55899

Route13TrainerHeader7: ; 55899 (15:5899)
	db $7 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d9 ; flag's byte
	dw Route13BattleText8 ; 0x596a TextBeforeBattle
	dw Route13AfterBattleText8 ; 0x5974 TextAfterBattle
	dw Route13EndBattleText8 ; 0x596f TextEndBattle
	dw Route13EndBattleText8 ; 0x596f TextEndBattle
; 0x558a5

Route13TrainerHeader8: ; 558a5 (15:58a5)
	db $8 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7d9 ; flag's byte
	dw Route13BattleText9 ; 0x5983 TextBeforeBattle
	dw Route13AfterBattleText9 ; 0x598d TextAfterBattle
	dw Route13EndBattleText9 ; 0x5988 TextEndBattle
	dw Route13EndBattleText9 ; 0x5988 TextEndBattle
; 0x558b1

Route13TrainerHeader9: ; 558b1 (15:58b1)
	db $9 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7d9 ; flag's byte
	dw Route13BattleText10 ; 0x599c TextBeforeBattle
	dw Route13AfterBattleText10 ; 0x59a6 TextAfterBattle
	dw Route13EndBattleText10 ; 0x59a1 TextEndBattle
	dw Route13EndBattleText10 ; 0x59a1 TextEndBattle
; 0x558bd

Route13TrainerHeader10: ; 558bd (15:58bd)
	db $a ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d9 ; flag's byte
	dw Route13BattleText11 ; 0x59b5 TextBeforeBattle
	dw Route13AfterBattleText11 ; 0x59bf TextAfterBattle
	dw Route13EndBattleText11 ; 0x59ba TextEndBattle
	dw Route13EndBattleText11 ; 0x59ba TextEndBattle
; 0x558c9

db $ff

Route13Text1: ; 558ca (15:58ca)
	db $08 ; asm
	ld hl, Route13TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route13BattleText2: ; 558d4 (15:58d4)
	TX_FAR _Route13BattleText2
	db $50
; 0x558d4 + 5 bytes

Route13EndBattleText2: ; 558d9 (15:58d9)
	TX_FAR _Route13EndBattleText2
	db $50
; 0x558d9 + 5 bytes

Route13AfterBattleText2: ; 558de (15:58de)
	TX_FAR _Route13AfterBattleText2
	db $50
; 0x558de + 5 bytes

Route13Text2: ; 558e3 (15:58e3)
	db $08 ; asm
	ld hl, Route13TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route13BattleText3: ; 558ed (15:58ed)
	TX_FAR _Route13BattleText3
	db $50
; 0x558ed + 5 bytes

Route13EndBattleText3: ; 558f2 (15:58f2)
	TX_FAR _Route13EndBattleText3
	db $50
; 0x558f2 + 5 bytes

Route13AfterBattleText3: ; 558f7 (15:58f7)
	TX_FAR _Route13AfterBattleText3
	db $50
; 0x558f7 + 5 bytes

Route13Text3: ; 558fc (15:58fc)
	db $08 ; asm
	ld hl, Route13TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route13BattleText4: ; 55906 (15:5906)
	TX_FAR _Route13BattleText4
	db $50
; 0x55906 + 5 bytes

Route13EndBattleText4: ; 5590b (15:590b)
	TX_FAR _Route13EndBattleText4
	db $50
; 0x5590b + 5 bytes

Route13AfterBattleText4: ; 55910 (15:5910)
	TX_FAR _Route13AfterBattleText4
	db $50
; 0x55910 + 5 bytes

Route13Text4: ; 55915 (15:5915)
	db $08 ; asm
	ld hl, Route13TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route13BattleText5: ; 5591f (15:591f)
	TX_FAR _Route13BattleText5
	db $50
; 0x5591f + 5 bytes

Route13EndBattleText5: ; 55924 (15:5924)
	TX_FAR _Route13EndBattleText5
	db $50
; 0x55924 + 5 bytes

Route13AfterBattleText5: ; 55929 (15:5929)
	TX_FAR _Route13AfterBattleText5
	db $50
; 0x55929 + 5 bytes

Route13Text5: ; 5592e (15:592e)
	db $08 ; asm
	ld hl, Route13TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route13BattleText6: ; 55938 (15:5938)
	TX_FAR _Route13BattleText6
	db $50
; 0x55938 + 5 bytes

Route13EndBattleText6: ; 5593d (15:593d)
	TX_FAR _Route13EndBattleText6
	db $50
; 0x5593d + 5 bytes

Route13AfterBattleText6: ; 55942 (15:5942)
	TX_FAR _Route13AfterBattleText6
	db $50
; 0x55942 + 5 bytes

Route13Text6: ; 55947 (15:5947)
	db $08 ; asm
	ld hl, Route13TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route13BattleText7: ; 55951 (15:5951)
	TX_FAR _Route13BattleText7
	db $50
; 0x55951 + 5 bytes

Route13EndBattleText7: ; 55956 (15:5956)
	TX_FAR _Route13EndBattleText7
	db $50
; 0x55956 + 5 bytes

Route13AfterBattleText7: ; 5595b (15:595b)
	TX_FAR _Route13AfterBattleText7
	db $50
; 0x5595b + 5 bytes

Route13Text7: ; 55960 (15:5960)
	db $08 ; asm
	ld hl, Route13TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

Route13BattleText8: ; 5596a (15:596a)
	TX_FAR _Route13BattleText8
	db $50
; 0x5596a + 5 bytes

Route13EndBattleText8: ; 5596f (15:596f)
	TX_FAR _Route13EndBattleText8
	db $50
; 0x5596f + 5 bytes

Route13AfterBattleText8: ; 55974 (15:5974)
	TX_FAR _Route13AfterBattleText8
	db $50
; 0x55974 + 5 bytes

Route13Text8: ; 55979 (15:5979)
	db $08 ; asm
	ld hl, Route13TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

Route13BattleText9: ; 55983 (15:5983)
	TX_FAR _Route13BattleText9
	db $50
; 0x55983 + 5 bytes

Route13EndBattleText9: ; 55988 (15:5988)
	TX_FAR _Route13EndBattleText9
	db $50
; 0x55988 + 5 bytes

Route13AfterBattleText9: ; 5598d (15:598d)
	TX_FAR _Route13AfterBattleText9
	db $50
; 0x5598d + 5 bytes

Route13Text9: ; 55992 (15:5992)
	db $08 ; asm
	ld hl, Route13TrainerHeader9
	call TalkToTrainer
	jp TextScriptEnd

Route13BattleText10: ; 5599c (15:599c)
	TX_FAR _Route13BattleText10
	db $50
; 0x5599c + 5 bytes

Route13EndBattleText10: ; 559a1 (15:59a1)
	TX_FAR _Route13EndBattleText10
	db $50
; 0x559a1 + 5 bytes

Route13AfterBattleText10: ; 559a6 (15:59a6)
	TX_FAR _Route13AfterBattleText10
	db $50
; 0x559a6 + 5 bytes

Route13Text10: ; 559ab (15:59ab)
	db $08 ; asm
	ld hl, Route13TrainerHeader10
	call TalkToTrainer
	jp TextScriptEnd

Route13BattleText11: ; 559b5 (15:59b5)
	TX_FAR _Route13BattleText11
	db $50
; 0x559b5 + 5 bytes

Route13EndBattleText11: ; 559ba (15:59ba)
	TX_FAR _Route13EndBattleText11
	db $50
; 0x559ba + 5 bytes

Route13AfterBattleText11: ; 559bf (15:59bf)
	TX_FAR _Route13AfterBattleText11
	db $50
; 0x559bf + 5 bytes

Route13Text11: ; 559c4 (15:59c4)
	TX_FAR _Route13Text11
	db $50

Route13Text12: ; 559c9 (15:59c9)
	TX_FAR _Route13Text12
	db $50

Route13Text13: ; 559ce (15:59ce)
	TX_FAR _Route13Text13
	db $50

Route14Script: ; 559d3 (15:59d3)
	call EnableAutoTextBoxDrawing
	ld hl, Route14TrainerHeaders
	ld de, Unknown_559e6
	ld a, [W_ROUTE14CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE14CURSCRIPT], a
	ret
; 0x559e6

Unknown_559e6: ; 559e6 (15:59e6)
INCBIN "baserom.gbc",$559e6,$559ec - $559e6

Route14Texts: ; 559ec (15:59ec)
	dw Route14Text1, Route14Text2, Route14Text3, Route14Text4, Route14Text5, Route14Text6, Route14Text7, Route14Text8, Route14Text9, Route14Text10, Route14Text11

Route14TrainerHeaders: ; 55a02 (15:5a02)
Route14TrainerHeader0: ; 55a02 (15:5a02)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7db ; flag's byte
	dw Route14BattleText1 ; 0x5a85 TextBeforeBattle
	dw Route14AfterBattleText1 ; 0x5a8f TextAfterBattle
	dw Route14EndBattleText1 ; 0x5a8a TextEndBattle
	dw Route14EndBattleText1 ; 0x5a8a TextEndBattle
; 0x55a0e

Route14TrainerHeader1: ; 55a0e (15:5a0e)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7db ; flag's byte
	dw Route14BattleText2 ; 0x5a9e TextBeforeBattle
	dw Route14AfterBattleText2 ; 0x5aa8 TextAfterBattle
	dw Route14EndBattleText2 ; 0x5aa3 TextEndBattle
	dw Route14EndBattleText2 ; 0x5aa3 TextEndBattle
; 0x55a1a

Route14TrainerHeader2: ; 55a1a (15:5a1a)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7db ; flag's byte
	dw Route14BattleText3 ; 0x5ab7 TextBeforeBattle
	dw Route14AfterBattleText3 ; 0x5ac1 TextAfterBattle
	dw Route14EndBattleText3 ; 0x5abc TextEndBattle
	dw Route14EndBattleText3 ; 0x5abc TextEndBattle
; 0x55a26

Route14TrainerHeader3: ; 55a26 (15:5a26)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7db ; flag's byte
	dw Route14BattleText4 ; 0x5ad0 TextBeforeBattle
	dw Route14AfterBattleText4 ; 0x5ada TextAfterBattle
	dw Route14EndBattleText4 ; 0x5ad5 TextEndBattle
	dw Route14EndBattleText4 ; 0x5ad5 TextEndBattle
; 0x55a32

Route14TrainerHeader4: ; 55a32 (15:5a32)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7db ; flag's byte
	dw Route14BattleText5 ; 0x5ae9 TextBeforeBattle
	dw Route14AfterBattleText5 ; 0x5af3 TextAfterBattle
	dw Route14EndBattleText5 ; 0x5aee TextEndBattle
	dw Route14EndBattleText5 ; 0x5aee TextEndBattle
; 0x55a3e

Route14TrainerHeader5: ; 55a3e (15:5a3e)
	db $6 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7db ; flag's byte
	dw Route14BattleText6 ; 0x5b02 TextBeforeBattle
	dw Route14AfterBattleText6 ; 0x5b0c TextAfterBattle
	dw Route14EndBattleText6 ; 0x5b07 TextEndBattle
	dw Route14EndBattleText6 ; 0x5b07 TextEndBattle
; 0x55a4a

Route14TrainerHeader6: ; 55a4a (15:5a4a)
	db $7 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7db ; flag's byte
	dw Route14BattleText7 ; 0x5b1b TextBeforeBattle
	dw Route14AfterBattleText7 ; 0x5b25 TextAfterBattle
	dw Route14EndBattleText7 ; 0x5b20 TextEndBattle
	dw Route14EndBattleText7 ; 0x5b20 TextEndBattle
; 0x55a56

Route14TrainerHeader7: ; 55a56 (15:5a56)
	db $8 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7db ; flag's byte
	dw Route14BattleText8 ; 0x5b34 TextBeforeBattle
	dw Route14AfterBattleText8 ; 0x5b3e TextAfterBattle
	dw Route14EndBattleText8 ; 0x5b39 TextEndBattle
	dw Route14EndBattleText8 ; 0x5b39 TextEndBattle
; 0x55a62

Route14TrainerHeader8: ; 55a62 (15:5a62)
	db $9 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7db ; flag's byte
	dw Route14BattleText9 ; 0x5b4d TextBeforeBattle
	dw Route14AfterBattleText9 ; 0x5b57 TextAfterBattle
	dw Route14EndBattleText9 ; 0x5b52 TextEndBattle
	dw Route14EndBattleText9 ; 0x5b52 TextEndBattle
; 0x55a6e

Route14TrainerHeader9: ; 55a6e (15:5a6e)
	db $a ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7db ; flag's byte
	dw Route14BattleText10 ; 0x5b66 TextBeforeBattle
	dw Route14AfterBattleText10 ; 0x5b70 TextAfterBattle
	dw Route14EndBattleText10 ; 0x5b6b TextEndBattle
	dw Route14EndBattleText10 ; 0x5b6b TextEndBattle
; 0x55a7a

db $ff

Route14Text1: ; 55a7b (15:5a7b)
	db $08 ; asm
	ld hl, Route14TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route14BattleText1: ; 55a85 (15:5a85)
	TX_FAR _Route14BattleText1
	db $50
; 0x55a85 + 5 bytes

Route14EndBattleText1: ; 55a8a (15:5a8a)
	TX_FAR _Route14EndBattleText1
	db $50
; 0x55a8a + 5 bytes

Route14AfterBattleText1: ; 55a8f (15:5a8f)
	TX_FAR _Route14AfterBattleText1
	db $50
; 0x55a8f + 5 bytes

Route14Text2: ; 55a94 (15:5a94)
	db $08 ; asm
	ld hl, Route14TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route14BattleText2: ; 55a9e (15:5a9e)
	TX_FAR _Route14BattleText2
	db $50
; 0x55a9e + 5 bytes

Route14EndBattleText2: ; 55aa3 (15:5aa3)
	TX_FAR _Route14EndBattleText2
	db $50
; 0x55aa3 + 5 bytes

Route14AfterBattleText2: ; 55aa8 (15:5aa8)
	TX_FAR _Route14AfterBattleText2
	db $50
; 0x55aa8 + 5 bytes

Route14Text3: ; 55aad (15:5aad)
	db $08 ; asm
	ld hl, Route14TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route14BattleText3: ; 55ab7 (15:5ab7)
	TX_FAR _Route14BattleText3
	db $50
; 0x55ab7 + 5 bytes

Route14EndBattleText3: ; 55abc (15:5abc)
	TX_FAR _Route14EndBattleText3
	db $50
; 0x55abc + 5 bytes

Route14AfterBattleText3: ; 55ac1 (15:5ac1)
	TX_FAR _Route14AfterBattleText3
	db $50
; 0x55ac1 + 5 bytes

Route14Text4: ; 55ac6 (15:5ac6)
	db $08 ; asm
	ld hl, Route14TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route14BattleText4: ; 55ad0 (15:5ad0)
	TX_FAR _Route14BattleText4
	db $50
; 0x55ad0 + 5 bytes

Route14EndBattleText4: ; 55ad5 (15:5ad5)
	TX_FAR _Route14EndBattleText4
	db $50
; 0x55ad5 + 5 bytes

Route14AfterBattleText4: ; 55ada (15:5ada)
	TX_FAR _Route14AfterBattleText4
	db $50
; 0x55ada + 5 bytes

Route14Text5: ; 55adf (15:5adf)
	db $08 ; asm
	ld hl, Route14TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route14BattleText5: ; 55ae9 (15:5ae9)
	TX_FAR _Route14BattleText5
	db $50
; 0x55ae9 + 5 bytes

Route14EndBattleText5: ; 55aee (15:5aee)
	TX_FAR _Route14EndBattleText5
	db $50
; 0x55aee + 5 bytes

Route14AfterBattleText5: ; 55af3 (15:5af3)
	TX_FAR _Route14AfterBattleText5
	db $50
; 0x55af3 + 5 bytes

Route14Text6: ; 55af8 (15:5af8)
	db $08 ; asm
	ld hl, Route14TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route14BattleText6: ; 55b02 (15:5b02)
	TX_FAR _Route14BattleText6
	db $50
; 0x55b02 + 5 bytes

Route14EndBattleText6: ; 55b07 (15:5b07)
	TX_FAR _Route14EndBattleText6
	db $50
; 0x55b07 + 5 bytes

Route14AfterBattleText6: ; 55b0c (15:5b0c)
	TX_FAR _Route14AfterBattleText6
	db $50
; 0x55b0c + 5 bytes

Route14Text7: ; 55b11 (15:5b11)
	db $08 ; asm
	ld hl, Route14TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route14BattleText7: ; 55b1b (15:5b1b)
	TX_FAR _Route14BattleText7
	db $50
; 0x55b1b + 5 bytes

Route14EndBattleText7: ; 55b20 (15:5b20)
	TX_FAR _Route14EndBattleText7
	db $50
; 0x55b20 + 5 bytes

Route14AfterBattleText7: ; 55b25 (15:5b25)
	TX_FAR _Route14AfterBattleText7
	db $50
; 0x55b25 + 5 bytes

Route14Text8: ; 55b2a (15:5b2a)
	db $08 ; asm
	ld hl, Route14TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

Route14BattleText8: ; 55b34 (15:5b34)
	TX_FAR _Route14BattleText8
	db $50
; 0x55b34 + 5 bytes

Route14EndBattleText8: ; 55b39 (15:5b39)
	TX_FAR _Route14EndBattleText8
	db $50
; 0x55b39 + 5 bytes

Route14AfterBattleText8: ; 55b3e (15:5b3e)
	TX_FAR _Route14AfterBattleText8
	db $50
; 0x55b3e + 5 bytes

Route14Text9: ; 55b43 (15:5b43)
	db $08 ; asm
	ld hl, Route14TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

Route14BattleText9: ; 55b4d (15:5b4d)
	TX_FAR _Route14BattleText9
	db $50
; 0x55b4d + 5 bytes

Route14EndBattleText9: ; 55b52 (15:5b52)
	TX_FAR _Route14EndBattleText9
	db $50
; 0x55b52 + 5 bytes

Route14AfterBattleText9: ; 55b57 (15:5b57)
	TX_FAR _Route14AfterBattleText9
	db $50
; 0x55b57 + 5 bytes

Route14Text10: ; 55b5c (15:5b5c)
	db $08 ; asm
	ld hl, Route14TrainerHeader9
	call TalkToTrainer
	jp TextScriptEnd

Route14BattleText10: ; 55b66 (15:5b66)
	TX_FAR _Route14BattleText10
	db $50
; 0x55b66 + 5 bytes

Route14EndBattleText10: ; 55b6b (15:5b6b)
	TX_FAR _Route14EndBattleText10
	db $50
; 0x55b6b + 5 bytes

Route14AfterBattleText10: ; 55b70 (15:5b70)
	TX_FAR _Route14AfterBattleText10
	db $50
; 0x55b70 + 5 bytes

Route14Text11: ; 55b75 (15:5b75)
	TX_FAR _Route14Text11
	db $50

Route17Script: ; 55b7a (15:5b7a)
	call EnableAutoTextBoxDrawing
	ld hl, Route17TrainerHeaders
	ld de, Route17_Unknown55b8d
	ld a, [W_ROUTE17CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE17CURSCRIPT], a
	ret
; 0x55b8d

Route17_Unknown55b8d: ; 55b8d (15:5b8d)
INCBIN "baserom.gbc",$55b8d,$55b93 - $55b8d

Route17Texts: ; 55b93 (15:5b93)
	dw Route17Text1, Route17Text2, Route17Text3, Route17Text4, Route17Text5, Route17Text6, Route17Text7, Route17Text8, Route17Text9, Route17Text10, Route17Text11, Route17Text12, Route17Text13, Route17Text14, Route17Text15, Route17Text16

Route17TrainerHeaders: ; 55bb3 (15:5bb3)
Route17TrainerHeader0: ; 55bb3 (15:5bb3)
	db $1 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e1 ; flag's byte
	dw Route17BattleText1 ; 0x5c36 TextBeforeBattle
	dw Route17AfterBattleText1 ; 0x5c40 TextAfterBattle
	dw Route17EndBattleText1 ; 0x5c3b TextEndBattle
	dw Route17EndBattleText1 ; 0x5c3b TextEndBattle
; 0x55bbf

Route17TrainerHeader1: ; 55bbf (15:5bbf)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e1 ; flag's byte
	dw Route17BattleText2 ; 0x5c4f TextBeforeBattle
	dw Route17AfterBattleText2 ; 0x5c59 TextAfterBattle
	dw Route17EndBattleText2 ; 0x5c54 TextEndBattle
	dw Route17EndBattleText2 ; 0x5c54 TextEndBattle
; 0x55bcb

Route17TrainerHeader2: ; 55bcb (15:5bcb)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e1 ; flag's byte
	dw Route17BattleText3 ; 0x5c68 TextBeforeBattle
	dw Route17AfterBattleText3 ; 0x5c72 TextAfterBattle
	dw Route17EndBattleText3 ; 0x5c6d TextEndBattle
	dw Route17EndBattleText3 ; 0x5c6d TextEndBattle
; 0x55bd7

Route17TrainerHeader3: ; 55bd7 (15:5bd7)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e1 ; flag's byte
	dw Route17BattleText4 ; 0x5c81 TextBeforeBattle
	dw Route17AfterBattleText4 ; 0x5c8b TextAfterBattle
	dw Route17EndBattleText4 ; 0x5c86 TextEndBattle
	dw Route17EndBattleText4 ; 0x5c86 TextEndBattle
; 0x55be3

Route17TrainerHeader4: ; 55be3 (15:5be3)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e1 ; flag's byte
	dw Route17BattleText5 ; 0x5c9a TextBeforeBattle
	dw Route17AfterBattleText5 ; 0x5ca4 TextAfterBattle
	dw Route17EndBattleText5 ; 0x5c9f TextEndBattle
	dw Route17EndBattleText5 ; 0x5c9f TextEndBattle
; 0x55bef

Route17TrainerHeader5: ; 55bef (15:5bef)
	db $6 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7e1 ; flag's byte
	dw Route17BattleText6 ; 0x5cb3 TextBeforeBattle
	dw Route17AfterBattleText6 ; 0x5cbd TextAfterBattle
	dw Route17EndBattleText6 ; 0x5cb8 TextEndBattle
	dw Route17EndBattleText6 ; 0x5cb8 TextEndBattle
; 0x55bfb

Route17TrainerHeader6: ; 55bfb (15:5bfb)
	db $7 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e1 ; flag's byte
	dw Route17BattleText7 ; 0x5ccc TextBeforeBattle
	dw Route17AfterBattleText7 ; 0x5cd6 TextAfterBattle
	dw Route17EndBattleText7 ; 0x5cd1 TextEndBattle
	dw Route17EndBattleText7 ; 0x5cd1 TextEndBattle
; 0x55c07

Route17TrainerHeader7: ; 55c07 (15:5c07)
	db $8 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7e1 ; flag's byte
	dw Route17BattleText8 ; 0x5ce5 TextBeforeBattle
	dw Route17AfterBattleText8 ; 0x5cef TextAfterBattle
	dw Route17EndBattleText8 ; 0x5cea TextEndBattle
	dw Route17EndBattleText8 ; 0x5cea TextEndBattle
; 0x55c13

Route17TrainerHeader8: ; 55c13 (15:5c13)
	db $9 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e1 ; flag's byte
	dw Route17BattleText9 ; 0x5cfe TextBeforeBattle
	dw Route17AfterBattleText9 ; 0x5d08 TextAfterBattle
	dw Route17EndBattleText9 ; 0x5d03 TextEndBattle
	dw Route17EndBattleText9 ; 0x5d03 TextEndBattle
; 0x55c1f

Route17TrainerHeader9: ; 55c1f (15:5c1f)
	db $a ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e1 ; flag's byte
	dw Route17BattleText10 ; 0x5d17 TextBeforeBattle
	dw Route17AfterBattleText10 ; 0x5d21 TextAfterBattle
	dw Route17EndBattleText10 ; 0x5d1c TextEndBattle
	dw Route17EndBattleText10 ; 0x5d1c TextEndBattle
; 0x55c2b

db $ff

Route17Text1: ; 55c2c (15:5c2c)
	db $08 ; asm
	ld hl, Route17TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route17BattleText1: ; 55c36 (15:5c36)
	TX_FAR _Route17BattleText1
	db $50
; 0x55c36 + 5 bytes

Route17EndBattleText1: ; 55c3b (15:5c3b)
	TX_FAR _Route17EndBattleText1
	db $50
; 0x55c3b + 5 bytes

Route17AfterBattleText1: ; 55c40 (15:5c40)
	TX_FAR _Route17AfterBattleText1
	db $50
; 0x55c40 + 5 bytes

Route17Text2: ; 55c45 (15:5c45)
	db $08 ; asm
	ld hl, Route17TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route17BattleText2: ; 55c4f (15:5c4f)
	TX_FAR _Route17BattleText2
	db $50
; 0x55c4f + 5 bytes

Route17EndBattleText2: ; 55c54 (15:5c54)
	TX_FAR _Route17EndBattleText2
	db $50
; 0x55c54 + 5 bytes

Route17AfterBattleText2: ; 55c59 (15:5c59)
	TX_FAR _Route17AfterBattleText2
	db $50
; 0x55c59 + 5 bytes

Route17Text3: ; 55c5e (15:5c5e)
	db $08 ; asm
	ld hl, Route17TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route17BattleText3: ; 55c68 (15:5c68)
	TX_FAR _Route17BattleText3
	db $50
; 0x55c68 + 5 bytes

Route17EndBattleText3: ; 55c6d (15:5c6d)
	TX_FAR _Route17EndBattleText3
	db $50
; 0x55c6d + 5 bytes

Route17AfterBattleText3: ; 55c72 (15:5c72)
	TX_FAR _Route17AfterBattleText3
	db $50
; 0x55c72 + 5 bytes

Route17Text4: ; 55c77 (15:5c77)
	db $08 ; asm
	ld hl, Route17TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route17BattleText4: ; 55c81 (15:5c81)
	TX_FAR _Route17BattleText4
	db $50
; 0x55c81 + 5 bytes

Route17EndBattleText4: ; 55c86 (15:5c86)
	TX_FAR _Route17EndBattleText4
	db $50
; 0x55c86 + 5 bytes

Route17AfterBattleText4: ; 55c8b (15:5c8b)
	TX_FAR _Route17AfterBattleText4
	db $50
; 0x55c8b + 5 bytes

Route17Text5: ; 55c90 (15:5c90)
	db $08 ; asm
	ld hl, Route17TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route17BattleText5: ; 55c9a (15:5c9a)
	TX_FAR _Route17BattleText5
	db $50
; 0x55c9a + 5 bytes

Route17EndBattleText5: ; 55c9f (15:5c9f)
	TX_FAR _Route17EndBattleText5
	db $50
; 0x55c9f + 5 bytes

Route17AfterBattleText5: ; 55ca4 (15:5ca4)
	TX_FAR _Route17AfterBattleText5
	db $50
; 0x55ca4 + 5 bytes

Route17Text6: ; 55ca9 (15:5ca9)
	db $08 ; asm
	ld hl, Route17TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route17BattleText6: ; 55cb3 (15:5cb3)
	TX_FAR _Route17BattleText6
	db $50
; 0x55cb3 + 5 bytes

Route17EndBattleText6: ; 55cb8 (15:5cb8)
	TX_FAR _Route17EndBattleText6
	db $50
; 0x55cb8 + 5 bytes

Route17AfterBattleText6: ; 55cbd (15:5cbd)
	TX_FAR _Route17AfterBattleText6
	db $50
; 0x55cbd + 5 bytes

Route17Text7: ; 55cc2 (15:5cc2)
	db $08 ; asm
	ld hl, Route17TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route17BattleText7: ; 55ccc (15:5ccc)
	TX_FAR _Route17BattleText7
	db $50
; 0x55ccc + 5 bytes

Route17EndBattleText7: ; 55cd1 (15:5cd1)
	TX_FAR _Route17EndBattleText7
	db $50
; 0x55cd1 + 5 bytes

Route17AfterBattleText7: ; 55cd6 (15:5cd6)
	TX_FAR _Route17AfterBattleText7
	db $50
; 0x55cd6 + 5 bytes

Route17Text8: ; 55cdb (15:5cdb)
	db $08 ; asm
	ld hl, Route17TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

Route17BattleText8: ; 55ce5 (15:5ce5)
	TX_FAR _Route17BattleText8
	db $50
; 0x55ce5 + 5 bytes

Route17EndBattleText8: ; 55cea (15:5cea)
	TX_FAR _Route17EndBattleText8
	db $50
; 0x55cea + 5 bytes

Route17AfterBattleText8: ; 55cef (15:5cef)
	TX_FAR _Route17AfterBattleText8
	db $50
; 0x55cef + 5 bytes

Route17Text9: ; 55cf4 (15:5cf4)
	db $08 ; asm
	ld hl, Route17TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

Route17BattleText9: ; 55cfe (15:5cfe)
	TX_FAR _Route17BattleText9
	db $50
; 0x55cfe + 5 bytes

Route17EndBattleText9: ; 55d03 (15:5d03)
	TX_FAR _Route17EndBattleText9
	db $50
; 0x55d03 + 5 bytes

Route17AfterBattleText9: ; 55d08 (15:5d08)
	TX_FAR _Route17AfterBattleText9
	db $50
; 0x55d08 + 5 bytes

Route17Text10: ; 55d0d (15:5d0d)
	db $08 ; asm
	ld hl, Route17TrainerHeader9
	call TalkToTrainer
	jp TextScriptEnd

Route17BattleText10: ; 55d17 (15:5d17)
	TX_FAR _Route17BattleText10
	db $50
; 0x55d17 + 5 bytes

Route17EndBattleText10: ; 55d1c (15:5d1c)
	TX_FAR _Route17EndBattleText10
	db $50
; 0x55d1c + 5 bytes

Route17AfterBattleText10: ; 55d21 (15:5d21)
	TX_FAR _Route17AfterBattleText10
	db $50
; 0x55d21 + 5 bytes

Route17Text11: ; 55d26 (15:5d26)
	TX_FAR _Route17Text11
	db $50

Route17Text12: ; 55d2b (15:5d2b)
	TX_FAR _Route17Text12
	db $50

Route17Text13: ; 55d30 (15:5d30)
	TX_FAR _Route17Text13
	db $50

Route17Text14: ; 55d35 (15:5d35)
	TX_FAR _Route17Text14
	db $50

Route17Text15: ; 55d3a (15:5d3a)
	TX_FAR _Route17Text15
	db $50

Route17Text16: ; 55d3f (15:5d3f)
	TX_FAR _Route17Text16
	db $50

Route19Script: ; 55d44 (15:5d44)
	call EnableAutoTextBoxDrawing
	ld hl, Route19TrainerHeaders
	ld de, Route19_Unknown55d57
	ld a, [W_ROUTE19CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE19CURSCRIPT], a
	ret
; 0x55d57

Route19_Unknown55d57: ; 55d57 (15:5d57)
INCBIN "baserom.gbc",$55d57,$55d5d - $55d57

Route19Texts: ; 55d5d (15:5d5d)
	dw Route19Text1, Route19Text2, Route19Text3, Route19Text4, Route19Text5, Route19Text6, Route19Text7, Route19Text8, Route19Text9, Route19Text10, Route19Text11

Route19TrainerHeaders: ; 55d73 (15:5d73)
Route19TrainerHeader0: ; 55d73 (15:5d73)
	db $1 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e5 ; flag's byte
	dw Route19BattleText1 ; 0x5e50 TextBeforeBattle
	dw Route19AfterBattleText1 ; 0x5e5a TextAfterBattle
	dw Route19EndBattleText1 ; 0x5e55 TextEndBattle
	dw Route19EndBattleText1 ; 0x5e55 TextEndBattle
; 0x55d7f

Route19TrainerHeader1: ; 55d7f (15:5d7f)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e5 ; flag's byte
	dw Route19BattleText2 ; 0x5e5f TextBeforeBattle
	dw Route19AfterBattleText2 ; 0x5e69 TextAfterBattle
	dw Route19EndBattleText2 ; 0x5e64 TextEndBattle
	dw Route19EndBattleText2 ; 0x5e64 TextEndBattle
; 0x55d8b

Route19TrainerHeader2: ; 55d8b (15:5d8b)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e5 ; flag's byte
	dw Route19BattleText3 ; 0x5e6e TextBeforeBattle
	dw Route19AfterBattleText3 ; 0x5e78 TextAfterBattle
	dw Route19EndBattleText3 ; 0x5e73 TextEndBattle
	dw Route19EndBattleText3 ; 0x5e73 TextEndBattle
; 0x55d97

Route19TrainerHeader3: ; 55d97 (15:5d97)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e5 ; flag's byte
	dw Route19BattleText4 ; 0x5e7d TextBeforeBattle
	dw Route19AfterBattleText4 ; 0x5e87 TextAfterBattle
	dw Route19EndBattleText4 ; 0x5e82 TextEndBattle
	dw Route19EndBattleText4 ; 0x5e82 TextEndBattle
; 0x55da3

Route19TrainerHeader4: ; 55da3 (15:5da3)
	db $5 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e5 ; flag's byte
	dw Route19BattleText5 ; 0x5e8c TextBeforeBattle
	dw Route19AfterBattleText5 ; 0x5e96 TextAfterBattle
	dw Route19EndBattleText5 ; 0x5e91 TextEndBattle
	dw Route19EndBattleText5 ; 0x5e91 TextEndBattle
; 0x55daf

Route19TrainerHeader5: ; 55daf (15:5daf)
	db $6 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e5 ; flag's byte
	dw Route19BattleText6 ; 0x5e9b TextBeforeBattle
	dw Route19AfterBattleText6 ; 0x5ea5 TextAfterBattle
	dw Route19EndBattleText6 ; 0x5ea0 TextEndBattle
	dw Route19EndBattleText6 ; 0x5ea0 TextEndBattle
; 0x55dbb

Route19TrainerHeader6: ; 55dbb (15:5dbb)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e5 ; flag's byte
	dw Route19BattleText7 ; 0x5eaa TextBeforeBattle
	dw Route19AfterBattleText7 ; 0x5eb4 TextAfterBattle
	dw Route19EndBattleText7 ; 0x5eaf TextEndBattle
	dw Route19EndBattleText7 ; 0x5eaf TextEndBattle
; 0x55dc7

Route19TrainerHeader7: ; 55dc7 (15:5dc7)
	db $8 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e5 ; flag's byte
	dw Route19BattleText8 ; 0x5eb9 TextBeforeBattle
	dw Route19AfterBattleText8 ; 0x5ec3 TextAfterBattle
	dw Route19EndBattleText8 ; 0x5ebe TextEndBattle
	dw Route19EndBattleText8 ; 0x5ebe TextEndBattle
; 0x55dd3

Route19TrainerHeader8: ; 55dd3 (15:5dd3)
	db $9 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e5 ; flag's byte
	dw Route19BattleText9 ; 0x5ec8 TextBeforeBattle
	dw Route19AfterBattleText9 ; 0x5ed2 TextAfterBattle
	dw Route19EndBattleText9 ; 0x5ecd TextEndBattle
	dw Route19EndBattleText9 ; 0x5ecd TextEndBattle
; 0x55ddf

Route19TrainerHeader9: ; 55ddf (15:5ddf)
	db $a ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e5 ; flag's byte
	dw Route19BattleText10 ; 0x5ed7 TextBeforeBattle
	dw Route19AfterBattleText10 ; 0x5ee1 TextAfterBattle
	dw Route19EndBattleText10 ; 0x5edc TextEndBattle
	dw Route19EndBattleText10 ; 0x5edc TextEndBattle
; 0x55deb

db $ff

Route19Text1: ; 55dec (15:5dec)
	db $08 ; asm
	ld hl, Route19TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route19Text2: ; 55df6 (15:5df6)
	db $08 ; asm
	ld hl, Route19TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route19Text3: ; 55e00 (15:5e00)
	db $08 ; asm
	ld hl, Route19TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route19Text4: ; 55e0a (15:5e0a)
	db $08 ; asm
	ld hl, Route19TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route19Text5: ; 55e14 (15:5e14)
	db $08 ; asm
	ld hl, Route19TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route19Text6: ; 55e1e (15:5e1e)
	db $08 ; asm
	ld hl, Route19TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route19Text7: ; 55e28 (15:5e28)
	db $08 ; asm
	ld hl, Route19TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route19Text8: ; 55e32 (15:5e32)
	db $08 ; asm
	ld hl, Route19TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

Route19Text9: ; 55e3c (15:5e3c)
	db $08 ; asm
	ld hl, Route19TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

Route19Text10: ; 55e46 (15:5e46)
	db $08 ; asm
	ld hl, Route19TrainerHeader9
	call TalkToTrainer
	jp TextScriptEnd

Route19BattleText1: ; 55e50 (15:5e50)
	TX_FAR _Route19BattleText1
	db $50
; 0x55e50 + 5 bytes

Route19EndBattleText1: ; 55e55 (15:5e55)
	TX_FAR _Route19EndBattleText1
	db $50
; 0x55e55 + 5 bytes

Route19AfterBattleText1: ; 55e5a (15:5e5a)
	TX_FAR _Route19AfterBattleText1
	db $50
; 0x55e5a + 5 bytes

Route19BattleText2: ; 55e5f (15:5e5f)
	TX_FAR _Route19BattleText2
	db $50
; 0x55e5f + 5 bytes

Route19EndBattleText2: ; 55e64 (15:5e64)
	TX_FAR _Route19EndBattleText2
	db $50
; 0x55e64 + 5 bytes

Route19AfterBattleText2: ; 55e69 (15:5e69)
	TX_FAR _Route19AfterBattleText2
	db $50
; 0x55e69 + 5 bytes

Route19BattleText3: ; 55e6e (15:5e6e)
	TX_FAR _Route19BattleText3
	db $50
; 0x55e6e + 5 bytes

Route19EndBattleText3: ; 55e73 (15:5e73)
	TX_FAR _Route19EndBattleText3
	db $50
; 0x55e73 + 5 bytes

Route19AfterBattleText3: ; 55e78 (15:5e78)
	TX_FAR _Route19AfterBattleText3
	db $50
; 0x55e78 + 5 bytes

Route19BattleText4: ; 55e7d (15:5e7d)
	TX_FAR _Route19BattleText4
	db $50
; 0x55e7d + 5 bytes

Route19EndBattleText4: ; 55e82 (15:5e82)
	TX_FAR _Route19EndBattleText4
	db $50
; 0x55e82 + 5 bytes

Route19AfterBattleText4: ; 55e87 (15:5e87)
	TX_FAR _Route19AfterBattleText4
	db $50
; 0x55e87 + 5 bytes

Route19BattleText5: ; 55e8c (15:5e8c)
	TX_FAR _Route19BattleText5
	db $50
; 0x55e8c + 5 bytes

Route19EndBattleText5: ; 55e91 (15:5e91)
	TX_FAR _Route19EndBattleText5
	db $50
; 0x55e91 + 5 bytes

Route19AfterBattleText5: ; 55e96 (15:5e96)
	TX_FAR _Route19AfterBattleText5
	db $50
; 0x55e96 + 5 bytes

Route19BattleText6: ; 55e9b (15:5e9b)
	TX_FAR _Route19BattleText6
	db $50
; 0x55e9b + 5 bytes

Route19EndBattleText6: ; 55ea0 (15:5ea0)
	TX_FAR _Route19EndBattleText6
	db $50
; 0x55ea0 + 5 bytes

Route19AfterBattleText6: ; 55ea5 (15:5ea5)
	TX_FAR _Route19AfterBattleText6
	db $50
; 0x55ea5 + 5 bytes

Route19BattleText7: ; 55eaa (15:5eaa)
	TX_FAR _Route19BattleText7
	db $50
; 0x55eaa + 5 bytes

Route19EndBattleText7: ; 55eaf (15:5eaf)
	TX_FAR _Route19EndBattleText7
	db $50
; 0x55eaf + 5 bytes

Route19AfterBattleText7: ; 55eb4 (15:5eb4)
	TX_FAR _Route19AfterBattleText7
	db $50
; 0x55eb4 + 5 bytes

Route19BattleText8: ; 55eb9 (15:5eb9)
	TX_FAR _Route19BattleText8
	db $50
; 0x55eb9 + 5 bytes

Route19EndBattleText8: ; 55ebe (15:5ebe)
	TX_FAR _Route19EndBattleText8
	db $50
; 0x55ebe + 5 bytes

Route19AfterBattleText8: ; 55ec3 (15:5ec3)
	TX_FAR _Route19AfterBattleText8
	db $50
; 0x55ec3 + 5 bytes

Route19BattleText9: ; 55ec8 (15:5ec8)
	TX_FAR _Route19BattleText9
	db $50
; 0x55ec8 + 5 bytes

Route19EndBattleText9: ; 55ecd (15:5ecd)
	TX_FAR _Route19EndBattleText9
	db $50
; 0x55ecd + 5 bytes

Route19AfterBattleText9: ; 55ed2 (15:5ed2)
	TX_FAR _Route19AfterBattleText9
	db $50
; 0x55ed2 + 5 bytes

Route19BattleText10: ; 55ed7 (15:5ed7)
	TX_FAR _Route19BattleText10
	db $50
; 0x55ed7 + 5 bytes

Route19EndBattleText10: ; 55edc (15:5edc)
	TX_FAR _Route19EndBattleText10
	db $50
; 0x55edc + 5 bytes

Route19AfterBattleText10: ; 55ee1 (15:5ee1)
	TX_FAR _Route19AfterBattleText10
	db $50
; 0x55ee1 + 5 bytes

Route19Text11: ; 55ee6 (15:5ee6)
	TX_FAR _Route19Text11
	db $50

Route21Script: ; 55eeb (15:5eeb)
	call EnableAutoTextBoxDrawing
	ld hl, Route21TrainerHeaders
	ld de, Route21_Unknown55efe
	ld a, [W_ROUTE21CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE21CURSCRIPT], a
	ret
; 0x55efe

Route21_Unknown55efe: ; 55efe (15:5efe)
INCBIN "baserom.gbc",$55efe,$55f04 - $55efe

Route21Texts: ; 55f04 (15:5f04)
	dw Route21Text1, Route21Text2, Route21Text3, Route21Text4, Route21Text5, Route21Text6, Route21Text7, Route21Text8, Route21Text9

Route21TrainerHeaders: ; 55f16 (15:5f16)
Route21TrainerHeader0: ; 55f16 (15:5f16)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d7e9 ; flag's byte
	dw Route21BattleText1 ; 0x5fdd TextBeforeBattle
	dw Route21AfterBattleText1 ; 0x5fe7 TextAfterBattle
	dw Route21EndBattleText1 ; 0x5fe2 TextEndBattle
	dw Route21EndBattleText1 ; 0x5fe2 TextEndBattle
; 0x55f22

Route21TrainerHeader1: ; 55f22 (15:5f22)
	db $2 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d7e9 ; flag's byte
	dw Route21BattleText2 ; 0x5fec TextBeforeBattle
	dw Route21AfterBattleText2 ; 0x5ff6 TextAfterBattle
	dw Route21EndBattleText2 ; 0x5ff1 TextEndBattle
	dw Route21EndBattleText2 ; 0x5ff1 TextEndBattle
; 0x55f2e

Route21TrainerHeader2: ; 55f2e (15:5f2e)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e9 ; flag's byte
	dw Route21BattleText3 ; 0x5ffb TextBeforeBattle
	dw Route21AfterBattleText3 ; 0x6005 TextAfterBattle
	dw Route21EndBattleText3 ; 0x6000 TextEndBattle
	dw Route21EndBattleText3 ; 0x6000 TextEndBattle
; 0x55f3a

Route21TrainerHeader3: ; 55f3a (15:5f3a)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e9 ; flag's byte
	dw Route21BattleText4 ; 0x600a TextBeforeBattle
	dw Route21AfterBattleText4 ; 0x6014 TextAfterBattle
	dw Route21EndBattleText4 ; 0x600f TextEndBattle
	dw Route21EndBattleText4 ; 0x600f TextEndBattle
; 0x55f46

Route21TrainerHeader4: ; 55f46 (15:5f46)
	db $5 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e9 ; flag's byte
	dw Route21BattleText5 ; 0x6019 TextBeforeBattle
	dw Route21AfterBattleText5 ; 0x6023 TextAfterBattle
	dw Route21EndBattleText5 ; 0x601e TextEndBattle
	dw Route21EndBattleText5 ; 0x601e TextEndBattle
; 0x55f52

Route21TrainerHeader5: ; 55f52 (15:5f52)
	db $6 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e9 ; flag's byte
	dw Route21BattleText6 ; 0x6028 TextBeforeBattle
	dw Route21AfterBattleText6 ; 0x6032 TextAfterBattle
	dw Route21EndBattleText6 ; 0x602d TextEndBattle
	dw Route21EndBattleText6 ; 0x602d TextEndBattle
; 0x55f5e

Route21TrainerHeader6: ; 55f5e (15:5f5e)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e9 ; flag's byte
	dw Route21BattleText7 ; 0x6037 TextBeforeBattle
	dw Route21AfterBattleText7 ; 0x6041 TextAfterBattle
	dw Route21EndBattleText7 ; 0x603c TextEndBattle
	dw Route21EndBattleText7 ; 0x603c TextEndBattle
; 0x55f6a

Route21TrainerHeader7: ; 55f6a (15:5f6a)
	db $8 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d7e9 ; flag's byte
	dw Route21BattleText8 ; 0x6046 TextBeforeBattle
	dw Route21AfterBattleText8 ; 0x6050 TextAfterBattle
	dw Route21EndBattleText8 ; 0x604b TextEndBattle
	dw Route21EndBattleText8 ; 0x604b TextEndBattle
; 0x55f76

Route21TrainerHeader8: ; 55f76 (15:5f76)
	db $9 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d7e9 ; flag's byte
	dw Route21BattleText9 ; 0x6055 TextBeforeBattle
	dw Route21AfterBattleText9 ; 0x605f TextAfterBattle
	dw Route21EndBattleText9 ; 0x605a TextEndBattle
	dw Route21EndBattleText9 ; 0x605a TextEndBattle
; 0x55f82

db $ff

Route21Text1: ; 55f83 (15:5f83)
	db $08 ; asm
	ld hl, Route21TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route21Text2: ; 55f8d (15:5f8d)
	db $08 ; asm
	ld hl, Route21TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route21Text3: ; 55f97 (15:5f97)
	db $08 ; asm
	ld hl, Route21TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route21Text4: ; 55fa1 (15:5fa1)
	db $08 ; asm
	ld hl, Route21TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route21Text5: ; 55fab (15:5fab)
	db $08 ; asm
	ld hl, Route21TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route21Text6: ; 55fb5 (15:5fb5)
	db $08 ; asm
	ld hl, Route21TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route21Text7: ; 55fbf (15:5fbf)
	db $08 ; asm
	ld hl, Route21TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route21Text8: ; 55fc9 (15:5fc9)
	db $08 ; asm
	ld hl, Route21TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

Route21Text9: ; 55fd3 (15:5fd3)
	db $08 ; asm
	ld hl, Route21TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

Route21BattleText1: ; 55fdd (15:5fdd)
	TX_FAR _Route21BattleText1
	db $50
; 0x55fdd + 5 bytes

Route21EndBattleText1: ; 55fe2 (15:5fe2)
	TX_FAR _Route21EndBattleText1
	db $50
; 0x55fe2 + 5 bytes

Route21AfterBattleText1: ; 55fe7 (15:5fe7)
	TX_FAR _Route21AfterBattleText1
	db $50
; 0x55fe7 + 5 bytes

Route21BattleText2: ; 55fec (15:5fec)
	TX_FAR _Route21BattleText2
	db $50
; 0x55fec + 5 bytes

Route21EndBattleText2: ; 55ff1 (15:5ff1)
	TX_FAR _Route21EndBattleText2
	db $50
; 0x55ff1 + 5 bytes

Route21AfterBattleText2: ; 55ff6 (15:5ff6)
	TX_FAR _Route21AfterBattleText2
	db $50
; 0x55ff6 + 5 bytes

Route21BattleText3: ; 55ffb (15:5ffb)
	TX_FAR _Route21BattleText3
	db $50
; 0x55ffb + 5 bytes

Route21EndBattleText3: ; 56000 (15:6000)
	TX_FAR _Route21EndBattleText3
	db $50
; 0x56000 + 5 bytes

Route21AfterBattleText3: ; 56005 (15:6005)
	TX_FAR _Route21AfterBattleText3
	db $50
; 0x56005 + 5 bytes

Route21BattleText4: ; 5600a (15:600a)
	TX_FAR _Route21BattleText4
	db $50
; 0x5600a + 5 bytes

Route21EndBattleText4: ; 5600f (15:600f)
	TX_FAR _Route21EndBattleText4
	db $50
; 0x5600f + 5 bytes

Route21AfterBattleText4: ; 56014 (15:6014)
	TX_FAR _Route21AfterBattleText4
	db $50
; 0x56014 + 5 bytes

Route21BattleText5: ; 56019 (15:6019)
	TX_FAR _Route21BattleText5
	db $50
; 0x56019 + 5 bytes

Route21EndBattleText5: ; 5601e (15:601e)
	TX_FAR _Route21EndBattleText5
	db $50
; 0x5601e + 5 bytes

Route21AfterBattleText5: ; 56023 (15:6023)
	TX_FAR _Route21AfterBattleText5
	db $50
; 0x56023 + 5 bytes

Route21BattleText6: ; 56028 (15:6028)
	TX_FAR _Route21BattleText6
	db $50
; 0x56028 + 5 bytes

Route21EndBattleText6: ; 5602d (15:602d)
	TX_FAR _Route21EndBattleText6
	db $50
; 0x5602d + 5 bytes

Route21AfterBattleText6: ; 56032 (15:6032)
	TX_FAR _Route21AfterBattleText6
	db $50
; 0x56032 + 5 bytes

Route21BattleText7: ; 56037 (15:6037)
	TX_FAR _Route21BattleText7
	db $50
; 0x56037 + 5 bytes

Route21EndBattleText7: ; 5603c (15:603c)
	TX_FAR _Route21EndBattleText7
	db $50
; 0x5603c + 5 bytes

Route21AfterBattleText7: ; 56041 (15:6041)
	TX_FAR _Route21AfterBattleText7
	db $50
; 0x56041 + 5 bytes

Route21BattleText8: ; 56046 (15:6046)
	TX_FAR _Route21BattleText8
	db $50
; 0x56046 + 5 bytes

Route21EndBattleText8: ; 5604b (15:604b)
	TX_FAR _Route21EndBattleText8
	db $50
; 0x5604b + 5 bytes

Route21AfterBattleText8: ; 56050 (15:6050)
	TX_FAR _Route21AfterBattleText8
	db $50
; 0x56050 + 5 bytes

Route21BattleText9: ; 56055 (15:6055)
	TX_FAR _Route21BattleText9
	db $50
; 0x56055 + 5 bytes

Route21EndBattleText9: ; 5605a (15:605a)
	TX_FAR _Route21EndBattleText9
	db $50
; 0x5605a + 5 bytes

Route21AfterBattleText9: ; 5605f (15:605f)
	TX_FAR _Route21AfterBattleText9
	db $50
; 0x5605f + 5 bytes

VermilionHouse2_h: ; 0x56064 to 0x56070 (12 bytes) (id=163)
	db $08 ; tileset
	db VERMILION_HOUSE_2_HEIGHT, VERMILION_HOUSE_2_WIDTH ; dimensions (y, x)
	dw VermilionHouse2Blocks, VermilionHouse2Texts, VermilionHouse2Script ; blocks, texts, scripts
	db $00 ; connections

	dw VermilionHouse2Object ; objects

VermilionHouse2Script: ; 56070 (15:6070)
	jp EnableAutoTextBoxDrawing
; 0x56073

VermilionHouse2Texts: ; 56073 (15:6073)
	dw VermilionHouse2Text1

VermilionHouse2Text1: ; 56075 (15:6075)
	db $08 ; asm
	ld a, [$d728]
	bit 3, a
	jr nz, asm_03ef5 ; 0x5607b
	ld hl, UnnamedText_560b1
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, asm_eb1b7 ; 0x5608a
	ld bc, (OLD_ROD << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, $d728
	set 3, [hl]
	ld hl, UnnamedText_560b6
	jr asm_5dd95 ; 0x5609c
.BagFull
	ld hl, UnnamedText_560ca
	jr asm_5dd95 ; 0x560a1
asm_eb1b7 ; 0x560a3
	ld hl, UnnamedText_560c0
	jr asm_5dd95 ; 0x560a6
asm_03ef5 ; 0x560a8
	ld hl, UnnamedText_560c5
asm_5dd95 ; 0x560ab
	call PrintText
	jp TextScriptEnd

UnnamedText_560b1: ; 560b1 (15:60b1)
	TX_FAR _UnnamedText_560b1
	db $50
; 0x560b1 + 5 bytes

UnnamedText_560b6: ; 560b6 (15:60b6)
	TX_FAR _UnnamedText_560b6 ; 0x9c554
	db $0B
	TX_FAR _UnnamedText_560bb ; 0x9c5a4
	db $50
; 0x560c0

UnnamedText_560c0: ; 560c0 (15:60c0)
	TX_FAR _UnnamedText_560c0
	db $50
; 0x560c0 + 5 bytes

UnnamedText_560c5: ; 560c5 (15:60c5)
	TX_FAR _UnnamedText_560c5
	db $50
; 0x560c5 + 5 bytes

UnnamedText_560ca: ; 560ca (15:60ca)
	TX_FAR _UnnamedText_560ca
	db $50
; 0x560ca + 5 bytes

VermilionHouse2Object: ; 0x560cf (size=26)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $8, $ff
	db $7, $3, $8, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_FISHER, $4 + 4, $2 + 4, $ff, $d3, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

CeladonMart2_h: ; 0x560e9 to 0x560f5 (12 bytes) (id=123)
	db $12 ; tileset
	db CELADON_MART_2_HEIGHT, CELADON_MART_2_WIDTH ; dimensions (y, x)
	dw CeladonMart2Blocks, CeladonMart2Texts, CeladonMart2Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMart2Object ; objects

CeladonMart2Script: ; 560f5 (15:60f5)
	jp EnableAutoTextBoxDrawing
; 0x560f8

CeladonMart2Texts: ; 560f8 (15:60f8)
	dw CeladonMart2Text1, CeladonMart2Text2, CeladonMart2Text3, CeladonMart2Text4, CeladonMart2Text5

CeladonMart2Text3: ; 56102 (15:6102)
	TX_FAR _CeladonMart2Text3
	db $50

CeladonMart2Text4: ; 56107 (15:6107)
	TX_FAR _CeladonMart2Text4
	db $50

CeladonMart2Text5: ; 5610c (15:610c)
	TX_FAR _CeladonMart2Text5
	db $50

CeladonMart2Object: ; 0x56111 (size=55)
	db $f ; border tile

	db $3 ; warps
	db $1, $c, $4, CELADON_MART_1
	db $1, $10, $1, CELADON_MART_3
	db $1, $1, $0, CELADON_MART_ELEVATOR

	db $1 ; signs
	db $1, $e, $5 ; CeladonMart2Text5

	db $4 ; people
	db SPRITE_MART_GUY, $3 + 4, $5 + 4, $ff, $d0, $1 ; person
	db SPRITE_MART_GUY, $3 + 4, $6 + 4, $ff, $d0, $2 ; person
	db SPRITE_FAT_BALD_GUY, $5 + 4, $13 + 4, $ff, $ff, $3 ; person
	db SPRITE_GIRL, $4 + 4, $e + 4, $fe, $1, $4 ; person

	; warp-to
	EVENT_DISP $a, $1, $c ; CELADON_MART_1
	EVENT_DISP $a, $1, $10 ; CELADON_MART_3
	EVENT_DISP $a, $1, $1 ; CELADON_MART_ELEVATOR

CeladonMart2Blocks: ; 56148 (15:6148)
	INCBIN "maps/celadonmart2.blk"

FuchsiaHouse3_h: ; 0x56170 to 0x5617c (12 bytes) (id=164)
	db $0d ; tileset
	db FUCHSIA_HOUSE_3_HEIGHT, FUCHSIA_HOUSE_3_WIDTH ; dimensions (y, x)
	dw FuchsiaHouse3Blocks, FuchsiaHouse3Texts, FuchsiaHouse3Script ; blocks, texts, scripts
	db $00 ; connections

	dw FuchsiaHouse3Object ; objects

FuchsiaHouse3Script: ; 5617c (15:617c)
	jp EnableAutoTextBoxDrawing
; 0x5617f

FuchsiaHouse3Texts: ; 5617f (15:617f)
	dw FuchsiaHouse3Text1

FuchsiaHouse3Text1: ; 56181 (15:6181)
	db $08 ; asm
	ld a, [$d728]
	bit 4, a
	jr nz, asm_6084e ; 0x56187
	ld hl, UnnamedText_561bd
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, asm_3ace4 ; 0x56196
	ld bc, (GOOD_ROD << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, $d728
	set 4, [hl]
	ld hl, UnnamedText_561c2
	jr asm_1b09c ; 0x561a8
.BagFull
	ld hl, UnnamedText_5621c
	jr asm_1b09c ; 0x561ad
asm_3ace4 ; 0x561af
	ld hl, UnnamedText_56212
	jr asm_1b09c ; 0x561b2
asm_6084e ; 0x561b4
	ld hl, UnnamedText_56217
asm_1b09c ; 0x561b7
	call PrintText
	jp TextScriptEnd

UnnamedText_561bd: ; 561bd (15:61bd)
	TX_FAR _UnnamedText_561bd
	db $50
; 0x561bd + 5 bytes

UnnamedText_561c2: ; 561c2 (15:61c2)
	TX_FAR _UnnamedText_561c2 ; 0xa06e8
	db $0B, $50
; 0x561c8

INCBIN "baserom.gbc",$561c8,$56212 - $561c8

UnnamedText_56212: ; 56212 (15:6212)
	TX_FAR _UnnamedText_56212
	db $50
; 0x56212 + 5 bytes

UnnamedText_56217: ; 56217 (15:6217)
	TX_FAR _UnnamedText_56217
	db $50
; 0x56217 + 5 bytes

UnnamedText_5621c: ; 5621c (15:621c)
	TX_FAR _UnnamedText_5621c
	db $50
; 0x5621c + 5 bytes

FuchsiaHouse3Object: ; 0x56221 (size=34)
	db $c ; border tile

	db $3 ; warps
	db $0, $2, $8, $ff
	db $7, $2, $7, $ff
	db $7, $3, $7, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_FISHER, $3 + 4, $5 + 4, $ff, $d3, $1 ; person

	; warp-to
	EVENT_DISP $4, $0, $2
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

DayCareM_h: ; 0x56243 to 0x5624f (12 bytes) (id=72)
	db $08 ; tileset
	db DAYCAREM_HEIGHT, DAYCAREM_WIDTH ; dimensions (y, x)
	dw DayCareMBlocks, DayCareMTexts, DayCareMScript ; blocks, texts, scripts
	db $00 ; connections

	dw DayCareMObject ; objects

DayCareMScript: ; 5624f (15:624f)
	jp EnableAutoTextBoxDrawing
; 0x56252

DayCareMTexts: ; 56252 (15:6252)
	dw DayCareMText1

DayCareMText1: ; 56254 (15:6254)
	db $8
	call SaveScreenTilesToBuffer2
	ld a, [$da48]
	and a
	jp nz, Unnamed_562e1
	ld hl, UnnamedText_5640f
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	ld hl, UnnamedText_5643b
	jp nz, Unnamed_56409
	ld a, [$d163]
	dec a
	ld hl, UnnamedText_56445
	jp z, Unnamed_56409
	ld hl, UnnamedText_56414
	call PrintText
	xor a
	ld [$cfcb], a
	ld [$d07d], a
	ld [$cc35], a
	call DisplayPartyMenu
	push af
	call GBPalWhiteOutWithDelay3
	call Func_3dbe
	call LoadGBPal
	pop af
	ld hl, UnnamedText_56437
	jp c, Unnamed_56409
	ld hl, Func_2171b
	ld b, BANK(Func_2171b)
	call Bankswitch
	ld hl, UnnamedText_5644a
	jp c, Unnamed_56409
	xor a
	ld [$cc2b], a
	ld a, [$cf92]
	ld hl, $d2b5
	call GetPartyMonName
	ld hl, UnnamedText_56419
	call PrintText
	ld a, $1
	ld [$da48], a
	ld a, $3
	ld [$cf95], a
	call Func_3a68
	xor a
	ld [$cf95], a
	call RemovePokemon
	ld a, [$cf91]
	call PlayCry
	ld hl, UnnamedText_5641e
	jp Unnamed_56409
; 0x562e1

Unnamed_562e1: ; 562e1 (15:62e1)
INCBIN "baserom.gbc",$562e1,$56409 - $562e1

Unnamed_56409: ; 56409 (15:6409)
	call PrintText
	jp TextScriptEnd
; 0x5640f

UnnamedText_5640f: ; 5640f (15:640f)
	TX_FAR _UnnamedText_5640f
	db $50
; 0x5640f + 5 bytes

UnnamedText_56414: ; 56414 (15:6414)
	TX_FAR _UnnamedText_56414
	db $50
; 0x56414 + 5 bytes

UnnamedText_56419: ; 56419 (15:6419)
	TX_FAR _UnnamedText_56419
	db $50
; 0x56419 + 5 bytes

UnnamedText_5641e: ; 5641e (15:641e)
	TX_FAR _UnnamedText_5641e
	db $50
; 0x5641e + 5 bytes

UnnamedText_56423: ; 56423 (15:6423)
	TX_FAR _UnnamedText_56423
	db $50
; 0x56423 + 5 bytes

UnnamedText_56428: ; 56428 (15:6428)
	TX_FAR _UnnamedText_56428
	db $50
; 0x56428 + 5 bytes

UnnamedText_5642d: ; 5642d (15:642d)
	TX_FAR _UnnamedText_5642d
	db $50
; 0x5642d + 5 bytes

UnnamedText_56432: ; 56432 (15:6432)
	TX_FAR _UnnamedText_56432
	db $50
; 0x56432 + 5 bytes

UnnamedText_56437: ; 56437 (15:6437)
	TX_FAR _UnnamedText_56437 ; 0x8c000
UnnamedText_5643b: ; 5643b (15:643b)
	TX_FAR _UnnamedText_5643b ; 0x8c013
	db $50
; 0x5643b + 5 bytes

UnnamedText_56440: ; 56440 (15:6440)
	TX_FAR _UnnamedText_56440
	db $50
; 0x56440 + 5 bytes

UnnamedText_56445: ; 56445 (15:6445)
	TX_FAR _UnnamedText_56445
	db $50
; 0x56445 + 5 bytes

UnnamedText_5644a: ; 5644a (15:644a)
	TX_FAR _UnnamedText_5644a
	db $50
; 0x5644a + 5 bytes

UnnamedText_5644f: ; 5644f (15:644f)
	TX_FAR _UnnamedText_5644f
	db $50
; 0x5644f + 5 bytes

UnnamedText_56454: ; 56454 (15:6454)
	TX_FAR _UnnamedText_56454
	db $50
; 0x56454 + 5 bytes

DayCareMObject: ; 0x56459 (size=26)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $4, $ff
	db $7, $3, $4, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_GENTLEMAN, $3 + 4, $2 + 4, $ff, $d3, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

Route12House_h: ; 0x56473 to 0x5647f (12 bytes) (id=189)
	db $08 ; tileset
	db ROUTE_12_HOUSE_HEIGHT, ROUTE_12_HOUSE_WIDTH ; dimensions (y, x)
	dw Route12HouseBlocks, Route12HouseTexts, Route12HouseScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route12HouseObject ; objects

Route12HouseScript: ; 5647f (15:647f)
	jp EnableAutoTextBoxDrawing
; 0x56482

Route12HouseTexts: ; 56482 (15:6482)
	dw Route12HouseText1

Route12HouseText1: ; 56484 (15:6484)
	db $08 ; asm
	ld a, [$d728]
	bit 5, a
	jr nz, asm_b4cad ; 0x5648a
	ld hl, UnnamedText_564c0
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, asm_a2d76 ; 0x56499
	ld bc, (SUPER_ROD << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, $d728
	set 5, [hl]
	ld hl, UnnamedText_564c5
	jr asm_df984 ; 0x564ab
.BagFull
	ld hl, UnnamedText_564d9
	jr asm_df984 ; 0x564b0
asm_a2d76 ; 0x564b2
	ld hl, UnnamedText_564cf
	jr asm_df984 ; 0x564b5
asm_b4cad ; 0x564b7
	ld hl, UnnamedText_564d4
asm_df984 ; 0x564ba
	call PrintText
	jp TextScriptEnd

UnnamedText_564c0: ; 564c0 (15:64c0)
	TX_FAR _UnnamedText_564c0
	db $50
; 0x564c0 + 5 bytes

UnnamedText_564c5: ; 564c5 (15:64c5)
	TX_FAR _UnnamedText_564c5 ; 0x8ca00
	db $0B
	TX_FAR _UnnamedText_564ca ; 0x8ca4f
	db $50
; 0x564c5 + 10 bytes = 0x564cf

UnnamedText_564cf: ; 564cf (15:64cf)
	TX_FAR _UnnamedText_564cf
	db $50
; 0x564cf + 5 bytes

UnnamedText_564d4: ; 564d4 (15:64d4)
	TX_FAR _UnnamedText_564d4
	db $50
; 0x564d4 + 5 bytes

UnnamedText_564d9: ; 564d9 (15:64d9)
	TX_FAR _UnnamedText_564d9
	db $50
; 0x564d9 + 5 bytes

Route12HouseObject: ; 0x564de (size=26)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $3, $ff
	db $7, $3, $3, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_FISHER, $4 + 4, $2 + 4, $ff, $d3, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

SilphCo8_h: ; 0x564f8 to 0x56504 (12 bytes) (id=213)
	db $16 ; tileset
	db SILPH_CO_8F_HEIGHT, SILPH_CO_8F_WIDTH ; dimensions (y, x)
	dw SilphCo8Blocks, SilphCo8Texts, SilphCo8Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo8Object ; objects

SilphCo8Script: ; 56504 (15:6504)
	call SilphCo8_Unknown5651a
	call EnableAutoTextBoxDrawing
	ld hl, SilphCo8TrainerHeader0
	ld de, Unknown_56577 ; $6577
	ld a, [W_SILPHCO8CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SILPHCO8CURSCRIPT], a
	ret
; 0x5651a

SilphCo8_Unknown5651a: ; 5651a (15:651a)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, Unknown_5653e ; $653e
	call Func_56541
	call Func_5656d
	ld a, [$d832]
	bit 0, a
	ret nz
	ld a, $5f
	ld [$d09f], a
	ld bc, $403
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

Unknown_5653e: ; 5653e (15:653e)
INCBIN "baserom.gbc",$5653e,$56541 - $5653e

; known jump sources: 56525 (15:6525)
Func_56541: ; 56541 (15:6541)
	push hl
	ld hl, $d73f
	ld a, [hli]
	ld b, a
	ld a, [hl]
	ld c, a
	xor a
	ld [$FF00+$e0], a
	pop hl
.asm_5654d
	ld a, [hli]
	cp $ff
	jr z, .asm_56569
	push hl
	ld hl, $ffe0
	inc [hl]
	pop hl
	cp b
	jr z, .asm_5655e
	inc hl
	jr .asm_5654d
.asm_5655e
	ld a, [hli]
	cp c
	jr nz, .asm_5654d
	ld hl, $d73f
	xor a
	ld [hli], a
	ld [hl], a
	ret
.asm_56569
	xor a
	ld [$FF00+$e0], a
	ret

; known jump sources: 56528 (15:6528)
Func_5656d: ; 5656d (15:656d)
	ld a, [$FF00+$e0]
	and a
	ret z
	ld hl, $d832
	set 0, [hl]
	ret

Unknown_56577: ; 56577 (15:6577)
INCBIN "baserom.gbc",$56577,$5657d - $56577

SilphCo8Texts: ; 5657d (15:657d)
	dw SilphCo8Text1, SilphCo8Text2, SilphCo8Text3, SilphCo8Text4

SilphCo8TrainerHeaders: ; 56585 (15:6585)
SilphCo8TrainerHeader0: ; 56585 (15:6585)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d831 ; flag's byte
	dw SilphCo8BattleText1 ; 0x65e6 TextBeforeBattle
	dw SilphCo8AfterBattleText1 ; 0x65f0 TextAfterBattle
	dw SilphCo8EndBattleText1 ; 0x65eb TextEndBattle
	dw SilphCo8EndBattleText1 ; 0x65eb TextEndBattle
; 0x56591

SilphCo8TrainerHeader1: ; 56591 (15:6591)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d831 ; flag's byte
	dw SilphCo8BattleText2 ; 0x65f5 TextBeforeBattle
	dw SilphCo8AfterBattleText2 ; 0x65ff TextAfterBattle
	dw SilphCo8EndBattleText2 ; 0x65fa TextEndBattle
	dw SilphCo8EndBattleText2 ; 0x65fa TextEndBattle
; 0x5659d

SilphCo8TrainerHeader2: ; 5659d (15:659d)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d831 ; flag's byte
	dw SilphCo8BattleText3 ; 0x6604 TextBeforeBattle
	dw SilphCo8AfterBattleText3 ; 0x660e TextAfterBattle
	dw SilphCo8EndBattleText3 ; 0x6609 TextEndBattle
	dw SilphCo8EndBattleText3 ; 0x6609 TextEndBattle
; 0x565a9

db $ff

SilphCo8Text1: ; 565aa (15:65aa)
	db $08 ; asm
	ld a, [$d838]
	bit 7, a
	ld hl, UnnamedText_565c3
	jr nz, asm_a468f ; 0x565b3
	ld hl, UnnamedText_565be
asm_a468f ; 0x565b8
	call PrintText
	jp TextScriptEnd

UnnamedText_565be: ; 565be (15:65be)
	TX_FAR _UnnamedText_565be
	db $50
; 0x565be + 5 bytes

UnnamedText_565c3: ; 565c3 (15:65c3)
	TX_FAR _UnnamedText_565c3
	db $50
; 0x565c3 + 5 bytes

SilphCo8Text2: ; 565c8 (15:65c8)
	db $08 ; asm
	ld hl, SilphCo8TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SilphCo8Text3: ; 565d2 (15:65d2)
	db $08 ; asm
	ld hl, SilphCo8TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SilphCo8Text4: ; 565dc (15:65dc)
	db $08 ; asm
	ld hl, SilphCo8TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SilphCo8BattleText1: ; 565e6 (15:65e6)
	TX_FAR _SilphCo8BattleText1
	db $50
; 0x565e6 + 5 bytes

SilphCo8EndBattleText1: ; 565eb (15:65eb)
	TX_FAR _SilphCo8EndBattleText1
	db $50
; 0x565eb + 5 bytes

SilphCo8AfterBattleText1: ; 565f0 (15:65f0)
	TX_FAR _SilphCo8AfterBattleText1
	db $50
; 0x565f0 + 5 bytes

SilphCo8BattleText2: ; 565f5 (15:65f5)
	TX_FAR _SilphCo8BattleText2
	db $50
; 0x565f5 + 5 bytes

SilphCo8EndBattleText2: ; 565fa (15:65fa)
	TX_FAR _SilphCo8EndBattleText2
	db $50
; 0x565fa + 5 bytes

SilphCo8AfterBattleText2: ; 565ff (15:65ff)
	TX_FAR _SilphCo8AfterBattleText2
	db $50
; 0x565ff + 5 bytes

SilphCo8BattleText3: ; 56604 (15:6604)
	TX_FAR _SilphCo8BattleText3
	db $50
; 0x56604 + 5 bytes

SilphCo8EndBattleText3: ; 56609 (15:6609)
	TX_FAR _SilphCo8EndBattleText3
	db $50
; 0x56609 + 5 bytes

SilphCo8AfterBattleText3: ; 5660e (15:660e)
	TX_FAR _SilphCo8AfterBattleText3
	db $50
; 0x5660e + 5 bytes

SilphCo8Object: ; 0x56613 (size=90)
	db $2e ; border tile

	db $7 ; warps
	db $0, $10, $1, SILPH_CO_9F
	db $0, $e, $0, SILPH_CO_7F
	db $0, $12, $0, SILPH_CO_ELEVATOR
	db $b, $3, $6, SILPH_CO_8F
	db $f, $3, $4, SILPH_CO_2F
	db $5, $b, $5, SILPH_CO_2F
	db $9, $b, $3, SILPH_CO_8F

	db $0 ; signs

	db $4 ; people
	db SPRITE_LAPRAS_GIVER, $2 + 4, $4 + 4, $ff, $ff, $1 ; person
	db SPRITE_ROCKET, $2 + 4, $13 + 4, $ff, $d2, $42, ROCKET + $C8, $23 ; trainer
	db SPRITE_OAK_AIDE, $2 + 4, $a + 4, $ff, $d0, $43, SCIENTIST + $C8, $9 ; trainer
	db SPRITE_ROCKET, $f + 4, $c + 4, $ff, $d3, $44, ROCKET + $C8, $24 ; trainer

	; warp-to
	EVENT_DISP $d, $0, $10 ; SILPH_CO_9F
	EVENT_DISP $d, $0, $e ; SILPH_CO_7F
	EVENT_DISP $d, $0, $12 ; SILPH_CO_ELEVATOR
	EVENT_DISP $d, $b, $3 ; SILPH_CO_8F
	EVENT_DISP $d, $f, $3 ; SILPH_CO_2F
	EVENT_DISP $d, $5, $b ; SILPH_CO_2F
	EVENT_DISP $d, $9, $b ; SILPH_CO_8F

SilphCo8Blocks: ; 5666d (15:666d)
	INCBIN "maps/silphco8.blk"

DisplayDiploma: ; 566e2 (15:66e2)
	call SaveScreenTilesToBuffer2
	call GBPalWhiteOutWithDelay3
	call ClearScreen
	xor a
	ld [$cfcb], a
	ld hl, $d730
	set 6, [hl]
	call DisableLCD
	ld hl, BlankLeaderNames + $160 ; $7d88 ; circle tile
	ld de, $9700
	ld bc, $0010
	ld a, BANK(BlankLeaderNames)
	call FarCopyData2
	ld hl, W_SCREENTILESBUFFER
	ld bc, $1012
	ld a, $27
	call Predef
	ld hl, Unknown_56784 ; $6784
	ld c, $5
.asm_56715
	push bc
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	ld a, [hli]
	push hl
	ld h, [hl]
	ld l, a
	call PlaceString
	pop hl
	inc hl
	pop bc
	dec c
	jr nz, .asm_56715 ; 0x56725 $ee
	FuncCoord 10, 4 ; $c3fa
	ld hl, Coord
	ld de, $d158
	call PlaceString
	ld b, BANK(Func_44dd)
	ld hl, Func_44dd
	call Bankswitch
	ld hl, $c301
	ld bc, $8028
.asm_5673e
	ld a, [hl]
	add $21
	ld [hli], a
	inc hl
	ld a, b
	ld [hli], a
	inc hl
	dec c
	jr nz, .asm_5673e ; 0x56747 $f5
	call EnableLCD
	ld b, BANK(Func_5ae6)
	ld hl, Func_5ae6
	call Bankswitch
	ld b, $8
	call GoPAL_SET
	call Delay3
	call GBPalNormal
	ld a, $90
	ld [$ff00+$48], a
	call WaitForTextScrollButtonPress
	ld hl, $d730
	res 6, [hl]
	call GBPalWhiteOutWithDelay3
	call Func_3dbe
	call Delay3
	jp GBPalNormal
; 0x56777

Func_56777: ; 56777 (15:6777)
	ld hl, $d158
	ld bc, $ff00
.asm_5677d
	ld a, [hli]
	cp $50
	ret z
	dec c
	jr .asm_5677d ; 0x56782 $f9

Unknown_56784: ; 56784 (15:6784)
INCBIN "baserom.gbc",$56784,$567f9 - $56784

; known jump sources: 3303 (0:3303)
Func_567f9: ; 567f9 (15:67f9)
	ld hl, $c100
	ld de, $4
	ld a, [$cf13]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call Func_56903
	ld a, [hli]
	ld [$FF00+$eb], a
	inc hl
	ld a, [hl]
	ld [$FF00+$ec], a
	ld de, $fe
	add hl, de
	ld a, [hli]
	ld [$FF00+$ed], a
	ld a, [hl]
	ld [$FF00+$ee], a
	ret

Func_56819: ; 56819 (15:6819)
	ld hl, $c100
	ld de, $0004
	ld a, [$cf13]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call Func_56903
	ld a, [hli]
	ld [$d130], a
	inc hl
	ld a, [hl]
	ld [$d131], a
	ld de, $00fe
	add hl, de
	ld a, [hli]
	ld [$d132], a
	ld a, [hl]
	ld [$d133], a
	ret
; 0x5683d

Func_5683d: ; 5683d (15:683d)
	ld hl, $c100
	ld de, $4
	ld a, [$cf13]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call Func_56903
	ld a, [$FF00+$eb]
	ld [hli], a
	inc hl
	ld a, [$FF00+$ec]
	ld [hl], a
	ld de, $fe
	add hl, de
	ld a, [$FF00+$ed]
	ld [hli], a
	ld a, [$FF00+$ee]
	ld [hl], a
	ret

Func_5685d: ; 5685d (15:685d)
	ld hl, $c100
	ld de, $0004
	ld a, [$cf13]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call Func_56903
	ld a, [$d130]
	ld [hli], a
	inc hl
	ld a, [$d131]
	ld [hl], a
	ld de, $00fe
	add hl, de
	ld a, [$d132]
	ld [hli], a
	ld a, [$d133]
	ld [hl], a
	ret
; 0x56881

; known jump sources: 32d4 (0:32d4)
TrainerWalkUpToPlayer: ; 56881 (15:6881)
	ld a, [$cf13]
	swap a
	ld [W_TRAINERSPRITEOFFSET], a ; $cd3d
	call ReadTrainerScreenPosition
	ld a, [W_TRAINERFACINGDIR]
	and a
	jr z, .facingDown
	cp $4
	jr z, .facingUp
	cp $8
	jr z, .facingLeft
	jr .facingRight
.facingDown
	ld a, [W_TRAINERSCREENYPOS]
	ld b, a
	ld a, $3c           ; (fixed) player screen Y pos
	call CalcDifference
	cp $10              ; trainer is right above player
	ret z
	swap a
	dec a
	ld c, a             ; bc = steps yet to go to reach player
	xor a
	ld b, a           ; a = direction to go to
	jr .writeWalkScript
.facingUp
	ld a, [W_TRAINERSCREENYPOS]
	ld b, a
	ld a, $3c           ; (fixed) player screen Y pos
	call CalcDifference
	cp $10              ; trainer is right below player
	ret z
	swap a
	dec a
	ld c, a             ; bc = steps yet to go to reach player
	ld b, $0
	ld a, $40           ; a = direction to go to
	jr .writeWalkScript
.facingRight
	ld a, [W_TRAINERSCREENXPOS]
	ld b, a
	ld a, $40           ; (fixed) player screen X pos
	call CalcDifference
	cp $10              ; trainer is directly left of player
	ret z
	swap a
	dec a
	ld c, a             ; bc = steps yet to go to reach player
	ld b, $0
	ld a, $c0           ; a = direction to go to
	jr .writeWalkScript
.facingLeft
	ld a, [$cd41]
	ld b, a
	ld a, $40           ; (fixed) player screen X pos
	call CalcDifference
	cp $10              ; trainer is directly right of player
	ret z
	swap a
	dec a
	ld c, a             ; bc = steps yet to go to reach player
	ld b, $0
	ld a, $80           ; a = direction to go to
.writeWalkScript
	ld hl, $cc97
	ld de, $cc97
	call FillMemory     ; write the necessary steps to reach player
	ld [hl], $ff        ; write end of list sentinel
	ld a, [$cf13]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp MoveSprite_

; known jump sources: 56804 (15:6804), 56848 (15:6848)
Func_56903: ; 56903 (15:6903)
	push de
	add hl, de
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	swap a
	ld d, $0
	ld e, a
	add hl, de
	pop de
	ret

; tests if this trainer is in the right position to engage the player and do so if she is.
CheckEngagePlayer: ; 5690f (15:690f)
	push hl
	push de
	ld a, [W_TRAINERSPRITEOFFSET] ; $cd3d
	add $2
	ld d, $0
	ld e, a
	ld hl, $c100
	add hl, de
	ld a, [hl]             ; c1x2: sprite image index
	sub $ff
	jr nz, .spriteOnScreen ; test if sprite is on screen
	jp .noEngage
.spriteOnScreen
	ld a, [W_TRAINERSPRITEOFFSET] ; $cd3d
	add $9
	ld d, $0
	ld e, a
	ld hl, $c100
	add hl, de
	ld a, [hl]             ; c1x9: facing direction
	ld [$cd3f], a
	call ReadTrainerScreenPosition
	ld a, [$cd40]          ; sprite screen Y pos
	ld b, a
	ld a, $3c
	cp b
	jr z, .linedUpY
	ld a, [$cd41]          ; sprite screen X pos
	ld b, a
	ld a, $40
	cp b
	jr z, .linedUpX
	xor a
	jp .noEngage
.linedUpY
	ld a, [$cd41]        ; sprite screen X pos
	ld b, a
	ld a, $40            ; (fixed) player X position
	call CalcDifference  ; calc distance
	jr z, .noEngage      ; exact same position as player
	call CheckSpriteCanSeePlayer
	jr c, .engage
	xor a
	jr .noEngage
.linedUpX
	ld a, [$cd40]        ; sprite screen Y pos
	ld b, a
	ld a, $3c            ; (fixed) player Y position
	call CalcDifference  ; calc distance
	jr z, .noEngage      ; exact same position as player
	call CheckSpriteCanSeePlayer
	jr c, .engage
	xor a
	jp .noEngage
.engage
	call CheckPlayerIsInFrontOfSprite
	ld a, [W_TRAINERSPRITEOFFSET] ; $cd3d
	and a
	jr z, .noEngage
	ld hl, W_FLAGS_CD60
	set 0, [hl]
	call EngageMapTrainer
	ld a, $ff
.noEngage: ; 56988 (15:6988)
	ld [W_TRAINERSPRITEOFFSET], a ; $cd3d
	pop de
	pop hl
	ret

; reads trainer's Y position to $cd40 and X position to $cd41
ReadTrainerScreenPosition: ; 5698e (15:698e)
	ld a, [W_TRAINERSPRITEOFFSET] ; $cd3d
	add $4
	ld d, $0
	ld e, a
	ld hl, $c100
	add hl, de
	ld a, [hl]
	ld [$cd40], a
	ld a, [W_TRAINERSPRITEOFFSET] ; $cd3d
	add $6
	ld d, $0
	ld e, a
	ld hl, $c100
	add hl, de
	ld a, [hl]
	ld [$cd41], a
	ret

; checks if the sprite is properly lined up with the player with respect to the direction it's looking. Also checks the distance between player and sprite
; note that this does not necessarily mean the sprite is seeing the player, he could be behind it's back
; a: distance player to sprite
CheckSpriteCanSeePlayer: ; 569af (15:69af)
	ld b, a
	ld a, [W_TRAINERENGAGEDISTANCE]  ; sprite line of sight (engage distance)
	cp b
	jr nc, .checkIfLinedUp
	jr .notInLine         ; player too far away
.checkIfLinedUp
	ld a, [$cd3f]         ; sprite facing direction
	cp $0                 ; down
	jr z, .checkXCoord
	cp $4                 ; up
	jr z, .checkXCoord
	cp $8                 ; left
	jr z, .checkYCoord
	cp $c                 ; right
	jr z, .checkYCoord
	jr .notInLine
.checkXCoord
	ld a, [$cd41]         ; sprite screen X position
	ld b, a
	cp $40
	jr z, .inLine
	jr .notInLine
.checkYCoord
	ld a, [$cd40]         ; sprite screen Y position
	ld b, a
	cp $3c
	jr nz, .notInLine
.inLine
	scf
	ret
.notInLine
	and a
	ret

; tests if the player is in front of the sprite (rather than behind it)
CheckPlayerIsInFrontOfSprite: ; 569e3 (15:69e3)
	ld a, [W_CURMAP] ; $d35e
	cp POWER_PLANT
	jp z, .engage       ; XXX not sure why bypass this for power plant (maybe to get voltorb fake items to work?)
	ld a, [W_TRAINERSPRITEOFFSET] ; $cd3d
	add $4
	ld d, $0
	ld e, a
	ld hl, $c100
	add hl, de
	ld a, [hl]          ; c1x4 (sprite screen Y pos)
	cp $fc
	jr nz, .notOnTopmostTile ; special case if sprite is on topmost tile (Y = $fc (-4)), make it come down a block
	ld a, $c
.notOnTopmostTile
	ld [$cd40], a
	ld a, [W_TRAINERSPRITEOFFSET] ; $cd3d
	add $6
	ld d, $0
	ld e, a
	ld hl, $c100
	add hl, de
	ld a, [hl]          ; c1x6 (sprite screen X pos)
	ld [$cd41], a
	ld a, [$cd3f]       ; facing direction
	cp $0
	jr nz, .notFacingDown
	ld a, [$cd40]       ; sprite screen Y pos
	cp $3c
	jr c, .engage       ; sprite above player
	jr .noEngage        ; sprite below player
.notFacingDown
	cp $4
	jr nz, .notFacingUp
	ld a, [$cd40]       ; sprite screen Y pos
	cp $3c
	jr nc, .engage      ; sprite below player
	jr .noEngage        ; sprite above player
.notFacingUp
	cp $8
	jr nz, .notFacingLeft
	ld a, [$cd41]       ; sprite screen X pos
	cp $40
	jr nc, .engage      ; sprite right of player
	jr .noEngage        ; sprite left of player
.notFacingLeft
	ld a, [$cd41]       ; sprite screen X pos
	cp $40
	jr nc, .noEngage    ; sprite right of player
.engage
	ld a, $ff
	jr .done
.noEngage
	xor a
.done
	ld [W_TRAINERSPRITEOFFSET], a ; $cd3d
	ret
; 56a4b (15:6a4b)

SECTION "bank16",ROMX,BANK[$16]

Route6_h: ; 0x58000 to 0x58022 (34 bytes) (id=17)
	db $00 ; tileset
	db ROUTE_6_HEIGHT, ROUTE_6_WIDTH ; dimensions (y, x)
	dw Route6Blocks, Route6Texts, Route6Script ; blocks, texts, scripts
	db NORTH | SOUTH ; connections

	; connections data

	db SAFFRON_CITY
	dw SaffronCityBlocks + (SAFFRON_CITY_HEIGHT - 3) * SAFFRON_CITY_WIDTH + 2 ; connection strip location
	dw $C6EB + -3 ; current map position
	db $10, SAFFRON_CITY_WIDTH ; bigness, width
	db (SAFFRON_CITY_HEIGHT * 2) - 1, (-5 * -2) ; alignments (y, x)
	dw $C6E9 + SAFFRON_CITY_HEIGHT * (SAFFRON_CITY_WIDTH + 6) ; window

	db VERMILION_CITY
	dw VermilionCityBlocks + 2 ; connection strip location
	dw $C6EB + (ROUTE_6_HEIGHT + 3) * (ROUTE_6_WIDTH + 6) + -3 ; current map position
	db $10, VERMILION_CITY_WIDTH ; bigness, width
	db 0, (-5 * -2) ; alignments (y, x)
	dw $C6EF + VERMILION_CITY_WIDTH ; window

	; end connections data

	dw Route6Object ; objects

Route6Object: ; 0x58022 (size=87)
	db $f ; border tile

	db $4 ; warps
	db $1, $9, $2, ROUTE_6_GATE
	db $1, $a, $2, ROUTE_6_GATE
	db $7, $a, $0, ROUTE_6_GATE
	db $d, $11, $0, PATH_ENTRANCE_ROUTE_6

	db $1 ; signs
	db $f, $13, $7 ; Route6Text7

	db $6 ; people
	db SPRITE_BLACK_HAIR_BOY_1, $15 + 4, $a + 4, $ff, $d3, $41, JR__TRAINER_M + $C8, $4 ; trainer
	db SPRITE_LASS, $15 + 4, $b + 4, $ff, $d2, $42, JR__TRAINER_F + $C8, $2 ; trainer
	db SPRITE_BUG_CATCHER, $f + 4, $0 + 4, $ff, $d3, $43, BUG_CATCHER + $C8, $a ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $1f + 4, $b + 4, $ff, $d2, $44, JR__TRAINER_M + $C8, $5 ; trainer
	db SPRITE_LASS, $1e + 4, $b + 4, $ff, $d2, $45, JR__TRAINER_F + $C8, $3 ; trainer
	db SPRITE_BUG_CATCHER, $1a + 4, $13 + 4, $ff, $d2, $46, BUG_CATCHER + $C8, $b ; trainer

	; warp-to
	EVENT_DISP $a, $1, $9 ; ROUTE_6_GATE
	EVENT_DISP $a, $1, $a ; ROUTE_6_GATE
	EVENT_DISP $a, $7, $a ; ROUTE_6_GATE
	EVENT_DISP $a, $d, $11 ; PATH_ENTRANCE_ROUTE_6

Route6Blocks: ; 58079 (16:4079)
	INCBIN "maps/route6.blk"

Route8_h: ; 0x5812d to 0x5814f (34 bytes) (id=19)
	db $00 ; tileset
	db ROUTE_8_HEIGHT, ROUTE_8_WIDTH ; dimensions (y, x)
	dw Route8Blocks, Route8Texts, Route8Script ; blocks, texts, scripts
	db WEST | EAST ; connections

	; connections data

	db SAFFRON_CITY
	dw SaffronCityBlocks - 3 + (SAFFRON_CITY_WIDTH * 2) ; connection strip location
	dw $C6E8 + (ROUTE_8_WIDTH + 6) * (-3 + 3) ; current map position
	db $f, SAFFRON_CITY_WIDTH ; bigness, width
	db (-4 * -2), (SAFFRON_CITY_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * SAFFRON_CITY_WIDTH ; window

	db LAVENDER_TOWN
	dw LavenderTownBlocks + (LAVENDER_TOWN_WIDTH * 0) ; connection strip location
	dw $C6E5 + (ROUTE_8_WIDTH + 6) * (0 + 4) ; current map position
	db LAVENDER_TOWN_HEIGHT, LAVENDER_TOWN_WIDTH ; bigness, width
	db (0 * -2), 0 ; alignments (y, x)
	dw $C6EF + LAVENDER_TOWN_WIDTH ; window

	; end connections data

	dw Route8Object ; objects

Route8Object: ; 0x5814f (size=119)
	db $2c ; border tile

	db $5 ; warps
	db $9, $1, $0, ROUTE_8_GATE
	db $a, $1, $1, ROUTE_8_GATE
	db $9, $8, $2, ROUTE_8_GATE
	db $a, $8, $3, ROUTE_8_GATE
	db $3, $d, $0, PATH_ENTRANCE_ROUTE_8

	db $1 ; signs
	db $3, $11, $a ; Route8Text10

	db $9 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $5 + 4, $8 + 4, $ff, $d3, $41, SUPER_NERD + $C8, $3 ; trainer
	db SPRITE_GAMBLER, $9 + 4, $d + 4, $ff, $d1, $42, GAMBLER + $C8, $5 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $6 + 4, $2a + 4, $ff, $d1, $43, SUPER_NERD + $C8, $4 ; trainer
	db SPRITE_LASS, $3 + 4, $1a + 4, $ff, $d2, $44, LASS + $C8, $d ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $4 + 4, $1a + 4, $ff, $d3, $45, SUPER_NERD + $C8, $5 ; trainer
	db SPRITE_LASS, $5 + 4, $1a + 4, $ff, $d2, $46, LASS + $C8, $e ; trainer
	db SPRITE_LASS, $6 + 4, $1a + 4, $ff, $d3, $47, LASS + $C8, $f ; trainer
	db SPRITE_GAMBLER, $d + 4, $2e + 4, $ff, $d0, $48, GAMBLER + $C8, $7 ; trainer
	db SPRITE_LASS, $c + 4, $33 + 4, $ff, $d2, $49, LASS + $C8, $10 ; trainer

	; warp-to
	EVENT_DISP $1e, $9, $1 ; ROUTE_8_GATE
	EVENT_DISP $1e, $a, $1 ; ROUTE_8_GATE
	EVENT_DISP $1e, $9, $8 ; ROUTE_8_GATE
	EVENT_DISP $1e, $a, $8 ; ROUTE_8_GATE
	EVENT_DISP $1e, $3, $d ; PATH_ENTRANCE_ROUTE_8

Route8Blocks: ; 581c6 (16:41c6)
	INCBIN "maps/route8.blk"

Route10_h: ; 0x582d4 to 0x582f6 (34 bytes) (id=21)
	db $00 ; tileset
	db ROUTE_10_HEIGHT, ROUTE_10_WIDTH ; dimensions (y, x)
	dw Route10Blocks, Route10Texts, Route10Script ; blocks, texts, scripts
	db SOUTH | WEST ; connections

	; connections data

	db LAVENDER_TOWN
	dw LavenderTownBlocks ; connection strip location
	dw $C6EB + (ROUTE_10_HEIGHT + 3) * (ROUTE_10_WIDTH + 6) + 0 ; current map position
	db LAVENDER_TOWN_WIDTH, LAVENDER_TOWN_WIDTH ; bigness, width
	db 0, (0 * -2) ; alignments (y, x)
	dw $C6EF + LAVENDER_TOWN_WIDTH ; window

	db ROUTE_9
	dw Route9Blocks - 3 + (ROUTE_9_WIDTH) ; connection strip location
	dw $C6E8 + (ROUTE_10_WIDTH + 6) * (0 + 3) ; current map position
	db ROUTE_9_HEIGHT, ROUTE_9_WIDTH ; bigness, width
	db (0 * -2), (ROUTE_9_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_9_WIDTH ; window

	; end connections data

	dw Route10Object ; objects

Route10Object: ; 0x582f6 (size=96)
	db $2c ; border tile

	db $4 ; warps
	db $13, $b, $0, ROCK_TUNNEL_POKECENTER
	db $11, $8, $0, ROCK_TUNNEL_1
	db $35, $8, $2, ROCK_TUNNEL_1
	db $27, $6, $0, POWER_PLANT

	db $4 ; signs
	db $13, $7, $7 ; Route10Text7
	db $13, $c, $8 ; PokeCenterSignText
	db $37, $9, $9 ; Route10Text9
	db $29, $5, $a ; Route10Text10

	db $6 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $2c + 4, $a + 4, $ff, $d2, $41, POKEMANIAC + $C8, $1 ; trainer
	db SPRITE_HIKER, $39 + 4, $3 + 4, $ff, $d1, $42, HIKER + $C8, $7 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $40 + 4, $e + 4, $ff, $d2, $43, POKEMANIAC + $C8, $2 ; trainer
	db SPRITE_LASS, $19 + 4, $7 + 4, $ff, $d2, $44, JR__TRAINER_F + $C8, $7 ; trainer
	db SPRITE_HIKER, $3d + 4, $3 + 4, $ff, $d0, $45, HIKER + $C8, $8 ; trainer
	db SPRITE_LASS, $36 + 4, $7 + 4, $ff, $d0, $46, JR__TRAINER_F + $C8, $8 ; trainer

	; warp-to
	EVENT_DISP $a, $13, $b ; ROCK_TUNNEL_POKECENTER
	EVENT_DISP $a, $11, $8 ; ROCK_TUNNEL_1
	EVENT_DISP $a, $35, $8 ; ROCK_TUNNEL_1
	EVENT_DISP $a, $27, $6 ; POWER_PLANT

Route10Blocks: ; 58356 (16:4356)
	INCBIN "maps/route10.blk"

Route11_h: ; 0x584be to 0x584e0 (34 bytes) (id=22)
	db $00 ; tileset
	db ROUTE_11_HEIGHT, ROUTE_11_WIDTH ; dimensions (y, x)
	dw Route11Blocks, Route11Texts, Route11Script ; blocks, texts, scripts
	db WEST | EAST ; connections

	; connections data

	db VERMILION_CITY
	dw VermilionCityBlocks - 3 + (VERMILION_CITY_WIDTH * 2) ; connection strip location
	dw $C6E8 + (ROUTE_11_WIDTH + 6) * (-3 + 3) ; current map position
	db $f, VERMILION_CITY_WIDTH ; bigness, width
	db (-4 * -2), (VERMILION_CITY_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * VERMILION_CITY_WIDTH ; window

	db ROUTE_12
	dw Route12Blocks + (ROUTE_12_WIDTH * 24) ; connection strip location
	dw $C6E5 + (ROUTE_11_WIDTH + 6) * (-3 + 4) ; current map position
	db $f, ROUTE_12_WIDTH ; bigness, width
	db (-27 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_12_WIDTH ; window

	; end connections data

	dw Route11Object ; objects

Route11Object: ; 0x584e0 (size=127)
	db $f ; border tile

	db $5 ; warps
	db $8, $31, $0, ROUTE_11_GATE_1F
	db $9, $31, $1, ROUTE_11_GATE_1F
	db $8, $3a, $2, ROUTE_11_GATE_1F
	db $9, $3a, $3, ROUTE_11_GATE_1F
	db $5, $4, $0, DIGLETTS_CAVE_ENTRANCE

	db $1 ; signs
	db $5, $1, $b ; Route11Text11

	db $a ; people
	db SPRITE_GAMBLER, $e + 4, $a + 4, $ff, $d0, $41, GAMBLER + $C8, $1 ; trainer
	db SPRITE_GAMBLER, $9 + 4, $1a + 4, $ff, $d0, $42, GAMBLER + $C8, $2 ; trainer
	db SPRITE_BUG_CATCHER, $5 + 4, $d + 4, $ff, $d2, $43, YOUNGSTER + $C8, $9 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $b + 4, $24 + 4, $ff, $d0, $44, ENGINEER + $C8, $2 ; trainer
	db SPRITE_BUG_CATCHER, $4 + 4, $16 + 4, $ff, $d1, $45, YOUNGSTER + $C8, $a ; trainer
	db SPRITE_GAMBLER, $7 + 4, $2d + 4, $ff, $d0, $46, GAMBLER + $C8, $3 ; trainer
	db SPRITE_GAMBLER, $3 + 4, $21 + 4, $ff, $d1, $47, GAMBLER + $C8, $4 ; trainer
	db SPRITE_BUG_CATCHER, $5 + 4, $2b + 4, $ff, $d3, $48, YOUNGSTER + $C8, $b ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $10 + 4, $2d + 4, $ff, $d2, $49, ENGINEER + $C8, $3 ; trainer
	db SPRITE_BUG_CATCHER, $c + 4, $16 + 4, $ff, $d1, $4a, YOUNGSTER + $C8, $c ; trainer

	; warp-to
	EVENT_DISP $1e, $8, $31 ; ROUTE_11_GATE_1F
	EVENT_DISP $1e, $9, $31 ; ROUTE_11_GATE_1F
	EVENT_DISP $1e, $8, $3a ; ROUTE_11_GATE_1F
	EVENT_DISP $1e, $9, $3a ; ROUTE_11_GATE_1F
	EVENT_DISP $1e, $5, $4 ; DIGLETTS_CAVE_ENTRANCE

Route11Blocks: ; 5855f (16:455f)
	INCBIN "maps/route11.blk"

Route12_h: ; 0x5866d to 0x5869a (45 bytes) (id=23)
	db $00 ; tileset
	db ROUTE_12_HEIGHT, ROUTE_12_WIDTH ; dimensions (y, x)
	dw Route12Blocks, Route12Texts, Route12Script ; blocks, texts, scripts
	db NORTH | SOUTH | WEST ; connections

	; connections data

	db LAVENDER_TOWN
	dw LavenderTownBlocks + (LAVENDER_TOWN_HEIGHT - 3) * LAVENDER_TOWN_WIDTH ; connection strip location
	dw $C6EB + 0 ; current map position
	db LAVENDER_TOWN_WIDTH, LAVENDER_TOWN_WIDTH ; bigness, width
	db (LAVENDER_TOWN_HEIGHT * 2) - 1, (0 * -2) ; alignments (y, x)
	dw $C6E9 + LAVENDER_TOWN_HEIGHT * (LAVENDER_TOWN_WIDTH + 6) ; window

	db ROUTE_13
	dw Route13Blocks + 17 ; connection strip location
	dw $C6EB + (ROUTE_12_HEIGHT + 3) * (ROUTE_12_WIDTH + 6) + -3 ; current map position
	db $d, ROUTE_13_WIDTH ; bigness, width
	db 0, (-20 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_13_WIDTH ; window

	db ROUTE_11
	dw Route11Blocks - 3 + (ROUTE_11_WIDTH) ; connection strip location
	dw $C6E8 + (ROUTE_12_WIDTH + 6) * (27 + 3) ; current map position
	db ROUTE_11_HEIGHT, ROUTE_11_WIDTH ; bigness, width
	db (27 * -2), (ROUTE_11_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * ROUTE_11_WIDTH ; window

	; end connections data

	dw Route12Object ; objects

Route12Object: ; 0x5869a (size=118)
	db $43 ; border tile

	db $4 ; warps
	db $f, $a, $0, ROUTE_12_GATE
	db $f, $b, $1, ROUTE_12_GATE
	db $15, $a, $2, ROUTE_12_GATE
	db $4d, $b, $0, ROUTE_12_HOUSE

	db $2 ; signs
	db $d, $d, $b ; Route12Text11
	db $3f, $b, $c ; Route12Text12

	db $a ; people
	db SPRITE_SNORLAX, $3e + 4, $a + 4, $ff, $d0, $1 ; person
	db SPRITE_FISHER2, $1f + 4, $e + 4, $ff, $d2, $42, FISHER + $C8, $3 ; trainer
	db SPRITE_FISHER2, $27 + 4, $5 + 4, $ff, $d1, $43, FISHER + $C8, $4 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $5c + 4, $b + 4, $ff, $d2, $44, JR__TRAINER_M + $C8, $9 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $4c + 4, $e + 4, $ff, $d1, $45, ROCKER + $C8, $2 ; trainer
	db SPRITE_FISHER2, $28 + 4, $c + 4, $ff, $d2, $46, FISHER + $C8, $5 ; trainer
	db SPRITE_FISHER2, $34 + 4, $9 + 4, $ff, $d3, $47, FISHER + $C8, $6 ; trainer
	db SPRITE_FISHER2, $57 + 4, $6 + 4, $ff, $d0, $48, FISHER + $C8, $b ; trainer
	db SPRITE_BALL, $23 + 4, $e + 4, $ff, $ff, $89, TM_16 ; item
	db SPRITE_BALL, $59 + 4, $5 + 4, $ff, $ff, $8a, IRON ; item

	; warp-to
	EVENT_DISP $a, $f, $a ; ROUTE_12_GATE
	EVENT_DISP $a, $f, $b ; ROUTE_12_GATE
	EVENT_DISP $a, $15, $a ; ROUTE_12_GATE
	EVENT_DISP $a, $4d, $b ; ROUTE_12_HOUSE

Route12Blocks: ; 58710 (16:4710)
	INCBIN "maps/route12.blk"

Route15_h: ; 0x5892c to 0x5894e (34 bytes) (id=26)
	db $00 ; tileset
	db ROUTE_15_HEIGHT, ROUTE_15_WIDTH ; dimensions (y, x)
	dw Route15Blocks, Route15Texts, Route15Script ; blocks, texts, scripts
	db WEST | EAST ; connections

	; connections data

	db FUCHSIA_CITY
	dw FuchsiaCityBlocks - 3 + (FUCHSIA_CITY_WIDTH * 2) ; connection strip location
	dw $C6E8 + (ROUTE_15_WIDTH + 6) * (-3 + 3) ; current map position
	db $f, FUCHSIA_CITY_WIDTH ; bigness, width
	db (-4 * -2), (FUCHSIA_CITY_WIDTH * 2) - 1 ; alignments (y, x)
	dw $C6EE + 2 * FUCHSIA_CITY_WIDTH ; window

	db ROUTE_14
	dw Route14Blocks + (ROUTE_14_WIDTH * 15) ; connection strip location
	dw $C6E5 + (ROUTE_15_WIDTH + 6) * (-3 + 4) ; current map position
	db $c, ROUTE_14_WIDTH ; bigness, width
	db (-18 * -2), 0 ; alignments (y, x)
	dw $C6EF + ROUTE_14_WIDTH ; window

	; end connections data

	dw Route15Object ; objects

Route15Object: ; 0x5894e (size=126)
	db $43 ; border tile

	db $4 ; warps
	db $8, $7, $0, ROUTE_15_GATE_1F
	db $9, $7, $1, ROUTE_15_GATE_1F
	db $8, $e, $2, ROUTE_15_GATE_1F
	db $9, $e, $3, ROUTE_15_GATE_1F

	db $1 ; signs
	db $9, $27, $c ; Route15Text12

	db $b ; people
	db SPRITE_LASS, $b + 4, $29 + 4, $ff, $d0, $41, JR__TRAINER_F + $C8, $14 ; trainer
	db SPRITE_LASS, $a + 4, $35 + 4, $ff, $d2, $42, JR__TRAINER_F + $C8, $15 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $d + 4, $1f + 4, $ff, $d1, $43, BIRD_KEEPER + $C8, $6 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $d + 4, $23 + 4, $ff, $d1, $44, BIRD_KEEPER + $C8, $7 ; trainer
	db SPRITE_FOULARD_WOMAN, $b + 4, $35 + 4, $ff, $d0, $45, BEAUTY + $C8, $9 ; trainer
	db SPRITE_FOULARD_WOMAN, $a + 4, $29 + 4, $ff, $d3, $46, BEAUTY + $C8, $a ; trainer
	db SPRITE_BIKER, $a + 4, $30 + 4, $ff, $d0, $47, BIKER + $C8, $3 ; trainer
	db SPRITE_BIKER, $a + 4, $2e + 4, $ff, $d0, $48, BIKER + $C8, $4 ; trainer
	db SPRITE_LASS, $5 + 4, $25 + 4, $ff, $d3, $49, JR__TRAINER_F + $C8, $16 ; trainer
	db SPRITE_LASS, $d + 4, $12 + 4, $ff, $d1, $4a, JR__TRAINER_F + $C8, $17 ; trainer
	db SPRITE_BALL, $5 + 4, $12 + 4, $ff, $ff, $8b, TM_20 ; item

	; warp-to
	EVENT_DISP $1e, $8, $7 ; ROUTE_15_GATE_1F
	EVENT_DISP $1e, $9, $7 ; ROUTE_15_GATE_1F
	EVENT_DISP $1e, $8, $e ; ROUTE_15_GATE_1F
	EVENT_DISP $1e, $9, $e ; ROUTE_15_GATE_1F

Route15Blocks: ; 589cc (16:49cc)
	INCBIN "maps/route15.blk"

Route16_h: ; 0x58ada to 0x58afc (34 bytes) (id=27)
	db $00 ; tileset
	db ROUTE_16_HEIGHT, ROUTE_16_WIDTH ; dimensions (y, x)
	dw Route16Blocks, Route16Texts, Route16Script ; blocks, texts, scripts
	db SOUTH | EAST ; connections

	; connections data

	db ROUTE_17
	dw Route17Blocks ; connection strip location
	dw $C6EB + (ROUTE_16_HEIGHT + 3) * (ROUTE_16_WIDTH + 6) + 0 ; current map position
	db ROUTE_17_WIDTH, ROUTE_17_WIDTH ; bigness, width
	db 0, (0 * -2) ; alignments (y, x)
	dw $C6EF + ROUTE_17_WIDTH ; window

	db CELADON_CITY
	dw CeladonCityBlocks + (CELADON_CITY_WIDTH) ; connection strip location
	dw $C6E5 + (ROUTE_16_WIDTH + 6) * (-3 + 4) ; current map position
	db $f, CELADON_CITY_WIDTH ; bigness, width
	db (-4 * -2), 0 ; alignments (y, x)
	dw $C6EF + CELADON_CITY_WIDTH ; window

	; end connections data

	dw Route16Object ; objects

Route16Object: ; 0x58afc (size=136)
	db $f ; border tile

	db $9 ; warps
	db $a, $11, $0, ROUTE_16_GATE_1F
	db $b, $11, $1, ROUTE_16_GATE_1F
	db $a, $18, $2, ROUTE_16_GATE_1F
	db $b, $18, $3, ROUTE_16_GATE_1F
	db $4, $11, $4, ROUTE_16_GATE_1F
	db $5, $11, $5, ROUTE_16_GATE_1F
	db $4, $18, $6, ROUTE_16_GATE_1F
	db $5, $18, $7, ROUTE_16_GATE_1F
	db $5, $7, $0, ROUTE_16_HOUSE

	db $2 ; signs
	db $b, $1b, $8 ; Route16Text8
	db $11, $5, $9 ; Route16Text9

	db $7 ; people
	db SPRITE_BIKER, $c + 4, $11 + 4, $ff, $d2, $41, BIKER + $C8, $5 ; trainer
	db SPRITE_BIKER, $d + 4, $e + 4, $ff, $d3, $42, CUE_BALL + $C8, $1 ; trainer
	db SPRITE_BIKER, $c + 4, $b + 4, $ff, $d1, $43, CUE_BALL + $C8, $2 ; trainer
	db SPRITE_BIKER, $b + 4, $9 + 4, $ff, $d2, $44, BIKER + $C8, $6 ; trainer
	db SPRITE_BIKER, $a + 4, $6 + 4, $ff, $d3, $45, CUE_BALL + $C8, $3 ; trainer
	db SPRITE_BIKER, $c + 4, $3 + 4, $ff, $d3, $46, BIKER + $C8, $7 ; trainer
	db SPRITE_SNORLAX, $a + 4, $1a + 4, $ff, $d0, $7 ; person

	; warp-to
	EVENT_DISP $14, $a, $11 ; ROUTE_16_GATE_1F
	EVENT_DISP $14, $b, $11 ; ROUTE_16_GATE_1F
	EVENT_DISP $14, $a, $18 ; ROUTE_16_GATE_1F
	EVENT_DISP $14, $b, $18 ; ROUTE_16_GATE_1F
	EVENT_DISP $14, $4, $11 ; ROUTE_16_GATE_1F
	EVENT_DISP $14, $5, $11 ; ROUTE_16_GATE_1F
	EVENT_DISP $14, $4, $18 ; ROUTE_16_GATE_1F
	EVENT_DISP $14, $5, $18 ; ROUTE_16_GATE_1F
	EVENT_DISP $14, $5, $7 ; ROUTE_16_HOUSE

Route16Blocks: ; 58b84 (16:4b84)
	INCBIN "maps/route16.blk"

Route18_h: ; 0x58c38 to 0x58c5a (34 bytes) (id=29)
	db $00 ; tileset
	db ROUTE_18_HEIGHT, ROUTE_18_WIDTH ; dimensions (y, x)
	dw Route18Blocks, Route18Texts, Route18Script ; blocks, texts, scripts
	db NORTH | EAST ; connections

	; connections data

	db ROUTE_17
	dw Route17Blocks + (ROUTE_17_HEIGHT - 3) * ROUTE_17_WIDTH ; connection strip location
	dw $C6EB + 0 ; current map position
	db ROUTE_17_WIDTH, ROUTE_17_WIDTH ; bigness, width
	db (ROUTE_17_HEIGHT * 2) - 1, (0 * -2) ; alignments (y, x)
	dw $C6E9 + ROUTE_17_HEIGHT * (ROUTE_17_WIDTH + 6) ; window

	db FUCHSIA_CITY
	dw FuchsiaCityBlocks + (FUCHSIA_CITY_WIDTH) ; connection strip location
	dw $C6E5 + (ROUTE_18_WIDTH + 6) * (-3 + 4) ; current map position
	db $f, FUCHSIA_CITY_WIDTH ; bigness, width
	db (-4 * -2), 0 ; alignments (y, x)
	dw $C6EF + FUCHSIA_CITY_WIDTH ; window

	; end connections data

	dw Route18Object ; objects

Route18Object: ; 0x58c5a (size=66)
	db $43 ; border tile

	db $4 ; warps
	db $8, $21, $0, ROUTE_18_GATE_1F
	db $9, $21, $1, ROUTE_18_GATE_1F
	db $8, $28, $2, ROUTE_18_GATE_1F
	db $9, $28, $3, ROUTE_18_GATE_1F

	db $2 ; signs
	db $7, $2b, $4 ; Route18Text4
	db $5, $21, $5 ; Route18Text5

	db $3 ; people
	db SPRITE_BLACK_HAIR_BOY_1, $b + 4, $24 + 4, $ff, $d3, $41, BIRD_KEEPER + $C8, $8 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $f + 4, $28 + 4, $ff, $d2, $42, BIRD_KEEPER + $C8, $9 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $d + 4, $2a + 4, $ff, $d2, $43, BIRD_KEEPER + $C8, $a ; trainer

	; warp-to
	EVENT_DISP $19, $8, $21 ; ROUTE_18_GATE_1F
	EVENT_DISP $19, $9, $21 ; ROUTE_18_GATE_1F
	EVENT_DISP $19, $8, $28 ; ROUTE_18_GATE_1F
	EVENT_DISP $19, $9, $28 ; ROUTE_18_GATE_1F

Route18Blocks: ; 58c9c (16:4c9c)
	INCBIN "maps/route18.blk"

INCBIN "baserom.gbc",$58d7d,$58d99 - $58d7d

; known jump sources: 3c0fc (f:40fc)
Func_58d99: ; 58d99 (16:4d99)
	ld a, [W_ISINBATTLE] ; $d057
	dec a
	jr nz, .asm_58dbe
	ld a, [W_CURMAP] ; $d35e
	cp $90
	jr c, .asm_58daa
	cp $95
	jr c, .asm_58dd8
.asm_58daa
	ld a, [W_ENEMYMONID]
	call PlayCry
	ld hl, UnnamedText_58e3b ; $4e3b
	ld a, [W_MOVEMISSED] ; $d05f
	and a
	jr z, .asm_58dbc
	ld hl, UnnamedText_58e40 ; $4e40
.asm_58dbc
	jr .asm_58dc9
.asm_58dbe
	call Func_58e29
	ld c, $14
	call DelayFrames
	ld hl, UnnamedText_58e4a ; $4e4a
.asm_58dc9
	push hl
	ld hl, Func_3a849
	ld b, BANK(Func_3a849)
	call Bankswitch ; indirect jump to Func_3a849 (3a849 (e:6849))
	pop hl
	call PrintText
	jr asm_58e3a
.asm_58dd8
	ld b, $48
	call IsItemInBag
	ld a, [W_ENEMYMONID]
	ld [$cf91], a
	cp $91
	jr z, .asm_58e03
	ld a, b
	and a
	jr z, .asm_58df5
	ld hl, Func_3eb01
	ld b, BANK(Func_3eb01)
	call Bankswitch ; indirect jump to Func_3eb01 (3eb01 (f:6b01))
	jr .asm_58daa
.asm_58df5
	ld hl, UnnamedText_58e45 ; $4e45
	call PrintText
	ld hl, UnnamedText_58e54 ; $4e54
	call PrintText
	jr asm_58e3a
.asm_58e03
	ld a, b
	and a
	jr z, .asm_58df5
	ld hl, UnnamedText_58e45 ; $4e45
	call PrintText
	ld hl, UnnamedText_58e4f ; $4e4f
	call PrintText
	ld hl, Func_3eb01
	ld b, BANK(Func_3eb01)
	call Bankswitch ; indirect jump to Func_3eb01 (3eb01 (f:6b01))
	ld hl, Func_708ca
	ld b, BANK(Func_708ca)
	call Bankswitch ; indirect jump to Func_708ca (708ca (1c:48ca))
	ld hl, UnnamedText_58e3b ; $4e3b
	call PrintText

; known jump sources: 58dbe (16:4dbe)
Func_58e29: ; 58e29 (16:4e29)
	xor a
	ld [$c0f1], a
	ld a, $80
	ld [$c0f2], a
	ld a, $e9
	call PlaySound
	jp WaitForSoundToFinish
asm_58e3a: ; 58e3a (16:4e3a)
	ret
; 58e3b (16:4e3b)
UnnamedText_58e3b: ; 58e3b (16:4e3b)
	TX_FAR _UnnamedText_58e3b
	db $50
; 0x58e3b + 5 bytes

UnnamedText_58e40: ; 58e40 (16:4e40)
	TX_FAR _UnnamedText_58e40
	db $50
; 0x58e40 + 5 bytes

UnnamedText_58e45: ; 58e45 (16:4e45)
	TX_FAR _UnnamedText_58e45
	db $50
; 0x58e45 + 5 bytes

UnnamedText_58e4a: ; 58e4a (16:4e4a)
	TX_FAR _UnnamedText_58e4a
	db $50
; 0x58e4a + 5 bytes

UnnamedText_58e4f: ; 58e4f (16:4e4f)
	TX_FAR _UnnamedText_58e4f
	db $50
; 0x58e4f + 5 bytes

UnnamedText_58e54: ; 58e54 (16:4e54)
	TX_FAR _UnnamedText_58e54
	db $50
; 0x58e54 + 5 bytes

; known jump sources: 3cc96 (f:4c96)
Func_58e59: ; 58e59 (16:4e59)
	ld hl, W_ENEMYMONCURHP ; $cfe6
	ld a, [hli]
	or [hl]
	ld hl, .unknown_58eae ; $4eae
	jr z, .asm_58eab
	xor a
	ld [H_NUMTOPRINT], a ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld hl, W_ENEMYMONCURHP ; $cfe6
	ld a, [hli]
	ld [$cce3], a
	ld [$FF00+$97], a
	ld a, [hl]
	ld [$cce4], a
	ld [$FF00+$98], a
	ld a, $19
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	call Multiply
	ld hl, W_ENEMYMONMAXHP ; $cff4
	ld a, [hli]
	ld b, [hl]
	srl a
	rr b
	srl a
	rr b
	ld a, b
	ld b, $4
	ld [H_REMAINDER], a ; $FF00+$99 (aliases: H_DIVISOR, H_MULTIPLIER, H_POWEROFTEN)
	call Divide
	ld a, [$FF00+$98]
	ld hl, .unknown_58eae ; $4eae
	cp $46
	jr nc, .asm_58eab
	ld hl, .unknown_58eb5 ; $4eb5
	cp $28
	jr nc, .asm_58eab
	ld hl, .unknown_58ebc ; $4ebc
	cp $a
	jr nc, .asm_58eab
	ld hl, .unknown_58ec3 ; $4ec3
.asm_58eab
	jp PrintText

.unknown_58eae: ; 58eae (16:4eae)
INCBIN "baserom.gbc",$58eae,$58eb3 - $58eae

	jr .asm_58ec8

.unknown_58eb5: ; 58eb5 (16:4eb5)
INCBIN "baserom.gbc",$58eb5,$58eba - $58eb5

	jr .asm_58ec8

.unknown_58ebc: ; 58ebc (16:4ebc)
INCBIN "baserom.gbc",$58ebc,$58ec3 - $58ebc

.unknown_58ec3: ; 58ec3 (16:4ec3)
INCBIN "baserom.gbc",$58ec3,$58ec8 - $58ec3

.asm_58ec8
	ld hl, UnnamedText_58ecc ; $4ecc
	ret
; 58ecc (16:4ecc)

UnnamedText_58ecc: ; 58ecc (16:4ecc)
	TX_FAR _UnnamedText_58ecc
	db $50
; 0x58ecc + 5 bytes

; known jump sources: 3d1bf (f:51bf)
Func_58ed1: ; 58ed1 (16:4ed1)
	ld hl, Unknown_58ed7 ; $4ed7
	jp PrintText

Unknown_58ed7: ; 58ed7 (16:4ed7)
INCBIN "baserom.gbc",$58ed7,$58f3e - $58ed7

UnnamedText_58f3e: ; 58f3e (16:4f3e)
	TX_FAR _UnnamedText_58f3e
	db $50
; 0x58f3e + 5 bytes

; known jump sources: f64c (3:764c), 55350 (15:5350)
Func_58f43: ; 58f43 (16:4f43)
	ld a, [$cf98]
	ld [$d0b5], a
	call GetMonHeader
	ld d, $1
.asm_58f4e
	inc d
	call CalcExperience
	push hl
	ld hl, $cfa8
	ld a, [$FF00+$98]
	ld c, a
	ld a, [hld]
	sub c
	ld a, [$FF00+$97]
	ld c, a
	ld a, [hld]
	sbc c
	ld a, [H_NUMTOPRINT] ; $FF00+$96 (aliases: H_MULTIPLICAND)
	ld c, a
	ld a, [hl]
	sbc c
	pop hl
	jr nc, .asm_58f4e
	dec d
	ret

; known jump sources: de9a (3:5e9a), e88c (3:688c), f431 (3:7431), 12c94 (4:6c94), 55312 (15:5312), 58f4f (16:4f4f)
; calculates the amount of experience needed for level d
CalcExperience: ; 58f6a (16:4f6a)
	ld a, [W_MONHGROWTHRATE]
	add a
	add a
	ld c, a
	ld b, $0
	ld hl, GrowthRateTable
	add hl, bc
	call CalcDSquared
	ld a, d
	ld [H_MULTIPLIER], a ; $FF00+$99
	call Multiply
	ld a, [hl]
	and $f0
	swap a
	ld [H_MULTIPLIER], a ; $FF00+$99
	call Multiply
	ld a, [hli]
	and $f
	ld [H_DIVISOR], a ; $FF00+$99
	ld b, $4
	call Divide
	ld a, [H_MULTIPLICAND] ; $FF00+$96 (aliases: H_NUMTOPRINT)
	push af
	ld a, [H_MULTIPLICAND+1]
	push af
	ld a, [H_MULTIPLICAND+2]
	push af
	call CalcDSquared
	ld a, [hl]
	and $7f
	ld [H_MULTIPLIER], a ; $FF00+$99
	call Multiply
	ld a, [H_MULTIPLICAND] ; $FF00+$96 (aliases: H_NUMTOPRINT)
	push af
	ld a, [H_MULTIPLICAND+1]
	push af
	ld a, [H_MULTIPLICAND+2]
	push af
	ld a, [hli]
	push af
	xor a
	ld [H_MULTIPLICAND], a ; $FF00+$96
	ld [H_MULTIPLICAND+1], a
	ld a, d
	ld [H_MULTIPLICAND+2], a
	ld a, [hli]
	ld [H_MULTIPLIER], a
	call Multiply
	ld b, [hl]
	ld a, [H_MULTIPLICAND+2]
	sub b
	ld [H_MULTIPLICAND+2], a
	ld b, $0
	ld a, [H_MULTIPLICAND+1]
	sbc b
	ld [H_MULTIPLICAND+1], a
	ld a, [H_MULTIPLICAND] ; $FF00+$96
	sbc b
	ld [H_MULTIPLICAND], a ; $FF00+$96
	pop af
	and $80
	jr nz, .subtractSquaredTerm ; check sign
	pop bc
	ld a, [H_MULTIPLICAND+2]
	add b
	ld [H_MULTIPLICAND+2], a
	pop bc
	ld a, [H_MULTIPLICAND+1]
	adc b
	ld [H_MULTIPLICAND+1], a
	pop bc
	ld a, [H_MULTIPLICAND]
	adc b
	ld [H_MULTIPLICAND], a
	jr .addCubedTerm
.subtractSquaredTerm
	pop bc
	ld a, [H_MULTIPLICAND+2]
	sub b
	ld [H_MULTIPLICAND+2], a
	pop bc
	ld a, [H_MULTIPLICAND+1]
	sbc b
	ld [H_MULTIPLICAND+1], a
	pop bc
	ld a, [H_MULTIPLICAND]
	sbc b
	ld [H_MULTIPLICAND], a
.addCubedTerm
	pop bc
	ld a, [H_MULTIPLICAND+2]
	add b
	ld [H_MULTIPLICAND+2], a
	pop bc
	ld a, [H_MULTIPLICAND+1]
	adc b
	ld [H_MULTIPLICAND+1], a
	pop bc
	ld a, [H_MULTIPLICAND]
	adc b
	ld [H_MULTIPLICAND], a
	ret

; known jump sources: 58f76 (16:4f76), 58f9c (16:4f9c)
; calculates d*d
CalcDSquared: ; 59010 (16:5010)
	xor a
	ld [H_MULTIPLICAND], a ; $FF00+$96 (aliases: H_NUMTOPRINT)
	ld [H_MULTIPLICAND+1], a
	ld a, d
	ld [H_MULTIPLICAND+2], a
	ld [H_MULTIPLIER], a ; $FF00+$99 (aliases: H_DIVISOR, H_REMAINDER, H_POWEROFTEN)
	jp Multiply

; each entry has the following scheme:
; %AAAABBBB %SCCCCCCC %DDDDDDDD %EEEEEEEE
; resulting in 
;  (a*n^3)/b + sign*c*n^2 + d*n - e
; where sign = -1 <=> S=1
GrowthRateTable: ; 5901d (16:501d)
db $11,$00,$00,$00 ; medium fast      n^3
db $34,$0A,$00,$1E ; (unused?)    3/4 n^3 + 10 n^2         - 30
db $34,$14,$00,$46 ; (unused?)    3/4 n^3 + 20 n^2         - 70
db $65,$8F,$64,$8C ; medium slow: 6/5 n^3 - 15 n^2 + 100 n - 140
db $45,$00,$00,$00 ; fast:        4/5 n^3
db $54,$00,$00,$00 ; slow:        5/4 n^3

; no known jump sources
Func_59035 ; 0x59035
	ld hl, UnnamedText_59091 ; $5091
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_59086 ; 0x59042 $42
	ld hl, $d2f7
	ld b, $13
	call CountSetBits
	ld a, [$d11e]
	ld [$ff00+$dd], a
	ld b, a
	ld a, [$ff00+$db]
	cp b
	jr z, .asm_59059 ; 0x59055 $2
	jr nc, .asm_5907c ; 0x59057 $23
.asm_59059
	ld hl, UnnamedText_590a0 ; $50a0
	call PrintText
	ld a, [$ff00+$dc]
	ld b, a
	ld c, 1
	call GiveItem
	jr nc, .BagFull
	ld hl, Unknown_590a5 ; $50a5
	call PrintText
	ld a, $1
	jr .asm_5908e ; 0x59071 $1b
.BagFull
	ld hl, UnnamedText_590ab ; $50ab
	call PrintText
	xor a
	jr .asm_5908e ; 0x5907a $12
.asm_5907c
	ld hl, UnnamedText_59096 ; $5096
	call PrintText
	ld a, $80
	jr .asm_5908e ; 0x59084 $8
.asm_59086
	ld hl, UnnamedText_5909b ; $509b
	call PrintText
	ld a, $ff
.asm_5908e
	ld [$ff00+$db], a
	ret
; 0x59091

UnnamedText_59091: ; 59091 (16:5091)
	TX_FAR _UnnamedText_59091
	db $50
; 0x59091 + 5 bytes

UnnamedText_59096: ; 59096 (16:5096)
	TX_FAR _UnnamedText_59096
	db $50
; 0x59096 + 5 bytes

UnnamedText_5909b: ; 5909b (16:509b)
	TX_FAR _UnnamedText_5909b
	db $50
; 0x5909b + 5 bytes

UnnamedText_590a0: ; 590a0 (16:50a0)
	TX_FAR _UnnamedText_590a0
	db $50
; 0x590a0 + 5 bytes

Unknown_590a5: ; 590a5 (16:50a5)
INCBIN "baserom.gbc",$590a5,$590ab - $590a5

UnnamedText_590ab: ; 590ab (16:50ab)
	TX_FAR _UnnamedText_590ab
	db $50
; 0x590ab + 5 bytes

Route6Script: ; 590b0 (16:50b0)
	call EnableAutoTextBoxDrawing
	ld hl, Route6TrainerHeaders
	ld de, Route6_Unknown590c3
	ld a, [W_ROUTE6CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE6CURSCRIPT], a
	ret
; 0x590c3

Route6_Unknown590c3: ; 590c3 (16:50c3)
INCBIN "baserom.gbc",$590c3,$590c9 - $590c3

Route6Texts: ; 590c9 (16:50c9)
	dw Route6Text1, Route6Text2, Route6Text3, Route6Text4, Route6Text5, Route6Text6, Route6Text7

Route6TrainerHeaders: ; 590d7 (16:50d7)
Route6TrainerHeader0: ; 590d7 (16:50d7)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d7c9 ; flag's byte
	dw Route6BattleText1 ; 0x512a TextBeforeBattle
	dw Route6AfterBattleText1 ; 0x5134 TextAfterBattle
	dw Route6EndBattleText1 ; 0x512f TextEndBattle
	dw Route6EndBattleText1 ; 0x512f TextEndBattle
; 0x590e3

Route6TrainerHeader1: ; 590e3 (16:50e3)
	db $2 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d7c9 ; flag's byte
	dw Route6BattleText2 ; 0x5143 TextBeforeBattle
	dw Route6AfterBattleText1 ; 0x5134 TextAfterBattle
	dw Route6EndBattleText2 ; 0x5148 TextEndBattle
	dw Route6EndBattleText2 ; 0x5148 TextEndBattle
; 0x590ef

Route6TrainerHeader2: ; 590ef (16:50ef)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7c9 ; flag's byte
	dw Route6BattleText3 ; 0x5157 TextBeforeBattle
	dw Route6AfterBattleText3 ; 0x5161 TextAfterBattle
	dw Route6EndBattleText3 ; 0x515c TextEndBattle
	dw Route6EndBattleText3 ; 0x515c TextEndBattle
; 0x590fb

Route6TrainerHeader3: ; 590fb (16:50fb)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7c9 ; flag's byte
	dw Route6BattleText4 ; 0x5170 TextBeforeBattle
	dw Route6AfterBattleText4 ; 0x517a TextAfterBattle
	dw Route6EndBattleText4 ; 0x5175 TextEndBattle
	dw Route6EndBattleText4 ; 0x5175 TextEndBattle
; 0x59107

Route6TrainerHeader4: ; 59107 (16:5107)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7c9 ; flag's byte
	dw Route6BattleText5 ; 0x5189 TextBeforeBattle
	dw Route6AfterBattleText5 ; 0x5193 TextAfterBattle
	dw Route6EndBattleText5 ; 0x518e TextEndBattle
	dw Route6EndBattleText5 ; 0x518e TextEndBattle
; 0x59113

Route6TrainerHeader5: ; 59113 (16:5113)
	db $6 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7c9 ; flag's byte
	dw Route6BattleText6 ; 0x51a2 TextBeforeBattle
	dw Route6AfterBattleText6 ; 0x51ac TextAfterBattle
	dw Route6EndBattleText6 ; 0x51a7 TextEndBattle
	dw Route6EndBattleText6 ; 0x51a7 TextEndBattle
; 0x5911e

db $ff

Route6Text1: ; 59120 (16:5120)
	db $8
	ld hl, Route6TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd
; 0x5912a

Route6BattleText1: ; 5912a (16:512a)
	TX_FAR _Route6BattleText1
	db $50
; 0x5912a + 5 bytes

Route6EndBattleText1: ; 5912f (16:512f)
	TX_FAR _Route6EndBattleText1
	db $50
; 0x5912f + 5 bytes

Route6AfterBattleText1: ; 59134 (16:5134)
	TX_FAR _Route6AfterBattleText1
	db $50
; 0x59134 + 5 bytes

Route6Text2: ; 59139 (16:5139)
	db $08 ; asm
	ld hl, Route6TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route6BattleText2: ; 59143 (16:5143)
	TX_FAR _Route6BattleText2
	db $50
; 0x59143 + 5 bytes

Route6EndBattleText2: ; 59148 (16:5148)
	TX_FAR _Route6EndBattleText2
	db $50
; 0x59148 + 5 bytes

Route6Text3: ; 5914d (16:514d)
	db $08 ; asm
	ld hl, Route6TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route6BattleText3: ; 59157 (16:5157)
	TX_FAR _Route6BattleText3
	db $50
; 0x59157 + 5 bytes

Route6EndBattleText3: ; 5915c (16:515c)
	TX_FAR _Route6EndBattleText3
	db $50
; 0x5915c + 5 bytes

Route6AfterBattleText3: ; 59161 (16:5161)
	TX_FAR _Route6AfterBattleText3
	db $50
; 0x59161 + 5 bytes

Route6Text4: ; 59166 (16:5166)
	db $08 ; asm
	ld hl, Route6TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route6BattleText4: ; 59170 (16:5170)
	TX_FAR _Route6BattleText4
	db $50
; 0x59170 + 5 bytes

Route6EndBattleText4: ; 59175 (16:5175)
	TX_FAR _Route6EndBattleText4
	db $50
; 0x59175 + 5 bytes

Route6AfterBattleText4: ; 5917a (16:517a)
	TX_FAR _Route6AfterBattleText4
	db $50
; 0x5917a + 5 bytes

Route6Text5: ; 5917f (16:517f)
	db $08 ; asm
	ld hl, Route6TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route6BattleText5: ; 59189 (16:5189)
	TX_FAR _Route6BattleText5
	db $50
; 0x59189 + 5 bytes

Route6EndBattleText5: ; 5918e (16:518e)
	TX_FAR _Route6EndBattleText5
	db $50
; 0x5918e + 5 bytes

Route6AfterBattleText5: ; 59193 (16:5193)
	TX_FAR _Route6AfterBattleText5
	db $50
; 0x59193 + 5 bytes

Route6Text6: ; 59198 (16:5198)
	db $08 ; asm
	ld hl, Route6TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route6BattleText6: ; 591a2 (16:51a2)
	TX_FAR _Route6BattleText6
	db $50
; 0x591a2 + 5 bytes

Route6EndBattleText6: ; 591a7 (16:51a7)
	TX_FAR _Route6EndBattleText6
	db $50
; 0x591a7 + 5 bytes

Route6AfterBattleText6: ; 591ac (16:51ac)
	TX_FAR _Route6AfterBattleText6
	db $50
; 0x591ac + 5 bytes

Route6Text7: ; 591b1 (16:51b1)
	TX_FAR _Route6Text7
	db $50

Route8Script: ; 591b6 (16:51b6)
	call EnableAutoTextBoxDrawing
	ld hl, Route8TrainerHeaders
	ld de, Route8_Unknown591c9
	ld a, [W_ROUTE8CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE8CURSCRIPT], a
	ret
; 0x591c9

Route8_Unknown591c9: ; 591c9 (16:51c9)
INCBIN "baserom.gbc",$591c9,$591cf - $591c9

Route8Texts: ; 591cf (16:51cf)
	dw Route8Text1, Route8Text2, Route8Text3, Route8Text4, Route8Text5, Route8Text6, Route8Text7, Route8Text8, Route8Text9, Route8Text10

Route8TrainerHeaders: ; 591e3 (16:51e3)
Route8TrainerHeader0: ; 591e3 (16:51e3)
	db $1 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7cd ; flag's byte
	dw Route8BattleText1 ; 0x525a TextBeforeBattle
	dw Route8AfterBattleText1 ; 0x5264 TextAfterBattle
	dw Route8EndBattleText1 ; 0x525f TextEndBattle
	dw Route8EndBattleText1 ; 0x525f TextEndBattle
; 0x591ef

Route8TrainerHeader1: ; 591ef (16:51ef)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7cd ; flag's byte
	dw Route8BattleText2 ; 0x5273 TextBeforeBattle
	dw Route8AfterBattleText2 ; 0x527d TextAfterBattle
	dw Route8EndBattleText2 ; 0x5278 TextEndBattle
	dw Route8EndBattleText2 ; 0x5278 TextEndBattle
; 0x591fb

Route8TrainerHeader2: ; 591fb (16:51fb)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7cd ; flag's byte
	dw Route8BattleText3 ; 0x528c TextBeforeBattle
	dw Route8AfterBattleText3 ; 0x5296 TextAfterBattle
	dw Route8EndBattleText3 ; 0x5291 TextEndBattle
	dw Route8EndBattleText3 ; 0x5291 TextEndBattle
; 0x59207

Route8TrainerHeader3: ; 59207 (16:5207)
	db $4 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7cd ; flag's byte
	dw Route8BattleText4 ; 0x52a5 TextBeforeBattle
	dw Route8AfterBattleText4 ; 0x52af TextAfterBattle
	dw Route8EndBattleText4 ; 0x52aa TextEndBattle
	dw Route8EndBattleText4 ; 0x52aa TextEndBattle
; 0x59213

Route8TrainerHeader4: ; 59213 (16:5213)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7cd ; flag's byte
	dw Route8BattleText5 ; 0x52be TextBeforeBattle
	dw Route8AfterBattleText5 ; 0x52c8 TextAfterBattle
	dw Route8EndBattleText5 ; 0x52c3 TextEndBattle
	dw Route8EndBattleText5 ; 0x52c3 TextEndBattle
; 0x5921f

Route8TrainerHeader5: ; 5921f (16:521f)
	db $6 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7cd ; flag's byte
	dw Route8BattleText6 ; 0x52d7 TextBeforeBattle
	dw Route8AfterBattleText6 ; 0x52e1 TextAfterBattle
	dw Route8EndBattleText6 ; 0x52dc TextEndBattle
	dw Route8EndBattleText6 ; 0x52dc TextEndBattle
; 0x5922b

Route8TrainerHeader6: ; 5922b (16:522b)
	db $7 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7cd ; flag's byte
	dw Route8BattleText7 ; 0x52f0 TextBeforeBattle
	dw Route8AfterBattleText7 ; 0x52fa TextAfterBattle
	dw Route8EndBattleText7 ; 0x52f5 TextEndBattle
	dw Route8EndBattleText7 ; 0x52f5 TextEndBattle
; 0x59237

Route8TrainerHeader7: ; 59237 (16:5237)
	db $8 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7cd ; flag's byte
	dw Route8BattleText8 ; 0x5309 TextBeforeBattle
	dw Route8AfterBattleText8 ; 0x5313 TextAfterBattle
	dw Route8EndBattleText8 ; 0x530e TextEndBattle
	dw Route8EndBattleText8 ; 0x530e TextEndBattle
; 0x59243

Route8TrainerHeader8: ; 59243 (16:5243)
	db $9 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7cd ; flag's byte
	dw Route8BattleText9 ; 0x5322 TextBeforeBattle
	dw Route8AfterBattleText9 ; 0x532c TextAfterBattle
	dw Route8EndBattleText9 ; 0x5327 TextEndBattle
	dw Route8EndBattleText9 ; 0x5327 TextEndBattle
; 0x5924e

db $ff

Route8Text1: ; 59250 (16:5250)
	db $8
	ld hl, Route8TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd
; 0x5925a

Route8BattleText1: ; 5925a (16:525a)
	TX_FAR _Route8BattleText1
	db $50
; 0x5925f

Route8EndBattleText1: ; 5925f (16:525f)
	TX_FAR _Route8EndBattleText1
	db $50
; 0x5925f + 5 bytes

Route8AfterBattleText1: ; 59264 (16:5264)
	TX_FAR _Route8AfterBattleText1
	db $50
; 0x59264 + 5 bytes

Route8Text2: ; 59269 (16:5269)
	db $08 ; asm
	ld hl, Route8TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route8BattleText2: ; 59273 (16:5273)
	TX_FAR _Route8BattleText2
	db $50
; 0x59273 + 5 bytes

Route8EndBattleText2: ; 59278 (16:5278)
	TX_FAR _Route8EndBattleText2
	db $50
; 0x59278 + 5 bytes

Route8AfterBattleText2: ; 5927d (16:527d)
	TX_FAR _Route8AfterBattleText2
	db $50
; 0x5927d + 5 bytes

Route8Text3: ; 59282 (16:5282)
	db $08 ; asm
	ld hl, Route8TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route8BattleText3: ; 5928c (16:528c)
	TX_FAR _Route8BattleText3
	db $50
; 0x5928c + 5 bytes

Route8EndBattleText3: ; 59291 (16:5291)
	TX_FAR _Route8EndBattleText3
	db $50
; 0x59291 + 5 bytes

Route8AfterBattleText3: ; 59296 (16:5296)
	TX_FAR _Route8AfterBattleText3
	db $50
; 0x59296 + 5 bytes

Route8Text4: ; 5929b (16:529b)
	db $08 ; asm
	ld hl, Route8TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route8BattleText4: ; 592a5 (16:52a5)
	TX_FAR _Route8BattleText4
	db $50
; 0x592a5 + 5 bytes

Route8EndBattleText4: ; 592aa (16:52aa)
	TX_FAR _Route8EndBattleText4
	db $50
; 0x592aa + 5 bytes

Route8AfterBattleText4: ; 592af (16:52af)
	TX_FAR _Route8AfterBattleText4
	db $50
; 0x592af + 5 bytes

Route8Text5: ; 592b4 (16:52b4)
	db $08 ; asm
	ld hl, Route8TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route8BattleText5: ; 592be (16:52be)
	TX_FAR _Route8BattleText5
	db $50
; 0x592be + 5 bytes

Route8EndBattleText5: ; 592c3 (16:52c3)
	TX_FAR _Route8EndBattleText5
	db $50
; 0x592c3 + 5 bytes

Route8AfterBattleText5: ; 592c8 (16:52c8)
	TX_FAR _Route8AfterBattleText5
	db $50
; 0x592c8 + 5 bytes

Route8Text6: ; 592cd (16:52cd)
	db $08 ; asm
	ld hl, Route8TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route8BattleText6: ; 592d7 (16:52d7)
	TX_FAR _Route8BattleText6
	db $50
; 0x592d7 + 5 bytes

Route8EndBattleText6: ; 592dc (16:52dc)
	TX_FAR _Route8EndBattleText6
	db $50
; 0x592dc + 5 bytes

Route8AfterBattleText6: ; 592e1 (16:52e1)
	TX_FAR _Route8AfterBattleText6
	db $50
; 0x592e1 + 5 bytes

Route8Text7: ; 592e6 (16:52e6)
	db $08 ; asm
	ld hl, Route8TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route8BattleText7: ; 592f0 (16:52f0)
	TX_FAR _Route8BattleText7
	db $50
; 0x592f0 + 5 bytes

Route8EndBattleText7: ; 592f5 (16:52f5)
	TX_FAR _Route8EndBattleText7
	db $50
; 0x592f5 + 5 bytes

Route8AfterBattleText7: ; 592fa (16:52fa)
	TX_FAR _Route8AfterBattleText7
	db $50
; 0x592fa + 5 bytes

Route8Text8: ; 592ff (16:52ff)
	db $08 ; asm
	ld hl, Route8TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

Route8BattleText8: ; 59309 (16:5309)
	TX_FAR _Route8BattleText8
	db $50
; 0x59309 + 5 bytes

Route8EndBattleText8: ; 5930e (16:530e)
	TX_FAR _Route8EndBattleText8
	db $50
; 0x5930e + 5 bytes

Route8AfterBattleText8: ; 59313 (16:5313)
	TX_FAR _Route8AfterBattleText8
	db $50
; 0x59313 + 5 bytes

Route8Text9: ; 59318 (16:5318)
	db $08 ; asm
	ld hl, Route8TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

Route8BattleText9: ; 59322 (16:5322)
	TX_FAR _Route8BattleText9
	db $50
; 0x59322 + 5 bytes

Route8EndBattleText9: ; 59327 (16:5327)
	TX_FAR _Route8EndBattleText9
	db $50
; 0x59327 + 5 bytes

Route8AfterBattleText9: ; 5932c (16:532c)
	TX_FAR _Route8AfterBattleText9
	db $50
; 0x5932c + 5 bytes

Route8Text10: ; 59331 (16:5331)
	TX_FAR _Route8Text10
	db $50

Route10Script: ; 59336 (16:5336)
	call EnableAutoTextBoxDrawing
	ld hl, Route10TrainerHeaders
	ld de, Route10_Unknown59349
	ld a, [W_ROUTE10CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE10CURSCRIPT], a
	ret
; 0x59349

Route10_Unknown59349: ; 59349 (16:5349)
INCBIN "baserom.gbc",$59349,$5934f - $59349

Route10Texts: ; 5934f (16:534f)
	dw Route10Text1, Route10Text2, Route10Text3, Route10Text4, Route10Text5, Route10Text6, Route10Text7, PokeCenterSignText, Route10Text9, Route10Text10

Route10TrainerHeaders: ; 59363 (16:5363)
Route10TrainerHeader0: ; 59363 (16:5363)
	db $1 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d1 ; flag's byte
	dw Route10BattleText1 ; 0x53b6 TextBeforeBattle
	dw Route10AfterBattleText1 ; 0x53c0 TextAfterBattle
	dw Route10EndBattleText1 ; 0x53bb TextEndBattle
	dw Route10EndBattleText1 ; 0x53bb TextEndBattle
; 0x5936f

Route10TrainerHeader1: ; 5936f (16:536f)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7d1 ; flag's byte
	dw Route10BattleText2 ; 0x53cf TextBeforeBattle
	dw Route10AfterBattleText2 ; 0x53d9 TextAfterBattle
	dw Route10EndBattleText2 ; 0x53d4 TextEndBattle
	dw Route10EndBattleText2 ; 0x53d4 TextEndBattle
; 0x5937b

Route10TrainerHeader2: ; 5937b (16:537b)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d1 ; flag's byte
	dw Route10BattleText3 ; 0x53e8 TextBeforeBattle
	dw Route10AfterBattleText3 ; 0x53f2 TextAfterBattle
	dw Route10EndBattleText3 ; 0x53ed TextEndBattle
	dw Route10EndBattleText3 ; 0x53ed TextEndBattle
; 0x59387

Route10TrainerHeader3: ; 59387 (16:5387)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7d1 ; flag's byte
	dw Route10BattleText4 ; 0x5401 TextBeforeBattle
	dw Route10AfterBattleText4 ; 0x540b TextAfterBattle
	dw Route10EndBattleText4 ; 0x5406 TextEndBattle
	dw Route10EndBattleText4 ; 0x5406 TextEndBattle
; 0x59393

Route10TrainerHeader4: ; 59393 (16:5393)
	db $5 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7d1 ; flag's byte
	dw Route10BattleText5 ; 0x541a TextBeforeBattle
	dw Route10AfterBattleText5 ; 0x5424 TextAfterBattle
	dw Route10EndBattleText5 ; 0x541f TextEndBattle
	dw Route10EndBattleText5 ; 0x541f TextEndBattle
; 0x5939f

Route10TrainerHeader5: ; 5939f (16:539f)
	db $6 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7d1 ; flag's byte
	dw Route10BattleText6 ; 0x5433 TextBeforeBattle
	dw Route10AfterBattleText6 ; 0x543d TextAfterBattle
	dw Route10EndBattleText6 ; 0x5438 TextEndBattle
	dw Route10EndBattleText6 ; 0x5438 TextEndBattle
; 0x593ab

db $ff

Route10Text1: ; 593ac (16:53ac)
	db $08 ; asm
	ld hl, Route10TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route10BattleText1: ; 593b6 (16:53b6)
	TX_FAR _Route10BattleText1
	db $50
; 0x593b6 + 5 bytes

Route10EndBattleText1: ; 593bb (16:53bb)
	TX_FAR _Route10EndBattleText1
	db $50
; 0x593bb + 5 bytes

Route10AfterBattleText1: ; 593c0 (16:53c0)
	TX_FAR _Route10AfterBattleText1
	db $50
; 0x593c0 + 5 bytes

Route10Text2: ; 593c5 (16:53c5)
	db $08 ; asm
	ld hl, Route10TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route10BattleText2: ; 593cf (16:53cf)
	TX_FAR _Route10BattleText2
	db $50
; 0x593cf + 5 bytes

Route10EndBattleText2: ; 593d4 (16:53d4)
	TX_FAR _Route10EndBattleText2
	db $50
; 0x593d4 + 5 bytes

Route10AfterBattleText2: ; 593d9 (16:53d9)
	TX_FAR _Route10AfterBattleText2
	db $50
; 0x593d9 + 5 bytes

Route10Text3: ; 593de (16:53de)
	db $08 ; asm
	ld hl, Route10TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route10BattleText3: ; 593e8 (16:53e8)
	TX_FAR _Route10BattleText3
	db $50
; 0x593e8 + 5 bytes

Route10EndBattleText3: ; 593ed (16:53ed)
	TX_FAR _Route10EndBattleText3
	db $50
; 0x593ed + 5 bytes

Route10AfterBattleText3: ; 593f2 (16:53f2)
	TX_FAR _Route10AfterBattleText3
	db $50
; 0x593f2 + 5 bytes

Route10Text4: ; 593f7 (16:53f7)
	db $08 ; asm
	ld hl, Route10TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route10BattleText4: ; 59401 (16:5401)
	TX_FAR _Route10BattleText4
	db $50
; 0x59401 + 5 bytes

Route10EndBattleText4: ; 59406 (16:5406)
	TX_FAR _Route10EndBattleText4
	db $50
; 0x59406 + 5 bytes

Route10AfterBattleText4: ; 5940b (16:540b)
	TX_FAR _Route10AfterBattleText4
	db $50
; 0x5940b + 5 bytes

Route10Text5: ; 59410 (16:5410)
	db $08 ; asm
	ld hl, Route10TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route10BattleText5: ; 5941a (16:541a)
	TX_FAR _Route10BattleText5
	db $50
; 0x5941a + 5 bytes

Route10EndBattleText5: ; 5941f (16:541f)
	TX_FAR _Route10EndBattleText5
	db $50
; 0x5941f + 5 bytes

Route10AfterBattleText5: ; 59424 (16:5424)
	TX_FAR _Route10AfterBattleText5
	db $50
; 0x59424 + 5 bytes

Route10Text6: ; 59429 (16:5429)
	db $08 ; asm
	ld hl, Route10TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route10BattleText6: ; 59433 (16:5433)
	TX_FAR _Route10BattleText6
	db $50
; 0x59433 + 5 bytes

Route10EndBattleText6: ; 59438 (16:5438)
	TX_FAR _Route10EndBattleText6
	db $50
; 0x59438 + 5 bytes

Route10AfterBattleText6: ; 5943d (16:543d)
	TX_FAR _Route10AfterBattleText6
	db $50
; 0x5943d + 5 bytes

Route10Text9: ; 59442 (16:5442)
Route10Text7: ; 59442 (16:5442)
	TX_FAR _Route10Text7 ; _Route10Text9
	db $50

Route10Text10: ; 59447 (16:5447)
	TX_FAR _Route10Text10
	db $50

Route11Script: ; 5944c (16:544c)
	call EnableAutoTextBoxDrawing
	ld hl, Route11TrainerHeaders
	ld de, Route11_Unknown5945f
	ld a, [W_ROUTE11CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE11CURSCRIPT], a
	ret
; 0x5945f

Route11_Unknown5945f: ; 5945f (16:545f)
	dw CheckFightingMapTrainers
	dw Func_324c
	dw EndTrainerBattle

Route11Texts: ; 59465 (16:5465)
	dw UnnamedText_594f4, Route11Text2, Route11Text3, Route11Text4, Route11Text5, Route11Text6, Route11Text7, Route11Text8, Route11Text9, Route11Text10, Route11Text11

Route11TrainerHeaders: ; 5947b (16:547b)
Route11TrainerHeader0: ; 5947b (16:547b)
	db $1 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7d5 ; flag's byte
	dw Route11BattleText1 ; 0x54fe TextBeforeBattle
	dw Route11AfterBattleText1 ; 0x5508 TextAfterBattle
	dw Route11EndBattleText1 ; 0x5503 TextEndBattle
	dw Route11EndBattleText1 ; 0x5503 TextEndBattle
; 0x59487

Route11TrainerHeader1: ; 59487 (16:5487)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7d5 ; flag's byte
	dw Route11BattleText2 ; 0x5517 TextBeforeBattle
	dw Route11AfterBattleText2 ; 0x5521 TextAfterBattle
	dw Route11EndBattleText2 ; 0x551c TextEndBattle
	dw Route11EndBattleText2 ; 0x551c TextEndBattle
; 0x59493

Route11TrainerHeader2: ; 59493 (16:5493)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7d5 ; flag's byte
	dw Route11BattleText3 ; 0x5530 TextBeforeBattle
	dw Route11AfterBattleText3 ; 0x553a TextAfterBattle
	dw Route11EndBattleText3 ; 0x5535 TextEndBattle
	dw Route11EndBattleText3 ; 0x5535 TextEndBattle
; 0x5949f

Route11TrainerHeader3: ; 5949f (16:549f)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7d5 ; flag's byte
	dw Route11BattleText4 ; 0x5549 TextBeforeBattle
	dw Route11AfterBattleText4 ; 0x5553 TextAfterBattle
	dw Route11EndBattleText4 ; 0x554e TextEndBattle
	dw Route11EndBattleText4 ; 0x554e TextEndBattle
; 0x594ab

Route11TrainerHeader4: ; 594ab (16:54ab)
	db $5 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d5 ; flag's byte
	dw Route11BattleText5 ; 0x5562 TextBeforeBattle
	dw Route11AfterBattleText5 ; 0x556c TextAfterBattle
	dw Route11EndBattleText5 ; 0x5567 TextEndBattle
	dw Route11EndBattleText5 ; 0x5567 TextEndBattle
; 0x594b7

Route11TrainerHeader5: ; 594b7 (16:54b7)
	db $6 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7d5 ; flag's byte
	dw Route11BattleText6 ; 0x557b TextBeforeBattle
	dw Route11AfterBattleText6 ; 0x5585 TextAfterBattle
	dw Route11EndBattleText6 ; 0x5580 TextEndBattle
	dw Route11EndBattleText6 ; 0x5580 TextEndBattle
; 0x594c3

Route11TrainerHeader6: ; 594c3 (16:54c3)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7d5 ; flag's byte
	dw Route11BattleText7 ; 0x5594 TextBeforeBattle
	dw Route11AfterBattleText7 ; 0x559e TextAfterBattle
	dw Route11EndBattleText7 ; 0x5599 TextEndBattle
	dw Route11EndBattleText7 ; 0x5599 TextEndBattle
; 0x594cf

Route11TrainerHeader7: ; 594cf (16:54cf)
	db $8 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d5 ; flag's byte
	dw Route11BattleText8 ; 0x55ad TextBeforeBattle
	dw Route11AfterBattleText8 ; 0x55b7 TextAfterBattle
	dw Route11EndBattleText8 ; 0x55b2 TextEndBattle
	dw Route11EndBattleText8 ; 0x55b2 TextEndBattle
; 0x594db

Route11TrainerHeader8: ; 594db (16:54db)
	db $9 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7d5 ; flag's byte
	dw Route11BattleText9 ; 0x55c6 TextBeforeBattle
	dw Route11AfterBattleText9 ; 0x55d0 TextAfterBattle
	dw Route11EndBattleText9 ; 0x55cb TextEndBattle
	dw Route11EndBattleText9 ; 0x55cb TextEndBattle
; 0x594e7

Route11TrainerHeader9: ; 594e7 (16:54e7)
	db $a ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d5 ; flag's byte
	dw Route11BattleText10 ; 0x55df TextBeforeBattle
	dw Route11AfterBattleText10 ; 0x55e9 TextAfterBattle
	dw Route11EndBattleText10 ; 0x55e4 TextEndBattle
	dw Route11EndBattleText10 ; 0x55e4 TextEndBattle
; 0x594f3

db $ff

UnnamedText_594f4: ; 594f4 (16:54f4)
	db $8
	ld hl, Route11TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd
; 0x594fe

Route11BattleText1: ; 594fe (16:54fe)
	TX_FAR _Route11BattleText1
	db $50
; 0x594fe + 5 bytes

Route11EndBattleText1: ; 59503 (16:5503)
	TX_FAR _Route11EndBattleText1
	db $50
; 0x59503 + 5 bytes

Route11AfterBattleText1: ; 59508 (16:5508)
	TX_FAR _Route11AfterBattleText1
	db $50
; 0x59508 + 5 bytes

Route11Text2: ; 5950d (16:550d)
	db $08 ; asm
	ld hl, Route11TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route11BattleText2: ; 59517 (16:5517)
	TX_FAR _Route11BattleText2
	db $50
; 0x59517 + 5 bytes

Route11EndBattleText2: ; 5951c (16:551c)
	TX_FAR _Route11EndBattleText2
	db $50
; 0x5951c + 5 bytes

Route11AfterBattleText2: ; 59521 (16:5521)
	TX_FAR _Route11AfterBattleText2
	db $50
; 0x59521 + 5 bytes

Route11Text3: ; 59526 (16:5526)
	db $08 ; asm
	ld hl, Route11TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route11BattleText3: ; 59530 (16:5530)
	TX_FAR _Route11BattleText3
	db $50
; 0x59530 + 5 bytes

Route11EndBattleText3: ; 59535 (16:5535)
	TX_FAR _Route11EndBattleText3
	db $50
; 0x59535 + 5 bytes

Route11AfterBattleText3: ; 5953a (16:553a)
	TX_FAR _Route11AfterBattleText3
	db $50
; 0x5953a + 5 bytes

Route11Text4: ; 5953f (16:553f)
	db $08 ; asm
	ld hl, Route11TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route11BattleText4: ; 59549 (16:5549)
	TX_FAR _Route11BattleText4
	db $50
; 0x59549 + 5 bytes

Route11EndBattleText4: ; 5954e (16:554e)
	TX_FAR _Route11EndBattleText4
	db $50
; 0x5954e + 5 bytes

Route11AfterBattleText4: ; 59553 (16:5553)
	TX_FAR _Route11AfterBattleText4
	db $50
; 0x59553 + 5 bytes

Route11Text5: ; 59558 (16:5558)
	db $08 ; asm
	ld hl, Route11TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route11BattleText5: ; 59562 (16:5562)
	TX_FAR _Route11BattleText5
	db $50
; 0x59562 + 5 bytes

Route11EndBattleText5: ; 59567 (16:5567)
	TX_FAR _Route11EndBattleText5
	db $50
; 0x59567 + 5 bytes

Route11AfterBattleText5: ; 5956c (16:556c)
	TX_FAR _Route11AfterBattleText5
	db $50
; 0x5956c + 5 bytes

Route11Text6: ; 59571 (16:5571)
	db $08 ; asm
	ld hl, Route11TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route11BattleText6: ; 5957b (16:557b)
	TX_FAR _Route11BattleText6
	db $50
; 0x5957b + 5 bytes

Route11EndBattleText6: ; 59580 (16:5580)
	TX_FAR _Route11EndBattleText6
	db $50
; 0x59580 + 5 bytes

Route11AfterBattleText6: ; 59585 (16:5585)
	TX_FAR _Route11AfterBattleText6
	db $50
; 0x59585 + 5 bytes

Route11Text7: ; 5958a (16:558a)
	db $08 ; asm
	ld hl, Route11TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route11BattleText7: ; 59594 (16:5594)
	TX_FAR _Route11BattleText7
	db $50
; 0x59594 + 5 bytes

Route11EndBattleText7: ; 59599 (16:5599)
	TX_FAR _Route11EndBattleText7
	db $50
; 0x59599 + 5 bytes

Route11AfterBattleText7: ; 5959e (16:559e)
	TX_FAR _Route11AfterBattleText7
	db $50
; 0x5959e + 5 bytes

Route11Text8: ; 595a3 (16:55a3)
	db $08 ; asm
	ld hl, Route11TrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

Route11BattleText8: ; 595ad (16:55ad)
	TX_FAR _Route11BattleText8
	db $50
; 0x595ad + 5 bytes

Route11EndBattleText8: ; 595b2 (16:55b2)
	TX_FAR _Route11EndBattleText8
	db $50
; 0x595b2 + 5 bytes

Route11AfterBattleText8: ; 595b7 (16:55b7)
	TX_FAR _Route11AfterBattleText8
	db $50
; 0x595b7 + 5 bytes

Route11Text9: ; 595bc (16:55bc)
	db $08 ; asm
	ld hl, Route11TrainerHeader8
	call TalkToTrainer
	jp TextScriptEnd

Route11BattleText9: ; 595c6 (16:55c6)
	TX_FAR _Route11BattleText9
	db $50
; 0x595c6 + 5 bytes

Route11EndBattleText9: ; 595cb (16:55cb)
	TX_FAR _Route11EndBattleText9
	db $50
; 0x595cb + 5 bytes

Route11AfterBattleText9: ; 595d0 (16:55d0)
	TX_FAR _Route11AfterBattleText9
	db $50
; 0x595d0 + 5 bytes

Route11Text10: ; 595d5 (16:55d5)
	db $08 ; asm
	ld hl, Route11TrainerHeader9
	call TalkToTrainer
	jp TextScriptEnd

Route11BattleText10: ; 595df (16:55df)
	TX_FAR _Route11BattleText10
	db $50
; 0x595df + 5 bytes

Route11EndBattleText10: ; 595e4 (16:55e4)
	TX_FAR _Route11EndBattleText10
	db $50
; 0x595e4 + 5 bytes

Route11AfterBattleText10: ; 595e9 (16:55e9)
	TX_FAR _Route11AfterBattleText10
	db $50
; 0x595e9 + 5 bytes

Route11Text11: ; 595ee (16:55ee)
	TX_FAR _Route11Text11
	db $50

Route12Script: ; 595f3 (16:55f3)
	call EnableAutoTextBoxDrawing
	ld hl, Route12TrainerHeaders
	ld de, .unknown_59611 ; $5611
	ld a, [W_ROUTE12CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE12CURSCRIPT], a
	ret
.asm_59606
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_ROUTE12CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

.unknown_59611: ; 59611 (16:5611)
INCBIN "baserom.gbc",$59611,$59619 - $59611

	ld hl, $d7d8
	bit 7, [hl]
	jp nz, CheckFightingMapTrainers
	bit 6, [hl]
	res 6, [hl]
	jp z, CheckFightingMapTrainers
	ld a, $d
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $84
	ld [W_CUROPPONENT], a ; $d059
	ld a, $1e
	ld [W_CURENEMYLVL], a ; $d127
	ld a, $1d
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	ld a, $3
	ld [W_ROUTE12CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jr z, .asm_59606
	call UpdateSprites
	ld a, [$cf0b]
	cp $2
	jr z, .asm_59664
	ld a, $e
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
.asm_59664
	ld hl, $d7d8
	set 7, [hl]
	call Delay3
	ld a, $0
	ld [W_ROUTE12CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 59675 (16:5675)
Route12Texts: ; 59675 (16:5675)
	dw Route12Text1, Route12Text2, Route12Text3, Route12Text4, Route12Text5, Route12Text6, Route12Text7, Route12Text8, Predef5CText, Predef5CText, Route12Text11, Route12Text12, Route12Text13, Route12Text14

Route12TrainerHeaders: ; 59691 (16:5691)
Route12TrainerHeader0: ; 59691 (16:5691)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d7 ; flag's byte
	dw Route12BattleText1 ; 0x56ff TextBeforeBattle
	dw Route12AfterBattleText1 ; 0x5709 TextAfterBattle
	dw Route12EndBattleText1 ; 0x5704 TextEndBattle
	dw Route12EndBattleText1 ; 0x5704 TextEndBattle
; 0x5969d

Route12TrainerHeader1: ; 5969d (16:569d)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d7 ; flag's byte
	dw Route12BattleText2 ; 0x5718 TextBeforeBattle
	dw Route12AfterBattleText2 ; 0x5722 TextAfterBattle
	dw Route12EndBattleText2 ; 0x571d TextEndBattle
	dw Route12EndBattleText2 ; 0x571d TextEndBattle
; 0x596a9

Route12TrainerHeader2: ; 596a9 (16:56a9)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d7 ; flag's byte
	dw Route12BattleText3 ; 0x5731 TextBeforeBattle
	dw Route12AfterBattleText3 ; 0x573b TextAfterBattle
	dw Route12EndBattleText3 ; 0x5736 TextEndBattle
	dw Route12EndBattleText3 ; 0x5736 TextEndBattle
; 0x596b5

Route12TrainerHeader3: ; 596b5 (16:56b5)
	db $5 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d7 ; flag's byte
	dw Route12BattleText4 ; 0x574a TextBeforeBattle
	dw Route12AfterBattleText4 ; 0x5754 TextAfterBattle
	dw Route12EndBattleText4 ; 0x574f TextEndBattle
	dw Route12EndBattleText4 ; 0x574f TextEndBattle
; 0x596c1

Route12TrainerHeader4: ; 596c1 (16:56c1)
	db $6 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d7 ; flag's byte
	dw Route12BattleText5 ; 0x5763 TextBeforeBattle
	dw Route12AfterBattleText5 ; 0x576d TextAfterBattle
	dw Route12EndBattleText5 ; 0x5768 TextEndBattle
	dw Route12EndBattleText5 ; 0x5768 TextEndBattle
; 0x596cd

Route12TrainerHeader5: ; 596cd (16:56cd)
	db $7 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7d7 ; flag's byte
	dw Route12BattleText6 ; 0x577c TextBeforeBattle
	dw Route12AfterBattleText6 ; 0x5786 TextAfterBattle
	dw Route12EndBattleText6 ; 0x5781 TextEndBattle
	dw Route12EndBattleText6 ; 0x5781 TextEndBattle
; 0x596d9

Route12TrainerHeader6: ; 596d9 (16:56d9)
	db $8 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d7d7 ; flag's byte
	dw Route12BattleText7 ; 0x5795 TextBeforeBattle
	dw Route12AfterBattleText7 ; 0x579f TextAfterBattle
	dw Route12EndBattleText7 ; 0x579a TextEndBattle
	dw Route12EndBattleText7 ; 0x579a TextEndBattle
; 0x596e5

db $ff

Route12Text1: ; 596e6 (16:56e6)
	TX_FAR _Route12Text1
	db $50

Route12Text13: ; 596eb (16:56eb)
UnnamedText_596eb: ; 596eb (16:56eb)
	TX_FAR _UnnamedText_596eb
	db $50
; 0x596eb + 5 bytes

Route12Text14: ; 596f0 (16:56f0)
UnnamedText_596f0: ; 596f0 (16:56f0)
	TX_FAR _UnnamedText_596f0
	db $50
; 0x596f0 + 5 bytes

Route12Text2: ; 596f5 (16:56f5)
	db $08 ; asm
	ld hl, Route12TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route12BattleText1: ; 596ff (16:56ff)
	TX_FAR _Route12BattleText1
	db $50
; 0x596ff + 5 bytes

Route12EndBattleText1: ; 59704 (16:5704)
	TX_FAR _Route12EndBattleText1
	db $50
; 0x59704 + 5 bytes

Route12AfterBattleText1: ; 59709 (16:5709)
	TX_FAR _Route12AfterBattleText1
	db $50
; 0x59709 + 5 bytes

Route12Text3: ; 5970e (16:570e)
	db $08 ; asm
	ld hl, Route12TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route12BattleText2: ; 59718 (16:5718)
	TX_FAR _Route12BattleText2
	db $50
; 0x59718 + 5 bytes

Route12EndBattleText2: ; 5971d (16:571d)
	TX_FAR _Route12EndBattleText2
	db $50
; 0x5971d + 5 bytes

Route12AfterBattleText2: ; 59722 (16:5722)
	TX_FAR _Route12AfterBattleText2
	db $50
; 0x59722 + 5 bytes

Route12Text4: ; 59727 (16:5727)
	db $08 ; asm
	ld hl, Route12TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route12BattleText3: ; 59731 (16:5731)
	TX_FAR _Route12BattleText3
	db $50
; 0x59731 + 5 bytes

Route12EndBattleText3: ; 59736 (16:5736)
	TX_FAR _Route12EndBattleText3
	db $50
; 0x59736 + 5 bytes

Route12AfterBattleText3: ; 5973b (16:573b)
	TX_FAR _Route12AfterBattleText3
	db $50
; 0x5973b + 5 bytes

Route12Text5: ; 59740 (16:5740)
	db $08 ; asm
	ld hl, Route12TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route12BattleText4: ; 5974a (16:574a)
	TX_FAR _Route12BattleText4
	db $50
; 0x5974a + 5 bytes

Route12EndBattleText4: ; 5974f (16:574f)
	TX_FAR _Route12EndBattleText4
	db $50
; 0x5974f + 5 bytes

Route12AfterBattleText4: ; 59754 (16:5754)
	TX_FAR _Route12AfterBattleText4
	db $50
; 0x59754 + 5 bytes

Route12Text6: ; 59759 (16:5759)
	db $08 ; asm
	ld hl, Route12TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route12BattleText5: ; 59763 (16:5763)
	TX_FAR _Route12BattleText5
	db $50
; 0x59763 + 5 bytes

Route12EndBattleText5: ; 59768 (16:5768)
	TX_FAR _Route12EndBattleText5
	db $50
; 0x59768 + 5 bytes

Route12AfterBattleText5: ; 5976d (16:576d)
	TX_FAR _Route12AfterBattleText5
	db $50
; 0x5976d + 5 bytes

Route12Text7: ; 59772 (16:5772)
	db $08 ; asm
	ld hl, Route12TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route12BattleText6: ; 5977c (16:577c)
	TX_FAR _Route12BattleText6
	db $50
; 0x5977c + 5 bytes

Route12EndBattleText6: ; 59781 (16:5781)
	TX_FAR _Route12EndBattleText6
	db $50
; 0x59781 + 5 bytes

Route12AfterBattleText6: ; 59786 (16:5786)
	TX_FAR _Route12AfterBattleText6
	db $50
; 0x59786 + 5 bytes

Route12Text8: ; 5978b (16:578b)
	db $08 ; asm
	ld hl, Route12TrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

Route12BattleText7: ; 59795 (16:5795)
	TX_FAR _Route12BattleText7
	db $50
; 0x59795 + 5 bytes

Route12EndBattleText7: ; 5979a (16:579a)
	TX_FAR _Route12EndBattleText7
	db $50
; 0x5979a + 5 bytes

Route12AfterBattleText7: ; 5979f (16:579f)
	TX_FAR _Route12AfterBattleText7
	db $50
; 0x5979f + 5 bytes

Route12Text11: ; 597a4 (16:57a4)
	TX_FAR _Route12Text11
	db $50

Route12Text12: ; 597a9 (16:57a9)
	TX_FAR _Route12Text12
	db $50

Route15Script: ; 597ae (16:57ae)
	call EnableAutoTextBoxDrawing
	ld hl, Route15TrainerHeaders
	ld de, Route15_Unknown597c1
	ld a, [W_ROUTE15CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE15CURSCRIPT], a
	ret
; 0x597c1

Route15_Unknown597c1: ; 597c1 (16:57c1)
INCBIN "baserom.gbc",$597c1,$597c7 - $597c1

Route15Texts: ; 597c7 (16:57c7)
	dw Route15Text1, Route15Text2, Route15Text3, Route15Text4, Route15Text5, Route15Text6, Route15Text7, Route15Text8, Route15Text9, Route15Text10, Predef5CText, Route15Text12

Route15TrainerHeaders: ; 597df (16:57df)
Route15TrainerHeader0: ; 597df (16:57df)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7dd ; flag's byte
	dw Route15BattleText1 ; 0x5898 TextBeforeBattle
	dw Route15AfterBattleText1 ; 0x58a2 TextAfterBattle
	dw Route15EndBattleText1 ; 0x589d TextEndBattle
	dw Route15EndBattleText1 ; 0x589d TextEndBattle
; 0x597eb

Route15TrainerHeader1: ; 597eb (16:57eb)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7dd ; flag's byte
	dw Route15BattleText2 ; 0x58a7 TextBeforeBattle
	dw Route15AfterBattleText2 ; 0x58b1 TextAfterBattle
	dw Route15EndBattleText2 ; 0x58ac TextEndBattle
	dw Route15EndBattleText2 ; 0x58ac TextEndBattle
; 0x597f7

Route15TrainerHeader2: ; 597f7 (16:57f7)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7dd ; flag's byte
	dw Route15BattleText3 ; 0x58b6 TextBeforeBattle
	dw Route15AfterBattleText3 ; 0x58c0 TextAfterBattle
	dw Route15EndBattleText3 ; 0x58bb TextEndBattle
	dw Route15EndBattleText3 ; 0x58bb TextEndBattle
; 0x59803

Route15TrainerHeader3: ; 59803 (16:5803)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7dd ; flag's byte
	dw Route15BattleText4 ; 0x58c5 TextBeforeBattle
	dw Route15AfterBattleText4 ; 0x58cf TextAfterBattle
	dw Route15EndBattleText4 ; 0x58ca TextEndBattle
	dw Route15EndBattleText4 ; 0x58ca TextEndBattle
; 0x5980f

Route15TrainerHeader4: ; 5980f (16:580f)
	db $5 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7dd ; flag's byte
	dw Route15BattleText5 ; 0x58d4 TextBeforeBattle
	dw Route15AfterBattleText5 ; 0x58de TextAfterBattle
	dw Route15EndBattleText5 ; 0x58d9 TextEndBattle
	dw Route15EndBattleText5 ; 0x58d9 TextEndBattle
; 0x5981b

Route15TrainerHeader5: ; 5981b (16:581b)
	db $6 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7dd ; flag's byte
	dw Route15BattleText6 ; 0x58e3 TextBeforeBattle
	dw Route15AfterBattleText6 ; 0x58ed TextAfterBattle
	dw Route15EndBattleText6 ; 0x58e8 TextEndBattle
	dw Route15EndBattleText6 ; 0x58e8 TextEndBattle
; 0x59827

Route15TrainerHeader6: ; 59827 (16:5827)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7dd ; flag's byte
	dw Route15BattleText7 ; 0x58f2 TextBeforeBattle
	dw Route15AfterBattleText7 ; 0x58fc TextAfterBattle
	dw Route15EndBattleText7 ; 0x58f7 TextEndBattle
	dw Route15EndBattleText7 ; 0x58f7 TextEndBattle
; 0x59833

Route15TrainerHeader7: ; 59833 (16:5833)
	db $8 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7dd ; flag's byte
	dw Route15BattleText8 ; 0x5901 TextBeforeBattle
	dw Route15AfterBattleText8 ; 0x590b TextAfterBattle
	dw Route15EndBattleText8 ; 0x5906 TextEndBattle
	dw Route15EndBattleText8 ; 0x5906 TextEndBattle
; 0x5983f

Route15TrainerHeader8: ; 5983f (16:583f)
	db $9 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7dd ; flag's byte
	dw Route15BattleText9 ; 0x5910 TextBeforeBattle
	dw Route15AfterBattleText9 ; 0x591a TextAfterBattle
	dw Route15EndBattleText9 ; 0x5915 TextEndBattle
	dw Route15EndBattleText9 ; 0x5915 TextEndBattle
; 0x5984b

Route15TrainerHeader9: ; 5984b (16:584b)
	db $a ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7dd ; flag's byte
	dw Route15BattleText10 ; 0x591f TextBeforeBattle
	dw Route15AfterBattleText10 ; 0x5929 TextAfterBattle
	dw Route15EndBattleText10 ; 0x5924 TextEndBattle
	dw Route15EndBattleText10 ; 0x5924 TextEndBattle
; 0x59857

db $ff

Route15Text1: ; 59858 (16:5858)
	db $8 ; asm
	ld hl, Route15TrainerHeader0
	jr asm_33cb7 ; 0x5985c $34

Route15Text2: ; 5985e (16:585e)
	db $8 ; asm
	ld hl, Route15TrainerHeader1
	jr asm_33cb7 ; 0x59862 $2e

Route15Text3: ; 59864 (16:5864)
	db $8 ; asm
	ld hl, Route15TrainerHeader2
	jr asm_33cb7 ; 0x59868 $28

Route15Text4: ; 5986a (16:586a)
	db $8 ; asm
	ld hl, Route15TrainerHeader3
	jr asm_33cb7 ; 0x5986e $22

Route15Text5: ; 59870 (16:5870)
	db $8 ; asm
	ld hl, Route15TrainerHeader4
	jr asm_33cb7 ; 0x59874 $1c

Route15Text6: ; 59876 (16:5876)
	db $8 ; asm
	ld hl, Route15TrainerHeader5
	jr asm_33cb7 ; 0x5987a $16

Route15Text7: ; 5987c (16:587c)
	db $8 ; asm
	ld hl, Route15TrainerHeader6
	jr asm_33cb7 ; 0x59880 $10

Route15Text8: ; 59882 (16:5882)
	db $8 ; asm
	ld hl, Route15TrainerHeader7
	jr asm_33cb7 ; 0x59886 $a

Route15Text9: ; 59888 (16:5888)
	db $8 ; asm
	ld hl, Route15TrainerHeader8
	jr asm_33cb7 ; 0x5988c $4

Route15Text10: ; 5988e (16:588e)
	db $8 ; asm
	ld hl, Route15TrainerHeader9
asm_33cb7: ; 59892 (16:5892)
	call TalkToTrainer
	jp TextScriptEnd
; 0x59898

Route15BattleText1: ; 59898 (16:5898)
	TX_FAR _Route15BattleText1
	db $50
; 0x59898 + 5 bytes

Route15EndBattleText1: ; 5989d (16:589d)
	TX_FAR _Route15EndBattleText1
	db $50
; 0x5989d + 5 bytes

Route15AfterBattleText1: ; 598a2 (16:58a2)
	TX_FAR _Route15AfterBattleText1
	db $50
; 0x598a2 + 5 bytes

Route15BattleText2: ; 598a7 (16:58a7)
	TX_FAR _Route15BattleText2
	db $50
; 0x598a7 + 5 bytes

Route15EndBattleText2: ; 598ac (16:58ac)
	TX_FAR _Route15EndBattleText2
	db $50
; 0x598ac + 5 bytes

Route15AfterBattleText2: ; 598b1 (16:58b1)
	TX_FAR _Route15AfterBattleText2
	db $50
; 0x598b1 + 5 bytes

Route15BattleText3: ; 598b6 (16:58b6)
	TX_FAR _Route15BattleText3
	db $50
; 0x598b6 + 5 bytes

Route15EndBattleText3: ; 598bb (16:58bb)
	TX_FAR _Route15EndBattleText3
	db $50
; 0x598bb + 5 bytes

Route15AfterBattleText3: ; 598c0 (16:58c0)
	TX_FAR _Route15AfterBattleText3
	db $50
; 0x598c0 + 5 bytes

Route15BattleText4: ; 598c5 (16:58c5)
	TX_FAR _Route15BattleText4
	db $50
; 0x598c5 + 5 bytes

Route15EndBattleText4: ; 598ca (16:58ca)
	TX_FAR _Route15EndBattleText4
	db $50
; 0x598ca + 5 bytes

Route15AfterBattleText4: ; 598cf (16:58cf)
	TX_FAR _Route15AfterBattleText4
	db $50
; 0x598cf + 5 bytes

Route15BattleText5: ; 598d4 (16:58d4)
	TX_FAR _Route15BattleText5
	db $50
; 0x598d4 + 5 bytes

Route15EndBattleText5: ; 598d9 (16:58d9)
	TX_FAR _Route15EndBattleText5
	db $50
; 0x598d9 + 5 bytes

Route15AfterBattleText5: ; 598de (16:58de)
	TX_FAR _Route15AfterBattleText5
	db $50
; 0x598de + 5 bytes

Route15BattleText6: ; 598e3 (16:58e3)
	TX_FAR _Route15BattleText6
	db $50
; 0x598e3 + 5 bytes

Route15EndBattleText6: ; 598e8 (16:58e8)
	TX_FAR _Route15EndBattleText6
	db $50
; 0x598e8 + 5 bytes

Route15AfterBattleText6: ; 598ed (16:58ed)
	TX_FAR _Route15AfterBattleText6
	db $50
; 0x598ed + 5 bytes

Route15BattleText7: ; 598f2 (16:58f2)
	TX_FAR _Route15BattleText7
	db $50
; 0x598f2 + 5 bytes

Route15EndBattleText7: ; 598f7 (16:58f7)
	TX_FAR _Route15EndBattleText7
	db $50
; 0x598f7 + 5 bytes

Route15AfterBattleText7: ; 598fc (16:58fc)
	TX_FAR _Route15AfterBattleText7
	db $50
; 0x598fc + 5 bytes

Route15BattleText8: ; 59901 (16:5901)
	TX_FAR _Route15BattleText8
	db $50
; 0x59901 + 5 bytes

Route15EndBattleText8: ; 59906 (16:5906)
	TX_FAR _Route15EndBattleText8
	db $50
; 0x59906 + 5 bytes

Route15AfterBattleText8: ; 5990b (16:590b)
	TX_FAR _Route15AfterBattleText8
	db $50
; 0x5990b + 5 bytes

Route15BattleText9: ; 59910 (16:5910)
	TX_FAR _Route15BattleText9
	db $50
; 0x59910 + 5 bytes

Route15EndBattleText9: ; 59915 (16:5915)
	TX_FAR _Route15EndBattleText9
	db $50
; 0x59915 + 5 bytes

Route15AfterBattleText9: ; 5991a (16:591a)
	TX_FAR _Route15AfterBattleText9
	db $50
; 0x5991a + 5 bytes

Route15BattleText10: ; 5991f (16:591f)
	TX_FAR _Route15BattleText10
	db $50
; 0x5991f + 5 bytes

Route15EndBattleText10: ; 59924 (16:5924)
	TX_FAR _Route15EndBattleText10
	db $50
; 0x59924 + 5 bytes

Route15AfterBattleText10: ; 59929 (16:5929)
	TX_FAR _Route15AfterBattleText10
	db $50
; 0x59929 + 5 bytes

Route15Text12: ; 5992e (16:592e)
	TX_FAR _Route15Text12
	db $50

Route16Script: ; 59933 (16:5933)
	call EnableAutoTextBoxDrawing
	ld hl, Route16TrainerHeaders
	ld de, Unknown_59951 ; $5951
	ld a, [W_ROUTE16CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE16CURSCRIPT], a
	ret
; 0x59946

; known jump sources: 59994 (16:5994)
Func_59946: ; 59946 (16:5946)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_ROUTE16CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_59951: ; 59951 (16:5951)
INCBIN "baserom.gbc",$59951,$59959 - $59951
	ld hl, $d7e0
	bit 1, [hl]
	jp nz, CheckFightingMapTrainers
	bit 0, [hl]
	res 0, [hl]
	jp z, CheckFightingMapTrainers
	ld a, $a
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $84
	ld [W_CUROPPONENT], a ; $d059
	ld a, $1e
	ld [W_CURENEMYLVL], a ; $d127
	ld a, $21
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	call UpdateSprites
	ld a, $3
	ld [W_ROUTE16CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_59946
	call UpdateSprites
	ld a, [$cf0b]
	cp $2
	jr z, .asm_599a8
	ld a, $b
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
.asm_599a8
	ld hl, $d7e0
	set 1, [hl]
	call Delay3
	ld a, $0
	ld [W_ROUTE16CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 599b9 (16:59b9)
Route16Texts: ; 599b9 (16:59b9)
	dw Route16Text1, Route16Text2, Route16Text3, Route16Text4, Route16Text5, Route16Text6, Route16Text7, Route16Text8, Route16Text9, Route16Text10, Route16Text11

Route16TrainerHeaders: ; 599cf (16:59cf)
Route16TrainerHeader0: ; 599cf (16:59cf)
	db $1 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7df ; flag's byte
	dw Route16BattleText1 ; 0x5a22 TextBeforeBattle
	dw Route16AfterBattleText1 ; 0x5a2c TextAfterBattle
	dw Route16EndBattleText1 ; 0x5a27 TextEndBattle
	dw Route16EndBattleText1 ; 0x5a27 TextEndBattle
; 0x599db

Route16TrainerHeader1: ; 599db (16:59db)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7df ; flag's byte
	dw Route16BattleText2 ; 0x5a3b TextBeforeBattle
	dw Route16AfterBattleText2 ; 0x5a45 TextAfterBattle
	dw Route16EndBattleText2 ; 0x5a40 TextEndBattle
	dw Route16EndBattleText2 ; 0x5a40 TextEndBattle
; 0x599e7

Route16TrainerHeader2: ; 599e7 (16:59e7)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7df ; flag's byte
	dw Route16BattleText3 ; 0x5a54 TextBeforeBattle
	dw Route16AfterBattleText3 ; 0x5a5e TextAfterBattle
	dw Route16EndBattleText3 ; 0x5a59 TextEndBattle
	dw Route16EndBattleText3 ; 0x5a59 TextEndBattle
; 0x599f3

Route16TrainerHeader3: ; 599f3 (16:59f3)
	db $4 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7df ; flag's byte
	dw Route16BattleText4 ; 0x5a6d TextBeforeBattle
	dw Route16AfterBattleText4 ; 0x5a77 TextAfterBattle
	dw Route16EndBattleText4 ; 0x5a72 TextEndBattle
	dw Route16EndBattleText4 ; 0x5a72 TextEndBattle
; 0x599ff

Route16TrainerHeader4: ; 599ff (16:59ff)
	db $5 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d7df ; flag's byte
	dw Route16BattleText5 ; 0x5a86 TextBeforeBattle
	dw Route16AfterBattleText5 ; 0x5a90 TextAfterBattle
	dw Route16EndBattleText5 ; 0x5a8b TextEndBattle
	dw Route16EndBattleText5 ; 0x5a8b TextEndBattle
; 0x59a0b

Route16TrainerHeader5: ; 59a0b (16:5a0b)
	db $6 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7df ; flag's byte
	dw Route16BattleText6 ; 0x5a9f TextBeforeBattle
	dw Route16AfterBattleText6 ; 0x5aa9 TextAfterBattle
	dw Route16EndBattleText6 ; 0x5aa4 TextEndBattle
	dw Route16EndBattleText6 ; 0x5aa4 TextEndBattle
; 0x59a17

db $ff

Route16Text1: ; 59a18 (16:5a18)
	db $08 ; asm
	ld hl, Route16TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route16BattleText1: ; 59a22 (16:5a22)
	TX_FAR _Route16BattleText1
	db $50
; 0x59a22 + 5 bytes

Route16EndBattleText1: ; 59a27 (16:5a27)
	TX_FAR _Route16EndBattleText1
	db $50
; 0x59a27 + 5 bytes

Route16AfterBattleText1: ; 59a2c (16:5a2c)
	TX_FAR _Route16AfterBattleText1
	db $50
; 0x59a2c + 5 bytes

Route16Text2: ; 59a31 (16:5a31)
	db $08 ; asm
	ld hl, Route16TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route16BattleText2: ; 59a3b (16:5a3b)
	TX_FAR _Route16BattleText2
	db $50
; 0x59a3b + 5 bytes

Route16EndBattleText2: ; 59a40 (16:5a40)
	TX_FAR _Route16EndBattleText2
	db $50
; 0x59a40 + 5 bytes

Route16AfterBattleText2: ; 59a45 (16:5a45)
	TX_FAR _Route16AfterBattleText2
	db $50
; 0x59a45 + 5 bytes

Route16Text3: ; 59a4a (16:5a4a)
	db $08 ; asm
	ld hl, Route16TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route16BattleText3: ; 59a54 (16:5a54)
	TX_FAR _Route16BattleText3
	db $50
; 0x59a54 + 5 bytes

Route16EndBattleText3: ; 59a59 (16:5a59)
	TX_FAR _Route16EndBattleText3
	db $50
; 0x59a59 + 5 bytes

Route16AfterBattleText3: ; 59a5e (16:5a5e)
	TX_FAR _Route16AfterBattleText3
	db $50
; 0x59a5e + 5 bytes

Route16Text4: ; 59a63 (16:5a63)
	db $08 ; asm
	ld hl, Route16TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

Route16BattleText4: ; 59a6d (16:5a6d)
	TX_FAR _Route16BattleText4
	db $50
; 0x59a6d + 5 bytes

Route16EndBattleText4: ; 59a72 (16:5a72)
	TX_FAR _Route16EndBattleText4
	db $50
; 0x59a72 + 5 bytes

Route16AfterBattleText4: ; 59a77 (16:5a77)
	TX_FAR _Route16AfterBattleText4
	db $50
; 0x59a77 + 5 bytes

Route16Text5: ; 59a7c (16:5a7c)
	db $08 ; asm
	ld hl, Route16TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

Route16BattleText5: ; 59a86 (16:5a86)
	TX_FAR _Route16BattleText5
	db $50
; 0x59a86 + 5 bytes

Route16EndBattleText5: ; 59a8b (16:5a8b)
	TX_FAR _Route16EndBattleText5
	db $50
; 0x59a8b + 5 bytes

Route16AfterBattleText5: ; 59a90 (16:5a90)
	TX_FAR _Route16AfterBattleText5
	db $50
; 0x59a90 + 5 bytes

Route16Text6: ; 59a95 (16:5a95)
	db $08 ; asm
	ld hl, Route16TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

Route16BattleText6: ; 59a9f (16:5a9f)
	TX_FAR _Route16BattleText6
	db $50
; 0x59a9f + 5 bytes

Route16EndBattleText6: ; 59aa4 (16:5aa4)
	TX_FAR _Route16EndBattleText6
	db $50
; 0x59aa4 + 5 bytes

Route16AfterBattleText6: ; 59aa9 (16:5aa9)
	TX_FAR _Route16AfterBattleText6
	db $50
; 0x59aa9 + 5 bytes

Route16Text7: ; 59aae (16:5aae)
	TX_FAR _Route16Text7
	db $50

Route16Text10: ; 59ab3 (16:5ab3)
	TX_FAR _UnnamedText_59ab3
	db $50
; 0x59ab3 + 5 bytes

Route16Text11: ; 59ab8 (16:5ab8)
	TX_FAR _UnnamedText_59ab8
	db $50
; 0x59ab8 + 5 bytes

Route16Text8: ; 59abd (16:5abd)
	TX_FAR _Route16Text8
	db $50

Route16Text9: ; 59ac2 (16:5ac2)
	TX_FAR _Route16Text9
	db $50

Route18Script: ; 59ac7 (16:5ac7)
	call EnableAutoTextBoxDrawing
	ld hl, Route18TrainerHeaders
	ld de, Route18_Unknown59ada
	ld a, [W_ROUTE18CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_ROUTE18CURSCRIPT], a
	ret
; 0x59ada

Route18_Unknown59ada: ; 59ada (16:5ada)
INCBIN "baserom.gbc",$59ada,$59ae0 - $59ada

Route18Texts: ; 59ae0 (16:5ae0)
	dw Route18Text1, Route18Text2, Route18Text3, Route18Text4, Route18Text5

Route18TrainerHeaders: ; 59aea (16:5aea)
Route18TrainerHeader0: ; 59aea (16:5aea)
	db $1 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e3 ; flag's byte
	dw Route18BattleText1 ; 0x5b19 TextBeforeBattle
	dw Route18AfterBattleText1 ; 0x5b23 TextAfterBattle
	dw Route18EndBattleText1 ; 0x5b1e TextEndBattle
	dw Route18EndBattleText1 ; 0x5b1e TextEndBattle
; 0x59af6

Route18TrainerHeader1: ; 59af6 (16:5af6)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7e3 ; flag's byte
	dw Route18BattleText2 ; 0x5b32 TextBeforeBattle
	dw Route18AfterBattleText2 ; 0x5b3c TextAfterBattle
	dw Route18EndBattleText2 ; 0x5b37 TextEndBattle
	dw Route18EndBattleText2 ; 0x5b37 TextEndBattle
; 0x59b02

Route18TrainerHeader2: ; 59b02 (16:5b02)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7e3 ; flag's byte
	dw Route18BattleText3 ; 0x5b4b TextBeforeBattle
	dw Route18AfterBattleText3 ; 0x5b55 TextAfterBattle
	dw Route18EndBattleText3 ; 0x5b50 TextEndBattle
	dw Route18EndBattleText3 ; 0x5b50 TextEndBattle
; 0x59b0e

db $ff

Route18Text1: ; 59b0f (16:5b0f)
	db $08 ; asm
	ld hl, Route18TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

Route18BattleText1: ; 59b19 (16:5b19)
	TX_FAR _Route18BattleText1
	db $50
; 0x59b19 + 5 bytes

Route18EndBattleText1: ; 59b1e (16:5b1e)
	TX_FAR _Route18EndBattleText1
	db $50
; 0x59b1e + 5 bytes

Route18AfterBattleText1: ; 59b23 (16:5b23)
	TX_FAR _Route18AfterBattleText1
	db $50
; 0x59b23 + 5 bytes

Route18Text2: ; 59b28 (16:5b28)
	db $08 ; asm
	ld hl, Route18TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

Route18BattleText2: ; 59b32 (16:5b32)
	TX_FAR _Route18BattleText2
	db $50
; 0x59b32 + 5 bytes

Route18EndBattleText2: ; 59b37 (16:5b37)
	TX_FAR _Route18EndBattleText2
	db $50
; 0x59b37 + 5 bytes

Route18AfterBattleText2: ; 59b3c (16:5b3c)
	TX_FAR _Route18AfterBattleText2
	db $50
; 0x59b3c + 5 bytes

Route18Text3: ; 59b41 (16:5b41)
	db $08 ; asm
	ld hl, Route18TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

Route18BattleText3: ; 59b4b (16:5b4b)
	TX_FAR _Route18BattleText3
	db $50
; 0x59b4b + 5 bytes

Route18EndBattleText3: ; 59b50 (16:5b50)
	TX_FAR _Route18EndBattleText3
	db $50
; 0x59b50 + 5 bytes

Route18AfterBattleText3: ; 59b55 (16:5b55)
	TX_FAR _Route18AfterBattleText3
	db $50
; 0x59b55 + 5 bytes

Route18Text4: ; 59b5a (16:5b5a)
	TX_FAR _Route18Text4
	db $50

Route18Text5: ; 59b5f (16:5b5f)
	TX_FAR _Route18Text5
	db $50

FanClub_h: ; 0x59b64 to 0x59b70 (12 bytes) (id=90)
	db $10 ; tileset
	db POKEMON_FAN_CLUB_HEIGHT, POKEMON_FAN_CLUB_WIDTH ; dimensions (y, x)
	dw FanClubBlocks, FanClubTexts, FanClubScript ; blocks, texts, scripts
	db $00 ; connections

	dw FanClubObject ; objects

FanClubScript: ; 59b70 (16:5b70)
	jp EnableAutoTextBoxDrawing
; 0x59b73

; known jump sources: 59c1d (16:5c1d)
Func_59b73: ; 59b73 (16:5b73)
	ld a, [$d771]
	bit 1, a
	ret nz
	ld b, $6
	call IsItemInBag
	ret nz
	ld b, $2d
	jp IsItemInBag
; 59b84 (16:5b84)
FanClubTexts: ; 59b84 (16:5b84)
	dw FanClubText1, FanClubText2, FanClubText3, FanClubText4, FanClubText5, FanClubText6, FanClubText7, FanClubText8

FanClubText1: ; 59b94 (16:5b94)
	db $08 ; asm
	ld a, [$d771]
	bit 7, a
	jr nz, asm_67b22 ; 0x59b9a
	ld hl, UnnamedText_59bb7
	call PrintText
	ld hl, $d771
	set 6, [hl]
	jr asm_64f01 ; 0x59ba7
asm_67b22 ; 0x59ba9
	ld hl, UnnamedText_59bbc
	call PrintText
	ld hl, $d771
	res 7, [hl]
asm_64f01 ; 0x59bb4
	jp TextScriptEnd

UnnamedText_59bb7: ; 59bb7 (16:5bb7)
	TX_FAR _UnnamedText_59bb7
	db $50
; 0x59bb7 + 5 bytes

UnnamedText_59bbc: ; 59bbc (16:5bbc)
	TX_FAR _UnnamedText_59bbc
	db $50
; 0x59bbc + 5 bytes

FanClubText2: ; 59bc1 (16:5bc1)
	db $08 ; asm
	ld a, [$d771]
	bit 6, a
	jr nz, asm_5cd59 ; 0x59bc7
	ld hl, UnnamedText_59be4
	call PrintText
	ld hl, $d771
	set 7, [hl]
	jr asm_59625 ; 0x59bd4
asm_5cd59 ; 0x59bd6
	ld hl, UnnamedText_59be9
	call PrintText
	ld hl, $d771
	res 6, [hl]
asm_59625 ; 0x59be1
	jp TextScriptEnd

UnnamedText_59be4: ; 59be4 (16:5be4)
	TX_FAR _UnnamedText_59be4
	db $50
; 0x59be4 + 5 bytes

UnnamedText_59be9: ; 59be9 (16:5be9)
	TX_FAR _UnnamedText_59be9
	db $50
; 0x59be9 + 5 bytes

FanClubText3: ; 59bee (16:5bee)
	db $8
	ld hl, UnnamedText_59c00
	call PrintText
	ld a, PIKACHU
	call PlayCry
	call WaitForSoundToFinish
	jp TextScriptEnd
; 0x59c00

UnnamedText_59c00: ; 59c00 (16:5c00)
	TX_FAR _UnnamedText_59c00
	db $50
; 0x59c00 + 5 bytes

FanClubText4: ; 59c05 (16:5c05)
	db $08 ; asm
	ld hl, UnnamedText_59c17
	call PrintText
	ld a, SEEL
	call PlayCry
	call WaitForSoundToFinish
	jp TextScriptEnd

UnnamedText_59c17: ; 59c17 (16:5c17)
	TX_FAR _UnnamedText_59c17
	db $50
; 0x59c17 + 5 bytes

FanClubText5: ; 59c1c (16:5c1c)
	db $08 ; asm
	call Func_59b73
	jr nz, asm_38bb3 ; 0x59c20
	ld hl, UnnamedText_59c65
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, asm_2c8d7 ; 0x59c2f
	ld hl, UnnamedText_59c6a
	call PrintText
	ld bc, (BIKE_VOUCHER << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedBikeVoucherText
	call PrintText
	ld hl, $d771
	set 1, [hl]
	jr asm_d3c26 ; 0x59c4a
.BagFull
	ld hl, UnnamedText_59c83
	call PrintText
	jr asm_d3c26 ; 0x59c52
asm_2c8d7 ; 0x59c54
	ld hl, UnnamedText_59c79
	call PrintText
	jr asm_d3c26 ; 0x59c5a
asm_38bb3 ; 0x59c5c
	ld hl, UnnamedText_59c7e
	call PrintText
asm_d3c26 ; 0x59c62
	jp TextScriptEnd

UnnamedText_59c65: ; 59c65 (16:5c65)
	TX_FAR _UnnamedText_59c65
	db $50
; 0x59c65 + 5 bytes

UnnamedText_59c6a: ; 59c6a (16:5c6a)
	TX_FAR _UnnamedText_59c6a
	db $50
; 0x59c6a + 5 bytes

ReceivedBikeVoucherText: ; 59c6f (16:5c6f)
	TX_FAR _ReceivedBikeVoucherText ; 0x9a82e
	db $11
	TX_FAR _UnnamedText_59c74 ; 0x9a844
	db $50
; 0x59c6f + 10 bytes = 0x59c79

UnnamedText_59c79: ; 59c79 (16:5c79)
	TX_FAR _UnnamedText_59c79
	db $50
; 0x59c79 + 5 bytes

UnnamedText_59c7e: ; 59c7e (16:5c7e)
	TX_FAR _UnnamedText_59c7e
	db $50
; 0x59c7e + 5 bytes

UnnamedText_59c83: ; 59c83 (16:5c83)
	TX_FAR _UnnamedText_59c83
	db $50
; 0x59c83 + 5 bytes

FanClubText6: ; 59c88 (16:5c88)
	TX_FAR _FanClubText6
	db $50

FanClubText7: ; 59c8d (16:5c8d)
	TX_FAR _FanClubText7
	db $50

FanClubText8: ; 59c92 (16:5c92)
	TX_FAR _FanClubText8
	db $50

FanClubObject: ; 0x59c97 (size=62)
	db $d ; border tile

	db $2 ; warps
	db $7, $2, $1, $ff
	db $7, $3, $1, $ff

	db $2 ; signs
	db $0, $1, $7 ; FanClubText7
	db $0, $6, $8 ; FanClubText8

	db $6 ; people
	db SPRITE_FISHER2, $3 + 4, $6 + 4, $ff, $d2, $1 ; person
	db SPRITE_GIRL, $3 + 4, $1 + 4, $ff, $d3, $2 ; person
	db SPRITE_CLEFAIRY, $4 + 4, $6 + 4, $ff, $d2, $3 ; person
	db SPRITE_SEEL, $4 + 4, $1 + 4, $ff, $d3, $4 ; person
	db SPRITE_GENTLEMAN, $1 + 4, $3 + 4, $ff, $d0, $5 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $1 + 4, $5 + 4, $ff, $d0, $6 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

FanClubBlocks: ; 59cd5 (16:5cd5)
	INCBIN "maps/fanclub.blk"

SilphCo2_h: ; 0x59ce5 to 0x59cf1 (12 bytes) (id=207)
	db $16 ; tileset
	db SILPH_CO_2F_HEIGHT, SILPH_CO_2F_WIDTH ; dimensions (y, x)
	dw SilphCo2Blocks, SilphCo2Texts, SilphCo2Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo2Object ; objects

SilphCo2Script: ; 59cf1 (16:5cf1)
	call SilphCo2_Unknown59d07
	call EnableAutoTextBoxDrawing
	ld hl, SilphCo2TrainerHeaders
	ld de, Unknown_59d80 ; $5d80
	ld a, [W_SILPHCO2CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SILPHCO2CURSCRIPT], a
	ret
; 0x59d07

SilphCo2_Unknown59d07: ; 59d07 (16:5d07)
INCBIN "baserom.gbc",$59d07,$59d43 - $59d07

; known jump sources: 59f7c (16:5f7c), 5a15a (16:615a)
Func_59d43: ; 59d43 (16:5d43)
	push hl
	ld hl, $d73f
	ld a, [hli]
	ld b, a
	ld a, [hl]
	ld c, a
	xor a
	ld [$FF00+$e0], a
	pop hl
.asm_59d4f
	ld a, [hli]
	cp $ff
	jr z, .asm_59d6b
	push hl
	ld hl, $ffe0
	inc [hl]
	pop hl
	cp b
	jr z, .asm_59d60
	inc hl
	jr .asm_59d4f
.asm_59d60
	ld a, [hli]
	cp c
	jr nz, .asm_59d4f
	ld hl, $d73f
	xor a
	ld [hli], a
	ld [hl], a
	ret
.asm_59d6b
	xor a
	ld [$FF00+$e0], a
	ret

INCBIN "baserom.gbc",$59d6f,$59d80 - $59d6f

Unknown_59d80: ; 59d80 (16:5d80)
INCBIN "baserom.gbc",$59d80,$59d86 - $59d80

SilphCo2Texts: ; 59d86 (16:5d86)
	dw SilphCo2Text1, SilphCo2Text2, SilphCo2Text3, SilphCo2Text4, SilphCo2Text5

SilphCo2TrainerHeaders: ; 59d90 (16:5d90)
SilphCo2TrainerHeader0: ; 59d90 (16:5d90)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d825 ; flag's byte
	dw SilphCo2BattleText1 ; 0x5e2a TextBeforeBattle
	dw SilphCo2AfterBattleText1 ; 0x5e34 TextAfterBattle
	dw SilphCo2EndBattleText1 ; 0x5e2f TextEndBattle
	dw SilphCo2EndBattleText1 ; 0x5e2f TextEndBattle
; 0x59d9c

SilphCo2TrainerHeader1: ; 59d9c (16:5d9c)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d825 ; flag's byte
	dw SilphCo2BattleText2 ; 0x5e39 TextBeforeBattle
	dw SilphCo2AfterBattleText2 ; 0x5e43 TextAfterBattle
	dw SilphCo2EndBattleText2 ; 0x5e3e TextEndBattle
	dw SilphCo2EndBattleText2 ; 0x5e3e TextEndBattle
; 0x59da8

SilphCo2TrainerHeader2: ; 59da8 (16:5da8)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d825 ; flag's byte
	dw SilphCo2BattleText3 ; 0x5e48 TextBeforeBattle
	dw SilphCo2AfterBattleText3 ; 0x5e52 TextAfterBattle
	dw SilphCo2EndBattleText3 ; 0x5e4d TextEndBattle
	dw SilphCo2EndBattleText3 ; 0x5e4d TextEndBattle
; 0x59db4

SilphCo2TrainerHeader3: ; 59db4 (16:5db4)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d825 ; flag's byte
	dw SilphCo2BattleText4 ; 0x5e57 TextBeforeBattle
	dw SilphCo2AfterBattleText4 ; 0x5e61 TextAfterBattle
	dw SilphCo2EndBattleText4 ; 0x5e5c TextEndBattle
	dw SilphCo2EndBattleText4 ; 0x5e5c TextEndBattle
; 0x59dc0

db $ff

SilphCo2Text1: ; 59dc1 (16:5dc1)
	db $08 ; asm
	ld a, [$d826]
	bit 7, a
	jr nz, asm_b8a0d ; 0x59dc7
	ld hl, UnnamedText_59ded
	call PrintText
	ld bc, (TM_36 << 8) | 1
	call GiveItem
	ld hl, TM36NoRoomText
	jr nc, asm_2c1e0 ; 0x59dd8
	ld hl, $d826
	set 7, [hl]
	ld hl, ReceivedTM36Text
	jr asm_2c1e0 ; 0x59de2
asm_b8a0d ; 0x59de4
	ld hl, TM36ExplanationText
asm_2c1e0 ; 0x59de7
	call PrintText
	jp TextScriptEnd

UnnamedText_59ded: ; 59ded (16:5ded)
	TX_FAR _UnnamedText_59ded
	db $50
; 0x59ded + 5 bytes

ReceivedTM36Text: ; 59df2 (16:5df2)
	TX_FAR _ReceivedTM36Text ; 0x824ba
	db $0B, $50
; 0x59df2 + 6 bytes = 0x59df8

TM36ExplanationText: ; 59df8 (16:5df8)
	TX_FAR _TM36ExplanationText
	db $50
; 0x59df8 + 5 bytes

TM36NoRoomText: ; 59dfd (16:5dfd)
	TX_FAR _TM36NoRoomText
	db $50
; 0x59dfd + 5 bytes

SilphCo2Text2: ; 59e02 (16:5e02)
	db $08 ; asm
	ld hl, SilphCo2TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SilphCo2Text3: ; 59e0c (16:5e0c)
	db $08 ; asm
	ld hl, SilphCo2TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SilphCo2Text4: ; 59e16 (16:5e16)
	db $08 ; asm
	ld hl, SilphCo2TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SilphCo2Text5: ; 59e20 (16:5e20)
	db $08 ; asm
	ld hl, SilphCo2TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

SilphCo2BattleText1: ; 59e2a (16:5e2a)
	TX_FAR _SilphCo2BattleText1
	db $50
; 0x59e2a + 5 bytes

SilphCo2EndBattleText1: ; 59e2f (16:5e2f)
	TX_FAR _SilphCo2EndBattleText1
	db $50
; 0x59e2f + 5 bytes

SilphCo2AfterBattleText1: ; 59e34 (16:5e34)
	TX_FAR _SilphCo2AfterBattleText1
	db $50
; 0x59e34 + 5 bytes

SilphCo2BattleText2: ; 59e39 (16:5e39)
	TX_FAR _SilphCo2BattleText2
	db $50
; 0x59e39 + 5 bytes

SilphCo2EndBattleText2: ; 59e3e (16:5e3e)
	TX_FAR _SilphCo2EndBattleText2
	db $50
; 0x59e3e + 5 bytes

SilphCo2AfterBattleText2: ; 59e43 (16:5e43)
	TX_FAR _SilphCo2AfterBattleText2
	db $50
; 0x59e43 + 5 bytes

SilphCo2BattleText3: ; 59e48 (16:5e48)
	TX_FAR _SilphCo2BattleText3
	db $50
; 0x59e48 + 5 bytes

SilphCo2EndBattleText3: ; 59e4d (16:5e4d)
	TX_FAR _SilphCo2EndBattleText3
	db $50
; 0x59e4d + 5 bytes

SilphCo2AfterBattleText3: ; 59e52 (16:5e52)
	TX_FAR _SilphCo2AfterBattleText3
	db $50
; 0x59e52 + 5 bytes

SilphCo2BattleText4: ; 59e57 (16:5e57)
	TX_FAR _SilphCo2BattleText4
	db $50
; 0x59e57 + 5 bytes

SilphCo2EndBattleText4: ; 59e5c (16:5e5c)
	TX_FAR _SilphCo2EndBattleText4
	db $50
; 0x59e5c + 5 bytes

SilphCo2AfterBattleText4: ; 59e61 (16:5e61)
	TX_FAR _SilphCo2AfterBattleText4
	db $50
; 0x59e61 + 5 bytes

SilphCo2Object: ; 0x59e66 (size=98)
	db $2e ; border tile

	db $7 ; warps
	db $0, $18, $2, SILPH_CO_1F
	db $0, $1a, $0, SILPH_CO_3F
	db $0, $14, $0, SILPH_CO_ELEVATOR
	db $3, $3, $6, SILPH_CO_3F
	db $3, $d, $4, SILPH_CO_8F
	db $f, $1b, $5, SILPH_CO_8F
	db $f, $9, $4, SILPH_CO_6F

	db $0 ; signs

	db $5 ; people
	db SPRITE_ERIKA, $1 + 4, $a + 4, $ff, $d1, $1 ; person
	db SPRITE_OAK_AIDE, $c + 4, $5 + 4, $ff, $d0, $42, SCIENTIST + $C8, $2 ; trainer
	db SPRITE_OAK_AIDE, $d + 4, $18 + 4, $ff, $d2, $43, SCIENTIST + $C8, $3 ; trainer
	db SPRITE_ROCKET, $b + 4, $10 + 4, $ff, $d1, $44, ROCKET + $C8, $17 ; trainer
	db SPRITE_ROCKET, $7 + 4, $18 + 4, $ff, $d1, $45, ROCKET + $C8, $18 ; trainer

	; warp-to
	EVENT_DISP $f, $0, $18 ; SILPH_CO_1F
	EVENT_DISP $f, $0, $1a ; SILPH_CO_3F
	EVENT_DISP $f, $0, $14 ; SILPH_CO_ELEVATOR
	EVENT_DISP $f, $3, $3 ; SILPH_CO_3F
	EVENT_DISP $f, $3, $d ; SILPH_CO_8F
	EVENT_DISP $f, $f, $1b ; SILPH_CO_8F
	EVENT_DISP $f, $f, $9 ; SILPH_CO_6F

SilphCo2Blocks: ; 59ec8 (16:5ec8)
	INCBIN "maps/silphco2.blk"

SilphCo3_h: ; 0x59f4f to 0x59f5b (12 bytes) (id=208)
	db $16 ; tileset
	db SILPH_CO_3F_HEIGHT, SILPH_CO_3F_WIDTH ; dimensions (y, x)
	dw SilphCo3Blocks, SilphCo3Texts, SilphCo3Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo3Object ; objects

SilphCo3Script: ; 59f5b (16:5f5b)
	call SilphCo3Script_Unknown59f71
	call EnableAutoTextBoxDrawing
	ld hl, SilphCo3TrainerHeaders
	ld de, Unknown_59fbe ; $5fbe
	ld a, [W_SILPHCO3CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SILPHCO3CURSCRIPT], a
	ret
; 0x59f71

SilphCo3Script_Unknown59f71: ; 59f71 (16:5f71)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, Unknown_59fa8 ; $5fa8
	call Func_59d43
	call Func_59fad
	ld a, [$d828]
	bit 0, a
	jr nz, .asm_59f98
	push af
	ld a, $5f
	ld [$d09f], a
	ld bc, $404
	ld a, $17
	call Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))
	pop af
.asm_59f98
	bit 1, a
	ret nz
	ld a, $5f
	ld [$d09f], a
	ld bc, $408
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

Unknown_59fa8: ; 59fa8 (16:5fa8)
INCBIN "baserom.gbc",$59fa8,$59fad - $59fa8

; known jump sources: 59f7f (16:5f7f)
Func_59fad: ; 59fad (16:5fad)
	ld hl, $d828
	ld a, [$FF00+$e0]
	and a
	ret z
	cp $1
	jr nz, .asm_59fbb
	set 0, [hl]
	ret
.asm_59fbb
	set 1, [hl]
	ret

Unknown_59fbe: ; 59fbe (16:5fbe)
INCBIN "baserom.gbc",$59fbe,$59fc4 - $59fbe

SilphCo3Texts: ; 59fc4 (16:5fc4)
	dw SilphCo3Text1, SilphCo3Text2, SilphCo3Text3, Predef5CText

SilphCo3TrainerHeaders: ; 59fcc (16:5fcc)
SilphCo3TrainerHeader0: ; 59fcc (16:5fcc)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d827 ; flag's byte
	dw SilphCo3BattleText1 ; 0x600d TextBeforeBattle
	dw SilphCo3AfterBattleText1 ; 0x6017 TextAfterBattle
	dw SilphCo3EndBattleText1 ; 0x6012 TextEndBattle
	dw SilphCo3EndBattleText1 ; 0x6012 TextEndBattle
; 0x59fd8

SilphCo3TrainerHeader1: ; 59fd8 (16:5fd8)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d827 ; flag's byte
	dw SilphCo3BattleText2 ; 0x6026 TextBeforeBattle
	dw SilphCo3AfterBattleText2 ; 0x6030 TextAfterBattle
	dw SilphCo3EndBattleText2 ; 0x602b TextEndBattle
	dw SilphCo3EndBattleText2 ; 0x602b TextEndBattle
; 0x59fe4

db $ff

SilphCo3Text1: ; 59fe5 (16:5fe5)
	db $08 ; asm
	ld a, [$d838]
	bit 7, a
	ld hl, UnnamedText_59ffe
	jr nz, asm_8c56f ; 0x59fee
	ld hl, UnnamedText_59ff9
asm_8c56f ; 0x59ff3
	call PrintText
	jp TextScriptEnd

UnnamedText_59ff9: ; 59ff9 (16:5ff9)
	TX_FAR _UnnamedText_59ff9
	db $50
; 0x59ff9 + 5 bytes

UnnamedText_59ffe: ; 59ffe (16:5ffe)
	TX_FAR _UnnamedText_59ffe
	db $50
; 0x59ffe + 5 bytes

SilphCo3Text2: ; 5a003 (16:6003)
	db $08 ; asm
	ld hl, SilphCo3TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SilphCo3BattleText1: ; 5a00d (16:600d)
	TX_FAR _SilphCo3BattleText1
	db $50
; 0x5a00d + 5 bytes

SilphCo3EndBattleText1: ; 5a012 (16:6012)
	TX_FAR _SilphCo3EndBattleText1
	db $50
; 0x5a012 + 5 bytes

SilphCo3AfterBattleText1: ; 5a017 (16:6017)
	TX_FAR _SilphCo3AfterBattleText1
	db $50
; 0x5a017 + 5 bytes

SilphCo3Text3: ; 5a01c (16:601c)
	db $08 ; asm
	ld hl, SilphCo3TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SilphCo3BattleText2: ; 5a026 (16:6026)
	TX_FAR _SilphCo3BattleText2
	db $50
; 0x5a026 + 5 bytes

SilphCo3EndBattleText2: ; 5a02b (16:602b)
	TX_FAR _SilphCo3EndBattleText2
	db $50
; 0x5a02b + 5 bytes

SilphCo3AfterBattleText2: ; 5a030 (16:6030)
	TX_FAR _SilphCo3AfterBattleText2
	db $50
; 0x5a030 + 5 bytes

SilphCo3Object: ; 0x5a035 (size=113)
	db $2e ; border tile

	db $a ; warps
	db $0, $1a, $1, SILPH_CO_2F
	db $0, $18, $0, SILPH_CO_4F
	db $0, $14, $0, SILPH_CO_ELEVATOR
	db $b, $17, $9, SILPH_CO_3F
	db $3, $3, $5, SILPH_CO_5F
	db $f, $3, $6, SILPH_CO_5F
	db $3, $1b, $3, SILPH_CO_2F
	db $b, $3, $3, SILPH_CO_9F
	db $b, $b, $4, SILPH_CO_7F
	db $f, $1b, $3, SILPH_CO_3F

	db $0 ; signs

	db $4 ; people
	db SPRITE_LAPRAS_GIVER, $8 + 4, $18 + 4, $ff, $ff, $1 ; person
	db SPRITE_ROCKET, $7 + 4, $14 + 4, $ff, $d2, $42, ROCKET + $C8, $19 ; trainer
	db SPRITE_OAK_AIDE, $9 + 4, $7 + 4, $ff, $d0, $43, SCIENTIST + $C8, $4 ; trainer
	db SPRITE_BALL, $5 + 4, $8 + 4, $ff, $ff, $84, HYPER_POTION ; item

	; warp-to
	EVENT_DISP $f, $0, $1a ; SILPH_CO_2F
	EVENT_DISP $f, $0, $18 ; SILPH_CO_4F
	EVENT_DISP $f, $0, $14 ; SILPH_CO_ELEVATOR
	EVENT_DISP $f, $b, $17 ; SILPH_CO_3F
	EVENT_DISP $f, $3, $3 ; SILPH_CO_5F
	EVENT_DISP $f, $f, $3 ; SILPH_CO_5F
	EVENT_DISP $f, $3, $1b ; SILPH_CO_2F
	EVENT_DISP $f, $b, $3 ; SILPH_CO_9F
	EVENT_DISP $f, $b, $b ; SILPH_CO_7F
	EVENT_DISP $f, $f, $1b ; SILPH_CO_3F

SilphCo3Blocks: ; 5a0a6 (16:60a6)
	INCBIN "maps/silphco3.blk"

SilphCo10_h: ; 0x5a12d to 0x5a139 (12 bytes) (id=234)
	db $16 ; tileset
	db SILPH_CO_10F_HEIGHT, SILPH_CO_10F_WIDTH ; dimensions (y, x)
	dw SilphCo10Blocks, SilphCo10Texts, SilphCo10Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo10Object ; objects

SilphCo10Script: ; 5a139 (16:6139)
	call SilphCo10Script_Unknown5a14f
	call EnableAutoTextBoxDrawing
	ld hl, SilphCo10TrainerHeaders
	ld de, Unknown_5a180 ; $6180
	ld a, [W_SILPHCO10CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SILPHCO10CURSCRIPT], a
	ret
; 0x5a14f

SilphCo10Script_Unknown5a14f: ; 5a14f (16:614f)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, Unknown_5a173 ; $6173
	call Func_59d43
	call Func_5a176
	ld a, [$d836]
	bit 0, a
	ret nz
	ld a, $54
	ld [$d09f], a
	ld bc, $405
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

Unknown_5a173: ; 5a173 (16:6173)
INCBIN "baserom.gbc",$5a173,$5a176 - $5a173

; known jump sources: 5a15d (16:615d)
Func_5a176: ; 5a176 (16:6176)
	ld a, [$FF00+$e0]
	and a
	ret z
	ld hl, $d836
	set 0, [hl]
	ret

Unknown_5a180: ; 5a180 (16:6180)
INCBIN "baserom.gbc",$5a180,$5a186 - $5a180

SilphCo10Texts: ; 5a186 (16:6186)
	dw SilphCo10Text1, SilphCo10Text2, SilphCo10Text3, Predef5CText, Predef5CText, Predef5CText

SilphCo10TrainerHeaders: ; 5a192 (16:6192)
SilphCo10TrainerHeader0: ; 5a192 (16:6192)
	db $1 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d835 ; flag's byte
	dw SilphCo10BattleText1 ; 0x61dd TextBeforeBattle
	dw SilphCo10AfterBattleText1 ; 0x61e7 TextAfterBattle
	dw SilphCo10EndBattleText1 ; 0x61e2 TextEndBattle
	dw SilphCo10EndBattleText1 ; 0x61e2 TextEndBattle
; 0x5a19e

SilphCo10TrainerHeader1: ; 5a19e (16:619e)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d835 ; flag's byte
	dw SilphCo10BattleText2 ; 0x61ec TextBeforeBattle
	dw SilphCo10AfterBattleText2 ; 0x61f6 TextAfterBattle
	dw SilphCo10EndBattleText2 ; 0x61f1 TextEndBattle
	dw SilphCo10EndBattleText2 ; 0x61f1 TextEndBattle
; 0x5a1aa

db $ff

SilphCo10Text1: ; 5a1ab (16:61ab)
	db $08 ; asm
	ld hl, SilphCo10TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SilphCo10Text2: ; 5a1b5 (16:61b5)
	db $08 ; asm
	ld hl, SilphCo10TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SilphCo10Text3: ; 5a1bf (16:61bf)
	db $08 ; asm
	ld a, [$d838]
	bit 7, a
	ld hl, UnnamedText_5a1d8
	jr nz, asm_cf85f ; 0x5a1c8
	ld hl, UnnamedText_5a1d3
asm_cf85f ; 0x5a1cd
	call PrintText
	jp TextScriptEnd

UnnamedText_5a1d3: ; 5a1d3 (16:61d3)
	TX_FAR _UnnamedText_5a1d3
	db $50
; 0x5a1d3 + 5 bytes

UnnamedText_5a1d8: ; 5a1d8 (16:61d8)
	TX_FAR _UnnamedText_5a1d8
	db $50
; 0x5a1d8 + 5 bytes

SilphCo10BattleText1: ; 5a1dd (16:61dd)
	TX_FAR _SilphCo10BattleText1
	db $50
; 0x5a1dd + 5 bytes

SilphCo10EndBattleText1: ; 5a1e2 (16:61e2)
	TX_FAR _SilphCo10EndBattleText1
	db $50
; 0x5a1e2 + 5 bytes

SilphCo10AfterBattleText1: ; 5a1e7 (16:61e7)
	TX_FAR _SilphCo10AfterBattleText1
	db $50
; 0x5a1e7 + 5 bytes

SilphCo10BattleText2: ; 5a1ec (16:61ec)
	TX_FAR _SilphCo10BattleText2
	db $50
; 0x5a1ec + 5 bytes

SilphCo10EndBattleText2: ; 5a1f1 (16:61f1)
	TX_FAR _SilphCo10EndBattleText2
	db $50
; 0x5a1f1 + 5 bytes

SilphCo10AfterBattleText2: ; 5a1f6 (16:61f6)
	TX_FAR _SilphCo10AfterBattleText2
	db $50
; 0x5a1f6 + 5 bytes

SilphCo10Object: ; 0x5a1fb (size=95)
	db $2e ; border tile

	db $6 ; warps
	db $0, $8, $0, SILPH_CO_9F
	db $0, $a, $0, SILPH_CO_11F
	db $0, $c, $0, SILPH_CO_ELEVATOR
	db $b, $9, $3, SILPH_CO_4F
	db $f, $d, $5, SILPH_CO_4F
	db $7, $d, $6, SILPH_CO_4F

	db $0 ; signs

	db $6 ; people
	db SPRITE_ROCKET, $9 + 4, $1 + 4, $ff, $d3, $41, ROCKET + $C8, $27 ; trainer
	db SPRITE_OAK_AIDE, $2 + 4, $a + 4, $ff, $d2, $42, SCIENTIST + $C8, $b ; trainer
	db SPRITE_ERIKA, $f + 4, $9 + 4, $fe, $0, $3 ; person
	db SPRITE_BALL, $c + 4, $2 + 4, $ff, $ff, $84, TM_26 ; item
	db SPRITE_BALL, $e + 4, $4 + 4, $ff, $ff, $85, RARE_CANDY ; item
	db SPRITE_BALL, $b + 4, $5 + 4, $ff, $ff, $86, CARBOS ; item

	; warp-to
	EVENT_DISP $8, $0, $8 ; SILPH_CO_9F
	EVENT_DISP $8, $0, $a ; SILPH_CO_11F
	EVENT_DISP $8, $0, $c ; SILPH_CO_ELEVATOR
	EVENT_DISP $8, $b, $9 ; SILPH_CO_4F
	EVENT_DISP $8, $f, $d ; SILPH_CO_4F
	EVENT_DISP $8, $7, $d ; SILPH_CO_4F

SilphCo10Blocks: ; 5a25a (16:625a)
	INCBIN "maps/silphco10.blk"

Lance_h: ; 0x5a2a2 to 0x5a2ae (12 bytes) (id=113)
	db $05 ; tileset
	db LANCES_ROOM_HEIGHT, LANCES_ROOM_WIDTH ; dimensions (y, x)
	dw LanceBlocks, LanceTexts, LanceScript ; blocks, texts, scripts
	db $00 ; connections

	dw LanceObject ; objects

LanceScript: ; 5a2ae (16:62ae)
	call LanceScript_Unknown5a2c4
	call EnableAutoTextBoxDrawing
	ld hl, LanceTrainerHeaders
	ld de, Unknown_5a2fa ; $62fa
	ld a, [W_LANCECURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_LANCECURSCRIPT], a
	ret
; 0x5a2c4

LanceScript_Unknown5a2c4: ; 5a2c4 (16:62c4)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld a, [$d866]
	bit 7, a
	jr nz, .asm_5a2da
	ld a, $31
	ld b, $32
	jp Func_5a2de
.asm_5a2da
	ld a, $72
	ld b, $73

; known jump sources: 5a2d7 (16:62d7)
Func_5a2de: ; 5a2de (16:62de)
	push bc
	ld [$d09f], a
	ld bc, $602
	call Func_5a2f0
	pop bc
	ld a, b
	ld [$d09f], a
	ld bc, $603

; known jump sources: 5a2e5 (16:62e5)
Func_5a2f0: ; 5a2f0 (16:62f0)
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

; known jump sources: 5a351 (16:6351)
Func_5a2f5: ; 5a2f5 (16:62f5)
	xor a
	ld [W_LANCECURSCRIPT], a
	ret

Unknown_5a2fa: ; 5a2fa (16:62fa)
INCBIN "baserom.gbc",$5a2fa,$5a305 - $5a2fa
	ld a, [$d866]
	bit 6, a
	ret nz
	ld hl, .unknown_5a33e ; $633e
	call ArePlayerCoordsInArray
	jp nc, CheckFightingMapTrainers
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $3
	jr nc, .asm_5a325
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp DisplayTextID
.asm_5a325
	cp $5
	jr z, .asm_5a35b
	ld hl, $d866
	bit 7, [hl]
	set 7, [hl]
	ret nz
	ld hl, $d126
	set 5, [hl]
	ld a, $ad
	call PlaySound
	jp LanceScript_Unknown5a2c4

.unknown_5a33e: ; 5a33e (16:633e)
INCBIN "baserom.gbc",$5a33e,$5a349 - $5a33e

	call EndTrainerBattle
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_5a2f5
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp DisplayTextID
.asm_5a35b
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $ccd3
	ld de, RLEList_5a379
	call DecodeRLEList
	dec a
	ld [$cd38], a
	call Func_3486
	ld a, $3
	ld [W_LANCECURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

RLEList_5a379: ; 5a379 (16:6379)
db $40, $0C
db $20, $0C
db $80, $07
db $20, $06
db $FF

Func_5a382: ; 5a382 (16:6382)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_LANCECURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 5a395 (16:6395)
LanceTexts: ; 5a395 (16:6395)
	dw LanceText1

LanceTrainerHeaders: ; 5a397 (16:6397)
LanceTrainerHeader0: ; 5a397 (16:6397)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d866 ; flag's byte
	dw LanceBeforeBattleText ; 0x63ae TextBeforeBattle
	dw LanceAfterBattleText ; 0x63b8 TextAfterBattle
	dw LanceEndBattleText ; 0x63b3 TextEndBattle
	dw LanceEndBattleText ; 0x63b3 TextEndBattle
; 0x5a3a3

db $ff

LanceText1: ; 5a3a4 (16:63a4)
	db $08 ; asm
	ld hl, LanceTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

LanceBeforeBattleText: ; 5a3ae (16:63ae)
	TX_FAR _LanceBeforeBattleText
	db $50
; 0x5a3ae + 5 bytes

LanceEndBattleText: ; 5a3b3 (16:63b3)
	TX_FAR _LanceEndBattleText
	db $50
; 0x5a3b3 + 5 bytes

LanceAfterBattleText: ; 5a3b8 (16:63b8)
	TX_FAR _LanceAfterBattleText ; 0x85e9e
	db $8
	ld hl, $d866
	set 6, [hl]
	jp TextScriptEnd
; 0x5a3c5

LanceObject: ; 0x5a3c5 (size=36)
	db $3 ; border tile

	db $3 ; warps
	db $10, $18, $2, AGATHAS_ROOM
	db $0, $5, $0, CHAMPIONS_ROOM
	db $0, $6, $0, CHAMPIONS_ROOM

	db $0 ; signs

	db $1 ; people
	db SPRITE_LANCE, $1 + 4, $6 + 4, $ff, $d0, $41, LANCE + $C8, $1 ; trainer

	; warp-to
	EVENT_DISP $d, $10, $18 ; AGATHAS_ROOM
	EVENT_DISP $d, $0, $5 ; CHAMPIONS_ROOM
	EVENT_DISP $d, $0, $6 ; CHAMPIONS_ROOM

LanceBlocks: ; 5a3e9 (16:63e9)
	INCBIN "maps/lance.blk"

HallofFameRoom_h: ; 0x5a492 to 0x5a49e (12 bytes) (id=118)
	db $07 ; tileset
	db HALL_OF_FAME_HEIGHT, HALL_OF_FAME_WIDTH ; dimensions (y, x)
	dw HallofFameRoomBlocks, HallofFameRoomTexts, HallofFameRoomScript ; blocks, texts, scripts
	db $00 ; connections

	dw HallofFameRoomObject ; objects

HallofFameRoomScript: ; 5a49e (16:649e)
	call EnableAutoTextBoxDrawing
	ld hl, HallofFameRoomScripts
	ld a, [W_HALLOFFAMEROOMCURSCRIPT]
	jp CallFunctionInTable
; 0x5a4aa

INCBIN "baserom.gbc",$5a4aa,$5a4b2 - $5a4aa

HallofFameRoomScripts: ; 5a4b2 (16:64b2)
	dw HallofFameRoomScript0, HallofFameRoomScript1, HallofFameRoomScript2, HallofFameRoomScript3

HallofFameRoomScript3: ; 5a4ba (16:64ba)
	db $c9

HallofFameRoomScript2: ; 5a4bb (16:64bb)
	call Delay3
	ld a, [$d358]
	push af
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $55
	call Predef
	pop af
	ld [$d358], a
	ld hl, W_FLAGS_D733
	res 1, [hl]
	inc hl
	set 0, [hl]
	xor a
	ld hl, W_LORELEICURSCRIPT
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld [W_LANCECURSCRIPT], a
	ld [W_HALLOFFAMEROOMCURSCRIPT], a
	ld hl, $d863
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	xor a
	ld [W_HALLOFFAMEROOMCURSCRIPT], a
	ld a, $0
	ld [$d719], a
	ld b, BANK(SaveSAVtoSRAM)
	ld hl, SaveSAVtoSRAM
	call Bankswitch
	ld b, $5
.asm_5a4ff
	ld c, $78
	call DelayFrames
	dec b
	jr nz, .asm_5a4ff ; 0x5a505 $f8
	call WaitForTextScrollButtonPress
	jp InitGame
; 0x5a50d

HallofFameRoomScript0: ; 5a50d (16:650d)
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $ccd3
	ld de, RLEMovement5a528
	call DecodeRLEList
	dec a
	ld [$cd38], a
	call Func_3486
	ld a, $1
	ld [W_HALLOFFAMEROOMCURSCRIPT], a
	ret
; 0x5a528

RLEMovement5a528: ; 5a528 (16:6528)
	db $40,$5
	db $ff

HallofFameRoomScript1: ; 5a52b (16:652b)
	ld a, [$cd38]
	and a
	ret nz
	ld a, $1
	ld [$d528], a
	ld a, $1
	ld [$ff00+$8c], a
	call SetSpriteMovementBytesToFF
	ld a, $8
	ld [$ff00+$8d], a
	call Func_34a6
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	inc a
	ld [$d528], a
	ld a, $1
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $8
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, $2
	ld [W_HALLOFFAMEROOMCURSCRIPT], a
	ret
; 0x5a56a

HallofFameRoomTexts: ; 5a56a (16:656a)
	dw HallofFameRoomText1

HallofFameRoomText1: ; 5a56c (16:656c)
	TX_FAR _HallofFameRoomText1
	db $50

HallofFameRoomObject: ; 0x5a571 (size=26)
	db $3 ; border tile

	db $2 ; warps
	db $7, $4, $2, CHAMPIONS_ROOM
	db $7, $5, $3, CHAMPIONS_ROOM

	db $0 ; signs

	db $1 ; people
	db SPRITE_OAK, $2 + 4, $5 + 4, $ff, $d0, $1 ; person

	; warp-to
	EVENT_DISP $5, $7, $4 ; CHAMPIONS_ROOM
	EVENT_DISP $5, $7, $5 ; CHAMPIONS_ROOM

HallofFameRoomBlocks: ; 5a58b (16:658b)
	INCBIN "maps/halloffameroom.blk"

; known jump sources: 1e142 (7:6142)
RemoveGuardDrink: ; 5a59f (16:659f)
	ld hl, GuardDrinksList
.drinkLoop
	ld a, [hli]
	ld [$FF00+$db], a
	and a
	ret z
	push hl
	ld b, a
	call IsItemInBag
	pop hl
	jr z, .drinkLoop
	ld b, BANK(RemoveItemByID)
	ld hl, RemoveItemByID
	jp Bankswitch ; indirect jump to RemoveItemByID (17f37 (5:7f37))

GuardDrinksList: ; 5a5b7 (16:65b7)
	db FRESH_WATER, SODA_POP, LEMONADE, $00

SECTION "bank17",ROMX,BANK[$17]

SaffronMartBlocks: ; 5c000 (17:4000)
LavenderMartBlocks: ; 5c000 (17:4000)
CeruleanMartBlocks: ; 5c000 (17:4000)
VermilionMartBlocks: ; 5c000 (17:4000)
	INCBIN "maps/vermilionmart.blk"

CopycatsHouseF2Blocks: ; 5c010 (17:4010)
RedsHouse2FBlocks: ; 0x5c010 16?
	INCBIN "maps/redshouse2f.blk"

MuseumF1Blocks: ; 5c020 (17:4020)
	INCBIN "maps/museumf1.blk"

MuseumF2Blocks: ; 5c048 (17:4048)
	INCBIN "maps/museumf2.blk"

SaffronPokecenterBlocks: ; 5c064 (17:4064)
VermilionPokecenterBlocks: ; 5c064 (17:4064)
LavenderPokecenterBlocks: ; 5c064 (17:4064)
PewterPokecenterBlocks: ; 5c064 (17:4064)
	INCBIN "maps/pewterpokecenter.blk"

UndergroundTunnelEntranceRoute7Blocks: ; 5c080 (17:4080)
UndergroundTunnelEntranceRoute6Blocks: ; 5c080 (17:4080)
UndergroundTunnelEntranceRoute5Blocks: ; 5c080 (17:4080)
	INCBIN "maps/undergroundtunnelentranceroute5.blk"

Route2GateBlocks: ; 5c090 (17:4090)
ViridianForestEntranceBlocks: ; 5c090 (17:4090)
ViridianForestexitBlocks: ; 5c090 (17:4090)
	INCBIN "maps/viridianforestexit.blk"

RedsHouse2F_h: ; 5c0a4 (17:40a4)
	db $04 ; tileset
	db $04,$04 ; dimensions
	dw RedsHouse2FBlocks, RedsHouse2FTexts, RedsHouse2FScript
	db 0 ; no connections
	dw RedsHouse2FObject

RedsHouse2FScript: ; 5c0b0 (17:40b0)
	call EnableAutoTextBoxDrawing
	ld hl,RedsHouse2FScriptPointers
	ld a,[W_REDSHOUSE2CURSCRIPT]
	jp CallFunctionInTable

RedsHouse2FScriptPointers: ; 5c0bc (17:40bc)
	dw RedsHouse2FScript1,RedsHouse2FScript2

RedsHouse2FScript1: ; 5c0c0 (17:40c0)
	xor a
	ld [H_CURRENTPRESSEDBUTTONS],a
	ld a,8
	ld [$D528],a
	ld a,1
	ld [W_REDSHOUSE2CURSCRIPT],a
	ret

RedsHouse2FScript2: ; 5c0ce (17:40ce)
	ret

RedsHouse2FTexts: ; 5c0cf (17:40cf)
	db "@"

RedsHouse2FObject: ; 0x5c0d0 ?
	db $0A ; border tile

	db 1 ; warps
	db 1,7,2,$25

	db 0 ; signs

	db 0 ; people

	dw $C6EF + 4 + (4 + 6) * 0 + 3
	db 1,7

; known jump sources: 1d178 (7:5178)
Func_5c0dc: ; 5c0dc (17:40dc)
	ld a, $4b
	ld [W_OWNEDPOKEMON], a ; $d2f7
	ld a, $3d
	call Predef ; indirect jump to ShowPokedexData (402d1 (10:42d1))
	xor a
	ld [W_OWNEDPOKEMON], a ; $d2f7
	ret
; 5c0eb (17:40eb)
MuseumF1_h: ; 0x5c0eb to 0x5c0f7 (12 bytes) (id=52)
	db $0a ; tileset
	db MUSEUM_1F_HEIGHT, MUSEUM_1F_WIDTH ; dimensions (y, x)
	dw MuseumF1Blocks, MuseumF1Texts, MuseumF1Script ; blocks, texts, scripts
	db $00 ; connections

	dw MuseumF1Object ; objects

MuseumF1Script: ; 5c0f7 (17:40f7)
	ld a, $1
	ld [$cf0c], a
	xor a
	ld [$cc3c], a
	ld hl, MuseumF1Scripts
	ld a, [W_MUSEUMF1CURSCRIPT]
	jp CallFunctionInTable
; 0x5c109

MuseumF1Scripts: ; 5c109 (17:4109)
	dw MuseumF1Script0, MuseumF1Script1

MuseumF1Script0: ; 5c10d (17:410d)
	ld a, [$d361]
	cp $4
	ret nz
	ld a, [$d362]
	cp $9
	jr z, .asm_5c120 ; 0x5c118 $6
	ld a, [$d362]
	cp $a
	ret nz
.asm_5c120
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $1
	ld [$ff00+$8c], a
	jp DisplayTextID
; 0x5c12a

MuseumF1Script1: ; 5c12a (17:412a)
	ret
; 0x5c12b

MuseumF1Texts: ; 5c12b (17:412b)
	dw MuseumF1Text1, MuseumF1Text2, MuseumF1Text3, MuseumF1Text4, MuseumF1Text5

MuseumF1Text1: ; 5c135 (17:4135)
	db $8
	ld a, [$d361]
	cp $4
	jr nz, asm_8774b ; 0x5c13b $a
	ld a, [$d362]
	cp $d
	jp z, Func_5c1f9
	jr asm_b8709 ; 0x5c145 $1c
asm_8774b: ; 5c147 (17:4147)
	cp $3
	jr nz, asm_d49e7 ; 0x5c149 $8
	ld a, [$d362]
	cp $c
	jp z, Func_5c1f9
asm_d49e7: ; 5c153 (17:4153)
	ld a, [$d754]
	bit 0, a
	jr nz, asm_31a16 ; 0x5c158 $10
	ld hl, UnnamedText_5c23d
	call PrintText
	jp asm_d1145
asm_b8709: ; 5c163 (17:4163)
	ld a, [$d754]
	bit 0, a
	jr z, asm_3ded4 ; 0x5c168 $9
asm_31a16: ; 5c16a (17:416a)
	ld hl, UnnamedText_5c242
	call PrintText
	jp asm_d1145
asm_3ded4: ; 5c173 (17:4173)
	ld a, $13
	ld [$d125], a
	call DisplayTextBoxID
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld hl, UnnamedText_5c21f
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, asm_de133 ; 0x5c18b $4d
	xor a
	ld [$ff00+$9f], a
	ld [$ff00+$a0], a
	ld a, $50
	ld [$ff00+$a1], a
	call HasEnoughMoney
	jr nc, asm_0f3e3 ; 0x5c199 $9
	ld hl, UnnamedText_5c229
	call PrintText
	jp asm_de133
asm_0f3e3: ; 5c1a4 (17:41a4)
	ld hl, UnnamedText_5c224
	call PrintText
	ld hl, $d754
	set 0, [hl]
	xor a
	ld [$cd3d], a
	ld [$cd3e], a
	ld a, $50
	ld [$cd3f], a
	ld hl, $cd3f
	ld de, $d349
	ld c, $3
	ld a, $c
	call Predef
	ld a, $13
	ld [$d125], a
	call DisplayTextBoxID
	ld a, $b2
	call PlaySoundWaitForCurrent
	call WaitForSoundToFinish
	jr asm_0b094 ; 0x5c1d8 $18
asm_de133: ; 5c1da (17:41da)
	ld hl, UnnamedText_5c21a ; $421a
	call PrintText
	ld a, $1
	ld [$cd38], a
	ld a, $80
	ld [$ccd3], a
	call Func_3486
	call UpdateSprites
	jr asm_d1145 ; 0x5c1f0 $25
asm_0b094: ; 5c1f2 (17:41f2)
	ld a, $1
	ld [W_MUSEUMF1CURSCRIPT], a
	jr asm_d1145 ; 0x5c1f7 $1e

Func_5c1f9: ; 5c1f9 (17:41f9)
	ld hl, UnnamedText_5c22e
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	cp $0
	jr nz, asm_d1144
	ld hl, UnnamedText_5c233
	call PrintText
	jr asm_d1145 ; 0x5c20f $6
asm_d1144: ; 5c211 (17:4211)
	ld hl, UnnamedText_5c238
	call PrintText
asm_d1145: ; 5c217 (17:4217)
	jp TextScriptEnd
; 0x5c21a

UnnamedText_5c21a: ; 5c21a (17:421a)
	TX_FAR _UnnamedText_5c21a
	db $50
; 0x5c21a + 5 bytes

UnnamedText_5c21f: ; 5c21f (17:421f)
	TX_FAR _UnnamedText_5c21f
	db $50
; 0x5c21f + 5 bytes

UnnamedText_5c224: ; 5c224 (17:4224)
	TX_FAR _UnnamedText_5c224
	db $50
; 0x5c224 + 5 bytes

UnnamedText_5c229: ; 5c229 (17:4229)
	TX_FAR _UnnamedText_5c229
	db $50
; 0x5c229 + 5 bytes

UnnamedText_5c22e: ; 5c22e (17:422e)
	TX_FAR _UnnamedText_5c22e
	db $50
; 0x5c22e + 5 bytes

UnnamedText_5c233: ; 5c233 (17:4233)
	TX_FAR _UnnamedText_5c233
	db $50
; 0x5c233 + 5 bytes

UnnamedText_5c238: ; 5c238 (17:4238)
	TX_FAR _UnnamedText_5c238
	db $50
; 0x5c238 + 5 bytes

UnnamedText_5c23d: ; 5c23d (17:423d)
	TX_FAR _UnnamedText_5c23d
	db $50
; 0x5c23d + 5 bytes

UnnamedText_5c242: ; 5c242 (17:4242)
	TX_FAR _UnnamedText_5c242
	db $50
; 0x5c242 + 5 bytes

MuseumF1Text2: ; 5c247 (17:4247)
	db $08 ; asm
	ld hl, UnnamedText_5c251
	call PrintText
	jp TextScriptEnd

UnnamedText_5c251: ; 5c251 (17:4251)
	TX_FAR _UnnamedText_5c251
	db $50
; 0x5c251 + 5 bytes

MuseumF1Text3: ; 5c256 (17:4256)
	db $08 ; asm
	ld a, [$d754]
	bit 1, a
	jr nz, .asm_16599 ; 0x5c25c
	ld hl, UnnamedText_5c28e
	call PrintText
	ld bc, (OLD_AMBER << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, $d754
	set 1, [hl]
	ld a, $34
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld hl, ReceivedOldAmberText
	jr .asm_52e0f ; 0x5c27e
.BagFull
	ld hl, UnnamedText_5c29e
	jr .asm_52e0f ; 0x5c283
.asm_16599 ; 0x5c285
	ld hl, UnnamedText_5c299
.asm_52e0f ; 0x5c288
	call PrintText
	jp TextScriptEnd

UnnamedText_5c28e: ; 5c28e (17:428e)
	TX_FAR _UnnamedText_5c28e
	db $50
; 0x5c28e + 5 bytes

ReceivedOldAmberText: ; 5c293 (17:4293)
	TX_FAR _ReceivedOldAmberText ; 0x96790
	db $0B, $50
; 0x5c293 + 6 bytes = 0x5c299

UnnamedText_5c299: ; 5c299 (17:4299)
	TX_FAR _UnnamedText_5c299
	db $50
; 0x5c299 + 5 bytes

UnnamedText_5c29e: ; 5c29e (17:429e)
	TX_FAR _UnnamedText_5c29e
	db $50
; 0x5c29e + 5 bytes

MuseumF1Text4: ; 5c2a3 (17:42a3)
	db $08 ; asm
	ld hl, UnnamedText_5c2ad
	call PrintText
	jp TextScriptEnd

UnnamedText_5c2ad: ; 5c2ad (17:42ad)
	TX_FAR _UnnamedText_5c2ad
	db $50
; 0x5c2ad + 5 bytes

MuseumF1Text5: ; 5c2b2 (17:42b2)
	db $08 ; asm
	ld hl, UnnamedText_5c2bc
	call PrintText
	jp TextScriptEnd

UnnamedText_5c2bc: ; 5c2bc (17:42bc)
	TX_FAR _UnnamedText_5c2bc
	db $50
; 0x5c2bc + 5 bytes

MuseumF1Object: ; 0x5c2c1 (size=74)
	db $a ; border tile

	db $5 ; warps
	db $7, $a, $0, $ff
	db $7, $b, $0, $ff
	db $7, $10, $1, $ff
	db $7, $11, $1, $ff
	db $7, $7, $0, MUSEUM_2F

	db $0 ; signs

	db $5 ; people
	db SPRITE_OAK_AIDE, $4 + 4, $c + 4, $ff, $d2, $1 ; person
	db SPRITE_GAMBLER, $4 + 4, $1 + 4, $ff, $ff, $2 ; person
	db SPRITE_OAK_AIDE, $2 + 4, $f + 4, $ff, $d0, $3 ; person
	db SPRITE_OAK_AIDE, $4 + 4, $11 + 4, $ff, $ff, $4 ; person
	db SPRITE_OLD_AMBER, $2 + 4, $10 + 4, $ff, $ff, $5 ; person

	; warp-to
	EVENT_DISP $a, $7, $a
	EVENT_DISP $a, $7, $b
	EVENT_DISP $a, $7, $10
	EVENT_DISP $a, $7, $11
	EVENT_DISP $a, $7, $7 ; MUSEUM_2F

MuseumF2_h: ; 0x5c30b to 0x5c317 (12 bytes) (id=53)
	db $0a ; tileset
	db MUSEUM_2F_HEIGHT, MUSEUM_2F_WIDTH ; dimensions (y, x)
	dw MuseumF2Blocks, MuseumF2Texts, MuseumF2Script ; blocks, texts, scripts
	db $00 ; connections

	dw MuseumF2Object ; objects

MuseumF2Script: ; 5c317 (17:4317)
	jp EnableAutoTextBoxDrawing
; 0x5c31a

MuseumF2Texts: ; 5c31a (17:431a)
	dw MuseumF2Text1, MuseumF2Text2, MuseumF2Text3, MuseumF2Text4, MuseumF2Text5, MuseumF2Text6, MuseumF2Text7

MuseumF2Text1: ; 5c328 (17:4328)
	TX_FAR _MuseumF2Text1
	db $50

MuseumF2Text2: ; 5c32d (17:432d)
	TX_FAR _MuseumF2Text2
	db $50

MuseumF2Text3: ; 5c332 (17:4332)
	TX_FAR _MuseumF2Text3
	db $50

MuseumF2Text4: ; 5c337 (17:4337)
	TX_FAR _MuseumF2Text4
	db $50

MuseumF2Text5: ; 5c33c (17:433c)
	TX_FAR _MuseumF2Text5
	db $50

MuseumF2Text6: ; 5c341 (17:4341)
	TX_FAR _MuseumF2Text6
	db $50

MuseumF2Text7: ; 5c346 (17:4346)
	TX_FAR _MuseumF2Text7
	db $50

MuseumF2Object: ; 0x5c34b (size=48)
	db $a ; border tile

	db $1 ; warps
	db $7, $7, $4, MUSEUM_1F

	db $2 ; signs
	db $2, $b, $6 ; MuseumF2Text6
	db $5, $2, $7 ; MuseumF2Text7

	db $5 ; people
	db SPRITE_BUG_CATCHER, $7 + 4, $1 + 4, $fe, $2, $1 ; person
	db SPRITE_OLD_PERSON, $5 + 4, $0 + 4, $ff, $d0, $2 ; person
	db SPRITE_OAK_AIDE, $5 + 4, $7 + 4, $ff, $d0, $3 ; person
	db SPRITE_BRUNETTE_GIRL, $5 + 4, $b + 4, $ff, $ff, $4 ; person
	db SPRITE_HIKER, $5 + 4, $c + 4, $ff, $d0, $5 ; person

	; warp-to
	EVENT_DISP $7, $7, $7 ; MUSEUM_1F

PewterGym_h: ; 0x5c37b to 0x5c387 (12 bytes) (id=54)
	db $07 ; tileset
	db PEWTER_GYM_HEIGHT, PEWTER_GYM_WIDTH ; dimensions (y, x)
	dw PewterGymBlocks, PewterGymTexts, PewterGymScript ; blocks, texts, scripts
	db $00 ; connections

	dw PewterGymObject ; objects

PewterGymScript: ; 5c387 (17:4387)
	ld hl, $d126
	bit 6, [hl]
	res 6, [hl]
	call nz, PewterGymScript_Unknown5c3a4
	call EnableAutoTextBoxDrawing
	ld hl, PewterGymTrainerHeaders
	ld de, Unknown_5c3ca ; $43ca
	ld a, [W_PEWTERGYMCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_PEWTERGYMCURSCRIPT], a
	ret
; 0x5c3a4

PewterGymScript_Unknown5c3a4: ; 5c3a4 (17:43a4)
	ld hl, Unknown_5c3ad ; $43ad
	ld de, Unknown_5c3b9 ; $43b9
	jp LoadGymLeaderAndCityName

Unknown_5c3ad: ; 5c3ad (17:43ad)
INCBIN "baserom.gbc",$5c3ad,$5c3b9 - $5c3ad

Unknown_5c3b9: ; 5c3b9 (17:43b9)
INCBIN "baserom.gbc",$5c3b9,$5c3bf - $5c3b9

; known jump sources: 5c3d7 (17:43d7), 5c432 (17:4432)
Func_5c3bf: ; 5c3bf (17:43bf)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_PEWTERGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_5c3ca: ; 5c3ca (17:43ca)
INCBIN "baserom.gbc",$5c3ca,$5c3d2 - $5c3ca
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_5c3bf
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a

; known jump sources: 5c45a (17:445a)
Func_5c3df: ; 5c3df (17:43df)
	ld a, $4
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d755
	set 7, [hl]
	ld bc, (TM_34 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a, $5
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d755
	set 6, [hl]
	jr .asm_5c408
.BagFull
	ld a, $6
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
.asm_5c408
	ld hl, W_OBTAINEDBADGES ; $d356
	set 0, [hl]
	ld hl, $d72a
	set 0, [hl]
	ld a, $4
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	ld a, $22
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	ld hl, $d7eb
	res 0, [hl]
	res 7, [hl]
	ld hl, $d755
	set 2, [hl]
	jp Func_5c3bf
; 5c435 (17:4435)
PewterGymTexts: ; 5c435 (17:4435)
	dw PewterGymText1, PewterGymText2, PewterGymText3, PewterGymText4, PewterGymText5, PewterGymText6

PewterGymTrainerHeaders: ; 5c441 (17:4441)
PewterGymTrainerHeader0: ; 5c441 (17:4441)
	db $2 ; flag's bit
	db ($5 << 4) ; trainer's view range
	dw $d755 ; flag's byte
	dw PewterGymBattleText1 ; 0x44d0 TextBeforeBattle
	dw PewterGymAfterBattleText1 ; 0x44da TextAfterBattle
	dw PewterGymEndBattleText1 ; 0x44d5 TextEndBattle
	dw PewterGymEndBattleText1 ; 0x44d5 TextEndBattle
; 0x5c44d

db $ff

PewterGymText1: ; 5c44e (17:444e)
	db $08 ; asm
	ld a, [$d755]
	bit 7, a
	jr z, .asm_4a735 ; 0x5c454
	bit 6, a
	jr nz, .asm_ff7d0 ; 0x5c458
	call z, Func_5c3df
	call DisableWaitingAfterTextDisplay
	jr .asm_e0ffb ; 0x5c460
.asm_ff7d0 ; 0x5c462
	ld hl, UnnamedText_5c4a3
	call PrintText
	jr .asm_e0ffb ; 0x5c468
.asm_4a735 ; 0x5c46a
	ld hl, UnnamedText_5c49e
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_5c4bc
	ld de, UnnamedText_5c4bc
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $1
	ld [$d05c], a
	xor a
	ldh [$b4], a
	ld a, $3
	ld [W_PEWTERGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
.asm_e0ffb ; 0x5c49b
	jp TextScriptEnd

UnnamedText_5c49e: ; 5c49e (17:449e)
	TX_FAR _UnnamedText_5c49e
	db $50
; 0x5c49e + 5 bytes

UnnamedText_5c4a3: ; 5c4a3 (17:44a3)
	TX_FAR _UnnamedText_5c4a3
	db $50
; 0x5c4a3 + 5 bytes

PewterGymText4: ; 5c4a8 (17:44a8)
	TX_FAR _TM34PreReceiveText
	db $50
; 0x5c4a8 + 5 bytes

PewterGymText5: ; 5c4ad (17:44ad)
	TX_FAR _ReceivedTM34Text ; 0x980ad
	db $0B
	TX_FAR _TM34ExplanationText ; 0x980c0
	db $50
; 0x5c4ad + 10 bytes = 0x5c4b7

PewterGymText6: ; 5c4b7 (17:44b7)
	TX_FAR _TM34NoRoomText
	db $50

UnnamedText_5c4bc: ; 5c4bc (17:44bc)
	TX_FAR _UnnamedText_5c4bc ; 0x981c9
	db $0B
	TX_FAR _UnnamedText_5c4c1 ; 0x98232
	db $50
; 0x5c4c6

PewterGymText2: ; 5c4c6 (17:44c6)
	db $08 ; asm
	ld hl, PewterGymTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

PewterGymBattleText1: ; 5c4d0 (17:44d0)
	TX_FAR _PewterGymBattleText1
	db $50
; 0x5c4d0 + 5 bytes

PewterGymEndBattleText1: ; 5c4d5 (17:44d5)
	TX_FAR _PewterGymEndBattleText1
	db $50
; 0x5c4d5 + 5 bytes

PewterGymAfterBattleText1: ; 5c4da (17:44da)
	TX_FAR _PewterGymAfterBattleText1
	db $50
; 0x5c4da + 5 bytes

PewterGymText3: ; 5c4df (17:44df)
	db $08 ; asm
	ld a, [$d72a]
	bit 0, a
	jr nz, .asm_71369 ; 0x5c4e5
	ld hl, UnnamedText_5c515
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_6123a ; 0x5c4f4
	ld hl, UnnamedText_5c51a
	call PrintText
	jr .asm_d1578 ; 0x5c4fc
.asm_6123a ; 0x5c4fe
	ld hl, UnnamedText_5c524
	call PrintText
.asm_d1578 ; 0x5c504
	ld hl, UnnamedText_5c51f
	call PrintText
	jr .asm_07013 ; 0x5c50a
.asm_71369 ; 0x5c50c
	ld hl, UnnamedText_5c529
	call PrintText
.asm_07013 ; 0x5c512
	jp TextScriptEnd

UnnamedText_5c515: ; 5c515 (17:4515)
	TX_FAR _UnnamedText_5c515
	db $50
; 0x5c515 + 5 bytes

UnnamedText_5c51a: ; 5c51a (17:451a)
	TX_FAR _UnnamedText_5c51a
	db $50
; 0x5c51a + 5 bytes

UnnamedText_5c51f: ; 5c51f (17:451f)
	TX_FAR _UnnamedText_5c51f
	db $50
; 0x5c51f + 5 bytes

UnnamedText_5c524: ; 5c524 (17:4524)
	TX_FAR _UnnamedText_5c524
	db $50
; 0x5c524 + 5 bytes

UnnamedText_5c529: ; 5c529 (17:4529)
	TX_FAR _UnnamedText_5c529
	db $50
; 0x5c529 + 5 bytes

PewterGymObject: ; 0x5c52e (size=42)
	db $3 ; border tile

	db $2 ; warps
	db $d, $4, $2, $ff
	db $d, $5, $2, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $1 + 4, $4 + 4, $ff, $d0, $41, BROCK + $C8, $1 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $6 + 4, $3 + 4, $ff, $d3, $42, JR__TRAINER_M + $C8, $1 ; trainer
	db SPRITE_GYM_HELPER, $a + 4, $7 + 4, $ff, $d0, $3 ; person

	; warp-to
	EVENT_DISP $5, $d, $4
	EVENT_DISP $5, $d, $5

PewterGymBlocks: ; 5c558 (17:4558)
	INCBIN "maps/pewtergym.blk"

PewterPokecenter_h: ; 0x5c57b to 0x5c587 (12 bytes) (id=58)
	db $06 ; tileset
	db PEWTER_POKECENTER_HEIGHT, PEWTER_POKECENTER_WIDTH ; dimensions (y, x)
	dw PewterPokecenterBlocks, PewterPokecenterTexts, PewterPokecenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw PewterPokecenterObject ; objects

PewterPokecenterScript: ; 5c587 (17:4587)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x5c58d

PewterPokecenterTexts: ; 5c58d (17:458d)
	dw PewterPokecenterText1, PewterPokecenterText2, PewterPokecenterText3, PewterPokecenterText4

PewterPokecenterText1: ; 5c595 (17:4595)
	db $ff

PewterPokecenterText2: ; 5c596 (17:4596)
	TX_FAR _PewterPokecenterText1
	db $50

PewterPokecenterText3: ; 5c59b (17:459b)
	db $8
	ld a, $1
	ld [$cc3c], a
	ld hl, PewterPokecenterText5
	call PrintText
	ld a, $ff
	call PlaySound
	ld c, $20
	call DelayFrames
	ld hl, Unknown_5c608 ; $4608
	ld de, $cd3f
	ld bc, $0004
	call CopyData
	ld a, [$c132]
	ld hl, $cd3f
.asm_5c5c3
	cp [hl]
	inc hl
	jr nz, .asm_5c5c3 ; 0x5c5c5 $fc
	dec hl
	push hl
	ld c, $1f
	ld a, $d0
	call PlayMusic
	pop hl
.asm_5c5d1
	ld a, [hl]
	ld [$c132], a
	push hl
	ld hl, $cd3f
	ld de, $cd3e
	ld bc, $0004
	call CopyData
	ld a, [$cd3e]
	ld [$cd42], a
	pop hl
	ld c, $18
	call DelayFrames
	ld a, [$c026]
	ld b, a
	ld a, [$c027]
	or b
	jr nz, .asm_5c5d1 ; 0x5c5f6 $d9
	ld c, $30
	call DelayFrames
	call Func_2307
	jp TextScriptEnd
; 0x5c603

PewterPokecenterText5: ; 5c603 (17:4603)
	TX_FAR _PewterPokecenterText5 ; 0x98744
	db $50
; 0x5c603 + 5 bytes = 0x5c608

Unknown_5c608: ; 5c608 (17:4608)
db $30, $38, $34, $3c

PewterPokecenterText4: ; 5c60c (17:460c)
	db $f6

PewterPokecenterObject: ; 0x5c60d (size=44)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $6, $ff
	db $7, $4, $6, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_GENTLEMAN, $7 + 4, $b + 4, $ff, $d2, $2 ; person
	db SPRITE_CLEFAIRY, $3 + 4, $1 + 4, $ff, $d0, $3 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

CeruleanPokecenter_h: ; 0x5c639 to 0x5c645 (12 bytes) (id=64)
	db $06 ; tileset
	db CERULEAN_POKECENTER_HEIGHT, CERULEAN_POKECENTER_WIDTH ; dimensions (y, x)
	dw CeruleanPokecenterBlocks, CeruleanPokecenterTexts, CeruleanPokecenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeruleanPokecenterObject ; objects

CeruleanPokecenterScript: ; 5c645 (17:4645)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x5c64b

CeruleanPokecenterTexts: ; 5c64b (17:464b)
	dw CeruleanPokecenterText1, CeruleanPokecenterText2, CeruleanPokecenterText3, CeruleanPokecenterText4

CeruleanPokecenterText4: ; 5c653 (17:4653)
	db $f6

CeruleanPokecenterText1: ; 5c654 (17:4654)
	db $ff

CeruleanPokecenterText2: ; 5c655 (17:4655)
	TX_FAR _CeruleanPokecenterText1
	db $50

CeruleanPokecenterText3: ; 5c65a (17:465a)
	TX_FAR _CeruleanPokecenterText3
	db $50

CeruleanPokecenterObject: ; 0x5c65f (size=44)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $2, $ff
	db $7, $4, $2, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $5 + 4, $a + 4, $fe, $0, $2 ; person
	db SPRITE_GENTLEMAN, $3 + 4, $4 + 4, $ff, $d0, $3 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

CeruleanPokecenterBlocks: ; 5c68b (17:468b)
	INCBIN "maps/ceruleanpokecenter.blk"

CeruleanGym_h: ; 0x5c6a7 to 0x5c6b3 (12 bytes) (id=65)
	db $07 ; tileset
	db CERULEAN_GYM_HEIGHT, CERULEAN_GYM_WIDTH ; dimensions (y, x)
	dw CeruleanGymBlocks, CeruleanGymTexts, CeruleanGymScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeruleanGymObject ; objects

CeruleanGymScript: ; 5c6b3 (17:46b3)
	ld hl, $d126
	bit 6, [hl]
	res 6, [hl]
	call nz, CeruleanGymScript_Unknown5c6d0
	call EnableAutoTextBoxDrawing
	ld hl, CeruleanGymTrainerHeaders
	ld de, Unknown_5c6f8 ; $46f8
	ld a, [W_CERULEANGYMCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_CERULEANGYMCURSCRIPT], a
	ret
; 0x5c6d0

CeruleanGymScript_Unknown5c6d0: ; 5c6d0 (17:46d0)
	ld hl, Unknown_5c6d9 ; $46d9
	ld de, Unknown_5c6e7 ; $46e7
	jp LoadGymLeaderAndCityName

Unknown_5c6d9: ; 5c6d9 (17:46d9)
INCBIN "baserom.gbc",$5c6d9,$5c6e7 - $5c6d9

Unknown_5c6e7: ; 5c6e7 (17:46e7)
INCBIN "baserom.gbc",$5c6e7,$5c6ed - $5c6e7

; known jump sources: 5c705 (17:4705), 5c747 (17:4747)
Func_5c6ed: ; 5c6ed (17:46ed)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_CERULEANGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_5c6f8: ; 5c6f8 (17:46f8)
INCBIN "baserom.gbc",$5c6f8,$5c700 - $5c6f8
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_5c6ed
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a

; known jump sources: 5c77d (17:477d)
Func_5c70d: ; 5c70d (17:470d)
	ld a, $5
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d75e
	set 7, [hl]
	ld bc, (TM_11 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a, $6
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d75e
	set 6, [hl]
	jr .asm_5c736
.BagFull
	ld a, $7
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
.asm_5c736
	ld hl, W_OBTAINEDBADGES ; $d356
	set 1, [hl]
	ld hl, $d72a
	set 1, [hl]
	ld hl, $d75e
	set 2, [hl]
	set 3, [hl]
	jp Func_5c6ed
; 5c74a (17:474a)
CeruleanGymTexts: ; 5c74a (17:474a)
	dw CeruleanGymText1, CeruleanGymText2, CeruleanGymText3, CeruleanGymText4, CeruleanGymText5, CeruleanGymText6, CeruleanGymText7

CeruleanGymTrainerHeaders: ; 5c758 (17:4758)
CeruleanGymTrainerHeader0: ; 5c758 (17:4758)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d75e ; flag's byte
	dw CeruleanGymBattleText1 ; 0x47e9 TextBeforeBattle
	dw CeruleanGymAfterBattleText1 ; 0x47f3 TextAfterBattle
	dw CeruleanGymEndBattleText1 ; 0x47ee TextEndBattle
	dw CeruleanGymEndBattleText1 ; 0x47ee TextEndBattle
; 0x5c764

CeruleanGymTrainerHeader1: ; 5c764 (17:4764)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d75e ; flag's byte
	dw CeruleanGymBattleText2 ; 0x4802 TextBeforeBattle
	dw CeruleanGymAfterBattleText2 ; 0x480c TextAfterBattle
	dw CeruleanGymEndBattleText2 ; 0x4807 TextEndBattle
	dw CeruleanGymEndBattleText2 ; 0x4807 TextEndBattle
; 0x5c770

db $ff

CeruleanGymText1: ; 5c771 (17:4771)
	db $08 ; asm
	ld a, [$d75e]
	bit 7, a
	jr z, .asm_10854 ; 0x5c777
	bit 6, a
	jr nz, .asm_37a1b ; 0x5c77b
	call z, Func_5c70d
	call DisableWaitingAfterTextDisplay
	jr .asm_95b04 ; 0x5c783
.asm_37a1b ; 0x5c785
	ld hl, UnnamedText_5c7c3
	call PrintText
	jr .asm_95b04 ; 0x5c78b
.asm_10854 ; 0x5c78d
	ld hl, UnnamedText_5c7be
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_5c7d8
	ld de, UnnamedText_5c7d8
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $2
	ld [$d05c], a
	xor a
	ldh [$b4], a
	ld a, $3
	ld [W_CERULEANGYMCURSCRIPT], a
.asm_95b04 ; 0x5c7bb
	jp TextScriptEnd

UnnamedText_5c7be: ; 5c7be (17:47be)
	TX_FAR _UnnamedText_5c7be
	db $50
; 0x5c7be + 5 bytes

UnnamedText_5c7c3: ; 5c7c3 (17:47c3)
	TX_FAR _UnnamedText_5c7c3
	db $50
; 0x5c7c3 + 5 bytes

CeruleanGymText5: ; 5c7c8 (17:47c8)
	TX_FAR _UnnamedText_5c7c8
	db $50
; 0x5c7c8 + 5 bytes

CeruleanGymText6: ; 5c7cd (17:47cd)
ReceivedTM11Text: ; 5c7cd (17:47cd)
	TX_FAR _ReceivedTM11Text ; 0x98b7d
	db $0B, $50
; 0x5c7cd + 6 bytes = 0x5c7d3

CeruleanGymText7: ; 5c7d3 (17:47d3)
	TX_FAR _UnnamedText_5c7d3
	db $50
; 0x5c7d3 + 5 bytes

UnnamedText_5c7d8: ; 5c7d8 (17:47d8)
	TX_FAR _UnnamedText_5c7d8 ; 0x98bb0
	db $11, $6, $50
; 0x5c7d8 + 7 bytes = 0x5c7df

CeruleanGymText2: ; 5c7df (17:47df)
	db $08 ; asm
	ld hl, CeruleanGymTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

CeruleanGymBattleText1: ; 5c7e9 (17:47e9)
	TX_FAR _CeruleanGymBattleText1
	db $50
; 0x5c7e9 + 5 bytes

CeruleanGymEndBattleText1: ; 5c7ee (17:47ee)
	TX_FAR _CeruleanGymEndBattleText1
	db $50
; 0x5c7ee + 5 bytes

CeruleanGymAfterBattleText1: ; 5c7f3 (17:47f3)
	TX_FAR _CeruleanGymAfterBattleText1
	db $50
; 0x5c7f3 + 5 bytes

CeruleanGymText3: ; 5c7f8 (17:47f8)
	db $08 ; asm
	ld hl, CeruleanGymTrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

CeruleanGymBattleText2: ; 5c802 (17:4802)
	TX_FAR _CeruleanGymBattleText2
	db $50
; 0x5c802 + 5 bytes

CeruleanGymEndBattleText2: ; 5c807 (17:4807)
	TX_FAR _CeruleanGymEndBattleText2
	db $50
; 0x5c807 + 5 bytes

CeruleanGymAfterBattleText2: ; 5c80c (17:480c)
	TX_FAR _CeruleanGymAfterBattleText2
	db $50
; 0x5c80c + 5 bytes

CeruleanGymText4: ; 5c811 (17:4811)
	db $08 ; asm
	ld a, [$d75e]
	bit 7, a
	jr nz, .asm_f80ce ; 0x5c817
	ld hl, UnnamedText_5c82a
	call PrintText
	jr .asm_18a31 ; 0x5c81f
.asm_f80ce ; 0x5c821
	ld hl, UnnamedText_5c82f
	call PrintText
.asm_18a31 ; 0x5c827
	jp TextScriptEnd

UnnamedText_5c82a: ; 5c82a (17:482a)
	TX_FAR _UnnamedText_5c82a
	db $50
; 0x5c82a + 5 bytes

UnnamedText_5c82f: ; 5c82f (17:482f)
	TX_FAR _UnnamedText_5c82f
	db $50
; 0x5c82f + 5 bytes

CeruleanGymObject: ; 0x5c834 (size=50)
	db $3 ; border tile

	db $2 ; warps
	db $d, $4, $3, $ff
	db $d, $5, $3, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_BRUNETTE_GIRL, $2 + 4, $4 + 4, $ff, $d0, $41, MISTY + $C8, $1 ; trainer
	db SPRITE_LASS, $3 + 4, $2 + 4, $ff, $d3, $42, JR__TRAINER_F + $C8, $1 ; trainer
	db SPRITE_SWIMMER, $7 + 4, $8 + 4, $ff, $d2, $43, SWIMMER + $C8, $1 ; trainer
	db SPRITE_GYM_HELPER, $a + 4, $7 + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $5, $d, $4
	EVENT_DISP $5, $d, $5

CeruleanGymBlocks: ; 5c866 (17:4866)
	INCBIN "maps/ceruleangym.blk"

CeruleanMart_h: ; 0x5c889 to 0x5c895 (12 bytes) (id=67)
	db $02 ; tileset
	db CERULEAN_MART_HEIGHT, CERULEAN_MART_WIDTH ; dimensions (y, x)
	dw CeruleanMartBlocks, CeruleanMartTexts, CeruleanMartScript ; blocks, texts, scripts
	db $00 ; connections

	dw CeruleanMartObject ; objects

CeruleanMartScript: ; 5c895 (17:4895)
	jp EnableAutoTextBoxDrawing
; 0x5c898

CeruleanMartTexts: ; 5c898 (17:4898)
	dw CeruleanMartText1, CeruleanMartText2, CeruleanMartText3

CeruleanMartText2: ; 5c89e (17:489e)
	TX_FAR _CeruleanMartText2
	db $50

CeruleanMartText3: ; 5c8a3 (17:48a3)
	TX_FAR _CeruleanMartText3
	db $50

CeruleanMartObject: ; 0x5c8a8 (size=38)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $5, $ff
	db $7, $4, $5, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_MART_GUY, $5 + 4, $0 + 4, $ff, $d3, $1 ; person
	db SPRITE_BLACK_HAIR_BOY_1, $4 + 4, $3 + 4, $fe, $1, $2 ; person
	db SPRITE_LASS, $2 + 4, $6 + 4, $fe, $2, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4

LavenderPokecenter_h: ; 0x5c8ce to 0x5c8da (12 bytes) (id=141)
	db $06 ; tileset
	db LAVENDER_POKECENTER_HEIGHT, LAVENDER_POKECENTER_WIDTH ; dimensions (y, x)
	dw LavenderPokecenterBlocks, LavenderPokecenterTexts, LavenderPokecenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw LavenderPokecenterObject ; objects

LavenderPokecenterScript: ; 5c8da (17:48da)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x5c8e0

LavenderPokecenterTexts: ; 5c8e0 (17:48e0)
	dw LavenderPokecenterText1, LavenderPokecenterText2, LavenderPokecenterText3, LavenderPokecenterText4

LavenderPokecenterText4: ; 5c8e8 (17:48e8)
	db $f6

LavenderPokecenterText1: ; 5c8e9 (17:48e9)
	db $ff

LavenderPokecenterText2: ; 5c8ea (17:48ea)
	TX_FAR _LavenderPokecenterText1
	db $50

LavenderPokecenterText3: ; 5c8ef (17:48ef)
	TX_FAR _LavenderPokecenterText3
	db $50

LavenderPokecenterObject: ; 0x5c8f4 (size=44)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $0, $ff
	db $7, $4, $0, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_GENTLEMAN, $3 + 4, $5 + 4, $ff, $ff, $2 ; person
	db SPRITE_LITTLE_GIRL, $6 + 4, $2 + 4, $fe, $1, $3 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

LavenderMart_h: ; 0x5c920 to 0x5c92c (12 bytes) (id=150)
	db $02 ; tileset
	db LAVENDER_MART_HEIGHT, LAVENDER_MART_WIDTH ; dimensions (y, x)
	dw LavenderMartBlocks, LavenderMartTexts, LavenderMartScript ; blocks, texts, scripts
	db $00 ; connections

	dw LavenderMartObject ; objects

LavenderMartScript: ; 5c92c (17:492c)
	jp EnableAutoTextBoxDrawing
; 0x5c92f

LavenderMartTexts: ; 5c92f (17:492f)
	dw LavenderMartText1, LavenderMartText2, LavenderMartText3

LavenderMartText2: ; 5c935 (17:4935)
	TX_FAR _LavenderMartText2
	db $50

LavenderMartText3: ; 5c93a (17:493a)
	db $08 ; asm
	ld a, [$d7e0]
	bit 7, a
	jr nz, .asm_c88d4 ; 0x5c940
	ld hl, UnnamedText_5c953
	call PrintText
	jr .asm_6d225 ; 0x5c948
.asm_c88d4 ; 0x5c94a
	ld hl, UnnamedText_5c958
	call PrintText
.asm_6d225 ; 0x5c950
	jp TextScriptEnd

UnnamedText_5c953: ; 5c953 (17:4953)
	TX_FAR _UnnamedText_5c953
	db $50
; 0x5c953 + 5 bytes

UnnamedText_5c958: ; 5c958 (17:4958)
	TX_FAR _UnnamedText_5c958
	db $50
; 0x5c958 + 5 bytes

LavenderMartObject: ; 0x5c95d (size=38)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $3, $ff
	db $7, $4, $3, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_MART_GUY, $5 + 4, $0 + 4, $ff, $d3, $1 ; person
	db SPRITE_BALDING_GUY, $4 + 4, $3 + 4, $ff, $ff, $2 ; person
	db SPRITE_BLACK_HAIR_BOY_1, $2 + 4, $7 + 4, $ff, $ff, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4

VermilionPokecenter_h: ; 0x5c983 to 0x5c98f (12 bytes) (id=89)
	db $06 ; tileset
	db VERMILION_POKECENTER_HEIGHT, VERMILION_POKECENTER_WIDTH ; dimensions (y, x)
	dw VermilionPokecenterBlocks, VermilionPokecenterTexts, VermilionPokecenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw VermilionPokecenterObject ; objects

VermilionPokecenterScript: ; 5c98f (17:498f)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x5c995

VermilionPokecenterTexts: ; 5c995 (17:4995)
	dw VermilionPokecenterText1, VermilionPokecenterText2, VermilionPokecenterText3, VermilionPokecenterText4

VermilionPokecenterText1: ; 5c99d (17:499d)
	db $ff

VermilionPokecenterText2: ; 5c99e (17:499e)
	TX_FAR _VermilionPokecenterText1
	db $50

VermilionPokecenterText3: ; 5c9a3 (17:49a3)
	TX_FAR _VermilionPokecenterText3
	db $50

VermilionPokecenterText4: ; 5c9a8 (17:49a8)
	db $f6

VermilionPokecenterObject: ; 0x5c9a9 (size=44)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $0, $ff
	db $7, $4, $0, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_FISHER, $5 + 4, $a + 4, $ff, $ff, $2 ; person
	db SPRITE_SAILOR, $4 + 4, $5 + 4, $ff, $ff, $3 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

VermilionMart_h: ; 0x5c9d5 to 0x5c9e1 (12 bytes) (id=91)
	db $02 ; tileset
	db VERMILION_MART_HEIGHT, VERMILION_MART_WIDTH ; dimensions (y, x)
	dw VermilionMartBlocks, VermilionMartTexts, VermilionMartScript ; blocks, texts, scripts
	db $00 ; connections

	dw VermilionMartObject ; objects

VermilionMartScript: ; 5c9e1 (17:49e1)
	jp EnableAutoTextBoxDrawing
; 0x5c9e4

VermilionMartTexts: ; 5c9e4 (17:49e4)
	dw VermilionMartText1, VermilionMartText2, VermilionMartText3

VermilionMartText2: ; 5c9ea (17:49ea)
	TX_FAR _VermilionMartText2
	db $50

VermilionMartText3: ; 5c9ef (17:49ef)
	TX_FAR _VermilionMartText3
	db $50

VermilionMartObject: ; 0x5c9f4 (size=38)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $2, $ff
	db $7, $4, $2, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_MART_GUY, $5 + 4, $0 + 4, $ff, $d3, $1 ; person
	db SPRITE_BLACK_HAIR_BOY_1, $6 + 4, $5 + 4, $ff, $ff, $2 ; person
	db SPRITE_LASS, $3 + 4, $3 + 4, $fe, $2, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4

VermilionGym_h: ; 0x5ca1a to 0x5ca26 (12 bytes) (id=92)
	db $07 ; tileset
	db VERMILION_GYM_HEIGHT, VERMILION_GYM_WIDTH ; dimensions (y, x)
	dw VermilionGymBlocks, VermilionGymTexts, VermilionGymScript ; blocks, texts, scripts
	db $00 ; connections

	dw VermilionGymObject ; objects

VermilionGymScript: ; 5ca26 (17:4a26)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	push hl
	call nz, VermilionGymScript_Unknown5ca4c
	pop hl
	bit 6, [hl]
	res 6, [hl]
	call nz, Func_5ca6d
	call EnableAutoTextBoxDrawing
	ld hl, VermilionGymTrainerHeader0
	ld de, Unknown_5ca95 ; $4a95
	ld a, [W_VERMILIONGYMCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_VERMILIONGYMCURSCRIPT], a
	ret
; 0x5ca4c

VermilionGymScript_Unknown5ca4c: ; 5ca4c (17:4a4c)
	ld hl, Unknown_5ca55 ; $4a55
	ld de, Unknown_5ca64 ; $4a64
	jp LoadGymLeaderAndCityName

Unknown_5ca55: ; 5ca55 (17:4a55)
INCBIN "baserom.gbc",$5ca55,$5ca64 - $5ca55

Unknown_5ca64: ; 5ca64 (17:4a64)
INCBIN "baserom.gbc",$5ca64,$5ca6d - $5ca64

; known jump sources: 5ca36 (17:4a36)
Func_5ca6d: ; 5ca6d (17:4a6d)
	ld a, [$d773]
	bit 0, a
	jr nz, .asm_5ca78
	ld a, $24
	jr .asm_5ca7f
.asm_5ca78
	ld a, $ad
	call PlaySound
	ld a, $5
.asm_5ca7f
	ld [$d09f], a
	ld bc, $202
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

; known jump sources: 5caa2 (17:4aa2), 5cae5 (17:4ae5)
Func_5ca8a: ; 5ca8a (17:4a8a)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_VERMILIONGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_5ca95: ; 5ca95 (17:4a95)
INCBIN "baserom.gbc",$5ca95,$5ca9d - $5ca95
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_5ca8a
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a

; known jump sources: 5cb29 (17:4b29)
Func_5caaa: ; 5caaa (17:4aaa)
	ld a, $6
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d773
	set 7, [hl]
	ld bc, (TM_24 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a, $7
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d773
	set 6, [hl]
	jr .asm_5cad3
.BagFull
	ld a, $8
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
.asm_5cad3
	ld hl, W_OBTAINEDBADGES ; $d356
	set 2, [hl]
	ld hl, $d72a
	set 2, [hl]
	ld a, [$d773]
	or $1c
	ld [$d773], a
	jp Func_5ca8a
; 5cae8 (17:4ae8)
VermilionGymTexts: ; 5cae8 (17:4ae8)
	dw VermilionGymText1, VermilionGymText2, VermilionGymText3, VermilionGymText4, VermilionGymText5, VermilionGymText6, VermilionGymText7, VermilionGymText8

VermilionGymTrainerHeaders: ; 5caf8 (17:4af8)
VermilionGymTrainerHeader0: ; 5caf8 (17:4af8)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d773 ; flag's byte
	dw VermilionGymBattleText1 ; 0x4b9a TextBeforeBattle
	dw VermilionGymAfterBattleText1 ; 0x4ba4 TextAfterBattle
	dw VermilionGymEndBattleText1 ; 0x4b9f TextEndBattle
	dw VermilionGymEndBattleText1 ; 0x4b9f TextEndBattle
; 0x5cb04

VermilionGymTrainerHeader1: ; 5cb04 (17:4b04)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d773 ; flag's byte
	dw VermilionGymBattleText2 ; 0x4bb3 TextBeforeBattle
	dw VermilionGymAfterBattleText2 ; 0x4bbd TextAfterBattle
	dw VermilionGymEndBattleText2 ; 0x4bb8 TextEndBattle
	dw VermilionGymEndBattleText2 ; 0x4bb8 TextEndBattle
; 0x5cb10

VermilionGymTrainerHeader2: ; 5cb10 (17:4b10)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d773 ; flag's byte
	dw VermilionGymBattleText3 ; 0x4bcc TextBeforeBattle
	dw VermilionGymAfterBattleText3 ; 0x4bd6 TextAfterBattle
	dw VermilionGymEndBattleText3 ; 0x4bd1 TextEndBattle
	dw VermilionGymEndBattleText3 ; 0x4bd1 TextEndBattle
; 0x5cb1c

db $ff

VermilionGymText1: ; 5cb1d (17:4b1d)
	db $08 ; asm
	ld a, [$d773]
	bit 7, a
	jr z, .asm_7cc29 ; 0x5cb23
	bit 6, a
	jr nz, .asm_41203 ; 0x5cb27
	call z, Func_5caaa
	call DisableWaitingAfterTextDisplay
	jr .asm_23621 ; 0x5cb2f
.asm_41203 ; 0x5cb31
	ld hl, UnnamedText_5cb72
	call PrintText
	jr .asm_23621 ; 0x5cb37
.asm_7cc29 ; 0x5cb39
	ld hl, UnnamedText_5cb6d
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, ReceivedThunderbadgeText
	ld de, ReceivedThunderbadgeText
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $3
	ld [$d05c], a
	xor a
	ldh [$b4], a
	ld a, $3
	ld [W_VERMILIONGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
.asm_23621 ; 0x5cb6a
	jp TextScriptEnd

UnnamedText_5cb6d: ; 5cb6d (17:4b6d)
	TX_FAR _UnnamedText_5cb6d
	db $50
; 0x5cb6d + 5 bytes

UnnamedText_5cb72: ; 5cb72 (17:4b72)
	TX_FAR _UnnamedText_5cb72
	db $50
; 0x5cb72 + 5 bytes

VermilionGymText6: ; 5cb77 (17:4b77)
	TX_FAR _UnnamedText_5cb77
	db $50
; 0x5cb77 + 5 bytes

VermilionGymText7: ; 5cb7c (17:4b7c)
	TX_FAR _ReceivedTM24Text ; 0x9c0e0
	db $11
	TX_FAR _TM24ExplanationText ; 0x9c0f5
	db $50
; 0x5cb7c + 10 bytes = 0x5cb86

VermilionGymText8: ; 5cb86 (17:4b86)
	TX_FAR _TM24NoRoomText
	db $50

ReceivedThunderbadgeText: ; 5cb8b (17:4b8b)
	TX_FAR _ReceivedThunderbadgeText
	db $50

VermilionGymText2: ; 5cb90 (17:4b90)
	db $08 ; asm
	ld hl, VermilionGymTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

VermilionGymBattleText1: ; 5cb9a (17:4b9a)
	TX_FAR _VermilionGymBattleText1
	db $50
; 0x5cb9a + 5 bytes

VermilionGymEndBattleText1: ; 5cb9f (17:4b9f)
	TX_FAR _VermilionGymEndBattleText1
	db $50
; 0x5cb9f + 5 bytes

VermilionGymAfterBattleText1: ; 5cba4 (17:4ba4)
	TX_FAR _VermilionGymAfterBattleText1
	db $50
; 0x5cba4 + 5 bytes

VermilionGymText3: ; 5cba9 (17:4ba9)
	db $08 ; asm
	ld hl, VermilionGymTrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

VermilionGymBattleText2: ; 5cbb3 (17:4bb3)
	TX_FAR _VermilionGymBattleText2
	db $50
; 0x5cbb3 + 5 bytes

VermilionGymEndBattleText2: ; 5cbb8 (17:4bb8)
	TX_FAR _VermilionGymEndBattleText2
	db $50
; 0x5cbb8 + 5 bytes

VermilionGymAfterBattleText2: ; 5cbbd (17:4bbd)
	TX_FAR _VermilionGymAfterBattleText2
	db $50
; 0x5cbbd + 5 bytes

VermilionGymText4: ; 5cbc2 (17:4bc2)
	db $08 ; asm
	ld hl, VermilionGymTrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

VermilionGymBattleText3: ; 5cbcc (17:4bcc)
	TX_FAR _VermilionGymBattleText3
	db $50
; 0x5cbcc + 5 bytes

VermilionGymEndBattleText3: ; 5cbd1 (17:4bd1)
	TX_FAR _VermilionGymEndBattleText3
	db $50
; 0x5cbd1 + 5 bytes

VermilionGymAfterBattleText3: ; 5cbd6 (17:4bd6)
	TX_FAR _VermilionGymAfterBattleText3
	db $50
; 0x5cbd6 + 5 bytes

VermilionGymText5: ; 5cbdb (17:4bdb)
	db $08 ; asm
	ld a, [$d72a]
	bit 2, a
	jr nz, .asm_13b67 ; 0x5cbe1
	ld hl, UnnamedText_5cbf4
	call PrintText
	jr .asm_c2b38 ; 0x5cbe9
.asm_13b67 ; 0x5cbeb
	ld hl, UnnamedText_5cbf9
	call PrintText
.asm_c2b38 ; 0x5cbf1
	jp TextScriptEnd

UnnamedText_5cbf4: ; 5cbf4 (17:4bf4)
	TX_FAR _UnnamedText_5cbf4
	db $50
; 0x5cbf4 + 5 bytes

UnnamedText_5cbf9: ; 5cbf9 (17:4bf9)
	TX_FAR _UnnamedText_5cbf9
	db $50
; 0x5cbf9 + 5 bytes

VermilionGymObject: ; 0x5cbfe (size=58)
	db $3 ; border tile

	db $2 ; warps
	db $11, $4, $3, $ff
	db $11, $5, $3, $ff

	db $0 ; signs

	db $5 ; people
	db SPRITE_ROCKER, $1 + 4, $5 + 4, $ff, $d0, $41, LT__SURGE + $C8, $1 ; trainer
	db SPRITE_GENTLEMAN, $6 + 4, $9 + 4, $ff, $d2, $42, GENTLEMAN + $C8, $3 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $8 + 4, $3 + 4, $ff, $d2, $43, ROCKER + $C8, $1 ; trainer
	db SPRITE_SAILOR, $a + 4, $0 + 4, $ff, $d3, $44, SAILOR + $C8, $8 ; trainer
	db SPRITE_GYM_HELPER, $e + 4, $4 + 4, $ff, $d0, $5 ; person

	; warp-to
	EVENT_DISP $5, $11, $4
	EVENT_DISP $5, $11, $5

VermilionGymBlocks: ; 5cc38 (17:4c38)
	INCBIN "maps/vermiliongym.blk"

CopycatsHouseF2_h: ; 0x5cc65 to 0x5cc71 (12 bytes) (id=176)
	db $04 ; tileset
	db COPYCATS_HOUSE_2F_HEIGHT, COPYCATS_HOUSE_2F_WIDTH ; dimensions (y, x)
	dw CopycatsHouseF2Blocks, CopycatsHouseF2Texts, CopycatsHouseF2Script ; blocks, texts, scripts
	db $00 ; connections

	dw CopycatsHouseF2Object ; objects

CopycatsHouseF2Script: ; 5cc71 (17:4c71)
	jp EnableAutoTextBoxDrawing
; 0x5cc74

CopycatsHouseF2Texts: ; 5cc74 (17:4c74)
	dw CopycatsHouseF2Text1, CopycatsHouseF2Text2, CopycatsHouseF2Text3, CopycatsHouseF2Text4, CopycatsHouseF2Text5, CopycatsHouseF2Text6, CopycatsHouseF2Text7

CopycatsHouseF2Text1: ; 5cc82 (17:4c82)
	db $08 ; asm
	ld a, [$d7af]
	bit 0, a
	jr nz, .asm_7ccf3 ; 0x5cc88
	ld a, $1
	ld [$cc3c], a
	ld hl, UnnamedText_5ccd4
	call PrintText
	ld b, POKE_DOLL
	call IsItemInBag
	jr z, .asm_62ecd ; 0x5cc9a
	ld hl, TM31PreReceiveText
	call PrintText
	ld bc, (TM_31 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedTM31Text
	call PrintText
	ld a, $33
	ldh [$db], a
	ld b, BANK(RemoveItemByID)
	ld hl, RemoveItemByID
	call Bankswitch
	ld hl, $d7af
	set 0, [hl]
	jr .asm_62ecd ; 0x5ccc1
.BagFull
	ld hl, TM31NoRoomText
	call PrintText
	jr .asm_62ecd ; 0x5ccc9
.asm_7ccf3 ; 0x5cccb
	ld hl, TM31ExplanationText2
	call PrintText
.asm_62ecd ; 0x5ccd1
	jp TextScriptEnd

UnnamedText_5ccd4: ; 5ccd4 (17:4cd4)
	TX_FAR _UnnamedText_5ccd4
	db $50
; 0x5ccd4 + 5 bytes

TM31PreReceiveText: ; 5ccd9 (17:4cd9)
	TX_FAR _TM31PreReceiveText
	db $50
; 0x5ccd9 + 5 bytes

ReceivedTM31Text: ; 5ccde (17:4cde)
	TX_FAR _ReceivedTM31Text ; 0xa1675
	db $0B
TM31ExplanationText1: ; 5cce3 (17:4ce3)
	TX_FAR _TM31ExplanationText1 ; 0xa1689
	db $d, $50
; 0x5cce9

TM31ExplanationText2: ; 5cce9 (17:4ce9)
	TX_FAR _TM31ExplanationText2 ; 0xa16c5
	db $50
; 0x5cce9 + 5 bytes = 0x5ccee

TM31NoRoomText: ; 5ccee (17:4cee)
	TX_FAR _TM31NoRoomText ; 0xa1733
	db $d, $50
; 0x5ccf4

CopycatsHouseF2Text2: ; 5ccf4 (17:4cf4)
	TX_FAR _CopycatsHouseF2Text2
	db $50

CopycatsHouseF2Text5: ; 5ccf9 (17:4cf9)
CopycatsHouseF2Text4: ; 5ccf9 (17:4cf9)
CopycatsHouseF2Text3: ; 5ccf9 (17:4cf9)
	TX_FAR _CopycatsHouseF2Text3
	db $50

CopycatsHouseF2Text6: ; 5ccfe (17:4cfe)
	TX_FAR _CopycatsHouseF2Text6
	db $50

CopycatsHouseF2Text7: ; 5cd03 (17:4d03)
	db $08 ; asm
	ld a, [$c109]
	cp $4
	ld hl, UnnamedText_5cd1c
	jr nz, .asm_399a4 ; 0x5cd0c
	ld hl, UnnamedText_5cd17
.asm_399a4 ; 0x5cd11
	call PrintText
	jp TextScriptEnd

UnnamedText_5cd17: ; 5cd17 (17:4d17)
	TX_FAR _UnnamedText_5cd17
	db $50
; 0x5cd17 + 5 bytes

UnnamedText_5cd1c: ; 5cd1c (17:4d1c)
	TX_FAR _UnnamedText_5cd1c
	db $50
; 0x5cd1c + 5 bytes

CopycatsHouseF2Object: ; 0x5cd21 (size=48)
	db $a ; border tile

	db $1 ; warps
	db $1, $7, $2, COPYCATS_HOUSE_1F

	db $2 ; signs
	db $5, $3, $6 ; CopycatsHouseF2Text6
	db $1, $0, $7 ; CopycatsHouseF2Text7

	db $5 ; people
	db SPRITE_BRUNETTE_GIRL, $3 + 4, $4 + 4, $fe, $0, $1 ; person
	db SPRITE_BIRD, $6 + 4, $4 + 4, $fe, $2, $2 ; person
	db SPRITE_SLOWBRO, $1 + 4, $5 + 4, $ff, $d0, $3 ; person
	db SPRITE_BIRD, $0 + 4, $2 + 4, $ff, $d0, $4 ; person
	db SPRITE_CLEFAIRY, $6 + 4, $1 + 4, $ff, $d3, $5 ; person

	; warp-to
	EVENT_DISP $4, $1, $7 ; COPYCATS_HOUSE_1F

FightingDojo_h: ; 0x5cd51 to 0x5cd5d (12 bytes) (id=177)
	db $05 ; tileset
	db FIGHTINGDOJO_HEIGHT, FIGHTINGDOJO_WIDTH ; dimensions (y, x)
	dw FightingDojoBlocks, FightingDojoTexts, FightingDojoScript ; blocks, texts, scripts
	db $00 ; connections

	dw FightingDojoObject ; objects

FightingDojoScript: ; 5cd5d (17:4d5d)
	call EnableAutoTextBoxDrawing
	ld hl, FightingDojoTrainerHeaders
	ld de, Unknown_5cd7b ; $4d7b
	ld a, [W_FIGHTINGDOJOCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_FIGHTINGDOJOCURSCRIPT], a
	ret
; 0x5cd70

INCBIN "baserom.gbc",$5cd70,$5cd7b - $5cd70

Unknown_5cd7b: ; 5cd7b (17:4d7b)
INCBIN "baserom.gbc",$5cd7b,$5ce03 - $5cd7b

FightingDojoTexts: ; 5ce03 (17:4e03)
	dw FightingDojoText1, FightingDojoText2, FightingDojoText3, FightingDojoText4, FightingDojoText5, FightingDojoText6, FightingDojoText7, FightingDojoText8

FightingDojoTrainerHeaders: ; 5ce13 (17:4e13)
FightingDojoTrainerHeader0: ; 5ce13 (17:4e13)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7b1 ; flag's byte
	dw FightingDojoBattleText1 ; 0x4eac TextBeforeBattle
	dw FightingDojoAfterBattleText1 ; 0x4eb6 TextAfterBattle
	dw FightingDojoEndBattleText1 ; 0x4eb1 TextEndBattle
	dw FightingDojoEndBattleText1 ; 0x4eb1 TextEndBattle
; 0x5ce1f

FightingDojoTrainerHeader1: ; 5ce1f (17:4e1f)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7b1 ; flag's byte
	dw FightingDojoBattleText2 ; 0x4ec5 TextBeforeBattle
	dw FightingDojoAfterBattleText2 ; 0x4ecf TextAfterBattle
	dw FightingDojoEndBattleText2 ; 0x4eca TextEndBattle
	dw FightingDojoEndBattleText2 ; 0x4eca TextEndBattle
; 0x5ce2b

FightingDojoTrainerHeader2: ; 5ce2b (17:4e2b)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7b1 ; flag's byte
	dw FightingDojoBattleText3 ; 0x4ede TextBeforeBattle
	dw FightingDojoAfterBattleText3 ; 0x4ee8 TextAfterBattle
	dw FightingDojoEndBattleText3 ; 0x4ee3 TextEndBattle
	dw FightingDojoEndBattleText3 ; 0x4ee3 TextEndBattle
; 0x5ce37

FightingDojoTrainerHeader3: ; 5ce37 (17:4e37)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7b1 ; flag's byte
	dw FightingDojoBattleText4 ; 0x4ef7 TextBeforeBattle
	dw FightingDojoAfterBattleText4 ; 0x4f01 TextAfterBattle
	dw FightingDojoEndBattleText4 ; 0x4efc TextEndBattle
	dw FightingDojoEndBattleText4 ; 0x4efc TextEndBattle
; 0x5ce43

db $ff

FightingDojoText1: ; 5ce44 (17:4e44)
	db $08 ; asm
	ld a, [$d7b1]
	bit 0, a
	jp nz, .continue1
	bit 1, a
	jp nz, .continue2
	ld hl, UnnamedText_5ce8e
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_5ce93
	ld de, UnnamedText_5ce93
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $3
	ld [W_FIGHTINGDOJOCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	jr .asm_9dba4 ; 0x5ce7b
.continue1 ; 0x5ce7d
	ld hl, UnnamedText_5ce9d
	call PrintText
	jr .asm_9dba4 ; 0x5ce83
.continue2 ; 0x5ce85f
	ld hl, FightingDojoText8
	call PrintText
.asm_9dba4 ; 0x5ce8b
	jp TextScriptEnd

UnnamedText_5ce8e: ; 5ce8e (17:4e8e)
	TX_FAR _UnnamedText_5ce8e
	db $50
; 0x5ce8e + 5 bytes

UnnamedText_5ce93: ; 5ce93 (17:4e93)
	TX_FAR _UnnamedText_5ce93
	db $50
; 0x5ce93 + 5 bytes

FightingDojoText8: ; 5ce98 (17:4e98)
	TX_FAR _UnnamedText_5ce98
	db $50
; 0x5ce98 + 5 bytes

UnnamedText_5ce9d: ; 5ce9d (17:4e9d)
	TX_FAR _UnnamedText_5ce9d
	db $50
; 0x5ce9d + 5 bytes

FightingDojoText2: ; 5cea2 (17:4ea2)
	db $08 ; asm
	ld hl, FightingDojoTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

FightingDojoBattleText1: ; 5ceac (17:4eac)
	TX_FAR _FightingDojoBattleText1
	db $50
; 0x5ceac + 5 bytes

FightingDojoEndBattleText1: ; 5ceb1 (17:4eb1)
	TX_FAR _FightingDojoEndBattleText1
	db $50
; 0x5ceb1 + 5 bytes

FightingDojoAfterBattleText1: ; 5ceb6 (17:4eb6)
	TX_FAR _FightingDojoAfterBattleText1
	db $50
; 0x5ceb6 + 5 bytes

FightingDojoText3: ; 5cebb (17:4ebb)
	db $08 ; asm
	ld hl, FightingDojoTrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

FightingDojoBattleText2: ; 5cec5 (17:4ec5)
	TX_FAR _FightingDojoBattleText2
	db $50
; 0x5cec5 + 5 bytes

FightingDojoEndBattleText2: ; 5ceca (17:4eca)
	TX_FAR _FightingDojoEndBattleText2
	db $50
; 0x5ceca + 5 bytes

FightingDojoAfterBattleText2: ; 5cecf (17:4ecf)
	TX_FAR _FightingDojoAfterBattleText2
	db $50
; 0x5cecf + 5 bytes

FightingDojoText4: ; 5ced4 (17:4ed4)
	db $08 ; asm
	ld hl, FightingDojoTrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

FightingDojoBattleText3: ; 5cede (17:4ede)
	TX_FAR _FightingDojoBattleText3
	db $50
; 0x5cede + 5 bytes

FightingDojoEndBattleText3: ; 5cee3 (17:4ee3)
	TX_FAR _FightingDojoEndBattleText3
	db $50
; 0x5cee3 + 5 bytes

FightingDojoAfterBattleText3: ; 5cee8 (17:4ee8)
	TX_FAR _FightingDojoAfterBattleText3
	db $50
; 0x5cee8 + 5 bytes

FightingDojoText5: ; 5ceed (17:4eed)
	db $08 ; asm
	ld hl, FightingDojoTrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

FightingDojoBattleText4: ; 5cef7 (17:4ef7)
	TX_FAR _FightingDojoBattleText4
	db $50
; 0x5cef7 + 5 bytes

FightingDojoEndBattleText4: ; 5cefc (17:4efc)
	TX_FAR _FightingDojoEndBattleText4
	db $50
; 0x5cefc + 5 bytes

FightingDojoAfterBattleText4: ; 5cf01 (17:4f01)
	TX_FAR _FightingDojoAfterBattleText4
	db $50
; 0x5cf01 + 5 bytes

FightingDojoText6: ; 5cf06 (17:4f06)
; Hitmonlee Poké Ball
	db $08 ; asm
	ld a, [$d7b1]
	and %11000000
	jr z, .GetMon
	ld hl, OtherHitmonText
	call PrintText
	jr .done
.GetMon
	ld a, HITMONLEE
	call DisplayPokedex
	ld hl, WantHitmonleeText
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .done
	ld a, [$cf91]
	ld b, a
	ld c, 30
	call GivePokemon
	jr nc, .done

	; once Poké Ball is taken, hide sprite
	ld a, $4a
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld hl, $d7b1
	set 6, [hl]
	set 0, [hl]
.done
	jp TextScriptEnd

WantHitmonleeText: ; 5cf49 (17:4f49)
	TX_FAR _WantHitmonleeText
	db $50
; 0x5cf49 + 5 bytes

FightingDojoText7: ; 5cf4e (17:4f4e)
; Hitmonchan Poké Ball
	db $08 ; asm
	ld a, [$d7b1]
	and %11000000
	jr z, .GetMon
	ld hl, OtherHitmonText
	call PrintText
	jr .done
.GetMon
	ld a, HITMONCHAN
	call DisplayPokedex
	ld hl, WantHitmonchanText
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .done
	ld a, [$cf91]
	ld b, a
	ld c,30
	call GivePokemon
	jr nc, .done
	ld hl, $d7b1
	set 7, [hl]
	set 0, [hl]

	; once Poké Ball is taken, hide sprite
	ld a, $4b
	ld [$cc4d], a
	ld a, $11
	call Predef
.done
	jp TextScriptEnd

WantHitmonchanText: ; 5cf91 (17:4f91)
	TX_FAR _WantHitmonchanText
	db $50
; 0x5cf91 + 5 bytes

OtherHitmonText: ; 5cf96 (17:4f96)
	TX_FAR _OtherHitmonText
	db $50
; 0x5cf96 + 5 bytes

FightingDojoObject: ; 0x5cf9b (size=72)
	db $3 ; border tile

	db $2 ; warps
	db $b, $4, $1, $ff
	db $b, $5, $1, $ff

	db $0 ; signs

	db $7 ; people
	db SPRITE_HIKER, $3 + 4, $5 + 4, $ff, $d0, $41, BLACKBELT + $C8, $1 ; trainer
	db SPRITE_HIKER, $4 + 4, $3 + 4, $ff, $d3, $42, BLACKBELT + $C8, $2 ; trainer
	db SPRITE_HIKER, $6 + 4, $3 + 4, $ff, $d3, $43, BLACKBELT + $C8, $3 ; trainer
	db SPRITE_HIKER, $5 + 4, $5 + 4, $ff, $d2, $44, BLACKBELT + $C8, $4 ; trainer
	db SPRITE_HIKER, $7 + 4, $5 + 4, $ff, $d2, $45, BLACKBELT + $C8, $5 ; trainer
	db SPRITE_BALL, $1 + 4, $4 + 4, $ff, $ff, $6 ; person
	db SPRITE_BALL, $1 + 4, $5 + 4, $ff, $ff, $7 ; person

	; warp-to
	EVENT_DISP $5, $b, $4
	EVENT_DISP $5, $b, $5

FightingDojoBlocks: ; 5cfe3 (17:4fe3)
	INCBIN "maps/fightingdojo.blk"

SaffronGym_h: ; 0x5d001 to 0x5d00d (12 bytes) (id=178)
	db $16 ; tileset
	db SAFFRON_GYM_HEIGHT, SAFFRON_GYM_WIDTH ; dimensions (y, x)
	dw SaffronGymBlocks, SaffronGymTexts, SaffronGymScript ; blocks, texts, scripts
	db $00 ; connections

	dw SaffronGymObject ; objects

SaffronGymScript: ; 5d00d (17:500d)
	ld hl, $d126
	bit 6, [hl]
	res 6, [hl]
	call nz, .extra
	call EnableAutoTextBoxDrawing
	ld hl, SaffronGymTrainerHeader0 ; $50c3
	ld de, Unknown_5d053 ; $5053
	ld a, [W_SAFFRONGYMCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SAFFRONGYMCURSCRIPT], a
	ret
; 0x5d02a
.extra
	ld hl, Unknown_5d033 ; $5033
	ld de, Unknown_5d040 ; $5040
	jp LoadGymLeaderAndCityName

Unknown_5d033: ; 5d033 (17:5033)
INCBIN "baserom.gbc",$5d033,$5d040 - $5d033

Unknown_5d040: ; 5d040 (17:5040)
INCBIN "baserom.gbc",$5d040,$5d048 - $5d040

; known jump sources: 5d060 (17:5060), 5d0a8 (17:50a8)
Func_5d048: ; 5d048 (17:5048)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_SAFFRONGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_5d053: ; 5d053 (17:5053)
INCBIN "baserom.gbc",$5d053,$5d05b - $5d053
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_5d048
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a

; known jump sources: 5d124 (17:5124)
Func_5d068: ; 5d068 (17:5068)
	ld a, $a
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d7b3
	set 1, [hl]
	ld bc, (TM_46 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a, $b
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d7b3
	set 0, [hl]
	jr .asm_5d091
.BagFull
	ld a, $c
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
.asm_5d091
	ld hl, W_OBTAINEDBADGES ; $d356
	set 5, [hl]
	ld hl, $d72a
	set 5, [hl]
	ld a, [$d7b3]
	or $fc
	ld [$d7b3], a
	ld hl, $d7b4
	set 0, [hl]
	jp Func_5d048
; 5d0ab (17:50ab)
SaffronGymTexts: ; 5d0ab (17:50ab)
	dw SaffronGymText1, SaffronGymText2, SaffronGymText3, SaffronGymText4, SaffronGymText5, SaffronGymText6, SaffronGymText7, SaffronGymText8, SaffronGymText9, SaffronGymText10, SaffronGymText11, SaffronGymText12

SaffronGymTrainerHeaders: ; 5d0c3 (17:50c3)
SaffronGymTrainerHeader0: ; 5d0c3 (17:50c3)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7b3 ; flag's byte
	dw SaffronGymBattleText1 ; 0x51f0 TextBeforeBattle
	dw SaffronGymAfterBattleText1 ; 0x51fa TextAfterBattle
	dw SaffronGymEndBattleText1 ; 0x51f5 TextEndBattle
	dw SaffronGymEndBattleText1 ; 0x51f5 TextEndBattle
; 0x5d0cf

SaffronGymTrainerHeader1: ; 5d0cf (17:50cf)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7b3 ; flag's byte
	dw SaffronGymBattleText2 ; 0x51ff TextBeforeBattle
	dw SaffronGymAfterBattleText2 ; 0x5209 TextAfterBattle
	dw SaffronGymEndBattleText2 ; 0x5204 TextEndBattle
	dw SaffronGymEndBattleText2 ; 0x5204 TextEndBattle
; 0x5d0db

SaffronGymTrainerHeader2: ; 5d0db (17:50db)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7b3 ; flag's byte
	dw SaffronGymBattleText3 ; 0x520e TextBeforeBattle
	dw SaffronGymAfterBattleText3 ; 0x5218 TextAfterBattle
	dw SaffronGymEndBattleText3 ; 0x5213 TextEndBattle
	dw SaffronGymEndBattleText3 ; 0x5213 TextEndBattle
; 0x5d0e7

SaffronGymTrainerHeader3: ; 5d0e7 (17:50e7)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7b3 ; flag's byte
	dw SaffronGymBattleText4 ; 0x521d TextBeforeBattle
	dw SaffronGymAfterBattleText4 ; 0x5227 TextAfterBattle
	dw SaffronGymEndBattleText4 ; 0x5222 TextEndBattle
	dw SaffronGymEndBattleText4 ; 0x5222 TextEndBattle
; 0x5d0f3

SaffronGymTrainerHeader4: ; 5d0f3 (17:50f3)
	db $6 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7b3 ; flag's byte
	dw SaffronGymBattleText5 ; 0x522c TextBeforeBattle
	dw SaffronGymAfterBattleText5 ; 0x5236 TextAfterBattle
	dw SaffronGymEndBattleText5 ; 0x5231 TextEndBattle
	dw SaffronGymEndBattleText5 ; 0x5231 TextEndBattle
; 0x5d0ff

SaffronGymTrainerHeader5: ; 5d0ff (17:50ff)
	db $7 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7b3 ; flag's byte
	dw SaffronGymBattleText6 ; 0x523b TextBeforeBattle
	dw SaffronGymAfterBattleText6 ; 0x5245 TextAfterBattle
	dw SaffronGymEndBattleText6 ; 0x5240 TextEndBattle
	dw SaffronGymEndBattleText6 ; 0x5240 TextEndBattle
; 0x5d10b

SaffronGymTrainerHeader6: ; 5d10b (17:510b)
	db $8 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7b3 ; flag's byte
	dw SaffronGymBattleText7 ; 0x524a TextBeforeBattle
	dw SaffronGymAfterBattleText7 ; 0x5254 TextAfterBattle
	dw SaffronGymEndBattleText7 ; 0x524f TextEndBattle
	dw SaffronGymEndBattleText7 ; 0x524f TextEndBattle
; 0x5d117

db $ff

SaffronGymText1: ; 5d118 (17:5118)
	db $08 ; asm
	ld a, [$d7b3]
	bit 1, a
	jr z, .asm_e3544 ; 0x5d11e
	bit 0, a
	jr nz, .asm_8d2f6 ; 0x5d122
	call z, Func_5d068
	call DisableWaitingAfterTextDisplay
	jr .asm_34c2c ; 0x5d12a
.asm_8d2f6 ; 0x5d12c
	ld hl, UnnamedText_5d16e
	call PrintText
	jr .asm_34c2c ; 0x5d132
.asm_e3544 ; 0x5d134
	ld hl, UnnamedText_5d162
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_5d167
	ld de, UnnamedText_5d167
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $6
	ld [$d05c], a
	ld a, $3
	ld [W_SAFFRONGYMCURSCRIPT], a
.asm_34c2c ; 0x5d15f
	jp TextScriptEnd

UnnamedText_5d162: ; 5d162 (17:5162)
	TX_FAR _UnnamedText_5d162
	db $50
; 0x5d162 + 5 bytes

UnnamedText_5d167: ; 5d167 (17:5167)
	TX_FAR _UnnamedText_5d167 ; 0xa1c73
	db $11 ; play same sound as red giving oak parcel
	db $6 ; wait for keypress
	db $50
; 0x5d16e

UnnamedText_5d16e: ; 5d16e (17:516e)
	TX_FAR _UnnamedText_5d16e
	db $50
; 0x5d16e + 5 bytes

SaffronGymText10: ; 5d173 (17:5173)
	TX_FAR _UnnamedText_5d173
	db $50
; 0x5d173 + 5 bytes

SaffronGymText11: ; 5d178 (17:5178)
	TX_FAR ReceivedTM46Text
	db $b
	TX_FAR _TM46ExplanationText
	db $50

SaffronGymText12: ; 5d182 (17:5182)
	TX_FAR _TM46NoRoomText ; pack full
	db $50
; 0x5d182 + 5 bytes

SaffronGymText2: ; 5d187 (17:5187)
	db $08 ; asm
	ld hl, SaffronGymTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SaffronGymText3: ; 5d191 (17:5191)
	db $08 ; asm
	ld hl, SaffronGymTrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SaffronGymText4: ; 5d19b (17:519b)
	db $08 ; asm
	ld hl, SaffronGymTrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SaffronGymText5: ; 5d1a5 (17:51a5)
	db $08 ; asm
	ld hl, SaffronGymTrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

SaffronGymText6: ; 5d1af (17:51af)
	db $08 ; asm
	ld hl, SaffronGymTrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

SaffronGymText7: ; 5d1b9 (17:51b9)
	db $08 ; asm
	ld hl, SaffronGymTrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

SaffronGymText8: ; 5d1c3 (17:51c3)
	db $08 ; asm
	ld hl, SaffronGymTrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

SaffronGymText9: ; 5d1cd (17:51cd)
	db $08 ; asm
	ld a, [$d7b3]
	bit 1, a
	jr nz, .asm_13f3c ; 0x5d1d3
	ld hl, UnnamedText_5d1e6
	call PrintText
	jr .asm_e9907 ; 0x5d1db
.asm_13f3c ; 0x5d1dd
	ld hl, UnnamedText_5d1eb
	call PrintText
.asm_e9907 ; 0x5d1e3
	jp TextScriptEnd

UnnamedText_5d1e6: ; 5d1e6 (17:51e6)
	TX_FAR _UnnamedText_5d1e6
	db $50
; 0x5d1e6 + 5 bytes

UnnamedText_5d1eb: ; 5d1eb (17:51eb)
	TX_FAR _UnnamedText_5d1eb
	db $50
; 0x5d1eb + 5 bytes

SaffronGymBattleText1: ; 5d1f0 (17:51f0)
	TX_FAR _SaffronGymBattleText1
	db $50
; 0x5d1f0 + 5 bytes

SaffronGymEndBattleText1: ; 5d1f5 (17:51f5)
	TX_FAR _SaffronGymEndBattleText1
	db $50
; 0x5d1f5 + 5 bytes

SaffronGymAfterBattleText1: ; 5d1fa (17:51fa)
	TX_FAR _SaffronGymAfterBattleText1
	db $50
; 0x5d1fa + 5 bytes

SaffronGymBattleText2: ; 5d1ff (17:51ff)
	TX_FAR _SaffronGymBattleText2
	db $50
; 0x5d1ff + 5 bytes

SaffronGymEndBattleText2: ; 5d204 (17:5204)
	TX_FAR _SaffronGymEndBattleText2
	db $50
; 0x5d204 + 5 bytes

SaffronGymAfterBattleText2: ; 5d209 (17:5209)
	TX_FAR _SaffronGymAfterBattleText2
	db $50
; 0x5d209 + 5 bytes

SaffronGymBattleText3: ; 5d20e (17:520e)
	TX_FAR _SaffronGymBattleText3
	db $50
; 0x5d20e + 5 bytes

SaffronGymEndBattleText3: ; 5d213 (17:5213)
	TX_FAR _SaffronGymEndBattleText3
	db $50
; 0x5d213 + 5 bytes

SaffronGymAfterBattleText3: ; 5d218 (17:5218)
	TX_FAR _SaffronGymAfterBattleText3
	db $50
; 0x5d218 + 5 bytes

SaffronGymBattleText4: ; 5d21d (17:521d)
	TX_FAR _SaffronGymBattleText4
	db $50
; 0x5d21d + 5 bytes

SaffronGymEndBattleText4: ; 5d222 (17:5222)
	TX_FAR _SaffronGymEndBattleText4
	db $50
; 0x5d222 + 5 bytes

SaffronGymAfterBattleText4: ; 5d227 (17:5227)
	TX_FAR _SaffronGymAfterBattleText4
	db $50
; 0x5d227 + 5 bytes

SaffronGymBattleText5: ; 5d22c (17:522c)
	TX_FAR _SaffronGymBattleText5
	db $50
; 0x5d22c + 5 bytes

SaffronGymEndBattleText5: ; 5d231 (17:5231)
	TX_FAR _SaffronGymEndBattleText5
	db $50
; 0x5d231 + 5 bytes

SaffronGymAfterBattleText5: ; 5d236 (17:5236)
	TX_FAR _SaffronGymAfterBattleText5
	db $50
; 0x5d236 + 5 bytes

SaffronGymBattleText6: ; 5d23b (17:523b)
	TX_FAR _SaffronGymBattleText6
	db $50
; 0x5d23b + 5 bytes

SaffronGymEndBattleText6: ; 5d240 (17:5240)
	TX_FAR _SaffronGymEndBattleText6
	db $50
; 0x5d240 + 5 bytes

SaffronGymAfterBattleText6: ; 5d245 (17:5245)
	TX_FAR _SaffronGymAfterBattleText6
	db $50
; 0x5d245 + 5 bytes

SaffronGymBattleText7: ; 5d24a (17:524a)
	TX_FAR _SaffronGymBattleText7
	db $50
; 0x5d24a + 5 bytes

SaffronGymEndBattleText7: ; 5d24f (17:524f)
	TX_FAR _SaffronGymEndBattleText7
	db $50
; 0x5d24f + 5 bytes

SaffronGymAfterBattleText7: ; 5d254 (17:5254)
	TX_FAR _SaffronGymAfterBattleText7
	db $50
; 0x5d254 + 5 bytes

SaffronGymObject: ; 0x5d259 (size=330)
	db $2e ; border tile

	db $20 ; warps
	db $11, $8, $2, $ff
	db $11, $9, $2, $ff
	db $3, $1, $16, SAFFRON_GYM
	db $3, $5, $f, SAFFRON_GYM
	db $5, $1, $12, SAFFRON_GYM
	db $5, $5, $8, SAFFRON_GYM
	db $9, $1, $1b, SAFFRON_GYM
	db $9, $5, $10, SAFFRON_GYM
	db $b, $1, $5, SAFFRON_GYM
	db $b, $5, $d, SAFFRON_GYM
	db $f, $1, $17, SAFFRON_GYM
	db $f, $5, $1e, SAFFRON_GYM
	db $11, $1, $11, SAFFRON_GYM
	db $11, $5, $9, SAFFRON_GYM
	db $3, $9, $1a, SAFFRON_GYM
	db $3, $b, $3, SAFFRON_GYM
	db $5, $9, $7, SAFFRON_GYM
	db $5, $b, $c, SAFFRON_GYM
	db $b, $b, $4, SAFFRON_GYM
	db $f, $b, $1f, SAFFRON_GYM
	db $3, $f, $18, SAFFRON_GYM
	db $3, $13, $1c, SAFFRON_GYM
	db $5, $f, $2, SAFFRON_GYM
	db $5, $13, $a, SAFFRON_GYM
	db $9, $f, $14, SAFFRON_GYM
	db $9, $13, $1d, SAFFRON_GYM
	db $b, $f, $e, SAFFRON_GYM
	db $b, $13, $6, SAFFRON_GYM
	db $f, $f, $15, SAFFRON_GYM
	db $f, $13, $19, SAFFRON_GYM
	db $11, $f, $b, SAFFRON_GYM
	db $11, $13, $13, SAFFRON_GYM

	db $0 ; signs

	db $9 ; people
	db SPRITE_GIRL, $8 + 4, $9 + 4, $ff, $d0, $41, SABRINA + $C8, $1 ; trainer
	db SPRITE_MEDIUM, $1 + 4, $a + 4, $ff, $d0, $42, CHANNELER + $C8, $16 ; trainer
	db SPRITE_BUG_CATCHER, $1 + 4, $11 + 4, $ff, $d0, $43, PSYCHIC_TR + $C8, $1 ; trainer
	db SPRITE_MEDIUM, $7 + 4, $3 + 4, $ff, $d0, $44, CHANNELER + $C8, $17 ; trainer
	db SPRITE_BUG_CATCHER, $7 + 4, $11 + 4, $ff, $d0, $45, PSYCHIC_TR + $C8, $2 ; trainer
	db SPRITE_MEDIUM, $d + 4, $3 + 4, $ff, $d0, $46, CHANNELER + $C8, $18 ; trainer
	db SPRITE_BUG_CATCHER, $d + 4, $11 + 4, $ff, $d0, $47, PSYCHIC_TR + $C8, $3 ; trainer
	db SPRITE_BUG_CATCHER, $1 + 4, $3 + 4, $ff, $d0, $48, PSYCHIC_TR + $C8, $4 ; trainer
	db SPRITE_GYM_HELPER, $f + 4, $a + 4, $ff, $d0, $9 ; person

	; warp-to
	EVENT_DISP $a, $11, $8
	EVENT_DISP $a, $11, $9
	EVENT_DISP $a, $3, $1 ; SAFFRON_GYM
	EVENT_DISP $a, $3, $5 ; SAFFRON_GYM
	EVENT_DISP $a, $5, $1 ; SAFFRON_GYM
	EVENT_DISP $a, $5, $5 ; SAFFRON_GYM
	EVENT_DISP $a, $9, $1 ; SAFFRON_GYM
	EVENT_DISP $a, $9, $5 ; SAFFRON_GYM
	EVENT_DISP $a, $b, $1 ; SAFFRON_GYM
	EVENT_DISP $a, $b, $5 ; SAFFRON_GYM
	EVENT_DISP $a, $f, $1 ; SAFFRON_GYM
	EVENT_DISP $a, $f, $5 ; SAFFRON_GYM
	EVENT_DISP $a, $11, $1 ; SAFFRON_GYM
	EVENT_DISP $a, $11, $5 ; SAFFRON_GYM
	EVENT_DISP $a, $3, $9 ; SAFFRON_GYM
	EVENT_DISP $a, $3, $b ; SAFFRON_GYM
	EVENT_DISP $a, $5, $9 ; SAFFRON_GYM
	EVENT_DISP $a, $5, $b ; SAFFRON_GYM
	EVENT_DISP $a, $b, $b ; SAFFRON_GYM
	EVENT_DISP $a, $f, $b ; SAFFRON_GYM
	EVENT_DISP $a, $3, $f ; SAFFRON_GYM
	EVENT_DISP $a, $3, $13 ; SAFFRON_GYM
	EVENT_DISP $a, $5, $f ; SAFFRON_GYM
	EVENT_DISP $a, $5, $13 ; SAFFRON_GYM
	EVENT_DISP $a, $9, $f ; SAFFRON_GYM
	EVENT_DISP $a, $9, $13 ; SAFFRON_GYM
	EVENT_DISP $a, $b, $f ; SAFFRON_GYM
	EVENT_DISP $a, $b, $13 ; SAFFRON_GYM
	EVENT_DISP $a, $f, $f ; SAFFRON_GYM
	EVENT_DISP $a, $f, $13 ; SAFFRON_GYM
	EVENT_DISP $a, $11, $f ; SAFFRON_GYM
	EVENT_DISP $a, $11, $13 ; SAFFRON_GYM

SaffronGymBlocks: ; 5d3a3 (17:53a3)
	INCBIN "maps/saffrongym.blk"

SaffronMart_h: ; 0x5d3fd to 0x5d409 (12 bytes) (id=180)
	db $02 ; tileset
	db SAFFRON_MART_HEIGHT, SAFFRON_MART_WIDTH ; dimensions (y, x)
	dw SaffronMartBlocks, SaffronMartTexts, SaffronMartScript ; blocks, texts, scripts
	db $00 ; connections

	dw SaffronMartObject ; objects

SaffronMartScript: ; 5d409 (17:5409)
	jp EnableAutoTextBoxDrawing
; 0x5d40c

SaffronMartTexts: ; 5d40c (17:540c)
	dw SaffronMartText1, SaffronMartText2, SaffronMartText3

SaffronMartText2: ; 5d412 (17:5412)
	TX_FAR _SaffronMartText2
	db $50

SaffronMartText3: ; 5d417 (17:5417)
	TX_FAR _SaffronMartText3
	db $50

SaffronMartObject: ; 0x5d41c (size=38)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $4, $ff
	db $7, $4, $4, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_MART_GUY, $5 + 4, $0 + 4, $ff, $d3, $1 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $2 + 4, $4 + 4, $ff, $ff, $2 ; person
	db SPRITE_LASS, $5 + 4, $6 + 4, $fe, $0, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4

SilphCo1_h: ; 0x5d442 to 0x5d44e (12 bytes) (id=181)
	db $16 ; tileset
	db SILPH_CO_1F_HEIGHT, SILPH_CO_1F_WIDTH ; dimensions (y, x)
	dw SilphCo1Blocks, SilphCo1Texts, SilphCo1Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo1Object ; objects

SilphCo1Script: ; 5d44e (17:544e)
	call EnableAutoTextBoxDrawing
	ld a, [$d838]
	bit 7, a
	ret z
	ld hl, $d7b9
	bit 7, [hl]
	set 7, [hl]
	ret nz
	ld a, $4c
	ld [$cc4d], a
	ld a, $15
	jp Predef
; 0x5d469

SilphCo1Texts: ; 5d469 (17:5469)
	dw SilphCo1Text1

SilphCo1Text1: ; 5d46b (17:546b)
	TX_FAR _SilphCo1Text1
	db $50

SilphCo1Object: ; 0x5d470 (size=50)
	db $2e ; border tile

	db $5 ; warps
	db $11, $a, $5, $ff
	db $11, $b, $5, $ff
	db $0, $1a, $0, SILPH_CO_2F
	db $0, $14, $0, SILPH_CO_ELEVATOR
	db $a, $10, $6, SILPH_CO_3F

	db $0 ; signs

	db $1 ; people
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $4 + 4, $ff, $d0, $1 ; person

	; warp-to
	EVENT_DISP $f, $11, $a
	EVENT_DISP $f, $11, $b
	EVENT_DISP $f, $0, $1a ; SILPH_CO_2F
	EVENT_DISP $f, $0, $14 ; SILPH_CO_ELEVATOR
	EVENT_DISP $f, $a, $10 ; SILPH_CO_3F

SilphCo1Blocks: ; 5d4a2 (17:54a2)
	INCBIN "maps/silphco1.blk"

SaffronPokecenter_h: ; 0x5d529 to 0x5d535 (12 bytes) (id=182)
	db $06 ; tileset
	db SAFFRON_POKECENTER_HEIGHT, SAFFRON_POKECENTER_WIDTH ; dimensions (y, x)
	dw SaffronPokecenterBlocks, SaffronPokecenterTexts, SaffronPokecenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw SaffronPokecenterObject ; objects

SaffronPokecenterScript: ; 5d535 (17:5535)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x5d53b

SaffronPokecenterTexts: ; 5d53b (17:553b)
	dw SaffronPokecenterText1, SaffronPokecenterText2, SaffronPokecenterText3, SaffronPokecenterText4

SaffronPokecenterText1: ; 5d543 (17:5543)
	db $ff

SaffronPokecenterText2: ; 5d544 (17:5544)
	TX_FAR _SaffronPokecenterText1
	db $50

SaffronPokecenterText3: ; 5d549 (17:5549)
	TX_FAR _SaffronPokecenterText3
	db $50

SaffronPokecenterText4: ; 5d54e (17:554e)
	db $f6

SaffronPokecenterObject: ; 0x5d54f (size=44)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $6, $ff
	db $7, $4, $6, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_FOULARD_WOMAN, $5 + 4, $5 + 4, $ff, $ff, $2 ; person
	db SPRITE_GENTLEMAN, $3 + 4, $8 + 4, $ff, $d0, $3 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

ViridianForestexit_h: ; 0x5d57b to 0x5d587 (12 bytes) (id=47)
	db $09 ; tileset
	db VIRIDIAN_FOREST_EXIT_HEIGHT, VIRIDIAN_FOREST_EXIT_WIDTH ; dimensions (y, x)
	dw ViridianForestexitBlocks, ViridianForestexitTexts, ViridianForestexitScript ; blocks, texts, scripts
	db $00 ; connections

	dw ViridianForestexitObject ; objects

ViridianForestexitScript: ; 5d587 (17:5587)
	jp EnableAutoTextBoxDrawing
; 0x5d58a

ViridianForestexitTexts: ; 5d58a (17:558a)
	dw ViridianForestexitText1, ViridianForestexitText2

ViridianForestexitText1: ; 5d58e (17:558e)
	TX_FAR _ViridianForestexitText1
	db $50

ViridianForestexitText2: ; 5d593 (17:5593)
	TX_FAR _ViridianForestexitText2
	db $50

ViridianForestexitObject: ; 0x5d598 (size=48)
	db $a ; border tile

	db $4 ; warps
	db $0, $4, $1, $ff
	db $0, $5, $1, $ff
	db $7, $4, $0, VIRIDIAN_FOREST
	db $7, $5, $0, VIRIDIAN_FOREST

	db $0 ; signs

	db $2 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $2 + 4, $3 + 4, $ff, $ff, $1 ; person
	db SPRITE_OLD_PERSON, $5 + 4, $2 + 4, $ff, $ff, $2 ; person

	; warp-to
	EVENT_DISP $5, $0, $4
	EVENT_DISP $5, $0, $5
	EVENT_DISP $5, $7, $4 ; VIRIDIAN_FOREST
	EVENT_DISP $5, $7, $5 ; VIRIDIAN_FOREST

Route2Gate_h: ; 0x5d5c8 to 0x5d5d4 (12 bytes) (id=49)
	db $0c ; tileset
	db ROUTE_2_GATE_HEIGHT, ROUTE_2_GATE_WIDTH ; dimensions (y, x)
	dw Route2GateBlocks, Route2GateTexts, Route2GateScript ; blocks, texts, scripts
	db $00 ; connections

	dw Route2GateObject ; objects

Route2GateScript: ; 5d5d4 (17:55d4)
	jp EnableAutoTextBoxDrawing
; 0x5d5d7

Route2GateTexts: ; 5d5d7 (17:55d7)
	dw Route2GateText1, Route2GateText2

Route2GateText1: ; 5d5db (17:55db)
	db $08 ; asm
	ld a, [$d7c2]
	bit 0, a
	jr nz, .asm_6592c ; 0x5d5e1
	ld a, $a
	ldh [$db], a
	ld a, $c8
	ldh [$dc], a
	ld [$d11e], a
	call GetItemName ; $2fcf
	ld hl, $cd6d
	ld de, $cc5b
	ld bc, $000d
	call CopyData
	ld a, $62
	call Predef
	ldh a, [$db]
	cp $1
	jr nz, .asm_ad646 ; 0x5d606
	ld hl, $d7c2
	set 0, [hl]
.asm_6592c ; 0x5d60d
	ld hl, UnnamedText_5d616
	call PrintText
.asm_ad646 ; 0x5d613
	jp TextScriptEnd

UnnamedText_5d616: ; 5d616 (17:5616)
	TX_FAR _UnnamedText_5d616
	db $50
; 0x5d616 + 5 bytes

Route2GateText2: ; 5d61b (17:561b)
	TX_FAR _Route2GateText2
	db $50

Route2GateObject: ; 0x5d620 (size=48)
	db $a ; border tile

	db $4 ; warps
	db $0, $4, $3, $ff
	db $0, $5, $3, $ff
	db $7, $4, $4, $ff
	db $7, $5, $4, $ff

	db $0 ; signs

	db $2 ; people
	db SPRITE_OAK_AIDE, $4 + 4, $1 + 4, $ff, $d2, $1 ; person
	db SPRITE_BUG_CATCHER, $4 + 4, $5 + 4, $fe, $2, $2 ; person

	; warp-to
	EVENT_DISP $5, $0, $4
	EVENT_DISP $5, $0, $5
	EVENT_DISP $5, $7, $4
	EVENT_DISP $5, $7, $5

ViridianForestEntrance_h: ; 0x5d650 to 0x5d65c (12 bytes) (id=50)
	db $09 ; tileset
	db VIRIDIAN_FOREST_ENTRANCE_HEIGHT, VIRIDIAN_FOREST_ENTRANCE_WIDTH ; dimensions (y, x)
	dw ViridianForestEntranceBlocks, ViridianForestEntranceTexts, ViridianForestEntranceScript ; blocks, texts, scripts
	db $00 ; connections

	dw ViridianForestEntranceObject ; objects

ViridianForestEntranceScript: ; 5d65c (17:565c)
	jp EnableAutoTextBoxDrawing
; 0x5d65f

ViridianForestEntranceTexts: ; 5d65f (17:565f)
	dw ViridianForestEntranceText1, ViridianForestEntranceText2

ViridianForestEntranceText1: ; 5d663 (17:5663)
	TX_FAR _ViridianForestEntranceText1
	db $50

ViridianForestEntranceText2: ; 5d668 (17:5668)
	TX_FAR _ViridianForestEntranceText2
	db $50

ViridianForestEntranceObject: ; 0x5d66d (size=48)
	db $a ; border tile

	db $4 ; warps
	db $0, $4, $3, VIRIDIAN_FOREST
	db $0, $5, $4, VIRIDIAN_FOREST
	db $7, $4, $5, $ff
	db $7, $5, $5, $ff

	db $0 ; signs

	db $2 ; people
	db SPRITE_GIRL, $4 + 4, $8 + 4, $ff, $d2, $1 ; person
	db SPRITE_LITTLE_GIRL, $4 + 4, $2 + 4, $fe, $1, $2 ; person

	; warp-to
	EVENT_DISP $5, $0, $4 ; VIRIDIAN_FOREST
	EVENT_DISP $5, $0, $5 ; VIRIDIAN_FOREST
	EVENT_DISP $5, $7, $4
	EVENT_DISP $5, $7, $5

UndergroundTunnelEntranceRoute5_h: ; 0x5d69d to 0x5d6a9 (12 bytes) (id=71)
	db $0c ; tileset
	db PATH_ENTRANCE_ROUTE_5_HEIGHT, PATH_ENTRANCE_ROUTE_5_WIDTH ; dimensions (y, x)
	dw UndergroundTunnelEntranceRoute5Blocks, UndergroundTunnelEntranceRoute5Texts, UndergroundTunnelEntranceRoute5Script ; blocks, texts, scripts
	db $00 ; connections

	dw UndergroundTunnelEntranceRoute5Object ; objects

UndergroundTunnelEntranceRoute5Script: ; 5d6a9 (17:56a9)
	ld a, $10
	ld [$d365], a
	ret
; 0x5d6af

UndergroundTunnelEntranceRoute5_5d6af: ; 5d6af (17:56af)
	db $50

UndergroundTunnelEntranceRoute5Texts: ; 5d6b0 (17:56b0)
	dw UndergroundTunnelEntranceRoute5Text1

UndergroundTunnelEntranceRoute5Text1: ; 5d6b2 (17:56b2)
	db $08 ; asm
	ld a, $9
	ld [W_WHICHTRADE], a
	ld a, $54
	call Predef
	ld hl, UndergroundTunnelEntranceRoute5_5d6af
	ret

UndergroundTunnelEntranceRoute5Object: ; 0x5d6c1 (size=34)
	db $a ; border tile

	db $3 ; warps
	db $7, $3, $3, $ff
	db $7, $4, $3, $ff
	db $4, $4, $0, UNDERGROUND_PATH_NS

	db $0 ; signs

	db $1 ; people
	db SPRITE_LITTLE_GIRL, $3 + 4, $2 + 4, $ff, $ff, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4
	EVENT_DISP $4, $4, $4 ; UNDERGROUND_PATH_NS

UndergroundTunnelEntranceRoute6_h: ; 0x5d6e3 to 0x5d6ef (12 bytes) (id=74)
	db $0c ; tileset
	db PATH_ENTRANCE_ROUTE_6_HEIGHT, PATH_ENTRANCE_ROUTE_6_WIDTH ; dimensions (y, x)
	dw UndergroundTunnelEntranceRoute6Blocks, UndergroundTunnelEntranceRoute6Texts, UndergroundTunnelEntranceRoute6Script ; blocks, texts, scripts
	db $00 ; connections

	dw UndergroundTunnelEntranceRoute6Object ; objects

UndergroundTunnelEntranceRoute6Script: ; 5d6ef (17:56ef)
	ld a, $11
	ld [$d365], a
	jp EnableAutoTextBoxDrawing
; 0x5d6f7

UndergroundTunnelEntranceRoute6Texts: ; 5d6f7 (17:56f7)
	dw UndergroundTunnelEntranceRoute6Text1

;XXX wtf? syntax error on TX_FAR?
UndergroundTunnelEntranceRoute6Text1: ; 5d6f9 (17:56f9)
	db $17, $cb, $40, $23
	;TX_FAR _UndergroundTunnelEntranceRoute6Text1 ; $cb, $40, $23
	db $50

UndergroundTunnelEntranceRoute6Object: ; 0x5d6fe (size=34)
	db $a ; border tile

	db $3 ; warps
	db $7, $3, $3, $ff
	db $7, $4, $3, $ff
	db $4, $4, $1, UNDERGROUND_PATH_NS

	db $0 ; signs

	db $1 ; people
	db SPRITE_GIRL, $3 + 4, $2 + 4, $ff, $ff, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4
	EVENT_DISP $4, $4, $4 ; UNDERGROUND_PATH_NS

UndergroundPathEntranceRoute7_h: ; 0x5d720 to 0x5d72c (12 bytes) (id=77)
	db $0c ; tileset
	db PATH_ENTRANCE_ROUTE_7_HEIGHT, PATH_ENTRANCE_ROUTE_7_WIDTH ; dimensions (y, x)
	dw UndergroundTunnelEntranceRoute7Blocks, UndergroundPathEntranceRoute7Texts, UndergroundPathEntranceRoute7Script ; blocks, texts, scripts
	db $00 ; connections

	dw UndergroundPathEntranceRoute7Object ; objects

UndergroundPathEntranceRoute7Script: ; 5d72c (17:572c)
	ld a, $12
	ld [$d365], a
	jp EnableAutoTextBoxDrawing
; 0x5d734

UndergroundPathEntranceRoute7Texts: ; 5d734 (17:5734)
	dw UndergroundPathEntranceRoute7Text1

UndergroundPathEntranceRoute7Text1: ; 5d736 (17:5736)
	db $17, $ff, $40, $23
	;TX_FAR _UndergroundPathEntranceRoute7Text1
	db $50

UndergroundPathEntranceRoute7Object: ; 0x5d73b (size=34)
	db $a ; border tile

	db $3 ; warps
	db $7, $3, $4, $ff
	db $7, $4, $4, $ff
	db $4, $4, $0, UNDERGROUND_PATH_WE

	db $0 ; signs

	db $1 ; people
	db SPRITE_FAT_BALD_GUY, $4 + 4, $2 + 4, $ff, $ff, $1 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4
	EVENT_DISP $4, $4, $4 ; UNDERGROUND_PATH_WE

INCBIN "baserom.gbc",$5d75d,$5d773 - $5d75d

UnnamedText_5d773: ; 5d773 (17:5773)
	TX_FAR _UnnamedText_5d773
	db $50
; 0x5d773 + 5 bytes

UnnamedText_5d778: ; 5d778 (17:5778)
	TX_FAR _UnnamedText_5d778
	db $50
; 0x5d778 + 5 bytes

UnnamedText_5d77d: ; 5d77d (17:577d)
	TX_FAR _UnnamedText_5d77d
	db $50
; 0x5d77d + 5 bytes

UnnamedText_5d782: ; 5d782 (17:5782)
	TX_FAR _UnnamedText_5d782
	db $50
; 0x5d782 + 5 bytes

INCBIN "baserom.gbc",$5d787,$5d7af - $5d787

SilphCo9_h: ; 0x5d7af to 0x5d7bb (12 bytes) (id=233)
	db $16 ; tileset
	db SILPH_CO_9F_HEIGHT, SILPH_CO_9F_WIDTH ; dimensions (y, x)
	dw SilphCo9Blocks, SilphCo9Texts, SilphCo9Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo9Object ; objects

SilphCo9Script: ; 5d7bb (17:57bb)
	call SilphCo9Script_Unknown5d7d1
	call EnableAutoTextBoxDrawing
	ld hl, SilphCo9TrainerHeaders
	ld de, Unknown_5d885 ; $5885
	ld a, [W_SILPHCO9CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SILPHCO9CURSCRIPT], a
	ret
; 0x5d7d1

SilphCo9Script_Unknown5d7d1: ; 5d7d1 (17:57d1)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, Unknown_5d82e ; $582e
	call Func_5d837
	call Func_5d863
	ld a, [$d834]
	bit 0, a
	jr nz, .asm_5d7f8
	push af
	ld a, $5f
	ld [$d09f], a
	ld bc, $401
	ld a, $17
	call Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))
	pop af
.asm_5d7f8
	bit 1, a
	jr nz, .asm_5d80b
	push af
	ld a, $54
	ld [$d09f], a
	ld bc, $209
	ld a, $17
	call Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))
	pop af
.asm_5d80b
	bit 2, a
	jr nz, .asm_5d81e
	push af
	ld a, $54
	ld [$d09f], a
	ld bc, $509
	ld a, $17
	call Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))
	pop af
.asm_5d81e
	bit 3, a
	ret nz
	ld a, $5f
	ld [$d09f], a
	ld bc, $605
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

Unknown_5d82e: ; 5d82e (17:582e)
INCBIN "baserom.gbc",$5d82e,$5d837 - $5d82e

; known jump sources: 5d7dc (17:57dc)
Func_5d837: ; 5d837 (17:5837)
	push hl
	ld hl, $d73f
	ld a, [hli]
	ld b, a
	ld a, [hl]
	ld c, a
	xor a
	ld [$FF00+$e0], a
	pop hl
.asm_5d843
	ld a, [hli]
	cp $ff
	jr z, .asm_5d85f
	push hl
	ld hl, $ffe0
	inc [hl]
	pop hl
	cp b
	jr z, .asm_5d854
	inc hl
	jr .asm_5d843
.asm_5d854
	ld a, [hli]
	cp c
	jr nz, .asm_5d843
	ld hl, $d73f
	xor a
	ld [hli], a
	ld [hl], a
	ret
.asm_5d85f
	xor a
	ld [$FF00+$e0], a
	ret

; known jump sources: 5d7df (17:57df)
Func_5d863: ; 5d863 (17:5863)
	ld hl, $d834
	ld a, [$FF00+$e0]
	and a
	ret z
	cp $1
	jr nz, .asm_5d871
	set 0, [hl]
	ret
.asm_5d871
	cp $2
	jr nz, .asm_5d878
	set 1, [hl]
	ret
.asm_5d878
	cp $3
	jr nz, .asm_5d87f
	set 2, [hl]
	ret
.asm_5d87f
	cp $4
	ret nz
	set 3, [hl]
	ret

Unknown_5d885: ; 5d885 (17:5885)
INCBIN "baserom.gbc",$5d885,$5d88b - $5d885

SilphCo9Texts: ; 5d88b (17:588b)
	dw SilphCo9Text1, SilphCo9Text2, SilphCo9Text3, SilphCo9Text4

SilphCo9TrainerHeaders: ; 5d893 (17:5893)
SilphCo9TrainerHeader0: ; 5d893 (17:5893)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d833 ; flag's byte
	dw SilphCo9BattleText1 ; 0x5912 TextBeforeBattle
	dw SilphCo9AfterBattleText1 ; 0x591c TextAfterBattle
	dw SilphCo9EndBattleText1 ; 0x5917 TextEndBattle
	dw SilphCo9EndBattleText1 ; 0x5917 TextEndBattle
; 0x5d89f

SilphCo9TrainerHeader1: ; 5d89f (17:589f)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d833 ; flag's byte
	dw SilphCo9BattleText2 ; 0x5921 TextBeforeBattle
	dw SilphCo9AfterBattleText2 ; 0x592b TextAfterBattle
	dw SilphCo9EndBattleText2 ; 0x5926 TextEndBattle
	dw SilphCo9EndBattleText2 ; 0x5926 TextEndBattle
; 0x5d8ab

SilphCo9TrainerHeader2: ; 5d8ab (17:58ab)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d833 ; flag's byte
	dw SilphCo9BattleText3 ; 0x5930 TextBeforeBattle
	dw SilphCo9AfterBattleText3 ; 0x593a TextAfterBattle
	dw SilphCo9EndBattleText3 ; 0x5935 TextEndBattle
	dw SilphCo9EndBattleText3 ; 0x5935 TextEndBattle
; 0x5d8b7

db $ff

SilphCo9Text1: ; 5d8b8 (17:58b8)
	db $08 ; asm
	ld a, [$d838]
	bit 7, a
	jr nz, .asm_a14c3 ; 0x5d8be
	ld hl, UnnamedText_5d8e5
	call PrintText
	ld a, $7
	call Predef
	call GBFadeOut2
	call Delay3
	call GBFadeIn2
	ld hl, UnnamedText_5d8ea
	call PrintText
	jr .asm_b6e28 ; 0x5d8da
.asm_a14c3 ; 0x5d8dc
	ld hl, UnnamedText_5d8ef
	call PrintText
.asm_b6e28 ; 0x5d8e2
	jp TextScriptEnd

UnnamedText_5d8e5: ; 5d8e5 (17:58e5)
	TX_FAR _UnnamedText_5d8e5
	db $50
; 0x5d8e5 + 5 bytes

UnnamedText_5d8ea: ; 5d8ea (17:58ea)
	TX_FAR _UnnamedText_5d8ea
	db $50
; 0x5d8ea + 5 bytes

UnnamedText_5d8ef: ; 5d8ef (17:58ef)
	TX_FAR _UnnamedText_5d8ef
	db $50
; 0x5d8ef + 5 bytes

SilphCo9Text2: ; 5d8f4 (17:58f4)
	db $08 ; asm
	ld hl, SilphCo9TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SilphCo9Text3: ; 5d8fe (17:58fe)
	db $08 ; asm
	ld hl, SilphCo9TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SilphCo9Text4: ; 5d908 (17:5908)
	db $08 ; asm
	ld hl, SilphCo9TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SilphCo9BattleText1: ; 5d912 (17:5912)
	TX_FAR _SilphCo9BattleText1
	db $50
; 0x5d912 + 5 bytes

SilphCo9EndBattleText1: ; 5d917 (17:5917)
	TX_FAR _SilphCo9EndBattleText1
	db $50
; 0x5d917 + 5 bytes

SilphCo9AfterBattleText1: ; 5d91c (17:591c)
	TX_FAR _SilphCo9AfterBattleText1
	db $50
; 0x5d91c + 5 bytes

SilphCo9BattleText2: ; 5d921 (17:5921)
	TX_FAR _SilphCo9BattleText2
	db $50
; 0x5d921 + 5 bytes

SilphCo9EndBattleText2: ; 5d926 (17:5926)
	TX_FAR _SilphCo9EndBattleText2
	db $50
; 0x5d926 + 5 bytes

SilphCo9AfterBattleText2: ; 5d92b (17:592b)
	TX_FAR _SilphCo9AfterBattleText2
	db $50
; 0x5d92b + 5 bytes

SilphCo9BattleText3: ; 5d930 (17:5930)
	TX_FAR _SilphCo9BattleText3
	db $50
; 0x5d930 + 5 bytes

SilphCo9EndBattleText3: ; 5d935 (17:5935)
	TX_FAR _SilphCo9EndBattleText3
	db $50
; 0x5d935 + 5 bytes

SilphCo9AfterBattleText3: ; 5d93a (17:593a)
	TX_FAR _SilphCo9AfterBattleText3
	db $50
; 0x5d93a + 5 bytes

SilphCo9Object: ; 0x5d93f (size=74)
	db $2e ; border tile

	db $5 ; warps
	db $0, $e, $0, SILPH_CO_10F
	db $0, $10, $0, SILPH_CO_8F
	db $0, $12, $0, SILPH_CO_ELEVATOR
	db $3, $9, $7, SILPH_CO_3F
	db $f, $11, $4, SILPH_CO_5F

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $e + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_ROCKET, $4 + 4, $2 + 4, $ff, $d1, $42, ROCKET + $C8, $25 ; trainer
	db SPRITE_OAK_AIDE, $d + 4, $15 + 4, $ff, $d0, $43, SCIENTIST + $C8, $a ; trainer
	db SPRITE_ROCKET, $10 + 4, $d + 4, $ff, $d1, $44, ROCKET + $C8, $26 ; trainer

	; warp-to
	EVENT_DISP $d, $0, $e ; SILPH_CO_10F
	EVENT_DISP $d, $0, $10 ; SILPH_CO_8F
	EVENT_DISP $d, $0, $12 ; SILPH_CO_ELEVATOR
	EVENT_DISP $d, $3, $9 ; SILPH_CO_3F
	EVENT_DISP $d, $f, $11 ; SILPH_CO_5F

SilphCo9Blocks: ; 5d989 (17:5989)
	INCBIN "maps/silphco9.blk"

VictoryRoad1_h: ; 0x5d9fe to 0x5da0a (12 bytes) (id=108)
	db $11 ; tileset
	db VICTORY_ROAD_1_HEIGHT, VICTORY_ROAD_1_WIDTH ; dimensions (y, x)
	dw VictoryRoad1Blocks, VictoryRoad1Texts, VictoryRoad1Script ; blocks, texts, scripts
	db $00 ; connections

	dw VictoryRoad1Object ; objects

VictoryRoad1Script: ; 5da0a (17:5a0a)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	call nz, .next
	call EnableAutoTextBoxDrawing
	ld hl, VictoryRoad1TrainerHeaders
	ld de, Unknown_5da3a ; $5a3a
	ld a, [W_VICTORYROAD1CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_VICTORYROAD1CURSCRIPT], a
	ret
; 0x5da27
.next
	ld a, [$d869]
	bit 7, a
	ret z
	ld a, $1d
	ld [$d09f], a
	ld bc, $604
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

Unknown_5da3a: ; 5da3a (17:5a3a)
INCBIN "baserom.gbc",$5da3a,$5da40 - $5da3a
	ld a, [$d869]
	bit 7, a
	jp nz, CheckFightingMapTrainers
	ld hl, Unknown_5da5c ; $5a5c
	call CheckBoulderCoords
	jp nc, CheckFightingMapTrainers
	ld hl, $d126
	set 5, [hl]
	ld hl, $d869
	set 7, [hl]
	ret

Unknown_5da5c: ; 5da5c (17:5a5c)
INCBIN "baserom.gbc",$5da5c,$5da5f - $5da5c

VictoryRoad1Texts: ; 5da5f (17:5a5f)
	dw VictoryRoad1Text1, VictoryRoad1Text2, Predef5CText, Predef5CText, BoulderText, BoulderText, BoulderText

VictoryRoad1TrainerHeaders: ; 5da6d (17:5a6d)
VictoryRoad1TrainerHeader0: ; 5da6d (17:5a6d)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d869 ; flag's byte
	dw VictoryRoad1BattleText1 ; 0x5a9a TextBeforeBattle
	dw VictoryRoad1AfterBattleText1 ; 0x5aa4 TextAfterBattle
	dw VictoryRoad1EndBattleText1 ; 0x5a9f TextEndBattle
	dw VictoryRoad1EndBattleText1 ; 0x5a9f TextEndBattle
; 0x5da79

VictoryRoad1TrainerHeader1: ; 5da79 (17:5a79)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d869 ; flag's byte
	dw VictoryRoad1BattleText2 ; 0x5aa9 TextBeforeBattle
	dw VictoryRoad1AfterBattleText2 ; 0x5ab3 TextAfterBattle
	dw VictoryRoad1EndBattleText2 ; 0x5aae TextEndBattle
	dw VictoryRoad1EndBattleText2 ; 0x5aae TextEndBattle
; 0x5da85

db $ff

VictoryRoad1Text1: ; 5da86 (17:5a86)
	db $08 ; asm
	ld hl, VictoryRoad1TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad1Text2: ; 5da90 (17:5a90)
	db $08 ; asm
	ld hl, VictoryRoad1TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

VictoryRoad1BattleText1: ; 5da9a (17:5a9a)
	TX_FAR _VictoryRoad1BattleText1
	db $50
; 0x5da9a + 5 bytes

VictoryRoad1EndBattleText1: ; 5da9f (17:5a9f)
	TX_FAR _VictoryRoad1EndBattleText1
	db $50
; 0x5da9f + 5 bytes

VictoryRoad1AfterBattleText1: ; 5daa4 (17:5aa4)
	TX_FAR _VictoryRoad1AfterBattleText1
	db $50
; 0x5daa4 + 5 bytes

VictoryRoad1BattleText2: ; 5daa9 (17:5aa9)
	TX_FAR _VictoryRoad1BattleText2
	db $50
; 0x5daa9 + 5 bytes

VictoryRoad1EndBattleText2: ; 5daae (17:5aae)
	TX_FAR _VictoryRoad1EndBattleText2
	db $50
; 0x5daae + 5 bytes

VictoryRoad1AfterBattleText2: ; 5dab3 (17:5ab3)
	TX_FAR _VictoryRoad1AfterBattleText2
	db $50
; 0x5dab3 + 5 bytes

VictoryRoad1Object: ; 0x5dab8 (size=76)
	db $7d ; border tile

	db $3 ; warps
	db $11, $8, $2, $ff
	db $11, $9, $2, $ff
	db $1, $1, $0, VICTORY_ROAD_2

	db $0 ; signs

	db $7 ; people
	db SPRITE_LASS, $5 + 4, $7 + 4, $ff, $d3, $41, COOLTRAINER_F + $C8, $5 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $2 + 4, $3 + 4, $ff, $d0, $42, COOLTRAINER_M + $C8, $5 ; trainer
	db SPRITE_BALL, $0 + 4, $b + 4, $ff, $ff, $83, TM_43 ; item
	db SPRITE_BALL, $2 + 4, $9 + 4, $ff, $ff, $84, RARE_CANDY ; item
	db SPRITE_BOULDER, $f + 4, $5 + 4, $ff, $10, $5 ; person
	db SPRITE_BOULDER, $2 + 4, $e + 4, $ff, $10, $6 ; person
	db SPRITE_BOULDER, $a + 4, $2 + 4, $ff, $10, $7 ; person

	; warp-to
	EVENT_DISP $a, $11, $8
	EVENT_DISP $a, $11, $9
	EVENT_DISP $a, $1, $1 ; VICTORY_ROAD_2

VictoryRoad1Blocks: ; 5db04 (17:5b04)
	INCBIN "maps/victoryroad1.blk"

; known jump sources: 3aeaa (e:6eaa)
; updates the types of a party mon (pointed to in hl) to the ones of the mon specified in $d11e
SetPartyMonTypes: ; 5db5e (17:5b5e)
	call Load16BitRegisters
	ld bc, W_PARTYMON1_TYPE1 - W_PARTYMON1DATA ; $5
	add hl, bc
	ld a, [$d11e]
	ld [$d0b5], a
	push hl
	call GetMonHeader
	pop hl
	ld a, [W_MONHTYPE1]
	ld [hli], a
	ld a, [W_MONHTYPE2]
	ld [hl], a
	ret

INCBIN "baserom.gbc",$5db79,$5db81 - $5db79

UnnamedText_5db81: ; 5db81 (17:5b81)
	TX_FAR _UnnamedText_5db81
	db $50
; 0x5db81 + 5 bytes

INCBIN "baserom.gbc",$5db86,$5dba8 - $5db86

UnnamedText_5dba8: ; 5dba8 (17:5ba8)
	TX_FAR _UnnamedText_5dba8
	db $50
; 0x5dba8 + 5 bytes

	ld a, $b7
	ld [$cf91], a
	call Func_5dbd9
	call EnableAutoTextBoxDrawing
	ld a, $9
	call Func_3ef5
	ret
; 5dbbe (17:5bbe)
UnnamedText_5dbbe: ; 5dbbe (17:5bbe)
	TX_FAR _UnnamedText_5dbbe
	db $50
; 0x5dbbe + 5 bytes

	ld a, $b6
	ld [$cf91], a
	call Func_5dbd9
	call EnableAutoTextBoxDrawing
	ld a, $b
	call Func_3ef5
	ret
; 5dbd4 (17:5bd4)
UnnamedText_5dbd4: ; 5dbd4 (17:5bd4)
	TX_FAR _UnnamedText_5dbd4
	db $50
; 0x5dbd4 + 5 bytes

; known jump sources: 5dbb2 (17:5bb2), 5dbc8 (17:5bc8)
Func_5dbd9: ; 5dbd9 (17:5bd9)
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Delay3
	xor a
	ld [$FF00+$b0], a
	call SaveScreenTilesToBuffer1
	ld a, $11
	ld [$d125], a
	call DisplayTextBoxID
	call UpdateSprites
	ld a, [$cf91]
	ld [$d0b5], a
	call GetMonHeader
	ld de, $8b10
	call LoadMonFrontSprite
	ld a, $80
	ld [$FF00+$e1], a
	FuncCoord 10, 11 ; $c486
	ld hl, Coord
	ld a, $2
	call Predef ; indirect jump to Func_3f073 (3f073 (f:7073))
	call WaitForTextScrollButtonPress
	call LoadScreenTilesFromBuffer1
	call Delay3
	ld a, $90
	ld [$FF00+$b0], a
	ret

INCBIN "baserom.gbc",$5dc1a,$5dc9e - $5dc1a

UnnamedText_5dc9e: ; 5dc9e (17:5c9e)
	TX_FAR _UnnamedText_5dc9e
	db $50
; 0x5dc9e + 5 bytes

UnnamedText_5dca3: ; 5dca3 (17:5ca3)
	TX_FAR _UnnamedText_5dca3
	db $50
; 0x5dca3 + 5 bytes

INCBIN "baserom.gbc",$5dca8,$5dcde - $5dca8

UnnamedText_5dcde: ; 5dcde (17:5cde)
	TX_FAR _UnnamedText_5dcde
	db $50
; 0x5dcde + 5 bytes

UnnamedText_5dce3: ; 5dce3 (17:5ce3)
	TX_FAR _UnnamedText_5dce3
	db $50
; 0x5dce3 + 5 bytes

UnnamedText_5dce8: ; 5dce8 (17:5ce8)
	TX_FAR _UnnamedText_5dce8
	db $50
; 0x5dce8 + 5 bytes

INCBIN "baserom.gbc",$5dced,$5dda2 - $5dced

UnnamedText_5dda2: ; 5dda2 (17:5da2)
	TX_FAR _UnnamedText_5dda2
	db $50
; 0x5dda2 + 5 bytes

UnnamedText_5dda7: ; 5dda7 (17:5da7)
	TX_FAR _UnnamedText_5dda7
	db $50
; 0x5dda7 + 5 bytes

INCBIN "baserom.gbc",$5ddac,$5ddd6 - $5ddac

UnnamedText_5ddd6: ; 5ddd6 (17:5dd6)
	TX_FAR _UnnamedText_5ddd6
	db $50
; 0x5ddd6 + 5 bytes

UnnamedText_5dddb: ; 5dddb (17:5ddb)
	TX_FAR _UnnamedText_5dddb
	db $50
; 0x5dddb + 5 bytes

UnnamedText_5dde0: ; 5dde0 (17:5de0)
	TX_FAR _UnnamedText_5dde0
	db $50
; 0x5dde0 + 5 bytes

UnnamedText_5dde5: ; 5dde5 (17:5de5)
	TX_FAR _UnnamedText_5dde5
	db $50
; 0x5dde5 + 5 bytes

UnnamedText_5ddea: ; 5ddea (17:5dea)
	TX_FAR _UnnamedText_5ddea
	db $50
; 0x5ddea + 5 bytes

INCBIN "baserom.gbc",$5ddef,$5ddf7 - $5ddef

UnnamedText_5ddf7: ; 5ddf7 (17:5df7)
	TX_FAR _UnnamedText_5ddf7
	db $50
; 0x5ddf7 + 5 bytes

	call EnableAutoTextBoxDrawing
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [$cd5b], a
	ld a, [$d773]
	bit 0, a
	jr z, .asm_5de11
	ld a, $26
	jp Func_3ef5
.asm_5de11
	bit 1, a
	jr nz, .asm_5de53
	ld a, [$d743]
	ld b, a
	ld a, [$cd5b]
	cp b
	jr z, .asm_5de23
	ld a, $26
	jr .asm_5de7a
.asm_5de23
	ld hl, $d773
	set 1, [hl]
	ld hl, Unknown_5de7d ; $5e7d
	ld a, [$cd5b]
	ld b, a
	add a
	add a
	add b
	ld d, $0
	ld e, a
	add hl, de
	ld a, [hli]
	ld [$FF00+$db], a
	push hl
	call GenRandom
	swap a
	ld b, a
	ld a, [$FF00+$db]
	and b
	dec a
	pop hl
	ld d, $0
	ld e, a
	add hl, de
	ld a, [hl]
	and $f
	ld [$d744], a
	ld a, $3b
	jr .asm_5de7a
.asm_5de53
	ld a, [$d744]
	ld b, a
	ld a, [$cd5b]
	cp b
	jr z, .asm_5de6e
	ld hl, $d773
	res 1, [hl]
	call GenRandom
	and $e
	ld [$d743], a
	ld a, $3e
	jr .asm_5de7a
.asm_5de6e
	ld hl, $d773
	set 0, [hl]
	ld hl, $d126
	set 6, [hl]
	ld a, $3d
.asm_5de7a
	jp Func_3ef5

Unknown_5de7d: ; 5de7d (17:5e7d)
INCBIN "baserom.gbc",$5de7d,$5decd - $5de7d
	call WaitForSoundToFinish
	ld a, $9d
	call PlaySound
	call WaitForSoundToFinish
	jp TextScriptEnd
; 5dedb (17:5edb)
UnnamedText_5dedb: ; 5dedb (17:5edb)
	TX_FAR _UnnamedText_5dedb
	db $50
; 0x5dedb + 5 bytes

INCBIN "baserom.gbc",$5dee0,$5def4 - $5dee0
	call WaitForSoundToFinish
	ld a, $ad
	call PlaySound
	call WaitForSoundToFinish
	jp TextScriptEnd

INCBIN "baserom.gbc",$5df02,$5df07 - $5df02
	call WaitForSoundToFinish
	ld a, $a5
	call PlaySound
	call WaitForSoundToFinish
	jp TextScriptEnd
; 5df15 (17:5f15)
SECTION "bank18",ROMX,BANK[$18]

ViridianForestBlocks: ; 60000 (18:4000)
	INCBIN "maps/viridianforest.blk"

UndergroundPathNSBlocks: ; 60198 (18:4198)
	INCBIN "maps/undergroundpathns.blk"

INCBIN "baserom.gbc",$601f8,$603c0 - $601f8

SSAnne10Blocks: ; 603c0 (18:43c0)
SSAnne9Blocks: ; 603c0 (18:43c0)
	INCBIN "maps/ssanne9.blk"

PokemonTower1_h: ; 0x60420 to 0x6042c (12 bytes) (id=142)
	db $0f ; tileset
	db POKEMONTOWER_1_HEIGHT, POKEMONTOWER_1_WIDTH ; dimensions (y, x)
	dw PokemonTower1Blocks, PokemonTower1Texts, PokemonTower1Script ; blocks, texts, scripts
	db $00 ; connections

	dw PokemonTower1Object ; objects

PokemonTower1Script: ; 6042c (18:442c)
	jp EnableAutoTextBoxDrawing
; 0x6042f

PokemonTower1Texts: ; 6042f (18:442f)
	dw PokemonTower1Text1, PokemonTower1Text2, PokemonTower1Text3, PokemonTower1Text4, PokemonTower1Text5

PokemonTower1Text1: ; 60439 (18:4439)
	TX_FAR _PokemonTower1Text1
	db $50

PokemonTower1Text2: ; 6043e (18:443e)
	TX_FAR _PokemonTower1Text2
	db $50

PokemonTower1Text3: ; 60443 (18:4443)
	TX_FAR _PokemonTower1Text3
	db $50

PokemonTower1Text4: ; 60448 (18:4448)
	TX_FAR _PokemonTower1Text4
	db $50

PokemonTower1Text5: ; 6044d (18:444d)
	TX_FAR _PokemonTower1Text5
	db $50

PokemonTower1Object: ; 0x60452 (size=58)
	db $1 ; border tile

	db $3 ; warps
	db $11, $a, $1, $ff
	db $11, $b, $1, $ff
	db $9, $12, $1, POKEMONTOWER_2

	db $0 ; signs

	db $5 ; people
	db SPRITE_CABLE_CLUB_WOMAN, $d + 4, $f + 4, $ff, $d1, $1 ; person
	db SPRITE_MOM_GEISHA, $8 + 4, $6 + 4, $ff, $ff, $2 ; person
	db SPRITE_BALDING_GUY, $c + 4, $8 + 4, $ff, $ff, $3 ; person
	db SPRITE_GIRL, $7 + 4, $d + 4, $ff, $ff, $4 ; person
	db SPRITE_MEDIUM, $7 + 4, $11 + 4, $ff, $d2, $5 ; person

	; warp-to
	EVENT_DISP $a, $11, $a
	EVENT_DISP $a, $11, $b
	EVENT_DISP $a, $9, $12 ; POKEMONTOWER_2

PokemonTower1Blocks: ; 6048c (18:448c)
	INCBIN "maps/pokemontower1.blk"

PokemonTower2_h: ; 0x604e6 to 0x604f2 (12 bytes) (id=143)
	db $0f ; tileset
	db POKEMONTOWER_2_HEIGHT, POKEMONTOWER_2_WIDTH ; dimensions (y, x)
	dw PokemonTower2Blocks, PokemonTower2Texts, PokemonTower2Script ; blocks, texts, scripts
	db $00 ; connections

	dw PokemonTower2Object ; objects

PokemonTower2Script: ; 604f2 (18:44f2)
	call EnableAutoTextBoxDrawing
	ld hl, PokemonTower2Scripts
	ld a, [W_POKEMONTOWER2CURSCRIPT]
	jp CallFunctionInTable
; 0x604fe

; known jump sources: 60568 (18:4568)
Func_604fe: ; 604fe (18:44fe)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_POKEMONTOWER2CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 60509 (18:4509)
PokemonTower2Scripts: ; 60509 (18:4509)
	dw PokemonTower2Script0, PokemonTower2Script1, PokemonTower2Script2

PokemonTower2Script0: ; 6050f (18:450f)
	ld a, [$d764]
	bit 7, a
	ret nz
	ld hl, Unknown_6055e ; $455e
	call ArePlayerCoordsInArray
	ret nc
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld c, $2
	ld a, $de
	call PlayMusic
	ld hl, $d764
	res 6, [hl]
	ld a, [$cd3d]
	cp $1
	ld a, $8
	ld b, $0
	jr nz, .asm_60544 ; 0x60539 $9
	ld hl, $d764
	set 6, [hl]
	ld a, $2
	ld b, $c
.asm_60544
	ld [$d528], a
	ld a, $1
	ld [$ff00+$8c], a
	ld a, b
	ld [$ff00+$8d], a
	call Func_34a6
	ld a, $1
	ld [$ff00+$8c], a
	call DisplayTextID
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [H_NEWLYPRESSEDBUTTONS], a
	ret
; 0x6055e

Unknown_6055e: ; 6055e (18:455e)
INCBIN "baserom.gbc",$6055e,$60563 - $6055e

PokemonTower2Script1: ; 60563 (18:4563)
	ld a, [$d057]
	cp $ff
	jp z, Func_604fe
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d764
	set 7, [hl]
	ld a, $1
	ld [$ff00+$8c], a
	call DisplayTextID
	ld de, Unknown_605b2 ; $45b2
	ld a, [$d764]
	bit 6, a
	jr nz, .asm_60589 ; 0x60584 $3
	ld de, Unknown_605a9 ; $45a9
.asm_60589
	ld a, $1
	ld [$ff00+$8c], a
	call MoveSprite
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld b, BANK(Func_9b47)
	ld hl, Func_9b47
	call Bankswitch
	ld a, $2
	ld [W_POKEMONTOWER2CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 0x605a9

Unknown_605a9: ; 605a9 (18:45a9)
INCBIN "baserom.gbc",$605a9,$605b2 - $605a9

Unknown_605b2: ; 605b2 (18:45b2)
INCBIN "baserom.gbc",$605b2,$605bb - $605b2

PokemonTower2Script2: ; 605bb (18:45bb)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $38
	ld [$cc4d], a
	ld a, $11
	call Predef
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	call Func_2307
	ld a, $0
	ld [W_POKEMONTOWER2CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 0x605db

PokemonTower2Texts: ; 605db (18:45db)
	dw PokemonTower2Text1, PokemonTower2Text2

PokemonTower2Text1: ; 605df (18:45df)
	db $08 ; asm
	ld a, [$d764]
	bit 7, a
	jr z, .asm_16f24 ; 0x605e5
	ld hl, UnnamedText_6063c
	call PrintText
	jr .asm_41852 ; 0x605ed
.asm_16f24 ; 0x605ef
	ld hl, UnnamedText_6062d
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_60632
	ld de, UnnamedText_60637 ; XXX $4637
	call PreBattleSaveRegisters
	ld a, $f2
	ld [$d059], a

	; select which team to use during the encounter
	ld a, [W_RIVALSTARTER]
	cp SQUIRTLE
	jr nz, .NotSquirtle ; 0x6060f
	ld a, $4
	jr .done
.NotSquirtle ; 0x60615
	cp BULBASAUR
	jr nz, .Charmander ; 0x60617
	ld a, $5
	jr .done
.Charmander ; 0x6061d
	ld a, $6
.done
	ld [W_TRAINERNO], a

	ld a, $1
	ld [W_POKEMONTOWER2CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
.asm_41852 ; 0x6062a
	jp TextScriptEnd

UnnamedText_6062d: ; 6062d (18:462d)
	TX_FAR _UnnamedText_6062d
	db $50
; 0x6062d + 5 bytes

UnnamedText_60632: ; 60632 (18:4632)
	TX_FAR _UnnamedText_60632
	db $50
; 0x60632 + 5 bytes

UnnamedText_60637: ; 60637 (18:4637)
	TX_FAR _UnnamedText_60637
	db $50
; 0x60637 + 5 bytes

UnnamedText_6063c: ; 6063c (18:463c)
	TX_FAR _UnnamedText_6063c
	db $50
; 0x6063c + 5 bytes

PokemonTower2Text2: ; 60641 (18:4641)
	TX_FAR _PokemonTower2Text2
	db $50

PokemonTower2Object: ; 0x60646 (size=32)
	db $1 ; border tile

	db $2 ; warps
	db $9, $3, $0, POKEMONTOWER_3
	db $9, $12, $2, POKEMONTOWER_1

	db $0 ; signs

	db $2 ; people
	db SPRITE_BLUE, $5 + 4, $e + 4, $ff, $ff, $1 ; person
	db SPRITE_MEDIUM, $7 + 4, $3 + 4, $ff, $d3, $2 ; person

	; warp-to
	EVENT_DISP $a, $9, $3 ; POKEMONTOWER_3
	EVENT_DISP $a, $9, $12 ; POKEMONTOWER_1

PokemonTower2Blocks: ; 60666 (18:4666)
	INCBIN "maps/pokemontower2.blk"

PokemonTower3_h: ; 0x606c0 to 0x606cc (12 bytes) (id=144)
	db $0f ; tileset
	db POKEMONTOWER_3_HEIGHT, POKEMONTOWER_3_WIDTH ; dimensions (y, x)
	dw PokemonTower3Blocks, PokemonTower3Texts, PokemonTower3Script ; blocks, texts, scripts
	db $00 ; connections

	dw PokemonTower3Object ; objects

PokemonTower3Script: ; 606cc (18:46cc)
	call EnableAutoTextBoxDrawing
	ld hl, PokemonTower3TrainerHeaders
	ld de, Unknown_606df
	ld a, [W_POKEMONTOWER3CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_POKEMONTOWER3CURSCRIPT], a
	ret
; 0x606df

Unknown_606df: ; 606df (18:46df)
INCBIN "baserom.gbc",$606df,$606e5 - $606df

PokemonTower3Texts: ; 606e5 (18:46e5)
	dw PokemonTower3Text1, PokemonTower3Text2, PokemonTower3Text3, Predef5CText

PokemonTower3TrainerHeaders: ; 606ed (18:46ed)
PokemonTower3TrainerHeader0: ; 606ed (18:46ed)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d765 ; flag's byte
	dw PokemonTower3BattleText1 ; 0x4730 TextBeforeBattle
	dw PokemonTower3AfterBattleText1 ; 0x473a TextAfterBattle
	dw PokemonTower3EndBattleText1 ; 0x4735 TextEndBattle
	dw PokemonTower3EndBattleText1 ; 0x4735 TextEndBattle
; 0x606f9

PokemonTower3TrainerHeader1: ; 606f9 (18:46f9)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d765 ; flag's byte
	dw PokemonTower3BattleText2 ; 0x473f TextBeforeBattle
	dw PokemonTower3AfterBattleText2 ; 0x4749 TextAfterBattle
	dw PokemonTower3EndBattleText2 ; 0x4744 TextEndBattle
	dw PokemonTower3EndBattleText2 ; 0x4744 TextEndBattle
; 0x60705

PokemonTower3TrainerHeader2: ; 60705 (18:4705)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d765 ; flag's byte
	dw PokemonTower3BattleText3 ; 0x474e TextBeforeBattle
	dw PokemonTower3AfterBattleText3 ; 0x4758 TextAfterBattle
	dw PokemonTower3EndBattleText3 ; 0x4753 TextEndBattle
	dw PokemonTower3EndBattleText3 ; 0x4753 TextEndBattle
; 0x60711
db $ff

PokemonTower3Text1: ; 60712 (18:4712)
	db $08 ; asm
	ld hl, PokemonTower3TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower3Text2: ; 6071c (18:471c)
	db $08 ; asm
	ld hl, PokemonTower3TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower3Text3: ; 60726 (18:4726)
	db $08 ; asm
	ld hl, PokemonTower3TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower3BattleText1: ; 60730 (18:4730)
	TX_FAR _PokemonTower3BattleText1
	db $50
; 0x60730 + 5 bytes

PokemonTower3EndBattleText1: ; 60735 (18:4735)
	TX_FAR _PokemonTower3EndBattleText1
	db $50
; 0x60735 + 5 bytes

PokemonTower3AfterBattleText1: ; 6073a (18:473a)
	TX_FAR _PokemonTower3AfterBattleText1
	db $50
; 0x6073a + 5 bytes

PokemonTower3BattleText2: ; 6073f (18:473f)
	TX_FAR _PokemonTower3BattleText2
	db $50
; 0x6073f + 5 bytes

PokemonTower3EndBattleText2: ; 60744 (18:4744)
	TX_FAR _PokemonTower3EndBattleText2
	db $50
; 0x60744 + 5 bytes

PokemonTower3AfterBattleText2: ; 60749 (18:4749)
	TX_FAR _PokemonTower3AfterBattleText2
	db $50
; 0x60749 + 5 bytes

PokemonTower3BattleText3: ; 6074e (18:474e)
	TX_FAR _PokemonTower3BattleText3
	db $50
; 0x6074e + 5 bytes

PokemonTower3EndBattleText3: ; 60753 (18:4753)
	TX_FAR _PokemonTower3EndBattleText3
	db $50
; 0x60753 + 5 bytes

PokemonTower3AfterBattleText3: ; 60758 (18:4758)
	TX_FAR _PokemonTower3AfterBattleText3
	db $50
; 0x60758 + 5 bytes

PokemonTower3Object: ; 0x6075d (size=51)
	db $1 ; border tile

	db $2 ; warps
	db $9, $3, $0, POKEMONTOWER_2
	db $9, $12, $1, POKEMONTOWER_4

	db $0 ; signs

	db $4 ; people
	db SPRITE_MEDIUM, $3 + 4, $c + 4, $ff, $d2, $41, CHANNELER + $C8, $5 ; trainer
	db SPRITE_MEDIUM, $8 + 4, $9 + 4, $ff, $d0, $42, CHANNELER + $C8, $6 ; trainer
	db SPRITE_MEDIUM, $d + 4, $a + 4, $ff, $d0, $43, CHANNELER + $C8, $8 ; trainer
	db SPRITE_BALL, $1 + 4, $c + 4, $ff, $ff, $84, ESCAPE_ROPE ; item

	; warp-to
	EVENT_DISP $a, $9, $3 ; POKEMONTOWER_2
	EVENT_DISP $a, $9, $12 ; POKEMONTOWER_4

PokemonTower3Blocks: ; 60790 (18:4790)
	INCBIN "maps/pokemontower3.blk"

PokemonTower4_h: ; 0x607ea to 0x607f6 (12 bytes) (id=145)
	db $0f ; tileset
	db POKEMONTOWER_4_HEIGHT, POKEMONTOWER_4_WIDTH ; dimensions (y, x)
	dw PokemonTower4Blocks, PokemonTower4Texts, PokemonTower4Script ; blocks, texts, scripts
	db $00 ; connections

	dw PokemonTower4Object ; objects

PokemonTower4Script: ; 607f6 (18:47f6)
	call EnableAutoTextBoxDrawing
	ld hl, PokemonTower4TrainerHeaders
	ld de, PokemonTower4Script_Unknown60809
	ld a, [W_POKEMONTOWER4CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_POKEMONTOWER4CURSCRIPT], a
	ret
; 0x60809

PokemonTower4Script_Unknown60809: ; 60809 (18:4809)
INCBIN "baserom.gbc",$60809,$6080f - $60809

PokemonTower4Texts: ; 6080f (18:480f)
	dw PokemonTower4Text1, PokemonTower4Text2, PokemonTower4Text3, Predef5CText, Predef5CText, Predef5CText

PokemonTower4TrainerHeaders: ; 6081b (18:481b)
PokemonTower4TrainerHeader0: ; 6081b (18:481b)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d766 ; flag's byte
	dw PokemonTower4BattleText1 ; 0x485e TextBeforeBattle
	dw PokemonTower4AfterBattleText1 ; 0x4868 TextAfterBattle
	dw PokemonTower4EndBattleText1 ; 0x4863 TextEndBattle
	dw PokemonTower4EndBattleText1 ; 0x4863 TextEndBattle
; 0x60827

PokemonTower4TrainerHeader1: ; 60827 (18:4827)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d766 ; flag's byte
	dw PokemonTower4BattleText2 ; 0x486d TextBeforeBattle
	dw PokemonTower4AfterBattleText2 ; 0x4877 TextAfterBattle
	dw PokemonTower4EndBattleText2 ; 0x4872 TextEndBattle
	dw PokemonTower4EndBattleText2 ; 0x4872 TextEndBattle
; 0x60833

PokemonTower4TrainerHeader2: ; 60833 (18:4833)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d766 ; flag's byte
	dw PokemonTower4BattleText3 ; 0x487c TextBeforeBattle
	dw PokemonTower4AfterBattleText3 ; 0x4886 TextAfterBattle
	dw PokemonTower4EndBattleText3 ; 0x4881 TextEndBattle
	dw PokemonTower4EndBattleText3 ; 0x4881 TextEndBattle
; 0x6083f

db $ff

PokemonTower4Text1: ; 60840 (18:4840)
	db $08 ; asm
	ld hl, PokemonTower4TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower4Text2: ; 6084a (18:484a)
	db $08 ; asm
	ld hl, PokemonTower4TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower4Text3: ; 60854 (18:4854)
	db $08 ; asm
	ld hl, PokemonTower4TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower4BattleText1: ; 6085e (18:485e)
	TX_FAR _PokemonTower4BattleText1
	db $50
; 0x6085e + 5 bytes

PokemonTower4EndBattleText1: ; 60863 (18:4863)
	TX_FAR _PokemonTower4EndBattleText1
	db $50
; 0x60863 + 5 bytes

PokemonTower4AfterBattleText1: ; 60868 (18:4868)
	TX_FAR _PokemonTower4AfterBattleText1
	db $50
; 0x60868 + 5 bytes

PokemonTower4BattleText2: ; 6086d (18:486d)
	TX_FAR _PokemonTower4BattleText2
	db $50
; 0x6086d + 5 bytes

PokemonTower4EndBattleText2: ; 60872 (18:4872)
	TX_FAR _PokemonTower4EndBattleText2
	db $50
; 0x60872 + 5 bytes

PokemonTower4AfterBattleText2: ; 60877 (18:4877)
	TX_FAR _PokemonTower4AfterBattleText2
	db $50
; 0x60877 + 5 bytes

PokemonTower4BattleText3: ; 6087c (18:487c)
	TX_FAR _PokemonTower4BattleText3
	db $50
; 0x6087c + 5 bytes

PokemonTower4EndBattleText3: ; 60881 (18:4881)
	TX_FAR _PokemonTower4EndBattleText3
	db $50
; 0x60881 + 5 bytes

PokemonTower4AfterBattleText3: ; 60886 (18:4886)
	TX_FAR _PokemonTower4AfterBattleText3
	db $50
; 0x60886 + 5 bytes

PokemonTower4Object: ; 0x6088b (size=65)
	db $1 ; border tile

	db $2 ; warps
	db $9, $3, $0, POKEMONTOWER_5
	db $9, $12, $1, POKEMONTOWER_3

	db $0 ; signs

	db $6 ; people
	db SPRITE_MEDIUM, $a + 4, $5 + 4, $ff, $d3, $41, CHANNELER + $C8, $9 ; trainer
	db SPRITE_MEDIUM, $7 + 4, $f + 4, $ff, $d0, $42, CHANNELER + $C8, $a ; trainer
	db SPRITE_MEDIUM, $c + 4, $e + 4, $ff, $d2, $43, CHANNELER + $C8, $c ; trainer
	db SPRITE_BALL, $a + 4, $c + 4, $ff, $ff, $84, ELIXER ; item
	db SPRITE_BALL, $a + 4, $9 + 4, $ff, $ff, $85, AWAKENING ; item
	db SPRITE_BALL, $10 + 4, $c + 4, $ff, $ff, $86, HP_UP ; item

	; warp-to
	EVENT_DISP $a, $9, $3 ; POKEMONTOWER_5
	EVENT_DISP $a, $9, $12 ; POKEMONTOWER_3

PokemonTower4Blocks: ; 608cc (18:48cc)
	INCBIN "maps/pokemontower4.blk"

PokemonTower5_h: ; 0x60926 to 0x60932 (12 bytes) (id=146)
	db $0f ; tileset
	db POKEMONTOWER_5_HEIGHT, POKEMONTOWER_5_WIDTH ; dimensions (y, x)
	dw PokemonTower5Blocks, PokemonTower5Texts, PokemonTower5Script ; blocks, texts, scripts
	db $00 ; connections

	dw PokemonTower5Object ; objects

PokemonTower5Script: ; 60932 (18:4932)
	call EnableAutoTextBoxDrawing
	ld hl, PokemonTower5TrainerHeaders
	ld de, PokemonTower5Script_Unknown60945
	ld a, [W_POKEMONTOWER5CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_POKEMONTOWER5CURSCRIPT], a
	ret
; 0x60945

PokemonTower5Script_Unknown60945: ; 60945 (18:4945)
INCBIN "baserom.gbc",$60945,$6094b - $60945
	ld hl, Unknown_60992 ; $4992
	call ArePlayerCoordsInArray
	jr c, .asm_60960
	ld hl, $d72e
	res 4, [hl]
	ld hl, $d767
	res 7, [hl]
	jp CheckFightingMapTrainers
.asm_60960
	ld hl, $d767
	bit 7, [hl]
	set 7, [hl]
	ret nz
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d72e
	set 4, [hl]
	ld a, $7
	call Predef ; indirect jump to HealParty (f6a5 (3:76a5))
	call GBFadeOut2
	call Delay3
	call Delay3
	call GBFadeIn2
	ld a, $7
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ret

Unknown_60992: ; 60992 (18:4992)
INCBIN "baserom.gbc",$60992,$6099b - $60992

PokemonTower5Texts: ; 6099b (18:499b)
	dw PokemonTower5Text1, PokemonTower5Text2, PokemonTower5Text3, PokemonTower5Text4, PokemonTower5Text5, Predef5CText, PokemonTower5Text7

PokemonTower5TrainerHeaders: ; 609a9 (18:49a9)
PokemonTower5TrainerHeader0: ; 609a9 (18:49a9)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d767 ; flag's byte
	dw PokemonTower5BattleText1 ; 0x49e9 TextBeforeBattle
	dw PokemonTower5AfterBattleText1 ; 0x49f3 TextAfterBattle
	dw PokemonTower5EndBattleText1 ; 0x49ee TextEndBattle
	dw PokemonTower5EndBattleText1 ; 0x49ee TextEndBattle
; 0x609b5

PokemonTower5TrainerHeader1: ; 609b5 (18:49b5)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d767 ; flag's byte
	dw PokemonTower5BattleText2 ; 0x4a02 TextBeforeBattle
	dw PokemonTower5AfterBattleText2 ; 0x4a0c TextAfterBattle
	dw PokemonTower5EndBattleText2 ; 0x4a07 TextEndBattle
	dw PokemonTower5EndBattleText2 ; 0x4a07 TextEndBattle
; 0x609c1

PokemonTower5TrainerHeader2: ; 609c1 (18:49c1)
	db $4 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d767 ; flag's byte
	dw PokemonTower5BattleText3 ; 0x4a1b TextBeforeBattle
	dw PokemonTower5AfterBattleText3 ; 0x4a25 TextAfterBattle
	dw PokemonTower5EndBattleText3 ; 0x4a20 TextEndBattle
	dw PokemonTower5EndBattleText3 ; 0x4a20 TextEndBattle
; 0x609cd

PokemonTower5TrainerHeader3: ; 609cd (18:49cd)
	db $5 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d767 ; flag's byte
	dw PokemonTower5BattleText4 ; 0x4a34 TextBeforeBattle
	dw PokemonTower5AfterBattleText4 ; 0x4a3e TextAfterBattle
	dw PokemonTower5EndBattleText4 ; 0x4a39 TextEndBattle
	dw PokemonTower5EndBattleText4 ; 0x4a39 TextEndBattle
; 0x609d9

db $ff

PokemonTower5Text1: ; 609da (18:49da)
	TX_FAR _PokemonTower5Text1
	db $50

PokemonTower5Text2: ; 609df (18:49df)
	db $08 ; asm
	ld hl, PokemonTower5TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower5BattleText1: ; 609e9 (18:49e9)
	TX_FAR _PokemonTower5BattleText1
	db $50
; 0x609e9 + 5 bytes

PokemonTower5EndBattleText1: ; 609ee (18:49ee)
	TX_FAR _PokemonTower5EndBattleText1
	db $50
; 0x609ee + 5 bytes

PokemonTower5AfterBattleText1: ; 609f3 (18:49f3)
	TX_FAR _PokemonTower5AfterBattleText1
	db $50
; 0x609f3 + 5 bytes

PokemonTower5Text3: ; 609f8 (18:49f8)
	db $08 ; asm
	ld hl, PokemonTower5TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower5BattleText2: ; 60a02 (18:4a02)
	TX_FAR _PokemonTower5BattleText2
	db $50
; 0x60a02 + 5 bytes

PokemonTower5EndBattleText2: ; 60a07 (18:4a07)
	TX_FAR _PokemonTower5EndBattleText2
	db $50
; 0x60a07 + 5 bytes

PokemonTower5AfterBattleText2: ; 60a0c (18:4a0c)
	TX_FAR _PokemonTower5AfterBattleText2
	db $50
; 0x60a0c + 5 bytes

PokemonTower5Text4: ; 60a11 (18:4a11)
	db $08 ; asm
	ld hl, PokemonTower5TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower5BattleText3: ; 60a1b (18:4a1b)
	TX_FAR _PokemonTower5BattleText3
	db $50
; 0x60a1b + 5 bytes

PokemonTower5EndBattleText3: ; 60a20 (18:4a20)
	TX_FAR _PokemonTower5EndBattleText3
	db $50
; 0x60a20 + 5 bytes

PokemonTower5AfterBattleText3: ; 60a25 (18:4a25)
	TX_FAR _PokemonTower5AfterBattleText3
	db $50
; 0x60a25 + 5 bytes

PokemonTower5Text5: ; 60a2a (18:4a2a)
	db $08 ; asm
	ld hl, PokemonTower5TrainerHeader3 ; $49cd
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower5BattleText4: ; 60a34 (18:4a34)
	TX_FAR _PokemonTower5BattleText4
	db $50
; 0x60a34 + 5 bytes

PokemonTower5EndBattleText4: ; 60a39 (18:4a39)
	TX_FAR _PokemonTower5EndBattleText4
	db $50
; 0x60a39 + 5 bytes

PokemonTower5AfterBattleText4: ; 60a3e (18:4a3e)
	TX_FAR _PokemonTower5AfterBattleText4
	db $50
; 0x60a3e + 5 bytes

PokemonTower5Text7: ; 60a43 (18:4a43)
	TX_FAR _UnnamedText_60a43
	db $50
; 0x60a43 + 5 bytes

PokemonTower5Object: ; 0x60a48 (size=65)
	db $1 ; border tile

	db $2 ; warps
	db $9, $3, $0, POKEMONTOWER_4
	db $9, $12, $0, POKEMONTOWER_6

	db $0 ; signs

	db $6 ; people
	db SPRITE_MEDIUM, $8 + 4, $c + 4, $ff, $ff, $1 ; person
	db SPRITE_MEDIUM, $7 + 4, $11 + 4, $ff, $d2, $42, CHANNELER + $C8, $e ; trainer
	db SPRITE_MEDIUM, $3 + 4, $e + 4, $ff, $d2, $43, CHANNELER + $C8, $10 ; trainer
	db SPRITE_MEDIUM, $a + 4, $6 + 4, $ff, $d3, $44, CHANNELER + $C8, $11 ; trainer
	db SPRITE_MEDIUM, $10 + 4, $9 + 4, $ff, $d3, $45, CHANNELER + $C8, $12 ; trainer
	db SPRITE_BALL, $e + 4, $6 + 4, $ff, $ff, $86, NUGGET ; item

	; warp-to
	EVENT_DISP $a, $9, $3 ; POKEMONTOWER_4
	EVENT_DISP $a, $9, $12 ; POKEMONTOWER_6

PokemonTower5Blocks: ; 60a89 (18:4a89)
	INCBIN "maps/pokemontower5.blk"

PokemonTower6_h: ; 0x60ae3 to 0x60aef (12 bytes) (id=147)
	db $0f ; tileset
	db POKEMONTOWER_6_HEIGHT, POKEMONTOWER_6_WIDTH ; dimensions (y, x)
	dw PokemonTower6Blocks, PokemonTower6Texts, PokemonTower6Script ; blocks, texts, scripts
	db $00 ; connections

	dw PokemonTower6Object ; objects

PokemonTower6Script: ; 60aef (18:4aef)
	call EnableAutoTextBoxDrawing
	ld hl, PokemonTower6TrainerHeaders
	ld de, Unknown_60b0d ; $4b0d
	ld a, [W_POKEMONTOWER6CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_POKEMONTOWER6CURSCRIPT], a
	ret
; 0x60b02

; known jump sources: 60b4d (18:4b4d)
Func_60b02: ; 60b02 (18:4b02)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_POKEMONTOWER6CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_60b0d: ; 60b0d (18:4b0d)
INCBIN "baserom.gbc",$60b0d,$60b17 - $60b0d
	ld a, [$d768]
	bit 7, a
	jp nz, CheckFightingMapTrainers
	ld hl, Unknown_60b45 ; $4b45
	call ArePlayerCoordsInArray
	jp nc, CheckFightingMapTrainers
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $6
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $91
	ld [W_CUROPPONENT], a ; $d059
	ld a, $1e
	ld [W_CURENEMYLVL], a ; $d127
	ld a, $4
	ld [W_POKEMONTOWER6CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_60b45: ; 60b45 (18:4b45)
INCBIN "baserom.gbc",$60b45,$60b48 - $60b45
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_60b02
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, [$d72d]
	bit 6, a
	ret nz
	call UpdateSprites
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, [$cf0b]
	and a
	jr nz, .asm_60b82
	ld hl, $d768
	set 7, [hl]
	ld a, $7
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $0
	ld [W_POKEMONTOWER6CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
.asm_60b82
	ld a, $1
	ld [$cd38], a
	ld a, $10
	ld [$ccd3], a
	xor a
	ld [$c206], a
	ld [$cd3b], a
	ld hl, $d730
	set 7, [hl]
	ld a, $3
	ld [W_POKEMONTOWER6CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

INCBIN "baserom.gbc",$60ba1,$60bb1 - $60ba1

PokemonTower6Texts: ; 60bb1 (18:4bb1)
	dw PokemonTower6Text1, PokemonTower6Text2, PokemonTower6Text3, Predef5CText, Predef5CText, PokemonTower6Text6, PokemonTower6Text7

PokemonTower6TrainerHeaders: ; 60bbf (18:4bbf)
PokemonTower6TrainerHeader0: ; 60bbf (18:4bbf)
	db $1 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d768 ; flag's byte
	dw PokemonTower6BattleText1 ; 0x4c29 TextBeforeBattle
	dw PokemonTower6AfterBattleText1 ; 0x4c33 TextAfterBattle
	dw PokemonTower6EndBattleText1 ; 0x4c2e TextEndBattle
	dw PokemonTower6EndBattleText1 ; 0x4c2e TextEndBattle
; 0x60bcb

PokemonTower6TrainerHeader1: ; 60bcb (18:4bcb)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d768 ; flag's byte
	dw PokemonTower6BattleText2 ; 0x4c38 TextBeforeBattle
	dw PokemonTower6AfterBattleText2 ; 0x4c42 TextAfterBattle
	dw PokemonTower6EndBattleText2 ; 0x4c3d TextEndBattle
	dw PokemonTower6EndBattleText2 ; 0x4c3d TextEndBattle
; 0x60bd7

PokemonTower6TrainerHeader2: ; 60bd7 (18:4bd7)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d768 ; flag's byte
	dw PokemonTower6BattleText3 ; 0x4c47 TextBeforeBattle
	dw PokemonTower6AfterBattleText3 ; 0x4c51 TextAfterBattle
	dw PokemonTower6EndBattleText3 ; 0x4c4c TextEndBattle
	dw PokemonTower6EndBattleText3 ; 0x4c4c TextEndBattle
; 0x60be3

db $ff

PokemonTower6Text1: ; 60be4 (18:4be4)
	db $08 ; asm
	ld hl, PokemonTower6TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower6Text2: ; 60bee (18:4bee)
	db $08 ; asm
	ld hl, PokemonTower6TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower6Text3: ; 60bf8 (18:4bf8)
	db $08 ; asm
	ld hl, PokemonTower6TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower6Text7: ; 60c02 (18:4c02)
	db $8
	ld hl, UnnamedText_60c1f
	call PrintText
	ld a, MAROWAK
	call PlayCry
	call WaitForSoundToFinish
	ld c, $1e
	call DelayFrames
	ld hl, UnnamedText_60c24
	call PrintText
	jp TextScriptEnd
; 0x60c1f

UnnamedText_60c1f: ; 60c1f (18:4c1f)
	TX_FAR _UnnamedText_60c1f
	db $50
; 0x60c1f + 5 bytes

UnnamedText_60c24: ; 60c24 (18:4c24)
	TX_FAR _UnnamedText_60c24
	db $50
; 0x60c24 + 5 bytes

PokemonTower6BattleText1: ; 60c29 (18:4c29)
	TX_FAR _PokemonTower6BattleText1
	db $50
; 0x60c29 + 5 bytes

PokemonTower6EndBattleText1: ; 60c2e (18:4c2e)
	TX_FAR _PokemonTower6EndBattleText1
	db $50
; 0x60c2e + 5 bytes

PokemonTower6AfterBattleText1: ; 60c33 (18:4c33)
	TX_FAR _PokemonTower6AfterBattleText1
	db $50
; 0x60c33 + 5 bytes

PokemonTower6BattleText2: ; 60c38 (18:4c38)
	TX_FAR _PokemonTower6BattleText2
	db $50
; 0x60c38 + 5 bytes

PokemonTower6EndBattleText2: ; 60c3d (18:4c3d)
	TX_FAR _PokemonTower6EndBattleText2
	db $50
; 0x60c3d + 5 bytes

PokemonTower6AfterBattleText2: ; 60c42 (18:4c42)
	TX_FAR _PokemonTower6AfterBattleText2
	db $50
; 0x60c42 + 5 bytes

PokemonTower6BattleText3: ; 60c47 (18:4c47)
	TX_FAR _PokemonTower6BattleText3
	db $50
; 0x60c47 + 5 bytes

PokemonTower6EndBattleText3: ; 60c4c (18:4c4c)
	TX_FAR _PokemonTower6EndBattleText3
	db $50
; 0x60c4c + 5 bytes

PokemonTower6AfterBattleText3: ; 60c51 (18:4c51)
	TX_FAR _PokemonTower6AfterBattleText3
	db $50
; 0x60c51 + 5 bytes

PokemonTower6Text6: ; 60c56 (18:4c56)
	TX_FAR _UnnamedText_60c56
	db $50
; 0x60c56 + 5 bytes

PokemonTower6Object: ; 0x60c5b (size=58)
	db $1 ; border tile

	db $2 ; warps
	db $9, $12, $1, POKEMONTOWER_5
	db $10, $9, $0, POKEMONTOWER_7

	db $0 ; signs

	db $5 ; people
	db SPRITE_MEDIUM, $a + 4, $c + 4, $ff, $d3, $41, CHANNELER + $C8, $13 ; trainer
	db SPRITE_MEDIUM, $5 + 4, $9 + 4, $ff, $d0, $42, CHANNELER + $C8, $14 ; trainer
	db SPRITE_MEDIUM, $5 + 4, $10 + 4, $ff, $d2, $43, CHANNELER + $C8, $15 ; trainer
	db SPRITE_BALL, $8 + 4, $6 + 4, $ff, $ff, $84, RARE_CANDY ; item
	db SPRITE_BALL, $e + 4, $e + 4, $ff, $ff, $85, X_ACCURACY ; item

	; warp-to
	EVENT_DISP $a, $9, $12 ; POKEMONTOWER_5
	EVENT_DISP $a, $10, $9 ; POKEMONTOWER_7

PokemonTower6Blocks: ; 60c95 (18:4c95)
	INCBIN "maps/pokemontower6.blk"

INCBIN "baserom.gbc",$60cef,$60cf9 - $60cef

PokemonTower7_h: ; 0x60cf9 to 0x60d05 (12 bytes) (id=148)
	db $0f ; tileset
	db POKEMONTOWER_7_HEIGHT, POKEMONTOWER_7_WIDTH ; dimensions (y, x)
	dw PokemonTower7Blocks, PokemonTower7Texts, PokemonTower7Script ; blocks, texts, scripts
	db $00 ; connections

	dw PokemonTower7Object ; objects

PokemonTower7Script: ; 60d05 (18:4d05)
	call EnableAutoTextBoxDrawing
	ld hl, PokemonTower7TrainerHeaders
	ld de, Unknown_60d23 ; $4d23
	ld a, [W_POKEMONTOWER7CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_POKEMONTOWER7CURSCRIPT], a
	ret
; 0x60d18

; known jump sources: 60d37 (18:4d37)
Func_60d18: ; 60d18 (18:4d18)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_POKEMONTOWER7CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_60d23: ; 60d23 (18:4d23)
INCBIN "baserom.gbc",$60d23,$60d2d - $60d23
	ld hl, W_FLAGS_CD60
	res 0, [hl]
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_60d18
	call EndTrainerBattle
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, [$cf13]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	call Func_60db6
	ld a, $3
	ld [W_POKEMONTOWER7CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
	ld a, [$d730]
	bit 0, a
	ret nz
	ld hl, W_MISSABLEOBJECTLIST
	ld a, [$cf13]
	ld b, a
.missableObjectsListLoop
	ld a, [hli]
	cp b            ; search for sprite ID in missing objects list
	ld a, [hli]
	jr nz, .missableObjectsListLoop
	ld [$cc4d], a   ; remove missable object
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [$cf13], a
	ld [W_TRAINERHEADERFLAGBIT], a
	ld [$da38], a
	ld a, $0
	ld [W_POKEMONTOWER7CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $43
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	ld a, $4
	ld [$c109], a
	ld a, $95
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld a, $1
	ld [$d42f], a
	ld a, $4
	ld [$d365], a
	ld hl, $d72d
	set 3, [hl]
	ld a, $0
	ld [W_POKEMONTOWER7CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

; known jump sources: 60d4a (18:4d4a)
Func_60db6: ; 60db6 (18:4db6)
	ld hl, Unknown_60de3 ; $4de3
	ld a, [$cf13]
	dec a
	swap a
	ld d, $0
	ld e, a
	add hl, de
	ld a, [W_YCOORD] ; $d361
	ld b, a
	ld a, [W_XCOORD] ; $d362
	ld c, a
.asm_60dcb
	ld a, [hli]
	cp b
	jr nz, .asm_60dde
	ld a, [hli]
	cp c
	jr nz, .asm_60ddf
	ld a, [hli]
	ld d, [hl]
	ld e, a
	ld a, [$cf13]
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp MoveSprite
.asm_60dde
	inc hl
.asm_60ddf
	inc hl
	inc hl
	jr .asm_60dcb

Unknown_60de3: ; 60de3 (18:4de3)
INCBIN "baserom.gbc",$60de3,$60e3f - $60de3

PokemonTower7Texts: ; 60e3f (18:4e3f)
	dw PokemonTower7Text1, PokemonTower7Text2, PokemonTower7Text3, PokemonTower7Text4

PokemonTower7TrainerHeaders: ; 60e47 (18:4e47)
PokemonTower7TrainerHeader0: ; 60e47 (18:4e47)
	db $1 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d769 ; flag's byte
	dw PokemonTower7BattleText1 ; 0x4ec9 TextBeforeBattle
	dw PokemonTower7AfterBattleText1 ; 0x4ed3 TextAfterBattle
	dw PokemonTower7EndBattleText1 ; 0x4ece TextEndBattle
	dw PokemonTower7EndBattleText1 ; 0x4ece TextEndBattle
; 0x60e53

PokemonTower7TrainerHeader1: ; 60e53 (18:4e53)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d769 ; flag's byte
	dw PokemonTower7BattleText2 ; 0x4ed8 TextBeforeBattle
	dw PokemonTower7AfterBattleText2 ; 0x4ee2 TextAfterBattle
	dw PokemonTower7EndBattleText2 ; 0x4edd TextEndBattle
	dw PokemonTower7EndBattleText2 ; 0x4edd TextEndBattle
; 0x60e5f

PokemonTower7TrainerHeader2: ; 60e5f (18:4e5f)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d769 ; flag's byte
	dw PokemonTower7BattleText3 ; 0x4ee7 TextBeforeBattle
	dw PokemonTower7AfterBattleText3 ; 0x4ef1 TextAfterBattle
	dw PokemonTower7EndBattleText3 ; 0x4eec TextEndBattle
	dw PokemonTower7EndBattleText3 ; 0x4eec TextEndBattle
; 0x60e6b

db $ff

PokemonTower7Text1: ; 60e6c (18:4e6c)
	db $08 ; asm
	ld hl, PokemonTower7TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower7Text2: ; 60e76 (18:4e76)
	db $08 ; asm
	ld hl, PokemonTower7TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower7Text3: ; 60e80 (18:4e80)
	db $08 ; asm
	ld hl, PokemonTower7TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

PokemonTower7Text4: ; 60e8a (18:4e8a)
	db $08 ; asm
	ld hl, UnnamedText_60ec4
	call PrintText
	ld hl, $d7e0
	set 7, [hl]
	ld hl, $d769
	set 7, [hl]
	ld a, $44
	ld [$cc4d], a
	ld a, $15
	call Predef
	ld a, $17
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, $18
	ld [$cc4d], a
	ld a, $15
	call Predef
	ld a, $4
	ld [W_POKEMONTOWER7CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	jp TextScriptEnd

UnnamedText_60ec4: ; 60ec4 (18:4ec4)
	TX_FAR _UnnamedText_60ec4
	db $50
; 0x60ec4 + 5 bytes

PokemonTower7BattleText1: ; 60ec9 (18:4ec9)
	TX_FAR _PokemonTower7BattleText1
	db $50
; 0x60ec9 + 5 bytes

PokemonTower7EndBattleText1: ; 60ece (18:4ece)
	TX_FAR _PokemonTower7EndBattleText1
	db $50
; 0x60ece + 5 bytes

PokemonTower7AfterBattleText1: ; 60ed3 (18:4ed3)
	TX_FAR _PokemonTower7AfterBattleText1
	db $50
; 0x60ed3 + 5 bytes

PokemonTower7BattleText2: ; 60ed8 (18:4ed8)
	TX_FAR _PokemonTower7BattleText2
	db $50
; 0x60ed8 + 5 bytes

PokemonTower7EndBattleText2: ; 60edd (18:4edd)
	TX_FAR _PokemonTower7EndBattleText2
	db $50
; 0x60edd + 5 bytes

PokemonTower7AfterBattleText2: ; 60ee2 (18:4ee2)
	TX_FAR _PokemonTower7AfterBattleText2
	db $50
; 0x60ee2 + 5 bytes

PokemonTower7BattleText3: ; 60ee7 (18:4ee7)
	TX_FAR _PokemonTower7BattleText3
	db $50
; 0x60ee7 + 5 bytes

PokemonTower7EndBattleText3: ; 60eec (18:4eec)
	TX_FAR _PokemonTower7EndBattleText3
	db $50
; 0x60eec + 5 bytes

PokemonTower7AfterBattleText3: ; 60ef1 (18:4ef1)
	TX_FAR _PokemonTower7AfterBattleText3
	db $50
; 0x60ef1 + 5 bytes

PokemonTower7Object: ; 0x60ef6 (size=42)
	db $1 ; border tile

	db $1 ; warps
	db $10, $9, $1, POKEMONTOWER_6

	db $0 ; signs

	db $4 ; people
	db SPRITE_ROCKET, $b + 4, $9 + 4, $ff, $d3, $41, ROCKET + $C8, $13 ; trainer
	db SPRITE_ROCKET, $9 + 4, $c + 4, $ff, $d2, $42, ROCKET + $C8, $14 ; trainer
	db SPRITE_ROCKET, $7 + 4, $9 + 4, $ff, $d3, $43, ROCKET + $C8, $15 ; trainer
	db SPRITE_MR_FUJI, $3 + 4, $a + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $a, $10, $9 ; POKEMONTOWER_6

PokemonTower7Blocks: ; 60f20 (18:4f20)
	INCBIN "maps/pokemontower7.blk"

CeladonMart1_h: ; 0x60f7a to 0x60f86 (12 bytes) (id=122)
	db $12 ; tileset
	db CELADON_MART_1_HEIGHT, CELADON_MART_1_WIDTH ; dimensions (y, x)
	dw CeladonMart1Blocks, CeladonMart1Texts, CeladonMart1Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeladonMart1Object ; objects

CeladonMart1Script: ; 60f86 (18:4f86)
	jp EnableAutoTextBoxDrawing
; 0x60f89

CeladonMart1Texts: ; 60f89 (18:4f89)
	dw CeladonMart1Text1, CeladonMart1Text2, CeladonMart1Text3

CeladonMart1Text1: ; 60f8f (18:4f8f)
	TX_FAR _CeladonMart1Text1
	db $50

CeladonMart1Text2: ; 60f94 (18:4f94)
	TX_FAR _CeladonMart1Text2
	db $50

CeladonMart1Text3: ; 60f99 (18:4f99)
	TX_FAR _CeladonMart1Text3
	db $50

CeladonMart1Object: ; 0x60f9e (size=64)
	db $f ; border tile

	db $6 ; warps
	db $7, $2, $0, $ff
	db $7, $3, $0, $ff
	db $7, $10, $1, $ff
	db $7, $11, $1, $ff
	db $1, $c, $0, CELADON_MART_2
	db $1, $1, $0, CELADON_MART_ELEVATOR

	db $2 ; signs
	db $4, $b, $2 ; CeladonMart1Text2
	db $1, $e, $3 ; CeladonMart1Text3

	db $1 ; people
	db SPRITE_CABLE_CLUB_WOMAN, $3 + 4, $8 + 4, $ff, $d0, $1 ; person

	; warp-to
	EVENT_DISP $a, $7, $2
	EVENT_DISP $a, $7, $3
	EVENT_DISP $a, $7, $10
	EVENT_DISP $a, $7, $11
	EVENT_DISP $a, $1, $c ; CELADON_MART_2
	EVENT_DISP $a, $1, $1 ; CELADON_MART_ELEVATOR

CeladonMart1Blocks: ; 60fde (18:4fde)
	INCBIN "maps/celadonmart1.blk"

; known jump sources: 75d88 (1d:5d88)
GiveFossilToCinnabarLab: ; 61006 (18:5006)
	ld hl, $d730
	set 6, [hl]
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld a, $3
	ld [W_MENUWATCHEDKEYS], a ; $cc29
	ld a, [$cd37]
	dec a
	ld [W_MAXMENUITEMID], a ; $cc28
	ld a, $2
	ld [W_TOPMENUITEMY], a ; $cc24
	ld a, $1
	ld [W_TOPMENUITEMX], a ; $cc25
	ld a, [$cd37]
	dec a
	ld bc, $2
	ld hl, $3
	call AddNTimes
	dec l
	ld b, l
	ld c, $d
	ld hl, W_SCREENTILESBUFFER
	call TextBoxBorder
	call UpdateSprites
	call Func_610c2
	ld hl, $d730
	res 6, [hl]
	call HandleMenuInput
	bit 1, a
	jr nz, .asm_610a7
	ld hl, $cc5b
	ld a, [W_CURMENUITEMID] ; $cc26
	ld d, $0
	ld e, a
	add hl, de
	ld a, [hl]
	ld [$FF00+$db], a
	cp DOME_FOSSIL
	jr z, .choseDomeFossil
	cp HELIX_FOSSIL
	jr z, .choseHelixFossil
	ld b, AERODACTYL
	jr .fossilSelected
.choseHelixFossil
	ld b, OMANYTE
	jr .fossilSelected
.choseDomeFossil
	ld b, KABUTO
.fossilSelected
	ld [W_FOSSILITEM], a
	ld a, b
	ld [W_FOSSILMON], a
	call LoadFossilItemAndMonName
	ld hl, UnnamedText_610ae
	call PrintText
	call YesNoChoice
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	jr nz, .asm_610a7
	ld hl, UnnamedText_610b3
	call PrintText
	ld a, [W_FOSSILITEM]
	ld [$FF00+$db], a
	ld b, BANK(RemoveItemByID)
	ld hl, RemoveItemByID
	call Bankswitch ; indirect jump to RemoveItemByID (17f37 (5:7f37))
	ld hl, UnnamedText_610b8
	call PrintText
	ld hl, $d7a3
	set 0, [hl]
	set 1, [hl]
	ret
.asm_610a7
	ld hl, UnnamedText_610bd
	call PrintText
	ret
; 610ae (18:50ae)

UnnamedText_610ae: ; 610ae (18:50ae)
	TX_FAR _UnnamedText_610ae
	db $50
; 0x610ae + 5 bytes

UnnamedText_610b3: ; 610b3 (18:50b3)
	TX_FAR _UnnamedText_610b3
	db $50
; 0x610b3 + 5 bytes

UnnamedText_610b8: ; 610b8 (18:50b8)
	TX_FAR _UnnamedText_610b8
	db $50
; 0x610b8 + 5 bytes

UnnamedText_610bd: ; 610bd (18:50bd)
	TX_FAR _UnnamedText_610bd
	db $50
; 0x610bd + 5 bytes

; known jump sources: 6103f (18:503f)
Func_610c2: ; 610c2 (18:50c2)
	ld hl, $cc5b
	xor a
	ld [$FF00+$db], a
.asm_610c8
	ld a, [hli]
	cp $ff
	ret z
	push hl
	ld [$d11e], a
	call GetItemName
	FuncCoord 2, 2 ; $c3ca
	ld hl, Coord
	ld a, [$FF00+$db]
	ld bc, $28
	call AddNTimes
	ld de, $cd6d
	call PlaceString
	ld hl, $ffdb
	inc [hl]
	pop hl
	jr .asm_610c8

; known jump sources: 61074 (18:5074), 75ded (1d:5ded)
; loads the names of the fossil item and the resulting mon
LoadFossilItemAndMonName: ; 610eb (18:50eb)
	ld a, [W_FOSSILMON]
	ld [$d11e], a
	call GetMonName
	call CopyStringToCF4B
	ld a, [W_FOSSILITEM]
	ld [$d11e], a
	call GetItemName
	ret
; 61101 (18:5101)

ViridianForest_h: ; 0x61101 to 0x6110d (12 bytes) (id=51)
	db $03 ; tileset
	db VIRIDIAN_FOREST_HEIGHT, VIRIDIAN_FOREST_WIDTH ; dimensions (y, x)
	dw ViridianForestBlocks, ViridianForestTexts, ViridianForestScript ; blocks, texts, scripts
	db $00 ; connections

	dw ViridianForestObject ; objects

ViridianForestScript: ; 6110d (18:510d)
	call EnableAutoTextBoxDrawing
	ld hl, ViridianForestTrainerHeaders
	ld de, ViridianForestScript_Unknown61120
	ld a, [W_VIRIDIANFORESTCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_VIRIDIANFORESTCURSCRIPT], a
	ret
; 0x61120

ViridianForestScript_Unknown61120: ; 61120 (18:5120)
INCBIN "baserom.gbc",$61120,$61126 - $61120

ViridianForestTexts: ; 61126 (18:5126)
	dw ViridianForestText1, ViridianForestText2, ViridianForestText3, ViridianForestText4, Predef5CText, Predef5CText, Predef5CText, ViridianForestText8, ViridianForestText9, ViridianForestText10, ViridianForestText11, ViridianForestText12, ViridianForestText13, ViridianForestText14

ViridianForestTrainerHeaders: ; 61142 (18:5142)
ViridianForestTrainerHeader0: ; 61142 (18:5142)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7f3 ; flag's byte
	dw ViridianForestBattleText1 ; 0x518a TextBeforeBattle
	dw ViridianForestAfterBattleText1 ; 0x5194 TextAfterBattle
	dw ViridianForestEndBattleText1 ; 0x518f TextEndBattle
	dw ViridianForestEndBattleText1 ; 0x518f TextEndBattle
; 0x6114e

ViridianForestTrainerHeader1: ; 6114e (18:514e)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d7f3 ; flag's byte
	dw ViridianForestBattleText2 ; 0x5199 TextBeforeBattle
	dw ViridianForestAfterBattleText2 ; 0x51a3 TextAfterBattle
	dw ViridianForestEndBattleText2 ; 0x519e TextEndBattle
	dw ViridianForestEndBattleText2 ; 0x519e TextEndBattle
; 0x6115a

ViridianForestTrainerHeader2: ; 6115a (18:515a)
	db $4 ; flag's bit
	db ($1 << 4) ; trainer's view range
	dw $d7f3 ; flag's byte
	dw ViridianForestBattleText3 ; 0x51a8 TextBeforeBattle
	dw ViridianForestAfterBattleText3 ; 0x51b2 TextAfterBattle
	dw ViridianForestEndBattleText3 ; 0x51ad TextEndBattle
	dw ViridianForestEndBattleText3 ; 0x51ad TextEndBattle
; 0x61166

db $ff

ViridianForestText1: ; 61167 (18:5167)
	TX_FAR _ViridianForestText1
	db $50

ViridianForestText2: ; 6116c (18:516c)
	db $08 ; asm
	ld hl, ViridianForestTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

ViridianForestText3: ; 61176 (18:5176)
	db $08 ; asm
	ld hl, ViridianForestTrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

ViridianForestText4: ; 61180 (18:5180)
	db $08 ; asm
	ld hl, ViridianForestTrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

ViridianForestBattleText1: ; 6118a (18:518a)
	TX_FAR _ViridianForestBattleText1
	db $50
; 0x6118a + 5 bytes

ViridianForestEndBattleText1: ; 6118f (18:518f)
	TX_FAR _ViridianForestEndBattleText1
	db $50
; 0x6118f + 5 bytes

ViridianForestAfterBattleText1: ; 61194 (18:5194)
	;TX_FAR _ViridianForestAfterBattleText1
	db $17
	dw _ViridianForestAfterBattleText1
	db BANK(_ViridianForestAfterBattleText1)
	db $50
; 0x61194 + 5 bytes

ViridianForestBattleText2: ; 61199 (18:5199)
	TX_FAR _ViridianForestBattleText2
	db $50
; 0x61199 + 5 bytes

ViridianForestEndBattleText2: ; 6119e (18:519e)
	TX_FAR _ViridianForestEndBattleText2
	db $50
; 0x6119e + 5 bytes

ViridianForestAfterBattleText2: ; 611a3 (18:51a3)
	;TX_FAR _ViridianForestAfterBattleText2
	db $17
	dw _ViridianForestAfterBattleText2
	db BANK(_ViridianForestAfterBattleText2)
	db $50
; 0x611a3 + 5 bytes

ViridianForestBattleText3: ; 611a8 (18:51a8)
	TX_FAR _ViridianForestBattleText3
	db $50
; 0x611a8 + 5 bytes

ViridianForestEndBattleText3: ; 611ad (18:51ad)
	TX_FAR _ViridianForestEndBattleText3
	db $50
; 0x611ad + 5 bytes

ViridianForestAfterBattleText3: ; 611b2 (18:51b2)
	;TX_FAR _ViridianForestAfterBattleText3
	db $17
	dw _ViridianForestAfterBattleText3
	db BANK(_ViridianForestAfterBattleText3)
	db $50
; 0x611b2 + 5 bytes

ViridianForestText8: ; 611b7 (18:51b7)
	TX_FAR _ViridianForestText8
	db $50

ViridianForestText9: ; 611bc (18:51bc)
	TX_FAR _ViridianForestText9
	db $50

ViridianForestText10: ; 611c1 (18:51c1)
	TX_FAR _ViridianForestText10
	db $50

ViridianForestText11: ; 611c6 (18:51c6)
	TX_FAR _ViridianForestText11
	db $50

ViridianForestText12: ; 611cb (18:51cb)
	TX_FAR _ViridianForestText12
	db $50

ViridianForestText13: ; 611d0 (18:51d0)
	TX_FAR _ViridianForestText13
	db $50

ViridianForestText14: ; 611d5 (18:51d5)
	TX_FAR _ViridianForestText14
	db $50

ViridianForestObject: ; 0x611da (size=127)
	db $3 ; border tile

	db $6 ; warps
	db $0, $1, $2, VIRIDIAN_FOREST_EXIT
	db $0, $2, $3, VIRIDIAN_FOREST_EXIT
	db $2f, $f, $1, VIRIDIAN_FOREST_ENTRANCE
	db $2f, $10, $1, VIRIDIAN_FOREST_ENTRANCE
	db $2f, $11, $1, VIRIDIAN_FOREST_ENTRANCE
	db $2f, $12, $1, VIRIDIAN_FOREST_ENTRANCE

	db $6 ; signs
	db $28, $18, $9 ; ViridianForestText9
	db $20, $10, $a ; ViridianForestText10
	db $11, $1a, $b ; ViridianForestText11
	db $18, $4, $c ; ViridianForestText12
	db $2d, $12, $d ; ViridianForestText13
	db $1, $2, $e ; ViridianForestText14

	db $8 ; people
	db SPRITE_BUG_CATCHER, $2b + 4, $10 + 4, $ff, $ff, $1 ; person
	db SPRITE_BUG_CATCHER, $21 + 4, $1e + 4, $ff, $d2, $42, BUG_CATCHER + $C8, $1 ; trainer
	db SPRITE_BUG_CATCHER, $13 + 4, $1e + 4, $ff, $d2, $43, BUG_CATCHER + $C8, $2 ; trainer
	db SPRITE_BUG_CATCHER, $12 + 4, $2 + 4, $ff, $d2, $44, BUG_CATCHER + $C8, $3 ; trainer
	db SPRITE_BALL, $b + 4, $19 + 4, $ff, $ff, $85, ANTIDOTE ; item
	db SPRITE_BALL, $1d + 4, $c + 4, $ff, $ff, $86, POTION ; item
	db SPRITE_BALL, $1f + 4, $1 + 4, $ff, $ff, $87, POKE_BALL ; item
	db SPRITE_BUG_CATCHER, $28 + 4, $1b + 4, $ff, $ff, $8 ; person

	; warp-to
	EVENT_DISP $11, $0, $1 ; VIRIDIAN_FOREST_EXIT
	EVENT_DISP $11, $0, $2 ; VIRIDIAN_FOREST_EXIT
	EVENT_DISP $11, $2f, $f ; VIRIDIAN_FOREST_ENTRANCE
	EVENT_DISP $11, $2f, $10 ; VIRIDIAN_FOREST_ENTRANCE
	EVENT_DISP $11, $2f, $11 ; VIRIDIAN_FOREST_ENTRANCE
	EVENT_DISP $11, $2f, $12 ; VIRIDIAN_FOREST_ENTRANCE

SSAnne1_h: ; 0x61259 to 0x61265 (12 bytes) (id=95)
	db $0d ; tileset
	db SS_ANNE_1_HEIGHT, SS_ANNE_1_WIDTH ; dimensions (y, x)
	dw SSAnne1Blocks, SSAnne1Texts, SSAnne1Script ; blocks, texts, scripts
	db $00 ; connections

	dw SSAnne1Object ; objects

SSAnne1Script: ; 61265 (18:5265)
	call EnableAutoTextBoxDrawing
	ret
; 0x61269

SSAnne1Texts: ; 61269 (18:5269)
	dw SSAnne1Text1, SSAnne1Text2

SSAnne1Text1: ; 6126d (18:526d)
	TX_FAR _SSAnne1Text1
	db $50

SSAnne1Text2: ; 61272 (18:5272)
	TX_FAR _SSAnne1Text2
	db $50

SSAnne1Object: ; 0x61277 (size=104)
	db $c ; border tile

	db $b ; warps
	db $0, $1a, $1, VERMILION_DOCK
	db $0, $1b, $1, VERMILION_DOCK
	db $8, $1f, $0, SS_ANNE_8
	db $8, $17, $1, SS_ANNE_8
	db $8, $13, $2, SS_ANNE_8
	db $8, $f, $3, SS_ANNE_8
	db $8, $b, $4, SS_ANNE_8
	db $8, $7, $5, SS_ANNE_8
	db $6, $2, $6, SS_ANNE_2
	db $f, $25, $5, SS_ANNE_4
	db $10, $3, $0, SS_ANNE_6

	db $0 ; signs

	db $2 ; people
	db SPRITE_WAITER, $6 + 4, $c + 4, $fe, $2, $1 ; person
	db SPRITE_SAILOR, $5 + 4, $1b + 4, $ff, $ff, $2 ; person

	; warp-to
	EVENT_DISP $14, $0, $1a ; VERMILION_DOCK
	EVENT_DISP $14, $0, $1b ; VERMILION_DOCK
	EVENT_DISP $14, $8, $1f ; SS_ANNE_8
	EVENT_DISP $14, $8, $17 ; SS_ANNE_8
	EVENT_DISP $14, $8, $13 ; SS_ANNE_8
	EVENT_DISP $14, $8, $f ; SS_ANNE_8
	EVENT_DISP $14, $8, $b ; SS_ANNE_8
	EVENT_DISP $14, $8, $7 ; SS_ANNE_8
	EVENT_DISP $14, $6, $2 ; SS_ANNE_2
	EVENT_DISP $14, $f, $25 ; SS_ANNE_4
	EVENT_DISP $14, $10, $3 ; SS_ANNE_6

SSAnne1Blocks: ; 612df (18:52df)
	INCBIN "maps/ssanne1.blk"

SSAnne2_h: ; 0x61393 to 0x6139f (12 bytes) (id=96)
	db $0d ; tileset
	db SS_ANNE_2_HEIGHT, SS_ANNE_2_WIDTH ; dimensions (y, x)
	dw SSAnne2Blocks, SSAnne2Texts, SSAnne2Script ; blocks, texts, scripts
	db $00 ; connections

	dw SSAnne2Object ; objects

SSAnne2Script: ; 6139f (18:539f)
	call EnableAutoTextBoxDrawing
	ld hl, SSAnne2Scripts
	ld a, [W_SSANNE2CURSCRIPT]
	jp CallFunctionInTable
; 0x613ab

; known jump sources: 61472 (18:5472)
Func_613ab: ; 613ab (18:53ab)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_SSANNE2CURSCRIPT], a
	ret
; 613b3 (18:53b3)
SSAnne2Scripts: ; 613b3 (18:53b3)
	dw SSAnne2Script0, SSAnne2Script1, SSAnne2Script2, SSAnne2Script3, SSAnne2Script4

SSAnne2Script4: ; 613bd (18:53bd)
	ret
; 0x613be

SSAnne2Script0: ; 613be (18:53be)
	ld hl, Unknown_61411 ; $5411
	call ArePlayerCoordsInArray
	ret nc
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld c, $2
	ld a, $de
	call PlayMusic
	ld a, [$cd3d]
	ld [$ff00+$db], a
	ld a, $71
	ld [$cc4d], a
	ld a, $15
	call Predef
	call Delay3
	ld a, $2
	ld [$ff00+$8c], a
	call SetSpriteMovementBytesToFF
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, [$ff00+$db]
	cp $2
	jr nz, .asm_61400 ; 0x613f9 $5
	ld de, Unknown_6140c ; $540c
	jr .asm_61403 ; 0x613fe $3
.asm_61400
	ld de, Unknown_6140d ; $540d
.asm_61403
	call MoveSprite
	ld a, $1
	ld [W_SSANNE2CURSCRIPT], a
	ret
; 0x6140c

Unknown_6140c: ; 6140c (18:540c)
INCBIN "baserom.gbc",$6140c,$6140d - $6140c

Unknown_6140d: ; 6140d (18:540d)
INCBIN "baserom.gbc",$6140d,$61411 - $6140d

Unknown_61411: ; 61411 (18:5411)
INCBIN "baserom.gbc",$61411,$61416 - $61411

; known jump sources: 61436 (18:5436), 61464 (18:5464), 61475 (18:5475)
Func_61416: ; 61416 (18:5416)
	ld a, [W_XCOORD] ; $d362
	cp $25
	jr nz, .asm_61426
	ld a, $2
	ld [$d528], a
	ld a, $c
	jr .asm_61427
.asm_61426
	xor a
.asm_61427
	ld [$FF00+$8d], a
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp Func_34a6
; 61430 (18:5430)
SSAnne2Script1: ; 61430 (18:5430)
	ld a, [$d730]
	bit 0, a
	ret nz
	call Func_61416
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $2
	ld [$ff00+$8c], a
	call DisplayTextID
	call Delay3
	ld a, $f2
	ld [$d059], a

	; select which team to use during the encounter
	ld a, [W_RIVALSTARTER]
	cp SQUIRTLE
	jr nz, .NotSquirtle ; 0x61451 $4
	ld a, $1
	jr .done
.NotSquirtle
	cp BULBASAUR
	jr nz, .Charmander ; 0x61459 $4
	ld a, $2
	jr .done
.Charmander
	ld a, $3
.done
	ld [W_TRAINERNO], a

	call Func_61416
	ld a, $2
	ld [W_SSANNE2CURSCRIPT], a
	ret
; 0x6146d

SSAnne2Script2: ; 6146d (18:546d)
	ld a, [$d057]
	cp $ff
	jp z, Func_613ab
	call Func_61416
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $3
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $2
	ld [$ff00+$8c], a
	call SetSpriteMovementBytesToFF
	ld a, [$d362]
	cp $25
	jr nz, .asm_61497 ; 0x61490 $5
	ld de, Unknown_614b9 ; $54b9
	jr .asm_6149a ; 0x61495 $3
.asm_61497
	ld de, Unknown_614b7 ; $54b7
.asm_6149a
	ld a, $2
	ld [$ff00+$8c], a
	call MoveSprite
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld b, BANK(Func_9b47)
	ld hl, Func_9b47
	call Bankswitch
	ld a, $3
	ld [W_SSANNE2CURSCRIPT], a
	ret
; 0x614b7

Unknown_614b7: ; 614b7 (18:54b7)
INCBIN "baserom.gbc",$614b7,$614b9 - $614b7

Unknown_614b9: ; 614b9 (18:54b9)
INCBIN "baserom.gbc",$614b9,$614be - $614b9

SSAnne2Script3: ; 614be (18:54be)
	ld a, [$d730]
	bit 0, a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $71
	ld [$cc4d], a
	ld a, $11
	call Predef
	call Func_2307
	ld a, $4
	ld [W_SSANNE2CURSCRIPT], a
	ret
; 0x614db

SSAnne2Texts: ; 614db (18:54db)
	dw SSAnne2Text1, SSAnne2Text2, SSAnne2Text3

SSAnne2Text1: ; 614e1 (18:54e1)
	TX_FAR _SSAnne2Text1
	db $50

SSAnne2Text2: ; 614e6 (18:54e6)
	db $8
	ld hl, SSAnneRivalBeforeBattleText
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, SSAnneRivalDefeatedText
	ld de, SSAnneRivalWonText
	call PreBattleSaveRegisters
	jp TextScriptEnd
; 0x61500

SSAnneRivalBeforeBattleText: ; 61500 (18:5500)
	TX_FAR _SSAnneRivalBeforeBattleText
	db $50
; 0x61500 + 5 bytes

SSAnneRivalDefeatedText: ; 61505 (18:5505)
	TX_FAR _SSAnneRivalDefeatedText
	db $50
; 0x61505 + 5 bytes

SSAnneRivalWonText: ; 6150a (18:550a)
	TX_FAR _SSAnneRivalWonText
	db $50
; 0x6150a + 5 bytes

SSAnne2Text3: ; 6150f (18:550f)
	TX_FAR _SSAnneRivalCaptainText
	db $50
; 0x6150f + 5 bytes

SSAnne2Object: ; 0x61514 (size=90)
	db $c ; border tile

	db $9 ; warps
	db $b, $9, $0, SS_ANNE_9
	db $b, $d, $2, SS_ANNE_9
	db $b, $11, $4, SS_ANNE_9
	db $b, $15, $6, SS_ANNE_9
	db $b, $19, $8, SS_ANNE_9
	db $b, $1d, $a, SS_ANNE_9
	db $4, $2, $8, SS_ANNE_1
	db $c, $2, $1, SS_ANNE_3
	db $4, $24, $0, SS_ANNE_7

	db $0 ; signs

	db $2 ; people
	db SPRITE_WAITER, $7 + 4, $3 + 4, $fe, $1, $1 ; person
	db SPRITE_BLUE, $4 + 4, $24 + 4, $ff, $d0, $42, SONY1 + $C8, $1 ; trainer

	; warp-to
	EVENT_DISP $14, $b, $9 ; SS_ANNE_9
	EVENT_DISP $14, $b, $d ; SS_ANNE_9
	EVENT_DISP $14, $b, $11 ; SS_ANNE_9
	EVENT_DISP $14, $b, $15 ; SS_ANNE_9
	EVENT_DISP $14, $b, $19 ; SS_ANNE_9
	EVENT_DISP $14, $b, $1d ; SS_ANNE_9
	EVENT_DISP $14, $4, $2 ; SS_ANNE_1
	EVENT_DISP $14, $c, $2 ; SS_ANNE_3
	EVENT_DISP $14, $4, $24 ; SS_ANNE_7

SSAnne2Blocks: ; 6156e (18:556e)
	INCBIN "maps/ssanne2.blk"

SSAnne4_h: ; 0x61622 to 0x6162e (12 bytes) (id=98)
	db $0d ; tileset
	db SS_ANNE_4_HEIGHT, SS_ANNE_4_WIDTH ; dimensions (y, x)
	dw SSAnne4Blocks, SSAnne4Texts, SSAnne4Script ; blocks, texts, scripts
	db $00 ; connections

	dw SSAnne4Object ; objects

SSAnne4Script: ; 6162e (18:562e)
	jp EnableAutoTextBoxDrawing
; 0x61631

SSAnne4Texts: ; 61631 (18:5631)
	db $50

SSAnne4Object: ; 0x61632 (size=52)
	db $c ; border tile

	db $6 ; warps
	db $3, $17, $8, SS_ANNE_10
	db $3, $13, $6, SS_ANNE_10
	db $3, $f, $4, SS_ANNE_10
	db $3, $b, $2, SS_ANNE_10
	db $3, $7, $0, SS_ANNE_10
	db $5, $1b, $9, SS_ANNE_1

	db $0 ; signs

	db $0 ; people

	; warp-to
	EVENT_DISP $f, $3, $17 ; SS_ANNE_10
	EVENT_DISP $f, $3, $13 ; SS_ANNE_10
	EVENT_DISP $f, $3, $f ; SS_ANNE_10
	EVENT_DISP $f, $3, $b ; SS_ANNE_10
	EVENT_DISP $f, $3, $7 ; SS_ANNE_10
	EVENT_DISP $f, $5, $1b ; SS_ANNE_1

SSAnne4Blocks: ; 61666 (18:5666)
	INCBIN "maps/ssanne4.blk"

SSAnne5_h: ; 0x616a2 to 0x616ae (12 bytes) (id=99)
	db $0d ; tileset
	db SS_ANNE_5_HEIGHT, SS_ANNE_5_WIDTH ; dimensions (y, x)
	dw SSAnne5Blocks, SSAnne5Texts, SSAnne5Script ; blocks, texts, scripts
	db $00 ; connections

	dw SSAnne5Object ; objects

SSAnne5Script: ; 616ae (18:56ae)
	call EnableAutoTextBoxDrawing
	ld hl, SSAnneTrainerHeader0 ; $56d1
	ld de, SSAnne5Script_Unknown616c1
	ld a, [W_SSANNE5CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SSANNE5CURSCRIPT], a
	ret
; 0x616c1

SSAnne5Script_Unknown616c1: ; 616c1 (18:56c1)
INCBIN "baserom.gbc",$616c1,$616c7 - $616c1

SSAnne5Texts: ; 616c7 (18:56c7)
	dw SSAnne5Text1, SSAnne5Text2, SSAnne5Text3, SSAnne5Text4, SSAnne5Text5

SSAnneTrainerHeaders: ; 616d1 (18:56d1)
SSAnneTrainerHeader0: ; 616d1 (18:56d1)
	db $4 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7ff ; flag's byte
	dw SSAnneBattleText1 ; 0x5703 TextBeforeBattle
	dw SSAnneAfterBattleText1 ; 0x570d TextAfterBattle
	dw SSAnneEndBattleText1 ; 0x5708 TextEndBattle
	dw SSAnneEndBattleText1 ; 0x5708 TextEndBattle
; 0x616dd

SSAnneTrainerHeader1: ; 616dd (18:56dd)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d7ff ; flag's byte
	dw SSAnneBattleText2 ; 0x571c TextBeforeBattle
	dw SSAnneAfterBattleText2 ; 0x5726 TextAfterBattle
	dw SSAnneEndBattleText2 ; 0x5721 TextEndBattle
	dw SSAnneEndBattleText2 ; 0x5721 TextEndBattle
; 0x616e9

db $ff

SSAnne5Text1: ; 616ea (18:56ea)
	TX_FAR _SSAnne5Text1
	db $50

SSAnne5Text2: ; 616ef (18:56ef)
	TX_FAR _SSAnne5Text2
	db $50

SSAnne5Text3: ; 616f4 (18:56f4)
	TX_FAR _SSAnne5Text3
	db $50

SSAnne5Text4: ; 616f9 (18:56f9)
	db $08 ; asm
	ld hl, SSAnneTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SSAnneBattleText1: ; 61703 (18:5703)
	TX_FAR _SSAnneBattleText1
	db $50
; 0x61703 + 5 bytes

SSAnneEndBattleText1: ; 61708 (18:5708)
	TX_FAR _SSAnneEndBattleText1
	db $50
; 0x61708 + 5 bytes

SSAnneAfterBattleText1: ; 6170d (18:570d)
	TX_FAR _SSAnneAfterBattleText1
	db $50
; 0x6170d + 5 bytes

SSAnne5Text5: ; 61712 (18:5712)
	db $08 ; asm
	ld hl, SSAnneTrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SSAnneBattleText2: ; 6171c (18:571c)
	TX_FAR _SSAnneBattleText2
	db $50
; 0x6171c + 5 bytes

SSAnneEndBattleText2: ; 61721 (18:5721)
	TX_FAR _SSAnneEndBattleText2
	db $50
; 0x61721 + 5 bytes

SSAnneAfterBattleText2: ; 61726 (18:5726)
	TX_FAR _SSAnneAfterBattleText2
	db $50
; 0x61726 + 5 bytes

SSAnne5Object: ; 0x6172b (size=54)
	db $23 ; border tile

	db $2 ; warps
	db $6, $d, $0, SS_ANNE_3
	db $7, $d, $0, SS_ANNE_3

	db $0 ; signs

	db $5 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $2 + 4, $5 + 4, $ff, $d1, $1 ; person
	db SPRITE_SAILOR, $9 + 4, $4 + 4, $ff, $ff, $2 ; person
	db SPRITE_BLACK_HAIR_BOY_1, $b + 4, $7 + 4, $ff, $ff, $3 ; person
	db SPRITE_SAILOR, $4 + 4, $4 + 4, $ff, $d0, $44, SAILOR + $C8, $1 ; trainer
	db SPRITE_SAILOR, $8 + 4, $a + 4, $ff, $d1, $45, SAILOR + $C8, $2 ; trainer

	; warp-to
	EVENT_DISP $a, $6, $d ; SS_ANNE_3
	EVENT_DISP $a, $7, $d ; SS_ANNE_3

SSAnne5Blocks: ; 61761 (18:5761)
	INCBIN "maps/ssanne5.blk"

SSAnne6_h: ; 0x617a7 to 0x617b3 (12 bytes) (id=100)
	db $0d ; tileset
	db SS_ANNE_6_HEIGHT, SS_ANNE_6_WIDTH ; dimensions (y, x)
	dw SSAnne6Blocks, SSAnne6Texts, SSAnne6Script ; blocks, texts, scripts
	db $00 ; connections

	dw SSAnne6Object ; objects

SSAnne6Script: ; 617b3 (18:57b3)
	call EnableAutoTextBoxDrawing
	ret
; 0x617b7

SSAnne6Texts: ; 617b7 (18:57b7)
	dw SSAnne6Text1, SSAnne6Text2, SSAnne6Text3, SSAnne6Text4, SSAnne6Text5, SSAnne6Text6, SSAnne6Text7

SSAnne6Text1: ; 617c5 (18:57c5)
	TX_FAR _SSAnne6Text1
	db $50

SSAnne6Text2: ; 617ca (18:57ca)
	TX_FAR _SSAnne6Text2
	db $50

SSAnne6Text3: ; 617cf (18:57cf)
	TX_FAR _SSAnne6Text3
	db $50

SSAnne6Text4: ; 617d4 (18:57d4)
	TX_FAR _SSAnne6Text4
	db $50

SSAnne6Text5: ; 617d9 (18:57d9)
	TX_FAR _SSAnne6Text5
	db $50

SSAnne6Text6: ; 617de (18:57de)
	TX_FAR _SSAnne6Text6
	db $50

SSAnne6Text7: ; 617e3 (18:57e3)
	db $08 ; asm
	ld hl, UnnamedText_61807
	call PrintText
	ldh a, [$d3]
	bit 7, a
	jr z, .asm_93eb1 ; 0x617ee
	ld hl, UnnamedText_6180c
	jr .asm_63292 ; 0x617f3
.asm_93eb1 ; 0x617f5
	bit 4, a
	jr z, .asm_7436c ; 0x617f7
	ld hl, UnnamedText_61811
	jr .asm_63292 ; 0x617fc
.asm_7436c ; 0x617fe
	ld hl, UnnamedText_61816
.asm_63292 ; 0x61801
	call PrintText
	jp TextScriptEnd

UnnamedText_61807: ; 61807 (18:5807)
	TX_FAR _UnnamedText_61807
	db $50
; 0x61807 + 5 bytes

UnnamedText_6180c: ; 6180c (18:580c)
	TX_FAR _UnnamedText_6180c
	db $50
; 0x6180c + 5 bytes

UnnamedText_61811: ; 61811 (18:5811)
	TX_FAR _UnnamedText_61811
	db $50
; 0x61811 + 5 bytes

UnnamedText_61816: ; 61816 (18:5816)
	TX_FAR _UnnamedText_61816
	db $50
; 0x61816 + 5 bytes

SSAnne6Object: ; 0x6181b (size=54)
	db $c ; border tile

	db $1 ; warps
	db $0, $6, $a, SS_ANNE_1

	db $0 ; signs

	db $7 ; people
	db SPRITE_COOK, $8 + 4, $1 + 4, $fe, $1, $1 ; person
	db SPRITE_COOK, $8 + 4, $5 + 4, $fe, $1, $2 ; person
	db SPRITE_COOK, $7 + 4, $9 + 4, $fe, $1, $3 ; person
	db SPRITE_COOK, $6 + 4, $d + 4, $ff, $ff, $4 ; person
	db SPRITE_COOK, $8 + 4, $d + 4, $ff, $ff, $5 ; person
	db SPRITE_COOK, $a + 4, $d + 4, $ff, $ff, $6 ; person
	db SPRITE_COOK, $d + 4, $b + 4, $ff, $d1, $7 ; person

	; warp-to
	EVENT_DISP $7, $0, $6 ; SS_ANNE_1

SSAnne6Blocks: ; 61851 (18:5851)
	INCBIN "maps/ssanne6.blk"

SSAnne7_h: ; 0x61889 to 0x61895 (12 bytes) (id=101)
	db $0d ; tileset
	db SS_ANNE_7_HEIGHT, SS_ANNE_7_WIDTH ; dimensions (y, x)
	dw SSAnne7Blocks, SSAnne7Texts, SSAnne7Script ; blocks, texts, scripts
	db $00 ; connections

	dw SSAnne7Object ; objects

SSAnne7Script: ; 61895 (18:5895)
	call SSAnne7Script_Unknown6189b
	jp EnableAutoTextBoxDrawing
; 0x6189b

SSAnne7Script_Unknown6189b: ; 6189b (18:589b)
	ld a, [$d803]
	bit 1, a
	ret nz
	ld hl, $d72d
	set 5, [hl]
	ret
; 618a7 (18:58a7)
SSAnne7Texts: ; 618a7 (18:58a7)
	dw SSAnne7Text1, SSAnne7Text2, SSAnne7Text3

SSAnne7Text1: ; 618ad (18:58ad)
	db $08 ; asm
	ld a, [$d803]
	bit 0, a
	jr nz, .asm_797c4 ; 0x618b3
	ld hl, SSAnne7RubText
	call PrintText
	ld hl, ReceivingHM01Text
	call PrintText
	ld bc, (HM_01 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedHM01Text
	call PrintText
	ld hl, $d803
	set 0, [hl]
	jr .asm_0faf5 ; 0x618d4
.BagFull
	ld hl, HM01NoRoomText
	call PrintText
	ld hl, $d72d
	set 5, [hl]
	jr .asm_0faf5 ; 0x618e1
.asm_797c4 ; 0x618e3
	ld hl, UnnamedText_61932
	call PrintText
.asm_0faf5 ; 0x618e9
	jp TextScriptEnd

SSAnne7RubText: ; 618ec (18:58ec)
	TX_FAR _SSAnne7RubText ; 0x812dd
	db $8
	ld a, [$c0ef]
	cp $1f
	ld [$c0f0], a
	jr nz, .asm_61908 ; 0x618f9 $d
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld a, $2
	ld [$c0ef], a
.asm_61908
	ld a, $e8
	ld [$c0ee], a
	call PlaySound
.asm_61910
	ld a, [$c026]
	cp $e8
	jr z, .asm_61910 ; 0x61915 $f9
	call Func_2307
	ld hl, $d803
	set 1, [hl]
	ld hl, $d72d
	res 5, [hl]
	jp TextScriptEnd
; 0x61927

ReceivingHM01Text: ; 61927 (18:5927)
	TX_FAR _ReceivingHM01Text
	db $50
; 0x61927 + 5 bytes

ReceivedHM01Text: ; 6192c (18:592c)
	TX_FAR _ReceivedHM01Text ; 0x8140d
	db $11, $50
; 0x6192c + 6 bytes = 0x61932

UnnamedText_61932: ; 61932 (18:5932)
	TX_FAR _UnnamedText_61932
	db $50
; 0x61932 + 5 bytes

HM01NoRoomText: ; 61937 (18:5937)
	TX_FAR _HM01NoRoomText
	db $50
; 0x61937 + 5 bytes

SSAnne7Text2: ; 6193c (18:593c)
	TX_FAR _SSAnne7Text2
	db $50

SSAnne7Text3: ; 61941 (18:5941)
	TX_FAR _SSAnne7Text3
	db $50

SSAnne7Object: ; 0x61946 (size=24)
	db $c ; border tile

	db $1 ; warps
	db $7, $0, $8, SS_ANNE_2

	db $2 ; signs
	db $1, $4, $2 ; SSAnne7Text2
	db $2, $1, $3 ; SSAnne7Text3

	db $1 ; people
	db SPRITE_SS_CAPTAIN, $2 + 4, $4 + 4, $ff, $d1, $1 ; person

	; warp-to
	EVENT_DISP $3, $7, $0 ; SS_ANNE_2

SSAnne7Blocks: ; 6195e (18:595e)
	INCBIN "maps/ssanne7.blk"

SSAnne8_h: ; 0x6196a to 0x61976 (12 bytes) (id=102)
	db $0d ; tileset
	db SS_ANNE_8_HEIGHT, SS_ANNE_8_WIDTH ; dimensions (y, x)
	dw SSAnne8Blocks, SSAnne8Texts, SSAnne8Script ; blocks, texts, scripts
	db $00 ; connections

	dw SSAnne8Object ; objects

SSAnne8Script: ; 61976 (18:5976)
	call EnableAutoTextBoxDrawing
	ld hl, SSAnne8TrainerHeaders
	ld de, SSAnne8Script_Unknown61989
	ld a, [W_SSANNE8CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SSANNE8CURSCRIPT], a
	ret
; 0x61989

SSAnne8Script_Unknown61989: ; 61989 (18:5989)
INCBIN "baserom.gbc",$61989,$6198f - $61989

SSAnne8Texts: ; 6198f (18:598f)
	dw SSAnne8Text1, SSAnne8Text2, SSAnne8Text3, SSAnne8Text4, SSAnne8Text5, SSAnne8Text6, SSAnne8Text7, SSAnne8Text8, SSAnne8Text9, Predef5CText, SSAnne8Text11

SSAnne8TrainerHeaders: ; 619a5 (18:59a5)
SSAnne8TrainerHeader0: ; 619a5 (18:59a5)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d805 ; flag's byte
	dw SSAnne8BattleText1 ; 0x5a0b TextBeforeBattle
	dw SSAnne8AfterBattleText1 ; 0x5a15 TextAfterBattle
	dw SSAnne8EndBattleText1 ; 0x5a10 TextEndBattle
	dw SSAnne8EndBattleText1 ; 0x5a10 TextEndBattle
; 0x619b1

SSAnne8TrainerHeader1: ; 619b1 (18:59b1)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d805 ; flag's byte
	dw SSAnne8BattleText2 ; 0x5a1a TextBeforeBattle
	dw SSAnne8AfterBattleText2 ; 0x5a24 TextAfterBattle
	dw SSAnne8EndBattleText2 ; 0x5a1f TextEndBattle
	dw SSAnne8EndBattleText2 ; 0x5a1f TextEndBattle
; 0x619bd

SSAnne8TrainerHeader2: ; 619bd (18:59bd)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d805 ; flag's byte
	dw SSAnne8BattleText3 ; 0x5a29 TextBeforeBattle
	dw SSAnne8AfterBattleText3 ; 0x5a33 TextAfterBattle
	dw SSAnne8EndBattleText3 ; 0x5a2e TextEndBattle
	dw SSAnne8EndBattleText3 ; 0x5a2e TextEndBattle
; 0x619c9

SSAnne8TrainerHeader3: ; 619c9 (18:59c9)
	db $4 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d805 ; flag's byte
	dw SSAnne8BattleText4 ; 0x5a38 TextBeforeBattle
	dw SSAnne8AfterBattleText4 ; 0x5a42 TextAfterBattle
	dw SSAnne8EndBattleText4 ; 0x5a3d TextEndBattle
	dw SSAnne8EndBattleText4 ; 0x5a3d TextEndBattle
; 0x619d5

db $ff

SSAnne8Text1: ; 619d6 (18:59d6)
	db $08 ; asm
	ld hl, SSAnne8TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SSAnne8Text2: ; 619e0 (18:59e0)
	db $08 ; asm
	ld hl, SSAnne8TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SSAnne8Text3: ; 619ea (18:59ea)
	db $08 ; asm
	ld hl, SSAnne8TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SSAnne8Text4: ; 619f4 (18:59f4)
	db $08 ; asm
	ld hl, SSAnne8TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

SSAnne8Text8: ; 619fe (18:59fe)
	TX_FAR _SSAnne8Text8
	db $08 ; asm
	ld a, WIGGLYTUFF
	call PlayCry
	jp TextScriptEnd

SSAnne8BattleText1: ; 61a0b (18:5a0b)
	TX_FAR _SSAnne8BattleText1
	db $50
; 0x61a0b + 5 bytes

SSAnne8EndBattleText1: ; 61a10 (18:5a10)
	TX_FAR _SSAnne8EndBattleText1
	db $50
; 0x61a10 + 5 bytes

SSAnne8AfterBattleText1: ; 61a15 (18:5a15)
	TX_FAR _SSAnne8AfterBattleText1
	db $50
; 0x61a15 + 5 bytes

SSAnne8BattleText2: ; 61a1a (18:5a1a)
	TX_FAR _SSAnne8BattleText2
	db $50
; 0x61a1a + 5 bytes

SSAnne8EndBattleText2: ; 61a1f (18:5a1f)
	TX_FAR _SSAnne8EndBattleText2
	db $50
; 0x61a1f + 5 bytes

UnnamedText_61a24: ; 61a24 (18:5a24)
	TX_FAR _UnnamedText_61a24
	db $50
; 0x61a24 + 5 bytes

SSAnne8BattleText3: ; 61a29 (18:5a29)
	TX_FAR _SSAnne8BattleText3
	db $50
; 0x61a29 + 5 bytes

SSAnne8EndBattleText3: ; 61a2e (18:5a2e)
	TX_FAR _SSAnne8EndBattleText3
	db $50
; 0x61a2e + 5 bytes

SSAnne8AfterBattleText3: ; 61a33 (18:5a33)
	TX_FAR _SSAnne8AfterBattleText3
	db $50
; 0x61a33 + 5 bytes

SSAnne8BattleText4: ; 61a38 (18:5a38)
	TX_FAR _SSAnne8BattleText4
	db $50
; 0x61a38 + 5 bytes

SSAnne8EndBattleText4: ; 61a3d (18:5a3d)
	TX_FAR _SSAnne8EndBattleText4
	db $50
; 0x61a3d + 5 bytes

SSAnne8AfterBattleText4: ; 61a42 (18:5a42)
	TX_FAR _SSAnne8AfterBattleText4
	db $50
; 0x61a42 + 5 bytes

SSAnne8Text5: ; 61a47 (18:5a47)
	TX_FAR _SSAnne8Text5
	db $50

SSAnne8Text6: ; 61a4c (18:5a4c)
	TX_FAR _SSAnne8Text6
	db $50

SSAnne8Text7: ; 61a51 (18:5a51)
	TX_FAR _SSAnne8Text7
	db $50

SSAnne8Text9: ; 61a56 (18:5a56)
	TX_FAR _SSAnne8Text9
	db $50

SSAnne8Text11: ; 61a5b (18:5a5b)
	TX_FAR _SSAnne8Text11
	db $50

SSAnne8Object: ; 0x61a60 (size=127)
	db $c ; border tile

	db $6 ; warps
	db $0, $0, $2, SS_ANNE_1
	db $0, $a, $3, SS_ANNE_1
	db $0, $14, $4, SS_ANNE_1
	db $a, $0, $5, SS_ANNE_1
	db $a, $a, $6, SS_ANNE_1
	db $a, $14, $7, SS_ANNE_1

	db $0 ; signs

	db $b ; people
	db SPRITE_GENTLEMAN, $3 + 4, $2 + 4, $ff, $d2, $41, GENTLEMAN + $C8, $1 ; trainer
	db SPRITE_GENTLEMAN, $4 + 4, $b + 4, $ff, $d1, $42, GENTLEMAN + $C8, $2 ; trainer
	db SPRITE_BUG_CATCHER, $e + 4, $b + 4, $ff, $d1, $43, YOUNGSTER + $C8, $8 ; trainer
	db SPRITE_LASS, $b + 4, $d + 4, $ff, $d2, $44, LASS + $C8, $b ; trainer
	db SPRITE_GIRL, $3 + 4, $16 + 4, $fe, $1, $5 ; person
	db SPRITE_FAT_BALD_GUY, $e + 4, $0 + 4, $ff, $ff, $6 ; person
	db SPRITE_LITTLE_GIRL, $b + 4, $2 + 4, $ff, $d0, $7 ; person
	db SPRITE_CLEFAIRY, $b + 4, $3 + 4, $ff, $d0, $8 ; person
	db SPRITE_GIRL, $d + 4, $a + 4, $ff, $d3, $9 ; person
	db SPRITE_BALL, $f + 4, $c + 4, $ff, $ff, $8a, TM_08 ; item
	db SPRITE_GENTLEMAN, $d + 4, $15 + 4, $fe, $2, $b ; person

	; warp-to
	EVENT_DISP $c, $0, $0 ; SS_ANNE_1
	EVENT_DISP $c, $0, $a ; SS_ANNE_1
	EVENT_DISP $c, $0, $14 ; SS_ANNE_1
	EVENT_DISP $c, $a, $0 ; SS_ANNE_1
	EVENT_DISP $c, $a, $a ; SS_ANNE_1
	EVENT_DISP $c, $a, $14 ; SS_ANNE_1

SSAnne8Blocks: ; 61adf (18:5adf)
	INCBIN "maps/ssanne8.blk"

SSAnne9_h: ; 0x61b3f to 0x61b4b (12 bytes) (id=103)
	db $0d ; tileset
	db SS_ANNE_9_HEIGHT, SS_ANNE_9_WIDTH ; dimensions (y, x)
	dw SSAnne9Blocks, SSAnne9Texts, SSAnne9Script ; blocks, texts, scripts
	db $00 ; connections

	dw SSAnne9Object ; objects

SSAnne9Script: ; 61b4b (18:5b4b)
	ld a, $1
	ld [$cf0c], a
	xor a
	ld [$cc3c], a
	ld hl, SSAnne9TrainerHeaders
	ld de, SSAnne9Script_Unknown61b64
	ld a, [W_SSANNE9CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SSANNE9CURSCRIPT], a
	ret
; 0x61b64

SSAnne9Script_Unknown61b64: ; 61b64 (18:5b64)
INCBIN "baserom.gbc",$61b64,$61b6a - $61b64

SSAnne9Texts: ; 61b6a (18:5b6a)
	dw SSAnne9Text1, SSAnne9Text2, SSAnne9Text3, SSAnne9Text4, SSAnne9Text5, Predef5CText, SSAnne9Text7, SSAnne9Text8, Predef5CText, SSAnne9Text10, SSAnne9Text11, SSAnne9Text12, SSAnne9Text13

SSAnne9TrainerHeaders: ; 61b84 (18:5b84)
SSAnne9TrainerHeader0: ; 61b84 (18:5b84)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d807 ; flag's byte
	dw SSAnne9BattleText1 ; 0x5c51 TextBeforeBattle
	dw SSAnne9AfterBattleText1 ; 0x5c5b TextAfterBattle
	dw SSAnne9EndBattleText1 ; 0x5c56 TextEndBattle
	dw SSAnne9EndBattleText1 ; 0x5c56 TextEndBattle
; 0x61b90

SSAnne9TrainerHeader1: ; 61b90 (18:5b90)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d807 ; flag's byte
	dw SSAnne9BattleText2 ; 0x5c60 TextBeforeBattle
	dw SSAnne9AfterBattleText2 ; 0x5c6a TextAfterBattle
	dw SSAnne9EndBattleText2 ; 0x5c65 TextEndBattle
	dw SSAnne9EndBattleText2 ; 0x5c65 TextEndBattle
; 0x61b9c

SSAnne9TrainerHeader2: ; 61b9c (18:5b9c)
	db $3 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d807 ; flag's byte
	dw SSAnne9BattleText3 ; 0x5c6f TextBeforeBattle
	dw SSAnne9AfterBattleText3 ; 0x5c79 TextAfterBattle
	dw SSAnne9EndBattleText3 ; 0x5c74 TextEndBattle
	dw SSAnne9EndBattleText3 ; 0x5c74 TextEndBattle
; 0x61ba8

SSAnne9TrainerHeader3: ; 61ba8 (18:5ba8)
	db $4 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d807 ; flag's byte
	dw SSAnne9BattleText4 ; 0x5c7e TextBeforeBattle
	dw SSAnne9AfterBattleText4 ; 0x5c88 TextAfterBattle
	dw SSAnne9EndBattleText4 ; 0x5c83 TextEndBattle
	dw SSAnne9EndBattleText4 ; 0x5c83 TextEndBattle
; 0x61bb4


db $ff

SSAnne9Text1: ; 61bb5 (18:5bb5)
	db $08 ; asm
	ld hl, SSAnne9TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SSAnne9Text2: ; 61bbf (18:5bbf)
	db $08 ; asm
	ld hl, SSAnne9TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SSAnne9Text3: ; 61bc9 (18:5bc9)
	db $08 ; asm
	ld hl, SSAnne9TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SSAnne9Text4: ; 61bd3 (18:5bd3)
	db $08 ; asm
	ld hl, SSAnne9TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

SSAnne9Text5: ; 61bdd (18:5bdd)
	db $08 ; asm
	call SaveScreenTilesToBuffer1
	ld hl, UnnamedText_61bf2
	call PrintText
	call LoadScreenTilesFromBuffer1
	ld a, SNORLAX
	call DisplayPokedex
	jp TextScriptEnd

UnnamedText_61bf2: ; 61bf2 (18:5bf2)
	TX_FAR _UnnamedText_61bf2
	db $50
; 0x61bf2 + 5 bytes

SSAnne9Text7: ; 61bf7 (18:5bf7)
	db $08 ; asm
	ld hl, UnnamedText_61c01
	call PrintText
	jp TextScriptEnd

UnnamedText_61c01: ; 61c01 (18:5c01)
	TX_FAR _UnnamedText_61c01
	db $50
; 0x61c01 + 5 bytes

SSAnne9Text8: ; 61c06 (18:5c06)
	db $08 ; asm
	ld hl, UnnamedText_61c10
	call PrintText
	jp TextScriptEnd

UnnamedText_61c10: ; 61c10 (18:5c10)
	TX_FAR _UnnamedText_61c10
	db $50
; 0x61c10 + 5 bytes

SSAnne9Text10: ; 61c15 (18:5c15)
	db $08 ; asm
	ld hl, UnnamedText_61c1f
	call PrintText
	jp TextScriptEnd

UnnamedText_61c1f: ; 61c1f (18:5c1f)
	TX_FAR _UnnamedText_61c1f
	db $50
; 0x61c1f + 5 bytes

SSAnne9Text11: ; 61c24 (18:5c24)
	db $08 ; asm
	ld hl, UnnamedText_61c2e
	call PrintText
	jp TextScriptEnd

UnnamedText_61c2e: ; 61c2e (18:5c2e)
	TX_FAR _UnnamedText_61c2e
	db $50
; 0x61c2e + 5 bytes

SSAnne9Text12: ; 61c33 (18:5c33)
	db $08 ; asm
	ld hl, UnnamedText_61c3d
	call PrintText
	jp TextScriptEnd

UnnamedText_61c3d: ; 61c3d (18:5c3d)
	TX_FAR _UnnamedText_61c3d
	db $50
; 0x61c3d + 5 bytes

SSAnne9Text13: ; 61c42 (18:5c42)
	db $08 ; asm
	ld hl, UnnamedText_61c4c
	call PrintText
	jp TextScriptEnd

UnnamedText_61c4c: ; 61c4c (18:5c4c)
	TX_FAR _UnnamedText_61c4c
	db $50
; 0x61c4c + 5 bytes

SSAnne9BattleText1: ; 61c51 (18:5c51)
	TX_FAR _SSAnne9BattleText1
	db $50
; 0x61c51 + 5 bytes

SSAnne9EndBattleText1: ; 61c56 (18:5c56)
	TX_FAR _SSAnne9EndBattleText1
	db $50
; 0x61c56 + 5 bytes

SSAnne9AfterBattleText1: ; 61c5b (18:5c5b)
	TX_FAR _SSAnne9AfterBattleText1
	db $50
; 0x61c5b + 5 bytes

SSAnne9BattleText2: ; 61c60 (18:5c60)
	TX_FAR _SSAnne9BattleText2
	db $50
; 0x61c60 + 5 bytes

SSAnne9EndBattleText2: ; 61c65 (18:5c65)
	TX_FAR _SSAnne9EndBattleText2
	db $50
; 0x61c65 + 5 bytes

SSAnne9AfterBattleText2: ; 61c6a (18:5c6a)
	TX_FAR _SSAnne9AfterBattleText2
	db $50
; 0x61c6a + 5 bytes

SSAnne9BattleText3: ; 61c6f (18:5c6f)
	TX_FAR _SSAnne9BattleText3
	db $50
; 0x61c6f + 5 bytes

SSAnne9EndBattleText3: ; 61c74 (18:5c74)
	TX_FAR _SSAnne9EndBattleText3
	db $50
; 0x61c74 + 5 bytes

SSAnne9AfterBattleText3: ; 61c79 (18:5c79)
	TX_FAR _SSAnne9AfterBattleText3
	db $50
; 0x61c79 + 5 bytes

SSAnne9BattleText4: ; 61c7e (18:5c7e)
	TX_FAR _SSAnne9BattleText4
	db $50
; 0x61c7e + 5 bytes

SSAnne9EndBattleText4: ; 61c83 (18:5c83)
	TX_FAR _SSAnne9EndBattleText4
	db $50
; 0x61c83 + 5 bytes

SSAnne9AfterBattleText4: ; 61c88 (18:5c88)
	TX_FAR _SSAnne9AfterBattleText4
	db $50
; 0x61c88 + 5 bytes

SSAnne9Object: ; 0x61c8d (size=188)
	db $c ; border tile

	db $c ; warps
	db $5, $2, $0, SS_ANNE_2
	db $5, $3, $0, SS_ANNE_2
	db $5, $c, $1, SS_ANNE_2
	db $5, $d, $1, SS_ANNE_2
	db $5, $16, $2, SS_ANNE_2
	db $5, $17, $2, SS_ANNE_2
	db $f, $2, $3, SS_ANNE_2
	db $f, $3, $3, SS_ANNE_2
	db $f, $c, $4, SS_ANNE_2
	db $f, $d, $4, SS_ANNE_2
	db $f, $16, $5, SS_ANNE_2
	db $f, $17, $5, SS_ANNE_2

	db $0 ; signs

	db $d ; people
	db SPRITE_GENTLEMAN, $2 + 4, $a + 4, $ff, $d3, $41, GENTLEMAN + $C8, $3 ; trainer
	db SPRITE_FISHER2, $4 + 4, $d + 4, $ff, $d2, $42, FISHER + $C8, $1 ; trainer
	db SPRITE_GENTLEMAN, $e + 4, $0 + 4, $ff, $d3, $43, GENTLEMAN + $C8, $5 ; trainer
	db SPRITE_LASS, $b + 4, $2 + 4, $ff, $d0, $44, LASS + $C8, $c ; trainer
	db SPRITE_GENTLEMAN, $2 + 4, $1 + 4, $ff, $d0, $5 ; person
	db SPRITE_BALL, $1 + 4, $c + 4, $ff, $ff, $86, MAX_ETHER ; item
	db SPRITE_GENTLEMAN, $2 + 4, $15 + 4, $ff, $d0, $7 ; person
	db SPRITE_OLD_PERSON, $1 + 4, $16 + 4, $ff, $d0, $8 ; person
	db SPRITE_BALL, $c + 4, $0 + 4, $ff, $ff, $89, RARE_CANDY ; item
	db SPRITE_GENTLEMAN, $c + 4, $c + 4, $ff, $d0, $a ; person
	db SPRITE_YOUNG_BOY, $e + 4, $b + 4, $ff, $ff, $b ; person
	db SPRITE_BRUNETTE_GIRL, $c + 4, $16 + 4, $ff, $d2, $c ; person
	db SPRITE_FOULARD_WOMAN, $c + 4, $14 + 4, $ff, $d3, $d ; person

	; warp-to
	EVENT_DISP $c, $5, $2 ; SS_ANNE_2
	EVENT_DISP $c, $5, $3 ; SS_ANNE_2
	EVENT_DISP $c, $5, $c ; SS_ANNE_2
	EVENT_DISP $c, $5, $d ; SS_ANNE_2
	EVENT_DISP $c, $5, $16 ; SS_ANNE_2
	EVENT_DISP $c, $5, $17 ; SS_ANNE_2
	EVENT_DISP $c, $f, $2 ; SS_ANNE_2
	EVENT_DISP $c, $f, $3 ; SS_ANNE_2
	EVENT_DISP $c, $f, $c ; SS_ANNE_2
	EVENT_DISP $c, $f, $d ; SS_ANNE_2
	EVENT_DISP $c, $f, $16 ; SS_ANNE_2
	EVENT_DISP $c, $f, $17 ; SS_ANNE_2

SSAnne10_h: ; 0x61d49 to 0x61d55 (12 bytes) (id=104)
	db $0d ; tileset
	db SS_ANNE_10_HEIGHT, SS_ANNE_10_WIDTH ; dimensions (y, x)
	dw SSAnne10Blocks, SSAnne10Texts, SSAnne10Script ; blocks, texts, scripts
	db $00 ; connections

	dw SSAnne10Object ; objects

SSAnne10Script: ; 61d55 (18:5d55)
	call EnableAutoTextBoxDrawing
	ld hl, SSAnne10TrainerHeaders
	ld de, SSAnne10Script_Unknown61d68
	ld a, [W_SSANNE10CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SSANNE10CURSCRIPT], a
	ret
; 0x61d68

SSAnne10Script_Unknown61d68: ; 61d68 (18:5d68)
INCBIN "baserom.gbc",$61d68,$61d6e - $61d68

SSAnne10Texts: ; 61d6e (18:5d6e)
	dw SSAnne10Text1, SSAnne10Text2, SSAnne10Text3, SSAnne10Text4, SSAnne10Text5, SSAnne10Text6, SSAnne10Text7, SSAnne10Text8, Predef5CText, Predef5CText, Predef5CText

SSAnne10TrainerHeaders: ; 61d84 (18:5d84)
SSAnne10TrainerHeader0: ; 61d84 (18:5d84)
	db $1 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d809 ; flag's byte
	dw SSAnne10BattleText1 ; 0x5e16 TextBeforeBattle
	dw SSAnne10AfterBattleText1 ; 0x5e20 TextAfterBattle
	dw SSAnne10EndBattleText1 ; 0x5e1b TextEndBattle
	dw SSAnne10EndBattleText1 ; 0x5e1b TextEndBattle
; 0x61d90

SSAnne10TrainerHeader1: ; 61d90 (18:5d90)
	db $2 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d809 ; flag's byte
	dw SSAnne10BattleText2 ; 0x5e25 TextBeforeBattle
	dw SSAnne10AfterBattleText2 ; 0x5e2f TextAfterBattle
	dw SSAnne10EndBattleText2 ; 0x5e2a TextEndBattle
	dw SSAnne10EndBattleText2 ; 0x5e2a TextEndBattle
; 0x61d9c

SSAnne10TrainerHeader2: ; 61d9c (18:5d9c)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d809 ; flag's byte
	dw SSAnne10BattleText3 ; 0x5e34 TextBeforeBattle
	dw SSAnne10AfterBattleText3 ; 0x5e3e TextAfterBattle
	dw SSAnne10EndBattleText3 ; 0x5e39 TextEndBattle
	dw SSAnne10EndBattleText3 ; 0x5e39 TextEndBattle
; 0x61da8

SSAnne10TrainerHeader3: ; 61da8 (18:5da8)
	db $4 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d809 ; flag's byte
	dw SSAnne10BattleText4 ; 0x5e43 TextBeforeBattle
	dw SSAnne10AfterBattleText4 ; 0x5e4d TextAfterBattle
	dw SSAnne10EndBattleText4 ; 0x5e48 TextEndBattle
	dw SSAnne10EndBattleText4 ; 0x5e48 TextEndBattle
; 0x61db4

SSAnne10TrainerHeader4: ; 61db4 (18:5db4)
	db $5 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d809 ; flag's byte
	dw SSAnne10BattleText5 ; 0x5e52 TextBeforeBattle
	dw SSAnne10AfterBattleText5 ; 0x5e5c TextAfterBattle
	dw SSAnne10EndBattleText5 ; 0x5e57 TextEndBattle
	dw SSAnne10EndBattleText5 ; 0x5e57 TextEndBattle
; 0x61dc0

SSAnne10TrainerHeader5: ; 61dc0 (18:5dc0)
	db $6 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d809 ; flag's byte
	dw SSAnne10BattleText6 ; 0x5e61 TextBeforeBattle
	dw SSAnne10AfterBattleText6 ; 0x5e6b TextAfterBattle
	dw SSAnne10EndBattleText6 ; 0x5e66 TextEndBattle
	dw SSAnne10EndBattleText6 ; 0x5e66 TextEndBattle
; 0x61dcc

db $ff

SSAnne10Text1: ; 61dcd (18:5dcd)
	db $08 ; asm
	ld hl, SSAnne10TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SSAnne10Text2: ; 61dd7 (18:5dd7)
	db $08 ; asm
	ld hl, SSAnne10TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SSAnne10Text3: ; 61de1 (18:5de1)
	db $08 ; asm
	ld hl, SSAnne10TrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

SSAnne10Text4: ; 61deb (18:5deb)
	db $08 ; asm
	ld hl, SSAnne10TrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

SSAnne10Text5: ; 61df5 (18:5df5)
	db $08 ; asm
	ld hl, SSAnne10TrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

SSAnne10Text6: ; 61dff (18:5dff)
	db $08 ; asm
	ld hl, SSAnne10TrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

SSAnne10Text8: ; 61e09 (18:5e09)
	TX_FAR _SSAnne10Text8
	db $8 ; 0x61e0d
	ld a, MACHOKE
	call PlayCry
	jp TextScriptEnd

SSAnne10BattleText1: ; 61e16 (18:5e16)
	TX_FAR _SSAnne10BattleText1
	db $50
; 0x61e16 + 5 bytes

SSAnne10EndBattleText1: ; 61e1b (18:5e1b)
	TX_FAR _SSAnne10EndBattleText1
	db $50
; 0x61e1b + 5 bytes

SSAnne10AfterBattleText1: ; 61e20 (18:5e20)
	TX_FAR _SSAnne10AfterBattleText1
	db $50
; 0x61e20 + 5 bytes

SSAnne10BattleText2: ; 61e25 (18:5e25)
	TX_FAR _SSAnne10BattleText2
	db $50
; 0x61e25 + 5 bytes

SSAnne10EndBattleText2: ; 61e2a (18:5e2a)
	TX_FAR _SSAnne10EndBattleText2
	db $50
; 0x61e2a + 5 bytes

SSAnne10AfterBattleText2: ; 61e2f (18:5e2f)
	TX_FAR _SSAnne10AfterBattleText2
	db $50
; 0x61e2f + 5 bytes

SSAnne10BattleText3: ; 61e34 (18:5e34)
	TX_FAR _SSAnne10BattleText3
	db $50
; 0x61e34 + 5 bytes

SSAnne10EndBattleText3: ; 61e39 (18:5e39)
	TX_FAR _SSAnne10EndBattleText3
	db $50
; 0x61e39 + 5 bytes

SSAnne10AfterBattleText3: ; 61e3e (18:5e3e)
	TX_FAR _SSAnne10AfterBattleText3
	db $50
; 0x61e3e + 5 bytes

SSAnne10BattleText4: ; 61e43 (18:5e43)
	TX_FAR _SSAnne10BattleText4
	db $50
; 0x61e43 + 5 bytes

SSAnne10EndBattleText4: ; 61e48 (18:5e48)
	TX_FAR _SSAnne10EndBattleText4
	db $50
; 0x61e48 + 5 bytes

SSAnne10AfterBattleText4: ; 61e4d (18:5e4d)
	TX_FAR _SSAnne10AfterBattleText4
	db $50
; 0x61e4d + 5 bytes

SSAnne10BattleText5: ; 61e52 (18:5e52)
	TX_FAR _SSAnne10BattleText5
	db $50
; 0x61e52 + 5 bytes

SSAnne10EndBattleText5: ; 61e57 (18:5e57)
	TX_FAR _SSAnne10EndBattleText5
	db $50
; 0x61e57 + 5 bytes

SSAnne10AfterBattleText5: ; 61e5c (18:5e5c)
	TX_FAR _SSAnne10AfterBattleText5
	db $50
; 0x61e5c + 5 bytes

SSAnne10BattleText6: ; 61e61 (18:5e61)
	TX_FAR _SSAnne10BattleText6
	db $50
; 0x61e61 + 5 bytes

SSAnne10EndBattleText6: ; 61e66 (18:5e66)
	TX_FAR _SSAnne10EndBattleText6
	db $50
; 0x61e66 + 5 bytes

SSAnne10AfterBattleText6: ; 61e6b (18:5e6b)
	TX_FAR _SSAnne10AfterBattleText6
	db $50
; 0x61e6b + 5 bytes

SSAnne10Text7: ; 61e70 (18:5e70)
	TX_FAR _SSAnne10Text7
	db $50

SSAnne10Object: ; 0x61e75 (size=165)
	db $c ; border tile

	db $a ; warps
	db $5, $2, $4, SS_ANNE_4
	db $5, $3, $4, SS_ANNE_4
	db $5, $c, $3, SS_ANNE_4
	db $5, $d, $3, SS_ANNE_4
	db $5, $16, $2, SS_ANNE_4
	db $5, $17, $2, SS_ANNE_4
	db $f, $2, $1, SS_ANNE_4
	db $f, $3, $1, SS_ANNE_4
	db $f, $c, $0, SS_ANNE_4
	db $f, $d, $0, SS_ANNE_4

	db $0 ; signs

	db $b ; people
	db SPRITE_SAILOR, $d + 4, $0 + 4, $ff, $d0, $41, SAILOR + $C8, $3 ; trainer
	db SPRITE_SAILOR, $b + 4, $2 + 4, $ff, $d0, $42, SAILOR + $C8, $4 ; trainer
	db SPRITE_SAILOR, $3 + 4, $c + 4, $ff, $d2, $43, SAILOR + $C8, $5 ; trainer
	db SPRITE_SAILOR, $2 + 4, $16 + 4, $ff, $d0, $44, SAILOR + $C8, $6 ; trainer
	db SPRITE_SAILOR, $2 + 4, $0 + 4, $ff, $d3, $45, SAILOR + $C8, $7 ; trainer
	db SPRITE_FISHER2, $4 + 4, $0 + 4, $ff, $d3, $46, FISHER + $C8, $2 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $d + 4, $a + 4, $ff, $d3, $7 ; person
	db SPRITE_SLOWBRO, $c + 4, $b + 4, $ff, $ff, $8 ; person
	db SPRITE_BALL, $2 + 4, $14 + 4, $ff, $ff, $89, ETHER ; item
	db SPRITE_BALL, $2 + 4, $a + 4, $ff, $ff, $8a, TM_44 ; item
	db SPRITE_BALL, $b + 4, $c + 4, $ff, $ff, $8b, MAX_POTION ; item

	; warp-to
	EVENT_DISP $c, $5, $2 ; SS_ANNE_4
	EVENT_DISP $c, $5, $3 ; SS_ANNE_4
	EVENT_DISP $c, $5, $c ; SS_ANNE_4
	EVENT_DISP $c, $5, $d ; SS_ANNE_4
	EVENT_DISP $c, $5, $16 ; SS_ANNE_4
	EVENT_DISP $c, $5, $17 ; SS_ANNE_4
	EVENT_DISP $c, $f, $2 ; SS_ANNE_4
	EVENT_DISP $c, $f, $3 ; SS_ANNE_4
	EVENT_DISP $c, $f, $c ; SS_ANNE_4
	EVENT_DISP $c, $f, $d ; SS_ANNE_4

UndergroundPathNS_h: ; 0x61f1a to 0x61f26 (12 bytes) (id=119)
	db $0b ; tileset
	db UNDERGROUND_PATH_NS_HEIGHT, UNDERGROUND_PATH_NS_WIDTH ; dimensions (y, x)
	dw UndergroundPathNSBlocks, UndergroundPathNSTexts, UndergroundPathNSScript ; blocks, texts, scripts
	db $00 ; connections

	dw UndergroundPathNSObject ; objects

UndergroundPathNSScript: ; 61f26 (18:5f26)
	jp EnableAutoTextBoxDrawing
; 0x61f29

UndergroundPathNSTexts: ; 61f29 (18:5f29)
	db $50

UndergroundPathNSObject: ; 0x61f2a (size=20)
	db $1 ; border tile

	db $2 ; warps
	db $4, $5, $2, PATH_ENTRANCE_ROUTE_5
	db $29, $2, $2, PATH_ENTRANCE_ROUTE_6

	db $0 ; signs

	db $0 ; people

	; warp-to
	EVENT_DISP $4, $4, $5 ; PATH_ENTRANCE_ROUTE_5
	EVENT_DISP $4, $29, $2 ; PATH_ENTRANCE_ROUTE_6

UndergroundPathWE_h: ; 0x61f3e to 0x61f4a (12 bytes) (id=121)
	db $0b ; tileset
	db UNDERGROUND_PATH_WE_HEIGHT, UNDERGROUND_PATH_WE_WIDTH ; dimensions (y, x)
	dw $41f4, UndergroundPathWETexts, UndergroundPathWEScript ; blocks, texts, scripts
	db $00 ; connections

	dw UndergroundPathWEObject ; objects

UndergroundPathWEScript: ; 61f4a (18:5f4a)
	jp EnableAutoTextBoxDrawing
; 0x61f4d

UndergroundPathWETexts: ; 61f4d (18:5f4d)
	db $50

UndergroundPathWEObject: ; 0x61f4e (size=20)
	db $1 ; border tile

	db $2 ; warps
	db $5, $2, $2, PATH_ENTRANCE_ROUTE_7
	db $2, $2f, $2, PATH_ENTRANCE_ROUTE_8

	db $0 ; signs

	db $0 ; people

	; warp-to
	EVENT_DISP $19, $5, $2 ; PATH_ENTRANCE_ROUTE_7
	EVENT_DISP $19, $2, $2f ; PATH_ENTRANCE_ROUTE_8

DiglettsCave_h: ; 0x61f62 to 0x61f6e (12 bytes) (id=197)
	db $11 ; tileset
	db DIGLETTS_CAVE_HEIGHT, DIGLETTS_CAVE_WIDTH ; dimensions (y, x)
	dw DiglettsCaveBlocks, DiglettsCaveTexts, DiglettsCaveScript ; blocks, texts, scripts
	db $00 ; connections

	dw DiglettsCaveObject ; objects

DiglettsCaveScript: ; 61f6e (18:5f6e)
	jp EnableAutoTextBoxDrawing
; 0x61f71

DiglettsCaveTexts: ; 61f71 (18:5f71)
	db $50

DiglettsCaveObject: ; 0x61f72 (size=20)
	db $19 ; border tile

	db $2 ; warps
	db $5, $5, $2, DIGLETTS_CAVE_EXIT
	db $1f, $25, $2, DIGLETTS_CAVE_ENTRANCE

	db $0 ; signs

	db $0 ; people

	; warp-to
	EVENT_DISP $14, $5, $5 ; DIGLETTS_CAVE_EXIT
	EVENT_DISP $14, $1f, $25 ; DIGLETTS_CAVE_ENTRANCE

DiglettsCaveBlocks: ; 61f86 (18:5f86)
	INCBIN "maps/diglettscave.blk"

SilphCo11_h: ; 0x620ee to 0x620fa (12 bytes) (id=235)
	db $10 ; tileset
	db SILPH_CO_11F_HEIGHT, SILPH_CO_11F_WIDTH ; dimensions (y, x)
	dw SilphCo11Blocks, SilphCo11Texts, SilphCo11Script ; blocks, texts, scripts
	db $00 ; connections

	dw SilphCo11Object ; objects

SilphCo11Script: ; 620fa (18:60fa)
	call SilphCo11Script_Unknown62110
	call EnableAutoTextBoxDrawing
	ld hl, SilphCo11TrainerHeaders
	ld de, Unknown_621cf ; $61cf
	ld a, [W_SILPHCO11CURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_SILPHCO11CURSCRIPT], a
	ret
; 0x62110

SilphCo11Script_Unknown62110: ; 62110 (18:6110)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, Unknown_62134 ; $6134
	call Func_62137
	call Func_62163
	ld a, [$d838]
	bit 0, a
	ret nz
	ld a, $20
	ld [$d09f], a
	ld bc, $603
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

Unknown_62134: ; 62134 (18:6134)
INCBIN "baserom.gbc",$62134,$62137 - $62134

; known jump sources: 6211b (18:611b)
Func_62137: ; 62137 (18:6137)
	push hl
	ld hl, $d73f
	ld a, [hli]
	ld b, a
	ld a, [hl]
	ld c, a
	xor a
	ld [$FF00+$e0], a
	pop hl
.asm_62143
	ld a, [hli]
	cp $ff
	jr z, .asm_6215f
	push hl
	ld hl, $ffe0
	inc [hl]
	pop hl
	cp b
	jr z, .asm_62154
	inc hl
	jr .asm_62143
.asm_62154
	ld a, [hli]
	cp c
	jr nz, .asm_62143
	ld hl, $d73f
	xor a
	ld [hli], a
	ld [hl], a
	ret
.asm_6215f
	xor a
	ld [$FF00+$e0], a
	ret

; known jump sources: 6211e (18:611e)
Func_62163: ; 62163 (18:6163)
	ld a, [$FF00+$e0]
	and a
	ret z
	ld hl, $d838
	set 0, [hl]
	ret

; known jump sources: 62252 (18:6252)
Func_6216d: ; 6216d (18:616d)
	ld hl, Unknown_6219b ; $619b
.asm_62170
	ld a, [hli]
	cp $ff
	jr z, .asm_62181
	push hl
	ld [$cc4d], a
	ld a, $11
	call Predef ; indirect jump to RemoveMissableObject (f1d7 (3:71d7))
	pop hl
	jr .asm_62170
.asm_62181
	ld hl, Unknown_62194 ; $6194
.asm_62184
	ld a, [hli]
	cp $ff
	ret z
	push hl
	ld [$cc4d], a
	ld a, $15
	call Predef ; indirect jump to AddMissableObject (f1c8 (3:71c8))
	pop hl
	jr .asm_62184

Unknown_62194: ; 62194 (18:6194)
INCBIN "baserom.gbc",$62194,$6219b - $62194

Unknown_6219b: ; 6219b (18:619b)
INCBIN "baserom.gbc",$6219b,$621c4 - $6219b

; known jump sources: 6222c (18:622c)
Func_621c4: ; 621c4 (18:61c4)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a

; known jump sources: 6220e (18:620e), 62267 (18:6267), 62290 (18:6290), 622b4 (18:62b4)
Func_621c8: ; 621c8 (18:61c8)
	ld [W_SILPHCO11CURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_621cf: ; 621cf (18:61cf)
INCBIN "baserom.gbc",$621cf,$621db - $621cf
	ld a, [$d838]
	bit 7, a
	ret nz
	ld hl, Unknown_62211 ; $6211
	call ArePlayerCoordsInArray
	jp nc, CheckFightingMapTrainers
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [$cf0d], a
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $3
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $3
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call SetSpriteMovementBytesToFF
	ld de, Unknown_62216 ; $6216
	call MoveSprite
	ld a, $3
	jp Func_621c8

Unknown_62211: ; 62211 (18:6211)
INCBIN "baserom.gbc",$62211,$62216 - $62211

Unknown_62216: ; 62216 (18:6216)
INCBIN "baserom.gbc",$62216,$6221a - $62216

; known jump sources: 62240 (18:6240), 62288 (18:6288)
Func_6221a: ; 6221a (18:621a)
	ld [$d528], a
	ld a, $3
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	ld a, b
	ld [$FF00+$8d], a
	jp Func_34a6
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_621c4
	ld a, [$cf0d]
	cp $1
	jr z, .asm_6223c
	ld a, $2
	ld b, $c
	jr .asm_62240
.asm_6223c
	ld a, $8
	ld b, $0
.asm_62240
	call Func_6221a
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $6
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	call GBFadeIn1
	call Func_6216d
	call UpdateSprites
	call Delay3
	call GBFadeOut1
	ld hl, $d838
	set 7, [hl]
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	jp Func_621c8
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $3
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call SetSpriteMovementBytesToFF
	ld a, [$cf0d]
	cp $1
	jr z, .asm_62284
	ld a, $2
	ld b, $c
	jr .asm_62288
.asm_62284
	ld a, $8
	ld b, $0
.asm_62288
	call Func_6221a
	call Delay3
	ld a, $4
	jp Func_621c8
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_62330 ; $6330
	ld de, UnnamedText_62330 ; $6330
	call PreBattleSaveRegisters
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $5
	jp Func_621c8
; 622b7 (18:62b7)
SilphCo11Texts: ; 622b7 (18:62b7)
	dw SilphCo11Text1, SilphCo11Text2, SilphCo11Text3, SilphCo11Text4, SilphCo11Text5, SilphCo11Text6

SilphCo11TrainerHeaders: ; 622c3 (18:62c3)
SilphCo11TrainerHeader0: ; 622c3 (18:62c3)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d837 ; flag's byte
	dw SilphCo11BattleText1 ; 0x6344 TextBeforeBattle
	dw SilphCo11AfterBattleText1 ; 0x634e TextAfterBattle
	dw SilphCo11EndBattleText1 ; 0x6349 TextEndBattle
	dw SilphCo11EndBattleText1 ; 0x6349 TextEndBattle
; 0x622cf

SilphCo11TrainerHeader1: ; 622cf (18:62cf)
	db $5 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d837 ; flag's byte
	dw SilphCo11BattleText2 ; 0x635d TextBeforeBattle
	dw SilphCo11AfterBattleText2 ; 0x6367 TextAfterBattle
	dw SilphCo11EndBattleText2 ; 0x6362 TextEndBattle
	dw SilphCo11EndBattleText2 ; 0x6362 TextEndBattle
; 0x622db

db $ff

SilphCo11Text1: ; 622dc (18:62dc)
	db $08 ; asm
	ld a, [$d838]
	bit 5, a
	jp nz, .asm_62308
	ld hl, SilphCoPresidentText
	call PrintText
	ld bc, (MASTER_BALL << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedSilphCoMasterBallText
	call PrintText
	ld hl, $d838
	set 5, [hl]
	jr .asm_fd405 ; 0x622fe
.BagFull
	ld hl, SilphCoMasterBallNoRoomText
	call PrintText
	jr .asm_fd405 ; 0x62306
.asm_62308 ; 0x62308
	ld hl, UnnamedText_6231c
	call PrintText
.asm_fd405 ; 0x6230e
	jp TextScriptEnd

SilphCoPresidentText: ; 62311 (18:6311)
	TX_FAR _SilphCoPresidentText
	db $50
; 0x62311 + 5 bytes

ReceivedSilphCoMasterBallText: ; 62316 (18:6316)
	TX_FAR _ReceivedSilphCoMasterBallText ; 0x84f63
	db $11, $50
; 0x62316 + 6 bytes = 0x6231c

UnnamedText_6231c: ; 6231c (18:631c)
	TX_FAR _UnnamedText_6231c
	db $50
; 0x6231c + 5 bytes

SilphCoMasterBallNoRoomText: ; 62321 (18:6321)
	TX_FAR _SilphCoMasterBallNoRoomText
	db $50
; 0x62321 + 5 bytes

SilphCo11Text2: ; 62326 (18:6326)
	TX_FAR _SilphCo11Text2
	db $50

SilphCo11Text3: ; 6232b (18:632b)
	TX_FAR _SilphCo11Text3
	db $50

UnnamedText_62330: ; 62330 (18:6330)
	TX_FAR _UnnamedText_62330
	db $50
; 0x62330 + 5 bytes

SilphCo11Text6: ; 62335 (18:6335)
	TX_FAR _UnnamedText_62335
	db $50
; 0x62335 + 5 bytes

SilphCo11Text4: ; 6233a (18:633a)
	db $08 ; asm
	ld hl, SilphCo11TrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

SilphCo11BattleText1: ; 62344 (18:6344)
	TX_FAR _SilphCo11BattleText1
	db $50
; 0x62344 + 5 bytes

SilphCo11EndBattleText1: ; 62349 (18:6349)
	TX_FAR _SilphCo11EndBattleText1
	db $50
; 0x62349 + 5 bytes

SilphCo11AfterBattleText1: ; 6234e (18:634e)
	TX_FAR _SilphCo11AfterBattleText1
	db $50
; 0x6234e + 5 bytes

SilphCo11Text5: ; 62353 (18:6353)
	db $08 ; asm
	ld hl, SilphCo11TrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

SilphCo11BattleText2: ; 6235d (18:635d)
	TX_FAR _SilphCo11BattleText2
	db $50
; 0x6235d + 5 bytes

SilphCo11EndBattleText2: ; 62362 (18:6362)
	TX_FAR _SilphCo11EndBattleText2
	db $50
; 0x62362 + 5 bytes

SilphCo11AfterBattleText2: ; 62367 (18:6367)
	TX_FAR _SilphCo11AfterBattleText2
	db $50
; 0x62367 + 5 bytes

UnknownText_6236c: ; 6236c (18:636c)
	db $8
	ld hl, UnnamedText_6237b
	call PrintText
	ld a, PORYGON
	call DisplayPokedex
	jp TextScriptEnd
; 0x6237b

UnnamedText_6237b: ; 6237b (18:637b)
	TX_FAR _UnnamedText_6237b
	db $50
; 0x6237b + 5 bytes

SilphCo11Object: ; 0x62380 (size=72)
	db $d ; border tile

	db $4 ; warps
	db $0, $9, $1, SILPH_CO_10F
	db $0, $d, $0, SILPH_CO_ELEVATOR
	db $5, $5, $9, $ff
	db $2, $3, $3, SILPH_CO_7F

	db $0 ; signs

	db $5 ; people
	db SPRITE_MR_MASTERBALL, $5 + 4, $7 + 4, $ff, $d0, $1 ; person
	db SPRITE_FOULARD_WOMAN, $5 + 4, $a + 4, $ff, $d0, $2 ; person
	db SPRITE_GIOVANNI, $9 + 4, $6 + 4, $ff, $d0, $43, GIOVANNI + $C8, $2 ; trainer
	db SPRITE_ROCKET, $10 + 4, $3 + 4, $ff, $d1, $44, ROCKET + $C8, $29 ; trainer
	db SPRITE_ROCKET, $9 + 4, $f + 4, $ff, $d1, $45, ROCKET + $C8, $28 ; trainer

	; warp-to
	EVENT_DISP $9, $0, $9 ; SILPH_CO_10F
	EVENT_DISP $9, $0, $d ; SILPH_CO_ELEVATOR
	EVENT_DISP $9, $5, $5
	EVENT_DISP $9, $2, $3 ; SILPH_CO_7F

SilphCo11Blocks: ; 623c8 (18:63c8)
	INCBIN "maps/silphco11.blk"

GymStatues: ; 62419 (18:6419)
; if in a gym and have the corresponding badge, a = $D and jp Func_3ef5
; if in a gym and don’t have the corresponding badge, a = $C and jp Func_3ef5
; else ret 
	call EnableAutoTextBoxDrawing
	ld a, [$c109]
	cp $4
	ret nz
	ld hl, .BadgeFlags
	ld a, [W_CURMAP]
	ld b, a
.asm_62429
	ld a, [hli]
	cp $ff
	ret z
	cp b
	jr z, .asm_62433 ; 0x6242e $3
	inc hl
	jr .asm_62429 ; 0x62431 $f6
.asm_62433
	ld b, [hl]
	ld a, [$d72a]
	and b
	cp b
	ld a, $d
	jr z, .asm_6243f ; 0x6243b $2
	ld a, $c
.asm_6243f
	jp Func_3ef5

.BadgeFlags: ; 62442 (18:6442)
	db PEWTER_GYM,   %00000001
	db CERULEAN_GYM, %00000010
	db VERMILION_GYM,%00000100
	db CELADON_GYM,  %00001000
	db FUCHSIA_GYM,  %00010000
	db SAFFRON_GYM,  %00100000
	db CINNABAR_GYM, %01000000
	db VIRIDIAN_GYM, %10000000
	db $ff

UnnamedText_62453: ; 62453 (18:6453)
	TX_FAR _UnnamedText_62453
	db $50
; 0x62453 + 5 bytes

UnnamedText_62458: ; 62458 (18:6458)
	TX_FAR _UnnamedText_62458
	db $50
; 0x62458 + 5 bytes

INCBIN "baserom.gbc",$6245d,$624a3 - $6245d

UnnamedText_624a3: ; 624a3 (18:64a3)
	TX_FAR _UnnamedText_624a3
	db $50
; 0x624a3 + 5 bytes

UnnamedText_624a8: ; 624a8 (18:64a8)
	TX_FAR _UnnamedText_624a8
	db $50
; 0x624a8 + 5 bytes

UnnamedText_624ad: ; 624ad (18:64ad)
	TX_FAR _UnnamedText_624ad
	db $50
; 0x624ad + 5 bytes

UnnamedText_624b2: ; 624b2 (18:64b2)
	TX_FAR _UnnamedText_624b2
	db $50
; 0x624b2 + 5 bytes

UnnamedText_624b7: ; 624b7 (18:64b7)
	TX_FAR _UnnamedText_624b7
	db $50
; 0x624b7 + 5 bytes

UnnamedText_624bc: ; 624bc (18:64bc)
	TX_FAR _UnnamedText_624bc
	db $50
; 0x624bc + 5 bytes

UnnamedText_624c1: ; 624c1 (18:64c1)
	TX_FAR _UnnamedText_624c1
	db $50
; 0x624c1 + 5 bytes

UnnamedText_624c6: ; 624c6 (18:64c6)
	TX_FAR _UnnamedText_624c6
	db $50
; 0x624c6 + 5 bytes

UnnamedText_624cb: ; 624cb (18:64cb)
	TX_FAR _UnnamedText_624cb
	db $50
; 0x624cb + 5 bytes

UnnamedText_624d0: ; 624d0 (18:64d0)
	TX_FAR _UnnamedText_624d0
	db $50
; 0x624d0 + 5 bytes

UnnamedText_624d5: ; 624d5 (18:64d5)
	TX_FAR _UnnamedText_624d5
	db $50
; 0x624d5 + 5 bytes

UnnamedText_624da: ; 624da (18:64da)
	TX_FAR _UnnamedText_624da
	db $50
; 0x624da + 5 bytes

UnnamedText_624df: ; 624df (18:64df)
	TX_FAR _UnnamedText_624df
	db $50
; 0x624df + 5 bytes

UnnamedText_624e4: ; 624e4 (18:64e4)
	db $8
	ld a, [$d838]
	bit 7, a
	ld hl, UnnamedText_624fd
	jr nz, .asm_624f2 ; 0x624ed $3
	ld hl, UnnamedText_624f8
.asm_624f2
	call PrintText
	jp TextScriptEnd
; 0x624f8

UnnamedText_624f8: ; 624f8 (18:64f8)
	TX_FAR _UnnamedText_624f8
	db $50
; 0x624f8 + 5 bytes

UnnamedText_624fd: ; 624fd (18:64fd)
	TX_FAR _UnnamedText_624fd
	db $50
; 0x624fd + 5 bytes

UnnamedText_62502: ; 62502 (18:6502)
	TX_FAR _UnnamedText_62502
	db $50
; 0x62502 + 5 bytes

INCBIN "baserom.gbc",$62507,$62511 - $62507

UnnamedText_62511: ; 62511 (18:6511)
	TX_FAR _UnnamedText_62511
	db $50
; 0x62511 + 5 bytes

	ld a, [$c109]
	cp $4
	ret nz
	call EnableAutoTextBoxDrawing
	ld a, $1
	ld [$cf0c], a
	ld a, $1f
	jp Func_3ef5

INCBIN "baserom.gbc",$62529,$6252a - $62529

SECTION "bank19",ROMX,BANK[$19]

Tset00_GFX: ; 64000 (19:4000)
	INCBIN "gfx/tilesets/00.2bpp"
Tset00_Block: ; 645e0 (19:45e0)
	INCBIN "gfx/blocksets/00.bst"
Tset01_GFX: ; 64de0 (19:4de0)
	INCBIN "gfx/tilesets/01.2bpp"
Tset01_Block: ; 65270 (19:5270)
	INCBIN "gfx/blocksets/01.bst"
Tset08_GFX: ; 653a0 (19:53a0)
	INCBIN "gfx/tilesets/08.2bpp"
Tset08_Block: ; 65980 (19:5980)
	INCBIN "gfx/blocksets/08.bst"
Tset13_GFX: ; 65bb0 (19:5bb0)
	INCBIN "gfx/tilesets/13.2bpp"
Tset13_Block: ; 66190 (19:6190)
	INCBIN "gfx/blocksets/13.bst"
Tset0E_GFX: ; 66610 (19:6610)
	INCBIN "gfx/tilesets/0e.2bpp"
Tset0E_Block: ; 66bf0 (19:6bf0)
	INCBIN "gfx/blocksets/0e.bst"
Tset10_GFX: ; 66d60 (19:6d60)
	INCBIN "gfx/tilesets/10.2bpp"
Tset10_Block: ; 67350 (19:7350)
	INCBIN "gfx/blocksets/10.bst"
Tset17_GFX: ; 676f0 (19:76f0)
	INCBIN "gfx/tilesets/17.2bpp"
Tset17_Block: ; 67b50 (19:7b50)
	INCBIN "gfx/blocksets/17.bst"

SECTION "bank1A",ROMX,BANK[$1A]

DecrementPP: ; 68000 (1a:4000)
; after using a move, decrement pp in battle and (if not transformed?) in party
	ld a, [de]
	cp a, STRUGGLE
	ret z                ; if the pokemon is using "struggle", there's nothing to do
	                     ; we don't decrement PP for "struggle"
	ld hl, W_PLAYERBATTSTATUS1
	ld a, [hli]          ; load the W_PLAYERBATTSTATUS1 pokemon status flags and increment hl to load the
	                     ; W_PLAYERBATTSTATUS2 status flags later
	and a, 7             ; check to see if bits 0, 1, or 2 are set
	ret nz               ; if any of these statuses are true, don't decrement PP
	bit 6, [hl]          ; check 6th bit status flag on W_PLAYERBATTSTATUS2
	ret nz               ; and return if it is set
	ld hl, $D02D         ; PP of first move (in battle)
	call .DecrementPP

	ld a, [$D064]        ; load pokemon status bits?
	bit 3, a             ; XXX transform status?
	ret nz               ; If it is, return.  Pokemon Red stores the "current pokemon's" PP
	                     ; separately from the "Pokemon in your party's" PP.  This is
	                     ; duplication -- in all cases *other* than Pokemon with Transform.
	                     ; Normally, this means we have to go on and make the same     
	                     ; modification to the "party's pokemon" PP that we made to the
	                     ; "current pokemon's" PP.  But, if we're dealing with a Transformed
	                     ; Pokemon, it has separate PP for the move set that it copied from
	                     ; its opponent, which is *not* the same as its real PP as part of your
	                     ; party.  So we return, and don't do that part.

	ld hl, $D188         ; PP of first move (in party)
	ld a, [$CC2F]        ; which mon in party is active
	ld bc, $2C           ; XXX probably size of party pokemon's data structure
	call AddNTimes       ; calculate address of the mon to modify
.DecrementPP
	ld a, [$CC2E]        ; which move (0, 1, 2, 3) did we use?
	ld c, a
	ld b, 0
	add hl ,bc           ; calculate the address in memory of the PP we need to decrement
	                     ; based on the move chosen.
	dec [hl]             ; Decrement PP
	ret
; 0x6802f

Version_GFX: ; 6802f (1a:402f)
IF _RED
	INCBIN "gfx/red/redgreenversion.1bpp"
	; 80 bytes
ENDC
IF _BLUE
	INCBIN "gfx/blue/blueversion.1bpp"
	; 64 bytes
ENDC

Tset05_GFX: ; 6807f (1a:407f)
	INCBIN "gfx/tilesets/05.2bpp"
Tset05_Block: ; 6867f (1a:467f)
	INCBIN "gfx/blocksets/05.bst"
Tset02_GFX: ; 68dbf (1a:4dbf)
	INCBIN "gfx/tilesets/02.2bpp"
Tset02_Block: ; 693bf (1a:53bf)
	INCBIN "gfx/blocksets/02.bst"
Tset09_GFX: ; 6960f (1a:560f)
	INCBIN "gfx/tilesets/09.2bpp"
Tset09_Block: ; 69bff (1a:5bff)
	INCBIN "gfx/blocksets/09.bst"
Tset03_GFX: ; 6a3ff (1a:63ff)
	INCBIN "gfx/tilesets/03.2bpp"
Tset03_Block: ; 6a9ff (1a:69ff)
	INCBIN "gfx/blocksets/03.bst"
Tset16_GFX: ; 6b1ff (1a:71ff)
	INCBIN "gfx/tilesets/16.2bpp"
Tset16_Block: ; 6b7ff (1a:77ff)
	INCBIN "gfx/blocksets/16.bst"

SECTION "bank1B",ROMX,BANK[$1B]

Tset0F_GFX: ; 6c000 (1b:4000)
	INCBIN "gfx/tilesets/0f.2bpp"
Tset0F_Block: ; 6c5c0 (1b:45c0)
	INCBIN "gfx/blocksets/0f.bst"
Tset11_GFX: ; 6cca0 (1b:4ca0)
	INCBIN "gfx/tilesets/11.2bpp"
Tset11_Block: ; 6d0c0 (1b:50c0)
	INCBIN "gfx/blocksets/11.bst"
Tset12_GFX: ; 6d8c0 (1b:58c0)
	INCBIN "gfx/tilesets/12.2bpp"
Tset12_Block: ; 6dea0 (1b:5ea0)
	INCBIN "gfx/blocksets/12.bst"
Tset0D_GFX: ; 6e390 (1b:6390)
	INCBIN "gfx/tilesets/0d.2bpp"
Tset0D_Block: ; 6e930 (1b:6930)
	INCBIN "gfx/blocksets/0d.bst"
Tset14_GFX: ; 6ed10 (1b:6d10)
	INCBIN "gfx/tilesets/14.2bpp"
Tset14_Block: ; 6f2d0 (1b:72d0)
	INCBIN "gfx/blocksets/14.bst"
Tset15_GFX: ; 6f670 (1b:7670)
	INCBIN "gfx/tilesets/15.2bpp"
Tset15_Block: ; 6fb20 (1b:7b20)
	INCBIN "gfx/blocksets/15.bst"
Tset0B_GFX: ; 6fd60 (1b:7d60)
	INCBIN "gfx/tilesets/0b.2bpp"
Tset0B_Block: ; 6fef0 (1b:7ef0)
	INCBIN "gfx/blocksets/0b.bst"

SECTION "bank1C",ROMX,BANK[$1C]

; known jump sources: 70044 (1c:4044)
Func_70000: ; 70000 (1c:4000)
	ld a, $f9
	ld [rOBP0], a ; $FF00+$48
	ld a, $a4
	ld [rOBP1], a ; $FF00+$49
	ld de, AnimationTileset2 + $30 ; $471e ; star tile (top left quadrant)
	ld hl, $8a00
	ld bc, (BANK(AnimationTileset2) << 8) + $01
	call CopyVideoData
	ld de, AnimationTileset2 + $130 ; $481e ; star tile (bottom left quadrant)
	ld hl, $8a10
	ld bc, (BANK(AnimationTileset2) << 8) + $01
	call CopyVideoData
	ld de, Unknown_70190 ; $4190
	ld hl, $8a20
	ld bc, (BANK(Unknown_70190) << 8) + $01
	call CopyVideoData
	ld hl, Unknown_70140 ; $4140
	ld de, $c360
	ld bc, $40
	call CopyData
	ld hl, Unknown_70180 ; $4180
	ld de, W_OAMBUFFER
	ld bc, $10
	jp CopyData

; known jump sources: 418c4 (10:58c4)
Func_70044: ; 70044 (1c:4044)
	call Func_70000
	ld a, $c2
	call PlaySound
	ld hl, W_OAMBUFFER
	ld bc, $a004
.asm_70052
	push hl
	push bc
.asm_70054
	ld a, [hl]
	add $4
	ld [hli], a
	ld a, [hl]
	add $fc
	ld [hli], a
	inc hl
	inc hl
	dec c
	jr nz, .asm_70054
	ld c, $1
	call CheckForUserInterruption
	pop bc
	pop hl
	ret c
	ld a, [hl]
	cp $50
	jr nz, .asm_70070
	jr .asm_70052
.asm_70070
	cp b
	jr nz, .asm_70052
	ld hl, W_OAMBUFFER
	ld c, $4
	ld de, $4
.asm_7007b
	ld [hl], $a0
	add hl, de
	dec c
	jr nz, .asm_7007b
	ld b, $3
.asm_70083
	ld hl, rOBP0 ; $ff48
	rrc [hl]
	rrc [hl]
	ld c, $a
	call CheckForUserInterruption
	ret c
	dec b
	jr nz, .asm_70083
	ld de, W_OAMBUFFER
	ld a, $18
.asm_70098
	push af
	ld hl, Unknown_700ee ; $40ee
	ld bc, $4
	call CopyData
	pop af
	dec a
	jr nz, .asm_70098
	xor a
	ld [W_WHICHTRADE], a ; $cd3d
	ld hl, Unknown_700f2 ; $40f2
	ld c, $6
.asm_700af
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	push bc
	push hl
	ld hl, $c350
	ld c, $4
.asm_700ba
	ld a, [de]
	cp $ff
	jr z, .asm_700d5
	ld [hli], a
	inc de
	ld a, [de]
	ld [hli], a
	inc de
	inc hl
	inc hl
	dec c
	jr nz, .asm_700ba
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $18
	jr z, .asm_700d5
	add $6
	ld [W_WHICHTRADE], a ; $cd3d
.asm_700d5
	call Func_7011f
	push af
	ld hl, $c310
	ld de, W_OAMBUFFER
	ld bc, $50
	call CopyData
	pop af
	pop hl
	pop bc
	ret c
	dec c
	jr nz, .asm_700af
	and a
	ret

Unknown_700ee: ; 700ee (1c:40ee)
INCBIN "baserom.gbc",$700ee,$700f2 - $700ee

Unknown_700f2: ; 700f2 (1c:40f2)
INCBIN "baserom.gbc",$700f2,$7011f - $700f2

; known jump sources: 700d5 (1c:40d5)
Func_7011f: ; 7011f (1c:411f)
	ld b, $8
.asm_70121
	ld hl, $c35c
	ld a, [W_WHICHTRADE] ; $cd3d
	ld de, $fffc
	ld c, a
.asm_7012b
	inc [hl]
	add hl, de
	dec c
	jr nz, .asm_7012b
	ld a, [rOBP1] ; $FF00+$49
	xor $a0
	ld [rOBP1], a ; $FF00+$49
	ld c, $3
	call CheckForUserInterruption
	ret c
	dec b
	jr nz, .asm_70121
	ret

Unknown_70140: ; 70140 (1c:4140)
INCBIN "baserom.gbc",$70140,$70180 - $70140

Unknown_70180: ; 70180 (1c:4180)
INCBIN "baserom.gbc",$70180,$70190 - $70180

Unknown_70190: ; 70190 (1c:4190)
INCBIN "baserom.gbc",$70190,$701a0 - $70190

; known jump sources: 74061 (1d:4061)
Func_701a0: ; 701a0 (1c:41a0)
	call Func_70423
	call ClearScreen
	ld c, $64
	call DelayFrames
	call LoadFontTilePatterns
	call LoadTextBoxTilePatterns
	call DisableLCD
	ld hl, $9800
	ld bc, $800
	ld a, $7f
	call FillMemory
	call EnableLCD
	ld hl, rLCDC ; $ff40
	set 3, [hl]
	xor a
	ld hl, $cc5b
	ld bc, $60
	call FillMemory
	xor a
	ld [$cfcb], a
	ld [$FF00+$d7], a
	ld [W_SPRITEFLIPPED], a
	ld [$d358], a
	ld [$cd40], a
	inc a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld hl, $d5a2
	ld a, [hl]
	inc a
	jr z, .asm_701eb
	inc [hl]
.asm_701eb
	ld a, $90
	ld [$FF00+$b0], a
	ld c, $1f
	ld a, $ca
	call PlayMusic
	ld hl, W_PARTYMON1 ; $d164
	ld c, $ff
.asm_701fb
	ld a, [hli]
	cp $ff
	jr z, .asm_70241
	inc c
	push hl
	push bc
	ld [W_WHICHTRADE], a ; $cd3d
	ld a, c
	ld [$cd3e], a
	ld hl, W_PARTYMON1_LEVEL ; $d18c
	ld bc, $2c
	call AddNTimes
	ld a, [hl]
	ld [$cd3f], a
	call Func_70278
	call Func_702e1
	ld c, $50
	call DelayFrames
	FuncCoord 2, 13 ; $c4a6
	ld hl, Coord
	ld b, $3
	ld c, $e
	call TextBoxBorder
	FuncCoord 4, 15 ; $c4d0
	ld hl, Coord
	ld de, Unknown_7026b ; $426b
	call PlaceString
	ld c, $b4
	call DelayFrames
	call GBFadeOut2
	pop bc
	pop hl
	jr .asm_701fb
.asm_70241
	ld a, c
	inc a
	ld hl, $cc5b
	ld bc, $10
	call AddNTimes
	ld [hl], $ff
	call Func_73b0d
	xor a
	ld [W_WHICHTRADE], a ; $cd3d
	inc a
	ld [$cd40], a
	call Func_70278
	call Func_70377
	call Func_70423
	xor a
	ld [$FF00+$b0], a
	ld hl, rLCDC ; $ff40
	res 3, [hl]
	ret

Unknown_7026b: ; 7026b (1c:426b)
INCBIN "baserom.gbc",$7026b,$70278 - $7026b

; known jump sources: 70217 (1c:4217), 70259 (1c:4259)
Func_70278: ; 70278 (1c:4278)
	call ClearScreen
	ld a, $d0
	ld [$FF00+$af], a
	ld a, $c0
	ld [$FF00+$ae], a
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [$cf91], a
	ld [$d0b5], a
	ld [$cfd9], a
	ld [$cf1d], a
	ld a, [$cd40]
	and a
	jr z, .asm_7029d
	call Func_7033e
	jr .asm_702ab
.asm_7029d
	FuncCoord 12, 5 ; $c410
	ld hl, Coord
	call GetMonHeader
	call LoadFrontSpriteByMonIndex
	ld a, $4
	call Predef ; indirect jump to LoadMonBackSprite (3f103 (f:7103))
.asm_702ab
	ld b, $b
	ld c, $0
	call GoPAL_SET
	ld a, $e4
	ld [rBGP], a ; $FF00+$47
	ld c, $31
	call Func_7036d
	ld d, $a0
	ld e, $4
	ld a, [$cf1b]
	and a
	jr z, .asm_702c7
	sla e
.asm_702c7
	call .asm_702d5
	xor a
	ld [$FF00+$af], a
	ld c, a
	call Func_7036d
	ld d, $0
	ld e, $fc
.asm_702d5
	call DelayFrame
	ld a, [$FF00+$ae]
	add e
	ld [$FF00+$ae], a
	cp d
	jr nz, .asm_702d5
	ret

; known jump sources: 7021a (1c:421a)
Func_702e1: ; 702e1 (1c:42e1)
	ld a, [$cd3e]
	ld hl, W_PARTYMON1NAME ; $d2b5
	call GetPartyMonName
	call Func_702f0
	jp Func_70404

; known jump sources: 702ea (1c:42ea), 7666d (1d:666d)
Func_702f0: ; 702f0 (1c:42f0)
	FuncCoord 0, 2 ; $c3c8
	ld hl, Coord
	ld b, $9
	ld c, $a
	call TextBoxBorder
	FuncCoord 2, 6 ; $c41a
	ld hl, Coord
	ld de, Unknown_70329 ; $4329
	call PlaceString
	FuncCoord 1, 4 ; $c3f1
	ld hl, Coord
	ld de, $cd6d
	call PlaceString
	ld a, [$cd3f]
	FuncCoord 8, 7 ; $c434
	ld hl, Coord
	call PrintLevelCommon
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [$d0b5], a
	FuncCoord 3, 9 ; $c457
	ld hl, Coord
	ld a, $4b
	call Predef ; indirect jump to Func_27d6b (27d6b (9:7d6b))
	ld a, [W_WHICHTRADE] ; $cd3d
	jp PlayCry

Unknown_70329: ; 70329 (1c:4329)
INCBIN "baserom.gbc",$70329,$7033e - $70329

; known jump sources: 70298 (1c:4298)
Func_7033e: ; 7033e (1c:433e)
	ld de, Unknown_72ede ; $6ede
	ld a, $4
	call UncompressSpriteFromDE
	ld hl, S_SPRITEBUFFER1
	ld de, $a000
	ld bc, $310
	call CopyData
	ld de, $9000
	call InterlaceMergeSpriteBuffers
	ld de, RedPicBack ; $7e0a
	ld a, BANK(RedPicBack)
	call UncompressSpriteFromDE
	ld a, $3
	call Predef ; indirect jump to ScaleSpriteByTwo (2fe40 (b:7e40))
	ld de, $9310
	call InterlaceMergeSpriteBuffers
	ld c, $1

; known jump sources: 702b8 (1c:42b8), 702ce (1c:42ce)
Func_7036d: ; 7036d (1c:436d)
	ld b, $0
	FuncCoord 12, 5 ; $c410
	ld hl, Coord
	ld a, $31
	jp Predef ; indirect jump to Func_79dda (79dda (1e:5dda))

; known jump sources: 7025c (1c:425c)
Func_70377: ; 70377 (1c:4377)
	ld hl, $d747
	set 3, [hl]
	ld a, $56
	call Predef ; indirect jump to DisplayDexRating (44169 (11:4169))
	FuncCoord 0, 4 ; $c3f0
	ld hl, Coord
	ld b, $6
	ld c, $a
	call TextBoxBorder
	FuncCoord 5, 0 ; $c3a5
	ld hl, Coord
	ld b, $2
	ld c, $9
	call TextBoxBorder
	FuncCoord 7, 2 ; $c3cf
	ld hl, Coord
	ld de, W_PLAYERNAME ; $d158
	call PlaceString
	FuncCoord 1, 6 ; $c419
	ld hl, Coord
	ld de, Unknown_703ea ; $43ea
	call PlaceString
	FuncCoord 5, 7 ; $c431
	ld hl, Coord
	ld de, $da41
	ld bc, $103
	call PrintNumber
	ld [hl], $6d
	inc hl
	ld de, $da43
	ld bc, $8102
	call PrintNumber
	FuncCoord 1, 9 ; $c455
	ld hl, Coord
	ld de, Unknown_703f4 ; $43f4
	call PlaceString
	FuncCoord 4, 10 ; $c46c
	ld hl, Coord
	ld de, W_PLAYERMONEY3 ; $d347
	ld c, $a3
	call PrintBCDNumber
	ld hl, UnnamedText_703fa ; $43fa
	call Func_703e2
	ld hl, UnnamedText_703ff ; $43ff
	call Func_703e2
	ld hl, $cc5d

; known jump sources: 703d6 (1c:43d6), 703dc (1c:43dc)
Func_703e2: ; 703e2 (1c:43e2)
	call PrintText
	ld c, $78
	jp DelayFrames

Unknown_703ea: ; 703ea (1c:43ea)
INCBIN "baserom.gbc",$703ea,$703f4 - $703ea

Unknown_703f4: ; 703f4 (1c:43f4)
INCBIN "baserom.gbc",$703f4,$703fa - $703f4

UnnamedText_703fa: ; 703fa (1c:43fa)
	TX_FAR _UnnamedText_703fa
	db $50
; 0x703fa + 5 bytes

UnnamedText_703ff: ; 703ff (1c:43ff)
	TX_FAR _UnnamedText_703ff
	db $50
; 0x703ff + 5 bytes

; known jump sources: 702ed (1c:42ed)
Func_70404: ; 70404 (1c:4404)
	ld hl, $cc5b
	ld bc, $10
	ld a, [$cd3e]
	call AddNTimes
	ld a, [W_WHICHTRADE] ; $cd3d
	ld [hli], a
	ld a, [$cd3f]
	ld [hli], a
	ld e, l
	ld d, h
	ld hl, $cd6d
	ld bc, $b
	jp CopyData

; known jump sources: 701a0 (1c:41a0), 7025f (1c:425f)
Func_70423: ; 70423 (1c:4423)
	ld a, $a
	ld [$cfc8], a
	ld [$cfc9], a
	ld a, $ff
	ld [$cfc7], a
	jp GBFadeOut2

; known jump sources: 7027 (1:7027)
Func_70433: ; 70433 (1c:4433)
	ld de, Unknown_704b7 ; $44b7
	ld hl, $87c0
	ld bc, (BANK(Unknown_704b7) << 8) + $03
	call CopyVideoData
	ld hl, $cfcb
	ld a, [hl]
	push af
	ld [hl], $ff
	push hl
	ld a, [rOBP1] ; $FF00+$49
	push af
	ld a, $e0
	ld [rOBP1], a ; $FF00+$49
	ld hl, $c384
	ld de, Unknown_704d7 ; $44d7
	call Func_70503
	ld a, $4
	ld [$cfc7], a
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
.asm_70464
	ld a, [$cfc7]
	and a
	jr nz, .asm_70464
	ld a, [W_NUMINPARTY] ; $d163
	ld b, a
.asm_7046e
	call Func_70503
	ld a, $9e
	call PlaySound
	ld c, $1e
	call DelayFrames
	dec b
	jr nz, .asm_7046e
	ld a, [$c0ef]
	cp $1f
	ld [$c0f0], a
	jr nz, .asm_70495
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld a, $2
	ld [$c0ef], a
.asm_70495
	ld a, $e8
	ld [$c0ee], a
	call PlaySound
	ld d, $28
	call Func_704f3
.asm_704a2
	ld a, [$c026]
	cp $e8
	jr z, .asm_704a2
	ld c, $20
	call DelayFrames
	pop af
	ld [rOBP1], a ; $FF00+$49
	pop hl
	pop af
	ld [hl], a
	jp UpdateSprites

Unknown_704b7: ; 704b7 (1c:44b7)
INCBIN "baserom.gbc",$704b7,$704d7 - $704b7

Unknown_704d7: ; 704d7 (1c:44d7)
INCBIN "baserom.gbc",$704d7,$704f3 - $704d7

; known jump sources: 7049f (1c:449f), 708f3 (1c:48f3)
Func_704f3: ; 704f3 (1c:44f3)
	ld b, $8
.asm_704f5
	ld a, [rOBP1] ; $FF00+$49
	xor d
	ld [rOBP1], a ; $FF00+$49
	ld c, $a
	call DelayFrames
	dec b
	jr nz, .asm_704f5
	ret

; known jump sources: 70454 (1c:4454), 7046e (1c:446e)
Func_70503: ; 70503 (1c:4503)
	ld a, [de]
	inc de
	ld [hli], a
	ld a, [de]
	inc de
	ld [hli], a
	ld a, [de]
	inc de
	ld [hli], a
	ld a, [de]
	inc de
	ld [hli], a
	ret

; known jump sources: 3de (0:3de)
Func_70510: ; 70510 (1c:4510)
	call Func_706ef
	ld a, $ec
	ld [$c104], a
	call Delay3
	push hl
	call GBFadeIn2
	ld hl, W_FLAGS_D733
	bit 7, [hl]
	res 7, [hl]
	jr nz, .asm_70568
	ld a, $a0
	call PlaySound
	ld hl, $d732
	bit 4, [hl]
	res 4, [hl]
	pop hl
	jr nz, .asm_7055e
	call Func_705aa
	ld a, $a3
	call PlaySound
	call Func_70787
	ld a, b
	and a
	jr nz, .asm_7055b
	ld hl, W_WHICHTRADE ; $cd3d
	xor a
	ld [hli], a
	inc a
	ld [hli], a
	ld a, $8
	ld [hli], a
	ld [hl], $ff
	ld hl, $cd48
	call Func_70730
.asm_70558
	call Func_2307
.asm_7055b
	jp Func_70772
.asm_7055e
	ld c, $32
	call DelayFrames
	call Func_705aa
	jr .asm_7055b
.asm_70568
	pop hl
	ld de, BirdSprite ; $4d80
	ld hl, $8000
	ld bc, (BANK(BirdSprite) << 8) + $0c
	call CopyVideoData
	call Func_706d7
	ld a, $a4
	call PlaySound
	ld hl, W_WHICHTRADE ; $cd3d
	xor a
	ld [hli], a
	ld a, $c
	ld [hli], a
	ld [hl], $8
	ld de, Unknown_70592 ; $4592
	call Func_706ae
	call LoadPlayerSpriteGraphics
	jr .asm_70558

Unknown_70592: ; 70592 (1c:4592)
INCBIN "baserom.gbc",$70592,$705aa - $70592

; known jump sources: 70537 (1c:4537), 70563 (1c:4563)
Func_705aa: ; 705aa (1c:45aa)
	ld hl, W_WHICHTRADE ; $cd3d
	ld a, $10
	ld [hli], a
	ld a, $3c
	ld [hli], a
	call Func_7077f
	ld [hl], a
	jp Func_70755

; known jump sources: 994 (0:994)
_DoFlyOrTeleportAwayGraphics: ; 705ba (1c:45ba)
	call Func_706ef
	call Func_70787
	ld a, b
	and a
	jr z, .asm_705ef
	dec a
	jp nz, Func_7067d
.asm_705c8
	ld a, $9f
	call PlaySound
	ld hl, W_WHICHTRADE ; $cd3d
	ld a, $f0
	ld [hli], a
	ld a, $ec
	ld [hli], a
	call Func_7077f
	ld [hl], a
	call Func_70755
	call Func_70787
	ld a, b
	dec a
	jr z, .asm_705e9
	ld c, $a
	call DelayFrames
.asm_705e9
	call GBFadeOut2
	jp Func_70772
.asm_705ef
	ld a, $4
	call StopMusic
	ld a, [$d732]
	bit 6, a
	jr z, .asm_70610
	ld hl, W_WHICHTRADE ; $cd3d
	ld a, $10
	ld [hli], a
	ld a, $ff
	ld [hli], a
	xor a
	ld [hli], a
	ld [hl], $a1
	ld hl, $cd48
	call Func_70730
	jr .asm_705c8
.asm_70610
	call Func_706d7
	ld hl, W_WHICHTRADE ; $cd3d
	ld a, $ff
	ld [hli], a
	ld a, $8
	ld [hli], a
	ld [hl], $c
	call Func_706ae
	ld a, $a4
	call PlaySound
	ld hl, W_WHICHTRADE ; $cd3d
	xor a
	ld [hli], a
	ld a, $c
	ld [hli], a
	ld [hl], $c
	ld de, Unknown_7064f ; $464f
	call Func_706ae
	ld c, $28
	call DelayFrames
	ld hl, $cd3e
	ld a, $b
	ld [hli], a
	ld [hl], $8
	ld de, Unknown_70667 ; $4667
	call Func_706ae
	call GBFadeOut2
	jp Func_70772

Unknown_7064f: ; 7064f (1c:464f)
INCBIN "baserom.gbc",$7064f,$70667 - $7064f

Unknown_70667: ; 70667 (1c:4667)
INCBIN "baserom.gbc",$70667,$7067d - $70667

; known jump sources: 705c5 (1c:45c5)
Func_7067d: ; 7067d (1c:467d)
	ld a, $ff
	ld [$cfcb], a
	ld a, [$c302]
	ld [$c30a], a
	ld a, [$c306]
	ld [$c30e], a
	ld a, $a0
	ld [W_OAMBUFFER], a
	ld [$c304], a
	ld c, $2
	call DelayFrames
	ld a, $a0
	ld [$c308], a
	ld [$c30c], a
	call GBFadeOut2
	ld a, $1
	ld [$cfcb], a
	jp Func_70772

; known jump sources: 7058a (1c:458a), 7061e (1c:461e), 70633 (1c:4633), 70646 (1c:4646), 706d4 (1c:46d4)
Func_706ae: ; 706ae (1c:46ae)
	ld a, [$cd3f]
	xor $1
	ld [$cd3f], a
	ld [$c102], a
	call Delay3
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $ff
	jr z, .asm_706cd
	ld hl, $c104
	ld a, [de]
	inc de
	ld [hli], a
	inc hl
	ld a, [de]
	inc de
	ld [hl], a
.asm_706cd
	ld a, [$cd3e]
	dec a
	ld [$cd3e], a
	jr nz, Func_706ae
	ret

; known jump sources: 70575 (1c:4575), 70610 (1c:4610)
Func_706d7: ; 706d7 (1c:46d7)
	ld de, BirdSprite ; $4d80
	ld hl, $8000
	ld bc, (BANK(BirdSprite) << 8) + $0c
	call CopyVideoData
	ld de, BirdSprite + $c0 ; $4e40 ; moving amination sprite
	ld hl, $8800
	ld bc, (BANK(BirdSprite) << 8) + $0c
	jp CopyVideoData

; known jump sources: 70510 (1c:4510), 705ba (1c:45ba)
Func_706ef: ; 706ef (1c:46ef)
	ld a, [$c102]
	ld [$cd50], a
	ld a, [$c104]
	ld [$cd4f], a
	ld hl, Unknown_70713 ; $4713
	ld de, $cd48
	ld bc, $4
	call CopyData
	ld a, [$c102]
	ld hl, $cd48
.asm_7070d
	cp [hl]
	inc hl
	jr nz, .asm_7070d
	dec hl
	ret

Unknown_70713: ; 70713 (1c:4713)
INCBIN "baserom.gbc",$70713,$70717 - $70713

; known jump sources: 70730 (1c:4730), 70755 (1c:4755)
Func_70717: ; 70717 (1c:4717)
	ld a, [hl]
	ld [$c102], a
	push hl
	ld hl, $cd48
	ld de, $cd47
	ld bc, $4
	call CopyData
	ld a, [$cd47]
	ld [$cd4b], a
	pop hl
	ret

; known jump sources: 70555 (1c:4555), 7060b (1c:460b), 70753 (1c:4753)
Func_70730: ; 70730 (1c:4730)
	call Func_70717
	ld a, [W_WHICHTRADE] ; $cd3d
	ld c, a
	and $3
	jr nz, .asm_70743
	ld a, [$cd40]
	cp $ff
	call nz, PlaySound
.asm_70743
	ld a, [$cd3e]
	add c
	ld [W_WHICHTRADE], a ; $cd3d
	ld c, a
	ld a, [$cd3f]
	cp c
	ret z
	call DelayFrames
	jr Func_70730

; known jump sources: 705b7 (1c:45b7), 705da (1c:45da), 70770 (1c:4770)
Func_70755: ; 70755 (1c:4755)
	call Func_70717
	ld a, [W_WHICHTRADE] ; $cd3d
	ld c, a
	ld a, [$c104]
	add c
	ld [$c104], a
	ld c, a
	ld a, [$cd3e]
	cp c
	ret z
	ld a, [$cd3f]
	ld c, a
	call DelayFrames
	jr Func_70755

; known jump sources: 7055b (1c:455b), 705ec (1c:45ec), 7064c (1c:464c), 706ab (1c:46ab)
Func_70772: ; 70772 (1c:4772)
	ld a, [$cd4f]
	ld [$c104], a
	ld a, [$cd50]
	ld [$c102], a
	ret

; known jump sources: 705b3 (1c:45b3), 705d6 (1c:45d6)
Func_7077f: ; 7077f (1c:477f)
	ld a, [$cf1b]
	xor $1
	inc a
	inc a
	ret

; known jump sources: 77e (0:77e), 7053f (1c:453f), 705bd (1c:45bd), 705dd (1c:45dd)
Func_70787: ; 70787 (1c:4787)
	ld b, $0
	ld hl, Unknown_707a9 ; $47a9
	ld a, [W_CURMAPTILESET] ; $d367
	ld c, a
.asm_70790
	ld a, [hli]
	cp $ff
	jr z, .asm_707a4
	cp c
	jr nz, .asm_7079e
	FuncCoord 8, 9 ; $c45c
	ld a, [Coord]
	cp [hl]
	jr z, .asm_707a2
.asm_7079e
	inc hl
	inc hl
	jr .asm_70790
.asm_707a2
	inc hl
	ld b, [hl]
.asm_707a4
	ld a, b
	ld [$cd5b], a
	ret

Unknown_707a9: ; 707a9 (1c:47a9)
INCBIN "baserom.gbc",$707a9,$707b6 - $707a9

; known jump sources: e2ad (3:62ad)
Func_707b6: ; 707b6 (1c:47b6)
	ld c, $a
	call DelayFrames
	ld hl, $d736
	set 6, [hl]
	ld de, RedSprite ; $4180
	ld hl, $8000
	ld bc, (BANK(RedSprite) << 8) + $0c
	call CopyVideoData
	ld a, $4
	ld hl, Unknown_70866 ; $4866
	call Func_71771
	ld a, [$c102]
	ld c, a
	ld b, $0
	ld hl, Unknown_70856 ; $4856
	add hl, bc
	ld de, $c39c
	ld bc, $4
	call CopyData
	ld c, $64
	call DelayFrames
	ld a, [W_WHICHTRADE] ; $cd3d
	and a
	ld hl, UnnamedText_70847 ; $4847
	jr z, .asm_70836
	cp $2
	ld hl, UnnamedText_7084c ; $484c
	jr z, .asm_70836
	ld b, $a
.asm_707fe
	ld hl, $c104
	call Func_70842
	ld hl, $c39c
	call Func_70842
	call Delay3
	dec b
	jr nz, .asm_707fe
	ld a, [$c102]
	cp $4
	jr nz, .asm_7081c
	ld a, $a0
	ld [$c39c], a
.asm_7081c
	ld hl, $cd4f
	xor a
	ld [hli], a
	ld [hl], a
	ld a, $4c
	call Predef ; indirect jump to Func_17c47 (17c47 (5:7c47))
	ld a, [$c102]
	cp $4
	jr nz, .asm_70833
	ld a, $44
	ld [$c39c], a
.asm_70833
	ld hl, UnnamedText_70851 ; $4851
.asm_70836
	call PrintText
	ld hl, $d736
	res 6, [hl]
	call LoadFontTilePatterns
	ret

; known jump sources: 70801 (1c:4801), 70807 (1c:4807)
Func_70842: ; 70842 (1c:4842)
	ld a, [hl]
	xor $1
	ld [hl], a
	ret
; 70847 (1c:4847)
UnnamedText_70847: ; 70847 (1c:4847)
	TX_FAR _UnnamedText_70847
	db $50
; 0x70847 + 5 bytes

UnnamedText_7084c: ; 7084c (1c:484c)
	TX_FAR _UnnamedText_7084c
	db $50
; 0x7084c + 5 bytes

UnnamedText_70851: ; 70851 (1c:4851)
	TX_FAR _UnnamedText_70851
	db $50
; 0x70851 + 5 bytes

Unknown_70856: ; 70856 (1c:4856)
INCBIN "baserom.gbc",$70856,$70866 - $70856

Unknown_70866: ; 70866 (1c:4866)
INCBIN "baserom.gbc",$70866,$7087e - $70866

; known jump sources: 3a3 (0:3a3)
_HandleMidJump: ; 7087e (1c:487e)
	ld a, [$d714]
	ld c, a
	inc a
	cp $10
	jr nc, .asm_70895
	ld [$d714], a
	ld b, $0
	ld hl, Unknown_708ba ; $48ba
	add hl, bc
	ld a, [hl]
	ld [$c104], a
	ret
.asm_70895
	ld a, [W_WALKCOUNTER] ; $cfc5
	cp $0
	ret nz
	call UpdateSprites
	call Delay3
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [H_NEWLYPRESSEDBUTTONS], a
	ld [H_NEWLYRELEASEDBUTTONS], a
	ld [$d714], a
	ld hl, $d736
	res 6, [hl]
	ld hl, $d730
	res 7, [hl]
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ret

Unknown_708ba: ; 708ba (1c:48ba)
INCBIN "baserom.gbc",$708ba,$708ca - $708ba

; known jump sources: 58e20 (16:4e20)
Func_708ca: ; 708ca (1c:48ca)
	ld a, $e4
	ld [rOBP1], a ; $FF00+$49
	call Func_7092a
	FuncCoord 12, 0 ; $c3ac
	ld hl, Coord
	ld bc, $707
	call ClearScreenArea
	call Delay3
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, $91
	ld [$cee9], a
	ld a, $1
	ld [H_WHOSETURN], a ; $FF00+$f3
	ld hl, Func_79793
	ld b, BANK(Func_79793)
	call Bankswitch ; indirect jump to Func_79793 (79793 (1e:5793))
	ld d, $80
	call Func_704f3
.asm_708f6
	ld c, $a
	call DelayFrames
	ld a, [rOBP1] ; $FF00+$49
	sla a
	sla a
	ld [rOBP1], a ; $FF00+$49
	jr nz, .asm_708f6
	call CleanLCD_OAM
	call Func_7092a
	ld b, $e4
.asm_7090d
	ld c, $a
	call DelayFrames
	ld a, [rOBP1] ; $FF00+$49
	srl b
	rra
	srl b
	rra
	ld [rOBP1], a ; $FF00+$49
	ld a, b
	and a
	jr nz, .asm_7090d
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Delay3
	jp CleanLCD_OAM

; known jump sources: 708ce (1c:48ce), 70908 (1c:4908)
Func_7092a: ; 7092a (1c:492a)
	ld de, $9000
	ld hl, $8000
	ld bc, $31
	call CopyVideoData
	ld a, $10
	ld [W_BASECOORDY], a ; $d082
	ld a, $70
	ld [W_BASECOORDX], a ; $d081
	ld hl, W_OAMBUFFER
	ld bc, $606
	ld d, $8
.asm_70948
	push bc
	ld a, [W_BASECOORDY] ; $d082
	ld e, a
.asm_7094d
	ld a, e
	add $8
	ld e, a
	ld [hli], a
	ld a, [W_BASECOORDX] ; $d081
	ld [hli], a
	ld a, d
	ld [hli], a
	ld a, $10
	ld [hli], a
	inc d
	dec c
	jr nz, .asm_7094d
	inc d
	ld a, [W_BASECOORDX] ; $d081
	add $8
	ld [W_BASECOORDX], a ; $d081
	pop bc
	dec b
	jr nz, .asm_70948
	ret

; known jump sources: 3ec52 (f:6c52)
Func_7096d: ; 7096d (1c:496d)
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Delay3
	xor a
	ld [$FF00+$b0], a
	dec a
	ld [$cfcb], a
	call DelayFrame
	ld hl, $c102
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	ld c, a
	ld b, $0
	ld de, $10
.asm_70989
	ld a, [hl]
	cp $ff
	jr z, .asm_7098f
	inc b
.asm_7098f
	add hl, de
	dec c
	jr nz, .asm_70989
	ld hl, $c310
	ld c, $9
.asm_70998
	ld a, b
	swap a
	cp l
	jr z, .asm_709a9
	push hl
	push bc
	ld bc, $10
	xor a
	call FillMemory
	pop bc
	pop hl
.asm_709a9
	ld de, $10
	add hl, de
	dec c
	jr nz, .asm_70998
	call Delay3
	call Func_70a4d
	ld bc, $0
	ld a, [W_ISLINKBATTLE] ; $d12b
	cp $4
	jr z, .asm_709c9
	call Func_709e2
	call Func_709ef
	call Func_70a19
.asm_709c9
	ld hl, Unknown_709d2 ; $49d2
	add hl, bc
	add hl, bc
	ld a, [hli]
	ld h, [hl]
	ld l, a
	jp [hl]

Unknown_709d2: ; 709d2 (1c:49d2)
INCBIN "baserom.gbc",$709d2,$709e2 - $709d2

; known jump sources: 709c0 (1c:49c0)
Func_709e2: ; 709e2 (1c:49e2)
	ld a, [W_CUROPPONENT] ; $d059
	cp $c8
	jr nc, .asm_709ec
	res 0, c
	ret
.asm_709ec
	set 0, c
	ret

; known jump sources: 709c3 (1c:49c3)
Func_709ef: ; 709ef (1c:49ef)
	ld hl, W_PARTYMON1_HP ; $d16c
.asm_709f2
	ld a, [hli]
	or [hl]
	jr nz, .asm_709fc
	ld de, $2b
	add hl, de
	jr .asm_709f2
.asm_709fc
	ld de, $1f
	add hl, de
	ld a, [hl]
	add $3
	ld e, a
	ld a, [W_CURENEMYLVL] ; $d127
	sub e
	jr nc, .asm_70a12
	res 1, c
	ld a, $1
	ld [$cd47], a
	ret
.asm_70a12
	set 1, c
	xor a
	ld [$cd47], a
	ret

; known jump sources: 709c6 (1c:49c6)
Func_70a19: ; 70a19 (1c:4a19)
	ld a, [W_CURMAP] ; $d35e
	ld e, a
	ld hl, Unknown_70a3f ; $4a3f
.asm_70a20
	ld a, [hli]
	cp $ff
	jr z, .asm_70a2b
	cp e
	jr nz, .asm_70a20
.asm_70a28
	set 2, c
	ret
.asm_70a2b
	ld hl, Unknown_70a44 ; $4a44
.asm_70a2e
	ld a, [hli]
	cp $ff
	jr z, .asm_70a3c
	ld d, a
	ld a, [hli]
	cp e
	jr c, .asm_70a2e
	ld a, e
	cp d
	jr nc, .asm_70a28
.asm_70a3c
	res 2, c
	ret

Unknown_70a3f: ; 70a3f (1c:4a3f)
INCBIN "baserom.gbc",$70a3f,$70a44 - $70a3f

Unknown_70a44: ; 70a44 (1c:4a44)
INCBIN "baserom.gbc",$70a44,$70a4d - $70a44

; known jump sources: 709b3 (1c:49b3)
Func_70a4d: ; 70a4d (1c:4a4d)
	ld hl, $8ff0
	ld de, Unknown_70a59 ; $4a59
	ld bc, (BANK(Unknown_70a59) << 8) + $01
	jp CopyVideoData

Unknown_70a59: ; 70a59 (1c:4a59)
INCBIN "baserom.gbc",$70a59,$70a69 - $70a59

; known jump sources: 70a9f (1c:4a9f), 70bc2 (1c:4bc2), 70c0a (1c:4c0a), 70ca7 (1c:4ca7), 70cd5 (1c:4cd5), 70d4d (1c:4d4d)
Func_70a69: ; 70a69 (1c:4a69)
	ld a, $ff
	ld [rBGP], a ; $FF00+$47
	ld [rOBP0], a ; $FF00+$48
	ld [rOBP1], a ; $FF00+$49
	ret
	ld a, [$cd47]
	and a
	jr z, .asm_70a7d
	call Func_70aaa
	jr .asm_70a9f
.asm_70a7d
	FuncCoord 10, 10 ; $c472
	ld hl, Coord
	ld a, $3
	ld [$d09f], a
	ld a, l
	ld [$d09b], a
	ld a, h
	ld [$d09a], a
	ld b, $78
.asm_70a8f
	ld c, $3
.asm_70a91
	push bc
	call Func_70af9
	pop bc
	dec c
	jr nz, .asm_70a91
	call DelayFrame
	dec b
	jr nz, .asm_70a8f
.asm_70a9f
	call Func_70a69
	xor a
	ld [$d09b], a
	ld [$d09a], a
	ret

; known jump sources: 70a78 (1c:4a78)
Func_70aaa: ; 70aaa (1c:4aaa)
	ld a, $7
	ld [W_WHICHTRADE], a ; $cd3d
	ld hl, W_SCREENTILESBUFFER
	ld c, $11
	ld de, $14
	call Func_70ae0
	inc c
	jr .asm_70ac3
.asm_70abd
	ld de, $14
	call Func_70ae0
.asm_70ac3
	inc c
	ld de, $1
	call Func_70ae0
	dec c
	dec c
	ld de, $ffec
	call Func_70ae0
	inc c
	ld de, rIE ; $ffff
	call Func_70ae0
	dec c
	dec c
	ld a, c
	and a
	jr nz, .asm_70abd
	ret

; known jump sources: 70ab7 (1c:4ab7), 70ac0 (1c:4ac0), 70ac7 (1c:4ac7), 70acf (1c:4acf), 70ad6 (1c:4ad6)
Func_70ae0: ; 70ae0 (1c:4ae0)
	push bc
.asm_70ae1
	ld [hl], $ff
	add hl, de
	push bc
	ld a, [W_WHICHTRADE] ; $cd3d
	dec a
	jr nz, .asm_70af0
	call Func_70d19
	ld a, $7
.asm_70af0
	ld [W_WHICHTRADE], a ; $cd3d
	pop bc
	dec c
	jr nz, .asm_70ae1
	pop bc
	ret

; known jump sources: 70a92 (1c:4a92)
Func_70af9: ; 70af9 (1c:4af9)
	ld bc, $ffec
	ld de, $14
	ld a, [$d09b]
	ld l, a
	ld a, [$d09a]
	ld h, a
	ld a, [$d09f]
	cp $0
	jr z, .asm_70b25
	cp $1
	jr z, .asm_70b2f
	cp $2
	jr z, .asm_70b39
	cp $3
	jr z, .asm_70b43
.asm_70b1a
	ld [hl], $ff
.asm_70b1c
	ld a, l
	ld [$d09b], a
	ld a, h
	ld [$d09a], a
	ret
.asm_70b25
	dec hl
	ld a, [hl]
	cp $ff
	jr nz, .asm_70b4d
	inc hl
	add hl, bc
	jr .asm_70b1a
.asm_70b2f
	add hl, de
	ld a, [hl]
	cp $ff
	jr nz, .asm_70b4d
	add hl, bc
	dec hl
	jr .asm_70b1a
.asm_70b39
	inc hl
	ld a, [hl]
	cp $ff
	jr nz, .asm_70b4d
	dec hl
	add hl, de
	jr .asm_70b1a
.asm_70b43
	add hl, bc
	ld a, [hl]
	cp $ff
	jr nz, .asm_70b4d
	add hl, de
	inc hl
	jr .asm_70b1a
.asm_70b4d
	ld [hl], $ff
	ld a, [$d09f]
	inc a
	cp $4
	jr nz, .asm_70b58
	xor a
.asm_70b58
	ld [$d09f], a
	jr .asm_70b1c

; known jump sources: 70b6f (1c:4b6f), 70cff (1c:4cff)
Func_70b5d: ; 70b5d (1c:4b5d)
	ld hl, Unknown_70b72 ; $4b72
.asm_70b60
	ld a, [hli]
	cp $1
	jr z, .asm_70b6e
	ld [rBGP], a ; $FF00+$47
	ld c, $2
	call DelayFrames
	jr .asm_70b60
.asm_70b6e
	dec b
	jr nz, Func_70b5d
	ret

Unknown_70b72: ; 70b72 (1c:4b72)
INCBIN "baserom.gbc",$70b72,$70b7f - $70b72
	ld c, $9
.asm_70b81
	push bc
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	FuncCoord 0, 7 ; $c42c
	ld hl, Coord
	FuncCoord 0, 8 ; $c440
	ld de, Coord
	ld bc, $ffd8
	call Func_70c12
	FuncCoord 0, 10 ; $c468
	ld hl, Coord
	FuncCoord 0, 9 ; $c454
	ld de, Coord
	ld bc, $28
	call Func_70c12
	FuncCoord 8, 0 ; $c3a8
	ld hl, Coord
	FuncCoord 9, 0 ; $c3a9
	ld de, Coord
	ld bc, $fffe
	call Func_70c3f
	FuncCoord 11, 0 ; $c3ab
	ld hl, Coord
	FuncCoord 10, 0 ; $c3aa
	ld de, Coord
	ld bc, $2
	call Func_70c3f
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld c, $6
	call DelayFrames
	pop bc
	dec c
	jr nz, .asm_70b81
	call Func_70a69
	ld c, $a
	jp DelayFrames
	ld c, $9
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
.asm_70bcf
	push bc
	FuncCoord 0, 16 ; $c4e0
	ld hl, Coord
	FuncCoord 0, 17 ; $c4f4
	ld de, Coord
	ld bc, $ffd8
	call Func_70c12
	FuncCoord 0, 1 ; $c3b4
	ld hl, Coord
	ld de, W_SCREENTILESBUFFER
	ld bc, $28
	call Func_70c12
	FuncCoord 18, 0 ; $c3b2
	ld hl, Coord
	FuncCoord 19, 0 ; $c3b3
	ld de, Coord
	ld bc, $fffe
	call Func_70c3f
	FuncCoord 1, 0 ; $c3a1
	ld hl, Coord
	ld de, W_SCREENTILESBUFFER
	ld bc, $2
	call Func_70c3f
	call Func_70d19
	call Delay3
	pop bc
	dec c
	jr nz, .asm_70bcf
	call Func_70a69
	ld c, $a
	jp DelayFrames

; known jump sources: 70b8e (1c:4b8e), 70b9a (1c:4b9a), 70bd9 (1c:4bd9), 70be5 (1c:4be5)
Func_70c12: ; 70c12 (1c:4c12)
	ld a, c
	ld [W_WHICHTRADE], a ; $cd3d
	ld a, b
	ld [$cd3e], a
	ld c, $8
.asm_70c1c
	push bc
	push hl
	push de
	ld bc, $14
	call CopyData
	pop hl
	pop de
	ld a, [W_WHICHTRADE] ; $cd3d
	ld c, a
	ld a, [$cd3e]
	ld b, a
	add hl, bc
	pop bc
	dec c
	jr nz, .asm_70c1c
	ld l, e
	ld h, d
	ld a, $ff
	ld c, $14
.asm_70c3a
	ld [hli], a
	dec c
	jr nz, .asm_70c3a
	ret

; known jump sources: 70ba6 (1c:4ba6), 70bb2 (1c:4bb2), 70bf1 (1c:4bf1), 70bfd (1c:4bfd)
Func_70c3f: ; 70c3f (1c:4c3f)
	ld a, c
	ld [W_WHICHTRADE], a ; $cd3d
	ld a, b
	ld [$cd3e], a
	ld c, $9
.asm_70c49
	push bc
	push hl
	push de
	ld c, $12
.asm_70c4e
	ld a, [hl]
	ld [de], a
	ld a, e
	add $14
	jr nc, .asm_70c56
	inc d
.asm_70c56
	ld e, a
	ld a, l
	add $14
	jr nc, .asm_70c5d
	inc h
.asm_70c5d
	ld l, a
	dec c
	jr nz, .asm_70c4e
	pop hl
	pop de
	ld a, [W_WHICHTRADE] ; $cd3d
	ld c, a
	ld a, [$cd3e]
	ld b, a
	add hl, bc
	pop bc
	dec c
	jr nz, .asm_70c49
	ld l, e
	ld h, d
	ld de, $14
	ld c, $12
.asm_70c77
	ld [hl], $ff
	add hl, de
	dec c
	jr nz, .asm_70c77
	ret
	ld c, $12
	ld hl, W_SCREENTILESBUFFER
	FuncCoord 1, 17 ; $c4f5
	ld de, Coord
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
.asm_70c89
	push bc
	push hl
	push de
	push de
	call Func_70caa
	pop hl
	call Func_70caa
	call Func_70d19
	pop hl
	ld bc, $ffec
	add hl, bc
	ld e, l
	ld d, h
	pop hl
	ld bc, $14
	add hl, bc
	pop bc
	dec c
	jr nz, .asm_70c89
	jp Func_70a69

; known jump sources: 70c8d (1c:4c8d), 70c91 (1c:4c91)
Func_70caa: ; 70caa (1c:4caa)
	ld c, $a
.asm_70cac
	ld [hl], $ff
	inc hl
	inc hl
	dec c
	jr nz, .asm_70cac
	ret
	ld c, $14
	ld hl, W_SCREENTILESBUFFER
	FuncCoord 19, 1 ; $c3c7
	ld de, Coord
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
.asm_70cbf
	push bc
	push hl
	push de
	push de
	call Func_70cd8
	pop hl
	call Func_70cd8
	call Func_70d19
	pop de
	pop hl
	pop bc
	inc hl
	dec de
	dec c
	jr nz, .asm_70cbf
	jp Func_70a69

; known jump sources: 70cc3 (1c:4cc3), 70cc7 (1c:4cc7)
Func_70cd8: ; 70cd8 (1c:4cd8)
	ld c, $9
	ld de, $28
.asm_70cdd
	ld [hl], $ff
	add hl, de
	dec c
	jr nz, .asm_70cdd
	ret

INCBIN "baserom.gbc",$70ce4,$70cfd - $70ce4

; known jump sources: 70d24 (1c:4d24)
Func_70cfd: ; 70cfd (1c:4cfd)
	ld b, $3
	call Func_70b5d
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ret

INCBIN "baserom.gbc",$70d06,$70d19 - $70d06

; known jump sources: 70aeb (1c:4aeb), 70c00 (1c:4c00), 70c94 (1c:4c94), 70cca (1c:4cca), 70d46 (1c:4d46)
Func_70d19: ; 70d19 (1c:4d19)
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Delay3
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ret
	call Func_70cfd
	ld c, $a
	ld hl, Unknown_70d61 ; $4d61
	ld de, Unknown_70d93 ; $4d93
.asm_70d2f
	push bc
	push hl
	push de
	push de
	xor a
	call Func_70d50
	pop hl
	ld a, $1
	call Func_70d50
	pop hl
	ld bc, $5
	add hl, bc
	ld e, l
	ld d, h
	pop hl
	add hl, bc
	call Func_70d19
	pop bc
	dec c
	jr nz, .asm_70d2f
	jp Func_70a69

; known jump sources: 70d34 (1c:4d34), 70d3a (1c:4d3a)
Func_70d50: ; 70d50 (1c:4d50)
	ld [W_WHICHTRADE], a ; $cd3d
	ld a, [hli]
	ld [$cd3e], a
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	jp asm_70dc5

Unknown_70d61: ; 70d61 (1c:4d61)
INCBIN "baserom.gbc",$70d61,$70d93 - $70d61

Unknown_70d93: ; 70d93 (1c:4d93)
INCBIN "baserom.gbc",$70d93,$70dc5 - $70d93

asm_70dc5
	push hl
	ld a, [de]
	ld c, a
	inc de
.asm_70dc9
	ld [hl], $ff
	ld a, [$cd3e]
	and a
	jr z, .asm_70dd4
	inc hl
	jr .asm_70dd5
.asm_70dd4
	dec hl
.asm_70dd5
	dec c
	jr nz, .asm_70dc9
	pop hl
	ld a, [W_WHICHTRADE] ; $cd3d
	and a
	ld bc, $14
	jr z, .asm_70de5
	ld bc, $ffec
.asm_70de5
	add hl, bc
	ld a, [de]
	inc de
	cp $ff
	ret z
	and a
	jr z, asm_70dc5
	ld c, a
.asm_70def
	ld a, [$cd3e]
	and a
	jr z, .asm_70df8
	dec hl
	jr .asm_70df9
.asm_70df8
	inc hl
.asm_70df9
	dec c
	jr nz, .asm_70def
	jr asm_70dc5

INCBIN "baserom.gbc",$70dfe,$70e3e - $70dfe

; known jump sources: d974 (3:5974)
Func_70e3e: ; 70e3e (1c:4e3e)
	call Func_7109b
	ld hl, $cfcb
	ld a, [hl]
	push af
	ld [hl], $ff
	push hl
	ld a, $1
	ld [$FF00+$b7], a
	ld a, [W_CURMAP] ; $d35e
	push af
	ld b, $0
	call Func_711c4
	FuncCoord 1, 0 ; $c3a1
	ld hl, Coord
	ld de, $cd6d
	call PlaceString
	ld hl, W_OAMBUFFER
	ld de, W_SCREENTILESBACKBUFFER
	ld bc, $10
	call CopyData
	ld hl, $8040
	ld de, Unknown_70f40 ; $4f40
	ld bc, (BANK(Unknown_70f40) << 8) + $04
	call CopyVideoDataDouble
	xor a
	ld [W_WHICHTRADE], a ; $cd3d
	pop af
	jr asm_70e92

; known jump sources: 70efe (1c:4efe), 70f0e (1c:4f0e)
Func_70e7e: ; 70e7e (1c:4e7e)
	ld hl, W_SCREENTILESBUFFER
	ld bc, $114
	call ClearScreenArea
	ld hl, Unknown_70f11 ; $4f11
	ld a, [W_WHICHTRADE] ; $cd3d
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
asm_70e92: ; 70e92 (1c:4e92)
	ld de, $cee9
	call Func_712f1
	ld a, [de]
	push hl
	call Func_71258
	ld a, $4
	ld [$cd5b], a
	ld hl, $c310
	call Func_71279
	pop hl
	ld de, $cd6d
.asm_70eac
	ld a, [hli]
	ld [de], a
	inc de
	cp $50
	jr nz, .asm_70eac
	FuncCoord 1, 0 ; $c3a1
	ld hl, Coord
	ld de, $cd6d
	call PlaceString
	ld hl, $c310
	ld de, $c518
	ld bc, $10
	call CopyData
.asm_70ec8
	call Func_716c6
	call GetJoypadStateLowSensitivity
	ld a, [$FF00+$b5]
	ld b, a
	and $c3
	jr z, .asm_70ec8
	ld a, $8c
	call PlaySound
	bit 6, b
	jr nz, .asm_70ef2
	bit 7, b
	jr nz, .asm_70f01
	xor a
	ld [$d09b], a
	ld [$FF00+$b7], a
	ld [W_SUBANIMTRANSFORM], a ; $d08b
	call Func_711ab
	pop hl
	pop af
	ld [hl], a
	ret
.asm_70ef2
	ld a, [W_WHICHTRADE] ; $cd3d
	inc a
	cp $2f
	jr nz, .asm_70efb
	xor a
.asm_70efb
	ld [W_WHICHTRADE], a ; $cd3d
	jp Func_70e7e
.asm_70f01
	ld a, [W_WHICHTRADE] ; $cd3d
	dec a
	cp $ff
	jr nz, .asm_70f0b
	ld a, $2e
.asm_70f0b
	ld [W_WHICHTRADE], a ; $cd3d
	jp Func_70e7e

Unknown_70f11: ; 70f11 (1c:4f11)
INCBIN "baserom.gbc",$70f11,$70f40 - $70f11

Unknown_70f40: ; 70f40 (1c:4f40)
INCBIN "baserom.gbc",$70f40,$70f60 - $70f40

; known jump sources: 4010a (10:410a)
Func_70f60: ; 70f60 (1c:4f60)
	call Func_7109b
	ld hl, $cfcb
	ld a, [hl]
	push af
	ld [hl], $ff
	push hl
	call Func_711ef
	call GetMonName
	FuncCoord 1, 0 ; $c3a1
	ld hl, Coord
	call PlaceString
	ld h, b
	ld l, c
	ld de, Unknown_70f89 ; $4f89
	call PlaceString
	call WaitForTextScrollButtonPress
	call Func_711ab
	pop hl
	pop af
	ld [hl], a
	ret

Unknown_70f89: ; 70f89 (1c:4f89)
INCBIN "baserom.gbc",$70f89,$70f90 - $70f89

; known jump sources: 30b3 (0:30b3)
Func_70f90: ; 70f90 (1c:4f90)
	call CleanLCD_OAM
	call Func_7109b
	call LoadPlayerSpriteGraphics
	call LoadFontTilePatterns
	ld de, BirdSprite ; $4d80
	ld hl, $8040
	ld bc, (BANK(BirdSprite) << 8) + $0c
	call CopyVideoData
	ld de, Unknown_71093 ; $5093
	ld hl, $8ed0
	ld bc, (BANK(Unknown_71093) << 8) + $01
	call CopyVideoDataDouble
	call Func_71070
	ld hl, $cfcb
	ld a, [hl]
	push af
	ld [hl], $ff
	push hl
	ld hl, W_SCREENTILESBUFFER
	ld de, Unknown_7106d ; $506d
	call PlaceString
	ld a, [W_CURMAP] ; $d35e
	ld b, $0
	call Func_711c4
	ld hl, $cd3e
	FuncCoord 18, 0 ; $c3b2
	ld de, Coord

; known jump sources: 7104f (1c:504f), 71055 (1c:5055), 71065 (1c:5065)
Func_70fd6: ; 70fd6 (1c:4fd6)
	ld a, $7f
	ld [de], a
	push hl
	push hl
	FuncCoord 3, 0 ; $c3a3
	ld hl, Coord
	ld bc, $10f
	call ClearScreenArea
	pop hl
	ld a, [hl]
	ld b, $4
	call Func_711c4
	FuncCoord 3, 0 ; $c3a3
	ld hl, Coord
	ld de, $cd6d
	call PlaceString
	ld c, $f
	call DelayFrames
	FuncCoord 18, 0 ; $c3b2
	ld hl, Coord
	ld [hl], $ed
	FuncCoord 19, 0 ; $c3b3
	ld hl, Coord
	ld [hl], $ee
	pop hl
.asm_71004
	push hl
	call DelayFrame
	call GetJoypadStateLowSensitivity
	ld a, [$FF00+$b5]
	ld b, a
	pop hl
	and $c3
	jr z, .asm_71004
	bit 0, b
	jr nz, .asm_71026
	ld a, $8c
	call PlaySound
	bit 6, b
	jr nz, .asm_71042
	bit 7, b
	jr nz, .asm_71058
	jr .asm_71037
.asm_71026
	ld a, $8e
	call PlaySound
	ld a, [hl]
	ld [$d71a], a
	ld hl, $d732
	set 3, [hl]
	inc hl
	set 7, [hl]
.asm_71037
	xor a
	ld [$d09b], a
	call GBPalWhiteOutWithDelay3
	pop hl
	pop af
	ld [hl], a
	ret
.asm_71042
	FuncCoord 18, 0 ; $c3b2
	ld de, Coord
	inc hl
	ld a, [hl]
	cp $ff
	jr z, .asm_71052
	cp $fe
	jr z, .asm_71042
	jp Func_70fd6
.asm_71052
	ld hl, $cd3e
	jp Func_70fd6
.asm_71058
	FuncCoord 19, 0 ; $c3b3
	ld de, Coord
	dec hl
	ld a, [hl]
	cp $ff
	jr z, .asm_71068
	cp $fe
	jr z, .asm_71058
	jp Func_70fd6
.asm_71068
	ld hl, $cd49
	jr .asm_71058

Unknown_7106d: ; 7106d (1c:506d)
INCBIN "baserom.gbc",$7106d,$71070 - $7106d

; known jump sources: 70fb4 (1c:4fb4)
Func_71070: ; 71070 (1c:5070)
	ld hl, W_WHICHTRADE ; $cd3d
	ld [hl], $ff
	inc hl
	ld a, [$d70b]
	ld e, a
	ld a, [$d70c]
	ld d, a
	ld bc, $b
.asm_71081
	srl d
	rr e
	ld a, $fe
	jr nc, .asm_7108a
	ld a, b
.asm_7108a
	ld [hl], a
	inc hl
	inc b
	dec c
	jr nz, .asm_71081
	ld [hl], $ff
	ret

Unknown_71093: ; 71093 (1c:5093)
INCBIN "baserom.gbc",$71093,$7109b - $71093

; known jump sources: 70e3e (1c:4e3e), 70f60 (1c:4f60), 70f93 (1c:4f93)
Func_7109b: ; 7109b (1c:509b)
	call GBPalWhiteOutWithDelay3
	call ClearScreen
	call UpdateSprites
	ld hl, W_SCREENTILESBUFFER
	ld b, $12
	ld c, $12
	call TextBoxBorder
	call DisableLCD
	ld hl, WorldMapTileGraphics ; $65a8
	ld de, $9600
	ld bc, $100
	ld a, BANK(WorldMapTileGraphics)
	call FarCopyData2
	ld hl, Unknown_716be ; $56be
	ld de, $8040
	ld bc, $8
	ld a, BANK(Unknown_716be)
	call FarCopyDataDouble
	ld hl, W_SCREENTILESBUFFER
	ld de, CompressedMap ; $5100
.asm_710d3
	ld a, [de]
	and a
	jr z, .asm_710e9
	ld b, a
	and $f
	ld c, a
	ld a, b
	swap a
	and $f
	add $60
.asm_710e2
	ld [hli], a
	dec c
	jr nz, .asm_710e2
	inc de
	jr .asm_710d3
.asm_710e9
	call EnableLCD
	ld b, $2
	call GoPAL_SET
	call Delay3
	call GBPalNormal
	xor a
	ld [W_SUBANIMTRANSFORM], a ; $d08b
	inc a
	ld [$d09b], a
	ret
; 71100 (1c:5100)
CompressedMap: ; 71100 (1c:5100)
; you can decompress this file with the redrle program in the extras/ dir
	INCBIN "baserom.gbc",$71100,$711AB-$71100

; known jump sources: 70eeb (1c:4eeb), 70f82 (1c:4f82)
Func_711ab: ; 711ab (1c:51ab)
	xor a
	ld [$d09b], a
	call GBPalWhiteOut
	call ClearScreen
	call CleanLCD_OAM
	call LoadPlayerSpriteGraphics
	call LoadFontTilePatterns
	call UpdateSprites
	jp GoPAL_SET_CF1C

; known jump sources: 70e53 (1c:4e53), 70fcd (1c:4fcd), 70fe8 (1c:4fe8), 7123b (1c:523b)
Func_711c4: ; 711c4 (1c:51c4)
	push af
	ld a, b
	ld [$cd5b], a
	pop af
	ld de, $cee9
	call Func_712f1
	ld a, [de]
	push hl
	call Func_71258
	call Func_7126d
	pop hl
	ld de, $cd6d
.asm_711dc
	ld a, [hli]
	ld [de], a
	inc de
	cp $50
	jr nz, .asm_711dc
	ld hl, W_OAMBUFFER
	ld de, W_SCREENTILESBACKBUFFER
	ld bc, $a0
	jp CopyData

; known jump sources: 70f6b (1c:4f6b)
Func_711ef: ; 711ef (1c:51ef)
	ld b, BANK(Func_e9cb)
	ld hl, Func_e9cb
	call Bankswitch ; indirect jump to Func_e9cb (e9cb (3:69cb))
	call Func_712d9
	ld hl, W_OAMBUFFER
	ld de, $cee9
.asm_71200
	ld a, [de]
	cp $ff
	jr z, .asm_7121d
	and a
	jr z, .asm_7121a
	push hl
	call Func_712f1
	pop hl
	ld a, [de]
	cp $19
	jr z, .asm_7121a
	call Func_71258
	ld a, $4
	ld [hli], a
	xor a
	ld [hli], a
.asm_7121a
	inc de
	jr .asm_71200
.asm_7121d
	ld a, l
	and a
	jr nz, .asm_71236
	FuncCoord 1, 7 ; $c42d
	ld hl, Coord
	ld b, $2
	ld c, $f
	call TextBoxBorder
	FuncCoord 2, 9 ; $c456
	ld hl, Coord
	ld de, Unknown_7124a ; $524a
	call PlaceString
	jr .asm_7123e
.asm_71236
	ld a, [W_CURMAP] ; $d35e
	ld b, $0
	call Func_711c4
.asm_7123e
	ld hl, W_OAMBUFFER
	ld de, W_SCREENTILESBACKBUFFER
	ld bc, $a0
	jp CopyData

Unknown_7124a: ; 7124a (1c:524a)
INCBIN "baserom.gbc",$7124a,$71258 - $7124a

; known jump sources: 70e9a (1c:4e9a), 711d2 (1c:51d2), 71212 (1c:5212)
Func_71258: ; 71258 (1c:5258)
	push af
	and $f0
	srl a
	add $18
	ld b, a
	ld [hli], a
	pop af
	and $f
	swap a
	srl a
	add $18
	ld c, a
	ld [hli], a
	ret

; known jump sources: 711d5 (1c:51d5)
Func_7126d: ; 7126d (1c:526d)
	ld a, [$cd5b]
	and a
	ld hl, $c390
	jr z, Func_71279
	ld hl, $c380

; known jump sources: 70ea5 (1c:4ea5), 71274 (1c:5274)
Func_71279: ; 71279 (1c:5279)
	push hl
	ld hl, $fcfc
	add hl, bc
	ld b, h
	ld c, l
	pop hl

; known jump sources: 718da (1c:58da)
Func_71281: ; 71281 (1c:5281)
	ld de, $202
.asm_71284
	push de
	push bc
.asm_71286
	ld a, b
	ld [hli], a
	ld a, c
	ld [hli], a
	ld a, [$cd5b]
	ld [hli], a
	inc a
	ld [$cd5b], a
	xor a
	ld [hli], a
	inc d
	ld a, $8
	add c
	ld c, a
	dec e
	jr nz, .asm_71286
	pop bc
	pop de
	ld a, $8
	add b
	ld b, a
	dec d
	jr nz, .asm_71284
	ret

; known jump sources: 718d5 (1c:58d5)
Func_712a6: ; 712a6 (1c:52a6)
	xor a
	ld [$cd5c], a
	ld de, $202
.asm_712ad
	push de
	push bc
.asm_712af
	ld a, b
	ld [hli], a
	ld a, c
	ld [hli], a
	ld a, [$cd5b]
	ld [hli], a
	ld a, [$cd5c]
	ld [hli], a
	xor $20
	ld [$cd5c], a
	inc d
	ld a, $8
	add c
	ld c, a
	dec e
	jr nz, .asm_712af
	pop bc
	pop de
	push hl
	ld hl, $cd5b
	inc [hl]
	inc [hl]
	pop hl
	ld a, $8
	add b
	ld b, a
	dec d
	jr nz, .asm_712ad
	ret

; known jump sources: 711f7 (1c:51f7)
Func_712d9: ; 712d9 (1c:52d9)
	ld de, $cee9
.asm_712dc
	ld a, [de]
	inc de
	cp $ff
	ret z
	ld c, a
	ld l, e
	ld h, d
.asm_712e4
	ld a, [hl]
	cp $ff
	jr z, .asm_712dc
	cp c
	jr nz, .asm_712ee
	xor a
	ld [hl], a
.asm_712ee
	inc hl
	jr .asm_712e4

; known jump sources: 70e95 (1c:4e95), 711cd (1c:51cd), 71209 (1c:5209)
Func_712f1: ; 712f1 (1c:52f1)
	cp $25
	jr c, .asm_71304
	ld bc, $4
	ld hl, InternalMapEntries ; $5382
.asm_712fb
	cp [hl]
	jr c, .asm_71301
	add hl, bc
	jr .asm_712fb
.asm_71301
	inc hl
	jr .asm_7130d
.asm_71304
	ld hl, ExternalMapEntries ; $5313
	ld c, a
	ld b, $0
	add hl, bc
	add hl, bc
	add hl, bc
.asm_7130d
	ld a, [hli]
	ld [de], a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ret
; 71313 (1c:5313)
ExternalMapEntries: ; 71313 (1c:5313)
	EMAP $2,$B,PalletTownName
	EMAP $2,$8,ViridianCityName
	EMAP $2,$3,PewterCityName
	EMAP $A,$2,CeruleanCityName
	EMAP $E,$5,LavenderTownName
	EMAP $A,$9,VermilionCityName
	EMAP $7,$5,CeladonCityName
	EMAP $8,$D,FuchsiaCityName
	EMAP $2,$F,CinnabarIslandName
	EMAP $0,$2,IndigoPlateauName
	EMAP $A,$5,SaffronCityName
	EMAP $0,$0,PalletTownName ; unused
	EMAP $2,$A,Route1Name
	EMAP $2,$6,Route2Name
	EMAP $4,$3,Route3Name
	EMAP $8,$2,Route4Name
	EMAP $A,$3,Route5Name
	EMAP $A,$8,Route6Name
	EMAP $8,$5,Route7Name
	EMAP $D,$5,Route8Name
	EMAP $D,$2,Route9Name
	EMAP $E,$4,Route10Name
	EMAP $C,$9,Route11Name
	EMAP $E,$9,Route12Name
	EMAP $D,$B,Route13Name
	EMAP $B,$C,Route14Name
	EMAP $A,$D,Route15Name
	EMAP $5,$5,Route16Name
	EMAP $4,$8,Route17Name
	EMAP $6,$D,Route18Name
	EMAP $6,$F,Route19Name
	EMAP $4,$F,Route20Name
	EMAP $2,$D,Route21Name
	EMAP $0,$8,Route22Name
	EMAP $0,$6,Route23Name
	EMAP $A,$1,Route24Name
	EMAP $B,$0,Route25Name

InternalMapEntries: ; 71382 (1c:5382)
	IMAP $29,$2,$B,PalletTownName
	IMAP $2E,$2,$8,ViridianCityName
	IMAP $33,$2,$6,Route2Name
	IMAP $34,$2,$4,ViridianForestName
	IMAP $3B,$2,$3,PewterCityName
	IMAP $3E,$6,$2,MountMoonName
	IMAP $44,$A,$2,CeruleanCityName
	IMAP $45,$5,$2,Route4Name
	IMAP $46,$A,$2,CeruleanCityName
	IMAP $49,$A,$4,Route5Name
	IMAP $4C,$A,$6,Route6Name
	IMAP $4F,$9,$5,Route7Name
	IMAP $51,$B,$5,Route8Name
	IMAP $53,$E,$3,RockTunnelName
	IMAP $54,$F,$4,PowerPlantName
	IMAP $57,$D,$9,Route11Name
	IMAP $58,$E,$7,Route12Name
	IMAP $59,$C,$0,SeaCottageName
	IMAP $5F,$A,$9,VermilionCityName
	IMAP $69,$9,$A,SSAnneName
	IMAP $6D,$0,$4,VictoryRoadName
	IMAP $77,$0,$2,PokemonLeagueName
	IMAP $78,$A,$5,UndergroundPathName
	IMAP $79,$0,$2,PokemonLeagueName
	IMAP $7A,$A,$5,UndergroundPathName
	IMAP $8D,$7,$5,CeladonCityName
	IMAP $8E,$E,$5,LavenderTownName
	IMAP $95,$F,$5,PokemonTowerName
	IMAP $98,$E,$5,LavenderTownName
	IMAP $9C,$8,$D,FuchsiaCityName
	IMAP $9D,$8,$C,SafariZoneName
	IMAP $9F,$8,$D,FuchsiaCityName
	IMAP $A3,$5,$F,SeafoamIslandsName
	IMAP $A4,$A,$9,VermilionCityName
	IMAP $A5,$8,$D,FuchsiaCityName
	IMAP $A6,$2,$F,PokemonMansionName
	IMAP $AE,$2,$F,CinnabarIslandName
	IMAP $AF,$0,$2,IndigoPlateauName
	IMAP $B8,$A,$5,SaffronCityName
	IMAP $BA,$9,$D,Route15Name
	IMAP $BD,$4,$5,Route16Name
	IMAP $BE,$E,$A,Route12Name
	IMAP $C0,$7,$D,Route18Name
	IMAP $C1,$5,$F,SeafoamIslandsName
	IMAP $C2,$0,$7,Route22Name
	IMAP $C3,$0,$4,VictoryRoadName
	IMAP $C4,$E,$7,Route12Name
	IMAP $C5,$A,$9,VermilionCityName
	IMAP $C6,$3,$4,DiglettsCaveName
	IMAP $C7,$0,$4,VictoryRoadName
	IMAP $CF,$7,$5,RocketHQName
	IMAP $D6,$A,$5,SilphCoName
	IMAP $D9,$2,$F,PokemonMansionName
	IMAP $E2,$8,$C,SafariZoneName
	IMAP $E5,$9,$1,CeruleanCaveName
	IMAP $E6,$E,$5,LavenderTownName
	IMAP $E7,$A,$2,CeruleanCityName
	IMAP $E9,$E,$3,RockTunnelName
	IMAP $ED,$A,$5,SilphCoName
	IMAP $F8,$0,$2,PokemonLeagueName
	db $FF

MapNames: ; 71473 (1c:5473)
PalletTownName: ; 71473 (1c:5473)
	db "PALLET TOWN@"
ViridianCityName: ; 7147f (1c:547f)
	db "VIRIDIAN CITY@"
PewterCityName: ; 7148d (1c:548d)
	db "PEWTER CITY@"
CeruleanCityName: ; 71499 (1c:5499)
	db "CERULEAN CITY@"
LavenderTownName: ; 714a7 (1c:54a7)
	db "LAVENDER TOWN@"
VermilionCityName: ; 714b5 (1c:54b5)
	db "VERMILION CITY@"
CeladonCityName: ; 714c4 (1c:54c4)
	db "CELADON CITY@"
FuchsiaCityName: ; 714d1 (1c:54d1)
	db "FUCHSIA CITY@"
CinnabarIslandName: ; 714de (1c:54de)
	db "CINNABAR ISLAND@"
IndigoPlateauName: ; 714ee (1c:54ee)
	db "INDIGO PLATEAU@"
SaffronCityName: ; 714fd (1c:54fd)
	db "SAFFRON CITY@"
Route1Name: ; 7150a (1c:550a)
	db "ROUTE 1@"
Route2Name: ; 71512 (1c:5512)
	db "ROUTE 2@"
Route3Name: ; 7151a (1c:551a)
	db "ROUTE 3@"
Route4Name: ; 71522 (1c:5522)
	db "ROUTE 4@"
Route5Name: ; 7152a (1c:552a)
	db "ROUTE 5@"
Route6Name: ; 71532 (1c:5532)
	db "ROUTE 6@"
Route7Name: ; 7153a (1c:553a)
	db "ROUTE 7@"
Route8Name: ; 71542 (1c:5542)
	db "ROUTE 8@"
Route9Name: ; 7154a (1c:554a)
	db "ROUTE 9@"
Route10Name: ; 71552 (1c:5552)
	db "ROUTE 10@"
Route11Name: ; 7155b (1c:555b)
	db "ROUTE 11@"
Route12Name: ; 71564 (1c:5564)
	db "ROUTE 12@"
Route13Name: ; 7156d (1c:556d)
	db "ROUTE 13@"
Route14Name: ; 71576 (1c:5576)
	db "ROUTE 14@"
Route15Name: ; 7157f (1c:557f)
	db "ROUTE 15@"
Route16Name: ; 71588 (1c:5588)
	db "ROUTE 16@"
Route17Name: ; 71591 (1c:5591)
	db "ROUTE 17@"
Route18Name: ; 7159a (1c:559a)
	db "ROUTE 18@"
Route19Name: ; 715a3 (1c:55a3)
	db "SEA ROUTE 19@"
Route20Name: ; 715b0 (1c:55b0)
	db "SEA ROUTE 20@"
Route21Name: ; 715bd (1c:55bd)
	db "SEA ROUTE 21@"
Route22Name: ; 715ca (1c:55ca)
	db "ROUTE 22@"
Route23Name: ; 715d3 (1c:55d3)
	db "ROUTE 23@"
Route24Name: ; 715dc (1c:55dc)
	db "ROUTE 24@"
Route25Name: ; 715e5 (1c:55e5)
	db "ROUTE 25@"
ViridianForestName: ; 715ee (1c:55ee)
	db "VIRIDIAN FOREST@"
MountMoonName: ; 715fe (1c:55fe)
	db "MT.MOON@"
RockTunnelName: ; 71606 (1c:5606)
	db "ROCK TUNNEL@"
SeaCottageName: ; 71612 (1c:5612)
	db "SEA COTTAGE@"
SSAnneName: ; 7161e (1c:561e)
	db "S.S.ANNE@"
PokemonLeagueName: ; 71627 (1c:5627)
	db "#MON LEAGUE@"
UndergroundPathName: ; 71633 (1c:5633)
	db "UNDERGROUND PATH@"
PokemonTowerName: ; 71644 (1c:5644)
	db "#MON TOWER@"
SeafoamIslandsName: ; 7164f (1c:564f)
	db "SEAFOAM ISLANDS@"
VictoryRoadName: ; 7165f (1c:565f)
	db "VICTORY ROAD@"
DiglettsCaveName: ; 7166c (1c:566c)
	db "DIGLETT's CAVE@"
RocketHQName: ; 7167a (1c:567a)
	db "ROCKET HQ@"
SilphCoName: ; 71684 (1c:5684)
	db "SILPH CO.@"
PokemonMansionName: ; 7168e (1c:568e)
	db $4a," MANSION@"
SafariZoneName: ; 71698 (1c:5698)
	db "SAFARI ZONE@"
CeruleanCaveName: ; 716a4 (1c:56a4)
	db "CERULEAN CAVE@"
PowerPlantName: ; 716b2 (1c:56b2)
	db "POWER PLANT@"

Unknown_716be: ; 716be (1c:56be)
INCBIN "baserom.gbc",$716be,$716c6 - $716be

; known jump sources: 70ec8 (1c:4ec8)
Func_716c6: ; 716c6 (1c:56c6)
	ld a, [W_SUBANIMTRANSFORM] ; $d08b
	inc a
	cp $19
	jr z, .asm_716e1
	cp $32
	jr nz, .asm_716f1
	ld hl, W_SCREENTILESBACKBUFFER
	ld de, W_OAMBUFFER
	ld bc, $90
	call CopyData
	xor a
	jr .asm_716f1
.asm_716e1
	ld hl, W_OAMBUFFER
	ld b, $24
	ld de, $4
.asm_716e9
	ld [hl], $a0
	add hl, de
	dec b
	jr nz, .asm_716e9
	ld a, $19
.asm_716f1
	ld [W_SUBANIMTRANSFORM], a ; $d08b
	jp DelayFrame

; known jump sources: 6608 (1:6608)
Func_716f7: ; 716f7 (1c:56f7)
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld b, a
	inc a
	jr asm_7170a

; known jump sources: 3ae5 (0:3ae5)
Func_716ff: ; 716ff (1c:56ff)
	ld hl, $cf1f
	ld a, [W_CURMENUITEMID] ; $cc26
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hl]
asm_7170a: ; 7170a (1c:570a)
	ld c, a
	ld hl, Unknown_71769 ; $5769
	add hl, bc
	ld a, [$cf1b]
	xor $1
	add [hl]
	ld c, a
	add a
	ld b, a
	ld a, [W_SUBANIMTRANSFORM] ; $d08b
	and a
	jr z, .asm_7172c
	cp c
	jr z, .asm_7173d
.asm_71721
	inc a
	cp b
	jr nz, .asm_71726
	xor a
.asm_71726
	ld [W_SUBANIMTRANSFORM], a ; $d08b
	jp DelayFrame
.asm_7172c
	push bc
	ld hl, $cc5b
	ld de, W_OAMBUFFER
	ld bc, $60
	call CopyData
	pop bc
	xor a
	jr .asm_71721
.asm_7173d
	push bc
	ld hl, $c302
	ld bc, $10
	ld a, [W_CURMENUITEMID] ; $cc26
	call AddNTimes
	ld c, $40
	ld a, [hl]
	cp $4
	jr z, .asm_71755
	cp $8
	jr nz, .asm_71759
.asm_71755
	dec hl
	dec hl
	ld c, $1
.asm_71759
	ld b, $4
	ld de, $4
.asm_7175e
	ld a, [hl]
	add c
	ld [hl], a
	add hl, de
	dec b
	jr nz, .asm_7175e
	pop bc
	ld a, c
	jr .asm_71721

Unknown_71769: ; 71769 (1c:5769)
INCBIN "baserom.gbc",$71769,$7176c - $71769

; known jump sources: 65b5 (1:65b5), 41214 (10:5214)
Func_7176c: ; 7176c (1c:576c)
	ld hl, Unknown_717c0 ; $57c0
	ld a, $1c

; known jump sources: 707d1 (1c:47d1)
Func_71771: ; 71771 (1c:5771)
	ld bc, $0
.asm_71774
	push af
	push bc
	push hl
	add hl, bc
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	ld a, [hli]
	ld c, a
	ld a, [hli]
	ld b, a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	call CopyVideoData
	pop hl
	pop bc
	ld a, $6
	add c
	ld c, a
	pop af
	dec a
	jr nz, .asm_71774
	ret

; known jump sources: 12ce0 (4:6ce0)
Func_71791: ; 71791 (1c:5791)
	call DisableLCD
	ld hl, Unknown_717c0 ; $57c0
	ld a, $1c
	ld bc, $0
.asm_7179c
	push af
	push bc
	push hl
	add hl, bc
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	push de
	ld a, [hli]
	ld c, a
	swap c
	ld b, $0
	ld a, [hli]
	ld e, [hl]
	inc hl
	ld d, [hl]
	pop hl
	call FarCopyData2
	pop hl
	pop bc
	ld a, $6
	add c
	ld c, a
	pop af
	dec a
	jr nz, .asm_7179c
	jp EnableLCD

Unknown_717c0: ; 717c0 (1c:57c0)
INCBIN "baserom.gbc",$717c0,$71868 - $717c0

; known jump sources: 12d1d (4:6d1d)
Func_71868: ; 71868 (1c:5868)
	push hl
	push de
	push bc
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	ld hl, W_PARTYMON1 ; $d164
	ld e, a
	ld d, $0
	add hl, de
	ld a, [hl]
	call Func_718e9
	ld [$cd5b], a
	call asm_718c3
	pop bc
	pop de
	pop hl
	ret

; known jump sources: 6916 (1:6916), 4150a (10:550a)
Func_71882: ; 71882 (1c:5882)
	xor a
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	ld a, [$cd5d]
	call Func_718e9
	ld [$cd5b], a
	jr asm_718c3

INCBIN "baserom.gbc",$71890,$718c3 - $71890
asm_718c3: ; 718c3 (1c:58c3)
	push af
	ld c, $10
	ld h, $c3
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	swap a
	ld l, a
	add $10
	ld b, a
	pop af
	cp $8
	jr z, .asm_718da
	call Func_712a6
	jr .asm_718dd
.asm_718da
	call Func_71281
.asm_718dd
	ld hl, W_OAMBUFFER
	ld de, $cc5b
	ld bc, $60
	jp CopyData

; known jump sources: 71875 (1c:5875), 71888 (1c:5888)
Func_718e9: ; 718e9 (1c:58e9)
	ld [$d11e], a
	ld a, $3a
	call Predef ; indirect jump to IndexToPokedex (41010 (10:5010))
	ld a, [$d11e]
	ld c, a
	dec a
	srl a
	ld hl, MonOverworldData ; $590d
	ld e, a
	ld d, $0
	add hl, de
	ld a, [hl]
	bit 0, c
	jr nz, .asm_71906
	swap a
.asm_71906
	and $f0
	srl a
	srl a
	ret
; 7190d (1c:590d)
MonOverworldData: ; 7190d (1c:590d)
	dn SPRITE_GRASS, SPRITE_GRASS			;Bulbasaur/Ivysaur
	dn SPRITE_GRASS, SPRITE_MON				;Venusaur/Charmander
	dn SPRITE_MON, SPRITE_MON				;Charmeleon/Charizard
	dn SPRITE_WATER, SPRITE_WATER			;Squirtle/Wartortle
	dn SPRITE_WATER, SPRITE_BUG				;Blastoise/Caterpie
	dn SPRITE_BUG, SPRITE_BUG				;Metapod/Butterfree
	dn SPRITE_BUG, SPRITE_BUG				;Weedle/Kakuna
	dn SPRITE_BUG, SPRITE_BIRD_M			;Beedrill/Pidgey
	dn SPRITE_BIRD_M, SPRITE_BIRD_M			;Pidgeotto/Pidgeot
	dn SPRITE_QUADRUPED, SPRITE_QUADRUPED	;Rattata/Raticate
	dn SPRITE_BIRD_M, SPRITE_BIRD_M			;Spearow/Fearow
	dn SPRITE_SNAKE, SPRITE_SNAKE			;Ekans/Arbok
	dn SPRITE_FAIRY, SPRITE_FAIRY			;Pikachu/Raichu
	dn SPRITE_MON, SPRITE_MON				;Sandshrew/Sandslash
	dn SPRITE_MON, SPRITE_MON				;Nidoran?/Nidorina
	dn SPRITE_MON, SPRITE_MON				;Nidoqueen/Nidoran?
	dn SPRITE_MON, SPRITE_MON				;Nidorino/Nidoking
	dn SPRITE_FAIRY, SPRITE_FAIRY			;Clefairy/Clefable
	dn SPRITE_QUADRUPED, SPRITE_QUADRUPED	;Vulpix/Ninetales
	dn SPRITE_FAIRY, SPRITE_FAIRY			;Jigglypuff/Wigglytuff
	dn SPRITE_MON, SPRITE_MON				;Zubat/Golbat
	dn SPRITE_GRASS, SPRITE_GRASS			;Oddish/Gloom
	dn SPRITE_GRASS, SPRITE_BUG				;Vileplume/Paras
	dn SPRITE_BUG, SPRITE_BUG				;Parasect/Venonat
	dn SPRITE_BUG, SPRITE_MON				;Venomoth/Diglett
	dn SPRITE_MON, SPRITE_MON				;Dugtrio/Meowth
	dn SPRITE_MON, SPRITE_MON				;Persian/Psyduck
	dn SPRITE_MON, SPRITE_MON				;Golduck/Mankey
	dn SPRITE_MON, SPRITE_QUADRUPED			;Primeape/Growlithe
	dn SPRITE_QUADRUPED, SPRITE_MON			;Arcanine/Poliwag
	dn SPRITE_MON, SPRITE_MON				;Poliwhirl/Poliwrath
	dn SPRITE_MON, SPRITE_MON				;Abra/Kadabra
	dn SPRITE_MON, SPRITE_MON				;Alakazam/Machop
	dn SPRITE_MON, SPRITE_MON				;Machoke/Machamp
	dn SPRITE_GRASS, SPRITE_GRASS			;Bellsprout/Weepinbell
	dn SPRITE_GRASS, SPRITE_WATER			;Victreebel/Tentacool
	dn SPRITE_WATER, SPRITE_MON				;Tentacruel/Geodude
	dn SPRITE_MON, SPRITE_MON				;Graveler/Golem
	dn SPRITE_QUADRUPED, SPRITE_QUADRUPED	;Ponyta/Rapidash
	dn SPRITE_QUADRUPED, SPRITE_MON			;Slowpoke/Slowbro
	dn SPRITE_BALL_M, SPRITE_BALL_M			;Magnemite/Magneton
	dn SPRITE_BIRD_M, SPRITE_BIRD_M			;Farfetch'd/Doduo
	dn SPRITE_BIRD_M, SPRITE_WATER			;Dodrio/Seel
	dn SPRITE_WATER, SPRITE_MON				;Dewgong/Grimer
	dn SPRITE_MON, SPRITE_HELIX				;Muk/Shellder
	dn SPRITE_HELIX, SPRITE_MON				;Cloyster/Gastly
	dn SPRITE_MON, SPRITE_MON				;Haunter/Gengar
	dn SPRITE_SNAKE, SPRITE_MON				;Onix/Drowzee
	dn SPRITE_MON, SPRITE_WATER				;Hypno/Krabby
	dn SPRITE_WATER, SPRITE_BALL_M			;Kingler/Voltorb
	dn SPRITE_BALL_M, SPRITE_GRASS			;Electrode/Exeggcute
	dn SPRITE_GRASS, SPRITE_MON				;Exeggutor/Cubone
	dn SPRITE_MON, SPRITE_MON				;Marowak/Hitmonlee
	dn SPRITE_MON, SPRITE_MON				;Hitmonchan/Lickitung
	dn SPRITE_MON, SPRITE_MON				;Koffing/Weezing
	dn SPRITE_QUADRUPED, SPRITE_MON			;Rhyhorn/Rhydon
	dn SPRITE_FAIRY, SPRITE_GRASS			;Chansey/Tangela
	dn SPRITE_MON, SPRITE_WATER				;Kangaskhan/Horsea
	dn SPRITE_WATER, SPRITE_WATER			;Seadra/Goldeen
	dn SPRITE_WATER, SPRITE_HELIX			;Seaking/Staryu
	dn SPRITE_HELIX, SPRITE_MON				;Starmie/Mr.Mime
	dn SPRITE_BUG, SPRITE_MON				;Scyther/Jynx
	dn SPRITE_MON, SPRITE_MON				;Electabuzz/Magmar
	dn SPRITE_BUG, SPRITE_QUADRUPED			;Pinsir/Tauros
	dn SPRITE_WATER, SPRITE_SNAKE			;Magikarp/Gyarados
	dn SPRITE_WATER, SPRITE_MON				;Lapras/Ditto
	dn SPRITE_QUADRUPED, SPRITE_QUADRUPED	;Eevee/Vaporeon
	dn SPRITE_QUADRUPED, SPRITE_QUADRUPED	;Jolteon/Flareon
	dn SPRITE_MON, SPRITE_HELIX				;Porygon/Omanyte
	dn SPRITE_HELIX, SPRITE_HELIX			;Omastar/Kabuto
	dn SPRITE_HELIX, SPRITE_BIRD_M			;Kabutops/Aerodactyl
	dn SPRITE_MON, SPRITE_BIRD_M			;Snorlax/Articuno
	dn SPRITE_BIRD_M, SPRITE_BIRD_M			;Zapdos/Moltres
	dn SPRITE_SNAKE, SPRITE_SNAKE			;Dratini/Dragonair
	dn SPRITE_SNAKE, SPRITE_MON				;Dragonite/Mewtwo
	dn SPRITE_MON, 0						;Mew/Padding

INCBIN "baserom.gbc",$71959,$71ad9 - $71959

Predef54: ; 71ad9 (1c:5ad9)
; trigger the trade offer/action specified by W_WHICHTRADE
	call SaveScreenTilesToBuffer2
	ld hl,TradeMons
	ld a,[W_WHICHTRADE]
	ld b,a
	swap a
	sub b
	sub b
	ld c,a
	ld b,$0
	add hl,bc
	ld a,[hli]
	ld [$cd0f],a
	ld a,[hli]
	ld [$cd34],a
	ld a,[hli]
	push af
	ld de,$cd29
	ld bc,$000b
	call CopyData
	pop af
	ld l,a
	ld h,$0
	ld de,Unknown_71d64 ; $5d64
	add hl,hl
	add hl,de
	ld a,[hli]
	ld [$cd10],a
	ld a,[hl]
	ld [$cd11],a
	ld a,[$cd0f]
	ld de,$cd13
	call Function71b6a
	ld a,[$cd34]
	ld de,$cd1e
	call Function71b6a
	ld hl,$d737
	ld a,[W_WHICHTRADE]
	ld c,a
	ld b,$2
	ld a,$10
	call Predef
	ld a,c
	and a
	ld a,$4
	ld [$cd12],a
	jr nz,.asm_99bca ; 0x71b36 $20
	xor a
	ld [$cd12],a
	call .asm_99bca
	ld a,$1
	ld [$cd12],a
	call YesNoChoice
	ld a,[$cc26]
	and a
	jr nz,.asm_99bca ; 0x71b4b $b
	call Function71c07
	jr c,.asm_99bca ; 0x71b50 $6
	ld hl, UnnamedText_71d8d
	call PrintText
.asm_99bca ; 0x71b58
	ld hl,$cd12
	ld a,[hld]
	ld e,a
	ld d,$0
	ld a,[hld]
	ld l,[hl]
	ld h,a
	add hl,de
	add hl,de
	ld a,[hli]
	ld h,[hl]
	ld l,a
	jp PrintText

Function71b6a: ; 71b6a (1c:5b6a)
	push de
	ld [$d11e],a
	call GetMonName
	ld hl,$cd6d
	pop de
	ld bc,$b
	jp CopyData

TradeMons: ; 71b7b (1c:5b7b)
; givemonster, getmonster, textstring, nickname (11 bytes), 14 bytes total
	db NIDORINO,  NIDORINA,  0,"TERRY@@@@@@"
	db ABRA,      MR_MIME,  0,"MARCEL@@@@@"
	db BUTTERFREE,BEEDRILL,  2,"CHIKUCHIKU@"
	db PONYTA,    SEEL,      0,"SAILOR@@@@@"
	db SPEAROW,   FARFETCH_D,2,"DUX@@@@@@@@"
	db SLOWBRO,   LICKITUNG, 0,"MARC@@@@@@@"
	db POLIWHIRL, JYNX,      1,"LOLA@@@@@@@"
	db RAICHU,    ELECTRODE, 1,"DORIS@@@@@@"
	db VENONAT,   TANGELA,   2,"CRINKLES@@@"
	db NIDORAN_M, NIDORAN_F, 2,"SPOT@@@@@@@"

Function71c07: ; 71c07 (1c:5c07)
	xor a
	ld [$d07d],a
	dec a
	ld [$cfcb],a
	call DisplayPartyMenu
	push af
	call Func_71ca2
	pop af
	ld a,$1
	jp c,.asm_c4bc2
	ld a,[$cd0f]
	ld b,a
	ld a,[$cf91]
	cp b
	ld a,$2
	jr nz,.asm_c4bc2 ; 0x71c26 $75
	ld a,[$cf92]
	ld hl,$d18c
	ld bc,$002c
	call AddNTimes
	ld a,[hl]
	ld [$d127],a
	ld hl,$d737
	ld a,[W_WHICHTRADE]
	ld c,a
	ld b,$1
	ld a,$10
	call Predef
	ld hl, UnnamedText_71d88
	call PrintText
	ld a,[$cf92]
	push af
	ld a,[$d127]
	push af
	call LoadHpBarAndStatusTilePatterns
	call Func_71cc1
	ld a,$38
	call Predef
	pop af
	ld [$d127],a
	pop af
	ld [$cf92],a
	ld a,[$cd34]
	ld [$cf91],a
	xor a
	ld [$cc49],a
	ld [$cf95],a
	call RemovePokemon
	ld a,$80
	ld [$cc49],a
	call AddPokemonToParty
	call Func_71d19
	ld hl, Func_17d7d
	ld b, BANK(Func_17d7d)
	call Bankswitch
	call ClearScreen
	call Func_71ca2
	ld b, BANK(Func_eedc)
	ld hl, Func_eedc
	call Bankswitch
	and a
	ld a,$3
	jr .asm_ee803 ; 0x71c9b $1
.asm_c4bc2 ; 0x71c9d
	scf
.asm_ee803 ; 0x71c9e
	ld [$cd12],a
	ret

; known jump sources: 71c13 (1c:5c13), 71c8d (1c:5c8d)
Func_71ca2: ; 71ca2 (1c:5ca2)
	call GBPalWhiteOutWithDelay3
	call Func_3dbe
	call ReloadTilesetTilePatterns
	call LoadScreenTilesFromBuffer2
	call Delay3
	call LoadGBPal
	ld c, $a
	call DelayFrames
	ld b, BANK(LoadWildData)
	ld hl, LoadWildData
	jp Bankswitch ; indirect jump to LoadWildData (ceb8 (3:4eb8))

; known jump sources: 71c57 (1c:5c57)
Func_71cc1: ; 71cc1 (1c:5cc1)
	ld hl, W_WHICHTRADE ; $cd3d
	ld a, [$cd0f]
	ld [hli], a
	ld a, [$cd34]
	ld [hl], a
	ld hl, W_PARTYMON1OT ; $d273
	ld bc, $b
	ld a, [W_WHICHPOKEMON] ; $cf92
	call AddNTimes
	ld de, $cd41
	ld bc, $b
	call Func_71d11
	ld hl, Unknown_71d59 ; $5d59
	ld de, $cd4e
	call Func_71d11
	ld de, W_GRASSRATE ; $d887
	call Func_71d11
	ld hl, W_PARTYMON1_OTID ; $d177
	ld bc, $2c
	ld a, [W_WHICHPOKEMON] ; $cf92
	call AddNTimes
	ld de, $cd4c
	ld bc, $2
	call Func_71d11
	call GenRandom
	ld hl, H_RAND1 ; $ffd3
	ld de, $cd59
	jp CopyData

; known jump sources: 71cde (1c:5cde), 71ce7 (1c:5ce7), 71ced (1c:5ced), 71d02 (1c:5d02)
Func_71d11: ; 71d11 (1c:5d11)
	push hl
	push bc
	call CopyData
	pop bc
	pop hl
	ret

; known jump sources: 71c7f (1c:5c7f)
Func_71d19: ; 71d19 (1c:5d19)
	ld hl, W_PARTYMON1NAME ; $d2b5
	ld bc, $b
	call Func_71d4f
	ld hl, $cd29
	ld bc, $b
	call CopyData
	ld hl, W_PARTYMON1OT ; $d273
	ld bc, $b
	call Func_71d4f
	ld hl, Unknown_71d59 ; $5d59
	ld bc, $b
	call CopyData
	ld hl, W_PARTYMON1_OTID ; $d177
	ld bc, $2c
	call Func_71d4f
	ld hl, $cd59
	ld bc, $2
	jp CopyData

; known jump sources: 71d1f (1c:5d1f), 71d31 (1c:5d31), 71d43 (1c:5d43)
Func_71d4f: ; 71d4f (1c:5d4f)
	ld a, [W_NUMINPARTY] ; $d163
	dec a
	call AddNTimes
	ld e, l
	ld d, h
	ret

Unknown_71d59: ; 71d59 (1c:5d59)
INCBIN "baserom.gbc",$71d59,$71d64 - $71d59

Unknown_71d64: ; 71d64 (1c:5d64)
INCBIN "baserom.gbc",$71d64,$71d88 - $71d64

UnnamedText_71d88: ; 71d88 (1c:5d88)
	TX_FAR _UnnamedText_71d88
	db $50
; 0x71d88 + 5 bytes

UnnamedText_71d8d: ; 71d8d (1c:5d8d)
	TX_FAR _UnnamedText_71d8d ; 0xa80bc
	db $11, $a, $50

UnnamedText_71d94: ; 71d94 (1c:5d94)
	TX_FAR _UnnamedText_71d94
	db $50
; 0x71d94 + 5 bytes

UnnamedText_71d99: ; 71d99 (1c:5d99)
	TX_FAR _UnnamedText_71d99
	db $50
; 0x71d99 + 5 bytes

UnnamedText_71d9e: ; 71d9e (1c:5d9e)
	TX_FAR _UnnamedText_71d9e
	db $50
; 0x71d9e + 5 bytes

UnnamedText_71da3: ; 71da3 (1c:5da3)
	TX_FAR _UnnamedText_71da3
	db $50
; 0x71da3 + 5 bytes

UnnamedText_71da8: ; 71da8 (1c:5da8)
	TX_FAR _UnnamedText_71da8
	db $50
; 0x71da8 + 5 bytes

UnnamedText_71dad: ; 71dad (1c:5dad)
	TX_FAR _UnnamedText_71dad
	db $50
; 0x71dad + 5 bytes

UnnamedText_71db2: ; 71db2 (1c:5db2)
	TX_FAR _UnnamedText_71db2
	db $50
; 0x71db2 + 5 bytes

UnnamedText_71db7: ; 71db7 (1c:5db7)
	TX_FAR _UnnamedText_71db7
	db $50
; 0x71db7 + 5 bytes

UnnamedText_71dbc: ; 71dbc (1c:5dbc)
	TX_FAR _UnnamedText_71dbc
	db $50
; 0x71dbc + 5 bytes

UnnamedText_71dc1: ; 71dc1 (1c:5dc1)
	TX_FAR _UnnamedText_71dc1
	db $50
; 0x71dc1 + 5 bytes

UnnamedText_71dc6: ; 71dc6 (1c:5dc6)
	TX_FAR _UnnamedText_71dc6
	db $50
; 0x71dc6 + 5 bytes

UnnamedText_71dcb: ; 71dcb (1c:5dcb)
	TX_FAR _UnnamedText_71dcb
	db $50
; 0x71dcb + 5 bytes

UnnamedText_71dd0: ; 71dd0 (1c:5dd0)
	TX_FAR _UnnamedText_71dd0
	db $50
; 0x71dd0 + 5 bytes

UnnamedText_71dd5: ; 71dd5 (1c:5dd5)
	TX_FAR _UnnamedText_71dd5
	db $50
; 0x71dd5 + 5 bytes

UnnamedText_71dda: ; 71dda (1c:5dda)
	TX_FAR _UnnamedText_71dda
	db $50
; 0x71dda + 5 bytes

; known jump sources: 3df6 (0:3df6)
Func_71ddf: ; 71ddf (1c:5ddf)
	call Load16BitRegisters
	ld a, b
	cp $ff
	jr nz, .asm_71dea
	ld a, [$cf1c]
.asm_71dea
	cp $fc
	jp z, Func_71fc2
	ld l, a
	ld h, $0
	add hl, hl
	ld de, Unknown_71f73 ; $5f73
	add hl, de
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ld de, Func_72156 ; $6156
	push de
	jp [hl]
	ld hl, Unknown_72448 ; $6448
	ld de, Unknown_721b5 ; $61b5
	ret
	ld hl, Unknown_72428 ; $6428
	ld de, $cf2d
	ld bc, $10
	call CopyData
; 71e12 (1c:5e12)
	ld a, [W_PLAYERBATTSTATUS3]
	ld hl, W_PLAYERMONID        ; player Pokemon ID
	call DeterminePaletteID
	ld b, a
	ld a, [W_ENEMYBATTSTATUS3]
	ld hl, W_ENEMYMONID                ; enemy Pokemon ID
	call DeterminePaletteID

	ld c, a
	ld hl, $cf2e
	ld a, [$cf1d]
	add $1f
	ld [hli], a
	inc hl
	ld a, [$cf1e]
	add $1f
	ld [hli], a
	inc hl
	ld a, b
	ld [hli], a
	inc hl
	ld a, c
	ld [hl], a
	ld hl, $cf2d
	ld de, Unknown_721b5 ; $61b5
	ld a, $1
	ld [$cf1c], a
	ret
	ld hl, Unknown_72458 ; $6458
	ld de, Unknown_7219e ; $619e
	ret
	ld hl, Unknown_72428 ; $6428
	ld de, $cf2d
	ld bc, $10
	call CopyData
	ld a, [$cf91]
	cp $bf
	jr c, .asm_71e64
	ld a, $1
.asm_71e64
	call Func_71f9d
	push af
	ld hl, $cf2e
	ld a, [$cf25]
	add $1f
	ld [hli], a
	inc hl
	pop af
	ld [hl], a
	ld hl, $cf2d
	ld de, Unknown_721fa ; $61fa
	ret
	ld hl, Unknown_72438 ; $6438
	ld de, $cf2e
	ret
	ld hl, Unknown_72468 ; $6468
	ld de, $cf2d
	ld bc, $10
	call CopyData
	ld a, [$cf91]
	call Func_71f9d
	ld hl, $cf30
	ld [hl], a
	ld hl, $cf2d
	ld de, Unknown_72222 ; $6222
	ret

INCBIN "baserom.gbc",$71e9f,$71ea6 - $71e9f
	ld hl, Unknown_72488 ; $6488
	ld de, Unknown_7228e ; $628e
	ret
	ld hl, Unknown_724a8 ; $64a8
	ld de, Unknown_7219e ; $619e
	ret
	ld hl, Unknown_724b8 ; $64b8
	ld de, Unknown_722c1 ; $62c1
	ret
	ld hl, Unknown_724c8 ; $64c8
	ld de, Unknown_723dd ; $63dd
	ld a, $8
	ld [$cf1c], a
	ret
	ld hl, Unknown_72428 ; $6428
	ld de, $cf2d
	ld bc, $10
	call CopyData
	ld a, [W_CURMAPTILESET] ; $d367
	cp $f
	jr z, .asm_71f0c
	cp $11
	jr z, .asm_71f10
	ld a, [W_CURMAP] ; $d35e
	cp $25
	jr c, .asm_71ef8
	cp $e2
	jr c, .asm_71ef5
	cp $e5
	jr c, .asm_71f10
	cp $f5
	jr z, .asm_71f14
	cp $f6
	jr z, .asm_71f10
.asm_71ef5
	ld a, [$d365]
.asm_71ef8
	cp $b
	jr c, .asm_71efe
	ld a, $ff
.asm_71efe
	inc a
	ld hl, $cf2e
	ld [hld], a
	ld de, Unknown_7219e ; $619e
	ld a, $9
	ld [$cf1c], a
	ret
.asm_71f0c
	ld a, $18
	jr .asm_71efe
.asm_71f10
	ld a, $22
	jr .asm_71efe
.asm_71f14
	xor a
	jr .asm_71efe
	push bc
	ld hl, Unknown_72428 ; $6428
	ld de, $cf2d
	ld bc, $10
	call CopyData
	pop bc
	ld a, c
	and a
	ld a, $1e
	jr nz, .asm_71f31
	ld a, [$cf1d]
	call Func_71f9d
.asm_71f31
	ld [$cf2e], a
	ld hl, $cf2d
	ld de, Unknown_7219e ; $619e
	ret
	ld hl, Unknown_72360 ; $6360
	ld de, $cc5b
	ld bc, $40
	call CopyData
	ld de, Unknown_71f8f ; $5f8f
	ld hl, $cc5d
	ld a, [W_OBTAINEDBADGES] ; $d356
	ld c, $8
.asm_71f52
	srl a
	push af
	jr c, .asm_71f62
	push bc
	ld a, [de]
	ld c, a
	xor a
.asm_71f5b
	ld [hli], a
	dec c
	jr nz, .asm_71f5b
	pop bc
	jr .asm_71f67
.asm_71f62
	ld a, [de]
.asm_71f63
	inc hl
	dec a
	jr nz, .asm_71f63
.asm_71f67
	pop af
	inc de
	dec c
	jr nz, .asm_71f52
	ld hl, Unknown_72498 ; $6498
	ld de, $cc5b
	ret

Unknown_71f73: ; 71f73 (1c:5f73)
INCBIN "baserom.gbc",$71f73,$71f8f - $71f73

Unknown_71f8f: ; 71f8f (1c:5f8f)
INCBIN "baserom.gbc",$71f8f,$71f97 - $71f8f

DeterminePaletteID: ; 71f97 (1c:5f97)
	bit 3, a                 ; bit 3 of battle status 3 (unused?)
	ld a, PAL_GREYMON
	ret nz
	ld a, [hl]
Func_71f9d: ; 71f9d (1c:5f9d)
	ld [$D11E], a
	and a
	jr z, .idZero
	push bc
	ld a, $3A
	call Predef               ; turn Pokemon ID number into Pokedex number
	pop bc
	ld a, [$D11E]
.idZero
	ld e, a
	ld d, $00
	ld hl, MonsterPalettes   ; not just for Pokemon, Trainers use it too
	add hl, de
	ld a, [hl]
	ret

; known jump sources: 12cf3 (4:6cf3)
Func_71fb6: ; 71fb6 (1c:5fb6)
	ld hl, Unknown_722f4 ; $62f4
	ld de, $cf2e
	ld bc, $30
	jp CopyData

; known jump sources: 71dec (1c:5dec)
Func_71fc2: ; 71fc2 (1c:5fc2)
	ld hl, $cf1f
	ld a, [$cf2d]
	ld e, a
	ld d, $0
	add hl, de
	ld e, l
	ld d, h
	ld a, [de]
	and a
	ld e, $5
	jr z, .asm_71fdb
	dec a
	ld e, $a
	jr z, .asm_71fdb
	ld e, $f
.asm_71fdb
	push de
	ld hl, $cf37
	ld bc, $6
	ld a, [$cf2d]
	call AddNTimes
	pop de
	ld [hl], e
	ret
; 71feb (1c:5feb)
SendSGBPacket: ; 71feb (1c:5feb)
;check number of packets
	ld a,[hl]
	and a,$07
	ret z
; store number of packets in B
	ld b,a
.loop2\@
; save B for later use
	push bc
; load a non-zero value in $fff9 to disable the routine that checks actual
; joypad input (said routine, located at $15f, does nothing if $fff9 is not
; zero)
	ld a,$01
	ld [$fff9],a
; send RESET signal (P14=LOW, P15=LOW)
	xor a
	ld [$ff00],a
; set P14=HIGH, P15=HIGH
	ld a,$30
	ld [$ff00],a
;load length of packets (16 bytes)
	ld b,$10
.nextByte\@
;set bit counter (8 bits per byte)
	ld e,$08
; get next byte in the packet
	ld a,[hli]
	ld d,a
.nextBit0\@
	bit 0,d
; if 0th bit is not zero set P14=HIGH,P15=LOW (send bit 1)
	ld a,$10
	jr nz,.next0\@
; else (if 0th bit is zero) set P14=LOW,P15=HIGH (send bit 0)
	ld a,$20
.next0\@
	ld [$ff00],a
; must set P14=HIGH,P15=HIGH between each "pulse"
	ld a,$30
	ld [$ff00],a
; rotation will put next bit in 0th position (so  we can always use command
; "bit 0,d" to fetch the bit that has to be sent)
	rr d
; decrease bit counter so we know when we have sent all 8 bits of current byte
	dec e
	jr nz,.nextBit0\@
	dec b
	jr nz,.nextByte\@
; send bit 1 as a "stop bit" (end of parameter data)
	ld a,$20
	ld [$ff00],a
; set P14=HIGH,P15=HIGH
	ld a,$30
	ld [$ff00],a
	xor a
	ld [$fff9],a
; wait for about 70000 cycles
	call Wait7000
; restore (previously pushed) number of packets
	pop bc
	dec b
; return if there are no more packets
	ret z
; else send 16 more bytes
	jr .loop2\@

; known jump sources: 1fd6 (0:1fd6)
Func_7202b: ; 7202b (1c:602b)
	xor a
	ld [$cf1b], a
	call Func_7209b
	ret nc
	ld a, $1
	ld [$cf1b], a
	ld a, [$cf1a]
	and a
	jr z, .asm_7203f
	ret
.asm_7203f
	di
	call Func_72075
	ei
	ld a, $1
	ld [$cf2d], a
	ld de, Unknown_72508 ; $6508
	ld hl, SGBBorderGraphics ; $6fe8
	call Func_7210b
	xor a
	ld [$cf2d], a
	ld de, Unknown_72518 ; $6518
	ld hl, BorderPalettes ; $6788
	call Func_7210b
	xor a
	ld [$cf2d], a
	ld de, Unknown_724d8 ; $64d8
	ld hl, SuperPalettes ; $6660
	call Func_7210b
	call ZeroVram
	ld hl, Unknown_72538 ; $6538
	jp SendSGBPacket

; known jump sources: 72040 (1c:6040)
Func_72075: ; 72075 (1c:6075)
	ld hl, Unknown_72089 ; $6089
	ld c, $9
.asm_7207a
	push bc
	ld a, [hli]
	push hl
	ld h, [hl]
	ld l, a
	call SendSGBPacket
	pop hl
	inc hl
	pop bc
	dec c
	jr nz, .asm_7207a
	ret

Unknown_72089: ; 72089 (1c:6089)
INCBIN "baserom.gbc",$72089,$7209b - $72089

; known jump sources: 7202f (1c:602f)
Func_7209b: ; 7209b (1c:609b)
	ld hl, Unknown_724f8 ; $64f8
	di
	call SendSGBPacket
	ld a, $1
	ld [$FF00+$f9], a
	ei
	call Wait7000
	ld a, [rJOYP] ; $FF00+$0
	and $3
	cp $3
	jr nz, .asm_720fd
	ld a, $20
	ld [rJOYP], a ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	call Wait7000
	call Wait7000
	ld a, $30
	ld [rJOYP], a ; $FF00+$0
	call Wait7000
	call Wait7000
	ld a, $10
	ld [rJOYP], a ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	call Wait7000
	call Wait7000
	ld a, $30
	ld [rJOYP], a ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	ld a, [rJOYP] ; $FF00+$0
	call Wait7000
	call Wait7000
	ld a, [rJOYP] ; $FF00+$0
	and $3
	cp $3
	jr nz, .asm_720fd
	call Func_72102
	and a
	ret
.asm_720fd
	call Func_72102
	scf
	ret

; known jump sources: 720f8 (1c:60f8), 720fd (1c:60fd)
Func_72102: ; 72102 (1c:6102)
	ld hl, Unknown_724e8 ; $64e8
	call SendSGBPacket
	jp Wait7000

; known jump sources: 7204f (1c:604f), 7205c (1c:605c), 72069 (1c:6069)
Func_7210b: ; 7210b (1c:610b)
	di
	push de
	call DisableLCD
	ld a, $e4
	ld [rBGP], a ; $FF00+$47
	ld de, $8800
	ld a, [$cf2d]
	and a
	jr z, .asm_72122
	call Func_72188
	jr .asm_72128
.asm_72122
	ld bc, $1000
	call CopyData
.asm_72128
	ld hl, $9800
	ld de, $c
	ld a, $80
	ld c, $d
.asm_72132
	ld b, $14
.asm_72134
	ld [hli], a
	inc a
	dec b
	jr nz, .asm_72134
	add hl, de
	dec c
	jr nz, .asm_72132
	ld a, $e3
	ld [rLCDC], a ; $FF00+$40
	pop hl
	call SendSGBPacket
	xor a
	ld [rBGP], a ; $FF00+$47
	ei
	ret
; 7214a (1c:614a)
Wait7000: ; 7214a (1c:614a)
; each loop takes about 10 cycles so this routine actually loops through 70000
; cycles.
	ld de,$1b58    ; = 7000
.loop\@
	nop
	nop
	nop
	dec de
	ld a,d
	or e
	jr nz,.loop\@
	ret

Func_72156: ; 72156 (1c:6156)
	ld a, [$cf1a]
	and a
	jr z, .asm_72165
	push de
	call Func_7216d
	pop hl
	call Func_72187
	ret
.asm_72165
	push de
	call SendSGBPacket
	pop hl
	jp SendSGBPacket

; known jump sources: 7215d (1c:615d)
Func_7216d: ; 7216d (1c:616d)
	ld a, $80
	ld [$FF00+$68], a
	inc hl
	ld c, $20
.asm_72174
	ld a, [hli]
	inc hl
	add a
	add a
	add a
	ld de, SuperPalettes ; $6660
	add e
	jr nc, .asm_72180
	inc d
.asm_72180
	ld a, [de]
	ld [$FF00+$69], a
	dec c
	jr nz, .asm_72174
	ret

; known jump sources: 72161 (1c:6161)
Func_72187: ; 72187 (1c:6187)
	ret

; known jump sources: 7211d (1c:611d)
Func_72188: ; 72188 (1c:6188)
	ld b, $80
.asm_7218a
	ld c, $10
.asm_7218c
	ld a, [hli]
	ld [de], a
	inc de
	dec c
	jr nz, .asm_7218c
	ld c, $10
	xor a
.asm_72195
	ld [de], a
	inc de
	dec c
	jr nz, .asm_72195
	dec b
	jr nz, .asm_7218a
	ret

Unknown_7219e: ; 7219e (1c:619e)
INCBIN "baserom.gbc",$7219e,$721b5 - $7219e

Unknown_721b5: ; 721b5 (1c:61b5)
INCBIN "baserom.gbc",$721b5,$721fa - $721b5

Unknown_721fa: ; 721fa (1c:61fa)
INCBIN "baserom.gbc",$721fa,$72222 - $721fa

Unknown_72222: ; 72222 (1c:6222)
INCBIN "baserom.gbc",$72222,$7228e - $72222

Unknown_7228e: ; 7228e (1c:628e)
INCBIN "baserom.gbc",$7228e,$722c1 - $7228e

Unknown_722c1: ; 722c1 (1c:62c1)
INCBIN "baserom.gbc",$722c1,$722f4 - $722c1

Unknown_722f4: ; 722f4 (1c:62f4)
INCBIN "baserom.gbc",$722f4,$72360 - $722f4

Unknown_72360: ; 72360 (1c:6360)
INCBIN "baserom.gbc",$72360,$723dd - $72360

Unknown_723dd: ; 723dd (1c:63dd)
INCBIN "baserom.gbc",$723dd,$72428 - $723dd

Unknown_72428: ; 72428 (1c:6428)
INCBIN "baserom.gbc",$72428,$72438 - $72428

Unknown_72438: ; 72438 (1c:6438)
INCBIN "baserom.gbc",$72438,$72448 - $72438

Unknown_72448: ; 72448 (1c:6448)
INCBIN "baserom.gbc",$72448,$72458 - $72448

Unknown_72458: ; 72458 (1c:6458)
INCBIN "baserom.gbc",$72458,$72468 - $72458

Unknown_72468: ; 72468 (1c:6468)
INCBIN "baserom.gbc",$72468,$72488 - $72468

Unknown_72488: ; 72488 (1c:6488)
INCBIN "baserom.gbc",$72488,$72498 - $72488

Unknown_72498: ; 72498 (1c:6498)
INCBIN "baserom.gbc",$72498,$724a8 - $72498

Unknown_724a8: ; 724a8 (1c:64a8)
INCBIN "baserom.gbc",$724a8,$724b8 - $724a8

Unknown_724b8: ; 724b8 (1c:64b8)
INCBIN "baserom.gbc",$724b8,$724c8 - $724b8

Unknown_724c8: ; 724c8 (1c:64c8)
INCBIN "baserom.gbc",$724c8,$724d8 - $724c8

Unknown_724d8: ; 724d8 (1c:64d8)
INCBIN "baserom.gbc",$724d8,$724e8 - $724d8

Unknown_724e8: ; 724e8 (1c:64e8)
INCBIN "baserom.gbc",$724e8,$724f8 - $724e8

Unknown_724f8: ; 724f8 (1c:64f8)
INCBIN "baserom.gbc",$724f8,$72508 - $724f8

Unknown_72508: ; 72508 (1c:6508)
INCBIN "baserom.gbc",$72508,$72518 - $72508

Unknown_72518: ; 72518 (1c:6518)
INCBIN "baserom.gbc",$72518,$72538 - $72518

Unknown_72538: ; 72538 (1c:6538)
INCBIN "baserom.gbc",$72538,$725c8 - $72538

MonsterPalettes: ; 725c8 (1c:65c8)
	db PAL_MEWMON    ; MISSINGNO
	db PAL_GREENMON  ; BULBASAUR
	db PAL_GREENMON  ; IVYSAUR
	db PAL_GREENMON  ; VENUSAUR
	db PAL_REDMON    ; CHARMANDER
	db PAL_REDMON    ; CHARMELEON
	db PAL_REDMON    ; CHARIZARD
	db PAL_CYANMON   ; SQUIRTLE
	db PAL_CYANMON   ; WARTORTLE
	db PAL_CYANMON   ; BLASTOISE
	db PAL_GREENMON  ; CATERPIE
	db PAL_GREENMON  ; METAPOD
	db PAL_CYANMON   ; BUTTERFREE
	db PAL_YELLOWMON ; WEEDLE
	db PAL_YELLOWMON ; KAKUNA
	db PAL_YELLOWMON ; BEEDRILL
	db PAL_BROWNMON  ; PIDGEY
	db PAL_BROWNMON  ; PIDGEOTTO
	db PAL_BROWNMON  ; PIDGEOT
	db PAL_GREYMON   ; RATTATA
	db PAL_GREYMON   ; RATICATE
	db PAL_BROWNMON  ; SPEAROW
	db PAL_BROWNMON  ; FEAROW
	db PAL_PURPLEMON ; EKANS
	db PAL_PURPLEMON ; ARBOK
	db PAL_YELLOWMON ; PIKACHU
	db PAL_YELLOWMON ; RAICHU
	db PAL_BROWNMON  ; SANDSHREW
	db PAL_BROWNMON  ; SANDSLASH
	db PAL_BLUEMON   ; NIDORAN_F
	db PAL_BLUEMON   ; NIDORINA
	db PAL_BLUEMON   ; NIDOQUEEN
	db PAL_PURPLEMON ; NIDORAN_M
	db PAL_PURPLEMON ; NIDORINO
	db PAL_PURPLEMON ; NIDOKING
	db PAL_PINKMON   ; CLEFAIRY
	db PAL_PINKMON   ; CLEFABLE
	db PAL_REDMON    ; VULPIX
	db PAL_YELLOWMON ; NINETALES
	db PAL_PINKMON   ; JIGGLYPUFF
	db PAL_PINKMON   ; WIGGLYTUFF
	db PAL_BLUEMON   ; ZUBAT
	db PAL_BLUEMON   ; GOLBAT
	db PAL_GREENMON  ; ODDISH
	db PAL_REDMON    ; GLOOM
	db PAL_REDMON    ; VILEPLUME
	db PAL_REDMON    ; PARAS
	db PAL_REDMON    ; PARASECT
	db PAL_PURPLEMON ; VENONAT
	db PAL_PURPLEMON ; VENOMOTH
	db PAL_BROWNMON  ; DIGLETT
	db PAL_BROWNMON  ; DUGTRIO
	db PAL_YELLOWMON ; MEOWTH
	db PAL_YELLOWMON ; PERSIAN
	db PAL_YELLOWMON ; PSYDUCK
	db PAL_CYANMON   ; GOLDUCK
	db PAL_BROWNMON  ; MANKEY
	db PAL_BROWNMON  ; PRIMEAPE
	db PAL_BROWNMON  ; GROWLITHE
	db PAL_REDMON    ; ARCANINE
	db PAL_BLUEMON   ; POLIWAG
	db PAL_BLUEMON   ; POLIWHIRL
	db PAL_BLUEMON   ; POLIWRATH
	db PAL_YELLOWMON ; ABRA
	db PAL_YELLOWMON ; KADABRA
	db PAL_YELLOWMON ; ALAKAZAM
	db PAL_GREYMON   ; MACHOP
	db PAL_GREYMON   ; MACHOKE
	db PAL_GREYMON   ; MACHAMP
	db PAL_GREENMON  ; BELLSPROUT
	db PAL_GREENMON  ; WEEPINBELL
	db PAL_GREENMON  ; VICTREEBEL
	db PAL_CYANMON   ; TENTACOOL
	db PAL_CYANMON   ; TENTACRUEL
	db PAL_GREYMON   ; GEODUDE
	db PAL_GREYMON   ; GRAVELER
	db PAL_GREYMON   ; GOLEM
	db PAL_REDMON    ; PONYTA
	db PAL_REDMON    ; RAPIDASH
	db PAL_PINKMON   ; SLOWPOKE
	db PAL_PINKMON   ; SLOWBRO
	db PAL_GREYMON   ; MAGNEMITE
	db PAL_GREYMON   ; MAGNETON
	db PAL_BROWNMON  ; FARFETCH_D
	db PAL_BROWNMON  ; DODUO
	db PAL_BROWNMON  ; DODRIO
	db PAL_BLUEMON   ; SEEL
	db PAL_BLUEMON   ; DEWGONG
	db PAL_PURPLEMON ; GRIMER
	db PAL_PURPLEMON ; MUK
	db PAL_GREYMON   ; SHELLDER
	db PAL_GREYMON   ; CLOYSTER
	db PAL_PURPLEMON ; GASTLY
	db PAL_PURPLEMON ; HAUNTER
	db PAL_PURPLEMON ; GENGAR
	db PAL_GREYMON   ; ONIX
	db PAL_YELLOWMON ; DROWZEE
	db PAL_YELLOWMON ; HYPNO
	db PAL_REDMON    ; KRABBY
	db PAL_REDMON    ; KINGLER
	db PAL_YELLOWMON ; VOLTORB
	db PAL_YELLOWMON ; ELECTRODE
	db PAL_PINKMON   ; EXEGGCUTE
	db PAL_GREENMON  ; EXEGGUTOR
	db PAL_GREYMON   ; CUBONE
	db PAL_GREYMON   ; MAROWAK
	db PAL_BROWNMON  ; HITMONLEE
	db PAL_BROWNMON  ; HITMONCHAN
	db PAL_PINKMON   ; LICKITUNG
	db PAL_PURPLEMON ; KOFFING
	db PAL_PURPLEMON ; WEEZING
	db PAL_GREYMON   ; RHYHORN
	db PAL_GREYMON   ; RHYDON
	db PAL_PINKMON   ; CHANSEY
	db PAL_BLUEMON   ; TANGELA
	db PAL_BROWNMON  ; KANGASKHAN
	db PAL_CYANMON   ; HORSEA
	db PAL_CYANMON   ; SEADRA
	db PAL_REDMON    ; GOLDEEN
	db PAL_REDMON    ; SEAKING
	db PAL_REDMON    ; STARYU
	db PAL_GREYMON   ; STARMIE
	db PAL_PINKMON   ; MR_MIME
	db PAL_GREENMON  ; SCYTHER
	db PAL_MEWMON    ; JYNX
	db PAL_YELLOWMON ; ELECTABUZZ
	db PAL_REDMON    ; MAGMAR
	db PAL_BROWNMON  ; PINSIR
	db PAL_GREYMON   ; TAUROS
	db PAL_REDMON    ; MAGIKARP
	db PAL_BLUEMON   ; GYARADOS
	db PAL_CYANMON   ; LAPRAS
	db PAL_GREYMON   ; DITTO
	db PAL_GREYMON   ; EEVEE
	db PAL_CYANMON   ; VAPOREON
	db PAL_YELLOWMON ; JOLTEON
	db PAL_REDMON    ; FLAREON
	db PAL_GREYMON   ; PORYGON
	db PAL_BLUEMON   ; OMANYTE
	db PAL_BLUEMON   ; OMASTAR
	db PAL_BROWNMON  ; KABUTO
	db PAL_BROWNMON  ; KABUTOPS
	db PAL_GREYMON   ; AERODACTYL
	db PAL_PINKMON   ; SNORLAX
	db PAL_BLUEMON   ; ARTICUNO
	db PAL_YELLOWMON ; ZAPDOS
	db PAL_REDMON    ; MOLTRES
	db PAL_GREYMON   ; DRATINI
	db PAL_BLUEMON   ; DRAGONAIR
	db PAL_BROWNMON  ; DRAGONITE
	db PAL_MEWMON    ; MEWTWO
	db PAL_MEWMON    ; MEW

; palettes for overworlds, title screen, monsters
SuperPalettes: ; 72660 (1c:6660)
	RGB 31,29,31 ; PAL_ROUTE
	RGB 21,28,11
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_PALLET
	RGB 25,28,27
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_VIRIDIAN
	RGB 17,26,3
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_PEWTER
	RGB 23,25,16
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_CERULEAN
	RGB 17,20,30
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_LAVENDER
	RGB 27,20,27
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_VERMILION
	RGB 30,18,0
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_CELADON
	RGB 16,30,22
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_FUCHSIA
	RGB 31,15,22
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_CINNABAR
	RGB 26,10,6
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_INDIGO
	RGB 22,14,24
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_SAFFRON
	RGB 27,27,3
	RGB 20,26,31
	RGB 3,2,2
	RGB 31,29,31 ; PAL_TOWNMAP
	RGB 20,26,31
	RGB 17,23,10
	RGB 3,2,2
IF _RED
	RGB 31,29,31 ; PAL_LOGO1
	RGB 30,30,17
	RGB 17,23,10
	RGB 21,0,4
ENDC
IF _BLUE
	RGB 31,29,31 ; PAL_LOGO1
	RGB 30,30,17
	RGB 21,0,4
	RGB 14,19,29
ENDC
	RGB 31,29,31 ; XXX
	RGB 30,30,17
	RGB 18,18,24
	RGB 7,7,16
	RGB 31,29,31 ; PAL_LOGO2
	RGB 24,20,30
	RGB 11,20,30
	RGB 3,2,2
	RGB 31,29,31 ; PAL_MEWMON
	RGB 30,22,17
	RGB 16,14,19
	RGB 3,2,2
	RGB 31,29,31 ; PAL_BLUEMON
	RGB 18,20,27
	RGB 11,15,23
	RGB 3,2,2
	RGB 31,29,31 ; PAL_REDMON
	RGB 31,20,10
	RGB 26,10,6
	RGB 3,2,2
	RGB 31,29,31 ; PAL_CYANMON
	RGB 21,25,29
	RGB 14,19,25
	RGB 3,2,2
	RGB 31,29,31 ; PAL_PURPLEMON
	RGB 27,22,24
	RGB 21,15,23
	RGB 3,2,2
	RGB 31,29,31 ; PAL_BROWNMON
	RGB 28,20,15
	RGB 21,14,9
	RGB 3,2,2
	RGB 31,29,31 ; PAL_GREENMON
	RGB 20,26,16
	RGB 9,20,11
	RGB 3,2,2
	RGB 31,29,31 ; PAL_PINKMON
	RGB 30,22,24
	RGB 28,15,21
	RGB 3,2,2
	RGB 31,29,31 ; PAL_YELLOWMON
	RGB 31,28,14
	RGB 26,20,0
	RGB 3,2,2
	RGB 31,29,31 ; PAL_GREYMON
	RGB 26,21,22
	RGB 15,15,18
	RGB 3,2,2
	RGB 31,29,31 ; PAL_SLOTS1
	RGB 26,21,22
	RGB 27,20,6
	RGB 3,2,2
	RGB 31,29,31 ; PAL_SLOTS2
	RGB 31,31,17
IF _RED
	RGB 25,17,21
ENDC
IF _BLUE
	RGB 16,19,29
ENDC
	RGB 3,2,2
	RGB 31,29,31 ; PAL_SLOTS3
	RGB 22,31,16
IF _RED
	RGB 25,17,21
ENDC
IF _BLUE
	RGB 16,19,29
ENDC
	RGB 3,2,2
	RGB 31,29,31 ; PAL_SLOTS4
IF _RED
	RGB 16,19,29
	RGB 25,17,21
ENDC
IF _BLUE
	RGB 25,17,21
	RGB 16,19,29
ENDC
	RGB 3,2,2
	RGB 31,29,31 ; PAL_BLACK
	RGB 7,7,7
	RGB 2,3,3
	RGB 3,2,2
	RGB 31,29,31 ; PAL_GREENBAR
	RGB 30,26,15
	RGB 9,20,11
	RGB 3,2,2
	RGB 31,29,31 ; PAL_YELLOWBAR
	RGB 30,26,15
	RGB 26,20,0
	RGB 3,2,2
	RGB 31,29,31 ; PAL_REDBAR
	RGB 30,26,15
	RGB 26,10,6
	RGB 3,2,2
	RGB 31,29,31 ; PAL_BADGE
	RGB 30,22,17
	RGB 11,15,23
	RGB 3,2,2
	RGB 31,29,31 ; PAL_CAVE
	RGB 21,14,9
	RGB 18,24,22
	RGB 3,2,2
	RGB 31,29,31 ; XXX
	RGB 31,28,14
	RGB 24,20,10
	RGB 3,2,2
BorderPalettes: ; 72788 (1c:6788)

IF _RED
	INCBIN "gfx/red/sgbborder.map"
ENDC
IF _BLUE
	INCBIN "gfx/blue/sgbborder.map"
ENDC

INCBIN "baserom.gbc",$72e88,$72ede - $72e88

Unknown_72ede: ; 72ede (1c:6ede)
INCBIN "baserom.gbc",$72ede,$72f88 - $72ede
IF _RED
	RGB 30,29,29 ; PAL_SGB1
	RGB 25,22,25
	RGB 25,17,21
	RGB 24,14,12
ENDC
IF _BLUE
	RGB 0,0,0 ; PAL_SGB1 (the first color is not defined, but if used, turns up as 30,29,29... o_O)
	RGB 10,17,26
	RGB 5,9,20
	RGB 16,20,27
ENDC

INCBIN "baserom.gbc",$72f90,$72fa8 - $72f90

IF _RED
	RGB 30,29,29 ; PAL_SGB2
	RGB 22,31,16
	RGB 27,20,6
	RGB 15,15,15
ENDC
IF _BLUE
	RGB 30,29,29 ; PAL_SGB2
	RGB 27,11,6
	RGB 5,9,20
	RGB 28,25,15
ENDC

INCBIN "baserom.gbc",$72fb0,$72fc8 - $72fb0

IF _RED
	RGB 30,29,29 ; PAL_SGB3
	RGB 31,31,17
	RGB 18,21,29
	RGB 15,15,15
ENDC
IF _BLUE
	RGB 30,29,29 ; PAL_SGB3
	RGB 12,15,11
	RGB 5,9,20
	RGB 14,22,17
ENDC

INCBIN "baserom.gbc",$72fd0,$72fe8 - $72fd0

SGBBorderGraphics: ; 72fe8 (1c:6fe8)
IF _RED
	INCBIN "gfx/red/sgbborder.2bpp"
ENDC
IF _BLUE
	INCBIN "gfx/blue/sgbborder.2bpp"
ENDC

; known jump sources: 4a9 (0:4a9), 5b04 (1:5b04)
LoadSAV: ; 735e8 (1c:75e8)
;(if carry -> write
;"the file data is destroyed")
	call ClearScreen
	call LoadFontTilePatterns
	call LoadTextBoxTilePatterns
	call LoadSAVCheckSum
	jr c, .badsum
	call LoadSAVCheckSum1
	jr c, .badsum
	call LoadSAVCheckSum2
	jr c, .badsum
	ld a, $2 ; good checksum
	jr .goodsum
.badsum
	ld hl, $d730
	push hl
	set 6, [hl]
	ld hl, FileDataDestroyedText ; $761e
	call PrintText
	ld c, $64
	call DelayFrames
	pop hl
	res 6, [hl]
	ld a, $1 ; bad checksum
.goodsum
	ld [$d088], a ; checksum flag
	ret

FileDataDestroyedText: ; 7361e (1c:761e)
	TX_FAR _FileDataDestroyedText
	db "@"

; known jump sources: 735f1 (1c:75f1)
LoadSAVCheckSum: ; 73623 (1c:7623)
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	ld [$4000], a
	ld hl, $a598 ; hero name located in SRAM
	ld bc, $f8b ; but here checks the full SAV
	call SAVCheckSum
	ld c, a
	ld a, [$b523] ; SAV's checksum
	cp c
	jp z, .Func_73652
	ld hl, $a598
	ld bc, $f8b
	call SAVCheckSum
	ld c, a
	ld a, [$b523] ; SAV's checksum
	cp c
	jp nz, SAVBadCheckSum

.Func_73652 ; 73652 (1c:7652)
	ld hl, $a598
	ld de, W_PLAYERNAME ; $d158
	ld bc, $b
	call CopyData
	ld hl, $a5a3
	ld de, W_OWNEDPOKEMON ; $d2f7
	ld bc, $789
	call CopyData
	ld hl, W_CURMAPTILESET ; $d367
	set 7, [hl]
	ld hl, $ad2c
	ld de, $c100
	ld bc, $200
	call CopyData
	ld a, [$b522]
	ld [$FF00+$d7], a
	ld hl, $b0c0
	ld de, W_NUMINBOX ; $da80
	ld bc, $462
	call CopyData
	and a
	jp SAVGoodChecksum

; known jump sources: 735f6 (1c:75f6)
LoadSAVCheckSum1: ; 73690 (1c:7690)
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	ld [$4000], a
	ld hl, $a598 ; hero name located in SRAM
	ld bc, $f8b  ; but here checks the full SAV
	call SAVCheckSum
	ld c, a
	ld a, [$b523] ; SAV's checksum
	cp c
	jr nz, SAVBadCheckSum
	ld hl, $b0c0
	ld de, W_NUMINBOX ; $da80
	ld bc, $462
	call CopyData
	and a
	jp SAVGoodChecksum

; known jump sources: 735fb (1c:75fb)
LoadSAVCheckSum2: ; 736bd (1c:76bd)
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	ld [$4000], a
	ld hl, $a598 ; hero name located in SRAM
	ld bc, $f8b  ; but here checks the full SAV
	call SAVCheckSum
	ld c, a
	ld a, [$b523] ; SAV's checksum
	cp c
	jp nz, SAVBadCheckSum
	ld hl, $af2c
	ld de, W_NUMINPARTY ; $d163
	ld bc, $194
	call CopyData
	ld hl, $a5a3
	ld de, W_OWNEDPOKEMON ; $d2f7
	ld bc, $26
	call CopyData
	and a
	jp SAVGoodChecksum

; known jump sources: 7364f (1c:764f), 736ab (1c:76ab), 736d8 (1c:76d8)
SAVBadCheckSum: ; 736f7 (1c:76f7)
	scf

; known jump sources: 7368d (1c:768d), 736ba (1c:76ba), 736f4 (1c:76f4)
SAVGoodChecksum: ; 736f8 (1c:76f8)
	ld a, $0
	ld [$6000], a
	ld [$0], a
	ret

Function_73701: ; 0x73701
	call LoadSAVCheckSum
	call LoadSAVCheckSum1
	jp LoadSAVCheckSum2

SaveSAV: ;$770a
	ld b,1
	ld hl,$5def ; LoadGameMenuInGame
	call Bankswitch
	ld hl,WouldYouLikeToSaveText
	call SaveSAVConfirm
	and a   ;|0 = Yes|1 = No|
	ret nz
	ld a,[$d088]
	dec a
	jr z,.save
	call SAVCheckRandomID
	jr z,.save
	ld hl,OlderFileWillBeErasedText
	call SaveSAVConfirm
	and a
	ret nz
.save        ;$772d
	call SaveSAVtoSRAM      ;$7848
	FuncCoord 1,13
	ld hl,Coord
	ld bc,$0412
	call $18c4      ;clear area 4x12 starting at 13,1
	FuncCoord 1,14
	ld hl,Coord
	ld de,NowSavingString
	call $1955
	ld c,$78
	call DelayFrames
	ld hl,GameSavedText
	call PrintText
	ld a,$b6        ;sound for saved game?
	call $3740      ;sound-related
	call $3748      ;sound-related
	ld c,$1e
	jp DelayFrames

NowSavingString:
	db "Now saving...@"

SaveSAVConfirm:
;$7768
	call PrintText
	FuncCoord 0, 7
	ld hl,Coord
	ld bc,$0801     ;arrow's coordinates |b = Y|c = X|
	ld a,$14        ;one line shifting ($28 = 2 lines)
	ld [$d125],a
	call DisplayTextBoxID      ;handle Yes/No KeyPress
	ld a,[$cc26]
	ret

WouldYouLikeToSaveText: ; 0x7377d
	TX_FAR _WouldYouLikeToSaveText
	db "@"

GameSavedText: ; 73782 (1c:7782)
	TX_FAR _GameSavedText
	db "@"

OlderFileWillBeErasedText: ; 73787 (1c:7787)
	TX_FAR _OlderFileWillBeErasedText
	db "@"

; known jump sources: 7384d (1c:784d)
SaveSAVtoSRAM0: ; 7378c (1c:778c)
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	ld [$4000], a
	ld hl, W_PLAYERNAME ; $d158
	ld de, $a598
	ld bc, $b
	call CopyData
	ld hl, W_OWNEDPOKEMON ; $d2f7
	ld de, $a5a3
	ld bc, $789
	call CopyData
	ld hl, $c100 ; OAM?
	ld de, $ad2c
	ld bc, $200
	call CopyData
	ld hl, W_NUMINBOX ; $da80
	ld de, $b0c0
	ld bc, $462
	call CopyData
	ld a, [$FF00+$d7]
	ld [$b522], a
	ld hl, $a598
	ld bc, $f8b
	call SAVCheckSum
	ld [$b523], a
	xor a
	ld [$6000], a
	ld [$0], a
	ret

; known jump sources: 73850 (1c:7850)
SaveSAVtoSRAM1: ; 737e2 (1c:77e2)
; stored pokémon
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	ld [$4000], a
	ld hl, W_NUMINBOX ; $da80
	ld de, $b0c0
	ld bc, $462
	call CopyData
	ld hl, $a598
	ld bc, $f8b
	call SAVCheckSum
	ld [$b523], a
	xor a
	ld [$6000], a
	ld [$0], a
	ret

; known jump sources: 73853 (1c:7853)
SaveSAVtoSRAM2: ; 7380f (1c:780f)
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	ld [$4000], a
	ld hl, W_NUMINPARTY ; $d163
	ld de, $af2c
	ld bc, $194
	call CopyData
	ld hl, W_OWNEDPOKEMON ; pokédex only
	ld de, $a5a3
	ld bc, $26
	call CopyData
	ld hl, $a598
	ld bc, $f8b
	call SAVCheckSum
	ld [$b523], a
	xor a
	ld [$6000], a
	ld [$0], a
	ret

; known jump sources: 7245 (1:7245), 5a4fa (16:64fa), 738f7 (1c:78f7)
SaveSAVtoSRAM: ; 73848 (1c:7848)
	ld a, $2
	ld [$d088], a
	call SaveSAVtoSRAM0
	call SaveSAVtoSRAM1
	jp SaveSAVtoSRAM2

; known jump sources: 73636 (1c:7636), 73647 (1c:7647), 736a3 (1c:76a3), 736d0 (1c:76d0), 737d4 (1c:77d4), 73801 (1c:7801), 7383a (1c:783a), 73870 (1c:7870), 7392e (1c:792e), 73a75 (1c:7a75)
SAVCheckSum: ; 73856 (1c:7856)
;Check Sum (result[1 byte] is complemented)
	ld d, $0
.loop
	ld a, [hli]
	add d
	ld d, a
	dec bc
	ld a, b
	or c
	jr nz, .loop
	ld a, d
	cpl
	ret

; known jump sources: 73934 (1c:7934), 73a7b (1c:7a7b)
Func_73863: ; 73863 (1c:7863)
	ld hl, $a000
	ld de, $ba4d
	ld b, $6
.asm_7386b
	push bc
	push de
	ld bc, $462
	call SAVCheckSum
	pop de
	ld [de], a
	inc de
	pop bc
	dec b
	jr nz, .asm_7386b
	ret

; known jump sources: 738cd (1c:78cd), 738e0 (1c:78e0)
Func_7387b: ; 7387b (1c:787b)
	ld hl, Unknown_73895 ; $7895
	ld a, [$d5a0]
	and $7f
	cp $6
	ld b, $2
	jr c, .asm_7388c
	inc b
	sub $6
.asm_7388c
	ld e, a
	ld d, $0
	add hl, de
	add hl, de
	ld a, [hli]
	ld h, [hl]
	ld l, a
	ret

Unknown_73895: ; 73895 (1c:7895)
INCBIN "baserom.gbc",$73895,$738a1 - $73895

; known jump sources: 216b8 (8:56b8)
Func_738a1: ; 738a1 (1c:78a1)
	ld hl, UnnamedText_73909 ; $7909
	call PrintText
	call YesNoChoice
	ld a, [W_CURMENUITEMID] ; $cc26
	and a
	ret nz
	ld hl, $d5a0
	bit 7, [hl]
	call z, Func_73a29
	call Func_7393f
	call UpdateSprites
	ld hl, $fff6
	set 1, [hl]
	call HandleMenuInput
	ld hl, $fff6
	res 1, [hl]
	bit 1, a
	ret nz
	call Func_7387b
	ld e, l
	ld d, h
	ld hl, W_NUMINBOX ; $da80
	call Func_7390e
	ld a, [W_CURMENUITEMID] ; $cc26
	set 7, a
	ld [$d5a0], a
	call Func_7387b
	ld de, W_NUMINBOX ; $da80
	call Func_7390e
	ld hl, W_MAPTEXTPTR ; $d36c
	ld de, W_WHICHTRADE ; $cd3d
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hl]
	ld [de], a
	call Func_3f05
	call SaveSAVtoSRAM
	ld hl, W_WHICHTRADE ; $cd3d
	call Func_3f0f
	ld a, $b6
	call PlaySoundWaitForCurrent
	call WaitForSoundToFinish
	ret
; 73909 (1c:7909)
UnnamedText_73909: ; 73909 (1c:7909)
	TX_FAR _UnnamedText_73909
	db $50
; 0x73909 + 5 bytes

; known jump sources: 738d5 (1c:78d5), 738e6 (1c:78e6)
Func_7390e: ; 7390e (1c:790e)
	push hl
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	ld a, b
	ld [$4000], a
	ld bc, $462
	call CopyData
	pop hl
	xor a
	ld [hli], a
	dec a
	ld [hl], a
	ld hl, $a000
	ld bc, $1a4c
	call SAVCheckSum
	ld [$ba4c], a
	call Func_73863
	xor a
	ld [$6000], a
	ld [$0], a
	ret

; known jump sources: 738b7 (1c:78b7)
Func_7393f: ; 7393f (1c:793f)
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, $3
	ld [W_MENUWATCHEDKEYS], a ; $cc29
	ld a, $b
	ld [W_MAXMENUITEMID], a ; $cc28
	ld a, $1
	ld [W_TOPMENUITEMY], a ; $cc24
	ld a, $c
	ld [W_TOPMENUITEMX], a ; $cc25
	xor a
	ld [$cc37], a
	ld a, [$d5a0]
	and $7f
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_OLDMENUITEMID], a ; $cc2a
	ld hl, W_SCREENTILESBUFFER
	ld b, $2
	ld c, $9
	call TextBoxBorder
	ld hl, UnnamedText_739d4 ; $79d4
	call PrintText
	FuncCoord 11, 0 ; $c3ab
	ld hl, Coord
	ld b, $c
	ld c, $7
	call TextBoxBorder
	ld hl, $fff6
	set 2, [hl]
	ld de, Unknown_739d9 ; $79d9
	FuncCoord 13, 1 ; $c3c1
	ld hl, Coord
	call PlaceString
	ld hl, $fff6
	res 2, [hl]
	ld a, [$d5a0]
	and $7f
	cp $9
	jr c, .asm_739a6
	sub $9
	FuncCoord 8, 2 ; $c3d0
	ld hl, Coord
	ld [hl], $f7
	add $f6
	jr .asm_739a8
.asm_739a6
	add $f7
.asm_739a8
	FuncCoord 9, 2 ; $c3d1
	ld [Coord], a
	FuncCoord 1, 2 ; $c3c9
	ld hl, Coord
	ld de, Unknown_73a21 ; $7a21
	call PlaceString
	call Func_73a84
	FuncCoord 18, 1 ; $c3c6
	ld hl, Coord
	ld de, W_WHICHTRADE ; $cd3d
	ld bc, $14
	ld a, $c
.asm_739c2
	push af
	ld a, [de]
	and a
	jr z, .asm_739c9
	ld [hl], $78
.asm_739c9
	add hl, bc
	inc de
	pop af
	dec a
	jr nz, .asm_739c2
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ret
; 739d4 (1c:79d4)
UnnamedText_739d4: ; 739d4 (1c:79d4)
	TX_FAR _UnnamedText_739d4
	db $50
; 0x739d4 + 5 bytes

Unknown_739d9: ; 739d9 (1c:79d9)
INCBIN "baserom.gbc",$739d9,$73a21 - $739d9

Unknown_73a21: ; 73a21 (1c:7a21)
INCBIN "baserom.gbc",$73a21,$73a29 - $73a21

; known jump sources: 738b4 (1c:78b4)
Func_73a29: ; 73a29 (1c:7a29)
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	ld a, $2
	ld [$4000], a
	call Func_73a4b
	ld a, $3
	ld [$4000], a
	call Func_73a4b
	xor a
	ld [$6000], a
	ld [$0], a
	ret

; known jump sources: 73a38 (1c:7a38), 73a40 (1c:7a40)
Func_73a4b: ; 73a4b (1c:7a4b)
	ld hl, $a000
	call Func_73a7f
	ld hl, $a462
	call Func_73a7f
	ld hl, $a8c4
	call Func_73a7f
	ld hl, $ad26
	call Func_73a7f
	ld hl, $b188
	call Func_73a7f
	ld hl, $b5ea
	call Func_73a7f
	ld hl, $a000
	ld bc, $1a4c
	call SAVCheckSum
	ld [$ba4c], a
	call Func_73863
	ret

; known jump sources: 73a4e (1c:7a4e), 73a54 (1c:7a54), 73a5a (1c:7a5a), 73a60 (1c:7a60), 73a66 (1c:7a66), 73a6c (1c:7a6c)
Func_73a7f: ; 73a7f (1c:7a7f)
	xor a
	ld [hli], a
	dec a
	ld [hl], a
	ret

; known jump sources: 739b4 (1c:79b4)
Func_73a84: ; 73a84 (1c:7a84)
	ld hl, W_WHICHTRADE ; $cd3d
	push hl
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	ld a, $2
	ld [$4000], a
	call Func_73ab8
	ld a, $3
	ld [$4000], a
	call Func_73ab8
	xor a
	ld [$6000], a
	ld [$0], a
	pop hl
	ld a, [$d5a0]
	and $7f
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [W_NUMINBOX] ; $da80
	ld [hl], a
	ret

; known jump sources: 73a97 (1c:7a97), 73a9f (1c:7a9f)
Func_73ab8: ; 73ab8 (1c:7ab8)
	ld a, [$a000]
	ld [hli], a
	ld a, [$a462]
	ld [hli], a
	ld a, [$a8c4]
	ld [hli], a
	ld a, [$ad26]
	ld [hli], a
	ld a, [$b188]
	ld [hli], a
	ld a, [$b5ea]
	ld [hli], a
	ret

SAVCheckRandomID: ;$7ad1
;checks if Sav file is the same by checking player's name 1st letter ($a598)
; and the two random numbers generated at game beginning
;(which are stored at $d359-d35a)
	ld a,$0a
	ld [$0000],a
	ld a,$01
	ld [$6000],a
	ld [$4000],a
	ld a,[$a598]
	and a
	jr z,.next
	ld hl,$a598
	ld bc,$0f8b
	call SAVCheckSum
	ld c,a
	ld a,[$b523]
	cp c
	jr nz,.next
	ld hl,$a605
	ld a,[hli]
	ld h,[hl]
	ld l,a
	ld a,[$d359]
	cp l
	jr nz,.next
	ld a,[$d35a]
	cp h
.next
	ld a,$00
	ld [$6000],a
	ld [$0000],a
	ret

; known jump sources: 7024e (1c:424e)
Func_73b0d: ; 73b0d (1c:7b0d)
	ld a, [$d5a2]
	dec a
	cp $32
	jr nc, .asm_73b28
	ld hl, $a598
	ld bc, $60
	call AddNTimes
	ld e, l
	ld d, h
	ld hl, $cc5b
	ld bc, $60
	jr CopyToSRAM0
.asm_73b28
	ld hl, $a5f8
	ld de, $a598
	ld bc, $1260
	call CopyToSRAM0
	ld hl, $cc5b
	ld de, $b7f8
	ld bc, $60
	jr CopyToSRAM0

; known jump sources: 765be (1d:65be)
Func_73b3f: ; 73b3f (1c:7b3f)
	ld hl, $a598
	ld bc, $60
	ld a, [W_WHICHTRADE] ; $cd3d
	call AddNTimes
	ld de, $cc5b
	ld bc, $60
	; fallthrough
CopyToSRAM0: ; 73b51 (1c:7b51)
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	xor a
	ld [$4000], a
	call CopyData
	xor a
	ld [$6000], a
	ld [$0], a
	ret

; known jump sources: 1c9bb (7:49bb)
Func_73b6a: ; 73b6a (1c:7b6a)
	ld a, $a
	ld [$0], a
	ld a, $1
	ld [$6000], a
	xor a
	call PadSRAM_FF
	ld a, $1
	call PadSRAM_FF
	ld a, $2
	call PadSRAM_FF
	ld a, $3
	call PadSRAM_FF
	xor a
	ld [$6000], a
	ld [$0], a
	ret

; known jump sources: 73b75 (1c:7b75), 73b7a (1c:7b7a), 73b7f (1c:7b7f), 73b84 (1c:7b84)
PadSRAM_FF: ; 73b8f (1c:7b8f)
	ld [$4000], a
	ld hl, $a000
	ld bc, $2000
	ld a, $ff
	jp FillMemory


SECTION "bank1D",ROMX,BANK[$1D]

CopycatsHouseF1Blocks: ; 74000 (1d:4000)
	INCBIN "maps/copycatshousef1.blk"

CinnabarMartBlocks: ; 74010 (1d:4010)
PewterMartBlocks: ; 74010 (1d:4010)
	INCBIN "maps/pewtermart.blk"

FuchsiaHouse1Blocks: ; 74020 (1d:4020)
	INCBIN "maps/fuchsiahouse1.blk"

CinnabarPokecenterBlocks: ; 74030 (1d:4030)
FuchsiaPokecenterBlocks: ; 74030 (1d:4030)
	INCBIN "maps/fuchsiapokecenter.blk"

CeruleanHouse3Blocks: ; 7404c (1d:404c)
	INCBIN "maps/ceruleanhouse3.blk"

; known jump sources: 5a4c8 (16:64c8)
Func_7405c: ; 7405c (1d:405c)
	ld b, BANK(Func_701a0)
	ld hl, Func_701a0
	call Bankswitch ; indirect jump to Func_701a0 (701a0 (1c:41a0))
	call ClearScreen
	ld c, $64
	call DelayFrames
	call DisableLCD
	ld hl, $8800
	ld bc, $400
	call Func_74171
	ld hl, $9600
	ld bc, $100
	call Func_74171
	ld hl, $97e0
	ld bc, $10
	ld a, $ff
	call FillMemory
	ld hl, W_SCREENTILESBUFFER
	call Func_7417b
	FuncCoord 0, 14 ; $c4b8
	ld hl, Coord
	call Func_7417b
	ld a, $c0
	ld [rBGP], a ; $FF00+$47
	call EnableLCD
	ld a, $ff
	call PlaySoundWaitForCurrent
	ld c, $1f
	ld a, $c7
	call PlayMusic
	ld c, $80
	call DelayFrames
	xor a
	ld [W_WHICHTRADE], a ; $cd3d
	ld [$cd3e], a
	jp Func_7418e

; known jump sources: 741d5 (1d:41d5), 741e6 (1d:41e6), 74226 (1d:4226)
Func_740ba: ; 740ba (1d:40ba)
	ld hl, Unknown_74160 ; $4160
	ld b, $4
.asm_740bf
	ld a, [hli]
	ld [rBGP], a ; $FF00+$47
	ld c, $5
	call DelayFrames
	dec b
	jr nz, .asm_740bf
	ret
; 740cb (1d:40cb)
Func40CB: ; 740cb (1d:40cb)
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a
	call SaveScreenTilesToBuffer1
	call Unknown_74183

	; display the next monster from CreditsMons
	ld hl,$CD3E
	ld c,[hl] ; how many monsters have we displayed so far?
	inc [hl]
	ld b,0
	ld hl,CreditsMons
	add hl,bc ; go that far in the list of monsters and get the next one
	ld a,[hl]
	ld [$CF91],a
	ld [$D0B5],a
	FuncCoord 8, 6 ; $c420
	ld hl,Coord
	call GetMonHeader
	call LoadFrontSpriteByMonIndex
	ld hl,$980C
	call Unknown_74164
	xor a
	ld [H_AUTOBGTRANSFERENABLED],a
	call LoadScreenTilesFromBuffer1
	ld hl,$9800
	call Unknown_74164
	ld a,$A7
	ld [$FF4B],a
	ld hl,$9C00
	call Unknown_74164
	call Unknown_74183
	ld a,$FC
	ld [$FF47],a
	ld bc,7
.next
	call Unknown_74140
	dec c
	jr nz,.next
	ld c,$14
.next2
	call Unknown_74140
	ld a,[$FF4B]
	sub 8
	ld [$FF4B],a
	dec c
	jr nz,.next2
	xor a
	ld [$FFB0],a
	ld a,$C0
	ld [$FF47],a
	ret

CreditsMons: ; 74131 (1d:4131)
	db VENUSAUR
	db ARBOK
	db RHYHORN
	db FEAROW
	db ABRA
	db GRAVELER
	db HITMONLEE
	db TANGELA
	db STARMIE
	db GYARADOS
	db DITTO
	db OMASTAR
	db VILEPLUME
	db NIDOKING
	db PARASECT

Unknown_74140: ; 74140 (1d:4140)
	ld h, b
	ld l, $20
	call Func_74152
	ld h, $0
	ld l, $70
	call Func_74152
	ld a, b
	add $8
	ld b, a
	ret

; known jump sources: 74143 (1d:4143), 7414a (1d:414a), 74155 (1d:4155)
Func_74152: ; 74152 (1d:4152)
	ld a, [$FF00+$44]
	cp l
	jr nz, Func_74152
	ld a, h
	ld [rSCX], a ; $FF00+$43
.asm_7415a
	ld a, [$FF00+$44]
	cp h
	jr z, .asm_7415a
	ret

Unknown_74160: ; 74160 (1d:4160)
INCBIN "baserom.gbc",$74160,$74164 - $74160

Unknown_74164: ; 74164 (1d:4164)
	ld a, l
	ld [H_AUTOBGTRANSFERDEST], a ; $FF00+$bc
	ld a, h
	ld [$FF00+$bd], a
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	jp Delay3

; known jump sources: 74075 (1d:4075), 7407e (1d:407e), 74178 (1d:4178)
Func_74171: ; 74171 (1d:4171)
	ld [hl], $0
	inc hl
	inc hl
	dec bc
	ld a, b
	or c
	jr nz, Func_74171
	ret

; known jump sources: 7408f (1d:408f), 74095 (1d:4095)
Func_7417b: ; 7417b (1d:417b)
	ld bc, $50
	ld a, $7e
	jp FillMemory
; 74183 (1d:4183)
Unknown_74183: ; 74183 (1d:4183)
	FuncCoord 0, 4 ; $c3f0
	ld hl, Coord
	ld bc, $c8
	ld a, $7f
	jp FillMemory

; known jump sources: 740b7 (1d:40b7)
Func_7418e: ; 7418e (1d:418e)
	ld de, Unknown_74243 ; $4243
	push de
.asm_74192
	pop de
	FuncCoord 9, 6 ; $c421
	ld hl, Coord
	push hl
	call Unknown_74183
	pop hl
.asm_7419b
	ld a, [de]
	inc de
	push de
	cp $ff
	jr z, .asm_741d5
	cp $fe
	jr z, .asm_741dc
	cp $fd
	jr z, .asm_741e6
	cp $fc
	jr z, .asm_741ed
	cp $fb
	jr z, .asm_741f4
	cp $fa
	jr z, .asm_74201
	push hl
	push hl
	ld hl, CreditsTextPointers ; $42c3
	add a
	ld c, a
	ld b, $0
	add hl, bc
	ld e, [hl]
	inc hl
	ld d, [hl]
	ld a, [de]
	inc de
	ld c, a
	ld b, $ff
	pop hl
	add hl, bc
	call PlaceString
	pop hl
	ld bc, $28
	add hl, bc
	pop de
	jr .asm_7419b
.asm_741d5
	call Func_740ba
	ld c, $5a
	jr .asm_741de
.asm_741dc
	ld c, $6e
.asm_741de
	call DelayFrames
	call Func40CB
	jr .asm_74192
.asm_741e6
	call Func_740ba
	ld c, $78
	jr .asm_741ef
.asm_741ed
	ld c, $8c
.asm_741ef
	call DelayFrames
	jr .asm_74192
.asm_741f4
	push de
	ld b, BANK(Func_4541)
	ld hl, Func_4541
	call Bankswitch ; indirect jump to Func_4541 (4541 (1:4541))
	pop de
	pop de
	jr .asm_7419b
.asm_74201
	ld c, $10
	call DelayFrames
	call Unknown_74183
	pop de
	ld de, TheEndGfx
	ld hl, $9600
	ld bc, (BANK(TheEndGfx) << 8) + $0a
	call CopyVideoData
	FuncCoord 4, 8 ; $c444
	ld hl, Coord
	ld de, Unknown_74229 ; $4229
	call PlaceString
	FuncCoord 4, 9 ; $c458
	ld hl, Coord
	inc de
	call PlaceString
	jp Func_740ba

Unknown_74229: ; 74229 (1d:4229)
INCBIN "baserom.gbc",$74229,$74243 - $74229

Unknown_74243: ; 74243 (1d:4243)
INCBIN "baserom.gbc",$74243,$742c3 - $74243

CreditsTextPointers: ; 742c3 (1d:42c3)

	dw CredVersion
	dw CredTajiri
	dw CredTaOota
	dw CredMorimoto
	dw CredWatanabe
	dw CredMasuda
	dw CredNisino
	dw CredSugimori
	dw CredNishida
	dw CredMiyamoto
	dw CredKawaguchi
	dw CredIshihara
	dw CredYamauchi
	dw CredZinnai
	dw CredHishida
	dw CredSakai
	dw CredYamaguchi
	dw CredYamamoto
	dw CredTaniguchi
	dw CredNonomura
	dw CredFuziwara
	dw CredMatsusima
	dw CredTomisawa
	dw CredKawamoto
	dw CredKakei
	dw CredTsuchiya
	dw CredTaNakamura
	dw CredYuda
	dw CredMon
	dw CredDirector
	dw CredProgrammers
	dw CredCharDesign
	dw CredMusic
	dw CredSoundEffects
	dw CredGameDesign
	dw CredMonsterDesign
	dw CredGameScene
	dw CredParam
	dw CredMap
	dw CredTest
	dw CredSpecial
	dw CredProducers
	dw CredProducer
	dw CredExecutive
	dw CredTamada
	dw CredSaOota
	dw CredYoshikawa
	dw CredToOota
	dw CredUSStaff
	dw CredUSCoord
	dw CredTilden
	dw CredKawakami
	dw CredHiNakamura
	dw CredGiese
	dw CredOsborne
	dw CredTrans
	dw CredOgasawara
	dw CredIwata
	dw CredIzushi
	dw CredHarada
	dw CredMurakawa
	dw CredFukui
	dw CredClub
	dw CredPAAD

CredVersion: ; 74343 (1d:4343) ; this 1 byte difference makes all bank addresses offset by 1 in the blue version
IF _RED
	db "2RED VERSION STAFF@"
ENDC
IF _BLUE
	db "2BLUE VERSION STAFF@"
ENDC
CredTajiri: ; 74356 (1d:4356)
	db "4SATOSHI TAJIRI@"
CredTaOota: ; 74366 (1d:4366)
	db "4TAKENORI OOTA@"
CredMorimoto: ; 74375 (1d:4375)
	db "3SHIGEKI MORIMOTO@"
CredWatanabe: ; 74387 (1d:4387)
	db "3TETSUYA WATANABE@"
CredMasuda: ; 74399 (1d:4399)
	db "4JUNICHI MASUDA@"
CredNisino: ; 743a9 (1d:43a9)
	db "5KOHJI NISINO@"
CredSugimori: ; 743b7 (1d:43b7)
	db "5KEN SUGIMORI@"
CredNishida: ; 743c5 (1d:43c5)
	db "4ATSUKO NISHIDA@"
CredMiyamoto: ; 743d5 (1d:43d5)
	db "3SHIGERU MIYAMOTO@"
CredKawaguchi: ; 743e7 (1d:43e7)
	db "2TAKASHI KAWAGUCHI@"
CredIshihara: ; 743fa (1d:43fa)
	db "2TSUNEKAZU ISHIHARA@"
CredYamauchi: ; 7440e (1d:440e)
	db "3HIROSHI YAMAUCHI@"
CredZinnai: ; 74420 (1d:4420)
	db "3HIROYUKI ZINNAI@"
CredHishida: ; 74431 (1d:4431)
	db "3TATSUYA HISHIDA@"
CredSakai: ; 74442 (1d:4442)
	db "4YASUHIRO SAKAI@"
CredYamaguchi: ; 74452 (1d:4452)
	db "3WATARU YAMAGUCHI@"
CredYamamoto: ; 74464 (1d:4464)
	db "2KAZUYUKI YAMAMOTO@"
CredTaniguchi: ; 74477 (1d:4477)
	db "2RYOHSUKE TANIGUCHI@"
CredNonomura: ; 7448b (1d:448b)
	db "2FUMIHIRO NONOMURA@"
CredFuziwara: ; 7449e (1d:449e)
	db "3MOTOFUMI FUZIWARA@"
CredMatsusima: ; 744b1 (1d:44b1)
	db "3KENJI MATSUSIMA@"
CredTomisawa: ; 744c2 (1d:44c2)
	db "3AKIHITO TOMISAWA@"
CredKawamoto: ; 744d4 (1d:44d4)
	db "3HIROSHI KAWAMOTO@"
CredKakei: ; 744e6 (1d:44e6)
	db "4AKIYOSHI KAKEI@"
CredTsuchiya: ; 744f6 (1d:44f6)
	db "3KAZUKI TSUCHIYA@"
CredTaNakamura: ; 74507 (1d:4507)
	db "4TAKEO NAKAMURA@"
CredYuda: ; 74517 (1d:4517)
	db "4MASAMITSU YUDA@"
CredMon: ; 74527 (1d:4527)
	db "7#MON@"
CredDirector: ; 7452d (1d:452d)
	db "7DIRECTOR@"
CredProgrammers: ; 74537 (1d:4537)
	db "5PROGRAMMERS@"
CredCharDesign: ; 74544 (1d:4544)
	db "3CHARACTER DESIGN@"
CredMusic: ; 74556 (1d:4556)
	db "8MUSIC@"
CredSoundEffects: ; 7455d (1d:455d)
	db "4SOUND EFFECTS@"
CredGameDesign: ; 7456c (1d:456c)
	db "5GAME DESIGN@"
CredMonsterDesign: ; 74579 (1d:4579)
	db "4MONSTER DESIGN@"
CredGameScene: ; 74589 (1d:4589)
	db "4GAME SCENARIO@"
CredParam: ; 74598 (1d:4598)
	db "2PARAMETRIC DESIGN@"
CredMap: ; 745ab (1d:45ab)
	db "6MAP DESIGN@"
CredTest: ; 745b7 (1d:45b7)
	db "3PRODUCT TESTING@"
CredSpecial: ; 745c8 (1d:45c8)
	db "4SPECIAL THANKS@"
CredProducers: ; 745d8 (1d:45d8)
	db "6PRODUCERS@"
CredProducer: ; 745e3 (1d:45e3)
	db "6PRODUCER@"
CredExecutive: ; 745ed (1d:45ed)
	db "2EXECUTIVE PRODUCER@"
CredTamada: ; 74601 (1d:4601)
	db "4SOUSUKE TAMADA@"
CredSaOota: ; 74611 (1d:4611)
	db "5SATOSHI OOTA@"
CredYoshikawa: ; 7461f (1d:461f)
	db "4RENA YOSHIKAWA@"
CredToOota: ; 7462f (1d:462f)
	db "4TOMOMICHI OOTA@"
CredUSStaff: ; 7463f (1d:463f)
	db "3US VERSION STAFF@"
CredUSCoord: ; 74651 (1d:4651)
	db "3US COORDINATION@"
CredTilden: ; 74662 (1d:4662)
	db "5GAIL TILDEN@"
CredKawakami: ; 7466f (1d:466f)
	db "4NAOKO KAWAKAMI@"
CredHiNakamura: ; 7467f (1d:467f)
	db "4HIRO NAKAMURA@"
CredGiese: ; 7468e (1d:468e)
	db "4WILLIAM GIESE@"
CredOsborne: ; 7469d (1d:469d)
	db "5SARA OSBORNE@"
CredTrans: ; 746ab (1d:46ab)
	db "3TEXT TRANSLATION@"
CredOgasawara: ; 746bd (1d:46bd)
	db "4NOB OGASAWARA@"
CredIwata: ; 746cc (1d:46cc)
	db "5SATORU IWATA@"
CredIzushi: ; 746da (1d:46da)
	db "3TAKEHIRO IZUSHI@"
CredHarada: ; 746eb (1d:46eb)
	db "3TAKAHIRO HARADA@"
CredMurakawa: ; 746fc (1d:46fc)
	db "3TERUKI MURAKAWA@"
CredFukui: ; 7470d (1d:470d)
	db "5KOHTA FUKUI@"
CredClub: ; 7471a (1d:471a)
	db "1NCL SUPER MARIO CLUB@"
CredPAAD: ; 74730 (1d:4730)
	db "5PAAD TESTING@"

TheEndGfx: ; 7473e (1d:473e) ; 473E (473F on blue)
	INCBIN "gfx/theend.2bpp"

Unknown_747de: ; 747de (1d:47de)
	ld a, [de]
	bit 3, a
	jr nz, .asm_747fb
	bit 4, a
	jr nz, .asm_74804
	bit 5, a
	jr nz, .asm_7480d
	bit 6, a
	jr nz, .asm_74816
	and $7
	ret z
	ld a, $92
	ld [hli], a
	ld a, $8b
	ld [hli], a
	ld [hl], $8f
	ret
.asm_747fb
	ld a, $8f
	ld [hli], a
	ld a, $92
	ld [hli], a
	ld [hl], $8d
	ret
.asm_74804
	ld a, $81
	ld [hli], a
	ld a, $91
	ld [hli], a
	ld [hl], $8d
	ret
.asm_7480d
	ld a, $85
	ld [hli], a
	ld a, $91
	ld [hli], a
	ld [hl], $99
	ret
.asm_74816
	ld a, $8f
	ld [hli], a
	ld a, $80
	ld [hli], a
	ld [hl], $91
	ret
; 7481f (1d:481f)

Unknown_7481f: ; 7481f (1d:481f)
	ld hl, HiddenItemCoords
	ld b, $0
.asm_74824
	ld de, $0003
	ld a, [$d35e]
	call IsInArrayCummulativeCount
	ret nc
	push bc
	push hl
	ld hl, $d6f0
	ld c, b
	ld b, $2
	ld a, $10
	call Predef
	ld a, c
	pop hl
	pop bc
	inc b
	and a
	inc hl
	ld d, [hl]
	inc hl
	ld e, [hl]
	inc hl
	jr nz, .asm_74824 ; 0x74845 $dd
	ld a, [$d361]
	call Unknown_7486b
	cp d
	jr nc, .asm_74824 ; 0x7484e $d4
	ld a, [$d361]
	add $4
	cp d
	jr c, .asm_74824 ; 0x74856 $cc
	ld a, [$d362]
	call Unknown_7486b
	cp e
	jr nc, .asm_74824 ; 0x7485f $c3
	ld a, [$d362]
	add $5
	cp e
	jr c, .asm_74824 ; 0x74867 $bb
	scf
	ret
; 0x7486b

Unknown_7486b: ; 7486b (1d:486b)
	sub $5
	cp $f0
	ret c
	xor a
	ret
; 0x74872

Unnamed_ASM_74872: ; 74872 (1d:4872)
; code similar to this appears in a lot of banks; this particular
; one is called after you beat the Rocket that gives you TM28 DIG.
; the screen then fades out, he disappears, and fades back in
	call GBFadeIn1
	ld a, $07
	ld [$CC4D], a
	ld a, $15
	call Predef
	ld a, $09
	ld [$CC4D], a
	ld a, $11
	call Predef
	ld a, $06
	ld [$CC4D], a
	ld a, $11
	call Predef
	call GBFadeOut1
	ret

ViridianGym_h: ; 0x74897 to 0x748a3 (12 bytes) (id=45)
	db $07 ; tileset
	db VIRIDIAN_GYM_HEIGHT, VIRIDIAN_GYM_WIDTH ; dimensions (y, x)
	dw ViridianGymBlocks, ViridianGymTexts, ViridianGymScript ; blocks, texts, scripts
	db $00 ; connections

	dw ViridianGymObject ; objects

ViridianGymScript: ; 748a3 (1d:48a3)
	ld hl, Gym8CityName
	ld de, Gym8LeaderName
	call LoadGymLeaderAndCityName
	call EnableAutoTextBoxDrawing
	ld hl, ViridianGymTrainerHeaders
	ld de, Unknown_748e1
	ld a, [W_VIRIDIANGYMCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_VIRIDIANGYMCURSCRIPT], a
	ret
; 0x748bf

Gym8CityName: ; 748bf (1d:48bf)
	db "VIRIDIAN CITY@"
Gym8LeaderName: ; 748cd (1d:48cd)
	db "GIOVANNI@"

; known jump sources: 7498d (1d:498d), 749e9 (1d:49e9)
Func_748d6: ; 748d6 (1d:48d6)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_VIRIDIANGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 748e1 (1d:48e1)

Unknown_748e1: ; 748e1 (1d:48e1)
	dw Func_748eb
	dw Func_324c
	dw EndTrainerBattle
	dw Func_74988
	dw Func_7496b


Func_748eb: ; 748eb (1d:48eb)
	ld a, [W_YCOORD] ; $d361
	ld b, a
	ld a, [W_XCOORD] ; $d362
	ld c, a
	ld hl, Unknown_74916
	call Func_3442
	cp $ff
	jp z, CheckFightingMapTrainers
	call Func_3486
	ld hl, $d736
	set 7, [hl]
	ld a, $a7
	call PlaySound
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $4
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_74916: ; 74916 (1d:4916)
dw $130b
dw Unknown_74947
dw $1301
dw Unknown_7494a
dw $1202
dw Unknown_7494d
dw $0b02
dw Unknown_74950
dw $100a
dw Unknown_74953
dw $0406
dw Unknown_74956
dw $050d
dw Unknown_74959
dw $040e
dw Unknown_7495c
dw $000f
dw Unknown_7495f
dw $010f
dw Unknown_74962
dw $0d10
dw Unknown_74965
dw $0d11
dw Unknown_74968
db $FF

Unknown_74947: ; 74947 (1d:4947)
db $40
db $09
db $FF
Unknown_7494a: ; 7494a (1d:494a)
db $20
db $08
db $FF
Unknown_7494d: ; 7494d (1d:494d)
db $80
db $09
db $FF
Unknown_74950: ; 74950 (1d:4950)
db $10
db $06
db $FF
Unknown_74953: ; 74953 (1d:4953)
db $80
db $02
db $FF
Unknown_74956: ; 74956 (1d:4956)
db $80
db $07
db $FF
Unknown_74959: ; 74959 (1d:4959)
db $10
db $08
db $FF
Unknown_7495c: ; 7495c (1d:495c)
db $10
db $09
db $FF
Unknown_7495f: ; 7495f (1d:495f)
db $40
db $08
db $FF
Unknown_74962: ; 74962 (1d:4962)
db $40
db $06
db $FF
Unknown_74965: ; 74965 (1d:4965)
db $20
db $06
db $FF
Unknown_74968: ; 74968 (1d:4968)
db $20
db $0C
db $FF

Func_7496b: ; 7496b (1d:496b)
	ld a, [$cd38]
	and a
	jr nz, .asm_74980
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d736
	res 7, [hl]
	ld a, $0
	ld [W_CURMAPSCRIPT], a
	ret
.asm_74980
	ld b, BANK(Func_44fd7)
	ld hl, Func_44fd7
	jp Bankswitch ; indirect jump to Func_44fd7 (44fd7 (11:4fd7))
; 74988

Func_74988: ; 74988 (1d:4988)
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_748d6
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
; 74995 (1d:4995)
Unknown_74995: ; 74995 (1d:4995)
	ld a, $c
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d751
	set 1, [hl]
	ld bc, (TM_27 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a, $d
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d751
	set 0, [hl]
	jr .asm_749be
.BagFull
	ld a, $e
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
.asm_749be
	ld hl, W_OBTAINEDBADGES ; $d356
	set 7, [hl]
	ld hl, $d72a
	set 7, [hl]
	ld a, [$d751]
	or $fc
	ld [$d751], a
	ld a, [$d752]
	or $3
	ld [$d752], a
	ld a, $23
	ld [$cc4d], a
	ld a, $15
	call Predef ; indirect jump to AddMissableObject (f1c8 (3:71c8))
	ld hl, $d7eb
	set 1, [hl]
	set 7, [hl]
	jp Func_748d6
; 749ec (1d:49ec)
ViridianGymTexts: ; 749ec (1d:49ec)
	dw ViridianGymText1, ViridianGymText2, ViridianGymText3, ViridianGymText4, ViridianGymText5, ViridianGymText6, ViridianGymText7, ViridianGymText8, ViridianGymText9, ViridianGymText10, Predef5CText, ViridianGymText12, ViridianGymText13, ViridianGymText14

ViridianGymTrainerHeaders: ; 74a08 (1d:4a08)
ViridianGymTrainerHeader0: ; 74a08 (1d:4a08)
	db $2 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d751 ; flag's byte
	dw ViridianGymBattleText1 ; 0x4afd TextBeforeBattle
	dw ViridianGymAfterBattleText1 ; 0x4b07 TextAfterBattle
	dw ViridianGymEndBattleText1 ; 0x4b02 TextEndBattle
	dw ViridianGymEndBattleText1 ; 0x4b02 TextEndBattle
; 0x74a14

ViridianGymTrainerHeader1: ; 74a14 (1d:4a14)
	db $3 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d751 ; flag's byte
	dw ViridianGymBattleText2 ; 0x4b16 TextBeforeBattle
	dw ViridianGymAfterBattleText2 ; 0x4b20 TextAfterBattle
	dw ViridianGymEndBattleText2 ; 0x4b1b TextEndBattle
	dw ViridianGymEndBattleText2 ; 0x4b1b TextEndBattle
; 0x74a20

ViridianGymTrainerHeader2: ; 74a20 (1d:4a20)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d751 ; flag's byte
	dw ViridianGymBattleText3 ; 0x4b2f TextBeforeBattle
	dw ViridianGymAfterBattleText3 ; 0x4b39 TextAfterBattle
	dw ViridianGymEndBattleText3 ; 0x4b34 TextEndBattle
	dw ViridianGymEndBattleText3 ; 0x4b34 TextEndBattle
; 0x74a2c

ViridianGymTrainerHeader3: ; 74a2c (1d:4a2c)
	db $5 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d751 ; flag's byte
	dw ViridianGymBattleText4 ; 0x4b48 TextBeforeBattle
	dw ViridianGymAfterBattleText4 ; 0x4b52 TextAfterBattle
	dw ViridianGymEndBattleText4 ; 0x4b4d TextEndBattle
	dw ViridianGymEndBattleText4 ; 0x4b4d TextEndBattle
; 0x74a38

ViridianGymTrainerHeader4: ; 74a38 (1d:4a38)
	db $6 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d751 ; flag's byte
	dw ViridianGymBattleText5 ; 0x4b61 TextBeforeBattle
	dw ViridianGymAfterBattleText5 ; 0x4b6b TextAfterBattle
	dw ViridianGymEndBattleText5 ; 0x4b66 TextEndBattle
	dw ViridianGymEndBattleText5 ; 0x4b66 TextEndBattle
; 0x74a44

ViridianGymTrainerHeader5: ; 74a44 (1d:4a44)
	db $7 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d751 ; flag's byte
	dw ViridianGymBattleText6 ; 0x4b7a TextBeforeBattle
	dw ViridianGymAfterBattleText6 ; 0x4b84 TextAfterBattle
	dw ViridianGymEndBattleText6 ; 0x4b7f TextEndBattle
	dw ViridianGymEndBattleText6 ; 0x4b7f TextEndBattle
; 0x74a50

ViridianGymTrainerHeader6: ; 74a50 (1d:4a50)
	db $8 ; flag's bit
	db ($3 << 4) ; trainer's view range
	dw $d751 ; flag's byte
	dw ViridianGymBattleText7 ; 0x4b93 TextBeforeBattle
	dw ViridianGymAfterBattleText7 ; 0x4b9d TextAfterBattle
	dw ViridianGymEndBattleText7 ; 0x4b98 TextEndBattle
	dw ViridianGymEndBattleText7 ; 0x4b98 TextEndBattle
; 0x74a5c

ViridianGymTrainerHeader7: ; 74a5c (1d:4a5c)
	db $9 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d751 ; flag's byte
	dw ViridianGymBattleText8 ; 0x4bac TextBeforeBattle
	dw ViridianGymAfterBattleText8 ; 0x4bb6 TextAfterBattle
	dw ViridianGymEndBattleText8 ; 0x4bb1 TextEndBattle
	dw ViridianGymEndBattleText8 ; 0x4bb1 TextEndBattle
; 0x74a68

db $ff

ViridianGymText1: ; 74a69 (1d:4a69)
	db $08 ; asm
	ld a, [$d751]
	bit 1, a
	jr z, .asm_6de66 ; 0x74a6f
	bit 0, a
	jr nz, .asm_9fc95 ; 0x74a73
	call z, Unknown_74995
	call DisableWaitingAfterTextDisplay
	jr .asm_6dff7 ; 0x74a7b
.asm_9fc95 ; 0x74a7d
	ld a, $1
	ld [$cc3c], a
	ld hl, UnnamedText_74ad9
	call PrintText
	call GBFadeIn1
	ld a, $32
	ld [$cc4d], a
	ld a, $11
	call Predef
	call UpdateSprites
	call Delay3
	call GBFadeOut1
	jr .asm_6dff7 ; 0x74a9e
.asm_6de66 ; 0x74aa0
	ld hl, UnnamedText_74ace
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_74ad3
	ld de, UnnamedText_74ad3
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $8
	ld [$d05c], a
	ld a, $3
	ld [W_VIRIDIANGYMCURSCRIPT], a
.asm_6dff7 ; 0x74acb
	jp TextScriptEnd

UnnamedText_74ace: ; 74ace (1d:4ace)
	TX_FAR _UnnamedText_74ace
	db $50
; 0x74ace + 5 bytes

UnnamedText_74ad3: ; 74ad3 (1d:4ad3)
	TX_FAR _UnnamedText_74ad3
	db $0b, $50
; 0x74ad9

UnnamedText_74ad9: ; 74ad9 (1d:4ad9)
	TX_FAR _UnnamedText_74ad9
	db $0d, $50
; 0x74add

ViridianGymText12: ; 74adf (1d:4adf)
	TX_FAR _ViridianGymText12
	db $50
; 0x74adf + 5 bytes

ViridianGymText13: ; 74ae4 (1d:4ae4)
	TX_FAR _ReceivedTM27Text
	db $0b

TM27ExplanationText: ; 74ae9 (1d:4ae9)
	TX_FAR _TM27ExplanationText
	db $50

ViridianGymText14: ; 74aee (1d:4aee)
	TX_FAR _TM27NoRoomText
	db $50
; 0x74aee + 5 bytes

ViridianGymText2: ; 74af3 (1d:4af3)
	db $08 ; asm
	ld hl, ViridianGymTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

ViridianGymBattleText1: ; 74afd (1d:4afd)
	TX_FAR _ViridianGymBattleText1
	db $50
; 0x74afd + 5 bytes

ViridianGymEndBattleText1: ; 74b02 (1d:4b02)
	TX_FAR _ViridianGymEndBattleText1
	db $50
; 0x74b02 + 5 bytes

ViridianGymAfterBattleText1: ; 74b07 (1d:4b07)
	TX_FAR _ViridianGymAfterBattleText1
	db $50
; 0x74b07 + 5 bytes

ViridianGymText3: ; 74b0c (1d:4b0c)
	db $08 ; asm
	ld hl, ViridianGymTrainerHeader1
	call TalkToTrainer
	jp TextScriptEnd

ViridianGymBattleText2: ; 74b16 (1d:4b16)
	TX_FAR _ViridianGymBattleText2
	db $50
; 0x74b16 + 5 bytes

ViridianGymEndBattleText2: ; 74b1b (1d:4b1b)
	TX_FAR _ViridianGymEndBattleText2
	db $50
; 0x74b1b + 5 bytes

ViridianGymAfterBattleText2: ; 74b20 (1d:4b20)
	TX_FAR _ViridianGymAfterBattleText2
	db $50
; 0x74b20 + 5 bytes

ViridianGymText4: ; 74b25 (1d:4b25)
	db $08 ; asm
	ld hl, ViridianGymTrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

ViridianGymBattleText3: ; 74b2f (1d:4b2f)
	TX_FAR _ViridianGymBattleText3
	db $50
; 0x74b2f + 5 bytes

ViridianGymEndBattleText3: ; 74b34 (1d:4b34)
	TX_FAR _ViridianGymEndBattleText3
	db $50
; 0x74b34 + 5 bytes

ViridianGymAfterBattleText3: ; 74b39 (1d:4b39)
	TX_FAR _ViridianGymAfterBattleText3
	db $50
; 0x74b39 + 5 bytes

ViridianGymText5: ; 74b3e (1d:4b3e)
	db $08 ; asm
	ld hl, ViridianGymTrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

ViridianGymBattleText4: ; 74b48 (1d:4b48)
	TX_FAR _ViridianGymBattleText4
	db $50
; 0x74b48 + 5 bytes

ViridianGymEndBattleText4: ; 74b4d (1d:4b4d)
	TX_FAR _ViridianGymEndBattleText4
	db $50
; 0x74b4d + 5 bytes

ViridianGymAfterBattleText4: ; 74b52 (1d:4b52)
	TX_FAR _ViridianGymAfterBattleText4
	db $50
; 0x74b52 + 5 bytes

ViridianGymText6: ; 74b57 (1d:4b57)
	db $08 ; asm
	ld hl, ViridianGymTrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

ViridianGymBattleText5: ; 74b61 (1d:4b61)
	TX_FAR _ViridianGymBattleText5
	db $50
; 0x74b61 + 5 bytes

ViridianGymEndBattleText5: ; 74b66 (1d:4b66)
	TX_FAR _ViridianGymEndBattleText5
	db $50
; 0x74b66 + 5 bytes

ViridianGymAfterBattleText5: ; 74b6b (1d:4b6b)
	TX_FAR _ViridianGymAfterBattleText5
	db $50
; 0x74b6b + 5 bytes

ViridianGymText7: ; 74b70 (1d:4b70)
	db $08 ; asm
	ld hl, ViridianGymTrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

ViridianGymBattleText6: ; 74b7a (1d:4b7a)
	TX_FAR _ViridianGymBattleText6
	db $50
; 0x74b7a + 5 bytes

ViridianGymEndBattleText6: ; 74b7f (1d:4b7f)
	TX_FAR _ViridianGymEndBattleText6
	db $50
; 0x74b7f + 5 bytes

ViridianGymAfterBattleText6: ; 74b84 (1d:4b84)
	TX_FAR _ViridianGymAfterBattleText6
	db $50
; 0x74b84 + 5 bytes

ViridianGymText8: ; 74b89 (1d:4b89)
	db $08 ; asm
	ld hl, ViridianGymTrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

ViridianGymBattleText7: ; 74b93 (1d:4b93)
	TX_FAR _ViridianGymBattleText7
	db $50
; 0x74b93 + 5 bytes

ViridianGymEndBattleText7: ; 74b98 (1d:4b98)
	TX_FAR _ViridianGymEndBattleText7
	db $50
; 0x74b98 + 5 bytes

ViridianGymAfterBattleText7: ; 74b9d (1d:4b9d)
	TX_FAR _ViridianGymAfterBattleText7
	db $50
; 0x74b9d + 5 bytes

ViridianGymText9: ; 74ba2 (1d:4ba2)
	db $08 ; asm
	ld hl, ViridianGymTrainerHeader7
	call TalkToTrainer
	jp TextScriptEnd

ViridianGymBattleText8: ; 74bac (1d:4bac)
	TX_FAR _ViridianGymBattleText8
	db $50
; 0x74bac + 5 bytes

ViridianGymEndBattleText8: ; 74bb1 (1d:4bb1)
	TX_FAR _ViridianGymEndBattleText8
	db $50
; 0x74bb1 + 5 bytes

ViridianGymAfterBattleText8: ; 74bb6 (1d:4bb6)
	TX_FAR _ViridianGymAfterBattleText8
	db $50
; 0x74bb6 + 5 bytes

ViridianGymText10: ; 74bbb (1d:4bbb)
	db $08 ; asm
	ld a, [$d751]
	bit 1, a
	jr nz, .asm_1abd1 ; 0x74bc1
	ld hl, UnnamedText_74bd4
	call PrintText
	jr .asm_6064d ; 0x74bc9
.asm_1abd1 ; 0x74bcb
	ld hl, UnnamedText_74bd9
	call PrintText
.asm_6064d ; 0x74bd1
	jp TextScriptEnd

UnnamedText_74bd4: ; 74bd4 (1d:4bd4)
	TX_FAR _UnnamedText_74bd4
	db $50
; 0x74bd4 + 5 bytes

UnnamedText_74bd9: ; 74bd9 (1d:4bd9)
	TX_FAR _UnnamedText_74bd9
	db $50
; 0x74bd9 + 5 bytes

ViridianGymObject: ; 0x74bde (size=105)
	db $3 ; border tile

	db $2 ; warps
	db $11, $10, $4, $ff
	db $11, $11, $4, $ff

	db $0 ; signs

	db $b ; people
	db SPRITE_GIOVANNI, $1 + 4, $2 + 4, $ff, $d0, $41, GIOVANNI + $C8, $3 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $7 + 4, $c + 4, $ff, $d0, $42, COOLTRAINER_M + $C8, $9 ; trainer
	db SPRITE_HIKER, $b + 4, $b + 4, $ff, $d1, $43, BLACKBELT + $C8, $6 ; trainer
	db SPRITE_ROCKER, $7 + 4, $a + 4, $ff, $d0, $44, TAMER + $C8, $3 ; trainer
	db SPRITE_HIKER, $7 + 4, $3 + 4, $ff, $d2, $45, BLACKBELT + $C8, $7 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $5 + 4, $d + 4, $ff, $d3, $46, COOLTRAINER_M + $C8, $a ; trainer
	db SPRITE_HIKER, $1 + 4, $a + 4, $ff, $d0, $47, BLACKBELT + $C8, $8 ; trainer
	db SPRITE_ROCKER, $10 + 4, $2 + 4, $ff, $d3, $48, TAMER + $C8, $4 ; trainer
	db SPRITE_BLACK_HAIR_BOY_1, $5 + 4, $6 + 4, $ff, $d0, $49, COOLTRAINER_M + $C8, $1 ; trainer
	db SPRITE_GYM_HELPER, $f + 4, $10 + 4, $ff, $d0, $a ; person
	db SPRITE_BALL, $9 + 4, $10 + 4, $ff, $ff, $8b, REVIVE ; item

	; warp-to
	EVENT_DISP $a, $11, $10
	EVENT_DISP $a, $11, $11

ViridianGymBlocks: ; 74c47 (1d:4c47)
	INCBIN "maps/viridiangym.blk"

PewterMart_h: ; 0x74ca1 to 0x74cad (12 bytes) (id=56)
	db $02 ; tileset
	db PEWTER_MART_HEIGHT, PEWTER_MART_WIDTH ; dimensions (y, x)
	dw PewterMartBlocks, PewterMartTexts, PewterMartScript ; blocks, texts, scripts
	db $00 ; connections

	dw PewterMartObject ; objects

PewterMartScript: ; 74cad (1d:4cad)
	call EnableAutoTextBoxDrawing
	ld a, $1
	ld [$cf0c], a
	ret
; 0x74cb6

PewterMartTexts: ; 74cb6 (1d:4cb6)
	dw PewterMartText1, PewterMartText2, PewterMartText3

PewterMartText2: ; 74cbc (1d:4cbc)
	db $08 ; asm
	ld hl, UnnamedText_74cc6
	call PrintText
	jp TextScriptEnd

UnnamedText_74cc6: ; 74cc6 (1d:4cc6)
	TX_FAR _UnnamedText_74cc6
	db $50
; 0x74cc6 + 5 bytes

PewterMartText3: ; 74ccb (1d:4ccb)
	db $08 ; asm
	ld hl, UnnamedText_74cd5
	call PrintText
	jp TextScriptEnd

UnnamedText_74cd5: ; 74cd5 (1d:4cd5)
	TX_FAR _UnnamedText_74cd5
	db $50
; 0x74cd5 + 5 bytes

PewterMartObject: ; 0x74cda (size=38)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $4, $ff
	db $7, $4, $4, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_MART_GUY, $5 + 4, $0 + 4, $ff, $d3, $1 ; person
	db SPRITE_BUG_CATCHER, $3 + 4, $3 + 4, $fe, $1, $2 ; person
	db SPRITE_BLACK_HAIR_BOY_2, $5 + 4, $5 + 4, $ff, $ff, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4

UnknownDungeon1_h: ; 0x74d00 to 0x74d0c (12 bytes) (id=228)
	db $11 ; tileset
	db UNKNOWN_DUNGEON_1_HEIGHT, UNKNOWN_DUNGEON_1_WIDTH ; dimensions (y, x)
	dw UnknownDungeon1Blocks, UnknownDungeon1Texts, UnknownDungeon1Script ; blocks, texts, scripts
	db $00 ; connections

	dw UnknownDungeon1Object ; objects

UnknownDungeon1Script: ; 74d0c (1d:4d0c)
	jp EnableAutoTextBoxDrawing
; 0x74d0f

UnknownDungeon1Texts: ; 74d0f (1d:4d0f)
	dw Predef5CText, Predef5CText, Predef5CText

UnknownDungeon1Object: ; 0x74d15 (size=97)
	db $7d ; border tile

	db $9 ; warps
	db $11, $18, $6, $ff
	db $11, $19, $6, $ff
	db $1, $1b, $0, UNKNOWN_DUNGEON_2
	db $7, $17, $1, UNKNOWN_DUNGEON_2
	db $9, $12, $2, UNKNOWN_DUNGEON_2
	db $1, $7, $3, UNKNOWN_DUNGEON_2
	db $3, $1, $4, UNKNOWN_DUNGEON_2
	db $b, $3, $5, UNKNOWN_DUNGEON_2
	db $6, $0, $0, UNKNOWN_DUNGEON_3

	db $0 ; signs

	db $3 ; people
	db SPRITE_BALL, $d + 4, $7 + 4, $ff, $ff, $81, FULL_RESTORE ; item
	db SPRITE_BALL, $3 + 4, $13 + 4, $ff, $ff, $82, MAX_ELIXER ; item
	db SPRITE_BALL, $0 + 4, $5 + 4, $ff, $ff, $83, NUGGET ; item

	; warp-to
	EVENT_DISP $f, $11, $18
	EVENT_DISP $f, $11, $19
	EVENT_DISP $f, $1, $1b ; UNKNOWN_DUNGEON_2
	EVENT_DISP $f, $7, $17 ; UNKNOWN_DUNGEON_2
	EVENT_DISP $f, $9, $12 ; UNKNOWN_DUNGEON_2
	EVENT_DISP $f, $1, $7 ; UNKNOWN_DUNGEON_2
	EVENT_DISP $f, $3, $1 ; UNKNOWN_DUNGEON_2
	EVENT_DISP $f, $b, $3 ; UNKNOWN_DUNGEON_2
	EVENT_DISP $f, $6, $0 ; UNKNOWN_DUNGEON_3

UnknownDungeon1Blocks: ; 74d76 (1d:4d76)
	INCBIN "maps/unknowndungeon1.blk"

CeruleanHouse3_h: ; 0x74dfd to 0x74e09 (12 bytes) (id=230)
	db $0d ; tileset
	db CERULEAN_HOUSE_3_HEIGHT, CERULEAN_HOUSE_3_WIDTH ; dimensions (y, x)
	dw CeruleanHouse3Blocks, CeruleanHouse3Texts, CeruleanHouse3Script ; blocks, texts, scripts
	db $00 ; connections

	dw CeruleanHouse3Object ; objects

CeruleanHouse3Script: ; 74e09 (1d:4e09)
	ld a, $1
	ld [$cf0c], a
	dec a
	ld [$cc3c], a
	ret
; 0x74e13

CeruleanHouse3Texts: ; 74e13 (1d:4e13)
	dw CeruleanHouse3Text1

CeruleanHouse3Text1: ; 74e15 (1d:4e15)
	db $8
	ld hl, UnnamedText_74e77
	call PrintText
	xor a
	ld [W_CURMENUITEMID], a
	ld [W_LISTSCROLLOFFSET], a
.asm_74e23
	ld hl, UnnamedText_74e7c
	call PrintText
	ld hl, UnnamedText_74e6d
	call LoadItemList
	ld hl, $cf7b
	ld a, l
	ld [$cf8b], a
	ld a, h
	ld [$cf8c], a
	xor a
	ld [$cf93], a
	ld [$cc35], a
	ld a, SPECIALLISTMENU
	ld [W_LISTMENUID], a
	call DisplayListMenuID
	jr c, .asm_74e60 ; 0x74e49 $15
	ld hl, Unknown_74e86
	ld a, [$cf91]
	sub $15
	add a
	ld d, $0
	ld e, a
	add hl, de
	ld a, [hli]
	ld h, [hl]
	ld l, a
	call PrintText
	jr .asm_74e23 ; 0x74e5e $c3
.asm_74e60
	xor a
	ld [W_LISTSCROLLOFFSET], a
	ld hl, UnnamedText_74e81
	call PrintText
	jp TextScriptEnd
; 0x74e6d

UnnamedText_74e6d: ; 74e6d (1d:4e6d)
db $8,BOULDERBADGE,CASCADEBADGE,THUNDERBADGE,RAINBOWBADGE,SOULBADGE,MARSHBADGE,VOLCANOBADGE,EARTHBADGE,$FF

UnnamedText_74e77: ; 74e77 (1d:4e77)
	TX_FAR _UnnamedText_74e77
	db $50
; 0x74e77 + 5 bytes

UnnamedText_74e7c: ; 74e7c (1d:4e7c)
	TX_FAR _UnnamedText_74e7c
	db $50
; 0x74e7c + 5 bytes

UnnamedText_74e81: ; 74e81 (1d:4e81)
	TX_FAR _UnnamedText_74e81
	db $50
; 0x74e81 + 5 bytes

Unknown_74e86: ; 74e86 (1d:4e86)
dw UnnamedText_74e96
dw UnnamedText_74e9b
dw UnnamedText_74ea0
dw UnnamedText_74ea5
dw UnnamedText_74eaa
dw UnnamedText_74eaf
dw UnnamedText_74eb4
dw UnnamedText_74eb9

UnnamedText_74e96: ; 74e96 (1d:4e96)
	TX_FAR _UnnamedText_74e96
	db $50
; 0x74e96 + 5 bytes

UnnamedText_74e9b: ; 74e9b (1d:4e9b)
	TX_FAR _UnnamedText_74e9b
	db $50
; 0x74e9b + 5 bytes

UnnamedText_74ea0: ; 74ea0 (1d:4ea0)
	TX_FAR _UnnamedText_74ea0
	db $50
; 0x74ea0 + 5 bytes

UnnamedText_74ea5: ; 74ea5 (1d:4ea5)
	TX_FAR _UnnamedText_74ea5
	db $50
; 0x74ea5 + 5 bytes

UnnamedText_74eaa: ; 74eaa (1d:4eaa)
	TX_FAR _UnnamedText_74eaa
	db $50
; 0x74eaa + 5 bytes

UnnamedText_74eaf: ; 74eaf (1d:4eaf)
	TX_FAR _UnnamedText_74eaf
	db $50
; 0x74eaf + 5 bytes

UnnamedText_74eb4: ; 74eb4 (1d:4eb4)
	TX_FAR _UnnamedText_74eb4
	db $50
; 0x74eb4 + 5 bytes

UnnamedText_74eb9: ; 74eb9 (1d:4eb9)
	TX_FAR _UnnamedText_74eb9
	db $50
; 0x74eb9 + 5 bytes

CeruleanHouse3Object: ; 0x74ebe (size=34)
	db $c ; border tile

	db $3 ; warps
	db $0, $2, $9, $ff
	db $7, $2, $8, $ff
	db $7, $3, $8, $ff

	db $0 ; signs

	db $1 ; people
	db SPRITE_FAT_BALD_GUY, $3 + 4, $5 + 4, $ff, $d3, $1 ; person

	; warp-to
	EVENT_DISP $4, $0, $2
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

Unknown_74ee0: ; 74ee0 (1d:4ee0)
	ld hl, UnnamedText_74f99
	call PrintText
	ld a, $13
	ld [$d125], a
	call DisplayTextBoxID
	xor a
	ld [W_CURMENUITEMID], a ; $cc26
	ld [W_OLDMENUITEMID], a ; $cc2a
	ld a, $3
	ld [W_MENUWATCHEDKEYS], a ; $cc29
	ld a, $3
	ld [W_MAXMENUITEMID], a ; $cc28
	ld a, $5
	ld [W_TOPMENUITEMY], a ; $cc24
	ld a, $1
	ld [W_TOPMENUITEMX], a ; $cc25
	ld hl, $d730
	set 6, [hl]
	FuncCoord 0, 3 ; $c3dc
	ld hl, Coord
	ld b, $8
	ld c, $c
	call TextBoxBorder
	call UpdateSprites
	FuncCoord 2, 5 ; $c406
	ld hl, Coord
	ld de, Unnamed_74f9e
	call PlaceString
	FuncCoord 9, 6 ; $c421
	ld hl, Coord
	ld de, Unnamed_74fc3
	call PlaceString
	ld hl, $d730
	res 6, [hl]
	call HandleMenuInput
	bit 1, a
	jr nz, .asm_74f93
	ld a, [W_CURMENUITEMID] ; $cc26
	cp $3
	jr z, .asm_74f93
	xor a
	ld [$FF00+$9f], a
	ld [$FF00+$a1], a
	ld a, $2
	ld [$FF00+$a0], a
	call HasEnoughMoney
	jr nc, .asm_74f54
	ld hl, UnnamedText_74fd3
	jp PrintText
.asm_74f54
	call Unknown_74fe7
	ld a, [$FF00+$db]
	ld b, a
	ld c, 1
	call GiveItem
	jr nc, .BagFull
	ld b, $3c
.asm_74f63
	ld c, $2
	call DelayFrames
	push bc
	ld a, $a8
	call PlaySound
	pop bc
	dec b
	jr nz, .asm_74f63
	ld hl, UnnamedText_74fd8
	call PrintText
	ld hl, $ffde
	ld de, W_PLAYERMONEY1 ; $d349
	ld c, $3
	ld a, $c
	call Predef ; indirect jump to Func_f836 (f836 (3:7836))
	ld a, $13
	ld [$d125], a
	jp DisplayTextBoxID
.BagFull
	ld hl, UnnamedText_74fdd
	jp PrintText
.asm_74f93
	ld hl, UnnamedText_74fe2
	jp PrintText
; 74f99 (1d:4f99)
UnnamedText_74f99: ; 74f99 (1d:4f99)
	TX_FAR _UnnamedText_74f99
	db $50
; 0x74f99 + 5 bytes

Unnamed_74f9e: ; 74f9e (1d:4f9e)
	db "FRESH WATER",$4E
	db "SODA POP",$4E
	db "LEMONADE",$4E
	db "CANCEL@"
Unnamed_74fc3: ; 74fc3 (1d:4fc3)
	db "¥200",$4E
	db "¥300",$4E
	db "¥350",$4E,"@"

UnnamedText_74fd3: ; 74fd3 (1d:4fd3)
	TX_FAR _UnnamedText_74fd3
	db $50
; 0x74fd3 + 5 bytes

UnnamedText_74fd8: ; 74fd8 (1d:4fd8)
	TX_FAR _UnnamedText_74fd8
	db $50
; 0x74fd8 + 5 bytes

UnnamedText_74fdd: ; 74fdd (1d:4fdd)
	TX_FAR _UnnamedText_74fdd
	db $50
; 0x74fdd + 5 bytes

UnnamedText_74fe2: ; 74fe2 (1d:4fe2)
	TX_FAR _UnnamedText_74fe2
	db $50
; 0x74fe2 + 5 bytes

Unknown_74fe7: ; 74fe7 (1d:4fe7)
	ld hl, Unknown_75000
	ld a, [$cc26]
	add a
	add a
	ld d, $0
	ld e, a
	add hl, de
	ld a, [hli]
	ld [$ff00+$db], a
	ld a, [hli]
	ld [$ff00+$dc], a
	ld a, [hli]
	ld [$ff00+$dd], a
	ld a, [hl]
	ld [$ff00+$de], a
	ret
; 0x75000

Unknown_75000: ; 75000 (1d:5000)
INCBIN "baserom.gbc",$75000,$7500c - $75000

FuchsiaHouse1_h: ; 0x7500c to 0x75018 (12 bytes) (id=153)
	db $08 ; tileset
	db FUCHSIA_HOUSE_1_HEIGHT, FUCHSIA_HOUSE_1_WIDTH ; dimensions (y, x)
	dw FuchsiaHouse1Blocks, FuchsiaHouse1Texts, FuchsiaHouse1Script ; blocks, texts, scripts
	db $00 ; connections

	dw FuchsiaHouse1Object ; objects

FuchsiaHouse1Script: ; 75018 (1d:5018)
	call EnableAutoTextBoxDrawing
	ret
; 0x7501c

FuchsiaHouse1Texts: ; 7501c (1d:501c)
	dw FuchsiaHouse1Text1, FuchsiaHouse1Text2, FuchsiaHouse1Text3

FuchsiaHouse1Text1: ; 75022 (1d:5022)
	TX_FAR _FuchsiaHouse1Text1
	db $50

FuchsiaHouse1Text2: ; 75027 (1d:5027)
	TX_FAR _FuchsiaHouse1Text2
	db $50

FuchsiaHouse1Text3: ; 7502c (1d:502c)
	TX_FAR _FuchsiaHouse1Text3
	db $50

FuchsiaHouse1Object: ; 0x75031 (size=38)
	db $a ; border tile

	db $2 ; warps
	db $7, $2, $1, $ff
	db $7, $3, $1, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_MOM_GEISHA, $3 + 4, $2 + 4, $ff, $d3, $1 ; person
	db SPRITE_GAMBLER, $2 + 4, $7 + 4, $ff, $d1, $2 ; person
	db SPRITE_BUG_CATCHER, $5 + 4, $5 + 4, $ff, $ff, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3

FuchsiaPokecenter_h: ; 0x75057 to 0x75063 (12 bytes) (id=154)
	db $06 ; tileset
	db FUCHSIA_POKECENTER_HEIGHT, FUCHSIA_POKECENTER_WIDTH ; dimensions (y, x)
	dw FuchsiaPokecenterBlocks, FuchsiaPokecenterTexts, FuchsiaPokecenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw FuchsiaPokecenterObject ; objects

FuchsiaPokecenterScript: ; 75063 (1d:5063)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x75069

FuchsiaPokecenterTexts: ; 75069 (1d:5069)
	dw FuchsiaPokecenterText1, FuchsiaPokecenterText2, FuchsiaPokecenterText3, FuchsiaPokecenterText4

FuchsiaPokecenterText1: ; 75071 (1d:5071)
	db $ff

FuchsiaPokecenterText2: ; 75072 (1d:5072)
	TX_FAR _FuchsiaPokecenterText1
	db $50

FuchsiaPokecenterText3: ; 75077 (1d:5077)
	TX_FAR _FuchsiaPokecenterText3
	db $50

FuchsiaPokecenterText4: ; 7507c (1d:507c)
	db $f6

FuchsiaPokecenterObject: ; 0x7507d (size=44)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $2, $ff
	db $7, $4, $2, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_ROCKER, $3 + 4, $2 + 4, $ff, $ff, $2 ; person
	db SPRITE_LASS, $5 + 4, $6 + 4, $fe, $2, $3 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

FuchsiaHouse2_h: ; 0x750a9 to 0x750b5 (12 bytes) (id=155)
	db $14 ; tileset
	db FUCHSIA_HOUSE_2_HEIGHT, FUCHSIA_HOUSE_2_WIDTH ; dimensions (y, x)
	dw FuchsiaHouse2Blocks, FuchsiaHouse2Texts, FuchsiaHouse2Script ; blocks, texts, scripts
	db $00 ; connections

	dw FuchsiaHouse2Object ; objects

FuchsiaHouse2Script: ; 750b5 (1d:50b5)
	jp EnableAutoTextBoxDrawing
; 0x750b8

FuchsiaHouse2Texts: ; 750b8 (1d:50b8)
	dw FuchsiaHouse2Text1, Predef5CText, BoulderText, FuchsiaHouse2Text4, FuchsiaHouse2Text5

FuchsiaHouse2Text1: ; 750c2 (1d:50c2)
	db $08 ; asm
	ld a, [$d78e]
	bit 0, a
	jr nz, .subtract ; 0x750c8
	ld b,GOLD_TEETH
	call IsItemInBag
	jr nz, .asm_3f30f ; 0x750cf
	ld a, [$d78e]
	bit 1, a
	jr nz, .asm_60cba ; 0x750d6
	ld hl, WardenGibberishText1
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	ld hl, WardenGibberishText3
	jr nz, .asm_61238 ; 0x750e8
	ld hl, WardenGibberishText2
.asm_61238 ; 0x750ed
	call PrintText
	jr .asm_52039 ; 0x750f0
.asm_3f30f ; 0x750f2
	ld hl, WardenTeethText1
	call PrintText
	ld a, $40
	ldh [$db], a
	ld b, BANK(RemoveItemByID)
	ld hl, RemoveItemByID
	call Bankswitch
	ld hl, $d78e
	set 1, [hl]
.asm_60cba ; 0x75109
	ld hl, WardenThankYouText
	call PrintText
	ld bc,(HM_04 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedHM04Text
	call PrintText
	ld hl, $d78e
	set 0, [hl]
	jr .asm_52039 ; 0x75122
.subtract ; 0x75124
	ld hl, HM04ExplanationText
	call PrintText
	jr .asm_52039 ; 0x7512a
.BagFull
	ld hl, HM04NoRoomText
	call PrintText
.asm_52039 ; 0x75132
	jp TextScriptEnd

WardenGibberishText1: ; 75135 (1d:5135)
	TX_FAR _WardenGibberishText1
	db $50
; 0x75135 + 5 bytes

WardenGibberishText2: ; 7513a (1d:513a)
	TX_FAR _WardenGibberishText2
	db $50
; 0x7513a + 5 bytes

WardenGibberishText3: ; 7513f (1d:513f)
	TX_FAR _WardenGibberishText3
	db $50
; 0x7513f + 5 bytes

WardenTeethText1: ; 75144 (1d:5144)
	TX_FAR _WardenTeethText1
	db $0b

WardenTeethText2: ; 75149 (1d:5149)
	TX_FAR _WardenTeethText2
	db $50
; 0x75149 + 5 bytes

WardenThankYouText: ; 7514e (1d:514e)
	TX_FAR _WardenThankYouText
	db $50
; 0x7514e + 5 bytes

ReceivedHM04Text: ; 75153 (1d:5153)
	TX_FAR _ReceivedHM04Text ; 0x9e5a2
	db $0B, $50
; 0x75153 + 6 bytes = 0x75159

HM04ExplanationText: ; 75159 (1d:5159)
	TX_FAR _HM04ExplanationText
	db $50
; 0x75159 + 5 bytes

HM04NoRoomText: ; 7515e (1d:515e)
	TX_FAR _HM04NoRoomText
	db $50
; 0x7515e + 5 bytes

FuchsiaHouse2Text5: ; 75163 (1d:5163)
FuchsiaHouse2Text4: ; 75163 (1d:5163)
	db $08 ; asm
	ldh a, [$8c]
	cp $4
	ld hl, UnnamedText_7517b
	jr nz, .asm_4c9a2 ; 0x7516b
	ld hl, UnnamedText_75176
.asm_4c9a2 ; 0x75170
	call PrintText
	jp TextScriptEnd

UnnamedText_75176: ; 75176 (1d:5176)
	TX_FAR _UnnamedText_75176
	db $50
; 0x75176 + 5 bytes

UnnamedText_7517b: ; 7517b (1d:517b)
	TX_FAR _UnnamedText_7517b
	db $50
; 0x7517b + 5 bytes

FuchsiaHouse2Object: ; 0x75180 (size=45)
	db $17 ; border tile

	db $2 ; warps
	db $7, $4, $3, $ff
	db $7, $5, $3, $ff

	db $2 ; signs
	db $3, $4, $4 ; FuchsiaHouse2Text4
	db $3, $5, $5 ; FuchsiaHouse2Text5

	db $3 ; people
	db SPRITE_WARDEN, $3 + 4, $2 + 4, $ff, $ff, $1 ; person
	db SPRITE_BALL, $3 + 4, $8 + 4, $ff, $ff, $82, RARE_CANDY ; item
	db SPRITE_BOULDER, $4 + 4, $8 + 4, $ff, $10, $3 ; person

	; warp-to
	EVENT_DISP $5, $7, $4
	EVENT_DISP $5, $7, $5

FuchsiaHouse2Blocks: ; 751ad (1d:51ad)
	INCBIN "maps/fuchsiahouse2.blk"

SafariZoneEntrance_h: ; 0x751c1 to 0x751cd (12 bytes) (id=156)
	db $0c ; tileset
	db SAFARIZONEENTRANCE_HEIGHT, SAFARIZONEENTRANCE_WIDTH ; dimensions (y, x)
	dw SafariZoneEntranceBlocks, SafariZoneEntranceTexts, SafariZoneEntranceScript ; blocks, texts, scripts
	db $00 ; connections

	dw SafariZoneEntranceObject ; objects

SafariZoneEntranceScript: ; 751cd (1d:51cd)
	call EnableAutoTextBoxDrawing
	ld hl, SafariZoneEntranceScripts
	ld a, [W_SAFARIZONEENTRANCECURSCRIPT]
	jp CallFunctionInTable
; 0x751d9

SafariZoneEntranceScripts: ; 751d9 (1d:51d9)
	dw SafariZoneEntranceScript0, SafariZoneEntranceScript1, SafariZoneEntranceScript2, SafariZoneEntranceScript3, SafariZoneEntranceScript4, SafariZoneEntranceScript5, SafariZoneEntranceScript6

SafariZoneEntranceScript0: ; 751e7 (1d:51e7)
	ld hl, Unknown_75221
	call ArePlayerCoordsInArray
	ret nc
	ld a, $3
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $c
	ld [$c109], a
	ld a, [$cd3d]
	cp $1
	jr z, .asm_7520f ; 0x75207 $6
	ld a, $2
	ld [W_SAFARIZONEENTRANCECURSCRIPT], a
	ret
.asm_7520f
	ld a, $10
	ld c, $1
	call Unknown_752a3
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $1
	ld [W_SAFARIZONEENTRANCECURSCRIPT], a
	ret
; 0x75221

Unknown_75221: ; 75221 (1d:5221)
db $2, $3, $2, $4, $ff

SafariZoneEntranceScript1: ; 75226 (1d:5226)
	call Unknown_752b4
	ret nz
SafariZoneEntranceScript2: ; 7522a (1d:522a)
	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	call UpdateSprites
	ld a, $4
	ld [$ff00+$8c], a
	call DisplayTextID
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ret
; 0x75240

SafariZoneEntranceScript3: ; 75240 (1d:5240)
	call Unknown_752b4
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $5
	ld [W_SAFARIZONEENTRANCECURSCRIPT], a
	ret
; 0x7524e

SafariZoneEntranceScript5: ; 7524e (1d:524e)
	ld a, $4
	ld [$d528], a
	ld hl, $d790
	bit 6, [hl]
	res 6, [hl]
	jr z, .asm_7527f ; 0x7525a $23
	res 7, [hl]
	call UpdateSprites
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $6
	ld [$ff00+$8c], a
	call DisplayTextID
	xor a
	ld [$da47], a
	ld a, $80
	ld c, $3
	call Unknown_752a3
	ld a, $4
	ld [W_SAFARIZONEENTRANCECURSCRIPT], a
	jr .asm_75286 ; 0x7527d $7
.asm_7527f
	ld a, $5
	ld [$ff00+$8c], a
	call DisplayTextID
.asm_75286
	ret
; 0x75287

SafariZoneEntranceScript4: ; 75287 (1d:5287)
	call Unknown_752b4
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $0
	ld [W_SAFARIZONEENTRANCECURSCRIPT], a
	ret
; 0x75295

SafariZoneEntranceScript6: ; 75295 (1d:5295)
	call Unknown_752b4
	ret nz
	call Delay3
	ld a, [$cf0d]
	ld [W_SAFARIZONEENTRANCECURSCRIPT], a
	ret
; 0x752a3

Unknown_752a3: ; 752a3 (1d:52a3)
	push af
	ld b, $0
	ld a, c
	ld [$cd38], a
	ld hl, $ccd3
	pop af
	call FillMemory
	jp Func_3486
; 752b4 (1d:52b4)
Unknown_752b4: ; 752b4 (1d:52b4)
	ld a, [$cd38]
	and a
	ret
; 752b9 (1d:52b9)
SafariZoneEntranceTexts: ; 752b9 (1d:52b9)
	dw SafariZoneEntranceText1, SafariZoneEntranceText2, SafariZoneEntranceText3, SafariZoneEntranceText4, SafariZoneEntranceText5, SafariZoneEntranceText6

SafariZoneEntranceText3: ; 752c5 (1d:52c5)
SafariZoneEntranceText1: ; 752c5 (1d:52c5)
	TX_FAR _SafariZoneEntranceText1
	db $50

SafariZoneEntranceText4: ; 752ca (1d:52ca)
	TX_FAR UnnamedText_9e6e4 ; 0x9e6e4
	db $8
; 0x752cf
	ld a, $13
	ld [$d125], a
	call DisplayTextBoxID
	call YesNoChoice
	ld a, [$cc26]
	and a
	jp nz, .asm_75346
	xor a
	ld [$ff00+$9f], a
	ld a, $5
	ld [$ff00+$a0], a
	ld a, $0
	ld [$ff00+$a1], a
	call HasEnoughMoney
	jr nc, .asm_752f9 ; 0x752ef $8
	ld hl, UnnamedText_7536a
	call PrintText
	jr .asm_7534c ; 0x752f7 $53
.asm_752f9
	xor a
	ld [$cd3d], a
	ld a, $5
	ld [$cd3e], a
	ld a, $0
	ld [$cd3f], a
	ld hl, $cd3f
	ld de, $d349
	ld c, $3
	ld a, $c
	call Predef
	ld a, $13
	ld [$d125], a
	call DisplayTextBoxID
	ld hl, UnnamedText_7535b
	call PrintText
	ld a, $1e
	ld [$da47], a
	ld a, $1
	ld [$d70d], a
	ld a, $f6
	ld [$d70e], a
	ld a, $40
	ld c, $3
	call Unknown_752a3
	ld hl, $d790
	set 7, [hl]
	res 6, [hl]
	ld a, $3
	ld [W_SAFARIZONEENTRANCECURSCRIPT], a
	jr .asm_75358 ; 0x75344 $12
.asm_75346
	ld hl, UnnamedText_75365
	call PrintText
.asm_7534c
	ld a, $80
	ld c, $1
	call Unknown_752a3
	ld a, $4
	ld [W_SAFARIZONEENTRANCECURSCRIPT], a
.asm_75358
	jp TextScriptEnd
; 0x7535b

UnnamedText_7535b: ; 7535b (1d:535b)
	TX_FAR UnnamedText_9e747 ; 0x9e747
	db $0B

UnnamedText_75360: ; 75360 (1d:5360)
	TX_FAR _UnnamedText_75360
	db $50
; 0x75360 + 5 bytes

UnnamedText_75365: ; 75365 (1d:5365)
	TX_FAR _UnnamedText_75365
	db $50
; 0x75365 + 5 bytes

UnnamedText_7536a: ; 7536a (1d:536a)
	TX_FAR _UnnamedText_7536a
	db $50
; 0x7536a + 5 bytes

SafariZoneEntranceText5: ; 7536f (1d:536f)
	TX_FAR UnnamedText_9e814 ; 0x9e814
	db $8
	call YesNoChoice
	ld a, [$cc26]
	and a
	jr nz, .asm_7539c ; 0x7537b $1f
	ld hl, UnnamedText_753bb
	call PrintText
	xor a
	ld [$c109], a
	ld a, $80
	ld c, $3
	call Unknown_752a3
	ld hl, $d790
	res 6, [hl]
	res 7, [hl]
	ld a, $0
	ld [$cf0d], a
	jr .asm_753b3 ; 0x7539a $17
.asm_7539c
	ld hl, UnnamedText_753c0
	call PrintText
	ld a, $4
	ld [$c109], a
	ld a, $40
	ld c, $1
	call Unknown_752a3
	ld a, $5
	ld [$cf0d], a
.asm_753b3
	ld a, $6
	ld [W_SAFARIZONEENTRANCECURSCRIPT], a
	jp TextScriptEnd
; 0x753bb

UnnamedText_753bb: ; 753bb (1d:53bb)
	TX_FAR _UnnamedText_753bb
	db $50
; 0x753bb + 5 bytes

UnnamedText_753c0: ; 753c0 (1d:53c0)
	TX_FAR _UnnamedText_753c0
	db $50
; 0x753c0 + 5 bytes

SafariZoneEntranceText6: ; 753c5 (1d:53c5)
	TX_FAR _UnnamedText_753c5
	db $50
; 0x753c5 + 5 bytes

SafariZoneEntranceText2: ; 753ca (1d:53ca)
	db $08 ; asm
	ld hl, UnnamedText_753e6
	call PrintText
	call YesNoChoice
	ld a, [$cc26]
	and a
	ld hl, UnnamedText_753f0
	jr nz, .asm_278a6 ; 0x753db
	ld hl, UnnamedText_753eb
.asm_278a6 ; 0x753e0
	call PrintText
	jp TextScriptEnd

UnnamedText_753e6: ; 753e6 (1d:53e6)
	TX_FAR _UnnamedText_753e6
	db $50
; 0x753e6 + 5 bytes

UnnamedText_753eb: ; 753eb (1d:53eb)
	TX_FAR _UnnamedText_753eb
	db $50
; 0x753eb + 5 bytes

UnnamedText_753f0: ; 753f0 (1d:53f0)
	TX_FAR _UnnamedText_753f0
	db $50
; 0x753f0 + 5 bytes

SafariZoneEntranceObject: ; 0x753f5 (size=48)
	db $a ; border tile

	db $4 ; warps
	db $5, $3, $4, $ff
	db $5, $4, $4, $ff
	db $0, $3, $0, SAFARI_ZONE_CENTER
	db $0, $4, $1, SAFARI_ZONE_CENTER

	db $0 ; signs

	db $2 ; people
	db SPRITE_WHITE_PLAYER, $2 + 4, $6 + 4, $ff, $d2, $1 ; person
	db SPRITE_WHITE_PLAYER, $4 + 4, $1 + 4, $ff, $d3, $2 ; person

	; warp-to
	EVENT_DISP $4, $5, $3
	EVENT_DISP $4, $5, $4
	EVENT_DISP $4, $0, $3 ; SAFARI_ZONE_CENTER
	EVENT_DISP $4, $0, $4 ; SAFARI_ZONE_CENTER

SafariZoneEntranceBlocks: ; 75425 (1d:5425)
	INCBIN "maps/safarizoneentrance.blk"

FuchsiaGym_h: ; 0x75431 to 0x7543d (12 bytes) (id=157)
	db $07 ; tileset
	db FUCHSIA_GYM_HEIGHT, FUCHSIA_GYM_WIDTH ; dimensions (y, x)
	dw FuchsiaGymBlocks, FuchsiaGymTexts, FuchsiaGymScript ; blocks, texts, scripts
	db $00 ; connections

	dw FuchsiaGymObject ; objects

FuchsiaGymScript: ; 7543d (1d:543d)
	call FuchsiaGymScript_Unknown75453
	call EnableAutoTextBoxDrawing
	ld hl, FuchsiaGymTrainerHeaders
	ld de, Unknown_75482
	ld a, [W_FUCHSIAGYMCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_FUCHSIAGYMCURSCRIPT], a
	ret
; 0x75453

FuchsiaGymScript_Unknown75453: ; 75453 (1d:5453)
	ld hl, $D126
	bit 6, [hl]
	res 6, [hl]
	ret z
	ld hl, Gym5CityName
	ld de, Gym5LeaderName
	call LoadGymLeaderAndCityName
	ret

Gym5CityName: ; 75465 (1d:5465)
	db "FUCHSIA CITY@"
Gym5LeaderName: ; 75472 (1d:5472)
	db "KOGA@"

; known jump sources: 7548f (1d:548f), 754d2 (1d:54d2)
Func_75477: ; 75477 (1d:5477)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_FUCHSIAGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 75482 (1d:5482)

Unknown_75482: ; 75482 (1d:5482)
	dw CheckFightingMapTrainers
	dw Func_324c
	dw EndTrainerBattle
	dw Func_7548a
; 7548a (1d:548a)

Func_7548a: ; 7548a (1d:548a)
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_75477
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
; 75497 (1d:5497)
Unknown_75497: ; 75497 (1d:5497)
	ld a, $9
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d792
	set 1, [hl]
	ld bc, (TM_06 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a, $a
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld hl, $d792
	set 0, [hl]
	jr .asm_754c0
.BagFull
	ld a, $b
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
.asm_754c0
	ld hl, W_OBTAINEDBADGES ; $d356
	set 4, [hl]
	ld hl, $d72a
	set 4, [hl]
	ld a, [$d792]
	or $fc
	ld [$d792], a
	jp Func_75477
; 754d5 (1d:54d5)
FuchsiaGymTexts: ; 754d5 (1d:54d5)
	dw FuchsiaGymText1, FuchsiaGymText2, FuchsiaGymText3, FuchsiaGymText4, FuchsiaGymText5, FuchsiaGymText6, FuchsiaGymText7, FuchsiaGymText8, FuchsiaGymText9, FuchsiaGymText10, FuchsiaGymText11

FuchsiaGymTrainerHeaders: ; 754eb (1d:54eb)
FuchsiaGymTrainerHeader0: ; 754eb (1d:54eb)
	db $2 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText1 ; 0x55ae TextBeforeBattle
	dw FuchsiaGymAfterBattleText1 ; 0x55b8 TextAfterBattle
	dw FuchsiaGymEndBattleText1 ; 0x55b3 TextEndBattle
	dw FuchsiaGymEndBattleText1 ; 0x55b3 TextEndBattle
; 0x754f7

FuchsiaGymTrainerHeader2: ; 754f7 (1d:54f7)
	db $3 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText2 ; 0x55c7 TextBeforeBattle
	dw FuchsiaGymAfterBattleText2 ; 0x55d1 TextAfterBattle
	dw FuchsiaGymEndBattleText2 ; 0x55cc TextEndBattle
	dw FuchsiaGymEndBattleText2 ; 0x55cc TextEndBattle
; 0x75503

FuchsiaGymTrainerHeader3: ; 75503 (1d:5503)
	db $4 ; flag's bit
	db ($4 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText3 ; 0x55e0 TextBeforeBattle
	dw FuchsiaGymAfterBattleText3 ; 0x55ea TextAfterBattle
	dw FuchsiaGymEndBattleText3 ; 0x55e5 TextEndBattle
	dw FuchsiaGymEndBattleText3 ; 0x55e5 TextEndBattle
; 0x7550f

FuchsiaGymTrainerHeader4: ; 7550f (1d:550f)
	db $5 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText4 ; 0x55f9 TextBeforeBattle
	dw FuchsiaGymAfterBattleText4 ; 0x5603 TextAfterBattle
	dw FuchsiaGymEndBattleText4 ; 0x55fe TextEndBattle
	dw FuchsiaGymEndBattleText4 ; 0x55fe TextEndBattle
; 0x7551b

FuchsiaGymTrainerHeader5: ; 7551b (1d:551b)
	db $6 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText5 ; 0x5612 TextBeforeBattle
	dw FuchsiaGymAfterBattleText5 ; 0x561c TextAfterBattle
	dw FuchsiaGymEndBattleText5 ; 0x5617 TextEndBattle
	dw FuchsiaGymEndBattleText5 ; 0x5617 TextEndBattle
; 0x75527

FuchsiaGymTrainerHeader6: ; 75527 (1d:5527)
	db $7 ; flag's bit
	db ($2 << 4) ; trainer's view range
	dw $d792 ; flag's byte
	dw FuchsiaGymBattleText6 ; 0x562b TextBeforeBattle
	dw FuchsiaGymAfterBattleText6 ; 0x5635 TextAfterBattle
	dw FuchsiaGymEndBattleText6 ; 0x5630 TextEndBattle
	dw FuchsiaGymEndBattleText6 ; 0x5630 TextEndBattle
; 0x75533

db $ff

FuchsiaGymText1: ; 75534 (1d:5534)
	db $08 ; asm
	ld a, [$d792]
	bit 1, a
	jr z, .asm_181b6 ; 0x7553a
	bit 0, a
	jr nz, .asm_adc3b ; 0x7553e
	call z, Unknown_75497
	call DisableWaitingAfterTextDisplay
	jr .asm_e84c6 ; 0x75546
.asm_adc3b ; 0x75548
	ld hl, UnnamedText_7558b
	call PrintText
	jr .asm_e84c6 ; 0x7554e
.asm_181b6 ; 0x75550
	ld hl, UnnamedText_75581
	call PrintText
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_75586
	ld de, UnnamedText_75586
	call PreBattleSaveRegisters
	ldh a, [$8c]
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld a, $5
	ld [$d05c], a
	xor a
	ldh [$b4], a
	ld a, $3
	ld [W_FUCHSIAGYMCURSCRIPT], a
.asm_e84c6 ; 0x7557e
	jp TextScriptEnd

UnnamedText_75581: ; 75581 (1d:5581)
	TX_FAR _UnnamedText_75581
	db $50
; 0x75581 + 5 bytes

UnnamedText_75586: ; 75586 (1d:5586)
	TX_FAR _UnnamedText_75586
	db $50
; 0x75586 + 5 bytes

UnnamedText_7558b: ; 7558b (1d:558b)
	TX_FAR _UnnamedText_7558b
	db $50
; 0x7558b + 5 bytes

FuchsiaGymText9: ; 75590 (1d:5590)
	TX_FAR _UnnamedText_75590
	db $50
; 0x75590 + 5 bytes

FuchsiaGymText10: ; 75595 (1d:5595)
	TX_FAR _ReceivedTM06Text ; 0xa00eb
	db $11

TM06ExplanationText: ; 7559a (1d:559a)
	TX_FAR _TM06ExplanationText
	db $50
; 0x7559a + 5 bytes

FuchsiaGymText11: ; 7559f (1d:559f)
	TX_FAR _TM06NoRoomText
	db $50
; 0x7559f + 5 bytes

FuchsiaGymText2: ; 755a4 (1d:55a4)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText1: ; 755ae (1d:55ae)
	TX_FAR _FuchsiaGymBattleText1
	db $50
; 0x755ae + 5 bytes

FuchsiaGymEndBattleText1: ; 755b3 (1d:55b3)
	TX_FAR _FuchsiaGymEndBattleText1
	db $50
; 0x755b3 + 5 bytes

FuchsiaGymAfterBattleText1: ; 755b8 (1d:55b8)
	TX_FAR _FuchsiaGymAfterBattleText1
	db $50
; 0x755b8 + 5 bytes

FuchsiaGymText3: ; 755bd (1d:55bd)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader2
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText2: ; 755c7 (1d:55c7)
	TX_FAR _FuchsiaGymBattleText2
	db $50
; 0x755c7 + 5 bytes

FuchsiaGymEndBattleText2: ; 755cc (1d:55cc)
	TX_FAR _FuchsiaGymEndBattleText2
	db $50
; 0x755cc + 5 bytes

FuchsiaGymAfterBattleText2: ; 755d1 (1d:55d1)
	TX_FAR _FuchsiaGymAfterBattleText2
	db $50
; 0x755d1 + 5 bytes

FuchsiaGymText4: ; 755d6 (1d:55d6)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader3
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText3: ; 755e0 (1d:55e0)
	TX_FAR _FuchsiaGymBattleText3
	db $50
; 0x755e0 + 5 bytes

FuchsiaGymEndBattleText3: ; 755e5 (1d:55e5)
	TX_FAR _FuchsiaGymEndBattleText3
	db $50
; 0x755e5 + 5 bytes

FuchsiaGymAfterBattleText3: ; 755ea (1d:55ea)
	TX_FAR _FuchsiaGymAfterBattleText3
	db $50
; 0x755ea + 5 bytes

FuchsiaGymText5: ; 755ef (1d:55ef)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader4
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText4: ; 755f9 (1d:55f9)
	TX_FAR _FuchsiaGymBattleText4
	db $50
; 0x755f9 + 5 bytes

FuchsiaGymEndBattleText4: ; 755fe (1d:55fe)
	TX_FAR _FuchsiaGymEndBattleText4
	db $50
; 0x755fe + 5 bytes

FuchsiaGymAfterBattleText4: ; 75603 (1d:5603)
	TX_FAR _FuchsiaGymAfterBattleText4
	db $50
; 0x75603 + 5 bytes

FuchsiaGymText6: ; 75608 (1d:5608)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader5
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText5: ; 75612 (1d:5612)
	TX_FAR _FuchsiaGymBattleText5
	db $50
; 0x75612 + 5 bytes

FuchsiaGymEndBattleText5: ; 75617 (1d:5617)
	TX_FAR _FuchsiaGymEndBattleText5
	db $50
; 0x75617 + 5 bytes

FuchsiaGymAfterBattleText5: ; 7561c (1d:561c)
	TX_FAR _FuchsiaGymAfterBattleText5
	db $50
; 0x7561c + 5 bytes

FuchsiaGymText7: ; 75621 (1d:5621)
	db $08 ; asm
	ld hl, FuchsiaGymTrainerHeader6
	call TalkToTrainer
	jp TextScriptEnd

FuchsiaGymBattleText6: ; 7562b (1d:562b)
	TX_FAR _FuchsiaGymBattleText6
	db $50
; 0x7562b + 5 bytes

FuchsiaGymEndBattleText6: ; 75630 (1d:5630)
	TX_FAR _FuchsiaGymEndBattleText6
	db $50
; 0x75630 + 5 bytes

FuchsiaGymAfterBattleText6: ; 75635 (1d:5635)
	TX_FAR _FuchsiaGymAfterBattleText6
	db $50
; 0x75635 + 5 bytes

FuchsiaGymText8: ; 7563a (1d:563a)
	db $08 ; asm
	ld a, [$d792]
	bit 1, a
	ld hl, UnnamedText_75653
	jr nz, .asm_50671 ; 0x75643
	ld hl, UnnamedText_7564e
.asm_50671 ; 0x75648
	call PrintText
	jp TextScriptEnd

UnnamedText_7564e: ; 7564e (1d:564e)
	TX_FAR _UnnamedText_7564e
	db $50
; 0x7564e + 5 bytes

UnnamedText_75653: ; 75653 (1d:5653)
	TX_FAR _UnnamedText_75653
	db $50
; 0x75653 + 5 bytes

FuchsiaGymObject: ; 0x75658 (size=82)
	db $3 ; border tile

	db $2 ; warps
	db $11, $4, $5, $ff
	db $11, $5, $5, $ff

	db $0 ; signs

	db $8 ; people
	db SPRITE_BLACKBELT, $a + 4, $4 + 4, $ff, $d0, $41, KOGA + $C8, $1 ; trainer
	db SPRITE_ROCKER, $d + 4, $8 + 4, $ff, $d0, $42, JUGGLER + $C8, $7 ; trainer
	db SPRITE_ROCKER, $8 + 4, $7 + 4, $ff, $d3, $43, JUGGLER + $C8, $3 ; trainer
	db SPRITE_ROCKER, $c + 4, $1 + 4, $ff, $d0, $44, JUGGLER + $C8, $8 ; trainer
	db SPRITE_ROCKER, $5 + 4, $3 + 4, $ff, $d1, $45, TAMER + $C8, $1 ; trainer
	db SPRITE_ROCKER, $2 + 4, $8 + 4, $ff, $d0, $46, TAMER + $C8, $2 ; trainer
	db SPRITE_ROCKER, $7 + 4, $2 + 4, $ff, $d2, $47, JUGGLER + $C8, $4 ; trainer
	db SPRITE_GYM_HELPER, $f + 4, $7 + 4, $ff, $d0, $8 ; person

	; warp-to
	EVENT_DISP $5, $11, $4
	EVENT_DISP $5, $11, $5

FuchsiaGymBlocks: ; 756aa (1d:56aa)
	INCBIN "maps/fuchsiagym.blk"

FuchsiaMeetingRoom_h: ; 0x756d7 to 0x756e3 (12 bytes) (id=158)
	db $14 ; tileset
	db FUCHSIAMEETINGROOM_HEIGHT, FUCHSIAMEETINGROOM_WIDTH ; dimensions (y, x)
	dw FuchsiaMeetingRoomBlocks, FuchsiaMeetingRoomTexts, FuchsiaMeetingRoomScript ; blocks, texts, scripts
	db $00 ; connections

	dw FuchsiaMeetingRoomObject ; objects

FuchsiaMeetingRoomScript: ; 756e3 (1d:56e3)
	call EnableAutoTextBoxDrawing
	ret
; 0x756e7

FuchsiaMeetingRoomTexts: ; 756e7 (1d:56e7)
	dw FuchsiaMeetingRoomText1, FuchsiaMeetingRoomText2, FuchsiaMeetingRoomText3

FuchsiaMeetingRoomText1: ; 756ed (1d:56ed)
	TX_FAR _FuchsiaMeetingRoomText1
	db $50

FuchsiaMeetingRoomText2: ; 756f2 (1d:56f2)
	TX_FAR _FuchsiaMeetingRoomText2
	db $50

FuchsiaMeetingRoomText3: ; 756f7 (1d:56f7)
	TX_FAR _FuchsiaMeetingRoomText3
	db $50

FuchsiaMeetingRoomObject: ; 0x756fc (size=38)
	db $17 ; border tile

	db $2 ; warps
	db $7, $4, $6, $ff
	db $7, $5, $6, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_WHITE_PLAYER, $1 + 4, $4 + 4, $ff, $d0, $1 ; person
	db SPRITE_WHITE_PLAYER, $2 + 4, $0 + 4, $ff, $d1, $2 ; person
	db SPRITE_WHITE_PLAYER, $1 + 4, $a + 4, $ff, $d0, $3 ; person

	; warp-to
	EVENT_DISP $7, $7, $4
	EVENT_DISP $7, $7, $5

FuchsiaMeetingRoomBlocks: ; 75722 (1d:5722)
	INCBIN "maps/fuchsiameetingroom.blk"

CinnabarGym_h: ; 0x7573e to 0x7574a (12 bytes) (id=166)
	db $16 ; tileset
	db CINNABAR_GYM_HEIGHT, CINNABAR_GYM_WIDTH ; dimensions (y, x)
	dw CinnabarGymBlocks, CinnabarGymTexts, CinnabarGymScript ; blocks, texts, scripts
	db $00 ; connections

	dw CinnabarGymObject ; objects

CinnabarGymScript: ; 7574a (1d:574a)
	call CinnabarGymScript_Unknown75759
	call EnableAutoTextBoxDrawing
	ld hl, CinnabarGymScripts
	ld a, [W_CINNABARGYMCURSCRIPT]
	jp CallFunctionInTable
; 0x75759

CinnabarGymScript_Unknown75759: ; 75759 (1d:5759)
	ld hl, $D126
	bit 6, [hl]
	res 6, [hl]
	push hl
	call nz, CinnabarGymScript_Unknown75772
	pop hl
	bit 5, [hl]
	res 5, [hl]
	call nz, Func_3ead
	ld hl, $D79B
	res 7, [hl]
	ret
CinnabarGymScript_Unknown75772: ; 75772 (1d:5772)
	ld hl, Gym7CityName
	ld de, Gym7LeaderName
	jp LoadGymLeaderAndCityName

Gym7CityName: ; 7577b (1d:577b)
	db "CINNABAR ISLAND@"
Gym7LeaderName: ; 7578b (1d:578b)
	db "BLAINE@"

Unknown_75792: ; 75792 (1d:5792)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_CINNABARGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ld [$da38], a
	ret
; 757a0 (1d:57a0)
Unknown_757a0: ; 757a0 (1d:57a0)
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	ld [W_TRAINERHEADERFLAGBIT], a
	ret
; 757a6 (1d:57a6)
CinnabarGymScripts: ; 757a6 (1d:57a6)
	dw CinnabarGymScript0, CinnabarGymScript1, CinnabarGymScript2, CinnabarGymScript3

CinnabarGymScript0: ; 757ae (1d:57ae)
	ld a, [$da38]
	and a
	ret z
	ld [$ff00+$8c], a
	cp $4
	jr nz, .asm_757c3 ; 0x757b7 $a
	ld a, $4
	ld [$d528], a
	ld de, Unknown_757d7
	jr .asm_757cb ; 0x757c1 $8
.asm_757c3
	ld de, Unknown_757da
	ld a, $1
	ld [$d528], a
.asm_757cb
	call MoveSprite
	ld a, $1
	ld [W_CINNABARGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 0x757d7

Unknown_757d7: ; 757d7 (1d:57d7)
INCBIN "baserom.gbc",$757d7,$757da - $757d7

Unknown_757da: ; 757da (1d:57da)
INCBIN "baserom.gbc",$757da,$757dc - $757da

CinnabarGymScript1: ; 757dc (1d:57dc)
	ld a, [$d730]
	bit 0, a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, [$da38]
	ld [W_TRAINERHEADERFLAGBIT], a
	ld [$ff00+$8c], a
	jp DisplayTextID
; 0x757f1

Unknown_757f1: ; 757f1 (1d:57f1)
	ld a, $10
	jp Predef ; indirect jump to HandleBitArray (f666 (3:7666))
; 757f6 (1d:57f6)
CinnabarGymScript2: ; 757f6 (1d:57f6)
	ld a, [$d057]
	cp $ff
	jp z, Unknown_75792
	ld a, [W_TRAINERHEADERFLAGBIT]
	ld [$ff00+$db], a
	ld c, a
	ld b, $2
	ld hl, $d79a
	call Unknown_757f1
	ld a, c
	and a
	jr nz, .asm_7581b ; 0x7580e $b
	call WaitForSoundToFinish
	ld a, $ad
	call PlaySound
	call WaitForSoundToFinish
.asm_7581b
	ld a, [W_TRAINERHEADERFLAGBIT]
	ld [$ff00+$db], a
	ld c, a
	ld b, $1
	ld hl, $d79a
	call Unknown_757f1
	ld a, [W_TRAINERHEADERFLAGBIT]
	sub $2
	ld c, a
	ld b, $1
	ld hl, $d79c
	call Unknown_757f1
	call Func_3ead
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [$da38], a
	ld a, $0
	ld [W_CINNABARGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
; 0x7584a

CinnabarGymScript3: ; 7584a (1d:584a)
	ld a, [$d057]
	cp $ff
	jp z, Unknown_75792
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
Unknown_75857: ; 75857 (1d:5857)
	ld a, $a
	ld [$ff00+$8c], a
	call DisplayTextID
	ld hl, $d79a
	set 1, [hl]
	ld bc, (TM_38 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld a, $b
	ld [$ff00+$8c], a
	call DisplayTextID
	ld hl, $d79a
	set 0, [hl]
	jr .asm_75880 ; 0x75877 $7
.BagFull
	ld a, $c
	ld [$ff00+$8c], a
	call DisplayTextID
.asm_75880
	ld hl, $d356
	set 6, [hl]
	ld hl, $d72a
	set 6, [hl]
	ld a, [$d79a]
	or $fc
	ld [$d79a], a
	ld hl, $d79b
	set 0, [hl]
	ld hl, $d126
	set 5, [hl]
	jp Unknown_75792
; 0x7589f

CinnabarGymTexts: ; 7589f (1d:589f)
	dw CinnabarGymText1, CinnabarGymText2, CinnabarGymText3, CinnabarGymText4, CinnabarGymText5, CinnabarGymText6, CinnabarGymText7, CinnabarGymText8, CinnabarGymText9
dw UnnamedText_75925 ;CinnabarGymText 10: ; 0x75925
dw ReceivedTM38Text  ;CinnabarGymText 11: ; 0x7592a
dw TM38NoRoomText    ;CinnabarGymText 12: ; 0x75934

Unknown_758b7: ; 758b7 (1d:58b7)
	ld a, [H_DOWNARROWBLINKCNT2] ; $FF00+$8c
	ld [$cf13], a
	call EngageMapTrainer
	call InitBattleEnemyParameters
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld a, [$cf13]
	cp $1
	jr z, .asm_758d4
	ld a, $2
	jr .asm_758d6
.asm_758d4
	ld a, $3
.asm_758d6
	ld [W_CINNABARGYMCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	jp TextScriptEnd
; 758df (1d:58df)
CinnabarGymText1: ; 758df (1d:58df)
	db $8
	ld a, [$d79a]
	bit 1, a
	jr z, .asm_d9332 ; 0x758e5 $16
	bit 0, a
	jr nz, .asm_3012f ; 0x758e9 $9
	call z, Unknown_75857
	call DisableWaitingAfterTextDisplay
	jp TextScriptEnd
.asm_3012f ; 0x758f4
	ld hl, UnnamedText_75920
	call PrintText
	jp TextScriptEnd
.asm_d9332 ; 0x758fd
	ld hl, UnnamedText_75914
	call PrintText
	ld hl, UnnamedText_75919
	ld de, UnnamedText_75919 ; $5919 XXX
	call PreBattleSaveRegisters
	ld a, $7
	ld [$d05c], a
	jp Unknown_758b7
; 0x75914

UnnamedText_75914: ; 75914 (1d:5914)
	TX_FAR _UnnamedText_75914
	db $50
; 0x75914 + 5 bytes

UnnamedText_75919: ; 75919 (1d:5919)
	TX_FAR UnnamedText_a08c7
	db $11
	db $d
	db $50

UnnamedText_75920: ; 75920 (1d:5920)
	TX_FAR _UnnamedText_75920
	db $50
; 0x75920 + 5 bytes

UnnamedText_75925: ; 75925 (1d:5925)
	TX_FAR _UnnamedText_75925
	db $50
; 0x75925 + 5 bytes

ReceivedTM38Text: ; 7592a (1d:592a)
	TX_FAR _ReceivedTM38Text ; 0xa09a8
	db $0B
	TX_FAR _TM38ExplanationText
	db $50
; 0x75934

TM38NoRoomText: ; 75934 (1d:5934)
	TX_FAR _TM38NoRoomText
	db $50
; 0x75934 + 5 bytes

CinnabarGymText2: ; 75939 (1d:5939)
	db $08 ; asm
	call Unknown_757a0
	ld a, [$d79a]
	bit 2, a
	jr nz, .asm_46bb4 ; 0x75942
	ld hl, UnnamedText_7595f
	call PrintText
	ld hl, UnnamedText_75964
	ld de, UnnamedText_75964 ; $5964 XXX
	call PreBattleSaveRegisters
	jp Unknown_758b7
.asm_46bb4 ; 0x75956
	ld hl, UnnamedText_75969
	call PrintText
	jp TextScriptEnd

UnnamedText_7595f: ; 7595f (1d:595f)
	TX_FAR _UnnamedText_7595f
	db $50
; 0x7595f + 5 bytes

UnnamedText_75964: ; 75964 (1d:5964)
	TX_FAR _UnnamedText_75964
	db $50
; 0x75964 + 5 bytes

UnnamedText_75969: ; 75969 (1d:5969)
	TX_FAR _UnnamedText_75969
	db $50
; 0x75969 + 5 bytes

CinnabarGymText3: ; 7596e (1d:596e)
	db $08 ; asm
	call Unknown_757a0
	ld a, [$d79a]
	bit 3, a
	jr nz, .asm_4b406 ; 0x75977
	ld hl, UnnamedText_75994
	call PrintText
	ld hl, UnnamedText_75999
	ld de, UnnamedText_75999 ; $5999 XXX
	call PreBattleSaveRegisters
	jp Unknown_758b7
.asm_4b406 ; 0x7598b
	ld hl, UnnamedText_7599e
	call PrintText
	jp TextScriptEnd

UnnamedText_75994: ; 75994 (1d:5994)
	TX_FAR _UnnamedText_75994
	db $50
; 0x75994 + 5 bytes

UnnamedText_75999: ; 75999 (1d:5999)
	TX_FAR _UnnamedText_75999
	db $50
; 0x75999 + 5 bytes

UnnamedText_7599e: ; 7599e (1d:599e)
	TX_FAR _UnnamedText_7599e
	db $50
; 0x7599e + 5 bytes

CinnabarGymText4: ; 759a3 (1d:59a3)
	db $08 ; asm
	call Unknown_757a0
	ld a, [$d79a]
	bit 4, a
	jr nz, .asm_c0673 ; 0x759ac
	ld hl, UnnamedText_759c9
	call PrintText
	ld hl, UnnamedText_759ce
	ld de, UnnamedText_759ce ; $59ce XXX
	call PreBattleSaveRegisters
	jp Unknown_758b7
.asm_c0673 ; 0x759c0
	ld hl, UnnamedText_759d3
	call PrintText
	jp TextScriptEnd

UnnamedText_759c9: ; 759c9 (1d:59c9)
	TX_FAR _UnnamedText_759c9
	db $50
; 0x759c9 + 5 bytes

UnnamedText_759ce: ; 759ce (1d:59ce)
	TX_FAR _UnnamedText_759ce
	db $50
; 0x759ce + 5 bytes

UnnamedText_759d3: ; 759d3 (1d:59d3)
	TX_FAR _UnnamedText_759d3
	db $50
; 0x759d3 + 5 bytes

CinnabarGymText5: ; 759d8 (1d:59d8)
	db $08 ; asm
	call Unknown_757a0
	ld a, [$d79a]
	bit 5, a
	jr nz, .asm_5cfd7 ; 0x759e1
	ld hl, UnnamedText_759fe
	call PrintText
	ld hl, UnnamedText_75a03
	ld de, UnnamedText_75a03 ; $5a03 XXX
	call PreBattleSaveRegisters
	jp Unknown_758b7
.asm_5cfd7 ; 0x759f5
	ld hl, UnnamedText_75a08
	call PrintText
	jp TextScriptEnd

UnnamedText_759fe: ; 759fe (1d:59fe)
	TX_FAR _UnnamedText_759fe
	db $50
; 0x759fe + 5 bytes

UnnamedText_75a03: ; 75a03 (1d:5a03)
	TX_FAR _UnnamedText_75a03
	db $50
; 0x75a03 + 5 bytes

UnnamedText_75a08: ; 75a08 (1d:5a08)
	TX_FAR _UnnamedText_75a08
	db $50
; 0x75a08 + 5 bytes

CinnabarGymText6: ; 75a0d (1d:5a0d)
	db $08 ; asm
	call Unknown_757a0
	ld a, [$d79a]
	bit 6, a
	jr nz, .asm_776b4 ; 0x75a16
	ld hl, UnnamedText_75a33
	call PrintText
	ld hl, UnnamedText_75a38
	ld de, UnnamedText_75a38
	call PreBattleSaveRegisters
	jp Unknown_758b7
.asm_776b4 ; 0x75a2a
	ld hl, UnnamedText_75a3d
	call PrintText
	jp TextScriptEnd

UnnamedText_75a33: ; 75a33 (1d:5a33)
	TX_FAR _UnnamedText_75a33
	db $50
; 0x75a33 + 5 bytes

UnnamedText_75a38: ; 75a38 (1d:5a38)
	TX_FAR _UnnamedText_75a38
	db $50
; 0x75a38 + 5 bytes

UnnamedText_75a3d: ; 75a3d (1d:5a3d)
	TX_FAR _UnnamedText_75a3d
	db $50
; 0x75a3d + 5 bytes

CinnabarGymText7: ; 75a42 (1d:5a42)
	db $08 ; asm
	call Unknown_757a0
	ld a, [$d79a]
	bit 7, a
	jr nz, .asm_2f755 ; 0x75a4b
	ld hl, UnnamedText_75a68
	call PrintText
	ld hl, UnnamedText_75a6d
	ld de, UnnamedText_75a6d
	call PreBattleSaveRegisters
	jp Unknown_758b7
.asm_2f755 ; 0x75a5f
	ld hl, UnnamedText_75a72
	call PrintText
	jp TextScriptEnd

UnnamedText_75a68: ; 75a68 (1d:5a68)
	TX_FAR _UnnamedText_75a68
	db $50
; 0x75a68 + 5 bytes

UnnamedText_75a6d: ; 75a6d (1d:5a6d)
	TX_FAR _UnnamedText_75a6d
	db $50
; 0x75a6d + 5 bytes

UnnamedText_75a72: ; 75a72 (1d:5a72)
	TX_FAR _UnnamedText_75a72
	db $50
; 0x75a72 + 5 bytes

CinnabarGymText8: ; 75a77 (1d:5a77)
	db $08 ; asm
	call Unknown_757a0
	ld a, [$d79b]
	bit 0, a
	jr nz, .asm_d87be ; 0x75a80
	ld hl, UnnamedText_75a9d
	call PrintText
	ld hl, UnnamedText_75aa2
	ld de, UnnamedText_75aa2 ; $5aa2 XXX
	call PreBattleSaveRegisters
	jp Unknown_758b7
.asm_d87be ; 0x75a94
	ld hl, UnnamedText_75aa7
	call PrintText
	jp TextScriptEnd

UnnamedText_75a9d: ; 75a9d (1d:5a9d)
	TX_FAR _UnnamedText_75a9d
	db $50
; 0x75a9d + 5 bytes

UnnamedText_75aa2: ; 75aa2 (1d:5aa2)
	TX_FAR _UnnamedText_75aa2
	db $50
; 0x75aa2 + 5 bytes

UnnamedText_75aa7: ; 75aa7 (1d:5aa7)
	TX_FAR _UnnamedText_75aa7
	db $50
; 0x75aa7 + 5 bytes

CinnabarGymText9: ; 75aac (1d:5aac)
	db $08 ; asm
	ld a, [$d79a]
	bit 1, a
	jr nz, .asm_627d9 ; 0x75ab2
	ld hl, UnnamedText_75ac2
	jr .asm_0b11d ; 0x75ab7
.asm_627d9 ; 0x75ab9
	ld hl, UnnamedText_75ac7
.asm_0b11d ; 0x75abc
	call PrintText
	jp TextScriptEnd

UnnamedText_75ac2: ; 75ac2 (1d:5ac2)
	TX_FAR _UnnamedText_75ac2
	db $50
; 0x75ac2 + 5 bytes

UnnamedText_75ac7: ; 75ac7 (1d:5ac7)
	TX_FAR _UnnamedText_75ac7
	db $50
; 0x75ac7 + 5 bytes

CinnabarGymObject: ; 0x75acc (size=90)
	db $2e ; border tile

	db $2 ; warps
	db $11, $10, $1, $ff
	db $11, $11, $1, $ff

	db $0 ; signs

	db $9 ; people
	db SPRITE_FAT_BALD_GUY, $3 + 4, $3 + 4, $ff, $d0, $41, BLAINE + $C8, $1 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $2 + 4, $11 + 4, $ff, $d0, $42, SUPER_NERD + $C8, $9 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $8 + 4, $11 + 4, $ff, $d0, $43, BURGLAR + $C8, $4 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $4 + 4, $b + 4, $ff, $d0, $44, SUPER_NERD + $C8, $a ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $8 + 4, $b + 4, $ff, $d0, $45, BURGLAR + $C8, $5 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $e + 4, $b + 4, $ff, $d0, $46, SUPER_NERD + $C8, $b ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $e + 4, $3 + 4, $ff, $d0, $47, BURGLAR + $C8, $6 ; trainer
	db SPRITE_BLACK_HAIR_BOY_2, $8 + 4, $3 + 4, $ff, $d0, $48, SUPER_NERD + $C8, $c ; trainer
	db SPRITE_GYM_HELPER, $d + 4, $10 + 4, $ff, $d0, $9 ; person

	; warp-to
	EVENT_DISP $a, $11, $10
	EVENT_DISP $a, $11, $11

CinnabarGymBlocks: ; 75b26 (1d:5b26)
	INCBIN "maps/cinnabargym.blk"

Lab1_h: ; 0x75b80 to 0x75b8c (12 bytes) (id=167)
	db $14 ; tileset
	db CINNABAR_LAB_1_HEIGHT, CINNABAR_LAB_1_WIDTH ; dimensions (y, x)
	dw Lab1Blocks, Lab1Texts, Lab1Script ; blocks, texts, scripts
	db $00 ; connections

	dw Lab1Object ; objects

Lab1Script: ; 75b8c (1d:5b8c)
	call EnableAutoTextBoxDrawing
	ret
; 0x75b90

Lab1Texts: ; 75b90 (1d:5b90)
	dw Lab1Text1, Lab1Text2, Lab1Text3, Lab1Text4, Lab1Text5

Lab1Text1: ; 75b9a (1d:5b9a)
	TX_FAR _Lab1Text1
	db $50

Lab1Text2: ; 75b9f (1d:5b9f)
	TX_FAR _Lab1Text2
	db $50

Lab1Text3: ; 75ba4 (1d:5ba4)
	TX_FAR _Lab1Text3
	db $50

Lab1Text4: ; 75ba9 (1d:5ba9)
	TX_FAR _Lab1Text4
	db $50

Lab1Text5: ; 75bae (1d:5bae)
	TX_FAR _Lab1Text5
	db $50

Lab1Object: ; 0x75bb3 (size=62)
	db $17 ; border tile

	db $5 ; warps
	db $7, $2, $2, $ff
	db $7, $3, $2, $ff
	db $4, $8, $0, CINNABAR_LAB_2
	db $4, $c, $0, CINNABAR_LAB_3
	db $4, $10, $0, CINNABAR_LAB_4

	db $4 ; signs
	db $2, $3, $2 ; Lab1Text2
	db $4, $9, $3 ; Lab1Text3
	db $4, $d, $4 ; Lab1Text4
	db $4, $11, $5 ; Lab1Text5

	db $1 ; people
	db SPRITE_FISHER, $3 + 4, $1 + 4, $ff, $ff, $1 ; person

	; warp-to
	EVENT_DISP $9, $7, $2
	EVENT_DISP $9, $7, $3
	EVENT_DISP $9, $4, $8 ; CINNABAR_LAB_2
	EVENT_DISP $9, $4, $c ; CINNABAR_LAB_3
	EVENT_DISP $9, $4, $10 ; CINNABAR_LAB_4

Lab1Blocks: ; 75bf1 (1d:5bf1)
	INCBIN "maps/lab1.blk"

Lab2_h: ; 0x75c15 to 0x75c21 (12 bytes) (id=168)
	db $14 ; tileset
	db CINNABAR_LAB_2_HEIGHT, CINNABAR_LAB_2_WIDTH ; dimensions (y, x)
	dw Lab2Blocks, Lab2Texts, Lab2Script ; blocks, texts, scripts
	db $00 ; connections

	dw Lab2Object ; objects

Lab2Script: ; 75c21 (1d:5c21)
	jp EnableAutoTextBoxDrawing
; 0x75c24

Lab2Texts: ; 75c24 (1d:5c24)
	dw Lab2Text1, Lab2Text2, Lab2Text3

Lab2Text1: ; 75c2a (1d:5c2a)
	TX_FAR _Lab2Text1
	db $50

Lab2Text2: ; 75c2f (1d:5c2f)
	db $8
	ld a, $7
	ld [W_WHICHTRADE], a
	jr asm_78552 ; 0x75c35 $6

Lab2Text3: ; 75c37 (1d:5c37)
	db $8
	ld a, $8
	ld [W_WHICHTRADE], a
asm_78552: ; 75c3d (1d:5c3d)
	ld a, $54
	call Predef
	jp TextScriptEnd

Lab2Object: ; 0x75c45 (size=38)
	db $17 ; border tile

	db $2 ; warps
	db $7, $2, $2, CINNABAR_LAB_1
	db $7, $3, $2, CINNABAR_LAB_1

	db $0 ; signs

	db $3 ; people
	db SPRITE_BLACK_HAIR_BOY_2, $2 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_OLD_PERSON, $4 + 4, $1 + 4, $ff, $ff, $2 ; person
	db SPRITE_FOULARD_WOMAN, $5 + 4, $5 + 4, $ff, $d1, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2 ; CINNABAR_LAB_1
	EVENT_DISP $4, $7, $3 ; CINNABAR_LAB_1

Lab2Blocks: ; 75c6b (1d:5c6b)
	INCBIN "maps/lab2.blk"

Lab3_h: ; 0x75c7b to 0x75c87 (12 bytes) (id=169)
	db $14 ; tileset
	db CINNABAR_LAB_3_HEIGHT, CINNABAR_LAB_3_WIDTH ; dimensions (y, x)
	dw Lab3Blocks, Lab3Texts, Lab3Script ; blocks, texts, scripts
	db $00 ; connections

	dw Lab3Object ; objects

Lab3Script: ; 75c87 (1d:5c87)
	jp EnableAutoTextBoxDrawing
; 0x75c8a

Lab3Texts: ; 75c8a (1d:5c8a)
	dw Lab3Text1, Lab3Text2, Lab3Text3, Lab3Text4, Lab3Text5

Lab3Text1: ; 75c94 (1d:5c94)
	db $08 ; asm
	ld a, [$d7a1]
	bit 7, a
	jr nz, .asm_e551a ; 0x75c9a
	ld hl, TM35PreReceiveText
	call PrintText
	ld bc, (TM_35 << 8) | 1
	call GiveItem
	jr nc, .BagFull
	ld hl, ReceivedTM35Text
	call PrintText
	ld hl, $d7a1
	set 7, [hl]
	jr .asm_eb896 ; 0x75cb5
.BagFull
	ld hl, TM35NoRoomText
	call PrintText
	jr .asm_eb896 ; 0x75cbd
.asm_e551a ; 0x75cbf
	ld hl, TM35ExplanationText
	call PrintText
.asm_eb896 ; 0x75cc5
	jp TextScriptEnd

TM35PreReceiveText: ; 75cc8 (1d:5cc8)
	TX_FAR _TM35PreReceiveText
	db $50
; 0x75cc8 + 5 bytes

ReceivedTM35Text: ; 75ccd (1d:5ccd)
	TX_FAR _ReceivedTM35Text ; 0xa0f48
	db $0B, $50
; 0x75cd3

TM35ExplanationText: ; 75cd3 (1d:5cd3)
	TX_FAR _TM35ExplanationText
	db $50
; 0x75cd3 + 5 bytes

TM35NoRoomText: ; 75cd8 (1d:5cd8)
	TX_FAR _TM35NoRoomText
	db $50
; 0x75cd8 + 5 bytes

Lab3Text2: ; 75cdd (1d:5cdd)
	TX_FAR _Lab3Text2
	db $50

Lab3Text4: ; 75ce2 (1d:5ce2)
Lab3Text3: ; 75ce2 (1d:5ce2)
	TX_FAR _Lab3Text3
	db $50

Lab3Text5: ; 75ce7 (1d:5ce7)
	TX_FAR _Lab3Text5
	db $50

Lab3Object: ; 0x75cec (size=41)
	db $17 ; border tile

	db $2 ; warps
	db $7, $2, $3, CINNABAR_LAB_1
	db $7, $3, $3, CINNABAR_LAB_1

	db $3 ; signs
	db $4, $0, $3 ; Lab3Text3
	db $4, $1, $4 ; Lab3Text4
	db $1, $2, $5 ; Lab3Text5

	db $2 ; people
	db SPRITE_OAK_AIDE, $2 + 4, $7 + 4, $ff, $d0, $1 ; person
	db SPRITE_OAK_AIDE, $3 + 4, $2 + 4, $fe, $2, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2 ; CINNABAR_LAB_1
	EVENT_DISP $4, $7, $3 ; CINNABAR_LAB_1

Lab3Blocks: ; 75d15 (1d:5d15)
	INCBIN "maps/lab3.blk"

Lab4_h: ; 0x75d25 to 0x75d31 (12 bytes) (id=170)
	db $14 ; tileset
	db CINNABAR_LAB_4_HEIGHT, CINNABAR_LAB_4_WIDTH ; dimensions (y, x)
	dw Lab4Blocks, Lab4Texts, Lab4Script ; blocks, texts, scripts
	db $00 ; connections

	dw Lab4Object ; objects

Lab4Script: ; 75d31 (1d:5d31)
	jp EnableAutoTextBoxDrawing
; 0x75d34

Lab4Texts: ; 75d34 (1d:5d34)
	dw Lab4Text1, Lab4Text2

Unknown_75d38: ; 75d38 (1d:5d38)
	xor a
	ld [$cd37], a
	ld de, $cc5b
	ld hl, Unknown_75d68
.asm_75d42
	ld a, [hli]
	and a
	jr z, .asm_75d64
	push hl
	push de
	ld [$d11e], a
	ld b, a
	ld a, $1c
	call Predef ; indirect jump to Func_f8a5 (f8a5 (3:78a5))
	pop de
	pop hl
	ld a, b
	and a
	jr z, .asm_75d42
	ld a, [$d11e]
	ld [de], a
	inc de
	push hl
	ld hl, $cd37
	inc [hl]
	pop hl
	jr .asm_75d42
.asm_75d64
	ld a, $ff
	ld [de], a
	ret

Unknown_75d68: ; 75d68 (1d:5d68)
INCBIN "baserom.gbc",$75d68,$75d6c - $75d68

Lab4Text1: ; 75d6c (1d:5d6c)
	db $8
	ld a, [$d7a3]
	bit 0, a
	jr nz, .asm_75d96 ; 0x75d72 $22
	ld hl, UnnamedText_75dc6
	call PrintText
	call Unknown_75d38
	ld a, [$cd37]
	and a
	jr z, .asm_75d8d ; 0x75d81 $a
	ld b, BANK(GiveFossilToCinnabarLab)
	ld hl, GiveFossilToCinnabarLab
	call Bankswitch
	jr .asm_75d93 ; 0x75d8b $6
.asm_75d8d
	ld hl, UnnamedText_75dcb
	call PrintText
.asm_75d93
	jp TextScriptEnd
.asm_75d96
	bit 1, a
	jr z, .asm_75da2 ; 0x75d98 $8
	ld hl, UnnamedText_75dd0
	call PrintText
	jr .asm_75d93 ; 0x75da0 $f1
.asm_75da2
	call LoadFossilItemAndMonNameBank1D
	ld hl, UnnamedText_75dd5
	call PrintText
	ld hl, $d7a3
	set 2, [hl]
	ld a, [W_FOSSILMON]
	ld b, a
	ld c, $1e
	call GivePokemon
	jr nc, .asm_75d93 ; 0x75db9 $d8
	ld hl, $d7a3
	res 0, [hl]
	res 1, [hl]
	res 2, [hl]
	jr .asm_75d93 ; 0x75dc4 $cd
; 0x75dc6

UnnamedText_75dc6: ; 75dc6 (1d:5dc6)
	TX_FAR _UnnamedText_75dc6
	db $50
; 0x75dc6 + 5 bytes

UnnamedText_75dcb: ; 75dcb (1d:5dcb)
	TX_FAR _UnnamedText_75dcb
	db $50
; 0x75dcb + 5 bytes

UnnamedText_75dd0: ; 75dd0 (1d:5dd0)
	TX_FAR _UnnamedText_75dd0
	db $50
; 0x75dd0 + 5 bytes

UnnamedText_75dd5: ; 75dd5 (1d:5dd5)
	TX_FAR _UnnamedText_75dd5
	db $50
; 0x75dd5 + 5 bytes

Lab4Text2: ; 75dda (1d:5dda)
	db $08 ; asm
	ld a, $3
	ld [W_WHICHTRADE], a
	ld a, $54
	call Predef
	jp TextScriptEnd

LoadFossilItemAndMonNameBank1D: ; 75de8 (1d:5de8)
	ld b, BANK(LoadFossilItemAndMonName)
	ld hl, LoadFossilItemAndMonName
	jp Bankswitch
; 0x75df0

Lab4Object: ; 0x75df0 (size=32)
	db $17 ; border tile

	db $2 ; warps
	db $7, $2, $4, CINNABAR_LAB_1
	db $7, $3, $4, CINNABAR_LAB_1

	db $0 ; signs

	db $2 ; people
	db SPRITE_OAK_AIDE, $2 + 4, $5 + 4, $fe, $2, $1 ; person
	db SPRITE_OAK_AIDE, $6 + 4, $7 + 4, $ff, $d1, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $2 ; CINNABAR_LAB_1
	EVENT_DISP $4, $7, $3 ; CINNABAR_LAB_1

Lab4Blocks: ; 75e10 (1d:5e10)
	INCBIN "maps/lab4.blk"

CinnabarPokecenter_h: ; 0x75e20 to 0x75e2c (12 bytes) (id=171)
	db $06 ; tileset
	db CINNABAR_POKECENTER_HEIGHT, CINNABAR_POKECENTER_WIDTH ; dimensions (y, x)
	dw CinnabarPokecenterBlocks, CinnabarPokecenterTexts, CinnabarPokecenterScript ; blocks, texts, scripts
	db $00 ; connections

	dw CinnabarPokecenterObject ; objects

CinnabarPokecenterScript: ; 75e2c (1d:5e2c)
	call Func_22fa
	jp EnableAutoTextBoxDrawing
; 0x75e32

CinnabarPokecenterTexts: ; 75e32 (1d:5e32)
	dw CinnabarPokecenterText1, CinnabarPokecenterText2, CinnabarPokecenterText3, CinnabarPokecenterText4

CinnabarPokecenterText1: ; 75e3a (1d:5e3a)
	db $ff

CinnabarPokecenterText2: ; 75e3b (1d:5e3b)
	TX_FAR _CinnabarPokecenterText1
	db $50

CinnabarPokecenterText3: ; 75e40 (1d:5e40)
	TX_FAR _CinnabarPokecenterText3
	db $50

CinnabarPokecenterText4: ; 75e45 (1d:5e45)
	db $f6

CinnabarPokecenterObject: ; 0x75e46 (size=44)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $3, $ff
	db $7, $4, $3, $ff

	db $0 ; signs

	db $4 ; people
	db SPRITE_NURSE, $1 + 4, $3 + 4, $ff, $d0, $1 ; person
	db SPRITE_LASS, $4 + 4, $9 + 4, $fe, $0, $2 ; person
	db SPRITE_GENTLEMAN, $6 + 4, $2 + 4, $ff, $ff, $3 ; person
	db SPRITE_CABLE_CLUB_WOMAN, $2 + 4, $b + 4, $ff, $d0, $4 ; person

	; warp-to
	EVENT_DISP $7, $7, $3
	EVENT_DISP $7, $7, $4

CinnabarMart_h: ; 0x75e72 to 0x75e7e (12 bytes) (id=172)
	db $02 ; tileset
	db CINNABAR_MART_HEIGHT, CINNABAR_MART_WIDTH ; dimensions (y, x)
	dw CinnabarMartBlocks, CinnabarMartTexts, CinnabarMartScript ; blocks, texts, scripts
	db $00 ; connections

	dw CinnabarMartObject ; objects

CinnabarMartScript: ; 75e7e (1d:5e7e)
	jp EnableAutoTextBoxDrawing
; 0x75e81

CinnabarMartTexts: ; 75e81 (1d:5e81)
	dw CinnabarMartText1, CinnabarMartText2, CinnabarMartText3

CinnabarMartText2: ; 75e87 (1d:5e87)
	TX_FAR _CinnabarMartText2
	db $50

CinnabarMartText3: ; 75e8c (1d:5e8c)
	TX_FAR _CinnabarMartText3
	db $50

CinnabarMartObject: ; 0x75e91 (size=38)
	db $0 ; border tile

	db $2 ; warps
	db $7, $3, $4, $ff
	db $7, $4, $4, $ff

	db $0 ; signs

	db $3 ; people
	db SPRITE_MART_GUY, $5 + 4, $0 + 4, $ff, $d3, $1 ; person
	db SPRITE_ERIKA, $2 + 4, $6 + 4, $ff, $ff, $2 ; person
	db SPRITE_OAK_AIDE, $4 + 4, $3 + 4, $ff, $ff, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $7, $4

CopycatsHouseF1_h: ; 0x75eb7 to 0x75ec3 (12 bytes) (id=175)
	db $01 ; tileset
	db COPYCATS_HOUSE_1F_HEIGHT, COPYCATS_HOUSE_1F_WIDTH ; dimensions (y, x)
	dw CopycatsHouseF1Blocks, CopycatsHouseF1Texts, CopycatsHouseF1Script ; blocks, texts, scripts
	db $00 ; connections

	dw CopycatsHouseF1Object ; objects

CopycatsHouseF1Script: ; 75ec3 (1d:5ec3)
	jp EnableAutoTextBoxDrawing
; 0x75ec6

CopycatsHouseF1Texts: ; 75ec6 (1d:5ec6)
	dw CopycatsHouseF1Text1, CopycatsHouseF1Text2, CopycatsHouseF1Text3

CopycatsHouseF1Text1: ; 75ecc (1d:5ecc)
	TX_FAR _CopycatsHouseF1Text1
	db $50

CopycatsHouseF1Text2: ; 75ed1 (1d:5ed1)
	TX_FAR _CopycatsHouseF1Text2
	db $50

CopycatsHouseF1Text3: ; 75ed6 (1d:5ed6)
	TX_FAR _CopycatsHouseF1Text3
	db $8
	ld a, CHANSEY
	call PlayCry
	jp TextScriptEnd

CopycatsHouseF1Object: ; 0x75ee3 (size=46)
	db $a ; border tile

	db $3 ; warps
	db $7, $2, $0, $ff
	db $7, $3, $0, $ff
	db $1, $7, $0, COPYCATS_HOUSE_2F

	db $0 ; signs

	db $3 ; people
	db SPRITE_MOM_GEISHA, $2 + 4, $2 + 4, $ff, $d0, $1 ; person
	db SPRITE_FAT_BALD_GUY, $4 + 4, $5 + 4, $ff, $d2, $2 ; person
	db SPRITE_CLEFAIRY, $4 + 4, $1 + 4, $fe, $1, $3 ; person

	; warp-to
	EVENT_DISP $4, $7, $2
	EVENT_DISP $4, $7, $3
	EVENT_DISP $4, $1, $7 ; COPYCATS_HOUSE_2F

Gary_h: ; 75f11 (1d:5f11)
	db $7 ;tileset
	db $4, $4 ;Height, Width
	dw GaryBlocks, GaryTexts, GaryScript
	db $0 ;No Connections

	dw GaryObject

GaryScript: ; 75f1d (1d:5f1d)
	call EnableAutoTextBoxDrawing
	ld hl, GaryScripts
	ld a, [W_GARYCURSCRIPT]
	jp CallFunctionInTable

Function75f29: ; 75f29 (1d:5f29)
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_GARYCURSCRIPT], a
	ret

GaryScripts: ; 75f31 (1d:5f31)
	dw GaryScript0
	dw GaryScript1
	dw GaryScript2
	dw GaryScript3
	dw GaryScript4
	dw GaryScript5
	dw GaryScript6
	dw GaryScript7
	dw GaryScript8
	dw GaryScript9
	dw GaryScript10 ; 60b9

GaryScript0: ; 75f47 (1d:5f47)
	ret
; 0x75f48

GaryScript1: ; 75f48 (1d:5f48)
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $ccd3
	ld de, RLEMovement75f63
	call DecodeRLEList
	dec a
	ld [$cd38], a
	call Func_3486
	ld a, $2
	ld [W_GARYCURSCRIPT], a
	ret

RLEMovement75f63: ; 75f63 (1d:5f63)
	db $40,1
	db $10,1
	db $40,3
	db $ff

GaryScript2: ; 75f6a (1d:5f6a)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $d355
	res 7, [hl]
	ld a, $1
	ld [$ff00+$8c], a
	call DisplayTextID
	call Delay3
	ld hl, $d72d
	set 6, [hl]
	set 7, [hl]
	ld hl, UnnamedText_760f9
	ld de, UnnamedText_760fe
	call PreBattleSaveRegisters
	ld a, $f3
	ld [$d059], a

	; select which team to use during the encounter
	ld a, [W_RIVALSTARTER]
	cp SQUIRTLE
	jr nz, .NotSquirtle ; 0x75f9f $4
	ld a, $1
	jr .done
.NotSquirtle
	cp BULBASAUR
	jr nz, .Charmander ; 0x75fa7 $4
	ld a, $2
	jr .done
.Charmander
	ld a, $3
.done
	ld [W_TRAINERNO], a

	xor a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld a, $3
	ld [W_GARYCURSCRIPT], a
	ret

GaryScript3: ; 75fbb (1d:5fbb)
	ld a, [W_ISINBATTLE]
	cp $ff
	jp z, Function75f29
	call UpdateSprites ; move sprites
	ld hl, $d867
	set 1, [hl]
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $1
	ld [$ff00+$8c], a
	call Function760c8
	ld a, $1
	ld [$ff00+$8c], a
	call SetSpriteMovementBytesToFF
	ld a, $4
	ld [W_GARYCURSCRIPT], a
	ret

GaryScript4: ; 75fe4 (1d:5fe4)
	ld b, BANK(Func_9b81)
	ld hl, Func_9b81
	call Bankswitch
	ld a, $2
	ld [$ff00+$8c], a
	call Function760c8
	ld a, $2
	ld [$ff00+$8c], a
	call SetSpriteMovementBytesToFF
	ld de, Movement76014
	ld a, $2
	ld [$ff00+$8c], a
	call MoveSprite
	ld a, $d6
	ld [$cc4d], a
	ld a, $15
	call Predef
	ld a, $5
	ld [W_GARYCURSCRIPT], a
	ret

Movement76014: ; 76014 (1d:6014)
	db $40,$40,$40,$40,$40,$ff

GaryScript5: ; 7601a (1d:601a)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $2
	ld [$d528], a
	ld a, $1
	ld [$ff00+$8c], a
	ld a, $8
	ld [$ff00+$8d], a
	call Func_34a6
	ld a, $2
	ld [$ff00+$8c], a
	xor a
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	ld a, $3
	ld [$ff00+$8c], a
	call Function760c8
	ld a, $6
	ld [W_GARYCURSCRIPT], a
	ret

GaryScript6: ; 76047 (1d:6047)
	ld a, $2
	ld [$ff00+$8c], a
	ld a, $c
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	ld a, $4
	ld [$ff00+$8c], a
	call Function760c8
	ld a, $7
	ld [W_GARYCURSCRIPT], a
	ret

GaryScript7: ; 7605f (1d:605f)
	ld a, $2
	ld [$ff00+$8c], a
	xor a
	ld [$ff00+$8d], a
	call Func_34a6 ; face object
	ld a, $5
	ld [$ff00+$8c], a
	call Function760c8
	ld de, Movement76080
	ld a, $2
	ld [$ff00+$8c], a
	call MoveSprite
	ld a, $8
	ld [W_GARYCURSCRIPT], a
	ret

Movement76080: ; 76080 (1d:6080)
	db $40,$40,$ff

GaryScript8: ; 76083 (1d:6083)
	ld a, [$d730]
	bit 0, a
	ret nz
	ld a, $d6
	ld [$cc4d], a
	ld a, $11
	call Predef
	ld a, $9
	ld [W_GARYCURSCRIPT], a
	ret

GaryScript9: ; 76099 (1d:6099)
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld hl, $ccd3
	ld de, RLEMovement760b4
	call DecodeRLEList
	dec a
	ld [$cd38], a
	call Func_3486
	ld a, $a
	ld [W_GARYCURSCRIPT], a
	ret

RLEMovement760b4; 0x760b4
	db $40,4
	db $20,1
	db $ff

GaryScript10: ; 760b9 (1d:60b9)
	ld a, [$cd38]
	and a
	ret nz
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld a, $0
	ld [W_GARYCURSCRIPT], a
	ret

Function760c8; 0x760c8
	ld a, $f0
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	call DisplayTextID
	ld a, $ff
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ret

GaryTexts: ; 760d6 (1d:60d6)
	dw GaryText1, GaryText2, GaryText3, GaryText4, GaryText5

GaryText1: ; 760e0 (1d:60e0)
	db $08 ; asm
	ld a, [$d867]
	bit 1, a
	ld hl, UnnamedText_760f4
	jr z, .asm_17e9f ; 0x760e9
	ld hl, UnnamedText_76103
.asm_17e9f ; 0x760ee
	call PrintText
	jp TextScriptEnd

UnnamedText_760f4: ; 760f4 (1d:60f4)
	TX_FAR _UnnamedText_760f4
	db $50
; 0x760f4 + 5 bytes

UnnamedText_760f9: ; 760f9 (1d:60f9)
	TX_FAR _UnnamedText_760f9
	db $50
; 0x760f9 + 5 bytes

UnnamedText_760fe: ; 760fe (1d:60fe)
	TX_FAR _UnnamedText_760fe
	db $50
; 0x760fe + 5 bytes

UnnamedText_76103: ; 76103 (1d:6103)
	TX_FAR _UnnamedText_76103
	db $50
; 0x76103 + 5 bytes

GaryText2: ; 76108 (1d:6108)
	TX_FAR _GaryText2
	db $50

GaryText3: ; 7610d (1d:610d)
	db $8
	ld a, [$d717]
	ld [$d11e], a
	call GetMonName
	ld hl, UnnamedText_76120
	call PrintText
	jp TextScriptEnd
; 0x76120

UnnamedText_76120: ; 76120 (1d:6120)
	TX_FAR _UnnamedText_76120
	db $50
; 0x76120 + 5 bytes

GaryText4: ; 76125 (1d:6125)
	TX_FAR _UnnamedText_76125
	db $50
; 0x76125 + 5 bytes

GaryText5: ; 7612a (1d:612a)
	TX_FAR _UnnamedText_7612a
	db $50
; 0x7612a + 5 bytes

GaryObject: ; 0x7612f (size=48)
	db $3 ; border tile

	db $4 ; warps
	db $7, $3, $1, LANCES_ROOM
	db $7, $4, $2, LANCES_ROOM
	db $0, $3, $0, HALL_OF_FAME
	db $0, $4, $0, HALL_OF_FAME

	db $0 ; signs

	db $2 ; people
	db SPRITE_BLUE, $2 + 4, $4 + 4, $ff, $d0, $1 ; person
	db SPRITE_OAK, $7 + 4, $3 + 4, $ff, $d1, $2 ; person

	; warp-to
	EVENT_DISP $4, $7, $3 ; LANCES_ROOM
	EVENT_DISP $4, $7, $4 ; LANCES_ROOM
	EVENT_DISP $4, $0, $3 ; HALL_OF_FAME
	EVENT_DISP $4, $0, $4 ; HALL_OF_FAME

GaryBlocks: ; 7615f (1d:615f)
	INCBIN "maps/gary.blk"

Lorelei_h: ; 0x7616f to 0x7617b (12 bytes) (id=245)
	db $07 ; tileset
	db LORELEIS_ROOM_HEIGHT, LORELEIS_ROOM_WIDTH ; dimensions (y, x)
	dw LoreleiBlocks, LoreleiTexts, LoreleiScript ; blocks, texts, scripts
	db $00 ; connections

	dw LoreleiObject ; objects

LoreleiScript: ; 7617b (1d:617b)
	call LoreleiScript_Unknown76191
	call EnableAutoTextBoxDrawing
	ld hl, LoreleiTrainerHeaders
	ld de, Unknown_761bb
	ld a, [W_LORELEICURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_LORELEICURSCRIPT], a
	ret
; 0x76191

LoreleiScript_Unknown76191: ; 76191 (1d:6191)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld hl, $d734
	set 1, [hl]
	ld a, [$d863]
	bit 1, a
	jr z, .asm_761a9
	ld a, $5
	jr .asm_761ab
.asm_761a9
	ld a, $24
.asm_761ab
	ld [$d09f], a
	ld bc, $2
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

; known jump sources: 76247 (1d:6247)
Func_761b6: ; 761b6 (1d:61b6)
	xor a
	ld [W_LORELEICURSCRIPT], a
	ret
; 761bb (1d:61bb)

Unknown_761bb: ; 761bb (1d:61bb)
dw Func_761e2
dw Func_324c
dw Func_7623f
dw Func_7622c
dw Func_761c5

Func_761c5: ; 761c5 (1d:61c5)
	ret
asm_761c6: ; 761c6 (1d:61c6)
	ld hl, $ccd3
	ld a, $40
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld a, $6
	ld [$cd38], a
	call Func_3486
	ld a, $3
	ld [W_LORELEICURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
Func_761e2: ; 761e2 (1d:61e2)
	ld hl, Unknown_76223
	call ArePlayerCoordsInArray
	jp nc, CheckFightingMapTrainers
	xor a
	ld [H_NEWLYPRESSEDBUTTONS], a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [$ccd3], a
	ld [$cd38], a
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $3
	jr c, .asm_76206
	ld hl, $d863
	bit 6, [hl]
	set 6, [hl]
	jr z, asm_761c6
.asm_76206
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $40
	ld [$ccd3], a
	ld a, $1
	ld [$cd38], a
	call Func_3486
	ld a, $3
	ld [W_LORELEICURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_76223: ; 76223 (1d:6223)
INCBIN "baserom.gbc",$76223,$7622c - $76223

Func_7622c: ; 7622c (1d:622c)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_LORELEICURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret
Func_7623f: ; 7623f (1d:623f)
	call EndTrainerBattle
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_761b6
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp DisplayTextID
; 76251 (1d:6251)
LoreleiTexts: ; 76251 (1d:6251)
	dw LoreleiText1, LoreleiText2

LoreleiTrainerHeaders: ; 76255 (1d:6255)
LoreleiTrainerHeader0: ; 76255 (1d:6255)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d863 ; flag's byte
	dw LoreleiBeforeBattleText ; 0x626c TextBeforeBattle
	dw LoreleiAfterBattleText ; 0x6276 TextAfterBattle
	dw LoreleiEndBattleText ; 0x6271 TextEndBattle
	dw LoreleiEndBattleText ; 0x6271 TextEndBattle
; 0x76261

db $ff

LoreleiText1: ; 76262 (1d:6262)
	db $08 ; asm
	ld hl, LoreleiTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

LoreleiBeforeBattleText: ; 7626c (1d:626c)
	TX_FAR _LoreleiBeforeBattleText
	db $50
; 0x7626c + 5 bytes

LoreleiEndBattleText: ; 76271 (1d:6271)
	TX_FAR _LoreleiEndBattleText
	db $50
; 0x76271 + 5 bytes

LoreleiAfterBattleText: ; 76276 (1d:6276)
	TX_FAR _LoreleiAfterBattleText
	db $50
; 0x76276 + 5 bytes

LoreleiText2: ; 7627b (1d:627b)
	TX_FAR _UnnamedText_7627b
	db $50
; 0x7627b + 5 bytes

LoreleiObject: ; 0x76280 (size=44)
	db $3 ; border tile

	db $4 ; warps
	db $b, $4, $2, INDIGO_PLATEAU_LOBBY
	db $b, $5, $2, INDIGO_PLATEAU_LOBBY
	db $0, $4, $0, BRUNOS_ROOM
	db $0, $5, $1, BRUNOS_ROOM

	db $0 ; signs

	db $1 ; people
	db SPRITE_LORELEI, $2 + 4, $5 + 4, $ff, $d0, $41, LORELEI + $C8, $1 ; trainer

	; warp-to
	EVENT_DISP $5, $b, $4 ; INDIGO_PLATEAU_LOBBY
	EVENT_DISP $5, $b, $5 ; INDIGO_PLATEAU_LOBBY
	EVENT_DISP $5, $0, $4 ; BRUNOS_ROOM
	EVENT_DISP $5, $0, $5 ; BRUNOS_ROOM

LoreleiBlocks: ; 762ac (1d:62ac)
	INCBIN "maps/loreli.blk"

Bruno_h: ; 0x762ca to 0x762d6 (12 bytes) (id=246)
	db $07 ; tileset
	db BRUNOS_ROOM_HEIGHT, BRUNOS_ROOM_WIDTH ; dimensions (y, x)
	dw BrunoBlocks, BrunoTexts, BrunoScript ; blocks, texts, scripts
	db $00 ; connections

	dw BrunoObject ; objects

BrunoScript: ; 762d6 (1d:62d6)
	call BrunoScript_Unknown762ec
	call EnableAutoTextBoxDrawing
	ld hl, BrunoTrainerHeaders
	ld de, Unknown_76312
	ld a, [W_BRUNOCURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_BRUNOCURSCRIPT], a
	ret
; 0x762ec

BrunoScript_Unknown762ec: ; 762ec (1d:62ec)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld a, [$d864]
	bit 1, a
	jr z, .asm_76300
	ld a, $5
	jp Func_76302
.asm_76300
	ld a, $24

; known jump sources: 762fd (1d:62fd)
Func_76302: ; 76302 (1d:6302)
	ld [$d09f], a
	ld bc, $2
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

; known jump sources: 7639e (1d:639e)
Func_7630d: ; 7630d (1d:630d)
	xor a
	ld [W_BRUNOCURSCRIPT], a
	ret
; 76312 (1d:6312)

Unknown_76312: ; 76312 (1d:6312)
dw Func_76339
dw Func_324c
dw Func_76396
dw Func_76383
dw Func_7631c

Func_7631c: ; 7631c (1d:631c)
	ret
asm_7631d: ; 7631d (1d:631d)
	ld hl, $ccd3
	ld a, $40
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld a, $6
	ld [$cd38], a
	call Func_3486
	ld a, $3
	ld [W_BRUNOCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Func_76339: ; 76339 (1d:6339)
	ld hl, Unknown_7637a
	call ArePlayerCoordsInArray
	jp nc, CheckFightingMapTrainers
	xor a
	ld [H_NEWLYPRESSEDBUTTONS], a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [$ccd3], a
	ld [$cd38], a
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $3
	jr c, .asm_7635d
	ld hl, $d864
	bit 6, [hl]
	set 6, [hl]
	jr z, asm_7631d
.asm_7635d
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $40
	ld [$ccd3], a
	ld a, $1
	ld [$cd38], a
	call Func_3486
	ld a, $3
	ld [W_BRUNOCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_7637a: ; 7637a (1d:637a)
INCBIN "baserom.gbc",$7637a,$76383 - $7637a

Func_76383: ; 76383 (1d:6383)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_BRUNOCURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Func_76396: ; 76396 (1d:6396)
	call EndTrainerBattle
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_7630d
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	jp DisplayTextID
; 763a8 (1d:63a8)
BrunoTexts: ; 763a8 (1d:63a8)
	dw BrunoText1, BrunoText2

BrunoTrainerHeaders: ; 763ac (1d:63ac)
BrunoTrainerHeader0: ; 763ac (1d:63ac)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d864 ; flag's byte
	dw BrunoBeforeBattleText ; 0x63c3 TextBeforeBattle
	dw BrunoAfterBattleText ; 0x63cd TextAfterBattle
	dw BrunoEndBattleText ; 0x63c8 TextEndBattle
	dw BrunoEndBattleText ; 0x63c8 TextEndBattle
; 0x763b8

db $ff

BrunoText1: ; 763b9 (1d:63b9)
	db $08 ; asm
	ld hl, BrunoTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

BrunoBeforeBattleText: ; 763c3 (1d:63c3)
	TX_FAR _BrunoBeforeBattleText
	db $50
; 0x763c3 + 5 bytes

BrunoEndBattleText: ; 763c8 (1d:63c8)
	TX_FAR _BrunoEndBattleText
	db $50
; 0x763c8 + 5 bytes

BrunoAfterBattleText: ; 763cd (1d:63cd)
	TX_FAR _BrunoAfterBattleText
	db $50
; 0x763cd + 5 bytes

BrunoText2: ; 763d2 (1d:63d2)
	TX_FAR _UnnamedText_763d2
	db $50
; 0x763d2 + 5 bytes

BrunoObject: ; 0x763d7 (size=44)
	db $3 ; border tile

	db $4 ; warps
	db $b, $4, $2, LORELEIS_ROOM
	db $b, $5, $3, LORELEIS_ROOM
	db $0, $4, $0, AGATHAS_ROOM
	db $0, $5, $1, AGATHAS_ROOM

	db $0 ; signs

	db $1 ; people
	db SPRITE_BRUNO, $2 + 4, $5 + 4, $ff, $d0, $41, BRUNO + $C8, $1 ; trainer

	; warp-to
	EVENT_DISP $5, $b, $4 ; LORELEIS_ROOM
	EVENT_DISP $5, $b, $5 ; LORELEIS_ROOM
	EVENT_DISP $5, $0, $4 ; AGATHAS_ROOM
	EVENT_DISP $5, $0, $5 ; AGATHAS_ROOM

BrunoBlocks: ; 76403 (1d:6403)
	INCBIN "maps/bruno.blk"

Agatha_h: ; 0x76421 to 0x7642d (12 bytes) (id=247)
	db $0f ; tileset
	db AGATHAS_ROOM_HEIGHT, AGATHAS_ROOM_WIDTH ; dimensions (y, x)
	dw AgathaBlocks, AgathaTexts, AgathaScript ; blocks, texts, scripts
	db $00 ; connections

	dw AgathaObject ; objects

AgathaScript: ; 7642d (1d:642d)
	call AgathaScript_Unknown76443
	call EnableAutoTextBoxDrawing
	ld hl, AgathaTrainerHeaders
	ld de, Unknown_76469
	ld a, [W_AGATHACURSCRIPT]
	call ExecuteCurMapScriptInTable
	ld [W_AGATHACURSCRIPT], a
	ret
; 0x76443

AgathaScript_Unknown76443: ; 76443 (1d:6443)
	ld hl, $d126
	bit 5, [hl]
	res 5, [hl]
	ret z
	ld a, [$d865]
	bit 1, a
	jr z, .asm_76457
	ld a, $e
	jp Func_76459
.asm_76457
	ld a, $3b

; known jump sources: 76454 (1d:6454)
Func_76459: ; 76459 (1d:6459)
	ld [$d09f], a
	ld bc, $2
	ld a, $17
	jp Predef ; indirect jump to Func_ee9e (ee9e (3:6e9e))

; known jump sources: 764f5 (1d:64f5)
Func_76464: ; 76464 (1d:6464)
	xor a
	ld [W_AGATHACURSCRIPT], a
	ret
; 76469 (1d:6469)

Unknown_76469: ; 76469 (1d:6469)
dw Func_76490
dw Func_324c
dw Func_764ed
dw Func_764da
dw Func_76473

Func_76473: ; 76473 (1d:6473)
	ret
asm_76474: ; 76474 (1d:6474)
	ld hl, $ccd3
	ld a, $40
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld a, $6
	ld [$cd38], a
	call Func_3486
	ld a, $3
	ld [W_AGATHACURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Func_76490: ; 76490 (1d:6490)
	ld hl, Unknown_764d1
	call ArePlayerCoordsInArray
	jp nc, CheckFightingMapTrainers
	xor a
	ld [H_NEWLYPRESSEDBUTTONS], a
	ld [H_CURRENTPRESSEDBUTTONS], a
	ld [$ccd3], a
	ld [$cd38], a
	ld a, [W_WHICHTRADE] ; $cd3d
	cp $3
	jr c, .asm_764b4
	ld hl, $d865
	bit 6, [hl]
	set 6, [hl]
	jr z, asm_76474
.asm_764b4
	ld a, $2
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $40
	ld [$ccd3], a
	ld a, $1
	ld [$cd38], a
	call Func_3486
	ld a, $3
	ld [W_AGATHACURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Unknown_764d1: ; 764d1 (1d:64d1)
INCBIN "baserom.gbc",$764d1,$764da - $764d1

Func_764da: ; 764da (1d:64da)
	ld a, [$cd38]
	and a
	ret nz
	call Delay3
	xor a
	ld [W_JOYPADFORBIDDENBUTTONSMASK], a
	ld [W_AGATHACURSCRIPT], a
	ld [W_CURMAPSCRIPT], a
	ret

Func_764ed: ; 764ed (1d:64ed)
	call EndTrainerBattle
	ld a, [W_ISINBATTLE] ; $d057
	cp $ff
	jp z, Func_76464
	ld a, $1
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	call DisplayTextID
	ld a, $1
	ld [W_GARYCURSCRIPT], a
	ret
; 76505 (1d:6505)
AgathaTexts: ; 76505 (1d:6505)
	dw AgathaText1, AgathaText2

AgathaTrainerHeaders: ; 76509 (1d:6509)
AgathaTrainerHeader0: ; 76509 (1d:6509)
	db $1 ; flag's bit
	db ($0 << 4) ; trainer's view range
	dw $d865 ; flag's byte
	dw AgathaBeforeBattleText ; 0x6520 TextBeforeBattle
	dw AgathaAfterBattleText ; 0x652a TextAfterBattle
	dw AgathaEndBattleText ; 0x6525 TextEndBattle
	dw AgathaEndBattleText ; 0x6525 TextEndBattle
; 0x76515

db $ff

AgathaText1: ; 76516 (1d:6516)
	db $08 ; asm
	ld hl, AgathaTrainerHeader0
	call TalkToTrainer
	jp TextScriptEnd

AgathaBeforeBattleText: ; 76520 (1d:6520)
	TX_FAR _AgathaBeforeBattleText
	db $50
; 0x76520 + 5 bytes

AgathaEndBattleText: ; 76525 (1d:6525)
	TX_FAR _AgathaEndBattleText
	db $50
; 0x76525 + 5 bytes

AgathaAfterBattleText: ; 7652a (1d:652a)
	TX_FAR _AgathaAfterBattleText
	db $50
; 0x7652a + 5 bytes

AgathaText2: ; 7652f (1d:652f)
	TX_FAR _AgathaText2
	db $50
; 0x7652f + 5 bytes

AgathaObject: ; 0x76534 (size=44)
	db $0 ; border tile

	db $4 ; warps
	db $b, $4, $2, BRUNOS_ROOM
	db $b, $5, $3, BRUNOS_ROOM
	db $0, $4, $0, LANCES_ROOM
	db $0, $5, $0, LANCES_ROOM

	db $0 ; signs

	db $1 ; people
	db SPRITE_AGATHA, $2 + 4, $5 + 4, $ff, $d0, $41, AGATHA + $C8, $1 ; trainer

	; warp-to
	EVENT_DISP $5, $b, $4 ; BRUNOS_ROOM
	EVENT_DISP $5, $b, $5 ; BRUNOS_ROOM
	EVENT_DISP $5, $0, $4 ; LANCES_ROOM
	EVENT_DISP $5, $0, $5 ; LANCES_ROOM

AgathaBlocks: ; 76560 (1d:6560)
	INCBIN "maps/agatha.blk"

Unknown_7657e: ; XXX: make better (has to do with the hall of fame on the PC) ; 0x7657e
	ld hl, UnnamedText_76683
	call PrintText
	ld hl, $D730
	set 6, [hl]
	push hl
	ld a, [$CFCB]
	push af
	ld a, [$FF00+$D7]
	push af
	xor a
	ld [$FF00+$D7], a
	ld [W_SPRITEFLIPPED], a
	ld [$CFCB], a
	ld [$CD41], a
	ld [$CD42], a
	ld a, [$D5A2]
	ld b, a
	cp a, $33
	jr c, .first
	ld b, $32
	sub b
	ld [$CD42], a
.first
	ld hl, $CD42
	inc [hl]
	push bc
	ld a, [$CD41]
	ld [$CD3D], a
	ld b, BANK(Func_73b3f)
	ld hl, Func_73b3f
	call Bankswitch
	call Unknown_765e5
	pop bc
	jr c, .second
	ld hl, $CD41
	inc [hl]
	ld a, [hl]
	cp b
	jr nz, .first
.second
	pop af
	ld [$FF00+$D7], a
	pop af
	ld [$CFCB], a
	pop hl
	res 6, [hl]
	call GBPalWhiteOutWithDelay3
	call ClearScreen
	call GoPAL_SET_CF1C
	jp GBPalNormal
Unknown_765e5: ; 765e5 (1d:65e5)
	ld c, 6
.third
	push bc
	call Unknown_76610
	call WaitForTextScrollButtonPress
	ld a, [H_CURRENTPRESSEDBUTTONS]
	bit 1, a
	jr nz, .fifth
	ld hl, $CC6B
	ld de, $CC5B
	ld bc, $0050
	call CopyData
	pop bc
	ld a, [$CC5B]
	cp a, $FF
	jr z, .fourth
	dec c
	jr nz, .third
.fourth
	and a
	ret 
.fifth
	pop bc
	scf 
	ret 
Unknown_76610: ; 76610 (1d:6610)
	call GBPalWhiteOutWithDelay3
	call ClearScreen
	ld hl, $CC5B
	ld a, [hli]
	ld [$CD3D], a
	ld [$CF91], a
	ld [$D0B5], a
	ld [$CFD9], a
	ld [$CF1D], a
	ld a, [hli]
	ld [$CD3F], a
	ld de, $CD6D
	ld bc, $000B
	call CopyData
	ld b, $0B
	ld c, 0
	call GoPAL_SET
	FuncCoord 12, 5 ; $c410
	ld hl, Coord
	call GetMonHeader
	call LoadFrontSpriteByMonIndex
	call GBPalNormal
	FuncCoord 0, 13 ; $c4a4
	ld hl, Coord
	ld b, 2
	ld c, $12
	call TextBoxBorder
	FuncCoord 1, 15 ; $c4cd
	ld hl, Coord
	ld de, HallOfFameNoText
	call PlaceString
	FuncCoord 16, 15 ; $c4dc
	ld hl, Coord
	ld de, $CD42
	ld bc, $0103
	call PrintNumber
	ld b, BANK(Func_702f0)
	ld hl, Func_702f0
	jp Bankswitch

HallOfFameNoText: ; 76670 (1d:6670)
	db "HALL OF FAME No   @"

UnnamedText_76683: ; 76683 (1d:6683)
	TX_FAR _UnnamedText_76683
	db $50
; 0x76683 + 5 bytes

HiddenItems: ; 76688 (1d:6688)
	ld hl, HiddenItemCoords
	call Label76857
	ld [$cd41], a
	ld hl, $d6f0
	ld a, [$cd41]
	ld c, a
	ld b, $2
	ld a, $10
	call Predef
	ld a, c
	and a
	ret nz
	call EnableAutoTextBoxDrawing
	ld a, $1
	ld [$cc3c], a
	ld a, [$cd3d] ; item ID
	ld [$d11e], a
	call GetItemName
	ld a, $24
	jp Func_3ef5

HiddenItemCoords: ; 766b8 (1d:66b8)
; map ID, then coords
	db VIRIDIAN_FOREST,$12,$01
	db VIRIDIAN_FOREST,$2a,$10
	db MT_MOON_3,$0c,$12
	db ROUTE_25,$03,$26
	db ROUTE_9,$07,$0e
	db SS_ANNE_6,$09,$0d
	db SS_ANNE_10,$01,$03
	db ROUTE_10,$11,$09
	db ROUTE_10,$35,$10
	db ROCKET_HIDEOUT_1,$0f,$15
	db ROCKET_HIDEOUT_3,$11,$1b
	db ROCKET_HIDEOUT_4,$01,$19
	db POKEMONTOWER_5,$0c,$04
	db ROUTE_13,$0e,$01
	db ROUTE_13,$0d,$10
	db MANSION_4,$09,$01
	db SAFARIZONEENTRANCE,$01,$0a
	db SAFARI_ZONE_WEST,$05,$06
	db SILPH_CO_5F,$03,$0c
	db SILPH_CO_9F,$0f,$02
	db COPYCATS_HOUSE_2F,$01,$01
	db UNKNOWN_DUNGEON_1,$0b,$0e
	db UNKNOWN_DUNGEON_3,$03,$1b
	db POWER_PLANT,$10,$11
	db POWER_PLANT,$01,$0c
	db SEAFOAM_ISLANDS_3,$0f,$0f
	db SEAFOAM_ISLANDS_5,$11,$19
	db MANSION_1,$10,$08
	db MANSION_3,$09,$01
	db ROUTE_23,$2c,$09
	db ROUTE_23,$46,$13
	db ROUTE_23,$5a,$08
	db VICTORY_ROAD_2,$02,$05
	db VICTORY_ROAD_2,$07,$1a
	db $6f,$0b,$0e
	db VIRIDIAN_CITY,$04,$0e
	db ROUTE_11,$05,$30
	db ROUTE_12,$3f,$02
	db ROUTE_17,$0e,$0f
	db ROUTE_17,$2d,$08
	db ROUTE_17,$48,$11
	db ROUTE_17,$5b,$04
	db ROUTE_17,$79,$08
	db UNDERGROUND_PATH_NS,$04,$03
	db UNDERGROUND_PATH_NS,$22,$04
	db UNDERGROUND_PATH_WE,$02,$0c
	db UNDERGROUND_PATH_WE,$05,$15
	db CELADON_CITY,$0f,$30
	db ROUTE_25,$01,$0a
	db MT_MOON_3,$09,$21
	db SEAFOAM_ISLANDS_4,$10,$09
	db VERMILION_CITY,$0b,$0e
	db CERULEAN_CITY,$08,$0f
	db ROUTE_4,$03,$28
	db $ff

FoundHiddenItemText: ; 7675b (1d:675b)
; XXX where is the pointer to this?
	TX_FAR UnnamedText_894d0
	db $8
	ld a, [$cd3d] ; item ID
	ld b, a
	ld c, 1
	call GiveItem
	jr nc, .BagFull
	ld hl, $d6f0
	ld a, [$cd41]
	ld c, a
	ld b, $1
	ld a, $10
	call Predef
	ld a, $89
	call PlaySoundWaitForCurrent ; play sound
	call WaitForSoundToFinish ; wait for sound to finish playing
	jp TextScriptEnd
.BagFull
	call WaitForTextScrollButtonPress ; wait for button press
	xor a
	ld [$cc3c], a
	ld hl, HiddenItemBagFullText
	call PrintText
	jp TextScriptEnd

HiddenItemBagFullText: ; 76794 (1d:6794)
	TX_FAR _UnnamedText_76794
	db $50

HiddenCoins: ; 76799 (1d:6799)
	ld b, COIN_CASE
	ld a, $1c
	call Predef
	ld a, b
	and a
	ret z
	ld hl, HiddenCoinCoords
	call Label76857
	ld [$cd41], a
	ld hl, $d6fe
	ld a, [$cd41]
	ld c, a
	ld b, $2
	ld a, $10
	call Predef
	ld a, c
	and a
	ret nz
	xor a
	ld [$ff00+$9f], a
	ld [$ff00+$a0], a
	ld [$ff00+$a1], a
	ld a, [$cd3d]
	sub COIN
	cp 10
	jr z, .bcd10
	cp 20
	jr z, .bcd20
	cp 40
	jr z, .bcd20
	jr .bcd100
.bcd10
	ld a, $10
	ld [$ff00+$a1], a
	jr .bcddone
.bcd20
	ld a, $20
	ld [$ff00+$a1], a
	jr .bcddone
.bcd40 ; due to a typo, this is never used
	ld a, $40
	ld [$ff00+$a1], a
	jr .bcddone
.bcd100
	ld a, $1
	ld [$ff00+$a0], a
.bcddone
	ld de, $d5a5
	ld hl, $ffa1
	ld c, $2
	ld a, $b
	call Predef
	ld hl, $d6fe
	ld a, [$cd41]
	ld c, a
	ld b, $1
	ld a, $10
	call Predef
	call EnableAutoTextBoxDrawing
	ld a, [W_PLAYERCOINS1]
	cp $99
	jr nz, .RoomInCoinCase
	ld a, [W_PLAYERCOINS2]
	cp $99
	jr nz, .RoomInCoinCase
	ld a, $2c
	jr .done
.RoomInCoinCase
	ld a, $2b
.done
	jp Func_3ef5

HiddenCoinCoords: ; 76822 (1d:6822)
	db GAME_CORNER,$08,$00
	db GAME_CORNER,$10,$01
	db GAME_CORNER,$0b,$03
	db GAME_CORNER,$0e,$03
	db GAME_CORNER,$0c,$04
	db GAME_CORNER,$0c,$09
	db GAME_CORNER,$0f,$09
	db GAME_CORNER,$0e,$10
	db GAME_CORNER,$10,$0a
	db GAME_CORNER,$07,$0b
	db GAME_CORNER,$08,$0f
	db GAME_CORNER,$0f,$0c
	db $ff

FoundHiddenCoinsText: ; 76847 (1d:6847)
	TX_FAR _FoundHiddenCoinsText
	db $10,"@"

DroppedHiddenCoinsText: ; 7684d (1d:684d)
	TX_FAR _FoundHiddenCoins2Text
	db $10
	TX_FAR _DroppedHiddenCoinsText
	db $50

Label76857: ; 76857 (1d:6857)
	ld a, [$cd40]
	ld d, a
	ld a, [$cd41]
	ld e, a
	ld a, [W_CURMAP]
	ld b, a
	ld c, $ff
.loop
	inc c
	ld a, [hli]
	cp $ff ; end of the list?
	ret z  ; if so, we're done here
	cp b
	jr nz, .asm_76877 ; 0x7686b $a
	ld a, [hli]
	cp d
	jr nz, .asm_76878 ; 0x7686f $7
	ld a, [hli]
	cp e
	jr nz, .loop
	ld a, c
	ret
.asm_76877
	inc hl
.asm_76878
	inc hl
	jr .loop

SECTION "bank1E",ROMX,BANK[$1E]

; Draws a "frame block". Frame blocks are blocks of tiles that are put
; together to form frames in battle animations.
DrawFrameBlock: ; 78000 (1e:4000)
	ld l,c
	ld h,b
	ld a,[hli]
	ld [W_NUMFBTILES],a
	ld a,[W_FBDESTADDR + 1]
	ld e,a
	ld a,[W_FBDESTADDR]
	ld d,a
	xor a
	ld [W_FBTILECOUNTER],a ; loop counter
.loop
	ld a,[W_FBTILECOUNTER]
	inc a
	ld [W_FBTILECOUNTER],a
	ld a,[W_SUBANIMTRANSFORM]
	dec a
	jr z,.flipHorizontalAndVertical   ; 1
	dec a
	jp z,.flipHorizontalTranslateDown ; 2
	dec a
	jr z,.flipBaseCoords              ; 3
.noTransformation
	ld a,[W_BASECOORDY]
	add [hl]
	ld [de],a ; store Y
	inc hl
	inc de
	ld a,[W_BASECOORDX]
	jr .finishCopying
.flipBaseCoords
	ld a,[W_BASECOORDY]
	ld b,a
	ld a,136
	sub b ; flip Y base coordinate
	add [hl] ; Y offset
	ld [de],a ; store Y
	inc hl
	inc de
	ld a,[W_BASECOORDX]
	ld b,a
	ld a,168
	sub b ; flip X base coordinate
.finishCopying ; finish copying values to OAM (when [W_SUBANIMTRANSFORM] not 1 or 2)
	add [hl] ; X offset
	ld [de],a ; store X
	inc hl
	inc de
	ld a,[hli]
	add a,$31 ; base tile ID for battle animations
	ld [de],a ; store tile ID
	inc de
	ld a,[hli]
	ld [de],a ; store flags
	inc de
	jp .nextTile
.flipHorizontalAndVertical
	ld a,[W_BASECOORDY]
	add [hl] ; Y offset
	ld b,a
	ld a,136
	sub b ; flip Y coordinate
	ld [de],a ; store Y
	inc hl
	inc de
	ld a,[W_BASECOORDX]
	add [hl] ; X offset
	ld b,a
	ld a,168
	sub b ; flip X coordinate
	ld [de],a ; store X
	inc hl
	inc de
	ld a,[hli]
	add a,$31 ; base tile ID for battle animations
	ld [de],a ; store tile ID
	inc de
; toggle horizontal and vertical flip
	ld a,[hli] ; flags
	and a
	ld b,OAM_VFLIP | OAM_HFLIP
	jr z,.storeFlags1
	cp a,OAM_HFLIP
	ld b,OAM_VFLIP
	jr z,.storeFlags1
	cp a,OAM_VFLIP
	ld b,OAM_HFLIP
	jr z,.storeFlags1
	ld b,0
.storeFlags1
	ld a,b
	ld [de],a
	inc de
	jp .nextTile
.flipHorizontalTranslateDown
	ld a,[W_BASECOORDY]
	add [hl]
	add a,40 ; translate Y coordinate downwards
	ld [de],a ; store Y
	inc hl
	inc de
	ld a,[W_BASECOORDX]
	add [hl]
	ld b,a
	ld a,168
	sub b ; flip X coordinate
	ld [de],a ; store X
	inc hl
	inc de
	ld a,[hli]
	add a,$31 ; base tile ID for battle animations
	ld [de],a ; store tile ID
	inc de
	ld a,[hli]
	bit 5,a ; is horizontal flip enabled?
	jr nz,.disableHorizontalFlip
.enableHorizontalFlip
	set 5,a
	jr .storeFlags2
.disableHorizontalFlip
	res 5,a
.storeFlags2
	ld [de],a
	inc de
.nextTile
	ld a,[W_FBTILECOUNTER]
	ld c,a
	ld a,[W_NUMFBTILES]
	cp c
	jp nz,.loop ; go back up if there are more tiles to draw
.afterDrawingTiles
	ld a,[W_FBMODE]
	cp a,2
	jr z,.advanceFrameBlockDestAddr; skip delay and don't clean OAM buffer
	ld a,[W_SUBANIMFRAMEDELAY]
	ld c,a
	call DelayFrames
	ld a,[W_FBMODE]
	cp a,3
	jr z,.advanceFrameBlockDestAddr ; skip cleaning OAM buffer
	cp a,4
	jr z,.done ; skip cleaning OAM buffer and don't advance the frame block destination address
	ld a,[W_ANIMATIONID]
	cp a,GROWL
	jr z,.resetFrameBlockDestAddr
	call AnimationCleanOAM
.resetFrameBlockDestAddr
	ld hl,W_OAMBUFFER ; OAM buffer
	ld a,l
	ld [W_FBDESTADDR + 1],a
	ld a,h
	ld [W_FBDESTADDR],a ; set destination address to beginning of OAM buffer
	ret
.advanceFrameBlockDestAddr
	ld a,e
	ld [W_FBDESTADDR + 1],a
	ld a,d
	ld [W_FBDESTADDR],a
.done
	ret

PlayAnimation: ; 780f1 (1e:40f1)
	xor a
	ld [$FF8B],a
	ld [W_SUBANIMTRANSFORM],a
	ld a,[W_ANIMATIONID] ; get animation number
	dec a
	ld l,a
	ld h,0
	add hl,hl
	ld de,Unknown_7a07d  ; $607d ; animation command stream pointers
	add hl,de
	ld a,[hli]
	ld h,[hl]
	ld l,a
.animationLoop
	ld a,[hli]
	cp a,$FF
	jr z,.AnimationOver
	cp a,$C0 ; is this subanimation or a special effect?
	jr c,.playSubanimation
.doSpecialEffect
	ld c,a
	ld de,SpecialEffectPointers
.searchSpecialEffectTableLoop
	ld a,[de]
	cp c
	jr z,.foundMatch
	inc de
	inc de
	inc de
	jr .searchSpecialEffectTableLoop
.foundMatch
	ld a,[hli]
	cp a,$FF ; is there a sound to play?
	jr z,.skipPlayingSound
	ld [W_ANIMSOUNDID],a ; store sound
	push hl
	push de
	call Func586F
	call PlaySound
	pop de
	pop hl
.skipPlayingSound
	push hl
	inc de
	ld a,[de]
	ld l,a
	inc de
	ld a,[de]
	ld h,a
	ld de,.nextAnimationCommand
	push de
	jp [hl] ; jump to special effect function
.playSubanimation
	ld c,a
	and a,63
	ld [W_SUBANIMFRAMEDELAY],a
	xor a
	sla c
	rla
	sla c
	rla
	ld [$D09F],a ; tile select
	ld a,[hli] ; sound
	ld [W_ANIMSOUNDID],a ; store sound
	ld a,[hli] ; subanimation ID
	ld c,l
	ld b,h
	ld l,a
	ld h,0
	add hl,hl
	ld de,Unknown_7a76d  ; $676d ; subanimation pointer table
	add hl,de
	ld a,l
	ld [W_SUBANIMADDRPTR],a
	ld a,h
	ld [W_SUBANIMADDRPTR + 1],a
	ld l,c
	ld h,b
	push hl
	ld a,[rOBP0]
	push af
	ld a,[$CC79]
	ld [rOBP0],a
	call LoadAnimationTileset
	call LoadSubanimation
	call PlaySubanimation
	pop af
	ld [rOBP0],a
.nextAnimationCommand
	pop hl
	jr .animationLoop
.AnimationOver ; 417B
	ret

LoadSubanimation: ; 7817c (1e:417c)
	ld a,[W_SUBANIMADDRPTR + 1]
	ld h,a
	ld a,[W_SUBANIMADDRPTR]
	ld l,a
	ld a,[hli]
	ld e,a
	ld a,[hl]
	ld d,a ; de = address of subanimation
	ld a,[de]
	ld b,a
	and a,31
	ld [W_SUBANIMCOUNTER],a ; number of frame blocks
	ld a,b
	and a,%11100000
	cp a,5 << 5 ; is subanimation type 5?
	jr nz,.isNotType5
.isType5
	call GetSubanimationTransform2
	jr .saveTransformation
.isNotType5
	call GetSubanimationTransform1
.saveTransformation
; place the upper 3 bits of a into bits 0-2 of a before storing
	srl a
	swap a
	ld [W_SUBANIMTRANSFORM],a
	cp a,4 ; is the animation reversed?
	ld hl,0
	jr nz,.storeSubentryAddr
; if the animation is reversed, then place the initial subentry address at the end of the list of subentries
	ld a,[W_SUBANIMCOUNTER]
	dec a
	ld bc,3
.loop
	add hl,bc
	dec a
	jr nz,.loop
.storeSubentryAddr
	inc de
	add hl,de
	ld a,l
	ld [W_SUBANIMSUBENTRYADDR],a
	ld a,h
	ld [W_SUBANIMSUBENTRYADDR + 1],a
	ret

; called if the subanimation type is not 5
; sets the transform to 0 (i.e. no transform) if it's the player's turn
; sets the transform to the subanimation type if it's the enemy's turn
GetSubanimationTransform1: ; 781c2 (1e:41c2)
	ld b,a
	ld a,[H_WHOSETURN]
	and a
	ld a,b
	ret nz
	xor a
	ret

; called if the subanimation type is 5
; sets the transform to 2 (i.e. horizontal and vertical flip) if it's the player's turn
; sets the transform to 0 (i.e. no transform) if it's the enemy's turn
GetSubanimationTransform2: ; 781ca (1e:41ca)
	ld a,[H_WHOSETURN]
	and a
	ld a,2 << 5
	ret z
	xor a
	ret

; loads tile patterns for battle animations
LoadAnimationTileset: ; 781d2 (1e:41d2)
	ld a,[$D09F] ; tileset select
	add a
	add a
	ld hl,AnimationTilesetPointers
	ld e,a
	ld d,0
	add hl,de
	ld a,[hli]
	ld [$D07D],a ; number of tiles
	ld a,[hli]
	ld e,a
	ld a,[hl]
	ld d,a ; de = address of tileset
	ld hl,$8310 ; destination address in VRAM
	ld b,$1E ; ROM bank
	ld a,[$D07D]
	ld c,a ; number of tiles
	jp CopyVideoData ; load tileset

AnimationTilesetPointers: ; 781f2 (1e:41f2)
db 79 ; number of tiles
dw AnimationTileset1
db $FF

db 79 ; number of tiles
dw AnimationTileset2
db $FF

db 64 ; number of tiles
dw AnimationTileset1
db $FF

AnimationTileset1: ; 781fe (1e:41fe)
INCBIN "baserom.gbc",$781fe,$786ee - $781fe

AnimationTileset2: ; 786ee (1e:46ee)
INCBIN "baserom.gbc",$786ee,$78bde - $786ee

IF _RED
	INCBIN "gfx/red/slotmachine2.2bpp"
ENDC
IF _BLUE
	INCBIN "gfx/blue/slotmachine2.2bpp"
ENDC

MoveAnimation: ; 78d5e (1e:4d5e)
	push hl
	push de
	push bc
	push af
	call WaitForSoundToFinish
	call Func_78e23
	ld a,[W_ANIMATIONID]
	and a
	jr z,.AnimationFinished

	; if throwing a Poké Ball, skip the regular animation code
	cp a,TOSS_ANIM
	jr nz,.MoveAnimation
	ld de,.AnimationFinished
	push de
	jp TossBallAnimation

.MoveAnimation
	; check if battle animations are disabled in the options
	ld a,[$D355]
	bit 7,a
	jr nz,.AnimationsDisabled
	call ShareMoveAnimations
	call PlayAnimation
	jr .next4
.AnimationsDisabled
	ld c,30
	call DelayFrames
.next4
	call Function4DBD ; reload pic and flash the pic in and out (to show damage)
.AnimationFinished
	call WaitForSoundToFinish
	xor a
	ld [$D096],a
	ld [$D09B],a
	ld [$D08B],a
	dec a
	ld [$CF07],a
	pop af
	pop bc
	pop de
	pop hl
	ret

ShareMoveAnimations: ; 78da6 (1e:4da6)
; some moves just reuse animations from status conditions
	ld a,[H_WHOSETURN]
	and a
	ret z

	; opponent’s turn

	ld a,[W_ANIMATIONID]

	cp a,AMNESIA
	ld b,CONF_ANIM
	jr z,.Replace

	cp a,REST
	ld b,SLP_ANIM
	ret nz

.Replace
	ld a,b
	ld [W_ANIMATIONID],a
	ret

Function4DBD: ; 78dbd (1e:4dbd)
	ld a,[$CC5B]
	and a
	ret z
	dec a
	add a
	ld c,a
	ld b,0
	ld hl,Pointer4DCF
	add hl,bc
	ld a,[hli]
	ld h,[hl]
	ld l,a
	jp [hl]

Pointer4DCF: ; 78dcf (1e:4dcf)
	dw $4DDB,$4DE3,$4DEB,$4DF0,$4DF6,$4DFE

	call Func_79e6a
	ld b, $8
	jp Func_79209
	call Func_79e6a
	ld b, $8
	jp Func_79210
	ld bc, $602
	jr .asm_78e01
	call Func_79e6a
	jp Func_79369
	call Func_79e6a
	ld b, $2
	jp Func_79210
	ld bc, $302
.asm_78e01
	push bc
	push bc
.asm_78e03
	ld a, [rWX] ; $FF00+$4b
	inc a
	ld [rWX], a ; $FF00+$4b
	ld c, $2
	call DelayFrames
	dec b
	jr nz, .asm_78e03
	pop bc
.asm_78e11
	ld a, [rWX] ; $FF00+$4b
	dec a
	ld [rWX], a ; $FF00+$4b
	ld c, $2
	call DelayFrames
	dec b
	jr nz, .asm_78e11
	pop bc
	dec c
	jr nz, .asm_78e01
	ret

; known jump sources: 78d65 (1e:4d65)
Func_78e23: ; 78e23 (1e:4e23)
	ld a, [$cf1b]
	and a
	ld a, $e4
	jr z, .asm_78e47
	ld a, $f0
	ld [$cc79], a
	ld b, $e4
	ld a, [W_ANIMATIONID] ; $d07c
	cp $aa
	jr c, .asm_78e3f
	cp $ae
	jr nc, .asm_78e3f
	ld b, $f0
.asm_78e3f
	ld a, b
	ld [rOBP0], a ; $FF00+$48
	ld a, $6c
	ld [rOBP1], a ; $FF00+$49
	ret
.asm_78e47
	ld a, $e4
	ld [$cc79], a
	ld [rOBP0], a ; $FF00+$48
	ld a, $6c
	ld [rOBP1], a ; $FF00+$49
	ret
; 78e53 (1e:4e53)
PlaySubanimation: ; 78e53 (1e:4e53)
	ld a,[W_ANIMSOUNDID]
	cp a,$FF
	jr z,.skipPlayingSound
	call Func586F
	call PlaySound ; play sound effect
.skipPlayingSound
	ld hl,W_OAMBUFFER ; base address of OAM buffer
	ld a,l
	ld [W_FBDESTADDR + 1],a
	ld a,h
	ld [W_FBDESTADDR],a
	ld a,[W_SUBANIMSUBENTRYADDR + 1]
	ld h,a
	ld a,[W_SUBANIMSUBENTRYADDR]
	ld l,a
.loop
	push hl
	ld c,[hl] ; frame block ID
	ld b,0
	ld hl,PointerTable6F74
	add hl,bc
	add hl,bc
	ld a,[hli]
	ld c,a
	ld a,[hli]
	ld b,a
	pop hl
	inc hl
	push hl
	ld e,[hl] ; base coordinate ID
	ld d,0
	ld hl,Unknown_7bc85  ; $7c85 ; base coordinate table
	add hl,de
	add hl,de
	ld a,[hli]
	ld [W_BASECOORDY],a
	ld a,[hl]
	ld [W_BASECOORDX],a
	pop hl
	inc hl
	ld a,[hl] ; frame block mode
	ld [W_FBMODE],a
	call DrawFrameBlock
	call DoSpecialEffectByAnimationId ; run animation-specific function (if there is one)
	ld a,[W_SUBANIMCOUNTER]
	dec a
	ld [W_SUBANIMCOUNTER],a
	ret z
	ld a,[W_SUBANIMSUBENTRYADDR + 1]
	ld h,a
	ld a,[W_SUBANIMSUBENTRYADDR]
	ld l,a
	ld a,[W_SUBANIMTRANSFORM]
	cp a,4 ; is the animation reversed?
	ld bc,3
	jr nz,.nextSubanimationSubentry
	ld bc,-3
.nextSubanimationSubentry
	add hl,bc
	ld a,h
	ld [W_SUBANIMSUBENTRYADDR + 1],a
	ld a,l
	ld [W_SUBANIMSUBENTRYADDR],a
	jp .loop

AnimationCleanOAM: ; 78ec8 (1e:4ec8)
	push hl
	push de
	push bc
	push af
	call DelayFrame
	call CleanLCD_OAM
	pop af
	pop bc
	pop de
	pop hl
	ret

; this runs after each frame block is drawn in a subanimation
; it runs a particular special effect based on the animation ID
DoSpecialEffectByAnimationId: ; 78ed7 (1e:4ed7)
	push hl
	push de
	push bc
	ld a,[W_ANIMATIONID]
	ld hl,AnimationIdSpecialEffects
	ld de,3
	call IsInArray
	jr nc,.done
	inc hl
	ld a,[hli]
	ld h,[hl]
	ld l,a
	ld de,.done
	push de
	jp [hl]
.done
	pop bc
	pop de
	pop hl
	ret

; Format: Animation ID (1 byte), Address (2 bytes)
AnimationIdSpecialEffects: ; 78ef5 (1e:4ef5)
	db MEGA_PUNCH
	dw AnimationFlashScreen

	db GUILLOTINE
	dw AnimationFlashScreen

	db MEGA_KICK
	dw AnimationFlashScreen

	db HEADBUTT
	dw AnimationFlashScreen

	db TAIL_WHIP
	dw Func50D0

	db GROWL
	dw DoGrowlSpecialEffects

	db DISABLE
	dw AnimationFlashScreen

	db BLIZZARD
	dw DoBlizzardSpecialEffects

	db BUBBLEBEAM
	dw AnimationFlashScreen

	db HYPER_BEAM
	dw FlashScreenEveryFourFrameBlocks

	db THUNDERBOLT
	dw FlashScreenEveryEightFrameBlocks

	db REFLECT
	dw AnimationFlashScreen

	db SELFDESTRUCT
	dw DoExplodeSpecialEffects

	db SPORE
	dw AnimationFlashScreen

	db EXPLOSION
	dw DoExplodeSpecialEffects

	db ROCK_SLIDE
	dw DoRockSlideSpecialEffects

	db $AA
	dw Func5041

	db $AB
	dw Func504C

	db $AC
	dw Func507C

	db TOSS_ANIM
	dw DoBallTossSpecialEffects

	db SHAKE_ANIM
	dw DoBallShakeSpecialEffects

	db POOF_ANIM
	dw DoPoofSpecialEffects

	db GREATTOSS_ANIM
	dw DoBallTossSpecialEffects

	db ULTRATOSS_ANIM
	dw DoBallTossSpecialEffects

	db $FF ; terminator

DoBallTossSpecialEffects: ; 78f3e (1e:4f3e)
	ld a,[$CF91]
	cp a,3 ; is it a Master Ball or Ultra Ball?
	jr nc,.skipFlashingEffect
.flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball
	ld a,[rOBP0]
	xor a,%00111100 ; complement colors 1 and 2
	ld [rOBP0],a
.skipFlashingEffect
	ld a,[W_SUBANIMCOUNTER]
	cp a,11 ; is it the beginning of the subanimation?
	jr nz,.skipPlayingSound
; if it is the beginning of the subanimation, play a sound
	ld a,$91
	call PlaySound ; play sound
.skipPlayingSound
	ld a,[W_ISINBATTLE]
	cp a,02 ; is it a trainer battle?
	jr z,.isTrainerBattle
	ld a,[$d11e]
	cp a,$10 ; is the enemy pokemon the Ghost Marowak?
	ret nz
; if the enemy pokemon is the Ghost Marowak, make it dodge during the last 3 frames
	ld a,[W_SUBANIMCOUNTER]
	cp a,3
	jr z,.moveGhostMarowakLeft
	cp a,2
	jr z,.moveGhostMarowakLeft
	cp a,1
	ret nz
.moveGhostMarowakLeft
	FuncCoord 17,0
	ld hl,Coord
	ld de,20
	ld bc,$0707 ; 7 rows and 7 columns
.loop
	push hl
	push bc
	call Func_79862 ; move row of tiles left
	pop bc
	pop hl
	add hl,de
	dec b
	jr nz,.loop
	ld a,%00001000
	ld [$ff10],a ; Channel 1 sweep register
	ret
.isTrainerBattle ; if it's a trainer battle, shorten the animation by one frame
	ld a,[W_SUBANIMCOUNTER]
	cp a,3
	ret nz
	dec a
	ld [W_SUBANIMCOUNTER],a
	ret

DoBallShakeSpecialEffects: ; 78f96 (1e:4f96)
	ld a,[W_SUBANIMCOUNTER]
	cp a,4 ; is it the beginning of a shake?
	jr nz,.skipPlayingSound
; if it is the beginning of a shake, play a sound and wait 2/3 of a second
	ld a,$8c
	call PlaySound ; play sound
	ld c,40
	call DelayFrames
.skipPlayingSound
	ld a,[W_SUBANIMCOUNTER]
	dec a
	ret nz
; if it's the end of the ball shaking subanimation, check if more shakes are left and restart the subanimation
	ld a,[$cd3d] ; number of shakes
	dec a ; decrement number of shakes
	ld [$cd3d],a
	ret z
; if there are shakes left, restart the subanimation
	ld a,[W_SUBANIMSUBENTRYADDR]
	ld l,a
	ld a,[W_SUBANIMSUBENTRYADDR + 1]
	ld h,a
	ld de,-(4 * 3) ; 4 subentries and 3 bytes per subentry
	add hl,de
	ld a,l
	ld [W_SUBANIMSUBENTRYADDR],a
	ld a,h
	ld [W_SUBANIMSUBENTRYADDR + 1],a
	ld a,5 ; number of subentries in the ball shaking subanimation plus one
	ld [W_SUBANIMCOUNTER],a
	ret

; plays a sound after the second frame of the poof animation
DoPoofSpecialEffects: ; 78fce (1e:4fce)
	ld a,[W_SUBANIMCOUNTER]
	cp a,5
	ret nz
	ld a,$93
	jp PlaySound

DoRockSlideSpecialEffects: ; 78fd9 (1e:4fd9)
	ld a,[W_SUBANIMCOUNTER]
	cp a,12
	ret nc
	cp a,8
	jr nc,.shakeScreen
	cp a,1
	jp z,AnimationFlashScreen ; if it's the end of the subanimation, flash the screen
	ret
; if the subaninmation counter is between 8 and 11, shake the screen horizontally and vertically
.shakeScreen
	ld b,1
	ld a,$24
	call Predef ; shake horizontally
	ld b,1
	ld a,$21
	jp Predef ; shake vertically

FlashScreenEveryEightFrameBlocks: ; 78ff7 (1e:4ff7)
	ld a,[W_SUBANIMCOUNTER]
	and a,7 ; is the subanimation counter exactly 8?
	call z,AnimationFlashScreen ; if so, flash the screen
	ret

; flashes the screen if the subanimation counter is divisible by 4
FlashScreenEveryFourFrameBlocks: ; 79000 (1e:5000)
	ld a,[W_SUBANIMCOUNTER]
	and a,3
	call z,AnimationFlashScreen
	ret

; used for Explosion and Selfdestruct
DoExplodeSpecialEffects: ; 79009 (1e:5009)
	ld a,[W_SUBANIMCOUNTER]
	cp a,1 ; is it the end of the subanimation?
	jr nz,FlashScreenEveryFourFrameBlocks
; if it's the end of the subanimation, make the attacking pokemon disappear
	FuncCoord 1, 5 ; $c405
	ld hl,Coord
	jp Func_79801 ; make pokemon disappear

; flashes the screen when subanimation counter is 1 modulo 4
DoBlizzardSpecialEffects: ; 79016 (1e:5016)
	ld a,[W_SUBANIMCOUNTER]
	cp a,13
	jp z,AnimationFlashScreen
	cp a,9
	jp z,AnimationFlashScreen
	cp a,5
	jp z,AnimationFlashScreen
	cp a,1
	jp z,AnimationFlashScreen
	ret

; flashes the screen at 3 points in the subanimation
; XXX is this unused?
Func502E: ; 7902e (1e:502e)
	ld a,[W_SUBANIMCOUNTER]
	cp a,14
	jp z,AnimationFlashScreen
	cp a,9
	jp z,AnimationFlashScreen
	cp a,2
	jp z,AnimationFlashScreen
	ret

; function to make the pokemon disappear at the beginning of the animation
; XXX probably a trade-related animation
Func5041: ; 79041 (1e:5041)
	ld a,[W_SUBANIMCOUNTER]
	cp a,6
	ret nz
	ld a,$2F
	jp Func_7980c ; make pokemon disappear

; function to make a shaking pokeball jump up at the end of the animation
; XXX probably a trade-related animation
Func504C: ; 7904c (1e:504c)
	ld a,[W_SUBANIMCOUNTER]
	cp a,1
	ret nz
; if it's the end of the animation, make the ball jump up
	ld de,BallMoveDistances1
.loop
	ld hl,W_OAMBUFFER ; OAM buffer
	ld bc,4
.innerLoop
	ld a,[de]
	cp a,$ff
	jr z,.done
	add [hl] ; add to Y value of OAM entry
	ld [hl],a
	add hl,bc
	ld a,l
	cp a,4 * 4 ; there are 4 entries, each 4 bytes
	jr nz,.innerLoop
	inc de
	push bc
	call Delay3
	pop bc
	jr .loop
.done
	call AnimationCleanOAM
	ld a,$98
	jp PlaySound ; play sound

BallMoveDistances1: ; 79078 (1e:5078)
db -12,-12,-8
db $ff ; terminator

; function to make the pokeball jump up
; XXX probably a trade-related animation
Func507C ; 507C
	ld de,BallMoveDistances2
.loop
	ld hl,W_OAMBUFFER ; OAM buffer
	ld bc,4
.innerLoop
	ld a,[de]
	cp a,$ff
	jp z,ClearScreen
	add [hl]
	ld [hl],a
	add hl,bc
	ld a,l
	cp a,4 * 4 ; there are 4 entries, each 4 bytes
	jr nz,.innerLoop
	inc de
	push de
	ld a,[de]
	cp a,12
	jr z,.playSound
	cp a,$ff
	jr nz,.skipPlayingSound
.playSound ; play sound if next move distance is 12 or this is the last one
	ld a,$ae
	call PlaySound
.skipPlayingSound
	push bc
	ld c,5
	call DelayFrames
	pop bc
	ld a,[$ffae] ; background scroll X
	sub a,8 ; scroll to the left
	ld [$ffae],a
	pop de
	jr .loop

BallMoveDistances2: ; 790b3 (1e:50b3)
db 11,12,-12,-7,7,12,-8,8
db $ff ; terminator

; this function copies the current musical note graphic
; so that there are two musical notes flying towards the defending pokemon
DoGrowlSpecialEffects: ; 790bc (1e:50bc)
	ld hl,W_OAMBUFFER ; OAM buffer
	ld de,$c310
	ld bc,$10
	call CopyData ; copy the musical note graphic
	ld a,[W_SUBANIMCOUNTER]
	dec a
	call z,AnimationCleanOAM ; clean up at the end of the subanimation
	ret

; this is associated with Tail Whip, but Tail Whip doesn't use any subanimations
; XXX why is this here?
Func50D0: ; 790d0 (1e:50d0)
	ld a,1
	ld [W_SUBANIMCOUNTER],a
	ld c,20
	jp DelayFrames

; Format: Special Effect ID (1 byte), Address (2 bytes)
SpecialEffectPointers: ; 790da (1e:50da)
	db $FE
	dw AnimationFlashScreen
	db $FD
	dw $51D6
	db $FC
	dw $51EA
	db $FB
	dw $520E
	db $FA
	dw $5215
	db $F9
	dw $51DB
	db $F8
	dw AnimationFlashScreenLong
	db $F7
	dw $527A
	db $F6
	dw $5297
	db $F5
	dw $5389
	db $F4
	dw $52AF
	db $F3
	dw $536F
	db $F2
	dw $53F9
	db $F1
	dw $5415
	db $F0
	dw $51F4
	db $EF
	dw $5801
	db $EE
	dw $54A1
	db $ED
	dw $54F9
	db $EC
	dw $5566
	db $EB
	dw $577A
	db $EA
	dw $559F
	db $E9
	dw $55C9
	db $E8
	dw $5787
	db $E7
	dw $5C74
	db $E6
	dw $5C8A
	db $E5
	dw $5645
	db $E4
	dw $5D77
	db $E3
	dw $5D77
	db $E2
	dw $5424
	db $E1
	dw AnimationDelay10
	db $E0
	dw $5398
	db $DF
	dw $57D8
	db $DE
	dw $5369
	db $DD
	dw $539E
	db $DC
	dw $53AB
	db $DB
	dw $52B9
	db $DA
	dw $53B1
	db $D9
	dw $56E0
	db $D8
	dw $5666
	db $FF

AnimationDelay10: ; 79150 (1e:5150)
	ld c,10
	jp DelayFrames

; calls a function with the turn flipped from player to enemy or vice versa
; input - hl - address of function to call
CallWithTurnFlipped: ; 79155 (1e:5155)
	ld a,[H_WHOSETURN]
	push af
	xor a,1
	ld [H_WHOSETURN],a
	ld de,.returnAddress
	push de
	jp [hl]
.returnAddress
	pop af
	ld [H_WHOSETURN],a
	ret 

; flashes the screen for an extended period (48 frames)
AnimationFlashScreenLong: ; 79165 (1e:5165)
	ld a,3 ; cycle through the palettes 3 times
	ld [$D08A],a
	ld a,[$cf1b] ; running on SGB?
	and a
	ld hl,FlashScreenLongMonochrome
	jr z,.loop
	ld hl,FlashScreenLongSGB
.loop
	push hl
.innerLoop
	ld a,[hli]
	cp a,$01 ; is it the end of the palettes?
	jr z,.endOfPalettes
	ld [rBGP],a
	call FlashScreenLongDelay
	jr .innerLoop
.endOfPalettes
	ld a,[$D08A]
	dec a
	ld [$D08A],a
	pop hl
	jr nz,.loop
	ret 

; BG palettes
FlashScreenLongMonochrome: ; 7918e (1e:518e)
db %11111001 ; 3, 3, 2, 1
db %11111110 ; 3, 3, 3, 2
db %11111111 ; 3, 3, 3, 3
db %11111110 ; 3, 3, 3, 2
db %11111001 ; 3, 3, 2, 1
db %11100100 ; 3, 2, 1, 0
db %10010000 ; 2, 1, 0, 0
db %01000000 ; 1, 0, 0, 0
db %00000000 ; 0, 0, 0, 0
db %01000000 ; 1, 0, 0, 0
db %10010000 ; 2, 1, 0, 0
db %11100100 ; 3, 2, 1, 0
db $01 ; terminator

; BG palettes
FlashScreenLongSGB: ; 7919b (1e:519b)
db %11111000 ; 3, 3, 2, 0
db %11111100 ; 3, 3, 3, 0
db %11111111 ; 3, 3, 3, 3
db %11111100 ; 3, 3, 3, 0
db %11111000 ; 3, 3, 2, 0
db %11100100 ; 3, 2, 1, 0
db %10010000 ; 2, 1, 0, 0
db %01000000 ; 1, 0, 0, 0
db %00000000 ; 0, 0, 0, 0
db %01000000 ; 1, 0, 0, 0
db %10010000 ; 2, 1, 0, 0
db %11100100 ; 3, 2, 1, 0
db $01 ; terminator

; causes a delay of 2 frames for the first cycle
; causes a delay of 1 frame for the second and third cycles
FlashScreenLongDelay: ; 791a8 (1e:51a8)
	ld a,[$D08A]
	cp a,4 ; never true since [$D08A] starts at 3
	ld c,4
	jr z,.delayFrames
	cp a,3
	ld c,2
	jr z,.delayFrames
	cp a,2 ; nothing is done with this
	ld c,1
.delayFrames
	jp DelayFrames

AnimationFlashScreen: ; 791be (1e:51be)
	ld a,[rBGP]
	push af ; save initial palette
	ld a,%00011011 ; 0, 1, 2, 3 (inverted colors)
	ld [rBGP],a
	ld c,2
	call DelayFrames
	xor a ; white out background
	ld [rBGP],a
	ld c,2
	call DelayFrames
	pop af
	ld [rBGP],a ; restore initial palette
	ret

	ld bc, Unknown_7af6f ; $6f6f
	jr .asm_791fc

INCBIN "baserom.gbc",$791db,$791ea - $791db
	ld bc, $e4e4
	jr .asm_791fc

INCBIN "baserom.gbc",$791ef,$791f4 - $791ef
	ld bc, $9090
	jr .asm_791fc

INCBIN "baserom.gbc",$791f9,$791fc - $791f9
.asm_791fc
	ld a, [$cf1b]
	and a
	ld a, b
	jr z, .asm_79204
	ld a, c
.asm_79204
	ld [rBGP], a ; $FF00+$47
	ret

INCBIN "baserom.gbc",$79207,$79209 - $79207

; known jump sources: 78de0 (1e:4de0)
Func_79209: ; 79209 (1e:5209)
	ld a, $21
	jp Predef ; indirect jump to Func_480ff (480ff (12:40ff))
	ld b, $8

; known jump sources: 78de8 (1e:4de8), 78dfb (1e:4dfb)
Func_79210: ; 79210 (1e:5210)
	ld a, $24
	jp Predef ; indirect jump to Func_48125 (48125 (12:4125))
	xor a
	ld [$d09f], a
	call LoadAnimationTileset
	ld d, $20
	ld a, $f0
	ld [W_BASECOORDX], a ; $d081
	ld a, $71
	ld [$d09f], a
.asm_79228
	ld a, $10
	ld [W_BASECOORDY], a ; $d082
	ld a, $0
	ld [$d08a], a
	call Func_79246
	ld a, $18
	ld [W_BASECOORDY], a ; $d082
	ld a, $20
	ld [$d08a], a
	call Func_79246
	dec d
	jr nz, .asm_79228
	ret

; known jump sources: 79232 (1e:5232), 7923f (1e:523f)
Func_79246: ; 79246 (1e:5246)
	ld hl, W_OAMBUFFER
.asm_79249
	ld a, [W_BASECOORDY] ; $d082
	ld [hli], a
	ld a, [W_BASECOORDX] ; $d081
	add $1b
	ld [W_BASECOORDX], a ; $d081
	ld [hli], a
	ld a, [$d09f]
	ld [hli], a
	xor a
	ld [hli], a
	ld a, [W_BASECOORDX] ; $d081
	cp $90
	jr c, .asm_79249
	sub $a8
	ld [W_BASECOORDX], a ; $d081
	ld a, [W_BASECOORDY] ; $d082
	add $10
	ld [W_BASECOORDY], a ; $d082
	cp $70
	jr c, .asm_79249
	call AnimationCleanOAM
	jp DelayFrame

INCBIN "baserom.gbc",$7927a,$79297 - $7927a

; known jump sources: 7975d (1e:575d)
Func_79297: ; 79297 (1e:5297)
	xor a
	call Func_79842
.asm_7929b
	call Func_79820
	push bc
	push de
	call Func_79aae
	call Delay3
	call Func_79801
	pop de
	pop bc
	dec b
	jr nz, .asm_7929b
	ret

; known jump sources: 79762 (1e:5762)
Func_792af: ; 792af (1e:52af)
	ld e, $8
	ld a, $3
	ld [W_SUBANIMTRANSFORM], a ; $d08b
	jp Func_795f8

; known jump sources: 3c226 (f:4226)
Func_792b9: ; 792b9 (1e:52b9)
	ld hl, Func_792af ; $52af
	jp CallWithTurnFlipped

INCBIN "baserom.gbc",$792bf,$79329 - $792bf

; known jump sources: 7952a (1e:552a), 797fa (1e:57fa)
Func_79329: ; 79329 (1e:5329)
	ld a, e
	add $8
	ld e, a
	ld [hli], a
	ld a, [W_BASECOORDX] ; $d081
	ld [hli], a
	ld a, d
	ld [hli], a
	xor a
	ld [hli], a
	ret
	ld l, e
	ld h, d

; known jump sources: 79eaa (1e:5eaa), 79eb7 (1e:5eb7), 79ef8 (1e:5ef8), 79f05 (1e:5f05), 79f12 (1e:5f12), 79f1f (1e:5f1f)
Func_79339: ; 79339 (1e:5339)
	ld de, $4
.asm_7933c
	ld a, [$d08a]
	ld b, a
	ld a, [hl]
	add b
	cp $a8
	jr c, .asm_7934a
	dec hl
	ld a, $a0
	ld [hli], a
.asm_7934a
	ld [hl], a
	add hl, de
	dec c
	jr nz, .asm_7933c
	ret
	ld l, e
	ld h, d

; known jump sources: 79ee5 (1e:5ee5)
Func_79352: ; 79352 (1e:5352)
	ld de, $4
.asm_79355
	ld a, [$d08a]
	ld b, a
	ld a, [hl]
	add b
	cp $70
	jr c, .asm_79363
	dec hl
	ld a, $a0
	ld [hli], a
.asm_79363
	ld [hl], a
	add hl, de
	dec c
	jr nz, .asm_79355
	ret

; known jump sources: 78df3 (1e:4df3)
Func_79369: ; 79369 (1e:5369)
	ld hl, Func_7936f ; $536f
	jp CallWithTurnFlipped

Func_7936f: ; 7936f (1e:536f)
	push af
	ld c, $6
.asm_79372
	push bc
	call Func_79801
	ld c, $5
	call DelayFrames
	call Func_7939e
	ld c, $5
	call DelayFrames
	pop bc
	dec c
	jr nz, .asm_79372
	pop af
	ret

; known jump sources: 7976b (1e:576b)
Func_79389: ; 79389 (1e:5389)
	ld a, [W_PLAYERMONID]
	ld [$ceea], a
	ld a, [$cfe5]
	ld [$cee9], a
	jp Func_79793

INCBIN "baserom.gbc",$79398,$7939e - $79398

; known jump sources: 7937b (1e:537b), 79421 (1e:5421), 795c1 (1e:55c1), 7976e (1e:576e)
Func_7939e: ; 7939e (1e:539e)
	xor a
	call Func_79842
	call Func_79820
	call Func_79aae
	jp Delay3
	ld hl, Func_7939e ; $539e
	jp CallWithTurnFlipped

INCBIN "baserom.gbc",$793b1,$793f9 - $793b1
	call Func_79801
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	FuncCoord 2, 5 ; $c406
	ld hl, Coord
	jr z, .asm_79407
	FuncCoord 11, 0 ; $c3ab
	ld hl, Coord
.asm_79407
	xor a
	push hl
	call Func_79842
	pop hl
	call Func_79aae
	ld c, $3
	jp DelayFrames
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, $66
	jr z, .asm_7941e
	ld a, $b
.asm_7941e
	call Func_7980c
	jp Func_7939e
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_79435
	ld a, $d8
	ld [$d08a], a
	ld a, $50
	ld [W_SUBANIMTRANSFORM], a ; $d08b
	jr .asm_7943c
.asm_79435
	xor a
	ld [$d08a], a
	ld [W_SUBANIMTRANSFORM], a ; $d08b
.asm_7943c
	ld d, $7a
	ld c, $3
	xor a
	call Func_797e8
	ld hl, Unknown_79476 ; $5476
.asm_79447
	push hl
	ld c, $3
	ld de, W_OAMBUFFER
.asm_7944d
	ld a, [hl]
	cp $ff
	jr z, .asm_7946f
	ld a, [$d08a]
	add [hl]
	ld [de], a
	inc de
	inc hl
	ld a, [W_SUBANIMTRANSFORM] ; $d08b
	add [hl]
	ld [de], a
	inc hl
	inc de
	inc de
	inc de
	dec c
	jr nz, .asm_7944d
	ld c, $5
	call DelayFrames
	pop hl
	inc hl
	inc hl
	jr .asm_79447
.asm_7946f
	pop hl
	call AnimationCleanOAM
	jp AnimationFlashScreen

Unknown_79476: ; 79476 (1e:5476)
INCBIN "baserom.gbc",$79476,$794a1 - $79476
	ld c, $4
.asm_794a3
	push bc
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_794b1
	FuncCoord 16, 0 ; $c3b0
	ld hl, Coord
	FuncCoord 14, 0 ; $c3ae
	ld de, Coord
	jr .asm_794b7
.asm_794b1
	FuncCoord 5, 5 ; $c409
	ld hl, Coord
	FuncCoord 3, 5 ; $c407
	ld de, Coord
.asm_794b7
	push de
	xor a
	ld [$d09f], a
	call Func_794d4
	pop hl
	ld a, $1
	ld [$d09f], a
	call Func_794d4
	pop bc
	dec c
	jr nz, .asm_794a3
	call Func_79801
	ld c, $2
	jp DelayFrame

; known jump sources: 794bc (1e:54bc), 794c5 (1e:54c5)
Func_794d4: ; 794d4 (1e:54d4)
	ld c, $7
.asm_794d6
	push bc
	push hl
	ld c, $3
	ld a, [$d09f]
	cp $0
	jr nz, .asm_794e7
	call asm_7985b
	dec hl
	jr .asm_794eb
.asm_794e7
	call Func_79862
	inc hl
.asm_794eb
	ld [hl], $7f
	pop hl
	ld de, $14
	add hl, de
	pop bc
	dec c
	jr nz, .asm_794d6
	jp Delay3
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_79503
	ld bc, $80
	jr .asm_79506
.asm_79503
	ld bc, $3028
.asm_79506
	ld a, b
	ld [W_BASECOORDY], a ; $d082
	ld a, c
	ld [W_BASECOORDX], a ; $d081
	ld bc, $501
	call Func_79517
	jp AnimationCleanOAM

; known jump sources: 79511 (1e:5511)
Func_79517: ; 79517 (1e:5517)
	push bc
	xor a
	ld [$d09f], a
	call LoadAnimationTileset
	pop bc
	ld d, $7a
	ld hl, W_OAMBUFFER
	push bc
	ld a, [W_BASECOORDY] ; $d082
	ld e, a
.asm_7952a
	call Func_79329
	dec b
	jr nz, .asm_7952a
	call DelayFrame
	pop bc
	ld a, b
	ld [$d08a], a
.asm_79538
	push bc
	ld hl, W_OAMBUFFER
.asm_7953c
	ld a, [W_BASECOORDY] ; $d082
	add $8
	ld e, a
	ld a, [hl]
	cp e
	jr z, .asm_7954b
	add $fc
	ld [hl], a
	jr .asm_79554
.asm_7954b
	ld [hl], $0
	ld a, [$d08a]
	dec a
	ld [$d08a], a
.asm_79554
	ld de, $4
	add hl, de
	dec b
	jr nz, .asm_7953c
	call DelayFrames
	pop bc
	ld a, [$d08a]
	and a
	jr nz, .asm_79538
	ret

INCBIN "baserom.gbc",$79566,$7959f - $79566

; known jump sources: 79768 (1e:5768)
Func_7959f: ; 7959f (1e:559f)
	ld hl, $c6e8
	push hl
	xor a
	ld bc, $310
	call FillMemory
	pop hl
	ld de, $194
	add hl, de
	ld de, Unknown_795c4 ; $55c4
	ld c, $5
.asm_795b4
	ld a, [de]
	ld [hli], a
	ld [hli], a
	inc de
	dec c
	jr nz, .asm_795b4
	call Func_79652
	call Delay3
	jp Func_7939e

Unknown_795c4: ; 795c4 (1e:55c4)
INCBIN "baserom.gbc",$795c4,$795f8 - $795c4

; known jump sources: 792b6 (1e:52b6)
Func_795f8: ; 795f8 (1e:55f8)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_79602
	FuncCoord 12, 0 ; $c3ac
	ld hl, Coord
	jr .asm_79605
.asm_79602
	FuncCoord 0, 5 ; $c404
	ld hl, Coord
.asm_79605
	ld d, $8
.asm_79607
	push hl
	ld b, $7
.asm_7960a
	ld c, $8
.asm_7960c
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_79616
	call Func_7963c
	jr .asm_79619
.asm_79616
	call Func_79633
.asm_79619
	ld [hli], a
	dec c
	jr nz, .asm_7960c
	push de
	ld de, $c
	add hl, de
	pop de
	dec b
	jr nz, .asm_7960a
	ld a, [W_SUBANIMTRANSFORM] ; $d08b
	ld c, a
	call DelayFrames
	pop hl
	dec d
	dec e
	jr nz, .asm_79607
	ret

; known jump sources: 79616 (1e:5616)
Func_79633: ; 79633 (1e:5633)
	ld a, [hl]
	add $7
	cp $61
	ret c
	ld a, $7f
	ret

; known jump sources: 79611 (1e:5611)
Func_7963c: ; 7963c (1e:563c)
	ld a, [hl]
	sub $7
	cp $30
	ret c
	ld a, $7f
	ret

INCBIN "baserom.gbc",$79645,$79652 - $79645

; known jump sources: 795bb (1e:55bb)
Func_79652: ; 79652 (1e:5652)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld hl, $9310
	jr z, .asm_7965d
	ld hl, $9000
.asm_7965d
	ld de, $c6e8
	ld bc, $31
	jp CopyVideoData

INCBIN "baserom.gbc",$79666,$796e0 - $79666

Func_796e0: ; 796e0 (1e:56e0)
	ld hl, $c6e8
	xor a
	ld bc, $0310
	call FillMemory
	ld a, [$ff00+$f3]
	and a
	jr z, .asm_79715 ; 0x796ed $26
	ld hl, SlowbroSprite ; $4780       ; facing down sprite
	ld de, $c808
	call CopySlowbroSpriteData
	ld hl, SlowbroSprite + $10 ; $4790
	ld de, $c878
	call CopySlowbroSpriteData
	ld hl, SlowbroSprite + $20 ; $47a0
	ld de, $c818
	call CopySlowbroSpriteData
	ld hl, SlowbroSprite + $30 ; $47b0
	ld de, $c888
	call CopySlowbroSpriteData
	jr .asm_79739 ; 0x79713 $24
.asm_79715
	ld hl, SlowbroSprite + $40 ; $47c0 ; facing up sprite
	ld de, $c878
	call CopySlowbroSpriteData
	ld hl, SlowbroSprite + $50 ; $47d0
	ld de, $c8e8
	call CopySlowbroSpriteData
	ld hl, SlowbroSprite + $60 ; $47e0
	ld de, $c888
	call CopySlowbroSpriteData
	ld hl, SlowbroSprite + $70 ; $47f0
	ld de, $c8f8
	call CopySlowbroSpriteData
.asm_79739
	call Func_79652
	jp Func_7939e
; 0x7973f

CopySlowbroSpriteData: ; 7973f (1e:573f)
	ld bc, $0010
	ld a, BANK(SlowbroSprite)
	jp FarCopyData2
; 0x79747

; known jump sources: 3e295 (f:6295)
Func_79747: ; 79747 (1e:5747)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld hl, $ccf7
	ld a, [W_PLAYERBATTSTATUS2] ; $d063
	jr z, .asm_79758
	ld hl, $ccf3
	ld a, [W_ENEMYBATTSTATUS2] ; $d068
.asm_79758
	push hl
	bit 4, a
	jr nz, .asm_79762
	call Func_79297
	jr .asm_79765
.asm_79762
	call Func_792af
.asm_79765
	pop hl
	ld a, [hl]
	and a
	jp nz, Func_7959f
	call Func_79389
	jp Func_7939e

Func_79771: ; 79771 (1e:5771)
	call Func_792af
	call Func_796e0
	jp Func_7939e
; 0x7977a

Func_7977a: ; 7977a (1e:577a)
	ld c, $5
.asm_7977c
	push bc
	call Func_79297
	pop bc
	dec c
	jr nz, .asm_7977c ; 0x79782 $f8
	jp Func_7939e
; 0x79787

Func_79787: ; 79787 (1e:5787)
	ld a, [$cfe5]
	ld [$ceea], a
	ld a, [W_PLAYERMONID]
	ld [$cee9], a

; known jump sources: 708ee (1c:48ee), 79395 (1e:5395)
Func_79793: ; 79793 (1e:5793)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_797b0
	ld a, [$cee9]
	ld [$cf91], a
	ld [$d0b5], a
	xor a
	ld [W_SPRITEFLIPPED], a
	call GetMonHeader
	FuncCoord 12, 0 ; $c3ac
	ld hl, Coord
	call LoadFrontSpriteByMonIndex
	jr .asm_797d3
.asm_797b0
	ld a, [$cfd9]
	push af
	ld a, [$ceea]
	ld [$cfd9], a
	ld [$d0b5], a
	call GetMonHeader
	ld a, $4
	call Predef ; indirect jump to LoadMonBackSprite (3f103 (f:7103))
	xor a
	call Func_79842
	call Func_79820
	call Func_79aae
	pop af
	ld [$cfd9], a
.asm_797d3
	ld b, $1
	jp GoPAL_SET
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld hl, Func_79801 ; $5801
	call CallWithTurnFlipped
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	jp Delay3

; known jump sources: 79441 (1e:5441)
Func_797e8: ; 797e8 (1e:57e8)
	push bc
	push de
	ld [$d09f], a
	call LoadAnimationTileset
	pop de
	pop bc
	xor a
	ld e, a
	ld [W_BASECOORDX], a ; $d081
	ld hl, W_OAMBUFFER
.asm_797fa
	call Func_79329
	dec c
	jr nz, .asm_797fa
	ret

; known jump sources: 792a6 (1e:52a6), 79373 (1e:5373), 793f9 (1e:53f9), 794cc (1e:54cc)
Func_79801: ; 79801 (1e:5801)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr z, .asm_7980a
	ld a, $c
	jr Func_7980c
.asm_7980a
	ld a, $65

; known jump sources: 79049 (1e:5049), 7941e (1e:541e), 79808 (1e:5808)
Func_7980c: ; 7980c (1e:580c)
	push hl
	push de
	push bc
	ld e, a
	ld d, $0
	ld hl, W_SCREENTILESBUFFER
	add hl, de
	ld bc, $707
	call ClearScreenArea
	pop bc
	pop de
	pop hl
	ret

; known jump sources: 7929b (1e:529b), 793a2 (1e:53a2), 797c9 (1e:57c9)
Func_79820: ; 79820 (1e:5820)
	push de
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	jr nz, .asm_7982a
	ld a, $65
	jr .asm_7982c
.asm_7982a
	ld a, $c
.asm_7982c
	ld hl, W_SCREENTILESBUFFER
	ld e, a
	ld d, $0
	add hl, de
	ld a, $7
	sub b
	and a
	jr z, .asm_79840
	ld de, $14
.asm_7983c
	add hl, de
	dec a
	jr nz, .asm_7983c
.asm_79840
	pop de
	ret

; known jump sources: 79298 (1e:5298), 7939f (1e:539f), 79409 (1e:5409), 797c6 (1e:57c6), 79de2 (1e:5de2)
Func_79842: ; 79842 (1e:5842)
	ld hl, Unknown_79aea ; $5aea
	ld e, a
	ld d, $0
	add hl, de
	add hl, de
	add hl, de
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld d, a
	ld a, [hli]
	ld b, a
	and $f
	ld c, a
	ld a, b
	swap a
	and $f
	ld b, a
	ret
asm_7985b: ; 7985b (1e:585b)
	ld a, [hld]
	ld [hli], a
	inc hl
	dec c
	jr nz, asm_7985b
	ret

; known jump sources: 78f7d (1e:4f7d), 794e7 (1e:54e7), 79866 (1e:5866)
Func_79862: ; 79862 (1e:5862)
	ld a, [hli]
	ld [hld], a
	dec hl
	dec c
	jr nz, Func_79862
	ret

INCBIN "baserom.gbc",$79869,$7986f - $79869

Func586F: ; 7986f (1e:586f)
	ld hl,MoveSoundTable
	ld e,a
	ld d,0
	add hl,de
	add hl,de
	add hl,de
	ld a,[hli]
	ld b,a
	call IsCryMove
	jr nc,.NotCryMove
	ld a,[H_WHOSETURN]
	and a
	jr nz,.next
	ld a,[W_PLAYERMONID] ; get number of current monster
	jr .Continue
.next
	ld a,[$CFE5]
.Continue
	push hl
	call GetCryData
	ld b,a
	pop hl
	ld a,[$C0F1]
	add [hl]
	ld [$C0F1],a
	inc hl
	ld a,[$C0F2]
	add [hl]
	ld [$C0F2],a
	jr .done
.NotCryMove
	ld a,[hli]
	ld [$C0F1],a
	ld a,[hli]
	ld [$C0F2],a
.done
	ld a,b
	ret
IsCryMove: ; 798ad (1e:58ad)
; set carry if the move animation involves playing a monster cry
	ld a,[W_ANIMATIONID]
	cp a,GROWL
	jr z,.CryMove
	cp a,ROAR
	jr z,.CryMove
	and a ; clear carry
	ret
.CryMove
	scf
	ret

MoveSoundTable: ; 798bc (1e:58bc)
	db $a0,$00,$80
	db $a2,$10,$80
	db $b3,$00,$80
	db $a1,$01,$80
	db $a3,$00,$40
	db $e9,$00,$ff
	db $a3,$10,$60
	db $a3,$20,$80
	db $a3,$00,$a0
	db $a6,$00,$80
	db $a5,$20,$40
	db $a5,$00,$80
	db $a4,$00,$a0
	db $a7,$10,$c0
	db $a7,$00,$a0
	db $a8,$00,$c0
	db $a8,$10,$a0
	db $a9,$00,$e0
	db $a7,$20,$c0
	db $aa,$00,$80
	db $b9,$00,$80
	db $ab,$01,$80
	db $b7,$00,$80
	db $ad,$f0,$40
	db $b0,$00,$80
	db $ad,$00,$80
	db $b8,$10,$80
	db $b1,$01,$a0
	db $ae,$00,$80
	db $b4,$00,$60
	db $b4,$01,$40
	db $b6,$00,$a0
	db $b0,$10,$a0
	db $b7,$00,$c0
	db $aa,$10,$60
	db $b0,$00,$a0
	db $b9,$11,$c0
	db $b0,$20,$c0
	db $b8,$00,$80
	db $b1,$00,$80
	db $b1,$20,$c0
	db $af,$00,$80
	db $db,$ff,$40
	db $b4,$00,$80
	db $a1,$00,$c0
	db $a1,$00,$40
	db $e4,$00,$80
	db $bf,$40,$60
	db $bf,$00,$80
	db $bf,$ff,$40
	db $c7,$80,$c0
	db $af,$10,$a0
	db $af,$21,$e0
	db $c5,$00,$80
	db $bb,$20,$60
	db $c7,$00,$80
	db $cc,$00,$80
	db $c2,$40,$80
	db $c5,$f0,$e0
	db $cf,$00,$80
	db $c7,$f0,$60
	db $c2,$00,$80
	db $e6,$00,$80
	db $9d,$01,$a0
	db $a9,$f0,$20
	db $ba,$01,$c0
	db $ba,$00,$80
	db $b0,$00,$e0
	db $be,$01,$60
	db $be,$20,$40
	db $bb,$00,$80
	db $bb,$40,$c0
	db $b1,$03,$60
	db $bd,$11,$e0
	db $a8,$20,$e0
	db $d2,$00,$80
	db $b2,$00,$80
	db $b2,$11,$a0
	db $b2,$01,$c0
	db $a9,$14,$c0
	db $b1,$02,$a0
	db $c5,$f0,$80
	db $c5,$20,$c0
	db $d5,$00,$20
	db $d5,$20,$80
	db $d2,$12,$60
	db $be,$00,$80
	db $aa,$01,$e0
	db $c5,$0f,$e0
	db $c5,$11,$20
	db $a6,$10,$40
	db $a5,$10,$c0
	db $aa,$00,$20
	db $d8,$00,$80
	db $e4,$11,$18
	db $9f,$20,$c0
	db $9e,$20,$c0
	db $bd,$00,$10
	db $be,$f0,$20
	db $df,$f0,$c0
	db $a7,$f0,$e0
	db $9f,$f0,$40
	db $db,$00,$80
	db $df,$80,$40
	db $df,$00,$80
	db $aa,$11,$20
	db $aa,$22,$10
	db $b1,$f1,$ff
	db $a9,$f1,$ff
	db $aa,$33,$30
	db $dd,$40,$c0
	db $a4,$20,$20
	db $a4,$f0,$10
	db $a5,$f8,$10
	db $a7,$f0,$10
	db $bd,$00,$80
	db $ae,$00,$c0
	db $dd,$c0,$ff
	db $9f,$f2,$20
	db $e1,$00,$80
	db $e1,$00,$40
	db $9f,$00,$40
	db $a7,$10,$ff
	db $c7,$20,$20
	db $dd,$00,$80
	db $c5,$1f,$20
	db $bd,$2f,$80
	db $a5,$1f,$ff
	db $ca,$1f,$60
	db $be,$1e,$20
	db $be,$1f,$18
	db $aa,$0f,$80
	db $9f,$f8,$10
	db $9e,$18,$20
	db $dd,$08,$40
	db $ad,$01,$e0
	db $a7,$09,$ff
	db $e4,$42,$01
	db $b2,$00,$ff
	db $dd,$08,$e0
	db $bb,$00,$80
	db $9f,$88,$10
	db $bd,$48,$ff
	db $9e,$ff,$ff
	db $bb,$ff,$10
	db $9e,$ff,$04
	db $b2,$01,$ff
	db $a9,$f8,$ff
	db $a2,$f0,$f0
	db $a5,$08,$10
	db $a3,$f0,$ff
	db $b0,$f0,$ff
	db $e1,$10,$ff
	db $a4,$f0,$20
	db $ca,$f0,$60
	db $b8,$12,$10
	db $e6,$f0,$20
	db $b4,$12,$ff
	db $db,$80,$04
	db $df,$f0,$10
	db $c5,$f8,$ff
	db $be,$f0,$ff
	db $a7,$01,$ff
	db $cc,$d8,$04
	db $a1,$00,$80
	db $a1,$00,$80

; known jump sources: 792a0 (1e:52a0), 793a5 (1e:53a5), 7940d (1e:540d), 797cc (1e:57cc)
Func_79aae: ; 79aae (1e:5aae)
	ld a, [H_WHOSETURN] ; $FF00+$f3
	and a
	ld a, $31
	jr z, .asm_79ab6
	xor a
.asm_79ab6
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	jr asm_79acb

; known jump sources: 3cd11 (f:4d11), 3cd2c (f:4d2c), 3f09a (f:709a), 3f0af (f:70af)
Func_79aba: ; 79aba (1e:5aba)
	call Load16BitRegisters
	ld a, [$cd6c]
	and a
	jr nz, .asm_79ac8
	ld de, Unknown_79b02 ; $5b02
	jr asm_79acb
.asm_79ac8
	ld de, Unknown_79b1b ; $5b1b
asm_79acb: ; 79acb (1e:5acb)
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba

; known jump sources: 79de6 (1e:5de6)
Func_79ace: ; 79ace (1e:5ace)
	push hl
.asm_79acf
	push bc
	push hl
	ld a, [H_DOWNARROWBLINKCNT1] ; $FF00+$8b
	ld b, a
.asm_79ad4
	ld a, [de]
	add b
	inc de
	ld [hli], a
	dec c
	jr nz, .asm_79ad4
	pop hl
	ld bc, $14
	add hl, bc
	pop bc
	dec b
	jr nz, .asm_79acf
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	pop hl
	ret

Unknown_79aea: ; 79aea (1e:5aea)
INCBIN "baserom.gbc",$79aea,$79b02 - $79aea

Unknown_79b02: ; 79b02 (1e:5b02)
INCBIN "baserom.gbc",$79b02,$79b1b - $79b02

Unknown_79b1b: ; 79b1b (1e:5b1b)
INCBIN "baserom.gbc",$79b1b,$79dda - $79b1b

; known jump sources: 41846 (10:5846), 70374 (1c:4374)
Func_79dda: ; 79dda (1e:5dda)
	call Load16BitRegisters
	ld a, c
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld a, b
	push hl
	call Func_79842
	pop hl
	jp Func_79ace

INCBIN "baserom.gbc",$79de9,$79e16 - $79de9

TossBallAnimation: ; 79e16 (1e:5e16)
	ld a,[W_ISINBATTLE]
	cp a,2
	jr z,.BlockBall ; if in trainer battle, play different animation
	ld a,[$D11E]
	ld b,a

	; upper nybble: how many animations (from PokeBallAnimations) to play
	; this will be 4 for successful capture, 6 for breakout
	and a,$F0
	swap a
	ld c,a

	; lower nybble: number of shakes
	; store these for later
	ld a,b
	and a,$F
	ld [$CD3D],a

	ld hl,.PokeBallAnimations
	; choose which toss animation to use
	ld a,[$CF91]
	cp a,POKE_BALL
	ld b,TOSS_ANIM
	jr z,.done
	cp a,GREAT_BALL
	ld b,GREATTOSS_ANIM
	jr z,.done
	ld b,ULTRATOSS_ANIM
.done
	ld a,b
.PlayNextAnimation
	ld [W_ANIMATIONID],a
	push bc
	push hl
	call PlayAnimation
	pop hl
	ld a,[hli]
	pop bc
	dec c
	jr nz,.PlayNextAnimation
	ret

.PokeBallAnimations: ; 79e50 (1e:5e50)
; sequence of animations that make up the Poké Ball toss
	db POOF_ANIM,HIDEPIC_ANIM,$C2,POOF_ANIM,SHOWPIC_ANIM

.BlockBall ; 5E55
	ld a,$C1
	ld [W_ANIMATIONID],a
	call PlayAnimation
	ld a,$95
	call PlaySound ; play sound effect
	ld a,BLOCKBALL_ANIM
	ld [W_ANIMATIONID],a
	jp PlayAnimation

; known jump sources: 78ddb (1e:4ddb), 78de3 (1e:4de3), 78df0 (1e:4df0), 78df6 (1e:4df6)
Func_79e6a: ; 79e6a (1e:5e6a)
	call WaitForSoundToFinish
	ld a, [$d05b]
	and $7f
	ret z
	cp $a
	ld a, $20
	ld b, $30
	ld c, $a6
	jr z, .asm_79e8b
	ld a, $e0
	ld b, $ff
	ld c, $b0
	jr nc, .asm_79e8b
	ld a, $50
	ld b, $1
	ld c, $a7
.asm_79e8b
	ld [$c0f1], a
	ld a, b
	ld [$c0f2], a
	ld a, c
	jp PlaySound

; known jump sources: efdb (3:6fdb)
Func_79e96: ; 79e96 (1e:5e96)
	ld a, [$cd4d]
	cp $52
	jr z, .asm_79ec8
	ld c, $8
.asm_79e9f
	push bc
	ld hl, $c391
	ld a, $1
	ld [$d08a], a
	ld c, $2
	call Func_79339
	ld hl, $c399
	ld a, $ff
	ld [$d08a], a
	ld c, $2
	call Func_79339
	ld a, [rOBP1] ; $FF00+$49
	xor $64
	ld [rOBP1], a ; $FF00+$49
	call DelayFrame
	pop bc
	dec c
	jr nz, .asm_79e9f
	ret
.asm_79ec8
	ld c, $2
.asm_79eca
	push bc
	ld c, $8
	call Func_79eed
	call Func_79f30
	ld c, $8
	call Func_79eed
	call Func_79f30
	ld hl, $c390
	ld a, $2
	ld [$d08a], a
	ld c, $4
	call Func_79352
	pop bc
	dec c
	jr nz, .asm_79eca
	ret

; known jump sources: 79ecd (1e:5ecd), 79ed5 (1e:5ed5), 79f2d (1e:5f2d)
Func_79eed: ; 79eed (1e:5eed)
	push bc
	ld hl, $c391
	ld a, $1
	ld [$d08a], a
	ld c, $1
	call Func_79339
	ld hl, $c395
	ld a, $2
	ld [$d08a], a
	ld c, $1
	call Func_79339
	ld hl, $c399
	ld a, $fe
	ld [$d08a], a
	ld c, $1
	call Func_79339
	ld hl, $c39d
	ld a, $ff
	ld [$d08a], a
	ld c, $1
	call Func_79339
	ld a, [rOBP1] ; $FF00+$49
	xor $64
	ld [rOBP1], a ; $FF00+$49
	call DelayFrame
	pop bc
	dec c
	jr nz, Func_79eed
	ret

; known jump sources: 79ed0 (1e:5ed0), 79ed8 (1e:5ed8)
Func_79f30: ; 79f30 (1e:5f30)
	ld hl, $c390
	ld de, $cee9
	ld bc, $8
	call CopyData
	ld hl, $c398
	ld de, $c390
	ld bc, $8
	call CopyData
	ld hl, $cee9
	ld de, $c398
	ld bc, $8
	jp CopyData

; known jump sources: f2c0 (3:72c0)
Func_79f54: ; 79f54 (1e:5f54)
	ld a, $1
	ld [$cd50], a
	ld a, [$cfcb]
	push af
	ld a, $ff
	ld [$cfcb], a
	ld a, $e4
	ld [rOBP1], a ; $FF00+$49
	call Func_79fc0
	ld b, BANK(asm_f055)
	ld hl, asm_f055
	call Bankswitch ; indirect jump to asm_f055 (f055 (3:7055))
	ld c, $8
.asm_79f73
	push bc
	call Func_79f92
	ld bc, $5f7e
	push bc
	ld c, $4
	jp [hl]
	ld a, [rOBP1] ; $FF00+$49
	xor $64
	ld [rOBP1], a ; $FF00+$49
	call Delay3
	pop bc
	dec c
	jr nz, .asm_79f73
	pop af
	ld [$cfcb], a
	jp LoadPlayerSpriteGraphics

; known jump sources: 79f74 (1e:5f74)
Func_79f92: ; 79f92 (1e:5f92)
	ld a, [$c109]
	ld hl, Unknown_79fb0 ; $5fb0
	ld c, a
	ld b, $0
	add hl, bc
	ld a, [hli]
	ld [$d08a], a
	ld a, [hli]
	ld e, a
	ld a, [hli]
	ld h, [hl]
	ld l, a
	push hl
	ld hl, $c390
	ld d, $0
	add hl, de
	ld e, l
	ld d, h
	pop hl
	ret

Unknown_79fb0: ; 79fb0 (1e:5fb0)
INCBIN "baserom.gbc",$79fb0,$79fc0 - $79fb0

; known jump sources: 1dbb4 (7:5bb4), 79f66 (1e:5f66)
Func_79fc0: ; 79fc0 (1e:5fc0)
	ld hl, $8fc0
	ld c, $4
.asm_79fc5
	push bc
	push hl
	call Func_79fd4
	pop hl
	ld bc, $10
	add hl, bc
	pop bc
	dec c
	jr nz, .asm_79fc5
	ret

; known jump sources: 79fc7 (1e:5fc7)
Func_79fd4: ; 79fd4 (1e:5fd4)
	ld de, Unknown_79fdd ; $5fdd
	ld bc, (BANK(Unknown_79fdd) << 8) + $01
	jp CopyVideoData

Unknown_79fdd: ; 79fdd (1e:5fdd)
INCBIN "baserom.gbc",$79fdd,$7a07d - $79fdd

Unknown_7a07d: ; 7a07d (1e:607d)
INCBIN "baserom.gbc",$7a07d,$7a76d - $7a07d

Unknown_7a76d: ; 7a76d (1e:676d)
INCBIN "baserom.gbc",$7a76d,$7af6f - $7a76d

Unknown_7af6f: ; 7af6f (1e:6f6f)
INCBIN "baserom.gbc",$7af6f,$7af74 - $7af6f

PointerTable6F74: ; 7af74 (1e:6f74)
	dw $7de7
	dw $7068
	dw $708d
	dw $70ce
	dw $70df
	dw $70f0
	dw $7101
	dw $7132
	dw $7173
	dw $71b4
	dw $71e5
	dw $7216
	dw $7227
	dw $7238
	dw $7259
	dw $726a
	dw $727b
	dw $729c
	dw $72bd
	dw $72ca
	dw $72db
	dw $72fc
	dw $732d
	dw $734e
	dw $735f
	dw $7364
	dw $736d
	dw $7376
	dw $737f
	dw $7388
	dw $7391
	dw $73ab
	dw $73b4
	dw $73cd
	dw $73fe
	dw $744b
	dw $745c
	dw $7465
	dw $7496
	dw $74a7
	dw $74bc
	dw $74d5
	dw $74e6
	dw $74f7
	dw $7500
	dw $7505
	dw $7526
	dw $7547
	dw $7558
	dw $7569
	dw $756e
	dw $758b
	dw $75a8
	dw $75ad
	dw $75c6
	dw $75d7
	dw $75e8
	dw $75f9
	dw $760a
	dw $761b
	dw $7630
	dw $7649
	dw $7666
	dw $7687
	dw $76a8
	dw $76b5
	dw $76c6
	dw $76f3
	dw $7720
	dw $7731
	dw $7742
	dw $7753
	dw $7764
	dw $7775
	dw $785a
	dw $786b
	dw $787c
	dw $788d
	dw $789e
	dw $78bf
	dw $78f0
	dw $7911
	dw $7932
	dw $7943
	dw $7950
	dw $7961
	dw $796e
	dw $7987
	dw $79ac
	dw $79c9
	dw $79ce
	dw $79ff
	dw $7a10
	dw $7a31
	dw $7a5e
	dw $7a9b
	dw $7aac
	dw $7acd
	dw $7afe
	dw $7b3f
	dw $7b58
	dw $7b71
	dw $7b8a
	dw $7b93
	dw $7b98
	dw $7ba9
	dw $7bae
	dw $7bcf
	dw $7bf0
	dw $7c11
	dw $7c1a
	dw $7c2b
	dw $7c3c
	dw $77b6
	dw $77f7
	dw $7828
	dw $7849
	dw $739a
	dw $7c4d
	dw $7c6a
	dw $7c7b
	dw $7c80

INCBIN "baserom.gbc",$7b068,$7bc85 - $7b068

Unknown_7bc85: ; 7bc85 (1e:7c85)
INCBIN "baserom.gbc",$7bc85,$7bde9 - $7bc85

; known jump sources: 3adf7 (e:6df7)
Func_7bde9: ; 7bde9 (1e:7de9)
	push hl
	push de
	push bc
	ld a, [$cf91]
	push af
	ld a, [$d0b5]
	push af
	xor a
	ld [$d083], a
	ld [$c02a], a
	dec a
	ld [$c0ee], a
	call PlaySound
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, $8c
	call PlaySound
	call Delay3
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld [$FF00+$d7], a
	ld a, [$cee9]
	ld [$cf1d], a
	ld c, $0
	call Func_7beb4
	ld a, [$ceea]
	ld [$cf91], a
	ld [$d0b5], a
	call Func_7beb9
	ld de, $9000
	ld hl, $9310
	ld bc, $31
	call CopyVideoData
	ld a, [$cee9]
	ld [$cf91], a
	ld [$d0b5], a
	call Func_7beb9
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	ld a, [$cee9]
	call PlayCry
	call WaitForSoundToFinish
	ld c, $2
	ld a, $e5
	call PlayMusic
	ld c, $50
	call DelayFrames
	ld c, $1
	call Func_7beb4
	ld bc, $110
.asm_7be63
	push bc
	call asm_7befa
	jr c, .asm_7bea9
	call asm_7bec2
	pop bc
	inc b
	dec c
	dec c
	jr nz, .asm_7be63
	xor a
	ld [$ceec], a
	ld a, $31
	ld [$ceeb], a
	call Func_7bed6
	ld a, [$ceea]
.asm_7be81
	ld [$cf1d], a
	ld a, $ff
	ld [$c0ee], a
	call PlaySound
	ld a, [$cf1d]
	call PlayCry
	ld c, $0
	call Func_7beb4
	pop af
	ld [$d0b5], a
	pop af
	ld [$cf91], a
	pop bc
	pop de
	pop hl
	ld a, [$ceec]
	and a
	ret z
	scf
	ret
.asm_7bea9
	pop bc
	ld a, $1
	ld [$ceec], a
	ld a, [$cee9]
	jr .asm_7be81

; known jump sources: 7be1b (1e:7e1b), 7be5d (1e:7e5d), 7be94 (1e:7e94)
Func_7beb4: ; 7beb4 (1e:7eb4)
	ld b, $b
	jp GoPAL_SET

; known jump sources: 7be27 (1e:7e27), 7be3f (1e:7e3f)
Func_7beb9: ; 7beb9 (1e:7eb9)
	call GetMonHeader
	FuncCoord 7, 2 ; $c3cf
	ld hl, Coord
	jp LoadFlippedFrontSpriteByMonIndex
asm_7bec2: ; 7bec2 (1e:7ec2)
	ld a, $31
	ld [$ceeb], a
	call Func_7bed6
	ld a, $cf
	ld [$ceeb], a
	call Func_7bed6
	dec b
	jr nz, asm_7bec2
	ret

; known jump sources: 7be7b (1e:7e7b), 7bec7 (1e:7ec7), 7becf (1e:7ecf)
Func_7bed6: ; 7bed6 (1e:7ed6)
	push bc
	xor a
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	FuncCoord 7, 2 ; $c3cf
	ld hl, Coord
	ld bc, $707
	ld de, $d
.asm_7bee3
	push bc
.asm_7bee4
	ld a, [$ceeb]
	add [hl]
	ld [hli], a
	dec c
	jr nz, .asm_7bee4
	pop bc
	add hl, de
	dec b
	jr nz, .asm_7bee3
	ld a, $1
	ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
	call Delay3
	pop bc
	ret
asm_7befa: ; 7befa (1e:7efa)
	call DelayFrame
	push bc
	call GetJoypadStateLowSensitivity
	ld a, [$FF00+$b5]
	pop bc
	and $2
	jr nz, .asm_7bf0d
.asm_7bf08
	dec c
	jr nz, asm_7befa
	and a
	ret
.asm_7bf0d
	ld a, [$ccd4]
	and a
	jr nz, .asm_7bf08
	scf
	ret

; known jump sources: 4582f (11:582f)
Func_7bf15: ; 7bf15 (1e:7f15)
	ld de, $ffe0
	call Func_7bf64
	ld de, $240
	call Func_7bf64
	call Delay3
	ld a, $ff
	call PlaySound
	ld a, [$FF00+$af]
	ld d, a
	ld e, $1
	ld b, $64
.asm_7bf30
	ld a, e
	xor $fe
	ld e, a
	add d
	ld [$FF00+$af], a
	push bc
	ld c, $2
	ld a, $b4
	call PlayMusic
	pop bc
	ld c, $2
	call DelayFrames
	dec b
	jr nz, .asm_7bf30
	ld a, d
	ld [$FF00+$af], a
	ld a, $ff
	call PlaySound
	ld c, $2
	ld a, $b9
	call PlayMusic
.asm_7bf57
	ld a, [$c02a]
	cp $b9
	jr z, .asm_7bf57
	call UpdateSprites
	jp Func_2307

; known jump sources: 7bf18 (1e:7f18), 7bf1e (1e:7f1e)
Func_7bf64: ; 7bf64 (1e:7f64)
	ld hl, $d527
	ld a, [hld]
	push af
	ld a, [hl]
	push af
	push hl
	push hl
	ld a, [hli]
	ld h, [hl]
	ld l, a
	add hl, de
	ld a, h
	and $3
	or $98
	ld d, a
	ld a, l
	pop hl
	ld [hli], a
	ld [hl], d
	call ScheduleNorthRowRedraw
	pop hl
	pop af
	ld [hli], a
	pop af
	ld [hl], a
	jp Delay3

; known jump sources: 3819 (0:3819)
GetMachinePrice: ; 7bf86 (1e:7f86)
	ld a, [$cf91]
	sub TM_01
	ret c
	ld d, a
	ld hl, TechnicalMachinePrices ; $7fa7
	srl a
	ld c, a
	ld b, 0
	add hl, bc
	ld a, [hl]
	srl d
	jr nc, .asm_7bf9d
	swap a
.asm_7bf9d
	and $f0
	ld [H_DOWNARROWBLINKCNT2], a ; $FF00+$8c
	xor a
	ld [H_DOWNARROWBLINKCNT1], a ; $FF00+$8b
	ld [$FF00+$8d], a
	ret

TechnicalMachinePrices: ; 7bfa7 (1e:7fa7)
; In thousands (nybbles).
	db $32, $21, $34, $24, $34
	db $21, $45, $55, $32, $32
	db $55, $52, $54, $52, $41
	db $21, $12, $42, $25, $24
	db $22, $52, $24, $34, $42
; 7bfc0


SECTION "bank1F",ROMX,BANK[$1F]

Unknown_7c000: ; 7c000 (1f:4000)
INCBIN "baserom.gbc",$7c000,$7c361 - $7c000

Unknown_7c361: ; 7c361 (1f:4361)
INCBIN "baserom.gbc",$7c361,$7c45e - $7c361

IF _RED
UnknSong_md_7c45e: ; 7c45e (1f:445e)
	mus_duty duty50
		mus_note noteD, note4_16

	db $f4

		mus_note noteC, note16
		mus_note noteC, note2
		mus_note noteD, note4

	mus_octave oct3
		mus_note noteG#, note16
		mus_note noteC, note4_8_16
		mus_note noteD, note4

	mus_octave oct3
		mus_note noteRst, note16

		mus_note noteC, note4_8_16
		mus_note noteD, note4

	mus_octave oct3
		mus_note noteC, note16
		mus_note noteC, note2
		mus_note noteD, note8_16

	mus_octave oct3
		mus_note noteA#, note16
		mus_note noteC, note2

	mus_end
UnknSong_md_7c475: ; 7c475 (1f:4475)
	mus_duty duty50
		mus_note noteD, note4_16
		mus_note noteC, note2_16
		mus_note noteC, note16
		mus_note noteC, note16
		mus_note noteD, note4

	db $d4

		mus_note noteC, note8
		mus_note noteC, note2
		mus_note noteD, note4
		mus_note noteRst, note4_16

		mus_note noteG#, note8
		mus_note noteC, note4_8_16
		mus_note noteD, note4
		mus_note noteRst, note4_16

		mus_note noteRst, note8

		mus_note noteC, note4_8_16
		mus_note noteD, note4
		mus_note noteRst, note4_16

		mus_note noteC, note8
		mus_note noteC, note2
		mus_note noteD, note8_16
		mus_note noteRst, note4_16

		mus_note noteA#, note8
		mus_note noteC, note2

	mus_end
ENDC
IF _BLUE
UnknSong_md_7c45e: ; 7c45e (1f:445e)
	mus_duty duty50
		mus_note noteD, note4

	mus_octave oct3
		mus_note noteC, note16
		mus_note noteC, note4_8_16
		mus_note noteD, note4

	mus_octave oct3
		mus_note noteG#, note16
		mus_note noteC, note4_8_16
		mus_note noteD, note4

	mus_octave oct3
		mus_note noteRst, note16

		mus_note noteC, note4_8_16
		mus_note noteD, note4

	mus_octave oct3
		mus_note noteC, note16
		mus_note noteC, note2
		mus_note noteD, note1

	db $f2

	mus_octave oct7
		mus_note noteC, note2

	mus_end
UnknSong_md_7c475: ; 7c475 (1f:4475)
	mus_duty duty50
		mus_note noteD, note4
		mus_note noteC, note2_16
		mus_note noteC, note16
		mus_note noteC, note16
		mus_note noteD, note4
		mus_note noteRst, note4_16

		mus_note noteC, note8
		mus_note noteC, note4_8_16
		mus_note noteD, note4
		mus_note noteRst, note4_16

		mus_note noteG#, note8
		mus_note noteC, note4_8_16
		mus_note noteD, note4
		mus_note noteRst, note4_16

		mus_note noteRst, note8

		mus_note noteC, note4_8_16
		mus_note noteD, note4
		mus_note noteRst, note4_16

		mus_note noteC, note8
		mus_note noteC, note2
		mus_note noteD, note1

	db $d2

	mus_octave oct6
		mus_note noteC, note2

	mus_end
ENDC

INCBIN "baserom.gbc",$7c490,$7d13b - $7c490

; known jump sources: 441b0 (11:41b0)
Func_7d13b: ; 7d13b (1f:513b)
	ld a, [$FF00+$dc]
	ld c, $0
	ld hl, Unknown_7d170 ; $5170
.asm_7d142
	cp [hl]
	jr c, .asm_7d149
	inc c
	inc hl
	jr .asm_7d142
.asm_7d149
	push bc
	ld a, $ff
	ld [$c0ee], a
	call PlaySoundWaitForCurrent
	pop bc
	ld b, $0
	ld hl, Unknown_7d162 ; $5162
	add hl, bc
	add hl, bc
	ld a, [hli]
	ld c, [hl]
	call PlayMusic
	jp Func_2307

Unknown_7d162: ; 7d162 (1f:5162)
INCBIN "baserom.gbc",$7d162,$7d170 - $7d162

Unknown_7d170: ; 7d170 (1f:5170)
INCBIN "baserom.gbc",$7d170,$7d177 - $7d170

Func_7d177: ; 7d177 (1f:5177)
	ld c, $0
.asm_7d179
	ld b, $0
	ld hl, $c026
	add hl, bc
	ld a, [hl]
	and a
	jr z, .asm_7d1a5
	ld a, c
	cp $4
	jr nc, .asm_7d1a2
	ld a, [$c002]
	and a
	jr z, .asm_7d1a2
	bit 7, a
	jr nz, .asm_7d1a5
	set 7, a
	ld [$c002], a
	xor a
	ld [$FF00+$25], a
	ld [$FF00+$1a], a
	ld a, $80
	ld [$FF00+$1a], a
	jr .asm_7d1a5
.asm_7d1a2
	call Func_7d1ac
.asm_7d1a5
	ld a, c
	inc c
	cp $7
	jr nz, .asm_7d179
	ret

; known jump sources: 7d1a2 (1f:51a2)
Func_7d1ac: ; 7d1ac (1f:51ac)
	ld b, $0
	ld hl, $c0b6
	add hl, bc
	ld a, [hl]
	cp $1
	jp z, Func_7d244
	dec a
	ld [hl], a
	ld a, c
	cp $4
	jr nc, .asm_7d1c8
	ld hl, $c02a
	add hl, bc
	ld a, [hl]
	and a
	jr z, .asm_7d1c8
	ret
.asm_7d1c8
	ld hl, $c02e
	add hl, bc
	bit 6, [hl]
	jr z, .asm_7d1d3
	call Func_7d881
.asm_7d1d3
	ld b, $0
	ld hl, $c036
	add hl, bc
	bit 0, [hl]
	jr nz, .asm_7d1e5
	ld hl, $c02e
	add hl, bc
	bit 2, [hl]
	jr nz, .asm_7d1f9
.asm_7d1e5
	ld hl, $c02e
	add hl, bc
	bit 4, [hl]
	jr z, .asm_7d1f0
	jp Func_7d76d
.asm_7d1f0
	ld hl, $c04e
	add hl, bc
	ld a, [hl]
	and a
	jr z, .asm_7d1fa
	dec [hl]
.asm_7d1f9
	ret
.asm_7d1fa
	ld hl, $c056
	add hl, bc
	ld a, [hl]
	and a
	jr nz, .asm_7d203
	ret
.asm_7d203
	ld d, a
	ld hl, $c05e
	add hl, bc
	ld a, [hl]
	and $f
	and a
	jr z, .asm_7d210
	dec [hl]
	ret
.asm_7d210
	ld a, [hl]
	swap [hl]
	or [hl]
	ld [hl], a
	ld hl, $c066
	add hl, bc
	ld e, [hl]
	ld hl, $c02e
	add hl, bc
	bit 3, [hl]
	jr z, .asm_7d230
	res 3, [hl]
	ld a, d
	and $f
	ld d, a
	ld a, e
	sub d
	jr nc, .asm_7d22e
	ld a, $0
.asm_7d22e
	jr .asm_7d23c
.asm_7d230
	set 3, [hl]
	ld a, d
	and $f0
	swap a
	add e
	jr nc, .asm_7d23c
	ld a, $ff
.asm_7d23c
	ld d, a
	ld b, $3
	call Func_7d8ac
	ld [hl], d
	ret

; known jump sources: 7d1b5 (1f:51b5)
Func_7d244: ; 7d244 (1f:5244)
	ld hl, $c06e
	add hl, bc
	ld a, [hl]
	ld hl, $c04e
	add hl, bc
	ld [hl], a
	ld hl, $c02e
	add hl, bc
	res 4, [hl]
	res 5, [hl]
	call Func_7d25a
	ret

; known jump sources: 7d256 (1f:5256), 7d2b0 (1f:52b0), 7d31a (1f:531a), 7d33c (1f:533c), 7d355 (1f:5355), 7d394 (1f:5394), 7d3a6 (1f:53a6), 7d3de (1f:53de), 7d42b (1f:542b), 7d46b (1f:546b), 7d478 (1f:5478), 7d497 (1f:5497), 7d4b5 (1f:54b5), 7d4c1 (1f:54c1), 7d4d0 (1f:54d0), 7d4e3 (1f:54e3), 7d54c (1f:554c)
Func_7d25a: ; 7d25a (1f:525a)
	call Func_7d899
	ld d, a
	cp $ff
	jp nz, Func_7d2e8
	ld b, $0
	ld hl, $c02e
	add hl, bc
	bit 1, [hl]
	jr nz, .asm_7d298
	ld a, c
	cp $3
	jr nc, .asm_7d274
	jr .asm_7d2b3
.asm_7d274
	res 2, [hl]
	ld hl, $c036
	add hl, bc
	res 0, [hl]
	cp $6
	jr nz, .asm_7d288
	ld a, $0
	ld [$FF00+$1a], a
	ld a, $80
	ld [$FF00+$1a], a
.asm_7d288
	jr nz, .asm_7d296
	ld a, [$c003]
	and a
	jr z, .asm_7d296
	xor a
	ld [$c003], a
	jr .asm_7d2b3
.asm_7d296
	jr .asm_7d2bc
.asm_7d298
	res 1, [hl]
	ld d, $0
	ld a, c
	add a
	ld e, a
	ld hl, $c006
	add hl, de
	push hl
	ld hl, $c016
	add hl, de
	ld e, l
	ld d, h
	pop hl
	ld a, [de]
	ld [hli], a
	inc de
	ld a, [de]
	ld [hl], a
	jp Func_7d25a
.asm_7d2b3
	ld hl, Unknown_7db93 ; $5b93
	add hl, bc
	ld a, [$FF00+$25]
	and [hl]
	ld [$FF00+$25], a
.asm_7d2bc
	ld a, [$c02a]
	cp $14
	jr nc, .asm_7d2c5
	jr .asm_7d2e2
.asm_7d2c5
	ld a, [$c02a]
	cp $86
	jr z, .asm_7d2e2
	jr c, .asm_7d2d0
	jr .asm_7d2e2
.asm_7d2d0
	ld a, c
	cp $4
	jr z, .asm_7d2d9
	call Func_7d73b
	ret c
.asm_7d2d9
	ld a, [$c005]
	ld [$FF00+$24], a
	xor a
	ld [$c005], a
.asm_7d2e2
	ld hl, $c026
	add hl, bc
	ld [hl], b
	ret

; known jump sources: 7d260 (1f:5260)
Func_7d2e8: ; 7d2e8 (1f:52e8)
	cp $fd
	jp nz, Func_7d31d
	call Func_7d899
	push af
	call Func_7d899
	ld d, a
	pop af
	ld e, a
	push de
	ld d, $0
	ld a, c
	add a
	ld e, a
	ld hl, $c006
	add hl, de
	push hl
	ld hl, $c016
	add hl, de
	ld e, l
	ld d, h
	pop hl
	ld a, [hli]
	ld [de], a
	inc de
	ld a, [hld]
	ld [de], a
	pop de
	ld [hl], e
	inc hl
	ld [hl], d
	ld b, $0
	ld hl, $c02e
	add hl, bc
	set 1, [hl]
	jp Func_7d25a

; known jump sources: 7d2ea (1f:52ea)
Func_7d31d: ; 7d31d (1f:531d)
	cp $fe
	jp nz, Func_7d358
	call Func_7d899
	ld e, a
	and a
	jr z, .asm_7d341
	ld b, $0
	ld hl, $c0be
	add hl, bc
	ld a, [hl]
	cp e
	jr nz, .asm_7d33f
	ld a, $1
	ld [hl], a
	call Func_7d899
	call Func_7d899
	jp Func_7d25a
.asm_7d33f
	inc a
	ld [hl], a
.asm_7d341
	call Func_7d899
	push af
	call Func_7d899
	ld b, a
	ld d, $0
	ld a, c
	add a
	ld e, a
	ld hl, $c006
	add hl, de
	pop af
	ld [hli], a
	ld [hl], b
	jp Func_7d25a

; known jump sources: 7d31f (1f:531f)
Func_7d358: ; 7d358 (1f:5358)
	and $f0
	cp $d0
	jp nz, Func_7d397
	ld a, d
	and $f
	ld b, $0
	ld hl, $c0c6
	add hl, bc
	ld [hl], a
	ld a, c
	cp $3
	jr z, .asm_7d394
	call Func_7d899
	ld d, a
	ld a, c
	cp $2
	jr z, .asm_7d380
	cp $6
	jr nz, .asm_7d38d
	ld hl, $c0e7
	jr .asm_7d383
.asm_7d380
	ld hl, $c0e6
.asm_7d383
	ld a, d
	and $f
	ld [hl], a
	ld a, d
	and $30
	sla a
	ld d, a
.asm_7d38d
	ld b, $0
	ld hl, $c0de
	add hl, bc
	ld [hl], d
.asm_7d394
	jp Func_7d25a

; known jump sources: 7d35c (1f:535c)
Func_7d397: ; 7d397 (1f:5397)
	ld a, d
	cp $e8
	jr nz, .asm_7d3a9
	ld b, $0
	ld hl, $c02e
	add hl, bc
	ld a, [hl]
	xor $1
	ld [hl], a
	jp Func_7d25a
.asm_7d3a9
	cp $ea
	jr nz, .asm_7d3e1
	call Func_7d899
	ld b, $0
	ld hl, $c04e
	add hl, bc
	ld [hl], a
	ld hl, $c06e
	add hl, bc
	ld [hl], a
	call Func_7d899
	ld d, a
	and $f0
	swap a
	ld b, $0
	ld hl, $c056
	add hl, bc
	srl a
	ld e, a
	adc b
	swap a
	or e
	ld [hl], a
	ld a, d
	and $f
	ld d, a
	ld hl, $c05e
	add hl, bc
	swap a
	or d
	ld [hl], a
	jp Func_7d25a
.asm_7d3e1
	cp $eb
	jr nz, .asm_7d419
	call Func_7d899
	ld b, $0
	ld hl, $c076
	add hl, bc
	ld [hl], a
	call Func_7d899
	ld d, a
	and $f0
	swap a
	ld b, a
	ld a, d
	and $f
	call Func_7d8cc
	ld b, $0
	ld hl, $c0a6
	add hl, bc
	ld [hl], d
	ld hl, $c0ae
	add hl, bc
	ld [hl], e
	ld b, $0
	ld hl, $c02e
	add hl, bc
	set 4, [hl]
	call Func_7d899
	ld d, a
	jp Func_7d57e
.asm_7d419
	cp $ec
	jr nz, .asm_7d42e
	call Func_7d899
	rrca
	rrca
	and $c0
	ld b, $0
	ld hl, $c03e
	add hl, bc
	ld [hl], a
	jp Func_7d25a
.asm_7d42e
	cp $ed
	jr nz, .asm_7d46e
	ld a, c
	cp $4
	jr nc, .asm_7d452
	call Func_7d899
	ld [$c0e8], a
	call Func_7d899
	ld [$c0e9], a
	xor a
	ld [$c0ce], a
	ld [$c0cf], a
	ld [$c0d0], a
	ld [$c0d1], a
	jr .asm_7d46b
.asm_7d452
	call Func_7d899
	ld [$c0ea], a
	call Func_7d899
	ld [$c0eb], a
	xor a
	ld [$c0d2], a
	ld [$c0d3], a
	ld [$c0d4], a
	ld [$c0d5], a
.asm_7d46b
	jp Func_7d25a
.asm_7d46e
	cp $ee
	jr nz, .asm_7d47b
	call Func_7d899
	ld [$c004], a
	jp Func_7d25a
.asm_7d47b
	cp $ef
	jr nz, .asm_7d49a
	call Func_7d899
	push bc
	call Func_7d8ea
	pop bc
	ld a, [$c003]
	and a
	jr nz, .asm_7d497
	ld a, [$c02d]
	ld [$c003], a
	xor a
	ld [$c02d], a
.asm_7d497
	jp Func_7d25a
.asm_7d49a
	cp $fc
	jr nz, .asm_7d4b8
	call Func_7d899
	ld b, $0
	ld hl, $c046
	add hl, bc
	ld [hl], a
	and $c0
	ld hl, $c03e
	add hl, bc
	ld [hl], a
	ld hl, $c02e
	add hl, bc
	set 6, [hl]
	jp Func_7d25a
.asm_7d4b8
	cp $f0
	jr nz, .asm_7d4c4
	call Func_7d899
	ld [$FF00+$24], a
	jp Func_7d25a
.asm_7d4c4
	cp $f8
	jr nz, .asm_7d4d3
	ld b, $0
	ld hl, $c036
	add hl, bc
	set 0, [hl]
	jp Func_7d25a
.asm_7d4d3
	and $f0
	cp $e0
	jr nz, .asm_7d4e6
	ld hl, $c0d6
	ld b, $0
	add hl, bc
	ld a, d
	and $f
	ld [hl], a
	jp Func_7d25a
.asm_7d4e6
	cp $20
	jr nz, .asm_7d533
	ld a, c
	cp $3
	jr c, .asm_7d533
	ld b, $0
	ld hl, $c036
	add hl, bc
	bit 0, [hl]
	jr nz, .asm_7d533
	call Func_7d57e
	ld d, a
	ld b, $0
	ld hl, $c03e
	add hl, bc
	ld a, [hl]
	or d
	ld d, a
	ld b, $1
	call Func_7d8ac
	ld [hl], d
	call Func_7d899
	ld d, a
	ld b, $2
	call Func_7d8ac
	ld [hl], d
	call Func_7d899
	ld e, a
	ld a, c
	cp $7
	ld a, $0
	jr z, .asm_7d526
	push de
	call Func_7d899
	pop de
.asm_7d526
	ld d, a
	push de
	call Func_7d69d
	call Func_7d66c
	pop de
	call Func_7d6bf
	ret
.asm_7d533
	ld a, c
	cp $4
	jr c, .asm_7d54f
	ld a, d
	cp $10
	jr nz, .asm_7d54f
	ld b, $0
	ld hl, $c036
	add hl, bc
	bit 0, [hl]
	jr nz, .asm_7d54f
	call Func_7d899
	ld [$FF00+$10], a
	jp Func_7d25a
.asm_7d54f
	ld a, c
	cp $3
	jr nz, Func_7d57e
	ld a, d
	and $f0
	cp $b0
	jr z, .asm_7d569
	jr nc, Func_7d57e
	swap a
	ld b, a
	ld a, d
	and $f
	ld d, a
	ld a, b
	push de
	push bc
	jr .asm_7d571
.asm_7d569
	ld a, d
	and $f
	push af
	push bc
	call Func_7d899
.asm_7d571
	ld d, a
	ld a, [$c003]
	and a
	jr nz, .asm_7d57c
	ld a, d
	call Func_7d8ea
.asm_7d57c
	pop bc
	pop de

; known jump sources: 7d416 (1f:5416), 7d4f9 (1f:54f9), 7d552 (1f:5552), 7d55b (1f:555b)
Func_7d57e: ; 7d57e (1f:557e)
	ld a, d
	push af
	and $f
	inc a
	ld b, $0
	ld e, a
	ld d, b
	ld hl, $c0c6
	add hl, bc
	ld a, [hl]
	ld l, b
	call Func_7d8bb
	ld a, c
	cp $4
	jr nc, .asm_7d59f
	ld a, [$c0e8]
	ld d, a
	ld a, [$c0e9]
	ld e, a
	jr .asm_7d5b2
.asm_7d59f
	ld d, $1
	ld e, $0
	cp $7
	jr z, .asm_7d5b2
	call Func_7d707
	ld a, [$c0ea]
	ld d, a
	ld a, [$c0eb]
	ld e, a
.asm_7d5b2
	ld a, l
	ld b, $0
	ld hl, $c0ce
	add hl, bc
	ld l, [hl]
	call Func_7d8bb
	ld e, l
	ld d, h
	ld hl, $c0ce
	add hl, bc
	ld [hl], e
	ld a, d
	ld hl, $c0b6
	add hl, bc
	ld [hl], a
	ld hl, $c036
	add hl, bc
	bit 0, [hl]
	jr nz, .asm_7d5dc
	ld hl, $c02e
	add hl, bc
	bit 2, [hl]
	jr z, .asm_7d5dc
	pop hl
	ret
.asm_7d5dc
	pop af
	and $f0
	cp $c0
	jr nz, .asm_7d613
	ld a, c
	cp $4
	jr nc, .asm_7d5f0
	ld hl, $c02a
	add hl, bc
	ld a, [hl]
	and a
	jr nz, .asm_7d612
.asm_7d5f0
	ld a, c
	cp $2
	jr z, .asm_7d5f9
	cp $6
	jr nz, .asm_7d606
.asm_7d5f9
	ld b, $0
	ld hl, Unknown_7db93 ; $5b93
	add hl, bc
	ld a, [$FF00+$25]
	and [hl]
	ld [$FF00+$25], a
	jr .asm_7d612
.asm_7d606
	ld b, $2
	call Func_7d8ac
	ld a, $8
	ld [hli], a
	inc hl
	ld a, $80
	ld [hl], a
.asm_7d612
	ret
.asm_7d613
	swap a
	ld b, $0
	ld hl, $c0d6
	add hl, bc
	ld b, [hl]
	call Func_7d8cc
	ld b, $0
	ld hl, $c02e
	add hl, bc
	bit 4, [hl]
	jr z, .asm_7d62c
	call Func_7d803
.asm_7d62c
	push de
	ld a, c
	cp $4
	jr nc, .asm_7d641
	ld hl, $c02a
	ld d, $0
	ld e, a
	add hl, de
	ld a, [hl]
	and a
	jr nz, .asm_7d63f
	jr .asm_7d641
.asm_7d63f
	pop de
	ret
.asm_7d641
	ld b, $0
	ld hl, $c0de
	add hl, bc
	ld d, [hl]
	ld b, $2
	call Func_7d8ac
	ld [hl], d
	call Func_7d69d
	call Func_7d66c
	pop de
	ld b, $0
	ld hl, $c02e
	add hl, bc
	bit 0, [hl]
	jr z, .asm_7d663
	inc e
	jr nc, .asm_7d663
	inc d
.asm_7d663
	ld hl, $c066
	add hl, bc
	ld [hl], e
	call Func_7d6bf
	ret

; known jump sources: 7d52b (1f:552b), 7d651 (1f:5651)
Func_7d66c: ; 7d66c (1f:566c)
	ld b, $0
	ld hl, Unknown_7db9b ; $5b9b
	add hl, bc
	ld a, [$FF00+$25]
	or [hl]
	ld d, a
	ld a, c
	cp $7
	jr z, .asm_7d687
	cp $4
	jr nc, .asm_7d699
	ld hl, $c02a
	add hl, bc
	ld a, [hl]
	and a
	jr nz, .asm_7d699
.asm_7d687
	ld a, [$c004]
	ld hl, Unknown_7db9b ; $5b9b
	add hl, bc
	and [hl]
	ld d, a
	ld a, [$FF00+$25]
	ld hl, Unknown_7db93 ; $5b93
	add hl, bc
	and [hl]
	or d
	ld d, a
.asm_7d699
	ld a, d
	ld [$FF00+$25], a
	ret

; known jump sources: 7d528 (1f:5528), 7d64e (1f:564e)
Func_7d69d: ; 7d69d (1f:569d)
	ld b, $0
	ld hl, $c0b6
	add hl, bc
	ld d, [hl]
	ld a, c
	cp $2
	jr z, .asm_7d6b8
	cp $6
	jr z, .asm_7d6b8
	ld a, d
	and $3f
	ld d, a
	ld hl, $c03e
	add hl, bc
	ld a, [hl]
	or d
	ld d, a
.asm_7d6b8
	ld b, $1
	call Func_7d8ac
	ld [hl], d
	ret

; known jump sources: 7d52f (1f:552f), 7d668 (1f:5668)
Func_7d6bf: ; 7d6bf (1f:56bf)
	ld a, c
	cp $2
	jr z, .asm_7d6c8
	cp $6
	jr nz, .asm_7d6f5
.asm_7d6c8
	push de
	ld de, $c0e6
	cp $2
	jr z, .asm_7d6d3
	ld de, $c0e7
.asm_7d6d3
	ld a, [de]
	add a
	ld d, $0
	ld e, a
	ld hl, Unknown_7c361 ; $4361
	add hl, de
	ld e, [hl]
	inc hl
	ld d, [hl]
	ld hl, $ff30
	ld b, $f
	ld a, $0
	ld [$FF00+$1a], a
.asm_7d6e8
	ld a, [de]
	inc de
	ld [hli], a
	ld a, b
	dec b
	and a
	jr nz, .asm_7d6e8
	ld a, $80
	ld [$FF00+$1a], a
	pop de
.asm_7d6f5
	ld a, d
	or $80
	and $c7
	ld d, a
	ld b, $3
	call Func_7d8ac
	ld [hl], e
	inc hl
	ld [hl], d
	call Func_7d729
	ret

; known jump sources: 7d5a7 (1f:55a7)
Func_7d707: ; 7d707 (1f:5707)
	call Func_7d759
	jr nc, .asm_7d71f
	ld d, $0
	ld a, [$c0f2]
	add $80
	jr nc, .asm_7d716
	inc d
.asm_7d716
	ld [$c0eb], a
	ld a, d
	ld [$c0ea], a
	jr .asm_7d728
.asm_7d71f
	xor a
	ld [$c0eb], a
	ld a, $1
	ld [$c0ea], a
.asm_7d728
	ret

; known jump sources: 7d703 (1f:5703)
Func_7d729: ; 7d729 (1f:5729)
	call Func_7d759
	jr nc, .asm_7d73a
	ld a, [$c0f1]
	add e
	jr nc, .asm_7d735
	inc d
.asm_7d735
	dec hl
	ld e, a
	ld [hl], e
	inc hl
	ld [hl], d
.asm_7d73a
	ret

; known jump sources: 7d2d5 (1f:52d5)
Func_7d73b: ; 7d73b (1f:573b)
	call Func_7d759
	jr nc, .asm_7d756
	ld hl, $c006
	ld e, c
	ld d, $0
	sla e
	rl d
	add hl, de
	ld a, [hl]
	sub $1
	ld [hl], a
	inc hl
	ld a, [hl]
	sbc $0
	ld [hl], a
	scf
	ret
.asm_7d756
	scf
	ccf
	ret

; known jump sources: 7d707 (1f:5707), 7d729 (1f:5729), 7d73b (1f:573b)
Func_7d759: ; 7d759 (1f:5759)
	ld a, [$c02a]
	cp $14
	jr nc, .asm_7d762
	jr .asm_7d768
.asm_7d762
	cp $86
	jr z, .asm_7d768
	jr c, .asm_7d76b
.asm_7d768
	scf
	ccf
	ret
.asm_7d76b
	scf
	ret

; known jump sources: 7d1ed (1f:51ed)
Func_7d76d: ; 7d76d (1f:576d)
	ld hl, $c02e
	add hl, bc
	bit 5, [hl]
	jp nz, Func_7d7b4
	ld hl, $c09e
	add hl, bc
	ld e, [hl]
	ld hl, $c096
	add hl, bc
	ld d, [hl]
	ld hl, $c07e
	add hl, bc
	ld l, [hl]
	ld h, b
	add hl, de
	ld d, h
	ld e, l
	ld hl, $c08e
	add hl, bc
	push hl
	ld hl, $c086
	add hl, bc
	ld a, [hl]
	pop hl
	add [hl]
	ld [hl], a
	ld a, $0
	adc e
	ld e, a
	ld a, $0
	adc d
	ld d, a
	ld hl, $c0a6
	add hl, bc
	ld a, [hl]
	cp d
	jp c, Func_7d7fa
	jr nz, asm_7d7e7
	ld hl, $c0ae
	add hl, bc
	ld a, [hl]
	cp e
	jp c, Func_7d7fa
	jr asm_7d7e7

; known jump sources: 7d773 (1f:5773)
Func_7d7b4: ; 7d7b4 (1f:57b4)
	ld hl, $c09e
	add hl, bc
	ld a, [hl]
	ld hl, $c096
	add hl, bc
	ld d, [hl]
	ld hl, $c07e
	add hl, bc
	ld e, [hl]
	sub e
	ld e, a
	ld a, d
	sbc b
	ld d, a
	ld hl, $c086
	add hl, bc
	ld a, [hl]
	add a
	ld [hl], a
	ld a, e
	sbc b
	ld e, a
	ld a, d
	sbc b
	ld d, a
	ld hl, $c0a6
	add hl, bc
	ld a, d
	cp [hl]
	jr c, Func_7d7fa
	jr nz, asm_7d7e7
	ld hl, $c0ae
	add hl, bc
	ld a, e
	cp [hl]
	jr c, Func_7d7fa
asm_7d7e7: ; 7d7e7 (1f:57e7)
	ld hl, $c09e
	add hl, bc
	ld [hl], e
	ld hl, $c096
	add hl, bc
	ld [hl], d
	ld b, $3
	call Func_7d8ac
	ld a, e
	ld [hli], a
	ld [hl], d
	ret

; known jump sources: 7d7a4 (1f:57a4), 7d7af (1f:57af), 7d7db (1f:57db), 7d7e5 (1f:57e5)
Func_7d7fa: ; 7d7fa (1f:57fa)
	ld hl, $c02e
	add hl, bc
	res 4, [hl]
	res 5, [hl]
	ret

; known jump sources: 7d629 (1f:5629)
Func_7d803: ; 7d803 (1f:5803)
	ld hl, $c096
	add hl, bc
	ld [hl], d
	ld hl, $c09e
	add hl, bc
	ld [hl], e
	ld hl, $c0b6
	add hl, bc
	ld a, [hl]
	ld hl, $c076
	add hl, bc
	sub [hl]
	jr nc, .asm_7d81b
	ld a, $1
.asm_7d81b
	ld [hl], a
	ld hl, $c0ae
	add hl, bc
	ld a, e
	sub [hl]
	ld e, a
	ld a, d
	sbc b
	ld hl, $c0a6
	add hl, bc
	sub [hl]
	jr c, .asm_7d837
	ld d, a
	ld b, $0
	ld hl, $c02e
	add hl, bc
	set 5, [hl]
	jr .asm_7d85a
.asm_7d837
	ld hl, $c096
	add hl, bc
	ld d, [hl]
	ld hl, $c09e
	add hl, bc
	ld e, [hl]
	ld hl, $c0ae
	add hl, bc
	ld a, [hl]
	sub e
	ld e, a
	ld a, d
	sbc b
	ld d, a
	ld hl, $c0a6
	add hl, bc
	ld a, [hl]
	sub d
	ld d, a
	ld b, $0
	ld hl, $c02e
	add hl, bc
	res 5, [hl]
.asm_7d85a
	ld hl, $c076
	add hl, bc
.asm_7d85e
	inc b
	ld a, e
	sub [hl]
	ld e, a
	jr nc, .asm_7d85e
	ld a, d
	and a
	jr z, .asm_7d86c
	dec a
	ld d, a
	jr .asm_7d85e
.asm_7d86c
	ld a, e
	add [hl]
	ld d, b
	ld b, $0
	ld hl, $c07e
	add hl, bc
	ld [hl], d
	ld hl, $c086
	add hl, bc
	ld [hl], a
	ld hl, $c08e
	add hl, bc
	ld [hl], a
	ret

; known jump sources: 7d1d0 (1f:51d0)
Func_7d881: ; 7d881 (1f:5881)
	ld b, $0
	ld hl, $c046
	add hl, bc
	ld a, [hl]
	rlca
	rlca
	ld [hl], a
	and $c0
	ld d, a
	ld b, $1
	call Func_7d8ac
	ld a, [hl]
	and $3f
	or d
	ld [hl], a
	ret

; known jump sources: 7d25a (1f:525a), 7d2ed (1f:52ed), 7d2f1 (1f:52f1), 7d322 (1f:5322), 7d336 (1f:5336), 7d339 (1f:5339), 7d341 (1f:5341), 7d345 (1f:5345), 7d36e (1f:536e), 7d3ad (1f:53ad), 7d3bc (1f:53bc), 7d3e5 (1f:53e5), 7d3ef (1f:53ef), 7d412 (1f:5412), 7d41d (1f:541d), 7d437 (1f:5437), 7d43d (1f:543d), 7d452 (1f:5452), 7d458 (1f:5458), 7d472 (1f:5472), 7d47f (1f:547f), 7d49e (1f:549e), 7d4bc (1f:54bc), 7d50c (1f:550c), 7d516 (1f:5516), 7d522 (1f:5522), 7d547 (1f:5547), 7d56e (1f:556e)
Func_7d899: ; 7d899 (1f:5899)
	ld d, $0
	ld a, c
	add a
	ld e, a
	ld hl, $c006
	add hl, de
	ld a, [hli]
	ld e, a
	ld a, [hld]
	ld d, a
	ld a, [de]
	inc de
	ld [hl], e
	inc hl
	ld [hl], d
	ret

; known jump sources: 7d23f (1f:523f), 7d508 (1f:5508), 7d512 (1f:5512), 7d608 (1f:5608), 7d64a (1f:564a), 7d6ba (1f:56ba), 7d6fd (1f:56fd), 7d7f3 (1f:57f3), 7d890 (1f:5890)
Func_7d8ac: ; 7d8ac (1f:58ac)
	ld a, c
	ld hl, Unknown_7db8b ; $5b8b
	add l
	jr nc, .asm_7d8b4
	inc h
.asm_7d8b4
	ld l, a
	ld a, [hl]
	add b
	ld l, a
	ld h, $ff
	ret

; known jump sources: 7d58d (1f:558d), 7d5ba (1f:55ba)
Func_7d8bb: ; 7d8bb (1f:58bb)
	ld h, $0
.asm_7d8bd
	srl a
	jr nc, .asm_7d8c2
	add hl, de
.asm_7d8c2
	sla e
	rl d
	and a
	jr z, .asm_7d8cb
	jr .asm_7d8bd
.asm_7d8cb
	ret

; known jump sources: 7d3fb (1f:53fb), 7d61c (1f:561c)
Func_7d8cc: ; 7d8cc (1f:58cc)
	ld h, $0
	ld l, a
	add hl, hl
	ld d, h
	ld e, l
	ld hl, Unknown_7dba3 ; $5ba3
	add hl, de
	ld e, [hl]
	inc hl
	ld d, [hl]
	ld a, b
.asm_7d8da
	cp $7
	jr z, .asm_7d8e5
	sra d
	rr e
	inc a
	jr .asm_7d8da
.asm_7d8e5
	ld a, $8
	add d
	ld d, a
	ret

; known jump sources: 7d483 (1f:5483), 7d579 (1f:5579)
Func_7d8ea: ; 7d8ea (1f:58ea)
	ld [$c001], a
	cp $ff
	jp z, Func_7daa8
	cp $c2
	jp z, Func_7d9c2
	jp c, Func_7d9c2
	cp $fe
	jr z, .asm_7d901
	jp nc, Func_7d9c2
.asm_7d901
	xor a
	ld [$c000], a
	ld [$c003], a
	ld [$c0e9], a
	ld [$c0e6], a
	ld [$c0e7], a
	ld d, $8
	ld hl, $c016
	call Func_7dafd
	ld hl, $c006
	call Func_7dafd
	ld d, $4
	ld hl, $c026
	call Func_7dafd
	ld hl, $c02e
	call Func_7dafd
	ld hl, $c03e
	call Func_7dafd
	ld hl, $c046
	call Func_7dafd
	ld hl, $c04e
	call Func_7dafd
	ld hl, $c056
	call Func_7dafd
	ld hl, $c05e
	call Func_7dafd
	ld hl, $c066
	call Func_7dafd
	ld hl, $c06e
	call Func_7dafd
	ld hl, $c036
	call Func_7dafd
	ld hl, $c076
	call Func_7dafd
	ld hl, $c07e
	call Func_7dafd
	ld hl, $c086
	call Func_7dafd
	ld hl, $c08e
	call Func_7dafd
	ld hl, $c096
	call Func_7dafd
	ld hl, $c09e
	call Func_7dafd
	ld hl, $c0a6
	call Func_7dafd
	ld hl, $c0ae
	call Func_7dafd
	ld a, $1
	ld hl, $c0be
	call Func_7dafd
	ld hl, $c0b6
	call Func_7dafd
	ld hl, $c0c6
	call Func_7dafd
	ld [$c0e8], a
	ld a, $ff
	ld [$c004], a
	xor a
	ld [$FF00+$24], a
	ld a, $8
	ld [$FF00+$10], a
	ld a, $0
	ld [$FF00+$25], a
	xor a
	ld [$FF00+$1a], a
	ld a, $80
	ld [$FF00+$1a], a
	ld a, $77
	ld [$FF00+$24], a
	jp Func_7db03

; known jump sources: 7d8f4 (1f:58f4), 7d8f7 (1f:58f7), 7d8fe (1f:58fe)
Func_7d9c2: ; 7d9c2 (1f:59c2)
	ld l, a
	ld e, a
	ld h, $0
	ld d, h
	add hl, hl
	add hl, de
	ld de, Unknown_7c000 ; $4000
	add hl, de
	ld a, h
	ld [$c0ec], a
	ld a, l
	ld [$c0ed], a
	ld a, [hl]
	and $c0
	rlca
	rlca
	ld c, a

; known jump sources: 7daa5 (1f:5aa5)
Func_7d9db: ; 7d9db (1f:59db)
	ld d, c
	ld a, c
	add a
	add c
	ld c, a
	ld b, $0
	ld a, [$c0ec]
	ld h, a
	ld a, [$c0ed]
	ld l, a
	add hl, bc
	ld c, d
	ld a, [hl]
	and $f
	ld e, a
	ld d, $0
	ld hl, $c026
	add hl, de
	ld a, [hl]
	and a
	jr z, .asm_7da17
	ld a, e
	cp $7
	jr nz, .asm_7da0e
	ld a, [$c001]
	cp $14
	jr nc, .asm_7da07
	ret
.asm_7da07
	ld a, [hl]
	cp $14
	jr z, .asm_7da17
	jr c, .asm_7da17
.asm_7da0e
	ld a, [$c001]
	cp [hl]
	jr z, .asm_7da17
	jr c, .asm_7da17
	ret
.asm_7da17
	xor a
	push de
	ld h, d
	ld l, e
	add hl, hl
	ld d, h
	ld e, l
	ld hl, $c016
	add hl, de
	ld [hli], a
	ld [hl], a
	ld hl, $c006
	add hl, de
	ld [hli], a
	ld [hl], a
	pop de
	ld hl, $c026
	add hl, de
	ld [hl], a
	ld hl, $c02e
	add hl, de
	ld [hl], a
	ld hl, $c03e
	add hl, de
	ld [hl], a
	ld hl, $c046
	add hl, de
	ld [hl], a
	ld hl, $c04e
	add hl, de
	ld [hl], a
	ld hl, $c056
	add hl, de
	ld [hl], a
	ld hl, $c05e
	add hl, de
	ld [hl], a
	ld hl, $c066
	add hl, de
	ld [hl], a
	ld hl, $c06e
	add hl, de
	ld [hl], a
	ld hl, $c076
	add hl, de
	ld [hl], a
	ld hl, $c07e
	add hl, de
	ld [hl], a
	ld hl, $c086
	add hl, de
	ld [hl], a
	ld hl, $c08e
	add hl, de
	ld [hl], a
	ld hl, $c096
	add hl, de
	ld [hl], a
	ld hl, $c09e
	add hl, de
	ld [hl], a
	ld hl, $c0a6
	add hl, de
	ld [hl], a
	ld hl, $c0ae
	add hl, de
	ld [hl], a
	ld hl, $c036
	add hl, de
	ld [hl], a
	ld a, $1
	ld hl, $c0be
	add hl, de
	ld [hl], a
	ld hl, $c0b6
	add hl, de
	ld [hl], a
	ld hl, $c0c6
	add hl, de
	ld [hl], a
	ld a, e
	cp $4
	jr nz, .asm_7da9f
	ld a, $8
	ld [$FF00+$10], a
.asm_7da9f
	ld a, c
	and a
	jp z, Func_7db03
	dec c
	jp Func_7d9db

; known jump sources: 7d8ef (1f:58ef)
Func_7daa8: ; 7daa8 (1f:5aa8)
	ld a, $80
	ld [$FF00+$26], a
	ld [$FF00+$1a], a
	xor a
	ld [$FF00+$25], a
	ld [$FF00+$1c], a
	ld a, $8
	ld [$FF00+$10], a
	ld [$FF00+$12], a
	ld [$FF00+$17], a
	ld [$FF00+$21], a
	ld a, $40
	ld [$FF00+$14], a
	ld [$FF00+$19], a
	ld [$FF00+$23], a
	ld a, $77
	ld [$FF00+$24], a
	xor a
	ld [$c000], a
	ld [$c003], a
	ld [$c002], a
	ld [$c0e9], a
	ld [$c0eb], a
	ld [$c0e6], a
	ld [$c0e7], a
	ld d, $a0
	ld hl, $c006
	call Func_7dafd
	ld a, $1
	ld d, $18
	ld hl, $c0b6
	call Func_7dafd
	ld [$c0e8], a
	ld [$c0ea], a
	ld a, $ff
	ld [$c004], a
	ret

; known jump sources: 7d916 (1f:5916), 7d91c (1f:591c), 7d924 (1f:5924), 7d92a (1f:592a), 7d930 (1f:5930), 7d936 (1f:5936), 7d93c (1f:593c), 7d942 (1f:5942), 7d948 (1f:5948), 7d94e (1f:594e), 7d954 (1f:5954), 7d95a (1f:595a), 7d960 (1f:5960), 7d966 (1f:5966), 7d96c (1f:596c), 7d972 (1f:5972), 7d978 (1f:5978), 7d97e (1f:597e), 7d984 (1f:5984), 7d98a (1f:598a), 7d992 (1f:5992), 7d998 (1f:5998), 7d99e (1f:599e), 7dae4 (1f:5ae4), 7daee (1f:5aee)
Func_7dafd: ; 7dafd (1f:5afd)
	ld b, d
.asm_7dafe
	ld [hli], a
	dec b
	jr nz, .asm_7dafe
	ret

; known jump sources: 7d9bf (1f:59bf), 7daa1 (1f:5aa1)
Func_7db03: ; 7db03 (1f:5b03)
	ld a, [$c001]
	ld l, a
	ld e, a
	ld h, $0
	ld d, h
	add hl, hl
	add hl, de
	ld de, Unknown_7c000 ; $4000
	add hl, de
	ld e, l
	ld d, h
	ld hl, $c006
	ld a, [de]
	ld b, a
	rlca
	rlca
	and $3
	ld c, a
	ld a, b
	and $f
	ld b, c
	inc b
	inc de
	ld c, $0
.asm_7db25
	cp c
	jr z, .asm_7db2d
	inc c
	inc hl
	inc hl
	jr .asm_7db25
.asm_7db2d
	push hl
	push bc
	push af
	ld b, $0
	ld c, a
	ld hl, $c026
	add hl, bc
	ld a, [$c001]
	ld [hl], a
	pop af
	cp $3
	jr c, .asm_7db46
	ld hl, $c02e
	add hl, bc
	set 2, [hl]
.asm_7db46
	pop bc
	pop hl
	ld a, [de]
	ld [hli], a
	inc de
	ld a, [de]
	ld [hli], a
	inc de
	inc c
	dec b
	ld a, b
	and a
	ld a, [de]
	inc de
	jr nz, .asm_7db25
	ld a, [$c001]
	cp $14
	jr nc, .asm_7db5f
	jr .asm_7db89
.asm_7db5f
	ld a, [$c001]
	cp $86
	jr z, .asm_7db89
	jr c, .asm_7db6a
	jr .asm_7db89
.asm_7db6a
	ld hl, $c02a
	ld [hli], a
	ld [hli], a
	ld [hli], a
	ld [hl], a
	ld hl, $c012
	ld de, Unknown_7db8a ; $5b8a
	ld [hl], e
	inc hl
	ld [hl], d
	ld a, [$c005]
	and a
	jr nz, .asm_7db89
	ld a, [$FF00+$24]
	ld [$c005], a
	ld a, $77
	ld [$FF00+$24], a
.asm_7db89
	ret

Unknown_7db8a: ; 7db8a (1f:5b8a)
INCBIN "baserom.gbc",$7db8a,$7db8b - $7db8a

Unknown_7db8b: ; 7db8b (1f:5b8b)
INCBIN "baserom.gbc",$7db8b,$7db93 - $7db8b

Unknown_7db93: ; 7db93 (1f:5b93)
INCBIN "baserom.gbc",$7db93,$7db9b - $7db93

Unknown_7db9b: ; 7db9b (1f:5b9b)
INCBIN "baserom.gbc",$7db9b,$7dba3 - $7db9b

Unknown_7dba3: ; 7dba3 (1f:5ba3)
INCBIN "baserom.gbc",$7dba3,$80000 - $7dba3

SECTION "bank20",ROMX,BANK[$20]

UnnamedText_80000: ; 80000 (20:4000)
	db $0, "Bingo!@@"
; 0xa80009

_UnnamedText_526f3: ; 80009 (20:4009)
	db $0, $4f
	db "The CARD KEY", $55
	db "opened the door!", $57
; 0x80009 + 32 bytes

_UnnamedText_526f8: ; 80029 (20:4029)
	db $0, "Darn! It needs a", $4f
	db "CARD KEY!", $57
; 0x80029 + 28 bytes

_UnnamedText_33cf: ; 80045 (20:4045)
	TX_RAM $cd6d
	db $0, ": @@"
; 0xa8004d

_UnnamedText_70847: ; 8004d (20:404d)
	db $0, "Not even a nibble!", $58
; 0x8004d + 20 bytes

_UnnamedText_7084c: ; 80061 (20:4061)
	db $0, "Looks like there's", $4f
	db "nothing here.", $58
; 0x80061 + 33 bytes

_UnnamedText_70851: ; 80082 (20:4082)
	db $0, "Oh!", $4f
	db "It's a bite!", $58
; 0x80082 + 17 bytes

_UnnamedText_24db: ; 80093 (20:4093)
	db $0, "!", $57
; 0x80093 + 3 bytes

_UnnamedText_24e0: ; 80096 (20:4096)
	db $0, "Ground rose up", $4f
	db "somewhere!", $57
; 0x80096 + 27 bytes

_BoulderText: ; 800b1 (20:40b1)
	db $0, "This requires", $4f
	db "STRENGTH to move!", $57

_MartSignText: ; 800d2 (20:40d2)
	db $0, "All your item", $4f
	db "needs fulfilled!", $55
	db "#MON MART", $57

_PokeCenterSignText: ; 800fc (20:40fc)
	db $0, "Heal Your #MON!", $4f
	db "#MON CENTER", $57

_FoundItemText: ; 80119 (20:4119)
	db $0, $52, " found", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x8012a

_NoMoreRoomForItemText: ; 8012a (20:412a)
	db $0, "No more room for", $4f
	db "items!", $57
; 0x8012a + 25 bytes

_UnnamedText_59091: ; 80143 (20:4143)
	db $0, "Hi! Remember me?", $4f
	db "I'm PROF.OAK's", $55
	db "AIDE!", $51
	db "If you caught @"
; 0x80143 + 52 bytes

UnnamedText_80177: ; 80177 (20:4177)
	TX_NUM $ffdb, 1, 3
	db $0, $4f
	db "kinds of #MON,", $55
	db "I'm supposed to", $55
	db "give you an", $55
	db "@"
	TX_RAM $cc5b
	db $0, "!", $51
	db "So, ", $52, "! Have", $4f
	db "you caught at", $55
	db "least @"
	TX_NUM $ffdb, 1, 3
	db $0, " kinds of", $55
	db "#MON?", $57
; 0x801e4

_UnnamedText_59096: ; 801e4 (20:41e4)
	db $0, "Let's see...", $4f
	db "Uh-oh! You have", $55
	db "caught only @"
; 0x801e4 + 42 bytes

UnnamedText_8020e: ; 8020e (20:420e)
	TX_NUM $ffdd, 1, 3
	db $0, $55
	db "kinds of #MON!", $51
	db "You need @"
	TX_NUM $ffdb, 1, 3
	db $0, " kinds", $4f
	db "if you want the", $55
	db "@"
	TX_RAM $cc5b
	db $0, ".", $57
; 0x80250

_UnnamedText_5909b: ; 80250 (20:4250)
	db $0, "Oh. I see.", $51
	db "When you get @"
	TX_NUM $ffdb, 1, 3
	db $0, $4f
	db "kinds, come back", $55
	db "for @"
	TX_RAM $cc5b
	db $0, ".", $57
; 0x8028c

_UnnamedText_590a0: ; 8028c (20:428c)
	db $0, "Great! You have", $4f
	db "caught @"
; 0x8028c + 25 bytes

UnnamedText_802a5: ; 802a5 (20:42a5)
	TX_NUM $ffdd, 1, 3
	db $0, " kinds ", $55
	db "of #MON!", $55
	db "Congratulations!", $51
	db "Here you go!", $58
; 0x802a5 + 52 bytes = 0x802d9

UnnamedText_802d9: ; 802d9 (20:42d9)
	db $0, $52, " got the", $4f
	db "@"
	TX_RAM $cc5b
	db $0, "!@@"
; 0xa802ec

_UnnamedText_590ab: ; 802ec (20:42ec)
	db $0, "Oh! I see you", $4f
	db "don't have any", $55
	db "room for the", $55
	db "@"
; 0x802ec + 43 bytes

UnnamedText_80317: ; 80317 (20:4317)
	TX_RAM $cc5b
	db $0, ".", $57
; 0x80317 + 6 bytes = 0x8031d

_ViridianForestText1: ; 8031d (20:431d)
	db $0, "I came here with", $4f
	db "some friends!", $51
	db "They're out for", $4f
	db "#MON fights!", $57

_ViridianForestBattleText1: ; 80359 (20:4359)
	db $0, "Hey! You have", $4f
	db "#MON! Come on!", $55
	db "Let's battle'em!", $57
; 0x80359 + 46 bytes

_ViridianForestEndBattleText1: ; 80387 (20:4387)
	db $0, "No!", $4f
	db "CATERPIE can't", $55
	db "cut it!", $58
; 0x80387 + 27 bytes

_ViridianForestAfterBattleText1: ; 803a2 (20:43a2)
	db $0, "Ssh! You'll scare", $4f
	db "the bugs away!", $57
; 0x803a2 + 33 bytes

_ViridianForestBattleText2: ; 803c3 (20:43c3)
	db $0, "Yo! You can't jam", $4f
	db "out if you're a", $55
	db "#MON trainer!", $57
; 0x803c3 + 47 bytes

_ViridianForestEndBattleText2: ; 803f2 (20:43f2)
	db $0, "Huh?", $4f
	db "I ran out of", $55
	db "#MON!", $58
; 0x803f2 + 25 bytes

_ViridianForestAfterBattleText2: ; 8040b (20:440b)
	db $0, "Darn! I'm going", $4f
	db "to catch some", $55
	db "stronger ones!", $57
; 0x8040b + 45 bytes

_ViridianForestBattleText3: ; 80438 (20:4438)
	db $0, "Hey, wait up!", $4f
	db "What's the hurry?", $57
; 0x80438 + 32 bytes

_ViridianForestEndBattleText3: ; 80458 (20:4458)
	db $0, "I", $4f
	db "give! You're good", $55
	db "at this!", $58
; 0x80458 + 29 bytes

_ViridianForestAfterBattleText3: ; 80475 (20:4475)
	db $0, "Sometimes, you", $4f
	db "can find stuff on", $55
	db "the ground!", $51
	db "I'm looking for", $4f
	db "the stuff I", $55
	db "dropped!", $57
; 0x80475 + 82 bytes

_ViridianForestText8: ; 804c7 (20:44c7)
	db $0, "I ran out of #", $4f
	db "BALLs to catch", $55
	db "#MON with!", $51
	db "You should carry", $4f
	db "extras!", $57

_ViridianForestText9: ; 8050a (20:450a)
	db $0, "TRAINER TIPS", $51
	db "If you want to", $4f
	db "avoid battles,", $55
	db "stay away from", $55
	db "grassy areas!", $57

_ViridianForestText10: ; 80553 (20:4553)
	db $0, "For poison, use", $4f
	db "ANTIDOTE! Get it", $55
	db "at #MON MARTs!", $57

_ViridianForestText11: ; 80584 (20:4584)
	db $0, "TRAINER TIPS", $51
	db "Contact PROF.OAK", $4f
	db "via PC to get", $55
	db "your #DEX", $55
	db "evaluated!", $57

_ViridianForestText12: ; 805c6 (20:45c6)
	db $0, "TRAINER TIPS", $51
	db "No stealing of", $4f
	db "#MON from", $55
	db "other trainers!", $55
	db "Catch only wild", $55
	db "#MON!", $57

_ViridianForestText13: ; 80613 (20:4613)
	db $0, "TRAINER TIPS", $51
	db "Weaken #MON", $4f
	db "before attempting", $55
	db "capture!", $51
	db "When healthy,", $4f
	db "they may escape!", $57

_ViridianForestText14: ; 80667 (20:4667)
	db $0, "LEAVING", $4f
	db "VIRIDIAN FOREST", $55
	db "PEWTER CITY AHEAD", $57

_MtMoon1BattleText2: ; 80692 (20:4692)
	db $0, "WHOA! You shocked", $4f
	db "me! Oh, you're", $55
	db "just a kid!", $57
; 0x80692 + 45 bytes

_MtMoon1EndBattleText2: ; 806bf (20:46bf)
	db $0, "Wow!", $4f
	db "Shocked again!", $58
; 0x806bf + 21 bytes

_MtMoon1AfterBattleText2: ; 806d4 (20:46d4)
	db $0, "Kids like you", $4f
	db "shouldn't be", $55
	db "here!", $57
; 0x806d4 + 33 bytes

_MtMoon1BattleText3: ; 806f5 (20:46f5)
	db $0, "Did you come to", $4f
	db "explore too?", $57
; 0x806f5 + 30 bytes

_MtMoon1EndBattleText3: ; 80713 (20:4713)
	db $0, "Losing", $4f
	db "stinks!", $58
; 0x80713 + 16 bytes

_MtMoon1AfterBattleText3: ; 80723 (20:4723)
	db $0, "I came down here", $4f
	db "to show off to", $55
	db "girls.", $57
; 0x80723 + 40 bytes

_MtMoon1BattleText4: ; 8074b (20:474b)
	db $0, "Wow! It's way", $4f
	db "bigger in here", $55
	db "than I thought!", $57
; 0x8074b + 45 bytes

_MtMoon1EndBattleText4: ; 80778 (20:4778)
	db $0, "Oh!", $4f
	db "I lost it!", $58
; 0x80778 + 16 bytes

_MtMoon1AfterBattleText4: ; 80788 (20:4788)
	db $0, "How do you get", $4f
	db "out of here?", $57
; 0x80788 + 29 bytes

_MtMoon1BattleText5: ; 807a5 (20:47a5)
	db $0, "What! Don't sneak", $4f
	db "up on me!", $57
; 0x807a5 + 28 bytes

_MtMoon1EndBattleText5: ; 807c1 (20:47c1)
	db $0, "My", $4f
	db "#MON won't do!", $58
; 0x807c1 + 18 bytes

_MtMoon1AfterBattleText5: ; 807d3 (20:47d3)
	db $0, "I have to find", $4f
	db "stronger #MON.", $57
; 0x807d3 + 31 bytes

_MtMoon1BattleText6: ; 807f2 (20:47f2)
	db $0, "What? I'm waiting", $4f
	db "for my friends to", $55
	db "find me here.", $57
; 0x807f2 + 50 bytes

_MtMoon1EndBattleText6: ; 80824 (20:4824)
	db $0, "I lost?", $58
; 0x80824 + 9 bytes

_MtMoon1AfterBattleText6: ; 8082d (20:482d)
	db $0, "I heard there are", $4f
	db "some very rare", $55
	db "fossils here.", $57
; 0x8082d + 48 bytes

_MtMoon1BattleText7: ; 8085d (20:485d)
	db $0, "Suspicious men", $4f
	db "are in the cave.", $55
	db "What about you?", $57
; 0x8085d + 49 bytes

_MtMoon1EndBattleText7: ; 8088e (20:488e)
	db $0, "You", $4f
	db "got me!", $58
; 0x8088e + 13 bytes

_MtMoon1AfterBattleText7: ; 8089b (20:489b)
	db $0, "I saw them! I'm", $4f
	db "sure they're from", $55
	db "TEAM ROCKET!", $57
; 0x8089b + 46 bytes

_MtMoon1BattleText8: ; 808c9 (20:48c9)
	db $0, "Go through this", $4f
	db "cave to get to", $55
	db "CERULEAN CITY!", $57
; 0x808c9 + 47 bytes

_MtMoon1EndBattleText8: ; 808f8 (20:48f8)
	db $0, "I", $4f
	db "lost.", $58
; 0x808f8 + 9 bytes

_MtMoon1AfterBattleText8: ; 80901 (20:4901)
	db $0, "ZUBAT is tough!", $4f
	db "But, it can be", $55
	db "useful if you", $55
	db "catch one.", $57
; 0x80901 + 57 bytes

_MtMoon1Text14: ; 8093a (20:493a)
	db $0, "Beware! ZUBAT is", $4f
	db "a blood sucker!", $57

_UnnamedText_51a48: ; 8095c (20:495c)
	db $0, $57
; 0x8095c + 2 bytes

_UnnamedText_49f24: ; 8095e (20:495e)
	db $0, "You want the", $4f
	db "DOME FOSSIL?", $57
; 0x8095e + 27 bytes

_UnnamedText_49f64: ; 80979 (20:4979)
	db $0, "You want the", $4f
	db "HELIX FOSSIL?", $57
; 0x80979 + 28 bytes

_UnnamedText_49f6f: ; 80995 (20:4995)
	db $0, $52, " got the", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x809a8

_UnnamedText_49f7f: ; 809a8 (20:49a8)
	db $0, "Look, you've got", $4f
	db "no room for this.@@"
; 0x809cc

_UnnamedText_49f85: ; 809cc (20:49cc)
	db $0, "Hey, stop!", $51
	db "I found these", $4f
	db "fossils! They're", $55
	db "both mine!", $57
; 0x809cc + 53 bytes

_UnnamedText_49f8a: ; 80a01 (20:4a01)
	db $0, "OK!", $4f
	db "I'll share!", $58
; 0x80a01 + 16 bytes

_UnnamedText_49f8f: ; 80a11 (20:4a11)
	db $0, "We'll each take", $4f
	db "one!", $55
	db "No being greedy!", $57
; 0x80a11 + 38 bytes

_UnnamedText_49f94: ; 80a37 (20:4a37)
	db $0, "Far away, on", $4f
	db "CINNABAR ISLAND,", $55
	db "there's a #MON", $55
	db "LAB.", $51
	db "They do research", $4f
	db "on regenerating", $55
	db "fossils.", $57
; 0x80a37 + 92 bytes

UnnamedText_80a93: ; 80a93 (20:4a93)
	db $0, "All right. Then", $4f
	db "this is mine!@@"
; 0x80ab3

_MtMoon3BattleText2: ; 80ab3 (20:4ab3)
	db $0, "TEAM ROCKET will", $4f
	db "find the fossils,", $55
	db "revive and sell", $55
	db "them for cash!", $57
; 0x80ab3 + 67 bytes

_MtMoon3EndBattleText2: ; 80af6 (20:4af6)
	db $0, "Urgh!", $4f
	db "Now I'm mad!", $58
; 0x80af6 + 19 bytes

_MtMoon3AfterBattleText2: ; 80b09 (20:4b09)
	db $0, "You made me mad!", $4f
	db "TEAM ROCKET will", $55
	db "blacklist you!", $57
; 0x80b09 + 50 bytes

_MtMoon3BattleText3: ; 80b3b (20:4b3b)
	db $0, "We, TEAM ROCKET,", $4f
	db "are #MON", $55
	db "gangsters!", $57
; 0x80b3b + 38 bytes

_MtMoon3EndBattleText3: ; 80b61 (20:4b61)
	db $0, "I blew", $4f
	db "it!", $58
; 0x80b61 + 12 bytes

_MtMoon3AfterBattleText3: ; 80b6d (20:4b6d)
	db $0, "Darn it all! My", $4f
	db "associates won't", $55
	db "stand for this!", $57
; 0x80b6d + 49 bytes

_MtMoon3BattleText4: ; 80b9e (20:4b9e)
	db $0, "We're pulling a", $4f
	db "big job here!", $55
	db "Get lost, kid!", $57
; 0x80b9e + 45 bytes

_MtMoon3EndBattleText4: ; 80bcb (20:4bcb)
	db $0, "So, you", $4f
	db "are good.", $58
; 0x80bcb + 19 bytes

_MtMoon3AfterBattleText4: ; 80bde (20:4bde)
	db $0, "If you find a", $4f
	db "fossil, give it", $55
	db "to me and scram!", $57
; 0x80bde + 48 bytes

_MtMoon3BattleText5: ; 80c0e (20:4c0e)
	db $0, "Little kids", $4f
	db "should leave", $55
	db "grown-ups alone!", $57
; 0x80c0e + 43 bytes

_MtMoon3EndBattleText5: ; 80c39 (20:4c39)
	db $0, "I'm", $4f
	db "steamed!", $58
; 0x80c39 + 13 bytes

_MtMoon3AfterBattleText5: ; 80c46 (20:4c46)
	db $0, "#MON lived", $4f
	db "here long before", $55
	db "people came.", $57
; 0x80c46 + 42 bytes

_SSAnne1Text1: ; 80c70 (20:4c70)
	db $0, "Bonjour!", $4f
	db "I am le waiter on", $55
	db "this ship!", $51
	db "I will be happy", $4f
	db "to serve you any-", $55
	db "thing you please!", $51
	db "Ah! Le strong", $4f
	db "silent type!", $57

_SSAnne1Text2: ; 80ce6 (20:4ce6)
	db $0, "The passengers", $4f
	db "are restless!", $51
	db "You might be", $4f
	db "challenged by the", $55
	db "more bored ones!", $57

_SSAnne2Text1: ; 80d34 (20:4d34)
	db $0, "This ship, she is", $4f
	db "a luxury liner", $55
	db "for trainers!", $51
	db "At every port, we", $4f
	db "hold parties with", $55
	db "invited trainers!", $57

_SSAnneRivalBeforeBattleText: ; 80d9a (20:4d9a)
	db $0, $53, ": Bonjour!", $4f
	db $52, "!", $51
	db "Imagine seeing", $4f
	db "you here!", $51
	db $52, ", were you", $4f
	db "really invited?", $51
	db "So how's your", $4f
	db "#DEX coming?", $51
	db "I already caught", $4f
	db "40 kinds, pal!", $51
	db "Different kinds", $4f
	db "are everywhere!", $51
	db "Crawl around in", $4f
	db "grassy areas!", $57
; 0x80d9a + 189 bytes

_SSAnneRivalDefeatedText: ; 80e57 (20:4e57)
	db $0, "Humph!", $51
	db "At least you're", $4f
	db "raising your", $55
	db "#MON!", $58
; 0x80e57 + 42 bytes

_SSAnneRivalWonText: ; 80e81 (20:4e81)
	db $0, $52, "! What are", $4f
	db "you, seasick?", $51
	db "You should shape", $4f
	db "up, pal!", $58
; 0x80e81 + 53 bytes

_SSAnneRivalCaptainText: ; 80eb6 (20:4eb6)
	db $0, $53, ": I heard", $4f
	db "there was a CUT", $55
	db "master on board.", $51
	db "But, he was just a", $4f
	db "seasick, old man!", $51
	db "But, CUT itself is", $4f
	db "really useful!", $51
	db "You should go see", $4f
	db "him! Smell ya!", $57
; 0x80eb6 + 149 bytes

_SSAnne3Text1: ; 80f4b (20:4f4b)
	db $0, "Our CAPTAIN is a", $4f
	db "sword master!", $51
	db "He even teaches", $4f
	db "CUT to #MON!", $57

_SSAnne5Text1: ; 80f88 (20:4f88)
	db $0, "The party's over.", $4f
	db "The ship will be", $55
	db "departing soon.", $57

_SSAnne5Text2: ; 80fbb (20:4fbb)
	db $0, "Scrubbing decks", $4f
	db "is hard work!", $57

_SSAnne5Text3: ; 80fda (20:4fda)
	db $0, "Urf. I feel ill.", $51
	db "I stepped out to", $4f
	db "get some air.", $57

_SSAnneBattleText1: ; 8100b (20:500b)
	db $0, "Hey matey!", $51
	db "Let's do a little", $4f
	db "jig!", $57
; 0x8100b + 34 bytes

_SSAnneEndBattleText1: ; 8102d (20:502d)
	db $0, "You're", $4f
	db "impressive!", $58
; 0x8102d + 19 bytes

_SSAnneAfterBattleText1: ; 81040 (20:5040)
	db $0, "How many kinds of", $4f
	db "#MON do you", $55
	db "think there are?", $57
; 0x81040 + 48 bytes

_SSAnneBattleText2: ; 81070 (20:5070)
	db $0, "Ahoy there!", $4f
	db "Are you seasick?", $57
; 0x81070 + 30 bytes

_SSAnneEndBattleText2: ; 8108e (20:508e)
	db $0, "I was", $4f
	db "just careless!", $58
; 0x8108e + 22 bytes

_SSAnneAfterBattleText2: ; 810a4 (20:50a4)
	db $0, "My Pa said there", $4f
	db "are 100 kinds of", $55
	db "#MON. I think", $55
	db "there are more.", $57
; 0x810a4 + 65 bytes

_SSAnne6Text1: ; 810e5 (20:50e5)
	db $0, "You, mon petit!", $4f
	db "We're busy here!", $55
	db "Out of the way!", $57

_SSAnne6Text2: ; 81116 (20:5116)
	db $0, "I saw an odd ball", $4f
	db "in the trash.", $57

_SSAnne6Text3: ; 81137 (20:5137)
	db $0, "I'm so busy I'm", $4f
	db "getting dizzy!", $57

_SSAnne6Text4: ; 81155 (20:5155)
	db $0, "Hum-de-hum-de-", $4f
	db "ho...", $51
	db "I peel spuds", $4f
	db "every day!", $55
	db "Hum-hum...", $57

_SSAnne6Text5: ; 8118e (20:518e)
	db $0, "Did you hear about", $4f
	db "SNORLAX?", $51
	db "All it does is", $4f
	db "eat and sleep!", $57

_SSAnne6Text6: ; 811c9 (20:51c9)
	db $0, "Snivel...Sniff...", $51
	db "I only get to", $4f
	db "peel onions...", $55
	db "Snivel...", $57

_UnnamedText_61807: ; 81203 (20:5203)
	db $0, "Er-hem! Indeed I", $4f
	db "am le CHEF!", $51
	db "Le main course is", $58
; 0x81203 + 48 bytes

_UnnamedText_6180c: ; 81233 (20:5233)
	db $0, "Salmon du Salad!", $51
	db "Les guests may", $4f
	db "gripe it's fish", $55
	db "again, however!", $57
; 0x81233 + 64 bytes

_UnnamedText_61811: ; 81273 (20:5273)
	db $0, "Eels au Barbecue!", $51
	db "Les guests will", $4f
	db "mutiny, I fear.", $57
; 0x81273 + 51 bytes

_UnnamedText_61816: ; 812a6 (20:52a6)
	db $0, "Prime Beef Steak!", $51
	db "But, have I enough", $4f
	db "fillets du beef?", $57
; 0x812a6 + 55 bytes

_SSAnne7RubText: ; 812dd (20:52dd)
	db $0, "CAPTAIN: Ooargh...", $4f
	db "I feel hideous...", $55
	db "Urrp! Seasick...", $51
	db $52, " rubbed", $4f
	db "the CAPTAIN's", $55
	db "back!", $51
	db "Rub-rub...", $4f
	db "Rub-rub...@@"
; 0x81347

_ReceivingHM01Text: ; 81347 (20:5347)
	db $0, "CAPTAIN: Whew!", $4f
	db "Thank you! I", $55
	db "feel much better!", $51
	db "You want to see", $4f
	db "my CUT technique?", $51
	db "I could show you", $4f
	db "if I wasn't ill...", $51
	db "I know! You can", $4f
	db "have this!", $51
	db "Teach it to your", $4f
	db "#MON and you", $55
	db "can see it CUT", $55
	db "any time!", $58
; 0x81347 + 198 bytes

_ReceivedHM01Text: ; 8140d (20:540d)
	db $0, $52, " got", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x8141c

_UnnamedText_61932: ; 8141c (20:541c)
	db $0, "CAPTAIN: Whew!", $51
	db "Now that I'm not", $4f
	db "sick any more, I", $55
	db "guess it's time.", $57
; 0x8141c + 65 bytes

_HM01NoRoomText: ; 8145d (20:545d)
	db $0, "Oh no! You have", $4f
	db "no room for this!", $57
; 0x8145d + 35 bytes

_SSAnne7Text2: ; 81480 (20:5480)
	db $0, "Yuck! Shouldn't", $4f
	db "have looked!", $57

_SSAnne7Text3: ; 8149d (20:549d)
	db $0, "How to Conquer", $4f
	db "Seasickness...", $55
	db "The CAPTAIN's", $55
	db "reading this!", $57

_SSAnne8Text8: ; 814d7 (20:54d7)
	db $0, "WIGGLYTUFF: Puup", $4f
	db "pupuu!@@"

_SSAnne8BattleText1: ; 814f1 (20:54f1)
	db $0, "I travel alone", $4f
	db "on my journeys!", $51
	db "My #MON are my", $4f
	db "only friends!", $57
; 0x814f1 + 61 bytes

_SSAnne8EndBattleText1: ; 8152e (20:552e)
	db $0, "My, my", $4f
	db "friends...", $58
; 0x8152e + 19 bytes

_SSAnne8AfterBattleText1: ; 81541 (20:5541)
	db $0, "You should be", $4f
	db "nice to friends!", $57
; 0x81541 + 32 bytes

_SSAnne8BattleText2: ; 81561 (20:5561)
	db $0, "You pup! How dare", $4f
	db "you barge in!", $57
; 0x81561 + 33 bytes

_SSAnne8EndBattleText2: ; 81582 (20:5582)
	db $0, "Humph!", $4f
	db "You rude child!", $58
; 0x81582 + 24 bytes

_UnnamedText_61a24: ; 8159a (20:559a)
	db $0, "I wish to be left", $4f
	db "alone! Get out!", $57
; 0x8159a + 35 bytes

_SSAnne8BattleText3: ; 815bd (20:55bd)
	db $0, "I love #MON!", $4f
	db "Do you?", $57
; 0x815bd + 22 bytes

_SSAnne8EndBattleText3: ; 815d3 (20:55d3)
	db $0, "Wow! ", $4f
	db "You're great!", $58
; 0x815d3 + 20 bytes

_SSAnne8AfterBattleText3: ; 815e7 (20:55e7)
	db $0, "Let me be your", $4f
	db "friend, OK?", $51
	db "Then we can trade", $4f
	db "#MON!", $57
; 0x815e7 + 52 bytes

_SSAnne8BattleText4: ; 8161b (20:561b)
	db $0, "I collected these", $4f
	db "#MON from all", $55
	db "around the world!", $57
; 0x8161b + 51 bytes

_SSAnne8EndBattleText4: ; 8164e (20:564e)
	db $0, "Oh no!", $4f
	db "I went around the", $55
	db "world for these!", $58
; 0x8164e + 43 bytes

_SSAnne8AfterBattleText4: ; 81679 (20:5679)
	db $0, "You hurt my poor", $4f
	db "worldly #MON!", $51
	db "I demand that you", $4f
	db "heal them at a", $55
	db "#MON CENTER!", $57
; 0x81679 + 78 bytes

_SSAnne8Text5: ; 816c7 (20:56c7)
	db $0, "Waiter, I would", $4f
	db "like a cherry pie", $55
	db "please!", $57

_SSAnne8Text6: ; 816f2 (20:56f2)
	db $0, "A cruise is so", $4f
	db "elegant yet cozy!", $57

_SSAnne8Text7: ; 81714 (20:5714)
	db $0, "I always travel", $4f
	db "with WIGGLYTUFF!", $57

_SSAnne8Text9: ; 81736 (20:5736)
	db $0, "We are cruising", $4f
	db "around the world.", $57

_SSAnne8Text11: ; 81759 (20:5759)
	db $0, "Ssh! I'm a GLOBAL", $4f
	db "POLICE agent!", $51
	db "I'm on the trail", $4f
	db "of TEAM ROCKET!", $57

_UnnamedText_61bf2: ; 81799 (20:5799)
	db $0, "In all my travels", $4f
	db "I've never seen", $55
	db "any #MON sleep", $55
	db "like this one!", $51
	db "It was something", $4f
	db "like this!", $58
; 0x81799 + 92 bytes

_UnnamedText_61c01: ; 817f5 (20:57f5)
	db $0, "Ah yes, I have", $4f
	db "seen some #MON", $55
	db "ferry people", $55
	db "across the water!", $57
; 0x817f5 + 62 bytes

_UnnamedText_61c10: ; 81833 (20:5833)
	db $0, "#MON can CUT", $4f
	db "down small bushes.", $57
; 0x81833 + 33 bytes

_UnnamedText_61c1f: ; 81854 (20:5854)
	db $0, "Have you gone to", $4f
	db "the SAFARI ZONE", $55
	db "in FUCHSIA CITY?", $51
	db "It had many rare", $4f
	db "kinds of #MON!!", $57
; 0x81854 + 84 bytes

_UnnamedText_61c2e: ; 818a8 (20:58a8)
	db $0, "Me and my Daddy", $4f
	db "think the SAFARI", $55
	db "ZONE is awesome!", $57
; 0x818a8 + 51 bytes

_UnnamedText_61c3d: ; 818db (20:58db)
	db $0, "The CAPTAIN looked", $4f
	db "really sick and", $55
	db "pale!", $57
; 0x818db + 42 bytes

_UnnamedText_61c4c: ; 81905 (20:5905)
	db $0, "I hear many people", $4f
	db "get seasick!", $57
; 0x81905 + 33 bytes

_SSAnne9BattleText1: ; 81926 (20:5926)
	db $0, "Competing against", $4f
	db "the young keeps", $55
	db "me youthful.", $57
; 0x81926 + 48 bytes

_SSAnne9EndBattleText1: ; 81956 (20:5956)
	db $0, "Good", $4f
	db "fight! Ah, I feel", $55
	db "young again!", $58
; 0x81956 + 37 bytes

_SSAnne9AfterBattleText1: ; 8197b (20:597b)
	db $0, "15 years ago, I", $4f
	db "would have won!", $57
; 0x8197b + 33 bytes

_SSAnne9BattleText2: ; 8199c (20:599c)
	db $0, "Check out what I", $4f
	db "fished up!", $57
; 0x8199c + 29 bytes

_SSAnne9EndBattleText2: ; 819b9 (20:59b9)
	db $0, "I'm", $4f
	db "all out!", $58
; 0x819b9 + 13 bytes

_SSAnne9AfterBattleText2: ; 819c6 (20:59c6)
	db $0, "Party?", $51
	db "The cruise ship's", $4f
	db "party should be", $55
	db "over by now.", $57
; 0x819c6 + 54 bytes

_SSAnne9BattleText3: ; 819fc (20:59fc)
	db $0, "Which do you like,", $4f
	db "a strong or a", $55
	db "rare #MON?", $57
; 0x819fc + 45 bytes

_SSAnne9EndBattleText3: ; 81a29 (20:5a29)
	db $0, "I must", $4f
	db "salute you!", $58
; 0x81a29 + 20 bytes

_SSAnne9AfterBattleText3: ; 81a3d (20:5a3d)
	db $0, "I prefer strong", $4f
	db "and rare #MON.", $57
; 0x81a3d + 32 bytes

_SSAnne9BattleText4: ; 81a5d (20:5a5d)
	db $0, "I never saw you", $4f
	db "at the party.", $57
; 0x81a5d + 31 bytes

_SSAnne9EndBattleText4: ; 81a7c (20:5a7c)
	db $0, "Take", $4f
	db "it easy!", $58
; 0x81a7c + 15 bytes

_SSAnne9AfterBattleText4: ; 81a8b (20:5a8b)
	db $0, "Oh, I adore your", $4f
	db "strong #MON!", $57
; 0x81a8b + 31 bytes

_SSAnne10Text8: ; 81aaa (20:5aaa)
	db $0, "MACHOKE: Gwoh!", $4f
	db "Goggoh!@@"

_SSAnne10BattleText1: ; 81ac3 (20:5ac3)
	db $0, "You know what they", $4f
	db "say about sailors", $55
	db "and fighting!", $57
; 0x81ac3 + 52 bytes

_SSAnne10EndBattleText1: ; 81af7 (20:5af7)
	db $0, "Right!", $4f
	db "Good fight, mate!", $58
; 0x81af7 + 26 bytes

_SSAnne10AfterBattleText1: ; 81b11 (20:5b11)
	db $0, "Haha! Want to be", $4f
	db "a sailor, mate?", $57
; 0x81b11 + 34 bytes

_SSAnne10BattleText2: ; 81b33 (20:5b33)
	db $0, "My sailor's pride", $4f
	db "is at stake!", $57
; 0x81b33 + 31 bytes

_SSAnne10EndBattleText2: ; 81b52 (20:5b52)
	db $0, "Your", $4f
	db "spirit sank me!", $58
; 0x81b52 + 22 bytes

_SSAnne10AfterBattleText2: ; 81b68 (20:5b68)
	db $0, "Did you see the", $4f
	db "FISHING GURU in", $55
	db "VERMILION CITY?", $57
; 0x81b68 + 49 bytes

_SSAnne10BattleText3: ; 81b99 (20:5b99)
	db $0, "Us sailors have", $4f
	db "#MON too!", $57
; 0x81b99 + 27 bytes

_SSAnne10EndBattleText3: ; 81bb4 (20:5bb4)
	db $0, "OK, ", $4f
	db "you're not bad.", $58
; 0x81bb4 + 21 bytes

_SSAnne10AfterBattleText3: ; 81bc9 (20:5bc9)
	db $0, "We caught all our", $4f
	db "#MON while", $55
	db "out at sea!", $57
; 0x81bc9 + 42 bytes

_SSAnne10BattleText4: ; 81bf3 (20:5bf3)
	db $0, "I like feisty", $4f
	db "kids like you!@@"
; 0x81bf3 + 31 bytes

_SSAnne10EndBattleText4: ; 81c12 (20:5c12)
	db $0, "Argh!", $4f
	db "Lost it!", $58
; 0x81c12 + 16 bytes

_SSAnne10AfterBattleText4: ; 81c22 (20:5c22)
	db $0, "Sea #MON live", $4f
	db "in deep water.", $55
	db "You'll need a ROD!", $57
; 0x81c22 + 48 bytes

_SSAnne10BattleText5: ; 81c52 (20:5c52)
	db $0, "Matey, you're", $4f
	db "walking the plank", $55
	db "if you lose!", $57
; 0x81c52 + 45 bytes

_SSAnne10EndBattleText5: ; 81c7f (20:5c7f)
	db $0, "Argh!", $4f
	db "Beaten by a kid!", $58
; 0x81c7f + 24 bytes

_SSAnne10AfterBattleText5: ; 81c97 (20:5c97)
	db $0, "Jellyfish some-", $4f
	db "times drift into", $55
	db "the ship.", $57
; 0x81c97 + 44 bytes

_SSAnne10BattleText6: ; 81cc3 (20:5cc3)
	db $0, "Hello stranger!", $4f
	db "Stop and chat!", $51
	db "All my #MON", $4f
	db "are from the sea!", $57
; 0x81cc3 + 62 bytes

_SSAnne10EndBattleText6: ; 81d01 (20:5d01)
	db $0, "Darn!", $4f
	db "I let that one", $55
	db "get away!", $58
; 0x81d01 + 32 bytes

_SSAnne10AfterBattleText6: ; 81d21 (20:5d21)
	db $0, "I was going to", $4f
	db "make you my", $55
	db "assistant too!", $57
; 0x81d21 + 43 bytes

_SSAnne10Text7: ; 81d4c (20:5d4c)
	db $0, "My buddy, MACHOKE,", $4f
	db "is super strong!", $51
	db "He has enough", $4f
	db "STRENGTH to move", $55
	db "big rocks!", $57

_VictoryRoad3BattleText2: ; 81d9b (20:5d9b)
	db $0, "I heard rumors of", $4f
	db "a child prodigy!", $57
; 0x81d9b + 36 bytes

_VictoryRoad3EndBattleText2: ; 81dbf (20:5dbf)
	db $0, "The", $4f
	db "rumors were true!", $58
; 0x81dbf + 23 bytes

_VictoryRoad3AfterBattleText2: ; 81dd6 (20:5dd6)
	db $0, "You beat GIOVANNI", $4f
	db "of TEAM ROCKET?", $57
; 0x81dd6 + 35 bytes

_VictoryRoad3BattleText3: ; 81df9 (20:5df9)
	db $0, "I'll show you just", $4f
	db "how good you are!", $57
; 0x81df9 + 37 bytes

_VictoryRoad3EndBattleText3: ; 81e1e (20:5e1e)
	db $0, "I'm", $4f
	db "furious!", $58
; 0x81e1e + 13 bytes

_VictoryRoad3AfterBattleText3: ; 81e2b (20:5e2b)
	db $0, "You showed me just", $4f
	db "how good I was!", $57
; 0x81e2b + 36 bytes

_VictoryRoad3BattleText4: ; 81e4f (20:5e4f)
	db $0, "Only the chosen", $4f
	db "can pass here!", $57
; 0x81e4f + 32 bytes

_VictoryRoad3EndBattleText4: ; 81e6f (20:5e6f)
	db $0, "I", $4f
	db "don't believe it!", $58
; 0x81e6f + 20 bytes

_VictoryRoad3AfterBattleText4: ; 81e83 (20:5e83)
	db $0, "All trainers here", $4f
	db "are headed to the", $55
	db "#MON LEAGUE!", $55
	db "Be careful!", $57
; 0x81e83 + 62 bytes

_VictoryRoad3BattleText5: ; 81ec1 (20:5ec1)
	db $0, "Trainers live to", $4f
	db "seek stronger", $55
	db "opponents!", $57
; 0x81ec1 + 43 bytes

_VictoryRoad3EndBattleText5: ; 81eec (20:5eec)
	db $0, "Oh!", $4f
	db "So strong!", $58
; 0x81eec + 16 bytes

_VictoryRoad3AfterBattleText5: ; 81efc (20:5efc)
	db $0, "By fighting tough", $4f
	db "battles, you get", $55
	db "stronger!", $57
; 0x81efc + 46 bytes

_RocketHideout1EndBattleText6: ; 81f2a (20:5f2a)
	db $0, "Why...?@@"
; 0x81f34

_RocketHideout1BattleText2: ; 81f34 (20:5f34)
	db $0, "Who are you? How", $4f
	db "did you get here?", $57
; 0x81f34 + 36 bytes

_RocketHideout1EndBattleText2: ; 81f58 (20:5f58)
	db $0, "Oww!", $4f
	db "Beaten!", $58
; 0x81f58 + 14 bytes

_RocketHideout1AfterBattleTxt2: ; 81f66 (20:5f66)
	db $0, "Are you dissing", $4f
	db "TEAM ROCKET?", $57
; 0x81f66 + 30 bytes

_RocketHideout1BattleText3: ; 81f84 (20:5f84)
	db $0, "You broke into", $4f
	db "our operation?", $57
; 0x81f84 + 31 bytes

_RocketHideout1EndBattleText3: ; 81fa3 (20:5fa3)
	db $0, "Burnt!", $58
; 0x81fa3 + 8 bytes

_RocketHideout1AfterBattleTxt3: ; 81fab (20:5fab)
	db $0, "You're not going", $4f
	db "to get away with", $55
	db "this, brat!", $57
; 0x81fab + 46 bytes

_RocketHideout1BattleText4: ; 81fd9 (20:5fd9)
	db $0, "Intruder alert!", $57
; 0x81fd9 + 17 bytes

_RocketHideout1EndBattleText4: ; 81fea (20:5fea)
	db $0, "I", $4f
	db "can't do it!", $58
; 0x81fea + 15 bytes

_RocketHideout1AfterBattleTxt4: ; 81ff9 (20:5ff9)
	db $0, "SILPH SCOPE?", $4f
	db "I don't know", $55
	db "where it is!", $57
; 0x81ff9 + 39 bytes

_RocketHideout1BattleText5: ; 82020 (20:6020)
	db $0, "Why did you come", $4f
	db "here?", $57
; 0x82020 + 24 bytes

_RocketHideout1EndBattleText5: ; 82038 (20:6038)
	db $0, "This", $4f
	db "won't do!", $58
; 0x82038 + 15 bytes

_RocketHideout1AfterBattleTxt5: ; 82047 (20:6047)
	db $0, "OK, I'll talk!", $4f
	db "Take the elevator", $55
	db "to see my BOSS!", $57
; 0x82047 + 49 bytes

_RocketHideout1BattleText6: ; 82078 (20:6078)
	db $0, "Are you lost, you", $4f
	db "little rat?", $57
; 0x82078 + 31 bytes

_RocketHideout1AfterBattleTxt6: ; 82097 (20:6097)
	db $0, "Uh-oh, that fight", $4f
	db "opened the door!", $57
; 0x82097 + 36 bytes

_RocketHideout2BattleText2: ; 820bb (20:60bb)
	db $0, "BOSS said you can", $4f
	db "see GHOSTs with", $55
	db "the SILPH SCOPE!", $57
; 0x820bb + 52 bytes

_RocketHideout2EndBattleText2: ; 820ef (20:60ef)
	db $0, "I", $4f
	db "surrender!", $58
; 0x820ef + 14 bytes

_RocketHideout2AfterBattleTxt2: ; 820fd (20:60fd)
	db $0, "The TEAM ROCKET", $4f
	db "HQ has 4 basement", $55
	db "floors. Can you", $55
	db "reach the BOSS?", $57
; 0x820fd + 67 bytes

_RocketHideout3BattleText2: ; 82140 (20:6140)
	db $0, "Stop meddling in", $4f
	db "TEAM ROCKET's", $55
	db "affairs!", $57
; 0x82140 + 40 bytes

_RocketHideout3EndBattleText2: ; 82168 (20:6168)
	db $0, "Oof!", $4f
	db "Taken down!", $58
; 0x82168 + 18 bytes

_RocketHideout3AfterBattleTxt2: ; 8217a (20:617a)
	db $0, "SILPH SCOPE?", $4f
	db "The machine the", $55
	db "BOSS stole. It's", $55
	db "here somewhere.", $57
; 0x8217a + 62 bytes

_RocketHideout3BattleTxt: ; 821b8 (20:61b8)
	db $0, "We got word from", $4f
	db "upstairs that you", $55
	db "were coming!", $57
; 0x821b8 + 49 bytes

_RocketHideout3EndBattleText3: ; 821e9 (20:61e9)
	db $0, "What?", $4f
	db "I lost? No!", $58
; 0x821e9 + 19 bytes

_RocketHideout3AfterBattleText3: ; 821fc (20:61fc)
	db $0, "Go ahead and go!", $4f
	db "But, you need the", $55
	db "LIFT KEY to run", $55
	db "the elevator!", $57
; 0x821fc + 66 bytes

_UnnamedText_4557a: ; 8223e (20:623e)
	db $0, "So! I must say, I", $4f
	db "am impressed you", $55
	db "got here!", $57
; 0x8223e + 46 bytes

_UnnamedText_4557f: ; 8226c (20:626c)
	db $0, "WHAT!", $4f
	db "This cannot be!", $58
; 0x8226c + 23 bytes

_UnnamedText_45584: ; 82283 (20:6283)
	db $0, "I see that you", $4f
	db "raise #MON", $55
	db "with utmost care.", $51
	db "A child like you", $4f
	db "would never", $55
	db "understand what I", $55
	db "hope to achieve.", $51
	db "I shall step", $4f
	db "aside this time!", $51
	db "I hope we meet", $4f
	db "again...", $57
; 0x82283 + 163 bytes

_RocketHideout4BattleText2: ; 82326 (20:6326)
	db $0, "I know you! You", $4f
	db "ruined our plans", $55
	db "at MT.MOON!", $57
; 0x82326 + 46 bytes

_RocketHideout4EndBattleText2: ; 82354 (20:6354)
	db $0, "Burned", $4f
	db "again!", $58
; 0x82354 + 15 bytes

_RocketHideout4AfterBattleText2: ; 82363 (20:6363)
	db $0, "Do you have", $4f
	db "something against", $55
	db "TEAM ROCKET?", $57
; 0x82363 + 44 bytes

_RocketHideout4BattleText3: ; 8238f (20:638f)
	db $0, "How can you not", $4f
	db "see the beauty of", $55
	db "our evil?", $57
; 0x8238f + 45 bytes

_RocketHideout4EndBattleText3: ; 823bc (20:63bc)
	db $0, "Ayaya!", $58
; 0x823bc + 8 bytes

_RocketHideout4AfterBattleText3: ; 823c4 (20:63c4)
	db $0, "BOSS! I'm sorry I", $4f
	db "failed you!", $57
; 0x823c4 + 30 bytes

_RocketHideout4BattleText4: ; 823e2 (20:63e2)
	db $0, "The elevator", $4f
	db "doesn't work? Who", $55
	db "has the LIFT KEY?", $57
; 0x823e2 + 49 bytes

_RocketHideout4EndBattleText4: ; 82413 (20:6413)
	db $0, "No!", $58
; 0x82413 + 5 bytes

_UnnamedText_455ec: ; 82418 (20:6418)
	db $0, "Oh no! I dropped", $4f
	db "the LIFT KEY!", $57
; 0x82418 + 32 bytes

_UnnamedText_4578b: ; 82438 (20:6438)
	db $0, "It appears to", $4f
	db "need a key.@@"
; 0xa82454

_UnnamedText_59ded: ; 82454 (20:6454)
	db $0, "Eeek!", $4f
	db "No! Stop! Help!", $51
	db "Oh, you're not", $4f
	db "with TEAM ROCKET.", $55
	db "I thought...", $55
	db "I'm sorry. Here,", $55
	db "please take this!", $58
; 0x82454 + 102 bytes

_ReceivedTM36Text: ; 824ba (20:64ba)
	db $0, $52, " got", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x824c9

_TM36ExplanationText: ; 824c9 (20:64c9)
	db $0, "TM36 is", $4f
	db "SELFDESTRUCT!", $51
	db "It's powerful, but", $4f
	db "the #MON that", $55
	db "uses it faints!", $55
	db "Be careful.", $57
; 0x824c9 + 83 bytes

_TM36NoRoomText: ; 8251c (20:651c)
	db $0, "You don't have any", $4f
	db "room for this.", $57
; 0x8251c + 34 bytes

_SilphCo2BattleText1: ; 8253e (20:653e)
	db $0, "Help! I'm a SILPH", $4f
	db "employee.", $57
; 0x8253e + 28 bytes

_SilphCo2EndBattleText1: ; 8255a (20:655a)
	db $0, "How", $4f
	db "did you know I", $55
	db "was a ROCKET?", $58
; 0x8255a + 34 bytes

_SilphCo2AfterBattleText1: ; 8257c (20:657c)
	db $0, "I work for both", $4f
	db "SILPH and TEAM", $55
	db "ROCKET!", $57
; 0x8257c + 40 bytes

_SilphCo2BattleText2: ; 825a4 (20:65a4)
	db $0, "It's off limits", $4f
	db "here! Go home!", $57
; 0x825a4 + 31 bytes

_SilphCo2EndBattleText2: ; 825c3 (20:65c3)
	db $0, "You're", $4f
	db "good.", $58
; 0x825c3 + 13 bytes

_SilphCo2AfterBattleText2: ; 825d0 (20:65d0)
	db $0, "Can you solve the", $4f
	db "maze in here?", $57
; 0x825d0 + 33 bytes

_SilphCo2BattleText3: ; 825f1 (20:65f1)
	db $0, "No kids are", $4f
	db "allowed in here!", $57
; 0x825f1 + 30 bytes

_SilphCo2EndBattleText3: ; 8260f (20:660f)
	db $0, "Tough!", $58
; 0x8260f + 8 bytes

_SilphCo2AfterBattleText3: ; 82617 (20:6617)
	db $0, "Diamond shaped", $4f
	db "tiles are", $55
	db "teleport blocks!", $51
	db "They're hi-tech", $4f
	db "transporters!", $57
; 0x82617 + 72 bytes

_SilphCo2BattleText4: ; 8265f (20:665f)
	db $0, "Hey kid! What are", $4f
	db "you doing here?", $57
; 0x8265f + 35 bytes

_SilphCo2EndBattleText4: ; 82682 (20:6682)
	db $0, "I goofed!", $58
; 0x82682 + 11 bytes

_SilphCo2AfterBattleText4: ; 8268d (20:668d)
	db $0, "SILPH CO. will", $4f
	db "be merged with", $55
	db "TEAM ROCKET!", $57
; 0x8268d + 44 bytes

_UnnamedText_59ff9: ; 826b9 (20:66b9)
	db $0, "I work for SILPH.", $4f
	db "What should I do?", $57
; 0x826b9 + 37 bytes

_UnnamedText_59ffe: ; 826de (20:66de)
	db $0, $52, "! You and", $4f
	db "your #MON", $55
	db "saved us!", $57
; 0x826de + 32 bytes

_SilphCo3BattleText1: ; 826fe (20:66fe)
	db $0, "Quit messing with", $4f
	db "us, kid!", $57
; 0x826fe + 28 bytes

_SilphCo3EndBattleText1: ; 8271a (20:671a)
	db $0, "I give", $4f
	db "up!", $58
; 0x8271a + 12 bytes

_SilphCo3AfterBattleText1: ; 82726 (20:6726)
	db $0, "A hint? You can", $4f
	db "open doors with a", $55
	db "CARD KEY!", $57
; 0x82726 + 45 bytes

_SilphCo3BattleText2: ; 82753 (20:6753)
	db $0, "I support TEAM", $4f
	db "ROCKET more than", $55
	db "I support SILPH!", $57
; 0x82753 + 50 bytes

_SilphCo3EndBattleText2: ; 82785 (20:6785)
	db $0, "You", $4f
	db "really got me!", $58
; 0x82785 + 20 bytes

_SilphCo3AfterBattleText2: ; 82799 (20:6799)
	db $0, "Humph...", $51
	db "TEAM ROCKET said", $4f
	db "that if I helped", $55
	db "them, they'd let", $55
	db "me study #MON!", $57
; 0x82799 + 75 bytes

_UnnamedText_19de0: ; 827e4 (20:67e4)
	db $0, "Sssh! Can't you", $4f
	db "see I'm hiding?", $57
; 0x827e4 + 31 bytes

_UnnamedText_19de5: ; 82803 (20:6803)
	db $0, "Huh? TEAM ROCKET", $4f
	db "is gone?", $57
; 0x82803 + 27 bytes

_SilphCo4BattleText2: ; 8281e (20:681e)
	db $0, "TEAM ROCKET has", $4f
	db "taken command of", $55
	db "SILPH CO.!", $57
; 0x8281e + 45 bytes

_SilphCo4EndBattleText2: ; 8284b (20:684b)
	db $0, "Arrgh!", $58
; 0x8284b + 8 bytes

_SilphCo4AfterBattleText2: ; 82853 (20:6853)
	db $0, "Fwahahaha!", $4f
	db "My BOSS has been", $55
	db "after this place!", $57
; 0x82853 + 47 bytes

_SilphCo4BattleText3: ; 82882 (20:6882)
	db $0, "My #MON are my", $4f
	db "loyal soldiers!", $57
; 0x82882 + 32 bytes

_SilphCo4EndBattleText3: ; 828a2 (20:68a2)
	db $0, "Darn!", $4f
	db "You weak #MON!", $58
; 0x828a2 + 22 bytes

_SilphCo4AfterBattleText3: ; 828b8 (20:68b8)
	db $0, "The doors are", $4f
	db "electronically", $55
	db "locked! A CARD", $55
	db "KEY opens them!", $57
; 0x828b8 + 61 bytes

_SilphCo4BattleText4: ; 828f5 (20:68f5)
	db $0, "Intruder spotted!", $57
; 0x828f5 + 19 bytes

_SilphCo4EndBattleText4: ; 82908 (20:6908)
	db $0, "Who", $4f
	db "are you?", $58
; 0x82908 + 14 bytes

_SilphCo4AfterBattleText4: ; 82916 (20:6916)
	db $0, "I better tell the", $4f
	db "BOSS on 11F!", $57
; 0x82916 + 32 bytes

_UnnamedText_1a010: ; 82936 (20:6936)
	db $0, "TEAM ROCKET is", $4f
	db "in an uproar over", $55
	db "some intruder.", $55
	db "That's you right?", $57
; 0x82936 + 66 bytes

_UnnamedText_1a015: ; 82978 (20:6978)
	db $0, "TEAM ROCKET took", $4f
	db "off! You're our", $55
	db "hero! Thank you!", $57
; 0x82978 + 50 bytes

_SilphCo5BattleText2: ; 829aa (20:69aa)
	db $0, "I heard a kid was", $4f
	db "wandering around.", $57
; 0x829aa + 37 bytes

_SilphCo5EndBattleText2: ; 829cf (20:69cf)
	db $0, "Boom!", $58
; 0x829cf + 7 bytes

_SilphCo5AfterBattleText2: ; 829d6 (20:69d6)
	db $0, "It's not smart", $4f
	db "to pick a fight", $55
	db "with TEAM ROCKET!", $57
; 0x829d6 + 49 bytes

_SilphCo5BattleText3: ; 82a07 (20:6a07)
	db $0, "We study #", $4f
	db "BALL technology", $55
	db "on this floor!", $57
; 0x82a07 + 43 bytes

_SilphCo5EndBattleText3: ; 82a32 (20:6a32)
	db $0, "Dang!", $4f
	db "Blast it!", $58
; 0x82a32 + 17 bytes

_SilphCo5AfterBattleText3: ; 82a43 (20:6a43)
	db $0, "We worked on the", $4f
	db "ultimate #", $55
	db "BALL which would", $55
	db "catch anything!", $57
; 0x82a43 + 62 bytes

_SilphCo5BattleText4: ; 82a81 (20:6a81)
	db $0, "Whaaat? There", $4f
	db "shouldn't be any", $55
	db "children here?", $57
; 0x82a81 + 46 bytes

SECTION "bank21",ROMX,BANK[$21]

_SilphCo5EndBattleText4: ; 84000 (21:4000)
	db $0, "Oh", $4f
	db "goodness!", $58
; 0x84000 + 14 bytes

_SilphCo5AfterBattleText4: ; 8400e (21:400e)
	db $0, "You're only on 5F.", $4f
	db "It's a long way", $55
	db "to my BOSS!", $57
; 0x8400e + 46 bytes

_SilphCo5BattleText5: ; 8403c (21:403c)
	db $0, "Show TEAM ROCKET", $4f
	db "a little respect!", $57
; 0x8403c + 36 bytes

_SilphCo5EndBattleText5: ; 84060 (21:4060)
	db $0, "Cough...", $4f
	db "Cough...", $58
; 0x84060 + 19 bytes

_SilphCo5AfterBattleText5: ; 84073 (21:4073)
	db $0, "Which reminds me.", $51
	db "KOFFING evolves", $4f
	db "into WEEZING!", $57
; 0x84073 + 49 bytes

_SilphCo5Text9: ; 840a4 (21:40a4)
	db $0, "It's a #MON", $4f
	db "REPORT!", $51
	db "#MON LAB", $4f
	db "created PORYGON,", $55
	db "the first virtual", $55
	db "reality #MON.", $57

_SilphCo5Text10: ; 840f2 (21:40f2)
	db $0, "It's a #MON", $4f
	db "REPORT!", $51
	db "Over 160 #MON", $4f
	db "techniques have", $55
	db "been confirmed.", $57

_SilphCo5Text11: ; 84134 (21:4134)
	db $0, "It's a #MON", $4f
	db "REPORT!", $51
	db "4 #MON evolve", $4f
	db "only when traded", $55
	db "by link-cable.", $57

_UnnamedText_1a24a: ; 84176 (21:4176)
	db $0, "The ROCKETs came", $4f
	db "and took over the", $55
	db "building!", $57
; 0x84176 + 46 bytes

_UnnamedText_1a24f: ; 841a4 (21:41a4)
	db $0, "Well, better get", $4f
	db "back to work!", $57
; 0x841a4 + 32 bytes

_UnnamedText_1a261: ; 841c4 (21:41c4)
	db $0, "Oh dear, oh dear.", $4f
	db "Help me please!", $57
; 0x841c4 + 35 bytes

_UnnamedText_1a266: ; 841e7 (21:41e7)
	db $0, "We got engaged!", $4f
	db "Heheh!", $57
; 0x841e7 + 24 bytes

_UnnamedText_1a278: ; 841ff (21:41ff)
	db $0, "Look at him! He's", $4f
	db "such a coward!", $57
; 0x841ff + 33 bytes

_UnnamedText_1a27d: ; 84220 (21:4220)
	db $0, "I feel so sorry", $4f
	db "for him, I have", $55
	db "to marry him!", $57
; 0x84220 + 47 bytes

_UnnamedText_1a28f: ; 8424f (21:424f)
	db $0, "TEAM ROCKET is", $4f
	db "trying to conquer", $55
	db "the world with", $55
	db "#MON!", $57
; 0x8424f + 55 bytes

_UnnamedText_1a294: ; 84286 (21:4286)
	db $0, "TEAM ROCKET ran", $4f
	db "because of you!", $57
; 0x84286 + 33 bytes

_UnnamedText_1a2a6: ; 842a7 (21:42a7)
	db $0, "They must have", $4f
	db "targeted SILPH", $55
	db "for our #MON", $55
	db "products.", $57
; 0x842a7 + 54 bytes

_UnnamedText_1a2ab: ; 842dd (21:42dd)
	db $0, "Come work for", $4f
	db "SILPH when you", $55
	db "get older!", $57
; 0x842dd + 41 bytes

_SilphCo6BattleText2: ; 84306 (21:4306)
	db $0, "I am one of the 4", $4f
	db "ROCKET BROTHERS!", $57
; 0x84306 + 36 bytes

_SilphCo6EndBattleText2: ; 8432a (21:432a)
	db $0, "Flame", $4f
	db "out!", $58
; 0x8432a + 12 bytes

_SilphCo6AfterBattleText2: ; 84336 (21:4336)
	db $0, "No matter!", $4f
	db "My brothers will", $55
	db "avenge me!", $57
; 0x84336 + 40 bytes

_SilphCo6BattleText3: ; 8435e (21:435e)
	db $0, "That rotten", $4f
	db "PRESIDENT!", $51
	db "He shouldn't have", $4f
	db "sent me to the", $55
	db "TIKSI BRANCH!", $57
; 0x8435e + 70 bytes

_SilphCo6EndBattleText3: ; 843a4 (21:43a4)
	db $0, "Shoot!", $58
; 0x843a4 + 8 bytes

_SilphCo6AfterBattleText3: ; 843ac (21:43ac)
	db $0, "TIKSI BRANCH?", $4f
	db "It's in Russian", $55
	db "no man's land!", $57
; 0x843ac + 44 bytes

_SilphCo6BattleText4: ; 843d8 (21:43d8)
	db $0, "You dare betray", $4f
	db "TEAM ROCKET?", $57
; 0x843d8 + 30 bytes

_SilphCo6EndBattleText4: ; 843f6 (21:43f6)
	db $0, "You", $4f
	db "traitor!", $58
; 0x843f6 + 14 bytes

_SilphCo6AfterBattleText4: ; 84404 (21:4404)
	db $0, "If you stand for", $4f
	db "justice, you", $55
	db "betray evil!", $57
; 0x84404 + 44 bytes

_UnnamedText_51dd3: ; 84430 (21:4430)
	db $0, "Oh! Hi! You're", $4f
	db "not a ROCKET! You", $55
	db "came to save us?", $55
	db "Why, thank you!", $51
	db "I want you to", $4f
	db "have this #MON", $55
	db "for saving us.", $58
; 0x84430 + 110 bytes

_UnnamedText_51dd8: ; 8449e (21:449e)
	db $0, "It's LAPRAS. It's", $4f
	db "very intelligent.", $51
	db "We kept it in our", $4f
	db "lab, but it will", $55
	db "be much better", $55
	db "off with you!", $51
	db "I think you will", $4f
	db "be a good trainer", $55
	db "for LAPRAS!", $51
	db "It's a good", $4f
	db "swimmer. It'll", $55
	db "give you a lift!", $57
; 0x8449e + 188 bytes

_UnnamedText_51ddd: ; 8455a (21:455a)
	db $0, "TEAM ROCKET's", $4f
	db "BOSS went to the", $55
	db "boardroom! Is our", $55
	db "PRESIDENT OK?", $57
; 0x8455a + 63 bytes

_UnnamedText_51de2: ; 84599 (21:4599)
	db $0, "Saved at last!", $4f
	db "Thank you!", $57
; 0x84599 + 27 bytes

_UnnamedText_51e00: ; 845b4 (21:45b4)
	db $0, "TEAM ROCKET was", $4f
	db "after the MASTER", $55
	db "BALL which will", $55
	db "catch any #MON!", $57
; 0x845b4 + 66 bytes

_UnnamedText_51e05: ; 845f6 (21:45f6)
	db $0, "We canceled the", $4f
	db "MASTER BALL", $55
	db "project because", $55
	db "of TEAM ROCKET.", $57
; 0x845f6 + 61 bytes

_UnnamedText_51e23: ; 84633 (21:4633)
	db $0, "It would be bad", $4f
	db "if TEAM ROCKET", $55
	db "took over SILPH", $55
	db "or our #MON!", $57
; 0x84633 + 61 bytes

_UnnamedText_51e28: ; 84670 (21:4670)
	db $0, "Wow! You chased", $4f
	db "off TEAM ROCKET", $55
	db "all by yourself?", $57
; 0x84670 + 50 bytes

_UnnamedText_51e46: ; 846a2 (21:46a2)
	db $0, "You! It's really", $4f
	db "dangerous here!", $55
	db "You came to save", $55
	db "me? You can't!", $57
; 0x846a2 + 64 bytes

_UnnamedText_51e4b: ; 846e2 (21:46e2)
	db $0, "Safe at last!", $4f
	db "Oh thank you!", $57
; 0x846e2 + 29 bytes

_SilphCo7BattleText1: ; 846ff (21:46ff)
	db $0, "Oh ho! I smell a", $4f
	db "little rat!", $57
; 0x846ff + 30 bytes

_SilphCo7EndBattleText1: ; 8471d (21:471d)
	db $0, "Lights", $4f
	db "out!", $58
; 0x8471d + 13 bytes

_SilphCo7AfterBattleText1: ; 8472a (21:472a)
	db $0, "You won't find my", $4f
	db "BOSS by just", $55
	db "scurrying around!", $57
; 0x8472a + 49 bytes

_SilphCo7BattleText2: ; 8475b (21:475b)
	db $0, "Heheh!", $51
	db "You mistook me for", $4f
	db "a SILPH worker?", $57
; 0x8475b + 43 bytes

_SilphCo7EndBattleText2: ; 84786 (21:4786)
	db $0, "I'm", $4f
	db "done!", $58
; 0x84786 + 10 bytes

_SilphCo7AfterBattleText2: ; 84790 (21:4790)
	db $0, "Despite your age,", $4f
	db "you are a skilled", $55
	db "trainer!", $57
; 0x84790 + 46 bytes

_SilphCo7BattleText3: ; 847be (21:47be)
	db $0, "I am one of the 4", $4f
	db "ROCKET BROTHERS!", $57
; 0x847be + 36 bytes

_SilphCo7EndBattleText3: ; 847e2 (21:47e2)
	db $0, "Aack!", $4f
	db "Brothers, I lost!", $58
; 0x847e2 + 25 bytes

_SilphCo7AfterBattleText3: ; 847fb (21:47fb)
	db $0, "Doesn't matter.", $4f
	db "My brothers will", $55
	db "repay the favor!", $57
; 0x847fb + 50 bytes

_SilphCo7BattleText4: ; 8482d (21:482d)
	db $0, "A child intruder?", $4f
	db "That must be you!", $57
; 0x8482d + 37 bytes

_SilphCo7EndBattleText4: ; 84852 (21:4852)
	db $0, "Fine!", $4f
	db "I lost!", $58
; 0x84852 + 15 bytes

_SilphCo7AfterBattleText4: ; 84861 (21:4861)
	db $0, "Go on home", $4f
	db "before my BOSS", $55
	db "gets ticked off!", $57
; 0x84861 + 44 bytes

_UnnamedText_51ebe: ; 8488d (21:488d)
	db $0, $53, ": What", $4f
	db "kept you ", $52, "?", $57
; 0x8488d + 21 bytes

_UnnamedText_51ec3: ; 848a2 (21:48a2)
	db $0, $53, ": Hahaha!", $4f
	db "I thought you'd", $55
	db "turn up if I", $55
	db "waited here!", $51
	db "I guess TEAM", $4f
	db "ROCKET slowed you", $55
	db "down! Not that I", $55
	db "care!", $51
	db "I saw you in", $4f
	db "SAFFRON, so I", $55
	db "decided to see if", $55
	db "you got better!", $57
; 0x848a2 + 168 bytes

_UnnamedText_51ec8: ; 8494a (21:494a)
	db $0, "Oh ho!", $4f
	db "So, you are ready", $55
	db "for BOSS ROCKET!", $58
; 0x8494a + 43 bytes

_UnnamedText_51ecd: ; 84975 (21:4975)
	db $0, $53, ": How can", $4f
	db "I put this?", $51
	db "You're not good", $4f
	db "enough to play", $55
	db "with us big boys!", $58
; 0x84975 + 72 bytes

_UnnamedText_51ed2: ; 849bd (21:49bd)
	db $0, "Well, ", $52, "!", $51
	db "I'm moving on up", $4f
	db "and ahead!", $51
	db "By checking my", $4f
	db "#DEX, I'm", $55
	db "starting to see", $55
	db "what's strong and", $55
	db "how they evolve!", $51
	db "I'm going to the", $4f
	db "#MON LEAGUE", $55
	db "to boot out the", $55
	db "ELITE FOUR!", $51
	db "I'll become the", $4f
	db "world's most", $55
	db "powerful trainer!", $51
	db $52, ", well", $4f
	db "good luck to you!", $55
	db "Don't sweat it!", $55
	db "Smell ya!", $57
; 0x849bd + 263 bytes

_UnnamedText_565be: ; 84ac4 (21:4ac4)
	db $0, "I wonder if SILPH", $4f
	db "is finished...", $57
; 0x84ac4 + 34 bytes

_UnnamedText_565c3: ; 84ae6 (21:4ae6)
	db $0, "Thanks for saving", $4f
	db "us!", $57
; 0x84ae6 + 23 bytes

_SilphCo8BattleText1: ; 84afd (21:4afd)
	db $0, "That's as far as", $4f
	db "you'll go!", $57
; 0x84afd + 27 bytes

_SilphCo8EndBattleText1: ; 84b18 (21:4b18)
	db $0, "Not", $4f
	db "enough grit!", $58
; 0x84b18 + 18 bytes

_SilphCo8AfterBattleText1: ; 84b2a (21:4b2a)
	db $0, "If you don't turn", $4f
	db "back, I'll call", $55
	db "for backup!", $57
; 0x84b2a + 45 bytes

_SilphCo8BattleText2: ; 84b57 (21:4b57)
	db $0, "You're causing us", $4f
	db "problems!", $57
; 0x84b57 + 28 bytes

_SilphCo8EndBattleText2: ; 84b73 (21:4b73)
	db $0, "Huh?", $4f
	db "I lost?", $58
; 0x84b73 + 14 bytes

_SilphCo8AfterBattleText2: ; 84b81 (21:4b81)
	db $0, "So, what do you", $4f
	db "think of SILPH", $55
	db "BUILDING's maze?", $57
; 0x84b81 + 48 bytes

_SilphCo8BattleText3: ; 84bb1 (21:4bb1)
	db $0, "I am one of the 4", $4f
	db "ROCKET BROTHERS!", $57
; 0x84bb1 + 36 bytes

_SilphCo8EndBattleText3: ; 84bd5 (21:4bd5)
	db $0, "Whoo!", $4f
	db "Oh brothers!", $58
; 0x84bd5 + 20 bytes

_SilphCo8AfterBattleText3: ; 84be9 (21:4be9)
	db $0, "I'll leave you up", $4f
	db "to my brothers!", $57
; 0x84be9 + 34 bytes

_UnnamedText_5d8e5: ; 84c0b (21:4c0b)
	db $0, "You look tired!", $4f
	db "You should take a", $55
	db "quick nap!", $58
; 0x84c0b + 46 bytes

_UnnamedText_5d8ea: ; 84c39 (21:4c39)
	db $0, "Don't give up!", $57
; 0x84c39 + 15 bytes

_UnnamedText_5d8ef: ; 84c48 (21:4c48)
	db $0, "Thank you so", $4f
	db "much!", $57
; 0x84c48 + 20 bytes

_SilphCo9BattleText1: ; 84c5c (21:4c5c)
	db $0, "Your #MON seem", $4f
	db "to adore you, kid!", $57
; 0x84c5c + 35 bytes

_SilphCo9EndBattleText1: ; 84c7f (21:4c7f)
	db $0, "Ghaaah!", $58
; 0x84c7f + 9 bytes

_SilphCo9AfterBattleText1: ; 84c88 (21:4c88)
	db $0, "If I had started", $4f
	db "as a trainer at", $55
	db "your age...", $57
; 0x84c88 + 46 bytes

_SilphCo9BattleText2: ; 84cb6 (21:4cb6)
	db $0, "Your #MON have", $4f
	db "weak points! I", $55
	db "can nail them!", $57
; 0x84cb6 + 46 bytes

_SilphCo9EndBattleText2: ; 84ce4 (21:4ce4)
	db $0, "You", $4f
	db "hammered me!", $58
; 0x84ce4 + 18 bytes

_SilphCo9AfterBattleText2: ; 84cf6 (21:4cf6)
	db $0, "Exploiting weak", $4f
	db "spots does work!", $55
	db "Think about", $55
	db "element types!", $57
; 0x84cf6 + 61 bytes

_SilphCo9BattleText3: ; 84d33 (21:4d33)
	db $0, "I am one of the 4", $4f
	db "ROCKET BROTHERS!", $57
; 0x84d33 + 36 bytes

_SilphCo9EndBattleText3: ; 84d57 (21:4d57)
	db $0, "Warg!", $4f
	db "Brothers, I lost!", $58
; 0x84d57 + 25 bytes

_SilphCo9AfterBattleText3: ; 84d70 (21:4d70)
	db $0, "My brothers will", $4f
	db "avenge me!", $57
; 0x84d70 + 29 bytes

_UnnamedText_5a1d3: ; 84d8d (21:4d8d)
	db $0, "Waaaaa!", $55
	db "I'm scared!", $57
; 0x84d8d + 20 bytes

_UnnamedText_5a1d8: ; 84da1 (21:4da1)
	db $0, "Please keep quiet", $4f
	db "about my crying!", $57
; 0x84da1 + 36 bytes

_SilphCo10BattleText1: ; 84dc5 (21:4dc5)
	db $0, "Welcome to the", $4f
	db "10F! So good of", $55
	db "you to join me!", $57
; 0x84dc5 + 48 bytes

_SilphCo10EndBattleText1: ; 84df5 (21:4df5)
	db $0, "I'm", $4f
	db "stunned!", $58
; 0x84df5 + 13 bytes

_SilphCo10AfterBattleText1: ; 84e02 (21:4e02)
	db $0, "Nice try, but the", $4f
	db "boardroom is up", $55
	db "one more floor!", $57
; 0x84e02 + 51 bytes

_SilphCo10BattleText2: ; 84e35 (21:4e35)
	db $0, "Enough of your", $4f
	db "silly games!", $57
; 0x84e35 + 29 bytes

_SilphCo10EndBattleText2: ; 84e52 (21:4e52)
	db $0, "No", $4f
	db "continues left!", $58
; 0x84e52 + 20 bytes

_SilphCo10AfterBattleText2: ; 84e66 (21:4e66)
	db $0, "Are you satisfied", $4f
	db "with beating me?", $55
	db "Then go on home!", $57
; 0x84e66 + 53 bytes

_SilphCoPresidentText: ; 84e9b (21:4e9b)
	db $0, "PRESIDENT: Thank", $4f
	db "you for saving", $55
	db "SILPH!", $51
	db "I will never", $4f
	db "forget you saved", $55
	db "us in our moment", $55
	db "of peril!", $51
	db "I have to thank", $4f
	db "you in some way!", $51
	db "Because I am rich,", $4f
	db "I can give you", $55
	db "anything!", $51
	db "Here, maybe this", $4f
	db "will do!", $58
; 0x84e9b + 200 bytes

_ReceivedSilphCoMasterBallText: ; 84f63 (21:4f63)
	db $0, $52, " got a", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x84f74

_UnnamedText_6231c: ; 84f74 (21:4f74)
	db $0, "PRESIDENT: You", $4f
	db "can't buy that", $55
	db "anywhere!", $51
	db "It's our secret", $4f
	db "prototype MASTER", $55
	db "BALL!", $51
	db "It will catch any", $4f
	db "#MON without", $55
	db "fail!", $51
	db "You should be", $4f
	db "quiet about using", $55
	db "it, though.", $57
; 0x84f74 + 159 bytes

_SilphCoMasterBallNoRoomText: ; 85013 (21:5013)
	db $0, "You have no", $4f
	db "room for this.", $57
; 0x85013 + 28 bytes

_SilphCo11Text2: ; 8502f (21:502f)
	db $0, "SECRETARY: Thank", $4f
	db "you for rescuing", $55
	db "all of us!", $51
	db "We admire your", $4f
	db "courage.", $57

_SilphCo11Text3: ; 85075 (21:5075)
	db $0, "Ah ", $52, "!", $4f
	db "So we meet again!", $51
	db "The PRESIDENT and", $4f
	db "I are discussing", $55
	db "a vital business", $55
	db "proposition.", $51
	db "Keep your nose", $4f
	db "out of grown-up", $55
	db "matters...", $51
	db "Or, experience a", $4f
	db "world of pain!", $57

_UnnamedText_62330: ; 85119 (21:5119)
	db $0, "Arrgh!!", $4f
	db "I lost again!?", $58
; 0x85119 + 24 bytes

_UnnamedText_62335: ; 85131 (21:5131)
	db $0, "Blast it all!", $4f
	db "You ruined our", $55
	db "plans for SILPH!", $51
	db "But, TEAM ROCKET", $4f
	db "will never fall!", $51
	db $52, "! Never", $4f
	db "forget that all", $55
	db "#MON exist", $55
	db "for TEAM ROCKET!", $51
	db "I must go, but I", $4f
	db "shall return!", $57
; 0x85131 + 165 bytes

_SilphCo11BattleText1: ; 851d6 (21:51d6)
	db $0, "Stop right there!", $4f
	db "Don't you move!", $57
; 0x851d6 + 34 bytes

_SilphCo11EndBattleText1: ; 851f8 (21:51f8)
	db $0, "Don't...", $4f
	db "Please!", $58
; 0x851f8 + 17 bytes

_SilphCo11AfterBattleText1: ; 85209 (21:5209)
	db $0, "So, you want to", $4f
	db "see my BOSS?", $57
; 0x85209 + 30 bytes

_SilphCo11BattleText2: ; 85227 (21:5227)
	db $0, "Halt! Do you have", $4f
	db "an appointment", $55
	db "with my BOSS?", $57
; 0x85227 + 48 bytes

_SilphCo11EndBattleText2: ; 85257 (21:5257)
	db $0, "Gaah!", $4f
	db "Demolished!", $58
; 0x85257 + 19 bytes

_SilphCo11AfterBattleText2: ; 8526a (21:526a)
	db $0, "Watch your step,", $4f
	db "my BOSS likes his", $55
	db "#MON tough!", $57
; 0x8526a + 48 bytes

_UnnamedText_6237b: ; 8529a (21:529a)
	db $0, "The monitor has", $4f
	db "#MON on it!", $57
; 0x8529a + 29 bytes

_Mansion2BattleText1: ; 852b7 (21:52b7)
	db $0, "I can't get out!", $4f
	db "This old place is", $55
	db "one big puzzle!", $57
; 0x852b7 + 51 bytes

_Mansion2EndBattleText1: ; 852ea (21:52ea)
	db $0, "Oh no!", $4f
	db "My bag of loot!", $58
; 0x852ea + 24 bytes

_Mansion2AfterBattleText1: ; 85302 (21:5302)
	db $0, "Switches open and", $4f
	db "close alternating", $55
	db "sets of doors!", $57
; 0x85302 + 52 bytes

_Mansion2Text3: ; 85336 (21:5336)
	db $0, "Diary: July 5", $4f
	db "Guyana,", $55
	db "South America", $51
	db "A new #MON was", $4f
	db "discovered deep", $55
	db "in the jungle.", $57

_Mansion2Text4: ; 85389 (21:5389)
	db $0, "Diary: July 10", $4f
	db "We christened the", $55
	db "newly discovered", $55
	db "#MON, MEW.", $57

_UnnamedText_520c2: ; 853c7 (21:53c7)
	db $0, "A secret switch!", $51
	db "Press it?", $57
; 0x853c7 + 28 bytes

_UnnamedText_520c7: ; 853e3 (21:53e3)
	db $0, "Who wouldn't?", $58
; 0x853e3 + 14 bytes

_UnnamedText_520cc: ; 853f1 (21:53f1)
	db $0, "Not quite yet!", $57
; 0x853f1 + 16 bytes

_Mansion3BattleText1: ; 85401 (21:5401)
	db $0, "This place is", $4f
	db "like, huge!", $57
; 0x85401 + 27 bytes

_Mansion3EndBattleText1: ; 8541c (21:541c)
	db $0, "Ayah!", $58
; 0x8541c + 7 bytes

_Mansion3AfterBattleText1: ; 85423 (21:5423)
	db $0, "I wonder where", $4f
	db "my partner went.", $57
; 0x85423 + 33 bytes

_Mansion3BattleText2: ; 85444 (21:5444)
	db $0, "My mentor once", $4f
	db "lived here.", $57
; 0x85444 + 28 bytes

_Mansion3EndBattleText2: ; 85460 (21:5460)
	db $0, "Whew!", $4f
	db "Overwhelming!", $58
; 0x85460 + 21 bytes

_Mansion3AfterBattleText2: ; 85475 (21:5475)
	db $0, "So, you're stuck?", $4f
	db "Try jumping off", $55
	db "over there!", $57
; 0x85475 + 46 bytes

_Mansion3Text5: ; 854a3 (21:54a3)
	db $0, "Diary: Feb. 6", $4f
	db "MEW gave birth.", $51
	db "We named the", $4f
	db "newborn MEWTWO.", $57

_Mansion4BattleText1: ; 854df (21:54df)
	db $0, "Uh-oh. Where am", $4f
	db "I now?", $57
; 0x854df + 24 bytes

_Mansion4EndBattleText1: ; 854f7 (21:54f7)
	db $0, "Awooh!", $58
; 0x854f7 + 8 bytes

_Mansion4AfterBattleText1: ; 854ff (21:54ff)
	db $0, "You can find stuff", $4f
	db "lying around.", $57
; 0x854ff + 34 bytes

_Mansion4BattleText2: ; 85521 (21:5521)
	db $0, "This place is", $4f
	db "ideal for a lab.", $57
; 0x85521 + 32 bytes

_Mansion4EndBattleText2: ; 85541 (21:5541)
	db $0, "What", $4f
	db "was that for?", $58
; 0x85541 + 20 bytes

_Mansion4AfterBattleText2: ; 85555 (21:5555)
	db $0, "I like it here!", $4f
	db "It's conducive to", $55
	db "my studies!", $57
; 0x85555 + 46 bytes

_Mansion4Text7: ; 85583 (21:5583)
	db $0, "Diary; Sept. 1", $4f
	db "MEWTWO is far too", $55
	db "powerful.", $51
	db "We have failed to", $4f
	db "curb its vicious", $55
	db "tendencies...", $57

_SafariZoneEastText5: ; 855e0 (21:55e0)
	db $0, "REST HOUSE", $57

_SafariZoneEastText6: ; 855ec (21:55ec)
	db $0, "TRAINER TIPS", $51
	db "The remaining time", $4f
	db "declines only", $55
	db "while you walk!", $57

_SafariZoneEastText7: ; 8562b (21:562b)
	db $0, "CENTER AREA", $4f
	db "NORTH: AREA 2", $57

_SafariZoneNorthText3: ; 85646 (21:5646)
	db $0, "REST HOUSE", $57

_SafariZoneNorthText4: ; 85652 (21:5652)
	db $0, "TRAINER TIPS", $51
	db "The SECRET HOUSE", $4f
	db "is still ahead!", $57

_SafariZoneNorthText5: ; 85681 (21:5681)
	db $0, "AREA 2", $57

_SafariZoneNorthText6: ; 85689 (21:5689)
	db $0, "TRAINER TIPS", $51
	db "#MON hide in", $4f
	db "tall grass!", $51
	db "Zigzag through", $4f
	db "grassy areas to", $55
	db "flush them out.", $57

_SafariZoneNorthText7: ; 856df (21:56df)
	db $0, "TRAINER TIPS", $51
	db "Win a free HM for", $4f
	db "finding the", $55
	db "SECRET HOUSE!", $57

_SafariZoneWestText5: ; 85719 (21:5719)
	db $0, "REST HOUSE", $57

_SafariZoneWestText6: ; 85725 (21:5725)
	db $0, "REQUEST NOTICE", $51
	db "Please find the", $4f
	db "SAFARI WARDEN's", $55
	db "lost GOLD TEETH.", $55
	db "They're around", $55
	db "here somewhere.", $51
	db "Reward offered!", $4f
	db "Contact: WARDEN", $57

_SafariZoneWestText7: ; 857a3 (21:57a3)
	db $0, "TRAINER TIPS", $51
	db "Zone Exploration", $4f
	db "Campaign!", $51
	db "The Search for", $4f
	db "the SECRET HOUSE!", $57

_SafariZoneWestText8: ; 857ed (21:57ed)
	db $0, "AREA 3", $4f
	db "EAST: CENTER AREA", $57

_SafariZoneCenterText2: ; 85807 (21:5807)
	db $0, "REST HOUSE", $57

_SafariZoneCenterText3: ; 85813 (21:5813)
	db $0, "TRAINER TIPS", $51
	db "Press the START", $4f
	db "Button to check", $55
	db "remaining time!", $57

_SafariZoneRestHouse1Text1: ; 85851 (21:5851)
	db $0, "SARA: Where did", $4f
	db "my boy friend,", $55
	db "ERIK, go?", $57

_SafariZoneRestHouse1Text2: ; 8587b (21:587b)
	db $0, "I'm catching", $4f
	db "#MON to take", $55
	db "home as gifts!", $57

_UnnamedText_4a350: ; 858a4 (21:58a4)
	db $0, "Ah! Finally!", $51
	db "You're the first", $4f
	db "person to reach", $55
	db "the SECRET HOUSE!", $51
	db "I was getting", $4f
	db "worried that no", $55
	db "one would win our", $55
	db "campaign prize.", $51
	db "Congratulations!", $4f
	db "You have won!", $58
; 0x858a4 + 159 bytes

_ReceivedHM03Text: ; 85943 (21:5943)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x85957

_HM03ExplanationText: ; 85957 (21:5957)
	db $0, "HM03 is SURF!", $51
	db "#MON will be", $4f
	db "able to ferry you", $55
	db "across water!", $51
	db "And, this HM isn't", $4f
	db "disposable! You", $55
	db "can use it over", $55
	db "and over!", $51
	db "You're super lucky", $4f
	db "for winning this", $55
	db "fabulous prize!", $57
; 0x85957 + 171 bytes

_HM03NoRoomText: ; 85a02 (21:5a02)
	db $0, "You don't have", $4f
	db "room for this", $55
	db "fabulous prize!", $57
; 0x85a02 + 45 bytes

_SafariZoneRestHouse2Text1: ; 85a2f (21:5a2f)
	db $0, "Tossing ROCKs at", $4f
	db "#MON might", $55
	db "make them run,", $55
	db "but they'll be", $55
	db "easier to catch.", $57

_SafariZoneRestHouse2Text2: ; 85a7a (21:5a7a)
	db $0, "Using BAIT will", $4f
	db "make #MON", $55
	db "easier to catch.", $57

_SafariZoneRestHouse2Text3: ; 85aa6 (21:5aa6)
	db $0, "I hiked a lot, but", $4f
	db "I didn't see any", $55
	db "#MON I wanted.", $57

_SafariZoneRestHouse3Text1: ; 85ad9 (21:5ad9)
	db $0, "How many did you", $4f
	db "catch? I'm bushed", $55
	db "from the work!", $57

_SafariZoneRestHouse3Text2: ; 85b0b (21:5b0b)
	db $0, "I caught a", $4f
	db "CHANSEY!", $51
	db "That makes this", $4f
	db "all worthwhile!", $57

_SafariZoneRestHouse3Text3: ; 85b40 (21:5b40)
	db $0, "Whew! I'm tired", $4f
	db "from all the fun!", $57

_SafariZoneRestHouse4Text1: ; 85b62 (21:5b62)
	db $0, "You can keep any", $4f
	db "item you find on", $55
	db "the ground here.", $51
	db "But, you'll run", $4f
	db "out of time if", $55
	db "you try for all", $55
	db "of them at once!", $57

_SafariZoneRestHouse4Text2: ; 85bd5 (21:5bd5)
	db $0, "Go to the deepest", $4f
	db "part of the", $55
	db "SAFARI ZONE. You", $55
	db "will win a prize!", $57

_SafariZoneRestHouse4Text3: ; 85c17 (21:5c17)
	db $0, "My EEVEE evolved", $4f
	db "into FLAREON!", $51
	db "But, a friend's", $4f
	db "EEVEE turned into", $55
	db "a VAPOREON!", $55
	db "I wonder why?", $57

_UnknownDungeon3MewtwoText: ; 85c72 (21:5c72)
	db $0, "Mew!@@"
; 0x85c79

_VictoryRoad1BattleText1: ; 85c79 (21:5c79)
	db $0, "I wonder if you", $4f
	db "are good enough", $55
	db "for me!", $57
; 0x85c79 + 41 bytes

_VictoryRoad1EndBattleText1: ; 85ca2 (21:5ca2)
	db $0, "I", $4f
	db "lost out!", $58
; 0x85ca2 + 13 bytes

_VictoryRoad1AfterBattleText1: ; 85caf (21:5caf)
	db $0, "I never wanted to", $4f
	db "lose to anybody!", $57
; 0x85caf + 36 bytes

_VictoryRoad1BattleText2: ; 85cd3 (21:5cd3)
	db $0, "I can see you're", $4f
	db "good! Let me see", $55
	db "exactly how good!", $57
; 0x85cd3 + 52 bytes

_VictoryRoad1EndBattleText2: ; 85d07 (21:5d07)
	db $0, "I", $4f
	db "had a chance...", $58
; 0x85d07 + 19 bytes

_VictoryRoad1AfterBattleText2: ; 85d1a (21:5d1a)
	db $0, "I concede, you're", $4f
	db "better than me!", $57
; 0x85d1a + 34 bytes

_LanceBeforeBattleText: ; 85d3c (21:5d3c)
	db $0, "Ah! I heard about", $4f
	db "you ", $52, "!", $51
	db "I lead the ELITE", $4f
	db "FOUR! You can", $55
	db "call me LANCE the", $55
	db "dragon trainer!", $51
	db "You know that", $4f
	db "dragons are", $55
	db "mythical #MON!", $51
	db "They're hard to", $4f
	db "catch and raise,", $55
	db "but their powers", $55
	db "are superior!", $51
	db "They're virtually", $4f
	db "indestructible!", $51
	db "Well, are you", $4f
	db "ready to lose?", $51
	db "Your LEAGUE", $4f
	db "challenge ends", $55
	db "with me, ", $52, "!", $57
; 0x85d3c + 296 bytes

_LanceEndBattleText: ; 85e64 (21:5e64)
	db $0, "That's it!", $51
	db "I hate to admit", $4f
	db "it, but you are a", $55
	db "#MON master!", $58
; 0x85e64 + 58 bytes

_LanceAfterBattleText: ; 85e9e (21:5e9e)
	db $0, "I still can't", $4f
	db "believe my", $55
	db "dragons lost to", $55
	db "you, ", $52, "!", $51
	db "You are now the", $4f
	db "#MON LEAGUE", $55
	db "champion!", $51
	db "...Or, you would", $4f
	db "have been, but", $55
	db "you have one more", $55
	db "challenge ahead.", $51
	db "You have to face", $4f
	db "another trainer!", $55
	db "His name is...", $51
	db $53, "!", $4f
	db "He beat the ELITE", $55
	db "FOUR before you!", $51
	db "He is the real", $4f
	db "#MON LEAGUE", $55
	db "champion!@@"
; 0x85e9e + 279 bytes = 0x85fb5

_HallofFameRoomText1: ; 85fb5 (21:5fb5)
	db $0, "OAK: Er-hem!", $4f
	db "Congratulations", $55
	db $52, "!", $51
	db "This floor is the", $4f
	db "#MON HALL OF", $55
	db "FAME!", $51
	db "#MON LEAGUE", $4f
	db "champions are", $55
	db "honored for their", $55
	db "exploits here!", $51
	db "Their #MON are", $4f
	db "also recorded in", $55
	db "the HALL OF FAME!", $51
	db $52, "! You have", $4f
	db "endeavored hard", $55
	db "to become the new", $55
	db "LEAGUE champion!", $51
	db "Congratulations,", $4f
	db $52, ", you and", $55
	db "your #MON are", $55
	db "HALL OF FAMERs!", $57

_UnnamedText_760f4: ; 860e1 (21:60e1)
	db $0, $53, ": Hey!", $51
	db "I was looking", $4f
	db "forward to seeing", $55
	db "you, ", $52, "!", $51
	db "My rival should", $4f
	db "be strong to keep", $55
	db "me sharp!", $51
	db "While working on", $4f
	db "#DEX, I looked", $55
	db "all over for", $55
	db "powerful #MON!", $51
	db "Not only that, I", $4f
	db "assembled teams", $55
	db "that would beat", $55
	db "any #MON type!", $51
	db "And now!", $51
	db "I'm the #MON", $4f
	db "LEAGUE champion!", $51
	db $52, "! Do you", $4f
	db "know what that", $55
	db "means?", $51
	db "I'll tell you!", $51
	db "I am the most", $4f
	db "powerful trainer", $55
	db "in the world!", $57
; 0x860e1 + 346 bytes

_UnnamedText_760f9: ; 8623b (21:623b)
	db $0, "NO!", $4f
	db "That can't be!", $55
	db "You beat my best!", $51
	db "After all that", $4f
	db "work to become", $55
	db "LEAGUE champ?", $51
	db "My reign is over", $4f
	db "already?", $55
	db "It's not fair!", $58
; 0x8623b + 121 bytes

_UnnamedText_760fe: ; 862b4 (21:62b4)
	db $0, "Hahaha!", $4f
	db "I won, I won!", $51
	db "I'm too good for", $4f
	db "you, ", $52, "!", $51
	db "You did well to", $4f
	db "even reach me,", $55
	db $53, ", the", $55
	db "#MON genius!", $51
	db "Nice try, loser!", $4f
	db "Hahaha!", $58
; 0x862b4 + 123 bytes

_UnnamedText_76103: ; 8632f (21:632f)
	db $0, "Why?", $4f
	db "Why did I lose?", $51
	db "I never made any", $4f
	db "mistakes raising", $55
	db "my #MON...", $51
	db "Darn it! You're", $4f
	db "the new #MON", $55
	db "LEAGUE champion!", $51
	db "Although I don't", $4f
	db "like to admit it.", $57
; 0x8632f + 146 bytes

_GaryText2: ; 863c1 (21:63c1)
	db $0, "OAK: ", $52, "!", $57

_UnnamedText_76120: ; 863ca (21:63ca)
	db $0, "OAK: So, you won!", $4f
	db "Congratulations!", $55
	db "You're the new", $55
	db "#MON LEAGUE", $55
	db "champion!", $51
	db "You've grown up so", $4f
	db "much since you", $55
	db "first left with", $55
	db "@"
	TX_RAM $cd6d
	db $0, "!", $51
	db $52, ", you have", $4f
	db "come of age!", $57
; 0xa86463

_UnnamedText_76125: ; 86463 (21:6463)
	db $0, "OAK: ", $53, "! I'm", $4f
	db "disappointed!", $51
	db "I came when I", $4f
	db "heard you beat", $55
	db "the ELITE FOUR!", $51
	db "But, when I got", $4f
	db "here, you had", $55
	db "already lost!", $51
	db $53, "! Do you", $4f
	db "understand why", $55
	db "you lost?", $51
	db "You have forgotten", $4f
	db "to treat your", $55
	db "#MON with", $55
	db "trust and love!", $51
	db "Without them, you", $4f
	db "will never become", $55
	db "a champ again!", $57
; 0x86463 + 260 bytes

_UnnamedText_7612a: ; 86567 (21:6567)
	db $0, "OAK: ", $52, "!", $51
	db "You understand", $4f
	db "that your victory", $55
	db "was not just your", $55
	db "own doing!", $51
	db "The bond you share", $4f
	db "with your #MON", $55
	db "is marvelous!", $51
	db $52, "!", $4f
	db "Come with me!", $57
; 0x86567 + 136 bytes

_LoreleiBeforeBattleText: ; 865ef (21:65ef)
	db $0, "Welcome to", $4f
	db "#MON LEAGUE!", $51
	db "I am LORELEI of", $4f
	db "the ELITE FOUR!", $51
	db "No one can best", $4f
	db "me when it comes", $55
	db "to icy #MON!", $51
	db "Freezing moves", $4f
	db "are powerful!", $51
	db "Your #MON will", $4f
	db "be at my mercy", $55
	db "when they are", $55
	db "frozen solid!", $51
	db "Hahaha!", $4f
	db "Are you ready?", $57
; 0x865ef + 213 bytes

_LoreleiEndBattleText: ; 866c4 (21:66c4)
	db $0, "How", $4f
	db "dare you!", $58
; 0x866c4 + 15 bytes

_LoreleiAfterBattleText: ; 866d3 (21:66d3)
	db $0, "You're better", $4f
	db "than I thought!", $55
	db "Go on ahead!", $51
	db "You only got a", $4f
	db "taste of #MON", $55
	db "LEAGUE power!", $57
; 0x866d3 + 86 bytes

_UnnamedText_7627b: ; 86729 (21:6729)
	db $0, "Someone's voice:", $4f
	db "Don't run away!", $57
; 0x86729 + 32 bytes

_BrunoBeforeBattleText: ; 86749 (21:6749)
	db $0, "I am BRUNO of", $4f
	db "the ELITE FOUR!", $51
	db "Through rigorous", $4f
	db "training, people", $55
	db "and #MON can", $55
	db "become stronger!", $51
	db "I've weight", $4f
	db "trained with", $55
	db "my #MON!", $51
	db $52, "!", $51
	db "We will grind you", $4f
	db "down with our", $55
	db "superior power!", $51
	db "Hoo hah!", $57
; 0x86749 + 188 bytes

_BrunoEndBattleText: ; 86805 (21:6805)
	db $0, "Why?", $4f
	db "How could I lose?", $58
; 0x86805 + 24 bytes

_BrunoAfterBattleText: ; 8681d (21:681d)
	db $0, "My job is done!", $4f
	db "Go face your next", $55
	db "challenge!", $57
; 0x8681d + 46 bytes

_UnnamedText_763d2: ; 8684b (21:684b)
	db $0, "Someone's voice:", $4f
	db "Don't run away!", $57
; 0x8684b + 32 bytes

_AgathaBeforeBattleText: ; 8686b (21:686b)
	db $0, "I am AGATHA of", $4f
	db "the ELITE FOUR!", $51
	db "OAK's taken a lot", $4f
	db "of interest in", $55
	db "you, child!", $51
	db "That old duff was", $4f
	db "once tough and", $55
	db "handsome! That", $55
	db "was decades ago!", $51
	db "Now he just wants", $4f
	db "to fiddle with", $55
	db "his #DEX! He's", $55
	db "wrong! #MON", $55
	db "are for fighting!", $51
	db $52, "! I'll show", $4f
	db "you how a real", $55
	db "trainer fights!", $57
; 0x8686b + 261 bytes

_AgathaEndBattleText: ; 86970 (21:6970)
	db $0, "Oh ho!", $4f
	db "You're something", $55
	db "special, child!", $58
; 0x86970 + 40 bytes

_AgathaAfterBattleText: ; 86998 (21:6998)
	db $0, "You win! I see", $4f
	db "what the old duff", $55
	db "sees in you now!", $51
	db "I have nothing", $4f
	db "else to say! Run", $55
	db "along now, child!", $57
; 0x86998 + 101 bytes

_AgathaText2: ; 869fd (21:69fd)
	db $0, "Someone's voice:", $4f
	db "Don't run away!", $57
; 0x869fd + 32 bytes

_RockTunnel2BattleText2: ; 86a1d (21:6a1d)
	db $0, "Hikers leave twigs", $4f
	db "as trail markers.", $57
; 0x86a1d + 38 bytes

_RockTunnel2EndBattleText2: ; 86a43 (21:6a43)
	db $0, "Ohhh!", $4f
	db "I did my best!", $58
; 0x86a43 + 22 bytes

_RockTunnel2AfterBattleText2: ; 86a59 (21:6a59)
	db $0, "I want to go ", $4f
	db "home!", $57
; 0x86a59 + 21 bytes

_RockTunnel2BattleText3: ; 86a6e (21:6a6e)
	db $0, "Hahaha! Can you", $4f
	db "beat my power?", $57
; 0x86a6e + 32 bytes

_RockTunnel2EndBattleText3: ; 86a8e (21:6a8e)
	db $0, "Oops!", $4f
	db "Out-muscled!", $58
; 0x86a8e + 20 bytes

_RockTunnel2AfterBattleText3: ; 86aa2 (21:6aa2)
	db $0, "I go for power", $4f
	db "because I hate", $55
	db "thinking!", $57
; 0x86aa2 + 41 bytes

_RockTunnel2BattleText4: ; 86acb (21:6acb)
	db $0, "You have a", $4f
	db "#DEX?", $55
	db "I want one too!", $57
; 0x86acb + 34 bytes

_RockTunnel2EndBattleText4: ; 86aed (21:6aed)
	db $0, "Shoot!", $4f
	db "I'm so jealous!", $58
; 0x86aed + 23 bytes

_RockTunnel2AfterBattleText4: ; 86b04 (21:6b04)
	db $0, "When you finish", $4f
	db "your #DEX, can", $55
	db "I have it?", $57
; 0x86b04 + 43 bytes

_RockTunnel2BattleText5: ; 86b2f (21:6b2f)
	db $0, "Do you know about", $4f
	db "costume players?", $57
; 0x86b2f + 36 bytes

_RockTunnel2EndBattleText5: ; 86b53 (21:6b53)
	db $0, "Well,", $4f
	db "that's that.", $58
; 0x86b53 + 19 bytes

_RockTunnel2AfterBattleText5: ; 86b66 (21:6b66)
	db $0, "Costume players", $4f
	db "dress up as", $55
	db "#MON for fun.", $57
; 0x86b66 + 43 bytes

_RockTunnel2BattleText6: ; 86b91 (21:6b91)
	db $0, "My #MON", $4f
	db "techniques will", $55
	db "leave you crying!", $57
; 0x86b91 + 43 bytes

_RockTunnel2EndBattleText6: ; 86bbc (21:6bbc)
	db $0, "I give!", $4f
	db "You're a better", $55
	db "technician!", $58
; 0x86bbc + 36 bytes

_RockTunnel2AfterBattleText6: ; 86be0 (21:6be0)
	db $0, "In mountains,", $4f
	db "you'll often find", $55
	db "rock-type #MON.", $57
; 0x86be0 + 48 bytes

_RockTunnel2BattleText7: ; 86c10 (21:6c10)
	db $0, "I don't often", $4f
	db "come here, but I", $55
	db "will fight you.", $57
; 0x86c10 + 47 bytes

_RockTunnel2EndBattleText7: ; 86c3f (21:6c3f)
	db $0, "Oh!", $4f
	db "I lost!", $58
; 0x86c3f + 13 bytes

_RockTunnel2AfterBattleText7: ; 86c4c (21:6c4c)
	db $0, "I like tiny", $4f
	db "#MON, big ones", $55
	db "are too scary!", $57
; 0x86c4c + 43 bytes

_RockTunnel2BattleText8: ; 86c77 (21:6c77)
	db $0, "Hit me with your", $4f
	db "best shot!", $57
; 0x86c77 + 29 bytes

_RockTunnel2EndBattleText8: ; 86c94 (21:6c94)
	db $0, "Fired", $4f
	db "away!", $58
; 0x86c94 + 13 bytes

SECTION "bank22",ROMX,BANK[$22]

_RockTunnel2AfterBattleText8: ; 88000 (22:4000)
	db $0, "I'll raise my", $4f
	db "#MON to beat", $55
	db "yours, kid!", $57
; 0x88000 + 39 bytes

_RockTunnel2BattleText9: ; 88027 (22:4027)
	db $0, "I draw #MON", $4f
	db "when I'm home.", $57
; 0x88027 + 27 bytes

_RockTunnel2EndBattleText9: ; 88042 (22:4042)
	db $0, "Whew!", $4f
	db "I'm exhausted!", $58
; 0x88042 + 21 bytes

_RockTunnel2AfterBattleText9: ; 88057 (22:4057)
	db $0, "I'm an artist,", $4f
	db "not a fighter.", $57
; 0x88057 + 30 bytes

_SeafoamIslands5BattleText2: ; 88075 (22:4075)
	db $0, "Gyaoo!@@"

_SeafoamIslands5Text4: ; 8807e (22:407e)
	db $0, "Boulders might", $4f
	db "change the flow", $55
	db "of water!", $57

_SeafoamIslands5Text5: ; 880a8 (22:40a8)
	db $0, "DANGER", $4f
	db "Fast current!", $57

_AIBattleWithdrawText: ; 880be (22:40be)
	db 1
	dw $D04A
	db 0," with-",$4F,"drew @",1
	dw W_ENEMYMONNAME
	db 0,"!",$58
_AIBattleUseItemText: ; 880d5 (22:40d5)
	db 1
	dw $D04A
	db 0,$4F,"used @",1
	dw $CD6D
	db 0,$55,"on @",1
	dw W_ENEMYMONNAME
	db 0,"!",$58

_UnnamedText_4160c: ; 880ef (22:40ef)
	TX_RAM $cf4b
	db $0, " went", $4f
	db "to @"
	TX_RAM $d887
	db $0, ".", $57
; 0x88103

_UnnamedText_41623: ; 88103 (22:4103)
	db $0, "For ", $52, "'s", $4f
	db "@"
	TX_RAM $cf4b
	db $0, ",", $57
; 0x88112

_UnnamedText_41628: ; 88112 (22:4112)
	TX_RAM $d887
	db $0, " sends", $4f
	db "@"
	TX_RAM $cd6d
	db $0, ".", $57
; 0x88124

_UnnamedText_41642: ; 88124 (22:4124)
	TX_RAM $d887
	db $0, " waves", $4f
	db "farewell as", $57

_UnnamedText_41647: ; 8813b (22:413b)
	TX_RAM $cd6d
	db $0, " is", $4f
	db "transferred.", $57
; 0x8813b + 21 bytes

_UnnamedText_41655: ; 88150 (22:4150)
	db $0, "Take good care of", $4f
	db "@"
; 0x88150 + 20 bytes

UnnamedText_88164: ; 88164 (22:4164)
	TX_RAM $cd6d
	db $0, ".", $57
; 0x8816a

_UnnamedText_4166c: ; 8816a (22:416a)
	TX_RAM $d887
	db $0, " will", $4f
	db "trade @"
; 0x8816a + 17 bytes

UnnamedText_8817b: ; 8817b (22:417b)
	TX_RAM $cd6d
	db $0, $57

_UnnamedText_41671: ; 88180 (22:4180)
	db $0, "for ", $52, "'s", $4f
	db "@"
	TX_RAM $cf4b
	db $0, ".", $57
; 0x8818f

_UnnamedText_37390: ; 8818f (22:418f)
	db $0, "A slot machine!", $4f
	db "Want to play?", $57
; 0x8818f + 31 bytes

_UnnamedText_37467: ; 881ae (22:41ae)
	db $0, "Darn!", $4f
	db "Ran out of coins!", $57
; 0x881ae + 25 bytes

_UnnamedText_3746c: ; 881c7 (22:41c7)
	db $0, "Bet how many", $4f
	db "coins?", $57
; 0x881c7 + 21 bytes

_UnnamedText_37471: ; 881dc (22:41dc)
	db $0, "Start!", $57
; 0x881dc + 8 bytes

_UnnamedText_37476: ; 881e4 (22:41e4)
	db $0, "Not enough", $4f
	db "coins!", $58
; 0x881e4 + 19 bytes

_UnnamedText_3747b: ; 881f7 (22:41f7)
	db $0, "One more ", $4f
	db "go?", $57
; 0x881f7 + 15 bytes

_UnnamedText_37673: ; 88206 (22:4206)
	db $0, " lined up!", $4f
	db "Scored @"
; 0x88206 + 20 bytes

UnnamedText_8821a: ; 8821a (22:421a)
	TX_RAM $cf4b
	db $0, " coins!", $57
; 0x88226

_UnnamedText_3769d: ; 88226 (22:4226)
	db $0, "Not this time!", $58
; 0x88226 + 16 bytes

UnnamedText_88236: ; 88236 (22:4236)
	db $0, "Yeah!@@"
; 0x8823e

_UnnamedText_703fa: ; 8823e (22:423e)
	db $0, "#DEX   Seen:@"
; 0x8823e + 14 bytes

UnnamedText_8824c: ; 8824c (22:424c)
	TX_NUM $cc5b, 1, 3
	db $0, $4f
	db "         Owned:@"
	TX_NUM $cc5c, 1, 3
	db $50
; 0x88267

_UnnamedText_703ff: ; 88267 (22:4267)
	db $0, "#DEX Rating", $6d, $57
; 0x88267 + 14 bytes

_UnnamedText_62453: ; 88275 (22:4275)
	TX_RAM W_GYMCITYNAME
	db $0, $4f
	db "#MON GYM", $55
	db "LEADER: @"
; 0x88275 + 23 bytes

UnnamedText_8828c: ; 8828c (22:428c)
	TX_RAM W_GYMLEADERNAME
	db $0, $51
	db "WINNING TRAINERS:", $4f
	db $53, $57
; 0x882a5

_UnnamedText_62458: ; 882a5 (22:42a5)
	TX_RAM W_GYMCITYNAME
	db $0, $4f
	db "#MON GYM", $55
	db "LEADER: @"
; 0x882a5 + 23 bytes

UnnamedText_882bc: ; 882bc (22:42bc)
	TX_RAM W_GYMLEADERNAME
	db $0, $51
	db "WINNING TRAINERS:", $4f
	db $53, $55
	db $52, $57
; 0x882d7

_UnnamedText_624a3: ; 882d7 (22:42d7)
	db $0, "#MON CENTERs", $4f
	db "heal your tired,", $55
	db "hurt or fainted", $55
	db "#MON!", $57
; 0x882d7 + 53 bytes

_UnnamedText_624a8: ; 8830c (22:430c)
	db $0, "Yawn!", $51
	db "When JIGGLYPUFF", $4f
	db "sings, #MON", $55
	db "get drowsy...", $51
	db "...Me too...", $4f
	db "Snore...", $57
; 0x8830c + 71 bytes

_UnnamedText_624ad: ; 88353 (22:4353)
	db $0, "BILL has lots of", $4f
	db "#MON!", $51
	db "He collects rare", $4f
	db "ones too!", $57
; 0x88353 + 51 bytes

_UnnamedText_624b2: ; 88386 (22:4386)
	db $0, "CUBONEs wear", $4f
	db "skulls, right?", $51
	db "People will pay a", $4f
	db "lot for one!", $57
; 0x88386 + 60 bytes

_UnnamedText_624b7: ; 883c2 (22:43c2)
	db $0, "If you have too", $4f
	db "many #MON, you", $55
	db "should store them", $55
	db "via PC!", $57
; 0x883c2 + 58 bytes

_UnnamedText_624bc: ; 883fc (22:43fc)
	db $0, "I heard that", $4f
	db "GHOSTs haunt", $55
	db "LAVENDER TOWN!", $57
; 0x883fc + 42 bytes

_UnnamedText_624c1: ; 88426 (22:4426)
	db $0, "I wish I could", $4f
	db "catch #MON.", $57
; 0x88426 + 28 bytes

_UnnamedText_624c6: ; 88442 (22:4442)
	db $0, "I'm tired from", $4f
	db "all the fun...", $57
; 0x88442 + 30 bytes

_UnnamedText_624cb: ; 88460 (22:4460)
	db $0, "SILPH's manager", $4f
	db "is hiding in the", $55
	db "SAFARI ZONE.", $57
; 0x88460 + 46 bytes

_UnnamedText_624d0: ; 8848e (22:448e)
	db $0, "It is true that a", $4f
	db "higher level", $55
	db "#MON will be", $55
	db "more powerful...", $51
	db "But, all #MON", $4f
	db "will have weak", $55
	db "points against", $55
	db "specific types.", $51
	db "So, there is no", $4f
	db "universally", $55
	db "strong #MON.", $57
; 0x8848e + 163 bytes

_UnnamedText_624d5: ; 88531 (22:4531)
	db $0, "If I had a BIKE,", $4f
	db "I would go to", $55
	db "CYCLING ROAD!", $57
; 0x88531 + 46 bytes

_UnnamedText_624da: ; 8855f (22:455f)
	db $0, "If you're studying ", $4f
	db "#MON, visit", $55
	db "the SAFARI ZONE.", $51
	db "It has all sorts", $4f
	db "of rare #MON.", $57
; 0x8855f + 80 bytes

_UnnamedText_624df: ; 885af (22:45af)
	db $0, "#MON can still", $4f
	db "learn techniques", $55
	db "after canceling", $55
	db "evolution.", $51
	db "Evolution can wait", $4f
	db "until new moves", $55
	db "have been learned.", $57
; 0x885af + 114 bytes

_UnnamedText_624f8: ; 88621 (22:4621)
	db $0, "It would be great", $4f
	db "if the ELITE FOUR", $55
	db "came and stomped", $55
	db "TEAM ROCKET!", $57
; 0x88621 + 67 bytes

_UnnamedText_624fd: ; 88664 (22:4664)
	db $0, "TEAM ROCKET took", $4f
	db "off! We can go", $55
	db "out safely again!", $55
	db "That's great!", $57
; 0x88664 + 64 bytes

_UnnamedText_62502: ; 886a4 (22:46a4)
	db $0, "My sis brought me", $4f
	db "on this vacation!", $57
; 0x886a4 + 37 bytes

_UnnamedText_62511: ; 886c9 (22:46c9)
	db $0, "Crammed full of", $4f
	db "#MON books!", $57
; 0x886c9 + 29 bytes

_UnnamedText_1e953: ; 886e6 (22:46e6)
	db $0, "A shiny new", $4f
	db "BICYCLE!", $57
; 0x886e6 + 22 bytes

_UnnamedText_1e960: ; 886fc (22:46fc)
	db $0, "Push START to", $4f
	db "open the MENU!", $57
; 0x886fc + 30 bytes

_UnnamedText_1e97e: ; 8871a (22:471a)
	db $0, "The SAVE option is", $4f
	db "on the MENU", $55
	db "screen.", $57
; 0x8871a + 40 bytes

_UnnamedText_1e983: ; 88742 (22:4742)
	db $0, "All #MON types", $4f
	db "have strong and", $55
	db "weak points", $55
	db "against others.", $57
; 0x88742 + 60 bytes

_UnnamedText_1ea0d: ; 8877e (22:477e)
	db $0, "PA: Ding-dong!", $51
	db "Time's up!", $58
; 0x8877e + 26 bytes

_UnnamedText_1ea12: ; 88798 (22:4798)
	db $0, "PA: Your SAFARI", $4f
	db "GAME is over!", $57
; 0x88798 + 31 bytes

_UnnamedText_1ea5b: ; 887b7 (22:47b7)
	db $0, "#MON Quiz!", $51
	db "Get it right and", $4f
	db "the door opens to", $55
	db "the next room!", $51
	db "Get it wrong and", $4f
	db "face a trainer!", $51
	db "If you want to", $4f
	db "conserve your", $55
	db "#MON for the", $55
	db "GYM LEADER...", $51
	db "Then get it right!", $4f
	db "Here we go!", $58
; 0x887b7 + 182 bytes

_UnnamedText_1ea6c: ; 8886d (22:486d)
	db $0, "CATERPIE evolves", $4f
	db "into BUTTERFREE?", $57
; 0x8886d + 35 bytes

_UnnamedText_1ea71: ; 88890 (22:4890)
	db $0, "There are 9", $4f
	db "certified #MON", $55
	db "LEAGUE BADGEs?", $57
; 0x88890 + 43 bytes

_UnnamedText_1ea76: ; 888bb (22:48bb)
	db $0, "POLIWAG evolves 3", $4f
	db "times?", $57
; 0x888bb + 26 bytes

_UnnamedText_1ea7b: ; 888d5 (22:48d5)
	db $0, "Are thunder moves", $4f
	db "effective against", $55
	db "ground element-", $55
	db "type #MON?", $57
; 0x888d5 + 64 bytes

_UnnamedText_1ea80: ; 88915 (22:4915)
	db $0, "#MON of the", $4f
	db "same kind and", $55
	db "level are not", $55
	db "identical?", $57
; 0x88915 + 52 bytes

_UnnamedText_1ea85: ; 88949 (22:4949)
	db $0, "TM28 contains", $4f
	db "TOMBSTONER?", $57
; 0x88949 + 27 bytes

UnnamedText_88964: ; 88964 (22:4964)
	db $0, "You're absolutely", $4f
	db "correct!", $51
	db "Go on through!@@"
; 0x8898f

_UnnamedText_1eb05: ; 8898f (22:498f)
	db $0, "Sorry! Bad call!", $58
; 0x8898f + 18 bytes

_UnnamedText_1eb69: ; 889a1 (22:49a1)
	db $0, "#MON magazines!", $51
	db "#MON notebooks!", $51
	db "#MON graphs!", $57
; 0x889a1 + 46 bytes

_UnnamedText_1ebdd: ; 889cf (22:49cf)
	db $0, "TELEPORTER is", $4f
	db "displayed on the", $55
	db "PC monitor.", $57
; 0x889cf + 44 bytes

UnnamedText_889fb: ; 889fb (22:49fb)
	db $0, $52, " initiated", $4f
	db "TELEPORTER's Cell", $55
	db "Separator!@@"
; 0x88a25

_UnnamedText_1ec7f: ; 88a25 (22:4a25)
	db $0, "BILL's favorite", $4f
	db "#MON list!", $58
; 0x88a25 + 27 bytes

_UnnamedText_1ecaa: ; 88a40 (22:4a40)
	db $0, "Which #MON do", $4f
	db "you want to see?", $57
; 0x88a40 + 32 bytes

_UnnamedText_1ecbd: ; 88a60 (22:4a60)
	db $0, "There's an e-mail", $4f
	db "message here!", $51
	db "...", $51
	db "Calling all", $4f
	db "#MON trainers!", $51
	db "The elite trainers", $4f
	db "of #MON LEAGUE", $55
	db "are ready to take", $55
	db "on all comers!", $51
	db "Bring your best", $4f
	db "#MON and see", $55
	db "how you rate as a", $55
	db "trainer!", $51
	db "#MON LEAGUE HQ", $4f
	db "INDIGO PLATEAU", $51
	db "PS: PROF.OAK,", $4f
	db "please visit us!", $55
	db "...", $57
; 0x88a60 + 251 bytes

_UnnamedText_2ff32: ; 88b5b (22:4b5b)
	db $0, "A COIN CASE is", $4f
	db "required!", $57
; 0x88b5b + 26 bytes

_UnnamedText_2ff37: ; 88b75 (22:4b75)
	db $0, "You don't have", $4f
	db "any coins!", $57
; 0x88b75 + 26 bytes

_UnnamedText_37e79: ; 88b8f (22:4b8f)
	db $0, "OUT OF ORDER", $4f
	db "This is broken.", $57
; 0x88b8f + 30 bytes

_UnnamedText_37e7e: ; 88bad (22:4bad)
	db $0, "OUT TO LUNCH", $4f
	db "This is reserved.", $57
; 0x88bad + 32 bytes

_UnnamedText_37e83: ; 88bcd (22:4bcd)
	db $0, "Someone's keys!", $4f
	db "They'll be back.", $57
; 0x88bcd + 32 bytes

_UnnamedText_21865: ; 88bed (22:4bed)
	db $0, "Just a moment.", $57
; 0x88bed + 16 bytes

UnnamedText_88bfd: ; 88bfd (22:4bfd)
	db $0, "It's a pamphlet", $4f
	db "on TMs.", $51
	db "...", $51
	db "There are 50 TMs", $4f
	db "in all.", $51
	db "There are also 5", $4f
	db "HMs that can be", $55
	db "used repeatedly.", $51
	db "SILPH CO.@@"
; 0x88c6f

_UnnamedText_529e9: ; 88c6f (22:4c6f)
	db $0, "Turn the page?", $57
; 0x88c6f + 16 bytes

UnnamedText_88c7f: ; 88c7f (22:4c7f)
	db $0, "GIRL: Hey! Don't", $4f
	db "look at my notes!@@"
; 0x88ca3

_UnnamedText_529f4: ; 88ca3 (22:4ca3)
	db $0, "Looked at the", $4f
	db "notebook!", $51
	db "First page...", $51
	db "# BALLs are", $4f
	db "used to catch", $55
	db "#MON.", $51
	db "Up to 6 #MON", $4f
	db "can be carried.", $51
	db "People who raise", $4f
	db "and make #MON", $55
	db "fight are called", $55
	db "#MON trainers.", $58
; 0x88ca3 + 163 bytes

_UnnamedText_529f9: ; 88d46 (22:4d46)
	db $0, "Second page...", $51
	db "A healthy #MON", $4f
	db "may be hard to", $55
	db "catch, so weaken", $55
	db "it first!", $51
	db "Poison, burns and", $4f
	db "other damage are", $55
	db "effective!", $58
; 0x88d46 + 119 bytes

_UnnamedText_529fe: ; 88dbd (22:4dbd)
	db $0, "Third page...", $51
	db "#MON trainers", $4f
	db "seek others to", $55
	db "engage in #MON", $55
	db "fights.", $51
	db "Battles are", $4f
	db "constantly fought", $55
	db "at #MON GYMs.", $58
; 0x88dbd + 111 bytes

_UnnamedText_52a03: ; 88e2c (22:4e2c)
	db $0, "Fourth page...", $51
	db "The goal for", $4f
	db "#MON trainers", $55
	db "is to beat the ", $55
	db "top 8 #MON", $55
	db "GYM LEADERs.", $51
	db "Do so to earn the", $4f
	db "right to face...", $51
	db "The ELITE FOUR of", $4f
	db "#MON LEAGUE!", $58
; 0x88e2c + 149 bytes

_UnnamedText_52a10: ; 88ec1 (22:4ec1)
	db $0, "Enemies on every", $4f
	db "side!", $57
; 0x88ec1 + 24 bytes

_UnnamedText_52a1d: ; 88ed9 (22:4ed9)
	db $0, "What goes around", $4f
	db "comes around!", $57
; 0x88ed9 + 32 bytes

_UnnamedText_52a2a: ; 88ef9 (22:4ef9)
	db $0, "FIGHTING DOJO", $57
; 0x88ef9 + 15 bytes

_UnnamedText_52a3d: ; 88f08 (22:4f08)
	db $0, "INDIGO PLATEAU", $4f
	db "#MON LEAGUE HQ", $57
; 0x88f08 + 31 bytes

_UnnamedText_5db81: ; 88f27 (22:4f27)
	db $0, $52, " is", $4f
	db "playing the SNES!", $55
	db "...Okay!", $55
	db "It's time to go!", $57
; 0x88f27 + 49 bytes

_UnnamedText_5dba8: ; 88f58 (22:4f58)
	db $0, "Looked into the", $4f
	db "binoculars...", $51
	db "A large, shining", $4f
	db "bird is flying", $55
	db "toward the sea.", $57
; 0x88f58 + 79 bytes

_UnnamedText_5dbbe: ; 88fa7 (22:4fa7)
	db $0, "AERODACTYL Fossil", $4f
	db "A primitive and", $55
	db "rare #MON.", $57
; 0x88fa7 + 46 bytes

_UnnamedText_5dbd4: ; 88fd5 (22:4fd5)
	db $0, "KABUTOPS Fossil", $4f
	db "A primitive and", $55
	db "rare #MON.", $57
; 0x88fd5 + 44 bytes

_UnnamedText_5dc9e: ; 89001 (22:5001)
	db $0, "TRAINER TIPS", $51
	db "Using a Game Link", $4f
	db "Cable", $58
; 0x89001 + 38 bytes

_UnnamedText_5dca3: ; 89027 (22:5027)
	db $0, "Which heading do", $4f
	db "you want to read?", $57
; 0x89027 + 36 bytes

_UnnamedText_5dcde: ; 8904b (22:504b)
	db $0, "When you have", $4f
	db "linked your GAME", $55
	db "BOY with another", $55
	db "GAME BOY, talk to", $55
	db "the attendant on", $55
	db "the right in any", $55
	db "#MON CENTER.", $58
; 0x8904b + 114 bytes

_UnnamedText_5dce3: ; 890bd (22:50bd)
	db $0, "COLOSSEUM lets", $4f
	db "you play against", $55
	db "a friend.", $58
; 0x890bd + 43 bytes

_UnnamedText_5dce8: ; 890e8 (22:50e8)
	db $0, "TRADE CENTER is", $4f
	db "used for trading", $55
	db "#MON.", $58
; 0x890e8 + 40 bytes

_UnnamedText_5dda2: ; 89110 (22:5110)
	db $0, "The blackboard", $4f
	db "describes #MON", $55
	db "STATUS changes", $55
	db "during battles.", $58
; 0x89110 + 62 bytes

_UnnamedText_5dda7: ; 8914e (22:514e)
	db $0, "Which heading do", $4f
	db "you want to read?", $57
; 0x8914e + 36 bytes

_UnnamedText_5ddd6: ; 89172 (22:5172)
	db $0, "A #MON can't", $4f
	db "attack if it's", $55
	db "asleep!", $51
	db "#MON will stay", $4f
	db "asleep even after", $55
	db "battles.", $51
	db "Use AWAKENING to", $4f
	db "wake them up!", $58
; 0x89172 + 108 bytes

_UnnamedText_5dddb: ; 891de (22:51de)
	db $0, "When poisoned, a", $4f
	db "#MON's health", $55
	db "steadily drops.", $51
	db "Poison lingers", $4f
	db "after battles.", $51
	db "Use an ANTIDOTE", $4f
	db "to cure poison!", $58
; 0x891de + 109 bytes

_UnnamedText_5dde0: ; 8924b (22:524b)
	db $0, "Paralysis could", $4f
	db "make #MON", $55
	db "moves misfire!", $51
	db "Paralysis remains", $4f
	db "after battles.", $51
	db "Use PARLYZ HEAL", $4f
	db "for treatment!", $58
; 0x8924b + 106 bytes

_UnnamedText_5dde5: ; 892b5 (22:52b5)
	db $0, "A burn reduces", $4f
	db "power and speed.", $55
	db "It also causes", $55
	db "ongoing damage.", $51
	db "Burns remain", $4f
	db "after battles.", $51
	db "Use BURN HEAL to", $4f
	db "cure a burn!", $58
; 0x892b5 + 122 bytes

_UnnamedText_5ddea: ; 8932f (22:532f)
	db $0, "If frozen, a", $4f
	db "#MON becomes", $55
	db "totally immobile!", $51
	db "It stays frozen", $4f
	db "even after the", $55
	db "battle ends.", $51
	db "Use ICE HEAL to", $4f
	db "thaw out #MON!", $58
; 0x8932f + 120 bytes

_UnnamedText_5ddf7: ; 893a7 (22:53a7)
	db $0, "Nope, there's", $4f
	db "only trash here.", $57
; 0x893a7 + 31 bytes

UnnamedText_893c6: ; 893c6 (22:53c6)
	db $0, "Hey! There's a", $4f
	db "switch under the", $55
	db "trash!", $55
	db "Turn it on!", $51
	db "The 1st electric", $4f
	db "lock opened!@@"
; 0x89418

_UnnamedText_5dedb: ; 89418 (22:5418)
	db $0, "Hey! There's", $4f
	db "another switch", $55
	db "under the trash!", $55
	db "Turn it on!", $58
; 0x89418 + 57 bytes

UnnamedText_89451: ; 89451 (22:5451)
	db $0, "The 2nd electric", $4f
	db "lock opened!", $51
	db "The motorized door", $4f
	db "opened!@@"
; 0x89451 + 59 bytes = 0x8948c

UnnamedText_8948c: ; 8948c (22:548c)
	db $0, "Nope! There's", $4f
	db "only trash here.", $55
	db "Hey! The electric", $55
	db "locks were reset!@@"
; 0x8948c + 68 bytes = 0x894d0

UnnamedText_894d0: ; 894d0 (22:54d0)
	db $0, $52, " found", $4f
	db "@"
	TX_RAM $cd6d
	db $0, "!@@"
; 0x894e1

_UnnamedText_76794: ; 894e1 (22:54e1)
	db $0, "But, ", $52, " has", $4f
	db "no more room for", $55
	db "other items!", $57
; 0x894e1 + 42 bytes

_FoundHiddenCoinsText: ; 8950b (22:550b)
	db $0, $52, " found", $4f
	db "@"
	db $2, $a0, $ff, $c2 ; XXX $2
	db $0, " coins!@@"
; 0x89523

_FoundHiddenCoins2Text: ; 89523 (22:5523)
	db $0, $52, " found", $4f
	db "@"
	db $2, $a0, $ff, $c2 ; XXX $2 probably coins
	db $0, " coins!@@"
; 0x8953a

_DroppedHiddenCoinsText: ; 8953b (22:553b)
	db $0, $51
	db "Oops! Dropped", $4f
	db "some coins!", $57
; 0x8953b + 28 bytes

_UnnamedText_fbd9: ; 89557 (22:5557)
	db $0, "INDIGO PLATEAU", $58
; 0x89557 + 16 bytes

_UnnamedText_fbde: ; 89567 (22:5567)
	db $0, "The ultimate goal", $4f
	db "of trainers!", $55
	db "#MON LEAGUE HQ", $57
; 0x89567 + 47 bytes

_UnnamedText_fbe3: ; 89596 (22:5596)
	db $0, "The highest", $4f
	db "#MON authority", $55
	db "#MON LEAGUE HQ", $57
; 0x89596 + 43 bytes

_UnnamedText_fc03: ; 895c1 (22:55c1)
	db $0, "Crammed full of", $4f
	db "#MON books!", $57
; 0x895c1 + 29 bytes

_UnnamedText_fc08: ; 895de (22:55de)
	db $0, "It's a sculpture", $4f
	db "of DIGLETT.", $57
; 0x895de + 29 bytes

_UnnamedText_fc0d: ; 895fb (22:55fb)
	db $0, "This is an", $4f
	db "elevator.", $57
; 0x895fb + 22 bytes

UnnamedText_89611: ; 89611 (22:5611)
	db $0, "A TOWN MAP.@@"
; 0x89611 + 14 bytes = 0x8961f

_UnnamedText_fc45: ; 8961f (22:561f)
	db $0, "Wow! Tons of", $4f
	db "#MON stuff!", $57
; 0x8961f + 26 bytes

_UnnamedText_3c1a8: ; 89639 (22:5639)
	db $0, "PA: Ding-dong!", $51
	db "You are out of", $4f
	db "SAFARI BALLs!", $58
; 0x89639 + 45 bytes

_UnnamedText_3c229: ; 89666 (22:5666)
	db $0, "Wild @"
	TX_RAM W_ENEMYMONNAME
	db $0, $4f
	db "ran!", $58
; 0x89666 + 17 bytes = 0x89677

_UnnamedText_3c22e: ; 89677 (22:5677)
	db $0, "Enemy @"
	TX_RAM W_ENEMYMONNAME
	db $0, $4f
	db "ran!", $58
; 0x89677 + 18 bytes = 0x89689

_HurtByPoisonText: ; 89689 (22:5689)
	db $0, $5a, "'s", $4f
	db "hurt by poison!", $58
; 0x89689 + 20 bytes

_HurtByBurnText: ; 8969d (22:569d)
	db $0, $5a, "'s", $4f
	db "hurt by the burn!", $58
; 0x8969d + 22 bytes

_HurtByLeechSeedText: ; 896b3 (22:56b3)
	db $0, "LEECH SEED saps", $4f
	db $5a, "!", $58
; 0x896b3 + 20 bytes

_UnnamedText_3c63e: ; 896c7 (22:56c7)
	db $0, "Enemy @"
	TX_RAM W_ENEMYMONNAME
	db $0, $4f
	db "fainted!", $58
; 0x896c7 + 22 bytes = 0x896dd

_MoneyForWinningText: ; 896dd (22:56dd)
	db $0, $52, " got ¥@"
	;XXX $2
	db $2, $79, $d0, $c3
	db $0, $4f
	db "for winning!", $58
; 0x896f9

_TrainerDefeatedText: ; 896f9 (22:56f9)
	db $0, $52, " defeated", $4f
	db "@"
	TX_RAM $d04a ; 0x89706
	db $0, "!", $58
; 0x896f9 + 19 bytes = 0x8970c

_PlayerMonFaintedText: ; 8970c (22:570c)
	TX_RAM W_PLAYERMONNAME
	db $0, $4f
	db "fainted!", $58
; 0x8970c + 14 bytes

_UnnamedText_3c7d3: ; 8971a (22:571a)
	db $0, "Use next #MON?", $57
; 0x8971a + 16 bytes

_Sony1WinText: ; 8972a (22:572a)
	db $0, $53, ": Yeah! Am", $4f
	db "I great or what?", $58
; 0x8972a + 30 bytes

_PlayerBlackedOutText2: ; 89748 (22:5748)
	db $0, $52, " is out of", $4f
	db "useable #MON!", $51
	db $52, " blacked", $4f
	db "out!", $58
; 0x89748 + 42 bytes

_LinkBattleLostText: ; 89772 (22:5772)
	db $0, $52, " lost to", $4f
	db "@"
	TX_RAM $d04a ; 0x8977e
	db $0, "!", $58
; 0x89772 + 18 bytes = 0x89784

_TrainerAboutToUseText: ; 89784 (22:5784)
	db 1
	dw $D04A
	db 0," is",$4F
	db "about to use",$55,"@",1
	dw W_ENEMYMONNAME
	db 0,"!",$51
	db "Will ",$52,$4F
	db "change #MON?",$57

_TrainerSentOutText: ; 897b4 (22:57b4)
	db 1
	dw $D04A
	db 0," sent",$4F
	db "out @",1
	dw W_ENEMYMONNAME
	db 0,"!",$57

_UnnamedText_3cab4: ; 897c9 (22:57c9)
	db $0, "There's no will", $4f
	db "to fight!", $58
; 0x897c9 + 26 bytes

_UnnamedText_3cb97: ; 897e3 (22:57e3)
	db $0, "Can't escape!", $58
; 0x897e3 + 14 bytes

_UnnamedText_3cb9c: ; 897f1 (22:57f1)
	db $0, "No! There's no", $4f
	db "running from a", $55
	db "trainer battle!", $58
; 0x897f1 + 46 bytes

_UnnamedText_3cba1: ; 8981f (22:581f)
	db $0, "Got away safely!", $58
; 0x8981f + 18 bytes

ItemsCantBeUsedHere_: ; 89831 (22:5831)
	db $0, "Items can't be", $4f
	db "used here.", $58
; 0x89831 + 26 bytes

_UnnamedText_3d1f5: ; 8984b (22:584b)
	TX_RAM W_PLAYERMONNAME
	db $0, " is", $4f
	db "already out!", $58
; 0x8984b + 21 bytes

_MoveNoPPText: ; 89860 (22:5860)
	db $0, "No PP left for", $4f
	db "this move!", $58
; 0x89860 + 27 bytes

_MoveDisabledText: ; 8987b (22:587b)
	db $0, "The move is", $4f
	db "disabled!", $58
; 0x8987b + 23 bytes

_UnnamedText_3d430: ; 89892 (22:5892)
	TX_RAM W_PLAYERMONNAME
	db $0, " has no", $4f
	db "moves left!", $57
; 0x89892 + 24 bytes

_MultiHitText: ; 898aa (22:58aa)
	db 0,"Hit the enemy",$4F,"@"
	TX_NUM W_NUMHITS,1,1
	db 0," times!",$58

_ScaredText: ; 898c7 (22:58c7)
	db 1
	dw W_PLAYERMONNAME
	db 0," is too",$4F
	db "scared to move!",$58

_GetOutText: ; 898e3 (22:58e3)
	db 0,"GHOST: Get out...",$4F
	db "Get out...",$58

_FastAsleepText: ; 89901 (22:5901)
	db 0,$5A,$4F
	db "is fast asleep!",$58

_WokeUpText: ; 89914 (22:5914)
	db 0,$5A,$4F
	db "woke up!",$58

_FrozenText: ; 89920 (22:5920)
	db 0,$5A,$4F
	db "is frozen solid!",$58

_FullyParalyzedText: ; 89934 (22:5934)
	db 0,$5A,"'s",$4F
	db "fully paralyzed!",$58

_FlinchedText: ; 89949 (22:5949)
	db 0,$5A,$4F
	db "flinched!",$58

_MustRechargeText: ; 89956 (22:5956)
	db 0,$5A,$4F
	db "must recharge!",$58

_DisabledNoMoreText: ; 89968 (22:5968)
	db 0,$5A,"'s",$4F
	db "disabled no more!",$58

_IsConfusedText: ; 8997e (22:597e)
	db 0,$5A,$4F
	db "is confused!",$58

_HurtItselfText: ; 8998e (22:598e)
	db 0,"It hurt itself in",$4F
	db "its confusion!",$58

_ConfusedNoMoreText: ; 899b0 (22:59b0)
	db 0,$5A,"'s",$4F
	db "confused no more!",$58

_SavingEnergyText: ; 899c6 (22:59c6)
	db 0,$5A,$4F
	db "is saving energy!",$58

_UnleashedEnergyText: ; 899db (22:59db)
	db 0,$5A,$4F
	db "unleashed energy!",$58

_ThrashingAboutText: ; 899f0 (22:59f0)
	db 0,$5A,"'s",$4F
	db "thrashing about!",$57

_AttackContinuesText: ; 89a05 (22:5a05)
	db 0,$5A,"'s",$4F
	db "attack continues!",$57

_CantMoveText: ; 89a1b (22:5a1b)
	db 0,$5A,$4F
	db "can't move!",$58

_UnnamedText_3daa8: ; 89a29 (22:5a29)
	db $0, $5a, "'s", $4f
	db "@"
; 0x89a29 + 5 bytes

UnnamedText_89a2e: ; 89a2e (22:5a2e)
	TX_RAM $cd6d
	db $0, " is", $55
	db "disabled!", $58
; 0x89a2e + 18 bytes = 0x89a40

UnnamedText_89a40: ; 89a40 (22:5a40)
	db $0, $5a, "@@"
; 0x89a40 + 4 bytes = 0x89a44

UnnamedText_89a44: ; 89a44 (22:5a44)
	db $0, $4f
	db "used @@"
; 0x89a44 + 9 bytes = 0x89a4d

UnnamedText_89a4d: ; 89a4d (22:5a4d)
	db $0, $4f
	db "used @@"
; 0x89a4d + 9 bytes = 0x89a56

UnnamedText_89a56: ; 89a56 (22:5a56)
	db $0, "instead,", $55
	db "@@"
; 0x89a56 + 12 bytes = 0x89a62

UnnamedText_89a62: ; 89a62 (22:5a62)
	TX_RAM $cf4b
	db $0, "@"
; 0x89a62 + 5 bytes = 0x89a67

_UnnamedText_3db6c: ; 89a67 (22:5a67)
	db $0, "!", $57
; 0x89a67 + 3 bytes

_UnnamedText_3db71: ; 89a6a (22:5a6a)
	db $0, "!", $57
; 0x89a6a + 3 bytes

_UnnamedText_3db76: ; 89a6d (22:5a6d)
	db $0, "!", $57
; 0x89a6d + 3 bytes

_UnnamedText_3db7b: ; 89a70 (22:5a70)
	db $0, "!", $57
; 0x89a70 + 3 bytes

_UnnamedText_3db80: ; 89a73 (22:5a73)
	db $0, "!", $57
; 0x89a73 + 3 bytes

_UnnamedText_3dc42: ; 89a76 (22:5a76)
	db $0, $5a, "'s", $4f
	db "attack missed!", $58
; 0x89a76 + 19 bytes

_UnnamedText_3dc47: ; 89a89 (22:5a89)
	db $0, $5a, $4f
	db "kept going and", $55
	db "crashed!", $58
; 0x89a89 + 27 bytes

_UnnamedText_3dc4c: ; 89aa4 (22:5aa4)
	db $0, $59, "'s", $4f
	db "unaffected!", $58
; 0x89aa4 + 16 bytes

_UnnamedText_3dc57: ; 89ab4 (22:5ab4)
	db $0, "It doesn't affect", $4f
	db $59, "!", $58
; 0x89ab4 + 21 bytes

_UnnamedText_3dc7e: ; 89ac9 (22:5ac9)
	db $0, "Critical hit!", $58
; 0x89ac9 + 15 bytes

_UnnamedText_3dc83: ; 89ad8 (22:5ad8)
	db $0, "One-hit KO!", $58
; 0x89ad8 + 13 bytes

_UnnamedText_3ddb6: ; 89ae5 (22:5ae5)
	TX_RAM W_PLAYERMONNAME
	db $0, " is", $4f
	db "loafing around.", $58
; 0x89ae5 + 24 bytes

_UnnamedText_3ddbb: ; 89afd (22:5afd)
	TX_RAM W_PLAYERMONNAME
	db $0, " began", $4f
	db "to nap!", $58
; 0x89afd + 19 bytes

_UnnamedText_3ddc0: ; 89b10 (22:5b10)
	TX_RAM W_PLAYERMONNAME
	db $0, " won't", $4f
	db "obey!", $58
; 0x89b10 + 16 bytes

_UnnamedText_3ddc5: ; 89b20 (22:5b20)
	TX_RAM W_PLAYERMONNAME
	db $0, " turned", $4f
	db "away!", $58
; 0x89b20 + 18 bytes

_UnnamedText_3ddca: ; 89b32 (22:5b32)
	TX_RAM W_PLAYERMONNAME
	db $0, $4f
	db "ignored orders!", $58
; 0x89b32 + 21 bytes

_SubstituteTookDamageText: ; 89b47 (22:5b47)
	db $0, "The SUBSTITUTE", $4f
	db "took damage for", $55
	db $59, "!", $58
; 0x89b47 + 35 bytes

_SubstituteBrokeText: ; 89b6a (22:5b6a)
	db $0, $59, "'s", $4f
	db "SUBSTITUTE broke!", $58
; 0x89b6a + 22 bytes

_BuildingRageText: ; 89b80 (22:5b80)
	db $0, $5a, "'s", $4f
	db "RAGE is building!", $58
; 0x89b80 + 22 bytes

_MirrorMoveFailedText: ; 89b96 (22:5b96)
	db $0, "The MIRROR MOVE", $4e, "failed!", $58
; 0x89b96 + 25 bytes

_UnnamedText_3e887: ; 89baf (22:5baf)
	db $0, "Hit @"
; 0x89baf + 6 bytes

UnnamedText_89bb5: ; 89bb5 (22:5bb5)
	TX_NUM $cd05, 1, 1
	db $0, " times!", $58
; 0x89bb5 + 13 bytes = 0x89bc2

UnnamedText_89bc2: ; 89bc2 (22:5bc2)
	TX_RAM $cd6d
	db $0, " gained", $4f
	db "@@"
; 0x89bc2 + 14 bytes = 0x89bd0

UnnamedText_89bd0: ; 89bd0 (22:5bd0)
	db $0, "with EXP.ALL,", $55
	db "@@"
; 0x89bd0 + 17 bytes = 0x89be1

UnnamedText_89be1: ; 89be1 (22:5be1)
	db $0, "a boosted", $55
	db "@@"
_UnnamedText_554d8: ; 89bee (22:5bee)
	TX_NUM $cf4b, 2, 4
	db $0, " EXP. Points!", $58
; 0x89be1 + 32 bytes = 0x89c01

UnnamedText_89c01: ; 89c01 (22:5c01)
	TX_RAM $cd6d
	db $0, " grew", $4f
	db "to level @"
	TX_NUM $d127, 1, 3
	db $0, "!@@"
; 0x89c01 + 28 bytes = 0x89c1d

_UnnamedText_58e3b: ; 89c1d (22:5c1d)
	db $0, "Wild @"
	TX_RAM W_ENEMYMONNAME
	db $0, $4f
	db "appeared!", $58
; 0x89c1d + 22 bytes

_UnnamedText_58e40: ; 89c33 (22:5c33)
	db $0, "The hooked", $4f
	db "@"
	TX_RAM W_ENEMYMONNAME
	db $0, $55
	db "attacked!", $58
; 0x89c33 + 28 bytes

_UnnamedText_58e45: ; 89c4f (22:5c4f)
	TX_RAM W_ENEMYMONNAME
	db $0, $4f
	db "appeared!", $58
; 0x89c4f + 15 bytes

_UnnamedText_58e4a: ; 89c5e (22:5c5e)
	TX_RAM $d04a
	db $0, " wants", $4f
	db "to fight!", $58
; 0x89c5e + 21 bytes

_UnnamedText_58e4f: ; 89c73 (22:5c73)
	db $0, "SILPH SCOPE", $4f
	db "unveiled the", $55
	db "GHOST's identity!", $58
; 0x89c73 + 43 bytes

_UnnamedText_58e54: ; 89c9e (22:5c9e)
	db $0, "Darn! The GHOST", $4f
	db "can't be ID'd!", $58
; 0x89c9e + 30 bytes

UnknownText_89cbc: ; 89cbc (22:5cbc)
	db $0, "Go! @@"
; 0x89cbc + 7 bytes
	db $0, "Do it! @@"
; 0x89cc3 + 10 bytes
	db $0, "Get'm! @@"
; 0x89ccd + 9 bytes

UnknownText_89cd6: ; 89cd6 (22:5cd6)
	db $0, "The enemy's weak!", $4f
	db "Get'm! @@"
; 0x89cd6 + 26 bytes

_UnnamedText_58ecc: ; 89cf0 (22:5cf0)
	TX_RAM W_PLAYERMONNAME
	db $0, "!", $57
; 0x89cf0 + 6 bytes
	TX_RAM W_PLAYERMONNAME
	db $0, " @@"
	db $0, "enough!@@"
; 0x89cf0 + 23 bytes

_UnnamedText_89d07: ; 89d07 (22:5d07)
	db $0, "OK!@@"
; 0x8d907 + 6

UnknownText_89d0d: ; 89d0d (22:5d0d)
	db $0, "good!@@"
; 0x89d0d + 8 bytes

_UnnamedText_58f3e: ; 89d15 (22:5d15)
	db $0, $4f
	db "Come back!", $57
; 0x89d15 + 13 bytes

_UnnamedText_2fb8e: ; 89d22 (22:5d22)
	db $0, "It's super", $4f
	db "effective!", $58
; 0x89d22 + 22 bytes

_UnnamedText_2fb93: ; 89d38 (22:5d38)
	db $0, "It's not very", $4f
	db "effective...", $58
; 0x89d38 + 27 bytes

SafariZoneEatingText: ; 89d53 (22:5d53)
	db $0, "Wild @"
	TX_RAM W_ENEMYMONNAME
	db $0, $4f
	db "is eating!", $58
; 0x89d53 + 23 bytes

SafariZoneAngryText: ; 89d6a (22:5d6a)
	db $0, "Wild @"
	TX_RAM W_ENEMYMONNAME
	db $0, $4f
	db "is angry!", $58
; 0x89d6a + 22 bytes

; money related
; XXX $2 BCD macro
; $2, pointer, byte
_UnnamedText_1386b: ; 89d80 (22:5d80)
	db $0, $52, " picked up", $4f
	db "¥@"
	db $2, $e5, $cc, $c3
	db $0, "!", $58

_UnnamedText_1c9c1: ; 89d96 (22:5d96)
	db $0, "Clear all saved", $4f
	db "data?", $57
; 0x89d96 + 23 bytes

_UnnamedText_1ca14: ; 89dad (22:5dad)
	db $0, "Which floor do", $4f
	db "you want? ", $57
; 0x89dad + 27 bytes

_PartyMenuNormalText: ; 89dc8 (22:5dc8)
	db $0, "Choose a #MON.", $57
; 0x89dc8 + 16 bytes

_PartyMenuItemUseText: ; 89dd8 (22:5dd8)
	db $0, "Use item on which", $4f
	db "#MON?", $57
; 0x89dd8 + 25 bytes

_PartyMenuBattleText: ; 89df1 (22:5df1)
	db $0, "Bring out which", $4f
	db "#MON?", $57
; 0x89df1 + 23 bytes

_PartyMenuUseTMText: ; 89e08 (22:5e08)
	db $0, "Use TM on which", $4f
	db "#MON?", $57
; 0x89e08 + 23 bytes

_PartyMenuSwapMonText: ; 89e1f (22:5e1f)
	db $0, "Move #MON", $4f
	db "where?", $57
; 0x89e1f + 18 bytes

_PotionText: ; 89e31 (22:5e31)
	TX_RAM $cd6d
	db $0, $4f
	db "recovered by @"
	TX_NUM W_HPBARHPDIFFERENCE, 2, 3
	db $0, "!", $57
; 0x89e31 + 26 bytes

_AntidoteText: ; 89e4b (22:5e4b)
	TX_RAM $cd6d
	db $0, " was", $4f
	db "cured of poison!", $57
; 0x89e4b + 26 bytes

_ParlyzHealText: ; 89e65 (22:5e65)
	TX_RAM $cd6d
	db $0, "'s", $4f
	db "rid of paralysis!", $57
; 0x89e65 + 24 bytes

_BurnHealText: ; 89e7d (22:5e7d)
	TX_RAM $cd6d
	db $0, "'s", $4f
	db "burn was healed!", $57
; 0x89e7d + 23 bytes

_IceHealText: ; 89e94 (22:5e94)
	TX_RAM $cd6d
	db $0, " was", $4f
	db "defrosted!", $57
; 0x89e94 + 20 bytes

_AwakeningText: ; 89ea8 (22:5ea8)
	TX_RAM $cd6d
	db $0, $4f
	db "woke up!", $57
; 0x89ea8 + 14 bytes

_FullHealText: ; 89eb6 (22:5eb6)
	TX_RAM $cd6d
	db $0, "'s", $4f
	db "health returned!", $57
; 0x89eb6 + 23 bytes

_ReviveText: ; 89ecd (22:5ecd)
	TX_RAM $cd6d
	db $0, $4f
	db "is revitalized!", $57
; 0x89ecd + 21 bytes

_RareCandyText: ; 89ee2 (22:5ee2)
	TX_RAM $cd6d
	db $0, " grew", $4f
	db "to level @"
	TX_NUM $d127, $1,$3
	db $0, "!@@"
; 0x89ee2 + 28 bytes

_UnnamedText_17f23: ; 89efe (22:5efe)
	db $0, $52, " turned on", $4f
	db "the PC.", $58
; 0x89efe + 21 bytes

_UnnamedText_17f28: ; 89f13 (22:5f13)
	db $0, "Accessed BILL's", $4f
	db "PC.", $51
	db "Accessed #MON", $4f
	db "Storage System.", $58
; 0x89f13 + 50 bytes

_UnnamedText_17f2d: ; 89f45 (22:5f45)
	db $0, "Accessed someone's", $4f
	db "PC.", $51
	db "Accessed #MON", $4f
	db "Storage System.", $58
; 0x89f45 + 53 bytes

_UnnamedText_17f32: ; 89f7a (22:5f7a)
	db $0, "Accessed my PC.", $51
	db "Accessed Item", $4f
	db "Storage System.", $58
; 0x89f7a + 47 bytes

_UnnamedText_7b22: ; 89fa9 (22:5fa9)
	db $0, $52, " turned on", $4f
	db "the PC.", $58
; 0x89fa9 + 21 bytes

_UnnamedText_7b27: ; 89fbe (22:5fbe)
	db $0, "What do you want", $4f
	db "to do?", $57
; 0x89fbe + 25 bytes

_UnnamedText_7b2c: ; 89fd7 (22:5fd7)
	db $0, "What do you want", $4f
	db "to deposit?", $57
; 0x89fd7 + 30 bytes

_UnnamedText_7b31: ; 89ff5 (22:5ff5)
	db $0, "How many?", $57
; 0x89ff5 + 11 bytes

_UnnamedText_7b36: ; 8a000 (22:6000)
	TX_RAM $cd6d
	db $0, " was", $4f
	db "stored via PC.", $58
; 0x8a000 + 24 bytes

_UnnamedText_7b3b: ; 8a018 (22:6018)
	db $0, "You have nothing", $4f
	db "to deposit.", $58
; 0x8a018 + 30 bytes

_UnnamedText_7b40: ; 8a036 (22:6036)
	db $0, "No room left to", $4f
	db "store items.", $58
; 0x8a036 + 30 bytes

_UnnamedText_7b45: ; 8a054 (22:6054)
	db $0, "What do you want", $4f
	db "to withdraw?", $57
; 0x8a054 + 31 bytes

_UnnamedText_7b4a: ; 8a073 (22:6073)
	db $0, "How many?", $57
; 0x8a073 + 11 bytes

_UnnamedText_7b4f: ; 8a07e (22:607e)
	db $0, "Withdrew", $4f
	db "@"
	TX_RAM $cd6d
	db $0, ".", $58
; 0x8a07e + 17 bytes

_UnnamedText_7b54: ; 8a08f (22:608f)
	db $0, "There is nothing", $4f
	db "stored.", $58
; 0x8a08f + 26 bytes

_UnnamedText_7b59: ; 8a0a9 (22:60a9)
	db $0, "You can't carry", $4f
	db "any more items.", $58
; 0x8a0a9 + 32 bytes

_UnnamedText_7b5e: ; 8a0c9 (22:60c9)
	db $0, "What do you want", $4f
	db "to toss away?", $57
; 0x8a0c9 + 32 bytes

_UnnamedText_7b63: ; 8a0e9 (22:60e9)
	db $0, "How many?", $57
; 0x8a0e9 + 11 bytes

_UnnamedText_76683: ; 8a0f4 (22:60f4)
	db $0, "Accessed #MON", $4f
	db "LEAGUE's site.", $51
	db "Accessed the HALL", $4f
	db "OF FAME List.", $58
; 0x8a0f4 + 61 bytes

_UnnamedText_217e9: ; 8a131 (22:6131)
	db $0, "Switch on!", $58
; 0x8a131 + 12 bytes

_UnnamedText_217ee: ; 8a13d (22:613d)
	db $0, "What?", $57
; 0x8a13d + 7 bytes

_UnnamedText_217f3: ; 8a144 (22:6144)
	db $0, "Deposit which", $4f
	db "#MON?", $57
; 0x8a144 + 21 bytes

_UnnamedText_217f8: ; 8a159 (22:6159)
	TX_RAM $cf4b
	db $0, " was", $4f
	db "stored in Box @"
	TX_RAM $cd3d
	db $0, ".", $58
; 30 bytes

_UnnamedText_217fd: ; 8a177 (22:6177)
	db $0, "You can't deposit", $4f
	db "the last #MON!", $58
; 0x8a177 + 33 bytes

_UnnamedText_21802: ; 8a198 (22:6198)
	db $0, "Oops! This Box is", $4f
	db "full of #MON.", $58
; 0x8a198 + 33 bytes

_UnnamedText_21807: ; 8a1b9 (22:61b9)
	TX_RAM $cf4b
	db $0, " is", $4f
	db "taken out.", $55
	db "Got @"
; 0x8a1b9 + 24 bytes
UnknownText_8a1d1: ; 8a1d1 (22:61d1)
	TX_RAM $cf4b
	db $0, ".", $58
; 0x8a1d1 + 6 bytes

_UnnamedText_2180c: ; 8a1d7 (22:61d7)
	db $0, "What? There are", $4f
	db "no #MON here!", $58
; 0x8a1d7 + 31 bytes

_UnnamedText_21811: ; 8a1f6 (22:61f6)
	db $0, "You can't take", $4f
	db "any more #MON.", $51
	db "Deposit #MON", $4f
	db "first.", $58
; 0x8a1f6 + 50 bytes

_UnnamedText_21816: ; 8a228 (22:6228)
	db $0, "Release which", $4f
	db "#MON?", $57
; 0x8a228 + 21 bytes

_UnnamedText_2181b: ; 8a23d (22:623d)
	db $0, "Once released,", $4f
	db "@"
; 0x8a23d + 17 bytes

UnknownText_8a24e: ; 8a24e (22:624e)
	TX_RAM $cf4b
	db $0, " is", $55
	db "gone forever. OK?", $57
; 0x8a24e + 26 bytes

_UnnamedText_21820: ; 8a268 (22:6268)
	TX_RAM $cf4b
	db $0, " was", $4f
	db "released outside.", $55
	db "Bye @"
; 0x8a268 + 32 bytes

_UnnamedText_8a288: ; 8a288 (22:6288)
	TX_RAM $cf4b
	db $0, "!", $58

_RequireCoinCaseText: ; 8a28e (22:628e)
	db 0,"A COIN CASE is",$4F
	db "required!@@"

_ExchangeCoinsForPrizesText: ; 8a2a9 (22:62a9)
	db 0,"We exchange your",$4F
	db "coins for prizes.",$58

_WhichPrizeText: ; 8a2cd (22:62cd)
	db 0,"Which prize do",$4F
	db "you want?",$57

_HereYouGoText: ; 8a2e7 (22:62e7)
	db 0,"Here you go!@@"

_SoYouWantPrizeText: ; 8a2f6 (22:62f6)
	db 0,"So, you want",$4F
	db "@"
	db 1
	dw $CD6D
	db 0,"?",$57

_SorryNeedMoreCoins: ; 8a30b (22:630b)
	db 0,"Sorry, you need",$4F
	db "more coins.@@"

_OopsYouDontHaveEnoughRoomText: ; 8a329 (22:6329)
	db 0,"Oops! You don't",$4F
	db "have enough room.@@"

_OhFineThenText: ; 8a34c (22:634c)
	db 0,"Oh, fine then.@@"
;635d

_UnnamedText_1e93b: ; 8a35d (22:635d)
	db $0, "Want to get your", $4f
	db "#DEX rated?", $57
; 0x8a35d + 30 bytes

UnknownText_8a37b: ; 8a37b (22:637b)
	db $0, "Closed link to", $4f
	db "PROF.OAK's PC.@@"
; 0x8a37b + 31 bytes

_UnnamedText_1e946: ; 8a39a (22:639a)
	db $0, "Accessed PROF.", $4f
	db "OAK's PC.", $51
	db "Accessed #DEX", $4f
	db "Rating System.", $58
; 0x8a39a + 54 bytes

_UnnamedText_5d43: ; 8a3d0 (22:63d0)
	db $0, "Where would you", $4f
	db "like to go?", $57
; 0x8a3d0 + 29 bytes

_UnnamedText_5d48: ; 8a3ed (22:63ed)
	db $0, "OK, please wait", $4f
	db "just a moment.", $57
; 0x8a3ed + 32 bytes

_UnnamedText_5d4d: ; 8a40d (22:640d)
	db $0, "The link was", $4f
	db "canceled.", $57
; 0x8a40d + 24 bytes

INCLUDE "text/oakspeech.tx"

_UnnamedText_6557: ; 8a605 (22:6605)
	db $0, "Do you want to", $4f
	db "give a nickname", $55
	db "to @"
; 0x8a605 + 36 bytes

UnknownText_8a629: ; 8a629 (22:6629)
	TX_RAM $cd6d
	db $0, "?", $57
; 0x8a629 + 6 bytes

_UnnamedText_699f: ; 8a62f (22:662f)
	db $0, "Right! So your", $4f
	db "name is ", $52, "!", $58
; 0x8a62f + 27 bytes

_UnnamedText_69e7: ; 8a64a (22:664a)
	db $0, "That's right! I", $4f
	db "remember now! His", $55
	db "name is ", $53, "!", $58
; 0x8a64a + 45 bytes

_SSAnne8AfterBattleText2: ; 8a677 (22:6677)
	TX_RAM $cd3f
	db $0, " and", $4f
	db "@"
; 0x8a677 + 10 bytes

UnknownText_8a681: ; 8a681 (22:6681)
	TX_RAM $cd6d
	db $0, " will", $55
	db "be traded.", $57
; 0x8a681 + 21 bytes

_Char00Text: ; 8a696 (22:6696)
	TX_NUM $FF8C,1,2
	db 0," ERROR.",$57

_Char55Text: ; 8a6a3 (22:66a3)
	db 0,$4B,"@@"

_DiglettsCaveRoute2Text1: ; 8a6a7 (22:66a7)
	db $0, "I went to ROCK", $4f
	db "TUNNEL, but it's", $55
	db "dark and scary.", $51
	db "If a #MON's", $4f
	db "FLASH could light", $55
	db "it up...", $57

_ViridianForestexitText1: ; 8a6fd (22:66fd)
	db $0, "Many #MON live", $4f
	db "only in forests ", $55
	db "and caves.", $51
	db "You need to look", $4f
	db "everywhere to get", $55
	db "different kinds!", $57

_ViridianForestexitText2: ; 8a75d (22:675d)
	db $0, "Have you noticed", $4f
	db "the bushes on the", $55
	db "roadside?", $51
	db "They can be cut", $4f
	db "down by a special", $55
	db "#MON move.", $57

_Route2HouseText1: ; 8a7b8 (22:67b8)
	db $0, "A fainted #MON", $4f
	db "can't fight. But, ", $55
	db "it can still use ", $55
	db "moves like CUT!", $57

_UnnamedText_5d616: ; 8a7fc (22:67fc)
	db $0, "The HM FLASH", $4f
	db "lights even the", $55
	db "darkest dungeons.", $57
; 0x8a7fc + 48 bytes

_Route2GateText2: ; 8a82c (22:682c)
	db $0, "Once a #MON", $4f
	db "learns FLASH, you", $55
	db "can get through", $55
	db "ROCK TUNNEL.", $57

_ViridianForestEntranceText1: ; 8a868 (22:6868)
	db $0, "Are you going to", $4f
	db "VIRIDIAN FOREST?", $55
	db "Be careful, it's", $55
	db "a natural maze!", $57

_ViridianForestEntranceText2: ; 8a8ab (22:68ab)
	db $0, "RATTATA may be", $4f
	db "small, but its", $55
	db "bite is wicked!", $55
	db "Did you get one?", $57

_MtMoonPokecenterText1: ; 8a8eb (22:68eb)
	db $0, "I've 6 # BALLs", $4f
	db "set in my belt.", $51
	db "At most, you can", $4f
	db "carry 6 #MON.", $57

_MtMoonPokecenterText3: ; 8a929 (22:6929)
	db $0, "TEAM ROCKET", $4f
	db "attacks CERULEAN", $55
	db "citizens...", $51
	db "TEAM ROCKET is", $4f
	db "always in the", $55
	db "news!", $57

_UnnamedText_4935c: ; 8a976 (22:6976)
	db $0, "MAN: Hello, there!", $4f
	db "Have I got a deal", $55
	db "just for you!", $51
	db "I'll let you have", $4f
	db "a swell MAGIKARP", $55
	db "for just ¥500!", $55
	db "What do you say?", $57
; 0x8a976 + 118 bytes

_UnnamedText_49361: ; 8a9ec (22:69ec)
	db $0, "No? I'm only", $4f
	db "doing this as a", $55
	db "favor to you!", $57
; 0x8a9ec + 43 bytes

_UnnamedText_49366: ; 8aa17 (22:6a17)
	db $0, "You'll need more", $4f
	db "money than that!", $57
; 0x8aa17 + 34 bytes

_UnnamedText_4936b: ; 8aa39 (22:6a39)
	db $0, "MAN: Well, I don't", $4f
	db "give refunds!", $57
; 0x8aa39 + 33 bytes

_MtMoonPokecenterText5: ; 8aa5a (22:6a5a)
	db $0, $57

_UnnamedText_1dfe7: ; 8aa5c (22:6a5c)
	db $0, "I'm on guard duty.", $4f
	db "Gee, I'm thirsty,", $55
	db "though!", $51
	db "Oh wait there,", $4f
	db "the road's closed.", $57
; 0x8aa5c + 77 bytes

_UnnamedText_8aaa9: ; 8aaa9 (22:6aa9)
	db $0, "Whoa, boy!", $4f
	db "I'm parched!", $55
	db "...", $55
	db "Huh? I can have", $55
	db "this drink?", $55
	db "Gee, thanks!@@"
; 0x8aaa9 + 70 bytes

_UnnamedText_1dff1: ; 8aaef (22:6aef)
	db $0, $51
	db "...", $4f
	db "Glug glug...", $55
	db "...", $55
	db "Gulp...", $55
	db "If you want to go", $55
	db "to SAFFRON CITY...", $55
	db "...", $55
	db "You can go on", $55
	db "through. I'll", $55
	db "share this with", $55
	db "the other guards!", $57
; 0x8aaef + 133 bytes

_UnnamedText_1dff6: ; 8ab74 (22:6b74)
	db $0, "Hi, thanks for", $4f
	db "the cool drinks!", $57
; 0x8ab74 + 33 bytes

_UnnamedText_5640f: ; 8ab95 (22:6b95)
	db $0, "I run a DAYCARE.", $4f
	db "Would you like me", $55
	db "to raise one of", $55
	db "your #MON?", $57
; 0x8ab95 + 63 bytes

_UnnamedText_56414: ; 8abd4 (22:6bd4)
	db $0, "Which #MON", $4f
	db "should I raise?", $58
; 0x8abd4 + 28 bytes

_UnnamedText_56419: ; 8abf0 (22:6bf0)
	db $0, "Fine, I'll look", $4f
	db "after @"
; 0x8abf0 + 23 bytes

UnknownText_8ac07: ; 8ac07 (22:6c07)
	TX_RAM $cd6d
	db $0, $55
	db "for a while.", $58
; 0x8ac07 + 18 bytes

_UnnamedText_5641e: ; 8ac19 (22:6c19)
	db $0, "Come see me in", $4f
	db "a while.", $57
; 0x8ac19 + 25 bytes

_UnnamedText_56423: ; 8ac32 (22:6c32)
	db $0, "Your @"
; 0x8ac32 + 7 bytes

UnknownText_8ac39: ; 8ac39 (22:6c39)
	TX_RAM $cd6d
	db $0, $4f
	db "has grown a lot!", $51
	db "By level, it's", $4f
	db "grown by @"
; 0x8ac39 + 46 bytes

UnknownText_8ac67: ; 8ac67 (22:6c67)
	TX_NUM $cd3e,$1,$3
	db $0, "!", $51
	db "Aren't I great?", $58
; 0x8ac67 + 22 bytes

_UnnamedText_56428: ; 8ac7d (22:6c7d)
	db $0, "You owe me ¥@"
; 0x8ac7d + 14 bytes

;XXX
; 0x8ac8b
db $2, $3f, $cd, $c2

UnknownText_8ac8f: ; 8ac8f (22:6c8f)
	db $0, $4f
	db "for the return", $55
	db "of this #MON.", $57
; 0x8ac8f + 31 bytes

_UnnamedText_5642d: ; 8acae (22:6cae)
	db $0, $52, " got", $4f
	db "@"
; 0x8acae + 8 bytes

UnknownText_8acb6: ; 8acb6 (22:6cb6)
	TX_RAM $da49
	db $0, " back!", $57
; 0x8acb6 + 11 bytes

_UnnamedText_56432: ; 8acc1 (22:6cc1)
	db $0, "Back already?", $4f
	db "Your @"
; 0x8acc1 + 21 bytes

UnknownText_8acd6: ; 8acd6 (22:6cd6)
	TX_RAM $cd6d
	db $0, $55
	db "needs some more", $55
	db "time with me.", $58
; 0x8acd6 + 35 bytes

SECTION "bank23",ROMX,BANK[$23]

_UnnamedText_56437: ; 8c000 (23:4000)
	db $0, "All right then,", $4f
	db "@@"
; 0x8c000 + 19 bytes

_UnnamedText_5643b: ; 8c013 (23:4013)
	db $0, "come again.", $57
; 0x8c013 + 13 bytes

_UnnamedText_56440: ; 8c020 (23:4020)
	db $0, "You have no room", $4f
	db "for this #MON!", $57
; 0x8c020 + 33 bytes

_UnnamedText_56445: ; 8c041 (23:4041)
	db $0, "You only have one", $4f
	db "#MON with you.", $57
; 0x8c041 + 34 bytes

_UnnamedText_5644a: ; 8c063 (23:4063)
	db $0, "I can't accept a", $4f
	db "#MON that", $55
	db "knows an HM move.", $57
; 0x8c063 + 45 bytes

_UnnamedText_5644f: ; 8c090 (23:4090)
	db $0, "Thank you! Here's", $4f
	db "your #MON!", $58
; 0x8c090 + 29 bytes

_UnnamedText_56454: ; 8c0ad (23:40ad)
	db $0, "Hey, you don't", $4f
	db "have enough ¥!", $57
; 0x8c0ad + 30 bytes

_UndergroundTunnelEntranceRoute6Text1: ; 8c0cb (23:40cb)
	db $0, "People often lose", $4f
	db "things in that", $55
	db "UNDERGROUND PATH.", $57

_UndergroundPathEntranceRoute7Text1: ; 8c0ff (23:40ff)
	db $0, "I heard a sleepy", $4f
	db "#MON appeared", $55
	db "near CELADON CITY.", $57

_UnnamedText_5d773: ; 8c132 (23:4132)
	db $0, "I want to shop at", $4f
	db "the dept. store", $55
	db "in CELADON but...", $51
	db "There are so many", $4f
	db "rough looking", $55
	db "people there.", $57
; 0x8c132 + 99 bytes

_UnnamedText_5d778: ; 8c195 (23:4195)
	db $0, "TEAM ROCKET had a", $4f
	db "secret hideout in", $55
	db "CELADON CITY?", $57
; 0x8c195 + 51 bytes

_UnnamedText_5d77d: ; 8c1c8 (23:41c8)
	db $0, "You're here to", $4f
	db "shop in CELADON?", $51
	db "Just step outside", $4f
	db "and head west!", $57
; 0x8c1c8 + 65 bytes

_UnnamedText_5d782: ; 8c209 (23:4209)
	db $0, "The UNDERGROUND", $4f
	db "PATH goes beneath", $55
	db "SAFFRON and leads", $55
	db "to LAVENDER.", $51
	db "If you're heading", $4f
	db "to CERULEAN, go", $55
	db "to the building", $55
	db "across the road.", $57
; 0x8c209 + 132 bytes

_UndergroundPathEntranceRoute8Text1: ; 8c28d (23:428d)
	db $0, "The dept. store", $4f
	db "in CELADON has a", $55
	db "great selection!", $57

_RockTunnelPokecenterText1: ; 8c2c0 (23:42c0)
	db $0, "The element types", $4f
	db "of #MON make", $55
	db "them stronger", $55
	db "than some types", $55
	db "and weaker than", $55
	db "others!", $57

_RockTunnelPokecenterText3: ; 8c316 (23:4316)
	db $0, "I sold a useless", $4f
	db "NUGGET for ¥5000!", $57

_UnnamedText_44588: ; 8c33a (23:433a)
	db $0, "This tunnel goes", $4f
	db "a long way, kid!", $57
; 0x8c33a + 35 bytes

_UnnamedText_4458d: ; 8c35d (23:435d)
	db $0, "Doh!", $4f
	db "You win!", $58
; 0x8c35d + 15 bytes

_UnnamedText_44592: ; 8c36c (23:436c)
	db $0, "Watch for ONIX!", $4f
	db "It can put the", $55
	db "squeeze on you!", $57
; 0x8c36c + 48 bytes

_UnnamedText_44597: ; 8c39c (23:439c)
	db $0, "Hmm. Maybe I'm", $4f
	db "lost in here...", $57
; 0x8c39c + 31 bytes

_UnnamedText_4459c: ; 8c3bb (23:43bb)
	db $0, "Ease up!", $4f
	db "What am I doing?", $55
	db "Which way is out?", $58
; 0x8c3bb + 45 bytes

_UnnamedText_445a1: ; 8c3e8 (23:43e8)
	db $0, "That sleeping", $4f
	db "#MON on ROUTE", $55
	db "12 forced me to", $55
	db "take this detour.", $57
; 0x8c3e8 + 63 bytes

_UnnamedText_445a6: ; 8c427 (23:4427)
	db $0, "Outsiders like", $4f
	db "you need to show", $55
	db "me some respect!", $57
; 0x8c427 + 50 bytes

_UnnamedText_445ab: ; 8c459 (23:4459)
	db $0, "I give!", $58
; 0x8c459 + 9 bytes

_UnnamedText_445b0: ; 8c462 (23:4462)
	db $0, "You're talented", $4f
	db "enough to hike!", $57
; 0x8c462 + 32 bytes

_UnnamedText_445b5: ; 8c482 (23:4482)
	db $0, "#MON fight!", $4f
	db "Ready, go!", $57
; 0x8c482 + 24 bytes

_UnnamedText_445ba: ; 8c49a (23:449a)
	db $0, "Game", $4f
	db "over!", $58
; 0x8c49a + 12 bytes

_UnnamedText_445bf: ; 8c4a6 (23:44a6)
	db $0, "Oh well, I'll get", $4f
	db "a ZUBAT as I go!", $57
; 0x8c4a6 + 35 bytes

_UnnamedText_445c4: ; 8c4c9 (23:44c9)
	db $0, "Eek! Don't try", $4f
	db "anything funny in", $55
	db "the dark!", $57
; 0x8c4c9 + 43 bytes

_UnnamedText_445c9: ; 8c4f4 (23:44f4)
	db $0, "It", $4f
	db "was too dark!", $58
; 0x8c4f4 + 18 bytes

_UnnamedText_445ce: ; 8c506 (23:4506)
	db $0, "I saw a MACHOP", $4f
	db "in this tunnel!", $57
; 0x8c506 + 32 bytes

_UnnamedText_445d3: ; 8c526 (23:4526)
	db $0, "I came this far", $4f
	db "for #MON!", $57
; 0x8c526 + 27 bytes

_UnnamedText_445d8: ; 8c541 (23:4541)
	db $0, "I'm", $4f
	db "out of #MON!", $58
; 0x8c541 + 17 bytes

_UnnamedText_445dd: ; 8c552 (23:4552)
	db $0, "You looked cute", $4f
	db "and harmless!", $57
; 0x8c552 + 31 bytes

_UnnamedText_445e2: ; 8c571 (23:4571)
	db $0, "You have #MON!", $4f
	db "Let's start!", $57
; 0x8c571 + 28 bytes

_UnnamedText_445e7: ; 8c58d (23:458d)
	db $0, "You", $4f
	db "play hard!", $58
; 0x8c58d + 16 bytes

_UnnamedText_445ec: ; 8c59d (23:459d)
	db $0, "Whew! I'm all", $4f
	db "sweaty now!", $57
; 0x8c59d + 26 bytes

_RockTunnel1Text8: ; 8c5b7 (23:45b7)
	db $0, "ROCK TUNNEL", $4f
	db "CERULEAN CITY -", $55
	db "LAVENDER TOWN", $57

_VoltorbBattleText: ; 8c5e2 (23:45e2)
	db $0, "Bzzzt!", $57
; 0x8c5e2 + 8 bytes

_ZapdosBattleText: ; 8c5ea (23:45ea)
	db $0, "Gyaoo!@@"
; 0x8c5ea + 9 bytes

_Route11GateText1: ; 8c5f3 (23:45f3)
	db $0, "When you catch", $4f
	db "lots of #MON,", $55
	db "isn't it hard to", $55
	db "think up names?", $51
	db "In LAVENDER TOWN,", $4f
	db "there's a man who", $55
	db "rates #MON", $55
	db "nicknames.", $51
	db "He'll help you", $4f
	db "rename them too!", $57

_UnnamedText_494a3: ; 8c689 (23:4689)
	db $0, "There are items on", $4f
	db "the ground that", $55
	db "can't be seen.", $51
	db "ITEMFINDER will", $4f
	db "detect an item", $55
	db "close to you.", $51
	db "It can't pinpoint", $4f
	db "it, so you have", $55
	db "to look yourself!", $57
; 0x8c689 + 146 bytes

_UnnamedText_494c4: ; 8c71b (23:471b)
	db $0, "Looked into the", $4f
	db "binoculars.", $51
	db "A big #MON is", $4f
	db "asleep on a road!", $57
; 0x8c71b + 61 bytes

_UnnamedText_494c9: ; 8c758 (23:4758)
	db $0, "Looked into the", $4f
	db "binoculars.", $51
	db "It's a beautiful", $4f
	db "view!", $57
; 0x8c758 + 51 bytes

_UnnamedText_494d5: ; 8c78b (23:478b)
	db $0, "Looked into the", $4f
	db "binoculars.", $51
	db "The only way to", $4f
	db "get from CERULEAN", $55
	db "CITY to LAVENDER", $55
	db "is by way of the", $55
	db "ROCK TUNNEL.", $57
; 0x8c78b + 110 bytes

_DiglettsCaveEntranceRoute11Text1: ; 8c7f9 (23:47f9)
	db $0, "What a surprise!", $4f
	db "DIGLETTs dug this", $55
	db "long tunnel!", $51
	db "It goes right to", $4f
	db "VIRIDIAN CITY!", $57

_Route12GateText1: ; 8c84a (23:484a)
	db $0, "There's a lookout", $4f
	db "spot upstairs.", $57

_TM39PreReceiveText: ; 8c86b (23:486b)
	db $0, "My #MON's", $4f
	db "ashes are stored", $55
	db "in #MON TOWER.", $51
	db "You can have this", $4f
	db "TM. I don't need", $55
	db "it any more...", $58
; 0x8c86b + 91 bytes

_ReceivedTM39Text: ; 8c8c6 (23:48c6)
	db $0, $52, " received", $4f
	db "TM39!@@"
; 0x8c8c6 + 19 bytes

_TM39ExplanationText: ; 8c8d9 (23:48d9)
	db $0, "TM39 is a move", $4f
	db "called SWIFT.", $51
	db "It's very accurate,", $4f
	db "so use it during", $55
	db "battles you can't", $55
	db "afford to lose.", $57
; 0x8c8d9 + 99 bytes

_TM39NoRoomText: ; 8c93c (23:493c)
	db $0, "You don't have", $4f
	db "room for this.", $57
; 0x8c93c + 30 bytes

_UnnamedText_495b8: ; 8c95a (23:495a)
	db $0, "Looked into the", $4f
	db "binoculars.", $51
	db "A man fishing!", $57
; 0x8c95a + 44 bytes

_UnnamedText_495c4: ; 8c986 (23:4986)
	db $0, "Looked into the", $4f
	db "binoculars.", $51
	db "It's #MON TOWER!", $57
; 0x8c986 + 45 bytes

_UnnamedText_564c0: ; 8c9b3 (23:49b3)
	db $0, "I'm the FISHING", $4f
	db "GURU's brother!", $51
	db "I simply Looove", $4f
	db "fishing!", $51
	db "Do you like to", $4f
	db "fish?", $57
; 0x8c9b3 + 77 bytes

_UnnamedText_564c5: ; 8ca00 (23:4a00)
	db $0, "Grand! I like", $4f
	db "your style!", $51
	db "Take this and", $4f
	db "fish, young one!", $51
	db $52, " received", $4f
	db "a @"
; 0x8ca00 + 72 bytes

UnknownText_8ca48: ; 8ca48 (23:4a48)
	TX_RAM $cf4b
	db $0, "!@@"
; 0x8ca48 + 7 bytes

_UnnamedText_564ca: ; 8ca4f (23:4a4f)
	db $0, $51
	db "Fishing is a way", $4f
	db "of life!", $51
	db "From the seas to", $4f
	db "rivers, go out", $55
	db "and land the big", $55
	db "one!", $57
; 0x8ca4f + 82 bytes

_UnnamedText_564cf: ; 8caa1 (23:4aa1)
	db $0, "Oh... That's so", $4f
	db "disappointing...", $57
; 0x8caa1 + 33 bytes

_UnnamedText_564d4: ; 8cac2 (23:4ac2)
	db $0, "Hello there,", $4f
	db $52, "!", $51
	db "Use the SUPER ROD", $4f
	db "in any water!", $55
	db "You can catch", $55
	db "different kinds", $55
	db "of #MON.", $51
	db "Try fishing", $4f
	db "wherever you can!", $57
; 0x8cac2 + 118 bytes

_UnnamedText_564d9: ; 8cb38 (23:4b38)
	db $0, "Oh no!", $51
	db "I had a gift for", $4f
	db "you, but you have", $55
	db "no room for it!", $57
; 0x8cb38 + 59 bytes

_Route15GateText1: ; 8cb73 (23:4b73)
	db $0, "Are you working", $4f
	db "on a #DEX?", $51
	db "PROF.OAK's AIDE", $4f
	db "came by here.", $57

_UnnamedText_4968c: ; 8cbac (23:4bac)
	db $0, "EXP.ALL gives", $4f
	db "EXP points to all", $55
	db "the #MON with", $55
	db "you, even if they", $55
	db "don't fight.", $51
	db "It does, however,", $4f
	db "reduce the amount", $55
	db "of EXP for each", $55
	db "#MON.", $51
	db "If you don't need", $4f
	db "it, you should ", $55
	db "store it via PC.", $57
; 0x8cbac + 185 bytes

_UnnamedText_49698: ; 8cc65 (23:4c65)
	db $0, "Looked into the", $4f
	db "binoculars.", $51
	db "It looks like a", $4f
	db "small island!", $57
; 0x8cc65 + 59 bytes

_UnnamedText_49777: ; 8cca0 (23:4ca0)
	db $0, "No pedestrians", $4f
	db "are allowed on", $55
	db "CYCLING ROAD!", $57
; 0x8cca0 + 45 bytes

_UnnamedText_4977c: ; 8cccd (23:4ccd)
	db $0, "CYCLING ROAD is a", $4f
	db "downhill course", $55
	db "by the sea. It's", $55
	db "a great ride.", $57
; 0x8cccd + 65 bytes

_UnnamedText_49781: ; 8cd0e (23:4d0e)
	db $0, "Excuse me! Wait", $4f
	db "up please!", $57
; 0x8cd0e + 28 bytes

_Route16GateMapText2: ; 8cd2a (23:4d2a)
	db $0, "How'd you get in?", $4f
	db "Good effort!", $57

_UnnamedText_49820: ; 8cd49 (23:4d49)
	db $0, "I'm going for a", $4f
	db "ride with my girl", $55
	db "friend!", $57
; 0x8cd49 + 42 bytes

_UnnamedText_4982f: ; 8cd73 (23:4d73)
	db $0, "We're going", $4f
	db "riding together!", $57
; 0x8cd73 + 29 bytes

_UnnamedText_4983b: ; 8cd90 (23:4d90)
	db $0, "Looked into the", $4f
	db "binoculars.", $51
	db "It's CELADON DEPT.", $4f
	db "STORE!", $57
; 0x8cd90 + 54 bytes

_UnnamedText_49847: ; 8cdc6 (23:4dc6)
	db $0, "Looked into the", $4f
	db "binoculars.", $51
	db "There's a long", $4f
	db "path over water!", $57
; 0x8cdc6 + 60 bytes

_Route16HouseText3: ; 8ce02 (23:4e02)
	db $0, "Oh, you found my", $4f
	db "secret retreat!", $51
	db "Please don't tell", $4f
	db "anyone I'm here.", $55
	db "I'll make it up", $55
	db "to you with this!", $58
; 0x8ce02 + 100 bytes

_ReceivedHM02Text: ; 8ce66 (23:4e66)
	db $0, $52, " received", $4f
	db "HM02!@@"
; 0x8ce66 + 19 bytes

_HM02ExplanationText: ; 8ce79 (23:4e79)
	db $0, "HM02 is FLY.", $4f
	db "It will take you", $55
	db "back to any town.", $51
	db "Put it to good", $4f
	db "use!", $57
; 0x8ce79 + 69 bytes

_HM02NoRoomText: ; 8cebe (23:4ebe)
	db $0, "You don't have any", $4f
	db "room for this.", $57
; 0x8cebe + 34 bytes

_UnnamedText_1e652: ; 8cee0 (23:4ee0)
	db $0, "FEAROW: Kyueen!", $57
; 0x8cee0 + 17 bytes

_UnnamedText_49928: ; 8cef1 (23:4ef1)
	db $0, "You need a BICYCLE", $4f
	db "for CYCLING ROAD!", $57
; 0x8cef1 + 38 bytes

_UnnamedText_4992d: ; 8cf17 (23:4f17)
	db $0, "CYCLING ROAD is", $4f
	db "all uphill from", $55
	db "here.", $57
; 0x8cf17 + 39 bytes

_UnnamedText_49932: ; 8cf3e (23:4f3e)
	db $0, "Excuse me!", $57
; 0x8cf3e + 12 bytes

_UnnamedText_49993: ; 8cf4a (23:4f4a)
	db $0, "Looked into the", $4f
	db "binoculars.", $51
	db "PALLET TOWN is in", $4f
	db "the west!", $57
; 0x8cf4a + 57 bytes

_UnnamedText_4999f: ; 8cf83 (23:4f83)
	db $0, "Looked into the", $4f
	db "binoculars.", $51
	db "There are people", $4f
	db "swimming!", $57
; 0x8cf83 + 56 bytes

_UnnamedText_1e704: ; 8cfbb (23:4fbb)
	db $0, "Only truly skilled", $4f
	db "trainers are", $55
	db "allowed through.", $51
	db "You don't have the", $4f
	db "BOULDERBADGE yet!@@"
; 0x8d012

_UnnamedText_1e715: ; 8d012 (23:5012)
	db $0, $51
	db "The rules are", $4f
	db "rules. I can't", $55
	db "let you pass.", $57
; 0x8d012 + 44 bytes

_UnnamedText_1e71a: ; 8d03e (23:503e)
	db $0, "Oh! That is the", $4f
	db "BOULDERBADGE!", $55
	db "Go right ahead!@@"
; 0x8d03e + 48 bytes

_VictoryRoad2BattleText6: ; 8d06e (23:506e)
	db $0, "Gyaoo!@@"
; 0x8d06e + 9 bytes

_VictoryRoad2BattleText1: ; 8d077 (23:5077)
	db $0, "VICTORY ROAD is", $4f
	db "the final test", $55
	db "for trainers!", $57
; 0x8d077 + 46 bytes

_VictoryRoad2EndBattleText1: ; 8d0a5 (23:50a5)
	db $0, "Aiyah!", $58
; 0x8d0a5 + 8 bytes

_VictoryRoad2AfterBattleText1: ; 8d0ad (23:50ad)
	db $0, "If you get stuck,", $4f
	db "try moving some", $55
	db "boulders around!", $57
; 0x8d0ad + 52 bytes

_VictoryRoad2BattleText2: ; 8d0e1 (23:50e1)
	db $0, "Ah, so you wish", $4f
	db "to challenge the", $55
	db "ELITE FOUR?", $57
; 0x8d0e1 + 46 bytes

_VictoryRoad2EndBattleText2: ; 8d10f (23:510f)
	db $0, "You", $4f
	db "got me!", $58
; 0x8d10f + 13 bytes

_VictoryRoad2AfterBattleText2: ; 8d11c (23:511c)
	db $0, $53, " also came", $4f
	db "through here!", $57
; 0x8d11c + 27 bytes

_VictoryRoad2BattleText3: ; 8d137 (23:5137)
	db $0, "Come on!", $4f
	db "I'll whip you!", $57
; 0x8d137 + 24 bytes

_VictoryRoad2EndBattleText3: ; 8d14f (23:514f)
	db $0, "I got", $4f
	db "whipped!", $58
; 0x8d14f + 16 bytes

_VictoryRoad2AfterBattleText3: ; 8d15f (23:515f)
	db $0, "You earned the", $4f
	db "right to be on", $55
	db "VICTORY ROAD!", $57
; 0x8d15f + 45 bytes

_VictoryRoad2BattleText4: ; 8d18c (23:518c)
	db $0, "If you can get", $4f
	db "through here, you", $55
	db "can go meet the", $55
	db "ELITE FOUR!", $57
; 0x8d18c + 62 bytes

_VictoryRoad2EndBattleText4: ; 8d1ca (23:51ca)
	db $0, "No!", $4f
	db "Unbelievable!", $58
; 0x8d1ca + 19 bytes

_VictoryRoad2AfterBattleText4: ; 8d1dd (23:51dd)
	db $0, "I can beat you", $4f
	db "when it comes to", $55
	db "knowledge about", $55
	db "#MON!", $57
; 0x8d1dd + 55 bytes

_VictoryRoad2BattleText5: ; 8d214 (23:5214)
	db $0, "Is VICTORY ROAD", $4f
	db "too tough?", $57
; 0x8d214 + 28 bytes

_VictoryRoad2EndBattleText5: ; 8d230 (23:5230)
	db $0, "Well", $4f
	db "done!", $58
; 0x8d230 + 12 bytes

_VictoryRoad2AfterBattleText5: ; 8d23c (23:523c)
	db $0, "Many trainers give", $4f
	db "up the challenge", $55
	db "here.", $57
; 0x8d23c + 43 bytes

_UnnamedText_1e865: ; 8d267 (23:5267)
	db $0, "Hiya! I'm a", $4f
	db "#MON...", $55
	db "...No I'm not!", $51
	db "Call me BILL!", $4f
	db "I'm a true blue", $55
	db "#MANIAC! Hey!", $55
	db "What's with that", $55
	db "skeptical look?", $51
	db "I'm not joshing", $4f
	db "you, I screwed up", $55
	db "an experiment and", $55
	db "got combined with", $55
	db "a #MON!", $51
	db "So, how about it?", $4f
	db "Help me out here!", $57
; 0x8d267 + 222 bytes

_UnnamedText_1e86a: ; 8d345 (23:5345)
	db $0, "When I'm in the", $4f
	db "TELEPORTER, go to", $55
	db "my PC and run the", $55
	db "Cell Separation", $55
	db "System!", $57
; 0x8d345 + 76 bytes

_UnnamedText_1e86f: ; 8d391 (23:5391)
	db $0, "No!? Come on, you", $4f
	db "gotta help a guy", $55
	db "in deep trouble!", $51
	db "What do you say,", $4f
	db "chief? Please?", $55
	db "OK? All right!", $58
; 0x8d391 + 100 bytes

_BillThankYouText: ; 8d3f5 (23:53f5)
	db $0, "BILL: Yeehah!", $4f
	db "Thanks, bud! I", $55
	db "owe you one!", $51
	db "So, did you come", $4f
	db "to see my #MON", $55
	db "collection?", $55
	db "You didn't?", $55
	db "That's a bummer.", $51
	db "I've got to thank", $4f
	db "you... Oh here,", $55
	db "maybe this'll do.", $58
; 0x8d3f5 + 164 bytes

_SSTicketReceivedText: ; 8d499 (23:5499)
	db $0, $52, " received", $4f
	db "an @"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x8d4b0

_SSTicketNoRoomText: ; 8d4b0 (23:54b0)
	db $0, "You've got too", $4f
	db "much stuff, bud!", $57
; 0x8d4b0 + 32 bytes

_UnnamedText_1e8cb: ; 8d4d0 (23:54d0)
	db $0, "That cruise ship,", $4f
	db "S.S.ANNE, is in", $55
	db "VERMILION CITY.", $55
	db "Its passengers", $55
	db "are all trainers!", $51
	db "They invited me", $4f
	db "to their party,", $55
	db "but I can't stand", $55
	db "fancy do's. Why", $55
	db "don't you go", $55
	db "instead of me?", $57
; 0x8d4d0 + 175 bytes

_UnnamedText_1e8da: ; 8d57f (23:557f)
	db $0, "BILL: Look, bud,", $4f
	db "just check out", $55
	db "some of my rare", $55
	db "#MON on my PC!", $57
; 0x8d57f + 64 bytes

_Route1ViridianMartSampleText: ; 8d5bf (23:55bf)
	db $0, "Hi! I work at a", $4f
	db "#MON MART.", $51
	db "It's a convenient", $4f
	db "shop, so please", $55
	db "visit us in", $55
	db "VIRIDIAN CITY.", $51
	db "I know, I'll give", $4f
	db "you a sample!", $55
	db "Here you go!", $58
; 0x8d5bf + 132 bytes

UnknownText_8d643: ; 8d643 (23:5643)
	db $0, $52, " got", $4f
	db "@"
; 0x8d643 + 8 bytes

UnknownText_8d64b: ; 8d64b (23:564b)
	TX_RAM $cf4b
	db $0, "!@@"
; 0x8d64b + 7 bytes

_UnnamedText_1caee: ; 8d652 (23:5652)
	db $0, "We also carry", $4f
	db "# BALLs for", $55
	db "catching #MON!", $57
; 0x8d652 + 42 bytes

_UnnamedText_1caf3: ; 8d67c (23:567c)
	db $0, "You have too much", $4f
	db "stuff with you!", $57
; 0x8d67c + 35 bytes

_Route1Text2: ; 8d69f (23:569f)
	db $0, "See those ledges", $4f
	db "along the road?", $51
	db "It's a bit scary,", $4f
	db "but you can jump", $55
	db "from them.", $51
	db "You can get back", $4f
	db "to PALLET TOWN", $55
	db "quicker that way.", $57

_Route1Text3: ; 8d720 (23:5720)
	db $0, "ROUTE 1", $4f
	db "PALLET TOWN -", $55
	db "VIRIDIAN CITY", $57

_Route2Text3: ; 8d745 (23:5745)
	db $0, "ROUTE 2", $4f
	db "VIRIDIAN CITY -", $55
	db "PEWTER CITY", $57

_Route2Text4: ; 8d76a (23:576a)
	db $0, "DIGLETT's CAVE", $57

_Route3Text1: ; 8d779 (23:5779)
	db $0, "Whew... I better", $4f
	db "take a rest...", $55
	db "Groan...", $51
	db "That tunnel from", $4f
	db "CERULEAN takes a", $55
	db "lot out of you!", $57

_Route3BattleText1: ; 8d7d5 (23:57d5)
	db $0, "Hey! I met you in", $4f
	db "VIRIDIAN FOREST!", $57
; 0x8d7d5 + 36 bytes

_Route3EndBattleText1: ; 8d7f9 (23:57f9)
	db $0, "You", $4f
	db "beat me again!", $58
; 0x8d7f9 + 20 bytes

_Route3AfterBattleText1: ; 8d80d (23:580d)
	db $0, "There are other", $4f
	db "kinds of #MON", $55
	db "than those found", $55
	db "in the forest!", $57
; 0x8d80d + 63 bytes

_Route3BattleText2: ; 8d84c (23:584c)
	db $0, "Hi! I like shorts!", $4f
	db "They're comfy and", $55
	db "easy to wear!", $57
; 0x8d84c + 51 bytes

_Route3EndBattleText2: ; 8d87f (23:587f)
	db $0, "I don't", $4f
	db "believe it!", $58
; 0x8d87f + 20 bytes

_Route3AfterBattleText2: ; 8d893 (23:5893)
	db $0, "Are you storing", $4f
	db "your #MON on", $55
	db "PC? Each BOX can", $55
	db "hold 20 #MON!", $57
; 0x8d893 + 61 bytes

_Route3BattleText3: ; 8d8d0 (23:58d0)
	db $0, "You looked at me,", $4f
	db "didn't you?", $57
; 0x8d8d0 + 30 bytes

_Route3EndBattleText3: ; 8d8ee (23:58ee)
	db $0, "You're", $4f
	db "mean!", $58
; 0x8d8ee + 13 bytes

_Route3AfterBattleText3: ; 8d8fb (23:58fb)
	db $0, "Quit staring if", $4f
	db "you don't want to", $55
	db "fight!", $57
; 0x8d8fb + 41 bytes

_Route3BattleText4: ; 8d924 (23:5924)
	db $0, "Are you a trainer?", $4f
	db "Let's fight!", $57
; 0x8d924 + 32 bytes

_Route3EndBattleText4: ; 8d944 (23:5944)
	db $0, "If I", $4f
	db "had new #MON I", $55
	db "would've won!", $58
; 0x8d944 + 34 bytes

_Route3AfterBattleText4: ; 8d966 (23:5966)
	db $0, "If a #MON BOX", $4f
	db "on the PC gets", $55
	db "full, just switch", $55
	db "to another BOX!", $57
; 0x8d966 + 64 bytes

_Route3BattleText5: ; 8d9a6 (23:59a6)
	db $0, "That look you", $4f
	db "gave me, it's so", $55
	db "intriguing!", $57
; 0x8d9a6 + 43 bytes

_Route3EndBattleText5: ; 8d9d1 (23:59d1)
	db $0, "Be nice!", $58
; 0x8d9d1 + 10 bytes

_Route3AfterBattleText5: ; 8d9db (23:59db)
	db $0, "Avoid fights by", $4f
	db "not letting", $55
	db "people see you!", $57
; 0x8d9db + 45 bytes

_Route3BattleText6: ; 8da08 (23:5a08)
	db $0, "Hey! You're not", $4f
	db "wearing shorts!", $57
; 0x8da08 + 32 bytes

_Route3EndBattleText6: ; 8da28 (23:5a28)
	db $0, "Lost!", $4f
	db "Lost! Lost!", $58
; 0x8da28 + 19 bytes

_Route3AfterBattleText6: ; 8da3b (23:5a3b)
	db $0, "I always wear", $4f
	db "shorts, even in", $55
	db "winter!", $57
; 0x8da3b + 39 bytes

_Route3BattleText7: ; 8da62 (23:5a62)
	db $0, "You can fight my", $4f
	db "new #MON!", $57
; 0x8da62 + 28 bytes

_Route3EndBattleText7: ; 8da7e (23:5a7e)
	db $0, "Done", $4f
	db "like dinner!", $58
; 0x8da7e + 19 bytes

_Route3AfterBattleText7: ; 8da91 (23:5a91)
	db $0, "Trained #MON", $4f
	db "are stronger than", $55
	db "the wild ones!", $57
; 0x8da91 + 47 bytes

_Route3BattleText8: ; 8dac0 (23:5ac0)
	db $0, "Eek! Did you", $4f
	db "touch me?", $57
; 0x8dac0 + 24 bytes

_Route3EndBattleText8: ; 8dad8 (23:5ad8)
	db $0, "That's it?", $58
; 0x8dad8 + 11 bytes

_Route3AfterBattleText8: ; 8dae3 (23:5ae3)
	db $0, "ROUTE 4 is at the", $4f
	db "foot of MT.MOON.", $57
; 0x8dae3 + 36 bytes

_Route3Text10: ; 8db07 (23:5b07)
	db $0, "ROUTE 3", $4f
	db "MT.MOON AHEAD", $57

_Route4Text1: ; 8db1e (23:5b1e)
	db $0, "Ouch! I tripped", $4f
	db "over a rocky", $55
	db "#MON, GEODUDE!", $57

_Route4BattleText1: ; 8db4b (23:5b4b)
	db $0, "I came to get my", $4f
	db "mushroom #MON!", $57
; 0x8db4b + 33 bytes

_Route4EndBattleText1: ; 8db6c (23:5b6c)
	db $0, "Oh! My cute", $4f
	db "mushroom #MON!", $58
; 0x8db6c + 28 bytes

_Route4AfterBattleText1: ; 8db88 (23:5b88)
	db $0, "There might not", $4f
	db "be any more", $55
	db "mushrooms here.", $51
	db "I think I got", $4f
	db "them all.", $57
; 0x8db88 + 69 bytes

_Route4Text5: ; 8dbcd (23:5bcd)
	db $0, "MT.MOON", $4f
	db "Tunnel Entrance", $57

_Route4Text6: ; 8dbe6 (23:5be6)
	db $0, "ROUTE 4", $4f
	db "MT.MOON -", $55
	db "CERULEAN CITY", $57

_Route5Text1: ; 8dc07 (23:5c07)
	db $0, "UNDERGROUND PATH", $4f
	db "CERULEAN CITY -", $55
	db "VERMILION CITY", $57

_Route6BattleText1: ; 8dc38 (23:5c38)
	db $0, "Who's there?", $4f
	db "Quit listening in", $55
	db "on us!", $57
; 0x8dc38 + 38 bytes

_Route6EndBattleText1: ; 8dc5e (23:5c5e)
	db $0, "I", $4f
	db "just can't win!", $58
; 0x8dc5e + 18 bytes

_Route6AfterBattleText1: ; 8dc70 (23:5c70)
	db $0, "Whisper...", $4f
	db "whisper...", $57
; 0x8dc70 + 23 bytes

_Route6BattleText2: ; 8dc87 (23:5c87)
	db $0, "Excuse me! This", $4f
	db "is a private", $55
	db "conversation!", $57
; 0x8dc87 + 44 bytes

_Route6EndBattleText2: ; 8dcb3 (23:5cb3)
	db $0, "Ugh!", $4f
	db "I hate losing!", $58
; 0x8dcb3 + 21 bytes

_Route6BattleText3: ; 8dcc8 (23:5cc8)
	db $0, "There aren't many", $4f
	db "bugs out here.", $57
; 0x8dcc8 + 33 bytes

_Route6EndBattleText3: ; 8dce9 (23:5ce9)
	db $0, "No!", $4f
	db "You're kidding!", $58
; 0x8dce9 + 20 bytes

_Route6AfterBattleText3: ; 8dcfd (23:5cfd)
	db $0, "I like bugs, so", $4f
	db "I'm going back to", $55
	db "VIRIDIAN FOREST.", $57
; 0x8dcfd + 51 bytes

_Route6BattleText4: ; 8dd30 (23:5d30)
	db $0, "Huh? You want", $4f
	db "to talk to me?", $57
; 0x8dd30 + 30 bytes

_Route6EndBattleText4: ; 8dd4e (23:5d4e)
	db $0, "I", $4f
	db "didn't start it!", $58
; 0x8dd4e + 19 bytes

_Route6AfterBattleText4: ; 8dd61 (23:5d61)
	db $0, "I should carry", $4f
	db "more #MON with", $55
	db "me for safety.", $57
; 0x8dd61 + 46 bytes

_Route6BattleText5: ; 8dd8f (23:5d8f)
	db $0, "Me? Well, OK.", $4f
	db "I'll play!", $57
; 0x8dd8f + 25 bytes

_Route6EndBattleText5: ; 8dda8 (23:5da8)
	db $0, "Just", $4f
	db "didn't work!", $58
; 0x8dda8 + 18 bytes

_Route6AfterBattleText5: ; 8ddba (23:5dba)
	db $0, "I want to get", $4f
	db "stronger! What's", $55
	db "your secret?", $57
; 0x8ddba + 44 bytes

_Route6BattleText6: ; 8dde6 (23:5de6)
	db $0, "I've never seen", $4f
	db "you around!", $55
	db "Are you good?", $57
; 0x8dde6 + 42 bytes

_Route6EndBattleText6: ; 8de10 (23:5e10)
	db $0, "You", $4f
	db "are too good!", $58
; 0x8de10 + 19 bytes

_Route6AfterBattleText6: ; 8de23 (23:5e23)
	db $0, "Are my #MON", $4f
	db "weak? Or, am I", $55
	db "just bad?", $57
; 0x8de23 + 38 bytes

_Route6Text7: ; 8de49 (23:5e49)
	db $0, "UNDERGROUND PATH", $4f
	db "CERULEAN CITY -", $55
	db "VERMILION CITY", $57

_Route7Text1: ; 8de7a (23:5e7a)
	db $0, "UNDERGROUND PATH", $4f
	db "CELADON CITY -", $55
	db "LAVENDER TOWN", $57

_Route8BattleText1: ; 8dea9 (23:5ea9)
	db $0, "You look good at", $4f
	db "#MON, but", $55
	db "how's your chem?", $57
; 0x8dea9 + 44 bytes

_Route8EndBattleText1: ; 8ded5 (23:5ed5)
	db $0, "Ow!", $4f
	db "Meltdown!", $58
; 0x8ded5 + 15 bytes

_Route8AfterBattleText1: ; 8dee4 (23:5ee4)
	db $0, "I am better at", $4f
	db "school than this!", $57
; 0x8dee4 + 34 bytes

_Route8BattleText2: ; 8df06 (23:5f06)
	db $0, "All right! Let's", $4f
	db "roll the dice!", $57
; 0x8df06 + 32 bytes

_Route8EndBattleText2: ; 8df26 (23:5f26)
	db $0, "Drat!", $4f
	db "Came up short!", $58
; 0x8df26 + 22 bytes

_Route8AfterBattleText2: ; 8df3c (23:5f3c)
	db $0, "Lady Luck's not", $4f
	db "with me today!", $57
; 0x8df3c + 31 bytes

_Route8BattleText3: ; 8df5b (23:5f5b)
	db $0, "You need strategy", $4f
	db "to win at this!", $57
; 0x8df5b + 35 bytes

_Route8EndBattleText3: ; 8df7e (23:5f7e)
	db $0, "It's", $4f
	db "not logical!", $58
; 0x8df7e + 18 bytes

_Route8AfterBattleText3: ; 8df90 (23:5f90)
	db $0, "Go with GRIMER", $4f
	db "first...and...", $55
	db "...and...then...", $57
; 0x8df90 + 48 bytes

_Route8BattleText4: ; 8dfc0 (23:5fc0)
	db $0, "I like NIDORAN, so", $4f
	db "I collect them!", $57
; 0x8dfc0 + 36 bytes

_Route8EndBattleText4: ; 8dfe4 (23:5fe4)
	db $0, "Why? Why??", $58
; 0x8dfe4 + 12 bytes

_Route8AfterBattleText4: ; 8dff0 (23:5ff0)
	db $0, "When #MON grow", $4f
	db "up they get ugly!", $55
	db "They shouldn't", $55
	db "evolve!", $57
; 0x8dff0 + 56 bytes

_Route8BattleText5: ; 8e028 (23:6028)
	db $0, "School is fun, but", $4f
	db "so are #MON.", $57
; 0x8e028 + 33 bytes

_Route8EndBattleText5: ; 8e049 (23:6049)
	db $0, "I'll", $4f
	db "stay with school.", $58
; 0x8e049 + 23 bytes

_Route8AfterBattleText5: ; 8e060 (23:6060)
	db $0, "We're stuck here", $4f
	db "because of the", $55
	db "gates at SAFFRON.", $57
; 0x8e060 + 50 bytes

_Route8BattleText6: ; 8e092 (23:6092)
	db $0, "MEOWTH is so cute,", $4f
	db "meow, meow, meow!", $57
; 0x8e092 + 38 bytes

_Route8EndBattleText6: ; 8e0b8 (23:60b8)
	db $0, "Meow!", $58
; 0x8e0b8 + 7 bytes

_Route8AfterBattleText6: ; 8e0bf (23:60bf)
	db $0, "I think PIDGEY", $4f
	db "and RATTATA", $55
	db "are cute too!", $57
; 0x8e0bf + 42 bytes

_Route8BattleText7: ; 8e0e9 (23:60e9)
	db $0, "We must look", $4f
	db "silly standing", $55
	db "here like this!", $57
; 0x8e0e9 + 45 bytes

_Route8EndBattleText7: ; 8e116 (23:6116)
	db $0, "Look what", $4f
	db "you did!", $58
; 0x8e116 + 20 bytes

_Route8AfterBattleText7: ; 8e12a (23:612a)
	db $0, "SAFFRON's gate", $4f
	db "keeper won't let", $55
	db "us through.", $55
	db "He's so mean!", $57
; 0x8e12a + 56 bytes

_Route8BattleText8: ; 8e162 (23:6162)
	db $0, "I'm a rambling,", $4f
	db "gambling dude!", $57
; 0x8e162 + 31 bytes

_Route8EndBattleText8: ; 8e181 (23:6181)
	db $0, "Missed", $4f
	db "the big score!", $58
; 0x8e181 + 23 bytes

_Route8AfterBattleText8: ; 8e198 (23:6198)
	db $0, "Gambling and", $4f
	db "#MON are like", $55
	db "eating peanuts!", $55
	db "Just can't stop!", $57
; 0x8e198 + 60 bytes

_Route8BattleText9: ; 8e1d4 (23:61d4)
	db $0, "What's a cute,", $4f
	db "round and fluffy", $55
	db "#MON?", $57
; 0x8e1d4 + 38 bytes

_Route8EndBattleText9: ; 8e1fa (23:61fa)
	db $0, "Stop!", $51
	db "Don't be so mean", $4f
	db "to my CLEFAIRY!", $58
; 0x8e1fa + 39 bytes

_Route8AfterBattleText9: ; 8e221 (23:6221)
	db $0, "I heard that", $4f
	db "CLEFAIRY evolves", $55
	db "when it's exposed", $55
	db "to a MOON STONE.", $57
; 0x8e221 + 65 bytes

_Route8Text10: ; 8e262 (23:6262)
	db $0, "UNDERGROUND PATH", $4f
	db "CELADON CITY -", $55
	db "LAVENDER TOWN", $57

_Route9BattleText1: ; 8e291 (23:6291)
	db $0, "You have #MON", $4f
	db "with you!", $55
	db "You're mine!", $57
; 0x8e291 + 37 bytes

_Route9EndBattleText1: ; 8e2b6 (23:62b6)
	db $0, "You", $4f
	db "deceived me!", $58
; 0x8e2b6 + 18 bytes

_Route9AfterBattleText1: ; 8e2c8 (23:62c8)
	db $0, "You need light to", $4f
	db "get through that", $55
	db "dark tunnel ahead.", $57
; 0x8e2c8 + 55 bytes

_Route9BattleText2: ; 8e2ff (23:62ff)
	db $0, "Who's that walking", $4f
	db "with those good", $55
	db "looking #MON?", $57
; 0x8e2ff + 49 bytes

_Route9EndBattleText2: ; 8e330 (23:6330)
	db $0, "Out", $4f
	db "like a light!", $58
; 0x8e330 + 19 bytes

_Route9AfterBattleText2: ; 8e343 (23:6343)
	db $0, "Keep walking!", $57
; 0x8e343 + 15 bytes

_Route9BattleText3: ; 8e352 (23:6352)
	db $0, "I'm taking ROCK", $4f
	db "TUNNEL to go to", $55
	db "LAVENDER...", $57
; 0x8e352 + 44 bytes

_Route9EndBattleText3: ; 8e37e (23:637e)
	db $0, "Can't", $4f
	db "measure up!", $58
; 0x8e37e + 18 bytes

_Route9AfterBattleText3: ; 8e390 (23:6390)
	db $0, "Are you off to", $4f
	db "ROCK TUNNEL too?", $57
; 0x8e390 + 33 bytes

_Route9BattleText4: ; 8e3b1 (23:63b1)
	db $0, "Don't you dare", $4f
	db "condescend me!", $57
; 0x8e3b1 + 30 bytes

_Route9EndBattleText4: ; 8e3cf (23:63cf)
	db $0, "No!", $4f
	db "You're too much!", $58
; 0x8e3cf + 21 bytes

_Route9AfterBattleText4: ; 8e3e4 (23:63e4)
	db $0, "You're obviously", $4f
	db "talented! Good", $55
	db "luck to you!", $57
; 0x8e3e4 + 45 bytes

_Route9BattleText5: ; 8e411 (23:6411)
	db $0, "Bwahaha!", $4f
	db "Great! I was", $55
	db "bored, eh!", $57
; 0x8e411 + 34 bytes

_Route9EndBattleText5: ; 8e433 (23:6433)
	db $0, "Keep it", $4f
	db "coming, eh!", $51
	db "Oh wait. I'm out", $4f
	db "of #MON!", $58
; 0x8e433 + 46 bytes

_Route9AfterBattleText5: ; 8e461 (23:6461)
	db $0, "You sure had guts", $4f
	db "standing up to me", $55
	db "there, eh?", $57
; 0x8e461 + 48 bytes

_Route9BattleText6: ; 8e491 (23:6491)
	db $0, "Hahaha!", $4f
	db "Aren't you a", $55
	db "little toughie!", $57
; 0x8e491 + 37 bytes

_Route9EndBattleText6: ; 8e4b6 (23:64b6)
	db $0, "What's", $4f
	db "that?", $58
; 0x8e4b6 + 13 bytes

_Route9AfterBattleText6: ; 8e4c3 (23:64c3)
	db $0, "Hahaha! Kids", $4f
	db "should be tough!", $57
; 0x8e4c3 + 31 bytes

_Route9BattleText7: ; 8e4e2 (23:64e2)
	db $0, "I got up early", $4f
	db "every day to", $55
	db "raise my #MON", $55
	db "from cocoons!", $57
; 0x8e4e2 + 57 bytes

_Route9EndBattleText7: ; 8e51b (23:651b)
	db $0, "WHAT?", $51
	db "What a total", $4f
	db "waste of time!", $58
; 0x8e51b + 35 bytes

_Route9AfterBattleText7: ; 8e53e (23:653e)
	db $0, "I have to collect", $4f
	db "more than bugs to", $55
	db "get stronger...", $57
; 0x8e53e + 53 bytes

_Route9BattleText8: ; 8e573 (23:6573)
	db $0, "Hahahaha!", $4f
	db "Come on, dude!", $57
; 0x8e573 + 26 bytes

_Route9EndBattleText8: ; 8e58d (23:658d)
	db $0, "Hahahaha!", $4f
	db "You beat me fair!", $58
; 0x8e58d + 29 bytes

_Route9AfterBattleText8: ; 8e5aa (23:65aa)
	db $0, "Hahahaha!", $4f
	db "Us hearty guys", $55
	db "always laugh!", $57
; 0x8e5aa + 40 bytes

_Route9BattleText9: ; 8e5d2 (23:65d2)
	db $0, "Go, my super bug", $4f
	db "#MON!", $57
; 0x8e5d2 + 24 bytes

_Route9EndBattleText9: ; 8e5ea (23:65ea)
	db $0, "My", $4f
	db "bugs...", $58
; 0x8e5ea + 12 bytes

_Route9AfterBattleText9: ; 8e5f6 (23:65f6)
	db $0, "If you don't like", $4f
	db "bug #MON, you", $55
	db "bug me!", $57
; 0x8e5f6 + 40 bytes

_Route9Text11: ; 8e61e (23:661e)
	db $0, "ROUTE 9", $4f
	db "CERULEAN CITY-", $55
	db "ROCK TUNNEL", $57

_Route10BattleText1: ; 8e642 (23:6642)
	db $0, "Wow, are you a", $4f
	db "#MANIAC too?", $55
	db "Want to see my", $55
	db "collection?", $57
; 0x8e642 + 56 bytes

_Route10EndBattleText1: ; 8e67a (23:667a)
	db $0, "Humph.", $4f
	db "I'm not angry!", $58
; 0x8e67a + 22 bytes

_Route10AfterBattleText1: ; 8e690 (23:6690)
	db $0, "I have more rare", $4f
	db "#MON at home!", $57
; 0x8e690 + 32 bytes

_Route10BattleText2: ; 8e6b0 (23:66b0)
	db $0, "Ha-hahah-ah-ha!", $57
; 0x8e6b0 + 17 bytes

_Route10EndBattleText2: ; 8e6c1 (23:66c1)
	db $0, "Ha-haha!", $4f
	db "Not laughing!", $55
	db "Ha-hay fever!", $55
	db "Haha-ha-choo!", $58
; 0x8e6c1 + 52 bytes

_Route10AfterBattleText2: ; 8e6f5 (23:66f5)
	db $0, "Haha-ha-choo!", $4f
	db "Ha-choo!", $55
	db "Snort! Snivel!", $57
; 0x8e6f5 + 39 bytes

_Route10BattleText3: ; 8e71c (23:671c)
	db $0, "Hi kid, want to", $4f
	db "see my #MON?", $57
; 0x8e71c + 30 bytes

_Route10EndBattleText3: ; 8e73a (23:673a)
	db $0, "Oh no!", $4f
	db "My #MON!", $58
; 0x8e73a + 17 bytes

_Route10AfterBattleText3: ; 8e74b (23:674b)
	db $0, "I don't like you", $4f
	db "for beating me!", $57
; 0x8e74b + 33 bytes

_Route10BattleText4: ; 8e76c (23:676c)
	db $0, "I've been to a", $4f
	db "#MON GYM a few", $55
	db "times. But, I", $55
	db "lost each time.", $57
; 0x8e76c + 60 bytes

_Route10EndBattleText4: ; 8e7a8 (23:67a8)
	db $0, "Ohh!", $4f
	db "Blew it again!", $58
; 0x8e7a8 + 21 bytes

_Route10AfterBattleText4: ; 8e7bd (23:67bd)
	db $0, "I noticed some", $4f
	db "#MANIACs", $55
	db "prowling around.", $57
; 0x8e7bd + 42 bytes

_Route10BattleText5: ; 8e7e7 (23:67e7)
	db $0, "Ah! This mountain", $4f
	db "air is delicious!", $57
; 0x8e7e7 + 37 bytes

_Route10EndBattleText5: ; 8e80c (23:680c)
	db $0, "That", $4f
	db "cleared my head!", $58
; 0x8e80c + 23 bytes

_Route10AfterBattleText5: ; 8e823 (23:6823)
	db $0, "I feel bloated on", $4f
	db "mountain air!", $57
; 0x8e823 + 33 bytes

_Route10BattleText6: ; 8e844 (23:6844)
	db $0, "I'm feeling a bit", $4f
	db "faint from this", $55
	db "tough hike.", $57
; 0x8e844 + 46 bytes

_Route10EndBattleText6: ; 8e872 (23:6872)
	db $0, "I'm", $4f
	db "not up to it!", $58
; 0x8e872 + 18 bytes

_Route10AfterBattleText6: ; 8e884 (23:6884)
	db $0, "The #MON here", $4f
	db "are so chunky!", $55
	db "There should be a", $55
	db "pink one with a", $55
	db "floral pattern!", $57
; 0x8e884 + 80 bytes

_Route10Text9: ; 8e8d4 (23:68d4)
_Route10Text7: ; 8e8d4 (23:68d4)
	db $0, "ROCK TUNNEL", $57

_Route10Text10: ; 8e8e1 (23:68e1)
	db $0, "POWER PLANT", $57

_Route11BattleText1: ; 8e8ee (23:68ee)
	db $0, "Win, lose or draw!", $57
; 0x8e8ee + 20 bytes

_Route11EndBattleText1: ; 8e902 (23:6902)
	db $0, "Atcha!", $4f
	db "Didn't go my way!", $58
; 0x8e902 + 25 bytes

_Route11AfterBattleText1: ; 8e91b (23:691b)
	db $0, "#MON is life!", $4f
	db "And to live is to", $55
	db "gamble!", $57
; 0x8e91b + 41 bytes

_Route11BattleText2: ; 8e944 (23:6944)
	db $0, "Competition! I", $4f
	db "can't get enough!", $57
; 0x8e944 + 33 bytes

_Route11EndBattleText2: ; 8e965 (23:6965)
	db $0, "I had", $4f
	db "a chance!", $58
; 0x8e965 + 17 bytes

_Route11AfterBattleText2: ; 8e976 (23:6976)
	db $0, "You can't be a", $4f
	db "coward in the", $55
	db "world of #MON!", $57
; 0x8e976 + 44 bytes

_Route11BattleText3: ; 8e9a2 (23:69a2)
	db $0, "Let's go, but", $4f
	db "don't cheat!", $57
; 0x8e9a2 + 26 bytes

_Route11EndBattleText3: ; 8e9bc (23:69bc)
	db $0, "Huh?", $4f
	db "That's not right!", $58
; 0x8e9bc + 23 bytes

_Route11AfterBattleText3: ; 8e9d3 (23:69d3)
	db $0, "I did my best! I", $4f
	db "have no regrets!", $57
; 0x8e9d3 + 35 bytes

_Route11BattleText4: ; 8e9f6 (23:69f6)
	db $0, "Careful!", $4f
	db "I'm laying down", $55
	db "some cables!", $57
; 0x8e9f6 + 38 bytes

_Route11EndBattleText4: ; 8ea1c (23:6a1c)
	db $0, "That", $4f
	db "was electric!", $58
; 0x8ea1c + 20 bytes

_Route11AfterBattleText4: ; 8ea30 (23:6a30)
	db $0, "Spread the word", $4f
	db "to save energy!", $57
; 0x8ea30 + 33 bytes

_Route11BattleText5: ; 8ea51 (23:6a51)
	db $0, "I just became a", $4f
	db "trainer! But, I", $55
	db "think I can win!", $57
; 0x8ea51 + 50 bytes

_Route11EndBattleText5: ; 8ea83 (23:6a83)
	db $0, "My", $4f
	db "#MON couldn't!", $58
; 0x8ea83 + 18 bytes

_Route11AfterBattleText5: ; 8ea95 (23:6a95)
	db $0, "What do you want?", $4f
	db "Leave me alone!", $57
; 0x8ea95 + 35 bytes

_Route11BattleText6: ; 8eab8 (23:6ab8)
	db $0, "Fwahaha! I have", $4f
	db "never lost!", $57
; 0x8eab8 + 29 bytes

_Route11EndBattleText6: ; 8ead5 (23:6ad5)
	db $0, "My", $4f
	db "first loss!", $58
; 0x8ead5 + 16 bytes

_Route11AfterBattleText6: ; 8eae5 (23:6ae5)
	db $0, "Luck of the draw!", $4f
	db "Just luck!", $57
; 0x8eae5 + 30 bytes

_Route11BattleText7: ; 8eb03 (23:6b03)
	db $0, "I have never won", $4f
	db "before...", $57
; 0x8eb03 + 28 bytes

_Route11EndBattleText7: ; 8eb1f (23:6b1f)
	db $0, "I saw", $4f
	db "this coming...", $58
; 0x8eb1f + 22 bytes

_Route11AfterBattleText7: ; 8eb35 (23:6b35)
	db $0, "It's just luck.", $4f
	db "Luck of the draw.", $57
; 0x8eb35 + 34 bytes

_Route11BattleText8: ; 8eb57 (23:6b57)
	db $0, "I'm the best in", $4f
	db "my class!", $57
; 0x8eb57 + 26 bytes

_Route11EndBattleText8: ; 8eb71 (23:6b71)
	db $0, "Darn!", $4f
	db "I need to make my", $55
	db "#MON stronger!", $58
; 0x8eb71 + 40 bytes

_Route11AfterBattleText8: ; 8eb99 (23:6b99)
	db $0, "There's a fat", $4f
	db "#MON that", $55
	db "comes down from", $55
	db "the mountains.", $51
	db "It's strong if", $4f
	db "you can get it.", $57
; 0x8eb99 + 85 bytes

_Route11BattleText9: ; 8ebee (23:6bee)
	db $0, "Watch out for", $4f
	db "live wires!", $57
; 0x8ebee + 27 bytes

SECTION "bank24",ROMX,BANK[$24]

_Route11EndBattleText9: ; 90000 (24:4000)
	db $0, "Whoa!", $4f
	db "You spark plug!", $58
; 0x90000 + 23 bytes

_Route11AfterBattleText9: ; 90017 (24:4017)
	db $0, "Well, better get", $4f
	db "back to work.", $57
; 0x90017 + 32 bytes

_Route11BattleText10: ; 90037 (24:4037)
	db $0, "My #MON should", $4f
	db "be ready by now!", $57
; 0x90037 + 33 bytes

_Route11EndBattleText10: ; 90058 (24:4058)
	db $0, "Too", $4f
	db "much, too young!", $58
; 0x90058 + 22 bytes

_Route11AfterBattleText10: ; 9006e (24:406e)
	db $0, "I better go find", $4f
	db "stronger ones!", $57
; 0x9006e + 33 bytes

_Route11Text11: ; 9008f (24:408f)
	db $0, "DIGLETT's CAVE", $57

_Route12Text1: ; 9009e (24:409e)
	db $0, "A sleeping #MON", $4f
	db "blocks the way!", $57

_UnnamedText_596eb: ; 900bf (24:40bf)
	db $0, "SNORLAX woke up!", $51
	db "It attacked in a", $4f
	db "grumpy rage!", $57
; 0x900bf + 48 bytes

_UnnamedText_596f0: ; 900ef (24:40ef)
	db $0, "SNORLAX calmed", $4f
	db "down! With a big", $55
	db "yawn, it returned", $55
	db "to the mountains!", $57
; 0x900ef + 69 bytes

_Route12BattleText1: ; 90134 (24:4134)
	db $0, "Yeah! I got a", $4f
	db "bite, here!", $57
; 0x90134 + 27 bytes

_Route12EndBattleText1: ; 9014f (24:414f)
	db $0, "Tch!", $4f
	db "Just a small fry!", $58
; 0x9014f + 24 bytes

_Route12AfterBattleText1: ; 90167 (24:4167)
	db $0, "Hang on! My line's", $4f
	db "snagged!", $57
; 0x90167 + 28 bytes

_Route12BattleText2: ; 90183 (24:4183)
	db $0, "Be patient!", $4f
	db "Fishing is a", $55
	db "waiting game!", $57
; 0x90183 + 40 bytes

_Route12EndBattleText2: ; 901ab (24:41ab)
	db $0, "That", $4f
	db "one got away!", $58
; 0x901ab + 20 bytes

_Route12AfterBattleText2: ; 901bf (24:41bf)
	db $0, "With a better ROD,", $4f
	db "I could catch", $55
	db "better #MON!", $57
; 0x901bf + 47 bytes

_Route12BattleText3: ; 901ee (24:41ee)
	db $0, "Have you found a", $4f
	db "MOON STONE?", $57
; 0x901ee + 30 bytes

_Route12EndBattleText3: ; 9020c (24:420c)
	db $0, "Oww!", $58
; 0x9020c + 6 bytes

_Route12AfterBattleText3: ; 90212 (24:4212)
	db $0, "I could have made", $4f
	db "my #MON evolve", $55
	db "with MOON STONE!", $57
; 0x90212 + 51 bytes

_Route12BattleText4: ; 90245 (24:4245)
	db $0, "Electricity is my", $4f
	db "specialty!", $57
; 0x90245 + 30 bytes

_Route12EndBattleText4: ; 90263 (24:4263)
	db $0, "Unplugged!", $58
; 0x90263 + 12 bytes

_Route12AfterBattleText4: ; 9026f (24:426f)
	db $0, "Water conducts", $4f
	db "electricity, so", $55
	db "you should zap", $55
	db "sea #MON!", $57
; 0x9026f + 57 bytes

_Route12BattleText5: ; 902a8 (24:42a8)
	db $0, "The FISHING FOOL", $4f
	db "vs. #MON KID!", $57
; 0x902a8 + 32 bytes

_Route12EndBattleText5: ; 902c8 (24:42c8)
	db $0, "Too", $4f
	db "much!", $58
; 0x902c8 + 11 bytes

_Route12AfterBattleText5: ; 902d3 (24:42d3)
	db $0, "You beat me at", $4f
	db "#MON, but I'm", $55
	db "good at fishing!", $57
; 0x902d3 + 46 bytes

_Route12BattleText6: ; 90301 (24:4301)
	db $0, "I'd rather be", $4f
	db "working!", $57
; 0x90301 + 23 bytes

_Route12EndBattleText6: ; 90318 (24:4318)
	db $0, "It's", $4f
	db "not easy...", $58
; 0x90318 + 17 bytes

_Route12AfterBattleText6: ; 90329 (24:4329)
	db $0, "It's all right.", $4f
	db "Losing doesn't", $55
	db "bug me any more.", $57
; 0x90329 + 47 bytes

_Route12BattleText7: ; 90358 (24:4358)
	db $0, "You never know", $4f
	db "what you could", $55
	db "catch!", $57
; 0x90358 + 38 bytes

_Route12EndBattleText7: ; 9037e (24:437e)
	db $0, "Lost", $4f
	db "it!", $58
; 0x9037e + 10 bytes

_Route12AfterBattleText7: ; 90388 (24:4388)
	db $0, "I catch MAGIKARP", $4f
	db "all the time, but", $55
	db "they're so weak!", $57
; 0x90388 + 52 bytes

_Route12Text11: ; 903bc (24:43bc)
	db $0, "ROUTE 12 ", $4f
	db "North to LAVENDER", $57

_Route12Text12: ; 903d9 (24:43d9)
	db $0, "SPORT FISHING AREA", $57

_Route13BattleText2: ; 903ed (24:43ed)
	db $0, "My bird #MON", $4f
	db "want to scrap!", $57
; 0x903ed + 29 bytes

_Route13EndBattleText2: ; 9040a (24:440a)
	db $0, "My", $4f
	db "bird combo lost?", $58
; 0x9040a + 21 bytes

_Route13AfterBattleText2: ; 9041f (24:441f)
	db $0, "My #MON look", $4f
	db "happy even though", $55
	db "they lost.", $57
; 0x9041f + 43 bytes

_Route13BattleText3: ; 9044a (24:444a)
	db $0, "I'm told I'm good", $4f
	db "for a kid!", $57
; 0x9044a + 28 bytes

_Route13EndBattleText3: ; 90466 (24:4466)
	db $0, "Ohh!", $4f
	db "I lost!", $58
; 0x90466 + 14 bytes

_Route13AfterBattleText3: ; 90474 (24:4474)
	db $0, "I want to become", $4f
	db "a good trainer.", $55
	db "I'll train hard.", $57
; 0x90474 + 50 bytes

_Route13BattleText4: ; 904a6 (24:44a6)
	db $0, "Wow! Your BADGEs", $4f
	db "are too cool!", $57
; 0x904a6 + 32 bytes

_Route13EndBattleText4: ; 904c6 (24:44c6)
	db $0, "Not", $4f
	db "enough!", $58
; 0x904c6 + 13 bytes

_Route13AfterBattleText4: ; 904d3 (24:44d3)
	db $0, "You got those", $4f
	db "BADGEs from GYM", $55
	db "LEADERs. I know!", $57
; 0x904d3 + 48 bytes

_Route13BattleText5: ; 90503 (24:4503)
	db $0, "My cute #MON", $4f
	db "wish to make your", $55
	db "acquaintance.", $57
; 0x90503 + 46 bytes

_Route13EndBattleText5: ; 90531 (24:4531)
	db $0, "Wow!", $4f
	db "You totally won!", $58
; 0x90531 + 23 bytes

_Route13AfterBattleText5: ; 90548 (24:4548)
	db $0, "You have to make", $4f
	db "#MON fight to", $55
	db "toughen them up!", $57
; 0x90548 + 49 bytes

_Route13BattleText6: ; 90579 (24:4579)
	db $0, "I found CARBOS in", $4f
	db "a cave once.", $57
; 0x90579 + 32 bytes

_Route13EndBattleText6: ; 90599 (24:4599)
	db $0, "Just", $4f
	db "messed up!", $58
; 0x90599 + 17 bytes

_Route13AfterBattleText6: ; 905aa (24:45aa)
	db $0, "CARBOS boosted", $4f
	db "the SPEED of my", $55
	db "#MON.", $57
; 0x905aa + 38 bytes

_Route13BattleText7: ; 905d0 (24:45d0)
	db $0, "The wind's blowing", $4f
	db "my way!", $57
; 0x905d0 + 27 bytes

_Route13EndBattleText7: ; 905eb (24:45eb)
	db $0, "The", $4f
	db "wind turned!", $58
; 0x905eb + 18 bytes

_Route13AfterBattleText7: ; 905fd (24:45fd)
	db $0, "I'm beat. I guess", $4f
	db "I'll FLY home.", $57
; 0x905fd + 32 bytes

_Route13BattleText8: ; 9061d (24:461d)
	db $0, "Sure, I'll play", $4f
	db "with you!", $57
; 0x9061d + 26 bytes

_Route13EndBattleText8: ; 90637 (24:4637)
	db $0, "Oh!", $4f
	db "You little brute!", $58
; 0x90637 + 23 bytes

_Route13AfterBattleText8: ; 9064e (24:464e)
	db $0, "I wonder which is", $4f
	db "stronger, male or", $55
	db "female #MON?", $57
; 0x9064e + 50 bytes

_Route13BattleText9: ; 90680 (24:4680)
	db $0, "Do you want to", $4f
	db "#MON with me?", $57
; 0x90680 + 30 bytes

_Route13EndBattleText9: ; 9069e (24:469e)
	db $0, "It's over", $4f
	db "already?", $58
; 0x9069e + 19 bytes

_Route13AfterBattleText9: ; 906b1 (24:46b1)
	db $0, "I don't know", $4f
	db "anything about", $55
	db "#MON. I just", $55
	db "like cool ones!", $57
; 0x906b1 + 57 bytes

_Route13BattleText10: ; 906ea (24:46ea)
	db $0, "What're you", $4f
	db "lookin' at?", $57
; 0x906ea + 24 bytes

_Route13EndBattleText10: ; 90702 (24:4702)
	db $0, "Dang!", $4f
	db "Stripped gears!", $58
; 0x90702 + 23 bytes

_Route13AfterBattleText10: ; 90719 (24:4719)
	db $0, "Get lost!", $57
; 0x90719 + 11 bytes

_Route13BattleText11: ; 90724 (24:4724)
	db $0, "I always go with", $4f
	db "bird #MON!", $57
; 0x90724 + 29 bytes

_Route13EndBattleText11: ; 90741 (24:4741)
	db $0, "Out", $4f
	db "of power!", $58
; 0x90741 + 15 bytes

_Route13AfterBattleText11: ; 90750 (24:4750)
	db $0, "I wish I could", $4f
	db "fly like PIDGEY", $55
	db "and PIDGEOTTO...", $57
; 0x90750 + 49 bytes

_Route13Text11: ; 90781 (24:4781)
	db $0, "TRAINER TIPS", $51
	db "Look to the left", $4f
	db "of that post!", $57

_Route13Text12: ; 907ae (24:47ae)
	db $0, "TRAINER TIPS", $51
	db "Use SELECT to", $4f
	db "switch items in", $55
	db "the ITEM window!", $57

_Route13Text13: ; 907eb (24:47eb)
	db $0, "ROUTE 13", $4f
	db "North to SILENCE", $55
	db "BRIDGE", $57

_Route14BattleText1: ; 9080d (24:480d)
	db $0, "You need to use", $4f
	db "TMs to teach good", $55
	db "moves to #MON!", $57
; 0x9080d + 50 bytes

_Route14EndBattleText1: ; 9083f (24:483f)
	db $0, "Not", $4f
	db "good enough!", $58
; 0x9083f + 18 bytes

_Route14AfterBattleText1: ; 90851 (24:4851)
	db $0, "You have some HMs", $4f
	db "right? #MON", $55
	db "can't ever forget", $55
	db "those moves.", $57
; 0x90851 + 61 bytes

_Route14BattleText2: ; 9088e (24:488e)
	db $0, "My bird #MON", $4f
	db "should be ready", $55
	db "for battle.", $57
; 0x9088e + 42 bytes

_Route14EndBattleText2: ; 908b8 (24:48b8)
	db $0, "Not", $4f
	db "ready yet!", $58
; 0x908b8 + 16 bytes

_Route14AfterBattleText2: ; 908c8 (24:48c8)
	db $0, "They need to learn", $4f
	db "better moves.", $57
; 0x908c8 + 34 bytes

_Route14BattleText3: ; 908ea (24:48ea)
	db $0, "TMs are on sale", $4f
	db "in CELADON!", $55
	db "But, only a few", $55
	db "people have HMs!", $57
; 0x908ea + 62 bytes

_Route14EndBattleText3: ; 90928 (24:4928)
	db $0, "Aww,", $4f
	db "bummer!", $58
; 0x90928 + 14 bytes

_Route14AfterBattleText3: ; 90936 (24:4936)
	db $0, "Teach #MON", $4f
	db "moves of the same", $55
	db "element type for", $55
	db "more power.", $57
; 0x90936 + 59 bytes

_Route14BattleText4: ; 90971 (24:4971)
	db $0, "Have you taught", $4f
	db "your bird #MON", $55
	db "how to FLY?", $57
; 0x90971 + 44 bytes

_Route14EndBattleText4: ; 9099d (24:499d)
	db $0, "Shot", $4f
	db "down in flames!", $58
; 0x9099d + 22 bytes

_Route14AfterBattleText4: ; 909b3 (24:49b3)
	db $0, "Bird #MON are", $4f
	db "my true love!", $57
; 0x909b3 + 29 bytes

_Route14BattleText5: ; 909d0 (24:49d0)
	db $0, "Have you heard of", $4f
	db "the legendary", $55
	db "#MON?", $57
; 0x909d0 + 39 bytes

_Route14EndBattleText5: ; 909f7 (24:49f7)
	db $0, "Why?", $4f
	db "Why'd I lose?", $58
; 0x909f7 + 19 bytes

_Route14AfterBattleText5: ; 90a0a (24:4a0a)
	db $0, "The 3 legendary", $4f
	db "#MON are all", $55
	db "birds of prey.", $57
; 0x90a0a + 45 bytes

_Route14BattleText6: ; 90a37 (24:4a37)
	db $0, "I'm not into it,", $4f
	db "but OK! Let's go!", $57
; 0x90a37 + 34 bytes

_Route14EndBattleText6: ; 90a59 (24:4a59)
	db $0, "I", $4f
	db "knew it!", $58
; 0x90a59 + 12 bytes

_Route14AfterBattleText6: ; 90a65 (24:4a65)
	db $0, "Winning, losing,", $4f
	db "it doesn't matter", $55
	db "in the long run!", $57
; 0x90a65 + 52 bytes

_Route14BattleText7: ; 90a99 (24:4a99)
	db $0, "C'mon, c'mon.", $4f
	db "Let's go, let's", $55
	db "go, let's go!", $57
; 0x90a99 + 40 bytes

_Route14EndBattleText7: ; 90ac1 (24:4ac1)
	db $0, "Arrg!", $4f
	db "Lost! Get lost!", $58
; 0x90ac1 + 23 bytes

_Route14AfterBattleText7: ; 90ad8 (24:4ad8)
	db $0, "What, what, what?", $4f
	db "What do you want?", $57
; 0x90ad8 + 37 bytes

_Route14BattleText8: ; 90afd (24:4afd)
	db $0, "Perfect! I need to", $4f
	db "burn some time!", $57
; 0x90afd + 36 bytes

_Route14EndBattleText8: ; 90b21 (24:4b21)
	db $0, "What?", $4f
	db "You!?", $58
; 0x90b21 + 13 bytes

_Route14AfterBattleText8: ; 90b2e (24:4b2e)
	db $0, "Raising #MON", $4f
	db "is a drag, man.", $57
; 0x90b2e + 30 bytes

_Route14BattleText9: ; 90b4c (24:4b4c)
	db $0, "We ride out here", $4f
	db "because there's", $55
	db "more room!", $57
; 0x90b4c + 44 bytes

_Route14EndBattleText9: ; 90b78 (24:4b78)
	db $0, "Wipe out!", $58
; 0x90b78 + 11 bytes

_Route14AfterBattleText9: ; 90b83 (24:4b83)
	db $0, "It's cool you", $4f
	db "made your #MON", $55
	db "so strong!", $51
	db "Might is right!", $4f
	db "And you know it!", $57
; 0x90b83 + 73 bytes

_Route14BattleText10: ; 90bcc (24:4bcc)
	db $0, "#MON fight?", $4f
	db "Cool! Rumble!", $57
; 0x90bcc + 27 bytes

_Route14EndBattleText10: ; 90be7 (24:4be7)
	db $0, "Blown", $4f
	db "away!", $58
; 0x90be7 + 13 bytes

_Route14AfterBattleText10: ; 90bf4 (24:4bf4)
	db $0, "You know who'd", $4f
	db "win, you and me", $55
	db "one on one!", $57
; 0x90bf4 + 43 bytes

_Route14Text11: ; 90c1f (24:4c1f)
	db $0, "ROUTE 14", $4f
	db "West to FUCHSIA", $55
	db "CITY", $57

_Route15BattleText1: ; 90c3e (24:4c3e)
	db $0, "Let me try out the", $4f
	db "#MON I just", $55
	db "got in a trade!", $57
; 0x90c3e + 48 bytes

_Route15EndBattleText1: ; 90c6e (24:4c6e)
	db $0, "Not", $4f
	db "good enough!", $58
; 0x90c6e + 18 bytes

_Route15AfterBattleText1: ; 90c80 (24:4c80)
	db $0, "You can't change", $4f
	db "the nickname of", $55
	db "any #MON you", $55
	db "get in a trade.", $51
	db "Only the Original", $4f
	db "Trainer can.", $57
; 0x90c80 + 93 bytes

_Route15BattleText2: ; 90cdd (24:4cdd)
	db $0, "You look gentle,", $4f
	db "so I think I can", $55
	db "beat you!", $57
; 0x90cdd + 45 bytes

_Route15EndBattleText2: ; 90d0a (24:4d0a)
	db $0, "No,", $4f
	db "wrong!", $58
; 0x90d0a + 12 bytes

_Route15AfterBattleText2: ; 90d16 (24:4d16)
	db $0, "I'm afraid of", $4f
	db "BIKERs, they look", $55
	db "so ugly and mean!", $57
; 0x90d16 + 50 bytes

_Route15BattleText3: ; 90d48 (24:4d48)
	db $0, "When I whistle, I", $4f
	db "can summon bird", $55
	db "#MON!", $57
; 0x90d48 + 41 bytes

_Route15EndBattleText3: ; 90d71 (24:4d71)
	db $0, "Ow!", $4f
	db "That's tragic!", $58
; 0x90d71 + 19 bytes

_Route15AfterBattleText3: ; 90d84 (24:4d84)
	db $0, "Maybe I'm not cut", $4f
	db "out for battles.", $57
; 0x90d84 + 35 bytes

_Route15BattleText4: ; 90da7 (24:4da7)
	db $0, "Hmm? My birds are", $4f
	db "shivering! You're", $55
	db "good, aren't you?", $57
; 0x90da7 + 53 bytes

_Route15EndBattleText4: ; 90ddc (24:4ddc)
	db $0, "Just", $4f
	db "as I thought!", $58
; 0x90ddc + 20 bytes

_Route15AfterBattleText4: ; 90df0 (24:4df0)
	db $0, "Did you know moves", $4f
	db "like EARTHQUAKE", $55
	db "don't have any", $55
	db "effect on birds?", $57
; 0x90df0 + 67 bytes

_Route15BattleText5: ; 90e33 (24:4e33)
	db $0, "Oh, you're a", $4f
	db "little cutie!", $57
; 0x90e33 + 27 bytes

_Route15EndBattleText5: ; 90e4e (24:4e4e)
	db $0, "You looked", $4f
	db "so cute too!", $58
; 0x90e4e + 25 bytes

_Route15AfterBattleText5: ; 90e67 (24:4e67)
	db $0, "I forgive you!", $4f
	db "I can take it!", $57
; 0x90e67 + 31 bytes

_Route15BattleText6: ; 90e86 (24:4e86)
	db $0, "I raise #MON", $4f
	db "because I live", $55
	db "alone!", $57
; 0x90e86 + 36 bytes

_Route15EndBattleText6: ; 90eaa (24:4eaa)
	db $0, "I didn't", $4f
	db "ask for this!", $58
; 0x90eaa + 23 bytes

_Route15AfterBattleText6: ; 90ec1 (24:4ec1)
	db $0, "I just like going", $4f
	db "home to be with", $55
	db "my #MON!", $57
; 0x90ec1 + 44 bytes

_Route15BattleText7: ; 90eed (24:4eed)
	db $0, "Hey kid! C'mon!", $4f
	db "I just got these!", $57
; 0x90eed + 34 bytes

_Route15EndBattleText7: ; 90f0f (24:4f0f)
	db $0, "Why", $4f
	db "not?", $58
; 0x90f0f + 10 bytes

_Route15AfterBattleText7: ; 90f19 (24:4f19)
	db $0, "You only live", $4f
	db "once, so I live", $55
	db "as an outlaw!", $55
	db "TEAM ROCKET RULES!", $57
; 0x90f19 + 64 bytes

_Route15BattleText8: ; 90f59 (24:4f59)
	db $0, "Fork over all your", $4f
	db "cash when you", $55
	db "lose to me, kid!", $57
; 0x90f59 + 51 bytes

_Route15EndBattleText8: ; 90f8c (24:4f8c)
	db $0, "That", $4f
	db "can't be true!", $58
; 0x90f8c + 20 bytes

_Route15AfterBattleText8: ; 90fa0 (24:4fa0)
	db $0, "I was just joking", $4f
	db "about the money!", $57
; 0x90fa0 + 36 bytes

_Route15BattleText9: ; 90fc4 (24:4fc4)
	db $0, "What's cool?", $4f
	db "Trading #MON!", $57
; 0x90fc4 + 27 bytes

_Route15EndBattleText9: ; 90fdf (24:4fdf)
	db $0, "I", $4f
	db "said trade!", $58
; 0x90fdf + 15 bytes

_Route15AfterBattleText9: ; 90fee (24:4fee)
	db $0, "I trade #MON", $4f
	db "with my friends!", $57
; 0x90fee + 31 bytes

_Route15BattleText10: ; 9100d (24:500d)
	db $0, "Want to play with", $4f
	db "my #MON?", $57
; 0x9100d + 28 bytes

_Route15EndBattleText10: ; 91029 (24:5029)
	db $0, "I was", $4f
	db "too impatient!", $58
; 0x91029 + 22 bytes

_Route15AfterBattleText10: ; 9103f (24:503f)
	db $0, "I'll go train with", $4f
	db "weaker people.@"
	db $50
; 0x9103f + 34 bytes + 1

_Route15Text12: ; 91062 (24:5062)
	db $0, "ROUTE 15", $4f
	db "West to FUCHSIA", $55
	db "CITY", $57

_Route16BattleText1: ; 91081 (24:5081)
	db $0, "What do you want?", $57
; 0x91081 + 19 bytes

_Route16EndBattleText1: ; 91094 (24:5094)
	db $0, "Don't you", $4f
	db "dare laugh!", $58
; 0x91094 + 22 bytes

_Route16AfterBattleText1: ; 910aa (24:50aa)
	db $0, "We like just", $4f
	db "hanging here,", $55
	db "what's it to you?", $57
; 0x910aa + 45 bytes

_Route16BattleText2: ; 910d7 (24:50d7)
	db $0, "Nice BIKE!", $4f
	db "Hand it over!", $57
; 0x910d7 + 26 bytes

_Route16EndBattleText2: ; 910f1 (24:50f1)
	db $0, "Knock", $4f
	db "out!", $58
; 0x910f1 + 12 bytes

_Route16AfterBattleText2: ; 910fd (24:50fd)
	db $0, "Forget it, who", $4f
	db "needs your BIKE!", $57
; 0x910fd + 33 bytes

_Route16BattleText3: ; 9111e (24:511e)
	db $0, "Come out and play,", $4f
	db "little mouse!", $57
; 0x9111e + 34 bytes

_Route16EndBattleText3: ; 91140 (24:5140)
	db $0, "You", $4f
	db "little rat!", $58
; 0x91140 + 17 bytes

_Route16AfterBattleText3: ; 91151 (24:5151)
	db $0, "I hate losing!", $4f
	db "Get away from me!", $57
; 0x91151 + 34 bytes

_Route16BattleText4: ; 91173 (24:5173)
	db $0, "Hey, you just", $4f
	db "bumped me!", $57
; 0x91173 + 26 bytes

_Route16EndBattleText4: ; 9118d (24:518d)
	db $0, "Kaboom!", $58
; 0x9118d + 9 bytes

_Route16AfterBattleText4: ; 91196 (24:5196)
	db $0, "You can also get", $4f
	db "to FUCHSIA from", $55
	db "VERMILION using a", $55
	db "coastal road.", $57
; 0x91196 + 66 bytes

_Route16BattleText5: ; 911d8 (24:51d8)
	db $0, "I'm feeling", $4f
	db "hungry and mean!", $57
; 0x911d8 + 29 bytes

_Route16EndBattleText5: ; 911f5 (24:51f5)
	db $0, "Bad,", $4f
	db "bad, bad!", $58
; 0x911f5 + 16 bytes

_Route16AfterBattleText5: ; 91205 (24:5205)
	db $0, "I like my #MON", $4f
	db "ferocious! They", $55
	db "tear up enemies!", $57
; 0x91205 + 49 bytes

_Route16BattleText6: ; 91236 (24:5236)
	db $0, "Sure, I'll go!", $57
; 0x91236 + 15 bytes

_Route16EndBattleText6: ; 91245 (24:5245)
	db $0, "Don't make", $4f
	db "me mad!", $58
; 0x91245 + 19 bytes

_Route16AfterBattleText6: ; 91258 (24:5258)
	db $0, "I like harassing", $4f
	db "people with my", $55
	db "vicious #MON!", $57
; 0x91258 + 47 bytes

_Route16Text7: ; 91287 (24:5287)
	db $0, "A sleeping #MON", $4f
	db "blocks the way!", $57

_UnnamedText_59ab3: ; 912a8 (24:52a8)
	db $0, "SNORLAX woke up!", $51
	db "It attacked in a", $4f
	db "grumpy rage!", $57
; 0x912a8 + 48 bytes

_UnnamedText_59ab8: ; 912d8 (24:52d8)
	db $0, "With a big yawn,", $4f
	db "SNORLAX returned", $55
	db "to the mountains!", $57
; 0x912d8 + 53 bytes

_Route16Text8: ; 9130d (24:530d)
	db $0, "Enjoy the slope!", $4f
	db "CYCLING ROAD", $57

_Route16Text9: ; 9132c (24:532c)
	db $0, "ROUTE 16", $4f
	db "CELADON CITY -", $55
	db "FUCHSIA CITY", $57

_Route17BattleText1: ; 91352 (24:5352)
	db $0, "There's no money", $4f
	db "in fighting kids!", $57
; 0x91352 + 35 bytes

_Route17EndBattleText1: ; 91375 (24:5375)
	db $0, "Burned", $4f
	db "out!", $58
; 0x91375 + 13 bytes

_Route17AfterBattleText1: ; 91382 (24:5382)
	db $0, "Good stuff is", $4f
	db "lying around on", $55
	db "CYCLING ROAD!", $57
; 0x91382 + 45 bytes

_Route17BattleText2: ; 913af (24:53af)
	db $0, "What do you want,", $4f
	db "kiddo?", $57
; 0x913af + 26 bytes

_Route17EndBattleText2: ; 913c9 (24:53c9)
	db $0, "Whoo!", $58
; 0x913c9 + 7 bytes

_Route17AfterBattleText2: ; 913d0 (24:53d0)
	db $0, "I could belly-", $4f
	db "bump you outta", $55
	db "here!", $57
; 0x913d0 + 37 bytes

_Route17BattleText3: ; 913f5 (24:53f5)
	db $0, "You heading to", $4f
	db "FUCHSIA?", $57
; 0x913f5 + 25 bytes

_Route17EndBattleText3: ; 9140e (24:540e)
	db $0, "Crash and", $4f
	db "burn!", $58
; 0x9140e + 17 bytes

_Route17AfterBattleText3: ; 9141f (24:541f)
	db $0, "I love racing", $4f
	db "downhill!", $57
; 0x9141f + 25 bytes

_Route17BattleText4: ; 91438 (24:5438)
	db $0, "We're BIKERs!", $4f
	db "Highway stars!", $57
; 0x91438 + 29 bytes

_Route17EndBattleText4: ; 91455 (24:5455)
	db $0, "Smoked!", $58
; 0x91455 + 9 bytes

_Route17AfterBattleText4: ; 9145e (24:545e)
	db $0, "Are you looking", $4f
	db "for adventure?", $57
; 0x9145e + 32 bytes

_Route17BattleText5: ; 9147e (24:547e)
	db $0, "Let VOLTORB", $4f
	db "electrify you!", $57
; 0x9147e + 28 bytes

_Route17EndBattleText5: ; 9149a (24:549a)
	db $0, "Grounded", $4f
	db "out!", $58
; 0x9149a + 15 bytes

_Route17AfterBattleText5: ; 914a9 (24:54a9)
	db $0, "I got my VOLTORB", $4f
	db "at the abandoned", $55
	db "POWER PLANT.", $57
; 0x914a9 + 48 bytes

_Route17BattleText6: ; 914d9 (24:54d9)
	db $0, "My #MON won't", $4f
	db "evolve! Why?", $57
; 0x914d9 + 27 bytes

_Route17EndBattleText6: ; 914f4 (24:54f4)
	db $0, "Why,", $4f
	db "you!", $58
; 0x914f4 + 11 bytes

_Route17AfterBattleText6: ; 914ff (24:54ff)
	db $0, "Maybe some #MON", $4f
	db "need element", $55
	db "STONEs to evolve.", $57
; 0x914ff + 48 bytes

_Route17BattleText7: ; 9152f (24:552f)
	db $0, "I need a little", $4f
	db "exercise!", $57
; 0x9152f + 27 bytes

_Route17EndBattleText7: ; 9154a (24:554a)
	db $0, "Whew!", $4f
	db "Good workout!", $58
; 0x9154a + 21 bytes

_Route17AfterBattleText7: ; 9155f (24:555f)
	db $0, "I'm sure I lost", $4f
	db "weight there!", $57
; 0x9155f + 30 bytes

_Route17BattleText8: ; 9157d (24:557d)
	db $0, "Be a rebel!", $57
; 0x9157d + 13 bytes

_Route17EndBattleText8: ; 9158a (24:558a)
	db $0, "Aaaargh!", $58
; 0x9158a + 10 bytes

_Route17AfterBattleText8: ; 91594 (24:5594)
	db $0, "Be ready to fight", $4f
	db "for your beliefs!", $57
; 0x91594 + 37 bytes

_Route17BattleText9: ; 915b9 (24:55b9)
	db $0, "Nice BIKE!", $4f
	db "How's it handle?", $57
; 0x915b9 + 28 bytes

_Route17EndBattleText9: ; 915d5 (24:55d5)
	db $0, "Shoot!", $58
; 0x915d5 + 8 bytes

_Route17AfterBattleText9: ; 915dd (24:55dd)
	db $0, "The slope makes", $4f
	db "it hard to steer!", $57
; 0x915dd + 35 bytes

_Route17BattleText10: ; 91600 (24:5600)
	db $0, "Get lost kid!", $4f
	db "I'm bushed!", $57
; 0x91600 + 26 bytes

_Route17EndBattleText10: ; 9161a (24:561a)
	db $0, "Are you", $4f
	db "satisfied?", $58
; 0x9161a + 20 bytes

_Route17AfterBattleText10: ; 9162e (24:562e)
	db $0, "I need to catch", $4f
	db "a few Zs!", $57
; 0x9162e + 27 bytes

_Route17Text11: ; 91649 (24:5649)
	db $0, "It's a notice!", $51
	db "Watch out for", $4f
	db "discarded items!", $57

_Route17Text12: ; 91677 (24:5677)
	db $0, "TRAINER TIPS", $51
	db "All #MON are", $4f
	db "unique.", $51
	db "Even #MON of", $4f
	db "the same type and", $55
	db "level grow at", $55
	db "different rates.", $57

_Route17Text13: ; 916d8 (24:56d8)
	db $0, "TRAINER TIPS", $51
	db "Press the A or B", $4f
	db "Button to stay in", $55
	db "place while on a", $55
	db "slope.", $57

_Route17Text14: ; 91721 (24:5721)
	db $0, "ROUTE 17", $4f
	db "CELADON CITY -", $55
	db "FUCHSIA CITY", $57

_Route17Text15: ; 91747 (24:5747)
	db $0, "It's a notice!", $51
	db "Don't throw the", $4f
	db "game, throw #", $55
	db "BALLs instead!", $57

_Route17Text16: ; 91782 (24:5782)
	db $0, "CYCLING ROAD", $4f
	db "Slope ends here!", $57

_Route18BattleText1: ; 917a1 (24:57a1)
	db $0, "I always check", $4f
	db "every grassy area", $55
	db "for new #MON.", $57
; 0x917a1 + 48 bytes

_Route18EndBattleText1: ; 917d1 (24:57d1)
	db $0, "Tch!", $58
; 0x917d1 + 6 bytes

_Route18AfterBattleText1: ; 917d7 (24:57d7)
	db $0, "I wish I had a", $4f
	db "BIKE!", $57
; 0x917d7 + 22 bytes

_Route18BattleText2: ; 917ed (24:57ed)
	db $0, "Kurukkoo!", $4f
	db "How do you like", $55
	db "my bird call?", $57
; 0x917ed + 41 bytes

_Route18EndBattleText2: ; 91816 (24:5816)
	db $0, "I", $4f
	db "had to bug you!", $58
; 0x91816 + 19 bytes

_Route18AfterBattleText2: ; 91829 (24:5829)
	db $0, "I also collect sea", $4f
	db "#MON on", $55
	db "weekends!", $57
; 0x91829 + 38 bytes

_Route18BattleText3: ; 9184f (24:584f)
	db $0, "This is my turf!", $4f
	db "Get out of here!", $57
; 0x9184f + 35 bytes

_Route18EndBattleText3: ; 91872 (24:5872)
	db $0, "Darn!", $58
; 0x91872 + 7 bytes

_Route18AfterBattleText3: ; 91879 (24:5879)
	db $0, "This is my fave", $4f
	db "#MON hunting", $55
	db "area!", $57
; 0x91879 + 36 bytes

_Route18Text4: ; 9189d (24:589d)
	db $0, "ROUTE 18", $4f
	db "CELADON CITY -", $55
	db "FUCHSIA CITY", $57

_Route18Text5: ; 918c3 (24:58c3)
	db $0, "CYCLING ROAD", $4f
	db "No pedestrians", $55
	db "permitted!", $57

_Route19BattleText1: ; 918eb (24:58eb)
	db $0, "Have to warm up", $4f
	db "before my swim!", $57
; 0x918eb + 33 bytes

_Route19EndBattleText1: ; 9190c (24:590c)
	db $0, "All", $4f
	db "warmed up!", $58
; 0x9190c + 16 bytes

_Route19AfterBattleText1: ; 9191c (24:591c)
	db $0, "Thanks, kid! I'm", $4f
	db "ready for a swim!", $57
; 0x9191c + 35 bytes

_Route19BattleText2: ; 9193f (24:593f)
	db $0, "Wait! You'll have", $4f
	db "a heart attack!", $57
; 0x9193f + 34 bytes

_Route19EndBattleText2: ; 91961 (24:5961)
	db $0, "Ooh!", $4f
	db "That's chilly!", $58
; 0x91961 + 20 bytes

_Route19AfterBattleText2: ; 91975 (24:5975)
	db $0, "Watch out for", $4f
	db "TENTACOOL!", $57
; 0x91975 + 26 bytes

_Route19BattleText3: ; 9198f (24:598f)
	db $0, "I love swimming!", $4f
	db "What about you?", $57
; 0x9198f + 34 bytes

_Route19EndBattleText3: ; 919b1 (24:59b1)
	db $0, "Belly", $4f
	db "flop!", $58
; 0x919b1 + 13 bytes

_Route19AfterBattleText3: ; 919be (24:59be)
	db $0, "I can beat #MON", $4f
	db "at swimming!", $57
; 0x919be + 30 bytes

_Route19BattleText4: ; 919dc (24:59dc)
	db $0, "What's beyond the", $4f
	db "horizon?", $57
; 0x919dc + 27 bytes

_Route19EndBattleText4: ; 919f7 (24:59f7)
	db $0, "Glub!", $58
; 0x919f7 + 7 bytes

_Route19AfterBattleText4: ; 919fe (24:59fe)
	db $0, "I see a couple of", $4f
	db "islands!", $57
; 0x919fe + 28 bytes

_Route19BattleText5: ; 91a1a (24:5a1a)
	db $0, "I tried diving", $4f
	db "for #MON, but", $55
	db "it was a no go!", $57
; 0x91a1a + 46 bytes

_Route19EndBattleText5: ; 91a48 (24:5a48)
	db $0, "Help!", $58
; 0x91a48 + 7 bytes

_Route19AfterBattleText5: ; 91a4f (24:5a4f)
	db $0, "You have to fish", $4f
	db "for sea #MON!", $57
; 0x91a4f + 32 bytes

_Route19BattleText6: ; 91a6f (24:5a6f)
	db $0, "I look at the", $4f
	db "sea to forget!", $57
; 0x91a6f + 30 bytes

_Route19EndBattleText6: ; 91a8d (24:5a8d)
	db $0, "Ooh!", $4f
	db "Traumatic!", $58
; 0x91a8d + 17 bytes

_Route19AfterBattleText6: ; 91a9e (24:5a9e)
	db $0, "I'm looking at the", $4f
	db "sea to forget!", $57
; 0x91a9e + 34 bytes

_Route19BattleText7: ; 91ac0 (24:5ac0)
	db $0, "Oh, I just love", $4f
	db "your ride! Can I", $55
	db "have it if I win?", $57
; 0x91ac0 + 52 bytes

_Route19EndBattleText7: ; 91af4 (24:5af4)
	db $0, "Oh!", $4f
	db "I lost!", $58
; 0x91af4 + 13 bytes

_Route19AfterBattleText7: ; 91b01 (24:5b01)
	db $0, "It's still a long", $4f
	db "way to go to", $55
	db "SEAFOAM ISLANDS.", $57
; 0x91b01 + 48 bytes

_Route19BattleText8: ; 91b31 (24:5b31)
	db $0, "Swimming's great!", $4f
	db "Sunburns aren't!", $57
; 0x91b31 + 34 bytes

_Route19EndBattleText8: ; 91b53 (24:5b53)
	db $0, "Shocker!", $58
; 0x91b53 + 10 bytes

_Route19AfterBattleText8: ; 91b5d (24:5b5d)
	db $0, "My boy friend", $4f
	db "wanted to swim to", $55
	db "SEAFOAM ISLANDS.", $57
; 0x91b5d + 50 bytes

_Route19BattleText9: ; 91b8f (24:5b8f)
	db $0, "These waters are", $4f
	db "treacherous!", $57
; 0x91b8f + 31 bytes

_Route19EndBattleText9: ; 91bae (24:5bae)
	db $0, "Ooh!", $4f
	db "Dangerous!", $58
; 0x91bae + 17 bytes

_Route19AfterBattleText9: ; 91bbf (24:5bbf)
	db $0, "I got a cramp!", $4f
	db "Glub, glub...", $57
; 0x91bbf + 30 bytes

_Route19BattleText10: ; 91bdd (24:5bdd)
	db $0, "I swam here, but", $4f
	db "I'm tired.", $57
; 0x91bdd + 28 bytes

_Route19EndBattleText10: ; 91bf9 (24:5bf9)
	db $0, "I'm", $4f
	db "exhausted...", $58
; 0x91bf9 + 17 bytes

_Route19AfterBattleText10: ; 91c0a (24:5c0a)
	db $0, "LAPRAS is so big,", $4f
	db "it must keep you", $55
	db "dry on water.", $57
; 0x91c0a + 50 bytes

_Route19Text11: ; 91c3c (24:5c3c)
	db $0, "SEA ROUTE 19", $4f
	db "FUCHSIA CITY -", $55
	db "SEAFOAM ISLANDS", $57

_Route20BattleText1: ; 91c69 (24:5c69)
	db $0, "The water is", $4f
	db "shallow here.", $57
; 0x91c69 + 28 bytes

_Route20EndBattleText1: ; 91c85 (24:5c85)
	db $0, "Splash!", $58
; 0x91c85 + 9 bytes

_Route20AfterBattleText1: ; 91c8e (24:5c8e)
	db $0, "I wish I could", $4f
	db "ride my #MON.", $57
; 0x91c8e + 30 bytes

_Route20BattleText2: ; 91cac (24:5cac)
	db $0, "SEAFOAM is a", $4f
	db "quiet getaway!", $57
; 0x91cac + 29 bytes

_Route20EndBattleText2: ; 91cc9 (24:5cc9)
	db $0, "Quit it!", $58
; 0x91cc9 + 10 bytes

_Route20AfterBattleText2: ; 91cd3 (24:5cd3)
	db $0, "There's a huge", $4f
	db "cavern underneath", $55
	db "this island.", $57
; 0x91cd3 + 46 bytes

_Route20BattleText3: ; 91d01 (24:5d01)
	db $0, "I love floating", $4f
	db "with the fishes!", $57
; 0x91d01 + 34 bytes

_Route20EndBattleText3: ; 91d23 (24:5d23)
	db $0, "Yowch!", $58
; 0x91d23 + 8 bytes

_Route20AfterBattleText3: ; 91d2b (24:5d2b)
	db $0, "Want to float", $4f
	db "with me?", $57
; 0x91d2b + 24 bytes

_Route20BattleText4: ; 91d43 (24:5d43)
	db $0, "Are you on", $4f
	db "vacation too?", $57
; 0x91d43 + 26 bytes

_Route20EndBattleText4: ; 91d5d (24:5d5d)
	db $0, "No", $4f
	db "mercy at all!", $58
; 0x91d5d + 18 bytes

_Route20AfterBattleText4: ; 91d6f (24:5d6f)
	db $0, "SEAFOAM used to", $4f
	db "be one island!", $57
; 0x91d6f + 32 bytes

_Route20BattleText5: ; 91d8f (24:5d8f)
	db $0, "Check out my buff", $4f
	db "physique!", $57
; 0x91d8f + 29 bytes

_Route20EndBattleText5: ; 91dac (24:5dac)
	db $0, "Wimpy!", $58
; 0x91dac + 8 bytes

_Route20AfterBattleText5: ; 91db4 (24:5db4)
	db $0, "I should've been", $4f
	db "buffing up my", $55
	db "#MON, not me!", $57
; 0x91db4 + 45 bytes

_Route20BattleText6: ; 91de1 (24:5de1)
	db $0, "Why are you", $4f
	db "riding a #MON?", $55
	db "Can't you swim?", $57
; 0x91de1 + 43 bytes

_Route20EndBattleText6: ; 91e0c (24:5e0c)
	db $0, "Ouch!", $4f
	db "Torpedoed!", $58
; 0x91e0c + 18 bytes

_Route20AfterBattleText6: ; 91e1e (24:5e1e)
	db $0, "Riding a #MON", $4f
	db "sure looks fun!", $57
; 0x91e1e + 31 bytes

_Route20BattleText7: ; 91e3d (24:5e3d)
	db $0, "I rode my bird", $4f
	db "#MON here!", $57
; 0x91e3d + 27 bytes

_Route20EndBattleText7: ; 91e58 (24:5e58)
	db $0, "Oh", $4f
	db "no!", $58
; 0x91e58 + 8 bytes

_Route20AfterBattleText7: ; 91e60 (24:5e60)
	db $0, "My birds can't", $4f
	db "FLY me back!", $57
; 0x91e60 + 28 bytes

_Route20BattleText8: ; 91e7c (24:5e7c)
	db $0, "My boy friend gave", $4f
	db "me big pearls!", $57
; 0x91e7c + 35 bytes

_Route20EndBattleText8: ; 91e9f (24:5e9f)
	db $0, "Don't", $4f
	db "touch my pearls!", $58
; 0x91e9f + 23 bytes

_Route20AfterBattleText8: ; 91eb6 (24:5eb6)
	db $0, "Will my pearls", $4f
	db "grow bigger", $55
	db "inside CLOYSTER?", $57
; 0x91eb6 + 45 bytes

_Route20BattleText9: ; 91ee3 (24:5ee3)
	db $0, "I swam here from", $4f
	db "CINNABAR ISLAND!", $57
; 0x91ee3 + 35 bytes

_Route20EndBattleText9: ; 91f06 (24:5f06)
	db $0, "I'm", $4f
	db "so disappointed!", $58
; 0x91f06 + 21 bytes

_Route20AfterBattleText9: ; 91f1b (24:5f1b)
	db $0, "#MON have", $4f
	db "taken over an", $55
	db "abandoned mansion", $55
	db "on CINNABAR!", $57
; 0x91f1b + 56 bytes

_Route20BattleText10: ; 91f53 (24:5f53)
	db $0, "CINNABAR, in the", $4f
	db "west, has a LAB", $55
	db "for #MON.", $57
; 0x91f53 + 44 bytes

_Route20EndBattleText10: ; 91f7f (24:5f7f)
	db $0, "Wait!", $58
; 0x91f7f + 7 bytes

_Route20AfterBattleText10: ; 91f86 (24:5f86)
	db $0, "CINNABAR is a ", $4f
	db "volcanic island!", $57
; 0x91f86 + 33 bytes

_Route20Text12: ; 91fa7 (24:5fa7)
_Route20Text11: ; 91fa7 (24:5fa7)
	db $0, "SEAFOAM ISLANDS", $57

_Route21BattleText1: ; 91fb8 (24:5fb8)
	db $0, "You want to know", $4f
	db "if the fish are", $55
	db "biting?", $57
; 0x91fb8 + 42 bytes

_Route21EndBattleText1: ; 91fe2 (24:5fe2)
	db $0, "Dang!", $58
; 0x91fe2 + 7 bytes

_Route21AfterBattleText1: ; 91fe9 (24:5fe9)
	db $0, "I can't catch", $4f
	db "anything good!", $57
; 0x91fe9 + 29 bytes

_Route21BattleText2: ; 92006 (24:6006)
	db $0, "I got a big haul!", $4f
	db "Wanna go for it?", $57
; 0x92006 + 36 bytes

_Route21EndBattleText2: ; 9202a (24:602a)
	db $0, "Darn", $4f
	db "MAGIKARP!", $58
; 0x9202a + 16 bytes

_Route21AfterBattleText2: ; 9203a (24:603a)
	db $0, "I seem to only", $4f
	db "catch MAGIKARP!", $57
; 0x9203a + 32 bytes

_Route21BattleText3: ; 9205a (24:605a)
	db $0, "The sea cleanses", $4f
	db "my body and soul!", $57
; 0x9205a + 36 bytes

_Route21EndBattleText3: ; 9207e (24:607e)
	db $0, "Ayah!", $58
; 0x9207e + 7 bytes

_Route21AfterBattleText3: ; 92085 (24:6085)
	db $0, "I like the", $4f
	db "mountains too!", $57
; 0x92085 + 27 bytes

_Route21BattleText4: ; 920a0 (24:60a0)
	db $0, "What's wrong with", $4f
	db "me swimming?", $57
; 0x920a0 + 31 bytes

_Route21EndBattleText4: ; 920bf (24:60bf)
	db $0, "Cheap", $4f
	db "shot!", $58
; 0x920bf + 13 bytes

_Route21AfterBattleText4: ; 920cc (24:60cc)
	db $0, "I look like what?", $4f
	db "A studded inner", $55
	db "tube? Get lost!", $57
; 0x920cc + 51 bytes

_Route21BattleText5: ; 920ff (24:60ff)
	db $0, "I caught all my", $4f
	db "#MON at sea!", $57
; 0x920ff + 30 bytes

_Route21EndBattleText5: ; 9211d (24:611d)
	db $0, "Diver!!", $4f
	db "Down!!", $58
; 0x9211d + 16 bytes

_Route21AfterBattleText5: ; 9212d (24:612d)
	db $0, "Where'd you catch", $4f
	db "your #MON?", $57
; 0x9212d + 29 bytes

_Route21BattleText6: ; 9214a (24:614a)
	db $0, "Right now, I'm in", $4f
	db "a triathlon meet!", $57
; 0x9214a + 36 bytes

_Route21EndBattleText6: ; 9216e (24:616e)
	db $0, "Pant...", $4f
	db "pant...pant...", $58
; 0x9216e + 24 bytes

_Route21AfterBattleText6: ; 92186 (24:6186)
	db $0, "I'm beat!", $4f
	db "But, I still have", $55
	db "the bike race and", $55
	db "marathon left!", $57
; 0x92186 + 61 bytes

_Route21BattleText7: ; 921c3 (24:61c3)
	db $0, "Ahh! Feel the sun", $4f
	db "and the wind!", $57
; 0x921c3 + 33 bytes

_Route21EndBattleText7: ; 921e4 (24:61e4)
	db $0, "Yow!", $4f
	db "I lost!", $58
; 0x921e4 + 14 bytes

_Route21AfterBattleText7: ; 921f2 (24:61f2)
	db $0, "I'm sunburnt to a", $4f
	db "crisp!", $57
; 0x921f2 + 25 bytes

_Route21BattleText8: ; 9220b (24:620b)
	db $0, "Hey, don't scare", $4f
	db "away the fish!", $57
; 0x9220b + 32 bytes

_Route21EndBattleText8: ; 9222b (24:622b)
	db $0, "Sorry!", $4f
	db "I didn't mean it!", $58
; 0x9222b + 25 bytes

_Route21AfterBattleText8: ; 92244 (24:6244)
	db $0, "I was just angry", $4f
	db "that I couldn't", $55
	db "catch anything.", $57
; 0x92244 + 49 bytes

_Route21BattleText9: ; 92275 (24:6275)
	db $0, "Keep me company", $4f
	db "'til I get a hit!", $57
; 0x92275 + 34 bytes

_Route21EndBattleText9: ; 92297 (24:6297)
	db $0, "That", $4f
	db "burned some time.", $58
; 0x92297 + 24 bytes

_Route21AfterBattleText9: ; 922af (24:62af)
	db $0, "Oh wait! I got a", $4f
	db "bite! Yeah!", $57
; 0x922af + 30 bytes

_UnnamedText_511ad: ; 922cd (24:62cd)
	db $0, $53, ": Hey!", $4f
	db $52, "!", $51
	db "You're going to", $4f
	db "#MON LEAGUE?", $51
	db "Forget it! You", $4f
	db "probably don't", $55
	db "have any BADGEs!", $51
	db "The guard won't", $4f
	db "let you through!", $51
	db "By the way, did", $4f
	db "your #MON", $55
	db "get any stronger?", $57
; 0x922cd + 162 bytes

_UnnamedText_511b2: ; 9236f (24:636f)
	db $0, "I heard #MON", $4f
	db "LEAGUE has many", $55
	db "tough trainers!", $51
	db "I have to figure", $4f
	db "out how to get", $55
	db "past them!", $51
	db "You should quit", $4f
	db "dawdling and get", $55
	db "a move on!", $57
; 0x9236f + 133 bytes

_UnnamedText_511b7: ; 923f4 (24:63f4)
	db $0, "Awww!", $4f
	db "You just lucked", $55
	db "out!", $58
; 0x923f4 + 28 bytes

_UnnamedText_511bc: ; 92410 (24:6410)
	db $0, $53, ": What?", $4f
	db "Why do I have 2", $55
	db "#MON?", $51
	db "You should catch", $55
	db "some more too!", $58
; 0x92410 + 64 bytes

_UnnamedText_511c1: ; 92450 (24:6450)
	db $0, $53, ": What?", $4f
	db $52, "! What a", $55
	db "surprise to see", $55
	db "you here!", $51
	db "So you're going to", $4f
	db "#MON LEAGUE?", $51
	db "You collected all", $4f
	db "the BADGEs too?", $55
	db "That's cool!", $51
	db "Then I'll whip you", $4f
	db $52, " as a", $55
	db "warm up for", $55
	db "#MON LEAGUE!", $51
	db "Come on!", $57
; 0x92450 + 182 bytes

_UnnamedText_511c6: ; 92506 (24:6506)
	db $0, "That loosened me", $4f
	db "up! I'm ready for", $55
	db "#MON LEAGUE!", $51
	db $52, ", you need", $4f
	db "more practice!", $51
	db "But hey, you know", $4f
	db "that! I'm out of", $55
	db "here. Smell ya!", $57
; 0x92506 + 125 bytes

_UnnamedText_511cb: ; 92583 (24:6583)
	db $0, "What!?", $51
	db "I was just", $4f
	db "careless!", $58
; 0x92583 + 29 bytes

_UnnamedText_511d0: ; 925a0 (24:65a0)
	db $0, $53, ": Hahaha!", $4f
	db $52, "! That's", $55
	db "your best? You're", $55
	db "nowhere near as", $55
	db "good as me, pal!", $51
	db "Go train some", $4f
	db "more! You loser!", $58
; 0x925a0 + 102 bytes

_Route22Text3: ; 92606 (24:6606)
	db $0, "#MON LEAGUE", $4f
	db "Front Gate", $57

UnknownText_9261e: ; 9261e (24:661e)
	db $0, "You can pass here", $4f
	db "only if you have", $55
	db "the @"
; 0x9261e + 41 bytes

UnknownText_92647: ; 92647 (24:6647)
	TX_RAM $cd6d
	db $0, "!", $51
	db "You don't have the", $4f
	db "@"
; 0x92647 + 25 bytes (0x92660)

UnknownText_92660: ; 92660 (24:6660)
	TX_RAM $cd6d
	db $0, " yet!", $51
	db "You have to have", $4f
	db "it to get to", $55
	db "#MON LEAGUE!@@"
; 0x92660 + 54 bytes

UnknownText_92696: ; 92696 (24:6696)
	db $0, "You can pass here", $4f
	db "only if you have", $55
	db "the @"
; 0x92696 + 41 bytes

UnknownText_926bf: ; 926bf (24:66bf)
	TX_RAM $cd6d
	db $0, "!", $51
	db "Oh! That is the", $4f
	db "@"
; 0x926bf + 23 bytes

UnknownText_926d6: ; 926d6 (24:66d6)
	TX_RAM $cd6d
	db $0, "!@@"
; 0x926d6 + 7 bytes

_UnnamedText_513a3: ; 926dd (24:66dd)
	db $0, $51
	db "OK then! Please,", $4f
	db "go right ahead!", $57
; 0x926dd + 35 bytes

_Route23Text8: ; 92700 (24:6700)
	db $0, "VICTORY ROAD GATE", $4f
	db "- #MON LEAGUE", $57

_UnnamedText_51510: ; 92721 (24:6721)
	db $0, "Congratulations!", $4f
	db "You beat our 5", $55
	db "contest trainers!@@"
; 0x92721 + 52 bytes

_UnnamedText_51515: ; 92755 (24:6755)
	db $0, $51
	db "You just earned a", $4f
	db "fabulous prize!", $58
; 0x92755 + 36 bytes

_UnnamedText_5151a: ; 92779 (24:6779)
	db $0, $52, " received", $4f
	db "a @"
; 0x92779 + 15 bytes

UnknownText_92788: ; 92788 (24:6788)
	TX_RAM $cf4b
	db $0, "!@@"
; 0x92788 + 7 bytes

_UnnamedText_51521: ; 9278f (24:678f)
	db $0, "You don't have", $4f
	db "any room!", $57
; 0x9278f + 25 bytes

_UnnamedText_51526: ; 927a8 (24:67a8)
	db $0, "By the way, would", $4f
	db "you like to join", $55
	db "TEAM ROCKET?", $51
	db "We're a group", $4f
	db "dedicated to evil", $55
	db "using #MON!", $51
	db "Want to join?", $51
	db "Are you sure?", $51
	db "Come on, join us!", $51
	db "I'm telling you", $4f
	db "to join!", $51
	db "OK, you need", $4f
	db "convincing!", $51
	db "I'll make you an", $4f
	db "offer you can't", $55
	db "refuse!", $57
; 0x927a8 + 226 bytes

_UnnamedText_5152b: ; 9288a (24:688a)
	db $0, "Arrgh!", $4f
	db "You are good!", $58
; 0x9288a + 22 bytes

_UnnamedText_51530: ; 928a0 (24:68a0)
	db $0, "With your ability,", $4f
	db "you could become", $55
	db "a top leader in", $55
	db "TEAM ROCKET!", $57
; 0x928a0 + 66 bytes

_Route24BattleText1: ; 928e2 (24:68e2)
	db $0, "I saw your feat", $4f
	db "from the grass!", $57
; 0x928e2 + 33 bytes

SECTION "bank25",ROMX,BANK[$25]

_Route24EndBattleText1: ; 94000 (25:4000)
	db $0, "I", $4f
	db "thought not!", $58
; 0x94000 + 16 bytes

_Route24AfterBattleText1: ; 94010 (25:4010)
	db $0, "I hid because the", $4f
	db "people on the", $55
	db "bridge scared me!", $57
; 0x94010 + 51 bytes

_Route24BattleText2: ; 94043 (25:4043)
	db $0, "OK! I'm No. 5!", $4f
	db "I'll stomp you!", $57
; 0x94043 + 30 bytes

_Route24EndBattleText2: ; 94061 (25:4061)
	db $0, "Whoa!", $4f
	db "Too much!", $58
; 0x94061 + 17 bytes

_Route24AfterBattleText2: ; 94072 (25:4072)
	db $0, "I did my best, I", $4f
	db "have no regrets!", $57
; 0x94072 + 35 bytes

_Route24BattleText3: ; 94095 (25:4095)
	db $0, "I'm No. 4!", $4f
	db "Getting tired?", $57
; 0x94095 + 26 bytes

_Route24EndBattleText3: ; 940af (25:40af)
	db $0, "I lost", $4f
	db "too!", $58
; 0x940af + 13 bytes

_Route24AfterBattleText3: ; 940bc (25:40bc)
	db $0, "I did my best, so", $4f
	db "I've no regrets!", $57
; 0x940bc + 35 bytes

_Route24BattleText4: ; 940df (25:40df)
	db $0, "Here's No. 3!", $4f
	db "I won't be easy!", $57
; 0x940df + 30 bytes

_Route24EndBattleText4: ; 940fd (25:40fd)
	db $0, "Ow!", $4f
	db "Stomped flat!", $58
; 0x940fd + 19 bytes

_Route24AfterBattleText4: ; 94110 (25:4110)
	db $0, "I did my best, I", $4f
	db "have no regrets!", $57
; 0x94110 + 35 bytes

_Route24BattleText5: ; 94133 (25:4133)
	db $0, "I'm second!", $4f
	db "Now it's serious!", $57
; 0x94133 + 29 bytes

_Route24EndBattleText5: ; 94150 (25:4150)
	db $0, "How could I", $4f
	db "lose?", $58
; 0x94150 + 19 bytes

_Route24AfterBattleText5: ; 94163 (25:4163)
	db $0, "I did my best, I", $4f
	db "have no regrets!", $57
; 0x94163 + 35 bytes

_Route24BattleText6: ; 94186 (25:4186)
	db $0, "This is NUGGET", $4f
	db "BRIDGE! Beat us 5", $55
	db "trainers and win", $55
	db "a fabulous prize!", $51
	db "Think you got", $4f
	db "what it takes?", $57
; 0x94186 + 98 bytes

_Route24EndBattleText6: ; 941e8 (25:41e8)
	db $0, "Whoo!", $4f
	db "Good stuff!", $58
; 0x941e8 + 19 bytes

_Route24AfterBattleText6: ; 941fb (25:41fb)
	db $0, "I did my best, I", $4f
	db "have no regrets!", $57
; 0x941fb + 35 bytes

_Route25BattleText1: ; 9421e (25:421e)
	db $0, "Local trainers", $4f
	db "come here to", $55
	db "practice!", $57
; 0x9421e + 39 bytes

_Route25EndBattleText1: ; 94245 (25:4245)
	db $0, "You're", $4f
	db "decent.", $58
; 0x94245 + 15 bytes

_Route25AfterBattleText1: ; 94254 (25:4254)
	db $0, "All #MON have", $4f
	db "weaknesses. It's", $55
	db "best to raise", $55
	db "different kinds.", $57
; 0x94254 + 62 bytes

_Route25BattleText2: ; 94292 (25:4292)
	db $0, "Dad took me to a", $4f
	db "great party on", $55
	db "S.S.ANNE at", $55
	db "VERMILION CITY!", $57
; 0x94292 + 61 bytes

_Route25EndBattleText2: ; 942cf (25:42cf)
	db $0, "I'm", $4f
	db "not mad!", $58
; 0x942cf + 13 bytes

_Route25AfterBattleText2: ; 942dc (25:42dc)
	db $0, "On S.S.ANNE, I", $4f
	db "saw trainers from", $55
	db "around the world.", $57
; 0x942dc + 52 bytes

_Route25BattleText3: ; 94310 (25:4310)
	db $0, "I'm a cool guy.", $4f
	db "I've got a girl", $55
	db "friend!", $57
; 0x94310 + 39 bytes

_Route25EndBattleText3: ; 94337 (25:4337)
	db $0, "Aww,", $4f
	db "darn...", $58
; 0x94337 + 14 bytes

_Route25AfterBattleText3: ; 94345 (25:4345)
	db $0, "Oh well. My girl", $4f
	db "will cheer me up.", $57
; 0x94345 + 36 bytes

_Route25BattleText4: ; 94369 (25:4369)
	db $0, "Hi! My boy", $4f
	db "friend is cool!", $57
; 0x94369 + 28 bytes

_Route25EndBattleText4: ; 94385 (25:4385)
	db $0, "I was in", $4f
	db "bad condition!", $58
; 0x94385 + 25 bytes

_Route25AfterBattleText4: ; 9439e (25:439e)
	db $0, "I wish my guy was", $4f
	db "as good as you!", $57
; 0x9439e + 35 bytes

_Route25BattleText5: ; 943c1 (25:43c1)
	db $0, "I knew I had to", $4f
	db "fight you!", $57
; 0x943c1 + 28 bytes

_Route25EndBattleText5: ; 943dd (25:43dd)
	db $0, "I knew", $4f
	db "I'd lose too!", $58
; 0x943dd + 21 bytes

_Route25AfterBattleText5: ; 943f2 (25:43f2)
	db $0, "If your #MON", $4f
	db "gets confused or", $55
	db "falls asleep,", $55
	db "switch it!", $57
; 0x943f2 + 56 bytes

_Route25BattleText6: ; 9442a (25:442a)
	db $0, "My friend has a", $4f
	db "cute #MON.", $55
	db "I'm so jealous!", $57
; 0x9442a + 43 bytes

_Route25EndBattleText6: ; 94455 (25:4455)
	db $0, "I'm", $4f
	db "not so jealous!", $58
; 0x94455 + 20 bytes

_Route25AfterBattleText6: ; 94469 (25:4469)
	db $0, "You came from MT.", $4f
	db "MOON? May I have", $55
	db "a CLEFAIRY?", $57
; 0x94469 + 48 bytes

_Route25BattleText7: ; 94499 (25:4499)
	db $0, "I just got down", $4f
	db "from MT.MOON,", $55
	db "but I'm ready!", $57
; 0x94499 + 45 bytes

_Route25EndBattleText7: ; 944c6 (25:44c6)
	db $0, "You", $4f
	db "worked hard!", $58
; 0x944c6 + 18 bytes

_Route25AfterBattleText7: ; 944d8 (25:44d8)
	db $0, "Drat!", $4f
	db "A ZUBAT bit me", $55
	db "back in there.", $57
; 0x944d8 + 37 bytes

_Route25BattleText8: ; 944fd (25:44fd)
	db $0, "I'm off to see a", $4f
	db "#MON collector", $55
	db "at the cape!", $57
; 0x944fd + 45 bytes

_Route25EndBattleText8: ; 9452a (25:452a)
	db $0, "You", $4f
	db "got me.", $58
; 0x9452a + 13 bytes

_Route25AfterBattleText8: ; 94537 (25:4537)
	db $0, "The collector has", $4f
	db "many rare kinds", $55
	db "of #MON.", $57
; 0x94537 + 44 bytes

_Route25BattleText9: ; 94563 (25:4563)
	db $0, "You're going to", $4f
	db "see BILL? First,", $55
	db "let's fight!", $57
; 0x94563 + 45 bytes

_Route25EndBattleText9: ; 94590 (25:4590)
	db $0, "You're", $4f
	db "something.", $58
; 0x94590 + 18 bytes

_Route25AfterBattleText9: ; 945a2 (25:45a2)
	db $0, "The trail below", $4f
	db "is a shortcut to", $55
	db "CERULEAN CITY.", $57
; 0x945a2 + 49 bytes

_Route25Text11: ; 945d3 (25:45d3)
	db $0, "SEA COTTAGE", $4f
	db "BILL lives here!", $57

_FileDataDestroyedText: ; 945f1 (25:45f1)
	db $0, "The file data is", $4f
	db "destroyed!", $58
; 0x945f1 + 29 bytes

_WouldYouLikeToSaveText: ; 9460e (25:460e)
	db $0, "Would you like to", $4f
	db "SAVE the game?", $57
; 0x9460e + 34 bytes

_GameSavedText: ; 94630 (25:4630)
	db $0, $52, " saved", $4f
	db "the game!", $57
; 0x94630 + 19 bytes

_OlderFileWillBeErasedText: ; 94643 (25:4643)
	db $0, "The older file", $4f
	db "will be erased to", $55
	db "save. Okay?", $57
; 0x94643 + 46 bytes

_UnnamedText_73909: ; 94671 (25:4671)
	db $0, "When you change a", $4f
	db "#MON BOX, data", $55
	db "will be saved.", $51
	db "Is that okay?", $57
; 0x94671 + 63 bytes

_UnnamedText_739d4: ; 946b0 (25:46b0)
	db $0, "Choose a", $4f
	db $4a, " BOX.@@"
; 0x946b0 + 17 bytes

_UnnamedText_3af3e: ; 946c2 (25:46c2)
	TX_RAM $cf4b
	db $0, " evolved", $57
; 0x946c2 + 13 bytes

_UnnamedText_3af43: ; 946cf (25:46cf)
	db $0, $4f
	db "into @"
; 0x946cf + 8 bytes

UnknownText_946d7: ; 946d7 (25:46d7)
	TX_RAM $cd6d
	db $0, "!", $57
; 0x946d7 + 6 bytes

_UnnamedText_3af48: ; 946dd (25:46dd)
	db $0, "Huh? @"
; 0x946dd + 7 bytes

UnknownText_946e4: ; 946e4 (25:46e4)
	TX_RAM $cf4b
	db $0, $4f
	db "stopped evolving!", $58
; 0x946e4 + 23 bytes

_UnnamedText_3af4d: ; 946fb (25:46fb)
	db $0, "What? @"
; 0x946fb + 8 bytes

UnknownText_94703: ; 94703 (25:4703)
	TX_RAM $cf4b
	db $0, $4f
	db "is evolving!", $57
; 0x94703 + 18 bytes

_UnnamedText_3f245: ; 94715 (25:4715)
	db $0, $59, $4f
	db "fell asleep!", $58
; 0x94715 + 16 bytes

_UnnamedText_3f24a: ; 94725 (25:4725)
	db $0, $59, "'s", $4f
	db "already asleep!", $58
; 0x94725 + 20 bytes

_UnnamedText_3f2df: ; 94739 (25:4739)
	db $0, $59, $4f
	db "was poisoned!", $58
; 0x94739 + 17 bytes

_UnnamedText_3f2e4: ; 9474a (25:474a)
	db $0, $59, "'s", $4f
	db "badly poisoned!", $58
; 0x9474a + 20 bytes

_UnnamedText_3f3d8: ; 9475e (25:475e)
	db $0, $59, $4f
	db "was burned!", $58
; 0x9475e + 15 bytes

_UnnamedText_3f3dd: ; 9476d (25:476d)
	db $0, $59, $4f
	db "was frozen solid!", $58
; 0x9476d + 21 bytes

_UnnamedText_3f423: ; 94782 (25:4782)
	db $0, "Fire defrosted", $4f
	db $59, "!", $58
; 0x94782 + 19 bytes

UnknownText_94795: ; 94795 (25:4795)
	db $0, $5a, "'s", $4f
	db "@"
; 0x94795 + 5 bytes

UnknownText_9479a: ; 9479a (25:479a)
	TX_RAM $cf4b
	db $0, "@@"
; 0x9479a + 6 bytes

UnknownText_947a0: ; 947a0 (25:47a0)
	db $0, $4c, "greatly@@"
; 0x947a0 + 11 bytes

_UnnamedText_3f547: ; 947ab (25:47ab)
	db $0, " rose!", $58
; 0x947ab + 8 bytes

UnknownText_947b3: ; 947b3 (25:47b3)
	db $0, $59, "'s", $4f
	db "@"
; 0x947b3 + 5 bytes

UnknownText_947b8: ; 947b8 (25:47b8)
	TX_RAM $cf4b
	db $0, "@@"
; 0x947b8 + 6 bytes

UnknownText_947be: ; 947be (25:47be)
	db $0, $4c, "greatly@@"
; 0x947be + 11 bytes

_UnnamedText_3f683: ; 947c9 (25:47c9)
	db $0, " fell!", $58
; 0x947c9 + 8 bytes

_UnnamedText_3f802: ; 947d1 (25:47d1)
	db $0, $5a, $4f
	db "ran from battle!", $58
; 0x947d1 + 20 bytes

_UnnamedText_3f807: ; 947e5 (25:47e5)
	db $0, $59, $4f
	db "ran away scared!", $58
; 0x947e5 + 20 bytes

_UnnamedText_3f80c: ; 947f9 (25:47f9)
	db $0, $59, $4f
	db "was blown away!", $58
; 0x947f9 + 19 bytes

UnnamedText_9480c: ; 9480c (25:480c)
	db $0, $5a, "@@"
; 0x9480c + 4 bytes

_UnnamedText_3f8f9: ; 94810 (25:4810)
	db $0, $4f
	db "made a whirlwind!", $58
; 0x94810 + 20 bytes

_UnnamedText_3f8fe: ; 94824 (25:4824)
	db $0, $4f
	db "took in sunlight!", $58
; 0x94824 + 20 bytes

_UnnamedText_3f903: ; 94838 (25:4838)
	db $0, $4f
	db "lowered its head!", $58
; 0x94838 + 20 bytes

_UnnamedText_3f908: ; 9484c (25:484c)
	db $0, $4f
	db "is glowing!", $58
; 0x9484c + 14 bytes

_UnnamedText_3f90d: ; 9485a (25:485a)
	db $0, $4f
	db "flew up high!", $58
; 0x9485a + 16 bytes

_UnnamedText_3f912: ; 9486a (25:486a)
	db $0, $4f
	db "dug a hole!", $58
; 0x9486a + 14 bytes

_UnnamedText_3f9a1: ; 94878 (25:4878)
	db $0, $59, $4f
	db "became confused!", $58
; 0x94878 + 20 bytes

_UnnamedText_3fa77: ; 9488c (25:488c)
	db $0, $5a, $4f
	db "learned", $55
	db "@"
; 0x9488c + 12 bytes

UnnamedText_94898: ; 94898 (25:4898)
	TX_RAM $cd6d
	db $0, "!", $58
; 0x94898 + 6 bytes

_UnnamedText_3fb09: ; 9489e (25:489e)
	db $0, $59, "'s", $4f
	db "@"
; 0x9489e + 5 bytes

UnnamedText_948a3: ; 948a3 (25:48a3)
	TX_RAM $cd6d
	db $0, " was", $55
	db "disabled!", $58
; 0x948a3 + 19 bytes

_UnnamedText_3fb3e: ; 948b6 (25:48b6)
	db $0, "Nothing happened!", $58
; 0x948b6 + 19 bytes

_UnnamedText_3fb49: ; 948c9 (25:48c9)
	db $0, "No effect!", $58
; 0x948c9 + 12 bytes

_UnnamedText_3fb59: ; 948d5 (25:48d5)
	db $0, "But, it failed! ", $58
; 0x948d5 + 18 bytes

_UnnamedText_3fb64: ; 948e7 (25:48e7)
	db $0, "It didn't affect", $4f
	db $59, "!", $58
; 0x948e7 + 20 bytes

_UnnamedText_3fb69: ; 948fb (25:48fb)
	db $0, $59, $4f
	db "is unaffected!", $58
; 0x948fb + 18 bytes

_UnnamedText_3fb74: ; 9490d (25:490d)
	db $0, $59, "'s", $4f
	db "paralyzed! It may", $55
	db "not attack!", $58
; 0x9490d + 34 bytes

_UnnamedText_17e1d: ; 9492f (25:492f)
	db $0, "It created a", $4f
	db "SUBSTITUTE!", $58
; 0x9492f + 26 bytes

_UnnamedText_17e22: ; 94949 (25:4949)
	db $0, $5a, $4f
	db "has a SUBSTITUTE!", $58
; 0x94949 + 21 bytes

_UnnamedText_17e27: ; 9495e (25:495e)
	db $0, "Too weak to make", $4f
	db "a SUBSTITUTE!", $58
; 0x9495e + 32 bytes

_UnnamedText_2ff04: ; 9497e (25:497e)
	db $0, "Coins scattered", $4f
	db "everywhere!", $58
; 0x9497e + 29 bytes

_UnnamedText_27fb3: ; 9499b (25:499b)
	db $0, $5a, "'s", $4f
	db "getting pumped!", $58
; 0x9499b + 20 bytes

_UnnamedText_2bef2: ; 949af (25:49af)
	db $0, $59, $4f
	db "was seeded!", $58
; 0x949af + 15 bytes

_UnnamedText_2bef7: ; 949be (25:49be)
	db $0, $59, $4f
	db "evaded attack!", $58
; 0x949be + 18 bytes

_UnnamedText_1399e: ; 949d0 (25:49d0)
	db $0, $5a, "'s", $4f
	db "hit with recoil!", $58
; 0x949d0 + 21 bytes

_UnnamedText_139cd: ; 949e5 (25:49e5)
	db $0, "Converted type to", $4f
	db $59, "'s!", $58
; 0x949e5 + 23 bytes

_UnnamedText_13a53: ; 949fc (25:49fc)
	db $0, "All STATUS changes", $4f
	db "are eliminated!", $58
; 0x949fc + 36 bytes

_UnnamedText_3baa2: ; 94a20 (25:4a20)
	db $0, $5a, $4f
	db "started sleeping!", $57
; 0x94a20 + 21 bytes

_UnnamedText_3baa7: ; 94a35 (25:4a35)
	db $0, $5a, $4f
	db "fell asleep and", $55
	db "became healthy!", $57
; 0x94a35 + 35 bytes

_UnnamedText_3baac: ; 94a58 (25:4a58)
	db $0, $5a, $4f
	db "regained health!", $58
; 0x94a58 + 20 bytes

_UnnamedText_3bb92: ; 94a6c (25:4a6c)
	db $0, $5a, $4f
	db "transformed into", $55
	db "@"
; 0x94a6c + 21 bytes

UnnamedText_94a81: ; 94a81 (25:4a81)
	TX_RAM $cd6d
	db $0, "!", $58
; 0x94a81 + 6 bytes

_UnnamedText_3bbd7: ; 94a87 (25:4a87)
	db $0, $5a, "'s", $4f
	db "protected against", $55
	db "special attacks!", $58
; 0x94a87 + 39 bytes

_UnnamedText_3bbdc: ; 94aae (25:4aae)
	db $0, $5a, $4f
	db "gained armor!", $58
; 0x94aae + 17 bytes

_UnnamedText_33f52: ; 94abf (25:4abf)
	db $0, $5a, "'s", $4f
	db "shrouded in mist!", $58
; 0x94abf + 22 bytes

_UnnamedText_78dc: ; 94ad5 (25:4ad5)
	db $0, "Sucked health from", $4f
	db $59, "!", $58
; 0x94ad5 + 23 bytes

_UnnamedText_78e1: ; 94aec (25:4aec)
	db $0, $59, "'s", $4f
	db "dream was eaten!", $58
; 0x94aec + 21 bytes

_BattleCenterMText1: ; 94b01 (25:4b01)
	db $0, "!", $57

_TradeCenterMText1: ; 94b04 (25:4b04)
	db $0, "!", $57

INCLUDE "text/mapRedsHouse1F.tx"
INCLUDE "text/mapBluesHouse.tx"

_OaksLabGaryText1: ; 94d5b (25:4d5b)
	db $0, $53, ": Yo", $4f
	db $52, "! Gramps", $55
	db "isn't around!", $57
; 0x94d5b + 30 bytes

_OaksLabText40: ; 94d79 (25:4d79)
	db $0, $53, ": Heh, I", $4f
	db "don't need to be", $55
	db "greedy like you!", $51
	db "Go ahead and", $4f
	db "choose, ", $52, "!", $57
; 0x94d79 + 68 bytes

_OaksLabText41: ; 94dbd (25:4dbd)
	db $0, $53, ": My", $4f
	db "#MON looks a", $55
	db "lot stronger.", $57
; 0x94dbd + 34 bytes

_OaksLabText39: ; 94ddf (25:4ddf)
	db $0
	db "Those are #", $4f
	db "BALLs. They", $55
	db "contain #MON!", $57
; 0x94e06

_OaksLabCharmanderText: ; 94e06 (25:4e06)
	db $0, "So! You want the", $4f
	db "fire #MON,", $55
	db "CHARMANDER?", $57
; 0x94e2f

_OaksLabSquirtleText: ; 94e2f (25:4e2f)
	db $0, "So! You want the", $4f
	db "water #MON,", $55
	db "SQUIRTLE?", $57
; 0x94e57

_OaksLabBulbasaurText: ; 94e57 (25:4e57)
	db $0, "So! You want the", $4f
	db "plant #MON,", $55
	db "BULBASAUR?", $57
; 0x94e80

_OaksLabMonEnergeticText: ; 94e80 (25:4e80)
	db $0, "This #MON is", $4f
	db "really energetic!", $58
; 0x94ea0

_OaksLabReceivedMonText: ; 94ea0 (25:4ea0)
	db $0, $52, " received", $4f
	db "a @"
	TX_RAM $cd6d
	db $0, "!@@"
; 0x94eb6

_OaksLabLastMonText: ; 94eb6 (25:4eb6)
	db $0, "That's PROF.OAK's", $4f
	db "last #MON!", $57
; 0x94ed2

_UnnamedText_1d2f0: ; 94ed2 (25:4ed2)
	db $0, "OAK: Now, ", $52, ",", $4f
	db "which #MON do", $55
	db "you want?", $57
; 0x94ef8

_UnnamedText_1d2f5: ; 94ef8 (25:4ef8)
	db $0, "OAK: If a wild", $4f
	db "#MON appears,", $55
	db "your #MON can", $55
	db "fight against it!", $57
; 0x94f36

_UnnamedText_1d2fa: ; 94f36 (25:4f36)
	db $0, "OAK: ", $52, ",", $4f
	db "raise your young", $55
	db "#MON by making", $55
	db "it fight!", $57
; 0x94f36 + 51 bytes

_OaksLabDeliverParcelText1: ; 94f69 (25:4f69)
	db $0, "OAK: Oh, ", $52, "!", $51
	db "How is my old", $4f
	db "#MON?", $51
	db "Well, it seems to", $4f
	db "like you a lot.", $51
	db "You must be", $4f
	db "talented as a", $55
	db "#MON trainer!", $51
	db "What? You have", $4f
	db "something for me?", $51
	db $52, " delivered", $4f
	db "OAK's PARCEL.@@"
; 0x94f69 + 166 bytes

_OaksLabDeliverParcelText2: ; 9500f (25:500f)
	db $0, $51
	db "Ah! This is the", $4f
	db "custom # BALL", $55
	db "I ordered!", $55
	db "Thank you!", $57
; 0x9500f + 54 bytes

_OaksLabAroundWorldText: ; 95045 (25:5045)
	db $0, "#MON around the", $4f
	db "world wait for", $55
	db "you, ", $52, "!", $57
; 0x95045 + 40 bytes

_OaksLabGivePokeballsText1: ; 9506d (25:506d)
	db $0, "OAK: You can't get", $4f
	db "detailed data on", $55
	db "#MON by just", $55
	db "seeing them.", $51
	db "You must catch", $4f
	db "them! Use these", $55
	db "to capture wild", $55
	db "#MON.", $51
	db $52, " got 5", $4f
	db "# BALLs!@@"
; 0x9506d + 133 bytes

_OaksLabGivePokeballsText2: ; 950f2 (25:50f2)
	db $0, $51
	db "When a wild", $4f
	db "#MON appears,", $55
	db "it's fair game.", $51
	db "Just throw a #", $4f
	db "BALL at it and try", $4f
	db "to catch it!", $51
	db "This won't always", $4f
	db "work, though.", $51
	db "A healthy #MON", $4f
	db "could escape. You", $55
	db "have to be lucky!", $57
; 0x950f2 + 172 bytes

_OaksLabPleaseVisitText: ; 9519e (25:519e)
	db $0, "OAK: Come see me", $4f
	db "sometimes.", $51
	db "I want to know how", $4f
	db "your #DEX is", $55
	db "coming along.", $57
; 0x9519e + 75 bytes

_UnnamedText_1d31d: ; 951e9 (25:51e9)
	db $0, "OAK: Good to see ", $4f
	db "you! How is your ", $55
	db "#DEX coming? ", $55
	db "Here, let me take", $55
	db "a look!", $58
; 0x951e9 + 77 bytes

_UnnamedText_1d32c: ; 95236 (25:5236)
	db $0, "It's encyclopedia-", $4f
	db "like, but the", $55
	db "pages are blank!", $57
; 0x95236 + 50 bytes

_OaksLabText8: ; 95268 (25:5268)
	db $0, "?", $57

_UnnamedText_1d340: ; 9526b (25:526b)
	db $0, "PROF.OAK is the", $4f
	db "authority on", $55
	db "#MON!", $51
	db "Many #MON", $4f
	db "trainers hold him", $55
	db "in high regard!", $57
; 0x9526b + 80 bytes

_OaksLabRivalWaitingText: ; 952bb (25:52bb)
	db $0, $53, ": Gramps!", $4f
	db "I'm fed up with", $55
	db "waiting!", $57
; 0x952bb + 36 bytes

_OaksLabChooseMonText: ; 952df (25:52df)
	db $0, "OAK: ", $53, "?", $4f
	db "Let me think...", $51
	db "Oh, that's right,", $4f
	db "I told you to", $55
	db "come! Just wait!", $51
	db "Here, ", $52, "!", $51
	db "There are 3", $4f
	db "#MON here!", $51
	db "Haha!", $51
	db "They are inside", $4f
	db "the # BALLs.", $51
	db "When I was young,", $4f
	db "I was a serious", $55
	db "#MON trainer!", $51
	db "In my old age, I", $4f
	db "have only 3 left,", $55
	db "but you can have", $55
	db "one! Choose!", $57
; 0x952df + 253 bytes

_OaksLabRivalInterjectionText: ; 953dc (25:53dc)
	db $0, $53, ": Hey!", $4f
	db "Gramps! What", $55
	db "about me?", $57
; 0x953dc + 32 bytes

_OaksLabBePatientText: ; 953fc (25:53fc)
	db $0, "OAK: Be patient!", $4f
	db $53, ", you can", $55
	db "have one too!", $57
; 0x953fc + 43 bytes

_OaksLabLeavingText: ; 95427 (25:5427)
	db $0, "OAK: Hey! Don't go", $4f
	db "away yet!", $57
; 0x95427 + 29 bytes

_OaksLabRivalPickingMonText: ; 95444 (25:5444)
	db $0, $53, ": I'll take", $4f
	db "this one, then!", $57
; 0x95444 + 29 bytes

_OaksLabRivalReceivedMonText: ; 95461 (25:5461)
	db $0, $53, " received", $4f
	db "a @"
; 0x95470

UnnamedText_95470: ; 95470 (25:5470)
	TX_RAM $cd6d
	db $0, "!@@"
; 0x95470 + 7 bytes

_OaksLabRivalChallengeText: ; 95477 (25:5477)
	db $0, $53, ": Wait", $4f
	db $52, "!", $55
	db "Let's check out", $55
	db "our #MON!", $51
	db "Come on, I'll take", $4f
	db "you on!", $57
; 0x95477 + 63 bytes

_UnnamedText_1d3be: ; 954b6 (25:54b6)
	db $0, "WHAT?", $4f
	db "Unbelievable!", $55
	db "I picked the", $55
	db "wrong #MON!", $58
; 0x954b6 + 46 bytes

_UnnamedText_1d3c3: ; 954e4 (25:54e4)
	db $0, $53, ": Yeah! Am", $4f
	db "I great or what?", $58
; 0x954e4 + 30 bytes

_OaksLabRivalToughenUpText: ; 95502 (25:5502)
	db $0, $53, ": Okay!", $4f
	db "I'll make my", $55
	db "#MON fight to", $55
	db "toughen it up!", $51
	db $52, "! Gramps!", $4f
	db "Smell you later!", $57
; 0x95502 + 79 bytes

_OaksLabText21: ; 95551 (25:5551)
	db $0, $53, ": Gramps!", $57
; 0x95551 + 12 bytes

_OaksLabText22: ; 9555d (25:555d)
	db $0, $53, ": What did", $4f
	db "you call me for?", $57
; 0x9555d + 30 bytes

_OaksLabText23: ; 9557b (25:557b)
	db $0, "OAK: Oh right! I", $4f
	db "have a request", $55
	db "of you two.", $57
; 0x9557b + 45 bytes

_OaksLabText24: ; 955a8 (25:55a8)
	db $0, "On the desk there", $4f
	db "is my invention,", $55
	db "#DEX!", $51
	db "It automatically", $4f
	db "records data on", $55
	db "#MON you've", $55
	db "seen or caught!", $51
	db "It's a hi-tech", $4f
	db "encyclopedia!", $57
; 0x955a8 + 130 bytes

_OaksLabText25: ; 9562a (25:562a)
	db $0, "OAK: ", $52, " and", $4f
	db $53, "! Take", $55
	db "these with you!", $51
	db $52, " got", $4f
	db "#DEX from OAK!@@"
; 0x9562a + 58 bytes

_OaksLabText26: ; 95664 (25:5664)
	db $0, "To make a complete", $4f
	db "guide on all the", $55
	db "#MON in the", $55
	db "world...", $51
	db "That was my dream!", $51
	db "But, I'm too old!", $4f
	db "I can't do it!", $51
	db "So, I want you two", $4f
	db "to fulfill my", $55
	db "dream for me!", $51
	db "Get moving, you", $4f
	db "two!", $51
	db "This is a great", $4f
	db "undertaking in", $55
	db "#MON history!", $57
; 0x95664 + 221 bytes

_OaksLabText27: ; 95741 (25:5741)
	db $0, $53, ": Alright", $4f
	db "Gramps! Leave it", $55
	db "all to me!", $51
	db $52, ", I hate to", $4f
	db "say it, but I", $55
	db "don't need you!", $51
	db "I know! I'll", $4f
	db "borrow a TOWN MAP", $55
	db "from my sis!", $51
	db "I'll tell her not", $4f
	db "to lend you one,", $55
	db $52, "! Hahaha!", $57
; 0x95741 + 170 bytes

_UnnamedText_1d405: ; 957eb (25:57eb)
	db $0, "I study #MON as", $4f
	db "PROF.OAK's AIDE.", $57
; 0x957eb + 33 bytes

_UnnamedText_441cc: ; 9580c (25:580c)
	db $0, "#DEX comp-", $4f
	db "letion is:", $51
	db "@"
; 0x9580c + 24 bytes

UnnamedText_95824: ; 95824 (25:5824)
	TX_NUM $ffdb, 1, 3
	db $0, " #MON seen", $4f
	db "@"
; 0x95835

UnnamedText_95835: ; 95835 (25:5835)
	TX_NUM $ffdc, 1, 3
	db $0, " #MON owned", $51
	db "PROF.OAK's", $4f
	db "Rating:", $58
; 0x95858

_UnnamedText_44201: ; 95858 (25:5858)
	db $0, "You still have", $4f
	db "lots to do.", $55
	db "Look for #MON", $55
	db "in grassy areas!", $57
; 0x95858 + 59 bytes

_UnnamedText_44206: ; 95893 (25:5893)
	db $0, "You're on the", $4f
	db "right track! ", $55
	db "Get a FLASH HM", $55
	db "from my AIDE!", $57
; 0x95893 + 57 bytes

_UnnamedText_4420b: ; 958cc (25:58cc)
	db $0, "You still need", $4f
	db "more #MON!", $55
	db "Try to catch", $55
	db "other species!", $57
; 0x958cc + 55 bytes

_UnnamedText_44210: ; 95903 (25:5903)
	db $0, "Good, you're", $4f
	db "trying hard!", $55
	db "Get an ITEMFINDER", $55
	db "from my AIDE!", $57
; 0x95903 + 58 bytes

_UnnamedText_44215: ; 9593d (25:593d)
	db $0, "Looking good!", $4f
	db "Go find my AIDE", $55
	db "when you get 50!", $57
; 0x9593d + 48 bytes

_UnnamedText_4421a: ; 9596d (25:596d)
	db $0, "You finally got at", $4f
	db "least 50 species!", $55
	db "Be sure to get", $55
	db "EXP.ALL from my", $55
	db "AIDE!", $57
; 0x9596d + 75 bytes

_UnnamedText_4421f: ; 959b8 (25:59b8)
	db $0, "Ho! This is geting", $4f
	db "even better!", $57
; 0x959b8 + 33 bytes

_UnnamedText_44224: ; 959d9 (25:59d9)
	db $0, "Very good!", $4f
	db "Go fish for some", $55
	db "marine #MON!", $57
; 0x959d9 + 42 bytes

_UnnamedText_44229: ; 95a03 (25:5a03)
	db $0, "Wonderful!", $4f
	db "Do you like to", $55
	db "collect things?", $57
; 0x95a03 + 43 bytes

_UnnamedText_4422e: ; 95a2e (25:5a2e)
	db $0, "I'm impressed!", $4f
	db "It must have been", $55
	db "difficult to do!", $57
; 0x95a2e + 50 bytes

_UnnamedText_44233: ; 95a60 (25:5a60)
	db $0, "You finally got at", $4f
	db "least 100 species!", $55
	db "I can't believe", $55
	db "how good you are!", $57
; 0x95a60 + 72 bytes

_UnnamedText_44238: ; 95aa8 (25:5aa8)
	db $0, "You even have the", $4f
	db "evolved forms of", $55
	db "#MON! Super!", $57
; 0x95aa8 + 49 bytes

_UnnamedText_4423d: ; 95ad9 (25:5ad9)
	db $0, "Excellent! Trade", $4f
	db "with friends to", $55
	db "get some more!", $57
; 0x95ad9 + 49 bytes

_UnnamedText_44242: ; 95b0a (25:5b0a)
	db $0, "Outstanding!", $4f
	db "You've become a", $55
	db "real pro at this!", $57
; 0x95b0a + 47 bytes

_UnnamedText_44247: ; 95b39 (25:5b39)
	db $0, "I have nothing", $4f
	db "left to say!", $55
	db "You're the", $55
	db "authority now!", $57
; 0x95b39 + 54 bytes

_UnnamedText_4424c: ; 95b6f (25:5b6f)
	db $0, "Your #DEX is", $4f
	db "entirely complete!", $55
	db "Congratulations!", $57
; 0x95b6f + 50 bytes

_ViridianPokeCenterText2: ; 95ba1 (25:5ba1)
_ViridianPokeCenterText1: ; 95ba1 (25:5ba1)
	db $0, "You can use that", $4f
	db "PC in the corner.", $51
	db "The receptionist", $4f
	db "told me. So kind!", $57

_ViridianPokeCenterText3: ; 95be8 (25:5be8)
	db $0, "There's a #MON", $4f
	db "CENTER in every", $55
	db "town ahead.", $51
	db "They don't charge", $4f
	db "any money either!", $57

_ViridianMartText1: ; 95c36 (25:5c36)
	db $0, "Okay! Say hi to", $4f
	db "PROF.OAK for me!", $57

_ViridianMartText4: ; 95c58 (25:5c58)
	db $0, "Hey! You came from", $4f
	db "PALLET TOWN?", $57
; 0x95c58 + 33 bytes

ViridianMartParcelQuestText: ; 95c79 (25:5c79)
	db $0, "You know PROF.", $4f
	db "OAK, right?", $51
	db "His order came in.", $4f
	db "Will you take it", $55
	db "to him?", $51
	db $52, " got", $4f
	db "OAK's PARCEL!@@"
; 0x95c79 + 92 bytes

_ViridianMartText2: ; 95cd5 (25:5cd5)
	db $0, "This shop sells", $4f
	db "many ANTIDOTEs.", $57

_ViridianMartText3: ; 95cf6 (25:5cf6)
	db $0, "No! POTIONs are", $4f
	db "all sold out.", $57

_SchoolText1: ; 95d15 (25:5d15)
	db $0, "Whew! I'm trying", $4f
	db "to memorize all", $55
	db "my notes.", $57

_SchoolText2: ; 95d40 (25:5d40)
	db $0, "Okay!", $51
	db "Be sure to read", $4f
	db "the blackboard", $55
	db "carefully!", $57

_ViridianHouseText1: ; 95d71 (25:5d71)
	db $0, "Coming up with", $4f
	db "nicknames is fun,", $55
	db "but hard.", $51
	db "Simple names are", $4f
	db "the easiest to", $55
	db "remember.", $57

_ViridianHouseText2: ; 95dc7 (25:5dc7)
	db $0, "My Daddy loves", $4f
	db "#MON too.", $57

_UnnamedText_1d5b1: ; 95de1 (25:5de1)
	db $0, "SPEARY: Tetweet!", $57
; 0x95de1 + 18 bytes

_ViridianHouseText4: ; 95df3 (25:5df3)
	db $0, "SPEAROW", $4f
	db "Name: SPEARY", $57

_UnnamedText_74ace: ; 95e09 (25:5e09)
	db $0, "Fwahahaha! This is", $4f
	db "my hideout!", $51
	db "I planned to", $4f
	db "resurrect TEAM", $55
	db "ROCKET here!", $51
	db "But, you have", $4f
	db "caught me again!", $55
	db "So be it! This", $55
	db "time, I'm not", $55
	db "holding back!", $51
	db "Once more, you", $4f
	db "shall face", $55
	db "GIOVANNI, the", $55
	db "greatest trainer!", $57
; 0x95e09 + 204 bytes

_UnnamedText_74ad3: ; 95ed5 (25:5ed5)
	db $0, "Ha!", $4f
	db "That was a truly", $55
	db "intense fight!", $55
	db "You have won!", $55
	db "As proof, here is", $55
	db "the EARTHBADGE!@@"
; 0x95ed5 + 85 bytes

_UnnamedText_74ad9: ; 95f2b (25:5f2b)
	db $0, "Having lost, I", $4f
	db "cannot face my", $55
	db "underlings!", $55
	db "TEAM ROCKET is", $55
	db "finished forever!", $51
	db "I will dedicate my", $4f
	db "life to the study", $55
	db "of #MON!", $51
	db "Let us meet again", $4f
	db "some day!", $55
	db "Farewell!@@"
; 0x95f2b + 160 bytes

_ViridianGymText12: ; 95fcc (25:5fcc)
	db $0, "The EARTHBADGE", $4f
	db "makes #MON of", $55
	db "any level obey!", $51
	db "It is evidence of", $4f
	db "your mastery as a", $55
	db "#MON trainer!", $51
	db "With it, you can", $4f
	db "enter the #MON", $55
	db "LEAGUE!", $51
	db "It is my gift for", $4f
	db "your #MON", $55
	db "LEAGUE challenge!", $57
; 0x95fcc + 182 bytes

_ReceivedTM27Text: ; 96082 (25:6082)
	db $0, $52, " received", $4f
	db "TM27!@@"
; 0x96082 + 19 bytes

_TM27ExplanationText: ; 96095 (25:6095)
	db $0, $51
	db "TM27 is FISSURE!", $4f
	db "It will take out", $55
	db "#MON with just", $55
	db "one hit!", $51
	db "I made it when I", $4f
	db "ran the GYM here,", $55
	db "too long ago...", $57
; 0x96095 + 111 bytes

_TM27NoRoomText: ; 96104 (25:6104)
	db $0, "You do not have", $4f
	db "space for this!", $57
; 0x96104 + 33 bytes

_ViridianGymBattleText1: ; 96125 (25:6125)
	db $0, "Heh! You must be", $4f
	db "running out of", $55
	db "steam by now!", $57
; 0x96125 + 47 bytes

_ViridianGymEndBattleText1: ; 96154 (25:6154)
	db $0, "I", $4f
	db "ran out of gas!", $58
; 0x96154 + 19 bytes

_ViridianGymAfterBattleText1: ; 96167 (25:6167)
	db $0, "You need power to", $4f
	db "keep up with our", $55
	db "GYM LEADER!", $57
; 0x96167 + 48 bytes

_ViridianGymBattleText2: ; 96197 (25:6197)
	db $0, "Rrrroar! I'm", $4f
	db "working myself", $55
	db "into a rage!", $57
; 0x96197 + 41 bytes

_ViridianGymEndBattleText2: ; 961c0 (25:61c0)
	db $0, "Wargh!", $58
; 0x961c0 + 8 bytes

_ViridianGymAfterBattleText2: ; 961c8 (25:61c8)
	db $0, "I'm still not", $4f
	db "worthy!", $57
; 0x961c8 + 22 bytes

_ViridianGymBattleText3: ; 961de (25:61de)
	db $0, "#MON and I, we", $4f
	db "make wonderful", $55
	db "music together!", $57
; 0x961de + 47 bytes

_ViridianGymEndBattleText3: ; 9620d (25:620d)
	db $0, "You are in", $4f
	db "perfect harmony!", $58
; 0x9620d + 29 bytes

_ViridianGymAfterBattleText3: ; 9622a (25:622a)
	db $0, "Do you know the", $4f
	db "identity of our", $55
	db "GYM LEADER?", $57
; 0x9622a + 45 bytes

_ViridianGymBattleText4: ; 96257 (25:6257)
	db $0, "Karate is the", $4f
	db "ultimate form of", $55
	db "martial arts!", $57
; 0x96257 + 46 bytes

_ViridianGymEndBattleText4: ; 96285 (25:6285)
	db $0, "Atcho!", $58
; 0x96285 + 8 bytes

_ViridianGymAfterBattleText4: ; 9628d (25:628d)
	db $0, "If my #MON", $4f
	db "were as good at", $55
	db "Karate as I...", $57
; 0x9628d + 43 bytes

_ViridianGymBattleText5: ; 962b8 (25:62b8)
	db $0, "The truly talented", $4f
	db "win with style!", $57
; 0x962b8 + 36 bytes

_ViridianGymEndBattleText5: ; 962dc (25:62dc)
	db $0, "I", $4f
	db "lost my grip!", $58
; 0x962dc + 17 bytes

_ViridianGymAfterBattleText5: ; 962ed (25:62ed)
	db $0, "The LEADER will", $4f
	db "scold me!", $57
; 0x962ed + 27 bytes

_ViridianGymBattleText6: ; 96308 (25:6308)
	db $0, "I'm the KARATE", $4f
	db "KING! Your fate", $55
	db "rests with me!", $57
; 0x96308 + 46 bytes

_ViridianGymEndBattleText6: ; 96336 (25:6336)
	db $0, "Ayah!", $58
; 0x96336 + 7 bytes

_ViridianGymAfterBattleText6: ; 9633d (25:633d)
	db $0, "#MON LEAGUE?", $4f
	db "You? Don't get", $55
	db "cocky!", $57
; 0x9633d + 35 bytes

_ViridianGymBattleText7: ; 96360 (25:6360)
	db $0, "Your #MON will", $4f
	db "cower at the", $55
	db "crack of my whip!", $57
; 0x96360 + 47 bytes

_ViridianGymEndBattleText7: ; 9638f (25:638f)
	db $0, "Yowch!", $4f
	db "Whiplash!", $58
; 0x9638f + 18 bytes

_ViridianGymAfterBattleText7: ; 963a1 (25:63a1)
	db $0, "Wait! I was just", $4f
	db "careless!", $57
; 0x963a1 + 28 bytes

_ViridianGymBattleText8: ; 963bd (25:63bd)
	db $0, "VIRIDIAN GYM was", $4f
	db "closed for a long", $55
	db "time, but now our", $55
	db "LEADER is back!", $57
; 0x963bd + 70 bytes

_ViridianGymEndBattleText8: ; 96403 (25:6403)
	db $0, "I", $4f
	db "was beaten?", $58
; 0x96403 + 15 bytes

_ViridianGymAfterBattleText8: ; 96412 (25:6412)
	db $0, "You can go onto", $4f
	db "#MON LEAGUE", $55
	db "only by defeating", $55
	db "our GYM LEADER!", $57
; 0x96412 + 63 bytes

_UnnamedText_74bd4: ; 96451 (25:6451)
	db $0, "Yo! Champ in", $4f
	db "making!", $51
	db "Even I don't know", $4f
	db "VIRIDIAN LEADER's", $55
	db "identity!", $51
	db "This will be the", $4f
	db "toughest of all", $55
	db "the GYM LEADERs!", $51
	db "I heard that the", $4f
	db "trainers here", $55
	db "like ground-type", $55
	db "#MON!", $57
; 0x96451 + 170 bytes

_UnnamedText_74bd9: ; 964fb (25:64fb)
	db $0, "Blow me away!", $4f
	db "GIOVANNI was the", $55
	db "GYM LEADER here?", $57
; 0x964fb + 49 bytes

_UnnamedText_5c21a: ; 9652c (25:652c)
	db $0, "Come again!", $57
; 0x9652c + 13 bytes

_UnnamedText_5c21f: ; 96539 (25:6539)
	db $0, "It's ¥50 for a", $4f
	db "child's ticket.", $51
	db "Would you like to", $4f
	db "come in?", $57
; 0x96539 + 57 bytes

_UnnamedText_5c224: ; 96572 (25:6572)
	db $0, "Right, ¥50!", $4f
	db "Thank you!", $57
; 0x96572 + 24 bytes

_UnnamedText_5c229: ; 9658a (25:658a)
	db $0, "You don't have", $4f
	db "enough money.", $58
; 0x9658a + 29 bytes

_UnnamedText_5c22e: ; 965a7 (25:65a7)
	db $0, "You can't sneak", $4f
	db "in the back way!", $51
	db "Oh, whatever!", $4f
	db "Do you know what", $55
	db "AMBER is?", $57
; 0x965a7 + 74 bytes

_UnnamedText_5c233: ; 965f1 (25:65f1)
	db $0, "There's a lab", $4f
	db "somewhere trying", $55
	db "to resurrect", $55
	db "ancient #MON", $55
	db "from AMBER.", $57
; 0x965f1 + 69 bytes

_UnnamedText_5c238: ; 96636 (25:6636)
	db $0, "AMBER is fossil-", $4f
	db "ized tree sap.", $57
; 0x96636 + 33 bytes

_UnnamedText_5c23d: ; 96657 (25:6657)
	db $0, "Please go to the", $4f
	db "other side!", $57
; 0x96657 + 30 bytes

_UnnamedText_5c242: ; 96675 (25:6675)
	db $0, "Take plenty of", $4f
	db "time to look!", $57
; 0x96675 + 30 bytes

_UnnamedText_5c251: ; 96693 (25:6693)
	db $0, "That is one", $4f
	db "magnificent", $55
	db "fossil!", $57
; 0x96693 + 33 bytes

_UnnamedText_5c28e: ; 966b4 (25:66b4)
	db $0, "Ssh! I think that", $4f
	db "this chunk of", $55
	db "AMBER contains", $55
	db "#MON DNA!", $51
	db "It would be great", $4f
	db "if #MON could", $55
	db "be resurrected", $55
	db "from it!", $51
	db "But, my colleagues", $4f
	db "just ignore me!", $51
	db "So I have a favor", $4f
	db "to ask!", $51
	db "Take this to a", $4f
	db "#MON LAB and", $55
	db "get it examined!", $58
; 0x966b4 + 220 bytes

_ReceivedOldAmberText: ; 96790 (25:6790)
	db $0, $52, " received", $4f
	db "OLD AMBER!@@"
; 0x96790 + 24 bytes

_UnnamedText_5c299: ; 967a8 (25:67a8)
	db $0, "Ssh! Get the OLD", $4f
	db "AMBER checked!", $57
; 0x967a8 + 33 bytes

_UnnamedText_5c29e: ; 967c9 (25:67c9)
	db $0, "You don't have", $4f
	db "space for this!", $57
; 0x967c9 + 31 bytes

_UnnamedText_5c2ad: ; 967e8 (25:67e8)
	db $0, "We are proud of 2", $4f
	db "fossils of very", $55
	db "rare, prehistoric", $55
	db "#MON!", $57
; 0x967e8 + 59 bytes

_UnnamedText_5c2bc: ; 96823 (25:6823)
	db $0, "The AMBER is", $4f
	db "clear and gold!", $57
; 0x96823 + 30 bytes

_MuseumF2Text1: ; 96841 (25:6841)
	db $0, "MOON STONE?", $51
	db "What's so special", $4f
	db "about it?", $57

_MuseumF2Text2: ; 96869 (25:6869)
	db $0, "July 20, 1969!", $51
	db "The 1st lunar", $4f
	db "landing!", $51
	db "I bought a color", $4f
	db "TV to watch it!", $57

_MuseumF2Text3: ; 968b1 (25:68b1)
	db $0, "We have a space", $4f
	db "exhibit now.", $57

_MuseumF2Text4: ; 968cf (25:68cf)
	db $0, "I want a PIKACHU!", $4f
	db "It's so cute!", $51
	db "I asked my Daddy", $4f
	db "to catch me one!", $57

_MuseumF2Text5: ; 96911 (25:6911)
	db $0, "Yeah, a PIKACHU", $4f
	db "soon, I promise!", $57

_MuseumF2Text6: ; 96933 (25:6933)
	db $0, "SPACE SHUTTLE", $4f
	db "COLUMBIA", $57

_MuseumF2Text7: ; 9694b (25:694b)
	db $0, "Meteorite that", $4f
	db "fell on MT.MOON.", $55
	db "(MOON STONE?)", $57

_UnnamedText_5c49e: ; 9697a (25:697a)
	db $0, "I'm BROCK!", $4f
	db "I'm PEWTER's GYM", $55
	db "LEADER!", $51
	db "I believe in rock", $4f
	db "hard defense and", $55
	db "determination!", $51
	db "That's why my", $4f
	db "#MON are all", $55
	db "the rock-type!", $51
	db "Do you still want", $4f
	db "to challenge me?", $55
	db "Fine then! Show", $55
	db "me your best!", $57
; 0x9697a + 190 bytes

SECTION "bank26",ROMX,BANK[$26]

_UnnamedText_5c4a3: ; 98000 (26:4000)
	db $0, "There are all", $4f
	db "kinds of trainers", $55
	db "in the world!", $51
	db "You appear to be", $4f
	db "very gifted as a", $55
	db "#MON trainer!", $51
	db "Go to the GYM in", $4f
	db "CERULEAN and test", $55
	db "your abilities!", $57
; 0x98000 + 146 bytes

_TM34PreReceiveText: ; 98092 (26:4092)
	db $0, "Wait! Take this", $4f
	db "with you!", $57
; 0x98092 + 27 bytes

_ReceivedTM34Text: ; 980ad (26:40ad)
	db $0, $52, " received", $4f
	db "TM34!@@"
; 0x980c0

_TM34ExplanationText: ; 980c0 (26:40c0)
	db $0, $51
	db "A TM contains a", $4f
	db "technique that", $55
	db "can be taught to", $55
	db "#MON!", $51
	db "A TM is good only", $4f
	db "once! So when you", $55
	db "use one to teach", $55
	db "a new technique,", $55
	db "pick the #MON", $55
	db "carefully!", $51
	db "TM34 contains", $4f
	db "BIDE!", $51
	db "Your #MON will", $4f
	db "absorb damage in", $55
	db "battle then pay", $55
	db "it back double!", $57
; 0x980c0 + 235 bytes

_TM34NoRoomText: ; 981ab (26:41ab)
	db $0, "You don't have", $4f
	db "room for this!", $57
; 0x981ab + 30 bytes

_UnnamedText_5c4bc: ; 981c9 (26:41c9)
	db $0, "I took", $4f
	db "you for granted.", $51
	db "As proof of your", $4f
	db "victory, here's", $55
	db "the BOULDERBADGE!", $51
	db $52, " received", $4f
	db "the BOULDERBADGE!@@"
; 0x98232

_UnnamedText_5c4c1: ; 98232 (26:4232)
	db $0, $51
	db "That's an official", $4f
	db "#MON LEAGUE", $55
	db "BADGE!", $51
	db "Its bearer's", $4f
	db "#MON become", $55
	db "more powerful!", $51
	db "The technique", $4f
	db "FLASH can now be", $55
	db "used any time!", $58
; 0x98232 + 124 bytes

_PewterGymBattleText1: ; 982ae (26:42ae)
	db $0, "Stop right there,", $4f
	db "kid!", $51
	db "You're still light", $4f
	db "years from facing", $55
	db "BROCK!", $57
; 0x982ae + 67 bytes

_PewterGymEndBattleText1: ; 982f1 (26:42f1)
	db $0, "Darn!", $51
	db "Light years isn't", $4f
	db "time! It measures", $55
	db "distance!", $58
; 0x982f1 + 52 bytes

_PewterGymAfterBattleText1: ; 98325 (26:4325)
	db $0, "You're pretty hot,", $4f
	db "but not as hot", $55
	db "as BROCK!", $57
; 0x98325 + 44 bytes

_UnnamedText_5c515: ; 98351 (26:4351)
	db $0, "Hiya! I can tell", $4f
	db "you have what it", $55
	db "takes to become a", $55
	db "#MON champ!", $51
	db "I'm no trainer,", $4f
	db "but I can tell", $55
	db "you how to win!", $51
	db "Let me take you", $4f
	db "to the top!", $57
; 0x98351 + 139 bytes

_UnnamedText_5c51a: ; 983dc (26:43dc)
	db $0, "All right! Let's", $4f
	db "get happening!", $58
; 0x983dc + 32 bytes

_UnnamedText_5c51f: ; 983fc (26:43fc)
	db $0, "The 1st #MON", $4f
	db "out in a match is", $55
	db "at the top of the", $55
	db "#MON LIST!", $51
	db "By changing the", $4f
	db "order of #MON,", $55
	db "matches could be", $55
	db "made easier!", $57
; 0x983fc + 122 bytes

_UnnamedText_5c524: ; 98476 (26:4476)
	db $0, "It's a free", $4f
	db "service! Let's", $55
	db "get happening!", $58
; 0x98476 + 41 bytes

_UnnamedText_5c529: ; 9849f (26:449f)
	db $0, "Just as I thought!", $4f
	db "You're #MON", $55
	db "champ material!", $57
; 0x9849f + 47 bytes

_PewterHouse1Text1: ; 984ce (26:44ce)
	db $0, "NIDORAN: Bowbow!@@"

_PewterHouse1Text2: ; 984e1 (26:44e1)
	db $0, "NIDORAN sit!", $57

_PewterHouse1Text3: ; 984ef (26:44ef)
	db $0, "Our #MON's an", $4f
	db "outsider, so it's", $55
	db "hard to handle.", $51
	db "An outsider is a", $4f
	db "#MON that you", $55
	db "get in a trade.", $51
	db "It grows fast, but", $4f
	db "it may ignore an", $55
	db "unskilled trainer", $55
	db "in battle!", $51
	db "If only we had", $4f
	db "some BADGEs...", $57

_UnnamedText_74cc6: ; 985ac (26:45ac)
	db $0, "A shady, old man", $4f
	db "got me to buy", $55
	db "this really weird", $55
	db "fish #MON!", $51
	db "It's totally weak", $4f
	db "and it cost ¥500!", $57
; 0x985ac + 96 bytes

_UnnamedText_74cd5: ; 9860c (26:460c)
	db $0, "Good things can", $4f
	db "happen if you", $55
	db "raise #MON", $55
	db "diligently, even", $55
	db "the weak ones!", $57
; 0x9860c + 74 bytes

_PewterHouse2Text1: ; 98656 (26:4656)
	db $0, "#MON learn new", $4f
	db "techniques as", $55
	db "they grow!", $51
	db "But, some moves", $4f
	db "must be taught by", $55
	db "the trainer!", $57

_PewterHouse2Text2: ; 986ae (26:46ae)
	db $0, "#MON become", $4f
	db "easier to catch", $55
	db "when they are", $55
	db "hurt or asleep!", $51
	db "But, it's not a", $4f
	db "sure thing!", $57

_PewterPokecenterText1: ; 98704 (26:4704)
	db $0, "What!?", $51
	db "TEAM ROCKET is", $4f
	db "at MT.MOON? Huh?", $55
	db "I'm on the phone!", $51
	db "Scram!", $57

_PewterPokecenterText5: ; 98744 (26:4744)
	db $0, "JIGGLYPUFF: Puu", $4f
	db "pupuu!", $57
; 0x9875c

_UnnamedText_1d6ab: ; 9875c (26:475c)
	db $0, "Those miserable", $4f
	db "ROCKETs!", $51
	db "Look what they", $4f
	db "did here!", $51
	db "They stole a TM", $4f
	db "for teaching", $55
	db "#MON how to", $55
	db "DIG holes!", $51
	db "That cost me a", $4f
	db "bundle, it did!", $57
; 0x9875c + 134 bytes

_UnnamedText_1d6b0: ; 987e2 (26:47e2)
	db $0, "I figure what's", $4f
	db "lost is lost!", $51
	db "I decided to teach", $4f
	db "DIGLETT how to", $55
	db "DIG without a TM!", $57
; 0x987e2 + 82 bytes

_CeruleanHouseTrashedText2: ; 98834 (26:4834)
	db $0, "TEAM ROCKET must", $4f
	db "be trying to DIG", $55
	db "their way into no", $55
	db "good!", $57

_CeruleanHouseTrashedText3: ; 9886f (26:486f)
	db $0, "TEAM ROCKET left", $4f
	db "a way out!", $57

_CeruleanHouse2Text1: ; 9888c (26:488c)
	db $0, "My husband likes", $4f
	db "trading #MON.", $51
	db "If you are a", $4f
	db "collector, would", $55
	db "you please trade", $55
	db "with him?", $57

_CeruleanPokecenterText1: ; 988e5 (26:48e5)
	db $0, "That BILL!", $51
	db "I heard that", $4f
	db "he'll do whatever", $55
	db "it takes to get", $55
	db "rare #MON!", $57

_CeruleanPokecenterText3: ; 9892a (26:492a)
	db $0, "Have you heard", $4f
	db "about BILL?", $51
	db "Everyone calls", $4f
	db "him a #MANIAC!", $51
	db "I think people", $4f
	db "are just jealous", $55
	db "of BILL, though.", $51
	db "Who wouldn't want", $4f
	db "to boast about", $55
	db "their #MON?", $57

_UnnamedText_5c7be: ; 989c1 (26:49c1)
	db $0, "Hi, you're a new", $4f
	db "face!", $51
	db "Trainers who want", $4f
	db "to turn pro have", $55
	db "to have a policy", $55
	db "about #MON!", $51
	db "What is your", $4f
	db "approach when you", $55
	db "catch #MON?", $51
	db "My policy is an", $4f
	db "all-out offensive", $55
	db "with water-type", $55
	db "#MON!", $57
; 0x989c1 + 186 bytes

_UnnamedText_5c7c3: ; 98a7b (26:4a7b)
	db $0, "TM11 teaches", $4f
	db "BUBBLEBEAM!", $51
	db "Use it on an", $4f
	db "aquatic #MON!", $57
; 0x98a7b + 53 bytes

_UnnamedText_5c7c8: ; 98ab0 (26:4ab0)
	db $0, "The CASCADEBADGE", $4f
	db "makes all #MON", $55
	db "up to L30 obey!", $51
	db "That includes", $4f
	db "even outsiders!", $51
	db "There's more, you", $4f
	db "can now use CUT", $55
	db "any time!", $51
	db "You can CUT down", $4f
	db "small bushes to", $55
	db "open new paths!", $51
	db "You can also have", $4f
	db "my favorite TM!", $57
; 0x98ab0 + 205 bytes

_ReceivedTM11Text: ; 98b7d (26:4b7d)
	db $0, $52, " received", $4f
	db "TM11!@@"
; 0x98b90

_UnnamedText_5c7d3: ; 98b90 (26:4b90)
	db $0, "You better make", $4f
	db "room for this!", $57
; 0x98b90 + 32 bytes

_UnnamedText_5c7d8: ; 98bb0 (26:4bb0)
	db $0, "Wow!", $4f
	db "You're too much!", $51
	db "All right!", $51
	db "You can have the", $4f
	db "CASCADEBADGE to", $55
	db "show you beat me!@@"
; 0x98c05

_CeruleanGymBattleText1: ; 98c05 (26:4c05)
	db $0, "I'm more than good", $4f
	db "enough for you!", $51
	db "MISTY can wait!", $57
; 0x98c05 + 51 bytes

_CeruleanGymEndBattleText1: ; 98c38 (26:4c38)
	db $0, "You", $4f
	db "overwhelmed me!", $58
; 0x98c38 + 21 bytes

_CeruleanGymAfterBattleText1: ; 98c4d (26:4c4d)
	db $0, "You have to face", $4f
	db "other trainers to", $55
	db "find out how good", $55
	db "you really are.", $57
; 0x98c4d + 70 bytes

_CeruleanGymBattleText2: ; 98c93 (26:4c93)
	db $0, "Splash!", $51
	db "I'm first up!", $4f
	db "Let's do it!", $57
; 0x98c93 + 34 bytes

_CeruleanGymEndBattleText2: ; 98cb5 (26:4cb5)
	db $0, "That", $4f
	db "can't be!", $58
; 0x98cb5 + 15 bytes

_CeruleanGymAfterBattleText2: ; 98cc4 (26:4cc4)
	db $0, "MISTY is going to", $4f
	db "keep improving!", $51
	db "She won't lose to", $4f
	db "someone like you!", $57
; 0x98cc4 + 70 bytes

_UnnamedText_5c82a: ; 98d0a (26:4d0a)
	db $0, "Yo! Champ in", $4f
	db "making!", $51
	db "Here's my advice!", $51
	db "The LEADER, MISTY,", $4f
	db "is a pro who uses", $55
	db "water #MON!", $51
	db "You can drain all", $4f
	db "their water with", $55
	db "plant #MON!", $51
	db "Or, zap them with", $4f
	db "electricity!", $57
; 0x98d0a + 166 bytes

_UnnamedText_5c82f: ; 98db0 (26:4db0)
	db $0, "You beat MISTY!", $4f
	db "What'd I tell ya?", $51
	db "You and me kid,", $4f
	db "we make a pretty", $55
	db "darn good team!", $57
; 0x98db0 + 83 bytes

_UnnamedText_1d810: ; 98e03 (26:4e03)
	db $0, "Hi! Welcome to", $4f
	db "our BIKE SHOP.", $51
	db "Have we got just", $4f
	db "the BIKE for you!", $58
; 0x98e03 + 66 bytes

_UnnamedText_1d815: ; 98e45 (26:4e45)
	db $0, "It's a cool BIKE!", $4f
	db "Do you want it?", $57
; 0x98e45 + 34 bytes

_UnnamedText_1d81a: ; 98e67 (26:4e67)
	db $0, "Sorry! You can't", $4f
	db "afford it!", $58
; 0x98e67 + 28 bytes

_UnnamedText_1d81f: ; 98e83 (26:4e83)
	db $0, "Oh, that's...", $51
	db "A BIKE VOUCHER!", $51
	db "OK! Here you go!", $58
; 0x98e83 + 47 bytes

_UnnamedText_1d824: ; 98eb2 (26:4eb2)
	db $0, $52, " exchanged", $4f
	db "the BIKE VOUCHER", $55
	db "for a BICYCLE.@@"
; 0x98ee0

_UnnamedText_1d82a: ; 98ee0 (26:4ee0)
	db $0, "Come back again", $4f
	db "some time!", $57
; 0x98ee0 + 28 bytes

_UnnamedText_1d82f: ; 98efc (26:4efc)
	db $0, "How do you like", $4f
	db "your new BICYCLE?", $51
	db "You can take it", $4f
	db "on CYCLING ROAD", $55
	db "and in caves!", $57
; 0x98efc + 81 bytes

_UnnamedText_1d834: ; 98f4d (26:4f4d)
	db $0, "You better make", $4f
	db "room for this!", $57
; 0x98f4d + 32 bytes

_UnnamedText_1d843: ; 98f6d (26:4f6d)
	db $0, "A plain city BIKE", $4f
	db "is good enough", $55
	db "for me!", $51
	db "You can't put a", $4f
	db "shopping basket", $55
	db "on an MTB!", $57
; 0x98f6d + 84 bytes

_UnnamedText_1d85c: ; 98fc1 (26:4fc1)
	db $0, "These BIKEs are", $4f
	db "cool, but they're", $55
	db "way expensive!", $57
; 0x98fc1 + 49 bytes

_UnnamedText_1d861: ; 98ff2 (26:4ff2)
	db $0, "Wow. Your BIKE is", $4f
	db "really cool!", $57
; 0x98ff2 + 32 bytes

_CeruleanMartText2: ; 99012 (26:5012)
	db $0, "Use REPEL to keep", $4f
	db "bugs and weak", $55
	db "#MON away.", $51
	db "Put your strongest", $4f
	db "#MON at the", $55
	db "top of the list", $55
	db "for best results!", $57

_CeruleanMartText3: ; 9907f (26:507f)
	db $0, "Have you seen any", $4f
	db "RARE CANDY?", $51
	db "It's supposed to", $4f
	db "make #MON go", $55
	db "up one level!", $57

_UnnamedText_74e77: ; 990c9 (26:50c9)
	db $0, "#MON BADGEs", $4f
	db "are owned only by", $55
	db "skilled trainers.", $51
	db "I see you have", $4f
	db "at least one.", $51
	db "Those BADGEs have", $4f
	db "amazing secrets!", $58
; 0x990c9 + 113 bytes

_UnnamedText_74e7c: ; 9913a (26:513a)
	db $0, "Now then...", $51
	db "Which of the 8", $4f
	db "BADGEs should I", $55
	db "describe?", $57
; 0x9913a + 54 bytes

_UnnamedText_74e81: ; 99170 (26:5170)
	db $0, "Come visit me any", $4f
	db "time you wish.", $57
; 0x99170 + 34 bytes

_UnnamedText_74e96: ; 99192 (26:5192)
	db $0, "The ATTACK of all", $4f
	db "#MON increases", $55
	db "a little bit.", $51
	db "It also lets you", $4f
	db "use FLASH any", $55
	db "time you desire.", $58
; 0x99192 + 96 bytes

_UnnamedText_74e9b: ; 991f2 (26:51f2)
	db $0, "#MON up to L30", $4f
	db "will obey you.", $51
	db "Any higher, they", $4f
	db "become unruly!", $51
	db "It also lets you", $4f
	db "use CUT outside", $55
	db "of battle.", $58
; 0x991f2 + 107 bytes

_UnnamedText_74ea0: ; 9925d (26:525d)
	db $0, "The SPEED of all", $4f
	db "#MON increases", $55
	db "a little bit.", $51
	db "It also lets you", $4f
	db "use FLY outside", $55
	db "of battle.", $58
; 0x9925d + 91 bytes

_UnnamedText_74ea5: ; 992b8 (26:52b8)
	db $0, "#MON up to L50", $4f
	db "will obey you.", $51
	db "Any higher, they", $4f
	db "become unruly!", $51
	db "It also lets you", $4f
	db "use STRENGTH out-", $55
	db "side of battle.", $58
; 0x992b8 + 114 bytes

_UnnamedText_74eaa: ; 9932a (26:532a)
	db $0, "The DEFENSE of all", $4f
	db "#MON increases", $55
	db "a little bit.", $51
	db "It also lets you", $4f
	db "use SURF outside", $55
	db "of battle.", $58
; 0x9932a + 94 bytes

_UnnamedText_74eaf: ; 99388 (26:5388)
	db $0, "#MON up to L70", $4f
	db "will obey you.", $51
	db "Any higher, they", $4f
	db "become unruly!", $58
; 0x99388 + 63 bytes

_UnnamedText_74eb4: ; 993c7 (26:53c7)
	db $0, "Your #MON's", $4f
	db "SPECIAL abilities", $55
	db "increase a bit.", $58
; 0x993c7 + 46 bytes

_UnnamedText_74eb9: ; 993f5 (26:53f5)
	db $0, "All #MON will", $4f
	db "obey you!", $58
; 0x993f5 + 25 bytes

_LavenderPokecenterText4: ; 9940e (26:540e)
_LavenderPokecenterText2: ; 9940e (26:540e)
_LavenderPokecenterText1: ; 9940e (26:540e)
	db $0, "TEAM ROCKET will", $4f
	db "do anything for", $55
	db "the sake of gold!", $57

_LavenderPokecenterText3: ; 99442 (26:5442)
	db $0, "I saw CUBONE's", $4f
	db "mother die trying", $55
	db "to escape from", $55
	db "TEAM ROCKET!", $57

_PokemonTower1Text1: ; 9947f (26:547f)
	db $0, "#MON TOWER was", $4f
	db "erected in the", $55
	db "memory of #MON", $55
	db "that had died.", $57

_PokemonTower1Text2: ; 994bc (26:54bc)
	db $0, "Did you come to", $4f
	db "pay respects?", $55
	db "Bless you!", $57

_PokemonTower1Text3: ; 994e6 (26:54e6)
	db $0, "I came to pray", $4f
	db "for my CLEFAIRY.", $51
	db "Sniff! I can't", $4f
	db "stop crying...", $57

_PokemonTower1Text4: ; 99524 (26:5524)
	db $0, "My GROWLITHE...", $4f
	db "Why did you die?", $57

_PokemonTower1Text5: ; 99546 (26:5546)
	db $0, "I am a CHANNELER!", $4f
	db "There are spirits", $55
	db "up to mischief!", $57

_UnnamedText_6062d: ; 9957b (26:557b)
	db $0, $53, ": Hey,", $4f
	db $52, "! What", $55
	db "brings you here?", $55
	db "Your #MON", $55
	db "don't look dead!", $51
	db "I can at least", $4f
	db "make them faint!", $55
	db "Let's go, pal!", $57
; 0x9957b + 106 bytes

_UnnamedText_60632: ; 995e5 (26:55e5)
	db $0, "What?", $4f
	db "You stinker!", $51
	db "I took it easy on", $4f
	db "you too!", $58
; 0x995e5 + 47 bytes

_UnnamedText_60637: ; 99614 (26:5614)
	db $0, $53, ": Well,", $4f
	db "look at all your", $55
	db "wimpy #MON!", $51
	db "Toughen them up a", $4f
	db "bit more!", $58
; 0x99614 + 67 bytes

_UnnamedText_6063c: ; 99657 (26:5657)
	db $0, "How's your #DEX", $4f
	db "coming, pal?", $55
	db "I just caught a", $55
	db "CUBONE!", $51
	db "I can't find the", $4f
	db "grown-up MAROWAK", $55
	db "yet!", $51
	db "I doubt there are", $4f
	db "any left! Well, I", $55
	db "better get going!", $55
	db "I've got a lot to", $55
	db "accomplish, pal!", $51
	db "Smell ya later!", $57
; 0x99657 + 195 bytes

_PokemonTower2Text2: ; 9971a (26:571a)
	db $0, "Even we could not", $4f
	db "identify the", $55
	db "wayward GHOSTs!", $51
	db "A SILPH SCOPE", $4f
	db "might be able to", $55
	db "unmask them.", $57

_PokemonTower3BattleText1: ; 99776 (26:5776)
	db $0, "Urrg...Awaa...", $4f
	db "Huhu...graa..", $57
; 0x99776 + 30 bytes

_PokemonTower3EndBattleText1: ; 99794 (26:5794)
	db $0, "Hwa!", $4f
	db "I'm saved!", $58
; 0x99794 + 16 bytes

_PokemonTower3AfterBattleText1: ; 997a4 (26:57a4)
	db $0, "The GHOSTs can be", $4f
	db "identified by the", $55
	db "SILPH SCOPE.", $57
; 0x997a4 + 50 bytes

_PokemonTower3BattleText2: ; 997d6 (26:57d6)
	db $0, "Kekeke....", $4f
	db "Kwaaah!", $57
; 0x997d6 + 20 bytes

_PokemonTower3EndBattleText2: ; 997ea (26:57ea)
	db $0, "Hmm?", $4f
	db "What am I doing?", $58
; 0x997ea + 23 bytes

_PokemonTower3AfterBattleText2: ; 99801 (26:5801)
	db $0, "Sorry! I was", $4f
	db "possessed!", $57
; 0x99801 + 25 bytes

_PokemonTower3BattleText3: ; 9981a (26:581a)
	db $0, "Be gone!", $4f
	db "Evil spirit!", $57
; 0x9981a + 23 bytes

_PokemonTower3EndBattleText3: ; 99831 (26:5831)
	db $0, "Whew!", $4f
	db "The spirit left!", $58
; 0x99831 + 24 bytes

_PokemonTower3AfterBattleText3: ; 99849 (26:5849)
	db $0, "My friends were", $4f
	db "possessed too!", $57
; 0x99849 + 32 bytes

_PokemonTower4BattleText1: ; 99869 (26:5869)
	db $0, "GHOST! No!", $4f
	db "Kwaaah!", $57
; 0x99869 + 20 bytes

_PokemonTower4EndBattleText1: ; 9987d (26:587d)
	db $0, "Where", $4f
	db "is the GHOST?", $58
; 0x9987d + 21 bytes

_PokemonTower4AfterBattleText1: ; 99892 (26:5892)
	db $0, "I must have been", $4f
	db "dreaming...", $57
; 0x99892 + 30 bytes

_PokemonTower4BattleText2: ; 998b0 (26:58b0)
	db $0, "Be cursed with", $4f
	db "me! Kwaaah!", $57
; 0x998b0 + 28 bytes

_PokemonTower4EndBattleText2: ; 998cc (26:58cc)
	db $0, "What!", $58
; 0x998cc + 7 bytes

_PokemonTower4AfterBattleText2: ; 998d3 (26:58d3)
	db $0, "We can't crack", $4f
	db "the identity of", $55
	db "the GHOSTs.", $57
; 0x998d3 + 43 bytes

_PokemonTower4BattleText3: ; 998fe (26:58fe)
	db $0, "Huhuhu...", $4f
	db "Beat me not!", $57
; 0x998fe + 24 bytes

_PokemonTower4EndBattleText3: ; 99916 (26:5916)
	db $0, "Huh?", $4f
	db "Who? What?", $58
; 0x99916 + 17 bytes

_PokemonTower4AfterBattleText3: ; 99927 (26:5927)
	db $0, "May the departed", $4f
	db "souls of #MON", $55
	db "rest in peace...", $57
; 0x99927 + 49 bytes

_PokemonTower5Text1: ; 99958 (26:5958)
	db $0, "Come, child! I", $4f
	db "sealed this space", $55
	db "with white magic!", $51
	db "You can rest here!", $57

_PokemonTower5BattleText1: ; 9999f (26:599f)
	db $0, "Give...me...", $4f
	db "your...soul...", $57
; 0x9999f + 29 bytes

_PokemonTower5EndBattleText1: ; 999bc (26:59bc)
	db $0, "Gasp!", $58
; 0x999bc + 7 bytes

_PokemonTower5AfterBattleText1: ; 999c3 (26:59c3)
	db $0, "I was under", $4f
	db "possession!", $57
; 0x999c3 + 25 bytes

_PokemonTower5BattleText2: ; 999dc (26:59dc)
	db $0, "You...shall...", $4f
	db "join...us...", $57
; 0x999dc + 29 bytes

_PokemonTower5EndBattleText2: ; 999f9 (26:59f9)
	db $0, "What", $4f
	db "a nightmare!", $58
; 0x999f9 + 19 bytes

_PokemonTower5AfterBattleText2: ; 99a0c (26:5a0c)
	db $0, "I was possessed!", $57
; 0x99a0c + 18 bytes

_PokemonTower5BattleText3: ; 99a1e (26:5a1e)
	db $0, "Zombies!", $57
; 0x99a1e + 10 bytes

_PokemonTower5EndBattleText3: ; 99a28 (26:5a28)
	db $0, "Ha?", $58
; 0x99a28 + 5 bytes

_PokemonTower5AfterBattleText3: ; 99a2d (26:5a2d)
	db $0, "I regained my", $4f
	db "senses!", $57
; 0x99a2d + 23 bytes

_PokemonTower5BattleText4: ; 99a44 (26:5a44)
	db $0, "Urgah...", $4f
	db "Urff....", $57
; 0x99a44 + 19 bytes

_PokemonTower5EndBattleText4: ; 99a57 (26:5a57)
	db $0, "Whoo!", $58
; 0x99a57 + 7 bytes

_PokemonTower5AfterBattleText4: ; 99a5e (26:5a5e)
	db $0, "I fell to evil", $4f
	db "spirits despite", $55
	db "my training!", $57
; 0x99a5e + 45 bytes

_UnnamedText_60a43: ; 99a8b (26:5a8b)
	db $0, "Entered purified,", $4f
	db "protected zone!", $51
	db $52, "'s #MON", $4f
	db "are fully healed!", $57
; 0x99a8b + 61 bytes

_UnnamedText_60c1f: ; 99ac8 (26:5ac8)
	db $0, "The GHOST was the", $4f
	db "restless soul of", $55
	db "CUBONE's mother!", $57
; 0x99ac8 + 52 bytes

_UnnamedText_60c24: ; 99afc (26:5afc)
	db $0, "The mother's soul", $4f
	db "was calmed.", $51
	db "It departed to", $4f
	db "the afterlife!", $57
; 0x99afc + 60 bytes

_PokemonTower6BattleText1: ; 99b38 (26:5b38)
	db $0, "Give...me...", $4f
	db "blood...", $57
; 0x99b38 + 23 bytes

_PokemonTower6EndBattleText1: ; 99b4f (26:5b4f)
	db $0, "Groan!", $58
; 0x99b4f + 8 bytes

_PokemonTower6AfterBattleText1: ; 99b57 (26:5b57)
	db $0, "I feel anemic and", $4f
	db "weak...", $57
; 0x99b57 + 27 bytes

_PokemonTower6BattleText2: ; 99b72 (26:5b72)
	db $0, "Urff... Kwaah!", $57
; 0x99b72 + 16 bytes

_PokemonTower6EndBattleText2: ; 99b82 (26:5b82)
	db $0, "Some-", $4f
	db "thing fell out!", $58
; 0x99b82 + 23 bytes

_PokemonTower6AfterBattleText2: ; 99b99 (26:5b99)
	db $0, "Hair didn't fall", $4f
	db "out! It was an", $55
	db "evil spirit!", $57
; 0x99b99 + 45 bytes

_PokemonTower6BattleText3: ; 99bc6 (26:5bc6)
	db $0, "Ke..ke...ke...", $4f
	db "ke..ke...ke!!", $57
; 0x99bc6 + 30 bytes

_PokemonTower6EndBattleText3: ; 99be4 (26:5be4)
	db $0, "Keee!", $58
; 0x99be4 + 7 bytes

_PokemonTower6AfterBattleText3: ; 99beb (26:5beb)
	db $0, "What's going on", $4f
	db "here?", $57
; 0x99beb + 22 bytes

_UnnamedText_60c56: ; 99c01 (26:5c01)
	db $0, "Be gone...", $4f
	db "Intruders...", $57
; 0x99c01 + 25 bytes

_UnnamedText_60ec4: ; 99c1a (26:5c1a)
	db $0, "MR.FUJI: Heh? You", $4f
	db "came to save me?", $51
	db "Thank you. But, I", $4f
	db "came here of my", $55
	db "own free will.", $51
	db "I came to calm", $4f
	db "the soul of", $55
	db "CUBONE's mother.", $51
	db "I think MAROWAK's", $4f
	db "spirit has gone", $55
	db "to the afterlife.", $51
	db "I must thank you", $4f
	db "for your kind", $55
	db "concern!", $51
	db "Follow me to my", $4f
	db "home, #MON", $55
	db "HOUSE at the foot", $55
	db "of this tower.", $57
; 0x99c1a + 279 bytes

_PokemonTower7BattleText1: ; 99d31 (26:5d31)
	db $0, "What do you want?", $4f
	db "Why are you here?", $57
; 0x99d31 + 37 bytes

_PokemonTower7EndBattleText1: ; 99d56 (26:5d56)
	db $0, "I give up!", $58
; 0x99d56 + 12 bytes

_PokemonTower7AfterBattleText1: ; 99d62 (26:5d62)
	db $0, "I'm not going to", $4f
	db "forget this!", $57
; 0x99d62 + 30 bytes

_PokemonTower7BattleText2: ; 99d80 (26:5d80)
	db $0, "This old guy came", $4f
	db "and complained", $55
	db "about us harming", $55
	db "useless #MON!", $51
	db "We're talking it", $4f
	db "over as adults!", $57
; 0x99d80 + 97 bytes

_PokemonTower7EndBattleText2: ; 99de1 (26:5de1)
	db $0, "Please!", $4f
	db "No more!", $58
; 0x99de1 + 18 bytes

_PokemonTower7AfterBattleText2: ; 99df3 (26:5df3)
	db $0, "#MON are only", $4f
	db "good for making", $55
	db "money!", $51
	db "Stay out of our", $4f
	db "business!", $57
; 0x99df3 + 64 bytes

_PokemonTower7BattleText3: ; 99e33 (26:5e33)
	db $0, "You're not saving", $4f
	db "anyone, kid!", $57
; 0x99e33 + 31 bytes

_PokemonTower7EndBattleText3: ; 99e52 (26:5e52)
	db $0, "Don't", $4f
	db "fight us ROCKETs!", $58
; 0x99e52 + 24 bytes

_PokemonTower7AfterBattleText3: ; 99e6a (26:5e6a)
	db $0, "You're not getting", $4f
	db "away with this!", $57
; 0x99e6a + 35 bytes

_UnnamedText_1d8d1: ; 99e8d (26:5e8d)
	db $0, "That's odd, MR.FUJI", $4f
	db "isn't here.", $55
	db "Where'd he go?", $57
; 0x99e8d + 45 bytes

_UnnamedText_1d8d6: ; 99eba (26:5eba)
	db $0, "MR.FUJI had been", $4f
	db "praying alone for", $55
	db "CUBONE's mother.", $57
; 0x99eba + 52 bytes

_UnnamedText_1d8f4: ; 99eee (26:5eee)
	db $0, "This is really", $4f
	db "MR.FUJI's house.", $51
	db "He's really kind!", $51
	db "He looks after", $4f
	db "abandoned and", $55
	db "orphaned #MON!", $57
; 0x99eee + 93 bytes

_UnnamedText_1d8f9: ; 99f4b (26:5f4b)
	db $0, "It's so warm!", $4f
	db "#MON are so", $55
	db "nice to hug!", $57
; 0x99f4b + 39 bytes

_LavenderHouse1Text3: ; 99f72 (26:5f72)
	db $0, "PSYDUCK: Gwappa!@@"

_LavenderHouse1Text4: ; 99f85 (26:5f85)
	db $0, "NIDORINO: Gaoo!@@"

_UnnamedText_1d94c: ; 99f97 (26:5f97)
	db $0, "MR.FUJI: ", $52, ".", $51
	db "Your #DEX quest", $4f
	db "may fail without", $55
	db "love for your", $55
	db "#MON.", $51
	db "I think this may", $4f
	db "help your quest.", $58
; 0x99f97 + 100 bytes

_ReceivedFluteText: ; 99ffb (26:5ffb)
	db $0, $52, " received", $4f
	db "a @"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x9a011

_FluteExplanationText: ; 9a011 (26:6011)
	db $0, $51
	db "Upon hearing #", $4f
	db "FLUTE, sleeping", $55
	db "#MON will", $55
	db "spring awake.", $51
	db "It works on all", $4f
	db "sleeping #MON.", $57
; 0x9a011 + 88 bytes

_FluteNoRoomText: ; 9a069 (26:6069)
	db $0, "You must make", $4f
	db "room for this!", $57
; 0x9a069 + 30 bytes

_MrFujiAfterFluteText: ; 9a087 (26:6087)
	db $0, "MR.FUJI: Has my", $4f
	db "FLUTE helped you?", $57
; 0x9a087 + 35 bytes

_LavenderHouse1Text6: ; 9a0aa (26:60aa)
	db $0, "#MON Monthly", $4f
	db "Grand Prize", $55
	db "Drawing!", $51
	db "The application", $4f
	db "form is...", $51
	db "Gone! It's been", $4f
	db "clipped out!", $57

_LavenderMartText2: ; 9a104 (26:6104)
	db $0, "I'm searching for", $4f
	db "items that raise", $55
	db "the abilities of", $55
	db "#MON during a", $55
	db "single battle.", $51
	db "X ATTACK, X", $4f
	db "DEFEND, X SPEED", $55
	db "and X SPECIAL are", $55
	db "what I'm after.", $51
	db "Do you know where", $4f
	db "I can get them?", $57

_UnnamedText_5c953: ; 9a1b4 (26:61b4)
	db $0, "You know REVIVE?", $4f
	db "It revives any", $55
	db "fainted #MON!", $57
; 0x9a1b4 + 47 bytes

_UnnamedText_5c958: ; 9a1e3 (26:61e3)
	db $0, "I found a NUGGET", $4f
	db "in the mountains.", $51
	db "I thought it was", $4f
	db "useless, but it", $55
	db "sold for ¥5000!", $57
; 0x9a1e3 + 85 bytes

_LavenderHouse2Text1: ; 9a238 (26:6238)
	db $0, "CUBONE: Kyarugoo!@@"

_UnnamedText_1d9dc: ; 9a24c (26:624c)
	db $0, "I hate those", $4f
	db "horrible ROCKETs!", $51
	db "That poor CUBONE's", $4f
	db "mother...", $51
	db "It was killed", $4f
	db "trying to escape", $55
	db "from TEAM ROCKET!", $57
; 0x9a24c + 109 bytes

_UnnamedText_1d9e1: ; 9a2b9 (26:62b9)
	db $0, "The GHOST of", $4f
	db "#MON TOWER is", $55
	db "gone!", $51
	db "Someone must have", $4f
	db "soothed its", $55
	db "restless soul!", $57
; 0x9a2b9 + 79 bytes

_UnnamedText_1dab3: ; 9a308 (26:6308)
	db $0, "Hello, hello!", $4f
	db "I am the official", $55
	db "NAME RATER!", $51
	db "Want me to rate", $4f
	db "the nicknames of", $55
	db "your #MON?", $57
; 0x9a308 + 89 bytes

_UnnamedText_1dab8: ; 9a361 (26:6361)
	db $0, "Which #MON", $4f
	db "should I look at?", $58
; 0x9a361 + 30 bytes

_UnnamedText_1dabd: ; 9a37f (26:637f)
	TX_RAM $cd6d
	db $0, ", is it?", $4f
	db "That is a decent", $55
	db "nickname!", $51
	db "But, would you", $4f
	db "like me to give", $55
	db "it a nicer name?", $51
	db "How about it?", $57
; 0x9a37f + 102 bytes

_UnnamedText_1dac2: ; 9a3e5 (26:63e5)
	db $0, "Fine! What should", $4f
	db "we name it?", $58
; 0x9a3e5 + 31 bytes

_UnnamedText_1dac7: ; 9a404 (26:6404)
	db $0, "OK! This #MON", $4f
	db "has been renamed", $55
	db "@"
; 0x9a404 + 33 bytes

UnnamedText_9a425: ; 9a425 (26:6425)
	TX_RAM $cee9
	db $0, "!", $51
	db "That's a better", $4f
	db "name than before!", $57
; 0x9a44c

_UnnamedText_1dacc: ; 9a44c (26:644c)
	db $0, "Fine! Come any", $4f
	db "time you like!", $57
; 0x9a44c + 31 bytes

_UnnamedText_1dad1: ; 9a46b (26:646b)
	TX_RAM $cd6d
	db $0, ", is it?", $4f
	db "That is a truly", $55
	db "impeccable name!", $51
	db "Take good care of", $4f
	db "@"
	TX_RAM $cd6d
	db $0, "!", $57
; 0x9a4b2

_VermilionPokecenterText2: ; 9a4b2 (26:64b2)
_VermilionPokecenterText1: ; 9a4b2 (26:64b2)
	db $0, "Even if they are", $4f
	db "the same level,", $55
	db "#MON can have", $55
	db "very different", $55
	db "abilities.", $51
	db "A #MON raised", $4f
	db "by a trainer is", $55
	db "stronger than one", $55
	db "in the wild.", $57

_VermilionPokecenterText3: ; 9a539 (26:6539)
	db $0, "My #MON was", $4f
	db "poisoned! It", $55
	db "fainted while we", $55
	db "were walking!", $57

_UnnamedText_59bb7: ; 9a572 (26:6572)
	db $0, "Won't you admire", $4f
	db "my PIKACHU's", $55
	db "adorable tail?", $57
; 0x9a572 + 44 bytes

_UnnamedText_59bbc: ; 9a59e (26:659e)
	db $0, "Humph! My PIKACHU", $4f
	db "is twice as cute", $55
	db "as that one!", $57
; 0x9a59e + 49 bytes

_UnnamedText_59be4: ; 9a5cf (26:65cf)
	db $0, "I just love my", $4f
	db "SEEL!", $51
	db "It squeals when I", $4f
	db "hug it!", $57
; 0x9a5cf + 48 bytes

_UnnamedText_59be9: ; 9a5ff (26:65ff)
	db $0, "Oh dear!", $51
	db "My SEEL is far", $4f
	db "more attractive!", $57
; 0x9a5ff + 42 bytes

_UnnamedText_59c00: ; 9a629 (26:6629)
	db $0, "PIKACHU: Chu!", $4f
	db "Pikachu!", $57
; 0x9a629 + 24 bytes

_UnnamedText_59c17: ; 9a641 (26:6641)
	db $0, "SEEL: Kyuoo!", $57
; 0x9a641 + 14 bytes

_UnnamedText_59c65: ; 9a64f (26:664f)
	db $0, "I chair the", $4f
	db "#MON Fan Club!", $51
	db "I have collected", $4f
	db "over 100 #MON!", $51
	db "I'm very fussy", $4f
	db "when it comes to", $55
	db "#MON!", $51
	db "So...", $51
	db "Did you come", $4f
	db "visit to hear", $55
	db "about my #MON?", $57
; 0x9a64f + 145 bytes

_UnnamedText_59c6a: ; 9a6e0 (26:66e0)
	db $0, "Good!", $4f
	db "Then listen up!", $51
	db "My favorite", $4f
	db "RAPIDASH...", $51
	db "It...cute...", $4f
	db "lovely...smart...", $55
	db "plus...amazing...", $55
	db "you think so?...", $55
	db "oh yes...it...", $55
	db "stunning...", $55
	db "kindly...", $55
	db "love it!", $51
	db "Hug it...when...", $55
	db "sleeping...warm", $55
	db "and cuddly...", $55
	db "spectacular...", $55
	db "ravishing...", $55
	db "...Oops! Look at", $55
	db "the time! I kept", $55
	db "you too long!", $51
	db "Thanks for hearing", $4f
	db "me out! I want", $55
	db "you to have this!", $58
; 0x9a6e0 + 334 bytes

_ReceivedBikeVoucherText: ; 9a82e (26:682e)
	db $0, $52, " received", $4f
	db "a @"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x9a844

_UnnamedText_59c74: ; 9a844 (26:6844)
	db $0, $51
	db "Exchange that for", $4f
	db "a BICYCLE!", $51
	db "Don't worry, my", $4f
	db "FEAROW will FLY", $55
	db "me anywhere!", $51
	db "So, I don't need a", $4f
	db "BICYCLE!", $51
	db "I hope you like", $4f
	db "cycling!", $57
; 0x9a844 + 127 bytes

_UnnamedText_59c79: ; 9a8c3 (26:68c3)
	db $0, "Oh. Come back", $4f
	db "when you want to", $55
	db "hear my story!", $57
; 0x9a8c3 + 47 bytes

_UnnamedText_59c7e: ; 9a8f2 (26:68f2)
	db $0, "Hello, ", $52, "!", $51
	db "Did you come see", $4f
	db "me about my", $55
	db "#MON again?", $51
	db "No? Too bad!", $57
; 0x9a8f2 + 65 bytes

_UnnamedText_59c83: ; 9a933 (26:6933)
	db $0, "Make room for", $4f
	db "this!", $57
; 0x9a933 + 21 bytes

_FanClubText6: ; 9a948 (26:6948)
	db $0, "Our Chairman is", $4f
	db "very vocal about", $55
	db "#MON.", $57

_FanClubText7: ; 9a970 (26:6970)
	db $0, "Let's all listen", $4f
	db "politely to other", $55
	db "trainers!", $57

_FanClubText8: ; 9a99d (26:699d)
	db $0, "If someone brags,", $4f
	db "brag right back!", $57

_VermilionMartText2: ; 9a9c1 (26:69c1)
	db $0, "There are evil", $4f
	db "people who will", $55
	db "use #MON for", $55
	db "criminal acts.", $51
	db "TEAM ROCKET", $4f
	db "traffics in rare", $55
	db "#MON.", $51
	db "They also abandon", $4f
	db "#MON that they", $55
	db "consider not to", $55
	db "be popular or", $55
	db "useful.", $57

_VermilionMartText3: ; 9aa67 (26:6a67)
	db $0, "I think #MON", $4f
	db "can be good or", $55
	db "evil. It depends", $55
	db "on the trainer.", $57

_UnnamedText_5cb6d: ; 9aaa5 (26:6aa5)
	db $0, "Hey, kid! What do", $4f
	db "you think you're", $55
	db "doing here?", $51
	db "You won't live", $4f
	db "long in combat!", $55
	db "That's for sure!", $51
	db "I tell you kid,", $4f
	db "electric #MON", $55
	db "saved me during", $55
	db "the war!", $51
	db "They zapped my", $4f
	db "enemies into", $55
	db "paralysis!", $51
	db "The same as I'll", $4f
	db "do to you!", $57
; 0x9aaa5 + 214 bytes

SECTION "bank27",ROMX,BANK[$27]

_UnnamedText_5cb72: ; 9c000 (27:4000)
	db $0, "A little word of", $4f
	db "advice, kid!", $51
	db "Electricity is", $4f
	db "sure powerful!", $51
	db "But, it's useless", $4f
	db "against ground-", $55
	db "type #MON!", $57
; 0x9c000 + 105 bytes

_UnnamedText_5cb77: ; 9c069 (27:4069)
	db $0, "The THUNDERBADGE", $4f
	db "cranks up your", $55
	db "#MON's SPEED!", $51
	db "It also lets your", $4f
	db "#MON FLY any", $55
	db "time, kid!", $51
	db "You're special,", $4f
	db "kid! Take this!", $57
; 0x9c069 + 119 bytes

_ReceivedTM24Text: ; 9c0e0 (27:40e0)
	db $0, $52, " received ", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x9c0f5

_TM24ExplanationText: ; 9c0f5 (27:40f5)
	db $0, $51
	db "TM24 contains", $4f
	db "THUNDERBOLT!", $51
	db "Teach it to an", $4f
	db "electric #MON!", $57
; 0x9c0f5 + 59 bytes

_TM24NoRoomText: ; 9c130 (27:4130)
	db $0, "Yo kid, make room", $4f
	db "in your pack!", $57
; 0x9c130 + 33 bytes

_ReceivedThunderbadgeText: ; 9c151 (27:4151)
	db $0, "Whoa!", $51
	db "You're the real", $4f
	db "deal, kid!", $51
	db "Fine then, take", $4f
	db "the THUNDERBADGE!", $58
; 0x9c151 + 67 bytes

_VermilionGymBattleText1: ; 9c194 (27:4194)
	db $0, "When I was in the", $4f
	db "Army, LT.SURGE", $55
	db "was my strict CO!", $57
; 0x9c194 + 52 bytes

_VermilionGymEndBattleText1: ; 9c1c8 (27:41c8)
	db $0, "Stop!", $4f
	db "You're very good!", $58
; 0x9c1c8 + 24 bytes

_VermilionGymAfterBattleText1: ; 9c1e0 (27:41e0)
	db $0, "The door won't", $4f
	db "open?", $51
	db "LT.SURGE always", $4f
	db "was cautious!", $57
; 0x9c1e0 + 51 bytes

_VermilionGymBattleText2: ; 9c213 (27:4213)
	db $0, "I'm a lightweight,", $4f
	db "but I'm good with", $55
	db "electricity!", $57
; 0x9c213 + 49 bytes

_VermilionGymEndBattleText2: ; 9c244 (27:4244)
	db $0, "Fried!", $58
; 0x9c244 + 8 bytes

_VermilionGymAfterBattleText2: ; 9c24c (27:424c)
	db $0, "OK, I'll talk!", $51
	db "LT.SURGE said he", $4f
	db "hid door switches", $55
	db "inside something!", $57
; 0x9c24c + 68 bytes

_VermilionGymBattleText3: ; 9c290 (27:4290)
	db $0, "This is no place", $4f
	db "for kids!", $57
; 0x9c290 + 28 bytes

_VermilionGymEndBattleText3: ; 9c2ac (27:42ac)
	db $0, "Wow!", $4f
	db "Surprised me!", $58
; 0x9c2ac + 20 bytes

_VermilionGymAfterBattleText3: ; 9c2c0 (27:42c0)
	db $0, "LT.SURGE set up", $4f
	db "double locks!", $55
	db "Here's a hint!", $51
	db "When you open the", $4f
	db "1st lock, the 2nd", $55
	db "lock is right", $55
	db "next to it!", $57
; 0x9c2c0 + 107 bytes

_UnnamedText_5cbf4: ; 9c32b (27:432b)
	db $0, "Yo! Champ in", $4f
	db "making!", $51
	db "LT.SURGE has a", $4f
	db "nickname. People", $55
	db "refer to him as", $55
	db "the Lightning", $55
	db "American!", $51
	db "He's an expert on", $4f
	db "electric #MON!", $51
	db "Birds and water", $4f
	db "#MON are at", $55
	db "risk! Beware of", $55
	db "paralysis too!", $51
	db "LT.SURGE is very", $4f
	db "cautious!", $51
	db "You'll have to", $4f
	db "break a code to", $55
	db "get to him!", $57
; 0x9c32b + 254 bytes

_UnnamedText_5cbf9: ; 9c429 (27:4429)
	db $0, "Whew! That match", $4f
	db "was electric!", $57
; 0x9c429 + 32 bytes

_VermilionHouse1Text1: ; 9c449 (27:4449)
	db $0, "I'm getting my", $4f
	db "PIDGEY to fly a", $55
	db "letter to SAFFRON", $55
	db "in the north!", $57

_VermilionHouse1Text2: ; 9c488 (27:4488)
	db $0, "PIDGEY: Kurukkoo!@@"

_VermilionHouse1Text3: ; 9c49c (27:449c)
	db $0, "Dear PIPPI, I hope", $4f
	db "to see you soon.", $51
	db "I heard SAFFRON", $4f
	db "has problems with", $55
	db "TEAM ROCKET.", $51
	db "VERMILION appears", $4f
	db "to be safe.", $57

_UnnamedText_1dcc1: ; 9c50e (27:450e)
	db $0, $57
; 0x9c50e + 2 bytes

_UnnamedText_560b1: ; 9c510 (27:4510)
	db $0, "I'm the FISHING", $4f
	db "GURU!", $51
	db "I simply Looove", $4f
	db "fishing!", $51
	db "Do you like to", $4f
	db "fish?", $57
; 0x9c510 + 68 bytes

_UnnamedText_560b6: ; 9c554 (27:4554)
	db $0, "Grand! I like", $4f
	db "your style!", $51
	db "Take this and", $4f
	db "fish, young one!", $51
	db $52, " received", $4f
	db "an @"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x9c5a4

_UnnamedText_560bb: ; 9c5a4 (27:45a4)
	db $0, $51
	db "Fishing is a way", $4f
	db "of life!", $51
	db "From the seas to", $4f
	db "rivers, go out", $55
	db "and land the big", $55
	db "one, young one!", $57
; 0x9c5a4 + 93 bytes

_UnnamedText_560c0: ; 9c601 (27:4601)
	db $0, "Oh... That's so", $4f
	db "disappointing...", $57
; 0x9c601 + 33 bytes

_UnnamedText_560c5: ; 9c622 (27:4622)
	db $0, "Hello there,", $4f
	db $52, "!", $51
	db "How are the fish", $4f
	db "biting?", $57
; 0x9c622 + 42 bytes

_UnnamedText_560ca: ; 9c64c (27:464c)
	db $0, "Oh no!", $51
	db "You have no room", $4f
	db "for my gift!", $57
; 0x9c64c + 38 bytes

_CeladonMart1Text1: ; 9c672 (27:4672)
	db $0, "Hello! Welcome to", $4f
	db "CELADON DEPT.", $55
	db "STORE.", $51
	db "The board on the", $4f
	db "right describes", $55
	db "the store layout.", $57

_CeladonMart1Text2: ; 9c6cd (27:46cd)
	db $0, "1F: SERVICE", $4f
	db "    COUNTER", $51
	db "2F: TRAINER'S", $4f
	db "    MARKET", $51
	db "3F: TV GAME SHOP", $51
	db "4F: WISEMAN GIFTS", $51
	db "5F: DRUG STORE", $51
	db "ROOFTOP SQUARE:", $4f
	db "VENDING MACHINES", $57

_CeladonMart1Text3: ; 9c752 (27:4752)
	db $0, "1F: SERVICE", $4f
	db "    COUNTER", $57

_CeladonMart2Text3: ; 9c76b (27:476b)
	db $0, "SUPER REPEL keeps", $4f
	db "weak #MON at", $55
	db "bay...", $51
	db "Hmm, it's a more", $4f
	db "powerful REPEL!", $57

_CeladonMart2Text4: ; 9c7b2 (27:47b2)
	db $0, "For long outings,", $4f
	db "you should buy", $55
	db "REVIVE.", $57

_CeladonMart2Text5: ; 9c7dc (27:47dc)
	db $0, "Top Grade Items", $4f
	db "for Trainers!", $51
	db "2F: TRAINER'S", $4f
	db "    MARKET", $57

_TM18PreReceiveText: ; 9c814 (27:4814)
	db $0, "Oh, hi! I finally", $4f
	db "finished #MON!", $51
	db "Not done yet?", $4f
	db "This might be", $55
	db "useful!", $58
; 0x9c814 + 70 bytes

_ReceivedTM18Text: ; 9c85a (27:485a)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x9c86e

_TM18ExplanationText: ; 9c86e (27:486e)
	db $0, "TM18 is COUNTER!", $4f
	db "Not like the one", $55
	db "I'm leaning on,", $55
	db "mind you!", $57
; 0x9c86e + 60 bytes

_TM18NoRoomText: ; 9c8aa (27:48aa)
	db $0, "Your pack is full", $4f
	db "of items!", $57
; 0x9c8aa + 29 bytes

_CeladonMart3Text2: ; 9c8c7 (27:48c7)
	db $0, "Captured #MON", $4f
	db "are registered", $55
	db "with an ID No.", $55
	db "and OT, the name", $55
	db "of the Original", $55
	db "Trainer that", $55
	db "caught it!", $57

_CeladonMart3Text3: ; 9c92d (27:492d)
	db $0, "All right!", $51
	db "My buddy's going", $4f
	db "to trade me his", $55
	db "KANGASKHAN for my", $55
	db "GRAVELER!", $57

_CeladonMart3Text4: ; 9c975 (27:4975)
	db $0, "Come on GRAVELER!", $51
	db "I love GRAVELER!", $4f
	db "I collect them!", $51
	db "Huh?", $51
	db "GRAVELER turned", $4f
	db "into a different", $55
	db "#MON!", $57

_CeladonMart3Text5: ; 9c9d5 (27:49d5)
	db $0, "You can identify", $4f
	db "#MON you got", $55
	db "in trades by", $55
	db "their ID Numbers!", $57

_CeladonMart3Text6: ; 9ca13 (27:4a13)
	db $0, "It's an SNES!", $57

_CeladonMart3Text7: ; 9ca21 (27:4a21)
	db $0, "An RPG! There's", $4f
	db "no time for that!", $57

_CeladonMart3Text9: ; 9ca43 (27:4a43)
	db $0, "A sports game!", $4f
	db "Dad'll like that!", $57

_CeladonMart3Text11: ; 9ca64 (27:4a64)
	db $0, "A puzzle game!", $4f
	db "Looks addictive!", $57

_CeladonMart3Text13: ; 9ca85 (27:4a85)
	db $0, "A fighting game!", $4f
	db "Looks tough!", $57

_CeladonMart3Text14: ; 9caa4 (27:4aa4)
	db $0, "3F: TV GAME SHOP", $57

_CeladonMart3Text15: ; 9cab6 (27:4ab6)
	db $0, "Red and Blue!", $4f
	db "Both are #MON!", $57

_CeladonMart4Text2: ; 9cad4 (27:4ad4)
	db $0, "I'm getting a", $4f
	db "# DOLL for my", $55
	db "girl friend!", $57

_CeladonMart4Text3: ; 9cafd (27:4afd)
	db $0, "I heard something", $4f
	db "useful.", $51
	db "You can run from", $4f
	db "wild #MON by", $55
	db "distracting them", $55
	db "with a # DOLL!", $57

_CeladonMart4Text4: ; 9cb56 (27:4b56)
	db $0, "Express yourself", $4f
	db "with gifts!", $51
	db "4F: WISEMAN GIFTS", $51
	db "Evolution Special!", $4f
	db "Element STONEs on", $55
	db "sale now!", $57

_UnnamedText_484ee: ; 9cbb5 (27:4bb5)
	db $0, "Give her which", $4f
	db "drink?", $57
; 0x9cbb5 + 23 bytes

UnnamedText_9cbcc: ; 9cbcc (27:4bcc)
	db $0, "Yay!", $51
	db "FRESH WATER!", $51
	db "Thank you!", $51
	db "You can have this", $4f
	db "from me!@@"
; 0x9cc06

UnnamedText_9cc06: ; 9cc06 (27:4c06)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x9cc1a

UnnamedText_9cc1a: ; 9cc1a (27:4c1a)
	db $0, $51
	db "@"
	TX_RAM $cf4b
	db $0, " contains", $4f
	db "ICE BEAM!", $51
	db "It can freeze the", $4f
	db "target sometimes!@@"
; 0x9cc5a

UnnamedText_9cc5a: ; 9cc5a (27:4c5a)
	db $0, "Yay!", $51
	db "SODA POP!", $51
	db "Thank you!", $51
	db "You can have this", $4f
	db "from me!@@"
; 0x9cc91

UnnamedText_9cc91: ; 9cc91 (27:4c91)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x9cca4

UnnamedText_9cca5: ; 9cca5 (27:4ca5)
	db $0, $51
	db "@"
	TX_RAM $cf4b
	db $0, " contains", $4f
	db "ROCK SLIDE!", $51
	db "It can spook the", $4f
	db "target sometimes!@@"
; 0x9cce6

UnnamedText_9cce6: ; 9cce6 (27:4ce6)
	db $0, "Yay!", $51
	db "LEMONADE!", $51
	db "Thank you!", $51
	db "You can have this", $4f
	db "from me!@@"
; 0x9cd1d

ReceivedTM49Text: ; 9cd1d (27:4d1d)
	db $0, $52, " received", $4f
	db "TM49!@@"
; 0x9cd30

UnnamedText_9cd30: ; 9cd30 (27:4d30)
	db $0, $51
	db "TM49 contains", $4f
	db "TRI ATTACK!@@"
; 0x9cd4d

UnnamedText_9cd4d: ; 9cd4d (27:4d4d)
	db $0, "You don't have", $4f
	db "space for this!@@"
; 0x9cd6d

UnnamedText_9cd6d: ; 9cd6d (27:4d6d)
	db $0, "No thank you!", $4f
	db "I'm not thirsty", $55
	db "after all!@@"
; 0x9cd97

_CeladonMartRoofText1: ; 9cd97 (27:4d97)
	db $0, "My sister is a", $4f
	db "trainer, believe", $55
	db "it or not.", $51
	db "But, she's so", $4f
	db "immature, she", $55
	db "drives me nuts!", $57

_UnnamedText_48598: ; 9cdee (27:4dee)
	db $0, "I'm thirsty!", $4f
	db "I want something", $55
	db "to drink!", $57
; 0x9cdee + 40 bytes

_UnnamedText_4859d: ; 9ce16 (27:4e16)
	db $0, "I'm thirsty!", $4f
	db "I want something", $55
	db "to drink!", $51
	db "Give her a drink?", $57
; 0x9ce16 + 58 bytes

_CeladonMartRoofText6: ; 9ce50 (27:4e50)
	db $0, "ROOFTOP SQUARE:", $4f
	db "VENDING MACHINES", $57

_UnnamedText_74f99: ; 9ce72 (27:4e72)
	db $0, "A vending machine!", $4f
	db "Here's the menu!", $58
; 0x9ce72 + 36 bytes

_UnnamedText_74fd3: ; 9ce96 (27:4e96)
	db $0, "Oops, not enough", $4f
	db "money!", $57
; 0x9ce96 + 25 bytes

_UnnamedText_74fd8: ; 9ceaf (27:4eaf)
	TX_RAM $cf4b
	db $0, $4f
	db "popped out!", $57
; 0x9ceaf + 17 bytes

_UnnamedText_74fdd: ; 9cec0 (27:4ec0)
	db $0, "There's no more", $4f
	db "room for stuff!", $57
; 0x9cec0 + 32 bytes

_UnnamedText_74fe2: ; 9cee0 (27:4ee0)
	db $0, "Not thirsty!", $57
; 0x9cee0 + 14 bytes

_CeladonMansion1Text1: ; 9ceee (27:4eee)
	db $0, "MEOWTH: Meow!@@"

_CeladonMansion1Text2: ; 9cefe (27:4efe)
	db $0, "My dear #MON", $4f
	db "keep me company.", $51
	db "MEOWTH even brings", $4f
	db "money home!", $57

_CeladonMansion1Text3: ; 9cf3c (27:4f3c)
	db $0, "CLEFAIRY: Pi", $4f
	db "pippippi!@@"

_CeladonMansion1Text4: ; 9cf55 (27:4f55)
	db $0, "NIDORAN: Kya", $4f
	db "kyaoo!@@"

_CeladonMansion1Text5: ; 9cf6b (27:4f6b)
	db $0, "CELADON MANSION", $4f
	db "Manager's Suite", $57

_CeladonMansion2Text1: ; 9cf8b (27:4f8b)
	db $0, "GAME FREAK", $4f
	db "Meeting Room", $57

_ProgrammerText: ; 9cfa4 (27:4fa4)
	db $0, "Me? I'm the", $4f
	db "programmer!", $57

_GraphicArtistText: ; 9cfbc (27:4fbc)
	db $0, "I'm the graphic", $4f
	db "artist!", $55
	db "I drew you!", $57

_WriterText: ; 9cfe0 (27:4fe0)
	db $0, "I wrote the story!", $4f
	db "Isn't ERIKA cute?", $51
	db "I like MISTY a", $4f
	db "lot too!", $51
	db "Oh, and SABRINA,", $4f
	db "I like her!", $57

_GameDesignerText: ; 9d03a (27:503a)
	db $0, "Is that right?", $51
	db "I'm the game", $4f
	db "designer!", $51
	db "Filling up your", $4f
	db "#DEX is tough,", $55
	db "but don't quit!", $51
	db "When you finish,", $4f
	db "come tell me!", $57
; 0x9d03a + 115 bytes

_CompletedDexText: ; 9d0ad (27:50ad)
	db $0, "Wow! Excellent!", $4f
	db "You completed", $55
	db "your #DEX!", $55
	db "Congratulations!", $55
	db "...@@"
; 0x9d0ed

_CeladonMansion3Text5: ; 9d0ed (27:50ed)
	db $0, "It's the game", $4f
	db "program! Messing", $55
	db "with it could bug", $55
	db "out the game!", $57

_CeladonMansion3Text6: ; 9d12c (27:512c)
	db $0, "Someone's playing", $4f
	db "a game instead of", $55
	db "working!", $57

_CeladonMansion3Text7: ; 9d159 (27:5159)
	db $0, "It's the script!", $4f
	db "Better not look", $55
	db "at the ending!", $57

_CeladonMansion3Text8: ; 9d189 (27:5189)
	db $0, "GAME FREAK", $4f
	db "Development Room", $57

_CeladonMansion4Text1: ; 9d1a6 (27:51a6)
	db $0, "I KNOW EVERYTHING!", $57

_CeladonMansion5Text1: ; 9d1ba (27:51ba)
	db $0, "I know everything", $4f
	db "about the world", $55
	db "of #MON in", $55
	db "your GAME BOY!", $51
	db "Get together with", $4f
	db "your friends and", $55
	db "trade #MON!", $57

_CeladonPokecenterText2: ; 9d226 (27:5226)
	db $0, "# FLUTE awakens", $4f
	db "#MON with a", $55
	db "sound that only", $55
	db "they can hear!", $57

_CeladonPokecenterText3: ; 9d262 (27:5262)
	db $0, "I rode uphill on", $4f
	db "CYCLING ROAD from", $55
	db "FUCHSIA!", $57

_UnnamedText_48a5e: ; 9d28f (27:528f)
	db $0, "Hello. Lovely", $4f
	db "weather isn't it?", $55
	db "It's so pleasant.", $51
	db "...Oh dear...", $4f
	db "I must have dozed", $55
	db "off. Welcome.", $51
	db "My name is ERIKA.", $4f
	db "I am the LEADER", $55
	db "of CELADON GYM.", $51
	db "I teach the art of", $4f
	db "flower arranging.", $55
	db "My #MON are of", $55
	db "the grass-type.", $51
	db "Oh, I'm sorry, I", $4f
	db "had no idea that", $55
	db "you wished to", $55
	db "challenge me.", $51
	db "Very well, but I", $4f
	db "shall not lose.", $57
; 0x9d28f + 307 bytes

_UnnamedText_48a63: ; 9d3c2 (27:53c2)
	db $0, "Oh!", $4f
	db "I concede defeat.", $51
	db "You are remarkably", $4f
	db "strong.", $51
	db "I must confer you", $4f
	db "the RAINBOWBADGE.", $58
; 0x9d3c2 + 86 bytes

_UnnamedText_48a68: ; 9d418 (27:5418)
	db $0, "You are cataloging", $4f
	db "#MON? I must", $55
	db "say I'm impressed.", $51
	db "I would never", $4f
	db "collect #MON", $55
	db "if they were", $55
	db "unattractive.", $57
; 0x9d418 + 105 bytes

_UnnamedText_48a6d: ; 9d481 (27:5481)
	db $0, "The RAINBOWBADGE", $4f
	db "will make #MON", $55
	db "up to L50 obey.", $51
	db "It also allows", $4f
	db "#MON to use", $55
	db "STRENGTH in and", $55
	db "out of battle.", $51
	db "Please also take", $4f
	db "this with you.", $57
; 0x9d481 + 139 bytes

_ReceivedTM21Text: ; 9d50c (27:550c)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x9d520

_TM21ExplanationText: ; 9d520 (27:5520)
	db $0, $51
	db "TM21 contains", $4f
	db "MEGA DRAIN.", $51
	db "Half the damage", $4f
	db "it inflicts is", $55
	db "drained to heal", $55
	db "your #MON!", $57
; 0x9d520 + 86 bytes

_TM21NoRoomText: ; 9d576 (27:5576)
	db $0, "You should make", $4f
	db "room for this.", $57
; 0x9d576 + 32 bytes

_CeladonGymBattleText2: ; 9d596 (27:5596)
	db $0, "Hey!", $51
	db "You are not", $4f
	db "allowed in here!", $57
; 0x9d596 + 35 bytes

_CeladonGymEndBattleText2: ; 9d5b9 (27:55b9)
	db $0, "You're", $4f
	db "too rough!", $58
; 0x9d5b9 + 18 bytes

_CeladonGymAfterBattleText2: ; 9d5cb (27:55cb)
	db $0, "Bleaah!", $4f
	db "I hope ERIKA", $55
	db "wipes you out!", $57
; 0x9d5cb + 37 bytes

_CeladonGymBattleText3: ; 9d5f0 (27:55f0)
	db $0, "I was getting", $4f
	db "bored.", $57
; 0x9d5f0 + 22 bytes

_CeladonGymEndBattleText3: ; 9d606 (27:5606)
	db $0, "My", $4f
	db "makeup!", $58
; 0x9d606 + 12 bytes

_CeladonGymAfterBattleText3: ; 9d612 (27:5612)
	db $0, "Grass-type #MON", $4f
	db "are tough against", $55
	db "the water-type!", $51
	db "They also have an", $4f
	db "edge on rock and", $55
	db "ground #MON!", $57
; 0x9d612 + 99 bytes

_CeladonGymBattleText4: ; 9d675 (27:5675)
	db $0, "Aren't you the", $4f
	db "peeping Tom?", $57
; 0x9d675 + 28 bytes

_CeladonGymEndBattleText4: ; 9d691 (27:5691)
	db $0, "I'm", $4f
	db "in shock!", $58
; 0x9d691 + 14 bytes

_CeladonGymAfterBattleText4: ; 9d69f (27:569f)
	db $0, "Oh, you weren't", $4f
	db "peeping? We get a", $55
	db "lot of gawkers!", $57
; 0x9d69f + 50 bytes

_CeladonGymBattleText5: ; 9d6d1 (27:56d1)
	db $0, "Look at my grass", $4f
	db "#MON!", $51
	db "They're so easy", $4f
	db "to raise!", $57
; 0x9d6d1 + 49 bytes

_CeladonGymEndBattleText5: ; 9d702 (27:5702)
	db $0, "No!", $58
; 0x9d702 + 5 bytes

_CeladonGymAfterBattleText5: ; 9d707 (27:5707)
	db $0, "We only use grass-", $4f
	db "type #MON at", $55
	db "our GYM!", $51
	db "We also use them", $4f
	db "for making flower", $55
	db "arrangements!", $57
; 0x9d707 + 91 bytes

_CeladonGymBattleText6: ; 9d762 (27:5762)
	db $0, "Don't bring any", $4f
	db "bugs or fire", $55
	db "#MON in here!", $57
; 0x9d762 + 43 bytes

_CeladonGymEndBattleText6: ; 9d78d (27:578d)
	db $0, "Oh!", $4f
	db "You!", $58
; 0x9d78d + 10 bytes

_CeladonGymAfterBattleText6: ; 9d797 (27:5797)
	db $0, "Our LEADER, ERIKA,", $4f
	db "might be quiet,", $55
	db "but she's also", $55
	db "very skilled!", $57
; 0x9d797 + 64 bytes

_CeladonGymBattleText7: ; 9d7d7 (27:57d7)
	db $0, "Pleased to meet", $4f
	db "you. My hobby is", $55
	db "#MON training.", $57
; 0x9d7d7 + 49 bytes

_CeladonGymEndBattleText7: ; 9d808 (27:5808)
	db $0, "Oh!", $4f
	db "Splendid!", $58
; 0x9d808 + 15 bytes

_CeladonGymAfterBattleText7: ; 9d817 (27:5817)
	db $0, "I have a blind", $4f
	db "date coming up.", $55
	db "I have to learn", $55
	db "to be polite.", $57
; 0x9d817 + 62 bytes

_CeladonGymBattleText8: ; 9d855 (27:5855)
	db $0, "Welcome to", $4f
	db "CELADON GYM!", $51
	db "You better not", $4f
	db "underestimate", $55
	db "girl power!", $57
; 0x9d855 + 66 bytes

_CeladonGymEndBattleText8: ; 9d897 (27:5897)
	db $0, "Oh!", $4f
	db "Beaten!", $58
; 0x9d897 + 13 bytes

_CeladonGymAfterBattleText8: ; 9d8a4 (27:58a4)
	db $0, "I didn't bring my", $4f
	db "best #MON!", $51
	db "Wait 'til next", $4f
	db "time!", $57
; 0x9d8a4 + 49 bytes

_CeladonGameCornerText1: ; 9d8d5 (27:58d5)
	db $0, "Welcome!", $51
	db "You can exchange", $4f
	db "your coins for", $55
	db "fabulous prizes", $55
	db "next door.", $57

_UnnamedText_48d22: ; 9d91a (27:591a)
	db $0, "Welcome to ROCKET", $4f
	db "GAME CORNER!", $51
	db "Do you need some", $4f
	db "game coins?", $51
	db "It's ¥1000 for 50", $4f
	db "coins. Would you", $55
	db "like some?", $57
; 0x9d91a + 106 bytes

_UnnamedText_48d27: ; 9d984 (27:5984)
	db $0, "Thanks! Here are", $4f
	db "your 50 coins!", $57
; 0x9d984 + 33 bytes

_UnnamedText_48d2c: ; 9d9a5 (27:59a5)
	db $0, "No? Please come", $4f
	db "play sometime!", $57
; 0x9d9a5 + 32 bytes

_UnnamedText_48d31: ; 9d9c5 (27:59c5)
	db $0, "You can't afford", $4f
	db "the coins!", $57
; 0x9d9c5 + 28 bytes

_UnnamedText_48d36: ; 9d9e1 (27:59e1)
	db $0, "Oops! Your COIN", $4f
	db "CASE is full.", $57
; 0x9d9e1 + 31 bytes

_UnnamedText_48d3b: ; 9da00 (27:5a00)
	db $0, "You don't have a", $4f
	db "COIN CASE!", $57
; 0x9da00 + 28 bytes

_CeladonGameCornerText3: ; 9da1c (27:5a1c)
	db $0, "Keep this quiet.", $51
	db "It's rumored that", $4f
	db "this place is run", $55
	db "by TEAM ROCKET.", $57

_CeladonGameCornerText4: ; 9da61 (27:5a61)
	db $0, "I think these", $4f
	db "machines have", $55
	db "different odds.", $57

_UnnamedText_48d9c: ; 9da8e (27:5a8e)
	db $0, "Kid, do you want", $4f
	db "to play?", $58
; 0x9da8e + 27 bytes

_Received10CoinsText: ; 9daa9 (27:5aa9)
	db $0, $52, " received", $4f
	db "10 coins!@@"
; 0x9dac0

_UnnamedText_48da7: ; 9dac0 (27:5ac0)
	db $0, "You don't need my", $4f
	db "coins!", $57
; 0x9dac0 + 25 bytes

_UnnamedText_48dac: ; 9dad9 (27:5ad9)
	db $0, "Wins seem to come", $4f
	db "and go.", $57
; 0x9dad9 + 27 bytes

_CeladonGameCornerText6: ; 9daf4 (27:5af4)
	db $0, "I'm having a", $4f
	db "wonderful time!", $57

_UnnamedText_48dca: ; 9db11 (27:5b11)
	db $0, "Hey!", $51
	db "You have better", $4f
	db "things to do,", $55
	db "champ in making!", $51
	db "CELADON GYM's", $4f
	db "LEADER is ERIKA!", $55
	db "She uses grass-", $55
	db "type #MON!", $51
	db "She might appear", $4f
	db "docile, but don't", $55
	db "be fooled!", $57
; 0x9db11 + 155 bytes

_UnnamedText_48dcf: ; 9dbac (27:5bac)
	db $0, "They offer rare", $4f
	db "#MON that can", $55
	db "be exchanged for", $55
	db "your coins.", $51
	db "But, I just can't", $4f
	db "seem to win!", $57
; 0x9dbac + 90 bytes

_CeladonGameCornerText8: ; 9dc06 (27:5c06)
	db $0, "Games are scary!", $4f
	db "It's so easy to", $55
	db "get hooked!", $57

_UnnamedText_48e26: ; 9dc33 (27:5c33)
	db $0, "What's up? Want", $4f
	db "some coins?", $58
; 0x9dc33 + 28 bytes

_Received20CoinsText: ; 9dc4f (27:5c4f)
	db $0, $52, " received", $4f
	db "20 coins!@@"
; 0x9dc66

_UnnamedText_48e31: ; 9dc66 (27:5c66)
	db $0, "You have lots of", $4f
	db "coins!", $57
; 0x9dc66 + 25 bytes

_UnnamedText_48e36: ; 9dc7f (27:5c7f)
	db $0, "Darn! I need more", $4f
	db "coins for the", $55
	db "#MON I want!", $57
; 0x9dc7f + 46 bytes

_UnnamedText_48e88: ; 9dcad (27:5cad)
	db $0, "Hey, what? You're", $4f
	db "throwing me off!", $55
	db "Here are some", $55
	db "coins, shoo!", $58
; 0x9dcad + 62 bytes

_UnnamedText_48e8d: ; 9dceb (27:5ceb)
	db $0, $52, " received", $4f
	db "20 coins!@@"
; 0x9dd02

_UnnamedText_48e93: ; 9dd02 (27:5d02)
	db $0, "You've got your", $4f
	db "own coins!", $57
; 0x9dd02 + 27 bytes

_UnnamedText_48e98: ; 9dd1d (27:5d1d)
	db $0, "The trick is to", $4f
	db "watch the reels", $55
	db "closely!", $57
; 0x9dd1d + 42 bytes

_UnnamedText_48ece: ; 9dd47 (27:5d47)
	db $0, "I'm guarding this", $4f
	db "poster!", $55
	db "Go away, or else!", $57
; 0x9dd47 + 44 bytes

_UnnamedText_48ed3: ; 9dd73 (27:5d73)
	db $0, "Dang!", $58
; 0x9dd73 + 7 bytes

_UnnamedText_48ed8: ; 9dd7a (27:5d7a)
	db $0, "Our hideout might", $4f
	db "be discovered! I", $55
	db "better tell BOSS!", $57
; 0x9dd7a + 54 bytes

_UnnamedText_48f09: ; 9ddb0 (27:5db0)
	db $0, "Hey!", $51
	db "A switch behind", $4f
	db "the poster!?", $55
	db "Let's push it!@@"
; 0x9dde2

_UnnamedText_48f19: ; 9dde2 (27:5de2)
	db $0, "Oops! Forgot the", $4f
	db "COIN CASE!", $57
; 0x9dde2 + 29 bytes

_CeladonMart5Text1: ; 9ddff (27:5dff)
	db $0, "#MON ability", $4f
	db "enhancers can be", $55
	db "bought only here.", $51
	db "Use CALCIUM to", $4f
	db "increase SPECIAL", $55
	db "abilities.", $51
	db "Use CARBOS to", $4f
	db "increase SPEED.", $57

_CeladonMart5Text2: ; 9de79 (27:5e79)
	db $0, "I'm here for", $4f
	db "#MON ability", $55
	db "enhancers.", $51
	db "PROTEIN increases", $4f
	db "ATTACK power.", $51
	db "IRON increases", $4f
	db "DEFENSE!", $57

_CeladonMart5Text5: ; 9ded6 (27:5ed6)
	db $0, "5F: DRUG STORE", $57

_CeladonPrizeRoomText1: ; 9dee6 (27:5ee6)
	db $0, "I sure do fancy", $4f
	db "that PORYGON!", $51
	db "But, it's hard to", $4f
	db "win at slots!", $57

_CeladonPrizeRoomText2: ; 9df24 (27:5f24)
	db $0, "I had a major", $4f
	db "haul today!", $57

_CeladonDinerText1: ; 9df3f (27:5f3f)
	db $0, "Hi!", $51
	db "We're taking a", $4f
	db "break now.", $57

_CeladonDinerText2: ; 9df5d (27:5f5d)
	db $0, "My #MON are", $4f
	db "weak, so I often", $55
	db "have to go to the", $55
	db "DRUG STORE.", $57

_CeladonDinerText3: ; 9df99 (27:5f99)
	db $0, "Psst! There's a", $4f
	db "basement under", $55
	db "the GAME CORNER.", $57

_CeladonDinerText4: ; 9dfc9 (27:5fc9)
	db $0, "Munch...", $51
	db "The man at that", $4f
	db "table lost it all", $55
	db "at the slots.", $57

_UnnamedText_491a7: ; 9e003 (27:6003)
	db $0, "Go ahead! Laugh!", $51
	db "I'm flat out", $4f
	db "busted!", $51
	db "No more slots for", $4f
	db "me! I'm going", $55
	db "straight!", $51
	db "Here! I won't be", $4f
	db "needing this any-", $55
	db "more!", $58
; 0x9e003 + 119 bytes

_ReceivedCoinCaseText: ; 9e07a (27:607a)
	db $0, $52, " received", $4f
	db "a @"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x9e090

_CoinCaseNoRoomText: ; 9e090 (27:6090)
	db $0, "Make room for", $4f
	db "this!", $57
; 0x9e090 + 21 bytes

_UnnamedText_491b7: ; 9e0a5 (27:60a5)
	db $0, "I always thought", $4f
	db "I was going to", $55
	db "win it back...", $57
; 0x9e0a5 + 48 bytes

_CeladonHouseText1: ; 9e0d5 (27:60d5)
	db $0, "Hehehe! The slots", $4f
	db "just reel in the", $55
	db "dough, big time!", $57

_CeladonHouseText2: ; 9e10a (27:610a)
	db $0, "CHIEF!", $51
	db "We just shipped", $4f
	db "2000 #MON as", $55
	db "slot prizes!", $57

_CeladonHouseText3: ; 9e13c (27:613c)
	db $0, "Don't touch the", $4f
	db "poster at the", $55
	db "GAME CORNER!", $51
	db "There's no secret", $4f
	db "switch behind it!", $57

_CeladonHotelText1: ; 9e18a (27:618a)
	db $0, "#MON? No, this", $4f
	db "is a hotel for", $55
	db "people.", $51
	db "We're full up.", $57

_CeladonHotelText2: ; 9e1bf (27:61bf)
	db $0, "I'm on vacation", $4f
	db "with my brother", $55
	db "and boy friend.", $51
	db "CELADON is such a", $4f
	db "pretty city!", $57

_CeladonHotelText3: ; 9e20e (27:620e)
	db $0, "Why did she bring", $4f
	db "her brother?", $57

_FuchsiaMartText2: ; 9e22e (27:622e)
	db $0, "Do you have a", $4f
	db "SAFARI ZONE flag?", $51
	db "What about cards", $4f
	db "or calendars?", $57

_FuchsiaMartText3: ; 9e26e (27:626e)
	db $0, "Did you try X", $4f
	db "SPEED? It speeds", $55
	db "up a #MON in", $55
	db "battle!", $57

_FuchsiaHouse1Text1: ; 9e2a3 (27:62a3)
	db $0, "SAFARI ZONE's", $4f
	db "WARDEN is old,", $55
	db "but still active!", $51
	db "All his teeth are", $4f
	db "false, though.", $57

_FuchsiaHouse1Text2: ; 9e2f3 (27:62f3)
	db $0, "Hmm? You've met", $4f
	db "BILL?", $51
	db "He's my grandson!", $51
	db "He always liked", $4f
	db "collecting things", $55
	db "even as a child!", $57

_FuchsiaHouse1Text3: ; 9e34d (27:634d)
	db $0, "BILL files his", $4f
	db "own #MON data", $55
	db "on his PC!", $51
	db "Did he show you?", $57

_FuchsiaPokecenterText1: ; 9e387 (27:6387)
	db $0, "You can't win", $4f
	db "with just one", $55
	db "strong #MON.", $51
	db "It's tough, but", $4f
	db "you have to raise", $55
	db "them evenly.", $57

_FuchsiaPokecenterText3: ; 9e3de (27:63de)
	db $0, "There's a narrow", $4f
	db "trail west of", $55
	db "VIRIDIAN CITY.", $51
	db "It goes to #MON", $4f
	db "LEAGUE HQ.", $55
	db "The HQ governs", $55
	db "all trainers.", $57

_WardenGibberishText1: ; 9e444 (27:6444)
	db $0, "WARDEN: Hif fuff", $4f
	db "hefifoo!", $51
	db "Ha lof ha feef ee", $4f
	db "hafahi ho. Heff", $55
	db "hee fwee!", $57
; 0x9e444 + 71 bytes

_WardenGibberishText2: ; 9e48b (27:648b)
	db $0, "Ah howhee ho hoo!", $4f
	db "Eef ee hafahi ho!", $57
; 0x9e48b + 37 bytes

_WardenGibberishText3: ; 9e4b0 (27:64b0)
	db $0, "Ha? He ohay heh", $4f
	db "ha hoo ee haheh!", $57
; 0x9e4b0 + 34 bytes

_WardenTeethText1: ; 9e4d2 (27:64d2)
	db $0, $52, " gave the", $4f
	db "GOLD TEETH to the", $55
	db "WARDEN!@@"
; 0x9e4f9

_WardenTeethText2: ; 9e4f9 (27:64f9)
	db $0, $51
	db "The WARDEN popped", $4f
	db "in his teeth!", $58
; 0x9e4f9 + 34 bytes

_WardenThankYouText: ; 9e51b (27:651b)
	db $0, "WARDEN: Thanks,", $4f
	db "kid! No one could", $55
	db "understand a word", $55
	db "that I said.", $51
	db "I couldn't work", $4f
	db "that way.", $55
	db "Let me give you", $55
	db "something for", $55
	db "your trouble.", $58
; 0x9e51b + 135 bytes

_ReceivedHM04Text: ; 9e5a2 (27:65a2)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0x9e5b6

_HM04ExplanationText: ; 9e5b6 (27:65b6)
	db $0, "WARDEN: HM04", $4f
	db "teaches STRENGTH!", $51
	db "It lets #MON", $4f
	db "move boulders", $55
	db "when you're out-", $55
	db "side of battle.", $51
	db "Oh yes, did you", $4f
	db "find SECRET HOUSE", $55
	db "in SAFARI ZONE?", $51
	db "If you do, you", $4f
	db "win an HM!", $51
	db "I hear it's the", $4f
	db "rare SURF HM.", $57
; 0x9e5b6 + 196 bytes

_HM04NoRoomText: ; 9e67a (27:667a)
	db $0, "Your pack is", $4f
	db "stuffed full!", $57
; 0x9e67a + 28 bytes

_UnnamedText_75176: ; 9e696 (27:6696)
	db $0, "#MON photos", $4f
	db "and fossils.", $57
; 0x9e696 + 26 bytes

_UnnamedText_7517b: ; 9e6b0 (27:66b0)
	db $0, "Old #MON", $4f
	db "merchandise.", $57
; 0x9e6b0 + 23 bytes

_SafariZoneEntranceText1: ; 9e6c7 (27:66c7)
	db $0, "Welcome to the", $4f
	db "SAFARI ZONE!", $57

UnnamedText_9e6e4: ; 9e6e4 (27:66e4)
	db $0, "For just ¥500,", $4f
	db "you can catch all", $55
	db "the #MON you", $55
	db "want in the park!", $51
	db "Would you like to", $4f
	db "join the hunt?@@"
; 0x9e747

UnnamedText_9e747: ; 9e747 (27:6747)
	db $0, "That'll be ¥500", $4f
	db "please!", $51
	db "We only use a", $4f
	db "special # BALL", $55
	db "here.", $51
	db $52, " received", $4f
	db "30 SAFARI BALLs!@@"
; 0x9e79f

_UnnamedText_75360: ; 9e79f (27:679f)
	db $0, $51
	db "We'll call you on", $4f
	db "the PA when you", $55
	db "run out of time", $55
	db "or SAFARI BALLs!", $57
; 0x9e79f + 68 bytes

_UnnamedText_75365: ; 9e7e3 (27:67e3)
	db $0, "OK! Please come", $4f
	db "again!", $57
; 0x9e7e3 + 24 bytes

_UnnamedText_7536a: ; 9e7fb (27:67fb)
	db $0, "Oops! Not enough", $4f
	db "money!", $57
; 0x9e7fb + 25 bytes

UnnamedText_9e814: ; 9e814 (27:6814)
	db $0, "Leaving early?@@"
; 0x9e825

_UnnamedText_753bb: ; 9e825 (27:6825)
	db $0, "Please return any", $4f
	db "SAFARI BALLs you", $55
	db "have left.", $57
; 0x9e825 + 47 bytes

_UnnamedText_753c0: ; 9e854 (27:6854)
	db $0, "Good Luck!", $57
; 0x9e854 + 12 bytes

_UnnamedText_753c5: ; 9e860 (27:6860)
	db $0, "Did you get a", $4f
	db "good haul?", $55
	db "Come again!", $57
; 0x9e860 + 38 bytes

_UnnamedText_753e6: ; 9e886 (27:6886)
	db $0, "Hi! Is it your", $4f
	db "first time here?", $57
; 0x9e886 + 33 bytes

_UnnamedText_753eb: ; 9e8a7 (27:68a7)
	db $0, "SAFARI ZONE has 4", $4f
	db "zones in it.", $51
	db "Each zone has", $4f
	db "different kinds", $55
	db "of #MON. Use", $55
	db "SAFARI BALLs to", $55
	db "catch them!", $51
	db "When you run out", $4f
	db "of time or SAFARI", $55
	db "BALLs, it's game", $55
	db "over for you!", $51
	db "Before you go,", $4f
	db "open an unused", $55
	db "#MON BOX so", $55
	db "there's room for", $55
	db "new #MON!", $57
; 0x9e8a7 + 236 bytes

_UnnamedText_753f0: ; 9e993 (27:6993)
	db $0, "Sorry, you're a", $4f
	db "regular here!", $57
; 0x9e993 + 30 bytes

_UnnamedText_75581: ; 9e9b1 (27:69b1)
	db $0, "KOGA: Fwahahaha!", $51
	db "A mere child like", $4f
	db "you dares to", $55
	db "challenge me?", $51
	db "Very well, I", $4f
	db "shall show you", $55
	db "true terror as a", $55
	db "ninja master!", $51
	db "You shall feel", $4f
	db "the despair of", $55
	db "poison and sleep", $55
	db "techniques!", $57
; 0x9e9b1 + 181 bytes

_UnnamedText_75586: ; 9ea66 (27:6a66)
	db $0, "Humph!", $4f
	db "You have proven", $55
	db "your worth!", $51
	db "Here! Take the", $4f
	db "SOULBADGE!", $58
; 0x9ea66 + 62 bytes

SECTION "bank28",ROMX,BANK[$28]

_UnnamedText_7558b: ; a0000 (28:4000)
	db $0, "When afflicted by", $4f
	db "TOXIC, #MON", $55
	db "suffer more and", $55
	db "more as battle", $55
	db "progresses!", $51
	db "It will surely", $4f
	db "terrorize foes!", $57
; 0xa0000 + 105 bytes

_UnnamedText_75590: ; a0069 (28:4069)
	db $0, "Now that you have", $4f
	db "the SOULBADGE,", $55
	db "the DEFENSE of", $55
	db "your #MON", $55
	db "increases!", $51
	db "It also lets you", $4f
	db "SURF outside of", $55
	db "battle!", $51
	db "Ah! Take this", $4f
	db "too!", $57
; 0xa0069 + 130 bytes

_ReceivedTM06Text: ; a00eb (28:40eb)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"

_TM06ExplanationText: ; a00ff (28:40ff)
	db $0, $51
	db "TM06 contains", $4f
	db "TOXIC!", $51
	db "It is a secret", $4f
	db "technique over", $55
	db "400 years old!", $57
; 0xa00ff + 68 bytes

_TM06NoRoomText: ; a0143 (28:4143)
	db $0, "Make space for", $4f
	db "this, child!", $57
; 0xa0143 + 29 bytes

_FuchsiaGymBattleText1: ; a0160 (28:4160)
	db $0, "Strength isn't", $4f
	db "the key for", $55
	db "#MON!", $51
	db "It's strategy!", $51
	db "I'll show you how", $4f
	db "strategy can beat", $55
	db "brute strength!", $57
; 0xa0160 + 98 bytes

_FuchsiaGymEndBattleText1: ; a01c2 (28:41c2)
	db $0, "What?", $4f
	db "Extraordinary!", $58
; 0xa01c2 + 22 bytes

_FuchsiaGymAfterBattleText1: ; a01d8 (28:41d8)
	db $0, "So, you mix brawn", $4f
	db "with brains?", $55
	db "Good strategy!", $57
; 0xa01d8 + 47 bytes

_FuchsiaGymBattleText2: ; a0207 (28:4207)
	db $0, "I wanted to become", $4f
	db "a ninja, so I", $55
	db "joined this GYM!", $57
; 0xa0207 + 51 bytes

_FuchsiaGymEndBattleText2: ; a023a (28:423a)
	db $0, "I'm done", $4f
	db "for!", $58
; 0xa023a + 14 bytes

_FuchsiaGymAfterBattleText2: ; a0248 (28:4248)
	db $0, "I will keep on", $4f
	db "training under", $55
	db "KOGA, my ninja", $55
	db "master!", $57
; 0xa0248 + 54 bytes

_FuchsiaGymBattleText3: ; a027e (28:427e)
	db $0, "Let's see you", $4f
	db "beat my special", $55
	db "techniques!", $57
; 0xa027e + 42 bytes

_FuchsiaGymEndBattleText3: ; a02a8 (28:42a8)
	db $0, "You", $4f
	db "had me fooled!", $58
; 0xa02a8 + 20 bytes

_FuchsiaGymAfterBattleText3: ; a02bc (28:42bc)
	db $0, "I like poison and", $4f
	db "sleep techniques,", $55
	db "as they linger", $55
	db "after battle!", $57
; 0xa02bc + 66 bytes

_FuchsiaGymBattleText4: ; a02fe (28:42fe)
	db $0, "Stop right there!", $51
	db "Our invisible", $4f
	db "walls have you", $55
	db "frustrated?", $57
; 0xa02fe + 60 bytes

_FuchsiaGymEndBattleText4: ; a033a (28:433a)
	db $0, "Whoa!", $4f
	db "He's got it!", $58
; 0xa033a + 19 bytes

_FuchsiaGymAfterBattleText4: ; a034d (28:434d)
	db $0, "You impressed me!", $4f
	db "Here's a hint!", $51
	db "Look very closely", $4f
	db "for gaps in the", $55
	db "invisible walls!", $57
; 0xa034d + 84 bytes

_FuchsiaGymBattleText5: ; a03a1 (28:43a1)
	db $0, "I also study the", $4f
	db "way of the ninja", $55
	db "with master KOGA!", $51
	db "Ninja have a long", $4f
	db "history of using", $55
	db "animals!", $57
; 0xa03a1 + 97 bytes

_FuchsiaGymEndBattleText5: ; a0402 (28:4402)
	db $0, "Awoo!", $58
; 0xa0402 + 7 bytes

_FuchsiaGymAfterBattleText5: ; a0409 (28:4409)
	db $0, "I still have much", $4f
	db "to learn!", $57
; 0xa0409 + 29 bytes

_FuchsiaGymBattleText6: ; a0426 (28:4426)
	db $0, "Master KOGA comes", $4f
	db "from a long line", $55
	db "of ninjas!", $51
	db "What did you", $4f
	db "descend from?", $57
; 0xa0426 + 74 bytes

_FuchsiaGymEndBattleText6: ; a0470 (28:4470)
	db $0, "Dropped", $4f
	db "my balls!", $58
; 0xa0470 + 19 bytes

_FuchsiaGymAfterBattleText6: ; a0483 (28:4483)
	db $0, "Where there is", $4f
	db "light, there is", $55
	db "shadow!", $51
	db "Light and shadow!", $4f
	db "Which do you", $55
	db "choose?", $57
; 0xa0483 + 79 bytes

_UnnamedText_7564e: ; a04d2 (28:44d2)
	db $0, "Yo! Champ in", $4f
	db "making!", $51
	db "FUCHSIA GYM is", $4f
	db "riddled with", $55
	db "invisible walls!", $51
	db "KOGA might appear", $4f
	db "close, but he's", $55
	db "blocked off!", $51
	db "You have to find", $4f
	db "gaps in the walls", $55
	db "to reach him!", $57
; 0xa04d2 + 162 bytes

_UnnamedText_75653: ; a0574 (28:4574)
	db $0, "It's amazing how", $4f
	db "ninja can terrify", $55
	db "even now!", $57
; 0xa0574 + 45 bytes

_FuchsiaMeetingRoomText1: ; a05a1 (28:45a1)
	db $0, "We nicknamed the", $4f
	db "WARDEN SLOWPOKE.", $51
	db "He and SLOWPOKE", $4f
	db "both look vacant!", $57

_FuchsiaMeetingRoomText2: ; a05e6 (28:45e6)
	db $0, "SLOWPOKE is very", $4f
	db "knowledgeable", $55
	db "about #MON!", $51
	db "He even has some", $4f
	db "fossils of rare,", $55
	db "extinct #MON!", $57

_FuchsiaMeetingRoomText3: ; a0642 (28:4642)
	db $0, "SLOWPOKE came in,", $4f
	db "but I couldn't", $55
	db "understand him.", $51
	db "I think he's got", $4f
	db "a speech problem!", $57

_UnnamedText_561bd: ; a0695 (28:4695)
	db $0, "I'm the FISHING", $4f
	db "GURU's older", $55
	db "brother!", $51
	db "I simply Looove", $4f
	db "fishing!", $51
	db "Do you like to", $4f
	db "fish?", $57
; 0xa0695 + 83 bytes

_UnnamedText_561c2: ; a06e8 (28:46e8)
	db $0, "Grand! I like", $4f
	db "your style!", $51
	db "Take this and", $4f
	db "fish, young one!", $51
	db $52, " received", $4f
	db "a @"
	TX_RAM $cf4b
	db $0, "!@@"
; 0xa0737

_UnnamedText_56212: ; a0737 (28:4737)
	db $0, "Oh... That's so", $4f
	db "disappointing...", $57
; 0xa0737 + 33 bytes

_UnnamedText_56217: ; a0758 (28:4758)
	db $0, "Hello there,", $4f
	db $52, "!", $51
	db "How are the fish", $4f
	db "biting?", $57
; 0xa0758 + 42 bytes

_UnnamedText_5621c: ; a0782 (28:4782)
	db $0, "Oh no!", $51
	db "You have no room", $4f
	db "for my gift!", $57
; 0xa0782 + 38 bytes

_Mansion1BattleText2: ; a07a8 (28:47a8)
	db $0, "Who are you? There", $4f
	db "shouldn't be", $55
	db "anyone here.", $57
; 0xa07a8 + 45 bytes

_Mansion1EndBattleText2: ; a07d5 (28:47d5)
	db $0, "Ouch!", $58
; 0xa07d5 + 7 bytes

_Mansion1AfterBattleText2: ; a07dc (28:47dc)
	db $0, "A key? I don't", $4f
	db "know what you're", $55
	db "talking about.", $57
; 0xa07dc + 46 bytes

_UnnamedText_44395: ; a080a (28:480a)
	db $0, "A secret switch!", $51
	db "Press it?", $57
; 0xa080a + 28 bytes

_UnnamedText_4439a: ; a0826 (28:4826)
	db $0, "Who wouldn't?", $58
; 0xa0826 + 14 bytes

_UnnamedText_4439f: ; a0834 (28:4834)
	db $0, "Not quite yet!", $57
; 0xa0834 + 16 bytes

_UnnamedText_75914: ; a0844 (28:4844)
	db $0, "Hah!", $51
	db "I am BLAINE! I", $4f
	db "am the LEADER of", $55
	db "CINNABAR GYM!", $51
	db "My fiery #MON", $4f
	db "will incinerate", $55
	db "all challengers!", $51
	db "Hah! You better", $4f
	db "have BURN HEAL!", $57
; 0xa0844 + 131 bytes

UnnamedText_a08c7: ; a08c7 (28:48c7)
	db $0, "I have", $4f
	db "burnt out!", $51
	db "You have earned", $4f
	db "the VOLCANOBADGE!@@"
; 0xa08fd

_UnnamedText_75920: ; a08fd (28:48fd)
	db $0, "FIRE BLAST is the", $4f
	db "ultimate fire", $55
	db "technique!", $51
	db "Don't waste it on", $4f
	db "water #MON!", $57
; 0xa08fd + 73 bytes

_UnnamedText_75925: ; a0946 (28:4946)
	db $0, "Hah!", $51
	db "The VOLCANOBADGE", $4f
	db "heightens the", $55
	db "SPECIAL abilities", $55
	db "of your #MON!", $51
	db "Here, you can", $4f
	db "have this too!", $57
; 0xa0946 + 98 bytes

_ReceivedTM38Text: ; a09a8 (28:49a8)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0xa09bc

_TM38ExplanationText: ; a09bc (28:49bc)
	db $0, $51
	db "TM38 contains", $4f
	db "FIRE BLAST!", $51
	db "Teach it to fire-", $4f
	db "type #MON!", $51
	db "CHARMELEON or", $4f
	db "PONYTA would be", $55
	db "good bets!", $57
; 0xa09bc + 98 bytes

_TM38NoRoomText: ; a0a1e (28:4a1e)
	db $0, "Make room for my", $4f
	db "gift!", $57
; 0xa0a1e + 24 bytes

_UnnamedText_7595f: ; a0a36 (28:4a36)
	db $0, "Do you know how", $4f
	db "hot #MON fire", $55
	db "breath can get?", $57
; 0xa0a36 + 47 bytes

_UnnamedText_75964: ; a0a65 (28:4a65)
	db $0, "Yow!", $4f
	db "Hot, hot, hot!", $58
; 0xa0a65 + 21 bytes

_UnnamedText_75969: ; a0a7a (28:4a7a)
	db $0, "Fire, or to be", $4f
	db "more precise,", $55
	db "combustion...", $51
	db "Blah, blah, blah,", $4f
	db "blah...", $57
; 0xa0a7a + 70 bytes

_UnnamedText_75994: ; a0ac0 (28:4ac0)
	db $0, "I was a thief, but", $4f
	db "I became straight", $55
	db "as a trainer!", $57
; 0xa0ac0 + 52 bytes

_UnnamedText_75999: ; a0af4 (28:4af4)
	db $0, "I", $4f
	db "surrender!", $58
; 0xa0af4 + 14 bytes

_UnnamedText_7599e: ; a0b02 (28:4b02)
	db $0, "I can't help", $4f
	db "stealing other", $55
	db "people's #MON!", $57
; 0xa0b02 + 42 bytes

_UnnamedText_759c9: ; a0b2c (28:4b2c)
	db $0, "You can't win!", $4f
	db "I have studied", $55
	db "#MON totally!", $57
; 0xa0b2c + 44 bytes

_UnnamedText_759ce: ; a0b58 (28:4b58)
	db $0, "Waah!", $4f
	db "My studies!", $58
; 0xa0b58 + 19 bytes

_UnnamedText_759d3: ; a0b6b (28:4b6b)
	db $0, "My theories are", $4f
	db "too complicated", $55
	db "for you!", $57
; 0xa0b6b + 42 bytes

_UnnamedText_759fe: ; a0b95 (28:4b95)
	db $0, "I just like using", $4f
	db "fire #MON!", $57
; 0xa0b95 + 30 bytes

_UnnamedText_75a03: ; a0bb3 (28:4bb3)
	db $0, "Too hot", $4f
	db "to handle!", $58
; 0xa0bb3 + 20 bytes

_UnnamedText_75a08: ; a0bc7 (28:4bc7)
	db $0, "I wish there was", $4f
	db "a thief #MON!", $55
	db "I'd use that!", $57
; 0xa0bc7 + 45 bytes

_UnnamedText_75a33: ; a0bf4 (28:4bf4)
	db $0, "I know why BLAINE", $4f
	db "became a trainer!", $57
; 0xa0bf4 + 37 bytes

_UnnamedText_75a38: ; a0c19 (28:4c19)
	db $0, "Ow!", $58
; 0xa0c19 + 5 bytes

_UnnamedText_75a3d: ; a0c1e (28:4c1e)
	db $0, "BLAINE was lost", $4f
	db "in the mountains", $55
	db "when a fiery bird", $55
	db "#MON appeared.", $51
	db "Its light enabled", $4f
	db "BLAINE to find", $55
	db "his way down!", $57
; 0xa0c1e + 114 bytes

_UnnamedText_75a68: ; a0c90 (28:4c90)
	db $0, "I've been to many", $4f
	db "GYMs, but this is", $55
	db "my favorite!", $57
; 0xa0c90 + 49 bytes

_UnnamedText_75a6d: ; a0cc1 (28:4cc1)
	db $0, "Yowza!", $4f
	db "Too hot!", $58
; 0xa0cc1 + 17 bytes

_UnnamedText_75a72: ; a0cd2 (28:4cd2)
	db $0, "Us fire #MON", $4f
	db "fans like PONYTA", $55
	db "and NINETALES!", $57
; 0xa0cd2 + 46 bytes

_UnnamedText_75a9d: ; a0d00 (28:4d00)
	db $0, "Fire is weak", $4f
	db "against H2O!", $57
; 0xa0d00 + 27 bytes

_UnnamedText_75aa2: ; a0d1b (28:4d1b)
	db $0, "Oh!", $4f
	db "Snuffed out!", $58
; 0xa0d1b + 18 bytes

_UnnamedText_75aa7: ; a0d2d (28:4d2d)
	db $0, "Water beats fire!", $4f
	db "But, fire melts", $55
	db "ice #MON!", $57
; 0xa0d2d + 45 bytes

_UnnamedText_75ac2: ; a0d5a (28:4d5a)
	db $0, "Yo! Champ in", $4f
	db "making!", $51
	db "The hot-headed", $4f
	db "BLAINE is a fire", $55
	db "#MON pro!", $51
	db "Douse his spirits", $4f
	db "with water!", $51
	db "You better take", $4f
	db "some BURN HEALs!", $57
; 0xa0d5a + 127 bytes

_UnnamedText_75ac7: ; a0dd9 (28:4dd9)
	db $0, $52, "! You beat", $4f
	db "that fire brand!", $57
; 0xa0dd9 + 30 bytes

_Lab1Text1: ; a0df7 (28:4df7)
	db $0, "We study #MON", $4f
	db "extensively here.", $51
	db "People often bring", $4f
	db "us rare #MON", $55
	db "for examination.", $57

_Lab1Text2: ; a0e49 (28:4e49)
	db $0, "A photo of the", $4f
	db "LAB's founder,", $55
	db "DR.FUJI!", $57

_Lab1Text3: ; a0e70 (28:4e70)
	db $0, "#MON LAB", $4f
	db "Meeting Room", $57

_Lab1Text4: ; a0e87 (28:4e87)
	db $0, "#MON LAB", $4f
	db "R-and-D Room", $57

_Lab1Text5: ; a0e9e (28:4e9e)
	db $0, "#MON LAB", $4f
	db "Testing Room", $57

_Lab2Text1: ; a0eb5 (28:4eb5)
	db $0, "I found this very", $4f
	db "strange fossil in", $55
	db "MT.MOON!", $51
	db "I think it's a", $4f
	db "rare, prehistoric", $55
	db "#MON!", $57

_TM35PreReceiveText: ; a0f09 (28:4f09)
	db $0, "Tch-tch-tch!", $4f
	db "I made a cool TM!", $51
	db "It can cause all", $4f
	db "kinds of fun!", $58
; 0xa0f09 + 63 bytes

_ReceivedTM35Text: ; a0f48 (28:4f48)
	db $0, $52, " received ", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0xa0f5d

_TM35ExplanationText: ; a0f5d (28:4f5d)
	db $0, "Tch-tch-tch!", $4f
	db "That's the sound", $55
	db "of a METRONOME!", $51
	db "It tweaks your", $4f
	db "#MON's brain", $55
	db "into using moves", $55
	db "it doesn't know!", $57
; 0xa0f5d + 106 bytes

_TM35NoRoomText: ; a0fc7 (28:4fc7)
	db $0, "Your pack is", $4f
	db "crammed full!", $57
; 0xa0fc7 + 28 bytes

_Lab3Text2: ; a0fe3 (28:4fe3)
	db $0, "EEVEE can evolve", $4f
	db "into 1 of 3 kinds", $55
	db "of #MON.", $57

_Lab3Text3: ; a1010 (28:5010)
	db $0, "There's an e-mail", $4f
	db "message!", $51
	db "...", $51
	db "The 3 legendary", $4f
	db "bird #MON are", $55
	db "ARTICUNO, ZAPDOS", $55
	db "and MOLTRES.", $51
	db "Their whereabouts", $4f
	db "are unknown.", $51
	db "We plan to explore", $4f
	db "the cavern close", $55
	db "to CERULEAN.", $51
	db "From: #MON", $4f
	db "RESEARCH TEAM", $51
	db "...", $57

_Lab3Text5: ; a10d8 (28:50d8)
	db $0, "An amber pipe!", $57

_UnnamedText_75dc6: ; a10e8 (28:50e8)
	db $0, "Hiya!", $51
	db "I am important", $4f
	db "doctor!", $51
	db "I study here rare", $4f
	db "#MON fossils!", $51
	db "You! Have you a", $4f
	db "fossil for me?", $58
; 0xa10e8 + 93 bytes

_UnnamedText_75dcb: ; a1145 (28:5145)
	db $0, "No! Is too bad!", $57
; 0xa1145 + 17 bytes

_UnnamedText_75dd0: ; a1156 (28:5156)
	db $0, "I take a little", $4f
	db "time!", $51
	db "You go for walk a", $4f
	db "little while!", $57
; 0xa1156 + 55 bytes

_UnnamedText_75dd5: ; a118d (28:518d)
	db $0, "Where were you?", $51
	db "Your fossil is", $4f
	db "back to life!", $51
	db "It was @"
; 0xa118d + 54 bytes

UnnamedText_a11c3: ; a11c3 (28:51c3)
	TX_RAM $cf4b
	db $0, $4f
	db "like I think!", $58
; 0xa11d6

_UnnamedText_610ae: ; a11d6 (28:51d6)
	db $0, "Oh! That is", $4f
	db "@"
; 0xa11d6 + 14 bytes

UnnamedText_a11e4: ; a11e4 (28:51e4)
	TX_RAM $cd6d
	db $0, "!", $51
	db "It is fossil of", $4f
	db "@"
	TX_RAM $cf4b
	db $0, ", a", $55
	db "#MON that is", $55
	db "already extinct!", $51
	db "My Resurrection", $4f
	db "Machine will make", $55
	db "that #MON live", $55
	db "again!", $57
; 0xa1259

_UnnamedText_610b3: ; a1259 (28:5259)
	db $0, "So! You hurry and", $4f
	db "give me that!", $51
	db $52, " handed", $4f
	db "over @"
	TX_RAM $cd6d
	db $0, "!", $58
; 0xa128f

_UnnamedText_610b8: ; a128f (28:528f)
	db $0, "I take a little", $4f
	db "time!", $51
	db "You go for walk a", $4f
	db "little while!", $57
; 0xa128f + 55 bytes

_UnnamedText_610bd: ; a12c6 (28:52c6)
	db $0, "Aiyah! You come", $4f
	db "again!", $57
; 0xa12c6 + 24 bytes

_CinnabarPokecenterText2: ; a12de (28:52de)
_CinnabarPokecenterText1: ; a12de (28:52de)
	db $0, "You can cancel", $4f
	db "evolution.", $51
	db "When a #MON is", $4f
	db "evolving, you can", $55
	db "stop it and leave", $55
	db "it the way it is.", $57

_CinnabarPokecenterText3: ; a133e (28:533e)
	db $0, "Do you have any", $4f
	db "friends?", $51
	db "#MON you get", $4f
	db "in trades grow", $55
	db "very quickly.", $51
	db "I think it's", $4f
	db "worth a try!", $57

_CinnabarMartText2: ; a139b (28:539b)
	db $0, "Don't they have X", $4f
	db "ATTACK? It's good", $55
	db "for battles!", $57

_CinnabarMartText3: ; a13cb (28:53cb)
	db $0, "It never hurts to", $4f
	db "have extra items!", $57

_IndigoPlateauLobbyText1: ; a13f0 (28:53f0)
	db $0, "Yo! Champ in", $4f
	db "making!", $51
	db "At #MON LEAGUE,", $4f
	db "you have to face", $55
	db "the ELITE FOUR in", $55
	db "succession.", $51
	db "If you lose, you", $4f
	db "have to start all", $55
	db "over again! This", $55
	db "is it! Go for it!", $57

_IndigoPlateauLobbyText3: ; a148b (28:548b)
	db $0, "From here on, you", $4f
	db "face the ELITE", $55
	db "FOUR one by one!", $51
	db "If you win, a", $4f
	db "door opens to the", $55
	db "next trainer!", $55
	db "Good luck!", $57

_CopycatsHouseF1Text1: ; a14f7 (28:54f7)
	db $0, "My daughter is so", $4f
	db "self-centered.", $55
	db "She only has a", $55
	db "few friends.", $57

_CopycatsHouseF1Text2: ; a1535 (28:5535)
	db $0, "My daughter likes", $4f
	db "to mimic people.", $51
	db "Her mimicry has", $4f
	db "earned her the", $55
	db "nickname COPYCAT", $55
	db "around here!", $57

_CopycatsHouseF1Text3: ; a1596 (28:5596)
	db $0, "CHANSEY: Chaan!", $4f
	db "Sii!@@"

_UnnamedText_5ccd4: ; a15ad (28:55ad)
	db $0, $52, ": Hi! Do", $4f
	db "you like #MON?", $51
	db $52, ": Uh no, I", $4f
	db "just asked you.", $51
	db $52, ": Huh?", $4f
	db "You're strange!", $51
	db "COPYCAT: Hmm?", $4f
	db "Quit mimicking?", $51
	db "But, that's my", $4f
	db "favorite hobby!", $58
; 0xa15ad + 137 bytes

_TM31PreReceiveText: ; a1636 (28:5636)
	db $0, "Oh wow!", $4f
	db "A # DOLL!", $51
	db "For me?", $4f
	db "Thank you!", $51
	db "You can have", $4f
	db "this, then!", $58
; 0xa1636 + 63 bytes

_ReceivedTM31Text: ; a1675 (28:5675)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0xa1689

_TM31ExplanationText1: ; a1689 (28:5689)
	db $0, $51
	db "TM31 contains my", $4f
	db "favorite, MIMIC!", $51
	db "Use it on a good", $4f
	db "#MON!@@"
; 0xa16c5

_TM31ExplanationText2: ; a16c5 (28:56c5)
	db $0, $52, ": Hi!", $4f
	db "Thanks for TM31!", $51
	db $52, ": Pardon?", $51
	db $52, ": Is it", $4f
	db "that fun to mimic", $55
	db "my every move?", $51
	db "COPYCAT: You bet!", $4f
	db "It's a scream!", $57
; 0xa16c5 + 110 bytes

_TM31NoRoomText: ; a1733 (28:5733)
	db $0, "Don't you want", $4f
	db "this?@@"
; 0xa1749

_CopycatsHouseF2Text2: ; a1749 (28:5749)
	db $0, "DODUO: Giiih!", $51
	db "MIRROR MIRROR ON", $4f
	db "THE WALL, WHO IS", $55
	db "THE FAIREST ONE", $55
	db "OF ALL?", $57

_CopycatsHouseF2Text3: ; a1792 (28:5792)
	db $0, "This is a rare", $4f
	db "#MON! Huh?", $55
	db "It's only a doll!", $57

_CopycatsHouseF2Text6: ; a17be (28:57be)
	db $0, "A game with MARIO", $4f
	db "wearing a bucket", $55
	db "on his head!", $57

_UnnamedText_5cd17: ; a17ef (28:57ef)
	db $0, "...", $51
	db "My Secrets!", $51
	db "Skill: Mimicry!", $4f
	db "Hobby: Collecting", $55
	db "dolls!", $55
	db "Favorite #MON:", $55
	db "CLEFAIRY!", $57
; 0xa17ef + 83 bytes

_UnnamedText_5cd1c: ; a1842 (28:5842)
	db $0, "Huh? Can't see!", $57
; 0xa1842 + 16 bytes

_UnnamedText_5ce8e: ; a1852 (28:5852)
	db $0, "Grunt!", $51
	db "I am the KARATE", $4f
	db "MASTER! I am the", $55
	db "LEADER here!", $51
	db "You wish to", $4f
	db "challenge us?", $55
	db "Expect no mercy!", $51
	db "Fwaaa!", $57
; 0xa1852 + 104 bytes

_UnnamedText_5ce93: ; a18ba (28:58ba)
	db $0, "Hwa!", $4f
	db "Arrgh! Beaten!", $58
; 0xa18ba + 21 bytes

_UnnamedText_5ce98: ; a18cf (28:58cf)
	db $0, "Indeed, I have", $4f
	db "lost!", $51
	db "But, I beseech", $4f
	db "you, do not take", $55
	db "our emblem as", $55
	db "your trophy!", $51
	db "In return, I will", $4f
	db "give you a prized", $55
	db "fighting #MON!", $51
	db "Choose whichever", $4f
	db "one you like!", $57
; 0xa18cf + 163 bytes

_UnnamedText_5ce9d: ; a1972 (28:5972)
	db $0, "Ho!", $51
	db "Stay and train at", $4f
	db "Karate with us!", $57
; 0xa1972 + 39 bytes

_FightingDojoBattleText1: ; a1999 (28:5999)
	db $0, "Hoargh! Take your", $4f
	db "shoes off!", $57
; 0xa1999 + 30 bytes

_FightingDojoEndBattleText1: ; a19b7 (28:59b7)
	db $0, "I give", $4f
	db "up!", $58
; 0xa19b7 + 12 bytes

_FightingDojoAfterBattleText1: ; a19c3 (28:59c3)
	db $0, "You wait 'til you", $4f
	db "see our Master!", $51
	db "I'm a small fry", $4f
	db "compared to him!", $57
; 0xa19c3 + 66 bytes

_FightingDojoBattleText2: ; a1a05 (28:5a05)
	db $0, "I hear you're", $4f
	db "good! Show me!", $57
; 0xa1a05 + 29 bytes

_FightingDojoEndBattleText2: ; a1a22 (28:5a22)
	db $0, "Judge!", $4f
	db "1 point!", $58
; 0xa1a22 + 17 bytes

_FightingDojoAfterBattleText2: ; a1a33 (28:5a33)
	db $0, "Our Master is a", $4f
	db "pro fighter!", $57
; 0xa1a33 + 30 bytes

_FightingDojoBattleText3: ; a1a51 (28:5a51)
	db $0, "Nothing tough", $4f
	db "frightens me!", $51
	db "I break boulders", $4f
	db "for training!", $57
; 0xa1a51 + 60 bytes

_FightingDojoEndBattleText3: ; a1a8d (28:5a8d)
	db $0, "Yow!", $4f
	db "Stubbed fingers!", $58
; 0xa1a8d + 23 bytes

_FightingDojoAfterBattleText3: ; a1aa4 (28:5aa4)
	db $0, "The only thing", $4f
	db "that frightens us", $55
	db "is psychic power!", $57
; 0xa1aa4 + 52 bytes

_FightingDojoBattleText4: ; a1ad8 (28:5ad8)
	db $0, "Hoohah!", $51
	db "You're trespassing", $4f
	db "in our FIGHTING", $55
	db "DOJO!", $57
; 0xa1ad8 + 49 bytes

_FightingDojoEndBattleText4: ; a1b09 (28:5b09)
	db $0, "Oof!", $4f
	db "I give up!", $58
; 0xa1b09 + 17 bytes

_FightingDojoAfterBattleText4: ; a1b1a (28:5b1a)
	db $0, "The prime fighters", $4f
	db "across the land", $55
	db "train here.", $57
; 0xa1b1a + 48 bytes

_WantHitmonleeText: ; a1b4a (28:5b4a)
	db $0, "You want the", $4f
	db "hard kicking", $55
	db "HITMONLEE?", $57
; 0xa1b4a + 38 bytes

_WantHitmonchanText: ; a1b70 (28:5b70)
	db $0, "You want the", $4f
	db "piston punching", $55
	db "HITMONCHAN?", $57
; 0xa1b70 + 42 bytes

_OtherHitmonText: ; a1b9a (28:5b9a)
	db $0, "Better not get", $4f
	db "greedy...", $57
; 0xa1b9a + 26 bytes

_UnnamedText_5d162: ; a1bb4 (28:5bb4)
	db $0, "I had a vision of", $4f
	db "your arrival!", $51
	db "I have had psychic", $4f
	db "powers since I", $55
	db "was a child.", $51
	db "I first learned", $4f
	db "to bend spoons", $55
	db "with my mind.", $51
	db "I dislike fight-", $4f
	db "ing, but if you", $55
	db "wish, I will show", $55
	db "you my powers!", $57
; 0xa1bb4 + 191 bytes

_UnnamedText_5d167: ; a1c73 (28:5c73)
	db $0, "I'm", $4f
	db "shocked!", $55
	db "But, a loss is a", $55
	db "loss.", $51
	db "I admit I didn't", $4f
	db "work hard enough", $55
	db "to win!", $51
	db "You earned the", $4f
	db "MARSHBADGE!@@"
; 0xa1cdc

_UnnamedText_5d16e: ; a1cdc (28:5cdc)
	db $0, "Everyone has", $4f
	db "psychic power!", $55
	db "People just don't", $55
	db "realize it!", $57
; 0xa1cdc + 58 bytes

_UnnamedText_5d173: ; a1d16 (28:5d16)
	db $0, "The MARSHBADGE", $4f
	db "makes #MON up", $55
	db "to L70 obey you!", $51
	db "Stronger #MON", $4f
	db "will become wild,", $55
	db "ignoring your", $55
	db "orders in battle!", $51
	db "Just don't raise", $4f
	db "your #MON too", $55
	db "much!", $51
	db "Wait, please take", $4f
	db "this TM with you!", $57
; 0xa1d16 + 183 bytes

ReceivedTM46Text: ; a1dcd (28:5dcd)
	db $0, $52, " received", $4f
	db "TM46!@@"
; 0xa1de0

_TM46ExplanationText: ; a1de0 (28:5de0)
	db $0, $51
	db "TM46 is PSYWAVE!", $4f
	db "It uses powerful", $55
	db "psychic waves to", $55
	db "inflict damage!", $57
; 0xa1de0 + 69 bytes

_TM46NoRoomText: ; a1e25 (28:5e25)
	db $0, "Your pack is full", $4f
	db "of other items!", $57
; 0xa1e25 + 35 bytes

_UnnamedText_5d1e6: ; a1e48 (28:5e48)
	db $0, "Yo! Champ in", $4f
	db "making!", $51
	db "SABRINA's #MON", $4f
	db "use psychic power", $55
	db "instead of force!", $51
	db "Fighting #MON", $4f
	db "are weak against", $55
	db "psychic #MON!", $51
	db "They get creamed", $4f
	db "before they can", $55
	db "even aim a punch!", $57
; 0xa1e48 + 168 bytes

_UnnamedText_5d1eb: ; a1ef0 (28:5ef0)
	db $0, "Psychic power,", $4f
	db "huh?", $51
	db "If I had that,", $4f
	db "I'd make a bundle", $55
	db "at the slots!", $57
; 0xa1ef0 + 67 bytes

_SaffronGymBattleText1: ; a1f33 (28:5f33)
	db $0, "SABRINA is younger", $4f
	db "than I, but I", $55
	db "respect her!", $57
; 0xa1f33 + 47 bytes

_SaffronGymEndBattleText1: ; a1f62 (28:5f62)
	db $0, "Not", $4f
	db "good enough!", $58
; 0xa1f62 + 18 bytes

_SaffronGymAfterBattleText1: ; a1f74 (28:5f74)
	db $0, "In a battle of", $4f
	db "equals, the one", $55
	db "with the stronger", $55
	db "will wins!", $51
	db "If you wish", $4f
	db "to beat SABRINA,", $55
	db "focus on winning!", $57
; 0xa1f74 + 108 bytes

_SaffronGymBattleText2: ; a1fe0 (28:5fe0)
	db $0, "Does our unseen", $4f
	db "power scare you?", $57
; 0xa1fe0 + 34 bytes

_SaffronGymEndBattleText2: ; a2002 (28:6002)
	db $0, "I never", $4f
	db "foresaw this!", $58
; 0xa2002 + 23 bytes

_SaffronGymAfterBattleText2: ; a2019 (28:6019)
	db $0, "Psychic #MON", $4f
	db "fear only ghosts", $55
	db "and bugs!", $57
; 0xa2019 + 41 bytes

_SaffronGymBattleText3: ; a2042 (28:6042)
	db $0, "#MON take on", $4f
	db "the appearance of", $55
	db "their trainers.", $51
	db "Your #MON must", $4f
	db "be tough, then!", $57
; 0xa2042 + 79 bytes

_SaffronGymEndBattleText3: ; a2091 (28:6091)
	db $0, "I knew", $4f
	db "it!", $58
; 0xa2091 + 12 bytes

_SaffronGymAfterBattleText3: ; a209d (28:609d)
	db $0, "I must teach", $4f
	db "better techniques", $55
	db "to my #MON!", $57
; 0xa209d + 44 bytes

_SaffronGymBattleText4: ; a20c9 (28:60c9)
	db $0, "You know that", $4f
	db "power alone isn't", $55
	db "enough!", $57
; 0xa20c9 + 40 bytes

_SaffronGymEndBattleText4: ; a20f1 (28:60f1)
	db $0, "I don't", $4f
	db "believe this!", $58
; 0xa20f1 + 22 bytes

_SaffronGymAfterBattleText4: ; a2107 (28:6107)
	db $0, "SABRINA just wiped", $4f
	db "out the KARATE", $55
	db "MASTER next door!", $57
; 0xa2107 + 53 bytes

_SaffronGymBattleText5: ; a213c (28:613c)
	db $0, "You and I, our", $4f
	db "#MON shall", $55
	db "fight!", $57
; 0xa213c + 34 bytes

_SaffronGymEndBattleText5: ; a215e (28:615e)
	db $0, "I lost", $4f
	db "after all!", $58
; 0xa215e + 19 bytes

_SaffronGymAfterBattleText5: ; a2171 (28:6171)
	db $0, "I knew that this", $4f
	db "was going to take", $55
	db "place.", $57
; 0xa2171 + 43 bytes

_SaffronGymBattleText6: ; a219c (28:619c)
	db $0, "SABRINA is young,", $4f
	db "but she's also", $55
	db "our LEADER!", $51
	db "You won't reach", $4f
	db "her easily!", $57
; 0xa219c + 72 bytes

_SaffronGymEndBattleText6: ; a21e4 (28:61e4)
	db $0, "I lost", $4f
	db "my concentration!", $58
; 0xa21e4 + 26 bytes

_SaffronGymAfterBattleText6: ; a21fe (28:61fe)
	db $0, "There used to be", $4f
	db "2 #MON GYMs in", $55
	db "SAFFRON.", $51
	db "The FIGHTING DOJO", $4f
	db "next door lost", $55
	db "its GYM status", $55
	db "when we went and", $55
	db "creamed them!", $57
; 0xa21fe + 121 bytes

_SaffronGymBattleText7: ; a2277 (28:6277)
	db $0, "SAFFRON #MON", $4f
	db "GYM is famous for", $55
	db "its psychics!", $51
	db "You want to see", $4f
	db "SABRINA!", $55
	db "I can tell!", $57
; 0xa2277 + 83 bytes

_SaffronGymEndBattleText7: ; a22ca (28:62ca)
	db $0, "Arrrgh!", $58
; 0xa22ca + 9 bytes

_SaffronGymAfterBattleText7: ; a22d3 (28:62d3)
	db $0, "That's right! I", $4f
	db "used telepathy to", $55
	db "read your mind!", $57
; 0xa22d3 + 50 bytes

_SaffronHouse1Text1: ; a2305 (28:6305)
	db $0, "Thank you for", $4f
	db "writing. I hope", $55
	db "to see you soon!", $51
	db "Hey! Don't look", $4f
	db "at my letter!", $57

_SaffronHouse1Text2: ; a2352 (28:6352)
	db $0, "PIDGEY: Kurukkoo!@@"

_SaffronHouse1Text3: ; a2366 (28:6366)
	db $0, "The COPYCAT is", $4f
	db "cute! I'm getting", $55
	db "her a # DOLL!", $57

_SaffronHouse1Text4: ; a2395 (28:6395)
	db $0, "I was given a PP", $4f
	db "UP as a gift.", $51
	db "It's used for", $4f
	db "increasing the PP", $55
	db "of techniques!", $57

_SaffronMartText2: ; a23e3 (28:63e3)
	db $0, "MAX REPEL lasts", $4f
	db "longer than SUPER", $55
	db "REPEL for keeping", $55
	db "weaker #MON", $55
	db "away!", $57

_SaffronMartText3: ; a242a (28:642a)
	db $0, "REVIVE is costly,", $4f
	db "but it revives", $55
	db "fainted #MON!", $57

_SilphCo1Text1: ; a245a (28:645a)
	db $0, "Welcome!", $51
	db "The PRESIDENT is", $4f
	db "in the boardroom", $55
	db "on 11F!", $57

_SaffronPokecenterText1: ; a248e (28:648e)
	db $0, "#MON growth", $4f
	db "rates differ from", $55
	db "specie to specie.", $57

_SaffronPokecenterText3: ; a24bf (28:64bf)
	db $0, "SILPH CO. is very", $4f
	db "famous. That's", $55
	db "why it attracted", $55
	db "TEAM ROCKET!", $57

_TM29PreReceiveText: ; a24fe (28:64fe)
	db $0, "...Wait! Don't", $4f
	db "say a word!", $51
	db "You wanted this!", $58
; 0xa24fe + 44 bytes

_ReceivedTM29Text: ; a252a (28:652a)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0xa253e

_TM29ExplanationText: ; a253e (28:653e)
	db $0, "TM29 is PSYCHIC!", $51
	db "It can lower the", $4f
	db "target's SPECIAL", $55
	db "abilities.", $57
; 0xa253e + 62 bytes

_TM29NoRoomText: ; a257c (28:657c)
	db $0, "Where do you plan", $4f
	db "to put this?", $57
; 0xa257c + 32 bytes

_PokemartGreetingText: ; a259c (28:659c)
	db $0, "Hi there!", $4e, "May I help you?", $57
; 0xa259c + 27 bytes

_PokemonFaintedText: ; a25b7 (28:65b7)
	TX_RAM $cd6d
	db $0, $4f
	db "fainted!", $57
; 0xa25b7 + 14 bytes

_PlayerBlackedOutText: ; a25c5 (28:65c5)
	db $0, $52, " is out of", $4f
	db "useable #MON!", $51
	db $52, " blacked", $4f
	db "out!", $58
; 0xa25c5 + 42 bytes

_RepelWoreOffText: ; a25ef (28:65ef)
	db $0, "REPEL's effect", $4f
	db "wore off.", $57
; 0xa25ef + 25 bytes

_PokemartBuyingGreetingText: ; a2608 (28:6608)
	db $0, "Take your time.", $57
; 0xa2608 + 17 bytes

_PokemartTellBuyPrice: ; a2619 (28:6619)
	TX_RAM $cf4b
	db $0, "?", $4f
	db "That will be", $55
	db "¥@"
	db $2, $9f, $ff, $c3
	db $0, ". OK?", $57
; 0xa2639

_PokemartBoughtItemText: ; a2639 (28:6639)
	db $0, "Here you are!", $4f
	db "Thank you!", $58
; 0xa2639 + 26 bytes

_PokemartNotEnoughMoneyText: ; a2653 (28:6653)
	db $0, "You don't have", $4f
	db "enough money.", $58
; 0xa2653 + 29 bytes

_PokemartItemBagFullText: ; a2670 (28:6670)
	db $0, "You can't carry", $4f
	db "any more items.", $58
; 0xa2670 + 32 bytes

_PokemonSellingGreetingText: ; a2690 (28:6690)
	db $0, "What would you", $4f
	db "like to sell?", $57
; 0xa2690 + 30 bytes

_PokemartTellSellPrice: ; a26ae (28:66ae)
	db $0, "I can pay you", $4f
	db "¥@"
	db $2, $9f, $ff, $c3 ; XXX
	db $0, " for that.", $57
; 0xa26cf

_PokemartItemBagEmptyText: ; a26cf (28:66cf)
	db $0, "You don't have", $4f
	db "anything to sell.", $58
; 0xa26cf + 33 bytes

_PokemartUnsellableItemText: ; a26f0 (28:66f0)
	db $0, "I can't put a", $4f
	db "price on that.", $58
; 0xa26f0 + 29 bytes

_PokemartThankYouText: ; a270d (28:670d)
	db $0, "Thank you!", $57
; 0xa270d + 12 bytes

_PokemartAnythingElseText: ; a2719 (28:6719)
	db $0, "Is there anything", $4f
	db "else I can do?", $57
; 0xa2719 + 34 bytes

UnnamedText_a273b: ; a273b (28:673b)
	TX_RAM $d036
	db $0, " learned", $4f
	db "@"
; 0xa2749

UnnamedText_a2749: ; a2749 (28:6749)
	TX_RAM $cf4b
	db $0, "!@@"
; 0xa2750

_UnnamedText_6fb4: ; a2750 (28:6750)
	db $0, "Which move should", $4e, "be forgotten?", $57
; 0xa2750 + 33 bytes

_UnnamedText_6fb9: ; a2771 (28:6771)
	db $0, "Abandon learning", $4f
	db "@"
; 0xa2771 + 19 bytes

UnnamedText_a2784: ; a2784 (28:6784)
	TX_RAM $cf4b
	db $0, "?", $57
; 0xa278a

_UnnamedText_6fbe: ; a278a (28:678a)
	TX_RAM $d036
	db $0, $4f
	db "did not learn", $55
	db "@"
; 0xa278a + 20 bytes

UnnamedText_a279e: ; a279e (28:679e)
	TX_RAM $cf4b
	db $0, "!", $58
; 0xa27a4

_UnnamedText_6fc3: ; a27a4 (28:67a4)
	TX_RAM $d036
	db $0, " is", $4f
	db "trying to learn", $55
	db "@"
; 0xa27a4 + 25 bytes

UnnamedText_a27bd: ; a27bd (28:67bd)
	TX_RAM $cf4b
	db $0, "!", $51
	db "But, @"
	TX_RAM $d036
	db $0, $4f
	db "can't learn more", $55
	db "than 4 moves!", $51
	db "Delete an older", $4f
	db "move to make room", $55
	db "for @"
; 0xa2813

UnnamedText_a2813: ; a2813 (28:6813)
	TX_RAM $cf4b
	db $0, "?", $57
; 0xa2819

_UnnamedText_6fc8: ; a2819 (28:6819)
	db $0, "1, 2 and...@@"
; 0xa2827

_UnnamedText_6fd7: ; a2827 (28:6827)
	db $0, " Poof!@@"
; 0xa2830

_UnnamedText_6fdc: ; a2830 (28:6830)
	db $0, $51
	db "@"
; 0xa2830 + 3 bytes

UnnamedText_a2833: ; a2833 (28:6833)
	TX_RAM $d036
	db $0, " forgot", $4f
	db "@"
	TX_RAM $cd6d
	db $0, "!", $51
	db "And...", $58
; 0xa284d

_UnnamedText_6fe1: ; a284d (28:684d)
	db $0, "HM techniques", $4f
	db "can't be deleted!", $58
; 0xa284d + 32 bytes

_PokemonCenterWelcomeText: ; a286d (28:686d)
	db $0, "Welcome to our", $4f
	db "#MON CENTER!", $51
	db "We heal your", $4f
	db "#MON back to", $55
	db "perfect health!", $58
; 0xa286d + 71 bytes

_ShallWeHealYourPokemonText: ; a28b4 (28:68b4)
	db $0, "Shall we heal your", $4f
	db "#MON?", $57
; 0xa28b4 + 26 bytes

_NeedYourPokemonText: ; a28ce (28:68ce)
	db $0, "OK. We'll need", $4f
	db "your #MON.", $57
; 0xa28ce + 26 bytes

_PokemonFightingFitText: ; a28e8 (28:68e8)
	db $0, "Thank you!", $4f
	db "Your #MON are", $55
	db "fighting fit!", $58
; 0xa28e8 + 40 bytes

_PokemonCenterFarewellText: ; a2910 (28:6910)
	db $0, "We hope to see", $4f
	db "you again!", $57
; 0xa2910 + 27 bytes

_UnnamedText_72b3: ; a292b (28:692b)
	db $0, "This area is", $4f
	db "reserved for 2", $55
	db "friends who are", $55
	db "linked by cable.", $57
; 0xa292b + 62 bytes

_UnnamedText_72b8: ; a2969 (28:6969)
	db $0, "Welcome to the", $4f
	db "Cable Club!", $57
; 0xa2969 + 28 bytes

_UnnamedText_72bd: ; a2985 (28:6985)
	db $0, "Please apply here.", $51
	db "Before opening", $4f
	db "the link, we have", $55
	db "to save the game.", $57
; 0xa2985 + 71 bytes

UnnamedText_a29cc: ; a29cc (28:69cc)
	db $0, "Please wait.@@"
; 0xa29b

_UnnamedText_72c8: ; a29db (28:69db)
	db $0, "The link has been", $4f
	db "closed because of", $55
	db "inactivity.", $51
	db "Please contact", $4f
	db "your friend and", $55
	db "come again!", $57
; 0xa29db + 92 bytes

SECTION "bank29",ROMX,BANK[$29]

_UnnamedText_72cd: ; a4000 (29:4000)
	db $0, "Please come again!", $57
; 0xa4000 + 20 bytes

_UnnamedText_72d2: ; a4014 (29:4014)
	db $0, "We're making", $4f
	db "preparations.", $55
	db "Please wait.", $57
; 0xa4014 + 40 bytes

UnnamedText_a403c: ; a403c (29:403c)
	TX_RAM $cd6d
	db $0, " used", $4f
	db "STRENGTH.@@"
; 0xa4051

_UnnamedText_cdbb: ; a4051 (29:4051)
	TX_RAM $cd6d
	db $0, " can", $4f
	db "move boulders.", $58
; 0xa4051 + 24 bytes

_UnnamedText_cdfa: ; a4069 (29:4069)
	db $0, "The current is", $4f
	db "much too fast!", $58
; 0xa4069 + 31 bytes

_UnnamedText_cdff: ; a4088 (29:4088)
	db $0, "Cycling is fun!", $4f
	db "Forget SURFing!", $58
; 0xa4088 + 33 bytes

_FlashLightsAreaText: ; a40a9 (29:40a9)
	db $0, "A blinding FLASH", $4f
	db "lights the area!", $58
; 0xa40a9 + 35 bytes

_WarpToLastPokemonCenterText: ; a40cc (29:40cc)
	db $0, "Warp to the last", $4f
	db "#MON CENTER.", $57
; 0xa40cc + 31 bytes

_CannotUseTeleportNowText: ; a40eb (29:40eb)
	TX_RAM $cd6d
	db $0, " can't", $4f
	db "use TELEPORT now.", $58
; 0xa40eb + 28 bytes

_CannotFlyHereText: ; a4107 (29:4107)
	TX_RAM $cd6d
	db $0, " can't", $4f
	db "FLY here.", $58
; 0xa4107 + 20 bytes

_NotHealthyEnoughText: ; a411b (29:411b)
	db $0, "Not healthy", $4f
	db "enough.", $58
; 0xa411b + 21 bytes

_NewBadgeRequiredText: ; a4130 (29:4130)
	db $0, "No! A new BADGE", $4f
	db "is required.", $58
; 0xa4130 + 30 bytes

_CannotUseItemsHereText: ; a414e (29:414e)
	db $0, "You can't use items", $4f
	db "here.", $58
; 0xa414e + 26 bytes

_CannotGetOffHereText: ; a4168 (29:4168)
	db $0, "You can't get off", $4f
	db "here.", $58
; 0xa4168 + 24 bytes

UnnamedText_a4180: ; a4180 (29:4180)
	db $0, $52, " got", $4f
	db "@"
	TX_RAM $cd6d
	db $0, "!@@"
; 0xa418f

_UnnamedText_4fe3f: ; a418f (29:418f)
	db $0, "There's no more", $4f
	db "room for #MON!", $55
	db "@"
	TX_RAM $de06
	db $0, " was", $55
	db "sent to #MON", $55
	db "BOX @"
	TX_RAM $cf4b
	db $0, " on PC!", $57

_UnnamedText_4fe44: ; a41d6 (29:41d6)
	db $0, "There's no more", $4f
	db "room for #MON!", $51
	db "The #MON BOX", $4f
	db "is full and can't", $55
	db "accept any more!", $51
	db "Change the BOX at", $4f
	db "a #MON CENTER!", $57
; 0xa41d6 + 111 bytes

INCLUDE "text/mapPalletTown.tx"

_ViridianCityText1: ; a43cc (29:43cc)
	db $0, "Those # BALLs", $4f
	db "at your waist!", $55
	db "You have #MON!", $51
	db "It's great that", $4f
	db "you can carry and", $55
	db "use #MON any", $55
	db "time, anywhere!", $57

_UnnamedText_19122: ; a4437 (29:4437)
	db $0, "This #MON GYM", $4f
	db "is always closed.", $51
	db "I wonder who the", $4f
	db "LEADER is?", $57
; 0xa4437 + 61 bytes

_UnnamedText_19127: ; a4474 (29:4474)
	db $0, "VIRIDIAN GYM's", $4f
	db "LEADER returned!", $57
; 0xa4474 + 32 bytes

_UnnamedText_1914d: ; a4494 (29:4494)
	db $0, "You want to know", $4f
	db "about the 2 kinds", $55
	db "of caterpillar", $55
	db "#MON?", $57
; 0xa4494 + 57 bytes

_UnnamedText_19152: ; a44cd (29:44cd)
	db $0, "Oh, OK then!", $57
; 0xa44cd + 14 bytes

_UnnamedText_19157: ; a44db (29:44db)
	db $0, "CATERPIE has no", $4f
	db "poison, but", $55
	db "WEEDLE does.", $51
	db "Watch out for its", $4f
	db "POISON STING!", $57
; 0xa44db + 74 bytes

_UnnamedText_19175: ; a4525 (29:4525)
	db $0, "Oh Grandpa! Don't", $4f
	db "be so mean!", $55
	db "He hasn't had his", $55
	db "coffee yet.", $57
; 0xa4525 + 59 bytes

_UnnamedText_1917a: ; a4560 (29:4560)
	db $0, "When I go shop in", $4f
	db "PEWTER CITY, I", $55
	db "have to take the", $55
	db "winding trail in", $55
	db "VIRIDIAN FOREST.", $57
; 0xa4560 + 85 bytes

_UnnamedText_19191: ; a45b5 (29:45b5)
	db $0, "You can't go", $4f
	db "through here!", $51
	db "This is private", $4f
	db "property!", $57
; 0xa45b5 + 53 bytes

_UnnamedText_191ca: ; a45ea (29:45ea)
	db $0, "Yawn!", $4f
	db "I must have dozed", $55
	db "off in the sun.", $51
	db "I had this dream", $4f
	db "about a DROWZEE", $55
	db "eating my dream.", $55
	db "What's this?", $55
	db "Where did this TM", $55
	db "come from?", $51
	db "This is spooky!", $4f
	db "Here, you can", $55
	db "have this TM.", $58
; 0xa45ea + 176 bytes

_ReceivedTM42Text: ; a469a (29:469a)
	db $0, $52, " received", $4f
	db "TM42!@@"
; 0xa46ad

_TM42Explanation: ; a46ad (29:46ad)
	db $0, "TM42 contains", $4f
	db "DREAM EATER...", $55
	db "...Snore...", $57
; 0xa46ad + 42 bytes

_TM42NoRoomText: ; a46d7 (29:46d7)
	db $0, "You have too much", $4f
	db "stuff already.", $57
; 0xa46d7 + 34 bytes

_UnnamedText_1920a: ; a46f9 (29:46f9)
	db $0, "Ahh, I've had my", $4f
	db "coffee now and I", $55
	db "feel great!", $51
	db "Sure you can go", $4f
	db "through!", $51
	db "Are you in a", $4f
	db "hurry?", $57
; 0xa46f9 + 91 bytes

_UnnamedText_1920f: ; a4754 (29:4754)
	db $0, "I see you're using", $4f
	db "a #DEX.", $51
	db "When you catch a", $4f
	db "#MON, #DEX", $55
	db "is automatically", $55
	db "updated.", $51
	db "What? Don't you", $4f
	db "know how to catch", $55
	db "#MON?", $51
	db "I'll show you", $4f
	db "how to then.", $57
; 0xa4754 + 146 bytes

_UnnamedText_19214: ; a47e6 (29:47e6)
	db $0, "Time is money...", $4f
	db "Go along then.", $57
; 0xa47e6 + 33 bytes

_UnnamedText_19219: ; a4807 (29:4807)
	db $0, "First, you need", $4f
	db "to weaken the", $55
	db "target #MON.", $57
; 0xa4807 + 44 bytes

_ViridianCityText8: ; a4833 (29:4833)
	db $0, "VIRIDIAN CITY ", $4f
	db "The Eternally", $55
	db "Green Paradise", $57

_ViridianCityText9: ; a4860 (29:4860)
	db $0, "TRAINER TIPS", $51
	db "Catch #MON", $4f
	db "and expand your", $55
	db "collection!", $51
	db "The more you have,", $4f
	db "the easier it is", $55
	db "to fight!", $57

_ViridianCityText10: ; a48c3 (29:48c3)
	db $0, "TRAINER TIPS", $51
	db "The battle moves", $4f
	db "of #MON are", $55
	db "limited by their", $55
	db "POWER POINTs, PP.", $51
	db "To replenish PP,", $4f
	db "rest your tired", $55
	db "#MON at a", $55
	db "#MON CENTER!", $57

_ViridianCityText13: ; a4949 (29:4949)
	db $0, "VIRIDIAN CITY", $4f
	db "#MON GYM", $57

_ViridianCityText14: ; a4961 (29:4961)
	db $0, "The GYM's doors", $4f
	db "are locked...", $57
; 0xa4961 + 30 bytes

_PewterCityText1: ; a497f (29:497f)
	db $0, "It's rumored that", $4f
	db "CLEFAIRYs came", $55
	db "from the moon!", $51
	db "They appeared ", $4f
	db "after MOON STONE", $55
	db "fell on MT.MOON.", $57

_PewterCityText2: ; a49e0 (29:49e0)
	db $0, "There aren't many", $4f
	db "serious #MON", $55
	db "trainers here!", $51
	db "They're all like", $4f
	db "BUG CATCHERs,", $55
	db "but PEWTER GYM's", $55
	db "BROCK is totally", $55
	db "into it!", $57

_UnnamedText_193f1: ; a4a56 (29:4a56)
	db $0, "Did you check out", $4f
	db "the MUSEUM?", $57
; 0xa4a56 + 31 bytes

_UnnamedText_193f6: ; a4a75 (29:4a75)
	db $0, "Weren't those", $4f
	db "fossils from MT.", $55
	db "MOON amazing?", $57
; 0xa4a75 + 45 bytes

_UnnamedText_193fb: ; a4aa2 (29:4aa2)
	db $0, "Really?", $4f
	db "You absolutely", $55
	db "have to go!", $57
; 0xa4aa2 + 36 bytes

_UnnamedText_19400: ; a4ac6 (29:4ac6)
	db $0, "It's right here!", $4f
	db "You have to pay", $55
	db "to get in, but", $55
	db "it's worth it!", $55
	db "See you around!", $57
; 0xa4ac6 + 78 bytes

_UnnamedText_19427: ; a4b14 (29:4b14)
	db $0, "Psssst!", $4f
	db "Do you know what", $55
	db "I'm doing?", $57
; 0xa4b14 + 36 bytes

_UnnamedText_1942c: ; a4b38 (29:4b38)
	db $0, "That's right!", $4f
	db "It's hard work!", $57
; 0xa4b38 + 29 bytes

_UnnamedText_19431: ; a4b55 (29:4b55)
	db $0, "I'm spraying REPEL", $4f
	db "to keep #MON", $55
	db "out of my garden!", $57
; 0xa4b55 + 50 bytes

_UnnamedText_1945d: ; a4b87 (29:4b87)
	db $0, "You're a trainer", $4f
	db "right? BROCK's", $55
	db "looking for new", $55
	db "challengers!", $55
	db "Follow me!", $57
; 0xa4b87 + 71 bytes

_UnnamedText_19462: ; a4bce (29:4bce)
	db $0, "If you have the", $4f
	db "right stuff, go", $55
	db "take on BROCK!", $57
; 0xa4bce + 48 bytes

_PewterCityText6: ; a4bfe (29:4bfe)
	db $0, "TRAINER TIPS", $51
	db "Any #MON that", $4f
	db "takes part in", $55
	db "battle, however", $55
	db "short, earns EXP!", $57

_PewterCityText7: ; a4c4a (29:4c4a)
	db $0, "NOTICE!", $51
	db "Thieves have been", $4f
	db "stealing #MON", $55
	db "fossils at MT.", $55
	db "MOON! Please call", $55
	db "PEWTER POLICE", $55
	db "with any info!", $57

_PewterCityText10: ; a4cb1 (29:4cb1)
	db $0, "PEWTER MUSEUM", $4f
	db "OF SCIENCE", $57

_PewterCityText11: ; a4ccb (29:4ccb)
	db $0, "PEWTER CITY", $4f
	db "#MON GYM", $55
	db "LEADER: BROCK", $51
	db "The Rock Solid", $4f
	db "#MON Trainer!", $57

_PewterCityText12: ; a4d0c (29:4d0c)
	db $0, "PEWTER CITY", $4f
	db "A Stone Gray", $55
	db "City", $57

_UnnamedText_19668: ; a4d2b (29:4d2b)
	db $0, $53, ": Yo!", $4f
	db $52, "!", $51
	db "You're still", $4f
	db "struggling along", $55
	db "back here?", $51
	db "I'm doing great!", $4f
	db "I caught a bunch", $55
	db "of strong and", $55
	db "smart #MON!", $51
	db "Here, let me see", $4f
	db "what you caught,", $55
	db $52, "!", $57
; 0xa4d2b + 147 bytes

_UnnamedText_1966d: ; a4dbe (29:4dbe)
	db $0, "Hey!", $4f
	db "Take it easy!", $55
	db "You won already!", $58
; 0xa4dbe + 37 bytes

_UnnamedText_19672: ; a4de3 (29:4de3)
	db $0, "Heh!", $4f
	db "You're no match", $55
	db "for my genius!", $58
; 0xa4de3 + 36 bytes

_UnnamedText_19677: ; a4e07 (29:4e07)
	db $0, $53, ": Hey,", $4f
	db "guess what?", $51
	db "I went to BILL's", $4f
	db "and got him to", $55
	db "show me his rare", $55
	db "#MON!", $51
	db "That added a lot", $4f
	db "of pages to my", $55
	db "#DEX!", $51
	db "After all, BILL's", $4f
	db "world famous as a", $55
	db "#MANIAC!", $51
	db "He invented the", $4f
	db "#MON Storage", $55
	db "System on PC!", $51
	db "Since you're using", $4f
	db "his system, go", $55
	db "thank him!", $51
	db "Well, I better", $4f
	db "get rolling!", $55
	db "Smell ya later!", $57
; 0xa4e07 + 288 bytes

_UnnamedText_196d9: ; a4f27 (29:4f27)
	db $0, "Hey! Stay out!", $4f
	db "It's not your", $55
	db "yard! Huh? Me?", $51
	db "I'm an innocent", $4f
	db "bystander! Don't", $55
	db "you believe me?", $57
; 0xa4f27 + 91 bytes

_ReceivedTM28Text: ; a4f82 (29:4f82)
	db $0, $52, " recovered", $4f
	db "TM28!@@"
; 0xa4f96

_ReceivedTM28Text2: ; a4f96 (29:4f96)
	db $0, $51
	db "I better get", $4f
	db "moving! Bye!@@"
; 0xa4fb3

_TM28NoRoomText: ; a4fb3 (29:4fb3)
	db $0, "Make room for", $4f
	db "this!", $51
	db "I can't run until", $4f
	db "I give it to you!", $57
; 0xa4fb3 + 56 bytes

_UnnamedText_196ee: ; a4feb (29:4feb)
	db $0, "Stop!", $4f
	db "I give up! I'll", $55
	db "leave quietly!", $58
; 0xa4feb + 37 bytes

_UnnamedText_196f3: ; a5010 (29:5010)
	db $0, "OK! I'll return", $4f
	db "the TM I stole!", $58
; 0xa5010 + 32 bytes

_CeruleanCityText3: ; a5030 (29:5030)
	db $0, "You're a trainer", $4f
	db "too? Collecting,", $55
	db "fighting, it's a", $55
	db "tough life.", $57

_CeruleanCityText4: ; a506e (29:506e)
	db $0, "That bush in", $4f
	db "front of the shop", $55
	db "is in the way.", $51
	db "There might be a", $4f
	db "way around.", $57

_CeruleanCityText5: ; a50ba (29:50ba)
	db $0, "You're making an", $4f
	db "encyclopedia on", $55
	db "#MON? That", $55
	db "sounds amusing.", $57

_CeruleanCityText6: ; a50f6 (29:50f6)
	db $0, "The people here", $4f
	db "were robbed.", $51
	db "It's obvious that", $4f
	db "TEAM ROCKET is", $55
	db "behind this most", $55
	db "heinous crime!", $51
	db "Even our POLICE", $4f
	db "force has trouble", $55
	db "with the ROCKETs!", $57

_UnnamedText_19730: ; a5188 (29:5188)
	db $0, "OK! SLOWBRO!", $4f
	db "Use SONICBOOM!", $55
	db "Come on, SLOWBRO", $55
	db "pay attention!", $57
; 0xa5188 + 61 bytes

_UnnamedText_19735: ; a51c5 (29:51c5)
	db $0, "SLOWBRO punch!", $4f
	db "No! You blew it", $55
	db "again!", $57
; 0xa51c5 + 39 bytes

_UnnamedText_1973a: ; a51ec (29:51ec)
	db $0, "SLOWBRO, WITHDRAW!", $4f
	db "No! That's wrong!", $51
	db "It's so hard to", $4f
	db "control #MON!", $51
	db "Your #MON's", $4f
	db "obedience depends", $55
	db "on your abilities", $55
	db "as a trainer!", $57
; 0xa51ec + 127 bytes

_UnnamedText_1976f: ; a526b (29:526b)
	db $0, "SLOWBRO took a", $4f
	db "snooze...", $57
; 0xa526b + 26 bytes

_UnnamedText_19774: ; a5285 (29:5285)
	db $0, "SLOWBRO is", $4f
	db "loafing around...", $57
; 0xa5285 + 30 bytes

_UnnamedText_19779: ; a52a3 (29:52a3)
	db $0, "SLOWBRO turned", $4f
	db "away...", $57
; 0xa52a3 + 24 bytes

_UnnamedText_1977e: ; a52bb (29:52bb)
	db $0, "SLOWBRO", $4f
	db "ignored orders...", $57
; 0xa52bb + 27 bytes

_CeruleanCityText9: ; a52d6 (29:52d6)
	db $0, "I want a bright", $4f
	db "red BICYCLE!", $51
	db "I'll keep it at", $4f
	db "home, so it won't", $55
	db "get dirty!", $57

_CeruleanCityText10: ; a531f (29:531f)
	db $0, "This is CERULEAN", $4f
	db "CAVE! Horribly", $55
	db "strong #MON", $55
	db "live in there!", $51
	db "The #MON LEAGUE", $4f
	db "champion is the", $55
	db "only person who", $55
	db "is allowed in!", $57

_CeruleanCityText12: ; a539a (29:539a)
	db $0, "CERULEAN CITY", $4f
	db "A Mysterious,", $55
	db "Blue Aura", $55
	db "Surrounds It", $57

_CeruleanCityText13: ; a53ce (29:53ce)
	db $0, "TRAINER TIPS", $51
	db "Pressing B Button", $4f
	db "during evolution", $55
	db "cancels the whole", $55
	db "process.", $57

_CeruleanCityText16: ; a541a (29:541a)
	db $0, "Grass and caves", $4f
	db "handled easily!", $55
	db "BIKE SHOP", $57

_CeruleanCityText17: ; a5445 (29:5445)
	db $0, "CERULEAN CITY", $4f
	db "#MON GYM", $55
	db "LEADER: MISTY", $51
	db "The Tomboyish", $4f
	db "Mermaid!", $57

_UnnamedText_4413c: ; a5482 (29:5482)
	db $0, "Do you believe in", $4f
	db "GHOSTs?", $57
; 0xa5482 + 27 bytes

_UnnamedText_44141: ; a549d (29:549d)
	db $0, "Really? So there", $4f
	db "are believers...", $57
; 0xa549d + 35 bytes

_UnnamedText_44146: ; a54c0 (29:54c0)
	db $0, "Hahaha, I guess", $4f
	db "not.", $51
	db "That white hand", $4f
	db "on your shoulder,", $55
	db "it's not real.", $57
; 0xa54c0 + 70 bytes

_LavenderTownText2: ; a5506 (29:5506)
	db $0, "This town is known", $4f
	db "as the grave site", $55
	db "of #MON.", $51
	db "Memorial services", $4f
	db "are held in", $55
	db "#MON TOWER.", $57

_LavenderTownText3: ; a555f (29:555f)
	db $0, "GHOSTs appeared", $4f
	db "in #MON TOWER.", $51
	db "I think they're", $4f
	db "the spirits of", $55
	db "#MON that the", $55
	db "ROCKETs killed.", $57

_LavenderTownText4: ; a55bb (29:55bb)
	db $0, "LAVENDER TOWN", $4f
	db "The Noble Purple", $55
	db "Town", $57

_LavenderTownText5: ; a55e0 (29:55e0)
	db $0, "New SILPH SCOPE!", $51
	db "Make the Invisible", $4f
	db "Plain to See!", $51
	db "SILPH CO.", $57

_LavenderTownText8: ; a561d (29:561d)
	db $0, "LAVENDER VOLUNTEER", $4f
	db "#MON HOUSE", $57

_LavenderTownText9: ; a563c (29:563c)
	db $0, "May the Souls of", $4f
	db "#MON Rest Easy", $55
	db "#MON TOWER", $57

_VermilionCityText1: ; a5668 (29:5668)
	db $0, "We're careful", $4f
	db "about pollution!", $51
	db "We've heard GRIMER", $4f
	db "multiplies in", $55
	db "toxic sludge!", $57

_UnnamedText_198a7: ; a56b5 (29:56b5)
	db $0, "Did you see S.S.", $4f
	db "ANNE moored in", $55
	db "the harbor?", $57
; 0xa56b5 + 45 bytes

_UnnamedText_198ac: ; a56e2 (29:56e2)
	db $0, "So, S.S.ANNE has", $4f
	db "departed!", $51
	db "She'll be back in", $4f
	db "about a year.", $57
; 0xa56e2 + 59 bytes

_SSAnneWelcomeText4: ; a571d (29:571d)
	db $0, "Welcome to S.S.", $4f
	db "ANNE!", $57
; 0xa571d + 23 bytes

_SSAnneWelcomeText9: ; a5734 (29:5734)
	db $0, "Welcome to S.S.", $4f
	db "ANNE!", $51
	db "Excuse me, do you", $4f
	db "have a ticket?", $58
; 0xa5734 + 56 bytes

_SSAnneFlashedTicketText: ; a576c (29:576c)
	db $0, $52, " flashed", $4f
	db "the S.S.TICKET!", $51
	db "Great! Welcome to", $4f
	db "S.S.ANNE!", $57
; 0xa576c + 55 bytes

_SSAnneNoTicketText: ; a57a3 (29:57a3)
	db $0, $52, " doesn't", $4f
	db "have the needed", $55
	db "S.S.TICKET.", $51
	db "Sorry!", $51
	db "You need a ticket", $4f
	db "to get aboard.", $57
; 0xa57a3 + 78 bytes

_SSAnneNotHereText: ; a57f1 (29:57f1)
	db $0, "The ship set sail.", $57
; 0xa57f1 + 20 bytes

_VermilionCityText4: ; a5805 (29:5805)
	db $0, "I'm putting up a", $4f
	db "building on this", $55
	db "plot of land.", $51
	db "My #MON is", $4f
	db "tamping the land.", $57

_VermilionCityText5: ; a5852 (29:5852)
	db $0, "MACHOP: Guoh!", $4f
	db "Gogogoh!@@"

_VermilionCityText14: ; a586b (29:586b)
	db $0, $51
	db "A MACHOP is", $4f
	db "stomping the land", $55
	db "flat.", $57

_VermilionCityText6: ; a5891 (29:5891)
	db $0, "S.S.ANNE is a", $4f
	db "famous luxury", $55
	db "cruise ship.", $51
	db "We visit VERMILION", $4f
	db "once a year.", $57

_VermilionCityText7: ; a58db (29:58db)
	db $0, "VERMILION CITY", $4f
	db "The Port of", $55
	db "Exquisite Sunsets", $57

_VermilionCityText8: ; a5909 (29:5909)
	db $0, "NOTICE!", $51
	db "ROUTE 12 may be", $4f
	db "blocked off by a", $55
	db "sleeping #MON.", $51
	db "Detour through", $4f
	db "ROCK TUNNEL to", $55
	db "LAVENDER TOWN.", $51
	db "VERMILION POLICE", $57

_VermilionCityText11: ; a5980 (29:5980)
	db $0, "#MON FAN CLUB", $4f
	db "All #MON fans", $55
	db "welcome!", $57

_VermilionCityText12: ; a59a6 (29:59a6)
	db $0, "VERMILION CITY", $4f
	db "#MON GYM", $55
	db "LEADER: LT.SURGE", $51
	db "The Lightning ", $4f
	db "American!", $57

_VermilionCityText13: ; a59e9 (29:59e9)
	db $0, "VERMILION HARBOR", $57

_CeladonCityText1: ; a59fb (29:59fb)
	db $0, "I got my KOFFING", $4f
	db "in CINNABAR!", $51
	db "It's nice, but it", $4f
	db "breathes poison", $55
	db "when it's angry!", $57

_CeladonCityText2: ; a5a4b (29:5a4b)
	db $0, "Heheh! This GYM", $4f
	db "is great! It's", $55
	db "full of women!", $57

_CeladonCityText3: ; a5a79 (29:5a79)
	db $0, "The GAME CORNER", $4f
	db "is bad for our", $55
	db "city's image!", $57

_CeladonCityText4: ; a5aa6 (29:5aa6)
	db $0, "Moan! I blew it", $4f
	db "all at the slots!", $51
	db "I knew I should", $4f
	db "have cashed in my", $55
	db "coins for prizes!", $57

_TM41PreText: ; a5afd (29:5afd)
	db $0, "Hello, there!", $51
	db "I've seen you,", $4f
	db "but I never had a", $55
	db "chance to talk!", $51
	db "Here's a gift for", $4f
	db "dropping by!", $58
; 0xa5afd + 93 bytes

_ReceivedTM41Text: ; a5b5a (29:5b5a)
	db $0, $52, " received", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!@@"
; 0xa5b6e

_TM41ExplanationText: ; a5b6e (29:5b6e)
	db $0, "TM41 teaches", $4f
	db "SOFTBOILED!", $51
	db "Only one #MON", $4f
	db "can use it!", $51
	db "That #MON is", $4f
	db "CHANSEY!", $57
; 0xa5b6e + 74 bytes

_TM41NoRoomText: ; a5bb8 (29:5bb8)
	db $0, "Oh, your pack is", $4f
	db "full of items!", $57
; 0xa5bb8 + 33 bytes

_CeladonCityText6: ; a5bd9 (29:5bd9)
	db $0, "This is my trusted", $4f
	db "pal, POLIWRATH!", $51
	db "It evolved from", $4f
	db "POLIWHIRL when I", $55
	db "used WATER STONE!", $57

_CeladonCityText7: ; a5c30 (29:5c30)
	db $0, "POLIWRATH: Ribi", $4f
	db "ribit!@@"

_CeladonCityText8: ; a5c49 (29:5c49)
	db $0, "What are you", $4f
	db "staring at?", $57

_CeladonCityText9: ; a5c63 (29:5c63)
	db $0, "Keep out of TEAM", $4f
	db "ROCKET's way!", $57

_CeladonCityText10: ; a5c82 (29:5c82)
	db $0, "TRAINER TIPS", $51
	db "X ACCURACY boosts", $4f
	db "the accuracy of", $55
	db "techniques!", $51
	db "DIRE HIT jacks up", $4f
	db "the likelihood of", $55
	db "critical hits!", $51
	db "Get your items at", $4f
	db "CELADON DEPT.", $55
	db "STORE!", $57

_CeladonCityText11: ; a5d18 (29:5d18)
	db $0, "CELADON CITY", $4f
	db "The City of", $55
	db "Rainbow Dreams", $57

_CeladonCityText13: ; a5d41 (29:5d41)
	db $0, "CELADON CITY", $4f
	db "#MON GYM", $55
	db "LEADER: ERIKA", $51
	db "The Nature Loving", $4f
	db "Princess!", $57

_CeladonCityText14: ; a5d82 (29:5d82)
	db $0, "CELADON MANSION", $57

_CeladonCityText15: ; a5d93 (29:5d93)
	db $0, "Find what you", $4f
	db "need at CELADON", $55
	db "DEPT. STORE!", $57

_CeladonCityText16: ; a5dbf (29:5dbf)
	db $0, "TRAINER TIPS", $51
	db "GUARD SPEC.", $4f
	db "protects #MON", $55
	db "against SPECIAL", $55
	db "attacks such as", $55
	db "fire and water!", $51
	db "Get your items at", $4f
	db "CELADON DEPT.", $55
	db "STORE!", $57

_CeladonCityText17: ; a5e3e (29:5e3e)
	db $0, "Coins exchanged", $4f
	db "for prizes!", $55
	db "PRIZE EXCHANGE", $57

_CeladonCityText18: ; a5e6a (29:5e6a)
	db $0, "ROCKET GAME CORNER", $4f
	db "The playground", $55
	db "for grown-ups!", $57

_FuchsiaCityText1: ; a5e9c (29:5e9c)
	db $0, "Did you try the", $4f
	db "SAFARI GAME? Some", $55
	db "#MON can only", $55
	db "be caught there.", $57

_FuchsiaCityText2: ; a5ede (29:5ede)
	db $0, "SAFARI ZONE has a", $4f
	db "zoo in front of", $55
	db "the entrance.", $51
	db "Out back is the", $4f
	db "SAFARI GAME for", $55
	db "catching #MON.", $57

_FuchsiaCityText3: ; a5f3e (29:5f3e)
	db $0, "ERIK: Where's", $4f
	db "SARA? I said I'd", $55
	db "meet her here.", $57

_FuchsiaCityText4: ; a5f6b (29:5f6b)
	db $0, "That item ball in", $4f
	db "there is really a", $55
	db "#MON.", $57

_FuchsiaCityText5: ; a5f96 (29:5f96)
	db $0, "!", $57

_FuchsiaCityText11: ; a5f99 (29:5f99)
	db $0, "FUCHSIA CITY", $4f
	db "Behold! It's", $55
	db "Passion Pink!", $57

_FuchsiaCityText13: ; a5fc1 (29:5fc1)
	db $0, "SAFARI GAME", $4f
	db "#MON-U-CATCH!", $57

_FuchsiaCityText16: ; a5fdc (29:5fdc)
	db $0, "SAFARI ZONE", $4f
	db "WARDEN's HOME", $57

_FuchsiaCityText17: ; a5ff6 (29:5ff6)
	db $0, "#MON PARADISE", $4f
	db "SAFARI ZONE", $57

_FuchsiaCityText18: ; a6011 (29:6011)
	db $0, "FUCHSIA CITY", $4f
	db "#MON GYM", $55
	db "LEADER: KOGA", $51
	db "The Poisonous", $4f
	db "Ninja Master", $57

_FuchsiaCityChanseyText: ; a6050 (29:6050)
	db $0, "Name: CHANSEY", $51
	db "Catching one is", $4f
	db "all up to chance.", $58
; 0xa6050 + 49 bytes

_FuchsiaCityVoltorbText: ; a6081 (29:6081)
	db $0, "Name: VOLTORB", $51
	db "The very image of", $4f
	db "a # BALL.", $58
; 0xa6081 + 43 bytes

_FuchsiaCityKangaskhanText: ; a60ac (29:60ac)
	db $0, "Name: KANGASKHAN", $51
	db "A maternal #MON", $4f
	db "that raises its", $55
	db "young in a pouch", $55
	db "on its belly.", $58
; 0xa60ac + 81 bytes

_FuchsiaCitySlowpokeText: ; a60fd (29:60fd)
	db $0, "Name: SLOWPOKE", $51
	db "Friendly and very", $4f
	db "slow moving.", $58
; 0xa60fd + 47 bytes

_FuchsiaCityLaprasText: ; a612c (29:612c)
	db $0, "Name: LAPRAS", $51
	db "A.K.A. the king", $4f
	db "of the seas.", $58
; 0xa612c + 43 bytes

_FuchsiaCityOmanyteText: ; a6157 (29:6157)
	db $0, "Name: OMANYTE", $51
	db "A #MON that", $4f
	db "was resurrected", $55
	db "from a fossil.", $58
; 0xa6157 + 58 bytes

_FuchsiaCityKabutoText: ; a6191 (29:6191)
	db $0, "Name: KABUTO", $51
	db "A #MON that", $4f
	db "was resurrected", $55
	db "from a fossil.", $58
; 0xa6191 + 57 bytes

_UnnamedText_19b2a: ; a61ca (29:61ca)
	db $0, "...", $57
; 0xa61ca + 5 bytes

_CinnabarIslandText8: ; a61cf (29:61cf)
	db $0, "The door is", $4f
	db "locked...", $57
; 0xa61cf + 23 bytes

_CinnabarIslandText1: ; a61e6 (29:61e6)
	db $0, "CINNABAR GYM's", $4f
	db "BLAINE is an odd", $55
	db "man who has lived", $55
	db "here for decades.", $57

_CinnabarIslandText2: ; a622a (29:622a)
	db $0, "Scientists conduct", $4f
	db "experiments in", $55
	db "the burned out", $55
	db "building.", $57

_CinnabarIslandText3: ; a6266 (29:6266)
	db $0, "CINNABAR ISLAND", $4f
	db "The Fiery Town of", $55
	db "Burning Desire", $57

_CinnabarIslandText6: ; a6298 (29:6298)
	db $0, "#MON LAB", $57

_CinnabarIslandText7: ; a62a2 (29:62a2)
	db $0, "CINNABAR ISLAND", $4f
	db "#MON GYM", $55
	db "LEADER: BLAINE", $51
	db "The Hot-Headed", $4f
	db "Quiz Master!", $57

_SaffronCityText1: ; a62e7 (29:62e7)
	db $0, "What do you want?", $4f
	db "Get lost!", $57

_SaffronCityText2: ; a6304 (29:6304)
	db $0, "BOSS said he'll", $4f
	db "take this town!", $57

_SaffronCityText3: ; a6324 (29:6324)
	db $0, "Get out of the", $4f
	db "way!", $57

_SaffronCityText4: ; a6339 (29:6339)
	db $0, "SAFFRON belongs", $4f
	db "to TEAM ROCKET!", $57

_SaffronCityText5: ; a635a (29:635a)
	db $0, "Being evil makes", $4f
	db "me feel so alive!", $57

_SaffronCityText6: ; a637e (29:637e)
	db $0, "Ow! Watch where", $4f
	db "you're walking!", $57

_SaffronCityText7: ; a639e (29:639e)
	db $0, "With SILPH under", $4f
	db "control, we can", $55
	db "exploit #MON", $55
	db "around the world!", $57

_SaffronCityText8: ; a63df (29:63df)
	db $0, "You beat TEAM", $4f
	db "ROCKET all alone?", $55
	db "That's amazing!", $57

_SaffronCityText9: ; a640f (29:640f)
	db $0, "Yeah! TEAM ROCKET", $4f
	db "is gone!", $55
	db "It's safe to go", $55
	db "out again!", $57

_SaffronCityText10: ; a6445 (29:6445)
	db $0, "People should be", $4f
	db "flocking back to", $55
	db "SAFFRON now.", $57

_SaffronCityText11: ; a6475 (29:6475)
	db $0, "I flew here on my", $4f
	db "PIDGEOT when I", $55
	db "read about SILPH.", $51
	db "It's already over?", $4f
	db "I missed the", $55
	db "media action.", $57

_SaffronCityText12: ; a64d6 (29:64d6)
	db $0, "PIDGEOT: Bi bibii!@@"

_SaffronCityText13: ; a64eb (29:64eb)
	db $0, "I saw ROCKET", $4f
	db "BOSS escaping", $55
	db "SILPH's building.", $57

_SaffronCityText14: ; a6518 (29:6518)
	db $0, "I'm a security", $4f
	db "guard.", $51
	db "Suspicious kids I", $4f
	db "don't allow in!", $57

_SaffronCityText15: ; a654f (29:654f)
	db $0, "...", $4f
	db "Snore...", $51
	db "Hah! He's taking", $4f
	db "a snooze!", $57

_SaffronCityText16: ; a6577 (29:6577)
	db $0, "SAFFRON CITY", $4f
	db "Shining, Golden", $55
	db "Land of Commerce", $57

_SaffronCityText17: ; a65a6 (29:65a6)
	db $0, "FIGHTING DOJO", $57

_SaffronCityText18: ; a65b5 (29:65b5)
	db $0, "SAFFRON CITY", $4f
	db "#MON GYM", $55
	db "LEADER: SABRINA", $51
	db "The Master of", $4f
	db "Psychic #MON!", $57

_SaffronCityText20: ; a65f8 (29:65f8)
	db $0, "TRAINER TIPS", $51
	db "FULL HEAL cures", $4f
	db "all ailments like", $55
	db "sleep and burns.", $51
	db "It costs a bit", $4f
	db "more, but it's", $55
	db "more convenient.", $57

_SaffronCityText21: ; a6667 (29:6667)
	db $0, "TRAINER TIPS", $51
	db "New GREAT BALL", $4f
	db "offers improved", $55
	db "capture rates.", $51
	db "Try it on those", $4f
	db "hard-to-catch", $55
	db "#MON.", $57

_SaffronCityText22: ; a66c7 (29:66c7)
	db $0, "SILPH CO.", $4f
	db "OFFICE BUILDING", $57

_SaffronCityText24: ; a66e2 (29:66e2)
	db $0, "MR.PSYCHIC's", $4f
	db "HOUSE", $57

_SaffronCityText25: ; a66f5 (29:66f5)
	db $0, "SILPH's latest", $4f
	db "product!", $51
	db "Release to be", $4f
	db "determined...", $57

_ItemUseBallText00: ; a6729 (29:6729)
	db 0,"It dodged the",$4F
	db "thrown BALL!",$51
	db "This #MON",$4F
	db "can't be caught!",$58

_ItemUseBallText01: ; a675f (29:675f)
	db 0,"You missed the",$4F
	db "#MON!",$58

_ItemUseBallText02: ; a6775 (29:6775)
	db 0,"Darn! The #MON",$4F
	db "broke free!",$58

_ItemUseBallText03: ; a6791 (29:6791)
	db 0,"Aww! It appeared",$4F
	db "to be caught! ",$58

_ItemUseBallText04: ; a67b2 (29:67b2)
	db 0,"Shoot! It was so",$4F
	db "close too!",$58

_ItemUseBallText05: ; a67cf (29:67cf)
	db 0,"All right!",$4F,"@",1
	dw W_ENEMYMONNAME
	db 0," was",$55
	db "caught!@@"

_ItemUseBallText07: ; a67ee (29:67ee)
	db 1
	dw $DE06
	db 0," was",$4F
	db "transferred to",$55
	db "BILL's PC!",$58

_ItemUseBallText08: ; a6810 (29:6810)
	db 1
	dw $DE06
	db 0," was",$4F
	db "transferred to",$55
	db "someone's PC!",$58

_ItemUseBallText06: ; a6835 (29:6835)
	db 0,"New #DEX data",$4F
	db "will be added for",$55,"@"
	TX_RAM W_ENEMYMONNAME
	db 0,"!@@"

_SurfingGotOnText: ; a685e (29:685e)
	db $0, $52, " got on", $4f
	db "@"
	TX_RAM $cd6d
	db $0, "!", $58

_SurfingNoPlaceToGetOffText: ; a686f (29:686f)
	db $0, "There's no place", $4f
	db "to get off!", $58

_VitaminStatRoseText: ; a688c (29:688c)
	TX_RAM $cd6d
	db $0, "'s", $4f
	db "@"
	TX_RAM $cf4b
	db $0, " rose.", $58

_VitaminNoEffectText: ; a689e (29:689e)
	db $0, "It won't have any", $4f
	db "effect.", $58

_ThrewBaitText: ; a68b8 (29:68b8)
	db $0, $52, " threw", $4f
	db "some BAIT.", $57

_ThrewRockText: ; a68cc (29:68cc)
	db $0, $52, " threw a", $4f
	db "ROCK.", $57

_PlayedFluteNoEffectText: ; a68dd (29:68dd)
	db $0, "Played the #", $4f
	db "FLUTE.", $51
	db "Now, that's a", $4f
	db "catchy tune!", $58

_FluteWokeUpText: ; a690c (29:690c)
	db $0, "All sleeping", $4f
	db "#MON woke up.", $58

_PlayedFluteHadEffectText: ; a6928 (29:6928)
	db $0, $52, " played the", $4f
	db "# FLUTE.@@"

_CoinCaseNumCoinsText: ; a6940 (29:6940)
	db $0, "Coins", $4f
	db "@"
	db $2, $a4, $d5, $c2 ; print BCD number
	db $0, " ", $58

_ItemfinderFoundItemText: ; a694f (29:694f)
	db $0, "Yes! ITEMFINDER", $4f
	db "indicates there's", $55
	db "an item nearby.", $58

_ItemfinderFoundNothingText: ; a6981 (29:6981)
	db $0, "Nope! ITEMFINDER", $4f
	db "isn't responding.", $58

_RaisePPWhichTechniqueText: ; a69a4 (29:69a4)
	db $0, "Raise PP of which", $4f
	db "technique?", $57

_RestorePPWhichTechniqueText: ; a69c2 (29:69c2)
	db $0, "Restore PP of", $4f
	db "which technique?", $57

_PPMaxedOutText: ; a69e2 (29:69e2)
	TX_RAM $cf4b
	db $0, "'s PP", $4f
	db "is maxed out.", $58

_PPIncreasedText: ; a69f9 (29:69f9)
	TX_RAM $cf4b
	db $0, "'s PP", $4f
	db "increased.", $58

_PPRestoredText: ; a6a0d (29:6a0d)
	db $0, "PP was restored.", $58

_BootedUpTMText: ; a6a1f (29:6a1f)
	db $0, "Booted up a TM!", $58

_BootedUpHMText: ; a6a30 (29:6a30)
	db $0, "Booted up an HM!", $58

_TeachMachineMoveText: ; a6a42 (29:6a42)
	db $0, "It contained", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!", $51
	db "Teach @"
	TX_RAM $cf4b
	db $0, $4f
	db "to a #MON?", $57

_MonCannotLearnMachineMoveText: ; a6a6e (29:6a6e)
	TX_RAM $cd6d
	db $0, " is not", $4f
	db "compatible with", $55
	db "@"
	TX_RAM $cf4b
	db $0, ".", $51
	db "It can't learn", $4f
	db "@"
	TX_RAM $cf4b
	db $0, ".", $58

_ItemUseNotTimeText: ; a6aa6 (29:6aa6)
	db $0, "OAK: ", $52, "!", $4f
	db "This isn't the", $55
	db "time to use that! ", $58

_ItemUseNotYoursToUseText: ; a6ad0 (29:6ad0)
	db $0, "This isn't yours", $4f
	db "to use!", $58

_ItemUseNoEffectText: ; a6ae9 (29:6ae9)
	db $0, "It won't have any", $4f
	db "effect.", $58
; 0xa6ae9 + 26 bytes = 0xa6b03

_ThrowBallAtTrainerMonText1: ; a6b03 (29:6b03)
	db $0, "The trainer", $4f
	db "blocked the BALL!", $58

_ThrowBallAtTrainerMonText2: ; a6b22 (29:6b22)
	db $0, "Don't be a thief!", $58

_NoCyclingAllowedHereText: ; a6b34 (29:6b34)
	db $0, "No cycling", $4e, "allowed here.", $58

_NoSurfingHereText: ; a6b4e (29:6b4e)
	db $0, "No SURFing on", $4f
	db "@"
	TX_RAM $cd6d
	db $0, " here!", $58

_BoxFullCannotThrowBallText: ; a6b69 (29:6b69)
	db $0, "The #MON BOX", $4f
	db "is full! Can't", $55
	db "use that item!", $58

SECTION "bank2A",ROMX,BANK[$2A]

_ItemUseText001: ; a8000 (2a:4000)
	db 0,$52," used@@"

_ItemUseText002: ; a8009 (2a:4009)
	TX_RAM $cf4b
	db $0, "!", $57

_GotOnBicycleText1: ; a800f (2a:400f)
	db $0, $52, " got on the@@"

_GotOnBicycleText2: ; a801e (2a:401e)
	TX_RAM $cf4b
	db $0, "!", $58

_GotOffBicycleText1: ; a8024 (2a:4024)
	db $0, $52, " got off@@"

_GotOffBicycleText2: ; a8030 (2a:4030)
	db $0, "the @"
	TX_RAM $cf4b
	db $0, ".", $58

_ThrewAwayItemText: ; a803c (2a:403c)
	db $0, "Threw away", $4f
	db "@"

UnnamedText_a8049: ; a8049 (2a:4049)
	TX_RAM $cd6d
	db $0, ".", $58

_IsItOKToTossItemText: ; a804f (2a:404f)
	db $0, "Is it OK to toss", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "?", $58

_TooImportantToTossText: ; a8068 (2a:4068)
	db $0, "That's too impor-", $4f
	db "tant to toss!", $58

_UnnamedText_2fe3b: ; a8088 (2a:4088)
	TX_RAM $cd6d
	db $0, " knows", $4f
	db "@"
	TX_RAM $cf4b
	db $0, "!", $58

_UnnamedText_71d88: ; a809a (2a:409a)
	db $0, "Okay, connect the", $4f
	db "cable like so!", $58
; 0xa809a + 34 bytes

_UnnamedText_71d8d: ; a80bc (2a:40bc)
	db $0, $52, " traded", $4f
	db "@"
	TX_RAM $cd13
	db $0, " for", $55
	db "@"
	TX_RAM $cd1e
	db $0, "!@@"

_UnnamedText_71d94: ; a80d8 (2a:40d8)
	db $0, "I'm looking for", $4f
	db "@"
	TX_RAM $cd13
	db $0, "! Wanna", $51
	db "trade one for", $4f
	db "@"
	TX_RAM $cd1e
	db $0, "? ", $57

_UnnamedText_71d99: ; a810b (2a:410b)
	db $0, "Awww!", $4f
	db "Oh well...", $57
; 0xa810b + 18 bytes

_UnnamedText_71d9e: ; a811d (2a:411d)
	db $0, "What? That's not", $4f
	db "@"
; 0xa811d + 18 bytes

UnnamedText_a812f: ; a812f (2a:412f)
	TX_RAM $cd13
	db $0, "!", $51
	db "If you get one,", $4f
	db "come back here!", $57
; 0xa8155

_UnnamedText_71da3: ; a8155 (2a:4155)
	db $0, "Hey thanks!", $57
; 0xa8155 + 13 bytes

_UnnamedText_71da8: ; a8162 (2a:4162)
	db $0, "Isn't my old", $4f
	db "@"
	TX_RAM $cd1e
	db $0, " great?", $57

_UnnamedText_71dad: ; a817c (2a:417c)
	db $0, "Hello there! Do", $4f
	db "you want to trade", $51
	db "your @"
	TX_RAM $cd13
	db $0, $4f
	db "for @"
	TX_RAM $cd1e
	db $0, "?", $57

_UnnamedText_71db2: ; a81b5 (2a:41b5)
	db $0, "Well, if you", $4f
	db "don't want to...", $57
; 0xa81b5 + 30 bytes

_UnnamedText_71db7: ; a81d3 (2a:41d3)
	db $0, "Hmmm? This isn't", $4f
	db "@"
	TX_RAM $cd13
	db $0, ".", $51
	db "Think of me when", $4f
	db "you get one.", $57
; 0xa8209

_UnnamedText_71dbc: ; a8209 (2a:4209)
	db $0, "Thanks!", $57
; 0xa8209 + 9 bytes

_UnnamedText_71dc1: ; a8212 (2a:4212)
	db $0, "The @"
	TX_RAM $cd13
	db $0, " you", $4f
	db "traded to me", $51
	db "went and evolved!", $57
; 0xa8240

_UnnamedText_71dc6: ; a8240 (2a:4240)
	db $0, "Hi! Do you have", $4f
	db "@"
	TX_RAM $cd13
	db $0, "?", $51
	db "Want to trade it", $4f
	db "for @"
	TX_RAM $cd1e
	db $0, "?", $57
; 0xa8274

_UnnamedText_71dcb: ; a8274 (2a:4274)
	db $0, "That's too bad.", $57
; 0xa8274 + 16 bytes

_UnnamedText_71dd0: ; a8284 (2a:4284)
	db $0, "...This is no", $4f
	db "@"
	TX_RAM $cd13
	db $0, ".", $51
	db "If you get one,", $4f
	db "trade it with me!", $57
; 0xa82bc

_UnnamedText_71dd5: ; a82bc (2a:42bc)
	db $0, "Thanks pal!", $57
; 0xa82bc + 13 bytes

_UnnamedText_71dda: ; a82c9 (2a:42c9)
	db $0, "How is my old", $4f
	db "@"
	TX_RAM $cd1e
	db $0, "?", $51
	db "My @"
	TX_RAM $cd13
	db $0, " is", $4f
	db "doing great!", $57
; 0xa82f8

; XXX
	db $0, "There isn't", $4f
	db "anything to CUT!", $58
	TX_RAM $cd6d
	db $0, " hacked", $4f
	db "away with CUT!", $58

SECTION "bank2B",ROMX,BANK[$2B]

INCLUDE "text/pokedex.tx"

SECTION "bank2C",ROMX,BANK[$2C]

MoveNames: ; b0000 (2c:4000)
	db "POUND@"
	db "KARATE CHOP@"
	db "DOUBLESLAP@"
	db "COMET PUNCH@"
	db "MEGA PUNCH@"
	db "PAY DAY@"
	db "FIRE PUNCH@"
	db "ICE PUNCH@"
	db "THUNDERPUNCH@"
	db "SCRATCH@"
	db "VICEGRIP@"
	db "GUILLOTINE@"
	db "RAZOR WIND@"
	db "SWORDS DANCE@"
	db "CUT@"
	db "GUST@"
	db "WING ATTACK@"
	db "WHIRLWIND@"
	db "FLY@"
	db "BIND@"
	db "SLAM@"
	db "VINE WHIP@"
	db "STOMP@"
	db "DOUBLE KICK@"
	db "MEGA KICK@"
	db "JUMP KICK@"
	db "ROLLING KICK@"
	db "SAND-ATTACK@"
	db "HEADBUTT@"
	db "HORN ATTACK@"
	db "FURY ATTACK@"
	db "HORN DRILL@"
	db "TACKLE@"
	db "BODY SLAM@"
	db "WRAP@"
	db "TAKE DOWN@"
	db "THRASH@"
	db "DOUBLE-EDGE@"
	db "TAIL WHIP@"
	db "POISON STING@"
	db "TWINEEDLE@"
	db "PIN MISSILE@"
	db "LEER@"
	db "BITE@"
	db "GROWL@"
	db "ROAR@"
	db "SING@"
	db "SUPERSONIC@"
	db "SONICBOOM@"
	db "DISABLE@"
	db "ACID@"
	db "EMBER@"
	db "FLAMETHROWER@"
	db "MIST@"
	db "WATER GUN@"
	db "HYDRO PUMP@"
	db "SURF@"
	db "ICE BEAM@"
	db "BLIZZARD@"
	db "PSYBEAM@"
	db "BUBBLEBEAM@"
	db "AURORA BEAM@"
	db "HYPER BEAM@"
	db "PECK@"
	db "DRILL PECK@"
	db "SUBMISSION@"
	db "LOW KICK@"
	db "COUNTER@"
	db "SEISMIC TOSS@"
	db "STRENGTH@"
	db "ABSORB@"
	db "MEGA DRAIN@"
	db "LEECH SEED@"
	db "GROWTH@"
	db "RAZOR LEAF@"
	db "SOLARBEAM@"
	db "POISONPOWDER@"
	db "STUN SPORE@"
	db "SLEEP POWDER@"
	db "PETAL DANCE@"
	db "STRING SHOT@"
	db "DRAGON RAGE@"
	db "FIRE SPIN@"
	db "THUNDERSHOCK@"
	db "THUNDERBOLT@"
	db "THUNDER WAVE@"
	db "THUNDER@"
	db "ROCK THROW@"
	db "EARTHQUAKE@"
	db "FISSURE@"
	db "DIG@"
	db "TOXIC@"
	db "CONFUSION@"
	db "PSYCHIC@"
	db "HYPNOSIS@"
	db "MEDITATE@"
	db "AGILITY@"
	db "QUICK ATTACK@"
	db "RAGE@"
	db "TELEPORT@"
	db "NIGHT SHADE@"
	db "MIMIC@"
	db "SCREECH@"
	db "DOUBLE TEAM@"
	db "RECOVER@"
	db "HARDEN@"
	db "MINIMIZE@"
	db "SMOKESCREEN@"
	db "CONFUSE RAY@"
	db "WITHDRAW@"
	db "DEFENSE CURL@"
	db "BARRIER@"
	db "LIGHT SCREEN@"
	db "HAZE@"
	db "REFLECT@"
	db "FOCUS ENERGY@"
	db "BIDE@"
	db "METRONOME@"
	db "MIRROR MOVE@"
	db "SELFDESTRUCT@"
	db "EGG BOMB@"
	db "LICK@"
	db "SMOG@"
	db "SLUDGE@"
	db "BONE CLUB@"
	db "FIRE BLAST@"
	db "WATERFALL@"
	db "CLAMP@"
	db "SWIFT@"
	db "SKULL BASH@"
	db "SPIKE CANNON@"
	db "CONSTRICT@"
	db "AMNESIA@"
	db "KINESIS@"
	db "SOFTBOILED@"
	db "HI JUMP KICK@"
	db "GLARE@"
	db "DREAM EATER@"
	db "POISON GAS@"
	db "BARRAGE@"
	db "LEECH LIFE@"
	db "LOVELY KISS@"
	db "SKY ATTACK@"
	db "TRANSFORM@"
	db "BUBBLE@"
	db "DIZZY PUNCH@"
	db "SPORE@"
	db "FLASH@"
	db "PSYWAVE@"
	db "SPLASH@"
	db "ACID ARMOR@"
	db "CRABHAMMER@"
	db "EXPLOSION@"
	db "FURY SWIPES@"
	db "BONEMERANG@"
	db "REST@"
	db "ROCK SLIDE@"
	db "HYPER FANG@"
	db "SHARPEN@"
	db "CONVERSION@"
	db "TRI ATTACK@"
	db "SUPER FANG@"
	db "SLASH@"
	db "SUBSTITUTE@"
	db "STRUGGLE@"