Serial: Optimize TryToSend

We don't need to reload SendFreeCnt each time we loop to wait
for the ACIA to be ready.
This commit is contained in:
Colin Leroy-Mira
2023-08-30 21:28:09 +02:00
parent c674b7ced4
commit 3f3b6123b9
7 changed files with 43 additions and 41 deletions

View File

@@ -466,25 +466,25 @@ NmiHandler:
sta tmp1 ; Remember tryHard flag
@L0: lda SendFreeCnt
cmp #$ff
beq @L3 ; Bail out
beq @L2 ; Bail out
; Check for flow stopped
@L1: lda Stopped
bne @L3 ; Bail out
bne @L2 ; Bail out
; Check that swiftlink is ready to send
@L2: lda ACIA_STATUS
lda ACIA_STATUS
and #$10
bne @L4
bne @L3
bit tmp1 ;keep trying if must try hard
bmi @L0
@L3: rts
bmi @L1
@L2: rts
; Send byte and try again
@L4: ldx SendHead
@L3: ldx SendHead
lda SendBuf,x
sta ACIA_DATA
inc SendHead