3 public ff_empty,ff_get,ff_full,ff_put
4 public ff_puth,ff_cnt,ff_gech
14 ;--------------------------------------------------------------------
23 ;--------------------------------------------------------------------
28 ld (ix+o.in_idx),0 ;reset pointers (empty fifo)
47 call hwl2phy ;get phys. address of fifo
49 ld a,(ix+o.id) ;fifo id
56 ; TODO: move to better place
59 push bc ;c: bank-addr, b: ignored
62 push bc ;c: function, b:subf
73 ;--------------------------------------------------------------
74 ; Check if characters in fifo
75 ; Fifo is empty, if output index and input index are the same
84 ;--------------------------------------------------------------
85 ; get character from fifo
108 ;--------------------------------------------------------------
109 ; get character and ramaining count from fifo
110 ; halt cpu, while buffer is empty
114 ; c,a: next character
115 ; b: number of charachters in fifo
120 ld c,(ix+o.out_idx) ;
141 ;--------------------------------------------------------------
142 ; Check if room in fifo
143 ; buffer is full, if output index is one behind input index
146 ; a = 0 and z if buffer full
147 ; a = ff and nz if buffer not full
159 ;--------------------------------------------------------------
160 ; put character in c in buffer
165 ex (sp),hl ; get buffer start address
168 ld c,(ix+o.in_idx) ; add input index
171 ld (hl),a ; one place is allways free
174 ld a,c ; bump input index
179 jr z,bp.wait ; while new input idx == ouput idx
183 ;--------------------------------------------------------------
184 ; put character in c in buffer
185 ; halt cpu, while buffer is is full
190 ex (sp),hl ; get buffer start address
193 ld c,(ix+o.in_idx) ; add input index
196 ld (hl),a ; one place is allways free
199 ld a,c ; bump input index
206 jr z,bph.wait ; while new input idx == ouput idx
210 ;--------------------------------------------------------------
211 ; Return number of characters in fifo
220 ;--------------------------------------------------------------