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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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