summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-10-29 16:43:35 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-10-29 16:43:35 -0400
commit15ad69e0c6e35be34dc65322209d3673607d00c5 (patch)
tree79028f0757a1ba2e8314eb37265f91f11ca2e345
parentffdde1fa005764b7c3fa4a2d197b22235387a289 (diff)
Define SERIAL_LINK_BYTE_TIMEOUT
-rw-r--r--constants/serial_constants.asm3
-rw-r--r--engine/link/link.asm5
-rw-r--r--home/serial.asm5
3 files changed, 9 insertions, 4 deletions
diff --git a/constants/serial_constants.asm b/constants/serial_constants.asm
index fd87e4a5..ddb6f4fd 100644
--- a/constants/serial_constants.asm
+++ b/constants/serial_constants.asm
@@ -30,4 +30,7 @@ SERIAL_PATCH_LIST_PART_TERMINATOR EQU $ff
SERIAL_PREAMBLE_LENGTH EQU 6
+; timeout duration after exchanging a byte
+SERIAL_LINK_BYTE_TIMEOUT EQU $5000
+
MAX_MYSTERY_GIFT_PARTNERS EQU 5
diff --git a/engine/link/link.asm b/engine/link/link.asm
index 09aec60c..2d8d458b 100644
--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -26,9 +26,10 @@ LinkCommunications:
ld de, String_PleaseWait
call PlaceString
ld hl, wLinkByteTimeout
- xor a ; LOW($5000)
+ assert LOW(SERIAL_LINK_BYTE_TIMEOUT) == 0
+ xor a ; LOW(SERIAL_LINK_BYTE_TIMEOUT)
ld [hli], a
- ld [hl], HIGH($5000)
+ ld [hl], HIGH(SERIAL_LINK_BYTE_TIMEOUT)
ld a, [wLinkMode]
cp LINK_TIMECAPSULE
jp nz, Gen2ToGen2LinkComms
diff --git a/home/serial.asm b/home/serial.asm
index ee4ad347..0e42b9c0 100644
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -183,9 +183,10 @@ Serial_ExchangeByte::
sub 1 << SERIAL
jr nz, .non_serial_interrupts_enabled
- ; a == LOW($5000)
+ ; a == 0
+ assert LOW(SERIAL_LINK_BYTE_TIMEOUT) == 0
ld [wLinkByteTimeout], a
- ld a, HIGH($5000)
+ ld a, HIGH(SERIAL_LINK_BYTE_TIMEOUT)
ld [wLinkByteTimeout + 1], a
.non_serial_interrupts_enabled