Skip to content

Commit 8974060

Browse files
committed
Simplify SioTick state switch.
1 parent ccdffb4 commit 8974060

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

unbricked/serial-link/sio.asm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,14 @@ SioMemFill:
152152
; Per-frame update
153153
; @mut: AF
154154
SioTick::
155+
; jump to state-specific tick routine
155156
ld a, [wSioState]
157+
cp a, SIO_ACTIVE
158+
jr z, .active_tick
156159
cp a, SIO_RESET
157160
jr z, .reset_tick
158-
cp a, SIO_ACTIVE
159-
ret nz
161+
ret
162+
.active_tick
160163
; update timeout on external clock
161164
ldh a, [rSC]
162165
and a, SCF_SOURCE
@@ -169,6 +172,7 @@ SioTick::
169172
jr z, SioAbort
170173
ret
171174
.reset_tick
175+
; delayed reset to IDLE state
172176
ld a, SIO_IDLE
173177
ld [wSioState], a
174178
ret

0 commit comments

Comments
 (0)