X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp-cpm3.git/blobdiff_plain/2a413c0df536bc1808a60598edc981152c4ec5f7..d6829fd3d7227d278aa32049665897a8a1b2d0d5:/cbios/conbuf.180?ds=sidebyside diff --git a/cbios/conbuf.180 b/cbios/conbuf.180 index 75741e0..3c846dd 100644 --- a/cbios/conbuf.180 +++ b/cbios/conbuf.180 @@ -6,6 +6,7 @@ ; global ff.init,ff.in,ff.ist,ff.out,ff.ost + extrn ff_empty,ff_get,ff_full,ff_put extrn bufinit,fifolst include config.inc @@ -38,65 +39,33 @@ ff.init: ;-------------------------------------------------------------- ; Input status -; buffer is empty, if output index and input index are the same dseg ff.ist: push ix ld ix,(fifolst+ici) ; - -buf.empty: - ld a,(ix+o.in_idx) ; - sub (ix+o.out_idx) ; + call ff_empty pop ix - ret z - or 0ffh ret - ;-------------------------------------------------------------- -; Output status -; buffer is full, if output index is one behind input index +; Get an input character ff.in: push ix ld ix,(fifolst+ici) ; - -buf.get: - push ix - pop hl - ld c,(ix+o.out_idx) ; - ld b,0 - add hl,bc - ld a,c -bg.wait: - cp (ix+o.in_idx) ; - jr z,bg.wait - ld b,(hl) - ld a,c ; - inc a - and (ix+o.mask) - ld (ix+o.out_idx),a - ld a,b + call ff_get pop ix ret ;-------------------------------------------------------------- ; Output status -; buffer is full, if output index is one behind input index ff.ost: push ix ld ix,(fifolst+ico) ; - -buf.full: - ld a,(ix+o.in_idx) ; - inc a - and (ix+o.mask) - sub (ix+o.out_idx) ; + call ff_full pop ix - ret z - or 0ffh ret @@ -108,28 +77,10 @@ buf.full: ff.out: push ix ; ld ix,(fifolst+ico) ; -buf.put: - push ix ; - pop hl ; get buffer start address - - ld a,c ; - ld c,(ix+o.in_idx) ; add input index - ld b,0 ; - add hl,bc ; - ld (hl),a ; one place is allways free - ld b,a ; - - ld a,c ; bump input index - inc a ; - and (ix+o.mask) ; -bp.wait: ; do - cp (ix+o.out_idx) ; - jr z,bp.wait ; while new input idx == ouput idx - ld (ix+o.in_idx),a ; - + call ff_put out (AVRINT6),a ; tell monitor - ld a,b ; pop ix ; - ret ; + ret end +