annotate level2/modules/joydrv_6551L.asm @ 1904:fd159d660df5

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