pokecrystal-board/main.asm

118625 lines
1.6 MiB
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

INCLUDE "includes.asm"
SECTION "bank1", ROMX, BANK[$1]
Function4000:: ; 4000
hlcoord 3, 10
ld b, 1
ld c, 11
ld a, [IsInBattle]
and a
jr z, .asm_4012
call TextBox
jr .asm_4017
.asm_4012
predef Function28eef
.asm_4017
hlcoord 4, 11
ld de, .Waiting
call PlaceString
ld c, 50
jp DelayFrames
; 4025
.Waiting ; 4025
db "Waiting...!@"
; 4031
LoadPushOAM:: ; 4031
ld c, hPushOAM & $ff
ld b, PushOAMEnd - PushOAM
ld hl, PushOAM
.loop
ld a, [hli]
ld [$ff00+c], a
inc c
dec b
jr nz, .loop
ret
; 403f
PushOAM: ; 403f
ld a, Sprites >> 8
ld [rDMA], a
ld a, $28
.loop
dec a
jr nz, .loop
ret
PushOAMEnd
; 4049
INCLUDE "engine/facings.asm"
Data4273:: ; 4273
db $00, $00, $01, $02, $00, $00
db $06, $00, $01, $0c, $00, $00
db $03, $00, $01, $00, $00, $00
db $04, $00, $01, $00, $00, $00
db $01, $00, $01, $00, $00, $00
db $02, $00, $01, $00, $00, $00
db $06, $00, $01, $00, $00, $00
db $06, $01, $01, $00, $00, $00
db $06, $02, $01, $00, $00, $00
db $06, $03, $01, $00, $00, $00
db $05, $00, $01, $00, $00, $00
db $07, $00, $01, $02, $00, $00
db $08, $00, $01, $00, $00, $00
db $09, $00, $01, $00, $00, $00
db $0a, $00, $01, $00, $00, $00
db $0b, $00, $01, $00, $00, $00
db $0c, $00, $01, $00, $00, $00
db $0d, $00, $01, $00, $00, $00
db $0e, $00, $01, $00, $00, $00
db $0f, $00, $01, $02, $00, $00
db $10, $00, $01, $02, $00, $00
db $15, $00, $09, $2e, $01, $c0
db $16, $00, $0a, $2e, $00, $00
db $06, $00, $01, $0c, $00, $00
db $06, $00, $01, $2e, $10, $00
db $11, $00, $01, $2e, $00, $40
db $12, $00, $01, $02, $00, $00
db $13, $00, $00, $8e, $01, $00
db $14, $00, $08, $8e, $02, $00
db $17, $00, $00, $82, $00, $00
db $19, $02, $01, $00, $00, $00
db $18, $03, $01, $00, $00, $00
db $11, $00, $0c, $2e, $01, $c0
db $11, $00, $0d, $2e, $01, $c0
db $1a, $00, $0e, $8e, $01, $00
db $1b, $00, $0f, $8e, $02, $00
db $03, $00, $01, $00, $00, $20
db $00, $00, $01, $00, $00, $00
; 4357
Function4357:: ; 4357
push bc
ld hl, $0001
add hl, bc
ld a, [hl]
push af
ld h, b
ld l, c
ld bc, ObjectStruct2 - ObjectStruct1
xor a
call ByteFill
pop af
cp $ff
jr z, .asm_4379
bit 7, a
jr nz, .asm_4379
call GetMapObject
ld hl, $0000
add hl, bc
ld [hl], $ff
.asm_4379
pop bc
ret
; 437b
Function437b: ; 437b
call Function4386
ret c
call Function43f3
call Function4427
ret
; 4386
Function4386: ; 4386
ld hl, OBJECT_FLAGS
add hl, bc
res 6, [hl]
ld a, [XCoord]
ld e, a
ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
add $1
sub e
jr c, .asm_43b2
cp $c
jr nc, .asm_43b2
ld a, [YCoord]
ld e, a
ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
add $1
sub e
jr c, .asm_43b2
cp $b
jr nc, .asm_43b2
jr .asm_43dc
.asm_43b2
ld hl, OBJECT_FLAGS
add hl, bc
set 6, [hl]
ld a, [XCoord]
ld e, a
ld hl, $0014
add hl, bc
ld a, [hl]
add $1
sub e
jr c, .asm_43de
cp $c
jr nc, .asm_43de
ld a, [YCoord]
ld e, a
ld hl, $0015
add hl, bc
ld a, [hl]
add $1
sub e
jr c, .asm_43de
cp $b
jr nc, .asm_43de
.asm_43dc
and a
ret
.asm_43de
ld hl, $0004
add hl, bc
bit 1, [hl]
jr nz, .asm_43eb
call Function4357
scf
ret
.asm_43eb
ld hl, OBJECT_FLAGS
add hl, bc
set 6, [hl]
and a
ret
; 43f3
Function43f3: ; 43f3
ld hl, $0009
add hl, bc
ld a, [hl]
and a
jr z, .asm_4409
ld hl, OBJECT_FLAGS
add hl, bc
bit 5, [hl]
jr nz, .asm_4426
cp $1
jr z, .asm_4414
jr .asm_4421
.asm_4409
call Function47bc
ld hl, OBJECT_FLAGS
add hl, bc
bit 5, [hl]
jr nz, .asm_4426
.asm_4414
call Function47dd
ld hl, $0009
add hl, bc
ld a, [hl]
and a
ret z
cp $1
ret z
.asm_4421
ld hl, Pointers4b45
rst JumpTable
ret
.asm_4426
ret
; 4427
Function4427: ; 4427
ld hl, $0004
add hl, bc
bit 0, [hl]
jr nz, Function44a3
ld hl, OBJECT_FLAGS
add hl, bc
bit 6, [hl]
jr nz, Function44a3
bit 5, [hl]
jr nz, Function4448
ld de, Pointers445f
jr Function444d
; 4440
Function4440: ; 4440
ld hl, $0004
add hl, bc
bit 0, [hl]
jr nz, Function44a3
; fallthrough
; 4448
Function4448: ; 4448
ld de, Pointers445f + 2
jr Function444d
; 444d
Function444d: ; 444d
ld hl, $000b
add hl, bc
ld a, [hl]
ld l, a
ld h, 0
add hl, hl
add hl, hl
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call _hl_
ret
; 445f
Pointers445f: ; 445f
dw Function44a3
dw Function44a3
dw Function44b5
dw Function44aa
dw Function44c1
dw Function44aa
dw Function4508
dw Function44aa
dw Function4529
dw Function44aa
dw Function4539
dw Function44a3
dw Function456e
dw Function456e
dw Function457b
dw Function44a3
dw Function4582
dw Function4582
dw Function4589
dw Function4589
dw Function4590
dw Function45a4
dw Function45ab
dw Function44aa
dw Function45be
dw Function45be
dw Function45c5
dw Function45c5
dw Function45da
dw Function44a3
dw Function45ed
dw Function44a3
dw Function44e4
dw Function44aa
; 44a3
Function44a3: ; 44a3
ld hl, OBJECT_FACING
add hl, bc
ld [hl], $ff
ret
; 44aa
Function44aa: ; 44aa
call GetSpriteDirection
or $0
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
; 44b5
Function44b5: ; 44b5
ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
and $1
jr nz, Function44c1
jp Function44aa
; 44c1
Function44c1: ; 44c1
ld hl, $0004
add hl, bc
bit 3, [hl]
jp nz, Function44aa
ld hl, $000c
add hl, bc
ld a, [hl]
inc a
and $f
ld [hl], a
rrca
rrca
and $3
ld d, a
call GetSpriteDirection
or $0
or d
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
; 44e4
Function44e4: ; 44e4
ld hl, $0004
add hl, bc
bit 3, [hl]
jp nz, Function44aa
ld hl, $000c
add hl, bc
ld a, [hl]
add $2
and $f
ld [hl], a
rrca
rrca
and $3
ld d, a
call GetSpriteDirection
or $0
or d
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
; 4508
Function4508: ; 4508
ld hl, $0004
add hl, bc
bit 3, [hl]
jp nz, Function44aa
ld hl, $000c
add hl, bc
inc [hl]
ld a, [hl]
rrca
rrca
rrca
and $3
ld d, a
call GetSpriteDirection
or $0
or d
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
; 4529
Function4529: ; 4529
call Function453f
ld hl, $0008
add hl, bc
ld a, [hl]
or $0
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
; 4539
Function4539: ; 4539
call Function453f
jp Function44a3
; 453f
Function453f: ; 453f
ld hl, $000c
add hl, bc
ld a, [hl]
and $f0
ld e, a
ld a, [hl]
inc a
and $f
ld d, a
cp $4
jr c, .asm_4558
ld d, 0
ld a, e
add $10
and $30
ld e, a
.asm_4558
ld a, d
or e
ld [hl], a
swap e
ld d, 0
ld hl, .Directions
add hl, de
ld a, [hl]
ld hl, $0008
add hl, bc
ld [hl], a
ret
; 456a
.Directions ; 456a
db $00, $0c, $04, $08
; 456e
Function456e: ; 456e
call GetSpriteDirection
rrca
rrca
add $10
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
; 457b
Function457b: ; 457b
ld hl, OBJECT_FACING
add hl, bc
ld [hl], $15
ret
; 4582
Function4582: ; 4582
ld hl, OBJECT_FACING
add hl, bc
ld [hl], $14
ret
; 4589
Function4589: ; 4589
ld hl, OBJECT_FACING
add hl, bc
ld [hl], $17
ret
; 4590
Function4590: ; 4590
ld hl, $000c
add hl, bc
ld a, [hl]
inc a
and $f
ld [hl], a
and $8
jr z, Function45a4
ld hl, OBJECT_FACING
add hl, bc
ld [hl], $4
ret
; 45a4
Function45a4: ; 45a4
ld hl, OBJECT_FACING
add hl, bc
ld [hl], $0
ret
; 45ab
Function45ab: ; 45ab
ld hl, $000c
add hl, bc
ld a, [hl]
inc a
ld [hl], a
and $c
rrca
rrca
add $18
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
; 45be
Function45be: ; 45be
ld hl, OBJECT_FACING
add hl, bc
ld [hl], $16
ret
; 45c5
Function45c5: ; 45c5
ld a, [$d831]
ld d, $17
cp $33
jr z, .asm_45d4
cp $47
jr z, .asm_45d4
ld d, $16
.asm_45d4
ld hl, OBJECT_FACING
add hl, bc
ld [hl], d
ret
; 45da
Function45da: ; 45da
ld hl, $000c
add hl, bc
inc [hl]
ld a, [hl]
ld hl, OBJECT_FACING
add hl, bc
and 2
ld a, $1c
jr z, .asm_45eb
inc a
.asm_45eb
ld [hl], a
ret
; 45ed
Function45ed: ; 45ed
ld hl, $000c
add hl, bc
inc [hl]
ld a, [hl]
ld hl, OBJECT_FACING
add hl, bc
and 4
ld a, $1e
jr z, .asm_45fe
inc a
.asm_45fe
ld [hl], a
ret
; 4600
Function4600: ; 4600
ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld [hl], a
ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld [hl], a
ld hl, OBJECT_STANDING_TILE
add hl, bc
ld a, [hl]
ld hl, OBJECT_NEXT_TILE
add hl, bc
ld [hl], a
call Function4661
ld hl, OBJECT_STANDING_TILE
add hl, bc
ld a, [hl]
call Function4679
ret
; 462a
Function462a: ; 462a
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
ld hl, OBJECT_MAP_X
add hl, bc
ld [hl], a
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld a, [hl]
ld hl, OBJECT_MAP_Y
add hl, bc
ld [hl], a
ret
; 463f
Function463f: ; 463f
ld hl, OBJECT_FLAGS
add hl, bc
bit 3, [hl]
jr z, .asm_464f
ld hl, $000e
add hl, bc
ld a, [hl]
call Function4661
.asm_464f
ld hl, $000e
add hl, bc
ld a, [hl]
call Function4679
ret c
ld hl, $000f
add hl, bc
ld a, [hl]
call Function4679
ret
; 4661
Function4661: ; 4661
call Function188e
jr z, .asm_466b
call Function1875
jr c, .asm_4672
.asm_466b
ld hl, $0005
add hl, bc
set 3, [hl]
ret
.asm_4672
ld hl, $0005
add hl, bc
res 3, [hl]
ret
; 4679
Function4679: ; 4679
and a
ret
; 467b
Function467b: ; 467b
xor a
ld hl, $000c
add hl, bc
ld [hl], a
ld hl, $001b
add hl, bc
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld hl, $0007
add hl, bc
ld [hl], $ff
ret
; 4690
Function4690: ; 4690
ld hl, $0007
add hl, bc
ld [hl], a
ld hl, $0004
add hl, bc
bit 2, [hl]
jr nz, .asm_46a6
add a
add a
and $c
ld hl, $0008
add hl, bc
ld [hl], a
.asm_46a6
; fallthrough
; 46a6
Function46a6: ; 46a6
call GetStepVector
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
ld a, d
call Function4730
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
add [hl]
ld hl, OBJECT_MAP_X
add hl, bc
ld [hl], a
ld d, a
ld a, e
call Function4730
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
add [hl]
ld hl, OBJECT_MAP_Y
add hl, bc
ld [hl], a
ld e, a
push bc
call Function2a3c
pop bc
ld hl, $000e
add hl, bc
ld [hl], a
ret
; 46d7
Function46d7: ; 46d7
call GetStepVector
ld hl, OBJECT_SPRITE_X
add hl, bc
ld a, [hl]
add d
ld [hl], a
ld hl, OBJECT_SPRITE_Y
add hl, bc
ld a, [hl]
add e
ld [hl], a
ret
; 46e9
GetStepVector: ; 46e9
; Return (x, y, duration, speed) in (d, e, a, h).
ld hl, $0007
add hl, bc
ld a, [hl]
and $f
add a
add a
ld l, a
ld h, 0
ld de, StepVectors
add hl, de
ld d, [hl]
inc hl
ld e, [hl]
inc hl
ld a, [hli]
ld h, [hl]
ret
; 4700
StepVectors: ; 4700
; x, y, duration, speed
; slow
db 0, 1, 16, 1
db 0, -1, 16, 1
db -1, 0, 16, 1
db 1, 0, 16, 1
; normal
db 0, 2, 8, 2
db 0, -2, 8, 2
db -2, 0, 8, 2
db 2, 0, 8, 2
; fast
db 0, 4, 4, 4
db 0, -4, 4, 4
db -4, 0, 4, 4
db 4, 0, 4, 4
; 4730
Function4730: ; 4730
add a
ret z
ld a, 1
ret nc
ld a, -1
ret
; 4738
Function4738: ; 4738
ld hl, $0007
add hl, bc
ld a, [hl]
and $3
ld [$d151], a
call Function46d7
ld a, [$d14e]
add d
ld [$d14e], a
ld a, [$d14f]
add e
ld [$d14f], a
ld hl, $d150
set 5, [hl]
ret
; 4759
Function4759: ; 4759
push bc
ld e, a
ld d, 0
ld hl, $0001
add hl, bc
ld a, [hl]
call GetMapObject
add hl, de
ld a, [hl]
pop bc
ret
; 4769
Function4769: ; 4769
ld hl, $0001
add hl, bc
ld a, [hl]
cp $ff
jr z, .asm_477d
push bc
call GetMapObject
ld hl, $0004
add hl, bc
ld a, [hl]
pop bc
ret
.asm_477d
ld a, $6
ret
; 4780
Function4780: ; 4780
ld hl, $001b
add hl, bc
ld [hl], $0
ret
; 4787
Function4787: ; 4787
ld hl, $001b
add hl, bc
inc [hl]
ret
; 478d
Function478d: ; 478d
ld hl, $001b
add hl, bc
dec [hl]
ret
; 4793
Function4793: ; 4793
ld hl, $001b
add hl, bc
ld a, [hl]
pop hl
rst JumpTable
ret
; 479b
Function479b: ; 479b
ld hl, $001c
add hl, bc
ld [hl], $0
ret
; 47a2
Function47a2: ; 47a2
ld hl, $001c
add hl, bc
inc [hl]
ret
; 47a8
Function47a8: ; 47a8
ld hl, $001c
add hl, bc
ld a, [hl]
pop hl
rst JumpTable
ret
; 47b0
Function47b0: ; 47b0
ld hl, $001c
add hl, bc
ld a, [hl]
ret
; 47b6
Function47b6: ; 47b6
ld hl, $001c
add hl, bc
ld [hl], a
ret
; 47bc
Function47bc: ; 47bc
ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
push bc
call Function2a3c
pop bc
ld hl, OBJECT_STANDING_TILE
add hl, bc
ld [hl], a
call Function4600
call Function467b
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 47dd
Function47dd: ; 47dd
call Function479b
call Function1a2f
ld a, [hl]
ld hl, .Pointers
rst JumpTable
ret
; 47e9
.Pointers ; 47e9
dw Function4821
dw Function4822
dw Function482c
dw Function4838
dw Function4842
dw Function4851
dw Function4869
dw Function487c
dw Function4882
dw Function4888
dw Function488e
dw Function4891
dw Function4894
dw Function4897
dw Function489d
dw Function48a0
dw Function48a6
dw Function48ac
dw Function48ff
dw Function49e5
dw Function4a21
dw Function4958
dw Function496e
dw Function4abc
dw Function498d
dw Function4984
dw Function4a46
dw Function4a89
; 4821
Function4821: ; 4821
ret
; 4822
Function4822: ; 4822
call Random
ld a, [hRandomAdd]
and 1
jp Function4af0
; 482c
Function482c: ; 482c
call Random
ld a, [hRandomAdd]
and 1
or 2
jp Function4af0
; 4838
Function4838: ; 4838
call Random
ld a, [hRandomAdd]
and 3
jp Function4af0
; 4842
Function4842: ; 4842
call Random
ld a, [hRandomAdd]
and $c
ld hl, $0008
add hl, bc
ld [hl], a
jp Function4b1d
; 4851
Function4851: ; 4851
ld hl, $0008
add hl, bc
ld a, [hl]
and $c
ld d, a
call Random
ld a, [hRandomAdd]
and $c
cp d
jr nz, .asm_4865
xor $c
.asm_4865
ld [hl], a
jp Function4b26
; 4869
Function4869: ; 4869
call Function462a
call Function467b
ld hl, $000b
add hl, bc
ld [hl], $1
ld hl, $0009
add hl, bc
ld [hl], $5
ret
; 487c
Function487c: ; 487c
ld hl, Function5000
jp Function5041
; 4882
Function4882: ; 4882
ld hl, Function5015
jp Function5041
; 4888
Function4888: ; 4888
ld hl, Function5026
jp Function5041
; 488e
Function488e: ; 488e
jp Function5037
; 4891
Function4891: ; 4891
jp Function5037
; 4894
Function4894: ; 4894
jp Function5037
; 4897
Function4897: ; 4897
ld hl, Function5000
jp Function5041
; 489d
Function489d: ; 489d
jp Function5037
; 48a0
Function48a0: ; 48a0
ld hl, Function54e6
jp Function5041
; 48a6
Function48a6: ; 48a6
ld hl, Function500e
jp Function5041
; 48ac
Function48ac: ; 48ac
call Function4793
dw Function48b3
dw Function48f8
; 48b3
Function48b3: ; 48b3
ld hl, $000e
add hl, bc
ld a, [hl]
call CheckPitTile
jr z, .asm_48f5
ld hl, $0005
add hl, bc
bit 2, [hl]
res 2, [hl]
jr z, .asm_48ee
ld hl, $0020
add hl, bc
ld a, [hl]
and $3
or $0
call Function4690
call Function6ec1
jr c, .asm_48eb
ld de, SFX_STRENGTH
call PlaySFX
call Function5538
call Function463f
ld hl, $0009
add hl, bc
ld [hl], $f
ret
.asm_48eb
call Function462a
.asm_48ee
ld hl, $0007
add hl, bc
ld [hl], $ff
ret
.asm_48f5
call Function4787
; fallthrough
; 48f8
Function48f8: ; 48f8
ld hl, $0007
add hl, bc
ld [hl], $ff
ret
; 48ff
Function48ff: ; 48ff
ld hl, $0010
add hl, bc
ld d, [hl]
ld hl, $0011
add hl, bc
ld e, [hl]
ld hl, $0020
add hl, bc
ld a, [hl]
push bc
call Function1ae5
ld hl, $0007
add hl, bc
ld a, [hl]
cp $ff
jr z, .asm_494a
ld hl, $0012
add hl, bc
ld a, [hl]
cp d
jr z, .asm_492d
jr c, .asm_4929
ld a, $3
jr .asm_493d
.asm_4929
ld a, $2
jr .asm_493d
.asm_492d
ld hl, $0013
add hl, bc
ld a, [hl]
cp e
jr z, .asm_494a
jr c, .asm_493b
ld a, $0
jr .asm_493d
.asm_493b
ld a, $1
.asm_493d
ld d, a
ld hl, $0007
add hl, bc
ld a, [hl]
and $c
or d
pop bc
jp Function5412
.asm_494a
pop bc
ld hl, $0007
add hl, bc
ld [hl], $ff
ld hl, $000b
add hl, bc
ld [hl], $1
ret
; 4958
Function4958: ; 4958
call Function467b
ld hl, $0007
add hl, bc
ld [hl], $ff
ld hl, $000b
add hl, bc
ld [hl], $9
ld hl, $0009
add hl, bc
ld [hl], $4
ret
; 496e
Function496e: ; 496e
call Function467b
ld hl, $0007
add hl, bc
ld [hl], $ff
ld hl, $000b
add hl, bc
ld [hl], $a
ld hl, $0009
add hl, bc
ld [hl], $4
ret
; 4984
Function4984: ; 4984
call Function4793
dw Function4996
dw Function499c
dw Function49b8
; 498d
Function498d: ; 498d
call Function4793
dw Function4996
dw Function499c
dw Function49c4
; 4996
Function4996: ; 4996
call Function467b
call Function4787
; fallthrough
; 499c
Function499c: ; 499c
ld hl, $000b
add hl, bc
ld [hl], $1
ld hl, $0020
add hl, bc
ld a, [hl]
ld a, $10
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
ld hl, $0009
add hl, bc
ld [hl], $3
call Function4787
ret
; 49b8
Function49b8: ; 49b8
ld de, .data_49c0
call Function49d0
jr Function4984
; 49c0
.data_49c0 ; 49c0
db $0c, $08, $00, $04
; 49c4
Function49c4: ; 49c4
ld de, .data_49cc
call Function49d0
jr Function498d
; 49cc
.data_49cc ; 49cc
db $08, $0c, $04, $00
; 49d0
Function49d0: ; 49d0
ld hl, $0008
add hl, bc
ld a, [hl]
and $c
rrca
rrca
push hl
ld l, a
ld h, $0
add hl, de
ld a, [hl]
pop hl
ld [hl], a
call Function478d
ret
; 49e5
Function49e5: ; 49e5
call Function4aa8
ld hl, $000b
add hl, bc
ld [hl], $7
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
inc a
add a
add $0
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
ld hl, $0007
add hl, de
ld a, [hl]
and 3
ld d, $e
cp 0
jr z, .asm_4a0f
cp 1
jr z, .asm_4a0f
ld d, $c
.asm_4a0f
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], d
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
ld [hl], $0
ld hl, $0009
add hl, bc
ld [hl], $13
ret
; 4a21
Function4a21: ; 4a21
call Function467b
call Function4aa8
ld hl, $000b
add hl, bc
ld [hl], $8
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $0
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], $f0
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
ld [hl], $0
ld hl, $0009
add hl, bc
ld [hl], $13
ret
; 4a46
Function4a46: ; 4a46
call Function467b
call Function4aa8
ld hl, $000b
add hl, bc
ld [hl], $e
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
inc a
add a
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
ld hl, $0007
add hl, de
ld a, [hl]
and 3
ld e, a
ld d, 0
ld hl, .data_4a81
add hl, de
add hl, de
ld d, [hl]
inc hl
ld e, [hl]
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
ld [hl], d
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], e
ld hl, $0009
add hl, bc
ld [hl], $13
ret
; 4a81
.data_4a81 ; 4a81
; x, y
db 0, -4
db 0, 8
db 6, 2
db -6, 2
; 4a89
Function4a89: ; 4a89
call Function467b
call Function4aa8
ld hl, $000b
add hl, bc
ld [hl], $f
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
add $ff
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
ld hl, $0009
add hl, bc
ld [hl], $13
ret
; 4aa8
Function4aa8: ; 4aa8
ld hl, $0020
add hl, bc
ld a, [hl]
push bc
call Function1ae5
ld d, b
ld e, c
pop bc
ld hl, $001d
add hl, bc
ld [hl], e
inc hl
ld [hl], d
ret
; 4abc
Function4abc: ; 4abc
call Function467b
ld hl, $000b
add hl, bc
ld [hl], $0
ld hl, $0020
add hl, bc
ld a, [hl]
call Function4ade
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], e
ld hl, $001e
add hl, bc
ld [hl], a
ld hl, $0009
add hl, bc
ld [hl], $15
ret
; 4ade
Function4ade: ; 4ade
ld d, a
and $3f
ld e, a
ld a, d
rlca
rlca
and $3
ld d, a
inc d
ld a, $1
.asm_4aeb
dec d
ret z
add a
jr .asm_4aeb
; 4af0
Function4af0: ; 4af0
call Function4690
call Function6ec1
jr c, Function4b17
call Function463f
ld hl, $000b
add hl, bc
ld [hl], $2
ld hl, $d4cf
ld a, [$ffaf]
cp [hl]
jr z, .asm_4b10
ld hl, $0009
add hl, bc
ld [hl], $7
ret
.asm_4b10
ld hl, $0009
add hl, bc
ld [hl], $6
ret
Function4b17: ; 4b17
call Function467b
call Function462a
; fallthrough
; 4b1d
Function4b1d: ; 4b1d
call Random
ld a, [hRandomAdd]
and $7f
jr Function4b2d
; 4b26
Function4b26: ; 4b26
call Random
ld a, [hRandomAdd]
and $1f
; fallthrough
; 4b2d
Function4b2d: ; 4b2d
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
ld hl, $0007
add hl, bc
ld [hl], $ff
ld hl, $000b
add hl, bc
ld [hl], $1
ld hl, $0009
add hl, bc
ld [hl], $3
ret
; 4b45
Pointers4b45: ; 4b45
dw Function47bc
dw Function47dd
dw Function4e2b
dw Function4ddd
dw Function4e21
dw Function4e0c
dw Function4e56
dw Function4e47
dw Function4b86
dw Function4bbf
dw Function4e83
dw Function4dff
dw Function4c18
dw Function4c89
dw Function4d14
dw Function4ecd
dw Function4d7e
dw Function4daf
dw Function4dc8
dw Function4f04
dw Function4f33
dw Function4f33
dw Function4f77
dw Function4f7a
dw Function4df0
dw Function4f83
; 4b79
Function4b79: ; 4b79
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4b86
Function4b86: ; 4b86
call Function47a8
dw Function4b8d
dw Function4ba9
; 4b8d
Function4b8d: ; 4b8d
call Function46d7
call UpdateJumpPosition
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
call Function4600
call Function46a6
ld hl, $0005
add hl, bc
res 3, [hl]
call Function47a2
ret
; 4ba9
Function4ba9: ; 4ba9
call Function46d7
call UpdateJumpPosition
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
call Function4600
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4bbf
Function4bbf: ; 4bbf
call Function47a8
dw Function4bca
dw Function4bd2
dw Function4bf2
dw Function4bfd
; 4bca
Function4bca: ; 4bca
ld hl, $d150
set 7, [hl]
call Function47a2
; fallthrough
; 4bd2
Function4bd2: ; 4bd2
call UpdateJumpPosition
call Function4738
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
call Function4600
ld hl, $0005
add hl, bc
res 3, [hl]
ld hl, $d150
set 6, [hl]
set 4, [hl]
call Function47a2
ret
; 4bf2
Function4bf2: ; 4bf2
call Function46a6
ld hl, $d150
set 7, [hl]
call Function47a2
; fallthrough
; 4bfd
Function4bfd: ; 4bfd
call UpdateJumpPosition
call Function4738
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
ld hl, $d150
set 6, [hl]
call Function4600
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4c18
Function4c18: ; 4c18
call Function47a8
dw Function4c23
dw Function4c32
dw Function4c42
dw Function4c5d
; 4c23
Function4c23: ; 4c23
ld hl, $000c
add hl, bc
ld [hl], $0
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $10
call Function47a2
; fallthrough
; 4c32
Function4c32: ; 4c32
ld hl, $000b
add hl, bc
ld [hl], $4
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
call Function47a2
ret
; 4c42
Function4c42: ; 4c42
ld hl, $000c
add hl, bc
ld [hl], $0
ld hl, $001f
add hl, bc
ld [hl], $10
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $10
ld hl, $0005
add hl, bc
res 3, [hl]
call Function47a2
; fallthrough
; 4c5d
Function4c5d: ; 4c5d
ld hl, $000b
add hl, bc
ld [hl], $4
ld hl, $001f
add hl, bc
inc [hl]
ld a, [hl]
ld d, $60
call Sine
ld a, h
sub $60
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], a
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
ld hl, $000c
add hl, bc
ld [hl], $0
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4c89
Function4c89: ; 4c89
call Function47a8
dw Function4c9a
dw Function4caa
dw Function4cb3
dw Function4cc9
dw Function4ceb
dw Function4cf5
dw Function4d01
; 4c9a
Function4c9a: ; 4c9a
ld hl, $000b
add hl, bc
ld [hl], $0
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $10
call Function47a2
ret
; 4caa
Function4caa: ; 4caa
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
call Function47a2
; fallthrough
; 4cb3
Function4cb3: ; 4cb3
ld hl, $000c
add hl, bc
ld [hl], $0
ld hl, $001f
add hl, bc
ld [hl], $0
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $10
call Function47a2
ret
; 4cc9
Function4cc9: ; 4cc9
ld hl, $000b
add hl, bc
ld [hl], $4
ld hl, $001f
add hl, bc
inc [hl]
ld a, [hl]
ld d, $60
call Sine
ld a, h
sub $60
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], a
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
call Function47a2
; fallthrough
; 4ceb
Function4ceb: ; 4ceb
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $10
call Function47a2
ret
; 4cf5
Function4cf5: ; 4cf5
ld hl, $000b
add hl, bc
ld [hl], $4
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
; 4d01
Function4d01: ; 4d01
ld hl, $000c
add hl, bc
ld [hl], $0
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], $0
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4d14
Function4d14: ; 4d14
call Function47a8
dw Function4d1f
dw Function4d2e
dw Function4d4f
dw Function4d6b
; 4d1f
Function4d1f: ; 4d1f
ld hl, $000b
add hl, bc
ld [hl], $0
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $10
call Function47a2
; fallthrough
; 4d2e
Function4d2e: ; 4d2e
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
ld hl, $000b
add hl, bc
ld [hl], $2
ld hl, $000c
add hl, bc
ld [hl], $0
ld hl, $001f
add hl, bc
ld [hl], $0
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $10
call Function47a2
; fallthrough
; 4d4f
Function4d4f: ; 4d4f
ld hl, $001f
add hl, bc
inc [hl]
ld a, [hl]
ld d, $60
call Sine
ld a, h
sub $60
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], a
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
call Function47a2
; fallthrough
; 4d6b
Function4d6b: ; 4d6b
ld hl, $000c
add hl, bc
ld [hl], $0
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], $0
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4d7e
Function4d7e: ; 4d7e
call Function47a8
dw Function4d85
dw Function4d94
; 4d85
Function4d85: ; 4d85
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $8
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], $0
call Function47a2
; fallthrough
; 4d94
Function4d94: ; 4d94
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld a, [hl]
xor 1
ld [hl], a
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], $0
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4daf
Function4daf: ; 4daf
call Function4db5
jp Function4b79
; 4db5
Function4db5: ; 4db5
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld a, [hl]
and $1
ld a, $1
jr z, .asm_4dc2
ld a, $0
.asm_4dc2
ld hl, $000b
add hl, bc
ld [hl], a
ret
; 4dc8
Function4dc8: ; 4dc8
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld a, [hl]
and $1
ld a, $4
jr z, .asm_4dd5
ld a, $5
.asm_4dd5
ld hl, $000b
add hl, bc
ld [hl], a
jp Function4b79
; 4ddd
Function4ddd: ; 4ddd
ld hl, $0007
add hl, bc
ld [hl], $ff
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4df0
Function4df0: ; 4df0
ld hl, $0007
add hl, bc
ld [hl], $ff
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
jp Function4357
; 4dff
Function4dff: ; 4dff
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4e0c
Function4e0c: ; 4e0c
call Function47a8
dw Function4e13
dw Function4e21
; 4e13
Function4e13: ; 4e13
call Function4769
call Function1a47
ld hl, $0008
add hl, bc
ld [hl], a
call Function47a2
; fallthrough
; 4e21
Function4e21: ; 4e21
call Function4fb2
ld hl, $0007
add hl, bc
ld [hl], $ff
ret
; 4e2b
Function4e2b: ; 4e2b
call Function4fb2
call Function46d7
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
call Function4600
ld hl, $0007
add hl, bc
ld [hl], $ff
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4e47
Function4e47: ; 4e47
call Function46d7
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
call Function4600
jp Function4b1d
; 4e56
Function4e56: ; 4e56
; AnimateStep?
call Function47a8
dw Function4e5d
dw Function4e65
; 4e5d
Function4e5d: ; 4e5d
ld hl, $d150
set 7, [hl]
call Function47a2
; fallthrough
; 4e65
Function4e65: ; 4e65
call Function4738
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
ld hl, $d150
set 6, [hl]
call Function4600
ld hl, $0007
add hl, bc
ld [hl], $ff
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4e83
Function4e83: ; 4e83
call Function47a8
dw Function4e8e
dw Function4ea4
dw Function4ead
dw Function4ec0
; 4e8e
Function4e8e: ; 4e8e
ld hl, $0007
add hl, bc
ld [hl], $ff
ld hl, $000c
add hl, bc
ld a, [hl]
ld [hl], $2
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $2
call Function47a2
; fallthrough
; 4ea4
Function4ea4: ; 4ea4
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
call Function47a2
; fallthrough
; 4ead
Function4ead: ; 4ead
ld hl, $001d
add hl, bc
ld a, [hl]
ld hl, $0008
add hl, bc
ld [hl], a
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $2
call Function47a2
; fallthrough
; 4ec0
Function4ec0: ; 4ec0
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4ecd
Function4ecd: ; 4ecd
call Function46d7
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
push bc
ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
ld hl, $0001
add hl, bc
ld a, [hl]
ld b, a
callba Function807e
pop bc
ld hl, OBJECT_FLAGS
add hl, bc
res 2, [hl]
call Function4600
ld hl, $0007
add hl, bc
ld [hl], $ff
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4f04
Function4f04: ; 4f04
ld hl, $001d
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
ld hl, $0000
add hl, de
ld a, [hl]
and a
jr z, .asm_4f30
ld hl, OBJECT_SPRITE_X
add hl, de
ld a, [hl]
ld hl, OBJECT_SPRITE_X
add hl, bc
ld [hl], a
ld hl, OBJECT_SPRITE_Y
add hl, de
ld a, [hl]
ld hl, OBJECT_SPRITE_Y
add hl, bc
ld [hl], a
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld a, [hl]
and a
ret z
dec [hl]
ret nz
.asm_4f30
jp Function4357
; 4f33
Function4f33: ; 4f33
call Function47a8
dw Function4f3a
dw Function4f43
; 4f3a
Function4f3a: ; 4f3a
xor a
ld hl, $001d
add hl, bc
ld [hl], a
call Function47a2
; fallthrough
; 4f43
Function4f43: ; 4f43
ld hl, $001d
add hl, bc
ld d, [hl]
ld a, [$d14f]
sub d
ld [$d14f], a
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
jr z, .asm_4f68
ld a, [hl]
call Function4f6c
ld hl, $001d
add hl, bc
ld [hl], a
ld d, a
ld a, [$d14f]
add d
ld [$d14f], a
ret
.asm_4f68
call Function4357
ret
; 4f6c
Function4f6c: ; 4f6c
ld hl, $001e
add hl, bc
and 1
ld a, [hl]
ret z
cpl
inc a
ret
; 4f77
Function4f77: ; 4f77
call Function47a8 ; ????
; 4f7a
Function4f7a: ; 4f7a
call Function47a8
dw Function4f83
dw Function4f83
dw Function4f83
; 4f83
Function4f83: ; 4f83
call Function47a8
dw Function4f8a
dw Function4f99
; 4f8a
Function4f8a: ; 4f8a
ld hl, $000b
add hl, bc
ld [hl], $10
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $10
call Function47a2
; 4f99
Function4f99: ; 4f99
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], $60
ld hl, $000c
add hl, bc
ld [hl], $0
ld hl, $0009
add hl, bc
ld [hl], $1
ret
; 4fb2
Function4fb2: ; 4fb2
ret
; 4fb3
Function4fb3: ; 4fb3
ld hl, $001d
add hl, bc
inc [hl]
ld a, [hl]
srl a
srl a
and 7
ld l, a
ld h, 0
ld de, .y
add hl, de
ld a, [hl]
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], a
ret
; 4fcd
.y ; 4fcd
db 0, -1, -2, -3, -4, -3, -2, -1
; 4fd5
UpdateJumpPosition: ; 4fd5
call GetStepVector
ld a, h
ld hl, $001f
add hl, bc
ld e, [hl]
add e
ld [hl], a
nop
srl e
ld d, 0
ld hl, .y
add hl, de
ld a, [hl]
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], a
ret
; 4ff0
.y ; 4ff0
db -4, -6, -8, -10, -11, -12, -12, -12
db -11, -10, -9, -8, -6, -4, 0, 0
; 5000
Function5000: ; 5000
ld a, [$c2de]
ld hl, $c2df
ld [hl], a
ld a, $3e
ld [$c2de], a
ld a, [hl]
ret
; 500e
Function500e: ; 500e
ld hl, $c2e3
call Function1aae
ret
; 5015
Function5015: ; 5015
ld hl, $001b
add hl, bc
ld e, [hl]
inc [hl]
ld d, 0
ld hl, $c2e2
ld a, [hli]
ld h, [hl]
ld l, a
add hl, de
ld a, [hl]
ret
; 5026
Function5026: ; 5026
ld hl, $001b
add hl, bc
ld e, [hl]
inc [hl]
ld d, 0
ld hl, $c2e6
ld a, [hli]
ld h, [hl]
ld l, a
add hl, de
ld a, [hl]
ret
; 5037
Function5037: ; 5037
ld hl, Function503d
jp Function5041
; 503d
Function503d: ; 503d
ld a, [$c2e2]
ret
; 5041
Function5041: ; 5041
call Function5055
.asm_5044
xor a
ld [$c2ea], a
call Function505e
call Function506b
ld a, [$c2ea]
and a
jr nz, .asm_5044
ret
; 5055
Function5055: ; 5055
ld a, l
ld [$c2eb], a
ld a, h
ld [$c2ec], a
ret
; 505e
Function505e: ; 505e
ld hl, $c2eb
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 5065
Function5065: ; 5065
ld a, $1
ld [$c2ea], a
ret
; 506b
Function506b: ; 506b
push af
call Function54b8
pop af
ld hl, MovementPointers
rst JumpTable
ret
; 5075
; 5075
INCLUDE "engine/movement.asm"
; 54b8
Function54b8: ; 54b8
ld e, a
ld a, [$d4ce]
cp $ff
ret z
ld a, [$d4cd]
ld d, a
ld a, [$ffaf]
cp d
ret nz
ld a, e
cp $3e
ret z
cp $47
ret z
cp $4b
ret z
cp $50
ret z
cp $8
ret c
push af
ld hl, $d4d0
inc [hl]
ld e, [hl]
ld d, 0
ld hl, $d4d1
add hl, de
pop af
ld [hl], a
ret
; 54e6
Function54e6: ; 54e6
ld hl, $d4d0
ld a, [hl]
and a
jr z, .asm_5503
cp $ff
jr z, .asm_5503
dec [hl]
ld e, a
ld d, 0
ld hl, $d4d1
add hl, de
inc e
ld a, $ff
.asm_54fc
ld d, [hl]
ld [hld], a
ld a, d
dec e
jr nz, .asm_54fc
ret
.asm_5503
call Function550a
ret c
ld a, $3e
ret
; 550a
Function550a: ; 550a
ld a, [$d4cd]
cp $ff
jr z, .asm_5520
push bc
call Function1ae5
ld hl, $0000
add hl, bc
ld a, [hl]
pop bc
and a
jr z, .asm_5520
and a
ret
.asm_5520
ld a, $ff
ld [$d4ce], a
ld a, $47
scf
ret
; 5529
Function5529: ; 5529
push bc
ld de, .data_5535
call Function55b9
call Function55ac
pop bc
ret
.data_5535
db $00, $05, $1b
; 5538
Function5538: ; 5538
push bc
ld de, .data_5544
call Function55b9
call Function55ac
pop bc
ret
.data_5544
db $00, $05, $22
; 5547
Function5547: ; 5547
push bc
ld de, .data_5553
call Function55b9
call Function55ac
pop bc
ret
.data_5553
db $00, $05, $1c
; 5556
Function5556: ; 5556
push bc
ld de, .data_5562
call Function55b9
call Function55ac
pop bc
ret
.data_5562
db $00, $06, $23
; 5565
Function5565: ; 5565
push bc
push af
ld de, .data_5576
call Function55b9
pop af
ld [$c2f5], a
call Function55ac
pop bc
ret
.data_5576
db $00, $05, $1d
; 5579
Function5579: ; 5579
push bc
ld a, [$ffaf]
ld c, a
call Function5582
pop bc
ret
; 5582
Function5582: ; 5582
ld de, ObjectStructs
ld a, $d
.asm_5587
push af
ld hl, $0004
add hl, de
bit 7, [hl]
jr z, .asm_55a1
ld hl, $0000
add hl, de
ld a, [hl]
and a
jr z, .asm_55a1
push bc
xor a
ld bc, ObjectStruct2 - ObjectStruct1
call ByteFill
pop bc
.asm_55a1
ld hl, ObjectStruct2 - ObjectStruct1
add hl, de
ld d, h
ld e, l
pop af
dec a
jr nz, .asm_5587
ret
; 55ac
Function55ac: ; 55ac
call Function1a13
ret nc
ld d, h
ld e, l
callba Function8286
ret
; 55b9
Function55b9: ; 55b9
ld hl, $c2f0
ld [hl], $ff
inc hl
ld [hl], $ff
inc hl
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
ld [hli], a
ld a, [$ffaf]
ld [hli], a
push hl
ld hl, $0010
add hl, bc
ld d, [hl]
ld hl, $0011
add hl, bc
ld e, [hl]
pop hl
ld [hl], d
inc hl
ld [hl], e
inc hl
ld [hl], $ff
ret
; 55e0
Function55e0:: ; 55e0
ld a, [VramState]
bit 0, a
ret z
ld bc, ObjectStructs
xor a
.asm_55ea
ld [$ffaf], a
call Function1af1
jr z, .asm_55f4
call Function565c
.asm_55f4
ld hl, ObjectStruct2 - ObjectStruct1
add hl, bc
ld b, h
ld c, l
ld a, [$ffaf]
inc a
cp $d
jr nz, .asm_55ea
ret
; 5602
Function5602: ; 5602
call Function5645
ld a, $0
call Function5629
ld a, [$d459]
bit 7, a
jr z, .asm_5619
ld a, [$ffe0]
and a
jr z, .asm_5619
call Function5629
.asm_5619
call Function5920
ret
; 561d
Function561d: ; 561d
call Function5645
ld a, $0
call Function5629
call Function5920
ret
; 5629
Function5629: ; 5629
cp $10
ret nc
call GetMapObject
ld hl, $0000
add hl, bc
ld a, [hl]
cp $ff
ret z
cp $d
ret nc
call Function1ae5
call Function1af1
ret z
call Function5673
ret
; 5645
Function5645: ; 5645
xor a
ld bc, ObjectStructs
.asm_5649
ld [$ffaf], a
call Function5680
ld hl, ObjectStruct2 - ObjectStruct1
add hl, bc
ld b, h
ld c, l
ld a, [$ffaf]
inc a
cp $d
jr nz, .asm_5649
ret
; 565c
Function565c: ; 565c
push bc
call Function56cd
pop bc
jr c, Function5680
call Function56a3
jr c, Function5680
call Function5688
callba Function4440
xor a
ret
; 5673
Function5673: ; 5673
call Function56a3
jr c, Function5680
callba Function4440
xor a
ret
; 5680
Function5680: ; 5680
ld hl, OBJECT_FACING
add hl, bc
ld [hl], $ff
scf
ret
; 5688
Function5688: ; 5688
push bc
ld hl, $0010
add hl, bc
ld d, [hl]
ld hl, $0011
add hl, bc
ld e, [hl]
call Function2a3c
pop bc
ld hl, $000e
add hl, bc
ld [hl], a
callba Function463f
ret
; 56a3
Function56a3: ; 56a3
ld hl, $0010
add hl, bc
ld d, [hl]
ld hl, $0011
add hl, bc
ld e, [hl]
inc d
inc e
ld a, [XCoord]
cp d
jr z, .asm_56bc
jr nc, .asm_56cb
add $b
cp d
jr c, .asm_56cb
.asm_56bc
ld a, [YCoord]
cp e
jr z, .asm_56c9
jr nc, .asm_56cb
add $a
cp e
jr c, .asm_56cb
.asm_56c9
xor a
ret
.asm_56cb
scf
ret
; 56cd
Function56cd: ; 56cd
ld a, [$d14c]
ld d, a
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
ld a, [hl]
ld hl, OBJECT_SPRITE_X
add hl, bc
add [hl]
add d
cp $f0
jr nc, .asm_56e5
cp $a0
jp nc, .asm_5768
.asm_56e5
and $7
ld d, $2
cp $4
jr c, .asm_56ef
ld d, $3
.asm_56ef
ld a, [hl]
srl a
srl a
srl a
cp $14
jr c, .asm_56fc
sub $20
.asm_56fc
ld [$ffbd], a
ld a, [$d14d]
ld e, a
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld a, [hl]
ld hl, OBJECT_SPRITE_Y
add hl, bc
add [hl]
add e
cp $f0
jr nc, .asm_5715
cp $90
jr nc, .asm_5768
.asm_5715
and $7
ld e, $2
cp $4
jr c, .asm_571f
ld e, $3
.asm_571f
ld a, [hl]
srl a
srl a
srl a
cp $12
jr c, .asm_572c
sub $20
.asm_572c
ld [$ffbe], a
ld hl, $0006
add hl, bc
bit 7, [hl]
jr z, .asm_573e
ld a, d
add $2
ld d, a
ld a, e
add $2
ld e, a
.asm_573e
ld a, d
ld [$ffbf], a
.asm_5741
ld a, [$ffbf]
ld d, a
ld a, [$ffbe]
add e
dec a
cp $12
jr nc, .asm_5763
ld b, a
.asm_574d
ld a, [$ffbd]
add d
dec a
cp $14
jr nc, .asm_5760
ld c, a
push bc
call GetTileCoord
pop bc
ld a, [hl]
cp $60
jr nc, .asm_5768
.asm_5760
dec d
jr nz, .asm_574d
.asm_5763
dec e
jr nz, .asm_5741
and a
ret
.asm_5768
scf
ret
; 576a
Function576a:: ; 576a
call Function5771
call Function5781
ret
; 5771
Function5771: ; 5771
xor a
ld [$d14e], a
ld [$d14f], a
ld [$d150], a
ld a, $ff
ld [$d151], a
ret
; 5781
Function5781: ; 5781
ld bc, ObjectStructs
xor a
.asm_5785
ld [$ffaf], a
call Function1af1
jr z, .asm_578f
call Function437b
.asm_578f
ld hl, ObjectStruct2 - ObjectStruct1
add hl, bc
ld b, h
ld c, l
ld a, [$ffaf]
inc a
cp $d
jr nz, .asm_5785
ret
; 579d
Function579d: ; 579d
ld a, $3e
ld [$c2de], a
ld [$c2df], a
xor a
ld [$d04e], a
ld [$d4e2], a
call Function57bc
callba Function149c6
call c, Function57d9
call Function57ca
ret
; 57bc
Function57bc: ; 57bc
ld hl, $d45b
bit 7, [hl]
jr nz, .asm_57c4
ret
.asm_57c4
ld a, $0
ld [PlayerAction], a
ret
; 57ca
Function57ca: ; 57ca
ld hl, $d45b
bit 5, [hl]
ret z
ld a, [$d45b]
and $3
add a
add a
jr Function57db
; 57d9
Function57d9: ; 57d9
ld a, $0
; fallthrough
; 57db
Function57db: ; 57db
ld bc, PlayerStruct
call Function1af8
ret
; 57e2
Function57e2: ; 57e2
ld a, d
and $80
ret z
ld bc, $0000
ld hl, $0008
add hl, bc
ld a, [hl]
or d
ld [hl], a
ld a, d
swap a
and $7
ld d, a
ld bc, PlayerStruct
ld hl, $0006
add hl, bc
ld a, [hl]
and $f8
or d
ld [hl], a
ret
; 5803
Function5803:: ; 5803
push bc
ld a, b
call Function5815
pop bc
ret c
ld a, c
call Function582c
callba Function848a
ret
; 5815
Function5815: ; 5815
call Function18de
ret c
ld a, [$ffb0]
ld [$d4cd], a
ret
; 581f
Function581f:: ; 581f
call Function5826
call Function5847
ret
; 5826
Function5826: ; 5826
ld a, $ff
ld [$d4cd], a
ret
; 582c
Function582c: ; 582c
push af
call Function5847
pop af
call Function18de
ret c
ld hl, $0003
add hl, bc
ld [hl], $13
ld hl, $0009
add hl, bc
ld [hl], $0
ld a, [$ffb0]
ld [$d4ce], a
ret
; 5847
Function5847: ; 5847
ld a, [$d4ce]
cp $ff
ret z
call Function1ae5
callba Function58e3
ld a, $ff
ld [$d4ce], a
ret
; 585c
Function585c:: ; 585c
ld a, c
call Function18de
ret c
push bc
call Function587a
pop bc
ld hl, $0005
add hl, bc
res 5, [hl]
xor a
ret
; 586e
Function586e: ; 586e
call Function18de
ret c
ld hl, $0005
add hl, bc
set 5, [hl]
xor a
ret
; 587a
Function587a: ; 587a
ld bc, ObjectStructs
xor a
.asm_587e
push af
call Function1af1
jr z, .asm_588a
ld hl, $0005
add hl, bc
set 5, [hl]
.asm_588a
ld hl, ObjectStruct2 - ObjectStruct1
add hl, bc
ld b, h
ld c, l
pop af
inc a
cp $d
jr nz, .asm_587e
ret
; 5897
Function5897:: ; 5897
ld a, [$d4cd]
cp $ff
ret z
push bc
call Function1ae5
ld hl, $0001
add hl, bc
ld a, [hl]
pop bc
cp c
ret nz
ld a, [$d4ce]
cp $ff
ret z
call Function1ae5
ld hl, $0005
add hl, bc
res 5, [hl]
ret
; 58b9
Function58b9:: ; 58b9
push bc
ld bc, ObjectStructs
xor a
.asm_58be
push af
call Function1af1
jr z, .asm_58ca
ld hl, $0005
add hl, bc
res 5, [hl]
.asm_58ca
ld hl, ObjectStruct2 - ObjectStruct1
add hl, bc
ld b, h
ld c, l
pop af
inc a
cp $d
jr nz, .asm_58be
pop bc
ret
; 58d8
Function58d8: ; 58d8
call Function18de
ret c
ld hl, $0005
add hl, bc
res 5, [hl]
ret
; 58e3
Function58e3: ; 58e3
ld hl, $0001
add hl, bc
ld a, [hl]
cp $ff
jp z, Function5903
push bc
call GetMapObject
ld hl, $0004
add hl, bc
ld a, [hl]
pop bc
ld hl, $0003
add hl, bc
ld [hl], a
ld hl, $0009
add hl, bc
ld [hl], $0
ret
; 5903
Function5903: ; 5903
call GetSpriteDirection
rrca
rrca
ld e, a
ld d, 0
ld hl, .data_591c
add hl, de
ld a, [hl]
ld hl, $0003
add hl, bc
ld [hl], a
ld hl, $0009
add hl, bc
ld [hl], $0
ret
.data_591c
db 6, 7, 8, 9
; 5920
Function5920:: ; 5920
ld a, [VramState]
bit 0, a
ret z
xor a
ld [$ffbd], a
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
call Function5991
call Function593a
pop af
ld [hOAMUpdate], a
ret
; 593a
Function593a: ; 593a
ld a, [VramState]
bit 1, a
ld b, $a0
jr z, .asm_5945
ld b, $70
.asm_5945
ld a, [$ffbd]
cp b
ret nc
ld l, a
ld h, $c4
ld de, $0004
ld a, b
ld c, $a0
.asm_5952
ld [hl], c
add hl, de
cp l
jr nz, .asm_5952
ret
; 5958
Function5958: ; 5958
push hl
push de
push bc
ld a, [$d14c]
ld d, a
ld a, [$d14d]
ld e, a
ld bc, ObjectStructs
ld a, $d
.asm_5968
push af
call Function1af1
jr z, .asm_597c
ld hl, OBJECT_SPRITE_X
add hl, bc
ld a, [hl]
add d
ld [hl], a
ld hl, OBJECT_SPRITE_Y
add hl, bc
ld a, [hl]
add e
ld [hl], a
.asm_597c
ld hl, ObjectStruct2 - ObjectStruct1
add hl, bc
ld b, h
ld c, l
pop af
dec a
jr nz, .asm_5968
xor a
ld [$d14c], a
ld [$d14d], a
pop bc
pop de
pop hl
ret
; 5991
Function5991: ; 5991
call Function59a4
ld c, $30
call Function59f3
ld c, $20
call Function59f3
ld c, $10
call Function59f3
ret
; 59a4
Function59a4: ; 59a4
xor a
ld hl, $c2eb
ld bc, 13
call ByteFill
ld d, 0
ld bc, ObjectStructs
ld hl, $c2eb
.loop
push hl
call Function1af1
jr z, .skip
ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
cp -1
jr z, .skip
; Define the sprite priority.
ld e, $10
ld hl, OBJECT_FLAGS
add hl, bc
bit 0, [hl]
jr nz, .add
ld e, $20
bit 1, [hl]
jr z, .add
ld e, $30
jr .add
.skip
ld hl, ObjectStruct2 - ObjectStruct1
add hl, bc
ld b, h
ld c, l
pop hl
jr .next
.add
ld hl, ObjectStruct2 - ObjectStruct1
add hl, bc
ld b, h
ld c, l
pop hl
ld a, d
or e
ld [hli], a
.next
inc d
ld a, d
cp $d
jr nz, .loop
ret
; 59f3
Function59f3: ; 59f3
ld hl, $c2eb
.next
ld a, [hli]
ld d, a
and $f0
ret z
cp c
jr nz, .next
push bc
push hl
ld a, d
and $f
call Function5ac2
call Function5a0d
pop hl
pop bc
jr .next
; 5a0d
Function5a0d: ; 5a0d
ld hl, OBJECT_SPRITE
add hl, bc
ld a, [hl]
and $7f
ld [$ffc1], a
xor a
bit 7, [hl]
jr nz, .asm_5a1d
or 8
.asm_5a1d
ld hl, OBJECT_FLAGS
add hl, bc
ld e, [hl]
bit 7, e
jr z, .asm_5a28
or $80
.asm_5a28
bit 4, e
jr z, .asm_5a2e
or $10
.asm_5a2e
ld hl, OBJECT_PALETTE
add hl, bc
ld d, a
ld a, [hl]
and 7
or d
ld d, a
xor a
bit 3, e
jr z, .asm_5a3f
or $80
.asm_5a3f
ld [$ffc2], a
ld hl, OBJECT_SPRITE_X
add hl, bc
ld a, [hl]
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
add [hl]
add 8
ld e, a
ld a, [$d14c]
add e
ld [$ffbf], a
ld hl, OBJECT_SPRITE_Y
add hl, bc
ld a, [hl]
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
add [hl]
add 12
ld e, a
ld a, [$d14d]
add e
ld [$ffc0], a
ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
cp -1
jp z, .done
cp NUM_FACINGS
jp nc, .done
ld l, a
ld h, 0
add hl, hl
ld bc, Facings
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$ffbd]
ld c, a
ld b, Sprites / $100
ld a, [hli]
ld [$ffbe], a
add c
cp SpritesEnd % $100
jr nc, .full
.addsprite
ld a, [$ffc0]
add [hl]
inc hl
ld [bc], a
inc c
ld a, [$ffbf]
add [hl]
inc hl
ld [bc], a
inc c
ld e, [hl]
inc hl
ld a, [$ffc1]
bit 2, e
jr z, .asm_5aa3
xor a
.asm_5aa3
add [hl]
inc hl
ld [bc], a
inc c
ld a, e
bit 1, a
jr z, .asm_5aaf
ld a, [$ffc2]
or e
.asm_5aaf
and $f0
or d
ld [bc], a
inc c
ld a, [$ffbe]
dec a
ld [$ffbe], a
jr nz, .addsprite
ld a, c
ld [$ffbd], a
.done
xor a
ret
.full
scf
ret
; 5ac2
Function5ac2: ; 5ac2
ld c, a
ld b, 0
ld hl, .Addresses
add hl, bc
add hl, bc
ld c, [hl]
inc hl
ld b, [hl]
ret
; 5ace
.Addresses ; 5ace
dw PlayerStruct
dw ObjectStruct1
dw ObjectStruct2
dw ObjectStruct3
dw ObjectStruct4
dw ObjectStruct5
dw ObjectStruct6
dw ObjectStruct7
dw ObjectStruct8
dw ObjectStruct9
dw ObjectStruct10
dw ObjectStruct11
dw ObjectStruct12
; 5ae8
Function5ae8: ; 5ae8
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
ld de, MUSIC_MAIN_MENU
ld a, e
ld [wMapMusic], a
call PlayMusic
callba MainMenu
jp Function6219
; 5b04
Function5b04: ; 5b04
ret
; 5b05
Function5b05: ; 5b05
push de
ld hl, .Days
ld a, b
call GetNthString
ld d, h
ld e, l
pop hl
call PlaceString
ld h, b
ld l, c
ld de, .Day
call PlaceString
ret
; 5b1c
.Days ; 5b1c
db "SUN@"
db "MON@"
db "TUES@"
db "WEDNES@"
db "THURS@"
db "FRI@"
db "SATUR@"
; 5b40
.Day ; 5b40
db "DAY@"
; 5b44
Function5b44: ; 5b44
xor a
ld [$ffde], a
call ClearTileMap
call Functione5f
call Functione51
call Function1fbf
ret
; 5b54
MysteryGift: ; 5b54
call UpdateTime
callba Function11548
callba Function1048ba
ret
; 5b64
OptionsMenu: ; 5b64
callba _OptionsMenu
ret
; 5b6b
NewGame: ; 5b6b
xor a
ld [$c2cc], a
call Function5ba7
call Function5b44
call Function5b8f
call OakSpeech
call Function5d23
ld a, $1
ld [$c2d8], a
ld a, 0 ; SPAWN_HOME
ld [$d001], a
ld a, $f1
ld [$ff9f], a
jp Function5e5d
; 5b8f
Function5b8f: ; 5b8f
callba Function10632f
jr c, .asm_5b9e
callba Function48dcb
ret
.asm_5b9e
ld c, $0
callba Function4802f
ret
; 5ba7
Function5ba7: ; 5ba7
xor a
ld [hBGMapMode], a
call Function5bae
ret
; 5bae
Function5bae: ; 5bae
ld hl, Sprites
ld bc, Options - Sprites
xor a
call ByteFill
ld hl, $d000
ld bc, PlayerID - $d000
xor a
call ByteFill
ld hl, PlayerID
ld bc, $dff5 - PlayerID
xor a
call ByteFill
ld a, [rLY]
ld [$ffe3], a
call DelayFrame
ld a, [hRandomSub]
ld [PlayerID], a
ld a, [rLY]
ld [$ffe3], a
call DelayFrame
ld a, [hRandomAdd]
ld [PlayerID + 1], a
call Random
ld [$d84a], a
call DelayFrame
call Random
ld [$d84b], a
ld hl, PartyCount
call Function5ca1
xor a
ld [wCurBox], a
ld [$d4b4], a
call Function5ca6
ld a, 1
call GetSRAMBank
ld hl, sBoxCount
call Function5ca1
call CloseSRAM
ld hl, NumItems
call Function5ca1
ld hl, NumKeyItems
call Function5ca1
ld hl, NumBalls
call Function5ca1
ld hl, PCItems
call Function5ca1
xor a
ld [wRoamMon1Species], a
ld [wRoamMon2Species], a
ld [wRoamMon3Species], a
ld a, -1
ld [wRoamMon1MapGroup], a
ld [wRoamMon2MapGroup], a
ld [wRoamMon3MapGroup], a
ld [wRoamMon1MapNumber], a
ld [wRoamMon2MapNumber], a
ld [wRoamMon3MapNumber], a
ld a, 0
call GetSRAMBank
ld hl, $abe2
xor a
ld [hli], a
dec a
ld [hl], a
call CloseSRAM
call Function5d33
call Function5cd3
xor a
ld [MonType], a
ld [JohtoBadges], a
ld [KantoBadges], a
ld [Coins], a
ld [Coins + 1], a
ld [Money], a
ld a, 3000 >> 8
ld [Money + 1], a
ld a, 3000 & $ff
ld [Money + 2], a
xor a
ld [$dc17], a
ld hl, $dc19
ld [hl], $0
inc hl
ld [hl], $8
inc hl
ld [hl], $fc
call Function5ce9
callba Function26751
callba Function44765
callba Function1061c0
call ResetGameTime
ret
; 5ca1
Function5ca1: ; 5ca1
xor a
ld [hli], a
dec a
ld [hl], a
ret
; 5ca6
Function5ca6: ; 5ca6
ld hl, wBoxNames
ld c, 0
.asm_5cab
push hl
ld de, .Box
call CopyName2
dec hl
ld a, c
inc a
cp 10
jr c, .asm_5cbe
sub 10
ld [hl], "1"
inc hl
.asm_5cbe
add "0"
ld [hli], a
ld [hl], "@"
pop hl
ld de, 9
add hl, de
inc c
ld a, c
cp NUM_BOXES
jr c, .asm_5cab
ret
.Box
db "BOX@"
; 5cd3
Function5cd3: ; 5cd3
ld hl, $dfe8
ld a, $3
ld [hli], a
ld a, $6
ld [hli], a
ld de, .Ralph
call CopyName2
ret
; 5ce3
.Ralph ; 5ce3
db "RALPH@"
; 5ce9
Function5ce9: ; 5ce9
ld hl, .Rival
ld de, RivalName
call .Copy
ld hl, .Mom
ld de, MomsName
call .Copy
ld hl, .Red
ld de, RedsName
call .Copy
ld hl, .Green
ld de, GreensName
.Copy
ld bc, NAME_LENGTH
call CopyBytes
ret
.Rival db "???@"
.Red db "RED@"
.Green db "GREEN@"
.Mom db "MOM@"
; 5d23
Function5d23: ; 5d23
call Function610f
callba Function8029
callba Function113d6
ret
; 5d33
Function5d33: ; 5d33
ld a, $0
call GetSRAMBank
ld a, [CurDay]
inc a
ld b, a
ld a, [$ac68]
cp b
ld a, [$ac6a]
ld c, a
ld a, [$ac69]
jr z, .asm_5d55
ld a, b
ld [$ac68], a
call Random
ld c, a
call Random
.asm_5d55
ld [$dc9f], a
ld [$ac69], a
ld a, c
ld [$dca0], a
ld [$ac6a], a
jp CloseSRAM
; 5d65
Continue: ; 5d65
callba Function14ea5
jr c, .asm_5dd6
callba Function150b9
call Function1d6e
call Function5e85
ld a, $1
ld [hBGMapMode], a
ld c, $14
call DelayFrames
call Function5e34
jr nc, .asm_5d8c
call Function1c17
jr .asm_5dd6
.asm_5d8c
call Function5e48
jr nc, .asm_5d96
call Function1c17
jr .asm_5dd6
.asm_5d96
ld a, $8
ld [MusicFade], a
ld a, MUSIC_NONE % $100
ld [MusicFadeIDLo], a
ld a, MUSIC_NONE / $100
ld [MusicFadeIDHi], a
call WhiteBGMap
call Function5df0
call Function1c17
call ClearTileMap
ld c, $14
call DelayFrames
callba Function2a394
callba Function105091
callba Function140ae
ld a, [$d4b5]
cp $1
jr z, .asm_5dd7
ld a, $f2
ld [$ff9f], a
jp Function5e5d
.asm_5dd6
ret
.asm_5dd7
ld a, $e ; SPAWN_NEW_BARK
ld [$d001], a
call Function5de7
jp Function5e5d
; 5de2
Function5de2: ; 5de2
ld a, $1a ; SPAWN_MT_SILVER
ld [$d001], a
; 5de7
Function5de7: ; 5de7
xor a
ld [$d4b5], a
ld a, $f1
ld [$ff9f], a
ret
; 5df0
Function5df0: ; 5df0
callba Function10632f
ret nc
ld hl, $d479
bit 1, [hl]
ret nz
ld a, $5
ld [MusicFade], a
ld a, MUSIC_MOBILE_ADAPTER_MENU % $100
ld [MusicFadeIDLo], a
ld a, MUSIC_MOBILE_ADAPTER_MENU / $100
ld [MusicFadeIDHi], a
ld c, 20
call DelayFrames
ld c, $1
callba Function4802f
callba Function1509a
ld a, $8
ld [MusicFade], a
ld a, MUSIC_NONE % $100
ld [MusicFadeIDLo], a
ld a, MUSIC_NONE / $100
ld [MusicFadeIDHi], a
ld c, 35
call DelayFrames
ret
; 5e34
Function5e34: ; 5e34
.asm_5e34
call DelayFrame
call GetJoypad
ld hl, hJoyPressed
bit 0, [hl]
jr nz, .asm_5e47
bit 1, [hl]
jr z, .asm_5e34
scf
ret
.asm_5e47
ret
; 5e48
Function5e48: ; 5e48
call Function6e3
and $80
jr z, .asm_5e5b
callba Function20021
ld a, c
and a
jr z, .asm_5e5b
scf
ret
.asm_5e5b
xor a
ret
; 5e5d
Function5e5d: ; 5e5d
.asm_5e5d
xor a
ld [$c2c1], a
ld [InLinkBattle], a
ld hl, GameTimerPause
set 0, [hl]
res 7, [hl]
ld hl, $d83e
set 1, [hl]
callba OverworldLoop
ld a, [$d4b5]
cp $2
jr z, .asm_5e80
jp Reset
.asm_5e80
call Function5de2
jr .asm_5e5d
; 5e85
Function5e85: ; 5e85
call Function6e3
and $80
jr z, .asm_5e93
ld de, $0408
call Function5eaf
ret
.asm_5e93
ld de, $0408
call Function5e9f
ret
; 5e9a
Function5e9a: ; 5e9a
ld de, $0400
jr Function5e9f
; 5e9f
Function5e9f: ; 5e9f
call Function5ebf
call Function5f1c
call Function5f40
call Functione5f
call Function1ad2
ret
; 5eaf
Function5eaf: ; 5eaf
call Function5ebf
call Function5f1c
call Function5f48
call Functione5f
call Function1ad2
ret
; 5ebf
Function5ebf: ; 5ebf
xor a
ld [hBGMapMode], a
ld hl, MenuDataHeader_0x5ed9
ld a, [StatusFlags]
bit 0, a ; pokedex
jr nz, .asm_5ecf
ld hl, MenuDataHeader_0x5efb
.asm_5ecf
call Function1e35
call Function1cbb
call Function1c89
ret
; 5ed9
MenuDataHeader_0x5ed9: ; 5ed9
db $40 ; flags
db 00, 00 ; start coords
db 09, 15 ; end coords
dw MenuData2_0x5ee1
db 1 ; default option
; 5ee1
MenuData2_0x5ee1: ; 5ee1
db $00 ; flags
db 4 ; items
db "PLAYER@"
db "BADGES@"
db "#DEX@"
db "TIME@"
; 5efb
MenuDataHeader_0x5efb: ; 5efb
db $40 ; flags
db 00, 00 ; start coords
db 09, 15 ; end coords
dw MenuData2_0x5f03
db 1 ; default option
; 5f03
MenuData2_0x5f03: ; 5f03
db $00 ; flags
db 4 ; items
db "PLAYER ", $52, "@"
db "BADGES@"
db " @"
db "TIME@"
; 5f1c
Function5f1c: ; 5f1c
call Function1cfd
push hl
ld de, $005d
add hl, de
call Function5f58
pop hl
push hl
ld de, $0084
add hl, de
call Function5f6b
pop hl
push hl
ld de, $0030
add hl, de
ld de, .Player
call PlaceString
pop hl
ret
.Player
db $52, "@"
; 5f40
Function5f40: ; 5f40
ld de, $00a9
add hl, de
call Function5f84
ret
; 5f48
Function5f48: ; 5f48
ld de, $00a9
add hl, de
ld de, .text_5f53
call PlaceString
ret
.text_5f53
db " ???@"
; 5f58
Function5f58: ; 5f58
push hl
ld hl, JohtoBadges
ld b, $2
call CountSetBits
pop hl
ld de, $d265
ld bc, $0102
jp PrintNum
; 5f6b
Function5f6b: ; 5f6b
ld a, [StatusFlags]
bit 0, a
ret z
push hl
ld hl, PokedexCaught
ld b, $20
call CountSetBits
pop hl
ld de, $d265
ld bc, $0103
jp PrintNum
; 5f84
Function5f84: ; 5f84
ld de, GameTimeHours
ld bc, $0203
call PrintNum
ld [hl], $6d
inc hl
ld de, GameTimeMinutes
ld bc, $8102
jp PrintNum
; 5f99
OakSpeech: ; 0x5f99
callba Function90672
call Function4dd
call ClearTileMap
ld de, MUSIC_ROUTE_30
call PlayMusic
call Function4a3
call Function4b6
xor a
ld [CurPartySpecies], a
ld a, POKEMON_PROF
ld [TrainerClass], a
call Function619c
ld b, $1c
call GetSGBLayout
call Function616a
ld hl, OakText1
call PrintText
call Function4b6
call ClearTileMap
ld a, WOOPER
ld [CurSpecies], a
ld [CurPartySpecies], a
call GetBaseData
hlcoord 6, 4
call Function3786
xor a
ld [TempMonDVs], a
ld [$d124], a
ld b, $1c
call GetSGBLayout
call Function6182
ld hl, OakText2
call PrintText
ld hl, OakText4
call PrintText
call Function4b6
call ClearTileMap
xor a
ld [CurPartySpecies], a
ld a, POKEMON_PROF
ld [TrainerClass], a
call Function619c
ld b, $1c
call GetSGBLayout
call Function616a
ld hl, OakText5
call PrintText
call Function4b6
call ClearTileMap
xor a
ld [CurPartySpecies], a
callba DrawIntroPlayerPic
ld b, $1c
call GetSGBLayout
call Function616a
ld hl, OakText6
call PrintText
call NamePlayer
ld hl, OakText7
call PrintText
ret
OakText1: ; 0x6045
TX_FAR _OakText1
db "@"
OakText2: ; 0x604a
TX_FAR _OakText2
start_asm
ld a,WOOPER
call PlayCry
call WaitSFX
ld hl,OakText3
ret
OakText3: ; 0x605b
TX_FAR _OakText3
db "@"
OakText4: ; 0x6060
TX_FAR _OakText4
db "@"
OakText5: ; 0x6065
TX_FAR _OakText5
db "@"
OakText6: ; 0x606a
TX_FAR _OakText6
db "@"
OakText7: ; 0x606f
TX_FAR _OakText7
db "@"
NamePlayer: ; 0x6074
callba MovePlayerPicRight
callba ShowPlayerNamingChoices
ld a, [$cfa9]
dec a
jr z, .NewName
call Function60fa
callba Function8c1d
callba MovePlayerPicLeft
ret
.NewName
ld b, 1
ld de, PlayerName
callba Function116c1
call Function4b6
call ClearTileMap
call Functione5f
call WaitBGMap
xor a
ld [CurPartySpecies], a
callba DrawIntroPlayerPic
ld b, $1c
call GetSGBLayout
call Function4f0
ld hl, PlayerName
ld de, .Chris
ld a, [PlayerGender]
bit 0, a
jr z, .asm_60cf
ld de, .Kris
.asm_60cf
call InitName
ret
.Chris
db "CHRIS@@@@@@"
.Kris
db "KRIS@@@@@@@"
; 60e9
Function60e9: ; 60e9
call LoadMenuDataHeader
call Function1d81
ld a, [$cfa9]
dec a
call Function1db8
call Function1c17
ret
; 60fa
Function60fa: ; 60fa
ld a, $50
ld bc, $000b
ld hl, PlayerName
call ByteFill
ld hl, PlayerName
ld de, StringBuffer2
call CopyName2
ret
; 610f
Function610f: ; 610f
ld a, [hROMBank]
push af
ld a, 0 << 7 | 32 ; fade out
ld [MusicFade], a
ld de, MUSIC_NONE
ld a, e
ld [MusicFadeIDLo], a
ld a, d
ld [MusicFadeIDHi], a
ld de, SFX_ESCAPE_ROPE
call PlaySFX
pop af
rst Bankswitch
ld c, 8
call DelayFrames
ld hl, Shrink1Pic
ld b, BANK(Shrink1Pic)
call Function61b4
ld c, 8
call DelayFrames
ld hl, Shrink2Pic
ld b, BANK(Shrink2Pic)
call Function61b4
ld c, 8
call DelayFrames
hlcoord 6, 5
ld b, 7
ld c, 7
call ClearBox
ld c, 3
call DelayFrames
call Function61cd
call Functione5f
ld c, 50
call DelayFrames
call Function4b6
call ClearTileMap
ret
; 616a
Function616a: ; 616a
ld hl, IntroFadePalettes
ld b, IntroFadePalettesEnd - IntroFadePalettes
.asm_616f
ld a, [hli]
call DmgToCgbBGPals
ld c, 10
call DelayFrames
dec b
jr nz, .asm_616f
ret
; 617c
IntroFadePalettes: ; 0x617c
db %01010100
db %10101000
db %11111100
db %11111000
db %11110100
db %11100100
IntroFadePalettesEnd
; 6182
Function6182: ; 6182
ld a, $77
ld [hWX], a
call DelayFrame
ld a, $e4
call DmgToCgbBGPals
.asm_618e
call DelayFrame
ld a, [hWX]
sub $8
cp $ff
ret z
ld [hWX], a
jr .asm_618e
; 619c
Function619c: ; 619c
ld de, VTiles2
callba GetTrainerPic
xor a
ld [$ffad], a
hlcoord 6, 4
ld bc, $0707
predef FillBox
ret
; 61b4
Function61b4: ; 61b4
ld de, VTiles2
ld c, $31
predef DecompressPredef
xor a
ld [$ffad], a
hlcoord 6, 4
ld bc, $0707
predef FillBox
ret
; 61cd
Function61cd: ; 61cd
callba GetPlayerIcon
ld c, $c
ld hl, VTiles0
call Request2bpp
ld hl, Sprites
ld de, .data_61fe
ld a, [de]
inc de
ld c, a
.asm_61e4
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 b, 0
ld a, [PlayerGender]
bit 0, a
jr z, .asm_61f8
ld b, 1
.asm_61f8
ld a, b
ld [hli], a
dec c
jr nz, .asm_61e4
ret
; 61fe
.data_61fe ; 61fe
db 4
db $4c, $48, $00
db $4c, $50, $01
db $54, $48, $02
db $54, $50, $03
; 620b
Function620b: ; 620b
callab Functione4579
jr c, Function6219
callba Functione48ac
Function6219: ; 6219
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
call TitleScreen
call DelayFrame
.asm_6226
call Function627b
jr nc, .asm_6226
call ClearSprites
call WhiteBGMap
pop af
ld [rSVBK], a
ld hl, rLCDC
res 2, [hl]
call ClearScreen
call Function3200
xor a
ld [hLCDStatCustom], a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
ld b, $8
call GetSGBLayout
call UpdateTimePals
ld a, [$cf64]
cp $5
jr c, .asm_625e
xor a
.asm_625e
ld e, a
ld d, 0
ld hl, .data_626a
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 626a
.data_626a
dw Function5ae8
dw Function6389
dw Function620b
dw Function620b
dw Function6392
; 6274
TitleScreen: ; 6274
callba _TitleScreen
ret
; 627b
Function627b: ; 627b
ld a, [$cf63]
bit 7, a
jr nz, .asm_6290
call TitleScreenScene
callba Function10eea7
call DelayFrame
and a
ret
.asm_6290
scf
ret
; 6292
Function6292: ; 6292
ld a, [$ff9b]
and $7
ret nz
ld hl, $d15f
ld a, [hl]
dec a
ld bc, $0028
call ByteFill
ret
; 62a3
TitleScreenScene: ; 62a3
ld e, a
ld d, 0
ld hl, .scenes
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 62af
.scenes
dw TitleScreenEntrance
dw TitleScreenTimer
dw TitleScreenMain
dw TitleScreenEnd
; 62b7
Function62b7: ; 62b7
ld hl, $cf63
inc [hl]
ret
; 62bc
TitleScreenEntrance: ; 62bc
; Animate the logo:
; Move each line by 4 pixels until our count hits 0.
ld a, [hSCX]
and a
jr z, .done
sub 4
ld [hSCX], a
; Lay out a base (all lines scrolling together).
ld e, a
ld hl, LYOverrides
ld bc, 8 * 10 ; logo height
call ByteFill
; Reversed signage for every other line's position.
; This is responsible for the interlaced effect.
ld a, e
xor $ff
inc a
ld b, 8 * 10 / 2 ; logo height / 2
ld hl, LYOverrides + 1
.loop
ld [hli], a
inc hl
dec b
jr nz, .loop
callba AnimateTitleCrystal
ret
.done
; Next scene
ld hl, $cf63
inc [hl]
xor a
ld [hLCDStatCustom], a
; Play the title screen music.
ld de, MUSIC_TITLE
call PlayMusic
ld a, $88
ld [hWY], a
ret
; 62f6
TitleScreenTimer: ; 62f6
; Next scene
ld hl, $cf63
inc [hl]
; Start a timer
ld hl, $cf65
ld de, $1140 ; 73.6 seconds
ld [hl], e
inc hl
ld [hl], d
ret
; 6304
TitleScreenMain: ; 6304
; Run the timer down.
ld hl, $cf65
ld e, [hl]
inc hl
ld d, [hl]
ld a, e
or d
jr z, .end
dec de
ld [hl], d
dec hl
ld [hl], e
; Save data can be deleted by pressing Up + B + Select.
call GetJoypad
ld hl, hJoyDown
ld a, [hl]
and D_UP + B_BUTTON + SELECT
cp D_UP + B_BUTTON + SELECT
jr z, .delete_save_data
; To bring up the clock reset dialog:
; Hold Down + B + Select to initiate the sequence.
ld a, [$ffeb]
cp $34
jr z, .check_clock_reset
ld a, [hl]
and D_DOWN + B_BUTTON + SELECT
cp D_DOWN + B_BUTTON + SELECT
jr nz, .check_start
ld a, $34
ld [$ffeb], a
jr .check_start
; Keep Select pressed, and hold Left + Up.
; Then let go of Select.
.check_clock_reset
bit 2, [hl] ; SELECT
jr nz, .check_start
xor a
ld [$ffeb], a
ld a, [hl]
and D_LEFT + D_UP
cp D_LEFT + D_UP
jr z, .clock_reset
; Press Start or A to start the game.
.check_start
ld a, [hl]
and START | A_BUTTON
jr nz, .continue
ret
.continue
ld a, 0
jr .done
.delete_save_data
ld a, 1
.done
ld [$cf64], a
; Return to the intro sequence.
ld hl, $cf63
set 7, [hl]
ret
.end
; Next scene
ld hl, $cf63
inc [hl]
; Fade out the title screen music
xor a
ld [MusicFadeIDLo], a
ld [MusicFadeIDHi], a
ld hl, MusicFade
ld [hl], 8 ; 1 second
ld hl, $cf65
inc [hl]
ret
.clock_reset
ld a, 4
ld [$cf64], a
; Return to the intro sequence.
ld hl, $cf63
set 7, [hl]
ret
; 6375
TitleScreenEnd: ; 6375
; Wait until the music is done fading.
ld hl, $cf65
inc [hl]
ld a, [MusicFade]
and a
ret nz
ld a, 2
ld [$cf64], a
; Back to the intro.
ld hl, $cf63
set 7, [hl]
ret
; 6389
Function6389: ; 6389
callba Function4d54c
jp Init
; 6392
Function6392: ; 6392
callba Function4d3b1
jp Init
; 639b
Function639b: ; 639b
ld a, [$cf65]
and $3
ret nz
ld bc, $c3a4
ld hl, $000a
add hl, bc
ld l, [hl]
ld h, 0
add hl, hl
add hl, hl
ld de, Data63ca
add hl, de
ld a, [$cf65]
and $4
srl a
srl a
ld e, a
ld d, 0
add hl, de
add hl, de
ld a, [hli]
and a
ret z
ld e, a
ld d, [hl]
ld a, $1
call Function3b2a
ret
; 63ca
Data63ca: ; 63ca
db $5c, $50, $00, $00
db $5c, $68, $5c, $58
db $5c, $68, $5c, $78
db $5c, $88, $5c, $78
db $00, $00, $5c, $78
db $00, $00, $5c, $58
; 63e2
Copyright: ; 63e2
call ClearTileMap
call Functione5f
ld de, CopyrightGFX
ld hl, VTiles2 + $600 ; tile $60
lb bc, BANK(CopyrightGFX), $1d
call Request2bpp
hlcoord 2, 7
ld de, CopyrightString
jp PlaceString
; 63fd
CopyrightString: ; 63fd
; ©1995-2001 Nintendo
db $60, $61, $62, $63, $64, $65, $66
db $67, $68, $69, $6a, $6b, $6c
db $4e
; ©1995-2001 Creatures inc.
db $60, $61, $62, $63, $64, $65, $66, $6d
db $6e, $6f, $70, $71, $72, $7a, $7b, $7c
db $4e
; ©1995-2001 GAME FREAK inc.
db $60, $61, $62, $63, $64, $65, $66, $73, $74
db $75, $76, $77, $78, $79, $7a, $7b, $7c
db "@"
; 642e
GameInit:: ; 642e
callba Function14f1c
call Function1fbf
call WhiteBGMap
call ClearTileMap
ld a, $98
ld [$ffd7], a
xor a
ld [hBGMapAddress], a
ld [hJoyDown], a
ld [hSCX], a
ld [hSCY], a
ld a, $90
ld [hWY], a
call WaitBGMap
jp Function620b
; 6454
Function6454:: ; 6454
call DelayFrame
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
ld a, [hBGMapMode]
push af
xor a
ld [hBGMapMode], a
call Function6473
pop af
ld [hBGMapMode], a
pop af
ld [hOAMUpdate], a
ld hl, VramState
set 6, [hl]
ret
; 6473
Function6473: ; 6473
xor a
ld [hLCDStatCustom], a
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
call Function2173
ld a, $9c
call Function64b9
call Function2e20
callba Function49409
callba Function96a4
ld a, $1
ld [hCGBPalUpdate], a
xor a
ld [hBGMapMode], a
ld [hWY], a
callba Function64db
ld a, $98
call Function64b9
xor a
ld [$d152], a
ld a, $98
ld [$d153], a
xor a
ld [hSCX], a
ld [hSCY], a
call Function5958
ret
; 64b9
Function64b9: ; 64b9
ld [$ffd7], a
xor a
ld [hBGMapAddress], a
ret
; 64bf
Function64bf:: ; 64bf
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
call Function64cd
pop af
ld [hOAMUpdate], a
ret
; 64cd
Function64cd: ; 64cd
call Functione5f
ld a, $90
ld [hWY], a
call Function2e31
call Functione51
ret
; 64db
Function64db: ; 64db
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
ld a, $60
ld hl, $d000
ld bc, $400
call ByteFill
ld a, $d0
ld [rHDMA1], a
ld a, $0
ld [rHDMA2], a
ld a, $18
ld [rHDMA3], a
ld a, $0
ld [rHDMA4], a
ld a, $3f
ld [hDMATransfer], a
call DelayFrame
pop af
ld [rSVBK], a
ret
; 6508
LearnMove: ; 6508
call Function309d
ld a, [CurPartyMon]
ld hl, PartyMonNicknames
call GetNick
ld hl, StringBuffer1
ld de, $d050
ld bc, PKMN_NAME_LENGTH
call CopyBytes
.loop
ld hl, PartyMon1Moves
ld bc, PartyMon2 - PartyMon1
ld a, [CurPartyMon]
call AddNTimes
ld d, h
ld e, l
ld b, NUM_MOVES
.next
ld a, [hl]
and a
jr z, .learn
inc hl
dec b
jr nz, .next
push de
call Function65d3
pop de
jp c, .cancel
push hl
push de
ld [$d265], a
ld b, a
ld a, [IsInBattle]
and a
jr z, .not_disabled
ld a, [DisabledMove]
cp b
jr nz, .not_disabled
xor a
ld [DisabledMove], a
ld [PlayerDisableCount], a
.not_disabled
call GetMoveName
ld hl, UnknownText_0x6684
call PrintText
pop de
pop hl
.learn
ld a, [$d262]
ld [hl], a
ld bc, PartyMon1PP - PartyMon1Moves
add hl, bc
push hl
push de
dec a
ld hl, Moves + MOVE_PP
ld bc, MOVE_LENGTH
call AddNTimes
ld a, BANK(Moves)
call GetFarByte
pop de
pop hl
ld [hl], a
ld a, [IsInBattle]
and a
jp z, .learned
ld a, [CurPartyMon]
ld b, a
ld a, [CurBattleMon]
cp b
jp nz, .learned
ld a, [PlayerSubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jp nz, .learned
ld h, d
ld l, e
ld de, BattleMonMoves
ld bc, NUM_MOVES
call CopyBytes
ld bc, PartyMon1PP - (PartyMon1Moves + NUM_MOVES)
add hl, bc
ld de, BattleMonPP
ld bc, NUM_MOVES
call CopyBytes
jp .learned
.cancel
ld hl, UnknownText_0x6675
call PrintText
call YesNoBox
jp c, .loop
ld hl, UnknownText_0x667a
call PrintText
ld b, 0
ret
.learned
ld hl, UnknownText_0x666b
call PrintText
ld b, 1
ret
; 65d3
Function65d3: ; 65d3
push hl
ld hl, UnknownText_0x667f
call PrintText
call YesNoBox
pop hl
ret c
ld bc, -NUM_MOVES
add hl, bc
push hl
ld de, $d25e
ld bc, NUM_MOVES
call CopyBytes
pop hl
.asm_65ee
push hl
ld hl, UnknownText_0x6670
call PrintText
hlcoord 5, 2
ld b, NUM_MOVES * 2
ld c, MOVE_NAME_LENGTH
call TextBox
hlcoord 5 + 2, 2 + 2
ld a, SCREEN_WIDTH * 2
ld [Buffer1], a
predef ListMoves
ld a, $4
ld [$cfa1], a
ld a, $6
ld [$cfa2], a
ld a, [$d0eb]
inc a
ld [$cfa3], a
ld a, $1
ld [$cfa4], a
ld [$cfa9], a
ld [$cfaa], a
ld a, $3
ld [$cfa8], a
ld a, $20
ld [$cfa5], a
xor a
ld [$cfa6], a
ld a, $20
ld [$cfa7], a
call Function1bc9
push af
call Function30b4
pop af
pop hl
bit 1, a
jr nz, .asm_6669
push hl
ld a, [$cfa9]
dec a
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
push af
push bc
call IsHMMove
pop bc
pop de
ld a, d
jr c, .asm_6660
pop hl
add hl, bc
and a
ret
.asm_6660
ld hl, UnknownText_0x669a
call PrintText
pop hl
jr .asm_65ee
.asm_6669
scf
ret
; 666b
UnknownText_0x666b: ; 666b
text_jump UnknownText_0x1c5660
db "@"
; 6670
UnknownText_0x6670: ; 6670
text_jump UnknownText_0x1c5678
db "@"
; 6675
UnknownText_0x6675: ; 6675
text_jump UnknownText_0x1c5699
db "@"
; 667a
UnknownText_0x667a: ; 667a
text_jump UnknownText_0x1c56af
db "@"
; 667f
UnknownText_0x667f: ; 667f
text_jump UnknownText_0x1c56c9
db "@"
; 6684
UnknownText_0x6684: ; 6684
text_jump UnknownText_0x1c5740
start_asm
push de
ld de, SFX_SWITCH_POKEMON
call PlaySFX
pop de
ld hl, UnknownText_0x6695
ret
; 6695
UnknownText_0x6695: ; 6695
text_jump UnknownText_0x1c574e
db "@"
; 669a
UnknownText_0x669a: ; 669a
text_jump UnknownText_0x1c5772
db "@"
; 669f
CheckNickErrors:: ; 669f
; error-check monster nick before use
; must be a peace offering to gamesharkers
; input: de = nick location
push bc
push de
ld b, PKMN_NAME_LENGTH
.checkchar
; end of nick?
ld a, [de]
cp "@" ; terminator
jr z, .end
; check if this char is a text command
ld hl, .textcommands
dec hl
.loop
; next entry
inc hl
; reached end of commands table?
ld a, [hl]
cp a, $ff
jr z, .done
; is the current char between this value (inclusive)...
ld a, [de]
cp [hl]
inc hl
jr c, .loop
; ...and this one?
cp [hl]
jr nc, .loop
; replace it with a "?"
ld a, "?"
ld [de], a
jr .loop
.done
; next char
inc de
; reached end of nick without finding a terminator?
dec b
jr nz, .checkchar
; change nick to "?@"
pop de
push de
ld a, "?"
ld [de], a
inc de
ld a, "@"
ld [de], a
.end
; if the nick has any errors at this point it's out of our hands
pop de
pop bc
ret
; 66cf
.textcommands ; 66cf
; table definining which characters
; are actually text commands
; format:
; >= <
db $00, $05
db $14, $19
db $1d, $26
db $35, $3a
db $3f, $40
db $49, $5d
db $5e, $7f
db $ff ; end
; 66de
_Multiply:: ; 66de
; hMultiplier is one byte.
ld a, 8
ld b, a
xor a
ld [hMultiplicand - 1], a
ld [hMathBuffer + 1], a
ld [hMathBuffer + 2], a
ld [hMathBuffer + 3], a
ld [hMathBuffer + 4], a
.loop
ld a, [hMultiplier]
srl a
ld [hMultiplier], a
jr nc, .next
ld a, [hMathBuffer + 4]
ld c, a
ld a, [hMultiplicand + 2]
add c
ld [hMathBuffer + 4], a
ld a, [hMathBuffer + 3]
ld c, a
ld a, [hMultiplicand + 1]
adc c
ld [hMathBuffer + 3], a
ld a, [hMathBuffer + 2]
ld c, a
ld a, [hMultiplicand + 0]
adc c
ld [hMathBuffer + 2], a
ld a, [hMathBuffer + 1]
ld c, a
ld a, [hMultiplicand - 1]
adc c
ld [hMathBuffer + 1], a
.next
dec b
jr z, .done
; hMultiplicand <<= 1
ld a, [hMultiplicand + 2]
add a
ld [hMultiplicand + 2], a
ld a, [hMultiplicand + 1]
rla
ld [hMultiplicand + 1], a
ld a, [hMultiplicand + 0]
rla
ld [hMultiplicand + 0], a
ld a, [hMultiplicand - 1]
rla
ld [hMultiplicand - 1], a
jr .loop
.done
ld a, [hMathBuffer + 4]
ld [hProduct + 3], a
ld a, [hMathBuffer + 3]
ld [hProduct + 2], a
ld a, [hMathBuffer + 2]
ld [hProduct + 1], a
ld a, [hMathBuffer + 1]
ld [hProduct + 0], a
ret
; 673e
_Divide:: ; 673e
xor a
ld [hMathBuffer + 0], a
ld [hMathBuffer + 1], a
ld [hMathBuffer + 2], a
ld [hMathBuffer + 3], a
ld [hMathBuffer + 4], a
ld a, 9
ld e, a
.loop
ld a, [hMathBuffer + 0]
ld c, a
ld a, [hDividend + 1]
sub c
ld d, a
ld a, [hDivisor]
ld c, a
ld a, [hDividend + 0]
sbc c
jr c, .asm_6767
ld [hDividend + 0], a
ld a, d
ld [hDividend + 1], a
ld a, [hMathBuffer + 4]
inc a
ld [hMathBuffer + 4], a
jr .loop
.asm_6767
ld a, b
cp 1
jr z, .done
ld a, [hMathBuffer + 4]
add a
ld [hMathBuffer + 4], a
ld a, [hMathBuffer + 3]
rla
ld [hMathBuffer + 3], a
ld a, [hMathBuffer + 2]
rla
ld [hMathBuffer + 2], a
ld a, [hMathBuffer + 1]
rla
ld [hMathBuffer + 1], a
dec e
jr nz, .asm_6798
ld e, 8
ld a, [hMathBuffer + 0]
ld [hDivisor], a
xor a
ld [hMathBuffer + 0], a
ld a, [hDividend + 1]
ld [hDividend + 0], a
ld a, [hDividend + 2]
ld [hDividend + 1], a
ld a, [hDividend + 3]
ld [hDividend + 2], a
.asm_6798
ld a, e
cp 1
jr nz, .asm_679e
dec b
.asm_679e
ld a, [hDivisor]
srl a
ld [hDivisor], a
ld a, [hMathBuffer + 0]
rr a
ld [hMathBuffer + 0], a
jr .loop
.done
ld a, [hDividend + 1]
ld [hDivisor], a
ld a, [hMathBuffer + 4]
ld [hDividend + 3], a
ld a, [hMathBuffer + 3]
ld [hDividend + 2], a
ld a, [hMathBuffer + 2]
ld [hDividend + 1], a
ld a, [hMathBuffer + 1]
ld [hDividend + 0], a
ret
; 67c1
ItemAttributes: ; 67c1
INCLUDE "items/item_attributes.asm"
; 6ec1
Function6ec1: ; 6ec1
ld hl, $0006
add hl, bc
bit 5, [hl]
jr z, .asm_6ed9
ld hl, $0004
add hl, bc
bit 4, [hl]
push hl
push bc
call Function6f2c
pop bc
pop hl
ret c
jr .asm_6ee9
.asm_6ed9
ld hl, $0004
add hl, bc
bit 4, [hl]
jr nz, .asm_6ee9
push hl
push bc
call Function6f07
pop bc
pop hl
ret c
.asm_6ee9
bit 6, [hl]
jr nz, .asm_6ef5
push hl
push bc
call Function7009
pop bc
pop hl
ret c
.asm_6ef5
bit 5, [hl]
jr nz, .asm_6f05
push hl
call Function70a4
pop hl
ret c
push hl
call Function70ed
pop hl
ret c
.asm_6f05
and a
ret
; 6f07
Function6f07: ; 6f07
call Function6f5f
ret c
ld hl, $0010
add hl, bc
ld d, [hl]
ld hl, $0011
add hl, bc
ld e, [hl]
ld hl, $0006
add hl, bc
bit 7, [hl]
jp nz, Function6fa1
ld hl, $000e
add hl, bc
ld a, [hl]
ld d, a
call GetTileCollision
and a
jr z, Function6f3e
scf
ret
; 6f2c
Function6f2c: ; 6f2c
call Function6f5f
ret c
ld hl, $000e
add hl, bc
ld a, [hl]
call GetTileCollision
cp $1
jr z, Function6f3e
scf
ret
; 6f3e
Function6f3e: ; 6f3e
ld hl, $000e
add hl, bc
ld a, [hl]
call Function6f7f
ret nc
push af
ld hl, $0007
add hl, bc
ld a, [hl]
and 3
ld e, a
ld d, 0
ld hl, .data_6f5b
add hl, de
pop af
and [hl]
ret z
scf
ret
; 6f5b
.data_6f5b
db 1, 2, 8, 4
; 6f5f
Function6f5f: ; 6f5f
ld hl, $000f
add hl, bc
ld a, [hl]
call Function6f7f
ret nc
push af
ld hl, $0007
add hl, bc
and 3
ld e, a
ld d, 0
ld hl, .data_6f7b
add hl, de
pop af
and [hl]
ret z
scf
ret
; 6f7b
.data_6f7b
db 2, 1, 4, 8
; 6f7f
Function6f7f: ; 6f7f
ld d, a
and $f0
cp $b0
jr z, .asm_6f8c
cp $c0
jr z, .asm_6f8c
xor a
ret
.asm_6f8c
ld a, d
and 7
ld e, a
ld d, 0
ld hl, .data_6f99
add hl, de
ld a, [hl]
scf
ret
; 6f99
.data_6f99
db 8, 4, 1, 2
db 10, 6, 9, 5
; 6fa1
Function6fa1: ; 6fa1
ld hl, $0007
add hl, bc
ld a, [hl]
and 3
jr z, .asm_6fb2
dec a
jr z, .asm_6fb7
dec a
jr z, .asm_6fbb
jr .asm_6fbf
.asm_6fb2
inc e
push de
inc d
jr .asm_6fc2
.asm_6fb7
push de
inc d
jr .asm_6fc2
.asm_6fbb
push de
inc e
jr .asm_6fc2
.asm_6fbf
inc d
push de
inc e
.asm_6fc2
call Function2a3c
call GetTileCollision
pop de
and a
jr nz, .asm_6fd7
call Function2a3c
call GetTileCollision
and a
jr nz, .asm_6fd7
xor a
ret
.asm_6fd7
scf
ret
; 6fd9
CheckFacingObject:: ; 6fd9
call GetFacingTileCoord
; Double the distance for counter tiles.
call CheckCounterTile
jr nz, .asm_6ff1
ld a, [MapX]
sub d
cpl
inc a
add d
ld d, a
ld a, [MapY]
sub e
cpl
inc a
add e
ld e, a
.asm_6ff1
ld bc, ObjectStructs ; redundant
ld a, 0
ld [$ffaf], a
call Function7041
ret nc
ld hl, $0007
add hl, bc
ld a, [hl]
cp $ff
jr z, .asm_7007
xor a
ret
.asm_7007
scf
ret
; 7009
Function7009: ; 7009
ld hl, $0010
add hl, bc
ld d, [hl]
ld hl, $0011
add hl, bc
ld e, [hl]
jr Function7041
; 7015
Function7015: ; 7015
ld a, [$ffaf]
call Function1ae5
call Function7021
call Function7041
ret
Function7021: ; 7021
ld hl, $0010
add hl, bc
ld d, [hl]
ld hl, $0011
add hl, bc
ld e, [hl]
call GetSpriteDirection
and a
jr z, .asm_703b
cp $4
jr z, .asm_703d
cp $8
jr z, .asm_703f
inc d
ret
.asm_703b
inc e
ret
.asm_703d
dec e
ret
.asm_703f
dec d
ret
; 7041
Function7041: ; 7041
ld bc, ObjectStructs
xor a
.asm_7045
ld [$ffb0], a
call Function1af1
jr z, .asm_7093
ld hl, $0004
add hl, bc
bit 7, [hl]
jr nz, .asm_7093
ld hl, $0006
add hl, bc
bit 7, [hl]
jr z, .asm_7063
call Function7171
jr nc, .asm_707b
jr .asm_7073
.asm_7063
ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
cp d
jr nz, .asm_707b
ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
cp e
jr nz, .asm_707b
.asm_7073
ld a, [$ffaf]
ld l, a
ld a, [$ffb0]
cp l
jr nz, .asm_70a2
.asm_707b
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
cp d
jr nz, .asm_7093
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld a, [hl]
cp e
jr nz, .asm_7093
ld a, [$ffaf]
ld l, a
ld a, [$ffb0]
cp l
jr nz, .asm_70a2
.asm_7093
ld hl, ObjectStruct2 - ObjectStruct1
add hl, bc
ld b, h
ld c, l
ld a, [$ffb0]
inc a
cp $d
jr nz, .asm_7045
and a
ret
.asm_70a2
scf
ret
; 70a4
Function70a4: ; 70a4
ld hl, $0016
add hl, bc
ld a, [hl]
and a
jr z, .asm_70e9
and $f
jr z, .asm_70c7
ld e, a
ld d, a
ld hl, $0014
add hl, bc
ld a, [hl]
sub d
ld d, a
ld a, [hl]
add e
ld e, a
ld hl, $0010
add hl, bc
ld a, [hl]
cp d
jr z, .asm_70eb
cp e
jr z, .asm_70eb
.asm_70c7
ld hl, $0016
add hl, bc
ld a, [hl]
swap a
and $f
jr z, .asm_70e9
ld e, a
ld d, a
ld hl, $0015
add hl, bc
ld a, [hl]
sub d
ld d, a
ld a, [hl]
add e
ld e, a
ld hl, $0011
add hl, bc
ld a, [hl]
cp d
jr z, .asm_70eb
cp e
jr z, .asm_70eb
.asm_70e9
xor a
ret
.asm_70eb
scf
ret
; 70ed
Function70ed: ; 70ed
ld hl, $0010
add hl, bc
ld a, [XCoord]
cp [hl]
jr z, .asm_70fe
jr nc, .asm_7111
add $9
cp [hl]
jr c, .asm_7111
.asm_70fe
ld hl, $0011
add hl, bc
ld a, [YCoord]
cp [hl]
jr z, .asm_710f
jr nc, .asm_7111
add $8
cp [hl]
jr c, .asm_7111
.asm_710f
and a
ret
.asm_7111
scf
ret
; 7113
Function7113: ; 7113
ld a, [MapX]
ld d, a
ld a, [MapY]
ld e, a
ld bc, ObjectStructs
xor a
.asm_711f
ld [$ffb0], a
call Function1af1
jr z, .asm_7160
ld hl, $0003
add hl, bc
ld a, [hl]
cp $15
jr nz, .asm_7136
call Function7171
jr c, .asm_716f
jr .asm_7160
.asm_7136
ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
cp e
jr nz, .asm_714e
ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
cp d
jr nz, .asm_714e
ld a, [$ffb0]
cp $0
jr z, .asm_7160
jr .asm_716f
.asm_714e
ld hl, OBJECT_NEXT_MAP_Y
add hl, bc
ld a, [hl]
cp e
jr nz, .asm_7160
ld hl, OBJECT_NEXT_MAP_X
add hl, bc
ld a, [hl]
cp d
jr nz, .asm_7160
jr .asm_716f
.asm_7160
ld hl, ObjectStruct2 - ObjectStruct1
add hl, bc
ld b, h
ld c, l
ld a, [$ffb0]
inc a
cp $d
jr nz, .asm_711f
xor a
ret
.asm_716f
scf
ret
; 7171
Function7171: ; 7171
ld hl, $0010
add hl, bc
ld a, d
sub [hl]
jr c, .asm_718b
cp $2
jr nc, .asm_718b
ld hl, $0011
add hl, bc
ld a, e
sub [hl]
jr c, .asm_718b
cp $2
jr nc, .asm_718b
scf
ret
.asm_718b
and a
ret
; 718d
Function718d: ; 718d
ld hl, PartyMon1Happiness
ld bc, PartyMon2 - PartyMon1
ld de, PartySpecies
.asm_7196
ld a, [de]
cp EGG
jr nz, .asm_719f
inc de
add hl, bc
jr .asm_7196
.asm_719f
ld [$d265], a
ld a, [hl]
ld [ScriptVar], a
call GetPokemonName
jp Function746e
; 71ac
Function71ac: ; 71ac
ld a, [PartySpecies]
ld [$d265], a
cp EGG
ld a, $1
jr z, .asm_71b9
xor a
.asm_71b9
ld [ScriptVar], a
call GetPokemonName
jp Function746e
; 71c2
ChangeHappiness: ; 71c2
; Perform happiness action c on CurPartyMon
ld a, [CurPartyMon]
inc a
ld e, a
ld d, 0
ld hl, PartySpecies - 1
add hl, de
ld a, [hl]
cp EGG
ret z
push bc
ld hl, PartyMon1Happiness
ld bc, PartyMon2 - PartyMon1
ld a, [CurPartyMon]
call AddNTimes
pop bc
ld d, h
ld e, l
push de
ld a, [de]
cp 100
ld e, 0
jr c, .asm_71ef
inc e
cp 200
jr c, .asm_71ef
inc e
.asm_71ef
dec c
ld b, 0
ld hl, .Actions
add hl, bc
add hl, bc
add hl, bc
ld d, 0
add hl, de
ld a, [hl]
cp 100
pop de
ld a, [de]
jr nc, .negative
add [hl]
jr nc, .asm_720d
ld a, $ff
jr .asm_720d
.negative
add [hl]
jr c, .asm_720d
xor a
.asm_720d
ld [de], a
ld a, [IsInBattle]
and a
ret z
ld a, [CurPartyMon]
ld b, a
ld a, [$d0d8]
cp b
ret nz
ld a, [de]
ld [BattleMonHappiness], a
ret
; 7221
.Actions
db +5, +3, +2
db +5, +3, +2
db +1, +1, +0
db +3, +2, +1 ; Battled a Gym Leader
db +1, +1, +0 ; Learned a move
db -1, -1, -1
db -5, -5, -10
db -5, -5, -10
db +1, +1, +1
db +3, +3, +1
db +5, +5, +2
db +1, +1, +1
db +3, +3, +1
db +10, +10, +4
db -5, -5, -10
db -10, -10, -15
db -15, -15, -20
db +3, +3, +1
db +10, +6, +4
; 725a
StepHappiness:: ; 725a
; Raise the party's happiness by 1 point every other step cycle.
ld hl, $dc77
ld a, [hl]
inc a
and 1
ld [hl], a
ret nz
ld de, PartyCount
ld a, [de]
and a
ret z
ld c, a
ld hl, PartyMon1Happiness
.loop
inc de
ld a, [de]
cp EGG
jr z, .next
inc [hl]
jr nz, .next
ld [hl], $ff
.next
push de
ld de, PartyMon2 - PartyMon1
add hl, de
pop de
dec c
jr nz, .loop
ret
; 7282
DaycareStep:: ; 7282
ld a, [wDaycareMan]
bit 0, a
jr z, .asm_72a4
ld a, [$df2b] ; level
cp 100
jr nc, .asm_72a4
ld hl, $df16 ; exp
inc [hl]
jr nz, .asm_72a4
dec hl
inc [hl]
jr nz, .asm_72a4
dec hl
inc [hl]
ld a, [hl]
cp $50
jr c, .asm_72a4
ld a, $50
ld [hl], a
.asm_72a4
ld a, [wDaycareLady]
bit 0, a
jr z, .asm_72c6
ld a, [$df64] ; level
cp 100
jr nc, .asm_72c6
ld hl, $df4f ; exp
inc [hl]
jr nz, .asm_72c6
dec hl
inc [hl]
jr nz, .asm_72c6
dec hl
inc [hl]
ld a, [hl]
cp $50
jr c, .asm_72c6
ld a, $50
ld [hl], a
.asm_72c6
ld hl, wDaycareMan
bit 5, [hl] ; egg
ret z
ld hl, wStepsToEgg
dec [hl]
ret nz
call Random
ld [hl], a
callab Function16e1d
ld a, [$d265]
cp $e6
ld b, $50
jr nc, .asm_72f8
ld a, [$d265]
cp $aa
ld b, $28
jr nc, .asm_72f8
ld a, [$d265]
cp $6e
ld b, $1e
jr nc, .asm_72f8
ld b, $a
.asm_72f8
call Random
cp b
ret nc
ld hl, wDaycareMan
res 5, [hl]
set 6, [hl]
ret
; 7305
SpecialGiveShuckle: ; 7305
; Adding to the party.
xor a
ld [MonType], a
; Level 15 Shuckle.
ld a, SHUCKLE
ld [CurPartySpecies], a
ld a, 15
ld [CurPartyLevel], a
predef Functiond88c
jr nc, .NotGiven
; Caught data.
ld b, 0
callba Function4dba3
; Holding a Berry.
ld bc, PartyMon2 - PartyMon1
ld a, [PartyCount]
dec a
push af
push bc
ld hl, PartyMon1Item
call AddNTimes
ld [hl], BERRY
pop bc
pop af
; OT ID.
ld hl, PartyMon1ID
call AddNTimes
ld a, $2
ld [hli], a
ld [hl], $6
; Nickname.
ld a, [PartyCount]
dec a
ld hl, PartyMonNicknames
call SkipNames
ld de, SpecialShuckleNick
call CopyName2
; OT.
ld a, [PartyCount]
dec a
ld hl, PartyMonOT
call SkipNames
ld de, SpecialShuckleOT
call CopyName2
; Engine flag for this event.
ld hl, $dc1e
set 5, [hl]
ld a, 1
ld [ScriptVar], a
ret
.NotGiven
xor a
ld [ScriptVar], a
ret
SpecialShuckleOT:
db "MANIA@"
SpecialShuckleNick:
db "SHUCKIE@"
; 737e
SpecialReturnShuckle: ; 737e
callba Function50000
jr c, .asm_73e6
ld a, [CurPartySpecies]
cp SHUCKLE
jr nz, .DontReturn
ld a, [CurPartyMon]
ld hl, PartyMon1ID
ld bc, PartyMon2 - PartyMon1
call AddNTimes
; OT ID
ld a, [hli]
cp $2
jr nz, .DontReturn
ld a, [hl]
cp $6
jr nz, .DontReturn
; OT
ld a, [CurPartyMon]
ld hl, PartyMonOT
call SkipNames
ld de, SpecialShuckleOT
.CheckOT
ld a, [de]
cp [hl]
jr nz, .DontReturn
cp "@"
jr z, .asm_73bb
inc de
inc hl
jr .CheckOT
.asm_73bb
callba Functione538
jr c, .asm_73f1
ld a, [CurPartyMon]
ld hl, PartyMon1Happiness
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld a, [hl]
cp 150
ld a, $3
jr nc, .asm_73e2
xor a
ld [$d10b], a
callab Functione039
ld a, $2
.asm_73e2
ld [ScriptVar], a
ret
.asm_73e6
ld a, $1
ld [ScriptVar], a
ret
.DontReturn
xor a
ld [ScriptVar], a
ret
.asm_73f1
ld a, $4
ld [ScriptVar], a
ret
; 73f7
Function73f7: ; 73f7
callba Function50000
jr c, .asm_740e
ld a, [CurPartySpecies]
ld [ScriptVar], a
ld [$d265], a
call GetPokemonName
jp Function746e
.asm_740e
xor a
ld [ScriptVar], a
ret
; 7413
Function7413: ; 7413
ld hl, Data7459
jr Function7420
Function7418: ; 7418
ld hl, Data7462
jr Function7420
Function741d: ; 741d
ld hl, Data746b
Function7420: ; 7420
push hl
callba Function50000
pop hl
jr c, .asm_744e
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_7453
push hl
call GetCurNick
call Function746e
pop hl
call Random
.next
sub [hl]
jr c, .asm_7444
inc hl
inc hl
inc hl
jr .next
.asm_7444
inc hl
ld a, [hli]
ld [ScriptVar], a
ld c, [hl]
call ChangeHappiness
ret
.asm_744e
xor a
ld [ScriptVar], a
ret
.asm_7453
ld a, $1
ld [ScriptVar], a
ret
; 7459
Data7459: ; 7459
db $4c, $02, $09
db $80, $03, $0a
db $ff, $04, $0b
Data7462: ; 7462
db $9a, $02, $0c
db $4c, $03, $0d
db $ff, $04, $0e
Data746b: ; 746b
db $ff, $02, $12
; 746e
Function746e: ; 746e
ld hl, StringBuffer1
ld de, StringBuffer3
ld bc, $000b
jp CopyBytes
; 747a
Predef1: ; 747a
; not used
ret
; 747b
SECTION "bank2", ROMX, BANK[$2]
Function8000: ; 8000
call Function2ed3
xor a
ld [hBGMapMode], a
call WhiteBGMap
call ClearSprites
ld hl, TileMap
ld bc, TileMapEnd - TileMap
ld a, " "
call ByteFill
ld hl, AttrMap
ld bc, AttrMapEnd - AttrMap
ld a, $7
call ByteFill
call Function3200
call Function32f9
ret
; 8029
Function8029: ; 8029
ld a, $ff
ld [$d4cd], a
ld [$d4ce], a
ld a, $0
ld hl, PlayerObjectTemplate
call Function19a6
ld b, $0
call Function808f
ld a, $0
call GetMapObject
ld hl, $0008
add hl, bc
ld e, $80
ld a, [$d45b]
bit 2, a
jr nz, .asm_8059
ld a, [PlayerGender]
bit 0, a
jr z, .asm_8059
ld e, $90
.asm_8059
ld [hl], e
ld a, $0
ld [$ffaf], a
ld bc, MapObjects
ld a, $0
ld [$ffb0], a
ld de, ObjectStructs
call Function8116
ld a, $0
ld [$d4cf], a
ret
; 8071
PlayerObjectTemplate: ; 8071
; A dummy map object used to initialize the player object.
; Shorter than the actual amount copied by two bytes.
; Said bytes seem to be unused.
db $01, $00, $00, $0b, $ff, $ff, $ff, $00, $00, $00, $00, $ff, $ff
; 807e
Function807e:: ; 807e
push de
ld a, b
call GetMapObject
pop de
ld hl, $0003
add hl, bc
ld [hl], d
ld hl, $0002
add hl, bc
ld [hl], e
ret
; 808f
Function808f: ; 808f
push bc
ld a, [XCoord]
add $4
ld d, a
ld a, [YCoord]
add $4
ld e, a
pop bc
call Function807e
ret
; 80a1
Function80a1:: ; 80a1
ld a, b
call Function18de
ret c
ld hl, $0010
add hl, bc
ld d, [hl]
ld hl, $0011
add hl, bc
ld e, [hl]
ld a, [$ffaf]
ld b, a
call Function807e
and a
ret
; 80b8
Function80b8: ; 80b8
ld a, [XCoord]
add $4
ld d, a
ld hl, MapX
sub [hl]
ld [hl], d
ld hl, $d721
ld [hl], d
ld hl, MapX2
ld [hl], d
ld d, a
ld a, [YCoord]
add $4
ld e, a
ld hl, MapY
sub [hl]
ld [hl], e
ld hl, $d720
ld [hl], e
ld hl, MapY2
ld [hl], e
ld e, a
ld a, [$d4cd]
cp $0
ret nz
ret
; 80e7
Function80e7:: ; 80e7
call Function2707
and a
ret nz
ld hl, ObjectStructs + (ObjectStruct2 - ObjectStruct1) * 1
ld a, 1
ld de, ObjectStruct2 - ObjectStruct1
.asm_80f4
ld [$ffb0], a
ld a, [hl]
and a
jr z, .asm_8104
add hl, de
ld a, [$ffb0]
inc a
cp $d
jr nz, .asm_80f4
scf
ret
.asm_8104
ld d, h
ld e, l
call Function8116
ld hl, VramState
bit 7, [hl]
ret z
ld hl, $0005
add hl, de
set 5, [hl]
ret
; 8116
Function8116: ; 8116
call Function811d
call Function8286
ret
; 811d
Function811d: ; 811d
ld a, [$ffb0]
ld hl, $0000
add hl, bc
ld [hl], a
ld a, [$ffaf]
ld [$c2f0], a
ld hl, $0001
add hl, bc
ld a, [hl]
ld [$c2f1], a
call Function180e
ld [$c2f2], a
ld a, [hl]
call GetSpritePalette
ld [$c2f3], a
ld hl, $0008
add hl, bc
ld a, [hl]
and $f0
jr z, .asm_814e
swap a
and $7
ld [$c2f3], a
.asm_814e
ld hl, $0004
add hl, bc
ld a, [hl]
ld [$c2f4], a
ld hl, $0009
add hl, bc
ld a, [hl]
ld [$c2f5], a
ld hl, $0003
add hl, bc
ld a, [hl]
ld [$c2f6], a
ld hl, $0002
add hl, bc
ld a, [hl]
ld [$c2f7], a
ld hl, $0005
add hl, bc
ld a, [hl]
ld [$c2f8], a
ret
; 8177
Function8177: ; 8177
ld bc, $d72e
ld a, $1
.asm_817c
ld [$ffaf], a
ld hl, $0001
add hl, bc
ld a, [hl]
and a
jr z, .asm_81bb
ld hl, $0000
add hl, bc
ld a, [hl]
cp $ff
jr nz, .asm_81bb
ld a, [XCoord]
ld d, a
ld a, [YCoord]
ld e, a
ld hl, $0003
add hl, bc
ld a, [hl]
add $1
sub d
jr c, .asm_81bb
cp $c
jr nc, .asm_81bb
ld hl, $0002
add hl, bc
ld a, [hl]
add $1
sub e
jr c, .asm_81bb
cp $b
jr nc, .asm_81bb
push bc
call Function80e7
pop bc
jp c, Function81c9
.asm_81bb
ld hl, $0010
add hl, bc
ld b, h
ld c, l
ld a, [$ffaf]
inc a
cp $10
jr nz, .asm_817c
ret
; 81c9
Function81c9: ; 81c9
ret
; 81ca
Function81ca:: ; 81ca
nop
ld a, [$d151]
cp $ff
ret z
ld hl, Table81d6
rst JumpTable
ret
; 81d6
Table81d6: ; 81d6
dw Function81e5
dw Function81de
dw Function8232
dw Function8239
; 81de
Function81de: ; 81de
ld a, [YCoord]
sub $1
jr Function81ea
Function81e5: ; 81e5
ld a, [YCoord]
add $9
Function81ea: ; 81ea
ld d, a
ld a, [XCoord]
ld e, a
ld bc, $d72e
ld a, $1
.asm_81f4
ld [$ffaf], a
ld hl, $0001
add hl, bc
ld a, [hl]
and a
jr z, .asm_8224
ld hl, $0002
add hl, bc
ld a, d
cp [hl]
jr nz, .asm_8224
ld hl, $0000
add hl, bc
ld a, [hl]
cp $ff
jr nz, .asm_8224
ld hl, $0003
add hl, bc
ld a, [hl]
add $1
sub e
jr c, .asm_8224
cp $c
jr nc, .asm_8224
push de
push bc
call Function80e7
pop bc
pop de
.asm_8224
ld hl, $0010
add hl, bc
ld b, h
ld c, l
ld a, [$ffaf]
inc a
cp $10
jr nz, .asm_81f4
ret
; 8232
Function8232: ; 8232
ld a, [XCoord]
sub $1
jr Function823e
Function8239: ; 8239
ld a, [XCoord]
add $a
Function823e: ; 823e
ld e, a
ld a, [YCoord]
ld d, a
ld bc, $d72e
ld a, $1
.asm_8248
ld [$ffaf], a
ld hl, $0001
add hl, bc
ld a, [hl]
and a
jr z, .asm_8278
ld hl, $0003
add hl, bc
ld a, e
cp [hl]
jr nz, .asm_8278
ld hl, $0000
add hl, bc
ld a, [hl]
cp $ff
jr nz, .asm_8278
ld hl, $0002
add hl, bc
ld a, [hl]
add $1
sub d
jr c, .asm_8278
cp $b
jr nc, .asm_8278
push de
push bc
call Function80e7
pop bc
pop de
.asm_8278
ld hl, $0010
add hl, bc
ld b, h
ld c, l
ld a, [$ffaf]
inc a
cp $10
jr nz, .asm_8248
ret
; 8286
Function8286: ; 8286
ld a, [$c2f0]
ld hl, $0001
add hl, de
ld [hl], a
ld a, [$c2f4]
call Function1a61
ld a, [$c2f3]
ld hl, $0006
add hl, de
or [hl]
ld [hl], a
ld a, [$c2f7]
call Function82d5
ld a, [$c2f6]
call Function82f1
ld a, [$c2f1]
ld hl, $0000
add hl, de
ld [hl], a
ld a, [$c2f2]
ld hl, $0002
add hl, de
ld [hl], a
ld hl, $0009
add hl, de
ld [hl], $0
ld hl, $000d
add hl, de
ld [hl], $ff
ld a, [$c2f8]
call Function830d
ld a, [$c2f5]
ld hl, $0020
add hl, de
ld [hl], a
and a
ret
; 82d5
Function82d5: ; 82d5
ld hl, $0015
add hl, de
ld [hl], a
ld hl, $0011
add hl, de
ld [hl], a
ld hl, YCoord
sub [hl]
and $f
swap a
ld hl, $d14d
sub [hl]
ld hl, $0018
add hl, de
ld [hl], a
ret
; 82f1
Function82f1: ; 82f1
ld hl, $0014
add hl, de
ld [hl], a
ld hl, $0010
add hl, de
ld [hl], a
ld hl, XCoord
sub [hl]
and $f
swap a
ld hl, $d14c
sub [hl]
ld hl, $0017
add hl, de
ld [hl], a
ret
; 830d
Function830d: ; 830d
ld h, a
inc a
and $f
ld l, a
ld a, h
add $10
and $f0
or l
ld hl, $0016
add hl, de
ld [hl], a
ret
; 831e
Function831e: ; 831e
ld a, [$ffe0]
call Function1b1e
ld a, $3e
call Function1b3f
ld a, [$d03f]
dec a
jr z, Function833b
ld a, [$ffe0]
ld b, a
ld c, $0
ld d, $1
call Function8341
call Function1b35
Function833b
ld a, $47
call Function1b3f
ret
; 8341
Function8341: ; 8341
push de
push bc
ld a, c
call GetMapObject
ld hl, $0000
add hl, bc
ld a, [hl]
call Function1ae5
ld d, b
ld e, c
pop bc
ld a, b
call GetMapObject
ld hl, $0000
add hl, bc
ld a, [hl]
call Function1ae5
ld hl, $0010
add hl, bc
ld a, [hl]
ld hl, $0011
add hl, bc
ld c, [hl]
ld b, a
ld hl, $0010
add hl, de
ld a, [hl]
ld hl, $0011
add hl, de
ld e, [hl]
ld d, a
pop af
call Function1b5f
ret
; 8379
Function8379: ; 8379
call Function1b1e
call Function8388
call Function1b3f
ld a, $47
call Function1b3f
ret
; 8388
Function8388: ; 8388
ld a, [PlayerDirection]
srl a
srl a
and 3
ld e, a
ld d, 0
ld hl, .data_839a
add hl, de
ld a, [hl]
ret
; 839a
.data_839a
db 8, 9, 10, 11
; 839e
Function839e:: ; 839e
push bc
ld a, c
call Function18de
ld d, b
ld e, c
pop bc
ret c
ld a, b
call Function18de
ret c
ld hl, $0010
add hl, bc
ld a, [hl]
ld hl, $0011
add hl, bc
ld c, [hl]
ld b, a
ld hl, $0010
add hl, de
ld a, [hl]
cp b
jr z, .asm_83c7
jr c, .asm_83c4
inc b
jr .asm_83d5
.asm_83c4
dec b
jr .asm_83d5
.asm_83c7
ld hl, $0011
add hl, de
ld a, [hl]
cp c
jr z, .asm_83d5
jr c, .asm_83d4
inc c
jr .asm_83d5
.asm_83d4
dec c
.asm_83d5
ld hl, $0010
add hl, de
ld [hl], b
ld a, b
ld hl, XCoord
sub [hl]
and $f
swap a
ld hl, $d14c
sub [hl]
ld hl, $0017
add hl, de
ld [hl], a
ld hl, $0011
add hl, de
ld [hl], c
ld a, c
ld hl, YCoord
sub [hl]
and $f
swap a
ld hl, $d14d
sub [hl]
ld hl, $0018
add hl, de
ld [hl], a
ld a, [$ffb0]
ld hl, $0020
add hl, de
ld [hl], a
ld hl, $0003
add hl, de
ld [hl], $1a
ld hl, $0009
add hl, de
ld [hl], $0
ret
; 8417
Function8417:: ; 8417
ld a, d
call GetMapObject
ld hl, $0000
add hl, bc
ld a, [hl]
cp $d
jr nc, .asm_8437
ld d, a
ld a, e
call GetMapObject
ld hl, $0000
add hl, bc
ld a, [hl]
cp $d
jr nc, .asm_8437
ld e, a
call Function8439
ret
.asm_8437
scf
ret
; 8439
Function8439: ; 8439
ld a, d
call Function1ae5
ld hl, $0010
add hl, bc
ld a, [hl]
ld hl, $0011
add hl, bc
ld c, [hl]
ld b, a
push bc
ld a, e
call Function1ae5
ld hl, $0010
add hl, bc
ld d, [hl]
ld hl, $0011
add hl, bc
ld e, [hl]
pop bc
ld a, b
sub d
jr z, .asm_846c
jr nc, .asm_8460
cpl
inc a
.asm_8460
ld h, a
ld a, c
sub e
jr z, .asm_847a
jr nc, .asm_8469
cpl
inc a
.asm_8469
sub h
jr c, .asm_847a
.asm_846c
ld a, c
cp e
jr z, .asm_8488
jr c, .asm_8476
ld d, $0
and a
ret
.asm_8476
ld d, $1
and a
ret
.asm_847a
ld a, b
cp d
jr z, .asm_8488
jr c, .asm_8484
ld d, $3
and a
ret
.asm_8484
ld d, $2
and a
ret
.asm_8488
scf
ret
; 848a
Function848a: ; 848a
call Function849d
jr c, .asm_8497
ld [$d4d1], a
xor a
ld [$d4d0], a
ret
.asm_8497
ld a, $ff
ld [$d4d0], a
ret
; 849d
Function849d: ; 849d
ld a, [$d4cd]
call Function1ae5
ld hl, $0010
add hl, bc
ld d, [hl]
ld hl, $0011
add hl, bc
ld e, [hl]
ld a, [$d4ce]
call Function1ae5
ld hl, $0010
add hl, bc
ld a, d
cp [hl]
jr z, .asm_84c5
jr c, .asm_84c1
and a
ld a, $f
ret
.asm_84c1
and a
ld a, $e
ret
.asm_84c5
ld hl, $0011
add hl, bc
ld a, e
cp [hl]
jr z, .asm_84d7
jr c, .asm_84d3
and a
ld a, $c
ret
.asm_84d3
and a
ld a, $d
ret
.asm_84d7
scf
ret
; 84d9
_Sine:: ; 84d9
; A simple sine function.
; Return d * sin(e) in hl.
; e is a signed 6-bit value.
ld a, e
and %111111
cp %100000
jr nc, .negative
call Function84ef
ld a, h
ret
.negative
and %011111
call Function84ef
ld a, h
xor $ff
inc a
ret
; 84ef
Function84ef: ; 84ef
ld e, a
ld a, d
ld d, 0
ld hl, SineWave
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, 0
; Factor amplitude
.multiply
srl a
jr nc, .even
add hl, de
.even
sla e
rl d
and a
jr nz, .multiply
ret
; 850b
SineWave: ; 850b
; A $20-word table representing a sine wave.
; 90 degrees is index $10 at a base amplitude of $100.
sine_wave $100
; 854b
GetPredefPointer:: ; 854b
; Return the bank and address of PredefID in a and PredefAddress.
; Save hl for later (back in Predef)
ld a, h
ld [PredefTemp], a
ld a, l
ld [PredefTemp + 1], a
push de
ld a, [PredefID]
ld e, a
ld d, 0
ld hl, PredefPointers
add hl, de
add hl, de
add hl, de
pop de
ld a, [hli]
ld [PredefAddress + 1], a
ld a, [hli]
ld [PredefAddress], a
ld a, [hl]
ret
; 856b
PredefPointers:: ; 856b
; $4b Predef pointers
; address, bank
add_predef LearnMove ; $0
add_predef Predef1
add_predef Functionc658
add_predef FlagPredef
add_predef Functionc699
add_predef FillPP
add_predef Functiond88c
add_predef Functionda96
add_predef Functiondb3f ; $8
add_predef Functionde6e
add_predef GiveEgg
add_predef Functionc6e0
add_predef Functione167
add_predef Functione17b
add_predef CanLearnTMHMMove
add_predef GetTMHMMove
add_predef Function28eef ; $ 10
add_predef PrintMoveDesc
add_predef UpdatePlayerHUD
add_predef FillBox
add_predef Function3d873
add_predef UpdateEnemyHUD
add_predef StartBattle
add_predef FillInExpBar
add_predef Function3f43d ; $18
add_predef Function3f47c
add_predef LearnLevelMoves
add_predef FillMoves
add_predef Function421e6
add_predef Function28f63
add_predef Function28f24
add_predef Function5084a
add_predef ListMoves ; $20
add_predef Function50d2e
add_predef Function50cdb
add_predef Function50c50
add_predef GetGender
add_predef StatsScreenInit
add_predef DrawPlayerHP
add_predef DrawEnemyHP
add_predef Function50b7b ; $28
add_predef GetTypeName
add_predef PrintMoveType
add_predef PrintType
add_predef PrintMonTypes
add_predef GetUnownLetter
add_predef Functioncbcdd
add_predef Predef2F
add_predef Function9853 ; $30
add_predef Function864c
add_predef Function91d11
add_predef CheckContestMon
add_predef Function8c20f
add_predef Function8c000
add_predef Function8c000_2
add_predef PlayBattleAnim
add_predef Predef38 ; $38
add_predef Predef39
add_predef Functionfd1d0
add_predef PartyMonItemName
add_predef GetFrontpic
add_predef GetBackpic
add_predef Function5108b
add_predef GetTrainerPic
add_predef DecompressPredef ; $40
add_predef Function347d3
add_predef Functionfb908
add_predef Functionfb877
add_predef Functiond0000
add_predef Function50d0a
add_predef Functiond00a3
add_predef Functiond008e
add_predef Functiond0669 ; $48
add_predef Functiond066e
dbw $ff, Function2d43 ; ????
; 864c
INCLUDE "engine/color.asm"
SECTION "bank3", ROMX, BANK[$3]
Functionc000:: ; c000
ld a, [TimeOfDay]
ld hl, Datac012
ld de, 2
call IsInArray
inc hl
ld c, [hl]
ret c
xor a
ld c, a
ret
; c012
Datac012: ; c012
db MORN, 1
db DAY, 2
db NITE, 4
db NITE, 4
db $ff
; c01b
Special:: ; c01b
; Run script special de.
ld hl, SpecialsPointers
add hl, de
add hl, de
add hl, de
ld b, [hl]
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
ld a, b
rst FarCall
ret
; c029
SpecialsPointers: ; c029
dbw BANK(Function97c28), Function97c28
dbw BANK(Function29ce8), Function29ce8
dbw BANK(Function29d11), Function29d11
dbw BANK(Function29d92), Function29d92
dbw BANK(Function29e66), Function29e66
dbw BANK(Function29e82), Function29e82
dbw BANK(Function29efa), Function29efa
dbw BANK(Function29eee), Function29eee
dbw BANK(Function29c92), Function29c92
dbw BANK(Function29cf1), Function29cf1
dbw BANK(Function29cfa), Function29cfa
dbw BANK(Function29bfb), Function29bfb
dbw BANK(Function29c7b), Function29c7b
dbw BANK(Function29ec4), Function29ec4
dbw BANK(Function29ed9), Function29ed9
dbw BANK(Function29eaf), Function29eaf
dbw BANK(Function29f47), Function29f47
dbw BANK(Functionc2f6), Functionc2f6
dbw BANK(Functionc309), Functionc309
dbw BANK(Function1050b9), Function1050b9
dbw BANK(Functionc34a), Functionc34a
dbw BANK(Function4d9e5), Function4d9e5
dbw BANK(Function13a12), Function13a12
dbw BANK(Function13a31), Function13a31
dbw BANK(Function135db), Function135db
dbw BANK(Functionfbb32), Functionfbb32
dbw BANK(Functionfbcd2), Functionfbcd2
dbw BANK(Functionc658), Functionc658
dbw BANK(Function1559a), Function1559a
dbw BANK(Functionc2e7), Functionc2e7
dbw BANK(Function166d6), Function166d6
dbw BANK(Function1672a), Function1672a
dbw BANK(Function16936), Function16936
dbw BANK(Function2c547), Function2c547
dbw BANK(Function16218), Function16218
dbw BANK(Function8cc04), Function8cc04
dbw BANK(SpecialNameRival), SpecialNameRival
dbw BANK(Function90913), Function90913
dbw BANK(Functionc2c0), Functionc2c0
dbw BANK(Functionc2cd), Functionc2cd
dbw BANK(Functionc355), Functionc355
dbw BANK(Functionc360), Functionc360
dbw BANK(Functionc373), Functionc373
dbw BANK(Functionc380), Functionc380
dbw BANK(Functionc38d), Functionc38d
dbw BANK(Functionc3db), Functionc3db
dbw BANK(Function8c084), Function8c084
dbw BANK(Function8c092), Function8c092
dbw BANK(Function8c0b6), Function8c0b6
dbw BANK(Function8c079), Function8c079
dbw BANK(Function8c0ab), Function8c0ab
dbw BANK(Functiond91), Functiond91
dbw BANK(WhiteBGMap), WhiteBGMap
dbw BANK(UpdateTimePals), UpdateTimePals
dbw BANK(ClearTileMap), ClearTileMap
dbw BANK(Function1ad2), Function1ad2
dbw BANK(Functione4a), Functione4a
dbw BANK(Functionc230), Functionc230
dbw BANK(SpecialSeenMon), SpecialSeenMon
dbw BANK(WaitSFX),WaitSFX
dbw BANK(PlayMapMusic), PlayMapMusic
dbw BANK(RestartMapMusic), RestartMapMusic
dbw BANK(Function12324), Function12324
dbw BANK(Function8379), Function8379
dbw BANK(Functionc25a), Functionc25a
dbw BANK(Functionc268), Functionc268
dbw BANK(Functionc276), Functionc276
dbw BANK(Functionc284), Functionc284
dbw BANK(Functionc3ef), Functionc3ef
dbw BANK(Function17421), Function17421
dbw BANK(Function17440), Function17440
dbw BANK(Function139a8), Function139a8
dbw BANK(Functionc3fc), Functionc3fc
dbw BANK(Function26feb), Function26feb
dbw BANK(Function27043), Function27043
dbw BANK(SpecialGiveShuckle), SpecialGiveShuckle
dbw BANK(SpecialReturnShuckle), SpecialReturnShuckle
dbw BANK(Function73f7), Function73f7
dbw BANK(SpecialCheckPokerus),SpecialCheckPokerus
dbw BANK(Function24b25), Function24b25
dbw BANK(Function24b4e), Function24b4e
dbw BANK(Function24ae8), Function24ae8
dbw BANK(Function4d87a), Function4d87a
dbw BANK(Functionc434), Functionc434
dbw BANK(Functionc422), Functionc422
dbw BANK(Function4d9d3), Function4d9d3
dbw BANK(Function88018), Function88018
dbw BANK(SpecialNameRater), SpecialNameRater
dbw BANK(Functionc2da), Functionc2da
dbw BANK(Function718d), Function718d
dbw BANK(Function71ac), Function71ac
dbw BANK(Function2a4ab), Function2a4ab
dbw BANK(Function2a51f), Function2a51f
dbw BANK(Function2a567), Function2a567
dbw BANK(Function14209), Function14209
dbw BANK(Functionfb841), Functionfb841
dbw BANK(SpecialSnorlaxAwake),SpecialSnorlaxAwake
dbw BANK(Function7413), Function7413
dbw BANK(Function7418), Function7418
dbw BANK(Function741d), Function741d
dbw BANK(Functionc472), Functionc472
dbw BANK(ProfOaksPCBoot), ProfOaksPCBoot
dbw BANK(SpecialGameboyCheck),SpecialGameboyCheck
dbw BANK(SpecialTrainerHouse),SpecialTrainerHouse
dbw BANK(Function16dc7), Function16dc7
dbw BANK(InitRoamMons), InitRoamMons
dbw BANK(Functionc48f), Functionc48f
dbw BANK(Functionc49f), Functionc49f
dbw BANK(Functionc4ac), Functionc4ac
dbw BANK(Function11ac3e), Function11ac3e
dbw BANK(Function11b444), Function11b444
dbw BANK(Function11b5e8), Function11b5e8
dbw BANK(Function11b7e5), Function11b7e5
dbw BANK(Function11b879), Function11b879
dbw BANK(Function11b920), Function11b920
dbw BANK(Function11b93b), Function11b93b
dbw BANK(Function1700b0), Function1700b0
dbw BANK(Function1700ba), Function1700ba
dbw BANK(Function170114), Function170114
dbw BANK(Function170215), Function170215
dbw BANK(Function1704e1), Function1704e1
dbw BANK(Function17021d), Function17021d
dbw BANK(Function170b44), Function170b44
dbw BANK(Function11ba38), Function11ba38
dbw BANK(Function170bd3), Function170bd3
dbw BANK(Function117656), Function117656
dbw BANK(Reset), Reset
dbw BANK(Function1011f1), Function1011f1
dbw BANK(Function101220), Function101220
dbw BANK(Function101225), Function101225
dbw BANK(Function101231), Function101231
dbw BANK(Function4925b), Function4925b
dbw BANK(Function8adef), Function8adef
dbw BANK(Function11c1ab), Function11c1ab
dbw BANK(Function170687), Function170687
dbw BANK(Function8ae68), Function8ae68
dbw BANK(Function17d224), Function17d224
dbw BANK(Function17d2b6), Function17d2b6
dbw BANK(Function17d2ce), Function17d2ce
dbw BANK(Function17f53d), Function17f53d
dbw BANK(Function103612), Function103612
dbw BANK(SpecialHoOhChamber),SpecialHoOhChamber
dbw BANK(Function102142), Function102142
dbw BANK(Function4989a), Function4989a
dbw BANK(Function49bf9), Function49bf9
dbw BANK(SpecialPokeSeer), SpecialPokeSeer
dbw BANK(SpecialBuenasPassword), SpecialBuenasPassword
dbw BANK(SpecialBuenaPrize), SpecialBuenaPrize
dbw BANK(SpecialDratini),SpecialDratini
dbw BANK(Function11485), Function11485
dbw BANK(SpecialBeastsCheck),SpecialBeastsCheck
dbw BANK(SpecialMonCheck),SpecialMonCheck
dbw BANK(Functionc225), Functionc225
dbw BANK(Function170bd2), Function170bd2
dbw BANK(Function10366e), Function10366e
dbw BANK(Function1037eb), Function1037eb
dbw BANK(Function10383c), Function10383c
dbw BANK(Function1060a2), Function1060a2
dbw BANK(Function14168), Function14168
dbw BANK(Function1037c2), Function1037c2
dbw BANK(Function10630f), Function10630f
dbw BANK(Function103780), Function103780
dbw BANK(Function10387b), Function10387b
dbw BANK(Function4ae12), Function4ae12
dbw BANK(Function1047eb), Function1047eb
dbw BANK(Function4a927), Function4a927
dbw BANK(Function90a54), Function90a54
dbw BANK(Function90a88), Function90a88
dbw BANK(SpecialNone), SpecialNone
; c224
SpecialNone: ; c224
ret
; c225
Functionc225: ; c225
ld a, [ScriptVar]
ld d, a
callba Function57e2
ret
; c230
Functionc230: ; c230
ld a, [ScriptVar]
dec a
call CheckCaughtMon
ret nz
ld a, [ScriptVar]
dec a
call SetSeenAndCaughtMon
call FadeToMenu
ld a, [ScriptVar]
ld [$d265], a
callba Functionfb877
call Function2b4d
ret
; c252
SpecialSeenMon: ; c252
ld a, [ScriptVar]
dec a
call SetSeenMon
ret
; c25a
Functionc25a: ; c25a
ld a, [ScriptVar]
ld b, a
callba Function4dbd2
jr z, Functionc298
jr Functionc292
Functionc268: ; c268
ld a, [ScriptVar]
ld b, a
callba Function4dbd9
jr z, Functionc298
jr Functionc292
Functionc276: ; c276
ld a, [ScriptVar]
ld b, a
callba Function4dbe0
jr z, Functionc298
jr Functionc292
Functionc284: ; c284
ld a, [ScriptVar]
ld b, a
callba Function4dbe6
jr z, Functionc298
jr Functionc292
Functionc292: ; c292
ld a, $1
ld [ScriptVar], a
ret
Functionc298: ; c298
xor a
ld [ScriptVar], a
ret
; c29d
SpecialNameRival: ; 0xc29d
ld b, $2 ; rival
ld de, RivalName
callba Function116b7
; default to "SILVER"
ld hl, RivalName
ld de, DefaultRivalName
call InitName
ret
; 0xc2b2
DefaultRivalName: ; 0xc2b2
db "SILVER@"
SpecialNameRater: ; c2b9
callba NameRater
ret
; c2c0
Functionc2c0: ; c2c0
call FadeToMenu
callba Function9191c
call Function2b4d
ret
; c2cd
Functionc2cd: ; c2cd
call FadeToMenu
callba Function16be4
call Function2b4d
ret
; c2da
Functionc2da: ; c2da
call FadeToMenu
callba Function3f836
call Function2b4d
ret
; c2e7
Functionc2e7: ; c2e7
xor a
ld [ScriptVar], a
callba Function156d9
ld a, c
ld [ScriptVar], a
ret
; c2f6
Functionc2f6: ; c2f6
ld a, $0
call GetSRAMBank
ld a, [$abe2]
and a
jr z, .asm_c302
inc a
.asm_c302
ld [ScriptVar], a
call CloseSRAM
ret
; c309
Functionc309: ; c309
ld a, $0
call GetSRAMBank
ld a, [$abe2]
ld [CurItem], a
ld a, $1
ld [$d10c], a
ld hl, NumItems
call ReceiveItem
jr nc, .asm_c33d
xor a
ld [$abe2], a
call CloseSRAM
ld a, [CurItem]
ld [$d265], a
call GetItemName
ld hl, UnknownText_0xc345
call PrintText
ld a, $1
ld [ScriptVar], a
ret
.asm_c33d
call CloseSRAM
xor a
ld [ScriptVar], a
ret
; c345
UnknownText_0xc345: ; 0xc345
; received item
text_jump UnknownText_0x1bd3be
db "@"
; 0xc34a
Functionc34a: ; c34a
callba Function1369d
ld a, b
ld [ScriptVar], a
ret
; c355
Functionc355: ; c355
ld a, [ScriptVar]
ld e, a
callba Function91a53
ret
; c360
Functionc360: ; c360
call FadeToMenu
callba Functione1190
ld a, [$d0ec]
ld [ScriptVar], a
call Function2b4d
ret
; c373
Functionc373: ; c373
call Functionc3ae
ret c
ld a, BANK(Function926c7)
ld hl, Function926c7
call Functionc39a
ret
; c380
Functionc380: ; c380
call Functionc3ae
ret c
ld a, BANK(Functione00ee)
ld hl, Functione00ee
call Functionc39a
ret
; c38d
Functionc38d: ; c38d
call Functionc3ae
ret c
ld a, BANK(Functione1e5b)
ld hl, Functione1e5b
call Functionc39a
ret
; c39a
Functionc39a: ; c39a
call Function31cf
call FadeToMenu
ld hl, $d0e8
ld a, [hli]
push af
ld a, [hli]
ld h, [hl]
ld l, a
pop af
rst FarCall
call Function2b4d
ret
; c3ae
Functionc3ae: ; c3ae
ld hl, Coins
ld a, [hli]
or [hl]
jr z, .asm_c3c4
ld a, COIN_CASE
ld [CurItem], a
ld hl, NumItems
call CheckItem
jr nc, .asm_c3c9
and a
ret
.asm_c3c4
ld hl, UnknownText_0xc3d1
jr .asm_c3cc
.asm_c3c9
ld hl, UnknownText_0xc3d6
.asm_c3cc
call PrintText
scf
ret
; c3d1
UnknownText_0xc3d1: ; 0xc3d1
; You have no coins.
text_jump UnknownText_0x1bd3d7
db "@"
; 0xc3d6
UnknownText_0xc3d6: ; 0xc3d6
; You don't have a COIN CASE.
text_jump UnknownText_0x1bd3eb
db "@"
; 0xc3db
Functionc3db: ; c3db
call WhiteBGMap
call Function2879
ret
; c3e2
ScriptReturnCarry: ; c3e2
jr c, .carry
xor a
ld [ScriptVar], a
ret
.carry
ld a, 1
ld [ScriptVar], a
ret
; c3ef
Functionc3ef: ; c3ef
callba Function1150c
ld a, [$dc3a]
ld [ScriptVar], a
ret
; c3fc
Functionc3fc: ; c3fc
ld a, [ScriptVar]
ld [$dfce], a
ret
; c403
Functionc403:: ; c403
ld a, c
and a
jr nz, .asm_c410
ld a, d
ld [$dfcc], a
ld a, e
ld [$dfcd], a
ret
.asm_c410
ld a, d
ld [$dc5a], a
ld a, e
ld [$dc5b], a
ret
; c419
SpecialCheckPokerus: ; c419
; Check if a monster in your party has Pokerus
callba CheckPokerus
jp ScriptReturnCarry
; c422
Functionc422: ; c422
callba Function1152b
ld hl, $dc9d
res 0, [hl]
callba Function5d33
ret
; c434
Functionc434: ; c434
callba Function11542
jp ScriptReturnCarry
; c43d
SpecialSnorlaxAwake: ; 0xc43d
; Check if the Poké Flute channel is playing, and if the player is standing
; next to Snorlax.
; outputs:
; ScriptVar is 1 if the conditions are met, otherwise 0.
; check background music
ld a, [wMapMusic]
cp MUSIC_POKE_FLUTE_CHANNEL
jr nz, .nope
ld a, [XCoord]
ld b, a
ld a, [YCoord]
ld c, a
ld hl, .ProximityCoords
.loop
ld a, [hli]
cp $ff
jr z, .nope
cp b
jr nz, .nextcoord
ld a, [hli]
cp c
jr nz, .loop
ld a, $1
jr .done
.nextcoord
inc hl
jr .loop
.nope
xor a
.done
ld [ScriptVar], a
ret
.ProximityCoords
; x, y
db 33, 8 ; left
db 34, 10 ; below
db 35, 10 ; below
db 36, 8 ; right
db 36, 9 ; right
db $ff
Functionc472: ; c472
ld a, [CurPartySpecies]
jp PlayCry
; c478
SpecialGameboyCheck: ; c478
ld a, [hCGB]
and a
jr nz, .cgb
ld a, [hSGB]
and a
jr nz, .sgb
.gb
xor a
jr .done
.sgb
ld a, 1
jr .done
.cgb
ld a, 2
.done
ld [ScriptVar], a
ret
Functionc48f: ; c48f
ld a, MUSIC_NONE % $100
ld [MusicFadeIDLo], a
ld a, MUSIC_NONE / $100
ld [MusicFadeIDHi], a
ld a, $2
ld [MusicFade], a
ret
; c49f
Functionc49f: ; c49f
call FadeToMenu
callba Function1dd702
call Function2b4d
ret
; c4ac
Functionc4ac: ; c4ac
call FadeToMenu
callba Function84688
call Function2b4d
ret
; c4b9
SpecialTrainerHouse: ; 0xc4b9
ld a, 0
call GetSRAMBank
ld a, [$abfd] ; XXX what is this memory location?
ld [ScriptVar], a
jp CloseSRAM
_PrintNum:: ; c4c7
; Print c digits of the b-byte value at hl.
; Allows 2 to 7 digits. For 1-digit numbers, add
; the value to char "0" instead of calling PrintNum.
; Some extra flags can be given in bits 5-7 of b.
push bc
bit 5, b
jr z, .main
bit 7, b
jr nz, .bit_7
bit 6, b
jr z, .main
.bit_7
ld a, $f0
ld [hli], a
res 5, b
.main
xor a
ld [$ffb3], a
ld [$ffb4], a
ld [$ffb5], a
ld a, b
and $f
cp 1
jr z, .byte
cp 2
jr z, .word
.long
ld a, [de]
ld [$ffb4], a
inc de
ld a, [de]
ld [$ffb5], a
inc de
ld a, [de]
ld [$ffb6], a
jr .start
.word
ld a, [de]
ld [$ffb5], a
inc de
ld a, [de]
ld [$ffb6], a
jr .start
.byte
ld a, [de]
ld [$ffb6], a
.start
push de
ld d, b
ld a, c
swap a
and $f
ld e, a
ld a, c
and $f
ld b, a
ld c, 0
cp 2
jr z, .two
cp 3
jr z, .three
cp 4
jr z, .four
cp 5
jr z, .five
cp 6
jr z, .six
.seven
ld a, 1000000 / $10000 % $100
ld [$ffb7], a
ld a, 1000000 / $100 % $100
ld [$ffb8], a
ld a, 1000000 % $100
ld [$ffb9], a
call .PrintDigit
call .AdvancePointer
.six
ld a, 100000 / $10000 % $100
ld [$ffb7], a
ld a, 100000 / $100 % $100
ld [$ffb8], a
ld a, 100000 % $100
ld [$ffb9], a
call .PrintDigit
call .AdvancePointer
.five
xor a
ld [$ffb7], a
ld a, 10000 / $100
ld [$ffb8], a
ld a, 10000 % $100
ld [$ffb9], a
call .PrintDigit
call .AdvancePointer
.four
xor a
ld [$ffb7], a
ld a, 1000 / $100
ld [$ffb8], a
ld a, 1000 % $100
ld [$ffb9], a
call .PrintDigit
call .AdvancePointer
.three
xor a
ld [$ffb7], a
xor a
ld [$ffb8], a
ld a, 100
ld [$ffb9], a
call .PrintDigit
call .AdvancePointer
.two
dec e
jr nz, .asm_c583
ld a, "0"
ld [$ffb3], a
.asm_c583
ld c, 0
ld a, [$ffb6]
.mod_10
cp 10
jr c, .modded_10
sub 10
inc c
jr .mod_10
.modded_10
ld b, a
ld a, [$ffb3]
or c
jr nz, .asm_c59b
call .PrintLeadingZero
jr .asm_c5ad
.asm_c59b
call .PrintYen
push af
ld a, "0"
add c
ld [hl], a
pop af
ld [$ffb3], a
inc e
dec e
jr nz, .asm_c5ad
inc hl
ld [hl], $f2 ; XXX
.asm_c5ad
call .AdvancePointer
call .PrintYen
ld a, "0"
add b
ld [hli], a
pop de
pop bc
ret
; c5ba
.PrintYen: ; c5ba
push af
ld a, [$ffb3]
and a
jr nz, .asm_c5c9
bit 5, d
jr z, .asm_c5c9
ld a, "¥"
ld [hli], a
res 5, d
.asm_c5c9
pop af
ret
; c5cb
.PrintDigit: ; c5cb (3:45cb)
dec e
jr nz, .ok
ld a, "0"
ld [$ffb3], a
.ok
ld c, 0
.asm_c5d4
ld a, [$ffb7]
ld b, a
ld a, [$ffb4]
ld [$ffba], a
cp b
jr c, .asm_c624
sub b
ld [$ffb4], a
ld a, [$ffb8]
ld b, a
ld a, [$ffb5]
ld [$ffbb], a
cp b
jr nc, .asm_c5f6
ld a, [$ffb4]
or 0
jr z, .asm_c620
dec a
ld [$ffb4], a
ld a, [$ffb5]
.asm_c5f6
sub b
ld [$ffb5], a
ld a, [$ffb9]
ld b, a
ld a, [$ffb6]
ld [$ffbc], a
cp b
jr nc, .asm_c616
ld a, [$ffb5]
and a
jr nz, .asm_c611
ld a, [$ffb4]
and a
jr z, .asm_c61c
dec a
ld [$ffb4], a
xor a
.asm_c611
dec a
ld [$ffb5], a
ld a, [$ffb6]
.asm_c616
sub b
ld [$ffb6], a
inc c
jr .asm_c5d4
.asm_c61c
ld a, [$ffbb]
ld [$ffb5], a
.asm_c620
ld a, [$ffba]
ld [$ffb4], a
.asm_c624
ld a, [$ffb3]
or c
jr z, .PrintLeadingZero
ld a, [$ffb3]
and a
jr nz, .asm_c637
bit 5, d
jr z, .asm_c637
ld a, $f0
ld [hli], a
res 5, d
.asm_c637
ld a, "0"
add c
ld [hl], a
ld [$ffb3], a
inc e
dec e
ret nz
inc hl
ld [hl], $f2
ret
.PrintLeadingZero: ; c644
; prints a leading zero unless they are turned off in the flags
bit 7, d ; print leading zeroes?
ret z
ld [hl], "0"
ret
.AdvancePointer: ; c64a
; increments the pointer unless leading zeroes are not being printed,
; the number is left-aligned, and no nonzero digits have been printed yet
bit 7, d ; print leading zeroes?
jr nz, .inc
bit 6, d ; left alignment or right alignment?
jr z, .inc
ld a, [$ffb3]
and a
ret z
.inc
inc hl
ret
; c658
Functionc658: ; c658
xor a
ld [CurPartyMon], a
ld hl, PartySpecies
.loop
ld a, [hli]
cp $ff
jr z, .done
cp EGG
jr z, .next
push hl
call Functionc677
pop hl
.next
ld a, [CurPartyMon]
inc a
ld [CurPartyMon], a
jr .loop
.done
ret
; c677
Functionc677: ; c677
ld a, PartyMon1Species - PartyMon1
call GetPartyParamLocation
ld d, h
ld e, l
ld hl, PartyMon1Status - PartyMon1Species
add hl, de
xor a
ld [hli], a
ld [hl], a
ld hl, PartyMon1MaxHP - PartyMon1Species
add hl, de
; bc = PartyMon1HP - PartyMon1Species
ld b, h
ld c, l
dec bc
dec bc
ld a, [hli]
ld [bc], a
inc bc
ld a, [hl]
ld [bc], a
callba Functionf8b9
ret
; c699
Functionc699: ; c699
ld a, b
or c
jr z, .asm_c6dd
push hl
xor a
ld [hMultiplicand], a
ld a, b
ld [$ffb5], a
ld a, c
ld [$ffb6], a
ld a, $30
ld [hMultiplier], a
call Multiply
ld a, d
and a
jr z, .asm_c6cc
srl d
rr e
srl d
rr e
ld a, [$ffb5]
ld b, a
ld a, [$ffb6]
srl b
rr a
srl b
rr a
ld [$ffb6], a
ld a, b
ld [$ffb5], a
.asm_c6cc
ld a, e
ld [hMultiplier], a
ld b, $4
call Divide
ld a, [$ffb6]
ld e, a
pop hl
and a
ret nz
ld e, $1
ret
.asm_c6dd
ld e, $0
ret
; c6e0
Functionc6e0: ; c6e0
call WaitBGMap
call Functiond627
call WaitBGMap
ret
; c6ea
Functionc6ea: ; c6ea
xor a
ld hl, Buffer1
ld bc, $0007
call ByteFill
ret
; c6f5
Functionc6f5: ; c6f5
ld a, [Buffer1]
rst JumpTable
ld [Buffer1], a
bit 7, a
jr nz, .asm_c702
and a
ret
.asm_c702
and $7f
scf
ret
; c706
GetPartyNick: ; c706
; write CurPartyMon nickname to StringBuffer1-3
ld hl, PartyMonNicknames
ld a, BOXMON
ld [MonType], a
ld a, [CurPartyMon]
call GetNick
call CopyName1
; copy text from StringBuffer2 to StringBuffer3
ld de, StringBuffer2
ld hl, StringBuffer3
call CopyName2
ret
; c721
CheckEngineFlag: ; c721
; Check engine flag de
; Return carry if flag is not set
ld b, CHECK_FLAG
callba EngineFlagAction
ld a, c
and a
jr nz, .isset
scf
ret
.isset
xor a
ret
; c731
CheckBadge: ; c731
; Check engine flag a (ENGINE_ZEPHYRBADGE thru ENGINE_EARTHBADGE)
; Display "Badge required" text and return carry if the badge is not owned
call CheckEngineFlag
ret nc
ld hl, BadgeRequiredText
call Function1d67 ; push text to queue
scf
ret
; c73d
BadgeRequiredText: ; c73d
; Sorry! A new BADGE
; is required.
TX_FAR _BadgeRequiredText
db "@"
; c742
CheckPartyMove: ; c742
; Check if a monster in your party has move d.
ld e, 0
xor a
ld [CurPartyMon], a
.loop
ld c, e
ld b, 0
ld hl, PartySpecies
add hl, bc
ld a, [hl]
and a
jr z, .no
cp a, $ff
jr z, .no
cp a, EGG
jr z, .next
ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1Moves
ld a, e
call AddNTimes
ld b, NUM_MOVES
.check
ld a, [hli]
cp d
jr z, .yes
dec b
jr nz, .check
.next
inc e
jr .loop
.yes
ld a, e
ld [CurPartyMon], a ; which mon has the move
xor a
ret
.no
scf
ret
; c779
Functionc779: ; c779
ld hl, UnknownText_0xc780
call Function1d67
ret
; c780
UnknownText_0xc780: ; 0xc780
text_jump UnknownText_0x1c05c8
db "@"
; 0xc785
Functionc785: ; c785
call Functionc6ea
.loop
ld hl, Jumptable_c796
call Functionc6f5
jr nc, .loop
and $7f
ld [$d0ec], a
ret
; c796
Jumptable_c796: ; c796 (3:4796)
dw Functionc79c
dw Functionc7b2
dw Functionc7bb
Functionc79c: ; c79c (3:479c)
ld de, ENGINE_HIVEBADGE
call CheckBadge
jr c, .asm_c7ac
call Functionc7ce
jr c, .asm_c7af
ld a, $1
ret
.asm_c7ac
ld a, $80
ret
.asm_c7af
ld a, $2
ret
Functionc7b2: ; c7b2 (3:47b2)
ld hl, UnknownScript_0xc7fe
call Function31cd
ld a, $81
ret
Functionc7bb: ; c7bb (3:47bb)
ld hl, UnknownText_0xc7c9
call Function1d67
ld a, $80
ret
UnknownText_0xc7c4: ; 0xc7c4
; used CUT!
text_jump UnknownText_0x1c05dd
db "@"
; 0xc7c9
UnknownText_0xc7c9: ; 0xc7c9
; There's nothing to CUT here.
text_jump UnknownText_0x1c05ec
db "@"
; 0xc7ce
Functionc7ce: ; c7ce
call GetFacingTileCoord
ld c, a
push de
callba Function149f5
pop de
jr nc, .asm_c7fc
call Function2a66
ld c, [hl]
push hl
ld hl, Unknown_c862
call Functionc840
pop hl
jr nc, .asm_c7fc
ld a, l
ld [$d1ec], a
ld a, h
ld [$d1ed], a
ld a, b
ld [$d1ee], a
ld a, c
ld [$d1ef], a
xor a
ret
.asm_c7fc
scf
ret
; c7fe
UnknownScript_0xc7fe: ; c7fe
reloadmappart
special $0035
UnknownScript_0xc802: ; 0xc802
3callasm GetPartyNick
2writetext UnknownText_0xc7c4
reloadmappart
3callasm Functionc810
loadmovesprites
end
; 0xc810
Functionc810: ; c810
ld hl, $d1ec
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$d1ee]
ld [hl], a
xor a
ld [hBGMapMode], a
call Function2173
call Function1ad2
call DelayFrame
ld a, [$d1ef]
ld e, a
callba Function8c940
call Function2879
call Function2914
call Function1ad2
call DelayFrame
call Functione51
ret
; c840
Functionc840: ; c840
push bc
ld a, [$d199]
ld de, 3
call IsInArray
pop bc
jr nc, .asm_c860
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
ld de, 3
ld a, c
call IsInArray
jr nc, .asm_c860
inc hl
ld b, [hl]
inc hl
ld c, [hl]
scf
ret
.asm_c860
xor a
ret
; c862
Unknown_c862: ; c862
dbw $01, Unknown_c872
dbw $02, Unknown_c882
dbw $03, Unknown_c886
dbw $19, Unknown_c899
dbw $1f, Unknown_c8a0
db -1
; c872
Unknown_c872: ; c872
db $03, $02, $01
db $5b, $3c, $00
db $5f, $3d, $00
db $63, $3f, $00
db $67, $3e, $00
db -1
; c882
Unknown_c882: ; c882
db $03, $02, $01
db -1
; c886
Unknown_c886: ; c886
db $0b, $0a, $01
db $32, $6d, $00
db $33, $6c, $00
db $34, $6f, $00
db $35, $4c, $00
db $60, $6e, $00
db -1
; c899
Unknown_c899: ; c899
db $13, $03, $01
db $03, $04, $01
db -1
; c8a0
Unknown_c8a0: ; c8a0
db $0f, $17, $00
db -1
; c8a4
Unknown_c8a4: ; c8a4
dbw $01, Unknown_c8a8
db -1
; c8a8
Unknown_c8a8: ; c8a8
db $07, $36, $00
db -1
; c8ac
Functionc8ac: ; c8ac
call Functionc8b5
and $7f
ld [$d0ec], a
ret
; c8b5
Functionc8b5: ; c8b5
; Flash
ld de, ENGINE_ZEPHYRBADGE
callba CheckBadge
jr c, .asm_c8dd
push hl
callba Function8ae30
pop hl
jr c, .asm_c8d1
ld a, [$d847]
cp $ff
jr nz, .asm_c8d7
.asm_c8d1
call Functionc8e0
ld a, $81
ret
.asm_c8d7
call Functionc779
ld a, $80
ret
.asm_c8dd
ld a, $80
ret
; c8e0
Functionc8e0: ; c8e0
ld hl, UnknownScript_0xc8e6
jp Function31cd
; c8e6
UnknownScript_0xc8e6: ; 0xc8e6
reloadmappart
special $0035
2writetext UnknownText_0xc8f3
3callasm Function8c7e1
loadmovesprites
end
; 0xc8f3
UnknownText_0xc8f3: ; 0xc8f3
text_jump UnknownText_0x1c0609
start_asm
; 0xc8f8
Functionc8f8: ; c8f8
call WaitSFX
ld de, SFX_FLASH
call PlaySFX
call WaitSFX
ld hl, UnknownText_0xc908
ret
; c908
UnknownText_0xc908: ; 0xc908
db "@"
; 0xc909
Functionc909: ; c909
call Functionc6ea
.asm_c90c
ld hl, Jumptable_c91a
call Functionc6f5
jr nc, .asm_c90c
and $7f
ld [$d0ec], a
ret
; c91a
Jumptable_c91a: ; c91a (3:491a)
dw Functionc922
dw Functionc95f
dw Functionc971
dw Functionc97a
Functionc922: ; c922 (3:4922)
ld de, ENGINE_FOGBADGE
call CheckBadge
jr c, .asm_c956
ld hl, BikeFlags
bit 1, [hl] ; always on bike
jr nz, .asm_c95c
ld a, [PlayerState]
cp PLAYER_SURF
jr z, .asm_c959
cp PLAYER_SURF_PIKA
jr z, .asm_c959
call GetFacingTileCoord
call GetTileCollision
cp $1
jr nz, .asm_c95c
call CheckDirection
jr c, .asm_c95c
callba CheckFacingObject
jr c, .asm_c95c
ld a, $1
ret
.asm_c956
ld a, $80
ret
.asm_c959
ld a, $3
ret
.asm_c95c
ld a, $2
ret
Functionc95f: ; c95f (3:495f)
call GetSurfType
ld [Buffer2], a ; $d1eb (aliases: MovementType)
call GetPartyNick
ld hl, UnknownScript_0xc983
call Function31cd
ld a, $81
ret
Functionc971: ; c971 (3:4971)
ld hl, CantSurfText
call Function1d67
ld a, $80
ret
Functionc97a: ; c97a (3:497a)
ld hl, AlreadySurfingText
call Function1d67
ld a, $80
ret
; c983 (3:4983)
UnknownScript_0xc983: ; c983
special $0035
UsedSurfScript: ; c986
2writetext UsedSurfText ; "used SURF!"
closetext
loadmovesprites
3callasm Functionc9a2 ; empty function
copybytetovar Buffer2
writevarcode VAR_MOVEMENT
special SPECIAL_UPDATESPRITETILES
special SPECIAL_BIKESURFMUSIC
; step into the water
special SPECIAL_LOADFACESTEP ; (slow_step_x, step_end)
applymovement 0, MovementBuffer ; PLAYER, MovementBuffer
end
; c9a2
Functionc9a2: ; c9a2
callba Function1060bb ; empty
ret
; c9a9
UsedSurfText: ; c9a9
TX_FAR _UsedSurfText
db "@"
; c9ae
CantSurfText: ; c9ae
TX_FAR _CantSurfText
db "@"
; c9b3
AlreadySurfingText: ; c9b3
TX_FAR _AlreadySurfingText
db "@"
; c9b8
GetSurfType: ; c9b8
; Surfing on Pikachu uses an alternate sprite.
; This is done by using a separate movement type.
ld a, [CurPartyMon]
ld e, a
ld d, 0
ld hl, PartySpecies
add hl, de
ld a, [hl]
cp PIKACHU
ld a, PLAYER_SURF_PIKA
ret z
ld a, PLAYER_SURF
ret
; c9cb
CheckDirection: ; c9cb
; Return carry if a tile permission prevents you
; from moving in the direction you're facing.
; Get player direction
ld a, [PlayerDirection]
and a, %00001100 ; bits 2 and 3 contain direction
rrca
rrca
ld e, a
ld d, 0
ld hl, .Directions
add hl, de
; Can you walk in this direction?
ld a, [TilePermissions]
and [hl]
jr nz, .quit
xor a
ret
.quit
scf
ret
.Directions
db FACE_DOWN
db FACE_UP
db FACE_LEFT
db FACE_RIGHT
; c9e7
TrySurfOW:: ; c9e7
; Checking a tile in the overworld.
; Return carry if surfing is allowed.
; Don't ask to surf if already surfing.
ld a, [PlayerState]
cp PLAYER_SURF_PIKA
jr z, .quit
cp PLAYER_SURF
jr z, .quit
; Must be facing water.
ld a, [EngineBuffer1]
call GetTileCollision
cp 1 ; surfable
jr nz, .quit
; Check tile permissions.
call CheckDirection
jr c, .quit
ld de, ENGINE_FOGBADGE
call CheckEngineFlag
jr c, .quit
ld d, SURF
call CheckPartyMove
jr c, .quit
ld hl, BikeFlags
bit 1, [hl] ; always on bike (can't surf)
jr nz, .quit
call GetSurfType
ld [MovementType], a
call GetPartyNick
ld a, BANK(AskSurfScript)
ld hl, AskSurfScript
call CallScript
scf
ret
.quit
xor a
ret
; ca2c
AskSurfScript: ; ca2c
loadfont
2writetext AskSurfText
yesorno
iftrue UsedSurfScript
loadmovesprites
end
; ca36
AskSurfText: ; ca36
TX_FAR _AskSurfText ; The water is calm.
db "@" ; Want to SURF?
; ca3b
Functionca3b: ; ca3b
call Functionc6ea
.asm_ca3e
ld hl, .data_ca4c
call Functionc6f5
jr nc, .asm_ca3e
and $7f
ld [$d0ec], a
ret
; ca4c
.data_ca4c
dw Functionca52
dw Functionca94
dw Functionca9d
; ca52
Functionca52: ; ca52
; Fly
ld de, ENGINE_STORMBADGE
call CheckBadge
jr c, .asm_ca85
call GetMapPermission
call CheckOutdoorMap
jr z, .asm_ca64
jr .indoors
.asm_ca64
xor a
ld [$ffde], a
call Function1d6e
call ClearSprites
callba Function91af3
ld a, e
cp -1
jr z, .asm_ca8b
cp $1c ; NUM_SPAWNS
jr nc, .asm_ca8b
ld [$d001], a
call Function1c17
ld a, $1
ret
.asm_ca85
ld a, $82
ret
.indoors
ld a, $2
ret
.asm_ca8b
call Function1c17
call WaitBGMap
ld a, $80
ret
; ca94
Functionca94: ; ca94
ld hl, UnknownScript_0xcaa3
call Function31cd
ld a, $81
ret
; ca9d
Functionca9d: ; ca9d
call Functionc779
ld a, $82
ret
; caa3
UnknownScript_0xcaa3: ; 0xcaa3
reloadmappart
3callasm HideSprites
special $0035
3callasm Function8caed
3call UnknownScript_0x122c1
special $0000
3callasm Function154f1
writecode $8, $0
newloadmap $fc
3callasm Function8cb33
special $003b
3callasm Functioncacb
end
; 0xcacb
Functioncacb: ; cacb
callba Function561d
call DelayFrame
call Functione4a
callba Function106594
ret
; cade
Functioncade: ; cade
call Functioncae7
and $7f
ld [$d0ec], a
ret
; cae7
Functioncae7: ; cae7
; Waterfall
ld de, ENGINE_RISINGBADGE
callba CheckBadge
ld a, $80
ret c
call Functioncb07
jr c, .asm_cb01
ld hl, UnknownScript_0xcb1c
call Function31cd
ld a, $81
ret
.asm_cb01
call Functionc779
ld a, $80
ret
; cb07
Functioncb07: ; cb07
ld a, [PlayerDirection]
and $c
cp FACE_UP
jr nz, .asm_cb1a
ld a, [TileUp]
call CheckWaterfallTile
jr nz, .asm_cb1a
xor a
ret
.asm_cb1a
scf
ret
; cb1c
UnknownScript_0xcb1c: ; 0xcb1c
reloadmappart
special $0035
UnknownScript_0xcb20: ; 0xcb20
3callasm GetPartyNick
2writetext UnknownText_0xcb51
closetext
loadmovesprites
playsound SFX_BUBBLEBEAM
.loop
applymovement $0, WaterfallStep
3callasm Functioncb38
iffalse .loop
end
; 0xcb38
Functioncb38: ; cb38
xor a
ld [ScriptVar], a
ld a, [StandingTile]
call CheckWaterfallTile
ret z
callba Function1060c1
ld a, $1
ld [ScriptVar], a
ret
; cb4f
WaterfallStep: ; cb4f
turn_waterfall_up
step_end
; cb51
UnknownText_0xcb51: ; 0xcb51
text_jump UnknownText_0x1c068e
db "@"
; 0xcb56
TryWaterfallOW:: ; cb56
ld d, WATERFALL
call CheckPartyMove
jr c, .asm_cb74
ld de, ENGINE_RISINGBADGE
call CheckEngineFlag
jr c, .asm_cb74
call Functioncb07
jr c, .asm_cb74
ld a, BANK(UnknownScript_0xcb86)
ld hl, UnknownScript_0xcb86
call CallScript
scf
ret
.asm_cb74
ld a, BANK(UnknownScript_0xcb7e)
ld hl, UnknownScript_0xcb7e
call CallScript
scf
ret
; cb7e
UnknownScript_0xcb7e: ; 0xcb7e
jumptext UnknownText_0xcb81
; 0xcb81
UnknownText_0xcb81: ; 0xcb81
text_jump UnknownText_0x1c06a3
db "@"
; 0xcb86
UnknownScript_0xcb86: ; 0xcb86
loadfont
2writetext UnknownText_0xcb90
yesorno
iftrue UnknownScript_0xcb20
loadmovesprites
end
; 0xcb90
UnknownText_0xcb90: ; 0xcb90
text_jump UnknownText_0x1c06bf
db "@"
; 0xcb95
Functioncb95: ; cb95
call Functionc6ea
ld a, $1
jr asm_cba1
Functioncb9c: ; cb9c
call Functionc6ea
ld a, $2
asm_cba1
ld [Buffer2], a
.asm_cba4
ld hl, Tablecbb2
call Functionc6f5
jr nc, .asm_cba4
and $7f
ld [$d0ec], a
ret
; cbb2
Tablecbb2: ; cbb2
dw Functioncbb8
dw Functioncbd8
dw Functioncc06
; cbb8
Functioncbb8: ; cbb8
call GetMapPermission
cp $4
jr z, .asm_cbc6
cp $7
jr z, .asm_cbc6
.asm_cbc3
ld a, $2
ret
.asm_cbc6
ld hl, $dca9
ld a, [hli]
and a
jr z, .asm_cbc3
ld a, [hli]
and a
jr z, .asm_cbc3
ld a, [hl]
and a
jr z, .asm_cbc3
ld a, $1
ret
; cbd8
Functioncbd8: ; cbd8
ld hl, $dca9
ld de, $d146
ld bc, $0003
call CopyBytes
call GetPartyNick
ld a, [Buffer2]
cp $2
jr nz, .asm_cbf7
ld hl, UnknownScript_0xcc35
call Function31cd
ld a, $81
ret
.asm_cbf7
callba Function8ae4e
ld hl, UnknownScript_0xcc2b
call Function31cd
ld a, $81
ret
; cc06
Functioncc06: ; cc06
ld a, [Buffer2]
cp $2
jr nz, .asm_cc19
ld hl, UnknownText_0xcc26
call Function1d4f
call Functiona80
call Function1c17
.asm_cc19
ld a, $80
ret
; cc1c
UnknownText_0xcc1c: ; 0xcc1c
; used DIG!
text_jump UnknownText_0x1c06de
db "@"
; 0xcc21
UnknownText_0xcc21: ; 0xcc21
; used an ESCAPE ROPE.
text_jump UnknownText_0x1c06ed
db "@"
; 0xcc26
UnknownText_0xcc26: ; 0xcc26
; Can't use that here.
text_jump UnknownText_0x1c0705
db "@"
; 0xcc2b
UnknownScript_0xcc2b: ; 0xcc2b
reloadmappart
special $0035
2writetext UnknownText_0xcc21
2jump UnknownScript_0xcc3c
; 0xcc35
UnknownScript_0xcc35: ; 0xcc35
reloadmappart
special $0035
2writetext UnknownText_0xcc1c
UnknownScript_0xcc3c: ; 0xcc3c
closetext
loadmovesprites
playsound SFX_WARP_TO
applymovement $0, MovementData_0xcc59
3call UnknownScript_0x122c1
special $0000
writecode $8, $0
newloadmap $f5
playsound SFX_WARP_FROM
applymovement $0, MovementData_0xcc5d
end
; 0xcc59
MovementData_0xcc59: ; 0xcc59
step_wait5
turn_away_down
hide_person
step_end
; 0xcc5d
MovementData_0xcc5d: ; 0xcc5d
db $3c, $58
turn_away_down
step_end
; 0xcc61
Functioncc61: ; cc61
call Functionc6ea
.asm_cc64
ld hl, Tablecc72
call Functionc6f5
jr nc, .asm_cc64
and $7f
ld [$d0ec], a
ret
; cc72
Tablecc72: ; cc72
dw Functioncc78
dw Functioncc9c
dw Functioncca8
; cc78
Functioncc78: ; cc78
call GetMapPermission
call CheckOutdoorMap
jr z, .asm_cc82
jr .asm_cc99
.asm_cc82
ld a, [$dcb2]
ld d, a
ld a, [$dcb3]
ld e, a
callba IsSpawnPoint
jr nc, .asm_cc99
ld a, c
ld [$d001], a
ld a, $1
ret
.asm_cc99
ld a, $2
ret
; cc9c
Functioncc9c: ; cc9c
call GetPartyNick
ld hl, UnknownScript_0xccbb
call Function31cd
ld a, $81
ret
; cca8
Functioncca8: ; cca8
ld hl, UnknownText_0xccb6
call Function1d67
ld a, $80
ret
; ccb1
UnknownText_0xccb1: ; 0xccb1
; Return to the last #MON CENTER.
text_jump UnknownText_0x1c071a
db "@"
; 0xccb6
UnknownText_0xccb6: ; 0xccb6
; Can't use that here.
text_jump UnknownText_0x1c073b
db "@"
; 0xccbb
UnknownScript_0xccbb: ; 0xccbb
reloadmappart
special $0035
2writetext UnknownText_0xccb1
pause 60
reloadmappart
loadmovesprites
playsound SFX_WARP_TO
applymovement $0, MovementData_0xcce1
3call UnknownScript_0x122c1
special $0000
writecode $8, $0
newloadmap $f4
playsound SFX_WARP_FROM
applymovement $0, MovementData_0xcce3
end
; 0xcce1
MovementData_0xcce1: ; cce1
teleport_from
step_end
; cce3
MovementData_0xcce3: ; cce3
teleport_to
step_end
; cce5
Functioncce5: ; cce5
call Functionccee
and $7f
ld [$d0ec], a
ret
; ccee
Functionccee: ; ccee
; Strength
ld de, ENGINE_PLAINBADGE
call CheckBadge
jr c, Functioncd06
jr Functioncd09
; ccf8
Functionccf8: ; ccf8
ld hl, UnknownText_0xcd01
call Function1d67
ld a, $80
ret
; cd01
UnknownText_0xcd01: ; 0xcd01
text_jump UnknownText_0x1c0751
db "@"
; 0xcd06
Functioncd06: ; cd06
ld a, $80
ret
; cd09
Functioncd09: ; cd09
ld hl, UnknownScript_0xcd29
call Function31cd
ld a, $81
ret
; cd12
Functioncd12: ; cd12
ld hl, BikeFlags
set 0, [hl]
ld a, [CurPartyMon]
ld e, a
ld d, 0
; fallthrough
; cd1d
Functioncd1d: ; cd1d
ld hl, PartySpecies
add hl, de
ld a, [hl]
ld [$d1ef], a
call GetPartyNick
ret
; cd29
UnknownScript_0xcd29: ; 0xcd29
reloadmappart
special $0035
UnknownScript_0xcd2d: ; 0xcd2d
3callasm Functioncd12
2writetext UnknownText_0xcd41
copybytetovar $d1ef
cry $0000
pause 3
2writetext UnknownText_0xcd46
loadmovesprites
end
; 0xcd41
UnknownText_0xcd41: ; 0xcd41
text_jump UnknownText_0x1c0774
db $50
; 0xcd46
UnknownText_0xcd46: ; 0xcd46
text_jump UnknownText_0x1c0788
db $50
; 0xcd4b
UnknownScript_0xcd4b: ; 0xcd4b
3callasm Functioncd78
iffalse UnknownScript_0xcd5f
if_equal $1, UnknownScript_0xcd59
2jump UnknownScript_0xcd5c
; 0xcd59
UnknownScript_0xcd59: ; 0xcd59
jumptext UnknownText_0xcd73
; 0xcd5c
UnknownScript_0xcd5c: ; 0xcd5c
jumptext UnknownText_0xcd6e
; 0xcd5f
UnknownScript_0xcd5f: ; 0xcd5f
loadfont
2writetext UnknownText_0xcd69
yesorno
iftrue UnknownScript_0xcd2d
loadmovesprites
end
; 0xcd69
UnknownText_0xcd69: ; 0xcd69
; A #MON may be able to move this. Want to use STRENGTH?
text_jump UnknownText_0x1c07a0
db "@"
; 0xcd6e
UnknownText_0xcd6e: ; 0xcd6e
; Boulders may now be moved!
text_jump UnknownText_0x1c07d8
db "@"
; 0xcd73
UnknownText_0xcd73: ; 0xcd73
; A #MON may be able to move this.
text_jump UnknownText_0x1c07f4
db "@"
; 0xcd78
Functioncd78: ; cd78
ld d, STRENGTH
call CheckPartyMove
jr c, .asm_cd92
ld de, ENGINE_PLAINBADGE
call CheckEngineFlag
jr c, .asm_cd92
ld hl, BikeFlags ; $dbf5
bit 0, [hl]
jr z, .asm_cd96
ld a, 2
jr .asm_cd99
.asm_cd92
ld a, 1
jr .asm_cd99
.asm_cd96
xor a
jr .asm_cd99
.asm_cd99
ld [ScriptVar], a
ret
; cd9d
Functioncd9d: ; cd9d
call Functionc6ea
.asm_cda0
ld hl, Jumptable_cdae
call Functionc6f5
jr nc, .asm_cda0
and $7f
ld [$d0ec], a
ret
; cdae
Jumptable_cdae: ; cdae
dw Functioncdb4
dw Functioncdca
dw Functioncdd3
; cdb4
Functioncdb4: ; cdb4
ld de, ENGINE_GLACIERBADGE
call CheckBadge
jr c, .asm_cdc7
call Functioncdde
jr c, .asm_cdc4
ld a, $1
ret
.asm_cdc4
ld a, $2
ret
.asm_cdc7
ld a, $80
ret
; cdca
Functioncdca: ; cdca
ld hl, UnknownScript_0xce0b
call Function31cd
ld a, $81
ret
; cdd3
Functioncdd3: ; cdd3
call Functionc779
ld a, $80
ret
; cdd9
UnknownText_0xcdd9: ; 0xcdd9
; used WHIRLPOOL!
text_jump UnknownText_0x1c0816
db "@"
; 0xcdde
Functioncdde: ; cdde
call GetFacingTileCoord
ld c, a
push de
call CheckWhirlpoolTile
pop de
jr c, .asm_ce09
call Function2a66
ld c, [hl]
push hl
ld hl, Unknown_c8a4
call Functionc840
pop hl
jr nc, .asm_ce09
ld a, l
ld [$d1ec], a
ld a, h
ld [$d1ed], a
ld a, b
ld [$d1ee], a
ld a, c
ld [$d1ef], a
xor a
ret
.asm_ce09
scf
ret
; ce0b
UnknownScript_0xce0b: ; 0xce0b
reloadmappart
special $0035
UnknownScript_0xce0f: ; 0xce0f
3callasm GetPartyNick
2writetext UnknownText_0xcdd9
reloadmappart
3callasm Functionce1d
loadmovesprites
end
; 0xce1d
Functionce1d: ; ce1d
ld hl, $d1ec
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$d1ee]
ld [hl], a
xor a
ld [hBGMapMode], a
call Function2173
ld a, [$d1ef]
ld e, a
callba Function8c7d4
call Function2879
call Function2914
ret
; ce3e
TryWhirlpoolOW:: ; ce3e
ld d, WHIRLPOOL
call CheckPartyMove
jr c, .asm_ce5c
ld de, ENGINE_GLACIERBADGE
call CheckEngineFlag
jr c, .asm_ce5c
call Functioncdde
jr c, .asm_ce5c
ld a, BANK(UnknownScript_0xce6e)
ld hl, UnknownScript_0xce6e
call CallScript
scf
ret
.asm_ce5c
ld a, BANK(UnknownScript_0xce66)
ld hl, UnknownScript_0xce66
call CallScript
scf
ret
; ce66
UnknownScript_0xce66: ; 0xce66
jumptext UnknownText_0xce69
; 0xce69
UnknownText_0xce69: ; 0xce69
text_jump UnknownText_0x1c082b
db "@"
; 0xce6e
UnknownScript_0xce6e: ; 0xce6e
loadfont
2writetext UnknownText_0xce78
yesorno
iftrue UnknownScript_0xce0f
loadmovesprites
end
; 0xce78
UnknownText_0xce78: ; 0xce78
text_jump UnknownText_0x1c0864
db "@"
; 0xce7d
Functionce7d: ; ce7d
call Functionce86
and $7f
ld [$d0ec], a
ret
; ce86
Functionce86: ; ce86
call GetFacingTileCoord
call CheckHeadbuttTreeTile
jr nz, .no_tree
ld hl, HeadbuttFromMenuScript
call Function31cd
ld a, $81
ret
.no_tree
call Functionc779
ld a, $80
ret
; ce9d
UnknownText_0xce9d: ; 0xce9d
; did a HEADBUTT!
text_jump UnknownText_0x1c0897
db "@"
; 0xcea2
UnknownText_0xcea2: ; 0xcea2
; Nope. Nothing…
text_jump UnknownText_0x1c08ac
db "@"
; 0xcea7
HeadbuttFromMenuScript: ; 0xcea7
reloadmappart
special $0035
HeadbuttScript: ; 0xceab
3callasm GetPartyNick
2writetext UnknownText_0xce9d
reloadmappart
3callasm ShakeHeadbuttTree
3callasm TreeMonEncounter
iffalse .no_battle
loadmovesprites
battlecheck
startbattle
returnafterbattle
end
.no_battle
2writetext UnknownText_0xcea2
closetext
loadmovesprites
end
; 0xcec9
TryHeadbuttOW:: ; cec9
ld d, HEADBUTT
call CheckPartyMove
jr c, .no
ld a, BANK(AskHeadbuttScript)
ld hl, AskHeadbuttScript
call CallScript
scf
ret
.no
xor a
ret
; cedc
AskHeadbuttScript: ; 0xcedc
loadfont
2writetext UnknownText_0xcee6
yesorno
iftrue HeadbuttScript
loadmovesprites
end
; 0xcee6
UnknownText_0xcee6: ; 0xcee6
; A #MON could be in this tree. Want to HEADBUTT it?
text_jump UnknownText_0x1c08bc
db "@"
; 0xceeb
Functionceeb: ; ceeb
call Functioncef4
and $7f
ld [$d0ec], a
ret
; cef4
Functioncef4: ; cef4
call Functioncf0d
jr c, .no_rock
ld a, d
cp $18
jr nz, .no_rock
ld hl, RockSmashFromMenuScript
call Function31cd
ld a, $81
ret
.no_rock
call Functionc779
ld a, $80
ret
; cf0d
Functioncf0d: ; cf0d
callba CheckFacingObject
jr nc, .asm_cf2c
ld a, [$ffb0]
call Function1ae5
ld hl, $0001
add hl, bc
ld a, [hl]
ld [$ffe0], a
call GetMapObject
ld hl, $0004
add hl, bc
ld a, [hl]
ld d, a
and a
ret
.asm_cf2c
scf
ret
; cf2e
RockSmashFromMenuScript: ; 0xcf2e
reloadmappart
special $0035
RockSmashScript: ; cf32
3callasm GetPartyNick
2writetext UnknownText_0xcf58
loadmovesprites
special $003b
playsound SFX_STRENGTH
earthquake 84
applymovement2 MovementData_0xcf55
disappear $fe
3callasm RockMonEncounter
copybytetovar $d22e
iffalse .done
battlecheck
startbattle
returnafterbattle
.done
end
; 0xcf55
MovementData_0xcf55: ; 0xcf55
db $57, $0a
step_end
UnknownText_0xcf58: ; 0xcf58
text_jump UnknownText_0x1c08f0
db "@"
; 0xcf5d
AskRockSmashScript: ; 0xcf5d
3callasm HasRockSmash
if_equal 1, .no
loadfont
2writetext UnknownText_0xcf77
yesorno
iftrue RockSmashScript
loadmovesprites
end
.no
jumptext UnknownText_0xcf72
; 0xcf72
UnknownText_0xcf72: ; 0xcf72
; Maybe a #MON can break this.
text_jump UnknownText_0x1c0906
db "@"
; 0xcf77
UnknownText_0xcf77: ; 0xcf77
; This rock looks breakable. Want to use ROCK SMASH?
text_jump UnknownText_0x1c0924
db "@"
; 0xcf7c
HasRockSmash: ; cf7c
ld d, ROCK_SMASH
call CheckPartyMove
jr nc, .yes
.no
ld a, 1
jr .done
.yes
xor a
jr .done
.done
ld [ScriptVar], a
ret
Functioncf8e: ; cf8e
ld a, e
push af
call Functionc6ea
pop af
ld [Buffer2], a
.asm_cf97
ld hl, Jumptable_cfa5
call Functionc6f5
jr nc, .asm_cf97
and $7f
ld [$d0ec], a
ret
; cfa5
Jumptable_cfa5: ; cfa5
dw Functioncfaf
dw Functiond002
dw Functioncff4
dw Functioncff1
dw Functiond010
; cfaf
Functioncfaf: ; cfaf
ld a, [PlayerState]
cp PLAYER_SURF
jr z, .asm_cfc4
cp PLAYER_SURF_PIKA
jr z, .asm_cfc4
call GetFacingTileCoord
call GetTileCollision
cp $1
jr z, .asm_cfc7
.asm_cfc4
ld a, $3
ret
.asm_cfc7
call Function2d19
and a
jr nz, .asm_cfd0
ld a, $4
ret
.asm_cfd0
ld d, a
ld a, [Buffer2]
ld e, a
callba FishAction
ld a, d
and a
jr z, .asm_cfee
ld [$d22e], a
ld a, e
ld [CurPartyLevel], a
ld a, BATTLETYPE_FISH
ld [BattleType], a
ld a, $2
ret
.asm_cfee
ld a, $1
ret
; cff1
Functioncff1: ; cff1
ld a, $80
ret
; cff4
Functioncff4: ; cff4
ld a, $1
ld [$d1ef], a
ld hl, UnknownScript_0xd035
call Function31cd
ld a, $81
ret
; d002
Functiond002: ; d002
ld a, $2
ld [$d1ef], a
ld hl, UnknownScript_0xd01e
call Function31cd
ld a, $81
ret
; d010
Functiond010: ; d010
ld a, $0
ld [$d1ef], a
ld hl, UnknownScript_0xd027
call Function31cd
ld a, $81
ret
; d01e
UnknownScript_0xd01e: ; 0xd01e
2call UnknownScript_0xd07c
2writetext UnknownText_0xd0a9
2jump UnknownScript_0xd02d
; 0xd027
UnknownScript_0xd027: ; 0xd027
2call UnknownScript_0xd07c
2writetext UnknownText_0xd0a9
UnknownScript_0xd02d: ; 0xd02d
loademote $8
3callasm Functiond095
loadmovesprites
end
; 0xd035
UnknownScript_0xd035: ; 0xd035
2call UnknownScript_0xd07c
3callasm Functiond06c
iffalse UnknownScript_0xd046
applymovement $0, MovementData_0xd062
2jump UnknownScript_0xd04a
; 0xd046
UnknownScript_0xd046: ; 0xd046
applymovement $0, MovementData_0xd05c
UnknownScript_0xd04a: ; 0xd04a
pause 40
applymovement $0, MovementData_0xd069
2writetext UnknownText_0xd0a4
3callasm Functiond095
loadmovesprites
battlecheck
startbattle
returnafterbattle
end
; 0xd05c
MovementData_0xd05c: ; d05c
db $51
db $51
db $51
db $51
show_emote
step_end
; d062
MovementData_0xd062: ; d062
db $51
db $51
db $51
db $51
show_person
show_emote
step_end
; d069
MovementData_0xd069: ; d069
hide_emote
db $52
step_end
; d06c
Functiond06c: ; d06c
ld a, [PlayerDirection]
and $c
cp $4
ld a, $1
jr z, .asm_d078
xor a
.asm_d078
ld [ScriptVar], a
ret
; d07c
UnknownScript_0xd07c: ; 0xd07c
reloadmappart
loadvar $ffd4, $0
special $0035
loademote $9
3callasm Functionb84b3
loademote $0
applymovement $0, MovementData_0xd093
pause 40
end
; 0xd093
MovementData_0xd093: ; d093
db $52
step_end
; d095
Functiond095: ; d095
xor a
ld [hBGMapMode], a
ld a, $1
ld [PlayerAction], a
call Function1ad2
call Functione4a
ret
; d0a4
UnknownText_0xd0a4: ; 0xd0a4
; Oh! A bite!
text_jump UnknownText_0x1c0958
db "@"
; 0xd0a9
UnknownText_0xd0a9: ; 0xd0a9
; Not even a nibble!
text_jump UnknownText_0x1c0965
db "@"
; 0xd0ae
UnknownText_0xd0ae: ; 0xd0ae
; Looks like there's nothing here.
text_jump UnknownText_0x1c0979
db "@"
; 0xd0b3
Functiond0b3: ; d0b3
call Functiond0bc
and $7f
ld [$d0ec], a
ret
; d0bc
Functiond0bc: ; d0bc
call Functiond121
jr c, .asm_d110
ld a, [PlayerState]
cp PLAYER_NORMAL
jr z, .asm_d0ce
cp PLAYER_BIKE
jr z, .asm_d0f7
jr .asm_d110
.asm_d0ce
ld hl, UnknownScript_0xd13e
ld de, UnknownScript_0xd14e
call Functiond119
call Function31cd
xor a
ld [MusicFade], a
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
call MaxVolume
ld de, MUSIC_BICYCLE
ld a, e
ld [wMapMusic], a
call PlayMusic
ld a, $1
ret
.asm_d0f7
ld hl, BikeFlags
bit 1, [hl]
jr nz, .asm_d10b
ld hl, UnknownScript_0xd158
ld de, UnknownScript_0xd16b
call Functiond119
ld a, $3
jr .asm_d113
.asm_d10b
ld hl, UnknownScript_0xd171
jr .asm_d113
.asm_d110
ld a, $0
ret
.asm_d113
call Function31cd
ld a, $1
ret
; d119
Functiond119: ; d119
ld a, [$d0ef]
and a
ret z
ld h, d
ld l, e
ret
; d121
Functiond121: ; d121
call GetMapPermission
call CheckOutdoorMap
jr z, .asm_d133
cp CAVE
jr z, .asm_d133
cp GATE
jr z, .asm_d133
jr .asm_d13c
.asm_d133
call Function184a
and $f
jr nz, .asm_d13c
xor a
ret
.asm_d13c
scf
ret
; d13e
UnknownScript_0xd13e: ; 0xd13e
reloadmappart
special $0035
writecode $8, $1
2writetext UnknownText_0xd17c
closetext
loadmovesprites
special $0038
end
; 0xd14e
UnknownScript_0xd14e: ; 0xd14e
writecode $8, $1
loadmovesprites
special $0038
end
; 0xd156
INCBIN "baserom.gbc", $d156, $d158 - $d156
UnknownScript_0xd158: ; 0xd158
reloadmappart
special $0035
writecode $8, $0
2writetext UnknownText_0xd181
closetext
UnknownScript_0xd163:
loadmovesprites
special $0038
special $003c
end
; 0xd16b
UnknownScript_0xd16b: ; 0xd16b
writecode $8, $0
2jump UnknownScript_0xd163
; 0xd171
UnknownScript_0xd171: ; 0xd171
2writetext UnknownText_0xd177
closetext
loadmovesprites
end
; 0xd177
UnknownText_0xd177: ; 0xd177
; You can't get off here!
text_jump UnknownText_0x1c099a
db "@"
; 0xd17c
UnknownText_0xd17c: ; 0xd17c
; got on the @ .
text_jump UnknownText_0x1c09b2
db "@"
; 0xd181
UnknownText_0xd181: ; 0xd181
; got off the @ .
text_jump UnknownText_0x1c09c7
db "@"
; 0xd186
TryCutOW:: ; d186
ld d, CUT
call CheckPartyMove
jr c, .cant_cut
ld de, ENGINE_HIVEBADGE
call CheckEngineFlag
jr c, .cant_cut
ld a, BANK(AskCutScript)
ld hl, AskCutScript
call CallScript
scf
ret
.cant_cut
ld a, BANK(CantCutScript)
ld hl, CantCutScript
call CallScript
scf
ret
; d1a9
AskCutScript: ; 0xd1a9
loadfont
2writetext UnknownText_0xd1c8
yesorno
iffalse .script_d1b8
3callasm Functiond1ba
iftrue UnknownScript_0xc802
.script_d1b8
loadmovesprites
end
; 0xd1ba
Functiond1ba: ; d1ba
xor a
ld [ScriptVar], a
call Functionc7ce
ret c
ld a, 1
ld [ScriptVar], a
ret
; d1c8
UnknownText_0xd1c8: ; 0xd1c8
text_jump UnknownText_0x1c09dd
db "@"
; 0xd1cd
CantCutScript: ; 0xd1cd
jumptext UnknownText_0xd1d0
; 0xd1d0
UnknownText_0xd1d0: ; 0xd1d0
text_jump UnknownText_0x1c0a05
db "@"
; 0xd1d5
_ReceiveItem:: ; d1d5
call Functiond27b
jp nz, Functiond29c
push hl
call CheckItemPocket
pop de
ld a, [$d142]
dec a
ld hl, Tabled1e9
rst JumpTable
ret
; d1e9
Tabled1e9: ; d1e9
dw Functiond1f1
dw Functiond1f6
dw Functiond1fb
dw Functiond201
; d1f1
Functiond1f1: ; d1f1
ld h, d
ld l, e
jp Functiond29c
; d1f6
Functiond1f6: ; d1f6
ld h, d
ld l, e
jp Functiond35a
; d1fb
Functiond1fb: ; d1fb
ld hl, NumBalls
jp Functiond29c
; d201
Functiond201: ; d201
ld h, d
ld l, e
ld a, [CurItem]
ld c, a
call GetTMHMNumber
jp Functiond3c4
; d20d
_TossItem:: ; d20d
call Functiond27b
jr nz, .asm_d241
push hl
call CheckItemPocket
pop de
ld a, [$d142]
dec a
ld hl, .data_d220
rst JumpTable
ret
.data_d220
dw .Item
dw .KeyItem
dw .Ball
dw .TMHM
; d228
.Ball ; d228
ld hl, NumBalls
jp Functiond2ff
; d22e
.TMHM ; d22e
ld h, d
ld l, e
ld a, [CurItem]
ld c, a
call GetTMHMNumber
jp Functiond3d8
; d23a
.KeyItem ; d23a
ld h, d
ld l, e
jp Functiond374
; d23f
.Item ; d23f
ld h, d
ld l, e
; d241
.asm_d241
jp Functiond2ff
; d244
_CheckItem:: ; d244
call Functiond27b
jr nz, .asm_d278
push hl
call CheckItemPocket
pop de
ld a, [$d142]
dec a
ld hl, .data_d257
rst JumpTable
ret
.data_d257
dw .Item
dw .KeyItem
dw .Ball
dw .TMHM
; d25f
.Ball ; d25f
ld hl, NumBalls
jp Functiond349
; d265
.TMHM ; d265
ld h, d
ld l, e
ld a, [CurItem]
ld c, a
call GetTMHMNumber
jp Functiond3fb
; d271
.KeyItem ; d271
ld h, d
ld l, e
jp Functiond3b1
; d276
.Item ; d276
ld h, d
ld l, e
; d278
.asm_d278
jp Functiond349
; d27b
Functiond27b: ; d27b
ld a, l
cp TMsHMsEnd % $100
ret nz
ld a, h
cp TMsHMsEnd / $100
ret
; d283
Functiond283: ; d283
ld c, 20
ld a, e
cp TMsHMsEnd % $100
jr nz, .asm_d28e
ld a, d
cp TMsHMsEnd / $100
ret z
.asm_d28e
ld c, 50
ld a, e
cp BallsEnd % $100
jr nz, .asm_d299
ld a, d
cp BallsEnd / $100
ret z
.asm_d299
ld c, $c
ret
; d29c
Functiond29c: ; d29c
ld d, h
ld e, l
inc hl
ld a, [CurItem]
ld c, a
ld b, 0
.asm_d2a5
ld a, [hli]
cp $ff
jr z, .asm_d2bd
cp c
jr nz, .asm_d2ba
ld a, $63
sub [hl]
add b
ld b, a
ld a, [$d10c]
cp b
jr z, .asm_d2c6
jr c, .asm_d2c6
.asm_d2ba
inc hl
jr .asm_d2a5
.asm_d2bd
call Functiond283
ld a, [de]
cp c
jr c, .asm_d2c6
and a
ret
.asm_d2c6
ld h, d
ld l, e
ld a, [CurItem]
ld c, a
ld a, [$d10c]
ld [$d10d], a
.asm_d2d2
inc hl
ld a, [hli]
cp $ff
jr z, .asm_d2ef
cp c
jr nz, .asm_d2d2
ld a, [$d10d]
add [hl]
cp $64
jr nc, .asm_d2e6
ld [hl], a
jr .asm_d2fd
.asm_d2e6
ld [hl], $63
sub $63
ld [$d10d], a
jr .asm_d2d2
.asm_d2ef
dec hl
ld a, [CurItem]
ld [hli], a
ld a, [$d10d]
ld [hli], a
ld [hl], $ff
ld h, d
ld l, e
inc [hl]
.asm_d2fd
scf
ret
; d2ff
Functiond2ff: ; d2ff
ld d, h
ld e, l
ld a, [hli]
ld c, a
ld a, [$d107]
cp c
jr nc, .asm_d318
ld c, a
ld b, $0
add hl, bc
add hl, bc
ld a, [CurItem]
cp [hl]
inc hl
jr z, .asm_d327
ld h, d
ld l, e
inc hl
.asm_d318
ld a, [CurItem]
ld b, a
.asm_d31c
ld a, [hli]
cp b
jr z, .asm_d327
cp $ff
jr z, .asm_d347
inc hl
jr .asm_d31c
.asm_d327
ld a, [$d10c]
ld b, a
ld a, [hl]
sub b
jr c, .asm_d347
ld [hl], a
ld [$d10d], a
and a
jr nz, .asm_d345
dec hl
ld b, h
ld c, l
inc hl
inc hl
.asm_d33b
ld a, [hli]
ld [bc], a
inc bc
cp $ff
jr nz, .asm_d33b
ld h, d
ld l, e
dec [hl]
.asm_d345
scf
ret
.asm_d347
and a
ret
; d349
Functiond349: ; d349
ld a, [CurItem]
ld c, a
.asm_d34d
inc hl
ld a, [hli]
cp $ff
jr z, .asm_d358
cp c
jr nz, .asm_d34d
scf
ret
.asm_d358
and a
ret
; d35a
Functiond35a: ; d35a
ld hl, NumKeyItems
ld a, [hli]
cp $19
jr nc, .asm_d372
ld c, a
ld b, $0
add hl, bc
ld a, [CurItem]
ld [hli], a
ld [hl], $ff
ld hl, NumKeyItems
inc [hl]
scf
ret
.asm_d372
and a
ret
; d374
Functiond374: ; d374
ld a, [$d107]
ld e, a
ld d, $0
ld hl, NumKeyItems
ld a, [hl]
cp e
jr nc, .asm_d387
call Functiond396
ret nc
jr .asm_d38a
.asm_d387
dec [hl]
inc hl
add hl, de
.asm_d38a
ld d, h
ld e, l
inc hl
.asm_d38d
ld a, [hli]
ld [de], a
inc de
cp $ff
jr nz, .asm_d38d
scf
ret
; d396
Functiond396: ; d396
ld hl, NumKeyItems
ld a, [CurItem]
ld c, a
.asm_d39d
inc hl
ld a, [hl]
cp c
jr z, .asm_d3a8
cp $ff
jr nz, .asm_d39d
xor a
ret
.asm_d3a8
ld a, [NumKeyItems]
dec a
ld [NumKeyItems], a
scf
ret
; d3b1
Functiond3b1: ; d3b1
ld a, [CurItem]
ld c, a
ld hl, KeyItems
.asm_d3b8
ld a, [hli]
cp c
jr z, .asm_d3c2
cp $ff
jr nz, .asm_d3b8
and a
ret
.asm_d3c2
scf
ret
; d3c4
Functiond3c4: ; d3c4
dec c
ld b, $0
ld hl, TMsHMs
add hl, bc
ld a, [$d10c]
add [hl]
cp $64
jr nc, .asm_d3d6
ld [hl], a
scf
ret
.asm_d3d6
and a
ret
; d3d8
Functiond3d8: ; d3d8
dec c
ld b, $0
ld hl, TMsHMs
add hl, bc
ld a, [$d10c]
ld b, a
ld a, [hl]
sub b
jr c, .asm_d3f9
ld [hl], a
ld [$d10d], a
jr nz, .asm_d3f7
ld a, [$d0e2]
and a
jr z, .asm_d3f7
dec a
ld [$d0e2], a
.asm_d3f7
scf
ret
.asm_d3f9
and a
ret
; d3fb
Functiond3fb: ; d3fb
dec c
ld b, $0
ld hl, TMsHMs
add hl, bc
ld a, [hl]
and a
ret z
scf
ret
; d407
GetTMHMNumber:: ; d407
; Return the number of a TM/HM by item id c.
ld a, c
; Skip any dummy items.
cp ITEM_C3 ; TM04-05
jr c, .done
cp ITEM_DC ; TM28-29
jr c, .skip
dec a
.skip
dec a
.done
sub TM_01
inc a
ld c, a
ret
; d417
GetNumberedTMHM: ; d417
; Return the item id of a TM/HM by number c.
ld a, c
; Skip any gaps.
cp ITEM_C3 - (TM_01 - 1)
jr c, .done
cp ITEM_DC - (TM_01 - 1) - 1
jr c, .skip_one
.skip_two
inc a
.skip_one
inc a
.done
add TM_01
dec a
ld c, a
ret
; d427
_CheckTossableItem:: ; d427
; Return 1 in $d142 and carry if CurItem can't be removed from the bag.
ld a, 4
call GetItemAttr
bit 7, a
jr nz, Functiond47f
and a
ret
; d432
CheckSelectableItem: ; d432
; Return 1 in $d142 and carry if CurItem can't be selected.
ld a, 4
call GetItemAttr
bit 6, a
jr nz, Functiond47f
and a
ret
; d43d
CheckItemPocket:: ; d43d
; Return the pocket for CurItem in $d142.
ld a, 5
call GetItemAttr
and $f
ld [$d142], a
ret
; d448
CheckItemContext: ; d448
; Return the context for CurItem in $d142.
ld a, 6
call GetItemAttr
and $f
ld [$d142], a
ret
; d453
CheckItemMenu: ; d453
; Return the menu for CurItem in $d142.
ld a, 6
call GetItemAttr
swap a
and $f
ld [$d142], a
ret
; d460
GetItemAttr: ; d460
; Get attribute a of CurItem.
push hl
push bc
ld hl, ItemAttributes
ld c, a
ld b, 0
add hl, bc
xor a
ld [$d142], a
ld a, [CurItem]
dec a
ld c, a
ld a, 7
call AddNTimes
ld a, BANK(ItemAttributes)
call GetFarByte
pop bc
pop hl
ret
; d47f
Functiond47f: ; d47f
ld a, 1
ld [$d142], a
scf
ret
; d486
GetItemPrice: ; d486
; Return the price of CurItem in de.
push hl
push bc
ld a, $0
call GetItemAttr
ld e, a
ld a, $1
call GetItemAttr
ld d, a
pop bc
pop hl
ret
; d497
Functiond497:: ; d497 (3:5497)
ld a, [$d150]
and a
ret z
bit 7, a
jr nz, .asm_d4a9
bit 6, a
jr nz, .asm_d4b3
bit 5, a
jr nz, .asm_d4b8
ret
.asm_d4a9
ld a, $4
ld [$d13f], a
call Functiond536
jr .asm_d4b8
.asm_d4b3
call Functiond511
jr .asm_d4b8
.asm_d4b8
call Functiond4e5
ld a, [$d14e]
ld d, a
ld a, [$d14f]
ld e, a
ld a, [$d14c]
sub d
ld [$d14c], a
ld a, [$d14d]
sub e
ld [$d14d], a
ret
Functiond4d2:: ; d4d2 (3:54d2)
ld a, [$d14e]
ld d, a
ld a, [$d14f]
ld e, a
ld a, [hSCX] ; $ff00+$cf
add d
ld [hSCX], a ; $ff00+$cf
ld a, [hSCY] ; $ff00+$d0
add e
ld [hSCY], a ; $ff00+$d0
ret
Functiond4e5: ; d4e5 (3:54e5)
ld hl, $d13f
ld a, [hl]
and a
ret z
dec [hl]
ld a, [hl]
ld hl, Jumptable_d4f2
rst JumpTable
ret
Jumptable_d4f2: ; d4f2 (3:54f2)
dw Function2914
dw Function2879
dw Functiond509
dw Functiond510
dw Functiond508
dw Functiond508
dw Functiond508
dw Functiond508
dw Functiond508
dw Functiond508
dw Functiond508
Functiond508: ; d508 (3:5508)
ret
Functiond509: ; d509 (3:5509)
callba Function10602e
ret
Functiond510: ; d510 (3:5510)
ret
Functiond511: ; d511 (3:5511)
ld a, [$d151]
and a
jr nz, .asm_d51c
ld hl, YCoord ; $dcb7
inc [hl]
ret
.asm_d51c
cp $1
jr nz, .asm_d525
ld hl, YCoord ; $dcb7
dec [hl]
ret
.asm_d525
cp $2
jr nz, .asm_d52e
ld hl, XCoord ; $dcb8
dec [hl]
ret
.asm_d52e
cp $3
ret nz
ld hl, XCoord ; $dcb8
inc [hl]
ret
Functiond536: ; d536 (3:5536)
ld a, [$d151]
and a
jr z, .asm_d549
cp $1
jr z, .asm_d553
cp $2
jr z, .asm_d55d
cp $3
jr z, .asm_d567
ret
.asm_d549
call Functiond571
call Function217a
call Function2748
ret
.asm_d553
call Functiond5a2
call Function217a
call Function272a
ret
.asm_d55d
call Functiond5d5
call Function217a
call Function2771
ret
.asm_d567
call Functiond5fe
call Function217a
call Function278f
ret
Functiond571: ; d571 (3:5571)
ld a, [$d152]
add $40
ld [$d152], a
jr nc, .asm_d586
ld a, [$d153]
inc a
and $3
or $98
ld [$d153], a
.asm_d586
ld hl, $d196
inc [hl]
ld a, [hl]
cp $2
jr nz, .asm_d594
ld [hl], $0
call Functiond595
.asm_d594
ret
Functiond595: ; d595 (3:5595)
ld hl, $d194
ld a, [MapWidth]
add $6
add [hl]
ld [hli], a
ret nc
inc [hl]
ret
Functiond5a2: ; d5a2 (3:55a2)
ld a, [$d152]
sub $40
ld [$d152], a
jr nc, .asm_d5b7
ld a, [$d153]
dec a
and $3
or $98
ld [$d153], a
.asm_d5b7
ld hl, $d196
dec [hl]
ld a, [hl]
cp $ff
jr nz, .asm_d5c5
ld [hl], $1
call Functiond5c6
.asm_d5c5
ret
Functiond5c6: ; d5c6 (3:55c6)
ld hl, $d194
ld a, [MapWidth]
add $6
ld b, a
ld a, [hl]
sub b
ld [hli], a
ret nc
dec [hl]
ret
Functiond5d5: ; d5d5 (3:55d5)
ld a, [$d152]
ld e, a
and $e0
ld d, a
ld a, e
sub $2
and $1f
or d
ld [$d152], a
ld hl, $d197
dec [hl]
ld a, [hl]
cp $ff
jr nz, .asm_d5f3
ld [hl], $1
call Functiond5f4
.asm_d5f3
ret
Functiond5f4: ; d5f4 (3:55f4)
ld hl, $d194
ld a, [hl]
sub $1
ld [hli], a
ret nc
dec [hl]
ret
Functiond5fe: ; d5fe (3:55fe)
ld a, [$d152]
ld e, a
and $e0
ld d, a
ld a, e
add $2
and $1f
or d
ld [$d152], a
ld hl, $d197
inc [hl]
ld a, [hl]
cp $2
jr nz, .asm_d61c
ld [hl], $0
call Functiond61d
.asm_d61c
ret
Functiond61d: ; d61d (3:561d)
ld hl, $d194
ld a, [hl]
add $1
ld [hli], a
ret nc
inc [hl]
ret
Functiond627: ; d627
call Functiond65f
jr c, .asm_d645
call Functiond670
.asm_d62f
push bc
push hl
call Functiond6e2
pop hl
pop bc
push af
push bc
push hl
call Functiond730
call Functiond7c9
pop hl
pop bc
pop af
jr nc, .asm_d62f
ret
.asm_d645
call Functiond670
.asm_d648
push bc
push hl
call Functiond6f5
pop hl
pop bc
ret c
push af
push bc
push hl
call Functiond749
call Functiond7c9
pop hl
pop bc
pop af
jr nc, .asm_d648
ret
; d65f
Functiond65f: ; d65f
ld a, [Buffer2]
and a
jr nz, .asm_d66e
ld a, [Buffer1]
cp $30
jr nc, .asm_d66e
and a
ret
.asm_d66e
scf
ret
; d670
Functiond670: ; d670
push hl
ld hl, Buffer1
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
pop hl
call Functionc699
ld a, e
ld [$d1f1], a
ld a, [$d1ee]
ld c, a
ld a, [$d1ef]
ld b, a
ld a, [Buffer1]
ld e, a
ld a, [Buffer2]
ld d, a
call Functionc699
ld a, e
ld [$d1f2], a
push hl
ld hl, $d1ec
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
pop hl
ld a, e
sub c
ld e, a
ld a, d
sbc b
ld d, a
jr c, .asm_d6c1
ld a, [$d1ec]
ld [$d1f5], a
ld a, [$d1ee]
ld [$d1f6], a
ld bc, $0001
jr .asm_d6d9
.asm_d6c1
ld a, [$d1ec]
ld [$d1f6], a
ld a, [$d1ee]
ld [$d1f5], a
ld a, e
xor $ff
inc a
ld e, a
ld a, d
xor $ff
ld d, a
ld bc, rIE
.asm_d6d9
ld a, d
ld [$d1f3], a
ld a, e
ld [$d1f4], a
ret
; d6e2
Functiond6e2: ; d6e2
ld hl, $d1f1
ld a, [$d1f2]
cp [hl]
jr nz, .asm_d6ed
scf
ret
.asm_d6ed
ld a, c
add [hl]
ld [hl], a
call Functiond839
and a
ret
; d6f5
Functiond6f5: ; d6f5
.asm_d6f5
ld hl, $d1ec
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, e
cp [hl]
jr nz, .asm_d707
inc hl
ld a, d
cp [hl]
jr nz, .asm_d707
scf
ret
.asm_d707
ld l, e
ld h, d
add hl, bc
ld a, l
ld [$d1ec], a
ld a, h
ld [$d1ed], a
push hl
push de
push bc
ld hl, Buffer1
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
call Functionc699
pop bc
pop de
pop hl
ld a, e
ld hl, $d1f1
cp [hl]
jr z, .asm_d6f5
ld [hl], a
and a
ret
; d730
Functiond730: ; d730
call Functiond784
ld d, $6
ld a, [$d10a]
and $1
ld b, a
ld a, [$d1f1]
ld e, a
ld c, a
push de
call Functiond771
pop de
call Functiond7b4
ret
; d749
Functiond749: ; d749
call Functiond784
ld a, [$d1ec]
ld c, a
ld a, [$d1ed]
ld b, a
ld a, [Buffer1]
ld e, a
ld a, [Buffer2]
ld d, a
call Functionc699
ld c, e
ld d, $6
ld a, [$d10a]
and $1
ld b, a
push de
call Functiond771
pop de
call Functiond7b4
ret
; d771
Functiond771: ; d771
ld a, [$d10a]
cp $2
jr nz, .asm_d780
ld a, $28
add l
ld l, a
ld a, $0
adc h
ld h, a
.asm_d780
call DrawHPBar
ret
; d784
Functiond784: ; d784
ld a, [$d10a]
and a
ret z
cp $1
jr z, .asm_d792
ld de, $0016
jr .asm_d795
.asm_d792
ld de, $0015
.asm_d795
push hl
add hl, de
ld a, $7f
ld [hli], a
ld [hli], a
ld [hld], a
dec hl
ld a, [$d1ec]
ld [$d087], a
ld a, [$d1ed]
ld [StringBuffer2], a
ld de, StringBuffer2
ld bc, $0203
call PrintNum
pop hl
ret
; d7b4
Functiond7b4: ; d7b4
ld a, [hCGB]
and a
ret z
ld hl, $d1f0
call SetHPPal
ld a, [$d1f0]
ld c, a
callba Function8c43
ret
; d7c9
Functiond7c9: ; d7c9
ld a, [hCGB]
and a
jr nz, .asm_d7d5
call DelayFrame
call DelayFrame
ret
.asm_d7d5
ld a, [$d10a]
and a
jr z, .asm_d829
cp $1
jr z, .asm_d82d
ld a, [CurPartyMon]
cp $3
jr nc, .asm_d7ea
ld c, $0
jr .asm_d7ec
.asm_d7ea
ld c, $1
.asm_d7ec
push af
cp $2
jr z, .asm_d7ff
cp $5
jr z, .asm_d7ff
ld a, $2
ld [hBGMapMode], a
ld a, c
ld [hBGMapThird], a
call DelayFrame
.asm_d7ff
ld a, $1
ld [hBGMapMode], a
ld a, c
ld [hBGMapThird], a
call DelayFrame
pop af
cp $2
jr z, .asm_d813
cp $5
jr z, .asm_d813
ret
.asm_d813
inc c
ld a, $2
ld [hBGMapMode], a
ld a, c
ld [hBGMapThird], a
call DelayFrame
ld a, $1
ld [hBGMapMode], a
ld a, c
ld [hBGMapThird], a
call DelayFrame
ret
.asm_d829
ld c, $0
jr .asm_d82f
.asm_d82d
ld c, $1
.asm_d82f
call DelayFrame
ld a, c
ld [hBGMapThird], a
call DelayFrame
ret
; d839
Functiond839: ; d839
ld a, [Buffer1]
ld c, a
ld b, $0
ld hl, $0000
ld a, [$d1f1]
cp $30
jr nc, .asm_d885
and a
jr z, .asm_d880
call AddNTimes
ld b, $0
.asm_d851
ld a, l
sub $30
ld l, a
ld a, h
sbc $0
ld h, a
jr c, .asm_d85e
inc b
jr .asm_d851
.asm_d85e
push bc
ld bc, $0080
add hl, bc
pop bc
ld a, l
sub $30
ld l, a
ld a, h
sbc $0
ld h, a
jr c, .asm_d86f
inc b
.asm_d86f
ld a, [$d1f5]
cp b
jr nc, .asm_d87c
ld a, [$d1f6]
cp b
jr c, .asm_d87c
ld a, b
.asm_d87c
ld [$d1ec], a
ret
.asm_d880
xor a
ld [$d1ec], a
ret
.asm_d885
ld a, [Buffer1]
ld [$d1ec], a
ret
; d88c
Functiond88c: ; d88c
ld de, PartyCount
ld a, [MonType]
and $f
jr z, .asm_d899
ld de, OTPartyCount
.asm_d899
ld a, [de]
inc a
cp PARTY_LENGTH + 1
ret nc
ld [de], a
ld a, [de]
ld [$ffae], a
add e
ld e, a
jr nc, .asm_d8a7
inc d
.asm_d8a7
ld a, [CurPartySpecies]
ld [de], a
inc de
ld a, $ff
ld [de], a
ld hl, PartyMonOT
ld a, [MonType]
and $f
jr z, .asm_d8bc
ld hl, OTPartyMonOT
.asm_d8bc
ld a, [$ffae]
dec a
call SkipNames
ld d, h
ld e, l
ld hl, PlayerName
ld bc, NAME_LENGTH
call CopyBytes
ld a, [MonType]
and a
jr nz, .asm_d8f0
ld a, [CurPartySpecies]
ld [$d265], a
call GetPokemonName
ld hl, PartyMonNicknames
ld a, [$ffae]
dec a
call SkipNames
ld d, h
ld e, l
ld hl, StringBuffer1
ld bc, PKMN_NAME_LENGTH
call CopyBytes
.asm_d8f0
ld hl, PartyMon1Species
ld a, [MonType]
and $f
jr z, .asm_d8fd
ld hl, OTPartyMon1Species
.asm_d8fd
ld a, [$ffae]
dec a
ld bc, PartyMon2 - PartyMon1
call AddNTimes
Functiond906: ; d906
ld e, l
ld d, h
push hl
ld a, [CurPartySpecies]
ld [CurSpecies], a
call GetBaseData
ld a, [BaseDexNo]
ld [de], a
inc de
ld a, [IsInBattle]
and a
ld a, $0
jr z, .asm_d922
ld a, [EnemyMonItem]
.asm_d922
ld [de], a
inc de
push de
ld h, d
ld l, e
ld a, [IsInBattle]
and a
jr z, .asm_d943
ld a, [MonType]
and a
jr nz, .asm_d943
ld de, EnemyMonMoves
rept NUM_MOVES + -1
ld a, [de]
inc de
ld [hli], a
endr
ld a, [de]
ld [hl], a
jr .asm_d950
.asm_d943
xor a
rept NUM_MOVES + -1
ld [hli], a
endr
ld [hl], a
ld [Buffer1], a
predef FillMoves
.asm_d950
pop de
inc de
inc de
inc de
inc de
ld a, [PlayerID]
ld [de], a
inc de
ld a, [$d47c]
ld [de], a
inc de
push de
ld a, [CurPartyLevel]
ld d, a
callab Function50e47
pop de
ld a, [hMultiplicand]
ld [de], a
inc de
ld a, [$ffb5]
ld [de], a
inc de
ld a, [$ffb6]
ld [de], a
inc de
xor a
ld b, $a
.asm_d97a
ld [de], a
inc de
dec b
jr nz, .asm_d97a
pop hl
push hl
ld a, [MonType]
and $f
jr z, .asm_d992
push hl
callba GetTrainerDVs
pop hl
jr .asm_d9b5
.asm_d992
ld a, [CurPartySpecies]
ld [$d265], a
dec a
push de
call CheckCaughtMon
ld a, [$d265]
dec a
call SetSeenAndCaughtMon
pop de
pop hl
push hl
ld a, [IsInBattle]
and a
jr nz, .asm_d9f3
call Random
ld b, a
call Random
ld c, a
.asm_d9b5
ld a, b
ld [de], a
inc de
ld a, c
ld [de], a
inc de
push hl
push de
inc hl
inc hl
call FillPP
pop de
pop hl
inc de
inc de
inc de
inc de
ld a, $46
ld [de], a
inc de
xor a
ld [de], a
inc de
ld [de], a
inc de
ld [de], a
inc de
ld a, [CurPartyLevel]
ld [de], a
inc de
xor a
ld [de], a
inc de
ld [de], a
inc de
ld bc, $000a
add hl, bc
ld a, $1
ld c, a
ld b, $0
call Functione17b
ld a, [$ffb5]
ld [de], a
inc de
ld a, [$ffb6]
ld [de], a
inc de
jr .asm_da29
.asm_d9f3
ld a, [EnemyMonDVs]
ld [de], a
inc de
ld a, [EnemyMonDVs + 1]
ld [de], a
inc de
push hl
ld hl, EnemyMonPP
ld b, NUM_MOVES
.asm_da03
ld a, [hli]
ld [de], a
inc de
dec b
jr nz, .asm_da03
pop hl
ld a, BASE_HAPPINESS
ld [de], a
inc de
xor a
ld [de], a
inc de
ld [de], a
inc de
ld [de], a
inc de
ld a, [CurPartyLevel]
ld [de], a
inc de
ld hl, EnemyMonStatus
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
inc de
.asm_da29
ld a, [IsInBattle]
dec a
jr nz, .asm_da3b
ld hl, EnemyMonMaxHP
ld bc, $000c
call CopyBytes
pop hl
jr .asm_da45
.asm_da3b
pop hl
ld bc, $000a
add hl, bc
ld b, $0
call Functione167
.asm_da45
ld a, [MonType]
and $f
jr nz, .asm_da6b
ld a, [CurPartySpecies]
cp UNOWN
jr nz, .asm_da6b
ld hl, PartyMon1DVs
ld a, [PartyCount]
dec a
ld bc, PartyMon2 - PartyMon1
call AddNTimes
predef GetUnownLetter
callab Functionfba18
.asm_da6b
scf
ret
; da6d
FillPP: ; da6d
push bc
ld b, $4
.asm_da70
ld a, [hli]
and a
jr z, .asm_da8f
dec a
push hl
push de
push bc
ld hl, Moves
ld bc, MOVE_LENGTH
call AddNTimes
ld de, StringBuffer1
ld a, BANK(Moves)
call FarCopyBytes
pop bc
pop de
pop hl
ld a, [$d078]
.asm_da8f
ld [de], a
inc de
dec b
jr nz, .asm_da70
pop bc
ret
; da96
Functionda96: ; da96
ld hl, PartyCount
ld a, [hl]
cp PARTY_LENGTH
scf
ret z
inc a
ld [hl], a
ld c, a
ld b, 0
add hl, bc
ld a, [CurPartySpecies]
ld [hli], a
ld [hl], $ff
ld hl, PartyMon1Species
ld a, [PartyCount]
dec a
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld e, l
ld d, h
ld hl, TempMonSpecies
call CopyBytes
ld hl, PartyMonOT
ld a, [PartyCount]
dec a
call SkipNames
ld d, h
ld e, l
ld hl, OTPartyMonOT
ld a, [CurPartyMon]
call SkipNames
ld bc, NAME_LENGTH
call CopyBytes
ld hl, PartyMonNicknames
ld a, [PartyCount]
dec a
call SkipNames
ld d, h
ld e, l
ld hl, OTPartyMonNicknames
ld a, [CurPartyMon]
call SkipNames
ld bc, PKMN_NAME_LENGTH
call CopyBytes
ld a, [CurPartySpecies]
ld [$d265], a
cp EGG
jr z, .owned
dec a
call SetSeenAndCaughtMon
ld hl, PartyMon1Happiness
ld a, [PartyCount]
dec a
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld [hl], BASE_HAPPINESS
.owned
ld a, [CurPartySpecies]
cp UNOWN
jr nz, .done
ld hl, PartyMon1DVs
ld a, [PartyCount]
dec a
ld bc, PartyMon2 - PartyMon1
call AddNTimes
predef GetUnownLetter
callab Functionfba18
ld a, [$def4]
and a
jr nz, .done
ld a, [UnownLetter]
ld [$def4], a
.done
and a
ret
; db3f
Functiondb3f: ; db3f
ld a, $1
call GetSRAMBank
ld a, [$d10b]
and a
jr z, .asm_db60
cp $2
jr z, .asm_db60
cp $3
ld hl, wBreedMon1Species
jr z, .asm_db9b
ld hl, sBoxCount
ld a, [hl]
cp MONS_PER_BOX
jr nz, .asm_db69
jp Functiondcb1
.asm_db60
ld hl, PartyCount
ld a, [hl]
cp PARTY_LENGTH
jp z, Functiondcb1
.asm_db69
inc a
ld [hl], a
ld c, a
ld b, 0
add hl, bc
ld a, [$d10b]
cp $2
ld a, [wBreedMon1Species]
jr z, .asm_db7c
ld a, [CurPartySpecies]
.asm_db7c
ld [hli], a
ld [hl], $ff
ld a, [$d10b]
dec a
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
ld a, [PartyCount]
jr nz, .asm_db97
ld hl, sBoxMon1Species
ld bc, sBoxMon1End - sBoxMon1
ld a, [sBoxCount]
.asm_db97
dec a
call AddNTimes
.asm_db9b
push hl
ld e, l
ld d, h
ld a, [$d10b]
and a
ld hl, sBoxMon1Species
ld bc, sBoxMon1End - sBoxMon1
jr z, .asm_dbb7
cp $2
ld hl, wBreedMon1Species
jr z, .asm_dbbd
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
.asm_dbb7
ld a, [CurPartyMon]
call AddNTimes
.asm_dbbd
ld bc, sBoxMon1End - sBoxMon1
call CopyBytes
ld a, [$d10b]
cp $3
ld de, wBreedMon1OT
jr z, .asm_dbe2
dec a
ld hl, PartyMonOT
ld a, [PartyCount]
jr nz, .asm_dbdc
ld hl, sBoxMonOT
ld a, [sBoxCount]
.asm_dbdc
dec a
call SkipNames
ld d, h
ld e, l
.asm_dbe2
ld hl, sBoxMonOT
ld a, [$d10b]
and a
jr z, .asm_dbf5
ld hl, wBreedMon1OT
cp $2
jr z, .asm_dbfb
ld hl, PartyMonOT
.asm_dbf5
ld a, [CurPartyMon]
call SkipNames
.asm_dbfb
ld bc, NAME_LENGTH
call CopyBytes
ld a, [$d10b]
cp $3
ld de, wBreedMon1Nick
jr z, .asm_dc20
dec a
ld hl, PartyMonNicknames
ld a, [PartyCount]
jr nz, .asm_dc1a
ld hl, sBoxMonNicknames
ld a, [sBoxCount]
.asm_dc1a
dec a
call SkipNames
ld d, h
ld e, l
.asm_dc20
ld hl, sBoxMonNicknames
ld a, [$d10b]
and a
jr z, .asm_dc33
ld hl, wBreedMon1Nick
cp $2
jr z, .asm_dc39
ld hl, PartyMonNicknames
.asm_dc33
ld a, [CurPartyMon]
call SkipNames
.asm_dc39
ld bc, PKMN_NAME_LENGTH
call CopyBytes
pop hl
ld a, [$d10b]
cp $1
jr z, .asm_dca4
cp $3
jp z, .asm_dcac
push hl
srl a
add $2
ld [MonType], a
predef Function5084a
callab Function50e1b
ld a, d
ld [CurPartyLevel], a
pop hl
ld b, h
ld c, l
ld hl, $001f
add hl, bc
ld [hl], a
ld hl, $0024
add hl, bc
ld d, h
ld e, l
ld hl, $000a
add hl, bc
push bc
ld b, $1
call Functione167
pop bc
ld a, [$d10b]
and a
jr nz, .asm_dcac
ld hl, $0020
add hl, bc
xor a
ld [hl], a
ld hl, $0022
add hl, bc
ld d, h
ld e, l
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_dc9e
inc hl
inc hl
ld a, [hli]
ld [de], a
ld a, [hl]
inc de
ld [de], a
jr .asm_dcac
.asm_dc9e
xor a
ld [de], a
inc de
ld [de], a
jr .asm_dcac
.asm_dca4
ld a, [sBoxCount]
dec a
ld b, a
call Functiondcb6
.asm_dcac
call CloseSRAM
and a
ret
; dcb1
Functiondcb1: ; dcb1
call CloseSRAM
scf
ret
; dcb6
Functiondcb6: ; dcb6
ld a, b
ld hl, sBoxMons
ld bc, sBoxMon1End - sBoxMon1
call AddNTimes
ld b, h
ld c, l
ld hl, sBoxMon1PP - sBoxMon1
add hl, bc
push hl
push bc
ld de, TempMonPP
ld bc, NUM_MOVES
call CopyBytes
pop bc
ld hl, sBoxMon1Moves - sBoxMon1
add hl, bc
push hl
ld de, TempMonMoves
ld bc, NUM_MOVES
call CopyBytes
pop hl
pop de
ld a, [$cfa9]
push af
ld a, [MonType]
push af
ld b, 0
.asm_dcec
ld a, [hli]
and a
jr z, .asm_dd18
ld [TempMonMoves+0], a
ld a, BOXMON
ld [MonType], a
ld a, b
ld [$cfa9], a
push bc
push hl
push de
callba Functionf8ec
pop de
pop hl
ld a, [$d265]
ld b, a
ld a, [de]
and $c0
add b
ld [de], a
pop bc
inc de
inc b
ld a, b
cp NUM_MOVES
jr c, .asm_dcec
.asm_dd18
pop af
ld [MonType], a
pop af
ld [$cfa9], a
ret
; dd21
Functiondd21: ; dd21
ld a, [wBreedMon1Species]
ld [CurPartySpecies], a
ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
call Functione698
ld a, b
ld [DefaultFlypoint], a
ld a, e
ld [CurPartyLevel], a
xor a
ld [$d10b], a
jp Functiondd64
; dd42
Functiondd42: ; dd42
ld a, [wBreedMon2Species]
ld [CurPartySpecies], a
ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
call Functione6b3
ld a, b
ld [DefaultFlypoint], a
ld a, e
ld [CurPartyLevel], a
ld a, $1
ld [$d10b], a
jp Functiondd64
; dd64
Functiondd64: ; dd64
ld hl, PartyCount
ld a, [hl]
cp PARTY_LENGTH
jr nz, .asm_dd6e
scf
ret
.asm_dd6e
inc a
ld [hl], a
ld c, a
ld b, 0
add hl, bc
ld a, [$d10b]
and a
ld a, [wBreedMon1Species]
ld de, wBreedMon1Nick
jr z, .asm_dd86
ld a, [wBreedMon2Species]
ld de, wBreedMon2Nick
.asm_dd86
ld [hli], a
ld [CurSpecies], a
ld a, $ff
ld [hl], a
ld hl, PartyMonNicknames
ld a, [PartyCount]
dec a
call SkipNames
push hl
ld h, d
ld l, e
pop de
call CopyBytes
push hl
ld hl, PartyMonOT
ld a, [PartyCount]
dec a
call SkipNames
ld d, h
ld e, l
pop hl
call CopyBytes
push hl
call Functionde1a
pop hl
ld bc, $0020
call CopyBytes
call GetBaseData
call Functionde1a
ld b, d
ld c, e
ld hl, $001f
add hl, bc
ld a, [CurPartyLevel]
ld [hl], a
ld hl, $0024
add hl, bc
ld d, h
ld e, l
ld hl, $000a
add hl, bc
push bc
ld b, $1
call Functione167
ld hl, PartyMon1Moves
ld a, [PartyCount]
dec a
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld d, h
ld e, l
ld a, $1
ld [Buffer1], a
predef FillMoves
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
callba Functionc677
ld a, [CurPartyLevel]
ld d, a
callab Function50e47
pop bc
ld hl, $0008
add hl, bc
ld a, [hMultiplicand]
ld [hli], a
ld a, [$ffb5]
ld [hli], a
ld a, [$ffb6]
ld [hl], a
and a
ret
; de1a
Functionde1a: ; de1a
ld a, [PartyCount]
dec a
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld d, h
ld e, l
ret
; de2a
Functionde2a: ; de2a
ld de, wBreedMon1Nick
call Functionde44
xor a
ld [$d10b], a
jp Functione039
; de37
Functionde37: ; de37
ld de, wBreedMon2Nick
call Functionde44
xor a
ld [$d10b], a
jp Functione039
; de44
Functionde44: ; de44
ld a, [CurPartyMon]
ld hl, PartyMonNicknames
call SkipNames
call CopyBytes
ld a, [CurPartyMon]
ld hl, PartyMonOT
call SkipNames
call CopyBytes
ld a, [CurPartyMon]
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld bc, sBoxMon1End - sBoxMon1
jp CopyBytes
; de6e
Functionde6e: ; de6e
ld a, 1 ; BANK(sBoxCount)
call GetSRAMBank
ld de, sBoxCount
ld a, [de]
cp MONS_PER_BOX
jp nc, Functiondf42
inc a
ld [de], a
ld a, [CurPartySpecies]
ld [CurSpecies], a
ld c, a
.asm_de85
inc de
ld a, [de]
ld b, a
ld a, c
ld c, b
ld [de], a
inc a
jr nz, .asm_de85
call GetBaseData
call ShiftBoxMon
ld hl, PlayerName
ld de, sBoxMonOT
ld bc, NAME_LENGTH
call CopyBytes
ld a, [CurPartySpecies]
ld [$d265], a
call GetPokemonName
ld de, sBoxMonNicknames
ld hl, StringBuffer1
ld bc, PKMN_NAME_LENGTH
call CopyBytes
ld hl, EnemyMon
ld de, sBoxMon1
ld bc, 1 + 1 + NUM_MOVES ; species + item + moves
call CopyBytes
ld hl, PlayerID
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
push de
ld a, [CurPartyLevel]
ld d, a
callab Function50e47
pop de
ld a, [hMultiplicand]
ld [de], a
inc de
ld a, [$ffb5]
ld [de], a
inc de
ld a, [$ffb6]
ld [de], a
inc de
xor a
ld b, $a
.asm_dee5
ld [de], a
inc de
dec b
jr nz, .asm_dee5
ld hl, EnemyMonDVs
ld b, 2 + NUM_MOVES ; DVs and PP ; EnemyMonHappiness - EnemyMonDVs
.asm_deef
ld a, [hli]
ld [de], a
inc de
dec b
jr nz, .asm_deef
ld a, BASE_HAPPINESS
ld [de], a
inc de
xor a
ld [de], a
inc de
ld [de], a
inc de
ld [de], a
inc de
ld a, [CurPartyLevel]
ld [de], a
ld a, [CurPartySpecies]
dec a
call SetSeenAndCaughtMon
ld a, [CurPartySpecies]
cp UNOWN
jr nz, .asm_df20
ld hl, sBoxMon1DVs
predef GetUnownLetter
callab Functionfba18
.asm_df20
ld hl, sBoxMon1Moves
ld de, TempMonMoves
ld bc, NUM_MOVES
call CopyBytes
ld hl, sBoxMon1PP
ld de, TempMonPP
ld bc, NUM_MOVES
call CopyBytes
ld b, 0
call Functiondcb6
call CloseSRAM
scf
ret
; df42
Functiondf42: ; df42
call CloseSRAM
and a
ret
; df47
ShiftBoxMon: ; df47
ld hl, sBoxMonOT
ld bc, NAME_LENGTH
call .asm_df5f
ld hl, sBoxMonNicknames
ld bc, PKMN_NAME_LENGTH
call .asm_df5f
ld hl, sBoxMons
ld bc, sBoxMon1End - sBoxMon1
.asm_df5f
ld a, [sBoxCount]
cp 2
ret c
push hl
call AddNTimes
dec hl
ld e, l
ld d, h
pop hl
ld a, [sBoxCount]
dec a
call AddNTimes
dec hl
push hl
ld a, [sBoxCount]
dec a
ld hl, 0
call AddNTimes
ld c, l
ld b, h
pop hl
.loop
ld a, [hld]
ld [de], a
dec de
dec bc
ld a, c
or b
jr nz, .loop
ret
; df8c
GiveEgg:: ; df8c
ld a, [CurPartySpecies]
push af
callab GetPreEvolution
callab GetPreEvolution
ld a, [CurPartySpecies]
dec a
push af
call CheckCaughtMon
pop af
push bc
call CheckSeenMon
push bc
call Functiond88c
pop bc
ld a, c
and a
jr nz, .asm_dfc3
ld a, [CurPartySpecies]
dec a
ld c, a
ld d, $0
ld hl, PokedexCaught
ld b, $0
predef FlagPredef
.asm_dfc3
pop bc
ld a, c
and a
jr nz, .asm_dfd9
ld a, [CurPartySpecies]
dec a
ld c, a
ld d, $0
ld hl, PokedexSeen
ld b, $0
predef FlagPredef
.asm_dfd9
pop af
ld [CurPartySpecies], a
ld a, [PartyCount]
dec a
ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1Species
call AddNTimes
ld a, [CurPartySpecies]
ld [hl], a
ld hl, PartyCount
ld a, [hl]
ld b, 0
ld c, a
add hl, bc
ld a, EGG
ld [hl], a
ld a, [PartyCount]
dec a
ld hl, PartyMonNicknames
call SkipNames
ld de, Stringe035
call CopyName2
ld a, [PartyCount]
dec a
ld hl, PartyMon1Happiness
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld a, [$c2cc]
bit 1, a
ld a, $1
jr nz, .asm_e022
ld a, [BaseEggSteps]
.asm_e022
ld [hl], a
ld a, [PartyCount]
dec a
ld hl, PartyMon1HP
ld bc, PartyMon2 - PartyMon1
call AddNTimes
xor a
ld [hli], a
ld [hl], a
and a
ret
; e035
Stringe035: ; e035
db "EGG@"
; e039
Functione039: ; e039
ld hl, PartyCount
ld a, [$d10b]
and a
jr z, .asm_e04a
ld a, 1 ; BANK(sBoxCount)
call GetSRAMBank
ld hl, sBoxCount
.asm_e04a
ld a, [hl]
dec a
ld [hli], a
ld a, [CurPartyMon]
ld c, a
ld b, 0
add hl, bc
ld e, l
ld d, h
inc de
.asm_e057
ld a, [de]
inc de
ld [hli], a
inc a
jr nz, .asm_e057
ld hl, PartyMonOT
ld d, PARTY_LENGTH - 1
ld a, [$d10b]
and a
jr z, .asm_e06d
ld hl, sBoxMonOT
ld d, MONS_PER_BOX - 1
.asm_e06d
ld a, [CurPartyMon]
call SkipNames
ld a, [CurPartyMon]
cp d
jr nz, .asm_e07e
ld [hl], $ff
jp .asm_60f0
.asm_e07e
ld d, h
ld e, l
ld bc, PKMN_NAME_LENGTH
add hl, bc
ld bc, PartyMonNicknames
ld a, [$d10b]
and a
jr z, .asm_e090
ld bc, sBoxMonNicknames
.asm_e090
call CopyDataUntil
ld hl, PartyMons
ld bc, PartyMon2 - PartyMon1
ld a, [$d10b]
and a
jr z, .asm_e0a5
ld hl, sBoxMons
ld bc, sBoxMon1End - sBoxMon1
.asm_e0a5
ld a, [CurPartyMon]
call AddNTimes
ld d, h
ld e, l
ld a, [$d10b]
and a
jr z, .asm_e0bc
ld bc, sBoxMon1End - sBoxMon1
add hl, bc
ld bc, sBoxMonOT
jr .asm_e0c3
.asm_e0bc
ld bc, PartyMon2 - PartyMon1
add hl, bc
ld bc, PartyMonOT
.asm_e0c3
call CopyDataUntil
ld hl, PartyMonNicknames
ld a, [$d10b]
and a
jr z, .asm_e0d2
ld hl, sBoxMonNicknames
.asm_e0d2
ld bc, PKMN_NAME_LENGTH
ld a, [CurPartyMon]
call AddNTimes
ld d, h
ld e, l
ld bc, PKMN_NAME_LENGTH
add hl, bc
ld bc, PartyMonNicknamesEnd
ld a, [$d10b]
and a
jr z, .asm_e0ed
ld bc, sBoxMonNicknamesEnd
.asm_e0ed
call CopyDataUntil
.asm_60f0
ld a, [$d10b]
and a
jp nz, CloseSRAM
ld a, [InLinkBattle]
and a
ret nz
ld a, $0
call GetSRAMBank
ld hl, PartyCount
ld a, [CurPartyMon]
cp [hl]
jr z, .asm_e131
ld hl, $a600
ld bc, $002f
call AddNTimes
push hl
add hl, bc
pop de
ld a, [CurPartyMon]
ld b, a
.asm_e11a
push bc
push hl
ld bc, $002f
call CopyBytes
pop hl
push hl
ld bc, $002f
add hl, bc
pop de
pop bc
inc b
ld a, [PartyCount]
cp b
jr nz, .asm_e11a
.asm_e131
jp CloseSRAM
; e134
Functione134: ; e134
ld a, $1f
call GetPartyParamLocation
ld a, [hl]
ld [$001f], a
ld a, $0
call GetPartyParamLocation
ld a, [hl]
ld [CurSpecies], a
call GetBaseData
ld a, $24
call GetPartyParamLocation
ld d, h
ld e, l
push de
ld a, $a
call GetPartyParamLocation
ld b, $1
call Functione167
pop de
ld a, $22
call GetPartyParamLocation
ld a, [de]
inc de
ld [hli], a
ld a, [de]
ld [hl], a
ret
; e167
Functione167: ; e167
ld c, $0
.asm_e169
inc c
call Functione17b
ld a, [$ffb5]
ld [de], a
inc de
ld a, [$ffb6]
ld [de], a
inc de
ld a, c
cp $6
jr nz, .asm_e169
ret
; e17b
Functione17b: ; e17b
push hl
push de
push bc
ld a, b
ld d, a
push hl
ld hl, BaseHP
dec hl
ld b, $0
add hl, bc
ld a, [hl]
ld e, a
pop hl
push hl
ld a, c
cp $6
jr nz, .asm_e193
dec hl
dec hl
.asm_e193
sla c
ld a, d
and a
jr z, .asm_e1a5
add hl, bc
push de
ld a, [hld]
ld e, a
ld d, [hl]
callba GetSquareRoot
pop de
.asm_e1a5
srl c
pop hl
push bc
ld bc, $000b
add hl, bc
pop bc
ld a, c
cp $2
jr z, .asm_e1e3
cp $3
jr z, .asm_e1ea
cp $4
jr z, .asm_e1ef
cp $5
jr z, .asm_e1f7
cp $6
jr z, .asm_e1f7
push bc
ld a, [hl]
swap a
and $1
add a
add a
add a
ld b, a
ld a, [hli]
and $1
add a
add a
add b
ld b, a
ld a, [hl]
swap a
and $1
add a
add b
ld b, a
ld a, [hl]
and $1
add b
pop bc
jr .asm_e1fb
.asm_e1e3
ld a, [hl]
swap a
and $f
jr .asm_e1fb
.asm_e1ea
ld a, [hl]
and $f
jr .asm_e1fb
.asm_e1ef
inc hl
ld a, [hl]
swap a
and $f
jr .asm_e1fb
.asm_e1f7
inc hl
ld a, [hl]
and $f
.asm_e1fb
ld d, $0
add e
ld e, a
jr nc, .asm_e202
inc d
.asm_e202
sla e
rl d
srl b
srl b
ld a, b
add e
jr nc, .asm_e20f
inc d
.asm_e20f
ld [$ffb6], a
ld a, d
ld [$ffb5], a
xor a
ld [hMultiplicand], a
ld a, [CurPartyLevel]
ld [hMultiplier], a
call Multiply
ld a, [hMultiplicand]
ld [hProduct], a
ld a, [$ffb5]
ld [hMultiplicand], a
ld a, [$ffb6]
ld [$ffb5], a
ld a, $64
ld [hMultiplier], a
ld a, $3
ld b, a
call Divide
ld a, c
cp $1
ld a, $5
jr nz, .asm_e24e
ld a, [CurPartyLevel]
ld b, a
ld a, [$ffb6]
add b
ld [$ffb6], a
jr nc, .asm_e24c
ld a, [$ffb5]
inc a
ld [$ffb5], a
.asm_e24c
ld a, $a
.asm_e24e
ld b, a
ld a, [$ffb6]
add b
ld [$ffb6], a
jr nc, .asm_e25b
ld a, [$ffb5]
inc a
ld [$ffb5], a
.asm_e25b
ld a, [$ffb5]
cp $4
jr nc, .asm_e26b
cp $3
jr c, .asm_e273
ld a, [$ffb6]
cp $e8
jr c, .asm_e273
.asm_e26b
ld a, $3
ld [$ffb5], a
ld a, $e7
ld [$ffb6], a
.asm_e273
pop bc
pop de
pop hl
ret
; e277
Functione277:: ; e277
push de
push bc
xor a
ld [MonType], a
call Functiond88c
jr nc, .asm_e2b0
ld hl, PartyMonNicknames
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
call SkipNames
ld d, h
ld e, l
pop bc
ld a, b
ld b, $0
push bc
push de
push af
ld a, [CurItem]
and a
jr z, .asm_e2e1
ld a, [CurPartyMon]
ld hl, PartyMon1Item
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld a, [CurItem]
ld [hl], a
jr .asm_e2e1
.asm_e2b0
ld a, [CurPartySpecies]
ld [TempEnemyMonSpecies], a
callab LoadEnemyMon
call Functionde6e
jp nc, Functione3d4
ld a, $2
ld [MonType], a
xor a
ld [CurPartyMon], a
ld de, $d050
pop bc
ld a, b
ld b, $1
push bc
push de
push af
ld a, [CurItem]
and a
jr z, .asm_e2e1
ld a, [CurItem]
ld [sBoxMon1Item], a
.asm_e2e1
ld a, [CurPartySpecies]
ld [$d265], a
ld [TempEnemyMonSpecies], a
call GetPokemonName
ld hl, StringBuffer1
ld de, $d050
ld bc, $000b
call CopyBytes
pop af
and a
jp z, .asm_e390
pop de
pop bc
pop hl
push bc
push hl
ld a, [ScriptBank]
call GetFarHalfword
ld bc, $000b
ld a, [ScriptBank]
call FarCopyBytes
pop hl
inc hl
inc hl
ld a, [ScriptBank]
call GetFarHalfword
pop bc
ld a, b
and a
push de
push bc
jr nz, .asm_e35e
push hl
ld a, [CurPartyMon]
ld hl, PartyMonOT
call SkipNames
ld d, h
ld e, l
pop hl
.asm_e32f
ld a, [ScriptBank]
call GetFarByte
ld [de], a
inc hl
inc de
cp $50
jr nz, .asm_e32f
ld a, [ScriptBank]
call GetFarByte
ld b, a
push bc
ld a, [CurPartyMon]
ld hl, PartyMon1ID
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld a, $3
ld [hli], a
ld [hl], $e9
pop bc
callba Function4dba3
jr .asm_e3b2
.asm_e35e
ld a, $1
call GetSRAMBank
ld de, sBoxMonOT
.asm_e366
ld a, [ScriptBank]
call GetFarByte
ld [de], a
inc hl
inc de
cp $50
jr nz, .asm_e366
ld a, [ScriptBank]
call GetFarByte
ld b, a
ld hl, sBoxMon1ID
call Random
ld [hli], a
call Random
ld [hl], a
call CloseSRAM
callba Function4db92
jr .asm_e3b2
.asm_e390
pop de
pop bc
push bc
push de
ld a, b
and a
jr z, .asm_e3a0
callba Function4db83
jr .asm_e3a6
.asm_e3a0
callba Function4db49
.asm_e3a6
callba Function4db3b
pop de
jr c, .asm_e3b2
call Functione3de
.asm_e3b2
pop bc
pop de
ld a, b
and a
ret z
ld hl, UnknownText_0xe3d9
call PrintText
ld a, $1
call GetSRAMBank
ld hl, $d050
ld de, sBoxMonNicknames
ld bc, $000b
call CopyBytes
call CloseSRAM
ld b, $1
ret
; e3d4
Functione3d4: ; e3d4
pop bc
pop de
ld b, $2
ret
; e3d9
UnknownText_0xe3d9: ; 0xe3d9
; was sent to BILL's PC.
text_jump UnknownText_0x1c0feb
db "@"
; 0xe3de
Functione3de: ; e3de
push de
call Function1d6e
call Function2ed3
pop de
push de
ld b, $0
callba Function116c1
pop hl
ld de, StringBuffer1
call InitName
ld a, $4
ld hl, Function2b4d
rst FarCall
ret
; e3fd
Functione3fd: ; e3fd
call Functione40a
ret c
call Functione41c
call Functione443
jp Functione43f
Functione40a: ; e40a (3:640a)
ld a, [PartyCount] ; $dcd7
and a
ret nz
ld hl, UnknownText_0xe417
call Function1d67
scf
ret
; e417 (3:6417)
UnknownText_0xe417: ; 0xe417
; You gotta have #MON to call!
text_jump UnknownText_0x1c1006
db "@"
; 0xe41c
Functione41c: ; e41c (3:641c)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function1d6e
call ClearPCItemScreen
ld hl, Options ; $cfcc
ld a, [hl]
push af
set 4, [hl]
ld hl, UnknownText_0xe43a
call PrintText
pop af
ld [Options], a ; $cfcc
call Functione58
ret
; e43a (3:643a)
UnknownText_0xe43a: ; 0xe43a
; What?
text_jump UnknownText_0x1c1024
db "@"
; 0xe43f
Functione43f: ; e43f (3:643f)
call Function2b3c
ret
Functione443: ; e443 (3:6443)
ld hl, MenuDataHeader_0xe46f
call LoadMenuDataHeader
ld a, $1
.asm_e44b
ld [$cf88], a
call Function32f9
xor a
ld [$cf76], a
ld [hBGMapMode], a ; $ff00+$d4
call Function1e5d
jr c, .asm_e46b
ld a, [$cf88]
push af
ld a, [MenuSelection] ; $cf74
ld hl, Jumptable_e4ba
rst JumpTable
pop bc
ld a, b
jr nc, .asm_e44b
.asm_e46b
call Function1c17
ret
; e46f (3:646f)
MenuDataHeader_0xe46f: ; 0xe46f
db $40 ; flags
db 00, 00 ; start coords
db 17, 19 ; end coords
dw MenuData2_0xe477
db 1 ; default option
; 0xe477
MenuData2_0xe477: ; 0xe477
db $80 ; flags
db 0 ; items
dw MenuItems_e4c4
dw Function1f79
dw Strings_e47f
; 0xe47f
Strings_e47f: ; e47f
db "WITHDRAW ", $e1, $e2, "@"
db "DEPOSIT ", $e1, $e2, "@"
db "CHANGE BOX@"
db "MOVE ", $e1, $e2, " W/O MAIL@"
db "SEE YA!@"
Jumptable_e4ba: ; e4ba (3:64ba)
dw Functione559
dw Functione4fe
dw Functione583
dw Functione4cd
dw Functione4cb
; e4c4
MenuItems_e4c4: ; e4c4
db 5
db 0 ; WITHDRAW
db 1; DEPOSIT
db 2 ; CHANGE BOX
db 3 ; MOVE PKMN
db 4 ; SEE YA!
db -1
; e4cb
Functione4cb: ; e4cb
scf
ret
; e4cd
Functione4cd: ; e4cd
call Function1d6e
callba Function44781
jr nc, .asm_e4e0
ld hl, UnknownText_0xe4f9
call PrintText
jr .asm_e4f4
.asm_e4e0
callba Function14b34
jr c, .asm_e4f4
callba Functione2759
call Function222a
call ClearPCItemScreen
.asm_e4f4
call Function1c17
and a
ret
; e4f9
UnknownText_0xe4f9: ; 0xe4f9
; There is a #MON holding MAIL. Please remove the MAIL.
text_jump UnknownText_0x1c102b
db "@"
; 0xe4fe
Functione4fe: ; e4fe (3:64fe)
call Function1d6e
callba Functione2391
call Function222a
call ClearPCItemScreen
call Function1c17
and a
ret
; e512 (3:6512)
Functione512: ; e512
ld a, [PartyCount]
and a
jr z, .asm_e51e
cp 2
jr c, .asm_e526
and a
ret
.asm_e51e
ld hl, UnknownText_0xe52e
call Function1d67
scf
ret
.asm_e526
ld hl, UnknownText_0xe533
call Function1d67
scf
ret
; e52e
UnknownText_0xe52e: ; 0xe52e
; You don't have a single #MON!
text_jump UnknownText_0x1c1062
db "@"
; 0xe533
UnknownText_0xe533: ; 0xe533
; You can't deposit your last #MON!
text_jump UnknownText_0x1c1080
db "@"
; 0xe538
Functione538: ; e538
ld hl, PartyMon1HP
ld de, PartyMon2 - PartyMon1
ld b, $0
.asm_e540
ld a, [CurPartyMon]
cp b
jr z, .asm_e54b
ld a, [hli]
or [hl]
jr nz, .asm_e557
dec hl
.asm_e54b
inc b
ld a, [PartyCount]
cp b
jr z, .asm_e555
add hl, de
jr .asm_e540
.asm_e555
scf
ret
.asm_e557
and a
ret
; e559
Functione559: ; e559 (3:6559)
call Function1d6e
callba Functione2583
call Function222a
call ClearPCItemScreen
call Function1c17
and a
ret
; e56d (3:656d)
Functione56d: ; e56d
ld a, [PartyCount]
cp PARTY_LENGTH
jr nc, .asm_e576
and a
ret
.asm_e576
ld hl, UnknownText_0xe57e
call Function1d67
scf
ret
; e57e
UnknownText_0xe57e: ; 0xe57e
; You can't take any more #MON.
text_jump UnknownText_0x1c10a2
db "@"
; 0xe583
Functione583: ; e583 (3:6583)
callba Functione35aa
and a
ret
ClearPCItemScreen: ; e58b
call Function2ed3
xor a
ld [hBGMapMode], a
call WhiteBGMap
call ClearSprites
ld hl, TileMap
ld bc, 18 * 20
ld a, " "
call ByteFill
hlcoord 0,0
ld bc, $0a12
call TextBox
hlcoord 0,12
ld bc, $0412
call TextBox
call Function3200
call Function32f9 ; load regular palettes?
ret
; 0xe5bb
Functione5bb: ; e5bb
ld a, [CurPartyMon]
ld hl, sBoxMon1Species
ld bc, $0020
call AddNTimes
ld de, TempMonSpecies
ld bc, $0020
ld a, $1
call GetSRAMBank
call CopyBytes
call CloseSRAM
ret
; e5d9
Functione5d9: ; e5d9
ld a, [wCurBox]
cp b
jr z, .asm_e5f1
ld a, b
ld hl, Unknown_e66e
ld bc, $0003
call AddNTimes
ld a, [hli]
push af
ld a, [hli]
ld h, [hl]
ld l, a
pop af
jr .asm_e5f6
.asm_e5f1
ld a, $1
ld hl, sBoxCount
.asm_e5f6
call GetSRAMBank
ld a, [hl]
ld bc, $0016
add hl, bc
ld b, a
ld c, $0
ld de, $c608
ld a, b
and a
jr z, .asm_e66a
.asm_e608
push hl
push bc
ld a, c
ld bc, $0000
add hl, bc
ld bc, $0020
call AddNTimes
ld a, [hl]
ld [de], a
inc de
ld [CurSpecies], a
call GetBaseData
pop bc
pop hl
push hl
push bc
ld a, c
ld bc, $035c
add hl, bc
call SkipNames
call CopyBytes
pop bc
pop hl
push hl
push bc
ld a, c
ld bc, $001f
add hl, bc
ld bc, $0020
call AddNTimes
ld a, [hl]
ld [de], a
inc de
pop bc
pop hl
push hl
push bc
ld a, c
ld bc, $0015
add hl, bc
ld bc, $0020
call AddNTimes
ld a, [hli]
and $f0
ld b, a
ld a, [hl]
and $f0
swap a
or b
ld b, a
ld a, [BaseGender]
cp b
ld a, $1
jr c, .asm_e662
xor a
.asm_e662
ld [de], a
inc de
pop bc
pop hl
inc c
dec b
jr nz, .asm_e608
.asm_e66a
call CloseSRAM
ret
; e66e
Unknown_e66e: ; e66e
dbw 2, $a000
dbw 2, $a450
dbw 2, $a8a0
dbw 2, $acf0
dbw 2, $b140
dbw 2, $b590
dbw 2, $b9e0
dbw 3, $a000
dbw 3, $a450
dbw 3, $a8a0
dbw 3, $acf0
dbw 3, $b140
dbw 3, $b590
dbw 3, $b9e0
; e698
Functione698: ; e698
ld hl, wBreedMon1Species
ld de, TempMonSpecies
ld bc, $0020
call CopyBytes
callab Function50e1b
ld a, [$df2b]
ld b, a
ld a, d
ld e, a
sub b
ld d, a
ret
; e6b3
Functione6b3: ; e6b3
ld hl, wBreedMon2Species
ld de, TempMonSpecies
ld bc, $0020
call CopyBytes
callab Function50e1b
ld a, [$df64]
ld b, a
ld a, d
ld e, a
sub b
ld d, a
ret
; e6ce
Functione6ce: ; e6ce
ld a, [$df9c]
and a
jr z, .asm_e6ea
ld [$d265], a
callba Functioncc0c7
callba Functioncc000
lb bc, 14, 7
call PlaceYesNoBox
ret c
.asm_e6ea
call Functione6fd
ld a, [TempEnemyMonSpecies]
ld [$d265], a
call GetPokemonName
ld hl, UnknownText_0xe71d
call PrintText
ret
; e6fd
Functione6fd: ; e6fd
ld a, [TempEnemyMonSpecies]
ld [CurSpecies], a
ld [CurPartySpecies], a
call GetBaseData
xor a
ld bc, PartyMon2 - PartyMon1
ld hl, $df9c
call ByteFill
xor a
ld [MonType], a
ld hl, $df9c
jp Functiond906
; e71d
UnknownText_0xe71d: ; 0xe71d
; Caught @ !
text_jump UnknownText_0x1c10c0
db "@"
; 0xe722
INCLUDE "items/item_effects.asm"
GetPokeBallWobble: ; f971 (3:7971)
; Returns whether a Poke Ball will wobble in the catch animation.
; Whether a Pokemon is caught is determined beforehand.
push de
ld a, [rSVBK]
ld d, a
push de
ld a, 1 ; BANK(Buffer2)
ld [rSVBK], a
ld a, [Buffer2]
inc a
ld [Buffer2], a
; Wobble up to 3 times.
cp 3 + 1
jr z, .finished
ld a, [$c64e]
and a
ld c, 0 ; next
jr nz, .done
ld hl, WobbleChances
ld a, [Buffer1]
ld b, a
.loop
ld a, [hli]
cp b
jr nc, .checkwobble
inc hl
jr .loop
.checkwobble
ld b, [hl]
call Random
cp b
ld c, 0 ; next
jr c, .done
ld c, 2 ; escaped
jr .done
.finished
ld a, [$c64e]
and a
ld c, 1 ; caught
jr nz, .done
ld c, 2 ; escaped
.done
pop de
ld e, a
ld a, d
ld [rSVBK], a
ld a, e
pop de
ret
; f9ba (3:79ba)
WobbleChances: ; f9ba
; catch rate, chance of wobbling / 255
db 1, 63
db 2, 75
db 3, 84
db 4, 90
db 5, 95
db 7, 103
db 10, 113
db 15, 126
db 20, 134
db 30, 149
db 40, 160
db 50, 169
db 60, 177
db 80, 191
db 100, 201
db 120, 211
db 140, 220
db 160, 227
db 180, 234
db 200, 240
db 220, 246
db 240, 251
db 254, 253
db 255, 255
; f9ea
KnowsMove: ; f9ea
ld a, PartyMon1Moves - PartyMon1
call GetPartyParamLocation
ld a, [$d262]
ld b, a
ld c, NUM_MOVES
.asm_f9f5
ld a, [hli]
cp b
jr z, .asm_f9fe
dec c
jr nz, .asm_f9f5
and a
ret
.asm_f9fe
ld hl, UnknownText_0xfa06
call PrintText
scf
ret
; fa06
UnknownText_0xfa06: ; 0xfa06
; knows @ .
text_jump UnknownText_0x1c5ea8
db "@"
; 0xfa0b
SECTION "bank4", ROMX, BANK[$4]
Pack: ; 10000
ld hl, Options
set 4, [hl]
call Function1068a
.loop
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .done
call Function10026
call DelayFrame
jr .loop
.done
ld a, [$cf65]
ld [$d0d6], a
ld hl, Options
res 4, [hl]
ret
; 10026
Function10026: ; 10026
ld a, [$cf63]
ld hl, Jumptable_10030
call Function1086b
jp [hl]
; 10030
Jumptable_10030: ; 10030 (4:4030)
dw Function10046
dw Function10056
dw Function10067
dw Function10186
dw Function10198
dw Function10094
dw Function100a6
dw Function100d3
dw Function100e8
dw Function10874
dw Function1087e
Function10046: ; 10046 (4:4046)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function10955
ld a, [$cf64]
ld [$cf63], a
call Function10a40
ret
Function10056: ; 10056 (4:4056)
xor a
ld [$cf65], a
call Function10a36
call Function109bb
call Function1089a
call Function10866
ret
Function10067: ; 10067 (4:4067)
ld hl, MenuDataHeader_0x10a4f
call Function1d3c
ld a, [$d0d9]
ld [$cf88], a
ld a, [$d0df]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0df], a
ld a, [$cfa9]
ld [$d0d9], a
ld b, $7
ld c, $3
call Function108d4
ret c
call Function101c5
ret
Function10094: ; 10094 (4:4094)
ld a, $2
ld [$cf65], a
call Function10a36
call Function109bb
call Function1089a
call Function10866
ret
Function100a6: ; 100a6 (4:40a6)
ld hl, MenuDataHeader_0x10a7f
call Function1d3c
ld a, [$d0da]
ld [$cf88], a
ld a, [$d0e0]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0e0], a
ld a, [$cfa9]
ld [$d0da], a
ld b, $3
ld c, $7
call Function108d4
ret c
call Function101c5
ret
Function100d3: ; 100d3 (4:40d3)
ld a, $3
ld [$cf65], a
call Function10a36
call Function109bb
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function1089a
call Function10866
ret
Function100e8: ; 100e8 (4:40e8)
callba Function2c76f
ld b, $5
ld c, $1
call Function108d4
ret c
callba _CheckTossableItem
ld a, [$d142]
and a
jr nz, .asm_1010a
ld hl, MenuDataHeader_0x1013b
ld de, Jumptable_10153
jr .asm_10110
.asm_1010a
ld hl, MenuDataHeader_0x10124
ld de, Jumptable_10137
.asm_10110
push de
call LoadMenuDataHeader
call Function1d81
call Function1c07
pop hl
ret c
ld a, [$cfa9]
dec a
call Function1086b
jp [hl]
; 10124 (4:4124)
MenuDataHeader_0x10124: ; 0x10124
db $40 ; flags
db 07, 13 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x1012c
db 1 ; default option
; 0x1012c
MenuData2_0x1012c: ; 0x1012c
db $c0 ; flags
db 2 ; items
db "USE@"
db "QUIT@"
; 0x10137
Jumptable_10137: ; 10137
dw Function10159
dw Function10492
; 1013b
MenuDataHeader_0x1013b: ; 0x1013b
db $40 ; flags
db 05, 13 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10143
db 1 ; default option
; 0x10143
MenuData2_0x10143: ; 0x10143
db $c0 ; flags
db 3 ; items
db "USE@"
db "GIVE@"
db "QUIT@"
; 0x10153
Jumptable_10153: ; 10153
dw Function10159
dw Function103fd
dw Function10492
; 10159
Function10159: ; 10159
callba Function2c7bf
ret c
callba Function2c7fb
jr c, .asm_10179
ld hl, Options ; $cfcc
ld a, [hl]
push af
res 4, [hl]
callba Function2c867
pop af
ld [Options], a ; $cfcc
.asm_10179
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function10955
call Function1089a
call Function10a40
ret
Function10186: ; 10186 (4:4186)
ld a, $1
ld [$cf65], a
call Function10a36
call Function109bb
call Function1089a
call Function10866
ret
Function10198: ; 10198 (4:4198)
ld hl, MenuDataHeader_0x10aaf
call Function1d3c
ld a, [$d0db]
ld [$cf88], a
ld a, [$d0e1]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0e1], a
ld a, [$cfa9]
ld [$d0db], a
ld b, $1
ld c, $5
call Function108d4
ret c
call Function101c5
ret
Function101c5: ; 101c5 (4:41c5)
callba _CheckTossableItem
ld a, [$d142]
and a
jr nz, .asm_101f9
callba CheckSelectableItem
ld a, [$d142]
and a
jr nz, .asm_101eb
callba CheckItemMenu
ld a, [$d142]
and a
jr nz, .asm_10207
jr .asm_10227
.asm_101eb
callba CheckItemMenu
ld a, [$d142]
and a
jr nz, .asm_1020f
jr .asm_1022f
.asm_101f9
callba CheckSelectableItem
ld a, [$d142]
and a
jr nz, .asm_10217
jr .asm_1021f
.asm_10207
ld hl, MenuDataHeader_0x10249
ld de, Jumptable_1026a
jr .asm_10235
.asm_1020f
ld hl, MenuDataHeader_0x10274
ld de, Jumptable_10291
jr .asm_10235
.asm_10217
ld hl, MenuDataHeader_0x10299
ld de, Jumptable_102ac
jr .asm_10235
.asm_1021f
ld hl, MenuDataHeader_0x102b0
ld de, Jumptable_102c7
jr .asm_10235
.asm_10227
ld hl, MenuDataHeader_0x102cd
ld de, Jumptable_102ea
jr .asm_10235
.asm_1022f
ld hl, MenuDataHeader_0x102f2
ld de, Jumptable_1030b
.asm_10235
push de
call LoadMenuDataHeader
call Function1d81
call Function1c07
pop hl
ret c
ld a, [$cfa9]
dec a
call Function1086b
jp [hl]
; 10249 (4:4249)
MenuDataHeader_0x10249: ; 0x10249
db $40 ; flags
db 01, 13 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10251
db 1 ; default option
; 0x10251
MenuData2_0x10251: ; 0x10251
db $c0 ; flags
db 5 ; items
db "USE@"
db "GIVE@"
db "TOSS@"
db "SEL@"
db "QUIT@"
; 0x1026a
Jumptable_1026a: ; 1026a
dw Function10311
dw Function103fd
dw Function10364
dw Function103c2
dw Function10492
; 10274
MenuDataHeader_0x10274: ; 0x10274
db $40 ; flags
db 03, 13 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x1027c
db 1 ; default option
; 0x1027c
MenuData2_0x1027c: ; 0x1027c
db $c0 ; flags
db 4 ; items
db "USE@"
db "GIVE@"
db "TOSS@"
db "QUIT@"
; 0x10291
Jumptable_10291: ; 10291
dw Function10311
dw Function103fd
dw Function10364
dw Function10492
; 10299
MenuDataHeader_0x10299: ; 0x10299
db $40 ; flags
db 07, 13 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x102a1
db 1 ; default option
; 0x102a1
MenuData2_0x102a1: ; 0x102a1
db $c0 ; flags
db 2 ; items
db "USE@"
db "QUIT@"
; 0x102ac
Jumptable_102ac: ; 102ac
dw Function10311
dw Function10492
; 102b0
MenuDataHeader_0x102b0: ; 0x102b0
db $40 ; flags
db 05, 13 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x102b8
db 1 ; default option
; 0x102b8
MenuData2_0x102b8: ; 0x102b8
db $c0 ; flags
db 3 ; items
db "USE@"
db "SEL@"
db "QUIT@"
; 0x102c7
Jumptable_102c7: ; 102c7
dw Function10311
dw Function103c2
dw Function10492
; 102cd
MenuDataHeader_0x102cd: ; 0x102cd
db $40 ; flags
db 03, 13 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x102d5
db 1 ; default option
; 0x102d5
MenuData2_0x102d5: ; 0x102d5
db $c0 ; flags
db 4 ; items
db "GIVE@"
db "TOSS@"
db "SEL@"
db "QUIT@"
; 0x102ea
Jumptable_102ea: ; 102ea
dw Function103fd
dw Function10364
dw Function103c2
dw Function10492
; 102f2
MenuDataHeader_0x102f2: ; 0x102f2
db $40 ; flags
db 05, 13 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x102fa
db 1 ; default option
; 0x102fa
MenuData2_0x102fa: ; 0x102fa
db $c0 ; flags
db 3 ; items
db "GIVE@"
db "TOSS@"
db "QUIT@"
; 0x1030b
Jumptable_1030b: ; 1030b
dw Function103fd
dw Function10364
dw Function10492
; 10311
Function10311: ; 10311
callba CheckItemMenu
ld a, [$d142]
ld hl, Jumptable_1031f
rst JumpTable
ret
; 1031f
Jumptable_1031f: ; 1031f (4:431f)
dw Function1032d
dw Function1032d
dw Function1032d
dw Function1032d
dw Function10334
dw Function10338
dw Function10355
; 1035c
Function1032d: ; 1032d (4:432d)
ld hl, UnknownText_0x10af3
call Function10889
ret
Function10334: ; 10334 (4:4334)
call DoItemEffect
ret
Function10338: ; 10338 (4:4338)
ld a, [PartyCount] ; $dcd7
and a
jr z, .asm_1034e
call DoItemEffect
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function10955
call Function1089a
call Function10a40
ret
.asm_1034e
ld hl, UnknownText_0x10af8
call Function10889
ret
Function10355: ; 10355 (4:4355)
call DoItemEffect
ld a, [$d0ec]
and a
jr z, Function1032d
ld a, $a
ld [$cf63], a
ret
; 10364 (4:4364)
Function10364: ; 10364
ld hl, UnknownText_0x10ae4
call Function10889
callba Function24fbf
push af
call Function1c07
pop af
jr c, .asm_1039c
call Function10a1d
ld hl, UnknownText_0x10ae9
call Function1d4f
call YesNoBox
push af
call Function1c07
pop af
jr c, .asm_1039c
ld hl, NumItems
ld a, [$d107]
call TossItem
call Function10a1d
ld hl, UnknownText_0x10aee
call Function10889
.asm_1039c
ret
; 1039d
Function1039d: ; 1039d
ld a, [$cf65]
and a
jr z, .asm_103b2
dec a
jr z, .asm_103aa
dec a
jr z, .asm_103ba
ret
.asm_103aa
xor a
ld [$d0db], a
ld [$d0e1], a
ret
.asm_103b2
xor a
ld [$d0d9], a
ld [$d0df], a
ret
.asm_103ba
xor a
ld [$d0da], a
ld [$d0e0], a
ret
; 103c2
Function103c2: ; 103c2
callba CheckSelectableItem
ld a, [$d142]
and a
jr nz, .asm_103f6
ld a, [$cf65]
rrca
rrca
and $c0
ld b, a
ld a, [$d107]
inc a
and $3f
or b
ld [WhichRegisteredItem], a
ld a, [CurItem]
ld [RegisteredItem], a
call Function10a1d
ld de, SFX_FULL_HEAL
call WaitPlaySFX
ld hl, UnknownText_0x10afd
call Function10889
ret
.asm_103f6
ld hl, UnknownText_0x10b02
call Function10889
ret
; 103fd
Function103fd: ; 103fd
ld a, [PartyCount] ; $dcd7
and a
jp z, Function10486
ld a, [Options] ; $cfcc
push af
res 4, a
ld [Options], a ; $cfcc
ld a, $8
ld [PartyMenuActionText], a ; $d141
call WhiteBGMap
callba Function5004f
callba Function50405
callba Function503e0
.asm_10427
callba WritePartyMenuTilemap
callba PrintPartyMenuText
call WaitBGMap
call Function32f9
call DelayFrame
callba PartyMenuSelect
jr c, .asm_10475
ld a, [CurPartySpecies] ; $d108
cp EGG
jr nz, .asm_10453
ld hl, UnknownText_0x1048d
call PrintText
jr .asm_10427
.asm_10453
ld a, [$cf63]
push af
ld a, [$cf64]
push af
call GetCurNick
ld hl, StringBuffer1 ; $d073
ld de, $d050
ld bc, PKMN_NAME_LENGTH
call CopyBytes
call Function12bd9
pop af
ld [$cf64], a
pop af
ld [$cf63], a
.asm_10475
pop af
ld [Options], a ; $cfcc
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function10955
call Function1089a
call Function10a40
ret
Function10486: ; 10486 (4:4486)
ld hl, UnknownText_0x10af8
call Function10889
ret
; 1048d (4:448d)
UnknownText_0x1048d: ; 0x1048d
; An EGG can't hold an item.
text_jump UnknownText_0x1c0b7f
db "@"
; 0x10492
Function10492: ; 10492
ret
; 10493
BattlePack: ; 10493
ld hl, Options
set 4, [hl]
call Function1068a
.asm_1049b
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_104ad
call Function104b9
call DelayFrame
jr .asm_1049b
.asm_104ad
ld a, [$cf65]
ld [$d0d6], a
ld hl, Options
res 4, [hl]
ret
; 104b9
Function104b9: ; 104b9
ld a, [$cf63]
ld hl, Jumptable_104c3
call Function1086b
jp [hl]
; 104c3
Jumptable_104c3: ; 104c3 (4:44c3)
dw Function104d9
dw Function104e9
dw Function104fa
dw Function10594
dw Function105a6
dw Function10527
dw Function10539
dw Function10566
dw Function10581
dw Function10874
dw Function1087e
Function104d9: ; 104d9 (4:44d9)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function10955
ld a, [$cf64]
ld [$cf63], a
call Function10a40
ret
Function104e9: ; 104e9 (4:44e9)
xor a
ld [$cf65], a
call Function10a36
call Function109bb
call Function1089a
call Function10866
ret
Function104fa: ; 104fa (4:44fa)
ld hl, MenuDataHeader_0x10a4f
call Function1d3c
ld a, [$d0d9]
ld [$cf88], a
ld a, [$d0df]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0df], a
ld a, [$cfa9]
ld [$d0d9], a
ld b, $7
ld c, $3
call Function108d4
ret c
call Function105d3
ret
Function10527: ; 10527 (4:4527)
ld a, $2
ld [$cf65], a
call Function10a36
call Function109bb
call Function1089a
call Function10866
ret
Function10539: ; 10539 (4:4539)
ld hl, MenuDataHeader_0x10a7f
call Function1d3c
ld a, [$d0da]
ld [$cf88], a
ld a, [$d0e0]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0e0], a
ld a, [$cfa9]
ld [$d0da], a
ld b, $3
ld c, $7
call Function108d4
ret c
call Function105d3
ret
Function10566: ; 10566 (4:4566)
ld a, $3
ld [$cf65], a
call Function10a36
call Function109bb
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function1089a
ld hl, UnknownText_0x10b0c
call Function10889
call Function10866
ret
Function10581: ; 10581 (4:4581)
callba Function2c76f
ld b, $5
ld c, $1
call Function108d4
ret c
xor a
call Function105dc
ret
Function10594: ; 10594 (4:4594)
ld a, $1
ld [$cf65], a
call Function10a36
call Function109bb
call Function1089a
call Function10866
ret
Function105a6: ; 105a6 (4:45a6)
ld hl, MenuDataHeader_0x10aaf
call Function1d3c
ld a, [$d0db]
ld [$cf88], a
ld a, [$d0e1]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0e1], a
ld a, [$cfa9]
ld [$d0db], a
ld b, $1
ld c, $5
call Function108d4
ret c
call Function105d3
ret
Function105d3: ; 105d3 (4:45d3)
callba CheckItemContext
ld a, [$d142]
Function105dc: ; 105dc (4:45dc)
and a
jr z, .asm_105e7
ld hl, MenuDataHeader_0x10601
ld de, Jumptable_10614
jr .asm_105ed
.asm_105e7
ld hl, MenuDataHeader_0x10618
ld de, Jumptable_10627
.asm_105ed
push de
call LoadMenuDataHeader
call Function1d81
call Function1c07
pop hl
ret c
ld a, [$cfa9]
dec a
call Function1086b
jp [hl]
; 10601 (4:4601)
MenuDataHeader_0x10601: ; 0x10601
db $40 ; flags
db 07, 13 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10609
db 1 ; default option
; 0x10609
MenuData2_0x10609: ; 0x10609
db $c0 ; flags
db 2 ; items
db "USE@"
db "QUIT@"
; 0x10614
Jumptable_10614: ; 10614
dw Function10629
dw Function10689
; 10618
MenuDataHeader_0x10618: ; 0x10618
db $40 ; flags
db 09, 13 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10620
db 1 ; default option
; 0x10620
MenuData2_0x10620: ; 0x10620
db $c0 ; flags
db 1 ; items
db "QUIT@"
; 0x10627
Jumptable_10627: ; 10627
dw Function10689
; 10629
Function10629: ; 10629
callba CheckItemContext
ld a, [$d142]
ld hl, Jumptable_10637
rst JumpTable
ret
Jumptable_10637: ; 10637 (4:4637)
dw Function10645
dw Function10645
dw Function10645
dw Function10645
dw Function1064c
dw Function10656
dw Function10671
Function10645: ; 10645 (4:4645)
ld hl, UnknownText_0x10af3
call Function10889
ret
Function1064c: ; 1064c (4:464c)
call DoItemEffect
ld a, [$d0ec]
and a
jr nz, asm_1066c
ret
Function10656: ; 10656 (4:4656)
call DoItemEffect
ld a, [$d0ec]
and a
jr nz, asm_1067e
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function10955
call Function1089a
call Function10a40
ret
asm_1066c: ; 1066c (4:466c)
call WhiteBGMap
jr asm_1067e
Function10671: ; 10671 (4:4671)
call DoItemEffect
ld a, [$d0ec]
and a
jr z, Function10645
cp $2
jr z, asm_10684
asm_1067e: ; 1067e (4:467e)
ld a, $a
ld [$cf63], a
ret
asm_10684: ; 10684 (4:4684)
xor a
ld [$d0ec], a
ret
; 10689 (4:4689)
Function10689: ; 10689
ret
; 1068a
Function1068a: ; 1068a
xor a
ld [$cf63], a
ld a, [$d0d6]
and $3
ld [$cf65], a
inc a
add a
dec a
ld [$cf64], a
xor a
ld [$cf66], a
xor a
ld [$d0e3], a
ret
; 106a5
Function106a5: ; 106a5
xor a
ld [hBGMapMode], a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
ld [$d0e3], a
call Function10955
call Function10a40
ret
; 106be
Function106be: ; 106be
.asm_106be
call Function106c7
call Function1076f
jr c, .asm_106be
ret
; 106c7
Function106c7: ; 106c7
ld a, [$cf63]
ld hl, Jumptable_106d1
call Function1086b
jp [hl]
; 106d1
Jumptable_106d1: ; 106d1 (4:46d1)
dw Function106d9
dw Function1073b
dw Function106ff
dw Function10726
Function106d9: ; 106d9 (4:46d9)
xor a
call Function10762
ld hl, MenuDataHeader_0x10a67
call Function1d3c
ld a, [$d0d9]
ld [$cf88], a
ld a, [$d0df]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0df], a
ld a, [$cfa9]
ld [$d0d9], a
ret
Function106ff: ; 106ff (4:46ff)
ld a, $2
call Function10762
ld hl, MenuDataHeader_0x10a97
call Function1d3c
ld a, [$d0da]
ld [$cf88], a
ld a, [$d0e0]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0e0], a
ld a, [$cfa9]
ld [$d0da], a
ret
Function10726: ; 10726 (4:4726)
ld a, $3
call Function10762
call Function1089a
callba Function2c76f
ld a, [CurItem] ; $d106
ld [CurItem], a ; $d106
ret
Function1073b: ; 1073b (4:473b)
ld a, $1
call Function10762
ld hl, MenuDataHeader_0x10ac7
call Function1d3c
ld a, [$d0db]
ld [$cf88], a
ld a, [$d0e1]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0e1], a
ld a, [$cfa9]
ld [$d0db], a
ret
Function10762: ; 10762 (4:4762)
ld [$cf65], a
call Function10a36
call Function109bb
call Function1089a
ret
Function1076f: ; 1076f
ld hl, $cf73
ld a, [hl]
and $1
jr nz, .asm_10788
ld a, [hl]
and $2
jr nz, .asm_1078f
ld a, [hl]
and $20
jr nz, .asm_10795
ld a, [hl]
and $10
jr nz, .asm_107a8
scf
ret
.asm_10788
ld a, $1
ld [$cf66], a
and a
ret
.asm_1078f
xor a
ld [$cf66], a
and a
ret
.asm_10795
ld a, [$cf63]
dec a
and $3
ld [$cf63], a
push de
ld de, SFX_UNKNOWN_62
call PlaySFX
pop de
scf
ret
.asm_107a8
ld a, [$cf63]
inc a
and $3
ld [$cf63], a
push de
ld de, SFX_UNKNOWN_62
call PlaySFX
pop de
scf
ret
; 107bb
Function107bb: ; 107bb
call Function106a5
ld a, [InputType]
or a
jr z, .asm_107ca
callba Function1de28f
.asm_107ca
call Function107d7
call Function1076f
jr c, .asm_107ca
xor a
ld [$cf66], a
ret
; 107d7
Function107d7: ; 107d7
ld a, [$cf63]
ld hl, Jumptable_107e1
call Function1086b
jp [hl]
; 107e1
Jumptable_107e1: ; 107e1 (4:47e1)
dw Function107e9
dw Function1083b
dw Function10807
dw Function10826
Function107e9: ; 107e9 (4:47e9)
xor a
ld hl, MenuDataHeader_0x107ef
jr Function1085a
; 107ef (4:47ef)
MenuDataHeader_0x107ef: ; 0x107ef
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x107f7
db 1 ; default option
; 0x107f7
MenuData2_0x107f7: ; 0x107f7
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
dbw 0, $d288
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function24ac3), Function24ac3
dbw BANK(Function244c3), Function244c3
; 10807
Function10807: ; 10807 (4:4807)
ld a, $2
ld hl, MenuDataHeader_0x1080e
jr Function1085a
; 1080e (4:480e)
MenuDataHeader_0x1080e: ; 0x1080e
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10816
db 1 ; default option
; 0x10816
MenuData2_0x10816: ; 0x10816
db $ae ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
dbw 0, $d292
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function24ac3), Function24ac3
dbw BANK(Function244c3), Function244c3
; 10826
Function10826: ; 10826 (4:4826)
ld a, $3
call Function10762
call Function1089a
callba Function2c76f
ld a, [CurItem] ; $d106
ld [CurItem], a ; $d106
ret
Function1083b: ; 1083b (4:483b)
ld a, $1
ld hl, MenuDataHeader_0x10842
jr Function1085a
; 10842 (4:4842)
MenuDataHeader_0x10842: ; 0x10842
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x1084a
db 1 ; default option
; 0x1084a
MenuData2_0x1084a: ; 0x1084a
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
dbw 0, $d2a6
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function24ac3), Function24ac3
dbw BANK(Function244c3), Function244c3
; 1085a
Function1085a: ; 1085a (4:485a)
push hl
call Function10762
pop hl
call Function1d3c
call Function350c
ret
Function10866: ; 10866 (4:4866)
ld hl, $cf63
inc [hl]
ret
Function1086b: ; 1086b
ld e, a
ld d, 0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
; 10874
Function10874: ; 10874 (4:4874)
ld hl, $cf63
set 7, [hl]
xor a
ld [$cf66], a
ret
Function1087e: ; 1087e (4:487e)
ld hl, $cf63
set 7, [hl]
ld a, $1
ld [$cf66], a
ret
Function10889: ; 10889 (4:4889)
ld a, [Options] ; $cfcc
push af
set 4, a
ld [Options], a ; $cfcc
call PrintText
pop af
ld [Options], a ; $cfcc
ret
Function1089a: ; 1089a (4:489a)
call WaitBGMap
Function1089d: ; 1089d
ld a, [$cf65]
and $3
ld e, a
ld d, $0
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
jr z, .asm_108b3
ld a, [PlayerGender]
bit 0, a
jr nz, .asm_108c5
.asm_108b3
ld hl, PackGFXPointers
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
ld hl, $9500
lb bc, BANK(PackGFX), 15
call Request2bpp
ret
.asm_108c5
callba Function48e81
ret
; 108cc
PackGFXPointers: ; 108cc
dw PackGFX + $f0 * 1
dw PackGFX + $f0 * 3
dw PackGFX + $f0 * 0
dw PackGFX + $f0 * 2
; 108d4
Function108d4: ; 108d4 (4:48d4)
ld hl, $cf73
ld a, [$d0e3]
and a
jr nz, .asm_10931
ld a, [hl]
and $1
jr nz, .asm_108f8
ld a, [hl]
and $2
jr nz, .asm_108fa
ld a, [hl]
and $20
jr nz, .asm_10901
ld a, [hl]
and $10
jr nz, .asm_10912
ld a, [hl]
and $4
jr nz, .asm_10923
scf
ret
.asm_108f8
and a
ret
.asm_108fa
ld a, $9
ld [$cf63], a
scf
ret
.asm_10901
ld a, b
ld [$cf63], a
ld [$cf64], a
push de
ld de, SFX_UNKNOWN_62
call PlaySFX
pop de
scf
ret
.asm_10912
ld a, c
ld [$cf63], a
ld [$cf64], a
push de
ld de, SFX_UNKNOWN_62
call PlaySFX
pop de
scf
ret
.asm_10923
callba Function2490c
ld hl, UnknownText_0x10b07
call Function10889
scf
ret
.asm_10931
ld a, [hl]
and $5
jr nz, .asm_1093d
ld a, [hl]
and $2
jr nz, .asm_1094f
scf
ret
.asm_1093d
callba Function2490c
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
.asm_1094f
xor a
ld [$d0e3], a
scf
ret
Function10955: ; 10955
call WhiteBGMap
call ClearTileMap
call ClearSprites
call DisableLCD
ld hl, PackMenuGFX
ld de, VTiles2
ld bc, $0600
ld a, BANK(PackMenuGFX)
call FarCopyBytes
hlcoord 0, 1
ld bc, $00dc
ld a, $24
call ByteFill
hlcoord 5, 1
lb bc, 11, 15
call ClearBox
ld hl, TileMap
ld a, $28
ld c, $14
.asm_1098a
ld [hli], a
inc a
dec c
jr nz, .asm_1098a
call Function109bb
call Function109a5
hlcoord 0, 12
lb bc, 4, 18
call TextBox
call EnableLCD
call Function1089d
ret
; 109a5
Function109a5: ; 109a5
hlcoord 0, 3
ld a, $50
ld de, 15
ld b, 3
.asm_109af
ld c, 5
.asm_109b1
ld [hli], a
inc a
dec c
jr nz, .asm_109b1
add hl, de
dec b
jr nz, .asm_109af
ret
; 109bb
Function109bb: ; 109bb
ld a, [$cf65]
; * 15
ld d, a
swap a
sub d
ld d, 0
ld e, a
ld hl, Tilemap_109e1
add hl, de
ld d, h
ld e, l
hlcoord 0, 7
ld c, 3
.asm_109d0
ld b, 5
.asm_109d2
ld a, [de]
inc de
ld [hli], a
dec b
jr nz, .asm_109d2
ld a, c
ld c, 15
add hl, bc
ld c, a
dec c
jr nz, .asm_109d0
ret
; 109e1
Tilemap_109e1: ; 109e1
db $00, $04, $04, $04, $01, $06, $07, $08, $09, $0a, $02, $05, $05, $05, $03
db $00, $04, $04, $04, $01, $15, $16, $17, $18, $19, $02, $05, $05, $05, $03
db $00, $04, $04, $04, $01, $0b, $0c, $0d, $0e, $0f, $02, $05, $05, $05, $03
db $00, $04, $04, $04, $01, $10, $11, $12, $13, $14, $02, $05, $05, $05, $03
; 10a1d
Function10a1d: ; 10a1d
ld a, [CurItem]
ld [$d265], a
call GetItemName
call CopyName1
ret
; 10a2a
Function10a2a: ; 10a2a
ld hl, TileMap
ld bc, $0168
ld a, $7f
call ByteFill
ret
; 10a36
Function10a36: ; 10a36 (4:4a36)
hlcoord 5, 2
ld bc, $a0f
call ClearBox
ret
Function10a40: ; 10a40
call WaitBGMap
ld b, $14
call GetSGBLayout
call Function32f9
call DelayFrame
ret
; 10a4f
MenuDataHeader_0x10a4f: ; 0x10a4f
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10a57
db 1 ; default option
; 0x10a57
MenuData2_0x10a57: ; 0x10a57
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
dbw 0, $d892
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function24ac3), Function24ac3
dbw BANK(Function244c3), Function244c3
; 10a67
MenuDataHeader_0x10a67: ; 0x10a67
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10a6f
db 1 ; default option
; 0x10a6f
MenuData2_0x10a6f: ; 0x10a6f
db $2e ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
dbw 0, $d892
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function24ac3), Function24ac3
dbw BANK(Function244c3), Function244c3
; 10a7f
MenuDataHeader_0x10a7f: ; 0x10a7f
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10a87
db 1 ; default option
; 0x10a87
MenuData2_0x10a87: ; 0x10a87
db $ae ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
dbw 0, $d8bc
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function24ac3), Function24ac3
dbw BANK(Function244c3), Function244c3
; 10a97
MenuDataHeader_0x10a97: ; 0x10a97
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10a9f
db 1 ; default option
; 0x10a9f
MenuData2_0x10a9f: ; 0x10a9f
db $2e ; flags
db 5, 8 ; rows, columns
db 1 ; horizontal spacing
dbw 0, $d8bc
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function24ac3), Function24ac3
dbw BANK(Function244c3), Function244c3
; 10aaf
MenuDataHeader_0x10aaf: ; 0x10aaf
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10ab7
db 1 ; default option
; 0x10ab7
MenuData2_0x10ab7: ; 0x10ab7
db $ae ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
dbw 0, $d8d7
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function24ac3), Function24ac3
dbw BANK(Function244c3), Function244c3
; 10ac7
MenuDataHeader_0x10ac7: ; 0x10ac7
db $40 ; flags
db 01, 07 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x10acf
db 1 ; default option
; 0x10acf
MenuData2_0x10acf: ; 0x10acf
db $2e ; flags
db 5, 8 ; rows, columns
db 2 ; horizontal spacing
dbw 0, $d8d7
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function24ac3), Function24ac3
dbw BANK(Function244c3), Function244c3
; 10adf
UnknownText_0x10adf: ; 0x10adf
; No items.
text_jump UnknownText_0x1c0b9a
db "@"
; 0x10ae4
UnknownText_0x10ae4: ; 0x10ae4
; Throw away how many?
text_jump UnknownText_0x1c0ba5
db "@"
; 0x10ae9
UnknownText_0x10ae9: ; 0x10ae9
; Throw away @ @ (S)?
text_jump UnknownText_0x1c0bbb
db "@"
; 0x10aee
UnknownText_0x10aee: ; 0x10aee
; Threw away @ (S).
text_jump UnknownText_0x1c0bd8
db "@"
; 0x10af3
UnknownText_0x10af3: ; 0x10af3
; OAK: ! This isn't the time to use that!
text_jump UnknownText_0x1c0bee
db "@"
; 0x10af8
UnknownText_0x10af8: ; 0x10af8
; You don't have a #MON!
text_jump UnknownText_0x1c0c17
db "@"
; 0x10afd
UnknownText_0x10afd: ; 0x10afd
; Registered the @ .
text_jump UnknownText_0x1c0c2e
db "@"
; 0x10b02
UnknownText_0x10b02: ; 0x10b02
; You can't register that item.
text_jump UnknownText_0x1c0c45
db "@"
; 0x10b07
UnknownText_0x10b07: ; 0x10b07
; Where should this be moved to?
text_jump UnknownText_0x1c0c63
db "@"
; 0x10b0c
UnknownText_0x10b0c: ; 0x10b0c
;
text_jump UnknownText_0x1c0c83
db "@"
; 0x10b11
UnknownText_0x10b11: ; 0x10b11
; You can't use it in a battle.
text_jump UnknownText_0x1c0c85
db "@"
; 0x10b16
PackMenuGFX:
INCBIN "gfx/misc/pack_menu.2bpp"
PackGFX:
INCBIN "gfx/misc/pack.w40.2bpp"
Function113d6: ; 113d6
call Function114dd
ret
; 113da
Function113da: ; 113da
xor a
ld [$dc2d], a
ld [$dc3a], a
ld [$dc1c], a
ret
; 113e5
Function113e5:: ; 113e5
xor a
ld [$d464], a
Function113e9: ; 113e9
ld a, [$d464]
cp 3
jr c, .asm_113f2
ld a, 3
.asm_113f2
ld e, a
ld d, 0
ld hl, .data_113fd
add hl, de
ld a, [hl]
jp Function1142e
; 113fd
.data_113fd
db 20, 10, 5, 3
; 11401
Function11401: ; 11401
call Function1143c
ret nc
ld hl, $d464
ld a, [hl]
cp 3
jr nc, .asm_1140e
inc [hl]
.asm_1140e
call Function113e9
scf
ret
; 11413
Function11413: ; 11413
ld a, 1
Function11415: ; 11415
ld [hl], a
push hl
call UpdateTime
pop hl
inc hl
call Function11621
ret
; 11420
Function11420: ; 11420
inc hl
push hl
call Function115cf
call Function115c8
pop hl
dec hl
call Function11586
ret
; 1142e
Function1142e: ; 1142e
ld hl, $d465
ld [hl], a
call UpdateTime
ld hl, $d466
call Function1162e
ret
; 1143c
Function1143c: ; 1143c
ld hl, $d466
call Function115d6
call Function115ae
ld hl, $d465
call Function11586
ret
; 1144c
Function1144c: ; 1144c
ld hl, $dc1c
jp Function11413
; 11452
Function11452:: ; 11452
ld hl, $dc1c
call Function11420
ret nc
xor a
ld hl, $dc1e
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld hl, $dc4c
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld hl, $dc50
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld hl, $dc54
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld hl, $dc58
ld a, [hl]
and a
jr z, .asm_11480
dec [hl]
jr nz, .asm_11483
.asm_11480
call Function11485
.asm_11483
jr Function1144c
; 11485
Function11485: ; 11485
call Random
and 3
add 3
ld [$dc58], a
ret
; 11490
Function11490: ; 11490
ld a, $14
ld [$d46c], a
ld a, $0
ld [$d46d], a
call UpdateTime
ld hl, $dc35
call Function11613
ret
; 114a4
Function114a4:: ; 114a4 (4:54a4)
ld hl, $dc35
call Function115db
ld a, [$cfd7]
and a
jr nz, .asm_114d4
ld a, [$cfd6]
and a
jr nz, .asm_114d4
ld a, [$cfd4]
ld b, a
ld a, [$d46d]
sub b
jr nc, .asm_114c2
add $3c
.asm_114c2
ld [$d46d], a
ld a, [$cfd5]
ld b, a
ld a, [$d46c]
sbc b
ld [$d46c], a
jr c, .asm_114d4
and a
ret
.asm_114d4
xor a
ld [$d46c], a
ld [$d46d], a
scf
ret
Function114dd: ; 114dd
call UpdateTime
ld hl, $dc23
call Function11621
ret
; 114e7
Function114e7:: ; 114e7
ld hl, $dc23
call Function115cf
call Function115c8
and a
jr z, .asm_114fa
ld b, a
callba ApplyPokerusTick
.asm_114fa
xor a
ret
; 114fc
Function114fc: ; 114fc
ld a, $2
ld hl, $dc3a
ld [hl], a
call UpdateTime
ld hl, $dc3b
call Function11621
ret
; 1150c
Function1150c: ; 1150c
ld hl, $dc3b
call Function115cf
call Function115c8
ld hl, $dc3a
call Function11586
ret
; 1151c
Function1151c: ; 1151c
ld hl, $dc1e
set 2, [hl]
ret
; 11522
Function11522: ; 11522
and a
ld hl, $dc1e
bit 2, [hl]
ret nz
scf
ret
; 1152b
Function1152b: ; 1152b
call Function11534
ld hl, $dc2d
jp Function11415
; 11534
Function11534: ; 11534
call GetWeekday
ld c, a
ld a, $5
sub c
jr z, .asm_1153f
jr nc, .asm_11541
.asm_1153f
add $7
.asm_11541
ret
; 11542
Function11542: ; 11542
ld hl, $dc2d
jp Function11420
; 11548
Function11548: ; 11548
ld a, $0
call GetSRAMBank
ld hl, $abfa
ld a, [hli]
ld [Buffer1], a
ld a, [hl]
ld [Buffer2], a
call CloseSRAM
ld hl, Buffer1
call Function11420
jr nc, .asm_11572
ld hl, Buffer1
call Function11413
call CloseSRAM
callba Function1050c8
.asm_11572
ld a, $0
call GetSRAMBank
ld hl, Buffer1
ld a, [hli]
ld [$abfa], a
ld a, [hl]
ld [$abfb], a
call CloseSRAM
ret
; 11586
Function11586: ; 11586
cp $ff
jr z, .asm_11595
ld c, a
ld a, [hl]
sub c
jr nc, .asm_11590
xor a
.asm_11590
ld [hl], a
jr z, .asm_11595
xor a
ret
.asm_11595
xor a
ld [hl], a
scf
ret
; 11599
Function11599: ; 11599
ld a, [$cfd7]
and a
jr nz, Function115cc
ld a, [$cfd6]
and a
jr nz, Function115cc
ld a, [$cfd5]
jr nz, Function115cc
ld a, [$cfd4]
ret
; 115ae
Function115ae: ; 115ae
ld a, [$cfd7]
and a
jr nz, Function115cc
ld a, [$cfd6]
and a
jr nz, Function115cc
ld a, [$cfd5]
ret
; 115be
Function115be: ; 115be
ld a, [$cfd7]
and a
jr nz, Function115cc
ld a, [$cfd6]
ret
; 115c8
Function115c8: ; 115c8
ld a, [$cfd7]
ret
; 115cc
Function115cc: ; 115cc
ld a, $ff
ret
; 115cf
Function115cf: ; 115cf
xor a
jr Function11605
; 115d2
Function115d2: ; 115d2
inc hl
xor a
jr Function115f8
; 115d6
Function115d6: ; 115d6
inc hl
inc hl
xor a
jr Function115eb
; 115db
Function115db: ; 115db
inc hl
inc hl
inc hl
ld a, [hSeconds]
ld c, a
sub [hl]
jr nc, .asm_115e6
add 60
.asm_115e6
ld [hl], c
dec hl
ld [$cfd4], a
Function115eb: ; 115eb
ld a, [hMinutes]
ld c, a
sbc [hl]
jr nc, .asm_115f3
add 60
.asm_115f3
ld [hl], c
dec hl
ld [$cfd5], a
Function115f8: ; 115f8
ld a, [hHours]
ld c, a
sbc [hl]
jr nc, .asm_11600
add 24
.asm_11600
ld [hl], c
dec hl
ld [$cfd6], a
Function11605
ld a, [CurDay]
ld c, a
sbc [hl]
jr nc, .asm_1160e
add 140
.asm_1160e
ld [hl], c
ld [$cfd7], a
ret
; 11613
Function11613: ; 11613
ld a, [CurDay]
ld [hli], a
ld a, [hHours]
ld [hli], a
ld a, [hMinutes]
ld [hli], a
ld a, [hSeconds]
ld [hli], a
ret
; 11621
Function11621: ; 11621
ld a, [CurDay]
ld [hl], a
ret
; 11626
Function11626: ; 11626
ld a, [CurDay]
ld [hli], a
ld a, [hHours]
ld [hli], a
ret
; 1162e
Function1162e: ; 1162e
ld a, [CurDay]
ld [hli], a
ld a, [hHours]
ld [hli], a
ld a, [hMinutes]
ld [hli], a
ret
; 11639
CanLearnTMHMMove: ; 11639
ld a, [CurPartySpecies]
ld [CurSpecies], a
call GetBaseData
ld hl, BaseTMHM
push hl
ld a, [$d262]
ld b, a
ld c, 0
ld hl, TMHMMoves
.loop
ld a, [hli]
and a
jr z, .end
cp b
jr z, .asm_11659
inc c
jr .loop
.asm_11659
pop hl
ld b, CHECK_FLAG
push de
ld d, 0
predef FlagPredef
pop de
ret
.end
pop hl
ld c, 0
ret
; 1166a
GetTMHMMove: ; 1166a
ld a, [$d265]
dec a
ld hl, TMHMMoves
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [$d265], a
ret
; 1167a
TMHMMoves: ; 1167a
db DYNAMICPUNCH
db HEADBUTT
db CURSE
db ROLLOUT
db ROAR
db TOXIC
db ZAP_CANNON
db ROCK_SMASH
db PSYCH_UP
db HIDDEN_POWER
db SUNNY_DAY
db SWEET_SCENT
db SNORE
db BLIZZARD
db HYPER_BEAM
db ICY_WIND
db PROTECT
db RAIN_DANCE
db GIGA_DRAIN
db ENDURE
db FRUSTRATION
db SOLARBEAM
db IRON_TAIL
db DRAGONBREATH
db THUNDER
db EARTHQUAKE
db RETURN
db DIG
db PSYCHIC_M
db SHADOW_BALL
db MUD_SLAP
db DOUBLE_TEAM
db ICE_PUNCH
db SWAGGER
db SLEEP_TALK
db SLUDGE_BOMB
db SANDSTORM
db FIRE_BLAST
db SWIFT
db DEFENSE_CURL
db THUNDERPUNCH
db DREAM_EATER
db DETECT
db REST
db ATTRACT
db THIEF
db STEEL_WING
db FIRE_PUNCH
db FURY_CUTTER
db NIGHTMARE
db CUT
db FLY
db SURF
db STRENGTH
db FLASH
db WHIRLPOOL
db WATERFALL
; Move tutor
db FLAMETHROWER
db THUNDERBOLT
db ICE_BEAM
db 0 ; end
; 116b7
Function116b7: ; 0x116b7
call Function2ed3
call Function116c1
call Function2b74
ret
; 0x116c1
Function116c1: ; 116c1
ld hl, PlayerSDefLevel
ld [hl], e
inc hl
ld [hl], d
ld hl, EnemyAtkLevel
ld [hl], b
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
ld a, [$ffde]
push af
xor a
ld [$ffde], a
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
call Function116f8
call DelayFrame
.asm_116e5
call Function11915
jr nc, .asm_116e5
pop af
ld [$ffaa], a
pop af
ld [$ffde], a
pop af
ld [Options], a
call ClearJoypad
ret
; 116f8
Function116f8: ; 116f8
call WhiteBGMap
ld b, $8
call GetSGBLayout
call DisableLCD
call Function11c51
call Function118a8
ld a, $e3
ld [rLCDC], a
call Function1171d
call WaitBGMap
call WaitTop
call Function32f9
call Function11be0
ret
; 1171d
Function1171d: ; 1171d
ld a, [EnemyAtkLevel]
and 7
ld e, a
ld d, 0
ld hl, Jumptable_1172e
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 1172e
Jumptable_1172e: ; 1172e (4:572e)
dw Function1173e
dw Function1178d
dw Function117ae
dw Function117d1
dw Function117f5
dw Function1182c
dw Function1173e
dw Function1173e
Function1173e: ; 1173e (4:573e)
ld a, [CurPartySpecies] ; $d108
ld [$d265], a
ld hl, Function8e83f
ld a, BANK(Function8e83f)
ld e, $1
rst FarCall ; ; indirect jump to Function8e83f (8e83f (23:683f))
ld a, [CurPartySpecies] ; $d108
ld [$d265], a
call GetPokemonName
hlcoord 5, 2
call PlaceString
ld l, c
ld h, b
ld de, Strings_11780
call PlaceString
inc de
hlcoord 5, 4
call PlaceString
callba GetGender
jr c, .asm_1177c
ld a, $ef
jr nz, .asm_11778
ld a, $f5
.asm_11778
hlcoord 1, 2
ld [hl], a
.asm_1177c
call Function1187b
ret
; 11780 (4:5780)
Strings_11780: ; 11780
db "'S@"
db "NICKNAME?@"
; 1178d
Function1178d: ; 1178d (4:578d)
callba GetPlayerIcon
call Function11847
hlcoord 5, 2
ld de, String_117a3
call PlaceString
call Function11882
ret
; 117a3 (4:57a3)
String_117a3: ; 117a3
db "YOUR NAME?@"
; 117ae
Function117ae: ; 117ae (4:57ae)
ld de, SilverSpriteGFX
ld b, BANK(SilverSpriteGFX)
call Function11847
hlcoord 5, 2
ld de, String_117c3
call PlaceString
call Function11882
ret
; 117c3 (4:57c3)
String_117c3: ; 117c3
db "RIVAL'S NAME?@"
; 117d1
Function117d1: ; 117d1 (4:57d1)
ld de, MomSpriteGFX
ld b, BANK(MomSpriteGFX)
call Function11847
hlcoord 5, 2
ld de, String_117e6
call PlaceString
call Function11882
ret
; 117e6 (4:57e6)
String_117e6: ; 117e6
db "MOTHER'S NAME?@"
; 117f5
Function117f5: ; 117f5 (4:57f5)
ld de, PokeBallSpriteGFX
ld hl, $8000
lb bc, BANK(PokeBallSpriteGFX), $4
call Request2bpp
xor a
ld hl, $c300
ld [hli], a
ld [hl], a
ld de, $2420
ld a, $a
call Function3b2a
ld hl, $1
add hl, bc
ld [hl], $0
hlcoord 5, 2
ld de, String_11822
call PlaceString
call Function11889
ret
; 11822 (4:5822)
String_11822: ; 11822
db "BOX NAME?@"
; 1182c
Function1182c: ; 1182c (4:582c)
hlcoord 3, 2
ld de, String_11839
call PlaceString
call Function11882
ret
; 11839 (4:5839)
String_11839: ; 11839
db "おともだち の なまえは?@"
; 11847
Function11847: ; 11847 (4:5847)
push de
ld hl, $8000
ld c, $4
push bc
call Request2bpp
pop bc
ld hl, $c0
add hl, de
ld e, l
ld d, h
ld hl, $8040
call Request2bpp
xor a
ld hl, $c300
ld [hli], a
ld [hl], a
pop de
ld b, $a
ld a, d
cp $7a
jr nz, .asm_11873
ld a, e
cp $40
jr nz, .asm_11873
ld b, $1e
.asm_11873
ld a, b
ld de, $2420
call Function3b2a
ret
Function1187b: ; 1187b (4:587b)
ld a, $a
hlcoord 5, 6
jr Function11890
Function11882: ; 11882 (4:5882)
ld a, $7
hlcoord 5, 6
jr Function11890
Function11889: ; 11889 (4:5889)
ld a, $8
hlcoord 5, 4
jr Function11890
Function11890: ; 11890 (4:5890)
ld [$c6d3], a
ld a, l
ld [EnemySDefLevel], a ; $c6d8
ld a, h
ld [EnemyAccLevel], a ; $c6d9
ret
Function1189c: ; 1189c
push bc
push af
ld a, [EnemyAtkLevel]
sub $3
ld b, a
pop af
dec b
pop bc
ret
; 118a8
Function118a8: ; 118a8
call WaitTop
ld hl, TileMap
ld bc, $0168
ld a, $60
call ByteFill
hlcoord 1, 1
ld bc, $0612
call Function1189c
jr nz, .asm_118c4
ld bc, $0412
.asm_118c4
call ClearBox
ld de, $5da2
Function118ca: ; 118ca
call Function1189c
jr nz, .asm_118d5
ld hl, $0055
add hl, de
ld d, h
ld e, l
.asm_118d5
push de
hlcoord 1, 8
ld bc, $0712
call Function1189c
jr nz, .asm_118e7
hlcoord 1, 6
ld bc, $0912
.asm_118e7
call ClearBox
hlcoord 1, 16
ld bc, $0112
call ClearBox
pop de
hlcoord 2, 8
ld b, $5
call Function1189c
jr nz, .asm_11903
hlcoord 2, 6
ld b, $6
.asm_11903
ld c, $11
.asm_11905
ld a, [de]
ld [hli], a
inc de
dec c
jr nz, .asm_11905
push de
ld de, $0017
add hl, de
pop de
dec b
jr nz, .asm_11903
ret
; 11915
Function11915: ; 11915
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_11930
call Function11968
callba Function8cf62
call Function11940
call DelayFrame
and a
ret
.asm_11930
callab Function8cf53
call ClearSprites
xor a
ld [hSCX], a
ld [hSCY], a
scf
ret
; 11940
Function11940: ; 11940
xor a
ld [hBGMapMode], a
hlcoord 1, 5
call Function1189c
jr nz, .asm_1194e
hlcoord 1, 3
.asm_1194e
ld bc, $0112
call ClearBox
ld hl, PlayerSDefLevel
ld e, [hl]
inc hl
ld d, [hl]
ld hl, EnemySDefLevel
ld a, [hli]
ld h, [hl]
ld l, a
call PlaceString
ld a, $1
ld [hBGMapMode], a
ret
; 11968
Function11968: ; 11968
ld a, [$cf63]
ld e, a
ld d, $0
ld hl, Jumptable_11977
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 11977
Jumptable_11977: ; 11977 (4:5977)
dw Function1197b
dw Function119a1
Function1197b: ; 1197b (4:597b)
ld de, $5018
call Function1189c
jr nz, .asm_11985
ld d, $40
.asm_11985
ld a, $2
call Function3b2a
ld a, c
ld [EnemyDefLevel], a ; $c6d5
ld a, b
ld [$c6d6], a
ld hl, $1
add hl, bc
ld a, [hl]
ld hl, $e
add hl, bc
ld [hl], a
ld hl, $cf63
inc [hl]
ret
Function119a1: ; 119a1 (4:59a1)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and $1
jr nz, .asm_119b9
ld a, [hl]
and $2
jr nz, .asm_119e7
ld a, [hl]
and $8
jr nz, .asm_119cf
ld a, [hl]
and $4
jr nz, .asm_119f4
ret
.asm_119b9
call Function11a0b
cp $1
jr z, .asm_119f4
cp $2
jr z, .asm_119e7
cp $3
jr z, .asm_119eb
call Function11c11
call Function11b14
ret nc
.asm_119cf
ld hl, EnemyDefLevel ; $c6d5
ld c, [hl]
inc hl
ld b, [hl]
ld hl, $c
add hl, bc
ld [hl], $8
ld hl, $d
add hl, bc
ld [hl], $4
call Function1189c
ret nz
inc [hl]
ret
.asm_119e7
call Function11bbc
ret
.asm_119eb
call Function11bf7
ld hl, $cf63
set 7, [hl]
ret
.asm_119f4
ld hl, $cf64
ld a, [hl]
xor $1
ld [hl], a
jr z, .asm_11a04
ld de, $5ce7
call Function118ca
ret
.asm_11a04
ld de, $5da2
call Function118ca
ret
Function11a0b: ; 11a0b (4:5a0b)
ld hl, EnemyDefLevel ; $c6d5
ld c, [hl]
inc hl
ld b, [hl]
Function11a11: ; 11a11 (4:5a11)
ld hl, $d
add hl, bc
ld a, [hl]
push bc
ld b, $4
call Function1189c
jr nz, .asm_11a1f
inc b
.asm_11a1f
cp b
pop bc
jr nz, .asm_11a39
ld hl, $c
add hl, bc
ld a, [hl]
cp $3
jr c, .asm_11a33
cp $6
jr c, .asm_11a36
ld a, $3
ret
.asm_11a33
ld a, $1
ret
.asm_11a36
ld a, $2
ret
.asm_11a39
xor a
ret
Function11a3b: ; 11a3b (4:5a3b)
call Function11a8b
ld hl, $d
add hl, bc
ld a, [hl]
ld e, a
swap e
ld hl, $7
add hl, bc
ld [hl], e
ld d, $4
call Function1189c
jr nz, .asm_11a53
inc d
.asm_11a53
cp d
ld de, Unknown_11a79
ld a, $0
jr nz, .asm_11a60
ld de, Unknown_11a82
ld a, $1
.asm_11a60
ld hl, $e
add hl, bc
add [hl]
ld hl, $1
add hl, bc
ld [hl], a
ld hl, $c
add hl, bc
ld l, [hl]
ld h, $0
add hl, de
ld a, [hl]
ld hl, $6
add hl, bc
ld [hl], a
ret
; 11a79 (4:5a79)
Unknown_11a79: ; 11a79
db $00, $10, $20, $30, $40, $50, $60, $70, $80
Unknown_11a82: ; 11a82
db $00, $00, $00, $30, $30, $30, $60, $60, $60
; 11a8b
Function11a8b: ; 11a8b (4:5a8b)
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, .asm_11b02
ld a, [hl]
and $80
jr nz, .asm_11ae9
ld a, [hl]
and $20
jr nz, .asm_11ac5
ld a, [hl]
and $10
jr nz, .asm_11aa3
ret
.asm_11aa3
call Function11a11
and a
jr nz, .asm_11ab7
ld hl, $c
add hl, bc
ld a, [hl]
cp $8
jr nc, .asm_11ab4
inc [hl]
ret
.asm_11ab4
ld [hl], $0
ret
.asm_11ab7
cp $3
jr nz, .asm_11abc
xor a
.asm_11abc
ld e, a
add a
add e
ld hl, $c
add hl, bc
ld [hl], a
ret
.asm_11ac5
call Function11a11
and a
jr nz, .asm_11ad8
ld hl, $c
add hl, bc
ld a, [hl]
and a
jr z, .asm_11ad5
dec [hl]
ret
.asm_11ad5
ld [hl], $8
ret
.asm_11ad8
cp $1
jr nz, .asm_11ade
ld a, $4
.asm_11ade
dec a
dec a
ld e, a
add a
add e
ld hl, $c
add hl, bc
ld [hl], a
ret
.asm_11ae9
ld hl, $d
add hl, bc
ld a, [hl]
call Function1189c
jr nz, .asm_11af9
cp $5
jr nc, .asm_11aff
inc [hl]
ret
.asm_11af9
cp $4
jr nc, .asm_11aff
inc [hl]
ret
.asm_11aff
ld [hl], $0
ret
.asm_11b02
ld hl, $d
add hl, bc
ld a, [hl]
and a
jr z, .asm_11b0c
dec [hl]
ret
.asm_11b0c
ld [hl], $4
call Function1189c
ret nz
inc [hl]
ret
Function11b14: ; 11b14 (4:5b14)
ld a, [EnemySAtkLevel] ; $c6d7
Function11b17: ; 11b17 (4:5b17)
ld a, [$c6d3]
ld c, a
ld a, [PlayerEvaLevel] ; $c6d2
cp c
ret nc
ld a, [EnemySAtkLevel] ; $c6d7
Function11b23: ; 11b23
call Function11bd0
ld [hl], a
Function11b27: ; 11b27
ld hl, PlayerEvaLevel ; $c6d2
inc [hl]
call Function11bd0
ld a, [hl]
cp $50
jr z, .asm_11b37
ld [hl], $f2
and a
ret
.asm_11b37
scf
ret
; 11b39 (4:5b39)
Function11b39: ; 11b39
ld a, [PlayerEvaLevel]
and a
ret z
push hl
ld hl, PlayerEvaLevel
dec [hl]
call Function11bd0
ld c, [hl]
pop hl
.asm_11b48
ld a, [hli]
cp $ff
jr z, Function11b27
cp c
jr z, .asm_11b53
inc hl
jr .asm_11b48
.asm_11b53
ld a, [hl]
jr Function11b23
; 11b56
Dakutens: ; 11b56
db "かが", "きぎ", "くぐ", "けげ", "こご"
db "さざ", "しじ", "すず", "せぜ", "そぞ"
db "ただ", "ちぢ", "つづ", "てで", "とど"
db "はば", "ひび", "ふぶ", "へべ", "ほぼ"
db "カガ", "キギ", "クグ", "ケゲ", "コゴ"
db "サザ", "シジ", "スズ", "セゼ", "ソゾ"
db "タダ", "チヂ", "ツヅ", "テデ", "トド"
db "ハバ", "ヒビ", "フブ", "へべ", "ホボ"
db $ff
Handakutens: ; 11ba7
db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ"
db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ"
db $ff
; 11bbc
Function11bbc: ; 11bbc (4:5bbc)
ld hl, PlayerEvaLevel ; $c6d2
ld a, [hl]
and a
ret z
dec [hl]
call Function11bd0
ld [hl], $f2
inc hl
ld a, [hl]
cp $f2
ret nz
ld [hl], $eb
ret
Function11bd0: ; 11bd0 (4:5bd0)
push af
ld hl, PlayerSDefLevel ; $c6d0
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [PlayerEvaLevel] ; $c6d2
ld e, a
ld d, 0
add hl, de
pop af
ret
; 11be0
Function11be0: ; 11be0
ld hl, PlayerSDefLevel
ld a, [hli]
ld h, [hl]
ld l, a
ld [hl], $f2
inc hl
ld a, [$c6d3]
dec a
ld c, a
ld a, $eb
.asm_11bf0
ld [hli], a
dec c
jr nz, .asm_11bf0
ld [hl], $50
ret
; 11bf7
Function11bf7: ; 11bf7 (4:5bf7)
ld hl, PlayerSDefLevel ; $c6d0
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$c6d3]
ld c, a
.asm_11c01
ld a, [hl]
cp $eb
jr z, .asm_11c0a
cp $f2
jr nz, .asm_11c0c
.asm_11c0a
ld [hl], $50
.asm_11c0c
inc hl
dec c
jr nz, .asm_11c01
ret
Function11c11: ; 11c11 (4:5c11)
ld hl, EnemyDefLevel ; $c6d5
ld c, [hl]
inc hl
ld b, [hl]
ld hl, $6
add hl, bc
ld a, [hl]
ld hl, $4
add hl, bc
add [hl]
sub $8
srl a
srl a
srl a
ld e, a
ld hl, $7
add hl, bc
ld a, [hl]
ld hl, $5
add hl, bc
add [hl]
sub $10
srl a
srl a
srl a
ld d, a
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $14
.asm_11c43
ld a, d
and a
jr z, .asm_11c4b
add hl, bc
dec d
jr .asm_11c43
.asm_11c4b
add hl, de
ld a, [hl]
ld [EnemySAtkLevel], a ; $c6d7
ret
Function11c51: ; 11c51
call ClearSprites
callab Function8cf53
call Functione51
call Functione5f
ld de, GFX_11e65
ld hl, $8eb0
lb bc, BANK(GFX_11e65), 1
call Get1bpp
ld de, GFX_11e6d
ld hl, $8f20
lb bc, BANK(GFX_11e6d), 1
call Get1bpp
ld de, $9600
ld hl, GFX_11cb7
ld bc, $10
ld a, BANK(GFX_11cb7)
call FarCopyBytes
ld de, $87e0
ld hl, GFX_11cc7
ld bc, $20
ld a, BANK(GFX_11cc7)
call FarCopyBytes
ld a, $5
ld hl, $c312
ld [hli], a
ld [hl], $7e
xor a
ld [hSCY], a
ld [$c3bf], a
ld [hSCX], a
ld [$c3c0], a
ld [$cf63], a
ld [$cf64], a
ld [hBGMapMode], a
ld [PlayerEvaLevel], a
ld a, $7
ld [hWX], a
ret
; 11cb7
GFX_11cb7: ; 11cb7
INCBIN "baserom.gbc", $11cb7, $11cc7 - $11cb7
; 11cc7
GFX_11cc7: ; 11cc7
INCBIN "baserom.gbc", $11cc7, $11ce7 - $11cc7
; 11ce7
NameInputLower:
db "a b c d e f g h i"
db "j k l m n o p q r"
db "s t u v w x y z "
db "× ( ) : ; [ ] ", $e1, " ", $e2
db "UPPER DEL END "
BoxNameInputLower:
db "a b c d e f g h i"
db "j k l m n o p q r"
db "s t u v w x y z "
db "é 'd 'l 'm 'r 's 't 'v 0"
db "1 2 3 4 5 6 7 8 9"
db "UPPER DEL END "
NameInputUpper:
db "A B C D E F G H I"
db "J K L M N O P Q R"
db "S T U V W X Y Z "
db "- ? ! / . , "
db "lower DEL END "
BoxNameInputUpper:
db "A B C D E F G H I"
db "J K L M N O P Q R"
db "S T U V W X Y Z "
db "× ( ) : ; [ ] ", $e1, " ", $e2
db "- ? ! ♂ ♀ / . , &"
db "lower DEL END "
; 11e5d
GFX_11e5d: ; 11e5d
INCBIN "baserom.gbc",$11e5d,$11e65 - $11e5d
; 11e6d
GFX_11e65:
INCBIN "baserom.gbc",$11e65,$11e6d - $11e65
; 11e6d
GFX_11e6d: ; 11e6d
INCBIN "baserom.gbc", $11e6d, $11e75 - $11e6d
; 11e75
Function11e75: ; 11e75 (4:5e75)
ld hl, PlayerSDefLevel ; $c6d0
ld [hl], e
inc hl
ld [hl], d
ld a, [$FF00+$de]
push af
xor a
ld [$FF00+$de], a
ld a, [$FF00+$aa]
push af
ld a, $1
ld [$FF00+$aa], a
call Function11e9a
call DelayFrame
.asm_11e8e
call Function11fc0
jr nc, .asm_11e8e
pop af
ld [$FF00+$aa], a
pop af
ld [$FF00+$de], a
ret
Function11e9a: ; 11e9a (4:5e9a)
call WhiteBGMap
call DisableLCD
call Function11c51
ld de, $8000
ld hl, GFX_11ef4
ld bc, $80
ld a, BANK(GFX_11ef4)
call FarCopyBytes
xor a
ld hl, $c300
ld [hli], a
ld [hl], a
ld de, $1810
ld a, $0
call Function3b2a
ld hl, $2
add hl, bc
ld [hl], $0
call Function11f84
ld a, $e3
ld [rLCDC], a ; $ff00+$40
call Function11f74
ld b, $8
call GetSGBLayout
call WaitBGMap
call WaitTop
ld a, $e4
call DmgToCgbBGPals
ld a, $e4
call Functioncf8
call Function11be0
ld hl, PlayerSDefLevel ; $c6d0
ld e, [hl]
inc hl
ld d, [hl]
ld hl, $10
add hl, de
ld [hl], $4e
ret
; 11ef4 (4:5ef4)
GFX_11ef4: ; 11ef4
INCBIN "baserom.gbc",$11ef4,$11f74 - $11ef4
; 11f74
Function11f74: ; 11f74 (4:5f74)
ld a, $21
ld [$c6d3], a
ret
; 11f7a (4:5f7a)
String_11f7a: ; 11f7a
db "メールを かいてね@"
; 11f84
Function11f84: ; 11f84 (4:5f84)
call WaitTop
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $78
ld a, $60
call ByteFill
hlcoord 0, 6
ld bc, $f0
ld a, $7f
call ByteFill
hlcoord 1, 1
ld bc, $412
call ClearBox
ld de, String_121dd
Function11fa9: ; 11fa9 (4:5fa9)
hlcoord 1, 7
ld b, $6
.asm_11fae
ld c, $13
.asm_11fb0
ld a, [de]
ld [hli], a
inc de
dec c
jr nz, .asm_11fb0
push de
ld de, $15
add hl, de
pop de
dec b
jr nz, .asm_11fae
ret
Function11fc0: ; 11fc0 (4:5fc0)
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_11fdb
call Function12008
callba Function8cf62
call Function11feb
call DelayFrame
and a
ret
.asm_11fdb
callab Function8cf53
call ClearSprites
xor a
ld [hSCX], a ; $ff00+$cf
ld [hSCY], a ; $ff00+$d0
scf
ret
Function11feb: ; 11feb (4:5feb)
xor a
ld [hBGMapMode], a ; $ff00+$d4
hlcoord 1, 1
ld bc, $412
call ClearBox
ld hl, PlayerSDefLevel ; $c6d0
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 2, 2
call PlaceString
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
Function12008: ; 12008 (4:6008)
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_12017
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_12017: ; 12017 (4:6017)
dw Function1201b
dw Function1203a
Function1201b: ; 1201b (4:601b)
ld de, $4810
ld a, $9
call Function3b2a
ld a, c
ld [EnemyDefLevel], a ; $c6d5
ld a, b
ld [$c6d6], a
ld hl, $1
add hl, bc
ld a, [hl]
ld hl, $e
add hl, bc
ld [hl], a
ld hl, $cf63
inc [hl]
ret
Function1203a: ; 1203a (4:603a)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and $1
jr nz, .asm_12052
ld a, [hl]
and $2
jr nz, .asm_1208d
ld a, [hl]
and $8
jr nz, .asm_1207a
ld a, [hl]
and $4
jr nz, .asm_120aa
ret
.asm_12052
call Function12185
cp $1
jr z, .asm_120aa
cp $2
jr z, .asm_1208d
cp $3
jr z, .asm_120a1
call Function11c11
call Function121ac
jr c, .asm_1207a
ld hl, PlayerEvaLevel ; $c6d2
ld a, [hl]
cp $10
ret nz
inc [hl]
call Function11bd0
ld [hl], $f2
dec hl
ld [hl], $4e
ret
.asm_1207a
ld hl, EnemyDefLevel ; $c6d5
ld c, [hl]
inc hl
ld b, [hl]
ld hl, $c
add hl, bc
ld [hl], $9
ld hl, $d
add hl, bc
ld [hl], $5
ret
.asm_1208d
call Function11bbc
ld hl, PlayerEvaLevel ; $c6d2
ld a, [hl]
cp $10
ret nz
dec [hl]
call Function11bd0
ld [hl], $f2
inc hl
ld [hl], $4e
ret
.asm_120a1
call Function11bf7
ld hl, $cf63
set 7, [hl]
ret
.asm_120aa
ld hl, $cf64
ld a, [hl]
xor $1
ld [hl], a
jr nz, .asm_120ba
ld de, String_121dd
call Function11fa9
ret
.asm_120ba
ld de, String_1224f
call Function11fa9
ret
Function120c1: ; 120c1 (4:60c1)
call Function1210c
ld hl, $d
add hl, bc
ld a, [hl]
ld e, a
swap e
ld hl, $7
add hl, bc
ld [hl], e
cp $5
ld de, Unknown_120f8
ld a, $0
jr nz, .asm_120df
ld de, Unknown_12102
ld a, $1
.asm_120df
ld hl, $e
add hl, bc
add [hl]
ld hl, $1
add hl, bc
ld [hl], a
ld hl, $c
add hl, bc
ld l, [hl]
ld h, $0
add hl, de
ld a, [hl]
ld hl, $6
add hl, bc
ld [hl], a
ret
; 120f8 (4:60f8)
Unknown_120f8: ; 120f8
db $00, $10, $20, $30, $40, $50, $60, $70, $80, $90
Unknown_12102: ; 12102
db $00, $00, $00, $30, $30, $30, $60, $60, $60, $60
; 1210c
Function1210c: ; 1210c (4:610c)
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, .asm_12178
ld a, [hl]
and $80
jr nz, .asm_1216a
ld a, [hl]
and $20
jr nz, .asm_12146
ld a, [hl]
and $10
jr nz, .asm_12124
ret
.asm_12124
call Function1218b
and a
jr nz, .asm_12138
ld hl, $c
add hl, bc
ld a, [hl]
cp $9
jr nc, .asm_12135
inc [hl]
ret
.asm_12135
ld [hl], $0
ret
.asm_12138
cp $3
jr nz, .asm_1213d
xor a
.asm_1213d
ld e, a
add a
add e
ld hl, $c
add hl, bc
ld [hl], a
ret
.asm_12146
call Function1218b
and a
jr nz, .asm_12159
ld hl, $c
add hl, bc
ld a, [hl]
and a
jr z, .asm_12156
dec [hl]
ret
.asm_12156
ld [hl], $9
ret
.asm_12159
cp $1
jr nz, .asm_1215f
ld a, $4
.asm_1215f
dec a
dec a
ld e, a
add a
add e
ld hl, $c
add hl, bc
ld [hl], a
ret
.asm_1216a
ld hl, $d
add hl, bc
ld a, [hl]
cp $5
jr nc, .asm_12175
inc [hl]
ret
.asm_12175
ld [hl], $0
ret
.asm_12178
ld hl, $d
add hl, bc
ld a, [hl]
and a
jr z, .asm_12182
dec [hl]
ret
.asm_12182
ld [hl], $5
ret
Function12185: ; 12185 (4:6185)
ld hl, EnemyDefLevel ; $c6d5
ld c, [hl]
inc hl
ld b, [hl]
Function1218b: ; 1218b (4:618b)
ld hl, $d
add hl, bc
ld a, [hl]
cp $5
jr nz, .asm_121aa
ld hl, $c
add hl, bc
ld a, [hl]
cp $3
jr c, .asm_121a4
cp $6
jr c, .asm_121a7
ld a, $3
ret
.asm_121a4
ld a, $1
ret
.asm_121a7
ld a, $2
ret
.asm_121aa
xor a
ret
Function121ac: ; 121ac (4:61ac)
ld a, [EnemySAtkLevel] ; $c6d7
jp Function11b17
; 121b2 (4:61b2)
Function121b2: ; 121b2
ld a, [PlayerEvaLevel]
and a
ret z
cp $11
jr nz, .asm_121c3
push hl
ld hl, PlayerEvaLevel
dec [hl]
dec [hl]
jr .asm_121c8
.asm_121c3
push hl
ld hl, PlayerEvaLevel
dec [hl]
.asm_121c8
call Function11bd0
ld c, [hl]
pop hl
.asm_121cd
ld a, [hli]
cp $ff
jp z, Function11b27
cp c
jr z, .asm_121d9
inc hl
jr .asm_121cd
.asm_121d9
ld a, [hl]
jp Function11b23
; 121dd
String_121dd: ; 122dd
db "A B C D E F G H I J"
db "K L M N O P Q R S T"
db "U V W X Y Z , ? !"
db "1 2 3 4 5 6 7 8 9 0"
db "ゅ ょ ", $70, " ", $71, " é ♂ ♀ ¥ … ×"
db "lower DEL END "
; 1224f
String_1224f: ; 1224f
db "a b c d e f g h i j"
db "k l m n o p q r s t"
db "u v w x y z . - /"
db "'d 'l 'm 'r 's 't 'v & ( )"
db $72, " ", $73, " [ ] ' : ; "
db "UPPER DEL END "
; 122c1
UnknownScript_0x122c1: ; 0x122c1
checkflag $0011
iffalse .script_122cd
setflag $0051
special $0017
.script_122cd
end
; 0x122ce
UnknownScript_0x122ce:: ; 0x122ce
3callasm Function122f8
iffalse UnknownScript_0x122e3
disappear $fe
loadfont
2writetext UnknownText_0x122ee
playsound SFX_ITEM
pause 60
itemnotify
loadmovesprites
end
; 0x122e3
UnknownScript_0x122e3: ; 0x122e3
loadfont
2writetext UnknownText_0x122ee
closetext
2writetext UnknownText_0x122f3
closetext
loadmovesprites
end
; 0x122ee
UnknownText_0x122ee: ; 0x122ee
; found @ !
text_jump UnknownText_0x1c0a1c
db "@"
; 0x122f3
UnknownText_0x122f3: ; 0x122f3
; But can't carry any more items.
text_jump UnknownText_0x1c0a2c
db "@"
; 0x122f8
Function122f8: ; 122f8
xor a
ld [ScriptVar], a
ld a, [EngineBuffer1]
ld [$d265], a
call GetItemName
ld hl, StringBuffer3
call CopyName2
ld a, [EngineBuffer1]
ld [CurItem], a
ld a, [CurFruit]
ld [$d10c], a
ld hl, NumItems
call ReceiveItem
ret nc
ld a, $1
ld [ScriptVar], a
ret
; 12324
Function12324: ; 12324
ld a, [PartyCount]
and a
ret z
ld a, [ScriptVar]
ld [Buffer1], a
ld a, [rOBP1]
ld [Buffer2], a
call Function1233e
ld a, [Buffer2]
call Functiond24
ret
; 1233e
Function1233e: ; 1233e
xor a
ld [$d1ec], a
.asm_12342
ld a, [Buffer1]
ld e, a
ld d, 0
ld hl, Unknown_12365
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$d1ec]
ld e, a
inc a
ld [$d1ec], a
add hl, de
ld a, [hl]
cp 5
jr z, .asm_12364
ld hl, Jumptable_12377
rst JumpTable
jr .asm_12342
.asm_12364
ret
; 12365
Unknown_12365: ; 12365
dw Unknown_1236b
dw Unknown_1236f
dw Unknown_12373
; 1236b
Unknown_1236b: ; 1236b
db 0, 1, 3, 5
Unknown_1236f: ; 1236f
db 0, 1, 3, 5
Unknown_12373: ; 12373
db 0, 2, 4, 5
; 12377
Jumptable_12377: ; 12377
dw Function12383
dw Function12393
dw Function123a1
dw Function123bf
dw Function123c8
dw Function123db
; 12383
Function12383: ; 12383
call Function12434
ld de, GFX_123fc
ld hl, $87c0
lb bc, BANK(GFX_123fc), $2
call Request2bpp
ret
; 12393
Function12393: ; 12393
ld hl, $c480
ld de, Unknown_123dc
call Function124a3
call Function124a3
jr Function123a7
Function123a1: ; 123a1
ld hl, $c480
ld de, Unknown_1241c
Function123a7: ; 123a7
ld a, [PartyCount]
ld b, a
.asm_123ab
call Function124a3
push de
ld de, SFX_SECOND_PART_OF_ITEMFINDER
call PlaySFX
pop de
ld c, 30
call DelayFrames
dec b
jr nz, .asm_123ab
ret
; 123bf
Function123bf: ; 123bf
ld de, MUSIC_HEAL
call PlayMusic
jp Function12459
; 123c8
Function123c8: ; 123c8
ld de, SFX_GAME_FREAK_LOGO_GS
call PlaySFX
call Function12459
call WaitSFX
ld de, SFX_BOOT_PC
call PlaySFX
ret
; 123db
Function123db: ; 123db
ret
; 123dc
Unknown_123dc: ; 123dc
db $20, $22, $7c, $16
db $20, $26, $7c, $16
db $26, $20, $7d, $16
db $26, $28, $7d, $36
db $2b, $20, $7d, $16
db $2b, $28, $7d, $36
db $30, $20, $7d, $16
db $30, $28, $7d, $36
; 123fc
GFX_123fc: ; 123fc
INCBIN "baserom.gbc", $123fc, $1241c - $123fc
; 1241c
Unknown_1241c: ; 1241c
db $3c, $51, $7d, $16
db $3c, $56, $7d, $16
db $3b, $4d, $7d, $16
db $3b, $5a, $7d, $16
db $39, $49, $7d, $16
db $39, $5d, $7d, $16
; 12434
Function12434: ; 12434
call Function3218
jr nz, .asm_1243e
ld a, $e0
ld [rOBP1], a
ret
.asm_1243e
ld hl, Palette_12451
ld de, $d0f0
ld bc, 8
ld a, $5
call FarCopyWRAM
ld a, $1
ld [hCGBPalUpdate], a
ret
; 12451
Palette_12451: ; 12451
RGB 31, 31, 31
RGB 31, 19, 10
RGB 31, 07, 01
RGB 00, 00, 00
; 12459
Function12459: ; 12459
ld c, $8
.asm_1245b
push bc
call Function12469
ld c, $a
call DelayFrames
pop bc
dec c
jr nz, .asm_1245b
ret
; 12469
Function12469: ; 12469
call Function3218
jr nz, .asm_12475
ld a, [rOBP1]
xor $28
ld [rOBP1], a
ret
.asm_12475
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, $d0f0
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push de
ld c, $3
.asm_12486
ld a, [hli]
ld e, a
ld a, [hld]
ld d, a
dec hl
ld a, d
ld [hld], a
ld a, e
ld [hli], a
inc hl
inc hl
inc hl
dec c
jr nz, .asm_12486
pop de
dec hl
ld a, d
ld [hld], a
ld a, e
ld [hl], a
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ret
; 124a3
Function124a3: ; 124a3
push bc
ld a, [Buffer1]
lb bc, $10, $20
cp $1
jr z, .asm_124b1
lb bc, $00, $00
.asm_124b1
ld a, [de]
add c
inc de
ld [hli], a
ld a, [de]
add b
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
pop bc
ret
; 124c1
UnknownScript_0x124c1:: ; 0x124c1
3callasm Function1250a
2jump UnknownScript_0x124ce
; 0x124c8
UnknownScript_0x124c8:: ; 0x124c8
refreshscreen $0
3callasm Function124fa
UnknownScript_0x124ce: ; 0x124ce
2writetext UnknownText_0x124f5
closetext
special $002e
pause 40
special $001b
checkflag $0011
iftrue .script_64f2
3callasm HalveMoney
3callasm Function12527
3call UnknownScript_0x122c1
special $0000
newloadmap $f1
resetfuncs
.script_64f2
jumpstd $0016
; 0x124f5
UnknownText_0x124f5: ; 0x124f5
; is out of useable #MON! whited out!
text_jump UnknownText_0x1c0a4e
db "@"
; 0x124fa
Function124fa: ; 124fa
call ClearPalettes
call ClearScreen
call Function3200
call HideSprites
call Function4f0
ret
; 1250a
Function1250a: ; 1250a
ld b, $0
call GetSGBLayout
call Function32f9
ret
; 12513
HalveMoney: ; 12513
; Empty function...
callba Function1060c7
; Halve the player's money.
ld hl, Money
ld a, [hl]
srl a
ld [hli], a
ld a, [hl]
rra
ld [hli], a
ld a, [hl]
rra
ld [hl], a
ret
; 12527
Function12527: ; 12527
ld a, [$dcb2]
ld d, a
ld a, [$dcb3]
ld e, a
callba IsSpawnPoint
ld a, c
jr c, .asm_12539
xor a
.asm_12539
ld [$d001], a
ret
; 1253d
UnknownScript_0x1253d:: ; 0x1253d
checkcode $9
if_equal $0, UnknownScript_0x12555
if_equal $1, UnknownScript_0x12550
if_equal $2, UnknownScript_0x1255f
if_equal $3, UnknownScript_0x1255a
end
; 0x12550
UnknownScript_0x12550: ; 0x12550
applymovement $0, MovementData_0x12564
end
; 0x12555
UnknownScript_0x12555: ; 0x12555
applymovement $0, MovementData_0x1256b
end
; 0x1255a
UnknownScript_0x1255a: ; 0x1255a
applymovement $0, MovementData_0x12572
end
; 0x1255f
UnknownScript_0x1255f: ; 0x1255f
applymovement $0, MovementData_0x12579
end
; 0x12564
MovementData_0x12564: ; 0x12564
step_wait5
big_step_down
turn_in_down
step_wait5
big_step_down
turn_head_down
step_end
; 0x1256b
MovementData_0x1256b: ; 0x1256b
step_wait5
big_step_down
turn_in_up
step_wait5
big_step_down
turn_head_up
step_end
; 0x12572
MovementData_0x12572: ; 0x12572
step_wait5
big_step_down
turn_in_left
step_wait5
big_step_down
turn_head_left
step_end
; 0x12579
MovementData_0x12579: ; 0x12579
step_wait5
big_step_down
turn_in_right
step_wait5
big_step_down
turn_head_right
step_end
; 0x12580
Function12580: ; 12580
callba Functionb8172
jr c, .asm_1258d
ld hl, UnknownScript_0x125ba
jr .asm_12590
.asm_1258d
ld hl, UnknownScript_0x125ad
.asm_12590
call Function31cd
ld a, $1
ld [$d0ec], a
ret
; 12599
Function12599: ; 12599
ld c, $4
.asm_1259b
push bc
ld de, SFX_SECOND_PART_OF_ITEMFINDER
call WaitPlaySFX
ld de, SFX_TRANSACTION
call WaitPlaySFX
pop bc
dec c
jr nz, .asm_1259b
ret
; 125ad
UnknownScript_0x125ad: ; 0x125ad
reloadmappart
special $0035
3callasm Function12599
2writetext UnknownText_0x125c3
loadmovesprites
end
; 0x125ba
UnknownScript_0x125ba: ; 0x125ba
reloadmappart
special $0035
2writetext UnknownText_0x125c8
loadmovesprites
end
; 0x125c3
UnknownText_0x125c3: ; 0x125c3
; Yes! ITEMFINDER indicates there's an item nearby.
text_jump UnknownText_0x1c0a77
db "@"
; 0x125c8
UnknownText_0x125c8: ; 0x125c8
; Nope! ITEMFINDER isn't responding.
text_jump UnknownText_0x1c0aa9
db "@"
; 0x125cd
StartMenu:: ; 125cd
call Function1fbf
ld de, SFX_MENU
call PlaySFX
callba Function6454
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
ld hl, .MenuDataHeader
jr z, .GotMenuData
ld hl, .ContestMenuDataHeader
.GotMenuData
call LoadMenuDataHeader
call .SetUpMenuItems
ld a, [$d0d2]
ld [$cf88], a
call .DrawMenuAccount_
call MenuFunc_1e7f
call .DrawBugContestStatusBox
call Function2e31
call Function2e20
callba Function64bf
call .DrawBugContestStatus
call UpdateTimePals
jr .Select
.Reopen
call Function1ad2
call UpdateTimePals
call .SetUpMenuItems
ld a, [$d0d2]
ld [$cf88], a
.Select
call .GetInput
jr c, .Exit
call .DrawMenuAccount
ld a, [$cf88]
ld [$d0d2], a
call PlayClickSFX
call Function1bee
call .OpenMenu
; Menu items have different return functions.
; For example, saving exits the menu.
ld hl, .MenuReturns
ld e, a
ld d, 0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
.MenuReturns
dw .Reopen
dw .Exit
dw .ReturnTwo
dw .ReturnThree
dw .ReturnFour
dw .ReturnEnd
dw .ReturnRedraw
.Exit
ld a, [hOAMUpdate]
push af
ld a, 1
ld [hOAMUpdate], a
call Functione5f
pop af
ld [hOAMUpdate], a
.ReturnEnd
call Function1c07
.ReturnEnd2
call Function2dcf
call UpdateTimePals
ret
.GetInput
; Return carry on exit, and no-carry on selection.
xor a
ld [hBGMapMode], a
call .DrawMenuAccount
call SetUpMenu
ld a, $ff
ld [MenuSelection], a
.loop
call .PrintMenuAccount
call Function1f1a
ld a, [$cf73]
cp B_BUTTON
jr z, .b
cp A_BUTTON
jr z, .a
jr .loop
.a
call PlayClickSFX
and a
ret
.b
scf
ret
; 12691
.ReturnFour ; 12691
call Function1c07
ld a, $80
ld [$ffa0], a
ret
; 12699
.ReturnThree ; 12699
call Function1c07
ld a, $80
ld [$ffa0], a
jr .ReturnEnd2
; 126a2
.ReturnTwo ; 126a2
call Function1c07
ld hl, $d0e9
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$d0e8]
rst FarCall
jr .ReturnEnd2
; 126b1
.ReturnRedraw ; 126b1
call .Clear
jp .Reopen
; 126b7
.Clear ; 126b7
call WhiteBGMap
call Function1d7d
call Function2bae
call .DrawMenuAccount_
call MenuFunc_1e7f
call .DrawBugContestStatus
call Function1ad2
call Functiond90
call Function2b5c
ret
; 126d3
.MenuDataHeader
db $40 ; tile backup
db 0, 10 ; start coords
db 17, 19 ; end coords
dw .MenuData
db 1 ; default selection
.ContestMenuDataHeader
db $40 ; tile backup
db 2, 10 ; start coords
db 17, 19 ; end coords
dw .MenuData
db 1 ; default selection
.MenuData
db %10101000 ; x padding, wrap around, start can close
dn 0, 0 ; rows, columns
dw MenuItemsList
dw .MenuString
dw .Items
.Items
dw StartMenu_Pokedex, .PokedexString, .PokedexDesc
dw StartMenu_Pokemon, .PartyString, .PartyDesc
dw StartMenu_Pack, .PackString, .PackDesc
dw StartMenu_Status, .StatusString, .StatusDesc
dw StartMenu_Save, .SaveString, .SaveDesc
dw StartMenu_Option, .OptionString, .OptionDesc
dw StartMenu_Exit, .ExitString, .ExitDesc
dw StartMenu_Pokegear, .PokegearString, .PokegearDesc
dw StartMenu_Quit, .QuitString, .QuitDesc
.PokedexString db "#DEX@"
.PartyString db "#MON@"
.PackString db "PACK@"
.StatusString db $52, "@"
.SaveString db "SAVE@"
.OptionString db "OPTION@"
.ExitString db "EXIT@"
.PokegearString db $24, "GEAR@"
.QuitString db "QUIT@"
.PokedexDesc db "#MON", $4e, "database@"
.PartyDesc db "Party ", $4a, $4e, "status@"
.PackDesc db "Contains", $4e, "items@"
.PokegearDesc db "Trainer's", $4e, "key device@"
.StatusDesc db "Your own", $4e, "status@"
.SaveDesc db "Save your", $4e, "progress@"
.OptionDesc db "Change", $4e, "settings@"
.ExitDesc db "Close this", $4e, "menu@"
.QuitDesc db "Quit and", $4e, "be judged.@"
.OpenMenu ; 127e5
ld a, [MenuSelection]
call .GetMenuAccountTextPointer
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 127ef
.MenuString ; 127ef
push de
ld a, [MenuSelection]
call .GetMenuAccountTextPointer
inc hl
inc hl
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
call PlaceString
ret
; 12800
.MenuDesc ; 12800
push de
ld a, [MenuSelection]
cp $ff
jr z, .none
call .GetMenuAccountTextPointer
inc hl
inc hl
inc hl
inc hl
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
call PlaceString
ret
.none
pop de
ret
; 12819
.GetMenuAccountTextPointer ; 12819
ld e, a
ld d, 0
ld hl, $cf97
ld a, [hli]
ld h, [hl]
ld l, a
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
ret
; 12829
.SetUpMenuItems ; 12829
xor a
ld [$cf76], a
call .FillMenuList
ld hl, StatusFlags
bit 0, [hl]
jr z, .no_pokedex
ld a, 0 ; pokedex
call .AppendMenuList
.no_pokedex
ld a, [PartyCount]
and a
jr z, .no_pokemon
ld a, 1 ; pokemon
call .AppendMenuList
.no_pokemon
ld a, [InLinkBattle]
and a
jr nz, .no_pack
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
jr nz, .no_pack
ld a, 2 ; pack
call .AppendMenuList
.no_pack
ld hl, $d957
bit 7, [hl]
jr z, .no_pokegear
ld a, 7 ; pokegear
call .AppendMenuList
.no_pokegear
ld a, 3 ; status
call .AppendMenuList
ld a, [InLinkBattle]
and a
jr nz, .no_save
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
ld a, 8 ; quit
jr nz, .write
ld a, 4 ; save
.write
call .AppendMenuList
.no_save
ld a, 5 ; option
call .AppendMenuList
ld a, 6 ; exit
call .AppendMenuList
ld a, c
ld [MenuItemsList], a
ret
; 1288d
.FillMenuList ; 1288d
xor a
ld hl, MenuItemsList
ld [hli], a
ld a, $ff
ld bc, $000f
call ByteFill
ld de, MenuItemsList + 1
ld c, 0
ret
; 128a0
.AppendMenuList ; 128a0
ld [de], a
inc de
inc c
ret
; 128a4
.DrawMenuAccount_ ; 128a4
jp .DrawMenuAccount
; 128a7
.PrintMenuAccount ; 128a7
call .IsMenuAccountOn
ret z
call .DrawMenuAccount
decoord 0, 14
jp .MenuDesc
; 128b4
.DrawMenuAccount ; 128b4
call .IsMenuAccountOn
ret z
hlcoord 0, 13
ld bc, $050a
call ClearBox
hlcoord 0, 13
ld b, 3
ld c, 8
jp TextBoxPalette
; 128cb
.IsMenuAccountOn ; 128cb
ld a, [Options2]
and 1
ret
; 128d1
.DrawBugContestStatusBox ; 128d1
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
ret z
callba Function24bdc
ret
; 128de
.DrawBugContestStatus ; 128de
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
jr nz, .contest
ret
.contest
callba Function24be7
ret
; 128ed
StartMenu_Exit: ; 128ed
; Exit the menu.
ld a, 1
ret
; 128f0
StartMenu_Quit: ; 128f0
; Retire from the bug catching contest.
ld hl, .EndTheContestText
call Function12cf5
jr c, .asm_12903
ld a, BANK(UnknownScript_0x1360b)
ld hl, UnknownScript_0x1360b
call Function31cf
ld a, 4
ret
.asm_12903
ld a, 0
ret
.EndTheContestText
text_jump UnknownText_0x1c1a6c
db "@"
; 1290b
StartMenu_Save: ; 1290b
; Save the game.
call Function2879
callba Function14a1a
jr nc, .asm_12919
ld a, 0
ret
.asm_12919
ld a, 1
ret
; 1291c
StartMenu_Option: ; 1291c
; Game options.
call FadeToMenu
callba OptionsMenu
ld a, 6
ret
; 12928
StartMenu_Status: ; 12928
; Player status.
call FadeToMenu
callba Function25105
call Function2b3c
ld a, 0
ret
; 12937
StartMenu_Pokedex: ; 12937
ld a, [PartyCount]
and a
jr z, .asm_12949
call FadeToMenu
callba Pokedex
call Function2b3c
.asm_12949
ld a, 0
ret
; 1294c
StartMenu_Pokegear: ; 1294c
call FadeToMenu
callba Function90b8d
call Function2b3c
ld a, 0
ret
; 1295b
StartMenu_Pack: ; 1295b
call FadeToMenu
callba Pack
ld a, [$cf66]
and a
jr nz, .asm_12970
call Function2b3c
ld a, 0
ret
.asm_12970
call Function2b4d
ld a, 4
ret
; 12976
StartMenu_Pokemon: ; 12976
ld a, [PartyCount]
and a
jr z, .return
call FadeToMenu
.choosemenu
xor a
ld [PartyMenuActionText], a ; Choose a POKéMON.
call WhiteBGMap
.menu
callba Function5004f
callba Function50405
callba Function503e0
.menunoreload
callba WritePartyMenuTilemap
callba PrintPartyMenuText
call WaitBGMap
call Function32f9 ; load regular palettes?
call DelayFrame
callba PartyMenuSelect
jr c, .return ; if cancelled or pressed B
call PokemonActionSubmenu
cp 3
jr z, .menu
cp 0
jr z, .choosemenu
cp 1
jr z, .menunoreload
cp 2
jr z, .quit
.return
call Function2b3c
ld a, 0
ret
.quit
ld a, b
push af
call Function2b4d
pop af
ret
; 129d5
Function129d5: ; 129d5
ld a, [NumItems] ; $d892 (aliases: TMsHMsEnd)
and a
ret nz
ld a, [NumKeyItems] ; $d8bc (aliases: ItemsEnd)
and a
ret nz
ld a, [NumBalls] ; $d8d7 (aliases: KeyItemsEnd)
and a
ret nz
ld hl, TMsHMs ; $d859
ld b, $39
.asm_129e9
ld a, [hli]
and a
jr nz, .asm_129f2
dec b
jr nz, .asm_129e9
scf
ret
.asm_129f2
and a
ret
Function129f4: ; 129f4
push de
call PartyMonItemName
callba _CheckTossableItem
ld a, [$d142]
and a
jr nz, .asm_12a3f
ld hl, UnknownText_0x12a45
call Function1d4f
callba Function24fbf
push af
call Function1c17
call Function1c07
pop af
jr c, .asm_12a42
ld hl, UnknownText_0x12a4a
call Function1d4f
call YesNoBox
push af
call Function1c07
pop af
jr c, .asm_12a42
pop hl
ld a, [$d107]
call TossItem
call PartyMonItemName
ld hl, UnknownText_0x12a4f
call Function1d4f
call Function1c07
and a
ret
.asm_12a3f
call Function12a54
.asm_12a42
pop hl
scf
ret
; 12a45 (4:6a45)
UnknownText_0x12a45: ; 0x12a45
; Toss out how many @ (S)?
text_jump UnknownText_0x1c1a90
db "@"
; 0x12a4a
UnknownText_0x12a4a: ; 0x12a4a
; Throw away @ @ (S)?
text_jump UnknownText_0x1c1aad
db "@"
; 0x12a4f
UnknownText_0x12a4f: ; 0x12a4f
; Discarded @ (S).
text_jump UnknownText_0x1c1aca
db "@"
; 0x12a54
Function12a54: ; 12a54 (4:6a54)
ld hl, UnknownText_0x12a5b
call Function1d67
ret
; 12a5b (4:6a5b)
UnknownText_0x12a5b: ; 0x12a5b
; That's too impor- tant to toss out!
text_jump UnknownText_0x1c1adf
db "@"
; 0x12a60
CantUseItem: ; 12a60
ld hl, CantUseItemText
call Function2012
ret
; 12a67
CantUseItemText: ; 12a67
text_jump UnknownText_0x1c1b03
db "@"
; 12a6c
PartyMonItemName: ; 12a6c
ld a, [CurItem]
ld [$d265], a
call GetItemName
call CopyName1
ret
; 12a79
CancelPokemonAction: ; 12a79
callba Function50405
callba Function8ea71
ld a, 1
ret
; 12a88
PokemonActionSubmenu: ; 12a88
hlcoord 1, 15
ld bc, $0212 ; box size
call ClearBox
callba Function24d19
call GetCurNick
ld a, [MenuSelection]
ld hl, .Actions
ld de, 3
call IsInArray
jr nc, .nothing
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
.nothing
ld a, 0
ret
.Actions
dbw 1, Function12e1b ; Cut
dbw 2, Function12e30 ; Fly
dbw 3, Function12ebd ; Surf
dbw 4, Function12e6a ; Strength
dbw 6, Function12e55 ; Flash
dbw 7, Function12e7f ; Whirlpool
dbw 8, Function12ed1 ; Dig
dbw 9, Function12ea9 ; Teleport
dbw 10, Function12ee6 ; Softboiled
dbw 13, Function12ee6 ; MilkDrink
dbw 11, Function12f26 ; Headbutt
dbw 5, Function12e94 ; Waterfall
dbw 12, Function12f3b ; RockSmash
dbw 14, Function12f50 ; SweetScent
dbw 15, OpenPartyStats
dbw 16, SwitchPartyMons
dbw 17, GiveTakePartyMonItem
dbw 18, CancelPokemonAction
dbw 19, Function12fba ; move
dbw 20, Function12d45 ; mail
; 12aec
SwitchPartyMons: ; 12aec
; Don't try if there's nothing to switch!
ld a, [PartyCount]
cp 2
jr c, .DontSwitch
ld a, [CurPartyMon]
inc a
ld [$d0e3], a
callba Function8ea8c
callba Function5042d
ld a, 4
ld [PartyMenuActionText], a
callba WritePartyMenuTilemap
callba PrintPartyMenuText
hlcoord 0, 1
ld bc, 20 * 2
ld a, [$d0e3]
dec a
call AddNTimes
ld [hl], "▷"
call WaitBGMap
call Function32f9
call DelayFrame
callba PartyMenuSelect
bit 1, b
jr c, .DontSwitch
callba Function50f12
xor a
ld [PartyMenuActionText], a
callba Function5004f
callba Function50405
callba Function503e0
ld a, 1
ret
.DontSwitch
xor a
ld [PartyMenuActionText], a
call CancelPokemonAction
ret
; 12b60
GiveTakePartyMonItem: ; 12b60
; Eggs can't hold items!
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_12ba6
ld hl, GiveTakeItemMenuData
call LoadMenuDataHeader
call Function1d81
call Function1c07
jr c, .asm_12ba6
call GetCurNick
ld hl, StringBuffer1
ld de, $d050
ld bc, $b
call CopyBytes
ld a, [$cfa9]
cp 1
jr nz, .asm_12ba0
call Function1d6e
call ClearPalettes
call Function12ba9
call ClearPalettes
call Functione58
call Function1c07
ld a, 0
ret
.asm_12ba0
call TakePartyItem
ld a, 3
ret
.asm_12ba6
ld a, 3
ret
; 12ba9
Function12ba9: ; 12ba9
callba Function106a5
.loop
callba Function106be
ld a, [$cf66]
and a
jr z, .quit
ld a, [$cf65]
cp 2
jr z, .next
call CheckTossableItem
ld a, [$d142]
and a
jr nz, .next
call Function12bd9
jr .quit
.next
ld hl, CantBeHeldText
call Function1d67
jr .loop
.quit
ret
; 12bd9
Function12bd9: ; 12bd9
call SpeechTextBox
call PartyMonItemName
call GetPartyItemLocation
ld a, [hl]
and a
jr z, .asm_12bf4
push hl
ld d, a
callba ItemIsMail
pop hl
jr c, .asm_12c01
ld a, [hl]
jr .asm_12c08
.asm_12bf4
call Function12cea
ld hl, MadeHoldText
call Function1d67
call GivePartyItem
ret
.asm_12c01
ld hl, PleaseRemoveMailText
call Function1d67
ret
.asm_12c08
ld [$d265], a
call GetItemName
ld hl, SwitchAlreadyHoldingText
call Function12cf5
jr c, .asm_12c4b
call Function12cea
ld a, [$d265]
push af
ld a, [CurItem]
ld [$d265], a
pop af
ld [CurItem], a
call Function12cdf
jr nc, .asm_12c3c
ld hl, TookAndMadeHoldText
call Function1d67
ld a, [$d265]
ld [CurItem], a
call GivePartyItem
ret
.asm_12c3c
ld a, [$d265]
ld [CurItem], a
call Function12cdf
ld hl, ItemStorageIsFullText
call Function1d67
.asm_12c4b
ret
; 12c4c
GivePartyItem: ; 12c4c
call GetPartyItemLocation
ld a, [CurItem]
ld [hl], a
ld d, a
callba ItemIsMail
jr nc, .asm_12c5f
call Function12cfe
.asm_12c5f
ret
; 12c60
TakePartyItem: ; 12c60
call SpeechTextBox
call GetPartyItemLocation
ld a, [hl]
and a
jr z, .asm_12c8c
ld [CurItem], a
call Function12cdf
jr nc, .asm_12c94
callba ItemIsMail
call GetPartyItemLocation
ld a, [hl]
ld [$d265], a
ld [hl], NO_ITEM
call GetItemName
ld hl, TookFromText
call Function1d67
jr .asm_12c9a
.asm_12c8c
ld hl, IsntHoldingAnythingText
call Function1d67
jr .asm_12c9a
.asm_12c94
ld hl, ItemStorageIsFullText
call Function1d67
.asm_12c9a
ret
; 12c9b
GiveTakeItemMenuData: ; 12c9b
db %01010000
db 12, 12 ; start coords
db 17, 19 ; end coords
dw .Items
db 1 ; default option
.Items
db %10000000 ; x padding
db 2 ; # items
db "GIVE@"
db "TAKE@"
; 12caf
TookAndMadeHoldText: ; 12caf
text_jump UnknownText_0x1c1b2c
db "@"
; 12cb4
MadeHoldText: ; 12cb4
text_jump UnknownText_0x1c1b57
db "@"
; 12cb9
PleaseRemoveMailText: ; 12cb9
text_jump UnknownText_0x1c1b6f
db "@"
; 12cbe
IsntHoldingAnythingText: ; 12cbe
text_jump UnknownText_0x1c1b8e
db "@"
; 12cc3
ItemStorageIsFullText: ; 12cc3
text_jump UnknownText_0x1c1baa
db "@"
; 12cc8
TookFromText: ; 12cc8
text_jump UnknownText_0x1c1bc4
db "@"
; 12ccd
SwitchAlreadyHoldingText: ; 12ccd
text_jump UnknownText_0x1c1bdc
db "@"
; 12cd2
CantBeHeldText: ; 12cd2
text_jump UnknownText_0x1c1c09
db "@"
; 12cd7
GetPartyItemLocation: ; 12cd7
push af
ld a, PartyMon1Item - PartyMon1
call GetPartyParamLocation
pop af
ret
; 12cdf
Function12cdf: ; 12cdf
ld a, $1
ld [$d10c], a
ld hl, NumItems
jp ReceiveItem
; 12cea
Function12cea: ; 12cea (4:6cea)
ld a, $1
ld [$d10c], a
ld hl, NumItems ; $d892 (aliases: TMsHMsEnd)
jp TossItem
Function12cf5: ; 12cf5
call Function1d4f
call YesNoBox
jp Function1c07
; 12cfe
Function12cfe: ; 12cfe (4:6cfe)
ld de, DefaultFlypoint ; $d002
callba Function11e75
ld hl, PlayerName ; $d47d
ld de, $d023
ld bc, $a
call CopyBytes
ld hl, PlayerID ; $d47b
ld bc, $2
call CopyBytes
ld a, [CurPartySpecies] ; $d108
ld [de], a
inc de
ld a, [CurItem] ; $d106
ld [de], a
ld a, [CurPartyMon] ; $d109
ld hl, $a600
ld bc, $2f
call AddNTimes
ld d, h
ld e, l
ld hl, DefaultFlypoint ; $d002
ld bc, $2f
ld a, $0
call GetSRAMBank
call CopyBytes
call CloseSRAM
ret
Function12d45: ; 12d45
ld a, [InLinkBattle]
cp $1
jr z, .asm_12d6d
cp $2
jr z, .asm_12d6d
ld hl, MenuDataHeader_0x12dc9
call LoadMenuDataHeader
call Function1d81
call Function1c07
jp c, .asm_12dc6
ld a, [$cfa9]
cp $1
jr z, .asm_12d6d
cp $2
jr z, .asm_12d76
jp .asm_12dc6
.asm_12d6d
callba Functionb9229
ld a, $0
ret
.asm_12d76
ld hl, UnknownText_0x12df1
call Function12cf5
jr c, .asm_12d9a
ld a, [CurPartyMon]
ld b, a
callba Function4456e
jr c, .asm_12d92
ld hl, UnknownText_0x12dfb
call Function1d67
jr .asm_12dc6
.asm_12d92
ld hl, UnknownText_0x12df6
call Function1d67
jr .asm_12dc6
.asm_12d9a
ld hl, UnknownText_0x12de2
call Function12cf5
jr c, .asm_12dc6
call GetPartyItemLocation
ld a, [hl]
ld [CurItem], a
call Function12cdf
jr nc, .asm_12dbe
call GetPartyItemLocation
ld [hl], $0
call GetCurNick
ld hl, UnknownText_0x12de7
call Function1d67
jr .asm_12dc6
.asm_12dbe
ld hl, UnknownText_0x12dec
call Function1d67
jr .asm_12dc6
.asm_12dc6
ld a, $3
ret
; 12dc9
MenuDataHeader_0x12dc9: ; 0x12dc9
db $40 ; flags
db 10, 12 ; start coords
db 17, 19 ; end coords
dw MenuData2_0x12dd1
db 1 ; default option
; 0x12dd1
MenuData2_0x12dd1: ; 0x12dd1
db $80 ; flags
db 3 ; items
db "READ@"
db "TAKE@"
db "QUIT@"
; 0x12de2
UnknownText_0x12de2: ; 0x12de2
text_jump UnknownText_0x1c1c22
db "@"
; 0x12de7
UnknownText_0x12de7: ; 0x12de7
text_jump UnknownText_0x1c1c47
db "@"
; 0x12dec
UnknownText_0x12dec: ; 0x12dec
text_jump UnknownText_0x1c1c62
db "@"
; 0x12df1
UnknownText_0x12df1: ; 0x12df1
text_jump UnknownText_0x1c1c86
db "@"
; 0x12df6
UnknownText_0x12df6: ; 0x12df6
text_jump UnknownText_0x1c1ca9
db "@"
; 0x12dfb
UnknownText_0x12dfb: ; 0x12dfb
text_jump UnknownText_0x1c1cc4
db "@"
; 0x12e00
OpenPartyStats: ; 12e00
call Function1d6e
call ClearSprites
; PartyMon
xor a
ld [MonType], a
call LowVolume
predef StatsScreenInit
call MaxVolume
call Function1d7d
ld a, 0
ret
; 12e1b
Function12e1b: ; 12e1b
callba Functionc785
ld a, [$d0ec]
cp $1
jr nz, .asm_12e2d
ld b, $4
ld a, $2
ret
.asm_12e2d
ld a, $3
ret
; 12e30
Function12e30: ; 12e30
callba Functionca3b
ld a, [$d0ec]
cp $2
jr z, .asm_12e4c
cp $0
jr z, .asm_12e4f
callba Function1060b5
ld b, $4
ld a, $2
ret
.asm_12e4c
ld a, $3
ret
.asm_12e4f
ld a, $0
ret
.asm_12e52
ld a, $1
ret
; 12e55
Function12e55: ; 12e55
callba Functionc8ac
ld a, [$d0ec]
cp $1
jr nz, .asm_12e67
ld b, $4
ld a, $2
ret
.asm_12e67
ld a, $3
ret
; 12e6a
Function12e6a: ; 12e6a
callba Functioncce5
ld a, [$d0ec]
cp $1
jr nz, .asm_12e7c
ld b, $4
ld a, $2
ret
.asm_12e7c
ld a, $3
ret
; 12e7f
Function12e7f: ; 12e7f
callba Functioncd9d
ld a, [$d0ec]
cp $1
jr nz, .asm_12e91
ld b, $4
ld a, $2
ret
.asm_12e91
ld a, $3
ret
; 12e94
Function12e94: ; 12e94
callba Functioncade
ld a, [$d0ec]
cp $1
jr nz, .asm_12ea6
ld b, $4
ld a, $2
ret
.asm_12ea6
ld a, $3
ret
; 12ea9
Function12ea9: ; 12ea9
callba Functioncc61
ld a, [$d0ec]
and a
jr z, .asm_12eba
ld b, $4
ld a, $2
ret
.asm_12eba
ld a, $3
ret
; 12ebd
Function12ebd: ; 12ebd
callba Functionc909
ld a, [$d0ec]
and a
jr z, .asm_12ece
ld b, $4
ld a, $2
ret
.asm_12ece
ld a, $3
ret
; 12ed1
Function12ed1: ; 12ed1
callba Functioncb9c
ld a, [$d0ec]
cp $1
jr nz, .asm_12ee3
ld b, $4
ld a, $2
ret
.asm_12ee3
ld a, $3
ret
; 12ee6
Function12ee6: ; 12ee6
call Function12f05
jr nc, .asm_12ef3
callba Functionf3df
jr .asm_12ef9
.asm_12ef3
ld hl, UnknownText_0x12f00
call PrintText
.asm_12ef9
xor a
ld [PartyMenuActionText], a
ld a, $3
ret
; 12f00
UnknownText_0x12f00: ; 0x12f00
; Not enough HP!
text_jump UnknownText_0x1c1ce3
db "@"
; 0x12f05
Function12f05: ; 12f05
ld a, $24
call GetPartyParamLocation
ld a, [hli]
ld [hProduct], a
ld a, [hl]
ld [hMultiplicand], a
ld a, $5
ld [hMultiplier], a
ld b, $2
call Divide
ld a, $23
call GetPartyParamLocation
ld a, [$ffb6]
sub [hl]
dec hl
ld a, [$ffb5]
sbc [hl]
ret
; 12f26
Function12f26: ; 12f26
callba Functionce7d
ld a, [$d0ec]
cp $1
jr nz, .asm_12f38
ld b, $4
ld a, $2
ret
.asm_12f38
ld a, $3
ret
; 12f3b
Function12f3b: ; 12f3b
callba Functionceeb
ld a, [$d0ec]
cp $1
jr nz, .asm_12f4d
ld b, $4
ld a, $2
ret
.asm_12f4d
ld a, $3
ret
; 12f50
Function12f50: ; 12f50
callba Function506bc
ld b, $4
ld a, $2
ret
; 12f5b
Function12f5b: ; 12f5b
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
call Functione58
call Function12f73
pop bc
ld a, b
ld [Options], a
push af
call WhiteBGMap
pop af
ret
; 12f73
Function12f73: ; 12f73
call Function13172
ld de, Unknown_12fb2
call Function1bb1
call Function131ef
ld hl, $cfa5
set 6, [hl]
jr Function12f93
Function12f86: ; 12f86
call Function1bd3
bit 1, a
jp nz, Function12f9f
bit 0, a
jp nz, Function12f9c
Function12f93: ; 12f93
call Function13235
call Function13256
jp Function12f86
; 12f9c
Function12f9c: ; 12f9c
and a
jr Function12fa0
Function12f9f: ; 12f9f
scf
Function12fa0: ; 12fa0
push af
xor a
ld [$d0e3], a
ld hl, $cfa5
res 6, [hl]
call ClearSprites
call ClearTileMap
pop af
ret
; 12fb2
Unknown_12fb2: ; 12fb2
db $03, $01, $03, $01, $40, $00, $20, $c3
; 12fba
Function12fba: ; 12fba
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_12fd2
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
call Function12fd5
pop af
ld [Options], a
call WhiteBGMap
.asm_12fd2
ld a, $0
ret
; 12fd5
Function12fd5: ; 12fd5
ld a, [CurPartyMon]
inc a
ld [$d0d8], a
call Function13172
call Function132d3
ld de, Unknown_13163
call Function1bb1
.asm_12fe8
call Function131ef
ld hl, $cfa5
set 6, [hl]
jr .asm_13009
.asm_12ff2
call Function1bd3
bit 1, a
jp nz, .asm_13038
bit 0, a
jp nz, .asm_130c6
bit 4, a
jp nz, .asm_1305b
bit 5, a
jp nz, .asm_13075
.asm_13009
call Function13235
ld a, [$d0e3]
and a
jr nz, .asm_13018
call Function13256
jp .asm_12ff2
.asm_13018
ld a, $7f
hlcoord 1, 11
ld bc, $0005
call ByteFill
hlcoord 1, 12
ld bc, $0512
call ClearBox
hlcoord 1, 12
ld de, $716b
call PlaceString
jp .asm_12ff2
.asm_13038: ; 13038
call PlayClickSFX
call WaitSFX
ld a, [$d0e3]
and a
jp z, Function13154
ld a, [$d0e3]
ld [$cfa9], a
xor a
ld [$d0e3], a
hlcoord 1, 2
ld bc, $0812
call ClearBox
jp .asm_12fe8
; 1305b
.asm_1305b: ; 1305b
ld a, [$d0e3]
and a
jp nz, .asm_12ff2
ld a, [CurPartyMon]
ld b, a
push bc
call .asm_1308f
pop bc
ld a, [CurPartyMon]
cp b
jp z, .asm_12ff2
jp Function12fd5
.asm_13075: ; 13075
ld a, [$d0e3]
and a
jp nz, .asm_12ff2
ld a, [CurPartyMon]
ld b, a
push bc
call .asm_130a7
pop bc
ld a, [CurPartyMon]
cp b
jp z, .asm_12ff2
jp Function12fd5
.asm_1308f
ld a, [CurPartyMon]
inc a
ld [CurPartyMon], a
ld c, a
ld b, 0
ld hl, PartySpecies
add hl, bc
ld a, [hl]
cp $ff
jr z, .asm_130a7
cp EGG
ret nz
jr .asm_1308f
.asm_130a7
ld a, [CurPartyMon]
and a
ret z
.asm_130ac
ld a, [CurPartyMon]
dec a
ld [CurPartyMon], a
ld c, a
ld b, 0
ld hl, PartySpecies
add hl, bc
ld a, [hl]
cp EGG
ret nz
ld a, [CurPartyMon]
and a
jr z, .asm_1308f
jr .asm_130ac
; 130c6
.asm_130c6: ; 130c6
call PlayClickSFX
call WaitSFX
ld a, [$d0e3]
and a
jr nz, .asm_130de
ld a, [$cfa9]
ld [$d0e3], a
call Function1bee
jp .asm_13018
.asm_130de
ld hl, PartyMon1Moves
ld bc, PartyMon2 - PartyMon1
ld a, [CurPartyMon]
call AddNTimes
push hl
call Function1313a
pop hl
ld bc, $0015
add hl, bc
call Function1313a
ld a, [IsInBattle]
jr z, .asm_13113
ld hl, BattleMonMoves
ld bc, $0020
ld a, [CurPartyMon]
call AddNTimes
push hl
call Function1313a
pop hl
ld bc, $0006
add hl, bc
call Function1313a
.asm_13113
ld de, SFX_SWITCH_POKEMON
call PlaySFX
call WaitSFX
ld de, SFX_SWITCH_POKEMON
call PlaySFX
call WaitSFX
hlcoord 1, 2
ld bc, $0812
call ClearBox
hlcoord 10, 10
ld bc, $0109
call ClearBox
jp .asm_12fe8
; 1313a
Function1313a: ; 1313a
push hl
ld a, [$cfa9]
dec a
ld c, a
ld b, $0
add hl, bc
ld d, h
ld e, l
pop hl
ld a, [$d0e3]
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
; 13154
Function13154: ; 13154
xor a
ld [$d0e3], a
ld hl, $cfa5
res 6, [hl]
call ClearSprites
jp ClearTileMap
; 13163
Unknown_13163: ; 13163
db $03, $01, $03, $01, $40, $00, $20, $f3
; 1316b
String_1316b: ; 1316b
db "Where?@"
; 13172
Function13172: ; 13172
call WhiteBGMap
call ClearTileMap
call ClearSprites
xor a
ld [hBGMapMode], a
callba Functionfb571
callba Function8e814
ld a, [CurPartyMon]
ld e, a
ld d, $0
ld hl, PartySpecies
add hl, de
ld a, [hl]
ld [$d265], a
ld e, $2
callba Function8e83f
hlcoord 0, 1
ld b, $9
ld c, $12
call TextBox
hlcoord 0, 11
ld b, $5
ld c, $12
call TextBox
hlcoord 2, 0
ld bc, $0203
call ClearBox
xor a
ld [MonType], a
ld hl, PartyMonNicknames
ld a, [CurPartyMon]
call GetNick
hlcoord 5, 1
call PlaceString
push bc
callba Function5084a
pop hl
call PrintLevel
ld hl, PlayerHPPal
call SetHPPal
ld b, $e
call GetSGBLayout
hlcoord 16, 0
ld bc, $0103
jp ClearBox
; 131ef
Function131ef: ; 131ef
xor a
ld [hBGMapMode], a
ld [$d0e3], a
ld [MonType], a
predef Function5084a
ld hl, TempMonMoves
ld de, $d25e
ld bc, NUM_MOVES
call CopyBytes
ld a, SCREEN_WIDTH * 2
ld [Buffer1], a
hlcoord 2, 3
predef ListMoves
hlcoord 10, 4
predef Function50c50
call WaitBGMap
call Function32f9
ld a, [$d0eb]
inc a
ld [$cfa3], a
hlcoord 0, 11
ld b, 5
ld c, 18
jp TextBox
; 13235
Function13235: ; 13235
ld hl, PartyMon1Moves
ld bc, PartyMon2 - PartyMon1
ld a, [CurPartyMon]
call AddNTimes
ld a, [$cfa9]
dec a
ld c, a
ld b, $0
add hl, bc
ld a, [hl]
ld [CurSpecies], a
hlcoord 1, 12
lb bc, 5, 18
jp ClearBox
; 13256
Function13256: ; 13256
xor a
ld [hBGMapMode], a
hlcoord 0, 10
ld de, String_132ba
call PlaceString
hlcoord 0, 11
ld de, String_132c2
call PlaceString
hlcoord 12, 12
ld de, String_132ca
call PlaceString
ld a, [CurSpecies]
ld b, a
hlcoord 2, 12
predef PrintMoveType
ld a, [CurSpecies]
dec a
ld hl, Moves + MOVE_POWER
ld bc, MOVE_LENGTH
call AddNTimes
ld a, BANK(Moves)
call GetFarByte
hlcoord 16, 12
cp $2
jr c, .asm_132a7
ld [$d265], a
ld de, $d265
ld bc, $0103
call PrintNum
jr .asm_132ad
.asm_132a7
ld de, String_132cf
call PlaceString
.asm_132ad
hlcoord 1, 14
predef PrintMoveDesc
ld a, $1
ld [hBGMapMode], a
ret
; 132ba
String_132ba: ; 132ba
db "┌─────┐@"
; 132c2
String_132c2: ; 132c2
db "│TYPE/└@"
; 132ca
String_132ca: ; 132ca
db "ATK/@"
; 132cf
String_132cf: ; 132cf
db "---@"
; 132d3
Function132d3: ; 132d3
call Function132da
call Function132fe
ret
; 132da
Function132da: ; 132da
ld a, [CurPartyMon]
and a
ret z
ld c, a
ld e, a
ld d, 0
ld hl, PartyCount
add hl, de
.asm_132e7
ld a, [hl]
and a
jr z, .asm_132f3
cp EGG
jr z, .asm_132f3
cp NUM_POKEMON + 1
jr c, .asm_132f8
.asm_132f3
dec hl
dec c
jr nz, .asm_132e7
ret
.asm_132f8
hlcoord 16, 0
ld [hl], $71
ret
; 132fe
Function132fe: ; 132fe
ld a, [CurPartyMon]
inc a
ld c, a
ld a, [PartyCount]
cp c
ret z
ld e, c
ld d, 0
ld hl, PartySpecies
add hl, de
.asm_1330f
ld a, [hl]
cp $ff
ret z
and a
jr z, .asm_1331e
cp EGG
jr z, .asm_1331e
cp NUM_POKEMON + 1
jr c, .asm_13321
.asm_1331e
inc hl
jr .asm_1330f
.asm_13321
hlcoord 18, 0
ld [hl], "▶"
ret
; 13327
SelectMenu:: ; 13327
call CheckRegisteredItem
jr c, .NotRegistered
jp UseRegisteredItem
.NotRegistered
call Function2e08
ld b, BANK(ItemMayBeRegisteredText)
ld hl, ItemMayBeRegisteredText
call Function269a
call Functiona46
jp Function2dcf
; 13340
ItemMayBeRegisteredText: ; 13340
text_jump UnknownText_0x1c1cf3
db "@"
; 13345
CheckRegisteredItem: ; 13345
ld a, [WhichRegisteredItem]
and a
jr z, .NoRegisteredItem
and REGISTERED_POCKET
rlca
rlca
ld hl, .Pockets
rst JumpTable
ret
.Pockets
dw .CheckItem
dw .CheckBall
dw .CheckKeyItem
dw .CheckTMHM
.CheckItem
ld hl, NumItems
call .CheckRegisteredNo
jr c, .NoRegisteredItem
inc hl
ld e, a
ld d, 0
add hl, de
add hl, de
call .IsSameItem
jr c, .NoRegisteredItem
and a
ret
.CheckKeyItem
ld a, [RegisteredItem]
ld hl, KeyItems
ld de, 1
call IsInArray
jr nc, .NoRegisteredItem
ld a, [RegisteredItem]
ld [CurItem], a
and a
ret
.CheckBall
ld hl, NumBalls
call .CheckRegisteredNo
jr nc, .NoRegisteredItem
inc hl
ld e, a
ld d, 0
add hl, de
add hl, de
call .IsSameItem
jr c, .NoRegisteredItem
ret
.CheckTMHM
jr .NoRegisteredItem
.NoRegisteredItem
xor a
ld [WhichRegisteredItem], a
ld [RegisteredItem], a
scf
ret
; 133a6
.CheckRegisteredNo ; 133a6
ld a, [WhichRegisteredItem]
and REGISTERED_NUMBER
dec a
cp [hl]
jr nc, .NotEnoughItems
ld [$d107], a
and a
ret
.NotEnoughItems
scf
ret
; 133b6
.IsSameItem ; 133b6
ld a, [RegisteredItem]
cp [hl]
jr nz, .NotSameItem
ld [CurItem], a
and a
ret
.NotSameItem
scf
ret
; 133c3
UseRegisteredItem: ; 133c3
callba CheckItemMenu
ld a, [$d142]
ld hl, .SwitchTo
rst JumpTable
ret
.SwitchTo
dw .CantUse
dw .NoFunction
dw .NoFunction
dw .NoFunction
dw .Current
dw .Party
dw .Overworld
; 133df
.NoFunction ; 133df
call Function2e08
call CantUseItem
call Function2dcf
and a
ret
; 133ea
.Current ; 133ea
call Function2e08
call DoItemEffect
call Function2dcf
and a
ret
; 133f5
.Party ; 133f5
call ResetWindow
call FadeToMenu
call DoItemEffect
call Function2b3c
call Function2dcf
and a
ret
; 13406
.Overworld ; 13406
call ResetWindow
ld a, 1
ld [$d0ef], a
call DoItemEffect
xor a
ld [$d0ef], a
ld a, [$d0ec]
cp 1
jr nz, .asm_13425
scf
ld a, $80
ld [$ffa0], a
ret
; 13422
.CantUse ; 13422
call ResetWindow
.asm_13425
call CantUseItem
call Function2dcf
and a
ret
; 1342d
Function1342d:: ; 1342d
call Function1344a
call Function1347d
jr c, .asm_13448
ld [$d041], a
call Function134dd
jr c, .asm_13448
ld hl, $d041
cp [hl]
jr z, .asm_13448
call Function134c0
and a
ret
.asm_13448
scf
ret
; 1344a
Function1344a: ; 1344a
ld a, b
ld [EngineBuffer1], a
ld a, e
ld [$d03f], a
ld a, d
ld [$d040], a
call Function1345a
ret
; 1345a
Function1345a: ; 1345a
ld de, $d0f0
ld bc, $0004
ld hl, $d03f
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [EngineBuffer1]
call GetFarByte
inc hl
ld [de], a
inc de
.asm_1346f
ld a, [EngineBuffer1]
call GetFarByte
ld [de], a
inc de
add hl, bc
cp $ff
jr nz, .asm_1346f
ret
; 1347d
Function1347d: ; 1347d
ld hl, $d03f
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [EngineBuffer1]
call GetFarByte
ld c, a
inc hl
ld a, [BackupMapGroup]
ld d, a
ld a, [BackupMapNumber]
ld e, a
ld b, $0
.asm_13495
ld a, [EngineBuffer1]
call GetFarByte
cp $ff
jr z, .asm_134be
inc hl
inc hl
ld a, [EngineBuffer1]
call GetFarByte
inc hl
cp d
jr nz, .asm_134b7
ld a, [EngineBuffer1]
call GetFarByte
inc hl
cp e
jr nz, .asm_134b8
jr .asm_134bb
.asm_134b7
inc hl
.asm_134b8
inc b
jr .asm_13495
.asm_134bb
xor a
ld a, b
ret
.asm_134be
scf
ret
; 134c0
Function134c0: ; 134c0
push af
ld hl, $d03f
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
pop af
ld bc, $0004
call AddNTimes
inc hl
ld de, $dcac
ld a, [EngineBuffer1]
ld bc, $0003
call FarCopyBytes
ret
; 134dd
Function134dd: ; 134dd
call Function1d6e
ld hl, UnknownText_0x1350d
call PrintText
call Function13512
ld hl, MenuDataHeader_0x13550
call Function1d3c
call Function352f
call Function1ad2
xor a
ld [$d0e4], a
call Function350c
call Function1c17
ld a, [$cf73]
cp $2
jr z, .asm_1350b
xor a
ld a, [$cf77]
ret
.asm_1350b
scf
ret
; 1350d
UnknownText_0x1350d: ; 0x1350d
; Which floor?
text_jump UnknownText_0x1bd2bc
db "@"
; 0x13512
Function13512: ; 13512
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
ld hl, TileMap
ld b, $4
ld c, $8
call TextBox
hlcoord 1, 2
ld de, String_13537
call PlaceString
hlcoord 4, 4
call Function1353f
pop af
ld [Options], a
ret
; 13537
String_13537: ; 13537
db "Now on:@"
; 1353f
Function1353f: ; 1353f
push hl
ld a, [$d041]
ld e, a
ld d, 0
ld hl, $d0f1
add hl, de
ld a, [hl]
pop de
call Function1356b
ret
; 13550
MenuDataHeader_0x13550: ; 0x13550
db $40 ; flags
db 01, 12 ; start coords
db 09, 18 ; end coords
dw MenuData2_0x13558
db 1 ; default option
; 0x13558
MenuData2_0x13558: ; 0x13558
db $10 ; flags
db 4, 0 ; rows, columns
db 1 ; horizontal spacing
dbw 0, $d0f0
dbw BANK(Function13568), Function13568
dbw BANK(NULL), NULL
dbw BANK(NULL), NULL
; 13568
Function13568: ; 13568
ld a, [MenuSelection] ; $cf74
Function1356b: ; 1356b
push de
call Function13575
ld d, h
ld e, l
pop hl
jp PlaceString
; 13575
Function13575: ; 13575
push de
ld e, a
ld d, 0
ld hl, .floors
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
pop de
ret
; 13583
.floors
dw .b4f
dw .b3f
dw .b2f
dw .b1f
dw ._1f
dw ._2f
dw ._3f
dw ._4f
dw ._5f
dw ._6f
dw ._7f
dw ._8f
dw ._9f
dw ._10f
dw ._11f
dw .roof
.b4f
db "B4F@"
.b3f
db "B3F@"
.b2f
db "B2F@"
.b1f
db "B1F@"
._1f
db "1F@"
._2f
db "2F@"
._3f
db "3F@"
._4f
db "4F@"
._5f
db "5F@"
._6f
db "6F@"
._7f
db "7F@"
._8f
db "8F@"
._9f
db "9F@"
._10f
db "10F@"
._11f
db "11F@"
.roof
db "ROOF@"
; 135db
Function135db: ; 135db
xor a
ld [$df9c], a
ld a, $14
ld [$dc79], a
callba Function11490
ret
; 135eb
UnknownScript_0x135eb:: ; 0x135eb
writecode $3, BATTLETYPE_CONTEST
battlecheck
startbattle
returnafterbattle
copybytetovar $dc79
iffalse UnknownScript_0x13603
end
; 0x135f8
UnknownScript_0x135f8:: ; 0x135f8
playsound SFX_ELEVATOR_END
loadfont
2writetext UnknownText_0x1360f
closetext
2jump UnknownScript_0x1360b
; 0x13603
UnknownScript_0x13603: ; 0x13603
playsound SFX_ELEVATOR_END
loadfont
2writetext UnknownText_0x13614
closetext
UnknownScript_0x1360b: ; 0x1360b
loadmovesprites
jumpstd $0016
; 0x1360f
UnknownText_0x1360f: ; 0x1360f
; ANNOUNCER: BEEEP! Time's up!
text_jump UnknownText_0x1bd2ca
db "@"
; 0x13614
UnknownText_0x13614: ; 0x13614
; ANNOUNCER: The Contest is over!
text_jump UnknownText_0x1bd2e7
db "@"
; 0x13619
UnknownScript_0x13619:: ; 0x13619
loadfont
2writetext UnknownText_0x13620
closetext
loadmovesprites
end
; 0x13620
UnknownText_0x13620: ; 0x13620
; REPEL's effect wore off.
text_jump UnknownText_0x1bd308
db "@"
; 0x13625
UnknownScript_0x13625:: ; 0x13625
loadfont
copybytetovar Unkn2Pals
itemtotext $0, $0
2writetext UnknownText_0x13645
giveitem $ff, $1
iffalse UnknownScript_0x1363e
3callasm Function1364f
specialsound
itemnotify
2jump UnknownScript_0x13643
; 0x1363e
UnknownScript_0x1363e: ; 0x1363e
keeptextopen
2writetext UnknownText_0x1364a
closetext
UnknownScript_0x13643: ; 13643
loadmovesprites
end
; 0x13645
UnknownText_0x13645: ; 0x13645
; found @ !
text_jump UnknownText_0x1bd321
db "@"
; 0x1364a
UnknownText_0x1364a: ; 0x1364a
; But has no space left…
text_jump UnknownText_0x1bd331
db "@"
; 0x1364f
Function1364f: ; 1364f
ld hl, EngineBuffer1 ; $d03e (aliases: MenuItemsList, CurFruitTree, CurInput)
ld a, [hli]
ld d, [hl]
ld e, a
ld b, $1
call EventFlagAction
ret
Function1365b:: ; 1365b
ld a, c
ld de, .table2 - .table1
ld hl, .table1
call IsInArray
jr nc, .asm_1367f
ld a, $c ; jumpstd
ld [$d03f], a
inc hl
ld a, [hli]
ld [$d03f + 1], a
ld a, [hli]
ld [$d03f + 2], a
ld a, BANK(UnknownScript_0x1369a)
ld hl, UnknownScript_0x1369a
call CallScript
scf
ret
.asm_1367f
xor a
ret
; 13681
.table1
dbw $91, $0003 ; bookshelf
.table2
dbw $93, $0031 ; pc
dbw $94, $000b ; radio
dbw $95, $0007 ; map
dbw $96, $0006 ; merchandise
dbw $97, $0009 ; tv
dbw $9d, $0008 ; window
dbw $9f, $0005 ; incense burner
dbw $ff ; end
; 1369a
UnknownScript_0x1369a: ; 0x1369a
2jump $d03f
; 0x1369d
Function1369d: ; 1369d
call ContestScore
callba Function105f79
call Function13819
ld a, [$d00a]
call Function13730
ld a, [$d00b]
ld [$d265], a
call GetPokemonName
ld hl, UnknownText_0x13719
call PrintText
ld a, [EndFlypoint]
call Function13730
ld a, [MovementBuffer]
ld [$d265], a
call GetPokemonName
ld hl, UnknownText_0x13702
call PrintText
ld a, [DefaultFlypoint]
call Function13730
ld a, [$d003]
ld [$d265], a
call GetPokemonName
ld hl, UnknownText_0x136eb
call PrintText
jp Function13807
; 136eb
UnknownText_0x136eb: ; 0x136eb
text_jump UnknownText_0x1c10fa
start_asm
; 0x136f0
Function136f0: ; 136f0
ld de, SFX_1ST_PLACE
call PlaySFX
call WaitSFX
ld hl, UnknownText_0x136fd
ret
; 136fd
UnknownText_0x136fd: ; 0x136fd
; The winning score was @ points!
text_jump UnknownText_0x1c113f
db "@"
; 0x13702
UnknownText_0x13702: ; 0x13702
; Placing second was @ , who caught a @ !@ @
text_jump UnknownText_0x1c1166
start_asm
; 0x13707
Function13707: ; 13707
ld de, SFX_2ND_PLACE
call PlaySFX
call WaitSFX
ld hl, UnknownText_0x13714
ret
; 13714
UnknownText_0x13714: ; 0x13714
; The score was @ points!
text_jump UnknownText_0x1c1196
db "@"
; 0x13719
UnknownText_0x13719: ; 0x13719
; Placing third was @ , who caught a @ !@ @
text_jump UnknownText_0x1c11b5
start_asm
; 0x1371e
Function1371e: ; 1371e
ld de, SFX_3RD_PLACE
call PlaySFX
call WaitSFX
ld hl, UnknownText_0x1372b
ret
; 1372b
UnknownText_0x1372b: ; 0x1372b
; The score was @ points!
text_jump UnknownText_0x1c11e4
db "@"
; 0x13730
Function13730: ; 13730
dec a
jr z, .asm_13777
ld c, a
ld b, 0
ld hl, Unknown_13783
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hli]
ld c, a
push hl
push bc
callab Function3952d
ld hl, StringBuffer1
ld de, $d016
ld bc, $000d
call CopyBytes
ld hl, $d016
.asm_13757
ld a, [hli]
cp $50
jr nz, .asm_13757
dec hl
ld [hl], $7f
inc hl
ld d, h
ld e, l
pop bc
pop hl
push de
ld a, [hl]
ld b, a
callab Function3994c
ld hl, StringBuffer1
pop de
ld bc, $000a
jp CopyBytes
.asm_13777
ld hl, PlayerName
ld de, $d016
ld bc, $000b
jp CopyBytes
; 13783
Unknown_13783: ; 13783
dw Unknown_13799
dw Unknown_13799
dw Unknown_137a4
dw Unknown_137af
dw Unknown_137ba
dw Unknown_137c5
dw Unknown_137d0
dw Unknown_137db
dw Unknown_137e6
dw Unknown_137f1
dw Unknown_137fc
; 13799
Unknown_13799:
db BUG_CATCHER, DON
dbw KAKUNA, 300
dbw METAPOD, 285
dbw CATERPIE, 226
Unknown_137a4:
db BUG_CATCHER, ED
dbw BUTTERFREE, 286
dbw BUTTERFREE, 251
dbw CATERPIE, 237
Unknown_137af:
db COOLTRAINERM, NICK
dbw SCYTHER, 357
dbw BUTTERFREE, 349
dbw PINSIR, 368
Unknown_137ba:
db POKEFANM, WILLIAM
dbw PINSIR, 332
dbw BUTTERFREE, 324
dbw VENONAT, 321
Unknown_137c5:
db BUG_CATCHER, BUG_CATCHER_BENNY
dbw BUTTERFREE, 318
dbw WEEDLE, 295
dbw CATERPIE, 285
Unknown_137d0:
db CAMPER, BARRY
dbw PINSIR, 366
dbw VENONAT, 329
dbw KAKUNA, 314
Unknown_137db:
db PICNICKER, CINDY
dbw BUTTERFREE, 341
dbw METAPOD, 301
dbw CATERPIE, 264
Unknown_137e6:
db BUG_CATCHER, JOSH
dbw SCYTHER, 326
dbw BUTTERFREE, 292
dbw METAPOD, 282
Unknown_137f1:
db YOUNGSTER, SAMUEL
dbw WEEDLE, 270
dbw PINSIR, 282
dbw CATERPIE, 251
Unknown_137fc:
db SCHOOLBOY, KIPP
dbw VENONAT, 267
dbw PARAS, 254
dbw KAKUNA, 259
; 13807
Function13807: ; 13807
ld hl, $d00a
ld de, $fffc
ld b, $3
.asm_1380f
ld a, [hl]
cp $1
jr z, .asm_13818
add hl, de
dec b
jr nz, .asm_1380f
.asm_13818
ret
; 13819
Function13819: ; 13819
call Function13833
call Function138b0
ld hl, $d00e
ld a, $1
ld [hli], a
ld a, [$df9c]
ld [hli], a
ld a, [hProduct]
ld [hli], a
ld a, [hMultiplicand]
ld [hl], a
call Function1383e
ret
; 13833
Function13833: ; 13833
ld hl, DefaultFlypoint
ld b, $c
xor a
.asm_13839
ld [hli], a
dec b
jr nz, .asm_13839
ret
; 1383e
Function1383e: ; 1383e
ld de, $d010
ld hl, $d004
ld c, $2
call StringCmp
jr c, .asm_1386b
ld hl, EndFlypoint
ld de, $d00a
ld bc, $0004
call CopyBytes
ld hl, DefaultFlypoint
ld de, EndFlypoint
ld bc, $0004
call CopyBytes
ld hl, DefaultFlypoint
call Function138a0
jr .asm_1389f
.asm_1386b
ld de, $d010
ld hl, $d008
ld c, $2
call StringCmp
jr c, .asm_1388c
ld hl, EndFlypoint
ld de, $d00a
ld bc, $0004
call CopyBytes
ld hl, EndFlypoint
call Function138a0
jr .asm_1389f
.asm_1388c
ld de, $d010
ld hl, $d00c
ld c, $2
call StringCmp
jr c, .asm_1389f
ld hl, $d00a
call Function138a0
.asm_1389f
ret
; 138a0
Function138a0: ; 138a0
ld de, $d00e
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 [hl], a
ret
; 138b0
Function138b0: ; 138b0
ld e, $0
.asm_138b2
push de
call Function139ed
pop de
jr nz, .asm_138f9
ld a, e
inc a
inc a
ld [$d00e], a
dec a
ld c, a
ld b, 0
ld hl, Unknown_13783
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
inc hl
.asm_138cd
call Random
and $3
cp $3
jr z, .asm_138cd
ld c, a
ld b, $0
add hl, bc
add hl, bc
add hl, bc
ld a, [hli]
ld [$d00f], a
ld a, [hli]
ld h, [hl]
ld l, a
call Random
and $7
ld c, a
ld b, $0
add hl, bc
ld a, h
ld [$d010], a
ld a, l
ld [$d011], a
push de
call Function1383e
pop de
.asm_138f9
inc e
ld a, e
cp $a
jr nz, .asm_138b2
ret
; 13900
ContestScore: ; 13900
; Determine the player's score in the Bug Catching Contest.
xor a
ld [hProduct], a
ld [hMultiplicand], a
ld a, [wContestMonSpecies] ; Species
and a
jr z, .done
; Tally the following:
; Max HP * 4
ld a, [wContestMonMaxHP + 1]
call .AddContestStat
ld a, [wContestMonMaxHP + 1]
call .AddContestStat
ld a, [wContestMonMaxHP + 1]
call .AddContestStat
ld a, [wContestMonMaxHP + 1]
call .AddContestStat
; Stats
ld a, [wContestMonAttack + 1]
call .AddContestStat
ld a, [wContestMonDefense + 1]
call .AddContestStat
ld a, [wContestMonSpeed + 1]
call .AddContestStat
ld a, [wContestMonSpclAtk + 1]
call .AddContestStat
ld a, [wContestMonSpclDef + 1]
call .AddContestStat
; DVs
ld a, [wContestMonDVs + 0]
ld b, a
and 2
add a
add a
ld c, a
swap b
ld a, b
and 2
add a
add c
ld d, a
ld a, [wContestMonDVs + 1]
ld b, a
and 2
ld c, a
swap b
ld a, b
and 2
srl a
add c
add c
add d
add d
call .AddContestStat
; Remaining HP / 8
ld a, [wContestMonHP + 1]
srl a
srl a
srl a
call .AddContestStat
; Whether it's holding an item
ld a, [wContestMonItem]
and a
jr z, .done
ld a, 1
call .AddContestStat
.done
ret
; 1397f
.AddContestStat: ; 1397f
ld hl, hMultiplicand
add [hl]
ld [hl], a
ret nc
dec hl
inc [hl]
ret
; 13988
; decreases all pokemon's pokerus counter by b. if the lower nybble reaches zero, the pokerus is cured.
ApplyPokerusTick: ; 13988
ld hl, PartyMon1PokerusStatus
ld a, [PartyCount]
and a
ret z
ld c, a
.asm_13991
ld a, [hl]
and $f
jr z, .asm_139a0
sub b
jr nc, .asm_1399a
xor a
.asm_1399a
ld d, a
ld a, [hl]
and $f0
add d
ld [hl], a
.asm_139a0
ld de, PartyMon2 - PartyMon1
add hl, de
dec c
jr nz, .asm_13991
ret
; 139a8
Function139a8: ; 139a8
ld c, $a
ld hl, Unknown_139fe
.asm_139ad
push bc
push hl
ld e, [hl]
inc hl
ld d, [hl]
ld b, $0
call EventFlagAction
pop hl
inc hl
inc hl
pop bc
dec c
jr nz, .asm_139ad
ld c, $5
.asm_139c0
push bc
.asm_139c1
call Random
cp $fa
jr nc, .asm_139c1
ld c, $19
call SimpleDivide
ld e, b
ld d, 0
ld hl, Unknown_139fe
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
push de
ld b, $2
call EventFlagAction
pop de
ld a, c
and a
jr nz, .asm_139c1
ld b, $1
call EventFlagAction
pop bc
dec c
jr nz, .asm_139c0
ret
; 139ed
Function139ed: ; 139ed
ld hl, Unknown_139fe
ld e, a
ld d, 0
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld b, $2
call EventFlagAction
ret
; 139fe
Unknown_139fe: ; 139fe
dw $0716
dw $0717
dw $0718
dw $0719
dw $071a
dw $071b
dw $071c
dw $071d
dw $071e
dw $071f
; 13a12
Function13a12: ; 13a12
ld hl, PartyMon1HP
ld a, [hli]
or [hl]
jr z, .asm_13a2b
ld hl, PartyCount
ld a, 1
ld [hli], a
inc hl
ld a, [hl]
ld [$df9b], a
ld [hl], $ff
xor a
ld [ScriptVar], a
ret
.asm_13a2b
ld a, $1
ld [ScriptVar], a
ret
; 13a31
Function13a31: ; 13a31
ld hl, PartySpecies + 1
ld a, [$df9b]
ld [hl], a
ld b, $1
.asm_13a3a
ld a, [hli]
cp $ff
jr z, .asm_13a42
inc b
jr .asm_13a3a
.asm_13a42
ld a, b
ld [PartyCount], a
ret
; 13a47
Function13a47: ; 13a47
ld hl, PartyCount
ld a, [hl]
and a
ret z
cp 6 + 1
jr c, .asm_13a54
ld a, 6
ld [hl], a
.asm_13a54
inc hl
ld b, a
ld c, 0
.asm_13a58
ld a, [hl]
and a
jr z, .asm_13a64
cp $fc
jr z, .asm_13a64
cp $fe
jr c, .asm_13a73
.asm_13a64
ld [hl], SMEARGLE
push hl
push bc
ld a, c
ld hl, PartyMon1Species
call GetPartyLocation
ld [hl], SMEARGLE
pop bc
pop hl
.asm_13a73
inc hl
inc c
dec b
jr nz, .asm_13a58
ld [hl], $ff
ld hl, PartyMon1
ld a, [PartyCount]
ld d, a
ld e, 0
.asm_13a83
push de
push hl
ld b, h
ld c, l
ld a, [hl]
and a
jr z, .asm_13a8f
cp $fc
jr c, .asm_13a9c
.asm_13a8f
ld [hl], SMEARGLE
push de
ld d, 0
ld hl, PartySpecies
add hl, de
pop de
ld a, SMEARGLE
ld [hl], a
.asm_13a9c
ld [CurSpecies], a
call GetBaseData
ld hl, PartyMon1Level - PartyMon1
add hl, bc
ld a, [hl]
cp 2
ld a, 2
jr c, .asm_13ab4
ld a, [hl]
cp MAX_LEVEL
jr c, .asm_13ab5
ld a, MAX_LEVEL
.asm_13ab4
ld [hl], a
.asm_13ab5
ld [CurPartyLevel], a
ld hl, PartyMon1MaxHP - PartyMon1
add hl, bc
ld d, h
ld e, l
ld hl, $000a
add hl, bc
ld b, $1
predef Functione167
pop hl
ld bc, PartyMon2 - PartyMon1
add hl, bc
pop de
inc e
dec d
jr nz, .asm_13a83
ld de, PartyMonNicknames
ld a, [PartyCount]
ld b, a
ld c, 0
.asm_13adc
push bc
call Function13b71
push de
callba Function17d073
pop hl
pop bc
jr nc, .asm_13b0e
push bc
push hl
ld hl, PartySpecies
push bc
ld b, 0
add hl, bc
pop bc
ld a, [hl]
cp EGG
ld hl, String_13b6b
jr z, .asm_13b06
ld [$d265], a
call GetPokemonName
ld hl, StringBuffer1
.asm_13b06
pop de
ld bc, $000b
call CopyBytes
pop bc
.asm_13b0e
inc c
dec b
jr nz, .asm_13adc
ld de, PartyMonOT
ld a, [PartyCount]
ld b, a
ld c, 0
.asm_13b1b
push bc
call Function13b71
push de
callba Function17d073
pop hl
jr nc, .asm_13b34
ld d, h
ld e, l
ld hl, PlayerName
ld bc, $000b
call CopyBytes
.asm_13b34
pop bc
inc c
dec b
jr nz, .asm_13b1b
ld hl, PartyMon1Moves
ld a, [PartyCount]
ld b, a
.asm_13b40
push hl
ld c, NUM_MOVES
ld a, [hl]
and a
jr z, .asm_13b4b
cp $fc
jr c, .asm_13b4d
.asm_13b4b
ld [hl], POUND
.asm_13b4d
ld a, [hl]
and a
jr z, .asm_13b55
cp NUM_ATTACKS + 1
jr c, .asm_13b5c
.asm_13b55
xor a
ld [hli], a
dec c
jr nz, .asm_13b55
jr .asm_13b60
.asm_13b5c
inc hl
dec c
jr nz, .asm_13b4d
.asm_13b60
pop hl
push bc
ld bc, PartyMon2 - PartyMon1
add hl, bc
pop bc
dec b
jr nz, .asm_13b40
ret
; 13b6b
String_13b6b: ; 13b6b
db "タマゴ@@@"
; 13b71
Function13b71: ; 13b71
push de
ld c, 1
ld b, 6
.asm_13b76
ld a, [de]
cp "@"
jr z, .asm_13b85
inc de
inc c
dec b
jr nz, .asm_13b76
dec c
dec de
ld a, "@"
ld [de], a
.asm_13b85
pop de
ret
; 13b87
GetSquareRoot: ; 13b87
; Return the square root of de in b.
; Rather than calculating the result, we take the index of the
; first value in a table of squares that isn't lower than de.
ld hl, Squares
ld b, 0
.loop
; Make sure we don't go past the end of the table.
inc b
ld a, b
cp $ff
ret z
; Iterate over the table until b**2 >= de.
ld a, [hli]
sub e
ld a, [hli]
sbc d
jr c, .loop
ret
Squares: ; 13b98
root set 1
rept $ff
dw root*root
root set root+1
endr
; 13d96
SECTION "bank5", ROMX, BANK[$5]
StopRTC: ; 14000
ld a, SRAM_ENABLE
ld [MBC3SRamEnable], a
call LatchClock
ld a, RTC_DH
ld [MBC3SRamBank], a
ld a, [MBC3RTC]
set 6, a ; halt
ld [MBC3RTC], a
call CloseSRAM
ret
; 14019
StartRTC: ; 14019
ld a, SRAM_ENABLE
ld [MBC3SRamEnable], a
call LatchClock
ld a, RTC_DH
ld [MBC3SRamBank], a
ld a, [MBC3RTC]
res 6, a ; halt
ld [MBC3RTC], a
call CloseSRAM
ret
; 14032
GetTimeOfDay:: ; 14032
; get time of day based on the current hour
ld a, [hHours] ; hour
ld hl, TimesOfDay
.check
; if we're within the given time period,
; get the corresponding time of day
cp [hl]
jr c, .match
; else, get the next entry
inc hl
inc hl
; try again
jr .check
.match
; get time of day
inc hl
ld a, [hl]
ld [TimeOfDay], a
ret
; 14044
TimesOfDay: ; 14044
; hours for the time of day
; 04-09 morn | 10-17 day | 18-03 nite
db 04, NITE
db 10, MORN
db 18, DAY
db 24, NITE
db -1, MORN
; 1404e
Unknown_1404e: ; 1404e
db 20, 2
db 40, 0
db 60, 1
db -1, 0
; 14056
Function14056: ; 14056
call UpdateTime
ld hl, wRTC
ld a, [CurDay]
ld [hli], a
ld a, [hHours]
ld [hli], a
ld a, [hMinutes]
ld [hli], a
ld a, [hSeconds]
ld [hli], a
ret
; 1406a
Function1406a: ; 1406a
ld a, $a
ld [MBC3SRamEnable], a
call LatchClock
ld hl, MBC3RTC
ld a, $c
ld [MBC3SRamBank], a
res 7, [hl]
ld a, $0
ld [MBC3SRamBank], a
xor a
ld [$ac60], a
call CloseSRAM
ret
; 14089
StartClock:: ; 14089
call GetClock
call Function1409b
call FixDays
jr nc, .asm_14097
call Function6d3
.asm_14097
call StartRTC
ret
; 1409b
Function1409b: ; 1409b
ld hl, hRTCDayHi
bit 7, [hl]
jr nz, .asm_140a8
bit 6, [hl]
jr nz, .asm_140a8
xor a
ret
.asm_140a8
ld a, $80
call Function6d3
ret
; 140ae
Function140ae: ; 140ae
call Function6e3
ld c, a
and $c0
jr nz, .asm_140c8
ld a, c
and $20
jr z, .asm_140eb
call UpdateTime
ld a, [wRTC + 0]
ld b, a
ld a, [CurDay]
cp b
jr c, .asm_140eb
.asm_140c8
callba Function113da
callba Function170923
ld a, $5
call GetSRAMBank
ld a, [$aa8c]
inc a
ld [$aa8c], a
ld a, [$b2fa]
inc a
ld [$b2fa], a
call CloseSRAM
ret
.asm_140eb
xor a
ret
; 140ed
Function140ed:: ; 140ed
call GetClock
call FixDays
ld hl, hRTCSeconds
ld de, StartSecond
ld a, [$d089]
sub [hl]
dec hl
jr nc, .asm_14102
add $3c
.asm_14102
ld [de], a
dec de
ld a, [$d088]
sbc [hl]
dec hl
jr nc, .asm_1410d
add $3c
.asm_1410d
ld [de], a
dec de
ld a, [$d087]
sbc [hl]
dec hl
jr nc, .asm_14118
add $18
.asm_14118
ld [de], a
dec de
ld a, [StringBuffer2]
sbc [hl]
dec hl
jr nc, .asm_14128
add $8c
ld c, $7
call SimpleDivide
.asm_14128
ld [de], a
ret
; 1412a
Function1412a: ; 1412a
ld a, $1
ld [rVBK], a
call Get2bpp
xor a
ld [rVBK], a
ret
; 14135
Function14135:: ; 14135
call GetPlayerSprite
ld a, [UsedSprites]
ld [$ffbd], a
ld a, [$d155]
ld [$ffbe], a
call Function143c8
ret
; 14146
Function14146: ; 14146
ld hl, $d13e
ld a, [hl]
push af
res 7, [hl]
set 6, [hl]
call Function14209
pop af
ld [$d13e], a
ret
; 14157
Function14157: ; 14157
ld hl, $d13e
ld a, [hl]
push af
set 7, [hl]
res 6, [hl]
call Function14209
pop af
ld [$d13e], a
ret
; 14168
Function14168:: ; 14168
call Function1416f
call Function14209
ret
; 1416f
Function1416f: ; 1416f
xor a
ld bc, $0040
ld hl, UsedSprites
call ByteFill
call GetPlayerSprite
call AddMapSprites
call Function142db
ret
; 14183
GetPlayerSprite: ; 14183
; Get Chris or Kris's sprite.
ld hl, .Chris
ld a, [$d45b]
bit 2, a
jr nz, .go
ld a, [PlayerGender]
bit 0, a
jr z, .go
ld hl, .Kris
.go
ld a, [PlayerState]
ld c, a
.loop
ld a, [hli]
cp c
jr z, .asm_141ac
inc hl
cp $ff
jr nz, .loop
; Any player state not in the array defaults to Chris's sprite.
xor a ; ld a, PLAYER_NORMAL
ld [PlayerState], a
ld a, SPRITE_CHRIS
jr .asm_141ad
.asm_141ac
ld a, [hl]
.asm_141ad
ld [UsedSprites + 0], a
ld [PlayerStruct + 0], a
ld [MapObjects + OBJECT_LENGTH * 0 + 1], a
ret
.Chris
db PLAYER_NORMAL, SPRITE_CHRIS
db PLAYER_BIKE, SPRITE_CHRIS_BIKE
db PLAYER_SURF, SPRITE_SURF
db PLAYER_SURF_PIKA, SPRITE_SURFING_PIKACHU
db $ff
.Kris
db PLAYER_NORMAL, SPRITE_KRIS
db PLAYER_BIKE, SPRITE_KRIS_BIKE
db PLAYER_SURF, SPRITE_SURF
db PLAYER_SURF_PIKA, SPRITE_SURFING_PIKACHU
db $ff
; 141c9
AddMapSprites: ; 141c9
call GetMapPermission
call CheckOutdoorMap
jr z, .outdoor
call AddIndoorSprites
ret
.outdoor
call AddOutdoorSprites
ret
; 141d9
AddIndoorSprites: ; 141d9
ld hl, MapObjects + 1 * OBJECT_LENGTH + 1 ; sprite
ld a, 1
.loop
push af
ld a, [hl]
call AddSpriteGFX
ld de, OBJECT_LENGTH
add hl, de
pop af
inc a
cp NUM_OBJECTS
jr nz, .loop
ret
; 141ee
AddOutdoorSprites: ; 141ee
ld a, [MapGroup]
dec a
ld c, a
ld b, 0
ld hl, OutdoorSprites
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld c, $17
.loop
push bc
ld a, [hli]
call AddSpriteGFX
pop bc
dec c
jr nz, .loop
ret
; 14209
Function14209: ; 14209
ld a, $4
call Function263b
call Function1439b
call Function14215
ret
; 14215
Function14215: ; 14215
ld a, [$d13e]
bit 6, a
ret nz
ld c, $8
callba Function1442f
call GetMapPermission
call CheckOutdoorMap
ld c, $b
jr z, .asm_1422f
ld c, $a
.asm_1422f
callba Function1442f
ret
; 14236
SafeGetSprite: ; 14236
push hl
call GetSprite
pop hl
ret
; 1423c
GetSprite: ; 1423c
call GetMonSprite
ret c
ld hl, SpriteHeaders
dec a
ld c, a
ld b, 0
ld a, 6
call AddNTimes
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
swap a
ld c, a
ld b, [hl]
ld a, [hli]
ld l, [hl]
ld h, a
ret
; 14259
GetMonSprite: ; 14259
; Return carry if a monster sprite was loaded.
cp SPRITE_POKEMON
jr c, .Normal
cp SPRITE_DAYCARE_MON_1
jr z, .wBreedMon1
cp SPRITE_DAYCARE_MON_2
jr z, .wBreedMon2
cp SPRITE_VARS
jr nc, .Variable
jr .Icon
.Normal
and a
ret
.Icon
sub SPRITE_POKEMON
ld e, a
ld d, 0
ld hl, SpriteMons
add hl, de
ld a, [hl]
jr .Mon
.wBreedMon1
ld a, [wBreedMon1Species]
jr .Mon
.wBreedMon2
ld a, [wBreedMon2Species]
.Mon
ld e, a
and a
jr z, .asm_1429f
callba Function8e82b
ld l, 1
ld h, 0
scf
ret
.Variable
sub SPRITE_VARS
ld e, a
ld d, 0
ld hl, VariableSprites
add hl, de
ld a, [hl]
and a
jp nz, GetMonSprite
.asm_1429f
ld a, 1
ld l, 1
ld h, 0
and a
ret
; 142a7
Function142a7:: ; 142a7
cp SPRITE_POKEMON
jr nc, .asm_142c2
push hl
push bc
ld hl, SpriteHeaders + 4
dec a
ld c, a
ld b, 0
ld a, 6
call AddNTimes
ld a, [hl]
pop bc
pop hl
cp 3
jr nz, .asm_142c2
scf
ret
.asm_142c2
and a
ret
; 142c4
_GetSpritePalette:: ; 142c4
ld a, c
call GetMonSprite
jr c, .asm_142d8
ld hl, SpriteHeaders + 5 ; palette
dec a
ld c, a
ld b, 0
ld a, 6
call AddNTimes
ld c, [hl]
ret
.asm_142d8
xor a
ld c, a
ret
; 142db
Function142db: ; 142db
call LoadSpriteGFX
call SortUsedSprites
call ArrangeUsedSprites
ret
; 142e5
AddSpriteGFX: ; 142e5
; Add any new sprite ids to a list of graphics to be loaded.
; Return carry if the list is full.
push hl
push bc
ld b, a
ld hl, UsedSprites + 2
ld c, $1f
.loop
ld a, [hl]
cp b
jr z, .exists
and a
jr z, .new
inc hl
inc hl
dec c
jr nz, .loop
pop bc
pop hl
scf
ret
.exists
pop bc
pop hl
and a
ret
.new
ld [hl], b
pop bc
pop hl
and a
ret
; 14306
LoadSpriteGFX: ; 14306
; Bug: b is not preserved, so
; it's useless as a loop count.
ld hl, UsedSprites
ld b, $20
.loop
ld a, [hli]
and a
jr z, .done
push hl
call .LoadSprite
pop hl
ld [hli], a
dec b
jr nz, .loop
.done
ret
.LoadSprite
call GetSprite
ld a, l
ret
; 1431e
SortUsedSprites: ; 1431e
; Bubble-sort sprites by type.
; Run backwards through UsedSprites to find the last one.
ld c, $20
ld de, UsedSprites + ($20 - 1) * 2
.FindLastSprite
ld a, [de]
and a
jr nz, .FoundLastSprite
dec de
dec de
dec c
jr nz, .FindLastSprite
.FoundLastSprite
dec c
jr z, .quit
; If the length of the current sprite is
; higher than a later one, swap them.
inc de
ld hl, UsedSprites + 1
.CheckSprite
push bc
push de
push hl
.CheckFollowing
ld a, [de]
cp [hl]
jr nc, .next
; Swap the two sprites.
ld b, a
ld a, [hl]
ld [hl], b
ld [de], a
dec de
dec hl
ld a, [de]
ld b, a
ld a, [hl]
ld [hl], b
ld [de], a
inc de
inc hl
; Keep doing this until everything's in order.
.next
dec de
dec de
dec c
jr nz, .CheckFollowing
pop hl
inc hl
inc hl
pop de
pop bc
dec c
jr nz, .CheckSprite
.quit
ret
; 14355
ArrangeUsedSprites: ; 14355
; Get the length of each sprite and space them out in VRAM.
; Crystal introduces a second table in VRAM bank 0.
ld hl, UsedSprites
ld c, $20
ld b, 0
.FirstTableLength
; Keep going until the end of the list.
ld a, [hli]
and a
jr z, .quit
ld a, [hl]
call GetSpriteLength
; Spill over into the second table after $80 tiles.
add b
cp $80
jr z, .next
jr nc, .SecondTable
.next
ld [hl], b
inc hl
ld b, a
; Assumes the next table will be reached before c hits 0.
dec c
jr nz, .FirstTableLength
.SecondTable
; The second tile table starts at tile $80.
ld b, $80
dec hl
.SecondTableLength
; Keep going until the end of the list.
ld a, [hli]
and a
jr z, .quit
ld a, [hl]
call GetSpriteLength
; There are only two tables, so don't go any further than that.
add b
jr c, .quit
ld [hl], b
ld b, a
inc hl
dec c
jr nz, .SecondTableLength
.quit
ret
; 14386
GetSpriteLength: ; 14386
; Return the length of sprite type a in tiles.
cp WALKING_SPRITE
jr z, .AnyDirection
cp STANDING_SPRITE
jr z, .AnyDirection
cp STILL_SPRITE
jr z, .OneDirection
ld a, 12
ret
.AnyDirection
ld a, 12
ret
.OneDirection
ld a, 4
ret
; 1439b
Function1439b: ; 1439b
ld hl, UsedSprites
ld c, $20
.asm_143a0
ld a, [$d13e]
res 5, a
ld [$d13e], a
ld a, [hli]
and a
jr z, .asm_143c7
ld [$ffbd], a
ld a, [hli]
ld [$ffbe], a
bit 7, a
jr z, .asm_143bd
ld a, [$d13e]
set 5, a
ld [$d13e], a
.asm_143bd
push bc
push hl
call Function143c8
pop hl
pop bc
dec c
jr nz, .asm_143a0
.asm_143c7
ret
; 143c8
Function143c8: ; 143c8
ld a, [$ffbd]
call SafeGetSprite
ld a, [$ffbe]
call Function14406
push hl
push de
push bc
ld a, [$d13e]
bit 7, a
jr nz, .asm_143df
call Function14418
.asm_143df
pop bc
ld l, c
ld h, $0
add hl, hl
add hl, hl
add hl, hl
add hl, hl
pop de
add hl, de
ld d, h
ld e, l
pop hl
ld a, [$d13e]
bit 5, a
jr nz, .asm_14405
bit 6, a
jr nz, .asm_14405
ld a, [$ffbd]
call Function142a7
jr c, .asm_14405
ld a, h
add $8
ld h, a
call Function14418
.asm_14405
ret
; 14406
Function14406: ; 14406
and $7f
ld l, a
ld h, $0
add hl, hl
add hl, hl
add hl, hl
add hl, hl
ld a, l
add $0
ld l, a
ld a, h
adc $80
ld h, a
ret
; 14418
Function14418: ; 14418
ld a, [rVBK]
push af
ld a, [$d13e]
bit 5, a
ld a, $1
jr z, .asm_14426
ld a, $0
.asm_14426
ld [rVBK], a
call Get2bpp
pop af
ld [rVBK], a
ret
; 1442f
Function1442f:: ; 1442f
ld a, c
ld bc, 6
ld hl, EmotesPointers
call AddNTimes
ld e, [hl]
inc hl
ld d, [hl]
inc hl
ld c, [hl]
swap c
inc hl
ld b, [hl]
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
ld a, c
and a
ret z
call Function1412a
ret
; 1444d
EmotesPointers: ; 144d
; dw source address
; db length, bank
; dw dest address
dw ShockEmote
db $40, BANK(ShockEmote)
dw $8f80
dw QuestionEmote
db $40, BANK(QuestionEmote)
dw $8f80
dw HappyEmote
db $40, BANK(HappyEmote)
dw $8f80
dw SadEmote
db $40, BANK(SadEmote)
dw $8f80
dw HeartEmote
db $40, BANK(HeartEmote)
dw $8f80
dw BoltEmote
db $40, BANK(BoltEmote)
dw $8f80
dw SleepEmote
db $40, BANK(SleepEmote)
dw $8f80
dw FishEmote
db $40, BANK(FishEmote)
dw $8f80
dw FishingRodGFX + $00
db $10, BANK(FishingRodGFX)
dw $8fc0
dw FishingRodGFX + $10
db $20, BANK(FishingRodGFX)
dw $8fc0
dw FishingRodGFX + $30
db $20, BANK(FishingRodGFX)
dw $8fe0
dw FishingRodGFX + $50
db $10, BANK(FishingRodGFX)
dw $8fe0
; 14495
SpriteMons: ; 14495
db UNOWN
db GEODUDE
db GROWLITHE
db WEEDLE
db SHELLDER
db ODDISH
db GENGAR
db ZUBAT
db MAGIKARP
db SQUIRTLE
db TOGEPI
db BUTTERFREE
db DIGLETT
db POLIWAG
db PIKACHU
db CLEFAIRY
db CHARMANDER
db JYNX
db STARMIE
db BULBASAUR
db JIGGLYPUFF
db GRIMER
db EKANS
db PARAS
db TENTACOOL
db TAUROS
db MACHOP
db VOLTORB
db LAPRAS
db RHYDON
db MOLTRES
db SNORLAX
db GYARADOS
db LUGIA
db HO_OH
; 144b8
OutdoorSprites: ; 144b8
; Valid sprite IDs for each map group.
dw Group1Sprites
dw Group2Sprites
dw Group3Sprites
dw Group4Sprites
dw Group5Sprites
dw Group6Sprites
dw Group7Sprites
dw Group8Sprites
dw Group9Sprites
dw Group10Sprites
dw Group11Sprites
dw Group12Sprites
dw Group13Sprites
dw Group14Sprites
dw Group15Sprites
dw Group16Sprites
dw Group17Sprites
dw Group18Sprites
dw Group19Sprites
dw Group20Sprites
dw Group21Sprites
dw Group22Sprites
dw Group23Sprites
dw Group24Sprites
dw Group25Sprites
dw Group26Sprites
; 144ec
Group13Sprites: ; 144ec
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_TEACHER
db SPRITE_FISHER
db SPRITE_YOUNGSTER
db SPRITE_BLUE
db SPRITE_GRAMPS
db SPRITE_BUG_CATCHER
db SPRITE_COOLTRAINER_F
db SPRITE_SWIMMER_GIRL
db SPRITE_SWIMMER_GUY
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 14503
Group23Sprites: ; 14503
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_TEACHER
db SPRITE_FISHER
db SPRITE_YOUNGSTER
db SPRITE_BLUE
db SPRITE_GRAMPS
db SPRITE_BUG_CATCHER
db SPRITE_COOLTRAINER_F
db SPRITE_SWIMMER_GIRL
db SPRITE_SWIMMER_GUY
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 1451a
Group14Sprites: ; 1451a
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_TEACHER
db SPRITE_FISHER
db SPRITE_YOUNGSTER
db SPRITE_BLUE
db SPRITE_GRAMPS
db SPRITE_BUG_CATCHER
db SPRITE_COOLTRAINER_F
db SPRITE_SWIMMER_GIRL
db SPRITE_SWIMMER_GUY
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 14531
Group6Sprites: ; 14531
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_TEACHER
db SPRITE_FISHER
db SPRITE_YOUNGSTER
db SPRITE_BLUE
db SPRITE_GRAMPS
db SPRITE_BUG_CATCHER
db SPRITE_COOLTRAINER_F
db SPRITE_SWIMMER_GIRL
db SPRITE_SWIMMER_GUY
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 14548
Group7Sprites: ; 14548
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_COOLTRAINER_M
db SPRITE_SUPER_NERD
db SPRITE_COOLTRAINER_F
db SPRITE_FISHER
db SPRITE_YOUNGSTER
db SPRITE_LASS
db SPRITE_POKEFAN_M
db SPRITE_ROCKET
db SPRITE_MISTY
db SPRITE_POKE_BALL
db SPRITE_SLOWPOKE
; 1455f
Group25Sprites: ; 1455f
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_COOLTRAINER_M
db SPRITE_SUPER_NERD
db SPRITE_COOLTRAINER_F
db SPRITE_FISHER
db SPRITE_YOUNGSTER
db SPRITE_LASS
db SPRITE_POKEFAN_M
db SPRITE_ROCKET
db SPRITE_MISTY
db SPRITE_POKE_BALL
db SPRITE_SLOWPOKE
; 14576
Group21Sprites: ; 14576
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_FISHER
db SPRITE_POLIWAG
db SPRITE_TEACHER
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_LASS
db SPRITE_BIKER
db SPRITE_SILVER
db SPRITE_BLUE
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 1458d
Group18Sprites: ; 1458d
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_POKEFAN_M
db SPRITE_MACHOP
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_FISHER
db SPRITE_TEACHER
db SPRITE_SUPER_NERD
db SPRITE_BIG_SNORLAX
db SPRITE_BIKER
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 145a4
Group12Sprites: ; 145a4
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_POKEFAN_M
db SPRITE_MACHOP
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_FISHER
db SPRITE_TEACHER
db SPRITE_SUPER_NERD
db SPRITE_BIG_SNORLAX
db SPRITE_BIKER
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 145bb
Group17Sprites: ; 145bb
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_POKEFAN_M
db SPRITE_MACHOP
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_FISHER
db SPRITE_TEACHER
db SPRITE_SUPER_NERD
db SPRITE_BIG_SNORLAX
db SPRITE_BIKER
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 145d2
Group16Sprites: ; 145d2
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_POKEFAN_M
db SPRITE_BUENA
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_FISHER
db SPRITE_TEACHER
db SPRITE_SUPER_NERD
db SPRITE_MACHOP
db SPRITE_BIKER
db SPRITE_POKE_BALL
db SPRITE_BOULDER
; 145e9
Group24Sprites: ; 145e9
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_SILVER
db SPRITE_TEACHER
db SPRITE_FISHER
db SPRITE_COOLTRAINER_M
db SPRITE_YOUNGSTER
db SPRITE_MONSTER
db SPRITE_GRAMPS
db SPRITE_BUG_CATCHER
db SPRITE_COOLTRAINER_F
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 14600
Group26Sprites: ; 14600
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_SILVER
db SPRITE_TEACHER
db SPRITE_FISHER
db SPRITE_COOLTRAINER_M
db SPRITE_YOUNGSTER
db SPRITE_MONSTER
db SPRITE_GRAMPS
db SPRITE_BUG_CATCHER
db SPRITE_COOLTRAINER_F
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 14617
Group19Sprites: ; 14617
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_SILVER
db SPRITE_TEACHER
db SPRITE_FISHER
db SPRITE_COOLTRAINER_M
db SPRITE_YOUNGSTER
db SPRITE_MONSTER
db SPRITE_GRAMPS
db SPRITE_BUG_CATCHER
db SPRITE_COOLTRAINER_F
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 1462e
Group10Sprites: ; 1462e
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_FISHER
db SPRITE_LASS
db SPRITE_OFFICER
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_COOLTRAINER_M
db SPRITE_BUG_CATCHER
db SPRITE_SUPER_NERD
db SPRITE_WEIRD_TREE
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 14645
Group4Sprites: ; 14645
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_FISHER
db SPRITE_LASS
db SPRITE_OFFICER
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_COOLTRAINER_M
db SPRITE_BUG_CATCHER
db SPRITE_SUPER_NERD
db SPRITE_WEIRD_TREE
db SPRITE_POKE_BALL
db SPRITE_FRUIT_TREE
; 1465c
Group8Sprites: ; 1465c
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_KURT_OUTSIDE
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_OFFICER
db SPRITE_POKEFAN_M
db SPRITE_BLACK_BELT
db SPRITE_TEACHER
db SPRITE_AZALEA_ROCKET
db SPRITE_LASS
db SPRITE_SILVER
db SPRITE_FRUIT_TREE
db SPRITE_SLOWPOKE
; 14673
Group11Sprites: ; 14673
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_POKE_BALL
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_OFFICER
db SPRITE_POKEFAN_M
db SPRITE_DAYCARE_MON_1
db SPRITE_COOLTRAINER_F
db SPRITE_ROCKET
db SPRITE_LASS
db SPRITE_DAYCARE_MON_2
db SPRITE_FRUIT_TREE
db SPRITE_SLOWPOKE
; 1468a
Group22Sprites: ; 1468a
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_STANDING_YOUNGSTER
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_OLIVINE_RIVAL
db SPRITE_POKEFAN_M
db SPRITE_LASS
db SPRITE_BUENA
db SPRITE_SWIMMER_GIRL
db SPRITE_SAILOR
db SPRITE_POKEFAN_F
db SPRITE_SUPER_NERD
db SPRITE_TAUROS
db SPRITE_FRUIT_TREE
db SPRITE_ROCK
; 146a1
Group1Sprites: ; 146a1
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_STANDING_YOUNGSTER
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_OLIVINE_RIVAL
db SPRITE_POKEFAN_M
db SPRITE_LASS
db SPRITE_BUENA
db SPRITE_SWIMMER_GIRL
db SPRITE_SAILOR
db SPRITE_POKEFAN_F
db SPRITE_SUPER_NERD
db SPRITE_TAUROS
db SPRITE_FRUIT_TREE
db SPRITE_ROCK
; 146b8
Group9Sprites: ; 146b8
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_LANCE
db SPRITE_GRAMPS
db SPRITE_SUPER_NERD
db SPRITE_COOLTRAINER_F
db SPRITE_FISHER
db SPRITE_COOLTRAINER_M
db SPRITE_LASS
db SPRITE_YOUNGSTER
db SPRITE_GYARADOS
db SPRITE_FRUIT_TREE
db SPRITE_POKE_BALL
; 146cf
Group2Sprites: ; 146cf
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_LASS
db SPRITE_SUPER_NERD
db SPRITE_COOLTRAINER_M
db SPRITE_POKEFAN_M
db SPRITE_BLACK_BELT
db SPRITE_COOLTRAINER_F
db SPRITE_FISHER
db SPRITE_FRUIT_TREE
db SPRITE_POKE_BALL
; 146e6
Group5Sprites: ; 146e6
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_GRAMPS
db SPRITE_YOUNGSTER
db SPRITE_LASS
db SPRITE_SUPER_NERD
db SPRITE_COOLTRAINER_M
db SPRITE_POKEFAN_M
db SPRITE_BLACK_BELT
db SPRITE_COOLTRAINER_F
db SPRITE_FISHER
db SPRITE_FRUIT_TREE
db SPRITE_POKE_BALL
; 146fd
Group3Sprites: ; 146fd
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_GAMEBOY_KID
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_LASS
db SPRITE_POKEFAN_F
db SPRITE_TEACHER
db SPRITE_YOUNGSTER
db SPRITE_GROWLITHE
db SPRITE_POKEFAN_M
db SPRITE_ROCKER
db SPRITE_FISHER
db SPRITE_SCIENTIST
db SPRITE_POKE_BALL
db SPRITE_BOULDER
; 14714
Group15Sprites: ; 14714
db SPRITE_SUICUNE
db SPRITE_SILVER_TROPHY
db SPRITE_FAMICOM
db SPRITE_POKEDEX
db SPRITE_WILL
db SPRITE_KAREN
db SPRITE_NURSE
db SPRITE_OLD_LINK_RECEPTIONIST
db SPRITE_BIG_LAPRAS
db SPRITE_BIG_ONIX
db SPRITE_SUDOWOODO
db SPRITE_BIG_SNORLAX
db SPRITE_SAILOR
db SPRITE_FISHING_GURU
db SPRITE_GENTLEMAN
db SPRITE_SUPER_NERD
db SPRITE_HO_OH
db SPRITE_TEACHER
db SPRITE_COOLTRAINER_F
db SPRITE_YOUNGSTER
db SPRITE_FAIRY
db SPRITE_POKE_BALL
db SPRITE_ROCK
; 1472b
Group20Sprites: ; 1472b
db SPRITE_OAK
db SPRITE_FISHER
db SPRITE_TEACHER
db SPRITE_TWIN
db SPRITE_POKEFAN_M
db SPRITE_GRAMPS
db SPRITE_FAIRY
db SPRITE_SILVER
db SPRITE_FISHING_GURU
db SPRITE_POKE_BALL
db SPRITE_POKEDEX
; 14736
SpriteHeaders: ; 14736
INCLUDE "gfx/overworld/sprite_headers.asm"
; 1499a
Function1499a:: ; 1499a
ld a, [StandingTile]
cp $60
jr z, .asm_149ad
cp $68
jr z, .asm_149ad
and $f0
cp $70
jr z, .asm_149ad
and a
ret
.asm_149ad
scf
ret
; 149af
Function149af:: ; 149af
ld a, [StandingTile]
cp $70
jr z, .asm_149c4
cp $76
jr z, .asm_149c4
cp $78
jr z, .asm_149c4
cp $7e
jr z, .asm_149c4
scf
ret
.asm_149c4
xor a
ret
; 149c6
Function149c6: ; 149c6
ld de, 1
ld hl, Unknown_149d3
ld a, [StandingTile] ; $d4e4
call IsInArray
ret
; 149d3
Unknown_149d3: ; 149d3
db $71 ; door
db $79
db $7a ; stairs
db $73
db $7b ; cave entrance
db $74
db $7c ; warp pad
db $75
db $7d
db -1
; 149dd
Function149dd:: ; 149dd
ld a, [StandingTile]
ld hl, Unknown_149ea
ld de, 1
call IsInArray
ret
; 149ea
Unknown_149ea: ; 149ea
db $08
db $18 ; tall grass
db $14 ; tall grass
db $28
db $29
db $48
db $49
db $4a
db $4b
db $4c
db -1
; 149f5
Function149f5: ; 149f5
ld a, c
ld hl, Unknown_14a00
ld de, 1
call IsInArray
ret
; 14a00
Unknown_14a00: ; 14a00
db $12 ; cut tree
db $1a ; cut tree
db $10 ; tall grass
db $18 ; tall grass
db $14 ; tall grass
db $1c ; tall grass
db -1
; 14a07
Function14a07:: ; 14a07
ld a, [StandingTile]
ld de, $001f
cp $71 ; door
ret z
ld de, $0013
cp $7c ; warp pad
ret z
ld de, $0023
ret
; 14a1a
Function14a1a: ; 14a1a
call Function1d6e
callba Function5e9a
call SpeechTextBox
call Function1ad2
callba Function4cf45
ld hl, UnknownText_0x15283
call Function14baf
jr nz, .asm_14a4a
call Function14b89
jr c, .asm_14a4a
call Function14b54
call Function14be3
call Function14b5a
call Function1c07
and a
ret
.asm_14a4a
call Function1c07
call Functiond90
callba Function4cf45
scf
ret
Function14a58: ; 14a58
call Function14b54
callba Function14056
callba Function1050d9
call Function14df7
call Function14e13
call Function14e76
call Function14e8b
callba Function44725
callba Function1406a
call Function14b5a
ret
; 14a83
Function14a83: ; 14a83 (5:4a83)
push de
ld hl, UnknownText_0x152a1
call Function1d4f
call YesNoBox
call Function1c07
jr c, .asm_14ab0
call Function14b89
jr c, .asm_14ab0
call Function14b54
call Function14c99
call Function14e0c
pop de
ld a, e
ld [wCurBox], a
call Function15021
call Function14be6
call Function14b5a
and a
ret
.asm_14ab0
pop de
ret
Function14ab2: ; 14ab2
call Function14b89
jr c, .asm_14ac1
call Function14b54
call Function14be3
call Function14b5a
and a
.asm_14ac1
ret
; 14ac2
Function14ac2: ; 14ac2
call Function14b54
push de
call Function14e0c
pop de
ld a, e
ld [wCurBox], a
call Function15021
call Function14b5a
ret
; 14ad5
Function14ad5: ; 14ad5
call Function14b54
push de
call Function14e0c
pop de
ld a, e
ld [wCurBox], a
ld a, $1
ld [$cfcd], a
callba Function14056
callba Function1050d9
call Function14da9
call Function14dbb
call Function14dd7
call Function14df7
call Function14e13
call Function14e2d
call Function14e40
call Function14e55
call Function14e76
call Function14e8b
callba Function44725
callba Function106187
callba Function1406a
call Function15021
call Function14b5a
ld de, SFX_SAVE
call PlaySFX
ld c, $18
call DelayFrames
ret
; 14b34
Function14b34: ; 14b34
ld hl, UnknownText_0x152a6
call Function1d4f
call YesNoBox
call Function1c07
jr c, .asm_14b52
call Function14b89
jr c, .asm_14b52
call Function14b54
call Function14be3
call Function14b5a
and a
ret
.asm_14b52
scf
ret
; 14b54
Function14b54: ; 14b54
ld a, $1
ld [$c2cd], a
ret
; 14b5a
Function14b5a: ; 14b5a
xor a
ld [$c2cd], a
ret
; 14b5f
Function14b5f: ; 14b5f
ld a, $1
call GetSRAMBank
ld hl, $bdd9
ld de, $be3b
ld bc, $0b1a
.asm_14b6d
ld a, [hld]
ld [de], a
dec de
dec bc
ld a, c
or b
jr nz, .asm_14b6d
ld hl, OverworldMap
ld de, $b2c0
ld bc, $0062
call CopyBytes
call CloseSRAM
ret
; 14b85
Function14b85: ; 14b85
call Function14c10
ret
; 14b89
Function14b89: ; 14b89
ld a, [$cfcd]
and a
jr z, .asm_14ba8
call Function14bcb
jr z, .asm_14b9e
ld hl, UnknownText_0x15297
call Function14baf
jr nz, .asm_14bad
jr .asm_14ba8
.asm_14b9e
ld hl, UnknownText_0x15292
call Function14baf
jr nz, .asm_14bad
jr .asm_14bab
.asm_14ba8
call Function14cbb
.asm_14bab
and a
ret
.asm_14bad
scf
ret
; 14baf
Function14baf: ; 14baf
ld b, $5
call Function269a
call Function1d58
lb bc, 0, 7
call PlaceYesNoBox
ld a, [$cfa9]
dec a
call Function1c17
push af
call Functiond90
pop af
and a
ret
; 14bcb
Function14bcb: ; 14bcb
ld a, $1
call GetSRAMBank
ld hl, $a009
ld a, [hli]
ld c, [hl]
ld b, a
call CloseSRAM
ld a, [PlayerID]
cp b
ret nz
ld a, [$d47c]
cp c
ret
; 14be3
Function14be3: ; 14be3
call Function14c99
Function14be6: ; 14be6
call Function14c10
ld c, $20
call DelayFrames
ld a, [Options]
push af
ld a, $3
ld [Options], a
ld hl, UnknownText_0x1528d
call PrintText
pop af
ld [Options], a
ld de, SFX_SAVE
call WaitPlaySFX
call WaitSFX
ld c, $1e
call DelayFrames
ret
; 14c10
Function14c10: ; 14c10
ld a, $1
ld [$cfcd], a
callba Function14056
callba Function1050d9
call Function14da9
call Function14dbb
call Function14dd7
call Function14df7
call Function14e0c
call Function14e13
call Function14e2d
call Function14e40
call Function14e55
call Function14e76
call Function14e8b
call Function14c6b
callba Function44725
callba Function106187
callba Function1406a
ld a, $1
call GetSRAMBank
ld a, [$be45]
cp $4
jr nz, .asm_14c67
xor a
ld [$be45], a
.asm_14c67
call CloseSRAM
ret
; 14c6b
Function14c6b: ; 14c6b
call Function14c90
ld a, $0
call GetSRAMBank
ld a, [$bf10]
ld e, a
ld a, [$bf11]
ld d, a
or e
jr z, .asm_14c84
ld a, e
sub l
ld a, d
sbc h
jr c, .asm_14c8c
.asm_14c84
ld a, l
ld [$bf10], a
ld a, h
ld [$bf11], a
.asm_14c8c
call CloseSRAM
ret
; 14c90
Function14c90: ; 14c90
ld hl, $c000
.asm_14c93
ld a, [hl]
or a
ret nz
inc hl
jr .asm_14c93
; 14c99
Function14c99: ; 14c99
xor a
ld [hJoypadReleased], a
ld [hJoypadPressed], a
ld [hJoypadSum], a
ld [hJoypadDown], a
ld a, [Options]
push af
ld a, $3
ld [Options], a
ld hl, UnknownText_0x15288
call PrintText
pop af
ld [Options], a
ld c, $10
call DelayFrames
ret
; 14cbb
Function14cbb: ; 14cbb
call Function151fb
call Function14d06
call Function14ce2
call Function14cf4
call Function14d68
call Function14d5c
ld a, $0
call GetSRAMBank
xor a
ld [$bf10], a
ld [$bf11], a
call CloseSRAM
ld a, $1
ld [$d4b4], a
ret
; 14ce2
Function14ce2: ; 14ce2
ld a, $1
call GetSRAMBank
ld hl, $b260
ld bc, $0060
xor a
call ByteFill
jp CloseSRAM
; 14cf4
Function14cf4: ; 14cf4
ld a, $0
call GetSRAMBank
ld hl, $abe4
ld bc, $004c
xor a
call ByteFill
jp CloseSRAM
; 14d06
Function14d06: ; 14d06
ld a, $1
call GetSRAMBank
ld hl, $b2c0
ld bc, $0b7c
xor a
call ByteFill
jp CloseSRAM
; 14d18
Function14d18: ; 14d18
ld a, $4
call GetSRAMBank
ld hl, Unknown_14d2c
ld de, $a007
ld bc, $0030
call CopyBytes
jp CloseSRAM
; 14d2c
Unknown_14d2c: ; 14d2c
db $0d, $02, $00, $05, $00, $00
db $22, $02, $01, $05, $00, $00
db $03, $04, $05, $08, $03, $05
db $0e, $06, $03, $02, $00, $00
db $39, $07, $07, $04, $00, $05
db $04, $07, $01, $05, $00, $00
db $0f, $05, $14, $07, $05, $05
db $11, $0c, $0c, $06, $06, $04
; 14d5c
Function14d5c: ; 14d5c
ld a, $1
call GetSRAMBank
xor a
ld [$be45], a
jp CloseSRAM
; 14d68
Function14d68: ; 14d68
call Function1509a
ret
; 14d6c
Function14d6c: ; 14d6c
ld a, $4
call GetSRAMBank
ld a, [$a60b]
ld b, $0
and a
jr z, .asm_14d7b
ld b, $2
.asm_14d7b
ld a, b
ld [$a60b], a
call CloseSRAM
ret
; 14d83
Function14d83: ; 14d83
ld a, $4
call GetSRAMBank
xor a
ld [$a60c], a
ld [$a60d], a
call CloseSRAM
ret
; 14d93
Function14d93: ; 14d93
ld a, $7
call GetSRAMBank
xor a
ld [$a000], a
call CloseSRAM
ret
; 14da0
Function14da0: ; 14da0
ld a, [$d4b4]
and a
ret nz
call Function14cbb
ret
; 14da9
Function14da9: ; 14da9
ld a, $1
call GetSRAMBank
ld a, $63
ld [$a008], a
ld a, $7f
ld [$ad0f], a
jp CloseSRAM
; 14dbb
Function14dbb: ; 14dbb
ld a, $1
call GetSRAMBank
ld hl, Options
ld de, $a000
ld bc, $0008
call CopyBytes
ld a, [Options]
and $ef
ld [$a000], a
jp CloseSRAM
; 14dd7
Function14dd7: ; 14dd7
ld a, $1
call GetSRAMBank
ld hl, PlayerID
ld de, $a009
ld bc, $082a
call CopyBytes
ld hl, VisitedSpawns
ld de, $a833
ld bc, $0032
call CopyBytes
jp CloseSRAM
; 14df7
Function14df7: ; 14df7
ld a, $1
call GetSRAMBank
ld hl, PartyCount
ld de, $a865
ld bc, $031e
call CopyBytes
call CloseSRAM
ret
; 14e0c
Function14e0c: ; 14e0c
call Function150d8
call Function150f9
ret
; 14e13
Function14e13: ; 14e13
ld hl, $a009
ld bc, $0b7a
ld a, $1
call GetSRAMBank
call Function15273
ld a, e
ld [$ad0d], a
ld a, d
ld [$ad0e], a
call CloseSRAM
ret
; 14e2d
Function14e2d: ; 14e2d
ld a, $0
call GetSRAMBank
ld a, $63
ld [$b208], a
ld a, $7f
ld [$bf0f], a
call CloseSRAM
ret
; 14e40
Function14e40: ; 14e40
ld a, $0
call GetSRAMBank
ld hl, Options
ld de, $b200
ld bc, $0008
call CopyBytes
call CloseSRAM
ret
; 14e55
Function14e55: ; 14e55
ld a, $0
call GetSRAMBank
ld hl, PlayerID
ld de, $b209
ld bc, $082a
call CopyBytes
ld hl, VisitedSpawns
ld de, $ba33
ld bc, $0032
call CopyBytes
call CloseSRAM
ret
; 14e76
Function14e76: ; 14e76
ld a, $0
call GetSRAMBank
ld hl, PartyCount
ld de, $ba65
ld bc, $031e
call CopyBytes
call CloseSRAM
ret
; 14e8b
Function14e8b: ; 14e8b
ld hl, $b209
ld bc, $0b7a
ld a, $0
call GetSRAMBank
call Function15273
ld a, e
ld [$bf0d], a
ld a, d
ld [$bf0e], a
call CloseSRAM
ret
; 14ea5
Function14ea5: ; 14ea5 (5:4ea5)
call Function15028
jr nz, .asm_14ed6
call Function14fd7
call Function1500c
call Function15021
callba Function44745
callba Function10619d
callba Function1050ea
call Function14e2d
call Function14e40
call Function14e55
call Function14e76
call Function14e8b
and a
ret
.asm_14ed6
call Function1507c
jr nz, .asm_14f07
call Function15046
call Function15067
call Function15021
callba Function44745
callba Function10619d
callba Function1050ea
call Function14da9
call Function14dbb
call Function14dd7
call Function14df7
call Function14e13
and a
ret
.asm_14f07
ld a, [Options] ; $cfcc
push af
set 4, a
ld [Options], a ; $cfcc
ld hl, UnknownText_0x1529c
call PrintText
pop af
ld [Options], a ; $cfcc
scf
ret
Function14f1c: ; 14f1c
xor a
ld [$cfcd], a
call Function14f84
ld a, [$cfcd]
and a
jr z, .asm_14f46
ld a, $1
call GetSRAMBank
ld hl, $a044
ld de, StartDay
ld bc, $0008
call CopyBytes
ld hl, $a3da
ld de, StatusFlags
ld a, [hl]
ld [de], a
call CloseSRAM
ret
.asm_14f46
call Function14faf
ld a, [$cfcd]
and a
jr z, .asm_14f6c
ld a, $0
call GetSRAMBank
ld hl, $b244
ld de, StartDay
ld bc, $0008
call CopyBytes
ld hl, $b5da
ld de, StatusFlags
ld a, [hl]
ld [de], a
call CloseSRAM
ret
.asm_14f6c
ld hl, DefaultOptions
ld de, Options
ld bc, $0008
call CopyBytes
call Function67e
ret
; 14f7c
DefaultOptions: ; 14f7c
db $03 ; mid text speed
db $00
db $00 ; frame 0
db $01
db $40 ; gb printer: normal brightness
db $01 ; menu account on
db $00
db $00
; 14f84
Function14f84: ; 14f84
ld a, $1
call GetSRAMBank
ld a, [$a008]
cp $63
jr nz, .asm_14fab
ld a, [$ad0f]
cp $7f
jr nz, .asm_14fab
ld hl, $a000
ld de, Options
ld bc, $0008
call CopyBytes
call CloseSRAM
ld a, $1
ld [$cfcd], a
.asm_14fab
call CloseSRAM
ret
; 14faf
Function14faf: ; 14faf
ld a, $0
call GetSRAMBank
ld a, [$b208]
cp $63
jr nz, .asm_14fd3
ld a, [$bf0f]
cp $7f
jr nz, .asm_14fd3
ld hl, $b200
ld de, Options
ld bc, $0008
call CopyBytes
ld a, $2
ld [$cfcd], a
.asm_14fd3
call CloseSRAM
ret
; 14fd7
Function14fd7: ; 14fd7 (5:4fd7)
ld a, $1
call GetSRAMBank
ld hl, $a009
ld de, PlayerID ; $d47b
ld bc, $82a
call CopyBytes
ld hl, $a833
ld de, VisitedSpawns ; $dca5
ld bc, $32
call CopyBytes
call CloseSRAM
ld a, $1
call GetSRAMBank
ld a, [$be45]
cp $4
jr nz, .asm_15008
ld a, $3
ld [$be45], a
.asm_15008
call CloseSRAM
ret
Function1500c: ; 1500c
ld a, $1
call GetSRAMBank
ld hl, $a865
ld de, PartyCount
ld bc, $031e
call CopyBytes
call CloseSRAM
ret
; 15021
Function15021: ; 15021 (5:5021)
call Function150d8
call Function1517d
ret
Function15028: ; 15028 (5:5028)
ld hl, $a009
ld bc, $b7a
ld a, $1
call GetSRAMBank
call Function15273
ld a, [$ad0d]
cp e
jr nz, .asm_15040
ld a, [$ad0e]
cp d
.asm_15040
push af
call CloseSRAM
pop af
ret
Function15046: ; 15046 (5:5046)
ld a, $0
call GetSRAMBank
ld hl, $b209
ld de, PlayerID ; $d47b
ld bc, $82a
call CopyBytes
ld hl, $ba33
ld de, VisitedSpawns ; $dca5
ld bc, $32
call CopyBytes
call CloseSRAM
ret
Function15067: ; 15067 (5:5067)
ld a, $0
call GetSRAMBank
ld hl, $ba65
ld de, PartyCount ; $dcd7
ld bc, $31e
call CopyBytes
call CloseSRAM
ret
Function1507c: ; 1507c (5:507c)
ld hl, $b209
ld bc, $b7a
ld a, $0
call GetSRAMBank
call Function15273
ld a, [$bf0d]
cp e
jr nz, .asm_15094
ld a, [$bf0e]
cp d
.asm_15094
push af
call CloseSRAM
pop af
ret
Function1509a: ; 1509a
ld a, $1
call GetSRAMBank
ld hl, PlayerGender
ld de, $be3d
ld bc, $0007
call CopyBytes
ld hl, $d479
ld a, [hli]
ld [$a60e], a
ld a, [hli]
ld [$a60f], a
jp CloseSRAM
; 150b9
Function150b9: ; 150b9 (5:50b9)
ld a, $1
call GetSRAMBank
ld hl, $be3d
ld de, PlayerGender ; $d472
ld bc, $7
call CopyBytes
ld hl, $d479
ld a, [$a60e]
ld [hli], a
ld a, [$a60f]
ld [hli], a
jp CloseSRAM
Function150d8: ; 150d8
ld a, [wCurBox]
cp NUM_BOXES
jr c, .asm_150e3
xor a
ld [wCurBox], a
.asm_150e3
ld e, a
ld d, 0
ld hl, Unknown_1522d
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
ld a, [hli]
push af
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld h, [hl]
ld l, a
pop af
ret
; 150f9
Function150f9: ; 150f9
push hl
push af
push de
ld a, $1
call GetSRAMBank
ld hl, sBoxCount
ld de, $c608
ld bc, $01e0
call CopyBytes
call CloseSRAM
pop de
pop af
push af
push de
call GetSRAMBank
ld hl, $c608
ld bc, $01e0
call CopyBytes
call CloseSRAM
ld a, $1
call GetSRAMBank
ld hl, $aef0
ld de, $c608
ld bc, $01e0
call CopyBytes
call CloseSRAM
pop de
pop af
ld hl, $01e0
add hl, de
ld e, l
ld d, h
push af
push de
call GetSRAMBank
ld hl, $c608
ld bc, $01e0
call CopyBytes
call CloseSRAM
ld a, $1
call GetSRAMBank
ld hl, $b0d0
ld de, $c608
ld bc, $008e
call CopyBytes
call CloseSRAM
pop de
pop af
ld hl, $01e0
add hl, de
ld e, l
ld d, h
call GetSRAMBank
ld hl, $c608
ld bc, $008e
call CopyBytes
call CloseSRAM
pop hl
ret
; 1517d
Function1517d: ; 1517d (5:517d)
push hl
ld l, e
ld h, d
push af
push hl
call GetSRAMBank
ld de, $c608
ld bc, $1e0
call CopyBytes
call CloseSRAM
ld a, $1
call GetSRAMBank
ld hl, $c608
ld de, $ad10
ld bc, $1e0
call CopyBytes
call CloseSRAM
pop hl
pop af
ld de, $1e0
add hl, de
push af
push hl
call GetSRAMBank
ld de, $c608
ld bc, $1e0
call CopyBytes
call CloseSRAM
ld a, $1
call GetSRAMBank
ld hl, $c608
ld de, $aef0
ld bc, $1e0
call CopyBytes
call CloseSRAM
pop hl
pop af
ld de, $1e0
add hl, de
call GetSRAMBank
ld de, $c608
ld bc, $8e
call CopyBytes
call CloseSRAM
ld a, $1
call GetSRAMBank
ld hl, $c608
ld de, $b0d0
ld bc, $8e
call CopyBytes
call CloseSRAM
pop hl
ret
Function151fb: ; 151fb
ld hl, Unknown_1522d
ld c, $e
.asm_15200
push bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
xor a
ld [de], a
inc de
ld a, $ff
ld [de], a
inc de
ld bc, $044c
.asm_15213
xor a
ld [de], a
inc de
dec bc
ld a, b
or c
jr nz, .asm_15213
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, $ff
ld [de], a
inc de
xor a
ld [de], a
call CloseSRAM
pop bc
dec c
jr nz, .asm_15200
ret
; 1522d
Unknown_1522d: ; 1522d
; dbww bank, address, address
db $02, $00, $a0, $4e, $a4 ; 2, $a000, $a44e
db $02, $50, $a4, $9e, $a8 ; 2, $a450, $a89e
db $02, $a0, $a8, $ee, $ac ; 2, $a8a0, $acee
db $02, $f0, $ac, $3e, $b1 ; 2, $acf0, $b13e
db $02, $40, $b1, $8e, $b5 ; 2, $b140, $b5de
db $02, $90, $b5, $de, $b9 ; 2, $b590, $b9de
db $02, $e0, $b9, $2e, $be ; 2, $b9e0, $be2e
db $03, $00, $a0, $4e, $a4 ; 3, $a000, $a44e
db $03, $50, $a4, $9e, $a8 ; 3, $a450, $a89e
db $03, $a0, $a8, $ee, $ac ; 3, $a8a0, $acee
db $03, $f0, $ac, $3e, $b1 ; 3, $acf0, $b13e
db $03, $40, $b1, $8e, $b5 ; 3, $b140, $b58e
db $03, $90, $b5, $de, $b9 ; 3, $b590, $b9de
db $03, $e0, $b9, $2e, $be ; 3, $b9e0, $be2e
; 15273
Function15273: ; 15273
ld de, $0000
.asm_15276
ld a, [hli]
add e
ld e, a
ld a, $0
adc d
ld d, a
dec bc
ld a, b
or c
jr nz, .asm_15276
ret
; 15283
UnknownText_0x15283: ; 0x15283
; Would you like to save the game?
text_jump UnknownText_0x1c454b
db "@"
; 0x15288
UnknownText_0x15288: ; 0x15288
; SAVING… DON'T TURN OFF THE POWER.
text_jump UnknownText_0x1c456d
db "@"
; 0x1528d
UnknownText_0x1528d: ; 0x1528d
; saved the game.
text_jump UnknownText_0x1c4590
db "@"
; 0x15292
UnknownText_0x15292: ; 0x15292
; There is already a save file. Is it OK to overwrite?
text_jump UnknownText_0x1c45a3
db "@"
; 0x15297
UnknownText_0x15297: ; 0x15297
; There is another save file. Is it OK to overwrite?
text_jump UnknownText_0x1c45d9
db "@"
; 0x1529c
UnknownText_0x1529c: ; 0x1529c
; The save file is corrupted!
text_jump UnknownText_0x1c460d
db "@"
; 0x152a1
UnknownText_0x152a1: ; 0x152a1
; When you change a #MON BOX, data will be saved. OK?
text_jump UnknownText_0x1c462a
db "@"
; 0x152a6
UnknownText_0x152a6: ; 0x152a6
; Each time you move a #MON, data will be saved. OK?
text_jump UnknownText_0x1c465f
db "@"
; 0x152ab
SpawnPoints: ; 0x152ab
const_def
spawn: MACRO
; name, map, y, x
\1\@ EQUS "SPAWN_\1"
const \1\@
map \2
db \3, \4
ENDM
spawn HOME, KRISS_HOUSE_2F, 3, 3
spawn DEBUG, VIRIDIAN_POKECENTER_1F, 5, 3
spawn PALLET, PALLET_TOWN, 5, 6
spawn VIRIDIAN, VIRIDIAN_CITY, 23, 26
spawn PEWTER, PEWTER_CITY, 13, 26
spawn CERULEAN, CERULEAN_CITY, 19, 22
spawn ROCK_TUNNEL, ROUTE_10A, 11, 2
spawn VERMILION, VERMILION_CITY, 9, 6
spawn LAVENDER, LAVENDER_TOWN, 5, 6
spawn SAFFRON, SAFFRON_CITY, 9, 30
spawn CELADON, CELADON_CITY, 29, 10
spawn FUCHSIA, FUCHSIA_CITY, 19, 28
spawn CINNABAR, CINNABAR_ISLAND, 11, 12
spawn INDIGO, ROUTE_23, 9, 6
spawn NEW_BARK, NEW_BARK_TOWN, 13, 6
spawn CHERRYGROVE, CHERRYGROVE_CITY, 29, 4
spawn VIOLET, VIOLET_CITY, 31, 26
spawn UNION_CAVE, ROUTE_32, 11, 74
spawn AZALEA, AZALEA_TOWN, 15, 10
spawn CIANWOOD, CIANWOOD_CITY, 23, 44
spawn GOLDENROD, GOLDENROD_CITY, 15, 28
spawn OLIVINE, OLIVINE_CITY, 13, 22
spawn ECRUTEAK, ECRUTEAK_CITY, 23, 28
spawn MAHOGANY, MAHOGANY_TOWN, 15, 14
spawn LAKE, LAKE_OF_RAGE, 21, 29
spawn BLACKTHORN, BLACKTHORN_CITY, 21, 30
spawn MT_SILVER, SILVER_CAVE_OUTSIDE, 23, 20
spawn FAST_SHIP, FAST_SHIP_CABINS_SW_SSW_NW, 6, 2
db -1, -1, -1, -1
const NUM_SPAWNS
LoadSpawnPoint: ; 1531f
push hl
push de
ld a, [$d001]
cp -1
jr z, .asm_15341
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld de, SpawnPoints
add hl, de
ld a, [hli]
ld [MapGroup], a
ld a, [hli]
ld [MapNumber], a
ld a, [hli]
ld [XCoord], a
ld a, [hli]
ld [YCoord], a
.asm_15341
pop de
pop hl
ret
; 15344
IsSpawnPoint: ; 15344
ld hl, SpawnPoints
ld c, 0
.asm_15349
ld a, [hl]
cp -1
jr z, .asm_1535f
cp d
jr nz, .asm_15356
inc hl
ld a, [hld]
cp e
jr z, .asm_15361
.asm_15356
push bc
ld bc, 4
add hl, bc
pop bc
inc c
jr .asm_15349
.asm_1535f
and a
ret
.asm_15361
scf
ret
; 15363
RunMapSetupScript:: ; 15363
ld a, [$ff9f]
and $f
dec a
ld c, a
ld b, 0
ld hl, MapSetupScripts
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
call ReadMapSetupScript
ret
; 15377
MapSetupScripts: ; 15377
dw MapSetupScript1
dw MapSetupScript2
dw MapSetupScript3
dw MapSetupScript4
dw MapSetupScript5
dw MapSetupScript6
dw MapSetupScript7
dw MapSetupScript8
dw MapSetupScript9
dw MapSetupScript10
dw MapSetupScript11
dw MapSetupScript12
; 1538f
; Command descriptions from Condensation water's scripting compendium.
const_def
const map_lcd_on ; 00 = Turn LCD on
const map_lcd_off ; 01 = Turn LCD off
const map_sound_off ; 02 = Turn speakers off
const map_music ; 03 = Music check for current map/ special check for bug catcher contest
const map_start_music ; 04 = Start map music anew
const map_fade_music ; 05 = Music check for current map / special check for Bug Contest/ music with FadeOut (old) and FadeIn
const map_fade ; 06 = Fade out music + screen
const map_bike_music ; 07 = If HIRO is on bike = bike music, else play map music
const map_music_force ; 08 = Play map music
const map_max_volume ; 09 = Turn music to highest volume
const map_load_blocks ; 0A = Write map data to MapRAM
const map_connection_blocks ; 0B = Compute maps connection pars and write into MapRAM
const map_save_screen ; 0C = Write current part of map into temporary memory
const map_buffer_screen ; 0D = Write current part of map into read-from memory
const map_load_graphics ; 0E = Write tileset header to ram/ load tileset/ load sprite tiles/ load special tiles
const map_load_tileset_header ; 0F = Write tileset header to ram
const map_time_of_day ; 10 = Compute time of day/ Update screen
const map_palettes ; 11 = Load map palettes
const map_wildmons ; 12 = Load probabilities for wild Pokémon battles
const map_sprites ; 13 = Delete sprite data and draw new sprites
const map_change_callback ; 14 = Check 2nd script header for 05 and 03 callbacks
const map_start_callback ; 15 = Check 2nd script header for 03 callbacks
const map_load_objects ; 16 = Analyze people data anew and check 2nd script header for 02 callbacks
const map_load_spawn ; 17 = Writes arrival data for arrival by flying/Blackout from table 05:5319 to ram
const map_load_connection ; 18 = Writes arrival data for entering a map by connection to ram
const map_load_warp ; 19 = Write warp data to ram when entering warp
const map_attributes ; 1A = Load complete map data (primary, secondary, event, script headers)
const map_attributes_2 ; 1B = Same as 1A, but some settings arent loaded new from the rom, such as hide function of the people events
const map_clear_bg_palettes ; 1C = Fill palette data with FFFF (=white)
const map_fade_out_palettes ; 1D = All BG pallet color are converted to 0|0 (Pal0, Col0), all sprite colors to x|0 (FadeOut)
const map_fade_in_palettes ; 1E = Palette FadeIn
const map_anchor_screen ; 1F = Compute position of upper left-most block visible on screen
const map_warp_face ; 20 = Position computation when HIRO leaves a warp
const map_face_down ; 21 = Set HIROs facing to “down”
const map_spawn_coord ; 22 = Prepare HIRO data for arrival by flight
const map_player_coord ; 23 = Compute HIRO x/y data anew
const map_prolong_sprites ; 24 = Prolong old sprites before removing them
const map_delay_sprites ; 25 = Delay rendering new sprites
const map_update_roam ; 26 = Compute chances to meet Raikou, Entei or Suicune
const map_keep_roam ; 27 = Recover chances to meet Raikou, Entei or Suicune
const map_fade_out_music ; 28 = Temporarily stop music playing
const map_animations_on ; 29 = Activate animations
const map_animations_off ; 2A = Deactivate animations
const map_keep_palettes ; 2B = Recover all palettes
const map_text_scroll_off ; 2C = Turn off text scroll (for town name overlays)
const map_stop_script ; 2D = Deactivate code prolonging
MapSetupScript4: ; 1538f
db map_prolong_sprites
MapSetupScript12: ; 15390
db map_fade_out_palettes
db map_keep_roam
MapSetupScript1: ; 15392
db map_lcd_off
db map_sound_off
db map_load_spawn
db map_attributes
db map_change_callback
db map_spawn_coord
db map_player_coord
db map_anchor_screen
db map_load_blocks
db map_buffer_screen
db map_load_graphics
db map_time_of_day
db map_load_objects
db map_lcd_on
db map_palettes
db map_face_down
db map_sprites
db map_bike_music
db map_max_volume
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
MapSetupScript11: ; 153a9
db map_load_spawn
db map_attributes
db map_change_callback
db map_spawn_coord
db map_player_coord
db map_anchor_screen
db map_load_blocks
db map_buffer_screen
db map_lcd_off
db map_load_graphics
db map_time_of_day
db map_fade_out_music
db map_lcd_on
db map_load_objects
db map_palettes
db map_face_down
db map_sprites
db map_fade_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
MapSetupScript7: ; 153bf
db map_animations_off
db map_load_connection
db map_attributes
db map_change_callback
db map_player_coord
db map_load_blocks
db map_load_tileset_header
db map_save_screen
db map_load_objects
db map_fade_music
db map_palettes
db map_stop_script
db map_keep_palettes
db map_wildmons
db map_update_roam
db map_animations_on
db -1
MapSetupScript6: ; 153d0
db map_prolong_sprites
MapSetupScript5: ; 153d1
db map_fade_out_palettes
MapSetupScript9: ; 153d2
db map_load_warp
db map_attributes
db map_warp_face
db map_change_callback
db map_player_coord
db map_load_blocks
db map_buffer_screen
db map_lcd_off
db map_load_graphics
db map_time_of_day
db map_fade_out_music
db map_lcd_on
db map_load_objects
db map_palettes
db map_sprites
db map_fade_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db map_update_roam
db -1
MapSetupScript3: ; 153e7
db map_fade
db map_clear_bg_palettes
db map_lcd_off
db map_sound_off
db map_load_blocks
db map_connection_blocks
db map_load_graphics
db map_time_of_day
db map_lcd_on
db map_palettes
db map_sprites
db map_music_force
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
MapSetupScript8: ; 153f7
db map_fade
db map_lcd_off
db map_sound_off
db map_change_callback
db map_load_blocks
db map_buffer_screen
db map_load_graphics
db map_time_of_day
db map_lcd_on
db map_palettes
db map_sprites
db map_bike_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db map_text_scroll_off
db -1
MapSetupScript2: ; 15408
db map_lcd_off
db map_sound_off
db map_attributes_2
db map_anchor_screen
db map_start_callback
db map_load_blocks
db map_connection_blocks
db map_buffer_screen
db map_load_graphics
db map_time_of_day
db map_lcd_on
db map_palettes
db map_sprites
db map_bike_music
db map_fade_in_palettes
db map_animations_on
db map_wildmons
db -1
MapSetupScript10: ; 1541a
db map_load_blocks
db map_connection_blocks
db -1
ReadMapSetupScript: ; 1541d
.loop
ld a, [hli]
cp -1
ret z
push hl
ld c, a
ld b, 0
ld hl, MapSetupCommands
add hl, bc
add hl, bc
add hl, bc
; bank
ld b, [hl]
inc hl
; address
ld a, [hli]
ld h, [hl]
ld l, a
; Bit 7 of the bank indicates a parameter.
; This is left unused.
bit 7, b
jr z, .go
pop de
ld a, [de]
ld c, a
inc de
push de
.go
ld a, b
and $7f
rst FarCall
pop hl
jr .loop
; 15440
MapSetupCommands: ; 15440
dbw BANK(EnableLCD), EnableLCD
dbw BANK(DisableLCD), DisableLCD
dbw BANK(SoundRestart), SoundRestart
dbw BANK(PlayMapMusic), PlayMapMusic
dbw BANK(RestartMapMusic), RestartMapMusic
dbw BANK(FadeToMapMusic), FadeToMapMusic
dbw BANK(Function15574), Function15574
dbw BANK(EnterMapMusic), EnterMapMusic
dbw BANK(Function15587), Function15587
dbw BANK(Function3cae), Function3cae
dbw BANK(Function24cd), Function24cd
dbw BANK(Function28e3), Function28e3
dbw BANK(Function289d), Function289d
dbw BANK(Function2879), Function2879
dbw BANK(Function1047cf), Function1047cf
dbw BANK(LoadTilesetHeader), LoadTilesetHeader
dbw BANK(Function104750), Function104750
dbw BANK(Function1047eb), Function1047eb
dbw BANK(Function29ff8), Function29ff8
dbw BANK(Function1047f0), Function1047f0
dbw BANK(Function1045b0), Function1045b0
dbw BANK(Function1045c4), Function1045c4
dbw BANK(Function154d7), Function154d7
dbw BANK(LoadSpawnPoint), LoadSpawnPoint
dbw BANK(EnterMapConnection), EnterMapConnection
dbw BANK(Function1046c6), Function1046c6
dbw BANK(Function2309), Function2309
dbw BANK(Function2317), Function2317
dbw BANK(WhiteBGMap), WhiteBGMap
dbw BANK(Function8c084), Function8c084
dbw BANK(Function8c079), Function8c079
dbw BANK(Function10486d), Function10486d
dbw BANK(Function248a), Function248a
dbw BANK(Function57d9), Function57d9
dbw BANK(Function8029), Function8029
dbw BANK(Function80b8), Function80b8
dbw BANK(Function154eb), Function154eb
dbw BANK(Function154f1), Function154f1
dbw BANK(Function2a30d), Function2a30d
dbw BANK(Function2a394), Function2a394
dbw BANK(Function15567), Function15567
dbw BANK(Function154cf), Function154cf
dbw BANK(Function154d3), Function154d3
dbw BANK(Function1556d), Function1556d
dbw BANK(Function154ca), Function154ca
dbw BANK(Functionb8000), Functionb8000
; 154ca
Function154ca: ; 154ca
xor a
ld [$c2d7], a
ret
; 154cf
Function154cf: ; 154cf
ld a, $1
ld [$ffde], a
ret
; 154d3
Function154d3: ; 154d3
xor a
ld [$ffde], a
ret
; 154d7
Function154d7: ; 154d7
ld a, $2
call Function263b
callba Function2454f
callba Function8177
ret
; 154ea (5:54ea)
Function154ea: ; 154ea
ret
; 154eb
Function154eb: ; 154eb
ld hl, $d45b
set 7, [hl]
ret
; 154f1
Function154f1: ; 154f1
ld hl, $d45b
set 6, [hl]
ret
Function154f7: ; 154f7
nop
call Function1550c
jr c, .asm_15508
call Function1554e
jr c, .asm_15508
call Function1551a
jr c, .asm_15508
ret
.asm_15508
call Functione4a
ret
Function1550c: ; 1550c (5:550c)
and a
ld hl, BikeFlags ; $dbf5
bit 1, [hl]
ret z
ld a, $1
ld [PlayerState], a ; $d95d
scf
ret
Function1551a: ; 1551a (5:551a)
ld a, [PlayerState] ; $d95d
cp $0
jr z, .asm_1554c
cp $2
jr z, .asm_1554c
cp $4
jr z, .asm_15545
cp $8
jr z, .asm_15545
call GetMapPermission
cp $3
jr z, .asm_1553e
cp $5
jr z, .asm_1553e
cp $7
jr z, .asm_1553e
jr .asm_1554c
.asm_1553e
ld a, [PlayerState] ; $d95d
cp $1
jr nz, .asm_1554c
.asm_15545
ld a, $0
ld [PlayerState], a ; $d95d
scf
ret
.asm_1554c
and a
ret
Function1554e: ; 1554e (5:554e)
call Function1852
jr nz, .asm_15565
ld a, [PlayerState] ; $d95d
cp $4
jr z, .asm_15563
cp $8
jr z, .asm_15563
ld a, $4
ld [PlayerState], a ; $d95d
.asm_15563
scf
ret
.asm_15565
and a
ret
; 15567
Function15567: ; 15567
ld a, 6
call SkipMusic
ret
; 1556d
Function1556d: ; 1556d
callba _UpdateTimePals
ret
Function15574: ; 15574
ld e, 0
ld a, [MusicFadeIDLo] ; $c2a9
ld d, 0
ld a, [MusicFadeIDHi] ; $c2aa
ld a, $4
ld [MusicFade], a ; $c2a7
call Function4b6
ret
; 15587
Function15587: ; 15587
ld a, [PlayerState] ; $d95d
cp $1
jr nz, .asm_15596
call VolumeOff
ld a, $88
ld [MusicFade], a ; $c2a7
.asm_15596
call Function3d2f
ret
; 1559a
Function1559a: ; 1559a
call Function15650
ret c
call Function156b3
ld hl, UnknownText_0x15a27
call Function15a20
ld hl, UnknownText_0x15a2c
call Function157bb
ld hl, MenuDataHeader_0x155d6
call LoadMenuDataHeader
.asm_155b3
xor a
ld [hBGMapMode], a
call Function1563e
ld [$cf76], a
call Function1e5d
jr c, .asm_155cc
ld a, [MenuSelection]
ld hl, Unknown_155e6
call Function1fa7
jr nc, .asm_155b3
.asm_155cc
call Function156b8
call Function1c07
call Function1c17
ret
; 155d6
MenuDataHeader_0x155d6: ; 0x155d6
db $48 ; flags
db 00, 00 ; start coords
db 12, 15 ; end coords
dw MenuData2_0x155de
db 1 ; default option
; 0x155de
MenuData2_0x155de: ; 0x155de
db $a0 ; flags
db 0 ; items
dw Unknown_1562c
dw Function1f8d
dw Unknown_155e6
; 0x155e6
Unknown_155e6: ; 155e6
dw Function15679, String_155fa
dw Function15668, String_15600
dw Function15689, String_15609
dw Function1569a, String_15616
dw Function156ab, String_15623
; 155fa
String_155fa: db $52, "'s PC@"
String_15600: db "BILL's PC@"
String_15609: db "PROF.OAK's PC@"
String_15616: db "HALL OF FAME@"
String_15623: db "TURN OFF@"
; 1562c
Unknown_1562c: ; 1562c
db 3
db 1, 0, 4, $ff
db 4
db 1, 0, 2, 4, $ff
db 5
db 1, 0, 2, 3, 4, $ff
; 1563e
Function1563e: ; 1563e
call Function2ead
jr nz, .asm_15646
ld a, $0
ret
.asm_15646
ld a, [$d95e]
and a
ld a, $1
ret z
ld a, $2
ret
; 15650
Function15650: ; 15650
ld a, [PartyCount]
and a
ret nz
ld de, SFX_CHOOSE_PC_OPTION
call PlaySFX
ld hl, UnknownText_0x15663
call Function15a20
scf
ret
; 15663
UnknownText_0x15663: ; 0x15663
; Bzzzzt! You must have a #MON to use this!
text_jump UnknownText_0x1c1328
db "@"
; 0x15668
Function15668: ; 15668
call Function156c2
ld hl, UnknownText_0x15a31
call Function15a20
callba Functione3fd
and a
ret
; 15679 (5:5679)
Function15679: ; 15679
call Function156c2
ld hl, UnknownText_0x15a36
call Function15a20
ld b, $0
call Function15704
and a
ret
; 15689
Function15689: ; 15689
call Function156c2
ld hl, UnknownText_0x15a3b
call Function15a20
callba ProfOaksPC
and a
ret
; 1569a
Function1569a: ; 1569a
call Function156c2
call FadeToMenu
callba Function86650
call Function2b3c
and a
ret
; 156ab
Function156ab: ; 156ab
ld hl, UnknownText_0x15a40
call PrintText
scf
ret
; 156b3
Function156b3: ; 156b3
ld de, SFX_BOOT_PC
jr Function156d0
Function156b8: ; 156b8
ld de, SFX_SHUT_DOWN_PC
call Function156d0
call WaitSFX
ret
Function156c2: ; 156c2
ld de, SFX_CHOOSE_PC_OPTION
jr Function156d0
Function156c7: ; 156c7
ld de, SFX_SWITCH_POKEMON
call Function156d0
ld de, SFX_SWITCH_POKEMON
Function156d0: ; 156d0
push de
call WaitSFX
pop de
call PlaySFX
ret
; 156d9
Function156d9: ; 156d9
call Function156b3
ld hl, UnknownText_0x156ff
call Function15a20
ld b, $1
call Function15704
and a
jr nz, .asm_156f9
call Function2173
call Function321c
call Function1ad2
call Function156b8
ld c, $0
ret
.asm_156f9
call WhiteBGMap
ld c, $1
ret
; 156ff
UnknownText_0x156ff: ; 0x156ff
; turned on the PC.
text_jump UnknownText_0x1c1353
db "@"
; 0x15704
Function15704: ; 15704
ld a, b
ld [$cf76], a
ld hl, UnknownText_0x157cc
call Function157bb
call Function15715
call Function1c07
ret
; 15715
Function15715: ; 15715
xor a
ld [$d0d7], a
ld [$d0dd], a
ld hl, KrissPCMenuData
call LoadMenuDataHeader
.asm_15722
call UpdateTimePals
call Function1e5d
jr c, .asm_15731
call Function1fa7
jr nc, .asm_15722
jr .asm_15732
.asm_15731
xor a
.asm_15732
call Function1c07
ret
; 15736
KrissPCMenuData: ; 0x15736
db %01000000
db 0, 0 ; top left corner coords (y, x)
db 12, 15 ; bottom right corner coords (y, x)
dw .KrissPCMenuData2
db 1 ; default selected option
.KrissPCMenuData2
db %10100000 ; bit7
db 0 ; # items?
dw .KrissPCMenuList1
dw Function1f8d
dw .KrissPCMenuPointers
.KrissPCMenuPointers ; 0x15746
dw KrisWithdrawItemMenu, .WithdrawItem
dw KrisDepositItemMenu, .DepositItem
dw KrisTossItemMenu, .TossItem
dw KrisMailBoxMenu, .MailBox
dw KrisDecorationMenu, .Decoration
dw KrisLogOffMenu, .LogOff
dw KrisLogOffMenu, .TurnOff
.WithdrawItem db "WITHDRAW ITEM@"
.DepositItem db "DEPOSIT ITEM@"
.TossItem db "TOSS ITEM@"
.MailBox db "MAIL BOX@"
.Decoration db "DECORATION@"
.TurnOff db "TURN OFF@"
.LogOff db "LOG OFF@"
WITHDRAW_ITEM EQU 0
DEPOSIT_ITEM EQU 1
TOSS_ITEM EQU 2
MAIL_BOX EQU 3
DECORATION EQU 4
TURN_OFF EQU 5
LOG_OFF EQU 6
.KrissPCMenuList1
db 5
db WITHDRAW_ITEM
db DEPOSIT_ITEM
db TOSS_ITEM
db MAIL_BOX
db TURN_OFF
db $ff
.KrissPCMenuList2
db 6
db WITHDRAW_ITEM
db DEPOSIT_ITEM
db TOSS_ITEM
db MAIL_BOX
db DECORATION
db LOG_OFF
db $ff
Function157bb: ; 157bb
ld a, [Options]
push af
set 4, a
ld [Options], a
call Function1d4f
pop af
ld [Options], a
ret
; 157cc
UnknownText_0x157cc: ; 0x157cc
; What do you want to do?
text_jump UnknownText_0x1c1368
db "@"
; 0x157d1
KrisWithdrawItemMenu: ; 0x157d1
call Function1d6e
callba ClearPCItemScreen
.asm_157da
call Function15985
jr c, .asm_157e4
call Function157e9
jr .asm_157da
.asm_157e4
call Function2b3c
xor a
ret
; 0x157e9
Function157e9: ; 0x157e9
; check if the item has a quantity
callba _CheckTossableItem
ld a, [$d142]
and a
jr z, .askquantity
; items without quantity are always ×1
ld a, 1
ld [$d10c], a
jr .withdraw
.askquantity
ld hl, .HowManyText
call Function1d4f
callba Function24fbf
call Function1c07
call Function1c07
jr c, .done
.withdraw
ld a, [$d10c]
ld [Buffer1], a ; quantity
ld a, [$d107]
ld [Buffer2], a
ld hl, NumItems
call ReceiveItem
jr nc, .PackFull
ld a, [Buffer1]
ld [$d10c], a
ld a, [Buffer2]
ld [$d107], a
ld hl, PCItems
call TossItem
predef PartyMonItemName
ld hl, .WithdrewText
call Function1d4f
xor a
ld [hBGMapMode], a
call Function1c07
ret
.PackFull
ld hl, .NoRoomText
call Function1d67
ret
.done
ret
; 0x15850
.HowManyText ; 0x15850
TX_FAR _KrissPCHowManyWithdrawText
db "@"
.WithdrewText ; 0x15855
TX_FAR _KrissPCWithdrewItemsText
db "@"
.NoRoomText ; 0x1585a
TX_FAR _KrissPCNoRoomWithdrawText
db "@"
KrisTossItemMenu: ; 0x1585f
call Function1d6e
callba ClearPCItemScreen
.asm_15868
call Function15985
jr c, .asm_15878
ld de, PCItems
callba Function129f4
jr .asm_15868
.asm_15878
call Function2b3c
xor a
ret
; 0x1587d
KrisDecorationMenu: ; 0x1587d
callba _KrisDecorationMenu
ld a, c
and a
ret z
scf
ret
; 0x15888
KrisLogOffMenu: ; 0x15888
xor a
scf
ret
; 0x1588b
KrisDepositItemMenu: ; 0x1588b
call Function158b8
jr c, .asm_158b6
call Function2ed3
call Function1d6e
callba Function106a5
.asm_1589c
callba Function106be
ld a, [$cf66]
and a
jr z, .asm_158b3
call Function158cc
callba CheckRegisteredItem
jr .asm_1589c
.asm_158b3
call Function2b3c
.asm_158b6
xor a
ret
; 0x158b8
Function158b8: ; 0x158b8
callba Function129d5
ret nc
ld hl, UnknownText_0x158c7
call Function1d67
scf
ret
; 0x158c7
UnknownText_0x158c7: ; 0x158c7
; No items here!
text_jump UnknownText_0x1c13df
db "@"
; 0x158cc
Function158cc: ; 0x158cc
ld a, [$c2ce]
push af
ld a, $0
ld [$c2ce], a
callba CheckItemMenu
ld a, [$d142]
ld hl, Jumptable_158e7
rst JumpTable
pop af
ld [$c2ce], a
ret
; 0x158e7
Jumptable_158e7: ; 0x158e7
dw .jump2
dw .jump1
dw .jump1
dw .jump1
dw .jump2
dw .jump2
dw .jump2
.jump1:
ret
.jump2:
ld a, [Buffer1]
push af
ld a, [Buffer2]
push af
call Function1590a
pop af
ld [Buffer2], a
pop af
ld [Buffer1], a
ret
; 0x1590a
Function1590a: ; 0x1590a
callba _CheckTossableItem
ld a, [$d142]
and a
jr z, .asm_1591d
ld a, $1
ld [$d10c], a
jr .asm_15933
.asm_1591d
ld hl, .HowManyText
call Function1d4f
callba Function24fbf
push af
call Function1c07
call Function1c07
pop af
jr c, .asm_1596c
.asm_15933
ld a, [$d10c]
ld [Buffer1], a
ld a, [$d107]
ld [Buffer2], a
ld hl, PCItems
call ReceiveItem
jr nc, .asm_15965
ld a, [Buffer1]
ld [$d10c], a
ld a, [Buffer2]
ld [$d107], a
ld hl, NumItems
call TossItem
predef PartyMonItemName
ld hl, .DepositText
call PrintText
ret
.asm_15965
ld hl, .NoRoomText
call PrintText
ret
.asm_1596c
and a
ret
; 0x1596e
.HowManyText ; 0x1596e
TX_FAR _KrissPCHowManyDepositText
db "@"
.DepositText ; 0x15973
TX_FAR _KrissPCDepositItemsText
db "@"
.NoRoomText ; 0x15978
TX_FAR _KrissPCNoRoomDepositText
db "@"
KrisMailBoxMenu: ; 0x1597d
callba _KrisMailBoxMenu
xor a
ret
; 0x15985
Function15985: ; 0x15985
xor a
ld [$d0e3], a
.asm_15989
ld a, [$c2ce]
push af
ld a, $0
ld [$c2ce], a
ld hl, MenuData15a08
call Function1d3c
hlcoord 0, 0
ld b, $a
ld c, $12
call TextBox
ld a, [$d0d7]
ld [$cf88], a
ld a, [$d0dd]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0dd], a
ld a, [$cfa9]
ld [$d0d7], a
pop af
ld [$c2ce], a
ld a, [$d0e3]
and a
jr nz, .asm_159d8
ld a, [$cf73]
cp $2
jr z, .asm_15a06
cp $1
jr z, .asm_159fb
cp $4
jr z, .asm_159f2
jr .asm_159f8
.asm_159d8
ld a, [$cf73]
cp $2
jr z, .asm_159e9
cp $1
jr z, .asm_159ef
cp $4
jr z, .asm_159ef
jr .asm_159f8
.asm_159e9
xor a
ld [$d0e3], a
jr .asm_159f8
.asm_159ef
call Function156c7
.asm_159f2
callba Function2490c
.asm_159f8
jp .asm_15989
.asm_159fb
callba Function24706
call Function1bee
and a
ret
.asm_15a06
scf
ret
; 0x15a08
MenuData15a08: ; 0x15a08
db %01000000
db 1, 4 ; start coords
db 10, 18 ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2
db %10110000
db 4, 8 ; rows/cols?
db 2 ; horizontal spacing?
dbw 0, PCItems
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function24ac3), Function24ac3
dbw BANK(Function244c3), Function244c3
Function15a20: ; 15a20
call Function1d4f
call Function1c07
ret
; 15a27
UnknownText_0x15a27: ; 0x15a27
; turned on the PC.
text_jump UnknownText_0x1c144d
db "@"
; 0x15a2c
UnknownText_0x15a2c: ; 0x15a2c
; Access whose PC?
text_jump UnknownText_0x1c1462
db "@"
; 0x15a31
UnknownText_0x15a31: ; 0x15a31
; BILL's PC accessed. #MON Storage System opened.
text_jump UnknownText_0x1c1474
db "@"
; 0x15a36
UnknownText_0x15a36: ; 0x15a36
; Accessed own PC. Item Storage System opened.
text_jump UnknownText_0x1c14a4
db "@"
; 0x15a3b
UnknownText_0x15a3b: ; 0x15a3b
; PROF.OAK's PC accessed. #DEX Rating System opened.
text_jump UnknownText_0x1c14d2
db "@"
; 0x15a40
UnknownText_0x15a40: ; 0x15a40
; … Link closed…
text_jump UnknownText_0x1c1505
db "@"
; 0x15a45
OpenMartDialog:: ; 15a45
call GetMart
ld a, c
ld [EngineBuffer1], a
call Function15b10
ld a, [EngineBuffer1]
ld hl, .dialogs
rst JumpTable
ret
; 15a57
.dialogs
dw MartDialog
dw HerbShop
dw BargainShop
dw Pharmacist
dw VendingMachine
; 15a61
MartDialog: ; 15a61
ld a, 0
ld [EngineBuffer1], a
xor a
ld [MovementAnimation], a
call Function15b47
ret
; 15a6e
HerbShop: ; 15a6e
call ReadMart
call Function1d6e
ld hl, UnknownText_0x15e4a
call Function15fcd
call Function15c62
ld hl, UnknownText_0x15e68
call Function15fcd
ret
; 15a84
BargainShop: ; 15a84
ld b, BANK(Unknown_15c51)
ld de, Unknown_15c51
call Function15b10
call Function15c25
call Function1d6e
ld hl, UnknownText_0x15e6d
call Function15fcd
call Function15c62
ld hl, WalkingDirection
ld a, [hli]
or [hl]
jr z, .asm_15aa7
ld hl, $dc1e
set 6, [hl]
.asm_15aa7
ld hl, UnknownText_0x15e8b
call Function15fcd
ret
; 15aae
Pharmacist: ; 15aae
call ReadMart
call Function1d6e
ld hl, UnknownText_0x15e90
call Function15fcd
call Function15c62
ld hl, UnknownText_0x15eae
call Function15fcd
ret
; 15ac4
VendingMachine: ; 15ac4
ld b, BANK(Unknown_15aee)
ld de, Unknown_15aee
ld hl, StatusFlags
bit 6, [hl]
jr z, .asm_15ad5
ld b, BANK(Unknown_15aff)
ld de, Unknown_15aff
.asm_15ad5
call Function15b10
call Function15c25
call Function1d6e
ld hl, UnknownText_0x15f83
call Function15fcd
call Function15c62
ld hl, UnknownText_0x15fb4
call Function15fcd
ret
; 15aee
Unknown_15aee: ; 15aee
db $05, $05, $96, $00, $04, $f4, $01, $11, $f4, $01, $26, $f4, $01, $27, $b0, $04, $ff
Unknown_15aff: ; 15aff
db $05, $10, $e8, $03, $0e, $d0, $07, $26, $f4, $01, $02, $e8, $03, $1b, $78, $1e, $ff
; 15b10
Function15b10: ; 15b10
ld a, b
ld [$d03f], a
ld a, e
ld [MartPointer], a
ld a, d
ld [MartPointer + 1], a
ld hl, CurMart
xor a
ld bc, CurMartEnd - CurMart
call ByteFill
xor a
ld [MovementAnimation], a
ld [WalkingDirection], a
ld [FacingDirection], a
ret
; 15b31
GetMart: ; 15b31
ld a, e
cp (MartsEnd - Marts) / 2
jr c, .IsAMart
ld b, $5
ld de, DefaultMart
ret
.IsAMart
ld hl, Marts
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld b, $5
ret
; 15b47
Function15b47: ; 15b47
.asm_15b47
ld a, [MovementAnimation]
ld hl, .table_15b56
rst JumpTable
ld [MovementAnimation], a
cp $ff
jr nz, .asm_15b47
ret
.table_15b56
dw Function15b62
dw Function15b6e
dw Function15b8d
dw Function15b9a
dw Function15ba3
dw Function15baf
; 15b62
Function15b62: ; 15b62
call Function1d6e
ld hl, UnknownText_0x15f83
call PrintText
ld a, $1
ret
; 15b6e
Function15b6e: ; 15b6e
ld hl, MenuDataHeader_0x15f88
call Function1d3c
call Function1d81
jr c, .asm_15b84
ld a, [$cfa9]
cp $1
jr z, .asm_15b87
cp $2
jr z, .asm_15b8a
.asm_15b84
ld a, $4
ret
.asm_15b87
ld a, $2
ret
.asm_15b8a
ld a, $3
ret
; 15b8d
Function15b8d: ; 15b8d
call Function1c07
call ReadMart
call Function15c62
and a
ld a, $5
ret
; 15b9a
Function15b9a: ; 15b9a
call Function1c07
call Function15eb3
ld a, $5
ret
; 15ba3
Function15ba3: ; 15ba3
call Function1c07
ld hl, UnknownText_0x15fb4
call Function15fcd
ld a, $ff
ret
; 15baf
Function15baf: ; 15baf
call Function1d6e
ld hl, UnknownText_0x15fb9
call PrintText
ld a, $1
ret
; 15bbb
ReadMart: ; 15bbb
ld hl, MartPointer
ld a, [hli]
ld h, [hl]
ld l, a
ld de, CurMart
.CopyMart
ld a, [$d03f]
call GetFarByte
ld [de], a
inc hl
inc de
cp $ff
jr nz, .CopyMart
ld hl, DefaultFlypoint
ld de, CurMart + 1
.ReadMartItem
ld a, [de]
inc de
cp $ff
jr z, .asm_15be4
push de
call GetMartItemPrice
pop de
jr .ReadMartItem
.asm_15be4
ret
; 15be5
GetMartItemPrice: ; 15be5
; Return the price of item a in BCD at hl and in tiles at StringBuffer1.
push hl
ld [CurItem], a
callba GetItemPrice
pop hl
GetMartPrice: ; 15bf0
; Return price de in BCD at hl and in tiles at StringBuffer1.
push hl
ld a, d
ld [StringBuffer2], a
ld a, e
ld [StringBuffer2 + 1], a
ld hl, StringBuffer1
ld de, StringBuffer2
ld bc, $82 << 8 + 6 ; 6 digits
call PrintNum
pop hl
ld de, StringBuffer1
ld c, 6 / 2 ; 6 digits
.asm_15c0b
call .TileToNum
swap a
ld b, a
call .TileToNum
or b
ld [hli], a
dec c
jr nz, .asm_15c0b
ret
; 15c1a
.TileToNum ; 15c1a
ld a, [de]
inc de
cp " "
jr nz, .asm_15c22
ld a, "0"
.asm_15c22
sub "0"
ret
; 15c25
Function15c25: ; 15c25
ld hl, MartPointer
ld a, [hli]
ld h, [hl]
ld l, a
push hl
inc hl
ld bc, $d002
ld de, CurMart + 1
.asm_15c33
ld a, [hli]
ld [de], a
inc de
cp $ff
jr z, .asm_15c4b
push de
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
ld h, b
ld l, c
call GetMartPrice
ld b, h
ld c, l
pop hl
pop de
jr .asm_15c33
.asm_15c4b
pop hl
ld a, [hl]
ld [CurMart], a
ret
; 15c51
Unknown_15c51: ; 15c51
db $05, $24, $94, $11, $6e, $8a, $02, $6f, $ac, $0d, $83, $84, $03, $84, $f8, $11, $ff
; 15c62
Function15c62: ; 15c62
call FadeToMenu
callba Function8000
xor a
ld [WalkingY], a
ld a, 1
ld [WalkingX], a
.asm_15c74
call Function15cef
jr nc, .asm_15c74
call Function2b3c
ret
; 15c7d
Function15c7d: ; 15c7d
push af
call Function15ca3
ld a, [hli]
ld h, [hl]
ld l, a
pop af
ld e, a
ld d, 0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call PrintText
ret
; 15c91
Function15c91: ; 15c91
call Function15ca3
inc hl
inc hl
ld a, [hl]
and a
jp z, Function15d83
cp 1
jp z, Function15da5
jp Function15de2
; 15ca3
Function15ca3: ; 15ca3
ld a, [EngineBuffer1]
ld e, a
ld d, 0
ld hl, .data_15cb0
add hl, de
add hl, de
add hl, de
ret
; 15cb0
.data_15cb0 ; 15cb0
dwb Unknown_15cbf, 0
dwb Unknown_15ccb, 0
dwb Unknown_15cd7, 1
dwb Unknown_15ce3, 0
dwb Unknown_15cbf, 2
; 15cbf
Unknown_15cbf: ; 15cbf
dw UnknownText_0x15e0e
dw UnknownText_0x15e13
dw UnknownText_0x15fa5
dw UnknownText_0x15faa
dw UnknownText_0x15fa0
dw Function15cef
Unknown_15ccb: ; 15ccb
dw UnknownText_0x15e4f
dw UnknownText_0x15e54
dw UnknownText_0x15e63
dw UnknownText_0x15e5e
dw UnknownText_0x15e59
dw Function15cef
Unknown_15cd7: ; 15cd7
dw Function15cef
dw UnknownText_0x15e72
dw UnknownText_0x15e86
dw UnknownText_0x15e7c
dw UnknownText_0x15e77
dw UnknownText_0x15e81
Unknown_15ce3: ; 15ce3
dw UnknownText_0x15e95
dw UnknownText_0x15e9a
dw UnknownText_0x15ea9
dw UnknownText_0x15ea4
dw UnknownText_0x15e9f
dw Function15cef
; 15cef
Function15cef: ; 15cef
callba Function24ae8
call Function1ad2
ld hl, MenuDataHeader_0x15e18
call Function1d3c
ld a, [WalkingX]
ld [$cf88], a
ld a, [WalkingY]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [WalkingY], a
ld a, [$cfa9]
ld [WalkingX], a
call SpeechTextBox
ld a, [$cf73]
cp $2
jr z, .asm_15d6d
cp $1
jr z, .asm_15d27
.asm_15d27
call Function15c91
jr c, .asm_15d68
call Function15d97
jr c, .asm_15d68
ld de, Money
ld bc, $ffc3
ld a, $3
call Function1600b
jr c, .asm_15d79
ld hl, NumItems
call ReceiveItem
jr nc, .asm_15d6f
ld a, [$d107]
ld e, a
ld d, $0
ld b, $1
ld hl, WalkingDirection
call FlagAction
call Function15fc3
ld de, Money
ld bc, $ffc3
call Function15ffa
ld a, $4
call Function15c7d
call Functiona36
.asm_15d68
call SpeechTextBox
and a
ret
.asm_15d6d
scf
ret
.asm_15d6f
ld a, $3
call Function15c7d
call Functiona36
and a
ret
.asm_15d79
ld a, $2
call Function15c7d
call Functiona36
and a
ret
; 15d83
Function15d83: ; 15d83
ld a, $63
ld [$d10d], a
ld a, $0
call Function15c7d
callba Function24fc9
call Function1c07
ret
; 15d97
Function15d97: ; 15d97
predef PartyMonItemName
ld a, $1
call Function15c7d
call YesNoBox
ret
; 15da5
Function15da5: ; 15da5
ld a, $1
ld [$d10c], a
ld a, [$d107]
ld e, a
ld d, $0
ld b, $2
ld hl, WalkingDirection
call FlagAction
ld a, c
and a
jr nz, .asm_15dd8
ld a, [$d107]
ld e, a
ld d, $0
ld hl, $d040
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
add hl, de
add hl, de
add hl, de
inc hl
ld a, [hli]
ld [$ffc5], a
ld a, [hl]
ld [$ffc4], a
xor a
ld [$ffc3], a
and a
ret
.asm_15dd8
ld a, $5
call Function15c7d
call Functiona36
scf
ret
; 15de2
Function15de2: ; 15de2
ld a, $0
call Function15c7d
call Function15df9
ld a, $63
ld [$d10d], a
callba Function24fcf
call Function1c07
ret
; 15df9
Function15df9: ; 15df9
ld a, [$d107]
ld e, a
ld d, 0
ld hl, $d040
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
add hl, de
add hl, de
add hl, de
inc hl
ld e, [hl]
inc hl
ld d, [hl]
ret
; 15e0e
UnknownText_0x15e0e: ; 0x15e0e
; How many?
text_jump UnknownText_0x1c4bfd
db "@"
; 0x15e13
UnknownText_0x15e13: ; 0x15e13
; @ (S) will be ¥@ .
text_jump UnknownText_0x1c4c08
db "@"
; 0x15e18
MenuDataHeader_0x15e18: ; 0x15e18
db $40 ; flags
db 03, 01 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x15e20
db 1 ; default option
; 0x15e20
MenuData2_0x15e20: ; 0x15e20
db $30 ; flags
db 4, 8 ; rows, columns
db 1 ; horizontal spacing
dbw 0, $d0f0
dbw BANK(Function24ab4), Function24ab4
dbw BANK(Function15e30), Function15e30
dbw BANK(Function244c3), Function244c3
; 15e30
Function15e30: ; 15e30
ld a, [$cf77]
ld c, a
ld b, 0
ld hl, DefaultFlypoint ; $d002
add hl, bc
add hl, bc
add hl, bc
push de
ld d, h
ld e, l
pop hl
ld bc, $14
add hl, bc
ld c, $a3
call PrintBCDNumber
ret
; 15e4a (5:5e4a)
UnknownText_0x15e4a: ; 0x15e4a
; Hello, dear. I sell inexpensive herbal medicine. They're good, but a trifle bitter. Your #MON may not like them. Hehehehe…
text_jump UnknownText_0x1c4c28
db "@"
; 0x15e4f
UnknownText_0x15e4f: ; 0x15e4f
; How many?
text_jump UnknownText_0x1c4ca3
db "@"
; 0x15e54
UnknownText_0x15e54: ; 0x15e54
; @ (S) will be ¥@ .
text_jump UnknownText_0x1c4cae
db "@"
; 0x15e59
UnknownText_0x15e59: ; 0x15e59
; Thank you, dear. Hehehehe…
text_jump UnknownText_0x1c4cce
db "@"
; 0x15e5e
UnknownText_0x15e5e: ; 0x15e5e
; Oh? Your PACK is full, dear.
text_jump UnknownText_0x1c4cea
db "@"
; 0x15e63
UnknownText_0x15e63: ; 0x15e63
; Hehehe… You don't have the money.
text_jump UnknownText_0x1c4d08
db "@"
; 0x15e68
UnknownText_0x15e68: ; 0x15e68
; Come again, dear. Hehehehe…
text_jump UnknownText_0x1c4d2a
db "@"
; 0x15e6d
UnknownText_0x15e6d: ; 0x15e6d
; Hiya! Care to see some bargains? I sell rare items that nobody else carries--but only one of each item.
text_jump UnknownText_0x1c4d47
db "@"
; 0x15e72
UnknownText_0x15e72: ; 0x15e72
; costs ¥@ . Want it?
text_jump UnknownText_0x1c4db0
db "@"
; 0x15e77
UnknownText_0x15e77: ; 0x15e77
; Thanks.
text_jump UnknownText_0x1c4dcd
db "@"
; 0x15e7c
UnknownText_0x15e7c: ; 0x15e7c
; Uh-oh, your PACK is chock-full.
text_jump UnknownText_0x1c4dd6
db "@"
; 0x15e81
UnknownText_0x15e81: ; 0x15e81
; You bought that already. I'm all sold out of it.
text_jump UnknownText_0x1c4df7
db "@"
; 0x15e86
UnknownText_0x15e86: ; 0x15e86
; Uh-oh, you're short on funds.
text_jump UnknownText_0x1c4e28
db "@"
; 0x15e8b
UnknownText_0x15e8b: ; 0x15e8b
; Come by again sometime.
text_jump UnknownText_0x1c4e46
db "@"
; 0x15e90
UnknownText_0x15e90: ; 0x15e90
; What's up? Need some medicine?
text_jump UnknownText_0x1c4e5f
db "@"
; 0x15e95
UnknownText_0x15e95: ; 0x15e95
; How many?
text_jump UnknownText_0x1c4e7e
db "@"
; 0x15e9a
UnknownText_0x15e9a: ; 0x15e9a
; @ (S) will cost ¥@ .
text_jump UnknownText_0x1c4e89
db "@"
; 0x15e9f
UnknownText_0x15e9f: ; 0x15e9f
; Thanks much!
text_jump UnknownText_0x1c4eab
db "@"
; 0x15ea4
UnknownText_0x15ea4: ; 0x15ea4
; You don't have any more space.
text_jump UnknownText_0x1c4eb9
db "@"
; 0x15ea9
UnknownText_0x15ea9: ; 0x15ea9
; Huh? That's not enough money.
text_jump UnknownText_0x1c4ed8
db "@"
; 0x15eae
UnknownText_0x15eae: ; 0x15eae
; All right. See you around.
text_jump UnknownText_0x1c4ef6
db "@"
; 0x15eb3
Function15eb3: ; 15eb3
call Function2ed3
callba Function106a5
.asm_15ebc
callba Function106be
ld a, [$cf66]
and a
jp z, Function15ece
call Function15ee0
jr .asm_15ebc
; 15ece
Function15ece: ; 15ece
call Function2b74
and a
ret
; 15ed3
Function15ed3: ; 15ed3
ld hl, UnknownText_0x15edb
call Function1d67
and a
ret
; 15edb
UnknownText_0x15edb: ; 0x15edb
; You don't have anything to sell.
text_jump UnknownText_0x1c4f12
db "@"
; 0x15ee0
Function15ee0: ; 15ee0
callba CheckItemMenu
ld a, [$d142]
ld hl, Jumptable_15eee
rst JumpTable
ret
; 15eee
Jumptable_15eee: ; 15eee
dw Function15efd
dw Function15efc
dw Function15efc
dw Function15efc
dw Function15efd
dw Function15efd
dw Function15efd
; 15efc
Function15efc: ; 15efc
ret
; 15efd
Function15efd: ; 15efd
callba _CheckTossableItem
ld a, [$d142]
and a
jr z, .asm_15f11
ld hl, UnknownText_0x15faf
call PrintText
and a
ret
.asm_15f11
ld hl, UnknownText_0x15f73
call PrintText
callba Function24af8
callba Function24fe1
call Function1c07
jr c, .asm_15f6e
hlcoord 1, 14
ld bc, $0312
call ClearBox
ld hl, UnknownText_0x15f78
call PrintTextBoxText
call YesNoBox
jr c, .asm_15f6e
ld de, Money
ld bc, $ffc3
call Function15fd7
ld a, [$d107]
ld hl, NumItems
call TossItem
predef PartyMonItemName
hlcoord 1, 14
ld bc, $0312
call ClearBox
ld hl, UnknownText_0x15fbe
call PrintTextBoxText
call Function15fc3
callba Function24af0
call Functiona36
.asm_15f6e
call Function1c07
and a
ret
; 15f73
UnknownText_0x15f73: ; 0x15f73
; How many?
text_jump UnknownText_0x1c4f33
db "@"
; 0x15f78
UnknownText_0x15f78: ; 0x15f78
; I can pay you ¥@ . Is that OK?
text_jump UnknownText_0x1c4f3e
db "@"
; 0x15f7d
String15f7d: ; 15f7d
db "!ダミー!@"
UnknownText_0x15f83: ; 0x15f83
; Welcome! How may I help you?
text_jump UnknownText_0x1c4f62
db "@"
; 0x15f88
MenuDataHeader_0x15f88: ; 0x15f88
db $40 ; flags
db 00, 00 ; start coords
db 08, 07 ; end coords
dw MenuData2_0x15f90
db 1 ; default option
; 0x15f90
MenuData2_0x15f90: ; 0x15f90
db $80 ; flags
db 3 ; items
db "BUY@"
db "SELL@"
db "QUIT@"
; 0x15f96
UnknownText_0x15fa0: ; 0x15fa0
; Here you are. Thank you!
text_jump UnknownText_0x1c4f80
db "@"
; 0x15fa5
UnknownText_0x15fa5: ; 0x15fa5
; You don't have enough money.
text_jump UnknownText_0x1c4f9a
db "@"
; 0x15faa
UnknownText_0x15faa: ; 0x15faa
; You can't carry any more items.
text_jump UnknownText_0x1c4fb7
db "@"
; 0x15faf
UnknownText_0x15faf: ; 0x15faf
; Sorry, I can't buy that from you.
text_jump UnknownText_0x1c4fd7
db "@"
; 0x15fb4
UnknownText_0x15fb4: ; 0x15fb4
; Please come again!
text_jump UnknownText_0x1c4ff9
db "@"
; 0x15fb9
UnknownText_0x15fb9: ; 0x15fb9
text_jump UnknownText_0x1c500d
db "@"
; 0x15fbe
UnknownText_0x15fbe: ; 0x15fbe
text_jump UnknownText_0x1c502e
db "@"
; 0x15fc3
Function15fc3: ; 15fc3
call WaitSFX
ld de, SFX_TRANSACTION
call PlaySFX
ret
; 15fcd
Function15fcd: ; 15fcd
call Function1d4f
call Functiona36
call Function1c07
ret
; 15fd7
Function15fd7:: ; 15fd7
ld a, $3
call Function16053
ld bc, Unknown_15ff7
ld a, $3
call Function1600b
jr z, .asm_15ff5
jr c, .asm_15ff5
ld hl, Unknown_15ff7
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
scf
ret
.asm_15ff5
and a
ret
; 15ff7
Unknown_15ff7: ; 15ff7
dt 999999
; 15ffa
Function15ffa:: ; 15ffa
ld a, $3
call Function16035
jr nc, .asm_16009
xor a
ld [de], a
inc de
ld [de], a
inc de
ld [de], a
scf
ret
.asm_16009
and a
ret
; 1600b
Function1600b:: ; 1600b
ld a, $3
Function1600d: ; 1600d
push hl
push de
push bc
ld h, b
ld l, c
ld c, $0
ld b, a
.asm_16015
dec a
jr z, .asm_1601c
inc de
inc hl
jr .asm_16015
.asm_1601c
and a
.asm_1601d
ld a, [de]
sbc [hl]
jr z, .asm_16022
inc c
.asm_16022
dec de
dec hl
dec b
jr nz, .asm_1601d
jr c, .asm_1602d
ld a, c
and a
jr .asm_16031
.asm_1602d
ld a, $1
and a
scf
.asm_16031
pop bc
pop de
pop hl
ret
; 16035
Function16035: ; 16035
ld a, $3
Function16037: ; 16037
push hl
push de
push bc
ld h, b
ld l, c
ld b, a
ld c, $0
.asm_1603f
dec a
jr z, .asm_16046
inc de
inc hl
jr .asm_1603f
.asm_16046
and a
.asm_16047
ld a, [de]
sbc [hl]
ld [de], a
dec de
dec hl
dec b
jr nz, .asm_16047
pop bc
pop de
pop hl
ret
; 16053
Function16053: ; 16053
ld a, $3
Function16055: ; 16055
push hl
push de
push bc
ld h, b
ld l, c
ld b, a
.asm_1605b
dec a
jr z, .asm_16062
inc de
inc hl
jr .asm_1605b
.asm_16062
and a
.asm_16063
ld a, [de]
adc [hl]
ld [de], a
dec de
dec hl
dec b
jr nz, .asm_16063
pop bc
pop de
pop hl
ret
; 1606f
Function1606f:: ; 1606f
ld a, $2
ld de, Coins
call Function16055
ld a, $2
ld bc, Unknown_1608d
call Function1600d
jr c, .asm_1608b
ld hl, Unknown_1608d
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
scf
ret
.asm_1608b
and a
ret
; 1608d
Unknown_1608d: ; 1608d
bigdw 9999
; 1608f
Function1608f:: ; 1608f
ld a, $2
ld de, Coins
call Function16037
jr nc, .asm_1609f
xor a
ld [de], a
inc de
ld [de], a
scf
ret
.asm_1609f
and a
ret
; 160a1
Function160a1:: ; 160a1
ld a, $2
ld de, Coins
jp Function1600d
; 160a9
INCLUDE "items/marts.asm"
Function16218: ; 16218
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
xor a
ld [$cf63], a
.asm_16223
ld a, [$cf63]
bit 7, a
jr nz, .asm_1622f
call Function16233
jr .asm_16223
.asm_1622f
pop af
ld [$ffaa], a
ret
; 16233
Function16233: ; 16233
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_16242
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 16242
Jumptable_16242: ; 16242
dw Function16254
dw Function1626a
dw Function16290
dw Function162a8
dw Function162e0
dw Function16373
dw Function16406
dw Function1642d
dw Function16433
; 16254
Function16254: ; 16254
ld a, [$d854]
bit 7, a
jr nz, .asm_16264
set 7, a
ld [$d854], a
ld a, $1
jr .asm_16266
.asm_16264
ld a, $2
.asm_16266
ld [$cf63], a
ret
; 1626a
Function1626a: ; 1626a
ld hl, UnknownText_0x16649
call PrintText
call YesNoBox
jr c, .asm_1627f
ld hl, UnknownText_0x1664e
call PrintText
ld a, $81
jr .asm_16281
.asm_1627f
ld a, $80
.asm_16281
ld [$d854], a
ld hl, UnknownText_0x16653
call PrintText
ld a, $8
ld [$cf63], a
ret
; 16290
Function16290: ; 16290
ld hl, UnknownText_0x16658
call PrintText
call YesNoBox
jr c, .asm_1629f
ld a, $3
jr .asm_162a4
.asm_1629f
call DSTChecks
ld a, $7
.asm_162a4
ld [$cf63], a
ret
; 162a8
Function162a8: ; 162a8
ld hl, UnknownText_0x1665d
call PrintText
call Function1d6e
ld hl, MenuDataHeader_0x166b5
call Function1d3c
call Function1d81
call Function1c17
jr c, .asm_162ce
ld a, [$cfa9]
cp $1
jr z, .asm_162d2
cp $2
jr z, .asm_162d6
cp $3
jr z, .asm_162da
.asm_162ce
ld a, $7
jr .asm_162dc
.asm_162d2
ld a, $5
jr .asm_162dc
.asm_162d6
ld a, $4
jr .asm_162dc
.asm_162da
ld a, $6
.asm_162dc
ld [$cf63], a
ret
; 162e0
Function162e0: ; 162e0
ld hl, UnknownText_0x16662
call PrintText
xor a
ld hl, StringBuffer2
ld [hli], a
ld [hli], a
ld [hl], a
ld a, $5
ld [$cf64], a
call Function1d6e
call Function16517
call Function1656b
call Function16571
call Function1c17
jr c, .asm_1636d
ld hl, StringBuffer2
ld a, [hli]
or [hl]
inc hl
or [hl]
jr z, .asm_1636d
ld de, Money
ld bc, StringBuffer2
callba Function1600b
jr c, .asm_1635f
ld hl, StringBuffer2
ld de, $d089
ld bc, $0003
call CopyBytes
ld bc, $d851
ld de, StringBuffer2
callba Function15fd7
jr c, .asm_16366
ld bc, $d089
ld de, Money
callba Function15ffa
ld hl, StringBuffer2
ld de, $d851
ld bc, $0003
call CopyBytes
ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
ld hl, UnknownText_0x1668a
call PrintText
ld a, $8
jr .asm_1636f
.asm_1635f
ld hl, UnknownText_0x1667b
call PrintText
ret
.asm_16366
ld hl, UnknownText_0x16680
call PrintText
ret
.asm_1636d
ld a, $7
.asm_1636f
ld [$cf63], a
ret
; 16373
Function16373: ; 16373
ld hl, UnknownText_0x16667
call PrintText
xor a
ld hl, StringBuffer2
ld [hli], a
ld [hli], a
ld [hl], a
ld a, $5
ld [$cf64], a
call Function1d6e
call Function16512
call Function1656b
call Function16571
call Function1c17
jr c, .asm_16400
ld hl, StringBuffer2
ld a, [hli]
or [hl]
inc hl
or [hl]
jr z, .asm_16400
ld hl, StringBuffer2
ld de, $d089
ld bc, $0003
call CopyBytes
ld de, $d851
ld bc, StringBuffer2
callba Function1600b
jr c, .asm_163f2
ld bc, Money
ld de, StringBuffer2
callba Function15fd7
jr c, .asm_163f9
ld bc, $d089
ld de, $d851
callba Function15ffa
ld hl, StringBuffer2
ld de, Money
ld bc, $0003
call CopyBytes
ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
ld hl, UnknownText_0x1668f
call PrintText
ld a, $8
jr .asm_16402
.asm_163f2
ld hl, UnknownText_0x16671
call PrintText
ret
.asm_163f9
ld hl, UnknownText_0x16676
call PrintText
ret
.asm_16400
ld a, $7
.asm_16402
ld [$cf63], a
ret
; 16406
Function16406: ; 16406
ld hl, UnknownText_0x1666c
call PrintText
call YesNoBox
jr c, .asm_16422
ld a, $81
ld [$d854], a
ld hl, UnknownText_0x16685
call PrintText
ld a, $8
ld [$cf63], a
ret
.asm_16422
ld a, $80
ld [$d854], a
ld a, $7
ld [$cf63], a
ret
; 1642d
Function1642d: ; 1642d
ld hl, UnknownText_0x16694
call PrintText
Function16433: ; 16433
ld hl, $cf63
set 7, [hl]
ret
; 16439
DSTChecks: ; 16439
; check the time; avoid changing DST if doing so would change the current day
ld a, [wDST]
bit 7, a
ld a, [hHours]
jr z, .asm_16447
and a ; within one hour of 00:00?
jr z, .LostBooklet
jr .next
.asm_16447
cp 23 ; within one hour of 23:00?
jr nz, .next
; fallthrough
.LostBooklet
call Function164ea
bccoord 1, 14
ld hl, UnknownText_0x164f4
call Function13e5
call YesNoBox
ret c
call Function164ea
bccoord 1, 14
ld hl, LostInstructionBookletText
call Function13e5
ret
.next
call Function164ea
bccoord 1, 14
ld a, [wDST]
bit 7, a
jr z, .asm_16497
ld hl, UnknownText_0x16508
call Function13e5
call YesNoBox
ret c
ld a, [wDST]
res 7, a
ld [wDST], a
call Function164d1
call Function164ea
bccoord 1, 14
ld hl, UnknownText_0x1650d
call Function13e5
ret
.asm_16497
ld hl, UnknownText_0x164fe
call Function13e5
call YesNoBox
ret c
ld a, [wDST]
set 7, a
ld [wDST], a
call Function164b9
call Function164ea
bccoord 1, 14
ld hl, UnknownText_0x16503
call Function13e5
ret
; 164b9
Function164b9: ; 164b9
ld a, [StartHour]
add 1
sub 24
jr nc, .asm_164c4
add 24
.asm_164c4
ld [StartHour], a
ccf
ld a, [StartDay]
adc 0
ld [StartDay], a
ret
; 164d1
Function164d1: ; 164d1
ld a, [StartHour]
sub 1
jr nc, .asm_164da
add 24
.asm_164da
ld [StartHour], a
ld a, [StartDay]
sbc 0
jr nc, .asm_164e6
add 7
.asm_164e6
ld [StartDay], a
ret
; 164ea
Function164ea: ; 164ea
hlcoord 1, 14
ld bc, $0312
call ClearBox
ret
; 164f4
UnknownText_0x164f4: ; 0x164f4
; Do you want to adjust your clock for Daylight Saving Time?
text_jump UnknownText_0x1c6095
db "@"
; 0x164f9
LostInstructionBookletText: ; 0x164f9
; I lost the instruction booklet for the POKéGEAR.
; Come back again in a while.
text_jump UnknownText_0x1c60d1
db "@"
; 0x164fe
UnknownText_0x164fe: ; 0x164fe
; Do you want to switch to Daylight Saving Time?
text_jump UnknownText_0x1c6000
db "@"
; 0x16503
UnknownText_0x16503: ; 0x16503
; I set the clock forward by one hour.
text_jump UnknownText_0x1c6030
db "@"
; 0x16508
UnknownText_0x16508: ; 0x16508
; Is Daylight Saving Time over?
text_jump UnknownText_0x1c6056
db "@"
; 0x1650d
UnknownText_0x1650d: ; 0x1650d
; I put the clock back one hour.
text_jump UnknownText_0x1c6075
db "@"
; 0x16512
Function16512: ; 16512
ld de, String_1669f
jr Function1651a
Function16517: ; 16517
ld de, String_166a8
Function1651a: ; 1651a
push de
xor a
ld [hBGMapMode], a
ld hl, TileMap
ld bc, $0612
call TextBox
hlcoord 1, 2
ld de, String_16699
call PlaceString
hlcoord 12, 2
ld de, $d851
ld bc, $2306
call PrintNum
hlcoord 1, 4
ld de, String_166b0
call PlaceString
hlcoord 12, 4
ld de, Money
ld bc, $2306
call PrintNum
hlcoord 1, 6
pop de
call PlaceString
hlcoord 12, 6
ld de, StringBuffer2
ld bc, $a306
call PrintNum
call Function1ad2
call Function3238
ret
; 1656b
Function1656b: ; 1656b
ld c, $a
call DelayFrames
ret
; 16571
Function16571: ; 16571
.asm_16571
call Functiona57
ld hl, hJoyPressed
ld a, [hl]
and $2
jr nz, .asm_165b5
ld a, [hl]
and $1
jr nz, .asm_165b7
call Function165b9
xor a
ld [hBGMapMode], a
hlcoord 12, 6
ld bc, $0007
ld a, $7f
call ByteFill
hlcoord 12, 6
ld de, StringBuffer2
ld bc, $a306
call PrintNum
ld a, [$ff9b]
and $10
jr nz, .asm_165b0
hlcoord 13, 6
ld a, [$cf64]
ld c, a
ld b, $0
add hl, bc
ld [hl], $7f
.asm_165b0
call WaitBGMap
jr .asm_16571
.asm_165b5
scf
ret
.asm_165b7
and a
ret
; 165b9
Function165b9: ; 165b9
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, .asm_165e3
ld a, [hl]
and $80
jr nz, .asm_165f5
ld a, [hl]
and $20
jr nz, .asm_165d2
ld a, [hl]
and $10
jr nz, .asm_165da
and a
ret
.asm_165d2
ld hl, $cf64
ld a, [hl]
and a
ret z
dec [hl]
ret
.asm_165da
ld hl, $cf64
ld a, [hl]
cp $5
ret nc
inc [hl]
ret
.asm_165e3
ld hl, Unknown_16613
call Function16607
ld c, l
ld b, h
ld de, StringBuffer2
callba Function15fd7
ret
.asm_165f5
ld hl, Unknown_16613
call Function16607
ld c, l
ld b, h
ld de, StringBuffer2
callba Function15ffa
ret
; 16607
Function16607: ; 16607
ld a, [$cf64]
push de
ld e, a
ld d, 0
add hl, de
add hl, de
add hl, de
pop de
ret
; 16613
Unknown_16613: ; 16613
dt 100000
dt 10000
dt 1000
dt 100
dt 10
dt 1
dt 100000
dt 10000
dt 1000
dt 100
dt 10
dt 1
dt 900000
dt 90000
dt 9000
dt 900
dt 90
dt 9
; 16649
UnknownText_0x16649: ; 0x16649
; Wow, that's a cute #MON. Where did you get it? … So, you're leaving on an adventure… OK! I'll help too. But what can I do for you? I know! I'll save money for you. On a long journey, money's important. Do you want me to save your money?
text_jump UnknownText_0x1bd77f
db "@"
; 0x1664e
UnknownText_0x1664e: ; 0x1664e
; OK, I'll take care of your money.
text_jump UnknownText_0x1bd868
db "@"
; 0x16653
UnknownText_0x16653: ; 0x16653
; Be careful. #MON are your friends. You need to work as a team. Now, go on!
text_jump UnknownText_0x1bd88e
db "@"
; 0x16658
UnknownText_0x16658: ; 0x16658
; Hi! Welcome home! You're trying very hard, I see. I've kept your room tidy. Or is this about your money?
text_jump UnknownText_0x1bd8da
db "@"
; 0x1665d
UnknownText_0x1665d: ; 0x1665d
; What do you want to do?
text_jump UnknownText_0x1bd942
db "@"
; 0x16662
UnknownText_0x16662: ; 0x16662
; How much do you want to save?
text_jump UnknownText_0x1bd95b
db "@"
; 0x16667
UnknownText_0x16667: ; 0x16667
; How much do you want to take?
text_jump UnknownText_0x1bd97a
db "@"
; 0x1666c
UnknownText_0x1666c: ; 0x1666c
; Do you want to save some money?
text_jump UnknownText_0x1bd999
db "@"
; 0x16671
UnknownText_0x16671: ; 0x16671
; You haven't saved that much.
text_jump UnknownText_0x1bd9ba
db "@"
; 0x16676
UnknownText_0x16676: ; 0x16676
; You can't take that much.
text_jump UnknownText_0x1bd9d7
db "@"
; 0x1667b
UnknownText_0x1667b: ; 0x1667b
; You don't have that much.
text_jump UnknownText_0x1bd9f1
db "@"
; 0x16680
UnknownText_0x16680: ; 0x16680
; You can't save that much.
text_jump UnknownText_0x1bda0b
db "@"
; 0x16685
UnknownText_0x16685: ; 0x16685
; OK, I'll save your money. Trust me! , stick with it!
text_jump UnknownText_0x1bda25
db "@"
; 0x1668a
UnknownText_0x1668a: ; 0x1668a
; Your money's safe here! Get going!
text_jump UnknownText_0x1bda5b
db "@"
; 0x1668f
UnknownText_0x1668f: ; 0x1668f
; , don't give up!
text_jump UnknownText_0x1bda7e
db "@"
; 0x16694
UnknownText_0x16694: ; 0x16694
; Just do what you can.
text_jump UnknownText_0x1bda90
db "@"
; 0x16699
String_16699: ; 16699
db "SAVED@"
; 1669f
String_1669f: ; 1669f
db "WITHDRAW@"
; 166a8
String_166a8: ; 166a8
db "DEPOSIT@"
; 166b0
String_166b0: ; 166b0
db "HELD@"
; 166b5
MenuDataHeader_0x166b5: ; 0x166b5
db $40 ; flags
db 00, 00 ; start coords
db 10, 10 ; end coords
dw MenuData2_0x166bd
db 1 ; default option
; 0x166bd
MenuData2_0x166bd: ; 0x166bd
db $80 ; flags
db 4 ; items
db "GET@"
db "SAVE@"
db "CHANGE@"
db "CANCEL@"
; 0x166d6
Function166d6: ; 166d6
ld hl, wDaycareMan
bit 0, [hl]
jr nz, .asm_166fe
ld hl, wDaycareMan
ld a, $0
call Function1678f
jr c, .asm_16724
call Function16798
jr c, .asm_16721
callba Functionde2a
ld hl, wDaycareMan
set 0, [hl]
call Function167f6
call Function16a3b
ret
.asm_166fe
callba Functione698
ld hl, wBreedMon1Nick
call Function1686d
call Function16807
jr c, .asm_16721
callba Functiondd21
call Function16850
ld hl, wDaycareMan
res 0, [hl]
res 5, [hl]
jr .asm_16724
.asm_16721
call Function1689b
.asm_16724
ld a, $13
call Function1689b
ret
; 1672a
Function1672a: ; 1672a
ld hl, wDaycareLady
bit 0, [hl]
jr nz, .asm_16752
ld hl, wDaycareLady
ld a, $2
call Function16781
jr c, .asm_1677b
call Function16798
jr c, .asm_16778
callba Functionde37
ld hl, wDaycareLady
set 0, [hl]
call Function167f6
call Function16a3b
ret
.asm_16752
callba Functione6b3
ld hl, wBreedMon2Nick
call Function1686d
call Function16807
jr c, .asm_16778
callba Functiondd42
call Function16850
ld hl, wDaycareLady
res 0, [hl]
ld hl, wDaycareMan
res 5, [hl]
jr .asm_1677b
.asm_16778
call Function1689b
.asm_1677b
ld a, $13
call Function1689b
ret
; 16781
Function16781: ; 16781
bit 7, [hl]
jr nz, .asm_16788
set 7, [hl]
inc a
.asm_16788
call Function1689b
call YesNoBox
ret
; 1678f
Function1678f: ; 1678f
set 7, [hl]
call Function1689b
call YesNoBox
ret
; 16798
Function16798: ; 16798
ld a, [PartyCount]
cp $2
jr c, .asm_167e5
ld a, $4
call Function1689b
ld b, $6
callba Function5001d
jr c, .asm_167dd
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_167e1
callba Functione538
jr c, .asm_167e9
ld hl, PartyMon1Item
ld bc, PartyMon2 - PartyMon1
ld a, [CurPartyMon]
call AddNTimes
ld d, [hl]
callba ItemIsMail
jr c, .asm_167ed
ld hl, PartyMonNicknames
ld a, [CurPartyMon]
call GetNick
and a
ret
.asm_167dd
ld a, $12
scf
ret
.asm_167e1
ld a, $6
scf
ret
.asm_167e5
ld a, $7
scf
ret
.asm_167e9
ld a, $8
scf
ret
.asm_167ed
ld a, $a
scf
ret
; 167f1
UnknownText_0x167f1: ; 0x167f1
;
text_jump UnknownText_0x1bdaa7
db "@"
; 0x167f6
Function167f6: ; 167f6
ld a, $5
call Function1689b
ld a, [CurPartySpecies]
call PlayCry
ld a, $9
call Function1689b
ret
; 16807
Function16807: ; 16807
ld a, [$d087]
and a
jr nz, .asm_16819
ld a, $f
call Function1689b
call YesNoBox
jr c, .asm_16844
jr .asm_1682d
.asm_16819
ld a, $b
call Function1689b
call YesNoBox
jr c, .asm_16844
ld a, $c
call Function1689b
call YesNoBox
jr c, .asm_16844
.asm_1682d
ld de, Money
ld bc, $d088
callba Function1600b
jr c, .asm_16848
ld a, [PartyCount]
cp $6
jr nc, .asm_1684c
and a
ret
.asm_16844
ld a, $12
scf
ret
.asm_16848
ld a, $11
scf
ret
.asm_1684c
ld a, $10
scf
ret
; 16850
Function16850: ; 16850
ld bc, $d088
ld de, Money
callba Function15ffa
ld a, $d
call Function1689b
ld a, [CurPartySpecies]
call PlayCry
ld a, $e
call Function1689b
ret
; 1686d
Function1686d: ; 1686d
ld a, b
ld [StringBuffer2], a
ld a, d
ld [$d087], a
ld de, StringBuffer1
ld bc, $000b
call CopyBytes
ld hl, $0000
ld bc, $0064
ld a, [$d087]
call AddNTimes
ld de, $0064
add hl, de
xor a
ld [$d088], a
ld a, h
ld [$d089], a
ld a, l
ld [$d08a], a
ret
; 1689b
Function1689b: ; 1689b
ld e, a
ld d, 0
ld hl, TextTable_168aa
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call PrintText
ret
; 168aa
TextTable_168aa: ; 168aa
dw UnknownText_0x168d2
dw UnknownText_0x168d7
dw UnknownText_0x168dc
dw UnknownText_0x168e1
dw UnknownText_0x168e6
dw UnknownText_0x168ff
dw UnknownText_0x168f0
dw UnknownText_0x168eb
dw UnknownText_0x168fa
dw UnknownText_0x16904
dw UnknownText_0x168f5
dw UnknownText_0x16909
dw UnknownText_0x1690e
dw UnknownText_0x16913
dw UnknownText_0x16918
dw UnknownText_0x1691d
dw UnknownText_0x16922
dw UnknownText_0x16927
dw UnknownText_0x1692c
dw UnknownText_0x16931
; 168d2
UnknownText_0x168d2: ; 0x168d2
; I'm the DAY-CARE MAN. Want me to raise a #MON?
text_jump UnknownText_0x1bdaa9
db "@"
; 0x168d7
UnknownText_0x168d7: ; 0x168d7
; I'm the DAY-CARE MAN. Do you know about EGGS? I was raising #MON with my wife, you see. We were shocked to find an EGG! How incredible is that? So, want me to raise a #MON?
text_jump UnknownText_0x1bdad8
db "@"
; 0x168dc
UnknownText_0x168dc: ; 0x168dc
; I'm the DAY-CARE LADY. Should I raise a #MON for you?
text_jump UnknownText_0x1bdb85
db "@"
; 0x168e1
UnknownText_0x168e1: ; 0x168e1
; I'm the DAY-CARE LADY. Do you know about EGGS? My husband and I were raising some #MON, you see. We were shocked to find an EGG! How incredible could that be? Should I raise a #MON for you?
text_jump UnknownText_0x1bdbbb
db "@"
; 0x168e6
UnknownText_0x168e6: ; 0x168e6
; What should I raise for you?
text_jump UnknownText_0x1bdc79
db "@"
; 0x168eb
UnknownText_0x168eb: ; 0x168eb
; Oh? But you have just one #MON.
text_jump UnknownText_0x1bdc97
db "@"
; 0x168f0
UnknownText_0x168f0: ; 0x168f0
; Sorry, but I can't accept an EGG.
text_jump UnknownText_0x1bdcb8
db "@"
; 0x168f5
UnknownText_0x168f5: ; 0x168f5
; Remove MAIL before you come see me.
text_jump UnknownText_0x1bdcda
db "@"
; 0x168fa
UnknownText_0x168fa: ; 0x168fa
; If you give me that, what will you battle with?
text_jump UnknownText_0x1bdcff
db "@"
; 0x168ff
UnknownText_0x168ff: ; 0x168ff
; OK. I'll raise your @ .
text_jump UnknownText_0x1bdd30
db "@"
; 0x16904
UnknownText_0x16904: ; 0x16904
; Come back for it later.
text_jump UnknownText_0x1bdd4b
db "@"
; 0x16909
UnknownText_0x16909: ; 0x16909
; Are we geniuses or what? Want to see your @ ?
text_jump UnknownText_0x1bdd64
db "@"
; 0x1690e
UnknownText_0x1690e: ; 0x1690e
; Your @ has grown a lot. By level, it's grown by @ . If you want your #MON back, it will cost ¥@ .
text_jump UnknownText_0x1bdd96
db "@"
; 0x16913
UnknownText_0x16913: ; 0x16913
; Perfect! Here's your #MON.
text_jump UnknownText_0x1bde04
db "@"
; 0x16918
UnknownText_0x16918: ; 0x16918
; got back @ .
text_jump UnknownText_0x1bde1f
db "@"
; 0x1691d
UnknownText_0x1691d: ; 0x1691d
; Huh? Back already? Your @ needs a little more time with us. If you want your #MON back, it will cost ¥100.
text_jump UnknownText_0x1bde32
db "@"
; 0x16922
UnknownText_0x16922: ; 0x16922
; You have no room for it.
text_jump UnknownText_0x1bdea2
db "@"
; 0x16927
UnknownText_0x16927: ; 0x16927
; You don't have enough money.
text_jump UnknownText_0x1bdebc
db "@"
; 0x1692c
UnknownText_0x1692c: ; 0x1692c
; Oh, fine then.
text_jump UnknownText_0x1bded9
db "@"
; 0x16931
UnknownText_0x16931: ; 0x16931
; Come again.
text_jump UnknownText_0x1bdee9
db "@"
; 0x16936
Function16936: ; 16936
ld hl, wDaycareMan
bit 6, [hl]
jr nz, Function16949
ld hl, UnknownText_0x16944
call PrintText
ret
UnknownText_0x16944: ; 0x16944
; Not yet…
text_jump UnknownText_0x1bdef6
db "@"
; 0x16949
Function16949: ; 16949
ld hl, UnknownText_0x16993
call PrintText
call YesNoBox
jr c, .asm_1697c
ld a, [PartyCount]
cp $6
jr nc, .asm_16987
call Function169ac
ld hl, wDaycareMan
res 6, [hl]
call Function16a3b
ld hl, UnknownText_0x16998
call PrintText
ld de, SFX_GET_EGG_FROM_DAYCARE_LADY
call PlaySFX
ld c, $78
call DelayFrames
ld hl, UnknownText_0x1699d
jr .asm_1697f
.asm_1697c
ld hl, UnknownText_0x169a2
.asm_1697f
call PrintText
xor a
ld [ScriptVar], a
ret
.asm_16987
ld hl, UnknownText_0x169a7
call PrintText
ld a, $1
ld [ScriptVar], a
ret
; 16993
UnknownText_0x16993: ; 0x16993
; Ah, it's you! We were raising your #MON, and my goodness, were we surprised! Your #MON had an EGG! We don't know how it got there, but your #MON had it. You want it?
text_jump UnknownText_0x1bdf00
db "@"
; 0x16998
UnknownText_0x16998: ; 0x16998
; received the EGG!
text_jump UnknownText_0x1bdfa5
db "@"
; 0x1699d
UnknownText_0x1699d: ; 0x1699d
; Take good care of it.
text_jump UnknownText_0x1bdfba
db "@"
; 0x169a2
UnknownText_0x169a2: ; 0x169a2
; Well then, I'll keep it. Thanks!
text_jump UnknownText_0x1bdfd1
db "@"
; 0x169a7
UnknownText_0x169a7: ; 0x169a7
; You have no room in your party. Come back later.
text_jump UnknownText_0x1bdff2
db "@"
; 0x169ac
Function169ac: ; 169ac
ld a, [$df9a]
ld [CurPartyLevel], a
ld hl, PartyCount
ld a, [hl]
cp $6
jr nc, .asm_16a2f
inc a
ld [hl], a
ld c, a
ld b, 0
add hl, bc
ld a, EGG
ld [hli], a
ld a, [wEggMonSpecies]
ld [CurSpecies], a
ld [CurPartySpecies], a
ld a, $ff
ld [hl], a
ld hl, PartyMonNicknames
ld bc, $000b
call Function16a31
ld hl, wEggNick
call CopyBytes
ld hl, PartyMonOT
ld bc, $000b
call Function16a31
ld hl, wEggOT
call CopyBytes
ld hl, PartyMon1
ld bc, PartyMon2 - PartyMon1
call Function16a31
ld hl, wEggMon
ld bc, wEggMonEnd - wEggMon
call CopyBytes
call GetBaseData
ld a, [PartyCount]
dec a
ld hl, PartyMon1
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld b, h
ld c, l
ld hl, $0007
add hl, bc
push hl
ld hl, $0024
add hl, bc
ld d, h
ld e, l
pop hl
push bc
ld b, $0
predef Functione167
pop bc
ld hl, $0022
add hl, bc
xor a
ld [hli], a
ld [hl], a
and a
ret
.asm_16a2f
scf
ret
; 16a31
Function16a31: ; 16a31
ld a, [PartyCount]
dec a
call AddNTimes
ld d, h
ld e, l
ret
; 16a3b
Function16a3b: ; 16a3b
ld a, [wDaycareLady]
bit 0, a
ret z
ld a, [wDaycareMan]
bit 0, a
ret z
callab Function16e1d
ld a, [$d265]
and a
ret z
inc a
ret z
ld hl, wDaycareMan
set 5, [hl]
.asm_16a59
call Random
cp 150
jr c, .asm_16a59
ld [wStepsToEgg], a
jp Function16a66
; 16a66
Function16a66: ; 16a66
xor a
ld hl, wEggMon
ld bc, wEggMonEnd - wEggMon
call ByteFill
ld hl, wEggNick
ld bc, PKMN_NAME_LENGTH
call ByteFill
ld hl, wEggOT
ld bc, NAME_LENGTH
call ByteFill
ld a, [$df21]
ld [TempMonDVs], a
ld a, [$df22]
ld [$d124], a
ld a, [wBreedMon1Species]
ld [CurPartySpecies], a
ld a, $3
ld [MonType], a
ld a, [wBreedMon1Species]
cp DITTO
ld a, $1
jr z, .asm_16ab6
ld a, [wBreedMon2Species]
cp DITTO
ld a, $0
jr z, .asm_16ab6
callba GetGender
ld a, $0
jr z, .asm_16ab6
inc a
.asm_16ab6
ld [wDittoInDaycare], a
and a
ld a, [wBreedMon1Species]
jr z, .asm_16ac2
ld a, [wBreedMon2Species]
.asm_16ac2
ld [CurPartySpecies], a
callab GetPreEvolution
callab GetPreEvolution
ld a, $5
ld [CurPartyLevel], a
ld a, [CurPartySpecies]
cp $1d
jr nz, .asm_16ae8
call Random
cp $80
ld a, $1d
jr c, .asm_16ae8
ld a, $20
.asm_16ae8
ld [CurPartySpecies], a
ld [CurSpecies], a
ld [wEggMonSpecies], a
call GetBaseData
ld hl, wEggNick
ld de, String_16be0
call CopyName2
ld hl, PlayerName
ld de, wEggOT
ld bc, NAME_LENGTH
call CopyBytes
xor a
ld [$df7c], a
ld de, $df7d
xor a
ld [Buffer1], a
predef FillMoves
callba Function170bf
ld hl, $df81
ld a, [PlayerID]
ld [hli], a
ld a, [$d47c]
ld [hl], a
ld a, [CurPartyLevel]
ld d, a
callab Function50e47
ld hl, $df83
ld a, [hMultiplicand]
ld [hli], a
ld a, [$ffb5]
ld [hli], a
ld a, [$ffb6]
ld [hl], a
xor a
ld b, $a
ld hl, $df86
.asm_16b46
ld [hli], a
dec b
jr nz, .asm_16b46
ld hl, $df90
call Random
ld [hli], a
ld [TempMonDVs], a
call Random
ld [hld], a
ld [$d124], a
ld de, $df21
ld a, [wBreedMon1Species]
cp DITTO
jr z, .asm_16b98
ld de, $df5a
ld a, [wBreedMon2Species]
cp DITTO
jr z, .asm_16b98
ld a, $3
ld [MonType], a
push hl
callba GetGender
pop hl
ld de, $df21
ld bc, $df5a
jr c, .asm_16bab
jr z, .asm_16b90
ld a, [wDittoInDaycare]
and a
jr z, .asm_16b98
ld d, b
ld e, c
jr .asm_16b98
.asm_16b90
ld a, [wDittoInDaycare]
and a
jr nz, .asm_16b98
ld d, b
ld e, c
.asm_16b98
ld a, [de]
inc de
and $f
ld b, a
ld a, [hl]
and $f0
add b
ld [hli], a
ld a, [de]
and $7
ld b, a
ld a, [hl]
and $f8
add b
ld [hl], a
.asm_16bab
ld hl, StringBuffer1
ld de, $d050
ld bc, $000b
call CopyBytes
ld hl, $df7d
ld de, $df92
predef FillPP
ld hl, $d050
ld de, StringBuffer1
ld bc, $000b
call CopyBytes
ld a, [BaseEggSteps]
ld hl, $df96
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hl], a
ld a, [CurPartyLevel]
ld [$df9a], a
ret
; 16be0
String_16be0: ; 16be0
db "EGG@"
; 16be4
Function16be4: ; 16be4
ld a, [UnownDex]
and a
ret z
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
ld a, [Options]
push af
set 4, a
ld [Options], a
call WhiteBGMap
call ClearTileMap
ld de, UnownDexATile
ld hl, $8ef0
lb bc, BANK(UnownDexBTile), 1
call Request1bpp
ld de, UnownDexBTile
ld hl, $8f50
lb bc, BANK(UnownDexBTile), 1
call Request1bpp
ld hl, TileMap
ld bc, $0312
call TextBox
hlcoord 0, 5
ld bc, $0707
call TextBox
hlcoord 0, 14
ld bc, $0212
call TextBox
hlcoord 1, 2
ld de, AlphRuinsStampString
call PlaceString
hlcoord 1, 16
ld de, UnownDexDoWhatString
call PlaceString
hlcoord 10, 6
ld de, UnownDexMenuString
call PlaceString
xor a
ld [$cf63], a
call Function16cc8
call WaitBGMap
ld a, UNOWN
ld [CurPartySpecies], a
xor a
ld [TempMonDVs], a
ld [TempMonDVs + 1], a
ld b, $1c
call GetSGBLayout
call Function32f9
.asm_16c6b
call Functiona57
ld a, [hJoyPressed]
and B_BUTTON
jr nz, .asm_16c95
ld a, [hJoyPressed]
and A_BUTTON
jr nz, .asm_16c82
call Function16ca0
call DelayFrame
jr .asm_16c6b
.asm_16c82
ld a, [$cf63]
push af
callba Function84560
call RestartMapMusic
pop af
ld [$cf63], a
jr .asm_16c6b
.asm_16c95
pop af
ld [Options], a
pop af
ld [$ffaa], a
call Function222a
ret
; 16ca0
Function16ca0: ; 16ca0
ld a, [$ffa9]
and $10
jr nz, .asm_16cb9
ld a, [$ffa9]
and $20
jr nz, .asm_16cad
ret
.asm_16cad
ld hl, $cf63
ld a, [hl]
and a
jr nz, .asm_16cb6
ld [hl], $1b
.asm_16cb6
dec [hl]
jr .asm_16cc4
.asm_16cb9
ld hl, $cf63
ld a, [hl]
cp $1a
jr c, .asm_16cc3
ld [hl], $ff
.asm_16cc3
inc [hl]
.asm_16cc4
call Function16cc8
ret
; 16cc8
Function16cc8: ; 16cc8
ld a, [$cf63]
cp 26
jr z, Function16d20
inc a
ld [UnownLetter], a
ld a, UNOWN
ld [CurPartySpecies], a
xor a
ld [$c2c6], a
ld de, VTiles2
predef GetFrontpic
call Function16cff
hlcoord 1, 6
xor a
ld [$ffad], a
ld bc, $0707
predef FillBox
ld de, $9310
callba Functione0000
ret
; 16cff
Function16cff: ; 16cff
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
ld a, $0
call GetSRAMBank
ld de, Unkn1Pals
ld hl, $a000
ld a, [hROMBank]
ld b, a
ld c, $31
call Get2bpp
call CloseSRAM
pop af
ld [rSVBK], a
ret
; 16d20
Function16d20: ; 16d20
hlcoord 1, 6
ld bc, $0707
call ClearBox
hlcoord 1, 9
ld de, UnownDexVacantString
call PlaceString
xor a
call GetSRAMBank
ld hl, $a000
ld bc, $0310
xor a
call ByteFill
ld hl, $9310
ld de, $a000
ld c, $31
ld a, [hROMBank]
ld b, a
call Get2bpp
call CloseSRAM
ld c, $14
call DelayFrames
ret
; 16d57
AlphRuinsStampString:
db " ALPH RUINS STAMP@"
UnownDexDoWhatString:
db "Do what?@"
UnownDexMenuString:
db $ef, " PRINT", $4e
db $f5, " CANCEL", $4e
db $df, " PREVIOUS", $4e
db $eb, " NEXT@"
UnownDexVacantString:
db "VACANT@"
; 16d9c
UnownDexATile: ; 16d9c
INCBIN "baserom.gbc", $16d9c, $16da4 - $16d9c
UnownDexBTile: ; 16da4
INCBIN "baserom.gbc", $16da4, $16dac - $16da4
; 16dac
Function16dac: ; 16dac
ld hl, TileMap
ld bc, $0168
ld a, $7f
call ByteFill
hlcoord 7, 11
ld a, $31
ld [$ffad], a
ld bc, $0707
predef FillBox
ret
; 16dc7
Function16dc7: ; 16dc7
ld hl, UnknownText_0x16e04
call PrintText
callba Function50000
jr c, .asm_16df8
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_16dfd
ld hl, UnknownText_0x16e09
call PrintText
call Function2ed3
callba Function8461a
call Function2b74
ld a, [$ffac]
and a
jr nz, .asm_16df8
ld hl, UnknownText_0x16e0e
jr .asm_16e00
.asm_16df8
ld hl, UnknownText_0x16e13
jr .asm_16e00
.asm_16dfd
ld hl, UnknownText_0x16e18
.asm_16e00
call PrintText
ret
; 16e04
UnknownText_0x16e04: ; 0x16e04
; Which #MON should I photo- graph?
text_jump UnknownText_0x1be024
db "@"
; 0x16e09
UnknownText_0x16e09: ; 0x16e09
; All righty. Hold still for a bit.
text_jump UnknownText_0x1be047
db "@"
; 0x16e0e
UnknownText_0x16e0e: ; 0x16e0e
; Presto! All done. Come again, OK?
text_jump UnknownText_0x1be06a
db "@"
; 0x16e13
UnknownText_0x16e13: ; 0x16e13
; Oh, no picture? Come again, OK?
text_jump UnknownText_0x1c0000
db "@"
; 0x16e18
UnknownText_0x16e18: ; 0x16e18
; An EGG? My talent is worth more…
text_jump UnknownText_0x1c0021
db "@"
; 0x16e1d
Function16e1d: ; 16e1d
call Function16ed6
ld c, $0
jp nc, .asm_16eb7
ld a, [wBreedMon1Species]
ld [CurPartySpecies], a
ld a, [$df21]
ld [TempMonDVs], a
ld a, [$df22]
ld [$d124], a
ld a, $3
ld [MonType], a
predef GetGender
jr c, .asm_16e70
ld b, $1
jr nz, .asm_16e48
inc b
.asm_16e48
push bc
ld a, [wBreedMon2Species]
ld [CurPartySpecies], a
ld a, [$df5a]
ld [TempMonDVs], a
ld a, [$df5b]
ld [$d124], a
ld a, $3
ld [MonType], a
predef GetGender
pop bc
jr c, .asm_16e70
ld a, $1
jr nz, .asm_16e6d
inc a
.asm_16e6d
cp b
jr nz, .asm_16e89
.asm_16e70
ld c, $0
ld a, [wBreedMon1Species]
cp DITTO
jr z, .asm_16e82
ld a, [wBreedMon2Species]
cp DITTO
jr nz, .asm_16eb7
jr .asm_16e89
.asm_16e82
ld a, [wBreedMon2Species]
cp DITTO
jr z, .asm_16eb7
.asm_16e89
call Function16ebc
ld c, $ff
jp z, .asm_16eb7
ld a, [wBreedMon2Species]
ld b, a
ld a, [wBreedMon1Species]
cp b
ld c, $fe
jr z, .asm_16e9f
ld c, $80
.asm_16e9f
ld a, [$df12]
ld b, a
ld a, [$df4b]
cp b
jr nz, .asm_16eb7
ld a, [$df13]
ld b, a
ld a, [$df4c]
cp b
jr nz, .asm_16eb7
ld a, c
sub $4d
ld c, a
.asm_16eb7
ld a, c
ld [$d265], a
ret
; 16ebc
Function16ebc: ; 16ebc (5:6ebc)
ld a, [$df21]
and $f
ld b, a
ld a, [$df5a]
and $f
cp b
ret nz
ld a, [$df22]
and $7
ld b, a
ld a, [$df5b]
and $7
cp b
ret
; 16ed6
Function16ed6: ; 16ed6
ld a, [wBreedMon2Species]
ld [CurSpecies], a
call GetBaseData
ld a, [BaseEggGroups]
cp $ff
jr z, .asm_16f3a
ld a, [wBreedMon1Species]
ld [CurSpecies], a
call GetBaseData
ld a, [BaseEggGroups]
cp $ff
jr z, .asm_16f3a
ld a, [wBreedMon2Species]
cp DITTO
jr z, .asm_16f3c
ld [CurSpecies], a
call GetBaseData
ld a, [BaseEggGroups]
push af
and $f
ld b, a
pop af
and $f0
swap a
ld c, a
ld a, [wBreedMon1Species]
cp DITTO
jr z, .asm_16f3c
ld [CurSpecies], a
push bc
call GetBaseData
pop bc
ld a, [BaseEggGroups]
push af
and $f
ld d, a
pop af
and $f0
swap a
ld e, a
ld a, d
cp b
jr z, .asm_16f3c
cp c
jr z, .asm_16f3c
ld a, e
cp b
jr z, .asm_16f3c
cp c
jr z, .asm_16f3c
.asm_16f3a
and a
ret
.asm_16f3c
scf
ret
; 16f3e
Function16f3e:: ; 16f3e
ld de, PartySpecies
ld hl, PartyMon1Happiness
ld c, 0
.loop
ld a, [de]
inc de
cp $ff
ret z
cp EGG
jr nz, .next
dec [hl]
jr nz, .next
ld a, 1
and a
ret
.next
push de
ld de, PartyMon2 - PartyMon1
add hl, de
pop de
jr .loop
; 16f5e
Function16f5e:: ; 16f5e
call ResetWindow
call Function1d6e
call Function16f70
call Function2b4d
call RestartMapMusic
jp Function2dcf
; 16f70
Function16f70: ; 16f70 (5:6f70)
ld de, PartySpecies ; $dcd8
ld hl, PartyMon1Happiness ; $dcfa
xor a
ld [CurPartyMon], a ; $d109
Function16f7a: ; 16f7a (5:6f7a)
ld a, [de]
inc de
cp $ff
jp z, Function1708a
push de
push hl
cp EGG
jp nz, Function1707d
ld a, [hl]
and a
jp nz, Function1707d
ld [hl], $78
push de
callba Function4dbb8
callba Function10608d
ld a, [CurPartyMon] ; $d109
ld hl, PartyMons ; $dcdf (aliases: PartyMon1, PartyMon1Species)
ld bc, $30
call AddNTimes
ld a, [hl]
ld [CurPartySpecies], a ; $d108
dec a
call SetSeenAndCaughtMon
ld a, [CurPartySpecies] ; $d108
cp $af
jr nz, .asm_16fbf
ld de, $54
ld b, $1
call EventFlagAction
.asm_16fbf
pop de
ld a, [CurPartySpecies] ; $d108
dec de
ld [de], a
ld [$d265], a
ld [CurSpecies], a ; $cf60
call GetPokemonName
xor a
ld [$d26b], a
call GetBaseData
ld a, [CurPartyMon] ; $d109
ld hl, PartyMons ; $dcdf (aliases: PartyMon1, PartyMon1Species)
ld bc, $30
call AddNTimes
push hl
ld bc, $24
add hl, bc
ld d, h
ld e, l
pop hl
push hl
ld bc, $1f
add hl, bc
ld a, [hl]
ld [CurPartyLevel], a ; $d143
pop hl
push hl
ld bc, $20
add hl, bc
xor a
ld [hli], a
ld [hl], a
pop hl
push hl
ld bc, $a
add hl, bc
ld b, $0
predef Functione167
pop bc
ld hl, $24
add hl, bc
ld d, h
ld e, l
ld hl, $22
add hl, bc
ld a, [de]
inc de
ld [hli], a
ld a, [de]
ld [hl], a
ld hl, $6
add hl, bc
ld a, [PlayerID] ; $d47b
ld [hli], a
ld a, [$d47c]
ld [hl], a
ld a, [CurPartyMon] ; $d109
ld hl, PartyMonOT ; $ddff (aliases: PartyMonOT)
ld bc, $b
call AddNTimes
ld d, h
ld e, l
ld hl, PlayerName ; $d47d
call CopyBytes
ld hl, UnknownText_0x1708b
call PrintText
ld a, [CurPartyMon] ; $d109
ld hl, PartyMonNicknames ; $de41 (aliases: PartyMonNicknames)
ld bc, $b
call AddNTimes
ld d, h
ld e, l
push de
ld hl, UnknownText_0x170ba
call PrintText
call YesNoBox
pop de
jr c, .asm_17074
ld a, $1
ld [$d26b], a
xor a
ld [MonType], a ; $cf5f
push de
ld b, $0
callba Function116c1
pop hl
ld de, StringBuffer1 ; $d073
call InitName
jr Function1707d
.asm_17074
ld hl, StringBuffer1 ; $d073
ld bc, $b
call CopyBytes
Function1707d: ; 1707d (5:707d)
ld hl, CurPartyMon ; $d109
inc [hl]
pop hl
ld de, $30
add hl, de
pop de
jp Function16f7a
Function1708a: ; 1708a (5:708a)
ret
; 1708b (5:708b)
UnknownText_0x1708b: ; 0x1708b
; Huh? @ @
text_jump UnknownText_0x1c0db0
start_asm
; 0x17090
Function17090: ; 17090
ld hl, VramState ; $d0ed
res 0, [hl]
push hl
push de
push bc
ld a, [CurPartySpecies] ; $d108
push af
call Function1728f
ld hl, UnknownText_0x170b0
call PrintText
pop af
ld [CurPartySpecies], a ; $d108
pop bc
pop de
pop hl
ld hl, UnknownText_0x170b5
ret
; 170b0 (5:70b0)
UnknownText_0x170b0: ; 0x170b0
;
text_jump UnknownText_0x1c0db8
db "@"
; 0x170b5
UnknownText_0x170b5: ; 0x170b5
; came out of its EGG!@ @
text_jump UnknownText_0x1c0dba
db "@"
; 0x170ba
UnknownText_0x170ba: ; 0x170ba
; Give a nickname to @ ?
text_jump UnknownText_0x1c0dd8
db "@"
; 0x170bf
Function170bf: ; 170bf
call Function17197
ld d, h
ld e, l
ld b, $4
.asm_170c6
ld a, [de]
and a
jr z, .asm_170e3
ld hl, $df7d
ld c, $4
.asm_170cf
ld a, [de]
cp [hl]
jr z, .asm_170df
inc hl
dec c
jr nz, .asm_170cf
call Function170e4
jr nc, .asm_170df
call Function17169
.asm_170df
inc de
dec b
jr nz, .asm_170c6
.asm_170e3
ret
; 170e4
Function170e4: ; 170e4
GLOBAL EggMoves
push bc
ld a, [wEggMonSpecies]
dec a
ld c, a
ld b, 0
ld hl, EggMovePointers
add hl, bc
add hl, bc
ld a, BANK(EggMovePointers)
call GetFarHalfword
.asm_170f6
ld a, BANK(EggMoves)
call GetFarByte
cp $ff
jr z, .asm_17107
ld b, a
ld a, [de]
cp b
jr z, .asm_17163
inc hl
jr .asm_170f6
.asm_17107
call Function1720b
ld b, NUM_MOVES
.asm_1710c
ld a, [de]
cp [hl]
jr z, .asm_17116
inc hl
dec b
jr z, .asm_17146
jr .asm_1710c
.asm_17116
ld a, [wEggMonSpecies]
dec a
ld c, a
ld b, 0
ld hl, EvosAttacksPointers
add hl, bc
add hl, bc
ld a, BANK(EvosAttacksPointers)
call GetFarHalfword
.asm_17127
ld a, BANK(EvosAttacks)
call GetFarByte
inc hl
and a
jr nz, .asm_17127
.asm_17130
ld a, BANK(EvosAttacks)
call GetFarByte
and a
jr z, .asm_17146
inc hl
ld a, BANK(EvosAttacks)
call GetFarByte
ld b, a
ld a, [de]
cp b
jr z, .asm_17163
inc hl
jr .asm_17130
.asm_17146
ld hl, TMHMMoves
.asm_17149
ld a, BANK(TMHMMoves)
call GetFarByte
inc hl
and a
jr z, .asm_17166
ld b, a
ld a, [de]
cp b
jr nz, .asm_17149
ld [$d262], a
predef CanLearnTMHMMove
ld a, c
and a
jr z, .asm_17166
.asm_17163
pop bc
scf
ret
.asm_17166
pop bc
and a
ret
; 17169
Function17169: ; 17169
push de
push bc
ld a, [de]
ld b, a
ld hl, $df7d
ld c, NUM_MOVES
.asm_17172
ld a, [hli]
and a
jr z, .asm_17187
dec c
jr nz, .asm_17172
ld de, $df7d
ld hl, $df7e
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
.asm_17187
dec hl
ld [hl], b
ld hl, $df7d
ld de, $df92
predef FillPP
pop bc
pop de
ret
; 17197
Function17197: ; 17197
ld hl, $df47
ld a, [wBreedMon1Species]
cp DITTO
jr z, .asm_171b1
ld a, [wBreedMon2Species]
cp DITTO
jr z, .asm_171d7
ld a, [wDittoInDaycare]
and a
ret z
ld hl, $df0e
ret
.asm_171b1
ld a, [CurPartySpecies]
push af
ld a, [wBreedMon2Species]
ld [CurPartySpecies], a
ld a, [$df5a]
ld [TempMonDVs], a
ld a, [$df5b]
ld [$d124], a
ld a, $3
ld [MonType], a
predef GetGender
jr c, .asm_171fb
jr nz, .asm_171fb
jr .asm_17203
.asm_171d7
ld a, [CurPartySpecies]
push af
ld a, [wBreedMon1Species]
ld [CurPartySpecies], a
ld a, [$df21]
ld [TempMonDVs], a
ld a, [$df22]
ld [$d124], a
ld a, $3
ld [MonType], a
predef GetGender
jr c, .asm_17203
jr nz, .asm_17203
.asm_171fb
ld hl, $df47
pop af
ld [CurPartySpecies], a
ret
.asm_17203
ld hl, $df0e
pop af
ld [CurPartySpecies], a
ret
; 1720b
Function1720b: ; 1720b
ld hl, $df0e
ld a, [wBreedMon1Species]
cp DITTO
ret z
ld a, [wBreedMon2Species]
cp DITTO
jr z, .asm_17220
ld a, [wDittoInDaycare]
and a
ret z
.asm_17220
ld hl, $df47
ret
; 17224
Function17224: ; 17224 (5:7224)
push de
ld [CurPartySpecies], a ; $d108
ld [CurSpecies], a ; $cf60
call GetBaseData
ld hl, BattleMonDVs
predef GetUnownLetter
pop de
predef_jump GetFrontpic
Function1723c: ; 1723c (5:723c)
push de
ld [CurPartySpecies], a ; $d108
ld [CurSpecies], a ; $cf60
call GetBaseData
ld hl, BattleMonDVs
predef GetUnownLetter
pop de
predef_jump Function5108b
Function17254: ; 17254 (5:7254)
push af
call WaitTop
push hl
push bc
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
ld a, $7f
call ByteFill
pop bc
pop hl
ld a, b
ld [$ffd7], a
ld a, c
ld [$ffad], a
ld bc, $707
predef FillBox
pop af
call Function17363
call Function32f9
jp WaitBGMap
Function1727f: ; 1727f (5:727f)
push hl
push de
push bc
callab Function8cf69
call DelayFrame
pop bc
pop de
pop hl
ret
Function1728f: ; 1728f (5:728f)
ld a, [$d265]
ld [$cf63], a
ld a, [CurSpecies] ; $cf60
push af
ld de, MUSIC_NONE
call PlayMusic
callba Function8000
call DisableLCD
ld hl, EggHatchGFX
ld de, $8000
ld bc, $20
ld a, BANK(EggHatchGFX)
call FarCopyBytes
callba Function8cf53
ld de, $9000
ld a, [$cf63]
call Function1723c
ld de, $9310
ld a, EGG
call Function17224
ld de, MUSIC_EVOLUTION
call PlayMusic
call EnableLCD
hlcoord 7, 4
ld b, $98
ld c, $31
ld a, EGG
call Function17254
ld c, $50
call DelayFrames
xor a
ld [$cf64], a
ld a, [hSCX] ; $ff00+$cf
ld b, a
.asm_172ee
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $8
jr nc, .asm_17327
ld e, [hl]
.asm_172f8
ld a, $2
ld [hSCX], a ; $ff00+$cf
ld a, $fe
ld [$c3c0], a
call Function1727f
ld c, $2
call DelayFrames
ld a, $fe
ld [hSCX], a ; $ff00+$cf
ld a, $2
ld [$c3c0], a
call Function1727f
ld c, $2
call DelayFrames
dec e
jr nz, .asm_172f8
ld c, $10
call DelayFrames
call Function1736d
jr .asm_172ee
.asm_17327
ld de, SFX_EGG_HATCH
call PlaySFX
xor a
ld [hSCX], a ; $ff00+$cf
ld [$c3c0], a
call ClearSprites
call Function173b3
hlcoord 6, 3
ld b, $98
ld c, $0
ld a, [$cf63]
call Function17254
call Function17418
call WaitSFX
ld a, [$cf63]
ld [CurPartySpecies], a ; $d108
hlcoord 6, 3
ld d, $0
ld e, $5
predef Functiond008e
pop af
ld [CurSpecies], a ; $cf60
ret
Function17363: ; 17363 (5:7363)
ld [PlayerHPPal], a ; $cd99
ld b, $b
ld c, $0
jp GetSGBLayout
Function1736d: ; 1736d (5:736d)
ld a, [$cf64]
dec a
and $7
cp $7
ret z
srl a
ret nc
swap a
srl a
add $4c
ld d, a
ld e, $58
ld a, $19
call Function3b2a
ld hl, $3
add hl, bc
ld [hl], $0
ld de, SFX_EGG_CRACK
jp PlaySFX
; 17393 (5:7393)
EggHatchGFX: ; 17393
INCBIN "baserom.gbc",$17393,$173b3 - $17393
; 173b3
Function173b3: ; 173b3 (5:73b3)
callba Function8cf53
ld hl, Unknown_173ef
.asm_173bc
ld a, [hli]
cp $ff
jr z, .asm_173e5
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
push hl
push bc
ld a, $1c
call Function3b2a
ld hl, $3
add hl, bc
ld [hl], $0
pop de
ld a, e
ld hl, $1
add hl, bc
add [hl]
ld [hl], a
ld hl, $b
add hl, bc
ld [hl], d
pop hl
jr .asm_173bc
.asm_173e5
ld de, SFX_EGG_HATCH
call PlaySFX
call Function1727f
ret
; 173ef (5:73ef)
Unknown_173ef: ; 173ef
; Probably OAM.
db $54, $48, $00, $3c
db $5c, $48, $01, $04
db $54, $50, $00, $30
db $5c, $50, $01, $10
db $54, $58, $02, $24
db $5c, $58, $03, $1c
db $50, $4c, $00, $36
db $60, $4c, $01, $0a
db $50, $54, $02, $2a
db $60, $54, $03, $16
db $ff
; 17418
Function17418: ; 17418 (5:7418)
ld c, $81
.asm_1741a
call Function1727f
dec c
jr nz, .asm_1741a
ret
Function17421: ; 17421
ld hl, UnknownText_0x17467
call PrintText
ld a, [wBreedMon1Species]
call PlayCry
ld a, [wDaycareLady]
bit 0, a
jr z, Function1745f
call Functionaaf
ld hl, wBreedMon2Nick
call Function1746c
jp PrintText
Function17440: ; 17440
ld hl, UnknownText_0x17462
call PrintText
ld a, [wBreedMon2Species]
call PlayCry
ld a, [wDaycareMan]
bit 0, a
jr z, Function1745f
call Functionaaf
ld hl, wBreedMon1Nick
call Function1746c
jp PrintText
Function1745f: ; 1745f
jp Functiona80
; 17462
UnknownText_0x17462: ; 0x17462
; It's @ that was left with the DAY-CARE LADY.
text_jump UnknownText_0x1c0df3
db "@"
; 0x17467
UnknownText_0x17467: ; 0x17467
; It's @ that was left with the DAY-CARE MAN.
text_jump UnknownText_0x1c0e24
db "@"
; 0x1746c
Function1746c: ; 1746c
push bc
ld de, StringBuffer1
ld bc, $000b
call CopyBytes
call Function16e1d
pop bc
ld a, [$d265]
ld hl, UnknownText_0x1749c
cp $ff
jr z, .asm_1749b
ld hl, UnknownText_0x174a1
and a
jr z, .asm_1749b
ld hl, UnknownText_0x174a6
cp 230
jr nc, .asm_1749b
cp 70
ld hl, UnknownText_0x174ab
jr nc, .asm_1749b
ld hl, UnknownText_0x174b0
.asm_1749b
ret
; 1749c
UnknownText_0x1749c: ; 0x1749c
; It's brimming with energy.
text_jump UnknownText_0x1c0e54
db "@"
; 0x174a1
UnknownText_0x174a1: ; 0x174a1
; It has no interest in @ .
text_jump UnknownText_0x1c0e6f
db "@"
; 0x174a6
UnknownText_0x174a6: ; 0x174a6
; It appears to care for @ .
text_jump UnknownText_0x1c0e8d
db "@"
; 0x174ab
UnknownText_0x174ab: ; 0x174ab
; It's friendly with @ .
text_jump UnknownText_0x1c0eac
db "@"
; 0x174b0
UnknownText_0x174b0: ; 0x174b0
; It shows interest in @ .
text_jump UnknownText_0x1c0ec6
db "@"
; 0x174b5
Function_174b5: ; 174b5
ld hl, String_174b9
ret
; 174b9
String_174b9: ; 174b9
db "@"
; 174ba
SECTION "Tileset Data 1", ROMX, BANK[TILESETS_1]
INCLUDE "tilesets/data_1.asm"
SECTION "Roofs", ROMX, BANK[ROOFS]
INCLUDE "tilesets/roofs.asm"
SECTION "Tileset Data 2", ROMX, BANK[TILESETS_2]
INCLUDE "tilesets/data_2.asm"
SECTION "bank8", ROMX, BANK[$8]
Function20000: ; 20000 (8:4000)
push hl
dec a
ld e, a
ld d, 0
ld hl, Unknown_20015
add hl, de
add hl, de
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
inc hl
ld b, [hl]
inc hl
ld c, [hl]
pop hl
ret
; 20015 (8:4015)
Unknown_20015: ; 20015
dw $d1ed
db $07, $04
dw $d1ee
db $18, $0c
dw $d1ef
db $3c, $0f
; 20021
Function20021: ; 20021 (8:4021)
ld hl, UnknownText_0x20047
call PrintText
ld hl, Options ; $cfcc
ld a, [hl]
push af
set 4, [hl]
call Function1d6e
call ClearTileMap
ld hl, UnknownText_0x2004c
call PrintText
call Function20051
call Function1c07
pop bc
ld hl, Options ; $cfcc
ld [hl], b
ld c, a
ret
; 20047 (8:4047)
UnknownText_0x20047: ; 0x20047
; The clock's time may be wrong. Please reset the time.
text_jump UnknownText_0x1c40e6
db "@"
; 0x2004c
UnknownText_0x2004c: ; 0x2004c
; Set with the Control Pad. Confirm: A Button Cancel: B Button
text_jump UnknownText_0x1c411c
db "@"
; 0x20051
Function20051: ; 20051 (8:4051)
ld a, $1
ld [Buffer1], a ; $d1ea (aliases: MagikarpLength)
ld [Buffer2], a ; $d1eb (aliases: MovementType)
ld a, $8
ld [$d1ec], a
call UpdateTime
call GetWeekday
ld [$d1ed], a
ld a, [hHours] ; $ff00+$94
ld [$d1ee], a
ld a, [hMinutes] ; $ff00+$96
ld [$d1ef], a
.asm_20071
call Function200ba
jr nc, .asm_20071
and a
ret nz
call Function2011f
ld hl, UnknownText_0x200b0
call PrintText
call YesNoBox
jr c, .asm_200ad
ld a, [$d1ed]
ld [StringBuffer2], a ; $d086
ld a, [$d1ee]
ld [$d087], a
ld a, [$d1ef]
ld [$d088], a
xor a
ld [$d089], a
call Function677
call Function2011f
ld hl, UnknownText_0x200b5
call PrintText
call Functiona80
xor a
ret
.asm_200ad
ld a, $1
ret
; 200b0 (8:40b0)
UnknownText_0x200b0: ; 0x200b0
; Is this OK?
text_jump UnknownText_0x1c415b
db "@"
; 0x200b5
UnknownText_0x200b5: ; 0x200b5
; The clock has been reset.
text_jump UnknownText_0x1c4168
db "@"
; 0x200ba
Function200ba: ; 200ba (8:40ba)
call Function354b
ld c, a
push af
call Function2011f
pop af
bit 0, a
jr nz, .asm_200dd
bit 1, a
jr nz, .asm_200e1
bit 6, a
jr nz, .asm_200e5
bit 7, a
jr nz, .asm_200f6
bit 5, a
jr nz, .asm_20108
bit 4, a
jr nz, .asm_20112
jr Function200ba
.asm_200dd
ld a, $0
scf
ret
.asm_200e1
ld a, $1
scf
ret
.asm_200e5
ld a, [Buffer1] ; $d1ea (aliases: MagikarpLength)
call Function20000
ld a, [de]
inc a
ld [de], a
cp b
jr c, .asm_2011d
ld a, $0
ld [de], a
jr .asm_2011d
.asm_200f6
ld a, [Buffer1] ; $d1ea (aliases: MagikarpLength)
call Function20000
ld a, [de]
dec a
ld [de], a
cp $ff
jr nz, .asm_2011d
ld a, b
dec a
ld [de], a
jr .asm_2011d
.asm_20108
ld hl, Buffer1 ; $d1ea (aliases: MagikarpLength)
dec [hl]
jr nz, .asm_2011d
ld [hl], $3
jr .asm_2011d
.asm_20112
ld hl, Buffer1 ; $d1ea (aliases: MagikarpLength)
inc [hl]
ld a, [hl]
cp $4
jr c, .asm_2011d
ld [hl], $1
.asm_2011d
xor a
ret
Function2011f: ; 2011f (8:411f)
hlcoord 0, 5
ld b, $5
ld c, $12
call TextBox
decoord 1, 8
ld a, [$d1ed]
ld b, a
callba Function5b05
ld a, [$d1ee]
ld b, a
ld a, [$d1ef]
ld c, a
decoord 11, 8
callba Function1dd6bb
ld a, [Buffer2] ; $d1eb (aliases: MovementType)
lb de, $7f, $7f
call Function20168
ld a, [Buffer1] ; $d1ea (aliases: MagikarpLength)
lb de, $61, $ee
call Function20168
ld a, [Buffer1] ; $d1ea (aliases: MagikarpLength)
ld [Buffer2], a ; $d1eb (aliases: MovementType)
ret
; 20160 (8:4160)
Function20160: ; 20160
ld a, [$d1ec]
ld b, a
call GetTileCoord
ret
; 20168
Function20168: ; 20168 (8:4168)
push de
call Function20000
ld a, [$d1ec]
dec a
ld b, a
call GetTileCoord
pop de
ld [hl], d
ld bc, $28
add hl, bc
ld [hl], e
ret
; 2017c (8:417c)
String_2017c: ; 2017c
db "じ@" ; HR
; 2017e
String_2017e: ; 2017e
db "ふん@" ; MIN
; 20181
SECTION "Tileset Data 3", ROMX, BANK[TILESETS_3]
INCLUDE "tilesets/data_3.asm"
SECTION "bank9", ROMX, BANK[$9]
Unknown_24000:: ; 24000
dw StringBuffer3
dw StringBuffer4
dw StringBuffer5
dw StringBuffer2
dw StringBuffer1
dw EnemyMonNick
dw BattleMonNick
; 2400e
Function2400e:: ; 2400e
ld hl, Function1c66
ld a, [$cf94]
rst FarCall
call Function24085
call Function1ad2
call Function321c
call Function2408f
ret
; 24022
Function24022:: ; 24022
ld hl, Function1c66
ld a, [$cf94]
rst FarCall
call Function24085
callba MobileTextBorder
call Function1ad2
call Function321c
call Function2408f
ret
; 2403c
Function2403c:: ; 2403c
ld hl, Function1c66
ld a, [$cf94]
rst FarCall
call Function24085
callba MobileTextBorder
call Function1ad2
call Function321c
call Function2411a
ld hl, $cfa5
set 7, [hl]
.asm_2405a
call DelayFrame
callba Function10032e
ld a, [$cd2b]
and a
jr nz, .asm_24076
call Function241ba
ld a, [$cfa8]
and c
jr z, .asm_2405a
call Function24098
ret
.asm_24076
ld a, [$cfa4]
ld c, a
ld a, [$cfa3]
call SimpleMultiply
ld [$cf88], a
and a
ret
; 24085
Function24085: ; 24085
xor a
ld [hBGMapMode], a
call Function1cbb
call Function240db
ret
; 2408f
Function2408f: ; 2408f
call Function2411a
call Function1bc9
call Function1ff8
Function24098: ; 24098
ld a, [$cf91]
bit 1, a
jr z, .asm_240a6
call Function1bdd
bit 2, a
jr nz, .asm_240c9
.asm_240a6
ld a, [$cf91]
bit 0, a
jr nz, .asm_240b4
call Function1bdd
bit 1, a
jr nz, .asm_240cb
.asm_240b4
ld a, [$cfa4]
ld c, a
ld a, [$cfa9]
dec a
call SimpleMultiply
ld c, a
ld a, [$cfaa]
add c
ld [$cf88], a
and a
ret
.asm_240c9
scf
ret
.asm_240cb
scf
ret
; 240cd
Function240cd: ; 240cd
ld a, [$cf92]
and $f
ret
; 240d3
Function240d3: ; 240d3
ld a, [$cf92]
swap a
and $f
ret
; 240db
Function240db: ; 240db
ld hl, $cf95
ld e, [hl]
inc hl
ld d, [hl]
call Function1cc6
call GetTileCoord
call Function240d3
ld b, a
.asm_240eb
push bc
push hl
call Function240cd
ld c, a
.asm_240f1
push bc
ld a, [$cf94]
call Function201c
inc de
ld a, [$cf93]
ld c, a
ld b, $0
add hl, bc
pop bc
dec c
jr nz, .asm_240f1
pop hl
ld bc, $0028
add hl, bc
pop bc
dec b
jr nz, .asm_240eb
ld hl, $cf98
ld a, [hli]
ld h, [hl]
ld l, a
or h
ret z
ld a, [$cf97]
rst FarCall
ret
; 2411a
Function2411a: ; 2411a (9:411a)
call Function1cc6
ld a, b
ld [$cfa1], a
dec c
ld a, c
ld [$cfa2], a
call Function240d3
ld [$cfa3], a
call Function240cd
ld [$cfa4], a
call Function24179
call Function2418a
call Function24193
ld a, [$cfa4]
ld e, a
ld a, [$cf88]
ld b, a
xor a
ld d, $0
.asm_24146
inc d
add e
cp b
jr c, .asm_24146
sub e
ld c, a
ld a, b
sub c
and a
jr z, .asm_24157
cp e
jr z, .asm_24159
jr c, .asm_24159
.asm_24157
ld a, $1
.asm_24159
ld [$cfaa], a
ld a, [$cfa3]
ld e, a
ld a, d
and a
jr z, .asm_24169
cp e
jr z, .asm_2416b
jr c, .asm_2416b
.asm_24169
ld a, $1
.asm_2416b
ld [$cfa9], a
xor a
ld [$cfab], a
ld [$cfac], a
ld [$cfad], a
ret
; 24179
Function24179: ; 24179
xor a
ld hl, $cfa5
ld [hli], a
ld [hld], a
ld a, [$cf91]
bit 5, a
ret z
set 5, [hl]
set 4, [hl]
ret
; 2418a
Function2418a: ; 2418a
ld a, [$cf93]
or $20
ld [$cfa7], a
ret
; 24193
Function24193: ; 24193
ld hl, $cf91
ld a, $1
bit 0, [hl]
jr nz, .asm_2419e
or $2
.asm_2419e
bit 1, [hl]
jr z, .asm_241a4
or $4
.asm_241a4
ld [$cfa8], a
ret
; 241a8
Function241a8:: ; 241a8
call Function24329
Function241ab:: ; 241ab
ld hl, $cfa6
res 7, [hl]
ld a, [hBGMapMode]
push af
call Function24216
pop af
ld [hBGMapMode], a
ret
; 241ba
Function241ba: ; 241ba
ld hl, $cfa6
res 7, [hl]
ld a, [hBGMapMode]
push af
call Function2431a
call Function24249
jr nc, .asm_241cd
call Function24270
.asm_241cd
pop af
ld [hBGMapMode], a
call Function1bdd
ld c, a
ret
; 241d5
Function241d5: ; 241d5
call Function24329
.asm_241d8
call Function2431a
call Function10402d ; BUG: This function is in a different bank.
call Function241fa
jr nc, .asm_241f9
call Function24270
jr c, .asm_241f9
ld a, [$cfa5]
bit 7, a
jr nz, .asm_241f9
call Function1bdd
ld c, a
ld a, [$cfa8]
and c
jr z, .asm_241d8
.asm_241f9
ret
; 241fa
Function241fa: ; 241fa
.asm_241fa
call Function24259
ret c
ld c, $1
ld b, $3
call $462d ; So does this one.
ret c
callba Function100337
ret c
ld a, [$cfa5]
bit 7, a
jr z, .asm_241fa
and a
ret
; 24216
Function24216: ; 24216
.asm_24216
call Function2431a
call Function24238
call Function24249
jr nc, .asm_24237
call Function24270
jr c, .asm_24237
ld a, [$cfa5]
bit 7, a
jr nz, .asm_24237
call Function1bdd
ld b, a
ld a, [$cfa8]
and b
jr z, .asm_24216
.asm_24237
ret
; 24238
Function24238: ; 24238
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
call WaitBGMap
pop af
ld [hOAMUpdate], a
xor a
ld [hBGMapMode], a
ret
; 24249
Function24249: ; 24249
.asm_24249
call RTC
call Function24259
ret c
ld a, [$cfa5]
bit 7, a
jr z, .asm_24249
and a
ret
; 24259
Function24259: ; 24259
ld a, [$cfa5]
bit 6, a
jr z, .asm_24266
callab Function8cf62
.asm_24266
call Functiona57
call Function1bdd
and a
ret z
scf
ret
; 24270
Function24270: ; 24270
call Function1bdd
bit 0, a
jp nz, Function24318
bit 1, a
jp nz, Function24318
bit 2, a
jp nz, Function24318
bit 3, a
jp nz, Function24318
bit 4, a
jr nz, .asm_242fa
bit 5, a
jr nz, .asm_242dc
bit 6, a
jr nz, .asm_242be
bit 7, a
jr nz, .asm_242a0
and a
ret
.asm_24299: ; 24299
ld hl, $cfa6
set 7, [hl]
scf
ret
.asm_242a0
ld hl, $cfa9
ld a, [$cfa3]
cp [hl]
jr z, .asm_242ac
inc [hl]
xor a
ret
.asm_242ac
ld a, [$cfa5]
bit 5, a
jr nz, .asm_242ba
bit 3, a
jp nz, .asm_24299
xor a
ret
.asm_242ba
ld [hl], $1
xor a
ret
.asm_242be
ld hl, $cfa9
ld a, [hl]
dec a
jr z, .asm_242c8
ld [hl], a
xor a
ret
.asm_242c8
ld a, [$cfa5]
bit 5, a
jr nz, .asm_242d6
bit 2, a
jp nz, .asm_24299
xor a
ret
.asm_242d6
ld a, [$cfa3]
ld [hl], a
xor a
ret
.asm_242dc
ld hl, $cfaa
ld a, [hl]
dec a
jr z, .asm_242e6
ld [hl], a
xor a
ret
.asm_242e6
ld a, [$cfa5]
bit 4, a
jr nz, .asm_242f4
bit 1, a
jp nz, .asm_24299
xor a
ret
.asm_242f4
ld a, [$cfa4]
ld [hl], a
xor a
ret
.asm_242fa
ld hl, $cfaa
ld a, [$cfa4]
cp [hl]
jr z, .asm_24306
inc [hl]
xor a
ret
.asm_24306
ld a, [$cfa5]
bit 4, a
jr nz, .asm_24314
bit 0, a
jp nz, .asm_24299
xor a
ret
.asm_24314
ld [hl], $1
xor a
ret
; 24318
Function24318: ; 24318
xor a
ret
; 2431a
Function2431a: ; 2431a
ld hl, $cfac
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
cp $ed
jr nz, Function24329
ld a, [$cfab]
ld [hl], a
Function24329: ; 24329
ld a, [$cfa1]
ld b, a
ld a, [$cfa2]
ld c, a
call GetTileCoord
ld a, [$cfa7]
swap a
and $f
ld c, a
ld a, [$cfa9]
ld b, a
xor a
dec b
jr z, .asm_24348
.asm_24344
add c
dec b
jr nz, .asm_24344
.asm_24348
ld c, $14
call AddNTimes
ld a, [$cfa7]
and $f
ld c, a
ld a, [$cfaa]
ld b, a
xor a
dec b
jr z, .asm_2435f
.asm_2435b
add c
dec b
jr nz, .asm_2435b
.asm_2435f
ld c, a
add hl, bc
ld a, [hl]
cp $ed
jr z, .asm_2436b
ld [$cfab], a
ld [hl], $ed
.asm_2436b
ld a, l
ld [$cfac], a
ld a, h
ld [$cfad], a
ret
; 24374
Function24374:: ; 24374
ld a, [rSVBK]
push af
ld a, $7
ld [rSVBK], a
ld hl, $cf71
ld e, [hl]
inc hl
ld d, [hl]
push de
ld b, $10
ld hl, $cf81
.asm_24387
ld a, [hli]
ld [de], a
dec de
dec b
jr nz, .asm_24387
ld a, [$cf81]
bit 6, a
jr nz, .asm_24398
bit 7, a
jr z, .asm_243ae
.asm_24398
ld hl, $cf71
ld a, [hli]
ld h, [hl]
ld l, a
set 0, [hl]
call Function1cfd
call Function243cd
call Function1d19
call Function243cd
jr .asm_243b5
.asm_243ae
pop hl
push hl
ld a, [hld]
ld l, [hl]
ld h, a
res 0, [hl]
.asm_243b5
pop hl
call Function243e7
ld a, h
ld [de], a
dec de
ld a, l
ld [de], a
dec de
ld hl, $cf71
ld [hl], e
inc hl
ld [hl], d
pop af
ld [rSVBK], a
ld hl, $cf78
inc [hl]
ret
; 243cd
Function243cd: ; 243cd
call Function1c53
inc b
inc c
call Function243e7
.asm_243d5
push bc
push hl
.asm_243d7
ld a, [hli]
ld [de], a
dec de
dec c
jr nz, .asm_243d7
pop hl
ld bc, $0014
add hl, bc
pop bc
dec b
jr nz, .asm_243d5
ret
; 243e7
Function243e7: ; 243e7
ret
; 243e8
Function243e8:: ; 243e8
xor a
ld [hBGMapMode], a
ld a, [rSVBK]
push af
ld a, $7
ld [rSVBK], a
call Function1c7e
ld a, l
or h
jp z, Function2445d
ld a, l
ld [$cf71], a
ld a, h
ld [$cf72], a
call Function1c47
ld a, [$cf81]
bit 0, a
jr z, .asm_24411
ld d, h
ld e, l
call Function1c23
.asm_24411
call Function1c7e
ld a, h
or l
jr z, .asm_2441b
call Function1c47
.asm_2441b
pop af
ld [rSVBK], a
ld hl, $cf78
dec [hl]
ret
; 24423
Function24423: ; 24423
ld a, [VramState]
bit 0, a
ret z
xor a
call GetSRAMBank
ld hl, TileMap
ld de, $a000
ld bc, $0168
call CopyBytes
call CloseSRAM
call Function2173
xor a
call GetSRAMBank
ld hl, $a000
ld de, TileMap
ld bc, $0168
.asm_2444c
ld a, [hl]
cp $61
jr c, .asm_24452
ld [de], a
.asm_24452
inc hl
inc de
dec bc
ld a, c
or b
jr nz, .asm_2444c
call CloseSRAM
ret
; 2445d
Function2445d: ; 2445d
ld hl, UnknownText_0x24468
call PrintText
call WaitBGMap
.asm_24466
jr .asm_24466
; 24468
UnknownText_0x24468: ; 24468
text_jump UnknownText_0x1c46b7
db "@"
; 2446d
Function2446d:: ; 2446d
ld a, [$cf91]
ld b, a
ld hl, $cfa1
ld a, [$cf82]
inc a
bit 6, b
jr nz, .asm_2447d
inc a
.asm_2447d
ld [hli], a
ld a, [$cf83]
inc a
ld [hli], a
ld a, [$cf92]
ld [hli], a
ld a, $1
ld [hli], a
ld [hl], $0
bit 5, b
jr z, .asm_24492
set 5, [hl]
.asm_24492
ld a, [$cf81]
bit 4, a
jr z, .asm_2449b
set 6, [hl]
.asm_2449b
inc hl
xor a
ld [hli], a
ld a, $20
ld [hli], a
ld a, $1
bit 0, b
jr nz, .asm_244a9
add $2
.asm_244a9
ld [hli], a
ld a, [$cf88]
and a
jr z, .asm_244b7
ld c, a
ld a, [$cf92]
cp c
jr nc, .asm_244b9
.asm_244b7
ld c, $1
.asm_244b9
ld [hl], c
inc hl
ld a, $1
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hli], a
ret
; 244c3
Function244c3: ; 0x244c3
ld a, [MenuSelection]
ld [CurSpecies], a
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
ld a, [MenuSelection]
cp $ff
ret z
decoord 1, 14
callba PrintItemDescription
ret
; 0x244e3
Function244e3:: ; 244e3
ld hl, MenuDataHeader_0x24547
call Function1d3c
call Function1cbb
call Function1ad2
call Function321c
ld b, $12
call GetSGBLayout
xor a
ld [hBGMapMode], a
ld a, [CurPartySpecies]
ld [CurSpecies], a
call GetBaseData
ld de, VTiles1
predef GetFrontpic
ld a, [$cf82]
inc a
ld b, a
ld a, [$cf83]
inc a
ld c, a
call GetTileCoord
ld a, $80
ld [$ffad], a
ld bc, $0707
predef FillBox
call WaitBGMap
ret
; 24528
Function24528:: ; 24528
ld hl, MenuDataHeader_0x24547
call Function1d3c
call Function1ce1
call WaitBGMap
call ClearSGB
xor a
ld [hBGMapMode], a
call Function2173
call Function321c
call Function1ad2
call Functione51
ret
; 24547
MenuDataHeader_0x24547: ; 0x24547
db $40 ; flags
db 04, 06 ; start coords
db 13, 14 ; end coords
dw NULL
db 1 ; default option
; 0x2454f
Function2454f: ; 2454f
ld hl, $d81e
xor a
ld bc, $10
call ByteFill
nop
ld bc, MapObjects ; $d71e
ld de, $d81e
xor a
.asm_24561
push af
push bc
push de
call Function245a7
jr c, .asm_2456c
call Function2457d
.asm_2456c
pop de
ld [de], a
inc de
pop bc
ld hl, $10
add hl, bc
ld b, h
ld c, l
pop af
inc a
cp $10
jr nz, .asm_24561
ret
Function2457d: ; 2457d (9:457d)
ld hl, $1
add hl, bc
ld a, [hl]
and a
jr z, .asm_245a3
ld hl, $c
add hl, bc
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
cp $ff
jr nz, .asm_24598
ld a, e
cp $ff
jr z, .asm_245a1
jr .asm_245a3
.asm_24598
ld b, $2
call EventFlagAction
ld a, c
and a
jr nz, .asm_245a3
.asm_245a1
xor a
ret
.asm_245a3
ld a, $ff
scf
ret
Function245a7: ; 245a7 (9:45a7)
call Function18f5
ld a, $ff
ret c
xor a
ret
Function245af:: ; 245af
xor a
ld [$cf73], a
ld [hBGMapMode], a
inc a
ld [$ffaa], a
call Function2471a
call Function24764
call Function247dd
call Function245f1
call Function321c
xor a
ld [hBGMapMode], a
ret
; 245cb
Function245cb:: ; 245cb
.asm_245cb
call Function24609
jp c, Function245d6
call z, Function245e1
jr .asm_245cb
; 245d6
Function245d6: ; 245d6
call Function1ff8
ld [$cf73], a
ld a, $0
ld [$ffaa], a
ret
; 245e1
Function245e1: ; 245e1
call Function245f1
ld a, $1
ld [hBGMapMode], a
ld c, $3
call DelayFrames
xor a
ld [hBGMapMode], a
ret
; 245f1
Function245f1: ; 245f1
xor a
ld [hBGMapMode], a
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
call Function247f0
call Function2488b
call Function248b8
pop af
ld [Options], a
ret
; 24609
Function24609: ; 24609
.asm_24609
call Function1bd3
ld a, [$ffa9]
and $f0
ld b, a
ld a, [hJoyPressed]
and $f
or b
bit 0, a
jp nz, Function24644
bit 1, a
jp nz, Function2466f
bit 2, a
jp nz, Function24673
bit 3, a
jp nz, Function24695
bit 4, a
jp nz, Function246b5
bit 5, a
jp nz, Function246a1
bit 6, a
jp nz, Function246c9
bit 7, a
jp nz, Function246df
jr .asm_24609
; 24640
Function24640: ; 24640
ld a, $ff
and a
ret
; 24644
Function24644: ; 24644
call Function1bee
ld a, [$cfa9]
dec a
call Function248d5
ld a, [MenuSelection]
ld [CurItem], a
ld a, [$cf75]
ld [$d10d], a
call Function246fc
dec a
ld [$cf77], a
ld [$d107], a
ld a, [MenuSelection]
cp $ff
jr z, Function2466f
ld a, $1
scf
ret
; 2466f
Function2466f: ; 2466f
ld a, $2
scf
ret
; 24673
Function24673: ; 24673
ld a, [$cf91]
bit 7, a
jp z, Function2ec8
ld a, [$cfa9]
dec a
call Function248d5
ld a, [MenuSelection]
cp $ff
jp z, Function2ec8
call Function246fc
dec a
ld [$cf77], a
ld a, $4
scf
ret
; 24695
Function24695: ; 24695
ld a, [$cf91]
bit 6, a
jp z, Function2ec8
ld a, $8
scf
ret
; 246a1
Function246a1: ; 246a1
ld hl, $cfa6
bit 7, [hl]
jp z, Function2ec8
ld a, [$cf91]
bit 3, a
jp z, Function2ec8
ld a, $20
scf
ret
; 246b5
Function246b5: ; 246b5
ld hl, $cfa6
bit 7, [hl]
jp z, Function2ec8
ld a, [$cf91]
bit 2, a
jp z, Function2ec8
ld a, $10
scf
ret
; 246c9
Function246c9: ; 246c9
ld hl, $cfa6
bit 7, [hl]
jp z, Function2ec6
ld hl, $d0e4
ld a, [hl]
and a
jr z, .asm_246dc
dec [hl]
jp Function2ec6
.asm_246dc
jp Function2ec8
; 246df
Function246df: ; 246df
ld hl, $cfa6
bit 7, [hl]
jp z, Function2ec6
ld hl, $d0e4
ld a, [$cf92]
add [hl]
ld b, a
ld a, [$d144]
cp b
jr c, .asm_246f9
inc [hl]
jp Function2ec6
.asm_246f9
jp Function2ec8
; 246fc
Function246fc: ; 246fc
ld a, [$d0e4]
ld c, a
ld a, [$cfa9]
add c
ld c, a
ret
; 24706
Function24706: ; 24706 (9:4706)
call Function1cfd
ld de, $14
add hl, de
ld de, $28
ld a, [$cf92]
.asm_24713
ld [hl], $7f
add hl, de
dec a
jr nz, .asm_24713
ret
Function2471a: ; 2471a
ld hl, $cf96
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$cf95]
call GetFarByte
ld [$d144], a
ld a, [$cf92]
ld c, a
ld a, [$d0e4]
add c
ld c, a
ld a, [$d144]
inc a
cp c
jr nc, .asm_24748
ld a, [$cf92]
ld c, a
ld a, [$d144]
inc a
sub c
jr nc, .asm_24745
xor a
.asm_24745
ld [$d0e4], a
.asm_24748
ld a, [$d0e4]
ld c, a
ld a, [$cf88]
add c
ld b, a
ld a, [$d144]
inc a
cp b
jr c, .asm_2475a
jr nc, .asm_24763
.asm_2475a
xor a
ld [$d0e4], a
ld a, $1
ld [$cf88], a
.asm_24763
ret
; 24764
Function24764: ; 24764
ld a, [$cf91]
ld c, a
ld a, [$d144]
ld b, a
ld a, [$cf82]
add $1
ld [$cfa1], a
ld a, [$cf83]
add $0
ld [$cfa2], a
ld a, [$cf92]
cp b
jr c, .asm_24786
jr z, .asm_24786
ld a, b
inc a
.asm_24786
ld [$cfa3], a
ld a, $1
ld [$cfa4], a
ld a, $8c
bit 2, c
jr z, .asm_24796
set 0, a
.asm_24796
bit 3, c
jr z, .asm_2479c
set 1, a
.asm_2479c
ld [$cfa5], a
xor a
ld [$cfa6], a
ld a, $20
ld [$cfa7], a
ld a, $c3
bit 7, c
jr z, .asm_247b0
add $4
.asm_247b0
bit 6, c
jr z, .asm_247b6
add $8
.asm_247b6
ld [$cfa8], a
ld a, [$cfa3]
ld b, a
ld a, [$cf88]
and a
jr z, .asm_247c8
cp b
jr z, .asm_247ca
jr c, .asm_247ca
.asm_247c8
ld a, $1
.asm_247ca
ld [$cfa9], a
ld a, $1
ld [$cfaa], a
xor a
ld [$cfac], a
ld [$cfad], a
ld [$cfab], a
ret
; 247dd
Function247dd: ; 247dd
ld a, [$d144]
ld c, a
ld a, [$d0e3]
and a
jr z, .asm_247ef
dec a
cp c
jr c, .asm_247ef
xor a
ld [$d0e3], a
.asm_247ef
ret
; 247f0
Function247f0: ; 247f0
call Function1cf1
ld a, [$cf91]
bit 4, a
jr z, .asm_2480d
ld a, [$d0e4]
and a
jr z, .asm_2480d
ld a, [$cf82]
ld b, a
ld a, [$cf85]
ld c, a
call GetTileCoord
ld [hl], $61
.asm_2480d
call Function1cfd
ld bc, $0015
add hl, bc
ld a, [$cf92]
ld b, a
ld c, $0
.asm_2481a
ld a, [$d0e4]
add c
ld [$cf77], a
ld a, c
call Function248d5
ld a, [MenuSelection]
cp $ff
jr z, .asm_24851
push bc
push hl
call Function2486e
pop hl
ld bc, $0028
add hl, bc
pop bc
inc c
ld a, c
cp b
jr nz, .asm_2481a
ld a, [$cf91]
bit 4, a
jr z, .asm_24850
ld a, [$cf84]
ld b, a
ld a, [$cf85]
ld c, a
call GetTileCoord
ld [hl], $ee
.asm_24850
ret
.asm_24851
ld a, [$cf91]
bit 0, a
jr nz, .asm_24866
ld de, .string_2485f
call PlaceString
ret
.string_2485f
db "CANCEL@"
.asm_24866
ld d, h
ld e, l
ld hl, $cf98
jp CallPointerAt
; 2486e
Function2486e: ; 2486e
push hl
ld d, h
ld e, l
ld hl, $cf98
call CallPointerAt
pop hl
ld a, [$cf93]
and a
jr z, .asm_2488a
ld e, a
ld d, $0
add hl, de
ld d, h
ld e, l
ld hl, $cf9b
call CallPointerAt
.asm_2488a
ret
; 2488b
Function2488b: ; 2488b
ld a, [$d0e3]
and a
jr z, .asm_248b7
ld b, a
ld a, [$d0e4]
cp b
jr nc, .asm_248b7
ld c, a
ld a, [$cf92]
add c
cp b
jr c, .asm_248b7
ld a, b
sub c
dec a
add a
add $1
ld c, a
ld a, [$cf82]
add c
ld b, a
ld a, [$cf83]
add $0
ld c, a
call GetTileCoord
ld [hl], $ec
.asm_248b7
ret
; 248b8
Function248b8: ; 248b8
ld a, [$cf91]
bit 5, a
ret z
bit 1, a
jr z, .asm_248c7
ld a, [$d0e3]
and a
ret nz
.asm_248c7
ld a, [$cfa9]
dec a
call Function248d5
ld hl, $cf9e
call CallPointerAt
ret
; 248d5
Function248d5: ; 248d5
push de
push hl
ld e, a
ld a, [$d0e4]
add e
ld e, a
ld d, $0
ld hl, $cf96
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
ld a, [$cf94]
cp $1
jr z, .asm_248f2
cp $2
jr z, .asm_248f1
.asm_248f1
add hl, de
.asm_248f2
add hl, de
ld a, [$cf95]
call GetFarByte
ld [MenuSelection], a
ld [CurItem], a
inc hl
ld a, [$cf95]
call GetFarByte
ld [$cf75], a
pop hl
pop de
ret
; 2490c
Function2490c: ; 2490c (9:490c)
ld a, [$d0e3]
and a
jr z, .asm_2493d
ld b, a
ld a, [$cf77]
inc a
cp b
jr z, .asm_24945
ld a, [$cf77]
call Function24a5c
ld a, [hl]
cp $ff
ret z
ld a, [$d0e3]
dec a
ld [$d0e3], a
call Function249a7
jp c, Function249d1
ld a, [$cf77]
ld c, a
ld a, [$d0e3]
cp c
jr c, .asm_2497a
jr .asm_2494a
.asm_2493d
ld a, [$cf77]
inc a
ld [$d0e3], a
ret
.asm_24945
xor a
ld [$d0e3], a
ret
.asm_2494a
ld a, [$d0e3]
call Function24a40
ld a, [$cf77]
ld d, a
ld a, [$d0e3]
ld e, a
call Function24a6c
push bc
ld a, [$d0e3]
call Function24a5c
dec hl
push hl
call Function24a80
add hl, bc
ld d, h
ld e, l
pop hl
pop bc
call Function24aab
ld a, [$cf77]
call Function24a4d
xor a
ld [$d0e3], a
ret
.asm_2497a
ld a, [$d0e3]
call Function24a40
ld a, [$cf77]
ld d, a
ld a, [$d0e3]
ld e, a
call Function24a6c
push bc
ld a, [$d0e3]
call Function24a5c
ld d, h
ld e, l
call Function24a80
add hl, bc
pop bc
call CopyBytes
ld a, [$cf77]
call Function24a4d
xor a
ld [$d0e3], a
ret
Function249a7: ; 249a7 (9:49a7)
ld a, [$d0e3]
call Function24a5c
ld d, h
ld e, l
ld a, [$cf77]
call Function24a5c
ld a, [de]
cp [hl]
jr nz, .asm_249cd
ld a, [$cf77]
call Function24a97
cp $63
jr z, .asm_249cd
ld a, [$d0e3]
call Function24a97
cp $63
jr nz, .asm_249cf
.asm_249cd
and a
ret
.asm_249cf
scf
ret
Function249d1: ; 249d1 (9:49d1)
ld a, [$d0e3]
call Function24a5c
inc hl
push hl
ld a, [$cf77]
call Function24a5c
inc hl
ld a, [hl]
pop hl
add [hl]
cp $64
jr c, .asm_24a01
sub $63
push af
ld a, [$cf77]
call Function24a5c
inc hl
ld [hl], $63
ld a, [$d0e3]
call Function24a5c
inc hl
pop af
ld [hl], a
xor a
ld [$d0e3], a
ret
.asm_24a01
push af
ld a, [$cf77]
call Function24a5c
inc hl
pop af
ld [hl], a
ld hl, $cf96
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$d0e3]
cp [hl]
jr nz, .asm_24a25
dec [hl]
ld a, [$d0e3]
call Function24a5c
ld [hl], $ff
xor a
ld [$d0e3], a
ret
.asm_24a25
dec [hl]
call Function24a80
push bc
ld a, [$d0e3]
call Function24a5c
pop bc
push hl
add hl, bc
pop de
.asm_24a34
ld a, [hli]
ld [de], a
inc de
cp $ff
jr nz, .asm_24a34
xor a
ld [$d0e3], a
ret
Function24a40: ; 24a40 (9:4a40)
call Function24a5c
ld de, DefaultFlypoint ; $d002
call Function24a80
call CopyBytes
ret
Function24a4d: ; 24a4d (9:4a4d)
call Function24a5c
ld d, h
ld e, l
ld hl, DefaultFlypoint ; $d002
call Function24a80
call CopyBytes
ret
Function24a5c: ; 24a5c (9:4a5c)
push af
call Function24a80
ld hl, $cf96
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
pop af
call AddNTimes
ret
Function24a6c: ; 24a6c (9:4a6c)
push hl
call Function24a80
ld a, d
sub e
jr nc, .asm_24a76
dec a
cpl
.asm_24a76
ld hl, $0
call AddNTimes
ld b, h
ld c, l
pop hl
ret
Function24a80: ; 24a80 (9:4a80)
push hl
ld a, [$cf94]
ld c, a
ld b, 0
ld hl, Unknown_24a91
add hl, bc
add hl, bc
ld c, [hl]
inc hl
ld b, [hl]
pop hl
ret
; 24a91 (9:4a91)
Unknown_24a91: ; 24a91
dw 0, 1, 2
; 24a97
Function24a97: ; 24a97 (9:4a97)
push af
call Function24a80
ld a, c
cp $2
jr nz, .asm_24aa7
pop af
call Function24a5c
inc hl
ld a, [hl]
ret
.asm_24aa7
pop af
ld a, $1
ret
Function24aab: ; 24aab (9:4aab)
ld a, [hld]
ld [de], a
dec de
dec bc
ld a, b
or c
jr nz, Function24aab
ret
Function24ab4: ; 0x24ab4
push de
ld a, [MenuSelection]
ld [$d265], a
call GetItemName
pop hl
call PlaceString
ret
; 0x24ac3
Function24ac3: ; 0x24ac3
push de
ld a, [MenuSelection]
ld [CurItem], a
callba _CheckTossableItem
ld a, [$d142]
pop hl
and a
jr nz, .done
ld de, $0015
add hl, de
ld [hl], $f1
inc hl
ld de, $cf75
ld bc, $0102
call PrintNum
.done
ret
; 0x24ae8
Function24ae8: ; 24ae8
ld hl, MenuDataHeader_0x24b15
call Function1d3c
jr Function24b01
Function24af0: ; 24af0
ld hl, MenuDataHeader_0x24b1d
call Function1d3c
jr Function24b01
Function24af8: ; 24af8
ld hl, MenuDataHeader_0x24b15
ld de, $000b
call Function1e2e
Function24b01: ; 24b01
call Function1cbb
call Function1cfd
ld de, $0015
add hl, de
ld de, Money
ld bc, $2306
call PrintNum
ret
; 24b15
MenuDataHeader_0x24b15: ; 0x24b15
db $40 ; flags
db 00, 11 ; start coords
db 02, 19 ; end coords
dw NULL
db 1 ; default option
; 0x24b1d
MenuDataHeader_0x24b1d: ; 0x24b1d
db $40 ; flags
db 11, 00 ; start coords
db 13, 08 ; end coords
dw NULL
db 1 ; default option
; 0x24b25
Function24b25: ; 24b25
hlcoord 11, 0
ld b, $1
ld c, $7
call TextBox
hlcoord 12, 0
ld de, CoinString
call PlaceString
hlcoord 17, 1
ld de, String24b8e
call PlaceString
ld de, Coins
ld bc, $0204
hlcoord 13, 1
call PrintNum
ret
; 24b4e
Function24b4e: ; 24b4e
hlcoord 5, 0
ld b, $3
ld c, $d
call TextBox
hlcoord 6, 1
ld de, MoneyString
call PlaceString
hlcoord 12, 1
ld de, Money
ld bc, $2306
call PrintNum
hlcoord 6, 3
ld de, CoinString
call PlaceString
hlcoord 15, 3
ld de, Coins
ld bc, $0204
call PrintNum
ret
; 24b83
MoneyString: ; 24b83
db "MONEY@"
CoinString: ; 24b89
db "COIN@"
String24b8e: ; 24b8e
db "@"
; 24b8f
Function24b8f: ; 24b8f
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
ld hl, TileMap
ld b, $3
ld c, $7
call TextBox
hlcoord 1, 1
ld de, $dc7a
ld bc, $0203
call PrintNum
hlcoord 4, 1
ld de, String24bcf
call PlaceString
hlcoord 1, 3
ld de, String24bd4
call PlaceString
hlcoord 5, 3
ld de, $dc79
ld bc, $0102
call PrintNum
pop af
ld [Options], a
ret
; 24bcf
String24bcf: ; 24bcf
db "/500@"
String24bd4: ; 24bd4
db "ボール こ@"
; 24bdc
Function24bdc: ; 24bdc
ld hl, TileMap
ld b, $5
ld c, $11
call TextBox
ret
; 24be7
Function24be7: ; 24be7
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
call Function24bdc
hlcoord 1, 5
ld de, String24c52
call PlaceString
hlcoord 8, 5
ld de, $dc79
ld bc, $4102
call PrintNum
hlcoord 1, 1
ld de, String24c4b
call PlaceString
ld a, [$df9c]
and a
ld de, String24c59
jr z, .asm_24c1e
ld [$d265], a
call GetPokemonName
.asm_24c1e
hlcoord 8, 1
call PlaceString
ld a, [$df9c]
and a
jr z, .asm_24c3e
hlcoord 1, 3
ld de, String24c5e
call PlaceString
ld a, [$dfbb]
ld h, b
ld l, c
inc hl
ld c, $3
call Function3842
.asm_24c3e
pop af
ld [Options], a
ret
; 24c43
String24c43: ; 24c43
db "ボール こ@"
String24c4b: ; 24c4b
db "CAUGHT@"
String24c52: ; 24c52
db "BALLS:@"
String24c59: ; 24c59
db "None@"
String24c5e: ; 24c5e
db "LEVEL@"
; 24c64
Function24c64: ; 24c64
ld hl, Buffer1
xor a
ld [hli], a
dec a
ld bc, $000a
call ByteFill
ld hl, ApricornBalls
.asm_24c73
ld a, [hl]
cp $ff
jr z, .asm_24c8d
push hl
ld [CurItem], a
ld hl, NumItems
call CheckItem
pop hl
jr nc, .asm_24c89
ld a, [hl]
call Function24c94
.asm_24c89
inc hl
inc hl
jr .asm_24c73
.asm_24c8d
ld a, [Buffer1]
and a
ret nz
scf
ret
; 24c94
Function24c94: ; 24c94
push hl
ld hl, Buffer1
inc [hl]
ld e, [hl]
ld d, 0
add hl, de
ld [hl], a
pop hl
ret
; 24ca0
ApricornBalls: ; 24ca0
db RED_APRICORN, LEVEL_BALL
db BLU_APRICORN, LURE_BALL
db YLW_APRICORN, MOON_BALL
db GRN_APRICORN, FRIEND_BALL
db WHT_APRICORN, FAST_BALL
db BLK_APRICORN, HEAVY_BALL
db PNK_APRICORN, LOVE_BALL
db $ff
; 24caf
MonMenuOptionStrings: ; 24caf
db "STATS@"
db "SWITCH@"
db "ITEM@"
db "CANCEL@"
db "MOVE@"
db "MAIL@"
db "ERROR!@"
; 24cd9
MonMenuOptions: ; 24cd9
; Moves
db 0, 1, CUT
db 0, 2, FLY
db 0, 3, SURF
db 0, 4, STRENGTH
db 0, 6, FLASH
db 0, 5, WATERFALL
db 0, 7, WHIRLPOOL
db 0, 8, DIG
db 0, 9, TELEPORT
db 0, 10, SOFTBOILED
db 0, 11, HEADBUTT
db 0, 12, ROCK_SMASH
db 0, 13, MILK_DRINK
db 0, 14, SWEET_SCENT
; Options
db 1, 15, 1 ; STATS
db 1, 16, 2 ; SWITCH
db 1, 17, 3 ; ITEM
db 1, 18, 4 ; CANCEL
db 1, 19, 5 ; MOVE
db 1, 20, 6 ; MAIL
db 1, 21, 7 ; ERROR!
db $ff
; 24d19
Function24d19: ; 24d19
xor a
ld [hBGMapMode], a
call Function24dd4
callba Function8ea4a
ld hl, MenuDataHeader_0x24d3f
call LoadMenuDataHeader
call Function24d47
call Function24d91
ld a, 1
ld [hBGMapMode], a
call Function24d59
ld [MenuSelection], a
call Function1c07
ret
; 24d3f
MenuDataHeader_0x24d3f: ; 24d3f
db $40 ; tile backup
db 00, 06 ; start coords
db 17, 19 ; end coords
dw $0000
db 1 ; default option
; 24d47
Function24d47: ; 24d47
ld a, [Buffer1]
inc a
add a
ld b, a
ld a, [$cf84]
sub b
inc a
ld [$cf82], a
call Function1cbb
ret
; 24d59
Function24d59: ; 24d59
.asm_24d59
ld a, $a0
ld [$cf91], a
ld a, [Buffer1]
ld [$cf92], a
call Function1c10
ld hl, $cfa5
set 6, [hl]
call Function1bc9
ld de, SFX_READ_TEXT_2
call PlaySFX
ld a, [hJoyPressed]
bit 0, a ; A
jr nz, .asm_24d84
bit 1, a ; B
jr nz, .asm_24d81
jr .asm_24d59
.asm_24d81
ld a, 18 ; CANCEL
ret
.asm_24d84
ld a, [$cfa9]
dec a
ld c, a
ld b, 0
ld hl, Buffer2
add hl, bc
ld a, [hl]
ret
; 24d91
Function24d91: ; 24d91
call Function1cfd
ld bc, $002a
add hl, bc
ld de, Buffer2
.asm_24d9b
ld a, [de]
inc de
cp $ff
ret z
push de
push hl
call Function24db0
pop hl
call PlaceString
ld bc, $0028
add hl, bc
pop de
jr .asm_24d9b
; 24db0
Function24db0: ; 24db0
ld hl, MonMenuOptions + 1
ld de, $0003
call IsInArray
dec hl
ld a, [hli]
cp $1
jr z, .asm_24dc8
inc hl
ld a, [hl]
ld [$d265], a
call GetMoveName
ret
.asm_24dc8
inc hl
ld a, [hl]
dec a
ld hl, MonMenuOptionStrings
call GetNthString
ld d, h
ld e, l
ret
; 24dd4
Function24dd4: ; 24dd4
call Function24e68
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_24e3f
ld a, [InLinkBattle]
and a
jr nz, .asm_24e03
ld a, $2
call GetPartyParamLocation
ld d, h
ld e, l
ld c, $4
.asm_24ded
push bc
push de
ld a, [de]
and a
jr z, .asm_24dfd
push hl
call Function24e52
pop hl
jr nc, .asm_24dfd
call Function24e83
.asm_24dfd
pop de
inc de
pop bc
dec c
jr nz, .asm_24ded
.asm_24e03
ld a, $f
call Function24e83
ld a, $10
call Function24e83
ld a, $13
call Function24e83
ld a, [InLinkBattle]
and a
jr nz, .asm_24e2f
push hl
ld a, $1
call GetPartyParamLocation
ld d, [hl]
callba ItemIsMail
pop hl
ld a, $14
jr c, .asm_24e2c
ld a, $11
.asm_24e2c
call Function24e83
.asm_24e2f
ld a, [Buffer1]
cp $8
jr z, .asm_24e3b
ld a, $12
call Function24e83
.asm_24e3b
call Function24e76
ret
.asm_24e3f
ld a, $f
call Function24e83
ld a, $10
call Function24e83
ld a, $12
call Function24e83
call Function24e76
ret
; 24e52
Function24e52: ; 24e52
ld b, a
ld hl, MonMenuOptions
.asm_24e56
ld a, [hli]
cp $ff
jr z, .asm_24e67
cp $1
jr z, .asm_24e67
ld d, [hl]
inc hl
ld a, [hli]
cp b
jr nz, .asm_24e56
ld a, d
scf
.asm_24e67
ret
; 24e68
Function24e68: ; 24e68
xor a
ld [Buffer1], a
ld hl, Buffer2
ld bc, $0009
call ByteFill
ret
; 24e76
Function24e76: ; 24e76
ld a, [Buffer1]
ld e, a
ld d, $0
ld hl, Buffer2
add hl, de
ld [hl], $ff
ret
; 24e83
Function24e83: ; 24e83
push hl
push de
push af
ld a, [Buffer1]
ld e, a
inc a
ld [Buffer1], a
ld d, $0
ld hl, Buffer2
add hl, de
pop af
ld [hl], a
pop de
pop hl
ret
; 24e99
Function24e99: ; 24e99
; BattleMonMenu
ld hl, MenuDataHeader_0x24ed4
call Function1d3c
xor a
ld [hBGMapMode], a
call Function1cbb
call Function1ad2
call Function1c89
call WaitBGMap
call Function1c66
ld a, [$cf91]
bit 7, a
jr z, .asm_24ed0
call Function1c10
ld hl, $cfa5
set 6, [hl]
call Function1bc9
ld de, SFX_READ_TEXT_2
call PlaySFX
ld a, [hJoyPressed]
bit 1, a
jr z, .asm_24ed2
ret z
.asm_24ed0
scf
ret
.asm_24ed2
and a
ret
; 24ed4
MenuDataHeader_0x24ed4: ; 24ed4
db $00 ; flags
db 11, 11 ; start coords
db 17, 19 ; end coords
dw MenuData2_0x24edc
db 1 ; default option
; 24edc
MenuData2_0x24edc: ; 24edc
db $c0 ; flags
db 3 ; items
db "SWITCH@"
db "STATS@"
db "CANCEL@"
; 24ef2
LoadBattleMenu: ; 24ef2
ld hl, BattleMenuDataHeader
call LoadMenuDataHeader
ld a, [$d0d2]
ld [$cf88], a
call Function2039
ld a, [$cf88]
ld [$d0d2], a
call Function1c07
ret
; 24f0b
SafariBattleMenu: ; 24f0b
; untranslated
ld hl, MenuDataHeader_0x24f4e
call LoadMenuDataHeader
jr Function24f19
; 24f13
ContestBattleMenu: ; 24f13
ld hl, MenuDataHeader_0x24f89
call LoadMenuDataHeader
; 24f19
Function24f19: ; 24f19
ld a, [$d0d2]
ld [$cf88], a
call Function202a
ld a, [$cf88]
ld [$d0d2], a
call Function1c07
ret
; 24f2c
BattleMenuDataHeader: ; 24f2c
db $40 ; flags
db 12, 08 ; start coords
db 17, 19 ; end coords
dw MenuData_0x24f34
db 1 ; default option
; 24f34
MenuData_0x24f34: ; 0x24f34
db $81 ; flags
dn 2, 2 ; rows, columns
db 6 ; spacing
dbw BANK(Strings24f3d), Strings24f3d
dbw $09, $0000
; 0x24f3d
Strings24f3d: ; 0x24f3d
db "FIGHT@"
db $4a, "@"
db "PACK@"
db "RUN@"
; 24f4e
MenuDataHeader_0x24f4e: ; 24f4e
db $40 ; flags
db 12, 00 ; start coords
db 17, 19 ; end coords
dw MenuData_0x24f56
db 1 ; default option
; 24f56
MenuData_0x24f56: ; 24f56
db $81 ; flags
dn 2, 2 ; rows, columns
db 11 ; spacing
dbw BANK(Strings24f5f), Strings24f5f
dbw BANK(Function24f7c), Function24f7c
; 24f5f
Strings24f5f: ; 24f5f
db "サファりボール× @" ; "SAFARI BALL× @"
db "エサをなげる@" ; "THROW BAIT"
db "いしをなげる@" ; "THROW ROCK"
db "にげる@" ; "RUN"
; 24f7c
Function24f7c: ; 24f7c
hlcoord 17, 13
ld de, $dc79
ld bc, $8102
call PrintNum
ret
; 24f89
MenuDataHeader_0x24f89: ; 24f89
db $40 ; flags
db 12, 02 ; start coords
db 17, 19 ; end coords
dw MenuData_0x24f91
db 1 ; default option
; 24f91
MenuData_0x24f91: ; 24f91
db $81 ; flags
dn 2, 2 ; rows, columns
db 12 ; spacing
dbw BANK(Strings24f9a), Strings24f9a
dbw BANK(Function24fb2), Function24fb2
; 24f9a
Strings24f9a: ; 24f9a
db "FIGHT@"
db $4a, "@"
db "PARKBALL× @"
db "RUN@"
; 24fb2
Function24fb2: ; 24fb2
hlcoord 13, 16
ld de, $dc79
ld bc, $8102
call PrintNum
ret
; 24fbf
Function24fbf: ; 24fbf
ld hl, MenuDataHeader_0x250ed
call LoadMenuDataHeader
call Function24ff9
ret
; 24fc9
Function24fc9: ; 24fc9
callba GetItemPrice
Function24fcf: ; 24fcf
ld a, d
ld [Buffer1], a
ld a, e
ld [Buffer2], a
ld hl, MenuDataHeader_0x250f5
call LoadMenuDataHeader
call Function24ff9
ret
; 24fe1
Function24fe1: ; 24fe1
callba GetItemPrice
ld a, d
ld [Buffer1], a
ld a, e
ld [Buffer2], a
ld hl, MenuDataHeader_0x250fd
call LoadMenuDataHeader
call Function24ff9
ret
; 24ff9
Function24ff9: ; 24ff9
ld a, $1
ld [$d10c], a
.asm_24ffe
call Function25072
call Function2500e
jr nc, .asm_24ffe
cp $ff
jr nz, .asm_2500c
scf
ret
.asm_2500c
and a
ret
; 2500e
Function2500e: ; 2500e
call Function354b
bit 1, c
jr nz, .asm_2502b
bit 0, c
jr nz, .asm_2502f
bit 7, c
jr nz, .asm_25033
bit 6, c
jr nz, .asm_2503f
bit 5, c
jr nz, .asm_2504d
bit 4, c
jr nz, .asm_2505f
and a
ret
.asm_2502b
ld a, $ff
scf
ret
.asm_2502f
ld a, $0
scf
ret
.asm_25033
ld hl, $d10c
dec [hl]
jr nz, .asm_2503d
ld a, [$d10d]
ld [hl], a
.asm_2503d
and a
ret
.asm_2503f
ld hl, $d10c
inc [hl]
ld a, [$d10d]
cp [hl]
jr nc, .asm_2504b
ld [hl], $1
.asm_2504b
and a
ret
.asm_2504d
ld a, [$d10c]
sub $a
jr c, .asm_25058
jr z, .asm_25058
jr .asm_2505a
.asm_25058
ld a, $1
.asm_2505a
ld [$d10c], a
and a
ret
.asm_2505f
ld a, [$d10c]
add $a
ld b, a
ld a, [$d10d]
cp b
jr nc, .asm_2506c
ld b, a
.asm_2506c
ld a, b
ld [$d10c], a
and a
ret
; 25072
Function25072: ; 25072
call Function1cbb
call Function1cfd
ld de, $0015
add hl, de
ld [hl], $f1
inc hl
ld de, $d10c
ld bc, $8102
call PrintNum
ld a, [$cf86]
ld e, a
ld a, [$cf87]
ld d, a
ld a, [$cf8a]
call FarCall_de
ret
; 25097
Function25097: ; 25097
ret
; 25098
Function25098: ; 25098
call Function250a9
call Function250d1
ret
; 2509f
Function2509f: ; 2509f
call Function250a9
call Function250c1
call Function250d1
ret
; 250a9
Function250a9: ; 250a9
xor a
ld [hMultiplicand], a
ld a, [Buffer1]
ld [$ffb5], a
ld a, [Buffer2]
ld [$ffb6], a
ld a, [$d10c]
ld [hMultiplier], a
push hl
call Multiply
pop hl
ret
; 250c1
Function250c1: ; 250c1
push hl
ld hl, hMultiplicand
ld a, [hl]
srl a
ld [hli], a
ld a, [hl]
rra
ld [hli], a
ld a, [hl]
rra
ld [hl], a
pop hl
ret
; 250d1
Function250d1: ; 250d1
push hl
ld hl, $ffc3
ld a, [hMultiplicand]
ld [hli], a
ld a, [$ffb5]
ld [hli], a
ld a, [$ffb6]
ld [hl], a
pop hl
inc hl
ld de, $ffc3
ld bc, $2306
call PrintNum
call WaitBGMap
ret
; 250ed
MenuDataHeader_0x250ed: ; 0x250ed
db $40 ; flags
db 09, 15 ; start coords
db 11, 19 ; end coords
dw Function25097
db 0 ; default option
; 0x250f5
MenuDataHeader_0x250f5: ; 0x250f5
db $40 ; flags
db 15, 07 ; start coords
db 17, 19 ; end coords
dw Function25098
db -1 ; default option
; 0x250fd
MenuDataHeader_0x250fd: ; 0x250fd
db $40 ; flags
db 15, 07 ; start coords
db 17, 19 ; end coords
dw Function2509f
db 0 ; default option
; 0x25105
Function25105: ; 25105
ld a, [VramState] ; $d0ed
push af
xor a
ld [VramState], a ; $d0ed
ld hl, Options ; $cfcc
ld a, [hl]
push af
set 4, [hl]
call Function2513b
.asm_25117
call UpdateTime
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_25132
ld a, [$FF00+$a9]
and $2
jr nz, .asm_25132
call Function2518e
call DelayFrame
jr .asm_25117
.asm_25132
pop af
ld [Options], a ; $cfcc
pop af
ld [VramState], a ; $d0ed
ret
Function2513b: ; 2513b (9:513b)
call WhiteBGMap
call ClearSprites
call ClearTileMap
call DisableLCD
callba Function8833e
ld hl, CardRightCornerGFX
ld de, $91c0
ld bc, $10
ld a, BANK(CardRightCornerGFX)
call FarCopyBytes
ld hl, CardStatusGFX
ld de, $9290
ld bc, $60 + $500
ld a, BANK(CardStatusGFX)
call FarCopyBytes
call Function25299
hlcoord 0, 8
ld d, $6
call Function253b0
call EnableLCD
call WaitBGMap
ld b, $15
call GetSGBLayout
call Function32f9
call WaitBGMap
ld hl, $cf63
xor a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ret
Function2518e: ; 2518e (9:518e)
ld a, [$cf63]
ld e, a
ld d, $0
ld hl, Jumptable_2519d
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_2519d: ; 2519d (9:519d)
dw Function251b6
dw Function251d7
dw Function251f4
dw Function25221
dw Function2524c
dw Function25279
dw Function251b0
Function251ab: ; 251ab (9:51ab)
ld hl, $cf63
inc [hl]
ret
Function251b0: ; 251b0 (9:51b0)
ld hl, $cf63
set 7, [hl]
ret
Function251b6: ; 251b6 (9:51b6)
call ClearSprites
hlcoord 0, 8
ld d, $6
call Function253b0
call WaitBGMap
ld de, CardStatusGFX
ld hl, $9290
lb bc, BANK(CardStatusGFX), $6 + $50
call Request2bpp
call Function2530a
call Function251ab
ret
Function251d7: ; 251d7 (9:51d7)
call Function25415
ld hl, $ffa9
ld a, [hl]
and $11
jr nz, .asm_251e3
ret
.asm_251e3
ld a, $2
ld [$cf63], a
ret
; 251e9 (9:51e9)
Function251e9: ; 251e9
ld a, [KantoBadges]
and a
ret z
ld a, $4
ld [$cf63], a
ret
; 251f4
Function251f4: ; 251f4 (9:51f4)
call ClearSprites
hlcoord 0, 8
ld d, $6
call Function253b0
call WaitBGMap
ld de, LeaderGFX
ld hl, $9290
lb bc, BANK(LeaderGFX), $56
call Request2bpp
ld de, BadgeGFX
ld hl, $8000
lb bc, BANK(BadgeGFX), $2c
call Request2bpp
call Function2536c
call Function251ab
ret
Function25221: ; 25221 (9:5221)
ld hl, Unknown_254c9
call Function25438
ld hl, $ffa9
ld a, [hl]
and $1
jr nz, Function25246
ld a, [hl]
and $20
jr nz, .asm_25235
ret
.asm_25235
ld a, $0
ld [$cf63], a
ret
; 2523b (9:523b)
Function2523b: ; 2523b
ld a, [KantoBadges]
and a
ret z
ld a, $4
ld [$cf63], a
ret
; 25246
Function25246: ; 25246
ld a, $6
ld [$cf63], a
ret
Function2524c: ; 2524c (9:524c)
call ClearSprites
hlcoord 0, 8
ld d, $6
call Function253b0
call WaitBGMap
ld de, LeaderGFX2
ld hl, $9290
lb bc, BANK(LeaderGFX2), $56
call Request2bpp
ld de, BadgeGFX2
ld hl, $8000
lb bc, BANK(BadgeGFX2), $2c
call Request2bpp
call Function2536c
call Function251ab
ret
Function25279: ; 25279 (9:5279)
ld hl, Unknown_254c9
call Function25438
ld hl, $ffa9
ld a, [hl]
and $20
jr nz, .asm_2528d
ld a, [hl]
and $10
jr nz, .asm_25293
ret
.asm_2528d
ld a, $2
ld [$cf63], a
ret
.asm_25293
ld a, $0
ld [$cf63], a
ret
Function25299: ; 25299 (9:5299)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld d, $5
call Function253b0
hlcoord 2, 2
ld de, String_252ec
call PlaceString
hlcoord 2, 4
ld de, Tilemap_252f9
call Function253a8
hlcoord 7, 2
ld de, PlayerName ; $d47d
call PlaceString
hlcoord 5, 4
ld de, PlayerID ; $d47b
ld bc, $8205
call PrintNum
hlcoord 7, 6
ld de, Money ; $d84e
ld bc, $2306
call PrintNum
hlcoord 1, 3
ld de, Tilemap_252fc
call Function253a8
hlcoord 14, 1
ld bc, $507
xor a
ld [$FF00+$ad], a
predef FillBox
ret
; 252ec (9:52ec)
String_252ec: ; 252ec
db "NAME/", $4e
db $4e
db "MONEY@"
Tilemap_252f9: ; 252f9
db $27, $28, $ff ; ID NO
Tilemap_252fc: ; 252fc
db $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $26, $ff ; ____________>
; 2530a
Function2530a: ; 2530a (9:530a)
hlcoord 2, 10
ld de, String_2534c
call PlaceString
hlcoord 10, 15
ld de, String_2535c
call PlaceString
ld hl, PokedexCaught ; $de99
ld b, $20
call CountSetBits
ld de, $d265
hlcoord 15, 10
ld bc, $103
call PrintNum
call Function25415
hlcoord 2, 8
ld de, Tilemap_25366
call Function253a8
ld a, [StatusFlags] ; $d84c
bit 0, a
ret nz
hlcoord 1, 9
ld bc, $211
call ClearBox
ret
; 2534c (9:534c)
String_2534c: ; 2534c
db "#DEX", $4e
db "PLAY TIME@"
String_2535b: ; 2535b
db "@"
String_2535c: ; 2535c
db " BADGES▶@"
Tilemap_25366: ; 25366
db $29, $2a, $2b, $2c, $2d, $ff
; 2536c
Function2536c: ; 2536c (9:536c)
hlcoord 2, 8
ld de, Tilemap_253a2
call Function253a8
hlcoord 2, 10
ld a, $29
ld c, $4
.asm_2537c
call Function253f4
inc hl
inc hl
inc hl
inc hl
dec c
jr nz, .asm_2537c
hlcoord 2, 13
ld a, $51
ld c, $4
.asm_2538d
call Function253f4
inc hl
inc hl
inc hl
inc hl
dec c
jr nz, .asm_2538d
xor a
ld [$cf64], a
ld hl, Unknown_254c9
call Function25448
ret
; 253a2 (9:53a2)
Tilemap_253a2: ; 253a2
db $79, $7a, $7b, $7c, $7d, $ff ; "BADGES"
; 253a8
Function253a8: ; 253a8 (9:53a8)
ld a, [de]
cp $ff
ret z
ld [hli], a
inc de
jr Function253a8
Function253b0: ; 253b0 (9:53b0)
ld e, $14
.asm_253b2
ld a, $23
ld [hli], a
dec e
jr nz, .asm_253b2
ld a, $23
ld [hli], a
ld e, $11
ld a, $7f
.asm_253bf
ld [hli], a
dec e
jr nz, .asm_253bf
ld a, $1c
ld [hli], a
ld a, $23
ld [hli], a
.asm_253c9
ld a, $23
ld [hli], a
ld e, $12
ld a, $7f
.asm_253d0
ld [hli], a
dec e
jr nz, .asm_253d0
ld a, $23
ld [hli], a
dec d
jr nz, .asm_253c9
ld a, $23
ld [hli], a
ld a, $24
ld [hli], a
ld e, $11
ld a, $7f
.asm_253e4
ld [hli], a
dec e
jr nz, .asm_253e4
ld a, $23
ld [hli], a
ld e, $14
.asm_253ed
ld a, $23
ld [hli], a
dec e
jr nz, .asm_253ed
ret
Function253f4: ; 253f4 (9:53f4)
push de
push hl
ld [hli], a
inc a
ld [hli], a
inc a
ld [hli], a
inc a
ld [hli], a
inc a
ld de, $11
add hl, de
ld [hli], a
inc a
ld [hli], a
inc a
ld [hli], a
inc a
ld de, $11
add hl, de
ld [hli], a
inc a
ld [hli], a
inc a
ld [hli], a
inc a
pop hl
pop de
ret
Function25415: ; 25415 (9:5415)
hlcoord 11, 12
ld de, GameTimeHours ; $d4c4
ld bc, $204
call PrintNum
inc hl
ld de, GameTimeMinutes ; $d4c6
ld bc, $8102
call PrintNum
ld a, [$FF00+$9b]
and $1f
ret nz
hlcoord 15, 12
ld a, [hl]
xor $51
ld [hl], a
ret
Function25438: ; 25438 (9:5438)
ld a, [$FF00+$9b]
and $7
ret nz
ld a, [$cf64]
inc a
and $7
ld [$cf64], a
jr Function25448
Function25448: ; 25448 (9:5448)
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [de]
ld c, a
ld de, Sprites ; $c400
ld b, 8
.asm_25453
srl c
push bc
jr nc, .asm_25472
push hl
ld a, [hli]
ld b, a
ld a, [hli]
ld c, a
ld a, [hli]
ld [$cf66], a
ld a, [$cf64]
add l
ld l, a
ld a, 0
adc h
ld h, a
ld a, [hl]
ld [$cf65], a
call Function2547b
pop hl
.asm_25472
ld bc, $b
add hl, bc
pop bc
dec b
jr nz, .asm_25453
ret
Function2547b: ; 2547b (9:547b)
ld a, [$cf65]
and $80
jr nz, .asm_25487
ld hl, Unknown_254a7
jr .asm_2548a
.asm_25487
ld hl, Unknown_254b8
.asm_2548a
ld a, [hli]
cp $ff
ret z
add b
ld [de], a
inc de
ld a, [hli]
add c
ld [de], a
inc de
ld a, [$cf65]
and $7f
add [hl]
ld [de], a
inc hl
inc de
ld a, [$cf66]
add [hl]
ld [de], a
inc hl
inc de
jr .asm_2548a
; 254a7 (9:54a7)
Unknown_254a7: ; 254a7
db $00, $00, $00, $00
db $00, $08, $01, $00
db $08, $00, $02, $00
db $08, $08, $03, $00
db $ff
Unknown_254b8: ; 254b8
db $00, $00, $01, $20
db $00, $08, $00, $20
db $08, $00, $03, $20
db $08, $08, $02, $20
db $ff
Unknown_254c9: ; 254c9
; Template OAM data for each badge on the trainer card.
; Format:
; y, x, palette
; cycle 1: face tile, in1 tile, in2 tile, in3 tile
; cycle 2: face tile, in1 tile, in2 tile, in3 tile
dw JohtoBadges
; Zephyrbadge
db $68, $18, $00
db $00, $20, $24, $20 | $80
db $00, $20, $24, $20 | $80
; Hivebadge
db $68, $38, $00
db $04, $20, $24, $20 | $80
db $04, $20, $24, $20 | $80
; Plainbadge
db $68, $58, $00
db $08, $20, $24, $20 | $80
db $08, $20, $24, $20 | $80
; Fogbadge
db $68, $78, $00
db $0c, $20, $24, $20 | $80
db $0c, $20, $24, $20 | $80
; Mineralbadge
db $80, $38, $00
db $10, $20, $24, $20 | $80
db $10, $20, $24, $20 | $80
; Stormbadge
db $80, $18, $00
db $14, $20, $24, $20 | $80
db $14, $20, $24, $20 | $80
; Glacierbadge
db $80, $58, $00
db $18, $20, $24, $20 | $80
db $18, $20, $24, $20 | $80
; Risingbadge
; X-flips on alternate cycles.
db $80, $78, $00
db $1c, $20, $24, $20 | $80
db $1c | $80, $20, $24, $20 | $80
; 25523
CardStatusGFX: INCBIN "gfx/misc/card_status.2bpp"
LeaderGFX: INCBIN "gfx/misc/leaders.w24.2bpp"
LeaderGFX2: INCBIN "gfx/misc/leaders.w24.2bpp"
BadgeGFX: INCBIN "gfx/misc/badges.w16.2bpp"
BadgeGFX2: INCBIN "gfx/misc/badges.w16.2bpp"
CardRightCornerGFX: INCBIN "gfx/misc/card_right_corner.2bpp"
ProfOaksPC: ; 0x265d3
ld hl, OakPCText1
call Function1d4f
call YesNoBox
jr c, .shutdown
call ProfOaksPCBoot ; player chose "yes"?
.shutdown
ld hl, OakPCText4
call PrintText
call Functiona36
call Function1c07
ret
; 0x265ee
ProfOaksPCBoot ; 0x265ee
ld hl, OakPCText2
call PrintText
call Rate
call PlaySFX ; sfx loaded by previous Rate function call
call Functiona36
call WaitSFX
ret
; 0x26601
Function26601: ; 0x26601
call Rate
push de
ld de, MUSIC_NONE
call PlayMusic
pop de
call PlaySFX
call Functiona36
call WaitSFX
ret
; 0x26616
Rate: ; 0x26616
; calculate Seen/Owned
ld hl, PokedexSeen
ld b, EndPokedexSeen - PokedexSeen
call CountSetBits
ld [DefaultFlypoint], a
ld hl, PokedexCaught
ld b, EndPokedexCaught - PokedexCaught
call CountSetBits
ld [$d003], a
; print appropriate rating
call ClearOakRatingBuffers
ld hl, OakPCText3
call PrintText
call Functiona36
ld a, [$d003]
ld hl, OakRatings
call FindOakRating
push de
call PrintText
pop de
ret
; 0x26647
ClearOakRatingBuffers: ; 0x26647
ld hl, StringBuffer3
ld de, DefaultFlypoint
call ClearOakRatingBuffer
ld hl, StringBuffer4
ld de, $d003
call ClearOakRatingBuffer
ret
; 0x2665a
ClearOakRatingBuffer: ; 0x2665a
push hl
ld a, "@"
ld bc, $000d
call ByteFill
pop hl
ld bc, $4103
call PrintNum
ret
; 0x2666b
FindOakRating: ; 0x2666b
; return sound effect in de
; return text pointer in hl
nop
ld c, a
.loop
ld a, [hli]
cp c
jr nc, .match
inc hl
inc hl
inc hl
inc hl
jr .loop
.match
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld h, [hl]
ld l, a
ret
; 0x2667f
OakRatings: ; 0x2667f
; db count (if number caught ≤ this number, then this entry is used)
; dw sound effect
; dw text pointer
db 9
dw SFX_DEX_FANFARE_LESS_THAN_20
dw OakRating01
db 19
dw SFX_DEX_FANFARE_LESS_THAN_20
dw OakRating02
db 34
dw SFX_DEX_FANFARE_20_49
dw OakRating03
db 49
dw SFX_DEX_FANFARE_20_49
dw OakRating04
db 64
dw SFX_DEX_FANFARE_50_79
dw OakRating05
db 79
dw SFX_DEX_FANFARE_50_79
dw OakRating06
db 94
dw SFX_DEX_FANFARE_80_109
dw OakRating07
db 109
dw SFX_DEX_FANFARE_80_109
dw OakRating08
db 124
dw SFX_CAUGHT_MON
dw OakRating09
db 139
dw SFX_CAUGHT_MON
dw OakRating10
db 154
dw SFX_DEX_FANFARE_140_169
dw OakRating11
db 169
dw SFX_DEX_FANFARE_140_169
dw OakRating12
db 184
dw SFX_DEX_FANFARE_170_199
dw OakRating13
db 199
dw SFX_DEX_FANFARE_170_199
dw OakRating14
db 214
dw SFX_DEX_FANFARE_200_229
dw OakRating15
db 229
dw SFX_DEX_FANFARE_200_229
dw OakRating16
db 239
dw SFX_DEX_FANFARE_230_PLUS
dw OakRating17
db 248
dw SFX_DEX_FANFARE_230_PLUS
dw OakRating18
db 255
dw SFX_DEX_FANFARE_230_PLUS
dw OakRating19
OakPCText1: ; 0x266de
TX_FAR _OakPCText1
db "@"
OakPCText2: ; 0x266e3
TX_FAR _OakPCText2
db "@"
OakPCText3: ; 0x266e8
TX_FAR _OakPCText3
db "@"
OakRating01:
TX_FAR _OakRating01
db "@"
OakRating02:
TX_FAR _OakRating02
db "@"
OakRating03:
TX_FAR _OakRating03
db "@"
OakRating04:
TX_FAR _OakRating04
db "@"
OakRating05:
TX_FAR _OakRating05
db "@"
OakRating06:
TX_FAR _OakRating06
db "@"
OakRating07:
TX_FAR _OakRating07
db "@"
OakRating08:
TX_FAR _OakRating08
db "@"
OakRating09:
TX_FAR _OakRating09
db "@"
OakRating10:
TX_FAR _OakRating10
db "@"
OakRating11:
TX_FAR _OakRating11
db "@"
OakRating12:
TX_FAR _OakRating12
db "@"
OakRating13:
TX_FAR _OakRating13
db "@"
OakRating14:
TX_FAR _OakRating14
db "@"
OakRating15:
TX_FAR _OakRating15
db "@"
OakRating16:
TX_FAR _OakRating16
db "@"
OakRating17:
TX_FAR _OakRating17
db "@"
OakRating18:
TX_FAR _OakRating18
db "@"
OakRating19:
TX_FAR _OakRating19
db "@"
OakPCText4: ; 0x2674c
TX_FAR _OakPCText4
db "@"
Function26751: ; 26751 (9:6751)
ld a, $2
ld [$dc0f], a
ld a, $10
ld [$dc12], a
ret
_KrisDecorationMenu: ; 0x2675c
ld a, [$cf76]
push af
ld hl, MenuDataHeader_0x2679a
call LoadMenuDataHeader
xor a
ld [$d1ee], a
ld a, $1
ld [$d1ef], a
.asm_2676f
ld a, [$d1ef]
ld [$cf88], a
call Function26806
call Function1e5d
ld a, [$cfa9]
ld [$d1ef], a
jr c, .asm_2678e
ld a, [MenuSelection]
ld hl, Unknown_267aa
call Function1fa7
jr nc, .asm_2676f
.asm_2678e
call Function1c07
pop af
ld [$cf76], a
ld a, [$d1ee]
ld c, a
ret
; 0x2679a
MenuDataHeader_0x2679a: ; 0x2679a
db $40 ; flags
db 00, 05 ; start coords
db 17, 19 ; end coords
dw MenuData2_0x267a2
db 1 ; default option
; 0x267a2
MenuData2_0x267a2: ; 0x267a2
db $a0 ; flags
db 0 ; items
dw $d002
dw Function1f8d
dw Unknown_267aa
; 0x267aa
Unknown_267aa: ; 267aa
dw Function268b5, .bed
dw Function268ca, .carpet
dw Function268df, .plant
dw Function268f3, .poster
dw Function26908, .game
dw Function2691d, .ornament
dw Function26945, .big_doll
dw Function26959, .exit
.bed db "BED@"
.carpet db "CARPET@"
.plant db "PLANT@"
.poster db "POSTER@"
.game db "GAME CONSOLE@"
.ornament db "ORNAMENT@"
.big_doll db "BIG DOLL@"
.exit db "EXIT@"
; 26806
Function26806: ; 26806
xor a
ld [$cf76], a
call Function26822
call Function2683a
ld a, $7
call Function26830
ld hl, StringBuffer2 ; $d086
ld de, DefaultFlypoint ; $d002
ld bc, $d
call CopyBytes
ret
Function26822: ; 26822 (9:6822)
ld hl, StringBuffer2 ; $d086
xor a
ld [hli], a
ld bc, $c
ld a, $ff
call ByteFill
ret
Function26830: ; 26830 (9:6830)
ld hl, StringBuffer2 ; $d086
inc [hl]
ld e, [hl]
ld d, 0
add hl, de
ld [hl], a
ret
Function2683a: ; 2683a (9:683a)
ld hl, Jumptable_26855
.asm_2683d
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
or e
jr z, .asm_26854
push hl
call _de_
pop hl
jr nc, .asm_26851
ld a, [hl]
push hl
call Function26830
pop hl
.asm_26851
inc hl
jr .asm_2683d
.asm_26854
ret
; 26855 (9:6855)
Jumptable_26855: ; 26855
dwb Function268bd, 0 ; bed
dwb Function268d2, 1 ; carpet
dwb Function268e7, 2 ; plant
dwb Function268fb, 3 ; poster
dwb Function26910, 4 ; game console
dwb Function26925, 5 ; ornament
dwb Function2694d, 6 ; big doll
dw 0 ; end
; 2686c
Function2686c: ; 2686c
xor a
ld hl, DefaultFlypoint
ld [hli], a
ld a, $ff
ld bc, $0010
call ByteFill
ret
; 2687a
Function2687a: ; 2687a
.asm_2687a
ld a, [hli]
cp $ff
jr z, .asm_26890
push hl
push af
ld b, $2
call Function26a3b
ld a, c
and a
pop bc
ld a, b
call nz, Function26891
pop hl
jr .asm_2687a
.asm_26890
ret
; 26891
Function26891: ; 26891
ld hl, DefaultFlypoint
inc [hl]
ld e, [hl]
ld d, $0
add hl, de
ld [hl], a
ret
; 2689b
Function2689b: ; 2689b
push bc
push hl
call Function2686c
pop hl
call Function2687a
pop bc
ld a, [DefaultFlypoint]
and a
ret z
ld a, c
call Function26891
ld a, $0
call Function26891
scf
ret
; 268b5
Function268b5: ; 268b5
call Function268bd
call Function2695b
xor a
ret
; 268bd
Function268bd: ; 268bd
ld hl, $68c5
ld c, 1
jp Function2689b
; 268c5
Unknown_268c5: ; 268c5
db 2, 3, 4, 5, $ff
; 268ca
Function268ca: ; 268ca
call Function268d2
call Function2695b
xor a
ret
; 268d2
Function268d2: ; 268d2
ld hl, Unknown_268da
ld c, 6
jp Function2689b
; 268da
Unknown_268da: ; 268da
db 7, 8, 9, 10, $ff
; 268df
Function268df: ; 268df
call Function268e7
call Function2695b
xor a
ret
; 268e7
Function268e7: ; 268e7
ld hl, Unknown_268ef
ld c, 11
jp Function2689b
; 268ef
Unknown_268ef: ; 268ef
db 12, 13, 14, $ff
; 268f3
Function268f3: ; 268f3
call Function268fb
call Function2695b
xor a
ret
; 268fb
Function268fb: ; 268fb
ld hl, Unknown_26903
ld c, 15
jp Function2689b
; 26903
Unknown_26903: ; 26903
db 16, 17, 18, 19, $ff
; 26908
Function26908: ; 26908
call Function26910
call Function2695b
xor a
ret
; 26910
Function26910: ; 26910
ld hl, Unknown_26918
ld c, 20
jp Function2689b
; 26918
Unknown_26918: ; 26918
db 21, 22, 23, 24, $ff
; 2691d
Function2691d: ; 2691d
call Function26925
call Function2695b
xor a
ret
; 26925
Function26925: ; 26925
ld hl, Unknown_2692d
ld c, 29
jp Function2689b
; 2692d
Unknown_2692d: ; 2692d
db 30, 31, 32, 33, 34, 35, 36, 37, 38, 39
db 40, 41, 42, 43, 44, 45, 46, 47, 48, 49
db 50, 51, 52, $ff
; 26945
Function26945: ; 26945
call Function2694d
call Function2695b
xor a
ret
; 2694d
Function2694d: ; 2694d
ld hl, Unknown_26955
ld c, 25
jp Function2689b
; 26955
Unknown_26955: ; 26955
db 26, 27, 28, $ff
; 26959
Function26959: ; 26959
scf
ret
; 2695b
Function2695b: ; 2695b
ld a, [DefaultFlypoint]
and a
jr z, .asm_269a9
cp $8
jr nc, .asm_2697b
xor a
ld [$cf76], a
ld hl, MenuDataHeader_0x269b5
call LoadMenuDataHeader
call Function1e5d
jr c, .asm_26977
call Function26a02
.asm_26977
call Function1c07
ret
.asm_2697b
ld hl, DefaultFlypoint
ld e, [hl]
dec [hl]
ld d, $0
add hl, de
ld [hl], $ff
call Function1d6e
ld hl, MenuDataHeader_0x269c5
call Function1d3c
xor a
ld [hBGMapMode], a
call Function352f
xor a
ld [$d0e4], a
call Function350c
ld a, [$cf73]
cp $2
jr z, .asm_269a5
call Function26a02
.asm_269a5
call Function1c07
ret
.asm_269a9
ld hl, UnknownText_0x269b0
call Function1d67
ret
; 269b0
UnknownText_0x269b0: ; 0x269b0
; There's nothing to choose.
text_jump UnknownText_0x1bc471
db "@"
; 0x269b5
MenuDataHeader_0x269b5: ; 0x269b5
db $40 ; flags
db 00, 00 ; start coords
db 17, 19 ; end coords
dw MenuData2_0x269bd
db 1 ; default option
; 0x269bd
MenuData2_0x269bd: ; 0x269bd
db $a0 ; flags
db 0 ; items
dw $d002
dw Function269f3
dw DecorationAttributes
; 0x269c5
MenuDataHeader_0x269c5: ; 0x269c5
db $40 ; flags
db 01, 01 ; start coords
db 16, 18 ; end coords
dw MenuData2_0x269cd
db 1 ; default option
; 0x269cd
MenuData2_0x269cd: ; 0x269cd
db $10 ; flags
db 8, 0 ; rows, columns
db 1 ; horizontal spacing
dbw 0, $d002 ; text pointer
dbw BANK(Function269f3), Function269f3
dbw 0, 0
dbw 0, 0
; 269dd
Function269dd: ; 269dd
ld hl, DecorationAttributes
ld bc, $0006
call AddNTimes
ret
; 269e7
Function269e7: ; 269e7
push hl
call Function269dd
call Function26c72
pop hl
call CopyName2
ret
; 269f3
Function269f3: ; 269f3
ld a, [MenuSelection]
push de
call Function269dd
call Function26c72
pop hl
call PlaceString
ret
; 26a02
Function26a02: ; 26a02
ld a, [MenuSelection]
call Function269dd
ld de, $0002
add hl, de
ld a, [hl]
ld hl, $6a12
rst JumpTable
ret
; 26a12
Jumptable_26a12: ; 26a12
dw Function26ce3
dw Function26ce5
dw Function26ceb
dw Function26cf1
dw Function26cf7
dw Function26cfd
dw Function26d03
dw Function26d09
dw Function26d0f
dw Function26d15
dw Function26d1b
dw Function26d21
dw Function26d27
dw Function26db3
dw Function26dc9
; 26a30
Function26a30: ; 26a30
call Function269dd
ld de, $0003
add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
ret
; 26a3b
Function26a3b: ; 26a3b
push bc
call Function26a30
pop bc
call EventFlagAction
ret
; 26a44
Function26a44: ; 26a44
ld a, c
call Function269dd
ld de, $0005
add hl, de
ld a, [hl]
ld c, a
ret
; 26a4f
DecorationAttributes: ; 26a4f
db $01, $00, $00, $00, $00, $00
db $01, $01, $02, $00, $00, $00
db $02, $12, $01, $a4, $02, $1b
db $02, $14, $01, $a5, $02, $1c
db $02, $15, $01, $a6, $02, $1d
db $02, $13, $01, $a7, $02, $1e
db $01, $01, $04, $00, $00, $00
db $03, $16, $03, $a8, $02, $08
db $03, $17, $03, $a9, $02, $0b
db $03, $18, $03, $aa, $02, $0e
db $03, $19, $03, $ab, $02, $11
db $01, $01, $06, $00, $00, $00
db $01, $02, $05, $ac, $02, $20
db $01, $03, $05, $ad, $02, $21
db $01, $04, $05, $ae, $02, $22
db $01, $01, $08, $00, $00, $00
db $01, $05, $07, $af, $02, $1f
db $04, $19, $07, $b0, $02, $23
db $04, $23, $07, $b1, $02, $24
db $04, $27, $07, $b2, $02, $25
db $01, $01, $0a, $00, $00, $00
db $01, $06, $09, $b3, $02, $5c
db $01, $07, $09, $b4, $02, $5b
db $01, $08, $09, $b5, $02, $51
db $01, $09, $09, $b6, $02, $57
db $01, $01, $0c, $00, $00, $00
db $06, $8f, $0b, $cf, $02, $33
db $06, $5f, $0b, $d0, $02, $50
db $06, $83, $0b, $d1, $02, $47
db $01, $01, $0e, $00, $00, $00
db $05, $19, $0d, $b7, $02, $8e
db $01, $0c, $0d, $b8, $02, $34
db $05, $23, $0d, $b9, $02, $8f
db $05, $27, $0d, $ba, $02, $94
db $05, $01, $0d, $bb, $02, $93
db $05, $04, $0d, $bc, $02, $90
db $05, $07, $0d, $bd, $02, $89
db $05, $3c, $0d, $be, $02, $8d
db $05, $32, $0d, $bf, $02, $8c
db $05, $78, $0d, $c0, $02, $92
db $05, $81, $0d, $c1, $02, $88
db $05, $2b, $0d, $c2, $02, $85
db $05, $5e, $0d, $c3, $02, $86
db $05, $5a, $0d, $c4, $02, $84
db $05, $58, $0d, $c5, $02, $95
db $05, $64, $0d, $c6, $02, $9b
db $05, $0d, $0d, $c7, $02, $83
db $05, $c9, $0d, $c8, $02, $80
db $05, $4a, $0d, $c9, $02, $81
db $05, $42, $0d, $ca, $02, $9a
db $05, $48, $0d, $cb, $02, $98
db $01, $0a, $0d, $cd, $02, $5e
db $01, $0b, $0d, $ce, $02, $5f
; 26b8d
DecorationNames: ; 26b8d
db "CANCEL@"
db "PUT IT AWAY@"
db "MAGNAPLANT@"
db "TROPICPLANT@"
db "JUMBOPLANT@"
db "TOWN MAP@"
db "NES@"
db "SUPER NES@"
db "NINTENDO 64@"
db "VIRTUAL BOY@"
db "GOLD TROPHY@"
db "SILVER TROPHY@"
db "SURF PIKACHU DOLL@"
db " BED@"
db " CARPET@"
db " POSTER@"
db " DOLL@"
db "BIG @"
db "FEATHERY@"
db "PIKACHU@"
db "PINK@"
db "POLKADOT@"
db "RED@"
db "BLUE@"
db "YELLOW@"
db "GREEN@"
; 26c72
Function26c72: ; 26c72
ld a, [hli]
ld e, [hl]
ld bc, StringBuffer2
push bc
ld hl, Table26c7e
rst JumpTable
pop de
ret
; 26c7e
Table26c7e: ; 26c7e
dw Function26c8c
dw Function26c8d
dw Function26c90
dw Function26c97
dw Function26c9e
dw Function26ca6
dw Function26cae
; 26c8c
Function26c8c: ; 26c8c
ret
; 26c8d
Function26c8d: ; 26c8d
ld a, e
jr Function26cca
Function26c90: ; 26c90
call Function26c8d
ld a, $d
jr Function26cca
Function26c97: ; 26c97
call Function26c8d
ld a, $e
jr Function26cca
Function26c9e: ; 26c9e
ld a, e
call Function26cc0
ld a, $f
jr Function26cca
Function26ca6: ; 26ca6
ld a, e
call Function26cc0
ld a, $10
jr Function26cca
Function26cae: ; 26cae
push de
ld a, $11
call Function26cca
pop de
ld a, e
jr Function26cc0
Function26cb8: ; 26cb8
push de
call Function26cca
pop de
ld a, e
jr Function26cca
Function26cc0: ; 26cc0
push bc
ld [$d265], a
call GetPokemonName
pop bc
jr Function26cda
Function26cca: ; 26cca
call Function26ccf
jr Function26cda
Function26ccf: ; 26ccf
push bc
ld hl, DecorationNames
call GetNthString
ld d, h
ld e, l
pop bc
ret
Function26cda: ; 26cda
ld h, b
ld l, c
call CopyName2
dec hl
ld b, h
ld c, l
ret
; 26ce3
Function26ce3: ; 26ce3
scf
ret
; 26ce5
Function26ce5: ; 26ce5
ld hl, Bed
jp Function26d2d
; 26ceb
Function26ceb: ; 26ceb
ld hl, Bed
jp Function26d86
; 26cf1
Function26cf1: ; 26cf1
ld hl, Carpet
jp Function26d2d
; 26cf7
Function26cf7: ; 26cf7
ld hl, Carpet
jp Function26d86
; 26cfd
Function26cfd: ; 26cfd
ld hl, Plant
jp Function26d2d
; 26d03
Function26d03: ; 26d03
ld hl, Plant
jp Function26d86
; 26d09
Function26d09: ; 26d09
ld hl, Poster
jp Function26d2d
; 26d0f
Function26d0f: ; 26d0f
ld hl, Poster
jp Function26d86
; 26d15
Function26d15: ; 26d15
ld hl, Console
jp Function26d2d
; 26d1b
Function26d1b: ; 26d1b
ld hl, Console
jp Function26d86
; 26d21
Function26d21: ; 26d21
ld hl, BigDoll
jp Function26d2d
; 26d27
Function26d27: ; 26d27
ld hl, BigDoll
jp Function26d86
; 26d2d
Function26d2d: ; 26d2d
ld a, [hl]
ld [Buffer1], a
push hl
call Function26d46
jr c, .asm_26d43
ld a, $1
ld [$d1ee], a
pop hl
ld a, [MenuSelection]
ld [hl], a
xor a
ret
.asm_26d43
pop hl
xor a
ret
; 26d46
Function26d46: ; 26d46
ld a, [Buffer1]
and a
jr z, .asm_26d6d
ld b, a
ld a, [MenuSelection]
cp b
jr z, .asm_26d7e
ld a, [MenuSelection]
ld hl, StringBuffer4
call Function269e7
ld a, [Buffer1]
ld hl, StringBuffer3
call Function269e7
ld hl, UnknownText_0x26ee0
call Function1d67
xor a
ret
.asm_26d6d
ld a, [MenuSelection]
ld hl, StringBuffer3
call Function269e7
ld hl, UnknownText_0x26edb
call Function1d67
xor a
ret
.asm_26d7e
ld hl, UnknownText_0x26ee5
call Function1d67
scf
ret
; 26d86
Function26d86: ; 26d86
ld a, [hl]
ld [Buffer1], a
xor a
ld [hl], a
ld a, [Buffer1]
and a
jr z, .asm_26dab
ld a, $1
ld [$d1ee], a
ld a, [Buffer1]
ld [MenuSelection], a
ld hl, StringBuffer3
call Function269e7
ld hl, UnknownText_0x26ed1
call Function1d67
xor a
ret
.asm_26dab
ld hl, UnknownText_0x26ed6
call Function1d67
xor a
ret
; 26db3
Function26db3: ; 26db3
ld hl, UnknownText_0x26e41
call Function26e70
jr c, .asm_26dc7
call Function26de3
jr c, .asm_26dc7
ld a, $1
ld [$d1ee], a
jr Function26dd6
.asm_26dc7
xor a
ret
Function26dc9: ; 26dc9
ld hl, UnknownText_0x26e6b
call Function26e70
jr nc, .asm_26dd3
xor a
ret
.asm_26dd3
call Function26e46
Function26dd6: ; 26dd6
call Function26e9a
ld a, [$d1ec]
ld [hl], a
ld a, [$d1ed]
ld [de], a
xor a
ret
; 26de3
Function26de3: ; 26de3
ld a, [$d1ec]
and a
jr z, .asm_26e11
ld b, a
ld a, [MenuSelection]
cp b
jr z, .asm_26e2b
ld a, b
ld hl, StringBuffer3
call Function269e7
ld a, [MenuSelection]
ld hl, StringBuffer4
call Function269e7
ld a, [MenuSelection]
ld [$d1ec], a
call Function26e33
ld hl, UnknownText_0x26ee0
call Function1d67
xor a
ret
.asm_26e11
ld a, [MenuSelection]
ld [$d1ec], a
call Function26e33
ld a, [MenuSelection]
ld hl, StringBuffer3
call Function269e7
ld hl, UnknownText_0x26edb
call Function1d67
xor a
ret
.asm_26e2b
ld hl, UnknownText_0x26ee5
call Function1d67
scf
ret
; 26e33
Function26e33: ; 26e33
ld a, [MenuSelection]
ld b, a
ld a, [$d1ed]
cp b
ret nz
xor a
ld [$d1ed], a
ret
; 26e41
UnknownText_0x26e41: ; 0x26e41
; Which side do you want to put it on?
text_jump UnknownText_0x1bc48c
db "@"
; 0x26e46
Function26e46: ; 26e46
ld a, [$d1ec]
and a
jr z, .asm_26e63
ld hl, StringBuffer3
call Function269e7
ld a, $1
ld [$d1ee], a
xor a
ld [$d1ec], a
ld hl, UnknownText_0x26ed1
call Function1d67
xor a
ret
.asm_26e63
ld hl, UnknownText_0x26ed6
call Function1d67
xor a
ret
; 26e6b
UnknownText_0x26e6b: ; 0x26e6b
; Which side do you want to put away?
text_jump UnknownText_0x1bc4b2
db "@"
; 0x26e70
Function26e70: ; 26e70
call Function1d4f
ld hl, MenuDataHeader_0x26eab
call Function1dab
call Function1c07
call Function1c66
jr c, .asm_26e98
ld a, [$cfa9]
cp $3
jr z, .asm_26e98
ld [Buffer2], a
call Function26e9a
ld a, [hl]
ld [$d1ec], a
ld a, [de]
ld [$d1ed], a
xor a
ret
.asm_26e98
scf
ret
; 26e9a
Function26e9a: ; 26e9a
ld hl, RightOrnament
ld de, LeftOrnament
ld a, [Buffer2]
cp $1
ret z
push hl
ld h, d
ld l, e
pop de
ret
; 26eab
MenuDataHeader_0x26eab: ; 0x26eab
db $40 ; flags
db 00, 00 ; start coords
db 07, 13 ; end coords
dw MenuData2_0x26eb3
db 1 ; default option
; 0x26eb3
MenuData2_0x26eb3: ; 0x26eb3
db $80 ; flags
db 3 ; items
db "RIGHT SIDE@"
db "LEFT SIDE@"
db "CANCEL@"
; 0x26ed1
UnknownText_0x26ed1: ; 0x26ed1
; Put away the @ .
text_jump UnknownText_0x1bc4d7
db "@"
; 0x26ed6
UnknownText_0x26ed6: ; 0x26ed6
; There's nothing to put away.
text_jump UnknownText_0x1bc4ec
db "@"
; 0x26edb
UnknownText_0x26edb: ; 0x26edb
; Set up the @ .
text_jump UnknownText_0x1bc509
db "@"
; 0x26ee0
UnknownText_0x26ee0: ; 0x26ee0
; Put away the @ and set up the @ .
text_jump UnknownText_0x1bc51c
db "@"
; 0x26ee5
UnknownText_0x26ee5: ; 0x26ee5
; That's already set up.
text_jump UnknownText_0x1bc546
db "@"
; 0x26eea
Function26eea: ; 26eea
ld a, c
ld h, d
ld l, e
call Function269e7
ret
; 26ef1
Function26ef1: ; 26ef1
ld a, c
jp Function26a3b
; 26ef5
Function26ef5: ; 26ef5 (9:6ef5)
ld a, c
call Function26f0c
ld hl, StringBuffer1 ; $d073
push hl
call Function269e7
pop de
ret
Function26f02: ; 26f02
ld a, c
call Function26f0c
ld b, $1
call Function26a3b
ret
; 26f0c
Function26f0c: ; 26f0c
push hl
push de
ld e, a
ld d, 0
ld hl, Unknown_26f2b
add hl, de
ld a, [hl]
pop de
pop hl
ret
; 26f19
Function26f19: ; 26f19
ld hl, Unknown_26f2b
.asm_26f1c
ld a, [hli]
cp $ff
jr z, .asm_26f2a
push hl
ld b, $1
call Function26a3b
pop hl
jr .asm_26f1c
.asm_26f2a
ret
; 26f2b
Unknown_26f2b: ; 26f2b
db $02, $03, $04, $05, $07
db $08, $09, $0a, $0c, $0d
db $0e, $10, $11, $12, $13
db $15, $16, $17, $18, $1e
db $1f, $20, $21, $22, $23
db $24, $25, $26, $27, $28
db $29, $2a, $2b, $2c, $2d
db $2e, $2f, $30, $31, $32
db $1a, $1b, $1c, $33, $34
db $ff
; 26f59
Function26f59:: ; 26f59
ld a, b
ld hl, Table26f5f
rst JumpTable
ret
; 26f5f
Table26f5f: ; 26f5f
dw Function26f69
dw Function26fb9
dw Function26fbe
dw Function26fdd
dw Function26fc3
; 26f69
Function26f69: ; 26f69
ld a, [Poster]
ld hl, Unknown_26f84
ld de, 3
call IsInArray
jr c, .asm_26f7d
ld de, UnknownScript_0x26fb8
ld b, $9
ret
.asm_26f7d
ld b, $9
inc hl
ld a, [hli]
ld d, [hl]
ld e, a
ret
; 26f84
Unknown_26f84: ; 26f84
dbw $10, UnknownScript_0x26f91
dbw $11, UnknownScript_0x26fa0
dbw $12, UnknownScript_0x26fa8
dbw $13, UnknownScript_0x26fb0
db $ff
; 26f91
UnknownScript_0x26f91: ; 0x26f91
loadfont
2writetext UnknownText_0x26f9b
closetext
special $0026
loadmovesprites
end
; 0x26f9b
UnknownText_0x26f9b: ; 0x26f9b
; It's the TOWN MAP.
text_jump UnknownText_0x1bc55d
db "@"
; 0x26fa0
UnknownScript_0x26fa0: ; 0x26fa0
jumptext UnknownText_0x26fa3
; 0x26fa3
UnknownText_0x26fa3: ; 0x26fa3
; It's a poster of a cute PIKACHU.
text_jump UnknownText_0x1bc570
db "@"
; 0x26fa8
UnknownScript_0x26fa8: ; 0x26fa8
jumptext UnknownText_0x26fab
; 0x26fab
UnknownText_0x26fab: ; 0x26fab
; It's a poster of a cute CLEFAIRY.
text_jump UnknownText_0x1bc591
db "@"
; 0x26fb0
UnknownScript_0x26fb0: ; 0x26fb0
jumptext UnknownText_0x26fb3
; 0x26fb3
UnknownText_0x26fb3: ; 0x26fb3
; It's a poster of a cute JIGGLYPUFF.
text_jump UnknownText_0x1bc5b3
db "@"
; 0x26fb8
UnknownScript_0x26fb8: ; 26fb8
end
; 26fb9
Function26fb9: ; 26fb9
ld a, [LeftOrnament]
jr Function26fc8
Function26fbe: ; 26fbe
ld a, [RightOrnament]
jr Function26fc8
Function26fc3: ; 26fc3
ld a, [Console]
jr Function26fc8
Function26fc8: ; 26fc8
ld c, a
ld de, StringBuffer3
call Function26eea
ld b, BANK(Unknown_26fd5)
ld de, Unknown_26fd5
ret
; 26fd5
Unknown_26fd5: ; 26fd5
dbw $53, UnknownText_0x26fd8
; 26fd8
UnknownText_0x26fd8: ; 0x26fd8
; It's an adorable @ .
text_jump UnknownText_0x1bc5d7
db "@"
; 0x26fdd
Function26fdd: ; 26fdd
ld b, BANK(Unknown_26fe3)
ld de, Unknown_26fe3
ret
; 26fe3
Unknown_26fe3: ; 26fe3
dbw $53, UnknownText_0x26fe6
; 26fe6
UnknownText_0x26fe6: ; 0x26fe6
; A giant doll! It's fluffy and cuddly.
text_jump UnknownText_0x1bc5ef
db "@"
; 0x26feb
Function26feb: ; 26feb
ld de, $0004
ld a, [Bed]
call Function27037
ld de, $0704
ld a, [Plant]
call Function27037
ld de, $0600
ld a, [Poster]
call Function27037
call Function27027
ld de, $0000
call Function27092
ld a, [Carpet]
and a
ret z
call Function27085
ld [hl], a
push af
ld de, $0002
call Function27092
pop af
inc a
ld [hli], a
inc a
ld [hli], a
dec a
ld [hl], a
ret
; 27027
Function27027: ; 27027
ld b, $1
ld a, [Poster]
and a
jr nz, .asm_27031
ld b, $0
.asm_27031
ld de, $02cc
jp EventFlagAction
; 27037
Function27037: ; 27037
push af
call Function27092
pop af
and a
ret z
call Function27085
ld [hl], a
ret
; 27043
Function27043: ; 27043
ld de, $0741
ld hl, VariableSprites
ld a, [Console]
call Function27074
ld de, $0742
ld hl, $d82f
ld a, [LeftOrnament]
call Function27074
ld de, $0743
ld hl, $d830
ld a, [RightOrnament]
call Function27074
ld de, $0744
ld hl, $d831
ld a, [BigDoll]
call Function27074
ret
; 27074
Function27074: ; 27074
and a
jr z, .asm_27080
call Function27085
ld [hl], a
ld b, $0
jp EventFlagAction
.asm_27080
ld b, $1
jp EventFlagAction
; 27085
Function27085: ; 27085
ld c, a
push de
push hl
callba Function26a44
pop hl
pop de
ld a, c
ret
; 27092
Function27092: ; 27092
ld a, d
add $4
ld d, a
ld a, e
add $4
ld e, a
call Function2a66
ret
; 2709e
Function2709e: ; 2709e
ld a, [CurPartyMon]
ld hl, PartyMon1CaughtLocation
call GetPartyLocation
ld a, [hl]
and $7f
ld d, a
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
cp d
ld c, $1
jr nz, .asm_270bd
ld c, $13
.asm_270bd
callab ChangeHappiness
ret
; 270c4
INCLUDE "trainers/dvs.asm"
Function2715c: ; 2715c
call WhiteBGMap
call ClearTileMap
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
jr z, .asm_27171
callba Function3f43d
jr .asm_27177
.asm_27171
callba GetBattleBackpic
.asm_27177
callba Function3f47c
callba Function3ed9f
call ClearSGB
call Function1c17
call Function1d6e
call WaitBGMap
jp Function32f9
; 27192
Function27192: ; 27192
push hl
push de
push bc
ld a, [hBattleTurn]
and a
ld hl, OTPartyMon1Item
ld de, EnemyMonItem
ld a, [CurOTMon]
jr z, .asm_271ac
ld hl, PartyMon1Item
ld de, BattleMonItem
ld a, [CurBattleMon]
.asm_271ac
push hl
push af
ld a, [de]
ld b, a
callba GetItem
ld hl, Unknown_271de
.asm_271b9
ld a, [hli]
cp b
jr z, .asm_271c6
inc a
jr nz, .asm_271b9
pop af
pop hl
pop bc
pop de
pop hl
ret
.asm_271c6
xor a
ld [de], a
pop af
pop hl
call GetPartyLocation
ld a, [hBattleTurn]
and a
jr nz, .asm_271d8
ld a, [IsInBattle]
dec a
jr z, .asm_271da
.asm_271d8
ld [hl], $0
.asm_271da
pop bc
pop de
pop hl
ret
; 271de
Unknown_271de: ; 271de
; Consumable items?
db HELD_BERRY
db $02
db $05
db HELD_HEAL_POISON
db HELD_HEAL_FREEZE
db HELD_HEAL_BURN
db HELD_HEAL_SLEEP
db HELD_HEAL_PARALYZE
db HELD_HEAL_STATUS
db $1e
db HELD_ATTACK_UP
db HELD_DEFENSE_UP
db HELD_SPEED_UP
db HELD_SP_ATTACK_UP
db HELD_SP_DEFENSE_UP
db HELD_ACCURACY_UP
db HELD_EVASION_UP
db $26
db $47
db HELD_ESCAPE
db HELD_CRITICAL_UP
db $ff
; 271f4
MoveEffectsPointers: ; 271f4
INCLUDE "battle/moves/move_effects_pointers.asm"
MoveEffects: ; 2732e
INCLUDE "battle/moves/move_effects.asm"
Function27a28: ; 27a28
call Function2500e
ld b, a
ret
; 27a2d
SECTION "bankA", ROMX, BANK[$A]
Function28000: ; 28000
call WhiteBGMap
ld c, $50
call DelayFrames
call ClearScreen
call ClearSprites
call Function1ad2
xor a
ld [hSCX], a
ld [hSCY], a
ld c, $50
call DelayFrames
call ClearScreen
call Function1ad2
call Functione51
call Functione58
callba Function16d69a
call Function3200
hlcoord 3, 8
ld b, $2
ld c, $c
ld d, h
ld e, l
callba Function4d35b
hlcoord 4, 10
ld de, String28419
call PlaceString
call Function28eff
call Function3200
ld hl, $cf5d
xor a
ld [hli], a
ld [hl], $50
ld a, [InLinkBattle]
cp $1
jp nz, Function28177
Function2805d: ; 2805d
call Function28426
call Function28499
call Function28434
xor a
ld [$cf56], a
call Function87d
ld a, [$ffcb]
cp $2
jr nz, .asm_28091
ld c, $3
call DelayFrames
xor a
ld [hSerialSend], a
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
call DelayFrame
xor a
ld [hSerialSend], a
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
.asm_28091
ld de, MUSIC_NONE
call PlayMusic
ld c, $3
call DelayFrames
xor a
ld [rIF], a
ld a, $8
ld [rIE], a
ld hl, $d1f3
ld de, EnemyMonSpecies
ld bc, $0011
call Function75f
ld a, $fe
ld [de], a
ld hl, OverworldMap
ld de, $d26b
ld bc, $01a8
call Function75f
ld a, $fe
ld [de], a
ld hl, $c608
ld de, PlayerSDefLevel
ld bc, $00c8
call Function75f
xor a
ld [rIF], a
ld a, $1d
ld [rIE], a
call Function287ab
ld hl, $d26b
call Function287ca
push hl
ld bc, $000b
add hl, bc
ld a, [hl]
pop hl
and a
jp z, Function28b22
cp $7
jp nc, Function28b22
ld de, OverworldMap
ld bc, $01a2
call Function2879e
ld de, PlayerSDefLevel
ld hl, $c813
ld c, $2
.asm_280fe
ld a, [de]
inc de
and a
jr z, .asm_280fe
cp $fd
jr z, .asm_280fe
cp $fe
jr z, .asm_280fe
cp $ff
jr z, .asm_2811d
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_280fe
.asm_2811d
ld hl, $c90f
dec c
jr nz, .asm_280fe
ld hl, OverworldMap
ld de, $d26b
ld bc, $000b
call CopyBytes
ld de, OTPartyCount
ld a, [hli]
ld [de], a
inc de
.asm_28135
ld a, [hli]
cp $ff
jr z, .asm_2814e
ld [$d265], a
push hl
push de
callab Functionfb908
pop de
pop hl
ld a, [$d265]
ld [de], a
inc de
jr .asm_28135
.asm_2814e
ld [de], a
ld hl, $c813
call Function2868a
ld a, $a8
ld [$d102], a
ld a, $d3
ld [$d103], a
ld de, MUSIC_NONE
call PlayMusic
ld a, [$ffcb]
cp $2
ld c, 66
call z, DelayFrames
ld de, MUSIC_ROUTE_30
call PlayMusic
jp Function287e3
; 28177
Function28177: ; 28177
call Function28426
call Function28595
call Function28434
call Function29dba
ld a, [ScriptVar]
and a
jp z, Function283b2
ld a, [$ffcb]
cp $2
jr nz, .asm_281ae
ld c, $3
call DelayFrames
xor a
ld [hSerialSend], a
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
call DelayFrame
xor a
ld [hSerialSend], a
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
.asm_281ae
ld de, MUSIC_NONE
call PlayMusic
ld c, $3
call DelayFrames
xor a
ld [rIF], a
ld a, $8
ld [rIE], a
ld hl, $d1f3
ld de, EnemyMonSpecies
ld bc, $0011
call Function75f
ld a, $fe
ld [de], a
ld hl, OverworldMap
ld de, $d26b
ld bc, $01c2
call Function75f
ld a, $fe
ld [de], a
ld hl, $c608
ld de, PlayerSDefLevel
ld bc, $00c8
call Function75f
ld a, [InLinkBattle]
cp $2
jr nz, .asm_281fd
ld hl, $c9f4
ld de, $cb84
ld bc, $0186
call Function283f2
.asm_281fd
xor a
ld [rIF], a
ld a, $1d
ld [rIE], a
ld de, MUSIC_NONE
call PlayMusic
call Function287ab
ld hl, $d26b
call Function287ca
ld de, OverworldMap
ld bc, $01b9
call Function2879e
ld de, PlayerSDefLevel
ld hl, $c813
ld c, $2
.asm_28224
ld a, [de]
inc de
and a
jr z, .asm_28224
cp $fd
jr z, .asm_28224
cp $fe
jr z, .asm_28224
cp $ff
jr z, .asm_28243
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_28224
.asm_28243
ld hl, $c90f
dec c
jr nz, .asm_28224
ld a, [InLinkBattle]
cp $2
jp nz, .asm_282fe
ld hl, $cb84
.asm_28254
ld a, [hli]
cp $20
jr nz, .asm_28254
.asm_28259
ld a, [hli]
cp $fe
jr z, .asm_28259
cp $20
jr z, .asm_28259
dec hl
ld de, $cb84
ld bc, $0190
call CopyBytes
ld hl, $cb84
ld bc, $00c6
.asm_28272
ld a, [hl]
cp $21
jr nz, .asm_28279
ld [hl], $fe
.asm_28279
inc hl
dec bc
ld a, b
or c
jr nz, .asm_28272
ld de, $cc9e
.asm_28282
ld a, [de]
inc de
cp $ff
jr z, .asm_28294
ld hl, $cc4a
dec a
ld b, $0
ld c, a
add hl, bc
ld [hl], $fe
jr .asm_28282
.asm_28294
ld hl, $cb84
ld de, $c9f4
ld b, $6
.asm_2829c
push bc
ld bc, $0021
call CopyBytes
ld a, $e
add e
ld e, a
ld a, $0
adc d
ld d, a
pop bc
dec b
jr nz, .asm_2829c
ld de, $c9f4
ld b, $6
.asm_282b4
push bc
ld a, $21
add e
ld e, a
ld a, $0
adc d
ld d, a
ld bc, $000e
call CopyBytes
pop bc
dec b
jr nz, .asm_282b4
ld b, $6
ld de, $c9f4
.asm_282cc
push bc
push de
callba Function1de5c8
ld a, c
or a
jr z, .asm_282ee
sub $3
jr nc, .asm_282e4
callba Function1df203
jr .asm_282ee
.asm_282e4
cp $2
jr nc, .asm_282ee
callba Function1df220
.asm_282ee
pop de
ld hl, $002f
add hl, de
ld d, h
ld e, l
pop bc
dec b
jr nz, .asm_282cc
ld de, $cb0e
xor a
ld [de], a
.asm_282fe
ld hl, OverworldMap
ld de, $d26b
ld bc, $000b
call CopyBytes
ld de, OTPartyCount
ld bc, $0008
call CopyBytes
ld de, $d276
ld bc, $0002
call CopyBytes
ld de, OTPartyMon1Species
ld bc, $01a4
call CopyBytes
ld a, $a8
ld [$d102], a
ld a, $d3
ld [$d103], a
ld de, MUSIC_NONE
call PlayMusic
ld a, [$ffcb]
cp $2
ld c, 66
call z, DelayFrames
ld a, [InLinkBattle]
cp $3
jr nz, .asm_283a9
ld a, CAL
ld [OtherTrainerClass], a
call ClearScreen
callba Function4d354
ld hl, Options
ld a, [hl]
push af
and $20
or $3
ld [hl], a
ld hl, $d26b
ld de, OTName
ld bc, $000b
call CopyBytes
call Function222a
ld a, [$c2d7]
push af
ld a, $1
ld [$c2d7], a
ld a, [rIE]
push af
ld a, [rIF]
push af
xor a
ld [rIF], a
ld a, [rIE]
set 1, a
ld [rIE], a
pop af
ld [rIF], a
predef StartBattle
ld a, [rIF]
ld h, a
xor a
ld [rIF], a
pop af
ld [rIE], a
ld a, h
ld [rIF], a
pop af
ld [$c2d7], a
pop af
ld [Options], a
callba Function1500c
jp Function28b22
.asm_283a9
ld de, MUSIC_ROUTE_30
call PlayMusic
jp Function287e3
; 283b2
Function283b2: ; 283b2
ld de, UnknownText_0x283ed
ld b, $a
.asm_283b7
call DelayFrame
call Function908
dec b
jr nz, .asm_283b7
xor a
ld [hld], a
ld [hl], a
ld [$ff9e], a
push de
hlcoord 0, 12
ld b, $4
ld c, $12
push de
ld d, h
ld e, l
callba Function4d35b
pop de
pop hl
bccoord 1, 14
call Function13e5
call Function4b6
call ClearScreen
ld b, $8
call GetSGBLayout
call Function3200
ret
; 283ed
UnknownText_0x283ed: ; 0x283ed
; Too much time has elapsed. Please try again.
text_jump UnknownText_0x1c4183
db "@"
; 0x283f2
Function283f2: ; 283f2
ld a, $1
ld [$ffcc], a
.asm_283f6
ld a, [hl]
ld [hSerialSend], a
call Function78a
push bc
ld b, a
inc hl
ld a, $30
.asm_28401
dec a
jr nz, .asm_28401
ld a, [$ffcc]
and a
ld a, b
pop bc
jr z, .asm_28411
dec hl
xor a
ld [$ffcc], a
jr .asm_283f6
.asm_28411
ld [de], a
inc de
dec bc
ld a, b
or c
jr nz, .asm_283f6
ret
; 28419
String28419: ; 28419
db "PLEASE WAIT!@"
; 28426
Function28426: ; 28426
ld hl, OverworldMap
ld bc, $0514
.asm_2842c
xor a
ld [hli], a
dec bc
ld a, b
or c
jr nz, .asm_2842c
ret
; 28434
Function28434: ; 28434
ld hl, $d1f3
ld a, $fd
ld b, $7
.asm_2843b
ld [hli], a
dec b
jr nz, .asm_2843b
ld b, $a
.asm_28441
call Random
cp $fd
jr nc, .asm_28441
ld [hli], a
dec b
jr nz, .asm_28441
ld hl, $c608
ld a, $fd
ld [hli], a
ld [hli], a
ld [hli], a
ld b, $c8
xor a
.asm_28457
ld [hli], a
dec b
jr nz, .asm_28457
ld hl, $c818
ld de, $c612
ld bc, $0000
.asm_28464
inc c
ld a, c
cp $fd
jr z, .asm_2848c
ld a, b
dec a
jr nz, .asm_2847f
push bc
ld a, [InLinkBattle]
cp $1
ld b, $d
jr z, .asm_2847a
ld b, $27
.asm_2847a
ld a, c
cp b
pop bc
jr z, .asm_28495
.asm_2847f
inc hl
ld a, [hl]
cp $fe
jr nz, .asm_28464
ld a, c
ld [de], a
inc de
ld [hl], $ff
jr .asm_28464
.asm_2848c
ld a, $ff
ld [de], a
inc de
ld bc, $100
jr .asm_28464
.asm_28495
ld a, $ff
ld [de], a
ret
; 28499
Function28499: ; 28499
ld de, OverworldMap
ld a, $fd
ld b, $6
.asm_284a0
ld [de], a
inc de
dec b
jr nz, .asm_284a0
ld hl, PlayerName
ld bc, $000b
call CopyBytes
push de
ld hl, PartyCount
ld a, [hli]
ld [de], a
inc de
.asm_284b5
ld a, [hli]
cp $ff
jr z, .asm_284ce
ld [$d265], a
push hl
push de
callab Functionfb8f1
pop de
pop hl
ld a, [$d265]
ld [de], a
inc de
jr .asm_284b5
.asm_284ce
ld [de], a
pop de
ld hl, $0008
add hl, de
ld d, h
ld e, l
ld hl, PartyMon1Species
ld c, $6
.asm_284db
push bc
call Function284f6
ld bc, PartyMon2 - PartyMon1
add hl, bc
pop bc
dec c
jr nz, .asm_284db
ld hl, PartyMonOT
call .asm_284f0
ld hl, PartyMonNicknames
.asm_284f0
ld bc, $0042
jp CopyBytes
; 284f6
Function284f6: ; 284f6
ld b, h
ld c, l
push de
push bc
ld a, [hl]
ld [$d265], a
callab Functionfb8f1
pop bc
pop de
ld a, [$d265]
ld [de], a
inc de
ld hl, $0022
add hl, bc
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
xor a
ld [de], a
inc de
ld hl, $0020
add hl, bc
ld a, [hl]
ld [de], a
inc de
ld a, [bc]
cp $51
jr z, .asm_28528
cp $52
jr nz, .asm_28530
.asm_28528
ld a, $17
ld [de], a
inc de
ld [de], a
inc de
jr .asm_28544
.asm_28530
push bc
dec a
ld hl, BaseData + 7 ; type
ld bc, BaseData1 - BaseData0
call AddNTimes
ld bc, 2
ld a, BANK(BaseData)
call FarCopyBytes
pop bc
.asm_28544
push bc
ld hl, $0001
add hl, bc
ld bc, $1a
call CopyBytes
pop bc
ld hl, $001f
add hl, bc
ld a, [hl]
ld [de], a
ld [CurPartyLevel], a
inc de
push bc
ld hl, $0024
add hl, bc
ld bc, $0008
call CopyBytes
pop bc
push de
push bc
ld a, [bc]
dec a
push bc
ld b, 0
ld c, a
ld hl, KantoMonSpecials
add hl, bc
ld a, BANK(KantoMonSpecials)
call GetFarByte
ld [BaseSpecialAttack], a
pop bc
ld hl, $000a
add hl, bc
ld c, $5
ld b, $1
predef Functione17b
pop bc
pop de
ld a, [$ffb5]
ld [de], a
inc de
ld a, [$ffb6]
ld [de], a
inc de
ld h, b
ld l, c
ret
; 28595
Function28595: ; 28595
ld de, OverworldMap
ld a, $fd
ld b, $6
.asm_2859c
ld [de], a
inc de
dec b
jr nz, .asm_2859c
ld hl, PlayerName
ld bc, $000b
call CopyBytes
ld hl, PartyCount
ld bc, $0008
call CopyBytes
ld hl, PlayerID
ld bc, $0002
call CopyBytes
ld hl, PartyMon1Species
ld bc, $0120
call CopyBytes
ld hl, PartyMonOT
ld bc, $0042
call CopyBytes
ld hl, PartyMonNicknames
ld bc, $0042
call CopyBytes
ld a, [InLinkBattle]
cp $2
ret nz
ld de, $c9f4
ld a, $20
call Function28682
ld a, $0
call GetSRAMBank
ld hl, $a600
ld b, $6
.asm_285ef
push bc
ld bc, $0021
call CopyBytes
ld bc, $000e
add hl, bc
pop bc
dec b
jr nz, .asm_285ef
ld hl, $a600
ld b, $6
.asm_28603
push bc
ld bc, $0021
add hl, bc
ld bc, $000e
call CopyBytes
pop bc
dec b
jr nz, .asm_28603
ld b, $6
ld de, $a600
ld hl, $c9f9
.asm_2861a
push bc
push hl
push de
push hl
callba Function1de5c8
pop de
ld a, c
or a
jr z, .asm_2863f
sub $3
jr nc, .asm_28635
callba Function1df1e6
jr .asm_2863f
.asm_28635
cp $2
jr nc, .asm_2863f
callba Function1df220
.asm_2863f
pop de
ld hl, $002f
add hl, de
ld d, h
ld e, l
pop hl
ld bc, $0021
add hl, bc
pop bc
dec b
jr nz, .asm_2861a
call CloseSRAM
ld hl, $c9f9
ld bc, $00c6
.asm_28658
ld a, [hl]
cp $fe
jr nz, .asm_2865f
ld [hl], $21
.asm_2865f
inc hl
dec bc
ld a, b
or c
jr nz, .asm_28658
ld hl, $cabf
ld de, $cb13
ld b, $54
ld c, $0
.asm_2866f
inc c
ld a, [hl]
cp $fe
jr nz, .asm_2867a
ld [hl], $ff
ld a, c
ld [de], a
inc de
.asm_2867a
inc hl
dec b
jr nz, .asm_2866f
ld a, $ff
ld [de], a
ret
; 28682
Function28682: ; 28682
ld c, $5
.asm_28684
ld [de], a
inc de
dec c
jr nz, .asm_28684
ret
; 2868a
Function2868a: ; 2868a
push hl
ld d, h
ld e, l
ld bc, $cbea
ld hl, $cbe8
ld a, c
ld [hli], a
ld [hl], b
ld hl, OTPartyMon1Species
ld c, $6
.asm_2869b
push bc
call Function286ba
pop bc
dec c
jr nz, .asm_2869b
pop hl
ld bc, $0108
add hl, bc
ld de, OTPartyMonOT
ld bc, $0042
call CopyBytes
ld de, OTPartyMonNicknames
ld bc, $0042
jp CopyBytes
; 286ba
Function286ba: ; 286ba
ld b, h
ld c, l
ld a, [de]
inc de
push bc
push de
ld [$d265], a
callab Functionfb908
pop de
pop bc
ld a, [$d265]
ld [bc], a
ld [CurSpecies], a
ld hl, $0022
add hl, bc
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hl], a
inc de
ld hl, $0020
add hl, bc
ld a, [de]
inc de
ld [hl], a
ld hl, $cbe8
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [de]
ld [hli], a
inc de
ld a, [de]
ld [hli], a
inc de
ld a, l
ld [$cbe8], a
ld a, h
ld [$cbe9], a
push bc
ld hl, $0001
add hl, bc
push hl
ld h, d
ld l, e
pop de
push bc
ld a, [hli]
ld b, a
call Function28771
ld a, b
ld [de], a
inc de
pop bc
ld bc, $0019
call CopyBytes
pop bc
ld d, h
ld e, l
ld hl, $001f
add hl, bc
ld a, [de]
inc de
ld [hl], a
ld [CurPartyLevel], a
push bc
ld hl, $0024
add hl, bc
push hl
ld h, d
ld l, e
pop de
ld bc, $0008
call CopyBytes
pop bc
call GetBaseData
push de
push bc
ld d, h
ld e, l
ld hl, $000a
add hl, bc
ld c, $5
ld b, $1
predef Functione17b
pop bc
pop hl
ld a, [$ffb5]
ld [hli], a
ld a, [$ffb6]
ld [hli], a
push hl
push bc
ld hl, $000a
add hl, bc
ld c, $6
ld b, $1
predef Functione17b
pop bc
pop hl
ld a, [$ffb5]
ld [hli], a
ld a, [$ffb6]
ld [hli], a
push hl
ld hl, $001b
add hl, bc
ld a, $46
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hl], a
pop hl
inc de
inc de
ret
; 28771
Function28771: ; 28771
ld a, b
and a
ret z
push hl
ld hl, Unknown_28785
.asm_28778
ld a, [hli]
and a
jr z, .asm_28783
cp b
jr z, .asm_28782
inc hl
jr .asm_28778
.asm_28782
ld b, [hl]
.asm_28783
pop hl
ret
; 28785
Unknown_28785: ; 28785
; Alternate mappings for unused items.
db ITEM_19, LEFTOVERS
db ITEM_2D, BITTER_BERRY
db ITEM_32, GOLD_BERRY
db ITEM_5A, BERRY
db ITEM_64, BERRY
db ITEM_78, BERRY
db ITEM_87, BERRY
db ITEM_BE, BERRY
db ITEM_C3, BERRY
db ITEM_DC, BERRY
db HM_08, BERRY
db $ff, BERRY
db $00
; 2879e
Function2879e: ; 2879e
.asm_2879e
ld a, [hli]
cp $fe
jr z, .asm_2879e
ld [de], a
inc de
dec bc
ld a, b
or c
jr nz, .asm_2879e
ret
; 287ab
Function287ab: ; 287ab
ld a, [$ffcb]
cp $2
ret z
ld hl, EnemyMonSpecies
call Function287d8
ld de, LinkBattleRNs
ld c, $a
.asm_287bb
ld a, [hli]
cp $fe
jr z, .asm_287bb
cp $fd
jr z, .asm_287bb
ld [de], a
inc de
dec c
jr nz, .asm_287bb
ret
; 287ca
Function287ca: ; 287ca
.asm_287ca
ld a, [hli]
and a
jr z, .asm_287ca
cp $fd
jr z, .asm_287ca
cp $fe
jr z, .asm_287ca
dec hl
ret
; 287d8
Function287d8: ; 287d8
.asm_287d8
ld a, [hli]
cp $fd
jr z, .asm_287d8
cp $fe
jr z, .asm_287d8
dec hl
ret
; 287e3
Function287e3: ; 287e3
call ClearScreen
call Function28ef8
callba Function16d673
xor a
ld hl, $cf51
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld a, $1
ld [$cfa9], a
inc a
ld [$cf56], a
jp Function2888b
; 28803
Function28803: ; 28803
ld a, $1
ld [MonType], a
ld a, $c1
ld [$cfa8], a
ld a, [OTPartyCount]
ld [$cfa3], a
ld a, $1
ld [$cfa4], a
ld a, $9
ld [$cfa1], a
ld a, $6
ld [$cfa2], a
ld a, $1
ld [$cfaa], a
ld a, $10
ld [$cfa7], a
ld a, $20
ld [$cfa5], a
xor a
ld [$cfa6], a
Function28835: ; 28835
callba Function16d70c
ld a, d
and a
jp z, Function2891c
bit 0, a
jr z, .asm_2885b
ld a, $1
ld [$d263], a
callab Function50db9
ld hl, OTPartyMon1Species
callba Function4d319
jp Function2891c
.asm_2885b
bit 6, a
jr z, .asm_28883
ld a, [$cfa9]
ld b, a
ld a, [OTPartyCount]
cp b
jp nz, Function2891c
xor a
ld [MonType], a
call Function1bf7
push hl
push bc
ld bc, $000b
add hl, bc
ld [hl], $7f
pop bc
pop hl
ld a, [PartyCount]
ld [$cfa9], a
jr Function2888b
.asm_28883
bit 7, a
jp z, Function2891c
jp Function28ac9
; 2888b
Function2888b: ; 2888b
callba Function49856
xor a
ld [MonType], a
ld a, $c1
ld [$cfa8], a
ld a, [PartyCount]
ld [$cfa3], a
ld a, $1
ld [$cfa4], a
ld a, $1
ld [$cfa1], a
ld a, $6
ld [$cfa2], a
ld a, $1
ld [$cfaa], a
ld a, $10
ld [$cfa7], a
ld a, $20
ld [$cfa5], a
xor a
ld [$cfa6], a
call Function3200
Function288c5: ; 288c5
callba Function16d70c
ld a, d
and a
jr nz, .asm_288d2
jp Function2891c
.asm_288d2
bit 0, a
jr z, .asm_288d9
jp Function28926
.asm_288d9
bit 7, a
jr z, .asm_288fe
ld a, [$cfa9]
dec a
jp nz, Function2891c
ld a, $1
ld [MonType], a
call Function1bf7
push hl
push bc
ld bc, $000b
add hl, bc
ld [hl], $7f
pop bc
pop hl
ld a, $1
ld [$cfa9], a
jp Function28803
.asm_288fe
bit 6, a
jr z, Function2891c
ld a, [$cfa9]
ld b, a
ld a, [PartyCount]
cp b
jr nz, Function2891c
call Function1bf7
push hl
push bc
ld bc, $000b
add hl, bc
ld [hl], $7f
pop bc
pop hl
jp Function28ade
; 2891c
Function2891c: ; 2891c
ld a, [MonType]
and a
jp z, Function288c5
jp Function28835
; 28926
Function28926: ; 28926
call Function309d
ld a, [$cfa9]
push af
hlcoord 0, 15
ld b, $1
ld c, $12
call Function28eef
hlcoord 2, 16
ld de, String28ab4
call PlaceString
callba Function4d354
.asm_28946
ld a, $7f
ld [$c5eb], a
ld a, $13
ld [$cfa8], a
ld a, $1
ld [$cfa3], a
ld a, $1
ld [$cfa4], a
ld a, $10
ld [$cfa1], a
ld a, $1
ld [$cfa2], a
ld a, $1
ld [$cfa9], a
ld [$cfaa], a
ld a, $20
ld [$cfa7], a
xor a
ld [$cfa5], a
ld [$cfa6], a
call Function1bd3
bit 4, a
jr nz, .asm_2898d
bit 1, a
jr z, .asm_289cd
.asm_28983
pop af
ld [$cfa9], a
call Function30b4
jp Function2888b
.asm_2898d
ld a, $7f
ld [$c5e1], a
ld a, $23
ld [$cfa8], a
ld a, $1
ld [$cfa3], a
ld a, $1
ld [$cfa4], a
ld a, $10
ld [$cfa1], a
ld a, $b
ld [$cfa2], a
ld a, $1
ld [$cfa9], a
ld [$cfaa], a
ld a, $20
ld [$cfa7], a
xor a
ld [$cfa5], a
ld [$cfa6], a
call Function1bd3
bit 5, a
jp nz, .asm_28946
bit 1, a
jr nz, .asm_28983
jr .asm_289fe
.asm_289cd
pop af
ld [$cfa9], a
ld a, $4
ld [$d263], a
callab Function50db9
callba Function4d319
call Function30b4
hlcoord 6, 1
ld bc, $0601
ld a, $7f
call Function28b77
hlcoord 17, 1
ld bc, $0601
ld a, $7f
call Function28b77
jp Function2888b
.asm_289fe
call Function1bee
pop af
ld [$cfa9], a
dec a
ld [DefaultFlypoint], a
ld [$cf56], a
callba Function16d6ce
ld a, [$cf51]
cp $f
jp z, Function287e3
ld [$d003], a
call Function28b68
ld c, $64
call DelayFrames
callba Functionfb57e
jr c, .asm_28a58
callba Functionfb5dd
jp nc, Function28b87
xor a
ld [$cf57], a
ld [$cf52], a
hlcoord 0, 12
ld b, $4
ld c, $12
call Function28eef
callba Function4d354
ld hl, UnknownText_0x28aaf
bccoord 1, 14
call Function13e5
jr .asm_28a89
.asm_28a58
xor a
ld [$cf57], a
ld [$cf52], a
ld a, [$d003]
ld hl, OTPartySpecies
ld c, a
ld b, $0
add hl, bc
ld a, [hl]
ld [$d265], a
call GetPokemonName
hlcoord 0, 12
ld b, $4
ld c, $12
call Function28eef
callba Function4d354
ld hl, UnknownText_0x28ac4
bccoord 1, 14
call Function13e5
.asm_28a89
hlcoord 0, 12
ld b, $4
ld c, $12
call Function28eef
hlcoord 1, 14
ld de, String28ece
call PlaceString
ld a, $1
ld [$cf56], a
callba Function16d6ce
ld c, $64
call DelayFrames
jp Function287e3
; 28aaf
UnknownText_0x28aaf: ; 0x28aaf
; If you trade that #MON, you won't be able to battle.
text_jump UnknownText_0x1c41b1
db "@"
; 0x28ab4
String28ab4: ; 28ab4
db "STATS TRADE@"
UnknownText_0x28ac4: ; 0x28ac4
; Your friend's @ appears to be abnormal!
text_jump UnknownText_0x1c41e6
db "@"
; 0x28ac9
Function28ac9: ; 28ac9
ld a, [$cfa9]
cp $1
jp nz, Function2891c
call Function1bf7
push hl
push bc
ld bc, $000b
add hl, bc
ld [hl], $7f
pop bc
pop hl
Function28ade: ; 28ade
.asm_28ade
ld a, $ed
ld [$c5fd], a
.asm_28ae3
call Functiona57
ld a, [$ffa9]
and a
jr z, .asm_28ae3
bit 0, a
jr nz, .asm_28b0b
push af
ld a, $7f
ld [$c5fd], a
pop af
bit 6, a
jr z, .asm_28b03
ld a, [OTPartyCount]
ld [$cfa9], a
jp Function28803
.asm_28b03
ld a, $1
ld [$cfa9], a
jp Function2888b
.asm_28b0b
ld a, $ec
ld [$c5fd], a
ld a, $f
ld [$cf56], a
callba Function16d6ce
ld a, [$cf51]
cp $f
jr nz, .asm_28ade
Function28b22: ; 28b22
call Function4b6
call ClearScreen
ld b, $8
call GetSGBLayout
call Function3200
xor a
ld [$cfbb], a
xor a
ld [rSB], a
ld [hSerialSend], a
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
ret
; 28b42
Function28b42: ; 28b42
hlcoord 0, 16
ld a, $7e
ld bc, $0028
call ByteFill
hlcoord 1, 16
ld a, $7f
ld bc, $0012
call ByteFill
hlcoord 2, 16
ld de, String_28b61
jp PlaceString
; 28b61
String_28b61: ; 28b61
db "CANCEL@"
; 28b68
Function28b68: ; 28b68
ld a, [$cf51]
hlcoord 6, 9
ld bc, $0014
call AddNTimes
ld [hl], $ec
ret
; 28b77
Function28b77: ; 28b77
.asm_28b77
push bc
push hl
.asm_28b79
ld [hli], a
dec c
jr nz, .asm_28b79
pop hl
ld bc, $0014
add hl, bc
pop bc
dec b
jr nz, .asm_28b77
ret
; 28b87
Function28b87: ; 28b87
xor a
ld [$cf57], a
ld [$cf52], a
hlcoord 0, 12
ld b, $4
ld c, $12
call Function28eef
callba Function4d354
ld a, [DefaultFlypoint]
ld hl, PartySpecies
ld c, a
ld b, $0
add hl, bc
ld a, [hl]
ld [$d265], a
call GetPokemonName
ld hl, StringBuffer1
ld de, $d004
ld bc, $000b
call CopyBytes
ld a, [$d003]
ld hl, OTPartySpecies
ld c, a
ld b, $0
add hl, bc
ld a, [hl]
ld [$d265], a
call GetPokemonName
ld hl, UnknownText_0x28eb8
bccoord 1, 14
call Function13e5
call Function1d6e
hlcoord 10, 7
ld b, $3
ld c, $7
call Function28eef
ld de, String28eab
hlcoord 12, 8
call PlaceString
ld a, $8
ld [$cfa1], a
ld a, $b
ld [$cfa2], a
ld a, $1
ld [$cfa4], a
ld a, $2
ld [$cfa3], a
xor a
ld [$cfa5], a
ld [$cfa6], a
ld a, $20
ld [$cfa7], a
ld a, $3
ld [$cfa8], a
ld a, $1
ld [$cfa9], a
ld [$cfaa], a
callba Function4d354
call Function1bd3
push af
call Function1d7d
call Function3200
pop af
bit 1, a
jr nz, .asm_28c33
ld a, [$cfa9]
dec a
jr z, .asm_28c54
.asm_28c33
ld a, $1
ld [$cf56], a
hlcoord 0, 12
ld b, $4
ld c, $12
call Function28eef
hlcoord 1, 14
ld de, String28ece
call PlaceString
callba Function16d6ce
jp Function28ea3
.asm_28c54
ld a, $2
ld [$cf56], a
callba Function16d6ce
ld a, [$cf51]
dec a
jr nz, .asm_28c7b
hlcoord 0, 12
ld b, $4
ld c, $12
call Function28eef
hlcoord 1, 14
ld de, String28ece
call PlaceString
jp Function28ea3
.asm_28c7b
ld hl, $a600
ld a, [DefaultFlypoint]
ld bc, $002f
call AddNTimes
ld a, $0
call GetSRAMBank
ld d, h
ld e, l
ld bc, $002f
add hl, bc
ld a, [DefaultFlypoint]
ld c, a
.asm_28c96
inc c
ld a, c
cp $6
jr z, .asm_28ca6
push bc
ld bc, $002f
call CopyBytes
pop bc
jr .asm_28c96
.asm_28ca6
ld hl, $a600
ld a, [PartyCount]
dec a
ld bc, $002f
call AddNTimes
push hl
ld hl, $c9f4
ld a, [$d003]
ld bc, $002f
call AddNTimes
pop de
ld bc, $002f
call CopyBytes
call CloseSRAM
ld hl, PlayerName
ld de, $c6e7
ld bc, $000b
call CopyBytes
ld a, [DefaultFlypoint]
ld hl, PartySpecies
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
ld [PlayerSDefLevel], a
push af
ld a, [DefaultFlypoint]
ld hl, PartyMonOT
call SkipNames
ld de, $c6f2
ld bc, $000b
call CopyBytes
ld hl, PartyMon1ID
ld a, [DefaultFlypoint]
call GetPartyLocation
ld a, [hli]
ld [PlayerScreens], a
ld a, [hl]
ld [EnemyScreens], a
ld hl, PartyMon1DVs
ld a, [DefaultFlypoint]
call GetPartyLocation
ld a, [hli]
ld [$c6fd], a
ld a, [hl]
ld [$c6fe], a
ld a, [DefaultFlypoint]
ld hl, PartyMon1Species
call GetPartyLocation
ld b, h
ld c, l
callba GetCaughtGender
ld a, c
ld [$c701], a
ld hl, $d26b
ld de, $c719
ld bc, $000b
call CopyBytes
ld a, [$d003]
ld hl, OTPartySpecies
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
ld [PlayerLightScreenCount], a
ld a, [$d003]
ld hl, OTPartyMonOT
call SkipNames
ld de, $c724
ld bc, $000b
call CopyBytes
ld hl, OTPartyMon1ID
ld a, [$d003]
call GetPartyLocation
ld a, [hli]
ld [$c731], a
ld a, [hl]
ld [$c732], a
ld hl, OTPartyMon1DVs
ld a, [$d003]
call GetPartyLocation
ld a, [hli]
ld [$c72f], a
ld a, [hl]
ld [$c730], a
ld a, [$d003]
ld hl, OTPartyMon1Species
call GetPartyLocation
ld b, h
ld c, l
callba GetCaughtGender
ld a, c
ld [$c733], a
ld a, [DefaultFlypoint]
ld [CurPartyMon], a
ld hl, PartySpecies
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
ld [DefaultFlypoint], a
xor a
ld [$d10b], a
callab Functione039
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
ld a, $1
ld [$d1e9], a
ld a, [$d003]
push af
ld hl, OTPartySpecies
ld b, $0
ld c, a
add hl, bc
ld a, [hl]
ld [$d003], a
ld c, $64
call DelayFrames
call ClearTileMap
call Functione58
ld b, $8
call GetSGBLayout
ld a, [$ffcb]
cp $1
jr z, .asm_28de4
predef Function28f24
jr .asm_28de9
.asm_28de4
predef Function28f63
.asm_28de9
pop af
ld c, a
ld [CurPartyMon], a
ld hl, OTPartySpecies
ld d, $0
ld e, a
add hl, de
ld a, [hl]
ld [CurPartySpecies], a
ld hl, OTPartyMon1Species
ld a, c
call GetPartyLocation
ld de, TempMonSpecies
ld bc, PartyMon2 - PartyMon1
call CopyBytes
predef Functionda96
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
callab Function421d8
call ClearScreen
call Function28ef8
call Function28eff
callba Function4d354
ld b, $1
pop af
ld c, a
cp $97
jr z, .asm_28e49
ld a, [CurPartySpecies]
cp $97
jr z, .asm_28e49
ld b, $2
ld a, c
cp $fb
jr z, .asm_28e49
ld a, [CurPartySpecies]
cp $fb
jr z, .asm_28e49
ld b, $0
.asm_28e49
ld a, b
ld [$cf56], a
push bc
call Function862
pop bc
ld a, [InLinkBattle]
cp $1
jr z, .asm_28e63
ld a, b
and a
jr z, .asm_28e63
ld a, [$cf52]
cp b
jr nz, .asm_28e49
.asm_28e63
callba Function14a58
callba Function1060af
callba Function106187
ld c, $28
call DelayFrames
hlcoord 0, 12
ld b, $4
ld c, $12
call Function28eef
hlcoord 1, 14
ld de, String28ebd
call PlaceString
callba Function4d354
ld c, $32
call DelayFrames
ld a, [InLinkBattle]
cp $1
jp z, Function2805d
jp Function28177
; 28ea3
Function28ea3: ; 28ea3
ld c, 100
call DelayFrames
jp Function287e3
; 28eab
String28eab: ; 28eab
db "TRADE"
next "CANCEL@"
UnknownText_0x28eb8: ; 0x28eb8
; Trade @ for @ ?
text_jump UnknownText_0x1c4212
db "@"
; 0x28ebd
String28ebd: ; 28ebd
db "Trade completed!@"
String28ece: ; 28ece
db "Too bad! The trade"
next "was canceled!@"
Function28eef: ; 28eef
ld d, h
ld e, l
callba Function16d6ca
ret
; 28ef8
Function28ef8: ; 28ef8
callba Function16d696
ret
; 28eff
Function28eff: ; 28eff
callba Function16d6a7
call Function32f9
ret
; 28f09
Function28f09: ; 28f09
hlcoord 0, 0
ld b, 6
ld c, 18
call Function28eef
hlcoord 0, 8
ld b, 6
ld c, 18
call Function28eef
callba Functionfb60d
ret
; 28f24
Function28f24: ; 28f24
xor a
ld [$cf66], a
ld hl, $c6e7
ld de, $c719
call Function297ff
ld hl, PlayerSDefLevel
ld de, PlayerLightScreenCount
call Function29814
ld de, .data_28f3f
jr Function28fa1
.data_28f3f
db $1b
db $1
db $1c
db $21
db $2d
db $27
db $23
db $3
db $25
db $28
db $25
db $1e
db $29
db $6
db $16
db $1f
db $19
db $17
db $22
db $1f
db $2a
db $e
db $3
db $24
db $5
db $25
db $2
db $27
db $25
db $1d
db $2c
db $2e
db $1e
db $18
db $1f
db $2b
Function28f63: ; 28f63
xor a
ld [$cf66], a
ld hl, $c719
ld de, $c6e7
call Function297ff
ld hl, PlayerLightScreenCount
ld de, PlayerSDefLevel
call Function29814
ld de, .data_28f7e
jr Function28fa1
.data_28f7e
db $1a
db $17
db $22
db $1f
db $2a
db $6
db $3
db $24
db $5
db $25
db $2
db $27
db $25
db $1d
db $2c
db $2f
db $1e
db $18
db $1f
db $1b
db $1
db $1c
db $22
db $27
db $23
db $3
db $25
db $28
db $25
db $1e
db $29
db $e
db $16
db $1f
db $2b
Function28fa1: ; 28fa1
ld hl, BattleEnded
ld [hl], e
inc hl
ld [hl], d
ld a, [$ffde]
push af
xor a
ld [$ffde], a
ld hl, VramState
ld a, [hl]
push af
res 0, [hl]
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
call Function28fdb
ld a, [$cf66]
and a
jr nz, .asm_28fca
ld de, MUSIC_EVOLUTION
call PlayMusic2
.asm_28fca
call Function29082
jr nc, .asm_28fca
pop af
ld [Options], a
pop af
ld [VramState], a
pop af
ld [$ffde], a
ret
; 28fdb
Function28fdb: ; 28fdb
xor a
ld [$cf63], a
call WhiteBGMap
call ClearSprites
call ClearTileMap
call DisableLCD
call Functione58
callab Function8cf53
ld a, [hCGB]
and a
jr z, .asm_2900b
ld a, $1
ld [rVBK], a
ld hl, VTiles0
ld bc, $2000
xor a
call ByteFill
ld a, $0
ld [rVBK], a
.asm_2900b
ld hl, VBGMap0
ld bc, $0800
ld a, $7f
call ByteFill
ld hl, TradeGameBoyLZ
ld de, $9310
call Decompress
ld hl, TradeArrowGFX
ld de, $8ed0
ld bc, $0010
ld a, BANK(TradeArrowGFX)
call FarCopyBytes
ld hl, TradeArrowGFX + $10
ld de, $8ee0
ld bc, $0010
ld a, BANK(TradeArrowGFX)
call FarCopyBytes
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
callba Function4d7fd
call EnableLCD
call Function2982b
ld a, [PlayerSDefLevel]
ld hl, $c6fd
ld de, VTiles0
call Function29491
ld a, [PlayerLightScreenCount]
ld hl, $c72f
ld de, $8310
call Function29491
ld a, [PlayerSDefLevel]
ld de, PlayerAccLevel
call Function294a9
ld a, [PlayerLightScreenCount]
ld de, PlayerReflectCount
call Function294a9
call Function297ed
ret
; 29082
Function29082: ; 29082
ld a, [$cf63]
bit 7, a
jr nz, .asm_2909b
call Function290a0
callab Function8cf69
ld hl, $cf65
inc [hl]
call DelayFrame
and a
ret
.asm_2909b
call Functione51
scf
ret
; 290a0
Function290a0: ; 290a0
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, JumpTable290af
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 290af
JumpTable290af: ; 290af
dw Function29114
dw Function2942e
dw Function29461
dw Function29348
dw Function2937e
dw Function29391
dw Function29129
dw Function291af
dw Function291c4
dw Function291d9
dw Function2925d
dw Function29220
dw Function2925d
dw Function29229
dw Function2913c
dw Function2925d
dw Function291e8
dw Function291fd
dw Function29211
dw Function29220
dw Function2925d
dw Function29229
dw Function29701
dw Function2973c
dw Function2975c
dw Function2977f
dw Function297a4
dw Function293a6
dw Function293b6
dw Function293d2
dw Function293de
dw Function293ea
dw Function2940c
dw Function294e7
dw Function294f0
dw Function2961b
dw Function2962c
dw Function29879
dw Function29886
dw Function29649
dw Function29660
dw Function2926d
dw Function29277
dw Function29123
dw Function29487
dw Function294f9
dw Function29502
dw Function2950c
; 2910f
Function2910f: ; 2910f
ld hl, $cf63
inc [hl]
ret
; 29114
Function29114: ; 29114
ld hl, BattleEnded
ld e, [hl]
inc hl
ld d, [hl]
ld a, [de]
ld [$cf63], a
inc de
ld [hl], d
dec hl
ld [hl], e
ret
; 29123
Function29123: ; 29123
ld hl, $cf63
set 7, [hl]
ret
; 29129
Function29129: ; 29129
ld a, $ed
call Function292f6
ld a, [$c74c]
ld [$d265], a
xor a
ld de, $2c58
ld b, $0
jr Function2914e
Function2913c: ; 2913c
ld a, $ee
call Function292f6
ld a, [$c74d]
ld [$d265], a
ld a, $2
ld de, $4c94
ld b, $4
Function2914e: ; 2914e
push bc
push de
push bc
push de
push af
call DisableLCD
callab Function8cf53
ld hl, $9874
ld bc, $000c
ld a, $60
call ByteFill
pop af
call Function29281
xor a
ld [hSCX], a
ld a, $7
ld [hWX], a
ld a, $70
ld [hWY], a
call EnableLCD
call Function2985a
pop de
ld a, $11
call Function3b2a
ld hl, $000b
add hl, bc
pop bc
ld [hl], b
pop de
ld a, $12
call Function3b2a
ld hl, $000b
add hl, bc
pop bc
ld [hl], b
call WaitBGMap
ld b, $1b
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
ld a, $d0
call Functioncf8
call Function2910f
ld a, $5c
ld [$cf64], a
ret
; 291af
Function291af: ; 291af
call Function2981d
ld a, [hSCX]
add $2
ld [hSCX], a
cp $50
ret nz
ld a, $1
call Function29281
call Function2910f
ret
; 291c4
Function291c4: ; 291c4
call Function2981d
ld a, [hSCX]
add $2
ld [hSCX], a
cp $a0
ret nz
ld a, $2
call Function29281
call Function2910f
ret
; 291d9
Function291d9: ; 291d9
call Function2981d
ld a, [hSCX]
add $2
ld [hSCX], a
and a
ret nz
call Function2910f
ret
; 291e8
Function291e8: ; 291e8
call Function2981d
ld a, [hSCX]
sub $2
ld [hSCX], a
cp $b0
ret nz
ld a, $1
call Function29281
call Function2910f
ret
; 291fd
Function291fd: ; 291fd
call Function2981d
ld a, [hSCX]
sub $2
ld [hSCX], a
cp $60
ret nz
xor a
call Function29281
call Function2910f
ret
; 29211
Function29211: ; 29211
call Function2981d
ld a, [hSCX]
sub $2
ld [hSCX], a
and a
ret nz
call Function2910f
ret
; 29220
Function29220: ; 29220
ld a, $80
ld [$cf64], a
call Function2910f
ret
; 29229
Function29229: ; 29229
call WhiteBGMap
call ClearTileMap
call ClearSprites
call DisableLCD
callab Function8cf53
ld hl, VBGMap0
ld bc, $0800
ld a, $7f
call ByteFill
xor a
ld [hSCX], a
ld a, $90
ld [hWY], a
call EnableLCD
call Function2982b
call WaitBGMap
call Function297ed
call Function29114
ret
; 2925d
Function2925d: ; 2925d
call Function2981d
ld hl, $cf64
ld a, [hl]
and a
jr z, .asm_29269
dec [hl]
ret
.asm_29269
call Function2910f
ret
; 2926d
Function2926d: ; 2926d
call Function29114
ld de, SFX_GIVE_TRADEMON
call PlaySFX
ret
; 29277
Function29277: ; 29277
call Function29114
ld de, SFX_GET_TRADEMON
call PlaySFX
ret
; 29281
Function29281: ; 29281
and 3
ld e, a
ld d, 0
ld hl, Jumptable_2928f
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 2928f
Jumptable_2928f: ; 2928f
dw Function29297
dw Function292af
dw Function292be
dw Function29297
; 29297
Function29297: ; 29297
call Function297cf
hlcoord 9, 3
ld [hl], $5b
inc hl
ld bc, $000a
ld a, $60
call ByteFill
hlcoord 3, 2
call Function292ec
ret
; 292af
Function292af: ; 292af
call Function297cf
hlcoord 0, 3
ld bc, $0014
ld a, $60
call ByteFill
ret
; 292be
Function292be: ; 292be
call Function297cf
hlcoord 0, 3
ld bc, $0011
ld a, $60
call ByteFill
hlcoord 17, 3
ld a, $5d
ld [hl], a
ld a, $61
ld de, $0014
ld c, $3
.asm_292d9
add hl, de
ld [hl], a
dec c
jr nz, .asm_292d9
add hl, de
ld a, $5f
ld [hld], a
ld a, $5b
ld [hl], a
hlcoord 10, 6
call Function292ec
ret
; 292ec
Function292ec: ; 292ec
ld de, TradeGameBoyTilemap
lb bc, 8, 6
call Function297db
ret
; 292f6
Function292f6: ; 292f6
push af
call WhiteBGMap
call WaitTop
ld a, $9c
ld [$ffd7], a
call ClearTileMap
ld hl, TileMap
ld bc, $0014
ld a, $7a
call ByteFill
hlcoord 0, 1
ld de, $c736
call PlaceString
ld hl, $c741
ld de, 0
.asm_2931e
ld a, [hli]
cp $50
jr z, .asm_29326
dec de
jr .asm_2931e
.asm_29326
hlcoord 0, 4
add hl, de
ld de, $c741
call PlaceString
hlcoord 7, 2
ld bc, $0006
pop af
call ByteFill
call WaitBGMap
call WaitTop
ld a, $98
ld [$ffd7], a
call ClearTileMap
ret
; 29348
Function29348: ; 29348
call ClearTileMap
call WaitTop
ld a, $a0
ld [hSCX], a
call DelayFrame
hlcoord 8, 2
ld de, Tilemap_298f7
lb bc, 3, 12
call Function297db
call WaitBGMap
ld b, $1b
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
ld de, $e4e4
call DmgToCgbObjPals
ld de, SFX_POTION
call PlaySFX
call Function2910f
ret
; 2937e
Function2937e: ; 2937e
ld a, [hSCX]
and a
jr z, .asm_29388
add $4
ld [hSCX], a
ret
.asm_29388
ld c, $50
call DelayFrames
call Function29114
ret
; 29391
Function29391: ; 29391
ld a, [hSCX]
cp $a0
jr z, .asm_2939c
sub $4
ld [hSCX], a
ret
.asm_2939c
call ClearTileMap
xor a
ld [hSCX], a
call Function29114
ret
; 293a6
Function293a6: ; 293a6
ld a, $8f
ld [hWX], a
ld a, $88
ld [hSCX], a
ld a, $50
ld [hWY], a
call Function29114
ret
; 293b6
Function293b6: ; 293b6
ld a, [hWX]
cp $7
jr z, .asm_293c7
sub $4
ld [hWX], a
ld a, [hSCX]
sub $4
ld [hSCX], a
ret
.asm_293c7
ld a, $7
ld [hWX], a
xor a
ld [hSCX], a
call Function29114
ret
; 293d2
Function293d2: ; 293d2
ld a, $7
ld [hWX], a
ld a, $50
ld [hWY], a
call Function29114
ret
; 293de
Function293de: ; 293de
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
call Function29114
ret
; 293ea
Function293ea: ; 293ea
call WaitTop
ld a, $9c
ld [$ffd7], a
call WaitBGMap
ld a, $7
ld [hWX], a
xor a
ld [hWY], a
call DelayFrame
call WaitTop
ld a, $98
ld [$ffd7], a
call ClearTileMap
call Function2910f
ret
; 2940c
Function2940c: ; 2940c
ld a, [hWX]
cp $a1
jr nc, .asm_29417
add $4
ld [hWX], a
ret
.asm_29417
ld a, $9c
ld [$ffd7], a
call WaitBGMap
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
ld a, $98
ld [$ffd7], a
call Function29114
ret
; 2942e
Function2942e: ; 2942e
call Function2951f
ld a, [PlayerSDefLevel]
ld [CurPartySpecies], a
ld a, [$c6fd]
ld [TempMonDVs], a
ld a, [$c6fe]
ld [$d124], a
ld b, $1a
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
call Function294bb
ld a, [PlayerSDefLevel]
call GetCryIndex
jr c, .asm_2945d
ld e, c
ld d, b
call PlayCryHeader
.asm_2945d
call Function29114
ret
; 29461
Function29461: ; 29461
call Function29549
ld a, [PlayerLightScreenCount]
ld [CurPartySpecies], a
ld a, [$c72f]
ld [TempMonDVs], a
ld a, [$c730]
ld [$d124], a
ld b, $1a
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
call Function294c0
call Function29114
ret
; 29487
Function29487: ; 29487
callba Function4d81e
call Function29114
ret
; 29491
Function29491: ; 29491
push de
push af
predef GetUnownLetter
pop af
ld [CurPartySpecies], a
ld [CurSpecies], a
call GetBaseData
pop de
predef GetFrontpic
ret
; 294a9
Function294a9: ; 294a9
push de
ld [$d265], a
call GetPokemonName
ld hl, StringBuffer1
pop de
ld bc, $000b
call CopyBytes
ret
; 294bb
Function294bb: ; 294bb
ld de, VTiles0
jr Function294c3
Function294c0: ; 294c0
ld de, $8310
Function294c3: ; 294c3
call DelayFrame
ld hl, VTiles2
ld bc, $0a31
call Request2bpp
call WaitTop
call Function297cf
hlcoord 7, 2
xor a
ld [$ffad], a
ld bc, $0707
predef FillBox
call WaitBGMap
ret
; 294e7
Function294e7: ; 294e7
ld c, $50
call DelayFrames
call Function29114
ret
; 294f0
Function294f0: ; 294f0
ld c, $28
call DelayFrames
call Function29114
ret
; 294f9
Function294f9: ; 294f9
ld c, $60
call DelayFrames
call Function29114
ret
; 29502
Function29502: ; 29502
call Function29516
ret nz
ld c, $50
call DelayFrames
ret
; 2950c
Function2950c: ; 2950c
call Function29516
ret nz
ld c, $b4
call DelayFrames
ret
; 29516
Function29516: ; 29516
call Function29114
ld a, [PlayerLightScreenCount]
cp $fd
ret
; 2951f
Function2951f: ; 2951f
ld de, PlayerSDefLevel
ld a, [de]
cp $fd
jr z, Function295a1
call Function29573
ld de, PlayerSDefLevel
call Function295e3
ld de, PlayerAccLevel
call Function295ef
ld a, [$c701]
ld de, $c6f2
call Function295f6
ld de, PlayerScreens
call Function29611
call Function295d8
ret
; 29549
Function29549: ; 29549
ld de, PlayerLightScreenCount
ld a, [de]
cp $fd
jr z, Function295a1
call Function29573
ld de, PlayerLightScreenCount
call Function295e3
ld de, PlayerReflectCount
call Function295ef
ld a, [$c733]
ld de, $c724
call Function295f6
ld de, $c731
call Function29611
call Function295d8
ret
; 29573
Function29573: ; 29573
call WaitTop
call Function297cf
ld a, $9c
ld [$ffd7], a
hlcoord 3, 0
ld b, $6
ld c, $d
call TextBox
hlcoord 4, 0
ld de, String29591
call PlaceString
ret
; 29591
String29591: ; 29591
db "─── №.", $4e
db $4e
db "OT/", $4e
db $73, "№.@"
; 295a1
Function295a1: ; 295a1
call WaitTop
call Function297cf
ld a, $9c
ld [$ffd7], a
hlcoord 3, 0
ld b, $6
ld c, $d
call TextBox
hlcoord 4, 2
ld de, String295c2
call PlaceString
call Function295d8
ret
; 295c2
String295c2: ; 295c2
db "EGG", $4e
db "OT/?????", $4e
db $73, "№.?????@"
; 295d8
Function295d8: ; 295d8
call WaitBGMap
call WaitTop
ld a, $98
ld [$ffd7], a
ret
; 295e3
Function295e3: ; 295e3
hlcoord 10, 0
ld bc, $8103
call PrintNum
ld [hl], $7f
ret
; 295ef
Function295ef: ; 295ef
hlcoord 4, 2
call PlaceString
ret
; 295f6
Function295f6: ; 295f6
cp 3
jr c, .asm_295fb
xor a
.asm_295fb
push af
hlcoord 7, 4
call PlaceString
inc bc
pop af
ld hl, Unknown_2960e
ld d, 0
ld e, a
add hl, de
ld a, [hl]
ld [bc], a
ret
; 2960e
Unknown_2960e: ; 2960e
db " ", "♂", "♀"
; 29611
Function29611: ; 29611
hlcoord 7, 6
ld bc, $8205
call PrintNum
ret
; 2961b
Function2961b: ; 2961b
ld de, $5458
ld a, $e
call Function3b2a
call Function29114
ld a, $20
ld [$cf64], a
ret
; 2962c
Function2962c: ; 2962c
ld de, $5458
ld a, $e
call Function3b2a
ld hl, $000b
add hl, bc
ld [hl], $1
ld hl, $0007
add hl, bc
ld [hl], $dc
call Function29114
ld a, $38
ld [$cf64], a
ret
; 29649
Function29649: ; 29649
ld de, $5458
ld a, $f
call Function3b2a
call Function29114
ld a, $10
ld [$cf64], a
ld de, SFX_BALL_POOF
call PlaySFX
ret
; 29660
Function29660: ; 29660
ld a, $e4
call Functioncf8
ld de, $2858
ld a, $10
call Function3b2a
call Function29114
ld a, $40
ld [$cf64], a
ret
; 29676
Function29676: ; 29676 (a:5676)
ld hl, $b
add hl, bc
ld e, [hl]
ld d, 0
ld hl, Jumptable_29686
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 29686
Jumptable_29686: ; 29686 (a:5686)
dw Function2969a
dw Function296a4
dw Function296af
dw Function296bd
dw Function296cf
dw Function296dd
dw Function296f2
; 2969a
Function29694: ; 29694 (a:5694)
ld hl, $b
add hl, bc
inc [hl]
ret
Function2969a: ; 2969a (a:569a)
call Function29694
ld hl, $c
add hl, bc
ld [hl], $80
ret
Function296a4: ; 296a4 (a:56a4)
ld hl, $c
add hl, bc
ld a, [hl]
dec [hl]
and a
ret nz
call Function29694
Function296af: ; 296af (a:56af)
ld hl, $4
add hl, bc
ld a, [hl]
cp $94
jr nc, .asm_296ba
inc [hl]
ret
.asm_296ba
call Function29694
Function296bd: ; 296bd (a:56bd)
ld hl, $5
add hl, bc
ld a, [hl]
cp $4c
jr nc, .asm_296c8
inc [hl]
ret
.asm_296c8
ld hl, $0
add hl, bc
ld [hl], $0
ret
Function296cf: ; 296cf (a:56cf)
ld hl, $5
add hl, bc
ld a, [hl]
cp $2c
jr z, .asm_296da
dec [hl]
ret
.asm_296da
call Function29694
Function296dd: ; 296dd (a:56dd)
ld hl, $4
add hl, bc
ld a, [hl]
cp $58
jr z, .asm_296e8
dec [hl]
ret
.asm_296e8
call Function29694
ld hl, $c
add hl, bc
ld [hl], $80
ret
Function296f2: ; 296f2 (a:56f2)
ld hl, $c
add hl, bc
ld a, [hl]
dec [hl]
and a
ret nz
ld hl, $0
add hl, bc
ld [hl], $0
ret
; 29701 (a:5701)
Function29701: ; 29701
ld a, [InLinkBattle]
cp $1
jr z, .asm_29725
ld hl, UnknownText_0x29737
call PrintText
ld c, $bd
call DelayFrames
ld hl, UnknownText_0x29732
call PrintText
call Function297c9
ld c, $80
call DelayFrames
call Function29114
ret
.asm_29725
ld hl, UnknownText_0x29732
call PrintText
call Function297c9
call Function29114
ret
; 29732
UnknownText_0x29732: ; 0x29732
; was sent to @ .
text_jump UnknownText_0x1bc6e9
db "@"
; 0x29737
UnknownText_0x29737: ; 0x29737
;
text_jump UnknownText_0x1bc701
db "@"
; 0x2973c
Function2973c: ; 2973c
ld hl, UnknownText_0x29752
call PrintText
call Function297c9
ld hl, UnknownText_0x29757
call PrintText
call Function297c9
call Function29114
ret
; 29752
UnknownText_0x29752: ; 0x29752
; bids farewell to
text_jump UnknownText_0x1bc703
db "@"
; 0x29757
UnknownText_0x29757: ; 0x29757
; .
text_jump UnknownText_0x1bc719
db "@"
; 0x2975c
Function2975c: ; 2975c
call WaitTop
hlcoord 0, 10
ld bc, $00a0
ld a, $7f
call ByteFill
call WaitBGMap
ld hl, UnknownText_0x2977a
call PrintText
call Function297c9
call Function29114
ret
; 2977a
UnknownText_0x2977a: ; 0x2977a
; Take good care of @ .
text_jump UnknownText_0x1bc71f
db "@"
; 0x2977f
Function2977f: ; 2977f
ld hl, UnknownText_0x2979a
call PrintText
call Function297c9
ld hl, UnknownText_0x2979f
call PrintText
call Function297c9
ld c, $e
call DelayFrames
call Function29114
ret
; 2979a
UnknownText_0x2979a: ; 0x2979a
; For @ 's @ ,
text_jump UnknownText_0x1bc739
db "@"
; 0x2979f
UnknownText_0x2979f: ; 0x2979f
; sends @ .
text_jump UnknownText_0x1bc74c
db "@"
; 0x297a4
Function297a4: ; 297a4
ld hl, UnknownText_0x297bf
call PrintText
call Function297c9
ld hl, UnknownText_0x297c4
call PrintText
call Function297c9
ld c, $e
call DelayFrames
call Function29114
ret
; 297bf
UnknownText_0x297bf: ; 0x297bf
; will trade @ @
text_jump UnknownText_0x1bc75e
db "@"
; 0x297c4
UnknownText_0x297c4: ; 0x297c4
; for @ 's @ .
text_jump UnknownText_0x1bc774
db "@"
; 0x297c9
Function297c9: ; 297c9
ld c, $50
call DelayFrames
ret
; 297cf
Function297cf: ; 297cf
ld hl, TileMap
ld bc, $0168
ld a, $7f
call ByteFill
ret
; 297db
Function297db: ; 297db
.asm_297db
push bc
push hl
.asm_297dd
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .asm_297dd
pop hl
ld bc, $0014
add hl, bc
pop bc
dec b
jr nz, .asm_297db
ret
; 297ed
Function297ed: ; 297ed
ld a, [hSGB]
and a
ld a, $e4
jr z, .asm_297f6
ld a, $f0
.asm_297f6
call Functioncf8
ld a, $e4
call DmgToCgbBGPals
ret
; 297ff
Function297ff: ; 297ff
push de
ld de, $c736
ld bc, $000b
call CopyBytes
pop hl
ld de, $c741
ld bc, $000b
call CopyBytes
ret
; 29814
Function29814: ; 29814
ld a, [hl]
ld [$c74c], a
ld a, [de]
ld [$c74d], a
ret
; 2981d
Function2981d: ; 2981d
ld a, [$cf65]
and $7
ret nz
ld a, [rBGP]
xor $3c
call DmgToCgbBGPals
ret
; 2982b
Function2982b: ; 2982b
call DelayFrame
ld de, TradeBallGFX
ld hl, $8620
lb bc, BANK(TradeBallGFX), $6
call Request2bpp
ld de, TradePoofGFX
ld hl, $8680
lb bc, BANK(TradePoofGFX), $c
call Request2bpp
ld de, TradeCableGFX
ld hl, $8740
lb bc, BANK(TradeCableGFX), $4
call Request2bpp
xor a
ld hl, $c300
ld [hli], a
ld [hl], $62
ret
; 2985a
Function2985a: ; 2985a
call DelayFrame
ld e, $3
callab Function8e83f
ld de, TradeBubbleGFX
ld hl, $8720
lb bc, BANK(TradeBubbleGFX), $4
call Request2bpp
xor a
ld hl, $c300
ld [hli], a
ld [hl], $62
ret
; 29879
Function29879: ; 29879
ld hl, $cf64
ld a, [hl]
and a
jr z, .asm_29882
dec [hl]
ret
.asm_29882
call Function29114
ret
; 29886
Function29886: ; 29886
ld hl, $cf64
ld a, [hl]
and a
jr z, .asm_2988f
dec [hl]
ret
.asm_2988f
call Function29114
ret
; 29893
Function29893: ; 29893
; This function is unreferenced.
; It was meant for use in Japanese versions, so the
; constant used for copy length was changed by accident.
ld hl, Unknown_298b5
ld a, [hli]
ld [$c6d0], a
ld de, $c6e7
ld c, 13 ; jp: 8
.asm_2989f
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .asm_2989f
ld a, [hli]
ld [$c702], a
ld de, $c719
ld c, 13 ; jp: 8
.asm_298ae
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .asm_298ae
ret
; 298b5
Unknown_298b5: ; 298b5
db $03, "ゲーフり@@", $23, $01 ; GAME FREAK
db $06, "クりーチャ@", $56, $04 ; Creatures Inc.
; 298c7
TradeGameBoyTilemap: ; 298c7
; 6x8
db $31, $32, $32, $32, $32, $33
db $34, $35, $36, $36, $37, $38
db $34, $39, $3a, $3a, $3b, $38
db $3c, $3d, $3e, $3e, $3f, $40
db $41, $42, $43, $43, $44, $45
db $46, $47, $43, $48, $49, $4a
db $41, $43, $4b, $4c, $4d, $4e
db $4f, $50, $50, $50, $51, $52
; 297f7
Tilemap_298f7: ; 297f7
; 12x3
db $43, $55, $56, $53, $53, $53, $53, $53, $53, $53, $53, $53
db $43, $57, $58, $54, $54, $54, $54, $54, $54, $54, $54, $54
db $43, $59, $5a, $43, $43, $43, $43, $43, $43, $43, $43, $43
; 2991b
TradeArrowGFX: INCBIN "gfx/trade/arrow.2bpp"
TradeCableGFX: INCBIN "gfx/trade/cable.2bpp"
TradeBubbleGFX: INCBIN "gfx/trade/bubble.2bpp"
TradeGameBoyLZ: INCBIN "gfx/trade/game_boy.2bpp.lz"
TradeBallGFX: INCBIN "gfx/trade/ball.2bpp"
TradePoofGFX: INCBIN "gfx/trade/poof.2bpp"
Function29bfb: ; 29bfb
ld hl, PartySpecies
ld b, $6
.asm_29c00
ld a, [hli]
cp $ff
jr z, .asm_29c0c
cp 151 + 1
jr nc, .asm_29c42
dec b
jr nz, .asm_29c00
.asm_29c0c
ld a, [PartyCount]
ld b, a
ld hl, PartyMon1Item
.asm_29c13
push hl
push bc
ld d, [hl]
callba ItemIsMail
pop bc
pop hl
jr c, .asm_29c5e
ld de, PartyMon2 - PartyMon1
add hl, de
dec b
jr nz, .asm_29c13
ld hl, PartyMon1Moves
ld a, [PartyCount]
ld b, a
.asm_29c2e
ld c, NUM_MOVES
.asm_29c30
ld a, [hli]
cp STRUGGLE + 1
jr nc, .asm_29c4c
dec c
jr nz, .asm_29c30
ld de, PartyMon2 - (PartyMon1 + NUM_MOVES)
add hl, de
dec b
jr nz, .asm_29c2e
xor a
jr .asm_29c63
.asm_29c42
ld [$d265], a
call GetPokemonName
ld a, $1
jr .asm_29c63
.asm_29c4c
push bc
ld [$d265], a
call GetMoveName
call CopyName1
pop bc
call Function29c67
ld a, $2
jr .asm_29c63
.asm_29c5e
call Function29c67
ld a, $3
.asm_29c63
ld [ScriptVar], a
ret
; 29c67
Function29c67: ; 29c67
ld a, [PartyCount]
sub b
ld c, a
inc c
ld b, $0
ld hl, PartyCount
add hl, bc
ld a, [hl]
ld [$d265], a
call GetPokemonName
ret
; 29c7b
Function29c7b: ; 29c7b
ld c, $a
call DelayFrames
ld a, $4
call Function29f17
ld c, $28
call DelayFrames
xor a
ld [$ff9e], a
inc a
ld [InLinkBattle], a
ret
; 29c92
Function29c92: ; 29c92
ld c, $3
call DelayFrames
ld a, $ff
ld [$ffcb], a
xor a
ld [rSB], a
ld [hSerialReceive], a
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
ld c, $3
call DelayFrames
xor a
ld [rSB], a
ld [hSerialReceive], a
ld a, $0
ld [rSC], a
ld a, $80
ld [rSC], a
ld c, $3
call DelayFrames
xor a
ld [rSB], a
ld [hSerialReceive], a
ld [rSC], a
ld c, $3
call DelayFrames
ld a, $ff
ld [$ffcb], a
ld a, [rIF]
push af
xor a
ld [rIF], a
ld a, $f
ld [rIE], a
pop af
ld [rIF], a
ld hl, $cf5b
xor a
ld [hli], a
ld [hl], a
ld [$ff9e], a
ld [InLinkBattle], a
ret
; 29ce8
Function29ce8: ; 29ce8
ld a, $1
ld [$cf56], a
ld [$d265], a
ret
; 29cf1
Function29cf1: ; 29cf1
ld a, $2
ld [$cf56], a
ld [$d265], a
ret
; 29cfa
Function29cfa: ; 29cfa
ld a, $2
ld [rSB], a
xor a
ld [hSerialReceive], a
ld a, $0
ld [rSC], a
ld a, $80
ld [rSC], a
xor a
ld [$cf56], a
ld [$d265], a
ret
; 29d11
Function29d11: ; 29d11
ld a, [$cf56]
and a
jr z, .asm_29d2f
ld a, $2
ld [rSB], a
xor a
ld [hSerialReceive], a
ld a, $0
ld [rSC], a
ld a, $80
ld [rSC], a
call DelayFrame
call DelayFrame
call DelayFrame
.asm_29d2f
ld a, $2
ld [$cf5c], a
ld a, $ff
ld [$cf5b], a
.asm_29d39
ld a, [$ffcb]
cp $2
jr z, .asm_29d79
cp $1
jr z, .asm_29d79
ld a, $ff
ld [$ffcb], a
ld a, $2
ld [rSB], a
xor a
ld [hSerialReceive], a
ld a, $0
ld [rSC], a
ld a, $80
ld [rSC], a
ld a, [$cf5b]
dec a
ld [$cf5b], a
jr nz, .asm_29d68
ld a, [$cf5c]
dec a
ld [$cf5c], a
jr z, .asm_29d8d
.asm_29d68
ld a, $1
ld [rSB], a
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
call DelayFrame
jr .asm_29d39
.asm_29d79
call Function908
call DelayFrame
call Function908
ld c, $32
call DelayFrames
ld a, $1
ld [ScriptVar], a
ret
.asm_29d8d
xor a
ld [ScriptVar], a
ret
; 29d92
Function29d92: ; 29d92
ld a, $1
ld [$cf56], a
ld hl, $cf5b
ld a, $3
ld [hli], a
xor a
ld [hl], a
call WaitBGMap
ld a, $2
ld [$ff9e], a
call DelayFrame
call DelayFrame
call Function29e0c
xor a
ld [$ff9e], a
ld a, [ScriptVar]
and a
ret nz
jp Function29f04
; 29dba
Function29dba: ; 29dba
ld a, $5
ld [$cf56], a
ld hl, $cf5b
ld a, $3
ld [hli], a
xor a
ld [hl], a
call WaitBGMap
ld a, $2
ld [$ff9e], a
call DelayFrame
call DelayFrame
call Function29e0c
ld a, [ScriptVar]
and a
jr z, .asm_29e08
ld bc, rIE
.asm_29de0
dec bc
ld a, b
or c
jr nz, .asm_29de0
ld a, [$cf51]
cp $5
jr nz, .asm_29e03
ld a, $6
ld [$cf56], a
ld hl, $cf5b
ld a, $1
ld [hli], a
ld [hl], $32
call Function29e0c
ld a, [$cf51]
cp $6
jr z, .asm_29e08
.asm_29e03
xor a
ld [ScriptVar], a
ret
.asm_29e08
xor a
ld [$ff9e], a
ret
; 29e0c
Function29e0c: ; 29e0c
xor a
ld [$ffca], a
ld a, [$cf5b]
ld h, a
ld a, [$cf5c]
ld l, a
push hl
call Function29e3b
pop hl
jr nz, .asm_29e2f
call Function29e47
call Function29e53
call Function29e3b
jr nz, .asm_29e2f
call Function29e47
xor a
jr .asm_29e31
.asm_29e2f
ld a, $1
.asm_29e31
ld [ScriptVar], a
ld hl, $cf5b
xor a
ld [hli], a
ld [hl], a
ret
; 29e3b
Function29e3b: ; 29e3b
call Function87d
ld hl, $cf5b
ld a, [hli]
inc a
ret nz
ld a, [hl]
inc a
ret
; 29e47
Function29e47: ; 29e47
ld b, $a
.asm_29e49
call DelayFrame
call Function908
dec b
jr nz, .asm_29e49
ret
; 29e53
Function29e53: ; 29e53
dec h
srl h
rr l
srl h
rr l
inc h
ld a, h
ld [$cf5b], a
ld a, l
ld [$cf5c], a
ret
; 29e66
Function29e66: ; 29e66
ld a, [$d265]
push af
callba Function14ab2
ld a, $1
jr nc, .asm_29e75
xor a
.asm_29e75
ld [ScriptVar], a
ld c, $1e
call DelayFrames
pop af
ld [$d265], a
ret
; 29e82
Function29e82: ; 29e82
ld a, [$d265]
call Function29f17
push af
call Function908
call DelayFrame
call Function908
pop af
ld b, a
ld a, [$d265]
cp b
jr nz, .asm_29eaa
ld a, [$d265]
inc a
ld [InLinkBattle], a
xor a
ld [$ff9e], a
ld a, $1
ld [ScriptVar], a
ret
.asm_29eaa
xor a
ld [ScriptVar], a
ret
; 29eaf
Function29eaf: ; 29eaf
ld a, $1
ld [InLinkBattle], a
call Function2ed3
callab Function28000
call Function2ee4
xor a
ld [$ff9e], a
ret
; 29ec4
Function29ec4: ; 29ec4
ld a, $2
ld [InLinkBattle], a
call Function2ed3
callab Function28000
call Function2ee4
xor a
ld [$ff9e], a
ret
; 29ed9
Function29ed9: ; 29ed9
ld a, $3
ld [InLinkBattle], a
call Function2ed3
callab Function28000
call Function2ee4
xor a
ld [$ff9e], a
ret
; 29eee
Function29eee: ; 29eee
xor a
ld [InLinkBattle], a
ld c, $3
call DelayFrames
jp Function29f04
; 29efa
Function29efa: ; 29efa
ld c, $28
call DelayFrames
ld a, $e
jp Function29f17
; 29f04
Function29f04: ; 29f04
ld c, $3
call DelayFrames
ld a, $ff
ld [$ffcb], a
ld a, $2
ld [rSB], a
xor a
ld [hSerialReceive], a
ld [rSC], a
ret
; 29f17
Function29f17: ; 29f17
add $d0
ld [$cf56], a
ld [$cf57], a
ld a, $2
ld [$ff9e], a
call DelayFrame
call DelayFrame
.asm_29f29
call Function83b
ld a, [$cf51]
ld b, a
and $f0
cp $d0
jr z, .asm_29f40
ld a, [$cf52]
ld b, a
and $f0
cp $d0
jr nz, .asm_29f29
.asm_29f40
xor a
ld [$ff9e], a
ld a, b
and $f
ret
; 29f47
Function29f47: ; 29f47
ld a, [$ffcb]
cp $1
ld a, $1
jr z, .asm_29f50
dec a
.asm_29f50
ld [ScriptVar], a
ret
; 29f54
GFX_29f54: ; 29f54
INCBIN "baserom.gbc", $29f54, $29fe4 - $29f54
; 29fe4
Function29fe4: ; 29fe4
ld a, $0
call GetSRAMBank
ld d, $0
ld b, $2
predef FlagPredef
call CloseSRAM
ld a, c
and a
ret
; 29ff8
Function29ff8: ; 29ff8
call Function2a205
jr c, .asm_2a006
ld hl, $d25a
xor a
ld [hli], a
ld [hli], a
ld [hl], a
jr .asm_2a011
.asm_2a006
inc hl
inc hl
ld de, $d25a
ld bc, $3
call CopyBytes
.asm_2a011
call Function2a21d
ld a, $0
jr nc, .asm_2a01b
inc hl
inc hl
ld a, [hl]
.asm_2a01b
ld [$d25d], a
ret
Function2a01f: ; 2a01f
ld hl, TileMap
ld bc, $0168
xor a
call ByteFill
ld a, e
and a
jr nz, .asm_2a043
ld de, TileMap
ld hl, WildMons1
call Function2a052
ld hl, WildMons2
call Function2a06e
call Function2a0b7
call Function2a0cf
ret
.asm_2a043
ld de, TileMap
ld hl, WildMons3
call Function2a052
ld hl, WildMons4
jp Function2a06e
; 2a052
Function2a052: ; 2a052
.asm_2a052
ld a, [hl]
cp $ff
ret z
push hl
ld a, [hli]
ld b, a
ld a, [hli]
ld c, a
inc hl
inc hl
inc hl
ld a, $15
call Function2a088
jr nc, .asm_2a067
ld [de], a
inc de
.asm_2a067
pop hl
ld bc, $002f
add hl, bc
jr .asm_2a052
; 2a06e
Function2a06e: ; 2a06e
.asm_2a06e
ld a, [hl]
cp $ff
ret z
push hl
ld a, [hli]
ld b, a
ld a, [hli]
ld c, a
inc hl
ld a, $3
call Function2a088
jr nc, .asm_2a081
ld [de], a
inc de
.asm_2a081
pop hl
ld bc, $0009
add hl, bc
jr .asm_2a06e
; 2a088
Function2a088: ; 2a088
inc hl
.asm_2a089
push af
ld a, [$d265]
cp [hl]
jr z, .asm_2a098
inc hl
inc hl
pop af
dec a
jr nz, .asm_2a089
and a
ret
.asm_2a098
pop af
jp Function2a09c
; 2a09c
Function2a09c: ; 2a09c
push de
call GetWorldMapLocation
ld c, a
ld hl, TileMap
ld de, $0168
.asm_2a0a7
ld a, [hli]
cp c
jr z, .asm_2a0b4
dec de
ld a, e
or d
jr nz, .asm_2a0a7
ld a, c
pop de
scf
ret
.asm_2a0b4
pop de
and a
ret
; 2a0b7
Function2a0b7: ; 2a0b7
ld a, [wRoamMon1Species]
ld b, a
ld a, [$d265]
cp b
ret nz
ld a, [wRoamMon1MapGroup]
ld b, a
ld a, [wRoamMon1MapNumber]
ld c, a
call Function2a09c
ret nc
ld [de], a
inc de
ret
; 2a0cf
Function2a0cf: ; 2a0cf
ld a, [wRoamMon2Species]
ld b, a
ld a, [$d265]
cp b
ret nz
ld a, [wRoamMon2MapGroup]
ld b, a
ld a, [wRoamMon2MapNumber]
ld c, a
call Function2a09c
ret nc
ld [de], a
inc de
ret
; 2a0e7
Function2a0e7:: ; 2a0e7
; Try to trigger a wild encounter.
call Function2a103
jr nc, .asm_2a0f8
call Function2a14f
jr nz, .asm_2a0f8
call Function2a1df
jr nc, .asm_2a0f8
xor a
ret
.asm_2a0f8
xor a ; BATTLETYPE_NORMAL
ld [$d22e], a
ld [BattleType], a
ld a, 1
and a
ret
; 2a103
Function2a103: ; 2a103
call Function2a111
call Function2a124
call Function2a138
call Random
cp b
ret
; 2a111
Function2a111: ; 2a111
ld hl, $d25a
call Function1852
ld a, 3
jr z, .asm_2a11e
ld a, [TimeOfDay]
.asm_2a11e
ld c, a
ld b, 0
add hl, bc
ld b, [hl]
ret
; 2a124
Function2a124:: ; 2a124
; Pokemon March and Ruins of Alph signal double encounter rate.
; Pokemon Lullaby halves encounter rate.
ld a, [wMapMusic]
cp MUSIC_POKEMON_MARCH
jr z, .asm_2a135
cp MUSIC_RUINS_OF_ALPH_RADIO
jr z, .asm_2a135
cp MUSIC_POKEMON_LULLABY
ret nz
srl b
ret
.asm_2a135
sla b
ret
; 2a138
Function2a138:: ; 2a138
; Cleanse Tag halves encounter rate.
ld hl, PartyMon1Item
ld de, PartyMon2 - PartyMon1
ld a, [PartyCount]
ld c, a
.next
ld a, [hl]
cp CLEANSE_TAG
jr z, .asm_2a14c
add hl, de
dec c
jr nz, .next
ret
.asm_2a14c
srl b
ret
; 2a14f
Function2a14f: ; 2a14f
call Function2a200
jp nc, .asm_2a1c1
call Function2a2ce
jp c, .asm_2a1c9
inc hl
inc hl
inc hl
call Function1852
ld de, Unknown_2a1d9
jr z, .asm_2a174
inc hl
inc hl
ld a, [TimeOfDay]
ld bc, $e
call AddNTimes
ld de, Unknown_2a1cb
.asm_2a174
push hl
.asm_2a175
call Random
cp 100
jr nc, .asm_2a175
inc a
ld b, a
ld h, d
ld l, e
.asm_2a180
ld a, [hli]
cp b
jr nc, .asm_2a187
inc hl
jr .asm_2a180
.asm_2a187
ld c, [hl]
ld b, 0
pop hl
add hl, bc
ld a, [hli]
ld b, a
call Function1852
jr nz, .asm_2a1aa
call Random
cp 89
jr c, .asm_2a1aa
inc b
cp 165
jr c, .asm_2a1aa
inc b
cp 216
jr c, .asm_2a1aa
inc b
cp 242
jr c, .asm_2a1aa
inc b
.asm_2a1aa
ld a, b
ld [CurPartyLevel], a
ld b, [hl]
call Function2a4a0
jr c, .asm_2a1c1
ld a, b
cp UNOWN
jr nz, .asm_2a1bf
ld a, [UnlockedUnowns]
and a
jr z, .asm_2a1c1
.asm_2a1bf
jr .asm_2a1c5
.asm_2a1c1
ld a, 1
and a
ret
.asm_2a1c5
ld a, b
ld [$d22e], a
.asm_2a1c9
xor a
ret
; 2a1cb
Unknown_2a1cb: ; 2a1cb
db 30, $0
db 60, $2
db 80, $4
db 90, $6
db 95, $8
db 99, $a
db 100, $c
; 2a1d9
Unknown_2a1d9: ; 2a1d9
db 60, $0
db 90, $2
db 100, $4
; 2a1df
Function2a1df:: ; 2a1df
ld a, [$dca1]
and a
jr z, .asm_2a1fe
ld hl, PartyMon1HP
ld bc, PartyMon2 - PartyMon1 - 1
.asm_2a1eb
ld a, [hli]
or [hl]
jr nz, .asm_2a1f2
add hl, bc
jr .asm_2a1eb
.asm_2a1f2
; to PartyMonLevel
dec hl
dec hl
dec hl
dec hl
ld a, [CurPartyLevel]
cp [hl]
jr nc, .asm_2a1fe
and a
ret
.asm_2a1fe
scf
ret
; 2a200
Function2a200: ; 2a200
call Function1852
jr z, Function2a21d
Function2a205: ; 2a205
ld hl, WildMons5
ld bc, $002f
call asm_2a23d
ret c
ld hl, WildMons1
ld de, WildMons3
call asm_2a235
ld bc, $002f
jr asm_2a27a
Function2a21d: ; 2a21d
ld hl, WildMons6
ld bc, $0009
call asm_2a23d
ret c
ld hl, WildMons2
ld de, WildMons4
call asm_2a235
ld bc, $0009
jr asm_2a27a
asm_2a235
call IsInJohto
and a
ret z
ld h, d
ld l, e
ret
asm_2a23d
call Function2a27f
push hl
ld hl, $dc20
bit 2, [hl]
pop hl
jr z, .asm_2a25c
ld a, [$dfcc]
cp d
jr nz, .asm_2a25c
ld a, [$dfcd]
cp e
jr nz, .asm_2a25c
call Function2a288
jr nc, asm_2a278
scf
ret
.asm_2a25c
push hl
ld hl, $dc20
bit 3, [hl]
pop hl
jr z, asm_2a278
ld a, [$dc5a]
cp d
jr nz, asm_2a278
ld a, [$dc5b]
cp e
jr nz, asm_2a278
call Function2a288
jr nc, asm_2a278
scf
ret
asm_2a278
and a
ret
asm_2a27a
call Function2a27f
jr Function2a288
; 2a27f
Function2a27f: ; 2a27f
ld a, [MapGroup]
ld d, a
ld a, [MapNumber]
ld e, a
ret
; 2a288
Function2a288: ; 2a288
push hl
ld a, [hl]
inc a
jr z, .asm_2a29a
ld a, d
cp [hl]
jr nz, .asm_2a296
inc hl
ld a, e
cp [hl]
jr z, .asm_2a29d
.asm_2a296
pop hl
add hl, bc
jr Function2a288
.asm_2a29a
pop hl
and a
ret
.asm_2a29d
pop hl
scf
ret
; 2a2a0
InitRoamMons: ; 2a2a0
; initialize wRoamMon structs
; species
ld a, RAIKOU
ld [wRoamMon1Species], a
ld a, ENTEI
ld [wRoamMon2Species], a
; ld a, SUICUNE
; ld [wRoamMon3Species], a
; level
ld a, 40
ld [wRoamMon1Level], a
ld [wRoamMon2Level], a
; ld [wRoamMon3Level], a
; raikou starting map
ld a, GROUP_ROUTE_42
ld [wRoamMon1MapGroup], a
ld a, MAP_ROUTE_42
ld [wRoamMon1MapNumber], a
; entei starting map
ld a, GROUP_ROUTE_37
ld [wRoamMon2MapGroup], a
ld a, MAP_ROUTE_37
ld [wRoamMon2MapNumber], a
; suicune starting map
; ld a, GROUP_ROUTE_38
; ld [wRoamMon3MapGroup], a
; ld a, MAP_ROUTE_38
; ld [wRoamMon3MapNumber], a
; hp
xor a ; generate new stats
ld [wRoamMon1HP], a
ld [wRoamMon2HP], a
; ld [wRoamMon3HP], a
ret
; 2a2ce
Function2a2ce: ; 2a2ce
push hl
call Function1852
jr z, .asm_2a30a
call Function2a27f
call Random
cp 100
jr nc, .asm_2a30a
and 3
jr z, .asm_2a30a
dec a
ld hl, wRoamMon1MapGroup
ld c, a
ld b, 0
ld a, 7
call AddNTimes
ld a, d
cp [hl]
jr nz, .asm_2a30a
inc hl
ld a, e
cp [hl]
jr nz, .asm_2a30a
dec hl
dec hl
dec hl
ld a, [hli]
ld [$d22e], a
ld a, [hl]
ld [CurPartyLevel], a
ld a, BATTLETYPE_ROAMING
ld [BattleType], a
pop hl
scf
ret
.asm_2a30a
pop hl
and a
ret
; 2a30d
Function2a30d: ; 2a30d
ld a, [wRoamMon1MapGroup]
cp $ff
jr z, .asm_2a324
ld b, a
ld a, [wRoamMon1MapNumber]
ld c, a
call Function2a355
ld a, b
ld [wRoamMon1MapGroup], a
ld a, c
ld [wRoamMon1MapNumber], a
.asm_2a324
ld a, [wRoamMon2MapGroup]
cp $ff
jr z, .asm_2a33b
ld b, a
ld a, [wRoamMon2MapNumber]
ld c, a
call Function2a355
ld a, b
ld [wRoamMon2MapGroup], a
ld a, c
ld [wRoamMon2MapNumber], a
.asm_2a33b
ld a, [wRoamMon3MapGroup]
cp $ff
jr z, .asm_2a352
ld b, a
ld a, [wRoamMon3MapNumber]
ld c, a
call Function2a355
ld a, b
ld [wRoamMon3MapGroup], a
ld a, c
ld [wRoamMon3MapNumber], a
.asm_2a352
jp Function2a3f6
; 2a355
Function2a355: ; 2a355
ld hl, RoamMaps
.asm_2a358
ld a, [hl]
cp $ff
ret z
ld a, b
cp [hl]
jr nz, .asm_2a365
inc hl
ld a, c
cp [hl]
jr z, .asm_2a36b
.asm_2a365
ld a, [hli]
and a
jr nz, .asm_2a365
jr .asm_2a358
.asm_2a36b
inc hl
ld d, h
ld e, l
.asm_2a36e
ld h, d
ld l, e
call Random
and $1f
jr z, Function2a3cd
and 3
cp [hl]
jr nc, .asm_2a36e
inc hl
ld c, a
ld b, $0
add hl, bc
add hl, bc
ld a, [$dfe7]
cp [hl]
jr nz, .asm_2a390
inc hl
ld a, [$dfe6]
cp [hl]
jr z, .asm_2a36e
dec hl
.asm_2a390
ld a, [hli]
ld b, a
ld c, [hl]
ret
Function2a394: ; 2a394
ld a, [wRoamMon1MapGroup]
cp $ff
jr z, .asm_2a3a6
call Function2a3cd
ld a, b
ld [wRoamMon1MapGroup], a
ld a, c
ld [wRoamMon1MapNumber], a
.asm_2a3a6
ld a, [wRoamMon2MapGroup]
cp $ff
jr z, .asm_2a3b8
call Function2a3cd
ld a, b
ld [wRoamMon2MapGroup], a
ld a, c
ld [wRoamMon2MapNumber], a
.asm_2a3b8
ld a, [wRoamMon3MapGroup]
cp $ff
jr z, .asm_2a3ca
call Function2a3cd
ld a, b
ld [wRoamMon3MapGroup], a
ld a, c
ld [wRoamMon3MapNumber], a
.asm_2a3ca
jp Function2a3f6
Function2a3cd: ; 2a3cd
.asm_2a3cd
ld hl, RoamMaps
.asm_2a3d0
call Random
and $f
cp $10
jr nc, .asm_2a3d0
inc a
ld b, a
.asm_2a3db
dec b
jr z, .asm_2a3e4
.asm_2a3de
ld a, [hli]
and a
jr nz, .asm_2a3de
jr .asm_2a3db
.asm_2a3e4
ld a, [MapGroup]
cp [hl]
jr nz, .asm_2a3f2
inc hl
ld a, [MapNumber]
cp [hl]
jr z, .asm_2a3cd
dec hl
.asm_2a3f2
ld a, [hli]
ld b, a
ld c, [hl]
ret
; 2a3f6
Function2a3f6: ; 2a3f6
ld a, [$dfe4]
ld [$dfe6], a
ld a, [$dfe5]
ld [$dfe7], a
ld a, [MapNumber]
ld [$dfe4], a
ld a, [MapGroup]
ld [$dfe5], a
ret
; 2a40f
RoamMaps: ; 2a40f
; Maps that roaming monsters can be on,
; and possible maps they can jump to.
; Notably missing are Route 40 and
; Route 41, which are water routes.
roam_map ROUTE_29, 2, ROUTE_30, ROUTE_46
roam_map ROUTE_30, 2, ROUTE_29, ROUTE_31
roam_map ROUTE_31, 3, ROUTE_30, ROUTE_32, ROUTE_36
roam_map ROUTE_32, 3, ROUTE_36, ROUTE_31, ROUTE_33
roam_map ROUTE_33, 2, ROUTE_32, ROUTE_34
roam_map ROUTE_34, 2, ROUTE_33, ROUTE_35
roam_map ROUTE_35, 2, ROUTE_34, ROUTE_36
roam_map ROUTE_36, 4, ROUTE_35, ROUTE_31, ROUTE_32, ROUTE_37
roam_map ROUTE_37, 3, ROUTE_36, ROUTE_38, ROUTE_42
roam_map ROUTE_38, 3, ROUTE_37, ROUTE_39, ROUTE_42
roam_map ROUTE_39, 1, ROUTE_38
roam_map ROUTE_42, 4, ROUTE_43, ROUTE_44, ROUTE_37, ROUTE_38
roam_map ROUTE_43, 2, ROUTE_42, ROUTE_44
roam_map ROUTE_44, 3, ROUTE_42, ROUTE_43, ROUTE_45
roam_map ROUTE_45, 2, ROUTE_44, ROUTE_46
roam_map ROUTE_46, 2, ROUTE_45, ROUTE_29
db $ff
; 2a4a0
Function2a4a0: ; 2a4a0
and a
jr z, .asm_2a4a9
cp $fc
jr nc, .asm_2a4a9
and a
ret
.asm_2a4a9
scf
ret
; 2a4ab
Function2a4ab: ; 2a4ab
callba Function90439
ld d, b
ld e, c
ld hl, WildMons1
ld bc, $002f
call Function2a288
jr c, .asm_2a4c6
ld hl, WildMons3
call Function2a288
jr nc, .asm_2a514
.asm_2a4c6
push hl
ld bc, $000d
add hl, bc
ld a, [TimeOfDay]
ld bc, $000e
call AddNTimes
.asm_2a4d4
call Random
and $3
jr z, .asm_2a4d4
dec a
ld c, a
ld b, $0
add hl, bc
add hl, bc
inc hl
ld c, [hl]
pop hl
ld de, $0005
add hl, de
inc hl
ld b, $4
.asm_2a4eb
ld a, [hli]
cp c
jr z, .asm_2a514
inc hl
dec b
jr nz, .asm_2a4eb
push bc
dec c
ld a, c
call CheckSeenMon
pop bc
jr nz, .asm_2a514
ld de, StringBuffer1
call CopyName1
ld a, c
ld [$d265], a
call GetPokemonName
ld hl, UnknownText_0x2a51a
call PrintText
xor a
ld [ScriptVar], a
ret
.asm_2a514
ld a, $1
ld [ScriptVar], a
ret
; 2a51a
UnknownText_0x2a51a: ; 0x2a51a
; I just saw some rare @ in @ . I'll call you if I see another rare #MON, OK?
text_jump UnknownText_0x1bd34b
db "@"
; 0x2a51f
Function2a51f: ; 2a51f
callba Function90439
ld d, b
ld e, c
ld hl, WildMons1
ld bc, $002f
call Function2a288
jr c, .asm_2a538
ld hl, WildMons3
call Function2a288
.asm_2a538
ld bc, $0005
add hl, bc
ld a, [TimeOfDay]
inc a
ld bc, $000e
.asm_2a543
dec a
jr z, .asm_2a549
add hl, bc
jr .asm_2a543
.asm_2a549
call Random
and $3
ld c, a
ld b, $0
add hl, bc
add hl, bc
inc hl
ld a, [hl]
ld [$d265], a
call GetPokemonName
ld hl, StringBuffer1
ld de, StringBuffer4
ld bc, $000b
jp CopyBytes
; 2a567
Function2a567: ; 2a567
callba Function90439
ld hl, $5999
ld a, d
dec a
ld c, a
ld b, $0
add hl, bc
add hl, bc
ld a, $e
call GetFarHalfword
.asm_2a57c
dec e
jr z, .asm_2a58b
.asm_2a57f
ld a, $e
call GetFarByte
inc hl
cp $ff
jr nz, .asm_2a57f
jr .asm_2a57c
.asm_2a58b
ld a, $e
call GetFarByte
inc hl
cp $50
jr nz, .asm_2a58b
ld a, $e
call GetFarByte
inc hl
ld bc, $0002
cp $0
jr z, .asm_2a5b3
ld bc, $0006
cp $1
jr z, .asm_2a5b3
ld bc, $0003
cp $2
jr z, .asm_2a5b3
ld bc, $0007
.asm_2a5b3
ld e, $0
push hl
.asm_2a5b6
inc e
add hl, bc
ld a, $e
call GetFarByte
cp $ff
jr nz, .asm_2a5b6
pop hl
.asm_2a5c2
call Random
and $7
cp e
jr nc, .asm_2a5c2
inc a
.asm_2a5cb
dec a
jr z, .asm_2a5d1
add hl, bc
jr .asm_2a5cb
.asm_2a5d1
inc hl
ld a, $e
call GetFarByte
ld [$d265], a
call GetPokemonName
ld hl, StringBuffer1
ld de, StringBuffer4
ld bc, $000b
jp CopyBytes
; 2a5e9
WildMons1: ; 0x2a5e9
INCLUDE "data/wild/johto_grass.asm"
WildMons2: ; 0x2b11d
INCLUDE "data/wild/johto_water.asm"
WildMons3: ; 0x2b274
INCLUDE "data/wild/kanto_grass.asm"
WildMons4: ; 0x2b7f7
INCLUDE "data/wild/kanto_water.asm"
WildMons5: ; 0x2b8d0
INCLUDE "data/wild/swarm_grass.asm"
WildMons6: ; 0x2b92f
INCLUDE "data/wild/swarm_water.asm"
Function2b930: ; 2b930
callba UpdateEnemyMonInParty
ld hl, PartyMon1HP
call Function2b995
push bc
ld hl, OTPartyMon1HP
call Function2b995
ld a, c
pop bc
cp c
jr z, .asm_2b94c
jr c, .asm_2b97f
jr .asm_2b976
.asm_2b94c
call Function2b9e1
jr z, .asm_2b98a
ld a, e
cp $1
jr z, .asm_2b976
cp $2
jr z, .asm_2b97f
ld hl, PartyMon1HP
call Function2b9a6
push de
ld hl, OTPartyMon1HP
call Function2b9a6
pop hl
ld a, d
cp h
jr c, .asm_2b976
jr z, .asm_2b970
jr .asm_2b97f
.asm_2b970
ld a, e
cp l
jr z, .asm_2b98a
jr nc, .asm_2b97f
.asm_2b976
ld a, [$d0ee]
and $f0
ld [$d0ee], a
ret
.asm_2b97f
ld a, [$d0ee]
and $f0
add $1
ld [$d0ee], a
ret
.asm_2b98a
ld a, [$d0ee]
and $f0
add $2
ld [$d0ee], a
ret
; 2b995
Function2b995: ; 2b995
ld c, $0
ld b, $3
ld de, $002f
.asm_2b99c
ld a, [hli]
or [hl]
jr nz, .asm_2b9a1
inc c
.asm_2b9a1
add hl, de
dec b
jr nz, .asm_2b99c
ret
; 2b9a6
Function2b9a6: ; 2b9a6
ld de, $0000
ld c, $3
.asm_2b9ab
ld a, [hli]
or [hl]
jr z, .asm_2b9d7
dec hl
xor a
ld [hProduct], a
ld a, [hli]
ld [hMultiplicand], a
ld a, [hli]
ld [$ffb5], a
xor a
ld [$ffb6], a
ld a, [hli]
ld b, a
ld a, [hld]
srl b
rr a
srl b
rr a
ld [hMultiplier], a
ld b, $4
call Divide
ld a, [$ffb6]
add e
ld e, a
ld a, [$ffb5]
adc d
ld d, a
dec hl
.asm_2b9d7
push de
ld de, $002f
add hl, de
pop de
dec c
jr nz, .asm_2b9ab
ret
; 2b9e1
Function2b9e1: ; 2b9e1
ld hl, PartyMon1HP
call Function2ba01
jr nz, .asm_2b9f2
ld hl, OTPartyMon1HP
call Function2ba01
ld e, $1
ret
.asm_2b9f2
ld hl, OTPartyMon1HP
call Function2ba01
ld e, $0
ret nz
ld e, $2
ld a, $1
and a
ret
; 2ba01
Function2ba01: ; 2ba01
ld d, $3
.asm_2ba03
ld a, [hli]
ld b, a
ld a, [hli]
ld c, a
or b
jr z, .asm_2ba10
ld a, [hli]
cp b
ret nz
ld a, [hld]
cp c
ret nz
.asm_2ba10
push de
ld de, $002e
add hl, de
pop de
dec d
jr nz, .asm_2ba03
ret
; 2ba1a
ChrisBackpic: ; 2ba1a
INCBIN "gfx/misc/player.6x6.2bpp.lz"
; 2bbaa
DudeBackpic: ; 2bbaa
INCBIN "gfx/misc/dude.6x6.2bpp.lz"
; 2bcea
SECTION "bankB", ROMX, BANK[$B]
Function2c000: ; 2c000
ld a, $e4
ld [rOBP0], a
call Function2c165
call Function2c01c
ld a, [IsInBattle]
dec a
ret z
jp Function2c03a
; 2c012
Function2c012: ; 2c012
ld a, $e4
ld [rOBP0], a
call Function2c165
jp Function2c03a
; 2c01c
Function2c01c: ; 2c01c
call Function2c0ad
ld hl, PartyMon1HP
ld de, PartyCount
call Function2c059
ld a, $60
ld hl, $cfc4
ld [hli], a
ld [hl], a
ld a, $8
ld [$d003], a
ld hl, Sprites
jp Function2c143
; 2c03a
Function2c03a: ; 2c03a
call Function2c0c5
ld hl, OTPartyMon1HP
ld de, OTPartyCount
call Function2c059
ld hl, $cfc4
ld a, $48
ld [hli], a
ld [hl], $20
ld a, $f8
ld [$d003], a
ld hl, $c418
jp Function2c143
; 2c059
Function2c059: ; 2c059
ld a, [de]
push af
ld de, Buffer1
ld c, $6
ld a, $34
.asm_2c062
ld [de], a
inc de
dec c
jr nz, .asm_2c062
pop af
ld de, Buffer1
.asm_2c06b
push af
call Function2c075
inc de
pop af
dec a
jr nz, .asm_2c06b
ret
; 2c075
Function2c075: ; 2c075
ld a, [hli]
and a
jr nz, .asm_2c07f
ld a, [hl]
and a
ld b, $33
jr z, .asm_2c08b
.asm_2c07f
dec hl
dec hl
dec hl
ld a, [hl]
and a
ld b, $32
jr nz, .asm_2c08e
dec b
jr .asm_2c08e
.asm_2c08b
dec hl
dec hl
dec hl
.asm_2c08e
ld a, b
ld [de], a
ld bc, $0032
add hl, bc
ret
; 2c095
DrawPlayerExpBar: ; 2c095
ld hl, .data_2c0a9
ld de, $d004
ld bc, 4
call CopyBytes
hlcoord 18, 10
ld de, -1
jr Function2c0f1
.data_2c0a9
db $73
db $77
db $6f
db $76
; 2c0ad
Function2c0ad: ; 2c0ad
ld hl, .data_2c0c1
ld de, $d004
ld bc, 4
call CopyBytes
hlcoord 18, 10
ld de, -1
jr Function2c0f1
.data_2c0c1
db $73, $5c, $6f, $76
; 2c0c5
Function2c0c5: ; 2c0c5
ld hl, .data_2c0ed
ld de, $d004
ld bc, 4
call CopyBytes
hlcoord 1, 2
ld de, 1
call Function2c0f1
ld a, [IsInBattle]
dec a
ret nz
ld a, [TempEnemyMonSpecies]
dec a
call CheckCaughtMon
ret z
hlcoord 1, 1
ld [hl], $5d
ret
.data_2c0ed
db $6d
db $74
db $78
db $76
; 2c0f1
Function2c0f1: ; 2c0f1
ld a, [$d004]
ld [hl], a
ld bc, $0014
add hl, bc
ld a, [StartFlypoint]
ld [hl], a
ld b, $8
.asm_2c0ff
add hl, de
ld a, [MovementBuffer]
ld [hl], a
dec b
jr nz, .asm_2c0ff
add hl, de
ld a, [EndFlypoint]
ld [hl], a
ret
; 2c10d
Function2c10d: ; 2c10d
call Function2c165
ld hl, PartyMon1HP
ld de, PartyCount
call Function2c059
ld hl, $cfc4
ld a, $50
ld [hli], a
ld [hl], $40
ld a, $8
ld [$d003], a
ld hl, Sprites
call Function2c143
ld hl, OTPartyMon1HP
ld de, OTPartyCount
call Function2c059
ld hl, $cfc4
ld a, $50
ld [hli], a
ld [hl], $68
ld hl, $c418
jp Function2c143
; 2c143
Function2c143: ; 2c143
ld de, Buffer1
ld c, $6
.asm_2c148
ld a, [$cfc5]
ld [hli], a
ld a, [$cfc4]
ld [hli], a
ld a, [de]
ld [hli], a
ld a, $3
ld [hli], a
ld a, [$cfc4]
ld b, a
ld a, [$d003]
add b
ld [$cfc4], a
inc de
dec c
jr nz, .asm_2c148
ret
; 2c165
Function2c165: ; 2c165
ld de, GFX_2c172
ld hl, $8310
lb bc, BANK(GFX_2c172), 4
call Functiondc9
ret
; 2c172
GFX_2c172: ; 2c172
INCBIN "gfx/battle/balls.2bpp"
; 2c1b2
Function2c1b2: ; 2c1b2
call WhiteBGMap
call Functione5f
hlcoord 2, 3
ld b, $9
ld c, $e
call TextBox
hlcoord 4, 5
ld de, PlayerName
call PlaceString
hlcoord 4, 10
ld de, $d26b
call PlaceString
hlcoord 9, 8
ld a, $69
ld [hli], a
ld [hl], $6a
callba Function2c10d
ld b, $8
call GetSGBLayout
call Function32f9
ld a, $e4
ld [rOBP0], a
ret
; 2c1ef
TrainerClassNames:: ; 2c1ef
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "RIVAL@"
db "#MON PROF.@"
db "ELITE FOUR@"
db $4a, " TRAINER@"
db "ELITE FOUR@"
db "ELITE FOUR@"
db "ELITE FOUR@"
db "CHAMPION@"
db "LEADER@"
db "LEADER@"
db "LEADER@"
db "SCIENTIST@"
db "LEADER@"
db "YOUNGSTER@"
db "SCHOOLBOY@"
db "BIRD KEEPER@"
db "LASS@"
db "LEADER@"
db "COOLTRAINER@"
db "COOLTRAINER@"
db "BEAUTY@"
db "#MANIAC@"
db "ROCKET@"
db "GENTLEMAN@"
db "SKIER@"
db "TEACHER@"
db "LEADER@"
db "BUG CATCHER@"
db "FISHER@"
db "SWIMMER♂@"
db "SWIMMER♀@"
db "SAILOR@"
db "SUPER NERD@"
db "RIVAL@"
db "GUITARIST@"
db "HIKER@"
db "BIKER@"
db "LEADER@"
db "BURGLAR@"
db "FIREBREATHER@"
db "JUGGLER@"
db "BLACKBELT@"
db "ROCKET@"
db "PSYCHIC@"
db "PICNICKER@"
db "CAMPER@"
db "ROCKET@"
db "SAGE@"
db "MEDIUM@"
db "BOARDER@"
db "#FAN@"
db "KIMONO GIRL@"
db "TWINS@"
db "#FAN@"
db $4a, " TRAINER@"
db "LEADER@"
db "OFFICER@"
db "ROCKET@"
db "MYSTICALMAN@"
AI_Redundant: ; 2c41a
; Check if move effect c will fail because it's already been used.
; Return z if the move is a good choice.
; Return nz if the move is a bad choice.
ld a, c
ld de, 3
ld hl, .Moves
call IsInArray
jp nc, .NotRedundant
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
.Moves: ; 2c42c
dbw EFFECT_DREAM_EATER, .DreamEater
dbw EFFECT_HEAL, .Heal
dbw EFFECT_LIGHT_SCREEN, .LightScreen
dbw EFFECT_MIST, .Mist
dbw EFFECT_FOCUS_ENERGY, .FocusEnergy
dbw EFFECT_CONFUSE, .Confuse
dbw EFFECT_TRANSFORM, .Transform
dbw EFFECT_REFLECT, .Reflect
dbw EFFECT_SUBSTITUTE, .Substitute
dbw EFFECT_LEECH_SEED, .LeechSeed
dbw EFFECT_DISABLE, .Disable
dbw EFFECT_ENCORE, .Encore
dbw EFFECT_SNORE, .Snore
dbw EFFECT_SLEEP_TALK, .SleepTalk
dbw EFFECT_MEAN_LOOK, .MeanLook
dbw EFFECT_NIGHTMARE, .Nightmare
dbw EFFECT_SPIKES, .Spikes
dbw EFFECT_FORESIGHT, .Foresight
dbw EFFECT_PERISH_SONG, .PerishSong
dbw EFFECT_SANDSTORM, .Sandstorm
dbw EFFECT_ATTRACT, .Attract
dbw EFFECT_SAFEGUARD, .Safeguard
dbw EFFECT_RAIN_DANCE, .RainDance
dbw EFFECT_SUNNY_DAY, .SunnyDay
dbw EFFECT_TELEPORT, .Teleport
dbw EFFECT_MORNING_SUN, .MorningSun
dbw EFFECT_SYNTHESIS, .Synthesis
dbw EFFECT_MOONLIGHT, .Moonlight
dbw EFFECT_SWAGGER, .Swagger
dbw EFFECT_FUTURE_SIGHT, .FutureSight
db -1
.LightScreen: ; 2c487
ld a, [EnemyScreens]
bit SCREENS_LIGHT_SCREEN, a
ret
.Mist: ; 2c48d
ld a, [EnemySubStatus4]
bit SUBSTATUS_MIST, a
ret
.FocusEnergy: ; 2c493
ld a, [EnemySubStatus4]
bit SUBSTATUS_FOCUS_ENERGY, a
ret
.Confuse: ; 2c499
ld a, [PlayerSubStatus3]
bit SUBSTATUS_CONFUSED, a
ret nz
ld a, [PlayerScreens]
bit SCREENS_SAFEGUARD, a
ret
.Transform: ; 2c4a5
ld a, [EnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
ret
.Reflect: ; 2c4ab
ld a, [EnemyScreens]
bit SCREENS_REFLECT, a
ret
.Substitute: ; 2c4b1
ld a, [EnemySubStatus4]
bit SUBSTATUS_SUBSTITUTE, a
ret
.LeechSeed: ; 2c4b7
ld a, [PlayerSubStatus4]
bit SUBSTATUS_LEECH_SEED, a
ret
.Disable: ; 2c4bd
ld a, [PlayerDisableCount]
and a
ret
.Encore: ; 2c4c2
ld a, [PlayerSubStatus5]
bit SUBSTATUS_ENCORED, a
ret
.Snore:
.SleepTalk: ; 2c4c8
ld a, [EnemyMonStatus]
and SLP
jr z, .Redundant
jr .NotRedundant
.MeanLook: ; 2c4d1
ld a, [EnemySubStatus5]
bit SUBSTATUS_CANT_RUN, a
ret
.Nightmare: ; 2c4d7
ld a, [BattleMonStatus]
and a
jr z, .Redundant
ld a, [PlayerSubStatus1]
bit SUBSTATUS_NIGHTMARE, a
ret
.Spikes: ; 2c4e3
ld a, [PlayerScreens]
bit SCREENS_SPIKES, a
ret
.Foresight: ; 2c4e9
ld a, [PlayerSubStatus1]
bit SUBSTATUS_IDENTIFIED, a
ret
.PerishSong: ; 2c4ef
ld a, [PlayerSubStatus1]
bit SUBSTATUS_PERISH, a
ret
.Sandstorm: ; 2c4f5
ld a, [Weather]
cp WEATHER_SANDSTORM
jr z, .Redundant
jr .NotRedundant
.Attract: ; 2c4fe
callba Function377f5
jr c, .Redundant
ld a, [PlayerSubStatus1]
bit SUBSTATUS_IN_LOVE, a
ret
.Safeguard: ; 2c50c
ld a, [EnemyScreens]
bit SCREENS_SAFEGUARD, a
ret
.RainDance: ; 2c512
ld a, [Weather]
cp WEATHER_RAIN
jr z, .Redundant
jr .NotRedundant
.SunnyDay: ; 2c51b
ld a, [Weather]
cp WEATHER_SUN
jr z, .Redundant
jr .NotRedundant
.DreamEater: ; 2c524
ld a, [BattleMonStatus]
and SLP
jr z, .Redundant
jr .NotRedundant
.Swagger: ; 2c52d
ld a, [PlayerSubStatus3]
bit SUBSTATUS_CONFUSED, a
ret
.FutureSight: ; 2c533
ld a, [EnemyScreens]
bit 5, a
ret
.Heal:
.MorningSun:
.Synthesis:
.Moonlight: ; 2c539
callba AICheckEnemyMaxHP
jr nc, .NotRedundant
.Teleport:
.Redundant: ; 2c541
ld a, 1
and a
ret
.NotRedundant: ; 2c545
xor a
ret
Function2c547: ; 2c547
ld hl, UnknownText_0x2c5ef
call PrintText
call YesNoBox
jr c, .asm_2c5c3
ld hl, UnknownText_0x2c5f4
call PrintText
callba Function50000
jr c, .asm_2c5c3
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_2c5bc
ld a, [CurPartyMon]
ld hl, PartyMon1Moves + 1
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld a, [hl]
and a
jr z, .asm_2c5ca
ld hl, UnknownText_0x2c5ea
call PrintText
call Function1d6e
callba Function12f5b
push af
call Function2b74
pop af
jr c, .asm_2c5c3
ld a, [$cfa9]
push af
ld a, [CurSpecies]
ld [$d265], a
call GetMoveName
ld hl, UnknownText_0x2c5d6
call PrintText
call YesNoBox
pop bc
jr c, .asm_2c5c3
call Function2c5f9
call WaitSFX
ld de, SFX_MOVE_DELETED
call PlaySFX
call WaitSFX
ld hl, UnknownText_0x2c5db
call PrintText
ret
.asm_2c5bc
ld hl, UnknownText_0x2c5e0
call PrintText
ret
.asm_2c5c3
ld hl, UnknownText_0x2c5e5
call PrintText
ret
.asm_2c5ca
ld hl, UnknownText_0x2c5d1
call PrintText
ret
; 2c5d1
UnknownText_0x2c5d1: ; 0x2c5d1
; That #MON knows only one move.
text_jump UnknownText_0x1c5eba
db "@"
; 0x2c5d6
UnknownText_0x2c5d6: ; 0x2c5d6
; Oh, make it forget @ ?
text_jump UnknownText_0x1c5eda
db "@"
; 0x2c5db
UnknownText_0x2c5db: ; 0x2c5db
; Done! Your #MON forgot the move.
text_jump UnknownText_0x1c5ef5
db "@"
; 0x2c5e0
UnknownText_0x2c5e0: ; 0x2c5e0
; An EGG doesn't know any moves!
text_jump UnknownText_0x1c5f17
db "@"
; 0x2c5e5
UnknownText_0x2c5e5: ; 0x2c5e5
; No? Come visit me again.
text_jump UnknownText_0x1c5f36
db "@"
; 0x2c5ea
UnknownText_0x2c5ea: ; 0x2c5ea
; Which move should it forget, then?
text_jump UnknownText_0x1c5f50
db "@"
; 0x2c5ef
UnknownText_0x2c5ef: ; 0x2c5ef
; Um… Oh, yes, I'm the MOVE DELETER. I can make #MON forget moves. Shall I make a #MON forget?
text_jump UnknownText_0x1c5f74
db "@"
; 0x2c5f4
UnknownText_0x2c5f4: ; 0x2c5f4
; Which #MON?
text_jump UnknownText_0x1c5fd1
db "@"
; 0x2c5f9
Function2c5f9: ; 2c5f9
ld a, b
push bc
dec a
ld c, a
ld b, 0
ld hl, PartyMon1Moves
add hl, bc
ld a, [CurPartyMon]
ld bc, PartyMon2 - PartyMon1
call AddNTimes
pop bc
push bc
inc b
.asm_2c60f
ld a, b
cp NUM_MOVES + 1
jr z, .asm_2c61b
inc hl
ld a, [hld]
ld [hl], a
inc hl
inc b
jr .asm_2c60f
.asm_2c61b
xor a
ld [hl], a
pop bc
ld a, b
push bc
dec a
ld c, a
ld b, 0
ld hl, PartyMon1PP
add hl, bc
ld a, [CurPartyMon]
ld bc, PartyMon2 - PartyMon1
call AddNTimes
pop bc
inc b
.asm_2c633
ld a, b
cp NUM_MOVES + 1
jr z, .asm_2c63f
inc hl
ld a, [hld]
ld [hl], a
inc hl
inc b
jr .asm_2c633
.asm_2c63f
xor a
ld [hl], a
ret
; 2c642
Function2c642: ; 2c642 (b:4642)
ld de, OverworldMap ; $c800
ld a, $1
ld [de], a
inc de
ld a, $1
call GetSRAMBank
ld hl, $a009
ld a, [hli]
ld [de], a
ld b, a
inc de
ld a, [hl]
ld [de], a
ld c, a
inc de
push bc
ld hl, $a00b
ld bc, $b
call CopyBytes
push de
ld hl, $aa27
ld b, $20
call CountSetBits
pop de
pop bc
ld a, [$d265]
ld [de], a
inc de
call CloseSRAM
call Random
and $1
ld [de], a
inc de
call Function2c6ac
ld [de], a
inc de
ld a, c
ld c, b
ld b, a
call Function2c6ac
ld [de], a
inc de
ld a, $0
call GetSRAMBank
ld a, [$abe4]
ld [de], a
inc de
ld a, [$abe5]
ld [de], a
ld a, $14
ld [$ca00], a
call CloseSRAM
ld hl, OverworldMap ; $c800
ld de, $c950
ld bc, $14
jp CopyBytes
Function2c6ac: ; 2c6ac (b:46ac)
push de
call Random
cp $19
jr c, .asm_2c6cc
call Random
and $7
ld d, a
rl d
ld e, $80
.asm_2c6be
rlc e
dec a
jr nz, .asm_2c6be
ld a, e
and c
jr z, .asm_2c6c9
ld a, $1
.asm_2c6c9
add d
jr .asm_2c706
.asm_2c6cc
call Random
cp $32
jr c, .asm_2c6ed
call Random
and $3
ld d, a
rl d
ld e, $80
.asm_2c6dd
rlc e
dec a
jr nz, .asm_2c6dd
ld a, e
and b
jr z, .asm_2c6e8
ld a, $1
.asm_2c6e8
add d
add $10
jr .asm_2c706
.asm_2c6ed
call Random
cp $32
jr c, .asm_2c6fd
ld a, b
swap a
and $7
add $18
jr .asm_2c706
.asm_2c6fd
ld a, b
and $80
ld a, $20
jr z, .asm_2c706
ld a, $21
.asm_2c706
pop de
ret
Function2c708: ; 2c708 (b:4708)
ld a, c
cp $25
jr nc, Function2c722
ld hl, Unknown_2c725
ld b, 0
add hl, bc
ld c, [hl]
ret
Function2c715: ; 2c715 (b:4715)
ld a, c
cp $25
jr nc, Function2c722
ld hl, Unknown_2c74a
ld b, 0
add hl, bc
ld c, [hl]
ret
Function2c722: ; 2c722 (b:4722)
ld c, $4
ret
; 2c725 (b:4725)
Unknown_2c725: ; 2c725
; May or may not be items.
db $ad, $4e, $54, $50, $4f
db $4a, $29, $33, $31, $53
db $2c, $35, $21, $b9, $ba
db $bc, $6d, $ae, $27, $04
db $2a, $2b, $41, $3f, $18
db $16, $22, $17, $40, $15
db $28, $8c, $1a, $3e, $20
db $bb, $bd
; 2c74a
Unknown_2c74a: ; 2c74a
; May or may not be items.
db $16, $1a, $1b, $1c, $1d
db $1e, $1f, $20, $21, $22
db $0d, $0e, $10, $23, $25
db $26, $08, $09, $0f, $11
db $17, $19, $01, $02, $04
db $05, $06, $07, $0a, $12
db $29, $0c, $2a, $14, $03
db $24, $27
; 2c76f
Function2c76f: ; 2c76f (b:476f)
ld a, $1
ld [$FF00+$aa], a
call Function2c8d3
ld a, $0
ld [$FF00+$aa], a
ret nc
call Function1bee
call WaitBGMap
ld a, [CurItem] ; $d106
dec a
ld [$d107], a
ld hl, TMsHMs ; $d859
ld c, a
ld b, $0
add hl, bc
ld a, [hl]
ld [$d10d], a
call Function2c798
scf
ret
Function2c798: ; 2c798 (b:4798)
ld a, [CurItem] ; $d106
ld c, a
callab GetNumberedTMHM
ld a, c
ld [CurItem], a ; $d106
ret
Function2c7a7: ; 2c7a7 (b:47a7)
ld a, [CurItem] ; $d106
ld c, a
callab GetTMHMNumber
ld a, c
ld [$d265], a
ret
GetTMHMItemMove: ; 2c7b6 (b:47b6)
call Function2c7a7
predef GetTMHMMove
ret
Function2c7bf: ; 2c7bf (b:47bf)
ld hl, Options ; $cfcc
ld a, [hl]
push af
res 4, [hl]
ld a, [CurItem] ; $d106
cp TM_01
jr c, .asm_2c7f5
call GetTMHMItemMove
ld a, [$d265]
ld [$d262], a
call GetMoveName
call CopyName1
ld hl, UnknownText_0x2c8bf
ld a, [CurItem] ; $d106
cp HM_01
jr c, .asm_2c7e9
ld hl, UnknownText_0x2c8c4
.asm_2c7e9
call PrintText
ld hl, UnknownText_0x2c8c9
call PrintText
call YesNoBox
.asm_2c7f5
pop bc
ld a, b
ld [Options], a ; $cfcc
ret
Function2c7fb: ; 2c7fb
ld hl, StringBuffer2
ld de, $d066
ld bc, $000c
call CopyBytes
call WhiteBGMap
Function2c80a: ; 2c80a
callba Function5004f
callba Function50405
callba Function503e0
ld a, $3
ld [PartyMenuActionText], a
.asm_2c821
callba WritePartyMenuTilemap
callba PrintPartyMenuText
call WaitBGMap
call Function32f9
call DelayFrame
callba PartyMenuSelect
push af
ld a, [CurPartySpecies]
cp EGG
pop bc
jr z, .asm_2c854
push bc
ld hl, $d066
ld de, StringBuffer2
ld bc, $000c
call CopyBytes
pop af
ret
.asm_2c854
push hl
push de
push bc
push af
ld de, SFX_WRONG
call PlaySFX
call WaitSFX
pop af
pop bc
pop de
pop hl
jr .asm_2c821
; 2c867
Function2c867: ; 2c867
predef CanLearnTMHMMove
push bc
ld a, [CurPartyMon] ; $d109
ld hl, PartyMonNicknames ; $de41 (aliases: PartyMonNicknames)
call GetNick
pop bc
ld a, c
and a
jr nz, .asm_2c88b
push de
ld de, SFX_WRONG
call PlaySFX
pop de
ld hl, UnknownText_0x2c8ce
call PrintText
jr .asm_2c8b6
.asm_2c88b
callab KnowsMove
jr c, .asm_2c8b6
predef LearnMove
ld a, b
and a
jr z, .asm_2c8b6
callba Function106049
ld a, [CurItem]
call IsHM
ret c
ld c, $5
callab ChangeHappiness
call Function2cb0c
jr .asm_2c8bd
.asm_2c8b6
and a
ret
.asm_2c8b8
ld a, $2
ld [$d0ec], a
.asm_2c8bd
scf
ret
; 2c8bf (b:48bf)
UnknownText_0x2c8bf: ; 0x2c8bf
; Booted up a TM.
text_jump UnknownText_0x1c0373
db "@"
; 0x2c8c4
UnknownText_0x2c8c4: ; 0x2c8c4
; Booted up an HM.
text_jump UnknownText_0x1c0384
db "@"
; 0x2c8c9
UnknownText_0x2c8c9: ; 0x2c8c9
; It contained @ . Teach @ to a #MON?
text_jump UnknownText_0x1c0396
db "@"
; 0x2c8ce
UnknownText_0x2c8ce: ; 0x2c8ce
; is not compatible with @ . It can't learn @ .
text_jump UnknownText_0x1c03c2
db "@"
; 0x2c8d3
Function2c8d3: ; 2c8d3 (b:48d3)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function2c9e2
ld a, $2
ld [$cfa1], a
ld a, $7
ld [$cfa2], a
ld a, $1
ld [$cfa4], a
ld a, $5
sub d
inc a
cp $6
jr nz, .asm_2c8f1
dec a
.asm_2c8f1
ld [$cfa3], a
ld a, $c
ld [$cfa5], a
xor a
ld [$cfa6], a
ld a, $20
ld [$cfa7], a
ld a, $f3
ld [$cfa8], a
ld a, [$d0dc]
inc a
ld [$cfa9], a
ld a, $1
ld [$cfaa], a
jr Function2c946
Function2c915: ; 2c915 (b:4915)
call Function2c9e2
call Function1bc9
ld b, a
ld a, [$cfa9]
dec a
ld [$d0dc], a
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, [$cfa6]
bit 7, a
jp nz, Function2c9b1
ld a, b
ld [$cf73], a
bit 0, a
jp nz, Function2c974
bit 1, a
jp nz, Function2c9a5
bit 4, a
jp nz, Function2c9af
bit 5, a
jp nz, Function2c9af
Function2c946: ; 2c946 (b:4946)
call Function2c98a
jp nc, Function2c9af
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
ld a, [CurItem] ; $d106
cp $3a
jr nc, Function2c915
ld [$d265], a
predef GetTMHMMove
ld a, [$d265]
ld [CurSpecies], a ; $cf60
hlcoord 1, 14
call PrintMoveDesc
jp Function2c915
Function2c974: ; 2c974 (b:4974)
call Function2cad6
call Function2cb2a
ld a, [$cfa9]
dec a
ld b, a
ld a, [$d0e2]
add b
ld b, a
ld a, [$d265]
cp b
jr z, asm_2c9a8
Function2c98a: ; 2c98a (b:498a)
call Function2cab5
ld a, [$cfa9]
ld b, a
.asm_2c991
inc c
ld a, c
cp $3a
jr nc, .asm_2c99f
ld a, [hli]
and a
jr z, .asm_2c991
dec b
jr nz, .asm_2c991
ld a, c
.asm_2c99f
ld [CurItem], a ; $d106
cp $ff
ret
Function2c9a5: ; 2c9a5 (b:49a5)
call Function2cad6
asm_2c9a8: ; 2c9a8 (b:49a8)
ld a, $2
ld [$cf73], a
and a
ret
Function2c9af: ; 2c9af (b:49af)
and a
ret
Function2c9b1: ; 2c9b1 (b:49b1)
ld a, b
bit 7, a
jr nz, .asm_2c9c5
ld hl, $d0e2
ld a, [hl]
and a
jp z, Function2c915
dec [hl]
call Function2c9e2
jp Function2c946
.asm_2c9c5
call Function2cab5
ld b, $5
.asm_2c9ca
inc c
ld a, c
cp $3a
jp nc, Function2c915
ld a, [hli]
and a
jr z, .asm_2c9ca
dec b
jr nz, .asm_2c9ca
ld hl, $d0e2
inc [hl]
call Function2c9e2
jp Function2c946
Function2c9e2: ; 2c9e2 (b:49e2)
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
jp z, Function2caca
hlcoord 5, 2
ld bc, $a0f
ld a, $7f
call ClearBox
call Function2cab5
ld d, $5
.asm_2c9fa
inc c
ld a, c
cp $3a
jr nc, .asm_2ca77
ld a, [hli]
and a
jr z, .asm_2c9fa
ld b, a
ld a, c
ld [$d265], a
push hl
push de
push bc
call Function2ca86
push hl
ld a, [$d265]
cp $33
jr nc, .asm_2ca22
ld de, $d265
ld bc, $8102
call PrintNum
jr .asm_2ca38
.asm_2ca22
push af
sub $32
ld [$d265], a
ld [hl], $87
inc hl
ld de, $d265
ld bc, $4102
call PrintNum
pop af
ld [$d265], a
.asm_2ca38
predef GetTMHMMove
ld a, [$d265]
ld [$d262], a
call GetMoveName
pop hl
ld bc, $3
add hl, bc
push hl
call PlaceString
pop hl
pop bc
ld a, c
push bc
cp $33
jr nc, .asm_2ca6f
ld bc, $1d
add hl, bc
ld [hl], $f1
inc hl
ld a, $f6
pop bc
push bc
ld a, b
ld [$d265], a
ld de, $d265
ld bc, $102
call PrintNum
.asm_2ca6f
pop bc
pop de
pop hl
dec d
jr nz, .asm_2c9fa
jr .asm_2ca85
.asm_2ca77
call Function2ca86
inc hl
inc hl
inc hl
push de
ld de, String_2caae
call PlaceString
pop de
.asm_2ca85
ret
Function2ca86: ; 2ca86 (b:4a86)
hlcoord 5, 0
ld bc, $28
ld a, $6
sub d
ld e, a
.asm_2ca90
add hl, bc
dec e
jr nz, .asm_2ca90
ret
; 2ca95 (b:4a95)
Function2ca95: ; 2ca95
pop hl
ld bc, $0003
add hl, bc
predef GetTMHMMove
ld a, [$d265]
ld [$d262], a
call GetMoveName
push hl
call PlaceString
pop hl
ret
; 2caae
String_2caae: ; 2caae
db "CANCEL@"
; 2cab5
Function2cab5: ; 2cab5 (b:4ab5)
ld hl, TMsHMs ; $d859
ld a, [$d0e2]
ld b, a
inc b
ld c, $0
.asm_2cabf
inc c
ld a, [hli]
and a
jr z, .asm_2cabf
dec b
jr nz, .asm_2cabf
dec hl
dec c
ret
Function2caca: ; 2caca (b:4aca)
hlcoord 9, 3
push de
ld de, String_2caae
call PlaceString
pop de
ret
Function2cad6: ; 2cad6 (b:4ad6)
push de
ld de, SFX_READ_TEXT_2
call PlaySFX
pop de
ret
; 2cadf (b:4adf)
Function2cadf: ; 2cadf
call Function2c7a7
call Function2cafa
ld hl, UnknownText_0x2caf0
jr nc, .asm_2caed
ld hl, UnknownText_0x2caf5
.asm_2caed
jp PrintText
; 2caf0
UnknownText_0x2caf0: ; 0x2caf0
; You have no room for any more @ S.
text_jump UnknownText_0x1c03fa
db "@"
; 0x2caf5
UnknownText_0x2caf5: ; 0x2caf5
; You received @ !
text_jump UnknownText_0x1c0421
db "@"
; 0x2cafa
Function2cafa: ; 2cafa
ld a, [$d265]
dec a
ld hl, TMsHMs
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
inc a
cp NUM_TMS * 2
ret nc
ld [hl], a
ret
; 2cb0c
Function2cb0c: ; 2cb0c (b:4b0c)
call Function2c7a7
ld a, [$d265]
dec a
ld hl, TMsHMs ; $d859
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
and a
ret z
dec a
ld [hl], a
ret nz
ld a, [$d0e2]
and a
ret z
dec a
ld [$d0e2], a
ret
Function2cb2a: ; 2cb2a (b:4b2a)
ld b, $0
ld c, $39
ld hl, TMsHMs ; $d859
.asm_2cb31
ld a, [hli]
and a
jr z, .asm_2cb36
inc b
.asm_2cb36
dec c
jr nz, .asm_2cb31
ld a, b
ld [$d265], a
ret
PrintMoveDesc: ; 2cb3e
push hl
ld hl, MoveDescriptions
ld a, [CurSpecies]
dec a
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
jp PlaceString
; 2cb52
MoveDescriptions:: ; 2cb52
INCLUDE "battle/moves/move_descriptions.asm"
; 2ed44
Function2ed44: ; 2ed44
call ConvertBerriesToBerryJuice
ld hl, PartyMon1PokerusStatus
ld a, [PartyCount]
ld b, a
ld de, PartyMon2 - PartyMon1
.loopMons
ld a, [hl]
and $f
jr nz, .monHasActivePokerus
add hl, de
dec b
jr nz, .loopMons
ld hl, StatusFlags2
bit 6, [hl]
ret z
call Random
ld a, [hRandomAdd]
and a
ret nz
ld a, [hRandomSub]
cp $3
ret nc ; 3/65536 chance (00 00, 00 01 or 00 02)
ld a, [PartyCount]
ld b, a
.randomMonSelectLoop
call Random
and $7
cp b
jr nc, .randomMonSelectLoop
ld hl, PartyMon1PokerusStatus
call GetPartyLocation ; get pokerus byte of random mon
ld a, [hl]
and $f0
ret nz ; if it already has pokerus, do nothing
.randomPokerusLoop
call Random
and a
jr z, .randomPokerusLoop
ld b, a
and $f0
jr z, .asm_2ed91
ld a, b
and $7
inc a
.asm_2ed91
ld b, a
swap b
and $3
inc a
add b
ld [hl], a
ret
.monHasActivePokerus
call Random
cp $55
ret nc ; 1/3 chance
ld a, [PartyCount]
cp $1
ret z ; only one mon, nothing to do
ld c, [hl]
ld a, b
cp $2
jr c, .checkPreviousMonsLoop ; no more mons after this one, go backwards
call Random
cp $80
jr c, .checkPreviousMonsLoop ; 1/2 chance, go backwards
.checkFollowingMonsLoop
add hl, de
ld a, [hl]
and a
jr z, .infectMon
ld c, a
and $3
ret z ; if mon has cured pokerus, stop searching
dec b ; go on to next mon
ld a, b
cp $1
jr nz, .checkFollowingMonsLoop ; no more mons left
ret
.checkPreviousMonsLoop
ld a, [PartyCount]
cp b
ret z ; no more mons
ld a, l
sub e
ld l, a
ld a, h
sbc d
ld h, a
ld a, [hl]
and a
jr z, .infectMon
ld c, a
and $3
ret z ; if mon has cured pokerus, stop searching
inc b ; go on to next mon
jr .checkPreviousMonsLoop
.infectMon
ld a, c
and $f0
ld b, a
ld a, c
swap a
and $3
inc a
add b
ld [hl], a
ret
; 2ede6
; any berry held by a Shuckle may be converted to berry juice
ConvertBerriesToBerryJuice: ; 2ede6
ld hl, StatusFlags2
bit 6, [hl]
ret z
call Random
cp $10
ret nc ; 1/16 chance
ld hl, PartyMons
ld a, [PartyCount]
.partyMonLoop
push af
push hl
ld a, [hl]
cp SHUCKLE
jr nz, .nextMon
ld bc, PartyMon1Item - PartyMon1Species
add hl, bc
ld a, [hl]
cp BERRY
jr z, .convertToJuice
.nextMon
pop hl
ld bc, PartyMon2 - PartyMon1
add hl, bc
pop af
dec a
jr nz, .partyMonLoop
ret
.convertToJuice
ld a, BERRY_JUICE
ld [hl], a
pop hl
pop af
ret
; 2ee18
Function2ee18: ; 2ee18
ld a, [InLinkBattle]
and a
ret z
callba Function2c1b2
ld c, 150
call DelayFrames
call ClearTileMap
call ClearSprites
ret
; 2ee2f
Function2ee2f: ; 2ee2f
xor a
ld [$ffde], a
call DelayFrame
ld b, 6
ld hl, PartyMon1HP
ld de, PartyMon2 - PartyMon1 - 1
.asm_2ee3d
ld a, [hli]
or [hl]
jr nz, .asm_2ee45
add hl, de
dec b
jr nz, .asm_2ee3d
.asm_2ee45
ld de, PartyMon1Level - PartyMon1HP
add hl, de
ld a, [hl]
ld [BattleMonLevel], a
predef Function8c20f
callba Function3ed9f
ld a, 1
ld [hBGMapMode], a
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
ld [hWY], a
ld [rWY], a
ld [$ffde], a
ret
; 2ee6c
PlayBattleMusic: ; 2ee6c
push hl
push de
push bc
xor a
ld [MusicFade], a
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
call MaxVolume
ld a, [BattleType]
cp BATTLETYPE_SUICUNE
ld de, MUSIC_SUICUNE_BATTLE
jp z, .done
cp BATTLETYPE_ROAMING
jp z, .done
; Are we fighting a trainer?
ld a, [OtherTrainerClass]
and a
jr nz, .trainermusic
callba RegionCheck
ld a, e
and a
jr nz, .kantowild
ld de, MUSIC_JOHTO_WILD_BATTLE
ld a, [TimeOfDay]
cp NITE
jr nz, .done
ld de, MUSIC_JOHTO_WILD_BATTLE_NIGHT
jr .done
.kantowild
ld de, MUSIC_KANTO_WILD_BATTLE
jr .done
.trainermusic
ld de, MUSIC_CHAMPION_BATTLE
cp CHAMPION
jr z, .done
cp RED
jr z, .done
; really, they should have included admins and scientists here too...
ld de, MUSIC_ROCKET_BATTLE
cp GRUNTM
jr z, .done
cp GRUNTF
jr z, .done
ld de, MUSIC_KANTO_GYM_LEADER_BATTLE
callba IsKantoGymLeader
jr c, .done
ld de, MUSIC_JOHTO_GYM_LEADER_BATTLE
callba IsJohtoGymLeader
jr c, .done
ld de, MUSIC_RIVAL_BATTLE
ld a, [OtherTrainerClass]
cp RIVAL1
jr z, .done
cp RIVAL2
jr nz, .othertrainer
ld a, [OtherTrainerID]
cp 4 ; Rival in Indigo Plateau
jr c, .done
ld de, MUSIC_CHAMPION_BATTLE
jr .done
.othertrainer
ld a, [InLinkBattle]
and a
jr nz, .johtotrainer
callba RegionCheck
ld a, e
and a
jr nz, .kantotrainer
.johtotrainer
ld de, MUSIC_JOHTO_TRAINER_BATTLE
jr .done
.kantotrainer
ld de, MUSIC_KANTO_TRAINER_BATTLE
.done
call PlayMusic
pop bc
pop de
pop hl
ret
; 2ef18
ClearBattleRAM: ; 2ef18
xor a
ld [$d0ec], a
ld [$d0ee], a
ld hl, $d0d8
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld [$d0e4], a
ld [CriticalHit], a
ld [BattleMonSpecies], a
ld [$c664], a
ld [CurBattleMon], a
ld [$d232], a
ld [TimeOfDayPal], a
ld [PlayerTurnsTaken], a
ld [EnemyTurnsTaken], a
ld [EvolvableFlags], a
ld hl, PlayerHPPal
ld [hli], a
ld [hl], a
ld hl, BattleMonDVs
ld [hli], a
ld [hl], a
ld hl, EnemyMonDVs
ld [hli], a
ld [hl], a
; Clear the entire BattleMons area
ld hl, wBattle
ld bc, wBattleEnd - wBattle
xor a
call ByteFill
callab ResetEnemyStatLevels
call Function1fbf
ld hl, hBGMapAddress
xor a
ld [hli], a
ld [hl], $98
ret
; 2ef6e
FillBox: ; 2ef6e
; Fill $c2c6-aligned box width b height c
; with iterating tile starting from $ffad at hl.
; Predef $13
ld de, 20
ld a, [$c2c6]
and a
jr nz, .left
ld a, [$ffad]
.x1
push bc
push hl
.y1
ld [hl], a
add hl, de
inc a
dec c
jr nz, .y1
pop hl
inc hl
pop bc
dec b
jr nz, .x1
ret
.left
; Right-aligned.
push bc
ld b, 0
dec c
add hl, bc
pop bc
ld a, [$ffad]
.x2
push bc
push hl
.y2
ld [hl], a
add hl, de
inc a
dec c
jr nz, .y2
pop hl
dec hl
pop bc
dec b
jr nz, .x2
ret
; 2ef9f
SECTION "Tileset Data 4", ROMX, BANK[TILESETS_4]
INCLUDE "tilesets/data_4.asm"
SECTION "bankD", ROMX, BANK[$D]
INCLUDE "battle/effect_commands.asm"
SECTION "bankE", ROMX, BANK[$E]
INCLUDE "battle/ai/items.asm"
AIScoring: ; 38591
INCLUDE "battle/ai/scoring.asm"
Function3952d: ; 3952d
ld hl, RivalName
ld a, c
cp RIVAL1
jr z, .rival
ld [CurSpecies], a
ld a, TRAINER_NAME
ld [$cf61], a
call GetName
ld de, StringBuffer1
ret
.rival
ld de, StringBuffer1
push de
ld bc, NAME_LENGTH
call CopyBytes
pop de
ret
; 39550
Function39550: ; 39550
ld hl, $d26b
ld a, [InLinkBattle]
and a
jr nz, .ok
ld hl, RivalName
ld a, c
cp RIVAL1
jr z, .ok
ld [CurSpecies], a
ld a, TRAINER_NAME
ld [$cf61], a
call GetName
ld hl, StringBuffer1
.ok
ld bc, $000d
ld de, OTName
push de
call CopyBytes
pop de
ret
; 3957b
Function3957b: ; 3957b
ld a, [TrainerClass]
ld c, a
call Function39550
ld a, [TrainerClass]
dec a
ld hl, TrainerClassAttributes
ld bc, 7
call AddNTimes
ld de, $c650
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
ld a, [hl]
ld [$c652], a
ret
; 3959c
INCLUDE "trainers/attributes.asm"
ReadTrainerParty: ; 39771
ld a, [$cfc0]
bit 0, a
ret nz
ld a, [InLinkBattle]
and a
ret nz
ld hl, OTPartyCount
xor a
ld [hli], a
dec a
ld [hl], a
ld hl, OTPartyMons
ld bc, OTPartyMonsEnd - OTPartyMons
xor a
call ByteFill
ld a, [OtherTrainerClass]
cp CAL
jr nz, .not_cal2
ld a, [OtherTrainerID]
cp CAL2
jr z, .cal2
ld a, [OtherTrainerClass]
.not_cal2
dec a
ld c, a
ld b, 0
ld hl, TrainerGroups
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [OtherTrainerID]
ld b, a
.skip_trainer
dec b
jr z, .got_trainer
.next
ld a, [hli]
cp $ff
jr nz, .next
jr .skip_trainer
.got_trainer
.skip_name
ld a, [hli]
cp "@"
jr nz, .skip_name
ld a, [hli]
ld c, a
ld b, 0
ld d, h
ld e, l
ld hl, TrainerTypes
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld bc, .done
push bc
jp [hl]
.done
jp Function3991b
.cal2
ld a, $0
call GetSRAMBank
ld de, $ac0a
call TrainerType2
call CloseSRAM
jr .done
; 397e3
TrainerTypes: ; 397e3
dw TrainerType1 ; level, species
dw TrainerType2 ; level, species, moves
dw TrainerType3 ; level, species, item
dw TrainerType4 ; level, species, item, moves
; 397eb
TrainerType1: ; 397eb
; normal (level, species)
ld h, d
ld l, e
.loop
ld a, [hli]
cp $ff
ret z
ld [CurPartyLevel], a
ld a, [hli]
ld [CurPartySpecies], a
ld a, OTPARTYMON
ld [MonType], a
push hl
predef Functiond88c
pop hl
jr .loop
; 39806
TrainerType2: ; 39806
; moves
ld h, d
ld l, e
.loop
ld a, [hli]
cp $ff
ret z
ld [CurPartyLevel], a
ld a, [hli]
ld [CurPartySpecies], a
ld a, OTPARTYMON
ld [MonType], a
push hl
predef Functiond88c
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Moves
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld d, h
ld e, l
pop hl
ld b, NUM_MOVES
.copy_moves
ld a, [hli]
ld [de], a
inc de
dec b
jr nz, .copy_moves
push hl
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Species
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld d, h
ld e, l
ld hl, OTPartyMon1PP - OTPartyMon1
add hl, de
push hl
ld hl, OTPartyMon1Moves - OTPartyMon1
add hl, de
pop de
ld b, NUM_MOVES
.copy_pp
ld a, [hli]
and a
jr z, .copied_pp
push hl
push bc
dec a
ld hl, Moves + MOVE_PP
ld bc, MOVE_LENGTH
call AddNTimes
ld a, BANK(Moves)
call GetFarByte
pop bc
pop hl
ld [de], a
inc de
dec b
jr nz, .copy_pp
.copied_pp
pop hl
jr .loop
; 39871
TrainerType3: ; 39871
; item
ld h, d
ld l, e
.loop
ld a, [hli]
cp $ff
ret z
ld [CurPartyLevel], a
ld a, [hli]
ld [CurPartySpecies], a
ld a, OTPARTYMON
ld [MonType], a
push hl
predef Functiond88c
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Item
ld bc, OTPartyMon2 - OTPartyMon1
call AddNTimes
ld d, h
ld e, l
pop hl
ld a, [hli]
ld [de], a
jr .loop
; 3989d (e:589d)
TrainerType4: ; 3989d
; item + moves
ld h, d
ld l, e
.loop
ld a, [hli]
cp $ff
ret z
ld [CurPartyLevel], a
ld a, [hli]
ld [CurPartySpecies], a
ld a, OTPARTYMON
ld [MonType], a
push hl
predef Functiond88c
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Item
ld bc, OTPartyMon2 - OTPartyMon1
call AddNTimes
ld d, h
ld e, l
pop hl
ld a, [hli]
ld [de], a
push hl
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1Moves
ld bc, OTPartyMon2 - OTPartyMon1
call AddNTimes
ld d, h
ld e, l
pop hl
ld b, NUM_MOVES
.copy_moves
ld a, [hli]
ld [de], a
inc de
dec b
jr nz, .copy_moves
push hl
ld a, [OTPartyCount]
dec a
ld hl, OTPartyMon1
ld bc, OTPartyMon2 - OTPartyMon1
call AddNTimes
ld d, h
ld e, l
ld hl, OTPartyMon1PP - OTPartyMon1
add hl, de
push hl
ld hl, OTPartyMon1Moves - OTPartyMon1
add hl, de
pop de
ld b, NUM_MOVES
.copy_pp
ld a, [hli]
and a
jr z, .copied_pp
push hl
push bc
dec a
ld hl, Moves + MOVE_PP
ld bc, MOVE_LENGTH
call AddNTimes
ld a, BANK(Moves)
call GetFarByte
pop bc
pop hl
ld [de], a
inc de
dec b
jr nz, .copy_pp
.copied_pp
pop hl
jr .loop
; 3991b
Function3991b: ; 3991b (e:591b)
ld hl, $ffb3
xor a
ld [hli], a
ld [hli], a
ld [hli], a
ld a, [$c652] ; base reward
ld [hli], a
ld a, [CurPartyLevel]
ld [hl], a
call Multiply
ld hl, $c686
xor a
ld [hli], a
ld a, [$ffb5]
ld [hli], a
ld a, [$ffb6]
ld [hl], a
ret
Function39939:: ; 39939
ld a, [$cfc0]
bit 0, a
ld hl, $d26b
jp nz, Function39984
ld a, [OtherTrainerID]
ld b, a
ld a, [OtherTrainerClass]
ld c, a
Function3994c:: ; 3994c
ld a, c
cp CAL
jr nz, .asm_3996d
ld a, $0
call GetSRAMBank
ld a, [$abfd]
and a
call CloseSRAM
jr z, .asm_3996d
ld a, $0
call GetSRAMBank
ld hl, $abfe
call Function39984
jp CloseSRAM
.asm_3996d
dec c
push bc
ld b, 0
ld hl, TrainerGroups
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
pop bc
.asm_3997a
dec b
jr z, Function39984
.asm_3997d
ld a, [hli]
cp $ff
jr nz, .asm_3997d
jr .asm_3997a
Function39984: ; 39984
ld de, StringBuffer1
push de
ld bc, $000b
call CopyBytes
pop de
ret
; 39990
Function39990: ; 39990
ld de, StringBuffer1
push de
ld bc, $000b
pop de
ret
; 39999
INCLUDE "trainers/trainer_pointers.asm"
INCLUDE "trainers/trainers.asm"
SECTION "bankF", ROMX, BANK[$F]
INCLUDE "battle/core.asm"
INCLUDE "battle/effect_command_pointers.asm"
SECTION "bank10", ROMX, BANK[$10]
Pokedex: ; 40000
ld a, [hWX]
ld l, a
ld a, [hWY]
ld h, a
push hl
ld a, [hSCX]
push af
ld hl, Options
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
ld a, [VramState]
push af
xor a
ld [VramState], a
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
xor a
ld [$ffde], a
call InitPokedex
call DelayFrame
.main
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .exit
call Function4010b
call DelayFrame
jr .main
.exit
ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
call ClearSprites
ld a, [$c7d4]
ld [$d959], a
pop af
ld [$ffaa], a
pop af
ld [VramState], a
pop af
ld [Options], a
pop af
ld [hSCX], a
pop hl
ld a, l
ld [hWX], a
ld a, h
ld [hWY], a
ret
; 40063
InitPokedex: ; 40063
call WhiteBGMap
call ClearSprites
call ClearTileMap
call Function414b7
ld hl, $c6d0
ld bc, $0115
xor a
call ByteFill
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
call Function400a2
ld a, [$d959]
ld [$c7d4], a
call Function40bdc
call Function400b4
call Function400ed
callba Function1de247
call Function41af7
ret
; 400a2
Function400a2: ; 400a2
ld a, [StatusFlags]
bit 1, a
jr nz, .asm_400ae
xor a
ld [$c7dc], a
ret
.asm_400ae
ld a, 1
ld [$c7dc], a
ret
; 400b4
Function400b4: ; 400b4
ld hl, $c6d0
ld a, [$c2d6]
and a
jr z, .asm_400ec
cp $fc
jr nc, .asm_400ec
ld b, a
ld a, [$c7d2]
cp $8
jr c, .asm_400db
sub $7
ld c, a
.asm_400cc
ld a, b
cp [hl]
jr z, .asm_400ec
inc hl
ld a, [$c7d0]
inc a
ld [$c7d0], a
dec c
jr nz, .asm_400cc
.asm_400db
ld c, $7
.asm_400dd
ld a, b
cp [hl]
jr z, .asm_400ec
inc hl
ld a, [$c7d1]
inc a
ld [$c7d1], a
dec c
jr nz, .asm_400dd
.asm_400ec
ret
; 400ed
Function400ed: ; 400ed
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
cp SPECIAL_MAP
jr nz, .asm_40107
ld a, [BackupMapGroup]
ld b, a
ld a, [BackupMapNumber]
ld c, a
call GetWorldMapLocation
.asm_40107
ld [$c7e4], a
ret
; 4010b
Function4010b: ; 4010b
ld a, [$cf63]
ld hl, Jumptable_40115
call Function41432
jp [hl]
; 40115
Jumptable_40115: ; 40115 (10:4115)
dw Function4013c
dw Function401ae
dw Function40217
dw Function40258
dw Function402aa
dw Function40443
dw Function40471
dw Function4039d
dw Function403be
dw Function4050a
dw Function40562
dw Function405bd
dw Function405df
dw Function40136
Function40131: ; 40131 (10:4131)
ld hl, $cf63
inc [hl]
ret
Function40136: ; 40136 (10:4136)
ld hl, $cf63
set 7, [hl]
ret
Function4013c: ; 4013c (10:413c)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call ClearSprites
xor a
ld hl, AttrMap ; $cdd9
ld bc, $168
call ByteFill
callba Function1de171
hlcoord 0, 17
ld de, $47f2
call Function40acd
ld a, $7
ld [$c7d3], a
call Function40b0f
call Function41aeb
call Function41af7
call Function4074c
ld a, $5
ld [hSCX], a ; $ff00+$cf
ld a, [$c7d4]
cp $1
ld a, $4a
jr z, .asm_4017b
ld a, $47
.asm_4017b
ld [hWX], a ; $ff00+$d1
xor a
ld [hWY], a ; $ff00+$d2
call WaitBGMap
call Function41af7
ld a, $ff
ld [CurPartySpecies], a ; $d108
ld a, $4
call Function41423
call Function41148
callba Function1de171
hlcoord 0, 17
ld de, $47f2
call Function40acd
ld a, $7
ld [$c7d3], a
call Function40b0f
call Function40131
ret
Function401ae: ; 401ae (10:41ae)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and $2
jr nz, .asm_40211
ld a, [hl]
and $1
jr nz, .asm_401d9
ld a, [hl]
and $4
jr nz, .asm_401eb
ld a, [hl]
and $8
jr nz, .asm_401fe
call Function406c5
ret nc
call Function41148
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function40b0f
call Function41ad7
call Function41af7
ret
.asm_401d9
call Function40bb1
call Function40bd0
ret z
ld a, $2
ld [$cf63], a
ld a, $0
ld [$cf64], a
ret
.asm_401eb
call Function41401
ld a, $7
ld [$cf63], a
xor a
ld [hSCX], a ; $ff00+$cf
ld a, $a7
ld [hWX], a ; $ff00+$d1
call DelayFrame
ret
.asm_401fe
call Function41401
ld a, $5
ld [$cf63], a
xor a
ld [hSCX], a ; $ff00+$cf
ld a, $a7
ld [hWX], a ; $ff00+$d1
call DelayFrame
ret
.asm_40211
ld a, $d
ld [$cf63], a
ret
Function40217: ; 40217 (10:4217)
call LowVolume
xor a
ld [$cf65], a
xor a
ld [hBGMapMode], a ; $ff00+$d4
call ClearSprites
call Function41478
call Function407fd
call Function4134f
call Function40bb1
ld [$c2d6], a
callba Function4424d
call Function40ba0
call WaitBGMap
ld a, $a7
ld [hWX], a ; $ff00+$d1
call Function40bb1
ld [CurPartySpecies], a ; $d108
ld a, $4
call Function41423
ld a, [CurPartySpecies] ; $d108
call PlayCry
call Function40131
ret
Function40258: ; 40258 (10:4258)
ld de, Unknown_402e8
call Function4135a
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and $2
jr nz, .asm_4027d
ld a, [hl]
and $1
jr nz, .asm_40273
call Function4066c
ret nc
call Function40131
ret
.asm_40273
ld a, [$c7d8]
ld hl, Jumptable_402f2
call Function41432
jp [hl]
.asm_4027d
ld a, [LastVolume] ; $c2b4
and a
jr z, .asm_40288
ld a, $77
ld [LastVolume], a ; $c2b4
.asm_40288
call MaxVolume
ld a, [$cf64]
ld [$cf63], a
ret
; 40292 (10:4292)
Function40292: ; 40292
ld a, [$cf65]
xor $1
ld [$cf65], a
call Function40bb1
ld [$c2d6], a
callba Function4424d
call WaitBGMap
ret
; 402aa
Function402aa: ; 402aa (10:42aa)
call Function41401
xor a
ld [$cf65], a
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function407fd
call Function4134f
call Function41478
call Function40bb1
ld [$c2d6], a
callba Function4424d
call Function40ba0
call Function4143b
call WaitBGMap
call Function40bb1
ld [CurPartySpecies], a ; $d108
ld a, $4
call Function41423
ld a, [CurPartySpecies] ; $d108
call PlayCry
ld hl, $cf63
dec [hl]
ret
; 402e8 (10:42e8)
Unknown_402e8: ; 402e8
dw $0430
dw $c5f5
dw $c5fa
dw $c5ff
dw $c603
; 402f2
Jumptable_402f2: ; 402f2
dw Function40292
dw Function402fa
dw Function40340
dw Function4034f
; 402fa
Function402fa: ; 402fa
call Function41401
xor a
ld [hSCX], a
call DelayFrame
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
call Function40bb1
ld a, [$c7e4]
ld e, a
predef Function91d11
call Function41401
call DelayFrame
xor a
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
ld a, $5
ld [hSCX], a
call DelayFrame
call Function4038d
call Function4143b
call WaitBGMap
call Function40bb1
ld [CurPartySpecies], a
ld a, $4
call Function41423
ret
; 40340
Function40340: ; 40340
call Function40bb1
ld a, [$d265]
call GetCryIndex
ld e, c
ld d, b
call PlayCryHeader
ret
; 4034f
Function4034f: ; 4034f
call Function41415
xor a
ld [hSCX], a
ld a, [$cf65]
push af
ld a, [$cf64]
push af
ld a, [$cf63]
push af
callba Function8442c
pop af
ld [$cf63], a
pop af
ld [$cf64], a
pop af
ld [$cf65], a
call WhiteBGMap
call DisableLCD
call Function414fb
call Function4038d
call EnableLCD
call WaitBGMap
ld a, $5
ld [hSCX], a
call Function41427
ret
; 4038d
Function4038d: ; 4038d
call Function407fd
call Function40bb1
callba Function4424d
call Function40ba0
ret
; 4039d
Function4039d: ; 4039d (10:439d)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call ClearSprites
call Function4087c
call Function4134f
ld a, [$c7d4]
ld [$c7d8], a
call Function40e5b
call WaitBGMap
ld a, $10
call Function41423
call Function40131
ret
Function403be: ; 403be (10:43be)
ld a, [$c7dc]
and a
jr nz, .asm_403c9
ld de, Unknown_403f3
jr .asm_403cc
.asm_403c9
ld de, Unknown_403fb
.asm_403cc
call Function4135a
call c, Function40e5b
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and $6
jr nz, .asm_403ea
ld a, [hl]
and $1
jr nz, .asm_403e0
ret
.asm_403e0
ld a, [$c7d8]
ld hl, Jumptable_40405
call Function41432
jp [hl]
.asm_403ea
call Function41401
ld a, $0
ld [$cf63], a
ret
; 403f3 (10:43f3)
Unknown_403f3: ; 403f3
dw $03c0
dw $c4f2
dw $c51a
dw $c542
; 403fb
Unknown_403fb: ; 403fb
dw $04c0
dw $c4f2
dw $c51a
dw $c542
dw $c56a
; 40405
Jumptable_40405: ; 40405 (10:4405)
dw Function4040d
dw Function40411
dw Function40415
dw Function4043a
; 4040d
Function4040d: ; 4040d (10:440d)
ld b, $0
jr Function40417
Function40411: ; 40411 (10:4411)
ld b, $1
jr Function40417
Function40415: ; 40415 (10:4415)
ld b, $2
Function40417: ; 40417 (10:4417)
ld a, [$c7d4]
cp b
jr z, .asm_40431
ld a, b
ld [$c7d4], a
call Function40bdc
call Function40f08
xor a
ld [$c7d0], a
ld [$c7d1], a
call Function400b4
.asm_40431
call Function41401
ld a, $0
ld [$cf63], a
ret
Function4043a: ; 4043a (10:443a)
call Function41401
ld a, $b
ld [$cf63], a
ret
Function40443: ; 40443 (10:4443)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call ClearSprites
call Function408f0
call Function4134f
ld a, $1
ld [$c7d5], a
xor a
ld [$c7d6], a
call Function40fa8
xor a
ld [$c7db], a
callba Function44207
call WaitBGMap
ld a, $10
call Function41423
call Function40131
ret
Function40471: ; 40471 (10:4471)
ld de, Unknown_4049e
call Function4135a
call Function40f4f
call c, Function40fa8
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and $a
jr nz, .asm_40495
ld a, [hl]
and $1
jr nz, .asm_4048b
ret
.asm_4048b
ld a, [$c7d8]
ld hl, Jumptable_404a8
call Function41432
jp [hl]
.asm_40495
call Function41401
ld a, $0
ld [$cf63], a
ret
; 4049e (10:449e)
Unknown_4049e: ; 4049e
dw $04c0
dw $c4f2
dw $c51a
dw $c5a6
dw $c5ce
; 404a8
Jumptable_404a8: ; 404a8
dw Function404b0
dw Function404b0
dw Function404b7
dw Function40501
; 404b0
Function404b0: ; 404b0
call Function40f84
call Function40fa8
ret
; 404b7
Function404b7: ; 404b7
call Function41086
callba Function441cf
ld a, [$c7d7]
and a
jr nz, .asm_404dc
call Function40bdc
call Function41107
xor a
ld [hBGMapMode], a
call Function408f0
call Function4134f
call Function40fa8
call WaitBGMap
ret
.asm_404dc
ld [$c7d2], a
ld a, [$c7d0]
ld [$c7e0], a
ld a, [$c7d1]
ld [$c7e1], a
ld a, [$c2d6]
ld [$cf65], a
xor a
ld [$c7d0], a
ld [$c7d1], a
call Function41401
ld a, $9
ld [$cf63], a
ret
; 40501
Function40501: ; 40501
call Function41401
ld a, $0
ld [$cf63], a
ret
; 4050a
Function4050a: ; 4050a (10:450a)
xor a
ld [hBGMapMode], a ; $ff00+$d4
xor a
ld hl, AttrMap ; $cdd9
ld bc, $168
call ByteFill
call Function41ae1
call Function41af7
callba Function1de1d1
call Function409cf
ld a, $4
ld [$c7d3], a
call Function40b0f
call Function41ad7
call Function41af7
call Function40962
ld a, $5
ld [hSCX], a ; $ff00+$cf
ld a, $4a
ld [hWX], a ; $ff00+$d1
xor a
ld [hWY], a ; $ff00+$d2
call WaitBGMap
call Function41af7
callba Function1de1d1
call Function409cf
call Function41281
ld a, $ff
ld [CurPartySpecies], a ; $d108
ld a, $4
call Function41423
call Function40131
ret
Function40562: ; 40562 (10:4562)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and $2
jr nz, .asm_40595
ld a, [hl]
and $1
jr nz, .asm_40583
call Function406c5
ret nc
call Function41281
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function40b0f
call Function41ad7
call Function41af7
ret
.asm_40583
call Function40bb1
call Function40bd0
ret z
ld a, $2
ld [$cf63], a
ld a, $9
ld [$cf64], a
ret
.asm_40595
ld a, [$c7e0]
ld [$c7d0], a
ld a, [$c7e1]
ld [$c7d1], a
ld a, [$cf65]
ld [$c2d6], a
call Function41401
call ClearSprites
call Function40bdc
ld a, $5
ld [$cf63], a
xor a
ld [hSCX], a ; $ff00+$cf
ld a, $a7
ld [hWX], a ; $ff00+$d1
ret
Function405bd: ; 405bd (10:45bd)
call Function41a2c
call Function409f1
xor a
ld [$c7dd], a
call Function41a58
call Function40658
callba Functionfba2e
call WaitBGMap
ld a, $16
call Function41423
call Function40131
ret
Function405df: ; 405df (10:45df)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and A_BUTTON | B_BUTTON
jr nz, .asm_405eb
call Function40610
ret
.asm_405eb
call Function41401
ld a, $7
ld [$cf63], a
call DelayFrame
call Function41a24
jr nz, .asm_40603
callba Function1ddf26
jr .asm_4060f
.asm_40603
ld hl, PokedexLZ
ld de, $9310
lb bc, BANK(PokedexLZ), $3a
call Functione73
.asm_4060f
ret
Function40610: ; 40610 (10:4610)
ld hl, $ffa9
ld a, [hl]
and $10
jr nz, .asm_4061e
ld a, [hl]
and $20
jr nz, .asm_4062d
ret
.asm_4061e
ld a, [$c7de]
ld e, a
ld hl, $c7dd
ld a, [hl]
inc a
cp e
ret nc
ld a, [hl]
inc [hl]
jr .asm_40635
.asm_4062d
ld hl, $c7dd
ld a, [hl]
and a
ret z
ld a, [hl]
dec [hl]
.asm_40635
push af
xor a
ld [hBGMapMode], a ; $ff00+$d4
pop af
call Function40654
call Function41a58
call Function40658
callba Functionfba2e
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
ret
Function40654: ; 40654 (10:4654)
ld c, $7f
jr asm_4065d
Function40658: ; 40658 (10:4658)
ld a, [$c7dd]
ld c, $5a
asm_4065d: ; 4065d (10:465d)
ld e, a
ld d, 0
ld hl, Unknown_40a3e + 2
add hl, de
add hl, de
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld [hl], c
ret
Function4066c: ; 4066c (10:466c)
ld a, [$c7d1]
ld [$c7e2], a
ld a, [$c7d0]
ld [$c7e3], a
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, .asm_40687
ld a, [hl]
and $80
jr nz, .asm_4069e
and a
ret
.asm_40687
ld a, [$c7d3]
ld d, a
ld a, [$c7d2]
ld e, a
call Function406ea
jr nc, .asm_406b7
call Function40bb1
call Function40bd0
jr nz, .asm_406b5
jr .asm_40687
.asm_4069e
ld a, [$c7d3]
ld d, a
ld a, [$c7d2]
ld e, a
call Function406fe
jr nc, .asm_406b7
call Function40bb1
call Function40bd0
jr nz, .asm_406b5
jr .asm_4069e
.asm_406b5
scf
ret
.asm_406b7
ld a, [$c7e2]
ld [$c7d1], a
ld a, [$c7e3]
ld [$c7d0], a
and a
ret
Function406c5: ; 406c5 (10:46c5)
ld a, [$c7d3]
ld d, a
ld a, [$c7d2]
ld e, a
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, Function406ea
ld a, [hl]
and $80
jr nz, Function406fe
ld a, d
cp e
jr nc, asm_4073d
ld a, [hl]
and $20
jr nz, asm_40716
ld a, [hl]
and $10
jr nz, asm_40728
jr asm_4073d
Function406ea: ; 406ea (10:46ea)
ld hl, $c7d1
ld a, [hl]
and a
jr z, .asm_406f4
dec [hl]
jr asm_4073f
.asm_406f4
ld hl, $c7d0
ld a, [hl]
and a
jr z, asm_4073d
dec [hl]
jr asm_4073f
Function406fe: ; 406fe (10:46fe)
ld hl, $c7d1
ld a, [hl]
inc a
cp e
jr nc, asm_4073d
cp d
jr nc, .asm_4070c
inc [hl]
jr asm_4073f
.asm_4070c
ld hl, $c7d0
add [hl]
cp e
jr nc, asm_4073d
inc [hl]
jr asm_4073f
asm_40716: ; 40716 (10:4716)
ld hl, $c7d0
ld a, [hl]
and a
jr z, asm_4073d
cp d
jr nc, .asm_40724
xor a
ld [hl], a
jr asm_4073f
.asm_40724
sub d
ld [hl], a
jr asm_4073f
asm_40728: ; 40728 (10:4728)
ld hl, $c7d0
ld a, d
add a
add [hl]
jr c, .asm_40733
cp e
jr c, .asm_40738
.asm_40733
ld a, e
sub d
ld [hl], a
jr asm_4073f
.asm_40738
ld a, [hl]
add d
ld [hl], a
jr asm_4073f
asm_4073d: ; 4073d (10:473d)
and a
ret
asm_4073f: ; 4073f (10:473f)
scf
ret
Function40741: ; 40741
push de
ld de, $0014
.asm_40745
ld [hl], a
add hl, de
dec b
jr nz, .asm_40745
pop de
ret
; 4074c
Function4074c: ; 4074c (10:474c)
hlcoord 0, 17
ld de, Unknown_407f2
call Function40acd
ld a, $32
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
call ByteFill
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $707
call Function40ad5
hlcoord 0, 9
ld bc, $607
call Function40ad5
hlcoord 1, 11
ld de, Unknown_407e1
call Function40acd
ld hl, PokedexSeen ; $deb9 (aliases: EndPokedexSeen)
ld b, $20
call CountSetBits
ld de, $d265
hlcoord 5, 12
ld bc, $103
call PrintNum
hlcoord 1, 14
ld de, Unknown_407e6
call Function40acd
ld hl, PokedexCaught ; $de99
ld b, $20
call CountSetBits
ld de, $d265
hlcoord 5, 15
ld bc, $103
call PrintNum
hlcoord 1, 17
ld de, Unknown_407ea
call Function40acd
hlcoord 8, 1
ld b, $7
ld a, $5a
call Function40741
hlcoord 8, 10
ld b, $6
ld a, $5a
call Function40741
hlcoord 8, 0
ld [hl], $59
hlcoord 8, 8
ld [hl], $53
hlcoord 8, 9
ld [hl], $54
hlcoord 8, 16
ld [hl], $5b
call Function40ab2
ret
; 407e1 (10:47e1)
Unknown_407e1: ; 407e1
db "SEEN", $ff
Unknown_407e6: ; 407e6
db "OWN", $ff
Unknown_407ea: ; 407ea
db $3b, $48, $49, $4a, $44, $45, $46, $47 ; SELECT > OPTION
Unknown_407f2: ; 407f2
db $3c, $3b, $41, $42, $43, $4b, $4c, $4d, $4e, $3c, $ff ; START > SEARCH
; 407fd
Function407fd: ; 407fd
call Function40aa6
ld hl, TileMap
ld bc, $0f12
call Function40ad5
hlcoord 19, 0
ld [hl], $34
hlcoord 19, 1
ld a, $7f
ld b, $f
call Function40741
ld [hl], $39
hlcoord 1, 10
ld bc, $0013
ld a, $61
call ByteFill
hlcoord 1, 17
ld bc, $0012
ld a, $7f
call ByteFill
hlcoord 9, 7
ld de, Unknown_40852
call Function40acd
hlcoord 9, 9
ld de, Unknown_4085c
call Function40acd
hlcoord 0, 17
ld de, Unknown_40867
call Function40acd
call Function40ab2
ret
; 4084f
Unknown_4084f: ; 4084f
db $5c, $5d, $ff ; No.
Unknown_40852: ; 40852
db "HT ?", $5e, "??", $5f, $ff ; HT ?'??"
Unknown_4085c: ; 4085c
db "WT ???lb", $ff ; WT ???lb
Unknown_40867: ; 40867
db $3b, " PAGE AREA CRY PRNT", $ff
; 4087c
Function4087c: ; 4087c (10:487c)
call Function40aa6
hlcoord 0, 2
ld bc, $812
call Function40ad5
hlcoord 0, 12
ld bc, $412
call Function40ad5
hlcoord 0, 1
ld de, Unknown_408b2
call Function40acd
hlcoord 3, 4
ld de, String_408bd
call PlaceString
ld a, [$c7dc]
and a
ret z
hlcoord 3, 10
ld de, String_408e5
call PlaceString
ret
; 408b2 (10:48b2)
Unknown_408b2: ; 408b2
db $3b, " OPTION ", $3c, $ff
; 408bd
String_408bd: ; 408bd
db "NEW #DEX MODE", $4e
db "OLD #DEX MODE", $4e
db "A to Z MODE@"
; 408e5
String_408e5: ; 408e5
db "UNOWN MODE@"
; 408f0
Function408f0: ; 408f0 (10:48f0)
call Function40aa6
hlcoord 0, 2
ld bc, $e12
call Function40ad5
hlcoord 0, 1
ld de, Unknown_4092a
call Function40acd
hlcoord 8, 4
ld de, Unknown_40935
call Function40acd
hlcoord 8, 6
ld de, Unknown_40935
call Function40acd
hlcoord 3, 4
ld de, String_40940
call PlaceString
hlcoord 3, 13
ld de, String_4094c
call PlaceString
ret
; 4092a (10:492a)
Unknown_4092a: ; 4092a
db $3b, " SEARCH ", $3c, $ff
; 40925
Unknown_40935: ; 40935
db $3d, " ", $3e, $ff
; 40940
String_40940: ; 40940
db "TYPE1", $4e
db "TYPE2@"
; 4094c
String_4094c: ; 4094c
db "BEGIN SEARCH!!", $4e, "CANCEL@"
; 40962
Function40962: ; 40962 (10:4962)
call Function40aa6
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $707
call Function40ad5
hlcoord 0, 11
ld bc, $512
call Function40ad5
hlcoord 1, 12
ld de, String_409ae
call PlaceString
ld de, $c7d7
hlcoord 1, 16
ld bc, $103
call PrintNum
hlcoord 8, 0
ld [hl], $59
hlcoord 8, 1
ld b, $7
ld a, $5a
call Function40741
hlcoord 8, 8
ld [hl], $53
hlcoord 8, 9
ld [hl], $69
hlcoord 8, 10
ld [hl], $6a
call Function40ab2
ret
; 409ae (10:49ae)
String_409ae: ; 409ae
db "SEARCH RESULTS", $4e
db " TYPE", $4e
db " FOUND!@"
; 409cf
Function409cf: ; 409cf (10:49cf)
ld a, [$c7d5]
hlcoord 0, 14
call Function40fcd
ld a, [$c7d5]
ld b, a
ld a, [$c7d6]
and a
jr z, .asm_409f0
cp b
jr z, .asm_409f0
hlcoord 2, 15
call Function40fcd
hlcoord 1, 15
ld [hl], $f3
.asm_409f0
ret
Function409f1: ; 409f1 (10:49f1)
call Function40aa6
hlcoord 2, 1
ld bc, $a0d
call Function40ad5
hlcoord 2, 14
ld bc, $10d
call Function40ad5
hlcoord 2, 15
ld [hl], $3d
hlcoord 16, 15
ld [hl], $3e
hlcoord 6, 5
call Function40ab5
ld de, $0
ld b, $0
ld c, $1a
.asm_40a1d
ld hl, EndPokedexSeen ; $ded9 (aliases: UnownDex)
add hl, de
ld a, [hl]
and a
jr z, .asm_40a39
push af
ld hl, Unknown_40a3e
add hl, de
add hl, de
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
pop af
add $3f
ld [hl], a
inc de
inc b
dec c
jr nz, .asm_40a1d
.asm_40a39
ld a, b
ld [$c7de], a
ret
; 40a3e (10:4a3e)
Unknown_40a3e: ; 40a3e
dw $c580, $c57f
dw $c56c, $c56b
dw $c558, $c557
dw $c544, $c543
dw $c530, $c52f
dw $c51c, $c51b
dw $c508, $c507
dw $c4f4, $c4f3
dw $c4e0, $c4cb
dw $c4e1, $c4cd
dw $c4e2, $c4ce
dw $c4e3, $c4cf
dw $c4e4, $c4d0
dw $c4e5, $c4d1
dw $c4e6, $c4d2
dw $c4e7, $c4d3
dw $c4e8, $c4d4
dw $c4e9, $c4d5
dw $c4ea, $c4d7
dw $c4fe, $c4ff
dw $c512, $c513
dw $c526, $c527
dw $c53a, $c53b
dw $c54e, $c54f
dw $c562, $c563
dw $c576, $c577
; 40aa6
Function40aa6: ; 40aa6
ld hl, TileMap
ld a, $32
ld bc, $0168
call ByteFill
ret
; 40ab2
Function40ab2: ; 40ab2
hlcoord 1, 1
Function40ab5: ; 40ab5
xor a
ld b, $7
.asm_40ab8
ld c, $7
push af
push hl
.asm_40abc
ld [hli], a
add $7
dec c
jr nz, .asm_40abc
pop hl
ld de, $0014
add hl, de
pop af
inc a
dec b
jr nz, .asm_40ab8
ret
; 40acd
Function40acd: ; 40acd
.asm_40acd
ld a, [de]
cp $ff
ret z
inc de
ld [hli], a
jr .asm_40acd
; 40ad5
Function40ad5: ; 40ad5
push hl
ld a, $33
ld [hli], a
ld d, $34
call Function40b06
ld a, $35
ld [hl], a
pop hl
ld de, $0014
add hl, de
.asm_40ae6
push hl
ld a, $36
ld [hli], a
ld d, $7f
call Function40b06
ld a, $37
ld [hl], a
pop hl
ld de, $0014
add hl, de
dec b
jr nz, .asm_40ae6
ld a, $38
ld [hli], a
ld d, $39
call Function40b06
ld a, $3a
ld [hl], a
ret
; 40b06
Function40b06: ; 40b06
ld e, c
.asm_40b07
ld a, e
and a
ret z
ld a, d
ld [hli], a
dec e
jr .asm_40b07
; 40b0f
Function40b0f: ; 40b0f (10:4b0f)
ld a, [$c7d4]
cp $1
jr z, .asm_40b1a
ld c, $b
jr .asm_40b1c
.asm_40b1a
ld c, $b
.asm_40b1c
hlcoord 0, 1
ld a, [$c7d3]
add a
inc a
ld b, a
ld a, $7f
call Function413fe
ld a, [$c7d0]
ld e, a
ld d, $0
ld hl, PlayerSDefLevel ; $c6d0
add hl, de
ld e, l
ld d, h
hlcoord 0, 2
ld a, [$c7d3]
.asm_40b3c
push af
ld a, [de]
ld [$d265], a
push de
push hl
call Function40b55
pop hl
ld de, $28
add hl, de
pop de
inc de
pop af
dec a
jr nz, .asm_40b3c
call Function4143b
ret
Function40b55: ; 40b55 (10:4b55)
and a
ret z
call Function40b6a
call Function40b8d
ret c
call Function40b82
push hl
call GetPokemonName
pop hl
call PlaceString
ret
Function40b6a: ; 40b6a (10:4b6a)
ld a, [$c7d4]
cp $1
jr z, .asm_40b72
ret
.asm_40b72
push hl
ld de, $ffec
add hl, de
ld de, $d265
ld bc, $8103
call PrintNum
pop hl
ret
Function40b82: ; 40b82 (10:4b82)
call Function40bc4
jr nz, .asm_40b89
inc hl
ret
.asm_40b89
ld a, $4f
ld [hli], a
ret
Function40b8d: ; 40b8d (10:4b8d)
call Function40bd0
ret nz
inc hl
ld de, String_40b9a
call PlaceString
scf
ret
; 40b9a (10:4b9a)
String_40b9a: ; 40b9a
db "-----@"
; 40ba0
Function40ba0: ; 40ba0
hlcoord 18, 1
ld a, $62
ld [hli], a
inc a
ld [hl], a
hlcoord 18, 2
ld a, $64
ld [hli], a
inc a
ld [hl], a
ret
; 40bb1
Function40bb1: ; 40bb1
ld a, [$c7d1]
ld hl, $c7d0
add [hl]
ld e, a
ld d, $0
ld hl, PlayerSDefLevel
add hl, de
ld a, [hl]
ld [$d265], a
ret
; 40bc4
Function40bc4: ; 40bc4 (10:4bc4)
push de
push hl
ld a, [$d265]
dec a
call CheckCaughtMon
pop hl
pop de
ret
Function40bd0: ; 40bd0
push de
push hl
ld a, [$d265]
dec a
call CheckSeenMon
pop hl
pop de
ret
; 40bdc
Function40bdc: ; 40bdc
ld hl, PlayerSDefLevel
ld bc, $100
xor a
call ByteFill
ld a, [$c7d4]
ld hl, Jumptable_40bf0
call Function41432
jp [hl]
; 40bf0
Jumptable_40bf0: ; 40bf0 (10:4bf0)
dw Function40bf6
dw Function40c08
dw Function40c30
Function40bf6: ; 40bf6 (10:4bf6)
ld de, NewPokedexOrder
ld hl, $c6d0
ld c, NUM_POKEMON
.asm_40bfe
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .asm_40bfe
call Function40c18
ret
Function40c08: ; 40c08 (10:4c08)
ld hl, $c6d0
ld a, $1
ld c, NUM_POKEMON
.asm_40c0f
ld [hli], a
inc a
dec c
jr nz, .asm_40c0f
call Function40c18
ret
Function40c18: ; 40c18 (10:4c18)
ld hl, $c7ca
ld d, NUM_POKEMON
ld e, d
.asm_40c1e
ld a, [hld]
ld [$d265], a
call Function40bd0
jr nz, .asm_40c2b
dec d
dec e
jr nz, .asm_40c1e
.asm_40c2b
ld a, d
ld [$c7d2], a
ret
Function40c30: ; 40c30
xor a
ld [$c7d2], a
ld hl, $c6d0
ld de, AlphabeticalPokedexOrder
ld c, NUM_POKEMON
.asm_40c3c
push bc
ld a, [de]
ld [$d265], a
call Function40bd0
jr z, .asm_40c51
ld a, [$d265]
ld [hli], a
ld a, [$c7d2]
inc a
ld [$c7d2], a
.asm_40c51
inc de
pop bc
dec c
jr nz, .asm_40c3c
ld a, [$c7d2]
ld c, 0
.asm_40c5b
cp NUM_POKEMON
jr z, .asm_40c64
ld [hl], c
inc hl
inc a
jr .asm_40c5b
.asm_40c64
ret
; 40c65
AlphabeticalPokedexOrder: ; 0x40c65
INCLUDE "data/pokedex/order_alpha.asm"
NewPokedexOrder: ; 0x40d60
INCLUDE "data/pokedex/order_new.asm"
Function40e5b: ; 40e5b
xor a
ld [hBGMapMode], a
hlcoord 0, 12
ld bc, $0412
call Function40ad5
ld a, [$c7d8]
ld hl, Unknown_40e7d
call Function41432
ld e, l
ld d, h
hlcoord 1, 14
call PlaceString
ld a, $1
ld [hBGMapMode], a
ret
; 40e7d
Unknown_40e7d: ; 40e7d
dw String_40e85
dw String_40ea6
dw String_40ec6
dw String_40ee4
; 40e85
String_40e85: ; 40e85
db $e1, $e2, " are listed by", $4e
db "evolution type.@"
; 40ea6
String_40ea6: ; 40ea6
db $e1, $e2, " are listed by", $4e
db "official type.@"
; 40ec6
String_40ec6: ; 40ec6
db $e1, $e2, " are listed", $4e
db "alphabetically.@"
; 40ee4
String_40ee4: ; 40ee4
db "UNOWN are listed", $4e
db "in catching order.@"
; 40f08
Function40f08: ; 40f08 (10:4f08)
xor a
ld [hBGMapMode], a ; $ff00+$d4
hlcoord 0, 12
ld bc, $412
call Function40ad5
ld de, $4f32
hlcoord 1, 14
call PlaceString
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ld c, $40
call DelayFrames
ld de, SFX_CHANGE_DEX_MODE
call PlaySFX
ld c, $40
call DelayFrames
ret
; 40f32 (10:4f32)
String_40f32: ; 40f32
db "Changing modes.", $4e, "Please wait.@"
; 40f4f
Function40f4f: ; 40f4f (10:4f4f)
ld a, [$c7d8]
cp $2
jr nc, .asm_40f63
ld hl, $ffa9
ld a, [hl]
and $20
jr nz, .asm_40f65
ld a, [hl]
and $10
jr nz, Function40f84
.asm_40f63
and a
ret
.asm_40f65
ld a, [$c7d8]
and a
jr nz, .asm_40f76
ld hl, $c7d5
ld a, [hl]
cp $1
jr z, .asm_40f80
dec [hl]
jr .asm_40f82
.asm_40f76
ld hl, $c7d6
ld a, [hl]
and a
jr z, .asm_40f80
dec [hl]
jr .asm_40f82
.asm_40f80
ld [hl], $11
.asm_40f82
scf
ret
; 40f84
Function40f84: ; 40f84
ld a, [$c7d8]
and a
jr nz, .asm_40f99
ld hl, $c7d5
ld a, [hl]
cp $11
jr nc, .asm_40f95
inc [hl]
jr .asm_40fa6
.asm_40f95
ld [hl], $1
jr .asm_40fa6
.asm_40f99
ld hl, $c7d6
ld a, [hl]
cp $11
jr nc, .asm_40fa4
inc [hl]
jr .asm_40fa6
.asm_40fa4
ld [hl], $0
.asm_40fa6
scf
ret
Function40fa8: ; 40fa8 (10:4fa8)
xor a
ld [hBGMapMode], a ; $ff00+$d4
hlcoord 9, 3
ld bc, $408
ld a, $7f
call Function413fe
ld a, [$c7d5]
hlcoord 9, 4
call Function40fcd
ld a, [$c7d6]
hlcoord 9, 6
call Function40fcd
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
Function40fcd: ; 40fcd (10:4fcd)
push hl
ld e, a
ld d, 0
ld hl, Strings_40fe4
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
ld e, l
ld d, h
pop hl
call PlaceString
ret
; 40fe4 (10:4fe4)
Strings_40fe4: ; 40fe4
db " ---- @"
db " NORMAL @"
db " FIRE @"
db " WATER @"
db " GRASS @"
db "ELECTRIC@"
db " ICE @"
db "FIGHTING@"
db " POISON @"
db " GROUND @"
db " FLYING @"
db "PSYCHIC @"
db " BUG @"
db " ROCK @"
db " GHOST @"
db " DRAGON @"
db " DARK @"
db " STEEL @"
; 41086
Function41086: ; 41086
ld a, [$c7d6]
and a
call nz, Function41095
ld a, [$c7d5]
and a
call nz, Function41095
ret
; 41095
Function41095: ; 41095
dec a
ld e, a
ld d, 0
ld hl, Unknown_410f6
add hl, de
ld a, [hl]
ld [$c7df], a
ld hl, $c6d0
ld de, $c6d0
ld c, NUM_POKEMON
xor a
ld [$c7d7], a
.asm_410ad
push bc
ld a, [hl]
and a
jr z, .asm_410e0
ld [$d265], a
ld [CurSpecies], a
call Function40bc4
jr z, .asm_410e0
push hl
push de
call GetBaseData
pop de
pop hl
ld a, [$c7df]
ld b, a
ld a, [BaseType1]
cp b
jr z, .asm_410d4
ld a, [BaseType2]
cp b
jr nz, .asm_410e0
.asm_410d4
ld a, [$d265]
ld [de], a
inc de
ld a, [$c7d7]
inc a
ld [$c7d7], a
.asm_410e0
inc hl
pop bc
dec c
jr nz, .asm_410ad
ld l, e
ld h, d
ld a, [$c7d7]
ld c, 0
.asm_410ec
cp NUM_POKEMON
jr z, .asm_410f5
ld [hl], c
inc hl
inc a
jr .asm_410ec
.asm_410f5
ret
; 410f6
Unknown_410f6: ; 410f6
db NORMAL
db FIRE
db WATER
db GRASS
db ELECTRIC
db ICE
db FIGHTING
db POISON
db GROUND
db FLYING
db PSYCHIC
db BUG
db ROCK
db GHOST
db DRAGON
db DARK
db STEEL
; 41107
Function41107: ; 41107
xor a
ld [hBGMapMode], a
hlcoord 0, 12
ld bc, $0412
call Function40ad5
ld de, String_41126
hlcoord 1, 14
call PlaceString
ld a, $1
ld [hBGMapMode], a
ld c, $80
call DelayFrames
ret
; 41126
String_41126: ; 41126
db "The specified type", $4e
db "was not found.@"
; 41148
Function41148: ; 41148 (10:5148)
ld a, [$c7d4]
cp $1
jp z, Function41157
call Function41229
call Function4130e
ret
Function41157: ; 41157 (10:5157)
ld hl, Unknown_41167
ld a, [$c7d1]
or a
jr nz, .asm_41163
ld hl, Unknown_411c8
.asm_41163
call Function412f1
ret
; 41167 (10:5167)
Unknown_41167: ; 41167
; OAM
db $18, $47, $30, $07
db $10, $47, $31, $07
db $10, $4f, $32, $07
db $10, $57, $32, $07
db $10, $5f, $32, $07
db $10, $67, $33, $07
db $10, $7e, $33, $27
db $10, $86, $32, $27
db $10, $8e, $32, $27
db $10, $96, $32, $27
db $10, $9e, $31, $27
db $18, $9e, $30, $27
db $20, $47, $30, $47
db $28, $47, $31, $47
db $28, $4f, $32, $47
db $28, $57, $32, $47
db $28, $5f, $32, $47
db $28, $67, $33, $47
db $28, $7e, $33, $67
db $28, $86, $32, $67
db $28, $8e, $32, $67
db $28, $96, $32, $67
db $28, $9e, $31, $67
db $20, $9e, $30, $67
db $ff
; 411c8
Unknown_411c8: ; 411c8
; OAM
db $18, $47, $30, $07
db $10, $47, $34, $07
db $10, $4f, $35, $07
db $10, $57, $35, $07
db $10, $5f, $35, $07
db $10, $67, $36, $07
db $10, $7e, $36, $27
db $10, $86, $35, $27
db $10, $8e, $35, $27
db $10, $96, $35, $27
db $10, $9e, $34, $27
db $18, $9e, $30, $27
db $20, $47, $30, $47
db $28, $47, $31, $47
db $28, $4f, $32, $47
db $28, $57, $32, $47
db $28, $5f, $32, $47
db $28, $67, $33, $47
db $28, $7e, $33, $67
db $28, $86, $32, $67
db $28, $8e, $32, $67
db $28, $96, $32, $67
db $28, $9e, $31, $67
db $20, $9e, $30, $67
db $ff
; 41229
Function41229: ; 41229 (10:5229)
ld hl, Unknown_41230
call Function412f1
ret
; 41230 (10:5230)
Unknown_41230: ; 41230
; OAM
db $1b, $47, $30, $07
db $13, $47, $31, $07
db $13, $4f, $32, $07
db $13, $57, $32, $07
db $13, $5f, $33, $07
db $13, $80, $33, $27
db $13, $88, $32, $27
db $13, $90, $32, $27
db $13, $98, $31, $27
db $1b, $98, $30, $27
db $23, $47, $30, $47
db $2b, $47, $31, $47
db $2b, $4f, $32, $47
db $2b, $57, $32, $47
db $2b, $5f, $33, $47
db $2b, $80, $33, $67
db $2b, $88, $32, $67
db $2b, $90, $32, $67
db $2b, $98, $31, $67
db $23, $98, $30, $67
db $ff
; 41281
Function41281: ; 41281 (10:5281)
ld a, [$c7d4]
cp $1
jp z, Function41157
ld hl, Unknown_41290
call Function412f1
ret
; 41290 (10:5290)
Unknown_41290: ; 41290
; OAM
db $1b, $47, $30, $07
db $13, $47, $31, $07
db $13, $4f, $32, $07
db $13, $57, $32, $07
db $13, $5f, $32, $07
db $13, $67, $33, $07
db $13, $7e, $33, $27
db $13, $86, $32, $27
db $13, $8e, $32, $27
db $13, $96, $32, $27
db $13, $9e, $31, $27
db $1b, $9e, $30, $27
db $23, $47, $30, $47
db $2b, $47, $31, $47
db $2b, $4f, $32, $47
db $2b, $57, $32, $47
db $2b, $5f, $32, $47
db $2b, $67, $33, $47
db $2b, $7e, $33, $67
db $2b, $86, $32, $67
db $2b, $8e, $32, $67
db $2b, $96, $32, $67
db $2b, $9e, $31, $67
db $23, $9e, $30, $67
db $ff
; 412f1
Function412f1: ; 412f1 (10:52f1)
ld de, Sprites ; $c400
.asm_412f4
ld a, [hl]
cp $ff
ret z
ld a, [$c7d1]
and $7
swap a
add [hl]
inc hl
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
jr .asm_412f4
Function4130e: ; 4130e (10:530e)
push de
ld a, [$c7d2]
dec a
ld e, a
ld a, [$c7d1]
ld hl, $c7d0
add [hl]
cp e
jr z, .asm_4133f
ld hl, $0
ld bc, $79
call AddNTimes
ld e, l
ld d, h
ld b, $0
ld a, d
or e
jr z, .asm_41341
ld a, [$c7d2]
ld c, a
.asm_41333
ld a, e
sub c
ld e, a
ld a, d
sbc $0
ld d, a
jr c, .asm_41341
inc b
jr .asm_41333
.asm_4133f
ld b, $79
.asm_41341
ld a, $14
add b
pop hl
ld [hli], a
ld a, $a1
ld [hli], a
ld a, $f
ld [hli], a
ld [hl], $0
ret
Function4134f: ; 4134f (10:534f)
xor a
ld [$c7d8], a
ld [$c7d9], a
ld [$c7da], a
ret
Function4135a: ; 4135a (10:535a)
ld a, [de]
ld b, a
inc de
ld a, [de]
dec a
ld c, a
inc de
call Function413e0
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and D_LEFT | D_UP
and b
jr nz, .asm_4138f
ld a, [hl]
and D_RIGHT | D_DOWN
and b
jr nz, .asm_413a0
ld a, [hl]
and SELECT
and b
jr nz, .asm_413c1
call Function413f5
jr c, .asm_413bf
ld hl, $ffa9
ld a, [hl]
and D_LEFT | D_UP
and b
jr nz, .asm_4138f
ld a, [hl]
and D_RIGHT | D_DOWN
and b
jr nz, .asm_413a0
jr .asm_413bf
.asm_4138f
ld a, [$c7d8]
and a
jr z, .asm_413bf
call Function413d4
ld [hl], $7f
ld hl, $c7d8
dec [hl]
jr .asm_413af
.asm_413a0
ld a, [$c7d8]
cp c
jr nc, .asm_413bf
call Function413d4
ld [hl], $7f
ld hl, $c7d8
inc [hl]
.asm_413af
call Function413d4
ld [hl], $ed
ld a, $c
ld [$c7d9], a
xor a
ld [$c7da], a
scf
ret
.asm_413bf
and a
ret
.asm_413c1
call Function413d4
ld [hl], $7f
ld a, [$c7d8]
cp c
jr c, .asm_413ce
ld a, $ff
.asm_413ce
inc a
ld [$c7d8], a
jr .asm_413af
Function413d4: ; 413d4 (10:53d4)
ld a, [$c7d8]
add a
ld l, a
ld h, $0
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
Function413e0: ; 413e0 (10:53e0)
ld hl, $c7da
ld a, [hl]
inc [hl]
and $8
jr z, .asm_413ef
call Function413d4
ld [hl], $7f
ret
.asm_413ef
call Function413d4
ld [hl], $ed
ret
Function413f5: ; 413f5 (10:53f5)
ld hl, $c7d9
ld a, [hl]
and a
ret z
dec [hl]
scf
ret
Function413fe: ; 413fe (10:53fe)
jp Functionfb8
Function41401: ; 41401 (10:5401)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unkn1Pals ; $d000
ld bc, $40
xor a
call ByteFill
pop af
ld [rSVBK], a ; $ff00+$70
Function41415: ; 41415
ld a, $ff
call DmgToCgbBGPals
ld a, $ff
call Functioncf8
call DelayFrame
ret
Function41423: ; 41423
ld b, a
call GetSGBLayout
Function41427: ; 41427
ld a, $e4
call DmgToCgbBGPals
ld a, $e0
call Functioncf8
ret
; 41432
Function41432: ; 41432
ld e, a
ld d, 0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
; 4143b
Function4143b: ; 4143b
call Function40bb1
call Function40bd0
jr z, .asm_4145b
ld a, [$def4]
ld [UnownLetter], a
ld a, [$d265]
ld [CurPartySpecies], a
call GetBaseData
ld de, VTiles2
predef GetFrontpic
ret
.asm_4145b
ld a, $0
call GetSRAMBank
callba Function1de0d7
ld hl, VTiles2
ld de, $a000
ld c, $31
ld a, [hROMBank]
ld b, a
call Get2bpp
call CloseSRAM
ret
; 41478
Function41478: ; 41478 (10:5478)
call Function40bb1
Function4147b: ; 4147b
ld a, [$d265]
dec a
and $f8
srl a
srl a
srl a
ld e, 0
ld d, a
ld a, [$d265]
dec a
and 7
swap a ; * $10
ld l, a
ld h, 0
add hl, de
ld de, Footprints
add hl, de
push hl
ld e, l
ld d, h
ld hl, $9620
lb bc, BANK(Footprints), 2
call Request1bpp
pop hl
; Whoever was editing footprints forgot to fix their
; tile editor. Now each bottom half is 8 tiles off.
ld de, $80
add hl, de
ld e, l
ld d, h
ld hl, $9640
lb bc, BANK(Footprints), 2
call Request1bpp
ret
; 414b7
Function414b7: ; 414b7
call DisableLCD
ld hl, VTiles2
ld bc, $0310
xor a
call ByteFill
call Function414fb
call Functione5f
ld hl, $9600
ld bc, $0200
call Function41504
call Function41a24
jr nz, .asm_414e0
callba Function1ddf1c
jr .asm_414e9
.asm_414e0
ld hl, PokedexLZ
ld de, $9310
call Decompress
.asm_414e9
ld hl, PokedexSlowpokeLZ
ld de, VTiles0
call Decompress
ld a, 6
call SkipMusic
call EnableLCD
ret
Function414fb: ; 414fb
call Functione51
ld hl, VTiles1
ld bc, $0800
Function41504: ; 41504
ld a, [hl]
xor $ff
ld [hli], a
dec bc
ld a, b
or c
jr nz, Function41504
ret
; 4150e
PokedexLZ: ; 4150e
INCBIN "baserom.gbc",$4150e,$416b0 - $4150e
; 416b0
PokedexSlowpokeLZ: ; 416b0
INCBIN "baserom.gbc",$416b0,$41a24 - $416b0
Function41a24: ; 41a24
ld a, [hCGB]
or a
ret nz
ld a, [hSGB]
dec a
ret
; 41a2c
Function41a2c: ; 41a2c
ld a, $0
call GetSRAMBank
ld hl, UnownFont
ld de, $a188
ld bc, $0270
ld a, BANK(UnownFont)
call FarCopyBytes
ld hl, $a188
ld bc, $01b0
call Function41504
ld de, $a188
ld hl, $9400
lb bc, $10, $1b
call Request2bpp
call CloseSRAM
ret
; 41a58
Function41a58: ; 41a58 (10:5a58)
ld a, [UnownLetter] ; $d234
push af
ld a, [$c7dd]
ld e, a
ld d, $0
ld hl, EndPokedexSeen ; $ded9 (aliases: UnownDex)
add hl, de
ld a, [hl]
ld [UnownLetter], a ; $d234
ld a, UNOWN
ld [CurPartySpecies], a ; $d108
call GetBaseData
ld de, $9000
predef GetFrontpic
pop af
ld [UnownLetter], a ; $d234
ret
Function41a7f: ; 41a7f
xor a
ld [hBGMapMode], a
callba Function1de247
call Function41af7
call DisableLCD
call Functione51
call Functione5f
call Function414b7
call Function4147b
ld a, [$d265]
ld [CurPartySpecies], a
call Function407fd
call Function40ba0
hlcoord 0, 17
ld [hl], $3b
inc hl
ld bc, $0013
ld a, $7f
call ByteFill
callba Function4424d
call EnableLCD
call WaitBGMap
call GetBaseData
ld de, VTiles2
predef GetFrontpic
ld a, $4
call Function41423
ld a, [CurPartySpecies]
call PlayCry
ret
; 41ad7
Function41ad7: ; 41ad7 (10:5ad7)
ld a, $3
ld [hBGMapMode], a ; $ff00+$d4
ld c, $4
call DelayFrames
ret
Function41ae1: ; 41ae1 (10:5ae1)
ld a, $4
ld [hBGMapMode], a ; $ff00+$d4
ld c, $4
call DelayFrames
ret
Function41aeb: ; 41aeb (10:5aeb)
ld a, [hCGB] ; $ff00+$e6
and a
jr z, .asm_41af3
call Function41ae1
.asm_41af3
call Function41ad7
ret
Function41af7: ; 41af7
xor a
ld [hBGMapMode], a
ret
; 41afb
INCLUDE "battle/moves/moves.asm"
Function421d8: ; 421d8
ld hl, EvolvableFlags
xor a
ld [hl], a
ld a, [CurPartyMon]
ld c, a
ld b, $1
call Function42577
Function421e6: ; 421e6
xor a
ld [$d268], a
dec a
ld [CurPartyMon], a
push hl
push bc
push de
ld hl, PartyCount
push hl
Function421f5: ; 421f5
ld hl, CurPartyMon
inc [hl]
pop hl
inc hl
ld a, [hl]
cp $ff
jp z, Function423ff
ld [Buffer1], a
push hl
ld a, [CurPartyMon]
ld c, a
ld hl, EvolvableFlags
ld b, 2
call Function42577
ld a, c
and a
jp z, Function421f5
ld a, [Buffer1]
dec a
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
push hl
xor a
ld [MonType], a
predef Function5084a
pop hl
.asm_42230
ld a, [hli]
and a
jr z, Function421f5
ld b, a
cp EVOLVE_TRADE
jr z, .trade
ld a, [InLinkBattle]
and a
jp nz, .asm_423f9
ld a, b
cp EVOLVE_ITEM
jp z, .item
ld a, [$d1e9]
and a
jp nz, .asm_423f9
ld a, b
cp EVOLVE_LEVEL
jp z, .level
cp EVOLVE_HAPPINESS
jr z, .happiness
; EVOLVE_STAT
ld a, [TempMonLevel]
cp [hl]
jp c, .asm_423f8
call Function42461
jp z, .asm_423f8
push hl
ld de, TempMonAttack
ld hl, TempMonDefense
ld c, 2
call StringCmp
ld a, ATK_EQ_DEF
jr z, .asm_4227a
ld a, ATK_LT_DEF
jr c, .asm_4227a
ld a, ATK_GT_DEF
.asm_4227a
pop hl
inc hl
cp [hl]
jp nz, .asm_423f9
inc hl
jr .asm_422fd
.happiness
ld a, [TempMonHappiness]
cp 220
jp c, .asm_423f9
call Function42461
jp z, .asm_423f9
ld a, [hli]
cp TR_ANYTIME
jr z, .asm_422fd
cp TR_MORNDAY
jr z, .asm_422a4
; TR_NITE
ld a, [TimeOfDay]
cp NITE
jp nz, .asm_423fa
jr .asm_422fd
.asm_422a4
ld a, [TimeOfDay]
cp NITE
jp z, .asm_423fa
jr .asm_422fd
.trade
ld a, [InLinkBattle]
and a
jp z, .asm_423f9
call Function42461
jp z, .asm_423f9
ld a, [hli]
ld b, a
inc a
jr z, .asm_422fd
ld a, [InLinkBattle]
cp $1
jp z, .asm_423fa
ld a, [TempMonItem]
cp b
jp nz, .asm_423fa
xor a
ld [TempMonItem], a
jr .asm_422fd
.item
ld a, [hli]
ld b, a
ld a, [CurItem]
cp b
jp nz, .asm_423fa
ld a, [$d1e9]
and a
jp z, .asm_423fa
ld a, [InLinkBattle]
and a
jp nz, .asm_423fa
jr .asm_422fd
.level
ld a, [hli]
ld b, a
ld a, [TempMonLevel]
cp b
jp c, .asm_423fa
call Function42461
jp z, .asm_423fa
.asm_422fd
ld a, [TempMonLevel]
ld [CurPartyLevel], a
ld a, $1
ld [$d268], a
push hl
ld a, [hl]
ld [Buffer2], a
ld a, [CurPartyMon]
ld hl, PartyMonNicknames
call GetNick
call CopyName1
ld hl, UnknownText_0x42482
call PrintText
ld c, 50
call DelayFrames
xor a
ld [hBGMapMode], a
ld hl, TileMap
lb bc, 12, 20
call ClearBox
ld a, $1
ld [hBGMapMode], a
call ClearSprites
callba EvolutionAnimation
push af
call ClearSprites
pop af
jp c, Function42454
ld hl, UnknownText_0x42473
call PrintText
pop hl
ld a, [hl]
ld [CurSpecies], a
ld [TempMonSpecies], a
ld [Buffer2], a
ld [$d265], a
call GetPokemonName
push hl
ld hl, UnknownText_0x42478
call PrintTextBoxText
callba Function106094
ld de, MUSIC_NONE
call PlayMusic
ld de, SFX_CAUGHT_MON
call PlaySFX
call WaitSFX
ld c, 40
call DelayFrames
call ClearTileMap
call Function42414
call GetBaseData
ld hl, $d118
ld de, TempMonMaxHP
ld b, $1
predef Functione167
ld a, [CurPartyMon]
ld hl, PartyMons
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld e, l
ld d, h
ld bc, $0024
add hl, bc
ld a, [hli]
ld b, a
ld c, [hl]
ld hl, $d133
ld a, [hld]
sub c
ld c, a
ld a, [hl]
sbc b
ld b, a
ld hl, $d131
ld a, [hl]
add c
ld [hld], a
ld a, [hl]
adc b
ld [hl], a
ld hl, TempMonSpecies
ld bc, PartyMon2 - PartyMon1
call CopyBytes
ld a, [CurSpecies]
ld [$d265], a
xor a
ld [MonType], a
call LearnLevelMoves
ld a, [$d265]
dec a
call SetSeenAndCaughtMon
ld a, [$d265]
cp UNOWN
jr nz, .asm_423ec
ld hl, TempMonDVs
predef GetUnownLetter
callab Functionfba18
.asm_423ec
pop de
pop hl
ld a, [TempMonSpecies]
ld [hl], a
push hl
ld l, e
ld h, d
jp Function421f5
; 423f8
.asm_423f8
inc hl
.asm_423f9
inc hl
.asm_423fa
inc hl
jp .asm_42230
; 423fe
Function423fe: ; 423fe
pop hl
Function423ff: ; 423ff
pop de
pop bc
pop hl
ld a, [InLinkBattle]
and a
ret nz
ld a, [IsInBattle]
and a
ret nz
ld a, [$d268]
and a
call nz, RestartMapMusic
ret
; 42414
Function42414: ; 42414
ld a, [CurSpecies]
push af
ld a, [BaseDexNo]
ld [$d265], a
call GetPokemonName
pop af
ld [CurSpecies], a
ld hl, StringBuffer1
ld de, StringBuffer2
.asm_4242b
ld a, [de]
inc de
cp [hl]
inc hl
ret nz
cp "@"
jr nz, .asm_4242b
ld a, [CurPartyMon]
ld bc, $000b
ld hl, PartyMonNicknames
call AddNTimes
push hl
ld a, [CurSpecies]
ld [$d265], a
call GetPokemonName
ld hl, StringBuffer1
pop de
ld bc, $000b
jp CopyBytes
; 42454
Function42454: ; 42454
ld hl, UnknownText_0x4247d
call PrintText
call ClearTileMap
pop hl
jp Function421f5
; 42461
Function42461: ; 42461
push hl
ld a, [CurPartyMon]
ld hl, PartyMon1Item
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld a, [hl]
cp EVERSTONE
pop hl
ret
; 42473
UnknownText_0x42473: ; 0x42473
; Congratulations! Your @ @
text_jump UnknownText_0x1c4b92
db "@"
; 0x42478
UnknownText_0x42478: ; 0x42478
; evolved into @ !
text_jump UnknownText_0x1c4baf
db "@"
; 0x4247d
UnknownText_0x4247d: ; 0x4247d
; Huh? @ stopped evolving!
text_jump UnknownText_0x1c4bc5
db "@"
; 0x42482
UnknownText_0x42482: ; 0x42482
; What? @ is evolving!
text_jump UnknownText_0x1c4be3
db "@"
; 0x42487
LearnLevelMoves: ; 42487
ld a, [$d265]
ld [CurPartySpecies], a
dec a
ld b, 0
ld c, a
ld hl, EvosAttacksPointers
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
.skip_evos
ld a, [hli]
and a
jr nz, .skip_evos
.find_move
ld a, [hli]
and a
jr z, .done
ld b, a
ld a, [CurPartyLevel]
cp b
ld a, [hli]
jr nz, .find_move
push hl
ld d, a
ld hl, PartyMon1Moves
ld a, [CurPartyMon]
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld b, NUM_MOVES
.check_move
ld a, [hli]
cp d
jr z, .has_move
dec b
jr nz, .check_move
jr .learn
.has_move
pop hl
jr .find_move
.learn
ld a, d
ld [$d262], a
ld [$d265], a
call GetMoveName
call CopyName1
predef LearnMove
pop hl
jr .find_move
.done
ld a, [CurPartySpecies]
ld [$d265], a
ret
; 424e1
FillMoves: ; 424e1
; Fill in moves at de for CurPartySpecies at CurPartyLevel
push hl
push de
push bc
ld hl, EvosAttacksPointers
ld b, 0
ld a, [CurPartySpecies]
dec a
add a
rl b
ld c, a
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
.GoToAttacks
ld a, [hli]
and a
jr nz, .GoToAttacks
jr .GetLevel
.NextMove
pop de
.GetMove
inc hl
.GetLevel
ld a, [hli]
and a
jp z, .done
ld b, a
ld a, [CurPartyLevel]
cp b
jp c, .done
ld a, [Buffer1]
and a
jr z, .CheckMove
ld a, [DefaultFlypoint]
cp b
jr nc, .GetMove
.CheckMove
push de
ld c, NUM_MOVES
.CheckRepeat
ld a, [de]
inc de
cp [hl]
jr z, .NextMove
dec c
jr nz, .CheckRepeat
pop de
push de
ld c, NUM_MOVES
.CheckSlot
ld a, [de]
and a
jr z, .LearnMove
inc de
dec c
jr nz, .CheckSlot
pop de
push de
push hl
ld h, d
ld l, e
call ShiftMoves
ld a, [Buffer1]
and a
jr z, .ShiftedMove
push de
ld bc, PartyMon1PP - (PartyMon1Moves + NUM_MOVES - 1)
add hl, bc
ld d, h
ld e, l
call ShiftMoves
pop de
.ShiftedMove
pop hl
.LearnMove
ld a, [hl]
ld [de], a
ld a, [Buffer1]
and a
jr z, .NextMove
push hl
ld a, [hl]
ld hl, PartyMon1PP - PartyMon1Moves
add hl, de
push hl
dec a
ld hl, Moves + MOVE_PP
ld bc, MOVE_LENGTH
call AddNTimes
ld a, BANK(Moves)
call GetFarByte
pop hl
ld [hl], a
pop hl
jr .NextMove
.done
pop bc
pop de
pop hl
ret
; 4256e
ShiftMoves: ; 4256e
ld c, NUM_MOVES - 1
.asm_42570
inc de
ld a, [de]
ld [hli], a
dec c
jr nz, .asm_42570
ret
; 42577
Function42577: ; 42577
push de
ld d, $0
predef FlagPredef
pop de
ret
; 42581
GetPreEvolution: ; 42581
; Find the first mon to evolve into CurPartySpecies.
; Return carry and the new species in CurPartySpecies
; if a pre-evolution is found.
ld c, 0
.asm_42583
ld hl, EvosAttacksPointers
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
.asm_4258d
ld a, [hli]
and a
jr z, .asm_425a2
cp EVOLVE_STAT
jr nz, .asm_42596
inc hl
.asm_42596
inc hl
ld a, [CurPartySpecies]
cp [hl]
jr z, .asm_425aa
inc hl
ld a, [hl]
and a
jr nz, .asm_4258d
.asm_425a2
inc c
ld a, c
cp NUM_POKEMON
jr c, .asm_42583
and a
ret
.asm_425aa
inc c
ld a, c
ld [CurPartySpecies], a
scf
ret
; 425b1
SECTION "bank11", ROMX, BANK[$11]
INCLUDE "engine/fruit_trees.asm"
AIChooseMove: ; 440ce
; Score each move in EnemyMonMoves starting from Buffer1. Lower is better.
; Pick the move with the lowest score.
; Wildmons attack at random.
ld a, [IsInBattle]
dec a
ret z
ld a, [InLinkBattle]
and a
ret nz
; No use picking a move if there's no choice.
callba Function3e8d1
ret nz
; The default score is 20. Unusable moves are given a score of 80.
ld a, 20
ld hl, Buffer1
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
; Don't pick disabled moves.
ld a, [EnemyDisabledMove]
and a
jr z, .CheckPP
ld hl, EnemyMonMoves
ld c, 0
.CheckDisabledMove
cp [hl]
jr z, .ScoreDisabledMove
inc c
inc hl
jr .CheckDisabledMove
.ScoreDisabledMove
ld hl, Buffer1
ld b, 0
add hl, bc
ld [hl], 80
; Don't pick moves with 0 PP.
.CheckPP
ld hl, Buffer1 - 1
ld de, EnemyMonPP
ld b, 0
.CheckMovePP
inc b
ld a, b
cp EnemyMonMovesEnd - EnemyMonMoves + 1
jr z, .ApplyLayers
inc hl
ld a, [de]
inc de
and $3f
jr nz, .CheckMovePP
ld [hl], 80
jr .CheckMovePP
; Apply AI scoring layers depending on the trainer class.
.ApplyLayers
ld hl, TrainerClassAttributes + 3
ld a, [$cfc0]
bit 0, a
jr nz, .asm_4412f
ld a, [TrainerClass]
dec a
ld bc, 7 ; Trainer2AI - Trainer1AI
call AddNTimes
.asm_4412f
lb bc, CHECK_FLAG, 0
push bc
push hl
.CheckLayer
pop hl
pop bc
ld a, c
cp 16 ; up to 16 scoring layers
jr z, .DecrementScores
push bc
ld d, BANK(TrainerClassAttributes)
predef FlagPredef
ld d, c
pop bc
inc c
push bc
push hl
ld a, d
and a
jr z, .CheckLayer
ld hl, AIScoringPointers
dec c
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, BANK(AIScoring)
call FarCall_hl
jr .CheckLayer
; Decrement the scores of all moves one by one until one reaches 0.
.DecrementScores
ld hl, Buffer1
ld de, EnemyMonMoves
ld c, EnemyMonMovesEnd - EnemyMonMoves
.DecrementNextScore
; If the enemy has no moves, this will infinite.
ld a, [de]
inc de
and a
jr z, .DecrementScores
; We are done whenever a score reaches 0
dec [hl]
jr z, .PickLowestScoreMoves
; If we just decremented the fourth move's score, go back to the first move
inc hl
dec c
jr z, .DecrementScores
jr .DecrementNextScore
; In order to avoid bias towards the moves located first in memory, increment the scores
; that were decremented one more time than the rest (in case there was a tie).
; This means that the minimum score will be 1.
.PickLowestScoreMoves
ld a, c
.asm_44175
inc [hl]
dec hl
inc a
cp NUM_MOVES + 1
jr nz, .asm_44175
ld hl, Buffer1
ld de, EnemyMonMoves
ld c, NUM_MOVES
; Give a score of 0 to a blank move
.asm_44184
ld a, [de]
and a
jr nz, .asm_44189
ld [hl], a
; Disregard the move if its score is not 1
.asm_44189
ld a, [hl]
dec a
jr z, .asm_44191
xor a
ld [hli], a
jr .asm_44193
.asm_44191
ld a, [de]
ld [hli], a
.asm_44193
inc de
dec c
jr nz, .asm_44184
; Randomly choose one of the moves with a score of 1
.ChooseMove
ld hl, Buffer1
call Random
and 3
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
and a
jr z, .ChooseMove
ld [CurEnemyMove], a
ld a, c
ld [CurEnemyMoveNum], a
ret
; 441af
AIScoringPointers: ; 441af
dw AI_Basic
dw AI_Setup
dw AI_Types
dw AI_Offensive
dw AI_Smart
dw AI_Opportunist
dw AI_Aggressive
dw AI_Cautious
dw AI_Status
dw AI_Risky
dw AI_None
dw AI_None
dw AI_None
dw AI_None
dw AI_None
dw AI_None
; 441cf
Function441cf: ; 441cf
ld hl, Unknown_441fc
ld b, 25
.loop
ld a, [hli]
; Wrap around
cp $fe
jr nz, .ok
ld hl, Unknown_441fc
ld a, [hli]
.ok
ld [$c7db], a
ld a, [hli]
ld c, a
push bc
push hl
call Function44207
pop hl
pop bc
call DelayFrames
dec b
jr nz, .loop
xor a
ld [$c7db], a
call Function44207
ld c, $20
call DelayFrames
ret
; 441fc
Unknown_441fc: ; 441fc
db 0, 7
db 1, 7
db 2, 7
db 3, 7
db 4, 7
db $fe
; 44207
Function44207: ; 44207
ld a, [$c7db]
ld hl, Unknown_44228
ld de, Sprites
.asm_44210
ld a, [hli]
cp $ff
ret z
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [$c7db]
ld b, a
add a
add b
add [hl]
inc hl
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
jr .asm_44210
; 44228
Unknown_44228: ; 44228
db $58, $48, $00, $00
db $58, $50, $01, $00
db $58, $58, $02, $00
db $60, $48, $10, $00
db $60, $50, $11, $00
db $60, $58, $12, $00
db $68, $48, $20, $00
db $68, $50, $21, $00
db $68, $58, $22, $00
db $ff
; 4424d
Function4424d: ; 4424d
call GetPokemonName
hlcoord 9, 3
call PlaceString
ld a, [$d265]
ld b, a
call Function44333
ld a, b
push af
hlcoord 9, 5
call FarString
ld h, b
ld l, c
push de
hlcoord 2, 8
ld a, $5c
ld [hli], a
ld a, $5d
ld [hli], a
ld de, $d265
ld bc, $8103
call PrintNum
ld a, [$d265]
dec a
call CheckCaughtMon
pop hl
pop bc
ret z
ld a, [CurPartySpecies]
ld [CurSpecies], a
inc hl
ld a, b
push af
push hl
call GetFarHalfword
ld d, l
ld e, h
pop hl
inc hl
inc hl
ld a, d
or e
jr z, .asm_442b0
push hl
push de
ld hl, [sp+$0]
ld d, h
ld e, l
hlcoord 12, 7
ld bc, $0224
call PrintNum
hlcoord 14, 7
ld [hl], $5e
pop af
pop hl
.asm_442b0
pop af
push af
inc hl
push hl
dec hl
call GetFarHalfword
ld d, l
ld e, h
ld a, e
or d
jr z, .asm_442cd
push de
ld hl, [sp+$0]
ld d, h
ld e, l
hlcoord 11, 9
ld bc, ClearVRAM
call PrintNum
pop de
.asm_442cd
ld bc, $0512
hlcoord 2, 11
call ClearBox
hlcoord 1, 10
ld bc, $0013
ld a, $61
call ByteFill
hlcoord 1, 9
ld [hl], $55
inc hl
ld [hl], $55
hlcoord 1, 10
ld [hl], $56
inc hl
ld [hl], $57
pop de
inc de
pop af
hlcoord 2, 11
push af
call FarString
pop bc
ld a, [$cf65]
or a
ret z
push bc
push de
ld bc, $0512
hlcoord 2, 11
call ClearBox
hlcoord 1, 10
ld bc, $0013
ld a, $61
call ByteFill
hlcoord 1, 9
ld [hl], $55
inc hl
ld [hl], $55
hlcoord 1, 10
ld [hl], $56
inc hl
ld [hl], $58
pop de
inc de
pop af
hlcoord 2, 11
call FarString
ret
; 44331
String_44331: ; 44331
db "#@"
; 44333
Function44333: ; 44333
push hl
ld hl, PokedexDataPointerTable
ld a, b
dec a
ld d, 0
ld e, a
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
push de
rlca
rlca
and $3
ld hl, PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld b, [hl]
pop de
pop hl
ret
; 44351
PokedexEntryBanks: ; 44351
GLOBAL PokedexEntries1
GLOBAL PokedexEntries2
GLOBAL PokedexEntries3
GLOBAL PokedexEntries4
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
; 44355
Function44355: ; 44355
call Function44333
push hl
ld h, d
ld l, e
.asm_4435b
ld a, b
call GetFarByte
inc hl
cp $50
jr nz, .asm_4435b
inc hl
inc hl
inc hl
inc hl
dec c
jr z, .asm_44374
.asm_4436b
ld a, b
call GetFarByte
inc hl
cp $50
jr nz, .asm_4436b
.asm_44374
ld d, h
ld e, l
pop hl
ret
; 44378
PokedexDataPointerTable: ; 0x44378
INCLUDE "data/pokedex/entry_pointers.asm"
Function4456e: ; 4456e
ld a, $1
call GetPartyParamLocation
ld d, [hl]
callba ItemIsMail
jr nc, .asm_445be
call Function44648
cp $a
jr nc, .asm_445be
ld bc, $002f
ld hl, $a835
call AddNTimes
ld d, h
ld e, l
ld a, [CurPartyMon]
ld bc, $002f
ld hl, $a600
call AddNTimes
push hl
ld a, $0
call GetSRAMBank
ld bc, $002f
call CopyBytes
pop hl
xor a
ld bc, $002f
call ByteFill
ld a, $1
call GetPartyParamLocation
ld [hl], $0
ld hl, $a834
inc [hl]
call CloseSRAM
xor a
ret
.asm_445be
scf
ret
; 445c0
Function445c0: ; 445c0 (11:45c0)
ld a, $0
call GetSRAMBank
ld a, b
push bc
ld hl, $a835
ld bc, $2f
call AddNTimes
push hl
add hl, bc
pop de
pop bc
.asm_445d4
ld a, b
cp $9
jr z, .asm_445e4
push bc
ld bc, $2f
call CopyBytes
pop bc
inc b
jr .asm_445d4
.asm_445e4
ld h, d
ld l, e
xor a
ld bc, $2f
call ByteFill
ld hl, $a834
dec [hl]
jp CloseSRAM
; 445f4 (11:45f4)
Function445f4: ; 445f4
ld a, b
ld hl, $a835
ld bc, $2f
call AddNTimes
ld d, h
ld e, l
callba Functionb9237
ret
Function44607: ; 44607
ld a, $0
call GetSRAMBank
push bc
ld a, b
ld bc, $2f
ld hl, $a835
call AddNTimes
push hl
ld a, [CurPartyMon] ; $d109
ld bc, $2f
ld hl, $a600
call AddNTimes
ld d, h
ld e, l
pop hl
push hl
ld bc, $2f
call CopyBytes
pop hl
ld de, $2e
add hl, de
ld d, [hl]
ld a, [CurPartyMon] ; $d109
ld hl, PartyMon1Item ; $dce0
ld bc, $30
call AddNTimes
ld [hl], d
call CloseSRAM
pop bc
jp Function445c0
; 44648 (11:4648)
Function44648: ; 44648
ld a, $0
call GetSRAMBank
ld a, [$a834]
ld c, a
jp CloseSRAM
; 44654
Function44654:: ; 44654
push bc
push de
callba Function50000
ld a, $2
jr c, .asm_446c6
ld a, [CurPartyMon]
ld hl, PartyMon1Item
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld d, [hl]
callba ItemIsMail
ld a, $3
jr nc, .asm_446c6
ld a, $0
call GetSRAMBank
ld a, [CurPartyMon]
ld hl, $a600
ld bc, $002f
call AddNTimes
ld d, h
ld e, l
pop hl
pop bc
ld a, $20
ld [$d265], a
.asm_44691
ld a, [de]
ld c, a
ld a, b
call GetFarByte
cp $50
jr z, .asm_446ab
cp c
ld a, $0
jr nz, .asm_446c1
inc hl
inc de
ld a, [$d265]
dec a
ld [$d265], a
jr nz, .asm_44691
.asm_446ab
callba Functione538
ld a, $4
jr c, .asm_446c1
xor a
ld [$d10b], a
callba Functione039
ld a, $1
.asm_446c1
call CloseSRAM
jr .asm_446c8
.asm_446c6
pop de
pop bc
.asm_446c8
ld [ScriptVar], a
ret
; 446cc
Function446cc:: ; 446cc
ld a, [PartyCount]
dec a
push af
push bc
ld hl, PartyMon1Item
ld bc, PartyMon2 - PartyMon1
call AddNTimes
pop bc
ld [hl], b
pop af
push bc
push af
ld hl, $a600
ld bc, $002f
call AddNTimes
ld d, h
ld e, l
ld hl, $d002
ld bc, $0021
ld a, $0
call GetSRAMBank
call CopyBytes
pop af
push af
ld hl, PartyMonOT
ld bc, $000b
call AddNTimes
ld bc, $000a
call CopyBytes
pop af
ld hl, PartyMon1ID
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
ld a, [CurPartySpecies]
ld [de], a
inc de
pop bc
ld a, b
ld [de], a
jp CloseSRAM
; 44725
Function44725: ; 44725
ld a, $0
call GetSRAMBank
ld hl, $a600
ld de, $a71a
ld bc, $011a
call CopyBytes
ld hl, $a834
ld de, $aa0b
ld bc, $01d7
call CopyBytes
jp CloseSRAM
; 44745
Function44745: ; 44745 (11:4745)
ld a, $0
call GetSRAMBank
ld hl, $a71a
ld de, $a600
ld bc, $11a
call CopyBytes
ld hl, $aa0b
ld de, $a834
ld bc, $1d7
call CopyBytes
jp CloseSRAM
Function44765: ; 44765 (11:4765)
ld a, $0
call GetSRAMBank
xor a
ld hl, $a600
ld bc, $11a
call ByteFill
xor a
ld hl, $a834
ld bc, $1d7
call ByteFill
jp CloseSRAM
; 44781 (11:4781)
Function44781: ; 44781
ld a, [PartyCount]
and a
jr z, .asm_4479e
ld e, a
ld hl, PartyMon1Item
.asm_4478b
ld d, [hl]
push hl
push de
callba ItemIsMail
pop de
pop hl
ret c
ld bc, PartyMon2 - PartyMon1
add hl, bc
dec e
jr nz, .asm_4478b
.asm_4479e
and a
ret
; 447a0
_KrisMailBoxMenu: ; 0x447a0
call InitMail
jr z, .nomail
call Function1d6e
call Function44806
jp Function1c17
.nomail
ld hl, .EmptyMailboxText
jp Function1d67
; 0x447b4
.EmptyMailboxText ; 0x447b4
TX_FAR _EmptyMailboxText
db "@"
InitMail: ; 0x447b9
; initialize $d0f2 and beyond with incrementing values, one per mail
; set z if no mail
ld a, $0
call GetSRAMBank
ld a, [$a834]
call CloseSRAM
ld hl, $d0f2
ld [hli], a
and a
jr z, .done ; if no mail, we're done
; load values in memory with incrementing values starting at $d0f2
ld b, a
ld a, $1
.loop
ld [hli], a
inc a
dec b
jr nz, .loop
.done
ld [hl], $ff ; terminate
ld a, [$d0f2]
and a
ret
; 0x447da
Function447da: ; 0x447da
dec a
ld hl, $a856
ld bc, $002f
call AddNTimes
ld a, $0
call GetSRAMBank
ld de, StringBuffer2
push de
ld bc, $a
call CopyBytes
ld a, $50
ld [de], a
call CloseSRAM
pop de
ret
; 0x447fb
Function447fb: ; 0x447fb
push de
ld a, [MenuSelection]
call Function447da
pop hl
jp PlaceString
; 0x44806
Function44806: ; 0x44806
xor a
ld [$d0f0], a
ld a, $1
ld [$d0f1], a
.asm_4480f
call InitMail
ld hl, MenuData4494c
call Function1d3c
xor a
ld [hBGMapMode], a
call Function352f
call Function1ad2
ld a, [$d0f1]
ld [$cf88], a
ld a, [$d0f0]
ld [$d0e4], a
call Function350c
ld a, [$d0e4]
ld [$d0f0], a
ld a, [$cfa9]
ld [$d0f1], a
ld a, [$cf73]
cp $2
jr z, .asm_44848
call Function4484a
jr .asm_4480f
.asm_44848
xor a
ret
; 0x4484a
Function4484a: ; 0x4484a
ld hl, MenuData44964
call LoadMenuDataHeader
call Function1d81
call Function1c07
jr c, .asm_44860
ld a, [$cfa9]
dec a
ld hl, .JumpTable
rst JumpTable
.asm_44860
ret
; 0x44861
.JumpTable
dw .ReadMail
dw .PutInPack
dw .AttachMail
dw .Cancel
.ReadMail ; 0x44869
call FadeToMenu
ld a, [MenuSelection]
dec a
ld b, a
call Function445f4
jp Function2b3c
; 0x44877
.PutInPack ; 0x44877
ld hl, .MessageLostText
call Function1d4f
call YesNoBox
call Function1c07
ret c
ld a, [MenuSelection]
dec a
call .Function448bb
ld a, $1
ld [$d10c], a
ld hl, NumItems
call ReceiveItem
jr c, .asm_4489e
ld hl, .PackFullText
jp Function1d67
.asm_4489e
ld a, [MenuSelection]
dec a
ld b, a
call Function445c0
ld hl, .PutAwayText
jp Function1d67
; 0x448ac
.PutAwayText ; 0x448ac
TX_FAR ClearedMailPutAwayText
db "@"
.PackFullText ; 0x448b1
TX_FAR MailPackFullText
db "@"
.MessageLostText ; 0x448b6
TX_FAR MailMessageLostText
db "@"
.Function448bb: ; 0x448bb
push af
ld a, $0
call GetSRAMBank
pop af
ld hl, $a863
ld bc, $002f
call AddNTimes
ld a, [hl]
ld [CurItem], a
jp CloseSRAM
; 0x448d2
.AttachMail ; 0x448d2
call FadeToMenu
xor a
ld [PartyMenuActionText], a
call WhiteBGMap
.asm_448dc
callba Function5004f
callba Function50405
callba Function503e0
callba WritePartyMenuTilemap
callba PrintPartyMenuText
call WaitBGMap
call Function32f9
call DelayFrame
callba PartyMenuSelect
jr c, .asm_44939
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_44923
ld a, PartyMon1Item - PartyMon1
call GetPartyParamLocation
ld a, [hl]
and a
jr z, .asm_4492b
ld hl, .HoldingMailText
call PrintText
jr .asm_448dc
.asm_44923
ld hl, .EggText
call PrintText
jr .asm_448dc
.asm_4492b
ld a, [MenuSelection]
dec a
ld b, a
call Function44607
ld hl, .MailMovedText
call PrintText
.asm_44939
jp Function2b3c
; 0x4493c
.HoldingMailText ; 0x4493c
TX_FAR MailAlreadyHoldingItemText
db "@"
.EggText ; 0x44941
TX_FAR MailEggText
db "@"
.MailMovedText ; 0x44946
TX_FAR MailMovedFromBoxText
db "@"
.Cancel
ret
MenuData4494c: ; 0x4494c
db %01000000 ; flags
db 1, 8 ; start coords
db $a, $12 ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2
db %00010000 ; flags
db 4, 0 ; rows/columns?
db 1 ; horizontal spacing?
dbw 0,$d0f2 ; text pointer
dbw BANK(Function447fb), Function447fb
dbw 0,0
dbw 0,0
MenuData44964: ; 0x44964
db %01000000 ; flags
db 0, 0 ; start coords
db 9, $d ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2
db %10000000 ; flags
db 4 ; items
db "READ MAIL@"
db "PUT IN PACK@"
db "ATTACH MAIL@"
db "CANCEL@"
SECTION "bank12", ROMX, BANK[$12]
Function48000: ; 48000
ld a, $1
ld [$d474], a
xor a
ld [$d473], a
ld [PlayerGender], a
ld [$d475], a
ld [$d476], a
ld [$d477], a
ld [$d478], a
ld [DefaultFlypoint], a
ld [$d003], a
ld a, [$d479]
res 0, a
ld [$d479], a
ld a, [$d479]
res 1, a
ld [$d479], a
ret
; 4802f
Function4802f: ; 4802f (12:402f)
xor a
set 6, a
ld [DefaultFlypoint], a ; $d002
ld hl, $d003
set 0, [hl]
ld a, c
and a
call z, Function48000
call WhiteBGMap
call Function48d3d
ld a, [$d479]
bit 1, a
jr z, .asm_4805a
ld a, [$d003]
set 0, a
set 1, a
set 2, a
set 3, a
ld [$d003], a
.asm_4805a
call Function486bf
call Functione5f
ld de, GFX_488c3
ld hl, $9100
lb bc, BANK(GFX_488c3), 1
call Request1bpp
ld de, GFX_488cb
ld hl, $9110
lb bc, BANK(GFX_488cb), 1
call Request1bpp
call Function4a3a7
call WhiteBGMap
ld a, [DefaultFlypoint] ; $d002
bit 6, a
jr z, .asm_4808a
call Function48689
jr .asm_480d7
.asm_4808a
ld a, $5
ld [MusicFade], a ; $c2a7
ld a, MUSIC_MOBILE_ADAPTER_MENU % $100
ld [MusicFadeIDLo], a ; $c2a9
ld a, MUSIC_MOBILE_ADAPTER_MENU / $100
ld [MusicFadeIDHi], a ; $c2aa
ld c, $14
call DelayFrames
ld b, $1
call Function4930f
call WhiteBGMap
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld b, $2
ld c, $14
call ClearBox
hlcoord 0, 1
ld a, $c
ld [hl], a
ld bc, $13
add hl, bc
ld [hl], a
ld de, MobileProfileString
hlcoord 1, 1
call PlaceString
hlcoord 0, 2
ld b, $a
ld c, $12
call Function48cdc
hlcoord 2, 4
ld de, String_48482
call PlaceString
.asm_480d7
hlcoord 2, 6
ld de, String_48489
call PlaceString
hlcoord 2, 8
ld de, String_4848d
call PlaceString
hlcoord 2, 10
ld de, String_48495
call PlaceString
hlcoord 2, 12
ld de, String_4849e
call PlaceString
ld a, [DefaultFlypoint] ; $d002
bit 6, a
jr nz, .asm_48113
ld a, [PlayerGender] ; $d472
ld hl, Strings_484fb
call GetNthString
ld d, h
ld e, l
hlcoord 11, 4
call PlaceString
.asm_48113
hlcoord 11, 6
call Function487ec
ld a, [$d474]
dec a
ld hl, Prefectures
call GetNthString
ld d, h
ld e, l
hlcoord 11, 8
call PlaceString
hlcoord 11, 10
call Function489ea
hlcoord 0, 14
ld b, $2
ld c, $12
call TextBox
hlcoord 1, 16
ld de, String_48275
call PlaceString
call Function48187
call Function3200
call Function32f9
call Function1bc9
ld hl, $cfa9
ld b, [hl]
push bc
jr asm_4815f
Function48157: ; 48157 (12:4157)
call Function1bd3
ld hl, $cfa9
ld b, [hl]
push bc
asm_4815f: ; 4815f (12:415f)
bit 0, a
jp nz, Function4820d
ld b, a
ld a, [DefaultFlypoint] ; $d002
bit 6, a
jr z, .asm_48177
ld hl, $d479
bit 1, [hl]
jr z, .asm_48177
bit 1, b
jr nz, .asm_4817a
.asm_48177
jp Function48272
.asm_4817a
call WhiteBGMap
call Function48d30
pop bc
call ClearTileMap
ld a, $ff
ret
Function48187: ; 48187 (12:4187)
ld a, [$d479]
bit 1, a
jr nz, .asm_481f1
ld a, [$d003]
ld d, a
call Function48725
jr c, .asm_481a2
ld bc, $104
hlcoord 2, 12
call ClearBox
jr .asm_481ad
.asm_481a2
push de
hlcoord 2, 12
ld de, String_4849e
call PlaceString
pop de
.asm_481ad
ld a, [DefaultFlypoint] ; $d002
bit 6, a
jr nz, .asm_481c1
bit 0, d
jr nz, .asm_481c1
ld bc, $108
hlcoord 11, 4
call ClearBox
.asm_481c1
bit 1, d
jr nz, .asm_481ce
ld bc, $108
hlcoord 11, 6
call ClearBox
.asm_481ce
bit 2, d
jr nz, .asm_481db
ld bc, $208
hlcoord 11, 7
call ClearBox
.asm_481db
bit 3, d
jr nz, .asm_481f1
ld a, [$d479]
bit 0, a
jr nz, .asm_481f8
ld bc, $108
hlcoord 11, 10
call ClearBox
jr .asm_48201
.asm_481f1
ld a, [$d479]
bit 0, a
jr nz, .asm_48201
.asm_481f8
hlcoord 11, 10
ld de, String_48202
call PlaceString
.asm_48201
ret
; 48202 (12:4202)
String_48202: ; 48202
db "Tell Later@"
; 4820d
Function4820d: ; 4820d (12:420d)
call Function1bee
ld hl, $cfa9
ld a, [hl]
push af
ld a, [DefaultFlypoint] ; $d002
bit 6, a
jr z, .asm_4821f
pop af
inc a
push af
.asm_4821f
pop af
cp $1
jr z, asm_4828d
cp $2
jp z, Function4876f
cp $3
jp z, Function48304
cp $4
jp z, Function488d3
ld a, $2
call Function1ff8
ld a, [DefaultFlypoint] ; $d002
bit 6, a
jr z, .asm_4825c
jr .asm_4825c
; 48241 (12:4241)
hlcoord 1, 15
ld b, $2
ld c, $12
call ClearBox
ld de, String_484a1
hlcoord 1, 16
call PlaceString
call WaitBGMap
ld c, $30
call DelayFrames
.asm_4825c
call WhiteBGMap
call Function48d30
pop bc
call ClearTileMap
ld b, $8
call GetSGBLayout
ld hl, $d479
set 1, [hl]
xor a
ret
Function48272: ; 48272 (12:4272)
jp Function4840c
; 48275 (12:4275)
String_48275: ; 48275
db "Personal Info@"
; 48283
Function48283: ; 48283 (12:4283)
ld bc, $212
hlcoord 1, 15
call ClearBox
ret
asm_4828d: ; 4828d (12:428d)
call Function48283
hlcoord 1, 16
ld de, String_484b1
call PlaceString
ld hl, MenuDataHeader_0x484f1
call LoadMenuDataHeader
call Function4873c
hlcoord 11, 2
ld b, $4
ld c, $7
call Function48cdc
hlcoord 13, 4
ld de, String_484fb
call PlaceString
hlcoord 13, 6
ld de, String_484ff
call PlaceString
call WaitBGMap
ld a, [PlayerGender] ; $d472
inc a
ld [$cf88], a
call Function1bc9
call PlayClickSFX
call Function1c07
bit 0, a
jp z, Function4840c
ld hl, $cfa9
ld a, [hl]
ld hl, Strings_484fb
cp $1
jr z, .asm_482ed
.asm_482e1
ld a, [hli]
cp $50
jr nz, .asm_482e1
ld a, $1
ld [PlayerGender], a ; $d472
jr .asm_482f1
.asm_482ed
xor a
ld [PlayerGender], a ; $d472
.asm_482f1
ld d, h
ld e, l
hlcoord 11, 4
call PlaceString
ld a, [$d003]
set 0, a
ld [$d003], a
jp Function4840c
Function48304: ; 48304 (12:4304)
call Function48283
hlcoord 1, 16
ld de, String_484cf
call PlaceString
ld hl, MenuDataHeader_0x48504
call LoadMenuDataHeader
ld hl, MenuDataHeader_0x48513
call LoadMenuDataHeader
hlcoord 10, 0
ld b, $c
ld c, $8
call Function48cdc
ld a, [$cf88]
ld b, a
ld a, [$d0e4]
ld c, a
push bc
ld a, [$d474]
dec a
cp $29
jr c, .asm_4833f
sub $29
inc a
ld [$cf88], a
ld a, $29
.asm_4833f
ld [$d0e4], a
callba Function104148
.asm_48348
call Function350c
ld de, $629
call Function48383
jr c, .asm_48348
ld d, a
pop bc
ld a, b
ld [$cf88], a
ld a, c
ld [$d0e4], a
ld a, d
push af
call Function1c07
call Function1c07
pop af
ld a, [hJoyPressed] ; $ff00+$a7
bit 0, a
jr z, .asm_48377
call Function483bb
ld a, [$d003]
set 2, a
ld [$d003], a
.asm_48377
call Function48187
callba Function104148
jp Function4840c
Function48383: ; 48383 (12:4383)
push bc
push af
bit 5, a
jr nz, .asm_48390
bit 4, a
jr nz, .asm_4839f
and a
jr .asm_483b7
.asm_48390
ld a, [$d0e4]
sub d
ld [$d0e4], a
jr nc, .asm_483af
xor a
ld [$d0e4], a
jr .asm_483af
.asm_4839f
ld a, [$d0e4]
add d
ld [$d0e4], a
cp e
jr c, .asm_483af
ld a, e
ld [$d0e4], a
jr .asm_483af
.asm_483af
ld hl, $cfa9
ld a, [hl]
ld [$cf88], a
scf
.asm_483b7
pop bc
ld a, b
pop bc
ret
Function483bb: ; 483bb (12:43bb)
ld hl, $cf77
ld a, [hl]
inc a
ld [$d474], a
dec a
ld b, a
ld hl, Prefectures
.asm_483c8
and a
jr z, .asm_483d5
.asm_483cb
ld a, [hli]
cp "@"
jr nz, .asm_483cb
ld a, b
dec a
ld b, a
jr .asm_483c8
.asm_483d5
ld d, h
ld e, l
ld b, $2
ld c, $8
hlcoord 11, 7
call ClearBox
hlcoord 11, 8
call PlaceString
ret
; 483e8 (12:43e8)
Function483e8: ; 483e8
push de
ld hl, Prefectures
ld a, [MenuSelection]
cp $ff
jr nz, .asm_483f8
ld hl, Wakayama ; last string
jr .asm_48405
.asm_483f8
ld d, a
and a
jr z, .asm_48405
.asm_483fc
ld a, [hli]
cp "@"
jr nz, .asm_483fc
ld a, d
dec a
jr .asm_483f8
.asm_48405
ld d, h
ld e, l
pop hl
call PlaceString
ret
; 4840c
Function4840c: ; 4840c (12:440c)
call Function48187
call Function48283
hlcoord 1, 16
ld de, String_48275
call PlaceString
call Function486bf
pop bc
ld hl, $cfa9
ld [hl], b
ld a, [DefaultFlypoint] ; $d002
bit 6, a
jr nz, .asm_48437
ld b, $9
ld c, $1
hlcoord 1, 4
call ClearBox
jp Function48157
.asm_48437
ld b, $7
ld c, $1
hlcoord 1, 6
call ClearBox
jp Function48157
Function48444: ; 48444 (12:4444)
push bc
push af
push de
push hl
ld hl, Unknown_4845d
.asm_4844b
and a
jr z, .asm_48453
inc hl
inc hl
dec a
jr .asm_4844b
.asm_48453
ld d, h
ld e, l
pop hl
call PlaceString
pop de
pop af
pop bc
ret
; 4845d (12:445d)
Unknown_4845d: ; 4845d
; 4845d
db "0@"
db "1@"
db "2@"
db "3@"
db "4@"
db "5@"
db "6@"
db "7@"
db "8@"
db "9@"
; 48471
MobileProfileString: db " Mobile Profile@"
String_48482: db "Gender@"
String_48489: db "Age@"
String_4848d: db "Address@"
String_48495: db "Zip Code@"
String_4849e: db "OK@"
String_484a1: db "Profile Changed@"
String_484b1: db "Boy or girl?@"
String_484be: db "How old are you?@"
String_484cf: db "Where do you live?@"
String_484e2: db "Your zip code?@"
; 484f1
MenuDataHeader_0x484f1: ; 0x484f1
db $40 ; flags
db 02, 11 ; start coords
db 07, 19 ; end coords
dw MenuData2_0x484f9
db 1 ; default option
; 0x484f9
MenuData2_0x484f9: ; 0x484f9
db $a0 ; flags
db 2 ; items
Strings_484fb:
String_484fb: db "Boy@"
String_484ff: db "Girl@"
; 0x48504
MenuDataHeader_0x48504: ; 0x48504
db $40 ; flags
db 00, 10 ; start coords
db 17, 19 ; end coords
MenuDataHeader_0x48509: ; 0x48509
db $40 ; flags
db 05, 10 ; start coords
db 07, 19 ; end coords
MenuDataHeader_0x4850e: ; 0x4850e
db $40 ; flags
db 09, 10 ; start coords
db 11, 19 ; end coords
MenuDataHeader_0x48513: ; 0x48513
db $40 ; flags
db 01, 11 ; start coords
db 12, 18 ; end coords
dw MenuData2_0x4851b
db 1 ; default option
; 0x4851b
MenuData2_0x4851b: ; 0x4851b
db $1d ; flags
db 6 ; items
Unknown_4851d: ; 4851d
db $00, $01, $12, $2b, $45, $12, $e8, $43, $00, $00, $00, $00, $00, $00, $2e, $00, $01, $02, $03, $04
db $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f, $10, $11, $12, $13, $14, $15, $16, $17, $18
db $19, $1a, $1b, $1c, $1d, $1e, $1f, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $2c
db $2d, $ff
Prefectures:
Aichi: db "あいちけん@" ; Aichi
Aomori: db "あおもりけん@" ; Aomori
Akita: db "あきたけん@" ; Akita
Ishikawa: db "いしかわけん@" ; Ishikawa
Ibaraki: db "いばらきけん@" ; Ibaraki
Iwate: db "いわてけん@" ; Iwate
Ehime: db "えひめけん@" ; Ehime
Oita: db "おおいたけん@" ; Oita
Osakafu: db "おおさかふ@" ; Osakafu
Okayama: db "おかやまけん@" ; Okayama
Okinawa: db "おきなわけん@" ; Okinawa
Kagawa: db "かがわけん@" ; Kagawa
Kagoshima: db "かごしまけん@" ; Kagoshima
Kanagawa: db "かながわけん@" ; Kanagawa
Gifu: db "ぎふけん@" ; Gifu
Kyotofu: db "きょうとふ@" ; Kyotofu
Kumamoto: db "くまもとけん@" ; Kumamoto
Gunma: db "ぐんまけん@" ; Gunma
Kochi: db "こうちけん@" ; Kochi
Saitama: db "さいたまけん@" ; Saitama
Saga: db "さがけん@" ; Saga
Shiga: db "しがけん@" ; Shiga
Shizuoka: db "しずおかけん@" ; Shizuoka
Shimane: db "しまねけん@" ; Shimane
Chiba: db "ちばけん@" ; Chiba
Tokyo: db "とうきょうと@" ; Tokyo
Tokushima: db "とくしまけん@" ; Tokushima
Tochigi: db "とちぎけん@" ; Tochigi
Tottori: db "とっとりけん@" ; Tottori
Toyama: db "とやまけん@" ; Toyama
Nagasaki: db "ながさきけん@" ; Nagasaki
Nagano: db "ながのけん@" ; Nagano
Naraken: db "ならけん@" ; Naraken
Niigata: db "にいがたけん@" ; Niigata
Hyogo: db "ひょうごけん@" ; Hyogo
Hiroshima: db "ひろしまけん@" ; Hiroshima
Fukui: db "ふくいけん@" ; Fukui
Fukuoka: db "ふくおかけん@" ; Fukuoka
Fukushima: db "ふくしまけん@" ; Fukushima
Hokkaido: db "ほっかいどう@" ; Hokkaido
Mie: db "みえけん@" ; Mie
Miyagi: db "みやぎけん@" ; Miyagi
Miyazaki: db "みやざきけん@" ; Miyazaki
Yamagata: db "やまがたけん@" ; Yamagata
Yamaguchi: db "やまぐちけん@" ; Yamaguchi
Yamanashi: db "やまなしけん@" ; Yamanashi
Wakayama: db "わかやまけん@" ; Wakayama
; 48689
Function48689: ; 48689 (12:4689)
ld c, $7
call DelayFrames
ld b, $1
call Function4930f
call WhiteBGMap
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld b, $4
ld c, $14
call ClearBox
hlcoord 0, 2
ld a, $c
ld [hl], a
ld bc, $13
add hl, bc
ld [hl], a
ld de, MobileProfileString
hlcoord 1, 2
call PlaceString
hlcoord 0, 4
ld b, $8
ld c, $12
call Function48cdc
ret
Function486bf: ; 486bf (12:46bf)
ld hl, $cfa1
ld a, [DefaultFlypoint] ; $d002
bit 6, a
jr nz, .asm_486ce
ld a, $4
ld [hli], a
jr .asm_486d1
.asm_486ce
ld a, $6
ld [hli], a
.asm_486d1
ld a, $1
ld [hli], a
ld a, [DefaultFlypoint] ; $d002
bit 6, a
jr nz, .asm_486e7
call Function48725
ld a, $4
jr nc, .asm_486e4
ld a, $5
.asm_486e4
ld [hli], a
jr .asm_486fb
.asm_486e7
ld a, [$d479]
bit 1, a
jr nz, .asm_486f8
call Function48725
jr c, .asm_486f8
ld a, $3
ld [hli], a
jr .asm_486fb
.asm_486f8
ld a, $4
ld [hli], a
.asm_486fb
ld a, $1
ld [hli], a
ld [hl], $0
set 5, [hl]
inc hl
xor a
ld [hli], a
ld a, $20
ld [hli], a
ld a, $1
add $40
add $80
push af
ld a, [DefaultFlypoint] ; $d002
bit 6, a
jr z, .asm_4871a
pop af
add $2
push af
.asm_4871a
pop af
ld [hli], a
ld a, $1
ld [hli], a
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hli], a
ret
Function48725: ; 48725 (12:4725)
ld a, [$d003]
bit 0, a
jr z, .asm_4873a
bit 1, a
jr z, .asm_4873a
bit 2, a
jr z, .asm_4873a
bit 3, a
jr z, .asm_4873a
scf
ret
.asm_4873a
and a
ret
Function4873c: ; 4873c (12:473c)
ld hl, $cfa1
ld a, $4
ld [hli], a
ld a, $c
ld [hli], a
ld a, $2
ld [hli], a
ld a, $1
ld [hli], a
ld [hl], $0
set 5, [hl]
inc hl
xor a
ld [hli], a
ld a, $20
ld [hli], a
ld a, $1
add $2
ld [hli], a
ld a, [PlayerGender] ; $d472
and a
jr z, .asm_48764
ld a, $2
jr .asm_48766
.asm_48764
ld a, $1
.asm_48766
ld [hli], a
ld a, $1
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hli], a
ret
Function4876f: ; 4876f (12:476f)
call Function48283
hlcoord 1, 16
ld de, String_484be
call PlaceString
ld hl, MenuDataHeader_0x48509
call LoadMenuDataHeader
ld a, [$FF00+$aa]
push af
ld a, $1
ld [$FF00+$aa], a
hlcoord 10, 5
ld b, $1
ld c, $8
call Function48cdc
call WaitBGMap
ld a, [$d473]
and a
jr z, .asm_487ab
cp $64
jr z, .asm_487b2
hlcoord 12, 5
ld [hl], $10
hlcoord 12, 7
ld [hl], $11
jr .asm_487b7
.asm_487ab
hlcoord 12, 5
ld [hl], $10
jr .asm_487b7
.asm_487b2
hlcoord 12, 7
ld [hl], $11
.asm_487b7
hlcoord 11, 6
call Function487ec
ld c, $a
call DelayFrames
ld a, [$d473]
push af
.asm_487c6
call Functiona57
call Function4880e
jr nc, .asm_487c6
ld a, $1
call Function1ff8
pop bc
jr nz, .asm_487da
ld a, b
ld [$d473], a
.asm_487da
ld a, [$d473]
call Function1c07
hlcoord 11, 6
call Function487ec
pop af
ld [$FF00+$aa], a
jp Function4840c
Function487ec: ; 487ec (12:47ec)
push hl
ld de, $d473
call Function487ff
pop hl
inc hl
inc hl
inc hl
inc hl
ld de, String_4880d
call PlaceString
ret
Function487ff: ; 487ff (12:47ff)
push hl
ld a, $7f
ld [hli], a
ld [hl], a
pop hl
ld b, $81
ld c, $3
call PrintNum
ret
; 4880d (12:480d)
String_4880d: ; 4880d
db "@"
; 4880e
Function4880e: ; 4880e (12:480e)
ld a, [hJoyPressed] ; $ff00+$a7
and A_BUTTON
jp nz, Function488b9
ld a, [hJoyPressed] ; $ff00+$a7
and B_BUTTON
jp nz, Function488b4
ld hl, $ffa9
ld a, [hl]
and D_UP
jr nz, .asm_48843
ld a, [hl]
and D_DOWN
jr nz, .asm_48838
ld a, [hl]
and D_LEFT
jr nz, .asm_4884f
ld a, [hl]
and D_RIGHT
jr nz, .asm_4885f
call DelayFrame
and a
ret
.asm_48838
ld hl, $d473
ld a, [hl]
and a
jr z, .asm_48840
dec a
.asm_48840
ld [hl], a
jr .asm_4886f
.asm_48843
ld hl, $d473
ld a, [hl]
cp $64
jr nc, .asm_4884c
inc a
.asm_4884c
ld [hl], a
jr .asm_4886f
.asm_4884f
ld a, [$d473]
cp $5b
jr c, .asm_48858
ld a, $5a
.asm_48858
add $a
ld [$d473], a
jr .asm_4886f
.asm_4885f
ld a, [$d473]
cp $a
jr nc, .asm_48868
ld a, $a
.asm_48868
sub $a
ld [$d473], a
jr .asm_4886f
.asm_4886f
ld a, [$d473]
and a
jr z, .asm_48887
cp $64
jr z, .asm_48898
jr z, .asm_488a7
hlcoord 12, 5
ld [hl], $10
hlcoord 12, 7
ld [hl], $11
jr .asm_488a7
.asm_48887
hlcoord 10, 5
ld b, $1
ld c, $8
call Function48cdc
hlcoord 12, 5
ld [hl], $10
jr .asm_488a7
.asm_48898
hlcoord 10, 5
ld b, $1
ld c, $8
call Function48cdc
hlcoord 12, 7
ld [hl], $11
.asm_488a7
hlcoord 11, 6
call Function487ec
call WaitBGMap
ld a, $1
and a
ret
Function488b4: ; 488b4 (12:48b4)
ld a, $0
and a
scf
ret
Function488b9: ; 488b9 (12:48b9)
ld a, [$d003]
set 1, a
ld [$d003], a
scf
ret
; 488c3 (12:48c3)
GFX_488c3: ; 488c3
INCBIN "baserom.gbc",$488c3,$488cb - $488c3
GFX_488cb: ; 488cb
INCBIN "baserom.gbc",$488cb,$488d3 - $488cb
Function488d3: ; 488d3 (12:48d3)
call Function48283
hlcoord 1, 16
ld de, String_484e2
call PlaceString
call Function48a3a
jp c, Function4840c
ld hl, MenuDataHeader_0x4850e
call LoadMenuDataHeader
ld a, [$FF00+$aa]
push af
ld a, $1
ld [$FF00+$aa], a
hlcoord 10, 9
ld b, $1
ld c, $8
call Function48cdc
ld a, [$d475]
and $f
ld d, $0
hlcoord 11, 10
call Function489ea
call WaitBGMap
ld a, [$d475]
ld b, a
ld a, [$d476]
ld c, a
ld a, [$d477]
ld d, a
ld a, [$d478]
ld e, a
push de
push bc
ld d, $0
ld b, $0
asm_48922: ; 48922 (12:4922)
push bc
call Functiona57
ld a, [hJoyDown] ; $ff00+$a8
and a
jp z, Function4896e
bit 0, a
jp nz, Function4896e
bit 1, a
jp nz, Function4896e
ld a, [DefaultFlypoint] ; $d002
and $cf
res 7, a
ld [DefaultFlypoint], a ; $d002
pop bc
inc b
ld a, b
cp $5
push bc
jr c, .asm_4894c
pop bc
ld b, $4
push bc
.asm_4894c
pop bc
push bc
ld a, b
cp $4
jr nz, asm_48972
ld c, $a
call DelayFrames
jr asm_48972
; 4895a (12:495a)
Function4895a: ; 4895a
ld a, [hJoyPressed]
and a
jr z, .asm_48965
pop bc
ld b, $1
push bc
jr asm_48972
.asm_48965
ld a, [$ffa9]
and a
jr z, asm_48972
pop bc
ld b, $1
push bc
Function4896e: ; 4896e (12:496e)
pop bc
ld b, $0
push bc
asm_48972: ; 48972 (12:4972)
call Function48ab5
push af
cp $f0
jr z, .asm_48994
cp $f
jr nz, .asm_48988
ld a, [DefaultFlypoint] ; $d002
set 7, a
and $cf
ld [DefaultFlypoint], a ; $d002
.asm_48988
hlcoord 11, 10
ld b, $0
ld c, d
add hl, bc
ld b, $3
call Function48c11
.asm_48994
call WaitBGMap
pop af
pop bc
jr nc, asm_48922
jr nz, .asm_489b1
pop bc
ld a, b
ld [$d475], a
ld a, c
ld [$d476], a
pop bc
ld a, b
ld [$d477], a
ld a, c
ld [$d478], a
jr .asm_489c5
.asm_489b1
push af
ld a, [$d479]
set 0, a
ld [$d479], a
ld a, [$d003]
set 3, a
ld [$d003], a
pop af
pop bc
pop bc
.asm_489c5
push af
push bc
push de
push hl
ld a, $1
call Function1ff8
pop hl
pop de
pop bc
pop af
call Function1c07
hlcoord 11, 10
call Function489ea
hlcoord 11, 9
ld bc, $108
call ClearBox
pop af
ld [$FF00+$aa], a
jp Function4840c
Function489ea: ; 489ea (12:49ea)
push de
ld a, [$d475]
and $f
call Function48444
ld a, [$d476]
and $f0
swap a
inc hl
call Function48444
ld a, [$d476]
and $f
inc hl
call Function48444
inc hl
ld de, String_48a38
call PlaceString
ld a, [$d477]
and $f0
swap a
inc hl
call Function48444
ld a, [$d477]
and $f
inc hl
call Function48444
ld a, [$d478]
and $f0
swap a
inc hl
call Function48444
ld a, [$d478]
and $f
inc hl
call Function48444
pop de
ret
; 48a38 (12:4a38)
String_48a38: ; 48a38
db "-@"
; 48a3a
Function48a3a: ; 48a3a (12:4a3a)
ld hl, MenuDataHeader_0x48a9c
call LoadMenuDataHeader
call Function4873c
ld a, $a
ld [$cfa1], a
ld a, $b
ld [$cfa2], a
ld a, $1
ld [$cfa9], a
hlcoord 10, 8
ld b, $4
ld c, $8
call Function48cdc
hlcoord 12, 10
ld de, String_48aa1
call PlaceString
call Function1bc9
push af
call PlayClickSFX
call Function1c07
pop af
bit 1, a
jp nz, Function48a9a
ld a, [$cfa9]
cp $1
jr z, .asm_48a98
ld a, [$d003]
set 3, a
ld [$d003], a
ld a, [$d479]
res 0, a
ld [$d479], a
xor a
ld bc, $4
ld hl, $d475
call ByteFill
jr Function48a9a
.asm_48a98
and a
ret
Function48a9a: ; 48a9a (12:4a9a)
scf
ret
; 48a9c (12:4a9c)
MenuDataHeader_0x48a9c: ; 0x48a9c
db $40 ; flags
db 08, 10 ; start coords
db 13, 19 ; end coord
String_48aa1: ; 48aa1
db "Tell Now"
next "Tell Later@"
; 48ab5
Function48ab5: ; 48ab5 (12:4ab5)
ld a, [hJoyPressed] ; $ff00+$a7
and A_BUTTON
jp nz, Function48c0f
ld a, [hJoyPressed] ; $ff00+$a7
and B_BUTTON
jp nz, Function48c0d
ld a, d
and a
jr z, .asm_48adf
cp $1
jr z, .asm_48ae7
cp $2
jr z, .asm_48af1
cp $3
jr z, .asm_48af9
cp $4
jr z, .asm_48b03
cp $5
jr z, .asm_48b0b
cp $6
jr .asm_48b15
.asm_48adf
ld hl, $d475
ld a, [hl]
and $f
jr .asm_48b1d
.asm_48ae7
ld hl, $d476
ld a, [hl]
swap a
or $f0
jr .asm_48b1d
.asm_48af1
ld hl, $d476
ld a, [hl]
and $f
jr .asm_48b1d
.asm_48af9
ld hl, $d477
ld a, [hl]
swap a
or $f0
jr .asm_48b1d
.asm_48b03
ld hl, $d477
ld a, [hl]
and $f
jr .asm_48b1d
.asm_48b0b
ld hl, $d478
ld a, [hl]
swap a
or $f0
jr .asm_48b1d
.asm_48b15
ld hl, $d478
ld a, [hl]
and $f
jr .asm_48b1d
.asm_48b1d
push hl
push af
ld e, $0
hlcoord 11, 10
ld a, d
.asm_48b25
and a
jr z, .asm_48b2c
inc e
dec a
jr .asm_48b25
.asm_48b2c
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, .asm_48b8d
ld a, [hl]
and $80
jr nz, .asm_48b55
ld a, [hl]
and $20
jp nz, Function48bd7
ld a, [hl]
and $10
jr nz, .asm_48b9d
hlcoord 11, 10
call Function489ea
ld a, [DefaultFlypoint] ; $d002
bit 7, a
jr nz, .asm_48b51
.asm_48b51
pop bc
pop bc
and a
ret
.asm_48b55
pop af
ld b, a
and $f
and a
ld a, b
jr nz, .asm_48b61
and $f0
add $a
.asm_48b61
dec a
.asm_48b62
push de
push af
hlcoord 10, 9
ld b, $1
ld c, $8
call Function48cdc
pop af
pop de
hlcoord 11, 10
ld b, a
ld a, d
cp $3
jr c, .asm_48b7a
inc hl
.asm_48b7a
ld a, b
pop hl
bit 7, a
jr z, .asm_48b85
call Function48c4d
jr .asm_48b88
.asm_48b85
call Function48c5a
.asm_48b88
ld a, $f0
jp Function48c00
.asm_48b8d
pop af
ld b, a
and $f
cp $9
ld a, b
jr c, .asm_48b9a
and $f0
add $ff
.asm_48b9a
inc a
jr .asm_48b62
.asm_48b9d
push de
hlcoord 10, 9
ld b, $1
ld c, $8
call Function48cdc
pop de
ld a, d
cp $6
jr nc, .asm_48baf
inc d
.asm_48baf
pop af
pop hl
ld b, a
ld a, d
cp $6
ld a, b
jr z, .asm_48bc4
bit 7, a
jr nz, .asm_48bc4
inc hl
ld a, [hl]
swap a
and $f
jr asm_48bc7
.asm_48bc4
ld a, [hl]
and $f
asm_48bc7: ; 48bc7 (12:4bc7)
hlcoord 11, 10
push af
ld a, d
cp $3
pop bc
ld a, b
jr c, .asm_48bd3
inc hl
.asm_48bd3
ld a, $f
jr Function48c00
Function48bd7: ; 48bd7 (12:4bd7)
push de
hlcoord 10, 9
ld b, $1
ld c, $8
call Function48cdc
pop de
ld a, d
and a
pop af
pop hl
ld b, a
ld a, d
and a
ld a, b
jr z, .asm_48bf3
bit 7, a
jr z, .asm_48bf8
dec d
dec hl
.asm_48bf3
ld a, [hl]
and $f
jr asm_48bc7
.asm_48bf8
dec d
ld a, [hl]
swap a
and $f
jr asm_48bc7
Function48c00: ; 48c00 (12:4c00)
push af
hlcoord 11, 10
call Function489ea
ld a, $1
and a
pop bc
ld a, b
ret
Function48c0d: ; 48c0d (12:4c0d)
xor a
and a
Function48c0f: ; 48c0f (12:4c0f)
scf
ret
Function48c11: ; 48c11 (12:4c11)
ld a, [DefaultFlypoint] ; $d002
bit 7, a
jr z, .asm_48c20
ld a, d
cp $3
jr c, .asm_48c1e
inc hl
.asm_48c1e
ld [hl], $7f
.asm_48c20
ld a, [DefaultFlypoint] ; $d002
swap a
and $3
inc a
cp b
jr nz, .asm_48c40
ld a, [DefaultFlypoint] ; $d002
bit 7, a
jr z, .asm_48c3a
res 7, a
ld [DefaultFlypoint], a ; $d002
xor a
jr .asm_48c40
.asm_48c3a
set 7, a
ld [DefaultFlypoint], a ; $d002
xor a
.asm_48c40
swap a
ld b, a
ld a, [DefaultFlypoint] ; $d002
and $cf
or b
ld [DefaultFlypoint], a ; $d002
ret
Function48c4d: ; 48c4d (12:4c4d)
swap a
and $f0
push af
ld a, [hl]
and $f
ld [hl], a
pop af
or [hl]
ld [hl], a
ret
Function48c5a: ; 48c5a (12:4c5a)
push af
ld a, [hl]
and $f0
ld [hl], a
pop af
or [hl]
ld [hl], a
ret
Function48c63: ; 48c63
ld a, "@"
ld [de], a
ld a, c
cp $30
jr nc, .asm_48c8c
and a
jr z, .asm_48c8c
dec c
push de
ld h, d
ld l, e
ld a, "@"
ld b, 7
.asm_48c76
ld [hli], a
dec b
jr nz, .asm_48c76
ld hl, Prefectures
ld a, c
call GetNthString
.asm_48c81
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
cp "@"
jr nz, .asm_48c81
and a
pop de
ret
.asm_48c8c
scf
ret
; 48c8e
Function48c8e: ; 48c8e
ld hl, $d02a
ld d, h
ld e, l
callba Function48c63
hlcoord 10, 7
call PlaceString
call WaitBGMap
ret
; 48ca3
Function48ca3: ; 48ca3
push af
push bc
push de
push hl
ld b, 0
ld c, 0
ld d, 0
.asm_48cad
cp 100
jr c, .asm_48cb6
sub 100
inc b
jr .asm_48cad
.asm_48cb6
cp 10
jr c, .asm_48cbf
sub 10
inc c
jr .asm_48cb6
.asm_48cbf
cp 1
jr c, .asm_48cc7
dec a
inc d
jr .asm_48cbf
.asm_48cc7
ld a, b
call Function48444
inc hl
ld a, c
call Function48444
inc hl
ld a, d
call Function48444
pop hl
pop de
pop bc
pop af
ret
; 48cda
Function48cda: ; 48cda (12:4cda)
ld h, d
ld l, e
Function48cdc: ; 48cdc (12:4cdc)
push bc
push hl
call Function48cfd
pop hl
pop bc
ld de, AttrMap - TileMap
add hl, de
inc b
inc b
inc c
inc c
ld a, $0
.asm_48ced
push bc
push hl
.asm_48cef
ld [hli], a
dec c
jr nz, .asm_48cef
pop hl
ld de, $14
add hl, de
pop bc
dec b
jr nz, .asm_48ced
ret
Function48cfd: ; 48cfd (12:4cfd)
push hl
ld a, $4
ld [hli], a
inc a
call Function48d2a
inc a
ld [hl], a
pop hl
ld de, $14
add hl, de
.asm_48d0c
push hl
ld a, $7
ld [hli], a
ld a, $7f
call Function48d2a
ld [hl], $8
pop hl
ld de, $14
add hl, de
dec b
jr nz, .asm_48d0c
ld a, $9
ld [hli], a
ld a, $a
call Function48d2a
ld [hl], $b
ret
Function48d2a: ; 48d2a (12:4d2a)
ld d, c
.asm_48d2b
ld [hli], a
dec d
jr nz, .asm_48d2b
ret
Function48d30: ; 48d30 (12:4d30)
ld hl, $d475
call Function48d4a
ld hl, $d477
call Function48d4a
ret
Function48d3d: ; 48d3d (12:4d3d)
ld hl, $d475
call Function48d94
ld hl, $d477
call Function48d94
ret
Function48d4a: ; 48d4a (12:4d4a)
inc hl
ld a, [hl]
ld b, a
and $f
ld c, a
srl b
srl b
srl b
srl b
push bc
ld c, 10
ld a, b
call SimpleMultiply
pop bc
add c
ld [hld], a
xor a
ld [hQuotient], a ; $ff00+$b4 (aliases: hMultiplicand)
ld [$FF00+$b5], a
ld a, [hl]
srl a
srl a
srl a
srl a
ld c, 10
call SimpleMultiply
ld b, a
ld a, [hli]
and $f
add b
ld [$FF00+$b6], a
ld a, 100
ld [hDivisor], a ; $ff00+$b7 (aliases: hMultiplier)
call Multiply
ld a, [$FF00+$b5]
ld b, a
ld a, [$FF00+$b6]
ld c, a
ld e, [hl]
add e
ld c, a
ld a, b
adc $0
ld b, a
ld a, c
ld [hld], a
ld [hl], b
ret
Function48d94: ; 48d94 (12:4d94)
xor a
ld [$ffb3], a
ld [hQuotient], a ; $ff00+$b4 (aliases: hMultiplicand)
ld a, [hli]
ld [$ffb3], a
ld a, [hl]
ld [hQuotient], a ; $ff00+$b4 (aliases: hMultiplicand)
ld a, 100
ld [hDivisor], a ; $ff00+$b7 (aliases: hMultiplier)
ld b, 2
call Divide
ld a, [hDivisor] ; $ff00+$b7 (aliases: hMultiplier)
ld c, $a
call SimpleDivide
sla b
sla b
sla b
sla b
or b
ld [hld], a
ld a, [$FF00+$b6]
ld c, 10
call SimpleDivide
sla b
sla b
sla b
sla b
or b
ld [hl], a
ret
Function48dcb: ; 48dcb (12:4dcb)
call Function48e14
call Function48e47
call Function48e64
call Function3200
call Function32f9
ld hl, UnknownText_0x48e0f
call PrintText
ld hl, MenuDataHeader_0x48dfc
call LoadMenuDataHeader
call Function3200
call Function1d81
call Function1c17
ld a, [$cfa9]
dec a
ld [PlayerGender], a ; $d472
ld c, $a
call DelayFrames
ret
; 48dfc (12:4dfc)
MenuDataHeader_0x48dfc: ; 0x48dfc
db $40 ; flags
db 04, 06 ; start coords
db 09, 12 ; end coords
dw MenuData2_0x48e04
db 1 ; default option
; 0x48e04
MenuData2_0x48e04: ; 0x48e04
db $a1 ; flags
db 2 ; items
db "Boy@"
db "Girl@"
; 0x48e0f
UnknownText_0x48e0f: ; 0x48e0f
; Are you a boy? Or are you a girl?
text_jump UnknownText_0x1c0ca3
db "@"
; 0x48e14
Function48e14: ; 48e14 (12:4e14)
ld a, $10
ld [MusicFade], a ; $c2a7
ld a, $0
ld [MusicFadeIDLo], a ; $c2a9
ld a, $0
ld [MusicFadeIDHi], a ; $c2aa
ld c, $8
call DelayFrames
call WhiteBGMap
call Function48000
call Functione5f
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
ld a, $0
call ByteFill
ld hl, AttrMap ; $cdd9
ld bc, $168
xor a
call ByteFill
ret
Function48e47: ; 48e47 (12:4e47)
ld hl, Palette_48e5c
ld de, Unkn1Pals ; $d000
ld bc, $8
ld a, $5
call FarCopyWRAM
callba Function96a4
ret
; 48e5c (12:4e5c)
Palette_48e5c: ; 48e5c
RGB 31, 31, 31
RGB 09, 30, 31
RGB 01, 11, 31
RGB 00, 00, 00
; 48e64
Function48e64: ; 48e64 (12:4e64)
ld de, GFX_48e71
ld hl, $9000
lb bc, BANK(GFX_48e71), 1
call Get2bpp
ret
; 48e71 (12:4e71)
GFX_48e71: ; 48e71
INCBIN "baserom.gbc",$48e71,$48e81 - $48e71
Function48e81: ; 48e81
ld hl, PackFGFXPointers
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
ld hl, $9500
lb bc, BANK(PackFGFX), 15
call Request2bpp
ret
; 48e93
PackFGFXPointers: ; 48e93
dw PackFGFX + $f0 * 1
dw PackFGFX + $f0 * 3
dw PackFGFX + $f0 * 0
dw PackFGFX + $f0 * 2
; 48e9b
PackFGFX: ; 48e9b
INCBIN "gfx/misc/pack_f.w40.2bpp"
; 4925b
Function4925b: ; 4925b
call FadeToMenu
call WhiteBGMap
call ClearScreen
call DelayFrame
ld b, $14
call GetSGBLayout
xor a
ld [$d142], a
call Function492a5
ld [$d265], a
ld [$d262], a
call GetMoveName
call CopyName1
callba Function2c7fb
jr c, .asm_4929c
jr .asm_49291
.asm_49289
callba Function2c80a
jr c, .asm_4929c
.asm_49291
call Function492b9
jr nc, .asm_49289
xor a
ld [ScriptVar], a
jr .asm_492a1
.asm_4929c
ld a, $ff
ld [ScriptVar], a
.asm_492a1
call Function2b3c
ret
; 492a5
Function492a5: ; 492a5
ld a, [ScriptVar]
cp $1
jr z, .asm_492b3
cp $2
jr z, .asm_492b6
ld a, ICE_BEAM
ret
.asm_492b3
ld a, FLAMETHROWER
ret
.asm_492b6
ld a, THUNDERBOLT
ret
; 492b9
Function492b9: ; 492b9
ld hl, MenuDataHeader_0x4930a
call LoadMenuDataHeader
predef CanLearnTMHMMove
push bc
ld a, [CurPartyMon]
ld hl, PartyMonNicknames
call GetNick
pop bc
ld a, c
and a
jr nz, .can_learn
push de
ld de, SFX_WRONG
call PlaySFX
pop de
ld a, BANK(UnknownText_0x2c8ce)
ld hl, UnknownText_0x2c8ce
call FarPrintText
jr .didnt_learn
.can_learn
callab KnowsMove
jr c, .didnt_learn
predef LearnMove
ld a, b
and a
jr z, .didnt_learn
ld c, $5
callab ChangeHappiness
jr .learned
.didnt_learn
call Function1c07
and a
ret
.learned
call Function1c07
scf
ret
; 4930a
MenuDataHeader_0x4930a: ; 0x4930a
db $40 ; flags
db 12, 00 ; start coords
db 17, 19 ; end coords
; 4930f
Function4930f: ; 4930f (12:530f)
ld a, b
cp $ff
jr nz, .asm_49317
ld a, [SGBPredef] ; $cd98
.asm_49317
push af
callba Function9673
pop af
ld l, a
ld h, 0
add hl, hl
ld de, Jumptable_49330
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .done
push de
jp [hl]
.done
ret
; 49330 (12:5330)
Jumptable_49330: ; 49330
dw Function4936e
dw Function4942f
dw Function49706
; 49336
Function49336: ; 49336
.asm_49336
push bc
push hl
.asm_49338
ld [hli], a
dec c
jr nz, .asm_49338
pop hl
ld bc, $0014
add hl, bc
pop bc
dec b
jr nz, .asm_49336
ret
; 49346
Function49346: ; 49346 (12:5346)
ld hl, AttrMap ; $cdd9
ld bc, $168
xor a
call ByteFill
ret
Function49351: ; 49351 (12:5351)
ld de, Unkn1Pals ; $d000
ld hl, Palette_493e1
ld bc, $28
ld a, $5 ; BANK(Unkn1Pals)
call FarCopyWRAM
ld de, Unkn1Pals + $38
ld hl, Palette_49418
ld bc, $8
ld a, $5 ; BANK(Unkn1Pals)
call FarCopyWRAM
ret
Function4936e: ; 4936e (12:536e)
call Function49351
call Function49346
call Function49384
callba Function96b3
callba Function96a4
ret
Function49384: ; 49384 (12:5384)
ld hl, AttrMap ; $cdd9
ld bc, $401
ld a, $1
call Function49336
ld bc, $201
ld a, $2
call Function49336
ld bc, $601
ld a, $3
call Function49336
ld hl, $cdda
ld a, $1
ld bc, $312
call Function49336
ld bc, $212
ld a, $2
call Function49336
ld bc, $c12
ld a, $3
call Function49336
ld hl, $cdec
ld bc, $401
ld a, $1
call Function49336
ld bc, $201
ld a, $2
call Function49336
ld bc, $601
ld a, $3
call Function49336
ld hl, $cec9
ld bc, $78
ld a, $7
call ByteFill
ret
; 493e1 (12:53e1)
Palette_493e1: ; 493e1
RGB 03, 07, 09
RGB 26, 31, 00
RGB 20, 16, 03
RGB 31, 31, 31
RGB 13, 24, 29
RGB 11, 16, 30
RGB 07, 11, 22
RGB 05, 06, 18
RGB 31, 31, 31
RGB 20, 26, 31
RGB 13, 24, 29
RGB 11, 16, 30
RGB 31, 31, 31
RGB 20, 26, 31
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 20, 16, 08
RGB 31, 00, 00
RGB 00, 00, 00
; 49409
Function49409:: ; 49409
ld hl, Palette_49418
ld de, $d038
ld bc, $0008
ld a, $5
call FarCopyWRAM
ret
; 49418
Palette_49418: ; 49418
RGB 31, 31, 31
RGB 08, 19, 28
RGB 05, 05, 16
RGB 00, 00, 00
; 49420
Function49420:: ; 49420 (12:5420)
ld hl, Palette_496bd
ld de, Unkn1Pals + $30
ld bc, $8
ld a, $5 ; BANK(Unkn1Pals)
call FarCopyWRAM
ret
; 4942f (12:542f)
Function4942f: ; 4942f
call Function49351
ld de, Unkn1Pals + $38
ld hl, Palette_49478
ld bc, $8
ld a, $5 ; BANK(Unkn1Pals)
call FarCopyWRAM
call Function49346
ld hl, AttrMap
ld bc, $0168
xor a
call ByteFill
ld hl, $cef1
ld bc, $0050
ld a, $7
call ByteFill
ld a, [DefaultFlypoint]
bit 6, a
jr z, .asm_49464
call Function49480
jr .asm_49467
.asm_49464
call Function49496
.asm_49467
callba Function96b3
callba Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 49478
Palette_49478: ; 49478
RGB 31, 31, 31
RGB 26, 31, 00
RGB 20, 16, 03
RGB 00, 00, 00
; 49480
Function49480: ; 49480
ld hl, AttrMap
ld bc, $0414
ld a, $7
call Function49336
ld hl, $ce01
ld a, $4
ld [hl], a
ld hl, $ce14
ld [hl], a
ret
; 49496
Function49496: ; 49496
ld hl, AttrMap
ld bc, $0214
ld a, $7
call Function49336
ld hl, $cded
ld a, $4
ld [hl], a
ld hl, $ce00
ld [hl], a
ret
; 494ac
Function494ac: ; 494ac
ld a, [$d199]
cp $15
jr z, .asm_494c9
cp $16
jr z, .asm_494ce
cp $1d
jr z, .asm_494d3
cp $5
jr z, .asm_494e1
cp $1b
jr z, .asm_494e6
cp $d
jr z, .asm_494eb
jr .asm_494f0
.asm_494c9
call Function494f2
scf
ret
.asm_494ce
call Function49541
scf
ret
.asm_494d3
ld a, [$d19a]
and $7
cp $3
jr z, .asm_494f0
call Function49590
scf
ret
.asm_494e1
call Function495df
scf
ret
.asm_494e6
call Function4962e
scf
ret
.asm_494eb
call Function496c5
scf
ret
.asm_494f0
and a
ret
; 494f2
Function494f2: ; 494f2
ld a, $5
ld de, Unkn1Pals
ld hl, Palette_49501
ld bc, $0040
call FarCopyWRAM
ret
; 49501
Palette_49501: ; 49501
RGB 30, 28, 26
RGB 19, 19, 19
RGB 13, 13, 13
RGB 07, 07, 07
RGB 30, 28, 26
RGB 31, 19, 24
RGB 30, 10, 06
RGB 07, 07, 07
RGB 18, 24, 09
RGB 15, 20, 01
RGB 09, 13, 00
RGB 07, 07, 07
RGB 30, 28, 26
RGB 17, 19, 31
RGB 14, 16, 31
RGB 07, 07, 07
RGB 31, 26, 21
RGB 31, 20, 01
RGB 14, 16, 31
RGB 07, 07, 07
RGB 21, 17, 07
RGB 17, 19, 31
RGB 16, 13, 03
RGB 07, 07, 07
RGB 05, 05, 16
RGB 08, 19, 28
RGB 00, 00, 00
RGB 31, 31, 31
RGB 31, 31, 16
RGB 31, 31, 16
RGB 14, 09, 00
RGB 00, 00, 00
; 49541
Function49541: ; 49541
ld a, $5
ld de, Unkn1Pals
ld hl, Palette_49550
ld bc, $0040
call FarCopyWRAM
ret
; 49550
Palette_49550: ; 49550
RGB 30, 28, 26
RGB 19, 19, 19
RGB 13, 13, 13
RGB 07, 07, 07
RGB 30, 28, 26
RGB 31, 19, 24
RGB 30, 10, 06
RGB 07, 07, 07
RGB 18, 24, 09
RGB 15, 20, 01
RGB 09, 13, 00
RGB 07, 07, 07
RGB 30, 28, 26
RGB 15, 16, 31
RGB 09, 09, 31
RGB 07, 07, 07
RGB 30, 28, 26
RGB 31, 31, 07
RGB 31, 16, 01
RGB 07, 07, 07
RGB 26, 24, 17
RGB 21, 17, 07
RGB 16, 13, 03
RGB 07, 07, 07
RGB 05, 05, 16
RGB 08, 19, 28
RGB 00, 00, 00
RGB 31, 31, 31
RGB 31, 31, 16
RGB 31, 31, 16
RGB 14, 09, 00
RGB 00, 00, 00
; 49590
Function49590: ; 49590
ld a, $5
ld de, Unkn1Pals
ld hl, Palette_4959f
ld bc, $0040
call FarCopyWRAM
ret
; 4959f
Palette_4959f: ; 4959f
RGB 15, 14, 24
RGB 11, 11, 19
RGB 07, 07, 12
RGB 00, 00, 00
RGB 15, 14, 24
RGB 14, 07, 17
RGB 13, 00, 08
RGB 00, 00, 00
RGB 22, 29, 31
RGB 10, 27, 31
RGB 31, 31, 31
RGB 05, 00, 09
RGB 15, 14, 24
RGB 05, 05, 17
RGB 03, 03, 10
RGB 00, 00, 00
RGB 30, 30, 11
RGB 16, 14, 18
RGB 16, 14, 10
RGB 00, 00, 00
RGB 15, 14, 24
RGB 12, 09, 15
RGB 08, 04, 05
RGB 00, 00, 00
RGB 25, 31, 31
RGB 09, 28, 31
RGB 16, 11, 31
RGB 05, 00, 09
RGB 31, 31, 16
RGB 31, 31, 16
RGB 14, 09, 00
RGB 00, 00, 00
; 495df
Function495df: ; 495df
ld a, $5
ld de, Unkn1Pals
ld hl, Palette_495ee
ld bc, $0040
call FarCopyWRAM
ret
; 495ee
Palette_495ee: ; 495ee
RGB 30, 28, 26
RGB 19, 19, 19
RGB 13, 13, 13
RGB 07, 07, 07
RGB 30, 28, 26
RGB 31, 19, 24
RGB 30, 10, 06
RGB 07, 07, 07
RGB 30, 28, 26
RGB 15, 20, 01
RGB 09, 13, 00
RGB 07, 07, 07
RGB 30, 28, 26
RGB 15, 16, 31
RGB 09, 09, 31
RGB 07, 07, 07
RGB 30, 28, 26
RGB 31, 31, 07
RGB 31, 16, 01
RGB 07, 07, 07
RGB 26, 24, 17
RGB 21, 17, 07
RGB 16, 13, 03
RGB 07, 07, 07
RGB 30, 28, 26
RGB 31, 19, 24
RGB 16, 13, 03
RGB 07, 07, 07
RGB 31, 31, 16
RGB 31, 31, 16
RGB 14, 09, 00
RGB 00, 00, 00
; 4962e
Function4962e: ; 4962e
ld a, $5
ld de, Unkn1Pals
ld hl, Palette_4963d
ld bc, $0040
call FarCopyWRAM
ret
; 4963d
Palette_4963d: ; 4963d
RGB 27, 31, 27
RGB 21, 21, 21
RGB 13, 13, 13
RGB 07, 07, 07
RGB 27, 31, 27
RGB 31, 19, 24
RGB 30, 10, 06
RGB 07, 07, 07
RGB 08, 12, 31
RGB 12, 25, 01
RGB 05, 14, 00
RGB 07, 07, 07
RGB 31, 31, 31
RGB 08, 12, 31
RGB 01, 04, 31
RGB 07, 07, 07
RGB 27, 31, 27
RGB 12, 25, 01
RGB 05, 14, 00
RGB 07, 07, 07
RGB 27, 31, 27
RGB 24, 18, 07
RGB 20, 15, 03
RGB 07, 07, 07
RGB 27, 31, 27
RGB 15, 31, 31
RGB 05, 17, 31
RGB 07, 07, 07
RGB 31, 31, 16
RGB 31, 31, 16
RGB 14, 09, 00
RGB 00, 00, 00
; 4967d
Palette_4967d: ; 4967d
RGB 30, 28, 26
RGB 19, 19, 19
RGB 13, 13, 13
RGB 07, 07, 07
RGB 30, 28, 26
RGB 31, 19, 24
RGB 30, 10, 06
RGB 07, 07, 07
RGB 18, 24, 09
RGB 15, 20, 01
RGB 09, 13, 00
RGB 07, 07, 07
RGB 30, 28, 26
RGB 15, 16, 31
RGB 09, 09, 31
RGB 07, 07, 07
RGB 30, 28, 26
RGB 31, 31, 07
RGB 31, 16, 01
RGB 07, 07, 07
RGB 26, 24, 17
RGB 21, 17, 07
RGB 16, 13, 03
RGB 07, 07, 07
Palette_496ad: ; 496ad
RGB 30, 28, 26
RGB 17, 19, 31
RGB 14, 16, 31
RGB 07, 07, 07
RGB 31, 31, 16
RGB 31, 31, 16
RGB 14, 09, 00
RGB 00, 00, 00
; 496bd
Palette_496bd: ; 496bd
RGB 05, 05, 16
RGB 08, 19, 28
RGB 00, 00, 00
RGB 31, 31, 31
; 496c5
Function496c5: ; 496c5
ld a, $5
ld de, Unkn1Pals
ld hl, Palette_4967d
ld bc, $0040
call FarCopyWRAM
ld a, $5
ld de, $d020
ld hl, Palette_496fe
ld bc, $0008
call FarCopyWRAM
ld a, $5
ld de, $d018
ld hl, Palette_496ad
ld bc, $0008
call FarCopyWRAM
ld a, $5
ld de, $d030
ld hl, Palette_496bd
ld bc, $0008
call FarCopyWRAM
ret
; 496fe
Palette_496fe: ; 496fe
RGB 25, 24, 23
RGB 20, 19, 19
RGB 14, 16, 31
RGB 07, 07, 07
; 49706
Function49706: ; 49706
ld hl, Palette_49732
ld de, Unkn1Pals
ld bc, $0008
ld a, $5
call FarCopyWRAM
callba Function96a4
call Function49346
callba Function96b3
ld hl, Palette_4973a
ld de, Unkn2Pals
ld bc, $0008
ld a, $5
call FarCopyWRAM
ret
; 49732
Palette_49732: ; 49732
RGB 31, 31, 31
RGB 23, 16, 07
RGB 23, 07, 07
RGB 03, 07, 20
; 4973a
Palette_4973a: ; 4973a
RGB 00, 00, 00
RGB 07, 05, 31
RGB 14, 18, 31
RGB 31, 31, 31
; 49742
Function49742: ; 49742
ld hl, Palette_49757
ld de, Unkn1Pals
ld bc, $0040
ld a, $5
call FarCopyWRAM
callba Function96a4
ret
; 49757
Palette_49757: ; 49757
RGB 31, 31, 63
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 63
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 04, 02, 15
RGB 21, 00, 21
RGB 31, 00, 00
RGB 31, 31, 31
RGB 04, 02, 15
RGB 21, 00, 21
RGB 30, 16, 26
RGB 31, 31, 31
RGB 04, 02, 15
RGB 21, 00, 21
RGB 16, 16, 16
RGB 31, 31, 31
RGB 04, 02, 15
RGB 21, 00, 21
RGB 31, 12, 12
RGB 31, 31, 31
RGB 04, 02, 15
RGB 21, 00, 21
RGB 07, 08, 31
RGB 31, 31, 31
RGB 04, 02, 15
RGB 21, 00, 21
RGB 29, 28, 09
RGB 31, 31, 31
; 49797
Function49797: ; 49797
ld hl, AttrMap
ld bc, $1002
ld a, $4
call Function49336
ld a, $3
ld [$cded], a
ld [$cef1], a
ld hl, $cddb
ld bc, $0812
ld a, $5
call Function49336
ld hl, $ce7b
ld bc, $0812
ld a, $6
call Function49336
ld hl, $cf19
ld bc, $0214
ld a, $4
call Function49336
ld a, $3
ld bc, $0601
ld hl, $cdf3
call Function49336
ld a, $3
ld bc, $0601
ld hl, $cdfe
call Function49336
ld a, $3
ld bc, $0601
ld hl, $ce93
call Function49336
ld a, $3
ld bc, $0601
ld hl, $ce9e
call Function49336
ld a, $2
ld hl, $cf1b
ld [hli], a
ld a, $7
ld [hli], a
ld [hli], a
ld [hli], a
ld a, $2
ld [hl], a
ld hl, $cf2f
ld a, $3
ld bc, $0006
call ByteFill
ret
; 49811
Function49811: ; 49811
ld hl, Palette_49826
ld de, $d010
ld bc, $0030
ld a, $5
call FarCopyWRAM
callba Function96a4
ret
; 49826
Palette_49826: ; 49826
RGB 04, 02, 15
RGB 07, 09, 31
RGB 31, 00, 00
RGB 31, 31, 31
RGB 04, 02, 15
RGB 07, 09, 31
RGB 15, 23, 30
RGB 31, 31, 31
RGB 04, 02, 15
RGB 07, 09, 31
RGB 16, 16, 16
RGB 31, 31, 31
RGB 04, 02, 15
RGB 07, 09, 31
RGB 25, 07, 04
RGB 31, 31, 31
RGB 04, 02, 15
RGB 07, 09, 31
RGB 03, 22, 08
RGB 31, 31, 31
RGB 04, 02, 15
RGB 07, 09, 31
RGB 29, 28, 09
RGB 31, 31, 31
; 49856
Function49856: ; 49856
call Function49797
ret
; 4985a
INCBIN "baserom.gbc",$4985a,$4989a - $4985a
Function4989a: ; 4989a
call DelayFrame
ld a, [VramState]
push af
xor a
ld [VramState], a
call Function49912
ld de, $0750
ld a, $2c
call Function3b2a
ld hl, $0003
add hl, bc
ld [hl], $84
ld hl, $0002
add hl, bc
ld [hl], $1f
ld hl, $000f
add hl, bc
ld a, $80
ld [hl], a
ld a, $a0
ld [$cf64], a
ld d, $0
.asm_498ca
ld a, [$cf63]
bit 7, a
jr nz, .asm_498ee
push bc
call Function49bae
inc d
push de
ld a, $90
ld [$c3b5], a
callba Function8cf7a
call Function49935
ld c, $2
call DelayFrames
pop de
pop bc
jr .asm_498ca
.asm_498ee
pop af
ld [VramState], a
call Function498f9
call Function49bf3
ret
; 498f9
Function498f9: ; 498f9
ld hl, $c402
xor a
ld c, $4
.asm_498ff
ld [hli], a
inc hl
inc hl
inc hl
inc a
dec c
jr nz, .asm_498ff
ld hl, $c410
ld bc, $0090
xor a
call ByteFill
ret
; 49912
Function49912: ; 49912
callba Function8cf53
ld de, SpecialCelebiLeafGFX
ld hl, VTiles1
lb bc, BANK(SpecialCelebiLeafGFX), 4
call Request2bpp
ld de, SpecialCelebiGFX
ld hl, $8840
lb bc, BANK(SpecialCelebiGFX), $10
call Request2bpp
xor a
ld [$cf63], a
ret
; 49935
Function49935: ; 49935
ld hl, $cf64
ld a, [hl]
and a
jr z, .asm_4993e
dec [hl]
ret
.asm_4993e
ld hl, $cf63
set 7, [hl]
ret
; 49944
Function49944: ; 49944
ld hl, $cf65
ld a, [hl]
inc [hl]
and $7
ret nz
ld a, [hl]
and $18
sla a
add $40
ld d, a
ld e, $0
ld a, $18
call Function3b2a
ld hl, $0003
add hl, bc
ld [hl], $80
ret
; 49962
SpecialCelebiLeafGFX: ; 49962
INCBIN "gfx/special/celebi/leaf.2bpp"
SpecialCelebiGFX: ; 499a2
INCBIN "gfx/special/celebi/1.2bpp"
INCBIN "gfx/special/celebi/2.2bpp"
INCBIN "gfx/special/celebi/3.2bpp"
INCBIN "gfx/special/celebi/4.2bpp"
Function49aa2: ; 49aa2 (12:5aa2)
ld hl, $6
add hl, bc
ld a, [hl]
push af
ld hl, $5
add hl, bc
ld a, [hl]
cp $52
jp nc, Function49b30
ld hl, $5
add hl, bc
inc [hl]
ld hl, $f
add hl, bc
ld a, [hl]
ld d, a
cp $3a
jr c, .asm_49ac6
jr z, .asm_49ac6
sub $3
ld [hl], a
.asm_49ac6
ld hl, $e
add hl, bc
ld a, [hl]
inc [hl]
call Function49b3b
ld hl, $6
add hl, bc
ld [hl], a
ld d, a
ld hl, $4
add hl, bc
add [hl]
cp $5c
jr nc, .asm_49ae2
cp $44
jr nc, .asm_49b0d
.asm_49ae2
pop af
push af
cp d
jr nc, .asm_49af2
ld hl, $4
add hl, bc
add [hl]
cp $50
jr c, .asm_49b05
jr .asm_49afb
.asm_49af2
ld hl, $4
add hl, bc
add [hl]
cp $50
jr nc, .asm_49b05
.asm_49afb
ld hl, $5
add hl, bc
ld a, [hl]
sub $2
ld [hl], a
jr .asm_49b0d
.asm_49b05
ld hl, $5
add hl, bc
ld a, [hl]
add $1
ld [hl], a
.asm_49b0d
pop af
ld hl, $4
add hl, bc
add [hl]
cp $50
jr c, .asm_49b26
cp $e6
jr nc, .asm_49b26
ld hl, $1
add hl, bc
ld a, $41
call Function3b3c
jr .asm_49b2f
.asm_49b26
ld hl, $1
add hl, bc
ld a, $40
call Function3b3c
.asm_49b2f
ret
Function49b30: ; 49b30 (12:5b30)
pop af
ld hl, $1
add hl, bc
ld a, $40
call Function3b3c
ret
Function49b3b: ; 49b3b (12:5b3b)
add $10
and $3f
cp $20
jr nc, .asm_49b48
call Function49b52
ld a, h
ret
.asm_49b48
and $1f
call Function49b52
ld a, h
xor $ff
inc a
ret
Function49b52: ; 49b52 (12:5b52)
ld e, a
ld a, d
ld d, $0
ld hl, Unknown_49b6e
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, $0
.asm_49b61
srl a
jr nc, .asm_49b66
add hl, de
.asm_49b66
sla e
rl d
and a
jr nz, .asm_49b61
ret
; 49b6e (12:5b6e)
Unknown_49b6e: ; 49b6e
sine_wave $100
; 49bae
Function49bae: ; 49bae
push hl
push bc
push de
ld a, d
ld d, $3
ld e, d
cp $0
jr z, .asm_49bd0
cp d
jr z, .asm_49bd4
call Function49bed
cp d
jr z, .asm_49bd8
call Function49bed
cp d
jr z, .asm_49bdc
call Function49bed
cp d
jr c, .asm_49be9
jr .asm_49be5
.asm_49bd0
ld a, $84
jr .asm_49bde
.asm_49bd4
ld a, $88
jr .asm_49bde
.asm_49bd8
ld a, $8c
jr .asm_49bde
.asm_49bdc
ld a, $90
.asm_49bde
ld hl, $0003
add hl, bc
ld [hl], a
jr .asm_49be9
.asm_49be5
pop de
ld d, $ff
push de
.asm_49be9
pop de
pop bc
pop hl
ret
; 49bed
Function49bed: ; 49bed
push af
ld a, d
add e
ld d, a
pop af
ret
; 49bf3
Function49bf3: ; 49bf3
ld a, BATTLETYPE_CELEBI
ld [BattleType], a
ret
; 49bf9
Function49bf9: ; 49bf9
ld a, [$d0ee]
bit 6, a
jr z, .asm_49c07
ld a, $1
ld [ScriptVar], a
jr .asm_49c0b
.asm_49c07
xor a
ld [ScriptVar], a
.asm_49c0b
ret
; 49c0c
GFX_49c0c: ; 49c0c
INCBIN "baserom.gbc",$49c0c,$49cdc - $49c0c
; 49cdc
MainMenu: ; 49cdc
xor a
ld [$c2d7], a
call Function49ed0
ld b, $8
call GetSGBLayout
call Function32f9
ld hl, GameTimerPause
res 0, [hl]
call Function49da4
ld [$cf76], a
call Function49e09
ld hl, MenuDataHeader_0x49d14
call LoadMenuDataHeader
call Function49de4
call Function1c17
jr c, .quit
call ClearTileMap
ld a, [MenuSelection]
ld hl, Label49d60
rst JumpTable
jr MainMenu
.quit
ret
; 49d14
MenuDataHeader_0x49d14: ; 49d14
db $40 ; flags
db 00, 00 ; start coords
db 07, 16 ; end coords
dw MenuData2_0x49d1c
db 1 ; default option
; 49d1c
MenuData2_0x49d1c: ; 49d1c
db $80 ; flags
db 0 ; items
dw MainMenuItems
dw Function1f79
dw MainMenuText
; 49d20
MainMenuText: ; 49d24
db "CONTINUE@"
db "NEW GAME@"
db "OPTION@"
db "MYSTERY GIFT@"
db "MOBILE@"
db "MOBILE STUDIUM@"
Label49d60: ; 0x49d60
dw MainMenu_Continue
dw MainMenu_NewGame
dw MainMenu_Options
dw MainMenu_MysteryGift
dw MainMenu_Mobile
dw MainMenu_MobileStudium
; 0x49d6c
CONTINUE EQU 0
NEW_GAME EQU 1
OPTION EQU 2
MYSTERY_GIFT EQU 3
MOBILE EQU 4
MOBILE_STUDIUM EQU 5
MainMenuItems:
NewGameMenu: ; 0x49d6c
db 2
db NEW_GAME
db OPTION
db $ff
ContinueMenu: ; 0x49d70
db 3
db CONTINUE
db NEW_GAME
db OPTION
db $ff
MobileMysteryMenu: ; 0x49d75
db 5
db CONTINUE
db NEW_GAME
db OPTION
db MYSTERY_GIFT
db MOBILE
db $ff
MobileMenu: ; 0x49d7c
db 4
db CONTINUE
db NEW_GAME
db OPTION
db MOBILE
db $ff
MobileStudiumMenu: ; 0x49d82
db 5
db CONTINUE
db NEW_GAME
db OPTION
db MOBILE
db MOBILE_STUDIUM
db $ff
MysteryMobileStudiumMenu: ; 0x49d89
db 6
db CONTINUE
db NEW_GAME
db OPTION
db MYSTERY_GIFT
db MOBILE
db MOBILE_STUDIUM
db $ff
MysteryMenu: ; 0x49d91
db 4
db CONTINUE
db NEW_GAME
db OPTION
db MYSTERY_GIFT
db $ff
MysteryStudiumMenu: ; 0x49d97
db 5
db CONTINUE
db NEW_GAME
db OPTION
db MYSTERY_GIFT
db MOBILE_STUDIUM
db $ff
StudiumMenu: ; 0x49d9e
db 4
db CONTINUE
db NEW_GAME
db OPTION
db MOBILE_STUDIUM
db $ff
Function49da4: ; 49da4
nop
nop
nop
ld a, [$cfcd]
and a
jr nz, .asm_49db0
ld a, $0
ret
.asm_49db0
ld a, [hCGB]
cp $1
ld a, $1
ret nz
ld a, $0
call GetSRAMBank
ld a, [$abe5]
cp $ff
call CloseSRAM
jr nz, .asm_49dd6
ld a, [StatusFlags]
bit 7, a
ld a, $1
jr z, .asm_49dd1
jr .asm_49dd1
.asm_49dd1
jr .asm_49dd3
.asm_49dd3
ld a, $1
ret
.asm_49dd6
ld a, [StatusFlags]
bit 7, a
jr z, .asm_49ddf
jr .asm_49ddf
.asm_49ddf
jr .asm_49de1
.asm_49de1
ld a, $6
ret
; 49de4
Function49de4: ; 49de4
call SetUpMenu
.asm_49de7
call Function49e09
ld a, [$cfa5]
set 5, a
ld [$cfa5], a
call Function1f1a
ld a, [$cf73]
cp $2
jr z, .asm_49e07
cp $1
jr z, .asm_49e02
jr .asm_49de7
.asm_49e02
call PlayClickSFX
and a
ret
.asm_49e07
scf
ret
; 49e09
Function49e09: ; 49e09
ld a, [$cfcd]
and a
ret z
xor a
ld [hBGMapMode], a
call Function49e27
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
call Function49e3d
pop af
ld [Options], a
ld a, $1
ld [hBGMapMode], a
ret
; 49e27
Function49e27: ; 49e27
call Function6e3
and $80
jr nz, .asm_49e39
hlcoord 0, 14
ld b, $2
ld c, $12
call TextBox
ret
.asm_49e39
call SpeechTextBox
ret
; 49e3d
Function49e3d: ; 49e3d
ld a, [$cfcd]
and a
ret z
call Function6e3
and $80
jp nz, Function49e75
call UpdateTime
call GetWeekday
ld b, a
decoord 1, 15
call Function49e91
decoord 4, 16
ld a, [hHours]
ld c, a
callba Function90b3e
ld [hl], ":"
inc hl
ld de, hMinutes
ld bc, $8102
call PrintNum
ret
; 49e70
; 49e70
db "min.@"
; 49e75
Function49e75: ; 49e75
hlcoord 1, 14
ld de, .TimeNotSet
call PlaceString
ret
; 49e7f
.TimeNotSet ; 49e7f
db "TIME NOT SET@"
; 49e8c
UnknownText_0x49e8c: ; 49e8c
text_jump UnknownText_0x1c5182
db "@"
; 49e91
Function49e91: ; 49e91
push de
ld hl, .Days
ld a, b
call GetNthString
ld d, h
ld e, l
pop hl
call PlaceString
ld h, b
ld l, c
ld de, .Day
call PlaceString
ret
; 49ea8
.Days
db "SUN@"
db "MON@"
db "TUES@"
db "WEDNES@"
db "THURS@"
db "FRI@"
db "SATUR@"
.Day
db "DAY@"
; 49ed0
Function49ed0: ; 49ed0
xor a
ld [$ffde], a
call ClearTileMap
call Functione5f
call Functione51
call Function1fbf
ret
; 49ee0
MainMenu_NewGame: ; 49ee0
callba NewGame
ret
; 49ee7
MainMenu_Options: ; 49ee7
callba OptionsMenu
ret
; 49eee
MainMenu_Continue: ; 49eee
callba Continue
ret
; 49ef5
MainMenu_MysteryGift: ; 49ef5
callba MysteryGift
ret
; 49efc
MainMenu_Mobile: ; 49efc
call WhiteBGMap
ld a, MUSIC_MOBILE_ADAPTER_MENU
ld [wMapMusic], a
ld de, MUSIC_MOBILE_ADAPTER_MENU
call Function4a6c5
Function49f0a: ; 49f0a
call WhiteBGMap
call Function4a3a7
call Function4a492
call WhiteBGMap
Function49f16: ; 49f16
call Function4a071
ld c, $c
call DelayFrames
hlcoord 4, 0
ld b, $a
ld c, $a
call Function48cdc
hlcoord 6, 2
ld de, MobileString1
call PlaceString
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
xor a
ld de, String_0x49fe9
hlcoord 1, 14
call PlaceString
call Function3200
call Function32f9
call Function1bc9
ld hl, $cfa9
ld b, [hl]
push bc
jr .asm_49f5d
.asm_49f55
call Function1bd3
ld hl, $cfa9
ld b, [hl]
push bc
.asm_49f5d
bit 0, a
jr nz, .asm_49f67
bit 1, a
jr nz, .asm_49f84
jr .asm_49f97
.asm_49f67
ld hl, $cfa9
ld a, [hl]
cp $1
jp z, Function4a098
cp $2
jp z, Function4a0b9
cp $3
jp z, Function4a0c2
cp $4
jp z, Function4a100
ld a, $1
call Function1ff8
.asm_49f84
pop bc
call WhiteBGMap
call ClearTileMap
ld a, MUSIC_MAIN_MENU
ld [wMapMusic], a
ld de, MUSIC_MAIN_MENU
call Function4a6c5
ret
.asm_49f97
ld hl, $cfa9
ld a, [hl]
dec a
ld hl, MobileStrings2
call GetNthString
ld d, h
ld e, l
hlcoord 1, 13
ld b, $4
ld c, $12
call ClearBox
hlcoord 1, 14
call PlaceString
jp .asm_49fb7
.asm_49fb7
call Function4a071
pop bc
ld hl, $cfa9
ld [hl], b
ld b, $a
ld c, $1
hlcoord 5, 1
call ClearBox
jp .asm_49f55
; 49fcc
MobileString1: ; 49fcc
db "めいしフ,ルダー", $4e
db "あいさつ", $4e
db "プロフィール", $4e
db "せ", $1e, "い", $4e
db "もどる@"
; 49fe9
MobileStrings2:
String_0x49fe9: ; 49fe9
db "めいし", $1f, "つくったり", $4e
db "ほぞんしておける フ,ルダーです@"
; 4a004
String_0x4a004: ; 4a004
db "モバイルたいせんや じぶんのめいしで", $4e
db "つかう あいさつ", $1f, "つくります@"
; 4a026
String_0x4a026: ; 4a026
db "あなた", $25, "じゅうしょや ねんれいの", $4e
db "せ", $1e, "い", $1f, "かえられます@"
; 4a042
String_0x4a042: ; 4a042
db "モバイルセンター", $1d, "せつぞくするとき", $4e
db "ひつような こと", $1f, "きめます@"
; 4a062
String_0x4a062: ; 4a062
db "まえ", $25, "がめん ", $1d, "もどります", $4e
db "@"
; 4a071
Function4a071: ; 4a071 (12:6071)
ld hl, $cfa1
ld a, $2
ld [hli], a
ld a, $5
ld [hli], a
ld a, $5
ld [hli], a
ld a, $1
ld [hli], a
ld [hl], $0
set 5, [hl]
inc hl
xor a
ld [hli], a
ld a, $20
ld [hli], a
ld a, $1
add $40
add $80
add $2
ld [hli], a
ld a, $1
ld [hli], a
ld [hli], a
ret
Function4a098: ; 4a098 (12:6098)
ld a, $2
call Function1ff8
call Function1bee
call WaitBGMap
call Function1d6e
callba Function89de0
call Function1d7d
call Function49351
call Function4a485
pop bc
jp Function49f16
Function4a0b9: ; 4a0b9 (12:60b9)
ld a, $2
call Function1ff8
pop bc
jp Function4a4c4
Function4a0c2: ; 4a0c2 (12:60c2)
ld a, $2
call Function1ff8
ld a, $1
call GetSRAMBank
ld hl, $a00b
ld de, PlayerName ; $d47d
ld bc, $6
call CopyBytes
call CloseSRAM
callba Function150b9
ld c, $2
call DelayFrames
ld c, $1
call Function4802f
push af
call WhiteBGMap
pop af
and a
jr nz, .asm_4a0f9
callba Function1509a
.asm_4a0f9
ld c, $5
call DelayFrames
jr asm_4a111
Function4a100: ; 4a100 (12:6100)
ld a, $2
call Function1ff8
call WhiteBGMap
call Function4a13b
call WhiteBGMap
call ClearTileMap
asm_4a111: ; 4a111 (12:6111)
pop bc
call Functione5f
jp Function49f0a
Function4a118: ; 4a118 (12:6118)
ld hl, $cfa1
ld a, $1
ld [hli], a
ld a, $d
ld [hli], a
ld a, $3
ld [hli], a
ld a, $1
ld [hli], a
ld [hl], $0
set 5, [hl]
inc hl
xor a
ld [hli], a
ld a, $20
ld [hli], a
ld a, $1
add $2
ld [hli], a
ld a, $1
ld [hli], a
ld [hli], a
ret
Function4a13b: ; 4a13b (12:613b)
call Function4a3a7
call Function4a492
call Function4a373
ld c, $a
call DelayFrames
Function4a149: ; 4a149 (12:6149)
hlcoord 1, 2
ld b, $6
ld c, $10
call Function48cdc
hlcoord 3, 4
ld de, String_4a1ef
call PlaceString
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
ld a, [$cfa9]
dec a
ld hl, Strings_4a23d
call GetNthString
ld d, h
ld e, l
hlcoord 1, 13
ld b, $4
ld c, $12
call ClearBox
hlcoord 1, 14
call PlaceString
callba Function104148
call Function32f9
call Function1bc9
ld hl, $cfa9
ld b, [hl]
push bc
jr asm_4a19d
Function4a195: ; 4a195 (12:6195)
call Function1bd3
ld hl, $cfa9
ld b, [hl]
push bc
asm_4a19d: ; 4a19d (12:619d)
bit 0, a
jr nz, .asm_4a1a7
bit 1, a
jr nz, .asm_4a1ba
jr .asm_4a1bc
.asm_4a1a7
ld hl, $cfa9
ld a, [hl]
cp $1
jp z, Function4a20e
cp $2
jp z, Function4a221
ld a, $1
call Function1ff8
.asm_4a1ba
pop bc
ret
.asm_4a1bc
ld hl, $cfa9
ld a, [hl]
dec a
ld hl, Strings_4a23d
call GetNthString
ld d, h
ld e, l
hlcoord 1, 13
ld b, $4
ld c, $12
call ClearBox
hlcoord 1, 14
call PlaceString
jr .asm_4a1db
.asm_4a1db
call Function4a373
pop bc
ld hl, $cfa9
ld [hl], b
ld bc, $601
hlcoord 2, 3
call ClearBox
jp Function4a195
; 4a1ef (12:61ef)
String_4a1ef: ; 4a1ef
db "モバイルセンター", $1f, "えらぶ"
next "ログインパスワード", $1f, "いれる"
next "もどる@"
; 4a20e
Function4a20e: ; 4a20e (12:620e)
ld a, $1
call Function1ff8
callba Function1719c8
call WhiteBGMap
call DelayFrame
jr Function4a239
Function4a221: ; 4a221 (12:6221)
ld a, $1
call Function1ff8
call Function4a28a
jr c, Function4a239
call Function4a373
ld a, $2
ld [$cfa9], a
jr .asm_4a235
.asm_4a235
pop bc
jp Function4a149
Function4a239: ; 4a239 (12:6239)
pop bc
jp Function4a13b
; 4a23d (12:623d)
Strings_4a23d: ; 4a23d
db "いつも せつぞく", $1f, "する"
next "モバイルセンター", $1f, "えらびます@"
db "モバイルセンター", $1d, "せつぞくするとき"
next "つかうパスワード", $1f, "ほぞんできます@"
db "まえ", $25, "がめん ", $1d, "もどります@"
db "@"
; 4a28a
Function4a28a: ; 4a28a (12:628a)
hlcoord 2, 3
ld bc, $601
ld a, $7f
call Function4a6d8
call Function1bee
call WaitBGMap
call Function1d6e
ld a, $5
call GetSRAMBank
ld a, [$aa4b]
call CloseSRAM
and a
jr z, .asm_4a2df
hlcoord 12, 0
ld b, $5
ld c, $6
call Function48cdc
hlcoord 14, 1
ld de, String_4a34b
call PlaceString
callba Function104148
call Function4a118
call Function1bd3
push af
call PlayClickSFX
pop af
bit 1, a
jr nz, .asm_4a33b
ld a, [$cfa9]
cp $2
jr z, .asm_4a2f0
cp $3
jr z, .asm_4a33b
.asm_4a2df
callba Function11765d
call WhiteBGMap
call Function1d7d
call Functione5f
scf
ret
.asm_4a2f0
call Function1bee
ld hl, UnknownText_0x4a358
call PrintText
hlcoord 14, 7
ld b, $3
ld c, $4
call TextBox
callba Function104148
ld hl, MenuDataHeader_0x4a362
call LoadMenuDataHeader
call Function1d81
bit 1, a
jr nz, .asm_4a338
ld a, [$cfa9]
cp $2
jr z, .asm_4a338
ld a, $5
call GetSRAMBank
ld hl, $aa4b
xor a
ld bc, $11
call ByteFill
call CloseSRAM
ld hl, UnknownText_0x4a35d
call PrintText
call Functiona36
.asm_4a338
call Function1c07
.asm_4a33b
call Function1d7d
callba Function104148
xor a
ret
; 4a346 (12:6346)
MenuDataHeader_0x4a346: ; 0x4a346
db $40 ; flags
db 00, 12 ; start coords
db 06, 19 ; end coords
String_4a34b: ; 4a34b
db "いれなおす"
next "けす"
next "もどる@"
; 4a358
UnknownText_0x4a358: ; 0x4a358
; Delete the saved LOG-IN PASSWORD?
text_jump UnknownText_0x1c5196
db "@"
; 0x4a35d
UnknownText_0x4a35d: ; 0x4a35d
; Deleted the LOG-IN PASSWORD.
text_jump UnknownText_0x1c51b9
db "@"
; 0x4a362
MenuDataHeader_0x4a362: ; 0x4a362
db $40 ; flags
db 07, 14 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x4a36a
db 2 ; default option
; 0x4a36a
MenuData2_0x4a36a: ; 0x4a36a
db $e0 ; flags
db 2 ; items
db "はい@"
db "いいえ@"
; 0x4a373
Function4a373: ; 4a373 (12:6373)
ld hl, $cfa1
ld a, $4
ld [hli], a
ld a, $2
ld [hli], a
ld a, $3
ld [hli], a
ld a, $1
ld [hli], a
ld [hl], $0
set 5, [hl]
inc hl
xor a
ld [hli], a
ld a, $20
ld [hli], a
ld a, $1
add $40
add $80
add $2
ld [hli], a
ld a, $1
ld [hli], a
ld [hli], a
ret
; 4a39a (12:639a)
Function4a39a: ; 4a39a
call Function4a485
call Function4a492
call Function4a3aa
call Function32f9
ret
; 4a3a7
Function4a3a7: ; 4a3a7 (12:63a7)
call Function4a485
Function4a3aa: ; 4a3aa
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $301
xor a
call Function4a6d8
ld bc, $101
ld a, $1
call Function4a6d8
ld bc, $101
xor a
call Function4a6d8
ld bc, $101
ld a, $1
call Function4a6d8
ld bc, $401
ld a, $2
call Function4a6d8
ld bc, $101
ld a, $3
call Function4a6d8
ld bc, $101
ld a, $7f
call Function4a6d8
hlcoord 1, 0
ld a, $1
ld bc, $312
call Function4a6d8
ld bc, $112
ld a, $0
call Function4a6d8
ld bc, $112
ld a, $1
call Function4a6d8
ld bc, $112
ld a, $2
call Function4a6d8
ld bc, $b12
ld a, $7f
call Function4a6d8
hlcoord 19, 0
ld bc, $301
ld a, $0
call Function4a6d8
ld bc, $101
ld a, $1
call Function4a6d8
ld bc, $101
xor a
call Function4a6d8
ld bc, $101
ld a, $1
call Function4a6d8
ld bc, $401
ld a, $2
call Function4a6d8
ld bc, $101
ld a, $3
call Function4a6d8
ld bc, $101
ld a, $7f
call Function4a6d8
ret
; 4a449 (12:6449)
Function4a449: ; 4a449
ld bc, $003c
ld a, $0
ld hl, TileMap
call ByteFill
ld bc, $0028
ld a, $1
call ByteFill
ld bc, $0028
ld a, $0
call ByteFill
ld bc, $0028
ld a, $1
call ByteFill
ld bc, $0014
ld a, $2
call ByteFill
ld bc, $0014
ld a, $3
call ByteFill
ld bc, $0014
ld a, $7f
call ByteFill
ret
; 4a485
Function4a485: ; 4a485 (12:6485)
ld de, GFX_49c0c
ld hl, $9000
lb bc, BANK(GFX_49c0c), $d
call Get2bpp
ret
Function4a492: ; 4a492 (12:6492)
call Function4936e
ret
MainMenu_MobileStudium: ; 4a496
ld a, [StartDay]
ld b, a
ld a, [StartHour]
ld c, a
ld a, [StartMinute]
ld d, a
ld a, [StartSecond]
ld e, a
push bc
push de
callba MobileStudium
call WhiteBGMap
pop de
pop bc
ld a, b
ld [StartDay], a
ld a, c
ld [StartHour], a
ld a, d
ld [StartMinute], a
ld a, e
ld [StartSecond], a
ret
; 4a4c4
Function4a4c4: ; 4a4c4 (12:64c4)
call WhiteBGMap
call Function4a3a7
call Function4a492
call Function4a680
call WhiteBGMap
ld c, $14
call DelayFrames
hlcoord 2, 0
ld b, $a
ld c, $e
call Function48cdc
hlcoord 4, 2
ld de, String_4a5c5
call PlaceString
hlcoord 4, 4
ld de, String_4a5cd
call PlaceString
hlcoord 4, 6
ld de, String_4a5da
call PlaceString
hlcoord 4, 8
ld de, String_4a5e6
call PlaceString
hlcoord 4, 10
ld de, String_4a5f2
call PlaceString
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
xor a
ld hl, Strings_4a5f6
ld d, h
ld e, l
hlcoord 1, 14
call PlaceString
ld a, $1
ld hl, Strings_4a5f6
call GetNthString
ld d, h
ld e, l
hlcoord 1, 16
call PlaceString
call Function3200
call Function32f9
call Function1bc9
ld hl, $cfa9
ld b, [hl]
push bc
jr asm_4a54d
Function4a545: ; 4a545 (12:6545)
call Function1bd3
ld hl, $cfa9
ld b, [hl]
push bc
asm_4a54d: ; 4a54d (12:654d)
bit 0, a
jr nz, .asm_4a557
bit 1, a
jr nz, .asm_4a574
jr .asm_4a57e
.asm_4a557
ld hl, $cfa9
ld a, [hl]
cp $1
jp z, Function4a6ab
cp $2
jp z, Function4a6ab
cp $3
jp z, Function4a6ab
cp $4
jp z, Function4a6ab
ld a, $1
call Function1ff8
.asm_4a574
pop bc
call WhiteBGMap
call ClearTileMap
jp Function49f0a
.asm_4a57e
ld hl, $cfa9
ld a, [hl]
dec a
add a
push af
ld hl, Strings_4a5f6
call GetNthString
ld d, h
ld e, l
hlcoord 1, 13
ld b, $4
ld c, $12
call ClearBox
hlcoord 1, 14
call PlaceString
pop af
inc a
ld hl, Strings_4a5f6
call GetNthString
ld d, h
ld e, l
hlcoord 1, 16
call PlaceString
jp Function4a5b0
Function4a5b0: ; 4a5b0 (12:65b0)
call Function4a680
pop bc
ld hl, $cfa9
ld [hl], b
ld b, $a
ld c, $1
hlcoord 3, 1
call ClearBox
jp Function4a545
; 4a5c5 (12:65c5)
String_4a5c5: ; 4a5c5
db "じこしょうかい@"
String_4a5cd: ; 4a5cd
db "たいせん ", $4a, "はじまるとき@"
String_4a5da: ; 4a5da
db "たいせん ", $1d, "かったとき@"
String_4a5e6: ; 4a5e6
db "たいせん ", $1d, "まけたとき@"
String_4a5f2: ; 4a5f2
db "もどる@"
; 4a5f6
Strings_4a5f6: ; 4a5f6
db "めいし や ニュース ", $1d, "のせる@"
db "あなた", $25, "あいさつです@"
db "モバイル たいせん", $4a, "はじまるとき@"
db "あいて", $1d, "みえる あいさつです@"
db "モバイル たいせんで かったとき@"
db "あいて", $1d, "みえる あいさつです@"
db "モバイル たいせんで まけたとき@"
db "あいて", $1d, "みえる あいさつです@"
db "まえ", $25, "がめん ", $1d, "もどります@"
db "@"
; 4a680
Function4a680: ; 4a680 (12:6680)
ld hl, $cfa1
ld a, $2
ld [hli], a
ld a, $3
ld [hli], a
ld a, $5
ld [hli], a
ld a, $1
ld [hli], a
ld [hl], $0
set 5, [hl]
inc hl
xor a
ld [hli], a
ld a, $20
ld [hli], a
ld a, $1
add $40
add $80
add $2
ld [hli], a
ld a, $1
ld [hli], a
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hli], a
ret
Function4a6ab: ; 4a6ab (12:66ab)
ld a, $2
call Function1ff8
call WhiteBGMap
ld b, $8
call GetSGBLayout
callba Function11c1ab
pop bc
call Functione5f
jp Function4a4c4
Function4a6c5: ; 4a6c5 (12:66c5)
ld a, $5
ld [MusicFade], a ; $c2a7
ld a, e
ld [MusicFadeIDLo], a ; $c2a9
ld a, d
ld [MusicFadeIDHi], a ; $c2aa
ld c, $16
call DelayFrames
ret
Function4a6d8: ; 4a6d8 (12:66d8)
push bc
push hl
.asm_4a6da
ld [hli], a
dec c
jr nz, .asm_4a6da
pop hl
ld bc, $14
add hl, bc
pop bc
dec b
jr nz, Function4a6d8
ret
SpecialBeastsCheck: ; 0x4a6e8
; Check if the player owns all three legendary beasts.
; They must exist in either party or PC, and have the player's OT and ID.
; Return the result in ScriptVar.
ld a, RAIKOU
ld [ScriptVar], a
call CheckOwnMonAnywhere
jr nc, .notexist
ld a, ENTEI
ld [ScriptVar], a
call CheckOwnMonAnywhere
jr nc, .notexist
ld a, SUICUNE
ld [ScriptVar], a
call CheckOwnMonAnywhere
jr nc, .notexist
; they exist
ld a, 1
ld [ScriptVar], a
ret
.notexist
xor a
ld [ScriptVar], a
ret
SpecialMonCheck: ; 0x4a711
; Check if the player owns any monsters of the species in ScriptVar.
; Return the result in ScriptVar.
call CheckOwnMonAnywhere
jr c, .exists
; doesn't exist
xor a
ld [ScriptVar], a
ret
.exists
ld a, 1
ld [ScriptVar], a
ret
CheckOwnMonAnywhere: ; 0x4a721
; Check if the player owns any monsters of the species in ScriptVar.
; It must exist in either party or PC, and have the player's OT and ID.
; If there are no monsters in the party,
; the player must not own any yet.
ld a, [PartyCount]
and a
ret z
ld d, a
ld e, 0
ld hl, PartyMon1Species
ld bc, PartyMonOT
; Run CheckOwnMon on each Pokémon in the party.
.partymon
call CheckOwnMon
ret c ; found!
push bc
ld bc, PartyMon2 - PartyMon1
add hl, bc
pop bc
call UpdateOTPointer
dec d
jr nz, .partymon
; Run CheckOwnMon on each Pokémon in the PC.
ld a, 1
call GetSRAMBank
ld a, [sBoxCount]
and a
jr z, .boxes
ld d, a
ld hl, sBoxMon1Species
ld bc, sBoxMonOT
.openboxmon
call CheckOwnMon
jr nc, .next
; found!
call CloseSRAM
ret
.next
push bc
ld bc, sBoxMon2 - sBoxMon1
add hl, bc
pop bc
call UpdateOTPointer
dec d
jr nz, .openboxmon
; Run CheckOwnMon on each monster in the other 13 PC boxes.
.boxes
call CloseSRAM
ld c, 0
.box
; Don't search the current box again.
ld a, [wCurBox]
and $f
cp c
jr z, .nextbox
; Load the box.
ld hl, Unknown_4a810
ld b, 0
add hl, bc
add hl, bc
add hl, bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]
ld h, [hl]
ld l, a
; Number of monsters in the box
ld a, [hl]
and a
jr z, .nextbox
push bc
push hl
ld de, sBoxMons - sBoxCount
add hl, de
ld d, h
ld e, l
pop hl
push de
ld de, sBoxMonOT - sBoxCount
add hl, de
ld b, h
ld c, l
pop hl
ld d, a
.boxmon
call CheckOwnMon
jr nc, .nextboxmon
; found!
pop bc
call CloseSRAM
ret
.nextboxmon
push bc
ld bc, sBoxMon2 - sBoxMon1
add hl, bc
pop bc
call UpdateOTPointer
dec d
jr nz, .boxmon
pop bc
.nextbox
inc c
ld a, c
cp NUM_BOXES
jr c, .box
; not found
call CloseSRAM
and a
ret
CheckOwnMon: ; 0x4a7ba
; Check if a Pokémon belongs to the player and is of a specific species.
; inputs:
; hl, pointer to PartyMonNSpecies
; bc, pointer to PartyMonNOT
; ScriptVar should contain the species we're looking for
; outputs:
; sets carry if monster matches species, ID, and OT name.
push bc
push hl
push de
ld d, b
ld e, c
; check species
ld a, [ScriptVar] ; species we're looking for
ld b, [hl] ; species we have
cp b
jr nz, .notfound ; species doesn't match
; check ID number
ld bc, PartyMon1ID - PartyMon1Species
add hl, bc ; now hl points to ID number
ld a, [PlayerID]
cp [hl]
jr nz, .notfound ; ID doesn't match
inc hl
ld a, [PlayerID + 1]
cp [hl]
jr nz, .notfound ; ID doesn't match
; check OT
; This only checks five characters, which is fine for the Japanese version,
; but in the English version the player name is 7 characters, so this is wrong.
ld hl, PlayerName
rept 4
ld a, [de]
cp [hl]
jr nz, .notfound
cp "@"
jr z, .found ; reached end of string
inc hl
inc de
endr
ld a, [de]
cp [hl]
jr z, .found
.notfound
pop de
pop hl
pop bc
and a
ret
.found
pop de
pop hl
pop bc
scf
ret
; 0x4a810
Unknown_4a810: ; 4a810
; bank, address
dbw $02, $a000
dbw $02, $a450
dbw $02, $a8a0
dbw $02, $acf0
dbw $02, $b140
dbw $02, $b590
dbw $02, $b9e0
dbw $03, $a000
dbw $03, $a450
dbw $03, $a8a0
dbw $03, $acf0
dbw $03, $b140
dbw $03, $b590
dbw $03, $b9e0
; 4a83a
UpdateOTPointer: ; 0x4a83a
push hl
ld hl, NAME_LENGTH
add hl, bc
ld b, h
ld c, l
pop hl
ret
; 0x4a843
Function4a843: ; 4a843
; Like CheckOwnMonAnywhere, but only check for species.
; OT/ID don't matter.
ld a, [PartyCount]
and a
ret z
ld d, a
ld e, 0
ld hl, PartyMon1Species
ld bc, PartyMonOT
.asm_4a851
call Function4a8dc
ret c
push bc
ld bc, PartyMon2 - PartyMon1
add hl, bc
pop bc
call Function4a91e
dec d
jr nz, .asm_4a851
ld a, 1
call GetSRAMBank
ld a, [sBoxCount]
and a
jr z, .asm_4a888
ld d, a
ld hl, sBoxMon1Species
ld bc, sBoxMonOT
.asm_4a873
call Function4a8dc
jr nc, .asm_4a87c
call CloseSRAM
ret
.asm_4a87c
push bc
ld bc, sBoxMon2 - sBoxMon1
add hl, bc
pop bc
call Function4a91e
dec d
jr nz, .asm_4a873
.asm_4a888
call CloseSRAM
ld c, 0
.asm_4a88d
ld a, [wCurBox]
and $f
cp c
jr z, .asm_4a8d1
ld hl, Unknown_4a8f4
ld b, 0
add hl, bc
add hl, bc
add hl, bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
and a
jr z, .asm_4a8d1
push bc
push hl
ld de, sBoxMons - sBoxCount
add hl, de
ld d, h
ld e, l
pop hl
push de
ld de, sBoxMonOT - sBoxCount
add hl, de
ld b, h
ld c, l
pop hl
ld d, a
.asm_4a8ba
call Function4a8dc
jr nc, .asm_4a8c4
pop bc
call CloseSRAM
ret
.asm_4a8c4
push bc
ld bc, sBoxMon2 - sBoxMon1
add hl, bc
pop bc
call Function4a91e
dec d
jr nz, .asm_4a8ba
pop bc
.asm_4a8d1
inc c
ld a, c
cp NUM_BOXES
jr c, .asm_4a88d
call CloseSRAM
and a
ret
; 4a8dc
Function4a8dc: ; 4a8dc
push bc
push hl
push de
ld d, b
ld e, c
ld a, [ScriptVar]
ld b, [hl]
cp b
jr nz, .no_match
jr .match
.no_match
pop de
pop hl
pop bc
and a
ret
.match
pop de
pop hl
pop bc
scf
ret
; 4a8f4
Unknown_4a8f4: ; 4a8f4
; bank, address
dbw $02, $a000
dbw $02, $a450
dbw $02, $a8a0
dbw $02, $acf0
dbw $02, $b140
dbw $02, $b590
dbw $02, $b9e0
dbw $03, $a000
dbw $03, $a450
dbw $03, $a8a0
dbw $03, $acf0
dbw $03, $b140
dbw $03, $b590
dbw $03, $b9e0
; 4a91e
Function4a91e: ; 4a91e
push hl
ld hl, NAME_LENGTH
add hl, bc
ld b, h
ld c, l
pop hl
ret
; 4a927
Function4a927: ; 4a927
ld a, [ScriptVar]
ld [CurItem], a
ld hl, PCItems
call CheckItem
jr c, .asm_4a948
ld a, [ScriptVar]
ld [CurItem], a
ld hl, NumItems
call CheckItem
jr c, .asm_4a948
xor a
ld [ScriptVar], a
ret
.asm_4a948
ld a, 1
ld [ScriptVar], a
ret
; 4a94e
Function4a94e: ; 4a94e
call FadeToMenu
ld a, $ff
ld hl, DefaultFlypoint
ld bc, $0003
call ByteFill
xor a
ld [$d018], a
ld [$d019], a
ld b, $14
call GetSGBLayout
call Function32f9
call Function4aa22
jr c, .asm_4a985
jr z, .asm_4a9a1
jr .asm_4a97b
.asm_4a974
call Function4aa25
jr c, .asm_4a985
jr z, .asm_4a9a1
.asm_4a97b
call Function4ac58
ld hl, $d019
res 1, [hl]
jr .asm_4a974
.asm_4a985
ld a, [$d018]
and a
jr nz, .asm_4a990
call Function4aba8
jr c, .asm_4a974
.asm_4a990
call Function2b3c
ld hl, DefaultFlypoint
ld a, $ff
ld bc, $0003
call ByteFill
scf
jr .asm_4a9af
.asm_4a9a1
call Function4a9c3
jr c, .asm_4a9b0
call Function4a9d7
jr c, .asm_4a974
call Function2b3c
and a
.asm_4a9af
ret
.asm_4a9b0
ld de, SFX_WRONG
call PlaySFX
ld hl, UnknownText_0x4a9be
call PrintText
jr .asm_4a974
; 4a9be
UnknownText_0x4a9be: ; 0x4a9be
; Pick three #MON for battle.
text_jump UnknownText_0x1c51d7
db "@"
; 0x4a9c3
Function4a9c3: ; 4a9c3
ld hl, DefaultFlypoint
ld a, $ff
cp [hl]
jr z, .asm_4a9d5
inc hl
cp [hl]
jr z, .asm_4a9d5
inc hl
cp [hl]
jr z, .asm_4a9d5
and a
ret
.asm_4a9d5
scf
ret
; 4a9d7
Function4a9d7: ; 4a9d7
ld a, [DefaultFlypoint]
ld hl, PartyMonNicknames
call GetNick
ld h, d
ld l, e
ld de, EndFlypoint
ld bc, $0006
call CopyBytes
ld a, [$d003]
ld hl, PartyMonNicknames
call GetNick
ld h, d
ld l, e
ld de, $d00c
ld bc, $0006
call CopyBytes
ld a, [$d004]
ld hl, PartyMonNicknames
call GetNick
ld h, d
ld l, e
ld de, $d012
ld bc, $0006
call CopyBytes
ld hl, UnknownText_0x4aa1d
call PrintText
call YesNoBox
ret
; 4aa1d
UnknownText_0x4aa1d: ; 0x4aa1d
; , @ and @ . Use these three?
text_jump UnknownText_0x1c51f4
db "@"
; 0x4aa22
Function4aa22: ; 4aa22
call WhiteBGMap
Function4aa25: ; 4aa25
callba Function5004f
callba Function50405
call Function4aad3
Function4aa34: ; 4aa34
ld a, $9
ld [PartyMenuActionText], a
callba WritePartyMenuTilemap
xor a
ld [PartyMenuActionText], a
callba PrintPartyMenuText
call Function4aab6
call WaitBGMap
call Function32f9
call DelayFrame
call Function4ab1a
jr z, .asm_4aa66
push af
call Function4aafb
jr c, .asm_4aa67
call Function4ab06
jr c, .asm_4aa67
pop af
.asm_4aa66
ret
.asm_4aa67
ld hl, $d019
set 1, [hl]
pop af
ret
; 4aa6e
Function4aa6e: ; 4aa6e
pop af
ld de, SFX_WRONG
call PlaySFX
call WaitSFX
jr Function4aa34
; 4aa7a
Function4aa7a: ; 4aa7a
ld hl, DefaultFlypoint
ld d, $3
.asm_4aa7f
ld e, $6
ld a, [hli]
push de
push hl
cp $ff
jr z, .asm_4aab3
ld hl, $c314
inc a
ld d, a
.asm_4aa8d
ld a, [hl]
and a
jr z, .asm_4aaa5
cp d
jr z, .asm_4aa9a
jr .asm_4aaa5
ld a, $3
jr .asm_4aa9c
.asm_4aa9a
ld a, $2
.asm_4aa9c
push hl
ld c, l
ld b, h
ld hl, $0002
add hl, bc
ld [hl], a
pop hl
.asm_4aaa5
ld bc, $0010
add hl, bc
dec e
jr nz, .asm_4aa8d
pop hl
pop de
dec d
jr nz, .asm_4aa7f
jr .asm_4aab5
.asm_4aab3
pop hl
pop de
.asm_4aab5
ret
; 4aab6
Function4aab6: ; 4aab6
ld hl, DefaultFlypoint
ld d, $3
.asm_4aabb
ld a, [hli]
cp $ff
jr z, .asm_4aad2
push de
push hl
hlcoord 0, 1
ld bc, $0028
call AddNTimes
ld [hl], $ec
pop hl
pop de
dec d
jr nz, .asm_4aabb
.asm_4aad2
ret
; 4aad3
Function4aad3: ; 4aad3
ld hl, PartyCount
ld a, [hli]
and a
ret z
ld c, a
xor a
ld [$ffb0], a
.asm_4aadd
push bc
push hl
ld e, 0
callba Function8e83f
ld a, [$ffb0]
inc a
ld [$ffb0], a
pop hl
pop bc
dec c
jr nz, .asm_4aadd
call Function4aa7a
callba Function8cf69
ret
; 4aafb
Function4aafb: ; 4aafb
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_4ab04
and a
ret
.asm_4ab04
scf
ret
; 4ab06
Function4ab06: ; 4ab06
ld a, [CurPartyMon]
ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1HP
call AddNTimes
ld a, [hli]
ld b, a
ld a, [hl]
or b
jr nz, .asm_4ab19
scf
.asm_4ab19
ret
; 4ab1a
Function4ab1a: ; 4ab1a
.asm_4ab1a
ld a, $fb
ld [$cfa8], a
ld a, $26
ld [$cfa7], a
ld a, $2
ld [$cfa4], a
call Function4adf7
call Function1bc9
call Function4abc3
jr c, .asm_4ab1a
push af
call Function4ab99
call nc, Function1bee
pop af
bit 1, a
jr nz, .asm_4ab6d
ld a, [PartyCount]
inc a
ld b, a
ld a, [$cfa9]
ld [$d0d8], a
cp b
jr z, .asm_4ab7e
ld a, [$cfa9]
dec a
ld [CurPartyMon], a
ld c, a
ld b, $0
ld hl, PartySpecies
add hl, bc
ld a, [hl]
ld [CurPartySpecies], a
ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
ld a, $1
and a
ret
.asm_4ab6d
ld a, [$cfa9]
ld [$d0d8], a
.asm_4ab73
ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
scf
ret
.asm_4ab7e
ld a, $1
ld [$d018], a
ld a, [$cfaa]
cp $2
jr z, .asm_4ab73
ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
xor a
ld [$d018], a
and a
ret
; 4ab99
Function4ab99: ; 4ab99
bit 1, a
jr z, .asm_4aba6
ld a, [DefaultFlypoint]
cp $ff
jr z, .asm_4aba6
scf
ret
.asm_4aba6
and a
ret
; 4aba8
Function4aba8: ; 4aba8
ld hl, $d004
ld a, [hl]
cp $ff
jr nz, .asm_4abbe
dec hl
ld a, [hl]
cp $ff
jr nz, .asm_4abbe
dec hl
ld a, [hl]
cp $ff
jr nz, .asm_4abbe
and a
ret
.asm_4abbe
ld a, $ff
ld [hl], a
scf
ret
; 4abc3
Function4abc3: ; 4abc3
bit 3, a
jr z, .asm_4abd5
ld a, [PartyCount]
inc a
ld [$cfa9], a
ld a, $1
ld [$cfaa], a
jr .asm_4ac29
.asm_4abd5
bit 6, a
jr z, .asm_4abeb
ld a, [$cfa9]
ld [$cfa9], a
and a
jr nz, .asm_4ac29
ld a, [PartyCount]
inc a
ld [$cfa9], a
jr .asm_4ac29
.asm_4abeb
bit 7, a
jr z, .asm_4ac08
ld a, [$cfa9]
ld [$cfa9], a
ld a, [PartyCount]
inc a
inc a
ld b, a
ld a, [$cfa9]
cp b
jr nz, .asm_4ac29
ld a, $1
ld [$cfa9], a
jr .asm_4ac29
.asm_4ac08
bit 4, a
jr nz, .asm_4ac10
bit 5, a
jr z, .asm_4ac56
.asm_4ac10
ld a, [$cfa9]
ld b, a
ld a, [PartyCount]
inc a
cp b
jr nz, .asm_4ac29
ld a, [$cfaa]
cp $1
jr z, .asm_4ac26
ld a, $1
jr .asm_4ac29
.asm_4ac26
ld [$cfaa], a
.asm_4ac29
hlcoord 0, 1
ld bc, $0d01
call ClearBox
call Function4aab6
ld a, [PartyCount]
hlcoord 6, 1
.asm_4ac3b
ld bc, $0028
add hl, bc
dec a
jr nz, .asm_4ac3b
ld [hl], $7f
ld a, [$cfa9]
ld b, a
ld a, [PartyCount]
inc a
cp b
jr z, .asm_4ac54
ld a, $1
ld [$cfaa], a
.asm_4ac54
scf
ret
.asm_4ac56
and a
ret
; 4ac58
Function4ac58: ; 4ac58
ld bc, $0212
hlcoord 1, 15
call ClearBox
callba Function8ea4a
ld hl, MenuDataHeader_0x4aca2
call LoadMenuDataHeader
ld hl, $d019
bit 1, [hl]
jr z, .asm_4ac89
hlcoord 11, 13
ld b, $3
ld c, $7
call TextBox
hlcoord 13, 14
ld de, String_4ada7
call PlaceString
jr .asm_4ac96
.asm_4ac89
hlcoord 11, 9
ld b, $7
ld c, $7
call TextBox
call Function4ad68
.asm_4ac96
ld a, $1
ld [hBGMapMode], a
call Function4acaa
call Function1c07
and a
ret
; 4aca2
MenuDataHeader_0x4aca2: ; 0x4aca2
db $40 ; flags
db 09, 11 ; start coords
db 17, 19 ; end coords
dw NULL
db 1 ; default option
; 0x4acaa
Function4acaa: ; 4acaa
.asm_4acaa
ld a, $a0
ld [$cf91], a
ld a, [$d019]
bit 1, a
jr z, .asm_4acc2
ld a, $2
ld [$cf92], a
ld a, $c
ld [$cf82], a
jr .asm_4accc
.asm_4acc2
ld a, $4
ld [$cf92], a
ld a, $8
ld [$cf82], a
.asm_4accc
ld a, $b
ld [$cf83], a
ld a, $1
ld [$cf88], a
call Function1c10
ld hl, $cfa5
set 6, [hl]
call Function1bc9
ld de, SFX_READ_TEXT_2
call PlaySFX
ld a, [hJoyPressed]
bit 0, a
jr nz, .asm_4acf4
bit 1, a
jr nz, .asm_4acf3
jr .asm_4acaa
.asm_4acf3
ret
.asm_4acf4
ld a, [$d019]
bit 1, a
jr nz, .asm_4ad0e
ld a, [$cfa9]
cp $1
jr z, Function4ad17
cp $2
jp z, Function4ad56
cp $3
jp z, Function4ad60
jr .asm_4acf3
.asm_4ad0e
ld a, [$cfa9]
cp $1
jr z, Function4ad56
jr .asm_4acf3
Function4ad17: ; 4ad17
call Function4adb2
jr z, .asm_4ad4a
ld hl, DefaultFlypoint
ld a, $ff
cp [hl]
jr z, .asm_4ad39
inc hl
cp [hl]
jr z, .asm_4ad39
inc hl
cp [hl]
jr z, .asm_4ad39
ld de, SFX_WRONG
call WaitPlaySFX
ld hl, UnknownText_0x4ad51
call PrintText
ret
.asm_4ad39
ld a, [CurPartyMon]
ld [hl], a
call Function4a9c3
ret c
ld a, [$d019]
set 0, a
ld [$d019], a
ret
.asm_4ad4a
ld a, $ff
ld [hl], a
call Function4adc2
ret
UnknownText_0x4ad51: ; 0x4ad51
; Only three #MON may enter.
text_jump UnknownText_0x1c521c
db "@"
; 0x4ad56
Function4ad56: ; 4ad56
callba OpenPartyStats
call Function3200
ret
; 4ad60
Function4ad60: ; 4ad60
callba Function12fba
ret
; 4ad67
Function4ad67: ; 4ad67
ret
; 4ad68
Function4ad68: ; 4ad68
hlcoord 13, 12
ld de, String_4ad88
call PlaceString
call Function4adb2
jr c, .asm_4ad7e
hlcoord 13, 10
ld de, String_4ada0
jr .asm_4ad84
.asm_4ad7e
hlcoord 13, 10
ld de, String_4ad9a
.asm_4ad84
call PlaceString
ret
; 4ad88
String_4ad88: ; 4ad88
db "つよさをみる"
next "つかえるわざ"
next "もどる@"
; 4ad9a
String_4ad9a: ; 4ad9a
db "さんかする@"
; 4ada0
String_4ada0: ; 4ada0
db "さんかしない@"
; 4ada7
String_4ada7: ; 4ada7
db "つよさをみる"
next "もどる@" ; BACK
; 4adb2
Function4adb2: ; 4adb2
ld hl, DefaultFlypoint
ld a, [CurPartyMon]
cp [hl]
ret z
inc hl
cp [hl]
ret z
inc hl
cp [hl]
ret z
scf
ret
; 4adc2
Function4adc2: ; 4adc2
ld a, [DefaultFlypoint]
cp $ff
jr nz, .asm_4ade5
ld a, [$d003]
cp $ff
jr nz, .asm_4addd
ld a, [$d004]
ld [DefaultFlypoint], a
ld a, $ff
ld [$d004], a
jr .asm_4ade5
.asm_4addd
ld [DefaultFlypoint], a
ld a, $ff
ld [$d003], a
.asm_4ade5
ld a, [$d003]
cp $ff
ret nz
ld b, a
ld a, [$d004]
ld [$d003], a
ld a, b
ld [$d004], a
ret
; 4adf7
Function4adf7: ; 4adf7
ld a, [$d019]
bit 0, a
ret z
ld a, [PartyCount]
inc a
ld [$cfa9], a
ld a, $1
ld [$cfaa], a
ld a, [$d019]
res 0, a
ld [$d019], a
ret
; 4ae12
Function4ae12: ; 4ae12
call Function4ae1f
ld a, $0
jr c, .asm_4ae1b
ld a, $1
.asm_4ae1b
ld [ScriptVar], a
ret
; 4ae1f
Function4ae1f: ; 4ae1f
ld bc, $0e07
push bc
ld hl, YesNoMenuDataHeader
call Function1d3c
pop bc
ld a, b
ld [$cf83], a
add $5
ld [$cf85], a
ld a, c
ld [$cf82], a
add $4
ld [$cf84], a
call Function1c00
call Function1d81
push af
ld c, $f
call DelayFrames
call Function4ae5e
pop af
jr c, .asm_4ae57
ld a, [$cfa9]
cp $2
jr z, .asm_4ae57
and a
ret
.asm_4ae57
ld a, $2
ld [$cfa9], a
scf
ret
; 4ae5e
Function4ae5e: ; 4ae5e
ld a, [hOAMUpdate]
push af
call Function1c07
call Function1ad2
xor a
ld [hOAMUpdate], a
call DelayFrame
ld a, $1
ld [hOAMUpdate], a
call Function321c
pop af
ld [hOAMUpdate], a
ret
; 4ae78
SECTION "bank13", ROMX, BANK[$13]
Function4c000:: ; 4c000
ld hl, TileMap
ld de, AttrMap
ld b, $12
.asm_4c008
push bc
ld c, $14
.asm_4c00b
ld a, [hl]
push hl
srl a
jr c, .asm_4c021
ld hl, TilesetPalettes
add [hl]
ld l, a
ld a, [$d1e7]
adc $0
ld h, a
ld a, [hl]
and $f
jr .asm_4c031
.asm_4c021
ld hl, TilesetPalettes
add [hl]
ld l, a
ld a, [$d1e7]
adc $0
ld h, a
ld a, [hl]
swap a
and $f
.asm_4c031
pop hl
ld [de], a
res 7, [hl]
inc hl
inc de
dec c
jr nz, .asm_4c00b
pop bc
dec b
jr nz, .asm_4c008
ret
; 4c03f
Function4c03f:: ; 4c03f
ld hl, BGMapBuffer
ld de, BGMapPalBuffer
.asm_4c045
ld a, [hl]
push hl
srl a
jr c, .asm_4c05b
ld hl, TilesetPalettes
add [hl]
ld l, a
ld a, [$d1e7]
adc $0
ld h, a
ld a, [hl]
and $f
jr .asm_4c06b
.asm_4c05b
ld hl, TilesetPalettes
add [hl]
ld l, a
ld a, [$d1e7]
adc $0
ld h, a
ld a, [hl]
swap a
and $f
.asm_4c06b
pop hl
ld [de], a
res 7, [hl]
inc hl
inc de
dec c
jr nz, .asm_4c045
ret
; 4c075
INCLUDE "tilesets/palette_maps.asm"
TileCollisionTable:: ; 4ce1f
; 00 land
; 01 water
; 0f wall
; 11 talkable water
; 1f talkable wall
db $00, $00, $00, $00, $00, $00, $00, $0f
db $00, $00, $00, $00, $00, $00, $00, $0f
db $00, $00, $1f, $00, $00, $1f, $00, $00
db $00, $00, $1f, $00, $00, $1f, $00, $00
db $01, $01, $11, $00, $11, $01, $01, $0f
db $01, $01, $11, $00, $11, $01, $01, $0f
db $01, $01, $01, $01, $01, $01, $01, $01
db $01, $01, $01, $01, $01, $01, $01, $01
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $0f, $00, $00, $00, $00, $00
db $00, $00, $0f, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $0f, $0f, $0f, $0f, $0f, $00, $00, $00
db $0f, $0f, $0f, $0f, $0f, $00, $00, $00
db $0f, $0f, $0f, $0f, $0f, $0f, $0f, $0f
db $0f, $0f, $0f, $0f, $0f, $0f, $0f, $0f
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $01, $01, $01, $01, $01, $01, $01, $01
db $01, $01, $01, $01, $01, $01, $01, $01
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $00, $00, $0f
; 4cf1f
Function4cf1f: ; 4cf1f
ld a, $0
call Function4cf34
ld a, $1
call Function4cf34
ld a, $2
call Function4cf34
ld a, $3
call Function4cf34
ret
; 4cf34
Function4cf34: ; 4cf34
call GetSRAMBank
ld hl, $a000
ld bc, $2000
xor a
call ByteFill
call CloseSRAM
ret
; 4cf45
Function4cf45: ; 4cf45 (13:4f45)
ld a, [hCGB] ; $ff00+$e6
and a
jp z, WaitBGMap
ld a, [hBGMapMode] ; $ff00+$d4
push af
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, [$FF00+$de]
push af
xor a
ld [$FF00+$de], a
.asm_4cf57
ld a, [rLY] ; $ff00+$44
cp $60
jr c, .asm_4cf57
di
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, AttrMap ; $cdd9
call Function4cf80
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
call Function4cf80
.asm_4cf72
ld a, [rLY] ; $ff00+$44
cp $60
jr c, .asm_4cf72
ei
pop af
ld [$FF00+$de], a
pop af
ld [hBGMapMode], a ; $ff00+$d4
ret
Function4cf80: ; 4cf80 (13:4f80)
ld [hSPBuffer], sp ; $ffd9
ld sp, hl
ld a, [$FF00+$d7]
ld h, a
ld l, $0
ld a, $12
ld [$FF00+$d3], a
ld b, $2
ld c, $41
.asm_4cf91
pop de
.asm_4cf92
ld a, [$ff00+c]
and b
jr nz, .asm_4cf92
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4cf9b
ld a, [$ff00+c]
and b
jr nz, .asm_4cf9b
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4cfa4
ld a, [$ff00+c]
and b
jr nz, .asm_4cfa4
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4cfad
ld a, [$ff00+c]
and b
jr nz, .asm_4cfad
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4cfb6
ld a, [$ff00+c]
and b
jr nz, .asm_4cfb6
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4cfbf
ld a, [$ff00+c]
and b
jr nz, .asm_4cfbf
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4cfc8
ld a, [$ff00+c]
and b
jr nz, .asm_4cfc8
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4cfd1
ld a, [$ff00+c]
and b
jr nz, .asm_4cfd1
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4cfda
ld a, [$ff00+c]
and b
jr nz, .asm_4cfda
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4cfe3
ld a, [$ff00+c]
and b
jr nz, .asm_4cfe3
ld [hl], e
inc l
ld [hl], d
inc l
ld de, $c
add hl, de
ld a, [$FF00+$d3]
dec a
ld [$FF00+$d3], a
jr nz, .asm_4cf91
ld a, [hSPBuffer] ; $ff00+$d9
ld l, a
ld a, [$FF00+$da]
ld h, a
ld sp, hl
ret
Function4cffe:: ; 4cffe
ld a, $1
call GetSRAMBank
ld a, [$a008]
ld b, a
ld a, [$ad0f]
ld c, a
call CloseSRAM
ld a, b
cp $63
jr nz, .asm_4d01b
ld a, c
cp $7f
jr nz, .asm_4d01b
ld c, $1
ret
.asm_4d01b
ld c, $0
ret
; 4d01e
MapTriggers:: ; 4d01e
; Map triggers
trigger_def: MACRO
; db group, map
; dw address
map \1
dw \2
ENDM
trigger_def POKECENTER_2F, wPokecenter2FTrigger
trigger_def TRADE_CENTER, wTradeCenterTrigger
trigger_def COLOSSEUM, wColosseumTrigger
trigger_def TIME_CAPSULE, wTimeCapsuleTrigger
trigger_def POWER_PLANT, wPowerPlantTrigger
trigger_def CERULEAN_GYM, wCeruleanGymTrigger
trigger_def ROUTE_25, wRoute25Trigger
trigger_def TRAINER_HOUSE_B1F, wTrainerHouseB1FTrigger
trigger_def VICTORY_ROAD_GATE, wVictoryRoadGateTrigger
trigger_def SAFFRON_TRAIN_STATION, wSaffronTrainStationTrigger
trigger_def ROUTE_16_GATE, wRoute16GateTrigger
trigger_def ROUTE_17_18_GATE, wRoute1718GateTrigger
trigger_def INDIGO_PLATEAU_POKECENTER_1F, wIndigoPlateauPokecenter1FTrigger
trigger_def WILLS_ROOM, wWillsRoomTrigger
trigger_def KOGAS_ROOM, wKogasRoomTrigger
trigger_def BRUNOS_ROOM, wBrunosRoomTrigger
trigger_def KARENS_ROOM, wKarensRoomTrigger
trigger_def LANCES_ROOM, wLancesRoomTrigger
trigger_def HALL_OF_FAME, wHallOfFameTrigger
trigger_def ROUTE_27, wRoute27Trigger
trigger_def NEW_BARK_TOWN, wNewBarkTownTrigger
trigger_def ELMS_LAB, wElmsLabTrigger
trigger_def KRISS_HOUSE_1F, wKrissHouse1FTrigger
trigger_def ROUTE_29, wRoute29Trigger
trigger_def CHERRYGROVE_CITY, wCherrygroveCityTrigger
trigger_def MR_POKEMONS_HOUSE, wMrPokemonsHouseTrigger
trigger_def ROUTE_32, wRoute32Trigger
trigger_def ROUTE_35_NATIONAL_PARK_GATE, wRoute35NationalParkGateTrigger
trigger_def ROUTE_36, wRoute36Trigger
trigger_def ROUTE_36_NATIONAL_PARK_GATE, wRoute36NationalParkGateTrigger
trigger_def AZALEA_TOWN, wAzaleaTownTrigger
trigger_def GOLDENROD_GYM, wGoldenrodGymTrigger
trigger_def GOLDENROD_MAGNET_TRAIN_STATION, wGoldenrodMagnetTrainStationTrigger
trigger_def GOLDENROD_POKECENTER_1F, wGoldenrodPokecenter1FTrigger
trigger_def OLIVINE_CITY, wOlivineCityTrigger
trigger_def ROUTE_34, wRoute34Trigger
trigger_def ROUTE_34_ILEX_FOREST_GATE, wRoute34IlexForestGateTrigger
trigger_def ECRUTEAK_HOUSE, wEcruteakHouseTrigger
trigger_def WISE_TRIOS_ROOM, wWiseTriosRoomTrigger
trigger_def ECRUTEAK_POKECENTER_1F, wEcruteakPokecenter1FTrigger
trigger_def ECRUTEAK_GYM, wEcruteakGymTrigger
trigger_def MAHOGANY_TOWN, wMahoganyTownTrigger
trigger_def ROUTE_42, wRoute42Trigger
trigger_def CIANWOOD_CITY, wCianwoodCityTrigger
trigger_def BATTLE_TOWER_1F, wBattleTower1FTrigger
trigger_def BATTLE_TOWER_BATTLE_ROOM, wBattleTowerBattleRoomTrigger
trigger_def BATTLE_TOWER_ELEVATOR, wBattleTowerElevatorTrigger
trigger_def BATTLE_TOWER_HALLWAY, wBattleTowerHallwayTrigger
trigger_def BATTLE_TOWER_OUTSIDE, wBattleTowerOutsideTrigger
trigger_def ROUTE_43_GATE, wRoute43GateTrigger
trigger_def MOUNT_MOON, wMountMoonTrigger
trigger_def SPROUT_TOWER_3F, wSproutTower3FTrigger
trigger_def TIN_TOWER_1F, wTinTower1FTrigger
trigger_def BURNED_TOWER_1F, wBurnedTower1FTrigger
trigger_def BURNED_TOWER_B1F, wBurnedTowerB1FTrigger
trigger_def RADIO_TOWER_5F, wRadioTower5FTrigger
trigger_def RUINS_OF_ALPH_OUTSIDE, wRuinsOfAlphOutsideTrigger
trigger_def RUINS_OF_ALPH_RESEARCH_CENTER, wRuinsOfAlphResearchCenterTrigger
trigger_def RUINS_OF_ALPH_HO_OH_CHAMBER, wRuinsOfAlphHoOhChamberTrigger
trigger_def RUINS_OF_ALPH_KABUTO_CHAMBER, wRuinsOfAlphKabutoChamberTrigger
trigger_def RUINS_OF_ALPH_OMANYTE_CHAMBER, wRuinsOfAlphOmanyteChamberTrigger
trigger_def RUINS_OF_ALPH_AERODACTYL_CHAMBER, wRuinsOfAlphAerodactylChamberTrigger
trigger_def RUINS_OF_ALPH_INNER_CHAMBER, wRuinsOfAlphInnerChamberTrigger
trigger_def MAHOGANY_MART_1F, wMahoganyMart1FTrigger
trigger_def TEAM_ROCKET_BASE_B1F, wTeamRocketBaseB1FTrigger
trigger_def TEAM_ROCKET_BASE_B2F, wTeamRocketBaseB2FTrigger
trigger_def TEAM_ROCKET_BASE_B3F, wTeamRocketBaseB3FTrigger
trigger_def UNDERGROUND_PATH_SWITCH_ROOM_ENTRANCES, wUndergroundPathSwitchRoomEntrancesTrigger
trigger_def SILVER_CAVE_ROOM_3, wSilverCaveRoom3Trigger
trigger_def VICTORY_ROAD, wVictoryRoadTrigger
trigger_def DRAGONS_DEN_B1F, wDragonsDenB1FTrigger
trigger_def DRAGON_SHRINE, wDragonShrineTrigger
trigger_def OLIVINE_PORT, wOlivinePortTrigger
trigger_def VERMILION_PORT, wVermilionPortTrigger
trigger_def FAST_SHIP_1F, wFastShip1FTrigger
trigger_def FAST_SHIP_B1F, wFastShipB1FTrigger
trigger_def MOUNT_MOON_SQUARE, wMountMoonSquareTrigger
trigger_def MOBILE_TRADE_ROOM_MOBILE, wMobileTradeRoomMobileTrigger
trigger_def MOBILE_BATTLE_ROOM, wMobileBattleRoomTrigger
db $ff
; 4d15b
Function4d15b:: ; 4d15b
ld hl, $c608
ld a, [$d196]
and a
jr z, .asm_4d168
ld bc, $0030
add hl, bc
.asm_4d168
ld a, [$d197]
and a
jr z, .asm_4d170
inc hl
inc hl
.asm_4d170
ld de, TileMap
ld b, SCREEN_HEIGHT
.asm_4d175
ld c, SCREEN_WIDTH
.asm_4d177
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .asm_4d177
ld a, l
add $4
ld l, a
jr nc, .asm_4d184
inc h
.asm_4d184
dec b
jr nz, .asm_4d175
ret
; 4d188
Function4d188: ; 4d188
ld a, [hCGB]
and a
jp z, WaitBGMap
ld a, [$c2ce]
cp $0
jp z, WaitBGMap
ld a, [hBGMapMode]
push af
xor a
ld [hBGMapMode], a
ld a, [$ffde]
push af
xor a
ld [$ffde], a
.asm_4d1a2
ld a, [rLY]
cp $8f
jr c, .asm_4d1a2
di
ld a, $1
ld [rVBK], a
ld hl, AttrMap
call Function4d1cb
ld a, $0
ld [rVBK], a
ld hl, TileMap
call Function4d1cb
.asm_4d1bd
ld a, [rLY]
cp $8f
jr c, .asm_4d1bd
ei
pop af
ld [$ffde], a
pop af
ld [hBGMapMode], a
ret
; 4d1cb
Function4d1cb: ; 4d1cb
ld [hSPBuffer], sp
ld sp, hl
ld a, [$ffd7]
ld h, a
ld l, $0
ld a, $12
ld [$ffd3], a
ld b, $2
ld c, $41
.asm_4d1dc
pop de
.asm_4d1dd
ld a, [$ff00+c]
and b
jr nz, .asm_4d1dd
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4d1e6
ld a, [$ff00+c]
and b
jr nz, .asm_4d1e6
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4d1ef
ld a, [$ff00+c]
and b
jr nz, .asm_4d1ef
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4d1f8
ld a, [$ff00+c]
and b
jr nz, .asm_4d1f8
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4d201
ld a, [$ff00+c]
and b
jr nz, .asm_4d201
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4d20a
ld a, [$ff00+c]
and b
jr nz, .asm_4d20a
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4d213
ld a, [$ff00+c]
and b
jr nz, .asm_4d213
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4d21c
ld a, [$ff00+c]
and b
jr nz, .asm_4d21c
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4d225
ld a, [$ff00+c]
and b
jr nz, .asm_4d225
ld [hl], e
inc l
ld [hl], d
inc l
pop de
.asm_4d22e
ld a, [$ff00+c]
and b
jr nz, .asm_4d22e
ld [hl], e
inc l
ld [hl], d
inc l
ld de, $000c
add hl, de
ld a, [$ffd3]
dec a
ld [$ffd3], a
jr nz, .asm_4d1dc
ld a, [hSPBuffer]
ld l, a
ld a, [$ffda]
ld h, a
ld sp, hl
ret
; 4d249
Shrink1Pic: ; 4d249
INCBIN "gfx/shrink1.2bpp.lz"
Shrink2Pic: ; 4d2d9
INCBIN "gfx/shrink2.2bpp.lz"
; 4d319
Function4d319: ; 4d319
ld a, [$cfa9]
dec a
ld [CurPartyMon], a
call LowVolume
predef StatsScreenInit
ld a, [CurPartyMon]
inc a
ld [$cfa9], a
call ClearScreen
call WhiteBGMap
call MaxVolume
callba Function28ef8
callba Function4d354
callba Function16d673
callba Function28eff
call Function3200
ret
; 4d354
Function4d354: ; 4d354
call WaitBGMap
call Function3200
ret
; 4d35b
Function4d35b: ; 4d35b
ld h, d
ld l, e
push bc
push hl
call Function4d37e
pop hl
pop bc
ld de, AttrMap - TileMap
add hl, de
inc b
inc b
inc c
inc c
ld a, $7
.asm_4d36e
push bc
push hl
.asm_4d370
ld [hli], a
dec c
jr nz, .asm_4d370
pop hl
ld de, $0014
add hl, de
pop bc
dec b
jr nz, .asm_4d36e
ret
; 4d37e
Function4d37e: ; 4d37e
push hl
ld a, $76
ld [hli], a
inc a
call Function4d3ab
inc a
ld [hl], a
pop hl
ld de, $0014
add hl, de
.asm_4d38d
push hl
ld a, $79
ld [hli], a
ld a, $7f
call Function4d3ab
ld [hl], $7a
pop hl
ld de, $0014
add hl, de
dec b
jr nz, .asm_4d38d
ld a, $7b
ld [hli], a
ld a, $7c
call Function4d3ab
ld [hl], $7d
ret
; 4d3ab
Function4d3ab: ; 4d3ab
ld d, c
.asm_4d3ac
ld [hli], a
dec d
jr nz, .asm_4d3ac
ret
; 4d3b1
Function4d3b1: ; 4d3b1
callba Function8000
ld b, $8
call GetSGBLayout
call Functione51
call Functione5f
ld de, MUSIC_MAIN_MENU
call PlayMusic
ld hl, UnknownText_0x4d408
call PrintText
ld hl, MenuDataHeader_0x4d40d
call Function1d3c
call Function1d81
ret c
ld a, [$cfa9]
cp $1
ret z
call Function4d41e
jr c, .asm_4d3f7
ld a, $0
call GetSRAMBank
ld a, $80
ld [$ac60], a
call CloseSRAM
ld hl, UnknownText_0x4d3fe
call PrintText
ret
.asm_4d3f7
ld hl, UnknownText_0x4d403
call PrintText
ret
; 4d3fe
UnknownText_0x4d3fe: ; 0x4d3fe
; Password OK. Select CONTINUE & reset settings.
text_jump UnknownText_0x1c55db
db "@"
; 0x4d403
UnknownText_0x4d403: ; 0x4d403
; Wrong password!
text_jump UnknownText_0x1c560b
db "@"
; 0x4d408
UnknownText_0x4d408: ; 0x4d408
; Reset the clock?
text_jump UnknownText_0x1c561c
db "@"
; 0x4d40d
MenuDataHeader_0x4d40d: ; 0x4d40d
db $00 ; flags
db 07, 14 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x4d415
db 1 ; default option
; 0x4d415
MenuData2_0x4d415: ; 0x4d415
db $c0 ; flags
db 2 ; items
db "NO@"
db "YES@"
; 0x4d41e
Function4d41e: ; 4d41e
call Function4d50f
push de
ld hl, StringBuffer2
ld bc, $0005
xor a
call ByteFill
ld a, $4
ld [$d08b], a
ld hl, UnknownText_0x4d463
call PrintText
.asm_4d437
call Function4d468
.asm_4d43a
call Functiona57
ld a, [$ffa9]
ld b, a
and $1
jr nz, .asm_4d453
ld a, b
and $f0
jr z, .asm_4d43a
call Function4d490
ld c, $3
call DelayFrames
jr .asm_4d437
.asm_4d453
call Function4d4e0
pop de
ld a, e
cp l
jr nz, .asm_4d461
ld a, d
cp h
jr nz, .asm_4d461
and a
ret
.asm_4d461
scf
ret
; 4d463
UnknownText_0x4d463: ; 0x4d463
; Please enter the password.
text_jump UnknownText_0x1c562e
db "@"
; 0x4d468
Function4d468: ; 4d468
hlcoord 14, 15
ld de, StringBuffer2
ld c, $5
.asm_4d470
ld a, [de]
add $f6
ld [hli], a
inc de
dec c
jr nz, .asm_4d470
hlcoord 14, 16
ld bc, $0005
ld a, $7f
call ByteFill
hlcoord 14, 16
ld a, [$d08b]
ld e, a
ld d, $0
add hl, de
ld [hl], $61
ret
; 4d490
Function4d490: ; 4d490
ld a, b
and $20
jr nz, .asm_4d4a5
ld a, b
and $10
jr nz, .asm_4d4af
ld a, b
and $40
jr nz, .asm_4d4ba
ld a, b
and $80
jr nz, .asm_4d4c8
ret
.asm_4d4a5
ld a, [$d08b]
and a
ret z
dec a
ld [$d08b], a
ret
.asm_4d4af
ld a, [$d08b]
cp $4
ret z
inc a
ld [$d08b], a
ret
.asm_4d4ba
call Function4d4d5
ld a, [hl]
cp $9
jr z, .asm_4d4c5
inc a
ld [hl], a
ret
.asm_4d4c5
ld [hl], $0
ret
.asm_4d4c8
call Function4d4d5
ld a, [hl]
and a
jr z, .asm_4d4d2
dec a
ld [hl], a
ret
.asm_4d4d2
ld [hl], $9
ret
; 4d4d5
Function4d4d5: ; 4d4d5
ld a, [$d08b]
ld e, a
ld d, $0
ld hl, StringBuffer2
add hl, de
ret
; 4d4e0
Function4d4e0: ; 4d4e0
ld hl, 0
ld de, $d08a
ld bc, 1
call Function4d501
ld bc, 10
call Function4d501
ld bc, 100
call Function4d501
ld bc, 1000
call Function4d501
ld bc, 10000
Function4d501: ; 4d501
ld a, [de]
dec de
push hl
ld hl, 0
call AddNTimes
ld c, l
ld b, h
pop hl
add hl, bc
ret
; 4d50f
Function4d50f: ; 4d50f
ld a, $1
call GetSRAMBank
ld de, $0000
ld hl, $a009
ld c, $2
call Function4d533
ld hl, $a00b
ld c, $5
call Function4d53e
ld hl, $a3dc
ld c, $3
call Function4d533
call CloseSRAM
ret
; 4d533
Function4d533: ; 4d533
.asm_4d533
ld a, [hli]
add e
ld e, a
ld a, $0
adc d
ld d, a
dec c
jr nz, .asm_4d533
ret
; 4d53e
Function4d53e: ; 4d53e
.asm_4d53e
ld a, [hli]
cp "@"
ret z
add e
ld e, a
ld a, $0
adc d
ld d, a
dec c
jr nz, .asm_4d53e
ret
; 4d54c
Function4d54c: ; 4d54c
callba Function8000
ld b, $8
call GetSGBLayout
call Functione51
call Functione5f
ld de, MUSIC_MAIN_MENU
call PlayMusic
ld hl, UnknownText_0x4d580
call PrintText
ld hl, MenuDataHeader_0x4d585
call Function1d3c
call Function1d81
ret c
ld a, [$cfa9]
cp $1
ret z
callba Function4cf1f
ret
; 4d580
UnknownText_0x4d580: ; 0x4d580
; Clear all save data?
text_jump UnknownText_0x1c564a
db "@"
; 0x4d585
MenuDataHeader_0x4d585: ; 0x4d585
db $00 ; flags
db 07, 14 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x4d58d
db 1 ; default option
; 0x4d58d
MenuData2_0x4d58d: ; 0x4d58d
db $c0 ; flags
db 2 ; items
db "NO@"
db "YES@"
; 0x4d596
Tilesets::
INCLUDE "tilesets/tileset_headers.asm"
FlagPredef: ; 4d7c1
; Perform action b on flag c in flag array hl.
; If checking a flag, check flag array d:hl unless d is 0.
; For longer flag arrays, see FlagAction.
push hl
push bc
; Divide by 8 to get the byte we want.
push bc
srl c
srl c
srl c
ld b, 0
add hl, bc
pop bc
; Which bit we want from the byte
ld a, c
and 7
ld c, a
; Shift left until we can mask the bit
ld a, 1
jr z, .shifted
.shift
add a
dec c
jr nz, .shift
.shifted
ld c, a
; What are we doing to this flag?
dec b
jr z, .set ; 1
dec b
jr z, .check ; 2
.reset
ld a, c
cpl
and [hl]
ld [hl], a
jr .done
.set
ld a, [hl]
or c
ld [hl], a
jr .done
.check
ld a, d
cp 0
jr nz, .farcheck
ld a, [hl]
and c
jr .done
.farcheck
call GetFarByte
and c
.done
pop bc
pop hl
ld c, a
ret
; 4d7fd
Function4d7fd: ; 4d7fd
ld a, [PlayerLightScreenCount]
ld hl, $c72f
ld de, VTiles2
push de
push af
predef GetUnownLetter
pop af
ld [CurPartySpecies], a
ld [CurSpecies], a
call GetBaseData
pop de
predef Function5108b
ret
; 4d81e
Function4d81e: ; 4d81e
ld a, [PlayerLightScreenCount]
call IsAPokemon
ret c
callba Function29549
ld a, [PlayerLightScreenCount]
ld [CurPartySpecies], a
ld a, [$c72f]
ld [TempMonDVs], a
ld a, [$c730]
ld [$d124], a
ld b, $1a
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
callba Function294c0
ld a, [PlayerLightScreenCount]
ld [CurPartySpecies], a
hlcoord 7, 2
ld d, $0
ld e, $3
predef Functiond008e
ret
; 4d860
CheckPokerus: ; 4d860
; Return carry if a monster in your party has Pokerus
; Get number of monsters to iterate over
ld a, [PartyCount]
and a
jr z, .NoPokerus
ld b, a
; Check each monster in the party for Pokerus
ld hl, PartyMon1PokerusStatus
ld de, PartyMon2 - PartyMon1
.Check
ld a, [hl]
and $0f ; only the bottom nybble is used
jr nz, .HasPokerus
; Next PartyMon
add hl, de
dec b
jr nz, .Check
.NoPokerus
and a
ret
.HasPokerus
scf
ret
; 4d87a
Function4d87a: ; 4d87a
xor a
ld [ScriptVar], a
ld [$d265], a
ld a, [PartyCount]
and a
ret z
ld d, a
ld hl, PartyMon1ID
ld bc, PartySpecies
.asm_4d88d
ld a, [bc]
inc bc
cp EGG
call nz, Function4d939
push bc
ld bc, PartyMon2 - PartyMon1
add hl, bc
pop bc
dec d
jr nz, .asm_4d88d
ld a, $1
call GetSRAMBank
ld a, [sBoxCount]
and a
jr z, .asm_4d8c8
ld d, a
ld hl, sBoxMon1ID
ld bc, sBoxSpecies
.asm_4d8af
ld a, [bc]
inc bc
cp EGG
jr z, .asm_4d8bf
call Function4d939
jr nc, .asm_4d8bf
ld a, $1
ld [$d265], a
.asm_4d8bf
push bc
ld bc, sBoxMon2 - sBoxMon1
add hl, bc
pop bc
dec d
jr nz, .asm_4d8af
.asm_4d8c8
call CloseSRAM
ld c, $0
.asm_4d8cd
ld a, [wCurBox]
and $f
cp c
jr z, .asm_4d90b
ld hl, Unknown_4d99f
ld b, 0
add hl, bc
add hl, bc
add hl, bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
and a
jr z, .asm_4d90b
push bc
ld b, h
ld c, l
inc bc
ld de, $001c
add hl, de
ld d, a
.asm_4d8f1
ld a, [bc]
inc bc
cp EGG
jr z, .asm_4d901
call Function4d939
jr nc, .asm_4d901
ld a, $1
ld [$d265], a
.asm_4d901
push bc
ld bc, sBoxMon2 - sBoxMon1
add hl, bc
pop bc
dec d
jr nz, .asm_4d8f1
pop bc
.asm_4d90b
inc c
ld a, c
cp NUM_BOXES
jr c, .asm_4d8cd
call CloseSRAM
ld a, [ScriptVar]
and a
ret z
callba Function1060cd
ld a, [$d265]
and a
push af
ld a, [CurPartySpecies]
ld [$d265], a
call GetPokemonName
ld hl, UnknownText_0x4d9c9
pop af
jr z, .asm_4d936
ld hl, UnknownText_0x4d9ce
.asm_4d936
jp PrintText
; 4d939
Function4d939: ; 4d939
push bc
push de
push hl
ld d, h
ld e, l
ld hl, Buffer1
ld bc, $8205
call PrintNum
ld hl, DefaultFlypoint
ld de, $dc9f
ld bc, $8205
call PrintNum
ld b, $5
ld c, $0
ld hl, EndFlypoint
ld de, $d1ee
.asm_4d95d
ld a, [de]
cp [hl]
jr nz, .asm_4d967
dec de
dec hl
inc c
dec b
jr nz, .asm_4d95d
.asm_4d967
pop hl
push hl
ld de, -6
add hl, de
ld a, [hl]
pop hl
pop de
push af
ld a, c
ld b, $1
cp $5
jr z, .asm_4d984
ld b, $2
cp $3
jr nc, .asm_4d984
ld b, $3
cp $2
jr nz, .asm_4d99b
.asm_4d984
inc b
ld a, [ScriptVar]
and a
jr z, .asm_4d98e
cp b
jr c, .asm_4d99b
.asm_4d98e
dec b
ld a, b
ld [ScriptVar], a
pop bc
ld a, b
ld [CurPartySpecies], a
pop bc
scf
ret
.asm_4d99b
pop bc
pop bc
and a
ret
; 4d99f
Unknown_4d99f: ; 4d99f
; bank, address
dbw $02, $a000
dbw $02, $a450
dbw $02, $a8a0
dbw $02, $acf0
dbw $02, $b140
dbw $02, $b590
dbw $02, $b9e0
dbw $03, $a000
dbw $03, $a450
dbw $03, $a8a0
dbw $03, $acf0
dbw $03, $b140
dbw $03, $b590
dbw $03, $b9e0
; 4d9c9
UnknownText_0x4d9c9: ; 0x4d9c9
; Congratulations! We have a match with the ID number of @ in your party.
text_jump UnknownText_0x1c1261
db "@"
; 0x4d9ce
UnknownText_0x4d9ce: ; 0x4d9ce
; Congratulations! We have a match with the ID number of @ in your PC BOX.
text_jump UnknownText_0x1c12ae
db "@"
; 0x4d9d3
Function4d9d3: ; 4d9d3
ld hl, StringBuffer3
ld de, $dc9f
ld bc, $8205
call PrintNum
ld a, $50
ld [$d09e], a
ret
; 4d9e5
Function4d9e5: ; 4d9e5
ld a, [$df9c]
and a
jp z, Function4db35
ld [CurPartySpecies], a
ld [CurSpecies], a
call GetBaseData
ld hl, PartyCount
ld a, [hl]
cp $6
jp nc, Function4daa3
inc a
ld [hl], a
ld c, a
ld b, $0
add hl, bc
ld a, [$df9c]
ld [hli], a
ld [CurSpecies], a
ld a, $ff
ld [hl], a
ld hl, PartyMon1Species
ld a, [PartyCount]
dec a
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld d, h
ld e, l
ld hl, $df9c
ld bc, PartyMon2 - PartyMon1
call CopyBytes
ld a, [PartyCount]
dec a
ld hl, PartyMonOT
call SkipNames
ld d, h
ld e, l
ld hl, PlayerName
call CopyBytes
ld a, [CurPartySpecies]
ld [$d265], a
call GetPokemonName
ld hl, StringBuffer1
ld de, $d050
ld bc, $000b
call CopyBytes
call Function4db3b
jr c, .asm_4da66
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
xor a
ld [MonType], a
ld de, $d050
callab Functione3de
.asm_4da66
ld a, [PartyCount]
dec a
ld hl, PartyMonNicknames
call SkipNames
ld d, h
ld e, l
ld hl, $d050
call CopyBytes
ld a, [PartyCount]
dec a
ld hl, PartyMon1Level
call GetPartyLocation
ld a, [hl]
ld [CurPartyLevel], a
call Function4db49
ld a, [PartyCount]
dec a
ld hl, PartyMon1CaughtLocation
call GetPartyLocation
ld a, [hl]
and $80
ld b, $13
or b
ld [hl], a
xor a
ld [$df9c], a
and a
ld [ScriptVar], a
ret
; 4daa3
Function4daa3: ; 4daa3
ld a, $1
call GetSRAMBank
ld hl, sBoxCount
ld a, [hl]
cp MONS_PER_BOX
call CloseSRAM
jr nc, .asm_4db08
xor a
ld [CurPartyMon], a
ld hl, $df9c
ld de, $d018
ld bc, sBoxMon2 - sBoxMon1
call CopyBytes
ld hl, PlayerName
ld de, $d00d
ld bc, NAME_LENGTH
call CopyBytes
callab Function51322
ld a, [CurPartySpecies]
ld [$d265], a
call GetPokemonName
call Function4db3b
ld hl, StringBuffer1
jr c, .asm_4daf7
ld a, BOXMON
ld [MonType], a
ld de, $d050
callab Functione3de
ld hl, $d050
.asm_4daf7
ld a, $1
call GetSRAMBank
ld de, sBoxMonNicknames
ld bc, PKMN_NAME_LENGTH
call CopyBytes
call CloseSRAM
.asm_4db08
ld a, $1
call GetSRAMBank
ld a, [sBoxMon1Level]
ld [CurPartyLevel], a
call CloseSRAM
call Function4db83
ld a, $1
call GetSRAMBank
ld hl, sBoxMon1CaughtLocation
ld a, [hl]
and $80
ld b, $13
or b
ld [hl], a
call CloseSRAM
xor a
ld [$df9c], a
ld a, $1
ld [ScriptVar], a
ret
; 4db35
Function4db35: ; 4db35
ld a, $2
ld [ScriptVar], a
ret
; 4db3b
Function4db3b: ; 4db3b
ld hl, UnknownText_0x4db44
call PrintText
jp YesNoBox
; 4db44
UnknownText_0x4db44: ; 0x4db44
; Give a nickname to the @ you received?
text_jump UnknownText_0x1c12fc
db "@"
; 0x4db49
Function4db49: ; 4db49
ld a, [PartyCount]
dec a
ld hl, PartyMon1CaughtLevel
call GetPartyLocation
Function4db53: ; 4db53
ld a, [TimeOfDay]
inc a
rrca
rrca
ld b, a
ld a, [CurPartyLevel]
or b
ld [hli], a
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
cp MAP_POKECENTER_2F
jr nz, .asm_4db78
ld a, b
cp GROUP_POKECENTER_2F
jr nz, .asm_4db78
ld a, [BackupMapGroup]
ld b, a
ld a, [BackupMapNumber]
ld c, a
.asm_4db78
call GetWorldMapLocation
ld b, a
ld a, [PlayerGender]
rrca
or b
ld [hl], a
ret
; 4db83
Function4db83: ; 4db83
ld a, $1
call GetSRAMBank
ld hl, sBoxMon1CaughtLevel
call Function4db53
call CloseSRAM
ret
; 4db92
Function4db92: ; 4db92
push bc
ld a, $1
call GetSRAMBank
ld hl, sBoxMon1CaughtLevel
pop bc
call Function4dbaf
call CloseSRAM
ret
; 4dba3
Function4dba3: ; 4dba3
ld a, [PartyCount]
dec a
ld hl, PartyMon1CaughtLevel
push bc
call GetPartyLocation
pop bc
Function4dbaf: ; 4dbaf
xor a
ld [hli], a
ld a, $7e
rrc b
or b
ld [hl], a
ret
; 4dbb8
Function4dbb8: ; 4dbb8 (13:5bb8)
ld a, [CurPartyMon] ; $d109
ld hl, PartyMon1CaughtLevel ; $dcfc
call GetPartyLocation
ld a, [CurPartyLevel] ; $d143
push af
ld a, $1
ld [CurPartyLevel], a ; $d143
call Function4db53
pop af
ld [CurPartyLevel], a ; $d143
ret
Function4dbd2: ; 4dbd2
ld hl, PartyMon1Level
call Function4dc31
ret
; 4dbd9
Function4dbd9: ; 4dbd9
ld hl, PartyMon1Happiness
call Function4dc0a
ret
; 4dbe0
Function4dbe0: ; 4dbe0
ld hl, PartyMon1Species
jp Function4dc56
; 4dbe6
Function4dbe6: ; 4dbe6
ld hl, PartyMon1Species
call Function4dc56
ret z
ld a, c
ld hl, PartyMon1ID
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld a, [PlayerID]
cp [hl]
jr nz, .asm_4dc08
inc hl
ld a, [$d47c]
cp [hl]
jr nz, .asm_4dc08
ld a, $1
and a
ret
.asm_4dc08
xor a
ret
; 4dc0a
Function4dc0a: ; 4dc0a
ld c, $0
ld a, [PartyCount]
ld d, a
.asm_4dc10
ld a, d
dec a
push hl
push bc
ld bc, PartyMon2 - PartyMon1
call AddNTimes
pop bc
ld a, b
cp [hl]
pop hl
jr z, .asm_4dc22
jr nc, .asm_4dc26
.asm_4dc22
ld a, c
or $1
ld c, a
.asm_4dc26
sla c
dec d
jr nz, .asm_4dc10
call Function4dc67
ld a, c
and a
ret
; 4dc31
Function4dc31: ; 4dc31
ld c, $0
ld a, [PartyCount]
ld d, a
.asm_4dc37
ld a, d
dec a
push hl
push bc
ld bc, PartyMon2 - PartyMon1
call AddNTimes
pop bc
ld a, b
cp [hl]
pop hl
jr c, .asm_4dc4b
ld a, c
or $1
ld c, a
.asm_4dc4b
sla c
dec d
jr nz, .asm_4dc37
call Function4dc67
ld a, c
and a
ret
; 4dc56
Function4dc56: ; 4dc56
ld c, $ff
ld hl, PartySpecies
.asm_4dc5b
ld a, [hli]
cp $ff
ret z
inc c
cp b
jr nz, .asm_4dc5b
ld a, $1
and a
ret
; 4dc67
Function4dc67: ; 4dc67
ld e, $fe
ld hl, PartySpecies
.asm_4dc6c
ld a, [hli]
cp $ff
ret z
cp EGG
jr nz, .asm_4dc77
ld a, c
and e
ld c, a
.asm_4dc77
rlc e
jr .asm_4dc6c
; 4dc7b
Function4dc7b: ; 4dc7b (13:5c7b)
ld a, [InLinkBattle] ; $c2dc
cp $4
jr nz, StatsScreenInit
ld a, [IsInBattle] ; $d22d (aliases: EnemyMonEnd)
and a
jr z, StatsScreenInit
jr Function4dc8f
StatsScreenInit: ; 4dc8a
ld hl, StatsScreenMain
jr StatsScreenInit_gotaddress
Function4dc8f: ; 4dc8f
ld hl, StatsScreenBattle
jr StatsScreenInit_gotaddress
StatsScreenInit_gotaddress: ; 4dc94
ld a, [$ffde]
push af
xor a
ld [$ffde], a ; disable overworld tile animations
ld a, [$c2c6] ; whether sprite is to be mirrorred
push af
ld a, [$cf63]
ld b, a
ld a, [$cf64]
ld c, a
push bc
push hl
call WhiteBGMap
call ClearTileMap
call Function1ad2
callba Functionfb53e
pop hl
call _hl_
call WhiteBGMap
call ClearTileMap
pop bc
; restore old values
ld a, b
ld [$cf63], a
ld a, c
ld [$cf64], a
pop af
ld [$c2c6], a
pop af
ld [$ffde], a
ret
; 0x4dcd2
StatsScreenMain: ; 0x4dcd2
xor a
ld [$cf63], a
ld [$cf64], a
ld a, [$cf64]
and $fc
or $1
ld [$cf64], a
.loop ; 4dce3
ld a, [$cf63]
and $7f
ld hl, StatsScreenPointerTable
rst JumpTable
call Function4dd3a ; check for keys?
ld a, [$cf63]
bit 7, a
jr z, .loop
ret
; 0x4dcf7
StatsScreenBattle: ; 4dcf7
xor a
ld [$cf63], a
ld [$cf64], a
ld a, [$cf64]
and $fc
or $1
ld [$cf64], a
.asm_4dd08
callba Function100dd2
ld a, [$cf63]
and $7f
ld hl, StatsScreenPointerTable
rst JumpTable
call Function4dd3a
callba Function100dfd
jr c, .asm_4dd29
ld a, [$cf63]
bit 7, a
jr z, .asm_4dd08
.asm_4dd29
ret
; 4dd2a
StatsScreenPointerTable: ; 4dd2a
dw Function4dd72 ; regular pokémon
dw EggStatsInit ; egg
dw Function4dde6
dw Function4ddac
dw Function4ddc6
dw Function4dde6
dw Function4ddd6
dw Function4dd6c
; 4dd3a
Function4dd3a: ; 4dd3a (13:5d3a)
ld hl, $cf64
bit 6, [hl]
jr nz, .asm_4dd49
bit 5, [hl]
jr nz, .asm_4dd56
call DelayFrame
ret
.asm_4dd49
callba Functiond00b4
jr nc, .asm_4dd56
ld hl, $cf64
res 6, [hl]
.asm_4dd56
ld hl, $cf64
res 5, [hl]
callba Function10402d
ret
Function4dd62: ; 4dd62 (13:5d62)
ld a, [$cf63]
and $80
or h
ld [$cf63], a
ret
Function4dd6c: ; 4dd6c (13:5d6c)
ld hl, $cf63
set 7, [hl]
ret
Function4dd72: ; 4dd72 (13:5d72)
ld hl, $cf64
res 6, [hl]
call WhiteBGMap
call ClearTileMap
callba Function10402d
call Function4ddf2
ld a, [CurPartySpecies] ; $d108
cp EGG
jr z, .asm_4dd9b
call Function4deea
ld hl, $cf64
set 4, [hl]
ld h, $4
call Function4dd62
ret
.asm_4dd9b
ld h, $1
call Function4dd62
ret
EggStatsInit: ; 4dda1
call EggStatsScreen
ld a, [$cf63]
inc a
ld [$cf63], a
ret
; 0x4ddac
Function4ddac: ; 4ddac (13:5dac)
call Function4de2c
jr nc, .asm_4ddb7
ld h, $0
call Function4dd62
ret
.asm_4ddb7
bit 0, a
jr nz, .asm_4ddc0
and $c3
jp Function4de54
.asm_4ddc0
ld h, $7
call Function4dd62
ret
Function4ddc6: ; 4ddc6 (13:5dc6)
call Function4dfb6
ld hl, $cf64
res 4, [hl]
ld a, [$cf63]
inc a
ld [$cf63], a
ret
Function4ddd6: ; 4ddd6 (13:5dd6)
call Function4de2c
jr nc, .asm_4dde1
ld h, $0
call Function4dd62
ret
.asm_4dde1
and $f3
jp Function4de54
Function4dde6: ; 4dde6 (13:5de6)
call IsSFXPlaying
ret nc
ld a, [$cf63]
inc a
ld [$cf63], a
ret
Function4ddf2: ; 4ddf2 (13:5df2)
ld a, [MonType] ; $cf5f
cp $3
jr nz, .asm_4de10
ld a, [$d018]
ld [CurSpecies], a ; $cf60
call GetBaseData
ld hl, $d018
ld de, TempMon ; $d10e
ld bc, $30
call CopyBytes
jr .asm_4de2a
.asm_4de10
callba Function5084a
ld a, [CurPartySpecies] ; $d108
cp EGG
jr z, .asm_4de2a
ld a, [MonType] ; $cf5f
cp $2
jr c, .asm_4de2a
callba Function50890
.asm_4de2a
and a
ret
Function4de2c: ; 4de2c (13:5e2c)
call GetJoypad
ld a, [MonType] ; $cf5f
cp $3
jr nz, .asm_4de4e
push hl
push de
push bc
callba Functione2f95
pop bc
pop de
pop hl
ld a, [$cf73]
and $c0
jr nz, .asm_4de52
ld a, [$cf73]
jr .asm_4de50
.asm_4de4e
ld a, [hJoyPressed] ; $ff00+$a7
.asm_4de50
and a
ret
.asm_4de52
scf
ret
Function4de54: ; 4de54 (13:5e54)
push af
ld a, [$cf64]
and $3
ld c, a
pop af
bit 1, a
jp nz, Function4dee4
bit 5, a
jr nz, .asm_4dec7
bit 4, a
jr nz, .asm_4debd
bit 0, a
jr nz, .asm_4deb8
bit 6, a
jr nz, .asm_4dea0
bit 7, a
jr nz, .asm_4de77
jr .asm_4dece
.asm_4de77
ld a, [MonType] ; $cf5f
cp $2
jr nc, .asm_4dece
and a
ld a, [PartyCount] ; $dcd7
jr z, .asm_4de87
ld a, [OTPartyCount] ; $d280
.asm_4de87
ld b, a
ld a, [CurPartyMon] ; $d109
inc a
cp b
jr z, .asm_4dece
ld [CurPartyMon], a ; $d109
ld b, a
ld a, [MonType] ; $cf5f
and a
jr nz, .asm_4dede
ld a, b
inc a
ld [$d0d8], a
jr .asm_4dede
.asm_4dea0
ld a, [CurPartyMon] ; $d109
and a
jr z, .asm_4dece
dec a
ld [CurPartyMon], a ; $d109
ld b, a
ld a, [MonType] ; $cf5f
and a
jr nz, .asm_4dede
ld a, b
inc a
ld [$d0d8], a
jr .asm_4dede
.asm_4deb8
ld a, c
cp $3
jr z, Function4dee4
.asm_4debd
inc c
ld a, $3
cp c
jr nc, .asm_4decf
ld c, $1
jr .asm_4decf
.asm_4dec7
dec c
jr nz, .asm_4decf
ld c, $3
jr .asm_4decf
.asm_4dece
ret
.asm_4decf
ld a, [$cf64]
and $fc
or c
ld [$cf64], a
ld h, $4
call Function4dd62
ret
.asm_4dede
ld h, $0
call Function4dd62
ret
Function4dee4: ; 4dee4 (13:5ee4)
ld h, $7
call Function4dd62
ret
Function4deea: ; 4deea (13:5eea)
call Function4df45
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, [CurBaseData] ; $d236 (aliases: BaseDexNo)
ld [$d265], a
ld [CurSpecies], a ; $cf60
hlcoord 8, 0
ld [hl], "№"
inc hl
ld [hl], "."
inc hl
hlcoord 10, 0
ld bc, $8103
ld de, $d265
call PrintNum
hlcoord 14, 0
call PrintLevel
ld hl, Unknown_4df77
call Function4e528
call Function4e505
hlcoord 8, 2
call PlaceString
hlcoord 18, 0
call Function4df66
hlcoord 9, 4
ld a, $f3
ld [hli], a
ld a, [CurBaseData] ; $d236 (aliases: BaseDexNo)
ld [$d265], a
call GetPokemonName
call PlaceString
call Function4df8f
call Function4df9b
call Function4dfa6
ret
Function4df45: ; 4df45 (13:5f45)
ld hl, TempMonHP ; $d130
ld a, [hli]
ld b, a
ld c, [hl]
ld hl, TempMonMaxHP ; $d132
ld a, [hli]
ld d, a
ld e, [hl]
callba Functionc699
ld hl, $cda1
call SetHPPal
ld b, $3
call GetSGBLayout
call DelayFrame
ret
Function4df66: ; 4df66 (13:5f66)
push hl
callba GetGender
pop hl
ret c
ld a, "♂"
jr nz, .asm_4df75
ld a, "♀"
.asm_4df75
ld [hl], a
ret
; 4df77 (13:5f77)
Unknown_4df77: ; 4df77
dw $de41
dw $d3ea
dw $b082
dw $d002
; 4df7f
Function4df7f: ; 4df7f
hlcoord 7, 0
ld bc, 20
ld d, 18
.asm_4df87
ld a, $31
ld [hl], a
add hl, bc
dec d
jr nz, .asm_4df87
ret
; 4df8f
Function4df8f: ; 4df8f (13:5f8f)
hlcoord 0, 7
ld b, 20
ld a, $62
.asm_4df96
ld [hli], a
dec b
jr nz, .asm_4df96
ret
Function4df9b: ; 4df9b (13:5f9b)
hlcoord 12, 6
ld [hl], $71
hlcoord 19, 6
ld [hl], $ed
ret
Function4dfa6: ; 4dfa6 (13:5fa6)
ld bc, TempMonDVs ; $d123
callba CheckShininess
ret nc
hlcoord 19, 0
ld [hl], $3f
ret
Function4dfb6: ; 4dfb6 (13:5fb6)
ld a, [CurBaseData] ; $d236 (aliases: BaseDexNo)
ld [$d265], a
ld [CurSpecies], a ; $cf60
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function4dfda
call Function4e002
call Function4dfed
ld hl, $cf64
bit 4, [hl]
jr nz, .asm_4dfd6
call Function32f9
ret
.asm_4dfd6
call Function4e226
ret
Function4dfda: ; 4dfda (13:5fda)
ld a, [$cf64]
and $3
ld c, a
call Function4e4cd
hlcoord 0, 8
ld bc, $a14
call ClearBox
ret
Function4dfed: ; 4dfed (13:5fed)
ld a, [$cf64]
and $3
ld c, a
callba Function8c8a
call DelayFrame
ld hl, $cf64
set 5, [hl]
ret
Function4e002: ; 4e002 (13:6002)
ld a, [$cf64]
and $3
dec a
ld hl, Jumptable_4e00d
rst JumpTable
ret
Jumptable_4e00d: ; 4e00d (13:600d)
dw Function4e013
dw Function4e147
dw Function4e1ae
Function4e013: ; 4e013 (13:6013)
hlcoord 0, 9
ld b, $0
predef DrawPlayerHP
hlcoord 8, 9
ld [hl], $41
ld de, String_4e119
hlcoord 0, 12
call PlaceString
ld a, [$d12a]
ld b, a
and $f
jr nz, .asm_4e055
ld a, b
and $f0
jr z, .asm_4e03d
hlcoord 8, 8
ld [hl], $e8
.asm_4e03d
ld a, [MonType] ; $cf5f
cp $2
jr z, .asm_4e060
hlcoord 6, 13
push hl
ld de, TempMonStatus ; $d12e
predef Function50d0a
pop hl
jr nz, .asm_4e066
jr .asm_4e060
.asm_4e055
ld de, String_4e142
hlcoord 1, 13
call PlaceString
jr .asm_4e066
.asm_4e060
ld de, String_4e127
call PlaceString
.asm_4e066
hlcoord 1, 15
predef PrintMonTypes
hlcoord 9, 8
ld de, $14
ld b, $a
ld a, $31
.asm_4e078
ld [hl], a
add hl, de
dec b
jr nz, .asm_4e078
ld de, String_4e12b
hlcoord 10, 9
call PlaceString
hlcoord 17, 14
call Function4e0d3
hlcoord 13, 10
ld bc, $307
ld de, TempMonExp ; $d116
call PrintNum
call Function4e0e7
hlcoord 13, 13
ld bc, $307
ld de, Buffer1 ; $d1ea (aliases: MagikarpLength)
call PrintNum
ld de, String_4e136
hlcoord 10, 12
call PlaceString
ld de, String_4e13f
hlcoord 14, 14
call PlaceString
hlcoord 11, 16
ld a, [TempMonLevel] ; $d12d
ld b, a
ld de, $d118
predef FillInExpBar
hlcoord 10, 16
ld [hl], $40
hlcoord 19, 16
ld [hl], $41
ret
Function4e0d3: ; 4e0d3 (13:60d3)
ld a, [TempMonLevel] ; $d12d
push af
cp MAX_LEVEL
jr z, .asm_4e0df
inc a
ld [TempMonLevel], a ; $d12d
.asm_4e0df
call PrintLevel
pop af
ld [TempMonLevel], a ; $d12d
ret
Function4e0e7: ; 4e0e7 (13:60e7)
ld a, [TempMonLevel] ; $d12d
cp MAX_LEVEL
jr z, .asm_4e111
inc a
ld d, a
callba Function50e47
ld hl, $d118
ld hl, $d118
ld a, [$FF00+$b6]
sub [hl]
dec hl
ld [$d1ec], a
ld a, [$FF00+$b5]
sbc [hl]
dec hl
ld [Buffer2], a ; $d1eb (aliases: MovementType)
ld a, [hQuotient] ; $ff00+$b4 (aliases: hMultiplicand)
sbc [hl]
ld [Buffer1], a ; $d1ea (aliases: MagikarpLength)
ret
.asm_4e111
ld hl, Buffer1 ; $d1ea (aliases: MagikarpLength)
xor a
ld [hli], a
ld [hli], a
ld [hl], a
ret
; 4e119 (13:6119)
String_4e119: ; 4e119
db "STATUS/"
next "TYPE/@"
; 4e127
String_4e127: ; 4e127
db "OK @"
; 4e12b
String_4e12b: ; 4e12b
db "EXP POINTS@"
; 4e136
String_4e136: ; 4e136
db "LEVEL UP@"
; 4e13f
String_4e13f: ; 4e13f
db "TO@"
; 4e142
String_4e142: ; 4e142
db "#RUS@"
; 4e147
Function4e147: ; 4e147 (13:6147)
ld de, String_4e1a0
hlcoord 0, 8
call PlaceString
call Function4e189
hlcoord 8, 8
call PlaceString
ld de, String_4e1a9
hlcoord 0, 10
call PlaceString
ld hl, TempMonMoves
ld de, $d25e
ld bc, NUM_MOVES
call CopyBytes
hlcoord 8, 10
ld a, SCREEN_WIDTH * 2
ld [Buffer1], a
predef ListMoves
hlcoord 12, 11
ld a, $28
ld [Buffer1], a
predef Function50c50
ret
Function4e189: ; 4e189 (13:6189)
ld de, String_4e1a5
ld a, [TempMonItem] ; $d10f
and a
ret z
ld b, a
callba Function28771
ld a, b
ld [$d265], a
call GetItemName
ret
; 4e1a0 (13:61a0)
String_4e1a0: ; 4e1a0
db "ITEM@"
; 4e1a5
String_4e1a5: ; 4e1a5
db "---@"
; 4e1a9
String_4e1a9: ; 4e1a9
db "MOVE@"
; 4e1ae
Function4e1ae: ; 4e1ae (13:61ae)
call Function4e1cc
hlcoord 10, 8
ld de, $14
ld b, $a
ld a, $31
.asm_4e1bb
ld [hl], a
add hl, de
dec b
jr nz, .asm_4e1bb
hlcoord 11, 8
ld bc, $6
predef Function50b7b
ret
Function4e1cc: ; 4e1cc (13:61cc)
ld de, IDNoString
hlcoord 0, 9
call PlaceString
ld de, OTString
hlcoord 0, 12
call PlaceString
hlcoord 2, 10
ld bc, $8205
ld de, TempMonID ; $d114
call PrintNum
ld hl, Unknown_4e216
call Function4e528
call Function4e505
callba CheckNickErrors
hlcoord 2, 13
call PlaceString
ld a, [$d12c]
and a
jr z, .asm_4e215
cp $7f
jr z, .asm_4e215
and $80
ld a, "♂"
jr z, .asm_4e211
ld a, "♀"
.asm_4e211
hlcoord 9, 13
ld [hl], a
.asm_4e215
ret
; 4e216 (13:6216)
Unknown_4e216: ; 4e216
dw PartyMonOT
dw OTPartyMonOT
dw sBoxMonOT
dw $d00d
; 4e21e
IDNoString: ; 4e21e
db $73, "№.@"
OTString: ; 4e222
db "OT/@"
; 4e226
Function4e226: ; 4e226 (13:6226)
ld hl, TempMonDVs ; $d123
predef GetUnownLetter
call Function4e2ad
jr c, .asm_4e238
and a
jr z, .asm_4e23f
jr .asm_4e246
.asm_4e238
call Function4e271
call Function32f9
ret
.asm_4e23f
call Function4e253
call Function32f9
ret
.asm_4e246
call Function32f9
call Function4e253
ld a, [CurPartySpecies] ; $d108
call PlayCry2
ret
Function4e253: ; 4e253 (13:6253)
ld hl, $cf64
set 5, [hl]
ld a, [CurPartySpecies] ; $d108
cp UNOWN
jr z, .asm_4e266
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
call Function3786
ret
.asm_4e266
xor a
ld [$c2c6], a
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
call Function378b
ret
Function4e271: ; 4e271 (13:6271)
ld a, [CurPartySpecies] ; $d108
cp UNOWN
jr z, .asm_4e281
ld a, $1
ld [$c2c6], a
call Function4e289
ret
.asm_4e281
xor a
ld [$c2c6], a
call Function4e289
ret
Function4e289: ; 4e289 (13:6289)
ld a, [CurPartySpecies] ; $d108
call IsAPokemon
ret c
call Function4e307
ld de, $9000
predef Function5108b
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld d, $0
ld e, $2
predef Functiond00a3
ld hl, $cf64
set 6, [hl]
ret
Function4e2ad: ; 4e2ad (13:62ad)
ld a, [MonType] ; $cf5f
ld hl, Jumptable_4e2b5
rst JumpTable
ret
Jumptable_4e2b5: ; 4e2b5 (13:62b5)
dw Function4e2bf
dw Function4e2cf
dw Function4e2d1
dw Function4e2ed
dw Function4e301
Function4e2bf: ; 4e2bf (13:62bf)
ld a, [CurPartyMon] ; $d109
ld hl, PartyMons ; $dcdf (aliases: PartyMon1, PartyMon1Species)
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld b, h
ld c, l
jr Function4e2f2
Function4e2cf: ; 4e2cf (13:62cf)
xor a
ret
Function4e2d1: ; 4e2d1 (13:62d1)
ld hl, sBoxMons
ld bc, $30
ld a, [CurPartyMon] ; $d109
call AddNTimes
ld b, h
ld c, l
ld a, $1
call GetSRAMBank
call Function4e2f2
push af
call CloseSRAM
pop af
ret
Function4e2ed: ; 4e2ed (13:62ed)
ld bc, TempMonSpecies ; $d10e (aliases: TempMon)
jr Function4e2f2
Function4e2f2: ; 4e2f2 (13:62f2)
ld a, [CurPartySpecies] ; $d108
cp EGG
jr z, .asm_4e2fe
call Function4e53f
jr c, Function4e305
.asm_4e2fe
xor a
scf
ret
Function4e301: ; 4e301 (13:6301)
ld a, $1
and a
ret
Function4e305: ; 4e305 (13:6305)
xor a
ret
Function4e307: ; 4e307 (13:6307)
nop
push hl
push de
push bc
push af
call DelayFrame
ld a, [rVBK] ; $ff00+$4f
push af
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld de, GFX_f9204
lb bc, BANK(GFX_f9204), 1
ld hl, $97f0
call Get2bpp
pop af
ld [rVBK], a ; $ff00+$4f
pop af
pop bc
pop de
pop hl
ret
; 4e32a (13:632a)
Unknown_4e32a: ; 4e32a
; A blank tile?
ds 16
; 4e33a
EggStatsScreen: ; 4e33a
xor a
ld [hBGMapMode], a
ld hl, $cda1
call SetHPPal
ld b, $3
call GetSGBLayout
call Function4df8f
ld de, EggString
hlcoord 8, 1 ; $c4bc
call PlaceString
ld de, IDNoString
hlcoord 8, 3 ; $c4e4
call PlaceString
ld de, OTString
hlcoord 8, 5 ; $c50c
call PlaceString
ld de, FiveQMarkString
hlcoord 11, 3 ; $c4e7
call PlaceString
ld de, FiveQMarkString
hlcoord 11, 5 ; $c50f
call PlaceString
ld a, [TempMonHappiness] ; egg status
ld de, EggSoonString
cp $6
jr c, .picked
ld de, EggCloseString
cp $b
jr c, .picked
ld de, EggMoreTimeString
cp $29
jr c, .picked
ld de, EggALotMoreTimeString
.picked
hlcoord 1, 9 ; $c555
call PlaceString
ld hl, $cf64
set 5, [hl]
call Function32f9 ; pals
call DelayFrame
ld hl, TileMap
call Function3786
callba Function10402d
call Function4e497
ld a, [TempMonHappiness]
cp 6
ret nc
ld de, SFX_2_BOOPS
call PlaySFX
ret
; 0x4e3c0
EggString: ; 4e3c0
db "EGG@"
FiveQMarkString: ; 4e3c4
db "?????@"
EggSoonString: ; 0x4e3ca
db "It's making sounds"
next "inside. It's going"
next "to hatch soon!@"
EggCloseString: ; 0x4e3fd
db "It moves around"
next "inside sometimes."
next "It must be close"
next "to hatching.@"
EggMoreTimeString: ; 0x4e43d
db "Wonder what's"
next "inside? It needs"
next "more time, though.@"
EggALotMoreTimeString: ; 0x4e46e
db "This EGG needs a"
next "lot more time to"
next "hatch.@"
; 0x4e497
Function4e497: ; 4e497 (13:6497)
call Function4e2ad
ret nc
ld a, [TempMonHappiness] ; $d129
ld e, $7
cp $6
jr c, .asm_4e4ab
ld e, $8
cp $b
jr c, .asm_4e4ab
ret
.asm_4e4ab
push de
ld a, $1
ld [$c2c6], a
call Function4e307
ld de, $9000
predef Function5108b
pop de
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld d, $0
predef Functiond00a3
ld hl, $cf64
set 6, [hl]
ret
Function4e4cd: ; 4e4cd (13:64cd)
hlcoord 13, 5
ld a, $36
call Function4e4f7
hlcoord 15, 5
ld a, $36
call Function4e4f7
hlcoord 17, 5
ld a, $36
call Function4e4f7
ld a, c
cp $2
ld a, $3a
hlcoord 13, 5
jr c, Function4e4f7
hlcoord 15, 5
jr z, Function4e4f7
hlcoord 17, 5
Function4e4f7: ; 4e4f7 (13:64f7)
push bc
ld [hli], a
inc a
ld [hld], a
ld bc, $14
add hl, bc
inc a
ld [hli], a
inc a
ld [hl], a
pop bc
ret
Function4e505: ; 4e505 (13:6505)
ld de, StringBuffer1 ; $d073
ld bc, $b
jr .asm_4e50d
.asm_4e50d
ld a, [MonType] ; $cf5f
cp BOXMON
jr nz, .asm_4e522
ld a, $1
call GetSRAMBank
push de
call CopyBytes
pop de
call CloseSRAM
ret
.asm_4e522
push de
call CopyBytes
pop de
ret
Function4e528: ; 4e528 (13:6528)
ld a, [MonType] ; $cf5f
add a
ld c, a
ld b, 0
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [MonType] ; $cf5f
cp $3
ret z
ld a, [CurPartyMon] ; $d109
jp SkipNames
Function4e53f: ; 4e53f
ld hl, PartyMon1HP - PartyMon1
add hl, bc
ld a, [hli]
or [hl]
jr z, .asm_4e552
ld hl, PartyMon1Status - PartyMon1
add hl, bc
ld a, [hl]
and (1 << FRZ) | SLP
jr nz, .asm_4e552
and a
ret
.asm_4e552
scf
ret
; 4e554
Function4e554:: ; 4e554
ld a, [BattleType]
dec a
ld c, a
ld hl, Jumptable_4e564
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 4e564
Jumptable_4e564: ; 4e564 (13:6564)
dw Function4e56a
dw Function4e56a
dw Function4e56a
Function4e56a: ; 4e56a (13:656a)
ld hl, PlayerName ; $d47d
ld de, MomsName ; $d488
ld bc, NAME_LENGTH
call CopyBytes
ld hl, DudeString
ld de, PlayerName ; $d47d
ld bc, NAME_LENGTH
call CopyBytes
call Function4e5b7
xor a
ld [hJoyDown], a
ld [hJoyPressed], a
ld a, [Options]
push af
and $f8
add $3
ld [Options], a
ld hl, AutoInput_4e5df
ld a, BANK(AutoInput_4e5df)
call StartAutoInput
callab StartBattle
call StopAutoInput
pop af
ld [Options], a ; $cfcc
ld hl, MomsName ; $d488
ld de, PlayerName ; $d47d
ld bc, NAME_LENGTH
call CopyBytes
ret
Function4e5b7: ; 4e5b7 (13:65b7)
ld hl, OTPartyMon1Species ; $d288 (aliases: OTPartyMon1)
ld [hl], $1
inc hl
ld [hl], $12
inc hl
ld [hl], $1
inc hl
ld [hl], $ff
ld hl, $d292
ld [hl], $0
inc hl
ld [hl], $ff
ld hl, $d2a6
ld a, $1
ld [hli], a
ld a, $5
ld [hli], a
ld [hli], a
ld [hl], $ff
ret
; 4e5da (13:65da)
DudeString: ; 4e5da
db "DUDE@"
; 4e5df
AutoInput_4e5df: ; 4e5df
db NO_INPUT, $ff ; end
; 4e5e1
EvolutionAnimation: ; 4e5e1
push hl
push de
push bc
ld a, [CurSpecies]
push af
ld a, [rOBP0]
push af
ld a, [BaseDexNo]
push af
call _EvolutionAnimation
pop af
ld [BaseDexNo], a
pop af
ld [rOBP0], a
pop af
ld [CurSpecies], a
pop bc
pop de
pop hl
ld a, [$d1ed]
and a
ret z
scf
ret
; 4e607
_EvolutionAnimation: ; 4e607
ld a, $e4
ld [rOBP0], a
ld de, MUSIC_NONE
call PlayMusic
callba Function8cf53
ld de, EvolutionGFX
ld hl, VTiles0
lb bc, BANK(EvolutionGFX), 8
call Request2bpp
xor a
ld [Danger], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ld a, [Buffer1]
ld [PlayerHPPal], a
ld c, $0
call Function4e703
ld a, [Buffer1]
ld [CurPartySpecies], a
ld [CurSpecies], a
call Function4e708
ld de, VTiles2
ld hl, $9310
ld bc, $0031
call Request2bpp
ld a, $31
ld [$d1ec], a
call Function4e755
ld a, [Buffer2]
ld [CurPartySpecies], a
ld [CurSpecies], a
call Function4e711
ld a, [Buffer1]
ld [CurPartySpecies], a
ld [CurSpecies], a
ld a, $1
ld [hBGMapMode], a
call Function4e794
jr c, .asm_4e67c
ld a, [Buffer1]
call PlayCry
.asm_4e67c
ld de, MUSIC_EVOLUTION
call PlayMusic
ld c, 80
call DelayFrames
ld c, $1
call Function4e703
call Function4e726
jr c, .asm_4e6df
ld a, $cf
ld [$d1ec], a
call Function4e755
xor a
ld [$d1ed], a
ld a, [Buffer2]
ld [PlayerHPPal], a
ld c, $0
call Function4e703
call Function4e7a6
callba Function8cf53
call Function4e794
jr c, .asm_4e6de
ld a, [$c2c6]
push af
ld a, $1
ld [$c2c6], a
ld a, [CurPartySpecies]
push af
ld a, [PlayerHPPal]
ld [CurPartySpecies], a
hlcoord 7, 2
ld d, $0
ld e, $4
predef Functiond008e
pop af
ld [CurPartySpecies], a
pop af
ld [$c2c6], a
ret
.asm_4e6de
ret
.asm_4e6df
ld a, $1
ld [$d1ed], a
ld a, [Buffer1]
ld [PlayerHPPal], a
ld c, $0
call Function4e703
call Function4e7a6
callba Function8cf53
call Function4e794
ret c
ld a, [PlayerHPPal]
call PlayCry
ret
; 4e703
Function4e703: ; 4e703
ld b, $b
jp GetSGBLayout
; 4e708
Function4e708: ; 4e708
call GetBaseData
hlcoord 7, 2
jp Function3786
; 4e711
Function4e711: ; 4e711
call GetBaseData
ld a, $1
ld [$c2c6], a
ld de, VTiles2
predef Function5108b
xor a
ld [$c2c6], a
ret
; 4e726
Function4e726: ; 4e726
call ClearJoypad
ld bc, $010e
.asm_4e72c
push bc
call Function4e779
pop bc
jr c, .asm_4e73f
push bc
call Function4e741
pop bc
inc b
dec c
dec c
jr nz, .asm_4e72c
and a
ret
.asm_4e73f
scf
ret
; 4e741
Function4e741: ; 4e741
.asm_4e741
ld a, $cf
ld [$d1ec], a
call Function4e755
ld a, $31
ld [$d1ec], a
call Function4e755
dec b
jr nz, .asm_4e741
ret
; 4e755
Function4e755: ; 4e755
push bc
xor a
ld [hBGMapMode], a
hlcoord 7, 2
ld bc, $0707
ld de, $000d
.asm_4e762
push bc
.asm_4e763
ld a, [$d1ec]
add [hl]
ld [hli], a
dec c
jr nz, .asm_4e763
pop bc
add hl, de
dec b
jr nz, .asm_4e762
ld a, $1
ld [hBGMapMode], a
call WaitBGMap
pop bc
ret
; 4e779
Function4e779: ; 4e779
.asm_4e779
call DelayFrame
push bc
call Functiona57
ld a, [hJoyDown]
pop bc
and $2
jr nz, .asm_4e78c
.asm_4e787
dec c
jr nz, .asm_4e779
and a
ret
.asm_4e78c
ld a, [$d1e9]
and a
jr nz, .asm_4e787
scf
ret
; 4e794
Function4e794: ; 4e794
ld a, [CurPartyMon]
ld hl, PartyMon1Species
call GetPartyLocation
ld b, h
ld c, l
callba Function4e53f
ret
; 4e7a6
Function4e7a6: ; 4e7a6
ld a, [$d1ed]
and a
ret nz
ld de, SFX_EVOLVED
call PlaySFX
ld hl, $cf63
ld a, [hl]
push af
ld [hl], $0
.asm_4e7b8
call Function4e7cf
jr nc, .asm_4e7c2
call Function4e80c
jr .asm_4e7b8
.asm_4e7c2
ld c, $20
.asm_4e7c4
call Function4e80c
dec c
jr nz, .asm_4e7c4
pop af
ld [$cf63], a
ret
; 4e7cf
Function4e7cf: ; 4e7cf
ld hl, $cf63
ld a, [hl]
cp $20
ret nc
ld d, a
inc [hl]
and $1
jr nz, .asm_4e7e6
ld e, $0
call Function4e7e8
ld e, $10
call Function4e7e8
.asm_4e7e6
scf
ret
; 4e7e8
Function4e7e8: ; 4e7e8
push de
ld de, $4858
ld a, $13
call Function3b2a
ld hl, $000b
add hl, bc
ld a, [$cf63]
and $e
sla a
pop de
add e
ld [hl], a
ld hl, $0003
add hl, bc
ld [hl], $0
ld hl, $000c
add hl, bc
ld [hl], $10
ret
; 4e80c
Function4e80c: ; 4e80c
push bc
callab Function8cf69
ld a, [$ff9b]
and $e
srl a
inc a
inc a
and $7
ld b, a
ld hl, $c403
ld c, $28
.asm_4e823
ld a, [hl]
or b
ld [hli], a
inc hl
inc hl
inc hl
dec c
jr nz, .asm_4e823
pop bc
call DelayFrame
ret
; 4e831
EvolutionGFX:
INCBIN "gfx/evo/bubble_large.2bpp"
INCBIN "gfx/evo/bubble.2bpp"
Function4e881: ; 4e881
call WhiteBGMap
call ClearTileMap
call ClearSprites
call DisableLCD
call Functione51
call Functione58
ld hl, VBGMap0
ld bc, $400
ld a, $7f
call ByteFill
ld hl, AttrMap
ld bc, $0168
xor a
call ByteFill
xor a
ld [hSCY], a
ld [hSCX], a
call EnableLCD
ld hl, UnknownText_0x4e8bd
call PrintText
call Function3200
call Function32f9
ret
; 4e8bd
UnknownText_0x4e8bd: ; 0x4e8bd
; SAVING RECORD… DON'T TURN OFF!
text_jump UnknownText_0x1bd39e
db "@"
; 0x4e8c2
Function4e8c2: ; 4e8c2
call WhiteBGMap
call ClearTileMap
call ClearSprites
call DisableLCD
call Functione51
call Functione58
ld hl, VBGMap0
ld bc, $400
ld a, $7f
call ByteFill
ld hl, AttrMap
ld bc, $0168
xor a
call ByteFill
ld hl, $d000
ld c, $40
.asm_4e8ee
ld a, $ff
ld [hli], a
ld a, $7f
ld [hli], a
dec c
jr nz, .asm_4e8ee
xor a
ld [hSCY], a
ld [hSCX], a
call EnableLCD
call Function3200
call Function32f9
ret
; 4e906
Function4e906: ; 4e906
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
ld hl, $d000
ld bc, $400
ld a, $7f
call ByteFill
ld hl, VBGMap0
ld de, $d000
ld b, $0
ld c, $40
call Request2bpp
pop af
ld [rSVBK], a
ret
; 4e929
Function4e929: ; 4e929
ld h, b
ld l, c
call Function4e930
ld c, a
ret
; 4e930
Function4e930: ; 4e930
ld a, [hli]
xor [hl]
ld c, a
jr z, .asm_4e941
srl c
srl c
.asm_4e939
srl c
ld a, c
cp MaleTrainersEnd - MaleTrainers - 1
jr nc, .asm_4e939
inc c
.asm_4e941
ld a, [de]
cp $1
ld hl, MaleTrainers
jr nz, .asm_4e958
ld hl, FemaleTrainers
ld a, c
and a
jr z, .asm_4e958
.asm_4e950
srl c
ld a, c
cp FemaleTrainersEnd - FemaleTrainers - 1
jr nc, .asm_4e950
inc c
.asm_4e958
ld b, $0
add hl, bc
ld a, [hl]
ret
; 4e95d
MaleTrainers: ; 4e95d
db BURGLAR
db YOUNGSTER
db SCHOOLBOY
db BIRD_KEEPER
db POKEMANIAC
db GENTLEMAN
db BUG_CATCHER
db FISHER
db SWIMMERM
db SAILOR
db SUPER_NERD
db GUITARIST
db HIKER
db FIREBREATHER
db BLACKBELT_T
db PSYCHIC_T
db CAMPER
db COOLTRAINERM
db BOARDER
db JUGGLER
db POKEFANM
db OFFICER
db SAGE
db BIKER
db SCIENTIST
MaleTrainersEnd:
; 4e976
FemaleTrainers: ; 4e976
db MEDIUM
db LASS
db BEAUTY
db SKIER
db TEACHER
db SWIMMERF
db PICNICKER
db KIMONO_GIRL
db POKEFANF
db COOLTRAINERF
FemaleTrainersEnd:
; 4e980
Function4e980: ; 4e980
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
call Function4e998
ld a, rSCX & $ff
ld [hLCDStatCustom], a
call Function4e9ab
xor a
ld [hLCDStatCustom], a
pop af
ld [rSVBK], a
ret
; 4e998
Function4e998: ; 4e998
call Function4e9e5
ld a, $90
ld [hSCX], a
ld a, $e4
call DmgToCgbBGPals
ld de, $e4e4
call DmgToCgbObjPals
ret
; 4e9ab
Function4e9ab: ; 4e9ab
ld d, $90
ld e, $72
ld a, $48
inc a
.asm_4e9b2
push af
.asm_4e9b3
ld a, [rLY]
cp $60
jr c, .asm_4e9b3
ld a, d
ld [hSCX], a
call Function4e9f1
inc e
inc e
dec d
dec d
pop af
push af
cp $1
jr z, .asm_4e9ce
push de
call Function4e9d6
pop de
.asm_4e9ce
call DelayFrame
pop af
dec a
jr nz, .asm_4e9b2
ret
; 4e9d6
Function4e9d6: ; 4e9d6
ld hl, $c401
ld c, $12
ld de, $0004
.asm_4e9de
dec [hl]
dec [hl]
add hl, de
dec c
jr nz, .asm_4e9de
ret
; 4e9e5
Function4e9e5: ; 4e9e5
ld hl, LYOverrides
ld a, $90
ld bc, $0090
call ByteFill
ret
; 4e9f1
Function4e9f1: ; 4e9f1
ld hl, LYOverrides
ld a, d
ld c, $3e
.asm_4e9f7
ld [hli], a
dec c
jr nz, .asm_4e9f7
ld a, e
ld c, $22
.asm_4e9fe
ld [hli], a
dec c
jr nz, .asm_4e9fe
xor a
ld c, $30
.asm_4ea05
ld [hli], a
dec c
jr nz, .asm_4ea05
ret
; 4ea0a
Function4ea0a: ; 4ea0a
ld a, c
push af
call SpeechTextBox
call MobileTextBorder
pop af
dec a
ld bc, $000c
ld hl, $dc1a
call AddNTimes
ld de, $cd53
ld bc, $000c
ld a, $5
call FarCopyWRAM
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
ld bc, $cd53
decoord 1, 14
callba Function11c0c6
pop af
ld [rSVBK], a
ld c, $b4
call DelayFrames
ret
; 4ea44
CheckBattleScene: ; 4ea44
; Return carry if battle scene is turned off.
ld a, 0
ld hl, InLinkBattle
call GetFarWRAMByte
cp 4
jr z, .mobile
ld a, [Options]
bit BATTLE_SCENE, a
jr nz, .off
and a
ret
.mobile
ld a, [$cd2f]
and a
jr nz, .asm_4ea72
ld a, $4
call GetSRAMBank
ld a, [$a60c]
ld c, a
call CloseSRAM
ld a, c
bit 0, c
jr z, .off
and a
ret
.asm_4ea72
ld a, $5
ld hl, $dc00
call GetFarWRAMByte
bit 0, a
jr z, .off
and a
ret
.off
scf
ret
; 4ea82
INCLUDE "misc/gbc_only.asm"
INCLUDE "event/poke_seer.asm"
SECTION "bank14", ROMX, BANK[$14]
Function50000: ; 50000
call Function2ed3
xor a
ld [PartyMenuActionText], a
call WhiteBGMap
call Function5003f
call WaitBGMap
call Function32f9
call DelayFrame
call PartyMenuSelect
call Function2b74
ret
; 5001d
Function5001d: ; 5001d
ld a, b
ld [PartyMenuActionText], a
call Function2ed3
call WhiteBGMap
call Function5003f
call WaitBGMap
ld b, $a
call GetSGBLayout
call Function32f9
call DelayFrame
call PartyMenuSelect
call Function2b74
ret
; 5003f
Function5003f: ; 5003f
call Function5004f
call Function50405
call Function503e0
call WritePartyMenuTilemap
call PrintPartyMenuText
ret
; 5004f
Function5004f: ; 5004f
call Functione58
callab Function8ad1
callab Function8e814
ret
; 5005f
WritePartyMenuTilemap: ; 0x5005f
ld hl, Options
ld a, [hl]
push af
set 4, [hl] ; Disable text delay
xor a
ld [hBGMapMode], a
ld hl, TileMap
ld bc, $0168
ld a, " "
call ByteFill ; blank the tilemap
call Function50396 ; This reads from a pointer table???
.asm_50077
ld a, [hli]
cp $ff
jr z, .asm_50084 ; 0x5007a $8
push hl
ld hl, Jumptable_50089
rst JumpTable
pop hl
jr .asm_50077 ; 0x50082 $f3
.asm_50084
pop af
ld [Options], a
ret
; 0x50089
Jumptable_50089: ; 50089
dw Function5009b
dw Function500cf
dw Function50138
dw Function50176
dw Function501b2
dw Function501e0
dw Function5022f
dw Function502b1
dw Function50307
; 5009b
Function5009b: ; 5009b
hlcoord 3, 1
ld a, [PartyCount]
and a
jr z, .asm_500bf
ld c, a
ld b, $0
.asm_500a7
push bc
push hl
push hl
ld hl, PartyMonNicknames
ld a, b
call GetNick
pop hl
call PlaceString
pop hl
ld de, $0028
add hl, de
pop bc
inc b
dec c
jr nz, .asm_500a7
.asm_500bf
dec hl
dec hl
ld de, String_500c8
call PlaceString
ret
; 500c8
String_500c8: ; 500c8
db "CANCEL@"
; 500cf
Function500cf: ; 500cf
xor a
ld [$cda9], a
ld a, [PartyCount]
and a
ret z
ld c, a
ld b, $0
hlcoord 11, 2
.asm_500de
push bc
push hl
call Function50389
jr z, .asm_50103
push hl
call Function50117
pop hl
ld d, $6
ld b, $0
call DrawHPBar
ld hl, $cd9b
ld a, [$cda9]
ld c, a
ld b, $0
add hl, bc
call SetHPPal
ld b, $fc
call GetSGBLayout
.asm_50103
ld hl, $cda9
inc [hl]
pop hl
ld de, $0028
add hl, de
pop bc
inc b
dec c
jr nz, .asm_500de
ld b, $a
call GetSGBLayout
ret
; 50117
Function50117: ; 50117
ld a, b
ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1HP
call AddNTimes
ld a, [hli]
or [hl]
jr nz, .asm_50129
xor a
ld e, a
ld c, a
ret
.asm_50129
dec hl
ld a, [hli]
ld b, a
ld a, [hli]
ld c, a
ld a, [hli]
ld d, a
ld a, [hli]
ld e, a
predef Functionc699
ret
; 50138
Function50138: ; 50138
ld a, [PartyCount]
and a
ret z
ld c, a
ld b, $0
hlcoord 13, 1
.asm_50143
push bc
push hl
call Function50389
jr z, .asm_5016b
push hl
ld a, b
ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1HP
call AddNTimes
ld e, l
ld d, h
pop hl
push de
ld bc, $0203
call PrintNum
pop de
ld a, $f3
ld [hli], a
inc de
inc de
ld bc, $0203
call PrintNum
.asm_5016b
pop hl
ld de, $0028
add hl, de
pop bc
inc b
dec c
jr nz, .asm_50143
ret
; 50176
Function50176: ; 50176
ld a, [PartyCount]
and a
ret z
ld c, a
ld b, 0
hlcoord 8, 2
.asm_50181
push bc
push hl
call Function50389
jr z, .asm_501a7
push hl
ld a, b
ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1Level
call AddNTimes
ld e, l
ld d, h
pop hl
ld a, [de]
cp 100 ; This is distinct from MAX_LEVEL.
jr nc, .asm_501a1
ld a, LV_CHAR
ld [hli], a
ld bc, $4102
.asm_501a1
ld bc, $4103
call PrintNum
.asm_501a7
pop hl
ld de, SCREEN_WIDTH * 2
add hl, de
pop bc
inc b
dec c
jr nz, .asm_50181
ret
; 501b2
Function501b2: ; 501b2
ld a, [PartyCount]
and a
ret z
ld c, a
ld b, 0
hlcoord 5, 2
.asm_501bd
push bc
push hl
call Function50389
jr z, .asm_501d5
push hl
ld a, b
ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1Status
call AddNTimes
ld e, l
ld d, h
pop hl
call Function50d0a
.asm_501d5
pop hl
ld de, SCREEN_WIDTH * 2
add hl, de
pop bc
inc b
dec c
jr nz, .asm_501bd
ret
; 501e0
Function501e0: ; 501e0
ld a, [PartyCount]
and a
ret z
ld c, a
ld b, 0
hlcoord 12, 2
.asm_501eb
push bc
push hl
call Function50389
jr z, .asm_5020a
push hl
ld hl, PartySpecies
ld e, b
ld d, 0
add hl, de
ld a, [hl]
ld [CurPartySpecies], a
predef CanLearnTMHMMove
pop hl
call Function50215
call PlaceString
.asm_5020a
pop hl
ld de, SCREEN_WIDTH * 2
add hl, de
pop bc
inc b
dec c
jr nz, .asm_501eb
ret
; 50215
Function50215: ; 50215
ld a, c
and a
jr nz, .asm_5021d
ld de, String_50226
ret
.asm_5021d
ld de, String_50221
ret
; 50221
String_50221: ; 50221
db "ABLE@"
; 50226
String_50226: ; 50226
db "NOT ABLE@"
; 5022f
Function5022f: ; 5022f
ld a, [PartyCount]
and a
ret z
ld c, a
ld b, 0
hlcoord 12, 2
.asm_5023a
push bc
push hl
call Function50389
jr z, .asm_5025d
push hl
ld a, b
ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1Species
call AddNTimes
ld a, [hl]
dec a
ld e, a
ld d, 0
ld hl, EvosAttacksPointers
add hl, de
add hl, de
call Function50268
pop hl
call PlaceString
.asm_5025d
pop hl
ld de, $0028
add hl, de
pop bc
inc b
dec c
jr nz, .asm_5023a
ret
; 50268
Function50268: ; 50268
ld de, StringBuffer1
ld a, BANK(EvosAttacksPointers)
ld bc, 2
call FarCopyBytes
ld hl, StringBuffer1
ld a, [hli]
ld h, [hl]
ld l, a
ld de, StringBuffer1
ld a, BANK(EvosAttacks)
ld bc, $a
call FarCopyBytes
ld hl, StringBuffer1
.asm_50287
ld a, [hli]
and a
jr z, .asm_5029f
inc hl
inc hl
cp EVOLVE_ITEM
jr nz, .asm_50287
dec hl
dec hl
ld a, [CurItem]
cp [hl]
inc hl
inc hl
jr nz, .asm_50287
ld de, String_502a3
ret
.asm_5029f
ld de, String_502a8
ret
; 502a3
String_502a3: ; 502a3
db "ABLE@"
; 502a8
String_502a8: ; 502a8
db "NOT ABLE@"
; 502b1
Function502b1: ; 502b1
ld a, [PartyCount]
and a
ret z
ld c, a
ld b, 0
hlcoord 12, 2
.asm_502bc
push bc
push hl
call Function50389
jr z, .asm_502e3
ld [CurPartySpecies], a
push hl
ld a, b
ld [CurPartyMon], a
xor a
ld [MonType], a
call GetGender
ld de, String_502fe
jr c, .asm_502df
ld de, String_502ee
jr nz, .asm_502df
ld de, String_502f5
.asm_502df
pop hl
call PlaceString
.asm_502e3
pop hl
ld de, $0028
add hl, de
pop bc
inc b
dec c
jr nz, .asm_502bc
ret
; 502ee
String_502ee: ; 502ee
db "♂…MALE@"
; 502f5
String_502f5: ; 502f5
db "♀…FEMALE@"
; 502fe
String_502fe: ; 502fe
db "…UNKNOWN@"
; 50307
Function50307: ; 50307
ld a, [PartyCount]
and a
ret z
ld c, a
ld b, 0
hlcoord 12, 1
.asm_50312
push bc
push hl
ld de, String_50372
call PlaceString
pop hl
ld de, $0028
add hl, de
pop bc
inc b
dec c
jr nz, .asm_50312
ld a, l
ld e, $b
sub e
ld l, a
ld a, h
sbc $0
ld h, a
ld de, String_50379
call PlaceString
ld b, $3
ld c, $0
ld hl, DefaultFlypoint
ld a, [hl]
.asm_5033b
push hl
push bc
hlcoord 12, 1
.asm_50340
and a
jr z, .asm_5034a
ld de, $0028
add hl, de
dec a
jr .asm_50340
.asm_5034a
ld de, String_5036b
push hl
call PlaceString
pop hl
pop bc
push bc
push hl
ld a, c
ld hl, Strings_50383
call GetNthString
ld d, h
ld e, l
pop hl
call PlaceString
pop bc
pop hl
inc hl
ld a, [hl]
inc c
dec b
ret z
jr .asm_5033b
; 5036b
String_5036b: ; 5036b
db " ばんめ @" ; Place
; 50372
String_50372: ; 50372
db "さんかしない@" ; Cancel
; 50379
String_50379: ; 50379
db "けってい やめる@" ; Quit
; 50383
Strings_50383: ; 50383
db "1@", "2@", "3@" ; 1st, 2nd, 3rd
; 50389
Function50389: ; 50389
ld a, PartySpecies % $100
add b
ld e, a
ld a, PartySpecies / $100
adc 0
ld d, a
ld a, [de]
cp EGG
ret
; 50396
Function50396: ; 50396
ld a, [PartyMenuActionText]
and $f0
jr nz, .asm_503ae
ld a, [PartyMenuActionText]
and $f
ld e, a
ld d, 0
ld hl, Unknown_503b2
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
.asm_503ae
ld hl, Unknown_503c6
ret
; 503b2
Unknown_503b2: ; 503b2
dw Unknown_503c6
dw Unknown_503c6
dw Unknown_503c6
dw Unknown_503cc
dw Unknown_503c6
dw Unknown_503d1
dw Unknown_503d6
dw Unknown_503d6
dw Unknown_503c6
dw Unknown_503db
; 503c6
Unknown_503c6: db 0, 1, 2, 3, 4, $ff
Unknown_503cc: db 0, 5, 3, 4, $ff
Unknown_503d1: db 0, 6, 3, 4, $ff
Unknown_503d6: db 0, 7, 3, 4, $ff
Unknown_503db: db 0, 8, 3, 4, $ff
; 503e0
Function503e0: ; 503e0
ld hl, PartyCount
ld a, [hli]
and a
ret z
ld c, a
xor a
ld [$ffb0], a
.asm_503ea
push bc
push hl
ld hl, Function8e83f
ld a, BANK(Function8e83f)
ld e, $0
rst FarCall
ld a, [$ffb0]
inc a
ld [$ffb0], a
pop hl
pop bc
dec c
jr nz, .asm_503ea
callab Function8cf69
ret
; 50405
Function50405: ; 50405
xor a
ld [$d0e3], a
ld de, Unknown_5044f
call Function1bb1
ld a, [PartyCount]
inc a
ld [$cfa3], a
dec a
ld b, a
ld a, [$d0d8]
and a
jr z, .asm_50422
inc b
cp b
jr c, .asm_50424
.asm_50422
ld a, $1
.asm_50424
ld [$cfa9], a
ld a, $3
ld [$cfa8], a
ret
; 5042d
Function5042d: ; 0x5042d
ld de, Unknown_5044f
call Function1bb1
ld a, [PartyCount] ; $dcd7
ld [$cfa3], a
ld b, a
ld a, [$d0d8]
and a
jr z, .asm_50444
inc b
cp b
jr c, .asm_50446
.asm_50444
ld a, $1
.asm_50446
ld [$cfa9], a
ld a, $3
ld [$cfa8], a
ret
; 5044f (14:444f)
Unknown_5044f: ; 5044f
; cursor y
; cursor x
; list length
; ?
; bit 6: animate sprites bit 5: wrap around
; ?
; distance between items (hi: y, lo: x)
; allowed buttons (mask)
db $01, $00, $00, $01, $60, $00, $20, $00
; 50457
PartyMenuSelect: ; 0x50457
; sets carry if exitted menu.
call Function1bc9
call Function1bee
ld a, [PartyCount]
inc a
ld b, a
ld a, [$cfa9] ; menu selection?
cp b
jr z, .exitmenu ; CANCEL
ld [$d0d8], a
ld a, [$ffa9]
ld b, a
bit 1, b
jr nz, .exitmenu ; B button?
ld a, [$cfa9]
dec a
ld [CurPartyMon], a
ld c, a
ld b, $0
ld hl, PartySpecies
add hl, bc
ld a, [hl]
ld [CurPartySpecies], a
ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
and a
ret
.exitmenu
ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
scf
ret
; 0x5049a
PrintPartyMenuText: ; 5049a
hlcoord 0, 14
ld bc, $0212
call TextBox
ld a, [PartyCount]
and a
jr nz, .haspokemon
ld de, YouHaveNoPKMNString
jr .gotstring
.haspokemon ; 504ae
ld a, [PartyMenuActionText]
and $f ; drop high nibble
ld hl, PartyMenuStrings
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
.gotstring ; 504be
ld a, [Options]
push af
set 4, a ; disable text delay
ld [Options], a
hlcoord 1, 16 ; Coord
call PlaceString
pop af
ld [Options], a
ret
; 0x504d2
PartyMenuStrings: ; 0x504d2
dw ChooseAMonString
dw UseOnWhichPKMNString
dw WhichPKMNString
dw TeachWhichPKMNString
dw MoveToWhereString
dw UseOnWhichPKMNString
dw ChooseAMonString ; Probably used to be ChooseAFemalePKMNString
dw ChooseAMonString ; Probably used to be ChooseAMalePKMNString
dw ToWhichPKMNString
ChooseAMonString: ; 0x504e4
db "Choose a #MON.@"
UseOnWhichPKMNString: ; 0x504f3
db "Use on which ", $e1, $e2, "?@"
WhichPKMNString: ; 0x50504
db "Which ", $e1, $e2, "?@"
TeachWhichPKMNString: ; 0x5050e
db "Teach which ", $e1, $e2, "?@"
MoveToWhereString: ; 0x5051e
db "Move to where?@"
ChooseAFemalePKMNString: ; 0x5052d ; UNUSED
db "Choose a ♀", $e1, $e2, ".@"
ChooseAMalePKMNString: ; 0x5053b ; UNUSED
db "Choose a ♂", $e1, $e2, ".@"
ToWhichPKMNString: ; 0x50549
db "To which ", $e1, $e2, "?@"
YouHaveNoPKMNString: ; 0x50556
db "You have no ", $e1, $e2, "!@"
Function50566: ; 50566
ld a, [CurPartyMon]
ld hl, PartyMonNicknames
call GetNick
ld a, [PartyMenuActionText]
and $f
ld hl, Unknown_5057b
call Function505c1
ret
; 5057b
Unknown_5057b: ; 5057b
dw UnknownText_0x50594
dw UnknownText_0x5059e
dw UnknownText_0x505a3
dw UnknownText_0x505a8
dw UnknownText_0x50599
dw UnknownText_0x5058f
dw UnknownText_0x505ad
dw UnknownText_0x505b2
dw UnknownText_0x505b7
dw UnknownText_0x505bc
; 5058f
UnknownText_0x5058f: ; 0x5058f
; recovered @ HP!
text_jump UnknownText_0x1bc0a2
db "@"
; 0x50594
UnknownText_0x50594: ; 0x50594
; 's cured of poison.
text_jump UnknownText_0x1bc0bb
db "@"
; 0x50599
UnknownText_0x50599: ; 0x50599
; 's rid of paralysis.
text_jump UnknownText_0x1bc0d2
db "@"
; 0x5059e
UnknownText_0x5059e: ; 0x5059e
; 's burn was healed.
text_jump UnknownText_0x1bc0ea
db "@"
; 0x505a3
UnknownText_0x505a3: ; 0x505a3
; was defrosted.
text_jump UnknownText_0x1bc101
db "@"
; 0x505a8
UnknownText_0x505a8: ; 0x505a8
; woke up.
text_jump UnknownText_0x1bc115
db "@"
; 0x505ad
UnknownText_0x505ad: ; 0x505ad
; 's health returned.
text_jump UnknownText_0x1bc123
db "@"
; 0x505b2
UnknownText_0x505b2: ; 0x505b2
; is revitalized.
text_jump UnknownText_0x1bc13a
db "@"
; 0x505b7
UnknownText_0x505b7: ; 0x505b7
; grew to level @ !@ @
text_jump UnknownText_0x1bc14f
db "@"
; 0x505bc
UnknownText_0x505bc: ; 0x505bc
; came to its senses.
text_jump UnknownText_0x1bc16e
db "@"
; 0x505c1
Function505c1: ; 505c1
ld e, a
ld d, 0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [Options]
push af
set 4, a
ld [Options], a
call PrintText
pop af
ld [Options], a
ret
; 505da
Function505da:: ; 505da
ld a, [PartyCount]
and a
jr z, .asm_5062c
xor a
ld c, 7
ld hl, EngineBuffer1
.asm_505e6
ld [hli], a
dec c
jr nz, .asm_505e6
xor a
ld [CurPartyMon], a
.asm_505ee
call Function5062e
jr nc, .asm_50605
ld a, [CurPartyMon]
ld e, a
ld d, 0
ld hl, $d03f
add hl, de
ld [hl], c
ld a, [EngineBuffer1]
or c
ld [EngineBuffer1], a
.asm_50605
ld a, [PartyCount]
ld hl, CurPartyMon
inc [hl]
cp [hl]
jr nz, .asm_505ee
ld a, [EngineBuffer1]
and $2
jr nz, .asm_50622
ld a, [EngineBuffer1]
and $1
jr z, .asm_5062c
call Function50658
xor a
ret
.asm_50622
ld a, BANK(UnknownScript_0x50669)
ld hl, UnknownScript_0x50669
call CallScript
scf
ret
.asm_5062c
xor a
ret
; 5062e
Function5062e: ; 5062e
ld a, $20
call GetPartyParamLocation
ld a, [hl]
and $8
ret z
ld a, $22
call GetPartyParamLocation
ld a, [hli]
ld b, a
ld c, [hl]
or c
ret z
dec bc
ld [hl], c
dec hl
ld [hl], b
ld a, b
or c
jr nz, .asm_50654
ld a, $20
call GetPartyParamLocation
ld [hl], $0
ld c, $2
scf
ret
.asm_50654
ld c, $1
scf
ret
; 50658
Function50658: ; 50658
ld de, SFX_POISON
call PlaySFX
ld b, $2
predef Functioncbcdd
call DelayFrame
ret
; 50669
UnknownScript_0x50669: ; 50669
3callasm Function50658
loadfont
3callasm Function5067b
iffalse UnknownScript_0x50677
loadmovesprites
end
; 50677
UnknownScript_0x50677: ; 50677
3jump UnknownScript_0x124c8
; 5067b
Function5067b: ; 5067b
xor a
ld [CurPartyMon], a
ld de, $d03f
.asm_50682
push de
ld a, [de]
and 2
jr z, .asm_5069c
ld c, 7
callba ChangeHappiness
callba GetPartyNick
ld hl, PoisonFaintText
call PrintText
.asm_5069c
pop de
inc de
ld hl, CurPartyMon
inc [hl]
ld a, [PartyCount]
cp [hl]
jr nz, .asm_50682
predef Function3d873
ld a, d
ld [ScriptVar], a
ret
; 506b2
PoisonFaintText: ; 506b2
text_jump UnknownText_0x1c0acc
db "@"
; 506b7
PoisonWhiteOutText: ; 506b7
text_jump UnknownText_0x1c0ada
db "@"
; 506bc
Function506bc: ; 506bc
ld hl, UnknownScript_0x506c8
call Function31cd
ld a, $1
ld [$d0ec], a
ret
; 506c8
UnknownScript_0x506c8: ; 0x506c8
reloadmappart
special $0035
3callasm GetPartyNick
2writetext UnknownText_0x50726
closetext
3callasm Function506ef
iffalse UnknownScript_0x506e9
checkflag $0011
iftrue UnknownScript_0x506e5
battlecheck
startbattle
returnafterbattle
end
; 0x506e5
UnknownScript_0x506e5: ; 0x506e5
3jump UnknownScript_0x135eb
; 0x506e9
UnknownScript_0x506e9: ; 0x506e9
2writetext UnknownText_0x5072b
closetext
loadmovesprites
end
; 0x506ef
Function506ef: ; 506ef
callba Function97cfd
jr nc, .asm_5071e
ld hl, StatusFlags2
bit 2, [hl]
jr nz, .asm_50712
callba Function2a111
ld a, b
and a
jr z, .asm_5071e
callba Function2a14f
jr nz, .asm_5071e
jr .asm_50718
.asm_50712
callba Function97d31
.asm_50718
ld a, $1
ld [ScriptVar], a
ret
.asm_5071e
xor a
ld [ScriptVar], a
ld [BattleType], a
ret
; 50726
UnknownText_0x50726: ; 0x50726
; used SWEET SCENT!
text_jump UnknownText_0x1c0b03
db "@"
; 0x5072b
UnknownText_0x5072b: ; 0x5072b
; Looks like there's nothing here…
text_jump UnknownText_0x1c0b1a
db "@"
; 0x50730
_Squirtbottle: ; 50730
ld hl, UnknownScript_0x5073c
call Function31cd
ld a, $1
ld [$d0ec], a
ret
; 5073c
UnknownScript_0x5073c: ; 0x5073c
reloadmappart
special $0035
3callasm Function50753
iffalse UnknownScript_0x5074b
3jump WateredWeirdTreeScript
; 0x5074b
UnknownScript_0x5074b: ; 0x5074b
jumptext UnknownText_0x5074e
; 0x5074e
UnknownText_0x5074e: ; 0x5074e
; sprinkled water. But nothing happened…
text_jump UnknownText_0x1c0b3b
db "@"
; 0x50753
Function50753: ; 50753
ld a, [MapGroup]
cp GROUP_ROUTE_36
jr nz, .asm_50774
ld a, [MapNumber]
cp MAP_ROUTE_36
jr nz, .asm_50774
callba Functioncf0d
jr c, .asm_50774
ld a, d
cp 23
jr nz, .asm_50774
ld a, $1
ld [ScriptVar], a
ret
.asm_50774
xor a
ld [ScriptVar], a
ret
; 50779
_CardKey: ; 50779
ld a, [MapGroup]
cp GROUP_RADIO_TOWER_3F
jr nz, .asm_507a9
ld a, [MapNumber]
cp MAP_RADIO_TOWER_3F
jr nz, .asm_507a9
ld a, [PlayerDirection]
and $c
cp UP << 2
jr nz, .asm_507a9
call GetFacingTileCoord
ld a, d
cp 18
jr nz, .asm_507a9
ld a, e
cp 6
jr nz, .asm_507a9
ld hl, UnknownScript_0x507af
call Function31cd
ld a, $1
ld [$d0ec], a
ret
.asm_507a9
ld a, $0
ld [$d0ec], a
ret
; 507af
UnknownScript_0x507af: ; 0x507af
loadmovesprites
3jump MapRadioTower3FSignpost2Script
; 0x507b4
_BasementKey: ; 507b4
ld a, [MapGroup]
cp GROUP_WAREHOUSE_ENTRANCE
jr nz, .asm_507db
ld a, [MapNumber]
cp MAP_WAREHOUSE_ENTRANCE
jr nz, .asm_507db
call GetFacingTileCoord
ld a, d
cp 22
jr nz, .asm_507db
ld a, e
cp 10
jr nz, .asm_507db
ld hl, UnknownScript_0x507e1
call Function31cd
ld a, $1
ld [$d0ec], a
ret
.asm_507db
ld a, $0
ld [$d0ec], a
ret
; 507e1
UnknownScript_0x507e1: ; 0x507e1
loadmovesprites
3jump MapWarehouseEntranceSignpost0Script
; 0x507e6
_SacredAsh: ; 507e6
ld a, $0
ld [$d0ec], a
call CheckAnyFaintedMon
ret nc
ld hl, UnknownScript_0x50821
call Function31cd
ld a, $1
ld [$d0ec], a
ret
; 507fb
CheckAnyFaintedMon: ; 507fb
ld de, PartyMon2 - PartyMon1
ld bc, PartySpecies
ld hl, PartyMon1HP
ld a, [PartyCount]
and a
ret z
.loop
push af
push hl
ld a, [bc]
inc bc
cp EGG
jr z, .next
ld a, [hli]
or [hl]
jr z, .asm_5081d
.next
pop hl
add hl, de
pop af
dec a
jr nz, .loop
xor a
ret
.asm_5081d
pop hl
pop af
scf
ret
; 50821
UnknownScript_0x50821: ; 0x50821
special $001b
reloadmappart
playsound SFX_WARP_TO
special $002e
special $0031
special $002e
special $0031
special $002e
special $0031
waitbutton
2writetext UnknownText_0x50845
playsound SFX_CAUGHT_MON
waitbutton
closetext
loadmovesprites
end
; 0x50845
UnknownText_0x50845: ; 0x50845
; 's #MON were all healed!
text_jump UnknownText_0x1c0b65
db "@"
; 0x5084a
Function5084a: ; 5084a
ld a, [CurPartyMon]
ld e, a
call Function508d5
ld a, [CurPartySpecies]
ld [CurSpecies], a
call GetBaseData
ld a, [MonType]
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
and a
jr z, .asm_5087b
ld hl, OTPartyMon1Species
ld bc, OTPartyMon2 - OTPartyMon1
cp $1
jr z, .asm_5087b
ld bc, $0020
callab Functione5bb
jr .asm_5088a
.asm_5087b
ld a, [CurPartyMon]
call AddNTimes
ld de, TempMonSpecies
ld bc, PartyMon2 - PartyMon1
call CopyBytes
.asm_5088a
ret
; 5088b
Function5088b: ; 5088b
ld bc, $d018
jr Function50893
; 50890
Function50890: ; 50890
ld bc, TempMon
; fallthrough
; 50893
Function50893: ; 50893
ld hl, TempMonLevel - TempMon
add hl, bc
ld a, [hl]
ld [CurPartyLevel], a
ld hl, TempMonMaxHP - TempMon
add hl, bc
ld d, h
ld e, l
ld hl, TempMonExp + 2 - TempMon
add hl, bc
push bc
ld b, $1
predef Functione167
pop bc
ld hl, TempMonHP - TempMon
add hl, bc
ld d, h
ld e, l
ld a, [CurPartySpecies]
cp EGG
jr nz, .asm_508c1
xor a
ld [de], a
inc de
ld [de], a
jr .asm_508cd
.asm_508c1
push bc
ld hl, TempMonMaxHP - TempMon
add hl, bc
ld bc, 2
call CopyBytes
pop bc
.asm_508cd
ld hl, TempMonStatus - TempMon
add hl, bc
xor a
ld [hli], a
ld [hl], a
ret
; 508d5
Function508d5: ; 508d5
ld a, [MonType]
and a ; PARTYMON
jr z, .asm_508e7
cp OTPARTYMON
jr z, .asm_508ec
cp BOXMON
jr z, .asm_508f1
cp $3
jr z, .asm_50900
; WILDMON
.asm_508e7
ld hl, PartySpecies
jr .asm_50905
.asm_508ec
ld hl, OTPartySpecies
jr .asm_50905
.asm_508f1
ld a, 1 ; BANK(sBoxSpecies)
call GetSRAMBank
ld hl, sBoxSpecies
call .asm_50905
call CloseSRAM
ret
.asm_50900
ld a, [wBreedMon1Species]
jr .asm_50909
.asm_50905
ld d, 0
add hl, de
ld a, [hl]
.asm_50909
ld [CurPartySpecies], a
ret
; 5090d
INCLUDE "text/types.asm"
Function50a28: ; 50a28
ld hl, Strings50a42
ld a, [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, StringBuffer1
.copy
ld a, [hli]
ld [de], a
inc de
cp "@"
jr nz, .copy
ret
; 50a42
Strings50a42: ; 50a42
; Untranslated trainer class names from Red.
dw .Youngster
dw .BugCatcher
dw .Lass
dw OTName
dw .JrTrainerM
dw .JrTrainerF
dw .Pokemaniac
dw .SuperNerd
dw OTName
dw OTName
dw .Burglar
dw .Engineer
dw .Jack
dw OTName
dw .Swimmer
dw OTName
dw OTName
dw .Beauty
dw OTName
dw .Rocker
dw .Juggler
dw OTName
dw OTName
dw .Blackbelt
dw OTName
dw .ProfOak
dw .Chief
dw .Scientist
dw OTName
dw .Rocket
dw .CooltrainerM
dw .CooltrainerF
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
dw OTName
.Youngster db "たんパン@"
.BugCatcher db "むしとり@"
.Lass db "ミニスカ@"
.JrTrainerM db "ボーイ@"
.JrTrainerF db "ガール@"
.Pokemaniac db "マニア@"
.SuperNerd db "りかけい@"
.Burglar db "どろぼう@"
.Engineer db "ォヤジ@"
.Jack db "ジャック@"
.Swimmer db "かいパン@"
.Beauty db "おねえさん@"
.Rocker db "グループ@"
.Juggler db "ジャグラー@"
.Blackbelt db "からて@"
.ProfOak db "ォーキド@"
.Chief db "チーフ@"
.Scientist db "けんきゅういん@"
.Rocket db "だんいん@"
.CooltrainerM db "エりート♂@"
.CooltrainerF db "エりート♀@"
; 50b0a
DrawPlayerHP: ; 50b0a
ld a, $1
jr DrawHP
DrawEnemyHP: ; 50b0e
ld a, $2
DrawHP: ; 50b10
ld [$d10a], a
push hl
push bc
ld a, [MonType]
cp BOXMON
jr z, .asm_50b30
ld a, [TempMonHP]
ld b, a
ld a, [TempMonHP + 1]
ld c, a
; Any HP?
or b
jr nz, .asm_50b30
xor a
ld c, a
ld e, a
ld a, 6
ld d, a
jp .asm_50b4a
.asm_50b30
ld a, [TempMonMaxHP]
ld d, a
ld a, [TempMonMaxHP + 1]
ld e, a
ld a, [MonType]
cp BOXMON
jr nz, .asm_50b41
ld b, d
ld c, e
.asm_50b41
predef Functionc699
ld a, 6
ld d, a
ld c, a
.asm_50b4a
ld a, c
pop bc
ld c, a
pop hl
push de
push hl
push hl
call DrawHPBar
pop hl
; Print HP
ld bc, $0015 ; move (1,1)
add hl, bc
ld de, TempMonHP
ld a, [MonType]
cp BOXMON
jr nz, .asm_50b66
ld de, TempMonMaxHP
.asm_50b66
ld bc, $0203
call PrintNum
ld a, "/"
ld [hli], a
; Print max HP
ld de, TempMonMaxHP
ld bc, $0203
call PrintNum
pop hl
pop de
ret
; 50b7b
Function50b7b: ; 50b7b
; Print a monster's stats on level up.
push bc
push hl
ld de, String_50bb5
call PlaceString
pop hl
pop bc
add hl, bc
ld bc, $0014
add hl, bc
ld de, TempMonAttack
ld bc, $0203
call Function50bab
ld de, TempMonDefense
call Function50bab
ld de, TempMonSpclAtk
call Function50bab
ld de, TempMonSpclDef
call Function50bab
ld de, TempMonSpeed
jp PrintNum
; 50bab
Function50bab: ; 50bab
push hl
call PrintNum
pop hl
ld de, $0028
add hl, de
ret
; 50bb5
String_50bb5: ; 50bb5
db "ATTACK"
next "DEFENSE"
next "SPCL.ATK"
next "SPCL.DEF"
next "SPEED"
next "@"
; 50bdd
GetGender: ; 50bdd
; Return the gender of a given monster (CurPartyMon/CurOTMon/CurWildMon).
; When calling this function, a should be set to an appropriate MonType value.
; return values:
; a = 1: f = nc|nz; male
; a = 0: f = nc|z; female
; f = c: genderless
; This is determined by comparing the Attack and Speed DVs
; with the species' gender ratio.
; Figure out what type of monster struct we're looking at.
; 0: PartyMon
ld hl, PartyMon1DVs
ld bc, PartyMon2 - PartyMon1
ld a, [MonType]
and a
jr z, .PartyMon
; 1: OTPartyMon
ld hl, OTPartyMon1DVs
dec a
jr z, .PartyMon
; 2: sBoxMon
ld hl, sBoxMon1DVs
ld bc, sBoxMon2 - sBoxMon1
dec a
jr z, .sBoxMon
; 3: Unknown
ld hl, TempMonDVs
dec a
jr z, .DVs
; else: WildMon
ld hl, EnemyMonDVs
jr .DVs
; Get our place in the party/box.
.PartyMon
.sBoxMon
ld a, [CurPartyMon]
call AddNTimes
.DVs
; sBoxMon data is read directly from SRAM.
ld a, [MonType]
cp BOXMON
ld a, 1
call z, GetSRAMBank
; Attack DV
ld a, [hli]
and $f0
ld b, a
; Speed DV
ld a, [hl]
and $f0
swap a
; Put our DVs together.
or b
ld b, a
; Close SRAM if we were dealing with a sBoxMon.
ld a, [MonType]
cp BOXMON
call z, CloseSRAM
; We need the gender ratio to do anything with this.
push bc
ld a, [CurPartySpecies]
dec a
ld hl, BaseData + BaseGender - CurBaseData
ld bc, BaseData1 - BaseData
call AddNTimes
pop bc
ld a, BANK(BaseData)
call GetFarByte
; The higher the ratio, the more likely the monster is to be female.
cp $ff
jr z, .Genderless
and a
jr z, .Male
cp $fe
jr z, .Female
; Values below the ratio are male, and vice versa.
cp b
jr c, .Male
.Female
xor a
ret
.Male
ld a, 1
and a
ret
.Genderless
scf
ret
; 50c50
Function50c50: ; 50c50
ld a, [$d0eb]
inc a
ld c, a
ld a, $4
sub c
ld b, a
push hl
ld a, [Buffer1]
ld e, a
ld d, $0
ld a, $3e
call Function50cc9
ld a, b
and a
jr z, .asm_50c6f
ld c, a
ld a, $e3
call Function50cc9
.asm_50c6f
pop hl
inc hl
inc hl
inc hl
ld d, h
ld e, l
ld hl, TempMonMoves
ld b, 0
.asm_50c7a
ld a, [hli]
and a
jr z, .asm_50cc8
push bc
push hl
push de
ld hl, $cfa9
ld a, [hl]
push af
ld [hl], b
push hl
callab Functionf8ec
pop hl
pop af
ld [hl], a
pop de
pop hl
push hl
ld bc, TempMonPP - (TempMonMoves + 1)
add hl, bc
ld a, [hl]
and $3f
ld [$d077], a
ld h, d
ld l, e
push hl
ld de, $d077
ld bc, $0102
call PrintNum
ld a, $f3
ld [hli], a
ld de, $d265
ld bc, $0102
call PrintNum
pop hl
ld a, [Buffer1]
ld e, a
ld d, 0
add hl, de
ld d, h
ld e, l
pop hl
pop bc
inc b
ld a, b
cp NUM_MOVES
jr nz, .asm_50c7a
.asm_50cc8
ret
; 50cc9
Function50cc9: ; 50cc9
.asm_50cc9
ld [hli], a
ld [hld], a
add hl, de
dec c
jr nz, .asm_50cc9
ret
; 50cd0
Function50cd0: ; 50cd0
.asm_50cd0
ld [hl], $32
inc hl
ld [hl], $3e
dec hl
add hl, de
dec c
jr nz, .asm_50cd0
ret
; 50cdb
Function50cdb: ; 50cdb
push hl
push hl
ld hl, PartyMonNicknames
ld a, [CurPartyMon]
call GetNick
pop hl
call PlaceString
call Function5084a
pop hl
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_50d09
push hl
ld bc, $fff4
add hl, bc
ld b, $0
call DrawEnemyHP
pop hl
ld bc, $0005
add hl, bc
push de
call PrintLevel
pop de
.asm_50d09
ret
; 50d0a
Function50d0a: ; 50d0a
push de
inc de
inc de
ld a, [de]
ld b, a
inc de
ld a, [de]
or b
pop de
jr nz, Function50d2e
push de
ld de, FntString
call Function50d25
pop de
ld a, $1
and a
ret
; 50d22
FntString: ; 50d22
db "FNT@"
; 50d25
Function50d25: ; 50d25
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
ld [hl], a
ret
; 50d2e
Function50d2e: ; 50d2e
push de
ld a, [de]
ld de, PsnString
bit PSN, a
jr nz, .asm_50d53
ld de, BrnString
bit BRN, a
jr nz, .asm_50d53
ld de, FrzString
bit FRZ, a
jr nz, .asm_50d53
ld de, ParString
bit PAR, a
jr nz, .asm_50d53
ld de, SlpString
and SLP
jr z, .asm_50d59
.asm_50d53
call Function50d25
ld a, $1
and a
.asm_50d59
pop de
ret
; 50d5b
SlpString: db "SLP@"
PsnString: db "PSN@"
BrnString: db "BRN@"
FrzString: db "FRZ@"
ParString: db "PAR@"
; 50d6f
ListMoves: ; 50d6f
; List moves at hl, spaced every [Buffer1] tiles.
ld de, $d25e
ld b, $0
.asm_50d74
ld a, [de]
inc de
and a
jr z, .asm_50da7
push de
push hl
push hl
ld [CurSpecies], a
ld a, MOVE_NAME
ld [$cf61], a
call GetName
ld de, StringBuffer1
pop hl
push bc
call PlaceString
pop bc
ld a, b
ld [$d0eb], a
inc b
pop hl
push bc
ld a, [Buffer1]
ld c, a
ld b, 0
add hl, bc
pop bc
pop de
ld a, b
cp NUM_MOVES
jr z, .asm_50db8
jr .asm_50d74
.asm_50da7
ld a, b
.asm_50da8
push af
ld [hl], "-"
ld a, [Buffer1]
ld c, a
ld b, 0
add hl, bc
pop af
inc a
cp NUM_MOVES
jr nz, .asm_50da8
.asm_50db8
ret
; 50db9
Function50db9: ; 50db9
ld a, [$d263]
cp $1
jr nz, .asm_50dca
ld hl, OTPartyCount
ld de, OTPartyMonOT
ld a, ENEMY_OT_NAME
jr .asm_50dfc
.asm_50dca
cp $4
jr nz, .asm_50dd8
ld hl, PartyCount
ld de, PartyMonOT
ld a, PARTY_OT_NAME
jr .asm_50dfc
.asm_50dd8
cp $5
jr nz, .asm_50de6
ld hl, $d0f0
ld de, PokemonNames
ld a, PKMN_NAME
jr .asm_50dfc
.asm_50de6
cp $2
jr nz, .asm_50df4
ld hl, NumItems
ld de, ItemNames
ld a, ITEM_NAME
jr .asm_50dfc
.asm_50df4
ld hl, $d0f0
ld de, ItemNames
ld a, ITEM_NAME
.asm_50dfc
ld [$cf61], a
ld a, l
ld [$d100], a
ld a, h
ld [$d101], a
ld a, e
ld [$d102], a
ld a, d
ld [$d103], a
ld bc, $67c1 ; XXX ItemAttributes?
ld a, c
ld [$d104], a
ld a, b
ld [$d105], a
ret
; 50e1b
Function50e1b: ; 50e1b
ld a, [TempMonSpecies]
ld [CurSpecies], a
call GetBaseData
ld d, 1
.asm_50e26
inc d
ld a, d
cp (MAX_LEVEL + 1) % $100
jr z, .asm_50e45
call Function50e47
push hl
ld hl, $d118
ld a, [$ffb6]
ld c, a
ld a, [hld]
sub c
ld a, [$ffb5]
ld c, a
ld a, [hld]
sbc c
ld a, [hMultiplicand]
ld c, a
ld a, [hl]
sbc c
pop hl
jr nc, .asm_50e26
.asm_50e45
dec d
ret
; 50e47
Function50e47: ; 50e47
ld a, [BaseGrowthRate]
add a
add a
ld c, a
ld b, 0
ld hl, GrowthRates
add hl, bc
call Function50eed
ld a, d
ld [hMultiplier], a
call Multiply
ld a, [hl]
and $f0
swap a
ld [hMultiplier], a
call Multiply
ld a, [hli]
and $f
ld [hMultiplier], a
ld b, $4
call Divide
ld a, [hMultiplicand]
push af
ld a, [$ffb5]
push af
ld a, [$ffb6]
push af
call Function50eed
ld a, [hl]
and $7f
ld [hMultiplier], a
call Multiply
ld a, [hMultiplicand]
push af
ld a, [$ffb5]
push af
ld a, [$ffb6]
push af
ld a, [hli]
push af
xor a
ld [hMultiplicand], a
ld [$ffb5], a
ld a, d
ld [$ffb6], a
ld a, [hli]
ld [hMultiplier], a
call Multiply
ld b, [hl]
ld a, [$ffb6]
sub b
ld [$ffb6], a
ld b, $0
ld a, [$ffb5]
sbc b
ld [$ffb5], a
ld a, [hMultiplicand]
sbc b
ld [hMultiplicand], a
pop af
and $80
jr nz, .asm_50ec8
pop bc
ld a, [$ffb6]
add b
ld [$ffb6], a
pop bc
ld a, [$ffb5]
adc b
ld [$ffb5], a
pop bc
ld a, [hMultiplicand]
adc b
ld [hMultiplicand], a
jr .asm_50eda
.asm_50ec8
pop bc
ld a, [$ffb6]
sub b
ld [$ffb6], a
pop bc
ld a, [$ffb5]
sbc b
ld [$ffb5], a
pop bc
ld a, [hMultiplicand]
sbc b
ld [hMultiplicand], a
.asm_50eda
pop bc
ld a, [$ffb6]
add b
ld [$ffb6], a
pop bc
ld a, [$ffb5]
adc b
ld [$ffb5], a
pop bc
ld a, [hMultiplicand]
adc b
ld [hMultiplicand], a
ret
; 50eed
Function50eed: ; 50eed
xor a
ld [hMultiplicand], a
ld [$ffb5], a
ld a, d
ld [$ffb6], a
ld [hMultiplier], a
jp Multiply
; 50efa
GrowthRates: ; 50efa
growth_rate: MACRO
; [1]/[2]*n**3 + [3]*n**2 + [4]*n - [5]
dn \1, \2
if \3 & $80 ; signed
db -\3 | $80
else
db \3
endc
db \4, \5
ENDM
growth_rate 1, 1, 0, 0, 0 ; Medium Fast
growth_rate 3, 4, 10, 0, 30
growth_rate 3, 4, 20, 0, 70
growth_rate 6, 5, -15, 100, 140 ; Medium Slow
growth_rate 4, 5, 0, 0, 0 ; Fast
growth_rate 5, 4, 0, 0, 0 ; Slow
; 50f12
Function50f12:
ld a, [$d0e3]
dec a
ld [$d1ec], a
ld b, a
ld a, [$cfa9]
dec a
ld [Buffer2], a ; $d1eb (aliases: MovementType)
cp b
jr z, .asm_50f33
call Function50f62
ld a, [$d1ec]
call Function50f34
ld a, [Buffer2] ; $d1eb (aliases: MovementType)
call Function50f34
.asm_50f33
ret
Function50f34: ; 50f34 (14:4f34)
push af
hlcoord 0, 1
ld bc, $28
call AddNTimes
ld bc, $28
ld a, $7f
call ByteFill
pop af
ld hl, Sprites ; $c400
ld bc, $10
call AddNTimes
ld de, $4
ld c, $4
.asm_50f55
ld [hl], $a0
add hl, de
dec c
jr nz, .asm_50f55
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
ret
Function50f62: ; 50f62 (14:4f62)
push hl
push de
push bc
ld bc, PartySpecies ; $dcd8
ld a, [Buffer2] ; $d1eb (aliases: MovementType)
ld l, a
ld h, $0
add hl, bc
ld d, h
ld e, l
ld a, [$d1ec]
ld l, a
ld h, $0
add hl, bc
ld a, [hl]
push af
ld a, [de]
ld [hl], a
pop af
ld [de], a
ld a, [Buffer2] ; $d1eb (aliases: MovementType)
ld hl, PartyMons ; $dcdf (aliases: PartyMon1, PartyMon1Species)
ld bc, $30
call AddNTimes
push hl
ld de, DefaultFlypoint ; $d002
ld bc, $30
call CopyBytes
ld a, [$d1ec]
ld hl, PartyMons ; $dcdf (aliases: PartyMon1, PartyMon1Species)
ld bc, $30
call AddNTimes
pop de
push hl
ld bc, $30
call CopyBytes
pop de
ld hl, DefaultFlypoint ; $d002
ld bc, $30
call CopyBytes
ld a, [Buffer2] ; $d1eb (aliases: MovementType)
ld hl, PartyMonOT ; $ddff (aliases: PartyMonOT)
call SkipNames
push hl
call Function51036
ld a, [$d1ec]
ld hl, PartyMonOT ; $ddff (aliases: PartyMonOT)
call SkipNames
pop de
push hl
call Function51039
pop de
ld hl, DefaultFlypoint ; $d002
call Function51039
ld hl, PartyMonNicknames ; $de41 (aliases: PartyMonNicknames)
ld a, [Buffer2] ; $d1eb (aliases: MovementType)
call SkipNames
push hl
call Function51036
ld hl, PartyMonNicknames ; $de41 (aliases: PartyMonNicknames)
ld a, [$d1ec]
call SkipNames
pop de
push hl
call Function51039
pop de
ld hl, DefaultFlypoint ; $d002
call Function51039
ld hl, $a600
ld a, [Buffer2] ; $d1eb (aliases: MovementType)
ld bc, $2f
call AddNTimes
push hl
ld de, DefaultFlypoint ; $d002
ld bc, $2f
ld a, $0
call GetSRAMBank
call CopyBytes
ld hl, $a600
ld a, [$d1ec]
ld bc, $2f
call AddNTimes
pop de
push hl
ld bc, $2f
call CopyBytes
pop de
ld hl, DefaultFlypoint ; $d002
ld bc, $2f
call CopyBytes
call CloseSRAM
pop bc
pop de
pop hl
ret
Function51036: ; 51036 (14:5036)
ld de, DefaultFlypoint ; $d002
Function51039: ; 51039 (14:5039)
ld bc, $b
call CopyBytes
ret
GetUnownLetter: ; 51040
; Return Unown letter in UnownLetter based on DVs at hl
; Take the middle 2 bits of each DV and place them in order:
; atk def spd spc
; .ww..xx. .yy..zz.
; atk
ld a, [hl]
and %01100000
sla a
ld b, a
; def
ld a, [hli]
and %00000110
swap a
srl a
or b
ld b, a
; spd
ld a, [hl]
and %01100000
swap a
sla a
or b
ld b, a
; spc
ld a, [hl]
and %00000110
srl a
or b
; Divide by 10 to get 0-25
ld [hDividend + 3], a
xor a
ld [hDividend], a
ld [hDividend + 1], a
ld [hDividend + 2], a
ld a, 10
ld [hDivisor], a
ld b, $4
call Divide
; Increment to get 1-26
ld a, [hQuotient + 2]
inc a
ld [UnownLetter], a
ret
; 51077
GetFrontpic: ; 51077
ld a, [CurPartySpecies]
ld [CurSpecies], a
call IsAPokemon
ret c
ld a, [rSVBK]
push af
call _GetFrontpic
pop af
ld [rSVBK], a
ret
; 5108b
Function5108b: ; 5108b
ld a, [CurPartySpecies]
ld [CurSpecies], a
call IsAPokemon
ret c
ld a, [rSVBK]
push af
xor a
ld [hBGMapMode], a
call _GetFrontpic
call Function51103
pop af
ld [rSVBK], a
ret
; 510a5
_GetFrontpic: ; 510a5
push de
call GetBaseData
ld a, [BasePicSize]
and $f
ld b, a
push bc
call GetFrontpicPointer
ld a, $6
ld [rSVBK], a
ld a, b
ld de, $d800
call FarDecompress
pop bc
ld hl, $d000
ld de, $d800
call Function512ab
pop hl
push hl
ld de, $d000
ld c, 7 * 7
ld a, [hROMBank]
ld b, a
call Get2bpp
pop hl
ret
; 510d7
GetFrontpicPointer: ; 510d7
GLOBAL PicPointers, UnownPicPointers
ld a, [CurPartySpecies]
cp UNOWN
jr z, .unown
ld a, [CurPartySpecies]
ld d, BANK(PicPointers)
jr .ok
.unown
ld a, [UnownLetter]
ld d, BANK(UnownPicPointers)
.ok
ld hl, PicPointers ; UnownPicPointers
dec a
ld bc, 6
call AddNTimes
ld a, d
call GetFarByte
call FixPicBank
push af
inc hl
ld a, d
call GetFarHalfword
pop bc
ret
; 51103
Function51103: ; 51103
ld a, $1
ld [rVBK], a
push hl
ld de, $d000
ld c, 7 * 7
ld a, [hROMBank]
ld b, a
call Get2bpp
pop hl
ld de, 7 * 7 * $10
add hl, de
push hl
ld a, $1
ld hl, BasePicSize
call GetFarWRAMByte
pop hl
and $f
ld de, $d800 + 5 * 5 * $10
ld c, 5 * 5
cp 5
jr z, .asm_5113b
ld de, $d800 + 6 * 6 * $10
ld c, 6 * 6
cp 6
jr z, .asm_5113b
ld de, $d800 + 7 * 7 * $10
ld c, 7 * 7
.asm_5113b
push hl
push bc
call Function5114f
pop bc
pop hl
ld de, $d000
ld a, [hROMBank]
ld b, a
call Get2bpp
xor a
ld [rVBK], a
ret
; 5114f
Function5114f: ; 5114f
ld hl, Unkn1Pals
swap c
ld a, c
and $f
ld b, a
ld a, c
and $f0
ld c, a
push bc
call Function512f2
pop bc
.asm_51161
push bc
ld c, $0
call Function512f2
pop bc
dec b
jr nz, .asm_51161
ret
; 5116c
GetBackpic: ; 5116c
ld a, [CurPartySpecies]
call IsAPokemon
ret c
ld a, [CurPartySpecies]
ld b, a
ld a, [UnownLetter]
ld c, a
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
push de
; These are assumed to be at the same
; address in their respective banks.
GLOBAL PicPointers, UnownPicPointers
ld hl, PicPointers ; UnownPicPointers
ld a, b
ld d, BANK(PicPointers)
cp UNOWN
jr nz, .ok
ld a, c
ld d, BANK(UnownPicPointers)
.ok
dec a
ld bc, 6
call AddNTimes
ld bc, 3
add hl, bc
ld a, d
call GetFarByte
call FixPicBank
push af
inc hl
ld a, d
call GetFarHalfword
ld de, $d000
pop af
call FarDecompress
ld hl, $d000
ld c, 6 * 6
call Function5127c
pop hl
ld de, $d000
ld a, [hROMBank]
ld b, a
call Get2bpp
pop af
ld [rSVBK], a
ret
; 511c5
FixPicBank: ; 511c5
; This is a thing for some reason.
push hl
push bc
sub PICS_1 - $36
ld c, a
ld b, 0
ld hl, Unknown_511d4
add hl, bc
ld a, [hl]
pop bc
pop hl
ret
; 511d4
Unknown_511d4: ; 511d4
db PICS_1
db PICS_2
db PICS_3
db PICS_4
db PICS_5
db PICS_6
db PICS_7
db PICS_8
db PICS_9
db PICS_10
db PICS_11
db PICS_12
db PICS_13
db PICS_14
db PICS_15
db PICS_16
db PICS_17
db PICS_18
db PICS_19
db PICS_19 + 1
db PICS_19 + 2
db PICS_19 + 3
db PICS_19 + 4
db PICS_19 + 5
Function511ec: ; 511ec
ld a, c
push de
ld hl, PicPointers
dec a
ld bc, 6
call AddNTimes
ld a, BANK(PicPointers)
call GetFarByte
call FixPicBank
push af
inc hl
ld a, BANK(PicPointers)
call GetFarHalfword
pop af
pop de
call FarDecompress
ret
; 0x5120d
GetTrainerPic: ; 5120d
ld a, [TrainerClass]
and a
ret z
cp NUM_TRAINER_CLASSES
ret nc
call WaitBGMap
xor a
ld [hBGMapMode], a
ld hl, TrainerPicPointers
ld a, [TrainerClass]
dec a
ld bc, 3
call AddNTimes
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
push de
ld a, BANK(TrainerPicPointers)
call GetFarByte
call FixPicBank
push af
inc hl
ld a, BANK(TrainerPicPointers)
call GetFarHalfword
pop af
ld de, $d000
call FarDecompress
pop hl
ld de, $d000
ld c, 7 * 7
ld a, [hROMBank]
ld b, a
call Get2bpp
pop af
ld [rSVBK], a
call WaitBGMap
ld a, $1
ld [hBGMapMode], a
ret
; 5125d
DecompressPredef: ; 5125d
; Decompress lz data from b:hl to scratch space at 6:d000, then copy it to address de.
ld a, [rSVBK]
push af
ld a, 6
ld [rSVBK], a
push de
push bc
ld a, b
ld de, $d000
call FarDecompress
pop bc
ld de, $d000
pop hl
ld a, [hROMBank]
ld b, a
call Get2bpp
pop af
ld [rSVBK], a
ret
; 5127c
Function5127c: ; 5127c
push de
push bc
ld a, [$c2c6]
and a
jr z, .asm_512a8
ld a, c
cp 7 * 7
ld de, 7 * 7 * $10
jr z, .asm_51296
cp 6 * 6
ld de, 6 * 6 * $10
jr z, .asm_51296
ld de, 5 * 5 * $10
.asm_51296
ld a, [hl]
ld b, $0
ld c, $8
.asm_5129b
rra
rl b
dec c
jr nz, .asm_5129b
ld a, b
ld [hli], a
dec de
ld a, e
or d
jr nz, .asm_51296
.asm_512a8
pop bc
pop de
ret
; 512ab
Function512ab: ; 512ab
ld a, b
cp 6
jr z, .six
cp 5
jr z, .five
.seven
ld c, $70
call Function512f2
dec b
jr nz, .seven
ret
.six
ld c, $70
xor a
call .Fill
.asm_512c3
ld c, $10
xor a
call .Fill
ld c, $60
call Function512f2
dec b
jr nz, .asm_512c3
ret
.five
ld c, $70
xor a
call .Fill
.asm_512d8
ld c, $20
xor a
call .Fill
ld c, $50
call Function512f2
dec b
jr nz, .asm_512d8
ld c, $70
xor a
call .Fill
ret
.Fill
ld [hli], a
dec c
jr nz, .Fill
ret
; 512f2
Function512f2: ; 512f2
ld a, [$c2c6]
and a
jr nz, .asm_512ff
.asm_512f8
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .asm_512f8
ret
.asm_512ff
push bc
.asm_51300
ld a, [de]
inc de
ld b, a
xor a
rept 8
rr b
rla
endr
ld [hli], a
dec c
jr nz, .asm_51300
pop bc
ret
; 51322
Function51322: ; 51322
ld a, $1
call GetSRAMBank
ld hl, sBoxCount
call Function513cb
ld a, [sBoxCount]
dec a
ld [$d265], a
ld hl, sBoxMonNicknames
ld bc, PKMN_NAME_LENGTH
ld de, $d002
call Function513e0
ld a, [sBoxCount]
dec a
ld [$d265], a
ld hl, sBoxMonOT
ld bc, NAME_LENGTH
ld de, $d00d
call Function513e0
ld a, [sBoxCount]
dec a
ld [$d265], a
ld hl, sBoxMons
ld bc, sBoxMon1End - sBoxMon1
ld de, $d018
call Function513e0
ld hl, $d01a
ld de, TempMonMoves
ld bc, NUM_MOVES
call CopyBytes
ld hl, $d02f
ld de, TempMonPP
ld bc, NUM_MOVES
call CopyBytes
ld a, [CurPartyMon]
ld b, a
callba Functiondcb6
jp CloseSRAM
; 5138b
Function5138b: ; 5138b
ld hl, PartyCount
call Function513cb
ld a, [PartyCount]
dec a
ld [$d265], a
ld hl, PartyMonNicknames
ld bc, PKMN_NAME_LENGTH
ld de, $d002
call Function513e0
ld a, [PartyCount]
dec a
ld [$d265], a
ld hl, PartyMonOT
ld bc, NAME_LENGTH
ld de, $d00d
call Function513e0
ld a, [PartyCount]
dec a
ld [$d265], a
ld hl, PartyMons
ld bc, PartyMon2 - PartyMon1
ld de, $d018
call Function513e0
ret
; 513cb
Function513cb: ; 513cb
inc [hl]
inc hl
ld a, [CurPartyMon]
ld c, a
ld b, 0
add hl, bc
ld a, [CurPartySpecies]
ld c, a
.asm_513d8
ld a, [hl]
ld [hl], c
inc hl
inc c
ld c, a
jr nz, .asm_513d8
ret
; 513e0
Function513e0: ; 513e0
push de
push hl
push bc
ld a, [$d265]
dec a
call AddNTimes
push hl
add hl, bc
ld d, h
ld e, l
pop hl
.asm_513ef
push bc
ld a, [$d265]
ld b, a
ld a, [CurPartyMon]
cp b
pop bc
jr z, .asm_51415
push hl
push de
push bc
call CopyBytes
pop bc
pop de
pop hl
push hl
ld a, l
sub c
ld l, a
ld a, h
sbc b
ld h, a
pop de
ld a, [$d265]
dec a
ld [$d265], a
jr .asm_513ef
.asm_51415
pop bc
pop hl
ld a, [CurPartyMon]
call AddNTimes
ld d, h
ld e, l
pop hl
call CopyBytes
ret
; 51424
BaseData::
INCLUDE "data/base_stats.asm"
PokemonNames::
INCLUDE "data/pokemon_names.asm"
INCBIN "baserom.gbc",$53d84,$53d9c - $53d84
UnknownEggPic:: ; 53d9c
; Another egg pic. This is shifted up a few pixels.
INCBIN "gfx/misc/unknown_egg.5x5.2bpp.lz"
; 53e2e
SECTION "bank19", ROMX, BANK[$19]
INCLUDE "text/phone/extra.asm"
SECTION "bank20", ROMX, BANK[$20]
DoPlayerMovement:: ; 80000
call GetMovementInput
ld a, $3e ; standing
ld [MovementAnimation], a
xor a
ld [$d041], a
call GetPlayerMovement
ld c, a
ld a, [MovementAnimation]
ld [$c2de], a
ret
; 80017
GetMovementInput: ; 80017
ld a, [hJoyDown]
ld [CurInput], a
; Standing downhill instead moves down.
ld hl, BikeFlags
bit 2, [hl] ; downhill
ret z
ld c, a
and $f0
ret nz
ld a, c
or D_DOWN
ld [CurInput], a
ret
; 8002d
GetPlayerMovement: ; 8002d
ld a, [PlayerState]
cp PLAYER_NORMAL
jr z, .Normal
cp PLAYER_SURF
jr z, .Surf
cp PLAYER_SURF_PIKA
jr z, .Surf
cp PLAYER_BIKE
jr z, .Normal
cp PLAYER_SLIP
jr z, .Board
.Normal
call CheckForcedMovementInput
call GetMovementAction
call CheckTileMovement
ret c
call CheckTurning
ret c
call TryStep
ret c
call TryJumpLedge
ret c
call CheckEdgeWarp
ret c
jr .NotMoving
.Surf
call CheckForcedMovementInput
call GetMovementAction
call CheckTileMovement
ret c
call CheckTurning
ret c
call TrySurfStep
ret c
jr .NotMoving
.Board
call CheckForcedMovementInput
call GetMovementAction
call CheckTileMovement
ret c
call CheckTurning
ret c
call TryStep
ret c
call TryJumpLedge
ret c
call CheckEdgeWarp
ret c
ld a, [WalkingDirection]
cp STANDING
jr z, .HitWall
call PlayBump
.HitWall
call StandInPlace
xor a
ret
.NotMoving
ld a, [WalkingDirection]
cp STANDING
jr z, .Standing
; Walking into an edge warp won't bump.
ld a, [$d041]
and a
jr nz, .CantMove
call PlayBump
.CantMove
call WalkInPlace
xor a
ret
.Standing
call StandInPlace
xor a
ret
; 800b7
CheckTileMovement: ; 800b7
; Tiles such as waterfalls and warps move the player
; in a given direction, overriding input.
ld a, [StandingTile]
ld c, a
call CheckWhirlpoolTile
jr c, .asm_800c4
ld a, 3
scf
ret
.asm_800c4
and $f0
cp $30 ; moving water
jr z, .water
cp $40 ; moving land 1
jr z, .land1
cp $50 ; moving land 2
jr z, .land2
cp $70 ; warps
jr z, .warps
jr .asm_8013c
.water
ld a, c
and 3
ld c, a
ld b, 0
ld hl, .water_table
add hl, bc
ld a, [hl]
ld [WalkingDirection], a
jr .asm_8013e
.water_table
db RIGHT
db LEFT
db UP
db DOWN
.land1
ld a, c
and 7
ld c, a
ld b, 0
ld hl, .land1_table
add hl, bc
ld a, [hl]
cp STANDING
jr z, .asm_8013c
ld [WalkingDirection], a
jr .asm_8013e
.land1_table
db STANDING
db RIGHT
db LEFT
db UP
db DOWN
db STANDING
db STANDING
db STANDING
.land2
ld a, c
and 7
ld c, a
ld b, 0
ld hl, .land2_table
add hl, bc
ld a, [hl]
cp STANDING
jr z, .asm_8013c
ld [WalkingDirection], a
jr .asm_8013e
.land2_table
db RIGHT
db LEFT
db UP
db DOWN
db STANDING
db STANDING
db STANDING
db STANDING
.warps
ld a, c
cp $71 ; door
jr z, .down
cp $79
jr z, .down
cp $7a ; stairs
jr z, .down
cp $7b ; cave
jr nz, .asm_8013c
.down
ld a, DOWN
ld [WalkingDirection], a
jr .asm_8013e
.asm_8013c
xor a
ret
.asm_8013e
ld a, STEP_WALK
call DoStep
ld a, 5
scf
ret
; 80147
CheckTurning: ; 80147
; If the player is turning, change direction first. This also lets
; the player change facing without moving by tapping a direction.
ld a, [$d04e]
cp 0
jr nz, .asm_80169
ld a, [WalkingDirection]
cp STANDING
jr z, .asm_80169
ld e, a
ld a, [PlayerDirection]
rrca
rrca
and 3
cp e
jr z, .asm_80169
ld a, STEP_TURN
call DoStep
ld a, 2
scf
ret
.asm_80169
xor a
ret
; 8016b
TryStep: ; 8016b
; Surfing actually calls TrySurfStep directly instead of passing through here.
ld a, [PlayerState]
cp PLAYER_SURF
jr z, TrySurfStep
cp PLAYER_SURF_PIKA
jr z, TrySurfStep
call CheckLandPermissions
jr c, .asm_801be
call IsNPCInFront
and a
jr z, .asm_801be
cp 2
jr z, .asm_801be
ld a, [StandingTile]
call CheckIceTile
jr nc, .ice
; Downhill riding is slower when not moving down.
call CheckRiding
jr nz, .asm_801ae
ld hl, BikeFlags
bit 2, [hl] ; downhill
jr z, .fast
ld a, [WalkingDirection]
cp DOWN
jr z, .fast
ld a, STEP_WALK
call DoStep
scf
ret
.fast
ld a, STEP_BIKE
call DoStep
scf
ret
.asm_801ae
ld a, STEP_WALK
call DoStep
scf
ret
.ice
ld a, STEP_ICE
call DoStep
scf
ret
; unused?
xor a
ret
.asm_801be
xor a
ret
; 801c0
TrySurfStep: ; 801c0
call CheckWaterPermissions
ld [$d040], a
jr c, .asm_801f1
call IsNPCInFront
ld [$d03f], a
and a
jr z, .asm_801f1
cp 2
jr z, .asm_801f1
ld a, [$d040]
and a
jr nz, .ExitWater
ld a, STEP_WALK
call DoStep
scf
ret
.ExitWater
call WaterToLandSprite
call PlayMapMusic
ld a, STEP_WALK
call DoStep
ld a, 6
scf
ret
.asm_801f1
xor a
ret
; 801f3
TryJumpLedge: ; 801f3
ld a, [StandingTile]
ld e, a
and $f0
cp $a0 ; ledge
jr nz, .DontJump
ld a, e
and 7
ld e, a
ld d, 0
ld hl, .data_8021e
add hl, de
ld a, [FacingDirection]
and [hl]
jr z, .DontJump
ld de, SFX_JUMP_OVER_LEDGE
call PlaySFX
ld a, STEP_LEDGE
call DoStep
ld a, 7
scf
ret
.DontJump
xor a
ret
.data_8021e
db FACE_RIGHT
db FACE_LEFT
db FACE_UP
db FACE_DOWN
db FACE_RIGHT | FACE_DOWN
db FACE_DOWN | FACE_LEFT
db FACE_UP | FACE_RIGHT
db FACE_UP | FACE_LEFT
; 80226
CheckEdgeWarp: ; 80226
; Bug: Since no case is made for STANDING here, it will check
; [.edgewarps + $ff]. This resolves to $3e at $8035a.
; This causes $d041 to be nonzero when standing on tile $3e,
; making bumps silent.
ld a, [WalkingDirection]
ld e, a
ld d, 0
ld hl, .EdgeWarps
add hl, de
ld a, [StandingTile]
cp [hl]
jr nz, .asm_80259
ld a, 1
ld [$d041], a
ld a, [WalkingDirection]
cp STANDING
jr z, .asm_80259
ld e, a
ld a, [PlayerDirection]
rrca
rrca
and 3
cp e
jr nz, .asm_80259
call Function224a ; CheckFallPit?
jr nc, .asm_80259
call StandInPlace
scf
ld a, 1
ret
.asm_80259
xor a
ret
.EdgeWarps
db $70, $78, $76, $7e
; 8025f
DoStep: ; 8025f
ld e, a
ld d, 0
ld hl, .Steps
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [WalkingDirection]
ld e, a
cp STANDING
jp z, StandInPlace
add hl, de
ld a, [hl]
ld [MovementAnimation], a
ld hl, .WalkInPlace
add hl, de
ld a, [hl]
ld [$d04e], a
ld a, 4
ret
.Steps
dw .Slow
dw .Walk
dw .Bike
dw .Ledge
dw .Ice
dw .Turn
dw .BackwardsLedge
dw .WalkInPlace
.Slow
db $08, $09, $0a, $0b
.Walk
db $0c, $0d, $0e, $0f
.Bike
db $10, $11, $12, $13
.Ledge
db $30, $31, $32, $33
.Ice
db $1c, $1d, $1e, $1f
.BackwardsLedge
db $31, $30, $33, $32
.Turn
db $04, $05, $06, $07
.WalkInPlace
db $80, $81, $82, $83
; 802b3
StandInPlace: ; 802b3
ld a, 0
ld [$d04e], a
ld a, $3e ; standing
ld [MovementAnimation], a
xor a
ret
; 802bf
WalkInPlace: ; 802bf
ld a, 0
ld [$d04e], a
ld a, $50 ; walking
ld [MovementAnimation], a
xor a
ret
; 802cb
CheckForcedMovementInput: ; 802cb
; When sliding on ice, input is forced to remain in the same direction.
call Function80404
ret nc
ld a, [$d04e]
cp 0
ret z
and 3
ld e, a
ld d, 0
ld hl, .data_802e8
add hl, de
ld a, [CurInput]
and A_BUTTON | B_BUTTON | SELECT | START
or [hl]
ld [CurInput], a
ret
.data_802e8
db D_DOWN, D_UP, D_LEFT, D_RIGHT
; 802ec
GetMovementAction: ; 802ec
; Poll player input and update movement info.
ld hl, .table
ld de, .table2 - .table1
ld a, [CurInput]
bit 7, a
jr nz, .down
bit 6, a
jr nz, .up
bit 5, a
jr nz, .left
bit 4, a
jr nz, .right
; Standing
jr .update
.down add hl, de
.up add hl, de
.left add hl, de
.right add hl, de
.update
ld a, [hli]
ld [WalkingDirection], a
ld a, [hli]
ld [FacingDirection], a
ld a, [hli]
ld [WalkingX], a
ld a, [hli]
ld [WalkingY], a
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
ld [WalkingTile], a
ret
.table
; struct:
; walk direction
; facing
; x movement
; y movement
; tile collision pointer
.table1
db STANDING, FACE_CURRENT, 0, 0
dw StandingTile
.table2
db RIGHT, FACE_RIGHT, 1, 0
dw TileRight
db LEFT, FACE_LEFT, -1, 0
dw TileLeft
db UP, FACE_UP, 0, -1
dw TileUp
db DOWN, FACE_DOWN, 0, 1
dw TileDown
; 80341
IsNPCInFront: ; 80341
ld a, 0
ld [$ffaf], a
ld a, [MapX]
ld d, a
ld a, [WalkingX]
add d
ld d, a
ld a, [MapY]
ld e, a
ld a, [WalkingY]
add e
ld e, a
ld bc, ObjectStructs ; redundant
callba Function7041
jr nc, .asm_80369
call Function8036f
jr c, .asm_8036c
xor a
ret
.asm_80369
ld a, 1
ret
.asm_8036c
ld a, 2
ret
; 8036f
Function8036f: ; 8036f
ld hl, BikeFlags
bit 0, [hl]
jr z, .asm_8039c
ld hl, $0007
add hl, bc
ld a, [hl]
cp $ff
jr nz, .asm_8039c
ld hl, $0006
add hl, bc
bit 6, [hl]
jr z, .asm_8039c
ld hl, $0005
add hl, bc
set 2, [hl]
ld a, [WalkingDirection]
ld d, a
ld hl, $0020
add hl, bc
ld a, [hl]
and $fc
or d
ld [hl], a
scf
ret
.asm_8039c
xor a
ret
; 8039e
CheckLandPermissions: ; 8039e
; Return 0 if walking onto land and tile permissions allow it.
; Otherwise, return carry.
ld a, [TilePermissions]
ld d, a
ld a, [FacingDirection]
and d
jr nz, .NotWalkable
ld a, [WalkingTile]
call CheckWalkable
jr c, .NotWalkable
xor a
ret
.NotWalkable
scf
ret
; 803b4
CheckWaterPermissions: ; 803b4
; Return 0 if moving in water, or 1 if moving onto land.
; Otherwise, return carry.
ld a, [TilePermissions]
ld d, a
ld a, [FacingDirection]
and d
jr nz, .NotSurfable
ld a, [WalkingTile]
call CheckSurfable
jr c, .NotSurfable
and a
ret
.NotSurfable
scf
ret
; 803ca
CheckRiding: ; 803ca
ld a, [PlayerState]
cp PLAYER_BIKE
ret z
cp PLAYER_SLIP
ret
; 803d3
CheckWalkable: ; 803d3
; Return 0 if tile a is land. Otherwise, return carry.
call GetTileCollision
and a ; land
ret z
scf
ret
; 803da
CheckSurfable: ; 803da
; Return 0 if tile a is water, or 1 if land.
; Otherwise, return carry.
call GetTileCollision
cp 1
jr z, .Water
; Can walk back onto land from water.
and a
jr z, .Land
jr .Neither
.Water
xor a
ret
.Land
ld a, 1
and a
ret
.Neither
scf
ret
; 803ee
PlayBump: ; 803ee
call CheckSFX
ret c
ld de, SFX_BUMP
call PlaySFX
ret
; 803f9
WaterToLandSprite: ; 803f9
push bc
ld a, PLAYER_NORMAL
ld [PlayerState], a
call Functione4a ; UpdateSprites
pop bc
ret
; 80404
Function80404:: ; 80404
ld a, [$d04e]
cp 0
jr z, .asm_80420
cp $f0
jr z, .asm_80420
ld a, [StandingTile]
call CheckIceTile
jr nc, .asm_8041e
ld a, [PlayerState]
cp PLAYER_SLIP
jr nz, .asm_80420
.asm_8041e
scf
ret
.asm_80420
and a
ret
; 80422
Function80422:: ; 80422
ld hl, $c2de
ld a, $3e ; standing
cp [hl]
ret z
ld [hl], a
ld a, 0
ld [$d04e], a
ret
; 80430
EngineFlagAction:: ; 80430
; Do action b on engine flag de
;
; b = 0: reset flag
; = 1: set flag
; > 1: check flag, result in c
;
; Setting/resetting does not return a result.
; 16-bit flag ids are considered invalid, but it's nice
; to know that the infrastructure is there.
ld a, d
cp 0
jr z, .ceiling
jr c, .read ; cp 0 can't set carry!
jr .invalid
; There are only $a2 engine flags, so
; anything beyond that is invalid too.
.ceiling
ld a, e
cp $a2
jr c, .read
; Invalid flags are treated as flag $00.
.invalid
xor a
ld e, a
ld d, a
; Get this flag's location.
.read
ld hl, EngineFlags
; location
add hl, de
add hl, de
; bit
add hl, de
; location
ld e, [hl]
inc hl
ld d, [hl]
inc hl
; bit
ld c, [hl]
; What are we doing with this flag?
ld a, b
cp 1
jr c, .reset ; b = 0
jr z, .set ; b = 1
; Return the given flag in c.
.check
ld a, [de]
and c
ld c, a
ret
; Set the given flag.
.set
ld a, [de]
or c
ld [de], a
ret
; Reset the given flag.
.reset
ld a, c
cpl ; AND all bits except the one in question
ld c, a
ld a, [de]
and c
ld [de], a
ret
; 80462
EngineFlags: ; 80462
INCLUDE "engine/engine_flags.asm"
; 80648
Function80648:: ; 80648 (20:4648)
ld a, c
cp NUM_VARS
jr c, .asm_8064e
xor a
.asm_8064e
ld c, a
ld b, 0
ld hl, Unknown_80671
add hl, bc
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
inc hl
ld b, [hl]
ld a, b
and $80
jr nz, .asm_80668
ld a, b
and $40
ret nz
ld a, [de]
jr Function8066c
.asm_80668
call _de_
ret
Function8066c: ; 8066c (20:466c)
ld de, StringBuffer2 ; $d086
ld [de], a
ret
; 80671 (20:4671)
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, EndPokedexCaught - PokedexCaught
call CountSetBits
ld a, [$d265]
jp Function8066c
; 806d3
Function806d3: ; 806d3
; Seen mons.
ld hl, PokedexSeen
ld b, EndPokedexSeen - PokedexSeen
call CountSetBits
ld a, [$d265]
jp Function8066c
; 806e1
Function806e1: ; 806e1
; Number of owned badges.
ld hl, Badges ; $d857
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
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 ; BANK(sBoxCount)
call GetSRAMBank
ld hl, sBoxCount
ld a, MONS_PER_BOX
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"
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 [$c608], a
ld a, $52
ld [$c609], a
ld a, $4a
ld [$c60a], a
ld a, $29
ld [$c60b], 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
hlcoord 1, 3
ld bc, $0712
ld a, $6c
call Function81efc
hlcoord 11, 0
ld bc, $0203
ld a, $6d
call Function81efc
hlcoord 16, 0
ld bc, $0203
ld a, $6e
call Function81efc
call Function81bc0
call Function81bf4
ld a, [$cf66]
inc a
ld [CurPartySpecies], a
ld [$d265], a
hlcoord 0, 1
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
hlcoord 4, 1
call PlaceString
xor a
ld [$c2c6], a
hlcoord 12, 3
call Function378b
ld de, $9310
predef GetBackpic
ld a, $31
ld [$ffad], a
hlcoord 2, 4
ld bc, $0606
predef FillBox
ld a, [$d003]
and a
jr z, .asm_81b66
ld de, String_81baf
jr .asm_81b69
.asm_81b66
ld de, String_81bb4
.asm_81b69
hlcoord 7, 17
call PlaceString
hlcoord 0, 17
ld de, String_81bb9
call PlaceString
jr .asm_81ba9
.asm_81b7a
ld a, [$d265]
ld [TrainerClass], a
callab Function3957b
ld de, StringBuffer1
hlcoord 4, 1
call PlaceString
ld de, VTiles2
callab GetTrainerPic
xor a
ld [TempEnemyMonSpecies], a
ld [$ffad], a
hlcoord 2, 3
ld bc, $0707
predef FillBox
.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
hlcoord 2, 11
ld a, $1
call Function81bde
ld de, $cedd
hlcoord 2, 13
ld a, $2
call Function81bde
ld de, $cf05
hlcoord 2, 15
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, $c608
ld bc, $0004
call CopyBytes
xor a
ld [$cf64], a
ld [$cf65], a
ld de, $c608
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, $c608
ld c, $1
call Function81ee3
hlcoord 10, 2
ld de, $c608
call Function81ca7
hlcoord 15, 2
ld de, $c60a
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, [$c608]
ld [hli], a
ld a, [$c609]
ld [hli], a
ld a, [$c60a]
ld [hli], a
ld a, [$c60b]
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hl], a
ld hl, $cda9
call Function81f0c
hlcoord 10, 2
ld de, $c608
call Function81ca7
hlcoord 15, 2
ld de, $c60a
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, $c608
call Function81ea5
ret
.asm_81d28
ld a, $1
ld [$cf65], a
ld de, $c60a
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, $c612
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, $c613
jr Function81d63
Function81d58: ; 81d58
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, Function81d84
ld hl, $c614
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
hlcoord 0, 10
ld bc, $00a0
ld a, $6f
call ByteFill
hlcoord 2, 12
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
hlcoord 10, 11
call Function81e5e
hlcoord 10, 12
call Function81e5e
hlcoord 10, 13
call Function81e5e
hlcoord 10, 14
call Function81e5e
ld a, [$d004]
inc a
ld [$d265], a
predef GetTMHMMove
ld a, [$d265]
ld [$d262], a
call GetMoveName
hlcoord 10, 12
call PlaceString
ld a, [$d004]
call Function81e55
ld [CurItem], a
predef CanLearnTMHMMove
ld a, c
and a
ld de, String_81e46
jr nz, .asm_81e3f
ld de, String_81e4d
.asm_81e3f
hlcoord 10, 14
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, [$c612]
and $1f
ld e, a
ld a, [$c613]
and $7
sla a
swap a
or e
ld e, a
ld a, [$c613]
and $18
sla a
swap a
ld d, a
ld a, [$c614]
and $1f
sla a
sla a
or d
ld d, a
ld a, [$cf65]
and a
jr z, .asm_81e9c
ld a, e
ld [$c60a], a
ld a, d
ld [$c60b], a
ret
.asm_81e9c
ld a, e
ld [$c608], a
ld a, d
ld [$c609], a
ret
; 81ea5
Function81ea5: ; 81ea5
ld a, [de]
and $1f
ld [$c612], 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 [$c613], a
ld a, [de]
and $7c
srl a
srl a
ld [$c614], 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, $c608
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
hlcoord 10, 0
ld [hl], a
hlcoord 15, 0
ld [hl], a
hlcoord 1, 11
ld [hl], a
hlcoord 1, 13
ld [hl], a
hlcoord 1, 15
ld [hl], a
ld a, [$cf63]
cp $3
jr nz, .asm_81fc9
ld a, [$cf64]
and a
jr z, .asm_81f8d
dec a
hlcoord 1, 11
ld bc, $0028
call AddNTimes
ld [hl], $ed
.asm_81f8d
ld a, [$cf65]
and a
jr z, .asm_81f98
hlcoord 15, 0
jr .asm_81f9b
.asm_81f98
hlcoord 10, 0
.asm_81f9b
ld [hl], $ed
ld b, $70
ld c, $5
ld hl, Sprites
ld de, $c612
call .asm_81fb7
ld de, $c613
call .asm_81fb7
ld de, $c614
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"
TilesetColorTest:
ret
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
ld [$ffde], a
call ClearSprites
call Function2173
call Function3200
xor a
ld [hBGMapMode], a
ld de, DebugColorTestGFX + $10
ld hl, $96a0
lb bc, BANK(DebugColorTestGFX), $16
call Request2bpp
ld de, DebugColorTestGFX
ld hl, VTiles1
lb bc, BANK(DebugColorTestGFX), 1
call Request2bpp
ld a, $9c
ld [$ffd7], a
ld hl, TileMap
ld bc, $0168
ld a, $6f
call ByteFill
ld hl, AttrMap
ld bc, $0168
ld a, $7
call ByteFill
ld de, $0015
ld a, $6c
call Function821d2
ld de, $001a
ld a, $6d
call Function821d2
ld de, $001f
ld a, $6e
call Function821d2
ld de, $0024
ld a, $6f
call Function821d2
call Function821f4
call Function8220f
call Function3200
ld [$cf63], a
ld a, $40
ld [hWY], a
ret
; 821d2
Function821d2: ; 821d2
ld hl, TileMap
call Function821de
Function821d8: ; 821d8
ld a, [$cf64]
ld hl, AttrMap
Function821de: ; 821de
add hl, de
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld bc, $0010
add hl, bc
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld bc, $0010
add hl, bc
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ret
; 821f4
Function821f4: ; 821f4
hlcoord 2, 4
call Function82203
hlcoord 2, 6
call Function82203
hlcoord 2, 8
Function82203: ; 82203
ld a, $6a
ld [hli], a
ld bc, $000f
ld a, $6b
call ByteFill
ret
; 8220f
Function8220f: ; 8220f
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld a, [$cf64]
ld l, a
ld h, $0
add hl, hl
add hl, hl
add hl, hl
ld de, Unkn1Pals
add hl, de
ld de, $c608
ld bc, $0008
call CopyBytes
ld de, $c608
call Function81ea5
pop af
ld [rSVBK], a
ret
; 82236
Function82236: ; 82236
ld hl, $ffa9
ld a, [hl]
and $4
jr nz, .asm_82247
ld a, [hl]
and $2
jr nz, .asm_82299
call Function822f0
ret
.asm_82247
ld hl, $cf64
ld a, [hl]
inc a
and $7
cp $7
jr nz, .asm_82253
xor a
.asm_82253
ld [hl], a
ld de, $0015
call Function821d8
ld de, $001a
call Function821d8
ld de, $001f
call Function821d8
ld de, $0024
call Function821d8
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, BGPals
ld a, [$cf64]
ld bc, $0008
call AddNTimes
ld de, $c608
ld bc, $0008
call CopyBytes
pop af
ld [rSVBK], a
ld a, $2
ld [hBGMapMode], a
ld c, $3
call DelayFrames
ld a, $1
ld [hBGMapMode], a
ret
.asm_82299
call ClearSprites
ld a, [hWY]
xor $d0
ld [hWY], a
ret
; 822a3
Function822a3: ; 822a3
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, BGPals
ld a, [$cf64]
ld bc, $0008
call AddNTimes
ld e, l
ld d, h
ld hl, $c608
ld bc, $0008
call CopyBytes
hlcoord 1, 0
ld de, $c608
call Function81ca7
hlcoord 6, 0
ld de, $c60a
call Function81ca7
hlcoord 11, 0
ld de, $c60c
call Function81ca7
hlcoord 16, 0
ld de, $c60e
call Function81ca7
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
call DelayFrame
ret
; 822f0
Function822f0: ; 822f0
ld a, [$cf65]
and 3
ld e, a
ld d, 0
ld hl, Jumptable_82301
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 82301
Jumptable_82301: ; 82301
dw Function82309
dw Function82339
dw Function8234b
dw Function8235d
; 82309
Function82309: ; 82309
ld hl, $ffa9
ld a, [hl]
and $80
jr nz, Function8238c
ld a, [hl]
and $20
jr nz, .asm_8231c
ld a, [hl]
and $10
jr nz, .asm_82322
ret
.asm_8231c
ld a, [$cf66]
dec a
jr .asm_82326
.asm_82322
ld a, [$cf66]
inc a
.asm_82326
and $3
ld [$cf66], a
ld e, a
ld d, $0
ld hl, $c608
add hl, de
add hl, de
ld e, l
ld d, h
call Function81ea5
ret
Function82339: ; 82338
ld hl, $ffa9
ld a, [hl]
and $80
jr nz, Function8238c
ld a, [hl]
and $40
jr nz, Function82387
ld hl, $c612
jr Function82368
Function8234b: ; 8234b
ld hl, $ffa9
ld a, [hl]
and $80
jr nz, Function8238c
ld a, [hl]
and $40
jr nz, Function82387
ld hl, $c613
jr Function82368
Function8235d: ; 8235d
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, Function82387
ld hl, $c614
Function82368: ; 82368
ld a, [$ffa9]
and $10
jr nz, .asm_82375
ld a, [$ffa9]
and $20
jr nz, .asm_8237c
ret
.asm_82375
ld a, [hl]
cp $1f
ret nc
inc [hl]
jr .asm_82380
.asm_8237c
ld a, [hl]
and a
ret z
dec [hl]
.asm_82380
call Function82391
call Function822a3
ret
Function82387: ; 82387
ld hl, $cf65
dec [hl]
ret
Function8238c: ; 8238c
ld hl, $cf65
inc [hl]
ret
; 82391
Function82391: ; 82391
ld a, [$c612]
and $1f
ld e, a
ld a, [$c613]
and $7
sla a
swap a
or e
ld e, a
ld a, [$c613]
and $18
sla a
swap a
ld d, a
ld a, [$c614]
and $1f
sla a
sla a
or d
ld d, a
ld a, [$cf66]
ld c, a
ld b, $0
ld hl, $c608
add hl, bc
add hl, bc
ld a, e
ld [hli], a
ld [hl], d
ret
; 823c6
Function823c6: ; 823c6
ret
Function823c7: ; 823c7
ret
; 823c8
SECTION "bank21", ROMX, BANK[$21]
Function84000: ; 84000
ld hl, OverworldMap
ld bc, $040c
xor a
call Function842ab
xor a
ld [rSB], a
ld [rSC], a
ld [$c2d5], a
ld hl, $c2d4
set 0, [hl]
ld a, [GBPrinter]
ld [$cbfb], a
xor a
ld [$cf63], a
ret
; 84022
Function84022: ; 84022
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_84031
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 84031
Jumptable_84031: ; 84031 (21:4031)
dw Function84077
dw Function84143
dw Function84120
dw Function84099
dw Function84180
dw Function8412e
dw Function840c5
dw Function84180
dw Function84120
dw Function840de
dw Function84180
dw Function84120
dw Function841a1
dw Function84063
dw Function8406d
dw Function84120
dw Function84103
dw Function84071
dw Function841b0
dw Function841b3
Function84059: ; 84059 (21:4059)
ld hl, $cf63
inc [hl]
ret
Function8405e: ; 8405e (21:405e)
ld hl, $cf63
dec [hl]
ret
Function84063: ; 84063 (21:4063)
xor a
ld [$ca89], a
ld hl, $cf63
set 7, [hl]
ret
Function8406d: ; 8406d (21:406d)
call Function84059
ret
Function84071: ; 84071 (21:4071)
ld a, $1
ld [$cf63], a
ret
Function84077: ; 84077 (21:4077)
call Function841fb
ld hl, Unknown_842b7
call Function841e2
xor a
ld [$ca8e], a
ld [$ca8f], a
ld a, [$cf65]
ld [$ca81], a
call Function84059
call Function841c3
ld a, $1
ld [$cbf8], a
ret
Function84099: ; 84099 (21:4099)
call Function841fb
ld hl, $ca81
ld a, [hl]
and a
jr z, Function840c5
ld hl, Unknown_842c3
call Function841e2
call Function84260
ld a, $80
ld [$ca8e], a
ld a, $2
ld [$ca8f], a
call Function84219
call Function84059
call Function841c3
ld a, $2
ld [$cbf8], a
ret
Function840c5: ; 840c5 (21:40c5)
ld a, $6
ld [$cf63], a
ld hl, Unknown_842c9
call Function841e2
xor a
ld [$ca8e], a
ld [$ca8f], a
call Function84059
call Function841c3
ret
Function840de: ; 840de (21:40de)
call Function841fb
ld hl, Unknown_842bd
call Function841e2
call Function84249
ld a, $4
ld [$ca8e], a
ld a, $0
ld [$ca8f], a
call Function84219
call Function84059
call Function841c3
ld a, $3
ld [$cbf8], a
ret
Function84103: ; 84103 (21:4103)
call Function841fb
ld hl, Unknown_842b7
call Function841e2
xor a
ld [$ca8e], a
ld [$ca8f], a
ld a, [$cf65]
ld [$ca81], a
call Function84059
call Function841c3
ret
Function84120: ; 84120 (21:4120)
ld hl, $ca8b
inc [hl]
ld a, [hl]
cp $6
ret c
xor a
ld [hl], a
call Function84059
ret
Function8412e: ; 8412e (21:412e)
ld hl, $ca8b
inc [hl]
ld a, [hl]
cp $6
ret c
xor a
ld [hl], a
ld hl, $ca81
dec [hl]
call Function8405e
call Function8405e
ret
Function84143: ; 84143 (21:4143)
ld a, [$c2d5]
and a
ret nz
ld a, [$ca88]
cp $ff
jr nz, .asm_84156
ld a, [$ca89]
cp $ff
jr z, .asm_84172
.asm_84156
ld a, [$ca88]
cp $81
jr nz, .asm_84172
ld a, [$ca89]
cp $0
jr nz, .asm_84172
ld hl, $c2d4
set 1, [hl]
ld a, $5
ld [$ca8a], a
call Function84059
ret
.asm_84172
ld a, $ff
ld [$ca88], a
ld [$ca89], a
ld a, $e
ld [$cf63], a
ret
Function84180: ; 84180 (21:4180)
ld a, [$c2d5]
and a
ret nz
ld a, [$ca89]
and $f0
jr nz, .asm_8419b
ld a, [$ca89]
and $1
jr nz, .asm_84197
call Function84059
ret
.asm_84197
call Function8405e
ret
.asm_8419b
ld a, $12
ld [$cf63], a
ret
Function841a1: ; 841a1 (21:41a1)
ld a, [$c2d5]
and a
ret nz
ld a, [$ca89]
and $f3
ret nz
call Function84059
ret
Function841b0: ; 841b0 (21:41b0)
call Function84059
Function841b3: ; 841b3 (21:41b3)
ld a, [$c2d5]
and a
ret nz
ld a, [$ca89]
and $f0
ret nz
xor a
ld [$cf63], a
ret
Function841c3: ; 841c3 (21:41c3)
ld a, [$c2d5]
and a
jr nz, Function841c3
xor a
ld [$ca8c], a
ld [$ca8d], a
ld a, $1
ld [$c2d5], a
ld a, $88
ld [rSB], a ; $ff00+$1
ld a, $1
ld [rSC], a ; $ff00+$2
ld a, $81
ld [rSC], a ; $ff00+$2
ret
Function841e2: ; 841e2 (21:41e2)
ld a, [hli]
ld [$ca82], a
ld a, [hli]
ld [$ca83], a
ld a, [hli]
ld [$ca84], a
ld a, [hli]
ld [$ca85], a
ld a, [hli]
ld [$ca86], a
ld a, [hl]
ld [$ca87], a
ret
Function841fb: ; 841fb (21:41fb)
xor a
ld hl, $ca82
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld hl, $ca86
ld [hli], a
ld [hl], a
xor a
ld [$ca8e], a
ld [$ca8f], a
ld hl, OverworldMap ; $c800
ld bc, $280
call Function842ab
ret
Function84219: ; 84219 (21:4219)
ld hl, $0
ld bc, $4
ld de, $ca82
call Function8423c
ld a, [$ca8e]
ld c, a
ld a, [$ca8f]
ld b, a
ld de, OverworldMap ; $c800
call Function8423c
ld a, l
ld [$ca86], a
ld a, h
ld [$ca87], a
ret
Function8423c: ; 8423c (21:423c)
ld a, [de]
inc de
add l
jr nc, .asm_84242
inc h
.asm_84242
ld l, a
dec bc
ld a, c
or b
jr nz, Function8423c
ret
Function84249: ; 84249 (21:4249)
ld a, $1
ld [OverworldMap], a ; $c800
ld a, [$cbfa]
ld [$c801], a
ld a, $e4
ld [$c802], a
ld a, [$cbfb]
ld [$c803], a
ret
Function84260: ; 84260 (21:4260)
ld a, [$ca81]
xor $ff
ld d, a
ld a, [$cf65]
inc a
add d
ld hl, $ca90
ld de, $28
.asm_84271
and a
jr z, .asm_84278
add hl, de
dec a
jr .asm_84271
.asm_84278
ld e, l
ld d, h
ld hl, OverworldMap ; $c800
ld c, $28
.asm_8427f
ld a, [de]
inc de
push bc
push de
push hl
swap a
ld d, a
and $f0
ld e, a
ld a, d
and $f
ld d, a
and $8
ld a, d
jr nz, .asm_84297
or $90
jr .asm_84299
.asm_84297
or $80
.asm_84299
ld d, a
lb bc, $21, 1
call Request2bpp
pop hl
ld de, $10
add hl, de
pop de
pop bc
dec c
jr nz, .asm_8427f
ret
Function842ab: ; 842ab
push de
ld e, a
.asm_842ad
ld [hl], e
inc hl
dec bc
ld a, c
or b
jr nz, .asm_842ad
ld a, e
pop de
ret
; 842b7
Unknown_842b7: db 1, 0, $00, 0, 1, 0
Unknown_842bd: db 2, 0, $04, 0, 0, 0
Unknown_842c3: db 4, 0, $80, 2, 0, 0
Unknown_842c9: db 4, 0, $00, 0, 4, 0
Unknown_842cf: db 8, 0, $00, 0, 8, 0 ; unused
Unknown_842d5: db 15, 0, $00, 0, 15, 0 ; unused
; 842db
Function842db:: ; 842db
ld a, [$c2d5]
add a
ld e, a
ld d, 0
ld hl, Jumptable_842ea
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 842ea
Jumptable_842ea: ; 842ea (21:42ea)
dw Function8432f
dw Function84330
dw Function84339
dw Function84343
dw Function8434d
dw Function84357
dw Function84361
dw Function8438b
dw Function84395
dw Function8439f
dw Function843a8
dw Function843b6
dw Function84330
dw Function843c0
dw Function843c9
dw Function843c9
dw Function843c9
dw Function843c0
dw Function843c9
dw Function8439f
dw Function843a8
dw Function843e6
dw Function84330
dw Function843d2
dw Function843c9
dw Function843c9
dw Function843c9
dw Function843d2
dw Function843c9
dw Function8439f
dw Function843a8
dw Function843b6
Function8432a: ; 8432a (21:432a)
ld hl, $c2d5
inc [hl]
ret
Function8432f: ; 8432f (21:432f)
ret
Function84330: ; 84330 (21:4330)
ld a, $33
call Function843db
call Function8432a
ret
Function84339: ; 84339 (21:4339)
ld a, [$ca82]
call Function843db
call Function8432a
ret
Function84343: ; 84343 (21:4343)
ld a, [$ca83]
call Function843db
call Function8432a
ret
Function8434d: ; 8434d (21:434d)
ld a, [$ca84]
call Function843db
call Function8432a
ret
Function84357: ; 84357 (21:4357)
ld a, [$ca85]
call Function843db
call Function8432a
ret
Function84361: ; 84361 (21:4361)
ld hl, $ca8e
ld a, [hli]
ld d, [hl]
ld e, a
or d
jr z, .asm_84388
dec de
ld [hl], d
dec hl
ld [hl], e
ld a, [$ca8c]
ld e, a
ld a, [$ca8d]
ld d, a
ld hl, OverworldMap ; $c800
add hl, de
inc de
ld a, e
ld [$ca8c], a
ld a, d
ld [$ca8d], a
ld a, [hl]
call Function843db
ret
.asm_84388
call Function8432a
Function8438b: ; 8438b (21:438b)
ld a, [$ca86]
call Function843db
call Function8432a
ret
Function84395: ; 84395 (21:4395)
ld a, [$ca87]
call Function843db
call Function8432a
ret
Function8439f: ; 8439f (21:439f)
ld a, $0
call Function843db
call Function8432a
ret
Function843a8: ; 843a8 (21:43a8)
ld a, [rSB] ; $ff00+$1
ld [$ca88], a
ld a, $0
call Function843db
call Function8432a
ret
Function843b6: ; 843b6 (21:43b6)
ld a, [rSB] ; $ff00+$1
ld [$ca89], a
xor a
ld [$c2d5], a
ret
Function843c0: ; 843c0 (21:43c0)
ld a, $f
call Function843db
call Function8432a
ret
Function843c9: ; 843c9 (21:43c9)
ld a, $0
call Function843db
call Function8432a
ret
Function843d2: ; 843d2 (21:43d2)
ld a, $8
call Function843db
call Function8432a
ret
Function843db: ; 843db (21:43db)
ld [rSB], a ; $ff00+$1
ld a, $1
ld [rSC], a ; $ff00+$2
ld a, $81
ld [rSC], a ; $ff00+$2
ret
Function843e6: ; 843e6 (21:43e6)
ld a, [rSB] ; $ff00+$1
ld [$ca89], a
xor a
ld [$c2d5], a
ret
Function843f0: ; 843f0
.asm_843f0
call Functiona57
call Function846f6
jr c, .asm_8440f
ld a, [$cf63]
bit 7, a
jr nz, .asm_8440d
call Function84022
call Function84757
call Function84785
call DelayFrame
jr .asm_843f0
.asm_8440d
and a
ret
.asm_8440f
scf
ret
; 84411
Function84411: ; 84411
xor a
ld [$c2d4], a
ld [$c2d5], a
ret
; 84419
Function84419: ; 84419
push af
call Function84000
pop af
ld [$cbfa], a
call Function84728
ret
; 84425
Function84425: ; 84425
call Function222a
call Function84753
ret
; 8442c
Function8442c: ; 8442c
ld a, [$cf65]
push af
ld hl, VTiles1
ld de, FontInversed
lb bc, BANK(FontInversed), $80
call Request1bpp
xor a
ld [$ffac], a
call Function8474c
ld a, [rIE]
push af
xor a
ld [rIF], a
ld a, $9
ld [rIE], a
call Function84000
ld a, $10
ld [$cbfa], a
callba Function1dc1b0
call ClearTileMap
ld a, $e4
call DmgToCgbBGPals
call DelayFrame
ld hl, $ff9e
ld a, [hl]
push af
ld [hl], $4
ld a, $8
ld [$cf65], a
call Function84742
call Function843f0
jr c, .asm_8449d
call Function84411
ld c, $c
call DelayFrames
xor a
ld [hBGMapMode], a
call Function84000
ld a, $3
ld [$cbfa], a
callba Function1dc213
call Function84742
ld a, $4
ld [$cf65], a
call Function843f0
.asm_8449d
pop af
ld [$ff9e], a
call Function84411
xor a
ld [rIF], a
pop af
ld [rIE], a
call Function84425
ld c, $8
.asm_844ae
call LowVolume
call DelayFrame
dec c
jr nz, .asm_844ae
pop af
ld [$cf65], a
ret
; 844bc
Function844bc: ; 844bc (21:44bc)
ld a, [$cf65]
push af
ld a, $9
ld [$cf65], a
ld a, e
ld [$d004], a
ld a, d
ld [StartFlypoint], a ; $d005
ld a, b
ld [EndFlypoint], a ; $d006
ld a, c
ld [MovementBuffer], a ; $d007
xor a
ld [$FF00+$ac], a
ld [$d003], a
call Function8474c
ld a, [rIE] ; $ff00+$ff
push af
xor a
ld [rIF], a ; $ff00+$f
ld a, $9
ld [rIE], a ; $ff00+$ff
ld hl, $ff9e
ld a, [hl]
push af
ld [hl], $4
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function84817
ld a, $10
call Function84419
call Function84559
jr c, .asm_84545
call Function84411
ld c, $c
call DelayFrames
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function8486f
ld a, $0
call Function84419
call Function84559
jr c, .asm_84545
call Function84411
ld c, $c
call DelayFrames
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function84893
ld a, $0
call Function84419
call Function84559
jr c, .asm_84545
call Function84411
ld c, $c
call DelayFrames
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function848b7
ld a, $3
call Function84419
call Function84559
.asm_84545
pop af
ld [$FF00+$9e], a
call Function84411
xor a
ld [rIF], a ; $ff00+$f
pop af
ld [rIE], a ; $ff00+$ff
call Function84425
pop af
ld [$cf65], a
ret
Function84559: ; 84559 (21:4559)
call Function84742
call Function843f0
ret
Function84560: ; 84560
ld a, [$cf65]
push af
xor a
ld [$ffac], a
call Function8474c
ld a, [rIE]
push af
xor a
ld [rIF], a
ld a, $9
ld [rIE], a
ld hl, $ff9e
ld a, [hl]
push af
ld [hl], $4
xor a
ld [hBGMapMode], a
call Function309d
callba Function16dac
ld a, $0
call Function84419
call Function30b4
call Function84742
ld a, $9
ld [$cf65], a
.asm_84597
call Functiona57
call Function846f6
jr c, .asm_845c0
ld a, [$cf63]
bit 7, a
jr nz, .asm_845c0
call Function84022
ld a, [$cf63]
cp $2
jr nc, .asm_845b5
ld a, $3
ld [$ca81], a
.asm_845b5
call Function84757
call Function84785
call DelayFrame
jr .asm_84597
.asm_845c0
pop af
ld [$ff9e], a
call Function84411
call Function30b4
xor a
ld [rIF], a
pop af
ld [rIE], a
pop af
ld [$cf65], a
ret
; 845d4
Function845d4: ; 845d4
call Function845db
call Function84425
ret
; 845db
Function845db: ; 845db
ld a, [$cf65]
push af
xor a
ld [$ffac], a
call Function8474c
ld a, [rIE]
push af
xor a
ld [rIF], a
ld a, $9
ld [rIE], a
xor a
ld [hBGMapMode], a
ld a, $13
call Function84419
ld hl, $ff9e
ld a, [hl]
push af
ld [hl], $4
ld a, $9
ld [$cf65], a
call Function843f0
pop af
ld [$ff9e], a
call Function84411
call Function84735
xor a
ld [rIF], a
pop af
ld [rIE], a
pop af
ld [$cf65], a
ret
; 8461a
Function8461a: ; 8461a
ld a, [$cf65]
push af
xor a
ld [$ffac], a
call Function8474c
ld a, [rIE]
push af
xor a
ld [rIF], a
ld a, $9
ld [rIE], a
xor a
ld [hBGMapMode], a
callba Function1dc381
ld a, $10
call Function84419
ld hl, $ff9e
ld a, [hl]
push af
ld [hl], $4
ld a, $8
ld [$cf65], a
call Function84742
call Function843f0
jr c, .asm_84671
call Function84411
ld c, $c
call DelayFrames
xor a
ld [hBGMapMode], a
callba Function1dc47b
ld a, $3
call Function84419
ld a, $9
ld [$cf65], a
call Function84742
call Function843f0
.asm_84671
pop af
ld [$ff9e], a
call Function84411
call Function84735
xor a
ld [rIF], a
pop af
ld [rIE], a
call Function84425
pop af
ld [$cf65], a
ret
; 84688
Function84688: ; 84688
ld a, [$cf65]
push af
callba Function1dd709
xor a
ld [$ffac], a
call Function8474c
ld a, [rIE]
push af
xor a
ld [rIF], a
ld a, $9
ld [rIE], a
ld hl, $ff9e
ld a, [hl]
push af
ld [hl], $4
ld a, $10
call Function84419
call Function84742
ld a, $9
ld [$cf65], a
call Function843f0
jr c, .asm_846e2
call Function84411
ld c, $c
call DelayFrames
call Function309d
xor a
ld [hBGMapMode], a
callba Function1dd7ae
ld a, $3
call Function84419
call Function30b4
call Function84742
ld a, $9
ld [$cf65], a
call Function843f0
.asm_846e2
pop af
ld [$ff9e], a
call Function84411
xor a
ld [rIF], a
pop af
ld [rIE], a
call Function84425
pop af
ld [$cf65], a
ret
; 846f6
Function846f6: ; 846f6
ld a, [hJoyDown]
and $2
jr nz, .asm_846fe
and a
ret
.asm_846fe
ld a, [$ca80]
cp $c
jr nz, .asm_84722
.asm_84705
ld a, [$c2d5]
and a
jr nz, .asm_84705
ld a, $16
ld [$c2d5], a
ld a, $88
ld [rSB], a
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
.asm_8471c
ld a, [$c2d5]
and a
jr nz, .asm_8471c
.asm_84722
ld a, $1
ld [$ffac], a
scf
ret
; 84728
Function84728: ; 84728
ld hl, TileMap
ld de, $ca90
ld bc, $0168
call CopyBytes
ret
; 84735
Function84735: ; 84735
ld hl, $ca90
ld de, TileMap
ld bc, $0168
call CopyBytes
ret
; 84742
Function84742: ; 84742
xor a
ld [hJoyReleased], a
ld [hJoyPressed], a
ld [hJoyDown], a
ld [$ffa9], a
ret
; 8474c
Function8474c: ; 8474c
ld de, MUSIC_PRINTER
call PlayMusic2
ret
; 84753
Function84753: ; 84753
call RestartMapMusic
ret
; 84757
Function84757: ; 84757
ld a, [$ca88]
cp $ff
jr nz, .asm_84765
ld a, [$ca89]
cp $ff
jr z, .asm_8477f
.asm_84765
ld a, [$ca89]
and $e0
ret z
bit 7, a
jr nz, .asm_8477b
bit 6, a
jr nz, .asm_84777
ld a, $6
jr .asm_84781
.asm_84777
ld a, $7
jr .asm_84781
.asm_8477b
ld a, $4
jr .asm_84781
.asm_8477f
ld a, $5
.asm_84781
ld [$cbf8], a
ret
; 84785
Function84785: ; 84785
ld a, [$cbf8]
and a
ret z
push af
xor a
ld [hBGMapMode], a
hlcoord 0, 5
ld bc, $0a12
call TextBox
pop af
ld e, a
ld d, 0
ld hl, Unknown_84807
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 1, 7
ld a, $77
call FarString
hlcoord 2, 15
ld de, String_847f5
call PlaceString
ld a, $1
ld [hBGMapMode], a
xor a
ld [$cbf8], a
ret
; 847bd
Function847bd: ; 847bd
ld a, [$cbf8]
and a
ret z
push af
xor a
ld [hBGMapMode], a
hlcoord 2, 4
ld bc, $0d10
call ClearBox
pop af
ld e, a
ld d, 0
ld hl, Unknown_84807
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 4, 7
ld a, BANK(GBPrinterStrings)
call FarString
hlcoord 4, 15
ld de, String_847f5
call PlaceString
ld a, $1
ld [hBGMapMode], a
xor a
ld [$cbf8], a
ret
; 847f5
String_847f5:
db "Press B to Cancel@"
; 84807
Unknown_84807: ; 84807
dw String_1dc275
dw String_1dc276
dw String_1dc289
dw String_1dc29c
dw String_1dc2ad
dw String_1dc2e2
dw String_1dc317
dw String_1dc34c
; 84817
Function84817: ; 84817 (21:4817)
xor a
ld [$d002], a
ld hl, TileMap
ld bc, $168
ld a, $7f
call ByteFill
call Function84a0e
ld hl, TileMap
ld bc, $b4
ld a, $7f
call ByteFill
call Function849e9
call Function849d7
hlcoord 4, 3
ld de, String_84865
call PlaceString
ld a, [$d007]
ld bc, 9
ld hl, wBoxNames
call AddNTimes
ld d, h
ld e, l
hlcoord 6, 5
call PlaceString
ld a, $1
call Function849c6
hlcoord 2, 9
ld c, $3
call Function848e7
ret
; 84865 (21:4865)
String_84865:
db "#MON LIST@"
; 8486f
Function8486f: ; 8486f (21:486f)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
ld a, $7f
call ByteFill
call Function84a0e
call Function849e9
ld a, [$d003]
and a
ret nz
ld a, $4
call Function849c6
hlcoord 2, 0
ld c, $6
call Function848e7
ret
Function84893: ; 84893 (21:4893)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
ld a, $7f
call ByteFill
call Function84a0e
call Function849e9
ld a, [$d003]
and a
ret nz
ld a, $a
call Function849c6
hlcoord 2, 0
ld c, $6
call Function848e7
ret
Function848b7: ; 848b7 (21:48b7)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
ld a, $7f
call ByteFill
call Function84a0e
hlcoord 1, 15
ld bc, $212
call ClearBox
call Function849e9
call Function849fc
ld a, [$d003]
and a
ret nz
ld a, $10
call Function849c6
hlcoord 2, 0
ld c, $5
call Function848e7
ret
Function848e7: ; 848e7 (21:48e7)
ld a, [EndFlypoint] ; $d006
call GetSRAMBank
Function848ed: ; 848ed (21:48ed)
ld a, c
and a
jp z, Function84986
dec c
ld a, [de]
cp $ff
jp z, Function84981
ld [$d265], a
ld [CurPartySpecies], a ; $d108
push bc
push hl
push de
push hl
ld bc, $10
ld a, $7f
call ByteFill
pop hl
push hl
call GetBasePokemonName
pop hl
push hl
call PlaceString
ld a, [CurPartySpecies] ; $d108
cp $fd
pop hl
jr z, .asm_84972
ld bc, $b
add hl, bc
call Function8498a
ld bc, $9
add hl, bc
ld a, $f3
ld [hli], a
push hl
ld bc, $e
ld a, $7f
call ByteFill
pop hl
push hl
ld a, [$d004]
ld l, a
ld a, [StartFlypoint] ; $d005
ld h, a
ld bc, $372
add hl, bc
ld bc, $b
ld a, [DefaultFlypoint] ; $d002
call AddNTimes
ld e, l
ld d, h
pop hl
push hl
call PlaceString
pop hl
ld bc, $b
add hl, bc
push hl
ld a, [$d004]
ld l, a
ld a, [StartFlypoint] ; $d005
ld h, a
ld bc, $35
add hl, bc
ld bc, $20
ld a, [DefaultFlypoint] ; $d002
call AddNTimes
ld a, [hl]
pop hl
call Function383d
.asm_84972
ld hl, DefaultFlypoint ; $d002
inc [hl]
pop de
pop hl
ld bc, $3c
add hl, bc
pop bc
inc de
jp Function848ed
Function84981: ; 84981 (21:4981)
ld a, $1
ld [$d003], a
Function84986: ; 84986 (21:4986)
call CloseSRAM
ret
Function8498a: ; 8498a (21:498a)
push hl
ld a, [$d004]
ld l, a
ld a, [StartFlypoint] ; $d005
ld h, a
ld bc, $2b
add hl, bc
ld bc, $20
ld a, [DefaultFlypoint] ; $d002
call AddNTimes
ld de, TempMonDVs ; $d123
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
ld a, [DefaultFlypoint] ; $d002
ld [CurPartyMon], a ; $d109
ld a, $3
ld [MonType], a ; $cf5f
callba GetGender
ld a, $7f
jr c, .asm_849c3
ld a, $ef
jr nz, .asm_849c3
ld a, $f5
.asm_849c3
pop hl
ld [hli], a
ret
Function849c6: ; 849c6 (21:49c6)
push hl
ld e, a
ld d, $0
ld a, [$d004]
ld l, a
ld a, [StartFlypoint] ; $d005
ld h, a
add hl, de
ld e, l
ld d, h
pop hl
ret
Function849d7: ; 849d7 (21:49d7)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld a, $79
ld [hli], a
ld a, $7a
ld c, $12
.asm_849e1
ld [hli], a
dec c
jr nz, .asm_849e1
ld a, $7b
ld [hl], a
ret
Function849e9: ; 849e9 (21:49e9)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld de, $13
ld c, $12
.asm_849f1
ld a, $7c
ld [hl], a
add hl, de
ld a, $7c
ld [hli], a
dec c
jr nz, .asm_849f1
ret
Function849fc: ; 849fc (21:49fc)
hlcoord 0, 17
ld a, $7d
ld [hli], a
ld a, $7a
ld c, $12
.asm_84a06
ld [hli], a
dec c
jr nz, .asm_84a06
ld a, $7e
ld [hl], a
ret
Function84a0e: ; 84a0e (21:4a0e)
hlcoord 2, 0
ld c, $6
.asm_84a13
push bc
push hl
ld de, String84a25
call PlaceString
pop hl
ld bc, $3c
add hl, bc
pop bc
dec c
jr nz, .asm_84a13
ret
; 84a25 (21:4a25)
String84a25: ; 84a25
db " ------@"
; 84a2e
INCLUDE "battle/anim_gfx.asm"
HallOfFame:: ; 0x8640e
call Function8648e
ld a, [StatusFlags]
push af
ld a, $1
ld [$c2cd], a
call Function2ed3
ld a, $1
ld [$d4b5], a
; Enable the Pokégear map to cycle through all of Kanto
ld hl, StatusFlags
set 6, [hl]
callba Function14da0
ld hl, $d95e
ld a, [hl]
cp $c8
jr nc, .asm_86436 ; 0x86433 $1
inc [hl]
.asm_86436
callba Function14b85
call Function8653f
callba Function14b5f
xor a
ld [$c2cd], a
call Function864c3
pop af
ld b, a
callba Function109847
ret
; 0x86455
Function86455:: ; 86455
ld a, MUSIC_NONE % $100
ld [MusicFadeIDLo], a
ld a, MUSIC_NONE / $100
ld [MusicFadeIDHi], a
ld a, $a
ld [MusicFade], a
callba Function8c084
xor a
ld [VramState], a
ld [$ffde], a
callba Function4e8c2
ld c, $8
call DelayFrames
call Function2ed3
ld a, $2
ld [$d4b5], a
ld a, [StatusFlags]
ld b, a
callba Function109847
ret
; 8648e
Function8648e: ; 8648e
ld a, MUSIC_NONE % $100
ld [MusicFadeIDLo], a
ld a, MUSIC_NONE / $100
ld [MusicFadeIDHi], a
ld a, $a
ld [MusicFade], a
callba Function8c084
xor a
ld [VramState], a
ld [$ffde], a
callba Function4e881
ld c, $64
jp DelayFrames
; 864b4
Function864b4: ; 864b4
push de
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
pop de
call PlayMusic
ret
; 864c3
Function864c3: ; 864c3
xor a
ld [$cf63], a
call Function8671c
jr c, .asm_864fb
ld de, $0014
call Function864b4
xor a
ld [$cf64], a
.asm_864d6
ld a, [$cf64]
cp $6
jr nc, .asm_864fb
ld hl, $c609
ld bc, $0010
call AddNTimes
ld a, [hl]
cp $ff
jr z, .asm_864fb
push hl
call Function865b5
pop hl
call Function8650c
jr c, .asm_864fb
ld hl, $cf64
inc [hl]
jr .asm_864d6
.asm_864fb
call Function86810
ld a, $4
ld [MusicFade], a
call Function4b6
ld c, $8
call DelayFrames
ret
; 8650c
Function8650c: ; 8650c
call Function86748
ld de, String_8652c
hlcoord 1, 2
call PlaceString
call WaitBGMap
decoord 6, 5
ld c, $6
predef Functiond066e
ld c, $3c
call DelayFrames
and a
ret
; 8652c
String_8652c:
db "New Hall of Famer!@"
; 8653f
Function8653f: ; 8653f
ld hl, OverworldMap
ld bc, $0062
xor a
call ByteFill
ld a, [$d95e]
ld de, OverworldMap
ld [de], a
inc de
ld hl, PartySpecies
ld c, 0
.asm_86556
ld a, [hli]
cp $ff
jr z, .asm_865b1
cp EGG
jr nz, .asm_86562
inc c
jr .asm_86556
.asm_86562
push hl
push de
push bc
ld a, c
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
call AddNTimes
ld c, l
ld b, h
ld hl, $0000
add hl, bc
ld a, [hl]
ld [de], a
inc de
ld hl, $0006
add hl, bc
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
ld hl, $0015
add hl, bc
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
ld hl, $001f
add hl, bc
ld a, [hl]
ld [de], a
inc de
pop bc
push bc
ld a, c
ld hl, PartyMonNicknames
ld bc, $000b
call AddNTimes
ld bc, $000a
call CopyBytes
pop bc
inc c
pop de
ld hl, $0010
add hl, de
ld e, l
ld d, h
pop hl
jr .asm_86556
.asm_865b1
ld a, $ff
ld [de], a
ret
; 865b5
Function865b5: ; 865b5
push hl
call WhiteBGMap
callba Function4e906
pop hl
ld a, [hli]
ld [TempMonSpecies], a
ld [CurPartySpecies], a
inc hl
inc hl
ld a, [hli]
ld [TempMonDVs], a
ld a, [hli]
ld [$d124], a
ld hl, TempMonDVs
predef GetUnownLetter
ld hl, TileMap
ld bc, $0168
ld a, $7f
call ByteFill
ld de, $9310
predef GetBackpic
ld a, $31
ld [$ffad], a
hlcoord 6, 6
ld bc, $0606
predef FillBox
ld a, $d0
ld [hSCY], a
ld a, $90
ld [hSCX], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ld b, $1a
call GetSGBLayout
call Function32f9
call Function86635
xor a
ld [$c2c6], a
ld hl, TileMap
ld bc, $0168
ld a, $7f
call ByteFill
hlcoord 6, 5
call Function378b
call WaitBGMap
xor a
ld [hBGMapMode], a
ld [hSCY], a
call Function86643
ret
; 86635
Function86635: ; 86635
.asm_86635
ld a, [hSCX]
cp $70
ret z
add $4
ld [hSCX], a
call DelayFrame
jr .asm_86635
; 86643
Function86643: ; 86643
.asm_86643
ld a, [hSCX]
and a
ret z
dec a
dec a
ld [hSCX], a
call DelayFrame
jr .asm_86643
; 86650
Function86650: ; 86650
call Functione58
xor a
ld [$cf63], a
.asm_86657
call Function8671c
ret c
call Function86665
ret c
ld hl, $cf63
inc [hl]
jr .asm_86657
; 86665
Function86665: ; 86665
xor a
ld [$cf64], a
.asm_86669
call Function86692
jr c, .asm_86690
.asm_8666e
call Functiona57
ld hl, $ffa9
ld a, [hl]
and $2
jr nz, .asm_8668e
ld a, [hl]
and $1
jr nz, .asm_86688
ld a, [hl]
and $8
jr nz, .asm_86690
call DelayFrame
jr .asm_8666e
.asm_86688
ld hl, $cf64
inc [hl]
jr .asm_86669
.asm_8668e
scf
ret
.asm_86690
and a
ret
; 86692
Function86692: ; 86692
; Print the number of times the player has entered the Hall of Fame.
; If that number is above 200, print "HOF Master!" instead.
ld a, [$cf64]
cp $6
jr nc, .asm_866a7
ld hl, $c609
ld bc, $0010
call AddNTimes
ld a, [hl]
cp $ff
jr nz, .asm_866a9
.asm_866a7
scf
ret
.asm_866a9
push hl
call WhiteBGMap
pop hl
call Function86748
ld a, [$c608]
cp 200 + 1
jr c, .asm_866c6
ld de, String_866fc
hlcoord 1, 2
call PlaceString
hlcoord 13, 2
jr .asm_866de
.asm_866c6
ld de, String_8670c
hlcoord 1, 2
call PlaceString
hlcoord 2, 2
ld de, $c608
ld bc, $0103
call PrintNum
hlcoord 11, 2
.asm_866de
ld de, String_866fb
call PlaceString
call WaitBGMap
ld b, $1a
call GetSGBLayout
call Function32f9
decoord 6, 5
ld c, $6
predef Functiond066e
and a
ret
; 866fb
String_866fb:
db "@"
; 866fc
String_866fc:
db " HOF Master!@"
; 8670c
String_8670c:
db " -Time Famer@"
; 8671c
Function8671c: ; 8671c
ld a, [$cf63]
cp $1e
jr nc, .asm_86746
ld hl, $b2c0
ld bc, $0062
call AddNTimes
ld a, $1
call GetSRAMBank
ld a, [hl]
and a
jr z, .asm_86743
ld de, $c608
ld bc, $0062
call CopyBytes
call CloseSRAM
and a
ret
.asm_86743
call CloseSRAM
.asm_86746
scf
ret
; 86748
Function86748: ; 86748
xor a
ld [hBGMapMode], a
ld a, [hli]
ld [TempMonSpecies], a
ld a, [hli]
ld [TempMonID], a
ld a, [hli]
ld [$d115], a
ld a, [hli]
ld [TempMonDVs], a
ld a, [hli]
ld [$d124], a
ld a, [hli]
ld [TempMonLevel], a
ld de, StringBuffer2
ld bc, $000a
call CopyBytes
ld a, $50
ld [$d090], a
ld hl, TileMap
ld bc, $0168
ld a, $7f
call ByteFill
ld hl, TileMap
ld bc, $0312
call TextBox
hlcoord 0, 12
ld bc, $0412
call TextBox
ld a, [TempMonSpecies]
ld [CurPartySpecies], a
ld [$d265], a
ld hl, TempMonDVs
predef GetUnownLetter
xor a
ld [$c2c6], a
hlcoord 6, 5
call Function378b
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_867f8
hlcoord 1, 13
ld a, $74
ld [hli], a
ld [hl], $f2
hlcoord 3, 13
ld de, $d265
ld bc, $8103
call PrintNum
call GetBasePokemonName
hlcoord 7, 13
call PlaceString
ld a, $3
ld [MonType], a
callba GetGender
ld a, $7f
jr c, .asm_867e2
ld a, $ef
jr nz, .asm_867e2
ld a, $f5
.asm_867e2
hlcoord 18, 13
ld [hli], a
hlcoord 8, 14
ld a, $f3
ld [hli], a
ld de, StringBuffer2
call PlaceString
hlcoord 1, 16
call PrintLevel
.asm_867f8
hlcoord 7, 16
ld a, $73
ld [hli], a
ld a, $74
ld [hli], a
ld [hl], $f3
hlcoord 10, 16
ld de, TempMonID
ld bc, $8205
call PrintNum
ret
; 86810
Function86810: ; 86810
call WhiteBGMap
ld hl, $9630
ld de, FontExtra + $d0
lb bc, BANK(FontExtra), 1
call Request2bpp
ld hl, TileMap
ld bc, $0168
ld a, $7f
call ByteFill
callba GetPlayerBackpic
ld a, $31
ld [$ffad], a
hlcoord 6, 6
ld bc, $0606
predef FillBox
ld a, $d0
ld [hSCY], a
ld a, $90
ld [hSCX], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ld [CurPartySpecies], a
ld b, $1a
call GetSGBLayout
call Function32f9
call Function86635
xor a
ld [$c2c6], a
ld hl, TileMap
ld bc, $0168
ld a, $7f
call ByteFill
callba Function88840
xor a
ld [$ffad], a
hlcoord 12, 5
ld bc, $0707
predef FillBox
ld a, $c0
ld [hSCX], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ld [hSCY], a
call Function86643
xor a
ld [hBGMapMode], a
hlcoord 0, 2
ld bc, $0809
call TextBox
hlcoord 0, 12
ld bc, $0412
call TextBox
hlcoord 2, 4
ld de, PlayerName
call PlaceString
hlcoord 1, 6
ld a, $73
ld [hli], a
ld a, $74
ld [hli], a
ld [hl], $f3
hlcoord 4, 6
ld de, PlayerID
ld bc, $8205
call PrintNum
hlcoord 1, 8
ld de, .PlayTime
call PlaceString
hlcoord 3, 9
ld de, GameTimeHours
ld bc, $0203
call PrintNum
ld [hl], $63
inc hl
ld de, GameTimeMinutes
ld bc, $8102
call PrintNum
call WaitBGMap
callba Function26601
ret
; 868ed
.PlayTime
db "PLAY TIME@"
; 868f7
SECTION "bank22", ROMX, BANK[$22]
Function88000: ; 88000
ld hl, UnknownText_0x88007
call PrintText
ret
; 88007
UnknownText_0x88007: ; 0x88007
; Which APRICORN should I use?
text_jump UnknownText_0x1bc06b
db "@"
; 0x8800c
Function8800c: ; 8800c
ld hl, UnknownText_0x88013
call PrintText
ret
; 88013
UnknownText_0x88013: ; 0x88013
; How many should I make?
text_jump UnknownText_0x1bc089
db "@"
; 0x88018
Function88018: ; 88018
call Function1d6e
ld c, $1
xor a
ld [$d0e4], a
ld [$dca4], a
.asm_88024
push bc
call Function88000
pop bc
ld a, c
ld [MenuSelection], a
call Function88055
ld a, c
ld [ScriptVar], a
and a
jr z, .asm_88051
ld [CurItem], a
ld a, [$cfa9]
ld c, a
push bc
call Function8800c
call Function880c2
pop bc
jr nc, .asm_88024
ld a, [$d10c]
ld [$dca4], a
call Function88161
.asm_88051
call Function1d7d
ret
; 88055
Function88055: ; 88055
callba Function24c64
jr c, .asm_88083
ld hl, MenuDataHeader_0x88086
call Function1d3c
ld a, [MenuSelection]
ld [$cf88], a
xor a
ld [hBGMapMode], a
call Function352f
call Function1ad2
call Function350c
ld a, [$cf73]
cp $2
jr z, .asm_88083
ld a, [MenuSelection]
cp $ff
jr nz, .asm_88084
.asm_88083
xor a
.asm_88084
ld c, a
ret
; 88086
MenuDataHeader_0x88086: ; 0x88086
db $40 ; flags
db 01, 01 ; start coords
db 10, 13 ; end coords
dw MenuData2_0x8808f
db 1 ; default option
; 0x8808e
db 0
MenuData2_0x8808f: ; 0x8808f
db $10 ; flags
db 4, 7
db 1
dbw 0, $d1ea
dbw BANK(Function8809f), Function8809f
dbw BANK(Function880ab), Function880ab
dbw BANK(NULL), NULL
Function8809f: ; 8809f
ld a, [MenuSelection]
and a
ret z
callba Function24ab4
ret
; 880ab
Function880ab: ; 880ab
ld a, [MenuSelection]
ld [CurItem], a
call Function88139
ret z
ld a, [$d10c]
ld [$cf75], a
callba Function24ac3
ret
; 880c2
Function880c2: ; 880c2
ld a, [CurItem]
ld [MenuSelection], a
call Function88139
jr z, .asm_88109
ld a, [$d10c]
ld [$d10d], a
ld a, $1
ld [$d10c], a
ld hl, MenuDataHeader_0x8810d
call LoadMenuDataHeader
.asm_880de
xor a
ld [hBGMapMode], a
call Function1cbb
call Function1ad2
call Function88116
call Function88126
call Function321c
callba Function27a28
jr nc, .asm_880de
push bc
call PlayClickSFX
pop bc
ld a, b
cp $ff
jr z, .asm_88109
ld a, [$d10c]
ld [$d10c], a
scf
.asm_88109
call Function1c17
ret
; 8810d
MenuDataHeader_0x8810d: ; 0x8810d
db $40 ; flags
db 09, 06 ; start coords
db 12, 19 ; end coords
INCBIN "baserom.gbc",$88112,$88116 - $88112
Function88116: ; 88116
call Function1cfd
ld de, $0015
add hl, de
ld d, h
ld e, l
callba Function24ab4
ret
; 88126
Function88126: ; 88126
call Function1cfd
ld de, $0032
add hl, de
ld [hl], $f1
inc hl
ld de, $d10c
ld bc, $8102
jp PrintNum
; 88139
Function88139: ; 88139
push bc
ld hl, NumItems
ld a, [CurItem]
ld c, a
ld b, $0
.asm_88143
inc hl
ld a, [hli]
cp $ff
jr z, .asm_88153
cp c
jr nz, .asm_88143
ld a, [hl]
add b
ld b, a
jr nc, .asm_88143
ld b, $ff
.asm_88153
ld a, b
sub $63
jr c, .asm_8815a
ld b, $63
.asm_8815a
ld a, b
ld [$d10c], a
and a
pop bc
ret
; 88161
Function88161: ; 88161
push de
push bc
ld hl, NumItems
ld a, [CurItem]
ld c, a
ld e, $0
xor a
ld [$d107], a
ld a, $ff
ld [DefaultFlypoint], a
.asm_88175
ld a, [$d107]
inc a
ld [$d107], a
inc hl
ld a, [hli]
cp $ff
jr z, .asm_88198
cp c
jr nz, .asm_88175
ld d, $0
push hl
ld hl, DefaultFlypoint
add hl, de
inc e
ld a, [$d107]
dec a
ld [hli], a
ld a, $ff
ld [hl], a
pop hl
jr .asm_88175
.asm_88198
ld a, e
and a
jr z, .asm_881fa
dec a
jr z, .asm_881d0
ld hl, DefaultFlypoint
.asm_881a2
ld a, [hl]
ld c, a
push hl
.asm_881a5
inc hl
ld a, [hl]
cp $ff
jr z, .asm_881c9
ld b, a
ld a, c
call Function88201
ld e, a
ld a, b
call Function88201
sub e
jr z, .asm_881bc
jr c, .asm_881c0
jr .asm_881a5
.asm_881bc
ld a, c
sub b
jr nc, .asm_881a5
.asm_881c0
ld a, c
ld c, b
ld [hl], a
ld a, c
pop hl
ld [hl], a
push hl
jr .asm_881a5
.asm_881c9
pop hl
inc hl
ld a, [hl]
cp $ff
jr nz, .asm_881a2
.asm_881d0
ld hl, DefaultFlypoint
.asm_881d3
ld a, [hl]
cp $ff
jr z, .asm_881fa
push hl
ld [$d107], a
call Function88211
pop hl
ld a, [$d10c]
and a
jr z, .asm_881fa
push hl
ld a, [hli]
ld c, a
.asm_881e9
ld a, [hli]
cp $ff
jr z, .asm_881f6
cp c
jr c, .asm_881e9
dec a
dec hl
ld [hli], a
jr .asm_881e9
.asm_881f6
pop hl
inc hl
jr .asm_881d3
.asm_881fa
ld a, [$d10c]
and a
pop bc
pop de
ret
; 88201
Function88201: ; 88201
push hl
push bc
ld hl, NumItems
inc hl
ld c, a
ld b, $0
add hl, bc
add hl, bc
inc hl
ld a, [hl]
pop bc
pop hl
ret
; 88211
Function88211: ; 88211
push bc
ld hl, NumItems
ld a, [$d107]
ld c, a
ld b, $0
inc hl
add hl, bc
add hl, bc
ld a, [CurItem]
ld c, a
ld a, [hli]
cp $ff
jr z, .asm_88243
cp c
jr nz, .asm_88243
ld a, [$d10c]
ld c, a
ld a, [hl]
sub c
ld b, c
jr nc, .asm_88235
add c
ld b, a
.asm_88235
push bc
ld hl, NumItems
ld a, b
ld [$d10c], a
call TossItem
pop bc
ld a, c
sub b
.asm_88243
ld [$d10c], a
pop bc
ret
; 88248
Function88248: ; 88248
ld c, $c
ld a, [PlayerGender]
bit 0, a
jr z, .asm_88253
ld c, $e
.asm_88253
ld a, c
ld [TrainerClass], a
ret
; 88258
MovePlayerPicRight: ; 88258
hlcoord 6, 4
ld de, 1
jr MovePlayerPic
MovePlayerPicLeft: ; 88260
hlcoord 13, 4
ld de, -1
; fallthrough
MovePlayerPic: ; 88266
; Move player pic at hl by de * 7 tiles.
ld c, $8
.loop
push bc
push hl
push de
xor a
ld [hBGMapMode], a
ld bc, $0707
predef FillBox
xor a
ld [hBGMapThird], a
call WaitBGMap
call DelayFrame
pop de
pop hl
add hl, de
pop bc
dec c
ret z
push hl
push bc
ld a, l
sub e
ld l, a
ld a, h
sbc d
ld h, a
ld bc, $0707
call ClearBox
pop bc
pop hl
jr .loop
; 88297
ShowPlayerNamingChoices: ; 88297
ld hl, ChrisNameMenuHeader
ld a, [PlayerGender]
bit 0, a
jr z, .GotGender
ld hl, KrisNameMenuHeader
.GotGender
call LoadMenuDataHeader
call Function1d81
ld a, [$cfa9]
dec a
call Function1db8
call Function1c17
ret
; 882b5
ChrisNameMenuHeader: ; 882b5
db $40 ; flags
db 00, 00 ; start coords
db 11, 10 ; end coords
dw MenuData2_0x882be
db 1 ; ????
db 0 ; default option
; 882be
MenuData2_0x882be: ; 882be
db $91 ; flags
db 5 ; items
db "NEW NAME@"
Unknown_882c9: ; 882c9
db "CHRIS@"
db "MAT@"
db "ALLAN@"
db "JON@"
db 2 ; displacement
db " NAME @" ; title
; 882e5
KrisNameMenuHeader: ; 882e5
db $40 ; flags
db 00, 00 ; start coords
db 11, 10 ; end coords
dw MenuData2_0x882ee
db 1 ; ????
db 0 ; default option
; 882ee
MenuData2_0x882ee: ; 882ee
db $91 ; flags
db 5 ; items
db "NEW NAME@"
Unknown_882f9: ; 882f9
db "KRIS@"
db "AMANDA@"
db "JUANA@"
db "JODI@"
db 2 ; displacement
db " NAME @" ; title
; 88318
Function88318: ; 88318
ld hl, PlayerName
ld de, Unknown_882c9
ld a, [PlayerGender]
bit 0, a
jr z, .asm_88328
ld de, Unknown_882f9
.asm_88328
call InitName
ret
; 8832c
GetPlayerIcon: ; 8832c
; Get the player icon corresponding to gender
; Male
ld de, ChrisSpriteGFX
ld b, BANK(ChrisSpriteGFX)
ld a, [PlayerGender]
bit 0, a
jr z, .done
; Female
ld de, KrisSpriteGFX
ld b, BANK(KrisSpriteGFX)
.done
ret
; 8833e
Function8833e: ; 8833e
ld hl, ChrisCardPic
ld a, [PlayerGender] ; $d472
bit 0, a
jr z, .asm_8834b
ld hl, KrisCardPic
.asm_8834b
ld de, $9000
ld bc, $230
ld a, BANK(ChrisCardPic) ; BANK(KrisCardPic)
call FarCopyBytes
ld hl, CardGFX
ld de, $9230
ld bc, $60
ld a, BANK(CardGFX)
call FarCopyBytes
ret
; 88365 (22:4365)
ChrisCardPic: ; 88365
INCBIN "gfx/misc/chris.5x7.2bpp"
; 88595
KrisCardPic: ; 88595
INCBIN "gfx/misc/kris.5x7.2bpp"
; 887c5
CardGFX: ; 887c5
INCBIN "gfx/misc/trainer_card.2bpp"
; 88825
GetPlayerBackpic: ; 88825
ld a, [PlayerGender]
bit 0, a
jr z, GetChrisBackpic
call GetKrisBackpic
ret
GetChrisBackpic: ; 88830
ld hl, ChrisBackpic
ld b, BANK(ChrisBackpic)
ld de, $9310
ld c, $31
predef DecompressPredef
ret
; 88840
Function88840: ; 88840
call WaitBGMap
xor a
ld [hBGMapMode], a
ld e, 0
ld a, [PlayerGender]
bit 0, a
jr z, .asm_88851
ld e, 1
.asm_88851
ld a, e
ld [TrainerClass], a
ld de, ChrisPic
ld a, [PlayerGender]
bit 0, a
jr z, .asm_88862
ld de, KrisPic
.asm_88862
ld hl, VTiles2
ld b, BANK(ChrisPic) ; BANK(KrisPic)
ld c, $31
call Get2bpp
call WaitBGMap
ld a, $1
ld [hBGMapMode], a
ret
; 88874
DrawIntroPlayerPic: ; 88874
; Draw the player pic at (6,4).
; Get class
ld e, 0
ld a, [PlayerGender]
bit 0, a
jr z, .GotClass
ld e, 1
.GotClass
ld a, e
ld [TrainerClass], a
; Load pic
ld de, ChrisPic
ld a, [PlayerGender]
bit 0, a
jr z, .GotPic
ld de, KrisPic
.GotPic
ld hl, VTiles2
ld b, BANK(ChrisPic) ; BANK(KrisPic)
ld c, 7 * 7 ; dimensions
call Get2bpp
; Draw
xor a
ld [$ffad], a
hlcoord 6, 4
ld bc, $0707
predef FillBox
ret
; 888a9
ChrisPic: ; 888a9
INCBIN "gfx/misc/chris.7x7.2bpp"
; 88bb9
KrisPic: ; 88bb9
INCBIN "gfx/misc/kris.7x7.2bpp"
; 88ec9
GetKrisBackpic: ; 88ec9
; Kris's backpic is uncompressed.
ld de, KrisBackpic
ld hl, $9310
lb bc, BANK(KrisBackpic), 7 * 7 ; dimensions
call Get2bpp
ret
; 88ed6
KrisBackpic: ; 88ed6
INCBIN "gfx/misc/kris_back.6x6.2bpp"
; 89116
String_89116:
db "-----@"
; 8911c
String_8911c: ; 8911c
db "でんわばんごうが ただしく" ; Phone number is not
next "はいって いません!@" ; entered correctly!
; 89135
String_89135: ; 89135
db "データが かわって いますが" ; The data has changed.
next "かきかえないで やめますか?@" ; Quit anyway?
; 89153
String_89153: ; 89153
db "メッセージは ありません@" ; No message
; 89160
Function89160: ; 89160
push af
ld a, $4
call GetSRAMBank
pop af
ret
; 89168
Function89168: ; 89168 (22:5168)
ld hl, GameTimerPause ; $cfbc
set 7, [hl]
ret
Function8916e: ; 8916e (22:516e)
ld hl, GameTimerPause ; $cfbc
res 7, [hl]
ret
Function89174: ; 89174 (22:5174)
ld hl, GameTimerPause ; $cfbc
bit 7, [hl]
ret
Function8917a: ; 8917a (22:517a)
ld hl, DefaultFlypoint ; $d002
ld bc, $32
xor a
call ByteFill
ret
Function89185: ; 89185 (22:5185)
push de
push hl
.asm_89187
ld a, [de]
inc de
cp [hl]
jr nz, .asm_89190
inc hl
dec c
jr nz, .asm_89187
.asm_89190
pop hl
pop de
ret
Function89193: ; 89193
push de
push hl
.asm_89195
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .asm_89195
pop hl
pop de
ret
; 8919e
Function8919e: ; 8919e (22:519e)
ld a, c
and a
ret z
.asm_891a1
ld a, [de]
inc de
cp $50
jr nz, .asm_891a1
dec c
jr nz, .asm_891a1
ret
Function891ab: ; 891ab
call Function89240
callba Function104061
call Function8923c
ret
; 891b8
Function891b8: ; 891b8
call Function8923c
ld hl, TileMap
ld a, $7f
ld bc, $0168
call ByteFill
call DelayFrame
ret
; 891ca
Function891ca: ; 891ca (22:51ca)
push bc
call Function891b8
call WaitBGMap
pop bc
ret
Function891d3: ; 891d3 (22:51d3)
push bc
call Function891ca
ld c, $10
call DelayFrames
pop bc
ret
Function891de: ; 891de
call Function8923c
call ClearPalettes
ld hl, AttrMap
ld a, $7
ld bc, $0168
call ByteFill
ld hl, TileMap
ld a, $7f
ld bc, $0168
call ByteFill
call Function891ab
ret
; 891fe
Function891fe: ; 891fe
push bc
call Function891de
ld c, $10
call DelayFrames
pop bc
ret
; 89209
Function89209: ; 89209
ld a, $1
ld [$c2ce], a
ret
; 8920f
Function8920f: ; 8920f
ld a, $0
ld [$c2ce], a
ret
; 89215
Function89215: ; 89215
push hl
push bc
ld bc, AttrMap - TileMap
add hl, bc
ld [hl], a
pop bc
pop hl
ret
; 8921f
Function8921f: ; 8921f (22:521f)
push de
ld de, $14
add hl, de
inc hl
ld a, $7f
.asm_89227
push bc
push hl
.asm_89229
ld [hli], a
dec c
jr nz, .asm_89229
pop hl
add hl, de
pop bc
dec b
jr nz, .asm_89227
pop de
ret
Function89235: ; 89235 (22:5235)
call Functiona36
call PlayClickSFX
ret
Function8923c: ; 8923c
xor a
ld [hBGMapMode], a
ret
; 89240
Function89240: ; 89240
ld a, $1
ld [hBGMapMode], a
ret
; 89245
Function89245: ; 89245 (22:5245)
callba Function14ea5
ret c
callba Function150b9
and a
ret
Function89254: ; 89254 (22:5254)
ld bc, $d07
jr Function89261
Function89259: ; 89259
ld bc, $0e07
jr Function89261
Function8925e: ; 8925e
ld bc, $0e0c
Function89261: ; 89261
push af
push bc
ld hl, MenuDataHeader_0x892a3
call Function1d3c
pop bc
ld hl, $cf82
ld a, c
ld [hli], a
ld a, b
ld [hli], a
ld a, c
add $4
ld [hli], a
ld a, b
add $5
ld [hl], a
pop af
ld [$cf88], a
call Function1c00
call Function8923c
call Function89209
call Function1d81
push af
ld c, $a
call DelayFrames
call Function1c17
call Function8920f
pop af
jr c, .asm_892a1
ld a, [$cfa9]
cp $2
jr z, .asm_892a1
and a
ret
.asm_892a1
scf
ret
; 892a3
MenuDataHeader_0x892a3: ; 0x892a3
db $40 ; flags
db 05, 10 ; start coords
db 09, 15 ; end coords
dw MenuData2_0x892ab
db 1 ; default option
; 0x892ab
MenuData2_0x892ab: ; 0x892ab
db $c0 ; flags
db 2 ; items
db "はい@"
db "いいえ@"
; 0x892b4
Function892b4: ; 892b4 (22:52b4)
call Function8931b
Function892b7: ; 892b7
ld d, b
ld e, c
ld hl, $0000
add hl, bc
ld a, $50
ld bc, $0006
call ByteFill
ld b, d
ld c, e
ld hl, $0006
add hl, bc
ld a, $50
ld bc, $0006
call ByteFill
ld b, d
ld c, e
ld hl, $000c
add hl, bc
xor a
ld [hli], a
ld [hl], a
ld hl, $000e
add hl, bc
ld [hli], a
ld [hl], a
ld hl, $0010
add hl, bc
ld [hl], a
ld hl, $0011
add hl, bc
ld a, $ff
ld bc, $0008
call ByteFill
ld b, d
ld c, e
ld e, $6
ld hl, $0019
add hl, bc
.asm_892fb
ld a, $ff
ld [hli], a
ld a, $ff
ld [hli], a
dec e
jr nz, .asm_892fb
ret
; 89305
Function89305: ; 89305 (22:5305)
xor a
ld [MenuSelection], a ; $cf74
ld c, $28
.asm_8930b
ld a, [MenuSelection] ; $cf74
inc a
ld [MenuSelection], a ; $cf74
push bc
call Function892b4
pop bc
dec c
jr nz, .asm_8930b
ret
Function8931b: ; 8931b
push hl
ld hl, $a03b
ld a, [MenuSelection]
dec a
ld bc, $0025
call AddNTimes
ld b, h
ld c, l
pop hl
ret
; 8932d
Function8932d: ; 8932d
ld hl, $0000
add hl, bc
Function89331: ; 89331
push bc
ld c, $5
.asm_89334
ld a, [hli]
cp $50
jr z, .asm_89340
cp $7f
jr nz, .asm_89343
dec c
jr nz, .asm_89334
.asm_89340
scf
jr .asm_89344
.asm_89343
and a
.asm_89344
pop bc
ret
; 89346
Function89346: ; 89346 (22:5346)
ld h, b
ld l, c
jr asm_8934e
Function8934a: ; 8934a
ld hl, $0006
add hl, bc
asm_8934e:
push bc
ld c, $5
.asm_89351
ld a, [hli]
cp $50
jr z, .asm_8935d
cp $7f
jr nz, .asm_89360
dec c
jr nz, .asm_89351
.asm_8935d
scf
jr .asm_89361
.asm_89360
and a
.asm_89361
pop bc
ret
; 89363
Function89363: ; 89363
ld h, b
ld l, c
jr .asm_8936b
ld hl, $0019
add hl, bc
.asm_8936b
push de
ld e, $6
.asm_8936e
ld a, [hli]
cp $ff
jr nz, .asm_8937e
ld a, [hli]
cp $ff
jr nz, .asm_8937e
dec e
jr nz, .asm_8936e
scf
jr .asm_8937f
.asm_8937e
and a
.asm_8937f
pop de
ret
; 89381
Function89381: ; 89381
push bc
push de
call Function89b45
jr c, .asm_89392
push hl
ld a, $ff
ld bc, $0008
call ByteFill
pop hl
.asm_89392
pop de
ld c, $8
call Function89193
pop bc
ret
; 8939a
Function8939a: ; 8939a
push bc
ld hl, $0000
add hl, bc
ld de, DefaultFlypoint
ld c, $6
call Function89193
pop bc
ld hl, $0011
add hl, bc
ld de, $d008
call Function89381
ret
; 893b3
Function893b3: ; 893b3 (22:53b3)
call DisableLCD
call ClearSprites
call Functione51
call Functione5f
call Function893ef
call Function8942b
call Function89455
call EnableLCD
ret
Function893cc: ; 893cc
call DisableLCD
call ClearSprites
call Functione51
call Functione5f
call Function893ef
call Function89464
call EnableLCD
ret
; 893e2
Function893e2: ; 893e2 (22:53e2)
call Function89b1e
call Function893b3
call Function8a5b6
call Function8949c
ret
Function893ef: ; 893ef
ld de, VTiles0
ld hl, GFX_8940b
ld bc, $0020
ld a, BANK(GFX_8940b)
call FarCopyBytes
ret
; 893fe
Function893fe: ; 893fe
call DisableLCD
call Function893ef
call EnableLCD
call DelayFrame
ret
; 8940b
GFX_8940b: ; 8940b
INCBIN "baserom.gbc",$8940b,$8942b - $8940b
; 8942b
Function8942b: ; 8942b (22:542b)
ld de, $8020
ld hl, $61bf
ld bc, $80
ld a, $5e
call FarCopyBytes
ld de, $80a0
ld hl, $664f
ld bc, $40
ld a, $5e
call FarCopyBytes
ret
Function89448: ; 89448 (22:5448)
push af
ld hl, Sprites ; $c400
ld d, $60
xor a
.asm_8944f
ld [hli], a
dec d
jr nz, .asm_8944f
pop af
ret
Function89455: ; 89455 (22:5455)
ld hl, $61bf
ld de, $90c0
ld bc, $490
ld a, $5e
call FarCopyBytes
ret
Function89464: ; 89464
ld hl, $59ef
ld de, VTiles2
ld bc, $0200
ld a, $5e
call FarCopyBytes
ld hl, $604f
ld de, $9200
ld bc, $0170
ld a, $5e
call FarCopyBytes
ret
; 89481
Function89481: ; 89481
ld d, $2
call Function8934a
ret c
ld d, $0
ld hl, $0010
add hl, bc
bit 0, [hl]
ret z
inc d
ret
; 89492
Function89492: ; 89492 (22:5492)
ld d, $0
ld a, [PlayerGender] ; $d472
bit 0, a
ret z
inc d
ret
Function8949c: ; 8949c
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, Palette_894b3
ld de, $d038
ld bc, $0008
call CopyBytes
pop af
ld [rSVBK], a
ret
; 894b3
Palette_894b3: ; 894b3
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
RGB 00, 00, 00
; 894bb
Function894bb: ; 894bb
call Function894dc
push bc
call Function8956f
call Function8949c
call Function8a60d
pop bc
ret
; 894ca
Function894ca: ; 894ca (22:54ca)
push bc
call Function894dc
call Function895c7
call Function8949c
call Function8a60d
call Function32f9
pop bc
ret
Function894dc: ; 894dc
push bc
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld c, d
ld b, 0
ld hl, Unknown_89509
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld de, Unkn1Pals
ld bc, $0018
call CopyBytes
ld hl, Palette_89557
ld de, $d018
ld bc, $0018
call CopyBytes
pop af
ld [rSVBK], a
pop bc
ret
; 89509
Unknown_89509: ; 89509
dw Palette_8950f
dw Palette_89527
dw Palette_8953f
; 8950f
Palette_8950f: ; 8950f
RGB 31, 31, 31
RGB 10, 17, 13
RGB 10, 08, 22
RGB 00, 00, 00
RGB 31, 31, 31
RGB 16, 20, 31
RGB 10, 08, 22
RGB 00, 00, 00
RGB 31, 31, 31
RGB 16, 20, 31
RGB 10, 17, 13
RGB 00, 00, 00
Palette_89527: ; 89527
RGB 31, 31, 31
RGB 30, 22, 11
RGB 31, 08, 15
RGB 00, 00, 00
RGB 31, 31, 31
RGB 16, 20, 31
RGB 31, 08, 15
RGB 00, 00, 00
RGB 31, 31, 31
RGB 16, 20, 31
RGB 30, 22, 11
RGB 00, 00, 00
Palette_8953f: ; 8953f
RGB 31, 31, 31
RGB 15, 20, 26
RGB 25, 07, 20
RGB 00, 00, 00
RGB 31, 31, 31
RGB 16, 20, 31
RGB 25, 07, 20
RGB 00, 00, 00
RGB 31, 31, 31
RGB 16, 20, 31
RGB 15, 20, 26
RGB 00, 00, 00
Palette_89557: ; 89557
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 13, 00
RGB 14, 08, 00
RGB 31, 31, 31
RGB 16, 16, 31
RGB 00, 00, 31
RGB 00, 00, 00
RGB 19, 31, 11
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
; 8956f
Function8956f: ; 8956f
push bc
ld hl, $0010
add hl, bc
ld d, h
ld e, l
ld hl, $000c
add hl, bc
ld b, h
ld c, l
callba Function4e929
ld a, c
ld [TrainerClass], a
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, $d030
ld a, $ff
ld [hli], a
ld a, $7f
ld [hl], a
pop af
ld [rSVBK], a
ld a, [TrainerClass]
ld h, $0
ld l, a
add hl, hl
add hl, hl
ld de, TrainerPalettes
add hl, de
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld de, $d032
ld c, $4
.asm_895b1
ld a, BANK(TrainerPalettes)
call GetFarByte
ld [de], a
inc de
inc hl
dec c
jr nz, .asm_895b1
ld hl, $d036
xor a
ld [hli], a
ld [hl], a
pop af
ld [rSVBK], a
pop bc
ret
; 895c7
Function895c7: ; 895c7 (22:55c7)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Palette_895de
ld de, $d030
ld bc, $8
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
ret
; 895de (22:55de)
Palette_895de: ; 895de
RGB 31, 31, 31
RGB 07, 07, 06
RGB 07, 07, 06
RGB 00, 00, 00
; 895e6
Function895e6: ; 895e6
ld a, $7
ld hl, AttrMap
ld bc, $0168
call ByteFill
ret
; 895f2
Function895f2: ; 895f2
push bc
xor a
ld hl, AttrMap
ld bc, $0168
call ByteFill
call Function89605
call Function89655
pop bc
ret
; 89605
Function89605: ; 89605
ld hl, $ce14
ld a, $1
ld de, $0014
ld c, $e
.asm_8960f
ld [hl], a
dec c
jr z, .asm_8961b
add hl, de
inc a
ld [hl], a
dec a
add hl, de
dec c
jr nz, .asm_8960f
.asm_8961b
ld hl, $cf19
ld c, $a
ld a, $2
.asm_89622
ld [hli], a
dec a
ld [hli], a
inc a
dec c
jr nz, .asm_89622
ld hl, $ceb6
ld a, $4
ld bc, $0004
call ByteFill
ld a, $5
ld bc, $000e
call ByteFill
ret
; 8963d
Function8963d: ; 8963d
ld hl, $ce21
ld a, $6
ld de, $0014
ld bc, $0707
.asm_89648
push hl
ld c, $7
.asm_8964b
ld [hli], a
dec c
jr nz, .asm_8964b
pop hl
add hl, de
dec b
jr nz, .asm_89648
ret
; 89655
Function89655: ; 89655
ld hl, AttrMap + SCREEN_WIDTH * 12 + 1
ld de, SCREEN_WIDTH
ld a, 5
ld b, 4
.asm_8965f
ld c, 18
push hl
.asm_89662
ld [hli], a
dec c
jr nz, .asm_89662
pop hl
add hl, de
dec b
jr nz, .asm_8965f
ret
; 8966c
Function8966c: ; 8966c
push bc
call Function89688
hlcoord 4, 0
ld c, $8
call Function896f5
pop bc
ret
; 8967a
Function8967a: ; 8967a (22:567a)
push bc
call Function89688
hlcoord 2, 0
ld c, $c
call Function896f5
pop bc
ret
Function89688: ; 89688
ld hl, TileMap
ld a, $1
ld e, $14
call Function896e1
ld a, $2
ld e, $14
call Function896eb
ld a, $3
ld [hli], a
ld a, $4
ld e, $12
call Function896e1
ld a, $6
ld [hli], a
push bc
ld c, $d
.asm_896a9
call Function896cb
dec c
jr z, .asm_896b5
call Function896d6
dec c
jr nz, .asm_896a9
.asm_896b5
pop bc
ld a, $19
ld [hli], a
ld a, $1a
ld e, $12
call Function896e1
ld a, $1c
ld [hli], a
ld a, $2
ld e, $14
call Function896eb
ret
; 896cb
Function896cb: ; 896cb
ld de, $0013
ld a, $7
ld [hl], a
add hl, de
ld a, $9
ld [hli], a
ret
; 896d6
Function896d6: ; 896d6
ld de, $0013
ld a, $a
ld [hl], a
add hl, de
ld a, $b
ld [hli], a
ret
; 896e1
Function896e1: ; 896e1
.asm_896e1
ld [hli], a
inc a
dec e
ret z
ld [hli], a
dec a
dec e
jr nz, .asm_896e1
ret
; 896eb
Function896eb: ; 896eb
.asm_896eb
ld [hli], a
dec a
dec e
ret z
ld [hli], a
inc a
dec e
jr nz, .asm_896eb
ret
; 896f5
Function896f5: ; 896f5
call Function8971f
call Function89736
inc hl
inc hl
ld b, 2
ClearScreenArea: ; 0x896ff
; clears an area of the screen
; INPUT:
; hl = address of upper left corner of the area
; b = height
; c = width
ld a, " " ; blank tile
ld de, 20 ; screen width
.loop
push bc
push hl
.innerLoop
ld [hli], a
dec c
jr nz, .innerLoop
pop hl
pop bc
add hl, de
dec b
jr nz, .loop
dec hl
inc c
inc c
.asm_89713
ld a, $36
ld [hli], a
dec c
ret z
ld a, $18
ld [hli], a
dec c
jr nz, .asm_89713 ; 0x8971c $f5
ret
; 0x8971f
Function8971f: ; 8971f
ld a, $2c
ld [hli], a
ld a, $2d
ld [hld], a
push hl
ld de, $0014
add hl, de
ld a, $31
ld [hli], a
ld a, $32
ld [hld], a
add hl, de
ld a, $35
ld [hl], a
pop hl
ret
; 89736
Function89736: ; 89736
push hl
inc hl
inc hl
ld e, c
ld d, $0
add hl, de
ld a, $2f
ld [hli], a
ld a, $30
ld [hld], a
ld de, $0014
add hl, de
ld a, $33
ld [hli], a
ld a, $34
ld [hl], a
add hl, de
ld a, $1f
ld [hl], a
pop hl
ret
; 89753
Function89753: ; 89753
ld a, $c
ld [hl], a
xor a
call Function89215
ret
; 8975b
Function8975b: ; 8975b
ld a, $1d
ld [hli], a
inc a
ld [hli], a
ld a, $d
ld [hl], a
dec hl
dec hl
ld a, $4
ld e, $3
.asm_89769
call Function89215
inc hl
dec e
jr nz, .asm_89769
ret
; 89771
Function89771: ; 89771
ld a, $12
ld [hl], a
ld a, $3
call Function89215
ret
; 8977a
Function8977a: ; 8977a
ld e, $4
ld d, $13
.asm_8977e
ld a, d
ld [hl], a
ld a, $4
call Function89215
inc hl
inc d
dec e
jr nz, .asm_8977e
ld e, $e
.asm_8978c
ld a, d
ld [hl], a
xor a
call Function89215
inc hl
dec e
jr nz, .asm_8978c
ret
; 89797
Function89797: ; 89797
push bc
ld a, $e
ld [hl], a
ld bc, $0014
add hl, bc
ld a, $11
ld [hli], a
ld a, $10
ld c, $8
.asm_897a6
ld [hli], a
dec c
jr nz, .asm_897a6
ld a, $f
ld [hl], a
pop bc
ret
; 897af
Function897af: ; 897af
push bc
ld hl, $0010
add hl, bc
ld d, h
ld e, l
ld hl, $000c
add hl, bc
ld b, h
ld c, l
callba Function4e929
ld a, c
ld [TrainerClass], a
xor a
ld [CurPartySpecies], a
ld de, $9370
callba GetTrainerPic
pop bc
ret
; 897d5
Function897d5: ; 897d5
push bc
call Function8934a
jr nc, .asm_897f3
ld hl, $ce21
xor a
ld de, $0014
ld bc, $0707
.asm_897e5
push hl
ld c, $7
.asm_897e8
ld [hli], a
dec c
jr nz, .asm_897e8
pop hl
add hl, de
dec b
jr nz, .asm_897e5
pop bc
ret
.asm_897f3
ld a, $37
ld [$ffad], a
hlcoord 12, 3
ld bc, $0707
predef FillBox
call Function8963d
pop bc
ret
; 89807
Function89807: ; 89807 (22:5807)
ld hl, $5bef
ld a, [PlayerGender] ; $d472
bit 0, a
jr z, .asm_89814
ld hl, $5e1f
.asm_89814
call DisableLCD
ld de, $9370
ld bc, $230
ld a, $5e
call FarCopyBytes
call EnableLCD
call DelayFrame
ret
Function89829: ; 89829 (22:5829)
push bc
ld bc, $705
ld de, $14
ld a, $37
.asm_89832
push bc
push hl
.asm_89834
ld [hli], a
inc a
dec c
jr nz, .asm_89834
pop hl
add hl, de
pop bc
dec b
jr nz, .asm_89832
call Function8963d
pop bc
ret
Function89844: ; 89844
call Function89481
call Function894bb
call Function897af
push bc
call Function3200
call Function32f9
pop bc
ret
; 89856
Function89856: ; 89856
push bc
call Function891b8
pop bc
call Function895f2
call Function8966c
call Function899d3
call Function898aa
call Function898be
call Function898dc
call Function898f3
push bc
ld bc, $d008
hlcoord 2, 10
call Function89975
pop bc
call Function897d5
ret
; 8987f
Function8987f: ; 8987f (22:587f)
call Function891b8
call Function895f2
call Function8967a
call Function899d3
hlcoord 5, 1
call Function8999c
hlcoord 13, 3
call Function89829
call Function899b2
hlcoord 5, 5
call Function899c9
ld bc, $d008
hlcoord 2, 10
call Function89975
ret
Function898aa: ; 898aa
ld a, [MenuSelection]
and a
ret z
push bc
hlcoord 6, 1
ld de, MenuSelection
ld bc, $8102
call PrintNum
pop bc
ret
; 898be
Function898be: ; 898be
push bc
ld de, DefaultFlypoint
ld hl, DefaultFlypoint
call Function89331
jr nc, .asm_898cd
ld de, String_89116
.asm_898cd
hlcoord 9, 1
ld a, [MenuSelection]
and a
jr nz, .asm_898d7
dec hl
.asm_898d7
call PlaceString
pop bc
ret
; 898dc
Function898dc: ; 898dc
ld hl, $0006
add hl, bc
push bc
ld d, h
ld e, l
call Function8934a
jr nc, .asm_898eb
ld de, String_89116
.asm_898eb
hlcoord 6, 4
call PlaceString
pop bc
ret
; 898f3
Function898f3: ; 898f3
push bc
ld hl, $000c
add hl, bc
ld d, h
ld e, l
call Function8934a
jr c, .asm_8990a
hlcoord 5, 5
ld bc, $8205
call PrintNum
jr .asm_89913
.asm_8990a
hlcoord 5, 5
ld de, String_89116
call PlaceString
.asm_89913
pop bc
ret
; 89915
Function89915: ; 89915
push bc
push hl
ld de, Unknown_89942
ld c, $8
.asm_8991c
ld a, [de]
ld [hl], a
ld a, $4
call Function89215
inc hl
inc de
dec c
jr nz, .asm_8991c
pop hl
ld b, $4
ld c, $2b
ld a, $8
ld de, Unknown_8994a
.asm_89932
push af
ld a, [de]
cp [hl]
jr nz, .asm_8993b
call Function8994e
inc de
.asm_8993b
inc hl
pop af
dec a
jr nz, .asm_89932
pop bc
ret
; 89942
Unknown_89942: ; 89942
db $24, $25, $26, " ", $27, $28, $29, $2a
Unknown_8994a: ; 8994a
db $24, $27, $29, $ff
; 8994e
Function8994e: ; 8994e
push hl
push de
ld de, $0014
ld a, l
sub e
ld l, a
ld a, h
sbc d
ld h, a
ld a, c
ld [hl], a
ld a, b
call Function89215
pop de
pop hl
ret
; 89962
Function89962: ; 89962
push bc
ld c, $4
ld b, $20
.asm_89967
ld a, b
ld [hl], a
ld a, $4
call Function89215
inc hl
inc b
dec c
jr nz, .asm_89967
pop bc
ret
; 89975
Function89975: ; 89975
push bc
ld e, $8
.asm_89978
ld a, [bc]
ld d, a
call Function8998b
swap d
inc hl
ld a, d
call Function8998b
inc bc
inc hl
dec e
jr nz, .asm_89978
pop bc
ret
; 8998b
Function8998b: ; 8998b
push bc
and $f
cp $a
jr nc, .asm_89997
ld c, $f6
add c
jr .asm_89999
.asm_89997
ld a, $7f
.asm_89999
ld [hl], a
pop bc
ret
; 8999c
Function8999c: ; 8999c (22:599c)
ld de, PlayerName ; $d47d
call PlaceString
inc bc
ld h, b
ld l, c
ld de, String_899ac
call PlaceString
ret
; 899ac (22:59ac)
String_899ac: ; 899ac
db "の めいし@"
; 899b2
Function899b2: ; 899b2 (22:59b2)
ld bc, PlayerName ; $d47d
call Function89346
jr c, .asm_899bf
ld de, PlayerName ; $d47d
jr .asm_899c2
.asm_899bf
ld de, String_89116
.asm_899c2
hlcoord 6, 4
call PlaceString
ret
Function899c9: ; 899c9 (22:59c9)
ld de, PlayerID ; $d47b
ld bc, $8205
call PrintNum
ret
Function899d3: ; 899d3
hlcoord 1, 4
call Function89753
hlcoord 2, 5
call Function8975b
hlcoord 1, 9
call Function89771
hlcoord 1, 11
call Function8977a
hlcoord 1, 5
call Function89797
hlcoord 2, 4
call Function89962
hlcoord 2, 9
call Function89915
ret
; 899fe
Function899fe: ; 899fe
push bc
push hl
ld hl, $0019
add hl, bc
ld b, h
ld c, l
pop hl
call Function89a0c
pop bc
ret
; 89a0c
Function89a0c: ; 89a0c
push hl
call Function89363
pop hl
jr c, .asm_89a1c
ld d, h
ld e, l
callba Function11c08f
ret
.asm_89a1c
ld de, String_89153
call PlaceString
ret
; 89a23
Function89a23: ; 89a23 (22:5a23)
hlcoord 0, 11
ld b, $4
ld c, $12
call Function8921f
ret
Function89a2e: ; 89a2e (22:5a2e)
hlcoord 11, 12
ld b, $2
ld c, $6
call TextBox
hlcoord 13, 13
ld de, String_89a4e
call PlaceString
hlcoord 13, 14
ld de, String_89a53
call PlaceString
call Function89655
ret
; 89a4e (22:5a4e)
String_89a4e: ; 89a4e
db "けってい@"
; 89a53
String_89a53: ; 89a53
db "やめる@"
; 89a57
Function89a57: ; 89a57
call Function354b
bit 6, c
jr nz, .asm_89a78
bit 7, c
jr nz, .asm_89a81
bit 0, c
jr nz, .asm_89a70
bit 1, c
jr nz, .asm_89a70
bit 3, c
jr nz, .asm_89a74
scf
ret
.asm_89a70
ld a, $1
and a
ret
.asm_89a74
ld a, $2
and a
ret
.asm_89a78
call Function89a9b
call nc, Function89a8a
ld a, $0
ret
.asm_89a81
call Function89a93
call nc, Function89a8a
ld a, $0
ret
; 89a8a
Function89a8a: ; 89a8a
push af
ld de, SFX_UNKNOWN_62
call PlaySFX
pop af
ret
; 89a93
Function89a93: ; 89a93
ld d, $28
ld e, $1
call Function89aa3
ret
; 89a9b
Function89a9b: ; 89a9b
ld d, $1
ld e, $ff
call Function89aa3
ret
; 89aa3
Function89aa3: ; 89aa3
ld a, [MenuSelection]
ld c, a
push bc
.asm_89aa8
ld a, [MenuSelection]
cp d
jr z, .asm_89ac0
add e
jr nz, .asm_89ab2
inc a
.asm_89ab2
ld [MenuSelection], a
call Function89ac7
jr nc, .asm_89aa8
call Function89ae6
pop bc
and a
ret
.asm_89ac0
pop bc
ld a, c
ld [MenuSelection], a
scf
ret
; 89ac7
Function89ac7: ; 89ac7
call Function89160
call Function8931b
call Function89ad4
call CloseSRAM
ret
; 89ad4
Function89ad4: ; 89ad4
push de
call Function8932d
jr c, .asm_89ae3
ld hl, $0011
add hl, bc
call Function89b45
jr c, .asm_89ae4
.asm_89ae3
and a
.asm_89ae4
pop de
ret
; 89ae6
Function89ae6: ; 89ae6
ld hl, $d031
xor a
ld [hl], a
ld a, [MenuSelection]
.asm_89aee
cp $6
jr c, .asm_89afc
sub $5
ld c, a
ld a, [hl]
add $5
ld [hl], a
ld a, c
jr .asm_89aee
.asm_89afc
ld [$d030], a
ret
; 89b00
Function89b00: ; 89b00 (22:5b00)
callba Function49351
ret
; 89b07 (22:5b07)
Function89b07: ; 89b07
call Function8923c
call DelayFrame
callba Function4a3a7
ret
; 89b14
Function89b14: ; 89b14
call WhiteBGMap
call Function89b07
call Function89b00
ret
; 89b1e
Function89b1e: ; 89b1e (22:5b1e)
callba Function4a485
call Function89b00
ret
Function89b28: ; 89b28 (22:5b28)
call Function891de
call WhiteBGMap
call Function893e2
call Function1d7d
call Function891ab
call Function32f9
ret
Function89b3b: ; 89b3b (22:5b3b)
call Function8923c
callba Function48cda
ret
Function89b45: ; 89b45
push hl
push bc
ld c, $10
ld e, $0
.asm_89b4b
ld a, [hli]
ld b, a
and $f
cp $a
jr c, .asm_89b5a
ld a, c
cp $b
jr nc, .asm_89b74
jr .asm_89b71
.asm_89b5a
dec c
swap b
inc e
ld a, b
and $f
cp $a
jr c, .asm_89b6c
ld a, c
cp $b
jr nc, .asm_89b74
jr .asm_89b71
.asm_89b6c
inc e
dec c
jr nz, .asm_89b4b
dec e
.asm_89b71
scf
jr .asm_89b75
.asm_89b74
and a
.asm_89b75
pop bc
pop hl
ret
; 89b78
Function89b78: ; 89b78 (22:5b78)
push bc
ld a, [$d010]
cp $10
jr c, .asm_89b8c
ld a, e
and a
jr z, .asm_89b89
ld c, e
.asm_89b85
inc hl
dec c
jr nz, .asm_89b85
.asm_89b89
ld a, $7f
ld [hl], a
.asm_89b8c
ld a, [$d010]
inc a
and $1f
ld [$d010], a
pop bc
ret
Function89b97: ; 89b97 (22:5b97)
call Function89c34
jr c, .asm_89ba0
call Function89448
ret
.asm_89ba0
ld a, [$d011]
ld hl, Unknown_89bd8
and a
jr z, .asm_89bae
.asm_89ba9
inc hl
inc hl
dec a
jr nz, .asm_89ba9
.asm_89bae
ld a, [hli]
ld h, [hl]
ld l, a
ld de, Sprites ; $c400
.asm_89bb4
ld a, [hli]
cp $ff
ret z
ld c, a
ld b, $0
.asm_89bbb
push hl
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
add b
ld [de], a
inc de
ld a, $8
add b
ld b, a
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
pop hl
dec c
jr nz, .asm_89bbb
ld b, $0
ld c, $4
add hl, bc
jr .asm_89bb4
; 89bd8 (22:5bd8)
Unknown_89bd8: ; 89bd8
dw Unknown_89be0
dw Unknown_89bf5
dw Unknown_89c0a
dw Unknown_89c1f
; 89be0
Unknown_89be0: ; 89be0
db $01, $12, $4e, $01, $00
db $01, $19, $4e, $01, $40
db $01, $12, $72, $01, $20
db $01, $19, $72, $01, $60
db $ff
Unknown_89bf5: ; 89bf5
db $01, $60, $16, $01, $00
db $01, $62, $16, $01, $40
db $01, $60, $92, $01, $20
db $01, $62, $92, $01, $60
db $ff
Unknown_89c0a: ; 89c0a
db $01, $78, $66, $01, $00
db $01, $78, $66, $01, $40
db $01, $78, $92, $01, $20
db $01, $78, $92, $01, $60
db $ff
Unknown_89c1f: ; 89c1f
db $01, $80, $66, $01, $00
db $01, $80, $66, $01, $40
db $01, $80, $92, $01, $20
db $01, $80, $92, $01, $60
db $ff
; 89c34
Function89c34: ; 89c34 (22:5c34)
push bc
ld a, [$d012]
ld c, a
inc a
and $f
ld [$d012], a
ld a, c
cp $8
pop bc
ret
Function89c44: ; 89c44 (22:5c44)
call Function89c34
jr c, .asm_89c4f
push de
call Function89448
pop de
ret
.asm_89c4f
ld hl, Sprites ; $c400
push de
ld a, b
ld [hli], a
ld d, $8
ld a, e
and a
ld a, c
jr z, .asm_89c60
.asm_89c5c
add d
dec e
jr nz, .asm_89c5c
.asm_89c60
pop de
ld [hli], a
ld a, d
ld [hli], a
xor a
ld [hli], a
ret
Function89c67: ; 89c67 (22:5c67)
call Function354b
ld b, $0
bit 0, c
jr z, .asm_89c74
ld b, $1
and a
ret
.asm_89c74
bit 1, c
jr z, .asm_89c7a
scf
ret
.asm_89c7a
xor a
bit 6, c
jr z, .asm_89c81
ld a, $1
.asm_89c81
bit 7, c
jr z, .asm_89c87
ld a, $2
.asm_89c87
bit 5, c
jr z, .asm_89c8d
ld a, $3
.asm_89c8d
bit 4, c
jr z, .asm_89c93
ld a, $4
.asm_89c93
and a
ret z
dec a
ld c, a
ld d, $0
ld hl, Unknown_89cbf
ld a, [$d02f]
and a
jr z, .asm_89ca5
ld hl, Unknown_89ccf
.asm_89ca5
ld a, [$d011]
and a
jr z, .asm_89cb1
ld e, $4
.asm_89cad
add hl, de
dec a
jr nz, .asm_89cad
.asm_89cb1
ld e, c
add hl, de
ld a, [hl]
and a
ret z
dec a
ld [$d011], a
xor a
ld [$d012], a
ret
; 89cbf (22:5cbf)
Unknown_89cbf: ; 89cbf
db 0, 2, 0, 0
db 1, 3, 0, 0
db 2, 4, 0, 0
db 3, 0, 0, 0
Unknown_89ccf: ; 89ccf
db 0, 0, 0, 0
db 0, 3, 0, 0
db 2, 4, 0, 0
db 3, 0, 0, 0
; 89cdf
Function89cdf: ; 89cdf (22:5cdf)
ld a, $10
add b
ld b, a
ld a, $8
add c
ld c, a
ld e, $2
ld a, $2
ld hl, Sprites ; $c400
.asm_89cee
push af
push bc
ld d, $4
.asm_89cf2
ld a, b
ld [hli], a
ld a, c
ld [hli], a
ld a, e
ld [hli], a
ld a, $1
ld [hli], a
ld a, $8
add c
ld c, a
inc e
dec d
jr nz, .asm_89cf2
pop bc
ld a, $8
add b
ld b, a
pop af
dec a
jr nz, .asm_89cee
ret
Function89d0d: ; 89d0d (22:5d0d)
call Function8923c
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld c, $8
ld de, Unkn1Pals ; $d000
.asm_89d1c
push bc
ld hl, Palette_89d4e
ld bc, $8
call CopyBytes
pop bc
dec c
jr nz, .asm_89d1c
ld hl, Palette_89d56
ld de, $d010
ld bc, $8
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
call Function32f9
callba Function845db
call Function89240
ld c, $18
call DelayFrames
call RestartMapMusic
ret
; 89d4e (22:5d4e)
Palette_89d4e: ; 89d4e
RGB 31, 31, 31
RGB 19, 19, 19
RGB 15, 15, 15
RGB 00, 00, 00
; 89d56
Palette_89d56: ; 89d56
RGB 31, 31, 31
RGB 19, 19, 19
RGB 19, 19, 19
RGB 00, 00, 00
; 89d5e
Function89d5e: ; 89d5e (22:5d5e)
push af
call Function1d3c
pop af
ld [$cf88], a
call Function8923c
call Function1c89
call Function1c10
ld hl, $cfa5
set 7, [hl]
ret
Function89d75: ; 89d75 (22:5d75)
push hl
call Function8923c
call _hl_
callba Function104148
pop hl
jr asm_89d90
Function89d85: ; 89d85 (22:5d85)
push hl
call Function8923c
call _hl_
call Function3238
pop hl
asm_89d90: ; 89d90 (22:5d90)
call Function8923c
push hl
call _hl_
call Function89dab
ld a, [$cfa9]
push af
call Function891ab
pop af
pop hl
jr c, .asm_89da9
jr z, asm_89d90
scf
ret
.asm_89da9
and a
ret
Function89dab: ; 89dab (22:5dab)
call Function8923c
callba Function241ba
call Function8923c
ld a, c
ld hl, $cfa8
and [hl]
ret z
bit 0, a
jr nz, .asm_89dc7
bit 1, a
jr nz, .asm_89dd9
xor a
ret
.asm_89dc7
call PlayClickSFX
ld a, [$cfa3]
ld c, a
ld a, [$cfa9]
cp c
jr z, .asm_89dd9
call Function1bee
scf
ret
.asm_89dd9
call PlayClickSFX
ld a, $1
and a
ret
Function89de0: ; 89de0 (22:5de0)
call ClearSprites
call Function89e0a
jr c, .asm_89e00
ld c, $1
.asm_89dea
call Function8a31c
jr z, .asm_89dfd
ld a, [$cfa9]
ld c, a
push bc
ld hl, Jumptable_89e04
ld a, e
dec a
rst JumpTable
pop bc
jr .asm_89dea
.asm_89dfd
call Function891fe
.asm_89e00
call Function8917a
ret
Jumptable_89e04: ; 89e04 (22:5e04)
dw Function8a62c
dw Function8a999
dw Function8ab93
Function89e0a: ; 89e0a (22:5e0a)
call Function89160
call Function8b3b0
call CloseSRAM
ld hl, Jumptable_89e18
rst JumpTable
ret
Jumptable_89e18: ; 89e18 (22:5e18)
dw Function89e1e
dw Function8a116
dw Function8a2aa
Function89e1e: ; 89e1e (22:5e1e)
call Function89160
ld bc, $a037
call Function8b36c
call CloseSRAM
xor a
ld [$d02d], a
asm_89e2e: ; 89e2e (22:5e2e)
ld a, [$d02d]
ld hl, Jumptable_89e3c
rst JumpTable
ret
Function89e36: ; 89e36 (22:5e36)
ld hl, $d02d
inc [hl]
jr asm_89e2e
Jumptable_89e3c: ; 89e3c (22:5e3c)
dw Function89e6f
dw Function89fed
dw Function89ff6
dw Function8a03d
dw Function89eb9
dw Function89efd
dw Function89fce
dw Function8a04c
dw Function8a055
dw Function8a0e6
dw Function8a0ec
dw Function8a0f5
dw Function89e58
dw Function89e68
Function89e58: ; 89e58 (22:5e58)
ld a, $1
call Function8a2fe
call Function891fe
call Function893e2
call Function89168
and a
ret
Function89e68: ; 89e68 (22:5e68)
call Function891fe
ld a, $1
scf
ret
Function89e6f: ; 89e6f (22:5e6f)
call Function891de
call Function89245
call Function89ee1
call Function89e9a
hlcoord 7, 4
call Function8a58d
ld a, $5
ld hl, $ce30
call Function8a5a3
ld a, $6
ld hl, $ce33
call Function8a5a3
call Function891ab
call Function32f9
jp Function89e36
Function89e9a: ; 89e9a (22:5e9a)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Palette_89eb1
ld de, $d028
ld bc, $8
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
ret
; 89eb1 (22:5eb1)
Palette_89eb1: ; 89eb1
RGB 31, 31, 31
RGB 31, 31, 31
RGB 27, 19, 00
RGB 00, 00, 00
; 89eb9
Function89eb9: ; 89eb9 (22:5eb9)
call Function891fe
call Function89ee1
call Function89e9a
hlcoord 7, 4
call Function8a58d
ld a, $5
ld hl, $ce30
call Function8a5a3
ld a, $6
ld hl, $ce33
call Function8a5a3
call Function891ab
call Function32f9
jp Function89e36
Function89ee1: ; 89ee1 (22:5ee1)
call WhiteBGMap
call Function893e2
call Function8923c
callba Function4a3a7
callba Function49384
hlcoord 1, 0
call Function8a53d
ret
Function89efd: ; 89efd (22:5efd)
ld hl, $d012
ld a, $ff
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
.asm_89f09
ld hl, $d012
inc [hl]
ld a, [hli]
and $3
jr nz, .asm_89f2e
ld a, [hl]
cp $4
jr nc, .asm_89f2e
ld b, $32
inc [hl]
ld a, [hl]
dec a
jr z, .asm_89f26
ld c, a
.asm_89f1f
ld a, $b
add b
ld b, a
dec c
jr nz, .asm_89f1f
.asm_89f26
ld c, $e8
ld a, [$d013]
call Function89fa5
.asm_89f2e
ld a, [$d013]
and a
jr z, .asm_89f58
.asm_89f34
call Function89f6a
ld e, a
ld a, c
cp $a8
jr nc, .asm_89f4d
cp $46
jr c, .asm_89f4d
ld d, $0
dec e
ld hl, $d014
add hl, de
set 0, [hl]
inc e
jr .asm_89f51
.asm_89f4d
ld a, $2
add c
ld c, a
.asm_89f51
ld a, e
call Function89f77
dec a
jr nz, .asm_89f34
.asm_89f58
call DelayFrame
ld hl, $d014
ld c, $4
.asm_89f60
ld a, [hli]
and a
jr z, .asm_89f09
dec c
jr nz, .asm_89f60
jp Function89e36
Function89f6a: ; 89f6a (22:5f6a)
push af
ld de, $10
call Function89f9a
ld a, [hli]
ld b, a
ld a, [hl]
ld c, a
pop af
ret
Function89f77: ; 89f77 (22:5f77)
push af
ld de, $10
call Function89f9a
ld d, $2
.asm_89f80
push bc
ld e, $2
.asm_89f83
ld a, b
ld [hli], a
ld a, c
ld [hli], a
inc hl
inc hl
ld a, $8
add c
ld c, a
dec e
jr nz, .asm_89f83
pop bc
ld a, $8
add b
ld b, a
dec d
jr nz, .asm_89f80
pop af
ret
Function89f9a: ; 89f9a (22:5f9a)
dec a
ld hl, Sprites ; $c400
and a
ret z
.asm_89fa0
add hl, de
dec a
jr nz, .asm_89fa0
ret
Function89fa5: ; 89fa5 (22:5fa5)
ld de, $10
call Function89f9a
ld e, $2
ld d, $a
.asm_89faf
push bc
ld a, $2
.asm_89fb2
push af
ld a, b
ld [hli], a
ld a, c
ld [hli], a
ld a, d
inc d
ld [hli], a
ld a, $1
ld [hli], a
ld a, $8
add c
ld c, a
pop af
dec a
jr nz, .asm_89fb2
pop bc
ld a, $8
add b
ld b, a
dec e
jr nz, .asm_89faf
ret
Function89fce: ; 89fce (22:5fce)
call Function8a5b6
ld a, $5
ld hl, $ce30
call Function8a5a3
ld a, $6
ld hl, $ce33
call Function8a5a3
call Function89448
call Function32f9
call Function891ab
jp Function89e36
Function89fed: ; 89fed (22:5fed)
ld hl, UnknownText_0x8a102
call PrintText
jp Function89e36
Function89ff6: ; 89ff6 (22:5ff6)
call Function891fe
call WhiteBGMap
call Function893cc
call Function89807
call Function89492
call Function894ca
call Function89160
ld hl, $a603
ld a, $ff
ld bc, $8
call ByteFill
ld hl, $a603
ld de, $d008
call Function89381
call CloseSRAM
call Function8987f
call Function89160
hlcoord 1, 13
ld bc, $a007
call Function89a0c
call CloseSRAM
call Function891ab
call Function89235
jp Function89e36
Function8a03d: ; 8a03d (22:603d)
ld hl, UnknownText_0x8a107
call Function89209
call PrintText
call Function8920f
jp Function89e36
Function8a04c: ; 8a04c (22:604c)
ld hl, UnknownText_0x8a10c
call PrintText
jp Function89e36
Function8a055: ; 8a055 (22:6055)
ld c, $7
ld b, $4
.asm_8a059
call Function8a0a1
inc c
call Function8a0c9
push bc
call Function8a58d
pop bc
call Function8a0de
push bc
push hl
ld a, $5
call Function8a5a3
pop hl
inc hl
inc hl
inc hl
ld a, $6
call Function8a5a3
call Function3238
pop bc
ld a, c
cp $b
jr nz, .asm_8a059
call Function8a0a1
hlcoord 12, 4
call Function8a58d
ld a, $5
ld hl, $ce35
call Function8a5a3
pop hl
ld a, $6
ld hl, $ce38
call Function8a5a3
call Function3238
jp Function89e36
Function8a0a1: ; 8a0a1 (22:60a1)
call Function8923c
push bc
call Function8a0c9
ld e, $6
.asm_8a0aa
push hl
ld bc, $6
add hl, bc
ld d, [hl]
call Function8a0c1
pop hl
ld [hl], d
call Function89215
ld bc, $14
add hl, bc
dec e
jr nz, .asm_8a0aa
pop bc
ret
Function8a0c1: ; 8a0c1 (22:60c1)
push hl
ld bc, AttrMap - TileMap
add hl, bc
ld a, [hl]
pop hl
ret
Function8a0c9: ; 8a0c9 (22:60c9)
push bc
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld de, $14
ld a, b
and a
jr z, .asm_8a0d8
.asm_8a0d4
add hl, de
dec b
jr nz, .asm_8a0d4
.asm_8a0d8
ld d, $0
ld e, c
add hl, de
pop bc
ret
Function8a0de: ; 8a0de (22:60de)
call Function8a0c9
ld de, AttrMap - TileMap
add hl, de
ret
Function8a0e6: ; 8a0e6 (22:60e6)
call Function8b539
jp Function89e36
Function8a0ec: ; 8a0ec (22:60ec)
ld hl, UnknownText_0x8a111
call PrintText
jp Function89e36
Function8a0f5: ; 8a0f5 (22:60f5)
call Function8b555
jp nc, Function8a0ff
ld hl, $d02d
inc [hl]
Function8a0ff: ; 8a0ff (22:60ff)
jp Function89e36
; 8a102 (22:6102)
UnknownText_0x8a102: ; 0x8a102
; The CARD FOLDER stores your and your friends' CARDS. A CARD contains information like the person's name, phone number and profile.
text_jump UnknownText_0x1c5238
db "@"
; 0x8a107
UnknownText_0x8a107: ; 0x8a107
; This is your CARD. Once you've entered your phone number, you can trade CARDS with your friends.
text_jump UnknownText_0x1c52bc
db "@"
; 0x8a10c
UnknownText_0x8a10c: ; 0x8a10c
; If you have your friend's CARD, you can use it to make a call from a mobile phone on the 2nd floor of a #MON CENTER.
text_jump UnknownText_0x1c531e
db "@"
; 0x8a111
UnknownText_0x8a111: ; 0x8a111
; To safely store your collection of CARDS, you must set a PASSCODE for your CARD FOLDER.
text_jump UnknownText_0x1c5394
db "@"
; 0x8a116
Function8a116: ; 8a116 (22:6116)
ld a, $1
ld [$d030], a
ld hl, MenuDataHeader_0x8a176
call LoadMenuDataHeader
.asm_8a121
call Function8923c
call Function8a17b
jr c, .asm_8a16b
ld a, [$cfa9]
ld [$d030], a
dec d
jr z, .asm_8a140
call Function8a20d
jr c, .asm_8a121
xor a
call Function8a2fe
call Function8916e
jr .asm_8a16b
.asm_8a140
call Function89174
jr nz, .asm_8a14c
call Function8a241
jr c, .asm_8a121
jr .asm_8a15a
.asm_8a14c
call WaitSFX
ld de, SFX_TWINKLE
call PlaySFX
ld c, $10
call DelayFrames
.asm_8a15a
call Function1c07
call Function891de
call Function893e2
call Function89245
call Function89168
and a
ret
.asm_8a16b
call Function89209
call Function1c17
call Function8920f
scf
ret
; 8a176 (22:6176)
MenuDataHeader_0x8a176: ; 0x8a176
db $40 ; flags
db 00, 14 ; start coords
db 06, 19 ; end coords
; 8a17b
Function8a17b: ; 8a17b (22:617b)
decoord 14, 0
ld b, $5
ld c, $4
call Function89b3b
ld hl, MenuDataHeader_0x8a19a
ld a, [$d030]
call Function89d5e
ld hl, $61b0
call Function89d75
jr nc, .asm_8a198
ld a, $0
.asm_8a198
ld d, a
ret
; 8a19a (22:619a)
MenuDataHeader_0x8a19a: ; 0x8a19a
db $40 ; flags
db 00, 14 ; start coords
db 06, 19 ; end coords
dw MenuData2_0x8a1a2
db 1 ; default option
; 0x8a1a2
MenuData2_0x8a1a2: ; 0x8a1a2
db $e0 ; flags
db 3 ; items
db "ひらく@"
db "すてる@"
db "もどる@"
; 0x8a1b0
Function8a1b0: ; 8a1b0
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
hlcoord 1, 14
ld a, [$cfa9]
ld de, Strings_8a1cc
dec a
ld c, a
call Function8919e
call PlaceString
ret
; 8a1cc
Strings_8a1cc: ; 8a1cc
db "めいし", $25, "せいりと へんしゅうを"
next "おこないます@"
db "めいしフ,ルダー", $25, "めいしと"
next "あんしょうばんごう", $1f, "けします@"
db "まえ", $25, "がめん", $1d, "もどります@"
; 8a20d
Function8a20d: ; 8a20d (22:620d)
ld hl, UnknownText_0x8a232
call PrintText
ld a, $2
call Function89259
ret c
ld hl, UnknownText_0x8a237
call PrintText
ld a, $2
call Function89259
ret c
xor a
call Function8a2fe
ld hl, UnknownText_0x8a23c
call PrintText
xor a
and a
ret
; 8a232 (22:6232)
UnknownText_0x8a232: ; 0x8a232
; If the CARD FOLDER is deleted, all its CARDS and the PASSCODE will also be deleted. Beware--a deleted CARD FOLDER can't be restored. Want to delete your CARD FOLDER?
text_jump UnknownText_0x1c53ee
db "@"
; 0x8a237
UnknownText_0x8a237: ; 0x8a237
; Are you sure you want to delete it?
text_jump UnknownText_0x1c5494
db "@"
; 0x8a23c
UnknownText_0x8a23c: ; 0x8a23c
; The CARD FOLDER has been deleted.
text_jump UnknownText_0x1c54b9
db "@"
; 0x8a241
Function8a241: ; 8a241 (22:6241)
call Function1d6e
call Function891fe
call Function8a262
jr nc, .asm_8a254
call Function891fe
call Function89b28
scf
ret
.asm_8a254
call Function891de
call WhiteBGMap
call Function1d7d
call Function891de
and a
ret
Function8a262: ; 8a262 (22:6262)
call WhiteBGMap
call Function893e2
call Function8923c
callba Function4a3a7
callba Function49384
hlcoord 1, 0
call Function8a53d
hlcoord 12, 4
call Function8a58d
ld a, $5
ld hl, $ce35
call Function8a5a3
ld a, $6
ld hl, $ce38
call Function8a5a3
xor a
ld [$d02e], a
ld bc, $d013
call Function8b36c
call Function8b493
call Function891ab
call Function32f9
call Function8b5e7
ret
Function8a2aa: ; 8a2aa (22:62aa)
ld hl, MenuDataHeader_0x8a2ef
call LoadMenuDataHeader
ld hl, UnknownText_0x8a2f4
call PrintText
ld a, $1
call Function89259
jr nc, .asm_8a2cf
ld hl, UnknownText_0x8a2f9
call PrintText
ld a, $2
call Function89259
jr c, .asm_8a2ea
call Function8a20d
jr .asm_8a2ea
.asm_8a2cf
call Function1c07
call Function8a241
jr c, .asm_8a2ed
ld a, $1
call Function8a313
call CloseSRAM
call Function891de
call Function89245
call Function89168
and a
ret
.asm_8a2ea
call Function1c17
.asm_8a2ed
scf
ret
; 8a2ef (22:62ef)
MenuDataHeader_0x8a2ef: ; 0x8a2ef
db $40 ; flags
db 12, 00 ; start coords
db 17, 19 ; end coords
; 8a2f4
UnknownText_0x8a2f4: ; 0x8a2f4
; There is an older CARD FOLDER from a previous journey. Do you want to open it?
text_jump UnknownText_0x1c54dd
db "@"
; 0x8a2f9
UnknownText_0x8a2f9: ; 0x8a2f9
; Delete the old CARD FOLDER?
text_jump UnknownText_0x1c552d
db "@"
; 0x8a2fe
Function8a2fe: ; 8a2fe (22:62fe)
call Function8a313
call Function89305
ld hl, $a603
ld bc, $8
ld a, $ff
call ByteFill
call CloseSRAM
ret
Function8a313: ; 8a313 (22:6313)
ld c, a
call Function89160
ld a, c
ld [$a60b], a
ret
Function8a31c: ; 8a31c (22:631c)
push bc
call Function8923c
callba Function4a3a7
callba Function49384
hlcoord 1, 0
call Function8a53d
hlcoord 12, 4
call Function8a58d
call Function8a3b2
pop bc
ld a, c
ld [$cf88], a
ld [MenuSelection], a ; $cf74
call Function1c89
call Function1c10
ld hl, $cfa5
set 7, [hl]
.asm_8a34e
call Function8a3a2
call Function8923c
call Function8a453
call Function8a4d3
call Function8a4fc
call Function891ab
call Function32f9
call Function8a383
jr c, .asm_8a370
jr z, .asm_8a34e
.asm_8a36a
call Function89448
xor a
ld e, a
ret
.asm_8a370
call Function89448
call Function1bee
call Function8a3a2
ld a, [MenuSelection] ; $cf74
cp $ff
jr z, .asm_8a36a
ld e, a
and a
ret
Function8a383: ; 8a383 (22:6383)
callba Function241ba
ld a, c
ld hl, $cfa8
and [hl]
ret z
bit 0, a
jr nz, .asm_8a399
bit 1, a
jr nz, .asm_8a39e
xor a
ret
.asm_8a399
call PlayClickSFX
scf
ret
.asm_8a39e
call PlayClickSFX
ret
Function8a3a2: ; 8a3a2 (22:63a2)
ld a, [$cfa9]
dec a
ld hl, DefaultFlypoint ; $d002
ld e, a
ld d, $0
add hl, de
ld a, [hl]
ld [MenuSelection], a ; $cf74
ret
Function8a3b2: ; 8a3b2 (22:63b2)
ld a, $1
ld [MenuSelection], a ; $cf74
call Function8a4fc
call Function8a3df
jr nc, .asm_8a3ce
decoord 0, 2
ld b, $6
ld c, $9
call Function89b3b
ld hl, MenuDataHeader_0x8a435
jr .asm_8a3db
.asm_8a3ce
decoord 0, 2
ld b, $8
ld c, $9
call Function89b3b
ld hl, MenuDataHeader_0x8a40f
.asm_8a3db
call Function1d3c
ret
Function8a3df: ; 8a3df (22:63df)
call Function89160
ld hl, $a603
call Function89b45
call CloseSRAM
ld hl, DefaultFlypoint ; $d002
jr c, .asm_8a3f8
ld de, Unknown_8a408
call Function8a400
scf
ret
.asm_8a3f8
ld de, Unknown_8a40b
call Function8a400
and a
ret
Function8a400: ; 8a400 (22:6400)
ld a, [de]
inc de
ld [hli], a
cp $ff
jr nz, Function8a400
ret
; 8a408 (22:6408)
Unknown_8a408: db 1, 2, -1
Unknown_8a40b: db 1, 2, 3, -1
MenuDataHeader_0x8a40f: ; 0x8a40f
db $40 ; flags
db 02, 00 ; start coords
db 11, 10 ; end coords
dw MenuData2_0x8a417
db 1 ; default option
; 0x8a417
MenuData2_0x8a417: ; 0x8a417
db $a0 ; flags
db 4 ; items
db "めいしりスト@"
db "じぶんの めいし@"
db "めいしこうかん@"
db "やめる@"
; 0x8a435
MenuDataHeader_0x8a435: ; 0x8a435
db $40 ; flags
db 02, 00 ; start coords
db 09, 10 ; end coords
dw MenuData2_0x8a43d
db 1 ; default option
; 0x8a43d
MenuData2_0x8a43d: ; 0x8a43d
db $a0 ; flags
db 3 ; items
db "めいしりスト@"
db "じぶんの めいし@"
db "やめる@"
; 0x8a453
Function8a453: ; 8a453 (22:6453)
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
hlcoord 1, 14
ld de, String_8a476
ld a, [MenuSelection] ; $cf74
cp $ff
jr z, .asm_8a472
ld de, Strings_8a483
dec a
ld c, a
call Function8919e
.asm_8a472
call PlaceString
ret
; 8a476 (22:6476)
String_8a476: ; 8a476
db "まえ", $25, "がめん", $1d, "もどります@"
; 8a483
Strings_8a483: ; 8a483
db "おともだち", $25, "めいしは"
next "ここ", $1d, "いれておきます@"
db "でんわばんごう", $1f, "いれると"
next "めいしこうかん", $4a, "できます@"
db "ともだちと じぶん", $25, "めいしを"
next "せきがいせんで こうかん します@"
; 8a4d3
Function8a4d3: ; 8a4d3 (22:64d3)
ld a, [MenuSelection] ; $cf74
cp $1
jr nz, .asm_8a4eb
ld a, $5
ld hl, $ce35
call Function8a5a3
ld a, $7
ld hl, $ce38
call Function8a5a3
ret
.asm_8a4eb
ld a, $7
ld hl, $ce35
call Function8a5a3
ld a, $6
ld hl, $ce38
call Function8a5a3
ret
Function8a4fc: ; 8a4fc (22:64fc)
ld a, [MenuSelection] ; $cf74
cp $3
jr nz, asm_8a529
ld hl, $d012
ld a, [hli]
ld b, a
ld a, [hld]
add b
ld [hl], a
ld b, a
ld c, $80
call Function89cdf
call Function8a515
ret
Function8a515: ; 8a515 (22:6515)
ld hl, $d012
ld a, [hl]
cp $38
jr c, .asm_8a520
cp $3c
ret c
.asm_8a520
ld a, [$d013]
cpl
inc a
ld [$d013], a
ret
asm_8a529: ; 8a529 (22:6529)
ld hl, $d012
ld a, $3c
ld [hli], a
ld a, $ff
ld [hli], a
ld hl, Sprites ; $c400
xor a
ld bc, $20
call ByteFill
ret
Function8a53d: ; 8a53d (22:653d)
push hl
ld a, $15
ld c, $8
ld de, $14
call Function8a573
ld a, $1d
ld c, $9
call Function8a57c
inc a
ld [hl], a
call Function8a584
pop hl
add hl, de
ld a, $1f
ld c, $8
call Function8a573
dec hl
ld a, $51
ld [hli], a
ld a, $26
ld c, $1
call Function8a57c
ld a, $52
ld c, $3
call Function8a573
ld a, $27
ld c, $6
Function8a573: ; 8a573 (22:6573)
ld [hl], a
call Function8a584
inc a
dec c
jr nz, Function8a573
ret
Function8a57c: ; 8a57c (22:657c)
ld [hl], a
call Function8a584
dec c
jr nz, Function8a57c
ret
Function8a584: ; 8a584 (22:6584)
push af
ld a, $4
call Function89215
inc hl
pop af
ret
Function8a58d: ; 8a58d (22:658d)
ld a, $2d
ld bc, $606
ld de, $14
.asm_8a595
push bc
push hl
.asm_8a597
ld [hli], a
inc a
dec c
jr nz, .asm_8a597
pop hl
add hl, de
pop bc
dec b
jr nz, .asm_8a595
ret
Function8a5a3: ; 8a5a3 (22:65a3)
ld bc, $603
ld de, $14
.asm_8a5a9
push bc
push hl
.asm_8a5ab
ld [hli], a
dec c
jr nz, .asm_8a5ab
pop hl
add hl, de
pop bc
dec b
jr nz, .asm_8a5a9
ret
Function8a5b6: ; 8a5b6 (22:65b6)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Palette_8a5e5
ld de, $d020
ld bc, $18
call CopyBytes
ld hl, Palette_8a5fd
ld de, Unkn2Pals ; $d040
ld bc, $8
call CopyBytes
ld hl, Palette_8a605
ld de, $d048
ld bc, $8
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
ret
; 8a5e5 (22:65e5)
Palette_8a5e5: ; 8a5e5
RGB 31, 31, 31
RGB 27, 19, 00
RGB 07, 11, 22
RGB 00, 00, 00
RGB 31, 31, 31
RGB 16, 16, 31
RGB 27, 19, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 31, 00, 00
RGB 27, 19, 00
RGB 00, 00, 00
; 8a5fd
Palette_8a5fd: ; 8a5fd
RGB 00, 00, 00
RGB 00, 00, 00
RGB 00, 00, 00
RGB 31, 31, 31
; 8a605
Palette_8a605: ; 8a605
RGB 00, 00, 00
RGB 14, 18, 31
RGB 16, 16, 31
RGB 31, 31, 31
; 8a60d
Function8a60d: ; 8a60d
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, Palette_8a624
ld de, Unkn2Pals
ld bc, $0008
call CopyBytes
pop af
ld [rSVBK], a
ret
; 8a624
Palette_8a624: ; 8a624
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
RGB 00, 00, 00
; 8a62c
Function8a62c: ; 8a62c (22:662c)
call Function1d6e
call Function891fe
xor a
call Function8b94a
call Function8b677
.asm_8a639
xor a
ld [$d033], a
ld [$d032], a
ld [$d0e3], a
call Function8b7bd
ld a, c
and a
jr z, .asm_8a66a
ld [MenuSelection], a ; $cf74
ld b, a
ld a, [$cf77]
inc a
ld [$d034], a
push bc
call Function8b960
ld a, c
pop bc
jr z, .asm_8a639
ld c, a
ld hl, Jumptable_8a671
ld a, b
ld [MenuSelection], a ; $cf74
ld a, c
dec a
rst JumpTable
jr .asm_8a639
.asm_8a66a
call Function891fe
call Function89b28
ret
Jumptable_8a671: ; 8a671 (22:6671)
dw Function8a679
dw Function8a6cd
dw Function8a8c3
dw Function8a930
Function8a679: ; 8a679 (22:6679)
call Function891de
call WhiteBGMap
call Function893cc
call Function89160
call Function8931b
call Function89844
call CloseSRAM
call Function89160
call Function8939a
call Function89856
hlcoord 1, 13
call Function899fe
call Function891ab
call CloseSRAM
.asm_8a6a3
call Function89a57
jr c, .asm_8a6a3
and a
jr z, Function8a679
ld hl, Jumptable_8a6bc
dec a
rst JumpTable
jr c, Function8a679
call Function891fe
call Function8b677
call Function89448
ret
Jumptable_8a6bc: ; 8a6bc (22:66bc)
dw Function8a6c0
dw Function8a6c5
Function8a6c0: ; 8a6c0 (22:66c0)
call PlayClickSFX
and a
ret
Function8a6c5: ; 8a6c5 (22:66c5)
call PlayClickSFX
call Function89d0d
scf
ret
Function8a6cd: ; 8a6cd (22:66cd)
call Function891de
call WhiteBGMap
call Function893cc
call Function89160
call Function8931b
call Function89844
call Function8a757
call CloseSRAM
.asm_8a6e5
call Function89160
call Function8931b
call Function89856
call Function89a2e
call Function891ab
xor a
ld [$d02f], a
call CloseSRAM
.asm_8a6fb
call Function89b97
call Function89c67
jr c, .asm_8a718
ld a, b
and a
jr z, .asm_8a6fb
call PlayClickSFX
call Function89448
ld a, [$d011]
ld hl, Jumptable_8a74f
rst JumpTable
jr nc, .asm_8a6e5
jr .asm_8a742
.asm_8a718
call Function89160
call Function8a765
call CloseSRAM
jr nc, .asm_8a73f
call Function8923c
call Function89448
call Function89a23
hlcoord 1, 13
ld de, String_89135
call PlaceString
call WaitBGMap
ld a, $2
call Function89254
jr c, .asm_8a6e5
.asm_8a73f
call CloseSRAM
.asm_8a742
call WhiteBGMap
call Function89448
call Function891d3
call Function8b677
ret
Jumptable_8a74f: ; 8a74f (22:674f)
dw Function8a78c
dw Function8a7cb
dw Function8a818
dw Function8a8a1
Function8a757: ; 8a757 (22:6757)
call Function8939a
xor a
ld [$d010], a
ld [$d011], a
ld [$d012], a
ret
Function8a765: ; 8a765 (22:6765)
call Function8931b
push bc
ld hl, $0
add hl, bc
ld de, DefaultFlypoint ; $d002
ld c, $6
call Function89185
pop bc
jr nz, .asm_8a78a
push bc
ld hl, $11
add hl, bc
ld de, $d008
ld c, $8
call Function89185
pop bc
jr nz, .asm_8a78a
and a
ret
.asm_8a78a
scf
ret
Function8a78c: ; 8a78c (22:678c)
call Function891fe
ld de, DefaultFlypoint ; $d002
ld b, $5
callba Function116c1
call Function89160
call Function8931b
push bc
ld hl, $0
add hl, bc
ld d, h
ld e, l
ld hl, DefaultFlypoint ; $d002
call InitName
call CloseSRAM
call DelayFrame
call Functiona57
call Function891de
call WhiteBGMap
call Function893cc
call Function89160
pop bc
call Function89844
call CloseSRAM
and a
ret
Function8a7cb: ; 8a7cb (22:67cb)
ld a, [MenuSelection] ; $cf74
push af
call Function891de
ld de, $d008
ld c, $0
callba Function17a68f
jr c, .asm_8a7f4
ld hl, $d008
ld a, $ff
ld bc, $8
call ByteFill
ld h, d
ld l, e
ld de, $d008
ld c, $8
call Function89193
.asm_8a7f4
pop af
ld [MenuSelection], a ; $cf74
call Function891de
call WhiteBGMap
call Function893cc
call Function89160
call Function8931b
call Function89844
call Function89856
call Function89a2e
call Function891ab
call CloseSRAM
and a
ret
Function8a818: ; 8a818 (22:6818)
call Function89a23
ld hl, DefaultFlypoint ; $d002
call Function89331
jr c, .asm_8a875
ld hl, $d008
call Function89b45
jr nc, .asm_8a87a
call Function89160
call Function8a765
jr nc, .asm_8a863
call Function8931b
push bc
ld hl, $0
add hl, bc
ld d, h
ld e, l
ld hl, DefaultFlypoint ; $d002
ld c, $6
call Function89193
pop bc
ld hl, $11
add hl, bc
ld d, h
ld e, l
ld hl, $d008
ld c, $8
call Function89193
hlcoord 1, 13
ld de, .string_8a868
call PlaceString
call WaitBGMap
call Functiona36
.asm_8a863
call CloseSRAM
scf
ret
; 8a868 (22:6868)
.string_8a868
db "めいし", $1f, "かきかえ まし", $22, "@"
.asm_8a875
ld de, String_8a88b
jr .asm_8a87d
.asm_8a87a
ld de, String_8911c
.asm_8a87d
hlcoord 1, 13
call PlaceString
call WaitBGMap
call Functiona36
and a
ret
; 8a88b (22:688b)
String_8a88b: ; 8a88b
db "おともだち", $25, "なまえが"
next "かかれて いません!@"
; 8a8a1
Function8a8a1: ; 8a8a1 (22:68a1)
call Function89160
call Function8a765
call CloseSRAM
jr nc, .asm_8a8bf
call Function89a23
hlcoord 1, 13
ld de, String_89135
call PlaceString
ld a, $2
call Function89254
jr c, .asm_8a8c1
.asm_8a8bf
scf
ret
.asm_8a8c1
and a
ret
Function8a8c3: ; 8a8c3 (22:68c3)
call Function891de
call WhiteBGMap
call Function893cc
call Function89160
call Function8931b
call Function89844
call Function8939a
call Function89856
call CloseSRAM
call Function891ab
hlcoord 1, 13
ld de, String_8a919
call PlaceString
ld a, $2
call Function89254
jr c, .asm_8a90f
call Function89160
call Function892b4
call CloseSRAM
call Function89a23
call Function8923c
hlcoord 1, 13
ld de, String_8a926
call PlaceString
call WaitBGMap
call Functiona36
.asm_8a90f
call Function89448
call Function891fe
call Function8b677
ret
; 8a919 (22:6919)
String_8a919: ; 8a919
db "このデータ", $1f, "けしますか?@"
; 8a926
String_8a926: ; 8a926
db "データ", $1f, "けしまし", $22, "@"
; 8a930
Function8a930: ; 8a930 (22:6930)
ld a, [MenuSelection] ; $cf74
push af
xor a
ld [$d032], a
ld a, $1
ld [$d033], a
ld a, [$d034]
ld [$d0e3], a
.asm_8a943
call Function8b7bd
ld a, [$cf73]
and $1
jr nz, .asm_8a953
ld a, c
and a
jr nz, .asm_8a943
pop af
ret
.asm_8a953
call Function89160
pop af
cp c
jr z, .asm_8a995
push bc
ld [MenuSelection], a ; $cf74
call Function8931b
push bc
ld h, b
ld l, c
ld de, DefaultFlypoint ; $d002
ld bc, $25
call CopyBytes
pop de
pop bc
ld a, c
ld [MenuSelection], a ; $cf74
call Function8931b
push bc
ld h, b
ld l, c
ld bc, $25
call CopyBytes
pop de
ld hl, DefaultFlypoint ; $d002
ld bc, $25
call CopyBytes
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
ld de, SFX_SWITCH_POKEMON
call WaitPlaySFX
.asm_8a995
call CloseSRAM
ret
Function8a999: ; 8a999 (22:6999)
ld hl, MenuDataHeader_0x8a9c9
call LoadMenuDataHeader
ld c, $1
.asm_8a9a1
call Function8a9ce
jr c, .asm_8a9bb
push bc
push de
call Function1d6e
pop de
dec e
ld a, e
ld hl, Jumptable_8a9c5
rst JumpTable
call Function891fe
call Function89b28
pop bc
jr .asm_8a9a1
.asm_8a9bb
call Function89209
call Function1c17
call Function8920f
ret
Jumptable_8a9c5: ; 8a9c5 (22:69c5)
dw Function8aa0a
dw Function8ab3b
; 8a9c9 (22:69c9)
MenuDataHeader_0x8a9c9: ; 0x8a9c9
db $40 ; flags
db 04, 11 ; start coords
db 11, 18 ; end coords
; 8a9ce
Function8a9ce: ; 8a9ce (22:69ce)
push bc
decoord 11, 4
ld b, $6
ld c, $6
call Function89b3b
pop bc
ld a, c
ld hl, MenuDataHeader_0x8a9f2
call Function89d5e
ld hl, Function8aa09
call Function89d85
jr c, .asm_8a9ed
ld c, a
ld e, a
and a
ret
.asm_8a9ed
ld c, a
ld e, $0
scf
ret
; 8a9f2 (22:69f2)
MenuDataHeader_0x8a9f2: ; 0x8a9f2
db $40 ; flags
db 04, 11 ; start coords
db 11, 18 ; end coords
dw MenuData2_0x8a9fa
db 1 ; default option
; 0x8a9fa
MenuData2_0x8a9fa: ; 0x8a9fa
db $a0 ; flags
db 3 ; items
db "へんしゅう@"
db "みる@"
db "やめる@"
; 0x8aa09
Function8aa09: ; 8aa09
ret
; 8aa0a
Function8aa0a: ; 8aa0a (22:6a0a)
ld a, $1
ld [$d02f], a
ld [$d011], a
xor a
ld [$d010], a
ld [$d012], a
call Function89160
ld hl, $a603
ld de, $d008
call Function89381
call CloseSRAM
call Function891fe
call WhiteBGMap
call Function893cc
call Function89807
call Function89492
call Function894ca
.asm_8aa3a
call Function8987f
call Function89a2e
call Function891ab
.asm_8aa43
call Function89b97
call Function89c67
jr c, .asm_8aa61
ld a, b
and a
jr z, .asm_8aa43
call PlayClickSFX
call Function89448
ld a, [$d011]
dec a
ld hl, Jumptable_8aa6d
rst JumpTable
jr nc, .asm_8aa3a
jr .asm_8aa69
.asm_8aa61
call Function89448
call Function8ab11
jr nc, .asm_8aa3a
.asm_8aa69
call Function89448
ret
Jumptable_8aa6d: ; 8aa6d (22:6a6d)
dw Function8aa73
dw Function8aab6
dw Function8ab11
Function8aa73: ; 8aa73 (22:6a73)
ld a, [MenuSelection] ; $cf74
ld e, a
push de
call Function891de
ld de, $d008
ld c, $0
callba Function17a68f
jr c, .asm_8aa9d
ld hl, $d008
ld a, $ff
ld bc, $8
call ByteFill
ld h, d
ld l, e
ld de, $d008
ld c, $8
call Function89193
.asm_8aa9d
call Function891fe
call WhiteBGMap
call Function893cc
call Function89807
call Function89492
call Function894ca
pop de
ld a, e
ld [MenuSelection], a ; $cf74
and a
ret
Function8aab6: ; 8aab6 (22:6ab6)
call Function89a23
ld hl, $d008
call Function89b45
jr nc, Function8ab00
call Function89160
ld de, $d008
ld hl, $a603
ld c, $8
call Function89185
jr z, .asm_8aaeb
ld hl, $d008
ld de, $a603
ld c, $8
call Function89193
hlcoord 1, 13
ld de, String_8aaf0
call PlaceString
call WaitBGMap
call Functiona36
.asm_8aaeb
call CloseSRAM
scf
ret
; 8aaf0 (22:6af0)
String_8aaf0: ; 8aaf0
db "あたらしい めいし", $4a, "できまし", $22, "@"
; 8ab00
Function8ab00: ; 8ab00
ld de, String_8911c
hlcoord 1, 13
call PlaceString
call WaitBGMap
call Function89235
and a
ret
Function8ab11: ; 8ab11 (22:6b11)
call Function89160
ld hl, $a603
ld de, $d008
ld c, $8
call Function89185
call CloseSRAM
jr z, .asm_8ab37
call Function89a23
hlcoord 1, 13
ld de, String_89135
call PlaceString
ld a, $2
call Function89254
jr c, .asm_8ab39
.asm_8ab37
scf
ret
.asm_8ab39
and a
ret
Function8ab3b: ; 8ab3b (22:6b3b)
call Function891fe
call WhiteBGMap
call Function893cc
call Function89807
call Function89492
call Function894ca
call Function89160
ld hl, $a603
ld de, $d008
call Function89381
call CloseSRAM
call Function8987f
call Function89160
hlcoord 1, 13
ld bc, $a007
call Function89a0c
call CloseSRAM
call Function891ab
call Function8ab77
jr c, Function8ab3b
ret
Function8ab77: ; 8ab77 (22:6b77)
call Function354b
bit 0, c
jr nz, .asm_8ab8e
bit 1, c
jr nz, .asm_8ab8e
bit 3, c
jr z, Function8ab77
call PlayClickSFX
call Function89d0d
scf
ret
.asm_8ab8e
call PlayClickSFX
and a
ret
Function8ab93: ; 8ab93 (22:6b93)
call WhiteBGMap
call Function1d6e
callba Function105688
call ClearSprites
call Function891fe
call Function89b28
ret
; 8aba9 (22:6ba9)
Function8aba9: ; 8aba9
ld a, $2
call Function8b94a
ld a, $1
ld [$d032], a
.asm_8abb3
call Function891fe
call Function8b677
.asm_8abb9
call Function8b7bd
jr z, .asm_8abdf
ld a, c
ld [MenuSelection], a
call Function89160
call Function8931b
ld hl, $0011
add hl, bc
call Function89b45
call CloseSRAM
jr c, .asm_8abe2
ld de, SFX_WRONG
call WaitPlaySFX
call CloseSRAM
jr .asm_8abb9
.asm_8abdf
xor a
ld c, a
ret
.asm_8abe2
call PlayClickSFX
.asm_8abe5
call Function891de
call WhiteBGMap
call Function893cc
call Function89160
call Function8931b
call Function89844
call CloseSRAM
call Function89160
call Function8939a
call Function89856
hlcoord 1, 13
call Function899fe
call CloseSRAM
call Function891ab
.asm_8ac0f
call Function89a57
jr c, .asm_8ac0f
and a
jr z, .asm_8abe5
cp $2
jr z, .asm_8ac0f
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
hlcoord 1, 14
ld de, String_8ac3b
call PlaceString
ld a, $1
call Function8925e
jp c, .asm_8abb3
ld a, [MenuSelection]
ld c, a
ret
; 8ac3b
String_8ac3b: ; 8ac3b
db "こ", $25, "ともだち", $1d, "でんわを"
next "かけますか?@"
; 8ac4e
Function8ac4e: ; 8ac4e
xor a
ld [MenuSelection], a
push de
call Function891de
call WhiteBGMap
call Function893cc
pop bc
call Function89844
call Function8939a
call Function89856
hlcoord 1, 13
call Function899fe
call Function891ab
ret
; 8ac70
Function8ac70: ; 8ac70
push de
ld a, $3
call Function8b94a
Function8ac76: ; 8ac76
call Function891fe
call Function8b677
Function8ac7c: ; 8ac7c
call Function8b7bd
jr z, .asm_8acf0
ld a, c
ld [$d02f], a
ld [MenuSelection], a
call Function89160
call Function8931b
call Function8932d
call CloseSRAM
jr nc, .asm_8acb0
call Function89160
ld hl, $0011
add hl, bc
call Function89b45
call CloseSRAM
jr nc, .asm_8accc
call Function89160
call Function892b7
call CloseSRAM
jr .asm_8accc
.asm_8acb0
call Function8ad0b
jr c, Function8ac76
and a
jr nz, .asm_8accc
call Function89160
ld h, b
ld l, c
ld d, $0
ld e, $6
add hl, de
ld d, h
ld e, l
pop hl
ld c, $1f
call Function89193
jr .asm_8ace4
.asm_8accc
pop hl
call Function89160
ld d, b
ld e, c
ld c, $6
call Function89193
ld a, $6
add e
ld e, a
ld a, $0
adc d
ld d, a
ld c, $1f
call Function89193
.asm_8ace4
call CloseSRAM
call Functione51
ld a, [$d02f]
ld c, a
and a
ret
.asm_8acf0
ld hl, UnknownText_0x8ad06
call PrintText
ld a, $2
call Function89259
jp c, Function8ac7c
call Functione51
pop de
ld c, $0
scf
ret
; 8ad06
UnknownText_0x8ad06: ; 0x8ad06
; Finish registering CARDS?
text_jump UnknownText_0x1c554a
db "@"
; 0x8ad0b
Function8ad0b: ; 8ad0b
.asm_8ad0b
ld a, [MenuSelection]
ld [$d02f], a
call Function891de
call WhiteBGMap
call Function893cc
call Function89160
call Function8931b
push bc
call Function89844
call Function8939a
call Function89856
hlcoord 1, 13
call Function899fe
call CloseSRAM
call Function891ab
pop bc
.asm_8ad37
push bc
call Function89a57
pop bc
jr c, .asm_8ad37
and a
jr z, .asm_8ad0b
cp $2
jr z, .asm_8ad37
call Function8923c
push bc
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
ld de, String_8ad89
hlcoord 1, 14
call PlaceString
ld a, $2
call Function8925e
jr c, .asm_8ad87
call Function8923c
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
ld de, String_8ad9c
hlcoord 1, 14
call PlaceString
ld a, $1
call Function8925e
jr c, .asm_8ad84
ld a, $0
jr .asm_8ad86
.asm_8ad84
ld a, $1
.asm_8ad86
and a
.asm_8ad87
pop bc
ret
; 8ad89
String_8ad89: ; 8ad89
db "こ", $25, "めいし", $1f, "けして"
next "いれかえますか?@"
; 8ad9c
String_8ad9c: ; 8ad9c
db "おともだち", $25, "なまえを"
next "のこして おきますか?@"
; 8adb3
Function8adb3: ; 8adb3
call Function891de
call Function8a262
push af
call Function891de
pop af
ret
; 8adbf
Function8adbf: ; 8adbf
call Function89160
ld hl, $a603
call Function89b45
call CloseSRAM
ret
; 8adcc
Function8adcc: ; 8adcc
call Function89160
call Function8b3b0
call CloseSRAM
ret nc
cp $2
ret z
scf
ret
; 8addb
SpecialHoOhChamber: ; 0x8addb
ld hl, PartySpecies
ld a, [hl]
cp HO_OH ; is Ho-oh the first Pokémon in the party?
jr nz, .done ; if not, we're done
call GetSecondaryMapHeaderPointer
ld de, $0326
ld b, SET_FLAG
call EventFlagAction
.done
ret
; 0x8adef
Function8adef: ; 8adef
call GetSecondaryMapHeaderPointer
ld de, $0328
ld b, CHECK_FLAG
call EventFlagAction
ld a, c
and a
jr nz, .asm_8ae2f
ld a, WATER_STONE
ld [CurItem], a
ld hl, NumItems
call CheckItem
jr c, .asm_8ae24
ld a, [PartyCount]
ld b, a
inc b
.asm_8ae10
dec b
jr z, .asm_8ae2f
ld a, b
dec a
ld [CurPartyMon], a
push bc
ld a, $1
call GetPartyParamLocation
pop bc
ld a, [hl]
cp WATER_STONE
jr nz, .asm_8ae10
.asm_8ae24
call GetSecondaryMapHeaderPointer
ld de, $0328
ld b, SET_FLAG
call EventFlagAction
.asm_8ae2f
ret
; 8ae30
Function8ae30: ; 8ae30
push de
push bc
call GetSecondaryMapHeaderPointer
ld a, h
cp RuinsofAlphAerodactylChamber_SecondMapHeader / $100
jr nz, .asm_8ae4a
ld a, l
cp RuinsofAlphAerodactylChamber_SecondMapHeader % $100
jr nz, .asm_8ae4a
ld de, $0329
ld b, SET_FLAG
call EventFlagAction
scf
jr .done
.asm_8ae4a
and a
.done
pop bc
pop de
ret
; 8ae4e
Function8ae4e: ; 8ae4e
push hl
push de
call GetSecondaryMapHeaderPointer
ld a, h
cp RuinsofAlphKabutoChamber_SecondMapHeader / $100
jr nz, .done
ld a, l
cp RuinsofAlphKabutoChamber_SecondMapHeader % $100
jr nz, .done
ld de, $0327
ld b, SET_FLAG
call EventFlagAction
.done
pop de
pop hl
ret
; 8ae68
Function8ae68: ; 8ae68
ld a, [ScriptVar]
ld hl, MenuDataHeader_0x8aed5
and a
jr z, .asm_8ae79
ld d, $0
ld e, $5
.asm_8ae75
add hl, de
dec a
jr nz, .asm_8ae75
.asm_8ae79
call LoadMenuDataHeader
xor a
ld [hBGMapMode], a
call Function1cbb
call Function1ad2
call Function321c
call Function1cfd
inc hl
ld d, $0
ld e, $14
add hl, de
add hl, de
ld a, [ScriptVar]
ld c, a
ld de, Unknown_8aebc
and a
jr z, .asm_8aea5
.asm_8ae9c
ld a, [de]
inc de
cp $ff
jr nz, .asm_8ae9c
dec c
jr nz, .asm_8ae9c
.asm_8aea5
call Function8af09
ld bc, AttrMap - TileMap
add hl, bc
call Function8aee9
call Function3200
call Functiona36
call PlayClickSFX
call Function1c17
ret
; 8aebc
Unknown_8aebc: ; 8aebc
db $08, $44, $04, $00, $2e, $08, $ff
db $26, $20, $0c, $0e, $46, $ff
db $4c, $00, $46, $08, $42, $ff
db $0e, $2c, $64, $2c, $0e, $ff
; 8aed5
MenuDataHeader_0x8aed5: ; 0x8aed5
db $40 ; flags
db 04, 03 ; start coords
db 09, 16 ; end coords
MenuDataHeader_0x8aeda: ; 0x8aeda
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
MenuDataHeader_0x8aedf: ; 0x8aedf
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
MenuDataHeader_0x8aee4: ; 0x8aee4
db $40 ; flags
db 04, 04 ; start coords
db 09, 15 ; end coords
; 8aee9
Function8aee9: ; 8aee9
.asm_8aee9
ld a, [de]
cp $ff
ret z
cp $60
ld a, $d
jr c, .asm_8aef5
ld a, $5
.asm_8aef5
call Function8aefd
inc hl
inc hl
inc de
jr .asm_8aee9
; 8aefd
Function8aefd: ; 8aefd
push hl
ld [hli], a
ld [hld], a
ld b, $0
ld c, $14
add hl, bc
ld [hli], a
ld [hl], a
pop hl
ret
; 8af09
Function8af09: ; 8af09
push hl
push de
.asm_8af0b
ld a, [de]
cp $ff
jr z, .asm_8af19
ld c, a
call Function8af1c
inc hl
inc hl
inc de
jr .asm_8af0b
.asm_8af19
pop de
pop hl
ret
; 8af1c
Function8af1c: ; 8af1c
push hl
ld a, c
cp $60
jr z, .asm_8af3b
cp $62
jr z, .asm_8af4b
cp $64
jr z, .asm_8af5b
ld [hli], a
inc a
ld [hld], a
dec a
ld b, $0
ld c, $14
add hl, bc
ld c, $10
add c
ld [hli], a
inc a
ld [hl], a
pop hl
ret
.asm_8af3b
ld [hl], $5b
inc hl
ld [hl], $5c
ld bc, $0013
add hl, bc
ld [hl], $4d
inc hl
ld [hl], $5d
pop hl
ret
.asm_8af4b
ld [hl], $4e
inc hl
ld [hl], $4f
ld bc, $0013
add hl, bc
ld [hl], $5e
inc hl
ld [hl], $5f
pop hl
ret
.asm_8af5b
ld [hl], $2
inc hl
ld [hl], $3
ld bc, $0013
add hl, bc
ld [hl], $3
inc hl
ld [hl], $2
pop hl
ret
; 8af6b
SpecialBuenasPassword: ; 8af6b
xor a
ld [$cf76], a
ld hl, MenuDataHeader_0x8afa9
call Function1d3c
ld a, [$dc4a]
ld c, a
callba Functionb8f8f
ld a, [$cf83]
add c
add $2
ld [$cf85], a
call Function1c00
call Function1e5d
callba Function4ae5e
ld b, $0
ld a, [MenuSelection]
ld c, a
ld a, [$dc4a]
and $3
cp c
jr nz, .asm_8afa4
ld b, $1
.asm_8afa4
ld a, b
ld [ScriptVar], a
ret
; 8afa9
MenuDataHeader_0x8afa9: ; 0x8afa9
db $40 ; flags
db 00, 00 ; start coords
db 07, 10 ; end coords
dw MenuData2_0x8afb2
db 1 ; default option
; 0x8afb1
db 0
MenuData2_0x8afb2: ; 0x8afb2
db $81 ; flags
db 0 ; items
dw Unknown_8afb8
dw Function8afbd
; 0x8afb4
Unknown_8afb8: ; 8afb8
db 3
db 0, 1, 2, $ff
Function8afbd: ; 8afbd
push de
ld a, [$dc4a]
and $f0
ld c, a
ld a, [MenuSelection]
add c
ld c, a
callba Functionb8f8f
pop hl
call PlaceString
ret
; 8afd4
SpecialBuenaPrize: ; 8afd4
xor a
ld [$d0e4], a
ld a, $1
ld [MenuSelection], a
call Function8b0d6
call Function8b090
ld hl, UnknownText_0x8b072
call PrintText
jr .asm_8aff1
.asm_8afeb
ld hl, UnknownText_0x8b072
call Function105a
.asm_8aff1
call DelayFrame
call Function1ad2
call Function8b097
call Function8b0e2
jr z, .asm_8b05f
ld [$cf75], a
call GetBuenaPrize
ld a, [hl]
ld [$d265], a
call GetItemName
ld hl, UnknownText_0x8b077
call Function105a
call YesNoBox
jr c, .asm_8afeb
ld a, [$cf75]
call GetBuenaPrize
inc hl
ld a, [hld]
ld c, a
ld a, [$dc4b]
cp c
jr c, .asm_8b047
ld a, [hli]
push hl
ld [CurItem], a
ld a, $1
ld [$d10c], a
ld hl, NumItems
call ReceiveItem
pop hl
jr nc, .asm_8b04c
ld a, [hl]
ld c, a
ld a, [$dc4b]
sub c
ld [$dc4b], a
call Function8b097
jr .asm_8b051
.asm_8b047
ld hl, UnknownText_0x8b081
jr .asm_8b05a
.asm_8b04c
ld hl, UnknownText_0x8b086
jr .asm_8b05a
.asm_8b051
ld de, SFX_TRANSACTION
call PlaySFX
ld hl, UnknownText_0x8b07c
.asm_8b05a
call Function105a
jr .asm_8afeb
.asm_8b05f
call Function1c17
call Function1c17
ld hl, UnknownText_0x8b08b
call PrintText
call Functiona36
call PlayClickSFX
ret
; 8b072
UnknownText_0x8b072: ; 0x8b072
; Which prize would you like?
text_jump UnknownText_0x1c589f
db "@"
; 0x8b077
UnknownText_0x8b077: ; 0x8b077
; ? Is that right?
text_jump UnknownText_0x1c58bc
db "@"
; 0x8b07c
UnknownText_0x8b07c: ; 0x8b07c
; Here you go!
text_jump UnknownText_0x1c58d1
db "@"
; 0x8b081
UnknownText_0x8b081: ; 0x8b081
; You don't have enough points.
text_jump UnknownText_0x1c58e0
db "@"
; 0x8b086
UnknownText_0x8b086: ; 0x8b086
; You have no room for it.
text_jump UnknownText_0x1c58ff
db "@"
; 0x8b08b
UnknownText_0x8b08b: ; 0x8b08b
; Oh. Please come back again!
text_jump UnknownText_0x1c591a
db "@"
; 0x8b090
Function8b090: ; 8b090
ld hl, MenuDataHeader_0x8b0d1
call LoadMenuDataHeader
ret
; 8b097
Function8b097: ; 8b097
ld de, $dc4b
call Function8b09e
ret
; 8b09e
Function8b09e: ; 8b09e
push de
xor a
ld [hBGMapMode], a
ld hl, MenuDataHeader_0x8b0d1
call Function1d3c
call Function1cbb
call Function1ad2
call Function1cfd
ld bc, $0015
add hl, bc
ld de, String_8b0ca
call PlaceString
ld h, b
ld l, c
inc hl
ld a, $7f
ld [hli], a
ld [hld], a
pop de
ld bc, $0102
call PrintNum
ret
; 8b0ca
String_8b0ca:
db "Points@"
; 8b0d1
MenuDataHeader_0x8b0d1: ; 0x8b0d1
db $40 ; flags
db 11, 00 ; start coords
db 13, 11 ; end coords
; 8b0d6
Function8b0d6: ; 8b0d6
ld hl, MenuDataHeader_0x8b0dd
call LoadMenuDataHeader
ret
; 8b0dd
MenuDataHeader_0x8b0dd: ; 0x8b0dd
db $40 ; flags
db 00, 00 ; start coords
db 11, 17 ; end coords
; 8b0e2
Function8b0e2: ; 8b0e2
ld hl, MenuDataHeader_0x8b113
call Function1d3c
ld a, [MenuSelection]
ld [$cf88], a
xor a
ld [$cf76], a
ld [hBGMapMode], a
call Function352f
call Function1ad2
call Function350c
ld a, [MenuSelection]
ld c, a
ld a, [$cfa9]
ld [MenuSelection], a
ld a, [$cf73]
cp $2
jr z, .asm_8b111
ld a, c
and a
ret nz
.asm_8b111
xor a
ret
; 8b113
MenuDataHeader_0x8b113: ; 0x8b113
db $40 ; flags
db 01, 01 ; start coords
db 09, 16 ; end coords
dw MenuData2_0x8b11c
db 1 ; default option
; 0x8b11b
db 0
MenuData2_0x8b11c: ; 0x8b11c
db $10 ; flags
db 4 ; items
db $d, $1
dbw BANK(Unknown_8b129), Unknown_8b129
dbw BANK(BuenaPrizeItem), BuenaPrizeItem
dbw BANK(BuenaPrizePoints), BuenaPrizePoints
; 8b129
Unknown_8b129: ; 8b129
db 9
db 1, 2, 3, 4, 5, 6, 7, 8, 9, $ff
; 8b134
BuenaPrizeItem: ; 8b134
ld a, [MenuSelection]
call GetBuenaPrize
ld a, [hl]
push de
ld [$d265], a
call GetItemName
pop hl
call PlaceString
ret
; 8b147
BuenaPrizePoints: ; 8b147
ld a, [MenuSelection]
call GetBuenaPrize
inc hl
ld a, [hl]
ld c, "0"
add c
ld [de], a
ret
; 8b154
GetBuenaPrize: ; 8b154
dec a
ld hl, BuenaPrizes
ld b, 0
ld c, a
add hl, bc
add hl, bc
ret
; 8b15e
BuenaPrizes: ; 8b15e
db ULTRA_BALL, 2
db FULL_RESTORE, 2
db NUGGET, 3
db RARE_CANDY, 3
db PROTEIN, 5
db IRON, 5
db CARBOS, 5
db CALCIUM, 5
db HP_UP, 5
; 8b170
INCLUDE "event/dratini.asm"
Function8b1e1: ; 8b1e1
ld de, Unknown_8b1ed
call Function8b25b
ret z
call Function8b231
scf
ret
; 8b1ed
Unknown_8b1ed: ; 8b1ed
db 2
dw Unknown_8b1f2
dw Unknown_8b1f6
Unknown_8b1f2: ; 8b1f2
dw Function8b2bb
dw Function8b2c1
; 8b1f6
Unknown_8b1f6: ; 8b1f6
dw UnknownText_0x8b1fc
dw UnknownText_0x8b23d
dw UnknownText_0x8b242
; 8b1fc
UnknownText_0x8b1fc: ; 0x8b1fc
; Excuse me!
text_jump UnknownText_0x1c5937
db "@"
; 0x8b201
Function8b201: ; 8b201
ld hl, StringBuffer2
ld [hl], "3"
inc hl
ld [hl], "@"
ld de, Unknown_8b215
call Function8b25b
ret z
call Function8b231
scf
ret
; 8b215
Unknown_8b215: ; 8b215
db 4
dw Unknown_8b21a
dw Unknown_8b222
Unknown_8b21a: ; 8b21a
dw Function8b2da
dw Function8b2e2
dw Function8b32a
dw Function8b331
; 8b222
Unknown_8b222: ; 8b222
dw UnknownText_0x8b22c
dw UnknownText_0x8b247
dw UnknownText_0x8b24c
dw UnknownText_0x8b251
dw UnknownText_0x8b256
; 8b22c
UnknownText_0x8b22c: ; 0x8b22c
; Excuse me. You're not ready.
text_jump UnknownText_0x1c5944
db "@"
; 0x8b231
Function8b231: ; 8b231
ld hl, UnknownText_0x8b238
call PrintText
ret
; 8b238
UnknownText_0x8b238: ; 0x8b238
; Please return when you're ready.
text_jump UnknownText_0x1c5962
db "@"
; 0x8b23d
UnknownText_0x8b23d: ; 0x8b23d
; You need at least three #MON.
text_jump UnknownText_0x1c5983
db "@"
; 0x8b242
UnknownText_0x8b242: ; 0x8b242
; Sorry, an EGG doesn't qualify.
text_jump UnknownText_0x1c59a3
db "@"
; 0x8b247
UnknownText_0x8b247: ; 0x8b247
; Only three #MON may be entered.
text_jump UnknownText_0x1c59c3
db "@"
; 0x8b24c
UnknownText_0x8b24c: ; 0x8b24c
; The @ #MON must all be different kinds.
text_jump UnknownText_0x1c59e5
db "@"
; 0x8b251
UnknownText_0x8b251: ; 0x8b251
; The @ #MON must not hold the same items.
text_jump UnknownText_0x1c5a13
db "@"
; 0x8b256
UnknownText_0x8b256: ; 0x8b256
; You can't take an EGG!
text_jump UnknownText_0x1c5a42
db "@"
; 0x8b25b
Function8b25b: ; 8b25b
ld bc, $0000
.asm_8b25e
call Function8b26c
call c, Function8b28e
call Function8b276
jr nz, .asm_8b25e
ld a, b
and a
ret
; 8b26c
Function8b26c: ; 8b26c
push de
push bc
call Function8b27a
ld a, c
rst JumpTable
pop bc
pop de
ret
; 8b276
Function8b276: ; 8b276
inc c
ld a, [de]
cp c
ret
; 8b27a
Function8b27a: ; 8b27a
inc de
ld a, [de]
ld l, a
inc de
ld a, [de]
ld h, a
ret
; 8b281
Function8b281: ; 8b281
inc de
inc de
inc de
ld a, [de]
ld l, a
inc de
ld a, [de]
ld h, a
ret
; 8b28a
Function8b28a: ; 8b28a
ld a, [hli]
ld h, [hl]
ld l, a
ret
; 8b28e
Function8b28e: ; 8b28e
push de
push bc
ld a, b
and a
call z, Function8b29d
pop bc
call Function8b2a9
ld b, $1
pop de
ret
; 8b29d
Function8b29d: ; 8b29d
push de
call Function8b281
call Function8b28a
call PrintText
pop de
ret
; 8b2a9
Function8b2a9: ; 8b2a9
push bc
call Function8b281
inc hl
inc hl
ld b, $0
add hl, bc
add hl, bc
call Function8b28a
call PrintText
pop bc
ret
; 8b2bb
Function8b2bb: ; 8b2bb
ld a, [PartyCount]
cp 3
ret
; 8b2c1
Function8b2c1: ; 8b2c1
ld hl, PartyCount
ld a, [hli]
ld b, $0
ld c, a
.asm_8b2c8
ld a, [hli]
cp EGG
jr z, .asm_8b2ce
inc b
.asm_8b2ce
dec c
jr nz, .asm_8b2c8
ld a, [PartyCount]
cp b
ret z
ld a, b
cp 3
ret
; 8b2da
Function8b2da: ; 8b2da
ld a, [PartyCount]
cp 3
ret z
scf
ret
; 8b2e2
Function8b2e2: ; 8b2e2
ld hl, PartyMon1Species
call Function8b2e9
ret
; 8b2e9
Function8b2e9: ; 8b2e9
ld de, PartyCount
ld a, [de]
inc de
dec a
jr z, .asm_8b314
ld b, a
.asm_8b2f2
push hl
push de
ld c, b
call Function8b322
jr z, .asm_8b30c
ld a, [hl]
and a
jr z, .asm_8b30c
.asm_8b2fe
call Function8b31a
call Function8b322
jr z, .asm_8b309
cp [hl]
jr z, .asm_8b316
.asm_8b309
dec c
jr nz, .asm_8b2fe
.asm_8b30c
pop de
pop hl
call Function8b31a
dec b
jr nz, .asm_8b2f2
.asm_8b314
and a
ret
.asm_8b316
pop de
pop hl
scf
ret
; 8b31a
Function8b31a: ; 8b31a
push bc
ld bc, PartyMon2 - PartyMon1
add hl, bc
inc de
pop bc
ret
; 8b322
Function8b322: ; 8b322
push bc
ld b, a
ld a, [de]
cp EGG
ld a, b
pop bc
ret
; 8b32a
Function8b32a: ; 8b32a
ld hl, PartyMon1Item
call Function8b2e9
ret
; 8b331
Function8b331: ; 8b331
ld hl, PartyCount
ld a, [hli]
ld c, a
.asm_8b336
ld a, [hli]
cp EGG
jr z, .asm_8b340
dec c
jr nz, .asm_8b336
and a
ret
.asm_8b340
scf
ret
; 8b342
Function8b342:: ; 8b342
call GetSecondaryMapHeaderPointer
ld d, h
ld e, l
xor a
.asm_8b348
push af
ld hl, Jumptable_8b354
rst JumpTable
pop af
inc a
cp 3
jr nz, .asm_8b348
ret
; 8b354
Jumptable_8b354: ; 8b354
dw Function8b35a
dw Function8b35b
dw Function8b35c
; 8b35a
Function8b35a: ; 8b35a
ret
; 8b35b
Function8b35b: ; 8b35b
ret
; 8b35c
Function8b35c: ; 8b35c
ret
; 8b35d
Function8b35d: ; 8b35d
ld a, h
cp d
ret nz
ld a, l
cp e
ret
; 8b363
Function8b363: ; 8b363
push bc
callba Function10632f
pop bc
ret
; 8b36c
Function8b36c: ; 8b36c (22:736c)
push bc
ld h, b
ld l, c
ld bc, $4
ld a, $ff
call ByteFill
pop bc
ret
Function8b379: ; 8b379 (22:7379)
push bc
ld a, c
add e
ld c, a
ld a, $0
adc b
ld b, a
ld a, [bc]
ld d, a
pop bc
ret
Function8b385: ; 8b385 (22:7385)
push bc
ld a, c
add e
ld c, a
ld a, $0
adc b
ld b, a
ld a, d
ld [bc], a
pop bc
ret
Function8b391: ; 8b391 (22:7391)
push bc
ld e, $0
ld d, $4
.asm_8b396
ld a, [bc]
inc bc
cp $ff
jr z, .asm_8b3a2
inc e
dec d
jr nz, .asm_8b396
dec e
scf
.asm_8b3a2
pop bc
ret
Function8b3a4: ; 8b3a4 (22:73a4)
push de
push bc
ld d, b
ld e, c
ld c, $4
call Function89185
pop bc
pop de
ret
Function8b3b0: ; 8b3b0 (22:73b0)
ld bc, $a037
ld a, [$a60b]
and a
jr z, .asm_8b3c2
cp $3
jr nc, .asm_8b3c2
call Function8b391
jr c, .asm_8b3c9
.asm_8b3c2
call Function8b36c
xor a
ld [$a60b], a
.asm_8b3c9
ld a, [$a60b]
ret
Function8b3cd: ; 8b3cd (22:73cd)
push de
push bc
ld e, $4
.asm_8b3d1
ld a, [bc]
inc bc
call Function8998b
inc hl
dec e
jr nz, .asm_8b3d1
pop bc
pop de
ret
Function8b3dd: ; 8b3dd (22:73dd)
push de
push bc
call Function354b
ld a, c
pop bc
pop de
bit 0, a
jr nz, .asm_8b3f7
bit 1, a
jr nz, .asm_8b40e
bit 6, a
jr nz, .asm_8b429
bit 7, a
jr nz, .asm_8b443
and a
ret
.asm_8b3f7
ld a, e
cp $3
jr z, .asm_8b407
inc e
ld d, $0
call Function8b385
xor a
ld [$d010], a
ret
.asm_8b407
call PlayClickSFX
ld d, $0
scf
ret
.asm_8b40e
ld a, e
and a
jr nz, .asm_8b41e
call PlayClickSFX
ld d, $ff
call Function8b385
ld d, $1
scf
ret
.asm_8b41e
ld d, $ff
call Function8b385
dec e
xor a
ld [$d010], a
ret
.asm_8b429
call Function8b379
ld a, d
cp $a
jr c, .asm_8b433
ld d, $9
.asm_8b433
inc d
ld a, d
cp $a
jr c, .asm_8b43b
ld d, $0
.asm_8b43b
call Function8b385
xor a
ld [$d010], a
ret
.asm_8b443
call Function8b379
ld a, d
cp $a
jr c, .asm_8b44d
ld d, $0
.asm_8b44d
ld a, d
dec d
and a
jr nz, .asm_8b454
ld d, $9
.asm_8b454
call Function8b385
xor a
ld [$d010], a
ret
Function8b45c: ; 8b45c (22:745c)
call Function8b36c
xor a
ld [$d010], a
ld [$d012], a
call Function8b391
ld d, $0
call Function8b385
.asm_8b46e
call Function8923c
call Function8b493
call Function8b4cc
call Function8b518
call Function89b78
push bc
call Function8b4fd
call Function89c44
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
pop bc
call Function8b3dd
jr nc, .asm_8b46e
ld a, d
and a
ret z
scf
ret
Function8b493: ; 8b493 (22:7493)
push bc
call Function8923c
call Function8b521
ld hl, Jumptable_8b4a0
pop bc
rst JumpTable
ret
Jumptable_8b4a0: ; 8b4a0 (22:74a0)
dw Function8b4a4
dw Function8b4b8
Function8b4a4: ; 8b4a4 (22:74a4)
push bc
push de
call Function8b4d8
call TextBox
pop de
pop bc
call Function8b4cc
call Function8b518
call Function8b3cd
ret
Function8b4b8: ; 8b4b8 (22:74b8)
push bc
push de
call Function8b4ea
call Function89b3b
pop de
pop bc
call Function8b4cc
call Function8b518
call Function8b3cd
ret
Function8b4cc: ; 8b4cc (22:74cc)
push bc
ld hl, Unknown_8b529
call Function8b50a
ld a, [hli]
ld h, [hl]
ld l, a
pop bc
ret
Function8b4d8: ; 8b4d8 (22:74d8)
ld hl, Unknown_8b529
call Function8b50a
push hl
inc hl
inc hl
ld a, [hli]
ld b, a
ld a, [hl]
ld c, a
pop hl
ld a, [hli]
ld h, [hl]
ld l, a
ret
Function8b4ea: ; 8b4ea (22:74ea)
ld hl, Unknown_8b529
call Function8b50a
push hl
inc hl
inc hl
ld a, [hli]
ld b, a
ld a, [hl]
ld c, a
pop hl
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
ret
Function8b4fd: ; 8b4fd (22:74fd)
ld hl, Unknown_8b529 + 4
call Function8b50a
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, [hli]
ld d, a
ret
Function8b50a: ; 8b50a (22:750a)
ld a, [$d02e]
and a
ret z
ld b, $0
ld c, $8
.asm_8b513
add hl, bc
dec a
jr nz, .asm_8b513
ret
Function8b518: ; 8b518 (22:7518)
push de
ld d, $0
ld e, $14
add hl, de
inc hl
pop de
ret
Function8b521: ; 8b521 (22:7521)
ld hl, Unknown_8b529 + 7
call Function8b50a
ld a, [hl]
ret
; 8b529 (22:7529)
Unknown_8b529: ; 8b529
dw $c506
db 1, 4, $20, $49, 0, 1
dw $c4f7
db 1, 4, $48, $41, 0, 0
; 8b539
Function8b539: ; 8b539 (22:7539)
ld bc, $d017
call Function8b36c
xor a
ld [$d012], a
ld [$d02e], a
call Function8b493
call Function8b4fd
ld e, $0
call Function89c44
call Function3238
ret
Function8b555: ; 8b555 (22:7555)
ld hl, UnknownText_0x8b5ce
call PrintText
ld bc, $d017
call Function8b45c
jr c, .asm_8b5c8
call Function89448
ld bc, $d017
call Function8b493
ld bc, $d017
call Function8b664
jr nz, .asm_8b57c
ld hl, UnknownText_0x8b5e2
call PrintText
jr Function8b555
.asm_8b57c
ld hl, UnknownText_0x8b5d3
call PrintText
ld bc, $d013
call Function8b45c
jr c, Function8b555
ld bc, $d017
ld hl, $d013
call Function8b3a4
jr z, .asm_8b5a6
call Function89448
ld bc, $d013
call Function8b493
ld hl, UnknownText_0x8b5d8
call PrintText
jr .asm_8b57c
.asm_8b5a6
call Function89160
ld hl, $d013
ld de, $a037
ld bc, $4
call CopyBytes
call CloseSRAM
call Function89448
ld bc, $d013
call Function8b493
ld hl, UnknownText_0x8b5dd
call PrintText
and a
.asm_8b5c8
push af
call Function89448
pop af
ret
; 8b5ce (22:75ce)
UnknownText_0x8b5ce: ; 0x8b5ce
; Please enter any four-digit number.
text_jump UnknownText_0x1bc187
db "@"
; 0x8b5d3
UnknownText_0x8b5d3: ; 0x8b5d3
; Enter the same number to confirm.
text_jump UnknownText_0x1bc1ac
db "@"
; 0x8b5d8
UnknownText_0x8b5d8: ; 0x8b5d8
; That's not the same number.
text_jump UnknownText_0x1bc1cf
db "@"
; 0x8b5dd
UnknownText_0x8b5dd: ; 0x8b5dd
; Your PASSCODE has been set. Enter this number next time to open the CARD FOLDER.
text_jump UnknownText_0x1bc1eb
db "@"
; 0x8b5e2
UnknownText_0x8b5e2: ; 0x8b5e2
; 0000 is invalid!
text_jump UnknownText_0x1bc23e
db "@"
; 0x8b5e7
Function8b5e7: ; 8b5e7 (22:75e7)
ld bc, $d013
call Function8b36c
xor a
ld [$d012], a
ld [$d02e], a
call Function8b493
call Function891ab
call Function8b4fd
ld e, $0
call Function89c44
.asm_8b602
ld hl, UnknownText_0x8b642
call PrintText
ld bc, $d013
call Function8b45c
jr c, .asm_8b63c
call Function89448
ld bc, $d013
call Function8b493
call Function89160
ld hl, $a037
call Function8b3a4
call CloseSRAM
jr z, .asm_8b635
ld hl, UnknownText_0x8b647
call PrintText
ld bc, $d013
call Function8b36c
jr .asm_8b602
.asm_8b635
ld hl, UnknownText_0x8b64c
call PrintText
and a
.asm_8b63c
push af
call Function89448
pop af
ret
; 8b642 (22:7642)
UnknownText_0x8b642: ; 0x8b642
; Enter the CARD FOLDER PASSCODE.
text_jump UnknownText_0x1bc251
db "@"
; 0x8b647
UnknownText_0x8b647: ; 0x8b647
; Incorrect PASSCODE!
text_jump UnknownText_0x1bc272
db "@"
; 0x8b64c
UnknownText_0x8b64c: ; 0x8b64c
; CARD FOLDER open.@ @
text_jump UnknownText_0x1bc288
start_asm
; 0x8b651
Function8b651: ; 8b651
ld de, SFX_TWINKLE
call PlaySFX
call WaitSFX
ld c, $8
call DelayFrames
ld hl, .string_8b663
ret
.string_8b663
db "@"
; 8b664
Function8b664: ; 8b664 (22:7664)
push bc
ld de, $4
.asm_8b668
ld a, [bc]
cp $0
jr nz, .asm_8b66e
inc d
.asm_8b66e
inc bc
dec e
jr nz, .asm_8b668
pop bc
ld a, d
cp $4
ret
Function8b677: ; 8b677
call WhiteBGMap
call DisableLCD
call Function8b690
call Function8b6bb
call Function8b6ed
call EnableLCD
call Function891ab
call Function32f9
ret
; 8b690
Function8b690: ; 8b690
ld hl, $74b9
ld de, VTiles2
ld bc, $0160
ld a, $5e
call FarCopyBytes
ld hl, $7609
ld de, $9610
ld bc, $0010
ld a, $5e
call FarCopyBytes
ld hl, $7619
ld de, $8ee0
ld bc, $0010
ld a, $5e
call FarCopyBytes
ret
; 8b6bb
Function8b6bb: ; 8b6bb
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, Palette_8b6d5
ld de, Unkn1Pals
ld bc, $0018
call CopyBytes
pop af
ld [rSVBK], a
call Function8949c
ret
; 8b6d5
Palette_8b6d5: ; 8b6d5
RGB 31, 31, 31
RGB 31, 21, 00
RGB 14, 07, 03
RGB 00, 00, 00
RGB 31, 31, 31
RGB 31, 21, 00
RGB 22, 09, 17
RGB 00, 00, 00
RGB 31, 31, 31
RGB 31, 21, 00
RGB 06, 24, 08
RGB 00, 00, 00
; 8b6ed
Function8b6ed: ; 8b6ed
ld hl, AttrMap
ld bc, $012c
xor a
call ByteFill
ld hl, $cef1
ld bc, $0050
ld a, $7
call ByteFill
ret
; 8b703
Function8b703: ; 8b703
call Function8923c
push hl
ld a, $c
ld [hli], a
inc a
call Function8b73e
inc a
ld [hl], a
pop hl
push hl
push bc
ld de, $0014
add hl, de
.asm_8b717
push hl
ld a, $f
ld [hli], a
ld a, $7f
call Function8b73e
ld a, $11
ld [hl], a
pop hl
ld de, $0014
add hl, de
dec b
jr nz, .asm_8b717
call Function8b732
pop bc
pop hl
jr Function8b744
; 8b732
Function8b732: ; 8b732
ld a, $12
ld [hli], a
ld a, $13
call Function8b73e
ld a, $14
ld [hl], a
ret
; 8b73e
Function8b73e: ; 8b73e
ld d, c
.asm_8b73f
ld [hli], a
dec d
jr nz, .asm_8b73f
ret
; 8b744
Function8b744: ; 8b744
ld de, AttrMap - TileMap
add hl, de
inc b
inc b
inc c
inc c
xor a
.asm_8b74d
push bc
push hl
.asm_8b74f
ld [hli], a
dec c
jr nz, .asm_8b74f
pop hl
ld de, $0014
add hl, de
pop bc
dec b
jr nz, .asm_8b74d
ret
; 8b75d
Function8b75d: ; 8b75d
call Function8923c
ld hl, TileMap
ld a, $1
ld bc, $0014
call ByteFill
hlcoord 0, 1
ld a, $2
ld [hl], a
hlcoord 9, 1
ld c, $b
call Function8b788
hlcoord 1, 1
ld a, $4
ld e, $8
.asm_8b780
ld [hli], a
inc a
dec e
jr nz, .asm_8b780
jr Function8b79e
; 8b787
Function8b787: ; 8b787
ret
; 8b788
Function8b788: ; 8b788
.asm_8b788
ld a, $2
ld [hli], a
dec c
ret z
ld a, $1
ld [hli], a
dec c
ret z
ld a, $3
ld [hli], a
dec c
ret z
ld a, $1
ld [hli], a
dec c
jr nz, .asm_8b788
ret
; 8b79e
Function8b79e: ; 8b79e
ld hl, $cded
ld a, $1
ld [hli], a
ld hl, $cdf6
ld e, $b
.asm_8b7a9
ld a, $2
ld [hli], a
dec e
ret z
xor a
ld [hli], a
dec e
ret z
ld a, $1
ld [hli], a
dec e
ret z
xor a
ld [hli], a
dec e
jr nz, .asm_8b7a9
ret
; 8b7bd
Function8b7bd: ; 8b7bd
call Function8b855
ld hl, MenuDataHeader_0x8b867
call Function1d3c
ld a, [$d030]
ld [$cf88], a
ld a, [$d031]
ld [$d0e4], a
ld a, [$d032]
and a
jr z, .asm_8b7e0
ld a, [$cf81]
set 3, a
ld [$cf81], a
.asm_8b7e0
ld a, [$d0e3]
and a
jr z, .asm_8b7ea
dec a
ld [$cf77], a
.asm_8b7ea
hlcoord 0, 2
ld b, $b
ld c, $12
call Function8b703
call Function8b75d
call Function1ad2
call Function89209
call Function350c
call Function8920f
ld a, [$cf73]
cp $2
jr z, .asm_8b823
cp $20
jr nz, .asm_8b813
call Function8b832
jr .asm_8b7ea
.asm_8b813
cp $10
jr nz, .asm_8b81c
call Function8b83e
jr .asm_8b7ea
.asm_8b81c
ld a, [MenuSelection]
cp $ff
jr nz, .asm_8b824
.asm_8b823
xor a
.asm_8b824
ld c, a
ld a, [$cfa9]
ld [$d030], a
ld a, [$d0e4]
ld [$d031], a
ret
; 8b832
Function8b832: ; 8b832
ld a, [$d0e4]
ld hl, $cf92
sub [hl]
jr nc, Function8b84b
xor a
jr Function8b84b
; 8b83e
Function8b83e: ; 8b83e
ld a, [$d0e4]
ld hl, $cf92
add [hl]
cp $24
jr c, Function8b84b
ld a, $24
Function8b84b: ; 8b84b
ld [$d0e4], a
ld a, [$cfa9]
ld [$cf88], a
ret
; 8b855
Function8b855: ; 8b855
ld a, $28
ld hl, DefaultFlypoint
ld [hli], a
ld c, $28
xor a
.asm_8b85e
inc a
ld [hli], a
dec c
jr nz, .asm_8b85e
ld a, $ff
ld [hl], a
ret
; 8b867
MenuDataHeader_0x8b867: ; 0x8b867
db $40 ; flags
db 03, 01 ; start coords
db 13, 18 ; end coords
dw MenuData2_0x8b870
db 1 ; default option
; 0x8b86f
db 0
MenuData2_0x8b870: ; 0x8b870
db $3c ; flags
db 5 ; items
db 3, 1
dbw 0, $d002
dbw BANK(Function8b880), Function8b880
dbw BANK(Function8b88c), Function8b88c
dbw BANK(Function8b8c8), Function8b8c8
; 8b880
Function8b880: ; 8b880
ld h, d
ld l, e
ld de, MenuSelection
ld bc, $8102
call PrintNum
ret
; 8b88c
Function8b88c: ; 8b88c
call Function89160
ld h, d
ld l, e
push hl
ld de, String_89116
call Function8931b
call Function8932d
jr c, .asm_8b8a3
ld hl, $0000
add hl, bc
ld d, h
ld e, l
.asm_8b8a3
pop hl
push hl
call PlaceString
pop hl
ld d, $0
ld e, $6
add hl, de
push hl
ld de, String_89116
call Function8931b
call Function8934a
jr c, .asm_8b8c0
ld hl, $0006
add hl, bc
ld d, h
ld e, l
.asm_8b8c0
pop hl
call PlaceString
call CloseSRAM
ret
; 8b8c8
Function8b8c8: ; 8b8c8
hlcoord 0, 14
ld b, $2
ld c, $12
call TextBox
ld a, [$d033]
ld b, 0
ld c, a
ld hl, Unknown_8b903
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld d, h
ld e, l
hlcoord 1, 16
call PlaceString
hlcoord 0, 13
ld a, $f
ld [hl], a
hlcoord 19, 13
ld a, $11
ld [hl], a
ld a, [$d0e4]
cp $24
ret c
hlcoord 0, 13
ld c, $12
call Function8b732
ret
; 8b903
Unknown_8b903: ; 8b903
dw String_8b90b
dw String_8b919
dw String_8b92a
dw String_8b938
String_8b90b: db "めいしを えらんでください@" ; Please select a noun.
String_8b919: db "どの めいしと いれかえますか?@" ; OK to swap with any noun?
String_8b92a: db "あいてを えらんでください@" ; Please select an opponent.
String_8b938: db "いれる ところを えらんでください@" ; Please select a location.
; 8b94a
Function8b94a: ; 8b94a
ld [$d033], a
xor a
ld [$d0e4], a
ld [$d032], a
ld [$d0e3], a
ld [$d031], a
ld a, $1
ld [$d030], a
ret
; 8b960
Function8b960: ; 8b960 (22:7960)
ld hl, MenuDataHeader_0x8b9ac
call LoadMenuDataHeader
call Function8b9e9
jr c, .asm_8b97a
hlcoord 11, 0
ld b, $6
ld c, $7
call Function8b703
ld hl, MenuDataHeader_0x8b9b1
jr .asm_8b987
.asm_8b97a
hlcoord 11, 0
ld b, $a
ld c, $7
call Function8b703
ld hl, MenuDataHeader_0x8b9ca
.asm_8b987
ld a, $1
call Function89d5e
ld hl, Function8b9ab
call Function89d85
call Function1c07
jr c, .asm_8b99c
call Function8b99f
jr nz, .asm_8b99d
.asm_8b99c
xor a
.asm_8b99d
ld c, a
ret
Function8b99f: ; 8b99f (22:799f)
ld hl, DefaultFlypoint ; $d002
dec a
ld c, a
ld b, $0
add hl, bc
ld a, [hl]
cp $ff
ret
; 8b9ab (22:79ab)
Function8b9ab: ; 8b9ab
ret
; 8b9ac
MenuDataHeader_0x8b9ac: ; 0x8b9ac
db $40 ; flags
db 00, 11 ; start coords
db 11, 19 ; end coords
MenuDataHeader_0x8b9b1: ; 0x8b9b1
db $40 ; flags
db 00, 11 ; start coords
db 07, 19 ; end coords
dw MenuData2_0x8b9b9
db 1 ; default option
; 0x8b9b9
MenuData2_0x8b9b9: ; 0x8b9b9
db $a0 ; flags
db 3 ; items
db "へんしゅう@" ; EDIT
db "いれかえ@" ; REPLACE
db "やめる@" ; QUIT
; 0x8b9ca
MenuDataHeader_0x8b9ca: ; 0x8b9ca
db $40 ; flags
db 00, 11 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x8b9d2
db 1 ; default option
; 0x8b9d2
MenuData2_0x8b9d2: ; 0x8b9d2
db $a0 ; flags
db 5 ; items
db "みる@" ; VIEW
db "へんしゅう@" ; EDIT
db "いれかえ@" ; REPLACE
db "けす@" ; ERASE
db "やめる@" ; QUIT
; 0x8b9e9
Function8b9e9: ; 8b9e9 (22:79e9)
call Function89160
call Function8931b
call Function8932d
jr nc, .asm_8b9f6
jr .asm_8b9ff
.asm_8b9f6
ld hl, $11
add hl, bc
call Function89b45
jr c, .asm_8ba08
.asm_8b9ff
call Function892b4
and a
ld de, Unknown_8ba1c
jr .asm_8ba0c
.asm_8ba08
ld de, Unknown_8ba1f
scf
.asm_8ba0c
push af
ld hl, DefaultFlypoint ; $d002
.asm_8ba10
ld a, [de]
inc de
ld [hli], a
cp $ff
jr nz, .asm_8ba10
call CloseSRAM
pop af
ret
; 8ba1c (22:7a1c)
Unknown_8ba1c: ; 8b1ac
db 2, 4, -1
Unknown_8ba1f: ; 8ba1f
db 1, 2, 4, 3, -1
; 8ba24
SECTION "bank23", ROMX, BANK[$23]
Function8c000: ; 8c000
Function8c000_2:
ret
; 8c001
Function8c001:: ; 8c001
call UpdateTime
ld a, [TimeOfDay]
ld [CurTimeOfDay], a
call GetTimePalette
ld [TimeOfDayPal], a
ret
; 8c011
_TimeOfDayPals:: ; 8c011
; return carry if pals are changed
; forced pals?
ld hl, $d846
bit 7, [hl]
jr nz, .dontchange
; do we need to bother updating?
ld a, [TimeOfDay]
ld hl, CurTimeOfDay
cp [hl]
jr z, .dontchange
; if so, the time of day has changed
ld a, [TimeOfDay]
ld [CurTimeOfDay], a
; get palette id
call GetTimePalette
; same palette as before?
ld hl, TimeOfDayPal
cp [hl]
jr z, .dontchange
; update palette id
ld [TimeOfDayPal], a
; save bg palette 8
ld hl, $d038 ; Unkn1Pals + 7 pals
; save wram bank
ld a, [rSVBK]
ld b, a
; wram bank 5
ld a, 5
ld [rSVBK], a
; push palette
ld c, 4 ; NUM_PAL_COLORS
.push
ld d, [hl]
inc hl
ld e, [hl]
inc hl
push de
dec c
jr nz, .push
; restore wram bank
ld a, b
ld [rSVBK], a
; update sgb pals
ld b, $9
call GetSGBLayout
; restore bg palette 8
ld hl, $d03f ; last byte in Unkn1Pals
; save wram bank
ld a, [rSVBK]
ld d, a
; wram bank 5
ld a, 5
ld [rSVBK], a
; pop palette
ld e, 4 ; NUM_PAL_COLORS
.pop
pop bc
ld [hl], c
dec hl
ld [hl], b
dec hl
dec e
jr nz, .pop
; restore wram bank
ld a, d
ld [rSVBK], a
; update palettes
call _UpdateTimePals
call DelayFrame
; successful change
scf
ret
.dontchange
; no change occurred
and a
ret
; 8c070
_UpdateTimePals:: ; 8c070
ld c, $9 ; normal
call GetTimePalFade
call DmgToCgbTimePals
ret
; 8c079
Function8c079:: ; 8c079
ld c, $12
call GetTimePalFade
ld b, $4
call Function8c16d
ret
; 8c084
Function8c084:: ; 8c084
call Function8c0c1
ld c, $9
call GetTimePalFade
ld b, $4
call Function8c15e
ret
; 8c092
Function8c092: ; 8c092
call Function8c0c1
ld c, $9
call GetTimePalFade
ld b, $4
.asm_8c09c
call DmgToCgbTimePals
inc hl
inc hl
inc hl
ld c, $7
call DelayFrames
dec b
jr nz, .asm_8c09c
ret
; 8c0ab
Function8c0ab: ; 8c0ab
ld c, $0
call GetTimePalFade
ld b, $4
call Function8c15e
ret
; 8c0b6
Function8c0b6: ; 8c0b6
ld c, $9
call GetTimePalFade
ld b, $4
call Function8c16d
ret
; 8c0c1
Function8c0c1: ; 8c0c1
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, $d000
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld hl, $d008
ld c, $6
.asm_8c0d4
ld a, e
ld [hli], a
ld a, d
ld [hli], a
inc hl
inc hl
inc hl
inc hl
inc hl
inc hl
dec c
jr nz, .asm_8c0d4
pop af
ld [rSVBK], a
ret
; 8c0e5
Function8c0e5: ; 8c0e5
ld hl, Unknown_8c10f
ld a, [$c2d0]
cp $4
jr z, .asm_8c0fc
and $7
add l
ld l, a
ld a, $0
adc h
ld h, a
ld a, [hl]
ld [$d847], a
ret
.asm_8c0fc
ld a, [StatusFlags] ; $d84c
bit 2, a
jr nz, .asm_8c109
ld a, $ff
ld [$d847], a
ret
.asm_8c109
ld a, $aa
ld [$d847], a
ret
; 8c10f (23:410f)
Unknown_8c10f: ; 8c10f
db $e4 ; 3210
db $55 ; 1111
db $aa ; 2222
db $00 ; 0000
db $ff ; 3333
db $e4 ; 3210
db $e4 ; 3210
db $e4 ; 3210
; 8c117
GetTimePalette: ; 8c117
ld a, [TimeOfDay]
ld e, a
ld d, 0
ld hl, .TimePalettes
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 8c126
.TimePalettes
dw .MorningPalette
dw .DayPalette
dw .NitePalette
dw .DarknessPalette
.MorningPalette
ld a, [$d847]
and %00000011 ; 0
ret
.DayPalette
ld a, [$d847]
and %00001100 ; 1
srl a
srl a
ret
.NitePalette
ld a, [$d847]
and %00110000 ; 2
swap a
ret
.DarknessPalette
ld a, [$d847]
and %11000000 ; 3
rlca
rlca
ret
; 8c14e
DmgToCgbTimePals: ; 8c14e
push hl
push de
ld a, [hli]
call DmgToCgbBGPals
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
call DmgToCgbObjPals
pop de
pop hl
ret
; 8c15e
Function8c15e: ; 8c15e
.asm_8c15e
call DmgToCgbTimePals
inc hl
inc hl
inc hl
ld c, $2
call DelayFrames
dec b
jr nz, .asm_8c15e
ret
; 8c16d
Function8c16d: ; 8c16d
.asm_8c16d
call DmgToCgbTimePals
dec hl
dec hl
dec hl
ld c, $2
call DelayFrames
dec b
jr nz, .asm_8c16d
ret
; 8c17c
GetTimePalFade: ; 8c17c
; check cgb
ld a, [hCGB]
and a
jr nz, .cgb
; else: dmg
; index
ld a, [TimeOfDayPal]
and %11
; get fade table
push bc
ld c, a
ld b, $0
ld hl, .dmgfades
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
pop bc
; get place in fade table
ld b, $0
add hl, bc
ret
.cgb
ld hl, .cgbfade
ld b, $0
add hl, bc
ret
.dmgfades
dw .morn
dw .day
dw .nite
dw .darkness
.morn
db %11111111, %11111111, %11111111
db %11111110, %11111110, %11111110
db %11111001, %11100100, %11100100
db %11100100, %11010000, %11010000
db %10010000, %10000000, %10000000
db %01000000, %01000000, %01000000
db %00000000, %00000000, %00000000
.day
db %11111111, %11111111, %11111111
db %11111110, %11111110, %11111110
db %11111001, %11100100, %11100100
db %11100100, %11010000, %11010000
db %10010000, %10000000, %10000000
db %01000000, %01000000, %01000000
db %00000000, %00000000, %00000000
.nite
db %11111111, %11111111, %11111111
db %11111110, %11111110, %11111110
db %11111001, %11100100, %11100100
db %11101001, %11010000, %11010000
db %10010000, %10000000, %10000000
db %01000000, %01000000, %01000000
db %00000000, %00000000, %00000000
.darkness
db %11111111, %11111111, %11111111
db %11111110, %11111110, %11111111
db %11111110, %11100100, %11111111
db %11111101, %11010000, %11111111
db %11111101, %10000000, %11111111
db %00000000, %01000000, %00000000
db %00000000, %00000000, %00000000
.cgbfade
db %11111111, %11111111, %11111111
db %11111110, %11111110, %11111110
db %11111001, %11111001, %11111001
db %11100100, %11100100, %11100100
db %10010000, %10010000, %10010000
db %01000000, %01000000, %01000000
db %00000000, %00000000, %00000000
; 8c20f
Function8c20f: ; 8c20f
call Function8c26d
ld a, [rBGP]
ld [$cfc7], a
ld a, [rOBP0]
ld [$cfc8], a
ld a, [rOBP1]
ld [$cfc9], a
call DelayFrame
ld hl, $ff9e
ld a, [hl]
push af
ld [hl], $1
.asm_8c22b
ld a, [$cf63]
bit 7, a
jr nz, .asm_8c23a
call Function8c314
call DelayFrame
jr .asm_8c22b
.asm_8c23a
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, Unkn1Pals
ld bc, $0040
xor a
call ByteFill
pop af
ld [rSVBK], a
ld a, $ff
ld [$cfc7], a
call DmgToCgbBGPals
call DelayFrame
xor a
ld [hLCDStatCustom], a
ld [$ffc7], a
ld [$ffc8], a
ld [hSCY], a
ld a, $1
ld [rSVBK], a
pop af
ld [$ff9e], a
call DelayFrame
ret
; 8c26d
Function8c26d: ; 8c26d
ld a, [InLinkBattle]
cp $4
jr z, .asm_8c288
callba Function6454
call Function1ad2
call DelayFrame
call Function8c2a0
call Function8cf4f
jr .asm_8c28b
.asm_8c288
call Function8c2aa
.asm_8c28b
ld a, $90
ld [hWY], a
call DelayFrame
xor a
ld [hBGMapMode], a
ld hl, $cf63
xor a
ld [hli], a
ld [hli], a
ld [hl], a
call Function8c6d8
ret
; 8c2a0
Function8c2a0: ; 8c2a0
call Function8c2aa
ld hl, VBGMap0
call Function8c2cf
ret
; 8c2aa
Function8c2aa: ; 8c2aa
ld de, GFX_8c2f4
ld hl, $8fe0
ld b, BANK(GFX_8c2f4)
ld c, 2
call Request2bpp
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ld de, GFX_8c2f4
ld hl, $8fe0
ld b, BANK(GFX_8c2f4)
ld c, 2
call Request2bpp
pop af
ld [rVBK], a
ret
; 8c2cf
Function8c2cf: ; 8c2cf
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
push hl
ld hl, $d000
ld bc, $28 * $10
.asm_8c2dd
ld [hl], $ff
inc hl
dec bc
ld a, c
or b
jr nz, .asm_8c2dd
pop hl
ld de, $d000
ld b, BANK(Function8c2cf) ; BANK(@)
ld c, $28
call Request2bpp
pop af
ld [rSVBK], a
ret
; 8c2f4
GFX_8c2f4: ; 8c2f4
INCBIN "baserom.gbc",$8c2f4,$8c314 - $8c2f4
Function8c314: ; 8c314
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_8c323
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 8c323
Jumptable_8c323: ; 8c323 (23:4323)
dw Function8c365
dw Function8c5dc
dw Function8c3a1
dw Function8c3ab
dw Function8c3ab
dw Function8c3ab
dw Function8c39c
dw Function8c3e8
dw Function8c408
dw Function8c5dc
dw Function8c3a1
dw Function8c3ab
dw Function8c3ab
dw Function8c3ab
dw Function8c39c
dw Function8c768
dw Function8c5dc
dw Function8c3a1
dw Function8c3ab
dw Function8c3ab
dw Function8c3ab
dw Function8c39c
dw Function8c43d
dw Function8c44f
dw Function8c5dc
dw Function8c3a1
dw Function8c3ab
dw Function8c3ab
dw Function8c3ab
dw Function8c39c
dw Function8c578
dw Function8c58f
dw Function8c393
Function8c365: ; 8c365 (23:4365)
ld de, 0
ld a, [BattleMonLevel] ; $c639
add 3
ld hl, EnemyMonLevel ; $d213
cp [hl]
jr nc, .asm_8c375
set 0, e
.asm_8c375
ld a, [$d19a]
cp $4
jr z, .asm_8c386
cp $5
jr z, .asm_8c386
cp $7
jr z, .asm_8c386
set 1, e
.asm_8c386
ld hl, Unknown_8c38f
add hl, de
ld a, [hl]
ld [$cf63], a
ret
; 8c38f (23:438f)
Unknown_8c38f: ; 8c38f
db 1, 9
db 16, 24
; 8c393
Function8c393: ; 8c393 (23:4393)
call ClearSprites
ld a, $80
ld [$cf63], a
ret
Function8c39c: ; 8c39c (23:439c)
ld hl, $cf63
inc [hl]
ret
Function8c3a1: ; 8c3a1 (23:43a1)
call Function8c39c
xor a
ld [$cf64], a
ld [hBGMapMode], a ; $ff00+$d4
ret
Function8c3ab: ; 8c3ab (23:43ab)
call Function8c3b3
ret nc
call Function8c39c
ret
Function8c3b3: ; 8c3b3 (23:43b3)
ld a, [$d847]
cp $ff
jr z, .asm_8c3d5
ld hl, $cf64
ld a, [hl]
inc [hl]
srl a
ld e, a
ld d, 0
ld hl, Unknown_8c3db
add hl, de
ld a, [hl]
cp $1
jr z, .asm_8c3d5
ld [$cfc7], a
call DmgToCgbBGPals
and a
ret
.asm_8c3d5
xor a
ld [$cf64], a
scf
ret
; 8c3db (23:43db)
Unknown_8c3db: ; 8c3db
db $f9 ; 3321
db $fe ; 3332
db $ff ; 3333
db $fe ; 3332
db $f9 ; 3321
db $e4 ; 3210
db $90 ; 2100
db $40 ; 1000
db $00 ; 0000
db $40 ; 1000
db $90 ; 2100
db $e4 ; 3210
db $01 ; 0001
; 8c3e8
Function8c3e8: ; 8c3e8 (23:43e8)
callba Function5602
ld a, $5
ld [rSVBK], a ; $ff00+$70
call Function8c39c
ld a, $43
ld [hLCDStatCustom], a ; $ff00+$c6
xor a
ld [$FF00+$c7], a
ld a, $90
ld [$FF00+$c8], a
xor a
ld [$cf64], a
ld [$cf65], a
ret
Function8c408: ; 8c408 (23:4408)
ld a, [$cf64]
cp $60
jr nc, .asm_8c413
call Function8c419
ret
.asm_8c413
ld a, $20
ld [$cf63], a
ret
Function8c419: ; 8c419 (23:4419)
ld hl, $cf65
ld a, [hl]
inc [hl]
ld hl, $cf64
ld d, [hl]
add [hl]
ld [hl], a
ld a, $90
ld bc, $d100
ld e, $0
.asm_8c42b
push af
push de
ld a, e
call Function8c6f7
ld [bc], a
inc bc
pop de
ld a, e
add $2
ld e, a
pop af
dec a
jr nz, .asm_8c42b
ret
Function8c43d: ; 8c43d (23:443d)
callba Function5602
ld a, $5
ld [rSVBK], a ; $ff00+$70
call Function8c39c
xor a
ld [$cf64], a
ret
Function8c44f: ; 8c44f (23:444f)
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, [$cf64]
ld e, a
ld d, 0
ld hl, Unknown_8c490
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
ld a, [hli]
cp $ff
jr z, .asm_8c47a
ld [$cf65], a
call Function8c4f5
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
ld hl, $cf64
inc [hl]
ret
.asm_8c47a
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $20
ld [$cf63], a
ret
; 8c490 (23:4490)
Unknown_8c490: ; 8c490
macro_8c490: MACRO
db \1
dw \2
dw TileMap + SCREEN_WIDTH * \4 + \3
ENDM
macro_8c490 0, Unknown_8c538, 1, 6
macro_8c490 0, Unknown_8c53e, 0, 3
macro_8c490 0, Unknown_8c548, 1, 0
macro_8c490 0, Unknown_8c55a, 5, 0
macro_8c490 0, Unknown_8c568, 9, 0
macro_8c490 1, Unknown_8c568, 10, 0
macro_8c490 1, Unknown_8c55a, 14, 0
macro_8c490 1, Unknown_8c548, 18, 0
macro_8c490 1, Unknown_8c53e, 19, 3
macro_8c490 1, Unknown_8c538, 18, 6
macro_8c490 3, Unknown_8c538, 18, 11
macro_8c490 3, Unknown_8c53e, 19, 14
macro_8c490 3, Unknown_8c548, 18, 17
macro_8c490 3, Unknown_8c55a, 14, 17
macro_8c490 3, Unknown_8c568, 10, 17
macro_8c490 2, Unknown_8c568, 9, 17
macro_8c490 2, Unknown_8c55a, 5, 17
macro_8c490 2, Unknown_8c548, 1, 17
macro_8c490 2, Unknown_8c53e, 0, 14
macro_8c490 2, Unknown_8c538, 1, 11
db $ff
; 8c4f5
Function8c4f5: ; 8c4f5 (23:44f5)
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld h, [hl]
ld l, a
.asm_8c4fc
push hl
ld a, [de]
ld c, a
inc de
.asm_8c500
ld [hl], $ff
ld a, [$cf65]
bit 0, a
jr z, .asm_8c50c
inc hl
jr .asm_8c50d
.asm_8c50c
dec hl
.asm_8c50d
dec c
jr nz, .asm_8c500
pop hl
ld a, [$cf65]
bit 1, a
ld bc, $14
jr z, .asm_8c51e
ld bc, $ffec
.asm_8c51e
add hl, bc
ld a, [de]
inc de
cp $ff
ret z
and a
jr z, .asm_8c4fc
ld c, a
.asm_8c528
ld a, [$cf65]
bit 0, a
jr z, .asm_8c532
dec hl
jr .asm_8c533
.asm_8c532
inc hl
.asm_8c533
dec c
jr nz, .asm_8c528
jr .asm_8c4fc
; 8c538 (23:4538)
Unknown_8c538: db 2, 3, 5, 4, 9, $ff
Unknown_8c53e: db 1, 1, 2, 2, 4, 2, 4, 2, 3, $ff
Unknown_8c548: db 2, 1, 3, 1, 4, 1, 4, 1, 4, 1, 3, 1, 2, 1, 1, 1, 1, $ff
Unknown_8c55a: db 4, 1, 4, 0, 3, 1, 3, 0, 2, 1, 2, 0, 1, $ff
Unknown_8c568: db 4, 0, 3, 0, 3, 0, 2, 0, 2, 0, 1, 0, 1, 0, 1, $ff
; 8c578
Function8c578: ; 8c578 (23:4578)
callba Function5602
ld a, $5
ld [rSVBK], a ; $ff00+$70
call Function8c39c
ld a, $10
ld [$cf64], a
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
Function8c58f: ; 8c58f (23:458f)
ld hl, $cf64
ld a, [hl]
and a
jr z, .asm_8c5a2
dec [hl]
ld c, $c
.asm_8c599
push bc
call Function8c5b8
pop bc
dec c
jr nz, .asm_8c599
ret
.asm_8c5a2
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $20
ld [$cf63], a
ret
Function8c5b8: ; 8c5b8 (23:45b8)
call Random
cp $12
jr nc, Function8c5b8
ld b, a
.asm_8c5c0
call Random
cp $14
jr nc, .asm_8c5c0
ld c, a
ld hl, $c48c
ld de, $14
inc b
.asm_8c5cf
add hl, de
dec b
jr nz, .asm_8c5cf
add hl, bc
ld a, [hl]
cp $ff
jr z, Function8c5b8
ld [hl], $ff
ret
Function8c5dc: ; 8c5dc (23:45dc)
ld a, [OtherTrainerClass] ; $d22f
and a
jp z, Function8c673
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld hl, AttrMap ; $cdd9
ld bc, $168
inc b
inc c
jr .asm_8c5f4
.asm_8c5f0
ld a, [hl]
or $7
ld [hli], a
.asm_8c5f4
dec c
jr nz, .asm_8c5f0
dec b
jr nz, .asm_8c5f0
call Function8c6b1
hlcoord 2, 1
ld b, $10
.asm_8c602
push hl
ld c, $2
.asm_8c605
push hl
ld a, [de]
inc de
.asm_8c608
and a
jr z, .asm_8c614
sla a
jr nc, .asm_8c611
ld [hl], $fe
.asm_8c611
inc hl
jr .asm_8c608
.asm_8c614
pop hl
push bc
ld bc, $8
add hl, bc
pop bc
dec c
jr nz, .asm_8c605
pop hl
push bc
ld bc, $14
add hl, bc
pop bc
dec b
jr nz, .asm_8c602
ld a, [hCGB] ; $ff00+$e6
and a
jr nz, .asm_8c639
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
jr Function8c673
.asm_8c639
ld hl, Unknown_8c6a1
ld a, [TimeOfDayPal] ; $d841
and 3
cp 3
jr nz, .asm_8c648
ld hl, Unknown_8c6a9
.asm_8c648
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
call Function8c677
push hl
ld de, $d038
ld bc, $8
call CopyBytes
pop hl
ld de, $d0b8
ld bc, $8
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
ld a, $1
ld [hCGBPalUpdate], a ; $ff00+$e5
call DelayFrame
call Function8cf4f
Function8c673: ; 8c673 (23:4673)
call Function8c39c
ret
Function8c677: ; 8c677 (23:4677)
ld de, $d038
call Function8c698
ld de, $d0b8
call Function8c698
ld de, $d070
call Function8c698
ld de, $d0f0
call Function8c698
ld de, $d078
call Function8c698
ld de, $d0f8
Function8c698: ; 8c698 (23:4698)
push hl
ld bc, $8
call CopyBytes
pop hl
ret
; 8c6a1 (23:46a1)
Unknown_8c6a1: ; 8c6a1
RGB 31, 18, 29
RGB 31, 11, 15
RGB 31, 05, 05
RGB 07, 07, 07
; 8c6a9
Unknown_8c6a9: ; 8c6a9
RGB 31, 18, 29
RGB 31, 05, 05
RGB 31, 05, 05
RGB 31, 05, 05
; 8c6b1
Function8c6b1: ; 8c6b1 (23:46b1)
ld a, [OtherTrainerClass] ; $d22f
ld de, Unknown_8c6b8
ret
; 8c6b8 (23:46b8)
Unknown_8c6b8: ; 8c6b8
db $03, $c0, $0f, $f0, $3c, $3c, $30, $0c
db $60, $06, $63, $c6, $c6, $63, $fc, $3f
db $fc, $3f, $c6, $63, $63, $c6, $60, $06
db $30, $0c, $3c, $3c, $0f, $f0, $03, $c0
; 8c6d8
Function8c6d8: ; 8c6d8
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, LYOverrides
call Function8c6ef
ld hl, $d200
call Function8c6ef
pop af
ld [rSVBK], a
ret
; 8c6ef
Function8c6ef: ; 8c6ef
xor a
ld c, $90
.asm_8c6f2
ld [hli], a
dec c
jr nz, .asm_8c6f2
ret
; 8c6f7
Function8c6f7: ; 8c6f7 (23:46f7)
and $3f
cp $20
jr nc, .asm_8c702
call Function8c70c
ld a, h
ret
.asm_8c702
and $1f
call Function8c70c
ld a, h
xor $ff
inc a
ret
Function8c70c: ; 8c70c (23:470c)
ld e, a
ld a, d
ld d, 0
ld hl, Unknown_8c728
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, 0
.asm_8c71b
srl a
jr nc, .asm_8c720
add hl, de
.asm_8c720
sla e
rl d
and a
jr nz, .asm_8c71b
ret
; 8c728 (23:4728)
Unknown_8c728: ; 8c728
sine_wave $100
; 8c768
Function8c768: ; 8c768 (23:4768)
callba Function5602
ld de, Unknown_8c792
.asm_8c771
ld a, [de]
cp $ff
jr z, .asm_8c78c
inc de
ld c, a
ld a, [de]
inc de
ld b, a
ld a, [de]
inc de
ld l, a
ld a, [de]
inc de
ld h, a
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function8c7b7
call WaitBGMap
jr .asm_8c771
.asm_8c78c
ld a, $20
ld [$cf63], a
ret
; 8c792 (23:4792)
Unknown_8c792: ; 8c792
dbbw 4, 2, $c548 ; (8, 8)
dbbw 6, 4, $c533 ; (7, 7)
dbbw 8, 6, $c51e ; (6, 6)
dbbw 10, 8, $c509 ; (5, 5)
dbbw 12, 10, $c4f4 ; (4, 4)
dbbw 14, 12, $c4df ; (3, 3)
dbbw 16, 14, $c4ca ; (2, 2)
dbbw 18, 16, $c4b5 ; (1, 1)
dbbw 20, 18, $c4a0 ; (0, 0)
db $ff
; 8c7b7
Function8c7b7: ; 8c7b7 (23:47b7)
ld a, $ff
.asm_8c7b9
push bc
push hl
.asm_8c7bb
ld [hli], a
dec c
jr nz, .asm_8c7bb
pop hl
ld bc, $14
add hl, bc
pop bc
dec b
jr nz, .asm_8c7b9
ret
; 8c7c9 (23:47c9)
Function8c7c9: ; 8c7c9
ld a, $1
ld [hBGMapMode], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ret
; 8c7d4
Function8c7d4: ; 8c7d4
call WaitSFX
ld de, SFX_SURF
call PlaySFX
call WaitSFX
ret
; 8c7e1
Function8c7e1: ; 8c7e1
callba Function8c084
ld hl, StatusFlags
set 2, [hl]
callba Function8c0e5
callba Function8c001
ld b, $9
call GetSGBLayout
callba Function49409
callba Function8c079
ret
; 8c80a
ShakeHeadbuttTree: ; 8c80a
callba Function8cf53
ld de, GFX_8c9cc
ld hl, VTiles1
lb bc, BANK(GFX_8c9cc), 4
call Request2bpp
ld de, HeadbuttTreeGFX
ld hl, $8840
lb bc, BANK(HeadbuttTreeGFX), 8
call Request2bpp
call Function8cad3
ld a, $1b
call Function3b2a
ld hl, $0003
add hl, bc
ld [hl], $84
ld a, $90
ld [$c3b5], a
callba Function8cf7a
call Function8c913
ld a, $20
ld [$cf64], a
call WaitSFX
ld de, SFX_SANDSTORM
call PlaySFX
.asm_8c852
ld hl, $cf64
ld a, [hl]
and a
jr z, .asm_8c86a
dec [hl]
ld a, $90
ld [$c3b5], a
callba Function8cf7a
call DelayFrame
jr .asm_8c852
.asm_8c86a
call Function2173
call WaitBGMap
xor a
ld [hBGMapMode], a
callba Function8cf53
ld hl, $c490
ld bc, $0010
xor a
call ByteFill
ld de, Font
ld hl, VTiles1
lb bc, BANK(Font), $c
call Get1bpp
call Functione4a
ret
; 8c893
HeadbuttTreeGFX: ; 8c893
INCBIN "baserom.gbc", $8c893, $8c913 - $8c893
; 8c913
Function8c913: ; 8c913
xor a
ld [hBGMapMode], a
ld a, [PlayerDirection]
and $c
srl a
ld e, a
ld d, 0
ld hl, Unknown_8c938
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld a, $5
ld [hli], a
ld [hld], a
ld bc, $0014
add hl, bc
ld [hli], a
ld [hld], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ret
; 8c938
Unknown_8c938: ; 8c938
dw TileMap + 8 + 10 * SCREEN_WIDTH
dw TileMap + 8 + 6 * SCREEN_WIDTH
dw TileMap + 6 + 8 * SCREEN_WIDTH
dw TileMap + 10 + 8 * SCREEN_WIDTH
; 8c940
Function8c940: ; 8c940
ld a, e
and $1
ld [$cf63], a
call Function8c96d
call WaitSFX
ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
call PlaySFX
.asm_8c952
ld a, [$cf63]
bit 7, a
jr nz, .asm_8c96c
ld a, $90
ld [$c3b5], a
callab Function8cf7a
call Function8ca0c
call DelayFrame
jr .asm_8c952
.asm_8c96c
ret
; 8c96d
Function8c96d: ; 8c96d
callab Function8cf53
ld de, GFX_8c9cc
ld hl, VTiles1
lb bc, BANK(GFX_8c9cc), 4
call Request2bpp
ld de, CutTreeGFX
ld hl, VTiles1 + $40
lb bc, BANK(CutTreeGFX), 4
call Request2bpp
ret
; 8c98c
CutTreeGFX: ; c898c
INCBIN "baserom.gbc", $8c98c, $8c9cc - $8c98c
; c89cc
GFX_8c9cc: ; 8c9cc
INCBIN "baserom.gbc", $8c9cc, $8ca0c - $8c9cc
; 8ca0c
Function8ca0c: ; 8ca0c
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_8ca1b
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 8ca1b
Jumptable_8ca1b: ; 8ca1b (23:4a1b)
dw Function8ca23
dw Function8ca3c
dw Function8ca5c
dw Function8ca64
Function8ca23: ; 8ca23 (23:4a23)
call Function8cad3
ld a, $17
call Function3b2a
ld hl, $3
add hl, bc
ld [hl], $84
ld a, $20
ld [$cf64], a
ld hl, $cf63
inc [hl]
inc [hl]
ret
Function8ca3c: ; 8ca3c (23:4a3c)
call Function8ca8e
xor a
call Function8ca73
ld a, $10
call Function8ca73
ld a, $20
call Function8ca73
ld a, $30
call Function8ca73
ld a, $20
ld [$cf64], a
ld hl, $cf63
inc [hl]
ret
Function8ca5c: ; 8ca5c (23:4a5c)
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ld hl, $cf63
inc [hl]
Function8ca64: ; 8ca64 (23:4a64)
ld hl, $cf64
ld a, [hl]
and a
jr z, .asm_8ca6d
dec [hl]
ret
.asm_8ca6d
ld hl, $cf63
set 7, [hl]
ret
Function8ca73: ; 8ca73 (23:4a73)
push de
push af
ld a, $16
call Function3b2a
ld hl, $3
add hl, bc
ld [hl], $80
ld hl, $e
add hl, bc
ld [hl], $4
pop af
ld hl, $c
add hl, bc
ld [hl], a
pop de
ret
Function8ca8e: ; 8ca8e (23:4a8e)
ld de, $0
ld a, [$d197]
bit 0, a
jr z, .asm_8ca9a
set 0, e
.asm_8ca9a
ld a, [$d196]
bit 0, a
jr z, .asm_8caa3
set 1, e
.asm_8caa3
ld a, [PlayerDirection] ; $d4de
and $c
add e
ld e, a
ld hl, Unknown_8cab3
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ret
; 8cab3 (23:4ab3)
Unknown_8cab3: ; 8cab3
db $58, $60
db $48, $60
db $58, $70
db $48, $70
db $58, $40
db $48, $40
db $58, $50
db $48, $50
db $38, $60
db $48, $60
db $38, $50
db $48, $50
db $58, $60
db $68, $60
db $58, $50
db $68, $50
; 8cad3
Function8cad3: ; 8cad3 (23:4ad3)
ld a, [PlayerDirection] ; $d4de
and $c
srl a
ld e, a
ld d, 0
ld hl, Unknown_8cae5
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ret
; 8cae5 (23:4ae5)
Unknown_8cae5: ; 8cae5
db $50, $68
db $50, $48
db $40, $58
db $60, $58
; 8caed
Function8caed: ; 8caed
call DelayFrame
ld a, [VramState] ; $d0ed
push af
xor a
ld [VramState], a ; $d0ed
call Function8cb9b
ld de, $5450
ld a, $a
call Function3b2a
ld hl, $3
add hl, bc
ld [hl], $84
ld hl, $2
add hl, bc
ld [hl], $16
ld a, $80
ld [$cf64], a
.asm_8cb14
ld a, [$cf63]
bit 7, a
jr nz, .asm_8cb2e
ld a, $0
ld [$c3b5], a
callab Function8cf7a
call Function8cbc8
call DelayFrame
jr .asm_8cb14
.asm_8cb2e
pop af
ld [VramState], a ; $d0ed
ret
; 8cb33
Function8cb33: ; 8cb33
call DelayFrame
ld a, [VramState] ; $d0ed
push af
xor a
ld [VramState], a ; $d0ed
call Function8cb9b
ld de, $fc50
ld a, $a
call Function3b2a
ld hl, $3
add hl, bc
ld [hl], $84
ld hl, $2
add hl, bc
ld [hl], $18
ld hl, $f
add hl, bc
ld [hl], $58
ld a, $40
ld [$cf64], a
.asm_8cb60
ld a, [$cf63]
bit 7, a
jr nz, .asm_8cb7a
ld a, $0
ld [$c3b5], a
callab Function8cf7a
call Function8cbc8
call DelayFrame
jr .asm_8cb60
.asm_8cb7a
pop af
ld [VramState], a ; $d0ed
call Function8cb82
ret
Function8cb82: ; 8cb82 (23:4b82)
ld hl, $c402
xor a
ld c, $4
.asm_8cb88
ld [hli], a
inc hl
inc hl
inc hl
inc a
dec c
jr nz, .asm_8cb88
ld hl, $c410
ld bc, $90
xor a
call ByteFill
ret
Function8cb9b: ; 8cb9b (23:4b9b)
callab Function8cf53
ld de, GFX_8c9cc
ld hl, $8800
lb bc, BANK(GFX_8c9cc), 4
call Request2bpp
ld a, [CurPartyMon] ; $d109
ld hl, PartySpecies ; $dcd8
ld e, a
ld d, 0
add hl, de
ld a, [hl]
ld [$d265], a
ld e, $84
callba Function8e9bc
xor a
ld [$cf63], a
ret
Function8cbc8: ; 8cbc8 (23:4bc8)
call Function8cbe6
ld hl, $cf64
ld a, [hl]
and a
jr z, .asm_8cbe0
dec [hl]
cp $40
ret c
and $7
ret nz
ld de, SFX_FLY
call PlaySFX
ret
.asm_8cbe0
ld hl, $cf63
set 7, [hl]
ret
Function8cbe6: ; 8cbe6 (23:4be6)
ld hl, $cf65
ld a, [hl]
inc [hl]
and $7
ret nz
ld a, [hl]
and $18
sla a
add $40
ld d, a
ld e, $0
ld a, $18
call Function3b2a
ld hl, $3
add hl, bc
ld [hl], $80
ret
Function8cc04: ; 8cc04
ld a, [ScriptVar]
and a
jr nz, .asm_8cc14
ld a, $1
ld bc, $4060
ld de, $fca0
jr .asm_8cc1c
.asm_8cc14
ld a, $ff
ld bc, $c0a0
ld de, $b460
.asm_8cc1c
ld h, a
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld a, h
ld [$d191], a
ld a, c
ld [$d192], a
ld a, b
ld [$d193], a
ld a, e
ld [$d194], a
ld a, d
ld [$d195], a
ld a, [hSCX]
push af
ld a, [hSCY]
push af
call Function8ccc9
ld hl, $ff9e
ld a, [hl]
push af
ld [hl], $1
.asm_8cc48
ld a, [$cf63]
and a
jr z, .asm_8cc66
bit 7, a
jr nz, .asm_8cc6b
callab Function8cf69
call Function8cdf7
call Function8cc99
call Function3b0c
call DelayFrame
jr .asm_8cc48
.asm_8cc66
call Function8ceae
jr .asm_8cc48
.asm_8cc6b
pop af
ld [$ff9e], a
call WhiteBGMap
xor a
ld [hLCDStatCustom], a
ld [$ffc7], a
ld [$ffc8], a
ld [hSCX], a
ld [Requested2bppSource], a
ld [$cf69], a
ld [Requested2bppDest], a
ld [$cf6b], a
ld [Requested2bpp], a
call ClearTileMap
pop af
ld [hSCY], a
pop af
ld [hSCX], a
xor a
ld [hBGMapMode], a
pop af
ld [rSVBK], a
ret
; 8cc99
Function8cc99: ; 8cc99
ld hl, $d200
ld c, $2f
ld a, [$cf64]
add a
ld [hSCX], a
call Function8ccc4
ld c, $30
ld a, [$cf65]
call Function8ccc4
ld c, $31
ld a, [$cf64]
add a
call Function8ccc4
ld a, [$d191]
ld d, a
ld hl, $cf64
ld a, [hl]
add d
add d
ld [hl], a
ret
; 8ccc4
Function8ccc4: ; 8ccc4
.asm_8ccc4
ld [hli], a
dec c
jr nz, .asm_8ccc4
ret
; 8ccc9
Function8ccc9: ; 8ccc9
call WhiteBGMap
call ClearSprites
call DisableLCD
callab Function8cf53
call SetMagnetTrainPals
call DrawMagnetTrain
ld a, $90
ld [hWY], a
call EnableLCD
xor a
ld [hBGMapMode], a
ld [hSCX], a
ld [hSCY], a
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
callba GetPlayerIcon
pop af
ld [rSVBK], a
ld hl, VTiles0
ld c, $4
call Request2bpp
ld hl, $00c0
add hl, de
ld d, h
ld e, l
ld hl, $8040
ld c, $4
call Request2bpp
call Function8cda6
ld hl, $cf63
xor a
ld [hli], a
ld a, [$d192]
ld [hli], a
ld [hli], a
ld [hli], a
ld de, MUSIC_MAGNET_TRAIN
call PlayMusic2
ret
; 8cd27
DrawMagnetTrain: ; 8cd27
ld hl, VBGMap0
xor a
.asm_8cd2b
call GetMagnetTrainBGTiles
ld b, 32 / 2
call .FillAlt
inc a
cp $12
jr c, .asm_8cd2b
ld hl, $98c0
ld de, MagnetTrainTilemap1
ld c, 20
call .FillLine
ld hl, $98e0
ld de, MagnetTrainTilemap2
ld c, 20
call .FillLine
ld hl, $9900
ld de, MagnetTrainTilemap3
ld c, 20
call .FillLine
ld hl, $9920
ld de, MagnetTrainTilemap4
ld c, 20
call .FillLine
ret
; 8cd65
.FillLine ; 8cd65
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .FillLine
ret
; 8cd6c
.FillAlt ; 8cd6c
ld [hl], e
inc hl
ld [hl], d
inc hl
dec b
jr nz, .FillAlt
ret
; 8cd74
GetMagnetTrainBGTiles: ; 8cd74
push hl
ld e, a
ld d, 0
ld hl, MagnetTrainBGTiles
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
pop hl
ret
; 8cd82
MagnetTrainBGTiles: ; 8cd82
; Alternating tiles for each line
; of the Magnet Train tilemap.
db $4c, $4d ; bush
db $5c, $5d ; bush
db $4c, $4d ; bush
db $5c, $5d ; bush
db $08, $08 ; fence
db $18, $18 ; fence
db $1f, $1f ; track
db $31, $31 ; track
db $11, $11 ; track
db $11, $11 ; track
db $0d, $0d ; track
db $31, $31 ; track
db $04, $04 ; fence
db $18, $18 ; fence
db $4c, $4d ; bush
db $5c, $5d ; bush
db $4c, $4d ; bush
db $5c, $5d ; bush
; 8cda6
Function8cda6: ; 8cda6
ld hl, LYOverrides
ld bc, $0090
ld a, [$d192]
call ByteFill
ld hl, $d200
ld bc, $0090
ld a, [$d192]
call ByteFill
ld a, $43
ld [hLCDStatCustom], a
ret
; 8cdc3
SetMagnetTrainPals: ; 8cdc3
ld a, $1
ld [rVBK], a
; bushes
ld hl, VBGMap0
ld bc, $0080
ld a, $2
call ByteFill
; train
ld hl, $9880
ld bc, $0140
xor a
call ByteFill
; more bushes
ld hl, $99c0
ld bc, $0080
ld a, $2
call ByteFill
; train window
ld hl, $9907
ld bc, $0006
ld a, $4
call ByteFill
ld a, $0
ld [rVBK], a
ret
; 8cdf7
Function8cdf7: ; 8cdf7
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_8ce06
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 8ce06
Jumptable_8ce06: ; 8ce06
dw Function8ce19
dw Function8ce6d
dw Function8ce47
dw Function8ce6d
dw Function8ce7a
dw Function8ce6d
dw Function8cea2
; 8ce14
Function8ce14: ; 8ce14
ld hl, $cf63
inc [hl]
ret
; 8ce19
Function8ce19: ; 8ce19
ld d, $55
ld a, [$d195]
ld e, a
ld b, $15
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
ld a, [PlayerGender]
bit 0, a
jr z, .asm_8ce31
ld b, $1f
.asm_8ce31
pop af
ld [rSVBK], a
ld a, b
call Function3b2a
ld hl, $0003
add hl, bc
ld [hl], $0
call Function8ce14
ld a, $80
ld [$cf66], a
ret
; 8ce47
Function8ce47: ; 8ce47
ld hl, $d193
ld a, [$cf65]
cp [hl]
jr z, .asm_8ce64
ld e, a
ld a, [$d191]
xor $ff
inc a
add e
ld [$cf65], a
ld hl, $c3c0
ld a, [$d191]
add [hl]
ld [hl], a
ret
.asm_8ce64
call Function8ce14
ld a, $80
ld [$cf66], a
ret
; 8ce6d
Function8ce6d: ; 8ce6d
ld hl, $cf66
ld a, [hl]
and a
jr z, .asm_8ce76
dec [hl]
ret
.asm_8ce76
call Function8ce14
ret
; 8ce7a
Function8ce7a: ; 8ce7a
ld hl, $d194
ld a, [$cf65]
cp [hl]
jr z, .asm_8ce9e
ld e, a
ld a, [$d191]
xor $ff
inc a
ld d, a
ld a, e
add d
add d
ld [$cf65], a
ld hl, $c3c0
ld a, [$d191]
ld d, a
ld a, [hl]
add d
add d
ld [hl], a
ret
ret
.asm_8ce9e
call Function8ce14
ret
; 8cea2
Function8cea2: ; 8cea2
ld a, $80
ld [$cf63], a
ld de, SFX_TRAIN_ARRIVED
call PlaySFX
ret
; 8ceae
Function8ceae: ; 8ceae
callba Function8cf69
call Function8cdf7
call Function8cc99
call Function3b0c
call DelayFrame
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
ld a, [TimeOfDayPal]
push af
ld a, [$d19a]
push af
ld a, [TimeOfDay]
and $3
ld [TimeOfDayPal], a
ld a, $1
ld [$d19a], a
ld b, $9
call GetSGBLayout
call UpdateTimePals
ld a, [rBGP]
ld [$cfc7], a
ld a, [rOBP0]
ld [$cfc8], a
ld a, [rOBP1]
ld [$cfc9], a
pop af
ld [$d19a], a
pop af
ld [TimeOfDayPal], a
pop af
ld [rSVBK], a
ret
; 8ceff
MagnetTrainTilemap1: db $1f, $05, $06, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0a, $0a, $0a, $09, $0a, $0a, $0a, $0b, $0c, $1f
MagnetTrainTilemap2: db $14, $15, $16, $1a, $1a, $1a, $19, $1a, $1a, $1a, $1a, $1a, $1a, $19, $1a, $1a, $1a, $1b, $1c, $1d
MagnetTrainTilemap3: db $24, $25, $26, $27, $07, $2f, $29, $28, $28, $28, $28, $28, $28, $29, $07, $2f, $2a, $2b, $2c, $2d
MagnetTrainTilemap4: db $20, $1f, $2e, $1f, $17, $00, $2e, $1f, $1f, $1f, $1f, $1f, $1f, $2e, $17, $00, $1f, $2e, $1f, $0f
; 8cf4f
Function8cf4f: ; 8cf4f
call Function3238
ret
; 8cf53
Function8cf53: ; 8cf53
ld hl, $c300
ld bc, $00c1
.asm_8cf59
ld [hl], $0
inc hl
dec bc
ld a, c
or b
jr nz, .asm_8cf59
ret
; 8cf62
Function8cf62: ; 8cf62
call Function8cf69
call DelayFrame
ret
; 8cf69
Function8cf69: ; 8cf69
push hl
push de
push bc
push af
ld a, $0
ld [$c3b5], a
call Function8cf7a
pop af
pop bc
pop de
pop hl
ret
; 8cf7a
Function8cf7a: ; 8cf7a
ld hl, $c314
ld e, $a
.asm_8cf7f
ld a, [hl]
and a
jr z, .asm_8cf91
ld c, l
ld b, h
push hl
push de
call Function8d24b
call Function8d04c
pop de
pop hl
jr c, .asm_8cfa7
.asm_8cf91
ld bc, $0010
add hl, bc
dec e
jr nz, .asm_8cf7f
ld a, [$c3b5]
ld l, a
ld h, $c4
.asm_8cf9e
ld a, l
cp $a0
jr nc, .asm_8cfa7
xor a
ld [hli], a
jr .asm_8cf9e
.asm_8cfa7
ret
; 8cfa8
Function8cfa8: ; 8cfa8 (23:4fa8)
ld hl, $c314
ld e, $a
.asm_8cfad
ld a, [hl]
and a
jr z, .asm_8cfbf
ld c, l
ld b, h
push hl
push de
call Function8d24b
call Function8d04c
pop de
pop hl
jr c, .asm_8cfd5
.asm_8cfbf
ld bc, $10
add hl, bc
dec e
jr nz, .asm_8cfad
ld a, [$c3b5]
ld l, a
ld h, $c4
.asm_8cfcc
ld a, l
cp $40
jr nc, .asm_8cfd5
xor a
ld [hli], a
jr .asm_8cfcc
.asm_8cfd5
ret
Function8cfd6:: ; 8cfd6
push de
push af
ld hl, $c314
ld e, $a
.asm_8cfdd
ld a, [hl]
and a
jr z, .asm_8cfec
ld bc, $0010
add hl, bc
dec e
jr nz, .asm_8cfdd
pop af
pop de
scf
ret
.asm_8cfec
ld c, l
ld b, h
ld hl, $c3b4
inc [hl]
ld a, [hl]
and a
jr nz, .asm_8cff7
inc [hl]
.asm_8cff7
pop af
ld e, a
ld d, 0
ld hl, Unknown_8d1c4
add hl, de
add hl, de
add hl, de
ld e, l
ld d, h
ld hl, $0000
add hl, bc
ld a, [$c3b4]
ld [hli], a
ld a, [de]
ld [hli], a
inc de
ld a, [de]
ld [hli], a
inc de
ld a, [de]
call Function8d109
ld [hli], a
pop de
ld hl, $0004
add hl, bc
ld a, e
ld [hli], a
ld a, d
ld [hli], a
xor a
ld [hli], a
ld [hli], a
xor a
ld [hli], a
ld [hli], a
dec a
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld a, c
ld [$c3b8], a
ld a, b
ld [$c3b9], a
ret
; 8d036
Function8d036: ; 8d036
ld hl, $0000
add hl, bc
ld [hl], $0
ret
; 8d03d
Function8d03d: ; 8d03d (23:503d)
ld hl, $c314
ld bc, $10
ld e, $a
xor a
.asm_8d046
ld [hl], a
add hl, bc
dec e
jr nz, .asm_8d046
ret
Function8d04c: ; 8d04c
call Function8d0ec
call Function8d132
cp $fd
jr z, .asm_8d0b9
cp $fc
jr z, .asm_8d0b6
call Function8d1a2
ld a, [$c3ba]
add [hl]
ld [$c3ba], a
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
push bc
ld a, [$c3b5]
ld e, a
ld d, Sprites / $100
ld a, [hli]
ld c, a
.asm_8d071
ld a, [$c3bc]
ld b, a
ld a, [$c3be]
add b
ld b, a
ld a, [$c3bf]
add b
ld b, a
call Function8d0be
add b
ld [de], a
inc hl
inc de
ld a, [$c3bb]
ld b, a
ld a, [$c3bd]
add b
ld b, a
ld a, [$c3c0]
add b
ld b, a
call Function8d0ce
add b
ld [de], a
inc hl
inc de
ld a, [$c3ba]
add [hl]
ld [de], a
inc hl
inc de
call Function8d0de
ld [de], a
inc hl
inc de
ld a, e
ld [$c3b5], a
cp SpritesEnd % $100
jr nc, .asm_8d0bb
dec c
jr nz, .asm_8d071
pop bc
jr .asm_8d0b9
.asm_8d0b6
call Function8d036
.asm_8d0b9
and a
ret
.asm_8d0bb
pop bc
scf
ret
; 8d0be
Function8d0be: ; 8d0be
push hl
ld a, [hl]
ld hl, $c3b8
bit 6, [hl]
jr z, .asm_8d0cc
add $8
xor $ff
inc a
.asm_8d0cc
pop hl
ret
; 8d0ce
Function8d0ce: ; 8d0ce
push hl
ld a, [hl]
ld hl, $c3b8
bit 5, [hl]
jr z, .asm_8d0dc
add $8
xor $ff
inc a
.asm_8d0dc
pop hl
ret
; 8d0de
Function8d0de: ; 8d0de
ld a, [$c3b8]
ld b, a
ld a, [hl]
xor b
and $e0
ld b, a
ld a, [hl]
and $1f
or b
ret
; 8d0ec
Function8d0ec: ; 8d0ec
xor a
ld [$c3b8], a
ld hl, $0003
add hl, bc
ld a, [hli]
ld [$c3ba], a
ld a, [hli]
ld [$c3bb], a
ld a, [hli]
ld [$c3bc], a
ld a, [hli]
ld [$c3bd], a
ld a, [hli]
ld [$c3be], a
ret
; 8d109
Function8d109: ; 8d109
push hl
push bc
ld hl, $c300
ld b, a
ld c, $a
.asm_8d111
ld a, [hli]
cp b
jr z, .asm_8d11c
inc hl
dec c
jr nz, .asm_8d111
xor a
jr .asm_8d11d
.asm_8d11c
ld a, [hl]
.asm_8d11d
pop bc
pop hl
ret
; 8d120
Function8d120:: ; 8d120
ld hl, $0001
add hl, bc
ld [hl], a
ld hl, $0008
add hl, bc
ld [hl], $0
ld hl, $000a
add hl, bc
ld [hl], $ff
ret
; 8d132
Function8d132: ; 8d132
.asm_8d132
ld hl, $0008
add hl, bc
ld a, [hl]
and a
jr z, .asm_8d142
dec [hl]
call Function8d189
ld a, [hli]
push af
jr .asm_8d163
.asm_8d142
ld hl, $000a
add hl, bc
inc [hl]
call Function8d189
ld a, [hli]
cp $fe
jr z, .asm_8d17b
cp $ff
jr z, .asm_8d16d
push af
ld a, [hl]
push hl
and $3f
ld hl, $0009
add hl, bc
add [hl]
ld hl, $0008
add hl, bc
ld [hl], a
pop hl
.asm_8d163
ld a, [hl]
and $c0
srl a
ld [$c3b8], a
pop af
ret
.asm_8d16d
xor a
ld hl, $0008
add hl, bc
ld [hl], a
ld hl, $000a
add hl, bc
dec [hl]
dec [hl]
jr .asm_8d132
.asm_8d17b
xor a
ld hl, $0008
add hl, bc
ld [hl], a
dec a
ld hl, $000a
add hl, bc
ld [hl], a
jr .asm_8d132
; 8d189
Function8d189: ; 8d189
ld hl, $0001
add hl, bc
ld e, [hl]
ld d, 0
ld hl, Unknown_8d6e6
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, $000a
add hl, bc
ld l, [hl]
ld h, 0
add hl, hl
add hl, de
ret
; 8d1a2
Function8d1a2: ; 8d1a2
ld e, a
ld d, 0
ld hl, Unknown_8d94d
add hl, de
add hl, de
add hl, de
ret
; 8d1ac
Function8d1ac: ; 8d1ac
push hl
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld de, Unknown_8e706
add hl, de
ld c, [hl]
inc hl
ld b, [hl]
inc hl
ld e, [hl]
inc hl
ld d, [hl]
pop hl
push bc
call Request2bpp
pop bc
ret
; 8d1c4
Unknown_8d1c4: ; 8d1c4
db $01, $01, $00
db $07, $04, $00
db $08, $05, $05
db $0a, $06, $00
db $0b, $07, $06
db $0c, $08, $06
db $0d, $09, $07
db $0e, $0a, $07
db $10, $0b, $07
db $08, $0c, $05
db $11, $00, $00
db $12, $0d, $08
db $12, $0e, $08
db $12, $0f, $08
db $13, $10, $00
db $15, $00, $00
db $16, $11, $00
db $17, $12, $00
db $18, $12, $00
db $19, $13, $00
db $1a, $14, $00
db $1b, $00, $00
db $1d, $15, $00
db $1e, $00, $00
db $1d, $17, $00
db $1f, $00, $00
db $24, $19, $00
db $25, $00, $00
db $20, $13, $00
db $26, $1a, $00
db $2d, $00, $00
db $2e, $00, $00
db $2f, $00, $00
db $30, $00, $00
db $31, $00, $00
db $32, $1b, $00
db $33, $1c, $00
db $34, $00, $00
db $35, $1d, $00
db $37, $1e, $00
db $38, $1e, $00
db $39, $20, $00
db $3f, $21, $00
db $3e, $22, $00
db $40, $00, $00
; 8d24b
Function8d24b: ; 8d24b
ld hl, $0002
add hl, bc
ld e, [hl]
ld d, 0
ld hl, Jumptable_8d25b
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 8d25b
Jumptable_8d25b: ; 8d25b (23:525b)
dw Function8d2a1
dw Function8d2a2
dw Function8d2b9
dw Function8d2ea
dw Function8d302
dw Function8d36c
dw Function8d37a
dw Function8d381
dw Function8d3c3
dw Function8d422
dw Function8d429
dw Function8d43e
dw Function8d373
dw Function8d46e
dw Function8d47c
dw Function8d475
dw Function8d483
dw Function8d52a
dw Function8d543
dw Function8d54a
dw Function8d578
dw Function8d57f
dw Function8d5b0
dw Function8d5e2
dw Function8d607
dw Function8d35a
dw Function8d6b7
dw Function8d630
dw Function8d637
dw Function8d63e
dw Function8d666
dw Function8d6be
dw Function8d680
dw Function8d6a2
dw Function8d6ae
Function8d2a1: ; 8d2a1 (23:52a1)
ret
Function8d2a2: ; 8d2a2 (23:52a2)
ld a, [$cfa9]
ld hl, $0
add hl, bc
cp [hl]
jr z, Function8d2b9
ld hl, $4
add hl, bc
ld [hl], $10
ld hl, $7
add hl, bc
ld [hl], $0
ret
Function8d2b9: ; 8d2b9 (23:52b9)
ld hl, $4
add hl, bc
ld [hl], $18
ld hl, $c
add hl, bc
ld a, [hl]
ld d, a
inc [hl]
and $f
ret nz
ld hl, $d
add hl, bc
ld e, [hl]
ld hl, $7
add hl, bc
ld a, d
and $10
jr z, .asm_8d2df
ld a, e
and a
jr z, .asm_8d2e6
cp $1
jr z, .asm_8d2e2
.asm_8d2df
xor a
ld [hl], a
ret
.asm_8d2e2
ld a, $ff
ld [hl], a
ret
.asm_8d2e6
ld a, $fe
ld [hl], a
ret
Function8d2ea: ; 8d2ea (23:52ea)
ld a, [$cfa9]
ld hl, $0
add hl, bc
cp [hl]
jr z, .asm_8d2fb
ld hl, $4
add hl, bc
ld [hl], $10
ret
.asm_8d2fb
ld hl, $4
add hl, bc
ld [hl], $18
ret
Function8d302: ; 8d302 (23:5302)
call Function8d6c5
jp [hl]
; 8d306 (23:5306)
; Anonymous jumptable (see Function8d6c5)
dw Function8d30a
dw Function8d321
; 8d30a
Function8d30a: ; 8d30a
call Function8d6d8
ld hl, $0000
add hl, bc
ld a, [hl]
ld hl, $000d
add hl, bc
and $3
ld [hl], a
inc [hl]
swap a
ld hl, $000c
add hl, bc
ld [hl], a
Function8d321: ; 8d321
ld hl, $0004
add hl, bc
ld a, [hl]
cp $a4
jr nc, .asm_8d356
ld hl, $000d
add hl, bc
add $4
ld hl, $0004
add hl, bc
ld [hl], a
ld hl, $0005
add hl, bc
inc [hl]
ld hl, $000d
add hl, bc
ld a, [hl]
sla a
sla a
ld d, $2
ld hl, $000c
add hl, bc
ld a, [hl]
add $3
ld [hl], a
call Function8d6de
ld hl, $0007
add hl, bc
ld [hl], a
ret
.asm_8d356
call Function8d036
ret
; 8d35a
Function8d35a: ; 8d35a (23:535a)
ld hl, $c
add hl, bc
ld a, [hl]
inc a
ld [hl], a
ld d, $2
call Function8d6de
ld hl, $7
add hl, bc
ld [hl], a
ret
Function8d36c: ; 8d36c (23:536c)
callab Function11a3b
ret
Function8d373: ; 8d373 (23:5373)
callab Function120c1
ret
Function8d37a: ; 8d37a (23:537a)
callab Functione46ed
ret
Function8d381: ; 8d381 (23:5381)
ld hl, $c
add hl, bc
ld a, [hl]
and a
jr z, .asm_8d3ba
dec [hl]
dec [hl]
ld d, a
and $1f
jr nz, .asm_8d395
ld hl, $d
add hl, bc
dec [hl]
.asm_8d395
ld hl, $b
add hl, bc
ld a, [hl]
push af
push de
call Function8d6de
ld hl, $7
add hl, bc
ld [hl], a
pop de
pop af
call Function8d6e2
ld hl, $6
add hl, bc
ld [hl], a
ld hl, $d
add hl, bc
ld a, [hl]
ld hl, $b
add hl, bc
add [hl]
ld [hl], a
ret
.asm_8d3ba
ld a, $1
ld [$cf64], a
call Function8d036
ret
Function8d3c3: ; 8d3c3 (23:53c3)
ld hl, $c
add hl, bc
ld a, [hli]
or [hl]
jr z, .asm_8d41e
ld hl, $f
add hl, bc
ld d, [hl]
ld hl, $b
add hl, bc
ld a, [hl]
push af
push de
call Function8d6de
ld hl, $7
add hl, bc
ld [hl], a
pop de
pop af
call Function8d6e2
ld hl, $6
add hl, bc
ld [hl], a
ld hl, $c
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
ld hl, $e
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
ld hl, $e
add hl, bc
ld [hl], e
inc hl
ld [hl], d
ld hl, $c
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld de, $fff0
add hl, de
ld e, l
ld d, h
ld hl, $c
add hl, bc
ld [hl], e
inc hl
ld [hl], d
ld hl, $b
add hl, bc
ld a, [hl]
xor $20
ld [hl], a
ret
.asm_8d41e
call Function8d036
ret
Function8d422: ; 8d422 (23:5422)
callab Function9321d
ret
Function8d429: ; 8d429 (23:5429)
callab Function932ac
ld hl, $cf64
ld a, [hl]
cp $2
ret nz
ld [hl], $3
ld a, $f
call Function8d120
ret
Function8d43e: ; 8d43e (23:543e)
ld hl, $b
add hl, bc
ld a, [hl]
dec [hl]
ld e, a
and $1
jr z, .asm_8d462
ld hl, $4
add hl, bc
ld a, [hl]
cp $78
jr c, .asm_8d461
call Function8d036
ld a, $4
ld [$cf64], a
ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
call PlaySFX
ret
.asm_8d461
inc [hl]
.asm_8d462
ld a, e
ld d, $20
call Function8d6de
ld hl, $7
add hl, bc
ld [hl], a
ret
Function8d46e: ; 8d46e (23:546e)
callab Functione00ed
ret
Function8d475: ; 8d475 (23:5475)
callab Function90d41
ret
Function8d47c: ; 8d47c (23:547c)
callab Functione21a1
ret
Function8d483: ; 8d483 (23:5483)
call Function8d6c5
jp [hl]
; 8d487 (23:5487)
; Anonymous jumptable (see Function8d6c5)
dw Function8d493
dw Function8d4d5
dw Function8d4a5
dw Function8d4b8
dw Function8d4e8
dw Function8d526
; 8d493
Function8d493: ; 8d493
ld a, $14
call Function8d120
ld hl, $000b
add hl, bc
ld [hl], $2
ld hl, $000c
add hl, bc
ld [hl], $20
ret
; 8d4a5
Function8d4a5: ; 8d4a5
ld hl, $000c
add hl, bc
ld a, [hl]
and a
jr z, .asm_8d4af
dec [hl]
ret
.asm_8d4af
call Function8d6d8
ld hl, $000c
add hl, bc
ld [hl], $40
Function8d4b8: ; 8d4b8
ld hl, $000c
add hl, bc
ld a, [hl]
cp $30
jr c, .asm_8d4cd
dec [hl]
ld d, $28
call Function8d6de
ld hl, $0007
add hl, bc
ld [hl], a
ret
.asm_8d4cd
ld de, SFX_GOT_SAFARI_BALLS
call PlaySFX
jr Function8d526
; 8d4d5
Function8d4d5: ; 8d4d5
ld hl, $000b
add hl, bc
ld [hl], $4
ld hl, $000c
add hl, bc
ld [hl], $30
ld hl, $000d
add hl, bc
ld [hl], $24
ret
; 8d4e8
Function8d4e8: ; 8d4e8
ld hl, $000d
add hl, bc
ld a, [hl]
and a
jr z, .asm_8d51c
ld d, a
ld hl, $000c
add hl, bc
ld a, [hl]
call Function8e72c
ld hl, $0007
add hl, bc
ld [hl], a
ld hl, $000c
add hl, bc
inc [hl]
ld a, [hl]
and $3f
ret nz
ld hl, $000c
add hl, bc
ld [hl], $20
ld hl, $000d
add hl, bc
ld a, [hl]
sub $c
ld [hl], a
ld de, SFX_SWITCH_POKEMON
call PlaySFX
ret
.asm_8d51c
xor a
ld hl, $0007
add hl, bc
ld [hl], a
call Function8d6d8
ret
Function8d526: ; 8d526
call Function8d036
ret
; 8d52a
Function8d52a: ; 8d52a (23:552a)
ld hl, $4
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
cp $b0
jr nc, .asm_8d53f
and $3
ret nz
ld de, SFX_POKEBALLS_PLACED_ON_TABLE
call PlaySFX
ret
.asm_8d53f
call Function8d036
ret
Function8d543: ; 8d543 (23:5543)
callab Function29676
ret
Function8d54a: ; 8d54a (23:554a)
ld hl, $c
add hl, bc
ld a, [hl]
cp $80
jr nc, .asm_8d574
ld d, a
add $8
ld [hl], a
ld hl, $b
add hl, bc
ld a, [hl]
xor $20
ld [hl], a
push af
push de
call Function8d6de
ld hl, $7
add hl, bc
ld [hl], a
pop de
pop af
call Function8d6e2
ld hl, $6
add hl, bc
ld [hl], a
ret
.asm_8d574
call Function8d036
ret
Function8d578: ; 8d578 (23:5578)
callab Function91640
ret
Function8d57f: ; 8d57f (23:557f)
ld hl, $d
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
ld hl, $80
add hl, de
ld e, l
ld d, h
ld hl, $d
add hl, bc
ld [hl], e
inc hl
ld [hl], d
ld hl, $c
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
inc [hl]
push af
push de
call Function8d6de
ld hl, $7
add hl, bc
ld [hl], a
pop de
pop af
call Function8d6e2
ld hl, $6
add hl, bc
ld [hl], a
ret
Function8d5b0: ; 8d5b0 (23:55b0)
ld hl, $5
add hl, bc
ld a, [hl]
and a
ret z
ld hl, $d
add hl, bc
ld a, [hl]
inc [hl]
cp $40
ret c
ld hl, $5
add hl, bc
dec [hl]
dec [hl]
ld hl, $f
add hl, bc
ld a, [hl]
ld d, a
cp $40
jr nc, .asm_8d5d3
add $8
ld [hl], a
.asm_8d5d3
ld hl, $e
add hl, bc
ld a, [hl]
inc [hl]
call Function8d6e2
ld hl, $6
add hl, bc
ld [hl], a
ret
Function8d5e2: ; 8d5e2 (23:55e2)
ld hl, $4
add hl, bc
ld a, [hl]
cp $b8
jr nc, .asm_8d603
inc [hl]
inc [hl]
ld hl, $5
add hl, bc
dec [hl]
ld d, $40
ld hl, $c
add hl, bc
ld a, [hl]
inc [hl]
call Function8d6e2
ld hl, $6
add hl, bc
ld [hl], a
ret
.asm_8d603
call Function8d036
ret
Function8d607: ; 8d607 (23:5607)
ld hl, $5
add hl, bc
ld a, [hl]
cp $54
ret z
ld hl, $5
add hl, bc
inc [hl]
inc [hl]
ld hl, $f
add hl, bc
ld a, [hl]
ld d, a
and a
jr z, .asm_8d621
sub $2
ld [hl], a
.asm_8d621
ld hl, $e
add hl, bc
ld a, [hl]
inc [hl]
call Function8d6e2
ld hl, $6
add hl, bc
ld [hl], a
ret
Function8d630: ; 8d630 (23:5630)
callba Function108bc7
ret
Function8d637: ; 8d637 (23:5637)
callba Function108be0
ret
Function8d63e: ; 8d63e (23:563e)
ld a, [$cf65]
and a
jr nz, .asm_8d645
ret
.asm_8d645
ld hl, $7
add hl, bc
ld [hl], $0
ld hl, $d
add hl, bc
ld a, [hl]
add $2
ld [hl], a
xor $ff
inc a
ld d, $20
call Function8d6de
ld hl, $7
add hl, bc
ld [hl], a
ld a, $36
call Function8d120
ret
Function8d666: ; 8d666 (23:5666)
ld hl, $c
add hl, bc
ld a, [hl]
cp $14
jr nc, .asm_8d67f
add $2
ld [hl], a
xor $ff
inc a
ld d, $20
call Function8d6de
ld hl, $7
add hl, bc
ld [hl], a
.asm_8d67f
ret
Function8d680: ; 8d680 (23:5680)
ld hl, $b
add hl, bc
ld d, [hl]
inc [hl]
inc [hl]
inc [hl]
ld hl, $c
add hl, bc
ld a, [hl]
push af
push de
call Function8d6de
ld hl, $7
add hl, bc
ld [hl], a
pop de
pop af
call Function8d6e2
ld hl, $6
add hl, bc
ld [hl], a
ret
Function8d6a2: ; 8d6a2 (23:56a2)
ld a, [$cf64]
cp $40
ret nz
ld a, $3d
call Function8d120
ret
Function8d6ae: ; 8d6ae (23:56ae)
ld hl, $5
add hl, bc
ld a, [hl]
add $10
ld [hl], a
ret
Function8d6b7: ; 8d6b7 (23:56b7)
callba Function11d0b6
ret
Function8d6be: ; 8d6be (23:56be)
callba Function49aa2
ret
Function8d6c5: ; 8d6c5 (23:56c5)
ld hl, [sp+$0]
ld e, [hl]
inc hl
ld d, [hl]
inc de
ld hl, $b
add hl, bc
ld l, [hl]
ld h, $0
add hl, hl
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
; 8d6d8 (23:56d8)
Function8d6d8: ; 8d6d8
ld hl, $000b
add hl, bc
inc [hl]
ret
; 8d6de
Function8d6de: ; 8d6de (23:56de)
call Function8e72c
ret
Function8d6e2: ; 8d6e2 (23:56e2)
call Function8e72a
ret
; 8d6e6 (23:56e6)
Unknown_8d6e6: ; 8d6e6
dw Unknown_8d76a
dw Unknown_8d76d
dw Unknown_8d772
dw Unknown_8d777
dw Unknown_8d77c
dw Unknown_8d781
dw Unknown_8d786
dw Unknown_8d7a6
dw Unknown_8d7ab
dw Unknown_8d7b0
dw Unknown_8d7b5
dw Unknown_8d7d4
dw Unknown_8d7d9
dw Unknown_8d7e2
dw Unknown_8d7eb
dw Unknown_8d7f4
dw Unknown_8d7ff
dw Unknown_8d78b
dw Unknown_8d802
dw Unknown_8d805
dw Unknown_8d808
dw Unknown_8d811
dw Unknown_8d818
dw Unknown_8d81d
dw Unknown_8d822
dw Unknown_8d825
dw Unknown_8d82c
dw Unknown_8d82f
dw Unknown_8d861
dw Unknown_8d864
dw Unknown_8d867
dw Unknown_8d874
dw Unknown_8d877
dw Unknown_8d87a
dw Unknown_8d87d
dw Unknown_8d880
dw Unknown_8d883
dw Unknown_8d890
dw Unknown_8d899
dw Unknown_8d89c
dw Unknown_8d89f
dw Unknown_8d8a2
dw Unknown_8d8a5
dw Unknown_8d8a8
dw Unknown_8d8ab
dw Unknown_8d794
dw Unknown_8d79d
dw Unknown_8d8ae
dw Unknown_8d8cd
dw Unknown_8d8ec
dw Unknown_8d8f1
dw Unknown_8d8f4
dw Unknown_8d8f7
dw Unknown_8d8fe
dw Unknown_8d907
dw Unknown_8d90c
dw Unknown_8d913
dw Unknown_8d916
dw Unknown_8d91d
dw Unknown_8d924
dw Unknown_8d92b
dw Unknown_8d932
dw Unknown_8d93d
dw Unknown_8d940
dw Unknown_8d943
dw Unknown_8d948
; 8d76a
Unknown_8d76a: db $00,$20, $ff
Unknown_8d76d: db $00,$08, $01,$08, $fe
Unknown_8d772: db $3d,$08, $3e,$08, $fe
Unknown_8d777: db $3f,$08, $40,$08, $fe
Unknown_8d77c: db $00,$04, $01,$04, $fe
Unknown_8d781: db $3d,$04, $3e,$04, $fe
Unknown_8d786: db $3f,$04, $40,$04, $fe
Unknown_8d78b: db $00,$08, $01,$08, $00,$08, $01,$48, $fe
Unknown_8d794: db $63,$08, $64,$08, $63,$08, $64,$48, $fe
Unknown_8d79d: db $65,$08, $66,$08, $65,$08, $66,$48, $fe
Unknown_8d7a6: db $1e,$01, $1f,$01, $fe
Unknown_8d7ab: db $20,$01, $fd,$01, $fe
Unknown_8d7b0: db $21,$01, $fd,$01, $fe
Unknown_8d7b5: db $81,$0c, $82,$01, $83,$01, $82,$04, $81,$0c, $82,$0c, $83,$04, $84,$20, $85,$03, $86,$03, $87,$04, $88,$04, $89,$04, $8a,$0a, $8b,$07, $ff
Unknown_8d7d4: db $23,$03, $23,$83, $fe
Unknown_8d7d9: db $24,$02, $25,$02, $26,$02, $25,$02, $fe
Unknown_8d7e2: db $27,$07, $28,$07, $27,$87, $28,$47, $fe
Unknown_8d7eb: db $29,$07, $2a,$07, $29,$07, $2b,$07, $fe
Unknown_8d7f4: db $29,$07, $2c,$07, $2d,$07, $2c,$07, $29,$07, $ff
Unknown_8d7ff: db $2e,$14, $ff
Unknown_8d802: db $2f,$20, $ff
Unknown_8d805: db $30,$20, $ff
Unknown_8d808: db $30,$03, $31,$03, $30,$03, $31,$43, $fe
Unknown_8d811: db $32,$04, $33,$04, $34,$04, $fc
Unknown_8d818: db $35,$03, $36,$03, $fe
Unknown_8d81d: db $37,$07, $38,$07, $fe
Unknown_8d822: db $39,$20, $ff
Unknown_8d825: db $3b,$02, $3a,$02, $3b,$02, $ff
Unknown_8d82c: db $3c,$20, $ff
Unknown_8d82f: db $41,$08, $42,$08, $41,$08, $42,$48, $fe
db $43,$08, $44,$08, $fe
db $45,$08, $46,$08, $fe
db $47,$08, $48,$08, $fe
db $49,$01, $49,$41, $49,$c1, $49,$81, $fe
db $4a,$20, $ff
db $4b,$20, $ff
db $4c,$20, $ff
db $4d,$20, $ff
db $4e,$03, $fd,$03, $fe
Unknown_8d861: db $fd,$20, $ff
Unknown_8d864: db $4f,$20, $ff
Unknown_8d867: db $50,$02, $51,$10, $fd,$01, $52,$01, $fd,$01, $53,$01, $fc
Unknown_8d874: db $54,$20, $ff
Unknown_8d877: db $55,$20, $ff
Unknown_8d87a: db $55,$60, $ff
Unknown_8d87d: db $55,$a0, $ff
Unknown_8d880: db $55,$e0, $ff
Unknown_8d883: db $56,$0a, $57,$09, $58,$0a, $59,$0a, $58,$09, $5a,$0a, $fe
Unknown_8d890: db $50,$02, $5b,$02, $50,$02, $5b,$42, $fe
Unknown_8d899: db $5c,$02, $ff
Unknown_8d89c: db $5d,$02, $ff
Unknown_8d89f: db $5e,$02, $ff
Unknown_8d8a2: db $5f,$02, $ff
Unknown_8d8a5: db $60,$02, $ff
Unknown_8d8a8: db $61,$02, $ff
Unknown_8d8ab: db $62,$02, $ff
Unknown_8d8ae: db $32,$03, $33,$03, $34,$03, $30,$03, $31,$03, $30,$03, $31,$43, $30,$03, $31,$03, $30,$03, $31,$43, $30,$03, $31,$03, $30,$03, $31,$43, $ff
Unknown_8d8cd: db $30,$03, $31,$03, $30,$03, $31,$43, $30,$03, $31,$03, $30,$03, $31,$43, $30,$03, $31,$03, $30,$03, $31,$43, $32,$03, $33,$03, $34,$03, $fc
Unknown_8d8ec: db $67,$03, $68,$03, $fe
Unknown_8d8f1: db $6c,$03, $ff
Unknown_8d8f4: db $6d,$03, $ff
Unknown_8d8f7: db $69,$02, $6a,$02, $6b,$02, $fc
Unknown_8d8fe: db $6e,$03, $6f,$03, $70,$03, $71,$03, $fe
Unknown_8d907: db $71,$03, $6e,$07, $ff
Unknown_8d90c: db $72,$20, $73,$07, $74,$07, $ff
Unknown_8d913: db $75,$03, $ff
Unknown_8d916: db $76,$03, $77,$03, $78,$07, $fc
Unknown_8d91d: db $76,$43, $77,$43, $78,$47, $fc
Unknown_8d924: db $76,$83, $77,$83, $78,$87, $fc
Unknown_8d92b: db $76,$c3, $77,$c3, $78,$c7, $fc
Unknown_8d932: db $79,$03, $7a,$03, $7b,$03, $7c,$07, $7d,$07, $ff
Unknown_8d93d: db $7e,$03, $ff
Unknown_8d940: db $fd,$00, $ff
Unknown_8d943: db $7f,$08, $80,$08, $ff
Unknown_8d948: db $7f,$48, $80,$48, $ff
; 8d94d
Unknown_8d94d: ; 8d94d
dbw $00, Unknown_8dd8a
dbw $04, Unknown_8dd8a
dbw $4c, Unknown_8daf1
dbw $5c, Unknown_8daf1
dbw $6c, Unknown_8daf6
dbw $6e, Unknown_8daf6
dbw $2d, Unknown_8ddf0
dbw $4d, Unknown_8ddf0
dbw $60, Unknown_8de09
dbw $00, Unknown_8de09
dbw $00, Unknown_8de09
dbw $06, Unknown_8de09
dbw $0c, Unknown_8de7e
dbw $0d, Unknown_8daf1
dbw $00, Unknown_8dc53
dbw $04, Unknown_8dc53
dbw $08, Unknown_8dc53
dbw $40, Unknown_8dc53
dbw $44, Unknown_8dc53
dbw $48, Unknown_8dc53
dbw $4c, Unknown_8dc53
dbw $80, Unknown_8de87
dbw $85, Unknown_8de87
dbw $8a, Unknown_8de87
dbw $00, Unknown_8db29
dbw $01, Unknown_8db5c
dbw $09, Unknown_8db9d
dbw $10, Unknown_8dc94
dbw $29, Unknown_8dc94
dbw $42, Unknown_8dc94
dbw $f8, Unknown_8e17e
dbw $fa, Unknown_8e17e
dbw $00, Unknown_8deb2
dbw $00, Unknown_8dec3
dbw $00, Unknown_8deec
dbw $0f, Unknown_8db07
dbw $11, Unknown_8daf1
dbw $12, Unknown_8daf1
dbw $13, Unknown_8daf1
dbw $00, Unknown_8df29
dbw $08, Unknown_8df29
dbw $10, Unknown_8df42
dbw $10, Unknown_8df5b
dbw $10, Unknown_8df74
dbw $10, Unknown_8df8d
dbw $10, Unknown_8dfa6
dbw $3a, Unknown_8daf1
dbw $00, Unknown_8dd8a
dbw $00, Unknown_8db18
dbw $02, Unknown_8dd9b
dbw $06, Unknown_8db5c
dbw $0a, Unknown_8db5c
dbw $0e, Unknown_8db5c
dbw $12, Unknown_8db3a
dbw $13, Unknown_8db3a
dbw $00, Unknown_8dd8a
dbw $04, Unknown_8dd8a
dbw $10, Unknown_8db5c
dbw $00, Unknown_8dd9b
dbw $04, Unknown_8daf1
dbw $00, Unknown_8dfbf
dbw $00, Unknown_8ddac
dbw $00, Unknown_8ddbd
dbw $00, Unknown_8ddce
dbw $00, Unknown_8dddf
dbw $00, Unknown_8dd9b
dbw $04, Unknown_8dd9b
dbw $00, Unknown_8dc2e
dbw $30, Unknown_8dc2e
dbw $03, Unknown_8dc2e
dbw $33, Unknown_8dc2e
dbw $06, Unknown_8dc2e
dbw $36, Unknown_8dc2e
dbw $09, Unknown_8dc2e
dbw $39, Unknown_8dc2e
dbw $0c, Unknown_8dfcc
dbw $0c, Unknown_8dfe5
dbw $3c, Unknown_8daf1
dbw $3e, Unknown_8daf1
dbw $00, Unknown_8de9c
dbw $00, Unknown_8dea1
dbw $00, Unknown_8dff6
dbw $00, Unknown_8e007
dbw $00, Unknown_8e018
dbw $00, Unknown_8daf1
dbw $01, Unknown_8daf1
dbw $00, Unknown_8e029
dbw $00, Unknown_8e076
dbw $00, Unknown_8e0b7
dbw $00, Unknown_8e0f4
dbw $00, Unknown_8e139
dbw $04, Unknown_8dea1
dbw $00, Unknown_8e183
dbw $00, Unknown_8e1b4
dbw $00, Unknown_8e1b9
dbw $00, Unknown_8e1ca
dbw $00, Unknown_8e1eb
dbw $00, Unknown_8e1f0
dbw $00, Unknown_8e1f9
dbw $00, Unknown_8e202
dbw $04, Unknown_8e202
dbw $00, Unknown_8e213
dbw $04, Unknown_8e213
dbw $20, Unknown_8e224
dbw $21, Unknown_8e224
dbw $22, Unknown_8e24b
dbw $23, Unknown_8e25c
dbw $27, Unknown_8e27d
dbw $2a, Unknown_8e229
dbw $2a, Unknown_8e23a
dbw $00, Unknown_8e2ae
dbw $08, Unknown_8e33f
dbw $60, Unknown_8e3b0
dbw $68, Unknown_8e429
dbw $00, Unknown_8e4a6
dbw $05, Unknown_8e4a6
dbw $0a, Unknown_8e4a6
dbw $50, Unknown_8e50b
dbw $00, Unknown_8e54c
dbw $01, Unknown_8e551
dbw $04, Unknown_8e55e
dbw $00, Unknown_8db29
dbw $01, Unknown_8e57b
dbw $03, Unknown_8e59c
dbw $08, Unknown_8e5cd
dbw $1c, Unknown_8e5cd
dbw $80, Unknown_8e61e
dbw $00, Unknown_8e66f
dbw $04, Unknown_8e66f
dbw $d0, Unknown_8e680
dbw $d3, Unknown_8e680
dbw $d6, Unknown_8e680
dbw $6c, Unknown_8e6a5
dbw $68, Unknown_8e6a5
dbw $64, Unknown_8e6a5
dbw $60, Unknown_8e6a5
dbw $0c, Unknown_8e6a5
dbw $08, Unknown_8e6a5
dbw $04, Unknown_8e6a5
dbw $00, Unknown_8e6a5
; 8daf1
Unknown_8daf1: ; 8daf1
db 1
db $fc, $fc, $00, $00
; 8daf6
Unknown_8daf6: ; 8daf6
db 4
db $f8, $f8, $00, $00
db $f8, $00, $01, $00
db $00, $f8, $10, $00
db $00, $00, $11, $00
; 8db07
Unknown_8db07: ; 8db07
db 4
db $f8, $f8, $00, $00
db $f8, $00, $00, $20
db $00, $f8, $01, $00
db $00, $00, $01, $20
; 8db18
Unknown_8db18: ; 8db18
db 4
db $f8, $f8, $00, $80
db $f8, $00, $00, $a0
db $00, $f8, $01, $80
db $00, $00, $01, $a0
; 8db29
Unknown_8db29: ; 8db29
db 4
db $f8, $f8, $00, $00
db $f8, $00, $00, $20
db $00, $f8, $00, $40
db $00, $00, $00, $60
; 8db3a
Unknown_8db3a: ; 8db3a
db 4
db $f8, $f8, $00, $07
db $f8, $00, $00, $27
db $00, $f8, $00, $47
db $00, $00, $00, $67
; 8db4b
; 8db4b
db 4
db $f8, $f8, $00, $80
db $f8, $00, $00, $a0
db $00, $f8, $00, $c0
db $00, $00, $00, $e0
; 8db5c
Unknown_8db5c: ; 8db5c
db 16
db $f0, $f0, $00, $00
db $f0, $f8, $01, $00
db $f8, $f0, $02, $00
db $f8, $f8, $03, $00
db $f0, $00, $01, $20
db $f0, $08, $00, $20
db $f8, $00, $03, $20
db $f8, $08, $02, $20
db $00, $f0, $02, $40
db $00, $f8, $03, $40
db $08, $f0, $00, $40
db $08, $f8, $01, $40
db $00, $00, $03, $60
db $00, $08, $02, $60
db $08, $00, $01, $60
db $08, $08, $00, $60
; 8db9d
Unknown_8db9d: ; 8db9d
db 36
db $e8, $e8, $00, $00
db $e8, $f0, $01, $00
db $e8, $f8, $02, $00
db $f0, $e8, $03, $00
db $f0, $f0, $04, $00
db $f0, $f8, $05, $00
db $f8, $e8, $06, $00
db $f8, $f0, $05, $00
db $f8, $f8, $05, $00
db $e8, $00, $02, $20
db $e8, $08, $01, $20
db $e8, $10, $00, $20
db $f0, $00, $05, $20
db $f0, $08, $04, $20
db $f0, $10, $03, $20
db $f8, $00, $05, $20
db $f8, $08, $05, $20
db $f8, $10, $06, $20
db $00, $e8, $06, $40
db $00, $f0, $05, $40
db $00, $f8, $05, $40
db $08, $e8, $03, $40
db $08, $f0, $04, $40
db $08, $f8, $05, $40
db $10, $e8, $00, $40
db $10, $f0, $01, $40
db $10, $f8, $02, $40
db $00, $00, $05, $60
db $00, $08, $05, $60
db $00, $10, $06, $60
db $08, $00, $05, $60
db $08, $08, $04, $60
db $08, $10, $03, $60
db $10, $00, $02, $60
db $10, $08, $01, $60
db $10, $10, $00, $60
; 8dc2e
Unknown_8dc2e: ; 8dc2e
db 9
db $f4, $f4, $00, $00
db $f4, $fc, $01, $00
db $f4, $04, $02, $00
db $fc, $f4, $10, $00
db $fc, $fc, $11, $00
db $fc, $04, $12, $00
db $04, $f4, $20, $00
db $04, $fc, $21, $00
db $04, $04, $22, $00
; 8dc53
Unknown_8dc53: ; 8dc53
db 16
db $f0, $f0, $00, $00
db $f0, $f8, $01, $00
db $f0, $00, $02, $00
db $f0, $08, $03, $00
db $f8, $f0, $10, $00
db $f8, $f8, $11, $00
db $f8, $00, $12, $00
db $f8, $08, $13, $00
db $00, $f0, $20, $00
db $00, $f8, $21, $00
db $00, $00, $22, $00
db $00, $08, $23, $00
db $08, $f0, $30, $00
db $08, $f8, $31, $00
db $08, $00, $32, $00
db $08, $08, $33, $00
; 8dc94
Unknown_8dc94: ; 8dc94
db 25
db $ec, $ec, $00, $00
db $f4, $ec, $01, $00
db $fc, $ec, $02, $00
db $04, $ec, $03, $00
db $0c, $ec, $04, $00
db $ec, $f4, $05, $00
db $f4, $f4, $06, $00
db $fc, $f4, $07, $00
db $04, $f4, $08, $00
db $0c, $f4, $09, $00
db $ec, $fc, $0a, $00
db $f4, $fc, $0b, $00
db $fc, $fc, $0c, $00
db $04, $fc, $0d, $00
db $0c, $fc, $0e, $00
db $ec, $04, $0f, $00
db $f4, $04, $10, $00
db $fc, $04, $11, $00
db $04, $04, $12, $00
db $0c, $04, $13, $00
db $ec, $0c, $14, $00
db $f4, $0c, $15, $00
db $fc, $0c, $16, $00
db $04, $0c, $17, $00
db $0c, $0c, $18, $00
; 8dcf9
; 8dcf9
db 36
db $e8, $e8, $00, $00
db $e8, $f0, $01, $00
db $e8, $f8, $02, $00
db $e8, $00, $03, $00
db $e8, $08, $04, $00
db $e8, $10, $05, $00
db $f0, $e8, $06, $00
db $f0, $f0, $07, $00
db $f0, $f8, $08, $00
db $f0, $00, $09, $00
db $f0, $08, $0a, $00
db $f0, $10, $0b, $00
db $f8, $e8, $0c, $00
db $f8, $f0, $0d, $00
db $f8, $f8, $0e, $00
db $f8, $00, $0f, $00
db $f8, $08, $10, $00
db $f8, $10, $11, $00
db $00, $e8, $12, $00
db $00, $f0, $13, $00
db $00, $f8, $14, $00
db $00, $00, $15, $00
db $00, $08, $16, $00
db $00, $10, $17, $00
db $08, $e8, $18, $00
db $08, $f0, $19, $00
db $08, $f8, $1a, $00
db $08, $00, $1b, $00
db $08, $08, $1c, $00
db $08, $10, $1d, $00
db $10, $e8, $1e, $00
db $10, $f0, $1f, $00
db $10, $f8, $20, $00
db $10, $00, $21, $00
db $10, $08, $22, $00
db $10, $10, $23, $00
; 8dd8a
Unknown_8dd8a: ; 8dd8a
db 4
db $f8, $f8, $00, $00
db $f8, $00, $01, $00
db $00, $f8, $02, $00
db $00, $00, $03, $00
; 8dd9b
Unknown_8dd9b: ; 8dd9b
db 4
db $f8, $f8, $00, $80
db $f8, $00, $01, $80
db $00, $f8, $02, $80
db $00, $00, $03, $80
; 8ddac
Unknown_8ddac: ; 8ddac
db 4
db $f8, $f8, $00, $00
db $f8, $00, $01, $00
db $00, $f8, $08, $00
db $00, $00, $03, $00
; 8ddbd
Unknown_8ddbd: ; 8ddbd
db 4
db $f8, $f8, $04, $00
db $f8, $00, $05, $00
db $00, $f8, $08, $00
db $00, $00, $07, $00
; 8ddce
Unknown_8ddce: ; 8ddce
db 4
db $f8, $f8, $00, $00
db $f8, $00, $01, $00
db $00, $f8, $09, $00
db $00, $00, $03, $00
; 8dddf
Unknown_8dddf: ; 8dddf
db 4
db $f8, $f8, $04, $00
db $f8, $00, $05, $00
db $00, $f8, $09, $00
db $00, $00, $07, $00
; 8ddf0
Unknown_8ddf0: ; 8ddf0
db 6
db $f8, $f4, $00, $01
db $f8, $fc, $01, $01
db $f8, $04, $02, $01
db $00, $f4, $10, $01
db $00, $fc, $11, $01
db $00, $04, $12, $01
; 8de09
Unknown_8de09: ; 8de09
db 29
db $e8, $e8, $00, $00
db $e8, $f0, $01, $00
db $e8, $f8, $02, $00
db $e8, $00, $03, $00
db $f0, $e8, $10, $00
db $f0, $f0, $11, $00
db $f0, $f8, $12, $00
db $f0, $00, $13, $00
db $f8, $e8, $20, $00
db $f8, $f0, $21, $00
db $f8, $f8, $22, $00
db $f8, $00, $23, $00
db $f8, $08, $24, $00
db $00, $e8, $30, $80
db $00, $f0, $31, $80
db $00, $f8, $32, $80
db $00, $00, $33, $80
db $00, $08, $34, $80
db $08, $e8, $40, $80
db $08, $f0, $41, $80
db $08, $f8, $42, $80
db $08, $00, $43, $80
db $08, $08, $44, $80
db $08, $10, $45, $80
db $10, $f0, $51, $80
db $10, $f8, $52, $80
db $10, $00, $53, $80
db $10, $08, $54, $80
db $10, $10, $55, $80
; 8de7e
Unknown_8de7e: ; 8de7e
db 2
db $f8, $fc, $00, $00
db $00, $fc, $10, $00
; 8de87
Unknown_8de87: ; 8de87
db 5
db $f0, $18, $00, $00
db $f0, $20, $01, $00
db $f8, $10, $02, $00
db $f8, $18, $03, $00
db $00, $10, $04, $00
; 8de9c
Unknown_8de9c: ; 8de9c
db 1
db $fc, $fc, $00, $06
; 8dea1
Unknown_8dea1: ; 8dea1
db 4
db $f8, $f8, $00, $06
db $f8, $00, $01, $06
db $00, $f8, $02, $06
db $00, $00, $03, $06
; 8deb2
Unknown_8deb2: ; 8deb2
db 4
db $ff, $ff, $00, $00
db $ff, $00, $00, $20
db $00, $ff, $00, $40
db $00, $00, $00, $60
; 8dec3
Unknown_8dec3: ; 8dec3
db 10
db $ff, $00, $00, $00
db $ff, $08, $01, $00
db $ff, $10, $01, $00
db $ff, $18, $01, $00
db $ff, $20, $00, $20
db $00, $00, $00, $40
db $00, $08, $01, $40
db $00, $10, $01, $40
db $00, $18, $01, $40
db $00, $20, $00, $60
; 8deec
Unknown_8deec: ; 8deec
db 15
db $ec, $f4, $00, $11
db $ec, $fc, $01, $11
db $ec, $04, $02, $11
db $f4, $f4, $03, $11
db $f4, $fc, $04, $11
db $f4, $04, $05, $11
db $fc, $f4, $06, $11
db $fc, $fc, $07, $11
db $fc, $04, $08, $11
db $04, $f4, $09, $11
db $04, $fc, $0a, $11
db $04, $04, $0b, $11
db $0c, $f4, $0c, $11
db $0c, $fc, $0d, $11
db $0c, $04, $0e, $11
; 8df29
Unknown_8df29: ; 8df29
db 6
db $f4, $f4, $00, $15
db $f4, $fc, $02, $15
db $f4, $04, $00, $35
db $04, $f4, $04, $15
db $04, $fc, $06, $15
db $04, $04, $04, $35
; 8df42
Unknown_8df42: ; 8df42
db 6
db $f4, $f4, $00, $16
db $f4, $fc, $02, $16
db $f4, $04, $04, $16
db $04, $f4, $06, $16
db $04, $fc, $08, $16
db $04, $04, $0a, $16
; 8df5b
Unknown_8df5b: ; 8df5b
db 6
db $f4, $f4, $00, $16
db $f4, $fc, $02, $16
db $f4, $04, $04, $16
db $04, $f4, $0c, $16
db $04, $fc, $0e, $16
db $04, $04, $10, $16
; 8df74
Unknown_8df74: ; 8df74
db 6
db $f4, $f4, $00, $16
db $f4, $fc, $02, $16
db $f4, $04, $04, $16
db $04, $f4, $12, $16
db $04, $fc, $14, $16
db $04, $04, $16, $16
; 8df8d
Unknown_8df8d: ; 8df8d
db 6
db $f4, $f4, $00, $16
db $f4, $fc, $02, $16
db $f4, $04, $04, $16
db $04, $f4, $18, $16
db $04, $fc, $1a, $16
db $04, $04, $1c, $16
; 8dfa6
Unknown_8dfa6: ; 8dfa6
db 6
db $f4, $f4, $1e, $16
db $f4, $fc, $20, $16
db $f4, $04, $22, $16
db $04, $f4, $24, $16
db $04, $fc, $26, $16
db $04, $04, $28, $16
; 8dfbf
Unknown_8dfbf: ; 8dfbf
db 3
db $f4, $fc, $00, $10
db $fc, $fc, $00, $10
db $04, $fc, $00, $10
; 8dfcc
Unknown_8dfcc: ; 8dfcc
db 6
db $00, $00, $00, $00
db $00, $08, $01, $00
db $00, $10, $01, $00
db $00, $18, $01, $00
db $00, $20, $02, $00
db $00, $28, $03, $00
; 8dfe5
Unknown_8dfe5: ; 8dfe5
db 4
db $00, $00, $00, $00
db $00, $08, $01, $00
db $00, $10, $02, $00
db $00, $18, $03, $00
; 8dff6
Unknown_8dff6: ; 8dff6
db 4
db $f8, $f6, $00, $06
db $f8, $02, $01, $06
db $00, $f6, $02, $06
db $00, $02, $03, $06
; 8e007
Unknown_8e007: ; 8e007
db 4
db $f8, $f4, $00, $06
db $f8, $04, $01, $06
db $00, $f4, $02, $06
db $00, $04, $03, $06
; 8e018
Unknown_8e018: ; 8e018
db 4
db $f8, $f0, $00, $06
db $f8, $08, $01, $06
db $00, $f0, $02, $06
db $00, $08, $03, $06
; 8e029
Unknown_8e029: ; 8e029
db 19
db $f8, $e0, $00, $00
db $f0, $e8, $02, $00
db $00, $e8, $04, $00
db $e8, $f0, $06, $00
db $f8, $f0, $08, $00
db $08, $f0, $0a, $00
db $e8, $f8, $0c, $00
db $f8, $f8, $0e, $00
db $08, $f8, $10, $00
db $e8, $00, $12, $00
db $f8, $00, $14, $00
db $08, $00, $16, $00
db $e8, $08, $18, $00
db $f8, $08, $1a, $00
db $08, $08, $1c, $00
db $f8, $10, $1e, $00
db $08, $10, $20, $00
db $f0, $18, $22, $00
db $00, $18, $24, $00
; 8e076
Unknown_8e076: ; 8e076
db 16
db $f8, $e0, $00, $00
db $f0, $e8, $02, $00
db $00, $e8, $04, $00
db $f8, $f0, $26, $00
db $08, $f0, $0a, $00
db $e8, $f8, $28, $00
db $f8, $f8, $2a, $00
db $08, $f8, $10, $00
db $f8, $00, $2c, $00
db $08, $00, $16, $00
db $f8, $08, $30, $00
db $08, $08, $1c, $00
db $f8, $10, $1e, $00
db $08, $10, $20, $00
db $f0, $18, $22, $00
db $00, $18, $24, $00
; 8e0b7
Unknown_8e0b7: ; 8e0b7
db 15
db $f8, $e0, $00, $00
db $f0, $e8, $02, $00
db $00, $e8, $32, $00
db $f8, $f0, $34, $00
db $08, $f0, $36, $00
db $f8, $f8, $38, $00
db $08, $f8, $3a, $00
db $f8, $00, $3c, $00
db $08, $00, $3e, $00
db $f8, $08, $30, $00
db $08, $08, $1c, $00
db $f8, $10, $1e, $00
db $08, $10, $20, $00
db $f0, $18, $22, $00
db $00, $18, $24, $00
; 8e0f4
Unknown_8e0f4: ; 8e0f4
db 17
db $f8, $e0, $00, $00
db $f0, $e8, $02, $00
db $00, $e8, $04, $00
db $f8, $f0, $40, $00
db $08, $f0, $42, $00
db $18, $f0, $44, $00
db $f8, $f8, $46, $00
db $08, $f8, $48, $00
db $18, $f8, $4a, $00
db $f8, $00, $4c, $00
db $08, $00, $4e, $00
db $f8, $08, $30, $00
db $08, $08, $1c, $00
db $f8, $10, $1e, $00
db $08, $10, $20, $00
db $f0, $18, $22, $00
db $00, $18, $24, $00
; 8e139
Unknown_8e139: ; 8e139
db 17
db $f8, $e0, $00, $00
db $f0, $e8, $02, $00
db $00, $e8, $04, $00
db $f8, $f0, $50, $00
db $08, $f0, $0a, $00
db $e8, $f8, $52, $00
db $f8, $f8, $54, $00
db $08, $f8, $10, $00
db $e8, $00, $56, $00
db $f8, $00, $2e, $00
db $08, $00, $16, $00
db $f8, $08, $30, $00
db $08, $08, $1c, $00
db $f8, $10, $1e, $00
db $08, $10, $20, $00
db $f0, $18, $22, $00
db $00, $18, $24, $00
; 8e17e
Unknown_8e17e: ; 8e17e
db 1
db $fc, $fc, $00, $11
; 8e183
Unknown_8e183: ; 8e183
db 12
db $00, $00, $30, $00
db $00, $08, $31, $00
db $00, $10, $31, $00
db $00, $18, $31, $00
db $00, $20, $31, $00
db $00, $28, $32, $00
db $08, $00, $33, $00
db $08, $08, $34, $00
db $08, $10, $34, $00
db $08, $18, $34, $00
db $08, $20, $34, $00
db $08, $28, $35, $00
; 8e1b4
Unknown_8e1b4: ; 8e1b4
db 1
db $00, $00, $ed, $00
; 8e1b9
Unknown_8e1b9: ; 8e1b9
db 4
db $ff, $ff, $30, $00
db $ff, $01, $32, $00
db $01, $ff, $33, $00
db $01, $01, $35, $00
; 8e1ca
Unknown_8e1ca: ; 8e1ca
db 8
db $ff, $ff, $30, $00
db $ff, $04, $31, $00
db $ff, $0c, $31, $00
db $ff, $11, $32, $00
db $01, $ff, $33, $00
db $01, $04, $34, $00
db $01, $0c, $34, $00
db $01, $11, $35, $00
; 8e1eb
Unknown_8e1eb: ; 8e1eb
db 1
db $00, $00, $34, $00
; 8e1f0
Unknown_8e1f0: ; 8e1f0
db 2
db $00, $00, $30, $00
db $08, $00, $33, $00
; 8e1f9
Unknown_8e1f9: ; 8e1f9
db 2
db $00, $00, $32, $00
db $08, $00, $35, $00
; 8e202
Unknown_8e202: ; 8e202
db 4
db $f8, $f8, $00, $01
db $f8, $00, $01, $01
db $00, $f8, $02, $01
db $00, $00, $03, $01
; 8e213
Unknown_8e213: ; 8e213
db 4
db $f8, $f8, $00, $81
db $f8, $00, $01, $81
db $00, $f8, $02, $81
db $00, $00, $03, $81
; 8e224
Unknown_8e224: ; 8e224
db 1
db $fc, $fc, $00, $02
; 8e229
Unknown_8e229: ; 8e229
db 4
db $f0, $fc, $00, $03
db $f8, $fc, $01, $03
db $00, $fc, $02, $03
db $08, $fc, $03, $03
; 8e23a
Unknown_8e23a: ; 8e23a
db 4
db $f0, $fc, $03, $44
db $f8, $fc, $02, $44
db $00, $fc, $01, $44
db $08, $fc, $00, $44
; 8e24b
Unknown_8e24b: ; 8e24b
db 4
db $f8, $f8, $00, $01
db $f8, $00, $00, $21
db $00, $f8, $00, $41
db $00, $00, $00, $61
; 8e25c
Unknown_8e25c: ; 8e25c
db 8
db $f4, $f4, $00, $01
db $f4, $fc, $01, $01
db $f4, $04, $00, $21
db $fc, $f4, $02, $01
db $fc, $04, $02, $21
db $04, $f4, $00, $41
db $04, $fc, $01, $41
db $04, $04, $00, $61
; 8e27d
Unknown_8e27d: ; 8e27d
db 12
db $f0, $f0, $00, $01
db $f0, $f8, $01, $01
db $f8, $f0, $02, $01
db $f0, $00, $01, $21
db $f0, $08, $00, $21
db $f8, $08, $02, $21
db $00, $f0, $02, $41
db $08, $f0, $00, $41
db $08, $f8, $01, $41
db $00, $08, $02, $61
db $08, $00, $01, $61
db $08, $08, $00, $61
; 8e2ae
Unknown_8e2ae: ; 8e2ae
db 36
db $e8, $08, $05, $00
db $e8, $10, $06, $00
db $e8, $18, $07, $00
db $f0, $e8, $11, $00
db $f0, $f0, $12, $00
db $f0, $f8, $13, $00
db $f0, $00, $14, $00
db $f0, $08, $15, $00
db $f0, $10, $16, $00
db $f0, $18, $17, $00
db $f8, $e0, $20, $00
db $f8, $e8, $21, $00
db $f8, $f0, $22, $00
db $f8, $f8, $23, $00
db $f8, $00, $24, $00
db $f8, $08, $25, $00
db $f8, $10, $26, $00
db $f8, $18, $27, $00
db $00, $e0, $30, $00
db $00, $e8, $31, $00
db $00, $f0, $32, $00
db $00, $f8, $33, $00
db $00, $00, $34, $00
db $00, $08, $35, $00
db $00, $10, $36, $00
db $08, $e0, $40, $00
db $08, $e8, $41, $00
db $08, $f0, $42, $00
db $08, $f8, $43, $00
db $08, $00, $44, $00
db $08, $08, $45, $00
db $08, $10, $46, $00
db $08, $18, $47, $00
db $10, $e0, $50, $00
db $10, $e8, $51, $00
db $10, $18, $57, $00
; 8e33f
Unknown_8e33f: ; 8e33f
db 28
db $e8, $00, $04, $00
db $e8, $08, $05, $00
db $e8, $10, $06, $00
db $f0, $e8, $11, $00
db $f0, $f0, $12, $00
db $f0, $f8, $13, $00
db $f0, $00, $14, $00
db $f0, $08, $15, $00
db $f0, $10, $16, $00
db $f8, $e8, $21, $00
db $f8, $f0, $22, $00
db $f8, $f8, $23, $00
db $f8, $00, $24, $00
db $f8, $08, $25, $00
db $f8, $10, $26, $00
db $00, $e0, $30, $00
db $00, $e8, $31, $00
db $00, $f0, $32, $00
db $00, $f8, $33, $00
db $00, $00, $34, $00
db $00, $08, $35, $00
db $08, $f0, $42, $00
db $08, $f8, $43, $00
db $08, $00, $44, $00
db $08, $08, $45, $00
db $10, $f8, $53, $00
db $10, $00, $54, $00
db $10, $08, $55, $00
; 8e3b0
Unknown_8e3b0: ; 8e3b0
db 30
db $e8, $00, $04, $00
db $e8, $08, $05, $00
db $f0, $e8, $11, $00
db $f0, $f0, $12, $00
db $f0, $f8, $13, $00
db $f0, $00, $14, $00
db $f0, $08, $15, $00
db $f0, $10, $16, $00
db $f0, $18, $17, $00
db $f8, $e0, $20, $00
db $f8, $e8, $21, $00
db $f8, $f0, $22, $00
db $f8, $f8, $23, $00
db $f8, $00, $24, $00
db $f8, $08, $25, $00
db $f8, $10, $26, $00
db $00, $e0, $30, $00
db $00, $e8, $31, $00
db $00, $f0, $32, $00
db $00, $f8, $33, $00
db $00, $00, $34, $00
db $00, $08, $35, $00
db $08, $f0, $42, $00
db $08, $f8, $43, $00
db $08, $00, $44, $00
db $08, $08, $45, $00
db $10, $f0, $52, $00
db $10, $f8, $53, $00
db $10, $00, $54, $00
db $10, $08, $55, $00
; 8e429
Unknown_8e429: ; 8e429
db 31
db $f0, $e8, $11, $00
db $f0, $f0, $12, $00
db $f0, $f8, $13, $00
db $f0, $00, $14, $00
db $f0, $08, $15, $00
db $f0, $10, $16, $00
db $f0, $18, $17, $00
db $f8, $e0, $20, $00
db $f8, $e8, $21, $00
db $f8, $f0, $22, $00
db $f8, $f8, $23, $00
db $f8, $00, $24, $00
db $f8, $08, $25, $00
db $f8, $10, $26, $00
db $f8, $18, $27, $00
db $00, $e0, $30, $00
db $00, $e8, $31, $00
db $00, $f0, $32, $00
db $00, $f8, $33, $00
db $00, $00, $34, $00
db $00, $08, $35, $00
db $00, $10, $36, $00
db $08, $e8, $41, $00
db $08, $f0, $42, $00
db $08, $f8, $43, $00
db $08, $00, $44, $00
db $08, $08, $45, $00
db $10, $e8, $51, $00
db $10, $f0, $52, $00
db $10, $00, $54, $00
db $10, $08, $55, $00
; 8e4a6
Unknown_8e4a6: ; 8e4a6
db 25
db $ec, $ec, $00, $09
db $ec, $f4, $01, $09
db $ec, $fc, $02, $09
db $ec, $04, $03, $09
db $ec, $0c, $04, $09
db $f4, $ec, $10, $09
db $f4, $f4, $11, $09
db $f4, $fc, $12, $09
db $f4, $04, $13, $09
db $f4, $0c, $14, $09
db $fc, $ec, $20, $09
db $fc, $f4, $21, $09
db $fc, $fc, $22, $09
db $fc, $04, $23, $09
db $fc, $0c, $24, $09
db $04, $ec, $30, $09
db $04, $f4, $31, $09
db $04, $fc, $32, $09
db $04, $04, $33, $09
db $04, $0c, $34, $09
db $0c, $ec, $40, $09
db $0c, $f4, $41, $09
db $0c, $fc, $42, $09
db $0c, $04, $43, $09
db $0c, $0c, $44, $09
; 8e50b
Unknown_8e50b: ; 8e50b
db 16
db $f0, $ec, $00, $0a
db $f0, $f4, $01, $0a
db $f0, $fc, $02, $0a
db $f0, $04, $03, $0a
db $f8, $ec, $04, $0a
db $f8, $f4, $05, $0a
db $f8, $fc, $06, $0a
db $f8, $04, $07, $0a
db $00, $ec, $08, $0a
db $00, $f4, $09, $0a
db $00, $fc, $0a, $0a
db $00, $04, $0b, $0a
db $08, $ec, $0c, $0a
db $08, $f4, $0d, $0a
db $08, $fc, $0e, $0a
db $08, $04, $0f, $0a
; 8e54c
Unknown_8e54c: ; 8e54c
db 1
db $fc, $fc, $00, $00
; 8e551
Unknown_8e551: ; 8e551
db 3
db $00, $f8, $00, $00
db $f8, $f8, $01, $00
db $f8, $00, $02, $00
; 8e55e
Unknown_8e55e: ; 8e55e
db 7
db $08, $f0, $00, $00
db $00, $f0, $01, $00
db $f8, $f0, $02, $00
db $f8, $f8, $03, $00
db $f0, $f8, $04, $00
db $f0, $00, $05, $00
db $f0, $08, $06, $00
; 8e57b
Unknown_8e57b: ; 8e57b
db 8
db $f8, $f0, $00, $00
db $f8, $f8, $01, $00
db $f8, $00, $01, $20
db $f8, $08, $00, $20
db $00, $f0, $00, $40
db $00, $f8, $01, $40
db $00, $00, $01, $60
db $00, $08, $00, $60
; 8e59c
Unknown_8e59c: ; 8e59c
db 12
db $e8, $f8, $00, $00
db $f0, $f8, $01, $00
db $f8, $f8, $02, $00
db $e8, $00, $00, $20
db $f0, $00, $01, $20
db $f8, $00, $02, $20
db $00, $f8, $02, $40
db $08, $f8, $01, $40
db $10, $f8, $00, $40
db $00, $00, $02, $60
db $08, $00, $01, $60
db $10, $00, $00, $60
; 8e5cd
Unknown_8e5cd: ; 8e5cd
db 20
db $ec, $f0, $00, $00
db $ec, $f8, $01, $00
db $ec, $00, $02, $00
db $ec, $08, $03, $00
db $f4, $f0, $04, $00
db $f4, $f8, $05, $00
db $f4, $00, $06, $00
db $f4, $08, $07, $00
db $fc, $f0, $08, $00
db $fc, $f8, $09, $00
db $fc, $00, $0a, $00
db $fc, $08, $0b, $00
db $04, $f0, $0c, $00
db $04, $f8, $0d, $00
db $04, $00, $0e, $00
db $04, $08, $0f, $00
db $0c, $f0, $10, $00
db $0c, $f8, $11, $00
db $0c, $00, $12, $00
db $0c, $08, $13, $00
; 8e61e
Unknown_8e61e: ; 8e61e
db 20
db $00, $08, $00, $81
db $08, $10, $00, $81
db $10, $18, $00, $81
db $18, $20, $00, $81
db $20, $28, $00, $81
db $18, $30, $00, $81
db $10, $38, $00, $81
db $08, $40, $00, $81
db $00, $48, $00, $81
db $08, $50, $00, $81
db $10, $58, $00, $81
db $18, $60, $00, $81
db $20, $68, $00, $81
db $18, $70, $00, $81
db $10, $78, $00, $81
db $08, $80, $00, $81
db $00, $88, $00, $81
db $08, $90, $00, $81
db $10, $98, $00, $81
db $18, $a0, $00, $81
; 8e66f
Unknown_8e66f: ; 8e66f
db 4
db $f8, $f8, $00, $02
db $f8, $00, $01, $02
db $00, $f8, $02, $02
db $00, $00, $03, $02
; 8e680
Unknown_8e680: ; 8e680
db 9
db $f0, $f4, $00, $01
db $f0, $fc, $01, $01
db $f0, $04, $02, $01
db $f8, $f4, $10, $01
db $f8, $fc, $11, $01
db $f8, $04, $12, $01
db $00, $f4, $20, $01
db $00, $fc, $21, $01
db $00, $04, $22, $01
; 8e6a5
Unknown_8e6a5: ; 8e6a5
db 24
db $d8, $f4, $00, $01
db $d8, $fc, $01, $01
db $d8, $04, $02, $01
db $d8, $0c, $03, $01
db $e0, $f4, $10, $01
db $e0, $fc, $11, $01
db $e0, $04, $12, $01
db $e0, $0c, $13, $01
db $e8, $f4, $20, $01
db $e8, $fc, $21, $01
db $e8, $04, $22, $01
db $e8, $0c, $23, $01
db $f0, $f4, $30, $01
db $f0, $fc, $31, $01
db $f0, $04, $32, $01
db $f0, $0c, $33, $01
db $f8, $f4, $40, $01
db $f8, $fc, $41, $01
db $f8, $04, $42, $01
db $f8, $0c, $43, $01
db $00, $f4, $50, $01
db $00, $fc, $51, $01
db $00, $04, $52, $01
db $00, $0c, $53, $01
; 8e706
Unknown_8e706: ; 8e706
dbbw $80, $01, Unknown_8e72a
dbbw $80, $01, Unknown_8e72a
dbbw $80, $01, Unknown_8e72a
dbbw $80, $01, Unknown_8e72a
dbbw $10, $37, Unknown_8e72a
dbbw $10, $11, Unknown_8e72a
dbbw $10, $39, Unknown_8e72a
dbbw $10, $24, Unknown_8e72a
dbbw $10, $21, Unknown_8e72a
Unknown_8e72a:
; 8e72a
Function8e72a: ; 8e72a
add $10
Function8e72c: ; 8e72c
and $3f
cp $20
jr nc, .asm_8e737
call Function8e741
ld a, h
ret
.asm_8e737
and $1f
call Function8e741
ld a, h
xor $ff
inc a
ret
; 8e741
Function8e741: ; 8e741
ld e, a
ld a, d
ld d, 0
ld hl, Unknown_8e75d
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, 0
.asm_8e750
srl a
jr nc, .asm_8e755
add hl, de
.asm_8e755
sla e
rl d
and a
jr nz, .asm_8e750
ret
; 8e75d
Unknown_8e75d: ; 8e75d
sine_wave $100
Function8e79d: ; 8e79d
ld a, [hSGB]
ld de, GFX_8e7f4
and a
jr z, .asm_8e7a8
ld de, GFX_8e804
.asm_8e7a8
ld hl, VTiles0
lb bc, BANK(GFX_8e7f4), 1
call Request2bpp
ld c, $8
ld d, $0
.asm_8e7b5
push bc
call Function8e7c6
call DelayFrame
pop bc
inc d
inc d
dec c
jr nz, .asm_8e7b5
call ClearSprites
ret
; 8e7c6
Function8e7c6: ; 8e7c6
ld hl, Sprites
ld c, $8
.asm_8e7cb
ld a, c
and a
ret z
dec c
ld a, c
sla a
sla a
sla a
push af
push de
push hl
call Function8e72c
pop hl
pop de
add $68
ld [hli], a
pop af
push de
push hl
call Function8e72a
pop hl
pop de
add $54
ld [hli], a
ld a, $0
ld [hli], a
ld a, $6
ld [hli], a
jr .asm_8e7cb
; 8e7f4
GFX_8e7f4: ; 8e7f4
INCBIN "baserom.gbc",$8e7f4,$8e804 - $8e7f4
GFX_8e804: ; 8e804
INCBIN "baserom.gbc",$8e804,$8e814 - $8e804
Function8e814: ; 8e814
push hl
push de
push bc
push af
ld hl, $c300
ld bc, $00c1
.asm_8e81e
ld [hl], $0
inc hl
dec bc
ld a, c
or b
jr nz, .asm_8e81e
pop af
pop bc
pop de
pop hl
ret
; 8e82b
Function8e82b: ; 8e82b
ld a, e
call ReadMonMenuIcon
ld l, a
ld h, 0
add hl, hl
ld de, IconPointers
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
ld b, BANK(Icons)
ld c, 8
ret
; 8e83f
Function8e83f: ; 8e83f
push hl
push de
push bc
call Function8e849
pop bc
pop de
pop hl
ret
; 8e849
Function8e849: ; 8e849
ld d, 0
ld hl, Jumptable_8e854
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 8e854
Jumptable_8e854: ; 8e854 (23:6854)
dw Function8e8d5
dw Function8e961
dw Function8e97d
dw Function8e99a
dw Function8e898
dw Function8e8b1
dw Function8e862
Function8e862: ; 8e862 (23:6862)
call Function8e908
call Function8e86c
call Function8e936
ret
Function8e86c: ; 8e86c (23:686c)
push bc
ld a, [$ffb0]
ld hl, PartyMon1Item ; $dce0
ld bc, PartyMon2 - PartyMon1
call AddNTimes
pop bc
ld a, [hl]
and a
jr z, .asm_8e890
push hl
push bc
ld d, a
callab ItemIsMail
pop bc
pop hl
jr c, .asm_8e88e
ld a, $6
jr .asm_8e892
.asm_8e88e
ld a, $5
.asm_8e890
ld a, $4
.asm_8e892
ld hl, $1
add hl, bc
ld [hl], a
ret
Function8e898: ; 8e898 (23:6898)
call Function8e8d5
ld hl, $2
add hl, bc
ld a, $0
ld [hl], a
ld hl, $4
add hl, bc
ld a, $48
ld [hl], a
ld hl, $5
add hl, bc
ld a, $48
ld [hl], a
ret
Function8e8b1: ; 8e8b1 (23:68b1)
call Function8e908
call Function8e936
ld hl, $2
add hl, bc
ld a, $0
ld [hl], a
ld hl, $4
add hl, bc
ld a, $18
ld [hl], a
ld hl, $5
add hl, bc
ld a, $60
ld [hl], a
ld a, c
ld [$c608], a
ld a, b
ld [$c609], a
ret
Function8e8d5: ; 8e8d5 (23:68d5)
call Function8e908
call Function8e8df
call Function8e936
ret
Function8e8df: ; 8e8df (23:68df)
push bc
ld a, [$ffb0]
ld hl, PartyMon1Item ; $dce0
ld bc, $30
call AddNTimes
pop bc
ld a, [hl]
and a
ret z
push hl
push bc
ld d, a
callab ItemIsMail
pop bc
pop hl
jr c, .asm_8e900
ld a, $3
jr .asm_8e902
.asm_8e900
ld a, $2
.asm_8e902
ld hl, $1
add hl, bc
ld [hl], a
ret
Function8e908: ; 8e908 (23:6908)
ld a, [$c3b7]
push af
ld a, [$ffb0]
ld hl, PartySpecies ; $dcd8
ld e, a
ld d, $0
add hl, de
ld a, [hl]
call ReadMonMenuIcon
ld [CurIcon], a ; $c3b6
call Function8e9db
ld a, [$ffb0]
add a
add a
add a
add a
add $1c
ld d, a
ld e, $10
ld a, $0
call Function8cfd6
pop af
ld hl, $3
add hl, bc
ld [hl], a
ret
Function8e936: ; 8e936 (23:6936)
push bc
ld a, [$ffb0]
ld b, a
call Function8e94c
ld a, b
pop bc
ld hl, $9
add hl, bc
ld [hl], a
rlca
rlca
ld hl, $d
add hl, bc
ld [hl], a
ret
Function8e94c: ; 8e94c (23:694c)
callba Function50117
call GetHPPal
ld e, d
ld d, 0
ld hl, Unknown_8e95e
add hl, de
ld b, [hl]
ret
; 8e95e (23:695e)
Unknown_8e95e: ; 8e95e
db $00, $40, $80
; 8e961
Function8e961: ; 8e961 (23:6961)
ld a, [$d265]
call ReadMonMenuIcon
ld [CurIcon], a ; $c3b6
xor a
call GetIconGFX
ld de, $2420
ld a, $0
call Function8cfd6
ld hl, $2
add hl, bc
ld [hl], $0
ret
Function8e97d: ; 8e97d (23:697d)
ld a, [$d265]
call ReadMonMenuIcon
ld [CurIcon], a ; $c3b6
xor a
call GetIconGFX
ld d, $1a
ld e, $24
ld a, $0
call Function8cfd6
ld hl, $2
add hl, bc
ld [hl], $0
ret
Function8e99a: ; 8e99a (23:699a)
ld a, [$d265]
call ReadMonMenuIcon
ld [CurIcon], a ; $c3b6
ld a, $62
ld [$c3b7], a
call Function8e9db
ret
GetSpeciesIcon: ; 8e9ac
; Load species icon into VRAM at tile a
push de
ld a, [$d265]
call ReadMonMenuIcon
ld [CurIcon], a
pop de
ld a, e
call GetIconGFX
ret
; 8e9bc
Function8e9bc: ; 8e9bc (23:69bc)
push de
ld a, [$d265]
call ReadMonMenuIcon
ld [CurIcon], a ; $c3b6
pop de
ld a, e
call GetIcon_a
ret
; 8e9cc (23:69cc)
Function8e9cc: ; 8e9cc
push de
ld a, [$d265]
call ReadMonMenuIcon
ld [CurIcon], a
pop de
call GetIcon_de
ret
; 8e9db
Function8e9db: ; 8e9db (23:69db)
ld a, [$c3b7]
GetIconGFX: ; 8e9de
call GetIcon_a
ld de, $80 ; 8 tiles
add hl, de
ld de, HeldItemIcons
lb bc, BANK(HeldItemIcons), 2
call GetGFXUnlessMobile
ld a, [$c3b7]
add 10
ld [$c3b7], a
ret
HeldItemIcons:
INCBIN "gfx/icon/mail.2bpp"
INCBIN "gfx/icon/item.2bpp"
; 8ea17
GetIcon_de: ; 8ea17
; Load icon graphics into VRAM starting from tile de.
ld l, e
ld h, d
jr GetIcon
GetIcon_a: ; 8ea1b
; Load icon graphics into VRAM starting from tile a.
ld l, a
ld h, 0
GetIcon: ; 8ea1e
; Load icon graphics into VRAM starting from tile hl.
; One tile is 16 bytes long.
add hl, hl
add hl, hl
add hl, hl
add hl, hl
ld de, VTiles0
add hl, de
push hl
; The icons are contiguous, in order and of the same
; size, so the pointer table is somewhat redundant.
ld a, [CurIcon]
push hl
ld l, a
ld h, 0
add hl, hl
ld de, IconPointers
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
lb bc, BANK(Icons), 8
call GetGFXUnlessMobile
pop hl
ret
; 8ea3f
GetGFXUnlessMobile: ; 8ea3f
ld a, [InLinkBattle]
cp 4 ; Mobile Link Battle
jp nz, Request2bpp
jp Functiondc9
; 8ea4a
Function8ea4a: ; 8ea4a
ld hl, $c314
ld e, $6
ld a, [$cfa9]
ld d, a
.asm_8ea53
ld a, [hl]
and a
jr z, .asm_8ea69
cp d
jr z, .asm_8ea5e
ld a, $0
jr .asm_8ea60
.asm_8ea5e
ld a, $2
.asm_8ea60
push hl
ld c, l
ld b, h
ld hl, $0002
add hl, bc
ld [hl], a
pop hl
.asm_8ea69
ld bc, $0010
add hl, bc
dec e
jr nz, .asm_8ea53
ret
; 8ea71
Function8ea71: ; 8ea71
ld hl, $c314
ld e, $6
.asm_8ea76
ld a, [hl]
and a
jr z, .asm_8ea84
push hl
ld c, l
ld b, h
ld hl, $2
add hl, bc
ld [hl], $1
pop hl
.asm_8ea84
ld bc, $10
add hl, bc
dec e
jr nz, .asm_8ea76
ret
; 8ea8c (23:6a8c)
Function8ea8c: ; 8ea8c
ld hl, $c314
ld e, $6
ld a, [$d0e3]
ld d, a
.asm_8ea95
ld a, [hl]
and a
jr z, .asm_8eaab
cp d
jr z, .asm_8eaa0
ld a, $3
jr .asm_8eaa2
.asm_8eaa0
ld a, $2
.asm_8eaa2
push hl
ld c, l
ld b, h
ld hl, $2
add hl, bc
ld [hl], a
pop hl
.asm_8eaab
ld bc, $10
add hl, bc
dec e
jr nz, .asm_8ea95
ret
INCLUDE "menu/mon_icons.asm"
SECTION "bank24", ROMX, BANK[$24]
Function90000:: ; 90000
call Function9001c
jr c, .asm_9000d
call Function9002d
jr nc, .asm_9000d
ld [hl], c
xor a
ret
.asm_9000d
scf
ret
; 9000f
Function9000f:: ; 9000f
call Function9001c
jr nc, .asm_90017
xor a
ld [hl], a
ret
.asm_90017
scf
ret
; 90019
Function90019:: ; 90019
jp Function9001c
; 9001c
Function9001c: ; 9001c
ld hl, $dc7c
ld b, $a
.asm_90021
ld a, [hli]
cp c
jr z, .asm_9002a
dec b
jr nz, .asm_90021
xor a
ret
.asm_9002a
dec hl
scf
ret
; 9002d
Function9002d: ; 9002d
call Function90040
ld b, a
ld hl, $dc7c
.asm_90034
ld a, [hli]
and a
jr z, .asm_9003d
dec b
jr nz, .asm_90034
xor a
ret
.asm_9003d
dec hl
scf
ret
; 90040
Function90040: ; 90040
xor a
ld [Buffer1], a
ld hl, Unknown_90066
.asm_90047
ld a, [hli]
cp $ff
jr z, .asm_9005f
cp c
jr z, .asm_9005d
push bc
push hl
ld c, a
call Function9001c
jr c, .asm_9005b
ld hl, Buffer1
inc [hl]
.asm_9005b
pop hl
pop bc
.asm_9005d
jr .asm_90047
.asm_9005f
ld a, $a
ld hl, Buffer1
sub [hl]
ret
; 90066
Unknown_90066: ; 90066
db 1, 4, $ff
; 90069
Function90069: ; 90069
ld a, [hROMBank]
push af
ld a, b
rst Bankswitch
call PlaceString
pop af
rst Bankswitch
ret
; 90074
CheckPhoneCall:: ; 90074 (24:4074)
; Check if the phone is ringing in the overworld.
call CheckStandingOnEntrance
jr z, .no_call
call Function900a6
nop
jr nc, .no_call
call Random
ld b, a
and $7f
cp b
jr nz, .no_call
call Function2d05
and a
jr nz, .no_call
call Function900de
call Function900bf
jr nc, .no_call
ld e, a
call Function9020d
ld a, BANK(UnknownScript_0x90241)
ld hl, UnknownScript_0x90241
call CallScript
scf
ret
.no_call
xor a
ret
Function900a6: ; 900a6 (24:40a6)
callba Function11401
ret
Function900ad: ; 900ad (24:40ad)
push hl
push bc
push de
push af
callba Functionc000
pop af
and $7
and c
pop de
pop bc
pop hl
ret
Function900bf: ; 900bf (24:40bf)
ld a, [$d040]
and a
jr z, .asm_900dc
ld c, a
call Random
ld a, [hRandomAdd] ; $ff00+$e1
swap a
and $1f
call SimpleDivide
ld c, a
ld b, $0
ld hl, $d041
add hl, bc
ld a, [hl]
scf
ret
.asm_900dc
xor a
ret
Function900de: ; 900de (24:40de)
callba Functionc000
ld a, c
ld [EngineBuffer1], a ; $d03e (aliases: MenuItemsList, CurFruitTree, CurInput)
ld hl, $d040
ld bc, $b
xor a
call ByteFill
ld de, $dc7c
ld a, $a
.asm_900f7
ld [$d03f], a
ld a, [de]
and a
jr z, .asm_9012e
ld hl, PhoneContacts + 8
ld bc, 12
call AddNTimes
ld a, [EngineBuffer1] ; $d03e (aliases: MenuItemsList, CurFruitTree, CurInput)
and [hl]
jr z, .asm_9012e
ld bc, $fffa
add hl, bc
ld a, [MapGroup] ; $dcb5
cp [hl]
jr nz, .asm_9011e
inc hl
ld a, [MapNumber] ; $dcb6
cp [hl]
jr z, .asm_9012e
.asm_9011e
ld a, [$d040]
ld c, a
ld b, $0
inc a
ld [$d040], a
ld hl, $d041
add hl, bc
ld a, [de]
ld [hl], a
.asm_9012e
inc de
ld a, [$d03f]
dec a
jr nz, .asm_900f7
ret
Function90136:: ; 90136 (24:4136)
ld a, [$dc31]
and a
jr z, .asm_90171
dec a
ld c, a
ld b, 0
ld hl, Unknown_90627
ld a, 6
call AddNTimes
ld a, [hli]
ld h, [hl]
ld l, a
call _hl_
jr nc, .asm_90171
call Function90178
inc hl
inc hl
ld a, [hli]
ld e, a
push hl
call Function9020d
pop hl
ld de, $d048
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
ld a, BANK(UnknownScript_0x90173)
ld hl, UnknownScript_0x90173
call CallScript
scf
ret
.asm_90171
xor a
ret
; 90173 (24:4173)
UnknownScript_0x90173: ; 0x90173
pause 30
2jump UnknownScript_0x90241
; 0x90178
Function90178: ; 90178 (24:4178)
ld a, [$dc31]
dec a
ld c, a
ld b, 0
ld hl, Unknown_90627
ld a, 6
call AddNTimes
ret
Function90188: ; 90188
ld a, [$d19a]
cp $1
jr z, .asm_90195
cp $2
jr z, .asm_90195
xor a
ret
.asm_90195
scf
ret
Function90197: ; 90197
scf
ret
Function90199: ; 90199 (24:4199)
ld a, [InLinkBattle]
and a
jr nz, .asm_901e7
call Function2d05
and a
jr nz, .asm_901e7
ld a, b
ld [$dbf9], a
ld hl, PhoneContacts
ld bc, 12
call AddNTimes
ld d, h
ld e, l
ld hl, 4
add hl, de
ld a, [hl]
call Function900ad
jr z, .asm_901e7
ld hl, 2
add hl, de
ld a, [MapGroup]
cp [hl]
jr nz, .asm_901d9
ld hl, $3
add hl, de
ld a, [MapNumber]
cp [hl]
jr nz, .asm_901d9
ld b, BANK(UnknownScript_0x90660)
ld hl, UnknownScript_0x90660
jr .asm_901f0
.asm_901d9
ld hl, $5
add hl, de
ld b, [hl]
ld hl, $6
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jr .asm_901f0
.asm_901e7
ld b, BANK(UnknownScript_0x90209)
ld de, UnknownScript_0x90209
call Function2674
ret
.asm_901f0
ld a, b
ld [$d002], a
ld a, l
ld [$d003], a
ld a, h
ld [$d004], a
ld b, BANK(UnknownScript_0x90205)
ld de, UnknownScript_0x90205
call Function2674
ret
; 90205 (24:4205)
UnknownScript_0x90205: ; 0x90205
2ptcall $d002
return
; 0x90209
UnknownScript_0x90209: ; 0x90209
2call UnknownScript_0x90657
return
; 0x9020d
Function9020d: ; 9020d (24:420d)
nop
nop
ld a, e
ld [$dbf9], a
and a
jr nz, .asm_9021d
ld a, BANK(Unknown_90233)
ld hl, Unknown_90233
jr .asm_90229
.asm_9021d
ld hl, PhoneContacts
ld bc, 12
ld a, e
call AddNTimes
ld a, BANK(PhoneContacts)
.asm_90229
ld de, $d03f
ld bc, 12
call FarCopyBytes
ret
; 90233 (24:4233)
Unknown_90233: ; 90233
db 0, 0
dbw BANK(UnknownScript_0x90238), UnknownScript_0x90238
UnknownScript_0x90238:
2writetext UnknownText_0x9023c
end
UnknownText_0x9023c:
text_jump UnknownText_0x1c5565
db "@"
; 90241
UnknownScript_0x90241: ; 0x90241
refreshscreen $0
3callasm Function9026f
2ptcall $d048
closetext
3callasm Function902eb
loadmovesprites
3callasm Function113e5
end
; 0x90255
UnknownScript_0x90255:: ; 0x90255
3callasm Function9025c
2jump UnknownScript_0x90241
; 0x9025c
Function9025c: ; 9025c
ld e, $3
jp Function9020d
; 90261
UnknownScript_0x90261: ; 0x90261
3callasm Function9026a
pause 30
2jump UnknownScript_0x90241
; 0x9026a
Function9026a: ; 9026a
ld e, $4
jp Function9020d
; 9026f
Function9026f: ; 9026f
call Function9027c
call Function9027c
callba Function1060d3
ret
; 9027c
Function9027c: ; 9027c (24:427c)
call Function9033f
call Function90357
call Function90292
call Function90357
call Function90375
call Function90357
call Function90292
ret
Function90292: ; 90292 (24:4292)
ld a, [$dbf9]
ld b, a
call Function90363
ret
Function9029a:: ; 9029a
ld a, b
ld [DefaultFlypoint], a
ld a, e
ld [$d003], a
ld a, d
ld [$d004], a
call Function902b3
call Function902b3
callba Function1060d3
ret
; 902b3
Function902b3: ; 902b3
call Function9033f
call Function90357
call Function902c9
call Function90357
call Function90375
call Function90357
call Function902c9
ret
; 902c9
Function902c9: ; 902c9
call Function90375
hlcoord 1, 2
ld [hl], $62
inc hl
inc hl
ld a, [$d002]
ld b, a
ld a, [$d003]
ld e, a
ld a, [$d004]
ld d, a
call Function90069
ret
; 902e3
Function902e3: ; 902e3 (24:42e3)
ld de, SFX_NO_SIGNAL
call PlaySFX
jr Function902f1
Function902eb:: ; 902eb
call Function9031d
call Function90355
Function902f1:
call Function9032f
call Function90355
call Function9033b
call Function90355
call Function9032f
call Function90355
call Function9033b
call Function90355
call Function9032f
call Function90355
call Function9033b
call Function90355
ret
; 90316
Function90316: ; 90316
ld de, SFX_SHUT_DOWN_PC
call PlaySFX
ret
; 9031d
Function9031d: ; 9031d
ld hl, UnknownText_0x9032a
call PrintText
ld de, SFX_HANG_UP
call PlaySFX
ret
; 9032a
UnknownText_0x9032a: ; 9032a
text_jump UnknownText_0x1c5580
db "@"
; 9032f
Function9032f: ; 9032f
ld hl, UnknownText_0x90336
call PrintText
ret
; 90336
UnknownText_0x90336: ; 0x90336
text_jump UnknownText_0x1c5588
db "@"
; 0x9033b
Function9033b: ; 9033b
call SpeechTextBox
ret
; 9033f
Function9033f: ; 9033f
call WaitSFX
ld de, SFX_CALL
call PlaySFX
call Function90375
call Function1ad2
callba Function4d188
ret
; 90355
Function90355: ; 90355
jr Function90357
Function90357
ld c, 20
call DelayFrames
callba Function4d188
ret
; 90363
Function90363: ; 90363 (24:4363)
push bc
call Function90375
hlcoord 1, 1
ld [hl], $62
inc hl
inc hl
ld d, h
ld e, l
pop bc
call Function90380
ret
Function90375: ; 90375
ld hl, TileMap
ld b, $2
ld c, $12
call TextBox
ret
; 90380
Function90380: ; 90380 (24:4380)
ld h, d
ld l, e
ld a, b
call Function9039a
call Function903a9
ret
Function9038a: ; 9038a (24:438a)
ld a, c
call Function9039a
ld a, c
ret nz
ld a, b
cp $1
ret z
cp $4
ret z
ld c, $1
ret
Function9039a: ; 9039a
push hl
ld hl, PhoneContacts
ld bc, 12
call AddNTimes
ld a, [hli]
ld b, [hl]
ld c, a
pop hl
ret
; 903a9
Function903a9: ; 903a9 (24:43a9)
ld a, c
and a
jr z, .asm_903c5
call Function90423
push hl
push bc
call PlaceString
ld a, ":"
ld [bc], a
pop bc
pop hl
ld de, 20 + 3
add hl, de
call Function9042e
call PlaceString
ret
.asm_903c5
push hl
ld c, b
ld b, 0
ld hl, Unknown_903d6
add hl, bc
add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
call PlaceString
ret
; 903d6 (24:43d6)
Unknown_903d6: ; 903d6
dw String_903e2
dw String_903ed
dw String_90402
dw String_903f2
dw String_903f8
dw String_9040d
String_903e2: db "----------@"
String_903ed: db "MOM:@"
String_903f2: db "BILL:@"
String_903f8: db "PROF.ELM:@"
String_90402: db "BIKE SHOP:@"
String_9040d: db "BUENA:", $22, " DISC JOCKEY@"
; 90423
Function90423: ; 90423 (24:4423)
push hl
push bc
callba Function3994c
pop bc
pop hl
ret
Function9042e: ; 9042e (24:442e)
push hl
push bc
callba Function3952d
pop bc
pop hl
ret
Function90439: ; 90439
ld a, [$dbf9]
call Function9039a
ld d, c
ld e, b
push de
ld a, [$dbf9]
ld hl, PhoneContacts + 2
ld bc, 12
call AddNTimes
ld b, [hl]
inc hl
ld c, [hl]
push bc
call GetWorldMapLocation
ld e, a
callba GetLandmarkName
pop bc
pop de
ret
; 9045f
PhoneContacts: ; 9045f
phone: MACRO
db \1, \2 ; trainer
map \3 ; map
db \4
dbw BANK(\5), \5 ; script 1
db \6
dbw BANK(\7), \7 ; script 2
ENDM
phone 0, 0, N_A, 0, UnusedPhoneScript, 0, UnusedPhoneScript
phone 0, 1, KRISS_HOUSE_1F, 7, MomPhoneScript, 0, UnusedPhoneScript
phone 0, 2, OAKS_LAB, 0, UnusedPhoneScript, 0, UnusedPhoneScript
phone 0, 3, N_A, 7, BillPhoneScript1, 0, BillPhoneScript2
phone 0, 4, ELMS_LAB, 7, ElmPhoneScript1, 0, ElmPhoneScript2
phone SCHOOLBOY, JACK1, NATIONAL_PARK, 7, UnknownScript_0xbd0d0, 7, UnknownScript_0xbd0fa
phone POKEFANF, BEVERLY1, NATIONAL_PARK, 7, UnknownScript_0xbd13f, 7, UnknownScript_0xbd158
phone SAILOR, HUEY1, OLIVINE_LIGHTHOUSE_2F, 7, UnknownScript_0xbd17c, 7, UnknownScript_0xbd1a9
phone 0, 0, N_A, 0, UnusedPhoneScript, 0, UnusedPhoneScript
phone 0, 0, N_A, 0, UnusedPhoneScript, 0, UnusedPhoneScript
phone 0, 0, N_A, 0, UnusedPhoneScript, 0, UnusedPhoneScript
phone COOLTRAINERM, GAVEN3, ROUTE_26, 7, UnknownScript_0xbd1da, 7, UnknownScript_0xbd204
phone COOLTRAINERF, BETH1, ROUTE_26, 7, UnknownScript_0xbd23d, 7, UnknownScript_0xbd267
phone BIRD_KEEPER, JOSE2, ROUTE_27, 7, UnknownScript_0xbd294, 7, UnknownScript_0xbd2cb
phone COOLTRAINERF, REENA1, ROUTE_27, 7, UnknownScript_0xbd31c, 7, UnknownScript_0xbd346
phone YOUNGSTER, JOEY1, ROUTE_30, 7, UnknownScript_0xbd373, 7, UnknownScript_0xbd3a0
phone BUG_CATCHER, WADE1, ROUTE_31, 7, UnknownScript_0xbd3d1, 7, UnknownScript_0xbd428
phone FISHER, RALPH1, ROUTE_32, 7, UnknownScript_0xbd4d2, 7, UnknownScript_0xbd509
phone PICNICKER, LIZ1, ROUTE_32, 7, UnknownScript_0xbd560, 7, UnknownScript_0xbd58d
phone HIKER, ANTHONY2, ROUTE_33, 7, UnknownScript_0xbd634, 7, UnknownScript_0xbd66b
phone CAMPER, TODD1, ROUTE_34, 7, UnknownScript_0xbd6c1, 7, UnknownScript_0xbd6f5
phone PICNICKER, GINA1, ROUTE_34, 7, UnknownScript_0xbd743, 7, UnknownScript_0xbd784
phone JUGGLER, IRWIN1, ROUTE_35, 7, UnknownScript_0xbd7e7, 7, UnknownScript_0xbd7fd
phone BUG_CATCHER, ARNIE1, ROUTE_35, 7, UnknownScript_0xbd813, 7, UnknownScript_0xbd84a
phone SCHOOLBOY, ALAN1, ROUTE_36, 7, UnknownScript_0xbd8a6, 7, UnknownScript_0xbd8dd
phone 0, 0, N_A, 0, UnusedPhoneScript, 0, UnusedPhoneScript
phone LASS, DANA1, ROUTE_38, 7, UnknownScript_0xbd930, 7, UnknownScript_0xbd967
phone SCHOOLBOY, CHAD1, ROUTE_38, 7, UnknownScript_0xbd9c6, 7, UnknownScript_0xbd9f0
phone POKEFANM, DEREK1, ROUTE_39, 7, UnknownScript_0xbda35, 7, UnknownScript_0xbda6e
phone FISHER, TULLY1, ROUTE_42, 7, UnknownScript_0xbdaac, 7, UnknownScript_0xbdae3
phone POKEMANIAC, BRENT1, ROUTE_43, 7, UnknownScript_0xbdb36, 7, UnknownScript_0xbdb60
phone PICNICKER, TIFFANY3, ROUTE_43, 7, UnknownScript_0xbdb99, 7, UnknownScript_0xbdbd0
phone BIRD_KEEPER, VANCE1, ROUTE_44, 7, UnknownScript_0xbdc73, 7, UnknownScript_0xbdc9d
phone FISHER, WILTON1, ROUTE_44, 7, UnknownScript_0xbdcce, 7, UnknownScript_0xbdd05
phone BLACKBELT_T, KENJI3, ROUTE_45, 7, UnknownScript_0xbdd71, 7, UnknownScript_0xbdd7d
phone HIKER, PARRY1, ROUTE_45, 7, UnknownScript_0xbdd89, 7, UnknownScript_0xbddb3
phone PICNICKER, ERIN1, ROUTE_46, 7, UnknownScript_0xbdde4, 7, UnknownScript_0xbde0e
phone 0, 5, GOLDENROD_DEPT_STORE_ROOF, 7, UnknownScript_0xa0b14, 7, UnknownScript_0xa0b26
; 90627
Unknown_90627: ; 90627
dw Function90188
db $04
dbw BANK(ElmPhoneScript2), ElmPhoneScript2
dw Function90188
db $04
dbw BANK(ElmPhoneScript2), ElmPhoneScript2
dw Function90188
db $04
dbw BANK(ElmPhoneScript2), ElmPhoneScript2
dw Function90188
db $04
dbw BANK(ElmPhoneScript2), ElmPhoneScript2
dw Function90197
db $04
dbw BANK(ElmPhoneScript2), ElmPhoneScript2
dw Function90197
db $02
dbw BANK(UnknownScript_0xa0b09), UnknownScript_0xa0b09 ; bike shop
dw Function90197
db $01
dbw BANK(MomPhoneLectureScript), MomPhoneLectureScript
dw Function90188
db $04
dbw BANK(ElmPhoneScript2), ElmPhoneScript2
; 90657
UnknownScript_0x90657: ; 0x90657
2writetext UnknownText_0x9065b
end
; 0x9065b
UnknownText_0x9065b: ; 0x9065b
; That number is out of the area.
text_jump UnknownText_0x1c558b
db "@"
; 0x90660
UnknownScript_0x90660: ; 0x90660
2writetext UnknownText_0x90664
end
; 0x90664
UnknownText_0x90664: ; 0x90664
; Just go talk to that person!
text_jump UnknownText_0x1c55ac
db "@"
; 0x90669
UnknownScript_0x90669: ; 0x90669
2writetext UnknownText_0x9066d
end
; 0x9066d
UnknownText_0x9066d: ; 0x9066d
; Thank you!
text_jump UnknownText_0x1c55ca
db "@"
; 0x90672
Function90672: ; 90672 (24:4672)
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
ld a, $0
ld [$c2ce], a
ld a, $10
ld [MusicFade], a
ld a, MUSIC_NONE % $100
ld [MusicFadeIDLo], a
ld a, MUSIC_NONE / $100
ld [MusicFadeIDHi], a
ld c, 8
call DelayFrames
call Function4dd
call ClearTileMap
call ClearSprites
ld b, $8
call GetSGBLayout
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Functione51
ld de, GFX_908fb
ld hl, $9000
lb bc, BANK(GFX_908fb), 1
call Request1bpp
ld de, GFX_90903
ld hl, $9010
lb bc, BANK(GFX_90903), 1
call Request1bpp
ld de, GFX_9090b
ld hl, $9020
lb bc, BANK(GFX_9090b), 1
call Request1bpp
call Function90783
call WaitBGMap
call Function4a3
ld hl, UnknownText_0x90874
call PrintText
ld hl, $c608
ld bc, $32
xor a
call ByteFill
ld a, $a
ld [$c61c], a
.asm_906e8
ld hl, UnknownText_0x90879
call PrintText
hlcoord 3, 7
ld b, $2
ld c, $f
call TextBox
hlcoord 11, 7
ld [hl], $1
hlcoord 11, 10
ld [hl], $2
hlcoord 4, 9
call Function907de
ld c, $a
call DelayFrames
.asm_9070d
call Functiona57
call Function90795
jr nc, .asm_9070d
ld a, [$c61c]
ld [$d087], a
call Function90783
ld hl, UnknownText_0x90886
call PrintText
call YesNoBox
jr nc, .asm_9072e
call Function90783
jr .asm_906e8
.asm_9072e
ld hl, UnknownText_0x9089a
call PrintText
hlcoord 11, 7
ld bc, $207
call TextBox
hlcoord 15, 7
ld [hl], $1
hlcoord 15, 10
ld [hl], $2
hlcoord 12, 9
call Function90859
ld c, 10
call DelayFrames
.asm_90752
call Functiona57
call Function90810
jr nc, .asm_90752
ld a, [$c626]
ld [$d088], a
call Function90783
ld hl, UnknownText_0x908a4
call PrintText
call YesNoBox
jr nc, .asm_90773
call Function90783
jr .asm_9072e
.asm_90773
call Function658
ld hl, UnknownText_0x908b8
call PrintText
call Functiona80
pop af
ld [$FF00+$aa], a
ret
Function90783: ; 90783 (24:4783)
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
xor a
call ByteFill
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
Function90795: ; 90795 (24:4795)
ld a, [hJoyPressed]
and A_BUTTON
jr nz, .asm_907dc
ld hl, $ffa9
ld a, [hl]
and D_UP
jr nz, .up
ld a, [hl]
and D_DOWN
jr nz, .down
call DelayFrame
and a
ret
.down
ld hl, $c61c
ld a, [hl]
and a
jr nz, .asm_907b6
ld a, 23 + 1
.asm_907b6
dec a
ld [hl], a
jr .asm_907c6
.up
ld hl, $c61c
ld a, [hl]
cp 23
jr c, .asm_907c4
ld a, -1
.asm_907c4
inc a
ld [hl], a
.asm_907c6
hlcoord 4, 9
ld a, " "
ld bc, 15
call ByteFill
hlcoord 4, 9
call Function907de
call WaitBGMap
and a
ret
.asm_907dc
scf
ret
Function907de: ; 907de (24:47de)
push hl
ld a, [$c61c]
ld c, a
ld e, l
ld d, h
call Function90b3e
inc hl
ld de, String_9087e
call PlaceString
pop hl
ret
; 907f1 (24:47f1)
Function907f1: ; 907f1
ld h, d
ld l, e
push hl
call Function907de
pop de
inc de
inc de
ld a, $9c
ld [de], a
inc de
push de
ld hl, $0003
add hl, de
ld a, [de]
inc de
ld [hli], a
ld a, [de]
ld [hl], a
pop hl
call Function90859
inc hl
inc hl
inc hl
ret
; 90810
Function90810: ; 90810 (24:4810)
ld a, [hJoyPressed] ; $ff00+$a7
and $1
jr nz, .asm_90857
ld hl, $ffa9
ld a, [hl]
and D_UP
jr nz, .asm_90835
ld a, [hl]
and D_DOWN
jr nz, .asm_90828
call DelayFrame
and a
ret
.asm_90828
ld hl, $c626
ld a, [hl]
and a
jr nz, .asm_90831
ld a, 59 + 1
.asm_90831
dec a
ld [hl], a
jr .asm_90841
.asm_90835
ld hl, $c626
ld a, [hl]
cp 59
jr c, .asm_9083f
ld a, -1
.asm_9083f
inc a
ld [hl], a
.asm_90841
hlcoord 12, 9
ld a, " "
ld bc, 7
call ByteFill
hlcoord 12, 9
call Function90859
call WaitBGMap
and a
ret
.asm_90857
scf
ret
Function90859: ; 90859 (24:4859)
ld de, $c626
call Function90867
inc hl
ld de, String_9089f
call PlaceString
ret
Function90867: ; 90867 (24:4867)
push hl
ld a, " "
ld [hli], a
ld [hl], a
pop hl
ld bc, $4102
call PrintNum
ret
; 90874 (24:4874)
UnknownText_0x90874: ; 0x90874
; Zzz… Hm? Wha…? You woke me up! Will you check the clock for me?
text_jump UnknownText_0x1bc29c
db "@"
; 0x90879
UnknownText_0x90879: ; 0x90879
; What time is it?
text_jump UnknownText_0x1bc2eb
db "@"
; 0x9087e
String_9087e:
db "o'clock@"
; 90886
UnknownText_0x90886: ; 0x90886
; What?@ @
text_jump UnknownText_0x1bc2fd
start_asm
hlcoord 1, 16
call Function907de
ld hl, UnknownText_0x90895
ret
; 90895 (24:4895)
UnknownText_0x90895: ; 0x90895
; ?
text_jump UnknownText_0x1bc305
db "@"
; 0x9089a
UnknownText_0x9089a: ; 0x9089a
; How many minutes?
text_jump UnknownText_0x1bc308
db "@"
; 0x9089f
String_9089f:
db "min.@"
; 908a4
UnknownText_0x908a4: ; 0x908a4
; Whoa!@ @
text_jump UnknownText_0x1bc31b
start_asm
; 0x908a9
hlcoord 7, 14
call Function90859
ld hl, UnknownText_0x908b3
ret
; 908b3 (24:48b3)
UnknownText_0x908b3: ; 0x908b3
; ?
text_jump UnknownText_0x1bc323
db "@"
; 0x908b8
UnknownText_0x908b8: ; 0x908b8
start_asm
decoord 1, 14
ld a, [$c61c]
ld c, a
call Function90b3e
ld [hl], ":"
inc hl
ld de, $c626
ld bc, $8102
call PrintNum
ld b, h
ld c, l
ld a, [$c61c]
cp 4
jr c, .asm_908e0
cp 11
jr c, .asm_908e4
cp 18
jr c, .asm_908e8
.asm_908e0
ld hl, UnknownText_0x908f6
ret
.asm_908e4
ld hl, UnknownText_0x908ec
ret
.asm_908e8
ld hl, UnknownText_0x908f1
ret
; 908ec (24:48ec)
UnknownText_0x908ec: ; 0x908ec
; ! I overslept!
text_jump UnknownText_0x1bc326
db "@"
; 0x908f1
UnknownText_0x908f1: ; 0x908f1
; ! Yikes! I over- slept!
text_jump UnknownText_0x1bc336
db "@"
; 0x908f6
UnknownText_0x908f6: ; 0x908f6
; ! No wonder it's so dark!
text_jump UnknownText_0x1bc34f
db "@"
; 0x908fb
GFX_908fb: ; 908fb
INCBIN "baserom.gbc", $908fb, $90903 - $908fb
GFX_90903: ; 90903
INCBIN "baserom.gbc",$90903,$9090b - $90903
GFX_9090b: ; 9090b
INCBIN "baserom.gbc",$9090b,$90913 - $9090b
; 90913
Function90913: ; 90913
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
ld de, GFX_90903
ld hl, $8ef0
lb bc, BANK(GFX_90903), 1
call Request1bpp
ld de, GFX_9090b
ld hl, $8f50
lb bc, BANK(GFX_9090b), 1
call Request1bpp
xor a
ld [DefaultFlypoint], a
.asm_90936
hlcoord 0, 12
ld bc, $0412
call TextBox
call Function1d6e
ld hl, UnknownText_0x90a3f
call PrintText
hlcoord 9, 3
ld b, $2
ld c, $9
call TextBox
hlcoord 14, 3
ld [hl], $ef
hlcoord 14, 6
ld [hl], $f5
hlcoord 10, 5
call Function909de
call Function321c
ld c, $a
call DelayFrames
.asm_9096a
call Functiona57
call Function90993
jr nc, .asm_9096a
call Function1c07
call Function1ad2
ld hl, UnknownText_0x90a44
call PrintText
call YesNoBox
jr c, .asm_90936
ld a, [DefaultFlypoint]
ld [StringBuffer2], a
call Function663
call Functione51
pop af
ld [$ffaa], a
ret
; 90993
Function90993: ; 90993
ld a, [hJoyPressed]
and A_BUTTON
jr z, .asm_9099b
scf
ret
.asm_9099b
ld hl, $ffa9
ld a, [hl]
and D_UP
jr nz, .asm_909ba
ld a, [hl]
and D_DOWN
jr nz, .asm_909ad
call DelayFrame
and a
ret
.asm_909ad
ld hl, $d002
ld a, [hl]
and a
jr nz, .asm_909b6
ld a, 6 + 1
.asm_909b6
dec a
ld [hl], a
jr .asm_909c6
.asm_909ba
ld hl, $d002
ld a, [hl]
cp 6
jr c, .asm_909c4
ld a, -1
.asm_909c4
inc a
ld [hl], a
.asm_909c6
xor a
ld [hBGMapMode], a
hlcoord 10, 4
ld b, $2
ld c, $9
call ClearBox
hlcoord 10, 5
call Function909de
call WaitBGMap
and a
ret
; 909de
Function909de: ; 909de
push hl
ld a, [$d002]
ld e, a
ld d, 0
ld hl, Unknown_909f2
add hl, de
add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
call PlaceString
ret
; 909f2
Unknown_909f2: ; 909f2
dw Sunday
dw Monday
dw Tuesday
dw Wednesday
dw Thursday
dw Friday
dw Saturday
dw Sunday
Sunday: db " SUNDAY@"
Monday: db " MONDAY@"
Tuesday: db " TUESDAY@"
Wednesday: db "WEDNESDAY@"
Thursday: db "THURSDAY@"
Friday: db " FRIDAY@"
Saturday: db "SATURDAY@"
UnknownText_0x90a3f: ; 0x90a3f
; What day is it?
text_jump UnknownText_0x1bc369
db "@"
; 0x90a44
UnknownText_0x90a44: ; 0x90a44
start_asm
hlcoord 1, 14
call Function909de
ld hl, UnknownText_0x90a4f
ret
; 90a4f (24:4a4f)
UnknownText_0x90a4f: ; 0x90a4f
; , is it?
text_jump UnknownText_0x1bc37a
db "@"
; 0x90a54
Function90a54: ; 90a54
ld a, [wDST]
set 7, a
ld [wDST], a
hlcoord 1, 14
ld bc, $0312
call ClearBox
ld hl, UnknownText_0x90a6c
call Function13e5
ret
; 90a6c
UnknownText_0x90a6c: ; 90a6c
start_asm
call UpdateTime
ld a, [hHours] ; $ff00+$94
ld b, a
ld a, [hMinutes] ; $ff00+$96
ld c, a
decoord 1, 14
callba Function1dd6bb
ld hl, UnknownText_0x90a83
ret
; 90a83 (24:4a83)
UnknownText_0x90a83: ; 0x90a83
; DST, is that OK?
text_jump UnknownText_0x1c5fde
db "@"
; 0x90a88
Function90a88: ; 90a88
ld a, [wDST]
res 7, a
ld [wDST], a
hlcoord 1, 14
ld bc, $0312
call ClearBox
ld hl, UnknownText_0x90aa0
call Function13e5
ret
; 90aa0
UnknownText_0x90aa0: ; 90aa0
start_asm
call UpdateTime
ld a, [hHours]
ld b, a
ld a, [hMinutes]
ld c, a
decoord 1, 14
callba Function1dd6bb
ld hl, UnknownText_0x90ab7
ret
; 90ab7
UnknownText_0x90ab7: ; 0x90ab7
; , is that OK?
text_jump UnknownText_0x1c5ff1
db "@"
; 0x90abc
Function90abc: ; 90abc
hlcoord 1, 14
ld bc, $0312
call ClearBox
ld hl, UnknownText_0x90acc
call Function13e5
ret
; 90acc
UnknownText_0x90acc: ; 0x90acc
start_asm
call UpdateTime
hlcoord 1, 14
ld [hl], "R"
inc hl
ld [hl], "T"
inc hl
ld [hl], " "
inc hl
ld de, hRTCDayLo
call Function90b23
hlcoord 1, 16
ld [hl], "D"
inc hl
ld [hl], "F"
inc hl
ld [hl], " "
inc hl
ld de, StartDay
call Function90b23
ld [hl], " "
inc hl
ld a, [wDST]
bit 7, a
jr z, .off
ld [hl], "O"
inc hl
ld [hl], "N"
inc hl
jr .done
.off
ld [hl], "O"
inc hl
ld [hl], "F"
inc hl
ld [hl], "F"
inc hl
.done
ld hl, UnknownText_0x90b13
ret
; 90b13
UnknownText_0x90b13: ; 0x90b13
db $0
para "Now on DEBUG…"
prompt
; 0x90b23
Function90b23: ; 90b23
ld bc, $0103
call PrintNum
ld [hl], "."
inc hl
inc de
ld bc, $8102
call PrintNum
ld [hl], ":"
inc hl
inc de
ld bc, $8102
call PrintNum
ret
; 90b3e
Function90b3e: ; 90b3e (24:4b3e)
ld l, e
ld h, d
push bc
call Function90b58
call PlaceString
ld l, c
ld h, b
inc hl
pop bc
call Function90b7f
ld [$d265], a
ld de, $d265
call Function90867
ret
Function90b58: ; 90b58 (24:4b58)
ld a, c
cp 4
jr c, .nite
cp 10
jr c, .morn
cp 18
jr c, .day
.nite
ld de, String_90b71
ret
.morn
ld de, String_90b76
ret
.day
ld de, String_90b7b
ret
; 90b71 (24:4b71)
String_90b71: db "NITE@"
String_90b76: db "MORN@"
String_90b7b: db "DAY@"
; 90b7f
Function90b7f: ; 90b7f (24:4b7f)
ld a, c
or a
jr z, .asm_90b8a
cp 12
ret c
ret z
sub 12
ret
.asm_90b8a
ld a, 12
ret
Function90b8d: ; 90b8d (24:4b8d)
ld hl, Options
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
ld a, [VramState]
push af
xor a
ld [VramState], a
call Function90bea
call DelayFrame
.loop
call UpdateTime
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .done
call Function90f04
callba Function8cf69
call DelayFrame
jr .loop
.done
ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
pop af
ld [VramState], a
pop af
ld [$ffaa], a
pop af
ld [Options], a
call WhiteBGMap
xor a
ld [hBGMapAddress], a
ld a, $98
ld [hBGMapAddress + 1], a
ld a, $90
ld [hWY], a
call Function91492
ret
Function90bea: ; 90bea (24:4bea)
call WhiteBGMap
call ClearTileMap
call ClearSprites
call DisableLCD
xor a
ld [hSCY], a
ld [hSCX], a
ld a, $7
ld [hWX], a
call Function90c4e
callba Function8cf53
call Function90d32
ld a, 8
call SkipMusic
ld a, $e3
ld [rLCDC], a
call Function90d70
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
ld [$c6d2], a
ld [$c6d1], a
ld [$c6d3], a
ld [$c6d9], a
ld [$c6da], a
ld [$c6db], a
call Function90d9e
call Function90da8
ld b, $2
call GetSGBLayout
call Function32f9
ld a, [hCGB]
and a
ret z
ld a, $e4
call Functioncf8
ret
Function90c4e: ; 90c4e
call Functiond79
ld hl, TownMapGFX
ld de, VTiles2
ld a, BANK(TownMapGFX)
call FarDecompress
ld hl, PokegearGFX
ld de, VTiles2 + $300
ld a, BANK(PokegearGFX)
call FarDecompress
ld hl, PokegearSpritesGFX
ld de, VTiles0
ld a, BANK(PokegearSpritesGFX)
call Decompress
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
cp FAST_SHIP
jr z, .ssaqua
callba GetPlayerIcon
push de
ld h, d
ld l, e
ld a, b
push af
ld de, $8100
ld bc, $40
call FarCopyBytes
pop af
pop hl
ld de, $c0
add hl, de
ld de, $8140
ld bc, $40
call FarCopyBytes
ret
.ssaqua
ld hl, FastShipGFX
ld de, $8100
ld bc, $80
call CopyBytes
ret
; 90cb2
FastShipGFX: ; 90cb2
INCBIN "gfx/misc/fast_ship.2bpp"
; 90d32
Function90d32: ; 90d32 (24:4d32)
ld de, $2410
ld a, $d
call Function3b2a
ld hl, $3
add hl, bc
ld [hl], $0
ret
Function90d41: ; 90d41 (24:4d41)
ld hl, $cf64
ld e, [hl]
ld d, 0
ld hl, Unknown_90d52
add hl, de
ld a, [hl]
ld hl, $6
add hl, bc
ld [hl], a
ret
; 90d52 (24:4d52)
Unknown_90d52: ; 90d52
db $00, $10, $20, $30
; 90d56
Function90d56: ; 90d56
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
cp SPECIAL_MAP
ret nz
ld a, [BackupMapGroup]
ld b, a
ld a, [BackupMapNumber]
ld c, a
call GetWorldMapLocation
ret
; 90d70
Function90d70: ; 90d70 (24:4d70)
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
cp FAST_SHIP
jr z, .asm_90d95
cp SPECIAL_MAP
jr nz, .asm_90d8e
ld a, [BackupMapGroup]
ld b, a
ld a, [BackupMapNumber]
ld c, a
call GetWorldMapLocation
.asm_90d8e
ld [$c6d8], a
ld [$c6d7], a
ret
.asm_90d95
ld [$c6d8], a
ld a, NEW_BARK_TOWN
ld [$c6d7], a
ret
Function90d9e: ; 90d9e (24:4d9e)
ld a, $0
ld [$cf63], a
xor a
ld [$cf64], a
ret
Function90da8: ; 90da8 (24:4da8)
xor a
ld [hBGMapMode], a
ld hl, TileMap
ld bc, TileMapEnd - TileMap
ld a, $4f
call ByteFill
ld a, [$cf64]
and $3
add a
ld e, a
ld d, 0
ld hl, Jumptable_90e12
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .asm_90dcb
push de
jp [hl]
.asm_90dcb
call Function90eb0
callba TownMapPals
ld a, [$cf65]
and a
jr nz, .asm_90de8
xor a
ld [hBGMapAddress], a
ld a, $98
ld [hBGMapAddress + 1], a
call Function90e00
ld a, $90
jr .asm_90df3
.asm_90de8
xor a
ld [hBGMapAddress], a
ld a, $9c
ld [hBGMapAddress + 1], a
call Function90e00
xor a
.asm_90df3
ld [hWY], a
ld a, [$cf65]
and 1
xor 1
ld [$cf65], a
ret
Function90e00: ; 90e00 (24:4e00)
ld a, [hCGB] ; $ff00+$e6
and a
jr z, .asm_90e0e
ld a, $2
ld [hBGMapMode], a ; $ff00+$d4
ld c, $3
call DelayFrames
.asm_90e0e
call WaitBGMap
ret
; 90e12 (24:4e12)
Jumptable_90e12: ; 90e12
dw Function90e1a
dw Function90e3f
dw Function90e82
dw Function90e72
; 90e1a
Function90e1a: ; 90e1a
ld de, ClockTilemapRLE
call Function914bb
hlcoord 12, 1
ld de, .switch
call PlaceString
hlcoord 0, 12
lb bc, 4, 18
call TextBox
call Function90f86
ret
; 90e36 (24:4e36)
.switch
db " SWITCH▶@"
; 90e3f
Function90e3f: ; 90e3f
ld a, [$c6d8]
cp FAST_SHIP
jr z, .johto
cp KANTO_LANDMARK
jr nc, .kanto
.johto
ld e, 0
jr .ok
.kanto
ld e, 1
.ok
callba Function91ae1
ld a, $7
ld bc, $12
hlcoord 1, 2
call ByteFill
hlcoord 0, 2
ld [hl], $6
hlcoord 19, 2
ld [hl], $17
ld a, [$c6d7]
call Function910b4
ret
; 90e72
Function90e72: ; 90e72
ld de, RadioTilemapRLE
call Function914bb
hlcoord 0, 12
ld bc, $412
call TextBox
ret
; 90e82
Function90e82: ; 90e82
ld de, PhoneTilemapRLE
call Function914bb
hlcoord 0, 12
ld bc, $412
call TextBox
call Function90e98
call Function912d8
ret
; 90e98
Function90e98: ; 90e98 (24:4e98)
hlcoord 17, 1
ld a, $3c
ld [hli], a
inc a
ld [hl], a
hlcoord 17, 2
inc a
ld [hli], a
call Function2d05
and a
ret nz
hlcoord 18, 2
ld [hl], $3f
ret
Function90eb0: ; 90eb0 (24:4eb0)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $8
ld a, $4f
call ByteFill
hlcoord 0, 1
ld bc, $8
ld a, $4f
call ByteFill
ld de, $d957
ld a, [de]
bit 0, a
call nz, Function90ee4
ld a, [de]
bit 2, a
call nz, Function90eeb
ld a, [de]
bit 1, a
call nz, Function90ef2
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld a, $46
call Function90ef7
ret
Function90ee4: ; 90ee4 (24:4ee4)
hlcoord 2, 0
ld a, $40
jr Function90ef7
Function90eeb: ; 90eeb (24:4eeb)
hlcoord 4, 0
ld a, $44
jr Function90ef7
Function90ef2: ; 90ef2 (24:4ef2)
hlcoord 6, 0
ld a, $42
Function90ef7: ; 90ef7 (24:4ef7)
ld [hli], a
inc a
ld [hld], a
ld bc, $14
add hl, bc
add $f
ld [hli], a
inc a
ld [hld], a
ret
Function90f04: ; 90f04 (24:4f04)
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_90f13
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_90f13: ; 90f13 (24:4f13)
dw Function90f2d
dw Function90f3e
dw Function90fb4
dw Function90fcd
dw Function90fee
dw Function90fcd
dw Function90fe9
dw Function91156
dw Function91171
dw Function911eb
dw Function91256
dw Function910f9
dw Function91112
Function90f2d: ; 90f2d (24:4f2d)
call Function90da8
ld hl, UnknownText_0x914d3
call PrintText
ld hl, $cf63
inc [hl]
call Function91492
ret
Function90f3e: ; 90f3e (24:4f3e)
call Function90f7b
ld hl, $ffa9
ld a, [hl]
and A_BUTTON + B_BUTTON + START + SELECT
jr nz, .asm_90f75
ld a, [hl]
and D_RIGHT
ret z
ld a, [$d957]
bit 0, a
jr z, .asm_90f5a
ld c, $2
ld b, $1
jr .asm_90f71
.asm_90f5a
ld a, [$d957]
bit 2, a
jr z, .asm_90f67
ld c, $7
ld b, $2
jr .asm_90f71
.asm_90f67
ld a, [$d957]
bit 1, a
ret z
ld c, $b
ld b, $3
.asm_90f71
call Function91480
ret
.asm_90f75
ld hl, $cf63
set 7, [hl]
ret
Function90f7b: ; 90f7b (24:4f7b)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Function90f86
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
Function90f86: ; 90f86 (24:4f86)
hlcoord 3, 5
lb bc, 5, 14
call ClearBox
ld a, [hHours] ; $ff00+$94
ld b, a
ld a, [hMinutes] ; $ff00+$96
ld c, a
decoord 6, 8
callba Function1dd6bb
ld hl, UnknownText_0x90faf
bccoord 6, 6
call Function13e5
ret
; 90fa8 (24:4fa8)
String_90fa8: db "ごぜん@"
String_90fac: db "ごご@"
UnknownText_0x90faf: ; 0x90faf
text_jump UnknownText_0x1c5821
db "@"
; 0x90fb4
Function90fb4: ; 90fb4 (24:4fb4)
ld a, [$c6d8]
cp FAST_SHIP
jr z, .johto
cp KANTO_LANDMARK
jr nc, .kanto
.johto
ld a, 3
jr .done
ret
.kanto
ld a, 5
.done
ld [$cf63], a
call Function91492
ret
Function90fcd: ; 90fcd (24:4fcd)
call Function90da8
ld a, [$c6d8]
call Function9106a
ld a, [$c6d7]
call Function91098
ld a, c
ld [$c6d5], a
ld a, b
ld [$c6d6], a
ld hl, $cf63
inc [hl]
ret
Function90fe9: ; 90fe9 (24:4fe9)
call Function910e8
jr Function90ff2
Function90fee: ; 90fee (24:4fee)
ld d, $2e
ld e, $1
Function90ff2: ; 90ff2 (24:4ff2)
ld hl, $ffa9
ld a, [hl]
and B_BUTTON
jr nz, .cancel
ld a, [hl]
and D_RIGHT
jr nz, .right
ld a, [hl]
and D_LEFT
jr nz, .left
call Function9102f
ret
.right
ld a, [$d957]
bit 2, a
jr z, .asm_91015
ld c, $7
ld b, $2
jr .done
.asm_91015
ld a, [$d957]
bit 1, a
ret z
ld c, $b
ld b, $3
jr .done
.left
ld c, $0
ld b, $0
.done
call Function91480
ret
.cancel
ld hl, $cf63
set 7, [hl]
ret
Function9102f: ; 9102f (24:502f)
ld hl, $ffa9
ld a, [hl]
and D_UP
jr nz, .up
ld a, [hl]
and D_DOWN
jr nz, .down
ret
.up
ld hl, $c6d7
ld a, [hl]
cp d
jr c, .asm_91047
ld a, e
dec a
ld [hl], a
.asm_91047
inc [hl]
jr .done
.down
ld hl, $c6d7
ld a, [hl]
cp e
jr nz, .asm_91054
ld a, d
inc a
ld [hl], a
.asm_91054
dec [hl]
.done
ld a, [$c6d7]
call Function910b4
ld a, [$c6d5]
ld c, a
ld a, [$c6d6]
ld b, a
ld a, [$c6d7]
call Function910d4
ret
Function9106a: ; 9106a
push af
ld de, $0000
ld b, $a
ld a, [PlayerGender]
bit 0, a
jr z, .asm_91079
ld b, $1e
.asm_91079
ld a, b
call Function3b2a
ld hl, $0003
add hl, bc
ld [hl], $10
pop af
ld e, a
push bc
callba GetLandmarkCoords
pop bc
ld hl, $0004
add hl, bc
ld [hl], e
ld hl, $0005
add hl, bc
ld [hl], d
ret
; 91098
Function91098: ; 91098
push af
ld de, $0000
ld a, $d
call Function3b2a
ld hl, $0003
add hl, bc
ld [hl], $4
ld hl, $0002
add hl, bc
ld [hl], $0
pop af
push bc
call Function910d4
pop bc
ret
; 910b4
Function910b4: ; 910b4
push af
hlcoord 8, 0
lb bc, 2, 12
call ClearBox
pop af
ld e, a
push de
callba GetLandmarkName
pop de
callba Function1de2c5
hlcoord 8, 0
ld [hl], $34
ret
; 910d4
Function910d4: ; 910d4
push bc
ld e, a
callba GetLandmarkCoords
pop bc
ld hl, $0004
add hl, bc
ld [hl], e
ld hl, $0005
add hl, bc
ld [hl], d
ret
; 910e8
Function910e8: ; 910e8
ld a, [StatusFlags]
bit 6, a
jr z, .asm_910f4
ld d, $5e
ld e, $2f
ret
.asm_910f4
ld d, $5e
ld e, $58
ret
; 910f9
Function910f9: ; 910f9 (24:50f9)
call Function90da8
ld de, $2454
ld a, $14
call Function3b2a
ld hl, $3
add hl, bc
ld [hl], $8
call Function9163e
ld hl, $cf63
inc [hl]
ret
Function91112: ; 91112 (24:5112)
ld hl, $ffa9
ld a, [hl]
and B_BUTTON
jr nz, .cancel
ld a, [hl]
and D_LEFT
jr nz, .left
ld a, [$c6da]
ld l, a
ld a, [$c6db]
ld h, a
ld a, [$c6d9]
and a
ret z
rst FarCall
ret
.left
ld a, [$d957]
bit 2, a
jr z, .asm_9113b
ld c, $7
ld b, $2
jr .asm_9114c
.asm_9113b
ld a, [$d957]
bit 0, a
jr z, .asm_91148
ld c, $2
ld b, $1
jr .asm_9114c
.asm_91148
ld c, $0
ld b, $0
.asm_9114c
call Function91480
ret
.cancel
ld hl, $cf63
set 7, [hl]
ret
Function91156: ; 91156 (24:5156)
ld hl, $cf63
inc [hl]
xor a
ld [$c6d2], a
ld [$c6d1], a
ld [$c6d3], a
call Function90da8
call Function91492
ld hl, UnknownText_0x914ce
call PrintText
ret
Function91171: ; 91171 (24:5171)
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
jr nz, .b
ld a, [hl]
and A_BUTTON
jr nz, .a
ld hl, $ffa9
ld a, [hl]
and D_LEFT
jr nz, .left
ld a, [hl]
and D_RIGHT
jr nz, .right
call Function9126d
ret
.left
ld a, [$d957]
bit 0, a
jr z, .asm_9119c
ld c, $2
ld b, $1
jr .asm_911ac
.asm_9119c
ld c, $0
ld b, $0
jr .asm_911ac
.right
ld a, [$d957]
bit 1, a
ret z
ld c, $b
ld b, $3
.asm_911ac
call Function91480
ret
.b
ld hl, $cf63
set 7, [hl]
ret
.a
ld hl, $dc7c
ld a, [$c6d2]
ld e, a
ld d, 0
add hl, de
ld a, [$c6d1]
ld e, a
ld d, 0
add hl, de
ld a, [hl]
and a
ret z
ld [$c6d3], a
hlcoord 1, 4
ld a, [$c6d1]
ld bc, 20 * 2
call AddNTimes
ld [hl], "▷"
call Function91342
jr c, .asm_911e5
ld hl, $cf63
inc [hl]
ret
.asm_911e5
ld a, $8
ld [$cf63], a
ret
Function911eb: ; 911eb (24:51eb)
call Function2d05
and a
jr nz, .asm_91234
ld hl, Options
res NO_TEXT_SCROLL, [hl]
xor a
ld [$ffaa], a
ld de, SFX_CALL
call PlaySFX
ld hl, UnknownText_0x9124c
call PrintText
call WaitSFX
ld de, SFX_CALL
call PlaySFX
ld hl, UnknownText_0x9124c
call PrintText
call WaitSFX
ld a, [$c6d3]
ld b, a
call Function90199
ld c, 10
call DelayFrames
ld hl, Options
set NO_TEXT_SCROLL, [hl]
ld a, $1
ld [$ffaa], a
call Function912b7
ld hl, $cf63
inc [hl]
ret
.asm_91234
callba Function902e3
ld hl, OutOfServiceAreaText
call PrintText
ld a, $8
ld [$cf63], a
ld hl, UnknownText_0x914ce
call PrintText
ret
; 9124c (24:524c)
UnknownText_0x9124c: ; 0x9124c
;
text_jump UnknownText_0x1c5824
db "@"
; 0x91251
OutOfServiceAreaText: ; 0x91251
; You're out of the service area.
text_jump UnknownText_0x1c5827
db "@"
; 0x91256
Function91256: ; 91256 (24:5256)
ld a, [hJoyPressed] ; $ff00+$a7
and $3
ret z
callba Function902eb
ld a, $8
ld [$cf63], a
ld hl, UnknownText_0x914ce
call PrintText
ret
Function9126d: ; 9126d (24:526d)
ld hl, $ffa9
ld a, [hl]
and D_UP
jr nz, .up
ld a, [hl]
and D_DOWN
jr nz, .down
ret
.up
ld hl, $c6d1
ld a, [hl]
and a
jr z, .asm_91285
dec [hl]
jr .asm_912a3
.asm_91285
ld hl, $c6d2
ld a, [hl]
and a
ret z
dec [hl]
jr .asm_912ad
.down
ld hl, $c6d1
ld a, [hl]
cp $3
jr nc, .asm_91299
inc [hl]
jr .asm_912a3
.asm_91299
ld hl, $c6d2
ld a, [hl]
cp $6
ret nc
inc [hl]
jr .asm_912ad
.asm_912a3
xor a
ld [hBGMapMode], a
call Function912b7
call WaitBGMap
ret
.asm_912ad
xor a
ld [hBGMapMode], a
call Function912d8
call WaitBGMap
ret
Function912b7: ; 912b7 (24:52b7)
ld a, " "
hlcoord 1, 4
ld [hl], a
hlcoord 1, 6
ld [hl], a
hlcoord 1, 8
ld [hl], a
hlcoord 1, 10
ld [hl], a
hlcoord 1, 4
ld a, [$c6d1]
ld bc, $28
call AddNTimes
ld [hl], "▶"
ret
Function912d8: ; 912d8 (24:52d8)
hlcoord 1, 3
ld b, $9
ld a, $7f
.asm_912df
ld c, $12
.asm_912e1
ld [hli], a
dec c
jr nz, .asm_912e1
inc hl
inc hl
dec b
jr nz, .asm_912df
ld a, [$c6d2]
ld e, a
ld d, $0
ld hl, $dc7c
add hl, de
xor a
ld [$c6d0], a
.asm_912f8
ld a, [hli]
push hl
push af
hlcoord 2, 4
ld a, [$c6d0]
ld bc, $28
call AddNTimes
ld d, h
ld e, l
pop af
ld b, a
call Function90380
pop hl
ld a, [$c6d0]
inc a
ld [$c6d0], a
cp $4
jr c, .asm_912f8
call Function912b7
ret
; 9131e (24:531e)
Function9131e: ; 9131e
ld hl, $dc7c
ld a, [$c6d2]
ld e, a
ld d, 0
add hl, de
ld a, [$c6d1]
ld e, a
ld d, 0
add hl, de
ld [hl], 0
ld hl, $dc7c
ld c, $a
.asm_91336
ld a, [hli]
and a
jr nz, .asm_9133e
ld a, [hld]
ld [hli], a
ld [hl], 0
.asm_9133e
dec c
jr nz, .asm_91336
ret
; 91342
Function91342: ; 91342 (24:5342)
ld hl, $dc7c
ld a, [$c6d2]
ld e, a
ld d, 0
add hl, de
ld a, [$c6d1]
ld e, a
ld d, 0
add hl, de
ld c, [hl]
callba Function9038a
ld a, c
and a
jr z, .asm_91366
ld hl, Jumptable_91455
ld de, Unknown_9143f
jr .asm_9136c
.asm_91366
ld hl, Jumptable_9146a
ld de, Unknown_9145b
.asm_9136c
xor a
ld [hBGMapMode], a
push hl
push de
ld a, [de]
ld l, a
inc de
ld a, [de]
ld h, a
inc de
push hl
ld bc, $ffd7
add hl, bc
ld a, [de]
inc de
sla a
ld b, a
ld c, 8
push de
call TextBox
pop de
pop hl
inc hl
call PlaceString
pop de
xor a
ld [$c6d4], a
call Function9141d
call WaitBGMap
.asm_91398
push de
call Functiona57
pop de
ld hl, hJoyPressed
ld a, [hl]
and D_UP
jr nz, .asm_913b4
ld a, [hl]
and D_DOWN
jr nz, .asm_913c1
ld a, [hl]
and A_BUTTON | B_BUTTON
jr nz, .asm_913d4
call DelayFrame
jr .asm_91398
.asm_913b4
ld hl, $c6d4
ld a, [hl]
and a
jr z, .asm_91398
dec [hl]
call Function9141d
jr .asm_91398
.asm_913c1
ld hl, 2
add hl, de
ld a, [$c6d4]
inc a
cp [hl]
jr nc, .asm_91398
ld [$c6d4], a
call Function9141d
jr .asm_91398
.asm_913d4
xor a
ld [hBGMapMode], a
call Function912d8
ld a, $1
ld [hBGMapMode], a
pop hl
ld a, [hJoyPressed]
and B_BUTTON
jr nz, Function913f1
ld a, [$c6d4]
ld e, a
ld d, 0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Function913f1: ; 913f1
ld hl, UnknownText_0x914ce
call PrintText
scf
ret
; 913f9 (24:53f9)
Function913f9: ; 913f9
ld hl, UnknownText_0x914d8
call Function1d4f
call YesNoBox
call Function1c07
jr c, .asm_91419
call Function9131e
xor a
ld [hBGMapMode], a
call Function912d8
ld hl, UnknownText_0x914ce
call PrintText
call WaitBGMap
.asm_91419
scf
ret
; 9141b
Function9141b: ; 9141b
and a
ret
; 9141d
Function9141d: ; 9141d (24:541d)
push de
ld a, [de]
inc de
ld l, a
ld a, [de]
inc de
ld h, a
ld a, [de]
ld c, a
push hl
ld a, " "
ld de, 20 * 2
.asm_9142c
ld [hl], a
add hl, de
dec c
jr nz, .asm_9142c
pop hl
ld a, [$c6d4]
ld bc, 20 * 2
call AddNTimes
ld [hl], "▶"
pop de
ret
; 9143f (24:543f)
Unknown_9143f: ; 9143f
dw $c522
db 3
db "CALL"
next "DELETE"
next "CANCEL"
db "@"
; 91455
Jumptable_91455: ; 91455
dw Function9141b
dw Function913f9
dw Function913f1
; 9145b
Unknown_9145b: ; 9145b
dw $c54a
db 2
db "CALL"
next "CANCEL"
db "@"
; 9146a
Jumptable_9146a: ; 9146a
dw Function9141b
dw Function913f1
; 9146e
Function9146e: ; 9146e
ld a, [hHours]
cp 12
jr c, .asm_9147b
sub 12
ld [$d265], a
scf
ret
.asm_9147b
ld [$d265], a
and a
ret
; 91480
Function91480: ; 91480 (24:5480)
ld de, SFX_READ_TEXT_2
call PlaySFX
ld a, c
ld [$cf63], a
ld a, b
ld [$cf64], a
call Function914ab
ret
Function91492: ; 91492
ld a, [$c6dc]
cp $fe
jr z, .asm_914a3
cp $ff
call z, EnterMapMusic
xor a
ld [$c6dc], a
ret
.asm_914a3
call RestartMapMusic
xor a
ld [$c6dc], a
ret
; 914ab
Function914ab: ; 914ab (24:54ab)
ld hl, $c324
ld bc, $90
xor a
call ByteFill
ld a, $2
ld [$c3b4], a
ret
Function914bb: ; 914bb (24:54bb)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
.asm_914be
ld a, [de]
cp $ff
ret z
ld b, a
inc de
ld a, [de]
ld c, a
inc de
ld a, b
.asm_914c8
ld [hli], a
dec c
jr nz, .asm_914c8
jr .asm_914be
; 914ce (24:54ce)
UnknownText_0x914ce: ; 0x914ce
; Whom do you want to call?
text_jump UnknownText_0x1c5847
db "@"
; 0x914d3
UnknownText_0x914d3: ; 0x914d3
; Press any button to exit.
text_jump UnknownText_0x1c5862
db "@"
; 0x914d8
UnknownText_0x914d8: ; 0x914d8
; Delete this stored phone number?
text_jump UnknownText_0x1c587d
db "@"
; 0x914dd
PokegearSpritesGFX: ; 914dd
INCBIN "gfx/misc/pokegear_sprites.2bpp.lz"
; 9150d
RadioTilemapRLE: ; 9150d
INCBIN "baserom.gbc",$9150d,$9158a - $9150d
PhoneTilemapRLE: ; 9158a
INCBIN "baserom.gbc",$9158a,$915db - $9158a
ClockTilemapRLE: ; 915db
INCBIN "baserom.gbc",$915db,$9163e - $915db
; 9163e
Function9163e: ; 9163e (24:563e)
jr UpdateRadioStation
Function91640: ; 91640 (24:5640)
push bc
call Function9164e
pop bc
ld a, [$d958]
ld hl, $6
add hl, bc
ld [hl], a
ret
Function9164e: ; 9164e (24:564e)
ld hl, $ffa9
ld a, [hl]
and D_DOWN
jr nz, .down
ld a, [hl]
and D_UP
jr nz, .up
ret
.down
ld hl, $d958
ld a, [hl]
and a
ret z
dec [hl]
dec [hl]
jr .update
.up
ld hl, $d958
ld a, [hl]
cp 80
ret nc
inc [hl]
inc [hl]
.update
UpdateRadioStation: ; 9166f (24:566f)
ld hl, $d958
ld d, [hl]
ld hl, Unknown_916ad
.asm_91676
ld a, [hli]
cp $ff
jr z, .asm_91682
cp d
jr z, .asm_91686
inc hl
inc hl
jr .asm_91676
.asm_91682
call NoRadioStation
ret
.asm_91686
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .asm_9168e
push de
jp [hl]
.asm_9168e
ld a, [$c6d9]
and a
ret z
xor a
ld [hBGMapMode], a
hlcoord 2, 9
call PlaceString
ld a, $1
ld [hBGMapMode], a
ret
; 916a1 (24:56a1)
Function916a1: ; 916a1
ld [$c6d9], a
ld a, [hli]
ld [$c6da], a
ld a, [hli]
ld [$c6db], a
ret
; 916ad
Unknown_916ad: ; 916ad
dbw 16, Function916c9
dbw 28, Function916d8
dbw 32, Function916e0
dbw 40, Function916e8
dbw 52, Function916f0
dbw 64, Function916fa
dbw 72, Function91709
dbw 78, Function91718
dbw 80, Function91727
db $ff
; 916c9
Function916c9: ; 916c9
call Function91744
jr nc, Function91740
ld a, [TimeOfDay]
and a
jp z, Function91766
jp Function91753
Function916d8: ; 916d8
call Function91744
jr nc, Function91740
jp Function9177b
Function916e0: ; 916e0
call Function91744
jr nc, Function91740
jp Function91790
Function916e8: ; 916e8
call Function91744
jr nc, Function91740
jp Function917a5
Function916f0: ; 916f0
ld a, [$c6d8]
cp RUINS_OF_ALPH
jr nz, Function91740
jp Function917d5
Function916fa: ; 916fa
call Function91744
jr c, Function91740
ld a, [$d957]
bit 3, a
jr z, Function91740
jp Function917ea
Function91709: ; 91709
call Function91744
jr c, Function91740
ld a, [$d957]
bit 3, a
jr z, Function91740
jp Function917ff
Function91718: ; 91718
call Function91744
jr c, Function91740
ld a, [$d957]
bit 3, a
jr z, Function91740
jp Function91829
Function91727: ; 91727
; This station airs in the Lake of Rage
; area when Rocket are still in Mahogany.
ld a, [StatusFlags]
bit 4, a
jr z, Function91740
ld a, [$c6d8]
cp MAHOGANY_TOWN
jr z, .ok
cp ROUTE_43
jr z, .ok
cp LAKE_OF_RAGE
jr nz, Function91740
.ok
jp Function9183e
Function91740: ; 91740
call NoRadioStation
ret
Function91744: ; 91744 (24:5744)
ld a, [$c6d8]
cp FAST_SHIP
jr z, .johto
cp KANTO_LANDMARK
jr c, .johto
.kanto
and a
ret
.johto
scf
ret
OAKS_POKEMON_TALK EQU 0
POKEDEX_SHOW EQU 1
POKEMON_MUSIC EQU 2
LUCKY_CHANNEL EQU 3
BUENAS_PASSWORD EQU 4
PLACES_AND_PEOPLE EQU 5
LETS_ALL_SING EQU 6
ROCKET_RADIO EQU 7
POKE_FLUTE_RADIO EQU 8
UNOWN_RADIO EQU 9
EVOLUTION_RADIO EQU 10
Function91753: ; 91753 (24:5753)
xor a ; OAKS_POKEMON_TALK
ld [$d002], a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, OaksPkmnTalkName
ret
Function91766: ; 91766 (24:5766)
ld a, POKEDEX_SHOW
ld [$d002], a
xor a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, PokedexShowName
ret
Function9177b: ; 9177b (24:577b)
ld a, POKEMON_MUSIC
ld [$d002], a
xor a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, PokemonMusicName
ret
Function91790: ; 91790 (24:5790)
ld a, LUCKY_CHANNEL
ld [$d002], a
xor a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, LuckyChannelName
ret
Function917a5: ; 917a5 (24:57a5)
ld a, BUENAS_PASSWORD
ld [$d002], a
xor a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, NotBuenasPasswordName
ld a, [StatusFlags2] ; $d84d
bit 0, a
ret z
ld de, BuenasPasswordName
ret
; 917c3 (24:57c3)
BuenasPasswordName: db "BUENA'S PASSWORD@"
NotBuenasPasswordName: db "@"
Function917d5: ; 917d5 (24:57d5)
ld a, UNOWN_RADIO
ld [$d002], a
xor a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, UnknownStationName
ret
Function917ea: ; 917ea (24:57ea)
ld a, PLACES_AND_PEOPLE
ld [$d002], a
xor a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, PlacesAndPeopleName
ret
Function917ff: ; 917ff (24:57ff)
ld a, LETS_ALL_SING
ld [$d002], a
xor a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, LetsAllSingName
ret
; 91814 (24:5814)
Function91814: ; 91814
ld a, ROCKET_RADIO
ld [$d002], a
xor a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, LetsAllSingName
ret
; 91829
Function91829: ; 91829 (24:5829)
ld a, POKE_FLUTE_RADIO
ld [$d002], a
xor a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, PokeFluteStationName
ret
Function9183e: ; 9183e (24:583e)
ld a, EVOLUTION_RADIO
ld [$d002], a
xor a
ld [$d005], a
ld a, BANK(PlayRadioShow)
ld hl, PlayRadioShow
call Function9187c
ld de, UnknownStationName
ret
; 91853 (24:5853)
Function91853: ; 91853
ret
Function91854: ; 91854 (24:5854)
push de
ld a, e
ld [$c6dc], a
ld de, MUSIC_NONE
call PlayMusic
pop de
ld a, e
ld [wMapMusic], a
call PlayMusic
ret
Function91868: ; 91868 (24:5868)
push de
ld a, $fe
ld [$c6dc], a
ld de, MUSIC_NONE
call PlayMusic
pop de
ld de, MUSIC_POKEMON_CHANNEL
call PlayMusic
ret
Function9187c: ; 9187c (24:587c)
ld [$c6d9], a
ld a, l
ld [$c6da], a
ld a, h
ld [$c6db], a
ret
NoRadioStation: ; 91888 (24:5888)
call NoRadioMusic
call NoRadioName
xor a
ld [$c6d9], a
ld [$c6da], a
ld [$c6db], a
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
NoRadioMusic: ; 9189d (24:589d)
ld de, MUSIC_NONE
call PlayMusic
ld a, $ff
ld [$c6dc], a
ret
NoRadioName: ; 918a9 (24:58a9)
xor a
ld [hBGMapMode], a ; $ff00+$d4
hlcoord 1, 8
ld bc, $312
call ClearBox
hlcoord 0, 12
ld bc, $412
call TextBox
ret
; 918bf
OaksPkmnTalkName: db "OAK's ", $e1, $e2, " Talk@"
PokedexShowName: db "#DEX Show@"
PokemonMusicName: db "#MON Music@"
LuckyChannelName: db "Lucky Channel@"
UnknownStationName: db "?????@"
PlacesAndPeopleName: db "Places & People@"
LetsAllSingName: db "Let's All Sing!@"
PokeFluteStationName: db "# FLUTE@"
; 9191c
Function9191c: ; 9191c
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
ld a, [VramState]
push af
xor a
ld [VramState], a
call WhiteBGMap
call ClearTileMap
call ClearSprites
call DisableLCD
call Function90c4e
callba Function8cf53
ld a, 8
call SkipMusic
ld a, $e3
ld [rLCDC], a
call Function90d56
ld [$d002], a
ld [$d003], a
xor a
ld [hBGMapMode], a
call Function91a04
call Function3200
ld a, [$d002]
call Function9106a
ld a, [$d003]
call Function91098
ld a, c
ld [$d004], a
ld a, b
ld [$d005], a
ld b, $2
call GetSGBLayout
call Function32f9
ld a, [hCGB]
and a
jr z, .asm_9198b
ld a, $e4
call Functioncf8
call DelayFrame
.asm_9198b
ld a, [$d002]
cp KANTO_LANDMARK
jr nc, .asm_9199b
ld d, KANTO_LANDMARK - 1
ld e, 1
call Function919b0
jr .asm_919a1
.asm_9199b
call Function910e8
call Function919b0
.asm_919a1
pop af
ld [VramState], a
pop af
ld [$ffaa], a
pop af
ld [Options], a
call WhiteBGMap
ret
; 919b0
Function919b0: ; 919b0
.asm_919b0
call Functiona57
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
ret nz
ld hl, $ffa9
ld a, [hl]
and D_UP
jr nz, .asm_919d4
ld a, [hl]
and D_DOWN
jr nz, .asm_919e1
.asm_919c7
push de
callba Function8cf69
pop de
call DelayFrame
jr .asm_919b0
.asm_919d4
ld hl, $d003
ld a, [hl]
cp d
jr c, .asm_919de
ld a, e
dec a
ld [hl], a
.asm_919de
inc [hl]
jr .asm_919ec
.asm_919e1
ld hl, $d003
ld a, [hl]
cp e
jr nz, .asm_919eb
ld a, d
inc a
ld [hl], a
.asm_919eb
dec [hl]
.asm_919ec
push de
ld a, [$d003]
call Function910b4
ld a, [$d004]
ld c, a
ld a, [$d005]
ld b, a
ld a, [$d003]
call Function910d4
pop de
jr .asm_919c7
; 91a04
Function91a04: ; 91a04
ld a, [$d002]
cp KANTO_LANDMARK
jr nc, .asm_91a0f
ld e, $0
jr .asm_91a11
.asm_91a0f
ld e, $1
.asm_91a11
callba Function91ae1
ld a, $7
ld bc, $0006
hlcoord 1, 0
call ByteFill
ld hl, TileMap
ld [hl], $6
hlcoord 7, 0
ld [hl], $17
hlcoord 7, 1
ld [hl], $16
hlcoord 7, 2
ld [hl], $26
ld a, $7
ld bc, $000b
hlcoord 8, 2
call ByteFill
hlcoord 19, 2
ld [hl], $17
ld a, [$d003]
call Function910b4
callba TownMapPals
ret
; 91a53
Function91a53: ; 91a53
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
call Function91a87
ld c, 100
call DelayFrames
.asm_91a62
call Functiona57
ld a, [hJoyPressed]
and A_BUTTON | B_BUTTON
jr nz, .asm_91a7f
ld a, [EnemyEvaLevel]
ld l, a
ld a, [$c6db]
ld h, a
ld a, [EnemyAccLevel]
and a
jr z, .asm_91a7a
rst FarCall
.asm_91a7a
call DelayFrame
jr .asm_91a62
.asm_91a7f
pop af
ld [Options], a
call Function91492
ret
; 91a87
Function91a87: ; 91a87
ld a, $ff
ld [EnemyTurnsTaken], a
ld hl, Jumptable_91ab9
ld d, $0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .asm_91a9b
push de
jp [hl]
.asm_91a9b
push de
hlcoord 0, 12
ld bc, $0412
call TextBox
hlcoord 1, 14
ld [hl], $72
pop de
hlcoord 2, 14
call PlaceString
ld h, b
ld l, c
ld [hl], $73
call WaitBGMap
ret
; 91ab9
Jumptable_91ab9: ; 91ab9
dw Function91acb
dw Function91753
dw Function91766
dw Function9177b
dw Function91790
dw Function917d5
dw Function917ea
dw Function917ff
dw Function91814
; 91acb
Function91acb: ; 91acb
call IsInJohto
and a
jr nz, .asm_91ade
call UpdateTime
ld a, [TimeOfDay]
and a
jp z, Function91766
jp Function91753
.asm_91ade
jp Function917ea
; 91ae1
Function91ae1: ; 91ae1
ld a, e
and a
jr nz, .asm_91aec
call Function91ff2
call FillJohtoMap
ret
.asm_91aec
call Function91ff2
call FillKantoMap
ret
; 91af3
Function91af3: ; 91af3
call WhiteBGMap
call ClearTileMap
call ClearSprites
ld hl, $ffaa
ld a, [hl]
push af
ld [hl], $1
xor a
ld [hBGMapMode], a
callba Function8cf53
call Function91ff2
ld de, GFX_922e1
ld hl, $9300
lb bc, BANK(GFX_922e1), 6
call Request1bpp
call FlyMap
call Function91c8f
ld b, $2
call GetSGBLayout
call Function32f9
.asm_91b29
call Functiona57
ld hl, hJoyPressed
ld a, [hl]
and $2
jr nz, .asm_91b4a
ld a, [hl]
and $1
jr nz, .asm_91b4e
call Function91b73
call Function91c17
callba Function8cf69
call DelayFrame
jr .asm_91b29
.asm_91b4a
ld a, $ff
jr .asm_91b5a
.asm_91b4e
ld a, [DefaultFlypoint]
ld l, a
ld h, $0
add hl, hl
ld de, $5c5f
add hl, de
ld a, [hl]
.asm_91b5a
ld [DefaultFlypoint], a
pop af
ld [$ffaa], a
call WhiteBGMap
ld a, $90
ld [hWY], a
xor a
ld [hBGMapAddress], a
ld a, $98
ld [$ffd7], a
ld a, [DefaultFlypoint]
ld e, a
ret
; 91b73
Function91b73: ; 91b73
ld a, [StartFlypoint]
ld e, a
ld a, [EndFlypoint]
ld d, a
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, .asm_91b89
ld a, [hl]
and $80
jr nz, .asm_91b9b
ret
.asm_91b89
ld hl, DefaultFlypoint
ld a, [hl]
cp d
jr nz, .asm_91b93
ld a, e
dec a
ld [hl], a
.asm_91b93
inc [hl]
call Function91c3c
jr z, .asm_91b89
jr .asm_91bab
.asm_91b9b
ld hl, DefaultFlypoint
ld a, [hl]
cp e
jr nz, .asm_91ba5
ld a, d
inc a
ld [hl], a
.asm_91ba5
dec [hl]
call Function91c3c
jr z, .asm_91b9b
.asm_91bab
call TownMapBubble
call WaitBGMap
xor a
ld [hBGMapMode], a
ret
; 91bb5
TownMapBubble: ; 91bb5
; Draw the bubble containing the location text in the town map HUD
; Top-left corner
ld hl, TileMap + 1 ; (1,0)
ld a, $30
ld [hli], a
; Top row
ld bc, 16
ld a, " "
call ByteFill
; Top-right corner
ld a, $31
ld [hl], a
ld hl, TileMap + 1 + 20 ; (1,1)
; Middle row
ld bc, 18
ld a, " "
call ByteFill
; Bottom-left corner
ld hl, TileMap + 1 + 40 ; (1,2)
ld a, $32
ld [hli], a
; Bottom row
ld bc, 16
ld a, " "
call ByteFill
; Bottom-right corner
ld a, $33
ld [hl], a
; Print "Where?"
ld hl, TileMap + 2 ; (2,0)
ld de, .Where
call PlaceString
; Print the name of the default flypoint
call .Name
; Up/down arrows
ld hl, TileMap + 18 + 20 ; (18,1)
ld [hl], $34
ret
.Where
db "Where?@"
.Name
; We need the map location of the default flypoint
ld a, [DefaultFlypoint]
ld l, a
ld h, 0
add hl, hl ; two bytes per flypoint
ld de, Flypoints
add hl, de
ld e, [hl]
callba GetLandmarkName
ld hl, TileMap + 2 + 20 ; (2,1)
ld de, StringBuffer1
call PlaceString
ret
; 91c17
Function91c17: ; 91c17
ld a, [DefaultFlypoint]
ld l, a
ld h, $0
add hl, hl
ld de, Flypoints
add hl, de
ld e, [hl]
callba GetLandmarkCoords
ld a, [$d003]
ld c, a
ld a, [$d004]
ld b, a
ld hl, $0004
add hl, bc
ld [hl], e
ld hl, $0005
add hl, bc
ld [hl], d
ret
; 91c3c
Function91c3c: ; 91c3c
push bc
push de
push hl
ld l, [hl]
ld h, 0
add hl, hl
ld de, Flypoints + 1
add hl, de
ld c, [hl]
call HasVisitedSpawn
pop hl
pop de
pop bc
and a
ret
; 91c50
HasVisitedSpawn: ; 91c50
; Check if spawn point c has been visited.
ld hl, VisitedSpawns
ld b, CHECK_FLAG
ld d, 0
predef FlagPredef
ld a, c
ret
; 91c5e
Flypoints: ; 91c5e
; landmark, spawn point
const_def
flypoint: MACRO
\1\@FLY EQUS "FLY_\1"
\1\@SPAWN EQUS "SPAWN_\1"
const \1\@FLY
db \2, \1\@SPAWN
ENDM
; Johto
flypoint NEW_BARK, NEW_BARK_TOWN
flypoint CHERRYGROVE, CHERRYGROVE_CITY
flypoint VIOLET, VIOLET_CITY
flypoint AZALEA, AZALEA_TOWN
flypoint GOLDENROD, GOLDENROD_CITY
flypoint ECRUTEAK, ECRUTEAK_CITY
flypoint OLIVINE, OLIVINE_CITY
flypoint CIANWOOD, CIANWOOD_CITY
flypoint MAHOGANY, MAHOGANY_TOWN
flypoint LAKE, LAKE_OF_RAGE
flypoint BLACKTHORN, BLACKTHORN_CITY
flypoint MT_SILVER, SILVER_CAVE
; Kanto
KANTO_FLYPOINT EQU const_value
flypoint PALLET, PALLET_TOWN
flypoint VIRIDIAN, VIRIDIAN_CITY
flypoint PEWTER, PEWTER_CITY
flypoint CERULEAN, CERULEAN_CITY
flypoint VERMILION, VERMILION_CITY
flypoint ROCK_TUNNEL, ROCK_TUNNEL
flypoint LAVENDER, LAVENDER_TOWN
flypoint CELADON, CELADON_CITY
flypoint SAFFRON, SAFFRON_CITY
flypoint FUCHSIA, FUCHSIA_CITY
flypoint CINNABAR, CINNABAR_ISLAND
flypoint INDIGO, INDIGO_PLATEAU
db -1
; 91c8f
Function91c8f: ; 91c8f
ret
; 91c90
FlyMap: ; 91c90
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
; If we're not in a valid location, i.e. Pokecenter floor 2F,
; the backup map information is used
cp SPECIAL_MAP
jr nz, .CheckRegion
ld a, [BackupMapGroup]
ld b, a
ld a, [BackupMapNumber]
ld c, a
call GetWorldMapLocation
.CheckRegion
; The first 46 locations are part of Johto. The rest are in Kanto
cp KANTO_LANDMARK
jr nc, .KantoFlyMap
.JohtoFlyMap
; Note that .NoKanto should be modified in tandem with this branch
push af
; Start from New Bark Town
ld a, FLY_NEW_BARK
ld [DefaultFlypoint], a
; Flypoints begin at New Bark Town...
ld [StartFlypoint], a
; ..and end at Silver Cave
ld a, FLY_MT_SILVER
ld [EndFlypoint], a
; Fill out the map
call FillJohtoMap
call .MapHud
pop af
call TownMapPlayerIcon
ret
.KantoFlyMap
; The event that there are no flypoints enabled in a map is not
; accounted for. As a result, if you attempt to select a flypoint
; when there are none enabled, the game will crash. Additionally,
; the flypoint selection has a default starting point that
; can be flown to even if none are enabled
; To prevent both of these things from happening when the player
; enters Kanto, fly access is restricted until Indigo Plateau is
; visited and its flypoint enabled
push af
ld c, SPAWN_INDIGO
call HasVisitedSpawn
and a
jr z, .NoKanto
; Kanto's map is only loaded if we've visited Indigo Plateau
; Flypoints begin at Pallet Town...
ld a, FLY_PALLET
ld [StartFlypoint], a
; ...and end at Indigo Plateau
ld a, FLY_INDIGO
ld [EndFlypoint], a
; Because Indigo Plateau is the first flypoint the player
; visits, it's made the default flypoint
ld [DefaultFlypoint], a
; Fill out the map
call FillKantoMap
call .MapHud
pop af
call TownMapPlayerIcon
ret
.NoKanto
; If Indigo Plateau hasn't been visited, we use Johto's map instead
; Start from New Bark Town
ld a, FLY_NEW_BARK
ld [DefaultFlypoint], a
; Flypoints begin at New Bark Town...
ld [StartFlypoint], a
; ..and end at Silver Cave
ld a, FLY_MT_SILVER
ld [EndFlypoint], a
call FillJohtoMap
pop af
.MapHud
call TownMapBubble
call TownMapPals
ld hl, VBGMap0 ; BG Map 0
call TownMapBGUpdate
call TownMapMon
ld a, c
ld [$d003], a
ld a, b
ld [$d004], a
ret
; 91d11
Function91d11: ; 91d11
ld a, [DefaultFlypoint]
push af
ld a, [$d003]
push af
ld a, e
ld [DefaultFlypoint], a
call ClearSprites
xor a
ld [hBGMapMode], a
ld a, $1
ld [$ffaa], a
ld de, GFX_922d1
ld hl, $87f0
lb bc, BANK(GFX_922d1), 1
call Request2bpp ; actually 1bpp
call Function91ed0
ld hl, $8780
ld c, $4
call Request2bpp
call Function91ff2
call FillKantoMap
call Function91de9
call TownMapPals
ld hl, VBGMap1
call TownMapBGUpdate
call FillJohtoMap
call Function91de9
call TownMapPals
ld hl, VBGMap0
call TownMapBGUpdate
ld b, $2
call GetSGBLayout
call Function32f9
xor a
ld [hBGMapMode], a
xor a
call Function91e1e
.asm_91d6e
call Functiona57
ld hl, hJoyPressed
ld a, [hl]
and $3
jr nz, .asm_91d8f
ld a, [hJoypadDown]
and $4
jr nz, .asm_91d87
call Function91d9b
call Function91dcd
jr .asm_91d8a
.asm_91d87
call Function91e5a
.asm_91d8a
call DelayFrame
jr .asm_91d6e
.asm_91d8f
call ClearSprites
pop af
ld [$d003], a
pop af
ld [DefaultFlypoint], a
ret
; 91d9b
Function91d9b: ; 91d9b
ld a, [hl]
and $20
jr nz, .asm_91da6
ld a, [hl]
and $10
jr nz, .asm_91db7
ret
.asm_91da6
ld a, [hWY]
cp $90
ret z
call ClearSprites
ld a, $90
ld [hWY], a
xor a
call Function91e1e
ret
.asm_91db7
ld a, [StatusFlags]
bit 6, a
ret z
ld a, [hWY]
and a
ret z
call ClearSprites
xor a
ld [hWY], a
ld a, $1
call Function91e1e
ret
; 91dcd
Function91dcd: ; 91dcd
ld a, [$ff9b]
ld e, a
and $f
ret nz
ld a, e
and $10
jr nz, .asm_91ddc
call ClearSprites
ret
.asm_91ddc
ld hl, TileMap
ld de, Sprites
ld bc, $00a0
call CopyBytes
ret
; 91de9
Function91de9: ; 91de9
ld hl, TileMap
ld bc, $0014
ld a, $7f
call ByteFill
hlcoord 0, 1
ld a, $6
ld [hli], a
ld bc, $0012
ld a, $7
call ByteFill
ld [hl], $17
call GetPokemonName
hlcoord 2, 0
call PlaceString
ld h, b
ld l, c
ld de, String_91e16
call PlaceString
ret
; 91e16
String_91e16:
db "'S NEST@"
; 91e1e
Function91e1e: ; 91e1e
ld [$d003], a
ld e, a
callba Function2a01f
ld de, TileMap
ld hl, Sprites
.asm_91e2e
ld a, [de]
and a
jr z, .asm_91e4d
push de
ld e, a
push hl
callba GetLandmarkCoords
pop hl
ld a, d
sub $4
ld [hli], a
ld a, e
sub $4
ld [hli], a
ld a, $7f
ld [hli], a
xor a
ld [hli], a
pop de
inc de
jr .asm_91e2e
.asm_91e4d
ld hl, Sprites
ld de, TileMap
ld bc, $00a0
call CopyBytes
ret
; 91e5a
Function91e5a: ; 91e5a
call Function91ea9
ret c
ld a, [DefaultFlypoint]
ld e, a
callba GetLandmarkCoords
ld c, e
ld b, d
ld de, Unknown_91e9c
ld hl, Sprites
.asm_91e70
ld a, [de]
cp $80
jr z, .asm_91e91
add b
ld [hli], a
inc de
ld a, [de]
add c
ld [hli], a
inc de
ld a, [de]
add $78
ld [hli], a
inc de
push bc
ld c, 0
ld a, [PlayerGender]
bit 0, a
jr z, .asm_91e8c
inc c
.asm_91e8c
ld a, c
ld [hli], a
pop bc
jr .asm_91e70
.asm_91e91
ld hl, Sprites + $10
ld bc, SpritesEnd - (Sprites + $10)
xor a
call ByteFill
ret
; 91e9c
Unknown_91e9c: ; 91e9c
db -8, -8, 0
db -8, 0, 1
db 0, -8, 2
db 0, 0, 3
db $80 ; terminator
; 91ea9
Function91ea9: ; 91ea9
ld a, [DefaultFlypoint]
cp FAST_SHIP
jr z, .johto
cp KANTO_LANDMARK
jr c, .johto
.kanto
ld a, [$d003]
and a
jr z, .clear
jr .ok
.johto
ld a, [$d003]
and a
jr nz, .clear
.ok
and a
ret
.clear
ld hl, Sprites
ld bc, SpritesEnd - Sprites
xor a
call ByteFill
scf
ret
; 91ed0
Function91ed0: ; 91ed0
ld a, [DefaultFlypoint]
cp FAST_SHIP
jr z, .asm_91ede
callba GetPlayerIcon
ret
.asm_91ede
ld de, FastShipGFX
ld b, BANK(FastShipGFX)
ret
; 91ee4
TownMapBGUpdate: ; 91ee4
; Update BG Map tiles and attributes
; BG Map address
ld a, l
ld [hBGMapAddress], a
ld a, h
ld [$ffd7], a
; Only update palettes on CGB
ld a, [hCGB]
and a
jr z, .tiles
; BG Map mode 2 (palettes)
ld a, 2
ld [hBGMapMode], a
; The BG Map is updated in thirds, so we wait
; 3 frames to update the whole screen's palettes.
ld c, 3
call DelayFrames
.tiles
; Update BG Map tiles
call WaitBGMap
; Turn off BG Map update
xor a
ld [hBGMapMode], a
ret
; 91eff
FillJohtoMap: ; 91eff
ld de, JohtoMap
jr FillTownMap
FillKantoMap: ; 91f04
ld de, KantoMap
FillTownMap: ; 91f07
ld hl, TileMap
.loop
ld a, [de]
cp $ff
ret z
ld a, [de]
ld [hli], a
inc de
jr .loop
; 91f13
TownMapPals: ; 91f13
; Assign palettes based on tile ids
ld hl, TileMap
ld de, AttrMap
ld bc, 360
.loop
; Current tile
ld a, [hli]
push hl
; HP/borders use palette 0
cp $60
jr nc, .pal0
; The palette data is condensed to nybbles,
; least-significant first.
ld hl, TownMapPalMap
srl a
jr c, .odd
; Even-numbered tile ids take the bottom nybble...
add l
ld l, a
ld a, h
adc 0
ld h, a
ld a, [hl]
and %111
jr .update
.odd
; ...and odd ids take the top.
add l
ld l, a
ld a, h
adc 0
ld h, a
ld a, [hl]
swap a
and %111
jr .update
.pal0
xor a
.update
pop hl
ld [de], a
inc de
dec bc
ld a, b
or c
jr nz, .loop
ret
TownMapPalMap:
db $11, $21, $22, $00, $11, $13, $54, $54, $11, $21, $22, $00
db $11, $10, $01, $00, $11, $21, $22, $00, $00, $00, $00, $00
db $00, $00, $44, $04, $00, $00, $00, $00, $33, $33, $33, $33
db $33, $33, $33, $03, $33, $33, $33, $33, $00, $00, $00, $00
; 91f7b
TownMapMon: ; 91f7b
; Draw the FlyMon icon at town map location in
; Get FlyMon species
ld a, [CurPartyMon]
ld hl, PartySpecies
ld e, a
ld d, $0
add hl, de
ld a, [hl]
ld [$d265], a
; Get FlyMon icon
ld e, 8 ; starting tile in VRAM
callba GetSpeciesIcon
; Animation/palette
ld de, $0000
ld a, $0
call Function3b2a
ld hl, 3
add hl, bc
ld [hl], 8
ld hl, 2
add hl, bc
ld [hl], 0
ret
; 91fa6
TownMapPlayerIcon: ; 91fa6
; Draw the player icon at town map location in a
push af
callba GetPlayerIcon
; Standing icon
ld hl, $8100
ld c, 4 ; # tiles
call Request2bpp
; Walking icon
ld hl, $00c0
add hl, de
ld d, h
ld e, l
ld hl, $8140
ld c, 4 ; # tiles
ld a, BANK(ChrisSpriteGFX) ; does nothing
call Request2bpp
; Animation/palette
ld de, $0000
ld b, $0a ; Male
ld a, [PlayerGender]
bit 0, a
jr z, .asm_91fd3
ld b, $1e ; Female
.asm_91fd3
ld a, b
call Function3b2a
ld hl, $0003
add hl, bc
ld [hl], $10
pop af
ld e, a
push bc
callba GetLandmarkCoords
pop bc
ld hl, 4
add hl, bc
ld [hl], e
ld hl, 5
add hl, bc
ld [hl], d
ret
; 0x91ff2
Function91ff2: ; 91ff2
ld hl, TownMapGFX
ld de, VTiles2
lb bc, BANK(TownMapGFX), $30
call Functione73
ret
; 91fff
JohtoMap: ; 91fff
INCBIN "gfx/misc/johto.bin"
; 92168
KantoMap: ; 92168
INCBIN "gfx/misc/kanto.bin"
; 922d1
GFX_922d1: ; 922d1
INCBIN "baserom.gbc", $922d1, $922e1 - $922d1
GFX_922e1: ; 922e1
INCBIN "baserom.gbc", $922e1, $92301 - $922e1
GFX_92301: ; 92301
INCBIN "baserom.gbc", $92301, $92311 - $92301
Function92311: ; 92311
xor a
ld [DefaultFlypoint], a
call WhiteBGMap
call ClearTileMap
call ClearSprites
ld hl, $ffaa
ld a, [hl]
push af
ld [hl], $1
xor a
ld [hBGMapMode], a
callba Function8cf53
call Function91ff2
ld de, GFX_922e1
ld hl, $9300
lb bc, BANK(GFX_922e1), 6
call Request1bpp
call FillKantoMap
call TownMapBubble
call TownMapPals
ld hl, VBGMap1
call TownMapBGUpdate
call FillJohtoMap
call TownMapBubble
call TownMapPals
ld hl, VBGMap0
call TownMapBGUpdate
call TownMapMon
ld a, c
ld [$d003], a
ld a, b
ld [$d004], a
ld b, $2
call GetSGBLayout
call Function32f9
.asm_9236e
call Functiona57
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
jr nz, .asm_9238f
ld a, [hl]
and A_BUTTON
jr nz, .asm_92393
call Function923b8
call Function91c17
callba Function8cf69
call DelayFrame
jr .asm_9236e
.asm_9238f
ld a, $ff
jr .asm_9239f
.asm_92393
ld a, [DefaultFlypoint]
ld l, a
ld h, 0
add hl, hl
ld de, Flypoints + 1
add hl, de
ld a, [hl]
.asm_9239f
ld [DefaultFlypoint], a
pop af
ld [$ffaa], a
call WhiteBGMap
ld a, $90
ld [hWY], a
xor a
ld [hBGMapAddress], a
ld a, $98
ld [$ffd7], a
ld a, [DefaultFlypoint]
ld e, a
ret
; 923b8
Function923b8: ; 923b8
ld hl, $ffa9
ld a, [hl]
and D_DOWN | D_RIGHT
jr nz, .asm_923c6
ld a, [hl]
and D_UP | D_LEFT
jr nz, .asm_923d3
ret
.asm_923c6
ld hl, DefaultFlypoint
ld a, [hl]
cp FLY_INDIGO
jr c, .asm_923d0
ld [hl], -1
.asm_923d0
inc [hl]
jr .asm_923dd
.asm_923d3
ld hl, DefaultFlypoint
ld a, [hl]
and a
jr nz, .asm_923dc
ld [hl], FLY_INDIGO + 1
.asm_923dc
dec [hl]
.asm_923dd
ld a, [DefaultFlypoint]
cp KANTO_FLYPOINT
jr c, .johto
call FillKantoMap
xor a
ld b, $9c
jr .asm_923f3
.johto
call FillJohtoMap
ld a, $90
ld b, $98
.asm_923f3
ld [hWY], a
ld a, b
ld [$ffd7], a
call TownMapBubble
call WaitBGMap
xor a
ld [hBGMapMode], a
ret
; 92402
INCLUDE "data/wild/fish.asm"
Function926c7:
ld hl, Options ; $cfcc
set 4, [hl]
call Function926f7
call DelayFrame
.asm_926d2
call Function927af
jr nc, .asm_926d2
call WaitSFX
ld de, SFX_QUIT_SLOTS
call PlaySFX
call WaitSFX
call WhiteBGMap
callba Function105fd0
ld hl, Options ; $cfcc
res 4, [hl]
ld hl, rLCDC ; $ff40
res 2, [hl]
ret
Function926f7: ; 926f7 (24:66f7)
call WhiteBGMap
call ClearTileMap
call ClearSprites
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
call DisableLCD
ld hl, $9800
ld bc, $400
ld a, $7f
call ByteFill
ld b, $5
call GetSGBLayout
callab Function8cf53
ld hl, PlayerSDefLevel ; $c6d0
ld bc, $48
xor a
call ByteFill
ld hl, Slots2LZ
ld de, $8000
call Decompress
ld hl, Slots3LZ
ld de, $8400
call Decompress
ld hl, Slots1LZ
ld de, $9000
call Decompress
ld hl, Slots2LZ
ld de, $9250
call Decompress
ld hl, SlotsTilemap
ld de, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, 20 * 12
call CopyBytes
ld hl, rLCDC ; $ff40
set 2, [hl]
call EnableLCD
ld hl, PlayerSDefLevel ; $c6d0
ld bc, $64
xor a
call ByteFill
call Function92a98
call Function9279b
ld a, $7
ld hl, $c300
ld [hli], a
ld [hl], $40
xor a
ld [$cf63], a
ld a, $ff
ld [$c709], a
ld de, MUSIC_GAME_CORNER
call PlayMusic
xor a
ld [$d002], a
call Random
and $2a
ret nz
ld a, $1
ld [$d002], a
ret
Function9279b: ; 9279b (24:679b)
ld a, $e4
call DmgToCgbBGPals
ld de, $e4e4
ld a, [hCGB] ; $ff00+$e6
and a
jr nz, .asm_927ab
ld de, $c0e4
.asm_927ab
call DmgToCgbObjPals
ret
Function927af: ; 927af (24:67af)
ld a, [$cf63]
bit 7, a
jr nz, .asm_927d1
call Function92844
call Function92b0f
xor a
ld [$c3b5], a
callab Function8cfa8
call Function927f8
call Function927d3
call DelayFrame
and a
ret
.asm_927d1
scf
ret
Function927d3: ; 927d3 (24:67d3)
ret
; 927d4 (24:67d4)
Function927d4: ; 927d4
ld a, [$c6d0]
and a
ret nz
ld a, [$c6e0]
and a
ret nz
ld a, [$c70c]
and a
jr nz, .asm_927ea
ld a, $e4
call DmgToCgbBGPals
ret
.asm_927ea
ld a, [TextDelayFrames]
and $7
ret nz
ld a, [rBGP]
xor %1100
call DmgToCgbBGPals
ret
; 927f8
Function927f8: ; 927f8 (24:67f8)
hlcoord 5, 1
ld de, Coins ; $d855
ld bc, $8204
call PrintNum
hlcoord 11, 1
ld de, $c711
ld bc, $8204
call PrintNum
ret
; 92811 (24:6811)
Function92811: ; 92811
ld a, [$c709]
add 0
daa
ld e, a
and $f
add "0"
hlcoord 1, 0
ld [hl], a
ld a, e
swap a
and $f
add "0"
hlcoord 0, 0
ld [hl], a
ret
; 9282c
Function9282c: ; 9282c
ld hl, $cf66
ld a, [hl]
inc [hl]
and $7
ret nz
ld hl, $c442
ld c, $18
.asm_92839
ld a, [hl]
xor $20
ld [hli], a
inc hl
inc hl
inc hl
dec c
jr nz, .asm_92839
ret
; 92844
Function92844: ; 92844 (24:6844)
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_92853
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 92853 (24:6853)
Jumptable_92853: ; 92853 (24:6853)
dw Function9287e
dw Function9288e
dw Function928c6
dw Function928d6
dw Function928e6
dw Function92900
dw Function92910
dw Function9292a
dw Function9293a
dw Function92879
dw Function92879
dw Function92879
dw Function92955
dw Function9296b
dw Function92987
dw Function9299e
dw Function929a4
dw Function929d9
dw Function929f0
Function92879: ; 92879 (24:6879)
ld hl, $cf63
inc [hl]
ret
Function9287e: ; 9287e (24:687e)
call Function92879
xor a
ld [$c70b], a
ld [$c70c], a
ld a, $ff
ld [$c70d], a
ret
Function9288e: ; 9288e (24:688e)
call Function9307c
jr nc, .asm_92899
ld a, $12
ld [$cf63], a
ret
.asm_92899
call Function92879
call Function9303f
call Function93002
ld a, $20
ld [$cf64], a
ld a, $4
ld [$c6d0], a
ld [$c6e0], a
ld [$c6f0], a
ld a, $4
ld [$c6d9], a
ld [$c6e9], a
ld [$c6f9], a
call WaitSFX
ld a, SFX_SLOT_MACHINE_START
call Function9331e
ret
Function928c6: ; 928c6 (24:68c6)
ld hl, $cf64
ld a, [hl]
and a
jr z, .asm_928cf
dec [hl]
ret
.asm_928cf
call Function92879
xor a
ld [hJoypadSum], a ; $ff00+$a5
ret
Function928d6: ; 928d6 (24:68d6)
ld hl, hJoypadSum ; $ffa5
ld a, [hl]
and A_BUTTON
ret z
call Function92879
call Function92a2b
ld [$c6d0], a
Function928e6: ; 928e6 (24:68e6)
ld a, [$c6d0]
cp $0
ret nz
ld a, SFX_STOP_SLOT
call Function9331e
ld bc, $c6d0
ld de, $c700
call Function929f6
call Function92879
xor a
ld [hJoypadSum], a ; $ff00+$a5
Function92900: ; 92900 (24:6900)
ld hl, hJoypadSum ; $ffa5
ld a, [hl]
and A_BUTTON
ret z
call Function92879
call Function92a2e
ld [$c6e0], a
Function92910: ; 92910 (24:6910)
ld a, [$c6e0]
cp $0
ret nz
ld a, SFX_STOP_SLOT
call Function9331e
ld bc, $c6e0
ld de, $c703
call Function929f6
call Function92879
xor a
ld [hJoypadSum], a ; $ff00+$a5
Function9292a: ; 9292a (24:692a)
ld hl, hJoypadSum ; $ffa5
ld a, [hl]
and A_BUTTON
ret z
call Function92879
call Function92a60
ld [$c6f0], a
Function9293a: ; 9293a (24:693a)
ld a, [$c6f0]
cp $0
ret nz
ld a, SFX_STOP_SLOT
call Function9331e
ld bc, $c6f0
ld de, $c706
call Function929f6
call Function92879
xor a
ld [hJoypadSum], a ; $ff00+$a5
ret
Function92955: ; 92955 (24:6955)
ld a, [$c70d]
cp $ff
jr nz, .asm_92963
call Function92879
call Function92879
ret
.asm_92963
call Function92879
ld a, $10
ld [$cf64], a
Function9296b: ; 9296b (24:696b)
ld hl, $cf64
ld a, [hl]
and a
jr z, .asm_92980
dec [hl]
srl a
ret z
ld a, [rOBP0] ; $ff00+$48
xor $ff
ld e, a
ld d, a
call DmgToCgbObjPals
ret
.asm_92980
call Function9279b
call Function92879
ret
Function92987: ; 92987 (24:6987)
xor a
ld [$c70b], a
ld [$c70c], a
ld a, $e4
call DmgToCgbBGPals
call Function93124
xor a
ld [$cf64], a
call Function92879
ret
Function9299e: ; 9299e (24:699e)
call Function93158
call Function92879
Function929a4: ; 929a4 (24:69a4)
ld hl, $cf64
ld a, [hl]
inc [hl]
and $1
ret z
ld hl, $c711
ld a, [hli]
ld d, a
or [hl]
jr z, .asm_929d5
ld e, [hl]
dec de
ld [hl], e
dec hl
ld [hl], d
ld hl, Coins ; $d855
ld d, [hl]
inc hl
ld e, [hl]
call Function92a04
jr c, .asm_929c5
inc de
.asm_929c5
ld [hl], e
dec hl
ld [hl], d
ld a, [$cf64]
and $7
ret z
ld de, SFX_GET_COIN_FROM_SLOTS
call PlaySFX
ret
.asm_929d5
call Function92879
ret
Function929d9: ; 929d9 (24:69d9)
call Function9304c
call Functiona80
call Function930e9
jr c, .asm_929ea
ld a, $0
ld [$cf63], a
ret
.asm_929ea
ld a, $12
ld [$cf63], a
ret
Function929f0: ; 929f0 (24:69f0)
ld hl, $cf63
set 7, [hl]
ret
Function929f6: ; 929f6 (24:69f6)
push de
call Function92a12
pop de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
ret
Function92a04: ; 92a04 (24:6a04)
ld a, d
cp 9999 / $100
jr c, .asm_92a10
ld a, e
cp 9999 % $100
jr c, .asm_92a10
scf
ret
.asm_92a10
and a
ret
Function92a12: ; 92a12 (24:6a12)
ld hl, $3
add hl, bc
ld a, [hl]
and a
jr nz, .asm_92a1c
ld a, $f
.asm_92a1c
dec a
and $f
ld e, a
ld d, $0
ld hl, $1
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
add hl, de
ret
Function92a2b: ; 92a2b (24:6a2b)
ld a, $7
ret
Function92a2e: ; 92a2e (24:6a2e)
ld a, [$c70a]
cp $2
jr c, .asm_92a4e
ld a, [$c709]
and a
jr z, .asm_92a3f
cp $ff
jr nz, .asm_92a4e
.asm_92a3f
call Function92a51
jr nz, .asm_92a4e
call Random
cp $50
jr nc, .asm_92a4e
ld a, $a
ret
.asm_92a4e
ld a, $8
ret
Function92a51: ; 92a51 (24:6a51)
ld a, [$c700]
and a
ret z
ld a, [$c701]
and a
ret z
ld a, [$c702]
and a
ret
Function92a60: ; 92a60 (24:6a60)
ld a, [$c70b]
and a
jr z, .asm_92a95
ld a, [$c70c]
and a
jr z, .asm_92a95
ld a, [$c709]
and a
jr nz, .asm_92a84
call Random
cp 180
jr nc, .asm_92a95
cp 120
jr nc, .asm_92a92
cp 60
jr nc, .asm_92a8f
ld a, $15
ret
.asm_92a84
call Random
cp $a0
jr nc, .asm_92a95
cp $50
jr nc, .asm_92a92
.asm_92a8f
ld a, $12
ret
.asm_92a92
ld a, $10
ret
.asm_92a95
ld a, $9
ret
Function92a98: ; 92a98 (24:6a98)
ld bc, $c6d0
ld hl, $6
add hl, bc
ld de, $c440
ld [hl], e
inc hl
ld [hl], d
ld hl, $1
add hl, bc
ld de, Unknown_93327
ld [hl], e
inc hl
ld [hl], d
ld hl, $8
add hl, bc
ld [hl], $30
call Function92af9
ld bc, $c6e0
ld hl, $6
add hl, bc
ld de, $c460
ld [hl], e
inc hl
ld [hl], d
ld hl, $1
add hl, bc
ld de, Unknown_93339
ld [hl], e
inc hl
ld [hl], d
ld hl, $8
add hl, bc
ld [hl], $50
call Function92af9
ld bc, $c6f0
ld hl, $6
add hl, bc
ld de, $c480
ld [hl], e
inc hl
ld [hl], d
ld hl, $1
add hl, bc
ld de, Unknown_9334b
ld [hl], e
inc hl
ld [hl], d
ld hl, $8
add hl, bc
ld [hl], $70
call Function92af9
ret
Function92af9: ; 92af9 (24:6af9)
ld hl, $0
add hl, bc
ld [hl], $0
ld hl, $3
add hl, bc
ld [hl], $e
ld hl, $4
add hl, bc
ld [hl], $0
call Function92b53
ret
Function92b0f: ; 92b0f (24:6b0f)
ld bc, $c6d0
call Function92b22
ld bc, $c6e0
call Function92b22
ld bc, $c6f0
call Function92b22
ret
Function92b22: ; 92b22 (24:6b22)
ld hl, $4
add hl, bc
ld a, [hl]
and $f
jr nz, .asm_92b2e
call Function92bd4
.asm_92b2e
ld hl, $5
add hl, bc
ld a, [hl]
and a
ret z
ld d, a
ld hl, $4
add hl, bc
add [hl]
ld [hl], a
and $f
jr z, Function92b53
ld hl, $6
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld e, $8
.asm_92b49
ld a, [hl]
add d
ld [hli], a
inc hl
inc hl
inc hl
dec e
jr nz, .asm_92b49
ret
Function92b53: ; 92b53 (24:6b53)
ld hl, $8
add hl, bc
ld a, [hl]
ld [$c713], a
ld a, $50
ld [$c714], a
ld hl, $3
add hl, bc
ld e, [hl]
ld d, $0
ld hl, $1
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
add hl, de
ld e, l
ld d, h
call Function92b83
ld hl, $3
add hl, bc
ld a, [hl]
inc a
and $f
cp $f
jr nz, .asm_92b81
xor a
.asm_92b81
ld [hl], a
ret
Function92b83: ; 92b83 (24:6b83)
ld hl, $6
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
.asm_92b8a
ld a, [$c714]
ld [hli], a
ld a, [$c713]
ld [hli], a
ld a, [de]
ld [hli], a
srl a
srl a
set 7, a
ld [hli], a
ld a, [$c714]
ld [hli], a
ld a, [$c713]
add $8
ld [hli], a
ld a, [de]
inc a
inc a
ld [hli], a
srl a
srl a
set 7, a
ld [hli], a
inc de
ld a, [$c714]
sub $10
ld [$c714], a
cp $10
jr nz, .asm_92b8a
ret
; 92bbe (24:6bbe)
Function92bbe: ; 92bbe
push hl
srl a
srl a
add Unknown_92bce % $100
ld l, a
ld a, 0
adc Unknown_92bce / $100
ld h, a
ld a, [hl]
pop hl
ret
; 92bce
Unknown_92bce: ; 92bce
db 0, 1, 2, 3, 4, 5
; 92bd4
Function92bd4: ; 92bd4 (24:6bd4)
ld hl, 0
add hl, bc
ld e, [hl]
ld d, 0
ld hl, Jumptable_92be4
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 92be4 (24:6be4)
Jumptable_92be4: ; 92be4
dw Function92c16
dw Function92c4c
dw Function92c17
dw Function92c1e
dw Function92c25
dw Function92c2c
dw Function92c33
dw Function92c5e
dw Function92c86
dw Function92ca9
dw Function92cd2
dw Function92cf8
dw Function92d13
dw Function92df7
dw Function92e10
dw Function92e31
dw Function92e47
dw Function92e64
dw Function92d20
dw Function92d4f
dw Function92d6e
dw Function92d7e
dw Function92da4
dw Function92db3
dw Function92dca
; 92c16
Function92c16: ; 92c16
ret
; 92c17
Function92c17: ; 92c17
ld hl, $0005
add hl, bc
ld [hl], $10
ret
; 92c1e
Function92c1e: ; 92c1e
ld hl, $0005
add hl, bc
ld [hl], $8
ret
; 92c25
Function92c25: ; 92c25
ld hl, $0005
add hl, bc
ld [hl], $4
ret
; 92c2c
Function92c2c: ; 92c2c
ld hl, $0005
add hl, bc
ld [hl], $2
ret
; 92c33
Function92c33: ; 92c33
ld hl, $0005
add hl, bc
ld [hl], $1
ret
; 92c3a
Function92c3a: ; 92c3a
ld hl, $0005
add hl, bc
ld [hl], $0
ld hl, $0000
add hl, bc
ld [hl], $1
ld hl, $000f
add hl, bc
ld [hl], $3
Function92c4c: ; 92c4c
ld hl, $000f
add hl, bc
ld a, [hl]
and a
jr z, .asm_92c56
dec [hl]
ret
.asm_92c56
ld hl, $0000
add hl, bc
ld a, $0
ld [hl], a
ret
; 92c5e
Function92c5e: ; 92c5e
ld a, [$c709]
cp $ff
jr z, .asm_92c72
ld hl, $0009
add hl, bc
ld a, [hl]
and a
jr z, .asm_92c72
dec [hl]
call Function92c76
ret nz
.asm_92c72
call Function92c3a
ret
; 92c76
Function92c76: ; 92c76
call Function92a12
ld a, [$c709]
ld e, a
ld a, [hli]
cp e
ret z
ld a, [hli]
cp e
ret z
ld a, [hl]
cp e
ret
; 92c86
Function92c86: ; 92c86
call Function92e94
jr nc, .asm_92c94
ld a, [$c717]
ld hl, $c709
cp [hl]
jr z, .asm_92ca5
.asm_92c94
ld a, [$c709]
cp $ff
jr z, .asm_92ca5
ld hl, $0009
add hl, bc
ld a, [hl]
and a
jr z, .asm_92ca5
dec [hl]
ret
.asm_92ca5
call Function92c3a
ret
; 92ca9
Function92ca9: ; 92ca9
call Function92f1d
jr nc, .asm_92cbd
ld hl, $c709
cp [hl]
jr z, .asm_92cce
ld hl, $0009
add hl, bc
ld a, [hl]
and a
ret z
dec [hl]
ret
.asm_92cbd
ld a, [$c709]
cp $ff
jr z, .asm_92cce
ld hl, $0009
add hl, bc
ld a, [hl]
and a
jr z, .asm_92cce
dec [hl]
ret
.asm_92cce
call Function92c3a
ret
; 92cd2
Function92cd2: ; 92cd2
call Function92e94
jr nc, .asm_92ce1
ld a, [$c70c]
and a
jr z, .asm_92ce1
call Function92c3a
ret
.asm_92ce1
ld a, SFX_STOP_SLOT
call Function9331e
ld hl, $0000
add hl, bc
inc [hl]
ld hl, $000a
add hl, bc
ld [hl], $20
ld hl, $0005
add hl, bc
ld [hl], $0
ret
; 92cf8
Function92cf8: ; 92cf8
ld hl, $000a
add hl, bc
ld a, [hl]
and a
jr z, .asm_92d02
dec [hl]
ret
.asm_92d02
ld a, SFX_THROW_BALL
call Function9331e
ld hl, $0000
add hl, bc
inc [hl]
ld hl, $0005
add hl, bc
ld [hl], $8
ret
; 92d13
Function92d13: ; 92d13
call Function92e94
ret nc
ld a, [$c70c]
and a
ret z
call Function92c3a
ret
; 92d20
Function92d20: ; 92d20
call Function92f1d
ret c
ld a, SFX_STOP_SLOT
call Function9331e
call Function93316
ld hl, $0000
add hl, bc
inc [hl]
ld hl, $0005
add hl, bc
ld [hl], $0
call Function92fc0
push bc
push af
ld de, $6068
ld a, $6
call Function3b2a
ld hl, $000e
add hl, bc
pop af
ld [hl], a
pop bc
xor a
ld [$cf64], a
Function92d4f: ; 92d4f
ld a, [$cf64]
cp $2
jr z, .asm_92d5b
cp $1
jr z, .asm_92d62
ret
.asm_92d5b
call Function92f1d
call Function92c3a
ret
.asm_92d62
ld hl, $0000
add hl, bc
inc [hl]
ld hl, $0005
add hl, bc
ld [hl], $8
ret
; 92d6e
Function92d6e: ; 92d6e
xor a
ld [$cf64], a
ld hl, $0000
add hl, bc
dec [hl]
ld hl, $0005
add hl, bc
ld [hl], $0
ret
; 92d7e
Function92d7e: ; 92d7e
call Function92f1d
ret c
ld a, SFX_STOP_SLOT
call Function9331e
call Function93316
ld hl, $0000
add hl, bc
inc [hl]
ld hl, $0005
add hl, bc
ld [hl], $0
push bc
ld de, $6000
ld a, $7
call Function3b2a
pop bc
xor a
ld [$cf64], a
ret
; 92da4
Function92da4: ; 92da4
ld a, [$cf64]
and a
ret z
ld hl, $0000
add hl, bc
inc [hl]
ld a, $2
ld [$cf64], a
Function92db3: ; 92db3
ld a, [$cf64]
cp $4
ret c
ld hl, $0000
add hl, bc
inc [hl]
ld hl, $0005
add hl, bc
ld [hl], $10
ld hl, $000a
add hl, bc
ld [hl], $11
Function92dca: ; 92dca
ld hl, $000a
add hl, bc
ld a, [hl]
and a
jr z, .asm_92dd4
dec [hl]
ret
.asm_92dd4
call Function92f1d
jr nc, .asm_92de5
and a
jr nz, .asm_92de5
ld a, $5
ld [$cf64], a
call Function92c3a
ret
.asm_92de5
ld hl, $0005
add hl, bc
ld [hl], $0
ld hl, $0000
add hl, bc
dec [hl]
dec [hl]
ld a, $1
ld [$cf64], a
ret
; 92df7
Function92df7: ; 92df7
call Function92f1d
ret c
ld a, SFX_STOP_SLOT
call Function9331e
call Function93316
ld hl, $0000
add hl, bc
inc [hl]
call Function92fc0
ld hl, $000a
add hl, bc
ld [hl], a
Function92e10: ; 92e10
ld hl, $000a
add hl, bc
ld a, [hl]
and a
jr nz, .asm_92e1f
call Function92f1d
call Function92c3a
ret
.asm_92e1f
dec [hl]
ld hl, $0000
add hl, bc
inc [hl]
ld hl, $000b
add hl, bc
ld [hl], $20
ld hl, $0005
add hl, bc
ld [hl], $0
Function92e31: ; 92e31
ld hl, $000b
add hl, bc
ld a, [hl]
and a
jr z, .asm_92e3b
dec [hl]
ret
.asm_92e3b
ld hl, $0000
add hl, bc
dec [hl]
ld hl, $0005
add hl, bc
ld [hl], $8
ret
; 92e47
Function92e47: ; 92e47
call Function92f1d
ret c
ld a, SFX_STOP_SLOT
call Function9331e
call Function93316
ld hl, $0005
add hl, bc
ld [hl], $1
ld hl, $0000
add hl, bc
inc [hl]
ld hl, $000a
add hl, bc
ld [hl], $10
Function92e64: ; 92e64
ld hl, $000a
add hl, bc
ld a, [hl]
and a
jr z, .asm_92e73
dec [hl]
.asm_92e6d
ld a, SFX_GOT_SAFARI_BALLS
call Function9331e
ret
.asm_92e73
ld a, [$c709]
and a
jr nz, .asm_92e88
call Function92f1d
jr nc, .asm_92e6d
and a
jr nz, .asm_92e6d
call Function92c3a
call WaitSFX
ret
.asm_92e88
call Function92f1d
jr c, .asm_92e6d
call Function92c3a
call WaitSFX
ret
; 92e94
Function92e94: ; 92e94
xor a
ld [$c70b], a
ld [$c70c], a
call Function92a12
call Function92fb4
ld a, [$c70a]
and 3
ld e, a
ld d, 0
ld hl, Jumptable_92ebd
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .asm_92eb6
push de
jp [hl]
.asm_92eb6
ld a, [$c70b]
and a
ret z
scf
ret
; 92ebd
Jumptable_92ebd: ; 92ebd
dw Function92ed4
dw Function92ed1
dw Function92ecb
dw Function92ec5
; 92ec5
Function92ec5: ; 92ec5
call Function92ee0
call Function92ef6
Function92ecb: ; 92ecb
call Function92ed5
call Function92f01
Function92ed1: ; 92ed1
call Function92eeb
Function92ed4: ; 92ed4
ret
; 92ed5
Function92ed5: ; 92ed5
ld hl, $c70e
ld a, [EnemyScreens]
cp [hl]
call z, Function92f0c
ret
; 92ee0
Function92ee0: ; 92ee0
ld hl, $c70f
ld a, [$c700]
cp [hl]
call z, Function92f0c
ret
; 92eeb
Function92eeb: ; 92eeb
ld hl, $c70f
ld a, [$c701]
cp [hl]
call z, Function92f0c
ret
; 92ef6
Function92ef6: ; 92ef6
ld hl, $c70f
ld a, [$c702]
cp [hl]
call z, Function92f0c
ret
; 92f01
Function92f01: ; 92f01
ld hl, $c710
ld a, [$c702]
cp [hl]
call z, Function92f0c
ret
; 92f0c
Function92f0c: ; 92f0c
ld [$c717], a
and a
jr nz, .asm_92f17
ld a, $1
ld [$c70c], a
.asm_92f17
ld a, $1
ld [$c70b], a
ret
; 92f1d
Function92f1d: ; 92f1d
ld a, $ff
ld [EffectFailed], a
call Function92a12
call Function92fb4
ld a, [$c70a]
and 3
ld e, a
ld d, 0
ld hl, Jumptable_92f48
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .asm_92f3d
push de
jp [hl]
.asm_92f3d
ld a, [$c70d]
cp $ff
jr nz, .asm_92f46
and a
ret
.asm_92f46
scf
ret
; 92f48
Jumptable_92f48: ; 92f48
dw Function92f5f
dw Function92f5c
dw Function92f56
dw Function92f50
; 92f50
Function92f50: ; 92f50
call Function92f70
call Function92f90
Function92f56: ; 92f56
call Function92f60
call Function92fa0
Function92f5c: ; 92f5c
call Function92f80
Function92f5f: ; 92f5f
ret
; 92f60
Function92f60: ; 92f60
ld hl, $c70e
ld a, [$c700]
cp [hl]
ret nz
ld hl, $c703
cp [hl]
call z, Function92fb0
ret
; 92f70
Function92f70: ; 92f70
ld hl, $c710
ld a, [$c700]
cp [hl]
ret nz
ld hl, $c704
cp [hl]
call z, Function92fb0
ret
; 92f80
Function92f80: ; 92f80
ld hl, $c70f
ld a, [$c701]
cp [hl]
ret nz
ld hl, $c704
cp [hl]
call z, Function92fb0
ret
; 92f90
Function92f90: ; 92f90
ld hl, $c70e
ld a, [$c702]
cp [hl]
ret nz
ld hl, $c704
cp [hl]
call z, Function92fb0
ret
; 92fa0
Function92fa0: ; 92fa0
ld hl, $c710
ld a, [$c702]
cp [hl]
ret nz
ld hl, $c705
cp [hl]
call z, Function92fb0
ret
; 92fb0
Function92fb0: ; 92fb0
ld [$c70d], a
ret
; 92fb4
Function92fb4: ; 92fb4
ld de, $c70e
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
ret
; 92fc0
Function92fc0: ; 92fc0
ld hl, $0003
add hl, bc
ld a, [hl]
push af
push hl
call Function92fcf
pop hl
pop af
ld [hl], a
ld a, e
ret
; 92fcf
Function92fcf: ; 92fcf
ld a, [$c709]
and a
jr nz, .asm_92fe8
ld e, $0
.asm_92fd7
ld hl, $0003
add hl, bc
inc [hl]
inc e
push de
call Function92f1d
pop de
jr nc, .asm_92fd7
and a
jr nz, .asm_92fd7
ret
.asm_92fe8
call Random
and $7
cp $4
jr c, .asm_92fe8
ld e, a
.asm_92ff2
ld a, e
inc e
ld hl, $0003
add hl, bc
add [hl]
ld [hl], a
push de
call Function92f1d
pop de
jr c, .asm_92ff2
ret
; 93002
Function93002: ; 93002 (24:7002)
ld a, [$c709]
and a
ret z
ld hl, Unknown_93023
ld a, [ScriptVar] ; $c2dd
and a
jr z, .asm_93013
ld hl, Unknown_93031
.asm_93013
call Random
ld c, a
.asm_93017
ld a, [hli]
cp c
jr nc, .asm_9301e
inc hl
jr .asm_93017
.asm_9301e
ld a, [hl]
ld [$c709], a
ret
; 93023 (24:7023)
Unknown_93023: ; 93023
db $01, $00
db $03, $04
db $0a, $14
db $14, $10
db $28, $0c
db $30, $08
db $ff, $ff
; 93031
Unknown_93031: ; 93031
db $02, $00
db $03, $04
db $08, $14
db $10, $10
db $1e, $0c
db $50, $08
db $ff, $ff
; 9303f
Function9303f: ; 9303f (24:703f)
ld b, $14
ld a, [$c70a]
dec a
jr z, asm_93066
dec a
jr z, asm_9305a
jr asm_9304e
Function9304c: ; 9304c (24:704c)
ld b, $23
asm_9304e: ; 9304e (24:704e)
hlcoord 3, 2
call Function93069
hlcoord 3, 10
call Function93069
asm_9305a: ; 9305a (24:705a)
hlcoord 3, 4
call Function93069
hlcoord 3, 8
call Function93069
asm_93066: ; 93066 (24:7066)
hlcoord 3, 6
Function93069: ; 93069 (24:7069)
ld a, b
ld [hl], a
ld de, $d
add hl, de
ld [hl], a
ld de, $7
add hl, de
inc a
ld [hl], a
ld de, $d
add hl, de
ld [hl], a
ret
Function9307c: ; 9307c (24:707c)
ld hl, UnknownText_0x930c7
call PrintText
ld hl, MenuDataHeader_0x930d6
call LoadMenuDataHeader
call Function1d81
call Function1c17
ret c
ld a, [$cfa9]
ld b, a
ld a, $4
sub b
ld [$c70a], a ; $c70a
ld hl, Coins ; $d855
ld c, a
ld a, [hli]
and a
jr nz, .asm_930ad
ld a, [hl]
cp c
jr nc, .asm_930ad
ld hl, UnknownText_0x930d1
call PrintText
jr Function9307c
.asm_930ad
ld hl, Coins + 1
ld a, [hl]
sub c
ld [hld], a
jr nc, .asm_930b6
dec [hl]
.asm_930b6
call WaitSFX
ld de, SFX_PAY_DAY
call PlaySFX
ld hl, UnknownText_0x930cc
call PrintText
and a
ret
; 930c7 (24:70c7)
UnknownText_0x930c7: ; 0x930c7
; Bet how many coins?
text_jump UnknownText_0x1c5049
db "@"
; 0x930cc
UnknownText_0x930cc: ; 0x930cc
; Start!
text_jump UnknownText_0x1c505e
db "@"
; 0x930d1
UnknownText_0x930d1: ; 0x930d1
; Not enough coins.
text_jump UnknownText_0x1c5066
db "@"
; 0x930d6
MenuDataHeader_0x930d6: ; 0x930d6
db $40 ; flags
db 10, 14 ; start coords
db 17, 19 ; end coords
dw MenuData2_0x930de
db 1 ; default option
; 0x930de
MenuData2_0x930de: ; 0x930de
db $80 ; flags
db 3 ; items
db " 3@"
db " 2@"
db " 1@"
; 0x930e9
Function930e9: ; 930e9 (24:70e9)
ld hl, Coins ; $d855
ld a, [hli]
or [hl]
jr nz, .asm_930fd
ld hl, UnknownText_9311a
call PrintText
ld c, $3c
call DelayFrames
jr .asm_93118
.asm_930fd
ld hl, UnknownText_9311f
call PrintText
call Function1d58
lb bc, 14, 12
call PlaceYesNoBox
ld a, [$cfa9]
dec a
call Function1c17
and a
jr nz, .asm_93118
and a
ret
.asm_93118
scf
ret
; 9311a (24:711a)
UnknownText_9311a: ; 9311a
TX_FAR UnknownText_0x1c5079
db "@"
UnknownText_9311f: ; 9311f
TX_FAR UnknownText_0x1c5092
db "@"
Function93124: ; 93124 (24:7124)
ld a, [EffectFailed] ; $c70d
cp $ff
jr z, .asm_93151
srl a
ld e, a
ld d, 0
ld hl, .data_93145
add hl, de
ld a, [hli]
ld [PlayerUsedMoves], a ; $c712
ld e, a
ld a, [hl]
ld [$c711], a
ld d, a
callba Function105fe3
ret
.data_93145
db $2c, $01
db $32, $00
db $06, $00
db $08, $00
db $0a, $00
db $0f, $00
.asm_93151
ld hl, $c711
xor a
ld [hli], a
ld [hl], a
ret
Function93158: ; 93158 (24:7158)
ld a, [EffectFailed] ; $c70d
cp $ff
jr nz, .asm_9316c
ld hl, UnknownText_0x931e0
call PrintText
callba Function105fd0
ret
.asm_9316c
srl a
ld e, a
ld d, 0
ld hl, Unknown_93195
add hl, de
add hl, de
add hl, de
ld de, StringBuffer2 ; $d086
ld bc, $4
call CopyBytes
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .asm_93188
push de
jp [hl]
.asm_93188
ld hl, UnknownText_0x931b9
call PrintText
callba Function105f9f
ret
; 93195 (24:7195)
Unknown_93195: ; 93195
db "300@"
dw Function931e5
db "50@@"
dw Function9320b
db "6@@@"
dw Function93214
db "8@@@"
dw Function93214
db "10@@"
dw Function93214
db "15@@"
dw Function93214
; 931b9
UnknownText_0x931b9: ; 0x931b9
start_asm
; 0x931ba
Function931ba: ; 931ba
ld a, [EffectFailed]
add $25
ld [$c5a6], a
inc a
ld [$c5ba], a
inc a
ld [$c5a7], a
inc a
ld [$c5bb], a
hlcoord 18, 17
ld [hl], $ee
ld hl, UnknownText_0x931db
inc bc
inc bc
inc bc
inc bc
ret
; 931db
UnknownText_0x931db: ; 0x931db
; lined up! Won @ coins!
text_jump UnknownText_0x1c509f
db "@"
; 0x931e0
UnknownText_0x931e0: ; 0x931e0
; Darn!
text_jump UnknownText_0x1c50bb
db "@"
; 0x931e5
Function931e5: ; 931e5
ld a, SFX_2ND_PLACE
call Function9331e
call WaitSFX
ld a, [$d002]
and a
jr nz, .asm_931ff
call Random
and $14
ret z
ld a, $ff
ld [$c709], a
ret
.asm_931ff
call Random
and $1c
ret z
ld a, $ff
ld [$c709], a
ret
; 9320b
Function9320b: ; 9320b
ld a, SFX_3RD_PLACE
call Function9331e
call WaitSFX
ret
; 93214
Function93214: ; 93214
ld a, SFX_PRESENT
call Function9331e
call WaitSFX
ret
; 9321d
Function9321d: ; 9321d (24:721d)
ld hl, $b
add hl, bc
ld e, [hl]
ld d, 0
ld hl, Jumptable_9322d
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_9322d: ; 9322d (24:722d)
dw Function93233
dw Function93259
dw Function93289
Function93233: ; 93233 (24:7233)
ld hl, $e
add hl, bc
ld a, [hl]
and a
jr nz, .asm_93247
ld a, $2
ld [$cf64], a
ld hl, $0
add hl, bc
ld [hl], $0
ret
.asm_93247
dec [hl]
ld hl, $b
add hl, bc
inc [hl]
ld hl, $c
add hl, bc
ld [hl], $30
ld hl, $6
add hl, bc
ld [hl], $0
Function93259: ; 93259 (24:7259)
ld hl, $c
add hl, bc
ld a, [hl]
cp $20
jr c, .asm_93273
dec [hl]
ld e, a
ld d, $70
callba Functionce765
ld a, e
ld hl, $7
add hl, bc
ld [hl], a
ret
.asm_93273
ld hl, $b
add hl, bc
inc [hl]
ld hl, $d
add hl, bc
ld [hl], $2
ld a, $1
ld [$cf64], a
ld a, SFX_PLACE_PUZZLE_PIECE_DOWN
call Function9331e
ret
Function93289: ; 93289 (24:7289)
ld hl, $6
add hl, bc
ld a, [hl]
inc [hl]
inc [hl]
cp $48
jr nc, .asm_932a3
and $3
ret nz
ld hl, $d
add hl, bc
ld a, [hl]
xor $ff
inc a
ld [hl], a
ld [hSCY], a ; $ff00+$d0
ret
.asm_932a3
ld hl, $b
add hl, bc
xor a
ld [hl], a
ld [hSCY], a ; $ff00+$d0
ret
Function932ac: ; 932ac (24:72ac)
ld hl, $b
add hl, bc
ld e, [hl]
ld d, 0
ld hl, Jumptable_932bc
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_932bc: ; 932bc (24:72bc)
dw Function932c2
dw Function932e0
dw Function932fc
Function932c2: ; 932c2 (24:72c2)
ld hl, $4
add hl, bc
ld a, [hl]
inc [hl]
cp $68
jr z, .asm_932d6
and $f
ret nz
ld de, SFX_JUMP_OVER_LEDGE
call PlaySFX
ret
.asm_932d6
ld hl, $b
add hl, bc
inc [hl]
ld a, $1
ld [$cf64], a
Function932e0: ; 932e0 (24:72e0)
ld a, [$cf64]
cp $2
jr z, .asm_932f1
cp $5
ret nz
ld hl, $0
add hl, bc
ld [hl], $0
ret
.asm_932f1
ld hl, $b
add hl, bc
inc [hl]
ld hl, $c
add hl, bc
ld [hl], $8
Function932fc: ; 932fc (24:72fc)
ld hl, $c
add hl, bc
ld a, [hl]
and a
jr z, .asm_93306
dec [hl]
ret
.asm_93306
ld hl, $b
add hl, bc
dec [hl]
push bc
ld de, $606c
ld a, $8
call Function3b2a
pop bc
ret
; 93316 (24:7316)
Function93316: ; 93316
push bc
ld c, $10
call DelayFrames
pop bc
ret
; 9331e
Function9331e: ; 9331e (24:731e)
push de
ld e, a
ld d, 0
call PlaySFX
pop de
ret
; 93327 (24:7327)
Unknown_93327: ; 93327
db $00, $08, $14, $0c, $10, $00, $08, $14, $0c, $10, $04, $08, $14, $0c, $10, $00, $08, $14
Unknown_93339: ; 93339
db $00, $0c, $08, $10, $14, $04, $0c, $08, $10, $14, $04, $0c, $08, $10, $14, $00, $0c, $08
Unknown_9334b: ; 9334b
db $00, $0c, $08, $10, $14, $0c, $08, $10, $14, $0c, $04, $08, $10, $14, $0c, $00, $0c, $08
; 9335d
SlotsTilemap: ; 9335d
INCBIN "gfx/slots.tilemap"
; 9344d
Slots1LZ: ; 9344d
INCBIN "gfx/slots_1.2bpp.lz"
; 935cd
Slots2LZ: ; 935cd
INCBIN "gfx/slots_2.2bpp.lz"
; 9382d
Slots3LZ: ; 9382d
INCBIN "gfx/slots_3.2bpp.lz"
; 93a3d
SECTION "bank28", ROMX, BANK[$28]
INCLUDE "engine/more_phone_scripts.asm"
INCLUDE "engine/buena_scripts.asm"
INCLUDE "text/buena.asm"
SECTION "bank29", ROMX, BANK[$29]
INCLUDE "text/phone/extra2.asm"
SECTION "Tileset Data 5", ROMX, BANK[TILESETS_5]
INCLUDE "tilesets/data_5.asm"
SECTION "bank2E", ROMX, BANK[$2E]
Functionb8000:: ; b8000
xor a
ld [hBGMapMode], a
callba Functionb800a
ret
; b800a
Functionb800a: ; b800a
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetWorldMapLocation
ld [$c2d9], a
call Functionb8089
jr z, .asm_b8024
call GetMapPermission
cp $6
jr nz, .asm_b8029
.asm_b8024
ld a, $ff
ld [$c2d9], a
.asm_b8029
ld hl, $d83e
bit 1, [hl]
res 1, [hl]
jr nz, .asm_b8054
call Functionb8064
jr z, .asm_b8054
ld a, [$c2d9]
ld [$c2d8], a
call Functionb8070
jr z, .asm_b8054
ld a, $3c
ld [$c2da], a
call Functionb80c6
call Functionb80d3
callba Function104303
ret
.asm_b8054
ld a, [$c2d9]
ld [$c2d8], a
ld a, $90
ld [rWY], a
ld [hWY], a
xor a
ld [hLCDStatCustom], a
ret
; b8064
Functionb8064: ; b8064
ld a, [$c2d9]
ld c, a
ld a, [$c2d8]
cp c
ret z
cp $0
ret
; b8070
Functionb8070: ; b8070
cp -1
ret z
cp SPECIAL_MAP
ret z
cp RADIO_TOWER
ret z
cp LAV_RADIO_TOWER
ret z
cp UNDERGROUND
ret z
cp INDIGO_PLATEAU
ret z
cp POWER_PLANT
ret z
ld a, $1
and a
ret
; b8089
Functionb8089: ; b8089
ld a, [MapGroup]
cp GROUP_ROUTE_35_NATIONAL_PARK_GATE
ret nz
ld a, [MapNumber]
cp MAP_ROUTE_35_NATIONAL_PARK_GATE
ret z
cp MAP_ROUTE_36_NATIONAL_PARK_GATE
ret
; b8098
Functionb8098:: ; b8098 (2e:4098)
ld hl, $c2da
ld a, [hl]
and a
jr z, .asm_b80bc
dec [hl]
cp $3c
ret z
cp $3b
jr nz, .asm_b80b3
call Functionb80d3
call Functionb80e1
callba Function104303
.asm_b80b3
ld a, $80
ld a, $70
ld [rWY], a ; $ff00+$4a
ld [hWY], a ; $ff00+$d2
ret
.asm_b80bc
ld a, $90
ld [rWY], a ; $ff00+$4a
ld [hWY], a ; $ff00+$d2
xor a
ld [hLCDStatCustom], a ; $ff00+$c6
ret
Functionb80c6: ; b80c6
ld de, GFX_f9344
ld hl, $9600
lb bc, BANK(GFX_f9344), $e
call Get2bpp
ret
; b80d3
Functionb80d3: ; b80d3
ld hl, TileMap
ld b, $2
ld c, $12
call Functionb8115
call Functionb812f
ret
; b80e1
Functionb80e1: ; b80e1 (2e:40e1)
ld a, [$c2d9]
ld e, a
callba GetLandmarkName
call Functionb8101
ld a, $14
sub c
srl a
ld b, $0
ld c, a
hlcoord 0, 2
add hl, bc
ld de, StringBuffer1 ; $d073
call PlaceString
ret
Functionb8101: ; b8101 (2e:4101)
ld c, $0
push hl
ld hl, StringBuffer1 ; $d073
.asm_b8107
ld a, [hli]
cp $50
jr z, .asm_b8113
cp $25
jr z, .asm_b8107
inc c
jr .asm_b8107
.asm_b8113
pop hl
ret
Functionb8115: ; b8115
ld de, AttrMap - TileMap
add hl, de
inc b
inc b
inc c
inc c
ld a, $87
.asm_b811f
push bc
push hl
.asm_b8121
ld [hli], a
dec c
jr nz, .asm_b8121
pop hl
ld de, $0014
add hl, de
pop bc
dec b
jr nz, .asm_b811f
ret
; b812f
Functionb812f: ; b812f
ld hl, TileMap
ld a, $61
ld [hli], a
ld a, $62
call Functionb8164
ld a, $64
ld [hli], a
ld a, $65
ld [hli], a
call Functionb815b
ld a, $6b
ld [hli], a
ld a, $66
ld [hli], a
call Functionb815b
ld a, $6c
ld [hli], a
ld a, $67
ld [hli], a
ld a, $68
call Functionb8164
ld a, $6a
ld [hl], a
ret
; b815b
Functionb815b: ; b815b
ld c, $12
ld a, $6d
.asm_b815f
ld [hli], a
dec c
jr nz, .asm_b815f
ret
; b8164
Functionb8164: ; b8164
ld c, $5
jr .asm_b816a
.asm_b8168
ld [hli], a
ld [hli], a
.asm_b816a
inc a
ld [hli], a
ld [hli], a
dec a
dec c
jr nz, .asm_b8168
ret
; b8172
Functionb8172: ; b8172
call GetMapScriptHeaderBank
ld [Buffer1], a
ld a, [XCoord]
add $5
ld [$d1ed], a
ld a, [YCoord]
add $4
ld [$d1ec], a
ld hl, $dc02
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$dc01]
and a
jr z, .asm_b81dd
.asm_b8194
ld [Buffer2], a
push hl
call Functionb81e2
ld e, a
ld a, [$d1ec]
sub e
jr c, .asm_b81d2
cp $9
jr nc, .asm_b81d2
call Functionb81e2
ld d, a
ld a, [$d1ed]
sub d
jr c, .asm_b81d2
cp $a
jr nc, .asm_b81d2
call Functionb81e2
cp $7
jr nz, .asm_b81d2
ld a, [Buffer1]
call GetFarHalfword
ld a, [Buffer1]
call GetFarHalfword
ld d, h
ld e, l
ld b, $2
call EventFlagAction
ld a, c
and a
jr z, .asm_b81df
.asm_b81d2
pop hl
ld bc, $0005
add hl, bc
ld a, [Buffer2]
dec a
jr nz, .asm_b8194
.asm_b81dd
xor a
ret
.asm_b81df
pop hl
scf
ret
; b81e2
Functionb81e2: ; b81e2
ld a, [Buffer1]
call GetFarByte
inc hl
ret
; b81ea
TreeMonEncounter: ; b81ea
callba Function1060ef
xor a
ld [$d22e], a
ld [CurPartyLevel], a
ld hl, TreeMonMaps
call GetTreeMonSet
jr nc, .no_battle
call GetTreeMons
jr nc, .no_battle
call GetTreeMon
jr nc, .no_battle
ld a, BATTLETYPE_TREE
ld [BattleType], a
ld a, 1
ld [ScriptVar], a
ret
.no_battle
xor a
ld [ScriptVar], a
ret
; b8219
RockMonEncounter: ; b8219
xor a
ld [$d22e], a
ld [CurPartyLevel], a
ld hl, RockMonMaps
call GetTreeMonSet
jr nc, .no_battle
call GetTreeMons
jr nc, .no_battle
ld a, 10
call RandomRange
cp 4
jr nc, .no_battle
call SelectTreeMon
jr nc, .no_battle
ret
.no_battle
xor a
ret
; b823e
db $05 ; ????
GetTreeMonSet: ; b823f
; Return carry and treemon set in a
; if the current map is in table hl.
ld a, [MapNumber]
ld e, a
ld a, [MapGroup]
ld d, a
.loop
ld a, [hli]
cp -1
jr z, .not_in_table
cp d
jr nz, .skip2
ld a, [hli]
cp e
jr nz, .skip1
jr .in_table
.skip2
inc hl
.skip1
inc hl
jr .loop
.not_in_table
xor a
ret
.in_table
ld a, [hl]
scf
ret
; b825e
TreeMonMaps: ; b825e
treemon_map: macro
map \1
db \2 ; treemon set
endm
treemon_map ROUTE_26, 4
treemon_map ROUTE_27, 4
treemon_map ROUTE_28, 0
treemon_map ROUTE_29, 3
treemon_map ROUTE_30, 3
treemon_map ROUTE_31, 3
treemon_map ROUTE_32, 4
treemon_map ROUTE_33, 2
treemon_map ROUTE_34, 3
treemon_map ROUTE_35, 3
treemon_map ROUTE_36, 3
treemon_map ROUTE_37, 3
treemon_map ROUTE_38, 3
treemon_map ROUTE_39, 3
treemon_map ROUTE_40, 0
treemon_map ROUTE_41, 0
treemon_map ROUTE_42, 2
treemon_map ROUTE_43, 5
treemon_map ROUTE_44, 1
treemon_map ROUTE_45, 1
treemon_map ROUTE_46, 1
treemon_map NEW_BARK_TOWN, 0
treemon_map CHERRYGROVE_CITY, 0
treemon_map VIOLET_CITY, 0
treemon_map AZALEA_TOWN, 2
treemon_map CIANWOOD_CITY, 0
treemon_map GOLDENROD_CITY, 0
treemon_map OLIVINE_CITY, 0
treemon_map ECRUTEAK_CITY, 0
treemon_map MAHOGANY_TOWN, 0
treemon_map LAKE_OF_RAGE, 5
treemon_map BLACKTHORN_CITY, 0
treemon_map SILVER_CAVE_OUTSIDE, 0
treemon_map ILEX_FOREST, 6
db -1
; b82c5
RockMonMaps: ; b82c5
treemon_map CIANWOOD_CITY, 7
treemon_map ROUTE_40, 7
treemon_map DARK_CAVE_VIOLET_ENTRANCE, 7
treemon_map SLOWPOKE_WELL_B1F, 7
db -1
; b82d2
GetTreeMons: ; b82d2
; Return the address of TreeMon table a in hl.
; Return nc if table a doesn't exist.
cp 8
jr nc, .quit
and a
jr z, .quit
ld e, a
ld d, 0
ld hl, TreeMons
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
scf
ret
.quit
xor a
ret
; b82e8
TreeMons: ; b82e8
dw TreeMons1
dw TreeMons1
dw TreeMons2
dw TreeMons3
dw TreeMons4
dw TreeMons5
dw TreeMons6
dw RockMons
dw TreeMons1
; Two tables each (normal, rare).
; Structure:
; db %, species, level
TreeMons1: ; b82fa
db 50, SPEAROW, 10
db 15, SPEAROW, 10
db 15, SPEAROW, 10
db 10, AIPOM, 10
db 5, AIPOM, 10
db 5, AIPOM, 10
db -1
db 50, SPEAROW, 10
db 15, HERACROSS, 10
db 15, HERACROSS, 10
db 10, AIPOM, 10
db 5, AIPOM, 10
db 5, AIPOM, 10
db -1
TreeMons2: ; b8320
db 50, SPEAROW, 10
db 15, EKANS, 10
db 15, SPEAROW, 10
db 10, AIPOM, 10
db 5, AIPOM, 10
db 5, AIPOM, 10
db -1
db 50, SPEAROW, 10
db 15, HERACROSS, 10
db 15, HERACROSS, 10
db 10, AIPOM, 10
db 5, AIPOM, 10
db 5, AIPOM, 10
db -1
TreeMons3: ; b8346
db 50, HOOTHOOT, 10
db 15, SPINARAK, 10
db 15, LEDYBA, 10
db 10, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db -1
db 50, HOOTHOOT, 10
db 15, PINECO, 10
db 15, PINECO, 10
db 10, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db -1
TreeMons4: ; b836c
db 50, HOOTHOOT, 10
db 15, EKANS, 10
db 15, HOOTHOOT, 10
db 10, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db -1
db 50, HOOTHOOT, 10
db 15, PINECO, 10
db 15, PINECO, 10
db 10, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db -1
TreeMons5: ; b8392
db 50, HOOTHOOT, 10
db 15, VENONAT, 10
db 15, HOOTHOOT, 10
db 10, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db -1
db 50, HOOTHOOT, 10
db 15, PINECO, 10
db 15, PINECO, 10
db 10, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db 5, EXEGGCUTE, 10
db -1
TreeMons6: ; b83b8
db 50, HOOTHOOT, 10
db 15, PINECO, 10
db 15, PINECO, 10
db 10, NOCTOWL, 10
db 5, BUTTERFREE, 10
db 5, BEEDRILL, 10
db -1
db 50, HOOTHOOT, 10
db 15, CATERPIE, 10
db 15, WEEDLE, 10
db 10, HOOTHOOT, 10
db 5, METAPOD, 10
db 5, KAKUNA, 10
db -1
RockMons: ; b83de
db 90, KRABBY, 15
db 10, SHUCKLE, 15
db -1
; b83e5
GetTreeMon: ; b83e5
push hl
call GetTreeScore
pop hl
and a
jr z, .bad
cp 1
jr z, .good
cp 2
jr z, .rare
ret
.bad
ld a, 10
call RandomRange
and a
jr nz, NoTreeMon
jr SelectTreeMon
.good
ld a, 10
call RandomRange
cp 5
jr nc, NoTreeMon
jr SelectTreeMon
.rare
ld a, 10
call RandomRange
cp 8
jr nc, NoTreeMon
jr .skip
.skip
ld a, [hli]
cp -1
jr nz, .skip
call SelectTreeMon
ret
; b841f
SelectTreeMon: ; b841f
; Read a TreeMons table and pick one monster at random.
ld a, 100
call RandomRange
.loop
sub [hl]
jr c, .ok
inc hl
inc hl
inc hl
jr .loop
.ok
ld a, [hli]
cp $ff
jr z, NoTreeMon
ld a, [hli]
ld [$d22e], a
ld a, [hl]
ld [CurPartyLevel], a
scf
ret
NoTreeMon: ; b843b
xor a
ld [$d22e], a
ld [CurPartyLevel], a
ret
; b8443
GetTreeScore: ; b8443
call .CoordScore
ld [Buffer1], a
call .OTIDScore
ld [Buffer2], a
ld c, a
ld a, [Buffer1]
sub c
jr z, .rare
jr nc, .ok
add 10
.ok
cp 5
jr c, .good
.bad
xor a
ret
.good
ld a, 1
ret
.rare
ld a, 2
ret
; b8466
.CoordScore: ; b8466
call GetFacingTileCoord
ld hl, 0
ld c, e
ld b, 0
ld a, d
and a
jr z, .next
.loop
add hl, bc
dec a
jr nz, .loop
.next
add hl, bc
ld c, d
add hl, bc
ld a, h
ld [hDividend], a
ld a, l
ld [hDividend + 1], a
ld a, 5
ld [hDivisor], a
ld b, 2
call Divide
ld a, [hQuotient + 1]
ld [hDividend], a
ld a, [hQuotient + 2]
ld [hDividend + 1], a
ld a, 10
ld [hDivisor], a
ld b, 2
call Divide
ld a, [hQuotient + 3]
ret
; b849d
.OTIDScore: ; b849d
ld a, [PlayerID]
ld [hDividend], a
ld a, [PlayerID + 1]
ld [hDividend + 1], a
ld a, 10
ld [hDivisor], a
ld b, 2
call Divide
ld a, [hQuotient + 3]
ret
; b84b3
Functionb84b3: ; b84b3
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ld de, FishingGFX
ld a, [PlayerGender]
bit 0, a
jr z, .asm_b84c7
ld de, KrisFishingGFX
.asm_b84c7
ld hl, $8020
call Functionb84e3
ld hl, $8060
call Functionb84e3
ld hl, $80a0
call Functionb84e3
ld hl, $9000 - $40
call Functionb84e3
pop af
ld [rVBK], a
ret
; b84e3
Functionb84e3: ; b84e3
lb bc, BANK(FishingGFX), 2
push de
call Get2bpp
pop de
ld hl, $20
add hl, de
ld d, h
ld e, l
ret
; b84f2
FishingGFX: ; b84f2
INCBIN "baserom.gbc",$b84f2,$b8582 - $b84f2
; b8582
KrisFishingGFX: ; b8582
INCBIN "baserom.gbc",$b8582,$b8612 - $b8582
; b8612
PlayRadioShow: ; b8612
ld a, [$d002]
cp 8
jr nc, .ok
ld a, [StatusFlags2]
bit 0, a
jr z, .ok
call IsInJohto
and a
jr nz, .ok
ld a, 7
ld [$d002], a
.ok
ld a, [$d002]
ld e, a
ld d, 0
ld hl, Jumptable_b863a
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_b863a: ; b863a (2e:463a)
dw Functionb8742
dw Functionb8a46
dw Functionb8b35
dw Functionb8bdc
dw Functionb8f12
dw Functionb8cbf
dw Functionb8b50
dw Functionb8e72
dw Functionb8ef7
dw Functionb8f00
dw Functionb8f09
dw Functionb8752
dw Functionb875a
dw Functionb8762
dw Functionb8810
dw Functionb8818
dw Functionb883e
dw Functionb8854
dw Functionb88d9
dw Functionb8a6c
dw Functionb8aa4
dw Functionb8aac
dw Functionb8ab4
dw Functionb8b40
dw Functionb8b48
dw Functionb8b63
dw Functionb8b6b
dw Functionb8b7d
dw Functionb8b8f
dw Functionb8b5b
dw Functionb8bf5
dw Functionb8bfd
dw Functionb8c05
dw Functionb8c0d
dw Functionb8c15
dw Functionb8c1d
dw Functionb8c25
dw Functionb8c3e
dw Functionb8c46
dw Functionb8c4e
dw Functionb8c56
dw Functionb8c5e
dw Functionb8c6e
dw Functionb8c76
dw Functionb8cca
dw Functionb8cd2
dw Functionb8cf2
dw Functionb8d56
dw Functionb8ded
dw Functionb8e28
dw Functionb8e7d
dw Functionb8e85
dw Functionb8e8d
dw Functionb8e95
dw Functionb8e9d
dw Functionb8ea5
dw Functionb8ead
dw Functionb8eb5
dw Functionb8ebd
dw Functionb896e
dw Functionb8994
dw Functionb89a9
dw Functionb89c6
dw Functionb89d7
dw Functionb8f3f
dw Functionb8f47
dw Functionb8f55
dw Functionb909c
dw Functionb90a4
dw Functionb90ac
dw Functionb90c5
dw Functionb90d2
dw Functionb90da
dw Functionb90e2
dw Functionb90ea
dw Functionb90f2
dw Functionb90fa
dw Functionb9102
dw Functionb910a
dw Functionb9112
dw Functionb911a
dw Functionb9122
dw Functionb912a
dw Functionb9152
dw Functionb8728
dw Functionb8abc
dw Functionb8ac4
dw Functionb8acc
Functionb86ea: ; b86ea (2e:46ea)
ld [$d003], a
ld hl, $d00c
ld a, [$d005]
cp $2
jr nc, .asm_b870a
inc hl
ld [hl], $0
inc a
ld [$d005], a
cp $2
jr nz, .asm_b870a
bccoord 1, 16
call Function13e5
jr .asm_b870d
.asm_b870a
call PrintTextBoxText
.asm_b870d
ld a, $54
ld [$d002], a
ld a, $64
ld [$d004], a
ret
; b8718 (2e:4718)
Functionb8718: ; b8718
push hl
ld b, $28
.asm_b871b
ld a, [hl]
cp $e8
jr nz, .asm_b8722
ld [hl], $7f
.asm_b8722
inc hl
dec b
jr nz, .asm_b871b
pop hl
ret
; b8728
Functionb8728: ; b8728 (2e:4728)
ld hl, $d004
ld a, [hl]
and a
jr z, .asm_b8731
dec [hl]
ret
.asm_b8731
ld a, [$d003]
ld [$d002], a
ld a, [$d005]
cp $1
call nz, Functionb8a0b
jp Functionb8a17
Functionb8742: ; b8742 (2e:4742)
ld a, $5
ld [$d006], a
call Functionb91eb
ld hl, UnknownText_0xb8820
ld a, $b
jp Functionb9221
Functionb8752: ; b8752 (2e:4752)
ld hl, UnknownText_0xb8825
ld a, $c
jp Functionb9221
Functionb875a: ; b875a (2e:475a)
ld hl, UnknownText_0xb882a
ld a, $d
jp Functionb9221
Functionb8762: ; b8762 (2e:4762)
call Random
and $1f
cp $f
jr nc, Functionb8762
ld hl, Unknown_b87f2
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld b, [hl]
inc hl
ld c, [hl]
push bc
ld hl, WildMons1
.loop
ld a, BANK(WildMons1)
call GetFarByte
cp $ff
jr z, .asm_b87ec
inc hl
cp b
jr nz, .next
ld a, BANK(WildMons1)
call GetFarByte
cp c
jr z, .asm_b8796
.next
dec hl
ld de, $2f
add hl, de
jr .loop
.asm_b8796
inc hl
inc hl
inc hl
inc hl
.not3
call Random
and 3
cp 3
jr z, .not3
ld bc, $e
call AddNTimes
.asm_b87a9
call Random
and 7
cp 2
jr c, .asm_b87a9
cp 5
jr nc, .asm_b87a9
ld e, a
ld d, 0
add hl, de
add hl, de
inc hl
ld a, BANK(WildMons1)
call GetFarByte
ld [$d265], a
ld [CurPartySpecies], a
call GetPokemonName
ld hl, StringBuffer1
ld de, $d050
ld bc, $b
call CopyBytes
pop bc
call GetWorldMapLocation
ld e, a
callba GetLandmarkName
ld hl, UnknownText_0xb882f
call Functionb91dc
ld a, $e
jp Functionb86ea
.asm_b87ec
pop bc
ld a, $0
jp Functionb86ea
; b87f2 (2e:47f2)
Unknown_b87f2: ; b87f2
map ROUTE_29
map ROUTE_46
map ROUTE_30
map ROUTE_32
map ROUTE_34
map ROUTE_35
map ROUTE_37
map ROUTE_38
map ROUTE_39
map ROUTE_42
map ROUTE_43
map ROUTE_44
map ROUTE_45
map ROUTE_36
map ROUTE_31
; b8810
Functionb8810: ; b8810 (2e:4810)
ld hl, UnknownText_0xb8834
ld a, $f
jp Functionb9221
Functionb8818: ; b8818 (2e:4818)
ld hl, UnknownText_0xb8839
ld a, $10
jp Functionb9221
; b8820 (2e:4820)
UnknownText_0xb8820: ; 0xb8820
; MARY: PROF.OAK'S
text_jump UnknownText_0x1bc81a
db "@"
; 0xb8825
UnknownText_0xb8825: ; 0xb8825
; #MON TALK!
text_jump UnknownText_0x1bc82d
db "@"
; 0xb882a
UnknownText_0xb882a: ; 0xb882a
; With me, MARY!
text_jump UnknownText_0x1bc83a
db "@"
; 0xb882f
UnknownText_0xb882f: ; 0xb882f
; OAK: @ @
text_jump UnknownText_0x1bc84b
db "@"
; 0xb8834
UnknownText_0xb8834: ; 0xb8834
; may be seen around
text_jump UnknownText_0x1bc858
db "@"
; 0xb8839
UnknownText_0xb8839: ; 0xb8839
; @ .
text_jump UnknownText_0x1bc86d
db "@"
; 0xb883e
Functionb883e: ; b883e (2e:483e)
ld a, [CurPartySpecies]
ld [$d265], a
call GetPokemonName
ld hl, UnknownText_0xb884f
ld a, $11
jp Functionb9221
; b884f (2e:484f)
UnknownText_0xb884f: ; 0xb884f
; MARY: @ 's
text_jump UnknownText_0x1bc876
db "@"
; 0xb8854
Functionb8854: ; b8854 (2e:4854)
call Random
and $f
ld e, a
ld d, 0
ld hl, Unknown_b8869
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld a, $12
jp Functionb9221
; b8869 (2e:4869)
Unknown_b8869: ; b8869
dw UnknownText_0xb8889
dw UnknownText_0xb888e
dw UnknownText_0xb8893
dw UnknownText_0xb8898
dw UnknownText_0xb889d
dw UnknownText_0xb88a2
dw UnknownText_0xb88a7
dw UnknownText_0xb88ac
dw UnknownText_0xb88b1
dw UnknownText_0xb88b6
dw UnknownText_0xb88bb
dw UnknownText_0xb88c0
dw UnknownText_0xb88c5
dw UnknownText_0xb88ca
dw UnknownText_0xb88cf
dw UnknownText_0xb88d4
; b8889
UnknownText_0xb8889: ; 0xb8889
; sweet and adorably
text_jump UnknownText_0x1bc885
db "@"
; 0xb888e
UnknownText_0xb888e: ; 0xb888e
; wiggly and slickly
text_jump UnknownText_0x1bc89a
db "@"
; 0xb8893
UnknownText_0xb8893: ; 0xb8893
; aptly named and
text_jump UnknownText_0x1bc8af
db "@"
; 0xb8898
UnknownText_0xb8898: ; 0xb8898
; undeniably kind of
text_jump UnknownText_0x1bc8c1
db "@"
; 0xb889d
UnknownText_0xb889d: ; 0xb889d
; so, so unbearably
text_jump UnknownText_0x1bc8d6
db "@"
; 0xb88a2
UnknownText_0xb88a2: ; 0xb88a2
; wow, impressively
text_jump UnknownText_0x1bc8ea
db "@"
; 0xb88a7
UnknownText_0xb88a7: ; 0xb88a7
; almost poisonously
text_jump UnknownText_0x1bc8fe
db "@"
; 0xb88ac
UnknownText_0xb88ac: ; 0xb88ac
; ooh, so sensually
text_jump UnknownText_0x1bc913
db "@"
; 0xb88b1
UnknownText_0xb88b1: ; 0xb88b1
; so mischievously
text_jump UnknownText_0x1bc927
db "@"
; 0xb88b6
UnknownText_0xb88b6: ; 0xb88b6
; so very topically
text_jump UnknownText_0x1bc93a
db "@"
; 0xb88bb
UnknownText_0xb88bb: ; 0xb88bb
; sure addictively
text_jump UnknownText_0x1bc94e
db "@"
; 0xb88c0
UnknownText_0xb88c0: ; 0xb88c0
; looks in water is
text_jump UnknownText_0x1bc961
db "@"
; 0xb88c5
UnknownText_0xb88c5: ; 0xb88c5
; evolution must be
text_jump UnknownText_0x1bc975
db "@"
; 0xb88ca
UnknownText_0xb88ca: ; 0xb88ca
; provocatively
text_jump UnknownText_0x1bc989
db "@"
; 0xb88cf
UnknownText_0xb88cf: ; 0xb88cf
; so flipped out and
text_jump UnknownText_0x1bc999
db "@"
; 0xb88d4
UnknownText_0xb88d4: ; 0xb88d4
; heart-meltingly
text_jump UnknownText_0x1bc9ae
db "@"
; 0xb88d9
Functionb88d9: ; b88d9 (2e:48d9)
call Random
and $f
ld e, a
ld d, 0
ld hl, Unknown_b88fe
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$d006]
dec a
ld [$d006], a
ld a, $d
jr nz, .asm_b88fb
ld a, $5
ld [$d006], a
ld a, $3b
.asm_b88fb
jp Functionb9221
; b88fe (2e:48fe)
Unknown_b88fe: ; b88fe
dw UnknownText_0xb891e
dw UnknownText_0xb8923
dw UnknownText_0xb8928
dw UnknownText_0xb892d
dw UnknownText_0xb8932
dw UnknownText_0xb8937
dw UnknownText_0xb893c
dw UnknownText_0xb8941
dw UnknownText_0xb8946
dw UnknownText_0xb894b
dw UnknownText_0xb8950
dw UnknownText_0xb8955
dw UnknownText_0xb895a
dw UnknownText_0xb895f
dw UnknownText_0xb8964
dw UnknownText_0xb8969
; b891e
UnknownText_0xb891e: ; 0xb891e
; cute.
text_jump UnknownText_0x1bc9c0
db "@"
; 0xb8923
UnknownText_0xb8923: ; 0xb8923
; weird.
text_jump UnknownText_0x1bc9c8
db "@"
; 0xb8928
UnknownText_0xb8928: ; 0xb8928
; pleasant.
text_jump UnknownText_0x1bc9d1
db "@"
; 0xb892d
UnknownText_0xb892d: ; 0xb892d
; bold, sort of.
text_jump UnknownText_0x1bc9dd
db "@"
; 0xb8932
UnknownText_0xb8932: ; 0xb8932
; frightening.
text_jump UnknownText_0x1bc9ee
db "@"
; 0xb8937
UnknownText_0xb8937: ; 0xb8937
; suave & debonair!
text_jump UnknownText_0x1bc9fd
db "@"
; 0xb893c
UnknownText_0xb893c: ; 0xb893c
; powerful.
text_jump UnknownText_0x1bca11
db "@"
; 0xb8941
UnknownText_0xb8941: ; 0xb8941
; exciting.
text_jump UnknownText_0x1bca1d
db "@"
; 0xb8946
UnknownText_0xb8946: ; 0xb8946
; groovy!
text_jump UnknownText_0x1bca29
db "@"
; 0xb894b
UnknownText_0xb894b: ; 0xb894b
; inspiring.
text_jump UnknownText_0x1bca33
db "@"
; 0xb8950
UnknownText_0xb8950: ; 0xb8950
; friendly.
text_jump UnknownText_0x1bca40
db "@"
; 0xb8955
UnknownText_0xb8955: ; 0xb8955
; hot, hot, hot!
text_jump UnknownText_0x1bca4c
db "@"
; 0xb895a
UnknownText_0xb895a: ; 0xb895a
; stimulating.
text_jump UnknownText_0x1bca5d
db "@"
; 0xb895f
UnknownText_0xb895f: ; 0xb895f
; guarded.
text_jump UnknownText_0x1bca6c
db "@"
; 0xb8964
UnknownText_0xb8964: ; 0xb8964
; lovely.
text_jump UnknownText_0x1bca77
db "@"
; 0xb8969
UnknownText_0xb8969: ; 0xb8969
; speedy.
text_jump UnknownText_0x1bca81
db "@"
; 0xb896e
Functionb896e: ; b896e (2e:496e)
callba Function91868
ld hl, UnknownText_0xb8993
call PrintText
call WaitBGMap
ld hl, UnknownText_0xb898e
call PrintText
ld a, $3c
ld [$d002], a
ld a, $64
ld [$d004], a
ret
; b898e (2e:498e)
UnknownText_0xb898e: ; 0xb898e
; #MON
text_jump UnknownText_0x1bca8b
db "@"
; 0xb8993
UnknownText_0xb8993: ; 0xb8993
db "@"
; 0xb8994
Functionb8994: ; b8994 (2e:4994)
ld hl, $d004
dec [hl]
ret nz
hlcoord 9, 14
ld de, String_b89a4
ld a, $3d
jp Functionb8a00
; b89a4 (2e:49a4)
String_b89a4:
db "#MON@"
; b89a9
Functionb89a9: ; b89a9 (2e:49a9)
ld hl, $d004
dec [hl]
ret nz
hlcoord 1, 16
ld de, String_b89b9
ld a, $3e
jp Functionb8a00
; b89b9 (2e:49b9)
String_b89b9:
db "#MON Channel@"
; b89c6
Functionb89c6: ; b89c6 (2e:49c6)
ld hl, $d004
dec [hl]
ret nz
hlcoord 12, 16
ld de, String_b89d6
ld a, $3f
jp Functionb8a00
; b89d6 (2e:49d6)
String_b89d6:
db "@"
; b89d7
Functionb89d7: ; b89d7 (2e:49d7)
ld hl, $d004
dec [hl]
ret nz
ld de, $1d
callab Function91854
ld hl, UnknownText_0xb89ff
call PrintText
ld a, $d
ld [$d003], a
xor a
ld [$d005], a
ld a, $54
ld [$d002], a
ld a, $a
ld [$d004], a
ret
; b89ff (2e:49ff)
UnknownText_0xb89ff: ; 0xb89ff
db "@"
; 0xb8a00
Functionb8a00: ; b8a00 (2e:4a00)
ld [$d002], a
ld a, $64
ld [$d004], a
jp PlaceString
Functionb8a0b: ; b8a0b (2e:4a0b)
hlcoord 0, 15
decoord 0, 13
ld bc, $28
jp CopyBytes
Functionb8a17: ; b8a17 (2e:4a17)
hlcoord 1, 15
ld bc, $12
ld a, $7f
call ByteFill
hlcoord 1, 16
ld bc, $12
ld a, $7f
jp ByteFill
Functionb8a2d: ; b8a2d (2e:4a2d)
push hl
push de
ld a, [CurPartySpecies]
dec a
rlca
rlca
and 3
ld hl, .pokedexbanks
ld d, 0
ld e, a
add hl, de
ld a, [hl]
pop de
pop hl
ret
; b8a42 (2e:4a42)
.pokedexbanks
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
; b8a46
Functionb8a46: ; b8a46 (2e:4a46)
call Functionb91eb
.asm_b8a49
call Random
cp CELEBI
jr nc, .asm_b8a49
ld c, a
push bc
ld a, c
call CheckCaughtMon
pop bc
jr z, .asm_b8a49
inc c
ld a, c
ld [CurPartySpecies], a ; $d108
ld [$d265], a
call GetPokemonName
ld hl, UnknownText_0xb8b30
ld a, $13
jp Functionb9221
Functionb8a6c: ; b8a6c (2e:4a6c)
ld a, [CurPartySpecies] ; $d108
dec a
ld hl, PokedexDataPointerTable
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, BANK(PokedexDataPointerTable)
call GetFarHalfword
call Functionb8a2d
push af
push hl
call Functionb8af3
dec hl
ld [hl], $57
ld hl, $d26b
call Functionb91dc
pop hl
pop af
call Functionb8b11
inc hl
inc hl
inc hl
inc hl
ld a, l
ld [$d26b], a
ld a, h
ld [$d26c], a
ld a, $14
jp Functionb86ea
Functionb8aa4: ; b8aa4 (2e:4aa4)
call Functionb8ad4
ld a, $15
jp Functionb86ea
Functionb8aac: ; b8aac (2e:4aac)
call Functionb8ad4
ld a, $16
jp Functionb86ea
Functionb8ab4: ; b8ab4 (2e:4ab4)
call Functionb8ad4
ld a, $55
jp Functionb86ea
Functionb8abc: ; b8abc (2e:4abc)
call Functionb8ad4
ld a, $56
jp Functionb86ea
Functionb8ac4: ; b8ac4 (2e:4ac4)
call Functionb8ad4
ld a, $57
jp Functionb86ea
Functionb8acc: ; b8acc (2e:4acc)
call Functionb8ad4
ld a, $1
jp Functionb86ea
Functionb8ad4: ; b8ad4 (2e:4ad4)
ld a, [$d26b]
ld l, a
ld a, [$d26c]
ld h, a
ld a, [$d26d]
push af
push hl
call Functionb8af3
dec hl
ld [hl], $57
ld hl, $d26b
call Functionb91dc
pop hl
pop af
call Functionb8b11
ret
Functionb8af3: ; b8af3 (2e:4af3)
ld de, $d26d
ld bc, $13
call FarCopyBytes
ld hl, $d26b
ld [hl], $0
inc hl
ld [hl], $4f
inc hl
.asm_b8b05
ld a, [hli]
cp $50
ret z
cp $4e
ret z
cp $5f
ret z
jr .asm_b8b05
Functionb8b11: ; b8b11 (2e:4b11)
ld d, a
.asm_b8b12
ld a, d
call GetFarByte
inc hl
cp $50
jr z, .asm_b8b23
cp $4e
jr z, .asm_b8b23
cp $5f
jr nz, .asm_b8b12
.asm_b8b23
ld a, l
ld [$d26b], a
ld a, h
ld [$d26c], a
ld a, d
ld [$d26d], a
ret
; b8b30 (2e:4b30)
UnknownText_0xb8b30: ; 0xb8b30
; @ @
text_jump UnknownText_0x1bca91
db "@"
; 0xb8b35
Functionb8b35: ; b8b35 (2e:4b35)
call Functionb8b90
ld hl, UnknownText_0xb8baa
ld a, $17
jp Functionb9221
Functionb8b40: ; b8b40 (2e:4b40)
ld hl, UnknownText_0xb8baf
ld a, $18
jp Functionb9221
Functionb8b48: ; b8b48 (2e:4b48)
ld hl, UnknownText_0xb8bb4
ld a, $19
jp Functionb9221
Functionb8b50: ; b8b50 (2e:4b50)
call Functionb8b90
ld hl, UnknownText_0xb8bb9
ld a, $1d
jp Functionb9221
Functionb8b5b: ; b8b5b (2e:4b5b)
ld hl, UnknownText_0xb8bbe
ld a, $19
jp Functionb9221
Functionb8b63: ; b8b63 (2e:4b63)
ld hl, UnknownText_0xb8bc3
ld a, $1a
jp Functionb9221
Functionb8b6b: ; b8b6b (2e:4b6b)
call GetWeekday
and 1
ld hl, UnknownText_0xb8bc8
jr z, .asm_b8b78
ld hl, UnknownText_0xb8bcd
.asm_b8b78
ld a, $1b
jp Functionb9221
Functionb8b7d: ; b8b7d (2e:4b7d)
call GetWeekday
and 1
ld hl, UnknownText_0xb8bd2
jr z, .asm_b8b8a
ld hl, UnknownText_0xb8bd7
.asm_b8b8a
ld a, $1c
jp Functionb9221
Functionb8b8f: ; b8b8f (2e:4b8f)
ret
Functionb8b90: ; b8b90 (2e:4b90)
call Function1052
call PrintText
ld de, $51
call GetWeekday
and 1
jr z, .asm_b8ba3
ld de, $50
.asm_b8ba3
callab Function91854
ret
; b8baa (2e:4baa)
UnknownText_0xb8baa: ; 0xb8baa
; BEN: #MON MUSIC
text_jump UnknownText_0x1bca99
db "@"
; 0xb8baf
UnknownText_0xb8baf: ; 0xb8baf
; CHANNEL!
text_jump UnknownText_0x1bcaab
db "@"
; 0xb8bb4
UnknownText_0xb8bb4: ; 0xb8bb4
; It's me, DJ BEN!
text_jump UnknownText_0x1bcab6
db "@"
; 0xb8bb9
UnknownText_0xb8bb9: ; 0xb8bb9
; FERN: #MUSIC!
text_jump UnknownText_0x1bcac8
db "@"
; 0xb8bbe
UnknownText_0xb8bbe: ; 0xb8bbe
; With DJ FERN!
text_jump UnknownText_0x1bcad8
db "@"
; 0xb8bc3
UnknownText_0xb8bc3: ; 0xb8bc3
; Today's @ ,
text_jump UnknownText_0x1bcae8
db "@"
; 0xb8bc8
UnknownText_0xb8bc8: ; 0xb8bc8
; so let us jam to
text_jump UnknownText_0x1bcaf6
db "@"
; 0xb8bcd
UnknownText_0xb8bcd: ; 0xb8bcd
; so chill out to
text_jump UnknownText_0x1bcb09
db "@"
; 0xb8bd2
UnknownText_0xb8bd2: ; 0xb8bd2
; #MON March!
text_jump UnknownText_0x1bcb1b
db "@"
; 0xb8bd7
UnknownText_0xb8bd7: ; 0xb8bd7
; #MON Lullaby!
text_jump UnknownText_0x1bcb29
db "@"
; 0xb8bdc
Functionb8bdc: ; b8bdc (2e:4bdc)
call Functionb91eb
callab Functionc434
jr nc, .asm_b8bed
callab Functionc422
.asm_b8bed
ld hl, $4c7e
ld a, $1e
jp Functionb9221
Functionb8bf5: ; b8bf5 (2e:4bf5)
ld hl, UnknownText_0xb8c83
ld a, $1f
jp Functionb9221
Functionb8bfd: ; b8bfd (2e:4bfd)
ld hl, UnknownText_0xb8c88
ld a, $20
jp Functionb9221
Functionb8c05: ; b8c05 (2e:4c05)
ld hl, UnknownText_0xb8c8d
ld a, $21
jp Functionb9221
Functionb8c0d: ; b8c0d (2e:4c0d)
ld hl, UnknownText_0xb8c92
ld a, $22
jp Functionb9221
Functionb8c15: ; b8c15 (2e:4c15)
ld hl, UnknownText_0xb8c97
ld a, $23
jp Functionb9221
Functionb8c1d: ; b8c1d (2e:4c1d)
ld hl, UnknownText_0xb8c9c
ld a, $24
jp Functionb9221
Functionb8c25: ; b8c25 (2e:4c25)
ld hl, StringBuffer1 ; $d073
ld de, $dc9f
ld bc, $8205
call PrintNum
ld a, $50
ld [$d078], a
ld hl, UnknownText_0xb8ca1
ld a, $25
jp Functionb9221
Functionb8c3e: ; b8c3e (2e:4c3e)
ld hl, UnknownText_0xb8ca6
ld a, $26
jp Functionb9221
Functionb8c46: ; b8c46 (2e:4c46)
ld hl, UnknownText_0xb8c9c
ld a, $27
jp Functionb9221
Functionb8c4e: ; b8c4e (2e:4c4e)
ld hl, UnknownText_0xb8ca1
ld a, $28
jp Functionb9221
Functionb8c56: ; b8c56 (2e:4c56)
ld hl, UnknownText_0xb8cab
ld a, $29
jp Functionb9221
Functionb8c5e: ; b8c5e (2e:4c5e)
ld hl, UnknownText_0xb8cb0
call Random
and a
ld a, $3
jr nz, .asm_b8c6b
ld a, $2a
.asm_b8c6b
jp Functionb9221
Functionb8c6e: ; b8c6e (2e:4c6e)
ld hl, UnknownText_0xb8cb5
ld a, $2b
jp Functionb9221
Functionb8c76: ; b8c76 (2e:4c76)
ld hl, UnknownText_0xb8cba
ld a, $3
jp Functionb9221
; b8c7e (2e:4c7e)
UnknownText_0xb8c7e: ; 0xb8c7e
; REED: Yeehaw! How
text_jump UnknownText_0x1bcb39
db "@"
; 0xb8c83
UnknownText_0xb8c83: ; 0xb8c83
; y'all doin' now?
text_jump UnknownText_0x1bcb4d
db "@"
; 0xb8c88
UnknownText_0xb8c88: ; 0xb8c88
; Whether you're up
text_jump UnknownText_0x1bcb60
db "@"
; 0xb8c8d
UnknownText_0xb8c8d: ; 0xb8c8d
; or way down low,
text_jump UnknownText_0x1bcb73
db "@"
; 0xb8c92
UnknownText_0xb8c92: ; 0xb8c92
; don't you miss the
text_jump UnknownText_0x1bcb86
db "@"
; 0xb8c97
UnknownText_0xb8c97: ; 0xb8c97
; LUCKY NUMBER SHOW!
text_jump UnknownText_0x1bcb9a
db "@"
; 0xb8c9c
UnknownText_0xb8c9c: ; 0xb8c9c
; This week's Lucky
text_jump UnknownText_0x1bcbaf
db "@"
; 0xb8ca1
UnknownText_0xb8ca1: ; 0xb8ca1
; Number is @ !
text_jump UnknownText_0x1bcbc2
db "@"
; 0xb8ca6
UnknownText_0xb8ca6: ; 0xb8ca6
; I'll repeat that!
text_jump UnknownText_0x1bcbd6
db "@"
; 0xb8cab
UnknownText_0xb8cab: ; 0xb8cab
; Match it and go to
text_jump UnknownText_0x1bcbe9
db "@"
; 0xb8cb0
UnknownText_0xb8cb0: ; 0xb8cb0
; the RADIO TOWER!
text_jump UnknownText_0x1bcbfe
db "@"
; 0xb8cb5
UnknownText_0xb8cb5: ; 0xb8cb5
; …Repeating myself
text_jump UnknownText_0x1bcc11
db "@"
; 0xb8cba
UnknownText_0xb8cba: ; 0xb8cba
; gets to be a drag…
text_jump UnknownText_0x1bcc25
db "@"
; 0xb8cbf
Functionb8cbf: ; b8cbf (2e:4cbf)
call Functionb91eb
ld hl, UnknownText_0xb8ce3
ld a, $2c
jp Functionb9221
Functionb8cca: ; b8cca (2e:4cca)
ld hl, UnknownText_0xb8ce8
ld a, $2d
jp Functionb9221
Functionb8cd2: ; b8cd2 (2e:4cd2)
ld hl, UnknownText_0xb8ced
call Random
cp $7b
ld a, $2e
jr c, .asm_b8ce0
ld a, $30
.asm_b8ce0
jp Functionb9221
; b8ce3 (2e:4ce3)
UnknownText_0xb8ce3: ; 0xb8ce3
; PLACES AND PEOPLE!
text_jump UnknownText_0x1bcc3a
db "@"
; 0xb8ce8
UnknownText_0xb8ce8: ; 0xb8ce8
; Brought to you by
text_jump UnknownText_0x1bcc4f
db "@"
; 0xb8ced
UnknownText_0xb8ced: ; 0xb8ced
; me, DJ LILY!
text_jump UnknownText_0x1bcc63
db "@"
; 0xb8cf2
Functionb8cf2: ; b8cf2 (2e:4cf2)
call Random
and $7f
inc a
cp $43
jr nc, Functionb8cf2
push af
ld hl, Unknown_b8d3e
ld a, [StatusFlags] ; $d84c
bit 6, a
jr z, .asm_b8d14
ld hl, Unknown_b8d43
ld a, [KantoBadges] ; $d858
cp %11111111
jr nz, .asm_b8d14
ld hl, Unknown_b8d4b
.asm_b8d14
pop af
ld c, a
ld de, $1
push bc
call IsInArray
pop bc
jr c, Functionb8cf2
push bc
callab Function3952d
ld de, StringBuffer1 ; $d073
call CopyName1
pop bc
ld b, $1
callab Function3994c
ld hl, UnknownText_0xb8d51
ld a, $2f
jp Functionb9221
; b8d3e (2e:4d3e)
Unknown_b8d3e: db $0b, $0d, $0e, $0f, $10
Unknown_b8d43: db $11, $12, $13, $15, $1a, $23, $2e, $40
Unknown_b8d4b: db $09, $0a, $0c, $2a, $3f
db $ff
; b8d51
UnknownText_0xb8d51: ; 0xb8d51
; @ @ @
text_jump UnknownText_0x1bcc72
db "@"
; 0xb8d56
Functionb8d56: ; b8d56 (2e:4d56)
call Random
and $f
ld e, a
ld d, 0
ld hl, Unknown_b8d7d
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call Random
cp $a
ld a, $5
jr c, .asm_b8d7a
call Random
cp $7b
ld a, $2e
jr c, .asm_b8d7a
ld a, $30
.asm_b8d7a
jp Functionb9221
; b8d7d (2e:4d7d)
Unknown_b8d7d: ; b8d7d
dw UnknownText_0xb8d9d
dw UnknownText_0xb8da2
dw UnknownText_0xb8da7
dw UnknownText_0xb8dac
dw UnknownText_0xb8db1
dw UnknownText_0xb8db6
dw UnknownText_0xb8dbb
dw UnknownText_0xb8dc0
dw UnknownText_0xb8dc5
dw UnknownText_0xb8dca
dw UnknownText_0xb8dcf
dw UnknownText_0xb8dd4
dw UnknownText_0xb8dd9
dw UnknownText_0xb8dde
dw UnknownText_0xb8de3
dw UnknownText_0xb8de8
; b8d9d
UnknownText_0xb8d9d: ; 0xb8d9d
; is cute.
text_jump UnknownText_0x1bcc80
db "@"
; 0xb8da2
UnknownText_0xb8da2: ; 0xb8da2
; is sort of lazy.
text_jump UnknownText_0x1bcc8b
db "@"
; 0xb8da7
UnknownText_0xb8da7: ; 0xb8da7
; is always happy.
text_jump UnknownText_0x1bcc9e
db "@"
; 0xb8dac
UnknownText_0xb8dac: ; 0xb8dac
; is quite noisy.
text_jump UnknownText_0x1bccb1
db "@"
; 0xb8db1
UnknownText_0xb8db1: ; 0xb8db1
; is precocious.
text_jump UnknownText_0x1bccc3
db "@"
; 0xb8db6
UnknownText_0xb8db6: ; 0xb8db6
; is somewhat bold.
text_jump UnknownText_0x1bccd4
db "@"
; 0xb8dbb
UnknownText_0xb8dbb: ; 0xb8dbb
; is too picky!
text_jump UnknownText_0x1bcce8
db "@"
; 0xb8dc0
UnknownText_0xb8dc0: ; 0xb8dc0
; is sort of OK.
text_jump UnknownText_0x1bccf8
db "@"
; 0xb8dc5
UnknownText_0xb8dc5: ; 0xb8dc5
; is just so-so.
text_jump UnknownText_0x1bcd09
db "@"
; 0xb8dca
UnknownText_0xb8dca: ; 0xb8dca
; is actually great.
text_jump UnknownText_0x1bcd1a
db "@"
; 0xb8dcf
UnknownText_0xb8dcf: ; 0xb8dcf
; is just my type.
text_jump UnknownText_0x1bcd2f
db "@"
; 0xb8dd4
UnknownText_0xb8dd4: ; 0xb8dd4
; is so cool, no?
text_jump UnknownText_0x1bcd42
db "@"
; 0xb8dd9
UnknownText_0xb8dd9: ; 0xb8dd9
; is inspiring!
text_jump UnknownText_0x1bcd54
db "@"
; 0xb8dde
UnknownText_0xb8dde: ; 0xb8dde
; is kind of weird.
text_jump UnknownText_0x1bcd64
db "@"
; 0xb8de3
UnknownText_0xb8de3: ; 0xb8de3
; is right for me?
text_jump UnknownText_0x1bcd78
db "@"
; 0xb8de8
UnknownText_0xb8de8: ; 0xb8de8
; is definitely odd!
text_jump UnknownText_0x1bcd8b
db "@"
; 0xb8ded
Functionb8ded: ; b8ded (2e:4ded)
call Random
cp $9
jr nc, Functionb8ded
ld hl, Unknown_b8e11
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld b, [hl]
inc hl
ld c, [hl]
call GetWorldMapLocation
ld e, a
callba GetLandmarkName
ld hl, UnknownText_0xb8e23
ld a, $31
jp Functionb9221
; b8e11 (2e:4e11)
Unknown_b8e11: ; b8e11
map PALLET_TOWN
map ROUTE_22
map PEWTER_CITY
map CERULEAN_POLICE_STATION
map ROUTE_12
map ROUTE_11
map ROUTE_16
map ROUTE_14
map CINNABAR_POKECENTER_2F_BETA
; b8e23
UnknownText_0xb8e23: ; 0xb8e23
; @ @
text_jump UnknownText_0x1bcda0
db "@"
; 0xb8e28
Functionb8e28: ; b8e28 (2e:4e28)
call Random
and $f
ld e, a
ld d, 0
ld hl, Unknown_b8e52
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call Functionb91dc
call Random
cp $a
ld a, $5
jr c, .asm_b8e4f
call Random
cp $7b
ld a, $2e
jr c, .asm_b8e4f
ld a, $30
.asm_b8e4f
jp Functionb86ea
; b8e52 (2e:4e52)
Unknown_b8e52: ; b8e52
dw UnknownText_0xb8d9d
dw UnknownText_0xb8da2
dw UnknownText_0xb8da7
dw UnknownText_0xb8dac
dw UnknownText_0xb8db1
dw UnknownText_0xb8db6
dw UnknownText_0xb8dbb
dw UnknownText_0xb8dc0
dw UnknownText_0xb8dc5
dw UnknownText_0xb8dca
dw UnknownText_0xb8dcf
dw UnknownText_0xb8dd4
dw UnknownText_0xb8dd9
dw UnknownText_0xb8dde
dw UnknownText_0xb8de3
dw UnknownText_0xb8de8
; b8e72
Functionb8e72: ; b8e72 (2e:4e72)
call Functionb91eb
ld hl, UnknownText_0xb8ec5
ld a, $32
jp Functionb9221
Functionb8e7d: ; b8e7d (2e:4e7d)
ld hl, UnknownText_0xb8eca
ld a, $33
jp Functionb9221
Functionb8e85: ; b8e85 (2e:4e85)
ld hl, UnknownText_0xb8ecf
ld a, $34
jp Functionb9221
Functionb8e8d: ; b8e8d (2e:4e8d)
ld hl, UnknownText_0xb8ed4
ld a, $35
jp Functionb9221
Functionb8e95: ; b8e95 (2e:4e95)
ld hl, UnknownText_0xb8ed9
ld a, $36
jp Functionb9221
Functionb8e9d: ; b8e9d (2e:4e9d)
ld hl, UnknownText_0xb8ede
ld a, $37
jp Functionb9221
Functionb8ea5: ; b8ea5 (2e:4ea5)
ld hl, UnknownText_0xb8ee3
ld a, $38
jp Functionb9221
Functionb8ead: ; b8ead (2e:4ead)
ld hl, UnknownText_0xb8ee8
ld a, $39
jp Functionb9221
Functionb8eb5: ; b8eb5 (2e:4eb5)
ld hl, UnknownText_0xb8eed
ld a, $3a
jp Functionb9221
Functionb8ebd: ; b8ebd (2e:4ebd)
ld hl, UnknownText_0xb8ef2
ld a, $7
jp Functionb9221
; b8ec5 (2e:4ec5)
UnknownText_0xb8ec5: ; 0xb8ec5
; … …Ahem, we are
text_jump UnknownText_0x1bcda8
db "@"
; 0xb8eca
UnknownText_0xb8eca: ; 0xb8eca
; TEAM ROCKET!
text_jump UnknownText_0x1bcdba
db "@"
; 0xb8ecf
UnknownText_0xb8ecf: ; 0xb8ecf
; After three years
text_jump UnknownText_0x1bcdc9
db "@"
; 0xb8ed4
UnknownText_0xb8ed4: ; 0xb8ed4
; of preparation, we
text_jump UnknownText_0x1bcddd
db "@"
; 0xb8ed9
UnknownText_0xb8ed9: ; 0xb8ed9
; have risen again
text_jump UnknownText_0x1bcdf2
db "@"
; 0xb8ede
UnknownText_0xb8ede: ; 0xb8ede
; from the ashes!
text_jump UnknownText_0x1bce05
db "@"
; 0xb8ee3
UnknownText_0xb8ee3: ; 0xb8ee3
; GIOVANNI! @ Can you
text_jump UnknownText_0x1bce17
db "@"
; 0xb8ee8
UnknownText_0xb8ee8: ; 0xb8ee8
; hear?@ We did it!
text_jump UnknownText_0x1bce2e
db "@"
; 0xb8eed
UnknownText_0xb8eed: ; 0xb8eed
; @ Where is our boss?
text_jump UnknownText_0x1bce44
db "@"
; 0xb8ef2
UnknownText_0xb8ef2: ; 0xb8ef2
; @ Is he listening?
text_jump UnknownText_0x1bce5c
db "@"
; 0xb8ef7
Functionb8ef7: ; b8ef7 (2e:4ef7)
call Functionb91eb
ld a, $1
ld [$d005], a
ret
Functionb8f00: ; b8f00 (2e:4f00)
call Functionb91eb
ld a, $1
ld [$d005], a
ret
Functionb8f09: ; b8f09 (2e:4f09)
call Functionb91eb
ld a, $1
ld [$d005], a
ret
Functionb8f12: ; b8f12 (2e:4f12)
call Functionb9169
jp nc, Functionb8f22
ld a, [$d005]
and a
jp z, Functionb912a
jp Functionb90c5
Functionb8f22: ; b8f22 (2e:4f22)
call Functionb91eb
ld a, [hBGMapMode] ; $ff00+$d4
push af
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld de, String_b9171
hlcoord 2, 9
call PlaceString
pop af
ld [hBGMapMode], a ; $ff00+$d4
ld hl, UnknownText_0xb9182
ld a, $40
jp Functionb9221
Functionb8f3f: ; b8f3f (2e:4f3f)
ld hl, UnknownText_0xb9187
ld a, $41
jp Functionb9221
Functionb8f47: ; b8f47 (2e:4f47)
call Functionb9169
ld hl, UnknownText_0xb918c
jp c, Functionb90b9
ld a, $42
jp Functionb9221
Functionb8f55: ; b8f55 (2e:4f55)
call Functionb9169
jp c, Functionb90c5
ld a, [$dc4a]
ld hl, $dc1f
bit 7, [hl]
jr nz, .asm_b8f83
.asm_b8f65
call Random
and $f
cp $b
jr nc, .asm_b8f65
swap a
ld e, a
.asm_b8f71
call Random
and $3
cp $3
jr nc, .asm_b8f71
add e
ld [$dc4a], a
ld hl, $dc1f
set 7, [hl]
.asm_b8f83
ld c, a
call Functionb8f8f
ld hl, UnknownText_0xb9191
ld a, $43
jp Functionb9221
Functionb8f8f: ; b8f8f
ld a, c
swap a
and $f
ld hl, Unknown_b8ff9
ld d, 0
ld e, a
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hli]
ld b, a
push hl
inc hl
ld a, c
and $f
ld c, a
push hl
ld hl, Jumptable_b8fb8
ld e, b
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
pop de
call _hl_
pop hl
ld c, [hl]
ret
; b8fb8
Jumptable_b8fb8: ; b8fb8 (2e:4fb8)
dw Functionb8fc0
dw Functionb8fc7
dw Functionb8fce
dw Functionb8fde
Functionb8fc0: ; b8fc0 (2e:4fc0)
call Functionb8fd5
call GetPokemonName
ret
Functionb8fc7: ; b8fc7 (2e:4fc7)
call Functionb8fd5
call GetItemName
ret
Functionb8fce: ; b8fce (2e:4fce)
call Functionb8fd5
call GetMoveName
ret
Functionb8fd5: ; b8fd5 (2e:4fd5)
ld h, 0
ld l, c
add hl, de
ld a, [hl]
ld [$d265], a
ret
Functionb8fde: ; b8fde (2e:4fde)
ld a, c
and a
jr z, .asm_b8feb
.asm_b8fe2
ld a, [de]
inc de
cp $50
jr nz, .asm_b8fe2
dec c
jr nz, .asm_b8fe2
.asm_b8feb
ld hl, StringBuffer1 ; $d073
.asm_b8fee
ld a, [de]
inc de
ld [hli], a
cp $50
jr nz, .asm_b8fee
ld de, StringBuffer1 ; $d073
ret
; b8ff9 (2e:4ff9)
Unknown_b8ff9: ; b8ff9
dw Unknown_b900f
dw Unknown_b9014
dw Unknown_b9019
dw Unknown_b901e
dw Unknown_b9023
dw Unknown_b9028
dw Unknown_b902d
dw Unknown_b905a
dw Unknown_b906d
dw Unknown_b9072
dw Unknown_b9077
; b900f
Unknown_b900f: db 0, 10, CYNDAQUIL, TOTODILE, CHIKORITA
Unknown_b9014: db 1, 12, FRESH_WATER, SODA_POP, LEMONADE
Unknown_b9019: db 1, 12, POTION, ANTIDOTE, PARLYZ_HEAL
Unknown_b901e: db 1, 12, POKE_BALL, GREAT_BALL, ULTRA_BALL
Unknown_b9023: db 0, 10, PIKACHU, RATTATA, GEODUDE
Unknown_b9028: db 0, 10, HOOTHOOT, SPINARAK, DROWZEE
Unknown_b902d: db 3, 16, "NEW BARK TOWN@", "CHERRYGROVE CITY@", "AZALEA TOWN@"
Unknown_b905a: db 3, 6, "FLYING@", "BUG@", "GRASS@"
Unknown_b906d: db 2, 12, TACKLE, GROWL, MUD_SLAP
Unknown_b9072: db 1, 12, X_ATTACK, X_DEFEND, X_SPEED
Unknown_b9077: db 3, 13, "#MON Talk@", "#MON Music@", "Lucky Channel@"
; b909c
Functionb909c: ; b909c (2e:509c)
ld hl, UnknownText_0xb9196
ld a, $44
jp Functionb9221
Functionb90a4: ; b90a4 (2e:50a4)
ld hl, UnknownText_0xb919b
ld a, $45
jp Functionb9221
Functionb90ac: ; b90ac (2e:50ac)
call Functionb9169
ld hl, UnknownText_0xb91a0
jr c, Functionb90b9
ld a, $4
jp Functionb9221
Functionb90b9: ; b90b9 (2e:50b9)
push hl
ld hl, $dc1f
res 7, [hl]
pop hl
ld a, $46
jp Functionb9221
Functionb90c5: ; b90c5 (2e:50c5)
ld hl, $dc1f
res 7, [hl]
ld hl, UnknownText_0xb91d2
ld a, $47
jp Functionb9221
Functionb90d2: ; b90d2 (2e:50d2)
ld hl, UnknownText_0xb91a5
ld a, $48
jp Functionb9221
Functionb90da: ; b90da (2e:50da)
ld hl, UnknownText_0xb91aa
ld a, $49
jp Functionb9221
Functionb90e2: ; b90e2 (2e:50e2)
ld hl, UnknownText_0xb91af
ld a, $4a
jp Functionb9221
Functionb90ea: ; b90ea (2e:50ea)
ld hl, UnknownText_0xb91b4
ld a, $4b
jp Functionb9221
Functionb90f2: ; b90f2 (2e:50f2)
ld hl, UnknownText_0xb91b9
ld a, $4c
jp Functionb9221
Functionb90fa: ; b90fa (2e:50fa)
ld hl, UnknownText_0xb91be
ld a, $4d
jp Functionb9221
Functionb9102: ; b9102 (2e:5102)
ld hl, UnknownText_0xb91c3
ld a, $4e
jp Functionb9221
Functionb910a: ; b910a (2e:510a)
ld hl, UnknownText_0xb91c8
ld a, $4f
jp Functionb9221
Functionb9112: ; b9112 (2e:5112)
ld hl, UnknownText_0xb91cd
ld a, $50
jp Functionb9221
Functionb911a: ; b911a (2e:511a)
ld hl, UnknownText_0xb91d2
ld a, $51
jp Functionb9221
Functionb9122: ; b9122 (2e:5122)
ld hl, UnknownText_0xb91d2
ld a, $52
jp Functionb9221
Functionb912a: ; b912a (2e:512a)
ld a, [hBGMapMode] ; $ff00+$d4
push af
callba NoRadioMusic
callba NoRadioName
pop af
ld [hBGMapMode], a ; $ff00+$d4
ld hl, $dc1f
res 7, [hl]
ld a, $4
ld [$d002], a
xor a
ld [$d005], a
ld hl, UnknownText_0xb91d7
ld a, $53
jp Functionb9221
Functionb9152: ; b9152 (2e:5152)
ld a, $4
ld [$d002], a
xor a
ld [$d005], a
call Functionb9169
jp nc, Functionb8f12
ld hl, UnknownText_0xb91d7
ld a, $53
jp Functionb9221
Functionb9169: ; b9169 (2e:5169)
call UpdateTime
ld a, [hHours] ; $ff00+$94
cp $12
ret
; b9171 (2e:5171)
String_b9171:
db "BUENA'S PASSWORD@"
; b9182
UnknownText_0xb9182: ; 0xb9182
; BUENA: BUENA here!
text_jump UnknownText_0x1bce72
db "@"
; 0xb9187
UnknownText_0xb9187: ; 0xb9187
; Today's password!
text_jump UnknownText_0x1bce87
db "@"
; 0xb918c
UnknownText_0xb918c: ; 0xb918c
; Let me think… It's
text_jump UnknownText_0x1bce9a
db "@"
; 0xb9191
UnknownText_0xb9191: ; 0xb9191
; @ !
text_jump UnknownText_0x1bceae
db "@"
; 0xb9196
UnknownText_0xb9196: ; 0xb9196
; Don't forget it!
text_jump UnknownText_0x1bceb7
db "@"
; 0xb919b
UnknownText_0xb919b: ; 0xb919b
; I'm in GOLDENROD's
text_jump UnknownText_0x1bcec9
db "@"
; 0xb91a0
UnknownText_0xb91a0: ; 0xb91a0
; RADIO TOWER!
text_jump UnknownText_0x1bcedc
db "@"
; 0xb91a5
UnknownText_0xb91a5: ; 0xb91a5
; BUENA: Oh my…
text_jump UnknownText_0x1bceeb
db "@"
; 0xb91aa
UnknownText_0xb91aa: ; 0xb91aa
; It's midnight! I
text_jump UnknownText_0x1bcefb
db "@"
; 0xb91af
UnknownText_0xb91af: ; 0xb91af
; have to shut down!
text_jump UnknownText_0x1bcf0d
db "@"
; 0xb91b4
UnknownText_0xb91b4: ; 0xb91b4
; Thanks for tuning
text_jump UnknownText_0x1bcf22
db "@"
; 0xb91b9
UnknownText_0xb91b9: ; 0xb91b9
; in to the end! But
text_jump UnknownText_0x1bcf36
db "@"
; 0xb91be
UnknownText_0xb91be: ; 0xb91be
; don't stay up too
text_jump UnknownText_0x1bcf4b
db "@"
; 0xb91c3
UnknownText_0xb91c3: ; 0xb91c3
; late! Presented to
text_jump UnknownText_0x1bcf5e
db "@"
; 0xb91c8
UnknownText_0xb91c8: ; 0xb91c8
; you by DJ BUENA!
text_jump UnknownText_0x1bcf73
db "@"
; 0xb91cd
UnknownText_0xb91cd: ; 0xb91cd
; I'm outta here!
text_jump UnknownText_0x1bcf86
db "@"
; 0xb91d2
UnknownText_0xb91d2: ; 0xb91d2
; …
text_jump UnknownText_0x1bcf96
db "@"
; 0xb91d7
UnknownText_0xb91d7: ; 0xb91d7
;
text_jump UnknownText_0x1bcf99
db "@"
; 0xb91dc
Functionb91dc: ; b91dc (2e:51dc)
ld a, [hl]
cp $16 ; TX_FAR
jp z, Function3a90
ld de, $d00c
ld bc, $28
jp CopyBytes
Functionb91eb: ; b91eb (2e:51eb)
ld a, [$d005]
and a
ret nz
call Function1052
call PrintText
ld hl, Unknown_b920b
ld a, [$d002]
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
callab Function91854
ret
; b920b (2e:520b)
Unknown_b920b: ; b920b
dw MUSIC_POKEMON_TALK
dw MUSIC_POKEMON_CENTER
dw MUSIC_TITLE
dw MUSIC_GAME_CORNER
dw MUSIC_BUENAS_PASSWORD
dw MUSIC_VIRIDIAN_CITY
dw MUSIC_BICYCLE
dw MUSIC_ROCKET_OVERTURE
dw MUSIC_POKE_FLUTE_CHANNEL
dw MUSIC_RUINS_OF_ALPH_RADIO
dw MUSIC_LAKE_OF_RAGE_ROCKET_RADIO
; b9221
Functionb9221: ; b9221 (2e:5221)
push af
call Functionb91dc
pop af
jp Functionb86ea
Functionb9229: ; b9229
ld a, [CurPartyMon]
ld hl, $a600
ld bc, $002f
call AddNTimes
ld d, h
ld e, l
Functionb9237: ; b9237
push de
call WhiteBGMap
call ClearSprites
call ClearTileMap
call DisableLCD
call Functione5f
pop de
push de
ld a, $0
call GetSRAMBank
callba Function1de5c8
call CloseSRAM
ld a, c
ld de, GFX_1de5e6
or a
jr z, .asm_b9268
ld de, GFX_1de9e6
sub $3
jr c, .asm_b9268
ld de, GFX_1dede6
.asm_b9268
ld hl, VTiles1
lb bc, BANK(GFX_1de5e6), $80
call Get1bpp
pop de
call Functionb92b8
call EnableLCD
call WaitBGMap
ld a, [$d1ec]
ld e, a
callba Function8cb4
call Function32f9
xor a
ld [hJoyPressed], a
call Functionb929a
call WhiteBGMap
call DisableLCD
call Functione51
jp EnableLCD
; b929a
Functionb929a: ; b929a
.asm_b929a
call GetJoypad
ld a, [hJoyPressed]
and A_BUTTON | B_BUTTON | START
jr z, .asm_b929a
and START
jr nz, .asm_b92a8
ret
.asm_b92a8
ld a, [$cf63]
push af
callab Function845d4
pop af
ld [$cf63], a
jr .asm_b929a
; b92b8
Functionb92b8: ; b92b8
ld h, d
ld l, e
push hl
ld a, $0
call GetSRAMBank
ld de, $002b
add hl, de
ld a, [hli]
ld [Buffer1], a
ld a, [hli]
ld [Buffer2], a
ld a, [hli]
ld [CurPartySpecies], a
ld b, [hl]
call CloseSRAM
ld hl, Unknown_b92f8
ld c, 0
.asm_b92d9
ld a, [hli]
cp b
jr z, .asm_b92ea
cp $ff
jr z, .asm_b92e6
inc c
inc hl
inc hl
jr .asm_b92d9
.asm_b92e6
ld hl, Unknown_b92f8
inc hl
.asm_b92ea
ld a, c
ld [$d1ec], a
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .done
pop bc
push de
jp [hl]
.done
ret
; b92f8
Unknown_b92f8: ; b92f8
dbw FLOWER_MAIL, Functionb963e
dbw SURF_MAIL, Functionb9317
dbw LITEBLUEMAIL, Functionb9335
dbw PORTRAITMAIL, Functionb96ca
dbw LOVELY_MAIL, Functionb944b
dbw EON_MAIL, Functionb93d2
dbw MORPH_MAIL, Functionb94d6
dbw BLUESKY_MAIL, Functionb9582
dbw MUSIC_MAIL, Functionb9710
dbw MIRAGE_MAIL, Functionb9776
db $ff
; b9317
Functionb9317: ; b9317
push bc
ld hl, $9310
ld de, Unknown_b9d46
ld c, $40
call Functionb9915
ld de, MailLaprasGFX
ld c, $30
call Functionb991e
ld de, Unknown_b994e
ld c, $8
call Functionb9915
jr Functionb9351
Functionb9335: ; b9335
push bc
ld hl, $9310
ld de, Unknown_b9dc6
ld c, $40
call Functionb9915
ld de, MailDratiniGFX
ld c, $30
call Functionb991e
ld de, Unknown_b995e
ld c, $8
call Functionb9915
Functionb9351: ; b9351
ld de, Unknown_b9976
ld c, $10
call Functionb9915
ld c, $10
call Functionb990c
ld de, Unknown_b9c3e
ld c, $40
call Functionb990c
ld c, $40
call Functionb9915
call Functionb9858
hlcoord 2, 15
ld a, $3f
call Functionb98d4
ld a, $39
hlcoord 15, 14
call Functionb98fc
ld a, $44
hlcoord 2, 2
call Functionb98ee
hlcoord 15, 11
call Functionb98ee
ld a, $4c
hlcoord 3, 12
call Functionb98ee
hlcoord 15, 2
call Functionb98ee
ld a, $50
hlcoord 6, 3
call Functionb98ee
ld a, $40
hlcoord 13, 2
ld [hli], a
hlcoord 6, 14
ld [hl], a
ld a, $41
hlcoord 4, 5
ld [hli], a
hlcoord 17, 5
ld [hli], a
hlcoord 13, 12
ld [hl], a
ld a, $42
hlcoord 9, 2
ld [hli], a
hlcoord 14, 5
ld [hli], a
hlcoord 3, 10
ld [hl], a
ld a, $43
hlcoord 6, 11
ld [hli], a
pop hl
jp Functionb9803
; b93d2
Functionb93d2: ; b93d2
push bc
ld hl, $9310
ld de, Unknown_b997e
ld c, $8
call Functionb9915
ld de, Unknown_b998e
ld c, $8
call Functionb990c
ld de, Unknown_b998e
ld c, $8
call Functionb990c
ld de, Unknown_b997e
ld c, $8
call Functionb9915
ld de, Unknown_b9d76
ld c, $8
call Functionb9915
ld de, MailPikaGFX
ld c, $30
call Functionb991e
ld hl, $93d0
ld de, Unknown_b9c9e
ld c, $20
call Functionb990c
ld de, Unknown_b998e
ld c, $8
call Functionb9915
ld a, $31
ld hl, TileMap
call Functionb98a8
hlcoord 1, 17
call Functionb98a8
ld a, $33
hlcoord 0, 1
call Functionb98ba
hlcoord 19, 0
call Functionb98ba
hlcoord 2, 15
ld a, $35
call Functionb98d4
inc a
hlcoord 15, 14
call Functionb98fc
call Functionb9491
pop hl
jp Functionb9803
; b944b
Functionb944b: ; b944b
push bc
ld hl, $9310
ld de, Unknown_b9e26
ld c, $28
call Functionb9915
ld de, MailPoliwagGFX
ld c, $30
call Functionb991e
ld de, Unknown_b9966
ld c, $8
call Functionb9915
ld de, Unknown_b9c5e
ld c, $20
call Functionb9915
ld de, Unknown_b996e
ld c, $8
call Functionb990c
call Functionb987b
hlcoord 2, 15
ld a, $3c
call Functionb98d4
ld a, $36
hlcoord 15, 14
call Functionb98fc
call Functionb9491
pop hl
jp Functionb9803
; b9491
Functionb9491: ; b9491
ld a, $3d
hlcoord 2, 2
call Functionb98ee
hlcoord 16, 2
call Functionb98ee
hlcoord 9, 4
call Functionb98ee
hlcoord 2, 11
call Functionb98ee
hlcoord 6, 12
call Functionb98ee
hlcoord 12, 11
call Functionb98ee
ld a, $41
hlcoord 5, 4
ld [hl], a
hlcoord 6, 2
ld [hl], a
hlcoord 12, 4
ld [hl], a
hlcoord 14, 2
ld [hl], a
hlcoord 3, 13
ld [hl], a
hlcoord 9, 11
ld [hl], a
hlcoord 16, 12
ld [hl], a
ret
; b94d6
Functionb94d6: ; b94d6
push bc
ld hl, $9310
ld bc, $0028
call Functionb97f8
ld de, Unknown_b9c96
ld c, 8
call Functionb9915
ld de, Unknown_b9c7e
ld c, 8
call Functionb9915
ld de, Unknown_b993e
ld c, 8
call Functionb9915
ld de, Unknown_b997e
ld c, 8
call Functionb990c
ld de, Unknown_b9926
ld c, 8
call Functionb9915
ld de, MailDittoGFX
ld c, $30
call Functionb991e
call Functionb987b
ld a, $31
hlcoord 1, 1
call Functionb98ee
hlcoord 17, 15
call Functionb98ee
hlcoord 1, 3
ld [hl], a
hlcoord 3, 1
ld [hl], a
hlcoord 16, 16
ld [hl], a
hlcoord 18, 14
ld [hl], a
ld a, $36
hlcoord 1, 4
ld [hl], a
hlcoord 2, 3
ld [hl], a
hlcoord 3, 2
ld [hl], a
hlcoord 4, 1
ld [hl], a
inc a
hlcoord 15, 16
ld [hl], a
hlcoord 16, 15
ld [hl], a
hlcoord 17, 14
ld [hl], a
hlcoord 18, 13
ld [hl], a
inc a
hlcoord 2, 15
ld b, $e
call Functionb98de
inc a
hlcoord 2, 11
call Functionb98d4
hlcoord 2, 5
call Functionb98d4
inc a
hlcoord 6, 1
call Functionb98d0
hlcoord 1, 16
call Functionb98d0
inc a
hlcoord 3, 13
call Functionb98fc
pop hl
jp Functionb9803
; b9582
Functionb9582: ; b9582
push bc
ld hl, $9310
ld de, Unknown_b997e
ld c, $8
call Functionb9915
ld a, $ff
ld bc, $0010
call ByteFill
ld de, Unknown_b992e
ld c, $8
call Functionb991e
ld de, MailDragoniteGFX
ld c, $b8
call Functionb991e
ld de, MailCloudGFX
ld c, $30
call Functionb990c
ld de, Unknown_b9db6
ld c, $8
call Functionb990c
ld de, MailCloudGFX
ld c, $8
call Functionb990c
ld de, Unknown_b9d26
ld c, $10
call Functionb990c
ld de, Unknown_b9d3e
ld c, $8
call Functionb990c
ld a, $31
ld hl, TileMap
call Functionb98dc
hlcoord 0, 1
call Functionb98e3
hlcoord 19, 1
call Functionb98e3
inc a
hlcoord 0, 17
call Functionb98dc
inc a
hlcoord 0, 16
call Functionb98dc
inc a
hlcoord 2, 2
call Functionb9636
hlcoord 3, 3
call Functionb9636
hlcoord 4, 4
call Functionb9636
dec hl
ld [hl], $7f
dec a
hlcoord 15, 14
call Functionb98ee
add $4
hlcoord 15, 16
ld [hli], a
inc a
ld [hl], a
inc a
push af
hlcoord 12, 1
call Functionb98fc
pop af
hlcoord 15, 4
call Functionb98fc
inc a
hlcoord 2, 11
call Functionb98d4
inc a
hlcoord 10, 3
call Functionb98ee
pop hl
jp Functionb9803
; b9636
Functionb9636: ; b9636
ld b, $6
.asm_b9638
ld [hli], a
inc a
dec b
jr nz, .asm_b9638
ret
; b963e
Functionb963e: ; b963e
push bc
ld hl, $9310
ld de, Unknown_b9d86
ld c, $40
call Functionb990c
ld de, MailOddishGFX
ld c, $20
call Functionb991e
ld de, Unknown_b9db6
ld c, $8
call Functionb9915
ld de, Unknown_b9cbe
ld c, $20
call Functionb990c
ld c, $20
call Functionb9915
call Functionb9858
hlcoord 2, 15
ld a, $3d
call Functionb98d4
ld a, $39
hlcoord 16, 13
call Functionb98ee
hlcoord 2, 13
call Functionb98ee
ld a, $3e
hlcoord 2, 2
call Functionb98ee
hlcoord 5, 3
call Functionb98ee
hlcoord 10, 2
call Functionb98ee
hlcoord 16, 3
call Functionb98ee
hlcoord 5, 11
call Functionb98ee
hlcoord 16, 10
call Functionb98ee
ld a, $42
hlcoord 3, 4
call Functionb98ee
hlcoord 12, 3
call Functionb98ee
hlcoord 14, 2
call Functionb98ee
hlcoord 2, 10
call Functionb98ee
hlcoord 14, 11
call Functionb98ee
pop hl
jp Functionb9803
; b96ca
Functionb96ca: ; b96ca
push bc
ld hl, $9310
ld de, Unknown_b9e4e
ld c, $28
call Functionb9915
ld de, Unknown_b995e
ld c, $8
call Functionb9915
ld hl, $93d0
ld de, Unknown_b9bfe
ld c, $20
call Functionb990c
ld de, Unknown_b9936
ld c, $8
call Functionb9915
call Functionb987b
hlcoord 8, 15
ld a, $36
ld b, $a
call Functionb98de
call Functionb9491
ld a, $1
ld [UnownLetter], a
hlcoord 1, 10
call Function3786
pop hl
jp Functionb9803
; b9710
Functionb9710: ; b9710
push bc
ld hl, $9310
ld de, Unknown_b9e06
ld c, $20
call Functionb9915
ld de, Unknown_b993e
ld c, $10
call Functionb9915
ld de, Unknown_b9996
ld c, $30
call Functionb991e
xor a
ld bc, $0010
call ByteFill
ld de, Unknown_b9cfe
ld c, $18
call Functionb990c
ld de, Unknown_b9946
ld c, $8
call Functionb990c
ld a, $31
ld hl, TileMap
call Functionb98a8
hlcoord 1, 17
call Functionb98a8
ld a, $33
hlcoord 0, 1
call Functionb98ba
hlcoord 19, 0
call Functionb98ba
ld a, $35
hlcoord 2, 15
call Functionb989e
ld a, $37
hlcoord 15, 14
call Functionb98fc
call Functionb9491
pop hl
jp Functionb9803
; b9776
Functionb9776: ; b9776
push bc
ld hl, $9310
ld bc, $0028
call Functionb97f8
ld de, Unknown_b992e
ld c, $8
call Functionb9915
ld de, MailMewGFX
ld c, $90
call Functionb9915
ld de, Unknown_b9dce
ld c, $8
call Functionb990c
ld de, Unknown_b9df6
ld c, $8
call Functionb990c
call Functionb987b
ld a, $36
hlcoord 1, 16
call Functionb98d8
inc a
hlcoord 15, 14
call Functionb98fc
inc a
hlcoord 15, 16
ld [hli], a
inc a
ld [hl], a
ld a, $3f
hlcoord 1, 1
call Functionb98a8
ld a, $41
hlcoord 0, 2
call Functionb98b5
ld a, $43
hlcoord 19, 2
call Functionb98b5
ld a, $45
hlcoord 0, 1
ld [hl], a
inc a
hlcoord 19, 1
ld [hl], a
inc a
hlcoord 0, 16
ld [hl], a
inc a
hlcoord 19, 16
ld [hl], a
inc a
hlcoord 2, 5
call Functionb98d4
inc a
hlcoord 2, 11
call Functionb98d4
pop hl
jp Functionb9803
; b97f8
Functionb97f8: ; b97f8
.asm_b97f8
xor a
ld [hli], a
ld a, $ff
ld [hli], a
dec bc
ld a, b
or c
jr nz, .asm_b97f8
ret
; b9803
Functionb9803: ; b9803
ld bc, $002f
ld de, $d002
ld a, $0
call GetSRAMBank
call CopyBytes
call CloseSRAM
ld hl, $d023
ld de, $d050
ld bc, $000a
call CopyBytes
ld a, $50
ld [$d023], a
ld [$d05a], a
ld de, $d002
hlcoord 2, 7
call PlaceString
ld de, $d050
ld a, [de]
and a
ret z
ld a, [$d1ec]
hlcoord 8, 14
cp $3
jr z, .asm_b984b
hlcoord 6, 14
cp $6
jr z, .asm_b984b
hlcoord 5, 14
.asm_b984b
jp PlaceString
; b984e
Functionb984e: ; b984e
.asm_b984e
ld a, [hl]
xor $ff
ld [hli], a
dec bc
ld a, b
or c
jr nz, .asm_b984e
ret
; b9858
Functionb9858: ; b9858
ld hl, TileMap
ld a, $31
ld [hli], a
inc a
call Functionb98d8
inc a
ld [hli], a
inc a
call Functionb98e3
ld a, $36
ld [hli], a
inc a
call Functionb98d8
hlcoord 19, 1
ld a, $35
call Functionb98e3
ld a, $38
ld [hl], a
ret
; b987b
Functionb987b: ; b987b
ld hl, TileMap
ld a, $31
ld [hli], a
inc a
call Functionb98d8
ld [hl], $31
inc hl
inc a
call Functionb98e3
ld [hl], $31
inc hl
inc a
call Functionb98d8
hlcoord 19, 1
ld a, $35
call Functionb98e3
ld [hl], $31
ret
; b989e
Functionb989e: ; b989e
push af
ld b, $7
jr Functionb98ab
Functionb98a3: ; b98a3
push af
ld b, $8
jr Functionb98ab
Functionb98a8: ; b98a8
push af
ld b, $9
Functionb98ab: ; b98ab
ld [hli], a
inc a
ld [hli], a
dec a
dec b
jr nz, Functionb98ab
ld [hl], a
pop af
ret
; b98b5
Functionb98b5: ; b98b5
push af
ld b, $7
jr Functionb98bd
Functionb98ba: ; b98ba
push af
ld b, $8
Functionb98bd: ; b98bd
ld [hl], a
ld de, $0014
add hl, de
inc a
ld [hl], a
add hl, de
dec a
dec b
jr nz, Functionb98bd
ld [hl], a
pop af
ret
; b98cc
Functionb98cc: ; b98cc
ld b, $7
jr Functionb98de
Functionb98d0: ; b98d0
ld b, $d
jr Functionb98de
Functionb98d4: ; b98d4
ld b, $10
jr Functionb98de
Functionb98d8: ; b98d8
ld b, $12
jr Functionb98de
Functionb98dc: ; b98dc
ld b, $14
Functionb98de: ; b98de
ld [hli], a
dec b
jr nz, Functionb98de
ret
; b98e3
Functionb98e3: ; b98e3
ld b, $10
ld de, $0014
.asm_b98e8
ld [hl], a
add hl, de
dec b
jr nz, .asm_b98e8
ret
; b98ee
Functionb98ee: ; b98ee
push af
ld [hli], a
inc a
ld [hl], a
ld bc, $0013
add hl, bc
inc a
ld [hli], a
inc a
ld [hl], a
pop af
ret
; b98fc
Functionb98fc: ; b98fc
ld [hli], a
inc a
ld [hli], a
inc a
ld [hl], a
ld bc, $0012
add hl, bc
inc a
ld [hli], a
inc a
ld [hli], a
inc a
ld [hl], a
ret
; b990c
Functionb990c: ; b990c
.asm_b990c
ld a, [de]
inc de
ld [hli], a
xor a
ld [hli], a
dec c
jr nz, .asm_b990c
ret
; b9915
Functionb9915: ; b9915
.asm_b9915
xor a
ld [hli], a
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .asm_b9915
ret
; b991e
Functionb991e: ; b991e
.asm_b991e
ld a, [de]
inc de
ld [hli], a
ld [hli], a
dec c
jr nz, .asm_b991e
ret
; b9926
Unknown_b9926: ; b9926
INCBIN "baserom.gbc", $b9926, $b992e - $b9926
Unknown_b992e: ; b992e
INCBIN "baserom.gbc", $b992e, $b9936 - $b992e
Unknown_b9936: ; b9936
INCBIN "baserom.gbc", $b9936, $b993e - $b9936
Unknown_b993e: ; b993e
INCBIN "baserom.gbc", $b993e, $b9946 - $b993e
Unknown_b9946: ; b9946
INCBIN "baserom.gbc", $b9946, $b994e - $b9946
Unknown_b994e: ; b994e
INCBIN "baserom.gbc", $b994e, $b995e - $b994e
Unknown_b995e: ; b995e
INCBIN "baserom.gbc", $b995e, $b9966 - $b995e
Unknown_b9966: ; b9966
INCBIN "baserom.gbc", $b9966, $b996e - $b9966
Unknown_b996e: ; b996e
INCBIN "baserom.gbc", $b996e, $b9976 - $b996e
Unknown_b9976: ; b9976
INCBIN "baserom.gbc", $b9976, $b997e - $b9976
Unknown_b997e: ; b997e
INCBIN "baserom.gbc", $b997e, $b998e - $b997e
Unknown_b998e: ; b998e
INCBIN "baserom.gbc", $b998e, $b9996 - $b998e
Unknown_b9996: ; b9996
INCBIN "baserom.gbc", $b9996, $b99c6 - $b9996
MailDratiniGFX: ; b99c6
INCBIN "baserom.gbc", $b99c6, $b99f6 - $b99c6
MailPoliwagGFX: ; b99f6
INCBIN "baserom.gbc", $b99f6, $b9a26 - $b99f6
MailLaprasGFX: ; b9a26
INCBIN "baserom.gbc", $b9a26, $b9a56 - $b9a26
MailPikaGFX: ; b9a56
INCBIN "baserom.gbc", $b9a56, $b9a86 - $b9a56
MailDittoGFX: ; b9a86
INCBIN "baserom.gbc", $b9a86, $b9ab6 - $b9a86
MailMewGFX: ; b9ab6
INCBIN "baserom.gbc", $b9ab6, $b9b46 - $b9ab6
MailDragoniteGFX: ; b9b46
INCBIN "baserom.gbc", $b9b46, $b9bce - $b9b46
MailSentretGFX: ; b9bce
INCBIN "baserom.gbc", $b9bce, $b9bee - $b9bce
Unknown_b9bee: ; b9bee
INCBIN "baserom.gbc", $b9bee, $b9bfe - $b9bee
Unknown_b9bfe: ; b9bfe
INCBIN "baserom.gbc", $b9bfe, $b9c1e - $b9bfe
MailOddishGFX: ; b9c1e
INCBIN "baserom.gbc", $b9c1e, $b9c3e - $b9c1e
Unknown_b9c3e: ; b9c3e
INCBIN "baserom.gbc", $b9c3e, $b9c5e - $b9c3e
Unknown_b9c5e: ; b9c5e
INCBIN "baserom.gbc", $b9c5e, $b9c7e - $b9c5e
Unknown_b9c7e: ; b9c7e
INCBIN "baserom.gbc", $b9c7e, $b9c96 - $b9c7e
Unknown_b9c96: ; b9c96
INCBIN "baserom.gbc", $b9c96, $b9c9e - $b9c96
Unknown_b9c9e: ; b9c9e
INCBIN "baserom.gbc", $b9c9e, $b9cbe - $b9c9e
Unknown_b9cbe: ; b9cbe
INCBIN "baserom.gbc", $b9cbe, $b9cde - $b9cbe
Unknown_b9cde: ; b9cde
INCBIN "baserom.gbc", $b9cde, $b9cfe - $b9cde
Unknown_b9cfe: ; b9cfe
INCBIN "baserom.gbc", $b9cfe, $b9d16 - $b9cfe
MailCloudGFX: ; b9d16
INCBIN "baserom.gbc", $b9d16, $b9d26 - $b9d16
Unknown_b9d26: ; b9d26
INCBIN "baserom.gbc", $b9d26, $b9d3e - $b9d26
Unknown_b9d3e: ; b9d3e
INCBIN "baserom.gbc", $b9d3e, $b9d46 - $b9d3e
Unknown_b9d46: ; b9d46
INCBIN "baserom.gbc", $b9d46, $b9d76 - $b9d46
Unknown_b9d76: ; b9d76
INCBIN "baserom.gbc", $b9d76, $b9d86 - $b9d76
Unknown_b9d86: ; b9d86
INCBIN "baserom.gbc", $b9d86, $b9db6 - $b9d86
Unknown_b9db6: ; b9db6
INCBIN "baserom.gbc", $b9db6, $b9dc6 - $b9db6
Unknown_b9dc6: ; b9dc6
INCBIN "baserom.gbc", $b9dc6, $b9dce - $b9dc6
Unknown_b9dce: ; b9dce
INCBIN "baserom.gbc", $b9dce, $b9df6 - $b9dce
Unknown_b9df6: ; b9df6
INCBIN "baserom.gbc", $b9df6, $b9e06 - $b9df6
Unknown_b9e06: ; b9e06
INCBIN "baserom.gbc", $b9e06, $b9e26 - $b9e06
Unknown_b9e26: ; b9e26
INCBIN "baserom.gbc", $b9e26, $b9e4e - $b9e26
Unknown_b9e4e: ; b9e4e
INCBIN "baserom.gbc", $b9e4e, $b9e76 - $b9e4e
ItemIsMail: ; b9e76
ld a, d
ld hl, .items
ld de, 1
jp IsInArray
; b9e80
.items
db FLOWER_MAIL
db SURF_MAIL
db LITEBLUEMAIL
db PORTRAITMAIL
db LOVELY_MAIL
db EON_MAIL
db MORPH_MAIL
db BLUESKY_MAIL
db MUSIC_MAIL
db MIRAGE_MAIL
db $ff
; b9e8b
SECTION "bank2F", ROMX, BANK[$2F]
INCLUDE "engine/std_scripts.asm"
INCLUDE "engine/phone_scripts.asm"
SECTION "bank30", ROMX, BANK[$30]
INCLUDE "gfx/overworld/sprites_1.asm"
SECTION "bank31", ROMX, BANK[$31]
INCLUDE "gfx/overworld/sprites_2.asm"
SECTION "bank32", ROMX, BANK[$32]
INCLUDE "battle/bg_effects.asm"
INCLUDE "battle/anims.asm"
Functioncbcdd: ; cbcdd
call Functioncbce5
ld a, [hCGB]
and a
ret nz
ret
; cbce5
Functioncbce5: ; cbce5
ld a, [hCGB]
and a
jr nz, .asm_cbd06
ld a, [TimeOfDayPal]
and $3
cp $3
ld a, $0
jr z, .asm_cbcf7
ld a, $aa
.asm_cbcf7
call DmgToCgbBGPals
ld c, $4
call DelayFrames
callba _UpdateTimePals
ret
.asm_cbd06
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, BGPals
ld c, $20
.asm_cbd12
ld a, $bc
ld [hli], a
ld a, $7e
ld [hli], a
dec c
jr nz, .asm_cbd12
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ld c, $4
call DelayFrames
callba _UpdateTimePals
ret
; cbd2e
TheEndGFX:: ; cbd2e
INCBIN "gfx/credits/theend.w64.2bpp"
; cbe2e
SECTION "bank33", ROMX, BANK[$33]
Functioncc000: ; cc000
call WhiteBGMap
call ClearTileMap
call ClearSprites
call Functione58
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
hlcoord 0, 0
ld b, 4
ld c, 13
call TextBox
hlcoord 0, 6
ld b, 4
ld c, 13
call TextBox
hlcoord 2, 0
ld de, .Stock
call PlaceString
hlcoord 2, 6
ld de, .This
call PlaceString
hlcoord 5, 4
ld de, .Health
call PlaceString
hlcoord 5, 10
ld de, .Health
call PlaceString
ld a, [$df9c]
ld [$d265], a
call GetPokemonName
ld de, StringBuffer1
hlcoord 1, 2
call PlaceString
ld h, b
ld l, c
ld a, [$dfbb]
ld [TempMonLevel], a
call PrintLevel
ld de, EnemyMonNick
hlcoord 1, 8
call PlaceString
ld h, b
ld l, c
ld a, [EnemyMonLevel]
ld [TempMonLevel], a
call PrintLevel
hlcoord 11, 4
ld de, $dfc0
ld bc, $0203
call PrintNum
hlcoord 11, 10
ld de, EnemyMonMaxHP
call PrintNum
ld hl, SwitchMonText
call PrintText
pop af
ld [Options], a
call WaitBGMap
ld b, $8
call GetSGBLayout
call Function32f9
ret
; cc0a7
.Health
db "HEALTH@"
.Stock
db " STOCK ", $4a, " @"
.This
db " THIS ", $4a, " @"
SwitchMonText: ; cc0c2
; Switch #MON?
text_jump UnknownText_0x1c10cf
db "@"
; cc0c7
Functioncc0c7: ; cc0c7
call GetPokemonName
ld hl, AlreadyCaughtText
jp PrintText
; cc0d0
AlreadyCaughtText: ; 0xcc0d0
; You already caught a @ .
text_jump UnknownText_0x1c10dd
db "@"
; 0xcc0d5
Predef2F:
Predef38:
Predef39: ; cc0d5
ret
; cc0d6
INCLUDE "battle/anim_commands.asm"
INCLUDE "battle/anim_objects.asm"
SECTION "Pic Animations 1", ROMX, BANK[$34]
INCLUDE "gfx/pics/animation.asm"
; Pic animations are assembled in 3 parts:
; Top-level animations:
; frame #, duration: Frame 0 is the original pic (no change)
; setrepeat #: Sets the number of times to repeat
; dorepeat #: Repeats from command # (starting from 0)
; end
; Bitmasks:
; Layered over the pic to designate affected tiles
; Frame definitions:
; first byte is the bitmask used for this frame
; following bytes are tile ids mapped to each bit in the mask
; Main animations (played everywhere)
INCLUDE "gfx/pics/anim_pointers.asm"
INCLUDE "gfx/pics/anims.asm"
; Extra animations, appended to the main animation
; Used in the status screen (blinking, tail wags etc.)
INCLUDE "gfx/pics/extra_pointers.asm"
INCLUDE "gfx/pics/extras.asm"
; Unown has its own animation data despite having an entry in the main tables
INCLUDE "gfx/pics/unown_anim_pointers.asm"
INCLUDE "gfx/pics/unown_anims.asm"
INCLUDE "gfx/pics/unown_extra_pointers.asm"
INCLUDE "gfx/pics/unown_extras.asm"
; Bitmasks
INCLUDE "gfx/pics/bitmask_pointers.asm"
INCLUDE "gfx/pics/bitmasks.asm"
INCLUDE "gfx/pics/unown_bitmask_pointers.asm"
INCLUDE "gfx/pics/unown_bitmasks.asm"
SECTION "Pic Animations 2", ROMX, BANK[$35]
INCLUDE "gfx/pics/frame_pointers.asm"
INCLUDE "gfx/pics/kanto_frames.asm"
SECTION "bank36", ROMX, BANK[$36]
FontInversed: INCBIN "gfx/misc/font_inversed.w128.1bpp"
SECTION "Pic Animations 3", ROMX, BANK[$36]
INCLUDE "gfx/pics/johto_frames.asm"
INCLUDE "gfx/pics/unown_frame_pointers.asm"
INCLUDE "gfx/pics/unown_frames.asm"
SECTION "Tileset Data 6", ROMX, BANK[TILESETS_6]
INCLUDE "tilesets/data_6.asm"
SECTION "bank38", ROMX, BANK[$38]
Functione0000: ; e0000
push de
xor a
call GetSRAMBank
ld hl, $a000
ld bc, $0000
.asm_e000b
push bc
push hl
push bc
ld de, $d002
call Functione004e
call Functione0057
ld hl, Unknown_e008b
pop bc
add hl, bc
add hl, bc
ld a, [hli]
ld e, a
ld d, [hl]
ld hl, $d012
call Functione004e
pop hl
ld bc, $0010
add hl, bc
pop bc
inc c
ld a, c
cp $31
jr c, .asm_e000b
ld hl, OverworldMap
ld de, $a000
ld bc, $0310
call CopyBytes
pop hl
ld de, $a000
ld c, $31
ld a, [hROMBank]
ld b, a
call Get2bpp
call CloseSRAM
ret
; e004e
Functione004e: ; e004e
ld c, $10
.asm_e0050
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .asm_e0050
ret
; e0057
Functione0057: ; e0057
ld hl, $d012
ld e, $80
ld d, $8
.asm_e005e
push hl
ld hl, $d002
call Functione0078
pop hl
ld a, b
ld [hli], a
push hl
ld hl, $d003
call Functione0078
pop hl
ld a, b
ld [hli], a
srl e
dec d
jr nz, .asm_e005e
ret
; e0078
Functione0078: ; e0078
ld b, $0
ld c, $8
.asm_e007c
ld a, [hli]
and e
jr z, .asm_e0083
scf
jr .asm_e0084
.asm_e0083
and a
.asm_e0084
rr b
inc hl
dec c
jr nz, .asm_e007c
ret
; e008b
Unknown_e008b: ; e008b
dw $caa0, $ca30, $c9c0, $c950, $c8e0, $c870, $c800
dw $cab0, $ca40, $c9d0, $c960, $c8f0, $c880, $c810
dw $cac0, $ca50, $c9e0, $c970, $c900, $c890, $c820
dw $cad0, $ca60, $c9f0, $c980, $c910, $c8a0, $c830
dw $cae0, $ca70, $ca00, $c990, $c920, $c8b0, $c840
dw $caf0, $ca80, $ca10, $c9a0, $c930, $c8c0, $c850
dw $cb00, $ca90, $ca20, $c9b0, $c940, $c8d0, $c860
; e00ed
Unknown_e00ed:
; Graphics for an unused Game Corner
; game were meant to be here.
Functione00ed: ; e00ed (38:40ed)
ret
; e00ee (38:40ee)
Functione00ee: ; e00ee (38:40ee)
ld hl, Options ; $cfcc
set 4, [hl]
call WhiteBGMap
call ClearTileMap
call ClearSprites
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
call DisableLCD
call Functione51
call Functione5f
ld hl, LZ_e0d16
ld de, $9000
call Decompress
ld hl, LZ_e0ea8
ld de, $93e0
call Decompress
ld hl, LZ_e0cdb
ld de, $8000
call Decompress
ld hl, Unknown_e0cf6
ld de, $8ef0
ld bc, $10
call CopyBytes
ld hl, Unknown_e0d06
ld de, $8f50
ld bc, $10
call CopyBytes
call Functione0521
call Functione04c1
call Functione0c37
call EnableLCD
call Function3200
ld a, $e4
call DmgToCgbBGPals
ld de, $e4e4
call DmgToCgbObjPals
call DelayFrame
xor a
ld [$cf63], a
ld a, $2
ld [$cf64], a
ld [$cf65], a
ld de, MUSIC_GAME_CORNER
call PlayMusic
.asm_e0170
ld a, [$cf63]
bit 7, a
jr nz, .asm_e017c
call Functione0191
jr .asm_e0170
.asm_e017c
call WaitSFX
ld de, SFX_QUIT_SLOTS
call PlaySFX
call WaitSFX
call WhiteBGMap
ld hl, Options ; $cfcc
res 4, [hl]
ret
Functione0191: ; e0191 (38:4191)
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_e01a0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; e01a0 (38:41a0)
Jumptable_e01a0: ; e01a0
dw Functione01b5
dw Functione01d2
dw Functione0217
dw Functione02b7
dw Functione02da
dw Functione0314
dw Functione031e
dw Functione0360
; e01b0
Functione01b0: ; e01b0
ld hl, $cf63
inc [hl]
ret
; e01b5
Functione01b5: ; e01b5
ld hl, UnknownText_0xe01cd
call Functione0489
call YesNoBox
jr c, .asm_e01c7
call Functione0366
call Functione01b0
ret
.asm_e01c7
ld a, $7
ld [$cf63], a
ret
; e01cd
UnknownText_0xe01cd: ; 0xe01cd
; Play with three coins?
text_jump UnknownText_0x1c5793
db "@"
; 0xe01d2
Functione01d2: ; e01d2
ld a, [Coins]
ld h, a
ld a, [Coins + 1]
ld l, a
ld a, h
and a
jr nz, .asm_e01ef
ld a, l
cp 3
jr nc, .asm_e01ef
ld hl, UnknownText_0xe0212
call Functione0489
ld a, $7
ld [$cf63], a
ret
.asm_e01ef
ld de, -3
add hl, de
ld a, h
ld [Coins], a
ld a, l
ld [Coins + 1], a
ld de, SFX_TRANSACTION
call PlaySFX
xor a
ld [hBGMapMode], a
call Functione049c
ld a, $1
ld [hBGMapMode], a
call WaitSFX
call Functione01b0
ret
; e0212
UnknownText_0xe0212: ; 0xe0212
; Not enough coins…
text_jump UnknownText_0x1c57ab
db "@"
; 0xe0217
Functione0217: ; e0217
xor a
ld [hBGMapMode], a
ld hl, TileMap
ld bc, $0c09
call Functione04e5
hlcoord 9, 0
ld bc, $0014
ld a, [$c6e8]
call AddNTimes
ld [hl], $f5
ld a, $1
ld [hBGMapMode], a
ld c, $14
call DelayFrames
hlcoord 2, 0
call Functione03c1
ld a, $1
ld [hBGMapMode], a
ld c, $14
call DelayFrames
hlcoord 2, 6
call Functione03c1
call WaitBGMap
ld hl, UnknownText_0xe02b2
call Functione0489
xor a
ld [$cf66], a
.asm_e025c
call Functiona57
ld a, [$ffa9]
and $1
jr nz, .asm_e027c
ld de, SFX_KINESIS
call PlaySFX
call Functione0849
ld c, $4
call DelayFrames
ld hl, $cf66
ld a, [hl]
xor $1
ld [hl], a
jr .asm_e025c
.asm_e027c
ld de, SFX_SLOT_MACHINE_START
call PlaySFX
ld a, $3
.asm_e0284
push af
call Functione0849
ld c, $4
call DelayFrames
call ClearSprites
ld c, $4
call DelayFrames
pop af
dec a
jr nz, .asm_e0284
ld hl, $cf66
ld a, [hl]
push af
xor $1
ld [hl], a
call Functione03ac
ld bc, $0605
call Functione04e5
pop af
ld [$cf66], a
call Functione01b0
ret
; e02b2
UnknownText_0xe02b2: ; 0xe02b2
; Choose a card.
text_jump UnknownText_0x1c57be
db "@"
; 0xe02b7
Functione02b7: ; e02b7
ld hl, UnknownText_0xe02d5
call Functione0489
.asm_e02bd
call Functiona57
ld a, [$ffa9]
and $1
jr nz, .asm_e02d1
call Functione089c
call Functione0960
call DelayFrame
jr .asm_e02bd
.asm_e02d1
call Functione01b0
ret
; e02d5
UnknownText_0xe02d5: ; 0xe02d5
; Place your bet.
text_jump UnknownText_0x1c57ce
db "@"
; 0xe02da
Functione02da: ; e02da
xor a
ld [$ff9b], a
call Functione0960
call WaitSFX
ld de, SFX_CHOOSE_A_CARD
call PlaySFX
call WaitSFX
ld a, [$c6e8]
ld e, a
ld d, $0
ld hl, PlayerSDefLevel
add hl, de
add hl, de
ld a, [$cf66]
ld e, a
add hl, de
ld a, [hl]
ld [CurEnemyMoveNum], a
ld e, a
ld hl, $c6ea
add hl, de
ld [hl], $1
call Functione03ac
call Functione03ec
call Function3200
call Functione01b0
ret
; e0314
Functione0314: ; e0314
call Functione0637
call Functiona80
call Functione01b0
ret
; e031e
Functione031e: ; e031e
call ClearSprites
ld hl, UnknownText_0xe0356
call Functione0489
call YesNoBox
jr nc, .asm_e0330
call Functione01b0
ret
.asm_e0330
ld a, [$c6e8]
inc a
ld [$c6e8], a
cp $c
jr c, .asm_e034d
call Functione04c1
ld a, $1
ld [hBGMapMode], a
call Functione0366
ld hl, UnknownText_0xe035b
call PrintText
jr .asm_e0350
.asm_e034d
call Functione0534
.asm_e0350
ld a, $1
ld [$cf63], a
ret
; e0356
UnknownText_0xe0356: ; 0xe0356
; Want to play again?
text_jump UnknownText_0x1c57df
db "@"
; 0xe035b
UnknownText_0xe035b: ; 0xe035b
; The cards have been shuffled.
text_jump UnknownText_0x1c57f4
db "@"
; 0xe0360
Functione0360: ; e0360
ld hl, $cf63
set 7, [hl]
ret
; e0366
Functione0366: ; e0366
ld hl, PlayerSDefLevel
ld bc, $0018
xor a
call ByteFill
ld de, PlayerSDefLevel
ld c, $17
.asm_e0375
call Random
and $1f
cp $18
jr nc, .asm_e0375
ld l, a
ld h, $0
add hl, de
ld a, [hl]
and a
jr nz, .asm_e0375
ld [hl], c
dec c
jr nz, .asm_e0375
xor a
ld [$c6e8], a
ld hl, $c6ea
ld bc, $0018
call ByteFill
ret
; e0398
Functione0398: ; e0398
ld hl, $0000
ld bc, $0006
ld a, [$cf64]
call AddNTimes
ld b, $0
ld a, [$cf65]
ld c, a
add hl, bc
ret
; e03ac
Functione03ac: ; e03ac
ld a, [$cf66]
and a
jr nz, .asm_e03ba
hlcoord 2, 0
ld bc, $1018
jr .asm_e03c0
.asm_e03ba
hlcoord 2, 6
ld bc, $4018
.asm_e03c0
ret
; e03c1
Functione03c1: ; e03c1
xor a
ld [hBGMapMode], a
ld de, Unknown_e03ce
lb bc, 6, 5
call Functione04f7
ret
; e03ce
Unknown_e03ce: ; e03ce
db $08, $09, $09, $09, $0a
db $0b, $28, $2b, $28, $0c
db $0b, $2c, $2d, $2e, $0c
db $0b, $2f, $30, $31, $0c
db $0b, $32, $33, $34, $0c
db $0d, $0e, $0e, $0e, $0f
; e03ec
Functione03ec: ; e03ec
xor a
ld [hBGMapMode], a
push hl
push hl
ld de, Unknown_e043b
lb bc, 6, 5
call Functione04f7
ld a, [CurEnemyMoveNum]
ld e, a
ld d, 0
ld hl, Unknown_e0459
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
ld bc, $0017
add hl, bc
ld [hl], e
ld bc, $0012
add hl, bc
ld a, d
ld de, $0014
ld b, $3
.asm_e0418
push hl
ld c, $3
.asm_e041b
ld [hli], a
inc a
dec c
jr nz, .asm_e041b
pop hl
add hl, de
dec b
jr nz, .asm_e0418
pop hl
ld a, [hCGB]
and a
ret z
ld de, AttrMap - TileMap
add hl, de
ld a, [CurEnemyMoveNum]
and 3
inc a
lb bc, 6, 5
call Functione04e7
ret
; e043b
Unknown_e043b: ; e043b
db $18, $19, $19, $19, $1a
db $1b, $35, $7f, $7f, $1c
db $0b, $28, $28, $28, $0c
db $0b, $28, $28, $28, $0c
db $0b, $28, $28, $28, $0c
db $1d, $1e, $1e, $1e, $1f
; e0459
Unknown_e0459: ; e0459
db $f7,$4e, $f7,$57, $f7,$69, $f7,$60
db $f8,$4e, $f8,$57, $f8,$69, $f8,$60
db $f9,$4e, $f9,$57, $f9,$69, $f9,$60
db $fa,$4e, $fa,$57, $fa,$69, $fa,$60
db $fb,$4e, $fb,$57, $fb,$69, $fb,$60
db $fc,$4e, $fc,$57, $fc,$69, $fc,$60
; e0489
Functione0489: ; e0489
push hl
hlcoord 0, 12
ld b, $4
ld c, $12
call TextBox
pop hl
call PrintTextBoxText
call Functione049c
ret
; e049c
Functione049c: ; e049c
hlcoord 9, 15
ld b, $1
ld c, $9
call TextBox
hlcoord 10, 16
ld de, String_e04bc
call PlaceString
hlcoord 15, 16
ld de, Coins
ld bc, $8204
call PrintNum
ret
; e04bc
String_e04bc:
db "COIN@"
; e04c1
Functione04c1: ; e04c1 (38:44c1)
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
ld a, $29
call ByteFill
hlcoord 9, 0
ld de, Unknown_e110c
lb bc, 12, 11
call Functione04f7
hlcoord 0, 12
ld bc, $412
call TextBox
ret
; e04e5 (38:44e5)
Functione04e5: ; e04e5
ld a, $29
Functione04e7: ; e04e7 (38:44e7)
push bc
push hl
.asm_e04e9
ld [hli], a
dec c
jr nz, .asm_e04e9
pop hl
ld bc, $14
add hl, bc
pop bc
dec b
jr nz, Functione04e7
ret
Functione04f7: ; e04f7 (38:44f7)
push bc
push hl
.asm_e04f9
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .asm_e04f9
pop hl
ld bc, $14
add hl, bc
pop bc
dec b
jr nz, Functione04f7
ret
; e0509 (38:4509)
Functione0509: ; e0509
ld de, Sprites
ld a, [hli]
.asm_e050d
push af
ld a, [hli]
add b
ld [de], a
inc de
ld a, [hli]
add c
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
pop af
dec a
jr nz, .asm_e050d
ret
; e0521
Functione0521: ; e0521 (38:4521)
ld de, $8f60
ld hl, $8f62
ld bc, $9e
call CopyBytes
ld hl, $8ffe
xor a
ld [hli], a
ld [hl], a
ret
; e0534 (38:4534)
Functione0534: ; e0534
xor a
ld [hBGMapMode], a
ld a, [CurEnemyMoveNum]
ld e, a
ld d, 0
and 3
ld c, a
ld b, 0
ld a, e
and $1c
srl a
add Jumptable_e0553 % $100
ld l, a
ld a, 0
adc Jumptable_e0553 / $100
ld h, a
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; e0553
Jumptable_e0553: ; e0553
dw Functione055f
dw Functione0583
dw Functione05a7
dw Functione05cb
dw Functione05ef
dw Functione0613
; e055f
Functione055f: ; e055f
ld hl, $c6ee
add hl, de
ld a, [hl]
and a
jr nz, .asm_e0575
hlcoord 13, 3
add hl, bc
add hl, bc
ld [hl], $36
ld bc, $0014
add hl, bc
ld [hl], $37
ret
.asm_e0575
hlcoord 13, 3
add hl, bc
add hl, bc
ld [hl], $36
ld bc, $0014
add hl, bc
ld [hl], $3d
ret
; e0583
Functione0583: ; e0583
ld hl, $c6e6
add hl, de
ld a, [hl]
and a
jr nz, .asm_e0599
hlcoord 13, 4
add hl, bc
add hl, bc
ld [hl], $3b
ld bc, $0014
add hl, bc
ld [hl], $3a
ret
.asm_e0599
hlcoord 13, 4
add hl, bc
add hl, bc
ld [hl], $3d
ld bc, $0014
add hl, bc
ld [hl], $3a
ret
; e05a7
Functione05a7: ; e05a7
ld hl, $c6ee
add hl, de
ld a, [hl]
and a
jr nz, .asm_e05bd
hlcoord 13, 6
add hl, bc
add hl, bc
ld [hl], $36
ld bc, $0014
add hl, bc
ld [hl], $38
ret
.asm_e05bd
hlcoord 13, 6
add hl, bc
add hl, bc
ld [hl], $36
ld bc, $0014
add hl, bc
ld [hl], $3d
ret
; e05cb
Functione05cb: ; e05cb
ld hl, $c6e6
add hl, de
ld a, [hl]
and a
jr nz, .asm_e05e1
hlcoord 13, 7
add hl, bc
add hl, bc
ld [hl], $3c
ld bc, $0014
add hl, bc
ld [hl], $3a
ret
.asm_e05e1
hlcoord 13, 7
add hl, bc
add hl, bc
ld [hl], $3d
ld bc, $0014
add hl, bc
ld [hl], $3a
ret
; e05ef
Functione05ef: ; e05ef
ld hl, $c6ee
add hl, de
ld a, [hl]
and a
jr nz, .asm_e0605
hlcoord 13, 9
add hl, bc
add hl, bc
ld [hl], $36
ld bc, $0014
add hl, bc
ld [hl], $39
ret
.asm_e0605
hlcoord 13, 9
add hl, bc
add hl, bc
ld [hl], $36
ld bc, $0014
add hl, bc
ld [hl], $3d
ret
; e0613
Functione0613: ; e0613
ld hl, $c6e6
add hl, de
ld a, [hl]
and a
jr nz, .asm_e0629
hlcoord 13, 10
add hl, bc
add hl, bc
ld [hl], $3c
ld bc, $0014
add hl, bc
ld [hl], $3a
ret
.asm_e0629
hlcoord 13, 10
add hl, bc
add hl, bc
ld [hl], $3d
ld bc, $0014
add hl, bc
ld [hl], $3a
ret
; e0637
Functione0637: ; e0637
call Functione0398
add hl, hl
ld de, Jumptable_e0643
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; e0643
Jumptable_e0643: ; e0643
dw Functione06a3
dw Functione06a3
dw Functione06a6
dw Functione06a6
dw Functione06b0
dw Functione06b0
dw Functione06a3
dw Functione06a3
dw Functione06ec
dw Functione06f6
dw Functione0702
dw Functione070e
dw Functione06c2
dw Functione0722
dw Functione0770
dw Functione0774
dw Functione0778
dw Functione077c
dw Functione06c2
dw Functione072c
dw Functione0780
dw Functione0784
dw Functione0788
dw Functione078c
dw Functione06cc
dw Functione0738
dw Functione0790
dw Functione0794
dw Functione0798
dw Functione079c
dw Functione06cc
dw Functione0744
dw Functione07a0
dw Functione07a4
dw Functione07a8
dw Functione07ac
dw Functione06d8
dw Functione0750
dw Functione07b0
dw Functione07b4
dw Functione07b8
dw Functione07bc
dw Functione06d8
dw Functione075c
dw Functione07c0
dw Functione07c4
dw Functione07c8
dw Functione07cc
; e06a3
Functione06a3: ; e06a3
jp Functione07db
; e06a6
Functione06a6: ; e06a6
ld a, [CurEnemyMoveNum]
and $2
jp nz, Functione07db
jr Functione06ba
Functione06b0: ; e06b0
ld a, [CurEnemyMoveNum]
and $2
jr nz, Functione06ba
jp Functione07db
Functione06ba: ; e06ba
ld c, $6
ld de, SFX_2ND_PLACE
jp Functione07eb
; e06c2
Functione06c2: ; e06c2
ld a, [CurEnemyMoveNum]
and $18
jr z, Functione06e4
jp Functione07db
Functione06cc: ; e06cc
ld a, [CurEnemyMoveNum]
and $18
cp $8
jr z, Functione06e4
jp Functione07db
Functione06d8: ; e06d8
ld a, [CurEnemyMoveNum]
and $18
cp $10
jr z, Functione06e4
jp Functione07db
Functione06e4: ; e06e4
ld c, $9
ld de, SFX_2ND_PLACE
jp Functione07eb
; e06ec
Functione06ec: ; e06ec
ld a, [CurEnemyMoveNum]
and $3
jr z, Functione071a
jp Functione07db
Functione06f6: ; e06f6
ld a, [CurEnemyMoveNum]
and $3
cp $1
jr z, Functione071a
jp Functione07db
Functione0702: ; e0702
ld a, [CurEnemyMoveNum]
and $3
cp $2
jr z, Functione071a
jp Functione07db
Functione070e: ; e070e
ld a, [CurEnemyMoveNum]
and $3
cp $3
jr z, Functione071a
jp Functione07db
Functione071a: ; e071a
ld c, $c
ld de, SFX_2ND_PLACE
jp Functione07eb
; e0722
Functione0722: ; e0722
ld a, [CurEnemyMoveNum]
and $1c
jr z, Functione0768
jp Functione07db
Functione072c: ; e072c
ld a, [CurEnemyMoveNum]
and $1c
cp $4
jr z, Functione0768
jp Functione07db
Functione0738: ; e0738
ld a, [CurEnemyMoveNum]
and $1c
cp $8
jr z, Functione0768
jp Functione07db
Functione0744: ; e0744
ld a, [CurEnemyMoveNum]
and $1c
cp $c
jr z, Functione0768
jp Functione07db
Functione0750: ; e0750
ld a, [CurEnemyMoveNum]
and $1c
cp $10
jr z, Functione0768
jp Functione07db
Functione075c: ; e075c
ld a, [CurEnemyMoveNum]
and $1c
cp $14
jr z, Functione0768
jp Functione07db
Functione0768: ; e0768
ld c, $12
ld de, SFX_2ND_PLACE
jp Functione07eb
; e0770
Functione0770: ; e0770
ld e, $0
jr Functione07ce
Functione0774: ; e0774
ld e, $1
jr Functione07ce
Functione0778: ; e0778
ld e, $2
jr Functione07ce
Functione077c: ; e077c
ld e, $3
jr Functione07ce
Functione0780: ; e0780
ld e, $4
jr Functione07ce
Functione0784: ; e0784
ld e, $5
jr Functione07ce
Functione0788: ; e0788
ld e, $6
jr Functione07ce
Functione078c: ; e078c
ld e, $7
jr Functione07ce
Functione0790: ; e0790
ld e, $8
jr Functione07ce
Functione0794: ; e0794
ld e, $9
jr Functione07ce
Functione0798: ; e0798
ld e, $a
jr Functione07ce
Functione079c: ; e079c
ld e, $b
jr Functione07ce
Functione07a0: ; e07a0
ld e, $c
jr Functione07ce
Functione07a4: ; e07a4
ld e, $d
jr Functione07ce
Functione07a8: ; e07a8
ld e, $e
jr Functione07ce
Functione07ac: ; e07ac
ld e, $f
jr Functione07ce
Functione07b0: ; e07b0
ld e, $10
jr Functione07ce
Functione07b4: ; e07b4
ld e, $11
jr Functione07ce
Functione07b8: ; e07b8
ld e, $12
jr Functione07ce
Functione07bc: ; e07bc
ld e, $13
jr Functione07ce
Functione07c0: ; e07c0
ld e, $14
jr Functione07ce
Functione07c4: ; e07c4
ld e, $15
jr Functione07ce
Functione07c8: ; e07c8
ld e, $16
jr Functione07ce
Functione07cc: ; e07cc
ld e, $17
Functione07ce: ; e07ce
ld a, [CurEnemyMoveNum]
cp e
jr nz, Functione07db
ld c, $48
ld de, SFX_2ND_PLACE
jr Functione07eb
Functione07db: ; e07db
ld de, SFX_WRONG
call PlaySFX
ld hl, UnknownText_0xe0816
call Functione0489
call WaitSFX
ret
Functione07eb: ; e07eb
push bc
push de
ld hl, UnknownText_0xe0811
call Functione0489
pop de
call PlaySFX
call WaitSFX
pop bc
.asm_e07fb
push bc
call Functione0833
jr c, .asm_e0804
call Functione081b
.asm_e0804
call Functione049c
ld c, $2
call DelayFrames
pop bc
dec c
jr nz, .asm_e07fb
ret
; e0811
UnknownText_0xe0811: ; 0xe0811
; Yeah!
text_jump UnknownText_0x1c5813
db "@"
; 0xe0816
UnknownText_0xe0816: ; 0xe0816
; Darn…
text_jump UnknownText_0x1c581a
db "@"
; 0xe081b
Functione081b: ; e081b
ld a, [Coins]
ld h, a
ld a, [Coins + 1]
ld l, a
inc hl
ld a, h
ld [Coins], a
ld a, l
ld [Coins + 1], a
ld de, SFX_PAY_DAY
call PlaySFX
ret
; e0833
Functione0833: ; e0833
ld a, [Coins]
cp 9999 / $100
jr c, .asm_e0847
jr z, .asm_e083e
jr .asm_e0845
.asm_e083e
ld a, [Coins + 1]
cp 9999 % $100
jr c, .asm_e0847
.asm_e0845
scf
ret
.asm_e0847
and a
ret
; e0849
Functione0849: ; e0849
call Functione03ac
ld hl, Unknown_e0853
call Functione0509
ret
; e0853
Unknown_e0853: ; e0853
db 18
db $00, $00, $04, $00
db $00, $08, $06, $00
db $00, $10, $06, $00
db $00, $18, $06, $00
db $00, $20, $04, $20
db $08, $00, $05, $00
db $08, $20, $05, $20
db $10, $00, $05, $00
db $10, $20, $05, $20
db $18, $00, $05, $00
db $18, $20, $05, $20
db $20, $00, $05, $00
db $20, $20, $05, $20
db $28, $00, $04, $40
db $28, $08, $06, $40
db $28, $10, $06, $40
db $28, $18, $06, $40
db $28, $20, $04, $60
; e089c
Functione089c: ; e089c
ld hl, $ffa9
ld a, [hl]
and D_LEFT
jp nz, Functione08b8
ld a, [hl]
and D_RIGHT
jp nz, Functione08ef
ld a, [hl]
and D_UP
jp nz, Functione090a
ld a, [hl]
and D_DOWN
jp nz, Functione093d
ret
; e08b8
Functione08b8: ; e08b8
ld hl, $cf65
ld a, [$cf64]
and a
jr z, .asm_e08d5
cp $1
jr z, .asm_e08cc
ld a, [hl]
and a
ret z
dec [hl]
jp Functione0959
.asm_e08cc
ld a, [hl]
cp $3
jr c, .asm_e08e2
dec [hl]
jp Functione0959
.asm_e08d5
ld a, [hl]
and $e
ld [hl], a
cp $3
jr c, .asm_e08e2
dec [hl]
dec [hl]
jp Functione0959
.asm_e08e2
ld a, $2
ld [$cf64], a
ld a, $1
ld [$cf65], a
jp Functione0959
; e08ef
Functione08ef: ; e08ef
ld hl, $cf65
ld a, [$cf64]
and a
jr z, .asm_e08ff
ld a, [hl]
cp $5
ret nc
inc [hl]
jr Functione0959
.asm_e08ff
ld a, [hl]
and $e
ld [hl], a
cp $4
ret nc
inc [hl]
inc [hl]
jr Functione0959
Functione090a: ; e090a
ld hl, $cf64
ld a, [$cf65]
and a
jr z, .asm_e0925
cp $1
jr z, .asm_e091d
ld a, [hl]
and a
ret z
dec [hl]
jr Functione0959
.asm_e091d
ld a, [hl]
cp $3
jr c, .asm_e0931
dec [hl]
jr Functione0959
.asm_e0925
ld a, [hl]
and $e
ld [hl], a
cp $3
jr c, .asm_e0931
dec [hl]
dec [hl]
jr Functione0959
.asm_e0931
ld a, $1
ld [$cf64], a
ld a, $2
ld [$cf65], a
jr Functione0959
Functione093d: ; e093d
ld hl, $cf64
ld a, [$cf65]
and a
jr z, .asm_e0950
ld hl, $cf64
ld a, [hl]
cp $7
ret nc
inc [hl]
jr Functione0959
.asm_e0950
ld a, [hl]
and $e
ld [hl], a
cp $6
ret nc
inc [hl]
inc [hl]
Functione0959: ; e0959
ld de, SFX_POKEBALLS_PLACED_ON_TABLE
call PlaySFX
ret
; e0960
Functione0960: ; e0960
call ClearSprites
ld a, [hCGB]
and a
jr nz, .asm_e096d
ld a, [$ff9b]
and $4
ret nz
.asm_e096d
call Functione0398
add hl, hl
add hl, hl
ld de, Unknown_e0981
add hl, de
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, [hli]
ld h, [hl]
ld l, a
call Functione0509
ret
; e0981
Unknown_e0981: ; e0981
dbbw $58, $10, Unknown_e0c26
dbbw $60, $10, Unknown_e0c26
dbbw $68, $10, Unknown_e0b8d
dbbw $68, $10, Unknown_e0b8d
dbbw $88, $10, Unknown_e0b8d
dbbw $88, $10, Unknown_e0b8d
dbbw $58, $18, Unknown_e0c26
dbbw $60, $18, Unknown_e0c26
dbbw $68, $18, Unknown_e0a5a
dbbw $78, $18, Unknown_e0a5a
dbbw $88, $18, Unknown_e0a5a
dbbw $98, $18, Unknown_e0a5a
dbbw $58, $28, Unknown_e0b14
dbbw $60, $28, Unknown_e0ac3
dbbw $68, $28, Unknown_e0a41
dbbw $78, $28, Unknown_e0a41
dbbw $88, $28, Unknown_e0a41
dbbw $98, $28, Unknown_e0a41
dbbw $58, $28, Unknown_e0b14
dbbw $60, $34, Unknown_e0ac3
dbbw $68, $34, Unknown_e0a41
dbbw $78, $34, Unknown_e0a41
dbbw $88, $34, Unknown_e0a41
dbbw $98, $34, Unknown_e0a41
dbbw $58, $40, Unknown_e0b14
dbbw $60, $40, Unknown_e0ac3
dbbw $68, $40, Unknown_e0a41
dbbw $78, $40, Unknown_e0a41
dbbw $88, $40, Unknown_e0a41
dbbw $98, $40, Unknown_e0a41
dbbw $58, $40, Unknown_e0b14
dbbw $60, $4c, Unknown_e0ac3
dbbw $68, $4c, Unknown_e0a41
dbbw $78, $4c, Unknown_e0a41
dbbw $88, $4c, Unknown_e0a41
dbbw $98, $4c, Unknown_e0a41
dbbw $58, $58, Unknown_e0b14
dbbw $60, $58, Unknown_e0ac3
dbbw $68, $58, Unknown_e0a41
dbbw $78, $58, Unknown_e0a41
dbbw $88, $58, Unknown_e0a41
dbbw $98, $58, Unknown_e0a41
dbbw $58, $58, Unknown_e0b14
dbbw $60, $64, Unknown_e0ac3
dbbw $68, $64, Unknown_e0a41
dbbw $78, $64, Unknown_e0a41
dbbw $88, $64, Unknown_e0a41
dbbw $98, $64, Unknown_e0a41
; e0a41
Unknown_e0a41: ; e0a41
db 6
db $00, $ff, $00, $80
db $00, $00, $02, $80
db $00, $08, $03, $80
db $05, $ff, $00, $c0
db $05, $00, $02, $c0
db $05, $08, $03, $80
Unknown_e0a5a: ; e0a5a
db 26
db $00, $ff, $00, $80
db $00, $00, $02, $80
db $00, $08, $00, $a0
db $08, $ff, $01, $80
db $08, $08, $01, $a0
db $10, $ff, $01, $80
db $10, $08, $03, $80
db $18, $ff, $01, $80
db $18, $08, $03, $80
db $20, $ff, $01, $80
db $20, $08, $03, $80
db $28, $ff, $01, $80
db $28, $08, $03, $80
db $30, $ff, $01, $80
db $30, $08, $03, $80
db $38, $ff, $01, $80
db $38, $08, $03, $80
db $40, $ff, $01, $80
db $40, $08, $03, $80
db $48, $ff, $01, $80
db $48, $08, $03, $80
db $50, $ff, $01, $80
db $50, $08, $03, $80
db $51, $ff, $00, $c0
db $51, $00, $02, $c0
db $51, $08, $03, $80
Unknown_e0ac3: ; e0ac3
db 20
db $00, $ff, $00, $80
db $00, $00, $02, $80
db $00, $08, $02, $80
db $00, $10, $03, $80
db $00, $18, $02, $80
db $00, $20, $03, $80
db $00, $28, $02, $80
db $00, $30, $03, $80
db $00, $38, $02, $80
db $00, $40, $03, $80
db $05, $ff, $00, $c0
db $05, $00, $02, $c0
db $05, $08, $02, $c0
db $05, $10, $03, $80
db $05, $18, $02, $c0
db $05, $20, $03, $80
db $05, $28, $02, $c0
db $05, $30, $03, $80
db $05, $38, $02, $c0
db $05, $40, $03, $80
Unknown_e0b14: ; e0b14
db 30
db $00, $00, $00, $80
db $00, $08, $02, $80
db $00, $10, $02, $80
db $00, $18, $03, $80
db $00, $20, $02, $80
db $00, $28, $03, $80
db $00, $30, $02, $80
db $00, $38, $03, $80
db $00, $40, $02, $80
db $00, $48, $03, $80
db $08, $00, $01, $80
db $08, $18, $03, $80
db $08, $28, $03, $80
db $08, $38, $03, $80
db $08, $48, $03, $80
db $10, $00, $01, $80
db $10, $18, $03, $80
db $10, $28, $03, $80
db $10, $38, $03, $80
db $10, $48, $03, $80
db $11, $00, $00, $c0
db $11, $08, $02, $c0
db $11, $10, $02, $c0
db $11, $18, $03, $80
db $11, $20, $03, $80
db $11, $28, $03, $80
db $11, $30, $03, $80
db $11, $38, $03, $80
db $11, $40, $03, $80
db $11, $48, $03, $80
Unknown_e0b8d: ; e0b8d
db 38
db $00, $ff, $00, $80
db $00, $18, $00, $a0
db $08, $ff, $01, $80
db $08, $18, $01, $a0
db $10, $ff, $01, $80
db $10, $18, $01, $a0
db $18, $ff, $01, $80
db $18, $08, $03, $80
db $18, $18, $03, $80
db $20, $ff, $01, $80
db $20, $08, $03, $80
db $20, $18, $03, $80
db $28, $ff, $01, $80
db $28, $08, $03, $80
db $28, $18, $03, $80
db $30, $ff, $01, $80
db $30, $08, $03, $80
db $30, $18, $03, $80
db $38, $ff, $01, $80
db $38, $08, $03, $80
db $38, $18, $03, $80
db $40, $ff, $01, $80
db $40, $08, $03, $80
db $40, $18, $03, $80
db $48, $ff, $01, $80
db $48, $08, $03, $80
db $48, $18, $03, $80
db $50, $ff, $01, $80
db $50, $08, $03, $80
db $50, $18, $03, $80
db $58, $ff, $01, $80
db $58, $08, $03, $80
db $58, $18, $03, $80
db $59, $ff, $00, $c0
db $59, $00, $02, $c0
db $59, $08, $03, $c0
db $59, $10, $02, $c0
db $59, $18, $03, $e0
Unknown_e0c26: ; e0c26
db 4
db $00, $00, $00, $80
db $00, $08, $00, $a0
db $08, $00, $00, $c0
db $08, $08, $00, $e0
; e0c37
Functione0c37: ; e0c37 (38:4c37)
ld a, [hCGB] ; $ff00+$e6
and a
ret z
ld hl, AttrMap ; $cdd9
ld bc, $168
xor a
call ByteFill
ld hl, $cdf9
ld bc, $202
ld a, $1
call Functione04e7
ld hl, $cdfb
ld bc, $202
ld a, $2
call Functione04e7
ld hl, $cdfd
ld bc, $202
ld a, $3
call Functione04e7
ld hl, $cdff
ld bc, $202
ld a, $4
call Functione04e7
ld hl, $cde2
ld bc, $c01
ld a, $1
call Functione04e7
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Palette_e0c93
ld de, Unkn1Pals ; $d000
ld bc, $48
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
ret
; e0c93 (38:4c93)
Palette_e0c93: ; e0c93
RGB 31, 31, 31
RGB 17, 07, 31
RGB 06, 19, 08
RGB 00, 00, 00
RGB 31, 31, 31
RGB 29, 25, 00
RGB 06, 19, 08
RGB 00, 00, 00
RGB 31, 31, 31
RGB 31, 13, 30
RGB 06, 19, 08
RGB 00, 00, 00
RGB 31, 31, 31
RGB 08, 17, 30
RGB 06, 19, 08
RGB 00, 00, 00
RGB 31, 31, 31
RGB 08, 31, 08
RGB 06, 19, 08
RGB 00, 00, 00
RGB 31, 31, 31
RGB 17, 07, 31
RGB 06, 19, 08
RGB 00, 00, 00
RGB 31, 31, 31
RGB 17, 07, 31
RGB 06, 19, 08
RGB 00, 00, 00
RGB 31, 31, 31
RGB 17, 07, 31
RGB 06, 19, 08
RGB 00, 00, 00
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 00, 00
RGB 31, 00, 00
; e0cdb
LZ_e0cdb: ; e0cdb
INCBIN "baserom.gbc", $e0cdb, $e0cf6 - $e0cdb
Unknown_e0cf6: ; e0cf6
INCBIN "baserom.gbc", $e0cf6, $e0d06 - $e0cf6
Unknown_e0d06: ; e0d06
INCBIN "baserom.gbc", $e0d06, $e0d16 - $e0d06
LZ_e0d16: ; e0d16
INCBIN "baserom.gbc", $e0d16, $e0ea8 - $e0d16
LZ_e0ea8: ; e0ea8
INCBIN "baserom.gbc", $e0ea8, $e110c - $e0ea8
Unknown_e110c: ; e110c
db $ef, $15, $27, $2a, $2a, $06, $27, $2a, $2a, $06, $27
db $ef, $07, $27, $3e, $3f, $42, $43, $46, $47, $4a, $4b
db $ef, $17, $26, $40, $41, $44, $45, $48, $49, $4c, $4d
db $ef, $25, $04, $00, $01, $00, $01, $00, $01, $00, $01
db $ef, $05, $14, $10, $11, $10, $11, $10, $11, $10, $11
db $ef, $16, $24, $20, $21, $20, $21, $20, $21, $20, $21
db $ef, $25, $04, $00, $02, $00, $02, $00, $02, $00, $02
db $ef, $05, $14, $10, $12, $10, $12, $10, $12, $10, $12
db $ef, $16, $24, $20, $22, $20, $22, $20, $22, $20, $22
db $ef, $25, $04, $00, $03, $00, $03, $00, $03, $00, $03
db $ef, $05, $14, $10, $13, $10, $13, $10, $13, $10, $13
db $ef, $16, $24, $20, $23, $20, $23, $20, $23, $20, $23
; e1190
Functione1190: ; e1190
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
call WhiteBGMap
call ClearTileMap
call ClearSprites
xor a
ld [hBGMapMode], a
call DisableLCD
ld hl, $c608
ld bc, $01e0
xor a
call ByteFill
ld hl, GFX_e17c5
ld de, $8e00
ld bc, $0040
call CopyBytes
ld hl, LZ_e1805
ld de, $8ed0
call Decompress
call Functione17a3
ld hl, TileMap
ld bc, $0168
ld a, $ee
call ByteFill
hlcoord 4, 3
ld bc, $0c0c
ld a, $ef
call Functione13ee
call Functione124e
call Functione13fe
call Functione127d
xor a
ld [hSCY], a
ld [hSCX], a
ld [rWY], a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
ld a, $93
ld [rLCDC], a
call WaitBGMap
ld b, $18
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
ld a, $24
call Functioncf8
xor a
ld [$d0ec], a
call DelayFrame
.asm_e1217
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_e123d
call Functione12ca
ld a, [$cf64]
and a
jr nz, .asm_e1230
ld a, [$ff9b]
and $10
jr z, .asm_e1235
.asm_e1230
call Functione14d9
jr .asm_e1238
.asm_e1235
call ClearSprites
.asm_e1238
call DelayFrame
jr .asm_e1217
.asm_e123d
pop af
ld [$ffaa], a
call WhiteBGMap
call ClearTileMap
call ClearSprites
ld a, $e3
ld [rLCDC], a
ret
; e124e
Functione124e: ; e124e
ld c, $1
ld b, $10
.asm_e1252
call Random
and $f
ld hl, Unknown_e126d
ld e, a
ld d, $0
add hl, de
ld e, [hl]
ld hl, PlayerSDefLevel
add hl, de
ld a, [hl]
and a
jr nz, .asm_e1252
ld [hl], c
inc c
dec b
jr nz, .asm_e1252
ret
; e126d
Unknown_e126d: ; e126d
INCBIN "baserom.gbc",$e126d,$e127d - $e126d
Functione127d: ; e127d
call Functione128d
hlcoord 5, 16
ld a, $f6
ld c, $a
.asm_e1287
ld [hli], a
inc a
dec c
jr nz, .asm_e1287
ret
; e128d
Functione128d: ; e128d
hlcoord 4, 15
ld a, $f0
ld [hli], a
ld bc, $000a
ld a, $f1
call ByteFill
hlcoord 15, 15
ld a, $f2
ld [hli], a
hlcoord 4, 16
ld a, $f3
ld [hli], a
ld bc, $000a
ld a, $ef
call ByteFill
hlcoord 15, 16
ld a, $f3
ld [hli], a
hlcoord 4, 17
ld a, $f4
ld [hli], a
ld bc, $000a
ld a, $f1
call ByteFill
hlcoord 15, 17
ld a, $f5
ld [hl], a
ret
; e12ca
Functione12ca: ; e12ca
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_e12d9
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; e12d9
Jumptable_e12d9: ; e12d9
dw Functione12db
; e12db
Functione12db: ; e12db
ld a, [hJoyPressed]
and $8
jp nz, Functione13de
ld a, [hJoyPressed]
and A_BUTTON
jp nz, Functione1376
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, .asm_e1301
ld a, [hl]
and $80
jr nz, .asm_e130d
ld a, [hl]
and $20
jr nz, .asm_e1325
ld a, [hl]
and $10
jr nz, .asm_e1345
ret
.asm_e1301
ld hl, $cf65
ld a, [hl]
cp $6
ret c
sub $6
ld [hl], a
jr .asm_e1364
.asm_e130d
ld hl, $cf65
ld a, [hl]
cp $19
ret z
cp $1a
ret z
cp $1b
ret z
cp $1c
ret z
cp $1e
ret nc
add $6
ld [hl], a
jr .asm_e1364
.asm_e1325
ld hl, $cf65
ld a, [hl]
and a
ret z
cp $6
ret z
cp $c
ret z
cp $12
ret z
cp $18
ret z
cp $1e
ret z
cp $23
jr z, .asm_e1341
dec [hl]
jr .asm_e1364
.asm_e1341
ld [hl], $1e
jr .asm_e1364
.asm_e1345
ld hl, $cf65
ld a, [hl]
cp $5
ret z
cp $b
ret z
cp $11
ret z
cp $17
ret z
cp $1d
ret z
cp $23
ret z
cp $1e
jr z, .asm_e1362
inc [hl]
jr .asm_e1364
.asm_e1362
ld [hl], $23
.asm_e1364
ld a, [$cf64]
and a
jr nz, .asm_e136f
ld de, SFX_POUND
jr .asm_e1372
.asm_e136f
ld de, SFX_MOVE_PUZZLE_PIECE
.asm_e1372
call PlaySFX
ret
; e1376
Functione1376: ; e1376
ld a, [$cf64]
and a
jr nz, .asm_e139f
call Functione1475
and a
jr z, Functione13e4
ld de, SFX_MEGA_KICK
call PlaySFX
ld [hl], $0
ld [$cf66], a
call Functione14d9
call Functione1441
call WaitBGMap
call WaitSFX
ld a, $1
ld [$cf64], a
ret
.asm_e139f
call Functione1475
and a
jr nz, Functione13e4
ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
call PlaySFX
ld a, [$cf66]
ld [hl], a
call Functione141f
call WaitBGMap
xor a
ld [$cf66], a
call Functione14d9
xor a
ld [$cf64], a
call WaitSFX
call Functione14a0
ret nc
call Functione128d
call ClearSprites
ld de, SFX_1ST_PLACE
call PlaySFX
call WaitSFX
call Functionaa5
ld a, $1
ld [$d0ec], a
Functione13de: ; e13de
ld hl, $cf63
set 7, [hl]
ret
Functione13e4: ; e13e4
ld de, SFX_WRONG
call PlaySFX
call WaitSFX
ret
; e13ee
Functione13ee: ; e13ee
ld de, $0014
.asm_e13f1
push bc
push hl
.asm_e13f3
ld [hli], a
dec c
jr nz, .asm_e13f3
pop hl
add hl, de
pop bc
dec b
jr nz, .asm_e13f1
ret
; e13fe
Functione13fe: ; e13fe
xor a
ld [$cf65], a
ld c, $24
.asm_e1404
push bc
call Functione1475
ld [$cf66], a
and a
jr z, .asm_e1413
call Functione141f
jr .asm_e1416
.asm_e1413
call Functione1441
.asm_e1416
ld hl, $cf65
inc [hl]
pop bc
dec c
jr nz, .asm_e1404
ret
; e141f
Functione141f: ; e141f
ld a, $2
call Functione1463
ld a, [hli]
ld h, [hl]
ld l, a
push hl
call Functione1481
pop hl
ld de, $0014
ld b, $3
.asm_e1431
ld c, $3
push hl
.asm_e1434
ld [hli], a
inc a
dec c
jr nz, .asm_e1434
add $9
pop hl
add hl, de
dec b
jr nz, .asm_e1431
ret
; e1441
Functione1441: ; e1441
ld a, $2
call Functione1463
ld a, [hli]
ld h, [hl]
ld l, a
push hl
ld a, $4
call Functione1463
ld a, [hl]
pop hl
ld de, $0014
ld b, $3
.asm_e1456
ld c, $3
push hl
.asm_e1459
ld [hli], a
dec c
jr nz, .asm_e1459
pop hl
add hl, de
dec b
jr nz, .asm_e1456
ret
; e1463
Functione1463: ; e1463
ld e, a
ld d, 0
ld hl, Unknown_e1559
add hl, de
ld a, [$cf65]
ld e, a
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
add hl, de
ret
; e1475
Functione1475: ; e1475
ld hl, PlayerSDefLevel
ld a, [$cf65]
ld e, a
ld d, $0
add hl, de
ld a, [hl]
ret
; e1481
Functione1481: ; e1481
ld a, [$cf66]
ld hl, Unknown_e148f
add l
ld l, a
ld a, $0
adc h
ld h, a
ld a, [hl]
ret
; e148f
Unknown_e148f: ; e148f
INCBIN "baserom.gbc", $e148f, $e14a0 - $e148f
Functione14a0: ; e14a0
ld hl, Unknown_e14b5
ld de, PlayerSDefLevel
ld c, $24
.asm_e14a8
ld a, [de]
cp [hl]
jr nz, .asm_e14b3
inc de
inc hl
dec c
jr nz, .asm_e14a8
scf
ret
.asm_e14b3
and a
ret
; e14b5
Unknown_e14b5: ; e14b5
INCBIN "baserom.gbc", $e14b5, $e14d9 - $e14b5
Functione14d9: ; e14d9
call Functione1481
ld [DefaultFlypoint], a
xor a
call Functione1463
ld a, [hli]
ld b, [hl]
ld c, a
ld a, [DefaultFlypoint]
cp $e0
jr z, .asm_e14f2
ld hl, Unknown_e150f
jr .asm_e14f5
.asm_e14f2
ld hl, Unknown_e1534
.asm_e14f5
ld de, Sprites
.asm_e14f8
ld a, [hli]
cp $ff
ret z
add b
ld [de], a
inc de
ld a, [hli]
add c
ld [de], a
inc de
ld a, [DefaultFlypoint]
add [hl]
ld [de], a
inc hl
inc de
ld a, [hli]
ld [de], a
inc de
jr .asm_e14f8
; e150f
Unknown_e150f: ; e150f
INCBIN "baserom.gbc",$e150f,$e1534 - $e150f
Unknown_e1534: ; e1534
INCBIN "baserom.gbc",$e1534,$e1559 - $e1534
Unknown_e1559: ; e1559
INCBIN "baserom.gbc",$e1559,$e1631 - $e1559
Functione1631: ; e1631
ld hl, VTiles2
ld de, VTiles0
ld b, $6
.asm_e1639
push bc
push hl
push hl
call Functione1654
pop hl
ld bc, $0008
add hl, bc
call Functione1654
pop hl
ld bc, $0060
add hl, bc
pop bc
dec b
jr nz, .asm_e1639
call Functione16c7
ret
; e1654
Functione1654: ; e1654
ld c, $6
.asm_e1656
push bc
push hl
push hl
ld c, $4
.asm_e165b
push bc
ld a, [hli]
and $f0
swap a
call Functione16aa
ld c, a
ld a, [hli]
and $f0
swap a
call Functione16aa
ld b, a
ld a, c
ld [de], a
inc de
ld a, b
ld [de], a
inc de
ld a, c
ld [de], a
inc de
ld a, b
ld [de], a
inc de
pop bc
dec c
jr nz, .asm_e165b
pop hl
ld c, $4
.asm_e1681
push bc
ld a, [hli]
and $f
call Functione16aa
ld c, a
ld a, [hli]
and $f
call Functione16aa
ld b, a
ld a, c
ld [de], a
inc de
ld a, b
ld [de], a
inc de
ld a, c
ld [de], a
inc de
ld a, b
ld [de], a
inc de
pop bc
dec c
jr nz, .asm_e1681
pop hl
ld bc, $0010
add hl, bc
pop bc
dec c
jr nz, .asm_e1656
ret
; e16aa
Functione16aa: ; e16aa
push hl
ld hl, Unknown_e16b7
add l
ld l, a
ld a, 0
adc h
ld h, a
ld a, [hl]
pop hl
ret
; e16b7
Unknown_e16b7: ; e16b7
db $00, $03, $0c, $0f
db $30, $33, $3c, $3f
db $c0, $c3, $cc, $cf
db $f0, $f3, $fc, $ff
; e16c7
Functione16c7: ; e16c7
ld hl, Unknown_e1703
ld a, $8
.asm_e16cc
push af
push hl
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld h, [hl]
ld l, a
call Functione16e2
pop hl
inc hl
inc hl
inc hl
inc hl
pop af
dec a
jr nz, .asm_e16cc
ret
; e16e2
Functione16e2: ; e16e2
lb bc, 4, 4
.asm_e16e5
push bc
.asm_e16e6
push de
push hl
ld b, $10
.asm_e16ea
ld a, [de]
or [hl]
ld [hli], a
inc de
dec b
jr nz, .asm_e16ea
pop hl
ld de, $0030
add hl, de
pop de
dec c
jr nz, .asm_e16e6
ld bc, $0180
add hl, bc
pop bc
dec b
jr nz, .asm_e16e5
ret
; e1703
Unknown_e1703: ; e1703
dw GFX_e1723 + $00, $8000
dw GFX_e1723 + $10, $8010
dw GFX_e1723 + $20, $8020
dw GFX_e1723 + $30, $80c0
dw GFX_e1723 + $40, $80e0
dw GFX_e1723 + $50, $8180
dw GFX_e1723 + $60, $8190
dw GFX_e1723 + $70, $81a0
; e1723
GFX_e1723: ; e1723
INCBIN "baserom.gbc", $e1723, $e17a3 - $e1723
Functione17a3: ; e17a3
ld a, [ScriptVar]
and 3
ld e, a
ld d, 0
ld hl, Unknown_e17bd
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, VTiles2
call Decompress
call Functione1631
ret
; e17bd
Unknown_e17bd: ; e17bd
dw LZ_e1bab
dw LZ_e1c9b
dw LZ_e19fb
dw LZ_e18ab
; e17c5
GFX_e17c5: ; e17c5
INCBIN "baserom.gbc", $e17c5, $e1805 - $e17c5
LZ_e1805: ; e1805
INCBIN "baserom.gbc", $e1805, $e18ab - $e1805
LZ_e18ab: ; e18ab
INCBIN "baserom.gbc", $e18ab, $e19fb - $e18ab
LZ_e19fb: ; e19fb
INCBIN "baserom.gbc", $e19fb, $e1bab - $e19fb
LZ_e1bab: ; e1bab
INCBIN "baserom.gbc", $e1bab, $e1c9b - $e1bab
LZ_e1c9b: ; e1c9b
INCBIN "baserom.gbc", $e1c9b, $e1e5b - $e1c9b
Functione1e5b: ; e1e5b (38:5e5b)
call Functione1e67
call DelayFrame
.asm_e1e61
call Functione1ebb
jr nc, .asm_e1e61
ret
Functione1e67: ; e1e67 (38:5e67)
call DisableLCD
ld b, $8
call GetSGBLayout
callab Function8cf53
ld hl, LZ_e2221
ld de, $9000
call Decompress
ld hl, Unknown_e00ed
ld de, $8000
ld bc, $40
ld a, BANK(Unknown_e00ed)
call FarCopyBytes
ld a, $8
ld hl, $c300
ld [hli], a
ld [hl], $0
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
xor a
call ByteFill
xor a
ld [hSCY], a ; $ff00+$d0
ld [hSCX], a ; $ff00+$cf
ld [rWY], a ; $ff00+$4a
ld [$cf63], a
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ld a, $e3
ld [rLCDC], a ; $ff00+$40
ld a, $e4
call DmgToCgbBGPals
ld a, $e0
call Functioncf8
ret
Functione1ebb: ; e1ebb (38:5ebb)
ld a, [$cf63]
bit 7, a
jr nz, .asm_e1ed0
call Functione1ed2
callab Function8cf69
call DelayFrame
and a
ret
.asm_e1ed0
scf
ret
Functione1ed2: ; e1ed2 (38:5ed2)
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_e1ee1
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; e1ee1 (38:5ee1)
Jumptable_e1ee1: ; e1ee1
dw Functione1ef3
dw Functione1efb
dw Functione1f1c
dw Functione1f42
dw Functione1f61
dw Functione1f8b
dw Functione1fba
dw Functione1fcc
dw Functione2000
; e1ef3
Functione1ef3: ; e1ef3
call Functione2152
ld hl, $cf63
inc [hl]
ret
; e1efb
Functione1efb: ; e1efb
call Functione00ed
jr nc, .asm_e1f06
ld hl, $cf63
set 7, [hl]
ret
.asm_e1f06
call Functione209d
ld hl, $cf63
inc [hl]
xor a
ld [$c708], a
ld hl, PlayerReflectCount
ld [hli], a
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld [$c709], a
Functione1f1c: ; e1f1c
ld hl, $c708
ld a, [hl]
cp $2d
jr nc, .asm_e1f30
inc [hl]
call Functione2183
xor a
ld [$c6fd], a
call Functione2128
ret
.asm_e1f30
ld de, $341c
ld a, $c
call Function3b2a
ld a, $5
ld [PlayerLightScreenCount], a
ld hl, $cf63
inc [hl]
ret
; e1f42
Functione1f42: ; e1f42
ld a, [PlayerLightScreenCount]
hlcoord 17, 0
add $f6
ld [hl], a
ld hl, PlayerLightScreenCount
ld a, [hl]
and a
jr nz, .asm_e1f58
ld a, $7
ld [$cf63], a
ret
.asm_e1f58
dec [hl]
xor a
ld [$cf64], a
ld hl, $cf63
inc [hl]
Functione1f61: ; e1f61
ld a, [$cf64]
and a
ret z
dec a
ld e, a
ld d, $0
ld hl, PlayerSDefLevel
add hl, de
ld a, [hl]
cp $ff
ret z
ld [$c6fd], a
ld [$c6fe], a
ld a, e
ld [EnemyScreens], a
call Functione2183
call Functione2128
xor a
ld [$cf64], a
ld hl, $cf63
inc [hl]
ret
; e1f8b
Functione1f8b: ; e1f8b
ld a, [$cf64]
and a
ret z
dec a
ld hl, EnemyScreens
cp [hl]
ret z
ld e, a
ld d, $0
ld hl, PlayerSDefLevel
add hl, de
ld a, [hl]
cp $ff
ret z
ld [$c6fd], a
ld [PlayerScreens], a
ld a, e
ld [$c701], a
call Functione2183
call Functione2128
ld a, $40
ld [$c708], a
ld hl, $cf63
inc [hl]
Functione1fba: ; e1fba
ld hl, $c708
ld a, [hl]
and a
jr z, .asm_e1fc3
dec [hl]
ret
.asm_e1fc3
call Functione2010
ld a, $3
ld [$cf63], a
ret
; e1fcc
Functione1fcc: ; e1fcc
ld a, [hJoypadPressed]
and A_BUTTON
ret z
xor a
ld [$c708], a
.asm_e1fd5
ld hl, $c708
ld a, [hl]
cp $2d
jr nc, .asm_e1ff9
inc [hl]
push af
call Functione2183
pop af
push hl
ld e, a
ld d, $0
ld hl, PlayerSDefLevel
add hl, de
ld a, [hl]
pop hl
cp $ff
jr z, .asm_e1fd5
ld [$c6fd], a
call Functione2128
jr .asm_e1fd5
.asm_e1ff9
call Functiona80
ld hl, $cf63
inc [hl]
Functione2000: ; e2000
call Functione00ed
jr nc, .asm_e200b
ld hl, $cf63
set 7, [hl]
ret
.asm_e200b
xor a
ld [$cf63], a
ret
; e2010
Functione2010: ; e2010
ld hl, $c6fe
ld a, [hli]
cp [hl]
jr nz, .asm_e2066
ld a, [EnemyScreens]
call Functione2183
call Functione2142
ld a, [$c701]
call Functione2183
call Functione2142
ld a, [EnemyScreens]
ld e, a
ld d, $0
ld hl, PlayerSDefLevel
add hl, de
ld [hl], $ff
ld a, [$c701]
ld e, a
ld d, $0
ld hl, PlayerSDefLevel
add hl, de
ld [hl], $ff
ld hl, PlayerReflectCount
.asm_e2044
ld a, [hli]
and a
jr nz, .asm_e2044
dec hl
ld a, [$c6fe]
ld [hl], a
ld [$c6fd], a
ld hl, $c709
ld e, [hl]
inc [hl]
inc [hl]
ld d, $0
hlcoord 5, 0
add hl, de
call Functione2128
ld hl, UnknownText_0xe2083
call PrintText
ret
.asm_e2066
xor a
ld [$c6fd], a
ld a, [EnemyScreens]
call Functione2183
call Functione2128
ld a, [$c701]
call Functione2183
call Functione2128
ld hl, UnknownText_0xe2098
call PrintText
ret
; e2083
UnknownText_0xe2083: ; 0xe2083
start_asm
; 0xe2084
Functione2084: ; e2084
push bc
hlcoord 2, 13
call Functione2128
ld hl, UnknownText_0xe2093
pop bc
inc bc
inc bc
inc bc
ret
; e2093
UnknownText_0xe2093: ; 0xe2093
; , yeah!
text_jump UnknownText_0x1c1a5b
db "@"
; 0xe2098
UnknownText_0xe2098: ; 0xe2098
; Darn…
text_jump UnknownText_0x1c1a65
db "@"
; 0xe209d
Functione209d: ; e209d
ld hl, PlayerSDefLevel
ld bc, $002d
xor a
call ByteFill
call Functione2101
ld c, $2
ld b, [hl]
call Functione20e5
ld c, $8
ld b, [hl]
call Functione20e5
ld c, $4
ld b, [hl]
call Functione20e5
ld c, $7
ld b, [hl]
call Functione20e5
ld c, $3
ld b, [hl]
call Functione20e5
ld c, $6
ld b, [hl]
call Functione20e5
ld c, $1
ld b, [hl]
call Functione20e5
ld c, $5
ld hl, PlayerSDefLevel
ld b, $2d
.asm_e20db
ld a, [hl]
and a
jr nz, .asm_e20e0
ld [hl], c
.asm_e20e0
inc hl
dec b
jr nz, .asm_e20db
ret
; e20e5
Functione20e5: ; e20e5
push hl
ld de, PlayerSDefLevel
.asm_e20e9
call Random
and $3f
cp $2d
jr nc, .asm_e20e9
ld l, a
ld h, $0
add hl, de
ld a, [hl]
and a
jr nz, .asm_e20e9
ld [hl], c
dec b
jr nz, .asm_e20e9
pop hl
inc hl
ret
; e2101
Functione2101: ; e2101
ld a, [$cfa9]
dec a
ld l, a
ld h, 0
add hl, hl
add hl, hl
add hl, hl
ld de, Unknown_e2110
add hl, de
ret
; e2110
Unknown_e2110: ; e2110
db $02, $03, $06, $06, $06, $08, $08, $06
db $02, $02, $04, $06, $06, $08, $08, $09
db $02, $02, $02, $04, $07, $08, $08, $0c
; e2128
Functione2128: ; e2128
ld a, [$c6fd]
sla a
sla a
add $4
ld [hli], a
inc a
ld [hld], a
inc a
ld bc, $0014
add hl, bc
ld [hli], a
inc a
ld [hl], a
ld c, $3
call DelayFrames
ret
; e2142
Functione2142: ; e2142
ld a, $1
ld [hli], a
ld [hld], a
ld bc, $0014
add hl, bc
ld [hli], a
ld [hl], a
ld c, $3
call DelayFrames
ret
; e2152
Functione2152: ; e2152
ld hl, TileMap
ld bc, $0168
ld a, $1
call ByteFill
ld hl, TileMap
ld de, String_e2177
call PlaceString
hlcoord 15, 0
ld de, String_e217d
call PlaceString
ld hl, UnknownText_0xe2176
call PrintText
ret
; e2176
UnknownText_0xe2176: ; 0xe2176
db "@"
; 0xe2177
String_e2177: db "とったもの@"
String_e217d: db "あと かい@"
; e2183
Functione2183: ; e2183
ld d, $0
.asm_e2185
sub $9
jr c, .asm_e218c
inc d
jr .asm_e2185
.asm_e218c
add $9
ld e, a
hlcoord 1, 2
ld bc, $0028
.asm_e2195
ld a, d
and a
jr z, .asm_e219d
add hl, bc
dec d
jr .asm_e2195
.asm_e219d
sla e
add hl, de
ret
; e21a1
Functione21a1: ; e21a1 (38:61a1)
ld a, [$cf63]
cp $7
jr nc, .asm_e21c8
call Functiona57
ld hl, hJoypadPressed ; $ffa3
ld a, [hl]
and A_BUTTON
jr nz, .asm_e21cf
ld a, [hl]
and D_LEFT
jr nz, .asm_e21d9
ld a, [hl]
and D_RIGHT
jr nz, .asm_e21e9
ld a, [hl]
and D_UP
jr nz, .asm_e21fa
ld a, [hl]
and D_DOWN
jr nz, .asm_e220d
ret
.asm_e21c8
ld hl, $0
add hl, bc
ld [hl], $0
ret
.asm_e21cf
ld hl, $c
add hl, bc
ld a, [hl]
inc a
ld [$cf64], a
ret
.asm_e21d9
ld hl, $6
add hl, bc
ld a, [hl]
and a
ret z
sub $10
ld [hl], a
ld hl, $c
add hl, bc
dec [hl]
ret
.asm_e21e9
ld hl, $6
add hl, bc
ld a, [hl]
cp $80
ret z
add $10
ld [hl], a
ld hl, $c
add hl, bc
inc [hl]
ret
.asm_e21fa
ld hl, $7
add hl, bc
ld a, [hl]
and a
ret z
sub $10
ld [hl], a
ld hl, $c
add hl, bc
ld a, [hl]
sub $9
ld [hl], a
ret
.asm_e220d
ld hl, $7
add hl, bc
ld a, [hl]
cp $40
ret z
add $10
ld [hl], a
ld hl, $c
add hl, bc
ld a, [hl]
add $9
ld [hl], a
ret
; e2221 (38:6221)
LZ_e2221: ; e2221
INCBIN "baserom.gbc",$e2221,$e2391 - $e2221
Functione2391: ; e2391 (38:6391)
ld hl, Options ; $cfcc
ld a, [hl]
push af
set 4, [hl]
ld a, [VramState] ; $d0ed
push af
xor a
ld [VramState], a ; $d0ed
ld a, [$FF00+$aa]
push af
ld a, $1
ld [$FF00+$aa], a
xor a
ld [$FF00+$de], a
call Functione2963
xor a
ld [$cb2e], a
call DelayFrame
.asm_e23b4
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_e23c6
call Functione23d5
call DelayFrame
jr .asm_e23b4
.asm_e23c6
call ClearSprites
pop af
ld [$FF00+$aa], a
pop af
ld [VramState], a ; $d0ed
pop af
ld [Options], a ; $cfcc
ret
Functione23d5: ; e23d5 (38:63d5)
ld a, [$cf63]
ld hl, Jumptable_e23df
call Functione33df
jp [hl]
Jumptable_e23df: ; e23df (38:63df)
dw Functione23e9
dw Functione241a
dw Functione245d
dw Functione247d
dw Functione2992
Functione23e9: ; e23e9 (38:63e9)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call ClearSprites
call Functione2d30
call Functione2a8e
ld de, String_e34dd
call Functione2a6e
ld a, $5
ld [$cb2d], a
call Functione2c2c
call PCMonInfo
ld a, $ff
ld [CurPartySpecies], a ; $d108
ld a, $17
call Functione33d0
call WaitBGMap
call Functione2e01
call Functione298d
ret
Functione241a: ; e241a (38:641a)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and B_BUTTON
jr nz, .asm_e2457
ld a, [hl]
and A_BUTTON
jr nz, .asm_e2443
call Functione29b5
and a
ret z
call Functione2e01
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Functione2c2c
call PCMonInfo
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
ret
.asm_e2443
call Functione2def
and a
ret z
cp $ff
jr z, .asm_e2457
ld a, $2
ld [$cf63], a
ret
; e2452 (38:6452)
.asm_e2452
ld hl, $cf63
dec [hl]
ret
.asm_e2457
ld a, $4
ld [$cf63], a
ret
Functione245d: ; e245d (38:645d)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call ClearSprites
call Functione2def
ld [CurPartySpecies], a ; $d108
ld a, $17
call Functione33d0
ld de, String_e34ea
call Functione2a6e
ld a, $1
ld [$cfa9], a
call Functione298d
ret
Functione247d: ; e247d (38:647d)
ld hl, BillsPCDepositMenuDataHeader
call Function1d3c
ld a, [$cfa9]
call Function1d4b
call Function1d81
jp c, BillsPCDepositFuncCancel
ld a, [$cfa9]
dec a
and $3
ld e, a
ld d, 0
ld hl, BillsPCDepositJumptable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
BillsPCDepositJumptable: ; e24a1 (38:64a1)
dw BillsPCDepositFuncDeposit ; Deposit Pokemon
dw BillsPCDepositFuncStats ; Pokemon Stats
dw BillsPCDepositFuncRelease ; Release Pokemon
dw BillsPCDepositFuncCancel ; Cancel
BillsPCDepositFuncDeposit: ; e24a9 (38:64a9)
call Functione2f18
jp c, BillsPCDepositFuncCancel
call Functione307c
jr c, .asm_e24c1
ld a, $0
ld [$cf63], a
xor a
ld [$cb2b], a
ld [$cb2a], a
ret
.asm_e24c1
ld de, String_e34ea
call Functione2a6e
ret
BillsPCDepositFuncStats: ; e24c8 (38:64c8)
call Function1d6e
call Functione2f7e
call Function1c07
call PCMonInfo
call Functione2def
ld [CurPartySpecies], a ; $d108
ld a, $17
call Functione33d0
ret
BillsPCDepositFuncRelease: ; e24e0 (38:64e0)
call Functione2f18
jr c, BillsPCDepositFuncCancel
call Functione2f5f
jr c, BillsPCDepositFuncCancel
ld a, [$cfa9]
push af
ld de, String_e34f4
call Functione2a6e
call Function1d6e
lb bc, 14, 11
call PlaceYesNoBox
ld a, [$cfa9]
dec a
call Function1c07
and a
jr nz, .asm_e252c
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld [CurPartyMon], a ; $d109
xor a
ld [$d10b], a
callba Functione039
call Functione3180
ld a, $0
ld [$cf63], a
xor a
ld [$cb2b], a
ld [$cb2a], a
pop af
ret
.asm_e252c
ld de, String_e34ea
call Functione2a6e
pop af
ld [$cfa9], a
ret
BillsPCDepositFuncCancel: ; e2537 (38:6537)
ld a, $0
ld [$cf63], a
ret
; e253d (38:653d)
BillsPCDepositMenuDataHeader: ; 0xe253d (38:653d)
db $40 ; flags
db 04, 09 ; start coords
db 13, 19 ; end coords
dw BillsPCDepositMenuData
db 1 ; default option
; 0xe2545
BillsPCDepositMenuData: ; 0xe2545 (38:6545)
db $80 ; flags
db 4 ; items
db "DEPOSIT@"
db "STATS@"
db "RELEASE@"
db "CANCEL@"
; 0xe2564 (38:6564)
Functione2564: ; e2564
ld hl, TileMap
ld b, $4
ld c, $8
call ClearBox
hlcoord 0, 4
ld b, $a
ld c, $9
call ClearBox
hlcoord 0, 14
ld b, $2
ld c, $8
call ClearBox
ret
; e2583
Functione2583: ; e2583 (38:6583)
ld hl, Options ; $cfcc
ld a, [hl]
push af
set 4, [hl]
ld a, [VramState] ; $d0ed
push af
xor a
ld [VramState], a ; $d0ed
ld a, [$FF00+$aa]
push af
ld a, $1
ld [$FF00+$aa], a
xor a
ld [$FF00+$de], a
call Functione2963
ld a, $f
ld [$cb2e], a
call DelayFrame
.asm_e25a7
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_e25b9
call Functione25c8
call DelayFrame
jr .asm_e25a7
.asm_e25b9
call ClearSprites
pop af
ld [$FF00+$aa], a
pop af
ld [VramState], a ; $d0ed
pop af
ld [Options], a ; $cfcc
ret
Functione25c8: ; e25c8 (38:65c8)
ld a, [$cf63]
ld hl, Jumptable_e25d2
call Functione33df
jp [hl]
Jumptable_e25d2: ; e25d2 (38:65d2)
dw Functione25dc
dw Functione2612
dw Functione2655
dw Functione2675
dw Functione2992
Functione25dc: ; e25dc (38:65dc)
ld a, $f
ld [$cb2e], a
xor a
ld [hBGMapMode], a ; $ff00+$d4
call ClearSprites
call Functione2d30
call Functione2a8e
ld de, String_e34dd
call Functione2a6e
ld a, $5
ld [$cb2d], a
call Functione2c2c
call PCMonInfo
ld a, $ff
ld [CurPartySpecies], a ; $d108
ld a, $17
call Functione33d0
call WaitBGMap
call Functione2e01
call Functione298d
ret
Functione2612: ; e2612 (38:6612)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and B_BUTTON
jr nz, .asm_e264f
ld a, [hl]
and A_BUTTON
jr nz, .asm_e263b
call Functione29b5
and a
ret z
call Functione2e01
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Functione2c2c
call PCMonInfo
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
ret
.asm_e263b
call Functione2def
and a
ret z
cp $ff
jr z, .asm_e264f
ld a, $2
ld [$cf63], a
ret
; e264a (38:664a)
.asm_e264a
ld hl, $cf63
dec [hl]
ret
.asm_e264f
ld a, $4
ld [$cf63], a
ret
; e2655
Functione2655: ; e2655 (38:6655)
xor a
ld [hBGMapMode], a ; $ff00+$d4
call ClearSprites
call Functione2def
ld [CurPartySpecies], a ; $d108
ld a, $17
call Functione33d0
ld de, String_e34ea
call Functione2a6e
ld a, $1
ld [$cfa9], a
call Functione298d
ret
Functione2675: ; e2675 (38:6675)
ld hl, BillsPCWithdrawMenuDataHeader
call Function1d3c
ld a, [$cfa9]
call Function1d4b
call Function1d81
jp c, BillsPCWithdrawFuncCancel
ld a, [$cfa9]
dec a
and 3
ld e, a
ld d, 0
ld hl, BillsPCWithdrawJumptable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
BillsPCWithdrawJumptable: ; e2699 (38:6699) #mark
dw BillsPCWithdrawFuncWithdraw ; Withdraw
dw BillsPCWithdrawFuncStats ; Stats
dw BillsPCWithdrawFuncRelease ; Release
dw BillsPCWithdrawFuncCancel ; Cancel
BillsPCWithdrawFuncWithdraw: ; e26a1 (38:66a1)
call Functione2f18
jp c, BillsPCWithdrawFuncCancel
call Functione30fa
jr c, .asm_e26b9
ld a, $0
ld [$cf63], a
xor a
ld [$cb2b], a
ld [$cb2a], a
ret
.asm_e26b9
ld de, String_e34ea
call Functione2a6e
ret
BillsPCWithdrawFuncStats: ; e26c0 (38:66c0)
call Function1d6e
call Functione2f7e
call Function1c07
call PCMonInfo
call Functione2def
ld [CurPartySpecies], a ; $d108
ld a, $17
call Functione33d0
ret
BillsPCWithdrawFuncRelease: ; e26d8 (38:66d8)
ld a, [$cfa9]
push af
call Functione2f5f
jr c, .asm_e2720
ld de, String_e34f4
call Functione2a6e
call Function1d6e
lb bc, 14, 11
call PlaceYesNoBox
ld a, [$cfa9]
dec a
call Function1c07
and a
jr nz, .asm_e2720
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld [CurPartyMon], a ; $d109
ld a, $1
ld [$d10b], a
callba Functione039
call Functione3180
ld a, $0
ld [$cf63], a
xor a
ld [$cb2b], a
ld [$cb2a], a
pop af
ret
.asm_e2720
ld de, String_e34ea
call Functione2a6e
pop af
ld [$cfa9], a
ret
BillsPCWithdrawFuncCancel: ; e272b (38:672b)
ld a, $0
ld [$cf63], a
ret
; e2731 (38:6731)
BillsPCWithdrawMenuDataHeader: ; 0xe2731
db $40 ; flags
db 04, 09 ; start coords
db 13, 19 ; end coords
dw BillsPCWithdrawMenuData
db 1 ; default option
; 0xe2739
BillsPCWithdrawMenuData: ; 0xe2739
db $80 ; flags
db 4 ; items
db "WITHDRAW@"
db "STATS@"
db "RELEASE@"
db "CANCEL@"
; 0xe2759
Functione2759: ; e2759
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
ld a, [VramState]
push af
xor a
ld [VramState], a
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
xor a
ld [$ffde], a
call Functione2963
ld a, [wCurBox]
and $f
inc a
ld [$cb2e], a
call DelayFrame
.asm_e2781
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_e2793
call Functione27a2
call DelayFrame
jr .asm_e2781
.asm_e2793
call ClearSprites
pop af
ld [$ffaa], a
pop af
ld [VramState], a
pop af
ld [Options], a
ret
; e27a2
Functione27a2: ; e27a2
ld a, [$cf63]
ld hl, Jumptable_e27ac
call Functione33df
jp [hl]
; e27ac
Jumptable_e27ac: ; e27ac
dw Functione27ba
dw Functione27eb
dw Functione283d
dw Functione285d
dw Functione28df
dw Functione2903
dw Functione2992
; e27ba
Functione27ba: ; e27ba
xor a
ld [hBGMapMode], a
call ClearSprites
call Functione2d30
ld de, String_e34dd
call Functione2a6e
ld a, $5
ld [$cb2d], a
call Functione2c2c
call Functione2a80
call PCMonInfo
ld a, $ff
ld [CurPartySpecies], a
ld a, $17
call Functione33d0
call WaitBGMap
call Functione2e01
call Functione298d
ret
; e27eb
Functione27eb: ; e27eb
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
jr nz, .asm_e2837
ld a, [hl]
and A_BUTTON
jr nz, .asm_e2823
call Functione29d0
jr c, .asm_e2816
and a
ret z
call Functione2e01
xor a
ld [hBGMapMode], a
call Functione2c2c
call PCMonInfo
ld a, $1
ld [hBGMapMode], a
call DelayFrame
call DelayFrame
ret
.asm_e2816
xor a
ld [$cb2b], a
ld [$cb2a], a
ld a, $0
ld [$cf63], a
ret
.asm_e2823
call Functione2def
and a
ret z
cp $ff
jr z, .asm_e2837
ld a, $2
ld [$cf63], a
ret
ld hl, $cf63
dec [hl]
ret
.asm_e2837
ld a, $6
ld [$cf63], a
ret
; e283d
Functione283d: ; e283d
xor a
ld [hBGMapMode], a
call ClearSprites
call Functione2def
ld [CurPartySpecies], a
ld a, $17
call Functione33d0
ld de, String_e34ea
call Functione2a6e
ld a, $1
ld [$cfa9], a
call Functione298d
ret
; e285d
Functione285d: ; e285d
ld hl, MenuDataHeader_0xe28c3
call Function1d3c
ld a, [$cfa9]
call Function1d4b
call Function1d81
jp c, Functione28bd
ld a, [$cfa9]
dec a
and 3
ld e, a
ld d, 0
ld hl, Jumptable_e2881
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; e2881
Jumptable_e2881: ; e2881
dw Functione2887
dw Functione28a5
dw Functione28bd
; e2887
Functione2887: ; e2887
call Functione2f18
jp c, Functione28bd
ld a, [$cb2a]
ld [$cb2f], a
ld a, [$cb2b]
ld [$cb30], a
ld a, [$cb2e]
ld [$cb31], a
ld a, $4
ld [$cf63], a
ret
; e28a5
Functione28a5: ; e28a5
call Function1d6e
call Functione2f7e
call Function1c07
call PCMonInfo
call Functione2def
ld [CurPartySpecies], a
ld a, $17
call Functione33d0
ret
; e28bd
Functione28bd: ; e28bd
ld a, $0
ld [$cf63], a
ret
; e28c3
MenuDataHeader_0xe28c3: ; 0xe28c3
db $40 ; flags
db 04, 09 ; start coords
db 13, 19 ; end coords
dw MenuData2_0xe28cb
db 1 ; default option
; 0xe28cb
MenuData2_0xe28cb: ; 0xe28cb
db $80 ; flags
db 3 ; items
db "MOVE@"
db "STATS@"
db "CANCEL@"
; 0xe28df
Functione28df: ; e28df
xor a
ld [hBGMapMode], a
call Functione2d30
ld de, String_e3500
call Functione2a6e
ld a, $5
ld [$cb2d], a
call Functione2c2c
call Functione2a80
call ClearSprites
call Functione2e8c
call WaitBGMap
call Functione298d
ret
; e2903
Functione2903: ; e2903
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
jr nz, .asm_e294b
ld a, [hl]
and A_BUTTON
jr nz, .asm_e2938
call Functione29f4
jr c, .asm_e292b
and a
ret z
call Functione2e8c
xor a
ld [hBGMapMode], a
call Functione2c2c
ld a, $1
ld [hBGMapMode], a
call DelayFrame
call DelayFrame
ret
.asm_e292b
xor a
ld [$cb2b], a
ld [$cb2a], a
ld a, $4
ld [$cf63], a
ret
.asm_e2938
call Functione2ee5
jr c, .asm_e2946
call Functione31e7
ld a, $0
ld [$cf63], a
ret
.asm_e2946
ld hl, $cf63
dec [hl]
ret
.asm_e294b
ld a, [$cb2f]
ld [$cb2a], a
ld a, [$cb30]
ld [$cb2b], a
ld a, [$cb31]
ld [$cb2e], a
ld a, $0
ld [$cf63], a
ret
; e2963
Functione2963: ; e2963 (38:6963)
call WhiteBGMap
call ClearSprites
call ClearTileMap
call Functione33e8
ld hl, OverworldMap ; $c800
ld bc, $338
xor a
call ByteFill
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
ld [$cb2b], a
ld [$cb2a], a
ret
Functione298d: ; e298d (38:698d)
ld hl, $cf63
inc [hl]
ret
Functione2992: ; e2992 (38:6992)
ld hl, $cf63
set 7, [hl]
ret
Functione2998: ; e2998 (38:6998)
ld a, [$cb2d]
ld d, a
ld a, [$cb2c]
and a
jr z, .asm_e29b2
dec a
cp $1
jr z, .asm_e29b2
ld e, a
ld a, [hl]
and D_UP
jr nz, Functione2a18
ld a, [hl]
and D_DOWN
jr nz, Functione2a2c
.asm_e29b2
jp Functione2a65
Functione29b5: ; e29b5 (38:69b5)
ld hl, $ffa9
ld a, [$cb2d]
ld d, a
ld a, [$cb2c]
ld e, a
and a
jr z, .asm_e29cd
ld a, [hl]
and D_UP
jr nz, Functione2a18
ld a, [hl]
and D_DOWN
jr nz, Functione2a2c
.asm_e29cd
jp Functione2a65
; e29d0 (38:69d0)
Functione29d0: ; e29d0
ld hl, $ffa9
ld a, [$cb2d]
ld d, a
ld a, [$cb2c]
ld e, a
and a
jr z, .asm_e29e8
ld a, [hl]
and D_UP
jr nz, Functione2a18
ld a, [hl]
and D_DOWN
jr nz, Functione2a2c
.asm_e29e8
ld a, [hl]
and D_LEFT
jr nz, Functione2a48
ld a, [hl]
and D_RIGHT
jr nz, Functione2a56
jr Functione2a65
Functione29f4: ; e29f4
ld hl, $ffa9
ld a, [$cb2d]
ld d, a
ld a, [$cb2c]
ld e, a
and a
jr z, .asm_e2a0c
ld a, [hl]
and D_UP
jr nz, Functione2a18
ld a, [hl]
and D_DOWN
jr nz, Functione2a2c
.asm_e2a0c
ld a, [hl]
and D_LEFT
jr nz, Functione2a48
ld a, [hl]
and D_RIGHT
jr nz, Functione2a56
jr Functione2a65
Functione2a18: ; e2a18 (38:6a18)
ld hl, $cb2b
ld a, [hl]
and a
jr z, .asm_e2a22
dec [hl]
jr Functione2a68
.asm_e2a22
ld hl, $cb2a
ld a, [hl]
and a
jr z, Functione2a65
dec [hl]
jr Functione2a68
Functione2a2c: ; e2a2c (38:6a2c)
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
inc a
cp e
jr nc, Functione2a65
ld hl, $cb2b
ld a, [hl]
inc a
cp d
jr nc, .asm_e2a42
inc [hl]
jr Functione2a68
.asm_e2a42
ld hl, $cb2a
inc [hl]
jr Functione2a68
; e2a48 (38:6a48)
Functione2a48: ; e2a48
ld hl, $cb2e
ld a, [hl]
and a
jr z, .asm_e2a52
dec [hl]
jr Functione2a6c
.asm_e2a52
ld [hl], $e
jr Functione2a6c
Functione2a56: ; e2a56
ld hl, $cb2e
ld a, [hl]
cp $e
jr z, .asm_e2a61
inc [hl]
jr Functione2a6c
.asm_e2a61
ld [hl], $0
jr Functione2a6c
Functione2a65: ; e2a65 (38:6a65)
xor a
and a
ret
Functione2a68: ; e2a68 (38:6a68)
ld a, $1
and a
ret
; e2a6c (38:6a6c)
Functione2a6c: ; e2a6c
scf
ret
; e2a6e
Functione2a6e: ; e2a6e (38:6a6e)
push de
hlcoord 0, 15
ld bc, $112
call TextBox
pop de
hlcoord 1, 16
call PlaceString
ret
; e2a80 (38:6a80)
Functione2a80: ; e2a80
call Functione2a8e
hlcoord 8, 1
ld [hl], $5f
hlcoord 19, 1
ld [hl], $5e
ret
; e2a8e
Functione2a8e: ; e2a8e (38:6a8e)
hlcoord 8, 0
lb bc, 1, 10
call TextBox
ld a, [$cb2e]
and a
jr z, .party
cp NUM_BOXES + 1
jr nz, .gotbox
ld a, [wCurBox]
inc a
.gotbox
dec a
ld hl, wBoxNames
ld bc, 9
call AddNTimes
ld e, l
ld d, h
jr .print
.party
ld de, String_e2abd
.print
hlcoord 10, 1
call PlaceString
ret
; e2abd (38:6abd)
String_e2abd:
db "PARTY ", $e1, $e2, "@"
; e2ac6
PCMonInfo: ; e2ac6 (38:6ac6)
; Display a monster's pic and
; attributes when highlighting
; it in a PC menu.
; Includes the neat cascading
; effect when showing the pic.
; Example: Species, level, gender,
; whether it's holding an item.
hlcoord 0, 0
lb bc, 15, 8
call ClearBox
hlcoord 8, 14
lb bc, 1, 3
call ClearBox
call Functione2def
and a
ret z
cp $ff
ret z
ld [$d265], a
hlcoord 1, 4
xor a
ld b, 7
.asm_e2ae9
ld c, 7
push af
push hl
.asm_e2aed
ld [hli], a
add 7
dec c
jr nz, .asm_e2aed
pop hl
ld de, 20
add hl, de
pop af
inc a
dec b
jr nz, .asm_e2ae9
call Functione2b6d
ld a, [$d265]
ld [CurPartySpecies], a
ld [CurSpecies], a
ld hl, TempMonDVs
predef GetUnownLetter
call GetBaseData
ld de, $9000
predef GetFrontpic
xor a
ld [$cb32], a
ld a, [CurPartySpecies]
ld [$d265], a
cp EGG
ret z
call GetBasePokemonName
hlcoord 1, 14
call PlaceString
hlcoord 1, 12
call PrintLevel
ld a, $3
ld [MonType], a
callba GetGender
jr c, .asm_e2b4f
ld a, "♂"
jr nz, .printgender
ld a, "♀"
.printgender
hlcoord 5, 12
ld [hl], a
.asm_e2b4f
ld a, [TempMonItem]
and a
ret z
ld d, a
callab ItemIsMail
jr c, .mail
ld a, $5d ; item icon
jr .printitem
.mail
ld a, $1
ld [$cb32], a
ld a, $5c ; mail icon
.printitem
hlcoord 7, 12
ld [hl], a
ret
Functione2b6d: ; e2b6d (38:6b6d)
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld e, a
ld d, $0
ld hl, $c801
add hl, de
add hl, de
add hl, de
ld a, [hl]
and a
jr z, .asm_e2bc6
cp $f
jr z, .asm_e2bf5
ld b, a
call Functione3396
ld a, b
call GetSRAMBank
push hl
ld bc, $35
add hl, bc
ld bc, $20
ld a, e
call AddNTimes
ld a, [hl]
ld [TempMonLevel], a ; $d12d
pop hl
push hl
ld bc, $17
add hl, bc
ld bc, $20
ld a, e
call AddNTimes
ld a, [hl]
ld [TempMonItem], a ; $d10f
pop hl
ld bc, $2b
add hl, bc
ld bc, $20
ld a, e
call AddNTimes
ld de, TempMonDVs ; $d123
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
call CloseSRAM
ret
.asm_e2bc6
ld hl, PartyMon1Level ; $dcfe
ld bc, $30
ld a, e
call AddNTimes
ld a, [hl]
ld [TempMonLevel], a ; $d12d
ld hl, PartyMon1Item ; $dce0
ld bc, $30
ld a, e
call AddNTimes
ld a, [hl]
ld [TempMonItem], a ; $d10f
ld hl, PartyMon1DVs ; $dcf4
ld bc, $30
ld a, e
call AddNTimes
ld de, TempMonDVs ; $d123
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
ret
.asm_e2bf5
ld a, $1
call GetSRAMBank
ld hl, $ad45
ld bc, $20
ld a, e
call AddNTimes
ld a, [hl]
ld [TempMonLevel], a ; $d12d
ld hl, $ad27
ld bc, $20
ld a, e
call AddNTimes
ld a, [hl]
ld [TempMonItem], a ; $d10f
ld hl, $ad3b
ld bc, $20
ld a, e
call AddNTimes
ld de, TempMonDVs ; $d123
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
call CloseSRAM
ret
Functione2c2c: ; e2c2c (38:6c2c)
hlcoord 8, 2
lb bc, 10, 10
call TextBox
hlcoord 8, 2
ld [hl], "└"
hlcoord 19, 2
ld [hl], "┘"
ld a, [$cb2a]
ld e, a
ld d, 0
ld hl, OverworldMap ; $c800
add hl, de
add hl, de
add hl, de
ld e, l
ld d, h
hlcoord 9, 4
ld a, [$cb2d]
.asm_e2c53
push af
push de
push hl
call Functione2c6e
pop hl
ld de, $28
add hl, de
pop de
inc de
inc de
inc de
pop af
dec a
jr nz, .asm_e2c53
ret
; e2c67 (38:6c67)
String_e2c67:
db "CANCEL@"
; e2c6e
Functione2c6e: ; e2c6e (38:6c6e)
ld a, [de]
and a
ret z
cp $ff
jr nz, .asm_e2c7c
ld de, String_e2c67
call PlaceString
ret
.asm_e2c7c
inc de
ld a, [de]
ld b, a
inc de
ld a, [de]
ld e, a
ld a, b
and a
jr z, .asm_e2cc8
cp $f
jr z, .asm_e2cf1
push hl
call Functione3396
ld a, b
call GetSRAMBank
push hl
ld bc, $16
add hl, bc
ld bc, $20
ld a, e
call AddNTimes
ld a, [hl]
pop hl
and a
jr z, .asm_e2cc2
ld bc, $372
add hl, bc
ld bc, $b
ld a, e
call AddNTimes
ld de, StringBuffer1 ; $d073
ld bc, $b
call CopyBytes
call CloseSRAM
pop hl
ld de, StringBuffer1 ; $d073
call PlaceString
ret
.asm_e2cc2
call CloseSRAM
pop hl
jr .asm_e2d23
.asm_e2cc8
push hl
ld hl, PartySpecies ; $dcd8
ld d, $0
add hl, de
ld a, [hl]
and a
jr z, .asm_e2cee
ld hl, PartyMonNicknames ; $de41 (aliases: PartyMonNicknames)
ld bc, $b
ld a, e
call AddNTimes
ld de, StringBuffer1 ; $d073
ld bc, $b
call CopyBytes
pop hl
ld de, StringBuffer1 ; $d073
call PlaceString
ret
.asm_e2cee
pop hl
jr .asm_e2d23
.asm_e2cf1
push hl
ld a, $1
call GetSRAMBank
ld hl, $ad11
ld d, $0
add hl, de
ld a, [hl]
and a
jr z, .asm_e2d1f
ld hl, $b082
ld bc, $b
ld a, e
call AddNTimes
ld de, StringBuffer1 ; $d073
ld bc, $b
call CopyBytes
call CloseSRAM
pop hl
ld de, StringBuffer1 ; $d073
call PlaceString
ret
.asm_e2d1f
call CloseSRAM
pop hl
.asm_e2d23
ld de, String_e2d2a
call PlaceString
ret
; e2d2a (38:6d2a)
String_e2d2a:
db "-----@"
; e2d30
Functione2d30: ; e2d30 (38:6d30)
xor a
ld hl, OverworldMap ; $c800
ld bc, $5a
call ByteFill
ld de, OverworldMap ; $c800
xor a
ld [$d003], a
ld [$d004], a
ld a, [$cb2e]
and a
jr z, .asm_e2d87
cp $f
jr z, .asm_e2db7
ld b, a
call Functione3396
ld a, b
call GetSRAMBank
inc hl
.asm_e2d57
ld a, [hl]
cp $ff
jr z, .asm_e2d79
and a
jr z, .asm_e2d79
ld [de], a
inc de
ld a, [$cb2e]
ld [de], a
inc de
ld a, [$d003]
ld [de], a
inc a
ld [$d003], a
inc de
inc hl
ld a, [$d004]
inc a
ld [$d004], a
jr .asm_e2d57
.asm_e2d79
call CloseSRAM
ld a, $ff
ld [de], a
ld a, [$d004]
inc a
ld [$cb2c], a
ret
.asm_e2d87
ld hl, PartySpecies ; $dcd8
.asm_e2d8a
ld a, [hl]
cp $ff
jr z, .asm_e2dac
and a
jr z, .asm_e2dac
ld [de], a
inc de
ld a, [$cb2e]
ld [de], a
inc de
ld a, [$d003]
ld [de], a
inc a
ld [$d003], a
inc de
inc hl
ld a, [$d004]
inc a
ld [$d004], a
jr .asm_e2d8a
.asm_e2dac
ld a, $ff
ld [de], a
ld a, [$d004]
inc a
ld [$cb2c], a
ret
.asm_e2db7
ld a, $1
call GetSRAMBank
ld hl, $ad11
.asm_e2dbf
ld a, [hl]
cp $ff
jr z, .asm_e2de1
and a
jr z, .asm_e2de1
ld [de], a
inc de
ld a, [$cb2e]
ld [de], a
inc de
ld a, [$d003]
ld [de], a
inc a
ld [$d003], a
inc de
inc hl
ld a, [$d004]
inc a
ld [$d004], a
jr .asm_e2dbf
.asm_e2de1
call CloseSRAM
ld a, $ff
ld [de], a
ld a, [$d004]
inc a
ld [$cb2c], a
ret
Functione2def: ; e2def (38:6def)
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld e, a
ld d, $0
ld hl, OverworldMap ; $c800
add hl, de
add hl, de
add hl, de
ld a, [hl]
ret
Functione2e01: ; e2e01 (38:6e01)
ld a, [$cb2c]
and a
jr nz, .asm_e2e0b
call ClearSprites
ret
.asm_e2e0b
ld hl, Unknown_e2e2b
ld de, Sprites ; $c400
.asm_e2e11
ld a, [hl]
cp $ff
ret z
ld a, [$cb2b]
and $7
swap a
add [hl]
inc hl
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
jr .asm_e2e11
; e2e2b (38:6e2b)
Unknown_e2e2b: ; e2e2b
db $26, $50, $00, $00
db $26, $58, $00, $00
db $26, $60, $00, $00
db $26, $68, $00, $00
db $26, $70, $00, $00
db $26, $78, $00, $00
db $26, $80, $00, $00
db $26, $88, $00, $00
db $26, $90, $00, $00
db $26, $97, $00, $00
db $39, $50, $00, $40
db $39, $58, $00, $40
db $39, $60, $00, $40
db $39, $68, $00, $40
db $39, $70, $00, $40
db $39, $78, $00, $40
db $39, $80, $00, $40
db $39, $88, $00, $40
db $39, $90, $00, $40
db $39, $97, $00, $40
db $2e, $4e, $01, $00
db $31, $4e, $01, $40
db $2e, $99, $01, $20
db $31, $99, $01, $60
db $ff
; e2e8c
Functione2e8c: ; e2e8c
ld hl, Unknown_e2eac
ld de, Sprites
.asm_e2e92
ld a, [hl]
cp $ff
ret z
ld a, [$cb2b]
and $7
swap a
add [hl]
inc hl
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
jr .asm_e2e92
; e2eac
Unknown_e2eac: ; e2eac
db $27, $50, $06, $00
db $2b, $58, $00, $40
db $2b, $60, $00, $40
db $2b, $68, $00, $40
db $2b, $70, $00, $40
db $2b, $78, $00, $40
db $2b, $80, $00, $40
db $2b, $88, $00, $40
db $2b, $90, $00, $40
db $27, $98, $07, $00
db $ff
; e2ed5
Functione2ed5: ; e2ed5
.asm_e2ed5
push bc
push hl
.asm_e2ed7
ld [hli], a
dec c
jr nz, .asm_e2ed7
pop hl
ld bc, $0014
add hl, bc
pop bc
dec b
jr nz, .asm_e2ed5
ret
; e2ee5
Functione2ee5: ; e2ee5
ld hl, $cb2e
ld a, [$cb31]
cp [hl]
jr z, .asm_e2f00
ld a, [$cb2e]
and a
jr z, .asm_e2ef8
ld e, $15
jr .asm_e2efa
.asm_e2ef8
ld e, $7
.asm_e2efa
ld a, [$cb2c]
cp e
jr nc, .asm_e2f02
.asm_e2f00
and a
ret
.asm_e2f02
ld de, String_e3521
call Functione2a6e
ld de, SFX_WRONG
call WaitPlaySFX
call WaitSFX
ld c, 50
call DelayFrames
scf
ret
; e2f18
Functione2f18: ; e2f18 (38:6f18)
ld a, [$cb2e]
and a
jr nz, .asm_e2f3d
ld a, [$cb2c]
cp $3
jr c, .asm_e2f49
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld [CurPartyMon], a ; $d109
callba Functione538
jr c, .asm_e2f44
ld a, [$cb32]
and a
jr nz, .asm_e2f3f
.asm_e2f3d
and a
ret
.asm_e2f3f
ld de, String_e3544
jr .asm_e2f4c
.asm_e2f44
ld de, String_e3531
jr .asm_e2f4c
.asm_e2f49
ld de, String_e350f
.asm_e2f4c
call Functione2a6e
ld de, SFX_WRONG
call WaitPlaySFX
call WaitSFX
ld c, 50
call DelayFrames
scf
ret
Functione2f5f: ; e2f5f (38:6f5f)
ld a, [CurPartySpecies] ; $d108
cp EGG
jr z, .asm_e2f68
and a
ret
.asm_e2f68
ld de, String_e3597
call Functione2a6e
ld de, SFX_WRONG
call WaitPlaySFX
call WaitSFX
ld c, 50
call DelayFrames
scf
ret
Functione2f7e: ; e2f7e (38:6f7e)
call LowVolume
call Functione2fd6
ld a, $3
ld [MonType], a ; $cf5f
predef StatsScreenInit
call Functione33e8
call MaxVolume
ret
Functione2f95: ; e2f95 (38:6f95)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and A_BUTTON | B_BUTTON | D_RIGHT + D_LEFT
ld [$cf73], a
jr nz, .asm_e2fd0
ld a, [hl]
and D_DOWN | D_UP
ld [$cf73], a
jr nz, .asm_e2faa
jr .asm_e2fd0
.asm_e2faa
call Functione2998
and a
jr z, .asm_e2fd1
call Functione2def
ld [$d265], a
call Functione2b6d
ld a, [$d265]
ld [CurPartySpecies], a ; $d108
ld [CurSpecies], a ; $cf60
ld hl, TempMonDVs ; $d123
predef GetUnownLetter
call GetBaseData
call Functione2fd6
.asm_e2fd0
ret
.asm_e2fd1
xor a
ld [$cf73], a
ret
Functione2fd6: ; e2fd6 (38:6fd6)
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld [CurPartyMon], a ; $d109
ld a, [$cb2e]
and a
jr z, .asm_e3020
cp $f
jr nz, .asm_e3048
ld a, $1
call GetSRAMBank
ld hl, $ad11
call Functione3357
ld hl, $b082
call Functione3363
ld hl, $afa6
call Functione3376
ld hl, $ad26
ld bc, $20
ld a, [CurPartyMon] ; $d109
call AddNTimes
ld de, $d018
ld bc, $30
call CopyBytes
call CloseSRAM
callba Function5088b
ret
.asm_e3020
ld hl, PartySpecies ; $dcd8
call Functione3357
ld hl, PartyMonNicknames ; $de41 (aliases: PartyMonNicknames)
call Functione3363
ld hl, PartyMonOT ; $ddff (aliases: PartyMonOT)
call Functione3376
ld hl, PartyMons ; $dcdf (aliases: PartyMon1, PartyMon1Species)
ld bc, $30
ld a, [CurPartyMon] ; $d109
call AddNTimes
ld de, $d018
ld bc, $30
call CopyBytes
ret
.asm_e3048
ld b, a
call Functione3396
ld a, b
call GetSRAMBank
push hl
inc hl
call Functione3357
pop hl
push hl
ld bc, $372
add hl, bc
call Functione3363
pop hl
push hl
ld bc, $296
add hl, bc
call Functione3376
pop hl
ld bc, $16
add hl, bc
ld bc, $20
call Functione3389
call CloseSRAM
callba Function5088b
ret
Functione307c: ; e307c (38:707c)
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld [CurPartyMon], a ; $d109
ld hl, PartyMonNicknames ; $de41 (aliases: PartyMonNicknames)
ld a, [CurPartyMon] ; $d109
call GetNick
ld a, $1
ld [$d10b], a
predef Functiondb3f
jr c, .asm_e30e4
xor a
ld [$d10b], a
callba Functione039
ld a, [CurPartySpecies] ; $d108
call PlayCry
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $f08
call ClearBox
hlcoord 8, 14
ld bc, $103
call ClearBox
hlcoord 0, 15
ld bc, $112
call TextBox
call WaitBGMap
hlcoord 1, 16
ld de, String_e3563
call PlaceString
ld l, c
ld h, b
ld de, StringBuffer1 ; $d073
call PlaceString
ld a, "!"
ld [bc], a
ld c, 50
call DelayFrames
and a
ret
.asm_e30e4
ld de, String_e3575
call Functione2a6e
ld de, SFX_WRONG
call WaitPlaySFX
call WaitSFX
ld c, 50
call DelayFrames
scf
ret
Functione30fa: ; e30fa (38:70fa)
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld [CurPartyMon], a ; $d109
ld a, $1
call GetSRAMBank
ld a, [CurPartyMon] ; $d109
ld hl, $b082
call GetNick
call CloseSRAM
xor a
ld [$d10b], a
predef Functiondb3f
jr c, .asm_e316a
ld a, $1
ld [$d10b], a
callba Functione039
ld a, [CurPartySpecies] ; $d108
call PlayCry
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $f08
call ClearBox
hlcoord 8, 14
ld bc, $103
call ClearBox
hlcoord 0, 15
ld bc, $112
call TextBox
call WaitBGMap
hlcoord 1, 16
ld de, String_e356b
call PlaceString
ld l, c
ld h, b
ld de, StringBuffer1 ; $d073
call PlaceString
ld a, $e7
ld [bc], a
ld c, 50
call DelayFrames
and a
ret
.asm_e316a
ld de, String_e3586
call Functione2a6e
ld de, SFX_WRONG
call WaitPlaySFX
call WaitSFX
ld c, 50
call DelayFrames
scf
ret
Functione3180: ; e3180 (38:7180)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $f08
call ClearBox
hlcoord 8, 14
ld bc, $103
call ClearBox
hlcoord 0, 15
ld bc, $112
call TextBox
call WaitBGMap
ld a, [CurPartySpecies] ; $d108
call GetCryIndex
jr c, .asm_e31ab
ld e, c
ld d, b
call PlayCryHeader
.asm_e31ab
ld a, [CurPartySpecies] ; $d108
ld [$d265], a
call GetPokemonName
hlcoord 1, 16
ld de, String_e3551
call PlaceString
ld c, 80
call DelayFrames
hlcoord 0, 15
ld bc, $112
call TextBox
hlcoord 1, 16
ld de, String_e355e
call PlaceString
ld l, c
ld h, b
inc hl
ld de, StringBuffer1 ; $d073
call PlaceString
ld l, c
ld h, b
ld [hl], $e7
ld c, 50
call DelayFrames
ret
; e31e7 (38:71e7)
Functione31e7: ; e31e7
push hl
push de
push bc
push af
hlcoord 0, 15
ld bc, $0112
call TextBox
hlcoord 1, 16
ld de, String_e3233
call PlaceString
ld c, 20
call DelayFrames
pop af
pop bc
pop de
pop hl
ld a, [wCurBox]
push af
ld bc, 0
ld a, [$cb31]
and a
jr nz, .asm_e3215
set 0, c
.asm_e3215
ld a, [$cb2e]
and a
jr nz, .asm_e321d
set 1, c
.asm_e321d
ld hl, Jumptable_e3245
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld de, Functione322a
push de
jp [hl]
; e322a
Functione322a: ; e322a
pop af
ld e, a
callba Function14ad5
ret
; e3233
String_e3233:
db "Saving… Leave ON!@"
; e3245
Jumptable_e3245: ; e3245
dw Functione324d
dw Functione3267
dw Functione327d
dw Functione3284
; e324d
Functione324d: ; e324d
ld hl, $cb31
ld a, [$cb2e]
cp [hl]
jr z, .asm_e325d
call Functione32b0
call Functione32fa
ret
.asm_e325d
call Functione32b0
call Functione328e
call Functione32fa
ret
; e3267
Functione3267: ; e3267
call Functione3316
ld a, $1
ld [$c2cd], a
callba Function14b85
xor a
ld [$c2cd], a
call Functione32fa
ret
; e327d
Functione327d: ; e327d
call Functione32b0
call Functione3346
ret
; e3284
Functione3284: ; e3284
call Functione3316
call Functione328e
call Functione3346
ret
; e328e
Functione328e: ; e328e
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld e, a
ld a, [$cb30]
ld hl, $cb2f
add [hl]
cp e
ret nc
ld hl, $cb2b
ld a, [hl]
and a
jr z, .asm_e32a8
dec [hl]
ret
.asm_e32a8
ld hl, $cb2a
ld a, [hl]
and a
ret z
dec [hl]
ret
; e32b0
Functione32b0: ; e32b0
ld a, [$cb31]
dec a
ld e, a
callba Function14ac2
ld a, [$cb30]
ld hl, $cb2f
add [hl]
ld [CurPartyMon], a
ld a, $1
call GetSRAMBank
ld hl, sBoxSpecies
call Functione3357
ld hl, sBoxMonNicknames
call Functione3363
ld hl, sBoxMonOT
call Functione3376
ld hl, sBoxMons
ld bc, sBoxMon1End - sBoxMon1
call Functione3389
call CloseSRAM
callba Function5088b
ld a, $1
ld [$d10b], a
callba Functione039
ret
; e32fa
Functione32fa: ; e32fa
ld a, [$cb2e]
dec a
ld e, a
callba Function14ac2
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld [CurPartyMon], a
callba Function51322
ret
; e3316
Functione3316: ; e3316
ld a, [$cb30]
ld hl, $cb2f
add [hl]
ld [CurPartyMon], a
ld hl, PartySpecies
call Functione3357
ld hl, PartyMonNicknames
call Functione3363
ld hl, PartyMonOT
call Functione3376
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
call Functione3389
xor a
ld [$d10b], a
callba Functione039
ret
; e3346
Functione3346: ; e3346
ld a, [$cb2b]
ld hl, $cb2a
add [hl]
ld [CurPartyMon], a
callba Function5138b
ret
; e3357
Functione3357: ; e3357 (38:7357)
ld a, [CurPartyMon] ; $d109
ld c, a
ld b, $0
add hl, bc
ld a, [hl]
ld [CurPartySpecies], a ; $d108
ret
Functione3363: ; e3363 (38:7363)
ld bc, $b
ld a, [CurPartyMon] ; $d109
call AddNTimes
ld de, DefaultFlypoint ; $d002
ld bc, $b
call CopyBytes
ret
Functione3376: ; e3376 (38:7376)
ld bc, $b
ld a, [CurPartyMon] ; $d109
call AddNTimes
ld de, $d00d
ld bc, $b
call CopyBytes
ret
Functione3389: ; e3389 (38:7389)
ld a, [CurPartyMon] ; $d109
call AddNTimes
ld de, $d018
call CopyBytes
ret
Functione3396: ; e3396 (38:7396)
dec b
ld c, b
ld b, 0
ld hl, Unknown_e33a6
add hl, bc
add hl, bc
add hl, bc
ld a, [hli]
ld b, a
ld a, [hli]
ld h, [hl]
ld l, a
ret
; e33a6 (38:73a6)
Unknown_e33a6: ; e33a6
; bank, address
dbw $02, $a000
dbw $02, $a450
dbw $02, $a8a0
dbw $02, $acf0
dbw $02, $b140
dbw $02, $b590
dbw $02, $b9e0
dbw $03, $a000
dbw $03, $a450
dbw $03, $a8a0
dbw $03, $acf0
dbw $03, $b140
dbw $03, $b590
dbw $03, $b9e0
; e33d0
Functione33d0: ; e33d0 (38:73d0)
ld b, a
call GetSGBLayout
ld a, $e4
call DmgToCgbBGPals
ld a, $fc
call Functioncf8
ret
Functione33df: ; e33df (38:73df)
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
Functione33e8: ; e33e8 (38:73e8)
call DisableLCD
ld hl, $9000
ld bc, $310
xor a
call ByteFill
call Functione51
call Functione58
ld hl, PCMailGFX
ld de, $95c0
ld bc, $40
call CopyBytes
ld hl, PCSelectLZ
ld de, $8000
call Decompress
ld a, 6
call SkipMusic
call EnableLCD
ret
; e3419 (38:7419)
PCSelectLZ: INCBIN "gfx/pc.2bpp.lz"
PCMailGFX: INCBIN "gfx/pc_mail.2bpp"
; e34dd
String_e34dd: db "Choose a ", $e1, $e2, ".@"
String_e34ea: db "What's up?@"
String_e34f4: db "Release ", $e1, $e2, "?@"
String_e3500: db "Move to where?@"
String_e350f: db "It's your last ", $e1, $e2, "!@"
String_e3521: db "There's no room!@"
String_e3531: db "No more usable ", $e1, $e2, "!@"
String_e3544: db "Remove MAIL.@"
String_e3551: db "Released ", $e1, $e2, ".@"
String_e355e: db "Bye,@"
String_e3563: db "Stored @"
String_e356b: db "Got @"
String_e3570: db "Non.@"
String_e3575: db "The BOX is full.@"
String_e3586: db "The party's full!@"
String_e3597: db "No releasing EGGS!@"
; e35aa
Functione35aa: ; e35aa (38:75aa)
call Function1d6e
call Functione35e2
.asm_e35b0
xor a
ld [hBGMapMode], a ; $ff00+$d4
call Functione36cf
call Functione379c
ld hl, MenuDataHeader_0xe35f1
call Function1d3c
xor a
ld [$d0e4], a
hlcoord 0, 4
ld bc, $809
call TextBox
call Function350c
ld a, [$cf73]
cp $2
jr z, .asm_e35de
call Functione37af
call Functione36f9
jr .asm_e35b0
.asm_e35de
call Function1c17
ret
Functione35e2: ; e35e2 (38:75e2)
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
ld a, $7f
call ByteFill
ret
; e35f1 (38:75f1)
MenuDataHeader_0xe35f1: ; 0xe35f1
db $40 ; flags
db 05, 01 ; start coords
db 12, 09 ; end coords
dw MenuData2_0xe35f9
db 1 ; default option
; 0xe35f9
MenuData2_0xe35f9: ; 0xe35f9
db $22 ; flags
db 4, 0
db 1
dbw BANK(Unknown_e3609), Unknown_e3609
dbw BANK(Functione3619), Functione3619
dbw BANK(NULL), NULL
dbw BANK(Functione3632), Functione3632
; e3609
Unknown_e3609: ; e3609
db 14
db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
db -1
; e3619
Functione3619: ; e3619
push de
ld a, [MenuSelection]
dec a
call Functione3626
pop hl
call PlaceString
ret
; e3626
Functione3626: ; e3626 (38:7626)
ld bc, 9
ld hl, wBoxNames
call AddNTimes
ld d, h
ld e, l
ret
; e3632 (38:7632)
Functione3632: ; e3632
hlcoord 11, 7
ld bc, $0507
call TextBox
ld a, [MenuSelection]
cp $ff
ret z
hlcoord 12, 9
ld de, String_e3663
call PlaceString
call Functione366c
ld [$d265], a
hlcoord 13, 11
ld de, $d265
ld bc, $0102
call PrintNum
ld de, String_e3668
call PlaceString
ret
; e3663
String_e3663: ; e3663
db "#MON@"
; e3668
String_e3668: ; e3668
db "/"
db "0" + MONS_PER_BOX / 10
db "0" + MONS_PER_BOX % 10
db "@"
; e366c
Functione366c: ; e366c (38:766c)
ld a, [wCurBox]
ld c, a
ld a, [MenuSelection] ; $cf74
dec a
cp c
jr z, .asm_e3697
ld c, a
ld b, 0
ld hl, Unknown_e36a5
add hl, bc
add hl, bc
add hl, bc
ld a, [hli]
ld b, a
call GetSRAMBank
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
call CloseSRAM
ld c, a
ld a, [$d4b4]
and a
jr z, .asm_e3695
ld a, c
ret
.asm_e3695
xor a
ret
.asm_e3697
ld a, 1
ld b, a
call GetSRAMBank
ld hl, $ad10
ld a, [hl]
call CloseSRAM
ret
; e36a5 (38:76a5)
Unknown_e36a5: ; e36a5
; bank, address
dbw $02, $a000
dbw $02, $a450
dbw $02, $a8a0
dbw $02, $acf0
dbw $02, $b140
dbw $02, $b590
dbw $02, $b9e0
dbw $03, $a000
dbw $03, $a450
dbw $03, $a8a0
dbw $03, $acf0
dbw $03, $b140
dbw $03, $b590
dbw $03, $b9e0
; e36cf
Functione36cf: ; e36cf (38:76cf)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld b, $2
ld c, $12
call TextBox
hlcoord 1, 2
ld de, String_e36f1
call PlaceString
ld a, [wCurBox]
and $f
call Functione3626
hlcoord 11, 2
call PlaceString
ret
; e36f1 (38:76f1)
String_e36f1: ; e36f1
db "CURRENT@"
; e36f9
Functione36f9: ; e36f9 (38:76f9)
ld hl, MenuDataHeader_0xe377b
call LoadMenuDataHeader
call Function1d81
call Function1c07
ret c
ld a, [$cfa9]
cp $1
jr z, .asm_e3734
cp $2
jr z, .asm_e3745
cp $3
jr z, .asm_e3717
and a
ret
.asm_e3717
call Functione366c
and a
jr z, .asm_e372f
ld e, l
ld d, h
ld a, [MenuSelection] ; $cf74
dec a
ld c, a
callba Function844bc
call Functione35e2
and a
ret
.asm_e372f
call Functione37be
and a
ret
.asm_e3734
ld a, [MenuSelection] ; $cf74
dec a
ld e, a
ld a, [wCurBox]
cp e
ret z
callba Function14a83
ret
.asm_e3745
ld b, $4
ld de, DefaultFlypoint ; $d002
callba Function116c1
call ClearTileMap
call Functione51
call Functione58
ld a, [MenuSelection] ; $cf74
dec a
call Functione3626
ld e, l
ld d, h
ld hl, DefaultFlypoint ; $d002
ld c, $8
call InitString
ld a, [MenuSelection] ; $cf74
dec a
call Functione3626
ld de, DefaultFlypoint ; $d002
call CopyName2
ret
; e3778 (38:7778)
INCBIN "baserom.gbc",$e3778,$e377b - $e3778
MenuDataHeader_0xe377b: ; 0xe377b
db $40 ; flags
db 04, 11 ; start coords
db 13, 19 ; end coords
dw MenuData2_0xe3783
db 1 ; default option
; 0xe3783
MenuData2_0xe3783: ; 0xe3783
db $80 ; flags
db 4 ; items
db "SWITCH@"
db "NAME@"
db "PRINT@"
db "QUIT@"
; 0xe379c
Functione379c: ; e379c (38:779c)
ld de, String_e37a1
jr Functione37e3
; e37a1 (38:77a1)
String_e37a1: ; e37a1
db "Choose a BOX.@"
; e37af
Functione37af: ; e37af (38:77af)
ld de, String_e37b4
jr Functione37e3
; e37b4 (38:77b4)
String_e37b4: ; e37b4
db "What's up?@"
; e37be
Functione37be: ; e37be (38:77be)
ld de, String_e37d3
call Functione37e3
ld de, SFX_WRONG
call WaitPlaySFX
call WaitSFX
ld c, 50
call DelayFrames
ret
; e37d3 (38:77d3)
String_e37d3: ; e37d3
db "There's no #MON.@"
; e37e3
Functione37e3: ; e37e3 (38:77e3)
push de
hlcoord 0, 14
ld bc, $212
call TextBox
pop de
hlcoord 1, 16
call PlaceString
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
SECTION "bank39", ROMX, BANK[$39]
CopyrightGFX:: ; e4000
INCBIN "gfx/misc/copyright.2bpp"
; e41d0
_OptionsMenu: ; e41d0
ld hl, $ffaa
ld a, [hl]
push af
ld [hl], $1
call WhiteBGMap
ld hl, TileMap
ld b, $10
ld c, $12
call TextBox
hlcoord 2, 2
ld de, StringOptions
call PlaceString
xor a
ld [$cf63], a
ld c, $6 ;number of items on the menu minus 1 (for cancel)
.asm_e41f3 ;this loop will display the settings of each option when the menu is opened
push bc
xor a
ld [$ffa9], a
call GetOptionPointer
pop bc
ld hl, $cf63
inc [hl]
dec c
jr nz, .asm_e41f3
call Functione4512
xor a
ld [$cf63], a
inc a
ld [hBGMapMode], a
call WaitBGMap
ld b, $8
call GetSGBLayout
call Function32f9
.asm_e4217
call Functiona57
ld a, [hJoyPressed]
and $a
jr nz, .ExitOptions
call OptionsControl
jr c, .asm_e422a
call GetOptionPointer
jr c, .ExitOptions
.asm_e422a
call Functione455c
ld c, $3
call DelayFrames
jr .asm_e4217
.ExitOptions
ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
pop af
ld [$ffaa], a
ret
; e4241
StringOptions: ; e4241
db "TEXT SPEED", $22
db " :", $22
db "BATTLE SCENE", $22
db " :", $22
db "BATTLE STYLE", $22
db " :", $22
db "SOUND", $22
db " :", $22
db "PRINT", $22
db " :", $22
db "MENU ACCOUNT", $22
db " :", $22
db "FRAME", $22
db " :TYPE", $22
db "CANCEL@"
; e42d6
GetOptionPointer: ; e42d6
ld a, [$cf63] ;load the cusror position to a
ld e, a ;copy it to de
ld d, 0
ld hl, .Pointers
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl] ;jump to the code of the current highlighted item
; e42e5
.Pointers
dw Options_TextSpeed
dw Options_BattleScene
dw Options_BattleStyle
dw Options_Sound
dw Options_Print
dw Options_MenuAccount
dw Options_Frame
dw Options_Cancel
; e42f5
Options_TextSpeed: ; e42f5
call GetTextSpeed
ld a, [hJoyPressed]
bit 5, a
jr nz, .LeftPressed
bit 4, a
jr z, .NonePressed
ld a, c ;right pressed
cp $2
jr c, .Increase
ld c, $ff
.Increase
inc c
ld a, e
jr .Save
.LeftPressed
ld a, c
and a
jr nz, .Decrease
ld c, $3
.Decrease
dec c
ld a, d
.Save
ld b, a
ld a, [Options]
and $f0
or b
ld [Options], a
.NonePressed
ld b, 0
ld hl, .Strings
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 11, 3
call PlaceString
and a
ret
; e4331
.Strings
dw .Fast
dw .Mid
dw .Slow
.Fast
db "FAST@"
.Mid
db "MID @"
.Slow
db "SLOW@"
; e4346
GetTextSpeed: ; e4346
ld a, [Options] ;This converts the number of frames, to 0,1,2 representing speed
and 7
cp 5 ;5 frames of delay is slow
jr z, .slow
cp 1 ;1 frame of delay is fast
jr z, .fast
ld c, 1 ;set it to mid if not one of the above
lb de, 1, 5
ret
.slow
ld c, 2
lb de, 3, 1
ret
.fast
ld c, 0
lb de, 5, 3
ret
; e4365
Options_BattleScene: ; e4365
ld hl, Options
ld a, [hJoyPressed]
bit 5, a
jr nz, .LeftPressed
bit 4, a
jr z, .NonePressed
bit 7, [hl]
jr nz, .ToggleOn
jr .ToggleOff
.LeftPressed
bit 7, [hl]
jr z, .ToggleOff
jr .ToggleOn
.NonePressed
bit 7, [hl]
jr z, .ToggleOn
jr .ToggleOff
.ToggleOn
res 7, [hl]
ld de, .On
jr .Display
.ToggleOff
set 7, [hl]
ld de, .Off
.Display
hlcoord 11, 5
call PlaceString
and a
ret
; e4398
.On
db "ON @"
.Off
db "OFF@"
; e43a0
Options_BattleStyle: ; e43a0
ld hl, Options
ld a, [hJoyPressed]
bit 5, a
jr nz, .LeftPressed
bit 4, a
jr z, .NonePressed
bit 6, [hl]
jr nz, .ToggleShift
jr .ToggleSet
.LeftPressed
bit 6, [hl]
jr z, .ToggleSet
jr .ToggleShift
.NonePressed
bit 6, [hl]
jr nz, .ToggleSet
.ToggleShift
res 6, [hl]
ld de, .Shift
jr .Display
.ToggleSet
set 6, [hl]
ld de, .Set
.Display
hlcoord 11, 7
call PlaceString
and a
ret
; e43d1
.Shift
db "SHIFT@"
.Set
db "SET @"
; e43dd
Options_Sound: ; e43dd
ld hl, Options
ld a, [hJoyPressed]
bit 5, a
jr nz, .LeftPressed
bit 4, a
jr z, .NonePressed
bit 5, [hl]
jr nz, .SetMono
jr .SetStereo
.LeftPressed
bit 5, [hl]
jr z, .SetStereo
jr .SetMono
.NonePressed
bit 5, [hl]
jr nz, .ToggleStereo
jr .ToggleMono
.SetMono
res 5, [hl]
call RestartMapMusic
.ToggleMono
ld de, .Mono
jr .Display
.SetStereo
set 5, [hl]
call RestartMapMusic
.ToggleStereo
ld de, .Stereo
.Display
hlcoord 11, 9
call PlaceString
and a
ret
; e4416
.Mono
db "MONO @"
.Stereo
db "STEREO@"
; e4424
Options_Print: ; e4424
call GetPrinterSetting
ld a, [hJoyPressed]
bit 5, a
jr nz, .LeftPressed
bit 4, a
jr z, .NonePressed
ld a, c
cp $4
jr c, .Increase
ld c, $ff
.Increase
inc c
ld a, e
jr .Save
.LeftPressed
ld a, c
and a
jr nz, .Decrease
ld c, $5
.Decrease
dec c
ld a, d
.Save
ld b, a
ld [GBPrinter], a
.NonePressed
ld b, $0
ld hl, .Strings
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 11, 11
call PlaceString
and a
ret
; e445a
.Strings
dw .Lightest
dw .Lighter
dw .Normal
dw .Darker
dw .Darkest
.Lightest
db "LIGHTEST@"
.Lighter
db "LIGHTER @"
.Normal
db "NORMAL @"
.Darker
db "DARKER @"
.Darkest
db "DARKEST @"
; e4491
GetPrinterSetting: ; e4491
ld a, [GBPrinter] ;converts from the stored printer setting to 0,1,2,3,4
and a
jr z, .IsLightest
cp $20
jr z, .IsLight
cp $60
jr z, .IsDark
cp $7f
jr z, .IsDarkest
ld c, $2 ;normal if none of the above
ld de, $2060 ;the 2 values next to this setting
ret
.IsLightest
ld c, $0
ld de, $7f20 ;the 2 values next to this setting
ret
.IsLight
ld c, $1
ld de, $0040 ;the 2 values next to this setting
ret
.IsDark
ld c, $3
ld de, $407f ;the 2 values next to this setting
ret
.IsDarkest
ld c, $4
ld de, $6000 ;the 2 values next to this setting
ret
; e44c1
Options_MenuAccount: ; e44c1
ld hl, Options2
ld a, [hJoyPressed]
bit 5, a
jr nz, .LeftPressed
bit 4, a
jr z, .NonePressed
bit 0, [hl]
jr nz, .ToggleOff
jr .ToggleOn
.LeftPressed
bit 0, [hl]
jr z, .ToggleOn
jr .ToggleOff
.NonePressed
bit 0, [hl]
jr nz, .ToggleOn
.ToggleOff
res 0, [hl]
ld de, .Off
jr .Display
.ToggleOn
set 0, [hl]
ld de, .On
.Display
hlcoord 11, 13
call PlaceString
and a
ret
; e44f2
.Off
db "OFF@"
.On
db "ON @"
; e44fa
Options_Frame: ; e44fa
ld hl, TextBoxFrame
ld a, [hJoyPressed]
bit 5, a
jr nz, .LeftPressed
bit 4, a
jr nz, .RightPressed
and a
ret
.RightPressed
ld a, [hl]
inc a
jr .Save
.LeftPressed
ld a, [hl]
dec a
.Save
and $7
ld [hl], a
; fallthrough
; e4512
Functione4512: ; e4512
ld a, [TextBoxFrame]
hlcoord 16, 15 ;where on the screen the number is drawn
add "1"
ld [hl], a
call Functione5f
and a
ret
; e4520
Options_Cancel: ; e4520
ld a, [hJoyPressed]
and A_BUTTON
jr nz, .Exit
and a
ret
.Exit
scf
ret
; e452a
OptionsControl: ; e452a
ld hl, $cf63
ld a, [$ffa9]
cp $80
jr z, .DownPressed
cp $40
jr z, .UpPressed
and a
ret
.DownPressed
ld a, [hl] ;load the cursor position to a
cp $7 ;maximum number of items in option menu
jr nz, .CheckFive
ld [hl], $0
scf
ret
.CheckFive ;I have no idea why this exists...
cp $5
jr nz, .Increase
ld [hl], $5
.Increase
inc [hl]
scf
ret
.UpPressed
ld a, [hl]
cp $6
jr nz, .NotSix
ld [hl], $5 ;Another thing where I'm not sure why it exists
scf
ret
.NotSix
and a
jr nz, .Decrease
ld [hl], $8 ;number of option items +1
.Decrease
dec [hl]
scf
ret
; e455c
Functione455c: ; e455c
hlcoord 1, 1
ld de, $0014
ld c, $10
.asm_e4564
ld [hl], $7f
add hl, de
dec c
jr nz, .asm_e4564
hlcoord 1, 2
ld bc, $0028
ld a, [$cf63]
call AddNTimes
ld [hl], $ed
ret
; e4579
Functione4579: ; e4579
ld de, MUSIC_NONE
call PlayMusic
call WhiteBGMap
call ClearTileMap
ld a, $98
ld [$ffd7], a
xor a
ld [hBGMapAddress], a
ld [hJoyDown], a
ld [hSCX], a
ld [hSCY], a
ld a, $90
ld [hWY], a
call WaitBGMap
ld b, $19
call GetSGBLayout
call Function32f9
ld c, 10
call DelayFrames
callab Copyright
call WaitBGMap
ld c, $64
call DelayFrames
call ClearTileMap
callba GBCOnlyScreen
call Functione45e8
.asm_e45c0
call Functiona57
ld a, [$ffa9]
and $f
jr nz, .asm_e45de
ld a, [$cf63]
bit 7, a
jr nz, .asm_e45e3
call Functione4670
callba Function8cf69
call DelayFrame
jr .asm_e45c0
.asm_e45de
call Functione465e
scf
ret
.asm_e45e3
call Functione465e
and a
ret
; e45e8
Functione45e8: ; e45e8
ld de, GameFreakLogo
ld hl, VTiles2
lb bc, BANK(GameFreakLogo), $1c
call Get1bpp
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
ld hl, IntroLogoGFX
ld de, $d000
ld a, BANK(IntroLogoGFX)
call FarDecompress
ld hl, VTiles0
ld de, $d000
ld bc, $0180
call Request2bpp
ld hl, VTiles1
ld de, $d800
ld bc, $0180
call Request2bpp
pop af
ld [rSVBK], a
callba Function8cf53
ld de, $5458
ld a, $3
call Function3b2a
ld hl, $0007
add hl, bc
ld [hl], $a0
ld hl, $000c
add hl, bc
ld [hl], $60
ld hl, $000d
add hl, bc
ld [hl], $30
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [hSCX], a
ld [hSCY], a
ld a, $1
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
ld de, $e4e4
call DmgToCgbObjPals
ret
; e465e
Functione465e: ; e465e
callba Function8cf53
call ClearTileMap
call ClearSprites
ld c, $10
call DelayFrames
ret
; e4670
Functione4670: ; e4670
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_e467f
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; e467f
Jumptable_e467f: ; e467f
dw Functione468c
dw Functione468d
dw Functione46ba
dw Functione46dd
; e4687
Functione4687: ; e4687
ld hl, $cf63
inc [hl]
ret
; e468c
Functione468c: ; e468c
ret
; e468d
Functione468d: ; e468d
ld hl, $cf65
ld a, [hl]
cp $20
jr nc, .asm_e4697
inc [hl]
ret
.asm_e4697
ld [hl], 0
ld hl, .GAME_FREAK
decoord 5, 10
ld bc, .end - .GAME_FREAK
call CopyBytes
call Functione4687
ld de, SFX_GAME_FREAK_PRESENTS
call PlaySFX
ret
; e46af
.GAME_FREAK
; G A M E _ F R E A K
db 0, 1, 2, 3, 13, 4, 5, 3, 1, 6
.end
db "@"
; e46ba
Functione46ba: ; e46ba
ld hl, $cf65
ld a, [hl]
cp $40
jr nc, .asm_e46c4
inc [hl]
ret
.asm_e46c4
ld [hl], 0
ld hl, .presents
decoord 7,11
ld bc, .end - .presents
call CopyBytes
call Functione4687
ret
; e46d6
.presents
db 7, 8, 9, 10, 11, 12
.end
db "@"
; e46dd
Functione46dd: ; e46dd
ld hl, $cf65
ld a, [hl]
cp $80
jr nc, .asm_e46e7
inc [hl]
ret
.asm_e46e7
ld hl, $cf63
set 7, [hl]
ret
; e46ed
Functione46ed: ; e46ed (39:46ed)
ld hl, $b
add hl, bc
ld e, [hl]
ld d, 0
ld hl, Jumptable_e46fd
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_e46fd: ; e46fd (39:46fd)
dw Functione4707
dw Functione470d
dw Functione4759
dw Functione4776
dw Functione47ab
Functione4707: ; e4707 (39:4707)
ld hl, $b
add hl, bc
inc [hl]
ret
Functione470d: ; e470d (39:470d)
ld hl, $c
add hl, bc
ld a, [hl]
and a
jr z, .asm_e4747
ld d, a
ld hl, $d
add hl, bc
ld a, [hl]
and $3f
cp $20
jr nc, .asm_e4723
add $20
.asm_e4723
ld e, a
callba Functionce765
ld hl, $7
add hl, bc
ld [hl], e
ld hl, $d
add hl, bc
ld a, [hl]
dec [hl]
and $1f
ret nz
ld hl, $c
add hl, bc
ld a, [hl]
sub $30
ld [hl], a
ld de, SFX_DITTO_BOUNCE
call PlaySFX
ret
.asm_e4747
ld hl, $b
add hl, bc
inc [hl]
ld hl, $d
add hl, bc
ld [hl], $0
ld de, SFX_DITTO_POP_UP
call PlaySFX
ret
Functione4759: ; e4759 (39:4759)
ld hl, $d
add hl, bc
ld a, [hl]
cp $20
jr nc, .asm_e4764
inc [hl]
ret
.asm_e4764
ld hl, $b
add hl, bc
inc [hl]
ld hl, $d
add hl, bc
ld [hl], $0
ld de, SFX_DITTO_TRANSFORM
call PlaySFX
ret
Functione4776: ; e4776 (39:4776)
ld hl, $d
add hl, bc
ld a, [hl]
cp $40
jr z, .asm_e47a3
inc [hl]
srl a
srl a
ld e, a
ld d, $0
ld hl, Unknown_e47ac
add hl, de
add hl, de
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld a, [hli]
ld [$d0cc], a
ld a, [hli]
ld [$d0cd], a
pop af
ld [rSVBK], a ; $ff00+$70
ld a, $1
ld [hCGBPalUpdate], a ; $ff00+$e5
ret
.asm_e47a3
ld hl, $b
add hl, bc
inc [hl]
call Functione4687
Functione47ab: ; e47ab (39:47ab)
ret
; e47ac (39:47ac)
Unknown_e47ac: ; e47ac
; Ditto's color as it turns into the Game Freak logo.
; Fade from pink to orange.
; One color per step.
RGB 23, 12, 28
RGB 23, 12, 27
RGB 23, 13, 26
RGB 23, 13, 24
RGB 24, 14, 22
RGB 24, 14, 20
RGB 24, 15, 18
RGB 24, 15, 16
RGB 25, 16, 14
RGB 25, 16, 12
RGB 25, 17, 10
RGB 25, 17, 08
RGB 26, 18, 06
RGB 26, 18, 04
RGB 26, 19, 02
RGB 26, 19, 00
;' e47cc
GameFreakLogo: ; e47cc
INCBIN "gfx/splash/logo.1bpp"
; e48ac
Functione48ac: ; e48ac
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld a, [$ffaa]
push af
ld a, [$ff9e]
push af
call Functione4901
Functione48bc: ; e48bc
call Functiona57
ld a, [$ffa9]
and $f
jr nz, .asm_e48db
ld a, [$cf63]
bit 7, a
jr nz, .asm_e48e1
call Functione490f
callba Function8cf69
call DelayFrame
jp Functione48bc
.asm_e48db
ld de, MUSIC_NONE
call PlayMusic
.asm_e48e1
call WhiteBGMap
call ClearSprites
call ClearTileMap
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
pop af
ld [$ff9e], a
pop af
ld [$ffaa], a
pop af
ld [rSVBK], a
ret
; e4901
Functione4901: ; e4901
xor a
ld [$ff9e], a
ld a, $1
ld [$ffaa], a
xor a
ld [$ffde], a
ld [$cf63], a
ret
; e490f
Functione490f: ; e490f
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, IntroScenes
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; e491e
IntroScenes: ; e491e (39:491e)
dw IntroScene1
dw IntroScene2
dw IntroScene3
dw IntroScene4
dw IntroScene5
dw IntroScene6
dw IntroScene7
dw IntroScene8
dw IntroScene9
dw IntroScene10
dw IntroScene11
dw IntroScene12
dw IntroScene13
dw IntroScene14
dw IntroScene15
dw IntroScene16
dw IntroScene17
dw IntroScene18
dw IntroScene19
dw IntroScene20
dw IntroScene21
dw IntroScene22
dw IntroScene23
dw IntroScene24
dw IntroScene25
dw IntroScene26
dw IntroScene27
dw IntroScene28
NextIntroScene: ; e4956 (39:4956)
ld hl, $cf63
inc [hl]
ret
IntroScene1: ; e495b (39:495b)
; Setup the next scene.
call Functione54a3
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, IntroTilemap001
ld de, $9800
call Functione54fa
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, IntroUnownsGFX
ld de, $9000
call Functione54c2
ld hl, IntroPulseGFX
ld de, $8000
call Functione54c2
ld hl, IntroTilemap002
ld de, $9800
call Functione54fa
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unknown_e65ad
ld de, Unkn1Pals ; $d000
ld bc, $80
call CopyBytes
ld hl, Unknown_e65ad
ld de, BGPals ; $d080
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
xor a
ld [hSCX], a ; $ff00+$cf
ld [hSCY], a ; $ff00+$d0
ld a, $7
ld [hWX], a ; $ff00+$d1
ld a, $90
ld [hWY], a ; $ff00+$d2
callba Function8cf53
call Functione549e
xor a
ld [$cf64], a
ld [$cf65], a
call NextIntroScene
ret
IntroScene2: ; e49d6 (39:49d6)
; First Unown (A) fades in, pulses, then fades out.
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $80
jr nc, .asm_e49f9
cp $60
jr nz, .asm_e49f1
push af
ld de, $5858
call Functione51dc
ld de, SFX_INTRO_UNOWN_1
call PlaySFX
pop af
.asm_e49f1
ld [$cf65], a
xor a
call Functione5223
ret
.asm_e49f9
call NextIntroScene
ret
IntroScene3: ; e49fd (39:49fd)
; More setup. Transition to the outdoor scene.
call Functione54a3
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, IntroTilemap003
ld de, $9800
call Functione54fa
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, IntroBackgroundGFX
ld de, $9000
call Functione54c2
ld hl, IntroTilemap004
ld de, $9800
call Functione54fa
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unknown_e5edd
ld de, Unkn1Pals ; $d000
ld bc, $80
call CopyBytes
ld hl, Unknown_e5edd
ld de, BGPals ; $d080
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
xor a
ld [hSCX], a ; $ff00+$cf
ld [hSCY], a ; $ff00+$d0
ld a, $7
ld [hWX], a ; $ff00+$d1
ld a, $90
ld [hWY], a ; $ff00+$d2
call Functione5516
call Functione549e
xor a
ld [$cf64], a
call NextIntroScene
ret
IntroScene4: ; e4a69 (39:4a69)
; Scroll the outdoor panorama for a bit.
call Functione552f
ld hl, $cf64
ld a, [hl]
cp $80
jr z, .asm_e4a76
inc [hl]
ret
.asm_e4a76
call NextIntroScene
ret
IntroScene5: ; e4a7a (39:4a7a)
; Go back to the Unown.
call Functione54a3
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld [hLCDStatCustom], a ; $ff00+$c6
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, IntroTilemap005
ld de, $9800
call Functione54fa
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, IntroUnownsGFX
ld de, $9000
call Functione54c2
ld hl, IntroPulseGFX
ld de, $8000
call Functione54c2
ld hl, IntroTilemap006
ld de, $9800
call Functione54fa
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unknown_e65ad
ld de, Unkn1Pals ; $d000
ld bc, $80
call CopyBytes
ld hl, Unknown_e65ad
ld de, BGPals ; $d080
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
xor a
ld [hSCX], a ; $ff00+$cf
ld [hSCY], a ; $ff00+$d0
ld a, $7
ld [hWX], a ; $ff00+$d1
ld a, $90
ld [hWY], a ; $ff00+$d2
callba Function8cf53
call Functione549e
xor a
ld [$cf64], a
ld [$cf65], a
call NextIntroScene
ret
IntroScene6: ; e4af7 (39:4af7)
; Two more Unown (I, H) fade in.
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $80
jr nc, .asm_e4b3b
cp $60
jr z, .asm_e4b24
cp $40
jr nc, .asm_e4b32
cp $20
jr z, .asm_e4b0e
jr .asm_e4b1c
.asm_e4b0e
push af
ld de, $3878
call Functione51dc
ld de, SFX_INTRO_UNOWN_2
call PlaySFX
pop af
.asm_e4b1c
ld [$cf65], a
xor a
call Functione5223
ret
.asm_e4b24
push af
ld de, $7030
call Functione51dc
ld de, SFX_INTRO_UNOWN_1
call PlaySFX
pop af
.asm_e4b32
ld [$cf65], a
ld a, $1
call Functione5223
ret
.asm_e4b3b
call NextIntroScene
ret
IntroScene7: ; e4b3f (39:4b3f)
; Back to the outdoor scene.
call Functione54a3
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, IntroTilemap003
ld de, $9800
call Functione54fa
ld hl, IntroPichuWooperGFX
ld de, $8000
call Functione54c2
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, IntroSuicuneRunGFX
ld de, $8000
call Functione54de
ld hl, IntroBackgroundGFX
ld de, $9000
call Functione54c2
ld hl, IntroTilemap004
ld de, $9800
call Functione54fa
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unknown_e5edd
ld de, Unkn1Pals ; $d000
ld bc, $80
call CopyBytes
ld hl, Unknown_e5edd
ld de, BGPals ; $d080
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
xor a
ld [hSCX], a ; $ff00+$cf
ld [hSCY], a ; $ff00+$d0
ld a, $7
ld [hWX], a ; $ff00+$d1
ld a, $90
ld [hWY], a ; $ff00+$d2
call Functione5516
callba Function8cf53
ld de, $6cd8
ld a, $26
call Function3b2a
ld a, $f0
ld [$c3c0], a
call Functione549e
xor a
ld [$cf64], a
ld [$cf65], a
call NextIntroScene
ret
IntroScene8: ; e4bd3 (39:4bd3)
; Scroll the scene, then show Suicune running across the screen.
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $40
jr z, .asm_e4be2
jr nc, .asm_e4be8
call Functione552f
ret
.asm_e4be2
ld de, SFX_INTRO_SUICUNE_3
call PlaySFX
.asm_e4be8
ld a, [$c3c0]
and a
jr z, .asm_e4bf4
sub $8
ld [$c3c0], a
ret
.asm_e4bf4
ld de, SFX_INTRO_SUICUNE_2
call PlaySFX
callba Function8d03d
call NextIntroScene
ret
IntroScene9: ; e4c04 (39:4c04)
; Set up the next scene (same bg).
xor a
ld [hLCDStatCustom], a ; $ff00+$c6
call ClearSprites
ld hl, AttrMap ; $cdd9
ld bc, $f0
ld a, $1
call ByteFill
ld bc, $3c
ld a, $2
call ByteFill
ld bc, $3c
ld a, $3
call ByteFill
ld a, $2
ld [hBGMapMode], a ; $ff00+$d4
call DelayFrame
call DelayFrame
call DelayFrame
ld a, $c
ld [hBGMapAddress], a ; $ff00+$d6
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld [hBGMapAddress], a ; $ff00+$d6
ld [$c3c0], a
xor a
ld [$cf64], a
call NextIntroScene
ret
IntroScene10: ; e4c4f (39:4c4f)
; Wooper and Pichu enter.
call Functione546d
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $c0
jr z, .done
cp $20
jr z, .wooper
cp $40
jr z, .pichu
ret
.pichu
lb de, $a9, $80
ld a, $27
call Function3b2a
ld de, SFX_INTRO_PICHU
call PlaySFX
ret
.wooper
lb de, $b0, $30
ld a, $28
call Function3b2a
ld de, SFX_INTRO_PICHU
call PlaySFX
ret
.done
call NextIntroScene
ret
IntroScene11: ; e4c86 (39:4c86)
; Back to Unown again.
call Functione54a3
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld [hLCDStatCustom], a ; $ff00+$c6
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, IntroTilemap007
ld de, $9800
call Functione54fa
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, IntroUnownsGFX
ld de, $9000
call Functione54c2
ld hl, IntroTilemap008
ld de, $9800
call Functione54fa
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unknown_e65ad
ld de, Unkn1Pals ; $d000
ld bc, $80
call CopyBytes
ld hl, Unknown_e65ad
ld de, BGPals ; $d080
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
xor a
ld [hSCX], a ; $ff00+$cf
ld [hSCY], a ; $ff00+$d0
ld a, $7
ld [hWX], a ; $ff00+$d1
ld a, $90
ld [hWY], a ; $ff00+$d2
callba Function8cf53
call Functione549e
xor a
ld [$cf64], a
ld [$cf65], a
call NextIntroScene
ret
IntroScene12: ; e4cfa (39:4cfa)
; Even more Unown.
call Functione4d36
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $c0
jr nc, .asm_e4d32
cp $80
jr nc, .asm_e4d1d
ld c, a
and $1f
sla a
ld [$cf65], a
ld a, c
and $e0
srl a
swap a
call Functione5223
ret
.asm_e4d1d
ld c, a
and $f
sla a
sla a
ld [$cf65], a
ld a, c
and $70
or $40
swap a
call Functione5223
ret
.asm_e4d32
call NextIntroScene
ret
Functione4d36: ; e4d36 (39:4d36)
ld a, [$cf64]
ld c, a
ld hl, Unknown_e4d54
.asm_e4d3d
ld a, [hli]
cp $ff
ret z
cp c
jr z, .asm_e4d48
inc hl
inc hl
jr .asm_e4d3d
.asm_e4d48
ld a, [hli]
ld d, [hl]
ld e, a
push de
call SFXChannelsOff
pop de
call PlaySFX
ret
; e4d54 (39:4d54)
Unknown_e4d54: ; e4d54
dbw $00, SFX_INTRO_UNOWN_3
dbw $20, SFX_INTRO_UNOWN_2
dbw $40, SFX_INTRO_UNOWN_1
dbw $60, SFX_INTRO_UNOWN_2
dbw $80, SFX_INTRO_UNOWN_3
dbw $90, SFX_INTRO_UNOWN_2
dbw $a0, SFX_INTRO_UNOWN_1
dbw $b0, SFX_INTRO_UNOWN_2
db $ff
; e4d6d
IntroScene13: ; e4d6d (39:4d6d)
; Switch scenes again.
call Functione54a3
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, IntroTilemap003
ld de, $9800
call Functione54fa
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, IntroSuicuneRunGFX
ld de, $8000
call Functione54de
ld hl, IntroBackgroundGFX
ld de, $9000
call Functione54c2
ld hl, IntroTilemap004
ld de, $9800
call Functione54fa
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unknown_e5edd
ld de, Unkn1Pals ; $d000
ld bc, $80
call CopyBytes
ld hl, Unknown_e5edd
ld de, BGPals ; $d080
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
xor a
ld [hSCX], a ; $ff00+$cf
ld [hSCY], a ; $ff00+$d0
ld a, $7
ld [hWX], a ; $ff00+$d1
ld a, $90
ld [hWY], a ; $ff00+$d2
callba Function8cf53
lb de, $6c, $58
ld a, $26
call Function3b2a
ld de, MUSIC_CRYSTAL_OPENING
call PlayMusic
xor a
ld [$c3c0], a
call Functione549e
xor a
ld [$cf64], a
ld [$cf65], a
call NextIntroScene
ret
IntroScene14: ; e4dfa (39:4dfa)
; Suicune runs then jumps.
ld a, [hSCX] ; $ff00+$cf
sub 10
ld [hSCX], a ; $ff00+$cf
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $80
jr z, .done
cp $60
jr z, .jump
jr nc, .asm_e4e1a
cp $40
jr nc, .asm_e4e33
ret
.jump
ld de, SFX_INTRO_SUICUNE_4
call PlaySFX
.asm_e4e1a
ld a, $1
ld [$cf65], a
ld a, [$c3c0]
cp $88
jr c, .asm_e4e2c
sub $8
ld [$c3c0], a
ret
.asm_e4e2c
callba Function8d03d
ret
.asm_e4e33
ld a, [$c3c0]
sub $2
ld [$c3c0], a
ret
.done
call NextIntroScene
ret
IntroScene15: ; e4e40 (39:4e40)
; Transition to a new scene.
call Functione54a3
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, IntroTilemap009
ld de, $9800
call Functione54fa
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, IntroSuicuneJumpGFX
ld de, $9000
call Functione54c2
ld hl, IntroUnownBackGFX
ld de, $8000
call Functione54c2
ld de, GFX_e7a5d
ld hl, $8800
lb bc, BANK(GFX_e7a5d), 1
call Request2bpp
ld hl, IntroTilemap010
ld de, $9800
call Functione54fa
call Functione541b
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unknown_e77dd
ld de, Unkn1Pals ; $d000
ld bc, $80
call CopyBytes
ld hl, Unknown_e77dd
ld de, BGPals ; $d080
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
xor a
ld [hSCX], a ; $ff00+$cf
ld a, $90
ld [hSCY], a ; $ff00+$d0
ld a, $7
ld [hWX], a ; $ff00+$d1
ld a, $90
ld [hWY], a ; $ff00+$d2
callba Function8cf53
call Functione549e
lb de, $40, $28
ld a, $2a
call Function3b2a
lb de, $60, $00
ld a, $2b
call Function3b2a
xor a
ld [$cf64], a
ld [$cf65], a
call NextIntroScene
ret
IntroScene16: ; e4edc (39:4edc)
; Suicune shows its face. An Unown appears in front.
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $80
jr nc, .done
call Functione5441
ld a, [hSCY] ; $ff00+$d0
and a
ret z
add 8
ld [hSCY], a ; $ff00+$d0
ret
.done
call NextIntroScene
ret
IntroScene17: ; e4ef5 (39:4ef5)
; ...
call Functione54a3
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, IntroTilemap011
ld de, $9800
call Functione54fa
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, IntroSuicuneCloseGFX
ld de, $8800
call Functione54de
ld hl, IntroTilemap012
ld de, $9800
call Functione54fa
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unknown_e6d6d
ld de, Unkn1Pals ; $d000
ld bc, $80
call CopyBytes
ld hl, Unknown_e6d6d
ld de, BGPals ; $d080
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
xor a
ld [hSCX], a ; $ff00+$cf
ld [hSCY], a ; $ff00+$d0
ld a, $7
ld [hWX], a ; $ff00+$d1
ld a, $90
ld [hWY], a ; $ff00+$d2
callba Function8cf53
call Functione549e
xor a
ld [$cf64], a
ld [$cf65], a
call NextIntroScene
ret
IntroScene18: ; e4f67 (39:4f67)
; Suicune close up.
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $60
jr nc, .done
ld a, [hSCX] ; $ff00+$cf
cp $60
ret z
add 8
ld [hSCX], a ; $ff00+$cf
ret
.done
call NextIntroScene
ret
IntroScene19: ; e4f7e (39:4f7e)
; More setup.
call Functione54a3
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, IntroTilemap013
ld de, $9800
call Functione54fa
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, IntroSuicuneBackGFX
ld de, $9000
call Functione54c2
ld hl, IntroUnownsGFX
ld de, $8800
call Functione54c2
ld de, GFX_e7a5d
ld hl, $8ff0
lb bc, BANK(GFX_e7a5d), 1
call Request2bpp
ld hl, IntroTilemap014
ld de, $9800
call Functione54fa
call Functione541b
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unknown_e77dd
ld de, Unkn1Pals ; $d000
ld bc, $80
call CopyBytes
ld hl, Unknown_e77dd
ld de, BGPals ; $d080
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
xor a
ld [hSCX], a ; $ff00+$cf
ld a, $d8
ld [hSCY], a ; $ff00+$d0
ld a, $7
ld [hWX], a ; $ff00+$d1
ld a, $90
ld [hWY], a ; $ff00+$d2
callba Function8cf53
ld hl, $c300
xor a
ld [hli], a
ld [hl], $7f
call Functione549e
lb de, $60, $00
ld a, $2b
call Function3b2a
xor a
ld [$cf64], a
ld [$cf65], a
call NextIntroScene
ret
IntroScene20: ; e5019 (39:5019)
; Suicune running away. A bunch of Unown appear.
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $98
jr nc, .asm_e5059
cp $58
ret nc
cp $40
jr nc, .asm_e5032
cp $28
ret nc
ld a, [hSCY] ; $ff00+$d0
inc a
ld [hSCY], a ; $ff00+$d0
ret
.asm_e5032
sub $18
ld c, a
and $3
cp $3
ret nz
ld a, c
and $1c
srl a
srl a
ld [$cf65], a
xor a
call Functione5348
ret
; e5049 (39:5049)
ld a, c
and $1c
srl a
srl a
ld [$cf65], a
ld a, 1
call Functione5348
ret
.asm_e5059
call NextIntroScene
ret
IntroScene21: ; e505d (39:505d)
; Suicune gets more distant and turns black.
call Functione5451
ld c, $3
call DelayFrames
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld [$cf64], a
ld [$cf65], a
call NextIntroScene
ret
IntroScene22: ; e5072 (39:5072)
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $8
jr nc, .done
ret
.done
callba Function8d03d
call NextIntroScene
ret
IntroScene23: ; e5086 (39:5086)
xor a
ld [$cf64], a
call NextIntroScene
ret
IntroScene24: ; e508e (39:508e)
; Fade to white.
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $20
jr nc, .done
ld c, a
and $3
ret nz
ld a, c
and $1c
sla a
call Functione5172
ret
.done
ld a, $40
ld [$cf64], a
call NextIntroScene
ret
IntroScene25: ; e50ad (39:50ad)
; Wait around a bit.
ld a, [$cf64]
dec a
jr z, .done
ld [$cf64], a
ret
.done
call NextIntroScene
ret
IntroScene26: ; e50bb (39:50bb)
; Load the final scene.
call WhiteBGMap
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, IntroTilemap015
ld de, $9800
call Functione54fa
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, IntroCrystalUnownsGFX
ld de, $9000
call Functione54c2
ld hl, IntroTilemap017
ld de, $9800
call Functione54fa
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, Unknown_e679d
ld de, Unkn1Pals ; $d000
ld bc, $80
call CopyBytes
ld hl, Unknown_e679d
ld de, BGPals ; $d080
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
xor a
ld [hSCX], a ; $ff00+$cf
ld [hSCY], a ; $ff00+$d0
ld a, $7
ld [hWX], a ; $ff00+$d1
ld a, $90
ld [hWY], a ; $ff00+$d2
callba Function8cf53
call Functione549e
xor a
ld [$cf64], a
ld [$cf65], a
call NextIntroScene
ret
IntroScene27: ; e512d (39:512d)
; Spell out C R Y S T A L with Unown.
ld hl, $cf65
inc [hl]
ld hl, $cf64
ld a, [hl]
inc [hl]
cp $80
jr nc, .done
ld c, a
and $f
ld [$cf65], a
ld a, c
and $70
swap a
call Functione539d
ret
.done
call NextIntroScene
ld a, $80
ld [$cf64], a
ret
IntroScene28: ; e5152 (39:5152)
; Cut out when the music ends, and lead into the title screen.
ld hl, $cf64
ld a, [hl]
and a
jr z, .done
dec [hl]
cp $18
jr z, .clear
cp $8
ret nz
ld de, SFX_UNKNOWN_CB
call PlaySFX
ret
.clear
call WhiteBGMap
ret
.done
ld hl, $cf63
set 7, [hl]
ret
Functione5172: ; e5172 (39:5172)
ld hl, Unknown_e519c
add l
ld l, a
ld a, $0
adc h
ld h, a
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld de, BGPals ; $d080
ld b, $8
.asm_e5187
push hl
ld c, $8
.asm_e518a
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .asm_e518a
pop hl
dec b
jr nz, .asm_e5187
pop af
ld [rSVBK], a ; $ff00+$70
ld a, $1
ld [hCGBPalUpdate], a ; $ff00+$e5
ret
; e519c (39:519c)
Unknown_e519c: ; e519c
; Fade to white.
RGB 24, 12, 09
RGB 31, 31, 31
RGB 12, 00, 31
RGB 00, 00, 00
RGB 31, 19, 05
RGB 31, 31, 31
RGB 15, 05, 31
RGB 07, 07, 07
RGB 31, 21, 09
RGB 31, 31, 31
RGB 18, 09, 31
RGB 11, 11, 11
RGB 31, 23, 13
RGB 31, 31, 31
RGB 21, 13, 31
RGB 15, 15, 15
RGB 31, 25, 17
RGB 31, 31, 31
RGB 25, 17, 31
RGB 19, 19, 19
RGB 31, 27, 21
RGB 31, 31, 31
RGB 27, 21, 31
RGB 23, 23, 23
RGB 31, 29, 25
RGB 31, 31, 31
RGB 29, 26, 31
RGB 27, 27, 27
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
; e51dc
Functione51dc: ; e51dc (39:51dc)
push de
ld a, $29
call Function3b2a
ld hl, $c
add hl, bc
ld [hl], $8
ld a, $3c
call Function3b3c
pop de
push de
ld a, $29
call Function3b2a
ld hl, $c
add hl, bc
ld [hl], $18
ld a, $3b
call Function3b3c
pop de
push de
ld a, $29
call Function3b2a
ld hl, $c
add hl, bc
ld [hl], $28
ld a, $39
call Function3b3c
pop de
ld a, $29
call Function3b2a
ld hl, $c
add hl, bc
ld [hl], $38
ld a, $3a
call Function3b3c
ret
Functione5223: ; e5223 (39:5223)
add a
add a
add a
ld e, a
ld d, $0
ld hl, BGPals ; $d080
add hl, de
inc hl
inc hl
ld a, [$cf65]
and $3f
cp $1f
jr z, .asm_e523e
jr c, .asm_e523e
ld c, a
ld a, $3f
sub c
.asm_e523e
ld c, a
ld b, $0
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
push hl
push bc
ld hl, BGPals ; $d080
ld bc, $40
xor a
call ByteFill
pop bc
pop hl
push hl
ld hl, Unknown_e5288
add hl, bc
add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
ld a, e
ld [hli], a
ld a, d
ld [hli], a
push hl
ld hl, Unknown_e52c8
add hl, bc
add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
ld a, e
ld [hli], a
ld a, d
ld [hli], a
push hl
ld hl, Unknown_e5308
add hl, bc
add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
ld a, e
ld [hli], a
ld a, d
ld [hli], a
pop af
ld [rSVBK], a ; $ff00+$70
ld a, $1
ld [hCGBPalUpdate], a ; $ff00+$e5
ret
; e5288 (39:5288)
Unknown_e5288: ; e5288
; Fade between black and white.
hue = 0
rept 32
RGB hue, hue, hue
hue = hue + 1
endr
; e52c8
Unknown_e52c8: ; e52c8
; Fade between black and light blue.
hue = 0
rept 32
RGB 0, hue / 2, hue
hue = hue + 1
endr
; e5308
Unknown_e5308: ; e5308
; Fade between black and blue.
hue = 0
rept 32
RGB 0, 0, hue
hue = hue + 1
endr
; e5348
Functione5348: ; e5348 (39:5348)
and a
jr nz, .asm_e5350
ld hl, Palette_e538d
jr .asm_e5353
.asm_e5350
ld hl, Palette_e5395
.asm_e5353
ld a, [$cf65]
and $7
add a
add a
add a
ld c, a
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
push bc
ld de, BGPals ; $d080
ld a, c
add e
ld e, a
ld a, $0
adc d
ld d, a
ld bc, $8
call CopyBytes
pop bc
ld de, Unkn1Pals ; $d000
ld a, c
add e
ld e, a
ld a, $0
adc d
ld d, a
ld bc, $8
call CopyBytes
pop af
ld [rSVBK], a ; $ff00+$70
ld a, $1
ld [hCGBPalUpdate], a ; $ff00+$e5
ret
; e538d (39:538d)
Palette_e538d: ; e538d
RGB 24, 12, 09
RGB 31, 31, 31
RGB 12, 00, 31
RGB 00, 00, 00
; e5395
Palette_e5395: ; e5395
RGB 24, 12, 09
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
; e539d
Functione539d: ; e539d (39:539d)
add a
add a
add a
ld e, a
ld d, $0
ld hl, BGPals ; $d080
add hl, de
inc hl
inc hl
inc hl
inc hl
ld a, [$cf65]
add a
ld c, a
ld b, $0
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
push hl
ld hl, Palette_e53db
add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
ld a, e
ld [hli], a
ld a, d
ld [hli], a
push hl
ld hl, Palette_e53fb
add hl, bc
ld a, [hli]
ld d, [hl]
ld e, a
pop hl
ld a, e
ld [hli], a
ld a, d
ld [hli], a
pop af
ld [rSVBK], a ; $ff00+$70
ld a, $1
ld [hCGBPalUpdate], a ; $ff00+$e5
ret
; e53db (39:53db)
Palette_e53db: ; e53db
hue = 31
rept 8
RGB hue, hue, hue
hue = hue + -1
RGB hue, hue, hue
hue = hue + -2
endr
; e53fb
Palette_e53fb: ; e53fb
hue = 31
rept 16
RGB hue, hue, hue
hue = hue + -1
endr
; e541b
Functione541b: ; e541b (39:541b)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $6
ld [rSVBK], a ; $ff00+$70
ld hl, Unkn1Pals ; $d000
ld de, TileMap ; $c4a0 (aliases: SpritesEnd)
ld b, $12
.asm_e542a
ld c, $14
.asm_e542c
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .asm_e542c
ld a, $c
add l
ld l, a
ld a, $0
adc h
ld h, a
dec b
jr nz, .asm_e542a
pop af
ld [rSVBK], a ; $ff00+$70
ret
Functione5441: ; e5441 (39:5441)
ld a, [$cf64]
and $3
jr z, Functione5451
cp $3
jr z, .asm_e544d
ret
.asm_e544d
xor a
ld [hBGMapMode], a ; $ff00+$d4
ret
Functione5451: ; e5451 (39:5451)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
.asm_e5457
ld a, [hl]
and a
jr z, .asm_e5462
cp $80
jr nc, .asm_e5462
xor $8
ld [hl], a
.asm_e5462
inc hl
dec bc
ld a, c
or b
jr nz, .asm_e5457
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
Functione546d: ; e546d (39:546d)
ld a, [$cf64]
cp $24
ret nc
and $c
srl a
ld e, a
ld d, $0
ld hl, Unknown_e5496
add hl, de
ld a, [hli]
ld [$cf68], a
ld a, [hli]
ld [$cf69], a
ld a, $90
ld [$cf6a], a
ld a, $90
ld [$cf6b], a
ld a, $4
ld [$cf67], a
ret
; e5496 (39:5496)
Unknown_e5496: ; e5496
dw Unknown_e799d
dw Unknown_e79dd
dw Unknown_e7a1d
dw Unknown_e79dd
; e549e
Functione549e: ; e549e (39:549e)
ld a, $1
ld [hCGBPalUpdate], a ; $ff00+$e5
ret
Functione54a3: ; e54a3 (39:54a3)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, BGPals ; $d080
ld bc, $80
xor a
call ByteFill
pop af
ld [rSVBK], a ; $ff00+$70
ld a, $1
ld [hCGBPalUpdate], a ; $ff00+$e5
call DelayFrame
call DelayFrame
ret
Functione54c2: ; e54c2 (39:54c2)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $6
ld [rSVBK], a ; $ff00+$70
push de
ld de, Unkn1Pals ; $d000
call Decompress
pop hl
ld de, Unkn1Pals ; $d000
ld bc, $180
call Request2bpp
pop af
ld [rSVBK], a ; $ff00+$70
ret
Functione54de: ; e54de (39:54de)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $6
ld [rSVBK], a ; $ff00+$70
push de
ld de, Unkn1Pals ; $d000
call Decompress
pop hl
ld de, Unkn1Pals ; $d000
ld bc, $1ff
call Request2bpp
pop af
ld [rSVBK], a ; $ff00+$70
ret
Functione54fa: ; e54fa (39:54fa)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $6
ld [rSVBK], a ; $ff00+$70
push de
ld de, Unkn1Pals ; $d000
call Decompress
pop hl
ld de, Unkn1Pals ; $d000
ld bc, $140
call Request2bpp
pop af
ld [rSVBK], a ; $ff00+$70
ret
Functione5516: ; e5516 (39:5516)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, LYOverrides
ld bc, $90
xor a
call ByteFill
pop af
ld [rSVBK], a ; $ff00+$70
ld a, $43
ld [hLCDStatCustom], a ; $ff00+$c6
ret
Functione552f: ; e552f (39:552f)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld a, [$cf64]
and $1
jr z, .asm_e5548
ld hl, LYOverrides
ld a, [hl]
inc a
ld bc, $5f
call ByteFill
.asm_e5548
ld hl, $d15f
ld a, [hl]
inc a
inc a
ld bc, $31
call ByteFill
ld a, [LYOverrides + 0]
ld [hSCX], a ; $ff00+$cf
pop af
ld [rSVBK], a ; $ff00+$70
ret
IntroSuicuneRunGFX: ; e555d
INCBIN "gfx/intro/suicune_run.2bpp.lz"
; e592d
IntroPichuWooperGFX: ; e592d
INCBIN "gfx/intro/pichu_wooper.2bpp.lz"
; e5c7d
IntroBackgroundGFX: ; e5c7d
INCBIN "gfx/intro/background.2bpp.lz"
; e5e6d
IntroTilemap004: ; e5e6d
INCBIN "gfx/intro/004.tilemap.lz"
; e5ecd
IntroTilemap003: ; e5ecd
INCBIN "gfx/intro/003.tilemap.lz"
; e5edd
Unknown_e5edd: ; e5edd
INCBIN "baserom.gbc", $e5edd, $e5f5d - $e5edd
IntroUnownsGFX: ; e5f5d
INCBIN "gfx/intro/unowns.2bpp.lz"
; e634d
IntroPulseGFX: ; e634d
INCBIN "gfx/intro/pulse.2bpp.lz"
; e63dd
IntroTilemap002: ; e63dd
INCBIN "gfx/intro/002.tilemap.lz"
; e641d
IntroTilemap001: ; e641d
INCBIN "gfx/intro/001.tilemap.lz"
; e642d
IntroTilemap006: ; e642d
INCBIN "gfx/intro/006.tilemap.lz"
; e647d
IntroTilemap005: ; e647d
INCBIN "gfx/intro/005.tilemap.lz"
; e649d
IntroTilemap008: ; e649d
INCBIN "gfx/intro/008.tilemap.lz"
; e655d
IntroTilemap007: ; e655d
INCBIN "gfx/intro/007.tilemap.lz"
; e65ad
Unknown_e65ad: ; e65ad
INCBIN "baserom.gbc", $e65ad, $e662d - $e65ad
IntroCrystalUnownsGFX: ; e662d
INCBIN "gfx/intro/crystal_unowns.2bpp.lz"
; e672d
IntroTilemap017: ; e672d
INCBIN "gfx/intro/017.tilemap.lz"
; e676d
IntroTilemap015: ; e676d
INCBIN "gfx/intro/015.tilemap.lz"
; e679d
Unknown_e679d: ; e679d
INCBIN "baserom.gbc", $e679d, $e681d - $e679d
IntroSuicuneCloseGFX: ; e681d
INCBIN "gfx/intro/suicune_close.2bpp.lz"
; e6c3d
IntroTilemap012: ; e6c3d
INCBIN "gfx/intro/012.tilemap.lz"
; e6d0d
IntroTilemap011: ; e6d0d
INCBIN "gfx/intro/011.tilemap.lz"
; e6d6d
Unknown_e6d6d: ; e6d6d
INCBIN "baserom.gbc", $e6d6d, $e6ded - $e6d6d
IntroSuicuneJumpGFX: ; e6ded
INCBIN "gfx/intro/suicune_jump.2bpp.lz"
; e72ad
IntroSuicuneBackGFX: ; e72ad
INCBIN "gfx/intro/suicune_back.2bpp.lz"
; e764d
IntroTilemap010: ; e764d
INCBIN "gfx/intro/010.tilemap.lz"
; e76ad
IntroTilemap009: ; e76ad
INCBIN "gfx/intro/009.tilemap.lz"
; e76bd
IntroTilemap014: ; e76bd
INCBIN "gfx/intro/014.tilemap.lz"
; e778d
IntroTilemap013: ; e778d
INCBIN "gfx/intro/013.tilemap.lz"
; e77dd
Unknown_e77dd: ; e77dd
INCBIN "baserom.gbc", $e77dd, $e785d - $e77dd
IntroUnownBackGFX: ; e785d
INCBIN "gfx/intro/unown_back.2bpp.lz"
; e799d
Unknown_e799d: ; e799d
INCBIN "baserom.gbc", $e799d, $e79dd - $e799d
Unknown_e79dd: ; e79dd
INCBIN "baserom.gbc", $e79dd, $e7a1d - $e79dd
Unknown_e7a1d: ; e7a1d
INCBIN "baserom.gbc", $e7a1d, $e7a5d - $e7a1d
GFX_e7a5d: ; e7a5d
INCBIN "baserom.gbc", $e7a5d, $e7a6d - $e7a5d
SECTION "bank3E", ROMX, BANK[$3E]
FontExtra:
INCBIN "gfx/misc/font_extra.2bpp"
Font:
INCBIN "gfx/misc/font.w128.1bpp"
FontBattleExtra:
INCBIN "gfx/misc/font_battle_extra.2bpp"
Frames: ; f8800
INCBIN "gfx/frames/1.1bpp"
INCBIN "gfx/frames/2.1bpp"
INCBIN "gfx/frames/3.1bpp"
INCBIN "gfx/frames/4.1bpp"
INCBIN "gfx/frames/5.1bpp"
INCBIN "gfx/frames/6.1bpp"
INCBIN "gfx/frames/7.1bpp"
INCBIN "gfx/frames/8.1bpp"
INCBIN "gfx/frames/9.1bpp"
; f89b0
; TODO: Various misc graphics here.
GFX_f89b0: ; f89b0
INCBIN "baserom.gbc", $f89b0, $f8a90 - $f89b0
; f8a90
ShinyIcon: ; f8a90
INCBIN "gfx/stats/shiny.2bpp"
GFX_f8aa0: ; f8aa0
INCBIN "baserom.gbc", $f8aa0, $f8ac0 - $f8aa0
; f8ac0
GFX_f8ac0: ; f8ac0
INCBIN "baserom.gbc", $f8ac0, $f8ae0 - $f8ac0
; f8ae0
GFX_f8ae0: ; f8ae0
INCBIN "baserom.gbc", $f8ae0, $f8b10 - $f8ae0
; f8b10
GFX_f8b10: ; f8b10
INCBIN "baserom.gbc", $f8b10, $f8ba0 - $f8b10
; f8ba0
TownMapGFX: ; f8ba0
INCBIN "gfx/misc/town_map.2bpp.lz"
; f8ea4
GFX_f8ea4: ; f8ea4
INCBIN "baserom.gbc", $f8ea4, $f8f24 - $f8ea4
; f8f24
GFX_f8f24: ; f8f24
INCBIN "baserom.gbc", $f8f24, $f8f34 - $f8f24
; f8f34
GFX_f8f34: ; f8f34
INCBIN "baserom.gbc", $f8f34, $f9204 - $f8f34
; f9204
GFX_f9204: ; f9204
INCBIN "baserom.gbc", $f9204, $f9214 - $f9204
; f9214
GFX_f9214: ; f9214
INCBIN "baserom.gbc", $f9214, $f9344 - $f9214
; f9344
GFX_f9344: ; f9344
INCBIN "baserom.gbc", $f9344, $f9424 - $f9344
; f9424
GFX_f9424: ; f9424
INCBIN "baserom.gbc", $f9424, $f9434 - $f9424
; f9434
Footprints: ; f9434
INCBIN "gfx/misc/footprints.w128.1bpp"
; fb434
INCBIN "baserom.gbc", $fb434, $fb449 - $fb434
Functionfb449:: ; fb449
ld de, Font
ld hl, VTiles1
lb bc, BANK(Font), $400 / 8
ld a, [rLCDC]
bit 7, a
jp z, Copy1bpp
ld de, Font
ld hl, VTiles1
lb bc, BANK(Font), $100 / 8
call Functionddc
ld de, Font + $100
ld hl, VTiles1 + $200
lb bc, BANK(Font), $100 / 8
call Functionddc
ld de, Font + $200
ld hl, VTiles1 + $400
lb bc, BANK(Font), $100 / 8
call Functionddc
ld de, Font + $300
ld hl, VTiles1 + $600
lb bc, BANK(Font), $100 / 8
call Functionddc
ret
; fb48a
Functionfb48a:: ; fb48a
ld de, GFX_f9214
ld hl, $9600
lb bc, BANK(GFX_f9214), 1
call Functionddc
ld de, GFX_f8f24
ld hl, $9620
lb bc, BANK(GFX_f8f24), 1
call Functiondc9
ld de, FontExtra + $30
ld hl, $9630
lb bc, BANK(FontExtra), $16
call Functiondc9
jr Functionfb4cc
; fb4b0
Functionfb4b0:: ; fb4b0
ld de, GFX_f9424
ld hl, $9610
ld b, BANK(GFX_f9424)
ld c, 1
call Functiondc9
ret
; fb4be
Functionfb4be:: ; fb4be
ld de, FontBattleExtra
ld hl, $9600
lb bc, BANK(FontBattleExtra), $19
call Functiondc9
jr Functionfb4cc
; fb4cc
Functionfb4cc: ; fb4cc
ld a, [TextBoxFrame]
and 7
ld bc, $0030
ld hl, Frames
call AddNTimes
ld d, h
ld e, l
ld hl, $9790
lb bc, BANK(Frames), 6
call Functionddc
ld hl, $97f0
ld de, GFX_f9204
lb bc, BANK(GFX_f9204), 1
call Functionddc
ret
; fb4f2
Functionfb4f2: ; fb4f2
ld de, FontBattleExtra
ld hl, $9600
lb bc, BANK(FontBattleExtra), $c
call Functiondc9
ld hl, $9700
ld de, FontBattleExtra + $100
lb bc, BANK(FontBattleExtra), 3
call Functiondc9
call Functionfb4cc
Functionfb50d: ; fb50d
ld de, GFX_f8ac0
ld hl, $96c0
lb bc, BANK(GFX_f8ac0), 4
call Functionddc
ld de, GFX_f8ae0
ld hl, $9730
lb bc, BANK(GFX_f8ae0), 6
call Functionddc
ld de, GFX_f8b10
ld hl, $9550
lb bc, BANK(GFX_f8b10), 9
call Functiondc9
ld de, GFX_f9214 + $90
ld hl, $95e0
lb bc, BANK(GFX_f9214), 2
call Functiondc9
ret
; fb53e
Functionfb53e: ; fb53e
call Functionfb4be
ld de, GFX_f8ac0
ld hl, $96c0
lb bc, BANK(GFX_f8ac0), 4
call Functionddc
ld de, GFX_f8ae0
ld hl, $9780
lb bc, BANK(GFX_f8ae0), 1
call Functionddc
ld de, GFX_f8ae0 + $18
ld hl, $9760
lb bc, BANK(GFX_f8ae0), 2
call Functionddc
ld de, GFX_f8b10
ld hl, $9550
lb bc, BANK(GFX_f8b10), 8
call Functiondc9
Functionfb571: ; fb571
ld de, GFX_f89b0
ld hl, $9310
lb bc, BANK(GFX_f89b0), $11
call Functiondc9
ret
; fb57e
Functionfb57e: ; fb57e
ld a, [$d003]
ld hl, OTPartyMon1Species
call GetPartyLocation
push hl
ld a, [$d003]
inc a
ld c, a
ld b, 0
ld hl, OTPartyCount
add hl, bc
ld a, [hl]
pop hl
cp EGG
jr z, .asm_fb59c
cp [hl]
jr nz, .asm_fb5db
.asm_fb59c
ld b, h
ld c, l
ld hl, OTPartyMon1Level - OTPartyMon1
add hl, bc
ld a, [hl]
cp 101
jr nc, .asm_fb5db
ld a, [InLinkBattle]
cp $1
jr nz, .asm_fb5d9
ld hl, OTPartySpecies
ld a, [$d003]
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
; Magnemite and Magneton's types changed
; from Electric to Electric/Steel.
cp MAGNEMITE
jr z, .asm_fb5d9
cp MAGNETON
jr z, .asm_fb5d9
ld [CurSpecies], a
call GetBaseData
ld hl, $cbea
add hl, bc
add hl, bc
ld a, [BaseType1]
cp [hl]
jr nz, .asm_fb5db
inc hl
ld a, [BaseType2]
cp [hl]
jr nz, .asm_fb5db
.asm_fb5d9
and a
ret
.asm_fb5db
scf
ret
; fb5dd
Functionfb5dd: ; fb5dd
ld a, [DefaultFlypoint]
ld d, a
ld a, [PartyCount]
ld b, a
ld c, $0
.asm_fb5e7
ld a, c
cp d
jr z, .asm_fb5f8
push bc
ld a, c
ld hl, PartyMon1HP
call GetPartyLocation
pop bc
ld a, [hli]
or [hl]
jr nz, .asm_fb60b
.asm_fb5f8
inc c
dec b
jr nz, .asm_fb5e7
ld a, [$d003]
ld hl, OTPartyMon1HP
call GetPartyLocation
ld a, [hli]
or [hl]
jr nz, .asm_fb60b
scf
ret
.asm_fb60b
and a
ret
; fb60d
Functionfb60d: ; fb60d
hlcoord 4, 0
ld de, PlayerName
call PlaceString
ld a, $14
ld [bc], a
hlcoord 4, 8
ld de, $d26b
call PlaceString
ld a, $14
ld [bc], a
hlcoord 7, 1
ld de, PartySpecies
call Functionfb634
hlcoord 7, 9
ld de, OTPartySpecies
Functionfb634: ; fb634
ld c, $0
.asm_fb636
ld a, [de]
cp $ff
ret z
ld [$d265], a
push bc
push hl
push de
push hl
ld a, c
ld [hProduct], a
call GetPokemonName
pop hl
call PlaceString
pop de
inc de
pop hl
ld bc, $0014
add hl, bc
pop bc
inc c
jr .asm_fb636
; fb656
KantoMonSpecials: ; fb656
; The original special base stat for
; each Kanto monster from Red/Blue.
db 65 ; BULBASAUR
db 80 ; IVYSAUR
db 100 ; VENUSAUR
db 50 ; CHARMANDER
db 65 ; CHARMELEON
db 85 ; CHARIZARD
db 50 ; SQUIRTLE
db 65 ; WARTORTLE
db 85 ; BLASTOISE
db 20 ; CATERPIE
db 25 ; METAPOD
db 80 ; BUTTERFREE
db 20 ; WEEDLE
db 25 ; KAKUNA
db 45 ; BEEDRILL
db 35 ; PIDGEY
db 50 ; PIDGEOTTO
db 70 ; PIDGEOT
db 25 ; RATTATA
db 50 ; RATICATE
db 31 ; SPEAROW
db 61 ; FEAROW
db 40 ; EKANS
db 65 ; ARBOK
db 50 ; PIKACHU
db 90 ; RAICHU
db 30 ; SANDSHREW
db 55 ; SANDSLASH
db 40 ; NIDORAN_F
db 55 ; NIDORINA
db 75 ; NIDOQUEEN
db 40 ; NIDORAN_M
db 55 ; NIDORINO
db 75 ; NIDOKING
db 60 ; CLEFAIRY
db 85 ; CLEFABLE
db 65 ; VULPIX
db 100 ; NINETALES
db 25 ; JIGGLYPUFF
db 50 ; WIGGLYTUFF
db 40 ; ZUBAT
db 75 ; GOLBAT
db 75 ; ODDISH
db 85 ; GLOOM
db 100 ; VILEPLUME
db 55 ; PARAS
db 80 ; PARASECT
db 40 ; VENONAT
db 90 ; VENOMOTH
db 45 ; DIGLETT
db 70 ; DUGTRIO
db 40 ; MEOWTH
db 65 ; PERSIAN
db 50 ; PSYDUCK
db 80 ; GOLDUCK
db 35 ; MANKEY
db 60 ; PRIMEAPE
db 50 ; GROWLITHE
db 80 ; ARCANINE
db 40 ; POLIWAG
db 50 ; POLIWHIRL
db 70 ; POLIWRATH
db 105 ; ABRA
db 120 ; KADABRA
db 135 ; ALAKAZAM
db 35 ; MACHOP
db 50 ; MACHOKE
db 65 ; MACHAMP
db 70 ; BELLSPROUT
db 85 ; WEEPINBELL
db 100 ; VICTREEBEL
db 100 ; TENTACOOL
db 120 ; TENTACRUEL
db 30 ; GEODUDE
db 45 ; GRAVELER
db 55 ; GOLEM
db 65 ; PONYTA
db 80 ; RAPIDASH
db 40 ; SLOWPOKE
db 80 ; SLOWBRO
db 95 ; MAGNEMITE
db 120 ; MAGNETON
db 58 ; FARFETCH_D
db 35 ; DODUO
db 60 ; DODRIO
db 70 ; SEEL
db 95 ; DEWGONG
db 40 ; GRIMER
db 65 ; MUK
db 45 ; SHELLDER
db 85 ; CLOYSTER
db 100 ; GASTLY
db 115 ; HAUNTER
db 130 ; GENGAR
db 30 ; ONIX
db 90 ; DROWZEE
db 115 ; HYPNO
db 25 ; KRABBY
db 50 ; KINGLER
db 55 ; VOLTORB
db 80 ; ELECTRODE
db 60 ; EXEGGCUTE
db 125 ; EXEGGUTOR
db 40 ; CUBONE
db 50 ; MAROWAK
db 35 ; HITMONLEE
db 35 ; HITMONCHAN
db 60 ; LICKITUNG
db 60 ; KOFFING
db 85 ; WEEZING
db 30 ; RHYHORN
db 45 ; RHYDON
db 105 ; CHANSEY
db 100 ; TANGELA
db 40 ; KANGASKHAN
db 70 ; HORSEA
db 95 ; SEADRA
db 50 ; GOLDEEN
db 80 ; SEAKING
db 70 ; STARYU
db 100 ; STARMIE
db 100 ; MR__MIME
db 55 ; SCYTHER
db 95 ; JYNX
db 85 ; ELECTABUZZ
db 85 ; MAGMAR
db 55 ; PINSIR
db 70 ; TAUROS
db 20 ; MAGIKARP
db 100 ; GYARADOS
db 95 ; LAPRAS
db 48 ; DITTO
db 65 ; EEVEE
db 110 ; VAPOREON
db 110 ; JOLTEON
db 110 ; FLAREON
db 75 ; PORYGON
db 90 ; OMANYTE
db 115 ; OMASTAR
db 45 ; KABUTO
db 70 ; KABUTOPS
db 60 ; AERODACTYL
db 65 ; SNORLAX
db 125 ; ARTICUNO
db 125 ; ZAPDOS
db 125 ; MOLTRES
db 50 ; DRATINI
db 70 ; DRAGONAIR
db 100 ; DRAGONITE
db 154 ; MEWTWO
db 100 ; MEW
; fb6ed
INCLUDE "event/name_rater.asm"
Functionfb841: ; fb841
ld a, [ScriptVar]
call LoadCryHeader
jr c, .done
ld hl, CryPitch
ld a, [hli]
ld h, [hl]
ld l, a
ld bc, -$140
add hl, bc
ld a, l
ld [CryPitch], a
ld a, h
ld [CryPitch + 1], a
ld hl, CryLength
ld a, [hli]
ld h, [hl]
ld l, a
ld bc, $60
add hl, bc
ld a, l
ld [CryLength], a
ld a, h
ld [CryLength + 1], a
callba _PlayCryHeader
call WaitSFX
.done
ret
; fb877
Functionfb877: ; fb877
ld a, [$ffde]
push af
xor a
ld [$ffde], a
call LowVolume
call WhiteBGMap
call ClearTileMap
call Function1ad2
call ClearSprites
ld a, [$cf65]
push af
ld a, [hSCX]
add $5
ld [hSCX], a
xor a
ld [$cf65], a
callba Function41a7f
call Functiona80
ld a, $1
ld [$cf65], a
callba Function4424d
call Functiona80
pop af
ld [$cf65], a
call MaxVolume
call Function4b6
ld a, [hSCX]
add $fb
ld [hSCX], a
call Functionfb8c8
pop af
ld [$ffde], a
ret
; fb8c8
Functionfb8c8: ; fb8c8
call ClearTileMap
call Functione5f
call Functione51
callba Function40ab2
call Function3200
callba Function3da97
ld a, [hli]
ld [TempMonDVs], a
ld a, [hl]
ld [$d124], a
ld b, $1c
call GetSGBLayout
call Function32f9
ret
; fb8f1
Functionfb8f1: ; fb8f1
push bc
push hl
ld a, [$d265]
ld b, a
ld c, 0
ld hl, Unknown_fb91c
.asm_fb8fc
inc c
ld a, [hli]
cp b
jr nz, .asm_fb8fc
ld a, c
ld [$d265], a
pop hl
pop bc
ret
; fb908
Functionfb908: ; fb908
push bc
push hl
ld a, [$d265]
dec a
ld hl, Unknown_fb91c
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [$d265], a
pop hl
pop bc
ret
; fb91c
Unknown_fb91c: ; fb91c
db RHYDON
db KANGASKHAN
db NIDORAN_M
db CLEFAIRY
db SPEAROW
db VOLTORB
db NIDOKING
db SLOWBRO
db IVYSAUR
db EXEGGUTOR
db LICKITUNG
db EXEGGCUTE
db GRIMER
db GENGAR
db NIDORAN_F
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 SCIZOR
db SHUCKLE
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 HERACROSS
db MAGMAR
db HO_OH
db ELECTABUZZ
db MAGNETON
db KOFFING
db SNEASEL
db MANKEY
db SEEL
db DIGLETT
db TAUROS
db TEDDIURSA
db URSARING
db SLUGMA
db FARFETCH_D
db VENONAT
db DRAGONITE
db MAGCARGO
db SWINUB
db PILOSWINE
db DODUO
db POLIWAG
db JYNX
db MOLTRES
db ARTICUNO
db ZAPDOS
db DITTO
db MEOWTH
db KRABBY
db CORSOLA
db REMORAID
db OCTILLERY
db VULPIX
db NINETALES
db PIKACHU
db RAICHU
db DELIBIRD
db MANTINE
db DRATINI
db DRAGONAIR
db KABUTO
db KABUTOPS
db HORSEA
db SEADRA
db SKARMORY
db HOUNDOUR
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 HOUNDOOM
db DODRIO
db PRIMEAPE
db DUGTRIO
db VENOMOTH
db DEWGONG
db KINGDRA
db PHANPY
db CATERPIE
db METAPOD
db BUTTERFREE
db MACHAMP
db DONPHAN
db GOLDUCK
db HYPNO
db GOLBAT
db MEWTWO
db SNORLAX
db MAGIKARP
db PORYGON2
db STANTLER
db MUK
db SMEARGLE
db KINGLER
db CLOYSTER
db TYROGUE
db ELECTRODE
db CLEFABLE
db WEEZING
db PERSIAN
db MAROWAK
db HITMONTOP
db HAUNTER
db ABRA
db ALAKAZAM
db PIDGEOTTO
db PIDGEOT
db STARMIE
db BULBASAUR
db VENUSAUR
db TENTACRUEL
db SMOOCHUM
db GOLDEEN
db SEAKING
db ELEKID
db MAGBY
db MILTANK
db BLISSEY
db PONYTA
db RAPIDASH
db RATTATA
db RATICATE
db NIDORINO
db NIDORINA
db GEODUDE
db PORYGON
db AERODACTYL
db RAIKOU
db MAGNEMITE
db ENTEI
db SUICUNE
db CHARMANDER
db SQUIRTLE
db CHARMELEON
db WARTORTLE
db CHARIZARD
db LARVITAR
db PUPITAR
db TYRANITAR
db LUGIA
db ODDISH
db GLOOM
db VILEPLUME
db BELLSPROUT
db WEEPINBELL
db VICTREEBEL
db CHIKORITA
db BAYLEEF
db MEGANIUM
db CYNDAQUIL
db QUILAVA
db TYPHLOSION
db TOTODILE
db CROCONAW
db FERALIGATR
db SENTRET
db FURRET
db HOOTHOOT
db NOCTOWL
db LEDYBA
db LEDIAN
db SPINARAK
db ARIADOS
db CROBAT
db CHINCHOU
db LANTURN
db PICHU
db CLEFFA
db IGGLYBUFF
db TOGEPI
db TOGETIC
db NATU
db XATU
db MAREEP
db FLAAFFY
db AMPHAROS
db BELLOSSOM
db MARILL
db AZUMARILL
db SUDOWOODO
db POLITOED
db HOPPIP
db SKIPLOOM
db JUMPLUFF
db AIPOM
db SUNKERN
db SUNFLORA
db YANMA
db WOOPER
db QUAGSIRE
db ESPEON
db UMBREON
db MURKROW
db SLOWKING
db MISDREAVUS
db UNOWN
db WOBBUFFET
db GIRAFARIG
db PINECO
db FORRETRESS
db DUNSPARCE
db GLIGAR
db STEELIX
db SNUBBULL
db GRANBULL
db QWILFISH
db WOBBUFFET
db WOBBUFFET
; fba18
Functionfba18: ; fba18
ld a, [UnownLetter]
ld c, a
ld b, 26
ld hl, UnownDex
.asm_fba21
ld a, [hli]
and a
jr z, .asm_fba2b
cp c
ret z
dec b
jr nz, .asm_fba21
ret
.asm_fba2b
dec hl
ld [hl], c
ret
; fba2e
Functionfba2e: ; fba2e (3e:7a2e)
hlcoord 4, 15
ld bc, $c
ld a, $7f
call ByteFill
ld a, [$c7dd]
ld e, a
ld d, 0
ld hl, UnownDex ; $ded9
add hl, de
ld a, [hl]
ld e, a
ld d, 0
ld hl, UnownWords
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
hlcoord 4, 15
.asm_fba52
ld a, [de]
cp $ff
ret z
inc de
ld [hli], a
jr .asm_fba52
; fba5a (3e:7a5a)
UnownWords: ; fba5a
dw UnownWord1
dw UnownWord1
dw UnownWord2
dw UnownWord3
dw UnownWord4
dw UnownWord5
dw UnownWord6
dw UnownWord7
dw UnownWord8
dw UnownWord9
dw UnownWord10
dw UnownWord11
dw UnownWord12
dw UnownWord13
dw UnownWord14
dw UnownWord15
dw UnownWord16
dw UnownWord17
dw UnownWord18
dw UnownWord19
dw UnownWord20
dw UnownWord21
dw UnownWord22
dw UnownWord23
dw UnownWord24
dw UnownWord25
dw UnownWord26
; fba90
UnownWord1: db $40, $4d, $46, $51, $58, $ff ; ANGRY
UnownWord2: db $41, $44, $40, $51, $ff ; BEAR
UnownWord3: db $42, $47, $40, $52, $44, $ff ; CHASE
UnownWord4: db $43, $48, $51, $44, $42, $53, $ff ; DIRECT
UnownWord5: db $44, $4d, $46, $40, $46, $44, $ff ; ENGAGE
UnownWord6: db $45, $48, $4d, $43, $ff ; FIND
UnownWord7: db $46, $48, $55, $44, $ff ; GIVE
UnownWord8: db $47, $44, $4b, $4f, $ff ; HELP
UnownWord9: db $48, $4d, $42, $51, $44, $40, $52, $44, $ff ; INCREASE
UnownWord10: db $49, $4e, $48, $4d, $ff ; JOIN
UnownWord11: db $4a, $44, $44, $4f, $ff ; KEEP
UnownWord12: db $4b, $40, $54, $46, $47, $ff ; LAUGH
UnownWord13: db $4c, $40, $4a, $44, $ff ; MAKE
UnownWord14: db $4d, $54, $59, $59, $4b, $44, $ff ; NUZZLE
UnownWord15: db $4e, $41, $52, $44, $51, $55, $44, $ff ; OBSERVE
UnownWord16: db $4f, $44, $51, $45, $4e, $51, $4c, $ff ; PERFORM
UnownWord17: db $50, $54, $48, $42, $4a, $44, $4d, $ff ; QUICKEN
UnownWord18: db $51, $44, $40, $52, $52, $54, $51, $44, $ff ; REASSURE
UnownWord19: db $52, $44, $40, $51, $42, $47, $ff ; SEARCH
UnownWord20: db $53, $44, $4b, $4b, $ff ; TELL
UnownWord21: db $54, $4d, $43, $4e, $ff ; UNDO
UnownWord22: db $55, $40, $4d, $48, $52, $47, $ff ; VANISH
UnownWord23: db $56, $40, $4d, $53, $ff ; WANT
UnownWord24: db $57, $57, $57, $57, $57, $ff ; XXXXX
UnownWord25: db $58, $48, $44, $4b, $43, $ff ; YIELD
UnownWord26: db $59, $4e, $4e, $4c, $ff ; ZOOM
; fbb32
Functionfbb32: ; fbb32
callba Function50000
jr c, .asm_fbb9e
ld a, [CurPartySpecies]
cp MAGIKARP
jr nz, .asm_fbba4
ld a, [CurPartyMon]
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
call AddNTimes
push hl
ld bc, $0015
add hl, bc
ld d, h
ld e, l
pop hl
ld bc, $0006
add hl, bc
ld b, h
ld c, l
call CalcMagikarpLength
call Functionfbbdb
callba Function105f33
ld hl, $7ba9
call PrintText
ld hl, Buffer1
ld de, $dfe8
ld c, $2
call StringCmp
jr nc, .asm_fbb98
ld hl, Buffer1
ld de, $dfe8
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
ld a, [CurPartyMon]
ld hl, PartyMonOT
call SkipNames
call CopyBytes
ld a, $3
ld [ScriptVar], a
ret
.asm_fbb98
ld a, $2
ld [ScriptVar], a
ret
.asm_fbb9e
ld a, $1
ld [ScriptVar], a
ret
.asm_fbba4
xor a
ld [ScriptVar], a
ret
; fbba9
UnknownText_0xfbba9: ; 0xfbba9
; Let me measure that MAGIKARP. …Hm, it measures @ .
text_jump UnknownText_0x1c1203
db "@"
; 0xfbbae
Functionfbbae: ; fbbae
ld hl, $96e0
ld de, GFX_fbbbb
lb bc, BANK(GFX_fbbbb), $02
call Request2bpp
ret
; fbbbb
GFX_fbbbb: ; fbbb
INCBIN "baserom.gbc",$fbbbb,$fbbdb - $fbbbb
; fbbdb
Functionfbbdb: ; fbbdb
call Functionfbbae
ld hl, StringBuffer1
ld de, Buffer1
ld bc, $4102
call PrintNum
ld [hl], $6e
inc hl
ld de, Buffer2
ld bc, $4102
call PrintNum
ld [hl], $6f
inc hl
ld [hl], "@"
ret
; fbbfc
INCLUDE "battle/magikarp_length.asm"
Functionfbcd2: ; fbcd2
ld a, [$dfe8]
ld [Buffer1], a
ld a, [$dfe9]
ld [Buffer2], a
call Functionfbbdb
ld hl, UnknownText_0xfbce8
call PrintText
ret
; fbce8
UnknownText_0xfbce8: ; 0xfbce8
; "CURRENT RECORD"
text_jump UnknownText_0x1c123a
db "@"
; 0xfbced
INCLUDE "battle/hidden_power.asm"
Functionfbd54: ; fbd54
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, [hBattleTurn] ; $ff00+$e4
and a
jr z, .asm_fbd61
call Functionfbd96
jr .asm_fbd64
.asm_fbd61
call Functionfbd9d
.asm_fbd64
call ClearBox
jr Functionfbd91
Functionfbd69: ; fbd69 (3e:7d69)
callba BattleCommanda6
jr Functionfbd77
Functionfbd71: ; fbd71 (3e:7d71)
callba BattleCommanda7
Functionfbd77: ; fbd77 (3e:7d77)
xor a
ld [hBGMapMode], a ; $ff00+$d4
ld a, [hBattleTurn] ; $ff00+$e4
and a
jr z, .asm_fbd85
call Functionfbd96
xor a
jr .asm_fbd8a
.asm_fbd85
call Functionfbd9d
ld a, $31
.asm_fbd8a
ld [$FF00+$ad], a
predef FillBox
Functionfbd91: ; fbd91 (3e:7d91)
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
Functionfbd96: ; fbd96 (3e:7d96)
hlcoord 12, 0
ld bc, $707
ret
Functionfbd9d: ; fbd9d (3e:7d9d)
hlcoord 2, 6
ld bc, $606
ret
DoWeatherModifiers: ; fbda4
ld de, .WeatherTypeModifiers
ld a, [Weather]
ld b, a
ld a, [$d265] ; move type
ld c, a
.CheckWeatherType
ld a, [de]
inc de
cp $ff
jr z, .asm_fbdc0
cp b
jr nz, .NextWeatherType
ld a, [de]
cp c
jr z, .ApplyModifier
.NextWeatherType
inc de
inc de
jr .CheckWeatherType
.asm_fbdc0
ld de, .WeatherMoveModifiers
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
ld c, a
.CheckWeatherMove
ld a, [de]
inc de
cp $ff
jr z, .done
cp b
jr nz, .NextWeatherMove
ld a, [de]
cp c
jr z, .ApplyModifier
.NextWeatherMove
inc de
inc de
jr .CheckWeatherMove
.ApplyModifier
xor a
ld [hMultiplicand], a
ld hl, CurDamage
ld a, [hli]
ld [$ffb5], a
ld a, [hl]
ld [$ffb6], a
inc de
ld a, [de]
ld [hMultiplier], a
call Multiply
ld a, 10
ld [hMultiplier], a
ld b, $4
call Divide
ld a, [hMultiplicand]
and a
ld bc, $ffff
jr nz, .Update
ld a, [$ffb5]
ld b, a
ld a, [$ffb6]
ld c, a
or b
jr nz, .Update
ld bc, 1
.Update
ld a, b
ld [CurDamage], a
ld a, c
ld [CurDamage + 1], a
.done
ret
.WeatherTypeModifiers
db WEATHER_RAIN, WATER, 15
db WEATHER_RAIN, FIRE, 05
db WEATHER_SUN, FIRE, 15
db WEATHER_SUN, WATER, 05
db $ff
.WeatherMoveModifiers
db WEATHER_RAIN, EFFECT_SOLARBEAM, 05
db $ff
; fbe24
DoBadgeTypeBoosts: ; fbe24
ld a, [InLinkBattle]
and a
ret nz
ld a, [$cfc0]
and a
ret nz
ld a, [hBattleTurn]
and a
ret nz
push de
push bc
ld hl, .BadgeTypes
ld a, [KantoBadges]
ld b, a
ld a, [JohtoBadges]
ld c, a
.CheckBadge
ld a, [hl]
cp $ff
jr z, .done
srl b
rr c
jr nc, .NextBadge
ld a, [$d265] ; move type
cp [hl]
jr z, .ApplyBoost
.NextBadge
inc hl
jr .CheckBadge
.ApplyBoost
ld a, [CurDamage]
ld h, a
ld d, a
ld a, [CurDamage + 1]
ld l, a
ld e, a
srl d
rr e
srl d
rr e
srl d
rr e
ld a, e
or d
jr nz, .asm_fbe6f
ld e, 1
.asm_fbe6f
add hl, de
jr nc, .Update
ld hl, $ffff
.Update
ld a, h
ld [CurDamage], a
ld a, l
ld [$d257], a
.done
pop bc
pop de
ret
.BadgeTypes
db FLYING ; zephyrbadge
db BUG ; hivebadge
db NORMAL ; plainbadge
db GHOST ; fogbadge
db STEEL ; mineralbadge
db FIGHTING ; stormbadge
db ICE ; glacierbadge
db DRAGON ; risingbadge
db ROCK ; boulderbadge
db WATER ; cascadebadge
db ELECTRIC ; thunderbadge
db GRASS ; rainbowbadge
db POISON ; soulbadge
db PSYCHIC ; marshbadge
db FIRE ; volcanobadge
db GROUND ; earthbadge
db $ff
; fbe91
SECTION "bank3F", ROMX, BANK[$3F]
INCLUDE "tilesets/animations.asm"
; Trade struct
TRADE_DIALOG EQU 0
TRADE_GIVEMON EQU 1
TRADE_GETMON EQU 2
TRADE_NICK EQU 3
TRADE_DVS EQU 14
TRADE_ITEM EQU 16
TRADE_OT_ID EQU 17
TRADE_OT_NAME EQU 19
TRADE_GENDER EQU 30
TRADE_PADDING EQU 31
; Trade dialogs
TRADE_INTRO EQU 0
TRADE_CANCEL EQU 1
TRADE_WRONG EQU 2
TRADE_COMPLETE EQU 3
TRADE_AFTER EQU 4
NPCTrade:: ; fcba8
ld a, e
ld [$cf63], a
call Functionfcc59
ld b, CHECK_FLAG
call TradeFlagAction
ld a, TRADE_AFTER
jr nz, .done
ld a, TRADE_INTRO
call PrintTradeText
call YesNoBox
ld a, TRADE_CANCEL
jr c, .done
; Select givemon from party
ld b, $6
callba Function5001d
ld a, TRADE_CANCEL
jr c, .done
ld e, TRADE_GIVEMON
call GetTradeAttribute
ld a, [CurPartySpecies]
cp [hl]
ld a, TRADE_WRONG
jr nz, .done
call CheckTradeGender
ld a, TRADE_WRONG
jr c, .done
ld b, SET_FLAG
call TradeFlagAction
ld hl, ConnectLinkCableText
call PrintText
call Functionfcc63
call Functionfcc07
call GetTradeMonNames
ld hl, TradedForText
call PrintText
call RestartMapMusic
ld a, TRADE_COMPLETE
.done
call PrintTradeText
ret
; fcc07
Functionfcc07: ; fcc07
call Function2ed3
ld a, [$cf63]
push af
ld a, [$cf64]
push af
predef Function28f24
pop af
ld [$cf64], a
pop af
ld [$cf63], a
call Function2b74
ret
; fcc23
CheckTradeGender: ; fcc23
xor a
ld [MonType], a
ld e, TRADE_GENDER
call GetTradeAttribute
ld a, [hl]
and a
jr z, .asm_fcc46
cp 1
jr z, .asm_fcc3e
callba GetGender
jr nz, .asm_fcc48
jr .asm_fcc46
.asm_fcc3e
callba GetGender
jr z, .asm_fcc48
.asm_fcc46
and a
ret
.asm_fcc48
scf
ret
; fcc4a
TradeFlagAction: ; fcc4a
ld hl, $d960
ld a, [$cf63]
ld c, a
predef FlagPredef
ld a, c
and a
ret
; fcc59
Functionfcc59: ; fcc59
ld e, TRADE_DIALOG
call GetTradeAttribute
ld a, [hl]
ld [$cf64], a
ret
; fcc63
Functionfcc63: ; fcc63
ld e, TRADE_GIVEMON
call GetTradeAttribute
ld a, [hl]
ld [$c6d0], a
ld e, TRADE_GETMON
call GetTradeAttribute
ld a, [hl]
ld [$c702], a
ld a, [$c6d0]
ld de, $c6d1
call Functionfcde8
call Functionfcdf4
ld a, [$c702]
ld de, $c703
call Functionfcde8
call Functionfcdf4
ld hl, PartyMonOT
ld bc, $000b
call Functionfcdd7
ld de, $c6f2
call Functionfcdf4
ld hl, PlayerName
ld de, $c6e7
call Functionfcdf4
ld hl, PartyMon1ID
ld bc, PartyMon2 - PartyMon1
call Functionfcdd7
ld de, $c6ff
call Functionfce0f
ld hl, PartyMon1DVs
ld bc, PartyMon2 - PartyMon1
call Functionfcdd7
ld de, $c6fd
call Functionfce0f
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
call Functionfcdd7
ld b, h
ld c, l
callba GetCaughtGender
ld a, c
ld [$c701], a
ld e, TRADE_DIALOG
call GetTradeAttribute
ld a, [hl]
cp TRADE_COMPLETE
ld a, 1
jr c, .asm_fcce6
ld a, 2
.asm_fcce6
ld [$c733], a
ld hl, PartyMon1Level
ld bc, PartyMon2 - PartyMon1
call Functionfcdd7
ld a, [hl]
ld [CurPartyLevel], a
ld a, [$c702]
ld [CurPartySpecies], a
xor a
ld [MonType], a
ld [$d10b], a
callab Functione039
predef Functiond88c
ld e, TRADE_DIALOG
call GetTradeAttribute
ld a, [hl]
cp TRADE_COMPLETE
ld b, 0
jr c, .asm_fcd1c
ld b, 1
.asm_fcd1c
callba Function4dba3
ld e, TRADE_NICK
call GetTradeAttribute
ld de, $c70e
call Functionfcdf4
ld hl, PartyMonNicknames
ld bc, PKMN_NAME_LENGTH
call Functionfcdde
ld hl, $c70e
call Functionfcdf4
ld e, TRADE_OT_NAME
call GetTradeAttribute
push hl
ld de, $c724
call Functionfcdf4
pop hl
ld de, $c719
call Functionfcdf4
ld hl, PartyMonOT
ld bc, $000b
call Functionfcdde
ld hl, $c724
call Functionfcdf4
ld e, TRADE_DVS
call GetTradeAttribute
ld de, $c72f
call Functionfce0f
ld hl, PartyMon1DVs
ld bc, PartyMon2 - PartyMon1
call Functionfcdde
ld hl, $c72f
call Functionfce0f
ld e, TRADE_OT_ID
call GetTradeAttribute
ld de, $c732
call Functionfce15
ld hl, PartyMon1ID
ld bc, PartyMon2 - PartyMon1
call Functionfcdde
ld hl, $c731
call Functionfce0f
ld e, TRADE_ITEM
call GetTradeAttribute
push hl
ld hl, PartyMon1Item
ld bc, PartyMon2 - PartyMon1
call Functionfcdde
pop hl
ld a, [hl]
ld [de], a
push af
push bc
push de
push hl
ld a, [CurPartyMon]
push af
ld a, [PartyCount]
dec a
ld [CurPartyMon], a
callba Functione134
pop af
ld [CurPartyMon], a
pop hl
pop de
pop bc
pop af
ret
; fcdc2
GetTradeAttribute: ; 0xfcdc2
ld d, 0
push de
ld a, [$cf63]
and $f
swap a
ld e, a
ld d, 0
ld hl, NPCTrades
add hl, de
add hl, de
pop de
add hl, de
ret
; 0xfcdd7
Functionfcdd7: ; fcdd7
ld a, [CurPartyMon]
call AddNTimes
ret
; fcdde
Functionfcdde: ; fcdde
ld a, [PartyCount]
dec a
call AddNTimes
ld e, l
ld d, h
ret
; fcde8
Functionfcde8: ; fcde8
push de
ld [$d265], a
call GetBasePokemonName
ld hl, StringBuffer1
pop de
ret
; fcdf4
Functionfcdf4: ; fcdf4
ld bc, $000b
call CopyBytes
ret
; fcdfb
Functionfcdfb: ; fcdfb
ld bc, $0004
call CopyBytes
ld a, $50
ld [de], a
ret
; fce05
Functionfce05: ; fce05
ld bc, $0003
call CopyBytes
ld a, $50
ld [de], a
ret
; fce0f
Functionfce0f: ; fce0f
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
ret
; fce15
Functionfce15: ; fce15
ld a, [hli]
ld [de], a
dec de
ld a, [hl]
ld [de], a
ret
; fce1b
GetTradeMonNames: ; fce1b
ld e, TRADE_GETMON
call GetTradeAttribute
ld a, [hl]
call Functionfcde8
ld de, StringBuffer2
call Functionfcdf4
ld e, TRADE_GIVEMON
call GetTradeAttribute
ld a, [hl]
call Functionfcde8
ld de, $d050
call Functionfcdf4
ld hl, StringBuffer1
.next
ld a, [hli]
cp "@"
jr nz, .next
dec hl
push hl
ld e, TRADE_GENDER
call GetTradeAttribute
ld a, [hl]
pop hl
and a
ret z
cp 1
ld a, "♂"
jr z, .done
ld a, "♀"
.done
ld [hli], a
ld [hl], "@"
ret
; fce58
NPCTrades: ; fce58
db 0, ABRA, MACHOP, "MUSCLE@@@@@", $37, $66, GOLD_BERRY, $54, $92, "MIKE@@@@@@@", 0, 0
db 0, BELLSPROUT, ONIX, "ROCKY@@@@@@", $96, $66, BITTER_BERRY, $1e, $bf, "KYLE@@@@@@@", 0, 0
db 1, KRABBY, VOLTORB, "VOLTY@@@@@@", $98, $88, PRZCUREBERRY, $05, $72, "TIM@@@@@@@@", 0, 0
db 3, DRAGONAIR, DODRIO, "DORIS@@@@@@", $77, $66, SMOKE_BALL, $1b, $01, "EMY@@@@@@@@", 2, 0
db 2, HAUNTER, XATU, "PAUL@@@@@@@", $96, $86, MYSTERYBERRY, $00, $3d, "CHRIS@@@@@@", 0, 0
db 3, CHANSEY, AERODACTYL, "AEROY@@@@@@", $96, $66, GOLD_BERRY, $7b, $67, "KIM@@@@@@@@", 0, 0
db 0, DUGTRIO, MAGNETON, "MAGGIE@@@@@", $96, $66, METAL_COAT, $a2, $c3, "FOREST@@@@@", 0, 0
; fcf38
PrintTradeText: ; fcf38
push af
call GetTradeMonNames
pop af
ld bc, 2 * 4
ld hl, TradeTexts
call AddNTimes
ld a, [$cf64]
ld c, a
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
call PrintText
ret
; fcf53
TradeTexts: ; fcf53
; intro
dw TradeIntroText1
dw TradeIntroText2
dw TradeIntroText3
dw TradeIntroText4
; cancel
dw TradeCancelText1
dw TradeCancelText2
dw TradeCancelText3
dw TradeCancelText4
; wrong mon
dw TradeWrongText1
dw TradeWrongText2
dw TradeWrongText3
dw TradeWrongText4
; completed
dw TradeCompleteText1
dw TradeCompleteText2
dw TradeCompleteText3
dw TradeCompleteText4
; after
dw TradeAfterText1
dw TradeAfterText2
dw TradeAfterText3
dw TradeAfterText4
; fcf7b
ConnectLinkCableText: ; 0xfcf7b
; OK, connect the Game Link Cable.
text_jump UnknownText_0x1bd407
db "@"
; 0xfcf80
TradedForText: ; 0xfcf80
; traded givemon for getmon
text_jump UnknownText_0x1bd429
start_asm
ld de, MUSIC_NONE
call PlayMusic
call DelayFrame
ld hl, .done
ret
.done
; sound0x0A
; interpret_data
text_jump UnknownText_0x1bd445
db "@"
; 0xfcf97
TradeIntroText1: ; 0xfcf97
; I collect #MON. Do you have @ ? Want to trade it for my @ ?
text_jump UnknownText_0x1bd449
db "@"
; 0xfcf9c
TradeCancelText1: ; 0xfcf9c
; You don't want to trade? Aww…
text_jump UnknownText_0x1bd48c
db "@"
; 0xfcfa1
TradeWrongText1: ; 0xfcfa1
; Huh? That's not @ . What a letdown…
text_jump UnknownText_0x1bd4aa
db "@"
; 0xfcfa6
TradeCompleteText1: ; 0xfcfa6
; Yay! I got myself @ ! Thanks!
text_jump UnknownText_0x1bd4d2
db "@"
; 0xfcfab
TradeAfterText1: ; 0xfcfab
; Hi, how's my old @ doing?
text_jump UnknownText_0x1bd4f4
db "@"
; 0xfcfb0
TradeIntroText2:
TradeIntroText3: ; 0xfcfb0
; Hi, I'm looking for this #MON. If you have @ , would you trade it for my @ ?
text_jump UnknownText_0x1bd512
db "@"
; 0xfcfb5
TradeCancelText2:
TradeCancelText3: ; 0xfcfb5
; You don't have one either? Gee, that's really disappointing…
text_jump UnknownText_0x1bd565
db "@"
; 0xfcfba
TradeWrongText2:
TradeWrongText3: ; 0xfcfba
; You don't have @ ? That's too bad, then.
text_jump UnknownText_0x1bd5a1
db "@"
; 0xfcfbf
TradeCompleteText2: ; 0xfcfbf
; Great! Thank you! I finally got @ .
text_jump UnknownText_0x1bd5cc
db "@"
; 0xfcfc4
TradeAfterText2: ; 0xfcfc4
; Hi! The @ you traded me is doing great!
text_jump UnknownText_0x1bd5f4
db "@"
; 0xfcfc9
TradeIntroText4: ; 0xfcfc9
; 's cute, but I don't have it. Do you have @ ? Want to trade it for my @ ?
text_jump UnknownText_0x1bd621
db "@"
; 0xfcfce
TradeCancelText4: ; 0xfcfce
; You don't want to trade? Oh, darn…
text_jump UnknownText_0x1bd673
db "@"
; 0xfcfd3
TradeWrongText4: ; 0xfcfd3
; That's not @ . Please trade with me if you get one.
text_jump UnknownText_0x1bd696
db "@"
; 0xfcfd8
TradeCompleteText4: ; 0xfcfd8
; Wow! Thank you! I always wanted @ !
text_jump UnknownText_0x1bd6cd
db "@"
; 0xfcfdd
TradeAfterText4: ; 0xfcfdd
; How is that @ I traded you doing? Your @ 's so cute!
text_jump UnknownText_0x1bd6f5
db "@"
; 0xfcfe2
TradeCompleteText3: ; 0xfcfe2
; Uh? What happened?
text_jump UnknownText_0x1bd731
db "@"
; 0xfcfe7
TradeAfterText3: ; 0xfcfe7
; Trading is so odd… I still have a lot to learn about it.
text_jump UnknownText_0x1bd745
db "@"
; 0xfcfec
Functionfcfec:: ; fcfec
ld a, [$d45c]
and a
ret nz
call Function2d05
and a
ret nz
xor a
ld [$dc18], a
call Functionfd044
ret nc
call Functionfd0c3
ret nc
ld b, BANK(UnknownScript_0xfd00f)
ld de, UnknownScript_0xfd00f
callba Function97c4f
scf
ret
; fd00f
UnknownScript_0xfd00f: ; 0xfd00f
3callasm Functionfd017
3jump UnknownScript_0x90241
; 0xfd017
Functionfd017: ; fd017
call Functionfd0a6
call Functionfd0eb
ld a, [$dc18]
and a
jr nz, .asm_fd027
ld hl, $dc17
inc [hl]
.asm_fd027
ld a, $1
ld [$dbf9], a
ld bc, $d03f
ld hl, $0
add hl, bc
ld [hl], $0
inc hl
ld [hl], $1
ld hl, $9
add hl, bc
ld a, $3f
ld [hli], a
ld a, e
ld [hli], a
ld a, d
ld [hl], a
ret
; fd044
Functionfd044: ; fd044
ld a, [$dc17]
cp $a
jr nc, .asm_fd065
call Functionfd117
ld a, [hli]
ld [$ffc3], a
ld a, [hli]
ld [$ffc4], a
ld a, [hli]
ld [$ffc5], a
ld de, $d851
ld bc, $ffc3
callba Function1600b
jr nc, .asm_fd067
.asm_fd065
jr .asm_fd069
.asm_fd067
scf
ret
.asm_fd069
ld hl, $ffc3
ld [hl], $0
inc hl
ld [hl], $8
inc hl
ld [hl], $fc
.asm_fd074
ld de, $dc19
ld bc, $d851
callba Function1600b
jr z, .asm_fd08b
jr nc, .asm_fd089
call Functionfd099
jr .asm_fd074
.asm_fd089
xor a
ret
.asm_fd08b
call Functionfd099
ld a, 5
call RandomRange
inc a
ld [$dc18], a
scf
ret
; fd099
Functionfd099: ; fd099
ld de, $dc19
ld bc, $ffc3
callba Function16053
ret
; fd0a6
Functionfd0a6: ; fd0a6 (3f:50a6)
call Functionfd117
ld de, $3
add hl, de
ld a, [hli]
ld [$FF00+$c3], a
ld a, [hli]
ld [$FF00+$c4], a
ld a, [hli]
ld [$FF00+$c5], a
ld de, $d851
ld bc, $ffc3
callba Function15ffa
ret
Functionfd0c3: ; fd0c3
call Functionfd117
ld de, $0006
add hl, de
ld a, [hli]
cp $1
jr z, .asm_fd0db
ld a, [hl]
ld c, a
ld b, $1
callba Function26ef1
scf
ret
.asm_fd0db
ld a, [hl]
ld [CurItem], a
ld a, $1
ld [$d10c], a
ld hl, PCItems
call ReceiveItem
ret
; fd0eb
Functionfd0eb: ; fd0eb (3f:50eb)
call Functionfd117
ld de, $6
add hl, de
ld a, [hli]
ld de, UnknownScript_0xfd0fd
cp $1
ret z
ld de, UnknownScript_0xfd10a
ret
; fd0fd (3f:50fd)
UnknownScript_0xfd0fd: ; 0xfd0fd
2writetext UnknownText_0xfd1b1
2writetext UnknownText_0xfd1b6
2writetext UnknownText_0xfd1bb
2writetext UnknownText_0xfd1c0
end
; 0xfd10a
UnknownScript_0xfd10a: ; 0xfd10a
2writetext UnknownText_0xfd1b1
2writetext UnknownText_0xfd1c5
2writetext UnknownText_0xfd1bb
2writetext UnknownText_0xfd1ca
end
; 0xfd117
Functionfd117: ; fd117
ld a, [$dc18]
and a
jr z, .asm_fd123
dec a
ld de, Unknown_fd136
jr .asm_fd12e
.asm_fd123
ld a, [$dc17]
cp $a
jr c, .asm_fd12b
xor a
.asm_fd12b
ld de, Unknown_fd15e
.asm_fd12e
ld l, a
ld h, 0
add hl, hl
add hl, hl
add hl, hl
add hl, de
ret
; fd136
Unknown_fd136: ; fd136
db $00, $00, $00, $00, $02, $58, $01, SUPER_POTION
db $00, $00, $00, $00, $00, $5a, $01, ANTIDOTE
db $00, $00, $00, $00, $00, $b4, $01, POKE_BALL
db $00, $00, $00, $00, $01, $c2, $01, ESCAPE_ROPE
db $00, $00, $00, $00, $01, $f4, $01, GREAT_BALL
; fd15e
Unknown_fd15e: ; fd15e
db $00, $03, $84, $00, $02, $58, $01, SUPER_POTION
db $00, $0f, $a0, $00, $01, $0e, $01, REPEL
db $00, $1b, $58, $00, $02, $58, $01, SUPER_POTION
db $00, $27, $10, $00, $07, $08, $02, $23 ; CHARMANDER_DOLL
db $00, $3a, $98, $00, $0b, $b8, $01, MOON_STONE
db $00, $4a, $38, $00, $02, $58, $01, SUPER_POTION
db $00, $75, $30, $00, $12, $c0, $02, $20 ; CLEFAIRY_DOLL
db $00, $9c, $40, $00, $03, $84, $01, HYPER_POTION
db $00, $c3, $50, $00, $1f, $40, $02, $1e ; PIKACHU_DOLL
db $01, $86, $a0, $00, $59, $10, $02, $1a ; SNORLAX_DOLL
; fd1ae
INCBIN "baserom.gbc", $fd1ae, $fd1b1 - $fd1ae
UnknownText_0xfd1b1: ; 0xfd1b1
; Hi, ! How are you?
text_jump UnknownText_0x1bc615
db "@"
; 0xfd1b6
UnknownText_0xfd1b6: ; 0xfd1b6
; I found a useful item shopping, so
text_jump UnknownText_0x1bc62a
db "@"
; 0xfd1bb
UnknownText_0xfd1bb: ; 0xfd1bb
; I bought it with your money. Sorry!
text_jump UnknownText_0x1bc64e
db "@"
; 0xfd1c0
UnknownText_0xfd1c0: ; 0xfd1c0
; It's in your PC. You'll like it!
text_jump UnknownText_0x1bc673
db "@"
; 0xfd1c5
UnknownText_0xfd1c5: ; 0xfd1c5
; While shopping today, I saw this adorable doll, so
text_jump UnknownText_0x1bc693
db "@"
; 0xfd1ca
UnknownText_0xfd1ca: ; 0xfd1ca
; It's in your room. You'll love it!
text_jump UnknownText_0x1bc6c7
db "@"
; 0xfd1cf
INCBIN "baserom.gbc", $fd1cf, $fd1d0 - $fd1cf
Functionfd1d0: ; fd1d0
ret
; fd1d1
INCBIN "baserom.gbc", $fd1d1, $fd1d2 - $fd1d1
SECTION "bank40", ROMX, BANK[$40]
Function100000: ; 100000
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
call Function100022
call Function1000ba
call Function100675
call Function100057
call Function10016f
call Function100276
push bc
call Function100301
pop bc
pop af
ld [rSVBK], a
ret
; 100022
Function100022: ; 100022
push de
push bc
call Function100063
pop bc
pop de
ld a, d
ld [$cd21], a
ld a, e
ld [CreditsTimer], a
ld a, c
ld [$cd23], a
ld a, b
ld [$cd24], a
callba Function10127e
callba Function106462
callba Function106464
callba Function11615a
ld hl, VramState
set 1, [hl]
ret
; 100057
Function100057: ; 100057
call Function1000a4
call Function222a
ld hl, VramState
res 1, [hl]
ret
; 100063
Function100063: ; 100063
xor a
ld hl, BGMapBuffer
ld bc, $0065
call ByteFill
xor a
ld hl, $c300
ld bc, $100
call ByteFill
ld a, [rIE]
ld [BGMapBuffer], a
xor a
ld [$ffde], a
ld [hLCDStatCustom], a
ret
; 100082
Function100082: ; 100082
xor a
ld hl, OverworldMap
ld bc, 1300
call ByteFill
di
call DoubleSpeed
xor a
ld [rIF], a
ld a, 1 << VBLANK + 1 << LCD_STAT + 1 << TIMER + 1 << SERIAL
ld [rIE], a
xor a
ld [$ffde], a
ld [hLCDStatCustom], a
ld a, $1
ld [$ffc9], a
ld [$ffe9], a
ei
ret
; 0x1000a4
Function1000a4: ; 1000a4
di
xor a
ld [$ffc9], a
ld [$ffe9], a
xor a
ld [$ff9e], a
call NormalSpeed
xor a
ld [rIF], a
ld a, [BGMapBuffer]
ld [rIE], a
ei
ret
; 1000ba
Function1000ba: ; 1000ba
.asm_1000ba
ld hl, $cd23
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [$cd25]
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [CreditsTimer]
call GetFarHalfword
ld a, [CreditsTimer]
rst FarCall
call Function1000e8
call Function1000fa
call Function100144
call Function100163
ld a, [$cd2b]
and a
jr z, .asm_1000ba
call DelayFrame
ret
; 1000e8
Function1000e8: ; 1000e8
ld hl, $cd29
bit 7, [hl]
ret z
callba Function115dd3
ld hl, $cd29
set 6, [hl]
ret
; 1000fa
Function1000fa: ; 1000fa
ld a, [$c30d]
and a
ret z
ld hl, $cd29
bit 4, [hl]
ret z
ld a, [$cd2b]
and a
jr nz, .asm_100117
callba Function11619d
ld hl, $cd29
set 6, [hl]
ret
.asm_100117
di
xor a
ld [rIF], a
ld a, [rIE]
and $13
ld [rIE], a
xor a
ld [$ffc9], a
ld [$ffe9], a
ei
ld a, [InLinkBattle]
push af
xor a
ld [InLinkBattle], a
ld a, $4
ld [$c319], a
callba Function11619d
ld hl, $cd29
set 6, [hl]
pop af
ld [InLinkBattle], a
ret
; 100144
Function100144: ; 100144
ld hl, $cd29
bit 5, [hl]
jr z, .asm_100155
res 5, [hl]
res 2, [hl]
res 6, [hl]
call Function100320
ret
.asm_100155
bit 2, [hl]
ret z
res 2, [hl]
res 6, [hl]
callba Function10402d
ret
; 100163
Function100163: ; 100163
ld hl, $cd29
bit 6, [hl]
ret z
res 6, [hl]
call DelayFrame
ret
; 10016f
Function10016f: ; 10016f
ld a, [$cd2b]
cp $1
ret z
cp $2
ret z
cp $ff
jp z, .asm_1001f5
cp $fe
jr z, .asm_1001c4
cp $f5
jr z, .asm_1001e7
cp $f6
jr z, .asm_1001b6
cp $fa
jp z, .asm_1001bd
cp $f7
jp z, .asm_1001ee
cp $f4
jr z, .asm_1001d2
cp $f3
jr z, .asm_1001cb
cp $f1
jr z, .asm_1001c4
cp $f2
jr z, .asm_1001c4
cp $fc
jr z, .asm_1001e6
cp $fb
jr z, .asm_1001af
cp $f8
ret z
ret
.asm_1001af
ld a, $d7
ld de, $0000
jr .asm_1001d7
.asm_1001b6
ld a, $d5
ld de, $0000
jr .asm_1001d7
.asm_1001bd
ld a, $d6
ld de, $0000
jr .asm_1001d7
.asm_1001c4
ld a, $d2
ld de, $0002
jr .asm_1001d7
.asm_1001cb
ld a, $d1
ld de, $0001
jr .asm_1001d7
.asm_1001d2
ld a, $d0
ld de, $0000
.asm_1001d7
ld [$c300], a
ld a, d
ld [$c302], a
ld a, e
ld [$c301], a
call Function10020b
ret
.asm_1001e6
ret
.asm_1001e7
ld de, String10025e
call Function100232
ret
.asm_1001ee
ld de, String10024d
call Function100232
ret
.asm_1001f5
ld a, [$cd2c]
ld [$c300], a
ld a, [$cd2d]
ld [$c302], a
ld a, [$cd2d]
ld [$c301], a
call Function10020b
ret
; 10020b
Function10020b: ; 10020b
xor a
ld [$c303], a
callba Function8c084
callba Function106464
call HideSprites
call DelayFrame
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
callba Function17f555
pop af
ld [rSVBK], a
ret
; 100232
Function100232: ; 100232
push de
callba Function106464
call Function3f20
call Function1ad2
hlcoord 1, 2
pop de
call PlaceString
call Function100320
call Functiona36
ret
; 10024d
String10024d: ; 10024d
db "つうしんを キャンセル しました@"
; 10025e
String10025e: ; 10025e
db "おともだちと えらんだ へやが"
next "ちがうようです@"
; 100276
Function100276: ; 100276
ld a, [$cd2b]
cp $1
jr z, .asm_10029f
cp $2
jr z, .asm_100296
cp $f5
jr z, .asm_1002a5
cp $f6
jr z, .asm_1002a5
cp $f7
jr z, .asm_100293
cp $f8
jr z, .asm_1002b1
jr .asm_1002c0
.asm_100293
ld c, $2
ret
.asm_100296
callba Script_reloadmappart
ld c, $4
ret
.asm_10029f
call Function1002dc
ld c, $0
ret
.asm_1002a5
callba Script_reloadmappart
call Function1002ed
ld c, $3
ret
.asm_1002b1
call Function1002c9
call Function1002dc
ld de, String10024d
call Function100232
ld c, $2
ret
.asm_1002c0
call Function1002c9
call Function1002dc
ld c, $1
ret
; 1002c9
Function1002c9: ; 1002c9
ld hl, $cd2a
bit 0, [hl]
ret z
callba Function3f6d0
callba Function1500c
ret
; 1002dc
Function1002dc: ; 1002dc
ld a, $f8
ld [$ff9f], a
callba RunMapSetupScript
xor a
ld [$ff9f], a
call Functione51
ret
; 1002ed
Function1002ed: ; 1002ed
callba Function49409
callba Function96a4
ld a, $1
ld [hCGBPalUpdate], a
call DelayFrame
ret
; 100301
Function100301: ; 100301
ld hl, $cd2a
bit 1, [hl]
ret z
callba Function106464
callba Function10202c
callba Function115dd3
call Function100320
call Functiona36
ret
; 100320
Function100320: ; 100320
callba Function104099
ret
; 100327
Function100327: ; 100327
callba Function10402d
ret
; 100327
Function10032e: ; 10032e
call Function10034d
ld e, a
ret nc
ld [$cd2b], a
ret
; 100337
Function100337: ; 100337
call Function10032e
ret c
ld a, [$c821]
bit 4, a
jr z, .asm_100345
ld a, e
and a
ret
.asm_100345
ld a, $f9
ld e, a
ld [$cd2b], a
scf
ret
; 10034d
Function10034d: ; 10034d
ld a, [$c821]
bit 1, a
jr nz, .asm_10036a
bit 2, a
jr nz, .asm_10037e
bit 3, a
jr nz, .asm_100366
bit 0, a
jr nz, .asm_100364
ld a, $1
and a
ret
.asm_100364
xor a
ret
.asm_100366
ld a, $2
and a
ret
.asm_10036a
ld a, $0
call Function3e32
ld [$cd2c], a
ld a, h
ld [$cd2d], a
ld a, l
ld [$cd2e], a
ld a, $ff
scf
ret
.asm_10037e
ld a, $fe
scf
ret
; 100382
Function100382: ; 100382
ld a, [$cd27]
ld hl, Jumptable_10044e
rst JumpTable
ret
; 10038a
Function10038a: ; 10038a
ld hl, $ccb4
ld a, $2e
call Function3e32
ret
; 100393
Function100393: ; 100393
ld hl, $cc60
ld a, $3a
call Function3e32
ret
; 10039c
Function10039c: ; 10039c
ld hl, $cc60
ld de, $d000
ld bc, $0054
ld a, $3
call FarCopyWRAM
ret
; 1003ab
Function1003ab: ; 1003ab
ld hl, $d000
ld de, $cc60
ld bc, $0054
ld a, $3
call FarCopyWRAM
ret
; 1003ba
Function1003ba: ; 1003ba
ld hl, $ccb4
ld de, $d080
ld bc, $0054
ld a, $3
call FarCopyWRAM
ret
; 1003c9
Function1003c9: ; 1003c9
ld hl, $d080
ld de, $ccb4
ld bc, $0054
ld a, $3
call FarCopyWRAM
ret
; 1003d8
Function1003d8: ; 1003d8
ld hl, $ccb4
ld a, [hli]
ld c, a
ld b, $0
push hl
add hl, bc
ld a, [BGMapPalBuffer]
ld [hl], a
pop hl
inc bc
call Function10043a
add hl, bc
ld [hl], e
inc hl
ld [hl], d
ld a, c
add $2
ld [$ccb4], a
ret
; 1003f5
Function1003f5: ; 1003f5
ld a, [$cc60]
sub $3
ld [$cc60], a
ld a, [$ccb4]
sub $3
ld [$ccb4], a
ret
; 100406
Function100406: ; 100406
ld a, [$cc60]
sub $2
ld c, a
ld b, $0
ld hl, $cc61
call Function10043a
add hl, bc
ld a, [hli]
cp e
jr nz, .asm_100426
ld a, [hld]
cp d
jr nz, .asm_100426
dec hl
ld a, [BGMapPalBuffer]
cp [hl]
jr nz, .asm_10042d
xor a
ret
.asm_100426
ld a, $f4
ld [$cd2b], a
jr .asm_100432
.asm_10042d
ld a, $f3
ld [$cd2b], a
.asm_100432
push hl
ld hl, $cd7c
inc [hl]
pop hl
scf
ret
; 10043a
Function10043a: ; 10043a
push hl
push bc
ld de, $0000
.asm_10043f
ld a, [hli]
add e
ld e, a
ld a, d
adc $0
ld d, a
dec bc
ld a, b
or c
jr nz, .asm_10043f
pop bc
pop hl
ret
; 10044e
Jumptable_10044e: ; 10044e (40:444e)
dw Function10046a
dw Function10047c
dw Function100493
dw Function1004ba
dw Function1004f4
dw Function1004ce
dw Function1004de
dw Function1004a4
dw Function100495
dw Function1004ce
dw Function1004de
dw Function1004e9
dw Function1004f4
dw Function1004a4
Function10046a: ; 10046a
ld hl, BGMapPalBuffer
inc [hl]
call Function1003d8
call Function1003ba
ld a, [$cd27]
inc a
ld [$cd27], a
ret
; 10047c
Function10047c: ; 10047c
call Function100337
ret c
ret z
cp $2
jr z, .asm_100487
jr .asm_10048d
.asm_100487
ld a, $8
ld [$cd27], a
ret
.asm_10048d
ld a, $2
ld [$cd27], a
ret
; 100493
Function100493: ; 100493
jr asm_100497
Function100495: ; 100495
jr asm_100497
asm_100497
call Function100337
ret c
ret z
ld a, [$cd27]
inc a
ld [$cd27], a
ret
; 1004a4
Function1004a4: ; 1004a4
call Function100406
jr c, .asm_1004b8
call Function1003c9
call Function1003f5
ld a, [$cd27]
set 7, a
ld [$cd27], a
ret
.asm_1004b8
scf
ret
; 1004ba
Function1004ba: ; 1004ba
call Function10038a
and a
jr nz, .asm_1004c8
ld a, [$cd27]
inc a
ld [$cd27], a
ret
.asm_1004c8
ld a, $8
ld [$cd27], a
ret
; 1004ce
Function1004ce: ; 1004ce
call Function100337
ret c
ret z
cp $2
ret nz
ld a, [$cd27]
inc a
ld [$cd27], a
ret
; 1004de
Function1004de: ; 1004de
call Function100393
ld a, [$cd27]
inc a
ld [$cd27], a
ret
; 1004e9
Function1004e9: ; 1004e9
call Function10038a
ld a, [$cd27]
inc a
ld [$cd27], a
ret
; 1004f4
Function1004f4: ; 1004f4
call Function100337
ret c
ret z
ld a, [$cd27]
inc a
ld [$cd27], a
call Function10039c
ret
; 100504
Function100504: ; 100504
push de
call Function3f20
call Function1ad2
pop de
hlcoord 4, 2
call PlaceString
ret
; 100513
Function100513: ; 100513
call Function3f7c
call Function1c89
call Function1c10
ld hl, $cfa5
set 7, [hl]
ret
; 100522
Function100522: ; 100522
ld a, [$cd28]
ld hl, Jumptable_10052a
rst JumpTable
ret
; 10052a
Jumptable_10052a: ; 10052a
dw Function100534
dw Function100545
dw Function100545
dw Function100545
dw Function10054d
; 100534
Function100534: ; 100534
call Function100513
call Function1ad2
call Function321c
ld a, [$cd28]
inc a
ld [$cd28], a
ret
; 100545
Function100545: ; 100545
ld a, [$cd28]
inc a
ld [$cd28], a
ret
; 10054d
Function10054d: ; 10054d
callba Function241ba
ld a, c
ld hl, $cfa8
and [hl]
ret z
call Function1ff8
bit 0, a
jr nz, .asm_100565
bit 1, a
jr nz, .asm_10056f
ret
.asm_100565
ld a, [$cd28]
set 7, a
ld [$cd28], a
and a
ret
.asm_10056f
ld a, [$cd28]
set 7, a
ld [$cd28], a
scf
ret
; 100579
Function100579: ; 100579
ld a, [$cd26]
ld hl, Jumptable_100581
rst JumpTable
ret
; 100581
Jumptable_100581: ; 100581
dw Function100585
dw Function100597
; 100585
Function100585: ; 100585
ld hl, MenuDataHeader_1005b2
call LoadMenuDataHeader
ld a, $0
ld [$cd28], a
ld a, [$cd26]
inc a
ld [$cd26], a
Function100597: ; 100597
call Function100522
ld a, [$cd28]
bit 7, a
ret z
jr nc, .asm_1005a6
xor a
ld [$cfa9], a
.asm_1005a6
call Function1c07
ld a, [$cd26]
set 7, a
ld [$cd26], a
ret
; 1005b2
MenuDataHeader_1005b2: ; 1005b2
db $40 ; flags
db 6, 14
db 10, 19
dw MenuData2_1005ba
db 1 ; default option
MenuData2_1005ba:
db $c0 ; flags
db 2
db "はい@"
db "いいえ@"
; 1005c3
Function1005c3: ; 1005c3
ld a, [$cd26]
ld hl, Jumptable_1005cb
rst JumpTable
ret
; 1005cb
Jumptable_1005cb: ; 1005cb
dw Function1005cf
dw Function1005e1
; 1005cf
Function1005cf: ; 1005cf
ld hl, MenuDataHeader_1005fc
call LoadMenuDataHeader
ld a, $0
ld [$cd28], a
ld a, [$cd26]
inc a
ld [$cd26], a
Function1005e1: ; 1005e1
call Function100522
ld a, [$cd28]
bit 7, a
ret z
jr nc, .asm_1005f0
xor a
ld [$cfa9], a
.asm_1005f0
call Function1c07
ld a, [$cd26]
set 7, a
ld [$cd26], a
ret
; 1005fc
MenuDataHeader_1005fc: ; 1005fc
db $40 ; flags
db 6, 14
db 10, 19
dw MenuData2_100604
db 1 ; default option
MenuData2_100604: ; 100604
db $c0 ; flags
db 2
db "かける@"
db "まつ@"
; 10060d
Function10060d: ; 10060d
ld hl, $c56b
ld b, $1
ld c, $b
call Function3eea
ld de, String_100621
ld hl, $c580
call PlaceString
ret
; 100621
String_100621: ; 100621
db "つうしんたいきちゅう!@"
; 10062d
Function10062d: ; 10062d
push bc
call Function10064e
pop bc
ld a, [$cd44]
cp b
jr nc, .asm_10063a
and a
ret
.asm_10063a
ld a, $fa
ld [$cd2b], a
scf
ret
; 100641
Function100641: ; 100641
xor a
ld [$cd44], a
ld [$cd45], a
ld [$cd46], a
ret
; 10064c
Function10064c: ; 10064c
ld c, 1
Function10064e: ; 10064e
ld hl, $cd46
ld a, [hl]
add c
cp $3c
jr c, .asm_100658
xor a
.asm_100658
ld [hld], a
ret c
ld a, [hl]
inc a
cp $3c
jr c, .asm_100661
xor a
.asm_100661
ld [hld], a
ret c
inc [hl]
ret
; 100665
Function100665: ; 100665
call UpdateTime
ld hl, $cd36
ld a, [hHours]
ld [hli], a
ld a, [hMinutes]
ld [hli], a
ld a, [hSeconds]
ld [hl], a
ret
; 100675
Function100675: ; 100675
ld hl, $cd2a
bit 2, [hl]
set 2, [hl]
ret nz
call Function1006d3
ret
; 100681
Function100681: ; 100681
push hl
ld hl, $cd2a
bit 2, [hl]
ld hl, $cd2a
set 2, [hl]
pop hl
jr nz, .asm_100694
push hl
call Function1006d3
pop hl
.asm_100694
ld de, $cd32
Function100697: ; 100697
ld a, [de]
and a
jr nz, .asm_1006bb
inc de
push de
call .asm_1006b4
ld de, String1006c2
call PlaceString
ld h, b
ld l, c
pop de
inc de
call .asm_1006b4
ld de, String1006c6
call PlaceString
ret
.asm_1006b4
ld bc, $8102
call PrintNum
ret
.asm_1006bb
ld de, String1006ca
call PlaceString
ret
; 1006c2
String1006c2: ; 1006c2
db "ふん @"
String1006c6: ; 1006c6
db "びょう@"
String1006ca: ; 1006ca
db "1じかんいじょう@"
; 1006d3
Function1006d3: ; 1006d3
call UpdateTime
ld de, $cd34
ld hl, $cd38
Function1006dc: ; 1006dc
ld a, [hld]
ld c, a
ld a, [hSeconds]
sub c
jr nc, .asm_1006e5
add $3c
.asm_1006e5
ld [de], a
dec de
ld a, [hld]
ld c, a
ld a, [hMinutes]
sbc c
jr nc, .asm_1006f0
add $3c
.asm_1006f0
ld [de], a
dec de
ld a, [hl]
ld c, a
ld a, [hHours]
sbc c
jr nc, .asm_1006fb
add $18
.asm_1006fb
ld [de], a
ret
; 1006fd
Function1006fd: ; 1006fd
ld a, $4
ld hl, $a800
call GetSRAMBank
xor a
ld [hli], a
ld [hli], a
ld [hli], a
call CloseSRAM
ret
; 10070d
Function10070d: ; 10070d
ld a, $4
ld hl, $a800
call GetSRAMBank
xor a
ld [hli], a
ld a, $a
ld [hli], a
xor a
ld [hli], a
call CloseSRAM
ret
; 100720
Function100720: ; 100720
xor a
ld [$cd6a], a
call UpdateTime
ld a, [hHours]
ld [$cd72], a
ld a, [hMinutes]
ld [$cd73], a
ld a, [hSeconds]
ld [$cd74], a
ld a, $4
ld hl, $a800
call GetSRAMBank
ld a, [hli]
ld [$cd6c], a
ld a, [hli]
ld [$cd6d], a
ld a, [hli]
ld [$cd6e], a
call CloseSRAM
ld a, [$cd6d]
ld [$cd6b], a
ret
; 100754
Function100754: ; 100754
call UpdateTime
ld a, [hHours]
ld [$cd72], a
ld a, [hMinutes]
ld [$cd73], a
ld a, [hSeconds]
ld [$cd74], a
ld a, [$cd6d]
ld [$cd6b], a
ld hl, $cd2a
res 6, [hl]
ret
; 100772
Function100772: ; 100772
push de
ld hl, $cd6c
ld a, [de]
cp [hl]
jr c, .asm_10079a
jr nz, .asm_10078c
inc hl
inc de
ld a, [de]
cp [hl]
jr c, .asm_10079a
jr nz, .asm_10078c
inc hl
inc de
ld a, [de]
cp [hl]
jr c, .asm_10079a
jr z, .asm_10079a
.asm_10078c
pop hl
ld a, [hli]
ld [$cd6c], a
ld a, [hli]
ld [$cd6d], a
ld a, [hli]
ld [$cd6e], a
ret
.asm_10079a
pop de
ret
; 10079c
Function10079c: ; 10079c
ld a, [$cd21]
cp $1
jr nz, .asm_1007f4
ld hl, $cd2a
bit 5, [hl]
jr nz, .asm_1007f4
ld hl, $cd2a
bit 6, [hl]
jr nz, .asm_1007f4
ld a, [$cd6a]
add c
cp $3c
jr nc, .asm_1007be
ld [$cd6a], a
and a
ret
.asm_1007be
sub $3c
ld [$cd6a], a
ld d, b
push de
call Function1007f6
pop de
jr c, .asm_1007e5
ld a, c
and a
jr nz, .asm_1007e5
ld a, b
cp $a
jr nc, .asm_1007e5
ld a, d
and a
ret z
ld a, [$cd6b]
cp b
ret z
ld a, b
ld [$cd6b], a
call Function1008e0
and a
ret
.asm_1007e5
call Function1008e0
ld hl, $cd2a
set 4, [hl]
ld a, $fc
ld [$cd2b], a
scf
ret
.asm_1007f4
and a
ret
; 1007f6
Function1007f6: ; 1007f6
call UpdateTime
ld hl, $cd74
ld de, $cd71
call Function1006dc
ld a, $4
call GetSRAMBank
ld hl, $a802
call Function100826
call CloseSRAM
ld hl, $cd6e
call Function100826
ld a, [hHours]
ld [$cd72], a
ld a, [hMinutes]
ld [$cd73], a
ld a, [hSeconds]
ld [$cd74], a
ret
; 100826
Function100826: ; 100826
ld a, [$cd71]
add [hl]
sub $3c
jr nc, .asm_100830
add $3c
.asm_100830
ld [hld], a
ccf
ld a, [BGMapBufferPtrs]
adc [hl]
sub $3c
jr nc, .asm_10083c
add $3c
.asm_10083c
ld [hld], a
ld b, a
ccf
ld a, [$cd6f]
adc [hl]
ld [hl], a
ld c, a
ret
; 100846
Function100846: ; 100846
ld hl, $cd2a
bit 5, [hl]
jr nz, .asm_10087c
ld a, [$cd6e]
ld c, a
ld a, $0
sub c
jr nc, .asm_100858
add $3c
.asm_100858
ld [$d088], a
ld a, [$cd6d]
ld c, a
ld a, $a
sbc c
ld [$d087], a
xor a
ld [StringBuffer2], a
ld de, $488e
ld hl, $c5b9
call PlaceString
ld de, StringBuffer2
ld hl, $c5e4
call Function100697
ret
.asm_10087c
ld de, $488e
ld hl, $c5b9
call PlaceString
ld h, b
ld l, c
ld de, $489f
call PlaceString
ret
; 10088e
INCBIN "baserom.gbc", $10088e, $1008a6 - $10088e
Function1008a6: ; 1008a6
ld a, $4
ld hl, $a800
call GetSRAMBank
ld a, [hli]
ld [StringBuffer2], a
ld a, [hli]
ld [$d087], a
ld a, [hli]
ld [$d088], a
call CloseSRAM
ld a, [$d088]
ld b, a
ld a, $0
sub b
jr nc, .asm_1008c8
add $3c
.asm_1008c8
ld b, a
ld a, [$d087]
ld c, a
ld a, $a
sbc c
ld c, a
jr c, .asm_1008da
ld a, [StringBuffer2]
and a
jr nz, .asm_1008da
ret
.asm_1008da
call Function10070d
ld c, $0
ret
; 1008e0
Function1008e0: ; 1008e0
ld a, [hBGMapMode]
ld b, a
ld a, [$ff9e]
ld c, a
push bc
xor a
ld [hBGMapMode], a
ld a, $3
ld [$ff9e], a
call Function100970
call Function100902
call Function100989
call DelayFrame
pop bc
ld a, c
ld [$ff9e], a
ld a, b
ld [hBGMapMode], a
ret
; 100902
Function100902: ; 100902
hlcoord 3, 10
ld b, $1
ld c, $b
call TextBox
ld a, [$cd6d]
ld c, a
ld a, $a
sub c
ld [StringBuffer2], a
jr z, .asm_10093f
ld de, .string_100966
hlcoord 4, 11
call PlaceString
hlcoord 8, 11
ld bc, $0102
ld de, StringBuffer2
call PrintNum
ld de, SFX_TWO_PC_BEEPS
call PlaySFX
callba Function104061
ld c, $3c
call DelayFrames
ret
.asm_10093f
ld de, .string_10095a
hlcoord 4, 11
call PlaceString
ld de, SFX_4_NOTE_DITTY
call PlaySFX
callba Function104061
ld c, $78
call DelayFrames
ret
; 10095a
.string_10095a ; 10095a
db "たいせん しゅうりょう@"
.string_100966 ; 100966
db "のこり ふん", $e7, "@"
; 100970
Function100970: ; 100970
ld hl, TileMap
ld de, $dc00
call Function1009a5
ld hl, AttrMap
ld de, $dd68
call Function1009a5
call Function1009d2
call Function1009ae
ret
; 100989
Function100989: ; 100989
ld hl, $dc00
ld de, TileMap
call Function1009a5
call Function1009ae
callba Function104061
ld hl, $dd68
ld de, AttrMap
call Function1009a5
ret
; 1009a5
Function1009a5: ; 1009a5
ld bc, $0168
ld a, $3
call FarCopyWRAM
ret
; 1009ae
Function1009ae: ; 1009ae
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ld hl, $d800
ld de, AttrMap
ld c, $14
ld b, $12
.asm_1009bf
push bc
.asm_1009c0
ld a, [hli]
ld [de], a
inc de
dec c
jr nz, .asm_1009c0
ld bc, $000c
add hl, bc
pop bc
dec b
jr nz, .asm_1009bf
pop af
ld [rSVBK], a
ret
; 1009d2
Function1009d2: ; 1009d2
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ld hl, $d800
ld de, VBGMap0
ld bc, $0324
call Get2bpp
pop af
ld [rVBK], a
pop af
ld [rSVBK], a
ret
; 1009f3
Function1009f3: ; 1009f3
ld a, [hJoyDown]
and $5
cp $5
jr nz, .asm_100a07
ld hl, $cd2a
set 4, [hl]
ld a, $f8
ld [$cd2b], a
scf
ret
.asm_100a07
xor a
ret
; 100a09
Function100a09: ; 100a09
call Function100a2e
ld [$d431], a
callba Function4000
ld a, [InLinkBattle]
cp $4
jr nz, .asm_100a2a
call Function100a87
call Function100da5
callba Function3ee27
jr .asm_100a2d
.asm_100a2a
call Function100a53
.asm_100a2d
ret
; 100a2e
Function100a2e: ; 100a2e
ld a, [$d0ec]
and a
jr nz, .asm_100a48
ld a, [CurPlayerMove]
ld b, $e
cp $a5
jr z, .asm_100a4f
ld b, $d
cp $ff
jr z, .asm_100a4f
ld a, [CurMoveNum]
jr .asm_100a50
.asm_100a48
ld a, [CurPartyMon]
add $4
jr .asm_100a50
.asm_100a4f
ld a, b
.asm_100a50
and $f
ret
; 100a53
Function100a53: ; 100a53
ld a, [$d431]
ld [$cf56], a
ld a, $ff
ld [$cf52], a
.asm_100a5e
call Function8c1
call DelayFrame
ld a, [$cf52]
inc a
jr z, .asm_100a5e
ld b, $a
.asm_100a6c
call DelayFrame
call Function8c1
dec b
jr nz, .asm_100a6c
ld b, $a
.asm_100a77
call DelayFrame
call Function908
dec b
jr nz, .asm_100a77
ld a, [$cf52]
ld [$d430], a
ret
; 100a87
Function100a87: ; 100a87
call Function100acf
call Function100641
ld a, $0
ld [$cd27], a
.asm_100a92
call DelayFrame
call GetJoypad
callba Function100382
ld c, $1
ld b, $3
push bc
call Function10062d
pop bc
jr c, .asm_100ac7
ld b, $1
call Function10079c
jr c, .asm_100ac7
call Function1009f3
jr c, .asm_100ac7
ld a, [$cd2b]
and a
jr nz, .asm_100ac7
ld a, [$cd27]
bit 7, a
jr z, .asm_100a92
call Function100ae7
jr .asm_100ace
.asm_100ac7
ld a, $f
ld [$d430], a
jr .asm_100ace
.asm_100ace
ret
; 100acf
Function100acf: ; 100acf
ld de, $4b0a
ld hl, $ccb5
ld a, [$d431]
ld [hli], a
ld c, $1
.asm_100adb
ld a, [de]
inc de
ld [hli], a
inc c
and a
jr nz, .asm_100adb
ld a, c
ld [$ccb4], a
ret
; 100ae7
Function100ae7: ; 100ae7
ld de, $4b0a
ld hl, $cc62
.asm_100aed
ld a, [de]
inc de
and a
jr z, .asm_100af8
cp [hl]
jr nz, .asm_100aff
inc hl
jr .asm_100aed
.asm_100af8
ld a, [$cc61]
ld [$d430], a
ret
.asm_100aff
ld a, $f
ld [$d430], a
ld a, $f1
ld [$cd2b], a
ret
; 100b0a
INCBIN "baserom.gbc",$100b0a,$100b12 - $100b0a
Function100b12: ; 100b12
call Function100dd8
ret c
ld hl, BattleMenuDataHeader
ld a, BANK(BattleMenuDataHeader)
ld de, LoadMenuDataHeader
call FarCall_de
ld a, BANK(BattleMenuDataHeader)
ld [$cf94], a
ld a, [$d0d2]
ld [$cf88], a
call Function100e72
call Function100b45
callba Function8e85
call Function100ed4
ld a, [$cf88]
ld [$d0d2], a
call Function1c07
ret
; 100b45
Function100b45: ; 100b45
call Function100b7a
.asm_100b48
call Function100dd2
callba Function241ba
push bc
callba Function10402d
call Function100e2d
pop bc
jr c, .asm_100b6b
ld a, [$cfa8]
and c
jr z, .asm_100b48
callba Function24098
ret
.asm_100b6b
ld a, [$cfa4]
ld c, a
ld a, [$cfa3]
call SimpleMultiply
ld [$cf88], a
and a
ret
; 100b7a
Function100b7a: ; 100b7a
ld hl, Function1c66
ld a, [$cf94]
rst FarCall
callba Function24085
callba MobileTextBorder
call Function1ad2
call Function321c
callba Function2411a
ld hl, $cfa5
set 7, [hl]
ret
; 100b9f
Function100b9f: ; 100b9f
xor a
ld [$d0e3], a
callba Function3e786
ret z
call Function100dd8
jp c, Function2ec8
call Function100e72
call Function100bc2
push af
callba Function8e85
call Function100ed4
pop af
ret
; 100bc2
Function100bc2: ; 100bc2
xor a
ld [hBGMapMode], a
call Function100c74
call Function100c98
.asm_100bcb
callba MoveInfoBox
.asm_100bd1
call Function100dd2
callba Function241ba
push bc
callba Function10402d
call Function100e2d
pop bc
jr c, .asm_100c25
ld a, [$cfa8]
and c
bit 6, a
jp nz, .asm_100bff
bit 7, a
jp nz, .asm_100c10
bit 0, a
jr nz, .asm_100c30
bit 1, a
jr nz, .asm_100c25
jr .asm_100bd1
.asm_100bff
ld a, [$cfa9]
and a
jp nz, .asm_100bcb
ld a, [$d0eb]
inc a
ld [$cfa9], a
jp .asm_100bcb
.asm_100c10
ld a, [$cfa9]
ld b, a
ld a, [$d0eb]
inc a
inc a
cp b
jp nz, .asm_100bcb
ld a, $1
ld [$cfa9], a
jp .asm_100bcb
.asm_100c25
ld a, [$cfa9]
dec a
ld [CurMoveNum], a
ld a, $1
and a
ret
.asm_100c30
ld a, [$cfa9]
dec a
ld [CurMoveNum], a
ld a, [$cfa9]
dec a
ld c, a
ld b, 0
ld hl, BattleMonPP
add hl, bc
ld a, [hl]
and $3f
jr z, .asm_100c68
ld a, [PlayerDisableCount]
swap a
and $f
dec a
cp c
jr z, .asm_100c63
ld a, [$cfa9]
dec a
ld c, a
ld b, 0
ld hl, BattleMonMoves
add hl, bc
ld a, [hl]
ld [CurPlayerMove], a
xor a
ret
.asm_100c63
ld hl, BattleText_0x80c5b
jr .asm_100c6b
.asm_100c68
ld hl, BattleText_0x80c39
.asm_100c6b
call StdBattleTextBox
call Function30b4
jp Function100bc2
; 100c74
Function100c74: ; 100c74
hlcoord 0, 8
ld b, 8
ld c, 8
call TextBox
ld hl, BattleMonMoves
ld de, $d25e
ld bc, NUM_MOVES
call CopyBytes
ld a, SCREEN_WIDTH * 2
ld [Buffer1], a
hlcoord 2, 10
predef ListMoves
ret
; 100c98
Function100c98: ; 100c98
ld de, Unknown_100cad
call Function1bb1
ld a, [$d0eb]
inc a
ld [$cfa3], a
ld a, [CurMoveNum]
inc a
ld [$cfa9], a
ret
; 100cad
Unknown_100cad: ; 100cad
INCBIN "baserom.gbc",$100cad,$100cb5 - $100cad
Function100cb5: ; 100cb5
call Function100dd8
ret c
ld hl, $cfa5
set 7, [hl]
res 6, [hl]
.asm_100cc0
call Function100dd2
callba Function241ba
push bc
callba Function8cf69
callba Function10402d
call Function100dfd
pop bc
jr c, .asm_100d17
ld a, [$cfa8]
and c
jr z, .asm_100cc0
call Function1bee
ld a, [PartyCount]
inc a
ld b, a
ld a, [$cfa9]
cp b
jr z, .asm_100d17
ld [$d0d8], a
ld a, [$ffa9]
ld b, a
bit 1, b
jr nz, .asm_100d17
ld a, [$cfa9]
dec a
ld [CurPartyMon], a
ld c, a
ld b, $0
ld hl, PartySpecies
add hl, bc
ld a, [hl]
ld [CurPartySpecies], a
ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
and a
ret
.asm_100d17
ld de, SFX_READ_TEXT_2
call PlaySFX
call WaitSFX
scf
ret
; 100d22
Function100d22: ; 100d22
call Function100dd8
ret c
call Function100d67
ld hl, $cfa5
set 7, [hl]
res 6, [hl]
.asm_100d30
call Function100dd2
callba Function241ba
push bc
callba Function8cf69
callba Function10402d
call Function100dfd
pop bc
jr c, .asm_100d54
ld a, [$cfa8]
and c
jr nz, .asm_100d56
jr .asm_100d30
.asm_100d54
scf
ret
.asm_100d56
push af
ld de, SFX_READ_TEXT_2
call PlaySFX
pop af
bit 1, a
jr z, .asm_100d65
ret z
scf
ret
.asm_100d65
and a
ret
; 100d67
Function100d67: ; 100d67
ld hl, $4d88
call Function1d3c
xor a
ld [hBGMapMode], a
call Function1cbb
call Function1ad2
call Function1c89
call WaitBGMap
call Function1c66
call Function1c10
ld hl, $cfa5
set 6, [hl]
ret
; 100d88
INCBIN "baserom.gbc",$100d88,$100da5 - $100d88
Function100da5: ; 100da5
ld hl, $cd2a
res 3, [hl]
ld hl, $cd29
res 0, [hl]
ret
; 100db0
Function100db0: ; 100db0
ld hl, $cd2a
bit 3, [hl]
jr nz, .asm_100dbe
ld hl, $cd2a
set 3, [hl]
scf
ret
.asm_100dbe
xor a
ret
; 100dc0
Function100dc0: ; 100dc0
ld a, [InLinkBattle]
cp $4
jr nz, .asm_100dd0
ld hl, $cd2a
bit 3, [hl]
jr z, .asm_100dd0
scf
ret
.asm_100dd0
xor a
ret
; 100dd2
Function100dd2: ; 100dd2
ld a, $1e
ld [OverworldDelay], a
ret
; 100dd8
Function100dd8: ; 100dd8
ld c, $1
ld b, $3
callba Function10062d
jr c, .asm_100dfb
ld c, $3c
ld b, $1
call Function10079c
jr c, .asm_100dfb
callba Function10032e
ld a, [$cd2b]
and a
jr nz, .asm_100dfb
xor a
ret
.asm_100dfb
scf
ret
; 100dfd
Function100dfd: ; 100dfd
ld a, [OverworldDelay]
ld c, a
ld a, $1e
sub c
ld c, a
ld b, $3
push bc
callba Function10062d
pop bc
jr c, .asm_100e2b
ld b, $1
call Function10079c
jr c, .asm_100e2b
call Function1009f3
jr c, .asm_100e2b
callba Function10032e
ld a, [$cd2b]
and a
jr nz, .asm_100e2b
xor a
ret
.asm_100e2b
scf
ret
; 100e2d
Function100e2d: ; 100e2d
ld a, [OverworldDelay]
ld c, a
ld a, $1e
sub c
ld c, a
ld b, $3
push bc
callba Function10062d
pop bc
jr c, .asm_100e61
ld b, $1
call Function10079c
jr c, .asm_100e61
call Function1009f3
jr c, .asm_100e61
callba Function10032e
ld a, [$cd2b]
and a
jr nz, .asm_100e61
call Function100e63
call Function100e84
xor a
ret
.asm_100e61
scf
ret
; 100e63
Function100e63: ; 100e63
ld a, e
cp $2
ret nz
call Function100db0
ret nc
ld de, SFX_ELEVATOR_END
call PlaySFX
ret
; 100e72
Function100e72: ; 100e72
xor a
ld hl, $cd29
bit 0, [hl]
jr z, .asm_100e7c
ld a, $a
.asm_100e7c
ld [$cd67], a
xor a
ld [$cd68], a
ret
; 100e84
Function100e84: ; 100e84
ld a, [$cd67]
ld hl, Jumptable_100e8c
rst JumpTable
ret
; 100e8c
Jumptable_100e8c: ; 100e8c (40:4e8c)
dw Function100ea2
dw Function100eae
dw Function100eb4
dw Function100eae
dw Function100eb4
dw Function100eae
dw Function100eb4
dw Function100eae
dw Function100eb4
dw Function100eae
dw Function100ec4
Function100ea2: ; 100ea2 (40:4ea2)
call Function100dc0
ret nc
ld hl, $cd29
set 0, [hl]
call Function100ec5
Function100eae: ; 100eae
scf
call Function100eca
jr asm_100eb8
Function100eb4: ; 100eb4
and a
call Function100eca
asm_100eb8
ld hl, $cd68
inc [hl]
ld a, [hl]
cp $2
ret c
ld [hl], $0
jr Function100ec5
Function100ec4: ; 100ec4
ret
Function100ec5
ld hl, $cd67
inc [hl]
ret
; 100eca
Function100eca: ; 100eca
callba Function8e8b
call Function100ed4
ret
; 100ed4
Function100ed4: ; 100ed4
callba Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 100edf
INCBIN "baserom.gbc",$100edf,$1011f1 - $100edf
Function1011f1: ; 1011f1
ld a, $4
call GetSRAMBank
ld a, [$a60c]
ld [$dc41], a
call CloseSRAM
ld hl, $dc41
res 4, [hl]
ld hl, GameTimerPause
bit 7, [hl]
jr z, .asm_101210
ld hl, $dc41
set 4, [hl]
.asm_101210
call Function10209c
xor a
ld [$dc5f], a
ld [$dc60], a
ld a, $4
ld [InLinkBattle], a
ret
; 101220
Function101220: ; 101220
xor a
ld [InLinkBattle], a
ret
; 101225
Function101225: ; 101225
ld d, $1
ld e, $40
ld bc, $5297
call Function100000
jr Function10123d
Function101231: ; 101231
ld d, $2
ld e, $40
ld bc, $5297
call Function100000
jr Function10123d
Function10123d: ; 10123d
xor a
ld [ScriptVar], a
ld a, c
ld hl, Table101247
rst JumpTable
ret
; 101247
Table101247: ; 101247
dw Function101251
dw Function10127d
dw Function10127c
dw Function10126c
dw Function101265
; 101251
Function101251: ; 101251
call Function1ad2
call ResetWindow
ld hl, $61f4
call Function1021e0
call Function1020ea
ret c
call Function102142
ret
; 101265
Function101265: ; 101265
ld hl, $61ef
call Function1021e0
ret
; 10126c
Function10126c: ; 10126c
call Function1ad2
callba Script_reloadmappart
ld hl, $61f4
call Function1021e0
ret
; 10127c
Function10127c: ; 10127c
ret
; 10127d
Function10127d: ; 10127d
ret
; 10127e
Function10127e: ; 10127e
ld a, [$dc5f]
and a
jr z, .asm_101290
cp $1
ld c, $27
jr z, .asm_101292
cp $2
ld c, $37
jr z, .asm_101292
.asm_101290
ld c, $0
.asm_101292
ld a, c
ld [$cd25], a
ret
; 101297
INCBIN "baserom.gbc",$101297,$1013aa - $101297
Function1013aa: ; 1013aa
call WhiteBGMap
call Function1d7d
call Function2bae
callba Function106464
call Function1ad2
call Function2b5c
ret
; 1013c0
INCBIN "baserom.gbc",$1013c0,$1013d6 - $1013c0
Function1013d6: ; 1013d6
callba Function104000
ret
; 1013dd
INCBIN "baserom.gbc",$1013dd,$10142c - $1013dd
Function10142c: ; 10142c
ld a, $1
ld [$c305], a
callba Function115e18
ret
; 101438
INCBIN "baserom.gbc",$101438,$101ee4 - $101438
Function101ee4: ; 101ee4
ld d, $0
ld hl, $5ef5
add hl, de
add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
callba Function100504
ret
; 101ef5
INCBIN "baserom.gbc",$101ef5,$10202c - $101ef5
Function10202c: ; 10202c
callba Function115d99
ld hl, $cd29
set 7, [hl]
ld c, $2
call Function10142c
ld e, $d
call Function101ee4
hlcoord 4, 4
call Function100681
ret
; 102048
INCBIN "baserom.gbc",$102048,$10209c - $102048
Function10209c: ; 10209c
ld a, $ff
ld hl, $dc42
ld bc, $0008
call ByteFill
ret
; 1020a8
INCBIN "baserom.gbc",$1020a8,$1020ea - $1020a8
Function1020ea: ; 1020ea
ld hl, $dc41
bit 4, [hl]
jr z, .asm_102110
ld hl, $dc41
bit 2, [hl]
jr nz, .asm_102110
call Function10218d
ld hl, $c608
bit 4, [hl]
jr z, .asm_102110
ld hl, $c608
bit 2, [hl]
jr nz, .asm_102110
call Function102112
jr z, .asm_102110
and a
ret
.asm_102110
scf
ret
; 102112
Function102112: ; 102112
ld a, $4
call GetSRAMBank
ld hl, $a041
ld c, $28
.asm_10211c
push hl
ld de, $c60f
ld b, $1f
.asm_102122
ld a, [de]
cp [hl]
jr nz, .asm_10212f
inc de
inc hl
dec b
jr nz, .asm_102122
pop hl
xor a
jr .asm_10213c
.asm_10212f
pop hl
ld de, $0025
add hl, de
dec c
jr nz, .asm_10211c
ld a, $1
and a
jr .asm_10213c
.asm_10213c
push af
call CloseSRAM
pop af
ret
; 102142
Function102142: ; 102142
call Function10218d
call Function102180
ld hl, $61d1
call Function1d4f
ld de, $0090
call PlaySFX
call Functiona36
call Function1c07
call Function10219f
ld hl, $61d6
call Function1d4f
call YesNoBox
call Function1c07
jr c, .asm_10217c
call Function1021b8
jr c, .asm_10217c
call Function10218d
call Function102180
ld hl, $61db
call PrintText
.asm_10217c
call Function1013d6
ret
; 102180
Function102180: ; 102180
ld hl, $c609
ld de, StringBuffer2
ld bc, $000b
call CopyBytes
ret
; 10218d
Function10218d: ; 10218d
ld hl, $dc00
ld de, $c608
ld bc, $0026
ld a, $5
call FarCopyWRAM
ld de, $c609
ret
; 10219f
Function10219f: ; 10219f
call FadeToMenu
call Function10218d
ld de, $c609
callba Function8ac4e
call Functiona36
call PlayClickSFX
call Function1013aa
ret
; 1021b8
Function1021b8: ; 1021b8
call FadeToMenu
call Function10218d
ld de, $c60f
callba Function8ac70
ld a, c
ld [StringBuffer1], a
push af
call Function1013aa
pop af
ret
; 1021d1
INCBIN "baserom.gbc",$1021d1,$1021e0 - $1021d1
Function1021e0: ; 1021e0
call Function1d4f
call Functiona36
call Function1c07
ret
; 1021ea
INCBIN "baserom.gbc",$1021ea,$103612 - $1021ea
Function103612: ; 103612
ld hl, $7640
call LoadMenuDataHeader
ld a, [$dc40]
and $f
jr z, .asm_103622
ld [$cf88], a
.asm_103622
call Function1d81
call Function1c17
jr c, .asm_10363b
ld a, [$cfa9]
ld [ScriptVar], a
ld c, a
ld a, [$dc40]
and $f0
or c
ld [$dc40], a
ret
.asm_10363b
xor a
ld [ScriptVar], a
ret
; 103640
INCBIN "baserom.gbc",$103640,$10366e - $103640
Function10366e: ; 10366e
callba Function10632f
bit 7, c
jr z, .asm_10369b
ld hl, $775d
call PrintText
call YesNoBox
jr c, .asm_103696
callba Function8b1e1
jr nc, .asm_103690
call Functiona36
jr .asm_103696
.asm_103690
ld a, $1
ld [ScriptVar], a
ret
.asm_103696
xor a
ld [ScriptVar], a
ret
.asm_10369b
ld hl, $dc40
bit 7, [hl]
set 7, [hl]
jr nz, .asm_1036b5
ld hl, $7762
call PrintText
call YesNoBox
jr c, .asm_1036b5
call Function1036f9
call Functiona36
.asm_1036b5
call Function103700
jr c, .asm_1036f4
ld hl, $7747
call LoadMenuDataHeader
call Function1d81
call Function1c07
jr c, .asm_1036f4
ld a, [$cfa9]
cp $1
jr z, .asm_1036d9
cp $2
jr z, .asm_1036f4
cp $3
jr z, .asm_1036ec
jr .asm_1036b5
.asm_1036d9
callba Function8b1e1
jr nc, .asm_1036e6
call Functiona36
jr .asm_1036f4
.asm_1036e6
ld a, $1
ld [ScriptVar], a
ret
.asm_1036ec
call Function1036f9
call Functiona36
jr .asm_1036b5
.asm_1036f4
xor a
ld [ScriptVar], a
ret
; 1036f9
Function1036f9: ; 1036f9
ld hl, $7767
call PrintText
ret
; 103700
Function103700: ; 103700
ld c, $a
ld hl, $dc20
bit 4, [hl]
jr z, .asm_10370f
callba Function1008a6
.asm_10370f
ld a, c
ld [StringBuffer2], a
ld a, [StringBuffer2]
cp $5
jr nc, .asm_103724
cp $2
jr nc, .asm_10372c
cp $1
jr nc, .asm_103734
jr .asm_10373c
.asm_103724
ld hl, $776c
call PrintText
and a
ret
.asm_10372c
ld hl, $7771
call PrintText
and a
ret
.asm_103734
ld hl, $7776
call PrintText
and a
ret
.asm_10373c
ld hl, $777b
call PrintText
call Functiona36
scf
ret
; 103747
INCBIN "baserom.gbc",$103747,$103780 - $103747
Function103780: ; 103780
ld a, [$d265]
push af
call Function10378c
pop af
ld [$d265], a
ret
; 10378c
Function10378c: ; 10378c
ld c, $0
ld hl, $dc20
bit 4, [hl]
jr nz, .asm_10379c
ld c, $1
ld hl, $dc20
set 4, [hl]
.asm_10379c
push bc
callba Function14ab2
pop bc
jr c, .asm_1037b5
ld a, $1
ld [ScriptVar], a
ld a, c
and a
ret z
callba Function1006fd
ret
.asm_1037b5
xor a
ld [ScriptVar], a
ld a, c
and a
ret z
ld hl, $dc20
res 4, [hl]
ret
; 1037c2
Function1037c2: ; 1037c2
call Function103823
jr c, .asm_1037de
ld a, [$dc5f]
and a
jr z, .asm_1037de
ld hl, $77e6
call PrintText
call YesNoBox
jr c, .asm_1037de
ld a, $1
ld [ScriptVar], a
ret
.asm_1037de
xor a
ld [$dc5f], a
ld [ScriptVar], a
ret
; 1037e6
INCBIN "baserom.gbc",$1037e6,$1037eb - $1037e6
Function1037eb: ; 1037eb
call Function103823
jr nc, .asm_103807
ld hl, $7819
call PrintText
call Functiona36
ld hl, $781e
call PrintText
call Functiona36
xor a
ld [ScriptVar], a
ret
.asm_103807
ld a, [$dc60]
and a
jr nz, .asm_103813
ld a, $1
ld [ScriptVar], a
ret
.asm_103813
ld a, $2
ld [ScriptVar], a
ret
; 103819
INCBIN "baserom.gbc",$103819,$103823 - $103819
Function103823: ; 103823
callba Function10632f
bit 7, c
jr nz, .asm_103838
callba Function1008a6
ld a, c
cp $1
jr c, .asm_10383a
.asm_103838
xor a
ret
.asm_10383a
scf
ret
; 10383c
Function10383c: ; 10383c
ld a, $1
ld [$dc60], a
xor a
ld hl, $dc5c
ld [hli], a
ld [hli], a
ld [hl], a
ld hl, $7876
call PrintText
call Functiona36
callba Script_reloadmappart
callba Function4a94e
jr c, .asm_103870
ld hl, DefaultFlypoint
ld de, $dc5c
ld bc, $0003
call CopyBytes
xor a
ld [ScriptVar], a
ret
.asm_103870
ld a, $1
ld [ScriptVar], a
ret
; 103876
INCBIN "baserom.gbc",$103876,$10387b - $103876
Function10387b: ; 10387b
callba Function10632f
bit 7, c
ret nz
callba Function1008a6
ld a, c
ld [StringBuffer2], a
ld hl, $7898
call PrintText
call Functiona36
ret
; 103898
INCBIN "baserom.gbc",$103898,$10389d - $103898
SECTION "bank41", ROMX, BANK[$41]
Function104000:: ; 104000
ld hl, $4006
jp Function104177
; 104006
INCBIN "baserom.gbc",$104006,$10402d - $104006
Function10402d:: ; 10402d
ld hl, $4033
jp Function104177
; 104033
ld de, TileMap ; $c4a0 (aliases: SpritesEnd)
ld hl, Unkn1Pals ; $d000
call Function10425f
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, Unkn1Pals ; $d000
call Function10419d
ret
Function104047: ; 104047
ld hl, $404d
jp Function104177
; 10404d
ld de, AttrMap ; $cdd9
ld hl, $d400
call Function104263
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, $d400
call Function10419d
ret
Function104061:: ; 104061
ld hl, $4067
jp Function104177
; 104067
ld de, AttrMap ; $cdd9
ld hl, $d400
call Function104263
ld de, TileMap ; $c4a0 (aliases: SpritesEnd)
ld hl, Unkn1Pals ; $d000
call Function10425f
call DelayFrame
di
ld a, [rVBK] ; $ff00+$4f
push af
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, $d400
call Function1041ad
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, Unkn1Pals ; $d000
call Function1041ad
pop af
ld [rVBK], a ; $ff00+$4f
ei
ret
Function104099: ; 104099
ld hl, Function104061
ld hl, $40a2
jp Function104177
; 1040a2
INCBIN "baserom.gbc",$1040a2,$104110 - $1040a2
Function104110:: ; 104110
ld hl, $4116
jp Function104177
; 104116
ld de, AttrMap ; $cdd9
ld hl, $d400
call Function104263
ld de, TileMap ; $c4a0 (aliases: SpritesEnd)
ld hl, Unkn1Pals ; $d000
call Function10425f
call DelayFrame
di
ld a, [rVBK] ; $ff00+$4f
push af
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld hl, $d400
call Function1041b7
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld hl, Unkn1Pals ; $d000
call Function1041b7
pop af
ld [rVBK], a ; $ff00+$4f
ei
ret
Function104148: ; 104148 (41:4148)
ld hl, $414e
jp Function104177
; 10414e (41:414e)
INCBIN "baserom.gbc",$10414e,$104177 - $10414e
Function104177: ; 104177
ld a, [hBGMapMode]
push af
ld a, [$ffde]
push af
xor a
ld [hBGMapMode], a
ld [$ffde], a
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
ld a, [rVBK]
push af
call Function10419c
pop af
ld [rVBK], a
pop af
ld [rSVBK], a
pop af
ld [$ffde], a
pop af
ld [hBGMapMode], a
ret
; 10419c
Function10419c: ; 10419c
jp [hl]
; 10419d
Function10419d: ; 10419d (41:419d)
call Function10424e
ld a, $23
ld [hDMATransfer], a ; $ff00+$e8
.asm_1041a4
call DelayFrame
ld a, [hDMATransfer] ; $ff00+$e8
and a
jr nz, .asm_1041a4
ret
Function1041ad: ; 1041ad (41:41ad)
ld a, [$FF00+$d7]
ld d, a
ld a, [hBGMapAddress] ; $ff00+$d6
ld e, a
ld c, $24
jr Function104209
Function1041b7: ; 1041b7 (41:41b7)
ld a, [$FF00+$d7]
ld d, a
ld a, [hBGMapAddress] ; $ff00+$d6
ld e, a
ld c, $24
jr .asm_104205
; 1041c1 (41:41c1)
INCBIN "baserom.gbc",$1041c1,$104205 - $1041c1
.asm_104205
ld b, $7b
jr asm_10420b
Function104209: ; 104209
ld b, $7f
asm_10420b:
ld a, h
ld [rHDMA1], a
ld a, l
and $f0
ld [rHDMA2], a
ld a, d
and $1f
ld [rHDMA3], a
ld a, e
and $f0
ld [rHDMA4], a
ld a, c
dec c
or $80
ld e, a
ld a, b
sub c
ld d, a
.asm_104225
ld a, [rLY]
cp d
jr nc, .asm_104225
di
.asm_10422b
ld a, [rSTAT]
and $3
jr nz, .asm_10422b
.asm_104231
ld a, [rSTAT]
and $3
jr z, .asm_104231
ld a, e
ld [rHDMA5], a
ld a, [rLY]
inc c
ld hl, rLY
.asm_104240
cp [hl]
jr z, .asm_104240
ld a, [hl]
dec c
jr nz, .asm_104240
ld hl, rHDMA5
res 7, [hl]
ei
ret
; 10424e
Function10424e: ; 10424e (41:424e)
ld a, h
ld [rHDMA1], a ; $ff00+$51
ld a, l
ld [rHDMA2], a ; $ff00+$52
ld a, [$FF00+$d7]
and $1f
ld [rHDMA3], a ; $ff00+$53
ld a, [hBGMapAddress] ; $ff00+$d6
ld [rHDMA4], a ; $ff00+$54
ret
Function10425f: ; 10425f (41:425f)
ld c, $7f
jr asm_104265
Function104263: ; 104263 (41:4263)
ld c, $0
asm_104265: ; 104265 (41:4265)
ld a, [$ffaf]
push af
ld a, c
ld [$ffaf], a
ld c, $12
.asm_10426d
ld b, $14
.asm_10426f
ld a, [de]
inc de
ld [hli], a
dec b
jr nz, .asm_10426f
ld a, [$ffaf]
ld b, $c
.asm_104279
ld [hli], a
dec b
jr nz, .asm_104279
dec c
jr nz, .asm_10426d
pop af
ld [$ffaf], a
ret
Function104284:: ; 104284
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
push bc
push hl
ld a, b
ld l, c
ld h, $0
add hl, hl
add hl, hl
add hl, hl
add hl, hl
ld b, h
ld c, l
ld h, d
ld l, e
ld de, $d000
call FarCopyBytes
pop hl
pop bc
push bc
call DelayFrame
pop bc
ld d, h
ld e, l
ld hl, $d000
call Function104209
pop af
ld [rSVBK], a
ret
; 1042b2
Function1042b2:: ; 1042b2
.asm_1042b2
ld a, c
cp $10
jp c, Function1042d6
jp z, Function1042d6
push bc
push hl
push de
ld c, $10
call Function1042d6
pop de
ld hl, $0080
add hl, de
ld d, h
ld e, l
pop hl
ld bc, $100
add hl, bc
pop bc
ld a, c
sub $10
ld c, a
jr .asm_1042b2
; 1042d6
Function1042d6: ; 1042d6
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
push bc
push hl
ld a, b
ld l, c
ld h, $0
add hl, hl
add hl, hl
add hl, hl
ld c, l
ld b, h
ld h, d
ld l, e
ld de, $d000
call Functiondef
pop hl
pop bc
push bc
call DelayFrame
pop bc
ld d, h
ld e, l
ld hl, $d000
call Function104209
pop af
ld [rSVBK], a
ret
; 104303
Function104303: ; 104303
ld hl, $4309
jp Function104177
; 104309
ld hl, Unkn1Pals ; $d000
ld de, TileMap ; $c4a0 (aliases: SpritesEnd)
call Function10433a
ld hl, BGPals ; $d080
ld de, AttrMap ; $cdd9
call Function10433a
ld a, $1
ld [rVBK], a ; $ff00+$4f
ld c, $8
ld hl, BGPals ; $d080
ld de, $9c00
call Function104209
ld a, $0
ld [rVBK], a ; $ff00+$4f
ld c, $8
ld hl, Unkn1Pals ; $d000
ld de, $9c00
call Function104209
ret
Function10433a: ; 10433a (41:433a)
ld b, $4
.asm_10433c
ld c, $14
.asm_10433e
ld a, [de]
ld [hli], a
inc de
dec c
jr nz, .asm_10433e
ld a, l
add $c
ld l, a
ld a, h
adc $0
ld h, a
dec b
jr nz, .asm_10433c
ret
; 104350
ShockEmote: INCBIN "gfx/emotes/shock.2bpp"
QuestionEmote: INCBIN "gfx/emotes/question.2bpp"
HappyEmote: INCBIN "gfx/emotes/happy.2bpp"
SadEmote: INCBIN "gfx/emotes/sad.2bpp"
HeartEmote: INCBIN "gfx/emotes/heart.2bpp"
BoltEmote: INCBIN "gfx/emotes/bolt.2bpp"
SleepEmote: INCBIN "gfx/emotes/sleep.2bpp"
FishEmote: INCBIN "gfx/emotes/fish.2bpp"
FishingRodGFX: INCBIN "gfx/misc/fishing.2bpp"
Function1045b0: ; 1045b0
call Function210f
call Function2e50
call Function2e5d
call GetCurrentMapTrigger
call Function2e56
ld a, $5
call Function263b
Function1045c4: ; 1045c4
callba Function97df9
ld a, $3
call Function263b
call Function2cff
ld [$c2d0], a
ret
EnterMapConnection: ; 1045d6
; Return carry if a connection has been entered.
ld a, [$d151]
and a
jp z, EnterSouthConnection
cp 1
jp z, EnterNorthConnection
cp 2
jp z, EnterWestConnection
cp 3
jp z, EnterEastConnection
ret
; 1045ed
EnterWestConnection: ; 1045ed
ld a, [WestConnectedMapGroup]
ld [MapGroup], a
ld a, [WestConnectedMapNumber]
ld [MapNumber], a
ld a, [WestConnectionStripXOffset]
ld [XCoord], a
ld a, [WestConnectionStripYOffset]
ld hl, YCoord
add [hl]
ld [hl], a
ld c, a
ld hl, WestConnectionWindow
ld a, [hli]
ld h, [hl]
ld l, a
srl c
jr z, .asm_10461e
ld a, [WestConnectedMapWidth]
add 6
ld e, a
ld d, 0
.asm_10461a
add hl, de
dec c
jr nz, .asm_10461a
.asm_10461e
ld a, l
ld [$d194], a
ld a, h
ld [$d195], a
jp EnteredConnection
; 104629
EnterEastConnection: ; 104629
ld a, [EastConnectedMapGroup]
ld [MapGroup], a
ld a, [EastConnectedMapNumber]
ld [MapNumber], a
ld a, [EastConnectionStripXOffset]
ld [XCoord], a
ld a, [EastConnectionStripYOffset]
ld hl, YCoord
add [hl]
ld [hl], a
ld c, a
ld hl, EastConnectionWindow
ld a, [hli]
ld h, [hl]
ld l, a
srl c
jr z, .asm_10465a
ld a, [EastConnectedMapWidth]
add 6
ld e, a
ld d, 0
.asm_104656
add hl, de
dec c
jr nz, .asm_104656
.asm_10465a
ld a, l
ld [$d194], a
ld a, h
ld [$d195], a
jp EnteredConnection
; 104665
EnterNorthConnection: ; 104665
ld a, [NorthConnectedMapGroup]
ld [MapGroup], a
ld a, [NorthConnectedMapNumber]
ld [MapNumber], a
ld a, [NorthConnectionStripYOffset]
ld [YCoord], a
ld a, [NorthConnectionStripXOffset]
ld hl, XCoord
add [hl]
ld [hl], a
ld c, a
ld hl, NorthConnectionWindow
ld a, [hli]
ld h, [hl]
ld l, a
ld b, 0
srl c
add hl, bc
ld a, l
ld [$d194], a
ld a, h
ld [$d195], a
jp EnteredConnection
; 104696
EnterSouthConnection: ; 104696
ld a, [SouthConnectedMapGroup]
ld [MapGroup], a
ld a, [SouthConnectedMapNumber]
ld [MapNumber], a
ld a, [SouthConnectionStripYOffset]
ld [YCoord], a
ld a, [SouthConnectionStripXOffset]
ld hl, XCoord
add [hl]
ld [hl], a
ld c, a
ld hl, SouthConnectionWindow
ld a, [hli]
ld h, [hl]
ld l, a
ld b, 0
srl c
add hl, bc
ld a, l
ld [$d194], a
ld a, h
ld [$d195], a
; fallthrough
; 1046c4
EnteredConnection: ; 1046c4
scf
ret
; 1046c6
Function1046c6: ; 1046c6
call Function1046df
call Function104718
ld a, [$d146]
ld [WarpNumber], a ; $dcb4
ld a, [$d147]
ld [MapGroup], a ; $dcb5
ld a, [$d148]
ld [MapNumber], a ; $dcb6
ret
Function1046df: ; 1046df (41:46df)
call GetMapPermission
call CheckOutdoorMap
ret nz
ld a, [$d147]
ld b, a
ld a, [$d148]
ld c, a
call GetAnyMapPermission
call CheckIndoorMap
ret nz
ld a, [$d14a]
cp $f
jr nz, .asm_104705
ld a, [$d14b]
cp $a
ret z
cp $c
ret z
.asm_104705
ld a, [$d149]
ld [$dca9], a
ld a, [$d14a]
ld [$dcaa], a
ld a, [$d14b]
ld [$dcab], a
ret
Function104718: ; 104718 (41:4718)
call GetMapPermission
call CheckOutdoorMap
ret nz
ld a, [$d147]
ld b, a
ld a, [$d148]
ld c, a
call GetAnyMapPermission
call CheckIndoorMap
ret nz
ld a, [$d147]
ld b, a
ld a, [$d148]
ld c, a
call GetAnyMapTileset
ld a, c
cp $7
jr z, .asm_104743
cp $15
jr z, .asm_104743
ret
.asm_104743
ld a, [$d14a]
ld [$dcb2], a
ld a, [$d14b]
ld [$dcb3], a
ret
Function104750: ; 104750
ld hl, VramState ; $d0ed
res 6, [hl]
ld a, $1
ld [$c2ce], a
callba Function8c0e5
callba Function8c001
call Function2173
call Function104770
call Function1047a3
ret
Function104770: ; 104770 (41:4770)
ld a, $98
ld [$d153], a
xor a
ld [$d152], a
ld [hSCY], a ; $ff00+$d0
ld [hSCX], a ; $ff00+$cf
callba Function5958
ld a, [rVBK] ; $ff00+$4f
push af
ld a, $1
ld [rVBK], a ; $ff00+$4f
xor a
ld bc, $400
ld hl, $9800
call ByteFill
pop af
ld [rVBK], a ; $ff00+$4f
ld a, $60
ld bc, $400
ld hl, $9800
call ByteFill
ret
Function1047a3: ; 1047a3 (41:47a3)
ld de, TileMap ; $c4a0 (aliases: SpritesEnd)
call Function1047b4
ld a, [hCGB] ; $ff00+$e6
and a
ret z
ld de, AttrMap ; $cdd9
ld a, $1
ld [rVBK], a ; $ff00+$4f
Function1047b4: ; 1047b4 (41:47b4)
ld hl, $9800
ld c, $14
ld b, $12
.asm_1047bb
push bc
.asm_1047bc
ld a, [de]
inc de
ld [hli], a
dec c
jr nz, .asm_1047bc
ld bc, $c
add hl, bc
pop bc
dec b
jr nz, .asm_1047bb
ld a, $0
ld [rVBK], a ; $ff00+$4f
ret
Function1047cf: ; 1047cf
call LoadTilesetHeader
call Function2821
xor a
ld [$FF00+$de], a
xor a
ld [hTileAnimFrame], a ; $ff00+$df
callba Function14168
call Functione5f
callba Function106594
ret
Function1047eb: ; 1047eb
ld b, $9
jp GetSGBLayout
; 1047f0
Function1047f0: ; 1047f0
call ClearSprites
callba Functionb8000
call Function2914
callba Function579d
callba Function154f7
ld hl, $d45b
bit 6, [hl]
jr nz, .asm_104817
ld hl, VramState ; $d0ed
set 0, [hl]
call Function2e31
.asm_104817
ld a, [$d45b]
and $1c
ld [$d45b], a
ret
Function104820:: ; 104820 (41:4820)
ld a, [$d151]
cp $ff
ret z
and a
jr z, .asm_104837
cp $1
jr z, .asm_104846
cp $2
jr z, .asm_104851
cp $3
jr z, .asm_10485c
and a
ret
.asm_104837
ld a, [MapY] ; $d4e7
sub $4
ld b, a
ld a, [MapHeight]
add a
cp b
jr z, .asm_10486b
and a
ret
.asm_104846
ld a, [MapY] ; $d4e7
sub $4
cp $ff
jr z, .asm_10486b
and a
ret
.asm_104851
ld a, [MapX] ; $d4e6
sub $4
cp $ff
jr z, .asm_10486b
and a
ret
.asm_10485c
ld a, [MapX] ; $d4e6
sub $4
ld b, a
ld a, [MapWidth]
add a
cp b
jr z, .asm_10486b
and a
ret
.asm_10486b
scf
ret
Function10486d:: ; 10486d
ld hl, OverworldMap
ld a, [XCoord]
bit 0, a
jr nz, .asm_10487d
srl a
add $1
jr .asm_104881
.asm_10487d
add $1
srl a
.asm_104881
ld c, a
ld b, $0
add hl, bc
ld a, [MapWidth]
add $6
ld c, a
ld b, $0
ld a, [YCoord]
bit 0, a
jr nz, .asm_10489a
srl a
add $1
jr .asm_10489e
.asm_10489a
add $1
srl a
.asm_10489e
call AddNTimes
ld a, l
ld [$d194], a
ld a, h
ld [$d195], a
ld a, [YCoord]
and $1
ld [$d196], a
ld a, [XCoord]
and $1
ld [$d197], a
ret
; 1048ba
Function1048ba: ; 1048ba (41:48ba)
call ClearTileMap
call ClearSprites
call WaitBGMap
call Function105153
hlcoord 3, 8
ld de, $49cd
call PlaceString
call WaitBGMap
callba Function2c642
call Function1050fb
ld a, $2
ld [$ca01], a
ld a, $14
ld [$ca02], a
ld a, [rIE] ; $ff00+$ff
push af
call Function104a95
ld d, a
xor a
ld [rIF], a ; $ff00+$f
pop af
ld [rIE], a ; $ff00+$ff
push de
call ClearTileMap
call EnableLCD
call WaitBGMap
ld b, $8
call GetSGBLayout
call Function32f9
pop de
hlcoord 2, 8
ld a, d
ld de, $49fd
cp $10
jp z, Function1049af
cp $6c
jp nz, Function1049b4
ld a, [$c900]
cp $3
jr z, .asm_10492f
call Function104a25
ld hl, $4a11
jp nc, Function1049c5
call Function104a30
ld hl, $4a16
jp c, Function1049c5
.asm_10492f
ld a, [$c962]
and a
jp nz, Function1049bd
ld a, [$c912]
and a
jp nz, Function1049c2
ld a, [$c900]
cp $3
jr z, .asm_104963
call Function104a56
ld a, [$c900]
cp $4
jr z, .asm_104963
call Function104a71
callba Function10619d
callba Function1060a9
callba Function106187
.asm_104963
ld a, [$c90f]
and a
jr z, .asm_104990
ld a, [$c911]
ld c, a
callba Function2c715
push bc
call Function105069
pop bc
jr nz, .asm_104990
callab Function26ef5
ld h, d
ld l, e
ld de, StringBuffer1 ; $d073
ld bc, $d
call CopyBytes
ld hl, $4a20
jr Function1049c5
.asm_104990
call Function105106
ld a, [$c910]
ld c, a
callba Function2c708
ld a, c
ld [$abe4], a
ld [$d265], a
call CloseSRAM
call GetItemName
ld hl, $4a1b
jr Function1049c5
Function1049af: ; 1049af (41:49af)
ld hl, $49fd
jr Function1049c5
Function1049b4: ; 1049b4 (41:49b4)
ld hl, $4a02
call PrintText
jp Function1048ba
Function1049bd: ; 1049bd (41:49bd)
ld hl, $4a07
jr Function1049c5
Function1049c2: ; 1049c2 (41:49c2)
ld hl, $4a0c
Function1049c5: ; 1049c5 (41:49c5)
call PrintText
ld a, $e3
ld [rLCDC], a ; $ff00+$40
ret
; 1049cd (41:49cd)
INCBIN "baserom.gbc",$1049cd,$104a25 - $1049cd
Function104a25: ; 104a25 (41:4a25)
call Function105106
ld a, [$abe5]
cp $5
jp CloseSRAM
Function104a30: ; 104a30 (41:4a30)
call Function105106
ld a, [$c901]
ld b, a
ld a, [$c902]
ld c, a
ld a, [$abe5]
ld d, a
ld hl, $abe6
.asm_104a42
ld a, d
and a
jr z, .asm_104a53
ld a, [hli]
cp b
jr nz, .asm_104a4e
ld a, [hl]
cp c
jr z, .asm_104a52
.asm_104a4e
inc hl
dec d
jr .asm_104a42
.asm_104a52
scf
.asm_104a53
jp CloseSRAM
Function104a56: ; 104a56 (41:4a56)
call Function105106
ld hl, $abe5
ld a, [hl]
inc [hl]
ld hl, $abe6
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [$c901]
ld [hli], a
ld a, [$c902]
ld [hl], a
jp CloseSRAM
Function104a71: ; 104a71 (41:4a71)
call Function105106
ld a, $1
ld [$abfd], a
ld hl, $c903
ld de, $abfe
ld bc, $b
call CopyBytes
ld a, $1
ld [de], a
inc de
ld hl, $c850
ld bc, $26
call CopyBytes
jp CloseSRAM
Function104a95: ; 104a95 (41:4a95)
di
callba ClearChannels
call Function104d5e
.asm_104a9f
call Function104d96
call Function104ddd
ld a, [$FF00+$bc]
cp $10
jp z, Function104bd0
cp $6c
jr nz, .asm_104a9f
ld a, [$FF00+$bb]
cp $2
jr z, Function104b22
ld hl, $ffb3
ld b, $1
call Function104d56
jr nz, .asm_104ac8
call Function104b49
jp nz, Function104bd0
jr asm_104b0a
.asm_104ac8
ld a, [rLY] ; $ff00+$44
cp $90
jr c, .asm_104ac8
ld c, $56
ld a, $c0
ld [$ff00+c], a
ld b, $f0
.asm_104ad5
push bc
call Function105038
ld b, $2
ld c, $56
.asm_104add
ld a, [$ff00+c]
and b
ld b, a
ld a, [rLY] ; $ff00+$44
cp $90
jr nc, .asm_104add
.asm_104ae6
ld a, [$ff00+c]
and b
ld b, a
ld a, [rLY] ; $ff00+$44
cp $90
jr c, .asm_104ae6
ld a, b
pop bc
dec b
jr z, .asm_104a9f
or a
jr nz, .asm_104a9f
ld a, [$FF00+$c4]
bit 1, a
jr z, .asm_104ad5
ld a, $10
ld [$FF00+$bc], a
jp Function104bd0
Function104b04: ; 104b04 (41:4b04)
call Function104b40
jp nz, Function104bd0
asm_104b0a: ; 104b0a (41:4b0a)
call Function104d38
jp nz, Function104bd0
call Function104b88
jp nz, Function104bd0
call Function104d43
jp nz, Function104bd0
call Function105033
jp Function104bd0
Function104b22: ; 104b22 (41:4b22)
call Function104b88
jp nz, Function104bd0
call Function104d43
jp nz, Function104bd0
call Function104b40
jp nz, Function104bd0
call Function104d38
jp nz, Function104bd0
call Function10502e
jp Function104bd0
Function104b40: ; 104b40 (41:4b40)
ld hl, $ffb3
ld b, $1
call Function104d56
ret nz
Function104b49: ; 104b49 (41:4b49)
call Function105033
ld a, [$FF00+$bc]
cp $6c
ret nz
ld a, [$ffb3]
cp $96
jp nz, Function104d32
ld a, $90
ld [$ffb3], a
call Function104d38
ret nz
ld hl, $ffb3
ld b, $1
call Function104d4e
ret nz
call Function10502e
ld a, [$FF00+$bc]
cp $6c
ret nz
call Function104d43
ret nz
ld hl, $c850
ld a, [$ca02]
ld b, a
call Function104d56
ret nz
call Function105033
ld a, [$FF00+$bc]
cp $6c
ret
Function104b88: ; 104b88 (41:4b88)
ld a, $96
ld [$ffb3], a
ld hl, $ffb3
ld b, $1
call Function104d4e
ret nz
call Function10502e
ld a, [$FF00+$bc]
cp $6c
ret nz
call Function104d43
ret nz
ld hl, $ffb3
ld b, $1
call Function104d56
ret nz
call Function105033
ld a, [$FF00+$bc]
cp $6c
ret nz
ld a, [$ffb3]
cp $90
jp nz, Function104d32
call Function104d38
ret nz
ld hl, OverworldMap ; $c800
ld a, [$ca02]
ld b, a
call Function104d4e
ret nz
call Function10502e
ld a, [$FF00+$bc]
cp $6c
ret
Function104bd0: ; 104bd0 (41:4bd0)
nop
ld a, [$FF00+$bc]
cp $10
jr z, .asm_104c18
cp $6c
jr nz, .asm_104c18
ld hl, $ca01
dec [hl]
jr z, .asm_104c18
ld hl, $c850
ld de, $c900
ld bc, $14
call CopyBytes
ld a, [$c850]
cp $3
jr nc, .asm_104c18
callba Function10510b
call Function1050fb
ld a, $26
ld [$ca02], a
ld a, [$FF00+$bb]
cp $2
jr z, .asm_104c10
call Function104d43
jr nz, Function104bd0
jp Function104b04
.asm_104c10
call Function104d38
jr nz, Function104bd0
jp Function104b22
.asm_104c18
ld a, [$FF00+$bc]
push af
call Function104da0
xor a
ld [rIF], a ; $ff00+$f
ld a, [rIE] ; $ff00+$ff
or $1
ld [rIE], a ; $ff00+$ff
ei
call DelayFrame
pop af
ret
Function104c2d: ; 104c2d (41:4c2d)
di
callba ClearChannels
call Function104d5e
.asm_104c37
call Function104d96
call Function104ddd
ld a, [$FF00+$bc]
cp $10
jp z, Function104d1c
cp $6c
jr nz, .asm_104c37
ld a, [$FF00+$bb]
cp $2
jr z, .asm_104c6c
call Function104c8a
jp nz, Function104d1c
call Function104d38
jp nz, Function104d1c
call Function104cd2
jp nz, Function104d1c
call Function104d43
jp nz, Function104d1c
call Function105033
jp Function104d1c
.asm_104c6c
call Function104cd2
jp nz, Function104d1c
call Function104d43
jp nz, Function104d1c
call Function104c8a
jp nz, Function104d1c
call Function104d38
jp nz, Function104d1c
call Function10502e
jp Function104d1c
Function104c8a: ; 104c8a (41:4c8a)
ld hl, $ffb3
ld b, $1
call Function104d56
ret nz
call Function105033
ld a, [$FF00+$bc]
cp $6c
ret nz
ld a, [$ffb3]
cp $3c
jp nz, Function104d32
swap a
ld [$ffb3], a
call Function104d38
ret nz
ld hl, $ffb3
ld b, $1
call Function104d4e
ret nz
call Function10502e
ld a, [$FF00+$bc]
cp $6c
ret nz
call Function104d43
ret nz
ld hl, $c850
ld a, [$ca02]
ld b, a
call Function104d56
ret nz
call Function105033
ld a, [$FF00+$bc]
cp $6c
ret
Function104cd2: ; 104cd2 (41:4cd2)
ld a, $3c
ld [$ffb3], a
ld hl, $ffb3
ld b, $1
call Function104d4e
ret nz
call Function10502e
ld a, [$FF00+$bc]
cp $6c
ret nz
call Function104d43
ret nz
ld hl, $ffb3
ld b, $1
call Function104d56
ret nz
call Function105033
ld a, [$FF00+$bc]
cp $6c
ret nz
ld a, [$ffb3]
swap a
cp $3c
jp nz, Function104d32
call Function104d38
ret nz
ld hl, OverworldMap ; $c800
ld a, [$ca02]
ld b, a
call Function104d4e
ret nz
call Function10502e
ld a, [$FF00+$bc]
cp $6c
ret
Function104d1c: ; 104d1c (41:4d1c)
nop
ld a, [$FF00+$bc]
push af
call Function104da0
xor a
ld [rIF], a ; $ff00+$f
ld a, [rIE] ; $ff00+$ff
or $1
ld [rIE], a ; $ff00+$ff
ei
call DelayFrame
pop af
ret
Function104d32: ; 104d32 (41:4d32)
ld a, $80
ld [$FF00+$bc], a
and a
ret
Function104d38: ; 104d38 (41:4d38)
call Function104d96
call Function104e46
ld a, [$FF00+$bc]
cp $6c
ret
Function104d43: ; 104d43 (41:4d43)
call Function104d96
call Function104dfe
ld a, [$FF00+$bc]
cp $6c
ret
Function104d4e: ; 104d4e (41:4d4e)
call Function104e93
ld a, [$FF00+$bc]
cp $6c
ret
Function104d56: ; 104d56 (41:4d56)
call Function104f57
ld a, [$FF00+$bc]
cp $6c
ret
Function104d5e: ; 104d5e (41:4d5e)
call Function104d74
ld a, $4
ld [rIE], a ; $ff00+$ff
xor a
ld [rIF], a ; $ff00+$f
call Function104d96
xor a
ld b, a
.asm_104d6d
inc a
jr nz, .asm_104d6d
inc b
jr nz, .asm_104d6d
ret
Function104d74: ; 104d74 (41:4d74)
xor a
ld [rTAC], a ; $ff00+$7
ld a, $fe
ld [rTMA], a ; $ff00+$6
ld [rTIMA], a ; $ff00+$5
ld a, $2
ld [rTAC], a ; $ff00+$7
or $4
ld [rTAC], a ; $ff00+$7
ret
Function104d86: ; 104d86 (41:4d86)
xor a
ld [rTAC], a ; $ff00+$7
ld [rTMA], a ; $ff00+$6
ld [rTIMA], a ; $ff00+$5
ld a, $2
ld [rTAC], a ; $ff00+$7
or $4
ld [rTAC], a ; $ff00+$7
ret
Function104d96: ; 104d96 (41:4d96)
ld a, $c0
call Function104e8c
ld a, $1
ld [$FF00+$bb], a
ret
Function104da0: ; 104da0 (41:4da0)
xor a
call Function104e8c
ld a, $2
ld [rTAC], a ; $ff00+$7
ret
Function104da9: ; 104da9 (41:4da9)
inc d
ret z
xor a
ld [rIF], a ; $ff00+$f
db $76 ;halt (prevents rgbasm from putting in an extra nop)
nop
ld a, [$ff00+c]
bit 1, a
jr z, Function104da9
or a
ret
Function104db7: ; 104db7 (41:4db7)
inc d
ret z
xor a
ld [rIF], a ; $ff00+$f
db $76 ;halt (prevents rgbasm from putting in an extra nop)
nop
ld a, [$ff00+c]
bit 1, a
jr nz, Function104db7
or a
ret
Function104dc5: ; 104dc5 (41:4dc5)
ld a, $c1
ld [$ff00+c], a
.asm_104dc8
dec d
ret z
xor a
ld [rIF], a ; $ff00+$f
db $76 ;halt (prevents rgbasm from putting in an extra nop)
nop
jr .asm_104dc8
Function104dd1: ; 104dd1 (41:4dd1)
ld a, $c0
ld [$ff00+c], a
.asm_104dd4
dec d
ret z
xor a
ld [rIF], a ; $ff00+$f
db $76 ;halt (prevents rgbasm from putting in an extra nop)
nop
jr .asm_104dd4
Function104ddd: ; 104ddd (41:4ddd)
ld d, $0
ld e, d
ld a, $1
ld [$FF00+$bb], a
.asm_104de4
call Function105038
ld b, $2
ld c, $56
ld a, [$FF00+$c4]
bit 1, a
jr z, .asm_104df6
ld a, $10
ld [$FF00+$bc], a
ret
.asm_104df6
bit 0, a
jr nz, asm_104e3a
ld a, [$ff00+c]
and b
jr nz, .asm_104de4
Function104dfe: ; 104dfe (41:4dfe)
ld c, $56
ld d, $0
ld e, d
call Function104db7
jp z, Function104f42
ld d, e
call Function104da9
jp z, Function104f42
call Function104db7
jp z, Function104f42
call Function104da9
jp z, Function104f42
ld a, $6c
ld [$FF00+$bc], a
ld d, $3d
call Function104dd1
ld d, $5
call Function104dc5
ld d, $15
call Function104dd1
ld d, $5
call Function104dc5
ld d, $5
call Function104dd1
ret
asm_104e3a: ; 104e3a (41:4e3a)
call Random
ld e, a
and $f
ld d, a
.asm_104e41
dec de
ld a, d
or e
jr nz, .asm_104e41
Function104e46: ; 104e46 (41:4e46)
ld a, $2
ld [$FF00+$bb], a
ld c, $56
ld d, $0
ld e, d
ld d, $3d
call Function104dd1
ld d, $5
call Function104dc5
ld d, $15
call Function104dd1
ld d, $5
call Function104dc5
ld d, $5
call Function104dd1
ld d, e
call Function104db7
jp z, Function104f42
ld d, e
call Function104da9
jp z, Function104f42
call Function104db7
jp z, Function104f42
call Function104da9
jp z, Function104f42
ld d, $3d
call Function104dd1
ld a, $6c
ld [$FF00+$bc], a
ret
Function104e8c: ; 104e8c (41:4e8c)
ld [rRP], a ; $ff00+$56
ld a, $ff
ld [$FF00+$bc], a
ret
Function104e93: ; 104e93 (41:4e93)
xor a
ld [hDivisor], a ; $ff00+$b7 (aliases: hMultiplier)
ld [hMathBuffer], a ; $ff00+$b8
push hl
push bc
ld c, $56
ld d, $3d
call Function104dd1
ld hl, hQuotient ; $ffb4 (aliases: hMultiplicand)
ld a, $5a
ld [hli], a
ld [hl], b
dec hl
ld b, $2
call Function104ed6
pop bc
pop hl
call Function104ed6
ld a, [hDivisor] ; $ff00+$b7 (aliases: hMultiplier)
ld [hQuotient], a ; $ff00+$b4 (aliases: hMultiplicand)
ld a, [hMathBuffer] ; $ff00+$b8
ld [$FF00+$b5], a
push hl
ld hl, hQuotient ; $ffb4 (aliases: hMultiplicand)
ld b, $2
call Function104ed6
ld hl, $ffbc
ld b, $1
call Function104faf
ld a, [hQuotient] ; $ff00+$b4 (aliases: hMultiplicand)
ld [hDivisor], a ; $ff00+$b7 (aliases: hMultiplier)
ld a, [$FF00+$b5]
ld [hMathBuffer], a ; $ff00+$b8
pop hl
ret
Function104ed6: ; 104ed6 (41:4ed6)
ld c, $56
ld d, $5
call Function104dd1
ld d, $5
call Function104dc5
ld d, $15
call Function104dd1
ld a, b
cpl
ld b, a
ld a, $f4
ld [rTMA], a ; $ff00+$6
.asm_104eee
inc b
jr z, .asm_104f2e
ld a, $8
ld [$FF00+$b6], a
ld a, [hli]
ld e, a
ld a, [hDivisor] ; $ff00+$b7 (aliases: hMultiplier)
add e
ld [hDivisor], a ; $ff00+$b7 (aliases: hMultiplier)
ld a, [hMathBuffer] ; $ff00+$b8
adc $0
ld [hMathBuffer], a ; $ff00+$b8
.asm_104f02
xor a
ld [rIF], a ; $ff00+$f
db $76 ;halt (prevents rgbasm from putting in an extra nop)
nop
ld a, $c1
ld [rRP], a ; $ff00+$56
ld d, $1
ld a, e
rlca
ld e, a
jr nc, .asm_104f13
inc d
.asm_104f13
ld a, [rTIMA] ; $ff00+$5
cp $f8
jr c, .asm_104f13
ld a, $c0
ld [rRP], a ; $ff00+$56
dec d
jr z, .asm_104f25
xor a
ld [rIF], a ; $ff00+$f
db $76 ;halt (prevents rgbasm from putting in an extra nop)
nop
.asm_104f25
ld a, [$FF00+$b6]
dec a
jr z, .asm_104eee
ld [$FF00+$b6], a
jr .asm_104f02
.asm_104f2e
ld a, $fe
ld [rTMA], a ; $ff00+$6
xor a
ld [rIF], a ; $ff00+$f
db $76 ;halt (prevents rgbasm from putting in an extra nop)
nop
ld d, $5
call Function104dc5
ld d, $11
call Function104dd1
ret
Function104f42: ; 104f42 (41:4f42)
ld a, [$FF00+$bc]
or $2
ld [$FF00+$bc], a
ret
Function104f49: ; 104f49 (41:4f49)
ld a, [$FF00+$bc]
or $1
ld [$FF00+$bc], a
ret
Function104f50: ; 104f50 (41:4f50)
ld a, [$FF00+$bc]
or $80
ld [$FF00+$bc], a
ret
Function104f57: ; 104f57 (41:4f57)
xor a
ld [hDivisor], a ; $ff00+$b7 (aliases: hMultiplier)
ld [hMathBuffer], a ; $ff00+$b8
push bc
push hl
ld hl, hQuotient ; $ffb4 (aliases: hMultiplicand)
ld b, $2
call Function104faf
ld a, [$FF00+$b5]
ld [$FF00+$ba], a
ld b, a
pop hl
pop af
cp b
jp c, Function104f50
ld a, [hQuotient] ; $ff00+$b4 (aliases: hMultiplicand)
cp $5a
jp nz, Function104f50
call Function104faf
ld a, [hDivisor] ; $ff00+$b7 (aliases: hMultiplier)
ld d, a
ld a, [hMathBuffer] ; $ff00+$b8
ld e, a
push hl
push de
ld hl, hQuotient ; $ffb4 (aliases: hMultiplicand)
ld b, $2
call Function104faf
pop de
ld hl, hQuotient ; $ffb4 (aliases: hMultiplicand)
ld a, [hli]
xor d
ld b, a
ld a, [hl]
xor e
or b
call nz, Function104f49
push de
ld d, $3d
call Function104dd1
ld hl, $ffbc
ld b, $1
call Function104ed6
pop de
pop hl
ld a, d
ld [hDivisor], a ; $ff00+$b7 (aliases: hMultiplier)
ld a, e
ld [hMathBuffer], a ; $ff00+$b8
ret
Function104faf: ; 104faf (41:4faf)
ld c, $56
ld d, $0
call Function104db7
jp z, Function104f42
ld d, $0
call Function104da9
jp z, Function104f42
ld d, $0
call Function104db7
jp z, Function104f42
ld a, b
cpl
ld b, a
xor a
ld [$FF00+$c5], a
call Function104d86
.asm_104fd2
inc b
jr z, .asm_10501a
ld a, $8
ld [$FF00+$b6], a
.asm_104fd9
ld d, $0
.asm_104fdb
inc d
jr z, .asm_104fe5
ld a, [$ff00+c]
bit 1, a
jr z, .asm_104fdb
ld d, $0
.asm_104fe5
inc d
jr z, .asm_104fed
ld a, [$ff00+c]
bit 1, a
jr nz, .asm_104fe5
.asm_104fed
ld a, [$FF00+$c5]
ld d, a
ld a, [rTIMA] ; $ff00+$5
ld [$FF00+$c5], a
sub d
cp $12
jr c, .asm_104ffd
set 0, e
jr .asm_104fff
.asm_104ffd
res 0, e
.asm_104fff
ld a, [$FF00+$b6]
dec a
ld [$FF00+$b6], a
jr z, .asm_10500b
ld a, e
rlca
ld e, a
jr .asm_104fd9
.asm_10500b
ld a, e
ld [hli], a
ld a, [hDivisor] ; $ff00+$b7 (aliases: hMultiplier)
add e
ld [hDivisor], a ; $ff00+$b7 (aliases: hMultiplier)
ld a, [hMathBuffer] ; $ff00+$b8
adc $0
ld [hMathBuffer], a ; $ff00+$b8
jr .asm_104fd2
.asm_10501a
call Function104d74
xor a
ld [rIF], a ; $ff00+$f
ld d, $0
call Function104da9
jp z, Function104f42
ld d, $10
call Function104dd1
ret
Function10502e: ; 10502e (41:502e)
ld b, $0
jp Function104e93
Function105033: ; 105033 (41:5033)
ld b, $0
jp Function104f57
Function105038: ; 105038 (41:5038)
ld a, $20
ld [rJOYP], a ; $ff00+$0
ld a, [rJOYP] ; $ff00+$0
ld a, [rJOYP] ; $ff00+$0
cpl
and $f
swap a
ld b, a
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
cpl
and $f
or b
ld c, a
ld a, [$FF00+$c3]
xor c
and c
ld [$FF00+$c4], a
ld a, c
ld [$FF00+$c3], a
ld a, $30
ld [rJOYP], a ; $ff00+$0
ret
Function105069: ; 105069 (41:5069)
call Function105106
ld d, $0
ld b, $2
ld hl, $abf0
predef_id FlagPredef
push hl
push bc
call Predef
call CloseSRAM
ld a, c
and a
pop bc
pop hl
ret nz
call Function105106
ld b, $1
predef FlagPredef
call CloseSRAM
xor a
ret
Function105091: ; 105091 (41:5091)
call Function105106
ld c, $0
.asm_105096
push bc
ld d, $0
ld b, $2
ld hl, $abf0
predef FlagPredef
ld a, c
and a
pop bc
jr z, .asm_1050b0
push bc
callab Function26f02
pop bc
.asm_1050b0
inc c
ld a, c
cp $2b
jr c, .asm_105096
jp CloseSRAM
Function1050b9: ; 1050b9
call Function105106
ld hl, $abe3
ld a, [hl]
inc a
jr nz, .asm_1050c5
ld [hld], a
ld [hl], a
.asm_1050c5
jp CloseSRAM
; 1050c8
Function1050c8: ; 1050c8
call Function105106
ld a, [$abe5]
cp $ff
jr z, .asm_1050d6
xor a
ld [$abe5], a
.asm_1050d6
jp CloseSRAM
; 1050d9
Function1050d9: ; 1050d9
call Function105106
ld hl, $abe2
ld de, $abe4
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
jp CloseSRAM
; 1050ea
Function1050ea: ; 1050ea (41:50ea)
call Function105106
ld hl, $abe4
ld de, $abe2
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
jp CloseSRAM
Function1050fb: ; 1050fb (41:50fb)
ld hl, $c850
xor a
ld b, $26
.asm_105101
ld [hli], a
dec b
jr nz, .asm_105101
ret
Function105106: ; 105106
ld a, $0
jp GetSRAMBank
; 10510b
Function10510b: ; 10510b (41:510b)
ld a, $1
call GetSRAMBank
ld de, OverworldMap ; $c800
ld bc, $a86d
ld hl, $a866
.asm_105119
ld a, [hli]
cp $ff
jr z, .asm_105148
cp $fd
jr z, .asm_10513e
push hl
ld hl, $1f
add hl, bc
ld a, [hl]
ld [de], a
inc de
ld hl, $0
add hl, bc
ld a, [hl]
ld [de], a
inc de
ld hl, $2
add hl, bc
push bc
ld bc, $4
call CopyBytes
pop bc
pop hl
.asm_10513e
push hl
ld hl, $30
add hl, bc
ld b, h
ld c, l
pop hl
jr .asm_105119
.asm_105148
ld a, $ff
ld [de], a
ld a, $26
ld [$ca00], a
jp CloseSRAM
Function105153: ; 105153 (41:5153)
call WhiteBGMap
call DisableLCD
ld hl, $5258
ld de, $9000
ld a, $41
ld bc, $430
call FarCopyBytes
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld a, $42
ld bc, $168
call ByteFill
hlcoord 3, 7
ld bc, $90f
call ClearBox
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld a, $0
ld [hli], a
inc a
ld [hl], a
hlcoord 0, 1
inc a
ld [hli], a
inc a
ld [hl], a
hlcoord 7, 1
ld a, $12
call Function10522e
hlcoord 2, 2
ld a, $17
call Function105236
hlcoord 2, 3
ld a, $27
call Function105236
hlcoord 9, 4
ld a, $37
ld [hli], a
inc a
ld [hl], a
hlcoord 1, 2
ld [hl], $4
hlcoord 1, 3
ld a, $5
call Function105246
ld a, $9
hlcoord 18, 5
call Function105242
hlcoord 2, 5
ld a, $b
call Function105251
hlcoord 2, 16
ld a, $7
call Function105251
hlcoord 2, 5
ld a, $d
call Function10522e
hlcoord 7, 5
ld [hl], $c
hlcoord 18, 5
ld [hl], $a
hlcoord 18, 16
ld [hl], $8
hlcoord 1, 16
ld [hl], $6
hlcoord 2, 6
ld a, $3a
call Function105251
hlcoord 2, 15
ld a, $40
call Function105251
hlcoord 2, 6
ld a, $3c
call Function10523e
hlcoord 17, 6
ld a, $3e
call Function10523e
hlcoord 2, 6
ld [hl], $39
hlcoord 17, 6
ld [hl], $3b
hlcoord 2, 15
ld [hl], $3f
hlcoord 17, 15
ld [hl], $41
call EnableLCD
call WaitBGMap
ld b, $1d
call GetSGBLayout
call Function32f9
ret
Function10522e: ; 10522e (41:522e)
ld b, $5
jr asm_105238
; 105232 (41:5232)
INCBIN "baserom.gbc",$105232,$105236 - $105232
Function105236: ; 105236 (41:5236)
ld b, $10
asm_105238: ; 105238 (41:5238)
ld [hli], a
inc a
dec b
jr nz, asm_105238
ret
Function10523e: ; 10523e (41:523e)
ld b, $9
jr asm_105248
Function105242: ; 105242 (41:5242)
ld b, $b
jr asm_105248
Function105246: ; 105246 (41:5246)
ld b, $e
asm_105248: ; 105248 (41:5248)
ld [hl], a
ld de, $14
add hl, de
dec b
jr nz, asm_105248
ret
Function105251: ; 105251 (41:5251)
ld b, $10
.asm_105253
ld [hli], a
dec b
jr nz, .asm_105253
ret
MysteryGiftGFX:
INCBIN "gfx/misc/mystery_gift.2bpp"
Function105688: ; 105688 (41:5688)
call ClearTileMap
call ClearSprites
call WaitBGMap
call Function1057d7
hlcoord 3, 8
ld de, $572e
call PlaceString
call WaitBGMap
call Function10578c
call Function1050fb
ld a, $24
ld [$ca02], a
ld a, [rIE] ; $ff00+$ff
push af
call Function104c2d
ld d, a
xor a
ld [rIF], a ; $ff00+$f
pop af
ld [rIE], a ; $ff00+$ff
ld a, d
cp $10
jp z, Function105712
cp $6c
jp nz, Function10571a
call Function1056eb
ld c, $3c
call DelayFrames
call Function105777
ld hl, $575e
call PrintText
ld de, $c850
callba Function8ac70
ld a, c
ld [$d265], a
ld hl, $5768
jr c, asm_105726
ld hl, $5763
jr asm_105726
Function1056eb: ; 1056eb (41:56eb)
ld c, $10
.asm_1056ed
ld hl, Sprites ; $c400
ld b, $8
.asm_1056f2
dec [hl]
inc hl
inc hl
inc hl
inc hl
dec b
jr nz, .asm_1056f2
ld hl, $c420
ld b, $8
.asm_1056ff
inc [hl]
inc hl
inc hl
inc hl
inc hl
dec b
jr nz, .asm_1056ff
dec c
ret z
push bc
ld c, $4
call DelayFrames
pop bc
jr .asm_1056ed
Function105712: ; 105712 (41:5712)
call Function105777
ld hl, $576d
jr asm_105726
Function10571a: ; 10571a (41:571a)
call Function105777
ld hl, $5772
call PrintText
jp Function105688
asm_105726: ; 105726 (41:5726)
call PrintText
ld a, $e3
ld [rLCDC], a ; $ff00+$40
ret
; 10572e (41:572e)
INCBIN "baserom.gbc",$10572e,$105777 - $10572e
Function105777: ; 105777 (41:5777)
call ClearSprites
call ClearTileMap
call EnableLCD
call WaitBGMap
ld b, $8
call GetSGBLayout
call Function32f9
ret
Function10578c: ; 10578c (41:578c)
ld de, OverworldMap ; $c800
ld a, $1
call GetSRAMBank
ld hl, $a00b
ld bc, $b
call CopyBytes
ld hl, $a009
ld bc, $2
call CopyBytes
ld hl, $a3d8
ld bc, $2
call CopyBytes
call CloseSRAM
ld a, $1
call GetSRAMBank
ld a, [$be3d]
ld [de], a
inc de
ld a, $4
call GetSRAMBank
ld hl, $a603
ld bc, $8
call CopyBytes
ld hl, $a007
ld bc, $c
call CopyBytes
call CloseSRAM
ret
Function1057d7: ; 1057d7 (41:57d7)
call WhiteBGMap
call DisableLCD
ld hl, $5930
ld de, $9000
ld a, $41
ld bc, $400
call FarCopyBytes
ld hl, $5d30
ld de, $8000
ld a, $41
ld bc, $80
call FarCopyBytes
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld a, $3f
ld bc, $168
call ByteFill
hlcoord 3, 7
ld bc, $90f
call ClearBox
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld a, $0
ld [hli], a
inc a
ld [hl], a
hlcoord 0, 1
inc a
ld [hli], a
inc a
ld [hl], a
hlcoord 4, 2
ld a, $13
call Function1058ca
hlcoord 4, 3
ld a, $1e
call Function1058ce
hlcoord 4, 4
ld a, $2a
call Function1058ce
hlcoord 1, 2
ld [hl], $4
hlcoord 1, 3
ld a, $5
call Function1058de
ld a, $9
hlcoord 18, 5
call Function1058da
hlcoord 2, 5
ld a, $b
call Function1058e9
hlcoord 2, 16
ld a, $7
call Function1058e9
hlcoord 2, 5
ld a, $d
call Function1058c6
hlcoord 8, 5
ld [hl], $c
hlcoord 18, 5
ld [hl], $a
hlcoord 18, 16
ld [hl], $8
hlcoord 1, 16
ld [hl], $6
hlcoord 2, 6
ld a, $37
call Function1058e9
hlcoord 2, 15
ld a, $3d
call Function1058e9
hlcoord 2, 6
ld a, $39
call Function1058d6
hlcoord 17, 6
ld a, $3b
call Function1058d6
hlcoord 2, 6
ld [hl], $36
hlcoord 17, 6
ld [hl], $38
hlcoord 2, 15
ld [hl], $3c
hlcoord 17, 15
ld [hl], $3e
ld de, Sprites ; $c400
ld hl, $58f0
ld bc, $40
call CopyBytes
call EnableLCD
call WaitBGMap
ld b, $2
callba Function4930f
jp Function32f9
Function1058c6: ; 1058c6 (41:58c6)
ld b, $6
jr asm_1058d0
Function1058ca: ; 1058ca (41:58ca)
ld b, $b
jr asm_1058d0
Function1058ce: ; 1058ce (41:58ce)
ld b, $c
asm_1058d0: ; 1058d0 (41:58d0)
ld [hli], a
inc a
dec b
jr nz, asm_1058d0
ret
Function1058d6: ; 1058d6 (41:58d6)
ld b, $9
jr asm_1058e0
Function1058da: ; 1058da (41:58da)
ld b, $b
jr asm_1058e0
Function1058de: ; 1058de (41:58de)
ld b, $e
asm_1058e0: ; 1058e0 (41:58e0)
ld [hl], a
ld de, $14
add hl, de
dec b
jr nz, asm_1058e0
ret
Function1058e9: ; 1058e9 (41:58e9)
ld b, $10
.asm_1058eb
ld [hli], a
dec b
jr nz, .asm_1058eb
ret
; 1058f0 (41:58f0)
INCBIN "baserom.gbc",$1058f0,$105930 - $1058f0
; japanese mystery gift gfx
INCBIN "gfx/misc/mystery_gift_jp.2bpp"
DisplayUsedMoveText: ; 105db0
; battle command 03
ld hl, UsedMoveText
call BattleTextBox
jp WaitBGMap
; 105db9
UsedMoveText: ; 105db9
; this is a stream of text and asm from 105db9 to 105ef6
text_jump _ActorNameText
start_asm
ld a, [hBattleTurn]
and a
jr nz, .start
ld a, [wPlayerMoveStruct + MOVE_ANIM]
call UpdateUsedMoves
.start
ld a, BATTLE_VARS_LAST_MOVE
call GetBattleVarAddr
ld d, h
ld e, l
ld a, BATTLE_VARS_LAST_COUNTER_MOVE
call GetBattleVarAddr
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
ld [$d265], a
push hl
callba Function34548
pop hl
jr nz, .grammar
; update last move
ld a, [$d265]
ld [hl], a
ld [de], a
.grammar
call GetMoveGrammar
; $d265 now contains MoveGrammar
; everything except 'instead' made redundant in localization
; check obedience
ld a, [AlreadyDisobeyed]
and a
ld hl, UsedMove2Text
ret nz
; check move grammar
ld a, [$d265]
cp $3
ld hl, UsedMove2Text
ret c
ld hl, UsedMove1Text
ret
; 105e04
UsedMove1Text: ; 105e04
text_jump _UsedMove1Text
start_asm
jr Function105e10
; 105e0b
UsedMove2Text: ; 105e0b
text_jump _UsedMove2Text
start_asm
; 105e10
Function105e10: ; 105e10
; check obedience
ld a, [AlreadyDisobeyed]
and a
jr z, GetMoveNameText
; print "instead,"
ld hl, UsedInsteadText
ret
; 105e1a
UsedInsteadText: ; 105e1a
text_jump _UsedInsteadText
start_asm
; 105e1f
GetMoveNameText: ; 105e1f
ld hl, MoveNameText
ret
; 105e23
MoveNameText: ; 105e23
text_jump _MoveNameText
start_asm
; 105e28
GetUsedMoveTextEnder: ; 105e28
; get start address
ld hl, .endusedmovetexts
; get move id
ld a, [$d265]
; 2-byte pointer
add a
; seek
push bc
ld b, $0
ld c, a
add hl, bc
pop bc
; get pointer to usedmovetext ender
ld a, [hli]
ld h, [hl]
ld l, a
ret
; 105e39
.endusedmovetexts ; 105e39
dw EndUsedMove1Text
dw EndUsedMove2Text
dw EndUsedMove3Text
dw EndUsedMove4Text
dw EndUsedMove5Text
; 105e43
EndUsedMove1Text: ; 105e43
text_jump _EndUsedMove1Text
db "@"
; 105e48
EndUsedMove2Text: ; 105e48
text_jump _EndUsedMove2Text
db "@"
; 105e4d
EndUsedMove3Text: ; 105e4d
text_jump _EndUsedMove3Text
db "@"
; 105e52
EndUsedMove4Text: ; 105e52
text_jump _EndUsedMove4Text
db "@"
; 105e57
EndUsedMove5Text: ; 105e57
text_jump _EndUsedMove5Text
db "@"
; 105e5c
GetMoveGrammar: ; 105e5c
; store move grammar type in $d265
push bc
; c = move id
ld a, [$d265]
ld c, a
ld b, $0
; read grammar table
ld hl, MoveGrammar
.loop
ld a, [hli]
; end of table?
cp $ff
jr z, .end
; match?
cp c
jr z, .end
; advance grammar type at $00
and a
jr nz, .loop
; next grammar type
inc b
jr .loop
.end
; $d265 now contains move grammar
ld a, b
ld [$d265], a
; we're done
pop bc
ret
; 105e7a
MoveGrammar: ; 105e7a
; made redundant in localization
; each move is given an identifier for what usedmovetext to use (0-4):
; 0
db SWORDS_DANCE
db GROWTH
db STRENGTH
db HARDEN
db MINIMIZE
db SMOKESCREEN
db WITHDRAW
db DEFENSE_CURL
db EGG_BOMB
db SMOG
db BONE_CLUB
db FLASH
db SPLASH
db ACID_ARMOR
db BONEMERANG
db REST
db SHARPEN
db SUBSTITUTE
db MIND_READER
db SNORE
db PROTECT
db SPIKES
db ENDURE
db ROLLOUT
db SWAGGER
db SLEEP_TALK
db HIDDEN_POWER
db PSYCH_UP
db EXTREMESPEED
db 0 ; end set
; 1
db RECOVER
db TELEPORT
db BIDE
db SELFDESTRUCT
db AMNESIA
db FLAIL
db 0 ; end set
; 2
db MEDITATE
db AGILITY
db MIMIC
db DOUBLE_TEAM
db BARRAGE
db TRANSFORM
db STRUGGLE
db SCARY_FACE
db 0 ; end set
; 3
db POUND
db SCRATCH
db VICEGRIP
db WING_ATTACK
db FLY
db BIND
db SLAM
db HORN_ATTACK
db WRAP
db THRASH
db TAIL_WHIP
db LEER
db BITE
db GROWL
db ROAR
db SING
db PECK
db ABSORB
db STRING_SHOT
db EARTHQUAKE
db FISSURE
db DIG
db TOXIC
db SCREECH
db METRONOME
db LICK
db CLAMP
db CONSTRICT
db POISON_GAS
db BUBBLE
db SLASH
db SPIDER_WEB
db NIGHTMARE
db CURSE
db FORESIGHT
db CHARM
db ATTRACT
db ROCK_SMASH
db 0 ; end set
; all other moves = 4
db $ff ; end
; 105ed0
UpdateUsedMoves: ; 105ed0
; append move a to PlayerUsedMoves unless it has already been used
push bc
; start of list
ld hl, PlayerUsedMoves
; get move id
ld b, a
; loop count
ld c, NUM_MOVES
.loop
; get move from the list
ld a, [hli]
; not used yet?
and a
jr z, .add
; already used?
cp b
jr z, .quit
; next byte
dec c
jr nz, .loop
; if the list is full and the move hasn't already been used
; shift the list back one byte, deleting the first move used
; this can occur with struggle or a new learned move
ld hl, PlayerUsedMoves + 1
; 1 = 2
ld a, [hld]
ld [hli], a
; 2 = 3
inc hl
ld a, [hld]
ld [hli], a
; 3 = 4
inc hl
ld a, [hld]
ld [hl], a
; 4 = new move
ld a, b
ld [PlayerUsedMoves + 3], a
jr .quit
.add
; go back to the byte we just inced from
dec hl
; add the new move
ld [hl], b
.quit
; list updated
pop bc
ret
; 105ef6
Mobile_HallOfFame2:: ; 0x105ef6
ret
; 105ef7
Function105ef7: ; 105ef7
ld a, $5
call GetSRAMBank
ld hl, GameTimeHours
ld de, $a001
ld bc, $0004
call CopyBytes
ld hl, $a010
ld de, $a005
ld bc, $0004
call CopyBytes
ld hl, $a039
ld de, $a009
ld bc, $0004
call CopyBytes
ld hl, $a01b
ld de, $a00d
ld bc, $0003
call CopyBytes
call Function106162
call CloseSRAM
ret
; 105f33
Function105f33: ; 105f33
ret
; 105f34
Function105f34: ; 105f34
ld a, $5
call GetSRAMBank
ld de, Buffer1
ld hl, $a07b
ld a, [de]
cp [hl]
jr z, .asm_105f47
jr nc, .asm_105f4f
jr .asm_105f55
.asm_105f47
inc hl
inc de
ld a, [de]
cp [hl]
dec hl
dec de
jr c, .asm_105f55
.asm_105f4f
ld a, [de]
inc de
ld [hli], a
ld a, [de]
dec de
ld [hl], a
.asm_105f55
ld hl, $a07d
ld a, [hli]
or [hl]
dec hl
jr z, .asm_105f6d
ld a, [de]
cp [hl]
jr z, .asm_105f65
jr c, .asm_105f6d
jr .asm_105f72
.asm_105f65
inc hl
inc de
ld a, [de]
cp [hl]
jr nc, .asm_105f72
dec hl
dec de
.asm_105f6d
ld a, [de]
inc de
ld [hli], a
ld a, [de]
ld [hl], a
.asm_105f72
call Function106162
call CloseSRAM
ret
; 105f79
Function105f79: ; 105f79
ret
; 105f7a
Function105f7a: ; 105f7a
ld a, $5
call GetSRAMBank
ld a, [hProduct]
ld hl, $a07f
cp [hl]
jr z, .asm_105f8b
jr nc, .asm_105f92
jr .asm_105f98
.asm_105f8b
inc hl
ld a, [hMultiplicand]
cp [hl]
jr c, .asm_105f98
dec hl
.asm_105f92
ld a, [hProduct]
ld [hli], a
ld a, [hMultiplicand]
ld [hl], a
.asm_105f98
call Function106162
call CloseSRAM
ret
; 105f9f
Function105f9f: ; 105f9f
ret
; 105fa0
Function105fa0: ; 105fa0
ld a, $5
call GetSRAMBank
ld hl, $a070
inc [hl]
jr nz, .asm_105fae
dec hl
inc [hl]
inc hl
.asm_105fae
dec hl
ld a, [$a071]
cp [hl]
jr z, .asm_105fb9
jr c, .asm_105fc1
jr .asm_105fc9
.asm_105fb9
inc hl
ld a, [$a072]
cp [hl]
jr nc, .asm_105fc9
dec hl
.asm_105fc1
ld a, [hli]
ld [$a071], a
ld a, [hl]
ld [$a072], a
.asm_105fc9
call Function106162
call CloseSRAM
ret
; 105fd0
Function105fd0: ; 105fd0
ret
; 105fd1
Function105fd1: ; 105fd1
ld a, $5
call GetSRAMBank
ld hl, $a06f
xor a
ld [hli], a
ld [hl], a
call Function106162
call CloseSRAM
ret
; 105fe3
Function105fe3: ; 105fe3
ret
; 105fe4
Function105fe4: ; 105fe4
ld a, $5
call GetSRAMBank
ld hl, $a076
ld a, e
add [hl]
ld [hld], a
ld a, d
adc [hl]
ld [hld], a
jr nc, .asm_106001
inc [hl]
jr nz, .asm_106001
dec hl
inc [hl]
jr nz, .asm_106001
ld a, $ff
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
.asm_106001
call Function106162
call CloseSRAM
ret
; 106008
Function106008: ; 106008
ret
; 106009
Function106009: ; 106009
ld a, $5
call GetSRAMBank
ld hl, $a07a
ld a, [bc]
dec bc
add [hl]
ld [hld], a
ld a, [bc]
dec bc
adc [hl]
ld [hld], a
ld a, [bc]
adc [hl]
ld [hld], a
jr nc, .asm_106027
inc [hl]
jr nz, .asm_106027
ld a, $ff
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
.asm_106027
call Function106162
call CloseSRAM
ret
; 10602e
Function10602e: ; 10602e (41:602e)
ret
; 10602f (41:602f)
INCBIN "baserom.gbc",$10602f,$106049 - $10602f
Function106049: ; 106049
ret
; 10604a (41:604a)
INCBIN "baserom.gbc",$10604a,$106050 - $10604a
Function106050: ; 106050
ret
; 106051
Function106051: ; 106051
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
ret z
ld hl, $a01b
jp Function10611d
; 10605d
Function10605d: ; 10605d
ret
; 10605e
Function10605e: ; 10605e
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
ret z
ld hl, $a01e
jp Function10611d
; 10606a
Function10606a: ; 10606a
ret
; 10606b
Function10606b: ; 10606b
ld hl, $a021
jp Function10611d
; 106071
INCBIN "baserom.gbc",$106071,$106078 - $106071
Mobile_HallOfFame:: ; 0x106078
ret
Function106079: ; 106079
ld hl, $a027
jp Function10611d
; 10607f
Function10607f: ; 10607f (41:607f)
ret
; 106080 (41:6080)
INCBIN "baserom.gbc",$106080,$106086 - $106080
Function106086: ; 106086
ret
; 106087
Function106087: ; 106087
ld hl, $a02d
jp Function10611d
; 10608d
Function10608d: ; 10608d (41:608d)
ret
; 10608e (41:608e)
INCBIN "baserom.gbc",$10608e,$106094 - $10608e
Function106094: ; 106094
ret
; 106095
Function106095: ; 106095
ld hl, $a033
jp Function10611d
; 10609b
Function10609b: ; 10609b
ret
; 10609c (41:609c)
INCBIN "baserom.gbc",$10609c,$1060a2 - $10609c
Function1060a2: ; 1060a2
ret
; 1060a3
Function1060a3: ; 1060a3
ld hl, $a039
jp Function10611d
; 1060a9
Function1060a9: ; 1060a9 (41:60a9)
ret
; 1060aa (41:60aa)
INCBIN "baserom.gbc",$1060aa,$1060af - $1060aa
Function1060af: ; 1060af
ret
; 1060b0
INCBIN "baserom.gbc",$1060b0,$1060b5 - $1060b0
Function1060b5: ; 1060b5
ret
; 1060b6
INCBIN "baserom.gbc",$1060b6,$1060bb - $1060b6
Function1060bb: ; 1060bb
ret
; 1060bc
INCBIN "baserom.gbc",$1060bc,$1060c1 - $1060bc
Function1060c1: ; 1060c1
ret
; 1060c2
INCBIN "baserom.gbc",$1060c2,$1060c7 - $1060c2
Function1060c7: ; 1060c7
ret
; 1060c8 (41:60c8)
INCBIN "baserom.gbc",$1060c8,$1060cd - $1060c8
Function1060cd: ; 1060cd
ret
; 1060ce
INCBIN "baserom.gbc",$1060ce,$1060d3 - $1060ce
Function1060d3: ; 1060d3
ret
; 1060d4
INCBIN "baserom.gbc",$1060d4,$1060df - $1060d4
Function1060df: ; 1060df
ret
; 1060e0
INCBIN "baserom.gbc",$1060e0,$1060e5 - $1060e0
Function1060e5: ; 1060e5
ret
; 1060e6 (41:60e6)
INCBIN "baserom.gbc", $1060e6, $1060ef - $1060e6
Function1060ef: ; 1060ef
ret
; 1060f0
INCBIN "baserom.gbc", $1060f0, $1060fb - $1060f0
Function1060fb: ; 1060fb
ret
; 1060fc
INCBIN "baserom.gbc",$1060fc,$106101 - $1060fc
Function106101: ; 106101
ret
; 106102
Function106102: ; 106102
ld hl, $a066
jr Function10611d
; 106107
Function106107: ; 106107
ret
; 106108
Function106108: ; 106108
ld hl, $a069
jr Function10611d
; 10610d
Function10610d: ; 10610d
ret
; 10610e
Function10610e: ; 10610e
ld a, [hBattleTurn]
and a
ret nz
ld hl, $a06c
jr Function10611d
; 106117
Function106117: ; 106117
push bc
ld bc, 3
jr Function10612d
; 10611d
Function10611d: ; 10611d
push bc
ld bc, 2
jr Function10612d
; 106123
Function106123: ; 106123
push bc
ld bc, 1
jr Function10612d
; 106129
Function106129: ; 106129
push bc
ld bc, 0
Function10612d: ; 10612d
ld a, $5
call GetSRAMBank
push hl
push de
ld e, c
inc e
.asm_106136
ld a, [hli]
inc a
jr nz, .asm_10613d
dec e
jr nz, .asm_106136
.asm_10613d
pop de
pop hl
jr z, .asm_10614d
add hl, bc
.asm_106142
inc [hl]
jr nz, .asm_10614d
ld a, c
and a
jr z, .asm_10614d
dec hl
dec c
jr .asm_106142
.asm_10614d
call Function106162
call CloseSRAM
pop bc
ret
; 106155
INCBIN "baserom.gbc",$106155,$106162 - $106155
Function106162: ; 106162
push de
call Function10616e
ld hl, $a081
ld [hl], d
inc hl
ld [hl], e
pop de
ret
; 10616e
Function10616e: ; 10616e
push bc
ld hl, $a001
ld bc, $0080
xor a
ld de, $0000
.asm_106179
ld a, e
add [hl]
ld e, a
jr nc, .asm_10617f
inc d
.asm_10617f
inc hl
dec bc
ld a, b
or c
jr nz, .asm_106179
pop bc
ret
; 106187
Function106187: ; 106187
ld a, $1
call GetSRAMBank
ld a, [$be3c]
push af
ld a, $1
call GetSRAMBank
pop af
ld [$be44], a
call CloseSRAM
ret
; 10619d
Function10619d: ; 10619d (41:619d)
ld a, $1
call GetSRAMBank
ld a, [$be44]
push af
ld a, $1
call GetSRAMBank
pop af
ld [$be3c], a
call CloseSRAM
ret
; 1061b3 (41:61b3)
INCBIN "baserom.gbc",$1061b3,$1061c0 - $1061b3
Function1061c0: ; 1061c0 (41:61c0)
ld a, $1
call GetSRAMBank
xor a
ld [$be3c], a
call CloseSRAM
ret
; 1061cd (41:61cd)
INCBIN "baserom.gbc",$1061cd,$1061ef - $1061cd
Function1061ef:: ; 1061ef
push bc
xor a
ld [hProduct], a
ld [hMultiplicand], a
ld [$ffb5], a
ld a, b
and $f
cp $1
jr z, .asm_106212
cp $2
jr z, .asm_10620e
cp $3
jr z, .asm_10620a
ld a, [de]
ld [hProduct], a
inc de
.asm_10620a
ld a, [de]
ld [hMultiplicand], a
inc de
.asm_10620e
ld a, [de]
ld [$ffb5], a
inc de
.asm_106212
ld a, [de]
ld [$ffb6], a
inc de
push de
xor a
ld [$ffbb], a
ld a, b
ld [$ffbc], a
ld a, c
cp $2
jr z, .asm_10626a
ld de, $62ae
cp $3
jr z, .asm_106256
ld de, $62aa
cp $4
jr z, .asm_106256
ld de, $62a6
cp $5
jr z, .asm_106256
ld de, $62a2
cp $6
jr z, .asm_106256
ld de, $629e
cp $7
jr z, .asm_106256
ld de, $629a
cp $8
jr z, .asm_106256
ld de, $6296
cp $9
jr z, .asm_106256
ld de, $6292
.asm_106256
inc de
inc de
inc de
dec a
dec a
.asm_10625b
push af
call Function1062b2
call Function1062ff
inc de
inc de
inc de
inc de
pop af
dec a
jr nz, .asm_10625b
.asm_10626a
ld c, $0
ld a, [$ffb6]
.asm_10626e
cp $a
jr c, .asm_106277
sub $a
inc c
jr .asm_10626e
.asm_106277
ld b, a
ld a, [$ffbb]
or c
ld [$ffbb], a
jr nz, .asm_106284
call Function1062f7
jr .asm_106288
.asm_106284
ld a, $f6
add c
ld [hl], a
.asm_106288
call Function1062ff
ld a, $f6
add b
ld [hli], a
pop de
pop bc
ret
; 106292
INCBIN "baserom.gbc",$106292,$1062b2 - $106292
Function1062b2: ; 1062b2
ld c, $0
.asm_1062b4
ld a, [de]
dec de
ld b, a
ld a, [$ffb6]
sub b
ld [$ffba], a
ld a, [de]
dec de
ld b, a
ld a, [$ffb5]
sbc b
ld [$ffb9], a
ld a, [de]
dec de
ld b, a
ld a, [hMultiplicand]
sbc b
ld [hMathBuffer], a
ld a, [de]
inc de
inc de
inc de
ld b, a
ld a, [hProduct]
sbc b
ld [hMultiplier], a
jr c, .asm_1062eb
ld a, [hMultiplier]
ld [hProduct], a
ld a, [hMathBuffer]
ld [hMultiplicand], a
ld a, [$ffb9]
ld [$ffb5], a
ld a, [$ffba]
ld [$ffb6], a
inc c
jr .asm_1062b4
.asm_1062eb
ld a, [$ffbb]
or c
jr z, Function1062f7
ld a, $f6
add c
ld [hl], a
ld [$ffbb], a
ret
Function1062f7
ld a, [$ffbc]
bit 7, a
ret z
ld [hl], $f6
ret
; 1062ff
Function1062ff: ; 1062ff
ld a, [$ffbc]
bit 7, a
jr nz, .asm_10630d
bit 6, a
jr z, .asm_10630d
ld a, [$ffbb]
and a
ret z
.asm_10630d
inc hl
ret
; 10630f
Function10630f: ; 10630f
xor a
ld [ScriptVar], a
ret
; 106314
INCBIN "baserom.gbc",$106314,$10632f - $106314
Function10632f: ; 10632f
or a
ret
; 106331
INCBIN "baserom.gbc",$106331,$106462 - $106331
Function106462: ; 106462
ret
; 106463
INCBIN "baserom.gbc",$106463,$106464 - $106463
Function106464:: ; 106464
ld de, $5214
ld hl, $9600
ld bc, $3e01
call Get2bpp
ld de, $5424
ld hl, $9610
ld bc, $3e01
call Get2bpp
ld de, $6514
ld hl, $9620
ld c, $9
ld b, $41
call Get2bpp
ld de, $40b0
ld hl, $96b0
ld b, $f
call Get2bpp
callba Functionfb4cc
ret
; 10649b
INCBIN "baserom.gbc",$10649b,$106594 - $10649b
Function106594:: ; 106594
ld de, $65ad
ld hl, VTiles1
ld bc, $4180
call Get2bpp
ld de, $6dad
ld hl, $97f0
ld bc, $4101
call Get2bpp
ret
; 1065ad
INCBIN "baserom.gbc",$1065ad,$106dbc - $1065ad
SECTION "bank42", ROMX, BANK[$42]
INCBIN "baserom.gbc",$108000,$108016 - $108000
Function108016: ; 108016
ld a, $0
ld [$cf65], a
ld de, $4021
jp Function108089
; 108021
INCBIN "baserom.gbc",$108021,$108089 - $108021
Function108089: ; 108089
ld hl, BattleEnded
ld [hl], e
inc hl
ld [hl], d
ld a, [$ffde]
push af
xor a
ld [$ffde], a
ld hl, VramState
ld a, [hl]
push af
res 0, [hl]
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
call Function108157
.asm_1080a6
call Function10824b
jr nc, .asm_1080a6
pop af
ld [Options], a
pop af
ld [VramState], a
pop af
ld [$ffde], a
ret
; 1080b7
INCBIN "baserom.gbc",$1080b7,$108157 - $1080b7
Function108157: ; 108157
xor a
ld [$cf63], a
call WhiteBGMap
call ClearSprites
call ClearTileMap
call DisableLCD
call Function1081ad
call Function1081ca
call Functione51
call Functione58
call EnableLCD
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
callba Function8cf53
xor a
ld hl, $c300
ld [hli], a
ld [hl], $0
call DelayFrame
ld a, [PlayerSDefLevel]
ld de, PlayerAccLevel
call Function108239
ld a, [PlayerLightScreenCount]
ld de, PlayerReflectCount
call Function108239
xor a
call Function108b98
call Function108af4
ret
; 1081ad
Function1081ad: ; 1081ad
ld a, $1
ld [rVBK], a
ld hl, VTiles0
ld bc, $1800
xor a
call ByteFill
ld a, $0
ld [rVBK], a
ld hl, VTiles0
ld bc, $1800
xor a
call ByteFill
ret
; 1081ca
Function1081ca: ; 1081ca
ld a, $1
ld [rVBK], a
ld hl, VBGMap0
ld bc, $0800
ld a, $0
call ByteFill
ld a, $0
ld [rVBK], a
ld hl, VBGMap0
ld bc, $0800
ld a, $7f
call ByteFill
ret
; 1081e9
INCBIN "baserom.gbc",$1081e9,$108239 - $1081e9
Function108239: ; 108239
push de
ld [$d265], a
call GetPokemonName
ld hl, StringBuffer1
pop de
ld bc, $000b
call CopyBytes
ret
; 10824b
Function10824b: ; 10824b
ld a, [$cf63]
bit 7, a
jr nz, .asm_10825a
call Function10827b
call DelayFrame
and a
ret
.asm_10825a
xor a
ld [hSCX], a
ld [hSCY], a
ld a, $7
ld [hWX], a
ld a, $90
ld [hWY], a
call Functione51
call Functione58
callba Function106462
callba Function106464
scf
ret
; 10827b
Function10827b: ; 10827b
ld a, [$cf63]
ld e, a
ld d, $0
ld hl, $428a
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 10828a
INCBIN "baserom.gbc",$10828a,$108af4 - $10828a
Function108af4: ; 108af4
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld a, [$cf65]
and $1
jr z, .asm_108b1c
ld hl, $5187
ld de, Unkn2Pals
ld bc, $0040
call CopyBytes
ld hl, $5187
ld de, OBPals
ld bc, $0040
call CopyBytes
jr .asm_108b34
.asm_108b1c
ld hl, $5147
ld de, Unkn2Pals
ld bc, $0040
call CopyBytes
ld hl, $5147
ld de, OBPals
ld bc, $0040
call CopyBytes
.asm_108b34
pop af
ld [rSVBK], a
ld a, $e4
call Functioncf8
ld a, $e4
call DmgToCgbBGPals
call DelayFrame
ret
; 108b45
INCBIN "baserom.gbc",$108b45,$108b98 - $108b45
Function108b98: ; 108b98
ld d, a
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld a, [$cf65]
and $1
xor d
jr z, .asm_108bad
ld hl, $4ba0
jr .asm_108bb0
.asm_108bad
ld hl, $4b98
.asm_108bb0
ld de, $d038
ld bc, $0040
call CopyBytes
pop af
ld [rSVBK], a
ret
; 108bbd
INCBIN "baserom.gbc",$108bbd,$108bc7 - $108bbd
Function108bc7: ; 108bc7 (42:4bc7)
ld a, [$cf64]
and a
ret z
ld hl, $5
add hl, bc
ld a, [hl]
cp $f2
jr z, .asm_108bd9
sub $8
ld [hl], a
ret
.asm_108bd9
callba Function8d036
ret
Function108be0: ; 108be0 (42:4be0)
ld hl, $5
add hl, bc
ld a, [hl]
cp $4a
ret z
add $8
ld [hl], a
ret
; 108bec (42:4bec)
INCBIN "baserom.gbc",$108bec,$109407 - $108bec
IntroLogoGFX: ; 109407
INCBIN "gfx/intro/logo.2bpp.lz"
; 109847
SECTION "bank43", ROMX, BANK[$43]
UnusedTitleScreen: ; 10c000
call WhiteBGMap
call ClearTileMap
call DisableLCD
xor a
ld [hBGMapMode], a
ld hl, $cf63
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld hl, UnusedTitleBG_GFX
ld de, VTiles2
ld bc, $800
call CopyBytes
ld hl, UnusedTitleBG_GFX + $800
ld de, VTiles1
ld bc, $800
call CopyBytes
ld hl, UnusedTitleFG_GFX
ld de, VTiles0
ld bc, $800
call CopyBytes
ld hl, UnusedTitleBG_Tilemap
ld de, VBGMap0
ld bc, 32 * 32
.copy
ld a, 0
ld [rVBK], a
ld a, [hli]
ld [de], a
ld a, 1
ld [rVBK], a
ld a, [hli]
ld [de], a
inc de
dec bc
ld a, b
or c
jr nz, .copy
ld hl, UnusedTitleFG_OAM
ld de, Sprites
ld bc, $a0
call CopyBytes
call EnableLCD
ld a, [rLCDC]
set 1, a
set 2, a
ld [rLCDC], a
call DelayFrame
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, UnsuedTitleBG_Palettes
ld de, Unkn1Pals
ld bc, $40
call CopyBytes
ld hl, UnsuedTitleFG_Palettes
ld de, Unkn2Pals
ld bc, $40
call CopyBytes
ld hl, UnsuedTitleBG_Palettes
ld de, BGPals
ld bc, $40
call CopyBytes
ld hl, UnsuedTitleFG_Palettes
ld de, OBPals
ld bc, $40
call CopyBytes
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ld de, MUSIC_TITLE
call PlayMusic
ret
; 10c0b1
UnusedTitleBG_GFX: ; 10c0b1
INCBIN "gfx/title/old_bg.2bpp"
; 10d0b1
UnusedTitleBG_Tilemap: ; 10d0b1
; 32x32 (tile, attributes)
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $01,$00, $02,$01, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $03,$00, $04,$00, $05,$01, $06,$01, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $07,$05, $08,$05, $09,$05, $0a,$05, $0b,$00, $0c,$00, $0d,$00, $0e,$00, $0f,$01, $10,$01, $11,$01, $12,$01, $13,$05, $14,$05, $15,$05, $16,$05, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $17,$04, $18,$04, $19,$04, $1a,$04, $1b,$00, $1c,$00, $1d,$02, $1e,$02, $1f,$07, $20,$07, $21,$01, $22,$01, $23,$04, $24,$04, $25,$04, $26,$04, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $27,$04, $28,$04, $29,$04, $2a,$04, $2b,$00, $2c,$00, $2d,$03, $2e,$01, $2f,$01, $30,$01, $31,$01, $32,$01, $33,$04, $34,$04, $35,$04, $36,$04, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $37,$04, $38,$04, $39,$04, $3a,$04, $3b,$00, $3c,$00, $3d,$01, $00,$00, $00,$00, $3e,$07, $3f,$01, $40,$01, $41,$04, $42,$04, $43,$04, $44,$04, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $45,$04, $46,$04, $47,$04, $48,$04, $49,$00, $3c,$00, $4a,$01, $00,$00, $00,$00, $4b,$07, $3f,$01, $4c,$01, $4d,$06, $4e,$06, $4f,$06, $50,$06, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $51,$04, $52,$06, $53,$06, $54,$06, $55,$00, $3c,$00, $56,$01, $00,$00, $00,$00, $57,$07, $58,$01, $59,$01, $5a,$06, $5b,$06, $5c,$06, $5d,$06, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $5e,$06, $5f,$06, $60,$06, $61,$06, $62,$00, $63,$00, $64,$03, $65,$01, $66,$01, $67,$07, $68,$01, $69,$01, $26,$04, $6a,$06, $26,$04, $26,$04, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $6b,$00, $6c,$05, $6d,$05, $6e,$05, $6f,$00, $70,$02, $71,$02, $72,$01, $73,$00, $74,$02, $75,$01, $76,$01, $77,$05, $78,$05, $79,$05, $6b,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $7a,$00, $7b,$00, $7c,$00, $7d,$00, $0f,$01, $7e,$01, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $a2,$00, $80,$00, $81,$00, $82,$00, $83,$00, $84,$07, $85,$01, $86,$01, $87,$01, $88,$01, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $89,$00, $8a,$00, $8b,$00, $8c,$07, $8d,$01, $8e,$01, $8f,$01, $90,$01, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $91,$01, $92,$01, $93,$01, $94,$01, $95,$01, $00,$00, $00,$00, $00,$00, $96,$05, $97,$05, $98,$05, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $99,$05, $9a,$05, $9b,$05, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $9c,$05, $9d,$05, $9e,$05, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $9f,$05, $a0,$05, $a1,$05, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $6b,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
db $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00, $00,$00
; 10d8b1
UnsuedTitleBG_Palettes: ; 10d8b1
RGB 00, 00, 00
RGB 25, 15, 28
RGB 22, 11, 28
RGB 19, 08, 26
RGB 00, 00, 00
RGB 17, 07, 22
RGB 13, 07, 16
RGB 19, 08, 26
RGB 25, 15, 28
RGB 22, 11, 28
RGB 19, 08, 26
RGB 17, 07, 22
RGB 22, 11, 28
RGB 19, 08, 26
RGB 17, 07, 22
RGB 13, 07, 16
RGB 00, 00, 00
RGB 31, 31, 31
RGB 16, 16, 24
RGB 02, 13, 21
RGB 00, 00, 00
RGB 31, 31, 31
RGB 20, 20, 20
RGB 12, 12, 12
RGB 00, 00, 00
RGB 01, 11, 23
RGB 16, 16, 24
RGB 02, 13, 21
RGB 00, 00, 00
RGB 22, 10, 31
RGB 19, 08, 26
RGB 17, 07, 22
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
RGB 20, 04, 20
RGB 16, 08, 16
RGB 24, 00, 24
rept 54
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 31, 31
endr
; 10dab1
UnusedTitleFG_GFX: ; 10dab1
INCBIN "gfx/title/old_fg.2bpp"
; 10eab1
UnsuedTitleFG_Palettes: ; 10eab1
RGB 00, 00, 00
RGB 31, 31, 31
RGB 16, 16, 24
RGB 02, 13, 21
RGB 00, 00, 00
RGB 31, 31, 31
RGB 20, 20, 20
RGB 12, 12, 12
RGB 00, 00, 00
RGB 01, 11, 23
RGB 16, 16, 24
RGB 02, 13, 21
RGB 00, 00, 00
RGB 31, 22, 00
RGB 31, 27, 00
RGB 31, 31, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 16, 16, 24
RGB 02, 13, 21
RGB 00, 00, 00
RGB 31, 31, 31
RGB 20, 20, 20
RGB 12, 12, 12
RGB 00, 00, 00
RGB 01, 11, 23
RGB 16, 16, 24
RGB 02, 13, 21
RGB 16, 31, 00
RGB 22, 31, 00
RGB 27, 31, 00
RGB 31, 31, 00
RGB 31, 00, 18
RGB 31, 31, 31
RGB 16, 16, 24
RGB 02, 13, 21
RGB 00, 00, 00
RGB 31, 31, 31
RGB 20, 20, 20
RGB 12, 12, 12
RGB 00, 00, 00
RGB 01, 11, 23
RGB 16, 16, 24
RGB 02, 13, 21
RGB 16, 31, 00
RGB 22, 31, 00
RGB 27, 31, 00
RGB 31, 31, 00
RGB 24, 18, 31
RGB 31, 31, 00
RGB 31, 31, 01
RGB 31, 31, 03
RGB 31, 31, 05
RGB 31, 31, 08
RGB 31, 31, 10
RGB 31, 31, 12
RGB 31, 31, 14
RGB 31, 31, 16
RGB 31, 31, 18
RGB 31, 31, 20
RGB 31, 31, 22
RGB 31, 31, 25
RGB 31, 31, 27
RGB 31, 31, 29
RGB 24, 06, 06
RGB 01, 01, 01
RGB 03, 03, 03
RGB 05, 05, 05
RGB 08, 08, 08
RGB 10, 10, 10
RGB 12, 12, 12
RGB 14, 14, 14
RGB 16, 16, 16
RGB 18, 18, 18
RGB 20, 20, 20
RGB 22, 22, 22
RGB 25, 25, 25
RGB 27, 27, 27
RGB 29, 29, 29
RGB 31, 31, 31
RGB 18, 24, 18
RGB 31, 29, 01
RGB 31, 27, 03
RGB 31, 25, 05
RGB 31, 22, 08
RGB 31, 20, 10
RGB 31, 18, 12
RGB 31, 16, 14
RGB 31, 14, 16
RGB 31, 12, 18
RGB 31, 10, 20
RGB 31, 08, 22
RGB 31, 05, 25
RGB 31, 03, 27
RGB 31, 01, 29
RGB 31, 00, 31
RGB 18, 06, 31
RGB 00, 31, 31
RGB 00, 31, 29
RGB 00, 31, 27
RGB 00, 31, 25
RGB 00, 31, 22
RGB 00, 31, 20
RGB 00, 31, 18
RGB 00, 31, 16
RGB 00, 31, 14
RGB 00, 31, 12
RGB 00, 31, 10
RGB 00, 31, 08
RGB 00, 31, 05
RGB 00, 31, 03
RGB 00, 31, 01
RGB 12, 31, 06
RGB 00, 00, 31
RGB 00, 01, 31
RGB 00, 03, 31
RGB 00, 05, 31
RGB 00, 08, 31
RGB 00, 10, 31
RGB 00, 12, 31
RGB 00, 14, 31
RGB 00, 16, 31
RGB 00, 18, 31
RGB 00, 20, 31
RGB 00, 22, 31
RGB 00, 25, 31
RGB 00, 27, 31
RGB 00, 29, 31
RGB 00, 00, 00
RGB 06, 00, 04
RGB 19, 02, 09
RGB 28, 04, 11
RGB 31, 07, 16
RGB 31, 17, 23
RGB 31, 26, 30
RGB 07, 05, 10
RGB 14, 10, 18
RGB 20, 20, 25
RGB 25, 27, 31
RGB 09, 05, 06
RGB 23, 16, 13
RGB 30, 23, 22
RGB 31, 28, 28
RGB 31, 31, 31
RGB 06, 31, 31
RGB 04, 00, 04
RGB 11, 02, 04
RGB 17, 02, 04
RGB 24, 05, 04
RGB 28, 07, 04
RGB 31, 11, 04
RGB 02, 01, 15
RGB 04, 11, 22
RGB 12, 25, 25
RGB 20, 31, 31
RGB 09, 04, 03
RGB 22, 11, 08
RGB 27, 19, 16
RGB 30, 28, 26
RGB 31, 31, 31
RGB 06, 18, 06
RGB 04, 04, 02
RGB 07, 07, 02
RGB 18, 18, 04
RGB 24, 24, 06
RGB 27, 27, 11
RGB 31, 31, 20
RGB 02, 03, 10
RGB 04, 05, 13
RGB 06, 10, 25
RGB 08, 15, 31
RGB 04, 00, 06
RGB 11, 07, 14
RGB 21, 16, 23
RGB 29, 26, 31
RGB 31, 31, 31
RGB 06, 00, 18
RGB 00, 04, 03
RGB 02, 09, 05
RGB 11, 19, 07
RGB 16, 24, 08
RGB 22, 31, 09
RGB 24, 31, 18
RGB 03, 01, 03
RGB 10, 04, 10
RGB 20, 08, 20
RGB 31, 17, 31
RGB 01, 03, 06
RGB 05, 09, 10
RGB 15, 21, 21
RGB 23, 25, 25
RGB 31, 31, 31
RGB 00, 18, 31
RGB 00, 05, 07
RGB 00, 08, 13
RGB 00, 12, 17
RGB 01, 20, 24
RGB 04, 27, 31
RGB 14, 31, 31
RGB 04, 02, 02
RGB 15, 01, 03
RGB 26, 04, 07
RGB 31, 13, 16
RGB 00, 05, 02
RGB 01, 11, 03
RGB 06, 21, 06
RGB 13, 31, 16
RGB 31, 31, 31
RGB 00, 06, 06
RGB 00, 01, 08
RGB 00, 05, 14
RGB 00, 08, 19
RGB 02, 14, 26
RGB 04, 21, 31
RGB 06, 26, 31
RGB 13, 00, 00
RGB 27, 07, 00
RGB 31, 17, 05
RGB 31, 25, 16
RGB 02, 04, 00
RGB 07, 11, 03
RGB 17, 19, 05
RGB 27, 31, 16
RGB 31, 31, 31
RGB 02, 00, 00
RGB 04, 01, 06
RGB 11, 03, 14
RGB 16, 04, 19
RGB 20, 07, 22
RGB 26, 12, 27
RGB 26, 20, 31
RGB 04, 07, 00
RGB 16, 20, 07
RGB 24, 28, 15
RGB 29, 31, 24
RGB 05, 02, 02
RGB 15, 04, 02
RGB 24, 11, 10
RGB 31, 22, 20
RGB 31, 31, 31
RGB 00, 00, 14
RGB 12, 00, 00
RGB 27, 05, 00
RGB 31, 15, 05
RGB 31, 26, 13
RGB 31, 30, 21
RGB 05, 07, 16
RGB 04, 16, 20
RGB 04, 24, 26
RGB 08, 31, 31
RGB 23, 31, 31
RGB 00, 00, 00
RGB 05, 05, 05
RGB 17, 17, 15
RGB 28, 28, 24
RGB 31, 31, 31
; 10ecb1
UnusedTitleFG_OAM: ; 10ecb1
db $18, $38, $00, $01, $18, $40, $02, $01, $18, $48, $04, $01, $18, $50, $06, $01
db $18, $58, $08, $01, $18, $60, $0a, $01, $18, $68, $0c, $01, $18, $70, $0e, $01
db $28, $38, $10, $00, $28, $40, $12, $00, $28, $48, $14, $00, $28, $50, $16, $00
db $28, $58, $18, $00, $28, $60, $1a, $00, $28, $68, $1c, $00, $28, $70, $1e, $00
db $38, $38, $20, $00, $38, $40, $22, $00, $38, $48, $24, $00, $38, $50, $26, $00
db $38, $58, $28, $00, $38, $60, $2a, $00, $38, $68, $2c, $00, $38, $70, $2e, $00
db $48, $38, $30, $02, $48, $40, $32, $02, $48, $48, $34, $02, $48, $50, $36, $02
db $48, $58, $38, $02, $48, $60, $3a, $02, $48, $68, $3c, $02, $48, $70, $3e, $02
db $58, $38, $40, $01, $58, $40, $42, $01, $58, $48, $44, $01, $58, $50, $46, $01
db $58, $58, $48, $01, $58, $60, $4a, $01, $58, $68, $4c, $01, $58, $70, $4e, $01
; 10ed51
Function10ed51: ; 10ed51
call _TitleScreen
.loop
call Functiona57
ld a, [$ffa9]
ld b, a
and 1
jr nz, .done
call Function10eea7
call DelayFrame
jr .loop
.done
ret
; 10ed67
INCLUDE "engine/title.asm"
SECTION "bank45", ROMX, BANK[$45]
INCBIN "baserom.gbc",$114000,$114243 - $114000
Function114243:: ; 114243
ld a, $a
ld [MBC3SRamEnable], a
ld a, [$ff8c]
push af
push de
ld a, [$dc02]
add a
ld e, a
ld d, $0
ld hl, $4165
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
pop de
jp [hl]
; 11425c
INCBIN "baserom.gbc",$11425c,$115d99 - $11425c
Function115d99: ; 115d99
ld de, $601a
ld hl, $8600
ld bc, $4514
call Get2bpp
xor a
ld [$c305], a
ld [$c306], a
ld [$c309], a
ld [$c30a], a
ld [$c30b], a
ld [$c30c], a
ld a, $10
ld [$c307], a
ld a, $18
ld [$c308], a
ret
; 115dc3
INCBIN "baserom.gbc",$115dc3,$115dd3 - $115dc3
Function115dd3: ; 115dd3
ld a, [$c305]
and a
ret z
ld a, $a0
ld hl, $c47c
ld bc, $0020
call ByteFill
call Function115e22
ld a, [$c309]
sla a
ld c, a
ld b, $0
ld hl, $5e86
add hl, bc
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
push de
pop hl
ld de, $c47c
ld a, [$c307]
ld c, a
ld a, [$c308]
ld b, a
ld a, [hli]
.asm_115e04
push af
ld a, [hli]
add b
ld [de], a
inc de
ld a, [hli]
add c
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
pop af
dec a
jr nz, .asm_115e04
ret
; 115e18
Function115e18: ; 115e18
ld a, c
ld [$c30a], a
xor a
ld [$c30b], a
jr Function115e2b
; 115e22
Function115e22: ; 115e22
ld hl, $c30c
dec [hl]
ret nz
ld hl, $c30b
inc [hl]
Function115e2b: ; 115e2b
ld a, [$c30a]
sla a
ld c, a
ld b, $0
ld hl, $5e59
add hl, bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push de
pop hl
ld a, [$c30b]
sla a
ld c, a
ld b, $0
add hl, bc
ld a, [hli]
cp $ff
jr nz, .asm_115e51
xor a
ld [$c30b], a
jr Function115e2b
.asm_115e51
ld [$c309], a
ld a, [hl]
ld [$c30c], a
ret
; 115e59
INCBIN "baserom.gbc",$115e59,$11615a - $115e59
Function11615a: ; 11615a
xor a
ld [$c30d], a
ld [$c319], a
ld [$c310], a
ld [$c311], a
ld [$c312], a
ld [$c313], a
ld [$c314], a
ld [$c315], a
ld [$c318], a
ld [$c3f6], a
ld [$c3f8], a
ld [$c3f2], a
ld [$c3f4], a
ld a, $24
ld [$c3f5], a
ld a, $7
ld [$c3f7], a
ld a, $b0
ld [$c30e], a
ld [$c3f1], a
ld a, $48
ld [$c30f], a
ld [$c3f3], a
ret
; 11619d
Function11619d: ; 11619d
ld a, [$c30d]
and a
ret z
ld a, [$c319]
cp $2
jr c, .asm_1161b4
ld a, $a0
ld hl, Sprites
ld bc, $0064
call ByteFill
.asm_1161b4
call Function1161b8
ret
; 1161b8
Function1161b8: ; 1161b8
ld a, [$c319]
ld e, a
ld d, $0
ld hl, $61c7
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 1161c7
INCBIN "baserom.gbc",$1161c7,$117656 - $1161c7
Function117656: ; 117656
callba GiveOddEgg
ret
; 11765d
Function11765d: ; 11765d (45:765d)
ld a, [$FF00+$aa]
push af
ld a, $1
ld [$FF00+$aa], a
call Function11766b
pop af
ld [$FF00+$aa], a
ret
Function11766b: ; 11766b (45:766b)
call Function117699
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
call Function1176ee
ld a, $5
call GetSRAMBank
ld hl, $b1f3
ld de, $cd49
ld bc, $8
call CopyBytes
ld de, $c708
ld bc, $11
call CopyBytes
call CloseSRAM
pop af
ld [rSVBK], a ; $ff00+$70
ret
Function117699: ; 117699 (45:7699)
ld a, $5
call GetSRAMBank
ld hl, $cd49
ld de, $b1f3
ld bc, $8
call CopyBytes
ld hl, $c708
ld bc, $11
call CopyBytes
call CloseSRAM
xor a
ld [$cd49], a
ld [$cd4a], a
ld [$cd4b], a
ld [$cd4c], a
ld [$cd4d], a
ld [$cd4e], a
ld [$cd4f], a
ld hl, $c708
ld bc, $11
call ByteFill
call WhiteBGMap
call ClearSprites
callba Function171c87
callba Function104061
callba Function8cf53
ret
Function1176ee: ; 1176ee (45:76ee)
call Functiona57
ld a, [$cd49]
bit 7, a
jr nz, .asm_117709
call Function117719
callba Function8cf69
callba Function104061
jr Function1176ee
.asm_117709
callba Function8cf53
call WhiteBGMap
call ClearScreen
call ClearSprites
ret
Function117719: ; 117719 (45:7719)
ld a, [$cd49]
ld e, a
ld d, 0
ld hl, Jumptable_117728
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_117728: ; 117728 (45:7728)
dw Function117738
dw Function117764
dw Function1178aa
dw Function1178e8
dw Function117942
dw Function117976
dw Function117984
dw Function1179a7
Function117738: ; 117738 (45:7738)
callba Function171ccd
ld de, $3018
ld a, $1d
call Function3b2a
ld hl, $c
add hl, bc
ld a, $6
ld [hl], a
ld de, $4820
ld a, $1d
call Function3b2a
ld hl, $c
add hl, bc
ld a, $7
ld [hl], a
ld a, $3
ld [$cd23], a
jp Function117a0a
Function117764: ; 117764 (45:7764)
ld a, [$cd4a]
cp $10
jr nz, .asm_11776f
ld a, $1
jr .asm_117770
.asm_11776f
xor a
.asm_117770
ld [$cd24], a
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and $4
jr nz, Function1177a5
ld a, [hl]
and $8
jr nz, Function1177ac
ld a, [hl]
and $1
jp nz, Function11784c
ld a, [hl]
and $2
jr nz, asm_1177d6
ld hl, $ffa9
ld a, [hl]
and $40
jr nz, asm_1177f1
ld a, [hl]
and $80
jr nz, asm_11780a
ld a, [hl]
and $20
jp nz, Function11782d
ld a, [hl]
and $10
jp nz, Function117837
ret
Function1177a5: ; 1177a5 (45:77a5)
callba Function171cf0
ret
Function1177ac: ; 1177ac (45:77ac)
ld a, $2
ld [$cd4c], a
ld a, $4
ld [$cd4d], a
ret
Function1177b7: ; 1177b7 (45:77b7)
ld a, $3
ld [$cd24], a
ld a, [$cd4a]
and a
jr z, .asm_1177c5
jp Function117a0a
.asm_1177c5
ld a, $6
ld [$cd49], a
ret
Function1177cb: ; 1177cb (45:77cb)
ld a, $80
ld [$cd49], a
ld [ScriptVar], a ; $c2dd
jp Function117a0a
asm_1177d6: ; 1177d6 (45:77d6)
call PlayClickSFX
ld a, [$cd4a]
and a
ret z
dec a
ld [$cd4a], a
ld e, a
ld d, $0
ld hl, $c708
add hl, de
xor a
ld [hl], a
hlcoord 2, 4
add hl, de
ld [hl], a
ret
asm_1177f1: ; 1177f1 (45:77f1)
ld a, [$cd4d]
and a
ret z
dec a
ld [$cd4d], a
cp $3
ret nz
ld a, [$cd4c]
ld e, a
sla a
sla a
add e
asm_117806: ; 117806 (45:7806)
ld [$cd4c], a
ret
asm_11780a: ; 11780a (45:780a)
ld a, [$cd4d]
cp $4
ret z
inc a
ld [$cd4d], a
cp $4
ret nz
ld a, [$cd4c]
cp $a
jr nc, .asm_117825
cp $5
jr nc, .asm_117829
xor a
jr asm_117806
.asm_117825
ld a, $2
jr asm_117806
.asm_117829
ld a, $1
jr asm_117806
Function11782d: ; 11782d (45:782d)
ld a, [$cd4c]
and a
ret z
dec a
ld [$cd4c], a
ret
Function117837: ; 117837 (45:7837)
ld e, $d
ld a, [$cd4d]
cp $4
jr nz, .asm_117842
ld e, $2
.asm_117842
ld a, [$cd4c]
cp e
ret z
inc a
ld [$cd4c], a
ret
Function11784c: ; 11784c (45:784c)
call PlayClickSFX
ld a, [$cd4d]
cp $4
jr nz, .asm_117866
ld a, [$cd4c]
cp $2
jp z, Function1177b7
cp $1
jp z, Function1177cb
jp Function1177a5
.asm_117866
ld a, [$cd4a]
ld e, a
cp $10
jp z, Function1177ac
inc a
ld [$cd4a], a
ld d, $0
ld a, [$cd4b]
and a
jr nz, .asm_117880
ld hl, $7a0f
jr .asm_117883
.asm_117880
ld hl, $7a47
.asm_117883
push de
ld a, [$cd4c]
ld b, a
ld a, [$cd4d]
ld c, $e
call SimpleMultiply
add b
ld c, a
ld b, $0
add hl, bc
ld a, [hl]
ld hl, $c708
add hl, de
ld [hl], a
pop de
hlcoord 2, 4
add hl, de
sub $20
ld [hl], a
ld a, e
cp $f
ret nz
jp Function1177ac
Function1178aa: ; 1178aa (45:78aa)
ld hl, $79b5
call LoadMenuDataHeader
call Function1cbb
call Function1cfd
ld hl, $79bd
call LoadMenuDataHeader
call Function1cbb
call Function1cfd
callba Function104061
hlcoord 16, 8
ld de, $79c5
call PlaceString
hlcoord 15, 10
ld a, $ed
ld [hl], a
hlcoord 1, 14
ld de, $79cc
call PlaceString
ld a, $1
ld [$cd4e], a
jp Function117a0a
Function1178e8: ; 1178e8 (45:78e8)
ld a, [hJoyPressed] ; $ff00+$a7
cp $2
jr z, .asm_117939
cp $1
jr z, .asm_117925
cp $80
jr z, .asm_11790f
cp $40
ret nz
ld a, [$cd4e]
and a
ret z
dec a
ld [$cd4e], a
hlcoord 15, 8
ld a, $ed
ld [hl], a
hlcoord 15, 10
ld a, $7f
ld [hl], a
ret
.asm_11790f
ld a, [$cd4e]
and a
ret nz
inc a
ld [$cd4e], a
hlcoord 15, 8
ld a, $7f
ld [hl], a
hlcoord 15, 10
ld a, $ed
ld [hl], a
ret
.asm_117925
call PlayClickSFX
ld a, [$cd4e]
and a
jr nz, .asm_117939
call Function1c07
ld a, $1
ld [$cd4f], a
jp Function117a0a
.asm_117939
call Function1c07
call Function1c07
jp Function117a0a
Function117942: ; 117942 (45:7942)
call SpeechTextBox
hlcoord 1, 14
ld de, $79f7
call PlaceString
ld a, $1e
ld [$cd4e], a
ld a, $5
call GetSRAMBank
ld a, [$cd4f]
ld [$aa4b], a
ld hl, $c708
ld de, $aa4c
ld bc, $11
call CopyBytes
call CloseSRAM
ld a, [$cd4f]
and a
jr z, asm_11797e
call Function117a0a
Function117976: ; 117976 (45:7976)
ld hl, $cd4e
dec [hl]
ret nz
call Function1c07
asm_11797e: ; 11797e (45:797e)
ld a, $80
ld [$cd49], a
ret
Function117984: ; 117984 (45:7984)
ld hl, $79b5
call LoadMenuDataHeader
call Function1cbb
call Function1cfd
callba Function104061
hlcoord 1, 14
ld de, $79e1
call PlaceString
ld a, $1e
ld [$cd4e], a
call Function117a0a
Function1179a7: ; 1179a7 (45:79a7)
ld hl, $cd4e
dec [hl]
ret nz
call Function1c07
ld a, $1
ld [$cd49], a
ret
; 1179b5 (45:79b5)
INCBIN "baserom.gbc",$1179b5,$117a0a - $1179b5
Function117a0a: ; 117a0a (45:7a0a)
ld hl, $cd49
inc [hl]
ret
; 117a0f (45:7a0f)
INCBIN "baserom.gbc",$117a0f,$117a7f - $117a0f
; everything from here to the end of the bank is related to the
; Mobile Stadium option from the continue/newgame menu.
; XXX better function names
MobileStudium: ; 0x117a7f
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
call Function117a8d
pop af
ld [$ffaa], a
ret
; 0x117a8d
Function117a8d: ; 0x117a8d
call Function117a94
call Function117acd
ret
; 0x117a94
Function117a94: ; 0x117a94
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
call WhiteBGMap
call ClearSprites
callba Function172e78
callba Function104000
ret
; 0x117ab4
Function117ab4: ; 0x117ab4
call WhiteBGMap
call ClearSprites
callba Function172e78
callba Function172eb9
callba Function104061
ret
; 0x117acd
Function117acd: ; 0x117acd
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_117ae2 ; 0x117ad5 $b
call Function117ae9
callba Function104000
jr Function117acd
.asm_117ae2
call WhiteBGMap
call ClearSprites
ret
Function117ae9: ; 0x117ae9
ld a, [$cf63]
ld e, a
ld d, $0
ld hl, Pointers117af8
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Pointers117af8: ; 0x117af8
dw Function117b06
dw Function117b14
dw Function117b28
dw Function117b31
dw Function117b4f
dw Function117bb6
dw Function117c4a
Function117b06:
callba Function172eb9
ld a, $10
ld [$cf64], a
jp Function117cdd
Function117b14:
ld hl, $cf64
dec [hl]
ret nz
ld hl, Data117cbc
call LoadMenuDataHeader
call Function1cbb
call Function1cfd
jp Function117cdd
Function117b28:
ld hl, MobileStadiumEntryText
call PrintText
jp Function117cdd
Function117b31:
ld hl, Data117cc4
call LoadMenuDataHeader
call Function1cbb
call Function1cfd
hlcoord 16, 8
ld de, YesNo117ccc
call PlaceString
hlcoord 15, 8
ld a, "▶"
ld [hl], a
jp Function117cdd
Function117b4f:
ld a, [hJoyPressed]
cp $2
jr z, .asm_117ba4 ; 0x117b53 $4f
cp $1
jr z, .asm_117b8c ; 0x117b57 $33
cp $80
jr z, .asm_117b76 ; 0x117b5b $19
cp $40
ret nz
ld a, [$cf64]
and a
ret z
dec a
ld [$cf64], a
hlcoord 15, 8
ld a, "▶"
ld [hl], a
hlcoord 15, 10
ld a, " "
ld [hl], a
ret
.asm_117b76
ld a, [$cf64]
and a
ret nz
inc a
ld [$cf64], a
hlcoord 15, 8
ld a, " "
ld [hl], a
hlcoord 15, 10
ld a, "▶"
ld [hl], a
ret
.asm_117b8c
call PlayClickSFX
ld a, [$cf64]
and a
jr nz, .asm_117ba4 ; 0x117b93 $f
call Function1c07
call Function1c07
callba Function104061
jp Function117cdd
.asm_117ba4
call Function1c07
call Function1c07
callba Function104061
ld a, $80
ld [$cf63], a
ret
Function117bb6:
call Function117c89
ld a, $1
ld [hBGMapMode], a
callba Function118284
call ClearSprites
ld a, [$c300]
and a
jr z, .asm_117be7 ; 0x117bca $1b
cp $a
jr z, .asm_117be1 ; 0x117bce $11
.asm_117bd0
ld a, $2
ld [$c303], a
callba Function17f555
ld a, $80
ld [$cf63], a
ret
.asm_117be1
ld a, $80
ld [$cf63], a
ret
.asm_117be7
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ld a, [$cd89]
and $1
jr nz, .asm_117c16 ; 0x117bf3 $21
ld a, [$d000]
cp $fe
jr nz, .asm_117c16 ; 0x117bfa $1a
ld a, [$d001]
cp $f
jr nz, .asm_117c16 ; 0x117c01 $13
ld hl, $dfec
ld de, $cd69
ld c, $10
.asm_117c0b
ld a, [de]
inc de
cp [hl]
jr nz, .asm_117c16 ; 0x117c0e $6
inc hl
dec c
jr nz, .asm_117c0b ; 0x117c12 $f7
jr .asm_117c20 ; 0x117c14 $a
.asm_117c16
pop af
ld [rSVBK], a
ld a, $d3
ld [$c300], a
jr .asm_117bd0 ; 0x117c1e $b0
.asm_117c20
pop af
ld [rSVBK], a
callba Function172eb9
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ld a, $7
call GetSRAMBank
ld hl, DefaultFlypoint
ld de, $b000
ld bc, $1000
call CopyBytes
call CloseSRAM
pop af
ld [rSVBK], a
jp Function117cdd
Function117c4a:
ld hl, Data117cbc
call LoadMenuDataHeader
call Function1cbb
call Function1cfd
callba Function104061
ld hl, MobileStadiumSuccessText
call PrintText
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, $d000
ld de, $0008
ld c, $8
.asm_117c71
push hl
ld a, $ff
ld [hli], a
ld a, " "
ld [hl], a
pop hl
add hl, de
dec c
jr nz, .asm_117c71 ; 0x117c7b $f4
call Function4b6
pop af
ld [rSVBK], a
ld a, $80
ld [$cf63], a
ret
Function117c89:
ld a, $7
call GetSRAMBank
ld l, $0
ld h, l
ld de, $b000
ld bc, $0ffc
.asm_117c97
push bc
ld a, [de]
inc de
ld c, a
ld b, $0
add hl, bc
pop bc
dec bc
ld a, b
or c
jr nz, .asm_117c97 ; 0x117ca2 $f3
ld a, l
ld [$cd83], a
ld a, h
ld [$cd84], a
ld hl, $bfea
ld de, $cd69
ld bc, $0010
call CopyBytes
call CloseSRAM
ret
Data117cbc: ; 0x117cbc
db $40, $0c, $00, $11, $13, $00, $00, $00
Data117cc4: ; 0x117cc4
db $40, $07, $0e, $0b, $13, $00, $00, $00 ; XXX what is this
YesNo117ccc: ; 0x117ccc
db "はい", $4e ; Yes
db "いいえ@" ; No
MobileStadiumEntryText: ; 0x117cd3
TX_FAR _MobileStadiumEntryText
db "@"
MobileStadiumSuccessText: ; 0x117cd8
TX_FAR _MobileStadiumSuccessText
db "@"
Function117cdd: ; 0x117cdd
ld hl, $cf63
inc [hl]
ret
SECTION "bank46", ROMX, BANK[$46]
Function118000: ; 118000
ld a, $1
ld [$cd38], a
jr .asm_11800b
xor a
ld [$cd38], a
.asm_11800b
call Function1183cb
ld a, $18
ld [$cd33], a
ld a, $19
ld [$cd34], a
ld a, $4
ld [$c3f0], a
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
.asm_118024
call Functiona57
call Function118473
ld a, [$cf66]
cp $1b
jr c, .asm_118037
ld a, [$cd34]
ld [$cf66], a
.asm_118037
call Function1184a5
call Function11a8fa
callba Function115dd3
callba Function11619d
call DelayFrame
ld a, [$cf66]
ld hl, $cd33
cp [hl]
jr nz, .asm_118024
pop af
ld [rSVBK], a
call Function118452
call Function222a
Function11805e: ; 11805e (46:405e)
ret
; 11805f
Function11805f: ; 11805f
ld a, $1
ld [$cd38], a
call Function1183cb
ld a, $18
ld [$cd33], a
ld a, $19
ld [$cd34], a
ld a, $4
ld [$c3f0], a
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
.asm_11807d
call Functiona57
call Function118473
ld a, [$cf66]
cp $1b
jr c, .asm_118090
ld a, [$cd34]
ld [$cf66], a
.asm_118090
call Function11857c
call Function11a8fa
callba Function115dd3
callba Function11619d
call DelayFrame
ld a, [$cf66]
ld hl, $cd33
cp [hl]
jr nz, .asm_11807d
pop af
ld [rSVBK], a
call Function118452
call Function222a
ret
; 1180b8
INCBIN "baserom.gbc",$1180b8,$11811a - $1180b8
Function11811a: ; 11811a
ld a, 1
ld [$cd38], a
jr Function118125
Function118121: ; 118121
xor a
ld [$cd38], a
Function118125: ; 118125
call Function1183cb
ld a, $3
ld [$cd33], a
ld a, $d
ld [$cd34], a
ld a, $4
ld [$c3f0], a
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
.asm_11813e
call Functiona57
call Function118473
ld a, [$cf66]
cp $f
jr c, .asm_118151
ld a, [$cd34]
ld [$cf66], a
.asm_118151
call Function11854d
call Function11a8fa
callba Function115dd3
callba Function11619d
call DelayFrame
ld a, [$cf66]
ld hl, $cd33
cp [hl]
jr nz, .asm_11813e
xor a
ld [Unkn1Pals], a
pop af
ld [rSVBK], a
call Function118452
call Function118180
call Function222a
ret
; 118180
Function118180: ; 118180
ld a, [ScriptVar]
and a
ret nz
ld a, [$cd38]
and a
ret z
ld a, $5
call GetSRAMBank
ld hl, $cd69
ld de, $a89c
ld bc, $0016
call CopyBytes
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ld de, $d202
ld c, $96
callba Function17d0b3
jr c, .asm_1181d0
ld de, $d202
ld bc, $0196
callba Function17d1e1
jr c, .asm_1181d0
ld hl, $d202
ld de, $a8b2
ld bc, $0096
call CopyBytes
.asm_1181c9
pop af
ld [rSVBK], a
call CloseSRAM
ret
.asm_1181d0
ld a, $d3
ld [$c300], a
ld [ScriptVar], a
jr .asm_1181c9
; 1181da
Function1181da: ; 1181da
call Function1183cb
ld a, $2
ld [$cd38], a
ld a, $21
ld [$cd33], a
ld a, $22
ld [$cd34], a
ld a, $4
ld [$c3f0], a
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
.asm_1181f8
call Functiona57
call Function118473
ld a, [$cf66]
cp $28
jr c, .asm_11820b
ld a, [$cd34]
ld [$cf66], a
.asm_11820b
call Function1185c3
call Function11a8fa
callba Function115dd3
callba Function11619d
call DelayFrame
ld a, [$cf66]
ld hl, $cd33
cp [hl]
jr nz, .asm_1181f8
pop af
ld [rSVBK], a
call Function118452
call Function222a
ret
; 118233
INCBIN "baserom.gbc",$118233,$118284 - $118233
Function118284: ; 118284
call Function1183cb
ld a, $19
ld [$cd33], a
ld a, $1e
ld [$cd34], a
ld a, $5
ld [$c3f0], a
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $3
ld [rSVBK], a ; $ff00+$70
.asm_11829d
call Functiona57
call Function118473
ld a, [$cf66]
cp $20
jr c, .asm_1182b0
ld a, [$cd34]
ld [$cf66], a
.asm_1182b0
call Function1186f5
call Function11a8fa
callba Function115dd3
callba Function11619d
call DelayFrame
ld a, [$cf66]
ld hl, $cd33
cp [hl]
jr nz, .asm_11829d
pop af
ld [rSVBK], a ; $ff00+$70
call Function118452
ret
; 1182d5 (46:42d5)
INCBIN "baserom.gbc",$1182d5,$1183cb - $1182d5
Function1183cb: ; 1183cb
di
ld a, [rIE]
ld [$cd32], a
call DoubleSpeed
xor a
ld [rIF], a
ld [$c300], a
ld [$c301], a
ld [$c302], a
ld [$cd80], a
ld [$cd65], a
ld [$cd66], a
ld [$cd67], a
ld [$cd68], a
ld [$c31a], a
ld [$cd89], a
ld [$cd8a], a
ld [$cd8b], a
ld [$c3ec], a
ld [$c3ed], a
ld [$c3ee], a
ld [$c3ef], a
ld hl, VramState
ld a, [hl]
ld [$cd7f], a
set 1, [hl]
ld a, $f
ld [rIE], a
ld a, $1
ld [$ffc9], a
ld [$ffe9], a
ei
callba Function106462
callba Function106464
callba Function115d99
callba Function11615a
ld a, $5
call GetSRAMBank
xor a
ld [$bfff], a
call CloseSRAM
ret
; 118440
INCBIN "baserom.gbc",$118440,$118452 - $118440
Function118452: ; 118452
di
xor a
ld [$ffc9], a
ld [$ffe9], a
ld [$ff9e], a
call NormalSpeed
xor a
ld [rIF], a
ld a, [$cd32]
ld [rIE], a
ei
ld a, [$cd7f]
ld [VramState], a
ld a, [$c300]
ld [ScriptVar], a
ret
; 118473
Function118473: ; 118473
ld a, [$cd65]
and a
ret z
ld a, [$cd66]
inc a
ld [$cd66], a
cp $3c
ret nz
xor a
ld [$cd66], a
ld a, [$cd67]
inc a
ld [$cd67], a
cp $3c
ret nz
ld a, [$cd68]
inc a
ld [$cd68], a
cp $63
jr z, .asm_1184a0
xor a
ld [$cd67], a
ret
.asm_1184a0
xor a
ld [$cd65], a
ret
; 1184a5
Function1184a5: ; 1184a5
ld a, [$cf66]
ld e, a
ld d, $0
ld hl, $44b4
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 1184b4
INCBIN "baserom.gbc",$1184b4,$11854d - $1184b4
Function11854d: ; 11854d
ld a, [$cf66]
ld e, a
ld d, $0
ld hl, $455c
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 11855c
INCBIN "baserom.gbc",$11855c,$11857c - $11855c
Function11857c: ; 11857c
ld a, [$cf66]
ld e, a
ld d, $0
ld hl, $458b
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 11858b
INCBIN "baserom.gbc",$11858b,$1185c3 - $11858b
Function1185c3: ; 1185c3
ld a, [$cf66]
ld e, a
ld d, $0
ld hl, $45d2
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 1185d2
INCBIN "baserom.gbc",$1185d2,$1186f5 - $1185d2
Function1186f5: ; 1186f5 (46:46f5)
ld a, [$cf66]
ld e, a
ld d, 0
ld hl, Jumptable_118704
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 118704 (46:4704)
Jumptable_118704: ; 118704 (46:4704)
dw Function11886a
dw Function118880
dw Function11878d
dw Function1188b0
dw Function11878d
dw Function1188b8
dw Function11878d
dw Function1188c0
dw Function11878d
dw Function1188c8
dw Function11878d
dw Function118903
dw Function118abc
dw Function11878d
dw Function119451
dw Function1195f8
dw Function119612
dw Function119629
dw Function119648
dw Function11878d
dw Function118e6d
dw Function11878d
dw Function118e76
dw Function118e7e
dw Function11878d
dw Function11805e
dw Function11967d
dw Function119685
dw Function119665
dw Function11966d
dw Function118e76
dw Function118e87
; 118744 (46:4744)
INCBIN "baserom.gbc",$118744,$11878d - $118744
Function11878d: ; 11878d (46:478d)
ld a, [$c821]
bit 1, a
jr nz, .asm_1187af
bit 2, a
jr nz, .asm_1187d1
bit 0, a
jr nz, .asm_1187aa
ld a, [$cd89]
and $1
jr z, .asm_1187a7
ld a, $3
ld [rSVBK], a ; $ff00+$70
.asm_1187a7
jp Function119e2e
.asm_1187aa
call Function118821
ret c
ret
.asm_1187af
ld a, $0
call Function3e32
ld [$c300], a
ld a, l
ld [$c301], a
ld a, h
ld [$c302], a
ld a, $a
call Function3e32
ld a, [$c3f0]
ld [$c319], a
ld a, [$cd34]
ld [$cf66], a
ret
.asm_1187d1
ld hl, $cd89
bit 0, [hl]
jr nz, .asm_118803
set 0, [hl]
ld a, $6
ld [rSVBK], a ; $ff00+$70
ld de, Unkn1Pals ; $d000
ld bc, $1000
ld a, [hl]
sla a
jr c, .asm_1187f9
sla a
jr c, .asm_1187fd
sla a
jr c, .asm_1187f5
ld a, $24
jr .asm_1187ff
.asm_1187f5
ld a, $28
jr .asm_1187ff
.asm_1187f9
ld a, $2a
jr .asm_1187ff
.asm_1187fd
ld a, $2c
.asm_1187ff
call Function3e32
ret
.asm_118803
ld a, $d3
Function118805: ; 118805 (46:4805)
ld [$c300], a
xor a
ld [$c301], a
ld [$c302], a
ld a, $a
call Function3e32
ld a, [$c3f0]
ld [$c319], a
ld a, [$cd34]
ld [$cf66], a
ret
Function118821: ; 118821 (46:4821)
ld a, [$c319]
cp $3
jr c, .asm_11884a
cp $4
jr z, .asm_11884a
ld a, [hJoyDown] ; $ff00+$a8
cp $5
jr nz, .asm_11884a
ld a, $a
call Function3e32
ld a, $a
ld [$c300], a
ld a, [$c3f0]
ld [$c319], a
ld a, [$cd34]
ld [$cf66], a
scf
ret
.asm_11884a
and a
ret
; 11884c (46:484c)
INCBIN "baserom.gbc",$11884c,$11886a - $11884c
Function11886a: ; 11886a (46:486a)
ld a, $1
jr .asm_11886f
; 11886e (46:486e)
INCBIN "baserom.gbc",$11886e,$11886f - $11886e
.asm_11886f
ld [BGMapPalBuffer], a ; $cd48
ld a, $0
ld [$cd3c], a
call Function119e2e
ld a, [$cd33]
ld [$cd45], a
Function118880: ; 118880 (46:4880)
call Function119ed8
ret c
xor a
ld [$cf64], a
ld [$c807], a
ld de, $cd81
ld hl, $46
ld a, $2
jp Function119e2b
; 118896 (46:4896)
INCBIN "baserom.gbc",$118896,$1188b0 - $118896
Function1188b0: ; 1188b0 (46:48b0)
ld de, $c346
ld a, $c
jp Function119e2b
Function1188b8: ; 1188b8 (46:48b8)
ld de, $c3ac
ld a, $e
jp Function119e2b
Function1188c0: ; 1188c0 (46:48c0)
ld de, $c3cd
ld a, $10
jp Function119e2b
Function1188c8: ; 1188c8 (46:48c8)
ld a, $1
ld [$cd65], a
call Function1188e7
ld hl, $c708
.asm_1188d3
ld a, [de]
inc de
ld [hli], a
and a
jr nz, .asm_1188d3
call Function119eb4
call Function119ec2
ld hl, $c708
ld a, $6
jp Function119e2b
Function1188e7: ; 1188e7 (46:48e7)
ld de, $c346
ld a, $5
call GetSRAMBank
ld a, [$aa4a]
call CloseSRAM
and a
ret z
sla a
ld c, a
.asm_1188fa
ld a, [de]
inc de
and a
jr nz, .asm_1188fa
dec c
jr nz, .asm_1188fa
ret
Function118903: ; 118903 (46:4903)
ld a, [$c3f0]
ld [$c319], a
ld c, $1
callba Function115e18
ld a, $8
ld [$cd3c], a
call Function119ed8
jp Function119e2e
; 11891c (46:491c)
INCBIN "baserom.gbc",$11891c,$118abc - $11891c
Function118abc: ; 118abc (46:4abc)
ld hl, $4c95
ld de, $cc60
ld bc, $80
call CopyBytes
ld de, Unkn1Pals ; $d000
ld bc, $1000
jr .asm_118b10
; 118ad0 (46:4ad0)
INCBIN "baserom.gbc",$118ad0,$118b10 - $118ad0
.asm_118b10
push de
push bc
ld a, $8
ld [$cd3c], a
call Function119ed8
call Function118b24
pop bc
pop de
ld a, $2a
jp Function119e2b
Function118b24: ; 118b24 (46:4b24)
ld hl, $c346
ld a, $8
ld [hli], a
ld a, $c7
ld [hli], a
ld a, $60
ld [hli], a
ld a, $cc
ld [hli], a
call Function119eb4
call Function119ec2
ld a, $80
ld [$cd89], a
ld hl, $c346
ret
; 118b42 (46:4b42)
INCBIN "baserom.gbc",$118b42,$118ba5 - $118b42
ExchangeDownloadURL: ; 0x118ba5
ascii "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/exchange/index.txt"
db $0
BattleDownloadURL: ; 0x118bf7
ascii "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/battle/index.txt"
db $0
NewsDownloadURL: ; 0x118c47
ascii "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/news/index.txt"
db $0
MenuDownloadURL: ; 0x118c95
ascii "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/POKESTA/menu.cgb"
db $0
IndexDownloadURL: ; 0x118ce4
ascii "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/tamago/index.txt"
db $0
INCBIN "baserom.gbc",$118d35,$118e39 - $118d35
Function118e39: ; 118e39 (46:4e39)
ld a, [hli]
and a
jr nz, Function118e39
dec hl
.asm_118e3e
ld a, [hld]
cp $2f
jr nz, .asm_118e3e
inc hl
inc hl
ld de, $cd85
ld c, $4
.asm_118e4a
ld a, [hli]
cp $2e
jr z, .asm_118e63
cp $30
jr c, .asm_118e67
cp $3a
jr nc, .asm_118e67
sub $30
add $f6
ld [de], a
inc de
dec c
jr nz, .asm_118e4a
ld de, $cd85
.asm_118e63
ld a, $50
ld [de], a
ret
.asm_118e67
ld a, $f3
ld [de], a
inc de
jr .asm_118e63
Function118e6d: ; 118e6d (46:4e6d)
xor a
ld [$cd65], a
ld a, $a
jp Function119e2b
Function118e76: ; 118e76 (46:4e76)
ld a, $c
ld [$cd3c], a
jp Function119e2e
Function118e7e: ; 118e7e (46:4e7e)
call Function119ed8
ret c
ld a, $36
jp Function119e2b
Function118e87: ; 118e87 (46:4e87)
call Function119ed8
ret c
ld a, [$cd33]
ld [$cf66], a
ret
; 118e92 (46:4e92)
INCBIN "baserom.gbc",$118e92,$119451 - $118e92
Function119451: ; 119451 (46:5451)
ld a, [$cd89]
and $1
jr z, .asm_11945d
ld a, $d3
jp Function118805
.asm_11945d
xor a
ld [$cd50], a
call Function119694
ld a, b
ld [$cd49], a
call Function1196cd
ld a, [DefaultFlypoint] ; $d002
ld hl, $d003
Function119471: ; 119471 (46:5471)
push af
ld a, [hli]
ld [$c608], a
ld a, [hli]
ld [$c60b], a
ld a, [hli]
ld [$c609], a
ld a, [hli]
ld [$c60a], a
ld a, [hli]
ld [$c60c], a
ld a, [hli]
ld [$c60d], a ; $c60d
push hl
ld a, [$c608]
cp $ff
jr z, .asm_1194a7
ld a, [$c60a]
cp $ff
jr z, .asm_1194a7
ld a, [$c609]
cp $ff
jr nz, .asm_1194a7
call Function119584
jr c, .asm_11950c
jr .asm_1194f0
.asm_1194a7
ld hl, $c608
ld de, $c60b
ld c, $3
.asm_1194af
ld a, [de]
inc de
cp [hl]
inc hl
jr c, .asm_1194f3
jr z, .asm_1194b9
jr nc, .asm_1194bc
.asm_1194b9
dec c
jr nz, .asm_1194af
.asm_1194bc
ld c, $3
ld hl, $cd49
ld de, $c608
.asm_1194c4
ld a, [de]
inc de
cp $ff
jr z, .asm_1194d1
cp [hl]
jr z, .asm_1194d1
jr c, .asm_1194d5
jr nc, .asm_1194f0
.asm_1194d1
inc hl
dec c
jr nz, .asm_1194c4
.asm_1194d5
ld c, $3
ld hl, $cd49
ld de, $c60b
.asm_1194dd
ld a, [de]
inc de
cp $ff
jr z, .asm_1194ea
cp [hl]
jr c, .asm_1194f0
jr z, .asm_1194ea
jr nc, .asm_11950c
.asm_1194ea
inc hl
dec c
jr nz, .asm_1194dd
jr .asm_11950c
.asm_1194f0
pop hl
jr .asm_119557
.asm_1194f3
ld c, $3
ld hl, $cd49
ld de, $c608
.asm_1194fb
ld a, [de]
inc de
cp $ff
jr z, .asm_119508
cp [hl]
jr c, .asm_11950c
jr z, .asm_119508
jr nc, .asm_1194d5
.asm_119508
inc hl
dec c
jr nz, .asm_1194fb
.asm_11950c
pop hl
ld a, $1
ld [$cd50], a
ld a, l
ld [$c608], a
ld a, h
ld [$c609], a
ld de, $cd69
ld c, $10
ld b, $0
.asm_119521
ld a, [de]
inc de
cp [hl]
inc hl
jr nz, .asm_119528
inc b
.asm_119528
dec c
jr nz, .asm_119521
ld a, $10
cp b
jr z, .asm_119536
inc hl
inc hl
inc hl
inc hl
jr .asm_11957a
.asm_119536
ld a, [hli]
cp $50
jr nz, .asm_119552
ld a, [hli]
cp $33
jr nz, .asm_119553
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, [$cd83]
cp c
jr nz, .asm_119576
ld a, [$cd84]
cp b
jr nz, .asm_119576
jr .asm_11955b
.asm_119552
inc hl
.asm_119553
inc hl
inc hl
jr .asm_11955b
.asm_119557
ld de, $14
add hl, de
.asm_11955b
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
add hl, de
pop af
dec a
jp nz, Function119471
ld a, [$cd50]
and a
jr z, .asm_119571
ld a, $1a
ld [$cf66], a
ret
.asm_119571
ld a, $d8
jp Function118805
.asm_119576
ld a, $10
jr .asm_11957c
.asm_11957a
ld a, $f
.asm_11957c
ld [$cf66], a
pop af
call Function1195c4
ret
Function119584: ; 119584 (46:5584)
ld a, [$c608]
ld b, a
ld a, [$c60b]
ld c, a
cp b
jr c, .asm_11959c
ld a, [$cd49]
cp b
jr c, .asm_1195c2
.asm_119595
cp c
jr c, .asm_1195a2
jr z, .asm_1195a2
jr .asm_1195c2
.asm_11959c
ld a, [$cd49]
cp b
jr c, .asm_119595
.asm_1195a2
ld a, [$c60a]
ld b, a
ld a, [$c60d] ; $c60d
ld c, a
cp b
jr c, .asm_1195ba
ld a, [$cd4b]
cp b
jr c, .asm_1195c2
.asm_1195b3
cp c
jr c, .asm_1195c0
jr z, .asm_1195c0
jr .asm_1195c2
.asm_1195ba
ld a, [$cd4b]
cp b
jr c, .asm_1195b3
.asm_1195c0
scf
ret
.asm_1195c2
and a
ret
Function1195c4: ; 1195c4 (46:55c4)
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld de, $a5
ld a, b
cp d
jr c, .asm_1195d9
jr z, .asm_1195d3
jr nc, .asm_1195f3
.asm_1195d3
ld a, c
cp e
jr z, .asm_1195d9
jr nc, .asm_1195f3
.asm_1195d9
ld de, $cc60
call CopyBytes
xor a
ld [de], a
ld a, [$c608]
ld l, a
ld a, [$c609]
ld h, a
ld de, $cd69
ld bc, $10
call CopyBytes
ret
.asm_1195f3
ld a, $d8
jp Function118805
Function1195f8: ; 1195f8 (46:55f8)
ld a, $11
ld [$cd3c], a
ld a, $1c
ld [$cd45], a
ld a, $f
ld [$cd46], a
ld a, $14
ld [$cd47], a
call Function119e2e
jp Function119e2e
Function119612: ; 119612 (46:5612)
ld a, $14
ld [$cd3c], a
ld a, $1c
ld [$cd45], a
ld a, $10
ld [$cd46], a
ld a, $14
ld [$cd47], a
jp Function119e2e
Function119629: ; 119629 (46:5629)
call Function119ed8
ret c
ld a, $60
ld l, a
ld a, $cc
ld h, a
call Function118e39
ld a, $9
ld [$cd3c], a
ld a, $1c
ld [$cd45], a
ld a, $14
ld [$cd47], a
call Function119e2e
Function119648: ; 119648 (46:5648)
call Function119ed8
ret c
call DelayFrame
ld a, $8
ld [$cd3c], a
call Function119ed8
call Function118b24
ld de, Unkn1Pals ; $d000
ld bc, $1000
ld a, $2a
jp Function119e2b
Function119665: ; 119665 (46:5665)
ld a, $1a
ld [$cd3c], a
call Function119e2e
Function11966d: ; 11966d (46:566d)
call Function119ed8
ret c
ld a, [$cd47]
ld [$cf66], a
ld a, $a
ld [$c300], a
ret
Function11967d: ; 11967d (46:567d)
ld a, $18
ld [$cd3c], a
call Function119e2e
Function119685: ; 119685 (46:5685)
call Function119ed8
ret c
ld a, $14
ld [$cf66], a
ld a, $a
ld [$c300], a
ret
Function119694: ; 119694 (46:5694)
ld b, $0
ld hl, $56b8
.asm_119699
ld de, $c708
ld a, [de]
inc de
cp [hl]
inc hl
jr nz, .asm_1196af
ld a, [de]
inc de
cp [hl]
inc hl
jr nz, .asm_1196b0
ld a, [de]
inc de
cp [hl]
inc hl
jr nz, .asm_1196b1
ret
.asm_1196af
inc hl
.asm_1196b0
inc hl
.asm_1196b1
inc b
ld a, b
cp $7
jr nz, .asm_119699
ret
; 1196b8 (46:56b8)
INCBIN "baserom.gbc",$1196b8,$1196cd - $1196b8
Function1196cd: ; 1196cd (46:56cd)
ld de, $c719
call Function1196de
ld [$cd4a], a
inc de
call Function1196de
ld [$cd4b], a
ret
Function1196de: ; 1196de (46:56de)
ld a, [de]
inc de
sub $30
sla a
ld b, a
sla a
sla a
add b
ld c, a
add hl, bc
ld a, [de]
inc de
sub $30
add c
ret
; 1196f2 (46:56f2)
INCBIN "baserom.gbc",$1196f2,$119d93 - $1196f2
Function119d93: ; 119d93 (46:5d93)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $1
ld [rSVBK], a ; $ff00+$70
ld a, [$cd4f]
ld c, 10
call SimpleMultiply
ld hl, $cd50
ld [hl], a
ld bc, PartyMon2 - PartyMon1
ld de, PartyMon1Level ; $dcfe
ld a, [PartyCount] ; $dcd7
.asm_119daf
push af
ld a, [de]
push hl
push de
pop hl
add hl, bc
push hl
pop de
pop hl
cp [hl]
jr z, .asm_119dbd
jr nc, .asm_119dc6
.asm_119dbd
pop af
dec a
jr nz, .asm_119daf
pop af
ld [rSVBK], a ; $ff00+$70
and a
ret
.asm_119dc6
pop af
ld a, $4
ld [$cf66], a
pop af
ld [rSVBK], a ; $ff00+$70
scf
ret
Function119dd1: ; 119dd1 (46:5dd1)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, [$cd4f]
cp 70 / 10
jr nc, .asm_119e08
ld a, $1
ld [rSVBK], a ; $ff00+$70
ld hl, PartyMon1Level ; $dcfe
ld bc, PartyMon2 - PartyMon1
ld de, PartySpecies ; $dcd8
ld a, [PartyCount] ; $dcd7
.asm_119deb
push af
ld a, [de]
cp MEWTWO
jr z, .asm_119dfd
cp MEW
jr z, .asm_119dfd
cp LUGIA
jr c, .asm_119e02
cp NUM_POKEMON + 1
jr nc, .asm_119e02
.asm_119dfd
ld a, [hl]
cp 70
jr c, .asm_119e0d
.asm_119e02
add hl, bc
inc de
pop af
dec a
jr nz, .asm_119deb
.asm_119e08
pop af
ld [rSVBK], a ; $ff00+$70
and a
ret
.asm_119e0d
pop af
ld a, [de]
ld [$d265], a
call GetPokemonName
ld hl, StringBuffer1 ; $d073
ld de, $cd49
ld bc, PKMN_NAME_LENGTH
call CopyBytes
ld a, $a
ld [$cf66], a
pop af
ld [rSVBK], a ; $ff00+$70
scf
ret
; 119e2b (46:5e2b)
Function119e2b: ; 119e2b (46:5e2b)
call Function3e32
Function119e2e: ; 119e2e (46:5e2e)
ld hl, $cf66
inc [hl]
ret
; 119e33 (46:5e33)
INCBIN "baserom.gbc",$119e33,$119eb4 - $119e33
Function119eb4: ; 119eb4 (46:5eb4)
xor a
ld [$c3cc], a
ld de, $c3ac
.asm_119ebb
ld a, [de]
inc de
ld [hli], a
and a
jr nz, .asm_119ebb
ret
Function119ec2: ; 119ec2 (46:5ec2)
ld a, $5
call GetSRAMBank
xor a
ld [$aa5c], a
ld de, $aa4c
.asm_119ece
ld a, [de]
inc de
ld [hli], a
and a
jr nz, .asm_119ece
call CloseSRAM
ret
Function119ed8: ; 119ed8 (46:5ed8)
ld a, [rSVBK] ; $ff00+$70
ld [$cd8c], a
ld a, $1
ld [rSVBK], a ; $ff00+$70
call Function119eee
ld a, [$cd8c]
ld [rSVBK], a ; $ff00+$70
ld a, $1
ld [hBGMapMode], a ; $ff00+$d4
ret
Function119eee: ; 119eee (46:5eee)
ld a, [$cd3c]
ld e, a
ld d, $0
ld hl, $5efd
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 119efd (46:5efd)
INCBIN "baserom.gbc",$119efd,$11a8fa - $119efd
Function11a8fa: ; 11a8fa
ld a, [$c31a]
ld e, a
ld d, $0
ld hl, $6909
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 11a909
INCBIN "baserom.gbc",$11a909,$11aa13 - $11a909
UnknownText_0x11aa13: ; 0x11aa13
text "SAVE FILE will be"
line "sent."
done
; 0x11aa2c
UnknownText_0x11aa2c: ; 0x11aa2c
text "Sent SAVE FILE."
line "Reading NEWS…"
done
; 0x11aa4b
UnknownText_0x11aa4b: ; 0x11aa4b
text "Reading NEWS…"
done
; 0x11aa5a
UnknownText_0x11aa5a: ; 0x11aa5a
text "Received NEWS!"
done
; 0x11aa6a
UnknownText_0x11aa6a: ; 0x11aa6a
text "Quit reading NEWS?"
done
; 0x11aa7e
UnknownText_0x11aa7e: ; 0x11aa7e
text "Canceled sending"
line "SAVE FILE."
done
; 0x11aa9b
UnknownText_0x11aa9b: ; 0x11aa9b
text "ODD EGG"
line "was received!"
done
; 0x11aab2
UnknownText_0x11aab2: ; 0x11aab2
text "Registering your"
line "record…"
done
; 0x11aacc
UnknownText_0x11aacc: ; 0x11aacc
text "One visit per day"
line "per BATTLE ROOM!"
done
; 0x11aaf0
UnknownText_0x11aaf0: ; 0x11aaf0
text "A party #MON"
line "tops this level."
done
; 0x11ab0f
UnknownText_0x11ab0f: ; 0x11ab0f
text_from_ram $cd49
text " may go"
line "only to BATTLE"
para "ROOMS that are"
line "Lv.70 or higher."
done
; 0x11ab4a
UnknownText_0x11ab4a: ; 0x11ab4a
text "Cancel your BATTLE"
line "ROOM challenge?"
done
; 0x11ab6e
UnknownText_0x11ab6e: ; 0x11ab6e
text "Exit GYM LEADER"
line "HONOR ROLL?"
done
; 0x11ab8b
UnknownText_0x11ab8b: ; 0x11ab8b
text "Linking with the"
line "CENTER…"
done
; 0x11aba5
UnknownText_0x11aba5: ; 0x11aba5
text "What level do you"
line "want to challenge?"
done
; 0x11abcb
UnknownText_0x11abcb: ; 0x11abcb
text "Check BATTLE ROOM"
line "list by max level?"
done
; 0x11abf1
UnknownText_0x11abf1: ; 0x11abf1
text "Enter which"
line "BATTLE ROOM?"
done
; 0x11ac0b
UnknownText_0x11ac0b: ; 0x11ac0b
text "Which BATTLE ROOM?"
done
; 0x11ac1f
UnknownText_0x11ac1f: ; 0x11ac1f
text_from_ram StringBuffer3
text "'s ROOM"
line "@"
text_from_ram StringBuffer4
text "?"
cont "Please wait…"
done
; 0x11ac3e
Function11ac3e: ; 11ac3e
call SpeechTextBox
call FadeToMenu
callab Function8e814
call Function11ac51
call Function2b3c
ret
; 11ac51
Function11ac51: ; 11ac51
xor a
ld [hBGMapMode], a
ld hl, Options
ld a, [hl]
push af
set 4, [hl]
ld a, [VramState]
push af
xor a
ld [VramState], a
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
xor a
ld [$ffde], a
ld [$cd49], a
ld [$cd4a], a
ld [$cd4c], a
ld [$cd4d], a
ld [$cd4e], a
call Function11ad1b
call DelayFrame
.asm_11ac82
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_11aca8
call Function11b314
call Function11acb7
call Function11ad6e
ld a, $78
ld [$c3b5], a
callba Function8cf7a
callba Function104061
jr .asm_11ac82
.asm_11aca8
call ClearSprites
pop af
ld [$ffaa], a
pop af
ld [VramState], a
pop af
ld [Options], a
ret
; 11acb7
Function11acb7: ; 11acb7
ld hl, $7a44
ld a, [$cd49]
ld c, a
ld b, $0
sla c
rl b
sla c
rl b
sla c
rl b
add hl, bc
decoord 6, 6
ld a, [hli]
ld [de], a
decoord 0, 7
ld bc, $0007
call CopyBytes
ld a, [$cd49]
inc a
ld [$cd49], a
ld a, [hl]
cp $ff
jr nz, .asm_11aceb
xor a
ld [$cd49], a
.asm_11aceb
ld hl, $7b7d
ld a, [$cd4a]
ld c, a
ld b, $0
sla c
rl b
sla c
rl b
sla c
rl b
add hl, bc
decoord 3, 9
ld bc, $0007
call CopyBytes
ld a, [$cd4a]
inc a
ld [$cd4a], a
inc hl
ld a, [hl]
cp $ff
ret nz
xor a
ld [$cd4a], a
ret
; 11ad1b
Function11ad1b: ; 11ad1b
call WhiteBGMap
call ClearSprites
call ClearTileMap
callba Function17c000
ld a, [$cfa9]
ld [$cd82], a
dec a
ld [$ffb0], a
ld a, $10
ld [$c3b7], a
ld hl, Function8e83f
ld a, BANK(Function8e83f)
ld e, $4
rst FarCall
ld hl, Function8e83f
ld a, BANK(Function8e83f)
ld e, $5
rst FarCall
ld hl, PlayerSDefLevel
ld bc, $0115
xor a
call ByteFill
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
ld [$cd30], a
ld a, $2
ld [$c7d4], a
callba Function40bdc
ret
; 11ad6e
Function11ad6e: ; 11ad6e
ld a, [$cf63]
ld hl, $6d78
call Function11b239
jp [hl]
; 11ad78
INCBIN "baserom.gbc",$11ad78,$11b239 - $11ad78
Function11b239: ; 11b239
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ret
; 11b242
INCBIN "baserom.gbc",$11b242,$11b314 - $11b242
Function11b314: ; 11b314
call Function11b31b
call Function11b3d9
ret
; 11b31b
Function11b31b: ; 11b31b
ld hl, $7350
ld a, [$cf63]
cp $2
jr c, .asm_11b349
ld a, [$c7d1]
cp $4
jr nc, .asm_11b344
cp $3
jr c, .asm_11b349
ld a, [$cf63]
cp $2
jr z, .asm_11b349
cp $3
jr z, .asm_11b349
cp $6
jr z, .asm_11b349
ld bc, $737b
jr .asm_11b34c
.asm_11b344
ld bc, $7389
jr .asm_11b34c
.asm_11b349
ld bc, $736d
.asm_11b34c
call Function11b397
ret
; 11b350
INCBIN "baserom.gbc",$11b350,$11b397 - $11b350
Function11b397: ; 11b397
ld de, Sprites
.asm_11b39a
ld a, [hl]
cp $ff
ret z
ld a, [$c7d1]
and $7
swap a
add [hl]
inc hl
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [bc]
inc bc
ld [de], a
inc de
ld a, $5
ld [de], a
inc de
jr .asm_11b39a
; 11b3b6
INCBIN "baserom.gbc",$11b3b6,$11b3d9 - $11b3b6
Function11b3d9: ; 11b3d9
ld de, $c470
push de
ld a, [$c7d2]
dec a
ld e, a
ld a, [$c7d1]
ld hl, $c7d0
add [hl]
cp e
jr z, .asm_11b40d
ld hl, $0000
ld bc, $0070
call AddNTimes
ld e, l
ld d, h
ld b, $0
ld a, d
or e
jr z, .asm_11b40f
ld a, [$c7d2]
ld c, a
.asm_11b401
ld a, e
sub c
ld e, a
ld a, d
sbc $0
ld d, a
jr c, .asm_11b40f
inc b
jr .asm_11b401
.asm_11b40d
ld b, $70
.asm_11b40f
ld a, $15
add b
pop hl
ld [hli], a
cp $41
jr c, .asm_11b42b
ld a, [$cf63]
cp $4
jr z, .asm_11b43b
cp $5
jr z, .asm_11b43b
cp $7
jr z, .asm_11b43b
cp $8
jr z, .asm_11b43b
.asm_11b42b
ld a, $9b
ld [hli], a
ld a, [$cd4c]
add $3c
ld [hli], a
ld a, [$cd4c]
add $1
ld [hl], a
ret
.asm_11b43b
ld a, $9b
ld [hli], a
ld a, $39
ld [hli], a
xor a
ld [hl], a
ret
; 11b444
Function11b444: ; 11b444
call Function11b44b
call Function11b45c
ret
; 11b44b
Function11b44b: ; 11b44b
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
call UpdateTime
ret
; 11b45c
Function11b45c: ; 11b45c
.asm_11b45c
call Function11b46a
call DelayFrame
ld a, [$cf63]
cp $4
jr nz, .asm_11b45c
ret
; 11b46a
Function11b46a: ; 11b46a
ld a, [$cf63]
ld e, a
ld d, $0
ld hl, $7479
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 11b479
INCBIN "baserom.gbc",$11b479,$11b5e8 - $11b479
Function11b5e8: ; 11b5e8
ld a, $0
call GetSRAMBank
ld hl, wRTC
ld de, $c608
ld bc, $0004
call CopyBytes
call CloseSRAM
ld a, $5
call GetSRAMBank
ld hl, $c608
ld de, $b08c
ld bc, $0004
call CopyBytes
ld a, $2
ld [$a800], a
ld a, [$a81f]
ld [$cd2a], a
ld a, [$a820]
ld [$cd2b], a
ld a, [$a821]
ld [$cd2c], a
ld a, [$a822]
ld [$cd2d], a
ld a, [$a823]
ld [$cd2e], a
ld a, [$a824]
ld [$cd2f], a
ld a, [$a825]
ld [$cd30], a
ld a, [$a826]
ld [$cd31], a
call CloseSRAM
call Function11b44b
call Function11b64c
ret
; 11b64c
Function11b64c: ; 11b64c
.asm_11b64c
call Function11b65a
call DelayFrame
ld a, [$cf63]
cp $1
jr nz, .asm_11b64c
ret
; 11b65a
Function11b65a: ; 11b65a
ld a, [$cf63]
ld e, a
ld d, $0
ld hl, $7669
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 11b669
INCBIN "baserom.gbc",$11b669,$11b7e5 - $11b669
Function11b7e5: ; 11b7e5
ld a, [$c60d]
ld [PlayerLightScreenCount], a
ld [CurPartySpecies], a
ld a, [$cd81]
ld [$c74e], a
ld hl, $c63d
ld de, $c724
ld bc, $0005
call CopyBytes
ld a, $50
ld [de], a
ld a, [$c613]
ld [$c731], a
ld a, [$c614]
ld [$c732], a
ld hl, $c622
ld a, [hli]
ld [$c72f], a
ld a, [hl]
ld [$c730], a
ld bc, $c60d
callba GetCaughtGender
ld a, c
ld [$c733], a
call SpeechTextBox
call FadeToMenu
callba Function108016
callba Function17d1f1
ld a, $1
ld [$d1e9], a
ld a, $2
ld [InLinkBattle], a
callba Function421d8
xor a
ld [InLinkBattle], a
callba Function14a58
ld a, $5
call GetSRAMBank
ld a, $5
ld [$a800], a
call CloseSRAM
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
ld c, a
call GetMapTrigger
ld a, d
or e
jr z, .asm_11b872
ld a, $1
ld [de], a
.asm_11b872
call Function2b3c
call RestartMapMusic
ret
; 11b879
Function11b879: ; 11b879
callba Function17089a
ld a, [ScriptVar]
and a
ret z
ld a, $5
call GetSRAMBank
ld a, [$a800]
ld [ScriptVar], a
ld a, [$a890]
ld [$cd49], a
ld a, [$a891]
ld [$cd4a], a
ld a, [$a892]
ld [$cd4b], a
ld a, [$a893]
ld [$cd4c], a
call CloseSRAM
ld a, [ScriptVar]
and a
ret z
ld hl, $cd4c
ld a, [hRTCDayHi]
cp [hl]
ret nz
dec hl
ld a, [hRTCDayLo]
cp [hl]
ret nz
ld hl, $cd4a
ld a, [hRTCHours]
cp [hl]
jr nc, .asm_11b8d8
ld a, $18
sub [hl]
ld hl, hRTCHours
add [hl]
ld [$cd4c], a
ld a, [hRTCMinutes]
ld [$cd4b], a
xor a
ld [$cd4a], a
jr .asm_11b8e2
.asm_11b8d8
ld a, [hRTCMinutes]
ld [$cd4b], a
ld a, [hRTCHours]
ld [$cd4c], a
.asm_11b8e2
xor a
ld l, a
ld h, a
ld b, a
ld d, a
ld a, [$cd4b]
ld e, a
ld a, [$cd4c]
ld c, $3c
call AddNTimes
add hl, de
push hl
xor a
ld l, a
ld h, a
ld b, a
ld d, a
ld a, [$cd49]
ld e, a
ld a, [$cd4a]
ld c, $3c
call AddNTimes
add hl, de
ld a, l
cpl
add $1
ld e, a
ld a, h
cpl
adc $0
ld d, a
pop hl
add hl, de
ld de, $ff88
add hl, de
bit 7, h
ret z
ld a, $2
ld [ScriptVar], a
ret
; 11b920
Function11b920: ; 11b920
call Function11b44b
ld a, $5
call GetSRAMBank
ld hl, $a81f
ld de, $c626
ld bc, $0008
call CopyBytes
call CloseSRAM
call Function118000
ret
; 11b93b
Function11b93b: ; 11b93b
ld a, $5
call GetSRAMBank
xor a
ld [$a800], a
ld hl, $a823
ld de, $c608
ld bc, $008f
call CopyBytes
call CloseSRAM
ld a, $8
ld [BGMapBuffer], a
ld a, $c6
ld [$cd21], a
ld a, $11
ld [CreditsTimer], a
ld a, $c6
ld [$cd23], a
ld a, $41
ld [$cd24], a
ld a, $c6
ld [$cd25], a
ld a, $46
ld [$cd26], a
ld a, $c6
ld [$cd27], a
ld a, $4b
ld [$cd28], a
ld a, $c6
ld [$cd29], a
call Function11b98f
callba Function14a58
ret
; 11b98f
Function11b98f: ; 11b98f
ld hl, PartyCount
ld a, [hl]
ld e, a
inc [hl]
ld a, [BGMapBuffer]
ld l, a
ld a, [$cd21]
ld h, a
inc hl
ld bc, PartySpecies
ld d, e
.asm_11b9a2
inc bc
dec d
jr nz, .asm_11b9a2
ld a, e
ld [CurPartyMon], a
ld a, [hl]
ld [bc], a
inc bc
ld a, $ff
ld [bc], a
ld hl, PartyMon1Species
ld bc, PartyMon2 - PartyMon1
ld a, e
ld [$cd2a], a
.asm_11b9ba
add hl, bc
dec a
and a
jr nz, .asm_11b9ba
ld e, l
ld d, h
ld a, [CreditsTimer]
ld l, a
ld a, [$cd23]
ld h, a
ld bc, PartyMon2 - PartyMon1
call CopyBytes
ld hl, PartyMonOT
ld bc, $000b
ld a, [$cd2a]
.asm_11b9d8
add hl, bc
dec a
and a
jr nz, .asm_11b9d8
ld e, l
ld d, h
ld a, [$cd24]
ld l, a
ld a, [$cd25]
ld h, a
ld bc, $000a
call CopyBytes
ld a, $50
ld [de], a
ld hl, PartyMonNicknames
ld bc, $000b
ld a, [$cd2a]
.asm_11b9f9
add hl, bc
dec a
and a
jr nz, .asm_11b9f9
ld e, l
ld d, h
ld a, [$cd26]
ld l, a
ld a, [$cd27]
ld h, a
ld bc, $000a
call CopyBytes
ld a, $50
ld [de], a
ld hl, $a600
ld bc, $002f
ld a, [$cd2a]
.asm_11ba1a
add hl, bc
dec a
and a
jr nz, .asm_11ba1a
ld a, $0
call GetSRAMBank
ld e, l
ld d, h
ld a, [$cd28]
ld l, a
ld a, [$cd29]
ld h, a
ld bc, $002f
call CopyBytes
call CloseSRAM
ret
; 11ba38
Function11ba38: ; 11ba38
callba Functione538
ret c
xor a
ld [ScriptVar], a
ret
; 11ba44
INCBIN "baserom.gbc",$11ba44,$11bc9e - $11ba44
SECTION "bank47", ROMX, BANK[$47]
Function11c000:: ; 11c000
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ld hl, $d105
ld a, [hl]
dec a
ld e, a
ld d, $0
ld hl, $72f0
add hl, de
ld a, [hl]
and a
jr nz, .asm_11c026
ld a, [hRandomAdd]
and $1f
cp $19
jr c, .asm_11c021
sub $19
.asm_11c021
ld hl, $7332
jr .asm_11c033
.asm_11c026
ld a, [hRandomAdd]
and $f
cp $f
jr c, .asm_11c030
sub $f
.asm_11c030
ld hl, $73ce
.asm_11c033
ld b, $0
dec c
jr nz, .asm_11c03d
ld [$d200], a
jr .asm_11c040
.asm_11c03d
ld a, [$d200]
.asm_11c040
push af
add hl, bc
add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
ld h, a
ld l, c
pop af
ld c, a
ld b, $0
add hl, bc
add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
ld l, c
ld h, a
bccoord 1, 14
pop af
ld [rSVBK], a
call Function13e5
ret
; 11c05d
Function11c05d: ; 11c05d
ld a, e
or d
jr z, .asm_11c071
ld a, e
and d
cp $ff
jr z, .asm_11c071
push hl
call Function11c156
pop hl
call PlaceString
and a
ret
.asm_11c071
ld c, l
ld b, h
scf
ret
; 11c075
Function11c075: ; 11c075
push de
ld a, c
call Function11c254
pop de
ld bc, $cd36
call Function11c08f
ret
; 11c082
INCBIN "baserom.gbc",$11c082,$11c08f - $11c082
Function11c08f: ; 11c08f
ld l, e
ld h, d
push hl
ld a, $3
.asm_11c094
push af
ld a, [bc]
ld e, a
inc bc
ld a, [bc]
ld d, a
inc bc
push bc
call Function11c05d
jr c, .asm_11c0a2
inc bc
.asm_11c0a2
ld l, c
ld h, b
pop bc
pop af
dec a
jr nz, .asm_11c094
pop hl
ld de, $0028
add hl, de
ld a, $3
.asm_11c0b0
push af
ld a, [bc]
ld e, a
inc bc
ld a, [bc]
ld d, a
inc bc
push bc
call Function11c05d
jr c, .asm_11c0be
inc bc
.asm_11c0be
ld l, c
ld h, b
pop bc
pop af
dec a
jr nz, .asm_11c0b0
ret
; 11c0c6
Function11c0c6: ; 11c0c6
ld a, [$cf63]
ld l, a
ld a, [$cf64]
ld h, a
push hl
ld hl, $c618
ld a, $0
ld [hli], a
push de
xor a
ld [$cf63], a
ld a, $12
ld [$cf64], a
ld a, $6
.asm_11c0e1
push af
ld a, [bc]
ld e, a
inc bc
ld a, [bc]
ld d, a
inc bc
or e
jr z, .asm_11c133
push hl
push bc
call Function11c156
call Function11c14a
ld e, c
pop bc
pop hl
ld a, e
or a
jr z, .asm_11c133
.asm_11c0fa
ld a, [$cf64]
cp $12
jr z, .asm_11c102
inc e
.asm_11c102
cp e
jr nc, .asm_11c11c
ld a, [$cf63]
inc a
ld [$cf63], a
ld [hl], $4e
rra
jr c, .asm_11c113
ld [hl], $55
.asm_11c113
inc hl
ld a, $12
ld [$cf64], a
dec e
jr .asm_11c0fa
.asm_11c11c
cp $12
jr z, .asm_11c123
ld [hl], $7f
inc hl
.asm_11c123
sub e
ld [$cf64], a
ld de, $c608
.asm_11c12a
ld a, [de]
cp $50
jr z, .asm_11c133
inc de
ld [hli], a
jr .asm_11c12a
.asm_11c133
pop af
dec a
jr nz, .asm_11c0e1
ld [hl], $57
pop bc
ld hl, $c618
call Function13e5
pop hl
ld a, l
ld [$cf63], a
ld a, h
ld [$cf64], a
ret
; 11c14a
Function11c14a: ; 11c14a
ld c, $0
ld hl, $c608
.asm_11c14f
ld a, [hli]
cp $50
ret z
inc c
jr .asm_11c14f
; 11c156
Function11c156: ; 11c156
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
ld a, $50
ld hl, $c608
ld bc, $000b
call ByteFill
ld a, d
and a
jr z, .asm_11c19c
ld hl, $5aac
dec d
sla d
ld c, d
ld b, $0
add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
ld b, a
push bc
pop hl
ld c, e
ld b, $0
sla c
rl b
sla c
rl b
sla c
rl b
add hl, bc
ld bc, $0005
.asm_11c18f
ld de, $c608
call CopyBytes
ld de, $c608
pop af
ld [rSVBK], a
ret
.asm_11c19c
ld a, e
ld [$d265], a
call GetPokemonName
ld hl, StringBuffer1
ld bc, $000a
jr .asm_11c18f
; 11c1ab
Function11c1ab: ; 11c1ab
ld a, [$ffaa]
push af
ld a, $1
ld [$ffaa], a
call Function11c1b9
pop af
ld [$ffaa], a
ret
; 11c1b9
Function11c1b9: ; 11c1b9
call Function11c1ca
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
call Function11c283
pop af
ld [rSVBK], a
ret
; 11c1ca
Function11c1ca: ; 11c1ca
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
ld [$cd23], a
ld [BGMapBuffer], a
ld [$cd21], a
ld [CreditsTimer], a
ld [$cd35], a
ld [$cd2b], a
ld a, $ff
ld [$cd24], a
ld a, [$cfa9]
dec a
call Function11c254
call WhiteBGMap
call ClearSprites
call ClearScreen
call Function11d323
call Function32f9
call DisableLCD
ld hl, $567e
ld de, VTiles2
ld bc, $0060
call CopyBytes
ld hl, $56de
ld de, VTiles0
call Decompress
call EnableLCD
callba Function104061
callba Function8cf53
callba Function1500c
callba Function40c30
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, PlayerSDefLevel
ld de, LYOverrides
ld bc, $100
call CopyBytes
pop af
ld [rSVBK], a
call Function11d4aa
call Function11d3ba
ret
; 11c254
Function11c254: ; 11c254
push af
ld a, $4
call GetSRAMBank
ld hl, $a007
pop af
sla a
sla a
ld c, a
sla a
add c
ld c, a
ld b, $0
add hl, bc
ld de, $cd36
ld bc, $000c
call CopyBytes
call CloseSRAM
ret
; 11c277
Function11c277: ; 11c277 (47:4277)
ld a, $7f
hlcoord 0, 6
ld bc, $f0
call ByteFill
ret
Function11c283: ; 11c283
.asm_11c283
call Functiona57
ld a, [hJoyPressed]
ld [hJoypadPressed], a
ld a, [$cf63]
bit 7, a
jr nz, .asm_11c2a2
call Function11c2ac
callba Function8cf69
callba Function104061
jr .asm_11c283
.asm_11c2a2
callba Function8cf53
call ClearSprites
ret
; 11c2ac
Function11c2ac: ; 11c2ac
ld a, [$cf63]
ld e, a
ld d, 0
ld hl, Jumptable_11c2bb
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 11c2bb
Jumptable_11c2bb: ; 11c2bb (47:42bb)
dw Function11c2e9
dw Function11c346
dw Function11c35f
dw Function11c373
dw Function11c3c2
dw Function11c3ed
dw Function11c52c
dw Function11c53d
dw Function11c658
dw Function11c675
dw Function11c9bd
dw Function11c9c3
dw Function11caad
dw Function11cab3
dw Function11cb52
dw Function11cb66
dw Function11cbf5
dw Function11ccef
dw Function11cd04
dw Function11cd20
dw Function11cd54
dw Function11ce0b
dw Function11ce2b
Function11c2e9: ; 11c2e9 (47:42e9)
ld de, $1a0d
ld a, $1d
call Function3b2a
ld de, $420d
ld a, $1d
call Function3b2a
ld hl, $c
add hl, bc
ld a, $1
ld [hl], a
ld de, $4a10
ld a, $1d
call Function3b2a
ld hl, $c
add hl, bc
ld a, $3
ld [hl], a
ld de, $5080
ld a, $1d
call Function3b2a
ld hl, $c
add hl, bc
ld a, $4
ld [hl], a
ld de, $5020
ld a, $1d
call Function3b2a
ld hl, $c
add hl, bc
ld a, $5
ld [hl], a
ld de, $5010
ld a, $1d
call Function3b2a
ld hl, $c
add hl, bc
ld a, $2
ld [hl], a
ld hl, $cd23
set 1, [hl]
set 2, [hl]
jp Function11cfb5
Function11c346: ; 11c346 (47:4346)
ld a, $9
ld [$cd2d], a
ld a, $2
ld [$cd2e], a
ld [$cd2f], a
ld [$cd30], a
ld de, $cd2d
call Function11cfce
jp Function11cfb5
Function11c35f: ; 11c35f (47:435f)
ld hl, $cd2f
inc [hl]
inc [hl]
dec hl
dec hl
dec [hl]
push af
ld de, $cd2d
call Function11cfce
pop af
ret nz
jp Function11cfb5
Function11c373: ; 11c373 (47:4373)
ld hl, $cd30
inc [hl]
inc [hl]
dec hl
dec hl
dec [hl]
push af
ld de, $cd2d
call Function11cfce
pop af
ret nz
call Function11c38a
jp Function11cfb5
Function11c38a: ; 11c38a (47:438a)
ld hl, $4986
ld bc, $cd36
ld a, $6
.asm_11c392
push af
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
push de
pop hl
ld a, [bc]
inc bc
ld e, a
ld a, [bc]
inc bc
ld d, a
push bc
or e
jr z, .asm_11c3af
ld a, e
and d
cp $ff
jr z, .asm_11c3af
call Function11c05d
jr .asm_11c3b5
.asm_11c3af
ld de, $43bc
call PlaceString
.asm_11c3b5
pop bc
pop hl
pop af
dec a
jr nz, .asm_11c392
ret
; 11c3bc (47:43bc)
INCBIN "baserom.gbc",$11c3bc,$11c3c2 - $11c3bc
Function11c3c2: ; 11c3c2 (47:43c2)
call Function11c277
ld de, $4fbe
call Function11d035
hlcoord 1, 7
ld de, $44db
call PlaceString
hlcoord 1, 16
ld de, $451b
call PlaceString
call Function11c4be
ld hl, $cd23
set 0, [hl]
ld hl, $cd24
res 0, [hl]
call Function11cfb5
Function11c3ed: ; 11c3ed (47:43ed)
ld hl, BGMapBuffer ; $cd20 (aliases: CreditsPos)
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and $8
jr nz, .asm_11c426
ld a, [de]
and $2
jr nz, .asm_11c41a
ld a, [de]
and $1
jr nz, .asm_11c42c
ld de, $ffa9
ld a, [de]
and $40
jr nz, .asm_11c47c
ld a, [de]
and $80
jr nz, .asm_11c484
ld a, [de]
and $20
jr nz, .asm_11c48c
ld a, [de]
and $10
jr nz, .asm_11c498
ret
.asm_11c41a
call PlayClickSFX
.asm_11c41d
ld hl, $cd24
set 0, [hl]
ld a, $c
jr .asm_11c475
.asm_11c426
ld a, $8
ld [BGMapBuffer], a ; $cd20 (aliases: CreditsPos)
ret
.asm_11c42c
ld a, [BGMapBuffer] ; $cd20 (aliases: CreditsPos)
cp $6
jr c, .asm_11c472
sub $6
jr z, .asm_11c469
dec a
jr z, .asm_11c41d
ld hl, $cd36
ld c, $c
xor a
.asm_11c440
or [hl]
inc hl
dec c
jr nz, .asm_11c440
and a
jr z, .asm_11c460
ld de, $4fba
call Function11cfce
decoord 1, 2
ld bc, $cd36
call Function11c08f
ld hl, $cd24
set 0, [hl]
ld a, $e
jr .asm_11c475
.asm_11c460
ld hl, $cd24
set 0, [hl]
ld a, $11
jr .asm_11c475
.asm_11c469
ld hl, $cd24
set 0, [hl]
ld a, $a
jr .asm_11c475
.asm_11c472
call Function11c4a5
.asm_11c475
ld [$cf63], a
call PlayClickSFX
ret
.asm_11c47c
ld a, [hl]
cp $3
ret c
sub $3
jr .asm_11c4a3
.asm_11c484
ld a, [hl]
cp $6
ret nc
add $3
jr .asm_11c4a3
.asm_11c48c
ld a, [hl]
and a
ret z
cp $3
ret z
cp $6
ret z
dec a
jr .asm_11c4a3
.asm_11c498
ld a, [hl]
cp $2
ret z
cp $5
ret z
cp $8
ret z
inc a
.asm_11c4a3
ld [hl], a
ret
Function11c4a5: ; 11c4a5 (47:44a5)
ld hl, $cd23
res 0, [hl]
ld a, [$cd2b]
and a
jr nz, .asm_11c4b7
xor a
ld [$cd21], a
ld a, $6
ret
.asm_11c4b7
xor a
ld [CreditsTimer], a ; $cd22
ld a, $15
ret
Function11c4be: ; 11c4be (47:44be)
ld a, $1
ld hl, $ce51
ld bc, $a0
call ByteFill
ld a, $7
ld hl, $cef1
ld bc, $28
call ByteFill
callba Function104061
ret
; 11c4db (47:44db)
INCBIN "baserom.gbc",$11c4db,$11c52c - $11c4db
Function11c52c: ; 11c52c (47:452c)
call Function11c277
call Function11c5f0
call Function11c618
ld hl, $cd24
res 1, [hl]
call Function11cfb5
Function11c53d: ; 11c53d (47:453d)
ld hl, $cd21
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and START
jr nz, .start
ld a, [de]
and SELECT
jr nz, .select
ld a, [de]
and B_BUTTON
jr nz, .b
ld a, [de]
and A_BUTTON
jr nz, .a
ld de, $ffa9
ld a, [de]
and D_UP
jr nz, .up
ld a, [de]
and D_DOWN
jr nz, .down
ld a, [de]
and D_LEFT
jr nz, .left
ld a, [de]
and D_RIGHT
jr nz, .right
ret
.a
ld a, [$cd21]
cp $f
jr c, .asm_11c59d
sub $f
jr z, .asm_11c5ab
dec a
jr z, .asm_11c599
jr .b
.start
ld hl, $cd24
set 0, [hl]
ld a, $8
ld [BGMapBuffer], a ; $cd20 (aliases: CreditsPos)
.b
ld a, $4
jr .asm_11c59f
.select
ld a, [$cd2b]
xor $1
ld [$cd2b], a
ld a, $15
jr .asm_11c59f
.asm_11c599
ld a, $13
jr .asm_11c59f
.asm_11c59d
ld a, $8
.asm_11c59f
ld hl, $cd24
set 1, [hl]
ld [$cf63], a
call PlayClickSFX
ret
.asm_11c5ab
ld a, [BGMapBuffer] ; $cd20 (aliases: CreditsPos)
call Function11ca6a
call PlayClickSFX
ret
.up
ld a, [hl]
cp $3
ret c
sub $3
jr .asm_11c5ee
.down
ld a, [hl]
cp $f
ret nc
add $3
jr .asm_11c5ee
.left
ld a, [hl]
and a
ret z
cp $3
ret z
cp $6
ret z
cp $9
ret z
cp $c
ret z
cp $f
ret z
dec a
jr .asm_11c5ee
.right
ld a, [hl]
cp $2
ret z
cp $5
ret z
cp $8
ret z
cp $b
ret z
cp $e
ret z
cp $11
ret z
inc a
.asm_11c5ee
ld [hl], a
ret
Function11c5f0: ; 11c5f0 (47:45f0)
ld de, $5a52
ld bc, $463a
ld a, $f
.asm_11c5f8
push af
ld a, [bc]
inc bc
ld l, a
ld a, [bc]
inc bc
ld h, a
push bc
call PlaceString
.asm_11c603
inc de
ld a, [de]
cp $50
jr z, .asm_11c603
pop bc
pop af
dec a
jr nz, .asm_11c5f8
hlcoord 1, 17
ld de, $462a
call PlaceString
ret
Function11c618: ; 11c618 (47:4618)
ld a, $2
ld hl, $ce51
ld bc, $c8
call ByteFill
callba Function104061
ret
; 11c62a (47:462a)
INCBIN "baserom.gbc",$11c62a,$11c658 - $11c62a
Function11c658: ; 11c658 (47:4658)
call Function11c277
call Function11c770
ld de, $4fc2
call Function11d035
call Function11c9ab
call Function11c7bc
call Function11c86e
ld hl, $cd24
res 3, [hl]
call Function11cfb5
Function11c675: ; 11c675 (47:4675)
ld hl, $cd25
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and $1
jr nz, .asm_11c6e6
ld a, [de]
and $2
jr nz, .asm_11c6f0
ld a, [de]
and $8
jr nz, .asm_11c69e
ld a, [de]
and $4
jr z, .asm_11c6ce
ld a, [$cd26]
and a
ret z
sub $c
jr nc, .asm_11c699
xor a
.asm_11c699
ld [$cd26], a
jr .asm_11c6c4
.asm_11c69e
ld hl, $cd28
ld a, [$cd26]
add $c
cp [hl]
ret nc
ld [$cd26], a
ld a, [hl]
ld b, a
ld hl, $cd25
ld a, [$cd26]
add [hl]
jr c, .asm_11c6b9
cp b
jr c, .asm_11c6c4
.asm_11c6b9
ld a, [$cd28]
ld hl, $cd26
sub [hl]
dec a
ld [$cd25], a
.asm_11c6c4
call Function11c992
call Function11c7bc
call Function11c86e
ret
.asm_11c6ce
ld de, $ffa9
ld a, [de]
and $40
jr nz, .asm_11c708
ld a, [de]
and $80
jr nz, .asm_11c731
ld a, [de]
and $20
jr nz, .asm_11c746
ld a, [de]
and $10
jr nz, .asm_11c755
ret
.asm_11c6e6
call Function11c8f6
ld a, $4
ld [$cd35], a
jr .asm_11c6fc
.asm_11c6f0
ld a, [$cd2b]
and a
jr nz, .asm_11c6fa
ld a, $6
jr .asm_11c6fc
.asm_11c6fa
ld a, $15
.asm_11c6fc
ld [$cf63], a
ld hl, $cd24
set 3, [hl]
call PlayClickSFX
ret
.asm_11c708
ld a, [hl]
cp $3
jr c, .asm_11c711
sub $3
jr .asm_11c76e
.asm_11c711
ld a, [$cd26]
sub $3
ret c
ld [$cd26], a
jr .asm_11c6c4
.asm_11c71c
ld hl, $cd28
ld a, [$cd26]
add $c
ret c
cp [hl]
ret nc
ld a, [$cd26]
add $3
ld [$cd26], a
jr .asm_11c6c4
.asm_11c731
ld a, [$cd28]
ld b, a
ld a, [$cd26]
add [hl]
add $3
cp b
ret nc
ld a, [hl]
cp $9
jr nc, .asm_11c71c
add $3
jr .asm_11c76e
.asm_11c746
ld a, [hl]
and a
ret z
cp $3
ret z
cp $6
ret z
cp $9
ret z
dec a
jr .asm_11c76e
.asm_11c755
ld a, [$cd28]
ld b, a
ld a, [$cd26]
add [hl]
inc a
cp b
ret nc
ld a, [hl]
cp $2
ret z
cp $5
ret z
cp $8
ret z
cp $b
ret z
inc a
.asm_11c76e
ld [hl], a
ret
Function11c770: ; 11c770 (47:4770)
xor a
ld [$cd25], a
ld [$cd26], a
ld [$cd27], a
ld a, [$cd2b]
and a
jr nz, .asm_11c7ab
ld a, [$cd21]
and a
jr z, .asm_11c799
dec a
sla a
ld hl, $7220
ld c, a
ld b, $0
add hl, bc
ld a, [hli]
ld [$cd28], a
ld a, [hl]
.asm_11c795
ld [$cd29], a
ret
.asm_11c799
ld a, [$c7d2]
ld [$cd28], a
.asm_11c79f
ld c, $c
call SimpleDivide
and a
jr nz, .asm_11c7a8
dec b
.asm_11c7a8
ld a, b
jr .asm_11c795
.asm_11c7ab
ld hl, $c6a8
ld a, [CreditsTimer] ; $cd22
ld c, a
ld b, $0
add hl, bc
add hl, bc
ld a, [hl]
ld [$cd28], a
jr .asm_11c79f
Function11c7bc: ; 11c7bc (47:47bc)
ld bc, $4854
ld a, [$cd2b]
and a
jr nz, .asm_11c814
ld a, [$cd21]
ld d, a
and a
jr z, .asm_11c7e9
ld a, [$cd26]
ld e, a
.asm_11c7d0
ld a, [bc]
ld l, a
inc bc
ld a, [bc]
ld h, a
inc bc
and l
cp $ff
ret z
push bc
push de
call Function11c05d
pop de
pop bc
inc e
ld a, [$cd28]
cp e
jr nz, .asm_11c7d0
ret
.asm_11c7e9
ld hl, $d100
ld a, [$cd26]
ld e, a
add hl, de
.asm_11c7f1
push de
ld a, [hli]
ld e, a
ld d, $0
push hl
ld a, [bc]
ld l, a
inc bc
ld a, [bc]
ld h, a
inc bc
and l
cp $ff
jr z, .asm_11c811
push bc
call Function11c05d
pop bc
pop hl
pop de
inc e
ld a, [$cd28]
cp e
jr nz, .asm_11c7f1
ret
.asm_11c811
pop hl
pop de
ret
.asm_11c814
ld hl, $c648
ld a, [$cd22]
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
push de
pop hl
ld a, [$cd26]
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [$cd26]
ld e, a
.asm_11c831
push de
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
ld a, [bc]
ld l, a
inc bc
ld a, [bc]
ld h, a
inc bc
and l
cp $ff
jr z, .asm_11c851
push bc
call Function11c05d
pop bc
pop hl
pop de
inc e
ld a, [$cd28]
cp e
jr nz, .asm_11c831
ret
.asm_11c851
pop hl
pop de
ret
; 11c854 (47:4854)
INCBIN "baserom.gbc",$11c854,$11c86e - $11c854
Function11c86e: ; 11c86e (47:486e)
ld a, [$cd26]
and a
jr z, .asm_11c88a
hlcoord 2, 17
ld de, $48f0
call PlaceString
hlcoord 6, 17
ld c, $3
xor a
.asm_11c883
ld [hli], a
inc a
dec c
jr nz, .asm_11c883
jr .asm_11c895
.asm_11c88a
hlcoord 2, 17
ld c, $7
ld a, $7f
.asm_11c891
ld [hli], a
dec c
jr nz, .asm_11c891
.asm_11c895
ld hl, $cd28
ld a, [$cd26]
add $c
jr c, .asm_11c8b7
cp [hl]
jr nc, .asm_11c8b7
hlcoord 16, 17
ld de, $48f3
call PlaceString
hlcoord 11, 17
ld a, $3
ld c, a
.asm_11c8b1
ld [hli], a
inc a
dec c
jr nz, .asm_11c8b1
ret
.asm_11c8b7
hlcoord 17, 16
ld a, $7f
ld [hl], a
hlcoord 11, 17
ld c, $7
.asm_11c8c2
ld [hli], a
dec c
jr nz, .asm_11c8c2
ret
; 11c8c7 (47:48c7)
INCBIN "baserom.gbc",$11c8c7,$11c8f6 - $11c8c7
Function11c8f6: ; 11c8f6 (47:48f6)
ld a, [BGMapBuffer] ; $cd20 (aliases: CreditsPos)
call Function11c95d
push hl
ld a, [$cd2b]
and a
jr nz, .asm_11c938
ld a, [$cd21]
ld d, a
and a
jr z, .asm_11c927
ld hl, $cd26
ld a, [$cd25]
add [hl]
.asm_11c911
ld e, a
.asm_11c912
pop hl
push de
call Function11c05d
pop de
ld a, [BGMapBuffer] ; $cd20 (aliases: CreditsPos)
ld c, a
ld b, $0
ld hl, $cd36
add hl, bc
add hl, bc
ld [hl], e
inc hl
ld [hl], d
ret
.asm_11c927
ld hl, $cd26
ld a, [$cd25]
add [hl]
ld c, a
ld b, $0
ld hl, $d100
add hl, bc
ld a, [hl]
jr .asm_11c911
.asm_11c938
ld hl, $c648
ld a, [$cd22]
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
push de
pop hl
ld a, [$cd26]
ld e, a
ld d, $0
add hl, de
add hl, de
ld a, [$cd25]
ld e, a
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
jr .asm_11c912
Function11c95d: ; 11c95d (47:495d)
sla a
ld c, a
ld b, $0
ld hl, $4986
add hl, bc
ld a, [hli]
ld c, a
ld a, [hl]
ld b, a
push bc
push bc
pop hl
ld a, $5
ld c, a
ld a, $7f
.asm_11c972
ld [hli], a
dec c
jr nz, .asm_11c972
dec hl
ld bc, $ffec
add hl, bc
ld a, $5
ld c, a
ld a, $7f
.asm_11c980
ld [hld], a
dec c
jr nz, .asm_11c980
pop hl
ret
; 11c986 (47:4986)
INCBIN "baserom.gbc",$11c986,$11c992 - $11c986
Function11c992: ; 11c992 (47:4992)
ld a, $8
hlcoord 2, 7
.asm_11c997
push af
ld a, $7f
push hl
ld bc, $11
call ByteFill
pop hl
ld bc, $14
add hl, bc
pop af
dec a
jr nz, .asm_11c997
ret
Function11c9ab: ; 11c9ab (47:49ab)
ld a, $7
ld hl, $ce51
ld bc, $c8
call ByteFill
callba Function104061
ret
Function11c9bd: ; 11c9bd (47:49bd)
ld de, $4a38
call Function11ca7f
Function11c9c3: ; 11c9c3 (47:49c3)
ld hl, $cd2a
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and $1
jr nz, .asm_11c9de
ld a, [de]
and $2
jr nz, .asm_11c9e9
ld a, [de]
and $40
jr nz, .asm_11c9f7
ld a, [de]
and $80
jr nz, .asm_11c9fc
ret
.asm_11c9de
ld a, [hl]
and a
jr nz, .asm_11c9e9
call Function11ca5e
xor a
ld [BGMapBuffer], a ; $cd20 (aliases: CreditsPos)
.asm_11c9e9
ld hl, $cd24
set 4, [hl]
ld a, $4
ld [$cf63], a
call PlayClickSFX
ret
.asm_11c9f7
ld a, [hl]
and a
ret z
dec [hl]
ret
.asm_11c9fc
ld a, [hl]
and a
ret nz
inc [hl]
ret
Function11ca01: ; 11ca01 (47:4a01)
ld hl, $ce73
ld de, $14
ld a, $5
ld c, a
.asm_11ca0a
push hl
ld a, $6
ld b, a
ld a, $7
.asm_11ca10
ld [hli], a
dec b
jr nz, .asm_11ca10
pop hl
add hl, de
dec c
jr nz, .asm_11ca0a
Function11ca19: ; 11ca19 (47:4a19)
ld hl, $cec9
ld de, $14
ld a, $6
ld c, a
.asm_11ca22
push hl
ld a, $14
ld b, a
ld a, $7
.asm_11ca28
ld [hli], a
dec b
jr nz, .asm_11ca28
pop hl
add hl, de
dec c
jr nz, .asm_11ca22
callba Function104061
ret
; 11ca38 (47:4a38)
INCBIN "baserom.gbc",$11ca38,$11ca5e - $11ca38
Function11ca5e: ; 11ca5e (47:4a5e)
xor a
.asm_11ca5f
push af
call Function11ca6a
pop af
inc a
cp $6
jr nz, .asm_11ca5f
ret
Function11ca6a: ; 11ca6a (47:4a6a)
ld hl, $cd36
ld c, a
ld b, $0
add hl, bc
add hl, bc
ld [hl], b
inc hl
ld [hl], b
call Function11c95d
ld de, $43bc
call PlaceString
ret
Function11ca7f: ; 11ca7f (47:4a7f)
push de
ld de, $4fc6
call Function11cfce
ld de, $4fca
call Function11cfce
hlcoord 1, 14
pop de
call PlaceString
hlcoord 16, 8
ld de, $4a57
call PlaceString
call Function11ca01
ld a, $1
ld [$cd2a], a
ld hl, $cd24
res 4, [hl]
call Function11cfb5
ret
Function11caad: ; 11caad (47:4aad)
ld de, $4b1c
call Function11ca7f
Function11cab3: ; 11cab3 (47:4ab3)
ld hl, $cd2a
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and $1
jr nz, .asm_11cace
ld a, [de]
and $2
jr nz, .asm_11caf9
ld a, [de]
and $40
jr nz, .asm_11cb12
ld a, [de]
and $80
jr nz, .asm_11cb17
ret
.asm_11cace
call PlayClickSFX
ld a, [hl]
and a
jr nz, .asm_11cafc
ld a, [$cd35]
and a
jr z, .asm_11caf3
cp $ff
jr z, .asm_11caf3
ld a, $ff
ld [$cd35], a
hlcoord 1, 14
ld de, $4b31
call PlaceString
ld a, $1
ld [$cd2a], a
ret
.asm_11caf3
ld hl, $cf63
set 7, [hl]
ret
.asm_11caf9
call PlayClickSFX
.asm_11cafc
ld hl, $cd24
set 4, [hl]
ld a, $4
ld [$cf63], a
ld a, [$cd35]
cp $ff
ret nz
ld a, $1
ld [$cd35], a
ret
.asm_11cb12
ld a, [hl]
and a
ret z
dec [hl]
ret
.asm_11cb17
ld a, [hl]
and a
ret nz
inc [hl]
ret
; 11cb1c (47:4b1c)
INCBIN "baserom.gbc",$11cb1c,$11cb52 - $11cb1c
Function11cb52: ; 11cb52 (47:4b52)
ld hl, $4c01
ld a, [$cfa9]
.asm_11cb58
dec a
jr z, .asm_11cb5f
inc hl
inc hl
jr .asm_11cb58
.asm_11cb5f
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
call Function11ca7f
Function11cb66: ; 11cb66 (47:4b66)
ld hl, $cd2a
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and $1
jr nz, .asm_11cb81
ld a, [de]
and $2
jr nz, .asm_11cbd7
ld a, [de]
and $40
jr nz, .asm_11cbeb
ld a, [de]
and $80
jr nz, .asm_11cbf0
ret
.asm_11cb81
ld a, [hl]
and a
jr nz, .asm_11cbd4
ld a, $4
call GetSRAMBank
ld hl, $a007
ld a, [$cfa9]
dec a
sla a
sla a
ld c, a
sla a
add c
ld c, a
ld b, $0
add hl, bc
ld de, $cd36
ld c, $c
.asm_11cba2
ld a, [de]
ld [hli], a
inc de
dec c
jr nz, .asm_11cba2
call CloseSRAM
call PlayClickSFX
ld de, $4fc6
call Function11cfce
ld hl, $4c7e
ld a, [$cfa9]
.asm_11cbba
dec a
jr z, .asm_11cbc1
inc hl
inc hl
jr .asm_11cbba
.asm_11cbc1
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
hlcoord 1, 14
call PlaceString
ld hl, $cf63
inc [hl]
inc hl
ld a, $10
ld [hl], a
ret
.asm_11cbd4
call PlayClickSFX
.asm_11cbd7
ld de, $4fba
call Function11cfce
call Function11c38a
ld hl, $cd24
set 4, [hl]
ld a, $4
ld [$cf63], a
ret
.asm_11cbeb
ld a, [hl]
and a
ret z
dec [hl]
ret
.asm_11cbf0
ld a, [hl]
and a
ret nz
inc [hl]
ret
Function11cbf5: ; 11cbf5 (47:4bf5)
call WaitSFX
ld hl, $cf64
dec [hl]
ret nz
dec hl
set 7, [hl]
ret
; 11cc01 (47:4c01)
INCBIN "baserom.gbc",$11cc01,$11ccef - $11cc01
Function11ccef: ; 11ccef (47:4cef)
ld de, $4fc6
call Function11cfce
hlcoord 1, 14
ld de, $4d10
call PlaceString
call Function11ca19
call Function11cfb5
Function11cd04: ; 11cd04 (47:4d04)
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and a
ret z
ld a, $4
ld [$cf63], a
ret
; 11cd10 (47:4d10)
INCBIN "baserom.gbc",$11cd10,$11cd20 - $11cd10
Function11cd20: ; 11cd20 (47:4d20)
call Function11c277
ld de, $4fc6
call Function11cfce
hlcoord 1, 14
ld a, [$cd2b]
ld [$cd2c], a
and a
jr nz, .asm_11cd3a
ld de, $4dc7
jr .asm_11cd3d
.asm_11cd3a
ld de, $4dd9
.asm_11cd3d
call PlaceString
hlcoord 4, 8
ld de, $4df5
call PlaceString
call Function11cdaa
ld hl, $cd24
res 5, [hl]
call Function11cfb5
Function11cd54: ; 11cd54 (47:4d54)
ld hl, $cd2c
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and $1
jr nz, .asm_11cd6f
ld a, [de]
and $2
jr nz, .asm_11cd73
ld a, [de]
and $40
jr nz, .asm_11cd8b
ld a, [de]
and $80
jr nz, .asm_11cd94
ret
.asm_11cd6f
ld a, [hl]
ld [$cd2b], a
.asm_11cd73
ld a, [$cd2b]
and a
jr nz, .asm_11cd7d
ld a, $6
jr .asm_11cd7f
.asm_11cd7d
ld a, $15
.asm_11cd7f
ld [$cf63], a
ld hl, $cd24
set 5, [hl]
call PlayClickSFX
ret
.asm_11cd8b
ld a, [hl]
and a
ret z
dec [hl]
ld de, $4dc7
jr .asm_11cd9b
.asm_11cd94
ld a, [hl]
and a
ret nz
inc [hl]
ld de, $4dd9
.asm_11cd9b
push de
ld de, $4fc6
call Function11cfce
pop de
hlcoord 1, 14
call PlaceString
ret
Function11cdaa: ; 11cdaa (47:4daa)
ld a, $2
ld hl, $ce51
ld bc, $78
call ByteFill
ld a, $7
ld hl, $cec9
ld bc, $50
call ByteFill
callba Function104061
ret
; 11cdc7 (47:4dc7)
INCBIN "baserom.gbc",$11cdc7,$11ce0b - $11cdc7
Function11ce0b: ; 11ce0b (47:4e0b)
call Function11c277
hlcoord 1, 7
ld de, $4f79
call PlaceString
hlcoord 1, 17
ld de, $462a
call PlaceString
call Function11c618
ld hl, $cd24
res 2, [hl]
call Function11cfb5
Function11ce2b: ; 11ce2b (47:4e2b)
ld a, [CreditsTimer] ; $cd22
sla a
sla a
ld c, a
ld b, $0
ld hl, $4eb9
add hl, bc
ld de, hJoypadPressed ; $ffa3
ld a, [de]
and $8
jr nz, .asm_11ce78
ld a, [de]
and $4
jr nz, .asm_11ce86
ld a, [de]
and $1
jr nz, .asm_11ce68
ld a, [de]
and $2
jr nz, .asm_11ce82
ld de, $ffa9
ld a, [de]
and $40
jr nz, .asm_11ceb1
ld a, [de]
and $80
jr nz, .asm_11ceaf
ld a, [de]
and $20
jr nz, .asm_11ceae
ld a, [de]
and $10
jr nz, .asm_11ceb0
ret
.asm_11ce68
ld a, [CreditsTimer] ; $cd22
cp $2d
jr c, .asm_11ce92
sub $2d
jr z, .asm_11cea4
dec a
jr z, .asm_11ce96
jr .asm_11ce82
.asm_11ce78
ld hl, $cd24
set 0, [hl]
ld a, $8
ld [BGMapBuffer], a ; $cd20 (aliases: CreditsPos)
.asm_11ce82
ld a, $4
jr .asm_11ce98
.asm_11ce86
ld a, [$cd2b]
xor $1
ld [$cd2b], a
ld a, $6
jr .asm_11ce98
.asm_11ce92
ld a, $8
jr .asm_11ce98
.asm_11ce96
ld a, $13
.asm_11ce98
ld [$cf63], a
ld hl, $cd24
set 2, [hl]
call PlayClickSFX
ret
.asm_11cea4
ld a, [BGMapBuffer] ; $cd20 (aliases: CreditsPos)
call Function11ca6a
call PlayClickSFX
ret
.asm_11ceae
inc hl
.asm_11ceaf
inc hl
.asm_11ceb0
inc hl
.asm_11ceb1
ld a, [hl]
cp $ff
ret z
ld [CreditsTimer], a ; $cd22
ret
; 11ceb9 (47:4eb9)
INCBIN "baserom.gbc",$11ceb9,$11cfb5 - $11ceb9
Function11cfb5: ; 11cfb5 (47:4fb5)
ld hl, $cf63
inc [hl]
ret
; 11cfba (47:4fba)
INCBIN "baserom.gbc",$11cfba,$11cfce - $11cfba
Function11cfce: ; 11cfce (47:4fce)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $14
ld a, [de]
inc de
push af
ld a, [de]
inc de
and a
.asm_11cfda
jr z, .asm_11cfe0
add hl, bc
dec a
jr .asm_11cfda
.asm_11cfe0
pop af
ld c, a
ld b, $0
add hl, bc
push hl
ld a, $79
ld [hli], a
ld a, [de]
inc de
dec a
dec a
jr z, .asm_11cff6
ld c, a
ld a, $7a
.asm_11cff2
ld [hli], a
dec c
jr nz, .asm_11cff2
.asm_11cff6
ld a, $7b
ld [hl], a
pop hl
ld bc, $14
add hl, bc
ld a, [de]
dec de
dec a
dec a
jr z, .asm_11d022
ld b, a
.asm_11d005
push hl
ld a, $7c
ld [hli], a
ld a, [de]
dec a
dec a
jr z, .asm_11d015
ld c, a
ld a, $7f
.asm_11d011
ld [hli], a
dec c
jr nz, .asm_11d011
.asm_11d015
ld a, $7c
ld [hl], a
pop hl
push bc
ld bc, $14
add hl, bc
pop bc
dec b
jr nz, .asm_11d005
.asm_11d022
ld a, $7d
ld [hli], a
ld a, [de]
dec a
dec a
jr z, .asm_11d031
ld c, a
ld a, $7a
.asm_11d02d
ld [hli], a
dec c
jr nz, .asm_11d02d
.asm_11d031
ld a, $7e
ld [hl], a
ret
Function11d035: ; 11d035 (47:5035)
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $14
ld a, [de]
inc de
push af
ld a, [de]
inc de
and a
.asm_11d041
jr z, .asm_11d047
add hl, bc
dec a
jr .asm_11d041
.asm_11d047
pop af
ld c, a
ld b, $0
add hl, bc
push hl
ld a, $79
ld [hl], a
pop hl
push hl
ld a, [de]
dec a
inc de
ld c, a
add hl, bc
ld a, $7b
ld [hl], a
call Function11d0ac
ld a, $7e
ld [hl], a
pop hl
push hl
call Function11d0ac
ld a, $7d
ld [hl], a
pop hl
push hl
inc hl
push hl
call Function11d0ac
pop bc
dec de
ld a, [de]
cp $2
jr z, .asm_11d082
dec a
dec a
.asm_11d078
push af
ld a, $7a
ld [hli], a
ld [bc], a
inc bc
pop af
dec a
jr nz, .asm_11d078
.asm_11d082
pop hl
ld bc, $14
add hl, bc
push hl
ld a, [de]
dec a
ld c, a
ld b, $0
add hl, bc
pop bc
inc de
ld a, [de]
cp $2
ret z
push bc
dec a
dec a
ld c, a
ld b, a
ld de, $14
.asm_11d09c
ld a, $7c
ld [hl], a
add hl, de
dec c
jr nz, .asm_11d09c
pop hl
.asm_11d0a4
ld a, $7c
ld [hl], a
add hl, de
dec b
jr nz, .asm_11d0a4
ret
Function11d0ac: ; 11d0ac (47:50ac)
ld a, [de]
dec a
ld bc, $14
.asm_11d0b1
add hl, bc
dec a
jr nz, .asm_11d0b1
ret
Function11d0b6: ; 11d0b6 (47:50b6)
ld hl, $c
add hl, bc
ld a, [hl]
ld e, a
ld d, 0
ld hl, Jumptable_11d0c7
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_11d0c7: ; 11d0c7 (47:50c7)
dw Function11d0dd
dw Function11d0e9
dw Function11d0f5
dw Function11d10f
dw Function11d134
dw Function11d145
dw Function11d156
dw Function11d175
dw Function11d1d7
dw Function11d1d1
dw Function11d1fc
Function11d0dd: ; 11d0dd (47:50dd)
ld a, [BGMapBuffer] ; $cd20 (aliases: CreditsPos)
sla a
ld hl, $5208
ld e, $1
jr asm_11d11e
Function11d0e9: ; 11d0e9 (47:50e9)
ld a, [$cd21]
sla a
ld hl, $521a
ld e, $2
jr asm_11d11e
Function11d0f5: ; 11d0f5 (47:50f5)
ld hl, $52be
ld a, [CreditsTimer] ; $cd22
ld e, a
ld d, $0
add hl, de
ld a, [hl]
call Function3b3c
ld a, [CreditsTimer] ; $cd22
sla a
ld hl, $523e
ld e, $4
jr asm_11d11e
Function11d10f: ; 11d10f (47:510f)
ld a, $27
call Function3b3c
ld a, [$cd25]
sla a
ld hl, $529e
ld e, $8
asm_11d11e: ; 11d11e (47:511e)
push de
ld e, a
ld d, $0
add hl, de
push hl
pop de
ld hl, $4
add hl, bc
ld a, [de]
inc de
ld [hli], a
ld a, [de]
ld [hl], a
pop de
ld a, e
call Function11d2ee
ret
Function11d134: ; 11d134 (47:5134)
ld a, $27
call Function3b3c
ld a, [$cd2a]
sla a
ld hl, $52b6
ld e, $10
jr asm_11d11e
Function11d145: ; 11d145 (47:5145)
ld a, $27
call Function3b3c
ld a, [$cd2c]
sla a
ld hl, $52ba
ld e, $20
jr asm_11d11e
Function11d156: ; 11d156 (47:5156)
ld a, $2a
call Function3b3c
ld a, [$cd4a]
sla a
sla a
sla a
add $18
ld hl, $4
add hl, bc
ld [hli], a
ld a, $30
ld [hl], a
ld a, $1
ld e, a
call Function11d2ee
ret
Function11d175: ; 11d175 (47:5175)
ld a, [$cd4d]
cp $4
jr z, .asm_11d180
ld a, $28
jr .asm_11d182
.asm_11d180
ld a, $26
.asm_11d182
call Function3b3c
ld a, [$cd4d]
cp $4
jr z, .asm_11d1b1
ld a, [$cd4c]
sla a
sla a
sla a
add $20
ld hl, $4
add hl, bc
ld [hli], a
ld a, [$cd4d]
sla a
sla a
sla a
sla a
add $48
ld [hl], a
ld a, $2
ld e, a
call Function11d2ee
ret
.asm_11d1b1
ld a, [$cd4c]
sla a
sla a
sla a
ld e, a
sla a
sla a
add e
add $18
ld hl, $4
add hl, bc
ld [hli], a
ld a, $8a
ld [hl], a
ld a, $2
ld e, a
call Function11d2ee
ret
Function11d1d1: ; 11d1d1 (47:51d1)
ld d, $98
ld a, $2c
jr asm_11d1db
Function11d1d7: ; 11d1d7 (47:51d7)
ld d, $10
ld a, $2b
asm_11d1db: ; 11d1db (47:51db)
push de
call Function3b3c
ld a, [$cd4a]
sla a
sla a
sla a
ld e, a
sla a
add e
add $40
ld hl, $5
add hl, bc
ld [hld], a
pop af
ld [hl], a
ld a, $4
ld e, a
call Function11d2ee
ret
Function11d1fc: ; 11d1fc (47:51fc)
ld a, $26
call Function3b3c
ld a, $8
ld e, a
call Function11d2ee
ret
; 11d208 (47:5208)
INCBIN "baserom.gbc",$11d208,$11d2ee - $11d208
Function11d2ee: ; 11d2ee (47:52ee)
ld hl, $cd24
and [hl]
jr nz, .asm_11d316
ld a, e
ld hl, $cd23
and [hl]
jr z, .asm_11d30f
ld hl, $e
add hl, bc
ld a, [hl]
and a
jr z, .asm_11d305
dec [hl]
ret
.asm_11d305
ld a, $0
ld [hld], a
ld a, $1
xor [hl]
ld [hl], a
and a
jr nz, .asm_11d316
.asm_11d30f
ld hl, $7
add hl, bc
xor a
ld [hl], a
ret
.asm_11d316
ld hl, $5
add hl, bc
ld a, $b0
sub [hl]
ld hl, $7
add hl, bc
ld [hl], a
ret
Function11d323: ; 11d323
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, $533a
ld de, Unkn1Pals
ld bc, $0080
call CopyBytes
pop af
ld [rSVBK], a
ret
; 11d33a
INCBIN "baserom.gbc",$11d33a,$11d3ba - $11d33a
Function11d3ba: ; 11d3ba
ld a, [rSVBK]
push af
ld hl, BattleMonSpclDef
ld a, $0
ld [$cd2d], a
ld [hli], a
ld a, $d8
ld [$cd2e], a
ld [hl], a
ld a, $fe
ld [$cd2f], a
ld a, $54
ld [$cd30], a
ld a, $a8
ld [$cd31], a
ld a, $c6
ld [$cd32], a
ld a, $4a
ld [$cd33], a
ld a, $c6
ld [$cd34], a
ld hl, $723c
ld a, $2d
Function11d3ef: ; 11d3ef
push af
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
push hl
ld hl, Unkn1Pals
add hl, de
ld a, [$cd2d]
ld e, a
ld a, [$cd2e]
ld d, a
push bc
.asm_11d406
ld a, $3
ld [rSVBK], a
ld a, [hli]
push af
ld a, $5
ld [rSVBK], a
pop af
ld [de], a
inc de
ld a, $3
ld [rSVBK], a
ld a, [hli]
push af
ld a, $5
ld [rSVBK], a
pop af
ld [de], a
inc de
dec bc
ld a, c
or b
jr nz, .asm_11d406
ld a, [$cd2f]
ld l, a
ld a, [$cd30]
ld h, a
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, l
ld [$cd2f], a
ld a, h
ld [$cd30], a
push bc
pop hl
ld c, $0
.asm_11d43d
ld a, [hl]
cp $ff
jr z, .asm_11d453
call Function11d493
jr nz, .asm_11d44a
inc hl
jr .asm_11d43d
.asm_11d44a
ld a, [hli]
ld [de], a
inc de
xor a
ld [de], a
inc de
inc c
jr .asm_11d43d
.asm_11d453
pop hl
ld b, $0
add hl, bc
push hl
pop bc
ld a, [$cd31]
ld l, a
ld a, [$cd32]
ld h, a
ld a, c
ld [hli], a
ld a, b
ld [hli], a
ld a, l
ld [$cd31], a
ld a, h
ld [$cd32], a
ld a, [$cd33]
ld l, a
ld a, [$cd34]
ld h, a
ld a, e
ld [$cd2d], a
ld [hli], a
ld a, d
ld [$cd2e], a
ld [hli], a
ld a, l
ld [$cd33], a
ld a, h
ld [$cd34], a
pop hl
pop af
dec a
jr z, .asm_11d48f
jp Function11d3ef
.asm_11d48f
pop af
ld [rSVBK], a
ret
; 11d493
Function11d493: ; 11d493
push hl
push bc
push de
dec a
ld hl, rSVBK
ld e, $1
ld [hl], e
call CheckSeenMon
ld hl, rSVBK
ld e, $5
ld [hl], e
pop de
pop bc
pop hl
ret
; 11d4aa
Function11d4aa: ; 11d4aa
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ld hl, $5aac
ld bc, $7220
xor a
ld [$cd2d], a
inc a
ld [$cd2e], a
ld a, $e
.asm_11d4c1
push af
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push hl
ld hl, $0005
add hl, de
ld a, [bc]
inc bc
inc bc
push bc
.asm_11d4cf
push af
push hl
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
ld hl, Unkn1Pals
add hl, de
ld a, [$cd2d]
ld [hli], a
inc a
ld [$cd2d], a
ld a, [$cd2e]
ld [hl], a
pop hl
ld de, $0008
add hl, de
pop af
dec a
jr nz, .asm_11d4cf
ld hl, $cd2d
xor a
ld [hli], a
inc [hl]
pop bc
pop hl
pop af
dec a
jr nz, .asm_11d4c1
pop af
ld [rSVBK], a
ret
; 11d4fe
INCBIN "baserom.gbc",$11d4fe,$11f686 - $11d4fe
SECTION "bank5B", ROMX, BANK[$5B]
INCBIN "baserom.gbc",$16c000,$16d421 - $16c000
Function16d421: ; 16d421
ld de, $4fc1
ld hl, VTiles2
ld bc, $5b46
call Get2bpp
ret
; 16d42e
Function16d42e: ; 16d42e
ld hl, $5465
ld de, TileMap
ld bc, $0168
call CopyBytes
ret
; 16d43b
INCBIN "baserom.gbc",$16d43b,$16d61d - $16d43b
Function16d61d: ; 16d61d
ld h, d
ld l, e
push bc
push hl
call Function16d640
pop hl
pop bc
ld de, AttrMap - TileMap
add hl, de
inc b
inc b
inc c
inc c
ld a, $7
.asm_16d630
push bc
push hl
.asm_16d632
ld [hli], a
dec c
jr nz, .asm_16d632
pop hl
ld de, $0014
add hl, de
pop bc
dec b
jr nz, .asm_16d630
ret
; 16d640
Function16d640: ; 16d640
push hl
ld a, $30
ld [hli], a
inc a
call Function16d66d
inc a
ld [hl], a
pop hl
ld de, $0014
add hl, de
.asm_16d64f
push hl
ld a, $33
ld [hli], a
ld a, $7f
call Function16d66d
ld [hl], $34
pop hl
ld de, $0014
add hl, de
dec b
jr nz, .asm_16d64f
ld a, $35
ld [hli], a
ld a, $36
call Function16d66d
ld [hl], $37
ret
; 16d66d
Function16d66d: ; 16d66d
ld d, c
.asm_16d66e
ld [hli], a
dec d
jr nz, .asm_16d66e
ret
; 16d673
Function16d673: ; 16d673
call Function16d696
call Function16d6ae
callba Function49856
callba Functionfb60d
hlcoord 10, 17
ld de, $568f
call PlaceString
ret
; 16d68f
INCBIN "baserom.gbc",$16d68f,$16d696 - $16d68f
Function16d696: ; 16d696
call Function16d421
ret
; 16d69a
Function16d69a: ; 16d69a
ld de, $52c1
ld hl, $9760
ld bc, $5b08
call Get2bpp
ret
; 16d6a7
Function16d6a7: ; 16d6a7
callba Function49811
ret
; 16d6ae
Function16d6ae: ; 16d6ae
call Function16d42e
ld hl, $55cd
ld de, TileMap
ld bc, $0028
call CopyBytes
ld hl, $55f5
decoord 0, 16
ld bc, $0028
call CopyBytes
ret
; 16d6ca
Function16d6ca: ; 16d6ca
call Function16d61d
ret
; 16d6ce
Function16d6ce: ; 16d6ce
call Function1d6e
call Function16d6e1
callba Function87d
call Function1d7d
call Function3200
ret
; 16d6e1
Function16d6e1: ; 16d6e1
hlcoord 4, 10
ld b, $1
ld c, $a
predef Function28eef
hlcoord 5, 11
ld de, $5701
call PlaceString
call WaitBGMap
call Function3200
ld c, $32
jp DelayFrames
; 16d701
INCBIN "baserom.gbc",$16d701,$16d70c - $16d701
Function16d70c: ; 16d70c
call Function16d725
call Function16d713
ret
; 16d713
Function16d713: ; 16d713
push bc
push af
ld a, [$ffa9]
and $f0
ld b, a
ld a, [hJoyPressed]
and $f
or b
ld b, a
pop af
ld a, b
pop bc
ld d, a
ret
; 16d725
Function16d725: ; 16d725
ld hl, $cfa6
res 7, [hl]
ld a, [hBGMapMode]
push af
call Function16d734
pop af
ld [hBGMapMode], a
ret
; 16d734
Function16d734: ; 16d734
.asm_16d734
call Function16d77a
call Function16d759
call Function16d76a
jr nc, .asm_16d758
callba Function24270
jr c, .asm_16d758
ld a, [$cfa5]
bit 7, a
jr nz, .asm_16d758
call Function16d713
ld b, a
ld a, [$cfa8]
and b
jr z, .asm_16d734
.asm_16d758
ret
; 16d759
Function16d759: ; 16d759
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
call WaitBGMap
pop af
ld [hOAMUpdate], a
xor a
ld [hBGMapMode], a
ret
; 16d76a
Function16d76a: ; 16d76a
.asm_16d76a
call RTC
call Function16d7e7
ret c
ld a, [$cfa5]
bit 7, a
jr z, .asm_16d76a
and a
ret
; 16d77a
Function16d77a: ; 16d77a
ld hl, $cfac
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
cp $1f
jr nz, .asm_16d792
ld a, [$cfab]
ld [hl], a
push hl
push bc
ld bc, $000b
add hl, bc
ld [hl], a
pop bc
pop hl
.asm_16d792
ld a, [$cfa1]
ld b, a
ld a, [$cfa2]
ld c, a
call GetTileCoord
ld a, [$cfa7]
swap a
and $f
ld c, a
ld a, [$cfa9]
ld b, a
xor a
dec b
jr z, .asm_16d7b1
.asm_16d7ad
add c
dec b
jr nz, .asm_16d7ad
.asm_16d7b1
ld c, $14
call AddNTimes
ld a, [$cfa7]
and $f
ld c, a
ld a, [$cfaa]
ld b, a
xor a
dec b
jr z, .asm_16d7c8
.asm_16d7c4
add c
dec b
jr nz, .asm_16d7c4
.asm_16d7c8
ld c, a
add hl, bc
ld a, [hl]
cp $1f
jr z, .asm_16d7de
ld [$cfab], a
ld [hl], $1f
push hl
push bc
ld bc, $000b
add hl, bc
ld [hl], $1f
pop bc
pop hl
.asm_16d7de
ld a, l
ld [$cfac], a
ld a, h
ld [$cfad], a
ret
; 16d7e7
Function16d7e7: ; 16d7e7
ld a, [$cfa5]
bit 6, a
jr z, .asm_16d7f4
callba Function8cf62
.asm_16d7f4
call Functiona57
call Function16d713
and a
ret z
scf
ret
; 16d7fe
SECTION "bank5C", ROMX, BANK[$5C]
INCBIN "baserom.gbc",$170000,$1700b0 - $170000
Function1700b0: ; 1700b0
call Function17021e
callba Function118121
ret
; 1700ba
Function1700ba: ; 1700ba
call Function17021e
callba Function11811a
ret
; 1700c4
INCBIN "baserom.gbc",$1700c4,$170114 - $1700c4
Function170114: ; 170114
call Function17021e
call Function170121
callba Function11805f
ret
; 170121
Function170121: ; 170121
ld a, $5
call GetSRAMBank
ld hl, $a948
ld de, $c608
ld bc, $00f6
call CopyBytes
call CloseSRAM
call Function170c8b
ret
; 170139
INCBIN "baserom.gbc",$170139,$170215 - $170139
Function170215: ; 170215
xor a
ld [$cf63], a
call Function17022c
ret
; 17021d
Function17021d: ; 17021d
ret
; 17021e
Function17021e: ; 17021e
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
ret
; 17022c
Function17022c: ; 17022c
.asm_17022c
call Function17023a
call DelayFrame
ld a, [$cf63]
cp $1
jr nz, .asm_17022c
ret
; 17023a
Function17023a: ; 17023a
ld a, [$cf63]
ld e, a
ld d, $0
ld hl, $4249
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 170249
INCBIN "baserom.gbc",$170249,$1704e1 - $170249
Function1704e1: ; 1704e1
call SpeechTextBox
call FadeToMenu
call Function17021e
call Function1704f1
call Function2b3c
ret
; 1704f1
Function1704f1: ; 1704f1
call WhiteBGMap
call ClearSprites
call ClearScreen
.asm_1704fa
call Functiona57
ld a, [$cf63]
bit 7, a
jr nz, .asm_17050f
call Function170510
callba Function104061
jr .asm_1704fa
.asm_17050f
ret
; 170510
Function170510: ; 170510
ld a, [$cf63]
ld e, a
ld d, $0
ld hl, $451f
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 17051f
INCBIN "baserom.gbc",$17051f,$170687 - $17051f
Function170687: ; 170687
ld a, [ScriptVar]
ld e, a
ld d, 0
ld hl, Jumptable_170696
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 170696
Jumptable_170696: ; 170696 (5c:4696)
dw Function17075f
dw Function170788
dw Function170778
dw Function170799
dw Function17079d
dw Function1707ac
dw Function1707f4
dw Function170868
dw Function170881
dw Function17089a
dw Function1708b1
dw Function1708b9
dw Function1708c8
dw Function1708f0
dw Function17093c
dw Function1709aa
dw Function1709bb
dw Function170a9c
dw Function170aa0
dw Function170aaf
dw Function170abe
dw Function170ad7
dw Function170807
dw Function17081d
dw Function170ae8
dw Function170b16
dw Function1706d6
dw Function1706ee
dw Function17071b
dw Function170729
dw Function17073e
dw Function170737
Function1706d6: ; 1706d6 (5c:46d6)
ld a, $1
call GetSRAMBank
ld a, $ff
ld hl, $be48
ld bc, $7
call ByteFill
xor a
ld [$be46], a
call CloseSRAM
ret
Function1706ee: ; 1706ee (5c:46ee)
ld a, $1
call GetSRAMBank
ld a, [$be50]
call CloseSRAM
ld [ScriptVar], a ; $c2dd
ld hl, NumItems ; $d892 (aliases: TMsHMsEnd)
ld a, [hli]
cp $14
ret c
ld b, $14
ld a, [ScriptVar] ; $c2dd
ld c, a
.asm_170709
ld a, [hli]
cp c
jr nz, .asm_170711
ld a, [hl]
cp $5f
ret c
.asm_170711
inc hl
dec b
jr nz, .asm_170709
ld a, $12
ld [ScriptVar], a ; $c2dd
ret
Function17071b: ; 17071b (5c:471b)
ld a, $1
call GetSRAMBank
ld a, $3
ld [$be45], a
call CloseSRAM
ret
Function170729: ; 170729 (5c:4729)
ld a, $1
call GetSRAMBank
ld a, $4
ld [$be45], a
call CloseSRAM
ret
Function170737: ; 170737 (5c:4737)
callba Function14dbb
ret
Function17073e: ; 17073e (5c:473e)
call Random
ld a, [hRandomAdd] ; $ff00+$e1
and $7
cp $6
jr c, .asm_17074b
sub $6
.asm_17074b
add $1a
cp $1e
jr z, Function17073e
push af
ld a, $1
call GetSRAMBank
pop af
ld [$be50], a
call CloseSRAM
ret
Function17075f: ; 17075f (5c:475f)
call Function17089a
ld a, [ScriptVar] ; $c2dd
and a
ret z
ld a, $1
call GetSRAMBank
ld a, [$be4f]
and $2
ld [ScriptVar], a ; $c2dd
call CloseSRAM
ret
Function170778: ; 170778 (5c:4778)
ld hl, $be45
ld a, $1
call GetSRAMBank
ld a, [hl]
ld [ScriptVar], a ; $c2dd
call CloseSRAM
ret
Function170788: ; 170788 (5c:4788)
ld a, $1
call GetSRAMBank
ld a, [$be4f]
or $2
ld [$be4f], a
call CloseSRAM
ret
Function170799: ; 170799 (5c:4799)
ld c, $1
jr asm_17079f
Function17079d: ; 17079d (5c:479d)
ld c, $0
asm_17079f: ; 17079f (5c:479f)
ld a, $1
call GetSRAMBank
ld a, c
ld [$be45], a
call CloseSRAM
ret
Function1707ac: ; 1707ac (5c:47ac)
ld a, $5
call GetSRAMBank
ld a, [$aa8c]
ld b, a
ld a, [$be46]
ld [ScriptVar], a ; $c2dd
call CloseSRAM
and a
ret z
ld a, b
cp $2
jr nc, .asm_1707ef
push bc
call UpdateTime
pop bc
ld a, $5
call GetSRAMBank
ld a, [$aa8b]
call CloseSRAM
ld c, a
ld a, [CurDay] ; $d4cb
sub c
jr c, .asm_1707e5
cp $8
jr nc, .asm_1707ef
ld a, b
and a
jr nz, .asm_1707ef
ret
.asm_1707e5
ld hl, CurDay ; $d4cb
ld a, $8c
sub c
add [hl]
cp $8
ret c
.asm_1707ef
ld a, $8
ld [ScriptVar], a ; $c2dd
Function1707f4: ; 1707f4 (5c:47f4)
ld a, $5
call GetSRAMBank
xor a
ld [$be46], a
ld [$aa8b], a
ld [$aa8c], a
call CloseSRAM
ret
Function170807: ; 170807 (5c:4807)
call UpdateTime
ld a, $5
call GetSRAMBank
ld a, [CurDay] ; $d4cb
ld [$b2f9], a
xor a
ld [$b2fa], a
call CloseSRAM
ret
Function17081d: ; 17081d (5c:481d)
xor a
ld [ScriptVar], a ; $c2dd
ld a, $5
call GetSRAMBank
ld a, [$b2f9]
ld c, a
ld a, [$b2fa]
ld b, a
call CloseSRAM
cp $2
jr nc, .asm_170853
push bc
call UpdateTime
pop bc
ld a, [CurDay] ; $d4cb
sub c
jr c, .asm_170849
cp $b
jr nc, .asm_170853
ld a, b
and a
jr nz, .asm_170853
ret
.asm_170849
ld hl, CurDay ; $d4cb
ld a, $8c
sub c
add [hl]
cp $b
ret c
.asm_170853
ld a, $1
ld [ScriptVar], a ; $c2dd
ld a, $5
call GetSRAMBank
xor a
ld [$b2f9], a
ld [$b2fa], a
call CloseSRAM
ret
Function170868: ; 170868 (5c:4868)
ld a, $1
call GetSRAMBank
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $3
ld [rSVBK], a ; $ff00+$70
ld a, [$d800]
ld [$be47], a
pop af
ld [rSVBK], a ; $ff00+$70
call CloseSRAM
ret
Function170881: ; 170881 (5c:4881)
ld a, $1
call GetSRAMBank
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $3
ld [rSVBK], a ; $ff00+$70
ld a, [$be47]
ld [$d800], a
pop af
ld [rSVBK], a ; $ff00+$70
call CloseSRAM
ret
Function17089a: ; 17089a
ld a, [$cfcd]
and a
jr z, .asm_1708ad
callba Function14bcb
jr z, .asm_1708ab
xor a
jr .asm_1708ad
.asm_1708ab
ld a, $1
.asm_1708ad
ld [ScriptVar], a
ret
; 1708b1
Function1708b1: ; 1708b1 (5c:48b1)
xor a
ld [MusicFade], a ; $c2a7
call MaxVolume
ret
Function1708b9: ; 1708b9 (5c:48b9)
ld a, $1
call GetSRAMBank
ld a, [$be3c]
ld [ScriptVar], a ; $c2dd
call CloseSRAM
ret
Function1708c8: ; 1708c8 (5c:48c8)
call UpdateTime
ld a, $5
call GetSRAMBank
ld a, [CurDay] ; $d4cb
ld [$aa8b], a
xor a
ld [$aa8c], a
ld a, [$aa5d]
cp $2
jr nc, .asm_1708ec
ld a, [CurDay] ; $d4cb
ld [$aa48], a
ld a, $1
ld [$aa47], a
.asm_1708ec
call CloseSRAM
ret
Function1708f0: ; 1708f0 (5c:48f0)
xor a
ld [ScriptVar], a ; $c2dd
call UpdateTime
ld a, $5
call GetSRAMBank
ld a, [$aa48]
ld c, a
ld a, [$aa47]
call CloseSRAM
and a
ret z
ld hl, CurDay ; $d4cb
ld a, c
cp [hl]
jr nz, Function170923
ld a, $5
call GetSRAMBank
ld a, [$aa5d]
call CloseSRAM
cp $5
ret c
ld a, $1
ld [ScriptVar], a ; $c2dd
ret
Function170923: ; 170923
ld a, $5
call GetSRAMBank
xor a
ld [$aa48], a
ld [$aa47], a
ld hl, $aa5d
ld bc, $0011
call ByteFill
call CloseSRAM
ret
; 17093c
Function17093c: ; 17093c (5c:493c)
xor a
ld [ScriptVar], a ; $c2dd
ld a, EGG_TICKET
ld [CurItem], a ; $d106
ld hl, NumItems ; $d892 (aliases: TMsHMsEnd)
call CheckItem
ret nc
ld a, [PartyCount] ; $dcd7
ld b, 0
ld c, a
ld hl, PartySpecies ; $dcd8
.asm_170955
ld a, [hli]
cp EGG
jr nz, .asm_17099f
push hl
ld hl, PartyMonOT ; $ddff (aliases: PartyMonOT)
ld de, $6
ld a, b
and a
jr z, .asm_170969
.asm_170965
add hl, de
dec a
jr nz, .asm_170965
.asm_170969
ld de, String_1709a4
ld a, $6
.asm_17096e
push af
ld a, [de]
inc de
cp [hl]
inc hl
jr nz, .asm_17099d
pop af
dec a
jr nz, .asm_17096e
dec hl
dec hl
dec hl
dec hl
ld a, $50
ld [hli], a
ld [hli], a
pop hl
ld a, EGG_TICKET
ld [CurItem], a ; $d106
ld a, $1
ld [$d10c], a
ld a, $ff
ld [$d107], a
ld hl, NumItems ; $d892 (aliases: TMsHMsEnd)
call TossItem
ld a, $1
ld [ScriptVar], a ; $c2dd
ret
.asm_17099d
pop af
pop hl
.asm_17099f
inc b
dec c
jr nz, .asm_170955
ret
; 1709a4 (5c:49a4)
String_1709a4: ; 1709a4
db "なぞナゾ@@"
Function1709aa: ; 1709aa (5c:49aa)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $3
ld [rSVBK], a ; $ff00+$70
ld a, [$d090]
ld [ScriptVar], a ; $c2dd
pop af
ld [rSVBK], a ; $ff00+$70
ret
Function1709bb: ; 1709bb (5c:49bb)
xor a
ld [ScriptVar], a ; $c2dd
ld a, $5
call GetSRAMBank
ld a, [$a800]
call CloseSRAM
cp $6
jr nc, .asm_1709da
ld e, a
ld d, $0
ld hl, $49e7
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
.asm_1709da
ld a, $5
call GetSRAMBank
xor a
ld [$a800], a
call CloseSRAM
ret
; 1709e7 (5c:49e7)
INCBIN "baserom.gbc",$1709e7,$170a9c - $1709e7
Function170a9c: ; 170a9c (5c:4a9c)
ld c, $0
jr asm_170aa2
Function170aa0: ; 170aa0 (5c:4aa0)
ld c, $1
asm_170aa2: ; 170aa2 (5c:4aa2)
ld a, $5
call GetSRAMBank
ld a, c
ld [$aa8d], a
call CloseSRAM
ret
Function170aaf: ; 170aaf (5c:4aaf)
ld a, $5
call GetSRAMBank
ld a, [$aa8d]
ld [ScriptVar], a ; $c2dd
call CloseSRAM
ret
Function170abe: ; 170abe (5c:4abe)
call Function17089a
ld a, [ScriptVar] ; $c2dd
and a
ret z
ld a, $1
call GetSRAMBank
ld a, [$be4f]
and $1
ld [ScriptVar], a ; $c2dd
call CloseSRAM
ret
Function170ad7: ; 170ad7 (5c:4ad7)
ld a, $1
call GetSRAMBank
ld a, [$be4f]
or $1
ld [$be4f], a
call CloseSRAM
ret
Function170ae8: ; 170ae8 (5c:4ae8)
ld a, $5
call GetSRAMBank
ld a, [$b2fb]
call CloseSRAM
ld c, $a
call SimpleDivide
ld a, b
ld [$cd4f], a
xor a
ld [ScriptVar], a ; $c2dd
callba Function119d93
ret nc
ld a, $5
call GetSRAMBank
ld a, [$b2fb]
call CloseSRAM
ld [ScriptVar], a ; $c2dd
ret
Function170b16: ; 170b16 (5c:4b16)
ld a, $5
call GetSRAMBank
ld a, [$b2fb]
call CloseSRAM
ld c, 10
call SimpleDivide
ld a, b
ld [$cd4f], a
xor a
ld [ScriptVar], a ; $c2dd
callba Function119dd1
ret nc
ld a, $5
call GetSRAMBank
ld a, [$b2fb]
call CloseSRAM
ld [ScriptVar], a ; $c2dd
ret
Function170b44: ; 170b44
callba Function1f8000
ld a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ld hl, $d10a
ld a, [hl]
dec a
ld c, a
ld b, $0
pop af
ld [rSVBK], a
ld hl, $4b90
add hl, bc
ld a, [hl]
ld [$cd49], a
ld a, [ScriptVar]
dec a
sla a
ld e, a
sla a
sla a
sla a
ld c, a
ld b, $0
ld d, $0
ld hl, MapObjects
add hl, bc
inc hl
ld a, [$cd49]
ld [hl], a
ld hl, UsedSprites
add hl, de
ld [hli], a
ld [$ffbd], a
ld a, [hl]
ld [$ffbe], a
callba Function143c8
ret
; 170b90
INCBIN "baserom.gbc",$170b90,$170bd2 - $170b90
Function170bd2: ; 170bd2
ret
; 170bd3
Function170bd3: ; 170bd3
callba Function8b201
jr c, .asm_170bde
xor a
jr .asm_170be0
.asm_170bde
ld a, $1
.asm_170be0
ld [ScriptVar], a
ret
; 170be4
INCBIN "baserom.gbc",$170be4,$170c8b - $170be4
Function170c8b: ; 170c8b
ld hl, LastPlayerCounterMove
ld b, $5
.asm_170c90
ld a, [hl]
xor $ff
ld [hli], a
dec b
jr nz, .asm_170c90
ret
; 170c98
INCBIN "baserom.gbc",$170c98,$1719c8 - $170c98
Function1719c8: ; 1719c8 (5c:59c8)
ld a, [$FF00+$aa]
push af
ld a, $1
ld [$FF00+$aa], a
call Function1719d6
pop af
ld [$FF00+$aa], a
ret
Function1719d6: ; 1719d6 (5c:59d6)
callba Function1183cb
call Function1719ed
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
call Function171a11
pop af
ld [rSVBK], a ; $ff00+$70
ret
Function1719ed: ; 1719ed (5c:59ed)
xor a
ld [$cd49], a
ld [$cd4a], a
dec a
ld [$cd4b], a
call WhiteBGMap
call ClearSprites
callba Function171d2b
callba Function104061
callba Function8cf53
ret
Function171a11: ; 171a11 (5c:5a11)
call Functiona57
ld a, [$cd49]
bit 7, a
jr nz, .asm_171a2c
call Function171a36
callba Function8cf69
callba Function104061
jr Function171a11
.asm_171a2c
callba Function8cf53
call ClearSprites
ret
Function171a36: ; 171a36 (5c:5a36)
ld a, [$cd49]
ld e, a
ld d, 0
ld hl, Jumptable_171a45
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
Jumptable_171a45: ; 171a45 (5c:5a45)
dw Function171a95
dw Function171ac9
dw Function171a5d
dw Function171ad7
dw Function171a5d
dw Function171aec
dw Function171b4b
dw Function171b85
dw Function171bcc
dw Function171c2c
dw Function171c39
dw Function171c41
Function171a5d: ; 171a5d (5c:5a5d)
ld a, [$c821]
bit 1, a
jr nz, .asm_171a6a
bit 0, a
ret nz
jp Function171c66
.asm_171a6a
ld a, $0
call Function3e32
ld [$c300], a
ld a, l
ld [$c301], a
ld a, h
ld [$c302], a
ld a, $a
call Function3e32
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $1
ld [rSVBK], a ; $ff00+$70
callba Function118452
pop af
ld [rSVBK], a ; $ff00+$70
ld a, $a
ld [$cd49], a
ret
Function171a95: ; 171a95 (5c:5a95)
callba Function171ccd
hlcoord 2, 8
ld de, $5aa7
call PlaceString
jp Function171c66
; 171aa7 (5c:5aa7)
INCBIN "baserom.gbc",$171aa7,$171ac9 - $171aa7
Function171ac9: ; 171ac9 (5c:5ac9)
ld de, $cd81
ld hl, $5c
ld a, $2
call Function3e32
jp Function171c66
Function171ad7: ; 171ad7 (5c:5ad7)
xor a
ld hl, $c608
ld bc, $66
call ByteFill
ld de, $c608
ld a, $c
call Function3e32
jp Function171c66
Function171aec: ; 171aec (5c:5aec)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $1
ld [rSVBK], a ; $ff00+$70
callba Function118452
pop af
ld [rSVBK], a ; $ff00+$70
hlcoord 2, 6
ld a, $8
.asm_171b01
push af
push hl
xor a
ld bc, $10
call ByteFill
pop hl
ld de, $14
add hl, de
pop af
dec a
jr nz, .asm_171b01
hlcoord 2, 7
ld a, $3
ld de, $c608
.asm_171b1b
push af
push hl
ld a, [de]
and a
jr z, .asm_171b34
ld a, [$cd4b]
inc a
ld [$cd4b], a
push hl
call Function171b42
pop hl
ld bc, $ffec
add hl, bc
call Function171b42
.asm_171b34
pop hl
ld bc, $14
add hl, bc
add hl, bc
add hl, bc
pop af
dec a
jr nz, .asm_171b1b
jp Function171c66
Function171b42: ; 171b42 (5c:5b42)
ld a, [de]
inc de
and a
ret z
sub $20
ld [hli], a
jr Function171b42
Function171b4b: ; 171b4b (5c:5b4b)
ld de, $4010
ld a, $1d
call Function3b2a
ld hl, $c
add hl, bc
ld a, $8
ld [hl], a
ld de, $4098
ld a, $1d
call Function3b2a
ld hl, $c
add hl, bc
ld a, $9
ld [hl], a
ld de, $8a70
ld a, $1d
call Function3b2a
ld hl, $c
add hl, bc
ld a, $a
ld [hl], a
ld a, $4
ld [$cd23], a
ld a, $8
ld [$cd24], a
jp Function171c66
Function171b85: ; 171b85 (5c:5b85)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and $2
jp nz, Function171b9f
ld a, [hl]
and $1
jp nz, Function171bbd
ld a, [hl]
and $40
jr nz, asm_171ba5
ld a, [hl]
and $80
jr nz, asm_171baf
ret
Function171b9f: ; 171b9f (5c:5b9f)
ld a, $80
ld [$cd49], a
ret
asm_171ba5: ; 171ba5 (5c:5ba5)
ld a, [$cd4a]
and a
ret z
dec a
ld [$cd4a], a
ret
asm_171baf: ; 171baf (5c:5baf)
ld a, [$cd4b]
ld c, a
ld a, [$cd4a]
cp c
ret z
inc a
ld [$cd4a], a
ret
Function171bbd: ; 171bbd (5c:5bbd)
call PlayClickSFX
ld a, $8
ld [$cd23], a
xor a
ld [$cd24], a
jp Function171c66
Function171bcc: ; 171bcc (5c:5bcc)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and $2
jp nz, Function171bdc
ld a, [hl]
and $1
jp nz, Function171beb
ret
Function171bdc: ; 171bdc (5c:5bdc)
ld a, $4
ld [$cd23], a
ld a, $8
ld [$cd24], a
ld hl, $cd49
dec [hl]
ret
Function171beb: ; 171beb (5c:5beb)
ld a, $5
call GetSRAMBank
ld a, [$cd4a]
ld [$aa4a], a
call CloseSRAM
ld hl, $5c6b
call LoadMenuDataHeader
call Function1cbb
call Function1cfd
callba Function104061
hlcoord 1, 14
ld de, $5c73
call PlaceString
ld a, [$cd4a]
cp $2
jr z, .asm_171c1f
ld a, $8
jr .asm_171c21
.asm_171c1f
ld a, $c
.asm_171c21
ld [$cd24], a
ld a, $1e
ld [$cd4c], a
call Function171c66
Function171c2c: ; 171c2c (5c:5c2c)
ld hl, $cd4c
dec [hl]
ret nz
call Function1c07
call WhiteBGMap
jr asm_171c60
Function171c39: ; 171c39 (5c:5c39)
ld a, $28
ld [$cd4c], a
call Function171c66
Function171c41: ; 171c41 (5c:5c41)
ld hl, $cd4c
dec [hl]
ret nz
call WhiteBGMap
callba Function106462
callba Function106464
ld a, $2
ld [$c303], a
callba Function17f555
asm_171c60: ; 171c60 (5c:5c60)
ld a, $80
ld [$cd49], a
ret
Function171c66: ; 171c66 (5c:5c66)
ld hl, $cd49
inc [hl]
ret
; 171c6b (5c:5c6b)
INCBIN "baserom.gbc",$171c6b,$171c87 - $171c6b
Function171c87: ; 171c87 (5c:5c87)
call DisableLCD
ld hl, $5db1
ld de, $9000
ld bc, $6e0
call CopyBytes
ld hl, $6abd
ld de, $8000
call Decompress
call EnableLCD
ld hl, $6491
ld de, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
call CopyBytes
ld hl, $67ed
ld de, AttrMap ; $cdd9
ld bc, $168
call CopyBytes
hlcoord 3, 2
ld de, $6e31
call PlaceString
hlcoord 3, 16
ld de, $6e3f
call PlaceString
ret
Function171ccd: ; 171ccd (5c:5ccd)
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, $5d71
ld de, Unkn1Pals ; $d000
ld bc, $40
call CopyBytes
ld hl, MovementAnimation ; $d042
ld a, $ff
ld [hli], a
ld a, $7f
ld [hl], a
call Function32f9
pop af
ld [rSVBK], a ; $ff00+$70
ret
Function171cf0: ; 171cf0 (5c:5cf0)
xor a
hlcoord 4, 15
ld [hli], a
ld [hli], a
ld a, [$cd4b]
xor $1
ld [$cd4b], a
and a
jr nz, .asm_171d16
ld hl, $651d
decoord 0, 7
ld bc, $8c
call CopyBytes
hlcoord 3, 16
ld de, $6e3f
jp PlaceString
.asm_171d16
ld hl, $65f9
decoord 0, 7
ld bc, $8c
call CopyBytes
hlcoord 3, 16
ld de, $6e4e
jp PlaceString
Function171d2b: ; 171d2b (5c:5d2b)
call DisableLCD
ld hl, $5db1
ld de, $9000
ld bc, $6e0
call CopyBytes
ld hl, $6abd
ld de, $8000
call Decompress
call EnableLCD
ld hl, $6685
ld de, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
call CopyBytes
ld hl, $6955
ld de, AttrMap ; $cdd9
ld bc, $168
call CopyBytes
hlcoord 2, 2
ld de, $6e5d
call PlaceString
hlcoord 14, 16
ld de, $6e58
call PlaceString
ret
; 171d71 (5c:5d71)
INCBIN "baserom.gbc",$171d71,$172e78 - $171d71
Function172e78: ; 172e78 (5c:6e78)
ld a, $7f
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
call ByteFill
ld a, $7
ld hl, AttrMap ; $cdd9
ld bc, $168
call ByteFill
call DisableLCD
ld hl, $6f1f
ld de, $9000
ld bc, $610
call CopyBytes
call EnableLCD
ld hl, $73af
ld de, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $168
call CopyBytes
ld hl, $7517
ld de, AttrMap ; $cdd9
ld bc, $168
call CopyBytes
ret
; 172eb9 (5c:6eb9)
Function172eb9:
ld a, [rSVBK] ; $ff00+$70
push af
ld a, $5
ld [rSVBK], a ; $ff00+$70
ld hl, $6edf
ld de, Unkn1Pals ; $d000
ld bc, $40
call CopyBytes
ld hl, $6edf
ld de, BGPals ; $d080
ld bc, $40
call CopyBytes
call Function32f9
pop af
ld [rSVBK], a ; $ff00+$70
ret
; 172edf (5c:6edf)
INCBIN "baserom.gbc",$172edf,$17367f - $172edf
SECTION "bank5D", ROMX, BANK[$5D]
INCLUDE "text/phone/extra3.asm"
SECTION "bank5E", ROMX, BANK[$5E]
Function178000:
callba DrawPlayerHUD
ld hl, PlayerHPPal ; $cd99
call SetHPPal
callba DrawEnemyHUD
ld hl, EnemyHPPal ; $cd9a
call SetHPPal
callba Function3ee27
ret
; 17801f (5e:401f)
SECTION "bank5F", ROMX, BANK[$5F]
Function17c000: ; 17c000
call DisableLCD
ld hl, VTiles2
ld bc, $310
xor a
call ByteFill
call Functione51
call Functione5f
ld hl, HaveWantMap
ld de, TileMap
ld bc, AttrMap
ld a, SCREEN_HEIGHT
.y
push af
ld a, SCREEN_WIDTH
push hl
.x
push af
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [bc], a
inc bc
pop af
dec a
jr nz, .x
pop hl
push bc
ld bc, BG_MAP_WIDTH * 2
add hl, bc
pop bc
pop af
dec a
jr nz, .y
ld a, [rSVBK]
push af
ld a, 5 ; BANK(Unkn1Pals)
ld [rSVBK], a
ld hl, HaveWantPals
ld de, Unkn1Pals
ld bc, $80
call CopyBytes
pop af
ld [rSVBK], a
ld hl, MobileSelectGFX
ld de, $8300
ld bc, $200
call CopyBytes
ld a, 1
ld [rVBK], a
ld hl, HaveWantGFX
ld de, VTiles2
ld bc, $800
call CopyBytes
ld hl, HaveWantGFX + $800
ld de, VTiles1
ld bc, $100
call CopyBytes
xor a
ld [rVBK], a
call EnableLCD
callba Function104061
ret
; 17c083
HaveWantGFX: ; 17c083
INCBIN "gfx/mobile/havewant.2bpp"
MobileSelectGFX: ; 17c983
INCBIN "gfx/mobile/select.2bpp"
HaveWantMap: ; 17cb83
; Interleaved tile/palette map.
INCBIN "baserom.gbc", $17cb83, $17cff3 - $17cb83
HaveWantPals: ; 17cff3
; BG and OBJ palettes.
INCBIN "baserom.gbc", $17cff3, $17d073 - $17cff3
Function17d073: ; 17d073
.asm_17d073
ld a, [de]
inc de
and a
jr z, .asm_17d0ae
cp $60
jr nc, .asm_17d0ae
cp $4e
jr z, .asm_17d0ae
cp $50
jr z, .asm_17d0b1
cp $5
jr c, .asm_17d0ac
cp $14
jr c, .asm_17d0ae
cp $19
jr c, .asm_17d0ac
cp $1d
jr c, .asm_17d0ae
cp $26
jr c, .asm_17d0ac
cp $35
jr c, .asm_17d0ae
cp $3a
jr c, .asm_17d0ac
cp $3f
jr c, .asm_17d0ae
cp $40
jr c, .asm_17d0ac
cp $49
jr c, .asm_17d0ae
.asm_17d0ac
scf
ret
.asm_17d0ae
dec c
jr nz, .asm_17d073
.asm_17d0b1
and a
ret
; 17d0b3
Function17d0b3: ; 17d0b3
.asm_17d0b3
ld a, [de]
inc de
and a
jr z, .asm_17d0ee
cp $60
jr nc, .asm_17d0ee
cp $4e
jr z, .asm_17d0ee
cp $50
jr z, .asm_17d0ee
cp $5
jr c, .asm_17d0ec
cp $14
jr c, .asm_17d0ee
cp $19
jr c, .asm_17d0ec
cp $1d
jr c, .asm_17d0ee
cp $26
jr c, .asm_17d0ec
cp $35
jr c, .asm_17d0ee
cp $3a
jr c, .asm_17d0ec
cp $3f
jr c, .asm_17d0ee
cp $40
jr c, .asm_17d0ec
cp $49
jr c, .asm_17d0ee
.asm_17d0ec
scf
ret
.asm_17d0ee
dec c
jr nz, .asm_17d0b3
and a
ret
; 17d0f3
INCBIN "baserom.gbc",$17d0f3,$17d1e1 - $17d0f3
Function17d1e1: ; 17d1e1
.asm_17d1e1
ld a, [de]
inc de
cp $4e
jr nz, .asm_17d1ea
dec b
jr z, .asm_17d1ef
.asm_17d1ea
dec c
jr nz, .asm_17d1e1
and a
ret
.asm_17d1ef
scf
ret
; 17d1f1
Function17d1f1: ; 17d1f1
ld a, [CurPartySpecies]
dec a
call SetSeenAndCaughtMon
ld a, [CurPartySpecies]
cp UNOWN
jr nz, .asm_17d223
ld hl, PartyMon1DVs
ld a, [PartyCount]
dec a
ld bc, PartyMon2 - PartyMon1
call AddNTimes
predef GetUnownLetter
callab Functionfba18
ld a, [$def4]
and a
jr nz, .asm_17d223
ld a, [UnownLetter]
ld [$def4], a
.asm_17d223
ret
; 17d224
Function17d224: ; 17d224
ld a, [ScriptVar]
and a
jr nz, .asm_17d234
ld a, $4
ld [ScriptVar], a
ld hl, $526a
jr .asm_17d23c
.asm_17d234
ld a, $4
ld [ScriptVar], a
ld hl, $528f
.asm_17d23c
call LoadMenuDataHeader
call Function17d246
call Function1c17
ret
; 17d246
Function17d246: ; 17d246
call Function1d81
jr c, .asm_17d264
ld a, [ScriptVar]
cp $5
jr nz, .asm_17d25d
ld a, [$cfa9]
cp $3
ret z
jr c, .asm_17d25d
dec a
jr .asm_17d260
.asm_17d25d
ld a, [$cfa9]
.asm_17d260
ld [ScriptVar], a
ret
.asm_17d264
ld a, $4
ld [ScriptVar], a
ret
; 17d26a
INCBIN "baserom.gbc",$17d26a,$17d2b6 - $17d26a
Function17d2b6: ; 17d2b6
call Function17d2c0
callba Function1181da
ret
; 17d2c0
Function17d2c0: ; 17d2c0
xor a
ld [$cf63], a
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
ret
; 17d2ce
Function17d2ce: ; 17d2ce
ld a, $5
call GetSRAMBank
ld a, [$aa72]
call CloseSRAM
and a
jr nz, .asm_17d2e2
ld a, $1
ld [ScriptVar], a
ret
.asm_17d2e2
call Function17d314
ret c
call SpeechTextBox
call FadeToMenu
ld a, [rSVBK]
push af
ld a, $4
ld [rSVBK], a
call Function17d370
call Function17d45a
pop af
ld [rSVBK], a
ld de, MUSIC_MOBILE_CENTER
ld a, e
ld [wMapMusic], a
ld [MusicFadeIDLo], a
ld a, d
ld [MusicFadeIDHi], a
call PlayMusic
call Function222a
call Function2b3c
ret
; 17d314
Function17d314: ; 17d314
ld a, $5
call GetSRAMBank
ld a, [$b1b1]
call CloseSRAM
cp $21
jr nc, .asm_17d354
ld a, $6
call GetSRAMBank
ld l, $0
ld h, l
ld de, $a006
ld a, [$a004]
ld c, a
ld a, [$a005]
ld b, a
.asm_17d336
push bc
ld a, [de]
inc de
ld c, a
ld b, $0
add hl, bc
pop bc
dec bc
ld a, b
or c
jr nz, .asm_17d336
ld a, [$a002]
cp l
jr nz, .asm_17d354
ld a, [$a003]
cp h
jr nz, .asm_17d354
call CloseSRAM
and a
ret
.asm_17d354
call CloseSRAM
ld a, $5
call GetSRAMBank
xor a
ld hl, $aa73
ld bc, $000c
call ByteFill
call CloseSRAM
ld a, $2
ld [ScriptVar], a
scf
ret
; 17d370
Function17d370: ; 17d370
xor a
ld [$cd77], a
ld [$cd78], a
ld [$cd79], a
dec a
ld [$cd6c], a
call WhiteBGMap
call ClearSprites
call ClearScreen
callba Function104061
call DisableLCD
ld hl, $8ee0
ld de, $c608
ld bc, $0010
call CopyBytes
ld a, $1
ld [rVBK], a
ld hl, PokemonNewsGFX
ld de, VTiles1
ld bc, $0480
call CopyBytes
xor a
ld hl, $97f0
ld bc, $0010
call ByteFill
ld hl, $c608
ld de, $8ee0
ld bc, $0010
call CopyBytes
xor a
ld [rVBK], a
ld hl, $6b7e
ld de, $9600
ld bc, $0010
call CopyBytes
call EnableLCD
call Function17d60b
ld a, $0
ld [BGMapBuffer], a
ld a, $d0
ld [$cd21], a
ld a, $6
call GetSRAMBank
ld hl, $a006
ld de, Unkn1Pals
ld bc, $1000
call CopyBytes
call CloseSRAM
ret
; 17d3f6
INCBIN "baserom.gbc",$17d3f6,$17d45a - $17d3f6
Function17d45a: ; 17d45a
.asm_17d45a
call Functiona57
ld a, [$cd77]
bit 7, a
jr nz, .asm_17d46f
call Function17d474
callba Function104061
jr .asm_17d45a
.asm_17d46f
xor a
ld [ScriptVar], a
ret
; 17d474
Function17d474: ; 17d474
ld a, [$cd77]
ld e, a
ld d, $0
ld hl, $5483
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 17d483
INCBIN "baserom.gbc",$17d483,$17d60b - $17d483
Function17d60b: ; 17d60b
ld a, $5
call GetSRAMBank
ld hl, $b1d3
ld de, $c608
ld bc, $0020
call CopyBytes
ld a, [$b1b1]
ld c, a
ld a, [$b1b2]
ld b, a
ld a, [$b1b3]
ld l, a
ld a, [$b1b4]
ld h, a
call CloseSRAM
ld a, $6
call GetSRAMBank
ld de, $c708
ld a, c
and a
jr z, .asm_17d684
.asm_17d63b
push bc
ld a, l
ld [de], a
inc de
ld a, h
ld [de], a
inc de
ld bc, $000a
add hl, bc
pop bc
ld a, [hli]
ld [$cd4a], a
ld a, [hli]
ld [$cd49], a
push hl
push de
ld hl, $c608
ld e, b
ld d, $0
add hl, de
ld a, [hli]
ld [$cd4b], a
ld a, [hl]
ld [$cd4c], a
pop de
pop hl
inc b
inc b
dec c
dec c
jr z, .asm_17d684
push bc
push de
ld a, [$cd49]
ld c, a
ld a, [$cd4a]
ld b, a
ld a, [$cd4b]
ld e, a
ld a, [$cd4c]
ld d, a
.asm_17d67a
add hl, de
dec bc
ld a, c
or b
jr nz, .asm_17d67a
pop de
pop bc
jr .asm_17d63b
.asm_17d684
call CloseSRAM
ld a, $5
call GetSRAMBank
ld hl, $c708
ld de, $b1b3
ld a, [$b1b1]
ld c, a
ld a, [$b1b2]
ld b, a
call CopyBytes
call CloseSRAM
ret
; 17d6a1
INCBIN "baserom.gbc", $17d6a1, $17e6fe - $17d6a1
PokemonNewsGFX: ; 17e6fe
INCBIN "gfx/mobile/pokemon_news.2bpp"
INCBIN "baserom.gbc", $17eb7e, $17f036 - $17eb7e
Function17f036:: ; 17f036
ld a, $6
call GetSRAMBank
inc de
.asm_17f03c
call Function17f047
jr c, .asm_17f043
jr .asm_17f03c
.asm_17f043
call CloseSRAM
ret
; 17f047
Function17f047: ; 17f047
ld a, [de]
inc de
cp $50
jr z, .asm_17f05f
cp $10
jr nc, .asm_17f05f
dec a
push de
ld e, a
ld d, 0
ld hl, Table17f061
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
.asm_17f05f
scf
ret
; 17f061
Table17f061: ; 17f061
dw Function17f081
dw Function17f0f8
dw Function17f154
dw Function17f181
dw Function17f1d0
dw Function17f220
dw Function17f27b
dw Function17f2cb
dw Function17f2ff
dw Function17f334
dw Function17f382
dw Function17f3c9
dw Function17f3f0
dw Function17f41d
dw Function17f44f
dw Function17f44f
; 17f081
Function17f081: ; 17f081
pop hl
call Function17f524
jr c, .asm_17f09f
ld de, $0004
add hl, de
ld a, [hli]
inc hl
inc hl
ld e, l
ld d, h
ld l, c
ld h, b
ld c, a
ld b, $0
add hl, bc
ld a, [de]
cp $50
jr z, .asm_17f09d
and a
ret
.asm_17f09d
scf
ret
.asm_17f09f
push bc
ld de, $cd54
ld bc, $0007
call CopyBytes
pop bc
push hl
push bc
call Function17f4f6
pop bc
ld a, [$cd54]
ld e, a
ld a, [$cd55]
ld d, a
add hl, de
ld e, l
ld d, h
ld l, c
ld h, b
push hl
ld a, [$cd56]
ld b, a
ld a, [$cd57]
ld c, a
call Function31a4
ld a, l
ld [$cd52], a
ld a, h
ld [$cd53], a
ld a, [$cd59]
and a
jr z, .asm_17f0ee
ld c, a
ld a, [$cd57]
inc a
ld b, a
ld e, l
ld d, h
dec de
.asm_17f0e0
ld a, c
cp b
jr z, .asm_17f0ea
ld a, [de]
dec de
ld [hld], a
dec b
jr .asm_17f0e0
.asm_17f0ea
ld a, [$cd5a]
ld [hl], a
.asm_17f0ee
pop hl
ld a, [$cd58]
call Function17f50f
pop de
and a
ret
; 17f0f8
Function17f0f8: ; 17f0f8
pop hl
call Function17f524
jr c, .asm_17f114
ld de, $0003
add hl, de
ld a, [hli]
ld e, l
ld d, h
ld l, c
ld h, b
ld c, a
ld b, $0
add hl, bc
ld a, [de]
cp $50
jr z, .asm_17f112
and a
ret
.asm_17f112
scf
ret
.asm_17f114
push bc
ld de, $cd54
ld bc, $0004
call CopyBytes
pop bc
push hl
push bc
call Function17f4f6
ld a, [$cd54]
ld e, a
ld a, [$cd55]
ld d, a
add hl, de
ld de, $c608
ld a, [$cd56]
ld c, a
ld b, $0
call CopyBytes
ld a, $50
ld [de], a
pop hl
ld de, $c608
call PlaceString
ld a, c
ld [$cd52], a
ld a, b
ld [$cd53], a
ld a, [$cd57]
call Function17f50f
pop de
and a
ret
; 17f154
Function17f154: ; 17f154
pop hl
call Function17f524
jr c, .asm_17f167
inc hl
inc hl
ld e, l
ld d, h
ld a, [de]
cp $50
jr z, .asm_17f165
and a
ret
.asm_17f165
scf
ret
.asm_17f167
push bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
pop bc
push hl
push bc
call Function17f4f6
add hl, de
ld c, l
ld b, h
pop de
callba Function11c08f
ld c, l
ld b, h
pop de
and a
ret
; 17f181
Function17f181: ; 17f181
pop hl
call Function17f524
jr c, .asm_17f19d
ld de, $0002
add hl, de
ld a, [hli]
ld e, l
ld d, h
ld l, c
ld h, b
ld c, a
ld b, $0
add hl, bc
ld a, [de]
cp $50
jr z, .asm_17f19b
and a
ret
.asm_17f19b
scf
ret
.asm_17f19d
push bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld [$cd54], a
pop bc
push hl
push bc
call Function17f4f6
add hl, de
ld a, [hl]
ld c, a
ld de, $c608
callba Function48c63
pop hl
ld de, $c608
call PlaceString
ld a, c
ld [$cd52], a
ld a, b
ld [$cd53], a
ld a, [$cd54]
call Function17f50f
pop de
and a
ret
; 17f1d0
Function17f1d0: ; 17f1d0
pop hl
call Function17f524
jr c, .asm_17f1ec
ld de, $0002
add hl, de
ld a, [hli]
ld e, l
ld d, h
ld l, c
ld h, b
ld c, a
ld b, $0
add hl, bc
ld a, [de]
cp $50
jr z, .asm_17f1ea
and a
ret
.asm_17f1ea
scf
ret
.asm_17f1ec
push bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld [$cd54], a
pop bc
push hl
push bc
call Function17f4f6
add hl, de
ld a, [hl]
ld a, $1
ld [rSVBK], a
ld [$d265], a
call GetPokemonName
pop hl
call PlaceString
ld a, c
ld [$cd52], a
ld a, b
ld [$cd53], a
ld a, $4
ld [rSVBK], a
ld a, [$cd54]
call Function17f50f
pop de
and a
ret
; 17f220
Function17f220: ; 17f220
pop hl
call Function17f524
jr c, .asm_17f23c
ld de, $0002
add hl, de
ld a, [hli]
ld e, l
ld d, h
ld l, c
ld h, b
ld c, a
ld b, $0
add hl, bc
ld a, [de]
cp $50
jr z, .asm_17f23a
and a
ret
.asm_17f23a
scf
ret
.asm_17f23c
push bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld [$cd54], a
pop bc
push hl
push bc
call Function17f4f6
add hl, de
ld a, [hl]
ld e, a
ld d, 0
ld hl, .Genders
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
pop hl
call PlaceString
ld a, c
ld [$cd52], a
ld a, b
ld [$cd53], a
ld a, [$cd54]
call Function17f50f
pop de
and a
ret
; 17f26e
.Genders: dw .Boy, .Girl
.Boy: db "Boy@"
.Girl: db "Girl@"
Function17f27b: ; 17f27b
pop hl
call Function17f524
jr c, .asm_17f297
ld de, $0002
add hl, de
ld a, [hli]
ld e, l
ld d, h
ld l, c
ld h, b
ld c, a
ld b, $0
add hl, bc
ld a, [de]
cp $50
jr z, .asm_17f295
and a
ret
.asm_17f295
scf
ret
.asm_17f297
push bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld [$cd54], a
pop bc
push hl
push bc
call Function17f4f6
add hl, de
ld a, [hl]
ld a, $1
ld [rSVBK], a
ld [$d265], a
call GetItemName
pop hl
call PlaceString
ld a, c
ld [$cd52], a
ld a, b
ld [$cd53], a
ld a, $4
ld [rSVBK], a
ld a, [$cd54]
call Function17f50f
pop de
and a
ret
; 17f2cb
Function17f2cb: ; 17f2cb
pop hl
push bc
ld a, [hli]
ld [$cd54], a
ld a, [hli]
ld [$cd55], a
ld a, [$cd2e]
inc a
ld [$cd56], a
pop bc
push hl
ld l, c
ld h, b
push hl
ld de, $cd56
ld b, $1
ld a, [$cd54]
ld c, a
call Function31a4
ld a, l
ld [$cd52], a
ld a, h
ld [$cd53], a
pop hl
ld a, [$cd55]
call Function17f50f
pop de
and a
ret
; 17f2ff
Function17f2ff: ; 17f2ff
pop hl
push bc
ld a, [hli]
ld [$cd54], a
pop bc
push hl
push bc
ld a, $1
ld [rSVBK], a
ld hl, PlayerName
ld de, $c608
ld bc, $0006
call CopyBytes
ld a, $4
ld [rSVBK], a
pop hl
ld de, $c608
call PlaceString
ld a, c
ld [$cd52], a
ld a, b
ld [$cd53], a
ld a, [$cd54]
call Function17f50f
pop de
and a
ret
; 17f334
Function17f334: ; 17f334
pop hl
push bc
ld a, [hli]
ld [$cd55], a
and $f
ld [$cd54], a
pop bc
push hl
ld l, c
ld h, b
push hl
ld a, [$cd55]
bit 7, a
jr nz, .asm_17f355
ld a, $1
call GetSRAMBank
ld a, [$be3f]
jr .asm_17f35d
.asm_17f355
ld a, $5
call GetSRAMBank
ld a, [$b2f3]
.asm_17f35d
ld c, a
call CloseSRAM
ld de, $c608
callba Function48c63
pop hl
ld de, $c608
call PlaceString
ld a, c
ld [$cd52], a
ld a, b
ld [$cd53], a
ld a, [$cd54]
call Function17f50f
pop de
and a
ret
; 17f382
Function17f382: ; 17f382
pop hl
push bc
ld a, [hli]
ld [$cd55], a
and $f
ld [$cd54], a
pop bc
push hl
push bc
ld l, c
ld h, b
ld a, [$cd55]
bit 7, a
jr nz, .asm_17f3a3
ld a, $1
call GetSRAMBank
ld de, $be40
jr .asm_17f3ab
.asm_17f3a3
ld a, $5
call GetSRAMBank
ld de, $b2f4
.asm_17f3ab
ld a, $82
ld b, a
ld a, $3
ld c, a
call PrintNum
call CloseSRAM
ld a, l
ld [$cd52], a
ld a, h
ld [$cd53], a
pop hl
ld a, [$cd54]
call Function17f50f
pop de
and a
ret
; 17f3c9
Function17f3c9: ; 17f3c9
push bc
ld hl, $cd36
ld de, $c708
ld bc, $000c
call CopyBytes
pop de
ld c, $0
callba Function11c075
push hl
ld hl, $c708
ld de, $cd36
ld bc, $000c
call CopyBytes
pop bc
pop de
and a
ret
; 17f3f0
Function17f3f0: ; 17f3f0
pop hl
push hl
ld a, [hli]
push af
push bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [de]
ld c, a
ld b, $0
add hl, bc
add hl, bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld hl, Unkn1Pals
add hl, de
ld e, l
ld d, h
pop hl
call PlaceString
pop af
ld e, a
ld d, $0
pop hl
add hl, de
add hl, de
inc hl
inc hl
inc hl
ld e, l
ld d, h
ld l, c
ld h, b
scf
ret
; 17f41d
Function17f41d: ; 17f41d
pop hl
ld a, [hli]
push hl
push af
ld l, c
ld h, b
ld bc, -TileMap + $10000
add hl, bc
ld de, -SCREEN_WIDTH
ld c, $1
.asm_17f42c
ld a, h
and a
jr nz, .asm_17f435
ld a, l
cp SCREEN_WIDTH
jr c, .asm_17f439
.asm_17f435
add hl, de
inc c
jr .asm_17f42c
.asm_17f439
ld hl, TileMap
ld de, SCREEN_WIDTH
ld a, c
.asm_17f440
and a
jr z, .asm_17f447
add hl, de
dec a
jr .asm_17f440
.asm_17f447
pop af
ld e, a
ld d, 0
add hl, de
pop de
and a
ret
; 17f44f
Function17f44f: ; 17f44f
pop hl
call Function17f524
jr c, .asm_17f46d
ld de, $0005
add hl, de
ld a, [hli]
inc hl
inc hl
ld e, l
ld d, h
ld l, c
ld h, b
ld c, a
ld b, 0
add hl, bc
ld a, [de]
cp $50
jr z, .asm_17f46b
and a
ret
.asm_17f46b
scf
ret
.asm_17f46d
push bc
ld de, $cd54
ld bc, $0008
call CopyBytes
pop bc
push hl
push bc
ld a, [$cd56]
cp $c0
jr c, .asm_17f488
ld a, [$cd54]
ld [rSVBK], a
jr .asm_17f48e
.asm_17f488
ld a, [$cd54]
call GetSRAMBank
.asm_17f48e
ld a, [$cd55]
ld l, a
ld a, [$cd56]
ld h, a
ld de, $c608
ld a, [$cd57]
ld c, a
ld b, $0
call CopyBytes
ld a, [$cd56]
cp $c0
jr c, .asm_17f4af
ld a, $4
ld [rSVBK], a
jr .asm_17f4b7
.asm_17f4af
call CloseSRAM
ld a, $6
call GetSRAMBank
.asm_17f4b7
ld de, $c608
pop hl
push hl
ld a, [$cd57]
ld b, a
ld a, [$cd58]
ld c, a
call Function31a4
ld a, l
ld [$cd52], a
ld a, h
ld [$cd53], a
ld a, [$cd5a]
and a
jr z, .asm_17f4ec
ld c, a
ld a, [$cd58]
inc a
ld b, a
ld e, l
ld d, h
dec de
.asm_17f4de
ld a, c
cp b
jr z, .asm_17f4e8
ld a, [de]
dec de
ld [hld], a
dec b
jr .asm_17f4de
.asm_17f4e8
ld a, [$cd5b]
ld [hl], a
.asm_17f4ec
pop hl
ld a, [$cd59]
call Function17f50f
pop de
and a
ret
; 17f4f6
Function17f4f6: ; 17f4f6
ld a, [$cd6a]
ld l, a
ld a, [$cd6b]
ld h, a
ld a, [$cd47]
ld c, a
ld a, [BGMapPalBuffer]
ld b, a
ld a, [$cd2e]
.asm_17f509
and a
ret z
dec a
add hl, bc
jr .asm_17f509
; 17f50f
Function17f50f: ; 17f50f
and a
jr z, .asm_17f519
ld c, a
ld b, $0
add hl, bc
ld c, l
ld b, h
ret
.asm_17f519
ld a, [$cd52]
ld c, a
ld l, a
ld a, [$cd53]
ld b, a
ld h, a
ret
; 17f524
Function17f524: ; 17f524
push hl
push bc
push de
ld a, [$cd42]
dec a
ld b, a
ld a, [$cd2e]
cp b
jr z, .asm_17f53a
ld hl, $cd68
cp [hl]
.asm_17f536
pop de
pop bc
pop hl
ret
.asm_17f53a
scf
jr .asm_17f536
; 17f53d
Function17f53d: ; 17f53d
call FadeToMenu
xor a
ld [$c303], a
ld a, [rSVBK]
push af
ld a, $1
ld [rSVBK], a
call Function17f555
pop af
ld [rSVBK], a
call Function2b4d
ret
; 17f555
Function17f555: ; 17f555
.asm_17f555
call Functiona57
call Function17f5ae
ld a, [$c303]
bit 7, a
jr nz, .asm_17f56a
callba Function104000
jr .asm_17f555
.asm_17f56a
call Function17f56e
ret
; 17f56e
Function17f56e: ; 17f56e
ld a, [$c300]
cp $22
jr z, .asm_17f597
cp $31
jr z, .asm_17f58a
cp $33
ret nz
ld a, [$c301]
cp $1
ret nz
ld a, [$c302]
cp $2
ret nz
jr .asm_17f5a1
.asm_17f58a
ld a, [$c301]
cp $3
ret nz
ld a, [$c302]
and a
ret nz
jr .asm_17f5a1
.asm_17f597
ld a, [$c301]
and a
ret nz
ld a, [$c302]
and a
ret nz
.asm_17f5a1
ld a, $5
call GetSRAMBank
xor a
ld [$aa4b], a
call CloseSRAM
ret
; 17f5ae
Function17f5ae: ; 17f5ae
ld a, [$c303]
ld e, a
ld d, 0
ld hl, Table17f5bd
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 17f5bd
Table17f5bd: ; 17f5bd
dw Function17f5c3
dw Function17ff23
dw Function17f5d2
; 17f5c3
Function17f5c3: ; 17f5c3
call Function17f5e4
callba Function2b5c
ld a, $1
ld [$c303], a
ret
; 17f5d2
Function17f5d2: ; 17f5d2
call Function17f5e4
callba Function104000
call Function32f9
ld a, $1
ld [$c303], a
ret
; 17f5e4
Function17f5e4: ; 17f5e4
ld a, $8
ld [MusicFade], a
ld de, MUSIC_NONE
ld a, e
ld [MusicFadeIDLo], a
ld a, d
ld [MusicFadeIDHi], a
ld a, " "
ld hl, TileMap
ld bc, $0168
call ByteFill
ld a, $6
ld hl, AttrMap
ld bc, $0168
call ByteFill
hlcoord 2, 1
ld b, $1
ld c, $e
call Function3eea
hlcoord 1, 4
ld b, $c
ld c, $10
call Function3eea
hlcoord 3, 2
ld de, String_17f6dc
call PlaceString
call Function17ff3c
jr nc, .asm_17f632
hlcoord 11, 2
call Function17f6b7
.asm_17f632
ld a, [$c300]
cp $d0
jr nc, .asm_17f684
cp $10
jr c, .asm_17f679
sub $10
cp $24
jr nc, .asm_17f679
ld e, a
ld d, $0
ld hl, Table_17f706
add hl, de
add hl, de
ld a, [$c301]
ld e, a
ld a, [$c302]
ld d, a
ld a, [hli]
ld c, a
ld a, [hl]
ld h, a
ld l, c
ld a, [hli]
and a
jr z, .asm_17f679
ld c, a
.asm_17f65d
ld a, [hli]
ld b, a
ld a, [hli]
cp $ff
jr nz, .asm_17f667
cp b
jr z, .asm_17f66e
.asm_17f667
xor d
jr nz, .asm_17f674
ld a, b
xor e
jr nz, .asm_17f674
.asm_17f66e
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
jr .asm_17f67d
.asm_17f674
inc hl
inc hl
dec c
jr nz, .asm_17f65d
.asm_17f679
ld a, $d9
jr .asm_17f684
.asm_17f67d
hlcoord 2, 6
call PlaceString
ret
.asm_17f684
sub $d0
ld e, a
ld d, 0
ld hl, Table_17f699
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld a, [hl]
ld d, a
hlcoord 2, 6
call PlaceString
ret
; 17f699
Table_17f699: ; 17f699
dw String_17fedf
dw String_17fdd9
dw String_17fdd9
dw String_17fe03
dw String_17fd84
dw String_17fe63
dw String_17fdb2
dw String_17fe4b
dw String_17fe03
dw String_17fe03
dw String_17fe03
; 17f6af
Palette_17f6af: ; 17f6af
RGB 5, 5, 16
RGB 8, 19, 28
RGB 0, 0, 0
RGB 31, 31, 31
; 17f6b7
Function17f6b7: ; 17f6b7
ld a, [$c300]
call Function17f6cd
inc hl
ld a, [$c302]
and $f
call Function17f6d8
ld a, [$c301]
call Function17f6cd
ret
; 17f6cd
Function17f6cd: ; 17f6cd
ld c, a
and $f0
swap a
call Function17f6d8
ld a, c
and $f
Function17f6d8: ; 17f6d8
add $f6
ld [hli], a
ret
; 17f6dc
String_17f6dc: ; 17f6dc
db "つうしんエラー ー@"
; 17f6e8
String_17f6e8: ; 17f6e8
db "みていぎ", $25, "エラーです"
next "プログラム", $1f
next "かくにん してください"
db "@"
; 17f706
Table_17f706:
dw Unknown_17f74e
dw Unknown_17f753
dw Unknown_17f758
dw Unknown_17f75d
dw Unknown_17f762
dw Unknown_17f767
dw Unknown_17f778
dw Unknown_17f77d
dw Unknown_17f782
dw Unknown_17f782
dw Unknown_17f782
dw Unknown_17f782
dw Unknown_17f782
dw Unknown_17f782
dw Unknown_17f782
dw Unknown_17f782
dw Unknown_17f782
dw Unknown_17f787
dw Unknown_17f78c
dw Unknown_17f791
dw Unknown_17f796
dw Unknown_17f79b
dw Unknown_17f7a0
dw Unknown_17f7a5
dw Unknown_17f7a5
dw Unknown_17f7a5
dw Unknown_17f7a5
dw Unknown_17f7a5
dw Unknown_17f7a5
dw Unknown_17f7a5
dw Unknown_17f7a5
dw Unknown_17f7a5
dw Unknown_17f7a5
dw Unknown_17f7ea
dw Unknown_17f7ff
dw Unknown_17f844
Unknown_17f74e: db 1
dbbw $0, $0, String_17f891
Unknown_17f753: db 1
dbbw $0, $0, String_17f8d1
Unknown_17f758: db 1
dbbw $0, $0, String_17f913
Unknown_17f75d: db 1
dbbw $0, $0, String_17f8d1
Unknown_17f762: db 1
dbbw $0, $0, String_17fa71
Unknown_17f767: db 4
dbbw $0, $0, String_17f946
dbbw $1, $0, String_17f946
dbbw $2, $0, String_17f946
dbbw $3, $0, String_17f946
Unknown_17f778: db 1
dbbw $0, $0, String_17f98e
Unknown_17f77d: db 1
dbbw $0, $0, String_17f98e
Unknown_17f782: db 1
dbbw $0, $0, String_17f98e
Unknown_17f787: db 1
dbbw $0, $0, String_17f98e
Unknown_17f78c: db 1
dbbw $0, $0, String_17f9d0
Unknown_17f791: db 1
dbbw $0, $0, String_17fa14
Unknown_17f796: db 1
dbbw $0, $0, String_17fcbf
Unknown_17f79b: db 1
dbbw $0, $0, String_17fa71
Unknown_17f7a0: db 1
dbbw $0, $0, String_17fbfe
Unknown_17f7a5: db 17
dbbw $0, $0, String_17f98e
dbbw $21, $2, String_17fcbf
dbbw $21, $4, String_17fcbf
dbbw $50, $4, String_17faf9
dbbw $51, $4, String_17fcbf
dbbw $52, $4, String_17fcbf
dbbw $0, $5, String_17f98e
dbbw $1, $5, String_17f98e
dbbw $2, $5, String_17f98e
dbbw $3, $5, String_17f98e
dbbw $4, $5, String_17f98e
dbbw $50, $5, String_17faf9
dbbw $51, $5, String_17faf9
dbbw $52, $5, String_17fcbf
dbbw $53, $5, String_17faf9
dbbw $54, $5, String_17fcbf
dbbw $ff, $ff, String_17fcbf
Unknown_17f7ea: db 5
dbbw $0, $0, String_17f98e
dbbw $2, $0, String_17fb2a
dbbw $3, $0, String_17fb6e
dbbw $4, $0, String_17f98e
dbbw $ff, $ff, String_17fcbf
Unknown_17f7ff: db 17
dbbw $0, $0, String_17f98e
dbbw $1, $3, String_17f98e
dbbw $2, $3, String_17f98e
dbbw $0, $4, String_17f98e
dbbw $1, $4, String_17f98e
dbbw $3, $4, String_17fbb6
dbbw $4, $4, String_17fbb6
dbbw $5, $4, String_17f98e
dbbw $6, $4, String_17f98e
dbbw $7, $4, String_17f98e
dbbw $8, $4, String_17fbfe
dbbw $0, $5, String_17fa49
dbbw $1, $5, String_17f98e
dbbw $2, $5, String_17fa49
dbbw $3, $5, String_17fab0
dbbw $4, $5, String_17fa49
dbbw $ff, $ff, String_17fa49
Unknown_17f844: db 19
dbbw $1, $1, String_17fc3e
dbbw $2, $1, String_17fc88
dbbw $3, $1, String_17fcff
dbbw $4, $1, String_17fd84
dbbw $5, $1, String_17fd84
dbbw $6, $1, String_17fd47
dbbw $1, $2, String_17fb6e
dbbw $2, $2, String_17f98e
dbbw $3, $2, String_17fd84
dbbw $4, $2, String_17f98e
dbbw $5, $2, String_17fa49
dbbw $6, $2, String_17fd84
dbbw $99, $2, String_17fc88
dbbw $1, $3, String_17fa49
dbbw $1, $4, String_17fa49
dbbw $2, $4, String_17fa49
dbbw $3, $4, String_17fa49
dbbw $4, $4, String_17fa49
dbbw $ff, $ff, String_17fa49
String_17f891: ; 17f891
db "モバイルアダプタが ただしく"
next "さしこまれていません"
next "とりあつかいせつめいしょを"
next "ごらんのうえ しっかりと"
next "さしこんで ください"
db "@"
String_17f8d1: ; 17f8d1
db "でんわが うまく かけられないか"
next "でんわかいせんが こんでいるので"
next "つうしん できません"
next "しばらく まって"
next "かけなおして ください"
db "@"
String_17f913: ; 17f913
db "でんわかいせんが こんでいるため"
next "でんわが かけられません"
next "しばらく まって"
next "かけなおして ください"
db "@"
String_17f946: ; 17f946
db "モバイルアダプタの エラーです"
next "しばらく まって"
next "かけなおして ください"
next "なおらない ときは"
next "モバイルサポートセンターへ"
next "おといあわせください"
db "@"
String_17f98e: ; 17f98e
db "つうしんエラーです"
next "しばらく まって"
next "かけなおして ください"
next "なおらない ときは"
next "モバイルサポートセンターへ"
next "おといあわせください"
db "@"
String_17f9d0: ; 17f9d0
db "ログインパスワードか"
next "ログイン アイディーに"
next "まちがいがあります"
next "パスワードを かくにんして"
next "しばらく まって"
next "かけなおして ください"
db "@"
String_17fa14: ; 17fa14
db "でんわが きれました"
next "とりあつかいせつめいしょを"
next "ごらんのうえ"
next "しばらく まって"
next "かけなおして ください"
db "@"
String_17fa49: ; 17fa49
db "モバイルセンターの"
next "つうしんエラーです"
next "しばらくまって"
next "かけなおして ください"
db "@"
String_17fa71: ; 17fa71
db "モバイルアダプタに"
next "とうろくされた じょうほうが"
next "ただしく ありません"
next "モバイルトレーナーで"
next "しょきとうろくを してください"
db "@"
String_17fab0: ; 17fab0
db "モバイルセンターが"
next "こんでいて つながりません"
next "しばらくまって"
next "かけなおして ください"
next "くわしくは とりあつかい"
next "せつめいしょを ごらんください"
db "@"
String_17faf9: ; 17faf9
db "あてさき メールアドレスに"
next "まちがいがあります"
next "ただしい メールアドレスを"
next "いれなおしてください"
db "@"
String_17fb2a: ; 17fb2a
db "メールアドレスに"
next "まちがいが あります"
next "とりあつかいせつめいしょを"
next "ごらんのうえ"
next "モバイルトレーナーで"
next "しょきとうろくを してください"
db "@"
String_17fb6e: ; 17fb6e
db "ログインパスワードに"
next "まちがいが あるか"
next "モバイルセンターの エラーです"
next "パスワードを かくにんして"
next "しばらく まって"
next "かけなおして ください"
db "@"
String_17fbb6: ; 17fbb6
db "データの よみこみが できません"
next "しばらくまって"
next "かけなおして ください"
next "なおらない ときは"
next "モバイルサポートセンターへ"
next "おといあわせください"
db "@"
String_17fbfe: ; 17fbfe
db "じかんぎれです"
next "でんわが きれました"
next "でんわを かけなおしてください"
next "くわしくは とりあつかい"
next "せつめいしょを ごらんください"
db "@"
String_17fc3e: ; 17fc3e
db "ごりよう りょうきんの "
next "おしはらいが おくれたばあいには"
next "ごりようが できなくなります"
next "くわしくは とりあつかい"
next "せつめいしょを ごらんください"
db "@"
String_17fc88: ; 17fc88
db "おきゃくさまの ごつごうにより"
next "ごりようできません"
next "くわしくは とりあつかい"
next "せつめいしょを ごらんください"
db "@"
String_17fcbf: ; 17fcbf
db "でんわかいせんが こんでいるか"
next "モバイルセンターの エラーで"
next "つうしんが できません"
next "しばらく まって"
next "かけなおして ください"
db "@"
String_17fcff: ; 17fcff
db "ごりよう りょうきんが"
next "じょうげんを こえているため"
next "こんげつは ごりようできません"
next "くわしくは とりあつかい"
next "せつめいしょを ごらんください"
db "@"
String_17fd47: ; 17fd47
db "げんざい モバイルセンターの"
next "てんけんを しているので"
next "つうしんが できません"
next "しばらく まって"
next "かけなおして ください"
db "@"
String_17fd84: ; 17fd84
db "データの よみこみが できません"
next "くわしくは とりあつかい"
next "せつめいしょを ごらんください"
db "@"
String_17fdb2: ; 17fdb2
db "3ぷん いじょう なにも"
next "にゅうりょく しなかったので"
next "でんわが きれました"
db "@"
String_17fdd9: ; 17fdd9
db "つうしんが うまく"
next "できませんでした"
next "もういちど はじめから"
next "やりなおしてください"
db "@"
String_17fe03: ; 17fe03
db "データの よみこみが できません"
next "しばらくまって"
next "かけなおして ください"
next "なおらない ときは"
next "モバイルサポートセンターへ"
next "おといあわせください"
db "@"
String_17fe4b: ; 17fe4b
db "まちじかんが ながいので"
next "でんわが きれました"
db "@"
String_17fe63: ; 17fe63
db "あいての モバイルアダプタと"
next "タイプが ちがいます"
next "くわしくは とりあつかい"
next "せつめいしょを ごらんください"
db "@"
String_17fe9a: ; 17fe9a ; unreferenced
db "ポケモンニュースが"
next "あたらしくなっているので"
next "レポートを おくれません"
next "あたらしい ポケモンニュースの"
next "よみこみを さきに してください"
db "@"
String_17fedf: ; 17fedf
db "つうしんの じょうきょうが"
next "よくないか かけるあいてが"
next "まちがっています"
next "もういちど かくにんをして"
next "でんわを かけなおして ください"
db "@"
; 17ff23
Function17ff23: ; 17ff23
ld a, [hJoyPressed]
and a
ret z
ld a, $8
ld [MusicFade], a
ld a, [wMapMusic]
ld [MusicFadeIDLo], a
xor a
ld [MusicFadeIDHi], a
ld hl, $c303
set 7, [hl]
ret
; 17ff3c
Function17ff3c: ; 17ff3c
nop
ld a, [$c300]
cp $d0
ret c
hlcoord 10, 2
ld de, String_17ff68
call PlaceString
ld a, [$c300]
push af
sub $d0
inc a
ld [$c300], a
hlcoord 14, 2
ld de, $c300
ld bc, $8103
call PrintNum
pop af
ld [$c300], a
and a
ret
; 17ff68
String_17ff68: ; 17ff68
db "101@"
; 17ff6c
SECTION "Common Text 1", ROMX, BANK[$6C]
INCLUDE "text/common.asm"
SECTION "bank6D", ROMX, BANK[$6D]
INCLUDE "text/phone/mom.asm"
INCLUDE "text/phone/bill.asm"
INCLUDE "text/phone/elm.asm"
INCLUDE "text/phone/trainers1.asm"
SECTION "Common Text 2", ROMX, BANK[$6F]
INCLUDE "text/common_2.asm"
SECTION "Common Text 3", ROMX, BANK[$70]
INCLUDE "text/common_3.asm"
SECTION "Common Text 4", ROMX, BANK[$71]
INCLUDE "text/common_4.asm"
SECTION "bank72", ROMX, BANK[$72]
; Item names & descriptions
ItemNames::
INCLUDE "items/item_names.asm"
INCLUDE "items/item_descriptions.asm"
MoveNames::
INCLUDE "battle/move_names.asm"
INCLUDE "engine/landmarks.asm"
SECTION "bank75", ROMX, BANK[$75]
SECTION "bank76", ROMX, BANK[$76]
SECTION "bank77", ROMX, BANK[$77]
UnownFont: ; 1dc000
INCBIN "gfx/misc/unown_font.2bpp"
; 1dc1b0
Function1dc1b0: ; 1dc1b0
ld hl, TileMap
ld de, $ca90
ld bc, $0154
call CopyBytes
ld hl, $cab5
ld a, $62
ld [hli], a
inc a
ld [hl], a
ld hl, $cac9
ld a, $64
ld [hli], a
inc a
ld [hl], a
ld hl, $cb45
ld a, $7f
ld [hli], a
ld [hl], a
ld hl, $cb59
ld a, $61
ld [hli], a
ld [hl], a
ld hl, $cb6e
ld bc, $0512
call ClearBox
ld a, [$d265]
dec a
call CheckCaughtMon
push af
ld a, [$d265]
ld b, a
ld c, $1
callba Function44355
pop af
ld a, b
ld hl, $cb6d
call nz, FarString
ld hl, $caa3
ld [hl], $35
ld de, $0014
add hl, de
ld b, $f
.asm_1dc20a
ld [hl], $37
add hl, de
dec b
jr nz, .asm_1dc20a
ld [hl], $3a
ret
; 1dc213
Function1dc213: ; 1dc213
ld hl, $ca90
ld bc, $00a0
ld a, $7f
call ByteFill
ld hl, $ca90
ld a, $36
ld b, $6
call Function1dc26a
ld hl, $caa3
ld a, $37
ld b, $6
call Function1dc26a
ld hl, $cb08
ld [hl], $38
inc hl
ld a, $39
ld bc, $0012
call ByteFill
ld [hl], $3a
ld hl, $cb1c
ld bc, $0014
ld a, $32
call ByteFill
ld a, [$d265]
dec a
call CheckCaughtMon
push af
ld a, [$d265]
ld b, a
ld c, $2
callba Function44355
pop af
ld hl, $caa5
ld a, b
call nz, FarString
ret
; 1dc26a
Function1dc26a: ; 1dc26a
push de
ld de, $0014
.asm_1dc26e
ld [hl], a
add hl, de
dec b
jr nz, .asm_1dc26e
pop de
ret
; 1dc275
GBPrinterStrings:
String_1dc275: db "@"
String_1dc276: next " CHECKING LINK...@"
String_1dc289: next " TRANSMITTING...@"
String_1dc29c: next " PRINTING...@"
String_1dc2ad:
db " Printer Error 1"
db $4e
next "Check the Game Boy"
next "Printer Manual.@"
String_1dc2e2:
db " Printer Error 2"
db $4e
next "Check the Game Boy"
next "Printer Manual.@"
String_1dc317:
db " Printer Error 3"
db $4e
next "Check the Game Boy"
next "Printer Manual.@"
String_1dc34c:
db " Printer Error 4"
db $4e
next "Check the Game Boy"
next "Printer Manual.@"
; 1dc381
Function1dc381: ; 1dc381
call WhiteBGMap
call ClearTileMap
call ClearSprites
xor a
ld [hBGMapMode], a
call Functione58
ld de, MobileHPIcon
ld hl, $9710
lb bc, BANK(MobileHPIcon), 1
call Request1bpp
ld de, MobileLvIcon
ld hl, $96e0
lb bc, BANK(MobileLvIcon), 1
call Request1bpp
ld de, ShinyIcon
ld hl, $93f0
lb bc, BANK(ShinyIcon), 1
call Get2bpp
xor a
ld [MonType], a
callba Function5084a
hlcoord 0, 7
ld b, $9
ld c, $12
call TextBox
hlcoord 8, 2
ld a, [TempMonLevel]
call Function383d
hlcoord 12, 2
ld [hl], $71
inc hl
ld de, TempMonMaxHP
ld bc, $0203
call PrintNum
ld a, [CurPartySpecies]
ld [$d265], a
ld [CurSpecies], a
ld hl, PartyMonNicknames
call Function1dc50e
hlcoord 8, 4
call PlaceString
hlcoord 9, 6
ld [hl], $f3
call GetPokemonName
hlcoord 10, 6
call PlaceString
hlcoord 8, 0
ld [hl], $74
inc hl
ld [hl], $e8
inc hl
ld de, $d265
ld bc, $8103
call PrintNum
hlcoord 1, 9
ld de, String1dc550
call PlaceString
ld hl, PartyMonOT
call Function1dc50e
hlcoord 4, 9
call PlaceString
hlcoord 1, 11
ld de, String1dc559
call PlaceString
hlcoord 4, 11
ld de, TempMonID
ld bc, $8205
call PrintNum
hlcoord 1, 14
ld de, String1dc554
call PlaceString
hlcoord 7, 14
ld a, [TempMonMoves + 0]
call Function1dc51a
call Function1dc52c
ld hl, TempMonDVs
predef GetUnownLetter
ld hl, $c2c6
xor a
ld [hl], a
ld a, [CurPartySpecies]
cp UNOWN
jr z, .asm_1dc469
inc [hl]
.asm_1dc469
ld hl, TileMap
call Function378b
call WaitBGMap
ld b, $3
call GetSGBLayout
call Function32f9
ret
; 1dc47b
Function1dc47b: ; 1dc47b
call WhiteBGMap
call ClearTileMap
call ClearSprites
xor a
ld [hBGMapMode], a
call Functione58
xor a
ld [MonType], a
callba Function5084a
ld hl, TileMap
ld b, 15
ld c, 18
call TextBox
ld bc, SCREEN_WIDTH
ld de, TileMap
hlcoord 0, 1
call CopyBytes
hlcoord 7, 0
ld a, [TempMonMoves + 1]
call Function1dc51a
hlcoord 7, 2
ld a, [TempMonMoves + 2]
call Function1dc51a
hlcoord 7, 4
ld a, [TempMonMoves + 3]
call Function1dc51a
hlcoord 7, 7
ld de, String1dc55d
call PlaceString
hlcoord 16, 7
ld de, TempMonAttack
call Function1dc507
hlcoord 16, 9
ld de, TempMonDefense
call Function1dc507
hlcoord 16, 11
ld de, TempMonSpclAtk
call Function1dc507
hlcoord 16, 13
ld de, TempMonSpclDef
call Function1dc507
hlcoord 16, 15
ld de, TempMonSpeed
call Function1dc507
call WaitBGMap
ld b, $3
call GetSGBLayout
call Function32f9
ret
; 1dc507
Function1dc507: ; 1dc507
ld bc, $0203
call PrintNum
ret
; 1dc50e
Function1dc50e: ; 1dc50e
ld bc, $000b
ld a, [CurPartyMon]
call AddNTimes
ld e, l
ld d, h
ret
; 1dc51a
Function1dc51a: ; 1dc51a
and a
jr z, .asm_1dc525
ld [$d265], a
call GetMoveName
jr .asm_1dc528
.asm_1dc525
ld de, String1dc584
.asm_1dc528
call PlaceString
ret
; 1dc52c
Function1dc52c: ; 1dc52c
callba GetGender
ld a, $7f
jr c, .asm_1dc53c
ld a, $ef
jr nz, .asm_1dc53c
ld a, $f5
.asm_1dc53c
hlcoord 17, 2
ld [hl], a
ld bc, TempMonDVs
callba CheckShininess
ret nc
hlcoord 18, 2
ld [hl], $3f
ret
; 1dc550
String1dc550: ; 1dc550
db "OT/@"
String1dc554: ; 1dc554
db "MOVE@"
String1dc559: ; 1dc559
db $73, "№.@"
String1dc55d: ; 1dc55d
db "ATTACK"
next "DEFENSE"
next "SPCL.ATK"
next "SPCL.DEF"
next "SPEED"
db "@"
String1dc584: ; 1dc584
db "------------@"
; 1dc591
MobileHPIcon: ; 1dc591
INCBIN "gfx/mobile/hp.1bpp"
MobileLvIcon: ; 1dc599
INCBIN "gfx/mobile/lv.1bpp"
INCLUDE "tilesets/data_7.asm"
Function1dd6a9: ; 1dd6a9
ld a, b
ld b, c
ld c, a
push bc
push de
ld hl, [sp+$2]
ld d, h
ld e, l
pop hl
ld bc, $8205
call PrintNum
pop bc
ret
; 1dd6bb
Function1dd6bb: ; 1dd6bb (77:56bb)
ld a, b
cp $c
push af
jr c, .asm_1dd6c7
jr z, .asm_1dd6cc
sub $c
jr .asm_1dd6cc
.asm_1dd6c7
or a
jr nz, .asm_1dd6cc
ld a, $c
.asm_1dd6cc
ld b, a
push bc
ld hl, [sp+$1]
push de
push hl
pop de
pop hl
ld [hl], $7f
ld bc, $102
call PrintNum
ld [hl], $9c
inc hl
ld d, h
ld e, l
ld hl, [sp+$0]
push de
push hl
pop de
pop hl
ld bc, $8102
call PrintNum
pop bc
ld de, String_1dd6fc
pop af
jr c, .asm_1dd6f7
ld de, String_1dd6ff
.asm_1dd6f7
inc hl
call PlaceString
ret
; 1dd6fc (77:56fc)
String_1dd6fc: db "AM@"
String_1dd6ff: db "PM@"
; 1dd702
Function1dd702: ; 1dd702
call Function1dd709
call Functiona80
ret
; 1dd709
Function1dd709: ; 1dd709
call WhiteBGMap
call ClearTileMap
call ClearSprites
call DisableLCD
ld hl, LZ_1dd805
ld de, VTiles2
call Decompress
ld hl, Tilemap_1ddc4b
ld de, TileMap
ld bc, $0168
call CopyBytes
ld de, String_1dd760
hlcoord 2, 5
call PlaceString
ld de, String_1dd767
hlcoord 15, 5
call PlaceString
ld de, PlayerName
hlcoord 9, 5
call PlaceString
ld de, String_1dd768
hlcoord 2, 8
call PlaceString
call EnableLCD
call WaitBGMap
ld b, $8
call GetSGBLayout
call Function32f9
call DelayFrame
ret
; 1dd760
String_1dd760:
db "PLAYER@"
String_1dd767:
db "@"
String_1dd768:
db "This certifies"
next "that you have"
next "completed the"
next "new #DEX."
next "Congratulations!"
db "@"
; 1dd7ae
Function1dd7ae: ; 1dd7ae
ld hl, TileMap
ld bc, $0168
ld a, $7f
call ByteFill
ld hl, Tilemap_1dddb3
ld de, TileMap
ld bc, $0168
call CopyBytes
ld de, String_1dd7fa
hlcoord 8, 0
call PlaceString
ld de, String_1dd7f0
hlcoord 3, 15
call PlaceString
hlcoord 12, 15
ld de, GameTimeHours
ld bc, $0204
call PrintNum
ld [hl], $67
inc hl
ld de, GameTimeMinutes
ld bc, $8102
call PrintNum
ret
; 1dd7f0
String_1dd7f0: db "PLAY TIME@"
String_1dd7fa: db "GAME FREAK@"
; 1dd805
LZ_1dd805: ; 1dd805
INCBIN "baserom.gbc", $1dd805, $1ddc4b - $1dd805
Tilemap_1ddc4b: ; 1ddc4b
INCBIN "baserom.gbc", $1ddc4b, $1dddb3 - $1ddc4b
Tilemap_1dddb3: ; 1dddb3
INCBIN "baserom.gbc", $1dddb3, $1ddf1c - $1dddb3
Function1ddf1c: ; 1ddf1c
ld hl, LZ_1ddf33
ld de, $9310
call Decompress
ret
; 1ddf26
Function1ddf26: ; 1ddf26 (77:5f26)
ld hl, LZ_1ddf33
ld de, $9310
lb bc, BANK(LZ_1ddf33), $3a
call Functione73
ret
; 1ddf33 (77:5f33)
LZ_1ddf33: ; 1ddf33
INCBIN "baserom.gbc",$1ddf33,$1de0d7 - $1ddf33
; 1de0d7
Function1de0d7: ; 1de0d7
ld hl, LZ_1de0e1
ld de, $a000
call Decompress
ret
; 1de0e1
LZ_1de0e1: ; 1de0e1
INCBIN "baserom.gbc",$1de0e1,$1de171 - $1de0e1
; 1de171
Function1de171: ; 1de171 (77:6171)
ld a, $32
hlcoord 0, 17
ld bc, $c
call ByteFill
hlcoord 0, 1
ld bc, $f0b
call ClearBox
ld a, $34
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $b
call ByteFill
ld a, $39
hlcoord 0, 16
ld bc, $b
call ByteFill
hlcoord 5, 0
ld [hl], $3f
hlcoord 5, 16
ld [hl], $40
ld a, [$c7d4]
cp $1
jr z, .asm_1de1bf
hlcoord 11, 0
ld [hl], $50
ld a, $51
hlcoord 11, 1
ld b, $f
call Function1de27f
ld [hl], $52
jr .asm_1de1d0
.asm_1de1bf
hlcoord 11, 0
ld [hl], $66
ld a, $67
hlcoord 11, 1
ld b, $f
call Function1de27f
ld [hl], $68
.asm_1de1d0
ret
Function1de1d1: ; 1de1d1 (77:61d1)
ld a, $34
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $b
call ByteFill
ld a, $39
hlcoord 0, 10
ld bc, $b
call ByteFill
hlcoord 5, 0
ld [hl], $3f
hlcoord 5, 10
ld [hl], $40
hlcoord 11, 0
ld [hl], $66
ld a, $67
hlcoord 11, 1
ld b, $9
call Function1de27f
ld [hl], $68
ld a, $34
hlcoord 0, 11
ld bc, $b
call ByteFill
ld a, $39
hlcoord 0, 17
ld bc, $b
call ByteFill
hlcoord 11, 11
ld [hl], $66
ld a, $67
hlcoord 11, 12
ld b, $5
call Function1de27f
ld [hl], $68
hlcoord 0, 12
lb bc, 5, 11
call ClearBox
ld de, String_1de23c
hlcoord 0, 12
call PlaceString
ret
; 1de23c (77:623c)
String_1de23c: ; 1de23c
; At a glance, this is less coherent in the Japanese charset.
db "ESULTS"
db $4e
db $4e
db "D!@"
; 1de247
Function1de247: ; 1de247
ld a, [hBGMapAddress]
ld l, a
ld a, [$ffd7]
ld h, a
push hl
inc hl
ld a, l
ld [hBGMapAddress], a
ld a, h
ld [$ffd7], a
hlcoord 19, 0
ld [hl], $66
hlcoord 19, 1
ld a, $67
ld b, $f
call Function1de27f
ld [hl], $68
hlcoord 19, 17
ld [hl], $3c
xor a
ld b, $12
ld hl, $cdec
call Function1de27f
call Function3200
pop hl
ld a, l
ld [hBGMapAddress], a
ld a, h
ld [$ffd7], a
ret
; 1de27f
Function1de27f: ; 1de27f
push de
ld de, $0014
.asm_1de283
ld [hl], a
add hl, de
dec b
jr nz, .asm_1de283
pop de
ret
; 1de28a
Function1de28a:: ; 1de28a
ld hl, DudeAutoInput_A
jr Function1de299
; 1de28f
Function1de28f: ; 1de28f
ld hl, DudeAutoInput_RightA
jr Function1de299
; 1de294
Function1de294: ; 1de294
ld hl, DudeAutoInput_DownA
jr Function1de299
; 1de299
Function1de299: ; 1de299
ld a, BANK(DudeAutoInputs)
call StartAutoInput
ret
; 1de29f
DudeAutoInputs:
DudeAutoInput_A: ; 1de29f
db NO_INPUT, $50
db A_BUTTON, $00
db NO_INPUT, $ff ; end
; 1de2a5
DudeAutoInput_RightA: ; 1de2a5
db NO_INPUT, $08
db D_RIGHT, $00
db NO_INPUT, $08
db A_BUTTON, $00
db NO_INPUT, $ff ; end
; 1de2af
DudeAutoInput_DownA: ; 1de2af
db NO_INPUT, $fe
db NO_INPUT, $fe
db NO_INPUT, $fe
db NO_INPUT, $fe
db D_DOWN, $00
db NO_INPUT, $fe
db NO_INPUT, $fe
db NO_INPUT, $fe
db NO_INPUT, $fe
db A_BUTTON, $00
db NO_INPUT, $ff ; end
; 1de2c5
Function1de2c5: ; 1de2c5
ld hl, StringBuffer1
.asm_1de2c8
ld a, [hl]
cp $50
jr z, .asm_1de2da
cp $25
jr z, .asm_1de2d8
cp $1f
jr z, .asm_1de2d8
inc hl
jr .asm_1de2c8
.asm_1de2d8
ld [hl], $22
.asm_1de2da
ld de, StringBuffer1
hlcoord 9, 0
call PlaceString
ret
; 1de2e4
PokegearGFX: ; 1de2e4
INCBIN "gfx/misc/pokegear.2bpp.lz"
; 1de5c8
Function1de5c8: ; 1de5c8
ld c, $0
ld hl, $0029
add hl, de
ld a, [hli]
cp $84
ret nz
ld a, [hli]
inc c
cp $85
ret z
inc c
cp $86
ret z
inc c
cp $88
ret z
inc c
cp $92
ret z
ld c, $0
ret
; 1de5e6
GFX_1de5e6: ; 1de5e6
; The regular font.
INCBIN "baserom.gbc",$1de5e6,$1de9e6 - $1de5e6
GFX_1de9e6: ; 1de9e6
; An extended font.
INCBIN "baserom.gbc",$1de9e6,$1dede6 - $1de9e6
GFX_1dede6: ; 1dede6
; An even more extended font.
INCBIN "baserom.gbc",$1dede6,$1df1e6 - $1dede6
Function1df1e6: ; 1df1e6
ld b, $21
ld h, d
ld l, e
.asm_1df1ea
ld a, [hl]
cp $dc
jr nz, .asm_1df1f3
ld a, $d4
jr .asm_1df1fd
.asm_1df1f3
sub $d4
jr c, .asm_1df1fe
cp $3
jr nc, .asm_1df1fe
add $cd
.asm_1df1fd
ld [hl], a
.asm_1df1fe
inc hl
dec b
jr nz, .asm_1df1ea
ret
; 1df203
Function1df203: ; 1df203
ld b, $21
ld h, d
ld l, e
.asm_1df207
ld a, [hl]
cp $d4
jr nz, .asm_1df210
ld a, $dc
jr .asm_1df21a
.asm_1df210
sub $cd
jr c, .asm_1df21b
cp $3
jr nc, .asm_1df21b
add $d4
.asm_1df21a
ld [hl], a
.asm_1df21b
inc hl
dec b
jr nz, .asm_1df207
ret
; 1df220
Function1df220: ; 1df220
ld b, $21
ld h, d
ld l, e
.asm_1df224
ld a, [hl]
and $f0
cp $d0
jr nz, .asm_1df233
ld a, [hl]
add $8
and $f
or $d0
ld [hl], a
.asm_1df233
inc hl
dec b
jr nz, .asm_1df224
ret
; 1df238
SECTION "Tileset Data 8", ROMX, BANK[TILESETS_8]
INCLUDE "tilesets/data_8.asm"
SECTION "bank79", ROMX, BANK[$79]
SECTION "bank7A", ROMX, BANK[$7A]
SECTION "bank7B", ROMX, BANK[$7B]
INCLUDE "text/battle_tower.asm"
SECTION "bank7C", ROMX, BANK[$7C]
INCBIN "baserom.gbc",$1f0000,$1f09d8 - $1f0000
SECTION "bank7D", ROMX, BANK[$7D]
INCBIN "baserom.gbc",$1f4000,$1f4003 - $1f4000
Function1f4003: ; 1f4003
ld a, $6
call GetSRAMBank
ld hl, MobileSave
ld de, $a000
ld bc, $1000
call CopyBytes
call CloseSRAM
ret
; 1f4018
MobileSave: INCBIN "misc/mobile_save.bin"
INCBIN "baserom.gbc",$1f5018,$1f636a - $1f5018
SECTION "bank7E", ROMX, BANK[$7E]
INCLUDE "data/battle_tower.asm"
INCLUDE "data/odd_eggs.asm"
SECTION "bank7F", ROMX, BANK[$7F]
SECTION "stadium2",ROMX[$8000-$220],BANK[$7F]
INCBIN "baserom.gbc",$1ffde0,$200000 - $1ffde0