More mobile SDK documentation

Labelled WRAM addresses, added constants for mobile commands, fixed some
mobile lib function names, documented most of the functions for specific
commands.
This commit is contained in:
mid-kid 2019-10-21 00:27:34 +02:00
parent f4907040c9
commit 86061d37d2
7 changed files with 297 additions and 255 deletions

View File

@ -19,3 +19,8 @@
NUM_KANA EQU 45 ; length of SortedPokemon table (see mobile/fixed_words.asm)
MOBILE_LOGIN_PASSWORD_LENGTH EQU 17
MOBILE_PHONE_NUMBER_LENGTH EQU 20
; Maximum amount of time allowed for mobile battles each day
MOBILE_BATTLE_ALLOWED_SECONDS EQU 0
MOBILE_BATTLE_ALLOWED_MINUTES EQU 10

View File

@ -79,7 +79,6 @@ _LinkAskTradeForText::
text "?"
done
; unused
UnknownText_0x1c422a::
text "To enter a mobile"
line "battle, you must"
@ -90,13 +89,11 @@ UnknownText_0x1c422a::
para "Is that OK?"
done
; unused
UnknownText_0x1c4275::
text "Need more info on"
line "mobile battles?"
done
; unused
UnknownText_0x1c4298::
text "For a mobile"
line "battle, choose"
@ -124,7 +121,6 @@ UnknownText_0x1c4298::
line "wins."
done
; unused
UnknownText_0x1c439c::
text "Today's remaining"
line "time is @"
@ -135,7 +131,6 @@ UnknownText_0x1c439c::
line "battle?"
done
; unused
UnknownText_0x1c43dc::
text "There are only @"
text_decimal wStringBuffer2, 1, 2
@ -146,7 +141,6 @@ UnknownText_0x1c43dc::
line "battle?"
done
; unused
UnknownText_0x1c4419::
text "There is only"
line "1 min. left today!"
@ -155,7 +149,6 @@ UnknownText_0x1c4419::
line "through a battle?"
done
; unused
UnknownText_0x1c445a::
text "There is less than"
line "1 min. left today!"
@ -164,31 +157,26 @@ UnknownText_0x1c445a::
line "tomorrow."
done
; unused
UnknownText_0x1c449c::
text "Try again using"
line "the same settings?"
done
; unused
UnknownText_0x1c44c0::
_MobileBattleLessThanOneMinuteLeftText::
text "There is less than"
line "1 min. left today!"
done
; unused
UnknownText_0x1c44e7::
_MobileBattleNoTimeLeftForLinkingText::
text "No time left for"
line "linking today."
done
; unused
UnknownText_0x1c4508::
text "Pick three #MON"
line "for battle."
done
; unused
UnknownText_0x1c4525::
text "Today's remaining"
line "time is @"

View File

@ -21,7 +21,7 @@ GetMobileOTTrainerClass: ; mobile function
.skip_male_trainers
ld a, [de]
cp $1
cp FEMALE
ld hl, MaleTrainers
jr nz, .finished

File diff suppressed because it is too large Load Diff

View File

@ -1102,13 +1102,13 @@ Function1006fd:
call CloseSRAM
ret
Function10070d:
ld a, $04
ld hl, $a800
MobileBattleFixTimer:
ld a, BANK(sMobileBattleTimer)
ld hl, sMobileBattleTimer
call GetSRAMBank
xor a
xor a ; MOBILE_BATTLE_ALLOWED_SECONDS
ld [hli], a
ld a, $0a
ld a, MOBILE_BATTLE_ALLOWED_MINUTES
ld [hli], a
xor a
ld [hli], a
@ -1125,8 +1125,8 @@ Function100720:
ld [wcd73], a
ldh a, [hSeconds]
ld [wcd74], a
ld a, $04
ld hl, $a800
ld a, BANK(sMobileBattleTimer)
ld hl, sMobileBattleTimer
call GetSRAMBank
ld a, [hli]
ld [wcd6c], a
@ -1335,9 +1335,11 @@ String_10088e:
String_10089f:
db " むせいげん@"
Function1008a6:
ld a, $04
ld hl, $a800
MobileBattleGetRemainingTime:
; Calculates the difference between 10 minutes and sMobileBattleTimer
; Returns minutes in c and seconds in b
ld a, BANK(sMobileBattleTimer)
ld hl, sMobileBattleTimer
call GetSRAMBank
ld a, [hli]
ld [wStringBuffer2], a
@ -1348,26 +1350,25 @@ Function1008a6:
call CloseSRAM
ld a, [wStringBuffer2 + 2]
ld b, a
ld a, 0
ld a, MOBILE_BATTLE_ALLOWED_SECONDS
sub b
jr nc, .asm_1008c8
add $3c
.asm_1008c8
jr nc, .no_carry_seconds
add 60
.no_carry_seconds
ld b, a
ld a, [wStringBuffer2 + 1]
ld c, a
ld a, $0a
ld a, MOBILE_BATTLE_ALLOWED_MINUTES
sbc c
ld c, a
jr c, .asm_1008da
jr c, .fail
ld a, [wStringBuffer2]
and a
jr nz, .asm_1008da
jr nz, .fail
ret
.asm_1008da
call Function10070d
.fail
call MobileBattleFixTimer
ld c, 0
ret
@ -3280,46 +3281,46 @@ Function10162a:
ld [wMobileCommsJumptableIndex], a
ret
Function101635:
ld de, wc608
MobileCopyTransferData:
ld de, wMobileTransferData
ld bc, $1e0
call FarCopyWRAM
ret
Function10163f:
ld hl, wc608
MobileCopyTransferData2:
ld hl, wMobileTransferData
ld bc, $1e0
call FarCopyWRAM
ret
Function101649:
ld a, $05
ld a, BANK(w5_d800)
ld hl, w5_d800
call Function101635
ld a, $05
call MobileCopyTransferData
ld a, BANK(w5_da00)
ld de, w5_da00
call Function10163f
call MobileCopyTransferData2
ret
Function10165a:
ld a, $05
ld a, BANK(w5_da00)
ld hl, w5_da00
call Function101635
call MobileCopyTransferData
ret
Function101663:
ld a, $05
ld a, BANK(w5_dc00)
ld hl, w5_d800
call Function101635
ld a, $05
call MobileCopyTransferData
ld a, BANK(w5_dc00)
ld de, w5_dc00
call Function10163f
call MobileCopyTransferData2
ret
Unreferenced_Function101674:
ld a, $05
ld a, BANK(w5_dc00)
ld hl, w5_dc00
call Function101635
call MobileCopyTransferData
ret
Function10167d:
@ -7443,7 +7444,7 @@ Function103700:
ld hl, wSwarmFlags
bit SWARMFLAGS_MOBILE_4_F, [hl]
jr z, .asm_10370f
farcall Function1008a6
farcall MobileBattleGetRemainingTime
.asm_10370f
ld a, c
@ -7564,7 +7565,7 @@ Function10378c:
ret
Function1037c2:
call Function103823
call MobileCheckRemainingBattleTime
jr c, .nope
ld a, [wdc5f]
and a
@ -7588,12 +7589,12 @@ UnknownText_0x1037e6:
text_end
Function1037eb:
call Function103823
call MobileCheckRemainingBattleTime
jr nc, .asm_103807
ld hl, UnknownText_0x103819
ld hl, MobileBattleLessThanOneMinuteLeftText
call PrintText
call JoyWaitAorB
ld hl, UnknownText_0x10381e
ld hl, MobileBattleNoTimeLeftForLinkingText
call PrintText
call JoyWaitAorB
xor a
@ -7613,28 +7614,29 @@ Function1037eb:
ld [wScriptVar], a
ret
UnknownText_0x103819:
text_far UnknownText_0x1c44c0
MobileBattleLessThanOneMinuteLeftText:
text_far _MobileBattleLessThanOneMinuteLeftText
text_end
UnknownText_0x10381e:
text_far UnknownText_0x1c44e7
MobileBattleNoTimeLeftForLinkingText:
text_far _MobileBattleNoTimeLeftForLinkingText
text_end
Function103823:
MobileCheckRemainingBattleTime:
; Returns carry if less than one minute remains
farcall Mobile_AlwaysReturnNotCarry
bit 7, c
jr nz, .asm_103838
farcall Function1008a6
jr nz, .ok
farcall MobileBattleGetRemainingTime
ld a, c
cp $01
jr c, .asm_10383a
cp 1
jr c, .fail
.asm_103838
.ok
xor a
ret
.asm_10383a
.fail
scf
ret
@ -7673,7 +7675,7 @@ Function10387b:
farcall Mobile_AlwaysReturnNotCarry
bit 7, c
ret nz
farcall Function1008a6
farcall MobileBattleGetRemainingTime
ld a, c
ld [wStringBuffer2], a
ld hl, UnknownText_0x103898

View File

@ -258,6 +258,10 @@ s4_a60c:: db ; a60c
s4_a60e:: dw ; a60e
ds $1f0
sMobileBattleTimer:: ds 3
SECTION "SRAM Mobile 2", SRAM

View File

@ -730,6 +730,9 @@ wPuzzlePieces:: ds 6 * 6
ds 244
wUnownPuzzleEnd::
NEXTU ; c608
wMobileTransferData:: ds $1e0
NEXTU ; c608
; This union spans 200 bytes from c608 to c6d0.
@ -759,7 +762,6 @@ wOddEggName:: ds MON_NAME_LENGTH
wOddEggOTName:: ds NAME_LENGTH
NEXTU ; c608
; mobile data
wc608:: ds 53
wc63d:: ds 5
wc642:: ds 5
@ -1052,14 +1054,15 @@ wc80e:: ds 1
wc80f:: ds 1
wc810:: ds 1
wc811:: ds 1
wc812:: ds 1
wc813:: ds 1
wMobileSDK_PacketChecksum:: dw ; c812
wc814:: ds 4
wc818:: ds 6
wMobileSDK_AdapterType:: db ; c818
ds 5
wMobileSDK_SendCommandID:: db ; c81e
ds 1
wc820:: ds 1
wc821:: ds 47
wc821:: ds 1
wc822:: ds 46
UNION ; c850
wMysteryGiftTrainerData:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 2
@ -1126,6 +1129,13 @@ NEXTU ; ca00
; link data
ds 191
wcabf:: ds 1
NEXTU ; ca00
ds $2f
wMobileSDK_ReceivePacketBufferAlt:: ds 11 ; ca2f
wMobileSDK_ReceivedBytes:: dw ; ca3a
wMobileSDK_ReceivePacketBuffer:: ; ca3c
ENDU ; cb00
ds 14
@ -3066,6 +3076,7 @@ NEXTU ; dd68
w3_de00:: ds $200
ENDU ; e000
SECTION "GBC Video", WRAMX, ALIGN[8]
; LCD expects wLYOverrides to have an alignment of $100