Browse Source

ch376-native: applied z88dk version 20250224

pull/592/head
Dean Netherton 11 months ago
parent
commit
eec2147826
  1. 2
      Source/HBIOS/ch376-native/Makefile
  2. 132
      Source/HBIOS/ch376-native/base-drv/ch376.c.s
  3. 2
      Source/HBIOS/ch376-native/base-drv/class_hub.c.s
  4. 2
      Source/HBIOS/ch376-native/base-drv/critical-section.c.s
  5. 218
      Source/HBIOS/ch376-native/base-drv/dev_transfers.c.s
  6. 357
      Source/HBIOS/ch376-native/base-drv/enumerate.c.s
  7. 30
      Source/HBIOS/ch376-native/base-drv/enumerate_hub.c.s
  8. 4
      Source/HBIOS/ch376-native/base-drv/enumerate_storage.c.s
  9. 64
      Source/HBIOS/ch376-native/base-drv/protocol.c.s
  10. 21
      Source/HBIOS/ch376-native/base-drv/transfers.c.s
  11. 21
      Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.s
  12. 37
      Source/HBIOS/ch376-native/base-drv/usb-init.c.s
  13. 16
      Source/HBIOS/ch376-native/base-drv/usb_state.c.s
  14. 2
      Source/HBIOS/ch376-native/base-drv/work-area.c.s
  15. 4
      Source/HBIOS/ch376-native/keyboard/class_hid.c.s
  16. 8
      Source/HBIOS/ch376-native/keyboard/class_hid_keyboard.c.s
  17. 51
      Source/HBIOS/ch376-native/keyboard/kyb-init.c.s
  18. 436
      Source/HBIOS/ch376-native/scsi-drv/class_scsi.c.s
  19. 6
      Source/HBIOS/ch376-native/scsi-drv/scsi-init.c.s
  20. 177
      Source/HBIOS/ch376-native/ufi-drv/class_ufi.c.s
  21. 6
      Source/HBIOS/ch376-native/ufi-drv/ufi-init.c.s
  22. 5
      Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.s

2
Source/HBIOS/ch376-native/Makefile

@ -12,7 +12,7 @@ ZCCFLAGS := +z80 -vn -startup=0 -clib=sdcc_iy -compiler=sdcc -Cs--std=c23 -Cs--
ZCC_PATH := $(shell command -v zcc) ZCC_PATH := $(shell command -v zcc)
DOCKER_PATH := $(shell command -v docker) DOCKER_PATH := $(shell command -v docker)
ZCC := $(shell command -v zcc >/dev/null 2>&1 && echo zcc || echo 'docker run -w /host/${PWD} -v /:/host/ -u $(shell id -u ${USER}):$(shell id -g ${USER}) -t z88dk/z88dk zcc')
ZCC := $(shell command -v zcc >/dev/null 2>&1 && echo zcc || echo 'docker run -w /host/${PWD} -v /:/host/ -u $(shell id -u ${USER}):$(shell id -g ${USER}) -t z88dk/z88dk:20250224 zcc')
ifeq ($(ZCC_PATH),) ifeq ($(ZCC_PATH),)
ifeq ($(DOCKER_PATH),) ifeq ($(DOCKER_PATH),)

132
Source/HBIOS/ch376-native/base-drv/ch376.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -56,19 +56,18 @@ _result:
; --------------------------------- ; ---------------------------------
_ch_command: _ch_command:
;source-doc/base-drv/ch376.c:10: while ((CH376_COMMAND_PORT & PARA_STATE_BUSY) && --counter != 0) ;source-doc/base-drv/ch376.c:10: while ((CH376_COMMAND_PORT & PARA_STATE_BUSY) && --counter != 0)
ld c,0xff
ld b,0xff
l_ch_command_00102: l_ch_command_00102:
ld a, +((_CH376_COMMAND_PORT) / 256) ld a, +((_CH376_COMMAND_PORT) / 256)
in a, (((_CH376_COMMAND_PORT) & 0xFF)) in a, (((_CH376_COMMAND_PORT) & 0xFF))
bit 4, a bit 4, a
jr Z,l_ch_command_00104 jr Z,l_ch_command_00104
dec c
jr NZ,l_ch_command_00102
djnz l_ch_command_00102
l_ch_command_00104: l_ch_command_00104:
;source-doc/base-drv/ch376.c:21: CH376_COMMAND_PORT = command; ;source-doc/base-drv/ch376.c:21: CH376_COMMAND_PORT = command;
ld a, l ld a, l
ld bc,_CH376_COMMAND_PORT ld bc,_CH376_COMMAND_PORT
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:22: } ;source-doc/base-drv/ch376.c:22: }
ret ret
;source-doc/base-drv/ch376.c:26: usb_error ch_long_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(5000); } ;source-doc/base-drv/ch376.c:26: usb_error ch_long_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(5000); }
@ -104,57 +103,51 @@ _ch_get_status:
ld a, +((_CH376_DATA_PORT) / 256) ld a, +((_CH376_DATA_PORT) / 256)
in a, (((_CH376_DATA_PORT) & 0xFF)) in a, (((_CH376_DATA_PORT) & 0xFF))
;source-doc/base-drv/ch376.c:36: if (ch_status >= USB_FILERR_MIN && ch_status <= USB_FILERR_MAX) ;source-doc/base-drv/ch376.c:36: if (ch_status >= USB_FILERR_MIN && ch_status <= USB_FILERR_MAX)
ld l,a
sub 0x41
cp 0x41
jr C,l_ch_get_status_00102 jr C,l_ch_get_status_00102
ld a,0xb4
sub l
cp 0xb5
jr NC,l_ch_get_status_00102
;source-doc/base-drv/ch376.c:37: return ch_status; ;source-doc/base-drv/ch376.c:37: return ch_status;
jr NC,l_ch_get_status_00126
ld l, a
jr l_ch_get_status_00126
l_ch_get_status_00102: l_ch_get_status_00102:
;source-doc/base-drv/ch376.c:39: if (ch_status == CH_CMD_RET_SUCCESS) ;source-doc/base-drv/ch376.c:39: if (ch_status == CH_CMD_RET_SUCCESS)
ld a, l
;source-doc/base-drv/ch376.c:40: return USB_ERR_OK;
sub 0x51
cp 0x51
jr NZ,l_ch_get_status_00105 jr NZ,l_ch_get_status_00105
ld l,a
;source-doc/base-drv/ch376.c:40: return USB_ERR_OK;
ld l,0x00
jr l_ch_get_status_00126 jr l_ch_get_status_00126
l_ch_get_status_00105: l_ch_get_status_00105:
;source-doc/base-drv/ch376.c:42: if (ch_status == CH_USB_INT_SUCCESS) ;source-doc/base-drv/ch376.c:42: if (ch_status == CH_USB_INT_SUCCESS)
ld a, l
;source-doc/base-drv/ch376.c:43: return USB_ERR_OK;
sub 0x14
cp 0x14
jr NZ,l_ch_get_status_00107 jr NZ,l_ch_get_status_00107
ld l,a
;source-doc/base-drv/ch376.c:43: return USB_ERR_OK;
ld l,0x00
jr l_ch_get_status_00126 jr l_ch_get_status_00126
l_ch_get_status_00107: l_ch_get_status_00107:
;source-doc/base-drv/ch376.c:45: if (ch_status == CH_USB_INT_CONNECT) ;source-doc/base-drv/ch376.c:45: if (ch_status == CH_USB_INT_CONNECT)
ld a, l
sub 0x15
cp 0x15
jr NZ,l_ch_get_status_00109 jr NZ,l_ch_get_status_00109
;source-doc/base-drv/ch376.c:46: return USB_INT_CONNECT; ;source-doc/base-drv/ch376.c:46: return USB_INT_CONNECT;
ld l,0x81 ld l,0x81
jr l_ch_get_status_00126 jr l_ch_get_status_00126
l_ch_get_status_00109: l_ch_get_status_00109:
;source-doc/base-drv/ch376.c:48: if (ch_status == CH_USB_INT_DISK_READ) ;source-doc/base-drv/ch376.c:48: if (ch_status == CH_USB_INT_DISK_READ)
ld a, l
sub 0x1d
cp 0x1d
jr NZ,l_ch_get_status_00111 jr NZ,l_ch_get_status_00111
;source-doc/base-drv/ch376.c:49: return USB_ERR_DISK_READ; ;source-doc/base-drv/ch376.c:49: return USB_ERR_DISK_READ;
ld l,0x1d ld l,0x1d
jr l_ch_get_status_00126 jr l_ch_get_status_00126
l_ch_get_status_00111: l_ch_get_status_00111:
;source-doc/base-drv/ch376.c:51: if (ch_status == CH_USB_INT_DISK_WRITE) ;source-doc/base-drv/ch376.c:51: if (ch_status == CH_USB_INT_DISK_WRITE)
ld a, l
sub 0x1e
cp 0x1e
jr NZ,l_ch_get_status_00113 jr NZ,l_ch_get_status_00113
;source-doc/base-drv/ch376.c:52: return USB_ERR_DISK_WRITE; ;source-doc/base-drv/ch376.c:52: return USB_ERR_DISK_WRITE;
ld l,0x1e ld l,0x1e
jr l_ch_get_status_00126 jr l_ch_get_status_00126
l_ch_get_status_00113: l_ch_get_status_00113:
;source-doc/base-drv/ch376.c:54: if (ch_status == CH_USB_INT_DISCONNECT) { ;source-doc/base-drv/ch376.c:54: if (ch_status == CH_USB_INT_DISCONNECT) {
ld a, l
sub 0x16
cp 0x16
jr NZ,l_ch_get_status_00115 jr NZ,l_ch_get_status_00115
;source-doc/base-drv/ch376.c:55: ch_cmd_set_usb_mode(5); ;source-doc/base-drv/ch376.c:55: ch_cmd_set_usb_mode(5);
ld l,0x05 ld l,0x05
@ -164,15 +157,13 @@ l_ch_get_status_00113:
jr l_ch_get_status_00126 jr l_ch_get_status_00126
l_ch_get_status_00115: l_ch_get_status_00115:
;source-doc/base-drv/ch376.c:59: if (ch_status == CH_USB_INT_BUF_OVER) ;source-doc/base-drv/ch376.c:59: if (ch_status == CH_USB_INT_BUF_OVER)
ld a, l
sub 0x17
cp 0x17
jr NZ,l_ch_get_status_00117 jr NZ,l_ch_get_status_00117
;source-doc/base-drv/ch376.c:60: return USB_ERR_DATA_ERROR; ;source-doc/base-drv/ch376.c:60: return USB_ERR_DATA_ERROR;
ld l,0x04 ld l,0x04
jr l_ch_get_status_00126 jr l_ch_get_status_00126
l_ch_get_status_00117: l_ch_get_status_00117:
;source-doc/base-drv/ch376.c:62: ch_status &= 0x2F; ;source-doc/base-drv/ch376.c:62: ch_status &= 0x2F;
ld a, l
and 0x2f and 0x2f
;source-doc/base-drv/ch376.c:64: if (ch_status == 0x2A) ;source-doc/base-drv/ch376.c:64: if (ch_status == 0x2A)
cp 0x2a cp 0x2a
@ -234,7 +225,7 @@ l_ch_probe_00103:
;source-doc/base-drv/ch376.c:86: CH376_DATA_PORT = (uint8_t)~0x55; ;source-doc/base-drv/ch376.c:86: CH376_DATA_PORT = (uint8_t)~0x55;
ld a,0xaa ld a,0xaa
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:87: delay(); ;source-doc/base-drv/ch376.c:87: delay();
call _delay call _delay
;source-doc/base-drv/ch376.c:88: complement = CH376_DATA_PORT; ;source-doc/base-drv/ch376.c:88: complement = CH376_DATA_PORT;
@ -272,14 +263,16 @@ _ch_cmd_set_usb_mode:
ld a,0x15 ld a,0x15
push bc push bc
ld bc,_CH376_COMMAND_PORT ld bc,_CH376_COMMAND_PORT
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:116: delay();
call _delay call _delay
pop bc pop bc
;source-doc/base-drv/ch376.c:117: CH376_DATA_PORT = mode; ;source-doc/base-drv/ch376.c:117: CH376_DATA_PORT = mode;
ld a, c ld a, c
push bc push bc
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:118: delay();
call _delay call _delay
pop bc pop bc
;source-doc/base-drv/ch376.c:122: while (result != CH_CMD_RET_SUCCESS && result != CH_CMD_RET_ABORT && --count != 0) { ;source-doc/base-drv/ch376.c:122: while (result != CH_CMD_RET_SUCCESS && result != CH_CMD_RET_ABORT && --count != 0) {
@ -351,7 +344,7 @@ _ch_issue_token:
;source-doc/base-drv/ch376.c:137: CH376_DATA_PORT = toggle_bit; ;source-doc/base-drv/ch376.c:137: CH376_DATA_PORT = toggle_bit;
ld a,(ix+4) ld a,(ix+4)
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:138: CH376_DATA_PORT = endpoint << 4 | pid; ;source-doc/base-drv/ch376.c:138: CH376_DATA_PORT = endpoint << 4 | pid;
ld a,(ix+5) ld a,(ix+5)
add a, a add a, a
@ -360,7 +353,7 @@ _ch_issue_token:
add a, a add a, a
or (ix+6) or (ix+6)
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:139: } ;source-doc/base-drv/ch376.c:139: }
pop ix pop ix
ret ret
@ -484,7 +477,6 @@ _ch_data_in_transfer:
push ix push ix
ld ix,0 ld ix,0
add ix,sp add ix,sp
push af
;source-doc/base-drv/ch376.c:158: if (buffer_size == 0) ;source-doc/base-drv/ch376.c:158: if (buffer_size == 0)
ld a,(ix+7) ld a,(ix+7)
or (ix+6) or (ix+6)
@ -496,18 +488,17 @@ l_ch_data_in_transfer_00102:
;source-doc/base-drv/ch376.c:161: USB_MODULE_LEDS = 0x01; ;source-doc/base-drv/ch376.c:161: USB_MODULE_LEDS = 0x01;
ld a,0x01 ld a,0x01
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:162: do { ;source-doc/base-drv/ch376.c:162: do {
ld c,(ix+8) ld c,(ix+8)
ld b,(ix+9) ld b,(ix+9)
pop de
push bc
l_ch_data_in_transfer_00107: l_ch_data_in_transfer_00107:
;source-doc/base-drv/ch376.c:163: ch_issue_token_in(endpoint); ;source-doc/base-drv/ch376.c:163: ch_issue_token_in(endpoint);
ld l,c ld l,c
ld h,b ld h,b
push hl push hl
call _ch_issue_token_in call _ch_issue_token_in
;source-doc/base-drv/ch376.c:165: result = ch_long_wait_int_and_get_status();
call _ch_long_wait_int_and_get_statu call _ch_long_wait_int_and_get_statu
pop bc pop bc
ld a, l ld a, l
@ -519,9 +510,9 @@ l_ch_data_in_transfer_00107:
;source-doc/base-drv/ch376.c:168: endpoint->toggle = !endpoint->toggle; ;source-doc/base-drv/ch376.c:168: endpoint->toggle = !endpoint->toggle;
ld e, c ld e, c
ld d, b ld d, b
pop hl
ld a,(hl)
push hl
ld l, e
ld h, d
ld a, (hl)
and 0x01 and 0x01
xor 0x01 xor 0x01
and 0x01 and 0x01
@ -544,7 +535,7 @@ l_ch_data_in_transfer_00107:
;source-doc/base-drv/ch376.c:173: USB_MODULE_LEDS = 0x03; ;source-doc/base-drv/ch376.c:173: USB_MODULE_LEDS = 0x03;
ld a,0x03 ld a,0x03
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:174: return USB_ERR_DATA_ERROR; ;source-doc/base-drv/ch376.c:174: return USB_ERR_DATA_ERROR;
ld l,0x04 ld l,0x04
jr l_ch_data_in_transfer_00111 jr l_ch_data_in_transfer_00111
@ -575,7 +566,7 @@ l_ch_data_in_transfer_00149:
;source-doc/base-drv/ch376.c:181: USB_MODULE_LEDS = 0x03; ;source-doc/base-drv/ch376.c:181: USB_MODULE_LEDS = 0x03;
ld a,0x03 ld a,0x03
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:182: return USB_ERR_OK; ;source-doc/base-drv/ch376.c:182: return USB_ERR_OK;
ld l,0x00 ld l,0x00
jr l_ch_data_in_transfer_00111 jr l_ch_data_in_transfer_00111
@ -584,13 +575,11 @@ l_ch_data_in_transfer_00110:
;source-doc/base-drv/ch376.c:185: USB_MODULE_LEDS = 0x03; ;source-doc/base-drv/ch376.c:185: USB_MODULE_LEDS = 0x03;
ld a,0x03 ld a,0x03
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:186: return result; ;source-doc/base-drv/ch376.c:186: return result;
ld hl,(_result)
ld h,+((_result) / 256)
ld hl, (_result)
l_ch_data_in_transfer_00111: l_ch_data_in_transfer_00111:
;source-doc/base-drv/ch376.c:187: } ;source-doc/base-drv/ch376.c:187: }
ld sp, ix
pop ix pop ix
ret ret
;source-doc/base-drv/ch376.c:189: usb_error ch_data_in_transfer_n(uint8_t *const buffer, int8_t *const buffer_size, endpoint_param *const endpoint) { ;source-doc/base-drv/ch376.c:189: usb_error ch_data_in_transfer_n(uint8_t *const buffer, int8_t *const buffer_size, endpoint_param *const endpoint) {
@ -604,32 +593,28 @@ _ch_data_in_transfer_n:
;source-doc/base-drv/ch376.c:193: USB_MODULE_LEDS = 0x01; ;source-doc/base-drv/ch376.c:193: USB_MODULE_LEDS = 0x01;
ld a,0x01 ld a,0x01
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:195: ch_issue_token_in(endpoint); ;source-doc/base-drv/ch376.c:195: ch_issue_token_in(endpoint);
ld l,(ix+8) ld l,(ix+8)
ld h,(ix+9) ld h,(ix+9)
call _ch_issue_token_in call _ch_issue_token_in
;source-doc/base-drv/ch376.c:197: CHECK(ch_long_wait_int_and_get_status()); ;source-doc/base-drv/ch376.c:197: CHECK(ch_long_wait_int_and_get_status());
call _ch_long_wait_int_and_get_statu call _ch_long_wait_int_and_get_statu
ld a, l
ld b, a
ld a,l
or a or a
jr NZ,l_ch_data_in_transfer_n_00103 jr NZ,l_ch_data_in_transfer_n_00103
;source-doc/base-drv/ch376.c:199: endpoint->toggle = !endpoint->toggle; ;source-doc/base-drv/ch376.c:199: endpoint->toggle = !endpoint->toggle;
ld e,(ix+8)
ld d,(ix+9)
ld c, e
ld b, d
ex de, hl
ld l,(ix+8)
ld h,(ix+9)
ld a, (hl) ld a, (hl)
and 0x01 and 0x01
xor 0x01 xor 0x01
and 0x01 and 0x01
ld e, a
ld a, (bc)
ld c, a
ld a, (hl)
and 0xfe and 0xfe
or e
ld (bc), a
or c
ld (hl), a
;source-doc/base-drv/ch376.c:201: count = ch_read_data(buffer); ;source-doc/base-drv/ch376.c:201: count = ch_read_data(buffer);
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
@ -641,7 +626,7 @@ _ch_data_in_transfer_n:
;source-doc/base-drv/ch376.c:205: USB_MODULE_LEDS = 0x03; ;source-doc/base-drv/ch376.c:205: USB_MODULE_LEDS = 0x03;
ld a,0x03 ld a,0x03
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:207: return USB_ERR_OK; ;source-doc/base-drv/ch376.c:207: return USB_ERR_OK;
ld l,0x00 ld l,0x00
jr l_ch_data_in_transfer_n_00104 jr l_ch_data_in_transfer_n_00104
@ -649,12 +634,9 @@ _ch_data_in_transfer_n:
l_ch_data_in_transfer_n_00103: l_ch_data_in_transfer_n_00103:
;source-doc/base-drv/ch376.c:209: USB_MODULE_LEDS = 0x03; ;source-doc/base-drv/ch376.c:209: USB_MODULE_LEDS = 0x03;
ld a,0x03 ld a,0x03
push bc
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
pop bc
out (c), a
;source-doc/base-drv/ch376.c:210: return result; ;source-doc/base-drv/ch376.c:210: return result;
ld l, b
l_ch_data_in_transfer_n_00104: l_ch_data_in_transfer_n_00104:
;source-doc/base-drv/ch376.c:211: } ;source-doc/base-drv/ch376.c:211: }
pop ix pop ix
@ -667,7 +649,6 @@ _ch_data_out_transfer:
push ix push ix
ld ix,0 ld ix,0
add ix,sp add ix,sp
push af
dec sp dec sp
;source-doc/base-drv/ch376.c:216: const uint8_t max_packet_size = calc_max_packet_size(endpoint->max_packet_sizex); ;source-doc/base-drv/ch376.c:216: const uint8_t max_packet_size = calc_max_packet_size(endpoint->max_packet_sizex);
ld c,(ix+8) ld c,(ix+8)
@ -676,16 +657,14 @@ _ch_data_out_transfer:
ld d, b ld d, b
inc de inc de
ld a, (de) ld a, (de)
ld (ix-3),a
ld (ix-1),a
;source-doc/base-drv/ch376.c:218: USB_MODULE_LEDS = 0x02; ;source-doc/base-drv/ch376.c:218: USB_MODULE_LEDS = 0x02;
ld a,0x02 ld a,0x02
push bc push bc
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
pop bc pop bc
;source-doc/base-drv/ch376.c:220: while (buffer_length > 0) { ;source-doc/base-drv/ch376.c:220: while (buffer_length > 0) {
ld (ix-2),c
ld (ix-1),b
l_ch_data_out_transfer_00103: l_ch_data_out_transfer_00103:
xor a xor a
cp (ix+6) cp (ix+6)
@ -695,7 +674,7 @@ l_ch_data_out_transfer_00103:
l_ch_data_out_transfer_00139: l_ch_data_out_transfer_00139:
jp P, l_ch_data_out_transfer_00105 jp P, l_ch_data_out_transfer_00105
;source-doc/base-drv/ch376.c:221: const uint8_t size = max_packet_size < buffer_length ? max_packet_size : buffer_length; ;source-doc/base-drv/ch376.c:221: const uint8_t size = max_packet_size < buffer_length ? max_packet_size : buffer_length;
ld d,(ix-3)
ld d,(ix-1)
ld e,0x00 ld e,0x00
ld a, d ld a, d
sub (ix+6) sub (ix+6)
@ -738,6 +717,7 @@ l_ch_data_out_transfer_00110:
ld h,b ld h,b
push hl push hl
call _ch_issue_token_out call _ch_issue_token_out
;source-doc/base-drv/ch376.c:226: CHECK(ch_long_wait_int_and_get_status());
call _ch_long_wait_int_and_get_statu call _ch_long_wait_int_and_get_statu
ld a, l ld a, l
pop bc pop bc
@ -747,8 +727,8 @@ l_ch_data_out_transfer_00110:
;source-doc/base-drv/ch376.c:228: endpoint->toggle = !endpoint->toggle; ;source-doc/base-drv/ch376.c:228: endpoint->toggle = !endpoint->toggle;
ld e, c ld e, c
ld d, b ld d, b
ld l,(ix-2)
ld h,(ix-1)
ld l, e
ld h, d
ld a, (hl) ld a, (hl)
and 0x01 and 0x01
xor 0x01 xor 0x01
@ -763,7 +743,7 @@ l_ch_data_out_transfer_00105:
;source-doc/base-drv/ch376.c:231: USB_MODULE_LEDS = 0x03; ;source-doc/base-drv/ch376.c:231: USB_MODULE_LEDS = 0x03;
ld a,0x03 ld a,0x03
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:232: return USB_ERR_OK; ;source-doc/base-drv/ch376.c:232: return USB_ERR_OK;
ld l,0x00 ld l,0x00
jr l_ch_data_out_transfer_00107 jr l_ch_data_out_transfer_00107
@ -772,11 +752,11 @@ l_ch_data_out_transfer_00106:
;source-doc/base-drv/ch376.c:235: USB_MODULE_LEDS = 0x03; ;source-doc/base-drv/ch376.c:235: USB_MODULE_LEDS = 0x03;
ld a,0x03 ld a,0x03
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:236: return result; ;source-doc/base-drv/ch376.c:236: return result;
l_ch_data_out_transfer_00107: l_ch_data_out_transfer_00107:
;source-doc/base-drv/ch376.c:237: } ;source-doc/base-drv/ch376.c:237: }
ld sp, ix
inc sp
pop ix pop ix
ret ret
;source-doc/base-drv/ch376.c:239: void ch_set_usb_address(const uint8_t device_address) __z88dk_fastcall { ;source-doc/base-drv/ch376.c:239: void ch_set_usb_address(const uint8_t device_address) __z88dk_fastcall {
@ -792,7 +772,7 @@ _ch_set_usb_address:
;source-doc/base-drv/ch376.c:241: CH376_DATA_PORT = device_address; ;source-doc/base-drv/ch376.c:241: CH376_DATA_PORT = device_address;
ld a, l ld a, l
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;source-doc/base-drv/ch376.c:242: } ;source-doc/base-drv/ch376.c:242: }
ret ret
_result: _result:

2
Source/HBIOS/ch376-native/base-drv/class_hub.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------

2
Source/HBIOS/ch376-native/base-drv/critical-section.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------

218
Source/HBIOS/ch376-native/base-drv/dev_transfers.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -93,27 +93,31 @@ _usbdev_blk_out_trnsfer:
push ix push ix
ld ix,0 ld ix,0
add ix,sp add ix,sp
dec sp
push af
push af
;source-doc/base-drv/dev_transfers.c:30: */ ;source-doc/base-drv/dev_transfers.c:30: */
ld e,(ix+4) ld e,(ix+4)
ld d,(ix+5) ld d,(ix+5)
ld c, e
ld b, d
inc bc
inc bc
inc bc
ld hl,0x0003
add hl, de
ex (sp), hl
;source-doc/base-drv/dev_transfers.c:32: return usb_control_transfer(cmd_packet, buffer, device->address, device->max_packet_size); ;source-doc/base-drv/dev_transfers.c:32: return usb_control_transfer(cmd_packet, buffer, device->address, device->max_packet_size);
ld l, e
ld h, d
ld a, (hl)
ld (ix-2),e
ld (ix-1),d
pop bc
pop hl
ld a,(hl)
push hl
push bc
rlca rlca
rlca rlca
rlca rlca
rlca rlca
and 0x0f and 0x0f
push bc
push de push de
push bc
ld l,(ix-4)
ld h,(ix-3)
push hl
push af push af
inc sp inc sp
ld l,(ix+8) ld l,(ix+8)
@ -128,56 +132,52 @@ _usbdev_blk_out_trnsfer:
pop af pop af
inc sp inc sp
pop de pop de
pop bc
ld a, l ld a, l
ld (_result), a ld (_result), a
;source-doc/base-drv/dev_transfers.c:34: ;source-doc/base-drv/dev_transfers.c:34:
ld a,(_result)
ld hl,_result
ld a, (hl)
sub 0x02 sub 0x02
jr NZ,l_usbdev_blk_out_trnsfer_00102 jr NZ,l_usbdev_blk_out_trnsfer_00102
;source-doc/base-drv/dev_transfers.c:35: usb_error usbdev_blk_out_trnsfer(device_config *const dev, const uint8_t *const buffer, const uint16_t buffer_size) { ;source-doc/base-drv/dev_transfers.c:35: usb_error usbdev_blk_out_trnsfer(device_config *const dev, const uint8_t *const buffer, const uint16_t buffer_size) {
ld l, e
ld h, d
inc hl
ld a, (hl)
ld (ix-1),a
ex de, hl ex de, hl
inc hl
ld d, (hl)
ld l,(ix-2)
ld h,(ix-1)
ld a, (hl) ld a, (hl)
rlca rlca
rlca rlca
rlca rlca
rlca rlca
and 0x0f and 0x0f
ld d, a
ld l, c
ld h, b
ld a, (hl)
ld b, a
pop hl
ld a,(hl)
push hl
rrca rrca
and 0x07 and 0x07
push bc
ld h,(ix-1)
ld l,d
push hl
ld e,b
push de
push af push af
inc sp inc sp
call _usbtrn_clear_endpoint_halt call _usbtrn_clear_endpoint_halt
pop af pop af
inc sp inc sp
pop bc
;source-doc/base-drv/dev_transfers.c:36: ;source-doc/base-drv/dev_transfers.c:36:
ld a, (bc)
and 0xfe
ld (bc), a
pop hl
push hl
res 0, (hl)
;source-doc/base-drv/dev_transfers.c:37: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_OUT]; ;source-doc/base-drv/dev_transfers.c:37: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_OUT];
ld l,0x02 ld l,0x02
jr l_usbdev_blk_out_trnsfer_00104 jr l_usbdev_blk_out_trnsfer_00104
l_usbdev_blk_out_trnsfer_00102: l_usbdev_blk_out_trnsfer_00102:
;source-doc/base-drv/dev_transfers.c:40: ;source-doc/base-drv/dev_transfers.c:40:
;source-doc/base-drv/dev_transfers.c:43: endpoint->toggle = 0; ;source-doc/base-drv/dev_transfers.c:43: endpoint->toggle = 0;
ld hl,(_result)
ld hl, (_result)
l_usbdev_blk_out_trnsfer_00104: l_usbdev_blk_out_trnsfer_00104:
;source-doc/base-drv/dev_transfers.c:44: return USB_ERR_STALL; ;source-doc/base-drv/dev_transfers.c:44: return USB_ERR_STALL;
inc sp
ld sp, ix
pop ix pop ix
ret ret
;source-doc/base-drv/dev_transfers.c:46: ;source-doc/base-drv/dev_transfers.c:46:
@ -188,25 +188,31 @@ _usbdev_bulk_in_transfer:
push ix push ix
ld ix,0 ld ix,0
add ix,sp add ix,sp
dec sp
push af
push af
;source-doc/base-drv/dev_transfers.c:47: RETURN_CHECK(result); ;source-doc/base-drv/dev_transfers.c:47: RETURN_CHECK(result);
ld c,(ix+4)
ld b,(ix+5)
ld e,(ix+4)
ld d,(ix+5)
ld hl,0x0006 ld hl,0x0006
add hl, bc
add hl, de
ex (sp), hl
;source-doc/base-drv/dev_transfers.c:49: done: ;source-doc/base-drv/dev_transfers.c:49: done:
ld e,c
ld d,b
ex de,hl
ld a, (hl)
ld (ix-2),e
ld (ix-1),d
pop bc
pop hl
ld a,(hl)
push hl
push bc
rlca rlca
rlca rlca
rlca rlca
rlca rlca
and 0x0f and 0x0f
push bc
push de
push de push de
ld l,(ix-4)
ld h,(ix-3)
push hl
push af push af
inc sp inc sp
ld l,(ix+8) ld l,(ix+8)
@ -221,21 +227,19 @@ _usbdev_bulk_in_transfer:
pop af pop af
inc sp inc sp
pop de pop de
pop bc
ld a, l ld a, l
ld (_result), a ld (_result), a
;source-doc/base-drv/dev_transfers.c:51: } ;source-doc/base-drv/dev_transfers.c:51: }
ld a,(_result)
ld hl,_result
ld a, (hl)
sub 0x02 sub 0x02
jr NZ,l_usbdev_bulk_in_transfer_00102 jr NZ,l_usbdev_bulk_in_transfer_00102
;source-doc/base-drv/dev_transfers.c:52: ;source-doc/base-drv/dev_transfers.c:52:
ld l, c
ld h, b
ex de, hl
inc hl inc hl
ld a, (hl)
ld (ix-1),a
ld l, c
ld h, b
ld d, (hl)
ld l,(ix-2)
ld h,(ix-1)
ld a, (hl) ld a, (hl)
rlca rlca
rlca rlca
@ -243,23 +247,21 @@ _usbdev_bulk_in_transfer:
rlca rlca
and 0x0f and 0x0f
ld b, a ld b, a
ld l, e
ld h, d
ld a, (hl)
pop hl
ld a,(hl)
push hl
rrca rrca
and 0x07 and 0x07
ld e,b
push de push de
ld h,(ix-1)
ld l,b
push hl
push af push af
inc sp inc sp
call _usbtrn_clear_endpoint_halt call _usbtrn_clear_endpoint_halt
pop af pop af
inc sp inc sp
pop de
;source-doc/base-drv/dev_transfers.c:53: usb_error usbdev_bulk_in_transfer(device_config *const dev, uint8_t *const buffer, uint8_t *const buffer_size) { ;source-doc/base-drv/dev_transfers.c:53: usb_error usbdev_bulk_in_transfer(device_config *const dev, uint8_t *const buffer, uint8_t *const buffer_size) {
ex de, hl
pop hl
push hl
res 0, (hl) res 0, (hl)
;source-doc/base-drv/dev_transfers.c:54: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_IN]; ;source-doc/base-drv/dev_transfers.c:54: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_IN];
ld l,0x02 ld l,0x02
@ -267,10 +269,10 @@ _usbdev_bulk_in_transfer:
l_usbdev_bulk_in_transfer_00102: l_usbdev_bulk_in_transfer_00102:
;source-doc/base-drv/dev_transfers.c:57: ;source-doc/base-drv/dev_transfers.c:57:
;source-doc/base-drv/dev_transfers.c:59: usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size); ;source-doc/base-drv/dev_transfers.c:59: usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size);
ld hl,(_result)
ld hl, (_result)
l_usbdev_bulk_in_transfer_00104: l_usbdev_bulk_in_transfer_00104:
;source-doc/base-drv/dev_transfers.c:60: endpoint->toggle = 0; ;source-doc/base-drv/dev_transfers.c:60: endpoint->toggle = 0;
inc sp
ld sp, ix
pop ix pop ix
ret ret
;source-doc/base-drv/dev_transfers.c:62: } ;source-doc/base-drv/dev_transfers.c:62: }
@ -281,7 +283,8 @@ _usbdev_dat_in_trnsfer:
push ix push ix
ld ix,0 ld ix,0
add ix,sp add ix,sp
dec sp
push af
push af
;source-doc/base-drv/dev_transfers.c:67: } ;source-doc/base-drv/dev_transfers.c:67: }
ld e,(ix+4) ld e,(ix+4)
ld d,(ix+5) ld d,(ix+5)
@ -297,22 +300,27 @@ _usbdev_dat_in_trnsfer:
add a, e add a, e
pop de pop de
add a, c add a, c
ld c, a
ld (ix-4),a
ld a,0x00 ld a,0x00
adc a, b adc a, b
ld b, a
ld (ix-3),a
;source-doc/base-drv/dev_transfers.c:69: usb_error usbdev_dat_in_trnsfer(device_config *const device, ;source-doc/base-drv/dev_transfers.c:69: usb_error usbdev_dat_in_trnsfer(device_config *const device,
ld l, e
ld h, d
ld a, (hl)
ld (ix-2),e
ld (ix-1),d
pop bc
pop hl
ld a,(hl)
push hl
push bc
rlca rlca
rlca rlca
rlca rlca
rlca rlca
and 0x0f and 0x0f
push bc
push de push de
push bc
ld l,(ix-4)
ld h,(ix-3)
push hl
push af push af
inc sp inc sp
ld l,(ix+8) ld l,(ix+8)
@ -327,56 +335,52 @@ _usbdev_dat_in_trnsfer:
pop af pop af
inc sp inc sp
pop de pop de
pop bc
ld a, l ld a, l
ld (_result), a ld (_result), a
;source-doc/base-drv/dev_transfers.c:71: const uint16_t buffer_size, ;source-doc/base-drv/dev_transfers.c:71: const uint16_t buffer_size,
ld a,(_result)
ld hl,_result
ld a, (hl)
sub 0x02 sub 0x02
jr NZ,l_usbdev_dat_in_trnsfer_00102 jr NZ,l_usbdev_dat_in_trnsfer_00102
;source-doc/base-drv/dev_transfers.c:72: const usb_endpoint_type endpoint_type) { ;source-doc/base-drv/dev_transfers.c:72: const usb_endpoint_type endpoint_type) {
ld l, e
ld h, d
inc hl
ld a, (hl)
ld (ix-1),a
ex de, hl ex de, hl
inc hl
ld d, (hl)
ld l,(ix-2)
ld h,(ix-1)
ld a, (hl) ld a, (hl)
rlca rlca
rlca rlca
rlca rlca
rlca rlca
and 0x0f and 0x0f
ld d, a
ld l, c
ld h, b
ld a, (hl)
ld b, a
pop hl
ld a,(hl)
push hl
rrca rrca
and 0x07 and 0x07
push bc
ld h,(ix-1)
ld l,d
push hl
ld e,b
push de
push af push af
inc sp inc sp
call _usbtrn_clear_endpoint_halt call _usbtrn_clear_endpoint_halt
pop af pop af
inc sp inc sp
pop bc
;source-doc/base-drv/dev_transfers.c:73: ;source-doc/base-drv/dev_transfers.c:73:
ld a, (bc)
and 0xfe
ld (bc), a
pop hl
push hl
res 0, (hl)
;source-doc/base-drv/dev_transfers.c:74: endpoint_param *const endpoint = &device->endpoints[endpoint_type]; ;source-doc/base-drv/dev_transfers.c:74: endpoint_param *const endpoint = &device->endpoints[endpoint_type];
ld l,0x02 ld l,0x02
jr l_usbdev_dat_in_trnsfer_00104 jr l_usbdev_dat_in_trnsfer_00104
l_usbdev_dat_in_trnsfer_00102: l_usbdev_dat_in_trnsfer_00102:
;source-doc/base-drv/dev_transfers.c:77: ;source-doc/base-drv/dev_transfers.c:77:
;source-doc/base-drv/dev_transfers.c:79: usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size); ;source-doc/base-drv/dev_transfers.c:79: usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size);
ld hl,(_result)
ld hl, (_result)
l_usbdev_dat_in_trnsfer_00104: l_usbdev_dat_in_trnsfer_00104:
;source-doc/base-drv/dev_transfers.c:80: endpoint->toggle = 0; ;source-doc/base-drv/dev_transfers.c:80: endpoint->toggle = 0;
inc sp
ld sp, ix
pop ix pop ix
ret ret
;source-doc/base-drv/dev_transfers.c:82: } ;source-doc/base-drv/dev_transfers.c:82: }
@ -388,6 +392,7 @@ _usbdev_dat_in_trnsfer_0:
ld ix,0 ld ix,0
add ix,sp add ix,sp
push af push af
push af
;source-doc/base-drv/dev_transfers.c:83: ;source-doc/base-drv/dev_transfers.c:83:
ld e,(ix+4) ld e,(ix+4)
ld d,(ix+5) ld d,(ix+5)
@ -395,9 +400,13 @@ _usbdev_dat_in_trnsfer_0:
add hl, de add hl, de
ex (sp), hl ex (sp), hl
;source-doc/base-drv/dev_transfers.c:85: done: ;source-doc/base-drv/dev_transfers.c:85: done:
ld l, e
ld h, d
ld a, (hl)
ld (ix-2),e
ld (ix-1),d
pop bc
pop hl
ld a,(hl)
push hl
push bc
rlca rlca
rlca rlca
rlca rlca
@ -406,8 +415,8 @@ _usbdev_dat_in_trnsfer_0:
ld c,(ix+8) ld c,(ix+8)
ld b,0x00 ld b,0x00
push de push de
ld l,(ix-2)
ld h,(ix-1)
ld l,(ix-4)
ld h,(ix-3)
push hl push hl
push af push af
inc sp inc sp
@ -424,29 +433,30 @@ _usbdev_dat_in_trnsfer_0:
ld a, l ld a, l
ld (_result), a ld (_result), a
;source-doc/base-drv/dev_transfers.c:87: } ;source-doc/base-drv/dev_transfers.c:87: }
ld a,(_result)
ld hl,_result
ld a, (hl)
sub 0x02 sub 0x02
jr NZ,l_usbdev_dat_in_trnsfer_0_00102 jr NZ,l_usbdev_dat_in_trnsfer_0_00102
;source-doc/base-drv/dev_transfers.c:88: ;source-doc/base-drv/dev_transfers.c:88:
ld l, e
ld h, d
inc hl
ld b, (hl)
ex de, hl ex de, hl
inc hl
ld d, (hl)
ld l,(ix-2)
ld h,(ix-1)
ld a, (hl) ld a, (hl)
rlca rlca
rlca rlca
rlca rlca
rlca rlca
and 0x0f and 0x0f
ld d, a
ld b, a
pop hl pop hl
ld a,(hl) ld a,(hl)
push hl push hl
rrca rrca
and 0x07 and 0x07
ld c, d
push bc
ld e,b
push de
push af push af
inc sp inc sp
call _usbtrn_clear_endpoint_halt call _usbtrn_clear_endpoint_halt
@ -461,7 +471,7 @@ _usbdev_dat_in_trnsfer_0:
jr l_usbdev_dat_in_trnsfer_0_00103 jr l_usbdev_dat_in_trnsfer_0_00103
l_usbdev_dat_in_trnsfer_0_00102: l_usbdev_dat_in_trnsfer_0_00102:
;source-doc/base-drv/dev_transfers.c:93: ;source-doc/base-drv/dev_transfers.c:93:
ld hl,(_result)
ld hl, (_result)
l_usbdev_dat_in_trnsfer_0_00103: l_usbdev_dat_in_trnsfer_0_00103:
;source-doc/base-drv/dev_transfers.c:94: if (result == USB_ERR_STALL) { ;source-doc/base-drv/dev_transfers.c:94: if (result == USB_ERR_STALL) {
ld sp, ix ld sp, ix

357
Source/HBIOS/ch376-native/base-drv/enumerate.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -99,7 +99,7 @@ _parse_endpoint_keyboard:
inc bc inc bc
ld a, d ld a, d
and 0x03 and 0x03
ld l,a
ld l, a
ld a, (bc) ld a, (bc)
and 0xfc and 0xfc
or l or l
@ -362,74 +362,77 @@ _configure_device:
push af push af
push af push af
;source-doc/base-drv/enumerate.c:79: dev_cfg->interface_number = interface->bInterfaceNumber; ;source-doc/base-drv/enumerate.c:79: dev_cfg->interface_number = interface->bInterfaceNumber;
ld a,(ix+8)
ld (ix-4),a
ld a,(ix+9)
ld (ix-3),a
pop bc
push bc
inc bc
inc bc
ld e,(ix+6)
ld d,(ix+7)
ld c,(ix+8)
ld b,(ix+9)
ld e, c
ld d, b
inc de inc de
inc de inc de
ld a, (de)
ld (bc), a
ld l,(ix+6)
ld h,(ix+7)
inc hl
inc hl
ld a, (hl)
ld (de), a
;source-doc/base-drv/enumerate.c:80: dev_cfg->max_packet_size = working->desc.bMaxPacketSize0; ;source-doc/base-drv/enumerate.c:80: dev_cfg->max_packet_size = working->desc.bMaxPacketSize0;
ld a,(ix-4)
add a,0x01
ld (ix-2),a
ld a,(ix-3)
adc a,0x00
ld (ix-1),a
ld c,(ix+4)
ld b,(ix+5)
ld hl,10
add hl,bc
ld hl,0x0001
add hl, bc
ex (sp), hl
ld e,(ix+4)
ld d,(ix+5)
ld hl,0x000a
add hl,de
ld a, (hl) ld a, (hl)
pop de
pop hl pop hl
push hl push hl
ld (hl), a
;source-doc/base-drv/enumerate.c:81: dev_cfg->address = working->current_device_address; ;source-doc/base-drv/enumerate.c:81: dev_cfg->address = working->current_device_address;
ld (hl),a
push de
ld hl,0x0018
add hl,bc
ld (ix-2),c
ld (ix-1),b
ld l, e
ld h, d
ld a,+((0x0018) & 0xFF)
add a,l
ld l,a
ld a,+((0x0018) / 256)
adc a,h
ld h,a
ld a, (hl) ld a, (hl)
ld l,(ix-2)
ld h,(ix-1)
add a, a add a, a
add a, a add a, a
add a, a add a, a
add a, a add a, a
ld l, a
ld a, (de)
push bc
ld c, a
ld a, (hl)
and 0x0f and 0x0f
or l
ld (de), a
or c
ld (hl), a
pop bc
;source-doc/base-drv/enumerate.c:82: dev_cfg->type = working->usb_device; ;source-doc/base-drv/enumerate.c:82: dev_cfg->type = working->usb_device;
pop de
push de
ld l, c
ld h, b
ld l, e
ld h, d
inc hl inc hl
inc hl inc hl
ld a, (hl) ld a, (hl)
and 0x0f and 0x0f
ld l, a ld l, a
ld a, (de)
ld a, (bc)
and 0xf0 and 0xf0
or l or l
ld (de), a
ld (bc), a
;source-doc/base-drv/enumerate.c:84: return usbtrn_set_configuration(dev_cfg->address, dev_cfg->max_packet_size, working->config.desc.bConfigurationvalue); ;source-doc/base-drv/enumerate.c:84: return usbtrn_set_configuration(dev_cfg->address, dev_cfg->max_packet_size, working->config.desc.bConfigurationvalue);
ld hl,36 ld hl,36
add hl, bc
add hl, de
ld b, (hl) ld b, (hl)
ld l,(ix-2)
ld h,(ix-1)
ld d, (hl)
pop hl pop hl
ld a,(hl)
ld d,(hl)
push hl push hl
ld l,(ix-2)
ld h,(ix-1)
ld a, (hl)
rlca rlca
rlca rlca
rlca rlca
@ -454,7 +457,6 @@ _op_capture_hub_driver_interfac:
add ix,sp add ix,sp
push af push af
push af push af
push af
dec sp dec sp
ex de, hl ex de, hl
;source-doc/base-drv/enumerate.c:88: const interface_descriptor *const interface = (interface_descriptor *)working->ptr; ;source-doc/base-drv/enumerate.c:88: const interface_descriptor *const interface = (interface_descriptor *)working->ptr;
@ -463,22 +465,20 @@ _op_capture_hub_driver_interfac:
ld a, (hl) ld a, (hl)
dec hl dec hl
ld l, (hl) ld l, (hl)
ld (ix-4),l
ld (ix-3),a
ld (ix-2),l
ld (ix-1),a
;source-doc/base-drv/enumerate.c:92: working->hub_config = &hub_config; ;source-doc/base-drv/enumerate.c:92: working->hub_config = &hub_config;
ld hl,0x0019 ld hl,0x0019
add hl, de add hl, de
ld (ix-2),l
ld (ix-1),h
ld c, l
ld b, h
ld hl,0 ld hl,0
add hl, sp add hl, sp
ld c, l
ld l,(ix-2)
ld b,h
ld h,(ix-1)
ld (hl), c
inc hl
ld (hl), b
ld a, l
ld (bc), a
inc bc
ld a, h
ld (bc), a
;source-doc/base-drv/enumerate.c:94: hub_config.type = USB_IS_HUB; ;source-doc/base-drv/enumerate.c:94: hub_config.type = USB_IS_HUB;
ld hl,0 ld hl,0
add hl, sp add hl, sp
@ -490,8 +490,8 @@ _op_capture_hub_driver_interfac:
ld hl,2 ld hl,2
add hl, sp add hl, sp
push hl push hl
ld l,(ix-4)
ld h,(ix-3)
ld l,(ix-2)
ld h,(ix-1)
push hl push hl
push de push de
call _configure_device call _configure_device
@ -524,7 +524,7 @@ _op_cap_drv_intf:
add ix,sp add ix,sp
ld c, l ld c, l
ld b, h ld b, h
ld hl, -16
ld hl, -14
add hl, sp add hl, sp
ld sp, hl ld sp, hl
;source-doc/base-drv/enumerate.c:104: const interface_descriptor *const interface = (interface_descriptor *)working->ptr; ;source-doc/base-drv/enumerate.c:104: const interface_descriptor *const interface = (interface_descriptor *)working->ptr;
@ -567,12 +567,12 @@ _op_cap_drv_intf:
;source-doc/base-drv/enumerate.c:108: working->p_current_device = NULL; ;source-doc/base-drv/enumerate.c:108: working->p_current_device = NULL;
ld a,(ix-2) ld a,(ix-2)
add a,0x1d add a,0x1d
ld (ix-4),a
ld l,a
ld e, a
ld a,(ix-1) ld a,(ix-1)
adc a,0x00 adc a,0x00
ld (ix-3),a
ld h,a
ld d, a
ld l, e
ld h, d
xor a xor a
ld (hl), a ld (hl), a
inc hl inc hl
@ -612,15 +612,12 @@ l_op_cap_drv_intf_00154:
;source-doc/base-drv/enumerate.c:119: working->p_current_device = &unkown_dev_cfg; ;source-doc/base-drv/enumerate.c:119: working->p_current_device = &unkown_dev_cfg;
ld hl,0 ld hl,0
add hl, sp add hl, sp
ex de, hl
ld l,(ix-4)
ld h,(ix-3)
ld (hl), e
inc hl
ld (hl), d
ld a, l
ld (de), a
inc de
ld a, h
ld (de), a
;source-doc/base-drv/enumerate.c:120: CHECK(configure_device(working, interface, &unkown_dev_cfg)); ;source-doc/base-drv/enumerate.c:120: CHECK(configure_device(working, interface, &unkown_dev_cfg));
ld hl,0
add hl, sp
push hl push hl
push bc push bc
ld l,(ix-2) ld l,(ix-2)
@ -638,25 +635,26 @@ l_op_cap_drv_intf_00154:
l_op_cap_drv_intf_00107: l_op_cap_drv_intf_00107:
;source-doc/base-drv/enumerate.c:125: device_config *dev_cfg = find_first_free(); ;source-doc/base-drv/enumerate.c:125: device_config *dev_cfg = find_first_free();
push bc push bc
push de
call _find_first_free call _find_first_free
;source-doc/base-drv/enumerate.c:126: if (dev_cfg == NULL)
pop de
pop bc pop bc
ld a,h
;source-doc/base-drv/enumerate.c:126: if (dev_cfg == NULL)
ld a, h
or l or l
ex de,hl
jr NZ,l_op_cap_drv_intf_00109 jr NZ,l_op_cap_drv_intf_00109
;source-doc/base-drv/enumerate.c:127: return USB_ERR_OUT_OF_MEMORY; ;source-doc/base-drv/enumerate.c:127: return USB_ERR_OUT_OF_MEMORY;
ld l,0x83 ld l,0x83
jr l_op_cap_drv_intf_00114 jr l_op_cap_drv_intf_00114
l_op_cap_drv_intf_00109: l_op_cap_drv_intf_00109:
;source-doc/base-drv/enumerate.c:128: working->p_current_device = dev_cfg; ;source-doc/base-drv/enumerate.c:128: working->p_current_device = dev_cfg;
ld l,(ix-4)
ld h,(ix-3)
ld (hl), e
inc hl
ld (hl), d
ld a, l
ld (de), a
inc de
ld a, h
ld (de), a
;source-doc/base-drv/enumerate.c:129: CHECK(configure_device(working, interface, dev_cfg)); ;source-doc/base-drv/enumerate.c:129: CHECK(configure_device(working, interface, dev_cfg));
push de
push hl
push bc push bc
ld l,(ix-2) ld l,(ix-2)
ld h,(ix-1) ld h,(ix-1)
@ -690,34 +688,32 @@ l_op_cap_drv_intf_00114:
_op_id_class_drv: _op_id_class_drv:
ex de, hl ex de, hl
;source-doc/base-drv/enumerate.c:141: const interface_descriptor *const ptr = (const interface_descriptor *)working->ptr; ;source-doc/base-drv/enumerate.c:141: const interface_descriptor *const ptr = (const interface_descriptor *)working->ptr;
ld hl,0x001c
ld hl,27
add hl,de add hl,de
ld a, (hl)
dec hl
ld l, (hl)
ld c, (hl)
inc hl
ld b, (hl)
;source-doc/base-drv/enumerate.c:143: working->usb_device = ptr->bLength > 5 ? identify_class_driver(working) : 0; ;source-doc/base-drv/enumerate.c:143: working->usb_device = ptr->bLength > 5 ? identify_class_driver(working) : 0;
ld c, e
ld b, d
inc bc
inc bc
ld h, a
ld l, (hl)
ld a,0x05
sub l
jr NC,l_op_id_class_drv_00103
push bc
ld l, e
ld h, d
inc hl
inc hl
ld a, (bc)
cp 0x06
jr C,l_op_id_class_drv_00103
push hl
push de push de
push de push de
call _identify_class_driver call _identify_class_driver
pop af pop af
ld a, l ld a, l
pop de pop de
pop bc
pop hl
jr l_op_id_class_drv_00104 jr l_op_id_class_drv_00104
l_op_id_class_drv_00103: l_op_id_class_drv_00103:
xor a xor a
l_op_id_class_drv_00104: l_op_id_class_drv_00104:
ld (bc), a
ld (hl), a
;source-doc/base-drv/enumerate.c:145: return op_cap_drv_intf(working); ;source-doc/base-drv/enumerate.c:145: return op_cap_drv_intf(working);
ex de, hl ex de, hl
call _op_cap_drv_intf call _op_cap_drv_intf
@ -732,13 +728,13 @@ _op_get_cfg_desc:
push ix push ix
ld ix,0 ld ix,0
add ix,sp add ix,sp
push af
ex de, hl
dec sp
ld c, l
ld b, h
;source-doc/base-drv/enumerate.c:149: memset(working->config.buffer, 0, MAX_CONFIG_SIZE); ;source-doc/base-drv/enumerate.c:149: memset(working->config.buffer, 0, MAX_CONFIG_SIZE);
ld hl,0x001f ld hl,0x001f
add hl, de
pop af
push hl
add hl, bc
push bc
ld b,0x46 ld b,0x46
l_op_get_cfg_desc_00113: l_op_get_cfg_desc_00113:
xor a xor a
@ -747,88 +743,77 @@ l_op_get_cfg_desc_00113:
ld (hl), a ld (hl), a
inc hl inc hl
djnz l_op_get_cfg_desc_00113 djnz l_op_get_cfg_desc_00113
pop bc
;source-doc/base-drv/enumerate.c:151: const uint8_t max_packet_size = working->desc.bMaxPacketSize0; ;source-doc/base-drv/enumerate.c:151: const uint8_t max_packet_size = working->desc.bMaxPacketSize0;
ld c, e
ld b, d
inc bc
inc bc
inc bc
ld hl,7
add hl, bc
ld e,c
ld d,b
ld hl,10
add hl,bc
ld a, (hl) ld a, (hl)
ld (ix-1),a
;source-doc/base-drv/enumerate.c:154: working->config.buffer)); ;source-doc/base-drv/enumerate.c:154: working->config.buffer));
ld c, e
ld b, d
ld hl,24
ld hl,0x001f
add hl, bc add hl, bc
ld b, (hl)
ld l, e
ld h, d
ex de, hl
ld hl,0x0018
add hl,bc
ld a, (hl)
ld hl,0x0015
add hl,bc
ld h, (hl)
push bc push bc
ld bc,0x0015
add hl, bc
pop bc
ld c, (hl)
push de push de
ld l,(ix-2)
ld h,(ix-1)
push hl
ld h,0x8c
ld l,a
ld d,0x8c
push de
inc sp
ld d,(ix-1)
push de
inc sp
ld l,h
ld h,a
push hl push hl
push bc
call _usbtrn_gfull_cfg_desc call _usbtrn_gfull_cfg_desc
pop af pop af
pop af pop af
pop af pop af
pop de
pop bc
ld a, l ld a, l
ld (_result), a ld (_result), a
ld a,(_result)
ld hl,_result
ld a, (hl)
or a or a
jr NZ,l_op_get_cfg_desc_00103 jr NZ,l_op_get_cfg_desc_00103
;source-doc/base-drv/enumerate.c:156: working->ptr = (working->config.buffer + sizeof(config_descriptor)); ;source-doc/base-drv/enumerate.c:156: working->ptr = (working->config.buffer + sizeof(config_descriptor));
ld hl,0x001b ld hl,0x001b
add hl, de
ld a, e
add a,0x1f
ld c, a
ld a, d
adc a,0x00
ld b, a
add hl, bc
ld a, c ld a, c
add a,0x09
ld c, a
add a,0x28
ld e, a
ld a, b ld a, b
adc a,0x00 adc a,0x00
ld (hl), c
ld (hl), e
inc hl inc hl
ld (hl), a ld (hl), a
;source-doc/base-drv/enumerate.c:157: working->interface_count = working->config.desc.bNumInterfaces; ;source-doc/base-drv/enumerate.c:157: working->interface_count = working->config.desc.bNumInterfaces;
ld hl,0x0016 ld hl,0x0016
add hl, de
ld c, l
ld b, h
pop hl
push hl
inc hl
inc hl
inc hl
inc hl
add hl, bc
ex de, hl
ld hl,0x0023
add hl,bc
ld a, (hl) ld a, (hl)
ld (bc), a
ld (de), a
;source-doc/base-drv/enumerate.c:159: return op_id_class_drv(working); ;source-doc/base-drv/enumerate.c:159: return op_id_class_drv(working);
ex de, hl
ld l, c
ld h, b
call _op_id_class_drv call _op_id_class_drv
jr l_op_get_cfg_desc_00104 jr l_op_get_cfg_desc_00104
;source-doc/base-drv/enumerate.c:160: done: ;source-doc/base-drv/enumerate.c:160: done:
l_op_get_cfg_desc_00103: l_op_get_cfg_desc_00103:
;source-doc/base-drv/enumerate.c:161: return result; ;source-doc/base-drv/enumerate.c:161: return result;
ld hl,_result
ld a, (hl)
ld a, (_result)
l_op_get_cfg_desc_00104: l_op_get_cfg_desc_00104:
;source-doc/base-drv/enumerate.c:162: } ;source-doc/base-drv/enumerate.c:162: }
ld sp, ix
inc sp
pop ix pop ix
ret ret
;source-doc/base-drv/enumerate.c:164: usb_error read_all_configs(enumeration_state *const state) { ;source-doc/base-drv/enumerate.c:164: usb_error read_all_configs(enumeration_state *const state) {
@ -845,44 +830,56 @@ _read_all_configs:
;source-doc/base-drv/enumerate.c:169: memset(&working, 0, sizeof(_working)); ;source-doc/base-drv/enumerate.c:169: memset(&working, 0, sizeof(_working));
ld hl,0 ld hl,0
add hl, sp add hl, sp
ld e,l
ld d,h
ld b,0x56
jr l_read_all_configs_00150
l_read_all_configs_00149:
ld (hl),0x00 ld (hl),0x00
ld e, l
ld d, h
inc de
ld bc,0x00aa
ldir
inc hl
l_read_all_configs_00150:
ld (hl),0x00
inc hl
djnz l_read_all_configs_00149
;source-doc/base-drv/enumerate.c:170: working.state = state; ;source-doc/base-drv/enumerate.c:170: working.state = state;
ld l, e
ld h, d
ld a,(ix+4) ld a,(ix+4)
ld hl,0
add hl, sp
ld (hl), a ld (hl), a
ld a,(ix+5)
inc hl inc hl
ld a,(ix+5)
ld (hl), a ld (hl), a
;source-doc/base-drv/enumerate.c:172: CHECK(usbtrn_get_descriptor(&working.desc)); ;source-doc/base-drv/enumerate.c:172: CHECK(usbtrn_get_descriptor(&working.desc));
ld hl,3
push de
ld hl,5
add hl, sp add hl, sp
push hl push hl
call _usbtrn_get_descriptor call _usbtrn_get_descriptor
pop af pop af
ld a, l ld a, l
pop de
or a or a
jr NZ,l_read_all_configs_00108 jr NZ,l_read_all_configs_00108
;source-doc/base-drv/enumerate.c:174: state->next_device_address++; ;source-doc/base-drv/enumerate.c:174: state->next_device_address++;
ld e,(ix+4)
ld d,(ix+5)
ld a, (de)
inc a
ld c,a
ld (de), a
ld b,(ix+5)
ld a,(ix+4)
ld l, a
ld h, b
ld c, (hl)
inc c
ld l, a
ld h, b
ld (hl), c
;source-doc/base-drv/enumerate.c:175: working.current_device_address = state->next_device_address; ;source-doc/base-drv/enumerate.c:175: working.current_device_address = state->next_device_address;
ld hl,24
add hl, sp
ld hl,0x0018
add hl, de
ld (hl), c ld (hl), c
;source-doc/base-drv/enumerate.c:176: CHECK(usbtrn_set_address(working.current_device_address)); ;source-doc/base-drv/enumerate.c:176: CHECK(usbtrn_set_address(working.current_device_address));
push de
ld l, c ld l, c
call _usbtrn_set_address call _usbtrn_set_address
ld a, l ld a, l
pop de
;source-doc/base-drv/enumerate.c:178: for (uint8_t config_index = 0; config_index < working.desc.bNumConfigurations; config_index++) { ;source-doc/base-drv/enumerate.c:178: for (uint8_t config_index = 0; config_index < working.desc.bNumConfigurations; config_index++) {
or a or a
jr NZ,l_read_all_configs_00108 jr NZ,l_read_all_configs_00108
@ -895,13 +892,16 @@ l_read_all_configs_00110:
sub b sub b
jr NC,l_read_all_configs_00107 jr NC,l_read_all_configs_00107
;source-doc/base-drv/enumerate.c:179: working.config_index = config_index; ;source-doc/base-drv/enumerate.c:179: working.config_index = config_index;
inc hl
ld hl,0x0015
add hl, de
ld (hl), c ld (hl), c
;source-doc/base-drv/enumerate.c:181: CHECK(op_get_cfg_desc(&working)); ;source-doc/base-drv/enumerate.c:181: CHECK(op_get_cfg_desc(&working));
ld l, e
ld h, d
push bc push bc
ld hl,2
add hl, sp
push de
call _op_get_cfg_desc call _op_get_cfg_desc
pop de
pop bc pop bc
or a or a
jr NZ,l_read_all_configs_00108 jr NZ,l_read_all_configs_00108
@ -934,22 +934,23 @@ _enumerate_all_devices:
add hl, sp add hl, sp
ld e,l ld e,l
ld d,h ld d,h
ld (hl),0x00
;source-doc/base-drv/enumerate.c:193: state.next_device_address = 0; ;source-doc/base-drv/enumerate.c:193: state.next_device_address = 0;
ld c, e
ld b, d
xor a xor a
ld (hl),a
ld (de), a
ld (bc), a
;source-doc/base-drv/enumerate.c:195: usb_error result = read_all_configs(&state); ;source-doc/base-drv/enumerate.c:195: usb_error result = read_all_configs(&state);
push de
push bc
push de push de
call _read_all_configs call _read_all_configs
pop af pop af
ld c, l
pop de
pop bc
;source-doc/base-drv/enumerate.c:197: work_area->count_of_detected_usb_devices = state.next_device_address; ;source-doc/base-drv/enumerate.c:197: work_area->count_of_detected_usb_devices = state.next_device_address;
ld a, (de)
ld ((_x + 1)),a
ld de,_x + 1
ld a, (bc)
ld (de), a
;source-doc/base-drv/enumerate.c:200: return result; ;source-doc/base-drv/enumerate.c:200: return result;
ld l, c
;source-doc/base-drv/enumerate.c:201: } ;source-doc/base-drv/enumerate.c:201: }
inc sp inc sp
pop ix pop ix

30
Source/HBIOS/ch376-native/base-drv/enumerate_hub.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -190,35 +190,37 @@ _hub_get_status_port:
;source-doc/base-drv/enumerate_hub.c:33: get_status_port = cmd_get_status_port; ;source-doc/base-drv/enumerate_hub.c:33: get_status_port = cmd_get_status_port;
ld hl,0 ld hl,0
add hl, sp add hl, sp
ex de, hl
ld e,l
ld d,h
push hl
ld bc,0x0008 ld bc,0x0008
ld hl,_cmd_get_status_port ld hl,_cmd_get_status_port
ldir ldir
pop bc
;source-doc/base-drv/enumerate_hub.c:35: get_status_port.bIndex[0] = index; ;source-doc/base-drv/enumerate_hub.c:35: get_status_port.bIndex[0] = index;
ld a,(ix+6) ld a,(ix+6)
ld (ix-4),a ld (ix-4),a
;source-doc/base-drv/enumerate_hub.c:36: return usb_control_transfer(&get_status_port, port_status, hub_config->address, hub_config->max_packet_size); ;source-doc/base-drv/enumerate_hub.c:36: return usb_control_transfer(&get_status_port, port_status, hub_config->address, hub_config->max_packet_size);
ld l,(ix+4)
ld h,(ix+5)
ld e,l
ld d,h
ld e,(ix+5)
ld a,(ix+4)
ld l, a
ld h, e
inc hl inc hl
ld b, (hl)
ex de, hl
ld d, (hl)
ld l, a
ld h, e
ld a, (hl) ld a, (hl)
rlca rlca
rlca rlca
rlca rlca
rlca rlca
and 0x0f and 0x0f
ld e,(ix+7)
ld d,(ix+8)
ld c,a
push bc
ld l,(ix+7)
ld h,(ix+8)
ld e,a
push de push de
ld hl,4
add hl, sp
push hl push hl
push bc
call _usb_control_transfer call _usb_control_transfer
;source-doc/base-drv/enumerate_hub.c:37: } ;source-doc/base-drv/enumerate_hub.c:37: }
ld sp,ix ld sp,ix

4
Source/HBIOS/ch376-native/base-drv/enumerate_storage.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -133,7 +133,7 @@ l_parse_endpoints_00107:
inc de inc de
ld a, b ld a, b
and 0x03 and 0x03
ld l,a
ld l, a
ld a, (de) ld a, (de)
and 0xfc and 0xfc
or l or l

64
Source/HBIOS/ch376-native/base-drv/protocol.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -73,9 +73,10 @@ _usbtrn_get_descriptor:
;source-doc/base-drv/protocol.c:30: setup_packet cmd; ;source-doc/base-drv/protocol.c:30: setup_packet cmd;
ld c,(ix+4) ld c,(ix+4)
ld b,(ix+5) ld b,(ix+5)
ld e, c
ld d, b
push bc push bc
push bc
ld e,c
ld d,b
ld a,0x08 ld a,0x08
push af push af
inc sp inc sp
@ -83,13 +84,14 @@ _usbtrn_get_descriptor:
push af push af
inc sp inc sp
push de push de
ld hl,6
ld hl,8
add hl, sp add hl, sp
push hl push hl
call _usb_control_transfer call _usb_control_transfer
pop af pop af
pop af pop af
pop af pop af
pop de
pop bc pop bc
ld a, l ld a, l
ld (_result), a ld (_result), a
@ -98,30 +100,30 @@ _usbtrn_get_descriptor:
or a or a
jr NZ,l_usbtrn_get_descriptor_00103 jr NZ,l_usbtrn_get_descriptor_00103
;source-doc/base-drv/protocol.c:34: result = usb_control_transfer(&cmd, (uint8_t *)buffer, 0, 8); ;source-doc/base-drv/protocol.c:34: result = usb_control_transfer(&cmd, (uint8_t *)buffer, 0, 8);
ld hl,0
push de
push bc
ld hl,4
add hl, sp add hl, sp
ex de, hl ex de, hl
push bc
ld bc,0x0008 ld bc,0x0008
ld hl,_cmd_get_device_descriptor ld hl,_cmd_get_device_descriptor
ldir ldir
pop bc pop bc
pop de
;source-doc/base-drv/protocol.c:35: ;source-doc/base-drv/protocol.c:35:
ld (ix-2),0x12 ld (ix-2),0x12
xor a xor a
ld (ix-1),a ld (ix-1),a
;source-doc/base-drv/protocol.c:36: CHECK(result); ;source-doc/base-drv/protocol.c:36: CHECK(result);
ld e,(ix+4)
ld d,(ix+5)
ld hl,7 ld hl,7
add hl, de
add hl, bc
ld a, (hl) ld a, (hl)
push af push af
inc sp inc sp
xor a xor a
push af push af
inc sp inc sp
push bc
push de
ld hl,4 ld hl,4
add hl, sp add hl, sp
push hl push hl
@ -135,7 +137,7 @@ _usbtrn_get_descriptor:
;source-doc/base-drv/protocol.c:40: result = usb_control_transfer(&cmd, (uint8_t *)buffer, 0, buffer->bMaxPacketSize0); ;source-doc/base-drv/protocol.c:40: result = usb_control_transfer(&cmd, (uint8_t *)buffer, 0, buffer->bMaxPacketSize0);
l_usbtrn_get_descriptor_00103: l_usbtrn_get_descriptor_00103:
;source-doc/base-drv/protocol.c:41: ;source-doc/base-drv/protocol.c:41:
ld hl,(_result)
ld hl, (_result)
;source-doc/base-drv/protocol.c:42: RETURN_CHECK(result); ;source-doc/base-drv/protocol.c:42: RETURN_CHECK(result);
ld sp, ix ld sp, ix
pop ix pop ix
@ -173,20 +175,22 @@ _usbtrn_get_descriptor2:
;source-doc/base-drv/protocol.c:51: * @param buffer the buffer to store the device descriptor in ;source-doc/base-drv/protocol.c:51: * @param buffer the buffer to store the device descriptor in
ld c,(ix+4) ld c,(ix+4)
ld b,(ix+5) ld b,(ix+5)
ld e, c
ld d, b
push bc push bc
push bc
ld e,c
ld d,b
ld h,0x08 ld h,0x08
ld l,(ix+6) ld l,(ix+6)
push hl push hl
push de push de
ld hl,6
ld hl,8
add hl, sp add hl, sp
push hl push hl
call _usb_control_transfer call _usb_control_transfer
pop af pop af
pop af pop af
pop af pop af
pop de
pop bc pop bc
ld a, l ld a, l
ld (_result), a ld (_result), a
@ -195,27 +199,27 @@ _usbtrn_get_descriptor2:
or a or a
jr NZ,l_usbtrn_get_descriptor2_00103 jr NZ,l_usbtrn_get_descriptor2_00103
;source-doc/base-drv/protocol.c:55: setup_packet cmd; ;source-doc/base-drv/protocol.c:55: setup_packet cmd;
ld hl,0
push de
push bc
ld hl,4
add hl, sp add hl, sp
ex de, hl ex de, hl
push bc
ld bc,0x0008 ld bc,0x0008
ld hl,_cmd_get_device_descriptor ld hl,_cmd_get_device_descriptor
ldir ldir
pop bc pop bc
pop de
;source-doc/base-drv/protocol.c:56: cmd = cmd_get_device_descriptor; ;source-doc/base-drv/protocol.c:56: cmd = cmd_get_device_descriptor;
ld (ix-2),0x12 ld (ix-2),0x12
xor a xor a
ld (ix-1),a ld (ix-1),a
;source-doc/base-drv/protocol.c:57: cmd.wLength = 8; ;source-doc/base-drv/protocol.c:57: cmd.wLength = 8;
ld e,(ix+4)
ld d,(ix+5)
ld hl,7 ld hl,7
add hl, de
add hl, bc
ld h,(hl) ld h,(hl)
ld l,(ix+6) ld l,(ix+6)
push hl push hl
push bc
push de
ld hl,4 ld hl,4
add hl, sp add hl, sp
push hl push hl
@ -228,7 +232,7 @@ _usbtrn_get_descriptor2:
;source-doc/base-drv/protocol.c:58: ;source-doc/base-drv/protocol.c:58:
l_usbtrn_get_descriptor2_00103: l_usbtrn_get_descriptor2_00103:
;source-doc/base-drv/protocol.c:59: result = usb_control_transfer(&cmd, (uint8_t *)buffer, device_address, 8); ;source-doc/base-drv/protocol.c:59: result = usb_control_transfer(&cmd, (uint8_t *)buffer, device_address, 8);
ld hl,(_result)
ld hl, (_result)
;source-doc/base-drv/protocol.c:60: ;source-doc/base-drv/protocol.c:60:
ld sp, ix ld sp, ix
pop ix pop ix
@ -247,10 +251,10 @@ _usbtrn_set_address:
push af push af
ld c, l ld c, l
;source-doc/base-drv/protocol.c:68: } ;source-doc/base-drv/protocol.c:68: }
ld hl,0
push bc
ld hl,2
add hl, sp add hl, sp
ex de, hl ex de, hl
push bc
ld bc,0x0008 ld bc,0x0008
ld hl,_cmd_set_device_address ld hl,_cmd_set_device_address
ldir ldir
@ -351,9 +355,13 @@ _usbtrn_get_config_descriptor:
ld a,(ix+6) ld a,(ix+6)
ld (ix-6),a ld (ix-6),a
;source-doc/base-drv/protocol.c:98: ;source-doc/base-drv/protocol.c:98:
ld hl,0x0006
add hl, bc
ld e,(ix+7) ld e,(ix+7)
ld (ix-2),e
ld (ix-1),0x00
xor a
ld (hl), e
inc hl
ld (hl), a
;source-doc/base-drv/protocol.c:100: } ;source-doc/base-drv/protocol.c:100: }
ld e,(ix+4) ld e,(ix+4)
ld d,(ix+5) ld d,(ix+5)
@ -408,8 +416,8 @@ _usbtrn_gfull_cfg_desc:
or a or a
jr NZ,l_usbtrn_gfull_cfg_desc_00107 jr NZ,l_usbtrn_gfull_cfg_desc_00107
;source-doc/base-drv/protocol.c:112: * @return usb_error USB_ERR_OK if all good, otherwise specific error code ;source-doc/base-drv/protocol.c:112: * @return usb_error USB_ERR_OK if all good, otherwise specific error code
ld l, c
ld h, b
ld l,(ix+8)
ld h,(ix+9)
inc hl inc hl
inc hl inc hl
ld d, (hl) ld d, (hl)
@ -442,7 +450,7 @@ l_usbtrn_gfull_cfg_desc_00104:
;source-doc/base-drv/protocol.c:119: setup_packet cmd; ;source-doc/base-drv/protocol.c:119: setup_packet cmd;
l_usbtrn_gfull_cfg_desc_00107: l_usbtrn_gfull_cfg_desc_00107:
;source-doc/base-drv/protocol.c:120: cmd = cmd_get_config_descriptor; ;source-doc/base-drv/protocol.c:120: cmd = cmd_get_config_descriptor;
ld hl,(_result)
ld hl, (_result)
l_usbtrn_gfull_cfg_desc_00108: l_usbtrn_gfull_cfg_desc_00108:
;source-doc/base-drv/protocol.c:121: cmd.bValue[0] = config_index; ;source-doc/base-drv/protocol.c:121: cmd.bValue[0] = config_index;
pop ix pop ix

21
Source/HBIOS/ch376-native/base-drv/transfers.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -120,7 +120,7 @@ _usb_control_transfer:
inc hl inc hl
ld a, b ld a, b
and 0x03 and 0x03
ld e,a
ld e, a
ld a, (hl) ld a, (hl)
and 0xfc and 0xfc
or e or e
@ -144,6 +144,7 @@ l_usb_control_transfer_00102:
;source-doc/base-drv/transfers.c:50: const uint8_t max_packet_size) { ;source-doc/base-drv/transfers.c:50: const uint8_t max_packet_size) {
push bc push bc
call _critical_begin call _critical_begin
;source-doc/base-drv/transfers.c:52: endpoint_param endpoint = {1, 0, max_packet_size};
ld l,(ix+8) ld l,(ix+8)
call _ch_set_usb_address call _ch_set_usb_address
pop bc pop bc
@ -158,7 +159,9 @@ l_usb_control_transfer_00102:
call _ch_write_data call _ch_write_data
pop af pop af
inc sp inc sp
;source-doc/base-drv/transfers.c:55:
call _ch_issue_token_setup call _ch_issue_token_setup
;source-doc/base-drv/transfers.c:56: if (transferIn && buffer == 0)
call _ch_short_wait_int_and_get_stat call _ch_short_wait_int_and_get_stat
pop bc pop bc
;source-doc/base-drv/transfers.c:57: return USB_ERR_OTHER; ;source-doc/base-drv/transfers.c:57: return USB_ERR_OTHER;
@ -175,13 +178,13 @@ l_usb_control_transfer_00102:
ld b,a ld b,a
or c or c
jr Z,l_usb_control_transfer_00116 jr Z,l_usb_control_transfer_00116
ld hl,0
add hl, sp
ld e,(ix+6) ld e,(ix+6)
ld d,(ix+7) ld d,(ix+7)
ld a,(ix-1) ld a,(ix-1)
or a or a
jr Z,l_usb_control_transfer_00118 jr Z,l_usb_control_transfer_00118
ld hl,0
add hl, sp
push hl push hl
push bc push bc
push de push de
@ -191,8 +194,6 @@ l_usb_control_transfer_00102:
pop af pop af
jr l_usb_control_transfer_00119 jr l_usb_control_transfer_00119
l_usb_control_transfer_00118: l_usb_control_transfer_00118:
ld hl,0
add hl, sp
push hl push hl
push bc push bc
push de push de
@ -220,7 +221,7 @@ l_usb_control_transfer_00117:
;source-doc/base-drv/transfers.c:69: ;source-doc/base-drv/transfers.c:69:
ld a,0x00 ld a,0x00
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;source-doc/base-drv/transfers.c:70: result = length != 0 ;source-doc/base-drv/transfers.c:70: result = length != 0
call _ch_issue_token_out_ep0 call _ch_issue_token_out_ep0
;source-doc/base-drv/transfers.c:71: ? (transferIn ? ch_data_in_transfer(buffer, length, &endpoint) : ch_data_out_transfer(buffer, length, &endpoint)) ;source-doc/base-drv/transfers.c:71: ? (transferIn ? ch_data_in_transfer(buffer, length, &endpoint) : ch_data_out_transfer(buffer, length, &endpoint))
@ -392,7 +393,7 @@ _usb_data_in_transfer:
;source-doc/base-drv/transfers.c:126: * @brief Perform a USB data in on the specififed endpoint ;source-doc/base-drv/transfers.c:126: * @brief Perform a USB data in on the specififed endpoint
call _critical_end call _critical_end
;source-doc/base-drv/transfers.c:128: * @param buffer the buffer to receive the data ;source-doc/base-drv/transfers.c:128: * @param buffer the buffer to receive the data
ld hl,(_result)
ld hl, (_result)
;source-doc/base-drv/transfers.c:129: * @param buffer_size the maximum size of data to be received ;source-doc/base-drv/transfers.c:129: * @param buffer_size the maximum size of data to be received
pop ix pop ix
ret ret
@ -428,7 +429,7 @@ _usb_data_in_transfer_n:
;source-doc/base-drv/transfers.c:141: ;source-doc/base-drv/transfers.c:141:
call _critical_end call _critical_end
;source-doc/base-drv/transfers.c:143: ;source-doc/base-drv/transfers.c:143:
ld hl,(_result)
ld hl, (_result)
;source-doc/base-drv/transfers.c:144: return result; ;source-doc/base-drv/transfers.c:144: return result;
pop ix pop ix
ret ret
@ -464,7 +465,7 @@ _usb_data_out_transfer:
;source-doc/base-drv/transfers.c:156: usb_error ;source-doc/base-drv/transfers.c:156: usb_error
call _critical_end call _critical_end
;source-doc/base-drv/transfers.c:158: critical_begin(); ;source-doc/base-drv/transfers.c:158: critical_begin();
ld hl,(_result)
ld hl, (_result)
;source-doc/base-drv/transfers.c:159: ;source-doc/base-drv/transfers.c:159:
pop ix pop ix
ret ret

21
Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -56,20 +56,18 @@ _storage_count:
; --------------------------------- ; ---------------------------------
_chnative_seek: _chnative_seek:
push ix push ix
;source-doc/base-drv/usb-base-drv.c:7: storage_device->current_lba = lba;
ld ix,0 ld ix,0
add ix,sp add ix,sp
ld c,(ix+4)
ld b,(ix+5)
push bc
ld a,(ix-2)
ld c, l
ld b, h
;source-doc/base-drv/usb-base-drv.c:7: storage_device->current_lba = lba;
ld h,(ix+5)
ld a,(ix+4)
add a,0x0c add a,0x0c
ld c,l
ld b,h
ld l, a ld l, a
ld a,(ix-1)
adc a,0x00
ld h, a
jr NC,l_chnative_seek_00103
inc h
l_chnative_seek_00103:
ld (hl), e ld (hl), e
inc hl inc hl
ld (hl), d ld (hl), d
@ -80,7 +78,6 @@ _chnative_seek:
;source-doc/base-drv/usb-base-drv.c:8: return 0; ;source-doc/base-drv/usb-base-drv.c:8: return 0;
xor a xor a
;source-doc/base-drv/usb-base-drv.c:9: } ;source-doc/base-drv/usb-base-drv.c:9: }
ld sp, ix
pop ix pop ix
pop hl pop hl
pop bc pop bc

37
Source/HBIOS/ch376-native/base-drv/usb-init.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -74,11 +74,11 @@ _usb_host_bus_reset:
;source-doc/base-drv/ch376.h:111: ;source-doc/base-drv/ch376.h:111:
ld a,0x25 ld a,0x25
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;source-doc/base-drv/ch376.h:112: #define calc_max_packet_sizex(packet_size) (packet_size & 0x3FF) ;source-doc/base-drv/ch376.h:112: #define calc_max_packet_sizex(packet_size) (packet_size & 0x3FF)
ld a,0xdf ld a,0xdf
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;source-doc/base-drv/usb-init.c:20: return USB_ERR_OK; ;source-doc/base-drv/usb-init.c:20: return USB_ERR_OK;
ld l,0x00 ld l,0x00
;source-doc/base-drv/usb-init.c:21: } ;source-doc/base-drv/usb-init.c:21: }
@ -103,7 +103,7 @@ __chnative_init:
;source-doc/base-drv/usb-init.c:28: USB_MODULE_LEDS = 0x00; ;source-doc/base-drv/usb-init.c:28: USB_MODULE_LEDS = 0x00;
ld a,0x00 ld a,0x00
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/usb-init.c:30: ch_cmd_reset_all(); ;source-doc/base-drv/usb-init.c:30: ch_cmd_reset_all();
call _ch_cmd_reset_all call _ch_cmd_reset_all
;source-doc/base-drv/usb-init.c:32: delay_medium(); ;source-doc/base-drv/usb-init.c:32: delay_medium();
@ -128,7 +128,7 @@ l__chnative_init_00104:
;source-doc/base-drv/usb-init.c:39: USB_MODULE_LEDS = 0x00; ;source-doc/base-drv/usb-init.c:39: USB_MODULE_LEDS = 0x00;
ld a,0x00 ld a,0x00
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/usb-init.c:40: print_string("\b $"); ;source-doc/base-drv/usb-init.c:40: print_string("\b $");
ld hl,usb_init_str_1 ld hl,usb_init_str_1
call _print_string call _print_string
@ -137,7 +137,7 @@ l__chnative_init_00102:
;source-doc/base-drv/usb-init.c:42: USB_MODULE_LEDS = 0x03; ;source-doc/base-drv/usb-init.c:42: USB_MODULE_LEDS = 0x03;
ld a,0x03 ld a,0x03
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/usb-init.c:43: print_string("\b*$"); ;source-doc/base-drv/usb-init.c:43: print_string("\b*$");
ld hl,usb_init_str_2 ld hl,usb_init_str_2
call _print_string call _print_string
@ -162,7 +162,7 @@ l__chnative_init_00110:
or a or a
jr NZ,l__chnative_init_00108 jr NZ,l__chnative_init_00108
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/usb-init.c:54: print_string("\r\nCH376: NOT PRESENT$"); ;source-doc/base-drv/usb-init.c:54: print_string("\r\nCH376: NOT PRESENT$");
ld hl,usb_init_str_4 ld hl,usb_init_str_4
call _print_string call _print_string
@ -176,7 +176,7 @@ l__chnative_init_00111:
;source-doc/base-drv/usb-init.c:61: USB_MODULE_LEDS = 0x01; ;source-doc/base-drv/usb-init.c:61: USB_MODULE_LEDS = 0x01;
ld a,0x01 ld a,0x01
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/usb-init.c:63: print_hex(ch_cmd_get_ic_version()); ;source-doc/base-drv/usb-init.c:63: print_hex(ch_cmd_get_ic_version());
call _ch_cmd_get_ic_version call _ch_cmd_get_ic_version
call _print_hex call _print_hex
@ -190,21 +190,14 @@ l__chnative_init_00111:
l__chnative_init_00116: l__chnative_init_00116:
bit 0,(ix+4) bit 0,(ix+4)
jr Z,l__chnative_init_00120 jr Z,l__chnative_init_00120
ld de,0x000a
ld b,0x0a
jr l__chnative_init_00121 jr l__chnative_init_00121
l__chnative_init_00120: l__chnative_init_00120:
ld de,0x0005
ld b,0x05
l__chnative_init_00121: l__chnative_init_00121:
ld b, c
ld l,0x00
ld a, b
sub e
ld a, l
sbc a, d
jp PO, l__chnative_init_00185
xor 0x80
l__chnative_init_00185:
jp P, l__chnative_init_00114
ld a, c
sub b
jr NC,l__chnative_init_00114
;source-doc/base-drv/usb-init.c:69: const uint8_t r = ch_very_short_wait_int_and_get_(); ;source-doc/base-drv/usb-init.c:69: const uint8_t r = ch_very_short_wait_int_and_get_();
push bc push bc
call _ch_very_short_wait_int_and_get call _ch_very_short_wait_int_and_get
@ -221,7 +214,7 @@ l__chnative_init_00185:
;source-doc/base-drv/usb-init.c:76: USB_MODULE_LEDS = 0x03; ;source-doc/base-drv/usb-init.c:76: USB_MODULE_LEDS = 0x03;
ld a,0x03 ld a,0x03
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/usb-init.c:77: return; ;source-doc/base-drv/usb-init.c:77: return;
jr l__chnative_init_00118 jr l__chnative_init_00118
l__chnative_init_00117: l__chnative_init_00117:
@ -232,7 +225,7 @@ l__chnative_init_00114:
;source-doc/base-drv/usb-init.c:81: USB_MODULE_LEDS = 0x00; ;source-doc/base-drv/usb-init.c:81: USB_MODULE_LEDS = 0x00;
ld a,0x00 ld a,0x00
ld bc,_USB_MODULE_LEDS ld bc,_USB_MODULE_LEDS
out (c),a
out (c), a
;source-doc/base-drv/usb-init.c:82: print_string("USB: DISCONNECTED$"); ;source-doc/base-drv/usb-init.c:82: print_string("USB: DISCONNECTED$");
ld hl,usb_init_str_8 ld hl,usb_init_str_8
call _print_string call _print_string

16
Source/HBIOS/ch376-native/base-drv/usb_state.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -70,10 +70,8 @@ l_find_device_config_00103:
ld h, d ld h, d
ld a, (hl) ld a, (hl)
and 0x0f and 0x0f
ld c, a
;source-doc/base-drv/usb_state.c:20: if (type == requested_type) ;source-doc/base-drv/usb_state.c:20: if (type == requested_type)
ld a,(ix+4)
sub c
sub (ix+4)
jr NZ,l_find_device_config_00102 jr NZ,l_find_device_config_00102
;source-doc/base-drv/usb_state.c:21: return (device_config *)p_config; ;source-doc/base-drv/usb_state.c:21: return (device_config *)p_config;
ex de, hl ex de, hl
@ -168,12 +166,14 @@ l_next_device_config_00102:
ld a,0x00 ld a,0x00
adc a, +((_device_config_sizes) / 256) adc a, +((_device_config_sizes) / 256)
ld h, a ld h, a
ld l, (hl)
ld a, (hl)
;source-doc/base-drv/usb_state.c:58: const uint8_t *_p = (uint8_t *)p; ;source-doc/base-drv/usb_state.c:58: const uint8_t *_p = (uint8_t *)p;
;source-doc/base-drv/usb_state.c:59: device_config *const result = (device_config *)(_p + size); ;source-doc/base-drv/usb_state.c:59: device_config *const result = (device_config *)(_p + size);
ld h,0x00
add hl, de
ex de, hl
add a, e
ld e, a
ld a,0x00
adc a, d
ld d, a
;source-doc/base-drv/usb_state.c:61: if (result >= (device_config *)&usb_state->device_configs_end) ;source-doc/base-drv/usb_state.c:61: if (result >= (device_config *)&usb_state->device_configs_end)
ld hl,0x0068 ld hl,0x0068
add hl, bc add hl, bc

2
Source/HBIOS/ch376-native/base-drv/work-area.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------

4
Source/HBIOS/ch376-native/keyboard/class_hid.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -62,6 +62,7 @@ _hid_set_protocol:
push af push af
;source-doc/keyboard/class_hid.c:8: cmd = cmd_hid_set; ;source-doc/keyboard/class_hid.c:8: cmd = cmd_hid_set;
push hl push hl
ex de,hl
ld hl,2 ld hl,2
add hl, sp add hl, sp
ex de, hl ex de, hl
@ -126,6 +127,7 @@ _hid_set_idle:
push af push af
;source-doc/keyboard/class_hid.c:18: cmd = cmd_hid_set; ;source-doc/keyboard/class_hid.c:18: cmd = cmd_hid_set;
push hl push hl
ex de,hl
ld hl,2 ld hl,2
add hl, sp add hl, sp
ex de, hl ex de, hl

8
Source/HBIOS/ch376-native/keyboard/class_hid_keyboard.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -184,16 +184,14 @@ l_scancode_to_char_00120:
ld d,0x00 ld d,0x00
ld hl,_scancodes_shift_table ld hl,_scancodes_shift_table
add hl, de add hl, de
ld a,(hl)
ld c,a
ld a, (hl)
jp _char_with_caps_lock jp _char_with_caps_lock
l_scancode_to_char_00122: l_scancode_to_char_00122:
;source-doc/keyboard/class_hid_keyboard.c:380: return char_with_caps_lock(scancodes_shift_table[code]); ;source-doc/keyboard/class_hid_keyboard.c:380: return char_with_caps_lock(scancodes_shift_table[code]);
ld d,0x00 ld d,0x00
ld hl,_scancodes_table ld hl,_scancodes_table
add hl, de add hl, de
ld a,(hl)
ld c,a
ld a, (hl)
jp _char_with_caps_lock jp _char_with_caps_lock
l_scancode_to_char_00123: l_scancode_to_char_00123:
;source-doc/keyboard/class_hid_keyboard.c:381: ;source-doc/keyboard/class_hid_keyboard.c:381:

51
Source/HBIOS/ch376-native/keyboard/kyb-init.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -173,8 +173,8 @@ l_keyboard_buf_put_00110:
ld b,0x00 ld b,0x00
ld hl,_previous_keyCodes ld hl,_previous_keyCodes
add hl, bc add hl, bc
ld a,(ix+5)
sub (hl)
ld a, (hl)
sub (ix+5)
;source-doc/keyboard/kyb-init.c:57: if (previous_keyCodes[i] == key_code) ;source-doc/keyboard/kyb-init.c:57: if (previous_keyCodes[i] == key_code)
jr Z,l_keyboard_buf_put_00112 jr Z,l_keyboard_buf_put_00112
;source-doc/keyboard/kyb-init.c:55: // if already reported, just skip it ;source-doc/keyboard/kyb-init.c:55: // if already reported, just skip it
@ -182,7 +182,7 @@ l_keyboard_buf_put_00110:
jr l_keyboard_buf_put_00110 jr l_keyboard_buf_put_00110
l_keyboard_buf_put_00106: l_keyboard_buf_put_00106:
;source-doc/keyboard/kyb-init.c:59: ;source-doc/keyboard/kyb-init.c:59:
ld a,(_write_index)
ld a, (_write_index)
inc a inc a
and 0x07 and 0x07
ld c, a ld c, a
@ -192,21 +192,20 @@ l_keyboard_buf_put_00106:
jr Z,l_keyboard_buf_put_00112 jr Z,l_keyboard_buf_put_00112
;source-doc/keyboard/kyb-init.c:61: if (next_write_index != read_index) { // Check if buffer is not full ;source-doc/keyboard/kyb-init.c:61: if (next_write_index != read_index) { // Check if buffer is not full
ld de,_buffer+0 ld de,_buffer+0
ld hl,(_write_index)
ld hl, (_write_index)
ld h,0x00 ld h,0x00
add hl, hl add hl, hl
add hl, de add hl, de
ld a,(ix+4) ld a,(ix+4)
ld (hl), a ld (hl), a
;source-doc/keyboard/kyb-init.c:62: buffer[write_index].modifier_keys = modifier_keys; ;source-doc/keyboard/kyb-init.c:62: buffer[write_index].modifier_keys = modifier_keys;
ld hl,(_write_index)
ld hl, (_write_index)
ld h,0x00 ld h,0x00
add hl, hl add hl, hl
add hl, de add hl, de
ex de, hl
inc de
inc hl
ld a,(ix+5) ld a,(ix+5)
ld (de), a
ld (hl), a
;source-doc/keyboard/kyb-init.c:63: buffer[write_index].key_code = key_code; ;source-doc/keyboard/kyb-init.c:63: buffer[write_index].key_code = key_code;
ld hl,_write_index ld hl,_write_index
ld (hl), c ld (hl), c
@ -231,13 +230,11 @@ _keyboard_buf_size:
jr l_keyboard_buf_size_00103 jr l_keyboard_buf_size_00103
l_keyboard_buf_size_00102: l_keyboard_buf_size_00102:
;source-doc/keyboard/kyb-init.c:71: ;source-doc/keyboard/kyb-init.c:71:
ld hl,_read_index
ld c, (hl)
ld hl, (_read_index)
ld a,0x08 ld a,0x08
sub c
ld hl,_write_index
ld c, (hl)
add a, c
sub l
ld hl, (_write_index)
add a, l
l_keyboard_buf_size_00103: l_keyboard_buf_size_00103:
;source-doc/keyboard/kyb-init.c:72: return KEYBOARD_BUFFER_SIZE - read_index + write_index; ;source-doc/keyboard/kyb-init.c:72: return KEYBOARD_BUFFER_SIZE - read_index + write_index;
ret ret
@ -264,7 +261,7 @@ _keyboard_buf_get_next:
l_keyboard_buf_get_next_00102: l_keyboard_buf_get_next_00102:
;source-doc/keyboard/kyb-init.c:78: ;source-doc/keyboard/kyb-init.c:78:
ld bc,_buffer+0 ld bc,_buffer+0
ld hl,(_read_index)
ld hl, (_read_index)
ld h,0x00 ld h,0x00
add hl, hl add hl, hl
add hl, bc add hl, bc
@ -273,11 +270,10 @@ l_keyboard_buf_get_next_00102:
inc hl inc hl
ld c, (hl) ld c, (hl)
;source-doc/keyboard/kyb-init.c:80: const uint8_t key_code = buffer[read_index].key_code; ;source-doc/keyboard/kyb-init.c:80: const uint8_t key_code = buffer[read_index].key_code;
ld hl,_read_index
ld a, (hl)
ld a, (_read_index)
inc a inc a
and 0x07 and 0x07
ld (hl), a
ld (_read_index),a
;source-doc/keyboard/kyb-init.c:82: ;source-doc/keyboard/kyb-init.c:82:
ld a, c ld a, c
sub 0x39 sub 0x39
@ -325,11 +321,10 @@ l_keyboard_buf_get_next_00105:
; --------------------------------- ; ---------------------------------
_keyboard_buf_flush: _keyboard_buf_flush:
;source-doc/keyboard/kyb-init.c:93: void keyboard_buf_flush() { ;source-doc/keyboard/kyb-init.c:93: void keyboard_buf_flush() {
ld hl,_write_index
ld (hl),0x00
;source-doc/keyboard/kyb-init.c:94: write_index = 0; ;source-doc/keyboard/kyb-init.c:94: write_index = 0;
ld hl,_read_index
ld (hl),0x00
xor a
ld (_write_index),a
ld (_read_index),a
;source-doc/keyboard/kyb-init.c:95: read_index = 0; ;source-doc/keyboard/kyb-init.c:95: read_index = 0;
ret ret
;source-doc/keyboard/kyb-init.c:101: ;source-doc/keyboard/kyb-init.c:101:
@ -349,13 +344,13 @@ _keyboard_tick:
;././source-doc/base-drv//ch376.h:111: ;././source-doc/base-drv//ch376.h:111:
ld a,0x25 ld a,0x25
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;././source-doc/base-drv//ch376.h:112: #define calc_max_packet_sizex(packet_size) (packet_size & 0x3FF) ;././source-doc/base-drv//ch376.h:112: #define calc_max_packet_sizex(packet_size) (packet_size & 0x3FF)
ld a,0x1f ld a,0x1f
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;source-doc/keyboard/kyb-init.c:106: ch_configure_nak_retry_disable(); ;source-doc/keyboard/kyb-init.c:106: ch_configure_nak_retry_disable();
ld bc,_report+0
ld bc,_report
ld hl, (_keyboard_config) ld hl, (_keyboard_config)
ld a,0x08 ld a,0x08
push af push af
@ -374,11 +369,11 @@ _keyboard_tick:
;././source-doc/base-drv//ch376.h:111: ;././source-doc/base-drv//ch376.h:111:
ld a,0x25 ld a,0x25
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;././source-doc/base-drv//ch376.h:112: #define calc_max_packet_sizex(packet_size) (packet_size & 0x3FF) ;././source-doc/base-drv//ch376.h:112: #define calc_max_packet_sizex(packet_size) (packet_size & 0x3FF)
ld a,0xdf ld a,0xdf
ld bc,_CH376_DATA_PORT ld bc,_CH376_DATA_PORT
out (c),a
out (c), a
;source-doc/keyboard/kyb-init.c:108: ch_configure_nak_retry_3s(); ;source-doc/keyboard/kyb-init.c:108: ch_configure_nak_retry_3s();
ld hl,_result ld hl,_result
ld a, (hl) ld a, (hl)

436
Source/HBIOS/ch376-native/scsi-drv/class_scsi.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -70,7 +70,7 @@ _do_scsi_cmd:
push ix push ix
ld ix,0 ld ix,0
add ix,sp add ix,sp
ld hl, -6
ld hl, -8
add hl, sp add hl, sp
ld sp, hl ld sp, hl
;source-doc/scsi-drv/class_scsi.c:17: cbw->dCBWTag[0] = next_tag++; ;source-doc/scsi-drv/class_scsi.c:17: cbw->dCBWTag[0] = next_tag++;
@ -79,7 +79,10 @@ _do_scsi_cmd:
ld hl,0x0004 ld hl,0x0004
add hl, bc add hl, bc
ex (sp), hl ex (sp), hl
ld de,(_next_tag)
ld a, (_next_tag)
ld e, a
ld hl,_next_tag + 1
ld d, (hl)
ld hl, (_next_tag) ld hl, (_next_tag)
inc hl inc hl
ld (_next_tag), hl ld (_next_tag), hl
@ -102,39 +105,43 @@ l_do_scsi_cmd_00102:
pop bc pop bc
;source-doc/scsi-drv/class_scsi.c:25: &dev->endpoints[ENDPOINT_BULK_OUT])); ;source-doc/scsi-drv/class_scsi.c:25: &dev->endpoints[ENDPOINT_BULK_OUT]));
ld a,(ix+4) ld a,(ix+4)
ld (ix-4),a
ld (ix-6),a
ld e, a
ld a,(ix+5) ld a,(ix+5)
ld (ix-5),a
ld d,a
inc de
inc de
inc de
ld a,(ix-6)
ld (ix-4),a
ld l, a
ld a,(ix-5)
ld (ix-3),a ld (ix-3),a
ld a,(ix-4)
add a,0x03
ld (ix-2),a
ld a,(ix-3)
adc a,0x00
ld (ix-1),a
ld l,(ix-4)
ld h,(ix-3)
ld h,a
ld a, (hl) ld a, (hl)
rlca rlca
rlca rlca
rlca rlca
rlca rlca
and 0x0f and 0x0f
ld e,(ix+6)
ld d,(ix+7)
ld l,(ix+6)
ld h,(ix+7)
push bc push bc
ld l,(ix-2)
ld h,(ix-1)
push hl
push de
push de
push af push af
inc sp inc sp
push hl
ld hl,0x001f ld hl,0x001f
ex (sp), hl
push hl push hl
push de
call _usb_data_out_transfer call _usb_data_out_transfer
pop af pop af
pop af pop af
pop af pop af
inc sp inc sp
pop de
pop bc pop bc
ld a, l ld a, l
ld (_result), a ld (_result), a
@ -144,30 +151,33 @@ l_do_scsi_cmd_00102:
;source-doc/scsi-drv/class_scsi.c:27: if (cbw->dCBWDataTransferLength != 0) { ;source-doc/scsi-drv/class_scsi.c:27: if (cbw->dCBWDataTransferLength != 0) {
ld hl,8 ld hl,8
add hl, bc add hl, bc
ld e, (hl)
ld c, (hl)
inc hl inc hl
ld d, (hl)
ld b, (hl)
inc hl inc hl
ld c, (hl)
inc hl inc hl
ld a, (hl) ld a, (hl)
dec hl
ld l, (hl)
or l
or b
or c or c
or d
or e
jr Z,l_do_scsi_cmd_00113 jr Z,l_do_scsi_cmd_00113
;source-doc/scsi-drv/class_scsi.c:30: &dev->endpoints[ENDPOINT_BULK_IN])); ;source-doc/scsi-drv/class_scsi.c:30: &dev->endpoints[ENDPOINT_BULK_IN]));
ld c,(ix+8)
ld b,(ix+9)
ld a,(ix+8)
ld (ix-2),a
ld a,(ix+9)
ld (ix-1),a
;source-doc/scsi-drv/class_scsi.c:28: if (!send) { ;source-doc/scsi-drv/class_scsi.c:28: if (!send) {
bit 0,(ix+10) bit 0,(ix+10)
jr NZ,l_do_scsi_cmd_00110 jr NZ,l_do_scsi_cmd_00110
;source-doc/scsi-drv/class_scsi.c:30: &dev->endpoints[ENDPOINT_BULK_IN])); ;source-doc/scsi-drv/class_scsi.c:30: &dev->endpoints[ENDPOINT_BULK_IN]));
ld a,(ix-4)
ld a,(ix-6)
add a,0x06 add a,0x06
ld (ix-2),a
ld a,(ix-3)
ld e, a
ld a,(ix-5)
adc a,0x00 adc a,0x00
ld (ix-1),a
ld d, a
ld l,(ix-4) ld l,(ix-4)
ld h,(ix-3) ld h,(ix-3)
ld a, (hl) ld a, (hl)
@ -176,13 +186,13 @@ l_do_scsi_cmd_00102:
rlca rlca
rlca rlca
and 0x0f and 0x0f
ld l,(ix-2)
ld h,(ix-1)
push hl
push de
push af push af
inc sp inc sp
push de
push bc push bc
ld l,(ix-2)
ld h,(ix-1)
push hl
call _usb_data_in_transfer call _usb_data_in_transfer
pop af pop af
pop af pop af
@ -204,13 +214,13 @@ l_do_scsi_cmd_00110:
rlca rlca
rlca rlca
and 0x0f and 0x0f
ld l,(ix-2)
ld h,(ix-1)
push hl
push de
push af push af
inc sp inc sp
push de
push bc push bc
ld l,(ix-2)
ld h,(ix-1)
push hl
call _usb_data_out_transfer call _usb_data_out_transfer
pop af pop af
pop af pop af
@ -223,10 +233,10 @@ l_do_scsi_cmd_00110:
jr NZ,l_do_scsi_cmd_00120 jr NZ,l_do_scsi_cmd_00120
l_do_scsi_cmd_00113: l_do_scsi_cmd_00113:
;source-doc/scsi-drv/class_scsi.c:39: usb_data_in_transfer((uint8_t *)&csw, sizeof(_scsi_command_status_wrapper), dev->address, &dev->endpoints[ENDPOINT_BULK_IN])); ;source-doc/scsi-drv/class_scsi.c:39: usb_data_in_transfer((uint8_t *)&csw, sizeof(_scsi_command_status_wrapper), dev->address, &dev->endpoints[ENDPOINT_BULK_IN]));
ld a,(ix-4)
ld a,(ix-6)
add a,0x06 add a,0x06
ld e, a ld e, a
ld a,(ix-3)
ld a,(ix-5)
adc a,0x00 adc a,0x00
ld d, a ld d, a
ld l,(ix-4) ld l,(ix-4)
@ -275,14 +285,14 @@ l_do_scsi_cmd_00113:
jr l_do_scsi_cmd_00120 jr l_do_scsi_cmd_00120
l_do_scsi_cmd_00117: l_do_scsi_cmd_00117:
;source-doc/scsi-drv/class_scsi.c:44: result = USB_ERR_OK; ;source-doc/scsi-drv/class_scsi.c:44: result = USB_ERR_OK;
ld hl,_result
ld (hl),0x00
xor a
ld (_result),a
;source-doc/scsi-drv/class_scsi.c:46: done: ;source-doc/scsi-drv/class_scsi.c:46: done:
l_do_scsi_cmd_00120: l_do_scsi_cmd_00120:
;source-doc/scsi-drv/class_scsi.c:47: critical_end(); ;source-doc/scsi-drv/class_scsi.c:47: critical_end();
call _critical_end call _critical_end
;source-doc/scsi-drv/class_scsi.c:48: return result; ;source-doc/scsi-drv/class_scsi.c:48: return result;
ld hl,(_result)
ld hl, (_result)
;source-doc/scsi-drv/class_scsi.c:49: } ;source-doc/scsi-drv/class_scsi.c:49: }
ld sp, ix ld sp, ix
pop ix pop ix
@ -301,37 +311,43 @@ _get_scsi_read_capacity:
;source-doc/scsi-drv/class_scsi.c:55: cbw_scsi.cbw = scsi_command_block_wrapper; ;source-doc/scsi-drv/class_scsi.c:55: cbw_scsi.cbw = scsi_command_block_wrapper;
ld hl,0 ld hl,0
add hl, sp add hl, sp
ex de, hl
ld e,l
ld d,h
push hl
ld bc,0x000f ld bc,0x000f
ld hl,_scsi_command_block_wrapper ld hl,_scsi_command_block_wrapper
ldir ldir
;source-doc/scsi-drv/class_scsi.c:56: cbw_scsi.read_capacity = scsi_read_capacity; ;source-doc/scsi-drv/class_scsi.c:56: cbw_scsi.read_capacity = scsi_read_capacity;
ld hl,15
ld hl,17
add hl, sp add hl, sp
ex de, hl ex de, hl
ld bc,0x000c ld bc,0x000c
ld hl,_scsi_read_capacity ld hl,_scsi_read_capacity
ldir ldir
pop bc
;source-doc/scsi-drv/class_scsi.c:58: cbw_scsi.cbw.bCBWLUN = 0; ;source-doc/scsi-drv/class_scsi.c:58: cbw_scsi.cbw.bCBWLUN = 0;
ld (ix-14),0x00 ld (ix-14),0x00
;source-doc/scsi-drv/class_scsi.c:59: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_read_capacity); ;source-doc/scsi-drv/class_scsi.c:59: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_read_capacity);
ld (ix-13),0x0c ld (ix-13),0x0c
;source-doc/scsi-drv/class_scsi.c:60: cbw_scsi.cbw.dCBWDataTransferLength = sizeof(scsi_read_capacity_result); ;source-doc/scsi-drv/class_scsi.c:60: cbw_scsi.cbw.dCBWDataTransferLength = sizeof(scsi_read_capacity_result);
ld (ix-19),0x08
ld hl,0x0008
add hl, bc
ld (hl),0x08
inc hl
xor a xor a
ld (ix-18),a
ld (ix-17),a
ld (ix-16),a
ld (hl), a
inc hl
ld (hl), a
inc hl
ld (hl), a
;source-doc/scsi-drv/class_scsi.c:62: return do_scsi_cmd(dev, &cbw_scsi.cbw, cap_result, false); ;source-doc/scsi-drv/class_scsi.c:62: return do_scsi_cmd(dev, &cbw_scsi.cbw, cap_result, false);
ld c,(ix+6)
ld b,(ix+7)
ld e,(ix+6)
ld d,(ix+7)
xor a xor a
push af push af
inc sp inc sp
push de
push bc push bc
ld hl,3
add hl, sp
push hl
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl
@ -354,37 +370,43 @@ _scsi_inquiry:
;source-doc/scsi-drv/class_scsi.c:69: cbw_scsi.cbw = scsi_command_block_wrapper; ;source-doc/scsi-drv/class_scsi.c:69: cbw_scsi.cbw = scsi_command_block_wrapper;
ld hl,0 ld hl,0
add hl, sp add hl, sp
ex de, hl
ld e,l
ld d,h
push hl
ld bc,0x000f ld bc,0x000f
ld hl,_scsi_command_block_wrapper ld hl,_scsi_command_block_wrapper
ldir ldir
;source-doc/scsi-drv/class_scsi.c:70: cbw_scsi.inquiry = scsi_packet_inquiry; ;source-doc/scsi-drv/class_scsi.c:70: cbw_scsi.inquiry = scsi_packet_inquiry;
ld hl,15
ld hl,17
add hl, sp add hl, sp
ex de, hl ex de, hl
ld bc,0x000c ld bc,0x000c
ld hl,_scsi_packet_inquiry ld hl,_scsi_packet_inquiry
ldir ldir
pop bc
;source-doc/scsi-drv/class_scsi.c:72: cbw_scsi.cbw.bCBWLUN = 0; ;source-doc/scsi-drv/class_scsi.c:72: cbw_scsi.cbw.bCBWLUN = 0;
ld (ix-14),0x00 ld (ix-14),0x00
;source-doc/scsi-drv/class_scsi.c:73: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_inquiry); ;source-doc/scsi-drv/class_scsi.c:73: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_inquiry);
ld (ix-13),0x0c ld (ix-13),0x0c
;source-doc/scsi-drv/class_scsi.c:74: cbw_scsi.cbw.dCBWDataTransferLength = 0x24; ;source-doc/scsi-drv/class_scsi.c:74: cbw_scsi.cbw.dCBWDataTransferLength = 0x24;
ld (ix-19),0x24
ld hl,0x0008
add hl, bc
ld (hl),0x24
inc hl
xor a xor a
ld (ix-18),a
ld (ix-17),a
ld (ix-16),a
ld (hl), a
inc hl
ld (hl), a
inc hl
ld (hl), a
;source-doc/scsi-drv/class_scsi.c:76: return do_scsi_cmd(dev, &cbw_scsi.cbw, inq_result, false); ;source-doc/scsi-drv/class_scsi.c:76: return do_scsi_cmd(dev, &cbw_scsi.cbw, inq_result, false);
ld c,(ix+6)
ld b,(ix+7)
ld e,(ix+6)
ld d,(ix+7)
xor a xor a
push af push af
inc sp inc sp
push de
push bc push bc
ld hl,3
add hl, sp
push hl
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl
@ -407,12 +429,14 @@ _scsi_test:
;source-doc/scsi-drv/class_scsi.c:81: cbw_scsi.cbw = scsi_command_block_wrapper; ;source-doc/scsi-drv/class_scsi.c:81: cbw_scsi.cbw = scsi_command_block_wrapper;
ld hl,0 ld hl,0
add hl, sp add hl, sp
ex de, hl
ld e,l
ld d,h
push hl
ld bc,0x000f ld bc,0x000f
ld hl,_scsi_command_block_wrapper ld hl,_scsi_command_block_wrapper
ldir ldir
;source-doc/scsi-drv/class_scsi.c:82: memset(&cbw_scsi.test, 0, sizeof(_scsi_packet_test)); ;source-doc/scsi-drv/class_scsi.c:82: memset(&cbw_scsi.test, 0, sizeof(_scsi_packet_test));
ld hl,15
ld hl,17
add hl, sp add hl, sp
ld b,0x06 ld b,0x06
l_scsi_test_00103: l_scsi_test_00103:
@ -422,30 +446,29 @@ l_scsi_test_00103:
ld (hl), a ld (hl), a
inc hl inc hl
djnz l_scsi_test_00103 djnz l_scsi_test_00103
pop bc
;source-doc/scsi-drv/class_scsi.c:84: cbw_scsi.cbw.bCBWLUN = 0; ;source-doc/scsi-drv/class_scsi.c:84: cbw_scsi.cbw.bCBWLUN = 0;
ld (ix-14),0x00 ld (ix-14),0x00
;source-doc/scsi-drv/class_scsi.c:85: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_test); ;source-doc/scsi-drv/class_scsi.c:85: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_test);
ld (ix-13),0x0c ld (ix-13),0x0c
;source-doc/scsi-drv/class_scsi.c:86: cbw_scsi.cbw.dCBWDataTransferLength = 0; ;source-doc/scsi-drv/class_scsi.c:86: cbw_scsi.cbw.dCBWDataTransferLength = 0;
ld hl,8
add hl, sp
ld hl,0x0008
add hl, bc
xor a xor a
ld (hl),a
ld (hl), a
inc hl inc hl
ld (hl),a
ld (hl), a
inc hl inc hl
ld (hl),a
ld (hl), a
inc hl inc hl
ld (hl),a
ld (hl), a
;source-doc/scsi-drv/class_scsi.c:88: return do_scsi_cmd(dev, &cbw_scsi.cbw, 0, false); ;source-doc/scsi-drv/class_scsi.c:88: return do_scsi_cmd(dev, &cbw_scsi.cbw, 0, false);
xor a xor a
push af push af
inc sp inc sp
ld hl,0x0000 ld hl,0x0000
push hl push hl
ld hl,3
add hl, sp
push hl
push bc
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl
@ -468,37 +491,43 @@ _scsi_request_sense:
;source-doc/scsi-drv/class_scsi.c:95: cbw_scsi.cbw = scsi_command_block_wrapper; ;source-doc/scsi-drv/class_scsi.c:95: cbw_scsi.cbw = scsi_command_block_wrapper;
ld hl,0 ld hl,0
add hl, sp add hl, sp
ex de, hl
ld e,l
ld d,h
push hl
ld bc,0x000f ld bc,0x000f
ld hl,_scsi_command_block_wrapper ld hl,_scsi_command_block_wrapper
ldir ldir
;source-doc/scsi-drv/class_scsi.c:96: cbw_scsi.request_sense = scsi_packet_request_sense; ;source-doc/scsi-drv/class_scsi.c:96: cbw_scsi.request_sense = scsi_packet_request_sense;
ld hl,15
ld hl,17
add hl, sp add hl, sp
ex de, hl ex de, hl
ld bc,0x000c ld bc,0x000c
ld hl,_scsi_packet_request_sense ld hl,_scsi_packet_request_sense
ldir ldir
pop bc
;source-doc/scsi-drv/class_scsi.c:98: cbw_scsi.cbw.bCBWLUN = 0; ;source-doc/scsi-drv/class_scsi.c:98: cbw_scsi.cbw.bCBWLUN = 0;
ld (ix-14),0x00 ld (ix-14),0x00
;source-doc/scsi-drv/class_scsi.c:99: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_request_sense); ;source-doc/scsi-drv/class_scsi.c:99: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_request_sense);
ld (ix-13),0x0c ld (ix-13),0x0c
;source-doc/scsi-drv/class_scsi.c:100: cbw_scsi.cbw.dCBWDataTransferLength = sizeof(scsi_sense_result); ;source-doc/scsi-drv/class_scsi.c:100: cbw_scsi.cbw.dCBWDataTransferLength = sizeof(scsi_sense_result);
ld (ix-19),0x12
ld hl,0x0008
add hl, bc
ld (hl),0x12
inc hl
xor a xor a
ld (ix-18),a
ld (ix-17),a
ld (ix-16),a
ld (hl), a
inc hl
ld (hl), a
inc hl
ld (hl), a
;source-doc/scsi-drv/class_scsi.c:102: return do_scsi_cmd(dev, &cbw_scsi.cbw, sens_result, false); ;source-doc/scsi-drv/class_scsi.c:102: return do_scsi_cmd(dev, &cbw_scsi.cbw, sens_result, false);
ld c,(ix+6)
ld b,(ix+7)
ld e,(ix+6)
ld d,(ix+7)
xor a xor a
push af push af
inc sp inc sp
push de
push bc push bc
ld hl,3
add hl, sp
push hl
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl
@ -553,7 +582,7 @@ l_scsi_sense_init_00104:
;source-doc/scsi-drv/class_scsi.c:112: critical_end(); ;source-doc/scsi-drv/class_scsi.c:112: critical_end();
call _critical_end call _critical_end
;source-doc/scsi-drv/class_scsi.c:114: return result; ;source-doc/scsi-drv/class_scsi.c:114: return result;
ld hl,(_result)
ld hl, (_result)
;source-doc/scsi-drv/class_scsi.c:115: } ;source-doc/scsi-drv/class_scsi.c:115: }
ld sp, ix ld sp, ix
pop ix pop ix
@ -566,17 +595,20 @@ _scsi_read:
push ix push ix
ld ix,0 ld ix,0
add ix,sp add ix,sp
push af
;source-doc/scsi-drv/class_scsi.c:120: memset(&cbw, 0, sizeof(cbw_scsi_read_write)); ;source-doc/scsi-drv/class_scsi.c:120: memset(&cbw, 0, sizeof(cbw_scsi_read_write));
ld hl,_cbw
ld de,_cbw
ld l, e
ld h, d
ld b,0x0e
jr l_scsi_read_00113
l_scsi_read_00112:
ld (hl),0x00 ld (hl),0x00
ld e, l
ld d, h
inc de
ld bc,0x001a
ldir
inc hl
l_scsi_read_00113:
ld (hl),0x00
inc hl
djnz l_scsi_read_00112
;source-doc/scsi-drv/class_scsi.c:121: cbw.cbw = scsi_command_block_wrapper; ;source-doc/scsi-drv/class_scsi.c:121: cbw.cbw = scsi_command_block_wrapper;
ld de,_cbw
ld bc,0x000f ld bc,0x000f
ld hl,_scsi_command_block_wrapper ld hl,_scsi_command_block_wrapper
ldir ldir
@ -598,50 +630,52 @@ _scsi_read:
ld hl,_cbw + 23 ld hl,_cbw + 23
ld (hl),0x01 ld (hl),0x01
;source-doc/scsi-drv/class_scsi.c:129: cbw.scsi_cmd.lba[0] = dev->current_lba >> 24; ;source-doc/scsi-drv/class_scsi.c:129: cbw.scsi_cmd.lba[0] = dev->current_lba >> 24;
ld c,(ix+4)
ld b,(ix+5)
ld hl,0x000c
add hl, bc
pop af
push hl
ld l,(ix+4)
ld h,(ix+5)
ld bc,0x000c
add hl,bc
ld c,l
ld b,h
inc hl inc hl
inc hl inc hl
inc hl inc hl
ld a, (hl) ld a, (hl)
ld ((_cbw + 17)),a ld ((_cbw + 17)),a
;source-doc/scsi-drv/class_scsi.c:130: cbw.scsi_cmd.lba[1] = dev->current_lba >> 16; ;source-doc/scsi-drv/class_scsi.c:130: cbw.scsi_cmd.lba[1] = dev->current_lba >> 16;
pop hl
push hl
inc hl
inc hl
ld a, (hl)
ld ((_cbw + 18)),a
;source-doc/scsi-drv/class_scsi.c:131: cbw.scsi_cmd.lba[2] = dev->current_lba >> 8; ;source-doc/scsi-drv/class_scsi.c:131: cbw.scsi_cmd.lba[2] = dev->current_lba >> 8;
pop hl
push hl
ld l,c
ld h,b
inc hl
inc hl inc hl
ld a,(hl) ld a,(hl)
ld ((_cbw + 19)),a
ld ((_cbw + 18)),a
dec hl
ld e, (hl)
ld hl, +(_cbw + 19)
ld (hl), e
;source-doc/scsi-drv/class_scsi.c:132: cbw.scsi_cmd.lba[3] = dev->current_lba; ;source-doc/scsi-drv/class_scsi.c:132: cbw.scsi_cmd.lba[3] = dev->current_lba;
pop hl
ld a,(hl)
push hl
ld ((_cbw + 20)),a
ld a, (bc)
inc hl
ld (hl), a
;source-doc/scsi-drv/class_scsi.c:134: result = do_scsi_cmd(dev, &cbw.cbw, buffer, false); ;source-doc/scsi-drv/class_scsi.c:134: result = do_scsi_cmd(dev, &cbw.cbw, buffer, false);
ld e,(ix+6) ld e,(ix+6)
ld d,(ix+7) ld d,(ix+7)
push bc
xor a xor a
push af push af
inc sp inc sp
push de push de
ld hl,_cbw ld hl,_cbw
push hl push hl
push bc
ld l,(ix+4)
ld h,(ix+5)
push hl
call _do_scsi_cmd call _do_scsi_cmd
pop af pop af
pop af pop af
pop af pop af
inc sp inc sp
pop bc
ld a, l ld a, l
ld (_result), a ld (_result), a
;source-doc/scsi-drv/class_scsi.c:136: if (result == USB_ERR_OK) ;source-doc/scsi-drv/class_scsi.c:136: if (result == USB_ERR_OK)
@ -649,35 +683,37 @@ _scsi_read:
or a or a
jr NZ,l_scsi_read_00102 jr NZ,l_scsi_read_00102
;source-doc/scsi-drv/class_scsi.c:137: dev->current_lba++; ;source-doc/scsi-drv/class_scsi.c:137: dev->current_lba++;
pop hl
ld c,(hl)
push hl
inc hl
ld b, (hl)
inc hl
ld l, c
ld h, b
ld e, (hl) ld e, (hl)
inc hl inc hl
ld d, (hl) ld d, (hl)
inc c
jr NZ,l_scsi_read_00112
inc b
jr NZ,l_scsi_read_00112
inc de
l_scsi_read_00112:
pop hl
push hl
ld (hl), c
inc hl
ld (hl), b
inc hl inc hl
ld (hl), e
ld a,(hl)
inc hl inc hl
ld (hl), d
ld h,(hl)
ld l,a
inc e
jr NZ,l_scsi_read_00114
inc d
jr NZ,l_scsi_read_00114
inc hl
l_scsi_read_00114:
ld a, e
ld (bc), a
inc bc
ld a, d
ld (bc), a
inc bc
ld a, l
ld (bc), a
inc bc
ld a, h
ld (bc), a
l_scsi_read_00102: l_scsi_read_00102:
;source-doc/scsi-drv/class_scsi.c:138: return result; ;source-doc/scsi-drv/class_scsi.c:138: return result;
ld hl,(_result)
ld hl, (_result)
;source-doc/scsi-drv/class_scsi.c:139: } ;source-doc/scsi-drv/class_scsi.c:139: }
ld sp, ix
pop ix pop ix
ret ret
;source-doc/scsi-drv/class_scsi.c:141: usb_error scsi_write(device_config_storage *const dev, uint8_t *const buffer) { ;source-doc/scsi-drv/class_scsi.c:141: usb_error scsi_write(device_config_storage *const dev, uint8_t *const buffer) {
@ -688,17 +724,20 @@ _scsi_write:
push ix push ix
ld ix,0 ld ix,0
add ix,sp add ix,sp
push af
;source-doc/scsi-drv/class_scsi.c:142: memset(&cbw, 0, sizeof(cbw_scsi_read_write)); ;source-doc/scsi-drv/class_scsi.c:142: memset(&cbw, 0, sizeof(cbw_scsi_read_write));
ld hl,_cbw
ld de,_cbw
ld l, e
ld h, d
ld b,0x0e
jr l_scsi_write_00113
l_scsi_write_00112:
ld (hl),0x00 ld (hl),0x00
ld e, l
ld d, h
inc de
ld bc,0x001a
ldir
inc hl
l_scsi_write_00113:
ld (hl),0x00
inc hl
djnz l_scsi_write_00112
;source-doc/scsi-drv/class_scsi.c:143: cbw.cbw = scsi_command_block_wrapper; ;source-doc/scsi-drv/class_scsi.c:143: cbw.cbw = scsi_command_block_wrapper;
ld de,_cbw
ld bc,0x000f ld bc,0x000f
ld hl,_scsi_command_block_wrapper ld hl,_scsi_command_block_wrapper
ldir ldir
@ -720,50 +759,52 @@ _scsi_write:
ld hl,_cbw + 23 ld hl,_cbw + 23
ld (hl),0x01 ld (hl),0x01
;source-doc/scsi-drv/class_scsi.c:151: cbw.scsi_cmd.lba[0] = dev->current_lba >> 24; ;source-doc/scsi-drv/class_scsi.c:151: cbw.scsi_cmd.lba[0] = dev->current_lba >> 24;
ld c,(ix+4)
ld b,(ix+5)
ld hl,0x000c
add hl, bc
pop af
push hl
ld l,(ix+4)
ld h,(ix+5)
ld bc,0x000c
add hl,bc
ld c,l
ld b,h
inc hl inc hl
inc hl inc hl
inc hl inc hl
ld a, (hl) ld a, (hl)
ld ((_cbw + 17)),a ld ((_cbw + 17)),a
;source-doc/scsi-drv/class_scsi.c:152: cbw.scsi_cmd.lba[1] = dev->current_lba >> 16; ;source-doc/scsi-drv/class_scsi.c:152: cbw.scsi_cmd.lba[1] = dev->current_lba >> 16;
pop hl
push hl
inc hl
inc hl
ld a, (hl)
ld ((_cbw + 18)),a
;source-doc/scsi-drv/class_scsi.c:153: cbw.scsi_cmd.lba[2] = dev->current_lba >> 8; ;source-doc/scsi-drv/class_scsi.c:153: cbw.scsi_cmd.lba[2] = dev->current_lba >> 8;
pop hl
push hl
ld l,c
ld h,b
inc hl
inc hl inc hl
ld a,(hl) ld a,(hl)
ld ((_cbw + 19)),a
ld ((_cbw + 18)),a
dec hl
ld e, (hl)
ld hl, +(_cbw + 19)
ld (hl), e
;source-doc/scsi-drv/class_scsi.c:154: cbw.scsi_cmd.lba[3] = dev->current_lba; ;source-doc/scsi-drv/class_scsi.c:154: cbw.scsi_cmd.lba[3] = dev->current_lba;
pop hl
ld a,(hl)
push hl
ld ((_cbw + 20)),a
ld a, (bc)
inc hl
ld (hl), a
;source-doc/scsi-drv/class_scsi.c:156: result = do_scsi_cmd(dev, &cbw.cbw, buffer, true); ;source-doc/scsi-drv/class_scsi.c:156: result = do_scsi_cmd(dev, &cbw.cbw, buffer, true);
ld e,(ix+6) ld e,(ix+6)
ld d,(ix+7) ld d,(ix+7)
push bc
ld a,0x01 ld a,0x01
push af push af
inc sp inc sp
push de push de
ld hl,_cbw ld hl,_cbw
push hl push hl
push bc
ld l,(ix+4)
ld h,(ix+5)
push hl
call _do_scsi_cmd call _do_scsi_cmd
pop af pop af
pop af pop af
pop af pop af
inc sp inc sp
pop bc
ld a, l ld a, l
ld (_result), a ld (_result), a
;source-doc/scsi-drv/class_scsi.c:158: if (result == USB_ERR_OK) ;source-doc/scsi-drv/class_scsi.c:158: if (result == USB_ERR_OK)
@ -771,35 +812,37 @@ _scsi_write:
or a or a
jr NZ,l_scsi_write_00102 jr NZ,l_scsi_write_00102
;source-doc/scsi-drv/class_scsi.c:159: dev->current_lba++; ;source-doc/scsi-drv/class_scsi.c:159: dev->current_lba++;
pop hl
ld c,(hl)
push hl
inc hl
ld b, (hl)
inc hl
ld l, c
ld h, b
ld e, (hl) ld e, (hl)
inc hl inc hl
ld d, (hl) ld d, (hl)
inc c
jr NZ,l_scsi_write_00112
inc b
jr NZ,l_scsi_write_00112
inc de
l_scsi_write_00112:
pop hl
push hl
ld (hl), c
inc hl
ld (hl), b
inc hl inc hl
ld (hl), e
ld a,(hl)
inc hl inc hl
ld (hl), d
ld h,(hl)
ld l,a
inc e
jr NZ,l_scsi_write_00114
inc d
jr NZ,l_scsi_write_00114
inc hl
l_scsi_write_00114:
ld a, e
ld (bc), a
inc bc
ld a, d
ld (bc), a
inc bc
ld a, l
ld (bc), a
inc bc
ld a, h
ld (bc), a
l_scsi_write_00102: l_scsi_write_00102:
;source-doc/scsi-drv/class_scsi.c:160: return result; ;source-doc/scsi-drv/class_scsi.c:160: return result;
ld hl,(_result)
ld hl, (_result)
;source-doc/scsi-drv/class_scsi.c:161: } ;source-doc/scsi-drv/class_scsi.c:161: }
ld sp, ix
pop ix pop ix
ret ret
;source-doc/scsi-drv/class_scsi.c:163: usb_error scsi_eject(device_config_storage *const dev) { ;source-doc/scsi-drv/class_scsi.c:163: usb_error scsi_eject(device_config_storage *const dev) {
@ -816,12 +859,14 @@ _scsi_eject:
;source-doc/scsi-drv/class_scsi.c:165: cbw_scsi.cbw = scsi_command_block_wrapper; ;source-doc/scsi-drv/class_scsi.c:165: cbw_scsi.cbw = scsi_command_block_wrapper;
ld hl,0 ld hl,0
add hl, sp add hl, sp
ex de, hl
ld e,l
ld d,h
push hl
ld bc,0x000f ld bc,0x000f
ld hl,_scsi_command_block_wrapper ld hl,_scsi_command_block_wrapper
ldir ldir
;source-doc/scsi-drv/class_scsi.c:167: memset(&cbw_scsi.eject, 0, sizeof(_scsi_packet_eject)); ;source-doc/scsi-drv/class_scsi.c:167: memset(&cbw_scsi.eject, 0, sizeof(_scsi_packet_eject));
ld hl,15
ld hl,17
add hl, sp add hl, sp
ld b,0x03 ld b,0x03
l_scsi_eject_00103: l_scsi_eject_00103:
@ -831,6 +876,7 @@ l_scsi_eject_00103:
ld (hl), a ld (hl), a
inc hl inc hl
djnz l_scsi_eject_00103 djnz l_scsi_eject_00103
pop bc
;source-doc/scsi-drv/class_scsi.c:169: cbw_scsi.eject.operation_code = 0x1B; ;source-doc/scsi-drv/class_scsi.c:169: cbw_scsi.eject.operation_code = 0x1B;
ld (ix-6),0x1b ld (ix-6),0x1b
;source-doc/scsi-drv/class_scsi.c:170: cbw_scsi.eject.loej = 1; ;source-doc/scsi-drv/class_scsi.c:170: cbw_scsi.eject.loej = 1;
@ -842,25 +888,23 @@ l_scsi_eject_00103:
;source-doc/scsi-drv/class_scsi.c:173: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_eject); ;source-doc/scsi-drv/class_scsi.c:173: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_eject);
ld (ix-7),0x06 ld (ix-7),0x06
;source-doc/scsi-drv/class_scsi.c:174: cbw_scsi.cbw.dCBWDataTransferLength = 0; ;source-doc/scsi-drv/class_scsi.c:174: cbw_scsi.cbw.dCBWDataTransferLength = 0;
ld hl,8
add hl, sp
ld hl,0x0008
add hl, bc
xor a xor a
ld (hl),a
ld (hl), a
inc hl inc hl
ld (hl),a
ld (hl), a
inc hl inc hl
ld (hl),a
ld (hl), a
inc hl inc hl
ld (hl),a
ld (hl), a
;source-doc/scsi-drv/class_scsi.c:176: return do_scsi_cmd(dev, &cbw_scsi.cbw, 0, false); ;source-doc/scsi-drv/class_scsi.c:176: return do_scsi_cmd(dev, &cbw_scsi.cbw, 0, false);
xor a xor a
push af push af
inc sp inc sp
ld hl,0x0000 ld hl,0x0000
push hl push hl
ld hl,3
add hl, sp
push hl
push bc
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl

6
Source/HBIOS/ch376-native/scsi-drv/scsi-init.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -85,14 +85,16 @@ l_chscsi_init_00105:
ld h,0x00 ld h,0x00
push de push de
call _print_uint16 call _print_uint16
;source-doc/scsi-drv/scsi-init.c:26: print_string(":$");
ld hl,scsi_init_str_1 ld hl,scsi_init_str_1
call _print_string call _print_string
pop de pop de
;source-doc/scsi-drv/scsi-init.c:27: print_uint16(storage_count); ;source-doc/scsi-drv/scsi-init.c:27: print_uint16(storage_count);
ld hl,(_storage_count)
ld hl, (_storage_count)
ld h,0x00 ld h,0x00
push de push de
call _print_uint16 call _print_uint16
;source-doc/scsi-drv/scsi-init.c:28: print_string(" $");
ld hl,scsi_init_str_2 ld hl,scsi_init_str_2
call _print_string call _print_string
pop de pop de

177
Source/HBIOS/ch376-native/ufi-drv/class_ufi.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -197,8 +197,6 @@ _ufi_test_unit_ready:
;source-doc/ufi-drv/class_ufi.c:35: memset(&ufi_cmd_request_test_unit_ready, 0, sizeof(ufi_test_unit_ready_command)); ;source-doc/ufi-drv/class_ufi.c:35: memset(&ufi_cmd_request_test_unit_ready, 0, sizeof(ufi_test_unit_ready_command));
ld hl,0 ld hl,0
add hl, sp add hl, sp
ld e,l
ld d,h
ld b,0x06 ld b,0x06
l_ufi_test_unit_ready_00104: l_ufi_test_unit_ready_00104:
xor a xor a
@ -215,7 +213,9 @@ l_ufi_test_unit_ready_00104:
xor a xor a
push af push af
inc sp inc sp
push de
ld hl,7
add hl, sp
push hl
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl
@ -226,26 +226,25 @@ l_ufi_test_unit_ready_00104:
;source-doc/ufi-drv/class_ufi.c:40: ufi_cmd_request_sense = _ufi_cmd_request_sense; ;source-doc/ufi-drv/class_ufi.c:40: ufi_cmd_request_sense = _ufi_cmd_request_sense;
ld hl,12 ld hl,12
add hl, sp add hl, sp
ld e,l
ld d,h
push hl
ex de, hl
ld bc,0x000c ld bc,0x000c
ld hl,__ufi_cmd_request_sense ld hl,__ufi_cmd_request_sense
ldir ldir
pop bc
;source-doc/ufi-drv/class_ufi.c:43: (uint8_t *)response, NULL); ;source-doc/ufi-drv/class_ufi.c:43: (uint8_t *)response, NULL);
ld e,(ix+6)
ld d,(ix+7)
ld c,(ix+6)
ld b,(ix+7)
;source-doc/ufi-drv/class_ufi.c:42: result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_sense, false, sizeof(ufi_request_sense_response), ;source-doc/ufi-drv/class_ufi.c:42: result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_sense, false, sizeof(ufi_request_sense_response),
ld hl,0x0000 ld hl,0x0000
push hl push hl
push de
push bc
ld l,0x12 ld l,0x12
push hl push hl
xor a xor a
push af push af
inc sp inc sp
push bc
ld hl,19
add hl, sp
push hl
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl
@ -269,25 +268,24 @@ _ufi_request_sense:
;source-doc/ufi-drv/class_ufi.c:51: ufi_cmd_request_sense = _ufi_cmd_request_sense; ;source-doc/ufi-drv/class_ufi.c:51: ufi_cmd_request_sense = _ufi_cmd_request_sense;
ld hl,0 ld hl,0
add hl, sp add hl, sp
ld e,l
ld d,h
push hl
ex de, hl
ld bc,0x000c ld bc,0x000c
ld hl,__ufi_cmd_request_sense ld hl,__ufi_cmd_request_sense
ldir ldir
pop bc
;source-doc/ufi-drv/class_ufi.c:53: usb_error result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_sense, false, sizeof(ufi_request_sense_response), ;source-doc/ufi-drv/class_ufi.c:53: usb_error result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_sense, false, sizeof(ufi_request_sense_response),
ld e,(ix+6)
ld d,(ix+7)
ld c,(ix+6)
ld b,(ix+7)
ld hl,0x0000 ld hl,0x0000
push hl push hl
push de
push bc
ld l,0x12 ld l,0x12
push hl push hl
xor a xor a
push af push af
inc sp inc sp
push bc
ld hl,7
add hl, sp
push hl
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl
@ -340,29 +338,30 @@ _ufi_read_frmt_caps:
pop af pop af
pop af pop af
inc sp inc sp
ld e, l
ld a, l
pop bc pop bc
ld l, a
;source-doc/ufi-drv/class_ufi.c:69: CHECK(result); ;source-doc/ufi-drv/class_ufi.c:69: CHECK(result);
ld a,e
ld l,a
or a or a
jr NZ,l_ufi_read_frmt_caps_00103 jr NZ,l_ufi_read_frmt_caps_00103
;source-doc/ufi-drv/class_ufi.c:71: const uint8_t available_length = response->capacity_list_length; ;source-doc/ufi-drv/class_ufi.c:71: const uint8_t available_length = response->capacity_list_length;
ld e,(ix+6)
ld d,(ix+7)
ld hl,3
add hl, de
ld e, (hl)
ld l,(ix+6)
ld h,(ix+7)
inc hl
inc hl
inc hl
ld a, (hl)
;source-doc/ufi-drv/class_ufi.c:73: const uint8_t max_length = ;source-doc/ufi-drv/class_ufi.c:73: const uint8_t max_length =
ld a,0x24
sub e
jr NC,l_ufi_read_frmt_caps_00106
cp 0x25
jr C,l_ufi_read_frmt_caps_00106
ld e,0x24 ld e,0x24
jr l_ufi_read_frmt_caps_00107
l_ufi_read_frmt_caps_00106: l_ufi_read_frmt_caps_00106:
ld e, a
l_ufi_read_frmt_caps_00107:
;source-doc/ufi-drv/class_ufi.c:77: memcpy(&cmd, &ufi_cmd_read_format_capacities, sizeof(cmd)); ;source-doc/ufi-drv/class_ufi.c:77: memcpy(&cmd, &ufi_cmd_read_format_capacities, sizeof(cmd));
push de push de
push bc push bc
ex de, hl
ld hl,16 ld hl,16
add hl, sp add hl, sp
ex de, hl ex de, hl
@ -417,25 +416,24 @@ _ufi_inquiry:
;source-doc/ufi-drv/class_ufi.c:90: ufi_cmd_inquiry = _ufi_cmd_inquiry; ;source-doc/ufi-drv/class_ufi.c:90: ufi_cmd_inquiry = _ufi_cmd_inquiry;
ld hl,0 ld hl,0
add hl, sp add hl, sp
ld e,l
ld d,h
push hl
ex de, hl
ld bc,0x000c ld bc,0x000c
ld hl,__ufi_cmd_inquiry ld hl,__ufi_cmd_inquiry
ldir ldir
pop bc
;source-doc/ufi-drv/class_ufi.c:92: usb_error result = ;source-doc/ufi-drv/class_ufi.c:92: usb_error result =
ld e,(ix+6)
ld d,(ix+7)
ld c,(ix+6)
ld b,(ix+7)
ld hl,0x0000 ld hl,0x0000
push hl push hl
push de
push bc
ld l,0x24 ld l,0x24
push hl push hl
xor a xor a
push af push af
inc sp inc sp
push bc
ld hl,7
add hl, sp
push hl
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl
@ -459,8 +457,6 @@ _ufi_read_write_sector:
;source-doc/ufi-drv/class_ufi.c:107: memset(&cmd, 0, sizeof(cmd)); ;source-doc/ufi-drv/class_ufi.c:107: memset(&cmd, 0, sizeof(cmd));
ld hl,0 ld hl,0
add hl, sp add hl, sp
ld e,l
ld d,h
ld b,0x06 ld b,0x06
l_ufi_read_write_sector_00113: l_ufi_read_write_sector_00113:
xor a xor a
@ -470,8 +466,6 @@ l_ufi_read_write_sector_00113:
inc hl inc hl
djnz l_ufi_read_write_sector_00113 djnz l_ufi_read_write_sector_00113
;source-doc/ufi-drv/class_ufi.c:108: cmd.operation_code = send ? 0x2A : 0x28; ;source-doc/ufi-drv/class_ufi.c:108: cmd.operation_code = send ? 0x2A : 0x28;
ld c, e
ld b, d
bit 0,(ix+6) bit 0,(ix+6)
jr Z,l_ufi_read_write_sector_00104 jr Z,l_ufi_read_write_sector_00104
ld a,0x2a ld a,0x2a
@ -479,7 +473,7 @@ l_ufi_read_write_sector_00113:
l_ufi_read_write_sector_00104: l_ufi_read_write_sector_00104:
ld a,0x28 ld a,0x28
l_ufi_read_write_sector_00105: l_ufi_read_write_sector_00105:
ld (bc), a
ld (ix-12),a
;source-doc/ufi-drv/class_ufi.c:109: cmd.lba[2] = sector_number >> 8; ;source-doc/ufi-drv/class_ufi.c:109: cmd.lba[2] = sector_number >> 8;
ld a,(ix+8) ld a,(ix+8)
ld (ix-8),a ld (ix-8),a
@ -491,6 +485,7 @@ l_ufi_read_write_sector_00105:
ld a,(ix+9) ld a,(ix+9)
ld (ix-4),a ld (ix-4),a
add a, a add a, a
ld b, a
ld c,0x00 ld c,0x00
ld l,(ix+12) ld l,(ix+12)
ld h,(ix+13) ld h,(ix+13)
@ -498,12 +493,13 @@ l_ufi_read_write_sector_00105:
ld l,(ix+10) ld l,(ix+10)
ld h,(ix+11) ld h,(ix+11)
push hl push hl
ld b, a
push bc push bc
ld a,(ix+6) ld a,(ix+6)
push af push af
inc sp inc sp
push de
ld hl,7
add hl, sp
push hl
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl
@ -527,7 +523,8 @@ _ufi_format:
;source-doc/ufi-drv/class_ufi.c:130: const ufi_format_capacity_descriptor *const format) { ;source-doc/ufi-drv/class_ufi.c:130: const ufi_format_capacity_descriptor *const format) {
ld hl,2 ld hl,2
add hl, sp add hl, sp
push hl
ld e,l
ld d,h
ld b,0x06 ld b,0x06
l_ufi_format_00104: l_ufi_format_00104:
xor a xor a
@ -536,16 +533,15 @@ l_ufi_format_00104:
ld (hl), a ld (hl), a
inc hl inc hl
djnz l_ufi_format_00104 djnz l_ufi_format_00104
pop bc
;source-doc/ufi-drv/class_ufi.c:133: ufi_format_parameter_list parameter_list; ;source-doc/ufi-drv/class_ufi.c:133: ufi_format_parameter_list parameter_list;
ld hl,14
push de
ld hl,16
add hl, sp add hl, sp
ex de, hl ex de, hl
push bc
ld bc,0x000c ld bc,0x000c
ld hl,__ufi_cmd_format ld hl,__ufi_cmd_format
ldir ldir
pop bc
pop de
;source-doc/ufi-drv/class_ufi.c:136: ufi_format_command cmd; ;source-doc/ufi-drv/class_ufi.c:136: ufi_format_command cmd;
ld a,(ix+7) ld a,(ix+7)
ld (ix-10),a ld (ix-10),a
@ -554,60 +550,68 @@ l_ufi_format_00104:
;source-doc/ufi-drv/class_ufi.c:138: // memcpy(&cmd, &_ufi_cmd_format, sizeof(cmd)); ;source-doc/ufi-drv/class_ufi.c:138: // memcpy(&cmd, &_ufi_cmd_format, sizeof(cmd));
ld (ix-4),0x0c ld (ix-4),0x0c
;source-doc/ufi-drv/class_ufi.c:140: cmd.track_number = track_number; ;source-doc/ufi-drv/class_ufi.c:140: cmd.track_number = track_number;
ld e, c
ld d, b
inc de
ld c, e
ld b, d
inc bc
ld a,(ix+6) ld a,(ix+6)
and 0x01 and 0x01
ld l, a ld l, a
ld a, (de)
ld a, (bc)
and 0xfe and 0xfe
or l or l
ld (de), a
ld (bc), a
;source-doc/ufi-drv/class_ufi.c:141: cmd.interleave[1] = 0; ;source-doc/ufi-drv/class_ufi.c:141: cmd.interleave[1] = 0;
ld l, e ld l, e
ld h, d ld h, d
inc hl
res 1, (hl) res 1, (hl)
;source-doc/ufi-drv/class_ufi.c:142: cmd.parameter_list_length[1] = sizeof(parameter_list); ;source-doc/ufi-drv/class_ufi.c:142: cmd.parameter_list_length[1] = sizeof(parameter_list);
ld l, e
ld h, d
ld a, (hl)
ld c, e
ld b, d
inc bc
ld a, (bc)
and 0xf3 and 0xf3
ld (hl), a
ld (bc), a
;source-doc/ufi-drv/class_ufi.c:143: ;source-doc/ufi-drv/class_ufi.c:143:
ld l, e ld l, e
ld h, d ld h, d
inc hl
set 4, (hl) set 4, (hl)
;source-doc/ufi-drv/class_ufi.c:144: parameter_list.defect_list_header.side = side; ;source-doc/ufi-drv/class_ufi.c:144: parameter_list.defect_list_header.side = side;
ld l, e ld l, e
ld h, d ld h, d
inc hl
set 5, (hl) set 5, (hl)
;source-doc/ufi-drv/class_ufi.c:145: parameter_list.defect_list_header.immediate = 0; ;source-doc/ufi-drv/class_ufi.c:145: parameter_list.defect_list_header.immediate = 0;
ld l, e ld l, e
ld h, d ld h, d
inc hl
res 6, (hl) res 6, (hl)
;source-doc/ufi-drv/class_ufi.c:146: parameter_list.defect_list_header.reserved2 = 0; ;source-doc/ufi-drv/class_ufi.c:146: parameter_list.defect_list_header.reserved2 = 0;
ex de, hl
ld l, e
ld h, d
inc hl
set 7, (hl) set 7, (hl)
;source-doc/ufi-drv/class_ufi.c:147: parameter_list.defect_list_header.single_track = 1; ;source-doc/ufi-drv/class_ufi.c:147: parameter_list.defect_list_header.single_track = 1;
ld (ix-22),0x00 ld (ix-22),0x00
;source-doc/ufi-drv/class_ufi.c:148: parameter_list.defect_list_header.dcrt = 1; ;source-doc/ufi-drv/class_ufi.c:148: parameter_list.defect_list_header.dcrt = 1;
ld (ix-21),0x08 ld (ix-21),0x08
;source-doc/ufi-drv/class_ufi.c:149: parameter_list.defect_list_header.extend = 0; ;source-doc/ufi-drv/class_ufi.c:149: parameter_list.defect_list_header.extend = 0;
ld e,(ix+8)
ld d,(ix+9)
push bc
ld hl,8
add hl, sp
ex de, hl
inc de
inc de
inc de
inc de
ld l,(ix+8)
ld h,(ix+9)
ld bc,0x0008 ld bc,0x0008
ldir ldir
pop bc
;source-doc/ufi-drv/class_ufi.c:151: parameter_list.defect_list_header.defect_list_length_msb = 0; ;source-doc/ufi-drv/class_ufi.c:151: parameter_list.defect_list_header.defect_list_length_msb = 0;
ld hl,0 ld hl,0
add hl, sp add hl, sp
push hl push hl
push bc
ld hl,4
add hl, sp
push hl
ld hl,0x000c ld hl,0x000c
push hl push hl
ld a,0x01 ld a,0x01
@ -639,13 +643,10 @@ _ufi_send_diagnostics:
;source-doc/ufi-drv/class_ufi.c:164: ;source-doc/ufi-drv/class_ufi.c:164:
ld hl,0 ld hl,0
add hl, sp add hl, sp
ld e,l
ld d,h
push hl
ex de, hl
ld bc,0x000c ld bc,0x000c
ld hl,__ufi_cmd_send_diagnostic ld hl,__ufi_cmd_send_diagnostic
ldir ldir
pop bc
;source-doc/ufi-drv/class_ufi.c:166: ufi_send_diagnostic_command ufi_cmd_send_diagnostic; ;source-doc/ufi-drv/class_ufi.c:166: ufi_send_diagnostic_command ufi_cmd_send_diagnostic;
ld hl,0x0000 ld hl,0x0000
push hl push hl
@ -654,7 +655,9 @@ _ufi_send_diagnostics:
ld a,0x01 ld a,0x01
push af push af
inc sp inc sp
push bc
ld hl,7
add hl, sp
push hl
ld l,(ix+4) ld l,(ix+4)
ld h,(ix+5) ld h,(ix+5)
push hl push hl
@ -678,28 +681,28 @@ _convert_from_msb_first:
add hl, sp add hl, sp
ex de, hl ex de, hl
;source-doc/ufi-drv/class_ufi.c:172: ;source-doc/ufi-drv/class_ufi.c:172:
ld c,(ix+4)
ld b,(ix+5)
inc bc
inc bc
inc bc
ld l,(ix+4)
ld h,(ix+5)
inc hl
inc hl
inc hl
;source-doc/ufi-drv/class_ufi.c:174: uint32_t result; ;source-doc/ufi-drv/class_ufi.c:174: uint32_t result;
ld a, (bc)
dec bc
ld a, (hl)
dec hl
ld (de), a ld (de), a
inc de inc de
;source-doc/ufi-drv/class_ufi.c:175: uint8_t *p_output = ((uint8_t *)&result); ;source-doc/ufi-drv/class_ufi.c:175: uint8_t *p_output = ((uint8_t *)&result);
ld a, (bc)
dec bc
ld a, (hl)
dec hl
ld (de), a ld (de), a
inc de inc de
;source-doc/ufi-drv/class_ufi.c:176: const uint8_t *p_input = buffer + 3; ;source-doc/ufi-drv/class_ufi.c:176: const uint8_t *p_input = buffer + 3;
ld a, (bc)
ld a, (hl)
ld (de), a ld (de), a
inc de inc de
;source-doc/ufi-drv/class_ufi.c:177: ;source-doc/ufi-drv/class_ufi.c:177:
dec bc
ld a, (bc)
dec hl
ld a, (hl)
ld (de), a ld (de), a
;source-doc/ufi-drv/class_ufi.c:179: *p_output++ = *p_input--; ;source-doc/ufi-drv/class_ufi.c:179: *p_output++ = *p_input--;
pop hl pop hl

6
Source/HBIOS/ch376-native/ufi-drv/ufi-init.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -85,14 +85,16 @@ l_chufi_init_00105:
ld h,0x00 ld h,0x00
push de push de
call _print_uint16 call _print_uint16
;source-doc/ufi-drv/ufi-init.c:25: print_string(":$");
ld hl,ufi_init_str_1 ld hl,ufi_init_str_1
call _print_string call _print_string
pop de pop de
;source-doc/ufi-drv/ufi-init.c:26: print_uint16(storage_count); ;source-doc/ufi-drv/ufi-init.c:26: print_uint16(storage_count);
ld hl,(_storage_count)
ld hl, (_storage_count)
ld h,0x00 ld h,0x00
push de push de
call _print_uint16 call _print_uint16
;source-doc/ufi-drv/ufi-init.c:27: print_string(" $");
ld hl,ufi_init_str_2 ld hl,ufi_init_str_2
call _print_string call _print_string
pop de pop de

5
Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.s

@ -4,7 +4,7 @@
; ;
;-------------------------------------------------------- ;--------------------------------------------------------
; File Created by SDCC : free open source ISO C Compiler ; File Created by SDCC : free open source ISO C Compiler
; Version 4.4.0 #14648 (Linux)
; Version 4.5.0 #15248 (Linux)
;-------------------------------------------------------- ;--------------------------------------------------------
; Processed by Z88DK ; Processed by Z88DK
;-------------------------------------------------------- ;--------------------------------------------------------
@ -72,7 +72,6 @@ _usb_execute_cbi:
;source-doc/ufi-drv/usb_cbi.c:20: adsc = cbi2_adsc; ;source-doc/ufi-drv/usb_cbi.c:20: adsc = cbi2_adsc;
push de push de
push bc push bc
ex de, hl
ld hl,4 ld hl,4
add hl, sp add hl, sp
ex de, hl ex de, hl
@ -216,7 +215,7 @@ l_usb_execute_cbi_00116:
;source-doc/ufi-drv/usb_cbi.c:66: critical_end(); ;source-doc/ufi-drv/usb_cbi.c:66: critical_end();
call _critical_end call _critical_end
;source-doc/ufi-drv/usb_cbi.c:68: return result; ;source-doc/ufi-drv/usb_cbi.c:68: return result;
ld hl,(_result)
ld hl, (_result)
;source-doc/ufi-drv/usb_cbi.c:69: } ;source-doc/ufi-drv/usb_cbi.c:69: }
ld sp, ix ld sp, ix
pop ix pop ix

Loading…
Cancel
Save