Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/rs232.asm @ 1287:10957d54bf16
Made all modules rev 0
author | boisy |
---|---|
date | Sat, 30 Aug 2003 20:16:51 +0000 |
parents | 4e235f213651 |
children |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * RS232 - CoCo bit-banger driver | |
3 * | |
4 * $Id$ | |
5 * | |
6 * Ed. Comments Who YY/MM/DD | |
7 * ------------------------------------------------------------------ | |
201 | 8 * 7 From Tandy OS-9 Level One VR 02.00.00 |
0 | 9 |
10 nam RS232 | |
11 ttl CoCo bit-banger driver | |
12 | |
13 * Disassembled 98/08/23 17:32:49 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 | |
1287 | 22 rev set $00 |
201 | 23 edition set 7 |
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 | |
205 | 31 BaudCnt rmb 2 baud rate counter |
0 | 32 u0022 rmb 2 |
33 u0024 rmb 1 | |
34 u0025 rmb 1 | |
35 size equ . | |
256 | 36 |
37 fcb UPDAT. | |
0 | 38 |
39 name fcs /RS232/ | |
40 fcb edition | |
41 | |
205 | 42 BaudTbl fdb $0482 110 baud |
43 fdb $01A2 300 baud | |
44 fdb $00CD 600 baud | |
45 fdb $0063 1200 baud | |
46 fdb $002D 2400 baud | |
47 fdb $0013 4800 baud | |
48 fdb $0005 9600 baud | |
0 | 49 |
50 start lbra Init | |
51 lbra Read | |
52 lbra Write | |
53 lbra GetStat | |
54 lbra SetStat | |
55 lbra Term | |
56 | |
57 * Init | |
58 * | |
59 * Entry: | |
60 * Y = address of device descriptor | |
61 * U = address of device memory area | |
62 * | |
63 * Exit: | |
64 * CC = carry set on error | |
65 * B = error code | |
66 * | |
67 Init pshs cc | |
68 orcc #IntMasks | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
257
diff
changeset
|
69 ldx #PIA1Base |
0 | 70 clr $01,x |
71 ldd <IT.COL,y get col/row bytes | |
72 std <u0024,u | |
73 lda #$FE | |
74 sta ,x | |
75 lda #$36 | |
76 sta $01,x | |
77 lda ,x | |
78 ldd <IT.PAR,y get parity/baud | |
79 lbsr L014D | |
80 puls cc | |
81 clrb | |
82 | |
83 * Term | |
84 * | |
85 * Entry: | |
86 * U = address of device memory area | |
87 * | |
88 * Exit: | |
89 * CC = carry set on error | |
90 * B = error code | |
91 * | |
92 Term rts | |
93 | |
94 * Read | |
95 * | |
96 * Entry: | |
97 * Y = address of path descriptor | |
98 * U = address of device memory area | |
99 * | |
100 * Exit: | |
101 * A = character read | |
102 * CC = carry set on error | |
103 * B = error code | |
104 * | |
105 Read bsr L00B1 | |
106 bcs L00CD | |
107 ldb #$08 | |
108 pshs b,cc | |
109 tst <u001E,u | |
110 beq L0066 | |
111 dec $01,s | |
112 L0066 bra L006E | |
113 L0068 ldx #$0001 | |
114 os9 F$Sleep | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
257
diff
changeset
|
115 L006E lda >PIA1Base+2 |
0 | 116 lsra |
117 pshs x,a | |
118 lda >$FF69 | |
119 bpl L0091 | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
257
diff
changeset
|
120 lda >PIA1Base+3 |
0 | 121 bita #$01 |
122 beq L0091 | |
123 bita #$80 | |
124 beq L0091 | |
125 orcc #Entire | |
126 leax <L0091,pcr | |
127 pshs x | |
128 pshs u,y,x,dp,b,a,cc | |
129 jmp [D.SvcIRQ] | |
130 L0091 puls x,a | |
131 bcs L0068 | |
132 orcc #IntMasks | |
133 clra | |
134 bsr L00DA | |
135 L009A bsr L00D3 | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
257
diff
changeset
|
136 ldb >PIA1Base+2 |
0 | 137 lsrb |
138 rora | |
139 dec $01,s | |
140 bne L009A | |
141 bsr L00DA | |
142 tst <u001E,u | |
143 beq L00AD | |
144 lsra | |
145 L00AD puls b,cc | |
146 clrb | |
147 rts | |
148 L00B1 pshs a | |
149 lda <PD.BAU,y | |
205 | 150 anda #$0F mask out baud rate |
151 cmpa #B19200 | |
0 | 152 bcc L00C9 |
153 lsla | |
205 | 154 leax >BaudTbl,pcr |
0 | 155 ldd a,x |
205 | 156 std <BaudCnt,u |
0 | 157 clrb |
158 puls pc,a | |
205 | 159 L00C9 ldb #E$BMode |
0 | 160 puls a |
161 L00CD orcc #Carry | |
162 rts | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
257
diff
changeset
|
163 L00D0 stb >PIA1Base |
0 | 164 L00D3 pshs b,a |
205 | 165 ldd <BaudCnt,u |
0 | 166 bra L00E1 |
167 L00DA pshs b,a | |
205 | 168 ldd <BaudCnt,u |
0 | 169 lsra |
170 rorb | |
171 L00E1 subd #$0001 | |
172 bne L00E1 | |
173 puls pc,b,a | |
174 | |
175 * Write | |
176 * | |
177 * Entry: | |
178 * A = character to write | |
179 * Y = address of path descriptor | |
180 * U = address of device memory area | |
181 * | |
182 * Exit: | |
183 * CC = carry set on error | |
184 * B = error code | |
185 * | |
186 Write bsr L00B1 | |
187 bcs L00CD | |
188 ldb #$09 | |
189 pshs b,cc | |
190 orcc #IntMasks | |
191 tst <u001E,u | |
192 beq L00F9 | |
193 dec $01,s | |
194 L00F9 andcc #^Carry | |
195 L00FB ldb #$02 | |
196 bcs L0100 | |
197 clrb | |
198 L0100 bsr L00D0 | |
199 lsra | |
200 dec $01,s | |
201 bne L00FB | |
202 ldb <u001D,u | |
203 beq L0110 | |
204 andb #$FE | |
205 bsr L00D0 | |
206 L0110 ldb #$02 | |
207 bsr L00D0 | |
208 tst <u001F,u | |
209 beq L011D | |
210 ldb #$02 | |
211 bsr L00D0 | |
212 L011D puls pc,b,cc | |
213 | |
214 * GetStat | |
215 * | |
216 * Entry: | |
217 * A = function code | |
218 * Y = address of path descriptor | |
219 * U = address of device memory area | |
220 * | |
221 * Exit: | |
222 * CC = carry set on error | |
223 * B = error code | |
224 * | |
225 GetStat cmpa #SS.EOF | |
226 bne L0125 | |
227 L0123 clrb | |
228 rts | |
229 L0125 ldx PD.RGS,y | |
230 cmpa #SS.ScSiz | |
231 beq L0136 | |
232 cmpa #SS.ComSt | |
233 bne L0183 | |
234 ldd <u0022,u | |
235 std R$Y,x | |
236 bra L0123 | |
237 L0136 ldx PD.RGS,y | |
238 clra | |
239 ldb <u0024,u | |
240 std R$X,x | |
241 ldb <u0025,u | |
242 std R$Y,x | |
243 bra L0123 | |
244 | |
245 * SetStat | |
246 * | |
247 * Entry: | |
248 * A = function code | |
249 * Y = address of path descriptor | |
250 * U = address of device memory area | |
251 * | |
252 * Exit: | |
253 * CC = carry set on error | |
254 * B = error code | |
255 * | |
256 SetStat cmpa #SS.ComSt | |
257 bne L0183 | |
258 ldx PD.RGS,y | |
259 ldd R$Y,x | |
260 L014D std <u0022,u | |
261 clra | |
262 clrb | |
263 std <u001D,u | |
264 sta <u001F,u | |
265 ldd <u0022,u | |
266 tstb | |
267 bpl L0161 | |
268 inc <u001F,u | |
269 L0161 bitb #$40 | |
270 bne L017F | |
271 bitb #$20 | |
272 beq L016C | |
273 inc <u001E,u | |
274 L016C bita #$20 | |
275 beq L017E | |
276 bita #$80 | |
277 beq L017F | |
278 inc <u001D,u | |
279 bita #$40 | |
280 bne L017E | |
281 inc <u001D,u | |
282 L017E rts | |
283 L017F comb | |
284 ldb <E$BMode | |
285 rts | |
286 L0183 comb | |
287 ldb #E$UnkSvc | |
288 rts | |
289 | |
290 emod | |
291 eom equ * | |
292 end | |
293 |