From 0f5540740bb494cfc6a5c724a2eeac4e064e9659 Mon Sep 17 00:00:00 2001 From: Andrew Cook Date: Thu, 15 Sep 2022 10:49:58 +1000 Subject: [PATCH] Some Mobile code labeling and removed magic numbers (#993) * Macro loop for EmptyAllSRAMBanks * Many things labeled and magic numbers removed * Conform to the style guide * Rename URLs in mobile_46 * MOBILEAPI_19 -> MOBILEAPI_TELEPHONESTATUS * Update engine/menus/empty_sram.asm Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> * Update ram/wram.asm Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> * Update mobile/mobile_46.asm Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> * Update mobile/mobile_46.asm Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> * Remove underscore from Set*DownloadURL symbols * Begin Labeling TradeCornerHoldMon routines * Add wMobileMon party_struct * Add TRADE_CORNER_REQUEST_LENGTH constant * Name battle tower action functions * Label trade corner send/receive buffer * Label the saved copy of the trade corner pokemon also fix mailmsg_jp * So many copies of decodeBase64Character * Label another buffer * Fix Alignment and use MOBILE_EMAIL_LENGTH * `Function11ad8a` -> `MobileIncJumptableIndex` * Apply Rangi Suggestions pass 1 Co-Authored-By: Rangi <35663410+Rangi42@users.noreply.github.com> * Apply Suggestions 2 Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> Co-authored-by: vulcandth --- constants/item_data_constants.asm | 9 +- constants/mobile_constants.asm | 9 +- data/events/special_pointers.asm | 2 +- engine/events/battle_tower/battle_tower.asm | 74 ++--- engine/events/odd_egg.asm | 6 +- engine/menus/empty_sram.asm | 10 +- layout.link | 2 + lib/mobile/main.asm | 262 +++++++-------- macros/ram.asm | 10 + mobile/mobile_40.asm | 16 +- mobile/mobile_41.asm | 2 +- mobile/mobile_45_2.asm | 2 +- mobile/mobile_45_sprite_engine.asm | 2 +- mobile/mobile_45_stadium.asm | 12 +- mobile/mobile_46.asm | 342 ++++++++++---------- mobile/mobile_5c.asm | 66 ++-- mobile/mobile_5f.asm | 73 ++--- ram/sram.asm | 36 ++- ram/wram.asm | 69 ++-- 19 files changed, 536 insertions(+), 468 deletions(-) diff --git a/constants/item_data_constants.asm b/constants/item_data_constants.asm index 4f466d411..af6b8478c 100644 --- a/constants/item_data_constants.asm +++ b/constants/item_data_constants.asm @@ -53,10 +53,11 @@ DEF MAX_PC_ITEMS EQU 50 DEF MAX_ITEM_STACK EQU 99 ; mail -DEF MAIL_LINE_LENGTH EQU $10 -DEF MAIL_MSG_LENGTH EQU $20 -DEF MAILBOX_CAPACITY EQU 10 -DEF MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct +DEF MAIL_LINE_LENGTH EQU $10 +DEF MAIL_MSG_LENGTH EQU $20 +DEF MAILBOX_CAPACITY EQU 10 +DEF MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct +DEF MAIL_STRUCT_LENGTH_JP EQU $2a ; mailmsg_jp struct ; held item effects const_def diff --git a/constants/mobile_constants.asm b/constants/mobile_constants.asm index 4adf151a6..dfc4b2cba 100644 --- a/constants/mobile_constants.asm +++ b/constants/mobile_constants.asm @@ -25,7 +25,7 @@ const MOBILEAPI_16 const MOBILEAPI_17 const MOBILEAPI_SETTIMER - const MOBILEAPI_19 + const MOBILEAPI_TELEPHONESTATUS const MOBILEAPI_1A const MOBILEAPI_1B const MOBILEAPI_1C @@ -61,3 +61,10 @@ DEF MOBILE_PHONE_NUMBER_LENGTH EQU 20 ; Maximum amount of time allowed for mobile battles each day DEF MOBILE_BATTLE_ALLOWED_SECONDS EQU 0 DEF MOBILE_BATTLE_ALLOWED_MINUTES EQU 10 + +; Trade corner request size +; DION addr $1e + request $8 + Name $5 +; + party struct $30 + OT $5 + NICK $5 +; + JP Mail struct $2a +DEF MOBILE_EMAIL_LENGTH EQU $1e +DEF TRADE_CORNER_REQUEST_LENGTH EQU $8f diff --git a/data/events/special_pointers.asm b/data/events/special_pointers.asm index d727e4bd2..36fa6d14c 100644 --- a/data/events/special_pointers.asm +++ b/data/events/special_pointers.asm @@ -123,7 +123,7 @@ SpecialsPointers:: ; Crystal only add_special Function11ac3e - add_special Function11b444 + add_special TradeCornerHoldMon add_special Function11b5e8 add_special Function11b7e5 add_special Function11b879 diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index 1e424f09e..6bdab76c5 100644 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -858,31 +858,31 @@ BattleTowerAction: dw BattleTowerAction_GetChallengeState dw BattleTowerAction_SetByteToQuickSaveChallenge dw BattleTowerAction_SetByteToCancelChallenge - dw Function1707ac - dw Function1707f4 + dw BattleTowerAction_05 + dw BattleTowerAction_06 dw SaveBattleTowerLevelGroup dw LoadBattleTowerLevelGroup dw BattleTower_CheckSaveFileExistsAndIsYours - dw Function1708b1 + dw BattleTowerAction_0A dw CheckMobileEventIndex - dw Function1708c8 - dw Function1708f0 + dw BattleTowerAction_0C + dw BattleTowerAction_0D dw BattleTowerAction_EggTicket - dw Function1709aa - dw Function1709bb - dw Function170a9c - dw Function170aa0 - dw Function170aaf - dw Function170abe - dw Function170ad7 - dw Function170807 - dw Function17081d + dw BattleTowerAction_0F + dw BattleTowerAction_10 + dw BattleTowerAction_11 + dw BattleTowerAction_12 + dw BattleTowerAction_13 + dw BattleTowerAction_14 + dw BattleTowerAction_15 + dw BattleTowerAction_16 + dw BattleTowerAction_17 dw BattleTowerAction_LevelCheck dw BattleTowerAction_UbersCheck dw ResetBattleTowerTrainersSRAM dw BattleTower_GiveReward - dw Function17071b - dw Function170729 + dw BattleTowerAction_1C + dw BattleTowerAction_1D dw BattleTower_RandomlyChooseReward dw BattleTower_SaveOptions @@ -932,7 +932,7 @@ BattleTower_GiveReward: ld [wScriptVar], a ret -Function17071b: +BattleTowerAction_1C: ld a, BANK(sBattleTowerChallengeState) call OpenSRAM ld a, BATTLETOWER_WON_CHALLENGE @@ -940,7 +940,7 @@ Function17071b: call CloseSRAM ret -Function170729: +BattleTowerAction_1D: ld a, BANK(sBattleTowerChallengeState) call OpenSRAM ld a, BATTLETOWER_RECEIVED_REWARD @@ -1019,7 +1019,7 @@ SetBattleTowerChallengeState: call CloseSRAM ret -Function1707ac: +BattleTowerAction_05: ld a, BANK(s5_aa8c) ; aka BANK(s5_be46) call OpenSRAM ld a, [s5_aa8c] @@ -1060,7 +1060,7 @@ Function1707ac: ld a, 8 ld [wScriptVar], a -Function1707f4: +BattleTowerAction_06: ld a, BANK(s5_be46) ; aka BANK(s5_aa8b) and BANK(s5_aa8c) call OpenSRAM xor a @@ -1070,7 +1070,7 @@ Function1707f4: call CloseSRAM ret -Function170807: +BattleTowerAction_16: call UpdateTime ld a, BANK(s5_b2f9) ; aka BANK(s5_b2fa) call OpenSRAM @@ -1081,7 +1081,7 @@ Function170807: call CloseSRAM ret -Function17081d: +BattleTowerAction_17: xor a ld [wScriptVar], a ld a, BANK(s5_b2f9) ; aka BANK(s5_b2fa) @@ -1168,13 +1168,13 @@ BattleTower_CheckSaveFileExistsAndIsYours: ld [wScriptVar], a ret -Function1708b1: ; BattleTowerAction $0a +BattleTowerAction_0A: xor a ld [wMusicFade], a call MaxVolume ret -CheckMobileEventIndex: ; BattleTowerAction $0b something to do with GS Ball +CheckMobileEventIndex: ; something to do with GS Ball ld a, BANK(sMobileEventIndex) call OpenSRAM ld a, [sMobileEventIndex] @@ -1182,7 +1182,7 @@ CheckMobileEventIndex: ; BattleTowerAction $0b something to do with GS Ball call CloseSRAM ret -Function1708c8: ; BattleTowerAction $0c +BattleTowerAction_0C: call UpdateTime ld a, BANK(s5_aa8b) ; aka BANK(s5_aa8c), BANK(s5_aa5d), BANK(s5_aa48), and BANK(s5_aa47) call OpenSRAM @@ -1201,7 +1201,7 @@ Function1708c8: ; BattleTowerAction $0c call CloseSRAM ret -Function1708f0: ; BattleTowerAction $0d +BattleTowerAction_0D: xor a ; FALSE ld [wScriptVar], a call UpdateTime @@ -1239,7 +1239,7 @@ Function170923: call CloseSRAM ret -BattleTowerAction_EggTicket: ; BattleTowerAction $0e +BattleTowerAction_EggTicket: xor a ; FALSE ld [wScriptVar], a ld a, EGG_TICKET @@ -1309,7 +1309,7 @@ endr String_MysteryJP: db "なぞナゾ@@" ; MYSTERY -Function1709aa: ; BattleTowerAction $0f +BattleTowerAction_0F: ldh a, [rSVBK] push af ld a, BANK(w3_d090) @@ -1320,7 +1320,7 @@ Function1709aa: ; BattleTowerAction $0f ldh [rSVBK], a ret -Function1709bb: ; BattleTowerAction $10 +BattleTowerAction_10: xor a ; FALSE ld [wScriptVar], a ld a, BANK(s5_a800) @@ -1366,15 +1366,15 @@ Function1709bb: ; BattleTowerAction $10 ret .Action4: - ld a, BANK(s5_b023) ; aka BANK(s5_a825) and BANK(s5_a826) + ld a, BANK(s5_b023) ; aka BANK(sOfferReqGender) and BANK(sOfferReqSpecies) call OpenSRAM ld hl, s5_b023 ld de, wc608 ld bc, 105 call CopyBytes - ld a, [s5_a825] + ld a, [sOfferReqGender] ld [wcd30], a - ld a, [s5_a826] + ld a, [sOfferReqSpecies] ld [wcd31], a call CloseSRAM farcall Function11b6b4 @@ -1444,11 +1444,11 @@ Function1709bb: ; BattleTowerAction $10 .no_scene_2 ret -Function170a9c: +BattleTowerAction_11: ld c, FALSE jr Set_s5_aa8d -Function170aa0: +BattleTowerAction_12: ld c, TRUE Set_s5_aa8d: ld a, BANK(s5_aa8d) @@ -1458,7 +1458,7 @@ Set_s5_aa8d: call CloseSRAM ret -Function170aaf: +BattleTowerAction_13: ld a, BANK(s5_aa8d) call OpenSRAM ld a, [s5_aa8d] @@ -1466,7 +1466,7 @@ Function170aaf: call CloseSRAM ret -Function170abe: +BattleTowerAction_14: call BattleTower_CheckSaveFileExistsAndIsYours ld a, [wScriptVar] and a @@ -1480,7 +1480,7 @@ Function170abe: call CloseSRAM ret -Function170ad7: +BattleTowerAction_15: ld a, BANK(sBattleTowerSaveFileFlags) call OpenSRAM ld a, [sBattleTowerSaveFileFlags] diff --git a/engine/events/odd_egg.asm b/engine/events/odd_egg.asm index 3321ad580..f30bc1b02 100644 --- a/engine/events/odd_egg.asm +++ b/engine/events/odd_egg.asm @@ -58,12 +58,12 @@ _GiveOddEgg: ; load species in wMobileMonSpecies ld a, EGG - ld [wMobileMonSpecies], a + ld [wMobileMonMiscSpecies], a ; load pointer to (wMobileMonSpecies - 1) in wMobileMonSpeciesPointer - ld a, LOW(wMobileMonSpecies - 1) + ld a, LOW(wMobileMonMiscSpecies - 1) ld [wMobileMonSpeciesPointer], a - ld a, HIGH(wMobileMonSpecies - 1) + ld a, HIGH(wMobileMonMiscSpecies - 1) ld [wMobileMonSpeciesPointer + 1], a ; load pointer to wOddEgg in wMobileMonStructPointer ld a, LOW(wOddEgg) diff --git a/engine/menus/empty_sram.asm b/engine/menus/empty_sram.asm index 264f08136..3c060d806 100644 --- a/engine/menus/empty_sram.asm +++ b/engine/menus/empty_sram.asm @@ -1,12 +1,8 @@ EmptyAllSRAMBanks: - ld a, 0 - call .EmptyBank - ld a, 1 - call .EmptyBank - ld a, 2 - call .EmptyBank - ld a, 3 +for x, NUM_SRAM_BANKS + ld a, x call .EmptyBank +endr ret .EmptyBank: diff --git a/layout.link b/layout.link index bf98d1fb4..eeff7219c 100644 --- a/layout.link +++ b/layout.link @@ -342,6 +342,8 @@ WRAMX 2 "Pic Animations" WRAMX 3 "Battle Tower RAM" +WRAMX 4 + "News Script RAM" WRAMX 5 align 8 "GBC Video" diff --git a/lib/mobile/main.asm b/lib/mobile/main.asm index 5d40eab1a..bf6f3c2c8 100644 --- a/lib/mobile/main.asm +++ b/lib/mobile/main.asm @@ -163,7 +163,7 @@ _MobileAPI:: dw Function1111fe dw Function1113fe dw MobileAPI_SetTimer - dw Function111541 + dw MobileAPI_TelephoneStatus dw Function111596 dw Function11162d dw Function11032c @@ -507,9 +507,9 @@ Function110291: ld c, a call MobileAPI_SetTimer ld hl, wc829 - ld a, $72 + ld a, LOW(wc872) ld [hli], a - ld a, $c8 + ld a, HIGH(wc872) ld [hl], a ld de, wMobileSDK_PacketBuffer ld b, MobilePacket_WriteConfigurationData.End - MobilePacket_WriteConfigurationData @@ -550,7 +550,7 @@ Function110291: ld a, l ld [wc880], a ld a, h - ld [wc881], a + ld [wc880 + 1], a ld b, c inc b call Function111f63 @@ -663,13 +663,13 @@ Function1103ac: jr c, .asm_1103d2 ld c, $12 call Function11039a - jr nc, .asm_1103d6 + jr nc, .isp_login .asm_1103d2 pop hl jp Function110231 -.asm_1103d6 +.isp_login xor a ldh [rTAC], a ld [wc86d], a @@ -678,11 +678,11 @@ Function1103ac: ld c, a call MobileAPI_SetTimer ld hl, wc829 - ld a, $80 + ld a, LOW(wc880) ld [hli], a - ld a, $c8 + ld a, HIGH(wc880) ld [hl], a - call Function110485 + call Mobile_DialTelephone push hl ld b, a call Function111f63 @@ -743,9 +743,9 @@ Function110438: ld c, a call MobileAPI_SetTimer ld hl, wc98f - ld a, $81 + ld a, LOW(wc880 + 1) ld [hli], a - ld a, $c8 + ld a, HIGH(wc880 + 1) ld [hli], a xor a ld [hli], a @@ -754,7 +754,7 @@ Function110438: ld [hl], a ld a, $ff ld [wc86e], a - call Function110485 + call Mobile_DialTelephone ld b, a call Function111f63 call Function1104b0 @@ -762,7 +762,7 @@ Function110438: ld [wc86a], a jr Function110432 -Function110485: +Mobile_DialTelephone: ld de, wMobileSDK_PacketBuffer ld hl, MobilePacket_DialTelephone ld b, MobilePacket_DialTelephone.End - MobilePacket_DialTelephone @@ -924,16 +924,16 @@ Function110596: ld a, e ld [wc86e], a ld a, d - ld [wc86f], a + ld [wc86e + 1], a xor a ld [wc819], a ld a, [wc870] ld c, a call MobileAPI_SetTimer ld hl, wc829 - ld a, $80 + ld a, LOW(wc880) ld [hli], a - ld a, $c8 + ld a, HIGH(wc880) ld [hl], a call Function1104b0 ld a, [wcb36] @@ -958,9 +958,9 @@ Function1105dd: ld c, a call MobileAPI_SetTimer ld hl, wc98f - ld a, $81 + ld a, LOW(wc880 + 1) ld [hli], a - ld a, $c8 + ld a, HIGH(wc880 + 1) ld [hli], a xor a ld [hli], a @@ -999,9 +999,9 @@ Function110615: push bc ld [wMobileSDK_PacketBuffer + 91], a ld hl, wc829 - ld a, $9d + ld a, LOW(wMobileSDK_PacketBuffer + 86) ld [hli], a - ld a, $cb + ld a, HIGH(wMobileSDK_PacketBuffer + 86) ld [hl], a xor a ld [wMobileSDK_PacketBuffer + 90], a @@ -1258,7 +1258,7 @@ Function1107ff: ld a, b ld [hli], a ld a, d - ld [wc86f], a + ld [wc86e + 1], a call Function112724 ld hl, wc98a ld a, [hl] @@ -1448,7 +1448,7 @@ Function1109a4: ld a, e ld [wc86e], a ld a, d - ld [wc86f], a + ld [wc86e + 1], a xor a ld [wc86b], a call Function112729 @@ -1488,7 +1488,7 @@ Function1109f9: ld a, e ld [wc86e], a ld a, d - ld [wc86f], a + ld [wc86e + 1], a ld a, l or h jp z, Function110231 @@ -1542,7 +1542,7 @@ Function110a5b: ld a, l ld [wc86e], a ld a, h - ld [wc86f], a + ld [wc86e + 1], a ld hl, wc827 ld a, e ld [hli], a @@ -1562,9 +1562,9 @@ Function110a5b: ld a, b ld [hl], a ld hl, wc829 - ld a, $80 + ld a, LOW(wc880) ld [hli], a - ld a, $c8 + ld a, HIGH(wc880) ld [hli], a ld a, $80 ld [hli], a @@ -1621,7 +1621,7 @@ Function110af4: ld a, b or c ld [wc86e], a - ld [wc86f], a + ld [wc86e + 1], a jr z, .asm_110b5c dec bc dec bc @@ -1664,7 +1664,7 @@ Function110af4: add hl, de ld a, [wc829] ld e, a - ld a, [wc82a] + ld a, [wc829 + 1] ld d, a call MobileSDK_CopyBytes pop bc @@ -1710,7 +1710,7 @@ Function110af4: add hl, de ld a, [wc829] ld e, a - ld a, [wc82a] + ld a, [wc829 + 1] ld d, a call MobileSDK_CopyBytes ld hl, wc829 @@ -1769,7 +1769,7 @@ Function110af4: add hl, de ld a, [wc829] ld e, a - ld a, [wc82a] + ld a, [wc829 + 1] ld d, a call MobileSDK_CopyBytes ld hl, wc827 @@ -1795,13 +1795,13 @@ Function110af4: add hl, de ld a, [wc829] ld e, a - ld a, [wc82a] + ld a, [wc829 + 1] ld d, a call MobileSDK_CopyBytes ld a, e ld [wc829], a ld a, d - ld [wc82a], a + ld [wc829 + 1], a pop bc ld a, [wc993] ld e, a @@ -1829,7 +1829,7 @@ Function110c3c: ld a, l ld [wc86e], a ld a, h - ld [wc86f], a + ld [wc86e + 1], a call Function112729 ld de, wMobileSDK_PacketBuffer ld hl, MobilePacket_TransferData @@ -1882,7 +1882,7 @@ Function110c9e: ld a, l ld [wc86e], a ld a, h - ld [wc86f], a + ld [wc86e + 1], a ld hl, wc827 ld a, e ld [hli], a @@ -1902,9 +1902,9 @@ Function110c9e: ld a, b ld [hl], a ld hl, wc829 - ld a, $80 + ld a, LOW(wc880) ld [hli], a - ld a, $c8 + ld a, HIGH(wc880) ld [hli], a ld a, $80 ld [hli], a @@ -2136,10 +2136,10 @@ Function110ddd: ld a, [hli] ld h, [hl] ld l, a - ld a, $80 + ld a, LOW(wc880) cp l jr nz, .asm_110e4a - ld a, $c8 + ld a, HIGH(wc880) cp h jr z, .asm_110dfd @@ -2403,7 +2403,7 @@ Function111044: ld a, b or c ld [wc86e], a - ld [wc86f], a + ld [wc86e + 1], a dec bc dec bc jp z, Function1111ca @@ -2438,7 +2438,7 @@ Function111044: add hl, de ld a, [wc829] ld e, a - ld a, [wc82a] + ld a, [wc829 + 1] ld d, a call MobileSDK_CopyBytes pop bc @@ -2492,7 +2492,7 @@ Function111044: add hl, de ld a, [wc829] ld e, a - ld a, [wc82a] + ld a, [wc829 + 1] ld d, a call MobileSDK_CopyBytes ld hl, wc829 @@ -2508,7 +2508,7 @@ Function111044: ld hl, wc821 res 2, [hl] ld a, [wMobileSDK_ReceivePacketBuffer] - cp $9f + cp MOBILE_COMMAND_TRANSFER_DATA_END | $80 jr z, .asm_111144 ld de, $000b ld a, MOBILE_COMMAND_TRANSFER_DATA | $80 @@ -2582,7 +2582,7 @@ Function11115f: add hl, de ld a, [wc829] ld e, a - ld a, [wc82a] + ld a, [wc829 + 1] ld d, a call MobileSDK_CopyBytes ld hl, wc829 @@ -2621,7 +2621,7 @@ Function11115f: add hl, de ld a, [wc829] ld e, a - ld a, [wc82a] + ld a, [wc829 + 1] ld d, a ld b, c call MobileSDK_CopyBytes @@ -2715,10 +2715,10 @@ endr ld a, [hli] ld h, [hl] ld l, a - ld a, $80 + ld a, LOW(wc880) cp l jr nz, .asm_111251 - ld a, $c8 + ld a, HIGH(wc880) cp h jp z, Function1113f7 @@ -3231,7 +3231,7 @@ Function11148c: Function111540: nop -Function111541: +MobileAPI_TelephoneStatus: ld hl, wc821 bit 0, [hl] jp nz, Function110226 @@ -3242,7 +3242,7 @@ Function111541: ld a, e ld [wc86e], a ld a, d - ld [wc86f], a + ld [wc86e + 1], a ld a, [wc807] cp $2 jr c, .asm_111582 @@ -3331,9 +3331,9 @@ Function1115e4: or a ld a, [wMobileSDK_ReceivePacketBuffer] jr z, .asm_111609 - cp $9f + cp MOBILE_COMMAND_TRANSFER_DATA_END | $80 jr z, .asm_11160d - cp $a4 + cp MOBILE_COMMAND_CLOSE_TCP_CONNECTION | $80 jr z, .asm_11160d .asm_111601 call Function112430 @@ -3862,7 +3862,7 @@ _Timer:: jr nz, .asm_11199c ld a, [hl] cp $1 - jp z, Function1119f0 + jp z, Function1119f0_BeginSession cp $a jr z, .asm_111984 cp $8 @@ -3936,7 +3936,7 @@ _Timer:: ld [wc80f], a jr .asm_1119a9 -Function1119f0: +Function1119f0_BeginSession: ld a, MOBILE_COMMAND_BEGIN_SESSION | $80 ld [wMobileSDK_SendCommandID], a ld [wc808], a @@ -4100,7 +4100,7 @@ Function111abd: ld a, $2 ld [wc810], a xor a - ld [wc811], a + ld [wc810 + 1], a .asm_111b1c ld a, $f1 jp Function111a42 @@ -4250,7 +4250,7 @@ Function111c17: ld a, [wMobileSDK_ReceivePacketBuffer] cp MOBILE_COMMAND_TRANSFER_DATA_END | $80 jp z, Function111d07 - ld a, [wc86f] + ld a, [wc86e + 1] ld b, a ld a, [wc86e] or b @@ -4374,7 +4374,7 @@ Function111cc2: ld [hl], e ld a, [wc829] ld e, a - ld a, [wc82a] + ld a, [wc829 + 1] ld d, a ld hl, wMobileSDK_ReceivePacketBuffer + 5 ld a, c @@ -4412,7 +4412,7 @@ Function111d07: Function111d23: ld a, [wc829] ld e, a - ld a, [wc82a] + ld a, [wc829 + 1] ld d, a ld hl, wMobileSDK_ReceivePacketBuffer + 4 ld b, $4 @@ -4817,35 +4817,35 @@ Function111f97: ret nz ld a, [wc807] cp $2 - jr c, .asm_111fcb + jr c, .done cp $5 - jr z, .asm_111fcb + jr z, .done cp $6 - jr nz, .asm_111fcd + jr nz, .hang_up ld a, [wc80f] cp $22 - jr z, .asm_111fcb + jr z, .done cp $23 - jr z, .asm_111fcb + jr z, .done cp $26 - jr z, .asm_111fcb + jr z, .done swap a and $f cp $1 - jr z, .asm_111fcb + jr z, .done cp $0 - jr z, .asm_111fcb + jr z, .done cp $8 - jr nz, .asm_111fcd -.asm_111fcb + jr nz, .hang_up +.done scf ret -.asm_111fcd +.hang_up ld b, $5 ld hl, wMobileSDK_SendCommandID ld a, [hl] cp -1 - jr z, .asm_111fe9 + jr z, .begin_session ld a, MOBILE_COMMAND_TELEPHONE_STATUS | $80 ld [hl], a ld hl, MobilePacket_TelephoneStatus @@ -4854,7 +4854,7 @@ Function111f97: ld hl, wc822 set 0, [hl] ret -.asm_111fe9 +.begin_session ld hl, MobilePacket_BeginSession ld de, MobilePacket_BeginSession.End - MobilePacket_BeginSession jp PacketSendBytes @@ -5077,7 +5077,7 @@ Function1121f6: ld a, [wMobileSDK_AdapterType] or a jr z, .asm_112206 - jr Function112269 + jr Mobile_EndSession .asm_112206 ld a, $10 @@ -5151,7 +5151,7 @@ Function11225d: ld hl, wc821 ret -Function112269: +Mobile_EndSession: ld a, MOBILE_COMMAND_END_SESSION | $80 ld hl, MobilePacket_EndSession jp PacketSendEmptyBody @@ -5180,9 +5180,9 @@ Function112271: .asm_112292 ld hl, wc829 - ld a, $e0 + ld a, LOW(wc8ca + 22) ld [hli], a - ld a, $c8 + ld a, HIGH(wc8ca + 22) ld [hli], a ld hl, MobilePacket_ReadConfigurationDataPart2 jp Function11236b @@ -5190,10 +5190,10 @@ Function112271: .asm_1122a1 ld hl, wc880 ld a, [hli] - cp $4d + cp "M" jr nz, .asm_1122f5 ld a, [hld] - cp $41 + cp "A" jr nz, .asm_1122f5 ld b, $be ld de, 0 @@ -5247,7 +5247,7 @@ Function112271: .asm_112301 ld a, $6 ld [wc86b], a - jp Function112269 + jp Mobile_EndSession .asm_112309 ld a, [wc821] @@ -5266,7 +5266,7 @@ Function112271: ld [wc872], a ld a, $6 ld [wc86b], a - jp Function112269 + jp Mobile_EndSession .asm_112326 ld d, a @@ -5301,9 +5301,9 @@ Function11234b: Function11235a: ld hl, wc86e - ld a, $80 + ld a, LOW(wc880) ld [hli], a - ld a, $c8 + ld a, HIGH(wc880) ld [hl], a ld a, MOBILE_COMMAND_TELEPHONE_STATUS | $80 ld hl, MobilePacket_TelephoneStatus @@ -5342,7 +5342,7 @@ Function112373: .asm_112393 ld a, $3 ld [wc86b], a - jp Function112269 + jp Mobile_EndSession .asm_11239b ld hl, wc822 @@ -5361,7 +5361,7 @@ Function112373: Function1123b6: dec a - jr z, .asm_1123be + jr z, .wait_for_call dec a jr z, .asm_1123c6 ret @@ -5369,7 +5369,7 @@ Function1123b6: .asm_1123bd dec [hl] -.asm_1123be +.wait_for_call ld a, MOBILE_COMMAND_WAIT_FOR_TELEPHONE_CALL | $80 ld hl, MobilePacket_WaitForTelephoneCall jp PacketSendEmptyBody @@ -5429,7 +5429,7 @@ Function1123e1: jp PacketSendEmptyBody .asm_11241e - jp Function112269 + jp Mobile_EndSession .asm_112421 ld hl, wc822 @@ -5688,9 +5688,9 @@ Function1125c7: ld [hli], a inc de inc de - ld a, $80 + ld a, LOW(wc880) ld [hli], a - ld a, $c8 + ld a, HIGH(wc880) ld [hli], a dec bc dec bc @@ -5883,9 +5883,9 @@ Function112729: ld [hld], a ld a, $ff ld [hld], a - ld a, $c8 + ld a, HIGH(wc880) ld [hld], a - ld a, $80 + ld a, LOW(wc880) ld [hl], a pop hl ret @@ -6158,7 +6158,7 @@ Function1128db: cp $9f jp z, Function1127cd call Function113482 - ld a, [wc86f] + ld a, [wc86e + 1] or a jr nz, .asm_112901 ld a, $3 @@ -6390,7 +6390,7 @@ Function112a56: call Function112aac ld a, [wc86e] ld c, a - ld a, [wc86f] + ld a, [wc86e + 1] ld b, a ld a, e ld [bc], a @@ -6497,15 +6497,15 @@ Function112b11: push af ld bc, $0300 ld de, wc872 - call Function112b60 - call nc, Function112b60 - call nc, Function112b60 + call .asm_112b60 + call nc, .asm_112b60 + call nc, .asm_112b60 dec hl .asm_112b2d ld a, [hli] - cp $d + cp "\r" jr z, .asm_112b36 - cp $20 + cp " " jr nz, .asm_112b2d .asm_112b36 @@ -6545,11 +6545,11 @@ Function112b11: ld [wc872], a ret -Function112b60: +.asm_112b60: ld a, [hli] - cp $30 + cp "0" jr c, .asm_112b6f - cp $3a + cp "9" + 1 jr nc, .asm_112b6f and $f ld [de], a @@ -6820,7 +6820,7 @@ Function112bec: .asm_112d09 ld a, [wc86e] ld l, a - ld a, [wc86f] + ld a, [wc86e + 1] or l ret z ld hl, wc827 @@ -6962,7 +6962,7 @@ Function112d33: .asm_112df2 ld a, [wc86e] ld l, a - ld a, [wc86f] + ld a, [wc86e + 1] or l ret z ld a, [wc86a] @@ -7097,7 +7097,7 @@ Function112d33: jr nz, .asm_112efb ld a, [wc86e] ld l, a - ld a, [wc86f] + ld a, [wc86e + 1] or l jr nz, .asm_112efb ld a, $2 @@ -7880,25 +7880,25 @@ Function1133de: Function1133fe: ld hl, wMobileSDK_PacketBuffer + 17 ld a, [hli] - cp $68 + cp "h" jr nz, .asm_113432 ld a, [hli] - cp $74 + cp "t" jr nz, .asm_113432 ld a, [hli] - cp $74 + cp "t" jr nz, .asm_113432 ld a, [hli] - cp $70 + cp "p" jr nz, .asm_113432 ld a, [hli] - cp $3a + cp ":" jr nz, .asm_113432 ld a, [hli] - cp $2f + cp "/" jr nz, .asm_113432 ld a, [hli] - cp $2f + cp "/" jr nz, .asm_113432 ld hl, wMobileSDK_PacketBuffer + 16 ld de, wc880 @@ -7911,7 +7911,7 @@ Function1133fe: .asm_113432 ld a, [wMobileSDK_PacketBuffer + 17] - cp $2f + cp "/" jr z, .asm_113460 ld de, wc880 ld hl, wc9b5 @@ -7928,7 +7928,7 @@ Function1133fe: ld h, d .asm_11344c ld a, [hld] - cp $2f + cp "/" jr nz, .asm_11344c inc hl inc hl @@ -7955,7 +7955,7 @@ Function1133fe: ld h, [hl] ld l, a ld a, [hl] - cp $2f + cp "/" jr z, .asm_113478 ld b, $7 call MobileSDK_CopyBytes @@ -7964,7 +7964,7 @@ Function1133fe: ld a, [hli] ld [de], a inc de - cp $2f + cp "/" jr nz, .asm_113478 dec de jr .asm_113455 @@ -8065,7 +8065,7 @@ Function1134cb: set 7, [hl] .asm_11350b - jp Function112269 + jp Mobile_EndSession .asm_11350e ld a, [wc86a] @@ -8091,23 +8091,23 @@ Function113519: .asm_11352d ld hl, wc829 - ld a, $e0 + ld a, LOW(wc8ca + 22) ld [hli], a - ld a, $c8 + ld a, HIGH(wc8ca + 22) ld [hli], a ld hl, MobilePacket_ReadConfigurationDataPart2 jp Function11236b .asm_11353c - jp Function112269 + jp Mobile_EndSession .asm_11353f ld hl, wc880 ld a, [hli] - cp $4d + cp "M" jr nz, .asm_113586 ld a, [hld] - cp $41 + cp "A" jr nz, .asm_113586 ld b, $be ld de, 0 @@ -8128,7 +8128,7 @@ Function113519: jr nz, .asm_11358a ld a, [wc86e] ld e, a - ld a, [wc86f] + ld a, [wc86e + 1] ld d, a ld hl, .asm_11357e push hl @@ -8297,7 +8297,7 @@ Function113626: jp Function111f02 .asm_11366c - jp Function112269 + jp Mobile_EndSession .asm_11366f jp Function1116a0 @@ -8351,7 +8351,7 @@ Function113672: jp Function11236b .asm_1136bb - jp Function112269 + jp Mobile_EndSession .asm_1136be jp Function1116a0 @@ -9188,7 +9188,7 @@ Function113d66: .asm_113d88 ld a, [de] inc de - call .Function113dfa + call .decodeBase64Character ld [hli], a dec b jr nz, .asm_113d88 @@ -9273,27 +9273,27 @@ endr ld [hl], a ret -.Function113dfa: - cp $2b +.decodeBase64Character: + cp "+" jr c, .asm_113e24 jr z, .asm_113e31 - cp $2f + cp "/" jr c, .asm_113e24 jr z, .asm_113e34 - cp $30 + cp "0" jr c, .asm_113e24 - cp $3a + cp "9" + 1 jr c, .asm_113e37 - cp $3d + cp "=" jr c, .asm_113e24 jr z, .asm_113e3a - cp $41 + cp "A" jr c, .asm_113e24 - cp $5b + cp "Z" + 1 jr c, .asm_113e3c - cp $61 + cp "a" jr c, .asm_113e24 - cp $7b + cp "z" + 1 jr c, .asm_113e3f .asm_113e24 diff --git a/macros/ram.asm b/macros/ram.asm index a1957aafc..652a21645 100644 --- a/macros/ram.asm +++ b/macros/ram.asm @@ -201,6 +201,16 @@ MACRO mailmsg \1End:: ENDM +MACRO mailmsg_jp +\1Message:: ds MAIL_MSG_LENGTH +\1MessageEnd:: db +\1Author:: ds NAME_LENGTH_JAPANESE - 1 +\1AuthorID:: dw +\1Species:: db +\1Type:: db +\1End:: +ENDM + MACRO roam_struct \1Species:: db \1Level:: db diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm index 7f14c4725..ce83fc0d2 100644 --- a/mobile/mobile_40.asm +++ b/mobile/mobile_40.asm @@ -2453,10 +2453,10 @@ endr ld [hl], e inc hl ld [hl], d - ld a, $07 + ld a, BANK(s7_a001) call OpenSRAM ld hl, wc608 - ld de, $a001 + ld de, s7_a001 ld bc, wc7bd - wc608 call CopyBytes call CloseSRAM @@ -2485,7 +2485,7 @@ Function10107d: ld bc, NAME_LENGTH call .CopyAllFromOT ld hl, wOTPartyMon1Species - ld de, $c699 + ld de, wc699 ld bc, PARTYMON_STRUCT_LENGTH call .CopyAllFromOT ld a, $50 @@ -3111,7 +3111,7 @@ Function1014a6: Function1014b7: call GetJoypad ldh a, [hJoyPressed] - and $03 + and A_BUTTON | B_BUTTON jr nz, .asm_1014c5 ld hl, wcd42 dec [hl] @@ -3831,7 +3831,7 @@ _StartMobileBattle: .CopyOTDetails: ldh a, [rSVBK] push af - ld a, 5 + ld a, BANK(w5_dc0d) ldh [rSVBK], a ld bc, w5_dc0d @@ -4723,13 +4723,13 @@ Function1020ea: ret Function102112: - ld a, $04 + ld a, BANK(s4_a03b) call OpenSRAM - ld hl, $a041 + ld hl, s4_a03b + 6 ld c, 40 .outer_loop push hl - ld de, $c60f + ld de, wc60f ld b, 31 .inner_loop ld a, [de] diff --git a/mobile/mobile_41.asm b/mobile/mobile_41.asm index 5c9fe6260..73b74b88e 100644 --- a/mobile/mobile_41.asm +++ b/mobile/mobile_41.asm @@ -943,7 +943,7 @@ Function1063e5: Function1063f3: ld de, wcd31 - ld a, MOBILEAPI_19 + ld a, MOBILEAPI_TELEPHONESTATUS call MobileAPI ld a, [wMobileCommsJumptableIndex] inc a diff --git a/mobile/mobile_45_2.asm b/mobile/mobile_45_2.asm index 912a453ec..82f2cc779 100644 --- a/mobile/mobile_45_2.asm +++ b/mobile/mobile_45_2.asm @@ -239,7 +239,7 @@ Function1166d6: cp $ff ret nz ld a, $4 - ld [$c319], a + ld [wc319], a xor a ld [wc314], a ret diff --git a/mobile/mobile_45_sprite_engine.asm b/mobile/mobile_45_sprite_engine.asm index 2e066a1ff..6a0cb09c9 100644 --- a/mobile/mobile_45_sprite_engine.asm +++ b/mobile/mobile_45_sprite_engine.asm @@ -666,7 +666,7 @@ Function1163c0: push af ld a, $5 ldh [rSVBK], a - ld hl, $c320 + ld hl, wc320 ld de, wd030 ld bc, $0010 call CopyBytes diff --git a/mobile/mobile_45_stadium.asm b/mobile/mobile_45_stadium.asm index 2b7f522ac..429bc7f55 100644 --- a/mobile/mobile_45_stadium.asm +++ b/mobile/mobile_45_stadium.asm @@ -25,7 +25,7 @@ Function11766b: ld de, wcd49 ld bc, $8 call CopyBytes - ld de, $c708 + ld de, wc708 ld bc, $11 call CopyBytes call CloseSRAM @@ -40,7 +40,7 @@ Function117699: ld de, $b1f3 ld bc, $8 call CopyBytes - ld hl, $c708 + ld hl, wc708 ld bc, $11 call CopyBytes call CloseSRAM @@ -52,7 +52,7 @@ Function117699: ld [wcd4d], a ld [wcd4e], a ld [wcd4f], a - ld hl, $c708 + ld hl, wc708 ld bc, $11 call ByteFill call ClearBGPalettes @@ -191,7 +191,7 @@ Function117764_b_button: ld [wcd4a], a ld e, a ld d, 0 - ld hl, $c708 + ld hl, wc708 add hl, de xor a ld [hl], a @@ -303,7 +303,7 @@ Function117764_a_button: ld b, 0 add hl, bc ld a, [hl] - ld hl, $c708 + ld hl, wc708 add hl, de ld [hl], a pop de @@ -402,7 +402,7 @@ Function117942: call OpenSRAM ld a, [wcd4f] ld [sMobileLoginPassword], a - ld hl, $c708 + ld hl, wc708 ld de, sMobileLoginPassword + 1 ld bc, MOBILE_LOGIN_PASSWORD_LENGTH call CopyBytes diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm index a3153a8b7..8c34693e4 100644 --- a/mobile/mobile_46.asm +++ b/mobile/mobile_46.asm @@ -559,7 +559,7 @@ Function1184a5: dw Function1188c8 dw Function11878d dw Function118903 - dw Function118a8f + dw SetExchangeDownloadURL dw Function11878d dw Function118d80 dw Function118d9b @@ -659,7 +659,7 @@ Function11857c: dw Function1188c8 dw Function11878d dw Function118903 - dw Function118a7a + dw SetBattleDownloadURL dw Function11878d dw Function11891c dw Function1198ee @@ -692,7 +692,7 @@ Function1185c3: dw Function1188c8 dw Function11878d dw Function118903 - dw Function118aa4 + dw SetNewsDownloadURL dw Function11878d dw Function118e92 dw Function11878d @@ -738,7 +738,7 @@ Function118624: dw Function1188c8 dw Function11878d dw Function118903 - dw Function118aa4 + dw SetNewsDownloadURL dw Function11878d dw Function118e92 dw Function11878d @@ -835,7 +835,7 @@ Function1186f5: dw Function1188c8 dw Function11878d dw Function118903 - dw Function118abc + dw SetStadiumDownloadURL dw Function11878d dw Function119451 dw Function1195f8 @@ -873,7 +873,7 @@ Function118746: dw Function1188c8 dw Function11878d dw Function118903 - dw Function118ad0 + dw SetOddEggDownloadURL dw Function11878d dw Function1196f2 dw Function1197c9 @@ -1067,7 +1067,7 @@ Function1188b8: jp Function119e2b Function1188c0: - ld de, wc3cd + ld de, wEmailAddress ld a, MOBILEAPI_08 jp Function119e2b @@ -1320,7 +1320,7 @@ Function118a65: ; unreferenced ld bc, $1000 jp Function118b10 -Function118a7a: +SetBattleDownloadURL: ld hl, BattleDownloadURL ld de, wcc60 ld bc, $80 @@ -1329,7 +1329,7 @@ Function118a7a: ld bc, $1000 jp Function118b10 -Function118a8f: +SetExchangeDownloadURL: ld hl, ExchangeDownloadURL ld de, wcc60 ld bc, $80 @@ -1338,7 +1338,7 @@ Function118a8f: ld bc, $1000 jp Function118b10 -Function118aa4: +SetNewsDownloadURL: ld hl, NewsDownloadURL ld de, wcc60 ld bc, $80 @@ -1349,8 +1349,8 @@ Function118aa4: ld bc, $e00 jr Function118b10 -Function118abc: - ld hl, MenuDownloadURL +SetStadiumDownloadURL: + ld hl, StadiumDownloadURL ld de, wcc60 ld bc, $80 call CopyBytes @@ -1358,8 +1358,8 @@ Function118abc: ld bc, $1000 jr Function118b10 -Function118ad0: - ld hl, IndexDownloadURL +SetOddEggDownloadURL: + ld hl, OddEggDownloadURL ld de, wcc60 ld bc, $80 call CopyBytes @@ -1411,13 +1411,13 @@ Function118b10: Function118b24: ld hl, wc346 - ld a, $8 + ld a, LOW(wc708) ld [hli], a - ld a, $c7 + ld a, HIGH(wc708) ld [hli], a - ld a, $60 + ld a, LOW(wcc60) ld [hli], a - ld a, $cc + ld a, HIGH(wcc60) ld [hli], a call Function119eb4 call Function119ec2 @@ -1494,10 +1494,10 @@ BattleDownloadURL: NewsDownloadURL: db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/news/index.txt", 0 -MenuDownloadURL: +StadiumDownloadURL: db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/POKESTA/menu.cgb", 0 -IndexDownloadURL: +OddEggDownloadURL: db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/tamago/index.txt", 0 popc @@ -1569,7 +1569,7 @@ asm_118d9f: ld a, [wcd38] and a jr nz, .asm_118db2 - ld a, $8f + ld a, TRADE_CORNER_REQUEST_LENGTH ld [wcd3b], a jr .asm_118db7 @@ -1579,17 +1579,17 @@ asm_118d9f: .asm_118db7 ld hl, w3_d800 - ld a, $8 + ld a, LOW(wc608) ld [hli], a - ld a, $c6 + ld a, HIGH(wc608) ld [hli], a ld a, [wcd3b] ld [hli], a xor a ld [hli], a - ld a, $8 + ld a, LOW(wc708) ld [hli], a - ld a, $c7 + ld a, HIGH(wc708) ld [hli], a ld a, [wcd39] ld [hli], a @@ -1752,9 +1752,9 @@ Function118ec6: call CopyBytes xor a ld [wc31f], a - ld a, $20 + ld a, LOW(wc320) ld [wc31b], a - ld a, $c3 + ld a, HIGH(wc320) ld [wc31c], a hlcoord 1, 14 ld a, l @@ -1834,21 +1834,21 @@ Function118f68: and a jr z, .asm_118fba ld hl, wc346 - ld a, LOW($c608) + ld a, LOW(wc608) ld [hli], a - ld a, HIGH($c608) + ld a, HIGH(wc608) ld [hli], a ld a, [wcd4b] ld [hli], a ld a, [wcd4c] ld [hli], a - ld a, LOW($c708) + ld a, LOW(wc708) ld [hli], a - ld a, HIGH($c708) + ld a, HIGH(wc708) ld [hli], a - ld a, $60 + ld a, LOW(wcc60) ld [hli], a - ld a, $cc + ld a, HIGH(wcc60) ld [hli], a call Function119eb4 call Function119ec2 @@ -1914,21 +1914,21 @@ Function119009: call Function1191ad ret c ld hl, wc346 - ld a, $8 + ld a, LOW(wc608) ld [hli], a - ld a, $c6 + ld a, HIGH(wc608) ld [hli], a ld a, [wcd4b] ld [hli], a ld a, [wcd4c] ld [hli], a - ld a, $8 + ld a, LOW(wc708) ld [hli], a - ld a, $c7 + ld a, HIGH(wc708) ld [hli], a - ld a, $60 + ld a, LOW(wcc60) ld [hli], a - ld a, $cc + ld a, HIGH(wcc60) ld [hli], a call Function119eb4 call Function119ec2 @@ -2202,7 +2202,7 @@ Function119223: ld [wcd4c], a ld a, BANK(s5_b092) ; aka BANK(s5_b1b1) and BANK(s5_b1b2) and BANK(s5_b1d3) call OpenSRAM - ld hl, wc3cd + ld hl, wEmailAddress ld de, s5_b092 ld bc, 31 call CopyBytes @@ -2460,9 +2460,9 @@ Function1193a0: ld [hli], a ld a, HIGH(wc708) ld [hli], a - ld a, $60 + ld a, LOW(wcc60) ld [hli], a - ld a, $cc + ld a, HIGH(wcc60) ld [hli], a call Function119eb4 call Function119ec2 @@ -2833,9 +2833,9 @@ Function119612: Function119629: call BattleTowerRoomMenu2 ret c - ld a, $60 + ld a, LOW(wcc60) ld l, a - ld a, $cc + ld a, HIGH(wcc60) ld h, a call Function118e39 ld a, $9 @@ -3291,12 +3291,12 @@ Function1198f7: jp Function119e2b Function119937: - farcall Function1707f4 + farcall BattleTowerAction_06 jp BattleTowerRoomMenu_IncrementJumptable Function119940: - ld de, wc3cd - ld c, $1e + ld de, wEmailAddress + ld c, MOBILE_EMAIL_LENGTH .asm_119945 ld a, [de] inc de @@ -3319,7 +3319,7 @@ Function119954: ld [wBattleTowerRoomMenu2JumptableIndex], a call BattleTowerRoomMenu2 ld hl, wc608 - ld de, wc3cd + ld de, wEmailAddress .asm_119962 ld a, [de] inc de @@ -5673,7 +5673,7 @@ Jumptable_11ad78: dw Function11af04 dw Function11af4e -Function11ad8a: +MobileIncJumptableIndex: ld hl, wJumptableIndex inc [hl] ret @@ -5694,7 +5694,7 @@ Function11ad95: lb bc, 8, 8 call Function11afd6 farcall ReloadMapPart - call Function11ad8a + call MobileIncJumptableIndex ld a, $1 ld [wMenuCursorY], a ld hl, Unknown_11afcc @@ -5768,7 +5768,7 @@ Function11adc4: ld [hl], a .asm_11ae2b - call Function11ad8a + call MobileIncJumptableIndex .asm_11ae2e call ExitMenu @@ -5807,7 +5807,7 @@ Function11ae4e: lb bc, 6, 11 call Function11afd6 farcall ReloadMapPart - call Function11ad8a + call MobileIncJumptableIndex ld a, $1 ld [wMenuCursorY], a ld hl, Unknown_11afd2 @@ -5869,7 +5869,7 @@ Function11ae98: ld a, [wcd4b] ld [wScriptVar], a call Function11b022 - call Function11ad8a + call MobileIncJumptableIndex .asm_11aef7 call ExitMenu @@ -5897,7 +5897,7 @@ Function11af04: lb bc, 6, 11 call Function11afd6 farcall ReloadMapPart - call Function11ad8a + call MobileIncJumptableIndex ld a, $2 ld [wMenuCursorY], a ld hl, Unknown_11afd2 @@ -6116,7 +6116,7 @@ Function11b082: call Function11b295 call Function11b275 call SetPalettes - jp Function11ad8a + jp MobileIncJumptableIndex Function11b099: ld c, $6 @@ -6249,7 +6249,7 @@ Function11b0ff: jr z, .asm_11b167 cp $ff jr z, .asm_11b16b - jp Function11ad8a + jp MobileIncJumptableIndex .asm_11b163 ld a, $1 @@ -6395,7 +6395,7 @@ Function11b20b: add [hl] ld e, a ld d, 0 - ld hl, $c6d0 + ld hl, wc6d0 add hl, de ld a, [hl] ld [wTempSpecies], a @@ -6500,9 +6500,9 @@ Function11b295: call Function11b20b call CheckSeenMemMon jr z, .asm_11b2d1 - ld a, [$c608] + ld a, [wc608] ld c, a - ld a, [$c608 + 1] + ld a, [wc608 + 1] ld b, a ld hl, $0007 add hl, bc @@ -6518,9 +6518,9 @@ Function11b295: jr .asm_11b2e7 .asm_11b2d1 - ld a, [$c608] + ld a, [wc608] ld c, a - ld a, [$c608 + 1] + ld a, [wc608 + 1] ld b, a ld hl, $0007 add hl, bc @@ -6531,7 +6531,7 @@ Function11b295: ld de, String_11b30e .asm_11b2e7 - ld a, $6 + ld a, NAME_LENGTH_JAPANESE ld bc, wStringBuffer4 .asm_11b2ec push af @@ -6791,10 +6791,10 @@ Function11b3d9: ld [hl], a ret -Function11b444: +TradeCornerHoldMon: ; special call Mobile46_InitJumptable - call Mobile46_RunJumptable + call TradeCornerHoldMon_RunJumptable ret Mobile46_InitJumptable: @@ -6806,7 +6806,7 @@ Mobile46_InitJumptable: call UpdateTime ret -Mobile46_RunJumptable: +TradeCornerHoldMon_RunJumptable: .loop call .IterateJumptable call DelayFrame @@ -6819,17 +6819,17 @@ Mobile46_RunJumptable: jumptable .Jumptable, wJumptableIndex .Jumptable: - dw Function11b483 + dw TradeCornerHoldMon_PrepareForUpload dw Function11b570 - dw Function11b5c0 - dw Function11b5e0 - dw Function11b5e7 ; unused + dw TradeCornerHoldMon_RemoveFromParty + dw TradeCornerHoldMon_Success + dw TradeCornerHoldMon_Noop ; unused -Function11b483: +TradeCornerHoldMon_PrepareForUpload: call .InitRAM ld hl, wPlayerName ld a, NAME_LENGTH_JAPANESE - 1 -.loop1 +.get_char push af ld a, [hli] ld [bc], a @@ -6837,24 +6837,26 @@ Function11b483: pop af dec a and a - jr nz, .loop1 + jr nz, .get_char ld de, PARTYMON_STRUCT_LENGTH ld hl, wPartyMon1Species ld a, [wcd82] dec a push af -.loop2 + +.get_next_party_mon and a - jr z, .okay + jr z, .got_selected_mon add hl, de dec a - jr .loop2 + jr .get_next_party_mon -.okay +.got_selected_mon push bc ld a, PARTYMON_STRUCT_LENGTH -.loop3 +.copy_mon_byte + ; copies wPartyMon to bc. push af ld a, [hli] ld [bc], a @@ -6862,9 +6864,9 @@ Function11b483: pop af dec a and a - jr nz, .loop3 + jr nz, .copy_mon_byte - pop de + pop de ; pushed from bc push bc ld a, [de] ld [wCurSpecies], a @@ -6961,10 +6963,10 @@ Function11b483: and a jr nz, .loop9 call CloseSRAM - jp Function11ad8a + jp MobileIncJumptableIndex .InitRAM: - ld bc, $c626 + ld bc, wOfferTrainerID ld a, [wPlayerID] ld [wcd2a], a ld [bc], a @@ -6985,19 +6987,19 @@ Function11b483: ld [bc], a inc bc - ld a, [wcd2e] + ld a, [wcd2e] ; offer gender ld [bc], a inc bc - ld a, [wcd2f] + ld a, [wcd2f] ; offer species ld [bc], a inc bc - ld a, [wcd30] + ld a, [wcd30] ; req gender ld [bc], a inc bc - ld a, [wd265] + ld a, [wd265] ; req species ld [bc], a inc bc ret @@ -7008,7 +7010,7 @@ Function11b570: and a jr nz, .exit call .SaveData - jp Function11ad8a + jp MobileIncJumptableIndex .exit ld a, $4 @@ -7020,7 +7022,7 @@ Function11b570: ldh [rSVBK], a ld hl, w3_d800 - ld de, $c608 + ld de, wc608 ld bc, w3_d88f - w3_d800 call CopyBytes @@ -7033,7 +7035,7 @@ Function11b570: ld a, $1 ld [de], a inc de - ld hl, $c608 + ld hl, wc608 ld bc, w3_d88f - w3_d800 call CopyBytes @@ -7052,36 +7054,36 @@ Function11b570: call CloseSRAM ret -Function11b5c0: +TradeCornerHoldMon_RemoveFromParty: ld a, [wcd82] dec a ld [wCurPartyMon], a xor a ; REMOVE_PARTY ld [wPokemonWithdrawDepositParameter], a farcall RemoveMonFromPartyOrBox - farcall Function170807 + farcall BattleTowerAction_16 farcall SaveAfterLinkTrade - jp Function11ad8a + jp MobileIncJumptableIndex -Function11b5e0: +TradeCornerHoldMon_Success: xor a ld [wScriptVar], a - jp Function11ad8a + jp MobileIncJumptableIndex -Function11b5e7: +TradeCornerHoldMon_Noop: ret Function11b5e8: ld a, $0 call OpenSRAM ld hl, wRTC - ld de, $c608 + ld de, wc608 ld bc, 4 call CopyBytes call CloseSRAM ld a, $5 call OpenSRAM - ld hl, $c608 + ld hl, wc608 ld de, $b08c ld bc, 4 call CopyBytes @@ -7145,7 +7147,7 @@ Function11b66d: jr .asm_11b6b0 .asm_11b691 - farcall Function17081d + farcall BattleTowerAction_17 ld a, [wScriptVar] and a jr z, .asm_11b6b0 @@ -7161,7 +7163,7 @@ Function11b66d: ldh [rSVBK], a .asm_11b6b0 - jp Function11ad8a + jp MobileIncJumptableIndex Function11b6b3: ret @@ -7170,74 +7172,74 @@ Function11b6b4: ld a, $5 call OpenSRAM ld a, [wcd30] - ld [$c708], a + ld [wc708], a ld a, [wcd31] - ld [$c709], a + ld [wc709], a - ld a, LOW($c708) ; Species + ld a, LOW(wc708) ld [wMobileMonSpeciesPointer], a - ld a, HIGH($c708) + ld a, HIGH(wc708) ld [wMobileMonSpeciesPointer + 1], a - ld a, LOW($c60d) ; Partymon Struct + ld a, LOW(wMobileMon) ld [wMobileMonStructPointer], a - ld a, HIGH($c60d) + ld a, HIGH(wMobileMon) ld [wMobileMonStructPointer + 1], a - ld a, LOW($c63d) ; OT + ld a, LOW(wMobileMonOT) ld [wMobileMonOTPointer], a - ld a, HIGH($c63d) + ld a, HIGH(wMobileMonOT) ld [wMobileMonOTPointer + 1], a - ld a, LOW($c642) ; Nickname + ld a, LOW(wMobileMonNick) ld [wMobileMonNicknamePointer], a - ld a, HIGH($c642) + ld a, HIGH(wMobileMonNick) ld [wMobileMonNicknamePointer + 1], a - ld a, LOW($c647) ; Mail + ld a, LOW(wMobileMonMail) ld [wMobileMonMailPointer], a - ld a, HIGH($c647) + ld a, HIGH(wMobileMonMail) ld [wMobileMonMailPointer + 1], a - ld a, $46 - ld [$c628], a + ld a, BASE_HAPPINESS + ld [wMobileMonHappiness], a - ld de, $c63d - ld c, 5 + ld de, wMobileMonOT + ld c, NAME_LENGTH_JAPANESE - 1 farcall CheckStringForErrors jr nc, .length_check_OT farcall Mobile_CopyDefaultOTName .length_check_OT - ld de, $c63d - lb bc, 1, 5 + ld de, wMobileMonOT + lb bc, 1, NAME_LENGTH_JAPANESE - 1 farcall CheckStringContainsLessThanBNextCharacters jr nc, .error_check_nick farcall Mobile_CopyDefaultOTName .error_check_nick - ld de, $c642 - ld c, 5 + ld de, wMobileMonNick + ld c, NAME_LENGTH_JAPANESE - 1 farcall CheckStringForErrors jr nc, .length_check_nick farcall Mobile_CopyDefaultNickname .length_check_nick - ld de, $c642 - lb bc, 1, 5 + ld de, wMobileMonNick + lb bc, 1, NAME_LENGTH_JAPANESE - 1 farcall CheckStringContainsLessThanBNextCharacters jr nc, .error_check_mail farcall Mobile_CopyDefaultNickname .error_check_mail - ld de, $c647 + ld de, wMobileMonMail ld c, MAIL_MSG_LENGTH + 1 farcall CheckStringForErrors jr nc, .length_check_mail farcall Mobile_CopyDefaultMail .length_check_mail - ld de, $c647 + ld de, wMobileMonMail lb bc, 2, MAIL_MSG_LENGTH + 1 farcall CheckStringContainsLessThanBNextCharacters jr c, .fix_mail @@ -7249,33 +7251,33 @@ Function11b6b4: farcall Mobile_CopyDefaultMail .mail_ok - ld de, $c668 - ld c, $5 + ld de, wMobileMonMailAuthor + ld c, NAME_LENGTH_JAPANESE - 1 farcall CheckStringForErrors jr nc, .length_check_author farcall Mobile_CopyDefaultMailAuthor .length_check_author - ld de, $c668 - lb bc, 1, 5 + ld de, wMobileMonMailAuthor + lb bc, 1, NAME_LENGTH_JAPANESE - 1 farcall CheckStringContainsLessThanBNextCharacters jr nc, .author_okay farcall Mobile_CopyDefaultMailAuthor .author_okay - ld a, [$c60e] + ld a, [wMobileMonItem] cp -1 jr nz, .item_okay xor a - ld [$c60e], a + ld [wMobileMonItem], a .item_okay ld a, [wcd31] - ld [$c60d], a + ld [wMobileMonSpecies], a ld [wCurSpecies], a call GetBaseData - ld hl, $c60d + MON_LEVEL + ld hl, wMobileMonLevel ld a, [hl] cp MIN_LEVEL ld a, MIN_LEVEL @@ -7289,12 +7291,12 @@ Function11b6b4: .done_level ld [wCurPartyLevel], a - ld hl, $c60d + MON_STAT_EXP - 1 - ld de, $c60d + MON_MAXHP + ld hl, wMobileMonExp + 2 + ld de, wMobileMonMaxHP ld b, TRUE predef CalcMonStats - ld de, $c60d + MON_MAXHP - ld hl, $c60d + MON_HP + ld de, wMobileMonMaxHP + ld hl, wMobileMonHP ld a, [de] ld [hli], a inc de @@ -7304,27 +7306,27 @@ Function11b6b4: ret Function11b7e5: - ld a, [$c60d] ; species + ld a, [wMobileMonSpecies] ld [wOTTrademonSpecies], a ld [wCurPartySpecies], a ld a, [wcd81] ld [wc74e], a - ld hl, $c63d ; OT + ld hl, wMobileMonOT ; OT ld de, wOTTrademonOTName ld bc, 5 call CopyBytes ld a, "@" ld [de], a - ld a, [$c60d + MON_ID] ; id + ld a, [wMobileMonID] ld [wOTTrademonID], a - ld a, [$c60d + MON_ID + 1] + ld a, [wMobileMonID + 1] ld [wOTTrademonID + 1], a - ld hl, $c60d + MON_DVS ; dvs + ld hl, wMobileMonDVs ld a, [hli] ld [wOTTrademonDVs], a ld a, [hl] ld [wOTTrademonDVs + 1], a - ld bc, $c60d ; pokemon_data_start + ld bc, wMobileMon ; pokemon_data_start farcall GetCaughtGender ld a, c ld [wOTTrademonCaughtData], a @@ -7340,10 +7342,10 @@ Function11b7e5: xor a ld [wLinkMode], a farcall SaveAfterLinkTrade - ld a, $5 + ld a, BANK(s5_a800) call OpenSRAM ld a, $5 - ld [$a800], a + ld [s5_a800], a call CloseSRAM ld a, [wMapGroup] ld b, a @@ -7366,17 +7368,17 @@ Function11b879: ld a, [wScriptVar] and a ret z - ld a, $5 + ld a, BANK(s5_a800) call OpenSRAM - ld a, [$a800] + ld a, [s5_a800] ld [wScriptVar], a - ld a, [$a890] + ld a, [s5_a890] ld [wcd49], a - ld a, [$a891] + ld a, [s5_a891] ld [wcd4a], a - ld a, [$a892] + ld a, [s5_a892] ld [wcd4b], a - ld a, [$a893] + ld a, [s5_a893] ld [wcd4c], a call CloseSRAM ld a, [wScriptVar] @@ -7455,10 +7457,10 @@ Function11b879: Function11b920: call Mobile46_InitJumptable - ld a, $5 + ld a, BANK(sOfferTrainerID) call OpenSRAM - ld hl, $a81f - ld de, $c626 + ld hl, sOfferTrainerID + ld de, wOfferTrainerID ld bc, 8 call CopyBytes call CloseSRAM @@ -7466,39 +7468,39 @@ Function11b920: ret Function11b93b: - ld a, $5 + ld a, BANK(s5_a800) call OpenSRAM xor a - ld [$a800], a - ld hl, $a823 - ld de, $c608 - ld bc, $008f + ld [s5_a800], a + ld hl, sOfferGender + ld de, wc608 + ld bc, TRADE_CORNER_REQUEST_LENGTH call CopyBytes call CloseSRAM - ld a, LOW($c608) + ld a, LOW(wUnknownGender) ld [wMobileMonSpeciesPointer], a - ld a, HIGH($c608) + ld a, HIGH(wUnknownGender) ld [wMobileMonSpeciesPointer + 1], a - ld a, LOW($c611) + ld a, LOW(wUnknownMon) ld [wMobileMonStructPointer], a - ld a, HIGH($c611) + ld a, HIGH(wUnknownMon) ld [wMobileMonStructPointer + 1], a - ld a, LOW($c641) + ld a, LOW(wUnknownMonOT) ld [wMobileMonOTPointer], a - ld a, HIGH($c641) + ld a, HIGH(wUnknownMonOT) ld [wMobileMonOTPointer + 1], a - ld a, LOW($c646) + ld a, LOW(wUnknownMonNick) ld [wMobileMonNicknamePointer], a - ld a, HIGH($c646) + ld a, HIGH(wUnknownMonNick) ld [wMobileMonNicknamePointer + 1], a - ld a, LOW($c64b) + ld a, LOW(wUnknownMonMail) ld [wMobileMonMailPointer], a - ld a, HIGH($c64b) + ld a, HIGH(wUnknownMonMail) ld [wMobileMonMailPointer + 1], a call AddMobileMonToParty farcall SaveAfterLinkTrade @@ -7532,7 +7534,7 @@ AddMobileMonToParty: ld hl, wPartyMon1Species ld bc, PARTYMON_STRUCT_LENGTH ld a, e - ld [wMobileMonSpecies], a + ld [wMobileMonIndex], a .loop2 add hl, bc dec a @@ -7549,7 +7551,7 @@ AddMobileMonToParty: ld hl, wPartyMonOTs ld bc, NAME_LENGTH - ld a, [wMobileMonSpecies] + ld a, [wMobileMonIndex] .loop3 add hl, bc dec a @@ -7568,7 +7570,7 @@ AddMobileMonToParty: ld hl, wPartyMonNicknames ld bc, MON_NAME_LENGTH - ld a, [wMobileMonSpecies] + ld a, [wMobileMonIndex] .loop4 add hl, bc dec a @@ -7587,7 +7589,7 @@ AddMobileMonToParty: ld hl, sPartyMail ld bc, MAIL_STRUCT_LENGTH - ld a, [wMobileMonSpecies] + ld a, [wMobileMonIndex] .loop5 add hl, bc dec a diff --git a/mobile/mobile_5c.asm b/mobile/mobile_5c.asm index 60a843939..f5a8707e1 100644 --- a/mobile/mobile_5c.asm +++ b/mobile/mobile_5c.asm @@ -1,68 +1,68 @@ Function170000: - ld a, [$c62b] + ld a, [wOfferSpecies] ld [wPlayerTrademonSpecies], a - ld hl, $c62e + ld hl, wOfferMonSender ld de, wPlayerTrademonSenderName - ld bc, $0005 + ld bc, NAME_LENGTH_JAPANESE - 1 call CopyBytes - ld a, $50 + ld a, "@" ld [de], a - ld hl, $c663 + ld hl, wOfferMonOT ld de, wPlayerTrademonOTName - ld bc, $0005 + ld bc, NAME_LENGTH_JAPANESE - 1 call CopyBytes - ld a, $50 + ld a, "@" ld [de], a - ld hl, $c648 + ld hl, wOfferMonDVs ld a, [hli] ld [wPlayerTrademonDVs], a ld a, [hl] ld [wPlayerTrademonDVs + 1], a - ld hl, $c639 + ld hl, wOfferMonID ld a, [hli] ld [wPlayerTrademonID], a ld a, [hl] ld [wPlayerTrademonID + 1], a - ld bc, $c633 + ld bc, wOfferMon farcall GetCaughtGender ld a, c ld [wPlayerTrademonCaughtData], a ld a, [wcd81] ld [wc74e], a - ld hl, $c608 + ld hl, wc608 ld de, $d800 - ld bc, $008f + ld bc, TRADE_CORNER_REQUEST_LENGTH call CopyBytes ret Function17005a: - ld a, $5 + ld a, BANK(sOfferMon) call OpenSRAM - ld a, [$a824] + ld a, [sOfferSpecies] ld [wOTTrademonSpecies], a - ld hl, $a827 + ld hl, sOfferMonSender ld de, wOTTrademonSenderName ld bc, NAME_LENGTH_JAPANESE - 1 call CopyBytes ld a, "@" ld [de], a - ld hl, $a85c + ld hl, sOfferMonOT ld de, wOTTrademonOTName ld bc, NAME_LENGTH_JAPANESE - 1 call CopyBytes ld a, "@" ld [de], a - ld hl, $a841 + ld hl, sOfferMonDVs ld a, [hli] ld [wOTTrademonDVs], a ld a, [hl] ld [wOTTrademonDVs + 1], a - ld hl, $a832 + ld hl, sOfferMonID ld a, [hli] ld [wOTTrademonID], a ld a, [hl] ld [wOTTrademonID + 1], a - ld bc, $a82c + ld bc, sOfferMon farcall GetCaughtGender ld a, c ld [wOTTrademonCaughtData], a @@ -413,10 +413,10 @@ Function171ac9: Function171ad7: xor a - ld hl, $c608 + ld hl, wc608 ld bc, $66 call ByteFill - ld de, $c608 + ld de, wc608 ld a, MOBILEAPI_06 call MobileAPI jp Function171c66 @@ -445,7 +445,7 @@ Function171aec: jr nz, .asm_171b01 hlcoord 2, 7 ld a, $3 - ld de, $c608 + ld de, wc608 .asm_171b1b push af push hl @@ -515,16 +515,16 @@ Function171b4b: Function171b85: ld hl, hJoyPressed ld a, [hl] - and $2 + and B_BUTTON jp nz, Function171b9f ld a, [hl] - and $1 + and A_BUTTON jp nz, Function171bbd ld a, [hl] - and $40 + and D_UP jr nz, asm_171ba5 ld a, [hl] - and $80 + and D_DOWN jr nz, asm_171baf ret @@ -562,10 +562,10 @@ Function171bbd: Function171bcc: ld hl, hJoyPressed ld a, [hl] - and $2 + and B_BUTTON jp nz, Function171bdc ld a, [hl] - and $1 + and A_BUTTON jp nz, Function171beb ret @@ -579,10 +579,10 @@ Function171bdc: ret Function171beb: - ld a, $5 + ld a, BANK(s5_aa4a) call OpenSRAM ld a, [wcd4a] - ld [$aa4a], a + ld [s5_aa4a], a call CloseSRAM ld hl, MenuHeader_171c6b call LoadMenuHeader @@ -652,7 +652,7 @@ Function171c87: call DisableLCD ld hl, AsciiFontGFX ld de, vTiles2 tile $00 - ld bc, $6e0 + ld bc, $6e tiles call CopyBytes ld hl, PasswordSlowpokeLZ ld de, vTiles0 tile $00 @@ -724,7 +724,7 @@ Function171d2b: call DisableLCD ld hl, AsciiFontGFX ld de, vTiles2 tile $00 - ld bc, $6e0 + ld bc, $6e tiles call CopyBytes ld hl, PasswordSlowpokeLZ ld de, vTiles0 tile $00 @@ -797,7 +797,7 @@ Function172e78: call DisableLCD ld hl, Stadium2N64GFX ld de, vTiles2 tile $00 - ld bc, $610 + ld bc, $61 tiles call CopyBytes call EnableLCD ld hl, Stadium2N64Tilemap diff --git a/mobile/mobile_5f.asm b/mobile/mobile_5f.asm index 8bc03e2a5..a7f301848 100644 --- a/mobile/mobile_5f.asm +++ b/mobile/mobile_5f.asm @@ -265,27 +265,27 @@ CheckStringForErrors_IgnoreTerminator: ret Function17d0f3: - ld a, [wc608 + 5] + ld a, [wMobileMonSpecies] ld [wOTTrademonSpecies], a ld [wCurPartySpecies], a ld a, [wcd81] ld [wc74e], a - ld hl, wc608 + 53 + ld hl, wMobileMonOT ld de, wOTTrademonOTName - ld bc, 5 + ld bc, NAME_LENGTH_JAPANESE - 1 call CopyBytes ld a, "@" ld [de], a - ld a, [wc608 + 11] + ld a, [wMobileMonID] ld [wOTTrademonID], a - ld a, [wc608 + 12] + ld a, [wMobileMonID + 1] ld [wOTTrademonID + 1], a - ld hl, wc608 + 26 + ld hl, wMobileMonDVs ld a, [hli] ld [wOTTrademonDVs], a ld a, [hl] ld [wOTTrademonDVs + 1], a - ld bc, wc608 + 5 + ld bc, wMobileMonSpecies farcall GetCaughtGender ld a, c ld [wOTTrademonCaughtData], a @@ -301,10 +301,10 @@ Function17d0f3: xor a ld [wLinkMode], a farcall SaveAfterLinkTrade - ld a, $5 + ld a, BANK(s5_a800) call OpenSRAM - ld a, $5 - ld [$a800], a + ld a, BANK(s5_a800) + ld [s5_a800], a call CloseSRAM ld a, [wMapGroup] ld b, a @@ -324,8 +324,8 @@ Function17d0f3: Mobile_CopyDefaultOTName: ld hl, Mobile5F_PlayersName - ld de, wc63d - ld bc, 5 + ld de, wMobileMonOT + ld bc, NAME_LENGTH_JAPANESE - 1 call CopyBytes ret @@ -334,8 +334,8 @@ Mobile5F_PlayersName: Mobile_CopyDefaultNickname: ld hl, .DefaultNickname - ld de, wc642 - ld bc, 5 + ld de, wMobileMonNick + ld bc, NAME_LENGTH_JAPANESE - 1 call CopyBytes ret @@ -344,26 +344,27 @@ Mobile_CopyDefaultNickname: Mobile_CopyDefaultMail: ld a, "@" - ld hl, wc647 + ld hl, wMobileMonMail ld bc, MAIL_MSG_LENGTH + 1 call ByteFill ld hl, .DefaultMessage - ld de, wc647 - ld bc, 6 + ld de, wMobileMonMail + ld bc, .DefaultMessageEnd - .DefaultMessage call CopyBytes ret .DefaultMessage: db "こんにちは@" +.DefaultMessageEnd: Mobile_CopyDefaultMailAuthor: ld a, "@" - ld de, wc668 - ld bc, 5 + ld de, wMobileMonMailAuthor + ld bc, NAME_LENGTH_JAPANESE - 1 call ByteFill ld hl, Mobile5F_PlayersName - ld de, wc668 - ld bc, 5 + ld de, wMobileMonMailAuthor + ld bc, NAME_LENGTH_JAPANESE - 1 call CopyBytes ret @@ -542,20 +543,20 @@ Function17d2ce: ret Function17d314: - ld a, $5 + ld a, BANK(s5_b1b1) call OpenSRAM - ld a, [$b1b1] + ld a, [s5_b1b1] call CloseSRAM cp $21 jr nc, .asm_17d354 - ld a, $6 + ld a, BANK(s6_a006) call OpenSRAM - ld l, $0 + ld l, 0 ld h, l - ld de, $a006 - ld a, [$a004] + ld de, s6_a006 + ld a, [s6_a004] ld c, a - ld a, [$a005] + ld a, [s6_a005] ld b, a .asm_17d336 push bc @@ -569,10 +570,10 @@ Function17d314: ld a, b or c jr nz, .asm_17d336 - ld a, [$a002] + ld a, [s6_a002] cp l jr nz, .asm_17d354 - ld a, [$a003] + ld a, [s6_a003] cp h jr nz, .asm_17d354 call CloseSRAM @@ -635,10 +636,10 @@ Function17d370: ld [wBGMapBuffer], a ld a, $d0 ld [wcd21], a - ld a, $6 + ld a, BANK(s6_a006) call OpenSRAM - ld hl, $a006 - ld de, wBGPals1 + ld hl, s6_a006 + ld de, w4_d000 ld bc, $1000 call CopyBytes call CloseSRAM @@ -1176,11 +1177,11 @@ Function17d78d: ld a, [hli] ld b, a call HlToCrashCheckPointer - ld a, $6 + ld a, BANK(s6_a006) call OpenSRAM - ld hl, $a006 + ld hl, s6_a006 add hl, bc - ld de, wBGPals1 + ld de, w4_d000 ld bc, $1000 call CopyBytes call CloseSRAM diff --git a/ram/sram.asm b/ram/sram.asm index 85b3b829b..12dfd895e 100644 --- a/ram/sram.asm +++ b/ram/sram.asm @@ -286,13 +286,23 @@ sTrainerRankingsBackup:: ds sTrainerRankingsEnd - sTrainerRankings s5_a800:: db - ds $24 - -s5_a825:: db -s5_a826:: db - - ds $6d +sOfferEmail:: ds MOBILE_EMAIL_LENGTH +sOfferTrainerID:: dw +sOfferSecretID:: dw +sOfferGender:: db +sOfferSpecies:: db +sOfferReqGender:: db +sOfferReqSpecies:: db +sOfferMonSender:: ds NAME_LENGTH_JAPANESE - 1 +sOfferMon:: party_struct sOfferMon +sOfferMonOT:: ds NAME_LENGTH_JAPANESE - 1 +sOfferMonNick:: ds NAME_LENGTH_JAPANESE - 1 +sOfferMonMail:: mailmsg_jp sOfferMonMail +s5_a890:: db +s5_a891:: db +s5_a892:: db +s5_a893:: db s5_a894:: ds 6 s5_a89a:: dw s5_a89c:: ds 22 @@ -372,13 +382,19 @@ s5_bfff:: db SECTION "SRAM Mobile 3", SRAM -s6_a000:: - +s6_a000:: db + db +s6_a002:: db +s6_a003:: db +s6_a004:: db +s6_a005:: db +s6_a006:: ds $1000 SECTION "SRAM Mobile 4", SRAM -s7_a000:: +s7_a000:: db +s7_a001:: db - ds $800 + ds $7fe s7_a800:: db diff --git a/ram/wram.asm b/ram/wram.asm index fc85e5870..be841992b 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -275,7 +275,8 @@ wSpriteAnimDataEnd:: ; mobile data wc3cc:: ds 1 -wc3cd:: ds 31 +wEmailAddress:: ds MOBILE_EMAIL_LENGTH + ds 1 wc3ec:: ds 1 wc3ed:: ds 1 wc3ee:: ds 1 @@ -668,16 +669,46 @@ wDebugDarkTileColor:: ds 2 wDebugBlackTileColor:: ds 2 NEXTU -wc608:: ds 16 -wc618:: ds 37 -wc63d:: ds 5 -wc642:: ds 5 -wc647:: ds 1 +wMobileMonSender:: ds NAME_LENGTH_JAPANESE - 1 +wMobileMon:: party_struct wMobileMon +wMobileMonOT:: ds NAME_LENGTH_JAPANESE - 1 +wMobileMonNick:: ds NAME_LENGTH_JAPANESE - 1 +wMobileMonMail:: mailmsg_jp wMobileMonMail + +NEXTU +wOfferEmail:: ds MOBILE_EMAIL_LENGTH +wOfferTrainerID:: dw +wOfferSecretID:: dw +wOfferGender:: db +wOfferSpecies:: db +wOfferReqGender:: db +wOfferReqSpecies:: db +wOfferMonSender:: ds NAME_LENGTH_JAPANESE - 1 +wOfferMon:: party_struct wOfferMon +wOfferMonOT:: ds NAME_LENGTH_JAPANESE - 1 +wOfferMonNick:: ds NAME_LENGTH_JAPANESE - 1 +wOfferMonMail:: mailmsg_jp wOfferMonMail + +NEXTU +wUnknownGender:: db +wUnknownSpecies:: db +wUnknownReqGender:: db +wUnknownReqSpecies:: db +wUnknownMonSender:: ds NAME_LENGTH_JAPANESE - 1 +wUnknownMon:: party_struct wUnknownMon +wUnknownMonOT:: ds NAME_LENGTH_JAPANESE - 1 +wUnknownMonNick:: ds NAME_LENGTH_JAPANESE - 1 +wUnknownMonMail:: mailmsg_jp wUnknownMonMail + +NEXTU +wc608:: ds 7 +wc60f:: ds 9 +wc618:: ds 48 wc648:: ds 2 -wc64a:: ds 30 -wc668:: ds 32 +wc64a:: ds 62 wc688:: ds 2 -wc68a:: ds 30 +wc68a:: ds 15 +wc699:: ds 15 wc6a8:: ds 40 ENDU @@ -1103,8 +1134,7 @@ wc80b:: db wc80c:: dw wc80e:: db wc80f:: db -wc810:: db -wc811:: db +wc810:: dw wMobileSDK_PacketChecksum:: dw wc814:: db wc815:: db @@ -1122,8 +1152,7 @@ wc821:: db wc822:: db wc823:: ds 4 wc827:: dw -wc829:: db -wc82a:: db +wc829:: dw wc82b:: db wc82c:: db wc82d:: db @@ -1141,8 +1170,7 @@ wc86a:: db wc86b:: db wc86c:: db wc86d:: db -wc86e:: db -wc86f:: db +wc86e:: dw wc870:: db wc871:: db wc872:: db @@ -1158,8 +1186,7 @@ wc87c:: db wc87d:: db wc87e:: db wc87f:: db -wc880:: db -wc881:: db +wc880:: dw wc882:: db wc883:: db wc884:: ds 8 @@ -1309,7 +1336,8 @@ wcd27:: ds 1 wcd28:: ds 1 wcd29:: ds 1 -wMobileMonSpecies:: +wMobileMonIndex:: +wMobileMonMiscSpecies:: wcd2a:: db UNION @@ -3465,6 +3493,11 @@ w3_de00:: ds $200 ENDU +SECTION "News Script RAM", WRAMX + +w4_d000:: ds $1000 + + SECTION "GBC Video", WRAMX, ALIGN[8] ; eight 4-color palettes each