mirror of
https://github.com/cc65/cc65.git
synced 2025-03-03 09:32:33 +00:00
Serial: Optimize SER_PUT
We don't need to reload SendFreeCnt if we don't jsr TryToSend.
This commit is contained in:
parent
89af42e5cb
commit
e8f5ad2471
@ -328,20 +328,21 @@ SER_PUT:
|
||||
|
||||
; Try to send
|
||||
ldy SendFreeCnt
|
||||
iny ; Y = $FF?
|
||||
cpy #$FF ; Nothing to flush
|
||||
beq :+
|
||||
pha
|
||||
lda #$00 ; TryHard = false
|
||||
jsr TryToSend
|
||||
pla
|
||||
|
||||
; Put byte into send buffer & send
|
||||
: ldy SendFreeCnt
|
||||
; Reload SendFreeCnt after TryToSend
|
||||
ldy SendFreeCnt
|
||||
bne :+
|
||||
lda #SER_ERR_OVERFLOW
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Put byte into send buffer & send
|
||||
: ldy SendTail
|
||||
sta SendBuf,y
|
||||
inc SendTail
|
||||
|
@ -269,20 +269,21 @@ SER_GET:
|
||||
SER_PUT:
|
||||
; Try to send
|
||||
ldy SendFreeCnt
|
||||
iny ; Y = $FF?
|
||||
cpy #$FF ; Nothing to flush
|
||||
beq :+
|
||||
pha
|
||||
lda #$00 ; TryHard = false
|
||||
jsr TryToSend
|
||||
pla
|
||||
|
||||
; Put byte into send buffer & send
|
||||
: ldy SendFreeCnt
|
||||
; Reload SendFreeCnt after TryToSend
|
||||
ldy SendFreeCnt
|
||||
bne :+
|
||||
lda #SER_ERR_OVERFLOW
|
||||
ldx #0 ; return value is char
|
||||
rts
|
||||
|
||||
; Put byte into send buffer & send
|
||||
: ldy SendTail
|
||||
sta SendBuf,y
|
||||
inc SendTail
|
||||
|
@ -362,21 +362,23 @@ SER_PUT:
|
||||
; Try to send
|
||||
|
||||
ldx SendFreeCnt
|
||||
inx ; X = $ff?
|
||||
cpx #$FF ; Nothing to flush
|
||||
beq @L2
|
||||
pha
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
pla
|
||||
|
||||
; Put byte into send buffer & send
|
||||
; Reload SendFreeCnt after TryToSend
|
||||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
ldx SendFreeCnt
|
||||
bne @L2
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
; Put byte into send buffer & send
|
||||
|
||||
@L2: ldx SendTail
|
||||
sta SendBuf,x
|
||||
inc SendTail
|
||||
dec SendFreeCnt
|
||||
|
@ -336,21 +336,23 @@ SER_PUT:
|
||||
; Try to send
|
||||
|
||||
ldx SendFreeCnt
|
||||
inx ; X = $ff?
|
||||
cpx #$FF ; Nothing to flush
|
||||
beq @L2
|
||||
pha
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
pla
|
||||
|
||||
; Put byte into send buffer & send
|
||||
; Reload SendFreeCnt after TryToSend
|
||||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
ldx SendFreeCnt
|
||||
bne @L2
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
; Put byte into send buffer & send
|
||||
|
||||
@L2: ldx SendTail
|
||||
sta SendBuf,x
|
||||
inc SendTail
|
||||
dec SendFreeCnt
|
||||
|
@ -292,21 +292,23 @@ SER_PUT:
|
||||
; Try to send
|
||||
|
||||
ldx SendFreeCnt
|
||||
inx ; X = $ff?
|
||||
cpx #$FF ; Nothing to flush
|
||||
beq @L2
|
||||
pha
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
pla
|
||||
|
||||
; Put byte into send buffer & send
|
||||
; Reload SendFreeCnt after TryToSend
|
||||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
ldx SendFreeCnt
|
||||
bne @L2
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
; Put byte into send buffer & send
|
||||
|
||||
@L2: ldx SendTail
|
||||
sta SendBuf,x
|
||||
inc SendTail
|
||||
dec SendFreeCnt
|
||||
|
@ -293,21 +293,23 @@ SER_PUT:
|
||||
; Try to send
|
||||
|
||||
ldx SendFreeCnt
|
||||
inx ; X = $ff?
|
||||
cpx #$ff ; Nothing to flush
|
||||
beq @L2
|
||||
pha
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
pla
|
||||
|
||||
; Put byte into send buffer & send
|
||||
; Reload SendFreeCnt after TryToSend
|
||||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
ldx SendFreeCnt
|
||||
bne @L2
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
; Put byte into send buffer & send
|
||||
|
||||
@L2: ldx SendTail
|
||||
sta SendBuf,x
|
||||
inc SendTail
|
||||
dec SendFreeCnt
|
||||
|
@ -300,21 +300,23 @@ SER_PUT:
|
||||
; Try to send
|
||||
|
||||
ldx SendFreeCnt
|
||||
inx ; X = $ff?
|
||||
cpx #$ff ; Nothing to flush
|
||||
beq @L2
|
||||
pha
|
||||
lda #$00
|
||||
jsr TryToSend
|
||||
pla
|
||||
|
||||
; Put byte into send buffer & send
|
||||
; Reload SendFreeCnt after TryToSend
|
||||
|
||||
@L2: ldx SendFreeCnt
|
||||
bne @L3
|
||||
ldx SendFreeCnt
|
||||
bne @L2
|
||||
lda #SER_ERR_OVERFLOW ; X is already zero
|
||||
rts
|
||||
|
||||
@L3: ldx SendTail
|
||||
; Put byte into send buffer & send
|
||||
|
||||
@L2: ldx SendTail
|
||||
sta SendBuf,x
|
||||
inc SendTail
|
||||
dec SendFreeCnt
|
||||
|
Loading…
x
Reference in New Issue
Block a user