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