]>
Commit | Line | Data |
---|---|---|
1 | page 255\r | |
2 | .z80\r | |
3 | \r | |
4 | ;\r | |
5 | ; FIFO channels for communication with avr\r | |
6 | ;\r | |
7 | global ff_dev\r | |
8 | \r | |
9 | extrn ff_empty,ff_get,ff_full,ff_put\r | |
10 | extrn bufinit,fifolst\r | |
11 | \r | |
12 | include config.inc\r | |
13 | if CPU_Z180\r | |
14 | maclib z180reg.inc\r | |
15 | endif\r | |
16 | \r | |
17 | dseg\r | |
18 | mkbuf ci.fifo_id, ci.fifo, ci.fifo_len\r | |
19 | mkbuf co.fifo_id, co.fifo, co.fifo_len\r | |
20 | \r | |
21 | ici equ ci.fifo_id * 2\r | |
22 | ico equ co.fifo_id * 2\r | |
23 | \r | |
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 | |
33 | ff_dev:\r | |
34 | \r | |
35 | ;--------------------------------------------------------------\r | |
36 | \r | |
37 | ; Init Serial I/O for console input and output\r | |
38 | ;\r | |
39 | dseg\r | |
40 | ff.init:\r | |
41 | ld ix,ci.fifo\r | |
42 | call bufinit\r | |
43 | ld ix,co.fifo\r | |
44 | jp bufinit\r | |
45 | \r | |
46 | ;--------------------------------------------------------------\r | |
47 | ; Input status\r | |
48 | \r | |
49 | dseg\r | |
50 | ff.ist:\r | |
51 | push ix\r | |
52 | ld ix,(fifolst+ici) ;\r | |
53 | call ff_empty\r | |
54 | pop ix\r | |
55 | ret\r | |
56 | \r | |
57 | ;--------------------------------------------------------------\r | |
58 | ; Get an input character\r | |
59 | \r | |
60 | ff.in:\r | |
61 | push ix\r | |
62 | ld ix,(fifolst+ici) ;\r | |
63 | call ff_get\r | |
64 | pop ix\r | |
65 | ret\r | |
66 | \r | |
67 | ;--------------------------------------------------------------\r | |
68 | ; Output status\r | |
69 | \r | |
70 | ff.ost:\r | |
71 | push ix\r | |
72 | ld ix,(fifolst+ico) ;\r | |
73 | call ff_full\r | |
74 | pop ix\r | |
75 | ret\r | |
76 | \r | |
77 | \r | |
78 | ;--------------------------------------------------------------\r | |
79 | ; put character in c in buffer\r | |
80 | ; destroys hl, bc\r | |
81 | ; returns output char in a\r | |
82 | \r | |
83 | ff.out:\r | |
84 | push ix ;\r | |
85 | ld ix,(fifolst+ico) ;\r | |
86 | call ff_put\r | |
87 | out (AVRINT6),a ; tell monitor\r | |
88 | pop ix ;\r | |
89 | ret\r | |
90 | \r | |
91 | end\r |