⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 des2.asm

📁 Holteck HT82M9XX的USB Mouse的Firmware汇编代码
💻 ASM
字号:
;--------------------------------------------------------------------------
; Remark : 所有的descriptor都放在最後一个PROM page(ORG 0F00H)
;--------------------------------------------------------------------------
Descript                .Section   at   0F00h           'code'  

;-----BEGIN (Standard descriptor)

;--------------------------------------------------------------------------
;Device descriptor
DeviceD:
dw              00112H, 00110H, 00000H, 00800H, 01241H, 01133H, 00200H, 00201H, 00100H
                
;bLengthD:           DW  0012H   ;Size of this descriptor in bytes (18)
;bDescriptorTypeD:   DW  0001H   ;Device descriptor type (1)
;bcdUSB:             DW  0000H, 0001H ;USB specification release Number (1.0)
;bDeviceClass:       DW  0000H   ;Class code (assigned by USB) (0 ?)
;bDeviceSubClass:    DW  0000H   ;Subclass code
;bDeviceProtocol:    DW  0000H   ;Protocol code
;wMaxPacketSize0:    DW  0008H   ;Maximum packet size for endpoint zero (8)
;idVendor:           DW  00bcH, 0005H ;Vendor ID (assigned by USB) (?)
;idProduct:          DW  0001H, 0000H ;Product ID (assigned by manufacturer) (?)
;
;bcdDevice:          DW  0000H, 0001H ;Device release number (1.0 ?)
;;According to the length of previous string(0 means no support)
;iManufacturer:      DW  0000H   ;Index of string descriptor (Manufacturer) (?)
;iProduct:           DW  0000H   ;Index of string descriptor (Product) (?)
;iSerialNumber:      DW  0000H   ;Index of string descriptor (Serial Number) (?)
;iNumConfigurations: DW  0001H   ;Number of possible configuration
;-----------------------------------------------------------------------------

;Configuration descriptor
ConfigurationD:
DW              00209H
Wtotallength:
DW              0022h
bNumberInterface:
DW              00101H, 03f00h, 032a0h

;bLengthC:           DW  0009H   ;Size of this descriptor in bytes (9)
;bDescriptorTypeC:   DW  0002H   ;Configur descriptor type (2)
;;According to the length of previous string
;wTotalLength:       DW  0022H, 0000H
;                    ;Total length of data return for this configuration.
;                    ;Include: Configuration,Interface,Endpoint,and HID)
;                    ;               9           9       7           9
;bNumberInterface:   DW  0001H   ;Number of interfaces supported by this config.
;bConfigurationValue:DW  0001H   ;The value set by Set configuration (1 ?)
;;According to the length of previous string(0 means no support)
;bConfiguration:     DW  0000H   ;Index of string descriptor (Configuration) (0 ?)
;bAttributes:        DW  00A0H   ;D7:BusPowered,D6:Selfpowered,D5:RemoteWakeup
;MaxPower:           DW  0032H   ;Maximum power (50 x 2 mA ?)
;-----------------------------------------------------------------------------

;Interface descriptor
InterfaceD_0:
DW              00409H, 00000H, 00301h, 00201H, 00000H
InterfaceD_1:
InterfaceD_2:

;bLengthI_0_1:           DW  0009H   ;Size of this descriptor in bytes (9)
;bDescriptorTypeI_0_1:   DW  0004H   ;Interface descriptor type (4)
;bInterfaceNumber_0_1:   DW  0000H   ;Number of interface (Zero-based 0)
;bAlternateSetting_0_1:  DW  0000H   ;Value used to select alternate setting (0)
;bNumEndpoints_0_1:      DW  0001H   ;Number of endpoints use by this interface (1)
;bInterfaceClass_0_1:    DW  0003H   ;Class code (HID code assigned by USB) (3)
;bInterfaceSubClass_0_1: DW  0001H   ;Subclass code (1:Boot interface subclass)
;bInterfaceProtocol_0_1: DW  0002H   ;Interface protocol code (2:Mouse)
;;According to the length of previous string(0 means no support)
;iInterface_0_1:         DW  0000H   ;Index of string descriptor (Interface) (?)
;-----------------------------------------------------------------------------

;-----------------------------------------------------------------------------
;Endpoint descriptor
EndpointD_0:
DW              00507H, 00381H, 00004H, 0000AH          ;
EndpointD_1:
EndpointD_2:

;bLengthE_0_1:           DW  0007H   ;Size of this descriptor in bytes (7)
;bDescriptorTypeE_0_1:   DW  0005H   ;Endpoint descriptor type (5)
;bEndpointAddress_0_1:   DW  0081H   ;The address of endpoint    (81h)
;                                    ;bit 0..3: The endpoint number  0001
;                                    ;bit 4..6: reserved              000
;                                    ;bit 7   : direction for Host (0:Out/1:In)  1
;bmAttribute_0_1:        DW  0003H   ;Endpoint Attribute (03h)
;                                    ;bit 0..1: transfer type
;                                    ;      00  Control
;                                    ;      01  Isochronous
;                                    ;      10  Bulk
;                                    ;      11  Interrupt
;                                    ;All other reserved
;wMaxPacketSize_0_1:     DW  0004H, 0000H    ;Maximum packet size (4 for Mouse)
;
;bInterval_0:            DW  000AH   ;Interval for polling endpoint (10 ms)

;-----------------------------------------------------------------------------

;-----BIGIN (Class specific discriptor)
;-----------------------------------------------------------------------------
;HID descriptor
;-----------------------------------------------------------------------------
HID_0:
DW              02109H, 00100H, 00100H, 03422H, 03F00H
HID_1:
HID_2:

;bLengthH_0:           DW  0009H   ;Size of this descriptor in bytes (9)
;bDescriptor_0:        DW  0021H   ;HID Descriptor type (1)  (MemPhis)
;bcdHID_0:             DW  0000H, 0001H  ;HID Class spec. release number (1.00)
;bCountryCode_0:       DW  0000H   ;Hardware target country
;bNumDescriptors_0:    DW  0001h   ;Number of HID class descriptors to follow(只附带一个HID-class的 descriptor)
;bDescriptorType_0:    DW  0022H   ;Entity(即Report) descriptor type(第一个HID-class descriptor的type)
;wEntityLength_0:      DW  0034H   ;Entity descriptor length(第一个HID-class descriptor的长度)
;-----------------------------------------------------------------------------

;Entity descriptor
; 在HT82K96E USB+PS2 optical mouse的应用中只用到Entity_0,其馀可忽略
Entity_2:
;-----------------------------------------------------------------------------
dw              00105H, 00209H, 001A1H, 00109H, 000A1H, 00905H, 00119H, 00529H
DW              00015H, 00125H, 00595H, 00175H, 00281H, 00195H, 00375H, 00181H
DW              00105H, 03009H, 03109H, 03809H, 03f15h, 02581h, 03f7fh, 00875H, 00595H
DW              00681H, 03fC0h, 03fC0H  
;-----------------------------------------------------------------------------
Entity_1:       ; For Keyboard interface ; 总共95个bytes(5FH个)(C0H为最後一个byte)
dw              00105h, 03f09h, 03f80h, 001a1h, 00185h, 03f19h, 02981h, 01583h
dw              02500h, 03f01h, 00395h, 00175h, 00281h, 00195h, 00575h, 00181h
dw              03fc0h
dw              00c05h, 00109h, 001a1h, 00285h, 00015h, 00125h, 03f09h, 009e9h
dw              009eah, 009e2h, 019cdh, 029b5h, 03fb8h, 00175h, 00895h, 00281h
dw              03f0ah, 0018ah, 0211ah, 02a02h, 00227h, 00281h, 03f0ah, 00193h
dw              03f0ah, 00196h, 03f0ah, 00192h, 03f0ah, 0019eh, 03f0ah, 00194h
dw              0060ah, 00902h, 009b2h, 03fb4h, 00281h, 000c0h
;-----------------------------------------------------------------------------
Entity_0:       ; For Mouse interface ; 总共52个bytes(34H个)(10/21/2002 modified by dlyi)
dw              00105H, 00209H, 001A1H, 00109H, 000A1H, 00905H, 00119H, 00529H
DW              00015H, 00125H, 00595H, 00175H, 00281H, 00195H, 00375H, 00181H
DW              00105H, 03009H, 03109H, 03809H, 03F15H, 02581H, 03F7FH, 00875H
DW              00395H, 00681H, 03FC0H, 03FC0H  
;                    DW  0005H, 0001H    ;Usage Pg(Generic Desktop)
;                    DW  0009H, 0002H    ;Usage (Mouse)
;                    DW  00A1H, 0001H    ;Collection: (Application)
;
;                    DW  0009H, 0001H    ;Usage (Pointer)
;                    DW  00A1H, 0000H    ;Collection (Linked)
;
;                    DW  0005H, 0009H    ;Usage(Button)
;                    DW  0019H, 0001H    ;Usage Min (#)
;                    DW  0029H, 0005H    ;Usage Max (#)
;                    DW  0015H, 0000H    ;Log Min (0)
;                    DW  0025H, 0001H    ;Log Max (1)
;                    DW  0095H, 0005H    ;Report count (5)
;                    DW  0075H, 0001H    ;Report Size (1)
;                    DW  0081H, 0002H    ;Input: (Data, Variable, Absolute)
;                    DW  0095H, 0001H    ;Report Count (1)
;                    DW  0075H, 0003H    ;Report Size (3)
;                    DW  0081H, 0001H    ;Input: (Constant)
;
;                    DW  0005H, 0001H    ;Usage Pg (Generic Desktop)
;                    DW  0009H, 0030H    ;Usage (X)
;                    DW  0009H, 0031H    ;Usage (Y)
;                    DW  0009H, 0038H    ;Usage (Wheel-Z)
;                    DW  0015H, 0081H    ;Log Min (-127)
;                    DW  0025H, 007FH    ;Log Max (127)
;                    DW  0075H, 0008H    ;Report Size (8)
;                    DW  0095H, 0003H    ;Report Count (3)
;                    DW  0081H, 0006H    ;Input: (Data, Variable, Relative)
;
;                    DW  00C0H           ;End Collection
;                    DW  00C0H           ;End Collection (52)
;-----------------------------------------------------------------------------
                        
;-----------------------------------------------------------------------------
; Remark : ASCII code table
;   SPACE(20H)
;   0(30H) 1(31H) 2(32H) 3(33H) 4(34H) 5(35H) 6(36H) 7(37H) 8(38H) 9(39H)
;   A(41H) B(42H) C(43H) D(44H) E(45H) F(46H) G(47H) H(48H) I(49H) J(4AH) K(4BH) L(4CH) M(4DH)
;   N(4EH) O(4FH) P(50H) Q(51H) R(52H) S(53H) T(54H) U(55H) V(56H) W(57H) X(58H) Y(59H) Z(5AH)
;   a(61H) b(62H) c(63H) d(64H) e(65H) f(66H) g(67H) h(68H) i(69H) j(6AH) k(6BH) l(6CH) m(6DH)
;   n(6EH) o(6FH) p(70H) q(71H) r(72H) s(73H) t(74H) u(75H) v(76H) w(77H) x(78H) y(79H) z(7AH)
;-----------------------------------------------------------------------------
USB_mouse_chk:
LANGID:
dw      0304h                           ; 04(=descriptor size); 03(=STRING descriptor type)
dw      00409h                          ; 09H(=LANG_ID_L语言:English); 04(=LANG_ID_H:次语言US)

ManufactureS:    ;"HOLTEK "
dw      0030eh                          ; 0E(=descriptor size); 03(=STRING descriptor type)
dw      00048h                          ; Two-byte LANGID "H"
dw      0004fh                          ; Two-byte LANGID "O"
dw      0004ch                          ; Two-byte LANGID "L"
dw      00054h                          ; Two-byte LANGID "T"
dw      00045h                          ; Two-byte LANGID "E"
dw      0004bh                          ; Two-byte LANGID "K"

ProductS:               ;USB Optical Mouse for 400 or 800 DPI
dw      00324H ;0034Ah                                                          ;
dw      00055h, 00053h, 00042h, 00020h                                  ; "USB "
dw      0004fh, 00070h, 00074h, 00069h, 00063h, 00061h, 0006ch, 00020h  ; "Optical "
dw      0004dh, 0006fh, 00075h, 00073h, 00065h, 00020H                  ; "Mouse "
;dw      00066H, 0006FH, 00072H, 00020H                                  ; "for "
;dw      00034H, 00030H, 00030H, 00020H                                  ; "400 "
;dw      0006FH, 00072H, 00020H                                          ; "or "
;dw      00038H, 00030H, 00030H, 00020H                                  ; "800 "
;dw      00044H, 00050H, 00049H                                          ; "DPI"
;-----------------------------------------------------------------------------

;-----END (Class specific discriptor)
PUBLIC                  DeviceD
PUBLIC                  ConfigurationD
PUBLIC                  InterfaceD_0
PUBLIC                  EndpointD_0
PUBLIC                  HID_0
PUBLIC                  Entity_0
PUBLIC                  InterfaceD_1
PUBLIC                  EndpointD_1
PUBLIC                  HID_1
PUBLIC                  Entity_1
PUBLIC                  Entity_2
PUBLIC                  InterfaceD_2
PUBLIC                  EndpointD_2
PUBLIC                  HID_2
public                  LANGID
public                  ManufactureS
public                  ProductS

public                  Wtotallength
;public                  Entity_length
public                  bNumberInterface

END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -