Skip to content

Commit 5fb3aff

Browse files
author
np511
committed
Make ioSendPacket thread-safe
1 parent d66afd0 commit 5fb3aff

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/00/link.asm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ _:
161161
;; will end in tears.
162162
ioSendPacket:
163163
push bc
164+
push af
165+
ld a,i
166+
di
164167
push af
165168
; io_tx_header_ix is 0xFF when ready to send
166169
ld a, (io_tx_header_ix)
@@ -196,11 +199,19 @@ _: ld (io_tx_header), de
196199
out (PORT_LINK_ASSIST_ENABLE), a
197200
pop de
198201
pop hl
202+
pop af
203+
jp po, _
204+
ei
205+
_:
199206
pop af
200207
pop bc
201208
cp a
202209
ret
203210
.abort:
211+
pop af
212+
jp po, _
213+
ei
214+
_:
204215
pop af \ ld b, a \ or 1 \ ld a, b
205216
pop bc \ ret ; Packet in progress, GTFO
206217

0 commit comments

Comments
 (0)