annotate level2/modules/keydrv_cc3.asm @ 1938:14e43c3ec661

Reset editions
author boisy
date Sat, 26 Nov 2005 22:07:06 +0000
parents 1e312b144f4d
children b8c7b7fbf3c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
1 ********************************************************************
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
2 * KeyDrv - Keyboard Driver for CoCo 3
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
3 *
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
4 * $Id$
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
5 *
1263
205b4fbc08cd Fixed comments, revs to zero
boisy
parents: 1262
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
205b4fbc08cd Fixed comments, revs to zero
boisy
parents: 1262
diff changeset
7 * Comment
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
1263
205b4fbc08cd Fixed comments, revs to zero
boisy
parents: 1262
diff changeset
9 * 4 1998/10/10 Robert Gault
205b4fbc08cd Fixed comments, revs to zero
boisy
parents: 1262
diff changeset
10 * L2 Upgrade distribution version with annotations by Robert Gault.
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
11
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
12 nam KeyDrv
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
13 ttl Keyboard Driver for CoCo 3
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
14
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
15 * Disassembled 98/09/09 09:02:10 by Disasm v1.6 (C) 1988 by RML
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
16
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
17 ifp1
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
18 use defsfile
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
19 ENDC
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
20
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
21 tylg set Systm+Objct
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
22 atrv set ReEnt+rev
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
23 rev set $00
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
24 edition equ 4
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
25
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
26 mod eom,name,tylg,atrv,entry,size
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
27 size equ .
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
28
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
29 name fcs /KeyDrv/
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
30 fcb edition
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
31
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
32 entry equ *
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
33
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
34 * Init - Initialize keyboard
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
35 lbra Init
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
36
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
37 * Term - Terminate keyboard
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
38 lbra Term
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
39
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
40 * Function - Test for function keys
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
41 lbra FuncKeys
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
42
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
43 * Read - read keys if pressed
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
44 * Exit: A = key pressed
1933
1e312b144f4d Major changes:
boisy
parents: 1592
diff changeset
45 ReadKys ldu <D.CCMem Get VTIO global memory into U
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
46 ldx #PIA0Base base address of PIA #0
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
47 ldb #$FF
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
48 stb $02,x clear all row strobes
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
49 ldb ,x read Joystick buttons
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
50 comb invert bits so 1=pressed
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
51 andb #%00001111 keep only buttons
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
52 bne L0059 branch if button pushed; error routine
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
53 clr $02,x enable all strobe lines
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
54 lda ,x read PIA #0
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
55 coma
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
56 * Check to see if ANY key is down
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
57 anda #%01111111 mask only the joystick comparator
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
58 beq NoKey branch if no keys pressed
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
59 * Here, a key is down on the keyboard
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
60 pshs dp save our DP
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
61 tfr u,d move statics ptr to D
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
62 tfr a,dp set DP to the address in regU
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
63 bsr EvalMatrix evaluate the found key matrix
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
64 puls dp return to system DP
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
65 bpl L005B valid key
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
66 NoKey clra regA would have been the found key
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
67 ldb <G.CapLok,u CapsLock/SysRq key down flag
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
68 bne L0056 branch if down
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
69 clr <G.KTblLC,u Key table entry# last checked (1-3)
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
70 IFNE H6309
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
71 comd
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
72 ELSE
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
73 coma
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
74 comb
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
75 ENDC
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
76 sta <G.LKeyCd,u last keyboard code
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
77 sta <G.2Key1,u 2nd key table storage; $FF=none
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
78 std <G.2Key2,u format (Row/Column)
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
79 L0056 clr <G.CapLok,u see above
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
80 L0059 ldb #$FF
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
81 L005B rts
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
82
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
83
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
84 * Evaluates the keyboard matrix for a key
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
85 EvalMatrix
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
86 ldx #PIA0Base base value of PIA #0
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
87 IFNE H6309
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
88 clrd
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
89 ELSE
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
90 clra
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
91 clrb
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
92 ENDC
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
93 std <G.ShftDn shift/CTRL flag; 0=NO $FF=YES
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
94 std <G.KeyFlg PIA bits/ALT flag
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
95 * %00000111-Column # (Output, 0-7)
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
96 * %00111000-Row # (Input, 0-6)
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
97 IFNE H6309
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
98 comd set D to $FFFF
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
99 ELSE
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
100 coma
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
101 comb set primary key table
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
102 ENDC
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
103 std <G.Key1 key 1&2 flags $FF=none
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
104 sta <G.Key3 key 3 "
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
105 deca ie. lda #%11111110
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
106 sta $02,x strobe one column
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
107 L006E lda ,x read PIA #0 row states
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
108 coma invert bits so 1=key pressed
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
109 anda #$7F keep only keys, bit 0=off 1=on
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
110 beq L0082 no keys pressed, try next column
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
111 ldb #$FF preset counter to -1
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
112 L0077 incb
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
113 lsra bit test regA
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
114 bcc L007E no key so branch
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
115 lbsr L010E convert column/row to matrix value and store it
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
116 L007E cmpb #$06 max counter
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
117 blo L0077 loop if more bits to test
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
118 L0082 inc <G.KeyFlg counter; used here for column
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
119 orcc #Carry bit marker; disable strobe
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
120 rol $02,x shift to next column
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
121 bcs L006E not finished with columns so loop
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
122 lbsr L0166 simultaneous check; recover key matrix value
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
123 bmi L00F5 invalid so go
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
124 cmpa <G.LKeyCd last keyboard code
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
125 bne L0095
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
126 inc <G.KySame same key flag ?counter?
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
127 L0095 sta <G.LKeyCd setup for last key pressed
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
128 beq L00B5 if @ key, use lookup table
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
129 suba #$1A the key value (matrix) of Z
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
130 bhi L00B5 not a letter so go
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
131 adda #$1A restore regA
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
132 ldb <G.CntlDn CTRL flag
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
133 bne L00E0 CTRL is down so go
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
134 adda #$40 convert to ASCII value; all caps
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
135 ldb <G.ShftDn shift key flag
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
136 ldy <G.CurDev get current device static memory pointer
1415
76137b27060d cc3io.asm: fixed issue with keyboard mouse being reset when CLEARing, still
boisy
parents: 1360
diff changeset
137 eorb <V.ULCase,y caps lock and keyboard mouse flags
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
138 andb #CapsLck test caps flag
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
139 bne L00E0 not shifted so go
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
140 adda #$20 convert to ASCII lower case
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
141 bra L00E0
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
142 * not a letter key, use the special keycode lookup table at L01DC.
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
143 * Entry: regA = table index (matrix scancode-26)
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
144 L00B5 ldb #$03 three entries per key (normal,shift,ctrl)
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
145 mul convert index to table offset
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
146 lda <G.ShftDn shift key flag
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
147 beq L00BF not shifted so go
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
148 incb adjust offset for SHIFTed entry
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
149 bra L00C5
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
150 L00BF lda <G.CntlDn CTRL flag
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
151 beq L00C5 adjust offset for CONTROL entry
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
152 addb #$02
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
153 L00C5 ldx <G.CurDev point X to device's static memory
1592
ad9f45622a19 comment updates
boisy
parents: 1415
diff changeset
154 lda <V.KySnsFlg,x key sense flag
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
155 beq L00D0 not set so go
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
156 cmpb #$11 spacebar
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
157 ble L00F3 must be an arrow so go
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
158 L00D0 cmpb #$4B ALT key? (was cmpb #$4C)
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
159 blt L00D8 not ALT, CTRL, F1, F2, or SHIFT so go
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
160 inc <G.AltDwn flag special keys (ALT,CTRL)
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
161 subb #$06 and adjust offset to skip them
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
162 L00D8 leax >L01DC,pcr decode table
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
163 lda b,x
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
164 bmi L00F6 if regA = $81 - $84, special key
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
165 * several entries to this routine from any key press; regA is already ASCII
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
166 L00E0 ldb <G.AltDwn was ALT flagged?
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
167 beq L00F0 no so go
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
168 cmpa #$3F ?
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
169 bls L00EE # or code
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
170 cmpa #$5B [
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
171 bhs L00EE capital letter so go
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
172 ora #$20 convert to lower case
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
173 L00EE ora #$80 set for ALT characters
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
174 L00F0 andcc #^Negative not negative
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
175 rts
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
176 L00F3 orcc #Negative set negative
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
177 L00F5 rts
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
178 * Flag that a special key was hit
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
179 L00F6 inc <G.CapLok caps lock/SysRq
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
180 inc <G.Clear one shot caps lock/SysRq
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
181 bra L00F0
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
182 * Calculate arrow keys for key sense byte
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
183 L00FC pshs b,a convert column into power of 2
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
184 clrb
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
185 orcc #Carry
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
186 inca
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
187 L0102 rolb
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
188 deca
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
189 bne L0102
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
190 * bra L0108 WHY IS THIS HERE??
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
191 L0108 orb <G.KySns previous value of column
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
192 stb <G.KySns
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
193 puls pc,b,a
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
194 * Check special keys (Shift, Cntrl, Alt)
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
195 L010E pshs b,a
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
196 cmpb #$03 is it row 3?
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
197 bne L011C
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
198 lda <G.KeyFlg get column #
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
199 cmpa #$03 is it column 3?; ie up arrow
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
200 blt L011C if lt must be a letter
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
201 bsr L00FC its a non letter so bsr
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
202 L011C lslb B*8 8 keys per row
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
203 lslb
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
204 lslb
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
205 addb <G.KeyFlg add in the column #
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
206 cmpb #$33 ALT
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
207 bne L012B
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
208 inc <G.AltDwn ALT down flag
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
209 ldb #$04
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
210 bra L0108
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
211 L012B cmpb #$34 CTRL
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
212 bne L0135
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
213 inc <G.CntlDn CTRL down flag
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
214 ldb #$02
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
215 bra L0108
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
216 L0135 cmpb #$37 SHIFT key
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
217 bne L013F
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
218 com <G.ShftDn SHIFT down flag
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
219 ldb #$01
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
220 bra L0108
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
221 * check how many key (1-3) are currently being pressed
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
222 L013F pshs x
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
223 leax <$2D,u 1st key table
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
224 bsr L014A
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
225 puls x
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
226 puls pc,b,a
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
227 L014A pshs a
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
228 lda ,x
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
229 bpl L0156
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
230 stb ,x
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
231 ldb #$01
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
232 puls pc,a
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
233 L0156 lda $01,x
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
234 bpl L0160
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
235 stb $01,x
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
236 ldb #$02
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
237 puls pc,a
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
238 L0160 stb $02,x
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
239 ldb #$03
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
240 puls pc,a
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
241 * simultaneous key test
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
242 L0166 pshs y,x,b
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
243 ldb <G.KTblLC key table entry #
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
244 beq L019D
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
245 leax <$2A,u point to 2nd key table
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
246 pshs b
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
247 L0171 leay <$2D,u 1st key table
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
248 ldb #$03
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
249 lda ,x get key #1
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
250 bmi L018F go if invalid? (no key)
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
251 L017A cmpa ,y is it a match?
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
252 bne L0184 go if not a matched key
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
253 clr ,y
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
254 com ,y set value to $FF
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
255 bra L018F
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
256 L0184 leay $01,y
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
257 decb
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
258 bne L017A
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
259 lda #$FF
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
260 sta ,x
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
261 dec <G.KTblLC key table entry#
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
262 L018F leax $01,x
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
263 dec ,s column counter
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
264 bne L0171
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
265 leas $01,s
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
266 ldb <G.KTblLC key table entry (can test for 3 simul keys)
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
267 beq L019D
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
268 bsr L01C4
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
269 L019D leax <$2D,u 1st key table
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
270 lda #$03
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
271 L01A2 ldb ,x+
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
272 bpl L01B5
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
273 deca
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
274 bne L01A2
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
275 ldb <G.KTblLC key table entry (can test for 3 simul keys)
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
276 beq L01C0
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
277 decb
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
278 leax <$2A,u 2nd key table
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
279 lda b,x
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
280 bra L01BE
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
281 L01B5 tfr b,a
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
282 leax <$2A,u 2nd key table
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
283 bsr L014A
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
284 stb <G.KTblLC
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
285 L01BE puls pc,y,x,b
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
286 L01C0 orcc #Negative flag negative
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
287 puls pc,y,x,b
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
288 * Sort 3 byte packet @ G.2Key1 according to sign of each byte
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
289 * so that positive #'s are at beginning & negative #'s at end
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
290 L01C4 leax <$2A,u 2nd key table
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
291 bsr L01CF sort bytes 1 & 2
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
292 leax $01,x
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
293 bsr L01CF sort bytes 2 & 3
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
294 leax -$01,x sort 1 & 2 again (fall thru for third pass)
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
295 L01CF ldb ,x get current byte
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
296 bpl L01DB positive - no swap
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
297 lda $01,x get next byte
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
298 bmi L01DB negative - no swap
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
299 std ,x swap the bytes
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
300 L01DB rts
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
301
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
302 * Special Key Codes Table : 3 entries per key - Normal, Shift, Control
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
303 * They are in COCO keyboard scan matrix order; the alphabetic and meta
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
304 * control keys are handled elsewhere. See INSIDE OS9 LEVEL II p.4-1-7
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
305 L01DC fcb $40,$60,$00 '@,'`,null
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
306 fcb $0c,$1c,$13 UP ARROW: FF, FS,DC3
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
307 fcb $0a,$1a,$12 DOWN ARROW: LF,SUB,DC2
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
308 fcb $08,$18,$10 LEFT ARROW: BS,CAN,DLE
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
309 fcb $09,$19,$11 RIGHT ARROW: HT, EM,DC1
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
310 fcb $20,$20,$20 SPACEBAR
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
311 fcb $30,$30,$81 '0,'0,$81 (caps lock toggle)
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
312 fcb $31,$21,$7c '1,'!,'|
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
313 fcb $32,$22,$00 '2,'",null
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
314 fcb $33,$23,$7e '3,'#,'~
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
315 fcb $34,$24,$1d '4,'$,GS (was null)
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
316 fcb $35,$25,$1e '5,'%,RS (was null)
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
317 fcb $36,$26,$1f '6,'&,US (was null)
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
318 fcb $37,$27,$5e '7,'','^
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
319 fcb $38,$28,$5b '8,'(,'[
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
320 fcb $39,$29,$5d '9,'),']
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
321 fcb $3a,$2a,$00 ':,'*,null
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
322 fcb $3b,$2b,$7f ';,'+,DEL
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
323 fcb $2c,$3c,$7b ',,'<,'{
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
324 fcb $2d,$3d,$5f '-,'=,'_
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
325 fcb $2e,$3e,$7d '.,'>,'}
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
326 fcb $2f,$3f,$5c '/,'?,'\
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
327 fcb $0d,$0d,$0d ENTER key
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
328 fcb $82,$83,$84 CLEAR key (NextWin, PrevWin, KbdMouse toggle)
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
329 fcb $05,$03,$1b BREAK key (ENQ,ETX,ESC)
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
330 fcb $31,$33,$35 F1 key (converts to $B1,$B3,$B5)
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
331 fcb $32,$34,$36 F2 key (converts to $B2,$B4,$B6)
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
332
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
333 *L01DC fdb $4060,$000c,$1c13,$0a1a,$1208,$1810,$0919,$1120
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
334 * fdb $2020,$3030,$8131,$217c,$3222,$0033,$237e,$3424
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
335 * fdb $0035,$2500,$3626,$0037,$275e,$3828,$5b39,$295d
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
336 * fdb $3a2a,$003b,$2b7f,$2c3c,$7b2d,$3d5f,$2e3e,$7d2f
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
337 * fdb $3f5c,$0d0d,$0d82,$8384,$0503,$1b31,$3335,$3234
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
338 * fcb $36
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
339
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
340 * Init and Term do nothing for this CoCo keyboard subroutine module
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
341 Init
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
342 Term clrb
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
343 rts
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
344
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
345 * This entry point tests for the F1/F2 function keys on a CoCo 3
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
346 * keyboard.
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
347 * Exit: A = Function keys pressed (Bit 0 = F1, Bit 2 = F2)
1933
1e312b144f4d Major changes:
boisy
parents: 1592
diff changeset
348 FuncKeys ldu <D.CCMem get VTIO global mem pointer into U
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
349 ldx #PIA0Base get address of PIA #0
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
350 clra clear A
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
351 ldb #%11011111 strobe column #6 of PIA #0
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
352 stb $02,x
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
353 IFNE H6309
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
354 tim #%01000000,0,x F1 down?
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
355 ELSE
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
356 ldb ,x read PIA #0
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
357 bitb #%01000000 test for F1 function key
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
358 ENDC
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
359 bne CheckF2 branch if set (key not down)
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
360 inca flag F1 as down
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
361 CheckF2 ldb #%10111111 strobe column #7 PIA #0
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
362 stb $02,x
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
363 IFNE H6309
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
364 tim #%01000000,0,x F2 down?
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
365 ELSE
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
366 ldb ,x read PIA #0
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
367 bitb #%01000000 test for F2 function key
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
368 ENDC
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
369 bne L024C
1360
146dfa918a9c Added comments
boisy
parents: 1338
diff changeset
370 ora #$04 flag F2 as down
1327
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
371 L024C rts
5dd56f2f45b4 Cleaned up source
boisy
parents: 1263
diff changeset
372
1338
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
373 emod
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
374 eom equ *
b3caa1b456ed Additional comments and some changes by the Rodney man!
boisy
parents: 1328
diff changeset
375 end