📄 joystick.lis
字号:
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 1
1 ; ---------------------------------------------------------
2 ; ../src/joystick.c
3 ; compiled with GCC 2.7.2 ST9+ Software Development Toolchain Version 6.1.3
4 ; Thu Oct 31 15:01:49 2002
5 ;
6 ; OPTIMIZATIONS: 1
7 ; omit-frame-pointer
8 ; OPTIONS: compact
9 ; ---------------------------------------------------------
10
11 gcc_compiled.:
12 .assume no-parmusp,no-fp-on,compact
38
39 .section .data
41
42 .desc xmin, near
43 xmin:
44 0000 FF .byte 255
46
47 .desc xmax, near
48 xmax:
49 0001 00 .byte 0
51
52 .desc ymin, near
53 ymin:
54 0002 FF .byte 255
56
57 .desc ymax, near
58 ymax:
59 0003 00 .byte 0
60
61 .section .text
64
65 .globl stretch
66
67 .desc stretch, near
68 .proc stretch
69 stretch:
70 .Ltext0:
1:../src/joystick.c **** #include <cpu.h>
2:../src/joystick.c **** #include <usb.h>
3:../src/joystick.c ****
4:../src/joystick.c **** #pragma register_file EP6TxAddr 48
5:../src/joystick.c **** extern volatile void *EP6TxAddr ;
6:../src/joystick.c **** #pragma register_file EP6TxCount 50
7:../src/joystick.c **** extern volatile WORD EP6TxCount ;
8:../src/joystick.c **** #pragma register_file EP6RxAddr 52
9:../src/joystick.c **** extern volatile void *EP6RxAddr ;
10:../src/joystick.c **** #pragma register_file EP6RxCount 54
11:../src/joystick.c **** extern volatile WORD EP6RxCount ;
12:../src/joystick.c **** #pragma register_file EP7TxAddr 56
13:../src/joystick.c **** extern volatile void *EP7TxAddr ;
14:../src/joystick.c **** #pragma register_file EP7TxCount 58
15:../src/joystick.c **** extern volatile WORD EP7TxCount ;
16:../src/joystick.c **** //#pragma register_file EP7RxAddr 60
17:../src/joystick.c **** //extern volatile void *EP7RxAddr ;
18:../src/joystick.c **** //#pragma register_file EP7RxCount 62
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 2
19:../src/joystick.c **** //extern volatile WORD EP7RxCount ;
20:../src/joystick.c ****
21:../src/joystick.c **** void JOYSTICK_Send( BYTE buts, BYTE x, BYTE y) ;
22:../src/joystick.c ****
23:../src/joystick.c **** BYTE x, y ; /* Joystick values */
24:../src/joystick.c **** static BYTE xmin = 255 ;
25:../src/joystick.c **** static BYTE xmax = 0 ;
26:../src/joystick.c **** static WORD xrange ;
27:../src/joystick.c **** static BYTE ymin = 255 ;
28:../src/joystick.c **** static BYTE ymax = 0 ;
29:../src/joystick.c **** static WORD yrange ;
30:../src/joystick.c ****
31:../src/joystick.c **** WORD stretch( WORD val)
32:../src/joystick.c **** {
72 0000 E320 ldw rr2,rr0
73 .LMM2:
33:../src/joystick.c **** // WORD val ;
34:../src/joystick.c ****
35:../src/joystick.c **** // val = coord ;
36:../src/joystick.c **** // coord >>= 2 ;
37:../src/joystick.c **** // val += coord ;
38:../src/joystick.c **** // coord >>=1 ;
39:../src/joystick.c **** // val += coord ;
40:../src/joystick.c **** // coord >>= 1 ;
41:../src/joystick.c **** // val += coord ; /* val = 1.4375 coord (> square 2) */
42:../src/joystick.c **** val += val >> 1 ; /* 1.5 */
75 0002 11 rcf
76 0003 36D0 rrcw rr0
77 0005 4E20 addw rr2,rr0
78 .LMM3:
43:../src/joystick.c **** if( val < 63)
80 0007 97D3003E cpw rr2,#62
81 000b BB04 jxugt .L2
82 .LMM4:
44:../src/joystick.c **** val = 0 ;
84 000d 6E22 xorw rr2,rr2
85 000f 8B04 jxt .L3
86 .L2:
87 .LMM5:
45:../src/joystick.c **** else
46:../src/joystick.c **** val -= 63 ;
89 0011 47D3FFC1 addw rr2,#-63
90 .L3:
91 .LMM6:
47:../src/joystick.c ****
48:../src/joystick.c **** if( val > 255)
93 0015 97D300FF cpw rr2,#255
94 0019 3B04 jxule .L4
95 .LMM7:
49:../src/joystick.c **** val = 255 ;
97 001b BFD200FF ldw rr2,#255
98 .L4:
99 .LMM8:
50:../src/joystick.c ****
51:../src/joystick.c **** return val ;
101 001f E302 ldw rr0,rr2
102 .LMM9:
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 3
52:../src/joystick.c **** }
104 0021 46 ret
105 .endproc
106 .Lscope0:
108
109 .globl FAD_CLR
110 .desc FAD_CLR, 8bit register
111 FAD_CLR= 241
112
113 .globl FAD_DTR
114 .desc FAD_DTR, 8bit register
115 FAD_DTR= 240
117
118 .globl get_xy
119
120 .desc get_xy, near
121 .proc get_xy
122 get_xy:
53:../src/joystick.c ****
54:../src/joystick.c **** void get_xy( void)
55:../src/joystick.c **** {
124 0022 74D8 pushw rr8
125 .LMM11:
56:../src/joystick.c **** spp( FAD_PG) ;
127 ; #APP
128 0024 C7FA spp #62
129 ; #NO_APP
130 .LMM12:
57:../src/joystick.c ****
58:../src/joystick.c **** /* do conversion */
59:../src/joystick.c **** FAD_CLR = 0xA5 ; /* Start channel 5 on P6.7 */
132 0026 F5F1A5 ld @FAD_CLR,#-91
133 .LMM13:
60:../src/joystick.c **** while( FAD_CLR & 1)
135 .L20:
136 0029 A5F101 tm @FAD_CLR,#1
137 002c EBFB jxnz .L20
138 .LMM14:
61:../src/joystick.c **** ;
62:../src/joystick.c ****
63:../src/joystick.c **** x = FAD_DTR ;
140 002e 68F0 ld r6,@FAD_DTR
141 0030 C5F60000 ld dpr:pof(@x),r6
142 .LMM15:
64:../src/joystick.c **** FAD_CLR = 0x95 ; /* Start channel 4 on P6.6 */
144 0034 F5F195 ld @FAD_CLR,#-107
145 .LMM16:
65:../src/joystick.c **** while( FAD_CLR & 1)
147 .L21:
148 0037 A5F101 tm @FAD_CLR,#1
149 003a EBFB jxnz .L21
150 .LMM17:
66:../src/joystick.c **** ;
67:../src/joystick.c ****
68:../src/joystick.c **** y = FAD_DTR ;
152 003c 68F0 ld r6,@FAD_DTR
153 003e C5F60000 ld dpr:pof(@y),r6
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 4
154 .LMM18:
69:../src/joystick.c ****
70:../src/joystick.c **** x = 255 - x ; /* Invert X sensing */
156 0042 0CFF ld r0,#255
157 0044 C4500000 sub r0,dpr:pof(@x)
158 0048 C5F00000 ld dpr:pof(@x),r0
159 .LMM19:
71:../src/joystick.c **** // x &= 0xFC ; /* Drop last bits */
72:../src/joystick.c **** // y &= 0xFC ; /* Drop last bits */
73:../src/joystick.c ****
74:../src/joystick.c **** if( x < xmin)
161 004c C4F60000 ld r6,dpr:pof(@xmin)
162 0050 C5960000 cp dpr:pof(@x),r6
163 0054 FB04 jxuge .L14
164 .LMM20:
75:../src/joystick.c **** xmin = x ;
166 0056 C5F00000 ld dpr:pof(@xmin),r0
167 .L14:
168 .LMM21:
76:../src/joystick.c ****
77:../src/joystick.c **** if( xmax < x)
170 005a C4F60000 ld r6,dpr:pof(@x)
171 005e C5960001 cp dpr:pof(@xmax),r6
172 0062 FB04 jxuge .L15
173 .LMM22:
78:../src/joystick.c **** xmax = x ;
175 0064 C5F60001 ld dpr:pof(@xmax),r6
176 .L15:
177 .LMM23:
79:../src/joystick.c ****
80:../src/joystick.c **** if( (xmin < 43) && (xmax > 212))
179 0068 2F912A00 cp dpr:pof(@xmin),#42
179 00
180 006d BB2C jxugt .L16
181 006f 2F91D400 cp dpr:pof(@xmax),#212
181 01
182 0074 3B25 jxule .L16
183 .LMM24:
81:../src/joystick.c **** {
82:../src/joystick.c **** xrange = xmax - xmin + 1;
185 0076 C4F10000 ld r1,dpr:pof(@xmin)
186 007a 0C00 ld r0,#0
187 007c C4F30001 ld r3,dpr:pof(@xmax)
188 0080 2C00 ld r2,#0
189 0082 5E20 subw rr2,rr0
190 0084 DFD2 incw rr2
191 0086 E2F30000 ldw dpr:pof(@xrange),rr2
192 .LMM25:
83:../src/joystick.c **** x = ((x - xmin) * 256) / xrange ;
194 008a C4F40000 ld r4,dpr:pof(@x)
195 008e 5241 sub r4,r1
196 0090 90D5 clr r5
197 0092 E304 ldw rr0,rr4
198 0094 D20000 call @__udivsi3
199 0097 C5F10000 ld dpr:pof(@x),r1
200 .L16:
201 .LMM26:
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 5
84:../src/joystick.c **** }
85:../src/joystick.c ****
86:../src/joystick.c **** x = stretch( x) ;
203 009b C4F10000 ld r1,dpr:pof(@x)
204 009f 0C00 ld r0,#0
205 00a1 D20000 call @stretch
206 00a4 C5F10000 ld dpr:pof(@x),r1
207 .LMM27:
87:../src/joystick.c ****
88:../src/joystick.c **** if( y < ymin)
209 00a8 C4F60002 ld r6,dpr:pof(@ymin)
210 00ac C5960000 cp dpr:pof(@y),r6
211 00b0 FB08 jxuge .L17
212 .LMM28:
89:../src/joystick.c **** ymin = y ;
214 00b2 C4F60000 ld r6,dpr:pof(@y)
215 00b6 C5F60002 ld dpr:pof(@ymin),r6
216 .L17:
217 .LMM29:
90:../src/joystick.c ****
91:../src/joystick.c **** if( ymax < y)
219 00ba C4F60000 ld r6,dpr:pof(@y)
220 00be C5960003 cp dpr:pof(@ymax),r6
221 00c2 FB04 jxuge .L18
222 .LMM30:
92:../src/joystick.c **** ymax = y ;
224 00c4 C5F60003 ld dpr:pof(@ymax),r6
225 .L18:
226 .LMM31:
93:../src/joystick.c ****
94:../src/joystick.c **** if( (ymin < 43) && (ymax > 212))
228 00c8 2F912A00 cp dpr:pof(@ymin),#42
228 02
229 00cd BB2C jxugt .L19
230 00cf 2F91D400 cp dpr:pof(@ymax),#212
230 03
231 00d4 3B25 jxule .L19
232 .LMM32:
95:../src/joystick.c **** {
96:../src/joystick.c **** yrange = ymax - ymin + 1;
234 00d6 C4F10002 ld r1,dpr:pof(@ymin)
235 00da 0C00 ld r0,#0
236 00dc C4F30003 ld r3,dpr:pof(@ymax)
237 00e0 2C00 ld r2,#0
238 00e2 5E20 subw rr2,rr0
239 00e4 DFD2 incw rr2
240 00e6 E2F30002 ldw dpr:pof(@yrange),rr2
241 .LMM33:
97:../src/joystick.c **** y = ((y - ymin) * 256) / yrange ;
243 00ea C4F80000 ld r8,dpr:pof(@y)
244 00ee 5281 sub r8,r1
245 00f0 90D9 clr r9
246 00f2 E308 ldw rr0,rr8
247 00f4 D20000 call @__udivsi3
248 00f7 C5F10000 ld dpr:pof(@y),r1
249 .L19:
250 .LMM34:
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 6
98:../src/joystick.c **** }
99:../src/joystick.c ****
100:../src/joystick.c **** y = stretch( y) ;
252 00fb C4F10000 ld r1,dpr:pof(@y)
253 00ff 0C00 ld r0,#0
254 0101 D20000 call @stretch
255 0104 C5F10000 ld dpr:pof(@y),r1
256 .LMM35:
101:../src/joystick.c **** }
258 0108 75D8 popw rr8
259 010a 46 ret
260 .endproc
261 .Lscope1:
263
264 .globl P5DR
265 .desc P5DR, 8bit register
266 P5DR= 229
268
269 .globl joy_poll
270
271 .desc joy_poll, near
272 .proc joy_poll
273 joy_poll:
102:../src/joystick.c ****
103:../src/joystick.c **** BYTE j_buttons ; /* Set by keyboard polling routine when no ghost key */
104:../src/joystick.c ****
105:../src/joystick.c **** void joy_poll( void)
106:../src/joystick.c **** {
275 .LMM37:
107:../src/joystick.c **** BYTE buts, tmp, cnt ;
277 .LBB2:
278 .LMM38:
108:../src/joystick.c ****
109:../src/joystick.c **** get_xy() ;
280 010b D20022 call @get_xy
281 .LMM39:
110:../src/joystick.c ****
111:../src/joystick.c **** if( configuration_status[ 1]) /* Keyboard polling is active */
283 010e 2F910000 cp dpr:pof(@configuration_status+1),#0
283 01
284 0113 6B06 jxz .L23
285 .LMM40:
112:../src/joystick.c **** {
113:../src/joystick.c **** buts = j_buttons ;
287 0115 C4F00000 ld r0,dpr:pof(@j_buttons)
288 .LMM41:
114:../src/joystick.c **** }
290 0119 8B0B jxt .L24
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -