2022-01-16 14:50:50 -08:00
|
|
|
MobileAPI::
|
2014-08-22 10:57:06 -07:00
|
|
|
; Mobile
|
|
|
|
cp $2
|
2022-01-16 14:50:50 -08:00
|
|
|
ld [wMobileAPIIndex], a
|
2014-08-22 10:57:06 -07:00
|
|
|
ld a, l
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc986], a
|
2014-08-22 10:57:06 -07:00
|
|
|
ld a, h
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc987], a
|
2016-05-05 12:07:37 -07:00
|
|
|
jr nz, .okay
|
2014-08-22 10:57:06 -07:00
|
|
|
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc982], a
|
2014-08-22 10:57:06 -07:00
|
|
|
ld a, l
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc981], a
|
|
|
|
ld hl, wc983
|
2014-08-22 10:57:06 -07:00
|
|
|
ld a, c
|
|
|
|
ld [hli], a
|
|
|
|
ld a, b
|
|
|
|
ld [hl], a
|
|
|
|
|
2016-05-05 12:07:37 -07:00
|
|
|
.okay
|
2021-09-05 09:47:24 -07:00
|
|
|
ld hl, wc822
|
2014-08-22 10:57:06 -07:00
|
|
|
set 6, [hl]
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hROMBank]
|
2014-08-22 10:57:06 -07:00
|
|
|
push af
|
2022-01-16 14:50:50 -08:00
|
|
|
ld a, BANK(_MobileAPI)
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc981], a
|
2014-08-22 10:57:06 -07:00
|
|
|
rst Bankswitch
|
|
|
|
|
2022-01-16 14:50:50 -08:00
|
|
|
jp _MobileAPI
|
2014-08-22 10:57:06 -07:00
|
|
|
|
2022-01-16 14:50:50 -08:00
|
|
|
ReturnMobileAPI::
|
|
|
|
; Return from _MobileAPI
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc986], a
|
2014-08-22 10:57:06 -07:00
|
|
|
ld a, l
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc987], a
|
2014-08-22 10:57:06 -07:00
|
|
|
ld a, h
|
2022-01-16 14:50:50 -08:00
|
|
|
ld [wMobileAPIIndex], a
|
2014-08-22 10:57:06 -07:00
|
|
|
|
|
|
|
pop bc
|
|
|
|
ld a, b
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc981], a
|
2014-08-22 10:57:06 -07:00
|
|
|
rst Bankswitch
|
|
|
|
|
2021-09-05 09:47:24 -07:00
|
|
|
ld hl, wc822
|
2014-08-22 10:57:06 -07:00
|
|
|
res 6, [hl]
|
2021-09-05 09:47:24 -07:00
|
|
|
ld hl, wc987
|
2014-08-22 10:57:06 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2021-09-05 09:47:24 -07:00
|
|
|
ld a, [wc986]
|
2014-08-22 10:57:06 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
MobileReceive::
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hROMBank]
|
2014-08-22 10:57:06 -07:00
|
|
|
push af
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, BANK(_MobileReceive)
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc981], a
|
2014-08-22 10:57:06 -07:00
|
|
|
rst Bankswitch
|
|
|
|
|
2015-12-15 15:59:49 -08:00
|
|
|
call _MobileReceive
|
2014-08-22 10:57:06 -07:00
|
|
|
pop bc
|
|
|
|
ld a, b
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc981], a
|
2014-08-22 10:57:06 -07:00
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
MobileTimer::
|
2014-08-22 10:57:06 -07:00
|
|
|
push af
|
|
|
|
push bc
|
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hMobile]
|
2014-08-22 10:57:06 -07:00
|
|
|
and a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr z, .pop_ret
|
2014-08-22 10:57:06 -07:00
|
|
|
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rTAC], a
|
2014-08-22 10:57:06 -07:00
|
|
|
|
|
|
|
; Turn off timer interrupt
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rIF]
|
2014-08-22 10:57:06 -07:00
|
|
|
and 1 << VBLANK | 1 << LCD_STAT | 1 << SERIAL | 1 << JOYPAD
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rIF], a
|
2014-08-22 10:57:06 -07:00
|
|
|
|
2021-09-05 09:47:24 -07:00
|
|
|
ld a, [wc86a]
|
2014-08-22 10:57:06 -07:00
|
|
|
or a
|
2015-10-24 07:34:19 -07:00
|
|
|
jr z, .pop_ret
|
2014-08-22 10:57:06 -07:00
|
|
|
|
2021-09-05 09:47:24 -07:00
|
|
|
ld a, [wc822]
|
2014-08-22 10:57:06 -07:00
|
|
|
bit 1, a
|
2020-06-21 13:27:43 -07:00
|
|
|
jr nz, .skip_timer
|
2014-08-22 10:57:06 -07:00
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rSC]
|
2014-08-22 10:57:06 -07:00
|
|
|
and 1 << rSC_ON
|
2020-06-21 13:27:43 -07:00
|
|
|
jr nz, .skip_timer
|
2014-08-22 10:57:06 -07:00
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hROMBank]
|
2014-08-22 10:57:06 -07:00
|
|
|
push af
|
2015-12-28 14:09:53 -08:00
|
|
|
ld a, BANK(_Timer)
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc981], a
|
2014-08-22 10:57:06 -07:00
|
|
|
rst Bankswitch
|
|
|
|
|
2015-12-28 14:09:53 -08:00
|
|
|
call _Timer
|
2014-08-22 10:57:06 -07:00
|
|
|
|
|
|
|
pop bc
|
|
|
|
ld a, b
|
2021-09-05 09:47:24 -07:00
|
|
|
ld [wc981], a
|
2014-08-22 10:57:06 -07:00
|
|
|
rst Bankswitch
|
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
.skip_timer
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rTMA]
|
|
|
|
ldh [rTIMA], a
|
2014-08-22 10:57:06 -07:00
|
|
|
|
|
|
|
ld a, 1 << rTAC_ON | rTAC_65536_HZ
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rTAC], a
|
2014-08-22 10:57:06 -07:00
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
.pop_ret
|
2014-08-22 10:57:06 -07:00
|
|
|
pop hl
|
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
pop af
|
|
|
|
reti
|
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
Function3ed7:: ; unreferenced
|
2016-01-12 09:46:18 -08:00
|
|
|
ld [$dc02], a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hROMBank]
|
2014-08-22 10:57:06 -07:00
|
|
|
push af
|
|
|
|
ld a, BANK(Function114243)
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
call Function114243
|
|
|
|
pop bc
|
|
|
|
ld a, b
|
|
|
|
rst Bankswitch
|
|
|
|
|
2016-01-12 09:46:18 -08:00
|
|
|
ld a, [$dc02]
|
2014-08-22 10:57:06 -07:00
|
|
|
ret
|
2015-12-28 14:09:53 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Function3eea::
|
2015-12-28 14:09:53 -08:00
|
|
|
push hl
|
|
|
|
push bc
|
2020-02-13 09:30:13 -08:00
|
|
|
ld de, wAttrmap - wTilemap
|
2015-12-28 14:09:53 -08:00
|
|
|
add hl, de
|
|
|
|
inc b
|
|
|
|
inc b
|
|
|
|
inc c
|
|
|
|
inc c
|
|
|
|
call Function3f35
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
call MobileHome_PlaceBox
|
|
|
|
ret
|
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
Function3efd:: ; unreferenced
|
2015-12-28 14:09:53 -08:00
|
|
|
push hl
|
|
|
|
hlcoord 0, 12
|
|
|
|
ld b, 4
|
|
|
|
ld c, 18
|
|
|
|
call .fill_attr
|
|
|
|
pop hl
|
2019-04-08 05:15:10 -07:00
|
|
|
call PrintTextboxText
|
2015-12-28 14:09:53 -08:00
|
|
|
ret
|
|
|
|
|
|
|
|
.fill_attr
|
|
|
|
push hl
|
|
|
|
push bc
|
2020-02-13 09:30:13 -08:00
|
|
|
ld de, wAttrmap - wTilemap
|
2015-12-28 14:09:53 -08:00
|
|
|
add hl, de
|
|
|
|
inc b
|
|
|
|
inc b
|
|
|
|
inc c
|
|
|
|
inc c
|
|
|
|
call Function3f35
|
|
|
|
pop bc
|
|
|
|
pop hl
|
2019-04-08 05:15:10 -07:00
|
|
|
call TextboxBorder
|
2015-12-28 14:09:53 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Function3f20::
|
2020-02-13 09:30:13 -08:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-12-28 14:09:53 -08:00
|
|
|
ld b, 6
|
|
|
|
ld c, 20
|
|
|
|
call Function3f35
|
|
|
|
hlcoord 0, 0
|
|
|
|
ld b, 4
|
|
|
|
ld c, 18
|
|
|
|
call MobileHome_PlaceBox
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Function3f35::
|
2015-12-28 14:09:53 -08:00
|
|
|
ld a, 6
|
|
|
|
ld de, SCREEN_WIDTH
|
|
|
|
.row
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
.col
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .col
|
|
|
|
pop hl
|
|
|
|
add hl, de
|
|
|
|
pop bc
|
|
|
|
dec b
|
|
|
|
jr nz, .row
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
MobileHome_PlaceBox:
|
2015-12-28 14:09:53 -08:00
|
|
|
push bc
|
|
|
|
call .FillTop
|
|
|
|
pop bc
|
2016-04-10 11:42:14 -07:00
|
|
|
.RowLoop:
|
2015-12-28 14:09:53 -08:00
|
|
|
push bc
|
|
|
|
call .FillMiddle
|
|
|
|
pop bc
|
|
|
|
dec b
|
|
|
|
jr nz, .RowLoop
|
|
|
|
call .FillBottom
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.FillTop:
|
2015-12-28 14:09:53 -08:00
|
|
|
ld a, $63
|
|
|
|
ld d, $62
|
|
|
|
ld e, $64
|
|
|
|
jr .FillRow
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.FillBottom:
|
2015-12-28 14:09:53 -08:00
|
|
|
ld a, $68
|
|
|
|
ld d, $67
|
|
|
|
ld e, $69
|
|
|
|
jr .FillRow
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.FillMiddle:
|
2015-12-28 14:09:53 -08:00
|
|
|
ld a, $7f
|
|
|
|
ld d, $65
|
|
|
|
ld e, $66
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.FillRow:
|
2015-12-28 14:09:53 -08:00
|
|
|
push hl
|
|
|
|
ld [hl], d
|
|
|
|
inc hl
|
2016-04-10 11:42:14 -07:00
|
|
|
.FillLoop:
|
2015-12-28 14:09:53 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .FillLoop
|
|
|
|
ld [hl], e
|
|
|
|
pop hl
|
|
|
|
ld de, SCREEN_WIDTH
|
|
|
|
add hl, de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Function3f7c::
|
2015-12-28 14:09:53 -08:00
|
|
|
call MenuBoxCoord2Tile
|
|
|
|
call GetMenuBoxDims
|
|
|
|
dec b
|
|
|
|
dec c
|
|
|
|
call Function3eea
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Function3f88::
|
2015-12-28 14:09:53 -08:00
|
|
|
ld hl, wDecompressScratch
|
|
|
|
ld b, 0
|
|
|
|
.row
|
|
|
|
push bc
|
|
|
|
ld c, 1 tiles / 2
|
|
|
|
.col
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cpl
|
|
|
|
ld [hl], 0
|
|
|
|
inc hl
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .col
|
|
|
|
pop bc
|
|
|
|
dec c
|
|
|
|
jr nz, .row
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Function3f9f::
|
2015-12-28 14:09:53 -08:00
|
|
|
ld hl, wDecompressScratch
|
|
|
|
.row
|
|
|
|
push bc
|
|
|
|
ld c, 1 tiles / 2
|
|
|
|
.col
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
cpl
|
|
|
|
ld [hl], $0
|
|
|
|
inc hl
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .col
|
|
|
|
pop bc
|
|
|
|
dec c
|
|
|
|
jr nz, .row
|
|
|
|
ret
|