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