annotate 3rdparty/utils/boisy/joypoll.asm @ 3250:13737f3608e6

Updated Level 1 VTIO and CoVDG for updates to do CoCoVGA. Updated Level 1 CoCo1 area makefile's to produce binaries and disk images needed for the CoCoVGA video output.
author David Ladd <drencor-xeen@users.sourceforge.net>
date Wed, 28 Mar 2018 21:20:31 -0500
parents 0e08f0830fd8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
380
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
1 nam JoyPoll
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
2 ttl Joystick poll utility
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
3
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
4 ifp1
1260
0e08f0830fd8 Changes pointed out by Rodney H.
boisy
parents: 380
diff changeset
5 use defsfile
380
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
6 endc
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
7
1260
0e08f0830fd8 Changes pointed out by Rodney H.
boisy
parents: 380
diff changeset
8 mod eom,Name,Prgrm+Objct,ReEnt+1,Start,Fin
380
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
9
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
10 Name fcs /AutoEx/
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
11 Ed fcb $02
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
12
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
13 outpath rmb 1
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
14 outline rmb 80
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
15 SubEnt rmb 2
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
16 RetAddr rmb 2
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
17 JoyNum rmb 2
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
18 JoyX rmb 2
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
19 JoyY rmb 2
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
20 JoyB rmb 2
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
21 LastJoyX rmb 2
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
22 LastJoyY rmb 2
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
23 LastJoyB rmb 2
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
24 opts rmb OPTCNT
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
25 Stack rmb 200
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
26 Fin equ .
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
27
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
28 ParmCnt equ 0
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
29 Addr1 equ 2
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
30 Size1 equ 4
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
31 Addr2 equ 6
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
32 Size2 equ 8
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
33 Addr3 equ 10
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
34 Size3 equ 12
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
35 Addr4 equ 14
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
36 Size4 equ 16
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
37 StackEnd equ Size4
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
38
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
39 submod fcs "JoyStk"
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
40 outdev fcs "/T1"
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
41
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
42 Start lda #Sbrtn+Objct
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
43 leax submod,pcr
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
44 pshs u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
45 os9 F$Link
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
46 puls u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
47 bcc GoOn
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
48 error os9 F$Exit
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
49 GoOn sty <SubEnt save entry pointer
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
50
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
51 * Initialize our static storage
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
52 ldd #$FFFF
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
53 std <LastJoyX
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
54 std <LastJoyY
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
55 std <LastJoyB
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
56
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
57 * Populate our storage area with parameters for the module
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
58 leas -StackEnd,s
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
59 ldd #$04
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
60 std ParmCnt,s
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
61 ldb #$02
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
62 std Size1,s
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
63 std Size2,s
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
64 std Size3,s
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
65 std Size4,s
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
66 leax JoyNum,u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
67 decb
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
68 std ,x
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
69 stx Addr1,s
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
70 leax JoyX,u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
71 stx Addr2,s
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
72 leax JoyY,u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
73 stx Addr3,s
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
74 leax JoyB,u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
75 stx Addr4,s
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
76
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
77 * Open path to output device
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
78 leax outdev,pcr
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
79 lda #WRITE.
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
80 os9 I$Open
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
81 bcs error
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
82 sta <outpath
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
83
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
84 * Set up no pause for both stdout and newly opened output path
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
85 ldb #SS.Opt
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
86 leax opts,u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
87 os9 I$GetStt
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
88 bcs error
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
89 clr (PD.PAU-PD.OPT),x
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
90 os9 I$SetStt
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
91 bcs error
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
92 lda #1
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
93 os9 I$GetStt
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
94 bcs error
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
95 clr (PD.PAU-PD.OPT),x
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
96 os9 I$SetStt
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
97 bcs error
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
98
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
99 * Here's where the action is
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
100 FLoop ldx <SubEnt
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
101 jsr ,x call subroutine module
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
102
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
103 * See if our new values match our last values?
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
104 ldd <JoyX get joystick X
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
105 cmpd <LastJoyX same as last?
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
106 bne CopyVals branch if not
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
107 ldd <JoyY get joystick Y
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
108 cmpd <LastJoyY same as last?
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
109 bne CopyVals branch if not
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
110 ldd <JoyB get joystick button
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
111 cmpd <LastJoyB same as last?
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
112 beq Nap
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
113
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
114 * Copy current values to 'last' values
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
115 CopyVals ldd <JoyB
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
116 std <LastJoyB
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
117 ldd <JoyY
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
118 std <LastJoyY
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
119 ldd <JoyX
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
120 std <LastJoyX
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
121
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
122 leax <outline,u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
123 bsr OutDec3 output joystick X
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
124 lda #C$SPAC
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
125 sta ,x+
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
126 ldd JoyY,u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
127 bsr OutDec3 output joystick Y
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
128 lda #C$SPAC
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
129 sta ,x+
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
130 ldd JoyB,u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
131 bsr OutDec3 output joystick button
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
132 lda #C$CR
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
133 sta ,x+
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
134 lda <outpath
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
135 leax <outline,u
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
136 ldy #80
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
137 os9 I$WritLn write line
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
138 lda #$01 stdout
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
139 os9 I$WritLn write line to screen
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
140
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
141 * Take a small nap
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
142 Nap ldx #60*1 1 seconds
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
143 os9 F$Sleep go to sleep
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
144 bra FLoop
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
145
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
146
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
147 * Print 3 Decimal Digits from D to ,X
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
148 OutDec3 pshs a
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
149 lda #'0
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
150 sta ,x
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
151 sta 1,x
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
152 puls a
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
153 Hundred subd #100
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
154 bcs PreTen
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
155 inc ,x
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
156 bra Hundred
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
157 PreTen addd #100
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
158 Ten subd #10
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
159 bcs PreOne
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
160 inc 1,x
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
161 bra Ten
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
162 PreOne addb #$30+10
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
163 stb 2,x
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
164 leax 3,x
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
165 rts
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
166
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
167 emod
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
168 eom equ *
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
169 end
a814a6c1dab7 Added joypoll
boisy
parents:
diff changeset
170
1260
0e08f0830fd8 Changes pointed out by Rodney H.
boisy
parents: 380
diff changeset
171