summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormid-kid <esteve.varela@gmail.com>2019-08-23 04:10:58 +0200
committermid-kid <esteve.varela@gmail.com>2019-10-21 00:42:36 +0200
commit7d0de22e7ec409ca05cb43679061f4ce0652f6a1 (patch)
treee553eee4ea869c0e0e29ad8f5e30a04a6fdab010
parentb7770e5f885e8cdefb7fd7b8985aa1278bd6b0d9 (diff)
Document mobile SDK error packets
-rw-r--r--lib/mobile/main.asm77
-rw-r--r--mobile/mobile_40.asm4
-rw-r--r--mobile/mobile_5f.asm20
-rw-r--r--wram.asm3
4 files changed, 58 insertions, 46 deletions
diff --git a/lib/mobile/main.asm b/lib/mobile/main.asm
index 9eed76137..35738ea0e 100644
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -77,11 +77,11 @@ Function110030::
; clear [$c835].
push de
ld a, [$c988]
- cp 2 * 6
+ cp $0c
jr z, .noreset
- cp 2 * 7
+ cp $0e
jr z, .noreset
- cp 2 * 8
+ cp $10
jr z, .noreset
xor a
ld [$c835], a
@@ -4134,7 +4134,7 @@ Function111b3c:
ld hl, Function111e28
push hl
cp $ee
- jp z, Function111e2b
+ jp z, MobileSDK_GetErrorCode
ld a, [wMobileSDK_SendCommandID]
cp $ff
jp z, Function111ef8
@@ -4546,7 +4546,8 @@ Function111e15:
Function111e28:
jp Function110029
-Function111e2b:
+MobileSDK_GetErrorCode:
+; Converts an error packet into a BCD error code
ld a, [wMobileSDK_SendCommandID]
cp $ff
jp z, Function111ef8
@@ -4571,54 +4572,59 @@ Function111e2b:
ld a, [hli]
ld [$c80e], a
cp $10
- jr z, .asm_111e88
+ jr z, .adapter_not_plugged_in
cp $12
- jr z, .asm_111e8c
+ jr z, .dial_telephone
cp $13
- jr z, .asm_111ea1
+ jr z, .hang_up_logout
cp $15
- jr z, .asm_111eae
+ jr z, .transfer_data
cp $19
- jr z, .asm_111edc
+ jr z, .read_configuration_data
cp $21
- jr z, .asm_111ee0
+ jr z, .isp_login
cp $22
- jr z, .asm_111ea1
+ jr z, .hang_up_logout
cp $23
- jr z, .asm_111ee4
+ jr z, .open_tcp_connection
cp $24
- jr z, .asm_111eed
+ jr z, .close_tcp_connection
cp $28
- jr z, .asm_111ee9
+ jr z, .dns_query
ld a, [hl]
-.asm_111e84
+
+.store_error_code
ld [$c80f], a
ret
-.asm_111e88
+
+.adapter_not_plugged_in
ld a, $10
- jr .asm_111e84
-.asm_111e8c
+ jr .store_error_code
+
+.dial_telephone
ld a, [hl]
or $0
jr z, .asm_111e9d
cp $2
jr z, .asm_111e99
ld a, $13
- jr .asm_111e84
+ jr .store_error_code
.asm_111e99
ld a, $17
- jr .asm_111e84
+ jr .store_error_code
.asm_111e9d
ld a, $12
- jr .asm_111e84
-.asm_111ea1
+ jr .store_error_code
+
+.hang_up_logout
ld hl, $c821
res 1, [hl]
res 4, [hl]
ld a, $2
ld [$c807], a
ret
-.asm_111eae
+
+.transfer_data
ld a, [hl]
cp $1
jr nz, .asm_111ed3
@@ -4641,20 +4647,25 @@ Function111e2b:
ld hl, $c822
res 5, [hl]
ld a, $24
- jr .asm_111e84
-.asm_111edc
+ jr .store_error_code
+
+.read_configuration_data
ld a, $14
- jr .asm_111e84
-.asm_111ee0
+ jr .store_error_code
+
+.isp_login
ld a, $22
- jr .asm_111e84
-.asm_111ee4
+ jr .store_error_code
+
+.open_tcp_connection
ld hl, $c821
res 1, [hl]
-.asm_111ee9
+
+.dns_query
ld a, $24
- jr .asm_111e84
-.asm_111eed
+ jr .store_error_code
+
+.close_tcp_connection
ld hl, $c821
res 1, [hl]
ld a, $3
diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm
index 724c2c80e..c5d37a104 100644
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -59,8 +59,8 @@ SetRAMStateForMobile:
ld bc, $65
call ByteFill
xor a
- ld hl, wMobileErrorCodeBuffer
- ld bc, $100
+ ld hl, wMobileWRAM
+ ld bc, wMobileWRAMEnd - wMobileWRAM
call ByteFill
ldh a, [rIE]
ld [wBGMapBuffer], a
diff --git a/mobile/mobile_5f.asm b/mobile/mobile_5f.asm
index 5d563b29b..d4a7fcd62 100644
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -4793,7 +4793,7 @@ MobileErrorCodes_23: db 1
dw $000, MobileErrorCode_23_000_Text
MobileErrorCodes_24: db 1
- dw $000, MobileErrorCode_LineBusyText
+ dw $000, MobileErrorCode_ServerConnectionFailedText
MobileErrorCodes_25: db 1
dw $000, MobileErrorCode_25_000_Text
@@ -4803,11 +4803,11 @@ MobileErrorCodes_26: db 1
MobileErrorCodes_30: db 17
dw $000, MobileErrorCode_CommuncationErrorText
- dw $221, MobileErrorCode_LineBusyText
- dw $421, MobileErrorCode_LineBusyText
+ dw $221, MobileErrorCode_ServerConnectionFailedText
+ dw $421, MobileErrorCode_ServerConnectionFailedText
dw $450, MobileErrorCode_30_450_Text
- dw $451, MobileErrorCode_LineBusyText
- dw $452, MobileErrorCode_LineBusyText
+ dw $451, MobileErrorCode_ServerConnectionFailedText
+ dw $452, MobileErrorCode_ServerConnectionFailedText
dw $500, MobileErrorCode_CommuncationErrorText
dw $501, MobileErrorCode_CommuncationErrorText
dw $502, MobileErrorCode_CommuncationErrorText
@@ -4815,17 +4815,17 @@ MobileErrorCodes_30: db 17
dw $504, MobileErrorCode_CommuncationErrorText
dw $550, MobileErrorCode_30_550_Text
dw $551, MobileErrorCode_30_551_Text
- dw $552, MobileErrorCode_LineBusyText
+ dw $552, MobileErrorCode_ServerConnectionFailedText
dw $553, MobileErrorCode_30_553_Text
- dw $554, MobileErrorCode_LineBusyText
- dw -1, MobileErrorCode_LineBusyText
+ dw $554, MobileErrorCode_ServerConnectionFailedText
+ dw -1, MobileErrorCode_ServerConnectionFailedText
MobileErrorCodes_31: db 5
dw $000, MobileErrorCode_CommuncationErrorText
dw $002, MobileErrorCode_31_002_Text
dw $003, MobileErrorCode_31_003_Text
dw $004, MobileErrorCode_CommuncationErrorText
- dw -1, MobileErrorCode_LineBusyText
+ dw -1, MobileErrorCode_ServerConnectionFailedText
MobileErrorCodes_32: db 17
dw $000, MobileErrorCode_CommuncationErrorText
@@ -5058,7 +5058,7 @@ MobileErrorCode_33_299_Text:
next "せつめいしょを ごらんください"
db "@"
-MobileErrorCode_LineBusyText:
+MobileErrorCode_ServerConnectionFailedText:
; The telephone line is busy. Due to this error, the Mobile Center cannot communicate.
; Please wait for a little while and call again.
db "でんわかいせんが こんでいるか"
diff --git a/wram.asm b/wram.asm
index e32f0fbcd..b3b69b0d9 100644
--- a/wram.asm
+++ b/wram.asm
@@ -237,6 +237,7 @@ wc300::
NEXTU ; c300
; mobile data
+wMobileWRAM::
wMobileErrorCodeBuffer:: ds 3 ; c300
wc303:: ds 2
wc305:: ds 1
@@ -299,8 +300,8 @@ wc3f9:: ds 1
wc3fa:: ds 1
wc3fb:: ds 1
wc3fc:: ds 1
-
ds 3
+wMobileWRAMEnd::
SECTION "Sprites", WRAM0