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
|
|
77 rts
|
|
78
|
|
79 * Write
|
|
80 *
|
|
81 * Entry:
|
|
82 * A = character to write
|
|
83 * Y = address of path descriptor
|
|
84 * U = address of device memory area
|
|
85 *
|
|
86 * Exit:
|
|
87 * CC = carry set on error
|
|
88 * B = error code
|
|
89 *
|
|
90 Write equ *
|
|
91 tfr a,b
|
2183
|
92 lda #OP_PRINT
|
2180
|
93 pshs d
|
|
94 leax ,s
|
|
95 ldy #$0002
|
|
96 ldu >D.DWSUB
|
|
97 jsr 6,u
|
|
98 puls d,pc
|
|
99
|
|
100
|
|
101 * GetStat
|
|
102 *
|
|
103 * Entry:
|
|
104 * A = function code
|
|
105 * Y = address of path descriptor
|
|
106 * U = address of device memory area
|
|
107 *
|
|
108 * Exit:
|
|
109 * CC = carry set on error
|
|
110 * B = error code
|
|
111 *
|
|
112 GetStt cmpa #SS.EOF end of file?
|
|
113 bne L0112
|
|
114 clrb if so, exit with no error
|
|
115 rts
|
|
116
|
|
117 L0112 ldx PD.RGS,y
|
|
118 cmpa #SS.ScSiz
|
|
119 beq L0123
|
|
120 cmpa #SS.ComSt
|
|
121 bne L0173
|
|
122 clra
|
|
123 clrb
|
|
124 std R$Y,x
|
|
125 clrb
|
|
126 rts
|
|
127
|
|
128 * get screen size GetStt
|
|
129 L0123 clra
|
|
130 ldb #80
|
|
131 std R$X,x
|
|
132 ldb #24
|
|
133 std R$Y,x
|
|
134 clrb
|
|
135 rts
|
|
136
|
|
137 * SetStat
|
|
138 *
|
|
139 * Entry:
|
|
140 * A = function code
|
|
141 * Y = address of path descriptor
|
|
142 * U = address of device memory area
|
|
143 *
|
|
144 * Exit:
|
|
145 * CC = carry set on error
|
|
146 * B = error code
|
|
147 *
|
|
148 SetStt
|
|
149 Close cmpa #SS.Close close the device?
|
|
150 bne L0173
|
2183
|
151 lda #OP_PRINTFLUSH send PrintQueue Flush Packet
|
2180
|
152 pshs a
|
|
153 ldy #$0001
|
|
154 leax ,s
|
|
155 ldu >D.DWSUB
|
|
156 jsr 6,u
|
|
157 puls a,pc
|
|
158
|
|
159
|
|
160 Read comb
|
|
161 ldb #E$BMode
|
|
162 rts
|
|
163
|
|
164 L0173 comb
|
|
165 ldb #E$UnkSVc
|
|
166 rts
|
|
167
|
|
168 emod
|
|
169 eom equ *
|
|
170 end
|