0
|
1 ********************************************************************
|
|
2 * CC3IO - CoCo 3 I/O driver
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Ed. Comments Who YY/MM/DD
|
|
7 * ------------------------------------------------------------------
|
|
8 * 16 Original OS-9 L2 Tandy distribution
|
|
9 * 26c Added support for obtaining monitor type from BGP 98/10/12
|
|
10 * the init module
|
|
11 * 26d Added support for obtaining key repeat info BGP 98/10/23
|
|
12 * from the init module
|
350
|
13 * 26e Added support for obtaining mouse info BGP 02/07/24
|
|
14 * from the init module
|
0
|
15
|
|
16 nam CC3IO
|
|
17 ttl CoCo 3 I/O driver
|
|
18
|
|
19 * Disassembled 98/09/09 08:29:24 by Disasm v1.6 (C) 1988 by RML
|
|
20
|
|
21 ifp1
|
|
22 use defsfile
|
|
23 endc
|
|
24
|
|
25 tylg set Drivr+Objct
|
|
26 atrv set ReEnt+rev
|
350
|
27 rev set 5
|
0
|
28 edition set 26
|
|
29
|
|
30 mod eom,name,tylg,atrv,start,size
|
|
31
|
|
32 u0000 rmb 1
|
|
33 u0001 rmb 1
|
|
34 u0002 rmb 1
|
|
35 u0003 rmb 1
|
|
36 u0004 rmb 1
|
|
37 u0005 rmb 1
|
|
38 u0006 rmb 3
|
|
39 u0009 rmb 2
|
|
40 u000B rmb 1
|
|
41 u000C rmb 1
|
|
42 u000D rmb 1
|
|
43 u000E rmb 2
|
|
44 u0010 rmb 6
|
|
45 u0016 rmb 5
|
|
46 u001B rmb 2
|
|
47 u001D rmb 1
|
|
48 u001E rmb 1
|
|
49 u001F rmb 1
|
|
50 u0020 rmb 2
|
|
51 u0022 rmb 1
|
|
52 u0023 rmb 1
|
|
53 u0024 rmb 1
|
|
54 u0025 rmb 1
|
|
55 u0026 rmb 1
|
|
56 u0027 rmb 1
|
|
57 u0028 rmb 1
|
|
58 u0029 rmb 1
|
|
59 u002A rmb 1
|
|
60 u002B rmb 1
|
|
61 u002C rmb 1
|
|
62 u002D rmb 2
|
|
63 u002F rmb 1
|
|
64 u0030 rmb 1
|
|
65 u0031 rmb 2
|
|
66 u0033 rmb 1
|
|
67 u0034 rmb 1
|
|
68 u0035 rmb 6
|
|
69 u003B rmb 1
|
|
70 u003C rmb 8
|
|
71 u0044 rmb 4
|
|
72 u0048 rmb 2
|
|
73 u004A rmb 6
|
|
74 u0050 rmb 6
|
|
75 u0056 rmb 10
|
|
76 u0060 rmb 1
|
|
77 u0061 rmb 1
|
|
78 u0062 rmb 1
|
|
79 u0063 rmb 1
|
|
80 u0064 rmb 1
|
|
81 u0065 rmb 1
|
|
82 u0066 rmb 1
|
|
83 u0067 rmb 25
|
|
84 u0080 rmb 24
|
|
85 u0098 rmb 13
|
|
86 u00A5 rmb 13
|
|
87 u00B2 rmb 13
|
|
88 u00BF rmb 7
|
|
89 u00C6 rmb 26
|
|
90 KeyEnt rmb 2
|
|
91 KeyStat rmb 8
|
|
92 JoyEnt rmb 2
|
|
93 JoyStat rmb 8
|
|
94 SndEnt rmb 2
|
|
95 SndStat rmb 2
|
|
96 u00F8 rmb 8
|
|
97 size equ .
|
|
98 fcb $07
|
|
99
|
|
100 name fcs /CC3IO/
|
|
101 fcb edition
|
|
102
|
|
103 start lbra Init
|
|
104 lbra Read
|
|
105 lbra Write
|
|
106 lbra GetStat
|
|
107 lbra SetStat
|
|
108
|
|
109 Term ldx <D.CCMem
|
|
110 cmpu <G.CurDev,x
|
|
111 bne L0056
|
|
112 lbsr L0495
|
|
113 cmpu <G.CurDev,x
|
|
114 bne L0056
|
|
115 pshs u,x
|
|
116 ldx #$10EA
|
|
117 bsr TermSub
|
|
118 ldx #$10F4
|
|
119 bsr TermSub
|
|
120 ldx #$10E0
|
|
121 bsr TermSub
|
|
122 puls u,x
|
|
123 pshs cc
|
|
124 orcc #IRQMask
|
|
125 clra
|
|
126 clrb
|
|
127 std <G.CurDev,x
|
|
128 ldx <D.Clock
|
|
129 stx <D.AltIRQ
|
|
130 puls cc
|
|
131 L0056 ldb #$0C
|
|
132 lbra L0590
|
|
133
|
|
134 * Call terminate routine in subroutine module (KeyDrv/JoyDrv/SndDrv)
|
|
135 * X = addr in statics of entry
|
|
136 TermSub leau 2,x point U to static area for sub module
|
|
137 ldx ,x get entry pointer at ,X
|
|
138 jmp $03,x call term routine in sub module
|
|
139
|
|
140 Init ldx <D.CCMem
|
|
141 ldd <G.CurDev,x
|
|
142 lbne L00EF
|
|
143 leax >CC3Irq,pcr Set up AltIRQ vector in DP
|
|
144 stx <D.AltIRQ
|
|
145 leax >L0495,pcr
|
|
146 pshs x
|
|
147 leax >L054C,pcr
|
|
148 tfr x,d
|
|
149 ldx <D.CCMem
|
|
150 std >G.MsInit,x
|
|
151 puls b,a
|
|
152 std >G.WindBk,x
|
|
153 stu <G.CurDev,x
|
|
154 lbsr L054C
|
|
155
|
|
156 lda #$02
|
|
157 sta G.CurTik,x
|
|
158 inc <G.Mouse+Pt.Valid,x
|
|
159 ldd #$0178 right mouse/time out value
|
|
160 std <G.Mouse+Pt.Actv,x
|
|
161
|
|
162 ldd #$FFFF
|
|
163 std <G.LKeyCd,x
|
|
164 std <G.2Key2,x
|
|
165 ldd <D.Proc
|
|
166 pshs u,y,x,b,a
|
|
167
|
|
168 * Added to allow patching for RGB/CMP/Mono and Key info - BGP
|
|
169 * Uses new init module format to get monitor type and key info
|
|
170
|
|
171 ldy <D.Init get init module ptr
|
|
172 lda MonType,y get monitor type byte
|
|
173 sta <G.MonTyp,x save off
|
350
|
174 ldd MouseInf,y get mouse information
|
|
175 sta <G.Mouse+Pt.Res,x save off hi-res/lo-res flag
|
|
176 stb <G.Mouse+Pt.Actv,x save off left/right
|
0
|
177 ldd KeyRptS,y get key repeat start/delay constant
|
387
|
178 sta <G.KyRept,x set first delay
|
|
179 std <G.KyDly,x set initial and 2ndary constants
|
0
|
180
|
|
181 ldd <D.SysPrc
|
|
182 std <D.Proc
|
|
183 leax >KeyDrv,pcr
|
|
184 bsr LinkSys
|
|
185 sty >KeyEnt,u
|
|
186 leau >KeyStat,u
|
|
187 jsr ,y call init routine of sub module
|
|
188 leax >JoyDrv,pcr
|
|
189 bsr LinkSys
|
|
190 sty >JoyEnt,u
|
|
191 leau >JoyStat,u
|
|
192 jsr ,y call init routine of sub module
|
|
193 leax >SndDrv,pcr
|
|
194 bsr LinkSys
|
|
195 sty >SndEnt,u
|
|
196 leau >SndStat,u
|
|
197 jsr ,y call init routine of sub module
|
|
198 puls u,y,x,b,a
|
|
199 std <D.Proc
|
|
200 L00EF ldd #$0078
|
|
201 std <u0028,u
|
|
202 ldd <IT.PAR,y get parity/baud bytes from dev desc
|
|
203 std <u001F,u save it off in our static
|
|
204 lbra L08AA
|
|
205
|
|
206 KeyDrv fcs /KeyDrv/
|
|
207 JoyDrv fcs /JoyDrv/
|
|
208 SndDrv fcs /SndDrv/
|
|
209
|
|
210 LinkSys lda #Systm+Objct
|
|
211 os9 F$Link
|
|
212 ldu <D.CCMem
|
|
213 rts
|
|
214
|
|
215 Read lda <u0024,u
|
|
216 lbne L0667
|
|
217 leax >u0080,u
|
|
218 ldb <u0034,u
|
|
219 orcc #IRQMask
|
|
220 cmpb <u0033,u
|
|
221 beq L0138
|
|
222 abx
|
|
223 lda ,x
|
|
224 bsr L0159
|
|
225 stb <u0034,u
|
|
226 andcc #^(IRQMask!Carry)
|
|
227 rts
|
|
228 L0138 lda V.BUSY,u
|
|
229 sta V.WAKE,u
|
|
230 andcc #^IRQMask
|
|
231 ldx #$0000
|
|
232 os9 F$Sleep
|
|
233 clr V.WAKE,u
|
|
234 ldx <D.Proc
|
|
235 ldb <P$Signal,x
|
|
236 beq Read
|
|
237 lda P$State,x
|
|
238 bita #Condem
|
|
239 bne L0157
|
|
240 cmpb #S$Window
|
|
241 bcc Read
|
|
242 L0157 coma
|
|
243 rts
|
|
244
|
|
245 L0159 incb
|
|
246 cmpb #$7F
|
|
247 bls L015F
|
|
248 clrb
|
|
249 L015F rts
|
|
250
|
|
251 L0160 fdb $0801,$027f,$f8ff,$0000,$0801,$00bf,$f8ff,$0000
|
|
252
|
|
253 L0170 cmpd ,y
|
|
254 blt L017B
|
|
255 ldd ,y
|
|
256 bpl L017D
|
|
257 clra
|
|
258 clrb
|
|
259 L017B std ,y
|
|
260 L017D rts
|
|
261 L017E ldb #$01
|
|
262 pshs u,y,x,b,a
|
|
263 ldb <u0063,u
|
|
264 beq L01E6
|
|
265 lda <u0034,u
|
|
266 bita #$78
|
|
267 beq L01DF
|
|
268 clr $01,s
|
|
269 lda #$01
|
|
270 sta <u0067,u
|
|
271 lda #$08
|
|
272 ldb #$03
|
|
273 pshs b,a
|
|
274 leax >L0160,pcr
|
|
275 leay <u0056,u
|
|
276 L01A2 bita <u0034,u
|
|
277 beq L01C5
|
|
278 lslb
|
|
279 lslb
|
|
280 tst <u0030,u
|
|
281 beq L01B1
|
|
282 incb
|
|
283 bra L01BC
|
|
284 L01B1 tst <u0031,u
|
|
285 beq L01BC
|
|
286 addb #$02
|
|
287 ldd b,x
|
|
288 bra L01C1
|
|
289 L01BC ldb b,x
|
|
290 sex
|
|
291 addd ,y
|
|
292 L01C1 std ,y
|
|
293 ldd ,s
|
|
294 L01C5 lsla
|
|
295 decb
|
|
296 cmpb #$01
|
|
297 bne L01CD
|
|
298 leay -$02,y
|
|
299 L01CD std ,s
|
|
300 bpl L01A2
|
|
301 puls b,a
|
|
302 ldd #$027F
|
|
303 bsr L0170
|
|
304 leay $02,y
|
|
305 ldd #$00BF
|
|
306 bsr L0170
|
|
307 L01DF lda <u0065,u
|
|
308 bne L0223
|
|
309 lda ,s
|
|
310 L01E6 tst <u0064,u
|
|
311 beq L0225
|
|
312 clr <u0064,u
|
|
313 cmpa #$81
|
|
314 bne L01FF
|
|
315 ldb <u0035,u
|
|
316 bne L0223
|
|
317 ldx <u0020,u
|
|
318 com <$21,x
|
|
319 bra L0223
|
|
320 L01FF cmpa #$82
|
|
321 bne L0208
|
|
322 lbsr L0485
|
|
323 bra L0223
|
|
324 L0208 cmpa #$83
|
|
325 bne L0211
|
|
326 lbsr L0495
|
|
327 bra L0223
|
|
328 L0211 cmpa #$84
|
|
329 bne L0225
|
|
330 ldb <u0035,u
|
|
331 bne L0223
|
|
332 com <u0063,u
|
|
333 ldx <u0020,u
|
|
334 com <$2A,x
|
|
335 L0223 clr $01,s
|
|
336 L0225 ldb $01,s
|
|
337 puls pc,u,y,x,b,a
|
|
338 L0229 pshs x,b
|
|
339 leax <u003C,u
|
|
340 tst $02,x
|
|
341 lbeq L02C8
|
|
342 leas -$05,s
|
|
343 tfr a,b
|
|
344 tst <u0063,u
|
|
345 bne L024E
|
|
346 ldb #$05
|
|
347 lda $01,x
|
|
348 anda #$02
|
|
349 sta ,s
|
|
350 beq L0248
|
|
351 lslb
|
|
352 L0248 andb $05,s
|
|
353 tsta
|
|
354 beq L024E
|
|
355 lsrb
|
|
356 L024E clra
|
|
357 lsrb
|
|
358 rola
|
|
359 lsrb
|
|
360 std $01,s
|
|
361 bne L0276
|
|
362 lda $05,x
|
|
363 beq L02C6
|
|
364 bsr L02CA
|
|
365 beq L0262
|
|
366 bsr L02D3
|
|
367 beq L02AB
|
|
368 L0262 dec $05,x
|
|
369 bne L02AB
|
|
370 clra
|
|
371 clrb
|
|
372 sta >u00C6,u
|
|
373 std $06,x
|
|
374 std $0A,x
|
|
375 std $0C,x
|
|
376 std $0E,x
|
|
377 bra L02C6
|
|
378 L0276 lda $02,x
|
|
379 sta $05,x
|
|
380 bsr L02CA
|
|
381 beq L02AB
|
|
382 bsr L02D3
|
|
383 inc >$008A,x
|
|
384 ldd <$18,x
|
|
385 std <$12,x
|
|
386 ldd <$1A,x
|
|
387 std <$14,x
|
|
388 pshs u
|
|
389 ldu <u0020,u
|
|
390 lda <u0026,u
|
|
391 beq L02A9
|
|
392 ldb <u0027,u
|
|
393 os9 F$Send
|
|
394 bcs L02A5
|
|
395 clr <u0026,u
|
|
396 L02A5 clr >$008A,x
|
|
397 L02A9 puls u
|
|
398 L02AB ldd $0C,x
|
|
399 cmpa #$FF
|
|
400 beq L02B2
|
|
401 inca
|
|
402 L02B2 cmpb #$FF
|
|
403 beq L02B7
|
|
404 incb
|
|
405 L02B7 std $0C,x
|
|
406 ldd $06,x
|
|
407 cmpd #$FFFF
|
|
408 beq L02C4
|
|
409 addd #$0001
|
|
410 L02C4 std $06,x
|
|
411 L02C6 leas $05,s
|
|
412 L02C8 puls pc,x,b
|
|
413 L02CA ldd $08,x
|
|
414 eora $03,s
|
|
415 eorb $04,s
|
|
416 std $05,s
|
|
417 rts
|
|
418 L02D3 ldd $0C,x
|
|
419 tst $05,s
|
|
420 beq L02E9
|
|
421 sta $0E,x
|
|
422 lda $03,s
|
|
423 bne L02E8
|
|
424 lda $0A,x
|
|
425 cmpa #$FF
|
|
426 beq L02E6
|
|
427 inca
|
|
428 L02E6 sta $0A,x
|
|
429 L02E8 clra
|
|
430 L02E9 tst $06,s
|
|
431 beq L02FD
|
|
432 stb $0F,x
|
|
433 ldb $04,s
|
|
434 bne L02FC
|
|
435 ldb $0B,x
|
|
436 cmpb #$FF
|
|
437 beq L02FA
|
|
438 incb
|
|
439 L02FA stb $0B,x
|
|
440 L02FC clrb
|
|
441 L02FD std $0C,x
|
|
442 ldd $03,s
|
|
443 std $08,x
|
|
444 ldd $05,s
|
|
445 L0305 rts
|
|
446
|
|
447
|
|
448 CC3Irq ldu <D.CCMem
|
|
449 ldy <G.CurDev,u
|
|
450 lbeq L044E
|
|
451 lda <G.TnCnt,u get tone counter
|
|
452 beq L0319 branch if zero
|
|
453 deca else decrement
|
|
454 sta <G.TnCnt,u and save back
|
|
455 L0319 leax <L0305,pcr
|
|
456 stx <D.AltIRQ
|
|
457 andcc #^(IntMasks)
|
|
458 ldb <$23,y
|
|
459 beq L0337
|
|
460 lda $06,y
|
|
461 bpl L032F
|
|
462 lda G.GfBusy,u
|
|
463 ora G.WIBusy,u
|
|
464 bne L034F
|
|
465 L032F lda #$00
|
|
466 lbsr L05DA
|
|
467 clr <$23,y
|
|
468 L0337 ldb G.CntTik,u
|
|
469 beq L034F
|
|
470 decb
|
|
471 stb G.CntTik,u
|
|
472 bne L034F
|
|
473 lda G.GfBusy,u
|
|
474 ora G.WIBusy,u
|
|
475 beq L034A
|
|
476 inc G.CntTik,u
|
|
477 bra L034F
|
|
478 L034A lda #$02
|
|
479 lbsr L05DA
|
|
480 L034F lda <G.KyMse,u keyboard mouse?
|
|
481 bne L0369 branch if so
|
|
482 lda <G.MSmpRt,u
|
|
483 beq L0369
|
|
484 deca
|
|
485 bne L0366
|
|
486 pshs u,y,x
|
|
487 lbsr L0739
|
|
488 puls u,y,x
|
|
489 lda <G.MSmpRV,u
|
|
490 L0366 sta <G.MSmpRt,u
|
|
491 L0369 clra
|
|
492 clrb
|
|
493 std <G.KySns,u
|
|
494 tst <G.KyMse,u
|
|
495 beq L0381
|
|
496 ldx >$10E0
|
|
497 leau >$00E2,u
|
|
498 jsr $06,x
|
|
499 ldu <D.CCMem
|
|
500 sta <G.KyButt,u
|
|
501 L0381 ldx >$10EA
|
|
502 leau >$00EC,u
|
|
503 jsr $06,x
|
|
504 ldu <D.CCMem
|
|
505 lda #$82
|
|
506 cmpb #$80
|
|
507 beq L0397
|
|
508 inca
|
|
509 cmpb #$C0
|
|
510 bne L039C
|
|
511 L0397 inc <G.Clear,u
|
|
512 bra L03C8
|
|
513 L039C tst $08,y
|
|
514 bpl L03A8
|
|
515 bitb #$03
|
|
516 beq L03A8
|
|
517 lda #$0D
|
|
518 bra L03C8
|
|
519 L03A8 lda <G.KyButt,u
|
|
520 lbsr L0229
|
|
521 tstb
|
|
522 lbne L044E
|
|
523 pshs u,y,x
|
|
524 ldx >$10E0
|
|
525 leau >$00E2,u
|
|
526 jsr $09,x
|
|
527 puls u,y,x
|
|
528 bpl L03C8
|
|
529 clr <G.LastCh,u
|
|
530 lbra L044E
|
|
531 L03C8 cmpa <G.LastCh,u
|
|
532 bne L03DF
|
|
533 ldb <G.KyRept,u
|
|
534 beq L044E
|
|
535 decb
|
|
536 beq L03DA
|
|
537 L03D5 stb <G.KyRept,u
|
|
538 bra L044E
|
|
539 L03DA ldb <u0062,u
|
|
540 bra L03ED
|
|
541 L03DF sta <u0027,u
|
|
542 ldb <u0061,u
|
|
543 tst <u0035,u
|
|
544 bne L03D5
|
|
545 ldb <u0061,u
|
|
546 L03ED stb <u0029,u
|
|
547 lbsr L017E
|
|
548 beq L044E
|
|
549 ldb #$01
|
|
550 stb >u00BF,u
|
|
551 ldu <u0020,u
|
|
552 ldb <u0033,u
|
|
553 leax >u0080,u
|
|
554 abx
|
|
555 lbsr L0159
|
|
556 cmpb <u0034,u
|
|
557 beq L0411
|
|
558 stb <u0033,u
|
|
559 L0411 sta ,x
|
|
560 beq L0431
|
|
561 cmpa u000D,u
|
|
562 bne L0421
|
|
563 ldx u0009,u
|
|
564 beq L0443
|
|
565 sta $08,x
|
|
566 bra L0443
|
|
567 L0421 ldb #$03
|
|
568 cmpa u000B,u
|
|
569 beq L042D
|
|
570 ldb #$02
|
|
571 cmpa u000C,u
|
|
572 bne L0431
|
|
573 L042D lda u0003,u
|
|
574 bra L0447
|
|
575 L0431 lda <u0024,u
|
|
576 beq L0443
|
|
577 ldb <u0025,u
|
|
578 os9 F$Send
|
|
579 bcs L044E
|
|
580 clr <u0024,u
|
|
581 bra L044E
|
|
582 L0443 ldb #$01
|
|
583 lda u0005,u
|
|
584 L0447 beq L044E
|
|
585 clr u0005,u
|
|
586 os9 F$Send
|
|
587 L044E ldu <D.CCMem
|
|
588 lda <G.AutoMs,u
|
|
589 beq L046B
|
|
590 lda <G.MseMv,u
|
|
591 ora <G.Mouse+Pt.CBSA,u
|
|
592 beq L046B
|
|
593 lda G.GfBusy,u
|
|
594 ora G.WIBusy,u
|
|
595 bne L046B
|
|
596 lda #$03
|
|
597 lbsr L05DA
|
|
598 clr <G.MseMv,u
|
|
599 L046B orcc #IntMasks
|
|
600 leax >CC3Irq,pcr
|
|
601 stx <D.AltIRQ
|
|
602 rts
|
|
603
|
|
604 L0474 stb $06,s
|
|
605 ldx <u0024
|
|
606 lda $0D,x
|
|
607 ldb #$09
|
|
608 mul
|
|
609 ldy <u0080
|
|
610 leax d,y
|
|
611 stx $07,s
|
|
612 rts
|
|
613 L0485 pshs u,y,x,b,a
|
|
614 leas <-$11,s
|
|
615 ldb #$09
|
|
616 bsr L0474
|
|
617 stx $09,s
|
|
618 sty $07,s
|
|
619 bra L04A7
|
|
620 L0495 pshs u,y,x,b,a
|
|
621 leas <-$11,s
|
|
622 ldb #$F7
|
|
623 bsr L0474
|
|
624 leay -$09,y
|
|
625 sty $09,s
|
|
626 leax -$09,x
|
|
627 stx $07,s
|
|
628 L04A7 ldx <D.CCMem
|
|
629 ldu <$20,x
|
|
630 lbeq L0546
|
|
631 ldx u0001,u
|
|
632 stx $0B,s
|
|
633 stx $0F,s
|
|
634 ldd ,x
|
|
635 std $0D,s
|
|
636 L04BA ldx $0F,s
|
|
637 L04BC ldb $04,s
|
|
638 leax b,x
|
|
639 cmpx $09,s
|
|
640 bne L04C6
|
|
641 ldx $07,s
|
|
642 L04C6 stx $0F,s
|
|
643 ldd ,x
|
|
644 cmpd $0D,s
|
|
645 bne L04BC
|
|
646 ldu $02,x
|
|
647 beq L04BC
|
|
648 cmpx $0B,s
|
|
649 beq L0541
|
|
650 lda <u001E,u
|
|
651 beq L04BA
|
|
652 ldx <u0016,u
|
|
653 beq L0536
|
|
654 lda u0003,u
|
|
655 beq L0536
|
|
656 ldy <u0048
|
|
657 lda a,y
|
|
658 beq L0536
|
|
659 clrb
|
|
660 tfr d,y
|
|
661 lda >$00AC,y
|
|
662 leay <$30,y
|
|
663 sta ,s
|
|
664 pshs x
|
|
665 L04FA ldb #$10
|
|
666 lda ,x
|
|
667 L04FE decb
|
|
668 cmpa b,y
|
|
669 beq L050F
|
|
670 tstb
|
|
671 bne L04FE
|
|
672 ldx <$3D,x
|
|
673 bne L04FA
|
|
674 puls x
|
|
675 bra L0536
|
|
676 L050F puls x
|
|
677 lda ,s
|
|
678 L0513 sta ,s
|
|
679 cmpa #$02
|
|
680 bhi L051F
|
|
681 ldb #$02
|
|
682 lda b,y
|
|
683 bra L0522
|
|
684 L051F lda a,y
|
|
685 clrb
|
|
686 L0522 cmpa ,x
|
|
687 beq L0536
|
|
688 decb
|
|
689 bmi L052D
|
|
690 lda b,y
|
|
691 bra L0522
|
|
692 L052D lda ,s
|
|
693 ldx <$3D,x
|
|
694 bne L0513
|
|
695 bra L04BA
|
|
696 L0536 ldx <D.CCMem
|
|
697 stu <$20,x
|
|
698 clr $0A,x
|
|
699 clr >$00BF,x
|
|
700 L0541 inc <u0023,u
|
|
701 bsr L054C
|
|
702 L0546 leas <$11,s
|
|
703 clrb
|
|
704 puls pc,u,y,x,b,a
|
|
705 L054C pshs x
|
|
706 ldd <u0028,u
|
|
707 ldx <D.CCMem
|
|
708 sta <$3B,x
|
|
709 sta <$60,x
|
|
710 stb <$3E,x
|
|
711 ldd <u002A,u
|
|
712 sta <$63,x
|
|
713 stb <$66,x
|
|
714 lda u0006,u
|
|
715 sta $0B,x
|
|
716 clra
|
|
717 puls pc,x
|
|
718
|
|
719 Write ldb <u002C,u
|
|
720 lbne L0600
|
|
721 sta <u001F,u
|
|
722 cmpa #C$SPAC space or higher?
|
|
723 bcc L058E
|
|
724 cmpa #$1E $1E escape code?
|
|
725 bcc L05EF
|
|
726 cmpa #$1B $1B escape code?
|
|
727 beq L05F3
|
|
728 cmpa #$05 $05 escape code?
|
|
729 beq L05F3
|
|
730 cmpa #C$BELL Bell?
|
|
731 bne L058E
|
|
732 jmp [>WGlobal+G.BelVec]
|
|
733
|
|
734 L058E ldb #$03 1st entry point in co-module
|
|
735 L0590 lda <u001F,u
|
|
736 L0593 ldx <D.CCMem
|
|
737 stu G.CurDvM,x
|
|
738 L0597 pshs a
|
|
739 leax <G.CoTble,x
|
|
740 lda <u001D,u
|
|
741 ldx a,x
|
|
742 puls a
|
|
743 beq L05EB
|
|
744 leax b,x
|
|
745 bsr L05C0
|
|
746 ldb <u001D,u
|
|
747 beq L05B4
|
|
748 jsr ,x
|
|
749
|
|
750 L05B0 pshs cc
|
|
751 bra L05BB
|
|
752 L05B4 jsr ,x
|
|
753 L05B6 pshs cc
|
|
754 clr >WGlobal+G.WIBusy
|
|
755 L05BB clr >WGlobal+G.CrDvFl
|
|
756 puls pc,cc
|
|
757
|
|
758 L05C0 pshs x,b
|
|
759 ldx <D.CCMem
|
|
760 clr G.WIBusy,x
|
|
761 ldb <u001D,u
|
|
762 bne L05CE
|
|
763 incb
|
|
764 stb G.WIBusy,x
|
|
765 L05CE clr G.CrDvFl,x
|
|
766 cmpu <G.CurDev,x
|
|
767 bne L05D8
|
|
768 inc g000A,x
|
|
769 L05D8 puls pc,x,b
|
|
770
|
|
771 L05DA pshs u,y,x
|
|
772 ldu <u0020,u
|
|
773 L05DF ldb #$0F
|
|
774 ldx <D.CCMem
|
|
775 bsr L0597
|
|
776 puls pc,u,y,x
|
|
777 L05E7 pshs u,y,x
|
|
778 bra L05DF
|
|
779 L05EB comb
|
|
780 ldb #E$MNF
|
|
781 rts
|
|
782
|
|
783 L05EF cmpa #$1E
|
|
784 beq L05FE
|
|
785 L05F3 leax <L058E,pcr
|
|
786 ldb #$01
|
|
787 stx <u002D,u
|
|
788 stb <u002C,u
|
|
789 L05FE clrb
|
|
790 rts
|
|
791
|
|
792 L0600 ldx <u0031,u
|
|
793 sta ,x+
|
|
794 stx <u0031,u
|
|
795 decb
|
|
796 stb <u002C,u
|
|
797 bne L05FE
|
|
798 ldx <D.CCMem
|
|
799 bsr L05C0
|
|
800 stu G.CurDvM,x
|
|
801 ldx <u002F,u
|
|
802 stx <u0031,u
|
|
803 ldb <u001D,u
|
|
804 beq L0624
|
|
805 jsr [<u002D,u]
|
|
806 bra L05B0
|
|
807 L0624 jsr [<u002D,u]
|
|
808 bra L05B6
|
|
809
|
|
810 GetStat cmpa #SS.EOF
|
|
811 beq SSEOF
|
|
812 ldx PD.RGS,y
|
|
813 cmpa #SS.ComSt
|
|
814 beq GSComSt
|
|
815 cmpa #SS.Joy
|
|
816 beq GSJoy
|
|
817 cmpa #SS.Mouse
|
|
818 lbeq GSMouse
|
|
819 cmpa #SS.Ready
|
|
820 beq GSReady
|
|
821 cmpa #SS.KySns
|
|
822 beq GSKySns
|
|
823 cmpa #SS.Montr
|
|
824 beq GSMontr
|
|
825 ldb #$06 2nd entry point in co-module
|
|
826 lbra L0593
|
|
827
|
|
828 * SS.ComSt - get baud/parity info
|
|
829 GSComSt lda V.TYPE,u
|
|
830 clrb
|
|
831 std R$Y,x
|
|
832 rts
|
|
833
|
|
834 GSReady ldb <u0033,u
|
|
835 cmpb <u0034,u
|
|
836 beq L0667
|
|
837 bhi L0660
|
|
838 addb #$80
|
|
839 L0660 subb <u0034,u
|
|
840 stb $02,x
|
|
841 SSEOF clrb
|
|
842 rts
|
|
843 L0667 comb
|
|
844 ldb #E$NotRdy
|
|
845 rts
|
|
846
|
|
847 GSKySns ldy <D.CCMem
|
|
848 clrb
|
|
849 cmpu <G.CurDev,y
|
|
850 bne L0678
|
|
851 ldb <G.KySns,y
|
|
852 L0678 stb R$A,x
|
|
853 clrb
|
|
854 rts
|
|
855
|
|
856 * GetStat: SS.Montr (get Monitor type)
|
|
857 GSMontr ldb >WGlobal+G.MonTyp get monitor type
|
|
858 tfr b,a put in A
|
|
859 std $04,x save in caller's X
|
|
860 rts
|
|
861
|
|
862 * GetStat: SS.JOY (get joystick X/Y/button values)
|
|
863 GSJoy clrb
|
|
864 tfr x,y
|
|
865 ldx <D.CCMem
|
|
866 cmpu <$20,x is this win device same as current?
|
|
867 beq L0697 branch if so
|
|
868 clra else D = 0
|
|
869 std $04,y
|
|
870 std $06,y
|
|
871 sta $01,y
|
|
872 rts
|
|
873 L0697 ldx >$10EA
|
|
874 pshs u
|
|
875 ldu <D.CCMem
|
|
876 leau >$00EC,u
|
|
877 jsr $0C,x
|
|
878 puls u
|
|
879 lda $05,y
|
|
880 beq L06AB
|
|
881 lsrb
|
|
882 L06AB andb #$05
|
|
883 lsrb
|
|
884 bcc L06B2
|
|
885 orb #$01
|
|
886 L06B2 stb $01,y
|
|
887 pshs y
|
|
888 lda $05,y
|
|
889 inca
|
|
890 ldy #$0000
|
|
891 pshs u
|
|
892 ldu <D.CCMem
|
|
893 ldx >$10EA
|
|
894 leau >$00EC,u
|
|
895 jsr $0F,x
|
|
896 puls u
|
|
897 pshs y
|
|
898 ldy $02,s
|
|
899 stx $04,y
|
|
900 ldd #$003F
|
|
901 subd ,s++
|
|
902 std $06,y
|
|
903 clrb
|
|
904 puls pc,y
|
|
905
|
|
906 * GetStat: SS.Mouse (get mouse info)
|
|
907 GSMouse pshs u,y,x
|
|
908 ldx <D.CCMem
|
|
909 cmpu <$20,x is caller in current window?
|
|
910 beq L06FA branch i so
|
|
911 ldy ,s
|
|
912 ldb #$20 size of packet
|
|
913 L06EC clr ,-s
|
|
914 decb
|
|
915 bne L06EC
|
|
916 leax ,s
|
|
917 bsr L0729
|
|
918 leas <$20,s
|
|
919 puls pc,u,y,x
|
|
920 * here the caller is in the current window
|
|
921 L06FA tst <$63,x
|
|
922 bne L071A
|
|
923 lda <$60,x
|
|
924 bne L071A
|
|
925 pshs u,y,x
|
|
926 bsr L073B
|
|
927 puls u,y,x
|
|
928 lda <$66,x
|
|
929 anda <$67,x
|
|
930 beq L071A
|
|
931 lda #$03
|
|
932 lbsr L05E7
|
|
933 clr <$67,x
|
|
934 L071A lda #$01
|
|
935 lbsr L05E7
|
|
936 leax <$3C,x
|
|
937 ldy ,s
|
|
938 bsr L0729
|
|
939 puls pc,u,y,x
|
|
940 L0729 ldu $04,y
|
|
941 ldy <D.Proc
|
|
942 ldb P$Task,y
|
|
943 clra
|
|
944 ldy #32
|
|
945 os9 F$Move
|
|
946 rts
|
|
947 L0739 ldx <D.CCMem
|
|
948 L073B leax <$3C,x
|
|
949 clra
|
|
950 ldb <$17,x
|
|
951 tfr d,y
|
|
952 lda $01,x
|
|
953 pshs u,y,x,b,a
|
|
954 ldx >$10EA
|
|
955 ldu <D.CCMem
|
|
956 leau >$00EC,u
|
|
957 jsr $09,x
|
|
958 pshs y,x
|
|
959 ldx $06,s
|
|
960 puls b,a
|
|
961 leay <$18,x
|
|
962 bsr L0764
|
|
963 puls b,a
|
|
964 bsr L0764
|
|
965 puls pc,u,y,x,b,a
|
|
966 L0764 cmpd ,y++
|
|
967 beq L0770
|
|
968 std -$02,y
|
|
969 lda #$01
|
|
970 sta <$2B,x
|
|
971 L0770 rts
|
|
972
|
|
973 SSTone ldx >$10F4
|
|
974 jmp $06,x
|
|
975
|
|
976 SSAnPal ldx >$10F4
|
|
977 jmp $09,x
|
|
978
|
|
979 * Y = addr of path desc
|
|
980 SetStat ldx PD.RGS,y
|
|
981 cmpa #SS.ComSt
|
|
982 lbeq SSComSt
|
|
983 cmpa #SS.Montr
|
|
984 lbeq SSMontr
|
|
985 cmpa #SS.KySns
|
|
986 lbeq SSKySns
|
|
987 cmpa #SS.Tone
|
|
988 beq SSTone
|
|
989 cmpa #SS.AnPal
|
|
990 beq SSAnPal
|
|
991 cmpa #SS.SSig
|
|
992 beq SSSig
|
|
993 cmpa #SS.MsSig
|
|
994 beq SSMsSig
|
|
995 cmpa #SS.Relea
|
|
996 beq SSRelea
|
|
997 cmpa #SS.Mouse
|
|
998 beq SSMouse
|
|
999 cmpa #SS.GIP
|
|
1000 lbeq SSGIP
|
|
1001 cmpa #SS.Open
|
|
1002 bne L07B5
|
|
1003 SSOpen ldx PD.DEV,y
|
|
1004 stx u0001,u
|
|
1005 L07B5 ldb #$09 3rd entry point in co-module
|
|
1006 lbra L0593
|
|
1007
|
|
1008 * SS.SSig - send signal on data ready
|
|
1009 SSSig pshs cc
|
|
1010 clr <u0024,u
|
|
1011 lda <u0034,u
|
|
1012 suba <u0033,u
|
|
1013 pshs a
|
|
1014 bsr L07EC
|
|
1015 tst ,s+
|
|
1016 bne L07F7
|
|
1017 std <u0024,u
|
|
1018 puls pc,cc
|
|
1019
|
|
1020 * SS.MsSig - send signal on mouse button
|
|
1021 SSMsSig pshs cc
|
|
1022 clr <u0026,u
|
|
1023 bsr L07EC
|
|
1024 ldx <D.CCMem
|
|
1025 cmpu <G.CurDev,x
|
|
1026 bne L07E7
|
|
1027 tst >G.MsSig,x
|
|
1028 bne L07F3
|
|
1029 L07E7 std <u0026,u
|
|
1030 puls pc,cc
|
|
1031 L07EC orcc #IntMasks
|
|
1032 lda PD.CPR,y get curr proc #
|
|
1033 ldb R$X+1,x get user signal code
|
|
1034 rts
|
|
1035 L07F3 clr >G.MsSig,x
|
|
1036 L07F7 puls cc
|
|
1037 os9 F$Send
|
|
1038 rts
|
|
1039
|
|
1040 * SS.Relea - release a path from SS.SSig
|
|
1041 SSRelea lda PD.CPR,y get curr proc #
|
|
1042 cmpa <u0024,u same as keyboard?
|
|
1043 bne L0807 branch if not
|
|
1044 clr <u0024,u
|
|
1045 L0807 cmpa <u0026,u same as mouse?
|
|
1046 bne L0871
|
|
1047 clr <u0026,u
|
|
1048 rts
|
|
1049
|
|
1050 * SS.Mouse - set mouse sample rate and button timeout
|
|
1051 SSMouse ldd R$X,x
|
|
1052 cmpa #$FF
|
|
1053 beq L0819
|
|
1054 sta <u0028,u
|
|
1055 L0819 cmpb #$FF
|
|
1056 beq L0820
|
|
1057 stb <u0029,u
|
|
1058 L0820 ldb R$Y+1,x
|
|
1059 stb <u002B,u
|
|
1060 ldy <D.CCMem
|
|
1061 cmpu <G.CurDev,y
|
|
1062 bne L083D
|
|
1063 stb <G.AutoMs,y
|
|
1064 ldd <u0028,u
|
|
1065 sta <G.MSmpRV,y
|
|
1066 sta <G.MSmpRt,y
|
|
1067 stb <G.Mouse+Pt.ToTm,y
|
|
1068 L083D clrb
|
|
1069 rts
|
|
1070
|
|
1071 * SS.GIP
|
|
1072 SSGIP ldy <D.CCMem
|
|
1073 cmpu <G.CurDev,y current window?
|
|
1074 bne L0866 branch if not
|
|
1075 ldd R$Y,x get caller's Y (key repeat info)
|
|
1076 cmpd #$FFFF unchanged?
|
|
1077 beq L0853 yes, don't change current key info
|
|
1078 std <G.KyDly,y else save key delay and speed info
|
|
1079 L0853 ldd R$X,x get mouse info
|
|
1080 cmpa #$01 set for hi res adapter?
|
|
1081 bgt L088F branch to error if greater
|
|
1082 sta <G.Mouse+Pt.Res,y
|
|
1083 * B = mouse port (1 = right, 2 = left)
|
|
1084 tstb
|
|
1085 beq L088F
|
|
1086 cmpb #$02
|
|
1087 bgt L088F
|
|
1088 stb <G.Mouse+Pt.Actv,y
|
|
1089 L0866 clrb
|
|
1090 rts
|
|
1091
|
|
1092 * SS.KySns - setstat???
|
|
1093 SSKySns ldd R$X,x
|
|
1094 beq L086E
|
|
1095 ldb #$FF
|
|
1096 L086E stb <u0022,u
|
|
1097 L0871 clrb
|
|
1098 rts
|
|
1099
|
|
1100 * SS.Montr - change monitor type
|
|
1101 SSMontr ldd R$X,x
|
|
1102 cmpd #$0002
|
|
1103 bhi L088F
|
|
1104 lda <D.VIDMD
|
|
1105 anda #$EF
|
|
1106 bitb #$02
|
|
1107 beq L0885
|
|
1108 ora #$10
|
|
1109 L0885 sta <D.VIDMD
|
|
1110 stb >WGlobal+G.MonTyp
|
|
1111 inc <u0023,u
|
|
1112 clrb
|
|
1113 rts
|
|
1114 L088F comb
|
|
1115 ldb #E$IllArg
|
|
1116 rts
|
|
1117
|
|
1118 * SS.ComSt - set baud/parity params
|
|
1119 SSComSt ldd R$Y,x
|
|
1120 eora u0006,u
|
|
1121 anda #$80
|
|
1122 bne L088F
|
|
1123 lda R$Y,x
|
|
1124 bsr L08AA
|
|
1125 lbcc L07B5
|
|
1126 rts
|
|
1127
|
|
1128 VDGInt fcs /VDGInt/
|
|
1129
|
|
1130 L08AA sta u0006,u
|
|
1131 bmi L08C3 if hi-bit if A is set, we're a window
|
|
1132 pshs u,y,a ..else VDG
|
|
1133 lda #$02
|
|
1134 sta <u001D,u
|
|
1135 leax <VDGInt,pcr
|
|
1136 bsr L08D4
|
|
1137 puls pc,u,y,a
|
|
1138
|
|
1139 WindInt fcs /WindInt/
|
|
1140
|
|
1141 L08C3 pshs u,y
|
|
1142 clra
|
|
1143 sta <u001D,u
|
|
1144 leax <WindInt,pcr
|
|
1145 lda #$80
|
|
1146 bsr L08D4
|
|
1147 puls pc,u,y
|
|
1148 L08D2 clrb
|
|
1149 rts
|
|
1150 L08D4 ldb <u002F,u
|
|
1151 bne L08D2
|
|
1152 pshs u
|
|
1153 ldu <D.CCMem
|
|
1154 bita <G.BCFFlg,u
|
|
1155 puls u
|
|
1156 bne L0900
|
|
1157 tsta
|
|
1158 bpl L08E8
|
|
1159 clra
|
|
1160 L08E8 pshs y,a
|
|
1161 bsr L0905
|
|
1162 bcc L08F0
|
|
1163 puls pc,y,a
|
|
1164 L08F0 puls a
|
|
1165 ldx <D.CCMem
|
|
1166 leax <G.CoTble,x
|
|
1167 sty a,x
|
|
1168 puls y
|
|
1169 cmpa #$02
|
|
1170 bgt L08D2
|
|
1171 L0900 ldb #$00
|
|
1172 lbra L0590
|
|
1173 L0905 ldd <D.Proc
|
|
1174 pshs u,x,b,a
|
|
1175 ldd <D.SysPrc
|
|
1176 std <D.Proc
|
|
1177 lda #Systm+Objct
|
|
1178 os9 F$Link
|
|
1179 ldx $02,s
|
|
1180 bcc L091B
|
|
1181 ldu <D.SysPrc
|
|
1182 os9 F$Load
|
|
1183 L091B puls u,x,b,a
|
|
1184 std <D.Proc
|
|
1185 lbcs L05EB
|
|
1186 rts
|
|
1187
|
|
1188 emod
|
|
1189 eom equ *
|
|
1190 end
|
|
1191
|