📄 3100_2interface.lst
字号:
315 0009 HidReport1Len defstring (Report2DescTable-Report1DescTable)
316 0009 HidReport2Len defstring (EndDeviceReportTable-Report2DescTable)
0317
318 0009 ConfigIndex defstring (ConfigDescTable-DeviceDescTable)
319 0009 Strind0Index defstring (String0Table-DeviceDescTable)
320 0009 Strind2Index defstring (String2Table-DeviceDescTable)
321 0009 HidClass1Index defstring (Class1DescTable-DeviceDescTable)
322 0009 HidReport2Index defstring (Report2DescTable-Report1DescTable)
0323
00324 ;------------------------------------------------------------------------
00325 ; For Gamepad Constant Definition
00326 ;------------------------------------------------------------------------
0327
328 0004 Columns equ 04h
329 00FF DebounceBufferEmpty equ ffh
330 0000 UsbNoReport equ 00h
331 0001 UsbReportError equ 01h
332 0002 UsbReport equ 02h
0333
334 0004 DebounceTimes equ 04h
335 00FF KeyPress equ ffh
336 0000 KeyRelease equ 00h
0337
00338 ;--------Rambank0 Register Files (20h~7fh)---------------------------
0339
00340 ;================== For USB Only===========================
0341
342 0020 StateTemp0 equ 20h
343 0021 StateTemp1 equ 21h
00344 ;CountTemp equ 22h
345 0023 WLengthTemp equ 23h
346 0024 LengthCnt equ 24h
347 0025 TableCnt equ 25h
348 0026 DataLength equ 26h
349 0027 RemoteWakeupStatus equ 27h
350 0028 ConfigurationStatus equ 28h
351 0029 Endpoint1Status equ 29h
352 002A Endpoint2Status equ 2ah
353 002B HidProtocolStatus equ 2bh
354 002C IdlePeriodStatus equ 2ch
355 002D UsbCountTemp equ 2dh
356 002E UsbRequireState equ 2eh
357 002F UsbDataTemp equ 2fh
0358
359 0030 IdlePeriodTemp equ 30h
360 0031 UsbLedDataTemp equ 31h
361 0032 DelayCount_us equ 32h
362 0033 AnyCountTemp equ 33h
363 0034 Function0Temp equ 34h
364 0035 Function1Temp equ 35h
0365
366 0036 ReportDataLength equ 36h
0367
368 0038 InOutBuffer equ 38h
369 0038 InOutBuffer0 equ 38h
370 0039 InOutBuffer1 equ 39h
371 003A InOutBuffer2 equ 3ah
372 003B InOutBuffer3 equ 3bh
373 003C InOutBuffer4 equ 3ch
374 003D InOutBuffer5 equ 3dh
375 003E InOutBuffer6 equ 3eh
376 003F InOutBuffer7 equ 3fh
0377
378 0040 DataBuffer equ 40h ;40h~4fh
0379
0380
00381 ;--------Rambank1 Register Files (20h~7fh)---------------------------
0382
0383
0384
0385
0386
00387 ;==============================================================================
00388 ;Macro:Delay_us Macro Files
00389 ;
00390 ;
00391 ;==============================================================================
0392
00393 Delay_us .MAC Time ;Delay "Cycles" instruction cycles
0394
00395 .IF (Time+0=1)
00396 goto $ + 1
00397 nop
00398 .EXITMAC
00399 .ENDIF
0400
00401 .IF (Time+0=2)
00402 goto $ + 1
00403 goto $ + 1
00404 nop
00405 .EXITMAC
00406 .ENDIF
0407
00408 .IF (Time+0=3)
00409 goto $ + 1
00410 goto $ + 1
00411 goto $ + 1
00412 goto $ + 1
00413 .EXITMAC
00414 .ENDIF
0415
00416 .IF (Time+0=4)
00417 goto $ + 1
00418 goto $ + 1
00419 goto $ + 1
00420 goto $ + 1
00421 goto $ + 1
00422 nop
00423 .EXITMAC
00424 .ENDIF
0425
00426 .IF (Time+0=5)
00427 goto $ + 1
00428 goto $ + 1
00429 goto $ + 1
00430 goto $ + 1
00431 goto $ + 1
00432 goto $ + 1
00433 goto $ + 1
00434 .EXITMAC
00435 .ENDIF
0436
00437 .IF (Time+0=6)
00438 goto $ + 1
00439 goto $ + 1
00440 goto $ + 1
00441 goto $ + 1
00442 goto $ + 1
00443 goto $ + 1
00444 goto $ + 1
00445 goto $ + 1
00446 .EXITMAC
00447 .ENDIF
0448
00449 .IF (Time+0=7)
00450 goto $ + 1
00451 goto $ + 1
00452 goto $ + 1
00453 goto $ + 1
00454 goto $ + 1
00455 goto $ + 1
00456 goto $ + 1
00457 goto $ + 1
00458 nop
00459 .EXITMAC
00460 .ENDIF
0461
00462 .IF (Time+0=8)
00463 goto $ + 1
00464 goto $ + 1
00465 goto $ + 1
00466 goto $ + 1
00467 goto $ + 1
00468 goto $ + 1
00469 goto $ + 1
00470 goto $ + 1
00471 goto $ + 1
00472 goto $ + 1
00473 goto $ + 1
00474 .EXITMAC
00475 .ENDIF
0476
0477
00478 .IF (Time%2=0)
00479 movlw Time
00480 movwf DelayCount_us
00481 decfsz DelayCount_us,F
00482 goto $ - 1
00483 .EXITMAC
00484 .ENDIF
0485
00486 .IF (Time%2=1)
00487 movlw Time
00488 movwf DelayCount_us
00489 decfsz DelayCount_us,F
00490 goto $ - 1
00491 ; .EXITMAC
00492 .ENDIF
0493
00494 .ENDM
0495
00496 ;==================================================================================================
497 0000 **** NEW ADDR **** org 0000h ;Reset Vector
00498 ;==================================================================================================
0499
500 00500 0000 3100 goto Start
0501
00502 ;==================================================================================================
503 0001 **** NEW ADDR **** org 0001h ;Interrupt Vector
00504 ;==================================================================================================
0505
506 00506 0001 00A0 movwf StateTemp0
507 00507 0002 0803 movfw Psw
508 00508 0003 00A1 movwf StateTemp1
0509
510 00510 0004 14D1 btfsc 11h,3
511 00511 0005 3024 goto RstiTask
0512
513 00513 0006 15D1 btfsc 11h,7
514 00514 0007 3017 goto Rc0iTask
0515
516 00516 0008 1591 btfsc 11h,6
517 00517 0009 301C goto Tx0iTask
0518
519 00519 000A 1551 btfsc 11h,5
520 00520 000B 3020 goto Tx1iTask
0521
522 00522 000C 1511 btfsc 11h,4
523 00523 000D 3022 goto Tx2iTask
0524
525 00525 000E 1492 btfsc 12h,2
526 00526 000F 3036 goto KbdiTask
0527
528 00528 0010 1452 btfsc 12h,1
529 00529 0011 3038 goto Pb0iTask
0530
531 00531 0012 14D2 btfsc 12h,3
532 00532 0013 302B goto RsmiTask
0533
534 00534 0014 1491 btfsc 11h,2
535 00535 0015 3028 goto SuspiTask
0536
537 00537 0016 3039 goto EndInt
0538
00539 ;==============================================================================
00540 ;Function:Rc0iTask
00541 ; Set RcoFlag and prepare to receive data.
00542 ;==============================================================================
0543
00544 Rc0iTask:
545 00545 0017 11D1 bcf 11h,7
546 00546 0018 1155 bcf 15h,5
547 00547 0019 11D5 bcf 15h,7
548 00548 001A 12CE bsf 0eh,3
549 00549 001B 3039 goto EndInt
0550
00551 ;==============================================================================
00552 ;Function:Tx0iTask
00553 ; When host got data from device then we will get Tx0i interrupt.
00554 ;==============================================================================
0555
00556 Tx0iTask:
557 00557 001C 1191 bcf 11h,6
558 00558 001D 11D5 bcf 15h,7
559 00559 001E 128E bsf 0eh,2
560 00560 001F 3039 goto EndInt
0561
00562 ;==============================================================================
00563 ;Function:Tx1iTask
00564 ; 1.Host receive data then send Tx1i back to MCU
00565 ;==============================================================================
0566
00567 Tx1iTask:
568 00568 0020 1151 bcf 11h,5
569 00569 0021 3039 goto EndInt
0570
00571 ;==============================================================================
00572 ;Function:Tx2iTask
00573 ; 1.Host receive data then send Tx2i back to MCU
00574 ;==============================================================================
0575
00576 Tx2iTask:
577 00577 0022 1111 bcf 11h,4
578 00578 0023 3039 goto EndInt
0579
00580 ;==============================================================================
00581 ;Function:RstiTask
00582 ; 1.Host request bus reset
00583 ;==============================================================================
0584
00585 RstiTask:
586 00586 0024 10D1 bcf 11h,3
587 00587 0025 2130 call UsbReset
588 00588 0026 1213 bsf 13h,0
589 00589 0027 3039 goto EndInt
0590
00591 ;==============================================================================
00592 ;Function:SuspiTask
00593 ; 1.Host want keyboard into power down mode
00594 ;==============================================================================
0595
00596 SuspiTask:
597 00597 0028 1091 bcf 11h,2
598 00598 0029 130E bsf 0eh,4
599 00599 002A 3039 goto EndInt
0600
00601 ;==============================================================================
00602 ;Function:RsmiTask
00603 ; 1.Host wake keyboard up
00604 ;==============================================================================
0605
00606 RsmiTask:
607 00607 002B 10D2 bcf 12h,3
608 00608 002C 11D3 bcf 13h,7
609 00609 002D 110E bcf 0eh,4
0610
611 00611 002E 19EC movlw ech
612 00612 002F 0011 movwr IntEn0
613 00613 0030 1900 movlw 00h
614 00614 0031 0012 movwr IntEn1
0615
616 00616 0032 120E bsf 0eh,0
617 00617 0033 0181 clrf Timer0
0618
619 00619 0034 1213 bsf 13h,0
620 00620 0035 3039 goto EndInt
0621
00622 ;==============================================================================
00623 ;Function:KbdiTask
00624 ; 1.Keyboard wake up by itself. (any keys)
00625 ;==============================================================================
0626
00627 KbdiTask:
628 00628 0036 1092 bcf 12h,2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -