0
|
1 ********************************************************************
|
|
2 * SIO - CoCo 3 Serial driver
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Ed. Comments Who YY/MM/DD
|
|
7 * ------------------------------------------------------------------
|
|
8 * 9 Original Tandy L2 distribution version
|
|
9
|
|
10 nam SIO
|
|
11 ttl CoCo 3 Serial driver
|
|
12
|
|
13 * Disassembled 98/08/23 20:58:36 by Disasm v1.6 (C) 1988 by RML
|
|
14
|
|
15 ifp1
|
|
16 use defsfile
|
|
17 use scfdefs
|
|
18 endc
|
|
19
|
|
20 tylg set Drivr+Objct
|
|
21 atrv set ReEnt+rev
|
|
22 rev set $01
|
|
23 edition set 9
|
|
24
|
|
25 mod eom,name,tylg,atrv,start,size
|
|
26
|
|
27 u0000 rmb 29
|
|
28 u001D rmb 1
|
|
29 u001E rmb 1
|
|
30 u001F rmb 1
|
|
31 u0020 rmb 2
|
|
32 u0022 rmb 2
|
|
33 u0024 rmb 1
|
|
34 u0025 rmb 1
|
|
35 size equ .
|
|
36 fcb $03
|
|
37
|
|
38 name fcs /SIO/
|
|
39 fcb edition
|
|
40
|
|
41 L0012 fcb $09
|
|
42 fcb $0C
|
|
43 fcb $03
|
|
44 fcb $4C L
|
|
45 fcb $01
|
|
46 fcb $A2 "
|
|
47 fcb $00
|
|
48 fcb $CE N
|
|
49 fcb $00
|
|
50 fcb $62 b
|
|
51 fcb $00
|
|
52 fcb $2E .
|
|
53 fcb $00
|
|
54 fcb $12
|
|
55 fcb $00
|
|
56 fcb $03
|
|
57
|
|
58 start lbra Init
|
|
59 lbra Read
|
|
60 lbra Write
|
|
61 lbra GetStat
|
|
62 lbra SetStat
|
|
63 lbra Term
|
|
64
|
|
65 * Init
|
|
66 *
|
|
67 * Entry:
|
|
68 * Y = address of device descriptor
|
|
69 * U = address of device memory area
|
|
70 *
|
|
71 * Exit:
|
|
72 * CC = carry set on error
|
|
73 * B = error code
|
|
74 *
|
|
75 Init pshs cc
|
|
76 orcc #IntMasks
|
|
77 ldx #PIA1Base
|
|
78 clr $01,x
|
|
79 ldd <IT.COL,y get col/row bytes
|
|
80 std <u0024,u
|
|
81 lda #$FE
|
|
82 sta ,x
|
|
83 lda #$36
|
|
84 sta $01,x
|
|
85 lda ,x
|
|
86 ldd <IT.PAR,y get parity/baud
|
|
87 lbsr L0148
|
|
88 puls cc
|
|
89 clrb
|
|
90
|
|
91 * Term
|
|
92 *
|
|
93 * Entry:
|
|
94 * U = address of device memory area
|
|
95 *
|
|
96 * Exit:
|
|
97 * CC = carry set on error
|
|
98 * B = error code
|
|
99 *
|
|
100 Term rts
|
|
101
|
|
102 * Read
|
|
103 *
|
|
104 * Entry:
|
|
105 * Y = address of path descriptor
|
|
106 * U = address of device memory area
|
|
107 *
|
|
108 * Exit:
|
|
109 * A = character read
|
|
110 * CC = carry set on error
|
|
111 * B = error code
|
|
112 *
|
|
113 Read bsr L00AC
|
|
114 bcs L00C8
|
|
115 ldb #$08
|
|
116 pshs b,cc
|
|
117 tst <u001E,u
|
|
118 beq L0066
|
|
119 dec $01,s
|
|
120 L0066 bra L0077
|
|
121 L0068 lda <PD.BAU,y
|
|
122 anda #$0F
|
|
123 cmpa #$07
|
|
124 beq L0077
|
|
125 ldx #$0001
|
|
126 os9 F$Sleep
|
|
127 L0077 pshs y
|
|
128 ldy #$FFFF
|
|
129 L007D lda >PIA1Base+2
|
|
130 leay -$01,y
|
|
131 beq L008B
|
|
132 lsra
|
|
133 bcs L007D
|
|
134 puls y
|
|
135 bra L0090
|
|
136 L008B puls y
|
|
137 lsra
|
|
138 bcs L0068
|
|
139 L0090 orcc #IntMasks
|
|
140 clra
|
|
141 bsr L00D5
|
|
142 L0095 bsr L00CE
|
|
143 ldb >PIA1Base+2
|
|
144 lsrb
|
|
145 rora
|
|
146 dec $01,s
|
|
147 bne L0095
|
|
148 bsr L00D5
|
|
149 tst <u001E,u
|
|
150 beq L00A8
|
|
151 lsra
|
|
152 L00A8 puls b,cc
|
|
153 clrb
|
|
154 rts
|
|
155 L00AC pshs a
|
|
156 lda <PD.BAU,y
|
|
157 anda #$0F
|
|
158 cmpa #$08
|
|
159 bcc L00C4
|
|
160 lsla
|
|
161 leax >L0012,pcr
|
|
162 ldd a,x
|
|
163 std <u0020,u
|
|
164 clrb
|
|
165 puls pc,a
|
|
166 L00C4 ldb #E$BMode
|
|
167 puls a
|
|
168 L00C8 orcc #Carry
|
|
169 rts
|
|
170 L00CB stb >PIA1Base
|
|
171 L00CE pshs b,a
|
|
172 ldd <u0020,u
|
|
173 bra L00DC
|
|
174 L00D5 pshs b,a
|
|
175 ldd <u0020,u
|
|
176 lsra
|
|
177 rorb
|
|
178 L00DC subd #$0001
|
|
179 bne L00DC
|
|
180 puls pc,b,a
|
|
181
|
|
182 * Write
|
|
183 *
|
|
184 * Entry:
|
|
185 * A = character to write
|
|
186 * Y = address of path descriptor
|
|
187 * U = address of device memory area
|
|
188 *
|
|
189 * Exit:
|
|
190 * CC = carry set on error
|
|
191 * B = error code
|
|
192 *
|
|
193 Write bsr L00AC
|
|
194 bcs L00C8
|
|
195 ldb #$09
|
|
196 pshs b,cc
|
|
197 orcc #IntMasks
|
|
198 tst <u001E,u
|
|
199 beq L00F4
|
|
200 dec $01,s
|
|
201 L00F4 andcc #^Carry
|
|
202 L00F6 ldb #$02
|
|
203 bcs L00FB
|
|
204 clrb
|
|
205 L00FB bsr L00CB
|
|
206 lsra
|
|
207 dec $01,s
|
|
208 bne L00F6
|
|
209 ldb <u001D,u
|
|
210 beq L010B
|
|
211 andb #$FE
|
|
212 bsr L00CB
|
|
213 L010B ldb #$02
|
|
214 bsr L00CB
|
|
215 tst <u001F,u
|
|
216 beq L0118
|
|
217 ldb #$02
|
|
218 bsr L00CB
|
|
219 L0118 puls pc,b,cc
|
|
220
|
|
221 * GetStat
|
|
222 *
|
|
223 * Entry:
|
|
224 * A = function code
|
|
225 * Y = address of path descriptor
|
|
226 * U = address of device memory area
|
|
227 *
|
|
228 * Exit:
|
|
229 * CC = carry set on error
|
|
230 * B = error code
|
|
231 *
|
|
232 GetStat cmpa #SS.EOF
|
|
233 bne L0120
|
|
234 L011E clrb
|
|
235 rts
|
|
236 L0120 ldx PD.RGS,y
|
|
237 cmpa #SS.ScSiz
|
|
238 beq L0131
|
|
239 cmpa #SS.ComSt
|
|
240 bne L017E
|
|
241 ldd <u0022,u
|
|
242 std R$Y,x
|
|
243 bra L011E
|
|
244 L0131 ldx PD.RGS,y
|
|
245 clra
|
|
246 ldb <u0024,u
|
|
247 std R$X,x
|
|
248 ldb <u0025,u
|
|
249 std R$Y,x
|
|
250 bra L011E
|
|
251
|
|
252 * SetStat
|
|
253 *
|
|
254 * Entry:
|
|
255 * A = function code
|
|
256 * Y = address of path descriptor
|
|
257 * U = address of device memory area
|
|
258 *
|
|
259 * Exit:
|
|
260 * CC = carry set on error
|
|
261 * B = error code
|
|
262 *
|
|
263 SetStat cmpa #SS.ComSt
|
|
264 bne L017E
|
|
265 ldx PD.RGS,y
|
|
266 ldd R$Y,x
|
|
267 L0148 std <u0022,u
|
|
268 clra
|
|
269 clrb
|
|
270 std <u001D,u
|
|
271 sta <u001F,u
|
|
272 ldd <u0022,u
|
|
273 tstb
|
|
274 bpl L015C
|
|
275 inc <u001F,u
|
|
276 L015C bitb #$40
|
|
277 bne L017A
|
|
278 bitb #$20
|
|
279 beq L0167
|
|
280 inc <u001E,u
|
|
281 L0167 bita #$20
|
|
282 beq L0179
|
|
283 bita #$80
|
|
284 beq L017A
|
|
285 inc <u001D,u
|
|
286 bita #$40
|
|
287 bne L0179
|
|
288 inc <u001D,u
|
|
289 L0179 rts
|
|
290 L017A comb
|
|
291 ldb #E$BMode
|
|
292 rts
|
|
293 L017E comb
|
|
294 ldb #E$UnkSvc
|
|
295 rts
|
|
296
|
|
297 emod
|
|
298 eom equ *
|
|
299 end
|