annotate level2/modules/joydrv_6551M.asm @ 2011:484c5493599a

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