mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
Serial: Optimize SER_IRQ
Apple2 and Atmos have Index in X, but can still use it for the best-case path as long as we reload it in the worst-case part (when we assert flow control). Also, standardize the free space to trigger flow control to 32 characters left (compare with RecvFreeCnt before decrement)
This commit is contained in:
parent
3f3b6123b9
commit
89af42e5cb
@ -404,19 +404,19 @@ SER_IRQ:
|
|||||||
and #$08
|
and #$08
|
||||||
beq Done ; Jump if no ACIA interrupt
|
beq Done ; Jump if no ACIA interrupt
|
||||||
lda ACIA_DATA,x ; Get byte from ACIA
|
lda ACIA_DATA,x ; Get byte from ACIA
|
||||||
ldy RecvFreeCnt ; Check if we have free space left
|
ldx RecvFreeCnt ; Check if we have free space left
|
||||||
beq Flow ; Jump if no space in receive buffer
|
beq Flow ; Jump if no space in receive buffer
|
||||||
ldy RecvTail ; Load buffer pointer
|
ldy RecvTail ; Load buffer pointer
|
||||||
sta RecvBuf,y ; Store received byte in buffer
|
sta RecvBuf,y ; Store received byte in buffer
|
||||||
inc RecvTail ; Increment buffer pointer
|
inc RecvTail ; Increment buffer pointer
|
||||||
dec RecvFreeCnt ; Decrement free space counter
|
dec RecvFreeCnt ; Decrement free space counter
|
||||||
ldy RecvFreeCnt ; Check for buffer space low
|
cpx #33 ; Check for buffer space low
|
||||||
cpy #33
|
|
||||||
bcc Flow ; Assert flow control if buffer space low
|
bcc Flow ; Assert flow control if buffer space low
|
||||||
rts ; Interrupt handled (carry already set)
|
rts ; Interrupt handled (carry already set)
|
||||||
|
|
||||||
; Assert flow control if buffer space too low
|
; Assert flow control if buffer space too low
|
||||||
Flow: lda RtsOff
|
Flow: ldx Index
|
||||||
|
lda RtsOff
|
||||||
sta ACIA_CMD,x
|
sta ACIA_CMD,x
|
||||||
sta Stopped
|
sta Stopped
|
||||||
sec ; Interrupt handled
|
sec ; Interrupt handled
|
||||||
|
@ -329,19 +329,19 @@ SER_IRQ:
|
|||||||
and #$08
|
and #$08
|
||||||
beq Done ; Jump if no ACIA interrupt
|
beq Done ; Jump if no ACIA interrupt
|
||||||
lda ACIA::DATA,x ; Get byte from ACIA
|
lda ACIA::DATA,x ; Get byte from ACIA
|
||||||
ldy RecvFreeCnt ; Check if we have free space left
|
ldx RecvFreeCnt ; Check if we have free space left
|
||||||
beq Flow ; Jump if no space in receive buffer
|
beq Flow ; Jump if no space in receive buffer
|
||||||
ldy RecvTail ; Load buffer pointer
|
ldy RecvTail ; Load buffer pointer
|
||||||
sta RecvBuf,y ; Store received byte in buffer
|
sta RecvBuf,y ; Store received byte in buffer
|
||||||
inc RecvTail ; Increment buffer pointer
|
inc RecvTail ; Increment buffer pointer
|
||||||
dec RecvFreeCnt ; Decrement free space counter
|
dec RecvFreeCnt ; Decrement free space counter
|
||||||
ldy RecvFreeCnt ; Check for buffer space low
|
cpx #33
|
||||||
cpy #33
|
|
||||||
bcc Flow ; Assert flow control if buffer space low
|
bcc Flow ; Assert flow control if buffer space low
|
||||||
rts ; Interrupt handled (carry already set)
|
rts ; Interrupt handled (carry already set)
|
||||||
|
|
||||||
; Assert flow control if buffer space too low
|
; Assert flow control if buffer space too low
|
||||||
Flow: lda RtsOff
|
Flow: ldx Index ; Reload port
|
||||||
|
lda RtsOff
|
||||||
sta ACIA::CMD,x
|
sta ACIA::CMD,x
|
||||||
sta Stopped
|
sta Stopped
|
||||||
sec ; Interrupt handled
|
sec ; Interrupt handled
|
||||||
|
Loading…
x
Reference in New Issue
Block a user