mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Identify link.asm WRAM labels based on ax6's research notes <https://pastebin.com/NTxjzKGQ>
This commit is contained in:
parent
9fea403be2
commit
6f226f584c
@ -22,17 +22,25 @@ USING_EXTERNAL_CLOCK EQU $01
|
|||||||
USING_INTERNAL_CLOCK EQU $02
|
USING_INTERNAL_CLOCK EQU $02
|
||||||
CONNECTION_NOT_ESTABLISHED EQU $ff
|
CONNECTION_NOT_ESTABLISHED EQU $ff
|
||||||
|
|
||||||
|
; length of a patch list (less than any of the signal bytes)
|
||||||
|
SERIAL_PATCH_LIST_LENGTH EQU $fc
|
||||||
; signals the start of an array of bytes transferred over the link cable
|
; signals the start of an array of bytes transferred over the link cable
|
||||||
SERIAL_PREAMBLE_BYTE EQU $fd
|
SERIAL_PREAMBLE_BYTE EQU $fd
|
||||||
; this byte is used when there is no data to send
|
; this byte is used when there is no data to send
|
||||||
SERIAL_NO_DATA_BYTE EQU $fe
|
SERIAL_NO_DATA_BYTE EQU $fe
|
||||||
; signals the end of one part of a patch list (there are two parts) for player/enemy party data
|
; signals the end of one part of a patch list (there are two parts) for player/enemy party data
|
||||||
SERIAL_PATCH_LIST_PART_TERMINATOR EQU $ff
|
SERIAL_PATCH_LIST_PART_TERMINATOR EQU $ff
|
||||||
|
; used to replace SERIAL_NO_DATA_BYTE
|
||||||
|
SERIAL_PATCH_REPLACEMENT_BYTE EQU $ff
|
||||||
|
|
||||||
SERIAL_PREAMBLE_LENGTH EQU 6
|
SERIAL_PREAMBLE_LENGTH EQU 6
|
||||||
SERIAL_RN_PREAMBLE_LENGTH EQU 7
|
SERIAL_RN_PREAMBLE_LENGTH EQU 7
|
||||||
SERIAL_RNS_LENGTH EQU 10
|
SERIAL_RNS_LENGTH EQU 10
|
||||||
|
|
||||||
|
SERIAL_MAIL_PREAMBLE_BYTE EQU $20
|
||||||
|
SERIAL_MAIL_REPLACEMENT_BYTE EQU $21
|
||||||
|
SERIAL_MAIL_PREAMBLE_LENGTH EQU 5
|
||||||
|
|
||||||
; timeout duration after exchanging a byte
|
; timeout duration after exchanging a byte
|
||||||
SERIAL_LINK_BYTE_TIMEOUT EQU $5000
|
SERIAL_LINK_BYTE_TIMEOUT EQU $5000
|
||||||
|
|
||||||
|
@ -82,14 +82,14 @@ Gen2ToGen1LinkComms:
|
|||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
ld hl, wLinkData
|
ld hl, wLinkData
|
||||||
ld de, wOTPlayerName
|
ld de, wOTPartyData
|
||||||
ld bc, $1a8
|
ld bc, SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + 1 + PARTY_LENGTH + 1 + (REDMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3
|
||||||
call Serial_ExchangeBytes
|
call Serial_ExchangeBytes
|
||||||
ld a, SERIAL_NO_DATA_BYTE
|
ld a, SERIAL_NO_DATA_BYTE
|
||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
ld hl, wLink_c608
|
ld hl, wPlayerPatchLists
|
||||||
ld de, wTrademons
|
ld de, wOTPatchLists
|
||||||
ld bc, 200
|
ld bc, 200
|
||||||
call Serial_ExchangeBytes
|
call Serial_ExchangeBytes
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ Gen2ToGen1LinkComms:
|
|||||||
|
|
||||||
call Link_CopyRandomNumbers
|
call Link_CopyRandomNumbers
|
||||||
|
|
||||||
ld hl, wOTPlayerName
|
ld hl, wOTPartyData
|
||||||
call Link_FindFirstNonControlCharacter_SkipZero
|
call Link_FindFirstNonControlCharacter_SkipZero
|
||||||
push hl
|
push hl
|
||||||
ld bc, NAME_LENGTH
|
ld bc, NAME_LENGTH
|
||||||
@ -113,11 +113,11 @@ Gen2ToGen1LinkComms:
|
|||||||
jp nc, ExitLinkCommunications
|
jp nc, ExitLinkCommunications
|
||||||
|
|
||||||
ld de, wLinkData
|
ld de, wLinkData
|
||||||
ld bc, $1a2
|
ld bc, NAME_LENGTH + 1 + PARTY_LENGTH + 1 + (REDMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3
|
||||||
call Link_CopyOTData
|
call Link_CopyOTData
|
||||||
|
|
||||||
ld de, wPlayerTrademon
|
ld de, wOTPatchLists
|
||||||
ld hl, wTimeCapsulePlayerData
|
ld hl, wLinkPatchList1
|
||||||
ld c, 2
|
ld c, 2
|
||||||
.loop
|
.loop
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
@ -143,7 +143,7 @@ Gen2ToGen1LinkComms:
|
|||||||
jr .loop
|
jr .loop
|
||||||
|
|
||||||
.next
|
.next
|
||||||
ld hl, wc90f
|
ld hl, wLinkPatchList2
|
||||||
dec c
|
dec c
|
||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
|
|
||||||
@ -156,6 +156,7 @@ Gen2ToGen1LinkComms:
|
|||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
|
|
||||||
.party_loop
|
.party_loop
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
cp -1
|
cp -1
|
||||||
@ -238,23 +239,23 @@ Gen2ToGen2LinkComms:
|
|||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
ld hl, wLinkData
|
ld hl, wLinkData
|
||||||
ld de, wOTPlayerName
|
ld de, wOTPartyData
|
||||||
ld bc, $1c2
|
ld bc, SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + 1 + PARTY_LENGTH + 1 + 2 + (PARTYMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3
|
||||||
call Serial_ExchangeBytes
|
call Serial_ExchangeBytes
|
||||||
ld a, SERIAL_NO_DATA_BYTE
|
ld a, SERIAL_NO_DATA_BYTE
|
||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
ld hl, wLink_c608
|
ld hl, wPlayerPatchLists
|
||||||
ld de, wTrademons
|
ld de, wOTPatchLists
|
||||||
ld bc, 200
|
ld bc, 200
|
||||||
call Serial_ExchangeBytes
|
call Serial_ExchangeBytes
|
||||||
|
|
||||||
ld a, [wLinkMode]
|
ld a, [wLinkMode]
|
||||||
cp LINK_TRADECENTER
|
cp LINK_TRADECENTER
|
||||||
jr nz, .not_trading
|
jr nz, .not_trading
|
||||||
ld hl, wc9f4
|
ld hl, wLinkPlayerMail
|
||||||
ld de, wcb84
|
ld de, wLinkOTMail
|
||||||
ld bc, $186
|
ld bc, wLinkPlayerMailEnd - wLinkPlayerMail
|
||||||
call ExchangeBytes
|
call ExchangeBytes
|
||||||
|
|
||||||
.not_trading
|
.not_trading
|
||||||
@ -267,14 +268,14 @@ Gen2ToGen2LinkComms:
|
|||||||
|
|
||||||
call Link_CopyRandomNumbers
|
call Link_CopyRandomNumbers
|
||||||
|
|
||||||
ld hl, wOTPlayerName
|
ld hl, wOTPartyData
|
||||||
call Link_FindFirstNonControlCharacter_SkipZero
|
call Link_FindFirstNonControlCharacter_SkipZero
|
||||||
ld de, wLinkData
|
ld de, wLinkData
|
||||||
ld bc, $1b9
|
ld bc, NAME_LENGTH + 1 + PARTY_LENGTH + 1 + 2 + (PARTYMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH
|
||||||
call Link_CopyOTData
|
call Link_CopyOTData
|
||||||
|
|
||||||
ld de, wPlayerTrademon
|
ld de, wPlayerTrademon
|
||||||
ld hl, wLinkPlayerData
|
ld hl, wLinkPatchList1
|
||||||
ld c, 2
|
ld c, 2
|
||||||
.loop1
|
.loop1
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
@ -300,33 +301,33 @@ Gen2ToGen2LinkComms:
|
|||||||
jr .loop1
|
jr .loop1
|
||||||
|
|
||||||
.next1
|
.next1
|
||||||
ld hl, wc90f
|
ld hl, wLinkPatchList2
|
||||||
dec c
|
dec c
|
||||||
jr nz, .loop1
|
jr nz, .loop1
|
||||||
|
|
||||||
ld a, [wLinkMode]
|
ld a, [wLinkMode]
|
||||||
cp LINK_TRADECENTER
|
cp LINK_TRADECENTER
|
||||||
jp nz, .skip_mail
|
jp nz, .skip_mail
|
||||||
ld hl, wcb84
|
ld hl, wLinkOTMail
|
||||||
.loop2
|
.loop2
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
cp MAIL_MSG_LENGTH
|
cp SERIAL_MAIL_PREAMBLE_BYTE
|
||||||
jr nz, .loop2
|
jr nz, .loop2
|
||||||
.loop3
|
.loop3
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
cp SERIAL_NO_DATA_BYTE
|
cp SERIAL_NO_DATA_BYTE
|
||||||
jr z, .loop3
|
jr z, .loop3
|
||||||
cp MAIL_MSG_LENGTH
|
cp SERIAL_MAIL_PREAMBLE_BYTE
|
||||||
jr z, .loop3
|
jr z, .loop3
|
||||||
dec hl
|
dec hl
|
||||||
ld de, wcb84
|
ld de, wLinkOTMail
|
||||||
ld bc, $190 ; 400
|
ld bc, wLinkDataEnd - wLinkOTMail ; should be wLinkOTMailEnd - wLinkOTMail
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
ld hl, wcb84
|
ld hl, wLinkOTMail
|
||||||
ld bc, $c6 ; 198
|
ld bc, (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||||
.loop4
|
.loop4
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp MAIL_MSG_LENGTH + 1
|
cp SERIAL_MAIL_REPLACEMENT_BYTE
|
||||||
jr nz, .okay1
|
jr nz, .okay1
|
||||||
ld [hl], SERIAL_NO_DATA_BYTE
|
ld [hl], SERIAL_NO_DATA_BYTE
|
||||||
.okay1
|
.okay1
|
||||||
@ -335,13 +336,13 @@ Gen2ToGen2LinkComms:
|
|||||||
ld a, b
|
ld a, b
|
||||||
or c
|
or c
|
||||||
jr nz, .loop4
|
jr nz, .loop4
|
||||||
ld de, wcc9e
|
ld de, wOTPlayerMailPatchSet
|
||||||
.loop5
|
.loop5
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
inc de
|
inc de
|
||||||
cp SERIAL_PATCH_LIST_PART_TERMINATOR
|
cp SERIAL_PATCH_LIST_PART_TERMINATOR
|
||||||
jr z, .start_copying_mail
|
jr z, .start_copying_mail
|
||||||
ld hl, wcc4a
|
ld hl, wLinkOTMailMetadata
|
||||||
dec a
|
dec a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld c, a
|
ld c, a
|
||||||
@ -350,8 +351,8 @@ Gen2ToGen2LinkComms:
|
|||||||
jr .loop5
|
jr .loop5
|
||||||
|
|
||||||
.start_copying_mail
|
.start_copying_mail
|
||||||
ld hl, wcb84
|
ld hl, wLinkOTMail
|
||||||
ld de, wc9f4
|
ld de, wLinkReceivedMail
|
||||||
ld b, PARTY_LENGTH
|
ld b, PARTY_LENGTH
|
||||||
.copy_mail_loop
|
.copy_mail_loop
|
||||||
push bc
|
push bc
|
||||||
@ -366,7 +367,7 @@ Gen2ToGen2LinkComms:
|
|||||||
pop bc
|
pop bc
|
||||||
dec b
|
dec b
|
||||||
jr nz, .copy_mail_loop
|
jr nz, .copy_mail_loop
|
||||||
ld de, wc9f4
|
ld de, wLinkReceivedMail
|
||||||
ld b, PARTY_LENGTH
|
ld b, PARTY_LENGTH
|
||||||
.copy_author_loop
|
.copy_author_loop
|
||||||
push bc
|
push bc
|
||||||
@ -382,7 +383,7 @@ Gen2ToGen2LinkComms:
|
|||||||
dec b
|
dec b
|
||||||
jr nz, .copy_author_loop
|
jr nz, .copy_author_loop
|
||||||
ld b, PARTY_LENGTH
|
ld b, PARTY_LENGTH
|
||||||
ld de, wc9f4
|
ld de, wLinkReceivedMail
|
||||||
.fix_mail_loop
|
.fix_mail_loop
|
||||||
push bc
|
push bc
|
||||||
push de
|
push de
|
||||||
@ -409,7 +410,7 @@ Gen2ToGen2LinkComms:
|
|||||||
pop bc
|
pop bc
|
||||||
dec b
|
dec b
|
||||||
jr nz, .fix_mail_loop
|
jr nz, .fix_mail_loop
|
||||||
ld de, wcb0e
|
ld de, wLinkReceivedMailEnd
|
||||||
xor a
|
xor a
|
||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
@ -605,7 +606,7 @@ FixDataForLinkTransfer:
|
|||||||
dec b
|
dec b
|
||||||
jr nz, .rn_loop
|
jr nz, .rn_loop
|
||||||
|
|
||||||
ld hl, wLink_c608
|
ld hl, wPlayerPatchLists
|
||||||
ld a, SERIAL_PREAMBLE_BYTE
|
ld a, SERIAL_PREAMBLE_BYTE
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
@ -618,13 +619,13 @@ FixDataForLinkTransfer:
|
|||||||
dec b
|
dec b
|
||||||
jr nz, .loop1
|
jr nz, .loop1
|
||||||
|
|
||||||
ld hl, wTimeCapsulePlayerData - 1 + PARTY_LENGTH
|
ld hl, (wLinkData + SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + 1 + PARTY_LENGTH + 1) - 1
|
||||||
ld de, wc612
|
ld de, wPlayerPatchLists + 10 ; ???
|
||||||
lb bc, 0, 0
|
lb bc, 0, 0
|
||||||
.loop2
|
.loop2
|
||||||
inc c
|
inc c
|
||||||
ld a, c
|
ld a, c
|
||||||
cp SERIAL_PREAMBLE_BYTE
|
cp SERIAL_PATCH_LIST_LENGTH + 1
|
||||||
jr z, .next1
|
jr z, .next1
|
||||||
ld a, b
|
ld a, b
|
||||||
dec a
|
dec a
|
||||||
@ -632,9 +633,9 @@ FixDataForLinkTransfer:
|
|||||||
push bc
|
push bc
|
||||||
ld a, [wLinkMode]
|
ld a, [wLinkMode]
|
||||||
cp LINK_TIMECAPSULE
|
cp LINK_TIMECAPSULE
|
||||||
ld b, $d
|
ld b, REDMON_STRUCT_LENGTH * PARTY_LENGTH - SERIAL_PATCH_LIST_LENGTH + 1
|
||||||
jr z, .got_value
|
jr z, .got_value
|
||||||
ld b, $27
|
ld b, 2 + PARTYMON_STRUCT_LENGTH * PARTY_LENGTH - SERIAL_PATCH_LIST_LENGTH + 1
|
||||||
.got_value
|
.got_value
|
||||||
ld a, c
|
ld a, c
|
||||||
cp b
|
cp b
|
||||||
@ -648,7 +649,7 @@ FixDataForLinkTransfer:
|
|||||||
ld a, c
|
ld a, c
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
ld [hl], SERIAL_PATCH_LIST_PART_TERMINATOR
|
ld [hl], SERIAL_PATCH_REPLACEMENT_BYTE
|
||||||
jr .loop2
|
jr .loop2
|
||||||
|
|
||||||
.next1
|
.next1
|
||||||
@ -872,12 +873,12 @@ Link_PrepPartyData_Gen2:
|
|||||||
cp LINK_TRADECENTER
|
cp LINK_TRADECENTER
|
||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
; Fill 5 bytes at wc9f4 with $20
|
; Fill 5 bytes at wLinkPlayerMailPreamble with $20
|
||||||
ld de, wc9f4
|
ld de, wLinkPlayerMailPreamble
|
||||||
ld a, $20
|
ld a, SERIAL_MAIL_PREAMBLE_BYTE
|
||||||
call Link_CopyMailPreamble
|
call Link_CopyMailPreamble
|
||||||
|
|
||||||
; Copy all the mail messages to wc9f9
|
; Copy all the mail messages to wLinkPlayerMailMessages
|
||||||
ld a, BANK(sPartyMail)
|
ld a, BANK(sPartyMail)
|
||||||
call OpenSRAM
|
call OpenSRAM
|
||||||
ld hl, sPartyMail
|
ld hl, sPartyMail
|
||||||
@ -886,26 +887,26 @@ Link_PrepPartyData_Gen2:
|
|||||||
push bc
|
push bc
|
||||||
ld bc, MAIL_MSG_LENGTH + 1
|
ld bc, MAIL_MSG_LENGTH + 1
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
ld bc, sPartyMon1MailEnd - sPartyMon1MailAuthor
|
ld bc, MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)
|
||||||
add hl, bc
|
add hl, bc
|
||||||
pop bc
|
pop bc
|
||||||
dec b
|
dec b
|
||||||
jr nz, .loop2
|
jr nz, .loop2
|
||||||
; Copy the mail data to wcabf
|
; Copy the mail data to wLinkPlayerMailMetadata
|
||||||
ld hl, sPartyMail
|
ld hl, sPartyMail
|
||||||
ld b, PARTY_LENGTH
|
ld b, PARTY_LENGTH
|
||||||
.loop3
|
.loop3
|
||||||
push bc
|
push bc
|
||||||
ld bc, MAIL_MSG_LENGTH + 1
|
ld bc, MAIL_MSG_LENGTH + 1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld bc, sPartyMon1MailEnd - sPartyMon1MailAuthor
|
ld bc, MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
pop bc
|
pop bc
|
||||||
dec b
|
dec b
|
||||||
jr nz, .loop3
|
jr nz, .loop3
|
||||||
ld b, PARTY_LENGTH
|
ld b, PARTY_LENGTH
|
||||||
ld de, sPartyMail
|
ld de, sPartyMail
|
||||||
ld hl, wc9f9
|
ld hl, wLinkPlayerMailMessages
|
||||||
.loop4
|
.loop4
|
||||||
push bc
|
push bc
|
||||||
push hl
|
push hl
|
||||||
@ -931,20 +932,20 @@ Link_PrepPartyData_Gen2:
|
|||||||
ld d, h
|
ld d, h
|
||||||
ld e, l
|
ld e, l
|
||||||
pop hl
|
pop hl
|
||||||
ld bc, sPartyMon1MailAuthor - sPartyMon1Mail
|
ld bc, MAIL_MSG_LENGTH + 1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
pop bc
|
pop bc
|
||||||
dec b
|
dec b
|
||||||
jr nz, .loop4
|
jr nz, .loop4
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
|
|
||||||
ld hl, wc9f9
|
ld hl, wLinkPlayerMailMessages
|
||||||
ld bc, PARTY_LENGTH * (sPartyMon1MailAuthor - sPartyMon1Mail)
|
ld bc, (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||||
.loop5
|
.loop5
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp SERIAL_NO_DATA_BYTE
|
cp SERIAL_NO_DATA_BYTE
|
||||||
jr nz, .skip2
|
jr nz, .skip2
|
||||||
ld [hl], sPartyMon1MailAuthor - sPartyMon1Mail
|
ld [hl], SERIAL_MAIL_REPLACEMENT_BYTE
|
||||||
.skip2
|
.skip2
|
||||||
inc hl
|
inc hl
|
||||||
dec bc
|
dec bc
|
||||||
@ -952,16 +953,16 @@ Link_PrepPartyData_Gen2:
|
|||||||
or c
|
or c
|
||||||
jr nz, .loop5
|
jr nz, .loop5
|
||||||
|
|
||||||
ld hl, wcabf
|
ld hl, wLinkPlayerMailMetadata
|
||||||
ld de, wcb13
|
ld de, wLinkPlayerMailPatchSet
|
||||||
ld b, PARTY_LENGTH * (sPartyMon1MailEnd - sPartyMon1MailAuthor)
|
ld b, (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH
|
||||||
ld c, $0
|
ld c, 0
|
||||||
.loop6
|
.loop6
|
||||||
inc c
|
inc c
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp SERIAL_NO_DATA_BYTE
|
cp SERIAL_NO_DATA_BYTE
|
||||||
jr nz, .skip3
|
jr nz, .skip3
|
||||||
ld [hl], SERIAL_PATCH_LIST_PART_TERMINATOR
|
ld [hl], SERIAL_PATCH_REPLACEMENT_BYTE
|
||||||
ld a, c
|
ld a, c
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
@ -976,7 +977,7 @@ Link_PrepPartyData_Gen2:
|
|||||||
|
|
||||||
Link_CopyMailPreamble:
|
Link_CopyMailPreamble:
|
||||||
; fill 5 bytes with the value of a, starting at de
|
; fill 5 bytes with the value of a, starting at de
|
||||||
ld c, 5
|
ld c, SERIAL_MAIL_PREAMBLE_LENGTH
|
||||||
.loop
|
.loop
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
@ -989,7 +990,7 @@ Link_ConvertPartyStruct1to2:
|
|||||||
ld d, h
|
ld d, h
|
||||||
ld e, l
|
ld e, l
|
||||||
ld bc, wLinkOTPartyMonTypes
|
ld bc, wLinkOTPartyMonTypes
|
||||||
ld hl, wcbe8
|
ld hl, wCurLinkOTPartyMonTypePtr
|
||||||
ld a, c
|
ld a, c
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hl], b
|
ld [hl], b
|
||||||
@ -1039,7 +1040,7 @@ Link_ConvertPartyStruct1to2:
|
|||||||
ld a, [de]
|
ld a, [de]
|
||||||
inc de
|
inc de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wcbe8
|
ld hl, wCurLinkOTPartyMonTypePtr
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld h, [hl]
|
ld h, [hl]
|
||||||
ld l, a
|
ld l, a
|
||||||
@ -1050,9 +1051,9 @@ Link_ConvertPartyStruct1to2:
|
|||||||
ld [hli], a
|
ld [hli], a
|
||||||
inc de
|
inc de
|
||||||
ld a, l
|
ld a, l
|
||||||
ld [wcbe8], a
|
ld [wCurLinkOTPartyMonTypePtr], a
|
||||||
ld a, h
|
ld a, h
|
||||||
ld [wcbe8 + 1], a
|
ld [wCurLinkOTPartyMonTypePtr + 1], a
|
||||||
push bc
|
push bc
|
||||||
ld hl, MON_ITEM
|
ld hl, MON_ITEM
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -1481,7 +1482,7 @@ LinkTrade_TradeStatsMenu:
|
|||||||
farcall CheckAnyOtherAliveMonsForTrade
|
farcall CheckAnyOtherAliveMonsForTrade
|
||||||
jp nc, LinkTrade
|
jp nc, LinkTrade
|
||||||
xor a
|
xor a
|
||||||
ld [wcf57], a
|
ld [wUnusedLinkAction], a
|
||||||
ld [wOtherPlayerLinkAction], a
|
ld [wOtherPlayerLinkAction], a
|
||||||
hlcoord 0, 12
|
hlcoord 0, 12
|
||||||
ld b, 4
|
ld b, 4
|
||||||
@ -1495,7 +1496,7 @@ LinkTrade_TradeStatsMenu:
|
|||||||
|
|
||||||
.abnormal
|
.abnormal
|
||||||
xor a
|
xor a
|
||||||
ld [wcf57], a
|
ld [wUnusedLinkAction], a
|
||||||
ld [wOtherPlayerLinkAction], a
|
ld [wOtherPlayerLinkAction], a
|
||||||
ld a, [wCurOTTradePartyMon]
|
ld a, [wCurOTTradePartyMon]
|
||||||
ld hl, wOTPartySpecies
|
ld hl, wOTPartySpecies
|
||||||
@ -1655,7 +1656,7 @@ LinkEngine_FillBox:
|
|||||||
|
|
||||||
LinkTrade:
|
LinkTrade:
|
||||||
xor a
|
xor a
|
||||||
ld [wcf57], a
|
ld [wUnusedLinkAction], a
|
||||||
ld [wOtherPlayerLinkAction], a
|
ld [wOtherPlayerLinkAction], a
|
||||||
hlcoord 0, 12
|
hlcoord 0, 12
|
||||||
ld b, 4
|
ld b, 4
|
||||||
@ -1784,7 +1785,7 @@ LinkTrade:
|
|||||||
ld bc, MAIL_STRUCT_LENGTH
|
ld bc, MAIL_STRUCT_LENGTH
|
||||||
call AddNTimes
|
call AddNTimes
|
||||||
push hl
|
push hl
|
||||||
ld hl, wc9f4
|
ld hl, wLinkPlayerMail
|
||||||
ld a, [wCurOTTradePartyMon]
|
ld a, [wCurOTTradePartyMon]
|
||||||
ld bc, MAIL_STRUCT_LENGTH
|
ld bc, MAIL_STRUCT_LENGTH
|
||||||
call AddNTimes
|
call AddNTimes
|
||||||
@ -2554,7 +2555,7 @@ Link_ResetSerialRegistersAfterLinkClosure:
|
|||||||
Link_EnsureSync:
|
Link_EnsureSync:
|
||||||
add $d0
|
add $d0
|
||||||
ld [wPlayerLinkAction], a
|
ld [wPlayerLinkAction], a
|
||||||
ld [wcf57], a
|
ld [wUnusedLinkAction], a
|
||||||
ld a, $2
|
ld a, $2
|
||||||
ldh [hVBlank], a
|
ldh [hVBlank], a
|
||||||
call DelayFrame
|
call DelayFrame
|
||||||
|
115
wram.asm
115
wram.asm
@ -683,7 +683,12 @@ wPuzzlePieces:: ds 6 * 6
|
|||||||
wUnownPuzzleEnd::
|
wUnownPuzzleEnd::
|
||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
wMobileTransferData:: ds $1e0
|
; link patch lists
|
||||||
|
wPlayerPatchLists:: ds 200
|
||||||
|
wOTPatchLists:: ds 200
|
||||||
|
|
||||||
|
NEXTU
|
||||||
|
wMobileTransferData:: ds 480
|
||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
|
|
||||||
@ -702,11 +707,6 @@ NEXTU
|
|||||||
; hall of fame temp struct
|
; hall of fame temp struct
|
||||||
wHallOfFameTemp:: hall_of_fame wHallOfFameTemp
|
wHallOfFameTemp:: hall_of_fame wHallOfFameTemp
|
||||||
|
|
||||||
NEXTU
|
|
||||||
; link engine data
|
|
||||||
wLink_c608:: ds 10
|
|
||||||
wc612:: ds 10
|
|
||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
; odd egg
|
; odd egg
|
||||||
wOddEgg:: party_struct wOddEgg
|
wOddEgg:: party_struct wOddEgg
|
||||||
@ -796,7 +796,6 @@ wPokegearRadioMusicPlaying:: db
|
|||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
; trade
|
; trade
|
||||||
wTrademons::
|
|
||||||
wPlayerTrademon:: trademon wPlayerTrademon
|
wPlayerTrademon:: trademon wPlayerTrademon
|
||||||
wOTTrademon:: trademon wOTTrademon
|
wOTTrademon:: trademon wOTTrademon
|
||||||
wTradeAnimAddress:: dw
|
wTradeAnimAddress:: dw
|
||||||
@ -967,29 +966,7 @@ wDebugOriginalColors:: ds 256 * 4
|
|||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
; raw link data
|
; raw link data
|
||||||
wLinkData:: ds 271
|
wLinkData:: ds 1300
|
||||||
wc90f:: ds 229
|
|
||||||
wc9f4:: ds 5
|
|
||||||
wc9f9:: ds 198
|
|
||||||
wcabf:: ds 79
|
|
||||||
wcb0e:: ds 5
|
|
||||||
wcb13:: ds 113
|
|
||||||
wcb84:: ds 100
|
|
||||||
wcbe8:: dw
|
|
||||||
wLinkOTPartyMonTypes:: ds 2 * PARTY_LENGTH
|
|
||||||
ds 84
|
|
||||||
wcc4a:: ds 22
|
|
||||||
wcc60:: ds 1
|
|
||||||
wcc61:: ds 1
|
|
||||||
wcc62:: ds 2
|
|
||||||
wcc64:: ds 1
|
|
||||||
wcc65:: ds 57
|
|
||||||
wcc9e:: ds 22
|
|
||||||
wccb4:: ds 1
|
|
||||||
wccb5:: ds 3
|
|
||||||
wccb8:: ds 1
|
|
||||||
wccb9:: ds 1
|
|
||||||
wccba:: ds 90
|
|
||||||
wLinkDataEnd::
|
wLinkDataEnd::
|
||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
@ -1000,18 +977,6 @@ wLinkPartySpecies:: ds PARTY_LENGTH
|
|||||||
wLinkPartyEnd:: db ; older code doesn't check PartyCount
|
wLinkPartyEnd:: db ; older code doesn't check PartyCount
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
; time capsule party data
|
|
||||||
wTimeCapsulePlayerData::
|
|
||||||
wTimeCapsulePartyMon1:: red_party_struct wTimeCapsulePartyMon1
|
|
||||||
wTimeCapsulePartyMon2:: red_party_struct wTimeCapsulePartyMon2
|
|
||||||
wTimeCapsulePartyMon3:: red_party_struct wTimeCapsulePartyMon3
|
|
||||||
wTimeCapsulePartyMon4:: red_party_struct wTimeCapsulePartyMon4
|
|
||||||
wTimeCapsulePartyMon5:: red_party_struct wTimeCapsulePartyMon5
|
|
||||||
wTimeCapsulePartyMon6:: red_party_struct wTimeCapsulePartyMon6
|
|
||||||
wTimeCapsulePartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH
|
|
||||||
wTimeCapsulePartyMonNicks:: ds PARTY_LENGTH * MON_NAME_LENGTH
|
|
||||||
|
|
||||||
NEXTU
|
|
||||||
; link player data
|
; link player data
|
||||||
wLinkPlayerData::
|
wLinkPlayerData::
|
||||||
wLinkPlayerPartyMon1:: party_struct wLinkPlayerPartyMon1
|
wLinkPlayerPartyMon1:: party_struct wLinkPlayerPartyMon1
|
||||||
@ -1020,10 +985,56 @@ wLinkPlayerPartyMon3:: party_struct wLinkPlayerPartyMon3
|
|||||||
wLinkPlayerPartyMon4:: party_struct wLinkPlayerPartyMon4
|
wLinkPlayerPartyMon4:: party_struct wLinkPlayerPartyMon4
|
||||||
wLinkPlayerPartyMon5:: party_struct wLinkPlayerPartyMon5
|
wLinkPlayerPartyMon5:: party_struct wLinkPlayerPartyMon5
|
||||||
wLinkPlayerPartyMon6:: party_struct wLinkPlayerPartyMon6
|
wLinkPlayerPartyMon6:: party_struct wLinkPlayerPartyMon6
|
||||||
wLinkPlayerPartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH
|
wLinkPlayerPartyMonOTNames:: ds NAME_LENGTH * PARTY_LENGTH
|
||||||
wLinkPlayerPartyMonNicks:: ds PARTY_LENGTH * MON_NAME_LENGTH
|
wLinkPlayerPartyMonNicks:: ds MON_NAME_LENGTH * PARTY_LENGTH
|
||||||
|
|
||||||
|
NEXTU
|
||||||
|
; time capsule party data
|
||||||
|
wTimeCapsulePlayerData::
|
||||||
|
wTimeCapsulePartyMon1:: red_party_struct wTimeCapsulePartyMon1
|
||||||
|
wTimeCapsulePartyMon2:: red_party_struct wTimeCapsulePartyMon2
|
||||||
|
wTimeCapsulePartyMon3:: red_party_struct wTimeCapsulePartyMon3
|
||||||
|
wTimeCapsulePartyMon4:: red_party_struct wTimeCapsulePartyMon4
|
||||||
|
wTimeCapsulePartyMon5:: red_party_struct wTimeCapsulePartyMon5
|
||||||
|
wTimeCapsulePartyMon6:: red_party_struct wTimeCapsulePartyMon6
|
||||||
|
wTimeCapsulePartyMonOTNames:: ds NAME_LENGTH * PARTY_LENGTH
|
||||||
|
wTimeCapsulePartyMonNicks:: ds MON_NAME_LENGTH * PARTY_LENGTH
|
||||||
|
|
||||||
|
NEXTU
|
||||||
|
; link patch lists
|
||||||
|
wLinkPatchList1:: ds SERIAL_PATCH_LIST_LENGTH
|
||||||
|
wLinkPatchList2:: ds SERIAL_PATCH_LIST_LENGTH
|
||||||
ENDU
|
ENDU
|
||||||
|
|
||||||
|
NEXTU
|
||||||
|
; link data prep
|
||||||
|
ds 1000
|
||||||
|
wCurLinkOTPartyMonTypePtr:: dw
|
||||||
|
wLinkOTPartyMonTypes:: ds 2 * PARTY_LENGTH
|
||||||
|
|
||||||
|
NEXTU
|
||||||
|
; link mail data
|
||||||
|
ds 500
|
||||||
|
wLinkPlayerMail::
|
||||||
|
wLinkPlayerMailPreamble:: ds SERIAL_MAIL_PREAMBLE_LENGTH
|
||||||
|
wLinkPlayerMailMessages:: ds (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||||
|
wLinkPlayerMailMetadata:: ds (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH
|
||||||
|
wLinkPlayerMailPatchSet:: ds 103
|
||||||
|
wLinkPlayerMailEnd::
|
||||||
|
ds 10
|
||||||
|
wLinkOTMail::
|
||||||
|
wLinkOTMailMessages:: ds (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||||
|
wLinkOTMailMetadata:: ds (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH
|
||||||
|
wOTPlayerMailPatchSet:: ds 103 + SERIAL_MAIL_PREAMBLE_LENGTH
|
||||||
|
wLinkOTMailEnd::
|
||||||
|
ds 10
|
||||||
|
|
||||||
|
NEXTU
|
||||||
|
; received link mail data
|
||||||
|
ds 500
|
||||||
|
wLinkReceivedMail:: ds MAIL_STRUCT_LENGTH * PARTY_LENGTH
|
||||||
|
wLinkReceivedMailEnd:: db
|
||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
; mystery gift data
|
; mystery gift data
|
||||||
wMysteryGiftStaging:: ds 80
|
wMysteryGiftStaging:: ds 80
|
||||||
@ -1099,7 +1110,18 @@ wc822:: ds 525
|
|||||||
wMobileSDK_ReceivePacketBufferAlt:: ds 11
|
wMobileSDK_ReceivePacketBufferAlt:: ds 11
|
||||||
wMobileSDK_ReceivedBytes:: dw
|
wMobileSDK_ReceivedBytes:: dw
|
||||||
wMobileSDK_ReceivePacketBuffer:: ds 267
|
wMobileSDK_ReceivePacketBuffer:: ds 267
|
||||||
wMobileSDK_PacketBuffer:: ds 461
|
wMobileSDK_PacketBuffer:: ds 281
|
||||||
|
wcc60:: ds 1
|
||||||
|
wcc61:: ds 1
|
||||||
|
wcc62:: ds 2
|
||||||
|
wcc64:: ds 1
|
||||||
|
wcc65:: ds 57
|
||||||
|
ds 22
|
||||||
|
wccb4:: ds 1
|
||||||
|
wccb5:: ds 3
|
||||||
|
wccb8:: ds 1
|
||||||
|
wccb9:: ds 1
|
||||||
|
wccba:: ds 90
|
||||||
|
|
||||||
if DEF(_DEBUG)
|
if DEF(_DEBUG)
|
||||||
NEXTU
|
NEXTU
|
||||||
@ -1337,7 +1359,7 @@ wOtherPlayerLinkMode:: db
|
|||||||
wOtherPlayerLinkAction:: db
|
wOtherPlayerLinkAction:: db
|
||||||
ds 3
|
ds 3
|
||||||
wPlayerLinkAction:: db
|
wPlayerLinkAction:: db
|
||||||
wcf57:: db
|
wUnusedLinkAction:: db
|
||||||
ds 3
|
ds 3
|
||||||
wLinkTimeoutFrames:: dw
|
wLinkTimeoutFrames:: dw
|
||||||
wLinkByteTimeout:: dw
|
wLinkByteTimeout:: dw
|
||||||
@ -2512,6 +2534,7 @@ wUnusedEggHatchFlag:: db
|
|||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
; enemy party
|
; enemy party
|
||||||
|
wOTPartyData::
|
||||||
wOTPlayerName:: ds NAME_LENGTH
|
wOTPlayerName:: ds NAME_LENGTH
|
||||||
wOTPlayerID:: dw
|
wOTPlayerID:: dw
|
||||||
ds 8
|
ds 8
|
||||||
|
Loading…
Reference in New Issue
Block a user