drawusb.lst

来自「单片机USB接口模拟键盘,该程序可以控制PC机的PS/2键盘的NUM LOCK和」· LST 代码 · 共 1,077 行 · 第 1/5 页

LST
1,077
字号
                                   (0145) IF (USB_CB_SRC_d2h_std_ifc_01 & USB_NOT_SUPPORTED)
                                   (0146) export  USB_CB_d2h_std_ifc_01
                                   (0147) USB_CB_d2h_std_ifc_01:
                                   (0148) ENDIF
                                   (0149) IF (USB_CB_SRC_d2h_std_ifc_02 & USB_NOT_SUPPORTED)
                                   (0150) export  USB_CB_d2h_std_ifc_02
                                   (0151) USB_CB_d2h_std_ifc_02:
                                   (0152) ENDIF
                                   (0153) IF (USB_CB_SRC_d2h_std_ifc_03 & USB_NOT_SUPPORTED)
                                   (0154) export  USB_CB_d2h_std_ifc_03
                                   (0155) USB_CB_d2h_std_ifc_03:
                                   (0156) ENDIF
                                   (0157) IF (USB_CB_SRC_d2h_std_ifc_04 & USB_NOT_SUPPORTED)
                                   (0158) export  USB_CB_d2h_std_ifc_04
                                   (0159) USB_CB_d2h_std_ifc_04:
                                   (0160) ENDIF
                                   (0161) IF (USB_CB_SRC_d2h_std_ifc_05 & USB_NOT_SUPPORTED)
                                   (0162) export  USB_CB_d2h_std_ifc_05
                                   (0163) USB_CB_d2h_std_ifc_05:
                                   (0164) ENDIF
                                   (0165) IF (USB_CB_SRC_d2h_std_ifc_06 & USB_NOT_SUPPORTED)
                                   (0166) export  USB_CB_d2h_std_ifc_06
                                   (0167) USB_CB_d2h_std_ifc_06:
                                   (0168) ENDIF
                                   (0169) IF (USB_CB_SRC_d2h_std_ifc_07 & USB_NOT_SUPPORTED)
                                   (0170) export  USB_CB_d2h_std_ifc_07
                                   (0171) USB_CB_d2h_std_ifc_07:
                                   (0172) ENDIF
                                   (0173) IF (USB_CB_SRC_d2h_std_ifc_08 & USB_NOT_SUPPORTED)
                                   (0174) export  USB_CB_d2h_std_ifc_08
                                   (0175) USB_CB_d2h_std_ifc_08:
                                   (0176) ENDIF
                                   (0177) IF (USB_CB_SRC_d2h_std_ifc_09 & USB_NOT_SUPPORTED)
                                   (0178) export  USB_CB_d2h_std_ifc_09
                                   (0179) USB_CB_d2h_std_ifc_09:
                                   (0180) ENDIF
                                   (0181) IF (USB_CB_SRC_d2h_std_ifc_10 & USB_NOT_SUPPORTED)
                                   (0182) export  USB_CB_d2h_std_ifc_10
                                   (0183) USB_CB_d2h_std_ifc_10:
                                   (0184) ENDIF
                                   (0185) 
                                   (0186) ; d2h_std_ifc
                                   (0187) IF (USB_CB_SRC_h2d_std_ifc_00 & USB_NOT_SUPPORTED)
                                   (0188) export  USB_CB_h2d_std_ifc_00
                                   (0189) USB_CB_h2d_std_ifc_00:
                                   (0190) ENDIF
                                   (0191) 
                                   (0192) ; d2h_std_ep
                                   (0193) IF (USB_CB_SRC_d2h_std_ep_00 & USB_NOT_SUPPORTED)
                                   (0194) export  USB_CB_d2h_std_ep_00
                                   (0195) USB_CB_d2h_std_ep_00:
                                   (0196) ENDIF
                                   (0197) 
                                   (0198) ; h2d_std_ep
                                   (0199) IF (USB_CB_SRC_h2d_std_ep_00 & USB_NOT_SUPPORTED)
                                   (0200) export  USB_CB_h2d_std_ep_00
                                   (0201) USB_CB_h2d_std_ep_00:
                                   (0202) ENDIF
                                   (0203) IF (USB_CB_SRC_h2d_std_ep_01 & USB_NOT_SUPPORTED)
                                   (0204) export  USB_CB_h2d_std_ep_01
                                   (0205) USB_CB_h2d_std_ep_01:
                                   (0206) ENDIF
                                   (0207) IF (USB_CB_SRC_h2d_std_ep_02 & USB_NOT_SUPPORTED)
                                   (0208) export  USB_CB_h2d_std_ep_02
                                   (0209) USB_CB_h2d_std_ep_02:
                                   (0210) ENDIF
                                   (0211) IF (USB_CB_SRC_h2d_std_ep_03 & USB_NOT_SUPPORTED)
                                   (0212) export  USB_CB_h2d_std_ep_03
                                   (0213) USB_CB_h2d_std_ep_03:
                                   (0214) ENDIF
                                   (0215) 
                                   (0216) export  USB_Not_Supported
                                   (0217) export _USB_Not_Supported
                                   (0218) USB_Not_Supported:
                                   (0219) _USB_Not_Supported:
0232: 50 00    MOV   A,0           (0220)    MOV    A, 0                         ; Count 0
0234: 57 03    MOV   X,3           (0221)    MOV    X, USB_MODE_STALL_IN_OUT     ; Stall the request
0236: 7D 04 BB LJMP  0x04BB        (0222)    LJMP   USB_EP0_UPD_MODE_EXIT
0239: 00       SWI   
023A: 01 00    ADD   A,0
023C: 02 00    ADD   A,[a_ram]
023E: 49 00 00 TST   REG[0],0
0241: DE 55    JNC   0x0097
                                   (0223) ;-----------------------------------------------------------------------------
                                   (0224) ;  FUNCTION NAME: USB_CB_d2h_std_dev_00
                                   (0225) ;
                                   (0226) ;  DESCRIPTION:   Get Device Status
                                   (0227) ;
                                   (0228) ;****************************************************************
                                   (0229) ; STANDARD DEVICE IN REQUEST: Get_Device_Status
                                   (0230) ;****************************************************************
                                   (0231) ;
                                   (0232) ; bmRequestType  : (IN | STANDARD | DEVICE)       = 80h     
                                   (0233) ; bRequest       : GET_STATUS                     = 00h    
                                   (0234) ; wValue         : RESERVED                       = 0000h  
                                   (0235) ; wIndex         : RESERVED                       = 0000h
                                   (0236) ; wLength        : SIZEOF_ENDPOINT_STATUS         = 0002h  
                                   (0237) ; 
                                   (0238) ; The GET_DEVICE_STATUS request returns the current device status.
                                   (0239) ;
                                   (0240) ;****************************************************************
                                   (0241) ;-----------------------------------------------------------------------------
                                   (0242) ;
                                   (0243) ;  ARGUMENTS:
                                   (0244) ;
                                   (0245) ;  RETURNS:
                                   (0246) ;
                                   (0247) ;  SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
                                   (0248) ;
                                   (0249) ;  THEORY of OPERATION or PROCEDURE:
                                   (0250) ;
                                   (0251) ;-----------------------------------------------------------------------------
                                   (0252) IF (USB_CB_SRC_d2h_std_dev_00 & USB_UM_SUPPLIED)
                                   (0253) .LITERAL
                                   (0254) GetStatusTransferDescrTable:
                                   (0255)     TD_START_TABLE 1                   ; One entry
                                   (0256)     TD_ENTRY    USB_DS_RAM, 2, USB_TransferBuffer, NULL_PTR  ; Intermediate Buffer
                                   (0257) .ENDLITERAL
                                   (0258) export  USB_CB_d2h_std_dev_00
                                   (0259) USB_CB_d2h_std_dev_00:
0243: 5C       MOV   X,A           (0260)     MOV     [USB_t2], 0                ; Use the UM temp var--Selector
0244: 00       SWI   
                                   (0261) 
0245: 55 4A 00 MOV   [USB_TransferBuffer+1],0(0262)     MOV     [USB_TransferBuffer+1], 0  ; Use the UM Transfer Buffer
0248: 5F 49 42 MOV   [USB_TransferType+1],[USB_DeviceStatus](0263)     MOV     [USB_TransferBuffer], [USB_DeviceStatus]
                                   (0264) 
024B: 50 02    MOV   A,2           (0265)     MOV     A,>GetStatusTransferDescrTable  ; Get the ROM Address MSB
024D: 57 39    MOV   X,57          (0266)     MOV     X,<GetStatusTransferDescrTable  ; Get the ROM Address LSB
024F: 82 56    JMP   0x04A6        (0267)     JMP     USB_GetTableEntry_Local_Std
                                   (0268) ENDIF
                                   (0269) ;-----------------------------------------------------------------------------
                                   (0270) ; FUNCTION NAME: USB_CB_d2h_std_dev_06
                                   (0271) ;
                                   (0272) ; DESCRIPTION:   Get Device Descriptor
                                   (0273) ;
                                   (0274) ;****************************************************************
                                   (0275) ; STANDARD DEVICE IN REQUEST: Get_Device_Descriptor
                                   (0276) ;****************************************************************
                                   (0277) ;
                                   (0278) ; bmRequestType  : (IN | STANDARD | DEVICE)       = 80h
                                   (0279) ; bRequest       : GET_DESCRIPTOR                 = 06h    
                                   (0280) ; wValue         : DESCRIPTOR TYPE | INDEX        = xxxxh  
                                   (0281) ; wIndex         : ZERO or LANG_ID                = xxxxh
                                   (0282) ; wLength        : SIZEOF_DESCRIPTOR              = --xxh  
                                   (0283) ; 
                                   (0284) ; The GET_DEVICE_DESCRIPTOR returns the specified descriptor if 
                                   (0285) ; the descriptor exists. 
                                   (0286) ; 
                                   (0287) ; The upper byte of wValue contains the descriptor type and 
                                   (0288) ; the lower byte contains the descriptor index. wIndex 
                                   (0289) ; contains either 0000h or the Language ID. wLength contains 
                                   (0290) ; the descriptor length. The actual descriptor information is 
                                   (0291) ; transferred in subsequent data packets. 
                                   (0292) ;
                                   (0293) ;****************************************************************
                                   (0294) ;
                                   (0295) ;-----------------------------------------------------------------------------
                                   (0296) ;
                                   (0297) ;  ARGUMENTS:
                                   (0298) ;
                                   (0299) ;  RETURNS:
                                   (0300) ;
                                   (0301) ;  SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
                                   (0302) ;
                                   (0303) ;  THEORY of OPERATION or PROCEDURE:
                                   (0304) ;
                                   (0305) ;-----------------------------------------------------------------------------
                                   (0306) IF (USB_CB_SRC_d2h_std_dev_06 & USB_UM_SUPPLIED)
                                   (0307) export  USB_CB_d2h_std_dev_06
                                   (0308) USB_CB_d2h_std_dev_06:
                                   (0309) ;-----------------------------------------------------------------------------
                                   (0310) ; Dispatch to the proper handler
                                   (0311) ;-----------------------------------------------------------------------------
0251: 5D 53    MOV   A,REG[83]     (0312)     MOV     A, REG[USB_EP0DATA+wValueHi] ; Get the descrptor type
0253: 64       ASL   A             (0313)     ASL     A                          ; Make it into a offset
0254: 39 08    CMP   A,8           (0314)     CMP     A, GET_DESCR_DISPATCH_SIZE         ; Validity check
0256: DF DB    JNC   0x0232        (0315)     JNC     USB_Not_Supported
                                   (0316) 
0258: E0 01    JACC  0x025A        (0317)     JACC    GET_DESCR_DISPATCH
                                   (0318) 
                                   (0319) GET_DESCR_DISPATCH:
025A: 8F D7    JMP   0x0232        (0320)     JMP     USB_Not_Supported          ; Invalid
025C: 80 28    JMP   0x0285        (0321)     JMP     USB_SendDeviceDescr        ; Device Descriptor
025E: 80 03    JMP   0x0262        (0322)     JMP     USB_SendConfigDescr        ; Configuration Descriptor
                                   (0323) IF  USB_bNumStringDescrs               ; Number of String Descriptor defined with the Wizard
                                   (0324)     JMP     USB_SendStringDescr        ; String Descriptor
                                   (0325) ELSE
0260: 8F D1    JMP   0x0232        (0326)     JMP     USB_Not_Supported          ; Not supported if we don't have
                                   (0327)                                             ; any String Descriptor
                                   (0328) ENDIF
                                   (0329) GET_DESCR_DISPATCH_END:
                                   (0330) GET_DESCR_DISPATCH_SIZE: EQU (GET_DESCR_DISPATCH_END - GET_DESCR_DISPATCH)     
                                   (0331) ;-----------------------------------------------------------------------------
                                   (0332) ; Configuration Descriptor Handler
                                   (0333) ;-----------------------------------------------------------------------------
                                   (0334) USB_SendConfigDescr:
0262: 94 16    CALL  0x067A        (0335)     CALL    USB_GET_DEVICE_TABLE_ENTRY
0264: 4B       SWAP  A,X           (0336)     SWAP    A, X
0265: 01 02    ADD   A,2           (0337)     ADD     A, 2                       ; We want the pointer to the descriptor table (second entry)
0267: 4B       SWAP  A,X           (0338)     SWAP    A, X
0268: 09 00    ADC   A,0           (0339)     ADC     A, 0                       ; Don't forget the carry
026A: 55 5C 5D MOV   [USB_t2],93   (0340)     MOV    [USB_t2], USB_t1            ; Set up the destination  
026D: 93 FA    CALL  0x0669        (0341)     CALL    USB_GETWORD                ; Get the pointer
                                   (0342)     
026F: 51 5D    MOV   A,[USB_t1]    (0343)     MOV     A, [USB_t1]                ; Pointer MSB
0271: 58 5E    MOV   X,[USB_t0]    (0344)     MOV     X, [USB_t1+1]              ; Pointer LSB
                                   (0345)     
0273: 08       PUSH  A             (0346)     PUSH    A                          ; Save the MSB
                                   (0347)     
0274: 5D 52    MOV   A,REG[82]     (0348)     MOV     A, REG[USB_EP0DATA+wValueLo]  ; Get the descrptor index
0276: 53 5C    MOV   [USB_t2],A    (0349)     MOV     [USB_t2], A                ; Use the UM temp var--Selector
0278: 18       POP   A             (0350)     POP     A                          ; Need the MSB for the range check
0279: 08       PUSH  A             (0351)     PUSH    A                          ; Save the MSB for a

⌨️ 快捷键说明

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