ref: 7d0de22e7ec409ca05cb43679061f4ce0652f6a1
parent: b7770e5f885e8cdefb7fd7b8985aa1278bd6b0d9
author: mid-kid <esteve.varela@gmail.com>
date: Fri Aug 23 00:10:58 EDT 2019
Document mobile SDK error packets
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -77,11 +77,11 @@
; 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 @@
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 @@
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,33 +4572,36 @@
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
@@ -4604,14 +4608,15 @@
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]
@@ -4618,7 +4623,8 @@
ld a, $2
ld [$c807], a
ret
-.asm_111eae
+
+.transfer_data
ld a, [hl]
cp $1
jr nz, .asm_111ed3
@@ -4641,20 +4647,25 @@
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
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -59,8 +59,8 @@
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
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -4793,7 +4793,7 @@
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_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,10 +4815,10 @@
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
@@ -4825,7 +4825,7 @@
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 @@
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 "でんわかいせんが こんでいるか"
--- a/wram.asm
+++ b/wram.asm
@@ -237,6 +237,7 @@
NEXTU ; c300
; mobile data
+wMobileWRAM::
wMobileErrorCodeBuffer:: ds 3 ; c300
wc303:: ds 2
wc305:: ds 1
@@ -299,8 +300,8 @@
wc3fa:: ds 1
wc3fb:: ds 1
wc3fc:: ds 1
-
ds 3
+wMobileWRAMEnd::
SECTION "Sprites", WRAM0