mirror of
https://github.com/cc65/cc65.git
synced 2025-01-27 09:33:42 +00:00
Serial: Optimize SER_GET
There is no need to TryToSend before getting the character. We send bytes during SER_PUT, and if interrupted during sending, we still try to do it at the beginning of the next SER_PUT.
This commit is contained in:
parent
a89a311abf
commit
734541ee05
@ -291,14 +291,9 @@ InvBaud:lda #SER_ERR_BAUD_UNAVAIL
|
||||
|
||||
SER_GET:
|
||||
ldx Index
|
||||
ldy SendFreeCnt ; Send data if necessary
|
||||
iny ; Y == $FF?
|
||||
beq :+
|
||||
lda #$00 ; TryHard = false
|
||||
jsr TryToSend
|
||||
|
||||
; Check for buffer empty
|
||||
: lda RecvFreeCnt ; (25)
|
||||
lda RecvFreeCnt ; (25)
|
||||
cmp #$FF
|
||||
bne :+
|
||||
lda #SER_ERR_NO_DATA
|
||||
|
@ -227,14 +227,8 @@ InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
|
||||
; returned.
|
||||
|
||||
SER_GET:
|
||||
ldy SendFreeCnt ; Send data if necessary
|
||||
iny ; Y == $FF?
|
||||
beq :+
|
||||
lda #$00 ; TryHard = false
|
||||
jsr TryToSend
|
||||
|
||||
; Check for buffer empty
|
||||
: lda RecvFreeCnt ; (25)
|
||||
lda RecvFreeCnt ; (25)
|
||||
cmp #$FF
|
||||
bne :+
|
||||
lda #SER_ERR_NO_DATA
|
||||
|
@ -314,15 +314,10 @@ SER_CLOSE:
|
||||
;
|
||||
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
|
||||
; Check for buffer empty
|
||||
|
||||
@L1: lda RecvFreeCnt ; (25)
|
||||
lda RecvFreeCnt ; (25)
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #SER_ERR_NO_DATA
|
||||
|
@ -288,15 +288,10 @@ SER_CLOSE:
|
||||
;
|
||||
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
|
||||
; Check for buffer empty
|
||||
|
||||
@L1: lda RecvFreeCnt ; (25)
|
||||
lda RecvFreeCnt ; (25)
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #SER_ERR_NO_DATA
|
||||
|
@ -244,15 +244,10 @@ InvBaud:
|
||||
;
|
||||
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
|
||||
; Check for buffer empty
|
||||
|
||||
@L1: lda RecvFreeCnt
|
||||
lda RecvFreeCnt
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #SER_ERR_NO_DATA
|
||||
|
@ -245,15 +245,10 @@ InvBaud:
|
||||
;
|
||||
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
|
||||
; Check for buffer empty
|
||||
|
||||
@L1: lda RecvFreeCnt
|
||||
lda RecvFreeCnt
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #SER_ERR_NO_DATA
|
||||
|
@ -252,15 +252,10 @@ InvBaud:
|
||||
;
|
||||
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
|
||||
; Check for buffer empty
|
||||
|
||||
@L1: lda RecvFreeCnt ; (25)
|
||||
lda RecvFreeCnt ; (25)
|
||||
cmp #$ff
|
||||
bne @L2
|
||||
lda #SER_ERR_NO_DATA
|
||||
|
Loading…
x
Reference in New Issue
Block a user