annotate level2/modules/joydrv_joy.asm @ 1948:7010c08050b7

Couldn't give yourself write permission to a file 'cause you didn't have write prmission, fixed.
author chrish
date Mon, 12 Dec 2005 03:13:04 +0000
parents 1e312b144f4d
children 65e3494fa1f3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
1 ********************************************************************
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
2 * JoyDrv - Joystick Driver for CoCo 3 Hi-Res Mouse
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
3 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
4 * $Id$
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
5 *
1263
205b4fbc08cd Fixed comments, revs to zero
boisy
parents: 0
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
205b4fbc08cd Fixed comments, revs to zero
boisy
parents: 0
diff changeset
7 * Comment
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 * ------------------------------------------------------------------
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
9 * 6 1998/10/09 Robert Gault
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
10 * Added annotations to the L2 Upgrade distribution version
1263
205b4fbc08cd Fixed comments, revs to zero
boisy
parents: 0
diff changeset
11 *
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
12 * 7 2003/08/28 Robert gault
1933
1e312b144f4d Major changes:
boisy
parents: 1288
diff changeset
13 * Contains routine for H6309 from VTIO
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 nam JoyDrv
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16 ttl Joystick Driver for CoCo 3 Hi-Res Mouse
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 * Disassembled 98/09/09 09:07:45 by Disasm v1.6 (C) 1988 by RML
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 ifp1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21 use defsfile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24 tylg set Systm+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 atrv set ReEnt+rev
1263
205b4fbc08cd Fixed comments, revs to zero
boisy
parents: 0
diff changeset
26 rev set $00
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
27 edition set 7
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 mod eom,name,tylg,atrv,start,size
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30 size equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
31
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 name fcs /JoyDrv/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
33 fcb edition
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35 start lbra Init setup for special button state & clear buttons
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 lbra Term clear button but don't change special flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 lbra SSMsBtn read and process button values
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 lbra SSMsXY read joystick values; with processing
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
39 lbra SSJoyBtn clear keyboard input and return raw button info
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
40
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41 SSJoyXY pshs y,x,b,a read joystick values
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 pshs x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43 ldx #PIA0Base point to PIA#1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44 lda <$23,x read sound enable state?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
45 ldb <$20,x read 6-bit DAC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
46 pshs b,a save current states
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47 anda #%11110111 clear sound enable
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48 sta <$23,x set switch
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 lda $01,x read MUX SEL#1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50 ldb $03,x read MUX SEL#2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
51 pshs b,a save current state
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52 orb #$08 set SEL#2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 lda $08,s read ?what?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54 anda #$02 keep only left or right joystick
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55 bne L0047 if left then don't
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 andb #%11110111 clear SEL#2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 L0047 stb $03,x enable SEL#2 value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58 leay <L0097,pcr point to high res routine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
59 ldb $0D,s flag for high/low res
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 bne L0054
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 leay >L010F,pcr point to low res routine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62 L0054 lda ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
63 ora #$08 set MUX SEL#1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64 jsr ,y read pot
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65 tst $0D,s here the same byte seems to be used for x/y flag??
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66 beq L0060
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67 bsr L00DB convert from width to height value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 L0060 std $06,s return joystick value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 lda ,s now read the other direction
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70 anda #$F7 flip the MUX SEL#1 bit
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 jsr ,y read the second pot
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 std $04,s save the other value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73 puls b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 sta $01,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 stb $03,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 puls b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 stb <$20,x reset the DAC and sound selector
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78 sta <$23,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 puls y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 lda ,s flag for double button?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 cmpa #$01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 bne L0094
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 ldb #$80 minimum flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 lda $05,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 bne L008B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 cmpx #32 minimum joystick value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 bcc L0092
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 L008B cmpx #320 maximum joystick value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 bcc L0092 if less than don't change flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90 ldb #$C0 maximum flag
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91 L0092 stb ,u save max/min flag value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 L0094 leas $06,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94 L0097 pshs cc high res routine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95 sta $01,x select x/y pot
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 lda #$FF full DAC value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 sta <$20,x store in DAC to charge capacitor
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
98 IFNE H6309
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
99 lda #$80
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
100 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101 lda #$5A timing loop; wait for voltage to settle
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
102 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
103 L00A2 deca
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
104 bne L00A2 wait
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
105 IFNE H6309
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
106 ldd #$2F0
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
107 lde #2
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
108 ELSE
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
109 ldd #$329
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
110 pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111 lda #$02
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
112 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 orcc #IntMasks kill interrupts
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
114 IFNE H6309
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
115 ste <$20,x
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
116 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117 sta <$20,x clear DAC; mask RS-232; start cap. discharge
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
118 ENDC
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
119 L00B1 equ *
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
120 IFNE H6309
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
121 lde ,x
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
122 ELSE
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
123 lda ,x test comparator
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
124 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
125 bmi L00C0
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
126 IFNE H6309
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
127 decd
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
128 ELSE
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
129 decb counter
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
130 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
131 bne L00B1 loop until state change
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
132 IFNE H6309
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
133 ldd #MaxRows-1 Too big, force to highest possible coord
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
134 puls cc,pc
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
135 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
136 dec ,s 3 -> 0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 bpl L00B1 loop again
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 puls a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 bra L00D6 branch to maximum value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 L00C0 puls a
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
141 ENDC
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
142 IFNE H6309
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
143 L00C0 equ *
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
144 ENDC
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
145 decb
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
146 IFNE H6309
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
147 ldw #MaxRows Max coord
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
148 subr d,w Subtract the timing ramp value we got
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
149 bhs L0A11 If didn't wrap, we're fine
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
150 clrd If went negative, force to 0 coord
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
151 puls cc,pc Turn interrupts back on & return
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
152 L0A11 tfr w,d Move to proper exit register for now
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
153 cmpd #MaxRows-1 Past maximum X coordinate?
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
154 blo L0A1A No, leave it alone
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
155 ldd #MaxRows-1 Don't let it get past end of screen
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
156 L0A1A puls pc,cc
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
157 ELSE
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158 pshs b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
159 ldd #640
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
160 subd ,s++ convert from 640 -> 0 to 0 -> 640
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 bcc L00D0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162 clra minimum value is $00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 puls pc,cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 L00D0 cmpd #639
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
166 bcs L00D9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167 L00D6 ldd #639 maximum value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
168 L00D9 puls pc,cc
1288
adad42855d76 Robert Gault's 6309/6809 merged changes
boisy
parents: 1263
diff changeset
169 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
170 * This routine converts a pot value from width (640) to height (192) to match
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171 * possible screen values; ie. value divided by 3.33
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 L00DB pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 lda #$09
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
174 pshs a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
175 lda #$03
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
176 mul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
177 pshs b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178 lda $03,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179 ldb #$03
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180 mul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
181 exg b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
182 addd ,s++
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
183 L00EF clr $01,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
184 cmpa #$0A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
185 bcs L00F9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186 inc $01,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187 suba #$0A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
188 L00F9 lsr $01,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
189 rolb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
190 rola
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
191 dec ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192 bne L00EF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
193 cmpb #$BF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
194 beq L010B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 cmpa #$0A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
196 bcs L010B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
197 addb #$01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 L010B clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 leas $02,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
201 * Low res binary tree search for joystick value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
202 L010F sta $01,x set MUX SEL#1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
203 lda #$7F DAC value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
204 ldb #$40
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
205 bra L0122
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
206 L0117 lsrb reset DAC offset value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
207 cmpb #$01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
208 bhi L0122
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
209 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
210 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
211 tfr a,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
212 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
213 rts return with voltage
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
214 L0122 pshs b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 sta <$20,x set DAC
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
216 tst ,x test comparator
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
217 bpl L012F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
218 adda ,s+ adjust binary tree search
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
219 bra L0117
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
220 L012F suba ,s+ adjust binary tree search
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
221 bra L0117
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
222
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
223 SSMsXY leay ,y get flag??
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
224 lbne SSJoyXY go read joystick pots
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225 lbsr SSJoyXY go read joystick pots and then convert values
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 tfr x,d multiply regX by 10 and regY by 3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227 lda #$0A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 mul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
229 tfr d,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
230 cmpx #630
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 bcs L014B
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
232 ldx #634 maximum limit on regX
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
233 * may be an error and could be 639
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
234 L014B tfr y,d
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
235 lda #$03
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
236 mul
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
237 tfr d,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
238 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
240 Init ldb #$80
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
241 stb ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
242
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
243 Term clr $01,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
244 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
245
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
246 SSJoyBtn ldx #PIA0Base PIA#1 base address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
247 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
248 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
249 stb $02,x clear PIA#1 key strobe lines
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
250 ldb ,x read data lines
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
251 comb only buttons and comparator valid
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
252 andb #$0F only buttons; 0=off 1=on
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
253 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
254
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
255 SSMsBtn bsr SSJoyBtn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
256 tfr b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
257 anda #%11111010 regA=left buttons; should be $0A not $FA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
258 pshs a save left button values
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
259 andb #$05 regB=right buttons
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
260 orb $01,u ORB with previous state??
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
261 leax <L0187,pcr point to sequential switch table possibilities
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
262 lda b,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
263 anda #%00001010 keep only left values
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
264 sta $01,u save for change test
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
265 ldb b,x repeat
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266 andb #%10000101 keep flag and right values
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
267 bpl L0184
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
268 ldb ,u previous min/max state
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
269 L0184 orb ,s+ ORB with current left values and pop stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
271 L0187 fcb $00,$03,$00,$03,$08,$06,$02,$06,$80,$02,$00,$02,$08,$06,$0a,$06
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
272
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
273 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
274 eom equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
275 end
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
276