📄 joystick.lis
字号:
291 .L23:
292 .LMM42:
115:../src/joystick.c **** else
116:../src/joystick.c **** {
117:../src/joystick.c **** extern BYTE get_key() ;
294 .LBB3:
295 .LMM43:
118:../src/joystick.c ****
119:../src/joystick.c **** // buts = 0 ;
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 7
120:../src/joystick.c **** // tmp = 0 ;
121:../src/joystick.c **** // cnt = 0 ;
122:../src/joystick.c **** P5DR = 0x7F ;
297 011b F5E57F ld @P5DR,#127
298 .LMM44:
123:../src/joystick.c **** // do
124:../src/joystick.c **** // {
125:../src/joystick.c **** // buts = ~P3DR & 0x0F ;
126:../src/joystick.c **** // buts |= (~P4DR << 4) & 0xF0 ;
127:../src/joystick.c **** // if( tmp == buts)
128:../src/joystick.c **** // {
129:../src/joystick.c **** // cnt += 1 ;
130:../src/joystick.c **** // }
131:../src/joystick.c **** // else
132:../src/joystick.c **** // {
133:../src/joystick.c **** // cnt = 0 ;
134:../src/joystick.c **** // tmp = buts ;
135:../src/joystick.c **** // }
136:../src/joystick.c **** // }
137:../src/joystick.c **** // while( cnt < 8) ;
138:../src/joystick.c ****
139:../src/joystick.c **** buts = get_key() ;
300 011e D20000 call @get_key
301 0121 08D1 ld r0,r1
302 .LMM45:
140:../src/joystick.c ****
141:../src/joystick.c **** P5DR = 0xFF ;
304 0123 F5E5FF ld @P5DR,#-1
305 .LMM46:
142:../src/joystick.c **** }
307 .LBE3:
308 .L24:
309 .LMM47:
143:../src/joystick.c ****
144:../src/joystick.c **** /* Process the raw values */
145:../src/joystick.c **** tmp = 0 ;
311 0126 90D1 clr r1
312 .LMM48:
146:../src/joystick.c **** if( buts & 1)
314 0128 AF1002 btjxf r0.0,.L25
315 .LMM49:
147:../src/joystick.c **** tmp |= 0x08 ;
317 012b 1C08 ld r1,#8
318 .L25:
319 .LMM50:
148:../src/joystick.c ****
149:../src/joystick.c **** if( buts & 2)
321 012d AF3002 btjxf r0.1,.L26
322 .LMM51:
150:../src/joystick.c **** tmp |= 0x20 ;
324 0130 0FA1 bset r1.5
325 .L26:
326 .LMM52:
151:../src/joystick.c ****
152:../src/joystick.c **** if( buts & 4)
328 0132 AF5002 btjxf r0.2,.L27
329 .LMM53:
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 8
153:../src/joystick.c **** tmp |= 0x04 ;
331 0135 0F41 bset r1.2
332 .L27:
333 .LMM54:
154:../src/joystick.c ****
155:../src/joystick.c **** if( buts & 8)
335 0137 AF7002 btjxf r0.3,.L28
336 .LMM55:
156:../src/joystick.c **** tmp |= 0x10 ;
338 013a 0F81 bset r1.4
339 .L28:
340 .LMM56:
157:../src/joystick.c ****
158:../src/joystick.c **** if( buts & 16)
342 013c AF9002 btjxf r0.4,.L29
343 .LMM57:
159:../src/joystick.c **** tmp |= 0x01 ;
345 013f 0F01 bset r1.0
346 .L29:
347 .LMM58:
160:../src/joystick.c ****
161:../src/joystick.c **** if( buts & 32)
349 0141 AFB002 btjxf r0.5,.L30
350 .LMM59:
162:../src/joystick.c **** tmp |= 0x02 ;
352 0144 0F21 bset r1.1
353 .L30:
354 .LMM60:
163:../src/joystick.c ****
164:../src/joystick.c **** buts = tmp ;
356 0146 08D1 ld r0,r1
357 .LMM61:
165:../src/joystick.c ****
166:../src/joystick.c **** JOYSTICK_Send( buts, x, y) ;
359 0148 C4F20000 ld r2,dpr:pof(@y)
360 014c C4F10000 ld r1,dpr:pof(@x)
361 0150 D20154 call @JOYSTICK_Send
362 .LMM62:
167:../src/joystick.c **** }
364 .LBE2:
365 0153 46 ret
366 .endproc
373 .Lscope2:
375
376 .globl EP7TxAddr
377 .desc EP7TxAddr, 16bit register
378 EP7TxAddr= 56
379
380 .globl EP7TxCount
381 .desc EP7TxCount, 16bit register
382 EP7TxCount= 58
383
384 .globl ENDPR7_A
385 .desc ENDPR7_A, 8bit register
386 ENDPR7_A= 254
391
392 .globl JOYSTICK_Send
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 9
393
394 .desc JOYSTICK_Send, near
395 .proc JOYSTICK_Send
396 JOYSTICK_Send:
168:../src/joystick.c ****
169:../src/joystick.c **** BYTE Joy_Buffer[ 3] ;
170:../src/joystick.c ****
171:../src/joystick.c **** void JOYSTICK_Send( BYTE buts, BYTE x, BYTE y)
172:../src/joystick.c **** {
398 .LMM64:
173:../src/joystick.c **** if( Joy_Buffer[ 0] != buts ||
400 0154 C5900000 cp dpr:pof(@Joy_Buffer),r0
401 0158 EB0C jxnz .L33
402 015a C5910001 cp dpr:pof(@Joy_Buffer+1),r1
403 015e EB06 jxnz .L33
404 0160 C5920002 cp dpr:pof(@Joy_Buffer+2),r2
405 0164 6B19 jxz .L32
406 .L33:
407 .LMM65:
174:../src/joystick.c **** Joy_Buffer[ 1] != x ||
175:../src/joystick.c **** Joy_Buffer[ 2] != y)
176:../src/joystick.c **** {
177:../src/joystick.c **** Joy_Buffer[ 0] = buts ;
409 0166 C5F00000 ld dpr:pof(@Joy_Buffer),r0
410 .LMM66:
178:../src/joystick.c **** Joy_Buffer[ 1] = x ;
412 016a C5F10001 ld dpr:pof(@Joy_Buffer+1),r1
413 .LMM67:
179:../src/joystick.c **** Joy_Buffer[ 2] = y ;
415 016e C5F20002 ld dpr:pof(@Joy_Buffer+2),r2
416 .LMM68:
180:../src/joystick.c **** EP7TxAddr = Joy_Buffer ;
418 0172 BF380000 ldw @EP7TxAddr,#dpr:pof(@Joy_Buffer)
419 .LMM69:
181:../src/joystick.c **** EP7TxCount = sizeof Joy_Buffer ;
421 0176 BF3A0003 ldw @EP7TxCount,#3
422 .LMM70:
182:../src/joystick.c **** spp( 4) ;
424 ; #APP
425 017a C712 spp #4
426 ; #NO_APP
427 .LMM71:
183:../src/joystick.c **** ENDPR7_A |= 0x30 ; /* Tx Valid */
429 017c 05FE30 or @ENDPR7_A,#48
430 .L32:
431 .LMM72:
184:../src/joystick.c **** }
185:../src/joystick.c **** }
433 017f 46 ret
434 .endproc
435 .Lscope3:
438
439 .globl JOYSTICK_proc
440
441 .desc JOYSTICK_proc, near
442 .proc JOYSTICK_proc
443 JOYSTICK_proc:
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 10
186:../src/joystick.c ****
187:../src/joystick.c **** void JOYSTICK_proc( void)
188:../src/joystick.c **** {
445 .LMM74:
189:../src/joystick.c **** if( configuration_status[ 3])
447 0180 2F910000 cp dpr:pof(@configuration_status+3),#0
447 03
448 0185 6B0F jxz .L35
449 .LMM75:
190:../src/joystick.c **** {
191:../src/joystick.c **** spp( 4) ;
451 ; #APP
452 0187 C712 spp #4
453 ; #NO_APP
454 .LMM76:
192:../src/joystick.c **** if( (ENDPR7_A & 0x30) == 0x20 /* STAT_NAK */)
456 0189 08FE ld r0,@ENDPR7_A
457 018b 15D030 and r0,#48
458 018e 95D020 cp r0,#32
459 0191 EB03 jxnz .L35
460 .LMM77:
193:../src/joystick.c **** {
194:../src/joystick.c **** joy_poll() ;
462 0193 D2010B call @joy_poll
463 .L35:
464 .LMM78:
195:../src/joystick.c **** }
196:../src/joystick.c **** }
197:../src/joystick.c **** }
466 0196 46 ret
467 .endproc
468 .Lscope4:
470
471 .globl ENDPR6_A
472 .desc ENDPR6_A, 8bit register
473 ENDPR6_A= 252
474
475 .globl EP6RxAddr
476 .desc EP6RxAddr, 16bit register
477 EP6RxAddr= 52
478
479 .globl EP6RxCount
480 .desc EP6RxCount, 16bit register
481 EP6RxCount= 54
482
483 .globl EP6TxAddr
484 .desc EP6TxAddr, 16bit register
485 EP6TxAddr= 48
486
487 .globl ENDPR6_B
488 .desc ENDPR6_B, 8bit register
489 ENDPR6_B= 253
490
491 .globl ENDPR7_B
492 .desc ENDPR7_B, 8bit register
493 ENDPR7_B= 255
494
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 11
495 .globl DADDR3
496 .desc DADDR3, 8bit register
497 DADDR3= 243
499
500 .globl JOYSTICK_reset
501
502 .desc JOYSTICK_reset, near
503 .proc JOYSTICK_reset
504 JOYSTICK_reset:
198:../src/joystick.c ****
199:../src/joystick.c **** void JOYSTICK_reset( void)
200:../src/joystick.c **** {
506 .LMM80:
201:../src/joystick.c **** /* Always called in Endpoint 0 (HUB) context */
202:../src/joystick.c **** spp( 4) ;
508 ; #APP
509 0197 C712 spp #4
510 ; #NO_APP
511 .LMM81:
203:../src/joystick.c **** ENDPR6_A |= 0x02 ; /* Control endpoint */
513 0199 05FC02 or @ENDPR6_A,#2
514 .LMM82:
204:../src/joystick.c ****
205:../src/joystick.c **** EP6RxAddr = RxBuffer[ 3] ;
516 019c BF340018 ldw @EP6RxAddr,#dpr:pof(@RxBuffer+24)
517 .LMM83:
206:../src/joystick.c **** EP6RxCount = MAX_PACKET_SIZE ;
519 01a0 BF360008 ldw @EP6RxCount,#8
520 .LMM84:
207:../src/joystick.c **** EP6TxAddr = 0 ; /* Insure there is a valid Tx address in case of a STATUS IN */
522 01a4 BF300000 ldw @EP6TxAddr,#0
523 .LMM85:
208:../src/joystick.c ****
209:../src/joystick.c **** ENDPR6_A &= ~0x30 ; /* EP2 TX STAT_DISABLED */
525 01a8 15FCCF and @ENDPR6_A,#207
526 .LMM86:
210:../src/joystick.c **** ENDPR6_B |= 0x30 ; /* EP2 RX STAT_VALID */
528 01ab 05FD30 or @ENDPR6_B,#48
529 .LMM87:
211:../src/joystick.c ****
212:../src/joystick.c **** /* INT IN */
213:../src/joystick.c **** ENDPR7_A &= ~0x30 ; /* EP3 TX STAT_DISABLED */
531 01ae 15FECF and @ENDPR7_A,#207
532 .LMM88:
214:../src/joystick.c **** ENDPR7_B &= ~0x30 ; /* EP3 RX STAT_DISABLED */
534 01b1 15FFCF and @ENDPR7_B,#207
535 .LMM89:
215:../src/joystick.c **** ENDPR7_B |= 0x1 ; /* EP3 is Device 1 Endpoint 1 */
537 01b4 05FF01 or @ENDPR7_B,#1
538 .LMM90:
216:../src/joystick.c ****
217:../src/joystick.c **** spp( USB_PG) ;
540 ; #APP
541 01b7 C73E spp #15
542 ; #NO_APP
543 .LMM91:
218:../src/joystick.c **** DADDR3 = 0 | 0x80 ; /* EP0 default address */
GAS LISTING C:\DOCUME~1\REF\LOCALS~1\Temp\cc001908.s page 12
545 01b9 F5F380 ld @DADDR3,#-128
546 .LMM92:
219:../src/joystick.c **** }
548 01bc 46 ret
549 .endproc
550 .Lscope5:
554
555 .globl JOYSTICK_set_configuration
556
557 .desc JOYSTICK_set_configuration, near
558 .proc JOYSTICK_set_configuration
559 JOYSTICK_set_configuration:
220:../src/joystick.c ****
221:../src/joystick.c **** void JOYSTICK_set_configuration( BYTE configuration_status)
222:../src/joystick.c **** {
561 .LMM94:
223:../src/joystick.c **** /* Called in the CTL endpoint context */
224:../src/joystick.c **** if( configuration_status == 0)
563 01bd 0200 or r0,r0
564 01bf EB04 jxnz .L39
565 .LMM95:
225:../src/joystick.c **** {
226:../src/joystick.c **** /* device is not configured */
227:../src/joystick.c **** ENDPR7_A &= ~0x30 ; /* Disable Tx */
567 01c1 15FECF and @ENDPR7_A,#207
568 .LMM96:
228:../src/joystick.c **** }
570 01c4 46 ret
571 .L39:
572 .LMM97:
229:../src/joystick.c **** else
230:../src/joystick.c **** {
231:../src/joystick.c **** /* device is configured */
232:../src/joystick.c **** ENDPR7_A &= ~0x70 ;
574 01c5 15FE8F and @ENDPR7_A,#143
575 .LMM98:
233:../src/joystick.c **** ENDPR7_A |= 0x20 ; /* Tx STAT_NAK */
577 01c8 05FE20 or @ENDPR7_A,#32
578 .LMM99:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -