Mercurial > hg > Members > kono > nitros9-code
annotate level2/modules/vtio.asm @ 3226:9749d0dfc4a2
Changed a puls PC to rts to save cycles
author | David Ladd <drencor-xeen@users.sourceforge.net> |
---|---|
date | Sat, 20 Jan 2018 19:32:22 -0600 |
parents | b8c7b7fbf3c9 |
children |
rev | line source |
---|---|
1933 | 1 ******************************************************************** |
2 * VTIO - Video Terminal I/O Driver for CoCo 3 | |
3 * | |
4 * $Id$ | |
5 * | |
6 * NOTE: CODE ISSUES FOUND!! | |
7 * "Animate Palette? This obviously isn't implemented yet" | |
8 * Look at this code. Why is this calling an entry point in | |
9 * SNDDRV??? | |
10 * | |
11 * Edt/Rev YYYY/MM/DD Modified by | |
12 * Comment | |
13 * ------------------------------------------------------------------ | |
14 * 16 1986/??/?? | |
15 * Original OS-9 L2 Tandy distribution. | |
16 * | |
17 * 26r3 1998/10/12 | |
18 * Added support for obtaining monitor type from the init module. | |
19 * | |
20 * 26r4 1998/10/23 | |
21 * Added support for obtaining key repeat info from the init module. | |
22 * | |
23 * 26r5 2002/07/24 | |
24 * Added support for obtaining mouse info from the init module. | |
25 * | |
26 * 27 2003/08/18 Boisy G. Pitre | |
27 * Forward ported to NitrOS-9. | |
28 * | |
29 * 2003/11/16 Robert Gault | |
30 * Corrected several lines for keyboard mouse. | |
31 * Corrected several lines in SSMOUSE where MS.Side used incorrectly. | |
32 * | |
33 * 2003/12/02 Boisy G. Pitre | |
34 * Keyboard mouse is now either global or local to window, depending | |
35 * on whether GLOBALKEYMOUSE is defined. | |
36 * | |
37 * 2004/08/14 Boisy G. Pitre | |
38 * Fixed a bug where the last deiniz of the last window device caused | |
39 * an infinite loop. The problem was that IOMan clears the static | |
40 * storage of a device whose use count has reached zero (in the | |
41 * case of a hard detach). See Note below. | |
2144 | 42 * |
43 * Renamed to VTIO and reset edition to 1. | |
2013
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
44 * |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
45 * 1 2006/03/04 Boisy G. Pitre |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
46 * Added detection of CTRL-ALT-BREAK to invoke system debugger. |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
47 * Renamed to VTIO and reset edition to 1. |
2115
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
48 * |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
49 * 2 2007/08/22 Boisy G. Pitre |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
50 * Fixed bug where an error other than E$MNF when linking to CoWin would be ignored. |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
51 * Now, if the error returned from linking CoWin is not E$MNF, we don't bother to look |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
52 * for CoGrf... we just return immediately. |
1933 | 53 |
54 nam VTIO | |
55 ttl Video Terminal I/O Driver for CoCo 3 | |
56 | |
57 * Disassembled 98/09/09 08:29:24 by Disasm v1.6 (C) 1988 by RML | |
58 | |
59 ifp1 | |
60 use defsfile | |
2624 | 61 use cocovtio.d |
1933 | 62 endc |
63 | |
64 tylg set Drivr+Objct | |
65 atrv set ReEnt+rev | |
66 rev set 0 | |
2115
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
67 edition set 2 |
1933 | 68 |
69 * Comment out next line for global keyboard mouse; otherwise, it's on/off | |
70 * on a per-window basis. | |
71 GLOBALKEYMOUSE equ 1 | |
72 | |
73 mod eom,name,tylg,atrv,start,CC3DSiz | |
74 | |
75 fcb EXEC.+UPDAT. | |
76 | |
77 name fcs /VTIO/ | |
78 fcb edition | |
79 | |
80 start lbra Init | |
81 lbra Read | |
82 lbra Write | |
83 lbra GetStat | |
84 lbra SetStat | |
85 | |
86 * Term | |
87 * | |
88 * Entry: | |
89 * U = address of device memory area | |
90 * | |
91 * Exit: | |
92 * CC = carry set on error | |
93 * B = error code | |
94 * | |
95 Term equ * | |
96 ldx <D.CCMem get ptr to CC memory | |
97 cmpu G.CurDev,x device to be terminated is current? | |
98 * cmpu >WGlobal+G.CurDev device to be terminated is current? | |
99 bne noterm no, execute terminate routine in co-module | |
100 lbsr SHFTCLR get last window memory pointer | |
101 cmpu G.CurDev,x device to be terminated is current? | |
102 * cmpu >WGlobal+G.CurDev we the only window left? | |
103 bne noterm no, execute terminate routine in co-module | |
104 * We are last device that VTIO has active; terminate ourself | |
105 pshs cc | |
106 orcc #IRQMask | |
107 IFNE H6309 | |
108 clrd | |
109 ELSE | |
110 clra | |
111 clrb | |
112 ENDC | |
113 std G.CurDev,x | |
114 * std >WGlobal+G.CurDev | |
115 * ldx <D.Clock change altirq routine to go to clock | |
116 ldx G.OrgAlt,x get original D.AltIRQ address | |
117 stx <D.AltIRQ | |
118 puls cc restore IRQs | |
119 | |
120 pshs u,x | |
121 ldx #(WGlobal+G.JoyEnt) | |
122 bsr TermSub | |
123 ldx #(WGlobal+G.SndEnt) | |
124 bsr TermSub | |
125 ldx #(WGlobal+G.KeyEnt) | |
126 bsr TermSub | |
127 puls u,x | |
128 noterm ldb #$0C branch table offset for terminate | |
129 lbra CallCo go to terminate in co-module | |
130 | |
131 * Call terminate routine in subroutine module (KeyDrv/JoyDrv/SndDrv) | |
132 * X = addr in statics of entry | |
133 TermSub leau 2,x point U to static area for sub module | |
134 ldx ,x get entry pointer at ,X | |
135 jmp $03,x call term routine in sub module | |
136 | |
137 * Init | |
138 * | |
139 * Entry: | |
140 * Y = address of device descriptor | |
141 * U = address of device memory area | |
142 * | |
143 * Exit: | |
144 * CC = carry set on error | |
145 * B = error code | |
146 * | |
147 Init ldx <D.CCMem get ptr to CC mem | |
148 ldd <G.CurDev,x has VTIO itself been initialized? | |
149 lbne PerWinInit yes, don't bother doing it again | |
150 * VTIO initialization code - done on the first init of ANY VTIO device | |
1994 | 151 * leax >ISR,pcr set up AltIRQ vector in DP |
1933 | 152 * stx <D.AltIRQ |
153 leax >SHFTCLR,pcr point to SHIFT-CLEAR subroutine | |
154 pshs x save it on stack | |
155 leax >setmouse,pcr get address of setmouse routine | |
156 tfr x,d | |
157 ldx <D.CCMem get ptr to CC mem | |
158 std >G.MsInit,x | |
159 puls b,a get address of SHIFT-CLEAR subroutine | |
160 std >G.WindBk,x save its vector | |
161 stu <G.CurDev,x | |
162 lbsr setmouse initialize mouse | |
163 | |
164 lda #$02 | |
165 sta G.CurTik,x save # ticks between cursor(s)updates | |
166 inc <G.Mouse+Pt.Valid,x set mouse packet to invalid | |
167 ldd #$0178 default to right mouse/time out value | |
168 std <G.Mouse+Pt.Actv,x | |
169 | |
170 ldd #$FFFF initialize keyboard values | |
171 std <G.LKeyCd,x last keyboard code & key repeat counter inactive | |
172 std <G.2Key2,x | |
173 ldd <D.Proc get cur proc desc ptr in D | |
174 pshs u,y,x,b,a save regs | |
175 | |
176 * Added to allow patching for RGB/CMP/Mono and Key info - BGP | |
177 * Uses new init module format to get monitor type and key info | |
178 | |
179 ldy <D.Init get init module ptr | |
180 lda MonType,y get monitor type byte 0,1,2 | |
181 sta <G.MonTyp,x save off | |
182 ldd MouseInf,y get mouse information | |
183 sta <G.Mouse+Pt.Res,x save off hi-res/lo-res flag | |
184 stb <G.Mouse+Pt.Actv,x save off left/right | |
185 ldd KeyRptS,y get key repeat start/delay constant | |
186 sta <G.KyRept,x set first delay | |
187 std <G.KyDly,x set initial and 2ndary constants | |
188 | |
189 ldd <D.SysPrc get system process desc ptr | |
190 std <D.Proc and make current proc | |
191 leax >KeyDrv,pcr point to keyboard driver sub module name | |
192 bsr LinkSys link to it | |
193 * U = ptr to CC mem | |
194 sty >G.KeyEnt,u and save the entry point | |
195 leau >G.KeyMem,u point U to keydrv statics | |
196 jsr ,y call init routine of sub module | |
197 leax >JoyDrv,pcr point to joystick driver sub module name | |
198 bsr LinkSys link to it | |
199 * U = ptr to CC mem | |
200 sty >G.JoyEnt,u and save the entry point | |
201 leau >G.JoyMem,u point U to joydrv statics | |
202 jsr ,y call init routine of sub module | |
203 leax >SndDrv,pcr point to sound driver sub module name | |
204 bsr LinkSys link to it | |
205 * U = ptr to CC mem | |
206 sty >G.SndEnt,u and save the entry point | |
207 leau >G.SndMem,u point U to sound statics | |
208 jsr ,y call init routine of sub module | |
209 puls u,y,x,b,a restore saved regs | |
210 std <D.Proc and restore current process | |
211 | |
212 ldx <D.AltIRQ get original D.AltIRQ address | |
213 stx >WGlobal+G.OrgAlt save in window globals for later | |
1994 | 214 leax >ISR,pcr set up AltIRQ vector in DP |
1933 | 215 stx <D.AltIRQ |
216 | |
217 * This code is executed on init of every window | |
218 * U = device memory area | |
219 PerWinInit | |
220 ldd #$0078 set default SS.Mouse parameters | |
221 std <V.MSmpl,u (Mouse sample rate & fire button timeout value) | |
222 ldd <IT.PAR,y get parity/baud bytes from dev desc | |
223 std <V.DevPar,u save it off in our static | |
224 *** Find CC3GfxInt | |
225 * pshs u,y,a ..else VDG | |
226 * lda #$02 get code for VDG type window | |
227 * sta <V.WinType,u save it | |
228 * leax <CC3GfxInt,pcr point to CC3GfxInt name | |
229 * lbsr L08D4 link to it if it exists | |
230 * puls u,y,a restore regs & return | |
231 *** | |
232 lbra FindCoMod go find and init co-module | |
233 | |
234 KeyDrv fcs /KeyDrv/ | |
235 JoyDrv fcs /JoyDrv/ | |
236 SndDrv fcs /SndDrv/ | |
237 | |
238 LinkSys lda #Systm+Objct system module | |
239 os9 F$Link link to it | |
240 ldu <D.CCMem get ptr to CC mem | |
241 rts | |
242 | |
243 | |
244 * Read | |
245 * | |
246 * NOTE: | |
247 * This just reads keys from the buffer. The physical reading | |
248 * of keys is done by the IRQ routine. | |
249 * | |
250 * Entry: | |
251 * Y = address of path descriptor | |
252 * U = address of device memory area | |
253 * | |
254 * Exit: | |
255 * A = character read | |
256 * CC = carry set on error | |
257 * B = error code | |
258 * | |
1994 | 259 Read tst V.PAUS,u device paused? |
260 bpl read1 no, do normal read | |
261 * Here, device is paused; check for mouse button down | |
262 * If it is down, we simply return without error. | |
263 tst >(WGlobal+G.Mouse+Pt.CBSA) test current button state A | |
1933 | 264 beq read1 button isn't pressed, do normal read |
265 clra clear carry (no error) | |
266 rts return | |
267 | |
1994 | 268 * Check to see if there is a signal-on-data-ready set for this path. |
269 * If so, we return a Not Ready error. | |
1933 | 270 read1 lda <V.SSigID,u data ready signal trap set up? |
1994 | 271 lbne NotReady yes, exit with not ready error |
1933 | 272 leax >ReadBuf,u point to keyboard buffer |
273 ldb <V.InpPtr,u get current position in keyboard buffer | |
274 orcc #IRQMask disable IRQs | |
275 cmpb <V.EndPtr,u same as end of buffer ptr (no keys in buffer)? | |
276 beq ReadSlp yes, no new chars waiting, sleep/scan for them | |
277 * Character(s) waiting in buffer | |
278 abx move ptr to character | |
279 lda ,x get character from buffer | |
280 incb inc keyboard buffer ptr | |
281 bpl bumpdon if it hasn't wrapped 128 bytes, go save it | |
282 * bsr ChkWrap check for wrap | |
283 clrb | |
284 bumpdon stb <V.InpPtr,u save updated keyboard buffer ptr | |
285 andcc #^(IRQMask!Carry) restore IRQ and clear carry | |
286 rts return with A containing char read | |
287 | |
288 * Nothing is in input buffer so wait for it | |
289 ReadSlp lda V.BUSY,u get active process id # | |
290 sta V.WAKE,u save as process id # to wake up when data read | |
291 andcc #^IRQMask restore IRQ | |
292 ldx #$0000 sleep till data ready | |
293 os9 F$Sleep | |
294 clr V.WAKE,u signal gotten, disable process # to wake up | |
295 ldx <D.Proc get current proc desc ptr | |
296 ldb <P$Signal,x signal pending? | |
297 beq Read no, go read char | |
298 * Signal was pending already, check it out | |
299 IFNE H6309 | |
300 tim #Condem,P$State,x are we condemend? | |
301 ELSE | |
302 lda P$State,x | |
303 bita #Condem | |
304 ENDC | |
305 bne ReadErr yes, exit with error flag set back to SCF | |
306 cmpb #S$Window window change or higher signal? | |
307 bcc Read yes, read the char since it won't change | |
308 ReadErr coma major signal, return with error flag | |
309 rts (Keyboard abort/interrupt) | |
310 | |
311 * Check wraparound of keyboard buffer (could be inlined) | |
312 *ChkWrap incb inc keyboard buffer pointer | |
313 * cmpb #$7F wrapped around? | |
314 * bls L015F branch if not | |
315 * clrb else reset pointer to 0 | |
316 *L015F rts return | |
317 | |
318 * Keyboard mouse coordinate deltas | |
319 L0160 fcb 8,1 right arrow (normal, shifted) | |
320 fdb MaxRows-1 right arrow (control) | |
321 fcb -8,-1 left arrow (normal, shifted) | |
322 fdb 0 left arrow (control) | |
323 fcb 8,1 down arrow (normal, shifted) | |
324 fdb MaxLine down arrow (control) | |
325 fcb -8,-1 up arrow (normal, shifted) | |
326 fdb 0 up arrow (control) | |
327 | |
328 * Check mouse coordinate | |
329 * Entry: D=Maximum allowed coordinate for current axis being checked | |
330 * Y=Ptr to current coordinate in mouse packet being checked | |
331 L0170 cmpd ,y past maximum allowed coordinate? | |
332 blt L017B | |
333 ldd ,y below zero? | |
334 bpl L017D no, return | |
335 IFNE H6309 | |
336 clrd set it to minimum coordinate (zero) | |
337 ELSE | |
338 clra | |
339 clrb | |
340 ENDC | |
341 L017B std ,y set it to maximum coordinate | |
342 L017D rts return | |
343 | |
344 | |
345 * Main keyboard scan (after PIA has been read) | |
346 * Check keyboard mouse arrows | |
347 * Entry: U=Global mem ptr | |
348 * X=??? | |
349 * A=Key that was pressed | |
350 * Exit: E=0 if key was pressed, 1 if none pressed | |
351 * Updated for localized keyboard mouse similiar to TC9IO | |
352 * | |
353 L017E ldb #$01 flag | |
354 pshs u,y,x,b,a save registers used & flag | |
355 ldb <G.KyMse,u get keyboard mouse flag | |
356 beq L01E6 branch if off | |
357 * Keyboard mouse is on | |
358 lda <G.KySns,u | |
359 bita #%01111000 any arrow key pressed? | |
360 beq L01DF | |
361 clr $01,s clear flag to indicate update | |
362 lda #$01 | |
363 sta <G.MseMv,u flag a mouse coord change | |
364 ldd #$0803 start at up arrow and up arrow table | |
365 pshs b,a entries & save them | |
366 leax >L0160,pcr point to keyboard mouse deltas | |
367 leay <G.Mouse+Pt.AcY,u point to mouse coords | |
368 | |
369 * Update keyboard mouse co-ordinates according to arrow key pressed | |
370 L01A2 bita <G.KySns,u desired arrow key down? | |
371 beq L01C5 no, move to next key | |
372 lslb multiply * 4 (size of each set) | |
373 lslb to point to start of proper arrow entry | |
374 tst <G.ShftDn,u shift key down? | |
375 beq L01B1 no, go on | |
376 incb move ptr to <shifted> offset | |
377 bra L01BC get delta | |
378 L01B1 tst <G.CntlDn,u control key down? | |
379 beq L01BC no, go on | |
380 * <CTRL>-arrow | |
381 addb #$02 move ptr to <CTRL> offset | |
382 ldd b,x get control coordinate | |
383 bra L01C1 go store it in mouse packet | |
384 * <arrow> or <SHIFT>-<arrow> | |
385 L01BC ldb b,x get offset to present mouse coordinate | |
386 sex make into 16 bit offset (keep sign) | |
387 addd ,y add it to current coordinate | |
388 L01C1 std ,y save updated coordinate | |
389 ldd ,s get key count | |
390 L01C5 lsla move to next key bit | |
391 decb decrement key count | |
392 cmpb #$01 down to X coordinates? | |
393 bne L01CD no, continue | |
394 leay -$02,y move to mouse X coordinate | |
395 L01CD std ,s save key count & key | |
396 bpl L01A2 keep trying until all keys checked | |
397 puls b,a purge stack of key and delta offset | |
398 ldd #MaxRows-1 get maximum X coordinate | |
399 bsr L0170 check X coordinate | |
400 leay $02,y move to Y coordinate | |
401 ldd #MaxLine get maximum Y coordinate | |
2013
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
402 lbsr L0170 check it |
1933 | 403 L01DF lda <G.KyButt,u key button down? |
404 bne L0223 yes, return | |
405 lda ,s get back character read | |
406 L01E6 tst <G.Clear,u clear key down? | |
407 beq L0225 yes, return | |
408 clr <G.Clear,u clear out clear key flag | |
409 * Check CTRL-0 (CAPS-Lock) | |
1994 | 410 cmpa #%10000001 CTRL-0? |
1933 | 411 bne L01FF no, keep checking |
412 ldb <G.KySame,u same key pressed? | |
413 bne L0223 | |
414 ldx <G.CurDev,u get dev mem pointer | |
415 IFNE H6309 | |
416 eim #CapsLck,<V.ULCase,x | |
417 ELSE | |
418 ldb <V.ULCase,x | |
419 eorb #CapsLck reverse current CapsLock status | |
420 stb <V.ULCase,x | |
421 ENDC | |
422 bra L0223 return | |
423 * Check CLEAR key | |
1994 | 424 L01FF cmpa #%10000010 was it CLEAR key? |
1933 | 425 bne L0208 no, keep going |
426 lbsr CLEAR find next window | |
427 bra L0223 return | |
428 * Check SHIFT-CLEAR | |
1994 | 429 L0208 cmpa #%10000011 was it SHIFT-CLEAR? |
1933 | 430 bne L0211 no, keep checking |
431 lbsr SHFTCLR yes, find back window | |
432 bra L0223 return | |
433 * Check CTRL-CLEAR | |
1994 | 434 L0211 cmpa #%10000100 keyboard mouse toggle key? |
1933 | 435 bne L0225 no, return |
436 ldb <G.KySame,u same key pressed? | |
437 bne L0223 yes, return | |
438 IFNE GLOBALKEYMOUSE | |
439 com <G.KyMse,u | |
440 ELSE | |
441 ldx <G.CurDev,u | |
442 clra assume no keyboard mouse | |
443 IFNE H6309 | |
444 eim #KeyMse,<V.ULCase,x | |
445 ELSE | |
446 ldb <V.ULCase,x | |
447 eorb #KeyMse reverse current Keyboard Mouse status | |
448 stb <V.ULCase,x | |
449 ENDC | |
450 beq KeyMOff branch if off | |
451 deca else A = $FF | |
452 KeyMOff sta <G.KyMse,u save window's keyboard mouse flag in global | |
453 ENDC | |
454 L0223 clr $01,s | |
455 L0225 ldb $01,s | |
456 puls pc,u,y,x,b,a restore regs | |
457 | |
458 L0229 pshs x,b save external mouse button status & PIA addr | |
459 leax <G.Mouse,u mouse point to mouse packet | |
460 tst Pt.ToTm,x timed value zero? | |
461 lbeq L02C8 branch if so | |
462 leas -$05,s make a buffer for locals | |
463 tfr a,b move keyboard button flags to B | |
464 tst <G.KyMse,u keyboard mouse activated? | |
465 bne L024E yes, go on | |
466 ldb #%00000101 mask for button 1 & 2 on right mouse/joystick | |
467 lda Pt.Actv,x get active mouse side | |
468 anda #%00000010 clear all but left side select | |
469 sta ,s save result | |
470 beq L0248 if 0 (off or right side), skip ahead | |
471 lslb otherwise, change button 1 & 2 mask for left moue | |
472 L0248 andb $05,s check with external mouse button status type | |
473 tsta right side? | |
474 beq L024E yes, skip ahead | |
475 lsrb left side, shift over so we can use same routine | |
476 * Bits 0 & 2 of B contain external mouse buttons that are pressed (doesn't | |
477 * matter which side) | |
478 L024E clra clear out A | |
479 lsrb shift out LSBit of B | |
480 rola put into LSBit of A | |
481 lsrb shift out another bit of B | |
482 std $01,s store fire button info | |
483 bne L0276 fire button(s) pressed, go on | |
484 lda Pt.TTTo,x timeout occur? | |
485 beq L02C6 yes, exit | |
486 bsr L02CA fire buttons change? | |
487 beq L0262 no, decrement timeout count | |
488 bsr L02D3 go update fire button click & timeout info | |
489 beq L02AB if neither button state changed, skip ahead | |
490 L0262 dec Pt.TTTo,x decrement timeout count | |
491 bne L02AB not timed out, go update last state counts | |
492 IFNE H6309 | |
493 clrd | |
494 clrw | |
495 ELSE | |
496 clra | |
497 clrb | |
498 ENDC | |
499 sta >G.MsSig,u clear read flag | |
500 std Pt.TSSt,x clear time since counter start | |
501 IFNE H6309 | |
502 stq Pt.CCtA,x clear button click count & time this state | |
503 ELSE | |
504 std Pt.CCtA,x clear button click count & time this state | |
505 std Pt.TTSA,x | |
506 ENDC | |
507 std Pt.TLSA,x clear button time last state | |
508 bra L02C6 exit | |
509 | |
510 L0276 lda Pt.ToTm,x get timeout initial value | |
511 sta Pt.TTTo,x reset count | |
512 bsr L02CA fire buttons change? | |
513 beq L02AB no, update last state counts | |
514 bsr L02D3 update fire button info | |
515 inc >WGlobal+G.MsSig flag mouse signal | |
516 IFNE H6309 | |
517 ldq <Pt.AcX,x get actual X & Y coordinates | |
518 stq <Pt.BDX,x copy it to button down X & Y coordinates | |
519 ELSE | |
520 ldd <Pt.AcX,x get actual X coordinate | |
521 std <Pt.BDX,x copy it to button down X coordinate | |
522 ldd <Pt.AcY,x get actual Y coordinate | |
523 std <Pt.BDY,x copy it to button down Y coordinate | |
524 ENDC | |
525 pshs u save ptr to CC mem | |
526 ldu <G.CurDev,u get dev mem ptr | |
527 lda <V.MSigID,u get process ID requesting mouse signal | |
528 beq L02A9 branch if none | |
529 ldb <V.MSigSg,u else get signal code to send | |
530 os9 F$Send and send it | |
531 bcs L02A5 branch if error | |
532 clr <V.MSigID,u clear signal ID (one shot) | |
533 L02A5 clr >WGlobal+G.MsSig clear read flag | |
534 L02A9 puls u recover pointer to CC mem | |
535 L02AB ldd Pt.TTSA,x get button A&B time last state | |
536 cmpa #$FF limit? | |
537 beq L02B2 yes, go on | |
538 inca increment state | |
539 L02B2 cmpb #$FF limit? | |
540 beq L02B7 yes, store them | |
541 incb increment B state | |
542 L02B7 std Pt.TTSA,x save updated states | |
543 ldd Pt.TSST,x get time since start | |
544 IFNE H6309 | |
545 incd increment | |
546 beq L02C6 branch if zero | |
547 ELSE | |
548 * cmpd #$FFFF check upper bound | |
549 * beq L02C4 branch if so | |
550 * addd #$0001 else increment | |
551 addd #1 | |
552 beq L02C6 | |
553 ENDC | |
554 L02C4 std Pt.TSST,x save updated state count | |
555 L02C6 leas $05,s purge locals | |
556 L02C8 puls pc,x,b restore & return | |
557 | |
558 L02CA ldd Pt.CBSA,x get button states | |
559 IFNE H6309 | |
560 eord $03,s flip fire 1 & 2 | |
561 ELSE | |
562 eora $03,s | |
563 eorb $04,s | |
564 ENDC | |
565 std $05,s save 'em | |
566 rts return | |
567 | |
568 * Update mouse button clock counts & timeouts | |
569 L02D3 ldd Pt.TTSA,x get button time this state | |
570 tst $05,s button A change? | |
571 beq L02E9 no, go check B | |
572 sta Pt.TLSA,x save button A time last state | |
573 lda $03,s button A pressed? | |
574 bne L02E8 yes, skip increment | |
575 lda Pt.CCtA,x get click count for A | |
576 inca bump up click count | |
577 beq L02E9 branch if wrapped | |
578 sta Pt.CCtA,x save button A click count | |
579 L02E8 clra clear button A time this state | |
580 L02E9 tst 6,s button B change? | |
581 beq L02FD no, go save time this state | |
582 stb Pt.TLSB,x save button B time last state count | |
583 ldb $04,s button B pressed? | |
584 bne L02FC yes, skip increment | |
585 ldb Pt.CCtB,x get b click count | |
586 incb bump up click count | |
587 beq L02FD brach if wrapped to zero | |
588 stb Pt.CCtB,x save B click count | |
589 L02FC clrb clear button B time this state | |
590 L02FD std Pt.TTSA,x save button time this state counts | |
591 ldd $03,s get new fire buttons | |
592 std Pt.CBSA,x save 'em | |
593 ldd $05,s get button A & B change flags | |
594 NullIRQ rts return | |
595 | |
596 | |
1994 | 597 * |
1933 | 598 * VTIO IRQ routine - Entered from Clock every 1/60th of a second |
1994 | 599 * |
600 * The interrupt service routine is responsible for: | |
601 * - Decrementing the tone counter | |
602 * - Select the new active window if needed | |
603 * - Updating graphics cursors if needed | |
604 * - Checking for mouse update | |
605 * | |
606 ISR ldu <D.CCMem get ptr to CC mem | |
1933 | 607 ldy <G.CurDev,u get current device's static |
1994 | 608 lbeq CheckAutoMouse branch if none (meaning no window is currently created) |
609 tst <G.TnCnt,u get tone counter | |
610 beq CheckScrChange branch if zero | |
611 dec <G.TnCnt,u else decrement | |
612 | |
1933 | 613 * Check for any change on screen |
614 * U=Unused now (sitting as NullIRQ ptr) - MAY WANT TO CHANGE TO CUR DEV PTR | |
615 * Y=Current Device mem ptr | |
1994 | 616 CheckScrChange |
617 leax <NullIRQ,pcr set AltIRQ to do nothing routine so other IRQs | |
1933 | 618 stx <D.AltIRQ can fall through to IOMan polling routine |
619 andcc #^(IntMasks) re-enable interrupts | |
620 ldb <V.ScrChg,y check screen update request flag (cur screen) | |
621 beq L0337 no update needed, skip ahead | |
622 lda V.TYPE,y device a window? | |
1994 | 623 bpl SelNewWindow no, must be CoVDG, so go on |
1933 | 624 lda G.GfBusy,u 0 = GrfDrv free, 1 = GrfDrv busy |
625 ora G.WIBusy,u 0 = CoWin free, 1 = CoWin busy | |
626 bne L034F one of the two is busy, can't update, skip | |
1994 | 627 SelNewWindow |
628 clra special function: select new active window | |
1933 | 629 lbsr L05DA go execute co-module |
630 clr <V.ScrChg,y clear screen change flag in device mem | |
631 * | |
632 * CHECK IF GFX/TEXT CURSORS NEED TO BE UPDATED | |
633 * G.GfBusy = 1 Grfdrv is busy processing something else | |
1994 | 634 * G.WIBusy = 1 CoWin is busy processing something else |
1933 | 635 * g0000 = # of clock ticks/cursor update constant (2) for 3 ticks: 2,1,0 |
636 * G.CntTik = current clock tick for cursor update | |
637 * | |
1994 | 638 L0337 tst G.CntTik,u get current clock tick count for cursor updates |
1933 | 639 beq L034F if 0, no update required |
1994 | 640 dec G.CntTik,u decrement the tick count |
641 bne L034F if still not 0, don't do update | |
1933 | 642 lda G.GfBusy,u get GrfDrv busy flag |
643 ora G.WIBusy,u merge with CoWin busy flag | |
644 beq L034A if both not busy, go update cursors | |
645 inc G.CntTik,u otherwise bump tick count up again | |
646 bra L034F and don't update | |
647 | |
648 L034A lda #$02 update cursors sub-function code | |
649 lbsr L05DA go update cursors through co-module | |
650 * Check for mouse update | |
651 L034F equ * | |
652 * Major error here. Used regU which points to D.CCMem not G.CurDev. RG | |
653 IFNE GLOBALKEYMOUSE | |
654 tst <G.KyMse,u keyboard mouse? | |
655 ELSE | |
656 IFNE H6309 | |
657 tim #KeyMse,<V.ULCase,y keyboard mouse? | |
658 ELSE | |
659 lda <V.ULCase,y keyboard mouse? | |
660 bita #KeyMse | |
661 ENDC | |
662 ENDC | |
663 bne L0369 branch if so | |
664 lda <G.MSmpRt,u get # ticks until next mouse read | |
665 beq L0369 0 means shut off, don't bother | |
666 deca decrement # ticks | |
667 bne L0366 still not yet, save tick counter & skip mouse | |
668 pshs u,y,x save dev mem ptr and others | |
669 lbsr L0739 go update mouse packet | |
670 puls u,y,x restore regs | |
671 lda <G.MSmpRV,u get # ticks/mouse read reset value | |
672 L0366 sta <G.MSmpRt,u save updated tick count | |
1994 | 673 |
1933 | 674 * Check keyboard |
675 L0369 equ * | |
676 IFNE H6309 | |
677 clrd initialize keysense & same key flag | |
678 ELSE | |
679 clra | |
680 clrb | |
681 ENDC | |
682 std <G.KySns,u initialize keysense & same key flag | |
683 * Major error here. Was regU; see above. RG | |
684 IFNE GLOBALKEYMOUSE | |
685 tst <G.KyMse,u | |
686 ELSE | |
687 IFNE H6309 | |
688 tim #KeyMse,>V.ULCase,y | |
689 ELSE | |
690 pshs a | |
691 lda >V.ULCase,y is the keyboard mouse enabled? | |
692 bita #KeyMse | |
693 puls a | |
694 ENDC | |
695 ENDC | |
696 beq L0381 no, try joystick | |
697 ldx >WGlobal+G.KeyEnt else get ptr to keydrv | |
698 leau >G.KeyMem,u and ptr to its statics | |
699 jsr K$FnKey,x call into it | |
700 ldu <D.CCMem get ptr to CC mem | |
1994 | 701 sta <G.KyButt,u save keyboard/button state |
1933 | 702 L0381 ldx >WGlobal+G.JoyEnt get ptr to joydrv |
703 leau >G.JoyMem,u and ptr to its statics | |
704 jsr J$MsBtn,x get mouse button info | |
1994 | 705 * Here, B now holds the value from the MsBtn routine in JoyDrv. |
1933 | 706 ldu <D.CCMem get ptr to CC mem |
707 lda #%10000010 A = $82 | |
708 cmpb #%10000000 clear flag set? | |
709 beq L0397 branch if so | |
710 inca A now = $83 | |
711 cmpb #%11000000 shift clear flag set? | |
712 bne L039C branch if not | |
713 L0397 inc <G.Clear,u | |
714 bra L03C8 | |
715 L039C tst V.PAUS,y pause screen on? | |
716 bpl L03A8 branch if not | |
717 bitb #%00000011 any mouse buttons down? | |
718 beq L03A8 branch if not | |
719 lda #C$CR load A with carriage return | |
720 bra L03C8 | |
721 L03A8 lda <G.KyButt,u | |
722 lbsr L0229 | |
723 tstb | |
724 lbne L044E | |
725 pshs u,y,x | |
726 ldx >WGlobal+G.KeyEnt | |
727 leau >G.KeyMem,u | |
728 jsr K$RdKey,x call Read Key routine | |
729 puls u,y,x | |
730 bpl L03C8 branch if valid char received | |
731 clr <G.LastCh,u else clear last character var | |
732 lbra L044E | |
2013
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
733 L03C8 |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
734 *** Inserted detection of debugger invocation key sequence here... |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
735 cmpa #$9B CTRL+ALT+BREAK? |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
736 bne n@ no, move on |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
737 jsr [>WGlobal+G.BelVec] for whom the bell tolls... |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
738 os9 F$Debug |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
739 lbra L044E |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
740 n@ |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
741 *** |
55210a27019c
Edition reset to 1, CTRL-ALT-BREAK now used to call F$Debug
boisy
parents:
1994
diff
changeset
|
742 cmpa <G.LastCh,u is current ASCII code same as last one pressed? |
1933 | 743 bne L03DF no, no keyboard repeat, skip ahead |
744 ldb <G.KyRept,u get repeat delay constant | |
745 beq L044E if keyboard repeat shut off, skip repeat code | |
746 decb repeat delay up? | |
747 beq L03DA branch if so and reset | |
748 L03D5 stb <G.KyRept,u update delay | |
749 bra L044E return | |
750 | |
751 L03DA ldb <G.KySpd,u get reset value for repeat delay | |
752 bra L03ED go update it | |
753 | |
754 L03DF sta <G.LastCh,u store last keyboard character | |
755 ldb <G.KyDly,u get keyboard delay speed | |
756 tst <G.KySame,u same key as last time? | |
757 bne L03D5 no, go reset repeat delay | |
758 ldb <G.KyDly,u get time remaining | |
759 L03ED stb <G.KyRept,u save updated repeat delay | |
760 lbsr L017E | |
761 beq L044E | |
762 ldb #$01 This may be wrong because regB was created in sub RG | |
763 stb >g00BF,u menu keypress flag | |
764 ldu <G.CurDev,u get ptr to statics in U | |
765 ldb <V.EndPtr,u | |
766 leax >ReadBuf,u point to keyboard buffer | |
767 abx move to proper offset | |
768 incb inc keyboard buffer ptr | |
769 bpl bumpdon2 hasn't wrapped, skip ahead | |
770 clrb reset pointer | |
771 * lbsr ChkWrap check for wrap-around | |
772 bumpdon2 cmpb <V.InpPtr,u same as start? | |
773 beq L0411 yep, go on | |
774 stb <V.EndPtr,u save updated pointer | |
775 L0411 sta ,x save key in buffer | |
776 beq L0431 go on if it was 0 | |
777 * Check for special characters | |
778 cmpa V.PCHR,u pause character? | |
779 bne L0421 no, keep checking | |
780 ldx V.DEV2,u is there an output path? | |
781 beq L0443 no, wake up the process | |
782 sta V.PAUS,x set immediate pause request on device | |
783 bra L0443 wake up the process | |
784 | |
785 L0421 ldb #S$Intrpt get signal code for key interrupt | |
786 cmpa V.INTR,u is key an interrupt? | |
787 beq L042D branch if so (go send signal) | |
788 ldb #S$Abort get signal code for key abort | |
789 cmpa V.QUIT,u is it a key abort? | |
790 bne L0431 no, check data ready signal | |
791 L042D lda V.LPRC,u get last process ID | |
792 bra L0447 go send the signal | |
793 L0431 lda <V.SSigID,u send signal on data ready? | |
794 beq L0443 no, just go wake up process | |
795 ldb <V.SSigSg,u else get signal code | |
796 os9 F$Send | |
797 bcs L044E | |
798 clr <V.SSigID,u clear signal ID | |
799 bra L044E return | |
800 L0443 ldb #S$Wake get signal code for wakeup | |
801 lda V.WAKE,u get process ID to wake up | |
802 L0447 beq L044E no process to wake, return | |
803 clr V.WAKE,u clear it | |
804 os9 F$Send send the signal | |
805 L044E ldu <D.CCMem get ptr to CC mem | |
1994 | 806 CheckAutoMouse |
1933 | 807 lda <G.AutoMs,u auto mouse flag set? |
808 beq L046B branch if not | |
809 lda <G.MseMv,u get mouse moved flag | |
810 ora <G.Mouse+Pt.CBSA,u | |
811 beq L046B | |
812 lda G.GfBusy,u check for GrfDrv busy | |
813 ora G.WIBusy,u OR with CoWin busy | |
814 bne L046B branch if they are busy | |
815 lda #$03 | |
816 lbsr L05DA | |
817 clr <G.MseMv,u clear mouse move flag | |
818 L046B orcc #IntMasks mask interrupts | |
1994 | 819 leax >ISR,pcr get IRQ vector |
1933 | 820 stx <D.AltIRQ and store in AltIRQ |
821 rts return | |
822 | |
823 | |
824 org 4 | |
825 f.nbyte rmb 1 # of bytes to next entry in table (signed #) | |
826 f.tblend rmb 2 ptr to end of device table + 1 | |
827 f.ptrstr rmb 2 start of search ptr (if backwards, -1 entry) | |
828 f.ptrend rmb 2 end of search ptr (if backwards, -1 entry) | |
829 *f.ptrcur rmb 2 ptr to current device's device table entry | |
830 f.ptrdrv rmb 2 ptr to current device's driver | |
831 f.ptrchk rmb 2 ptr to the device table entry we are currently checking | |
832 f.numdve rmb 1 number of device table entries in device table | |
833 f.end equ . | |
834 | |
835 * Prepare for Window search in Device Table | |
836 * Point to end of device table | |
837 WinSearchInit | |
838 stb f.nbyte+2,s save # bytes to next (neg or pos) | |
839 ldx <D.Init get pointer to init module | |
840 lda DevCnt,x get max # of devices allowed | |
841 sta f.numdve+2,s | |
842 ldb #DEVSIZ get size of each device table entry | |
843 mul calculate total size of device table | |
844 ldy <D.DevTbl get device table ptr | |
845 leax d,y point X to end of devtable + 1 | |
846 stx f.tblend+2,s save the ptr & return | |
847 rts | |
848 | |
849 * CLEAR processor | |
850 CLEAR pshs u,y,x,b,a preserve registers | |
851 leas <-f.end,s make a buffer on stack | |
852 ldb #DEVSIZ get # of bytes to move to next entry (forward) | |
853 bsr WinSearchInit get pointer to devtable | |
854 stx f.ptrend,s save end of devtable | |
855 sty f.ptrstr,s save beginning of devtable | |
856 bra FindWin | |
857 | |
858 * Shift-CLEAR processor | |
859 SHFTCLR pshs u,y,x,b,a preserve registers | |
860 leas <-f.end,s make a buffer on the stack | |
861 ldb #-DEVSIZ # of bytes to move next entry (backwards) | |
862 bsr WinSearchInit make ptrs to devtable | |
863 * Here, Y points to first entry of device table | |
864 * and X points to last entry of device table + 1 | |
865 leay -DEVSIZ,y bump Y back by 1 entry (for start of loop) | |
866 sty f.ptrend,s save it | |
867 leax -DEVSIZ,x bump X back for start of loop | |
868 stx f.ptrstr,s save it | |
869 | |
870 * FindWin - Find the next (or previous) window in the device table | |
871 * | |
872 * The search takes place just before or after the current window's | |
873 * device table entry. | |
874 * | |
875 * NOTE: SS.OPEN for current window has changed V.PORT to be the ptr to the | |
876 * current window's entry in the device table | |
877 FindWin ldx <D.CCMem get ptr to CC mem | |
878 ldu <G.CurDev,x get active device's static mem ptr | |
879 lbeq L0546 if none (no screens), exit without error | |
880 ldx V.PORT,u get device table ptr for current device | |
881 * stx f.ptrcur,s save it on stack | |
882 stx f.ptrchk,s save as default we are checking | |
883 ldd V$DRIV,x get ptr to current device driver's module | |
884 std f.ptrdrv,s save it on stack | |
885 * Main search loop | |
886 L04BA ldx f.ptrchk,s get ptr to device tbl entry we are checking | |
887 L04BC ldb f.nbyte,s get # of bytes to next entry (signed) | |
888 dec f.numdve,s + have we exhausted all entries? | |
889 bmi L0541 + yes, end | |
890 leax b,x point to next entry (signed add) | |
891 cmpx f.ptrend,s did we hit end of search table? | |
892 bne L04C6 no, go check if it is a screen device | |
893 ldx f.ptrstr,s otherwise wrap around to start of search ptr | |
894 * Check device table entry (any entry we can switch to has to have VTIO as | |
895 * the driver) | |
896 L04C6 stx f.ptrchk,s save new device table ptr we are checking | |
897 ldd V$DRIV,x get ptr to driver | |
898 cmpd f.ptrdrv,s same driver as us? (VTIO) | |
899 bne L04BC no, try next one | |
900 * NOTE: The next two lines are moved down two lines, past the check | |
901 * for our own device table pointer. This fixes a bug where the last | |
902 * deiniz of the last window device caused an infinite loop. The problem | |
903 * was that IOMan clears the static storage of a device whose use count | |
904 * has reached zero (in the case of a hard detach), and we were testing for | |
905 * a V$STAT of zero BEFORE seeing if we reached our own device table entry. | |
906 | |
907 * Next two lines moved... | |
908 * ldu V$STAT,x get ptr to static storage for tbl entry | |
909 * beq L04BC there is none, try next one | |
910 * cmpx f.ptrcur,s is this our own (have we come full circle)? | |
911 * beq L0541 yes, obviously nowhere else to switch to | |
912 * ...to here. | |
913 ldu V$STAT,x get ptr to static storage for tbl entry | |
914 beq L04BC there is none, try next one | |
915 * Found an initialized device controlled by VTIO that is not current device | |
916 lda <V.InfVld,u is the extra window data in static mem valid? | |
917 beq L04BA no, not good enough, try next one | |
918 ldx <V.PDLHd,u get ptr to list of open paths on device | |
919 beq L0536 no open paths, so switch to that device | |
920 lda V.LPRC,u get last active process ID # that used device | |
921 beq L0536 | |
922 * Path's open to device & there is a last process # for that path | |
923 ldy <D.PrcDBT get process descriptor table ptr | |
924 lda a,y get MSB of ptr to process descriptor last on it | |
925 beq L0536 process now gone, so switch to device | |
926 clrb move process desc ptr to Y | |
927 tfr d,y | |
928 lda >P$SelP,y get the path # that outputs to the window | |
929 leay <P$Path,y move to the path table local to the process | |
930 sta ,s | |
931 pshs x | |
932 L04FA ldb #NumPaths for every possible path... | |
933 lda ,x get system path into A | |
934 L04FE decb decrement | |
935 cmpa b,y same? | |
936 beq L050F branch if so | |
937 tstb are we at start of paths? | |
938 bne L04FE branch if not | |
939 ldx <PD.PLP,x get ptr to next path dsc. list (linked list) | |
940 bne L04FA branch if valid | |
941 puls x else restore X | |
942 bra L0536 | |
943 L050F puls x | |
944 lda ,s | |
945 L0513 sta ,s | |
946 cmpa #$02 is selected path one of the 3 std paths? | |
947 bhi L051F not one of the std 3 paths, skip ahead | |
948 ldb #$02 standard error path | |
949 lda b,y get system path # for local error path | |
950 bra L0522 | |
951 | |
952 L051F lda a,y get system path # for local path | |
953 clrb standard in | |
954 * X=Ptr to linked list of open paths on device | |
955 * A=System path # | |
956 * B=Local (to process) path # | |
957 * Check if any paths to device are open, if they are we can switch to it | |
958 L0522 cmpa ,x path we are checking same as path already open | |
959 beq L0536 on device? yes, go switch to it | |
960 decb bump local path # down | |
961 bmi L052D if no more paths to check, skip ahead | |
962 lda b,y get system path # for new local path to check | |
963 bra L0522 check if it is already open on device | |
964 | |
965 L052D lda ,s get local path # we started on | |
966 ldx <PD.PLP,x get ptr to path dsc. list (linked list) | |
967 bne L0513 there is no path desc list, try next path | |
968 bra L04BA can't switch to it, go to next device tbl entry | |
969 | |
970 L0536 ldx <D.CCMem get ptr to CC mem | |
971 stu <G.CurDev,x save new active device | |
972 clr g000A,x flag that we are not on active device anymore | |
973 clr >g00BF,x clear CoWin's key was pressed flag (new window) | |
974 * If there is only one window, it comes here to allow the text/mouse cursors | |
975 * to blink so you know you hit CLEAR or SHIFT-CLEAR | |
976 L0541 inc <V.ScrChg,u flag device for a screen change | |
977 bsr setmouse check mouse | |
978 L0546 leas <f.end,s purge stack buffer | |
979 clrb clear carry | |
980 puls pc,u,y,x,b,a restore regs and return | |
981 | |
982 * Initialize mouse | |
983 * Also called when CLEARing to a new window. | |
984 setmouse pshs x save register used | |
985 ldd <V.MSmpl,u get sample and timeout from win devmem | |
986 ldx <D.CCMem get ptr to CC mem | |
987 sta <G.MSmpRt,x set sample tick count in global mem | |
988 sta <G.MSmpRV,x set sample rate in global mem | |
989 stb <G.Mouse+Pt.ToTm,x set timeout constant in mouse packet | |
990 ldb <V.MAutoF,u get auto follow flag from win devmem | |
991 stb <G.AutoMs,x and set auto follow flag in global mem | |
992 lda V.TYPE,u get device type | |
993 sta <G.WinType,x set it | |
994 IFEQ GLOBALKEYMOUSE | |
995 * Added: get window's keyboard mouse flag and update global keyboard mouse | |
996 IFNE H6309 | |
997 tim #KeyMse,<V.ULCase,u keyboard mouse? | |
998 ELSE | |
999 lda <V.ULCase,u keyboard mouse? | |
1000 bita #KeyMse | |
1001 ENDC | |
1002 bne setmous2 | |
1003 clra | |
1004 fcb $8c | |
1005 setmous2 lda #$FF | |
1006 sta <G.KyMse,x | |
1007 ENDC | |
1008 clra | |
1009 puls pc,x restore and return | |
1010 | |
1011 | |
1012 * Write | |
1013 * | |
1014 * Entry: | |
1015 * A = character to write | |
1016 * Y = address of path descriptor | |
1017 * U = address of device memory area | |
1018 * | |
1019 * Exit: | |
1020 * CC = carry set on error | |
1021 * B = error code | |
1022 * | |
1023 Write ldb <V.ParmCnt,u are we in the process of getting parameters? | |
1024 lbne L0600 yes, go process | |
1025 sta <V.DevPar,u save off character | |
1026 cmpa #C$SPAC space or higher? | |
1027 bcc CoWrite yes, normal write | |
1028 cmpa #$1E 1E escape code? | |
1029 bcc L05EF yes, go process | |
1030 cmpa #$1B $1B escape code? | |
1031 beq L05F3 yes, go handle it | |
1032 cmpa #$05 $05 escape code? (cursor on/off) | |
1033 beq L05F3 yep, go handle it | |
1034 cmpa #C$BELL Bell? | |
1035 bne CoWrite no, control char | |
1036 jmp [>WGlobal+G.BelVec] for whom the bell tolls... | |
1037 | |
1038 CoWrite ldb #$03 write entry point in co-module | |
1039 CallCo lda <V.DevPar,u get character stored earlier | |
1040 L0593 ldx <D.CCMem get ptr to CC mem | |
1041 stu G.CurDvM,x save dev mem ptr for current device | |
1042 L0597 pshs a | |
1043 leax <G.CoTble,x point to co-module entry vectors | |
1044 lda <V.WinType,u get window type from device mem | |
1045 ldx a,x get vector to proper co-module | |
1046 puls a | |
1047 beq L05EB vector empty, exit with module not found | |
1048 leax b,x | |
1049 bsr L05C0 | |
1050 ldb <V.WinType,u | |
1051 beq L05B4 | |
1052 jsr ,x go execute co-module | |
1053 L05B0 pshs cc | |
1054 bra L05BB | |
1055 L05B4 jsr ,x | |
1056 L05B6 pshs cc | |
1057 clr >WGlobal+G.WIBusy | |
1058 L05BB clr >WGlobal+G.CrDvFl | |
1059 puls pc,cc | |
1060 | |
1061 L05C0 pshs x,b | |
1062 ldx <D.CCMem get ptr to CC mem | |
1063 clr G.WIBusy,x clear CoWin busy flag | |
1064 ldb <V.WinType,u get window type (0 = CoWin) | |
1937 | 1065 bne L05CE branch if CoVDG |
1933 | 1066 incb else make B = 1 |
1067 stb G.WIBusy,x and make CoWin busy | |
1068 L05CE clr G.CrDvFl,x clear 'we are current device' | |
1069 cmpu <G.CurDev,x | |
1070 bne L05D8 | |
1071 inc g000A,x | |
1072 L05D8 puls pc,x,b | |
1073 | |
1074 * U = ptr to CC memory | |
1075 L05DA pshs u,y,x | |
1076 ldu <G.CurDev,u get ptr to curr dev mem | |
1077 L05DF ldb #$0F | |
1078 ldx <D.CCMem get ptr to CC memory in X | |
1079 bsr L0597 | |
1080 puls pc,u,y,x restore regs and return | |
1081 | |
1082 L05E7 pshs u,y,x save regs | |
1083 bra L05DF | |
1084 | |
1085 L05EB comb | |
1086 ldb #E$MNF | |
1087 rts | |
1088 | |
1089 * $1E & $1F codes go here | |
1090 L05EF cmpa #$1E $1E code? | |
1091 beq Do1E branch if so | |
1092 * $1F codes fall through to here | |
1093 * Escape code handler : Initial code handled by VTIO, any parameters past | |
1094 * $1B xx are handled by co-module later | |
1095 * NOTE: Notice that is does NOT update <DevPar,u to contain the param byte, | |
1096 * but leaves the initial <ESC> ($1b) code there. The co-module checks it | |
1097 * to see it as an ESC, and then checks for the first parameter byte for the | |
1098 * required action. | |
1099 L05F3 leax <CoWrite,pcr point to parameter vector entry point | |
1100 ldb #$01 get parameter count (need 1 to determine code) | |
1101 stx <V.ParmVct,u save vector | |
1102 stb <V.ParmCnt,u save # param bytes needed before exec'ing vect. | |
1103 Do1E clrb no error | |
1104 rts return | |
1105 | |
1106 * Processing parameters | |
1107 * A=parameter byte from SCF | |
1108 * B=# parameter bytes left (not including one in A) | |
1109 * U=device mem ptr | |
1110 L0600 ldx <V.NxtPrm,u get ptr of where to put next param byte | |
1111 sta ,x+ put it there | |
1112 stx <V.NxtPrm,u update pointer | |
1113 decb decrement parameter count | |
1114 stb <V.ParmCnt,u update it | |
1115 bne Do1E if still more to get, exit without error | |
1116 * B=0, flag to say we are not current device | |
1117 * We have all parameter bytes we need at this point. | |
1118 ldx <D.CCMem get ptr to CC mem | |
1119 bsr L05C0 | |
1120 stu G.CurDvM,x | |
1121 ldx <V.PrmStrt,u reset next param ptr to start | |
1122 stx <V.NxtPrm,u | |
1123 ldb <V.WinType,u is this device using CoWin? | |
1124 beq L0624 yes, special processing for CoWin | |
1125 jsr [<V.ParmVct,u] go execute parameter handler | |
1126 bra L05B0 | |
1127 L0624 jsr [<V.ParmVct,u] | |
1128 bra L05B6 | |
1129 | |
1130 | |
1131 * GetStat | |
1132 * | |
1133 * Entry: | |
1134 * A = function code | |
1135 * Y = address of path descriptor | |
1136 * U = address of device memory area | |
1137 * | |
1138 * Exit: | |
1139 * CC = carry set on error | |
1140 * B = error code | |
1141 * | |
1142 GetStat cmpa #SS.EOF | |
1143 beq SSEOF | |
1144 ldx PD.RGS,y | |
1145 cmpa #SS.ComSt | |
1146 beq GSComSt | |
1147 cmpa #SS.Joy | |
1148 beq GSJoy | |
1149 cmpa #SS.Mouse | |
1150 lbeq GSMouse | |
1151 cmpa #SS.Ready | |
1152 beq GSReady | |
1153 cmpa #SS.KySns | |
1154 beq GSKySns | |
1155 cmpa #SS.Montr | |
1156 beq GSMontr | |
1157 ldb #$06 carry over to co-module | |
1158 lbra L0593 | |
1159 | |
1160 * SS.ComSt - get baud/parity info | |
1161 GSComSt lda V.TYPE,u get device type | |
1162 clrb clear parity, etc. | |
1163 std R$Y,x save it in register stack | |
1164 rts return | |
1165 | |
1166 GSReady ldb <V.EndPtr,u get input buffer end pointer | |
1167 cmpb <V.InpPtr,u anything there? | |
1168 beq NotReady nope, exit with error | |
1169 bhi L0660 higher? | |
1170 addb #$80 nope, add 128 to count | |
1171 L0660 subb <V.InpPtr,u calculate number of characters there | |
1172 stb R$B,x save it in register stack | |
1173 SSEOF clrb clear errors | |
1174 rts return | |
1175 NotReady comb set carry | |
1176 ldb #E$NotRdy get error code | |
1177 rts return | |
1178 | |
1179 * Return special key status | |
1180 * X = pointer to caller's register stack | |
1181 GSKySns ldy <D.CCMem get ptr to CC mem | |
1182 clrb clear key code | |
1183 cmpu <G.CurDev,y are we the active device? | |
1184 bne L0678 branch if not | |
1185 ldb <G.KySns,y get key codes | |
1186 L0678 stb R$A,x save to caller reg | |
1187 clrb clear errors | |
1188 rts return | |
1189 | |
1190 * GetStat: SS.Montr (get Monitor type) | |
1191 * X = pointer to caller's register stack | |
1192 GSMontr ldb >WGlobal+G.MonTyp get monitor type | |
1193 * tfr b,a put in A | |
1194 clra | |
1195 std R$X,x save in caller's X | |
1196 rts return | |
1197 | |
1198 * GetStat: SS.JOY (get joystick X/Y/button values) | |
1199 * X = pointer to caller's register stack | |
1200 GSJoy clrb default to no errors | |
1201 tfr x,y transfer caller's registers to Y | |
1202 ldx <D.CCMem get ptr to CC mem | |
1203 cmpu <G.CurDev,x are we the current active device? | |
1204 beq GetJoy if so, go read joysticks | |
1205 clra else D = 0 | |
1206 std R$X,y X pos = 0 | |
1207 std R$Y,y Y pos = 0 | |
1208 sta R$A,y no buttons held down | |
1209 rts return | |
1210 | |
1211 * Get button status first | |
1212 GetJoy ldx >WGlobal+G.JoyEnt | |
1213 pshs u save driver static | |
1214 ldu <D.CCMem get ptr to CC mem | |
1215 leau >G.JoyMem,u point to subroutine module's static mem | |
1216 jsr J$JyBtn,x call entry point to get button | |
1217 * Joysticks button states returned in B | |
1218 puls u restore driver static | |
1219 lda R$X+1,y left or right? | |
1220 beq L06AB branch if right joystick | |
1221 lsrb shift over so same range as if right joystick | |
1222 L06AB andb #$05 preserve button bits | |
1223 lsrb button 1 down? (shifts button 2 to bit 2 too) | |
1224 bcc L06B2 no, go on | |
1225 orb #$01 turn on button 1 | |
1226 L06B2 stb R$A,y save button status to caller | |
1227 * | |
1228 * Now get actual joystick values (note: IRQs still off) | |
1229 * | |
1230 pshs y save ptr to caller's regs | |
1231 lda R$X+1,y get switch to indicate left or right joystick | |
1232 inca now 1 or 2 | |
1233 ldy #$0000 force low res?? | |
1234 pshs u save driver static mem | |
1235 ldu <D.CCMem get ptr to CC mem | |
1236 ldx >WGlobal+G.JoyEnt get address of joystick sub module | |
1237 leau >G.JoyMem,u get ptr to sub module's static mem | |
1238 jsr J$JyXY,x call routine in sub module to get joy X/Y | |
1239 * X = joystick X pos, Y = joystick Y pos | |
1240 puls u restore driver static mem | |
1241 pshs y save joystick Y | |
1242 ldy $02,s get ptr to caller's regs | |
1243 stx R$X,y save joystick X in caller's X | |
1244 ldd #63 | |
1245 subd ,s++ | |
1246 std R$Y,y save joystick Y in caller's Y | |
1247 clrb cleary carry | |
1248 puls pc,y return | |
1249 | |
1250 * GetStat: SS.Mouse (get mouse info) | |
1251 * X = pointer to caller's register stack | |
1252 GSMouse pshs u,y,x | |
1253 ldx <D.CCMem get ptr to CC mem | |
1254 cmpu <G.CurDev,x is caller in current window? | |
1255 beq L06FA branch if so | |
1256 ldy ,s get ptr to caller's regs | |
1257 ldb #Pt.Siz size of packet | |
1258 L06EC clr ,-s make room on stack | |
1259 decb | |
1260 bne L06EC | |
1261 leax ,s point X to temp mouse buffer on stack | |
1262 bsr MovMsPkt | |
1263 leas <Pt.Siz,s clean up stack | |
1264 puls pc,u,y,x and return | |
1265 | |
1266 * here the caller is in the current window | |
1267 L06FA tst <G.KyMse,x mouse keyboard active? | |
1268 bne L071A branch if so | |
1269 lda <G.MSmpRV,x ready to sample? | |
1270 bne L071A no, return packet | |
1271 pshs u,y,x | |
1272 bsr L073B read external mouse | |
1273 puls u,y,x | |
1274 lda <G.AutoMs,x get automouse flag | |
1275 anda <G.MseMv,x has mouse moved? | |
1276 beq L071A no, return packet | |
1277 lda #$03 update auto-follow mouse sub-function call | |
1278 lbsr L05E7 call co-module to update mouse | |
1279 clr <G.MseMv,x flag that the mouse hasn't moved | |
1280 L071A lda #$01 'special' co-mod function code: move mouse packet? | |
1281 lbsr L05E7 | |
1282 leax <G.Mouse,x move X to point to mouse packet | |
1283 ldy ,s get register stack pointer | |
1284 bsr MovMsPkt move packet to caller | |
1285 puls pc,u,y,x | |
1286 | |
1287 * Move mouse packet to process | |
1288 * Y = ptr to caller's register stack | |
1289 MovMsPkt ldu R$X,y get destination pointer | |
1290 ldy <D.Proc get process descriptor pointer | |
1291 ldb P$Task,y get destination task number | |
1292 clra get source task number | |
1293 ldy #Pt.Siz get length of packet | |
1294 os9 F$Move move it to the process | |
1295 rts return | |
1296 | |
1297 L0739 ldx <D.CCMem | |
1298 L073B leax <G.Mouse,x move X to mouse packet | |
1299 clra clear MSB of mouse resolution | |
1300 ldb <Pt.Res,x get resolution (0 = lores, 1 = hires) | |
1301 tfr d,y move mouse res to Y | |
1302 lda Pt.Actv,x get mouse side | |
1303 pshs u,y,x,b,a preserve regs | |
1304 ldx >WGlobal+G.JoyEnt get ptr to mouse sub module | |
1305 ldu <D.CCMem get mem pointer | |
1306 leau >G.JoyMem,u and point to mouse sub module statics | |
1307 jsr J$MsXY,x get data | |
1308 pshs y,x | |
1309 ldx $06,s get ptr to mouse packet in CC mem | |
1310 puls b,a get X value into D | |
1311 leay <Pt.AcX,x point X to mouse X/Y in mouse packet | |
1312 bsr L0764 | |
1313 puls b,a get Y value into D | |
1314 bsr L0764 | |
1315 puls pc,u,y,x,b,a | |
1316 * X = Address of G.Mouse in D.CCMem | |
1317 L0764 cmpd ,y++ compare mouse's current X to Pt.AcX | |
1318 beq L0770 branch if same | |
1319 std -$02,y else store new X into Pt.AcX | |
1320 lda #$01 | |
1321 sta <(G.MseMv-G.Mouse),x update mouse moved flag | |
1322 L0770 rts | |
1323 | |
1324 SSTone ldx >WGlobal+G.SndEnt get address of sound sub module | |
1325 jmp S$SetStt,x go execute routine in sub module | |
1326 | |
1327 * Animate Palette? This obviously isn't implemented yet | |
1328 SSAnPal ldx >WGlobal+G.SndEnt | |
1329 jmp S$Term,x | |
1330 | |
1331 * SetStat | |
1332 * | |
1333 * Entry: | |
1334 * A = function code | |
1335 * Y = address of path descriptor | |
1336 * U = address of device memory area | |
1337 * | |
1338 * Exit: | |
1339 * CC = carry set on error | |
1340 * B = error code | |
1341 * | |
1342 SetStat ldx PD.RGS,y | |
1343 cmpa #SS.ComSt | |
1344 lbeq SSComSt | |
1345 cmpa #SS.Montr | |
1346 lbeq SSMontr | |
1347 cmpa #SS.KySns | |
1348 lbeq SSKySns | |
1349 cmpa #SS.Tone | |
1350 beq SSTone | |
1351 cmpa #SS.AnPal | |
1352 beq SSAnPal | |
1353 cmpa #SS.SSig | |
1354 beq SSSig | |
1355 cmpa #SS.MsSig | |
1356 beq SSMsSig | |
1357 cmpa #SS.Relea | |
1358 beq SSRelea | |
1359 cmpa #SS.Mouse | |
1360 beq SSMouse | |
1361 cmpa #SS.GIP | |
1362 lbeq SSGIP | |
1363 cmpa #SS.Open | |
1364 bne L07B5 | |
1365 SSOpen ldx PD.DEV,y get device table entry | |
1366 stx V.PORT,u save it as port address | |
1367 L07B5 ldb #$09 call setstt entry point in co-module | |
1368 lbra L0593 go do it | |
1369 | |
1370 * SS.SSig - send signal on data ready | |
1371 SSSig pshs cc save interrupt status | |
1372 * The next line doesn't exist in the NitrOS version | |
1373 * clr <V.SSigID,u | |
1374 lda <V.InpPtr,u get input buffer pointer | |
1375 suba <V.EndPtr,u get how many chars are there | |
1376 pshs a save it temporarily | |
1377 bsr L07EC get current process ID | |
1378 tst ,s+ anything in buffer? | |
1379 bne L07F7 yes, go send the signal | |
1380 std <V.SSigID,u save process ID & signal | |
1381 puls pc,cc restore interrupts & return | |
1382 | |
1383 * SS.MsSig - send signal on mouse button | |
1384 SSMsSig pshs cc save interrupt status | |
1385 * The next line doesn't exist in the NitrOS version | |
1386 * clr <V.MSigID,u | |
1387 bsr L07EC get process ID | |
1388 ldx <D.CCMem get ptr to CC mem | |
1389 cmpu <G.CurDev,x are we active device? | |
1390 bne L07E7 no, save ID & signal | |
1391 tst >G.MsSig,x has button been down? | |
1392 bne L07F3 yes, go send the signal | |
1393 L07E7 std <V.MSigID,u save ID & signal code | |
1394 puls pc,cc restore interrupts & return | |
1395 | |
1396 L07EC orcc #IntMasks disable interrupts | |
1397 lda PD.CPR,y get curr proc # | |
1398 ldb R$X+1,x get user signal code | |
1399 rts return | |
1400 | |
1401 L07F3 clr >G.MsSig,x clear mouse button down flag | |
1402 L07F7 puls cc restore interrupts | |
1403 os9 F$Send send the signal | |
1404 rts return | |
1405 | |
1406 * SS.Relea - release a path from SS.SSig | |
1407 SSRelea lda PD.CPR,y get curr proc # | |
1408 cmpa <V.SSigID,u same as keyboard? | |
1409 bne L0807 branch if not | |
1410 clr <V.SSigID,u clear process ID | |
1411 L0807 cmpa <V.MSigID,u same as mouse? | |
1412 bne L0871 no, return | |
1413 clr <V.MSigID,u else clear process ID | |
1414 rts return | |
1415 | |
1416 * SS.Mouse - set mouse sample rate and button timeout | |
1417 * | |
1418 * Entry: | |
1419 * R$X = mouse sample rate and timeout | |
1420 * MSB = mouse sample rate | |
1421 * LSB = mouse button timeout | |
1422 * R$Y = mouse auto-follow feature | |
1423 * MSB = don't care | |
1424 * LSB = auto-follow ($00 = OFF, else = ON) | |
1425 * | |
1426 * NOTE: Default mouse params @ $28,u are $0078 | |
1427 * It modifies the static mem variables (for caller's window) first, and | |
1428 * then modifies global memory only if we are the current active device. | |
1429 SSMouse ldd R$X,x get sample rate & timeout from caller | |
1430 cmpa #$FF sample rate 256? | |
1431 beq L0819 yes, can't have it so go on | |
1432 sta <V.MSmpl,u save new timeout | |
1433 L0819 cmpb #$FF timeout 256? | |
1434 beq L0820 yes, can't have it so go on | |
1435 stb <V.MTime,u save new timeout | |
1436 L0820 ldb R$Y+1,x get auto-follow flag | |
1437 stb <V.MAutoF,u save it was MS.Side wrong RG | |
1438 ldy <D.CCMem get ptr to CC mem | |
1439 cmpu <G.CurDev,y are we current device? | |
1440 bne L083D no, exit without error | |
1441 stb <G.AutoMs,y save auto-follow flag for this dev | |
1442 ldd <V.MSmpl,u get sample rate/timeout | |
1443 sta <G.MSmpRV,y save it (reset value) | |
1444 sta <G.MSmpRt,y save it (current value) | |
1445 stb <G.Mouse+Pt.ToTm,y save timeout too | |
1446 L083D clrb exit without error | |
1447 rts | |
1448 | |
1449 * SS.GIP | |
1450 SSGIP ldy <D.CCMem get ptr to CC mem | |
1451 cmpu <G.CurDev,y current window? | |
1452 bne L0866 branch if not | |
1453 ldd R$Y,x get caller's Y (key repeat info) | |
1454 cmpd #$FFFF unchanged? | |
1455 beq L0853 yes, don't change current key info | |
1456 std <G.KyDly,y else save key delay and speed info | |
1457 L0853 ldd R$X,x get mouse info | |
1458 cmpa #$01 set for hi res adapter? | |
1459 bgt L088F branch to error if greater | |
1460 sta <G.Mouse+Pt.Res,y save new resolution value | |
1461 * B = mouse port (1 = right, 2 = left) | |
1462 tstb side above legal value? | |
1463 beq L088F no, exit with error | |
1464 cmpb #$02 side below legal value? | |
1465 bgt L088F no, exit with error | |
1466 stb <G.Mouse+Pt.Actv,y save new side | |
1467 L0866 clrb clear errors | |
1468 rts and return | |
1469 | |
1470 * SS.KySns - setstat??? | |
1471 SSKySns ldd R$X,x get monitor type requested | |
1472 beq L086E below legal value? | |
1473 ldb #$FF no, exit with error | |
1474 L086E stb <V.KySnsFlg,u save new sense mode | |
1475 L0871 clrb clear errors | |
1476 rts return | |
1477 | |
1478 * SS.Montr - change monitor type | |
1479 SSMontr ldd R$X,x get monitor type requested | |
1480 cmpd #$0002 below legal value? | |
1481 bhi L088F no, exit with error | |
1482 lda <D.VIDMD get current GIME video mode register | |
1483 anda #$EF get rid of monochrome bit | |
1484 bitb #$02 mono requested? | |
1485 beq L0885 no, keep checking | |
1486 ora #$10 switch to monochrome | |
1487 L0885 sta <D.VIDMD update video mode register | |
1488 stb >WGlobal+G.MonTyp save new monitor type | |
1489 inc <V.ScrChg,u flag a screen change | |
1490 clrb clear errors | |
1491 rts return | |
1492 | |
1493 * Illegal argument error handler | |
1494 L088F comb set carry for error | |
1495 ldb #E$IllArg get illegal argument error code | |
1496 rts return with it | |
1497 | |
1498 * SS.ComSt - set baud/parity params | |
1499 SSComSt ldd R$Y,x get requested window type | |
1500 eora V.TYPE,u same type as now? | |
1501 anda #$80 trying to flip from window to VDG? | |
1502 bne L088F yes, error | |
1503 lda R$Y,x no, get requested window type again | |
1504 bsr FindCoMod go make sure co-module for new type exists | |
1505 lbcc L07B5 carry it over to co-module | |
1506 rts return | |
1507 | |
1937 | 1508 CoVDG fcs /CoVDG/ |
1933 | 1509 |
1510 * | |
1511 * Link to proper co-module | |
1937 | 1512 * Try CoVDG first |
1933 | 1513 * |
1514 * Entry: A = window type (If bit 7 is set, it's a window, else VDG screen) | |
1515 * | |
1516 FindCoMod | |
1517 sta V.TYPE,u save new type | |
1518 bmi FindWind if hi-bit if A is set, we're a window | |
1519 pshs u,y,a ..else VDG | |
1520 lda #$02 get code for VDG type window | |
1521 sta <V.WinType,u save it | |
1937 | 1522 leax <CoVDG,pcr point to CoVDG name |
1933 | 1523 bsr L08D4 link to it if it exists |
1524 puls pc,u,y,a restore regs & return | |
1525 | |
1526 CoWin fcs /CoWin/ | |
1527 CoGrf fcs /CoGrf/ ++ | |
1528 *CC3GfxInt fcs /CC3GfxInt/ ++ | |
1529 | |
1530 * | |
1531 * Try CoWin | |
1532 * | |
1533 FindWind pshs u,y preserve regs | |
1534 clra set window type | |
1535 sta <V.WinType,u | |
1536 leax <CoWin,pcr point to CoWin name | |
1537 lda #$80 get driver type code | |
1538 bsr L08D4 try and link it | |
1539 | |
1540 *++ | |
1541 bcc ok | |
2115
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1542 |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1543 * Bug fix by Boisy on 08/22/2007 - The three lines below were inserted to check to see |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1544 * the nature of the error that occurred fromfailing to link to CoWin/CoGrf. Since CoWin/CoGrf |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1545 * also load GrfDrv, an error other than E$MNF might arise. We expect an E$MNF if CoGrf is in |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1546 * place instead of CoWin, but any other error just gets blown away without the three lines below. |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1547 * Now, if any error other than E$MNF is returned from trying to link to CoWin, we don't bother trying |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1548 * to link to CoGrf... we just return the error as is. |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1549 cmpb #E$MNF compare the error to what we expect |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1550 orcc #Carry set the carry again (cmpb above clears it) |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1551 bne ok if the error in B is not E$MNF, just leave this routine |
9e49b536525f
Fixed the "crash" bug in the case where CoWin/CoGrf could not load or link grfdrv. This is now fixed.
boisy
parents:
2013
diff
changeset
|
1552 |
1933 | 1553 leax <CoGrf,pcr point to CoGrf name |
1554 lda #$80 | |
1555 bsr L08D4 | |
1556 *++ | |
1557 | |
1558 ok puls pc,u,y restore regs and return | |
1559 L08D2 clrb | |
1560 rts | |
1561 | |
1562 * | |
1563 * Check if co-module is in memory | |
1564 * | |
1565 L08D4 ldb <V.PrmStrt,u any parameter vector? | |
1566 bne L08D2 no, return | |
1567 pshs u save statics | |
1568 ldu <D.CCMem get ptr to CC mem | |
1569 bita <G.BCFFlg,u BCFFlg already linked? | |
1570 puls u restore statics | |
1571 bne L0900 yes, initialize co-module | |
1572 tsta Window type device? | |
1573 bpl L08E8 no, go on | |
1574 clra set co-module vector offset for window | |
1575 L08E8 pshs y,a preserve registers | |
1576 bsr L0905 try and link module | |
1577 bcc L08F0 we linked it, go on | |
1578 puls pc,y,a restore registers & return error | |
1579 | |
1580 L08F0 puls a restore vector offset | |
1581 ldx <D.CCMem get ptr to CC mem | |
1582 leax <G.CoTble,x point to vector offsets | |
1583 sty a,x store co-module entry vector | |
1584 puls y restore path descriptor pointer | |
1585 cmpa #$02 was it CoWin? | |
1586 bgt L08D2 no, return | |
1587 L0900 clrb | |
1588 lbra CallCo send it to co-module | |
1589 | |
1590 * | |
1591 * Link or load a co-module | |
1592 * | |
1593 L0905 ldd <D.Proc get current process descriptor pointer | |
1594 pshs u,x,b,a preserve it along with registers | |
1595 ldd <D.SysPrc get system process descriptor pointer | |
1596 std <D.Proc save it as current process | |
1597 lda #Systm+Objct get codes for link | |
1598 os9 F$Link link to it | |
1599 ldx $02,s get name pointer | |
1600 bcc L091B does module exist? | |
1601 ldu <D.SysPrc no, get system process descriptor pointer | |
1602 os9 F$Load load it | |
1603 L091B puls u,x,b,a restore regs | |
1604 std <D.Proc restore current process descriptor | |
1605 lbcs L05EB exit if error from load or link | |
1606 rts return | |
1607 | |
1608 emod | |
1609 eom equ * | |
1610 end |