2180
|
1 ********************************************************************
|
|
2 * scdwp.asm - CoCo DriveWire Printer Driver
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Edt/Rev YYYY/MM/DD Modified by
|
|
7 * Comment
|
|
8 * ------------------------------------------------------------------
|
|
9 * 1 2009/03/06 Boisy G. Pitre
|
|
10 * Started.
|
|
11
|
|
12 nam scdwp
|
|
13 ttl CoCo DriveWire Printer Driver
|
|
14
|
|
15 ifp1
|
|
16 use defsfile
|
2183
|
17 use dwdefs.d
|
2180
|
18 endc
|
|
19
|
|
20 tylg set Drivr+Objct
|
|
21 atrv set ReEnt+Rev
|
|
22 rev set $00
|
|
23 edition set 1
|
|
24
|
|
25 mod eom,name,tylg,atrv,Start,Size
|
|
26
|
|
27 fcb READ.+WRITE.
|
|
28
|
|
29 name fcs /scdwp/
|
|
30 fcb edition one more revision level than the stock printer
|
|
31
|
|
32 * Device memory area: offset from U
|
|
33 org V.SCF V.SCF: free memory for driver to use
|
|
34 V.PAR rmb 1 1=space, 2=mark parity
|
|
35 V.BIT rmb 1 0=7, 1=8 bits
|
|
36 V.STP rmb 1 0=1 stop bit, 1=2 stop bits
|
|
37 V.COM rmb 2 Com Status baud/parity (=Y from SS.Comst Set/GetStt
|
|
38 V.COL rmb 1 columns
|
|
39 V.ROW rmb 1 rows
|
|
40 V.WAIT rmb 2 wait count for baud rate?
|
|
41 V.TRY rmb 2 number of re-tries if printer is busy
|
|
42 V.RTRY rmb 1 low nibble of parity=high byte of number of retries
|
|
43 V.BUFF rmb $80 room for 128 blocked processes
|
|
44 size equ .
|
|
45
|
|
46 start equ *
|
|
47 lbra Init
|
|
48 lbra Read
|
|
49 lbra Write
|
|
50 lbra GetStt
|
|
51 lbra SetStt
|
|
52
|
|
53 * Term
|
|
54 *
|
|
55 * Entry:
|
|
56 * U = address of device memory area
|
|
57 *
|
|
58 * Exit:
|
|
59 * CC = carry set on error
|
|
60 * B = error code
|
|
61 *
|
|
62 Term equ *
|
|
63 clrb
|
|
64 rts
|
|
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
|
2213
|
77 * Check if D.DWSUB already holds a valid subroutine module pointer
|
|
78 IFGT Level-1
|
|
79 ldx <D.DWSUB
|
|
80 ELSE
|
|
81 ldx >D.DWSUB
|
|
82 ENDC
|
|
83 bne InitEx
|
|
84
|
|
85 * If here, D.DWSUB is 0, so we must link to subroutine module
|
|
86 IFGT Level-1
|
|
87 ldx <D.Proc
|
|
88 pshs x
|
|
89 ldx <D.SysPrc
|
|
90 stx <D.Proc
|
|
91 ENDC
|
|
92 clra
|
|
93 leax dw3name,pcr
|
|
94 os9 F$Link
|
|
95 IFGT Level-1
|
|
96 puls x
|
|
97 stx <D.Proc
|
|
98 ENDC
|
|
99 bcs InitEx
|
|
100 IFGT Level-1
|
|
101 sty <D.DWSUB
|
|
102 ELSE
|
|
103 sty >D.DWSUB
|
|
104 ENDC
|
|
105 jsr ,y call init routine
|
|
106 InitEx rts
|
|
107
|
|
108 dw3name fcs /dw3/
|
2180
|
109
|
|
110 * Write
|
|
111 *
|
|
112 * Entry:
|
|
113 * A = character to write
|
|
114 * Y = address of path descriptor
|
|
115 * U = address of device memory area
|
|
116 *
|
|
117 * Exit:
|
|
118 * CC = carry set on error
|
|
119 * B = error code
|
|
120 *
|
|
121 Write equ *
|
|
122 tfr a,b
|
2183
|
123 lda #OP_PRINT
|
2180
|
124 pshs d
|
|
125 leax ,s
|
|
126 ldy #$0002
|
|
127 ldu >D.DWSUB
|
|
128 jsr 6,u
|
|
129 puls d,pc
|
|
130
|
|
131
|
|
132 * GetStat
|
|
133 *
|
|
134 * Entry:
|
|
135 * A = function code
|
|
136 * Y = address of path descriptor
|
|
137 * U = address of device memory area
|
|
138 *
|
|
139 * Exit:
|
|
140 * CC = carry set on error
|
|
141 * B = error code
|
|
142 *
|
|
143 GetStt cmpa #SS.EOF end of file?
|
|
144 bne L0112
|
|
145 clrb if so, exit with no error
|
|
146 rts
|
|
147
|
|
148 L0112 ldx PD.RGS,y
|
|
149 cmpa #SS.ScSiz
|
|
150 beq L0123
|
|
151 cmpa #SS.ComSt
|
|
152 bne L0173
|
|
153 clra
|
|
154 clrb
|
|
155 std R$Y,x
|
|
156 clrb
|
|
157 rts
|
|
158
|
|
159 * get screen size GetStt
|
|
160 L0123 clra
|
|
161 ldb #80
|
|
162 std R$X,x
|
|
163 ldb #24
|
|
164 std R$Y,x
|
|
165 clrb
|
|
166 rts
|
|
167
|
|
168 * SetStat
|
|
169 *
|
|
170 * Entry:
|
|
171 * A = function code
|
|
172 * Y = address of path descriptor
|
|
173 * U = address of device memory area
|
|
174 *
|
|
175 * Exit:
|
|
176 * CC = carry set on error
|
|
177 * B = error code
|
|
178 *
|
|
179 SetStt
|
|
180 Close cmpa #SS.Close close the device?
|
|
181 bne L0173
|
2183
|
182 lda #OP_PRINTFLUSH send PrintQueue Flush Packet
|
2180
|
183 pshs a
|
|
184 ldy #$0001
|
|
185 leax ,s
|
|
186 ldu >D.DWSUB
|
|
187 jsr 6,u
|
|
188 puls a,pc
|
|
189
|
|
190
|
|
191 Read comb
|
|
192 ldb #E$BMode
|
|
193 rts
|
|
194
|
|
195 L0173 comb
|
|
196 ldb #E$UnkSVc
|
|
197 rts
|
|
198
|
|
199 emod
|
|
200 eom equ *
|
|
201 end
|