]> cloudbase.mooo.com Git - z180-stamp-cpm3.git/blame - cbios/conbuf.180
include --> maclib
[z180-stamp-cpm3.git] / cbios / conbuf.180
CommitLineData
ea5293bb
L
1 page 255\r
2 .z80\r
3\r
4;\r
5; FIFO channels for communication with avr\r
6;\r
6dd88c25 7 global ff_dev\r
ea5293bb 8\r
d6829fd3 9 extrn ff_empty,ff_get,ff_full,ff_put\r
ea5293bb
L
10 extrn bufinit,fifolst\r
11\r
12 include config.inc\r
13 if CPU_Z180\r
3c56f4c2 14 maclib z180reg.inc\r
ea5293bb
L
15 endif\r
16\r
2a413c0d 17 dseg\r
ea5293bb 18 mkbuf ci.fifo_id, ci.fifo, ci.fifo_len\r
b43b4662 19 mkbuf co.fifo_id, co.fifo, co.fifo_len\r
ea5293bb 20\r
40df51ae
L
21ici equ ci.fifo_id * 2\r
22ico equ co.fifo_id * 2\r
ea5293bb 23\r
6dd88c25
L
24;--------------------------------------------------------------\r
25\r
26 dseg\r
27\r
28 dw ff.out\r
29 dw ff.ost\r
30 dw ff.in\r
31 dw ff.ist\r
32 dw ff.init\r
33ff_dev:\r
ea5293bb
L
34\r
35;--------------------------------------------------------------\r
36\r
37; Init Serial I/O for console input and output\r
38;\r
50f3b8f0 39 dseg\r
ea5293bb
L
40ff.init:\r
41 ld a,(INIDONE)\r
42 cp INIDONEVAL\r
43 ret z\r
44\r
45 ld ix,ci.fifo\r
ea5293bb
L
46 call bufinit\r
47 ld ix,co.fifo\r
ea5293bb
L
48 jp bufinit\r
49\r
50;--------------------------------------------------------------\r
40df51ae 51; Input status\r
ea5293bb 52\r
2a413c0d 53 dseg\r
ea5293bb
L
54ff.ist:\r
55 push ix\r
56 ld ix,(fifolst+ici) ;\r
d6829fd3 57 call ff_empty\r
ea5293bb 58 pop ix\r
ea5293bb
L
59 ret\r
60\r
40df51ae 61;--------------------------------------------------------------\r
6dd88c25 62; Get an input character\r
40df51ae 63\r
ea5293bb
L
64ff.in:\r
65 push ix\r
66 ld ix,(fifolst+ici) ;\r
d6829fd3 67 call ff_get\r
ea5293bb
L
68 pop ix\r
69 ret\r
70\r
71;--------------------------------------------------------------\r
40df51ae 72; Output status\r
ea5293bb
L
73\r
74ff.ost:\r
75 push ix\r
40df51ae 76 ld ix,(fifolst+ico) ;\r
d6829fd3 77 call ff_full\r
ea5293bb 78 pop ix\r
ea5293bb
L
79 ret\r
80\r
81\r
40df51ae
L
82;--------------------------------------------------------------\r
83; put character in c in buffer\r
84; destroys hl, bc\r
85; returns output char in a\r
ea5293bb
L
86\r
87ff.out:\r
40df51ae
L
88 push ix ;\r
89 ld ix,(fifolst+ico) ;\r
d6829fd3 90 call ff_put\r
40df51ae 91 out (AVRINT6),a ; tell monitor\r
40df51ae 92 pop ix ;\r
d6829fd3 93 ret\r
ea5293bb
L
94\r
95 end\r