annotate level1/modules/scbbp.asm @ 2939:011a5f26e9da

rb1773: Fix comments about 135 TPI versus 48 or 96 Some comments were wrong about 48/96/135 TPI. Some new comments have been added. There are no code changes in this commit, the assembled binary should be identical.
author Robert Gault <robert.gault@att.net>
date Sat, 25 Jan 2014 23:19:38 +0100
parents b41df77588b0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1942
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
1 ********************************************************************
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
2 * scbbp.asm - CoCo Bit-Banger Printer Driver
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
3 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
4 * $Id$
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
5 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
6 * Enhanced and re-written by Alan DeKok
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
7 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
8 * Problems with original:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
9 * returns wrong error on Read/SetStt
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
10 * doesn't block output. The printer is a single-user device!
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
11 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
12 * Edt/Rev YYYY/MM/DD Modified by
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
13 * Comment
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
14 * ------------------------------------------------------------------
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
15 * 13 2003/01/05 Boisy G. Pitre
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
16 * Back-ported to OS-9 Level Two.
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
17 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
18 * 2003/09/04 Boisy G. Pitre
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
19 * Back-ported to OS-9 Level One.
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
20
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
21 nam scbbp
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
22 ttl CoCo Bit-Banger Printer Driver
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
23
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
24 ifp1
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
25 use defsfile
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
26 endc
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
27
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
28 tylg set Drivr+Objct
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
29 atrv set ReEnt+Rev
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
30 rev set $00
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
31 edition set 13
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
32
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
33 mod eom,name,tylg,atrv,Start,Size
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
34
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
35 fcb READ.+WRITE.
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
36
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
37 name fcs /scbbp/
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
38 fcb edition one more revision level than the stock printer
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
39
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
40 * Device memory area: offset from U
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
41 org V.SCF V.SCF: free memory for driver to use
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
42 V.PAR rmb 1 1=space, 2=mark parity
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
43 V.BIT rmb 1 0=7, 1=8 bits
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
44 V.STP rmb 1 0=1 stop bit, 1=2 stop bits
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
45 V.COM rmb 2 Com Status baud/parity (=Y from SS.Comst Set/GetStt
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
46 V.COL rmb 1 columns
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
47 V.ROW rmb 1 rows
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
48 V.WAIT rmb 2 wait count for baud rate?
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
49 V.TRY rmb 2 number of re-tries if printer is busy
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
50 V.RTRY rmb 1 low nibble of parity=high byte of number of retries
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
51 V.BUFF rmb $80 room for 128 blocked processes
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
52 size equ .
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
53
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
54 * Baud Rate Delay Table
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
55 BaudDly equ *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
56 IFEQ Level-1
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
57 * OS-9 Level One delay values (0.89MHz)
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
58 fdb $0482 110 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
59 fdb $01A2 300 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
60 fdb $00CD 600 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
61 fdb $0063 1200 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
62 fdb $002D 2400 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
63 fdb $0013 4800 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
64 fdb $0005 9600 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
65 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
66 IFEQ H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
67 * OS-9 Level Two delay values (1.78MHz)
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
68 fdb $090C 110 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
69 fdb $034C 300 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
70 fdb $01A2 600 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
71 fdb $00CE 1200 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
72 fdb $0062 2400 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
73 fdb $002E 4800 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
74 fdb $0012 9600 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
75 fdb $0003 32000 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
76 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
77 * NitrOS-9 Level Two delay values (1.78MHz)
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
78 fdb $090C 110 baud (Unchanged, unknown)
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
79 fdb $03D0 300 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
80 fdb $01A2 600 baud (Unchanged, unknown)
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
81 fdb $00F0 1200 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
82 fdb $0073 2400 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
83 fdb $0036 4800 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
84 fdb $0017 9600 baud
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
85 fdb $0003 32000 baud (Unchanged, unknown)
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
86 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
87 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
88
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
89
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
90 start equ *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
91 lbra Init
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
92 lbra Read
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
93 lbra Write
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
94 lbra GetStt
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
95 lbra SetStt
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
96
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
97 * Term
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
98 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
99 * Entry:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
100 * U = address of device memory area
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
101 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
102 * Exit:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
103 * CC = carry set on error
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
104 * B = error code
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
105 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
106 Term equ *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
107 clrb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
108 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
109
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
110 * Init
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
111 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
112 * Entry:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
113 * Y = address of device descriptor
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
114 * U = address of device memory area
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
115 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
116 * Exit:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
117 * CC = carry set on error
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
118 * B = error code
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
119 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
120 Init orcc #IntMasks
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
121 ldx #PIA1Base
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
122 clr $01,x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
123 ldd <IT.COL,y get number of columns/rows
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
124 std <V.COL,u save it in statics
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
125 lda #$FE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
126 sta ,x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
127 lda #$36
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
128 sta $01,x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
129 lda ,x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
130 andcc #^IntMasks
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
131 ldd <IT.PAR,y parity and baud rate
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
132 lbsr L0138 setup parity/baud in device memory
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
133 lbsr L0104 get low bit of $FF22 into carry
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
134 lbcs L0100 it's the ready flag
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
135 * clear out buffer
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
136 leax V.BUFF,u room for 128 blocked processes
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
137 ldb #128
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
138 I010 clr ,x+ we're more concerned with room
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
139 decb than with speed, so we don't use TFM
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
140 bne I010
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
141 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
142
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
143 L005F ldb <PD.BAU,y get baud rate in path desc.
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
144 andb #$0F keep lower nibble
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
145 cmpb #$07 compare against highest
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
146 lbhs Read
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
147 aslb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
148 leax <BaudDly,pc table of delay times
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
149 ldx b,x get delay counter
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
150 stx <V.WAIT,u save it off
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
151 clrb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
152 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
153
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
154 Bit_2 ldb #$02
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
155 L007D stb >PIA1Base
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
156 L0080 pshs d
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
157 ldd <V.WAIT,u get wait count for baud rate
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
158 L0085 equ *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
159 IFNE H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
160 decd count down by one
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
161 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
162 subd #$0001
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
163 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
164 bne L0085
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
165 puls pc,d
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
166
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
167 * Write
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
168 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
169 * Entry:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
170 * A = character to write
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
171 * Y = address of path descriptor
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
172 * U = address of device memory area
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
173 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
174 * Exit:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
175 * CC = carry set on error
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
176 * B = error code
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
177 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
178 Write equ *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
179 leax V.BUFF,u point to the buffer
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
180 ldb V.BUSY,u get my process number
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
181 tst ,x get allowed process number
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
182 bne W010 if not zero, else
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
183 stb ,x I'm the only one allowed to use it
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
184
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
185 W010 cmpb ,x am I allowed to use /p?
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
186 beq W030 if yes, go write a character
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
187
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
188 ***************************************************************
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
189 * WARNING: If more than 128 processes try to use the printer,
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
190 * this will CRASH BADLY. Since Level II on the Coco is limited
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
191 * to 32 processes, I don't think it's a problem.
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
192 ***************************************************************
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
193
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
194 W020 tst ,x+ if not, find the first non-zero entry
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
195 bne W020
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
196 stb -1,x and save my process number at the first zero
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
197 pshs a
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
198 lda V.BUFF,u process that's allowed to use /p
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
199 sta V.BUSY,u make it the busy one
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
200 ldb #S$Wake wake it up
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
201 os9 F$Send send a signal to wake it
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
202 IFNE H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
203 tfr 0,x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
204 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
205 ldx #$0000
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
206 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
207 os9 F$Sleep and go to sleep forever
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
208 puls a restore character to be sent, and continue
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
209
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
210 W030 bsr L005F set up baud rate, etc in memory
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
211 bcs L00CA
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
212 pshs a
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
213 bsr L00CB make sure that the device is ready
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
214 puls a
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
215 bcs L00CA if the device is not ready
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
216 IFNE H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
217 lde #$09 9 bits to send out
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
218 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
219 pshs b,a
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
220 lda #$09
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
221 sta 1,s
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
222 puls a
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
223 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
224 orcc #IntMasks turn off interrupts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
225 tst <V.BIT,u number of bits
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
226 beq L00AC if 7 bits, count down by one
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
227 IFNE H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
228 dece initially send out start bit
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
229 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
230 dec ,s
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
231 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
232
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
233 L00AC bsr L007D write B to $FF20 and wait
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
234 clrb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
235 lsra move A into carry
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
236 rolb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
237 rolb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
238 IFNE H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
239 dece count down on the number of bits to send
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
240 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
241 dec ,s
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
242 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
243 bne L00AC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
244 IFEQ H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
245 puls b
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
246 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
247 ldb <V.PAR,u space/mark parity
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
248 beq L00BC 0=no parity
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
249 andb #$FE 1=space, 0=mark parity
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
250 * should be andb #$FD I think...
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
251 bsr L007D dump out parity
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
252 L00BC bsr Bit_2 and a stop bit
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
253 tst <V.STP,u do another one?
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
254 beq L00C9
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
255 bsr Bit_2 yes, dump out another stop bit
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
256 L00C9 andcc #^IntMasks
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
257 L00CA rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
258
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
259 L0104 pshs b
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
260 ldb >PIA1Base+$02 get a byte
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
261 lsrb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
262 puls pc,b
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
263
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
264 L00CB equ *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
265 IFNE H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
266 clrd
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
267 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
268 clra
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
269 clrb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
270 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
271 std <V.TRY,u
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
272 L00D0 ldd #$0303
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
273 L00D3 bsr L0104 get device ready status
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
274 bcs L00DE if not ready, wait for a bit
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
275 IFNE H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
276 bsr L0080 wait
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
277 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
278 lbsr L0080 wait
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
279 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
280 decb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
281 bne L00D3 try again
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
282 clrb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
283 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
284
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
285 L00DE lbsr L0080 wait for a while
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
286 deca try 3 times,
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
287 bne L00D3
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
288 pshs x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
289 ldx #$0001
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
290 os9 F$Sleep sleep for the rest of this tick
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
291 puls x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
292 ldd <V.TRY,u
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
293 IFNE H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
294 incd we've tried once more and failed...
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
295 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
296 addd #$0001
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
297 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
298 std <V.TRY,u
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
299 ldb <V.RTRY,u number of retries to do
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
300 beq L00D0 if unspecified, keep retrying
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
301 cmpb <V.TRY,u if exceeded number of retries,
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
302 bhi L00D0 then we crap out
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
303
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
304 L0100 comb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
305 ldb #E$NotRdy
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
306 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
307
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
308 * GetStat
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
309 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
310 * Entry:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
311 * A = function code
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
312 * Y = address of path descriptor
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
313 * U = address of device memory area
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
314 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
315 * Exit:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
316 * CC = carry set on error
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
317 * B = error code
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
318 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
319 GetStt cmpa #SS.EOF end of file?
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
320 bne L0112
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
321 clrb if so, exit with no error
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
322 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
323
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
324 L0112 ldx PD.RGS,y
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
325 cmpa #SS.ScSiz
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
326 beq L0123
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
327 cmpa #SS.ComSt
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
328 bne L0173
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
329 ldd <V.COM,u get Com status
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
330 std R$Y,x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
331 clrb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
332 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
333
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
334 * get screen size GetStt
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
335 L0123 clra
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
336 ldb <V.COL,u
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
337 std R$X,x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
338 ldb <V.ROW,u
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
339 std R$Y,x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
340 clrb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
341 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
342
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
343 * SetStat
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
344 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
345 * Entry:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
346 * A = function code
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
347 * Y = address of path descriptor
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
348 * U = address of device memory area
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
349 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
350 * Exit:
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
351 * CC = carry set on error
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
352 * B = error code
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
353 *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
354 SetStt cmpa #SS.ComSt
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
355 bne Close if not, check if it's a close
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
356 ldx PD.RGS,y
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
357 ldd R$Y,x
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
358 * A = Parity byte
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
359 * B = baud rate
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
360 L0138 std <V.COM,u save parity, baud rate in com status
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
361 IFNE H6309
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
362 clrd
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
363 ELSE
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
364 clra
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
365 clrb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
366 ENDC
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
367 std <V.PAR,u
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
368 sta <V.STP,u
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
369 ldd <V.COM,u
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
370 tstb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
371 bpl L014C
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
372 inc <V.STP,u do 2 stop bits
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
373 L014C bitb #$40 make sure the bit is zero
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
374 bne Read
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
375 bitb #$20 0=8, 1=7 bits
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
376 beq L0157
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
377 inc <V.BIT,u
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
378 L0157 bita #$20
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
379 beq L0169 if=0, no parity
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
380 bita #$80
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
381 beq Read if high bit set (only for ACIA devices), error out
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
382 inc <V.PAR,u parity
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
383 bita #$40
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
384 bne L0169 1=space,
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
385 inc <V.PAR,u 2=mark parity
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
386 L0169 anda #$0F
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
387 sta <V.RTRY,u
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
388 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
389
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
390 Read comb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
391 ldb #E$BMode
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
392 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
393
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
394 L0173 comb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
395 ldb #E$UnkSVc
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
396 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
397
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
398 Close cmpa #SS.Close close the device?
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
399 bne L0173
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
400 leax V.BUFF,u point to blocked process buffer
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
401
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
402 C010 lda 1,x get next process number
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
403 sta ,x+
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
404 bne C010 do until we have a zero byte
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
405
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
406 lda V.BUFF,u get the first process in the queue
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
407 beq C020 if none left
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
408 ldb #S$Wake wake up signal
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
409 os9 F$Send re-start the blocked process
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
410
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
411 C020 clrb
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
412 rts
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
413
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
414 emod
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
415 eom equ *
b41df77588b0 printer is now scbbp
boisy
parents:
diff changeset
416 end