annotate level2/modules/joydrv_6551L.asm @ 0:6641a883d6b0

Initial revision
author boisy
date Thu, 04 Apr 2002 16:34:12 +0000
parents
children 7a973074acbe
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 6551/Logitech 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 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
6 * Ed. Comments Who YY/MM/DD
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
7 * ------------------------------------------------------------------
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
8 * 6 L2 Upgrade distribution version
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
9
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
10 nam JoyDrv
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
11 ttl Joystick Driver for 6551/Logitech Mouse
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
12
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
13 * Disassembled 98/09/09 09:22:44 by Disasm v1.6 (C) 1988 by RML
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
14
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
15 ifp1
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
16 use defsfile
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
17 use l51.defs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
18 endc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
19
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
20 tylg set Systm+Objct
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
21 atrv set ReEnt+rev
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
22 rev set $01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
23 edition set 6
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
24
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
25 MPISlot set $00
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
26
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
27 mod eom,name,tylg,atrv,start,$FF68
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
28
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
29 name fcs /JoyDrv/
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
30 fcb edition
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
31
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
32 SlotSlct equ MPISlot
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
33
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34 start lbra Init
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
35 lbra Term
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 lbra SSMsBtn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
37 lbra SSMsXY
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38 lbra SSJoyBtn
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
39
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
40 SSJoyXY pshs x,b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
41 ldx #PIA0Base
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
42 lda <$23,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
43 ldb <$20,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
44 pshs b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
45 anda #$F7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
46 sta <$23,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
47 lda $01,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
48 ldb $03,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
49 pshs b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
50 andb #$F7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
51 lsr $04,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
52 bcs L0043
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
53 orb #$08
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
54 L0043 stb $03,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
55 lda ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
56 ora #$08
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
57 bsr L0065
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
58 std $06,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
59 lda ,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
60 anda #$F7
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
61 bsr L0065
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
62 std $04,s
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
63 puls b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
64 sta $01,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65 stb $03,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
66 puls b,a
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
67 stb <$20,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
68 sta <$23,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
69 puls pc,y,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
70 L0065 sta $01,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
71 lda #$7F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
72 ldb #$40
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
73 bra L0078
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
74 L006D lsrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 cmpb #$01
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
76 bhi L0078
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
77 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
78 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
79 tfr a,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
81 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
82 L0078 pshs b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
83 sta <$20,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 tst ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
85 bpl L0085
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
86 adda ,s+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
87 bra L006D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
88 L0085 suba ,s+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
89 bra L006D
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
90
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
91 IRQPckt equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
92 Pkt.Flip fcb Stat.Flp D.Poll flip byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
93 Pkt.Mask fcb Stat.Msk D.Poll mask byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
94 fcb $01 priority
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
95
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
96 Init clra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 clrb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98 sta Btn.Cntr,u set up Rx data sync, no button(s) pressed
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 std CrntXPos,u set up X position at left screen edge
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
100 ldd #HResMaxY*2
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101 std CrntYPos,u set up Y position at top screen edge
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
102 ldd M$Mem,pcr get base hardware address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
103 addd #StatReg status register address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
104 leax IRQPckt,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
105 leay IRQSvc,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
106 os9 F$IRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
107 bcs InitExit go report error...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
108 ldx M$Mem,pcr get base hardware address again
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
109 ldd #(TIC.RTS!Cmd.DTR)*256+(DB.8!Ctl.RClk!BR.01200) [D]=command:control
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
110 pshs cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
111 orcc #IntMasks disable IRQs while setting up hardware
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
112 sta PRstReg,x reset 6551
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
113 std CmdReg,x set command and control registers
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
114 lda >PIA1Base+3 get PIA CART* input control register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
115 anda #$FC clear PIA CART* control bits
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
116 sta >PIA1Base+3 disable PIA CART* FIRQs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
117 lda >PIA1Base+2 clear possible pending PIA CART* FIRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
118 lda #$01 GIME CART* IRQ enable
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
119 ora <D.IRQER mask in current GIME IRQ enables
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
120 sta <D.IRQER save GIME CART* IRQ enable shadow register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
121 sta >IrqEnR enable GIME CART* IRQs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
122 ldb DataReg,x *ensure old error,
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
123 ldb StatReg,x *Rx data, and
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
124 ldb DataReg,x *IRQ flags
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
125 ldb StatReg,x *are clear
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
126 andb Pkt.Mask,pcr IRQ bits still set?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
127 bne InitErr yes, go disable ACIA and return...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
128 lda SlotSlct,pcr get MPI slot select value
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
129 bmi InitExit no MPI slot select, go exit...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
130 sta >MPI.Slct set MPI slot select register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
131 puls pc,cc recover original regs, return...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
132
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
133 Term pshs cc save regs we alter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
134 orcc #IntMasks mask IRQs while disabling ACIA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
135 InitErr ldx M$Mem,pcr get base address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
136 lda #TIC.RTS!Cmd.RxIE!Cmd.DTR *disable all
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
137 sta CmdReg,x *ACIA IRQs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
138 puls cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
139 leax StatReg,x point to status register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
140 tfr x,d copy status register address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
141 ldx #$0000 remove IRQ table entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
142 leay IRQSvc,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
143 os9 F$IRQ
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
144 InitExit rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
145
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
146 SSJoyBtn ldb #$FF
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
147 ldx #PIA0Base
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
148 stb $02,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
149 ldb ,x
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
150 comb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
151 andb #$0F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
152 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
153
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
154 SSMsBtn pshs cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
155 orcc #IntMasks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
156 lda ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
157 tfr a,b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
158 andb #$C0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
159 bne L0120
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
160 bita #$20
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
161 beq L011A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
162 orb #$03
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 L011A bita #$10
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
164 beq L0120
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
165 orb #$0C
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
166 L0120 anda #$3F
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167 sta ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
168 puls pc,cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
169
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
170 SSMsXY ldd #$017E
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
171 pshs cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
172 orcc #IntMasks
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
173 ldx CrntXPos,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
174 subd CrntYPos,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
175 lsra
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
176 rorb
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
177 tfr d,y
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
178 puls pc,cc
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
179
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
180 ***
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
181 * Mouse IRQ service routine.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
182 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
183 * INPUT: A = flipped and masked device status byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
184 * U = mouse data area address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
185 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186 * OUTPUT: updated serial mouse data
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
187 * CC Carry clear
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
188 * D, X, Y, and U registers may be altered
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
189 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
190 * ERROR OUTPUT: none
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
191 IRQSvc ldx M$Mem,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192 bita #Stat.Err any error(s)?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
193 beq ChkRDRF no, go check Rx data
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
194 ldb DataReg,x read Rx data register to clear error flags
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 ClrRxCnt lda Btn.Cntr,u get current button status and Rx data counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
196 anda #^BC.RxCnt clear Rx data counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
197 ButnExit sta Btn.Cntr,u reset Rx mouse data counter to wait for sync...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
198 IRQExit clrb clear Carry to mark IRQ serviced
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
199 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
200
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
201 ChkRDRF bita #Stat.RxF Rx data?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
202 beq IRQExit no, but this branch should never be taken...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
203 ldb DataReg,x get Rx data
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
204 lda Btn.Cntr,u get button status and Rx counter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
205 anda #BC.RxCnt waiting for sync with mouse data?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
206 bne ChkOfst no, go check Rx offset...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
207 tfr b,a copy Rx data
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
208 anda #SyncMask clear button status bits
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
209 cmpa #SyncData is it *PROBABLY* the initial (sync) byte?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
210 bne IRQExit no, just ignore it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
211 comb invert button bits to match SS.Mouse format
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
212 lslb *move button
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
213 lslb *status into
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
214 lslb *bits 5-3
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 andb #BC.Butns clear everything but the button bits
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
216 incb set Rx counter to first XY position byte
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
217 pshs b
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
218 lda ,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
219 bita #$08
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
220 beq L017A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
221 bitb #$08
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
222 bne L017A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
223 lda #$C0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
224 ldx CrntXPos,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
225 cmpx #$0140
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 bcs L017A
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227 lsla
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 L017A anda #$C0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
229 ora ,s+
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
230 bra ButnExit go save new button status and Rx counter, exit...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 ChkOfst cmpa #PcktSize-1 last byte in mouse packet?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
232 bcs SaveData no, go save mouse data to Rx buffer...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
233 ldx #HResMaxY*2 get maximum Y position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
234 pshs x save it for CalcPos subroutine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
235 leax CrntYPos,u point to current Y position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
236 leay Buffer+1,u point to primary Y offset
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
237 bsr CalcPos go calculate & save mouse's new Y position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
238 ldb Buffer+2,u get mouse packet's secondary X offset
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
239 ldx #HResMaxX get maximum X position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
240 stx ,s save it for CalcPos subroutine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
241 leax CrntXPos,u point to current X position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
242 leay Buffer+0,u point to primary X offset
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
243 bsr CalcPos go calculate & save mouse's new X position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
244 leas 2,s clean up stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
245 bra ClrRxCnt go save button status and clear Rx counter, exit...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
246 SaveData stb a,u save XY position byte to mouse data Rx buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
247 inc Btn.Cntr,u point to next byte in Rx buffer
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
248 clrb clear Carry to mark IRQ serviced
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
249 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
250
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
251 CalcPos sex sign extend mouse packet's 2nd XY offset ([D] = -128 to +127)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
252 pshs d save it temporarily...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
253 ldb ,y get mouse packet's 1st XY offset
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
254 sex sign extend it ([D] = -128 to +127)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
255 addd ,s add mouse's 2nd XY offset
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
256 std ,s save XY offset total temporarily...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
257 bpl PosAdjst go de-sensitize positive "ballistic" XY offset...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
258 orb #%00000111 if -8<XYoffset<0, no "ballistic" response
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
259 addd #1 "fix" negative offset "ballistic" response
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
260 bra RShiftD go calculate "ballistic" offset...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
261 PosAdjst andb #%11111000 if 0<XYoffset<8, no "ballistic" response
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
262 RShiftD asra *calculate 50% of XY offset
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
263 rorb *for "ballistic" response
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
264 addd ,s++ add original XY offset total, clean up stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
265 addd ,x add mouse's current XY position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
266 bpl CheckPos zero or positive XY position, go check it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
267 clra *set minimum
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
268 clrb *XY position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
269 CheckPos cmpd 2,s past maximum XY position?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
270 bls SavePos no, go save it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
271 ldd 2,s get maximum XY position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
272 SavePos std ,x save new XY position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
273 rts
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
274
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
275 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
276 eom equ *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
277 end