Enumerate MobileAPI function constants

This commit is contained in:
mid-kid 2022-01-16 23:50:50 +01:00
parent ce16317f33
commit 1dc88cb585
8 changed files with 152 additions and 115 deletions

View File

@ -1,3 +1,40 @@
; MobileAPI calls (see lib/mobile/main.asm:_MobileAPI)
const_def 0, 2
const MOBILEAPI_00
const MOBILEAPI_01
const MOBILEAPI_02
const MOBILEAPI_03
const MOBILEAPI_04
const MOBILEAPI_05
const MOBILEAPI_06
const MOBILEAPI_07
const MOBILEAPI_08
const MOBILEAPI_09
const MOBILEAPI_0A
const MOBILEAPI_0B
const MOBILEAPI_0C
const MOBILEAPI_0D
const MOBILEAPI_0E
const MOBILEAPI_0F
const MOBILEAPI_10
const MOBILEAPI_11
const MOBILEAPI_12
const MOBILEAPI_13
const MOBILEAPI_14
const MOBILEAPI_15
const MOBILEAPI_16
const MOBILEAPI_17
const MOBILEAPI_SETTIMER
const MOBILEAPI_19
const MOBILEAPI_1A
const MOBILEAPI_1B
const MOBILEAPI_1C
const MOBILEAPI_1D
const MOBILEAPI_1E
const MOBILEAPI_1F
const MOBILEAPI_20
const MOBILEAPI_21
; MobileEZChatCategoryPointers indexes (see mobile/fixed_words.asm)
const_def
const EZCHAT_POKEMON

View File

@ -1,7 +1,7 @@
Function3e32::
MobileAPI::
; Mobile
cp $2
ld [wc988], a
ld [wMobileAPIIndex], a
ld a, l
ld [wc986], a
ld a, h
@ -22,19 +22,19 @@ Function3e32::
set 6, [hl]
ldh a, [hROMBank]
push af
ld a, BANK(Function110030)
ld a, BANK(_MobileAPI)
ld [wc981], a
rst Bankswitch
jp Function110030
jp _MobileAPI
Function3e60::
; Return from Function110030
ReturnMobileAPI::
; Return from _MobileAPI
ld [wc986], a
ld a, l
ld [wc987], a
ld a, h
ld [wc988], a
ld [wMobileAPIIndex], a
pop bc
ld a, b

View File

@ -88,40 +88,40 @@ ResetReceivePacketBuffer:
ld [hl], a
ret
Function110030::
; Use the byte at wc988 as a parameter
_MobileAPI::
; Use the byte at wMobileAPIIndex as a parameter
; for a dw.
; If [wc988] not in {12, 14, 16},
; If [wMobileAPIIndex] not in {MOBILEAPI_06, MOBILEAPI_07, MOBILEAPI_08},
; clear [wc835].
push de
ld a, [wc988]
cp $0c
ld a, [wMobileAPIIndex]
cp MOBILEAPI_06
jr z, .noreset
cp $0e
cp MOBILEAPI_07
jr z, .noreset
cp $10
cp MOBILEAPI_08
jr z, .noreset
xor a
ld [wc835], a
ld a, [wc988]
ld a, [wMobileAPIIndex]
.noreset
; Get the pointer
ld d, 0
ld e, a
ld hl, .dw
add hl, de
; Store the low byte in [wc988]
; Store the low byte in [wMobileAPIIndex]
ld a, [hli]
ld [wc988], a
ld [wMobileAPIIndex], a
ld a, [hl]
; restore de
pop de
ld hl, Function3e60 ; return here
ld hl, ReturnMobileAPI ; return here
push hl
; If the destination function is not Function110236,
; call Function1100b4.
ld h, a
ld a, [wc988]
ld a, [wMobileAPIIndex]
ld l, a
push hl
ld a, LOW(Function110236)
@ -135,7 +135,7 @@ Function110030::
ld a, [hli]
ld h, [hl]
ld l, a
ret ; indirectly jump to the function loaded from the dw, which returns to Function3e60.
ret ; indirectly jump to the function loaded from the dw, which returns to ReturnMobileAPI.
.dw
dw Function110115
@ -162,7 +162,7 @@ Function110030::
dw Function110ddd
dw Function1111fe
dw Function1113fe
dw Function1100dc
dw MobileAPI_SetTimer
dw Function111541
dw Function111596
dw Function11162d
@ -201,7 +201,7 @@ Function1100b4:
pop bc
ret
Function1100dc:
MobileAPI_SetTimer:
xor a
ldh [rTAC], a
ld e, c
@ -231,10 +231,10 @@ Function1100dc:
ld a, [hl]
ld [wc820], a
ld [wc815], a
ld c, $7
ld a, $2
ld c, LOW(rTAC)
ld a, rTAC_65536_HZ
ldh [c], a
ld a, $6
ld a, 1 << rTAC_ON | rTAC_65536_HZ
ldh [c], a
ret
@ -413,7 +413,7 @@ Function110235:
nop
Function110236:
ld a, [wc988]
ld a, [wMobileAPIIndex]
push af
push bc
push hl
@ -453,7 +453,7 @@ Function110236:
xor a
ld [wc819], a
ld c, $c
call Function1100dc
call MobileAPI_SetTimer
call Function1104b0
pop af
cp $35
@ -505,7 +505,7 @@ Function110291:
ld [hl], a
ld a, [wc870]
ld c, a
call Function1100dc
call MobileAPI_SetTimer
ld hl, wc829
ld a, $72
ld [hli], a
@ -590,7 +590,7 @@ Function11032c:
ld [hl], a
ld a, [wc870]
ld c, a
call Function1100dc
call MobileAPI_SetTimer
ld de, wMobileSDK_PacketBuffer
ld b, 6 ; header size
ld hl, MobilePacket_ReadConfigurationDataPart1
@ -676,7 +676,7 @@ Function1103ac:
ld [wc97a], a
ld a, [wc870]
ld c, a
call Function1100dc
call MobileAPI_SetTimer
ld hl, wc829
ld a, $80
ld [hli], a
@ -741,7 +741,7 @@ Function110438:
ld [wc97a], a
ld a, [wc870]
ld c, a
call Function1100dc
call MobileAPI_SetTimer
ld hl, wc98f
ld a, $81
ld [hli], a
@ -929,7 +929,7 @@ Function110596:
ld [wc819], a
ld a, [wc870]
ld c, a
call Function1100dc
call MobileAPI_SetTimer
ld hl, wc829
ld a, $80
ld [hli], a
@ -956,7 +956,7 @@ Function1105dd:
ldh [rTAC], a
ld a, [wc870]
ld c, a
call Function1100dc
call MobileAPI_SetTimer
ld hl, wc98f
ld a, $81
ld [hli], a
@ -3252,7 +3252,7 @@ Function111541:
ld hl, MobilePacket_TelephoneStatus
call PacketSendEmptyBody
.asm_11156f
ld a, [wc988]
ld a, [wMobileAPIIndex]
cp $40
jr nz, .asm_11157a
ld a, $2c
@ -3270,7 +3270,7 @@ Function111541:
ldh [rTAC], a
ld a, [wc870]
ld c, a
call Function1100dc
call MobileAPI_SetTimer
call Function1104b0
ld a, $1
ld [wc86b], a
@ -4926,13 +4926,13 @@ MobilePacket_CloseTCPConnection:
.End
Unknown_112089:
db $ec, $14, $c9
db $e4, $0f, $0e
db $e0, $0c, $53
db $c4, $07, $94
db $b0, $05, $ee
db $ec, $10, $b4
db $e4, $0c, $dd
db -20, $14, $c9
db -28, $0f, $0e
db -32, $0c, $53
db -60, $07, $94
db -80, $05, $ee
db -20, $10, $b4
db -28, $0c, $dd
Unknown_11209e:
db "HELO ", 0

View File

@ -481,8 +481,8 @@ Function10034d:
ret
.asm_10036a
ld a, 0
call Function3e32
ld a, MOBILEAPI_00
call MobileAPI
ld [wcd2c], a
ld a, h
ld [wcd2d], a
@ -505,14 +505,14 @@ Function100382:
Function10038a:
ld hl, wccb4
ld a, $2e
call Function3e32
ld a, MOBILEAPI_17
call MobileAPI
ret
Function100393:
ld hl, wcc60
ld a, $3a
call Function3e32
ld a, MOBILEAPI_1D
call MobileAPI
ret
Function10039c:
@ -3138,32 +3138,32 @@ Function101507:
ld de, wcd30
ld hl, $40
ld bc, $40
ld a, $02
call Function3e32
ld a, MOBILEAPI_01
call MobileAPI
ld a, [wMobileCommsJumptableIndex]
inc a
ld [wMobileCommsJumptableIndex], a
ret
Function10151d: ; unreferenced
ld a, $34
call Function3e32
ld a, MOBILEAPI_1A
call MobileAPI
ld a, [wMobileCommsJumptableIndex]
inc a
ld [wMobileCommsJumptableIndex], a
ret
Function10152a:
ld a, $36
call Function3e32
ld a, MOBILEAPI_1B
call MobileAPI
ld a, [wMobileCommsJumptableIndex]
inc a
ld [wMobileCommsJumptableIndex], a
ret
Function101537:
ld a, $0a
call Function3e32
ld a, MOBILEAPI_05
call MobileAPI
ld a, [wMobileCommsJumptableIndex]
inc a
ld [wMobileCommsJumptableIndex], a
@ -3171,8 +3171,8 @@ Function101537:
Function101544:
farcall StartMobileInactivityTimer
ld a, $12
call Function3e32
ld a, MOBILEAPI_09
call MobileAPI
ld a, [wMobileCommsJumptableIndex]
inc a
ld [wMobileCommsJumptableIndex], a
@ -3181,8 +3181,8 @@ Function101544:
Function101557:
farcall StartMobileInactivityTimer
ld hl, wcd53
ld a, $08
call Function3e32
ld a, MOBILEAPI_04
call MobileAPI
ld a, [wMobileCommsJumptableIndex]
inc a
ld [wMobileCommsJumptableIndex], a

View File

@ -865,8 +865,8 @@ Function10635c:
ld de, wcd30
ld hl, $41
ld bc, $41
ld a, $40
call Function3e32
ld a, MOBILEAPI_20
call MobileAPI
ld a, [wMobileCommsJumptableIndex]
inc a
ld [wMobileCommsJumptableIndex], a
@ -935,8 +935,8 @@ Function1063e5:
Function1063f3:
ld de, wcd31
ld a, $32
call Function3e32
ld a, MOBILEAPI_19
call MobileAPI
ld a, [wMobileCommsJumptableIndex]
inc a
ld [wMobileCommsJumptableIndex], a
@ -983,8 +983,8 @@ Function106403:
ret
Function106442:
ld a, $36
call Function3e32
ld a, MOBILEAPI_1B
call MobileAPI
xor a
ldh [hMobile], a
ldh [hMobileReceive], a

View File

@ -910,15 +910,15 @@ Function11878d:
ret c
ret
.asm_1187af
ld a, $0
call Function3e32
ld a, MOBILEAPI_00
call MobileAPI
ld [wMobileErrorCodeBuffer], a
ld a, l
ld [wMobileErrorCodeBuffer + 1], a
ld a, h
ld [wMobileErrorCodeBuffer + 2], a
ld a, $a
call Function3e32
ld a, MOBILEAPI_05
call MobileAPI
ld a, [wc3f0]
ld [wc319], a
ld a, [wcd34]
@ -940,18 +940,18 @@ Function11878d:
jr c, .asm_1187fd
sla a
jr c, .asm_1187f5
ld a, $24
ld a, MOBILEAPI_12
jr .asm_1187ff
.asm_1187f5
ld a, $28
ld a, MOBILEAPI_14
jr .asm_1187ff
.asm_1187f9
ld a, $2a
ld a, MOBILEAPI_15
jr .asm_1187ff
.asm_1187fd
ld a, $2c
ld a, MOBILEAPI_16
.asm_1187ff
call Function3e32
call MobileAPI
ret
.asm_118803
ld a, $d3
@ -961,8 +961,8 @@ SetMobileErrorCode:
xor a
ld [wMobileErrorCodeBuffer + 1], a
ld [wMobileErrorCodeBuffer + 2], a
ld a, $a
call Function3e32
ld a, MOBILEAPI_05
call MobileAPI
ld a, [wc3f0]
ld [wc319], a
ld a, [wcd34]
@ -978,8 +978,8 @@ Function118821:
ldh a, [hJoyDown]
cp $5
jr nz, .asm_11884a
ld a, $a
call Function3e32
ld a, MOBILEAPI_05
call MobileAPI
ld a, $a
ld [wMobileErrorCodeBuffer], a
ld a, [wc3f0]
@ -996,8 +996,8 @@ Function11884c:
ldh a, [hJoyDown]
cp $5
jr nz, .asm_118864
ld a, $a
call Function3e32
ld a, MOBILEAPI_05
call MobileAPI
ld a, $a
ld [wMobileErrorCodeBuffer], a
ld a, [wcd34]
@ -1036,7 +1036,7 @@ Function118880:
ld [wc807], a
ld de, wcd81
ld hl, $46
ld a, $2
ld a, MOBILEAPI_01
jp Function119e2b
Function118896: ; unreferenced
@ -1049,7 +1049,7 @@ Function118896: ; unreferenced
jr z, .asm_1188aa
.asm_1188a5
ld a, $34
ld a, MOBILEAPI_1A
jp Function119e2b
.asm_1188aa
@ -1058,17 +1058,17 @@ Function118896: ; unreferenced
Function1188b0:
ld de, wc346
ld a, $c
ld a, MOBILEAPI_06
jp Function119e2b
Function1188b8:
ld de, wc3ac
ld a, $e
ld a, MOBILEAPI_07
jp Function119e2b
Function1188c0:
ld de, wc3cd
ld a, $10
ld a, MOBILEAPI_08
jp Function119e2b
Function1188c8:
@ -1085,7 +1085,7 @@ Function1188c8:
call Function119eb4
call Function119ec2
ld hl, wc708
ld a, $6
ld a, MOBILEAPI_03
jp Function119e2b
Function1188e7:
@ -1394,7 +1394,7 @@ Function118ae4:
call Function118b24
pop de
pop bc
ld a, $2a
ld a, MOBILEAPI_15
jp Function119e2b
Function118b10:
@ -1406,7 +1406,7 @@ Function118b10:
call Function118b24
pop bc
pop de
ld a, $2a
ld a, MOBILEAPI_15
jp Function119e2b
Function118b24:
@ -1602,7 +1602,7 @@ asm_118d9f:
ld hl, w3_d800
ld de, w3_de00
ld bc, $200
ld a, $2c
ld a, MOBILEAPI_16
jp Function119e2b
Function118ded:
@ -1697,7 +1697,7 @@ asm_118e3e:
Function118e6d:
xor a
ld [wcd65], a
ld a, $a
ld a, MOBILEAPI_05
jp Function119e2b
Function118e76:
@ -1709,7 +1709,7 @@ Function118e76:
Function118e7e:
call BattleTowerRoomMenu2
ret c
ld a, $36
ld a, MOBILEAPI_1B
jp Function119e2b
BattleTowerRoomMenu_CallRoomMenu2:
@ -1857,7 +1857,7 @@ Function118f68:
ld hl, wc346
ld de, w3_de00
ld bc, $200
ld a, $2c
ld a, MOBILEAPI_16
jp Function119e2b
.asm_118fba
@ -1937,7 +1937,7 @@ Function119009:
ld hl, wc346
ld de, w3_d000
ld bc, $1000
ld a, $2c
ld a, MOBILEAPI_16
jp Function119e2b
Function119054:
@ -2471,7 +2471,7 @@ Function1193a0:
ld hl, wc346
ld de, w3_de00
ld bc, $200
ld a, $2c
ld a, MOBILEAPI_16
jp Function119e2b
Function1193e3:
@ -2856,7 +2856,7 @@ Function119648:
call Function118b24
ld de, w3_d000
ld bc, $1000
ld a, $2a
ld a, MOBILEAPI_15
jp Function119e2b
Function119665:
@ -3147,7 +3147,7 @@ Function1197dc:
call Function118b24
ld de, w3_d000
ld bc, $1000
ld a, $2a
ld a, MOBILEAPI_15
jp Function119e2b
Function119800:
@ -3287,7 +3287,7 @@ Function1198f7:
ld hl, w3_d800
ld de, w3_de00
ld bc, $200
ld a, $2c
ld a, MOBILEAPI_16
jp Function119e2b
Function119937:
@ -3328,7 +3328,7 @@ Function119954:
jr nz, .asm_119962
call Function119ec2
ld hl, wc608
ld a, $1e
ld a, MOBILEAPI_0F
jp Function119e2b
Function119973:
@ -3338,7 +3338,7 @@ Function119973:
ld [wcf65], a
ld [w3_d090], a
ld de, w3_d000
ld a, $20
ld a, MOBILEAPI_10
jp Function119e2b
Function119987:
@ -3351,7 +3351,7 @@ Function119987:
ld a, [wcf65]
ld h, a
ld de, wBGPals2
ld a, $22
ld a, MOBILEAPI_11
jp Function119e2b
.asm_1199a0
@ -3389,7 +3389,7 @@ Function1199ca:
ld h, a
ld de, w3_d100
ld bc, $0700
ld a, $28
ld a, MOBILEAPI_14
jp Function119e2b
Function1199e2:
@ -3555,7 +3555,7 @@ Function119b0d:
ld h, a
ld de, w3_d100
ld bc, $0700
ld a, $24
ld a, MOBILEAPI_12
jp Function119e2b
Function119b3b:
@ -3572,7 +3572,7 @@ Function119b45:
ld h, a
asm_119b4d:
ld a, $26
ld a, MOBILEAPI_13
jp Function119e2b
Function119b52:
@ -3586,7 +3586,7 @@ Function119b52:
call CloseSRAM
.asm_119b66
ld a, $1c
ld a, MOBILEAPI_0E
jp Function119e2b
Function119b6b:
@ -3993,7 +3993,7 @@ BattleTower_UbersCheck:
ret
Function119e2b:
call Function3e32
call MobileAPI
BattleTowerRoomMenu_IncrementJumptable:
ld hl, wBattleTowerRoomMenuJumptableIndex

View File

@ -371,15 +371,15 @@ Function171a5d:
jp Function171c66
.asm_171a6a
ld a, $0
call Function3e32
ld a, MOBILEAPI_00
call MobileAPI
ld [wMobileErrorCodeBuffer], a
ld a, l
ld [wMobileErrorCodeBuffer + 1], a
ld a, h
ld [wMobileErrorCodeBuffer + 2], a
ld a, $a
call Function3e32
ld a, MOBILEAPI_05
call MobileAPI
ldh a, [rSVBK]
push af
ld a, $1
@ -407,8 +407,8 @@ String_171aa7:
Function171ac9:
ld de, wcd81
ld hl, $5c
ld a, $2
call Function3e32
ld a, MOBILEAPI_01
call MobileAPI
jp Function171c66
Function171ad7:
@ -417,8 +417,8 @@ Function171ad7:
ld bc, $66
call ByteFill
ld de, $c608
ld a, $c
call Function3e32
ld a, MOBILEAPI_06
call MobileAPI
jp Function171c66
Function171aec:

View File

@ -1195,7 +1195,7 @@ wc983:: dw
wc985:: db
wc986:: db
wc987:: db
wc988:: db
wMobileAPIIndex:: db
wc989:: db
wc98a:: db
wc98b:: db