ref: 63dcee0772cddb232afa15faee93c740a70b6518
parent: 762008952d9cb3cf8435ad5de31025c76cd4c6e3
author: yenatch <[email protected]>
date: Thu Apr 17 22:08:19 EDT 2014
Script vars and the color test debug menu.
--- a/main.asm
+++ b/main.asm
@@ -63091,13 +63091,13 @@
; no known jump sources
Function80648:: ; 80648 (20:4648)
ld a, c
- cp $1b
+ cp NUM_VARS
jr c, .asm_8064e
xor a
.asm_8064e
ld c, a
- ld b, $0
- ld hl, $4671
+ ld b, 0
+ ld hl, Unknown_80671
add hl, bc
add hl, bc
add hl, bc
@@ -63125,27 +63125,1258 @@
ret
; 80671 (20:4671)
-INCBIN "baserom.gbc",$80671,$806e1 - $80671
+Unknown_80671: ; 80671
+; $00: return address
+; $40: return at StringBuffer2
+; $80: return function result at StringBuffer2
+ dwb StringBuffer2, $00
+ dwb PartyCount, $00
+ dwb Function80728, $80
+ dwb BattleType, $40
+ dwb TimeOfDay, $00
+ dwb Function806c5, $80
+ dwb Function806d3, $80
+ dwb Function806e1, $80
+ dwb PlayerState, $40
+ dwb Function806ef, $80
+ dwb hHours, $00
+ dwb Function806f9, $80
+ dwb MapGroup, $00
+ dwb MapNumber, $00
+ dwb Function806ff, $80
+ dwb $d19a, $00
+ dwb Function80715, $80
+ dwb $d46c, $00
+ dwb XCoord, $00
+ dwb YCoord, $00
+ dwb $dc31, $00
+ dwb $cf64, $00
+ dwb $dca4, $00
+ dwb $dbf9, $40
+ dwb $dc4b, $40
+ dwb $dc4a, $40
+ dwb $dc58, $00
+ dwb NULL, $00
+; 806c5
+
+Function806c5: ; 806c5
+; Caught mons.
+ ld hl, PokedexCaught
+ ld b, $20
+ call CountSetBits
+ ld a, [$d265]
+ jp Function8066c
+; 806d3
+
+Function806d3: ; 806d3
+; Seen mons.
+ ld hl, PokedexSeen
+ ld b, $20
+ call CountSetBits
+ ld a, [$d265]
+ jp Function8066c
+; 806e1
+
+Function806e1: ; 806e1
+; Number of owned badges.
ld hl, JohtoBadges ; $d857
- ld b, $2
+ ld b, 2
call CountSetBits
ld a, [$d265]
jp Function8066c
+; 806ef
+
+Function806ef: ; 806ef
+; The direction the player is facing.
ld a, [PlayerDirection] ; $d4de
and $c
rrca
rrca
jp Function8066c
+; 806f9
+
+Function806f9: ; 806f9
+; The day of the week.
call GetWeekday
jp Function8066c
-; 806ff (20:46ff)
+; 806ff
-INCBIN "baserom.gbc",$806ff,$80730 - $806ff
+Function806ff: ; 806ff
+; Number of unique Unown caught.
+ call .count
+ ld a, b
+ jp Function8066c
+.count
+ ld hl, UnownDex
+ ld b, 0
+.loop
+ ld a, [hli]
+ and a
+ ret z
+ inc b
+ ld a, b
+ cp 26
+ jr c, .loop
+ ret
+; 80715
+
+Function80715: ; 80715
+; Remaining slots in the current box.
+ ld a, $1
+ call GetSRAMBank
+ ld hl, BoxCount
+ ld a, 20
+ sub [hl]
+ ld b, a
+ call CloseSRAM
+ ld a, b
+ jp Function8066c
+; 80728
+
+Function80728: ; 80728
+ ld a, [$d0ee]
+ and $3f
+ jp Function8066c
+; 80730
+
+
BattleText::
INCLUDE "text/battle.asm"
-INCBIN "baserom.gbc",$818ac,$81fe3 - $818ac
+
+ColorTest: ; 818ac
+; A debug menu to test monster and trainer palettes at runtime.
+
+ ld a, [hCGB]
+ and a
+ jr nz, .asm_818b5
+ ld a, [hSGB]
+ and a
+ ret z
+
+.asm_818b5
+ ld a, [$ffaa]
+ push af
+ ld a, $1
+ ld [$ffaa], a
+ call DisableLCD
+ call Function81948
+ call Function8197c
+ call Function819a7
+ call Function818f4
+ call EnableLCD
+ ld de, MUSIC_NONE
+ call PlayMusic
+ xor a
+ ld [$cf63], a
+ ld [$cf66], a
+ ld [$d003], a
+.asm_818de
+ ld a, [$cf63]
+ bit 7, a
+ jr nz, .asm_818f0
+ call Function81a74
+ call Function81f5e
+ call DelayFrame
+ jr .asm_818de
+
+.asm_818f0
+ pop af
+ ld [$ffaa], a
+ ret
+; 818f4
+
+Function818f4: ; 818f4
+ ld a, [DefaultFlypoint]
+ and a
+ jr nz, Function81911
+ ld hl, PokemonPalettes
+
+Function818fd: ; 818fd
+ ld de, OverworldMap
+ ld c, NUM_POKEMON + 1
+.asm_81902
+ push bc
+ push hl
+ call Function81928
+ pop hl
+ ld bc, $0008
+ add hl, bc
+ pop bc
+ dec c
+ jr nz, .asm_81902
+ ret
+
+Function81911: ; 81911
+ ld hl, TrainerPalettes
+ ld de, OverworldMap
+ ld c, NUM_TRAINER_CLASSES
+.asm_81919
+ push bc
+ push hl
+ call Function81928
+ pop hl
+ ld bc, $0004
+ add hl, bc
+ pop bc
+ dec c
+ jr nz, .asm_81919
+ ret
+; 81928
+
+Function81928: ; 81928
+ ld a, BANK(PokemonPalettes) ; BANK(TrainerPalettes)
+ call GetFarByte
+ ld [de], a
+ inc de
+ inc hl
+ ld a, BANK(PokemonPalettes) ; BANK(TrainerPalettes)
+ call GetFarByte
+ ld [de], a
+ inc de
+ inc hl
+ ld a, BANK(PokemonPalettes) ; BANK(TrainerPalettes)
+ call GetFarByte
+ ld [de], a
+ inc de
+ inc hl
+ ld a, BANK(PokemonPalettes) ; BANK(TrainerPalettes)
+ call GetFarByte
+ ld [de], a
+ inc de
+ ret
+; 81948
+
+Function81948: ; 81948
+ ld a, $1
+ ld [rVBK], a
+ ld hl, VTiles0
+ ld bc, $2000
+ xor a
+ call ByteFill
+ ld a, $0
+ ld [rVBK], a
+ ld hl, VTiles0
+ ld bc, $2000
+ xor a
+ call ByteFill
+ ld hl, AttrMap
+ ld bc, $0168
+ xor a
+ call ByteFill
+ ld hl, TileMap
+ ld bc, $0168
+ xor a
+ call ByteFill
+ call ClearSprites
+ ret
+; 8197c
+
+Function8197c: ; 8197c
+ ld hl, DebugColorTestGFX + $10
+ ld de, $96a0
+ ld bc, $0160
+ call CopyBytes
+ ld hl, DebugColorTestGFX
+ ld de, VTiles0
+ ld bc, $0010
+ call CopyBytes
+ call Functione51
+ ld hl, VTiles1
+ ld bc, $0800
+.asm_8199d
+ ld a, [hl]
+ xor $ff
+ ld [hli], a
+ dec bc
+ ld a, c
+ or b
+ jr nz, .asm_8199d
+ ret
+; 819a7
+
+Function819a7: ; 819a7
+ ld a, [hCGB]
+ and a
+ ret z
+ ld a, [rSVBK]
+ push af
+ ld a, $5
+ ld [rSVBK], a
+ ld hl, Palette_819f4
+ ld de, BGPals
+ ld bc, $0080
+ call CopyBytes
+ ld a, $80
+ ld [rBGPI], a
+ ld hl, Palette_819f4
+ ld c, $40
+ xor a
+.asm_819c8
+ ld [rBGPD], a
+ dec c
+ jr nz, .asm_819c8
+ ld a, $80
+ ld [rOBPI], a
+ ld hl, Palette_81a34
+ ld c, $40
+.asm_819d6
+ ld a, [hli]
+ ld [rOBPD], a
+ dec c
+ jr nz, .asm_819d6
+ ld a, $94
+ ld [EnemyMoveAnimation], a
+ ld a, $52
+ ld [EnemyMoveEffect], a
+ ld a, $4a
+ ld [EnemyMovePower], a
+ ld a, $29
+ ld [EnemyMoveType], a
+ pop af
+ ld [rSVBK], a
+ ret
+; 819f4
+
+Palette_819f4: ; 819f4
+ ; white
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+
+ ; red
+ RGB 31, 00, 00
+ RGB 31, 00, 00
+ RGB 31, 00, 00
+ RGB 00, 00, 00
+
+ ; green
+ RGB 00, 31, 00
+ RGB 00, 31, 00
+ RGB 00, 31, 00
+ RGB 00, 00, 00
+
+ ; blue
+ RGB 00, 00, 31
+ RGB 00, 00, 31
+ RGB 00, 00, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+
+Palette_81a34: ; 81a34
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+
+ ; red
+ RGB 31, 31, 31
+ RGB 31, 00, 00
+ RGB 31, 00, 00
+ RGB 00, 00, 00
+
+ ; green
+ RGB 31, 31, 31
+ RGB 00, 31, 00
+ RGB 00, 31, 00
+ RGB 00, 00, 00
+
+ ; blue
+ RGB 31, 31, 31
+ RGB 00, 00, 31
+ RGB 00, 00, 31
+ RGB 00, 00, 00
+; 81a74
+
+Function81a74: ; 81a74
+ call Functiona57
+ ld a, [$cf63]
+ cp $4
+ jr nc, .asm_81a8b
+ ld hl, $ffa9
+ ld a, [hl]
+ and $4
+ jr nz, .asm_81a9a
+ ld a, [hl]
+ and $8
+ jr nz, .asm_81aab
+
+.asm_81a8b
+ ld a, [$cf63]
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_81acf
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+
+.asm_81a9a
+ call Function81eca
+ call Function81ac3
+ ld e, a
+ ld a, [$cf66]
+ inc a
+ cp e
+ jr c, .asm_81aba
+ xor a
+ jr .asm_81aba
+
+.asm_81aab
+ call Function81eca
+ ld a, [$cf66]
+ dec a
+ cp $ff
+ jr nz, .asm_81aba
+ call Function81ac3
+ dec a
+
+.asm_81aba
+ ld [$cf66], a
+ ld a, $0
+ ld [$cf63], a
+ ret
+; 81ac3
+
+Function81ac3: ; 81ac3
+; Looping back around the pic set.
+ ld a, [DefaultFlypoint]
+ and a
+ jr nz, .asm_81acc
+ ld a, NUM_POKEMON ; CELEBI
+ ret
+
+.asm_81acc
+ ld a, NUM_TRAINER_CLASSES - 1 ; MYSTICALMAN
+ ret
+; 81acf
+
+Jumptable_81acf: ; 81acf
+ dw Function81adb
+ dw Function81c18
+ dw Function81c33
+ dw Function81cc2
+ dw Function81d8e
+ dw Function81daf
+; 81adb
+
+Function81adb: ; 81adb
+ xor a
+ ld [hBGMapMode], a
+ ld hl, TileMap
+ ld bc, $0168
+ ld a, $6f
+ call ByteFill
+ ld hl, $c4dd
+ ld bc, $0712
+ ld a, $6c
+ call Function81efc
+ ld hl, $c4ab
+ ld bc, $0203
+ ld a, $6d
+ call Function81efc
+ ld hl, $c4b0
+ ld bc, $0203
+ ld a, $6e
+ call Function81efc
+ call Function81bc0
+ call Function81bf4
+ ld a, [$cf66]
+ inc a
+ ld [CurPartySpecies], a
+ ld [$d265], a
+ ld hl, $c4b4
+ ld de, $d265
+ ld bc, $8103
+ call PrintNum
+ ld a, [DefaultFlypoint]
+ and a
+ jr nz, .asm_81b7a
+ ld a, $1
+ ld [UnownLetter], a
+ call GetPokemonName
+ ld hl, $c4b8
+ call PlaceString
+ xor a
+ ld [$c2c6], a
+ ld hl, $c4e8
+ call Function378b
+ ld de, $9310
+ ld a, $3d
+ call Predef
+ ld a, $31
+ ld [$ffad], a
+ ld hl, $c4f2
+ ld bc, $0606
+ ld a, $13
+ call Predef
+ ld a, [$d003]
+ and a
+ jr z, .asm_81b66
+ ld de, String_81baf
+ jr .asm_81b69
+
+.asm_81b66
+ ld de, String_81bb4
+
+.asm_81b69
+ ld hl, $c5fb
+ call PlaceString
+ ld hl, $c5f4
+ ld de, String_81bb9
+ call PlaceString
+ jr .asm_81ba9
+
+.asm_81b7a
+ ld a, [$d265]
+ ld [TrainerClass], a
+ callab Function3957b
+ ld de, StringBuffer1
+ ld hl, $c4b8
+ call PlaceString
+ ld de, VTiles2
+ callab Function5120d
+ xor a
+ ld [TempEnemyMonSpecies], a
+ ld [$ffad], a
+ ld hl, $c4de
+ ld bc, $0707
+ ld a, $13
+ call Predef
+
+.asm_81ba9
+ ld a, $1
+ ld [$cf63], a
+ ret
+; 81baf
+
+String_81baf: db "レア", $6f, $6f, "@" ; rare (shiny)
+String_81bb4: db "ノーマル@" ; normal
+String_81bb9: db $7a, "きりかえ▶@" ; (A) switches
+; 81bc0
+
+Function81bc0: ; 81bc0
+ ld de, $ceb5
+ ld hl, $c57e
+ ld a, $1
+ call Function81bde
+ ld de, $cedd
+ ld hl, $c5a6
+ ld a, $2
+ call Function81bde
+ ld de, $cf05
+ ld hl, $c5ce
+ ld a, $3
+
+Function81bde: ; 81bde
+ push af
+ ld a, $6a
+ ld [hli], a
+ ld bc, $000f
+ ld a, $6b
+ call ByteFill
+ ld l, e
+ ld h, d
+ pop af
+ ld bc, $0028
+ call ByteFill
+ ret
+; 81bf4
+
+Function81bf4: ; 81bf4
+ ld a, [$cf66]
+ inc a
+ ld l, a
+ ld h, $0
+ add hl, hl
+ add hl, hl
+ ld de, OverworldMap
+ add hl, de
+ ld de, EnemyMoveAnimation
+ ld bc, $0004
+ call CopyBytes
+ xor a
+ ld [$cf64], a
+ ld [$cf65], a
+ ld de, EnemyMoveAnimation
+ call Function81ea5
+ ret
+; 81c18
+
+Function81c18: ; 81c18
+ ld a, [hCGB]
+ and a
+ jr z, .asm_81c2a
+ ld a, $2
+ ld [hBGMapMode], a
+ call DelayFrame
+ call DelayFrame
+ call DelayFrame
+
+.asm_81c2a
+ call WaitBGMap
+ ld a, $2
+ ld [$cf63], a
+ ret
+; 81c33
+
+Function81c33: ; 81c33
+ ld a, [hCGB]
+ and a
+ jr z, .asm_81c69
+ ld a, [rSVBK]
+ push af
+ ld a, $5
+ ld [rSVBK], a
+ ld hl, BGPals
+ ld de, EnemyMoveAnimation
+ ld c, $1
+ call Function81ee3
+ ld hl, $c4d2
+ ld de, EnemyMoveAnimation
+ call Function81ca7
+ ld hl, $c4d7
+ ld de, EnemyMovePower
+ call Function81ca7
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ld a, $3
+ ld [$cf63], a
+ pop af
+ ld [rSVBK], a
+ ret
+
+.asm_81c69
+ ld hl, $cda9
+ ld a, $1
+ ld [hli], a
+ ld a, $ff
+ ld [hli], a
+ ld a, $7f
+ ld [hli], a
+ ld a, [EnemyMoveAnimation]
+ ld [hli], a
+ ld a, [EnemyMoveEffect]
+ ld [hli], a
+ ld a, [EnemyMovePower]
+ ld [hli], a
+ ld a, [EnemyMoveType]
+ ld [hli], a
+ xor a
+ ld [hli], a
+ ld [hli], a
+ ld [hl], a
+ ld hl, $cda9
+ call Function81f0c
+ ld hl, $c4d2
+ ld de, EnemyMoveAnimation
+ call Function81ca7
+ ld hl, $c4d7
+ ld de, EnemyMovePower
+ call Function81ca7
+ ld a, $3
+ ld [$cf63], a
+ ret
+; 81ca7
+
+Function81ca7: ; 81ca7
+ inc hl
+ inc hl
+ inc hl
+ ld a, [de]
+ call Function81cbc
+ ld a, [de]
+ swap a
+ call Function81cbc
+ inc de
+ ld a, [de]
+ call Function81cbc
+ ld a, [de]
+ swap a
+
+Function81cbc: ; 81cbc
+ and $f
+ add $70
+ ld [hld], a
+ ret
+; 81cc2
+
+Function81cc2: ; 81cc2
+ ld a, [$ffa9]
+ and $2
+ jr nz, .asm_81cdf
+ ld a, [$ffa9]
+ and $1
+ jr nz, .asm_81ce5
+ ld a, [$cf64]
+ and $3
+ ld e, a
+ ld d, 0
+ ld hl, Jumptable_81d02
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+
+.asm_81cdf
+ ld a, $4
+ ld [$cf63], a
+ ret
+
+.asm_81ce5
+ ld a, [DefaultFlypoint]
+ and a
+ ret nz
+ ld a, [$d003]
+ xor $4
+ ld [$d003], a
+ ld c, a
+ ld b, 0
+ ld hl, PokemonPalettes
+ add hl, bc
+ call Function818fd
+ ld a, $0
+ ld [$cf63], a
+ ret
+; 81d02
+
+Jumptable_81d02: ; 81d02
+ dw Function81d0a
+ dw Function81d34
+ dw Function81d46
+ dw Function81d58
+; 81d0a
+
+Function81d0a: ; 81d0a
+ ld hl, $ffa9
+ ld a, [hl]
+ and $80
+ jr nz, Function81d89
+ ld a, [hl]
+ and $20
+ jr nz, .asm_81d1d
+ ld a, [hl]
+ and $10
+ jr nz, .asm_81d28
+ ret
+
+.asm_81d1d
+ xor a
+ ld [$cf65], a
+ ld de, EnemyMoveAnimation
+ call Function81ea5
+ ret
+
+.asm_81d28
+ ld a, $1
+ ld [$cf65], a
+ ld de, EnemyMovePower
+ call Function81ea5
+ ret
+
+Function81d34: ; 81d34
+ ld hl, $ffa9
+ ld a, [hl]
+ and $80
+ jr nz, Function81d89
+ ld a, [hl]
+ and $40
+ jr nz, Function81d84
+ ld hl, PlayerMoveType
+ jr Function81d63
+
+Function81d46: ; 81d46
+ ld hl, $ffa9
+ ld a, [hl]
+ and $80
+ jr nz, Function81d89
+ ld a, [hl]
+ and $40
+ jr nz, Function81d84
+ ld hl, PlayerMoveAccuracy
+ jr Function81d63
+
+Function81d58: ; 81d58
+ ld hl, $ffa9
+ ld a, [hl]
+ and $40
+ jr nz, Function81d84
+ ld hl, PlayerMovePP
+
+Function81d63: ; 81d63
+ ld a, [$ffa9]
+ and $10
+ jr nz, Function81d70
+ ld a, [$ffa9]
+ and $20
+ jr nz, Function81d77
+ ret
+
+Function81d70: ; 81d70
+ ld a, [hl]
+ cp $1f
+ ret nc
+ inc [hl]
+ jr Function81d7b
+
+Function81d77: ; 81d77
+ ld a, [hl]
+ and a
+ ret z
+ dec [hl]
+
+Function81d7b: ; 81d7b
+ call Function81e67
+ ld a, $2
+ ld [$cf63], a
+ ret
+
+Function81d84: ; 81d84
+ ld hl, $cf64
+ dec [hl]
+ ret
+
+Function81d89: ; 81d89
+ ld hl, $cf64
+ inc [hl]
+ ret
+; 81d8e
+
+Function81d8e: ; 81d8e
+ ld hl, $c568
+ ld bc, $00a0
+ ld a, $6f
+ call ByteFill
+ ld hl, $c592
+ ld de, String_81fcd
+ call PlaceString
+ xor a
+ ld [$d004], a
+ call Function81df4
+ ld a, $5
+ ld [$cf63], a
+ ret
+; 81daf
+
+Function81daf: ; 81daf
+ ld hl, hJoyPressed
+ ld a, [hl]
+ and $2
+ jr nz, .asm_81dbb
+ call Function81dc7
+ ret
+
+.asm_81dbb
+ ld a, $0
+ ld [$cf63], a
+ ret
+; 81dc1
+
+Function81dc1: ; 81dc1
+ ld hl, $cf63
+ set 7, [hl]
+ ret
+; 81dc7
+
+Function81dc7: ; 81dc7
+ ld hl, $ffa9
+ ld a, [hl]
+ and $40
+ jr nz, .asm_81dd5
+ ld a, [hl]
+ and $80
+ jr nz, .asm_81de2
+ ret
+
+.asm_81dd5
+ ld a, [$d004]
+ cp $3b
+ jr z, .asm_81ddf
+ inc a
+ jr .asm_81ded
+
+.asm_81ddf
+ xor a
+ jr .asm_81ded
+
+.asm_81de2
+ ld a, [$d004]
+ and a
+ jr z, .asm_81deb
+ dec a
+ jr .asm_81ded
+
+.asm_81deb
+ ld a, $3b
+
+.asm_81ded
+ ld [$d004], a
+ call Function81df4
+ ret
+; 81df4
+
+Function81df4: ; 81df4
+ ld hl, $c586
+ call Function81e5e
+ ld hl, $c59a
+ call Function81e5e
+ ld hl, $c5ae
+ call Function81e5e
+ ld hl, $c5c2
+ call Function81e5e
+ ld a, [$d004]
+ inc a
+ ld [$d265], a
+ ld a, $f
+ call Predef
+ ld a, [$d265]
+ ld [$d262], a
+ call GetMoveName
+ ld hl, $c59a
+ call PlaceString
+ ld a, [$d004]
+ call Function81e55
+ ld [CurItem], a
+ ld a, $e
+ call Predef
+ ld a, c
+ and a
+ ld de, String_81e46
+ jr nz, .asm_81e3f
+ ld de, String_81e4d
+
+.asm_81e3f
+ ld hl, $c5c2
+ call PlaceString
+ ret
+; 81e46
+
+String_81e46: db "おぼえられる@" ; can be taught
+String_81e4d: db "おぼえられない@" ; cannot be taught
+; 81e55
+
+Function81e55: ; 81e55
+ cp $32
+ jr c, .asm_81e5b
+ inc a
+ inc a
+
+.asm_81e5b
+ add $bf
+ ret
+; 81e5e
+
+Function81e5e: ; 81e5e
+ ld bc, $000a
+ ld a, $6f
+ call ByteFill
+ ret
+; 81e67
+
+Function81e67: ; 81e67
+ ld a, [PlayerMoveType]
+ and $1f
+ ld e, a
+ ld a, [PlayerMoveAccuracy]
+ and $7
+ sla a
+ swap a
+ or e
+ ld e, a
+ ld a, [PlayerMoveAccuracy]
+ and $18
+ sla a
+ swap a
+ ld d, a
+ ld a, [PlayerMovePP]
+ and $1f
+ sla a
+ sla a
+ or d
+ ld d, a
+ ld a, [$cf65]
+ and a
+ jr z, .asm_81e9c
+ ld a, e
+ ld [EnemyMovePower], a
+ ld a, d
+ ld [EnemyMoveType], a
+ ret
+
+.asm_81e9c
+ ld a, e
+ ld [EnemyMoveAnimation], a
+ ld a, d
+ ld [EnemyMoveEffect], a
+ ret
+; 81ea5
+
+Function81ea5: ; 81ea5
+ ld a, [de]
+ and $1f
+ ld [PlayerMoveType], a
+ ld a, [de]
+ and $e0
+ swap a
+ srl a
+ ld b, a
+ inc de
+ ld a, [de]
+ and $3
+ swap a
+ srl a
+ or b
+ ld [PlayerMoveAccuracy], a
+ ld a, [de]
+ and $7c
+ srl a
+ srl a
+ ld [PlayerMovePP], a
+ ret
+; 81eca
+
+Function81eca: ; 81eca
+ ld a, [$cf66]
+ inc a
+ ld l, a
+ ld h, $0
+ add hl, hl
+ add hl, hl
+ ld de, OverworldMap
+ add hl, de
+ ld e, l
+ ld d, h
+ ld hl, EnemyMoveAnimation
+ ld bc, $0004
+ call CopyBytes
+ ret
+; 81ee3
+
+Function81ee3: ; 81ee3
+.asm_81ee3
+ ld a, $ff
+ ld [hli], a
+ ld a, $7f
+ 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
+ ld a, [de]
+ inc de
+ ld [hli], a
+ xor a
+ ld [hli], a
+ ld [hli], a
+ dec c
+ jr nz, .asm_81ee3
+ ret
+; 81efc
+
+Function81efc: ; 81efc
+.asm_81efc
+ push bc
+ push hl
+.asm_81efe
+ ld [hli], a
+ dec c
+ jr nz, .asm_81efe
+ pop hl
+ ld bc, $0014
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, .asm_81efc
+ ret
+; 81f0c
+
+Function81f0c: ; 81f0c
+ ld a, [$cfbe]
+ push af
+ set 7, a
+ ld [$cfbe], a
+ call Function81f1d
+ pop af
+ ld [$cfbe], a
+ ret
+; 81f1d
+
+Function81f1d: ; 81f1d
+ ld a, [hl]
+ and $7
+ ret z
+ ld b, a
+.asm_81f22
+ push bc
+ xor a
+ ld [rJOYP], a
+ ld a, $30
+ ld [rJOYP], a
+ ld b, $10
+.asm_81f2c
+ ld e, $8
+ ld a, [hli]
+ ld d, a
+.asm_81f30
+ bit 0, d
+ ld a, $10
+ jr nz, .asm_81f38
+ ld a, $20
+
+.asm_81f38
+ ld [rJOYP], a
+ ld a, $30
+ ld [rJOYP], a
+ rr d
+ dec e
+ jr nz, .asm_81f30
+ dec b
+ jr nz, .asm_81f2c
+ ld a, $20
+ ld [rJOYP], a
+ ld a, $30
+ ld [rJOYP], a
+ ld de, $1b58
+.asm_81f51
+ nop
+ nop
+ nop
+ dec de
+ ld a, d
+ or e
+ jr nz, .asm_81f51
+ pop bc
+ dec b
+ jr nz, .asm_81f22
+ ret
+; 81f5e
+
+Function81f5e: ; 81f5e
+ ld a, $6f
+ ld hl, $c4aa
+ ld [hl], a
+ ld hl, $c4af
+ ld [hl], a
+ ld hl, $c57d
+ ld [hl], a
+ ld hl, $c5a5
+ ld [hl], a
+ ld hl, $c5cd
+ ld [hl], a
+ ld a, [$cf63]
+ cp $3
+ jr nz, .asm_81fc9
+ ld a, [$cf64]
+ and a
+ jr z, .asm_81f8d
+ dec a
+ ld hl, $c57d
+ ld bc, $0028
+ call AddNTimes
+ ld [hl], $ed
+
+.asm_81f8d
+ ld a, [$cf65]
+ and a
+ jr z, .asm_81f98
+ ld hl, $c4af
+ jr .asm_81f9b
+
+.asm_81f98
+ ld hl, $c4aa
+
+.asm_81f9b
+ ld [hl], $ed
+ ld b, $70
+ ld c, $5
+ ld hl, Sprites
+ ld de, PlayerMoveType
+ call .asm_81fb7
+ ld de, PlayerMoveAccuracy
+ call .asm_81fb7
+ ld de, PlayerMovePP
+ call .asm_81fb7
+ ret
+
+.asm_81fb7
+ ld a, b
+ ld [hli], a
+ ld a, [de]
+ add a
+ add a
+ add $18
+ ld [hli], a
+ xor a
+ ld [hli], a
+ ld a, c
+ ld [hli], a
+ ld a, $10
+ add b
+ ld b, a
+ inc c
+ ret
+
+.asm_81fc9
+ call ClearSprites
+ ret
+; 81fcd
+
+String_81fcd: ; 81fcd
+ db "おわりますか?" ; Are you finished?
+ next "はい", $f2, $f2, $f2, $7a ; YES (A)
+ next "いいえ", $f2, $f2, $7b ; NO (B)
+ db "@"
+; 81fe3
DebugColorTestGFX:
INCBIN "gfx/debug/color_test.2bpp"