Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/ccio.asm @ 1349:b9df6b3f2eef
Rolled Level 2 unlink into here.
author | boisy |
---|---|
date | Wed, 17 Sep 2003 20:10:46 +0000 |
parents | 63bfe1e5c5f4 |
children | e19a38f50c3a |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * CCIO - OS-9 Level One V2 CoCo I/O driver | |
3 * | |
4 * $Id$ | |
5 * | |
1340
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
6 * Edt/Rev YYYY/MM/DD Modified by |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
7 * Comment |
0 | 8 * ------------------------------------------------------------------ |
1340
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
9 * 12 ????/??/?? ??? |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
10 * From Tandy OS-9 Level One VR 02.00.00. |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
11 * |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
12 * 12r1 2003/09/11 Rodney V. Hamilton |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
13 * Modified key table to include $7F, $1D, $1E and $1F codes. |
0 | 14 |
15 nam CCIO | |
16 ttl OS-9 Level One V2 CoCo I/O driver | |
17 | |
18 ifp1 | |
19 use defsfile | |
20 use scfdefs | |
21 endc | |
22 | |
23 tylg set Drivr+Objct | |
24 atrv set ReEnt+rev | |
1340
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
25 rev set $01 |
201 | 26 edition set 12 |
0 | 27 |
28 mod eom,name,tylg,atrv,start,size | |
29 | |
257 | 30 rmb V.SCF |
0 | 31 u001D rmb 7 |
32 u0024 rmb 1 | |
33 u0025 rmb 1 | |
34 u0026 rmb 2 | |
35 u0028 rmb 1 | |
36 u0029 rmb 4 | |
307 | 37 ScreenX rmb 1 |
38 ScreenY rmb 1 | |
0 | 39 u002F rmb 1 |
40 u0030 rmb 1 | |
41 u0031 rmb 1 | |
42 u0032 rmb 1 | |
43 u0033 rmb 2 | |
44 u0035 rmb 2 | |
45 u0037 rmb 9 | |
46 u0040 rmb 2 | |
47 u0042 rmb 2 | |
48 u0044 rmb 1 | |
49 u0045 rmb 2 | |
50 u0047 rmb 1 | |
51 u0048 rmb 1 | |
52 u0049 rmb 2 | |
53 u004B rmb 5 | |
54 u0050 rmb 1 | |
55 u0051 rmb 1 | |
307 | 56 WrChar rmb 1 |
0 | 57 u0053 rmb 2 |
58 u0055 rmb 6 | |
59 u005B rmb 2 | |
60 u005D rmb 2 | |
61 u005F rmb 1 | |
62 u0060 rmb 1 | |
63 u0061 rmb 2 | |
64 u0063 rmb 2 | |
65 u0065 rmb 1 | |
66 u0066 rmb 1 | |
67 u0067 rmb 1 | |
68 u0068 rmb 1 | |
69 u0069 rmb 1 | |
70 u006A rmb 1 | |
71 u006B rmb 1 | |
72 u006C rmb 1 | |
73 u006D rmb 1 | |
74 u006E rmb 1 | |
75 u006F rmb 1 | |
76 u0070 rmb 1 | |
307 | 77 trulocas rmb 1 |
78 SubEntry rmb 6 | |
79 IBufHead rmb 1 | |
80 IBufTail rmb 1 | |
0 | 81 u007A rmb 128 |
82 size equ . | |
83 | |
256 | 84 fcb UPDAT.+EXEC. |
0 | 85 |
86 name fcs /CCIO/ | |
87 fcb edition | |
88 | |
89 start lbra Init | |
90 lbra Read | |
91 lbra Write | |
92 lbra GetStat | |
93 lbra SetStat | |
94 lbra Term | |
95 | |
96 * Init | |
97 * | |
98 * Entry: | |
99 * Y = address of device descriptor | |
100 * U = address of device memory area | |
101 * | |
102 * Exit: | |
103 * CC = carry set on error | |
104 * B = error code | |
105 * | |
106 Init stu >D.KbdSta store devmem ptr | |
107 clra | |
307 | 108 leax <u001D,u |
0 | 109 ldb #$5D |
307 | 110 L002E sta ,x+ clear mem |
0 | 111 decb |
112 bne L002E | |
113 coma A = $FF | |
114 comb B = $FF | |
115 stb <u0050,u | |
116 std <u005F,u | |
117 std <u0061,u | |
118 lda #$3C | |
119 sta <u0051,u | |
307 | 120 leax >AltIRQ,pcr get IRQ routine ptr |
121 stx >D.AltIRQ store in AltIRQ | |
0 | 122 leax >L03CC,pcr |
123 stx <u005B,u | |
124 leax >L050F,pcr | |
125 stx <u005D,u | |
307 | 126 ldd <IT.PAR,y get parity and baud |
127 lbra L05CE process them | |
0 | 128 |
129 * Term | |
130 * | |
131 * Entry: | |
132 * U = address of device memory area | |
133 * | |
134 * Exit: | |
135 * CC = carry set on error | |
136 * B = error code | |
137 * | |
138 Term pshs cc | |
307 | 139 orcc #IRQMask mask interrupts |
140 ldx >D.Clock get clock vector | |
141 stx >D.AltIRQ and put back in AltIRQ | |
0 | 142 puls pc,cc |
143 | |
144 * Read | |
145 * | |
146 * Entry: | |
147 * Y = address of path descriptor | |
148 * U = address of device memory area | |
149 * | |
150 * Exit: | |
151 * A = character read | |
152 * CC = carry set on error | |
153 * B = error code | |
154 * | |
155 Read leax <u007A,u | |
307 | 156 ldb <IBufTail,u get tail pointer |
157 orcc #IRQMask mask IRQ | |
158 cmpb <IBufHead,u same as head pointer | |
159 beq Put2Bed if so, buffer is empty, branch to sleep | |
160 abx X now points to curr char | |
161 lda ,x get char | |
0 | 162 bsr L009D |
307 | 163 stb <IBufTail,u |
164 andcc #^(IRQMask+Carry) unmask IRQ | |
0 | 165 rts |
307 | 166 |
167 Put2Bed lda V.BUSY,u get calling process ID | |
168 sta V.WAKE,u store in V.WAKE | |
169 andcc #^IRQMask clear interrupts | |
0 | 170 ldx #$0000 |
307 | 171 os9 F$Sleep sleep forever |
172 clr V.WAKE,u clear wake | |
173 ldx <D.Proc get pointer to current proc desc | |
174 ldb <P$Signal,x get signal recvd | |
175 beq Read branch if no signal | |
176 cmpb #S$Window window signal? | |
177 bcc Read branch if so | |
0 | 178 coma |
179 rts | |
180 L009D incb | |
181 cmpb #$7F | |
182 bls L00A3 | |
183 clrb | |
184 L00A3 rts | |
185 | |
307 | 186 * IRQ routine for keyboard |
187 AltIRQ ldu >D.KbdSta get keyboard static | |
0 | 188 ldb <u0032,u |
189 beq L00B7 | |
190 ldb <u002F,u | |
191 beq L00B7 | |
192 lda <u0030,u | |
193 lbsr L03CC | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
194 L00B7 ldx #PIA0Base |
0 | 195 clra |
196 clrb | |
307 | 197 std <u006A,u clear |
0 | 198 bsr L00E8 |
199 bne L00CC | |
200 clr $02,x | |
307 | 201 lda ,x get byte from PIA |
202 coma complement | |
203 anda #$7F strip off hi bit | |
204 bne L00F1 branch if any bit set | |
0 | 205 L00CC clra |
206 clrb | |
307 | 207 std <u006E,u clear |
208 coma A = $FF | |
0 | 209 tst <u006D,u |
210 bne L00DA | |
211 sta <u005F,u | |
212 L00DA stb <u006D,u | |
213 comb | |
214 sta <u0060,u | |
215 std <u0061,u | |
216 L00E4 jmp [>D.Clock] | |
217 L00E8 comb | |
218 stb $02,x | |
219 ldb ,x | |
220 comb | |
221 andb #$03 | |
222 rts | |
307 | 223 |
0 | 224 L00F1 bsr L015C |
225 bmi L00CC | |
226 clrb | |
227 bsr L00E8 | |
228 bne L00CC | |
229 cmpa <u006F,u | |
230 bne L010E | |
231 ldb <u0051,u | |
232 beq L010A | |
233 decb | |
234 L0105 stb <u0051,u | |
235 bra L00E4 | |
236 L010A ldb #$05 | |
237 bra L011A | |
238 L010E sta <u006F,u | |
239 ldb #$05 | |
240 tst <u006B,u | |
241 bne L0105 | |
242 ldb #$3C | |
243 L011A stb <u0051,u | |
307 | 244 ldb <IBufHead,u |
0 | 245 leax <u007A,u |
246 abx | |
247 lbsr L009D | |
307 | 248 cmpb <IBufTail,u |
0 | 249 beq L012F |
307 | 250 stb <IBufHead,u |
0 | 251 L012F sta ,x |
252 beq L014F | |
257 | 253 cmpa V.PCHR,u |
0 | 254 bne L013F |
257 | 255 ldx V.DEV2,u |
0 | 256 beq L014F |
257 sta $08,x | |
258 bra L014F | |
307 | 259 L013F ldb #S$Intrpt |
257 | 260 cmpa V.INTR,u |
0 | 261 beq L014B |
307 | 262 ldb #S$Abort |
257 | 263 cmpa V.QUIT,u |
0 | 264 bne L014F |
257 | 265 L014B lda V.LPRC,u |
0 | 266 bra L0153 |
267 L014F ldb #S$Wake | |
268 lda V.WAKE,u | |
269 L0153 beq L0158 | |
270 os9 F$Send | |
271 L0158 clr V.WAKE,u | |
272 bra L00E4 | |
273 L015C clra | |
274 clrb | |
275 std <u0066,u | |
276 std <u0068,u | |
277 coma | |
278 comb | |
279 std <u0063,u | |
280 sta <u0065,u | |
281 deca | |
282 sta $02,x | |
283 L016F lda ,x | |
284 coma | |
285 anda #$7F | |
286 beq L0183 | |
287 ldb #$FF | |
288 L0178 incb | |
289 lsra | |
290 bcc L017F | |
291 lbsr L0221 | |
292 L017F cmpb #$06 | |
293 bcs L0178 | |
294 L0183 inc <u0068,u | |
295 orcc #Carry | |
296 rol $02,x | |
297 bcs L016F | |
298 lbsr L0289 | |
299 bmi L020A | |
300 cmpa <u005F,u | |
301 bne L0199 | |
302 inc <u006B,u | |
303 L0199 sta <u005F,u | |
304 beq L01B9 | |
305 suba #$1A | |
306 bhi L01B9 | |
307 adda #$1A | |
308 ldb <u0067,u | |
309 bne L01E9 | |
310 adda #$40 | |
311 ldb <u0066,u | |
312 eorb <u0050,u | |
313 andb #$01 | |
314 bne L01E9 | |
315 adda #$20 | |
316 bra L01E9 | |
317 L01B9 ldb #$03 | |
318 mul | |
319 lda <u0066,u | |
320 beq L01C4 | |
321 incb | |
322 bra L01CB | |
323 L01C4 lda <u0067,u | |
324 beq L01CB | |
325 addb #$02 | |
326 L01CB lda <u006C,u | |
327 beq L01D4 | |
328 cmpb #$11 | |
329 ble L0208 | |
330 L01D4 cmpb #$4C | |
331 blt L01DD | |
332 inc <u0069,u | |
333 subb #$06 | |
334 L01DD pshs x | |
335 leax >L0321,pcr | |
336 lda b,x | |
337 puls x | |
338 bmi L01FD | |
339 L01E9 ldb <u0069,u | |
340 beq L01FA | |
341 cmpa #$3F | |
342 bls L01F8 | |
343 cmpa #$5B | |
344 bcc L01F8 | |
345 ora #$20 | |
346 L01F8 ora #$80 | |
347 L01FA andcc #^Negative | |
348 rts | |
307 | 349 |
0 | 350 L01FD inc <u006D,u |
351 ldb <u006B,u | |
352 bne L0208 | |
353 com <u0050,u | |
354 L0208 orcc #Negative | |
355 L020A rts | |
356 L020B pshs b,a | |
357 clrb | |
358 orcc #Carry | |
359 inca | |
360 L0211 rolb | |
361 deca | |
362 bne L0211 | |
363 bra L0219 | |
364 L0217 pshs b,a | |
365 L0219 orb <u006A,u | |
366 stb <u006A,u | |
367 puls pc,b,a | |
368 L0221 pshs b,a | |
369 cmpb #$03 | |
370 bne L0230 | |
371 lda <u0068,u | |
372 cmpa #$03 | |
373 blt L0230 | |
374 bsr L020B | |
375 L0230 lslb | |
376 lslb | |
377 lslb | |
378 addb <u0068,u | |
379 beq L025D | |
380 cmpb #$33 | |
381 bne L0243 | |
382 inc <u0069,u | |
383 ldb #$04 | |
384 bra L0219 | |
385 L0243 cmpb #$31 | |
386 beq L024B | |
387 cmpb #$34 | |
388 bne L0252 | |
389 L024B inc <u0067,u | |
390 ldb #$02 | |
391 bra L0219 | |
392 L0252 cmpb #$37 | |
393 bne L0262 | |
394 com <u0066,u | |
395 ldb #$01 | |
396 bra L0219 | |
397 L025D ldb #$04 | |
398 bsr L0217 | |
399 clrb | |
400 L0262 pshs x | |
401 leax <u0063,u | |
402 bsr L026D | |
403 puls x | |
404 puls pc,b,a | |
405 L026D pshs a | |
406 lda ,x | |
407 bpl L0279 | |
408 stb ,x | |
409 ldb #$01 | |
410 puls pc,a | |
411 L0279 lda $01,x | |
412 bpl L0283 | |
413 stb $01,x | |
414 ldb #$02 | |
415 puls pc,a | |
416 L0283 stb $02,x | |
417 ldb #$03 | |
418 puls pc,a | |
419 L0289 pshs y,x,b | |
420 bsr L02EE | |
421 ldb <u006E,u | |
422 beq L02C5 | |
423 leax <u0060,u | |
424 pshs b | |
425 L0297 leay <u0063,u | |
426 ldb #$03 | |
427 lda ,x | |
428 bmi L02B6 | |
429 L02A0 cmpa ,y | |
430 bne L02AA | |
431 clr ,y | |
432 com ,y | |
433 bra L02B6 | |
434 L02AA leay $01,y | |
435 decb | |
436 bne L02A0 | |
437 lda #$FF | |
438 sta ,x | |
439 dec <u006E,u | |
440 L02B6 leax $01,x | |
441 dec ,s | |
442 bne L0297 | |
443 leas $01,s | |
444 ldb <u006E,u | |
445 beq L02C5 | |
446 bsr L0309 | |
447 L02C5 leax <u0063,u | |
448 lda #$03 | |
449 L02CA ldb ,x+ | |
450 bpl L02DE | |
451 deca | |
452 bne L02CA | |
453 ldb <u006E,u | |
454 beq L02EA | |
455 decb | |
456 leax <u0060,u | |
457 lda b,x | |
458 bra L02E8 | |
459 L02DE tfr b,a | |
460 leax <u0060,u | |
461 bsr L026D | |
462 stb <u006E,u | |
463 L02E8 puls pc,y,x,b | |
464 L02EA orcc #Negative | |
465 puls pc,y,x,b | |
466 L02EE ldd <u0066,u | |
467 bne L0301 | |
468 lda #$03 | |
469 leax <u0063,u | |
470 L02F8 ldb ,x | |
471 beq L0302 | |
472 leax $01,x | |
473 deca | |
474 bne L02F8 | |
475 L0301 rts | |
476 L0302 comb | |
477 stb ,x | |
478 inc <u0069,u | |
479 rts | |
480 L0309 leax <u0060,u | |
481 bsr L0314 | |
482 leax $01,x | |
483 bsr L0314 | |
484 leax -$01,x | |
485 L0314 lda ,x | |
486 bpl L0320 | |
487 ldb $01,x | |
488 bmi L0320 | |
489 sta $01,x | |
490 stb ,x | |
491 L0320 rts | |
492 | |
1340
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
493 L0321 fcb $00,$40,$60 ALT @ ` |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
494 fcb $0c,$1c,$13 UP |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
495 fcb $0a,$1a,$12 DOWN |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
496 fcb $08,$18,$10 LEFT |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
497 fcb $09,$19,$11 RIGHT |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
498 fcb $20,$20,$20 SPACEBAR |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
499 fcb $30,$30,$81 0 0 capslock |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
500 fcb $31,$21,$7c 1 ! | |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
501 fcb $32,$22,$00 2 " null |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
502 fcb $33,$23,$7e 3 # ~ |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
503 fcb $34,$24,$1d 4 $ RS (was null) |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
504 fcb $35,$25,$1e 5 % GS (was null) |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
505 fcb $36,$26,$1f 6 & US (was null) |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
506 fcb $37,$27,$5e 7 ' ^ |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
507 fcb $38,$28,$5b 8 ( [ |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
508 fcb $39,$29,$5d 9 ) ] |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
509 fcb $3a,$2a,$00 : * null |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
510 fcb $3b,$2b,$7f ; + del (was null) |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
511 fcb $2c,$3c,$7b , < { |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
512 fcb $2d,$3d,$5f - = _ |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
513 fcb $2e,$3e,$7d . > } |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
514 fcb $2f,$3f,$5c / ? \ |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
515 fcb $0d,$0d,$0d ENTER key |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
516 fcb $00,$00,$00 CLEAR key |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
517 fcb $05,$03,$1b BREAK key |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
518 fcb $31,$33,$35 F1 key |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
519 fcb $32,$34,$36 F2 key |
0 | 520 |
521 * Write | |
522 * | |
523 * Entry: | |
524 * A = character to write | |
525 * Y = address of path descriptor | |
526 * U = address of device memory area | |
527 * | |
528 * Exit: | |
529 * CC = carry set on error | |
530 * B = error code | |
531 * | |
532 Write ldb <u0025,u | |
533 bne L03A3 | |
307 | 534 sta <WrChar,u |
535 cmpa #C$SPAC | |
0 | 536 bcc L038E |
307 | 537 cmpa #$1E escape sequence |
0 | 538 bcc L03B8 |
539 cmpa #$0F | |
540 lbcc L063B | |
307 | 541 cmpa #C$BELL |
542 lbeq Ding ring bell | |
0 | 543 L038E lda <u0053,u |
307 | 544 L0391 ldb #$03 offset into subroutine |
545 L0393 leax <SubEntry,u get subroutine entry pointer in X | |
0 | 546 ldx a,x |
307 | 547 beq NoIOMod branch if no module |
548 lda <WrChar,u get character to write | |
549 L039D jmp b,x call i/o subroutine | |
550 NoIOMod comb | |
551 ldb #E$MNF | |
0 | 552 rts |
307 | 553 |
0 | 554 L03A3 cmpb #$02 |
555 beq L03B0 | |
556 sta <u0029,u | |
557 clr <u0025,u | |
558 jmp [<u0026,u] | |
559 L03B0 sta <u0028,u | |
560 dec <u0025,u | |
561 clrb | |
562 rts | |
563 L03B8 beq L03C5 | |
564 leax <L03C7,pcr | |
565 L03BD ldb #$01 | |
566 L03BF stx <u0026,u | |
567 stb <u0025,u | |
568 L03C5 clrb | |
569 rts | |
570 L03C7 ldb #$03 | |
571 lbra L055F | |
572 L03CC pshs x,a | |
573 stb <u002F,u | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
574 lda >PIA1Base+2 |
0 | 575 anda #$07 |
576 ora ,s+ | |
577 tstb | |
578 bne L03DE | |
307 | 579 ora <trulocas,u |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
580 L03DE sta >PIA1Base+2 |
0 | 581 sta <u0030,u |
582 tstb | |
583 bne L03F5 | |
584 stb >$FFC0 | |
585 stb >$FFC2 | |
586 stb >$FFC4 | |
587 lda <u001D,u | |
588 bra L0401 | |
589 L03F5 stb >$FFC0 | |
590 stb >$FFC3 | |
591 stb >$FFC5 | |
592 lda <u0033,u | |
593 L0401 ldb #$07 | |
594 ldx #$FFC6 | |
595 lsra | |
596 L0407 lsra | |
597 bcs L0410 | |
598 sta ,x+ | |
599 leax $01,x | |
600 bra L0414 | |
601 L0410 leax $01,x | |
602 sta ,x+ | |
603 L0414 decb | |
604 bne L0407 | |
605 clrb | |
606 puls pc,x | |
164 | 607 |
608 GRFO fcs /GRFO/ | |
609 CO32 fcs /CO32/ | |
610 CO80 fcs /CO80/ | |
0 | 611 |
612 * GetStat | |
613 * | |
614 * Entry: | |
615 * A = function code | |
616 * Y = address of path descriptor | |
617 * U = address of device memory area | |
618 * | |
619 * Exit: | |
620 * CC = carry set on error | |
621 * B = error code | |
622 * | |
307 | 623 GetStat sta <WrChar,u |
164 | 624 cmpa #SS.Ready |
0 | 625 bne L0439 |
307 | 626 lda <IBufTail,u get buff tail ptr |
627 suba <IBufHead,u Num of chars ready in A | |
628 lbeq L0660 branch if empty | |
629 SSEOF clrb | |
0 | 630 rts |
164 | 631 L0439 cmpa #SS.EOF |
632 beq SSEOF | |
633 ldx PD.RGS,y | |
634 cmpa #SS.Joy | |
635 beq SSJOY | |
636 cmpa #SS.ScSiz | |
637 beq SSSCSIZ | |
638 cmpa #SS.KySns | |
639 beq SSKYSNS | |
640 cmpa #SS.DStat | |
641 lbeq SSDSTAT | |
0 | 642 ldb #$06 |
643 lbra L055F | |
164 | 644 |
307 | 645 SSKYSNS ldb <u006A,u get key sense info |
646 stb R$A,x put in caller's A | |
0 | 647 clrb |
648 rts | |
164 | 649 |
650 SSSCSIZ clra | |
307 | 651 ldb <ScreenX,u |
652 std R$X,x | |
653 ldb <ScreenY,u | |
654 std R$Y,x | |
0 | 655 clrb |
656 rts | |
164 | 657 |
307 | 658 * Get joytsick values |
164 | 659 SSJOY pshs y,cc |
307 | 660 orcc #IRQMask mask interrupts |
0 | 661 lda #$FF |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
662 sta >PIA0Base+2 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
663 ldb >PIA0Base |
307 | 664 ldy R$X,x get joystick number to poll |
0 | 665 bne L0481 |
666 andb #$01 | |
667 bne L0485 | |
668 bra L0486 | |
669 L0481 andb #$02 | |
670 beq L0486 | |
671 L0485 clra | |
307 | 672 L0486 sta R$A,x |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
673 lda >PIA0Base+3 |
0 | 674 ora #$08 |
307 | 675 ldy R$X,x |
0 | 676 bne L0494 |
677 anda #$F7 | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
678 L0494 sta >PIA0Base+3 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
679 lda >PIA0Base+1 |
0 | 680 anda #$F7 |
681 bsr L04B3 | |
307 | 682 std R$X,x |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
683 lda >PIA0Base+1 |
0 | 684 ora #$08 |
685 bsr L04B3 | |
686 pshs b,a | |
687 ldd #$003F | |
688 subd ,s++ | |
307 | 689 std R$Y,x |
0 | 690 clrb |
691 puls pc,y,cc | |
307 | 692 |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
693 L04B3 sta >PIA0Base+1 |
0 | 694 lda #$7F |
695 ldb #$40 | |
696 bra L04C7 | |
697 L04BC lsrb | |
698 cmpb #$01 | |
699 bhi L04C7 | |
700 lsra | |
701 lsra | |
702 tfr a,b | |
703 clra | |
704 rts | |
705 L04C7 pshs b | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
706 sta >PIA1Base |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
707 tst >PIA0Base |
0 | 708 bpl L04D5 |
709 adda ,s+ | |
710 bra L04BC | |
711 L04D5 suba ,s+ | |
712 bra L04BC | |
164 | 713 |
714 SSDSTAT lbsr L065B | |
0 | 715 bcs L050E |
716 ldd <u0045,u | |
717 bsr L050F | |
718 tfr a,b | |
719 andb ,x | |
720 L04E7 bita #$01 | |
721 bne L04F6 | |
722 lsra | |
723 lsrb | |
724 tst <u0024,u | |
725 bmi L04E7 | |
726 lsra | |
727 lsrb | |
728 bra L04E7 | |
729 L04F6 pshs b | |
730 ldb <u004B,u | |
731 andb #$FC | |
732 orb ,s+ | |
733 ldx $06,y | |
734 stb $01,x | |
735 ldd <u0045,u | |
736 std $06,x | |
737 ldd <u0033,u | |
738 std $04,x | |
739 clrb | |
740 L050E rts | |
741 L050F pshs y,b,a | |
742 ldb <u0024,u | |
743 bpl L0517 | |
744 lsra | |
745 L0517 lsra | |
746 lsra | |
747 pshs a | |
748 ldb #$BF | |
749 subb $02,s | |
750 lda #$20 | |
751 mul | |
752 addb ,s+ | |
753 adca #$00 | |
754 ldy <u0033,u | |
755 leay d,y | |
756 lda ,s | |
757 sty ,s | |
758 anda <u0044,u | |
759 ldx <u0042,u | |
760 lda a,x | |
761 puls pc,y,x | |
762 | |
763 * SetStat | |
764 * | |
765 * Entry: | |
766 * A = function code | |
767 * Y = address of path descriptor | |
768 * U = address of device memory area | |
769 * | |
770 * Exit: | |
771 * CC = carry set on error | |
772 * B = error code | |
773 * | |
307 | 774 SetStat sta <WrChar,u |
164 | 775 ldx PD.RGS,y |
776 cmpa #SS.ComSt | |
777 lbeq SSCOMST | |
778 cmpa #SS.AAGBf | |
779 beq SSAAGBF | |
780 cmpa #SS.SLGBf | |
781 beq SSSLGBF | |
782 cmpa #SS.KySns | |
0 | 783 bne L055D |
164 | 784 ldd R$X,x |
0 | 785 beq L0558 |
786 ldb #$FF | |
787 L0558 stb <u006C,u | |
788 L055B clrb | |
789 L055C rts | |
790 L055D ldb #$09 | |
791 L055F pshs b | |
792 lda <u0053,u | |
793 lbsr L0393 | |
794 puls a | |
795 bcc L055B | |
307 | 796 tst <SubEntry,u |
0 | 797 beq L055C |
798 tfr a,b | |
799 clra | |
800 lbra L0393 | |
164 | 801 |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
802 * Reserve an additional graphics buffer (up to 2) |
164 | 803 SSAAGBF ldb <u0031,u |
0 | 804 lbeq L0660 |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
805 pshs b get buffer number |
0 | 806 leay <u0037,u |
807 ldd ,y | |
808 beq L058E | |
809 leay $02,y | |
810 inc ,s | |
811 ldd ,y | |
812 bne L059E | |
813 L058E lbsr L0685 | |
814 bcs L05A1 | |
815 std ,y | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
816 std R$X,x |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
817 puls b get buffer number off stack |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
818 clra clear hi byte of D |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
819 std R$Y,x and put in caller's Y |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
820 clrb call is ok |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
821 rts and return |
0 | 822 L059E ldb #E$BMode |
823 coma | |
824 L05A1 puls pc,a | |
164 | 825 |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
826 * Select a graphics buffer |
164 | 827 SSSLGBF ldb <u0031,u |
0 | 828 lbeq L0660 |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
829 ldd R$Y,x get buffer number from caller |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
830 cmpd #$0002 compare against high |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
831 bhi BadMode branch if error |
0 | 832 leay <u0035,u |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
833 lslb multiply by 2 |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
834 ldd b,y get pointer |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
835 beq BadMode branch if error |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
836 std <u0033,u else save in current |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
837 ldd R$X,x get select flag |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
838 beq L05C3 if zero, do nothing |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
839 ldb #$01 else set display flag |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
840 L05C3 stb <u0032,u save display flag |
0 | 841 clrb |
842 rts | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
843 BadMode comb |
0 | 844 ldb #E$BMode |
845 rts | |
846 | |
307 | 847 SSCOMST ldd R$Y,x Get caller's Y |
848 L05CE bita #$02 CO80? | |
849 bne GoCO80 branch if so | |
850 ldb #$10 assume true lower case TRUE | |
851 bita #$01 true lowercase bit set? | |
852 bne GoCO32 branch if so | |
853 clrb true lower case FALSE | |
854 GoCO32 stb <trulocas,u save flag for later | |
0 | 855 lda #$02 |
307 | 856 ldx #$2010 32x16 |
0 | 857 pshs u,y,x,a |
164 | 858 leax >CO32,pcr |
0 | 859 bra L05F4 |
307 | 860 GoCO80 lda #$04 |
861 ldx #$5018 80x24 | |
0 | 862 pshs u,y,x,a |
164 | 863 leax >CO80,pcr |
0 | 864 L05F4 bsr L0601 |
865 puls u,y,x,a | |
866 bcs L0600 | |
307 | 867 stx <ScreenX,u save screen size |
0 | 868 sta <u0053,u |
869 L0600 rts | |
870 L0601 bita <u0070,u | |
871 beq L0608 | |
872 L0606 clrb | |
873 rts | |
874 L0608 pshs y,x,a | |
307 | 875 lbsr LinkSub |
876 bcc L061F branch if link was successful | |
877 ldx $01,s get pointer to name on stack | |
0 | 878 pshs u |
307 | 879 os9 F$Load try to load subroutine I/O module |
0 | 880 puls u |
881 bcc L061F | |
882 puls y,x,a | |
307 | 883 lbra NoIOMod |
884 L061F leax <SubEntry,u | |
885 lda ,s get A off stack | |
0 | 886 sty a,x |
887 puls y,x,a | |
888 ldb #$00 | |
889 lbra L0393 | |
307 | 890 |
891 * Link to subroutine | |
892 LinkSub pshs u | |
0 | 893 lda #Systm+Objct |
894 os9 F$Link | |
895 puls pc,u | |
896 | |
897 L0637 fdb $0055,$aaff | |
898 | |
899 L063B cmpa #$15 | |
900 bcc L0664 | |
901 cmpa #$0F | |
902 beq L06B4 | |
903 suba #$10 | |
904 bsr L065B | |
905 bcs L0663 | |
906 leax <L0651,pcr | |
907 lsla | |
908 ldd a,x | |
909 jmp d,x | |
910 | |
911 L0651 fdb $0140,$00fd,$0111,$0160,$016f | |
912 | |
913 L065B ldb <u0031,u | |
914 bne L0606 | |
915 L0660 comb | |
916 ldb #E$NotRdy | |
917 L0663 rts | |
918 L0664 bsr L065B | |
919 bcs L0663 | |
307 | 920 ldx <SubEntry,u |
0 | 921 bne L0681 |
922 pshs y,a | |
923 bne L067F | |
164 | 924 leax >GRFO,pcr |
307 | 925 bsr LinkSub |
0 | 926 bcc L067B |
927 puls pc,y,a | |
307 | 928 L067B sty <SubEntry,u |
0 | 929 L067F puls y,a |
930 L0681 clra | |
931 lbra L0391 | |
932 L0685 pshs u | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
933 ldd #6144+256 |
0 | 934 os9 F$SRqMem |
935 bcc L0691 | |
936 puls pc,u | |
937 L0691 tfr u,d | |
938 puls u | |
939 tfr a,b | |
940 bita #$01 | |
941 beq L069F | |
942 adda #$01 | |
943 bra L06A1 | |
944 L069F addb #$18 | |
945 L06A1 pshs u,a | |
946 tfr b,a | |
947 clrb | |
948 tfr d,u | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
949 ldd #256 |
0 | 950 os9 F$SRtMem |
951 puls u,a | |
952 bcs L06B3 | |
953 clrb | |
954 L06B3 rts | |
955 L06B4 leax <L06BC,pcr | |
956 ldb #$02 | |
957 lbra L03BF | |
307 | 958 |
0 | 959 L06BC ldb <u0031,u |
960 bne L06D1 | |
961 bsr L0685 | |
962 bcs L06EF | |
963 std <u0033,u | |
964 std <u0035,u | |
965 inc <u0031,u | |
966 lbsr L07B1 | |
967 L06D1 lda <u0029,u | |
968 sta <u004B,u | |
969 anda #$03 | |
970 leax >L0637,pcr | |
971 lda a,x | |
972 sta <u0047,u | |
973 sta <u0048,u | |
974 lda <u0028,u | |
975 cmpa #$01 | |
976 bls L06F0 | |
977 comb | |
978 ldb #E$BMode | |
979 L06EF rts | |
980 L06F0 tsta | |
981 beq L0710 | |
982 ldd #$C003 | |
983 std <u0049,u | |
984 lda #$01 | |
985 sta <u0024,u | |
986 lda #$E0 | |
987 ldb <u0029,u | |
988 andb #$08 | |
989 beq L0709 | |
990 lda #$F0 | |
991 L0709 ldb #$03 | |
992 leax <L0742,pcr | |
993 bra L072D | |
994 L0710 ldd #$8001 | |
995 std <u0049,u | |
996 lda #$FF | |
997 tst <u0047,u | |
998 beq L0723 | |
999 sta <u0047,u | |
1000 sta <u0048,u | |
1001 L0723 sta <u0024,u | |
1002 lda #$F0 | |
1003 ldb #$07 | |
1004 leax <L0746,pcr | |
1005 L072D stb <u0044,u | |
1006 stx <u0042,u | |
1007 ldb <u0029,u | |
1008 andb #$04 | |
1009 lslb | |
1010 pshs b | |
1011 ora ,s+ | |
1012 ldb #$01 | |
1013 lbra L03CC | |
1014 | |
1015 L0742 fcb $c0,$30,$0c,$03 | |
1016 L0746 fcb $80,$40,$20,$10,$08,$04,$02,$01 | |
1017 fcb $30,$8C,$03,$16,$fC,$69,$6f,$C8,$28 | |
1018 fcb $A6,$C8,$24,$2B,$03,$6C,$C8,$28,$16 | |
1019 fcb $FF,$6F,$30,$C8,$35,$10,$8E,$00,$00 | |
1020 fcb $C6,$03,$34,$44 | |
1021 | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
1022 L076D ldd #6144 size of graphics screen |
0 | 1023 ldu ,x++ |
1024 beq L077A | |
1025 sty -$02,x | |
1026 os9 F$SRtMem | |
1027 L077A dec ,s | |
1028 bgt L076D | |
1029 ldu ,x | |
1030 beq L0788 | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
1031 ldd #512 |
0 | 1032 os9 F$SRtMem |
1033 L0788 puls u,b | |
1034 clra | |
1035 sta <u0031,u | |
1036 lbra L03CC | |
1037 leax <L0797,pcr | |
1038 lbra L03BD | |
1039 L0797 lda <u0029,u | |
1040 tst <u0024,u | |
1041 bpl L07A7 | |
1042 ldb #$FF | |
1043 anda #$01 | |
1044 beq L07B1 | |
1045 bra L07B2 | |
1046 L07A7 anda #$03 | |
1047 leax >L0637,pcr | |
1048 ldb a,x | |
1049 bra L07B2 | |
1050 L07B1 clrb | |
1051 L07B2 ldx <u0033,u | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
1052 leax >6144+1,x |
0 | 1053 L07B9 stb ,-x |
1054 cmpx <u0033,u | |
1055 bhi L07B9 | |
1056 clra | |
1057 clrb | |
1058 std <u0045,u | |
1059 rts | |
307 | 1060 |
1061 * Ding - tickle CoCo's PIA to emit a sound | |
1062 Ding pshs b,a | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1063 lda >PIA0Base+1 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1064 ldb >PIA0Base+3 |
0 | 1065 pshs b,a |
1066 anda #$F7 | |
1067 andb #$F7 | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1068 sta >PIA0Base+1 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1069 stb >PIA0Base+3 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1070 lda >PIA1Base+3 |
0 | 1071 pshs a |
1072 ora #$08 | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1073 sta >PIA1Base+3 |
0 | 1074 ldb #$0A |
1075 L07E6 lda #$FE | |
1076 bsr L0800 | |
1077 lda #$02 | |
1078 bsr L0800 | |
1079 decb | |
1080 bne L07E6 | |
1081 puls a | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1082 sta >PIA1Base+3 |
0 | 1083 puls b,a |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1084 sta >PIA0Base+1 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1085 stb >PIA0Base+3 |
0 | 1086 puls pc,b,a |
307 | 1087 |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1088 L0800 sta >PIA1Base |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
1089 * some type of settle delay |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
1090 lda #128 |
0 | 1091 L0805 inca |
1092 bne L0805 | |
1093 rts | |
1094 | |
1095 emod | |
1096 eom equ * | |
1097 end |