annotate level2/modules/joydrv_6551L.asm @ 2926:53961f90b9dd

d64/makefile: Stop building if error in subdirectory build
author Tormod Volden <debian.tormod@gmail.com>
date Sat, 18 Jan 2014 09:54:17 +0100
parents 28ed72477814
children
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.
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
14
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
15 * GH 08/06/2008 gleaned from a newsgroup msg found by google
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
16 *---------------------------------------------
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
17 *> Hmm, let me guess: the terminal used a 6551 ACIA.
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
18 *
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
19 * Possibly so, but not necessarily. Seems there are terminals out there
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
20 * that require DCD/DSR/strange signals for receiving/transmitting. Choose
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
21 * any combination you like.
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
22 *
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
23 * Now, the ACIA 6551 is an especially braindead beast. It requires both
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
24 * DCD and DSR, and pulling CTS low for flow control will make it stop
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
25 * sending immediately, without finishing the character, resulting in a
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
26 * junked character. (Not all versions of the chip have this bug. Most do.)
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
27 * The Archimedes people who were struck with the 6551 usually wired DCD
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
28 * and CTS to high, DSR to modem CTS, RI to modem DCD.
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
29 *----------------------------------------------
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
30 * FWIW, the mouse outputs a packet of un-determined length when
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
31 * it is enabled, no motion needed to trigger, just turn it on
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
32 * Since the mouse is port powered, enabling its power could
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
33 * cause this I presume.
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
34 * GH 21/06/08 my mouse is fixed at 3 bytes
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
35 * GH see comments scattered through the code
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
36 * none of which will be precious in final
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
37 * version
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
38 * GH - 21/12/09 version 11 (B) moving some code to shrink, rechecking
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
39 * GH - 18/12/09 version A - trying to fix button locations in packet
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
40 * GH - 30/06/2008 version 8
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
41 * GH - 08/08/2008 version 7
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
42 * Re-wrote to rearrange order of init see
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
43 * comments scattered through the code
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
44 * GH - 01/07/2008 version 9
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
45 * added code to function with a real M$ 3 button mouse
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
46 * now defaults to M$ empty packet for Center button down event
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
47 * but detects 4th byte from a Logitek mouse & switches modes
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
48 * till next reboot.
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
49 * Also no 6309 optimizations yet. Version A maybe? Not yet.
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
50
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
51 * damn this editor, it lets me open a file, do an hours worth of
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
52 * hacking on a file I don't own, but the sumbitch doesn't tell
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
53 * me until I go to save an hours work! So I have to re-invent
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
54 * this wheel every damned time.
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
55
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
56 * Now we start on version 13
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
57 * GH 2012/11/01 trying to make this work again, it died with
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
58 * the conversion to a mercurial repo on srcfrg.
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
59
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
60 * one problem has been the narrow list format, Boisy advises:
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
61 opt w132
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
62 nam JoyDrv
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
63 ttl Joystick Driver for 6551/Logitech or M$ Mouse
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
64
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
65 * Disassembled 98/09/09 09:22:44 by Disasm v1.6 (C) 1988 by RML
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
66
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
67 ifp1
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
68 use defsfile
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
69 use l51.defs
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
70 endc
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
71 * l51.defs - something else to check against google et all
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
72 * l51.defs has been modified, this needs the new version
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
73 * set this to get some debugging and a lockup in the boot trace
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
74 DEBUG = 0
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
75 tylg set Systm+Objct
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
76 atrv set ReEnt+rev
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
77 rev set $01
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
78 edition set 13
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
79 * set this to where your rs-232 pack is plugged in
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
80 MPISlot set $00 front slot for mine
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
81 * the $FF6C is the mouses port address, change to suit your system.
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
82 mod eom,name,tylg,atrv,start,$FF6C
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
83
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
84 name fcs /JoyDrv/
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
85 fcb edition
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
86
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
87 SlotSlct fcb MPISlot
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
88
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
89 start lbra Init
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
90 lbra Term
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
91 lbra SSMsBtn
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
92 lbra SSMsXY
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
93 lbra SSJoyBtn
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
94
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
95 * This code is not being used as we have SSMsXY, but save it so I
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
96 * don't have to reinvent this wheel later but no clue why
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
97 * so it will die in next Edition 14 if not sooner. GH.
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
98 *SSJoyXY pshs x,b,a
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
99 * ldx #PIA0Base
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
100 * lda <$23,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
101 * ldb <$20,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
102 * pshs b,a
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
103 * anda #$F7
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
104 * sta <$23,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
105 * lda $01,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
106 * ldb $03,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
107 * pshs b,a
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
108 * andb #$F7
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
109 * lsr $04,s
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
110 * bcs L0043
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
111 * orb #$08
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
112 *L0043 stb $03,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
113 * lda ,s
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
114 * ora #$08
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
115 * bsr L0065
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
116 * std $06,s
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
117 * lda ,s
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
118 * anda #$F7
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
119 * bsr L0065
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
120 * std $04,s
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
121 * puls b,a
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
122 * sta $01,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
123 * stb $03,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
124 * puls b,a
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
125 * stb <$20,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
126 * sta <$23,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
127 * puls pc,y,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
128 *L0065 sta $01,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
129 * lda #$7F
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
130 * ldb #$40
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
131 * bra L0078
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
132 *L006D lsrb
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
133 * cmpb #$01
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
134 * bhi L0078
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
135 * lsra
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
136 * lsra
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
137 * tfr a,b
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
138 * clra
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
139 * rts
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
140 *L0078 pshs b
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
141 * sta <$20,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
142 * tst ,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
143 * bpl L0085
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
144 * adda ,s+
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
145 * bra L006D
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
146 *L0085 suba ,s+
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
147 * bra L006D
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
148
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
149 IRQPckt equ *
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
150 Pkt.Flip fcb Stat.Flp D.Poll flip byte=$00
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
151 Pkt.Mask fcb Stat.RxF is correct
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
152 fcb $01 priority=low, mouse is pretty slow
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
153
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
154 ***
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
155 * JoyDrv Initialization.
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 * INPUT: U = JoyDrv data area address (8 bytes)
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
158 *
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
159 * OUTPUT: IRQ service entry installed
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
160 * D, X, and U registers may be altered
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
161 *
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
162 * ERROR OUTPUT: CC = Carry set
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
163 * B = error code
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
164 * first, suspend all interrupts
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
165 Init pshs cc save regs we alter, stack -1
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
166 orcc #IntMasks mask IRQs while disabling ACIA
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
167 bsr InitPIAs stack still -1
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
168 bsr InitGIME stack still -1
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
169 * we should see a bunch of stuff here, ending in 'D'
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
170 lbsr ClrACIA reset, clear trash data in ACIA, stack -1 on rtn
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
171 bcc SetBuf which will also install IRQSvs stack -1 yet
2893
ee0de59f5cef joydrv_6551L.asm: Revert accidental change
Tormod Volden <debian.tormod@gmail.com>
parents: 2880
diff changeset
172 bcc Alldone else stack still -1
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
173 lbra Term it won't come back!
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
174 Alldone puls cc,pc and return clean
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
175
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
176 *****SetBuf**************************
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
177 * Btn.Cntr,u offset 0 has room for 3 bits of incoming
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
178 * byte counter, 3 bits of button status.
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
179 * Buffer, offset 2-3 is the combined first 3 bytes
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
180 * of the incoming XY data
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
181 * CrntXpos, offset 4-5 is current (0-HResMaxX) xpos
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
182 * CrntYpos, offset 6-7 is current (0 to HResMaxY*2) ypos
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
183 SetBuf lda #$00
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
184 ldb #'M set Buffer,u to M$ mode
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
185 std Btn.Cntr,u set up Rx data sync, no button(s) pressed
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
186 clrb
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
187 std CrntXPos,u set up X position at left screen edge
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
188 ldd #HResMaxY*2 =$017E, 382 decimal? Odd value, check
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
189 std CrntYPos,u set up Y position at top screen edge
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
190 * Now we should be ready for live IRQ's
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
191 InstIRQ ldd M$Mem,pcr get base hardware address
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
192 addd #StatReg status register address
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
193 pshs x,y
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
194 leax IRQPckt,pcr
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
195 leay IRQSvc,pcr
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
196 os9 F$IRQ install the IRQSvs routine
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
197 puls x,y
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
198 lbcs InitErr go with cc on stack!
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
199 * Now, enable rx Rx IRQ's
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
200 ldx M$Mem,pcr but first clean out any instant IRQ's
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
201 lda DataReg,x dump it to the bitbucket
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
202 lda StatReg,x likewise, clear any irq's pending
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
203 * Now, enable the IRQ's
2876
1ca5c484c7a7 joydrv_6551L.asm: Remove spurious ! (OR) from expression
Tormod Volden <debian.tormod@gmail.com>
parents: 2730
diff changeset
204 ldd #(TIC.RTS!Cmd.DTR)*256+(DB.7!Ctl.RClk!BR.01200) enable rx IRQs
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
205 std CmdReg,x and enable Rx IRQ's
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
206 puls cc Fix the stack!
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
207 rts so stack = 0 now
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
208
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
209 * BUG FIX: InitExit is now here... was TermExit...
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
210 InitExit puls pc,cc recover original regs, return...
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
211
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
212 * clear the PIA's for this, stack is -3 on entry
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
213 InitPIAs lda >PIA1Base+3 get PIA CART* input control register
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
214 anda #$FC clear PIA CART* control bits
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
215 sta >PIA1Base+3 disable PIA CART* FIRQs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
216 lda >PIA1Base+2 clear possible pending PIA CART* FIRQ
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
217 ifeq DEBUG-1
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
218 pshs a,b,x,u,y,cc,dp
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
219 lda #'P
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
220 jsr <D.BtBug
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
221 puls a,b,x,u,y,cc,dp
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
222 endc
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
223 rts stack still -1
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
224
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
225 InitGIME lda #$01 GIME CART* IRQ enable
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
226 ora <D.IRQER mask in current GIME IRQ enables
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
227 sta <D.IRQER save GIME CART* IRQ enable shadow register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
228 sta >IrqEnR enable GIME CART* IRQs
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
229 lda SlotSlct,pcr mpi slot of mouse
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
230 bmi ClrACIA if no mpi
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
231 sta >MPI.Slct
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
232 ifeq DEBUG-1
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
233 pshs a,b,x,u,y,cc,dp
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
234 lda #'G
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
235 jsr <D.BtBug
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
236 puls a,b,x,u,y,cc,dp
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
237 endc
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
238 rts And stack still -1
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
239
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
240 ClrACIA ldx M$Mem,pcr get base hardware address again
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
241 lda #$10
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
242 sta StatReg,x reset again
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
243 * start it up with rx IRQs disabled
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
244 ldd #(TIC.RTS!Cmd.DTR!Cmd.RxIE)*256+(DB.7!Ctl.RClk!BR.01200) [D]=command:control
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
245 std CmdReg,x set command and control registers
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
246 * do instant reads for trash collection
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
247 * and clear status of Stat.RxF bits
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
248 * read it 32 times so its settled!
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
249 * and get rid of this headache
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
250 ldb #$02
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
251 flshinit lda StatReg,x
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
252 * look at everything
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
253 ifeq DEBUG-1
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
254 pshs a,b,x,u,y,cc,dp
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
255 jsr <D.BtBug lets see what its doing
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
256 puls a,b,x,u,y,cc,dp
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
257 endc
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
258 lda DataReg,x
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
259 ifeq DEBUG-1
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
260 pshs a,b,x,u,y,cc,dp
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
261 jsr <D.BtBug lets see what its doing
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
262 puls a,b,x,u,y,cc,dp
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
263 endc
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
264 decb
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
265 bne flshinit
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
266 * looks like 2x is enough to clear things, its P3P3P3 till end.
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
267 * Fall thru to KilTim
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
268
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
269 * this should allow the acia to overflow etc as the power/signin bytes come in
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
270 * but the Rx irq is disabled.
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
271 * We need at least 14 milliseconds plus 3 bytes at 1200 baud,
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
272 * which is 25 ms or about 40 milliseconds total.
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
273 KilTim pshs y stack -3
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
274 ldb #$03 a small time delay
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
275 rloadlp ldy #$1FFF ditto,
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
276 dodelay leay -1,y
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
277 bne dodelay
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
278 decb
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
279 clra
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
280 puls y stack -1
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
281 rts Return success regardless, stack -1
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
282
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
283
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
284 *** Only used by failed Init routine!
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
285 * JoyDrv Termination.
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
286 *
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
287 * INPUT: U = JoyDrv data area address (8 bytes)
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
288 *
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
289 * OUTPUT: IRQ service entry removed
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
290 * D, X, and U registers may be altered
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
291 *
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
292 * ERROR OUTPUT: CC = Carry set
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
293 * B = error code
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
294 Term pshs cc save regs we alter
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
295 orcc #IntMasks mask IRQs while disabling ACIA
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
296 InitErr ldx M$Mem,pcr get base address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
297 lda #TIC.RTS!Cmd.RxIE!Cmd.DTR *disable all
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
298 sta CmdReg,x *ACIA IRQs
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
299 leax StatReg,x point to status register
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
300 tfr x,d copy status register address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
301 ldx #$0000 remove IRQ table entry
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
302 leay IRQSvc,pcr
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
303 os9 F$IRQ
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
304
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
305 * ifeq DEBUG-1
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
306 pshs a,b,x,y,u,cc,dp
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
307 lda #'j failed
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
308 jsr <D.BtBug
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
309 puls a,b,x,y,u,cc,dp
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
310 * endc
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
311
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
312 TermExit puls cc clear stack
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
313 letssee bra letssee lock it with failed data on screen
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
314 comb
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
315 ldb #E$PrcAbt
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
316 rts
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
317 *************************
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
318 * This code only good for tandy
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
319 * Joysticks. Why here?
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
320 * Joystick button(s) status check.
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
321 *
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
322 * INPUT: U = JoyDrv data area address (8 bytes)
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
323 *
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
324 * OUTPUT: B = button or "clear" status
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
325 * button(s) = xxxxLRLR
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
326 * A, X, and U registers may be altered
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
327 *
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
328 * ERROR OUTPUT: none
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
329 SSJoyBtn ldb #$FF
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
330 ldx #PIA0Base check for standard joystick/mouse fire buttons
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
331 stb $02,x
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
332 ldb ,x
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
333 comb set == button pressed
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
334 andb #$0F
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
335 rts
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
336 * I (GH) don't believe the above code ever runs.
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
337
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
338 ****************************************
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
339 * Mouse button(s) status check.
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
340 * GH - 21/06/2008 will need center button additions
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
341 * GH - 30/06/2008 redefined buttons
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
342 * INPUT: U = JoyDrv data area address (8 bytes)
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
343 *
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
344 * OUTPUT: B = button or "clear" status
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
345 * ????? GH where did I find this set of bogus defines?
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
346 * button(s) = xxxxLRLR looks like a 3$ bill
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
347 * clear = 10000000
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
348 * shift-clear = 11000000
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
349 * A, X, and U registers may be altered
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
350 *
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
351 * ERROR OUTPUT: none
2730
6bd6e348665d Working on cloned default branch, pulled 2012/11/03
gheskett@wdtv.com
parents: 2371
diff changeset
352
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
353 SSMsBtn pshs cc
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
354 orcc #IntMasks mask interrupts
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
355 lda Btn.Cntr,u
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
356 * GH now Q is do we wait till mouse packet is in? Not ATM
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
357 tfr a,b
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
358 andb #%11000000 mask SHIFT-CLEAR
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
359 bne L0120
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
360 bita #BC.ButnL Left btn down?
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
361 beq L011A
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
362 orb #%00000011 wrong, will need adjustment
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
363 L011A bita #BC.ButnR Right btn down?
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
364 beq L0120
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
365 orb #%00001100 wrong, will need adjustment
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
366 L0120 anda #%00111111 turn off SHIFT-CLEAR flag
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
367 sta ,u
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
368 puls pc,cc
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
369
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
370
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
371 ***
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
372 * Joystick/Mouse XY coordinate read.
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
373 *
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
374 * INPUT: A = side flag (1 = right, 2 = left)
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
375 * Y = resolution (0 = low, 1 = high)
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
376 * U = JoyDrv data area address (8 bytes)
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
377 *
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
378 * OUTPUT: X = horizontal coordinate (left edge = 0)
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
379 * low resolution = 0 to 63
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
380 * high resolution = 0 to HResMaxX
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
381 * Y = vertical coordinate (top edge = 0)
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
382 * low resolution = 0 to 63
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
383 * high resolution = 0 to HResMaxY
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
384 * D and U registers may be altered
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
385 *
1846
7a973074acbe Fixed makefile error for dskcopy target
boisy
parents: 0
diff changeset
386 * ERROR OUTPUT: none
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
387 SSMsXY ldd #$017E
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
388 pshs cc
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
389 orcc #IntMasks
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
390 ldx CrntXPos,u
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
391 subd CrntYPos,u
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
392 lsra
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
393 rorb
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
394 tfr d,y
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
395 puls pc,cc
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
396
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
397 *************************************
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
398 * Mouse IRQ service routine.
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
399 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
400 * INPUT: A = flipped and masked device status byte
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
401 * NO IT'S NOT MASKED, normally $D8 coming into here
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
402 * And the 4 lsb's are all we care about
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
403 * U = mouse data area address
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
404 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
405 * OUTPUT: updated serial mouse data
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
406 * CC Carry clear
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
407 * D, X, Y, and U registers may be altered
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
408 *
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
409 * ERROR OUTPUT: none
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
410 * GH 23/06/2008 We can watch the buffer with "dbmouse"
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
411 * thanks Robert G.
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
412 IRQSvc ldx M$Mem,pcr is hdwe addr
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
413 anda Stat.Err any error(o/f/p)?
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
414 beq ChkRDRF no, go check Rx data
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
415 ldb DataReg,x read Rx data register to clear error flags
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
416 IRQExit clrb clear Carry to mark IRQ serviced
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
417 rts all done
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
418
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
419 ChkRDRF ldb DataReg,x get Rx data
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
420 lda Btn.Cntr,u get buttons, byte counter
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
421 bitb #MD.Sync Sync byte?
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
422 beq ChkOfst Not sync, go
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
423
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
424 * is sync, zero Cntr first
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
425 * is only non-err place counter is reset!
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
426 * but leave buttons alone
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
427 anda #^BC.RxCnt leave buttons
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
428 inca to count byte
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
429 sta Btn.Cntr,u save btns, cntr=1
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
430
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
431 * GH 06/21/2008-from here to rts is sync byte only
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
432 * ENTER B=%??LRXXYY 1st byte from mouse
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
433 * Left button 1st
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
434 ChkLBtn bitb #MD.ButnL
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
435 beq BtnLu not set, go
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
436 ora #BC.ButnL down $20
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
437 bra ChkRBtn
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
438 BtnLu anda #BU.ButnL release it
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
439 * Right button
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
440 ChkRBtn bitb #MD.ButnR $10
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
441 beq BtnRu
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
442 ora #BC.ButnR $10 pushed
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
443 bra GoDoXY
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
444 BtnRu anda #BU.ButnR release it
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
445 * That does left/right buttons
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
446 * now do MS 2 bits of YYXX also in sync byte
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
447 GoDoXY sta Btn.Cntr,u save count, buttons
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
448 lslb needs 4 shifts
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
449 lslb to put YY
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
450 lslb in d7, d6
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
451 lslb
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
452 pshs b Save YYXX0000
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
453 andb #MskYYXX nuke XX leave YY000000
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
454 stb Buffer+2,u preload YY
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
455 puls b refresh b
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
456 lslb
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
457 lslb Now only XX000000
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
458 stb Buffer+1,u mark in sync, 1st byte done
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
459 clrb clear errors
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
460 rts sync byte done
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
461 * the above does first byte with 0SBBYYXX
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
462 * Putting YY in MS2bits of Buffer+1,u (2,u)
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
463 * And XX in MS2bits of Buffer+0,u (1,u)
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
464 * And we have now set Btn.Cntr to 1+ buttons
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
465 *======================================
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
466 * we arrive here in sync, with BT.Cntr,u
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
467 * in a, ( s/b 1 or 2) but buttons not masked out
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
468 *======================================
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
469 ChkOfst inc Btn.Cntr,u count byte
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
470 lda Btn.Cntr,u
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
471 anda #BC.RxCnt mask out btns
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
472 cmpa #PcktSize last byte std pkt?
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
473 bcs SaveData no, go save YYXX mouse data to Rx buffer...
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
474
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
475 * this is a good place to handle the center button in the 4th byte
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
476 DoCBtn lda Btn.Cntr,u get old button status
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
477 bitb #MD.ButnC is 4th byte, status of middle button?
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
478 beq BtnCUp
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
479 ora #BC.ButnC set middle button
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
480 bra BtnCfn
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
481 BtnCUp anda #BU.ButnC unset it
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
482 BtnCfn sta Btn.Cntr,u put back new status
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
483 * GH - 01/07/2008 switch out the M$ center button
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
484 * code till next reboot
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
485 SetLgtk lda #'L
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
486 sta Buffer,u set Lgtk mode
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
487 clrb
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
488 rts
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
489
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
490 * we arrive here with byte #(2 or 3) in a, rx byte in b
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
491 * offset a,u is sync bytes %YY000000 or %XX000000
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
492 SaveData orb a,u incl 2 ms bits
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
493 stb a,u save Y or X position byte to mouse data Rx buffer
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
494 * Is last of YYXX data if a=3 here
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
495 cmpa #PcktSize-1
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
496 bne NotLstXY not last byte
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
497 * GH - 01/07/2008 do till Logitek sends 4th byte
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
498 * check to see if a Logitek mouse has been discovered
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
499 CkMSMou lda Buffer,u
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
500 cmpa #'M
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
501 bne DoCalcs skip this
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
502 * GH - 01/07/2008 else do M$ style center button
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
503 lda Btn.Cntr,u
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
504 anda #BC.Butns any btns down?
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
505 adda Buffer+1,u add motion
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
506 adda Buffer+2,u add motion
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
507 bne MBtnCup
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
508 lda Btn.Cntr,u
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
509 ora #BC.ButnC
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
510 sta Btn.Cntr,u
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
511 bra NotLstXY no use doing calcs
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
512 MBtnCup lda Btn.Cntr,u
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
513 anda #BU.ButnC
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
514 sta Btn.Cntr,u
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
515 DoCalcs ldx #HResMaxY*2 get maximum Y position
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
516 pshs x save it for CalcPos subroutine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
517 leax CrntYPos,u point to current Y position
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
518 * arrive here with regs b=YY
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
519 * Y motion is bass ackwards so
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
520 comb complement
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
521 incb 2's complement
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
522 bsr CalcPos go calculate & save mouse's new Y position
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
523 * now get full XX data
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
524 ldb Buffer+1,u get X offset
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
525 ldx #HResMaxX get maximum X position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
526 stx ,s save it for CalcPos subroutine
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
527 leax CrntXPos,u point to current X position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
528 bsr CalcPos go calculate & save mouse's new X position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
529 leas 2,s clean up stack
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
530 NotLstXY clrb clear Carry to mark IRQ serviced
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
531 rts
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
532
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
533 * destroys A, also slow, needs 12" square mouse pad!
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
534 CalcPos sex sign extend mouse packet's 2nd XY offset ([D] = -128 to +127)
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
535 pshs d save it temporarily...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
536 std ,s save XY offset total temporarily...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
537 bpl PosAdjst go de-sensitize positive "ballistic" XY offset...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
538 orb #%00000111 if -8<XYoffset<0, no "ballistic" response
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
539 addd #1 "fix" negative offset "ballistic" response
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
540 bra RShiftD go calculate "ballistic" offset...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
541 PosAdjst andb #%11111000 if 0<XYoffset<8, no "ballistic" response
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
542 RShiftD asra *calculate 50% of XY offset
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
543 rorb *for "ballistic" response
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
544 addd ,s++ add original XY offset total, clean up stack
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
545 addd ,x add mouse's current XY position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
546 bpl CheckPos zero or positive XY position, go check it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
547 clra *set minimum
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
548 clrb *XY position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
549 CheckPos cmpd 2,s past maximum XY position?
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
550 bls SavePos no, go save it...
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
551 ldd 2,s get maximum XY position
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
552 SavePos std ,x save new XY position
2371
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
553 rts
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
554
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
555 emod
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
556 eom equ *
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
557 end
1317b044e8bf *** empty log message ***
gheskett
parents: 2194
diff changeset
558