diff --git a/libsrc/apple2/ser/a2.ssc.s b/libsrc/apple2/ser/a2.ssc.s index 1dbf5f3a4..7705f0933 100644 --- a/libsrc/apple2/ser/a2.ssc.s +++ b/libsrc/apple2/ser/a2.ssc.s @@ -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 diff --git a/libsrc/atmos/ser/atmos-acia.s b/libsrc/atmos/ser/atmos-acia.s index 774a337bd..c918fe995 100644 --- a/libsrc/atmos/ser/atmos-acia.s +++ b/libsrc/atmos/ser/atmos-acia.s @@ -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 diff --git a/libsrc/c128/ser/c128-swlink.s b/libsrc/c128/ser/c128-swlink.s index 57b5ea3b2..a0fc43050 100644 --- a/libsrc/c128/ser/c128-swlink.s +++ b/libsrc/c128/ser/c128-swlink.s @@ -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 diff --git a/libsrc/c64/ser/c64-swlink.s b/libsrc/c64/ser/c64-swlink.s index 8c8b8bf39..c2934e669 100644 --- a/libsrc/c64/ser/c64-swlink.s +++ b/libsrc/c64/ser/c64-swlink.s @@ -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 diff --git a/libsrc/cbm510/ser/cbm510-std.s b/libsrc/cbm510/ser/cbm510-std.s index 34fe02d0f..633a392c7 100644 --- a/libsrc/cbm510/ser/cbm510-std.s +++ b/libsrc/cbm510/ser/cbm510-std.s @@ -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 diff --git a/libsrc/cbm610/ser/cbm610-std.s b/libsrc/cbm610/ser/cbm610-std.s index c241d5908..1216e3794 100644 --- a/libsrc/cbm610/ser/cbm610-std.s +++ b/libsrc/cbm610/ser/cbm610-std.s @@ -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 diff --git a/libsrc/plus4/ser/plus4-stdser.s b/libsrc/plus4/ser/plus4-stdser.s index 5c4c550e6..d1d84267f 100644 --- a/libsrc/plus4/ser/plus4-stdser.s +++ b/libsrc/plus4/ser/plus4-stdser.s @@ -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