]> cloudbase.mooo.com Git - z180-stamp-cpm3.git/blob - cbios/ascip.180
ascii.180 interrupt driver for ASCI 0/1
[z180-stamp-cpm3.git] / cbios / ascip.180
1 page 200
2
3 ; Simple polling drivers for ASCI0 and ASCI1
4
5
6 global as0init
7 global as0ista,as0inp
8 global as0osta,as0out
9 global as1init
10 global as1ista,as1inp
11 global as1osta,as1out
12
13 extrn as_init
14
15
16 include config.inc
17 include z180reg.inc
18
19 dseg
20
21 ;--------------------------------------------------------------
22 ; Init Serial I/O for input and output (ASCI 0/1)
23 ;
24 ; b: device number
25 ;
26
27
28 as0init:
29 ld c,0 ;asci channel number
30 jp as_init
31
32 as1init:
33 ld c,1 ;asci channel number
34 jp as_init
35
36
37 ;--------------------------------------------------------------
38
39 as0ista:
40 in0 a,(stat0)
41 and M_RDRF
42 ret z
43 or 0ffh
44 ret
45
46 as1ista:
47 in0 a,(stat1)
48 and M_RDRF
49 ret z
50 or 0ffh
51 ret
52
53
54 as0inp:
55 in0 a,(stat0)
56 bit RDRF,a
57 jr z,as0inp
58
59 in0 c,(rdr0)
60 and a,M_OVRN+M_PERR+M_FE
61 jr z,as0in_ex
62
63 in0 a,(cntla0)
64 res EFR,a
65 out0 (cntla0),a
66 as0in_ex:
67 ld a,c
68 ret
69
70 as1inp:
71 in0 a,(stat1)
72 bit RDRF,a
73 jr z,as1inp
74
75 in0 c,(rdr1)
76 and a,M_OVRN+M_PERR+M_FE
77 jr z,as1in_ex
78
79 in0 a,(cntla1)
80 res EFR,a
81 out0 (cntla1),a
82 as1in_ex:
83 ld a,c
84 ret
85
86 if 0
87 in0 a,(stat1)
88 rlca
89 jr nc,as1inp
90 in0 a,rdr1
91 ret
92 endif
93
94
95 as0osta:
96 in0 a,(stat0)
97 and M_TDRE
98 ret z
99 or 0ffh
100 ret
101
102 as1osta:
103 in0 a,(stat1)
104 and M_TDRE
105 ret z
106 or 0ffh
107 ret
108
109
110 as0out:
111 in0 a,(stat0)
112 and M_TDRE
113 jr z,as0out
114 out0 (tdr0),c
115 ld a,c
116 ret
117
118 as1out:
119 in0 a,(stat1)
120 and M_TDRE
121 jr z,as1out
122 out0 (tdr1),c
123 ld a,c
124 ret
125
126 end