?? bal.lst
字號:
1433 =1 728 Device_Clear_Feature: ; We have no features that can be set or cleared
1433 =1 729 Interface_Clear_Feature: ; We have no features that can be set or cleared
1433 =1 730 Endpoint_Sync_Frame: ; We are not an Isonchronous device
=1 731
1433 =1 732 Invalid: ; Invalid Request made, STALL the Endpoint
1433 D201 =1 733 SETB STALL
1435 22 =1 734 Reply: RET
=1 735
1436 =1 736 Set_Address: ; Set the address that the SIE will respond to
1436 D204 =1 737 SETB SetAddress
1438 22 =1 738 RET
=1 739
1439 =1 740 Set_Report: ; Host wants to sent us a Report.
=1 741 ; The ONLY case in this example where host sends data to us
1439 3000F7 =1 742 JNB Configured, Invalid ; Need to be Configured to do this command
143C 7116 =1 743 CALL GetOutputReport ; Handled in EZUSB.A51
143E 6194 =1 744 JMP ProcessOutputReport ; RETurn via this subroutine
1440 =1 745 Get_Report: ; Host wants a Report
1440 3000F0 =1 746 JNB Configured, Invalid ; Need to be Configured to do this command
1443 754142 =1 747 MOV ReplyBuffer, #42H ; Reply with a recognizable (arbitary) value
1446 22 =1 748 RET
1447 =1 749 Get_Configuration: ; Respond with CurrentConfiguration
1447 854341 =1 750 MOV ReplyBuffer, CurrentConfiguration
144A 22 =1 751 RET
144B =1 752 Device_Get_Status: ; Only two bits of Device Status are defined
144B 754101 =1 753 MOV ReplyBuffer, #1 ; Bit 1=Remote Wakeup(=0), Bit 0=Self Powered(=1)
144E 22 =1 754 RET
144F =1 755 Interface_Get_Status: ; Interface Status is currently defined as 0
144F =1 756 Endpoint_Get_Status:
144F 754002 =1 757 MOV ReplyCount, #2 ; Need a two byte 0 response
1452 22 =1 758 RET
1453 =1 759 Set_Configuration: ; Valid values are 0 and 1
1453 E549 =1 760 MOV A, wValueLow
1455 6009 =1 761 JZ Deconfigured
1457 14 =1 762 DEC A
1458 70D9 =1 763 JNZ Invalid
145A D200 =1 764 SETB Configured
145C 754301 =1 765 MOV CurrentConfiguration, #1
145F 22 =1 766 RET
1460 =1 767 Deconfigured:
1460 C200 =1 768 CLR Configured
1462 F543 =1 769 MOV CurrentConfiguration, A
1464 22 =1 770 RET
1465 =1 771 Get_Descriptor: ; Host wants to know who/what we are
1465 D203 =1 772 SETB IsDescriptor
1467 E54A =1 773 MOV A, wValueHigh
1469 14 =1 774 DEC A ; Valid Values are 1, 2 and 3
146A 9014A5 =1 775 MOV DPTR, #DeviceDescriptor
146D 6031 =1 776 JZ ReturnLength
146F 14 =1 777 DEC A
1470 9014B7 =1 778 MOV DPTR, #ConfigurationDescriptor
1473 7003 =1 779 JNZ TryString
1475 7429 =1 780 MOV A, #ConfigLength
1477 22 =1 781 RET
1478 =1 782 TryString:
A51 MACRO ASSEMBLER BAL 30/05/00 10:40:54 PAGE 13
1478 14 =1 783 DEC A
1479 70B8 =1 784 JNZ Invalid
=1 785 ; Request is for a String Descriptor
147B 9014FC =1 786 MOV DPTR, #String0 ; Point to String 0
147E E549 =1 787 MOV A, wValueLow ; Get String Index
1480 =1 788 NextString:
1480 601E =1 789 JZ ReturnLength
1482 FF =1 790 MOV R7, A ; Save String Index
1483 71E9 =1 791 CALL NextDPTR
1485 E0 =1 792 MOVX A, @DPTR ; Get the String Length (= 0 means we're at Backsto
p)
1486 60AB =1 793 JZ Invalid ; Asked for a string I don't have
1488 EF =1 794 MOV A, R7
1489 14 =1 795 DEC A
148A 80F4 =1 796 JMP NextString ; Check if we are there yet
148C =1 797 Get_Class_Descriptor: ; Valid values are 21H, 22H, 23H for Class Request
148C D203 =1 798 SETB IsDescriptor
148E E54A =1 799 MOV A, wValueHigh
1490 C3 =1 800 CLR C
1491 9421 =1 801 SUBB A, #21H
1493 9014C9 =1 802 MOV DPTR, #HIDDescriptor
1496 6008 =1 803 JZ ReturnLength
1498 14 =1 804 DEC A
1499 9014E0 =1 805 MOV DPTR, #ReportDescriptor
149C 6004 =1 806 JZ ReturnRDlength
=1 807 ; DEC A ; This example does not use Physical Descriptors
=1 808 ; JZ Send_Physical_Descriptor
149E 8093 =1 809 JMP Invalid
=1 810 ;
14A0 =1 811 ReturnLength:
14A0 E0 =1 812 MOVX A, @DPTR ; Get Descriptor Length (first byte)
14A1 22 =1 813 RET
14A2 =1 814 ReturnRDlength: ; Report Descriptor is different format
14A2 741C =1 815 MOV A, #ReportLength
14A4 22 =1 816 RET
=1 817 ; Error check: this MUST be on within a page of Subroutines
0072 =1 818 WithinSamePage EQU $ - Subroutines
=1 819 ;
=1 820
821 $INCLUDE(DTables.A51)
=1 822 ; This module declares the descriptors
=1 823 ;
=1 824 ; This example has one Device Descriptor with:
=1 825 ; One Configuration - single IN port and single OUT port
=1 826 ; One Interface - there is only one method of accessing the ports
=1 827 ; One HID Descriptor - to make PC host software simpler
=1 828 ; Two Endpoint Descriptors - for HID Input and Output Reports
=1 829 ; One Report Descriptor - one byte IN and one byte OUT reports
=1 830 ; Multiple Sting Descriptors - to aid the user
=1 831 ;
---- =1 832 CSEG
14A5 =1 833 DeviceDescriptor:
14A5 1201 =1 834 DB 18, 1 ; Length, Type
14A7 1001 =1 835 DB 10H, 1 ; USB Rev 1.1 (=0110H, low=10H, High=01H)
14A9 000000 =1 836 DB 0, 0, 0 ; Class, Subclass and Protocol
14AC 40 =1 837 DB EP0Size
14AD 42420142 =1 838 DB 42H, 42H, 1, 42H, 0, 1; Vendor ID, Product ID and Version
14B1 0001
14B3 010200 =1 839 DB 1, 2, 0 ; Manufacturer, Product & Serial# Names
14B6 01 =1 840 DB 1 ; #Configs
14B7 =1 841 ConfigurationDescriptor:
14B7 0902 =1 842 DB 9, 2 ; Length, Type
14B9 2900 =1 843 DB LOW(ConfigLength), HIGH(ConfigLength)
14BB 010100 =1 844 DB 1, 1, 0 ; #Interfaces, Configuration#, Config. Name
14BE 80 =1 845 DB 10000000b ; Attributes = Bus Powered
14BF FA =1 846 DB 250 ; Max. Power is 250x2 = 500mA
A51 MACRO ASSEMBLER BAL 30/05/00 10:40:54 PAGE 14
14C0 =1 847 InterfaceDescriptor:
14C0 0904 =1 848 DB 9, 4 ; Length, Type
14C2 000002 =1 849 DB 0, 0, 2 ; *Jan's code: No alternate setting, HID uses 2 additional
endpoints
14C5 03 =1 850 DB 3 ; Class = Human Interface Device
14C6 0000 =1 851 DB 0, 0 ; Subclass and Protocol
14C8 00 =1 852 DB 0 ; Interface Name
14C9 =1 853 HIDDescriptor:
14C9 0921 =1 854 DB 9, 21H ; Length, Type
14CB 1001 =1 855 DB 10H, 1 ; HID Class Specification compliance; Jan's code is V1.1
14CD 00 =1 856 DB 0 ; Country localization (=none)
14CE 01 =1 857 DB 1 ; Number of descriptors to follow
14CF 22 =1 858 DB 22H ; And it's a Report descriptor
14D0 1C00 =1 859 DB LOW(ReportLength), HIGH(ReportLength)
14D2 =1 860 EndpointDescriptor:
14D2 0705 =1 861 DB 7, 5 ; Length, Type
14D4 81 =1 862 DB 10000001b ; Address = IN 1
14D5 03 =1 863 DB 00000011b ; Interrupt
14D6 4000 =1 864 DB EP0Size, 0 ; Maximum packet size (this example only uses 1)
14D8 64 =1 865 DB 100 ; Poll every 0.1 seconds
=1 866
=1 867 ;*Jan's code start
14D9 =1 868 EndpointDescriptor2:
14D9 0705 =1 869 DB 7, 5 ; Length, Type
14DB 02 =1 870 DB 00000010b ; Address = OUT 2
14DC 03 =1 871 DB 00000011b ; Interrupt
14DD 4000 =1 872 DB EP0Size, 0 ; Maximum packet size (this example only uses 1)
14DF 64 =1 873 DB 100 ; Poll every 0.1 seconds
=1 874 ;*Jan's code end
=1 875
0029 =1 876 ConfigLength EQU $ - ConfigurationDescriptor
=1 877
14E0 =1 878 ReportDescriptor: ; Generated with HID Tool, copied to here
14E0 0600FF =1 879 DB 6, 0, 0FFH ; Usage_Page (Vendor Defined)
14E3 0901 =1 880 DB 9, 1 ; Usage (I/O Device)
14E5 A101 =1 881 DB 0A1H, 1 ; Collection (Application)
14E7 1901 =1 882 DB 19H, 1 ; Usage_Minimum (Button 1)
14E9 2908 =1 883 DB 29H, 8 ; Usage_Maximum (Button 8)
14EB 1500 =1 884 DB 15H, 0 ; Logical_Minimum (0)
14ED 2501 =1 885 DB 25H, 1 ; Logical_Maximum (1)
14EF 7501 =1 886 DB 75H, 1 ; Report_Size (1)
14F1 9508 =1 887 DB 95H, 8 ; Report_Count (8)
14F3 8102 =1 888 DB 81H, 2 ; Input (Data,Var,Abs)
14F5 1901 =1 889 DB 19H, 1 ; Usage_Minimum (Led 1)
14F7 2908 =1 890 DB 29H, 8 ; Usage_Maximum (Led 8)
14F9 9102 =1 891 DB 91H, 2 ; Output (Data,Var,Abs)
14FB C0 =1 892 DB 0C0H ; End_Collection
001C =1 893 ReportLength EQU $-ReportDescriptor
=1 894
14FC =1 895 String0: ; Declare the UNICODE strings
14FC 04030904 =1 896 DB 4, 3, 9, 4 ; Only English language strings supported
1500 =1 897 String1: ; Manufacturer
1500 2C03 =1 898 DB (String2-String1),3 ; Length, Type
1502 55005300 =1 899 DB "U",0,"S",0,"B",0," ",0,"D",0,"e",0,"s",0,"i",0,"g",0,"n",0," ", 0
1506 42002000
150A 44006500
150E 73006900
1512 67006E00
1516 2000
1518 42007900 =1 900 DB "B",0,"y",0," ",0,"E",0,"x",0,"a",0,"m",0,"p",0,"l",0,"e",0
151
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -