📄 enchid.lst
字号:
01D4 19 02 [04] mov A, NO_CHANGE_PENDING
01D6 31 27 [05] mov [ep0_in_flag], A
01D8 83 19 [05] jmp initialize_no_data_control
01DA
01DA
01DA get_interface_status: ; GET STATUS
01DA 19 02 [04] mov A, INTERFACE_STATUS_LENGTH
01DC 31 25 [05] mov [maximum_data_count], A
01DE 19 70 [04] mov A, (interface_status_table - control_read_table)
01E0 31 23 [05] mov [data_start], A
01E2 82 EE [05] jmp initialize_control_read
01E4
01E4
01E4 get_interface_interface: ; GET INTERFACE
01E4 19 01 [04] mov A, INTERFACE_ALTERNATE_LENGTH
01E6 31 25 [05] mov [maximum_data_count], A
01E8 19 72 [04] mov A, (interface_alternate_table - control_read_table)
01EA 31 23 [05] mov [data_start], A
01EC 82 EE [05] jmp initialize_control_read
01EE
01EE
01EE set_interface_idle: ; SET IDLE
01EE 1A FB [06] mov A, [wValuehi] ; test if new idle time
01F0 16 00 [04] cmp A, 00h ; disables idle timer
01F2 A2 04 [05] jz idle_timer_disable
01F4
01F4 1A 30 [06] mov A, [idle_timer] ; test if less than 4ms left
01F6 16 01 [04] cmp A, 01h
01F8 A2 08 [05] jz set_idle_last_not_expired
01FA
01FA 1A FB [06] mov A, [wValuehi] ; test if time left less than
01FC 08 30 [06] sub A, [idle_timer] ; new idle value
01FE 20 [04] NOP
01FF 1F [04] XPAGE
0200 D2 18 [05] jnc set_idle_new_timer_less
0202
0202 82 24 [05] jmp set_idle_normal
0204
0204 idle_timer_disable:
0204 31 2A [05] mov [idle], A ; disable idle timer
0206 82 2E [05] jmp set_idle_done
0208
0208 set_idle_last_not_expired:
0208 19 02 [04] mov A, EVENT_PENDING ; send report immediately
020A 31 2D [05] mov [event_machine], A
020C 19 00 [04] mov A, 00h ; reset idle prescaler
020E 31 31 [05] mov [idle_prescaler], A
0210 1A FB [06] mov A, [wValuehi] ; set new idle value
0212 31 30 [05] mov [idle_timer], A
0214 31 2A [05] mov [idle], A
0216 82 2E [05] jmp set_idle_done
0218
0218 set_idle_new_timer_less:
0218 19 00 [04] mov A, 00h
021A 31 31 [05] mov [idle_prescaler], A ; reset idle prescaler
021C 1A FB [06] mov A, [wValuehi]
021E 31 30 [05] mov [idle_timer], A ; update idle time value
0220 31 2A [05] mov [idle], A
0222 82 2E [05] jmp set_idle_done
0224
0224 set_idle_normal:
0224 19 00 [04] mov A, 00h ; reset idle prescaler
0226 31 31 [05] mov [idle_prescaler], A
0228 1A FB [06] mov A, [wValuehi] ; update idle time value
022A 31 30 [05] mov [idle_timer], A
022C 31 2A [05] mov [idle], A
022E
022E set_idle_done:
022E 19 02 [04] mov A, NO_CHANGE_PENDING ; respond with no-data control
0230 31 27 [05] mov [ep0_in_flag], A ; transaction
0232 83 19 [05] jmp initialize_no_data_control
0234
0234
0234 set_interface_protocol: ; SET PROTOCOL
0234 1A FA [06] mov A, [wValuelo]
0236 31 2B [05] mov [protocol], A ; set protocol value
0238 19 02 [04] mov A, NO_CHANGE_PENDING
023A 31 27 [05] mov [ep0_in_flag], A ; respond with no-data control
023C 83 19 [05] jmp initialize_no_data_control ; transaction
023E
023E
023E get_interface_report: ; GET REPORT
023E ; I haven't tested this request.
023E ; (No way to force a get_report request for an In report.)
023E ; But it could be adapted to handle device-to-host Feature reports.
023E 19 80 [04] mov A, DATA_TOGGLE ; set data toggle to DATA ONE
0240 31 22 [05] mov [ep0_data_toggle], A
0242 ;Send NAK in response to any new INs or OUTs while writing to the buffers.
0242 19 01 [04] mov A, NAK_IN_OUT ; clear setup bit to write to
0244 2A 12 [05] iowr ep0_mode ; endpoint fifo
0246
0246 ;If the host requests the In report with a control transfer,
0246 ;copy the In report data from Endpoint 1's buffer to Endpoint 0.
0246 1A F0 [06] mov A, [ep1_dmabuff0]
0248 31 F8 [05] mov [ep0_dmabuff0], A
024A
024A 1A F1 [06] mov A, [ep1_dmabuff1]
024C 31 F9 [05] mov [ep0_dmabuff1], A
024E
024E 19 02 [04] mov A, CONTROL_READ_DATA ; set state machine state
0250 31 26 [05] mov [ep0_in_machine], A
0252 1C 02 [04] mov X, 02h ; set number of bytes to transfer to 2
0254 83 4D [05] jmp dmabuffer_load_done ; jump to finish transfer
0256
0256
0256 get_interface_idle: ; GET IDLE
0256 19 80 [04] mov A, DATA_TOGGLE ; set data toggle to DATA ONE
0258 31 22 [05] mov [ep0_data_toggle], A
025A 19 01 [04] mov A, NAK_IN_OUT ; clear setup bit to write to
025C 2A 12 [05] iowr ep0_mode ; endpoint fifo
025E
025E 1A 2A [06] mov A, [idle] ; copy over idle time
0260 31 F8 [05] mov [ep0_dmabuff0], A
0262
0262 19 02 [04] mov A, CONTROL_READ_DATA ; set state machine state
0264 31 26 [05] mov [ep0_in_machine], A
0266 1C 01 [04] mov X, 01h ; set number of byte to transfer to 3
0268 83 4D [05] jmp dmabuffer_load_done ; jump to finish transfer
026A
026A
026A get_interface_protocol: ; GET PROTOCOL
026A 19 01 [04] mov A, INTERFACE_PROTOCOL_LENGTH
026C 31 25 [05] mov [maximum_data_count], A ; get offset of device descriptor table
026E 1A 2B [06] mov A, [protocol]
0270 10 01 [04] and A, 01h
0272 A2 7A [05] jz boot_protocol
0274 report_protocol:
0274 19 74 [04] mov A, (interface_report_protocol - control_read_table)
0276 31 23 [05] mov [data_start], A
0278 82 EE [05] jmp initialize_control_read ; get ready to send data
027A boot_protocol:
027A 19 73 [04] mov A, (interface_boot_protocol - control_read_table)
027C 31 23 [05] mov [data_start], A
027E 82 EE [05] jmp initialize_control_read ; get ready to send data
0280
0280
0280 get_interface_hid:
0280 1A FB [06] mov A, [wValuehi]
0282 16 21 [04] cmp A, 21h
0284 A2 8C [05] jz get_interface_hid_descriptor
0286 16 22 [04] cmp A, 22h
0288 A2 98 [05] jz get_interface_hid_report
028A 83 24 [05] jmp request_not_supported
028C
028C get_interface_hid_descriptor: ; GET HID CLASS DESCRIPTOR
028C 19 00 [04] mov A, 00h ; get hid decriptor length
028E F7 24 [14] index hid_desc_table
0290 31 25 [05] mov [maximum_data_count], A ; get offset of device descriptor table
0292 19 24 [04] mov A, (hid_desc_table - control_read_table)
0294 31 23 [05] mov [data_start], A
0296 82 EE [05] jmp initialize_control_read ; get ready to send data
0298
0298
0298 get_interface_hid_report: ; GET HID REPORT DESCRIPTOR
0298 19 07 [04] mov A, 07h ; get hid report descriptor length
029A F7 24 [14] index hid_desc_table
029C 31 25 [05] mov [maximum_data_count], A ; get offset of device descriptor table
029E 19 34 [04] mov A, (hid_report_desc_table - control_read_table)
02A0 31 23 [05] mov [data_start], A
02A2 82 EE [05] jmp initialize_control_read ; get ready to send data
02A4
02A4
02A4 ;;************ ENDPOINT REQUESTS ************
02A4
02A4 clear_endpoint_feature: ; CLEAR FEATURE
02A4 1A FA [06] mov A, [wValuelo]
02A6 16 00 [04] cmp A, ENDPOINT_STALL
02A8 B3 24 [05] jnz request_not_supported
02AA 19 00 [04] mov A, 00h ; clear endpoint 1 stall
02AC 31 29 [05] mov [ep1_stall], A
02AE 19 02 [04] mov A, NO_CHANGE_PENDING ; respond with no-data control
02B0 31 27 [05] mov [ep0_in_flag], A
02B2 83 19 [05] jmp initialize_no_data_control
02B4
02B4 set_endpoint_feature: ; SET FEATURE
02B4 1A FA [06] mov A, [wValuelo]
02B6 16 00 [04] cmp A, ENDPOINT_STALL
02B8 B3 24 [05] jnz request_not_supported
02BA 19 FF [04] mov A, FFh ; stall endpoint 1
02BC 31 29 [05] mov [ep1_stall], A
02BE 19 02 [04] mov A, NO_CHANGE_PENDING ; respond with no-data control
02C0 31 27 [05] mov [ep0_in_flag], A
02C2 83 19 [05] jmp initialize_no_data_control
02C4
02C4 get_endpoint_status: ; GET STATUS
02C4 19 02 [04] mov A, ENDPOINT_STALL_LENGTH
02C6 31 25 [05] mov [maximum_data_count], A
02C8 1A 29 [06] mov A, [ep1_stall] ; test if endpoint 1 stalled
02CA 10 FF [04] and A, FFh
02CC B2 D4 [05] jnz endpoint_stalled
02CE endpoint_not_stalled: ; send no-stall status
02CE 19 6C [04] mov A, (endpoint_nostall_table - control_read_table)
02D0 31 23 [05] mov [data_start], A
02D2 82 EE [05] jmp initialize_control_read
02D4 endpoint_stalled: ; send stall status
02D4 19 6E [04] mov A, (endpoint_stall_table - control_read_table)
02D6 31 23 [05] mov [data_start], A
02D8 82 EE [05] jmp initialize_control_read
02DA
02DA
02DA ;;************ CLASS INTERFACE REQUESTS ************
02DA
02DA set_report: ; SET REPORT
02DA ;Find out how many bytes to read in the Out transaction(s) that will follow.
02DA ;This value is in WLengthlo and WLengthhi.
02DA ;Save the length in data_count.
02DA 1A FE [06] mov A, [wLengthlo]
02DC 31 24 [05] mov [data_count], A
02DE ;The Output reports are 2 bytes, so wLengthhi is unused.
02DE 19 00 [04] mov A, 0
02E0 31 FF [05] mov [wLengthhi], A
02E2
02E2 ;Unlock the counter register so it can be updated with the
02E2 ;number of bytes in the data stage
02E2 29 11 [05] iord ep0_count
02E4
02E4 ;For testing,
02E4 ;copy the b
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -