diff options
author | Leo C | 2019-05-03 21:27:50 +0200 |
---|---|---|
committer | Leo C | 2019-05-03 21:27:50 +0200 |
commit | 80873aa27c7a3eccbd3858fdd5c39925ea7a2fcf (patch) | |
tree | 2d2a56c423c628e15221138fff15d1ce8356b27d | |
parent | 830b73bf0153777e6ae76ca44d64718a53b0b1b5 (diff) | |
download | z180-stamp-cpm3-80873aa27c7a3eccbd3858fdd5c39925ea7a2fcf.zip |
simplify buffer level calculation
-rw-r--r-- | cbios/ascii.180 | 13 | ||||
-rw-r--r-- | cbios/fifo.180 | 6 |
2 files changed, 7 insertions, 12 deletions
diff --git a/cbios/ascii.180 b/cbios/ascii.180 index 9054549..d3f6b20 100644 --- a/cbios/ascii.180 +++ b/cbios/ascii.180 @@ -710,15 +710,12 @@ rxi_2: and b ;
ld c,a
- sub (ix+o.out_idx) ;
- jr z,rxtxi&dev&_lp1 ;skip if buffer is full
-
- ld (ix+o.in_idx),c ;input buffer pointer
-
- jr nc,$+3 ;
- adc b ;
+ sub (ix+o.out_idx) ;number of free places in buffer
+ jr z,rxtxi&dev&_lp1 ;buffer full?
+ and b ;
+ ld (ix+o.in_idx),c ; no, update input index
- cp s&dev&.tx_len*3/4
+ cp s&dev&.tx_len*3/4 ;buffer now 75% full?
jr nz,rxtxi&dev&_lp1
if dev=0 ; only channel 0 has rts line
diff --git a/cbios/fifo.180 b/cbios/fifo.180 index e1bda54..ded979a 100644 --- a/cbios/fifo.180 +++ b/cbios/fifo.180 @@ -127,8 +127,7 @@ gech.wait: halt
jr gech.wait
gech.cont:
- jr nc,$+5
- adc (ix+o.mask) ; mask+carry == buffer size
+ and (ix+o.mask) ;
dec a
ld b,a
ld a,c
@@ -215,8 +214,7 @@ bph.wait: ; do ff_cnt:
ld a,(ix+o.in_idx) ;
sub (ix+o.out_idx) ;
- ret nc
- adc (ix+o.mask) ; mask+carry == buffer size
+ and (ix+o.mask) ;
ret
;--------------------------------------------------------------
|