0
|
1 ********************************************************************
|
|
2 * PRINTER - CoCo serial port printer driver
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Ed. Comments Who YY/MM/DD
|
|
7 * ------------------------------------------------------------------
|
201
|
8 * 10 From Tandy OS-9 Level One VR 02.00.00
|
0
|
9
|
|
10 nam PRINTER
|
|
11 ttl CoCo serial port printer driver
|
|
12
|
|
13 * Disassembled 98/08/23 17:32:06 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
|
201
|
23 edition set 10
|
0
|
24
|
|
25 mod eom,name,tylg,atrv,start,size
|
|
26
|
257
|
27 rmb V.SCF
|
0
|
28 u001D rmb 1
|
|
29 u001E rmb 1
|
|
30 u001F rmb 1
|
|
31 u0020 rmb 2
|
|
32 u0022 rmb 1
|
|
33 u0023 rmb 1
|
|
34 u0024 rmb 2
|
|
35 u0026 rmb 2
|
|
36 u0028 rmb 1
|
|
37 size equ .
|
256
|
38
|
|
39 fcb UPDAT.
|
0
|
40
|
|
41 name fcs /PRINTER/
|
|
42 fcb edition
|
|
43
|
|
44 L0016 fcb $04
|
|
45 fcb $82
|
|
46 fcb $01
|
|
47 fcb $A2 "
|
|
48 fcb $00
|
|
49 fcb $CD M
|
|
50 fcb $00
|
|
51 fcb $63 c
|
|
52 fcb $00
|
|
53 fcb $2D -
|
|
54 fcb $00
|
|
55 fcb $13
|
|
56 fcb $00
|
|
57 fcb $05
|
|
58
|
|
59 start lbra Init
|
|
60 lbra Read
|
|
61 lbra Write
|
|
62 lbra GetStat
|
|
63 lbra SetStat
|
|
64 lbra Term
|
|
65
|
|
66 * Init
|
|
67 *
|
|
68 * Entry:
|
|
69 * Y = address of device descriptor
|
|
70 * U = address of device memory area
|
|
71 *
|
|
72 * Exit:
|
|
73 * CC = carry set on error
|
|
74 * B = error code
|
|
75 *
|
|
76 Init pshs cc
|
|
77 orcc #IntMasks
|
|
78 ldx #PIA.U8
|
|
79 clr $01,x
|
|
80 ldd <IT.COL,y get column size
|
|
81 std <u0022,u
|
|
82 lda #$FE
|
|
83 sta ,x
|
|
84 lda #$36
|
|
85 sta $01,x
|
|
86 lda ,x
|
|
87 ldd <IT.PAR,y get parity/baud
|
|
88 lbsr L0155
|
|
89 puls cc
|
|
90 lbsr L0104
|
|
91 lbcs L0100
|
|
92
|
|
93 * Term
|
|
94 *
|
|
95 * Entry:
|
|
96 * U = address of device memory area
|
|
97 *
|
|
98 * Exit:
|
|
99 * CC = carry set on error
|
|
100 * B = error code
|
|
101 *
|
|
102 Term rts
|
|
103
|
|
104 L005F pshs a
|
|
105 lda <$35,y
|
|
106 anda #$0F
|
|
107 cmpa #$07
|
|
108 bcc L0076
|
|
109 lsla
|
|
110 leax <L0016,pcr
|
|
111 ldd a,x
|
|
112 std <u0024,u
|
|
113 clrb
|
|
114 puls pc,a
|
|
115 L0076 ldb #E$BMode
|
|
116 puls a
|
|
117 L007A orcc #Carry
|
|
118 rts
|
|
119 L007D stb >PIA.U8
|
|
120 L0080 pshs b,a
|
|
121 ldd <u0024,u
|
|
122 L0085 subd #$0001
|
|
123 bne L0085
|
|
124 puls pc,b,a
|
|
125
|
|
126 * Write
|
|
127 *
|
|
128 * Entry:
|
|
129 * A = character to write
|
|
130 * Y = address of path descriptor
|
|
131 * U = address of device memory area
|
|
132 *
|
|
133 * Exit:
|
|
134 * CC = carry set on error
|
|
135 * B = error code
|
|
136 *
|
|
137 Write bsr L005F
|
|
138 bcs L007A
|
|
139 pshs b,a
|
|
140 bsr L00CB
|
|
141 puls b,a
|
|
142 bcs L0100
|
|
143 ldb #$09
|
|
144 pshs b,cc
|
|
145 orcc #IntMasks
|
|
146 tst <u001E,u
|
|
147 beq L00A5
|
|
148 dec $01,s
|
|
149 L00A5 andcc #^Carry
|
|
150 L00A7 ldb #$02
|
|
151 bcs L00AC
|
|
152 clrb
|
|
153 L00AC bsr L007D
|
|
154 lsra
|
|
155 dec $01,s
|
|
156 bne L00A7
|
|
157 ldb <u001D,u
|
|
158 beq L00BC
|
|
159 andb #$FE
|
|
160 bsr L007D
|
|
161 L00BC ldb #$02
|
|
162 bsr L007D
|
|
163 tst <u001F,u
|
|
164 beq L00C9
|
|
165 ldb #$02
|
|
166 bsr L007D
|
|
167 L00C9 puls pc,b,cc
|
|
168 L00CB clra
|
|
169 clrb
|
|
170 std <u0026,u
|
|
171 L00D0 ldd #$0303
|
|
172 L00D3 bsr L0104
|
|
173 bcs L00DE
|
|
174 bsr L0080
|
|
175 decb
|
|
176 bne L00D3
|
|
177 clrb
|
|
178 rts
|
|
179 L00DE bsr L0080
|
|
180 deca
|
|
181 bne L00D3
|
|
182 pshs x
|
|
183 ldx #$0001
|
|
184 os9 F$Sleep
|
|
185 puls x
|
|
186 ldd <u0026,u
|
|
187 addd #$0001
|
|
188 std <u0026,u
|
|
189 ldb <u0028,u
|
|
190 beq L00D0
|
|
191 cmpb <u0026,u
|
|
192 bhi L00D0
|
|
193 L0100 comb
|
|
194 ldb #E$NotRdy
|
|
195 rts
|
|
196 L0104 pshs x,b,a
|
|
197 ldb >PIA.U8+2
|
|
198 lda >$FF69
|
|
199 bpl L0126
|
|
200 lda >PIA.U8+3
|
|
201 bita #$01
|
|
202 beq L0126
|
|
203 bita #$80
|
|
204 beq L0126
|
|
205 orcc #Entire
|
|
206 leax <L0126,pcr
|
|
207 pshs x
|
|
208 pshs u,y,x,dp,b,a,cc
|
|
209 jmp [D.SvcIRQ]
|
|
210 L0126 lsrb
|
|
211 puls pc,x,b,a
|
|
212
|
|
213 * GetStat
|
|
214 *
|
|
215 * Entry:
|
|
216 * A = function code
|
|
217 * Y = address of path descriptor
|
|
218 * U = address of device memory area
|
|
219 *
|
|
220 * Exit:
|
|
221 * CC = carry set on error
|
|
222 * B = error code
|
|
223 *
|
|
224 GetStat cmpa #SS.EOF
|
|
225 bne L012F
|
|
226 L012D clrb
|
|
227 rts
|
|
228 L012F ldx PD.RGS,y
|
|
229 cmpa #SS.ScSiz
|
|
230 beq L0140
|
|
231 cmpa #SS.ComSt
|
|
232 bne L0190
|
|
233 ldd <u0020,u
|
|
234 std R$Y,x
|
|
235 bra L012D
|
|
236 L0140 clra
|
|
237 ldb <u0022,u
|
|
238 std R$X,x
|
|
239 ldb <u0023,u
|
|
240 std R$Y,x
|
|
241 bra L012D
|
|
242
|
|
243 * GetStat
|
|
244 *
|
|
245 * Entry:
|
|
246 * A = function code
|
|
247 * Y = address of path descriptor
|
|
248 * U = address of device memory area
|
|
249 *
|
|
250 * Exit:
|
|
251 * CC = carry set on error
|
|
252 * B = error code
|
|
253 *
|
|
254 SetStat cmpa #SS.ComSt
|
|
255 bne L0190
|
|
256 ldx PD.RGS,y
|
|
257 ldd R$Y,x
|
|
258 L0155 std <u0020,u
|
|
259 clra
|
|
260 clrb
|
|
261 std <u001D,u
|
|
262 sta <u001F,u
|
|
263 ldd <u0020,u
|
|
264 tstb
|
|
265 bpl L0169
|
|
266 inc <u001F,u
|
|
267 L0169 bitb #$40
|
|
268 bne Read
|
|
269 bitb #$20
|
|
270 beq L0174
|
|
271 inc <u001E,u
|
|
272 L0174 bita #$20
|
|
273 beq L0186
|
|
274 bita #$80
|
|
275 beq Read
|
|
276 inc <u001D,u
|
|
277 bita #$40
|
|
278 bne L0186
|
|
279 inc <u001D,u
|
|
280 L0186 anda #$0F
|
|
281 sta <u0028,u
|
|
282 rts
|
|
283
|
|
284 * Read
|
|
285 *
|
|
286 * Entry:
|
|
287 * Y = address of path descriptor
|
|
288 * U = address of device memory area
|
|
289 *
|
|
290 * Exit:
|
|
291 * A = character read
|
|
292 * CC = carry set on error
|
|
293 * B = error code
|
|
294 *
|
|
295 Read comb
|
|
296 ldb <E$BMode
|
|
297 rts
|
|
298
|
|
299 L0190 comb
|
|
300 ldb #E$UnkSvc
|
|
301 rts
|
|
302
|
|
303 emod
|
|
304 eom equ *
|
|
305 end
|
|
306
|