pokecrystal-board/mobile/mobile_22_2.asm

1106 lines
15 KiB
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
Function8b342::
; Loads the map data pointer, then runs through a
; dw with three dummy functions. Spends a lot of energy
2015-10-16 10:35:43 -07:00
; doing pretty much nothing.
call GetMapAttributesPointer
2015-10-16 10:35:43 -07:00
ld d, h
ld e, l
; Everything between here and "ret" is useless.
xor a
.loop
push af
2015-12-26 18:59:03 -08:00
ld hl, .dw
2015-10-16 10:35:43 -07:00
rst JumpTable
pop af
inc a
cp 3
jr nz, .loop
ret
2018-06-24 07:09:41 -07:00
.dw
2015-10-16 10:35:43 -07:00
dw .zero
dw .one
dw .two
2018-06-24 07:09:41 -07:00
.zero
ret
2015-10-16 10:35:43 -07:00
2018-06-24 07:09:41 -07:00
.one
ret
2015-10-16 10:35:43 -07:00
2018-06-24 07:09:41 -07:00
.two
ret
2015-10-16 10:35:43 -07:00
2018-06-24 07:09:41 -07:00
Function8b35d:
2015-10-16 10:35:43 -07:00
ld a, h
cp d
ret nz
ld a, l
cp e
ret
2018-06-24 07:09:41 -07:00
Function8b363:
2015-10-16 10:35:43 -07:00
push bc
2017-12-24 09:47:30 -08:00
farcall Mobile_AlwaysReturnNotCarry
2015-10-16 10:35:43 -07:00
pop bc
ret
2018-06-24 07:09:41 -07:00
Function8b36c:
; [bc + (0:4)] = -1
2015-10-16 10:35:43 -07:00
push bc
ld h, b
ld l, c
ld bc, 4
2015-10-16 10:35:43 -07:00
ld a, -1
call ByteFill
pop bc
ret
2018-06-24 07:09:41 -07:00
Function8b379:
; d = [bc + e]
2015-10-16 10:35:43 -07:00
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
2018-06-24 07:09:41 -07:00
Function8b385:
; [bc + e] = d
2015-10-16 10:35:43 -07:00
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
2018-06-24 07:09:41 -07:00
Function8b391:
; find first e in range(4) such that [bc + e] == -1
; if none exist, return carry
2015-10-16 10:35:43 -07:00
push bc
ld e, 0
ld d, 4
.loop
2015-10-16 10:35:43 -07:00
ld a, [bc]
inc bc
cp -1
jr z, .done
2015-10-16 10:35:43 -07:00
inc e
dec d
jr nz, .loop
2015-10-16 10:35:43 -07:00
dec e
scf
.done
2015-10-16 10:35:43 -07:00
pop bc
ret
2018-06-24 07:09:41 -07:00
Function8b3a4:
; strcmp(hl, bc, 4)
2015-10-16 10:35:43 -07:00
push de
push bc
ld d, b
ld e, c
ld c, 4
2015-10-16 10:35:43 -07:00
call Function89185
pop bc
pop de
ret
2018-06-24 07:09:41 -07:00
Function8b3b0:
ld bc, $a037 ; 4:a037
2015-10-16 10:35:43 -07:00
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
2018-06-24 07:09:41 -07:00
Function8b3cd:
2015-10-16 10:35:43 -07:00
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
2018-06-24 07:09:41 -07:00
Function8b3dd:
2015-10-16 10:35:43 -07:00
push de
push bc
call JoyTextDelay_ForcehJoyDown ; joypad
2015-10-16 10:35:43 -07:00
ld a, c
pop bc
pop de
bit A_BUTTON_F, a
jr nz, .a_button
bit B_BUTTON_F, a
jr nz, .b_button
bit D_UP_F, a
jr nz, .d_up
bit D_DOWN_F, a
jr nz, .d_down
2015-10-16 10:35:43 -07:00
and a
ret
.a_button
2015-10-16 10:35:43 -07:00
ld a, e
cp $3
jr z, .e_is_zero
2015-10-16 10:35:43 -07:00
inc e
ld d, 0
2015-10-16 10:35:43 -07:00
call Function8b385
xor a
ld [wd010], a
ret
.e_is_zero
2015-10-16 10:35:43 -07:00
call PlayClickSFX
ld d, $0
scf
ret
.b_button
2015-10-16 10:35:43 -07:00
ld a, e
and a
jr nz, .e_is_not_zero
2015-10-16 10:35:43 -07:00
call PlayClickSFX
ld d, -1
2015-10-16 10:35:43 -07:00
call Function8b385
ld d, 1
2015-10-16 10:35:43 -07:00
scf
ret
.e_is_not_zero
ld d, -1
2015-10-16 10:35:43 -07:00
call Function8b385
dec e
xor a
ld [wd010], a
ret
.d_up
2015-10-16 10:35:43 -07:00
call Function8b379
ld a, d
cp $a
jr c, .less_than_10_up_1
2015-10-16 10:35:43 -07:00
ld d, $9
.less_than_10_up_1
2015-10-16 10:35:43 -07:00
inc d
ld a, d
cp $a
jr c, .less_than_10_up_2
2015-10-16 10:35:43 -07:00
ld d, $0
.less_than_10_up_2
2015-10-16 10:35:43 -07:00
call Function8b385
xor a
ld [wd010], a
ret
.d_down
2015-10-16 10:35:43 -07:00
call Function8b379
ld a, d
cp $a
jr c, .less_than_10_down
2015-10-16 10:35:43 -07:00
ld d, $0
.less_than_10_down
2015-10-16 10:35:43 -07:00
ld a, d
dec d
and a
jr nz, .nonzero_down
2015-10-16 10:35:43 -07:00
ld d, $9
.nonzero_down
2015-10-16 10:35:43 -07:00
call Function8b385
xor a
ld [wd010], a
ret
2018-06-24 07:09:41 -07:00
Function8b45c:
2015-10-16 10:35:43 -07:00
call Function8b36c
xor a
ld [wd010], a
ld [wd012], a
call Function8b391
ld d, $0
call Function8b385
.asm_8b46e
2016-05-11 14:16:03 -07:00
call Mobile22_SetBGMapMode0
2015-10-16 10:35:43 -07:00
call Function8b493
call Function8b4cc
call Function8b518
call Function89b78
push bc
call Function8b4fd
call Function89c44
ld a, $1
ld [hBGMapMode], a
2015-10-16 10:35:43 -07:00
pop bc
call Function8b3dd
jr nc, .asm_8b46e
ld a, d
and a
ret z
scf
ret
2018-06-24 07:09:41 -07:00
Function8b493:
2015-10-16 10:35:43 -07:00
push bc
2016-05-11 14:16:03 -07:00
call Mobile22_SetBGMapMode0
2015-10-16 10:35:43 -07:00
call Function8b521
ld hl, Jumptable_8b4a0
pop bc
rst JumpTable
ret
2018-06-24 07:09:41 -07:00
Jumptable_8b4a0:
2015-10-16 10:35:43 -07:00
dw Function8b4a4
dw Function8b4b8
2018-06-24 07:09:41 -07:00
Function8b4a4:
2015-10-16 10:35:43 -07:00
push bc
push de
call Function8b4d8
call TextBox
pop de
pop bc
call Function8b4cc
call Function8b518
call Function8b3cd
ret
2018-06-24 07:09:41 -07:00
Function8b4b8:
2015-10-16 10:35:43 -07:00
push bc
push de
call Function8b4ea
call Function89b3b
pop de
pop bc
call Function8b4cc
call Function8b518
call Function8b3cd
ret
2018-06-24 07:09:41 -07:00
Function8b4cc:
2015-10-16 10:35:43 -07:00
push bc
ld hl, Unknown_8b529
call Function8b50a
ld a, [hli]
ld h, [hl]
ld l, a
pop bc
ret
2018-06-24 07:09:41 -07:00
Function8b4d8:
2015-10-16 10:35:43 -07:00
ld hl, Unknown_8b529
call Function8b50a
push hl
inc hl
inc hl
2015-10-16 10:35:43 -07:00
ld a, [hli]
ld b, a
ld a, [hl]
ld c, a
pop hl
ld a, [hli]
ld h, [hl]
ld l, a
ret
2018-06-24 07:09:41 -07:00
Function8b4ea:
2015-10-16 10:35:43 -07:00
ld hl, Unknown_8b529
call Function8b50a
push hl
inc hl
inc hl
2015-10-16 10:35:43 -07:00
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
2018-06-24 07:09:41 -07:00
Function8b4fd:
2015-10-16 10:35:43 -07:00
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
2018-06-24 07:09:41 -07:00
Function8b50a:
2015-10-16 10:35:43 -07:00
ld a, [wd02e]
and a
ret z
ld b, $0
ld c, $8
.asm_8b513
add hl, bc
dec a
jr nz, .asm_8b513
ret
2018-06-24 07:09:41 -07:00
Function8b518:
2015-10-16 10:35:43 -07:00
push de
ld d, $0
ld e, $14
add hl, de
inc hl
pop de
ret
2018-06-24 07:09:41 -07:00
Function8b521:
2015-10-16 10:35:43 -07:00
ld hl, Unknown_8b529 + 7
call Function8b50a
ld a, [hl]
ret
2018-06-24 07:09:41 -07:00
Unknown_8b529:
2015-10-16 10:35:43 -07:00
dwcoord 2, 5
db 1, 4, $20, $49, 0, 1
dwcoord 7, 4
db 1, 4, $48, $41, 0, 0
2018-06-24 07:09:41 -07:00
Function8b539:
2015-10-16 10:35:43 -07:00
ld bc, wd017
call Function8b36c
xor a
ld [wd012], a
ld [wd02e], a
call Function8b493
call Function8b4fd
ld e, $0
call Function89c44
call CGBOnly_CopyTilemapAtOnce
2015-10-16 10:35:43 -07:00
ret
2018-06-24 07:09:41 -07:00
Function8b555:
.loop
2015-10-16 10:35:43 -07:00
ld hl, UnknownText_0x8b5ce
call PrintText
ld bc, wd017
call Function8b45c
jr c, .asm_8b5c8
call Function89448
ld bc, wd017
call Function8b493
ld bc, wd017
call Function8b664
jr nz, .asm_8b57c
ld hl, UnknownText_0x8b5e2
call PrintText
jr .loop
2015-10-16 10:35:43 -07:00
.asm_8b57c
ld hl, UnknownText_0x8b5d3
call PrintText
ld bc, wd013
call Function8b45c
jr c, .loop
2015-10-16 10:35:43 -07:00
ld bc, wd017
ld hl, wd013
call Function8b3a4
jr z, .strings_equal
2015-10-16 10:35:43 -07:00
call Function89448
ld bc, wd013
call Function8b493
ld hl, UnknownText_0x8b5d8
call PrintText
jr .asm_8b57c
.strings_equal
2015-10-16 10:35:43 -07:00
call OpenSRAMBank4
ld hl, wd013
ld de, $a037 ; 4:a037
2015-10-16 10:35:43 -07:00
ld bc, $4
call CopyBytes
call CloseSRAM
call Function89448
ld bc, wd013
call Function8b493
ld hl, UnknownText_0x8b5dd
call PrintText
and a
.asm_8b5c8
push af
call Function89448
pop af
ret
UnknownText_0x8b5ce:
2015-10-16 10:35:43 -07:00
; Please enter any four-digit number.
text_jump UnknownText_0x1bc187
db "@"
UnknownText_0x8b5d3:
2015-10-16 10:35:43 -07:00
; Enter the same number to confirm.
text_jump UnknownText_0x1bc1ac
db "@"
UnknownText_0x8b5d8:
2015-10-16 10:35:43 -07:00
; That's not the same number.
text_jump UnknownText_0x1bc1cf
db "@"
UnknownText_0x8b5dd:
2015-10-16 10:35:43 -07:00
; Your PASSCODE has been set. Enter this number next time to open the CARD FOLDER.
text_jump UnknownText_0x1bc1eb
db "@"
UnknownText_0x8b5e2:
2015-10-16 10:35:43 -07:00
; 0000 is invalid!
text_jump UnknownText_0x1bc23e
db "@"
2018-06-24 07:09:41 -07:00
Function8b5e7:
2015-10-16 10:35:43 -07:00
ld bc, wd013
call Function8b36c
xor a
ld [wd012], a
ld [wd02e], a
call Function8b493
call Function891ab
call Function8b4fd
ld e, $0
call Function89c44
.asm_8b602
ld hl, UnknownText_0x8b642
call PrintText
ld bc, wd013
call Function8b45c
jr c, .asm_8b63c
call Function89448
ld bc, wd013
call Function8b493
call OpenSRAMBank4
ld hl, $a037 ; 4:a037
2015-10-16 10:35:43 -07:00
call Function8b3a4
call CloseSRAM
jr z, .asm_8b635
ld hl, UnknownText_0x8b647
call PrintText
ld bc, wd013
call Function8b36c
jr .asm_8b602
.asm_8b635
ld hl, UnknownText_0x8b64c
call PrintText
and a
.asm_8b63c
push af
call Function89448
pop af
ret
UnknownText_0x8b642:
2015-10-16 10:35:43 -07:00
; Enter the CARD FOLDER PASSCODE.
text_jump UnknownText_0x1bc251
db "@"
UnknownText_0x8b647:
2015-10-16 10:35:43 -07:00
; Incorrect PASSCODE!
text_jump UnknownText_0x1bc272
db "@"
UnknownText_0x8b64c:
2015-10-16 10:35:43 -07:00
; CARD FOLDER open.@ @
text_jump UnknownText_0x1bc288
start_asm
ld de, SFX_TWINKLE
call PlaySFX
call WaitSFX
ld c, $8
call DelayFrames
ld hl, .string_8b663
ret
.string_8b663
db "@"
2018-06-24 07:09:41 -07:00
Function8b664:
2015-10-16 10:35:43 -07:00
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
2018-06-24 07:09:41 -07:00
Function8b677:
2015-11-11 20:38:57 -08:00
call ClearBGPalettes
2015-10-16 10:35:43 -07:00
call DisableLCD
call Function8b690
call Function8b6bb
call Function8b6ed
call EnableLCD
call Function891ab
2015-10-25 19:26:53 -07:00
call SetPalettes
2015-10-16 10:35:43 -07:00
ret
2018-06-24 07:09:41 -07:00
Function8b690:
2015-10-16 10:35:43 -07:00
ld hl, GFX_17afa5 + $514
2017-12-28 04:32:33 -08:00
ld de, vTiles2
2015-10-16 10:35:43 -07:00
ld bc, $160
ld a, BANK(GFX_17afa5)
call FarCopyBytes
ld hl, GFX_17afa5 + $514 + $160 - $10
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $61
2015-10-16 10:35:43 -07:00
ld bc, $10
ld a, BANK(GFX_17afa5)
call FarCopyBytes
ld hl, GFX_17afa5 + $514 + $160
2018-07-15 08:58:01 -07:00
ld de, vTiles0 tile $ee
2015-10-16 10:35:43 -07:00
ld bc, $10
ld a, BANK(GFX_17afa5)
call FarCopyBytes
ret
2018-06-24 07:09:41 -07:00
Function8b6bb:
2015-10-16 10:35:43 -07:00
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, Palette_8b6d5
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2018-01-01 05:47:16 -08:00
ld bc, 3 palettes
2015-10-16 10:35:43 -07:00
call CopyBytes
pop af
ld [rSVBK], a
call Function8949c
ret
2018-06-24 07:09:41 -07:00
Palette_8b6d5:
2015-10-16 10:35:43 -07:00
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
2018-06-24 07:09:41 -07:00
Function8b6ed:
2018-01-23 14:39:09 -08:00
hlcoord 0, 0, wAttrMap
2015-10-16 10:35:43 -07:00
ld bc, $012c
xor a
call ByteFill
2018-01-23 14:39:09 -08:00
hlcoord 0, 14, wAttrMap
2015-10-16 10:35:43 -07:00
ld bc, $0050
ld a, $7
call ByteFill
ret
2018-06-24 07:09:41 -07:00
Function8b703:
2016-05-11 14:16:03 -07:00
call Mobile22_SetBGMapMode0
2015-10-16 10:35:43 -07:00
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, SCREEN_WIDTH
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, SCREEN_WIDTH
add hl, de
dec b
jr nz, .asm_8b717
call Function8b732
pop bc
pop hl
jr Function8b744
2018-06-24 07:09:41 -07:00
Function8b732:
2015-10-16 10:35:43 -07:00
ld a, $12
ld [hli], a
ld a, $13
call Function8b73e
ld a, $14
ld [hl], a
ret
2018-06-24 07:09:41 -07:00
Function8b73e:
2015-10-16 10:35:43 -07:00
ld d, c
.asm_8b73f
ld [hli], a
dec d
jr nz, .asm_8b73f
ret
2018-06-24 07:09:41 -07:00
Function8b744:
2018-01-23 14:39:09 -08:00
ld de, wAttrMap - wTileMap
2015-10-16 10:35:43 -07:00
add hl, de
inc b
inc b
inc c
2015-10-16 10:35:43 -07:00
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, SCREEN_WIDTH
add hl, de
pop bc
dec b
jr nz, .asm_8b74d
ret
2018-06-24 07:09:41 -07:00
Function8b75d:
2016-05-11 14:16:03 -07:00
call Mobile22_SetBGMapMode0
2015-10-16 10:35:43 -07:00
hlcoord 0, 0
ld a, $1
ld bc, SCREEN_WIDTH
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
2018-06-24 07:09:41 -07:00
Function8b787:
2015-10-16 10:35:43 -07:00
ret
2018-06-24 07:09:41 -07:00
Function8b788:
2015-10-16 10:35:43 -07:00
.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
2018-06-24 07:09:41 -07:00
Function8b79e:
2018-01-23 14:39:09 -08:00
hlcoord 0, 1, wAttrMap
2015-10-16 10:35:43 -07:00
ld a, $1
ld [hli], a
2018-01-23 14:39:09 -08:00
hlcoord 9, 1, wAttrMap
2015-10-16 10:35:43 -07:00
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
2018-06-24 07:09:41 -07:00
Function8b7bd:
2015-10-16 10:35:43 -07:00
call Function8b855
ld hl, MenuHeader_0x8b867
call CopyMenuHeader
2015-10-16 10:35:43 -07:00
ld a, [wd030]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-10-16 10:35:43 -07:00
ld a, [wd031]
2015-11-23 13:04:53 -08:00
ld [wMenuScrollPosition], a
2015-10-16 10:35:43 -07:00
ld a, [wd032]
and a
jr z, .asm_8b7e0
ld a, [wMenuFlags]
2015-10-16 10:35:43 -07:00
set 3, a
ld [wMenuFlags], a
2015-10-16 10:35:43 -07:00
.asm_8b7e0
ld a, [wd0e3]
and a
jr z, .asm_8b7ea
dec a
2015-12-17 14:51:32 -08:00
ld [wScrollingMenuCursorPosition], a
2015-10-16 10:35:43 -07:00
.asm_8b7ea
hlcoord 0, 2
ld b, $b
ld c, $12
call Function8b703
call Function8b75d
call UpdateSprites
call Function89209
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-10-16 10:35:43 -07:00
call Function8920f
2015-12-15 15:59:49 -08:00
ld a, [wMenuJoypad]
2015-10-16 10:35:43 -07:00
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
2018-01-23 14:39:09 -08:00
ld a, [wMenuSelection]
2015-10-16 10:35:43 -07:00
cp $ff
jr nz, .asm_8b824
.asm_8b823
xor a
.asm_8b824
ld c, a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-16 10:35:43 -07:00
ld [wd030], a
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
2015-10-16 10:35:43 -07:00
ld [wd031], a
ret
2018-06-24 07:09:41 -07:00
Function8b832:
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld hl, wMenuDataItems
2015-10-16 10:35:43 -07:00
sub [hl]
jr nc, Function8b84b
xor a
jr Function8b84b
2018-06-24 07:09:41 -07:00
Function8b83e:
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
ld hl, wMenuDataItems
2015-10-16 10:35:43 -07:00
add [hl]
cp $24
jr c, Function8b84b
ld a, $24
2018-06-24 07:09:41 -07:00
Function8b84b:
2015-11-23 13:04:53 -08:00
ld [wMenuScrollPosition], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-10-16 10:35:43 -07:00
ret
2018-06-24 07:09:41 -07:00
Function8b855:
2015-10-16 10:35:43 -07:00
ld a, $28
2015-11-10 16:51:13 -08:00
ld hl, wd002
2015-10-16 10:35:43 -07:00
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
MenuHeader_0x8b867:
db MENU_BACKUP_TILES ; flags
menu_coords 1, 3, 18, 13
dw MenuData_0x8b870
2015-10-16 10:35:43 -07:00
db 1 ; default option
db 0
MenuData_0x8b870:
db SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_LEFT ; flags
2015-10-16 10:35:43 -07:00
db 5 ; items
db 3, 1
dbw 0, wd002
2015-11-03 16:43:47 -08:00
dba Function8b880
dba Function8b88c
dba Function8b8c8
2015-10-16 10:35:43 -07:00
2018-06-24 07:09:41 -07:00
Function8b880:
2015-10-16 10:35:43 -07:00
ld h, d
ld l, e
2018-01-23 14:39:09 -08:00
ld de, wMenuSelection
2015-10-16 10:35:43 -07:00
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
ret
2018-06-24 07:09:41 -07:00
Function8b88c:
2015-10-16 10:35:43 -07:00
call OpenSRAMBank4
ld h, d
ld l, e
push hl
ld de, String_89116
call Function8931b
call Function8932d
jr c, .asm_8b8a3
2015-11-02 11:37:02 -08:00
ld hl, 0
2015-10-16 10:35:43 -07:00
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
2018-06-24 07:09:41 -07:00
Function8b8c8:
2015-10-16 10:35:43 -07:00
hlcoord 0, 14
ld b, $2
ld c, $12
call TextBox
ld a, [wd033]
ld b, 0
ld c, a
ld hl, Unknown_8b903
add hl, bc
add hl, bc
2015-10-16 10:35:43 -07:00
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
2015-11-23 13:04:53 -08:00
ld a, [wMenuScrollPosition]
2015-10-16 10:35:43 -07:00
cp $24
ret c
hlcoord 0, 13
ld c, $12
call Function8b732
ret
2018-06-24 07:09:41 -07:00
Unknown_8b903:
2015-10-16 10:35:43 -07:00
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.
2015-10-16 10:35:43 -07:00
2018-06-24 07:09:41 -07:00
Function8b94a:
2015-10-16 10:35:43 -07:00
ld [wd033], a
xor a
2015-11-23 13:04:53 -08:00
ld [wMenuScrollPosition], a
2015-10-16 10:35:43 -07:00
ld [wd032], a
ld [wd0e3], a
ld [wd031], a
ld a, $1
ld [wd030], a
ret
2018-06-24 07:09:41 -07:00
Function8b960:
ld hl, MenuHeader_0x8b9ac
call LoadMenuHeader
2015-10-16 10:35:43 -07:00
call Function8b9e9
jr c, .asm_8b97a
hlcoord 11, 0
ld b, $6
ld c, $7
call Function8b703
ld hl, MenuHeader_0x8b9b1
2015-10-16 10:35:43 -07:00
jr .asm_8b987
.asm_8b97a
hlcoord 11, 0
ld b, $a
ld c, $7
call Function8b703
ld hl, MenuHeader_0x8b9ca
2015-10-16 10:35:43 -07:00
.asm_8b987
ld a, $1
call Function89d5e
ld hl, Function8b9ab
call Function89d85
call ExitMenu
jr c, .asm_8b99c
call Function8b99f
jr nz, .asm_8b99d
.asm_8b99c
xor a
.asm_8b99d
ld c, a
ret
2018-06-24 07:09:41 -07:00
Function8b99f:
2015-11-10 16:51:13 -08:00
ld hl, wd002
2015-10-16 10:35:43 -07:00
dec a
ld c, a
ld b, $0
add hl, bc
ld a, [hl]
cp $ff
ret
2018-06-24 07:09:41 -07:00
Function8b9ab:
2015-10-16 10:35:43 -07:00
ret
MenuHeader_0x8b9ac:
db MENU_BACKUP_TILES ; flags
menu_coords 11, 0, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
2015-10-16 10:35:43 -07:00
MenuHeader_0x8b9b1:
db MENU_BACKUP_TILES ; flags
menu_coords 11, 0, SCREEN_WIDTH - 1, 7
dw MenuData_0x8b9b9
2015-10-16 10:35:43 -07:00
db 1 ; default option
MenuData_0x8b9b9:
db STATICMENU_CURSOR | STATICMENU_WRAP ; flags
2015-10-16 10:35:43 -07:00
db 3 ; items
db "へんしゅう@" ; EDIT
db "いれかえ@" ; REPLACE
db "やめる@" ; QUIT
MenuHeader_0x8b9ca:
db MENU_BACKUP_TILES ; flags
menu_coords 11, 0, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw MenuData_0x8b9d2
2015-10-16 10:35:43 -07:00
db 1 ; default option
MenuData_0x8b9d2:
db STATICMENU_CURSOR | STATICMENU_WRAP ; flags
2015-10-16 10:35:43 -07:00
db 5 ; items
db "みる@" ; VIEW
db "へんしゅう@" ; EDIT
db "いれかえ@" ; REPLACE
db "けす@" ; ERASE
db "やめる@" ; QUIT
2018-06-24 07:09:41 -07:00
Function8b9e9:
2015-10-16 10:35:43 -07:00
call OpenSRAMBank4
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
2015-11-10 16:51:13 -08:00
ld hl, wd002
2015-10-16 10:35:43 -07:00
.asm_8ba10
ld a, [de]
inc de
ld [hli], a
cp $ff
jr nz, .asm_8ba10
call CloseSRAM
pop af
ret
2018-06-24 07:09:41 -07:00
Unknown_8ba1c:
2015-10-16 10:35:43 -07:00
db 2, 4, -1
2018-06-24 07:09:41 -07:00
Unknown_8ba1f:
2015-10-16 10:35:43 -07:00
db 1, 2, 4, 3, -1