📄 enchid.lst
字号:
00CC C3 81 [05] jc ep0_out_received
00CE
00CE ep0_done:
00CE 2B [04] pop A
00CF 2C [04] pop X
00D0 73 [08] reti
00D1
00D1 ep0_setup_received:
00D1
00D1 19 01 [04] mov A, NAK_IN_OUT ; clear setup bit to enable
00D3 2A 12 [05] iowr ep0_mode ; writes to EP0 DMA buffer
00D5
00D5
00D5 1A F8 [06] mov A, [bmRequestType] ; compact bmRequestType into 5 bit field
00D7 10 E3 [04] and A, E3h ; clear bits 4-3-2, these unused for our purposes
00D9 2D [05] push A ; store value
00DA 3C [04] asr A ; move bits 7-6-5 into 4-3-2's place
00DB 3C [04] asr A
00DC 3C [04] asr A
00DD 31 2F [05] mov [int_temp], A ; store shifted value
00DF 2B [04] pop A ; get original value
00E0 0E 2F [06] or A, [int_temp] ; or the two to get the 5-bit field
00E2 10 1F [04] and A, 1Fh ; clear bits 7-6-5 (asr wraps bit7)
00E4 3B [04] asl A ; shift to index jumptable
00E5
00E5 ;Use bmRequestType to find out whether the request is host-to-device (h2d)
00E5 ;or device-to-host (d2h), and whether the request is for the device, an ;interface, or an endpoint.
00E5 E6 00 [07] jacc bmRequestType_jumptable ; jump to handle bmRequestType
00E7
00E7 ;Use the request's value to decide where to jump.
00E7 ;Shift left to double the request's value because the entries in the jumptable
00E7 ;are two bytes each.
00E7
00E7 h2d_std_device:
00E7 1A F9 [06] mov A, [bRequest]
00E9 3B [04] asl A
00EA E6 40 [07] jacc h2d_std_device_jumptable
00EC
00EC h2d_std_interface:
00EC 1A F9 [06] mov A, [bRequest]
00EE 3B [04] asl A
00EF E6 54 [07] jacc h2d_std_interface_jumptable
00F1
00F1 h2d_std_endpoint:
00F1 1A F9 [06] mov A, [bRequest]
00F3 3B [04] asl A
00F4 E6 6C [07] jacc h2d_std_endpoint_jumptable
00F6
00F6 ;I added this jump for set_report requests
00F6 h2d_class_interface:
00F6 1A F9 [06] mov A, [bRequest]
00F8 3B [04] asl A
00F9 E6 74 [07] jacc h2d_class_interface_jumptable
00FB
00FB d2h_std_device:
00FB 1A F9 [06] mov A, [bRequest]
00FD 3B [04] asl A
00FE 20 [04] NOP
00FF 1F [04] XPAGE
0100 E6 8C [07] jacc d2h_std_device_jumptable
0102
0102 d2h_std_interface:
0102 1A F9 [06] mov A, [bRequest]
0104 3B [04] asl A
0105 E6 9E [07] jacc d2h_std_interface_jumptable
0107
0107 d2h_std_endpoint:
0107 1A F9 [06] mov A, [bRequest]
0109 3B [04] asl A
010A E6 B4 [07] jacc d2h_std_endpoint_jumptable
010C
010C ;;************ DEVICE REQUESTS **************
010C
010C set_device_address: ; SET ADDRESS
010C 19 00 [04] mov A, ADDRESS_CHANGE_PENDING ; set flag to indicate we
010E 31 27 [05] mov [ep0_in_flag], A ; need to change address on
0110 1A FA [06] mov A, [wValuelo]
0112 31 2E [05] mov [pending_data], A
0114 83 19 [05] jmp initialize_no_data_control
0116
0116 set_device_configuration: ; SET CONFIGURATION
0116 1A FA [06] mov A, [wValuelo]
0118 16 01 [04] cmp A, 01h
011A A1 28 [05] jz configure_device
011C ;0 means unconfigure the device.
011C unconfigure_device: ; set device as unconfigured
011C 31 28 [05] mov [configuration], A
011E 19 00 [04] mov A, DISABLE ; disable endpoint 1
0120 2A 14 [05] iowr ep1_mode
0122 19 01 [04] mov A, EP0_INT ; turn off endpoint 1 interrupts
0124 2A 21 [05] iowr endpoint_int
0126 81 48 [05] jmp set_device_configuration_done
0128 ;1 means select configuration 1 (the only configuration option).
0128 configure_device: ; set device as configured
0128 31 28 [05] mov [configuration], A
012A
012A 1A 29 [06] mov A, [ep1_stall] ; if endpoint 1 is stalled
012C 10 FF [04] and A, FFh
012E A1 36 [05] jz ep1_nak_in_out
0130 19 03 [04] mov A, STALL_IN_OUT ; set endpoint 1 mode to stall
0132 2A 14 [05] iowr ep1_mode
0134 81 3A [05] jmp ep1_set_int
0136 ep1_nak_in_out:
0136 19 01 [04] mov A, NAK_IN_OUT ; otherwise set it to NAK in/out
0138 2A 14 [05] iowr ep1_mode
013A ep1_set_int:
013A 19 03 [04] mov A, EP0_INT | EP1_INT ; enable endpoint 1 interrupt
013C 2A 21 [05] iowr endpoint_int
013E 19 00 [04] mov A, 00h
0140 31 21 [05] mov [ep1_data_toggle], A ; reset the data toggle
0142 31 F0 [05] mov [ep1_dmabuff0], A ; reset endpoint 1 fifo values
0144 31 F1 [05] mov [ep1_dmabuff1], A
0146 31 F2 [05] mov [ep1_dmabuff2], A
0148 set_device_configuration_done:
0148 19 02 [04] mov A, NO_CHANGE_PENDING
014A 31 27 [05] mov [ep0_in_flag], A
014C 83 19 [05] jmp initialize_no_data_control
014E
014E
014E get_device_status: ; GET STATUS
014E 19 02 [04] mov A, DEVICE_STATUS_LENGTH
0150 31 25 [05] mov [maximum_data_count], A
0152 19 68 [04] mov A, (device_status_wakeup_disabled - control_read_table)
0154 31 23 [05] mov [data_start], A
0156 82 EE [05] jmp initialize_control_read
0158
0158
0158 get_device_descriptor: ; GET DESCRIPTOR
0158 1A FB [06] mov A, [wValuehi]
015A 3B [04] asl A
015B E6 E6 [07] jacc get_device_descriptor_jumptable
015D
015D send_device_descriptor:
015D 19 00 [04] mov A, 00h ; get device descriptor length
015F F7 00 [14] index device_desc_table
0161 31 25 [05] mov [maximum_data_count], A
0163 19 00 [04] mov A, (device_desc_table - control_read_table)
0165 31 23 [05] mov [data_start], A
0167 82 EE [05] jmp initialize_control_read
0169
0169 send_configuration_descriptor:
0169 19 02 [04] mov A, 02h
016B F7 12 [14] index config_desc_table:
016D 31 25 [05] mov [maximum_data_count], A
016F 19 12 [04] mov A, (config_desc_table - control_read_table)
0171 31 23 [05] mov [data_start], A
0173 82 EE [05] jmp initialize_control_read
0175
0175 send_string_descriptor:
0175 1A FA [06] mov A, [wValuelo]
0177 3B [04] asl A
0178 E6 F2 [07] jacc string_jumptable:
017A
017A language_string:
017A 19 00 [04] mov A, 00h
017C F7 75 [14] index ilanguage_string
017E 31 25 [05] mov [maximum_data_count], A
0180 19 75 [04] mov A, (ilanguage_string - control_read_table)
0182 31 23 [05] mov [data_start], A
0184 82 EE [05] jmp initialize_control_read
0186
0186 manufacturer_string:
0186 19 00 [04] mov A, 00h
0188 F7 79 [14] index imanufacturer_string
018A 31 25 [05] mov [maximum_data_count], A
018C 19 79 [04] mov A, (imanufacturer_string - control_read_table)
018E 31 23 [05] mov [data_start], A
0190 82 EE [05] jmp initialize_control_read
0192
0192 product_string:
0192 19 00 [04] mov A, 00h
0194 F7 B1 [14] index iproduct_string
0196 31 25 [05] mov [maximum_data_count], A
0198 19 B1 [04] mov A, (iproduct_string - control_read_table)
019A 31 23 [05] mov [data_start], A
019C 82 EE [05] jmp initialize_control_read
019E
019E send_interface_descriptor:
019E 19 00 [04] mov A, 00h ; get interface descriptor length
01A0 F7 1B [14] index interface_desc_table
01A2 31 25 [05] mov [maximum_data_count], A
01A4 19 1B [04] mov A, (interface_desc_table - control_read_table)
01A6 31 23 [05] mov [data_start], A
01A8 82 EE [05] jmp initialize_control_read
01AA
01AA send_endpoint_descriptor:
01AA 19 00 [04] mov A, 00h ; get endpoint descriptor length
01AC F7 2D [14] index endpoint_desc_table
01AE 31 25 [05] mov [maximum_data_count], A
01B0 19 2D [04] mov A, (endpoint_desc_table - control_read_table)
01B2 31 23 [05] mov [data_start], A
01B4 82 EE [05] jmp initialize_control_read
01B6
01B6
01B6 get_device_configuration: ; GET CONFIGURATION
01B6 19 01 [04] mov A, DEVICE_CONFIG_LENGTH
01B8 31 25 [05] mov [maximum_data_count], A
01BA 1A 28 [06] mov A, [configuration] ; test configuration status
01BC 10 FF [04] and A, FFh
01BE A1 C6 [05] jz device_unconfigured
01C0 device_configured: ; send configured status
01C0 19 6A [04] mov A, (device_configured_table - control_read_table)
01C2 31 23 [05] mov [data_start], A
01C4 82 EE [05] jmp initialize_control_read
01C6 device_unconfigured: ; send unconfigured status
01C6 19 6B [04] mov A, (device_unconfigured_table - control_read_table)
01C8 31 23 [05] mov [data_start], A
01CA 82 EE [05] jmp initialize_control_read
01CC
01CC
01CC ;;************ INTERFACE REQUESTS ***********
01CC
01CC set_interface_interface: ; SET INTERFACE
01CC 1A FA [06] mov A, [wValuelo]
01CE 16 00 [04] cmp A, 00h ; there are no alternate interfaces
01D0 A1 D4 [05] jz alternate_supported ; for this device
01D2 alternate_not_supported: ; if the host requests any other
01D2 83 24 [05] jmp request_not_supported ; alternate than 0, stall.
01D4 alternate_supported:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -