Browse Source

ch376-native: fixes for windows build

* convert 0x??? hex literals to $??? literals
* More label shortening for windows tasm compatibility
pull/598/head
Dean Netherton 6 months ago
parent
commit
aacf98a82a
  1. 6
      Source/HBIOS/ch376-native/base-drv.asm
  2. 286
      Source/HBIOS/ch376-native/base-drv/ch376.c.s
  3. 62
      Source/HBIOS/ch376-native/base-drv/ch376_init.c.s
  4. 16
      Source/HBIOS/ch376-native/base-drv/class_hub.c.s
  5. 2
      Source/HBIOS/ch376-native/base-drv/critical-section.c.s
  6. 60
      Source/HBIOS/ch376-native/base-drv/dev_transfers.c.s
  7. 178
      Source/HBIOS/ch376-native/base-drv/enumerate.c.s
  8. 76
      Source/HBIOS/ch376-native/base-drv/enumerate_hub.c.s
  9. 30
      Source/HBIOS/ch376-native/base-drv/enumerate_storage.c.s
  10. 40
      Source/HBIOS/ch376-native/base-drv/hbios-driver-storage.c.s
  11. 148
      Source/HBIOS/ch376-native/base-drv/protocol.c.s
  12. 30
      Source/HBIOS/ch376-native/base-drv/transfers.c.s
  13. 72
      Source/HBIOS/ch376-native/base-drv/usb-base-drv.c.s
  14. 50
      Source/HBIOS/ch376-native/base-drv/usb_state.c.s
  15. 198
      Source/HBIOS/ch376-native/base-drv/work-area.c.s
  16. 30
      Source/HBIOS/ch376-native/keyboard/class_hid.c.s
  17. 562
      Source/HBIOS/ch376-native/keyboard/class_hid_keyboard.c.s
  18. 24
      Source/HBIOS/ch376-native/keyboard/kyb-init.c.s
  19. 112
      Source/HBIOS/ch376-native/keyboard/kyb_driver.c.s
  20. 126
      Source/HBIOS/ch376-native/scsi-drv/class_scsi.c.s
  21. 36
      Source/HBIOS/ch376-native/scsi-drv/scsi-init.c.s
  22. 150
      Source/HBIOS/ch376-native/scsi-drv/scsi_driver.c.s
  23. 14
      Source/HBIOS/ch376-native/source-doc/base-drv/ch376.c
  24. 10
      Source/HBIOS/ch376-native/source-doc/base-drv/ch376.h
  25. 8
      Source/HBIOS/ch376-native/source-doc/base-drv/dev_transfers.c
  26. 6
      Source/HBIOS/ch376-native/source-doc/base-drv/enumerate.c
  27. 4
      Source/HBIOS/ch376-native/source-doc/base-drv/hbios-driver-storage.c
  28. 2
      Source/HBIOS/ch376-native/source-doc/base-drv/hbios-driver-storage.h
  29. 38
      Source/HBIOS/ch376-native/source-doc/base-drv/protocol.c
  30. 17
      Source/HBIOS/ch376-native/source-doc/base-drv/protocol.h
  31. 6
      Source/HBIOS/ch376-native/source-doc/base-drv/transfers.c
  32. 2
      Source/HBIOS/ch376-native/source-doc/base-drv/usb-base-drv.c
  33. 1
      Source/HBIOS/ch376-native/source-doc/convert-for-uz80as.sh
  34. 12
      Source/HBIOS/ch376-native/source-doc/scsi-drv/class_scsi.c
  35. 2
      Source/HBIOS/ch376-native/source-doc/scsi-drv/class_scsi.h
  36. 6
      Source/HBIOS/ch376-native/source-doc/scsi-drv/scsi-init.c
  37. 14
      Source/HBIOS/ch376-native/source-doc/scsi-drv/scsi_driver.c
  38. 14
      Source/HBIOS/ch376-native/source-doc/ufi-drv/class_ufi.c
  39. 6
      Source/HBIOS/ch376-native/source-doc/ufi-drv/ufi-init.c
  40. 212
      Source/HBIOS/ch376-native/ufi-drv/class_ufi.c.s
  41. 28
      Source/HBIOS/ch376-native/ufi-drv/ufi-init.c.s
  42. 46
      Source/HBIOS/ch376-native/ufi-drv/ufi_driver.c.s
  43. 30
      Source/HBIOS/ch376-native/ufi-drv/usb_cbi.c.s

6
Source/HBIOS/ch376-native/base-drv.asm

@ -17,12 +17,12 @@ CH_CMD_WR_HOST_DATA .EQU CMD10_WR_HOST_DATA
; ---------------------------------
; Function ch_wait_int_and_get_status
; ---------------------------------
_ch_wait_int_and_get_status:
_ch_wait_and_get_status
ld bc, DELAY_FACTOR
keep_waiting:
ld a, $FF
in a, (_CH376_COMMAND_PORT & 0xFF)
in a, (_CH376_COMMAND_PORT & $FF)
rlca
jp nc, _ch_get_status
@ -34,7 +34,7 @@ keep_waiting:
dec hl
ld a, h
or l
jr nz, _ch_wait_int_and_get_status
jr nz, _ch_wait_and_get_status
call _delay
ld a, $FF

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

@ -51,10 +51,10 @@
; ---------------------------------
_ch_command:
;source-doc/base-drv/ch376.c:8: while ((CH376_COMMAND_PORT & PARA_STATE_BUSY) && --counter != 0)
ld b,0xff
ld b,$ff
l_ch_command_00102:
ld a, +((_CH376_COMMAND_PORT) / 256)
in a, (((_CH376_COMMAND_PORT) & 0xFF))
in a, (((_CH376_COMMAND_PORT) & $FF))
bit 4, a
jr Z,l_ch_command_00104
djnz l_ch_command_00102
@ -65,133 +65,133 @@ l_ch_command_00104:
out (c), a
;source-doc/base-drv/ch376.c:20: }
ret
;source-doc/base-drv/ch376.c:24: usb_error ch_long_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(5000); }
;source-doc/base-drv/ch376.c:24: usb_error ch_long_get_status(void) { return ch_wait_and_get_status(5000); }
; ---------------------------------
; Function ch_long_wait_int_and_get_status
; Function ch_long_get_status
; ---------------------------------
_ch_long_wait_int_and_get_statu:
ld hl,0x1388
jp _ch_wait_int_and_get_status
;source-doc/base-drv/ch376.c:26: usb_error ch_short_wait_int_and_get_statu(void) { return ch_wait_int_and_get_status(100); }
_ch_long_get_status:
ld hl,$1388
jp _ch_wait_and_get_status
;source-doc/base-drv/ch376.c:26: usb_error ch_short_get_status(void) { return ch_wait_and_get_status(100); }
; ---------------------------------
; Function ch_short_wait_int_and_get_statu
; Function ch_short_get_status
; ---------------------------------
_ch_short_wait_int_and_get_stat:
ld hl,0x0064
jp _ch_wait_int_and_get_status
;source-doc/base-drv/ch376.c:28: usb_error ch_very_short_wait_int_and_get_(void) { return ch_wait_int_and_get_status(10); }
_ch_short_get_status:
ld hl,$0064
jp _ch_wait_and_get_status
;source-doc/base-drv/ch376.c:28: usb_error ch_very_short_status(void) { return ch_wait_and_get_status(10); }
; ---------------------------------
; Function ch_very_short_wait_int_and_get_
; Function ch_very_short_status
; ---------------------------------
_ch_very_short_wait_int_and_get:
ld hl,0x000a
jp _ch_wait_int_and_get_status
_ch_very_short_status:
ld hl,$000a
jp _ch_wait_and_get_status
;source-doc/base-drv/ch376.c:30: usb_error ch_get_status(void) {
; ---------------------------------
; Function ch_get_status
; ---------------------------------
_ch_get_status:
;source-doc/base-drv/ch376.c:31: ch_command(CH_CMD_GET_STATUS);
ld l,0x22
ld l,$22
call _ch_command
;source-doc/base-drv/ch376.c:32: uint8_t ch_status = CH376_DATA_PORT;
ld a, +((_CH376_DATA_PORT) / 256)
in a, (((_CH376_DATA_PORT) & 0xFF))
in a, (((_CH376_DATA_PORT) & $FF))
;source-doc/base-drv/ch376.c:34: if (ch_status >= USB_FILERR_MIN && ch_status <= USB_FILERR_MAX)
cp 0x41
cp $41
jr C,l_ch_get_status_00102
cp 0xb5
cp $b5
jr NC,l_ch_get_status_00102
;source-doc/base-drv/ch376.c:35: return ch_status;
ld l, a
jr l_ch_get_status_00126
l_ch_get_status_00102:
;source-doc/base-drv/ch376.c:37: if (ch_status == CH_CMD_RET_SUCCESS)
cp 0x51
cp $51
jr NZ,l_ch_get_status_00105
;source-doc/base-drv/ch376.c:38: return USB_ERR_OK;
ld l,0x00
ld l,$00
jr l_ch_get_status_00126
l_ch_get_status_00105:
;source-doc/base-drv/ch376.c:40: if (ch_status == CH_USB_INT_SUCCESS)
cp 0x14
cp $14
jr NZ,l_ch_get_status_00107
;source-doc/base-drv/ch376.c:41: return USB_ERR_OK;
ld l,0x00
ld l,$00
jr l_ch_get_status_00126
l_ch_get_status_00107:
;source-doc/base-drv/ch376.c:43: if (ch_status == CH_USB_INT_CONNECT)
cp 0x15
cp $15
jr NZ,l_ch_get_status_00109
;source-doc/base-drv/ch376.c:44: return USB_INT_CONNECT;
ld l,0x81
ld l,$81
jr l_ch_get_status_00126
l_ch_get_status_00109:
;source-doc/base-drv/ch376.c:46: if (ch_status == CH_USB_INT_DISK_READ)
cp 0x1d
cp $1d
jr NZ,l_ch_get_status_00111
;source-doc/base-drv/ch376.c:47: return USB_ERR_DISK_READ;
ld l,0x1d
ld l,$1d
jr l_ch_get_status_00126
l_ch_get_status_00111:
;source-doc/base-drv/ch376.c:49: if (ch_status == CH_USB_INT_DISK_WRITE)
cp 0x1e
cp $1e
jr NZ,l_ch_get_status_00113
;source-doc/base-drv/ch376.c:50: return USB_ERR_DISK_WRITE;
ld l,0x1e
ld l,$1e
jr l_ch_get_status_00126
l_ch_get_status_00113:
;source-doc/base-drv/ch376.c:52: if (ch_status == CH_USB_INT_DISCONNECT) {
cp 0x16
cp $16
jr NZ,l_ch_get_status_00115
;source-doc/base-drv/ch376.c:53: ch_cmd_set_usb_mode(5);
ld l,0x05
ld l,$05
call _ch_cmd_set_usb_mode
;source-doc/base-drv/ch376.c:54: return USB_ERR_NO_DEVICE;
ld l,0x05
ld l,$05
jr l_ch_get_status_00126
l_ch_get_status_00115:
;source-doc/base-drv/ch376.c:57: if (ch_status == CH_USB_INT_BUF_OVER)
cp 0x17
cp $17
jr NZ,l_ch_get_status_00117
;source-doc/base-drv/ch376.c:58: return USB_ERR_DATA_ERROR;
ld l,0x04
ld l,$04
jr l_ch_get_status_00126
l_ch_get_status_00117:
;source-doc/base-drv/ch376.c:60: ch_status &= 0x2F;
and 0x2f
;source-doc/base-drv/ch376.c:62: if (ch_status == 0x2A)
cp 0x2a
;source-doc/base-drv/ch376.c:60: ch_status &= $2F;
and $2f
;source-doc/base-drv/ch376.c:62: if (ch_status == $2A)
cp $2a
jr NZ,l_ch_get_status_00119
;source-doc/base-drv/ch376.c:63: return USB_ERR_NAK;
ld l,0x01
ld l,$01
jr l_ch_get_status_00126
l_ch_get_status_00119:
;source-doc/base-drv/ch376.c:65: if (ch_status == 0x2E)
cp 0x2e
;source-doc/base-drv/ch376.c:65: if (ch_status == $2E)
cp $2e
jr NZ,l_ch_get_status_00121
;source-doc/base-drv/ch376.c:66: return USB_ERR_STALL;
ld l,0x02
ld l,$02
jr l_ch_get_status_00126
l_ch_get_status_00121:
;source-doc/base-drv/ch376.c:68: ch_status &= 0x23;
and 0x23
;source-doc/base-drv/ch376.c:70: if (ch_status == 0x20)
cp 0x20
;source-doc/base-drv/ch376.c:68: ch_status &= $23;
and $23
;source-doc/base-drv/ch376.c:70: if (ch_status == $20)
cp $20
jr NZ,l_ch_get_status_00123
;source-doc/base-drv/ch376.c:71: return USB_ERR_TIMEOUT;
ld l,0x03
ld l,$03
jr l_ch_get_status_00126
l_ch_get_status_00123:
;source-doc/base-drv/ch376.c:73: if (ch_status == 0x23)
sub 0x23
;source-doc/base-drv/ch376.c:73: if (ch_status == $23)
sub $23
jr NZ,l_ch_get_status_00125
;source-doc/base-drv/ch376.c:74: return USB_TOKEN_OUT_OF_SYNC;
ld l,0x07
ld l,$07
jr l_ch_get_status_00126
l_ch_get_status_00125:
;source-doc/base-drv/ch376.c:76: return USB_ERR_UNEXPECTED_STATUS_FROM_;
ld l,0x08
ld l,$08
l_ch_get_status_00126:
;source-doc/base-drv/ch376.c:77: }
ret
@ -200,7 +200,7 @@ l_ch_get_status_00126:
; Function ch_cmd_reset_all
; ---------------------------------
_ch_cmd_reset_all:
ld l,0x05
ld l,$05
jp _ch_command
;source-doc/base-drv/ch376.c:98: uint8_t ch_probe(void) {
; ---------------------------------
@ -212,26 +212,26 @@ _ch_probe:
add ix,sp
dec sp
;source-doc/base-drv/ch376.c:100: do {
ld (ix-1),0x05
ld (ix-1),$05
l_ch_probe_00103:
;source-doc/base-drv/ch376.c:83: ch_command(CH_CMD_CHECK_EXIST);
ld l,0x06
ld l,$06
call _ch_command
;source-doc/base-drv/ch376.c:84: CH376_DATA_PORT = (uint8_t)~0x55;
ld a,0xaa
;source-doc/base-drv/ch376.c:84: CH376_DATA_PORT = (uint8_t)~$55;
ld a,$aa
ld bc,_CH376_DATA_PORT
out (c), a
;source-doc/base-drv/ch376.c:85: delay();
call _delay
;source-doc/base-drv/ch376.c:86: complement = CH376_DATA_PORT;
ld a, +((_CH376_DATA_PORT) / 256)
in a, (((_CH376_DATA_PORT) & 0xFF))
;source-doc/base-drv/ch376.c:87: return complement == 0x55;
sub 0x55
in a, (((_CH376_DATA_PORT) & $FF))
;source-doc/base-drv/ch376.c:87: return complement == $55;
sub $55
jr NZ,l_ch_probe_00102
;source-doc/base-drv/ch376.c:101: if (ch_cmd_check_exist())
;source-doc/base-drv/ch376.c:102: return true;
ld l,0x01
ld l,$01
jr l_ch_probe_00107
l_ch_probe_00102:
;source-doc/base-drv/ch376.c:104: delay_medium();
@ -240,7 +240,7 @@ l_ch_probe_00102:
dec (ix-1)
jr NZ,l_ch_probe_00103
;source-doc/base-drv/ch376.c:107: return false;
ld l,0x00
ld l,$00
l_ch_probe_00107:
;source-doc/base-drv/ch376.c:108: }
inc sp
@ -253,9 +253,9 @@ l_ch_probe_00107:
_ch_cmd_set_usb_mode:
ld c, l
;source-doc/base-drv/ch376.c:111: uint8_t result = 0;
ld b,0x00
ld b,$00
;source-doc/base-drv/ch376.c:113: CH376_COMMAND_PORT = CH_CMD_SET_USB_MODE;
ld a,0x15
ld a,$15
push bc
ld bc,_CH376_COMMAND_PORT
out (c), a
@ -271,12 +271,12 @@ _ch_cmd_set_usb_mode:
call _delay
pop bc
;source-doc/base-drv/ch376.c:120: while (result != CH_CMD_RET_SUCCESS && result != CH_CMD_RET_ABORT && --count != 0) {
ld c,0x7f
ld c,$7f
l_ch_cmd_set_usb_mode_00103:
ld a, b
sub 0x51
sub $51
jr NZ,l_ch_cmd_set_usb_mode_00146
ld a,0x01
ld a,$01
jr l_ch_cmd_set_usb_mode_00147
l_ch_cmd_set_usb_mode_00146:
xor a
@ -285,13 +285,13 @@ l_ch_cmd_set_usb_mode_00147:
bit 0,a
jr NZ,l_ch_cmd_set_usb_mode_00105
ld a, b
sub 0x5f
sub $5f
jr Z,l_ch_cmd_set_usb_mode_00105
dec c
jr Z,l_ch_cmd_set_usb_mode_00105
;source-doc/base-drv/ch376.c:121: result = CH376_DATA_PORT;
ld a, +((_CH376_DATA_PORT) / 256)
in a, (((_CH376_DATA_PORT) & 0xFF))
in a, (((_CH376_DATA_PORT) & $FF))
ld b, a
;source-doc/base-drv/ch376.c:122: delay();
push bc
@ -303,10 +303,10 @@ l_ch_cmd_set_usb_mode_00105:
ld a, e
or a
jr Z,l_ch_cmd_set_usb_mode_00108
ld l,0x00
ld l,$00
jr l_ch_cmd_set_usb_mode_00109
l_ch_cmd_set_usb_mode_00108:
ld l,0x0e
ld l,$0e
l_ch_cmd_set_usb_mode_00109:
;source-doc/base-drv/ch376.c:126: }
ret
@ -316,12 +316,12 @@ l_ch_cmd_set_usb_mode_00109:
; ---------------------------------
_ch_cmd_get_ic_version:
;source-doc/base-drv/ch376.c:129: ch_command(CH_CMD_GET_IC_VER);
ld l,0x01
ld l,$01
call _ch_command
;source-doc/base-drv/ch376.c:130: return CH376_DATA_PORT & 0x1f;
;source-doc/base-drv/ch376.c:130: return CH376_DATA_PORT & $1f;
ld a, +((_CH376_DATA_PORT) / 256)
in a, (((_CH376_DATA_PORT) & 0xFF))
and 0x1f
in a, (((_CH376_DATA_PORT) & $FF))
and $1f
ld l, a
;source-doc/base-drv/ch376.c:131: }
ret
@ -334,7 +334,7 @@ _ch_issue_token:
ld ix,0
add ix,sp
;source-doc/base-drv/ch376.c:134: ch_command(CH_CMD_ISSUE_TKN_X);
ld l,0x4e
ld l,$4e
call _ch_command
;source-doc/base-drv/ch376.c:135: CH376_DATA_PORT = toggle_bit;
ld a,(ix+4)
@ -357,23 +357,23 @@ _ch_issue_token:
; Function ch_issue_token_in
; ---------------------------------
_ch_issue_token_in:
;source-doc/base-drv/ch376.c:140: ch_issue_token(endpoint->toggle ? 0x80 : 0x00, endpoint->number, CH_PID_IN);
;source-doc/base-drv/ch376.c:140: ch_issue_token(endpoint->toggle ? $80 : $00, endpoint->number, CH_PID_IN);
ld e,l
ld d,h
ld a, (hl)
rrca
and 0x07
and $07
ld b, a
ex de, hl
ld a, (hl)
and 0x01
and $01
jr Z,l_ch_issue_token_in_00103
ld a,0x80
ld a,$80
jr l_ch_issue_token_in_00104
l_ch_issue_token_in_00103:
xor a
l_ch_issue_token_in_00104:
ld h,0x09
ld h,$09
ld l,b
push hl
push af
@ -388,23 +388,23 @@ l_ch_issue_token_in_00104:
; Function ch_issue_token_out
; ---------------------------------
_ch_issue_token_out:
;source-doc/base-drv/ch376.c:144: ch_issue_token(endpoint->toggle ? 0x40 : 0x00, endpoint->number, CH_PID_OUT);
;source-doc/base-drv/ch376.c:144: ch_issue_token(endpoint->toggle ? $40 : $00, endpoint->number, CH_PID_OUT);
ld e,l
ld d,h
ld a, (hl)
rrca
and 0x07
and $07
ld b, a
ex de, hl
ld a, (hl)
and 0x01
and $01
jr Z,l_ch_issue_token_out_00103
ld a,0x40
ld a,$40
jr l_ch_issue_token_out_00104
l_ch_issue_token_out_00103:
xor a
l_ch_issue_token_out_00104:
ld h,0x01
ld h,$01
ld l,b
push hl
push af
@ -414,33 +414,33 @@ l_ch_issue_token_out_00104:
inc sp
;source-doc/base-drv/ch376.c:145: }
ret
;source-doc/base-drv/ch376.c:147: void ch_issue_token_out_ep0(void) { ch_issue_token(0x40, 0, CH_PID_OUT); }
;source-doc/base-drv/ch376.c:147: void ch_issue_token_out_ep0(void) { ch_issue_token($40, 0, CH_PID_OUT); }
; ---------------------------------
; Function ch_issue_token_out_ep0
; ---------------------------------
_ch_issue_token_out_ep0:
ld a,0x01
ld a,$01
push af
inc sp
xor a
ld d,a
ld e,0x40
ld e,$40
push de
call _ch_issue_token
pop af
inc sp
ret
;source-doc/base-drv/ch376.c:149: void ch_issue_token_in_ep0(void) { ch_issue_token(0x80, 0, CH_PID_IN); }
;source-doc/base-drv/ch376.c:149: void ch_issue_token_in_ep0(void) { ch_issue_token($80, 0, CH_PID_IN); }
; ---------------------------------
; Function ch_issue_token_in_ep0
; ---------------------------------
_ch_issue_token_in_ep0:
ld a,0x09
ld a,$09
push af
inc sp
xor a
ld d,a
ld e,0x80
ld e,$80
push de
call _ch_issue_token
pop af
@ -451,7 +451,7 @@ _ch_issue_token_in_ep0:
; Function ch_issue_token_setup
; ---------------------------------
_ch_issue_token_setup:
ld a,0x0d
ld a,$0d
push af
inc sp
xor a
@ -477,11 +477,11 @@ _ch_data_in_transfer:
or (ix+6)
jr NZ,l_ch_data_in_transfer_00102
;source-doc/base-drv/ch376.c:158: return USB_ERR_OK;
ld l,0x00
ld l,$00
jp l_ch_data_in_transfer_00111
l_ch_data_in_transfer_00102:
;source-doc/base-drv/ch376.c:160: USB_MODULE_LEDS = 0x01;
ld a,0x01
;source-doc/base-drv/ch376.c:160: USB_MODULE_LEDS = $01;
ld a,$01
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/ch376.c:161: do {
@ -493,8 +493,8 @@ l_ch_data_in_transfer_00107:
ld h,b
push hl
call _ch_issue_token_in
;source-doc/base-drv/ch376.c:164: result = ch_long_wait_int_and_get_status();
call _ch_long_wait_int_and_get_statu
;source-doc/base-drv/ch376.c:164: result = ch_long_get_status();
call _ch_long_get_status
ld a, l
pop bc
ld l, a
@ -507,12 +507,12 @@ l_ch_data_in_transfer_00107:
ld l, e
ld h, d
ld a, (hl)
and 0x01
xor 0x01
and 0x01
and $01
xor $01
and $01
ld l, a
ld a, (de)
and 0xfe
and $fe
or l
ld (de), a
;source-doc/base-drv/ch376.c:169: count = ch_read_data(buffer);
@ -524,13 +524,13 @@ l_ch_data_in_transfer_00107:
pop bc
;source-doc/base-drv/ch376.c:171: if (count == 0) {
ld a, e
;source-doc/base-drv/ch376.c:172: USB_MODULE_LEDS = 0x00;
;source-doc/base-drv/ch376.c:172: USB_MODULE_LEDS = $00;
or a
jr NZ,l_ch_data_in_transfer_00106
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/ch376.c:173: return USB_ERR_DATA_ERROR;
ld l,0x04
ld l,$04
jr l_ch_data_in_transfer_00111
l_ch_data_in_transfer_00106:
;source-doc/base-drv/ch376.c:176: buffer += count;
@ -541,7 +541,7 @@ l_ch_data_in_transfer_00106:
inc (ix+5)
l_ch_data_in_transfer_00148:
;source-doc/base-drv/ch376.c:177: buffer_size -= count;
ld d,0x00
ld d,$00
ld a,(ix+6)
sub e
ld (ix+6),a
@ -553,20 +553,20 @@ l_ch_data_in_transfer_00148:
cp (ix+6)
sbc a,(ix+7)
jp PO, l_ch_data_in_transfer_00149
xor 0x80
xor $80
l_ch_data_in_transfer_00149:
jp M, l_ch_data_in_transfer_00107
;source-doc/base-drv/ch376.c:180: USB_MODULE_LEDS = 0x00;
ld a,0x00
;source-doc/base-drv/ch376.c:180: USB_MODULE_LEDS = $00;
ld a,$00
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/ch376.c:181: return USB_ERR_OK;
ld l,0x00
ld l,$00
jr l_ch_data_in_transfer_00111
;source-doc/base-drv/ch376.c:183: done:
l_ch_data_in_transfer_00110:
;source-doc/base-drv/ch376.c:184: USB_MODULE_LEDS = 0x00;
ld a,0x00
;source-doc/base-drv/ch376.c:184: USB_MODULE_LEDS = $00;
ld a,$00
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/ch376.c:185: return result;
@ -582,16 +582,16 @@ _ch_data_in_transfer_n:
push ix
ld ix,0
add ix,sp
;source-doc/base-drv/ch376.c:193: USB_MODULE_LEDS = 0x01;
ld a,0x01
;source-doc/base-drv/ch376.c:193: USB_MODULE_LEDS = $01;
ld a,$01
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/ch376.c:195: ch_issue_token_in(endpoint);
ld l,(ix+8)
ld h,(ix+9)
call _ch_issue_token_in
;source-doc/base-drv/ch376.c:197: CHECK(ch_long_wait_int_and_get_status());
call _ch_long_wait_int_and_get_statu
;source-doc/base-drv/ch376.c:197: CHECK(ch_long_get_status());
call _ch_long_get_status
ld a,l
or a
jr NZ,l_ch_data_in_transfer_n_00103
@ -599,12 +599,12 @@ _ch_data_in_transfer_n:
ld l,(ix+8)
ld h,(ix+9)
ld a, (hl)
and 0x01
xor 0x01
and 0x01
and $01
xor $01
and $01
ld c, a
ld a, (hl)
and 0xfe
and $fe
or c
ld (hl), a
;source-doc/base-drv/ch376.c:201: count = ch_read_data(buffer);
@ -615,17 +615,17 @@ _ch_data_in_transfer_n:
ld c,(ix+6)
ld b,(ix+7)
ld (bc), a
;source-doc/base-drv/ch376.c:205: USB_MODULE_LEDS = 0x00;
ld a,0x00
;source-doc/base-drv/ch376.c:205: USB_MODULE_LEDS = $00;
ld a,$00
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/ch376.c:207: return USB_ERR_OK;
ld l,0x00
ld l,$00
jr l_ch_data_in_transfer_n_00104
;source-doc/base-drv/ch376.c:208: done:
l_ch_data_in_transfer_n_00103:
;source-doc/base-drv/ch376.c:209: USB_MODULE_LEDS = 0x00;
ld a,0x00
;source-doc/base-drv/ch376.c:209: USB_MODULE_LEDS = $00;
ld a,$00
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/ch376.c:210: return result;
@ -650,8 +650,8 @@ _ch_data_out_transfer:
inc de
ld a, (de)
ld (ix-1),a
;source-doc/base-drv/ch376.c:218: USB_MODULE_LEDS = 0x02;
ld a,0x02
;source-doc/base-drv/ch376.c:218: USB_MODULE_LEDS = $02;
ld a,$02
push bc
ld bc,_USB_MODULE_LEDS
out (c), a
@ -662,18 +662,18 @@ l_ch_data_out_transfer_00103:
cp (ix+6)
sbc a,(ix+7)
jp PO, l_ch_data_out_transfer_00139
xor 0x80
xor $80
l_ch_data_out_transfer_00139:
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;
ld d,(ix-1)
ld e,0x00
ld e,$00
ld a, d
sub (ix+6)
ld a, e
sbc a,(ix+7)
jp PO, l_ch_data_out_transfer_00140
xor 0x80
xor $80
l_ch_data_out_transfer_00140:
jp P, l_ch_data_out_transfer_00109
jr l_ch_data_out_transfer_00110
@ -697,7 +697,7 @@ l_ch_data_out_transfer_00110:
ld (ix+4),l
ld (ix+5),h
;source-doc/base-drv/ch376.c:223: buffer_length -= size;
ld e,0x00
ld e,$00
ld a,(ix+6)
sub d
ld (ix+6),a
@ -709,8 +709,8 @@ l_ch_data_out_transfer_00110:
ld h,b
push hl
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
;source-doc/base-drv/ch376.c:226: CHECK(ch_long_get_status());
call _ch_long_get_status
ld a, l
pop bc
ld l, a
@ -722,27 +722,27 @@ l_ch_data_out_transfer_00110:
ld l, e
ld h, d
ld a, (hl)
and 0x01
xor 0x01
and 0x01
and $01
xor $01
and $01
ld l, a
ld a, (de)
and 0xfe
and $fe
or l
ld (de), a
jr l_ch_data_out_transfer_00103
l_ch_data_out_transfer_00105:
;source-doc/base-drv/ch376.c:231: USB_MODULE_LEDS = 0x00;
ld a,0x00
;source-doc/base-drv/ch376.c:231: USB_MODULE_LEDS = $00;
ld a,$00
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/ch376.c:232: return USB_ERR_OK;
ld l,0x00
ld l,$00
jr l_ch_data_out_transfer_00107
;source-doc/base-drv/ch376.c:234: done:
l_ch_data_out_transfer_00106:
;source-doc/base-drv/ch376.c:235: USB_MODULE_LEDS = 0x00;
ld a,0x00
;source-doc/base-drv/ch376.c:235: USB_MODULE_LEDS = $00;
ld a,$00
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/ch376.c:236: return result;
@ -758,7 +758,7 @@ l_ch_data_out_transfer_00107:
_ch_set_usb_address:
;source-doc/base-drv/ch376.c:240: ch_command(CH_CMD_SET_USB_ADDR);
push hl
ld l,0x13
ld l,$13
call _ch_command
pop hl
;source-doc/base-drv/ch376.c:241: CH376_DATA_PORT = device_address;

62
Source/HBIOS/ch376-native/base-drv/ch376_init.c.s

@ -59,7 +59,7 @@ _wait_for_state:
ld c,l
ld e,l
;source-doc/base-drv/ch376_init.c:7: for (uint8_t i = 0; i < loop_counter; i++) {
ld d,0x00
ld d,$00
ld b,d
l_wait_for_state_00108:
ld a, b
@ -105,13 +105,13 @@ l_wait_for_state_00106:
inc sp
jp (hl)
ch376_init_str_0:
DEFB 0x08
DEFB $08
DEFM " $"
DEFB 0x00
DEFB $00
ch376_init_str_1:
DEFB 0x08
DEFB $08
DEFM "*$"
DEFB 0x00
DEFB $00
;source-doc/base-drv/ch376_init.c:25: static void _chnative_init(bool forced) {
; ---------------------------------
; Function _chnative_init
@ -124,20 +124,20 @@ __chnative_init:
;source-doc/base-drv/ch376_init.c:28: const uint8_t loop_counter = forced ? 40 : 5;
bit 0,(ix+4)
jr Z,l__chnative_init_00113
ld a,0x28
ld a,$28
jr l__chnative_init_00114
l__chnative_init_00113:
ld a,0x05
ld a,$05
l__chnative_init_00114:
ld (ix-1),a
;source-doc/base-drv/ch376_init.c:30: print_string("\r\nCH376: *$");
ld hl,ch376_init_str_2
call _print_string
;source-doc/base-drv/ch376_init.c:32: r = wait_for_state(loop_counter, state, 1);
ld a,0x01
ld a,$01
push af
inc sp
ld l,0x00
ld l,$00
ld a,(ix-1)
call _wait_for_state
;source-doc/base-drv/ch376_init.c:33: state = r & 255;
@ -154,7 +154,7 @@ l__chnative_init_00114:
ld c, e
;source-doc/base-drv/ch376_init.c:39: if (state != 2) {
ld a, c
sub 0x02
sub $02
jr Z,l__chnative_init_00102
;source-doc/base-drv/ch376_init.c:40: print_string("\rCH376: $");
ld hl,ch376_init_str_4
@ -177,7 +177,7 @@ l__chnative_init_00102:
call _print_string
pop bc
;source-doc/base-drv/ch376_init.c:50: r = wait_for_state(loop_counter, state, 3);
ld a,0x03
ld a,$03
push af
inc sp
ld l, c
@ -186,7 +186,7 @@ l__chnative_init_00102:
;source-doc/base-drv/ch376_init.c:51: state = r & 255;
;source-doc/base-drv/ch376_init.c:53: if (state == 2) {
ld a, e
sub 0x02
sub $02
jr NZ,l__chnative_init_00104
;source-doc/base-drv/ch376_init.c:54: print_string("\bDISCONNECTED$");
ld hl,ch376_init_str_7
@ -206,13 +206,13 @@ l__chnative_init_00104:
;source-doc/base-drv/ch376_init.c:62: state = r & 255;
ld c, e
;source-doc/base-drv/ch376_init.c:64: for (uint8_t i = 0; i < loop_counter; i++) {
ld b,0x00
ld b,$00
l__chnative_init_00109:
ld a, b
sub (ix-1)
jr NC,l__chnative_init_00111
;source-doc/base-drv/ch376_init.c:65: if (r >> 8 != 0)
ld a,0x00
ld a,$00
or d
jr NZ,l__chnative_init_00111
;source-doc/base-drv/ch376_init.c:68: print_string(".$");
@ -237,44 +237,44 @@ l__chnative_init_00111:
pop ix
ret
ch376_init_str_2:
DEFB 0x0d
DEFB 0x0a
DEFB $0d
DEFB $0a
DEFM "CH376: *$"
DEFB 0x00
DEFB $00
ch376_init_str_3:
DEFB 0x08
DEFB $08
DEFM "PRESENT (VER $"
DEFB 0x00
DEFB $00
ch376_init_str_4:
DEFB 0x0d
DEFB $0d
DEFM "CH376: $"
DEFB 0x00
DEFB $00
ch376_init_str_5:
DEFM "VERSION FAILURE"
DEFB 0x0d
DEFB 0x0a
DEFB $0d
DEFB $0a
DEFM "$"
DEFB 0x00
DEFB $00
ch376_init_str_6:
DEFM "USB: *$"
DEFB 0x00
DEFB $00
ch376_init_str_7:
DEFB 0x08
DEFB $08
DEFM "DISCONNECTED$"
DEFB 0x00
DEFB $00
ch376_init_str_8:
DEFB 0x08
DEFB $08
DEFM "CONNECTED$"
DEFB 0x00
DEFB $00
ch376_init_str_9:
DEFM ".$"
DEFB 0x00
DEFB $00
;source-doc/base-drv/ch376_init.c:74: void chnative_init_force(void) { _chnative_init(true); }
; ---------------------------------
; Function chnative_init_force
; ---------------------------------
_chnative_init_force:
ld a,0x01
ld a,$01
push af
inc sp
call __chnative_init

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

@ -62,7 +62,7 @@ _hub_get_descriptor:
rlca
rlca
rlca
and 0x0f
and $0f
ld c, a
push bc
push de
@ -76,10 +76,10 @@ _hub_get_descriptor:
;source-doc/base-drv/class_hub.c:9: }
ret
_cmd_get_hub_descriptor:
DEFB +0xa0
DEFB +0x06
DEFB +0x00
DEFB +0x29
DEFB +0x00
DEFB +0x00
DEFW +0x0008
DEFB +$a0
DEFB +$06
DEFB +$00
DEFB +$29
DEFB +$00
DEFB +$00
DEFW +$0008

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

@ -64,4 +64,4 @@ _critical_end:
dec (hl)
ret
_in_critical_usb_section:
DEFB +0x00
DEFB +$00

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

@ -66,7 +66,7 @@ _usbdev_control_transfer:
rlca
rlca
rlca
and 0x0f
and $0f
ld e,(ix+8)
ld d,(ix+9)
ld c,a
@ -109,7 +109,7 @@ _usbdev_blk_out_trnsfer:
rlca
rlca
rlca
and 0x0f
and $0f
push bc
push de
push de
@ -130,7 +130,7 @@ _usbdev_blk_out_trnsfer:
pop bc
;source-doc/base-drv/dev_transfers.c:34: usb_error usbdev_blk_out_trnsfer(device_config *const dev, const uint8_t *const buffer, const uint16_t buffer_size) {
ld a, l
sub 0x02
sub $02
jr NZ,l_usbdev_blk_out_trnsfer_00102
;source-doc/base-drv/dev_transfers.c:35: usb_error result;
inc bc
@ -143,20 +143,20 @@ _usbdev_blk_out_trnsfer:
rlca
rlca
rlca
and 0x0f
and $0f
ld c, a
ld l, e
ld h, d
ld a, (hl)
rrca
and 0x07
and $07
push de
push bc
inc sp
ld h, c
ld l,a
push hl
call _usbtrn_clear_endpoint_halt
call _usbtrn_clr_ep_halt
pop af
inc sp
pop de
@ -164,7 +164,7 @@ _usbdev_blk_out_trnsfer:
ex de, hl
res 0, (hl)
;source-doc/base-drv/dev_transfers.c:37: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_OUT];
ld l,0x02
ld l,$02
;source-doc/base-drv/dev_transfers.c:43: endpoint->toggle = 0;
l_usbdev_blk_out_trnsfer_00102:
;source-doc/base-drv/dev_transfers.c:44: return USB_ERR_STALL;
@ -183,7 +183,7 @@ _usbdev_bulk_in_transfer:
;source-doc/base-drv/dev_transfers.c:49: done:
ld c,(ix+4)
ld b,(ix+5)
ld hl,0x0006
ld hl,$0006
add hl, bc
;source-doc/base-drv/dev_transfers.c:51: }
pop de
@ -196,7 +196,7 @@ _usbdev_bulk_in_transfer:
rlca
rlca
rlca
and 0x0f
and $0f
push bc
push de
push de
@ -217,7 +217,7 @@ _usbdev_bulk_in_transfer:
pop bc
;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) {
ld a, l
sub 0x02
sub $02
jr NZ,l_usbdev_bulk_in_transfer_00102
;source-doc/base-drv/dev_transfers.c:54: usb_error result;
inc bc
@ -230,20 +230,20 @@ _usbdev_bulk_in_transfer:
rlca
rlca
rlca
and 0x0f
and $0f
ld c, a
ld l, e
ld h, d
ld a, (hl)
rrca
and 0x07
and $07
push de
push bc
inc sp
ld h, c
ld l,a
push hl
call _usbtrn_clear_endpoint_halt
call _usbtrn_clr_ep_halt
pop af
inc sp
pop de
@ -251,8 +251,8 @@ _usbdev_bulk_in_transfer:
ex de, hl
res 0, (hl)
;source-doc/base-drv/dev_transfers.c:56: endpoint_param *const endpoint = &dev->endpoints[ENDPOINT_BULK_IN];
ld l,0x02
;source-doc/base-drv/dev_transfers.c:61: usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size);
ld l,$02
;source-doc/base-drv/dev_transfers.c:61: usbtrn_clr_ep_halt(endpoint->number, dev->address, dev->max_packet_size);
l_usbdev_bulk_in_transfer_00102:
;source-doc/base-drv/dev_transfers.c:62: endpoint->toggle = 0;
ld sp, ix
@ -283,7 +283,7 @@ _usbdev_dat_in_trnsfer:
pop de
add a, e
ld e, a
ld a,0x00
ld a,$00
adc a, d
ld d, a
;source-doc/base-drv/dev_transfers.c:72: uint8_t *const buffer,
@ -296,7 +296,7 @@ _usbdev_dat_in_trnsfer:
rlca
rlca
rlca
and 0x0f
and $0f
push bc
push de
push de
@ -317,7 +317,7 @@ _usbdev_dat_in_trnsfer:
pop bc
;source-doc/base-drv/dev_transfers.c:74: const usb_endpoint_type endpoint_type) {
ld a, l
sub 0x02
sub $02
jr NZ,l_usbdev_dat_in_trnsfer_00102
;source-doc/base-drv/dev_transfers.c:75: usb_error result;
inc bc
@ -330,20 +330,20 @@ _usbdev_dat_in_trnsfer:
rlca
rlca
rlca
and 0x0f
and $0f
ld c, a
ld l, e
ld h, d
ld a, (hl)
rrca
and 0x07
and $07
push de
push bc
inc sp
ld h, c
ld l,a
push hl
call _usbtrn_clear_endpoint_halt
call _usbtrn_clr_ep_halt
pop af
inc sp
pop de
@ -351,8 +351,8 @@ _usbdev_dat_in_trnsfer:
ex de, hl
res 0, (hl)
;source-doc/base-drv/dev_transfers.c:77: endpoint_param *const endpoint = &device->endpoints[endpoint_type];
ld l,0x02
;source-doc/base-drv/dev_transfers.c:82: usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size);
ld l,$02
;source-doc/base-drv/dev_transfers.c:82: usbtrn_clr_ep_halt(endpoint->number, device->address, device->max_packet_size);
l_usbdev_dat_in_trnsfer_00102:
;source-doc/base-drv/dev_transfers.c:83: endpoint->toggle = 0;
ld sp, ix
@ -385,9 +385,9 @@ _usbdev_dat_in_trnsfer_0:
rlca
rlca
rlca
and 0x0f
and $0f
ld l,(ix+8)
ld h,0x00
ld h,$00
push bc
push de
push de
@ -406,7 +406,7 @@ _usbdev_dat_in_trnsfer_0:
pop bc
;source-doc/base-drv/dev_transfers.c:92: usb_error usbdev_dat_in_trnsfer_0(device_config *const device, uint8_t *const buffer, const uint8_t buffer_size) {
ld a, l
sub 0x02
sub $02
jr NZ,l_usbdev_dat_in_trnsfer_0_00102
;source-doc/base-drv/dev_transfers.c:93: usb_error result;
inc bc
@ -419,20 +419,20 @@ _usbdev_dat_in_trnsfer_0:
rlca
rlca
rlca
and 0x0f
and $0f
ld c, a
ld l, e
ld h, d
ld a, (hl)
rrca
and 0x07
and $07
push de
push bc
inc sp
ld h, c
ld l,a
push hl
call _usbtrn_clear_endpoint_halt
call _usbtrn_clr_ep_halt
pop af
inc sp
pop de
@ -440,7 +440,7 @@ _usbdev_dat_in_trnsfer_0:
ex de, hl
res 0, (hl)
;source-doc/base-drv/dev_transfers.c:95: endpoint_param *const endpoint = &device->endpoints[0];
ld l,0x02
ld l,$02
;source-doc/base-drv/dev_transfers.c:98:
l_usbdev_dat_in_trnsfer_0_00102:
;source-doc/base-drv/dev_transfers.c:99: if (result == USB_ERR_STALL) {

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

@ -57,11 +57,11 @@ _adv_to_next_desc:
push af
ex de, hl
;source-doc/base-drv/enumerate.c:15: const uint8_t *buffer_end = working->config.buffer + MAX_CONFIG_SIZE;
ld hl,0x00ab
ld hl,$00ab
add hl, de
ex (sp), hl
;source-doc/base-drv/enumerate.c:17: if (working->ptr >= buffer_end)
ld hl,0x001b
ld hl,$001b
add hl, de
ld (ix-2),l
ld (ix-1),h
@ -78,7 +78,7 @@ _adv_to_next_desc:
sbc a,(ix-3)
jr C,l_adv_to_next_desc_00102
;source-doc/base-drv/enumerate.c:18: return USB_ERR_BUFF_TO_LARGE;
ld a,0x84
ld a,$84
jr l_adv_to_next_desc_00110
l_adv_to_next_desc_00102:
;source-doc/base-drv/enumerate.c:20: d = (usb_descriptor_t *)working->ptr;
@ -90,7 +90,7 @@ l_adv_to_next_desc_00105:
ld a, (de)
add a, c
ld c, a
ld a,0x00
ld a,$00
adc a, b
ld b, a
ld l,(ix-2)
@ -105,7 +105,7 @@ l_adv_to_next_desc_00105:
sbc a,(ix-3)
jr C,l_adv_to_next_desc_00104
;source-doc/base-drv/enumerate.c:26: return USB_ERR_BUFF_TO_LARGE;
ld a,0x84
ld a,$84
jr l_adv_to_next_desc_00110
l_adv_to_next_desc_00104:
;source-doc/base-drv/enumerate.c:17: if (working->ptr >= buffer_end)
@ -129,7 +129,7 @@ l_adv_to_next_desc_00104:
;source-doc/base-drv/enumerate.c:31: if (working->ptr + d->bLength >= buffer_end)
ld a, (de)
ld l, a
ld h,0x00
ld h,$00
add hl, bc
ld a, l
sub (ix-4)
@ -137,7 +137,7 @@ l_adv_to_next_desc_00104:
sbc a,(ix-3)
jr C,l_adv_to_next_desc_00109
;source-doc/base-drv/enumerate.c:32: return USB_ERR_BUFF_TO_LARGE;
ld a,0x84
ld a,$84
jr l_adv_to_next_desc_00110
l_adv_to_next_desc_00109:
;source-doc/base-drv/enumerate.c:34: return USB_ERR_OK;
@ -174,11 +174,11 @@ _parse_endpoint_keyboard:
pop hl
push hl
rlca
and 0x0e
and $0e
push bc
ld c, a
ld a, (hl)
and 0xf1
and $f1
or c
ld (hl), a
;source-doc/base-drv/enumerate.c:41: ep->toggle = 0;
@ -193,16 +193,16 @@ _parse_endpoint_keyboard:
ld e, (hl)
inc hl
ld a, (hl)
and 0x03
and $03
ld d, a
ld a, e
ld (bc), a
inc bc
ld a, d
and 0x03
and $03
ld l, a
ld a, (bc)
and 0xfc
and $fc
or l
ld (bc), a
;source-doc/base-drv/enumerate.c:43: }
@ -230,17 +230,17 @@ _identify_class_driver:
add hl,bc
ld a,(hl)
ld e,a
sub 0x02
sub $02
jr NZ,l_identify_class_driver_00102
;source-doc/base-drv/enumerate.c:48: return USB_IS_CDC;
ld l,0x03
ld l,$03
jr l_identify_class_driver_00118
l_identify_class_driver_00102:
;source-doc/base-drv/enumerate.c:50: if (p->bInterfaceClass == 8 && (p->bInterfaceSubClass == 6 || p->bInterfaceSubClass == 5) && p->bInterfaceProtocol == 80)
ld a, e
sub 0x08
sub $08
jr NZ,l_identify_class_driver_00199
ld a,0x01
ld a,$01
jr l_identify_class_driver_00200
l_identify_class_driver_00199:
xor a
@ -248,46 +248,46 @@ l_identify_class_driver_00200:
ld d,a
or a
jr Z,l_identify_class_driver_00104
ld hl,0x0006
ld hl,$0006
add hl,bc
ld a, (hl)
cp 0x06
cp $06
jr Z,l_identify_class_driver_00107
sub 0x05
sub $05
jr NZ,l_identify_class_driver_00104
l_identify_class_driver_00107:
ld hl,0x0007
ld hl,$0007
add hl,bc
ld a, (hl)
sub 0x50
sub $50
jr NZ,l_identify_class_driver_00104
;source-doc/base-drv/enumerate.c:51: return USB_IS_MASS_STORAGE;
ld l,0x02
ld l,$02
jr l_identify_class_driver_00118
l_identify_class_driver_00104:
;source-doc/base-drv/enumerate.c:53: if (p->bInterfaceClass == 8 && p->bInterfaceSubClass == 4 && p->bInterfaceProtocol == 0)
ld a, d
or a
jr Z,l_identify_class_driver_00109
ld hl,0x0006
ld hl,$0006
add hl,bc
ld a, (hl)
sub 0x04
sub $04
jr NZ,l_identify_class_driver_00109
ld hl,0x0007
ld hl,$0007
add hl,bc
ld a, (hl)
or a
jr NZ,l_identify_class_driver_00109
;source-doc/base-drv/enumerate.c:54: return USB_IS_FLOPPY;
ld l,0x01
ld l,$01
jr l_identify_class_driver_00118
l_identify_class_driver_00109:
;source-doc/base-drv/enumerate.c:56: if (p->bInterfaceClass == 9 && p->bInterfaceSubClass == 0 && p->bInterfaceProtocol == 0)
ld a, e
sub 0x09
sub $09
jr NZ,l_identify_class_driver_00113
ld hl,0x0006
ld hl,$0006
add hl,bc
ld a, (hl)
or a
@ -298,19 +298,19 @@ l_identify_class_driver_00109:
or a
jr NZ,l_identify_class_driver_00113
;source-doc/base-drv/enumerate.c:57: return USB_IS_HUB;
ld l,0x0f
ld l,$0f
jr l_identify_class_driver_00118
l_identify_class_driver_00113:
;source-doc/base-drv/enumerate.c:59: if (p->bInterfaceClass == 3)
ld a, e
sub 0x03
sub $03
jr NZ,l_identify_class_driver_00117
;source-doc/base-drv/enumerate.c:60: return USB_IS_KEYBOARD;
ld l,0x04
ld l,$04
jr l_identify_class_driver_00118
l_identify_class_driver_00117:
;source-doc/base-drv/enumerate.c:62: return USB_IS_UNKNOWN;
ld l,0x06
ld l,$06
l_identify_class_driver_00118:
;source-doc/base-drv/enumerate.c:63: }
pop ix
@ -322,7 +322,7 @@ l_identify_class_driver_00118:
_op_interface_next:
ex de, hl
;source-doc/base-drv/enumerate.c:68: if (--working->interface_count == 0)
ld hl,0x0016
ld hl,$0016
add hl, de
ld a, (hl)
dec a
@ -335,7 +335,7 @@ _op_interface_next:
l_op_interface_next_00102:
;source-doc/base-drv/enumerate.c:71: CHECK(adv_to_next_desc(working, USB_DESCR_INTERFACE));
push de
ld a,0x04
ld a,$04
push af
inc sp
ex de,hl
@ -360,10 +360,10 @@ l_op_interface_next_00106:
_op_endpoint_next:
;source-doc/base-drv/enumerate.c:81: if (working->endpoint_count != 0 && --working->endpoint_count > 0) {
ld a, l
add a,0x17
add a,$17
ld c, a
ld a, h
adc a,0x00
adc a,$00
ld b, a
ld a, (bc)
or a
@ -374,7 +374,7 @@ _op_endpoint_next:
jr Z,l_op_endpoint_next_00104
;source-doc/base-drv/enumerate.c:82: CHECK(adv_to_next_desc(working, USB_DESCR_ENDPOINT));
push hl
ld a,0x05
ld a,$05
push af
inc sp
call _adv_to_next_desc
@ -407,7 +407,7 @@ _op_parse_endpoint:
add ix,sp
push af
;source-doc/base-drv/enumerate.c:93: const endpoint_descriptor *endpoint = (endpoint_descriptor *)working->ptr;
ld de,0x001c
ld de,$001c
ld c,l
ld b,h
add hl, de
@ -428,11 +428,11 @@ _op_parse_endpoint:
inc hl
inc hl
ld a, (hl)
cp 0x01
cp $01
jr Z,l_op_parse_endpoint_00102
cp 0x02
cp $02
jr Z,l_op_parse_endpoint_00102
sub 0x04
sub $04
jr Z,l_op_parse_endpoint_00103
jr l_op_parse_endpoint_00104
;source-doc/base-drv/enumerate.c:98: case USB_IS_MASS_STORAGE: {
@ -492,12 +492,12 @@ _configure_device:
ld a, (hl)
ld (de), a
;source-doc/base-drv/enumerate.c:115: dev_cfg->max_packet_size = working->desc.bMaxPacketSize0;
ld hl,0x0001
ld hl,$0001
add hl, bc
ex (sp), hl
ld e,(ix+4)
ld d,(ix+5)
ld hl,0x000a
ld hl,$000a
add hl,de
ld a, (hl)
pop hl
@ -508,10 +508,10 @@ _configure_device:
ld (ix-1),b
ld l, e
ld h, d
ld a,+((0x0018) & 0xFF)
ld a,+(($0018) & $FF)
add a,l
ld l,a
ld a,+((0x0018) / 256)
ld a,+(($0018) / 256)
adc a,h
ld h,a
ld a, (hl)
@ -524,7 +524,7 @@ _configure_device:
push bc
ld c, a
ld a, (hl)
and 0x0f
and $0f
or c
ld (hl), a
pop bc
@ -534,13 +534,13 @@ _configure_device:
inc hl
inc hl
ld a, (hl)
and 0x0f
and $0f
ld l, a
ld a, (bc)
and 0xf0
and $f0
or l
ld (bc), a
;source-doc/base-drv/enumerate.c:119: return usbtrn_set_configuration(dev_cfg->address, dev_cfg->max_packet_size, working->config.desc.bConfigurationvalue);
;source-doc/base-drv/enumerate.c:119: return usbtrn_set_config(dev_cfg->address, dev_cfg->max_packet_size, working->config.desc.bConfigurationvalue);
ld hl,36
add hl, de
ld b, (hl)
@ -554,21 +554,21 @@ _configure_device:
rlca
rlca
rlca
and 0x0f
and $0f
ld c, d
push bc
push af
inc sp
call _usbtrn_set_configuration
call _usbtrn_set_config
;source-doc/base-drv/enumerate.c:120: }
ld sp,ix
pop ix
ret
;source-doc/base-drv/enumerate.c:122: usb_error op_capture_hub_driver_interface(_working *const working) __sdcccall(1) {
;source-doc/base-drv/enumerate.c:122: usb_error op_cap_hub_drv_intf(_working *const working) __sdcccall(1) {
; ---------------------------------
; Function op_capture_hub_driver_interface
; Function op_cap_hub_drv_intf
; ---------------------------------
_op_capture_hub_driver_interfac:
_op_cap_hub_drv_intf:
push ix
ld ix,0
add ix,sp
@ -577,7 +577,7 @@ _op_capture_hub_driver_interfac:
dec sp
ex de, hl
;source-doc/base-drv/enumerate.c:123: const interface_descriptor *const interface = (interface_descriptor *)working->ptr;
ld hl,0x001c
ld hl,$001c
add hl,de
ld a, (hl)
dec hl
@ -585,7 +585,7 @@ _op_capture_hub_driver_interfac:
ld (ix-2),l
ld (ix-1),a
;source-doc/base-drv/enumerate.c:127: working->hub_config = &hub_config;
ld hl,0x0019
ld hl,$0019
add hl, de
ld c, l
ld b, h
@ -600,7 +600,7 @@ _op_capture_hub_driver_interfac:
ld hl,0
add hl, sp
ld a, (hl)
or 0x0f
or $0f
ld (hl), a
;source-doc/base-drv/enumerate.c:130: CHECK(configure_device(working, interface, (device_config *const)&hub_config));
push de
@ -619,13 +619,13 @@ _op_capture_hub_driver_interfac:
ld a, l
inc l
dec l
jr NZ,l_op_capture_hub_driver_interfa
jr NZ,l_op_cap_hub_drv_intf_00103
;source-doc/base-drv/enumerate.c:131: RETURN_CHECK(configure_usb_hub(working));
ex de, hl
call _configure_usb_hub
ld a, l
;source-doc/base-drv/enumerate.c:132: done:
l_op_capture_hub_driver_interfa:
l_op_cap_hub_drv_intf_00103:
;source-doc/base-drv/enumerate.c:133: return result;
;source-doc/base-drv/enumerate.c:134: }
ld sp, ix
@ -647,7 +647,7 @@ _op_cap_drv_intf:
;source-doc/base-drv/enumerate.c:139: const interface_descriptor *const interface = (interface_descriptor *)working->ptr;
ld l,c
ld h, b
ld de,0x001c
ld de,$001c
add hl, de
ld a, (hl)
dec hl
@ -655,7 +655,7 @@ _op_cap_drv_intf:
ld (ix-2),l
ld (ix-1),a
;source-doc/base-drv/enumerate.c:141: working->endpoint_count = interface->bNumEndpoints;
ld hl,0x0017
ld hl,$0017
add hl, bc
ex de, hl
ld l,(ix-2)
@ -671,7 +671,7 @@ _op_cap_drv_intf:
jr Z,l_op_cap_drv_intf_00104
;source-doc/base-drv/enumerate.c:143: CHECK(adv_to_next_desc(working, USB_DESCR_ENDPOINT));
push bc
ld a,0x05
ld a,$05
push af
inc sp
ld l, c
@ -682,7 +682,7 @@ _op_cap_drv_intf:
jp NZ, l_op_cap_drv_intf_00117
l_op_cap_drv_intf_00104:
;source-doc/base-drv/enumerate.c:144: working->p_current_device = NULL;
ld hl,0x001d
ld hl,$001d
add hl, bc
ld e,l
ld d,h
@ -696,15 +696,15 @@ l_op_cap_drv_intf_00104:
inc hl
inc hl
ld a, (hl)
cp 0x06
cp $06
jr Z,l_op_cap_drv_intf_00108
sub 0x0f
sub $0f
jr NZ,l_op_cap_drv_intf_00111
;source-doc/base-drv/enumerate.c:148: CHECK(op_capture_hub_driver_interface(working))
;source-doc/base-drv/enumerate.c:148: CHECK(op_cap_hub_drv_intf(working))
ld l,c
ld h,b
push hl
call _op_capture_hub_driver_interfac
call _op_cap_hub_drv_intf
pop bc
or a
jr Z,l_op_cap_drv_intf_00116
@ -715,7 +715,7 @@ l_op_cap_drv_intf_00108:
push bc
ld hl,2
add hl, sp
ld b,0x06
ld b,$06
l_op_cap_drv_intf_00165:
xor a
ld (hl), a
@ -761,7 +761,7 @@ l_op_cap_drv_intf_00111:
or l
jr NZ,l_op_cap_drv_intf_00113
;source-doc/base-drv/enumerate.c:163: return USB_ERR_OUT_OF_MEMORY;
ld l,0x83
ld l,$83
jr l_op_cap_drv_intf_00118
l_op_cap_drv_intf_00113:
;source-doc/base-drv/enumerate.c:164: working->p_current_device = dev_cfg;
@ -817,10 +817,10 @@ _op_id_class_drv:
;source-doc/base-drv/enumerate.c:179: if (ptr->bDescriptorType != USB_DESCR_INTERFACE)
inc bc
ld a, (bc)
sub 0x04
sub $04
jr Z,l_op_id_class_drv_00102
;source-doc/base-drv/enumerate.c:180: return USB_ERR_FAIL;
ld a,0x0e
ld a,$0e
jr l_op_id_class_drv_00103
l_op_id_class_drv_00102:
;source-doc/base-drv/enumerate.c:182: working->usb_device = identify_class_driver(working);
@ -862,10 +862,10 @@ _op_get_cfg_desc:
ld a, (hl)
ld (ix-1),a
;source-doc/base-drv/enumerate.c:192: memset(working->config.buffer, 0, MAX_CONFIG_SIZE);
ld hl,0x001f
ld hl,$001f
add hl, bc
push bc
ld b,0x46
ld b,$46
l_op_get_cfg_desc_00122:
xor a
ld (hl), a
@ -875,29 +875,29 @@ l_op_get_cfg_desc_00122:
djnz l_op_get_cfg_desc_00122
pop bc
;source-doc/base-drv/enumerate.c:193: working->ptr = working->config.buffer;
ld hl,0x001b
ld hl,$001b
add hl, bc
ld a, c
add a,0x1f
add a,$1f
ld e, a
ld a, b
adc a,0x00
adc a,$00
ld (hl), e
inc hl
ld (hl), a
;source-doc/base-drv/enumerate.c:196: working->config.buffer));
ld hl,0x001f
ld hl,$001f
add hl, bc
ex de, hl
ld hl,0x0018
ld hl,$0018
add hl,bc
ld a, (hl)
ld hl,0x0015
ld hl,$0015
add hl,bc
ld h, (hl)
push bc
push de
ld d,0x8c
ld d,$8c
push de
inc sp
ld d,(ix-1)
@ -916,7 +916,7 @@ l_op_get_cfg_desc_00122:
jr NZ,l_op_get_cfg_desc_00105
;source-doc/base-drv/enumerate.c:198: CHECK(adv_to_next_desc(working, USB_DESCR_INTERFACE));
push bc
ld a,0x04
ld a,$04
push af
inc sp
ld l, c
@ -926,10 +926,10 @@ l_op_get_cfg_desc_00122:
or a
jr NZ,l_op_get_cfg_desc_00105
;source-doc/base-drv/enumerate.c:199: working->interface_count = working->config.desc.bNumInterfaces;
ld hl,0x0016
ld hl,$0016
add hl, bc
ex de, hl
ld hl,0x0023
ld hl,$0023
add hl,bc
ld a, (hl)
ld (de), a
@ -960,13 +960,13 @@ _read_all_configs:
add hl, sp
ld e,l
ld d,h
ld b,0x56
ld b,$56
jr l_read_all_configs_00150
l_read_all_configs_00149:
ld (hl),0x00
ld (hl),$00
inc hl
l_read_all_configs_00150:
ld (hl),0x00
ld (hl),$00
inc hl
djnz l_read_all_configs_00149
;source-doc/base-drv/enumerate.c:213: working.state = state;
@ -999,7 +999,7 @@ l_read_all_configs_00150:
ld h, b
ld (hl), c
;source-doc/base-drv/enumerate.c:218: working.current_device_address = state->next_device_address;
ld hl,0x0018
ld hl,$0018
add hl, de
ld (hl), c
;source-doc/base-drv/enumerate.c:219: CHECK(usbtrn_set_address(working.current_device_address));
@ -1020,7 +1020,7 @@ l_read_all_configs_00110:
sub b
jr NC,l_read_all_configs_00107
;source-doc/base-drv/enumerate.c:222: working.config_index = config_index;
ld hl,0x0015
ld hl,$0015
add hl, de
ld (hl), c
;source-doc/base-drv/enumerate.c:224: CHECK(op_get_cfg_desc(&working));
@ -1038,7 +1038,7 @@ l_read_all_configs_00110:
jr l_read_all_configs_00110
l_read_all_configs_00107:
;source-doc/base-drv/enumerate.c:227: return USB_ERR_OK;
ld l,0x00
ld l,$00
jr l_read_all_configs_00112
;source-doc/base-drv/enumerate.c:228: done:
l_read_all_configs_00108:

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

@ -62,7 +62,7 @@ _hub_set_feature:
ld e,l
ld d,h
push hl
ld bc,0x0008
ld bc,$0008
ld hl,_cmd_set_feature
ldir
pop bc
@ -86,10 +86,10 @@ _hub_set_feature:
rlca
rlca
rlca
and 0x0f
and $0f
ld e,a
push de
ld hl,0x0000
ld hl,$0000
push hl
push bc
call _usb_control_transfer
@ -98,29 +98,29 @@ _hub_set_feature:
pop ix
ret
_cmd_set_feature:
DEFB +0x23
DEFB +0x03
DEFB +0x08
DEFB +0x00
DEFB +0x01
DEFB +0x00
DEFW +0x0000
DEFB +$23
DEFB +$03
DEFB +$08
DEFB +$00
DEFB +$01
DEFB +$00
DEFW +$0000
_cmd_clear_feature:
DEFB +0x23
DEFB +0x01
DEFB +0x08
DEFB +0x00
DEFB +0x01
DEFB +0x00
DEFW +0x0000
DEFB +$23
DEFB +$01
DEFB +$08
DEFB +$00
DEFB +$01
DEFB +$00
DEFW +$0000
_cmd_get_status_port:
DEFB +0xa3
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x01
DEFB +0x00
DEFW +0x0004
DEFB +$a3
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$01
DEFB +$00
DEFW +$0004
;source-doc/base-drv/enumerate_hub.c:22: usb_error hub_clear_feature(const device_config_hub *const hub_config, const uint8_t feature, const uint8_t index) {
; ---------------------------------
; Function hub_clear_feature
@ -138,7 +138,7 @@ _hub_clear_feature:
ld e,l
ld d,h
push hl
ld bc,0x0008
ld bc,$0008
ld hl,_cmd_clear_feature
ldir
pop bc
@ -162,10 +162,10 @@ _hub_clear_feature:
rlca
rlca
rlca
and 0x0f
and $0f
ld e,a
push de
ld hl,0x0000
ld hl,$0000
push hl
push bc
call _usb_control_transfer
@ -190,7 +190,7 @@ _hub_get_status_port:
ld e,l
ld d,h
push hl
ld bc,0x0008
ld bc,$0008
ld hl,_cmd_get_status_port
ldir
pop bc
@ -211,7 +211,7 @@ _hub_get_status_port:
rlca
rlca
rlca
and 0x0f
and $0f
ld l,(ix+7)
ld h,(ix+8)
ld e,a
@ -262,7 +262,7 @@ l_configure_usb_hub_00126:
;source-doc/base-drv/enumerate_hub.c:51: CHECK(hub_clear_feature(hub_config, FEAT_PORT_POWER, i));
push bc
push de
ld e,0x08
ld e,$08
push de
push bc
call _hub_clear_feature
@ -276,7 +276,7 @@ l_configure_usb_hub_00126:
;source-doc/base-drv/enumerate_hub.c:53: CHECK(hub_set_feature(hub_config, FEAT_PORT_POWER, i));
push bc
push de
ld e,0x08
ld e,$08
push de
push bc
call _hub_set_feature
@ -290,7 +290,7 @@ l_configure_usb_hub_00126:
;source-doc/base-drv/enumerate_hub.c:55: hub_clear_feature(hub_config, FEAT_PORT_RESET, i);
push bc
push de
ld e,0x04
ld e,$04
push de
push bc
call _hub_clear_feature
@ -301,7 +301,7 @@ l_configure_usb_hub_00126:
;source-doc/base-drv/enumerate_hub.c:57: CHECK(hub_set_feature(hub_config, FEAT_PORT_RESET, i));
push bc
push de
ld e,0x04
ld e,$04
push de
push bc
call _hub_set_feature
@ -337,7 +337,7 @@ l_configure_usb_hub_00126:
;source-doc/base-drv/enumerate_hub.c:62: CHECK(hub_clear_feature(hub_config, HUB_FEATURE_PORT_CONNECTION_CHA, i));
push bc
push de
ld e,0x10
ld e,$10
push de
push bc
call _hub_clear_feature
@ -351,7 +351,7 @@ l_configure_usb_hub_00126:
;source-doc/base-drv/enumerate_hub.c:64: CHECK(hub_clear_feature(hub_config, FEAT_PORT_ENABLE_CHANGE, i));
push bc
push de
ld e,0x11
ld e,$11
push de
push bc
call _hub_clear_feature
@ -365,7 +365,7 @@ l_configure_usb_hub_00126:
;source-doc/base-drv/enumerate_hub.c:66: CHECK(hub_clear_feature(hub_config, FEAT_PORT_RESET_CHANGE, i));
push bc
push de
ld e,0x14
ld e,$14
push de
push bc
call _hub_clear_feature
@ -428,7 +428,7 @@ l_configure_usb_hub_00124:
;source-doc/base-drv/enumerate_hub.c:75: CHECK(hub_clear_feature(hub_config, FEAT_PORT_POWER, i));
push bc
push de
ld e,0x08
ld e,$08
push de
push bc
call _hub_clear_feature
@ -444,7 +444,7 @@ l_configure_usb_hub_00127:
dec d
jp NZ, l_configure_usb_hub_00126
;source-doc/base-drv/enumerate_hub.c:79: return USB_ERR_OK;
ld l,0x00
ld l,$00
jr l_configure_usb_hub_00130
;source-doc/base-drv/enumerate_hub.c:80: done:
l_configure_usb_hub_00129:

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

@ -54,7 +54,7 @@ _parse_endpoints:
ld ix,0
add ix,sp
push af
;source-doc/base-drv/enumerate_storage.c:7: if (!(pEndpoint->bmAttributes & 0x02))
;source-doc/base-drv/enumerate_storage.c:7: if (!(pEndpoint->bmAttributes & $02))
ld l,(ix+6)
ld h,(ix+7)
ld c,l
@ -78,27 +78,27 @@ _parse_endpoints:
inc de
inc de
inc de
;source-doc/base-drv/enumerate_storage.c:15: if (!(pEndpoint->bEndpointAddress & 0x80))
;source-doc/base-drv/enumerate_storage.c:15: if (!(pEndpoint->bEndpointAddress & $80))
inc bc
inc bc
ld a, (bc)
ld c,a
and 0x80
ld b,0x00
;source-doc/base-drv/enumerate_storage.c:14: if (pEndpoint->bmAttributes & 0x01) { // 3 -> Interrupt
and $80
ld b,$00
;source-doc/base-drv/enumerate_storage.c:14: if (pEndpoint->bmAttributes & $01) { // 3 -> Interrupt
bit 0,(ix-2)
jr Z,l_parse_endpoints_00106
;source-doc/base-drv/enumerate_storage.c:15: if (!(pEndpoint->bEndpointAddress & 0x80))
;source-doc/base-drv/enumerate_storage.c:15: if (!(pEndpoint->bEndpointAddress & $80))
or b
;source-doc/base-drv/enumerate_storage.c:16: return;
jr Z,l_parse_endpoints_00108
;source-doc/base-drv/enumerate_storage.c:18: ep = &eps[ENDPOINT_INTERRUPT_IN];
ld hl,0x0006
ld hl,$0006
add hl, de
ex de, hl
jr l_parse_endpoints_00107
l_parse_endpoints_00106:
;source-doc/base-drv/enumerate_storage.c:21: ep = (pEndpoint->bEndpointAddress & 0x80) ? &eps[ENDPOINT_BULK_IN] : &eps[ENDPOINT_BULK_OUT];
;source-doc/base-drv/enumerate_storage.c:21: ep = (pEndpoint->bEndpointAddress & $80) ? &eps[ENDPOINT_BULK_IN] : &eps[ENDPOINT_BULK_OUT];
or b
jr Z,l_parse_endpoints_00110
inc de
@ -106,16 +106,16 @@ l_parse_endpoints_00106:
inc de
l_parse_endpoints_00110:
l_parse_endpoints_00107:
;source-doc/base-drv/enumerate_storage.c:24: ep->number = pEndpoint->bEndpointAddress & 0x07;
;source-doc/base-drv/enumerate_storage.c:24: ep->number = pEndpoint->bEndpointAddress & $07;
ld l, e
ld h, d
ld a, c
and 0x07
and $07
rlca
and 0x0e
and $0e
ld c, a
ld a, (hl)
and 0xf1
and $f1
or c
ld (hl), a
;source-doc/base-drv/enumerate_storage.c:25: ep->toggle = 0;
@ -125,14 +125,14 @@ l_parse_endpoints_00107:
;source-doc/base-drv/enumerate_storage.c:26: ep->max_packet_sizex = x;
inc de
ld a,(ix-1)
ld b,0x00
ld b,$00
ld (de), a
inc de
ld a, b
and 0x03
and $03
ld l, a
ld a, (de)
and 0xfc
and $fc
or l
ld (de), a
l_parse_endpoints_00108:

40
Source/HBIOS/ch376-native/base-drv/hbios-driver-storage.c.s

@ -30,7 +30,7 @@
; .area _INITIALIZED removed by z88dk
_hbios_usb_storage_devices:
_hbios_usbstore_devs:
DEFS 12
#ENDIF
@ -53,16 +53,16 @@ _hbios_usb_storage_devices:
; ---------------------------------
_find_storage_dev:
;source-doc/base-drv/hbios-driver-storage.c:6: for (uint8_t i = 0; i < MAX_NUMBER_OF_DEVICES; i++)
ld c,0x00
ld de,_hbios_usb_storage_devices+0
ld c,$00
ld de,_hbios_usbstore_devs+0
ld b,c
l_find_storage_dev_00105:
ld a, b
sub 0x06
sub $06
jr NC,l_find_storage_dev_00103
;source-doc/base-drv/hbios-driver-storage.c:7: if (hbios_usb_storage_devices[i].drive_index == 0)
;source-doc/base-drv/hbios-driver-storage.c:7: if (hbios_usbstore_devs[i].drive_index == 0)
ld l, b
ld h,0x00
ld h,$00
add hl, hl
add hl, de
ld a, (hl)
@ -78,20 +78,20 @@ l_find_storage_dev_00106:
jr l_find_storage_dev_00105
l_find_storage_dev_00103:
;source-doc/base-drv/hbios-driver-storage.c:10: return -1;
ld l,0xff
ld l,$ff
l_find_storage_dev_00107:
;source-doc/base-drv/hbios-driver-storage.c:11: }
ret
_hbios_usb_storage_devices:
DEFB +0x00
DEFB +0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
_hbios_usbstore_devs:
DEFB +$00
DEFB +$00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00

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

@ -60,11 +60,11 @@ _usbtrn_get_descriptor:
ld hl,0
add hl, sp
ex de, hl
ld bc,0x0008
ld hl,_cmd_get_device_descriptor
ld bc,$0008
ld hl,_cmd_get_dev_descriptr
ldir
;source-doc/base-drv/protocol.c:29: usb_error usbtrn_get_descriptor(device_descriptor *const buffer) {
ld (ix-2),0x08
ld (ix-2),$08
xor a
ld (ix-1),a
;source-doc/base-drv/protocol.c:31: setup_packet cmd;
@ -74,7 +74,7 @@ _usbtrn_get_descriptor:
push bc
ld e,c
ld d,b
ld a,0x08
ld a,$08
push af
inc sp
xor a
@ -101,13 +101,13 @@ _usbtrn_get_descriptor:
ld hl,4
add hl, sp
ex de, hl
ld bc,0x0008
ld hl,_cmd_get_device_descriptor
ld bc,$0008
ld hl,_cmd_get_dev_descriptr
ldir
pop bc
pop de
;source-doc/base-drv/protocol.c:36:
ld (ix-2),0x12
ld (ix-2),$12
xor a
ld (ix-1),a
;source-doc/base-drv/protocol.c:37: CHECK(result);
@ -134,14 +134,14 @@ l_usbtrn_get_descriptor_00103:
ld sp, ix
pop ix
ret
_cmd_get_device_descriptor:
DEFB +0x80
DEFB +0x06
DEFB +0x00
DEFB +0x01
DEFB +0x00
DEFB +0x00
DEFW +0x0008
_cmd_get_dev_descriptr:
DEFB +$80
DEFB +$06
DEFB +$00
DEFB +$01
DEFB +$00
DEFB +$00
DEFW +$0008
;source-doc/base-drv/protocol.c:47: }
; ---------------------------------
; Function usbtrn_get_descriptor2
@ -157,11 +157,11 @@ _usbtrn_get_descriptor2:
ld hl,0
add hl, sp
ex de, hl
ld bc,0x0008
ld hl,_cmd_get_device_descriptor
ld bc,$0008
ld hl,_cmd_get_dev_descriptr
ldir
;source-doc/base-drv/protocol.c:52: * @param buffer the buffer to store the device descriptor in
ld (ix-2),0x08
ld (ix-2),$08
xor a
ld (ix-1),a
;source-doc/base-drv/protocol.c:54: */
@ -171,7 +171,7 @@ _usbtrn_get_descriptor2:
push bc
ld e,c
ld d,b
ld h,0x08
ld h,$08
ld l,(ix+6)
push hl
push de
@ -195,13 +195,13 @@ _usbtrn_get_descriptor2:
ld hl,4
add hl, sp
ex de, hl
ld bc,0x0008
ld hl,_cmd_get_device_descriptor
ld bc,$0008
ld hl,_cmd_get_dev_descriptr
ldir
pop bc
pop de
;source-doc/base-drv/protocol.c:59: cmd = cmd_get_device_descriptor;
ld (ix-2),0x12
;source-doc/base-drv/protocol.c:59: cmd = cmd_get_dev_descriptr;
ld (ix-2),$12
xor a
ld (ix-1),a
;source-doc/base-drv/protocol.c:60: cmd.wLength = 8;
@ -243,7 +243,7 @@ _usbtrn_set_address:
ld hl,2
add hl, sp
ex de, hl
ld bc,0x0008
ld bc,$0008
ld hl,_cmd_set_device_address
ldir
pop bc
@ -256,7 +256,7 @@ _usbtrn_set_address:
xor a
push af
inc sp
ld hl,0x0000
ld hl,$0000
push hl
ld hl,4
add hl, sp
@ -267,18 +267,18 @@ _usbtrn_set_address:
pop ix
ret
_cmd_set_device_address:
DEFB +0x00
DEFB +0x05
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFW +0x0000
DEFB +$00
DEFB +$05
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFW +$0000
;source-doc/base-drv/protocol.c:81: usb_error usbtrn_set_address(const uint8_t device_address) __z88dk_fastcall {
; ---------------------------------
; Function usbtrn_set_configuration
; Function usbtrn_set_config
; ---------------------------------
_usbtrn_set_configuration:
_usbtrn_set_config:
push ix
ld ix,0
add ix,sp
@ -291,7 +291,7 @@ _usbtrn_set_configuration:
ld e,l
ld d,h
push hl
ld bc,0x0008
ld bc,$0008
ld hl,_cmd_set_configuration
ldir
pop bc
@ -302,7 +302,7 @@ _usbtrn_set_configuration:
ld h,(ix+5)
ld l,(ix+4)
push hl
ld hl,0x0000
ld hl,$0000
push hl
push bc
call _usb_control_transfer
@ -311,18 +311,18 @@ _usbtrn_set_configuration:
pop ix
ret
_cmd_set_configuration:
DEFB +0x00
DEFB +0x09
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFW +0x0000
DEFB +$00
DEFB +$09
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFW +$0000
;source-doc/base-drv/protocol.c:93: *
; ---------------------------------
; Function usbtrn_get_config_descriptor
; Function usbtrn_get_config_desc
; ---------------------------------
_usbtrn_get_config_descriptor:
_usbtrn_get_config_desc:
push ix
ld ix,0
add ix,sp
@ -335,15 +335,15 @@ _usbtrn_get_config_descriptor:
ld e,l
ld d,h
push hl
ld bc,0x0008
ld hl,_cmd_get_config_descriptor
ld bc,$0008
ld hl,_cmd_get_config_desc
ldir
pop bc
;source-doc/base-drv/protocol.c:100: cmd.bValue[0] = configuration;
ld a,(ix+6)
ld (ix-6),a
;source-doc/base-drv/protocol.c:101:
ld hl,0x0006
ld hl,$0006
add hl, bc
ld e,(ix+7)
xor a
@ -363,14 +363,14 @@ _usbtrn_get_config_descriptor:
ld sp,ix
pop ix
ret
_cmd_get_config_descriptor:
DEFB +0x80
DEFB +0x06
DEFB +0x00
DEFB +0x02
DEFB +0x00
DEFB +0x00
DEFW +0x0000
_cmd_get_config_desc:
DEFB +$80
DEFB +$06
DEFB +$00
DEFB +$02
DEFB +$00
DEFB +$00
DEFW +$0000
;source-doc/base-drv/protocol.c:106:
; ---------------------------------
; Function usbtrn_gfull_cfg_desc
@ -387,13 +387,13 @@ _usbtrn_gfull_cfg_desc:
push af
inc sp
ld d,(ix+5)
ld e,0x09
ld e,$09
push de
ld a,(ix+4)
push af
inc sp
push bc
call _usbtrn_get_config_descriptor
call _usbtrn_get_config_desc
pop af
pop af
pop af
@ -407,7 +407,7 @@ _usbtrn_gfull_cfg_desc:
inc hl
inc hl
ld d, (hl)
;source-doc/base-drv/protocol.c:117: usb_error usbtrn_get_config_descriptor(config_descriptor *const buffer,
;source-doc/base-drv/protocol.c:117: usb_error usbtrn_get_config_desc(config_descriptor *const buffer,
ld a,(ix+7)
sub d
jr NC,l_usbtrn_gfull_cfg_desc_00104
@ -421,7 +421,7 @@ l_usbtrn_gfull_cfg_desc_00104:
ld e,(ix+4)
push de
push bc
call _usbtrn_get_config_descriptor
call _usbtrn_get_config_desc
pop af
pop af
pop af
@ -430,7 +430,7 @@ l_usbtrn_gfull_cfg_desc_00104:
or a
jr NZ,l_usbtrn_gfull_cfg_desc_00107
ld l,a
;source-doc/base-drv/protocol.c:123: cmd = cmd_get_config_descriptor;
;source-doc/base-drv/protocol.c:123: cmd = cmd_get_config_desc;
;source-doc/base-drv/protocol.c:124: cmd.bValue[0] = config_index;
l_usbtrn_gfull_cfg_desc_00107:
;source-doc/base-drv/protocol.c:125: cmd.wLength = (uint16_t)buffer_size;
@ -438,9 +438,9 @@ l_usbtrn_gfull_cfg_desc_00107:
ret
;source-doc/base-drv/protocol.c:129:
; ---------------------------------
; Function usbtrn_clear_endpoint_halt
; Function usbtrn_clr_ep_halt
; ---------------------------------
_usbtrn_clear_endpoint_halt:
_usbtrn_clr_ep_halt:
push ix
ld ix,0
add ix,sp
@ -453,8 +453,8 @@ _usbtrn_clear_endpoint_halt:
ld e,l
ld d,h
push hl
ld bc,0x0008
ld hl,_usb_cmd_clear_endpoint_halt
ld bc,$0008
ld hl,_usb_cmd_clr_ep_halt
ldir
pop bc
;source-doc/base-drv/protocol.c:132: const uint8_t max_packet_size,
@ -464,7 +464,7 @@ _usbtrn_clear_endpoint_halt:
ld h,(ix+6)
ld l,(ix+5)
push hl
ld hl,0x0000
ld hl,$0000
push hl
push bc
call _usb_control_transfer
@ -472,11 +472,11 @@ _usbtrn_clear_endpoint_halt:
ld sp,ix
pop ix
ret
_usb_cmd_clear_endpoint_halt:
DEFB +0x02
DEFB +0x01
DEFB +0x00
DEFB +0x00
DEFB +0xff
DEFB +0x00
DEFW +0x0000
_usb_cmd_clr_ep_halt:
DEFB +$02
DEFB +$01
DEFB +$00
DEFB +$00
DEFB +$ff
DEFB +$00
DEFW +$0000

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

@ -62,26 +62,26 @@ _usb_control_transfer:
ld hl,0
add hl, sp
ld a, (hl)
and 0xf1
and $f1
ld (hl), a
ld c,(ix+9)
ld b,0x00
ld b,$00
ld hl,1
add hl, sp
ld (hl), c
inc hl
ld a, b
and 0x03
and $03
ld e, a
ld a, (hl)
and 0xfc
and $fc
or e
ld (hl), a
;source-doc/base-drv/transfers.c:30: */
ld c,(ix+4)
ld b,(ix+5)
ld a, (bc)
and 0x80
and $80
;source-doc/base-drv/transfers.c:32: void *const buffer,
ld (ix-1),a
or a
@ -90,7 +90,7 @@ _usb_control_transfer:
or (ix+6)
jr NZ,l_usb_control_transfer_00102
;source-doc/base-drv/transfers.c:33: const uint8_t device_address,
ld l,0x0f
ld l,$0f
jp l_usb_control_transfer_00114
l_usb_control_transfer_00102:
;source-doc/base-drv/transfers.c:35: usb_error result;
@ -104,7 +104,7 @@ l_usb_control_transfer_00102:
ld e,(ix+4)
ld d,(ix+5)
push bc
ld a,0x08
ld a,$08
push af
inc sp
push de
@ -114,7 +114,7 @@ l_usb_control_transfer_00102:
;source-doc/base-drv/transfers.c:40: if (transferIn && buffer == 0)
call _ch_issue_token_setup
;source-doc/base-drv/transfers.c:41: return USB_ERR_OTHER;
call _ch_short_wait_int_and_get_stat
call _ch_short_get_status
pop bc
;source-doc/base-drv/transfers.c:42:
ld a, l
@ -157,7 +157,7 @@ l_usb_control_transfer_00119:
jr l_usb_control_transfer_00117
l_usb_control_transfer_00116:
;source-doc/base-drv/transfers.c:48: ch_issue_token_setup();
ld l,0x00
ld l,$00
l_usb_control_transfer_00117:
;source-doc/base-drv/transfers.c:50: CHECK(result);
ld a, l
@ -168,25 +168,25 @@ l_usb_control_transfer_00117:
or a
jr Z,l_usb_control_transfer_00112
;source-doc/base-drv/transfers.c:53:
ld l,0x2c
ld l,$2c
call _ch_command
;source-doc/base-drv/transfers.c:54: result = length != 0
ld a,0x00
ld a,$00
ld bc,_CH376_DATA_PORT
out (c), a
;source-doc/base-drv/transfers.c:55: ? (transferIn ? ch_data_in_transfer(buffer, length, &endpoint) : ch_data_out_transfer(buffer, length, &endpoint))
call _ch_issue_token_out_ep0
;source-doc/base-drv/transfers.c:56: : USB_ERR_OK;
call _ch_long_wait_int_and_get_statu
call _ch_long_get_status
;source-doc/base-drv/transfers.c:58: CHECK(result)
ld a,l
or a
jr Z,l_usb_control_transfer_00108
sub 0x02
sub $02
jr NZ,l_usb_control_transfer_00113
l_usb_control_transfer_00108:
;source-doc/base-drv/transfers.c:59:
ld l,0x00
ld l,$00
;source-doc/base-drv/transfers.c:60: if (transferIn) {
jr l_usb_control_transfer_00113
;source-doc/base-drv/transfers.c:63: ch_issue_token_out_ep0();
@ -194,7 +194,7 @@ l_usb_control_transfer_00112:
;source-doc/base-drv/transfers.c:66: if (result == USB_ERR_OK || result == USB_ERR_STALL) {
call _ch_issue_token_in_ep0
;source-doc/base-drv/transfers.c:67: result = USB_ERR_OK;
call _ch_long_wait_int_and_get_statu
call _ch_long_get_status
;source-doc/base-drv/transfers.c:71: RETURN_CHECK(result);
l_usb_control_transfer_00113:
;source-doc/base-drv/transfers.c:72: }

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

@ -51,33 +51,33 @@
; ---------------------------------
_usb_host_bus_reset:
;source-doc/base-drv/usb-base-drv.c:8: ch_cmd_set_usb_mode(CH_MODE_HOST);
ld l,0x06
ld l,$06
call _ch_cmd_set_usb_mode
;source-doc/base-drv/usb-base-drv.c:9: delay_20ms();
call _delay_20ms
;source-doc/base-drv/usb-base-drv.c:11: ch_cmd_set_usb_mode(CH_MODE_HOST_RESET);
ld l,0x07
ld l,$07
call _ch_cmd_set_usb_mode
;source-doc/base-drv/usb-base-drv.c:12: delay_20ms();
call _delay_20ms
;source-doc/base-drv/usb-base-drv.c:14: ch_cmd_set_usb_mode(CH_MODE_HOST);
ld l,0x06
ld l,$06
call _ch_cmd_set_usb_mode
;source-doc/base-drv/usb-base-drv.c:15: delay_20ms();
call _delay_20ms
;source-doc/base-drv/ch376.h:108: #define TRACE_USB_ERROR(result)
ld l,0x0b
ld l,$0b
call _ch_command
;source-doc/base-drv/ch376.h:109:
ld a,0x25
ld a,$25
ld bc,_CH376_DATA_PORT
out (c), a
;source-doc/base-drv/ch376.h:110: #endif
ld a,0xdf
ld a,$df
ld bc,_CH376_DATA_PORT
out (c), a
;source-doc/base-drv/usb-base-drv.c:19: return USB_ERR_OK;
ld l,0x00
ld l,$00
;source-doc/base-drv/usb-base-drv.c:20: }
ret
;source-doc/base-drv/usb-base-drv.c:24: uint16_t usb_init(uint8_t state) __z88dk_fastcall {
@ -85,8 +85,8 @@ _usb_host_bus_reset:
; Function usb_init
; ---------------------------------
_usb_init:
;source-doc/base-drv/usb-base-drv.c:27: USB_MODULE_LEDS = 0x03;
ld a,0x03
;source-doc/base-drv/usb-base-drv.c:27: USB_MODULE_LEDS = $03;
ld a,$03
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/usb-base-drv.c:29: if (state == 0) {
@ -100,21 +100,21 @@ _usb_init:
;source-doc/base-drv/usb-base-drv.c:33: if (!ch_probe()) {
call _ch_probe
ld a, l
;source-doc/base-drv/usb-base-drv.c:34: USB_MODULE_LEDS = 0x00;
;source-doc/base-drv/usb-base-drv.c:34: USB_MODULE_LEDS = $00;
or a
jr NZ,l_usb_init_00102
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/usb-base-drv.c:35: return 0xFF00;
ld hl,0xff00
;source-doc/base-drv/usb-base-drv.c:35: return $FF00;
ld hl,$ff00
jp l_usb_init_00113
l_usb_init_00102:
;source-doc/base-drv/usb-base-drv.c:37: USB_MODULE_LEDS = 0x00;
ld a,0x00
;source-doc/base-drv/usb-base-drv.c:37: USB_MODULE_LEDS = $00;
ld a,$00
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/usb-base-drv.c:38: return 1;
ld hl,0x0001
ld hl,$0001
jr l_usb_init_00113
l_usb_init_00104:
;source-doc/base-drv/usb-base-drv.c:41: if (state == 1) {
@ -123,21 +123,21 @@ l_usb_init_00104:
jr NZ,l_usb_init_00106
;source-doc/base-drv/usb-base-drv.c:42: r = ch_cmd_get_ic_version();
call _ch_cmd_get_ic_version
;source-doc/base-drv/usb-base-drv.c:44: USB_MODULE_LEDS = 0x00;
ld a,0x00
;source-doc/base-drv/usb-base-drv.c:44: USB_MODULE_LEDS = $00;
ld a,$00
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/usb-base-drv.c:45: return (uint16_t)r << 8 | 2;
xor a
ld h, l
ld l,0x02
ld l,$02
jr l_usb_init_00113
l_usb_init_00106:
;source-doc/base-drv/usb-base-drv.c:48: if (state == 2) {
ld a, l
sub 0x02
sub $02
jr NZ,l_usb_init_00159
ld a,0x01
ld a,$01
jr l_usb_init_00160
l_usb_init_00159:
xor a
@ -147,33 +147,33 @@ l_usb_init_00160:
jr Z,l_usb_init_00110
;source-doc/base-drv/usb-base-drv.c:49: usb_host_bus_reset();
call _usb_host_bus_reset
;source-doc/base-drv/usb-base-drv.c:51: r = ch_very_short_wait_int_and_get_();
call _ch_very_short_wait_int_and_get
;source-doc/base-drv/usb-base-drv.c:51: r = ch_very_short_status();
call _ch_very_short_status
ld a, l
;source-doc/base-drv/usb-base-drv.c:53: if (r != USB_INT_CONNECT) {
sub 0x81
sub $81
jr Z,l_usb_init_00108
;source-doc/base-drv/usb-base-drv.c:54: USB_MODULE_LEDS = 0x00;
ld a,0x00
;source-doc/base-drv/usb-base-drv.c:54: USB_MODULE_LEDS = $00;
ld a,$00
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/usb-base-drv.c:55: return 2;
ld hl,0x0002
ld hl,$0002
jr l_usb_init_00113
l_usb_init_00108:
;source-doc/base-drv/usb-base-drv.c:58: return 3;
ld hl,0x0003
ld hl,$0003
jr l_usb_init_00113
l_usb_init_00110:
;source-doc/base-drv/usb-base-drv.c:61: memset(get_usb_work_area(), 0, sizeof(_usb_state));
ld b,0x32
ld b,$32
ld hl,_x
jr l_usb_init_00163
l_usb_init_00162:
ld (hl),0x00
ld (hl),$00
inc hl
l_usb_init_00163:
ld (hl),0x00
ld (hl),$00
inc hl
djnz l_usb_init_00162
;source-doc/base-drv/usb-base-drv.c:62: if (state != 2) {
@ -186,15 +186,15 @@ l_usb_init_00163:
l_usb_init_00112:
;source-doc/base-drv/usb-base-drv.c:66: enumerate_all_devices();
call _enumerate_all_devices
;source-doc/base-drv/usb-base-drv.c:67: USB_MODULE_LEDS = 0x00;
ld a,0x00
;source-doc/base-drv/usb-base-drv.c:67: USB_MODULE_LEDS = $00;
ld a,$00
ld bc,_USB_MODULE_LEDS
out (c), a
;source-doc/base-drv/usb-base-drv.c:68: return (uint16_t)count_of_devices() << 8 | 4;
call _count_of_devices
ld h, a
xor a
ld l,0x04
ld l,$04
l_usb_init_00113:
;source-doc/base-drv/usb-base-drv.c:69: }
ret
@ -210,15 +210,15 @@ _usb_scsi_seek:
ld a,(ix+4)
call _get_usb_device_config
;source-doc/base-drv/usb-base-drv.c:74: dev->current_lba = lba;
ld hl,0x000c
ld hl,$000c
add hl, de
ex de, hl
ld hl,6
add hl, sp
ld bc,0x0004
ld bc,$0004
ldir
;source-doc/base-drv/usb-base-drv.c:75: return USB_ERR_OK;
ld l,0x00
ld l,$00
;source-doc/base-drv/usb-base-drv.c:76: }
pop ix
ret

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

@ -55,7 +55,7 @@ _count_of_devices:
ld hl,_x
call _first_device_config
;source-doc/base-drv/usb_state.c:23: while (p_config) {
ld c,0x00
ld c,$00
l_count_of_devices_00104:
ld a, d
or e
@ -64,9 +64,9 @@ l_count_of_devices_00104:
ld l, e
ld h, d
ld a, (hl)
and 0x0f
and $0f
;source-doc/base-drv/usb_state.c:26: if (type != USB_IS_HUB && type)
cp 0x0f
cp $0f
jr Z,l_count_of_devices_00102
or a
jr Z,l_count_of_devices_00102
@ -85,13 +85,13 @@ l_count_of_devices_00106:
;source-doc/base-drv/usb_state.c:34: }
ret
_device_config_sizes:
DEFB +0x00
DEFB +0x10
DEFB +0x10
DEFB +0x0c
DEFB +0x06
DEFB 0x00
DEFB 0x00
DEFB +$00
DEFB +$10
DEFB +$10
DEFB +$0c
DEFB +$06
DEFB $00
DEFB $00
;source-doc/base-drv/usb_state.c:37: device_config *find_first_free(void) {
; ---------------------------------
; Function find_first_free
@ -110,7 +110,7 @@ l_find_first_free_00103:
ld l, e
ld h, d
ld a, (hl)
and 0x0f
and $0f
jr NZ,l_find_first_free_00102
;source-doc/base-drv/usb_state.c:44: return p;
ex de, hl
@ -122,7 +122,7 @@ l_find_first_free_00102:
jr l_find_first_free_00103
l_find_first_free_00105:
;source-doc/base-drv/usb_state.c:49: return NULL;
ld hl,0x0000
ld hl,$0000
l_find_first_free_00106:
;source-doc/base-drv/usb_state.c:50: }
ret
@ -146,20 +146,20 @@ _next_device_config:
ld l, e
ld h, d
ld a, (hl)
and 0x0f
and $0f
jr NZ,l_next_device_config_00102
;source-doc/base-drv/usb_state.c:56: return NULL;
ld de,0x0000
ld de,$0000
jr l_next_device_config_00105
l_next_device_config_00102:
;source-doc/base-drv/usb_state.c:58: const uint8_t size = device_config_sizes[p->type];
ld l, e
ld h, d
ld a, (hl)
and 0x0f
add a, +((_device_config_sizes) & 0xFF)
and $0f
add a, +((_device_config_sizes) & $FF)
ld l, a
ld a,0x00
ld a,$00
adc a, +((_device_config_sizes) / 256)
ld h, a
ld a, (hl)
@ -167,11 +167,11 @@ l_next_device_config_00102:
;source-doc/base-drv/usb_state.c:66: device_config *const result = (device_config *)(_p + size);
add a, e
ld e, a
ld a,0x00
ld a,$00
adc a, d
ld d, a
;source-doc/base-drv/usb_state.c:68: if (result >= (device_config *)&usb_state->device_configs_end)
ld hl,0x0062
ld hl,$0062
add hl, bc
ld a, e
sub l
@ -179,7 +179,7 @@ l_next_device_config_00102:
sbc a, h
ret C
;source-doc/base-drv/usb_state.c:69: return NULL;
ld de,0x0000
ld de,$0000
;source-doc/base-drv/usb_state.c:71: return result;
l_next_device_config_00105:
;source-doc/base-drv/usb_state.c:72: }
@ -196,7 +196,7 @@ _get_usb_device_config:
ld hl,_x
call _first_device_config
pop bc
ld b,0x01
ld b,$01
l_get_usb_device_config_00107:
ld a, d
or e
@ -205,7 +205,7 @@ l_get_usb_device_config_00107:
ld l, e
ld h, d
ld a, (hl)
and 0x0f
and $0f
jr Z,l_get_usb_device_config_00108
;source-doc/base-drv/usb_state.c:81: if (counter == device_index)
ld a, c
@ -223,7 +223,7 @@ l_get_usb_device_config_00108:
jr l_get_usb_device_config_00107
l_get_usb_device_config_00105:
;source-doc/base-drv/usb_state.c:87: return NULL; // is not a usb device
ld de,0x0000
ld de,$0000
l_get_usb_device_config_00109:
;source-doc/base-drv/usb_state.c:88: }
ret
@ -245,12 +245,12 @@ _usb_get_device_type:
or e
jr NZ,l_usb_get_device_type_00102
;source-doc/base-drv/usb_state.c:94: return -1;
ld l,0xff
ld l,$ff
jr l_usb_get_device_type_00103
l_usb_get_device_type_00102:
;source-doc/base-drv/usb_state.c:96: return dev->type;
ld a, (hl)
and 0x0f
and $0f
ld l, a
l_usb_get_device_type_00103:
;source-doc/base-drv/usb_state.c:97: }

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

@ -48,102 +48,102 @@ _x:
; code
;--------------------------------------------------------
_x:
DEFB 0x00
DEFB +0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB +0x00
DEFB $00
DEFB +$00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB +$00

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

@ -63,12 +63,12 @@ _hid_set_protocol:
ld hl,2
add hl, sp
ex de, hl
ld bc,0x0008
ld bc,$0008
ld hl,_cmd_hid_set
ldir
pop de
;source-doc/keyboard/class_hid.c:10: cmd.bRequest = HID_SET_PROTOCOL;
ld (ix-7),0x0b
ld (ix-7),$0b
;source-doc/keyboard/class_hid.c:11: cmd.bValue[0] = protocol;
ld a,(ix+4)
ld (ix-6),a
@ -83,10 +83,10 @@ _hid_set_protocol:
rlca
rlca
rlca
and 0x0f
and $0f
ld c,a
push bc
ld hl,0x0000
ld hl,$0000
push hl
ld hl,4
add hl, sp
@ -103,13 +103,13 @@ _hid_set_protocol:
inc sp
jp (hl)
_cmd_hid_set:
DEFB +0x21
DEFB +0x0b
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFW +0x0000
DEFB +$21
DEFB +$0b
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFW +$0000
;source-doc/keyboard/class_hid.c:16: usb_error hid_set_idle(const device_config_keyboard *const dev, const uint8_t duration) __sdcccall(1) {
; ---------------------------------
; Function hid_set_idle
@ -128,12 +128,12 @@ _hid_set_idle:
ld hl,2
add hl, sp
ex de, hl
ld bc,0x0008
ld bc,$0008
ld hl,_cmd_hid_set
ldir
pop de
;source-doc/keyboard/class_hid.c:20: cmd.bRequest = HID_SET_IDLE;
ld (ix-7),0x0a
ld (ix-7),$0a
;source-doc/keyboard/class_hid.c:21: cmd.bValue[0] = duration;
ld a,(ix+4)
ld (ix-6),a
@ -148,10 +148,10 @@ _hid_set_idle:
rlca
rlca
rlca
and 0x0f
and $0f
ld c,a
push bc
ld hl,0x0000
ld hl,$0000
push hl
ld hl,4
add hl, sp

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

@ -59,21 +59,21 @@ _char_with_caps_lock:
;source-doc/keyboard/class_hid_keyboard.c:336: static char char_with_caps_lock(const char c, const bool caps_lock_engaged) __sdcccall(1) {
jr Z,l_char_with_caps_lock_00109
;source-doc/keyboard/class_hid_keyboard.c:338: return c;
cp 0x41
cp $41
jr C,l_char_with_caps_lock_00104
cp 0x5b
cp $5b
jr NC,l_char_with_caps_lock_00104
;source-doc/keyboard/class_hid_keyboard.c:339:
add a,0x20
add a,$20
jr l_char_with_caps_lock_00109
l_char_with_caps_lock_00104:
;source-doc/keyboard/class_hid_keyboard.c:341: return c - 'A' + 'a';
cp 0x61
cp $61
ret C
cp 0x7b
cp $7b
ret NC
;source-doc/keyboard/class_hid_keyboard.c:342:
add a,0xe0
add a,$e0
;source-doc/keyboard/class_hid_keyboard.c:344: return c - 'a' + 'A';
l_char_with_caps_lock_00109:
;source-doc/keyboard/class_hid_keyboard.c:345:
@ -89,25 +89,25 @@ _scancode_to_char:
;source-doc/keyboard/class_hid_keyboard.c:348:
ld c,a
ld e,l
and 0x11
and $11
jr Z,l_scancode_to_char_00118
;source-doc/keyboard/class_hid_keyboard.c:349: char scancode_to_char(const uint8_t modifier_keys, const uint8_t code, const bool caps_lock_engaged) __sdcccall(1) {
ld a, e
sub 0x04
sub $04
jr C,l_scancode_to_char_00102
ld a,0x1d
ld a,$1d
sub e
jr C,l_scancode_to_char_00102
;source-doc/keyboard/class_hid_keyboard.c:350: if ((modifier_keys & (KEY_MOD_LCTRL | KEY_MOD_RCTRL))) {
ld a, e
add a,0xfd
add a,$fd
jr l_scancode_to_char_00121
l_scancode_to_char_00102:
;source-doc/keyboard/class_hid_keyboard.c:352: return code - 3;
ld a,e
cp 0x1f
cp $1f
jr Z,l_scancode_to_char_00104
sub 0x2c
sub $2c
jr NZ,l_scancode_to_char_00105
l_scancode_to_char_00104:
;source-doc/keyboard/class_hid_keyboard.c:353:
@ -116,50 +116,50 @@ l_scancode_to_char_00104:
l_scancode_to_char_00105:
;source-doc/keyboard/class_hid_keyboard.c:355: return 0;
ld a, e
sub 0x2f
sub $2f
jr NZ,l_scancode_to_char_00108
;source-doc/keyboard/class_hid_keyboard.c:356:
ld a,0x1b
ld a,$1b
jr l_scancode_to_char_00121
l_scancode_to_char_00108:
;source-doc/keyboard/class_hid_keyboard.c:358: return 27;
ld a, e
sub 0x31
sub $31
jr NZ,l_scancode_to_char_00110
;source-doc/keyboard/class_hid_keyboard.c:359:
ld a,0x1c
ld a,$1c
jr l_scancode_to_char_00121
l_scancode_to_char_00110:
;source-doc/keyboard/class_hid_keyboard.c:361: return 28;
ld a, e
sub 0x30
sub $30
jr NZ,l_scancode_to_char_00112
;source-doc/keyboard/class_hid_keyboard.c:362:
ld a,0x1d
ld a,$1d
jr l_scancode_to_char_00121
l_scancode_to_char_00112:
;source-doc/keyboard/class_hid_keyboard.c:364: return 29;
ld a, e
sub 0x23
sub $23
jr NZ,l_scancode_to_char_00114
;source-doc/keyboard/class_hid_keyboard.c:365:
ld a,0x1e
ld a,$1e
jr l_scancode_to_char_00121
l_scancode_to_char_00114:
;source-doc/keyboard/class_hid_keyboard.c:367: return 30;
ld a, e
sub 0x2d
sub $2d
jr NZ,l_scancode_to_char_00118
;source-doc/keyboard/class_hid_keyboard.c:368:
ld a,0x1f
ld a,$1f
jr l_scancode_to_char_00121
l_scancode_to_char_00118:
;source-doc/keyboard/class_hid_keyboard.c:371: }
ld a, c
and 0x22
and $22
jr Z,l_scancode_to_char_00120
;source-doc/keyboard/class_hid_keyboard.c:372:
ld d,0x00
ld d,$00
ld hl,_scancodes_shift_table
add hl, de
ld a, (hl)
@ -168,7 +168,7 @@ l_scancode_to_char_00118:
jr l_scancode_to_char_00121
l_scancode_to_char_00120:
;source-doc/keyboard/class_hid_keyboard.c:374: return char_with_caps_lock(scancodes_shift_table[code], caps_lock_engaged);
ld d,0x00
ld d,$00
ld hl,_scancodes_table
add hl, de
ld a, (hl)
@ -181,260 +181,260 @@ l_scancode_to_char_00121:
inc sp
jp (hl)
_scancodes_shift_table:
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x41
DEFB +0x42
DEFB +0x43
DEFB +0x44
DEFB +0x45
DEFB +0x46
DEFB +0x47
DEFB +0x48
DEFB +0x49
DEFB +0x4a
DEFB +0x4b
DEFB +0x4c
DEFB +0x4d
DEFB +0x4e
DEFB +0x4f
DEFB +0x50
DEFB +0x51
DEFB +0x52
DEFB +0x53
DEFB +0x54
DEFB +0x55
DEFB +0x56
DEFB +0x57
DEFB +0x58
DEFB +0x59
DEFB +0x5a
DEFB +0x21
DEFB +0x40
DEFB +0x23
DEFB +0x24
DEFB +0x25
DEFB +0x5e
DEFB +0x26
DEFB +0x2a
DEFB +0x28
DEFB +0x29
DEFB +0x0d
DEFB +0x1b
DEFB +0x08
DEFB +0x09
DEFB +0x20
DEFB +0x5f
DEFB +0x2b
DEFB +0x7b
DEFB +0x7d
DEFB +0x7c
DEFB +0x7e
DEFB +0x3a
DEFB +0x22
DEFB +0x7e
DEFB +0x3c
DEFB +0x3e
DEFB +0x3f
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x2f
DEFB +0x2a
DEFB +0x2d
DEFB +0x2b
DEFB +0x0d
DEFB +0x31
DEFB +0x32
DEFB +0x33
DEFB +0x34
DEFB +0x35
DEFB +0x36
DEFB +0x37
DEFB +0x38
DEFB +0x39
DEFB +0x30
DEFB +0x2e
DEFB +0x5c
DEFB +0x00
DEFB +0x00
DEFB +0x3d
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$41
DEFB +$42
DEFB +$43
DEFB +$44
DEFB +$45
DEFB +$46
DEFB +$47
DEFB +$48
DEFB +$49
DEFB +$4a
DEFB +$4b
DEFB +$4c
DEFB +$4d
DEFB +$4e
DEFB +$4f
DEFB +$50
DEFB +$51
DEFB +$52
DEFB +$53
DEFB +$54
DEFB +$55
DEFB +$56
DEFB +$57
DEFB +$58
DEFB +$59
DEFB +$5a
DEFB +$21
DEFB +$40
DEFB +$23
DEFB +$24
DEFB +$25
DEFB +$5e
DEFB +$26
DEFB +$2a
DEFB +$28
DEFB +$29
DEFB +$0d
DEFB +$1b
DEFB +$08
DEFB +$09
DEFB +$20
DEFB +$5f
DEFB +$2b
DEFB +$7b
DEFB +$7d
DEFB +$7c
DEFB +$7e
DEFB +$3a
DEFB +$22
DEFB +$7e
DEFB +$3c
DEFB +$3e
DEFB +$3f
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$2f
DEFB +$2a
DEFB +$2d
DEFB +$2b
DEFB +$0d
DEFB +$31
DEFB +$32
DEFB +$33
DEFB +$34
DEFB +$35
DEFB +$36
DEFB +$37
DEFB +$38
DEFB +$39
DEFB +$30
DEFB +$2e
DEFB +$5c
DEFB +$00
DEFB +$00
DEFB +$3d
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
_scancodes_table:
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x61
DEFB +0x62
DEFB +0x63
DEFB +0x64
DEFB +0x65
DEFB +0x66
DEFB +0x67
DEFB +0x68
DEFB +0x69
DEFB +0x6a
DEFB +0x6b
DEFB +0x6c
DEFB +0x6d
DEFB +0x6e
DEFB +0x6f
DEFB +0x70
DEFB +0x71
DEFB +0x72
DEFB +0x73
DEFB +0x74
DEFB +0x75
DEFB +0x76
DEFB +0x77
DEFB +0x78
DEFB +0x79
DEFB +0x7a
DEFB +0x31
DEFB +0x32
DEFB +0x33
DEFB +0x34
DEFB +0x35
DEFB +0x36
DEFB +0x37
DEFB +0x38
DEFB +0x39
DEFB +0x30
DEFB +0x0d
DEFB +0x1b
DEFB +0x08
DEFB +0x09
DEFB +0x20
DEFB +0x2d
DEFB +0x3d
DEFB +0x5b
DEFB +0x5d
DEFB +0x5c
DEFB +0x23
DEFB +0x3b
DEFB +0x27
DEFB +0x60
DEFB +0x2c
DEFB +0x2e
DEFB +0x2f
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x2f
DEFB +0x2a
DEFB +0x2d
DEFB +0x2b
DEFB +0x0d
DEFB +0x31
DEFB +0x32
DEFB +0x33
DEFB +0x34
DEFB +0x35
DEFB +0x36
DEFB +0x37
DEFB +0x38
DEFB +0x39
DEFB +0x30
DEFB +0x2e
DEFB +0x5c
DEFB +0x00
DEFB +0x00
DEFB +0x3d
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$61
DEFB +$62
DEFB +$63
DEFB +$64
DEFB +$65
DEFB +$66
DEFB +$67
DEFB +$68
DEFB +$69
DEFB +$6a
DEFB +$6b
DEFB +$6c
DEFB +$6d
DEFB +$6e
DEFB +$6f
DEFB +$70
DEFB +$71
DEFB +$72
DEFB +$73
DEFB +$74
DEFB +$75
DEFB +$76
DEFB +$77
DEFB +$78
DEFB +$79
DEFB +$7a
DEFB +$31
DEFB +$32
DEFB +$33
DEFB +$34
DEFB +$35
DEFB +$36
DEFB +$37
DEFB +$38
DEFB +$39
DEFB +$30
DEFB +$0d
DEFB +$1b
DEFB +$08
DEFB +$09
DEFB +$20
DEFB +$2d
DEFB +$3d
DEFB +$5b
DEFB +$5d
DEFB +$5c
DEFB +$23
DEFB +$3b
DEFB +$27
DEFB +$60
DEFB +$2c
DEFB +$2e
DEFB +$2f
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$2f
DEFB +$2a
DEFB +$2d
DEFB +$2b
DEFB +$0d
DEFB +$31
DEFB +$32
DEFB +$33
DEFB +$34
DEFB +$35
DEFB +$36
DEFB +$37
DEFB +$38
DEFB +$39
DEFB +$30
DEFB +$2e
DEFB +$5c
DEFB +$00
DEFB +$00
DEFB +$3d
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00

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

@ -56,12 +56,12 @@ _keyboard_init:
dec sp
;source-doc/keyboard/kyb-init.c:7: uint8_t index = 1;
;source-doc/keyboard/kyb-init.c:9: do {
ld c,0x01
ld c,$01
ld (ix-1),c
l_keyboard_init_00103:
;source-doc/keyboard/kyb-init.c:10: usb_device_type t = usb_get_device_type(index);
ld e, c
ld d,0x00
ld d,$00
push bc
push de
push de
@ -71,7 +71,7 @@ l_keyboard_init_00103:
pop de
pop bc
;source-doc/keyboard/kyb-init.c:12: if (t == USB_IS_KEYBOARD) {
sub 0x04
sub $04
jr NZ,l_keyboard_init_00104
;source-doc/keyboard/kyb-init.c:13: print_string("\r\nUSB: KEYBOARD @ $");
push de
@ -88,14 +88,14 @@ l_keyboard_init_00103:
ld a,(ix-1)
call _usb_kyb_init
;source-doc/keyboard/kyb-init.c:18: return 1;
ld a,0x01
ld a,$01
jr l_keyboard_init_00106
l_keyboard_init_00104:
;source-doc/keyboard/kyb-init.c:20: } while (++index != MAX_NUMBER_OF_DEVICES + 1);
inc c
ld (ix-1),c
ld a, c
sub 0x07
sub $07
jr NZ,l_keyboard_init_00103
;source-doc/keyboard/kyb-init.c:22: print_string("\r\nUSB: KEYBOARD: NOT FOUND$");
ld hl,kyb_init_str_2
@ -108,15 +108,15 @@ l_keyboard_init_00106:
pop ix
ret
kyb_init_str_0:
DEFB 0x0d
DEFB 0x0a
DEFB $0d
DEFB $0a
DEFM "USB: KEYBOARD @ $"
DEFB 0x00
DEFB $00
kyb_init_str_1:
DEFM " $"
DEFB 0x00
DEFB $00
kyb_init_str_2:
DEFB 0x0d
DEFB 0x0a
DEFB $0d
DEFB $0a
DEFM "USB: KEYBOARD: NOT FOUND$"
DEFB 0x00
DEFB $00

112
Source/HBIOS/ch376-native/keyboard/kyb_driver.c.s

@ -68,7 +68,7 @@ _report_diff:
ld de,_report+0
;source-doc/keyboard/kyb_driver.c:25: static uint8_t report_diff() __sdcccall(1) {
;source-doc/keyboard/kyb_driver.c:28:
ld b,0x08
ld b,$08
ld hl,_previous
l_report_diff_00103:
;source-doc/keyboard/kyb_driver.c:29: uint8_t i = sizeof(report);
@ -79,7 +79,7 @@ l_report_diff_00103:
sub c
jr Z,l_report_diff_00104
;source-doc/keyboard/kyb_driver.c:30: do {
ld a,0x01
ld a,$01
jr l_report_diff_00106
l_report_diff_00104:
;source-doc/keyboard/kyb_driver.c:31: if (*a++ != *b++)
@ -96,20 +96,20 @@ l_report_diff_00106:
_keyboard_buf_put:
ld c, a
;source-doc/keyboard/kyb_driver.c:37:
ld b,0x00
ld b,$00
ld hl,+(_report + 2)
add hl, bc
;source-doc/keyboard/kyb_driver.c:38: static void keyboard_buf_put(const uint8_t indx) __sdcccall(1) {
ld a,(hl)
ld e,a
sub 0x80
sub $80
jr NC,l_keyboard_buf_put_00112
ld a, e
or a
;source-doc/keyboard/kyb_driver.c:39: const uint8_t key_code = report.keyCode[indx];
jr Z,l_keyboard_buf_put_00112
;source-doc/keyboard/kyb_driver.c:42:
ld b,0x00
ld b,$00
ld hl,+(_previous + 2)
add hl, bc
ld a, (hl)
@ -118,12 +118,12 @@ _keyboard_buf_put:
jr Z,l_keyboard_buf_put_00112
;source-doc/keyboard/kyb_driver.c:45: return;
ld a, e
sub 0x39
sub $39
jr NZ,l_keyboard_buf_put_00107
;source-doc/keyboard/kyb_driver.c:46:
ld hl,_caps_lock_engaged
ld a, (hl)
xor 0x01
xor $01
ld (hl), a
;source-doc/keyboard/kyb_driver.c:47: if (key_code == KEY_CODE_CAPS_LOCK) {
jr l_keyboard_buf_put_00112
@ -144,7 +144,7 @@ l_keyboard_buf_put_00107:
;source-doc/keyboard/kyb_driver.c:55: return;
ld a, (_write_index)
inc a
and 0x07
and $07
ld c, a
;source-doc/keyboard/kyb_driver.c:56:
ld hl,_read_index
@ -153,7 +153,7 @@ l_keyboard_buf_put_00107:
ret Z
;source-doc/keyboard/kyb_driver.c:57: uint8_t next_write_index = (write_index + 1) & KEYBOARD_BUFFER_SIZE_MASK;
ld hl,(_write_index)
ld h,0x00
ld h,$00
ld de,_buffer
add hl,de
ld a,b
@ -184,7 +184,7 @@ _usb_kyb_status:
l_usb_kyb_status_00102:
;source-doc/keyboard/kyb_driver.c:70: size = write_index - read_index;
ld hl, (_read_index)
ld a,0x08
ld a,$08
sub l
ld hl, (_write_index)
add a, l
@ -205,14 +205,14 @@ _usb_kyb_read:
sub (hl)
jr NZ,l_usb_kyb_read_00102
;source-doc/keyboard/kyb_driver.c:78: uint16_t usb_kyb_read() {
ld hl,0xff00
ld hl,$ff00
jr l_usb_kyb_read_00103
l_usb_kyb_read_00102:
;source-doc/keyboard/kyb_driver.c:80: return 0xFF00; // H = -1, L = 0
;source-doc/keyboard/kyb_driver.c:80: return $FF00; // H = -1, L = 0
DI
;source-doc/keyboard/kyb_driver.c:81:
ld hl,(_read_index)
ld h,0x00
ld h,$00
ld bc,_buffer
add hl,bc
ld a,(hl)
@ -223,12 +223,12 @@ l_usb_kyb_read_00102:
;source-doc/keyboard/kyb_driver.c:82: DI;
ld a, (_read_index)
inc a
and 0x07
and $07
ld (_read_index), a
;source-doc/keyboard/kyb_driver.c:83: const uint8_t c = buffer[read_index];
EI
;source-doc/keyboard/kyb_driver.c:86:
ld h,0x00
ld h,$00
l_usb_kyb_read_00103:
;source-doc/keyboard/kyb_driver.c:87: /* H = 0, L = ascii char */
ret
@ -247,7 +247,7 @@ _usb_kyb_flush:
ld de,_previous+0
;source-doc/keyboard/kyb_driver.c:95: uint8_t i = sizeof(previous);
;source-doc/keyboard/kyb_driver.c:96: uint8_t *a = (uint8_t *)previous;
ld b,0x08
ld b,$08
ld hl,_report
l_usb_kyb_flush_00101:
;source-doc/keyboard/kyb_driver.c:97: uint8_t *b = (uint8_t *)report;
@ -255,7 +255,7 @@ l_usb_kyb_flush_00101:
ld (de), a
inc de
;source-doc/keyboard/kyb_driver.c:98: do {
ld (hl),0x00
ld (hl),$00
inc hl
;source-doc/keyboard/kyb_driver.c:99: *a++ = 0;
djnz l_usb_kyb_flush_00101
@ -277,20 +277,20 @@ _usb_kyb_tick:
;source-doc/keyboard/kyb_driver.c:110:
jr NZ,l_usb_kyb_tick_00112
;././source-doc/base-drv//ch376.h:108: #define TRACE_USB_ERROR(result)
ld l,0x0b
ld l,$0b
call _ch_command
;././source-doc/base-drv//ch376.h:109:
ld a,0x25
ld a,$25
ld bc,_CH376_DATA_PORT
out (c), a
;././source-doc/base-drv//ch376.h:110: #endif
ld a,0x1f
ld a,$1f
ld bc,_CH376_DATA_PORT
out (c), a
;source-doc/keyboard/kyb_driver.c:113:
ld bc,_report+0
ld hl, (_keyboard_config)
ld a,0x08
ld a,$08
push af
inc sp
push bc
@ -301,15 +301,15 @@ _usb_kyb_tick:
inc sp
;././source-doc/base-drv//ch376.h:108: #define TRACE_USB_ERROR(result)
push hl
ld l,0x0b
ld l,$0b
call _ch_command
pop hl
;././source-doc/base-drv//ch376.h:109:
ld a,0x25
ld a,$25
ld bc,_CH376_DATA_PORT
out (c), a
;././source-doc/base-drv//ch376.h:110: #endif
ld a,0xdf
ld a,$df
ld bc,_CH376_DATA_PORT
out (c), a
;source-doc/keyboard/kyb_driver.c:115: result = usbdev_dat_in_trnsfer_0((device_config *)keyboard_config, (uint8_t *)&report, 8);
@ -321,7 +321,7 @@ _usb_kyb_tick:
or a
jr Z,l_usb_kyb_tick_00112
;source-doc/keyboard/kyb_driver.c:118: if (report_diff()) {
ld b,0x06
ld b,$06
l_usb_kyb_tick_00103:
;source-doc/keyboard/kyb_driver.c:119: uint8_t i = 6;
ld a, b
@ -333,7 +333,7 @@ l_usb_kyb_tick_00103:
djnz l_usb_kyb_tick_00103
;source-doc/keyboard/kyb_driver.c:121: keyboard_buf_put(i - 1);
ld de,_previous
ld bc,0x0008
ld bc,$0008
ld hl,_report
ldir
l_usb_kyb_tick_00112:
@ -356,13 +356,13 @@ _usb_kyb_init:
;source-doc/keyboard/kyb_driver.c:130:
ret Z
;source-doc/keyboard/kyb_driver.c:132: return;
ld a,0x01
ld a,$01
push af
inc sp
ld hl, (_keyboard_config)
call _hid_set_protocol
;source-doc/keyboard/kyb_driver.c:133:
ld a,0x80
ld a,$80
push af
inc sp
ld hl, (_keyboard_config)
@ -370,37 +370,37 @@ _usb_kyb_init:
;source-doc/keyboard/kyb_driver.c:134: hid_set_protocol(keyboard_config, 1);
ret
_caps_lock_engaged:
DEFB +0x01
DEFB +$01
_keyboard_config:
DEFW +0x0000
DEFW +$0000
_buffer:
DEFB +0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB +$00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
_write_index:
DEFB +0x00
DEFB +$00
_read_index:
DEFB +0x00
DEFB +$00
_report:
DEFB +0x00
DEFB +0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB +$00
DEFB +$00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
_previous:
DEFB +0x00
DEFB +0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB +$00
DEFB +$00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00

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

@ -30,7 +30,7 @@
; .area _INITIALIZED removed by z88dk
_scsi_command_block_wrapper:
_scsi_cmd_blk_wrap:
DEFS 15
_next_tag:
DEFS 2
@ -61,7 +61,7 @@ _do_scsi_cmd:
add hl, sp
ld sp, hl
;source-doc/scsi-drv/class_scsi.c:17: _scsi_command_status_wrapper csw = {{{0}}};
ld a,0x00
ld a,$00
ld (ix-21),a
ld (ix-20),a
ld (ix-19),a
@ -72,16 +72,16 @@ _do_scsi_cmd:
xor a
ld (ix-15),a
ld (ix-14),a
ld a,0x00
ld a,$00
ld (ix-13),a
ld (ix-12),a
ld (ix-11),a
ld (ix-10),a
ld (ix-9),0x00
ld (ix-9),$00
;source-doc/scsi-drv/class_scsi.c:19: cbw->dCBWTag[0] = next_tag++;
ld c,(ix+6)
ld b,(ix+7)
ld hl,0x0004
ld hl,$0004
add hl, bc
ld (ix-8),l
ld (ix-7),h
@ -100,10 +100,10 @@ _do_scsi_cmd:
;source-doc/scsi-drv/class_scsi.c:21: if (!send)
bit 0,(ix+10)
jr NZ,l_do_scsi_cmd_00102
;source-doc/scsi-drv/class_scsi.c:22: cbw->bmCBWFlags = 0x80;
ld hl,0x000c
;source-doc/scsi-drv/class_scsi.c:22: cbw->bmCBWFlags = $80;
ld hl,$000c
add hl, bc
ld (hl),0x80
ld (hl),$80
l_do_scsi_cmd_00102:
;source-doc/scsi-drv/class_scsi.c:24: critical_begin();
push bc
@ -130,7 +130,7 @@ l_do_scsi_cmd_00102:
rlca
rlca
rlca
and 0x0f
and $0f
ld l,(ix+6)
ld h,(ix+7)
push bc
@ -139,7 +139,7 @@ l_do_scsi_cmd_00102:
push af
inc sp
push hl
ld hl,0x001f
ld hl,$001f
ex (sp), hl
push hl
call _usb_data_out_transfer
@ -177,10 +177,10 @@ l_do_scsi_cmd_00102:
jr NZ,l_do_scsi_cmd_00110
;source-doc/scsi-drv/class_scsi.c:32: &dev->endpoints[ENDPOINT_BULK_IN]));
ld a,(ix-6)
add a,0x06
add a,$06
ld e, a
ld a,(ix-5)
adc a,0x00
adc a,$00
ld d, a
ld l,(ix-4)
ld h,(ix-3)
@ -189,7 +189,7 @@ l_do_scsi_cmd_00102:
rlca
rlca
rlca
and 0x0f
and $0f
push de
push af
inc sp
@ -215,7 +215,7 @@ l_do_scsi_cmd_00110:
rlca
rlca
rlca
and 0x0f
and $0f
push de
push af
inc sp
@ -234,10 +234,10 @@ l_do_scsi_cmd_00110:
l_do_scsi_cmd_00113:
;source-doc/scsi-drv/class_scsi.c:41: usb_data_in_transfer((uint8_t *)&csw, sizeof(_scsi_command_status_wrapper), dev->address, &dev->endpoints[ENDPOINT_BULK_IN]));
ld a,(ix-6)
add a,0x06
add a,$06
ld c, a
ld a,(ix-5)
adc a,0x00
adc a,$00
ld b, a
ld l,(ix-4)
ld h,(ix-3)
@ -246,12 +246,12 @@ l_do_scsi_cmd_00113:
rlca
rlca
rlca
and 0x0f
and $0f
ld d, a
push bc
push de
inc sp
ld hl,0x000d
ld hl,$000d
push hl
ld hl,5
add hl, sp
@ -281,11 +281,11 @@ l_do_scsi_cmd_00113:
jr Z,l_do_scsi_cmd_00117
l_do_scsi_cmd_00116:
;source-doc/scsi-drv/class_scsi.c:44: result = USB_ERR_FAIL;
ld l,0x0e
ld l,$0e
jr l_do_scsi_cmd_00120
l_do_scsi_cmd_00117:
;source-doc/scsi-drv/class_scsi.c:46: result = USB_ERR_OK;
ld l,0x00
ld l,$00
;source-doc/scsi-drv/class_scsi.c:48: done:
l_do_scsi_cmd_00120:
;source-doc/scsi-drv/class_scsi.c:49: critical_end();
@ -308,19 +308,19 @@ _scsi_test:
ld hl, -27
add hl, sp
ld sp, hl
;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_cmd_blk_wrap;
ld hl,0
add hl, sp
ld e,l
ld d,h
push hl
ld bc,0x000f
ld hl,_scsi_command_block_wrapper
ld bc,$000f
ld hl,_scsi_cmd_blk_wrap
ldir
;source-doc/scsi-drv/class_scsi.c:56: memset(&cbw_scsi.test, 0, sizeof(_scsi_packet_test));
ld hl,17
add hl, sp
ld b,0x06
ld b,$06
l_scsi_test_00103:
xor a
ld (hl), a
@ -330,11 +330,11 @@ l_scsi_test_00103:
djnz l_scsi_test_00103
pop bc
;source-doc/scsi-drv/class_scsi.c:58: cbw_scsi.cbw.bCBWLUN = 0;
ld (ix-14),0x00
ld (ix-14),$00
;source-doc/scsi-drv/class_scsi.c:59: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_test);
ld (ix-13),0x0c
ld (ix-13),$0c
;source-doc/scsi-drv/class_scsi.c:60: cbw_scsi.cbw.dCBWDataTransferLength = 0;
ld hl,0x0008
ld hl,$0008
add hl, bc
xor a
ld (hl), a
@ -348,7 +348,7 @@ l_scsi_test_00103:
xor a
push af
inc sp
ld hl,0x0000
ld hl,$0000
push hl
push bc
ld l,(ix+4)
@ -370,31 +370,31 @@ _scsi_request_sense:
ld hl, -27
add hl, sp
ld sp, hl
;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_cmd_blk_wrap;
ld hl,0
add hl, sp
ld e,l
ld d,h
push hl
ld bc,0x000f
ld hl,_scsi_command_block_wrapper
ld bc,$000f
ld hl,_scsi_cmd_blk_wrap
ldir
;source-doc/scsi-drv/class_scsi.c:70: cbw_scsi.request_sense = scsi_packet_request_sense;
;source-doc/scsi-drv/class_scsi.c:70: cbw_scsi.request_sense = scsi_pckt_req_sense;
ld hl,17
add hl, sp
ex de, hl
ld bc,0x000c
ld hl,_scsi_packet_request_sense
ld bc,$000c
ld hl,_scsi_pckt_req_sense
ldir
pop bc
;source-doc/scsi-drv/class_scsi.c:72: cbw_scsi.cbw.bCBWLUN = 0;
ld (ix-14),0x00
ld (ix-14),$00
;source-doc/scsi-drv/class_scsi.c:73: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_request_sense);
ld (ix-13),0x0c
ld (ix-13),$0c
;source-doc/scsi-drv/class_scsi.c:74: cbw_scsi.cbw.dCBWDataTransferLength = sizeof(scsi_sense_result);
ld hl,0x0008
ld hl,$0008
add hl, bc
ld (hl),0x12
ld (hl),$12
inc hl
xor a
ld (hl), a
@ -418,29 +418,29 @@ _scsi_request_sense:
ld sp,ix
pop ix
ret
_scsi_packet_request_sense:
DEFB +0x03
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x12
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
_scsi_command_block_wrapper:
DEFB +0x55
DEFB +0x53
DEFB +0x42
DEFB +0x43
DEFW +0x0000
DEFW +0x0000
DEFB +0x00,0x00, +0x00, +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
_scsi_pckt_req_sense:
DEFB +$03
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$12
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
_scsi_cmd_blk_wrap:
DEFB +$55
DEFB +$53
DEFB +$42
DEFB +$43
DEFW +$0000
DEFW +$0000
DEFB +$00,$00, +$00, +$00
DEFB +$00
DEFB +$00
DEFB +$00
_next_tag:
DEFW +0x0000
DEFW +$0000

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

@ -56,12 +56,12 @@ _chscsi_init:
push af
dec sp
;source-doc/scsi-drv/scsi-init.c:11: do {
ld (ix-1),0x01
ld (ix-1),$01
l_chscsi_init_00103:
;source-doc/scsi-drv/scsi-init.c:12: usb_device_type t = usb_get_device_type(index);
ld a,(ix-1)
ld (ix-3),a
ld (ix-2),0x00
ld (ix-2),$00
pop hl
push hl
push hl
@ -69,26 +69,26 @@ l_chscsi_init_00103:
pop af
ld a, l
;source-doc/scsi-drv/scsi-init.c:14: if (t == USB_IS_MASS_STORAGE) {
sub 0x02
sub $02
jr NZ,l_chscsi_init_00104
;source-doc/scsi-drv/scsi-init.c:15: const uint8_t dev_index = find_storage_dev(); // index == -1 (no more left) should never happen
call _find_storage_dev
;source-doc/scsi-drv/scsi-init.c:17: hbios_usb_storage_devices[dev_index].drive_index = dev_index + 1;
;source-doc/scsi-drv/scsi-init.c:17: hbios_usbstore_devs[dev_index].drive_index = dev_index + 1;
ld a, l
ld c,0x00
ld c,$00
add a, a
rl c
add a, +((_hbios_usb_storage_devices) & 0xFF)
add a, +((_hbios_usbstore_devs) & $FF)
ld e, a
ld a, c
adc a, +((_hbios_usb_storage_devices) / 256)
adc a, +((_hbios_usbstore_devs) / 256)
ld d, a
ld c, e
ld b, d
ld a, l
inc a
ld (bc), a
;source-doc/scsi-drv/scsi-init.c:18: hbios_usb_storage_devices[dev_index].usb_device = index;
;source-doc/scsi-drv/scsi-init.c:18: hbios_usbstore_devs[dev_index].usb_device = index;
ld c, e
ld b, d
inc bc
@ -101,7 +101,7 @@ l_chscsi_init_00103:
call _print_string
;source-doc/scsi-drv/scsi-init.c:21: print_uint16(index);
ld l,(ix-3)
ld h,0x00
ld h,$00
call _print_uint16
;source-doc/scsi-drv/scsi-init.c:22: print_string(":$");
ld hl,scsi_init_str_1
@ -109,7 +109,7 @@ l_chscsi_init_00103:
pop de
pop hl
;source-doc/scsi-drv/scsi-init.c:23: print_uint16(dev_index);
ld h,0x00
ld h,$00
push de
call _print_uint16
;source-doc/scsi-drv/scsi-init.c:24: print_string(" $");
@ -117,32 +117,32 @@ l_chscsi_init_00103:
call _print_string
;source-doc/scsi-drv/scsi-init.c:25: usb_scsi_init(index);
ld l,(ix-3)
ld h,0x00
ld h,$00
push hl
call _usb_scsi_init
pop af
pop de
;source-doc/scsi-drv/scsi-init.c:26: dio_add_entry(ch_scsi_fntbl, &hbios_usb_storage_devices[dev_index]);
;source-doc/scsi-drv/scsi-init.c:26: dio_add_entry(ch_scsi_fntbl, &hbios_usbstore_devs[dev_index]);
ld hl,_ch_scsi_fntbl
call _dio_add_entry
l_chscsi_init_00104:
;source-doc/scsi-drv/scsi-init.c:29: } while (++index != MAX_NUMBER_OF_DEVICES + 1);
inc (ix-1)
ld a,(ix-1)
sub 0x07
sub $07
jr NZ,l_chscsi_init_00103
;source-doc/scsi-drv/scsi-init.c:30: }
ld sp, ix
pop ix
ret
scsi_init_str_0:
DEFB 0x0d
DEFB 0x0a
DEFB $0d
DEFB $0a
DEFM "USB: MASS STORAGE @ $"
DEFB 0x00
DEFB $00
scsi_init_str_1:
DEFM ":$"
DEFB 0x00
DEFB $00
scsi_init_str_2:
DEFM " $"
DEFB 0x00
DEFB $00

150
Source/HBIOS/ch376-native/scsi-drv/scsi_driver.c.s

@ -30,7 +30,7 @@
; .area _INITIALIZED removed by z88dk
_scsi_packet_read_capacity:
_scsi_pkt_read_cap:
DEFS 12
_cbw:
DEFS 27
@ -68,7 +68,7 @@ _usb_scsi_init:
call _critical_begin
pop de
;source-doc/scsi-drv/scsi_driver.c:17: while ((result = scsi_test(dev)) && --counter > 0)
ld c,0x03
ld c,$03
l_usb_scsi_init_00102:
push bc
push de
@ -120,30 +120,30 @@ _usb_scsi_read_capacity:
;source-doc/scsi-drv/scsi_driver.c:27: device_config_storage *const dev = (device_config_storage *)get_usb_device_config(dev_index);
ld a,(ix+4)
call _get_usb_device_config
;source-doc/scsi-drv/scsi_driver.c:30: cbw_scsi.cbw = scsi_command_block_wrapper;
;source-doc/scsi-drv/scsi_driver.c:30: cbw_scsi.cbw = scsi_cmd_blk_wrap;
push de
ld hl,2
add hl, sp
ex de, hl
ld bc,0x000f
ld hl,_scsi_command_block_wrapper
ld bc,$000f
ld hl,_scsi_cmd_blk_wrap
ldir
pop de
;source-doc/scsi-drv/scsi_driver.c:31: cbw_scsi.read_capacity = scsi_packet_read_capacity;
;source-doc/scsi-drv/scsi_driver.c:31: cbw_scsi.read_capacity = scsi_pkt_read_cap;
push de
ld hl,17
add hl, sp
ex de, hl
ld bc,0x000c
ld hl,_scsi_packet_read_capacity
ld bc,$000c
ld hl,_scsi_pkt_read_cap
ldir
pop de
;source-doc/scsi-drv/scsi_driver.c:33: cbw_scsi.cbw.bCBWLUN = 0;
ld (ix-14),0x00
ld (ix-14),$00
;source-doc/scsi-drv/scsi_driver.c:34: cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_read_capacity);
ld (ix-13),0x0c
ld (ix-13),$0c
;source-doc/scsi-drv/scsi_driver.c:35: cbw_scsi.cbw.dCBWDataTransferLength = sizeof(scsi_read_capacity_result);
ld (ix-19),0x08
ld (ix-19),$08
xor a
ld (ix-18),a
ld (ix-17),a
@ -186,40 +186,40 @@ _usb_scsi_read:
ld de,_cbw
ld l, e
ld h, d
ld b,0x0e
ld b,$0e
jr l_usb_scsi_read_00113
l_usb_scsi_read_00112:
ld (hl),0x00
ld (hl),$00
inc hl
l_usb_scsi_read_00113:
ld (hl),0x00
ld (hl),$00
inc hl
djnz l_usb_scsi_read_00112
;source-doc/scsi-drv/scsi_driver.c:64: cbw.cbw = scsi_command_block_wrapper;
ld bc,0x000f
ld hl,_scsi_command_block_wrapper
;source-doc/scsi-drv/scsi_driver.c:64: cbw.cbw = scsi_cmd_blk_wrap;
ld bc,$000f
ld hl,_scsi_cmd_blk_wrap
ldir
;source-doc/scsi-drv/scsi_driver.c:66: cbw.cbw.bCBWLUN = 0;
ld hl,_cbw + 13
ld (hl),0x00
ld (hl),$00
;source-doc/scsi-drv/scsi_driver.c:67: cbw.cbw.bCBWCBLength = sizeof(_scsi_packet_read_write);
ld hl,_cbw + 14
ld (hl),0x0c
ld (hl),$0c
;source-doc/scsi-drv/scsi_driver.c:68: cbw.cbw.dCBWDataTransferLength = 512;
ld hl,0x0200
ld hl,$0200
ld (_cbw + 8),hl
ld h, l
ld (_cbw + 8 + 2),hl
;source-doc/scsi-drv/scsi_driver.c:70: cbw.scsi_cmd.operation_code = 0x28; // read operation
;source-doc/scsi-drv/scsi_driver.c:70: cbw.scsi_cmd.operation_code = $28; // read operation
ld hl,_cbw + 15
ld (hl),0x28
ld (hl),$28
;source-doc/scsi-drv/scsi_driver.c:71: cbw.scsi_cmd.transfer_len[1] = 1;
ld hl,_cbw + 23
ld (hl),0x01
ld (hl),$01
;source-doc/scsi-drv/scsi_driver.c:72: cbw.scsi_cmd.lba[0] = dev->current_lba >> 24;
pop hl
push hl
ld de,0x000c
ld de,$000c
add hl, de
push hl
inc hl
@ -317,40 +317,40 @@ _usb_scsi_write:
ld de,_cbw
ld l, e
ld h, d
ld b,0x0e
ld b,$0e
jr l_usb_scsi_write_00113
l_usb_scsi_write_00112:
ld (hl),0x00
ld (hl),$00
inc hl
l_usb_scsi_write_00113:
ld (hl),0x00
ld (hl),$00
inc hl
djnz l_usb_scsi_write_00112
;source-doc/scsi-drv/scsi_driver.c:89: cbw.cbw = scsi_command_block_wrapper;
ld bc,0x000f
ld hl,_scsi_command_block_wrapper
;source-doc/scsi-drv/scsi_driver.c:89: cbw.cbw = scsi_cmd_blk_wrap;
ld bc,$000f
ld hl,_scsi_cmd_blk_wrap
ldir
;source-doc/scsi-drv/scsi_driver.c:91: cbw.cbw.bCBWLUN = 0;
ld hl,_cbw + 13
ld (hl),0x00
ld (hl),$00
;source-doc/scsi-drv/scsi_driver.c:92: cbw.cbw.bCBWCBLength = sizeof(_scsi_packet_read_write);
ld hl,_cbw + 14
ld (hl),0x0c
ld (hl),$0c
;source-doc/scsi-drv/scsi_driver.c:93: cbw.cbw.dCBWDataTransferLength = 512;
ld hl,0x0200
ld hl,$0200
ld (_cbw + 8),hl
ld h, l
ld (_cbw + 8 + 2),hl
;source-doc/scsi-drv/scsi_driver.c:95: cbw.scsi_cmd.operation_code = 0x2A; // write operation
;source-doc/scsi-drv/scsi_driver.c:95: cbw.scsi_cmd.operation_code = $2A; // write operation
ld hl,_cbw + 15
ld (hl),0x2a
ld (hl),$2a
;source-doc/scsi-drv/scsi_driver.c:96: cbw.scsi_cmd.transfer_len[1] = 1;
ld hl,_cbw + 23
ld (hl),0x01
ld (hl),$01
;source-doc/scsi-drv/scsi_driver.c:97: cbw.scsi_cmd.lba[0] = dev->current_lba >> 24;
pop hl
push hl
ld de,0x000c
ld de,$000c
add hl, de
push hl
inc hl
@ -380,7 +380,7 @@ l_usb_scsi_write_00113:
ld c,(ix+6)
ld b,(ix+7)
push hl
ld a,0x01
ld a,$01
push af
inc sp
push bc
@ -430,41 +430,41 @@ l_usb_scsi_write_00102:
ld sp, ix
pop ix
ret
_scsi_packet_read_capacity:
DEFB +0x25
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
_scsi_pkt_read_cap:
DEFB +$25
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
_cbw:
DEFB +0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB +0x00,0x00, +0x00, +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB 0x00
DEFB +0x00
DEFB 0x00
DEFB 0x00
DEFB +0x00
DEFB 0x00
DEFB 0x00
DEFB +$00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB +$00,$00, +$00, +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB $00
DEFB $00
DEFB $00
DEFB $00
DEFB +$00
DEFB $00
DEFB $00
DEFB +$00
DEFB $00
DEFB $00

14
Source/HBIOS/ch376-native/source-doc/base-drv/ch376.c

@ -19,13 +19,13 @@ void ch_command(const uint8_t command) __z88dk_fastcall {
CH376_COMMAND_PORT = command;
}
extern usb_error ch_wait_int_and_get_status(const int16_t timeout) __z88dk_fastcall;
extern usb_error ch_wait_and_get_status(const int16_t timeout) __z88dk_fastcall;
usb_error ch_long_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(5000); }
usb_error ch_long_get_status(void) { return ch_wait_and_get_status(5000); }
usb_error ch_short_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(100); }
usb_error ch_short_get_status(void) { return ch_wait_and_get_status(100); }
usb_error ch_very_short_wait_int_and_get_status(void) { return ch_wait_int_and_get_status(10); }
usb_error ch_very_short_status(void) { return ch_wait_and_get_status(10); }
usb_error ch_get_status(void) {
ch_command(CH_CMD_GET_STATUS);
@ -161,7 +161,7 @@ usb_error ch_data_in_transfer(uint8_t *buffer, int16_t buffer_size, endpoint_par
do {
ch_issue_token_in(endpoint);
result = ch_long_wait_int_and_get_status();
result = ch_long_get_status();
CHECK(result);
endpoint->toggle = !endpoint->toggle;
@ -194,7 +194,7 @@ usb_error ch_data_in_transfer_n(uint8_t *const buffer, uint8_t *const buffer_siz
ch_issue_token_in(endpoint);
CHECK(ch_long_wait_int_and_get_status());
CHECK(ch_long_get_status());
endpoint->toggle = !endpoint->toggle;
@ -223,7 +223,7 @@ usb_error ch_data_out_transfer(const uint8_t *buffer, int16_t buffer_length, end
buffer_length -= size;
ch_issue_token_out(endpoint);
CHECK(ch_long_wait_int_and_get_status());
CHECK(ch_long_get_status());
endpoint->toggle = !endpoint->toggle;
}

10
Source/HBIOS/ch376-native/source-doc/base-drv/ch376.h

@ -130,9 +130,9 @@ typedef struct {
typedef enum _ch376_pid { CH_PID_SETUP = DEF_USB_PID_SETUP, CH_PID_IN = DEF_USB_PID_IN, CH_PID_OUT = DEF_USB_PID_OUT } ch376_pid;
extern __sfr __banked CH376_DATA_PORT;
extern __sfr __banked CH376_COMMAND_PORT;
extern __sfr __banked CH376_COMMAND_PORT;
extern __sfr __banked USB_MODULE_LEDS;
extern __sfr __banked USB_MODULE_LEDS;
extern void delay_20ms(void);
extern void delay_short(void);
@ -140,9 +140,9 @@ extern void delay_medium(void);
extern void ch_command(const uint8_t command) __z88dk_fastcall;
extern usb_error ch_get_status(void);
extern usb_error ch_long_wait_int_and_get_status(void);
extern usb_error ch_short_wait_int_and_get_status(void);
extern usb_error ch_very_short_wait_int_and_get_status(void);
extern usb_error ch_long_get_status(void);
extern usb_error ch_short_get_status(void);
extern usb_error ch_very_short_status(void);
extern uint8_t ch_read_data(uint8_t *buffer) __sdcccall(1);
extern void ch_cmd_reset_all(void);
extern uint8_t ch_probe(void);

8
Source/HBIOS/ch376-native/source-doc/base-drv/dev_transfers.c

@ -39,7 +39,7 @@ usb_error usbdev_blk_out_trnsfer(device_config *const dev, const uint8_t *const
result = usb_data_out_transfer(buffer, buffer_size, dev->address, endpoint);
if (result == USB_ERR_STALL) {
usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size);
usbtrn_clr_ep_halt(endpoint->number, dev->address, dev->max_packet_size);
endpoint->toggle = 0;
return USB_ERR_STALL;
}
@ -58,7 +58,7 @@ usb_error usbdev_bulk_in_transfer(device_config *const dev, uint8_t *const buffe
result = usb_data_in_transfer_n(buffer, buffer_size, dev->address, endpoint);
if (result == USB_ERR_STALL) {
usbtrn_clear_endpoint_halt(endpoint->number, dev->address, dev->max_packet_size);
usbtrn_clr_ep_halt(endpoint->number, dev->address, dev->max_packet_size);
endpoint->toggle = 0;
return USB_ERR_STALL;
}
@ -79,7 +79,7 @@ usb_error usbdev_dat_in_trnsfer(device_config *const device,
result = usb_data_in_transfer(buffer, buffer_size, device->address, endpoint);
if (result == USB_ERR_STALL) {
usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size);
usbtrn_clr_ep_halt(endpoint->number, device->address, device->max_packet_size);
endpoint->toggle = 0;
return USB_ERR_STALL;
}
@ -97,7 +97,7 @@ usb_error usbdev_dat_in_trnsfer_0(device_config *const device, uint8_t *const bu
result = usb_data_in_transfer(buffer, buffer_size, device->address, endpoint);
if (result == USB_ERR_STALL) {
usbtrn_clear_endpoint_halt(endpoint->number, device->address, device->max_packet_size);
usbtrn_clr_ep_halt(endpoint->number, device->address, device->max_packet_size);
endpoint->toggle = 0;
return USB_ERR_STALL;
}

6
Source/HBIOS/ch376-native/source-doc/base-drv/enumerate.c

@ -116,10 +116,10 @@ configure_device(const _working *const working, const interface_descriptor *cons
dev_cfg->address = working->current_device_address;
dev_cfg->type = working->usb_device;
return usbtrn_set_configuration(dev_cfg->address, dev_cfg->max_packet_size, working->config.desc.bConfigurationvalue);
return usbtrn_set_config(dev_cfg->address, dev_cfg->max_packet_size, working->config.desc.bConfigurationvalue);
}
usb_error op_capture_hub_driver_interface(_working *const working) __sdcccall(1) {
usb_error op_cap_hub_drv_intf(_working *const working) __sdcccall(1) {
const interface_descriptor *const interface = (interface_descriptor *)working->ptr;
usb_error result;
@ -145,7 +145,7 @@ usb_error op_cap_drv_intf(_working *const working) __z88dk_fastcall {
switch (working->usb_device) {
case USB_IS_HUB: {
CHECK(op_capture_hub_driver_interface(working))
CHECK(op_cap_hub_drv_intf(working))
break;
}

4
Source/HBIOS/ch376-native/source-doc/base-drv/hbios-driver-storage.c

@ -1,10 +1,10 @@
#include "hbios-driver-storage.h"
hbios_storage_device_t hbios_usb_storage_devices[MAX_NUMBER_OF_DEVICES] = {{NULL}};
hbios_storage_device_t hbios_usbstore_devs[MAX_NUMBER_OF_DEVICES] = {{NULL}};
uint8_t find_storage_dev(void) {
for (uint8_t i = 0; i < MAX_NUMBER_OF_DEVICES; i++)
if (hbios_usb_storage_devices[i].drive_index == 0)
if (hbios_usbstore_devs[i].drive_index == 0)
return i;
return -1;

2
Source/HBIOS/ch376-native/source-doc/base-drv/hbios-driver-storage.h

@ -8,7 +8,7 @@ typedef struct _hbios_storage_device {
uint8_t usb_device;
} hbios_storage_device_t;
extern hbios_storage_device_t hbios_usb_storage_devices[MAX_NUMBER_OF_DEVICES];
extern hbios_storage_device_t hbios_usbstore_devs[MAX_NUMBER_OF_DEVICES];
uint8_t find_storage_dev(void);

38
Source/HBIOS/ch376-native/source-doc/base-drv/protocol.c

@ -18,7 +18,7 @@
#include "ez80-helpers.h"
#include "print.h"
const setup_packet cmd_get_device_descriptor = {0x80, 6, {0, 1}, {0, 0}, 8};
const setup_packet cmd_get_dev_descriptr = {0x80, 6, {0, 1}, {0, 0}, 8};
/**
* @brief Issue GET_DESCRIPTOR request to retrieve the device descriptor for usb device at address 0
@ -29,14 +29,14 @@ const setup_packet cmd_get_device_descriptor = {0x80, 6, {0, 1}, {0, 0}, 8};
usb_error usbtrn_get_descriptor(device_descriptor *const buffer) {
usb_error result;
setup_packet cmd;
cmd = cmd_get_device_descriptor;
cmd = cmd_get_dev_descriptr;
cmd.wLength = 8;
result = usb_control_transfer(&cmd, (uint8_t *)buffer, 0, 8);
CHECK(result);
cmd = cmd_get_device_descriptor;
cmd = cmd_get_dev_descriptr;
cmd.wLength = 18;
result = usb_control_transfer(&cmd, (uint8_t *)buffer, 0, buffer->bMaxPacketSize0);
@ -56,14 +56,14 @@ usb_error usbtrn_get_descriptor2(device_descriptor *const buffer, const uint8_t
usb_error result;
setup_packet cmd;
cmd = cmd_get_device_descriptor;
cmd = cmd_get_dev_descriptr;
cmd.wLength = 8;
result = usb_control_transfer(&cmd, (uint8_t *)buffer, device_address, 8);
CHECK(result);
cmd = cmd_get_device_descriptor;
cmd = cmd_get_dev_descriptr;
cmd.wLength = 18;
RETURN_CHECK(usb_control_transfer(&cmd, (uint8_t *)buffer, device_address, buffer->bMaxPacketSize0));
done:
@ -94,7 +94,7 @@ const setup_packet cmd_set_configuration = {0x00, 9, {0, 0}, {0, 0}, 0};
* @param config the device to be configured
* @return usb_error USB_ERR_OK if all good, otherwise specific error code
*/
usb_error usbtrn_set_configuration(const uint8_t device_address, const uint8_t max_packet_size, const uint8_t configuration) {
usb_error usbtrn_set_config(const uint8_t device_address, const uint8_t max_packet_size, const uint8_t configuration) {
setup_packet cmd;
cmd = cmd_set_configuration;
cmd.bValue[0] = configuration;
@ -102,7 +102,7 @@ usb_error usbtrn_set_configuration(const uint8_t device_address, const uint8_t m
return usb_control_transfer(&cmd, 0, device_address, max_packet_size);
}
const setup_packet cmd_get_config_descriptor = {0x80, 6, {0, 2}, {0, 0}, 0};
const setup_packet cmd_get_config_desc = {0x80, 6, {0, 2}, {0, 0}, 0};
/**
* @brief request the config descriptor for the specific config index of the specified device
@ -114,13 +114,13 @@ const setup_packet cmd_get_config_descriptor = {0x80, 6, {0, 2}, {0, 0}, 0};
* @param max_packet_size the max packet size for control transfers (endpoint 0)
* @return usb_error USB_ERR_OK if all good, otherwise specific error code
*/
usb_error usbtrn_get_config_descriptor(config_descriptor *const buffer,
const uint8_t config_index,
const uint8_t buffer_size,
const uint8_t device_address,
const uint8_t max_packet_size) {
usb_error usbtrn_get_config_desc(config_descriptor *const buffer,
const uint8_t config_index,
const uint8_t buffer_size,
const uint8_t device_address,
const uint8_t max_packet_size) {
setup_packet cmd;
cmd = cmd_get_config_descriptor;
cmd = cmd_get_config_desc;
cmd.bValue[0] = config_index;
cmd.wLength = (uint16_t)buffer_size;
@ -134,25 +134,25 @@ usb_error usbtrn_gfull_cfg_desc(const uint8_t config_index,
uint8_t *const buffer) {
usb_error result;
CHECK(usbtrn_get_config_descriptor((config_descriptor *)buffer, config_index, sizeof(config_descriptor), device_address,
max_packet_size));
CHECK(usbtrn_get_config_desc((config_descriptor *)buffer, config_index, sizeof(config_descriptor), device_address,
max_packet_size));
uint8_t max_length = ((config_descriptor *)buffer)->wTotalLength;
if (max_length > max_buffer_size)
max_length = max_buffer_size;
CHECK(usbtrn_get_config_descriptor((config_descriptor *)buffer, config_index, max_length, device_address, max_packet_size));
CHECK(usbtrn_get_config_desc((config_descriptor *)buffer, config_index, max_length, device_address, max_packet_size));
return USB_ERR_OK;
done:
return result;
}
const setup_packet usb_cmd_clear_endpoint_halt = {2, 1, {0, 0}, {255, 0}, 0}; // ;byte 4 is the endpoint to be cleared
const setup_packet usb_cmd_clr_ep_halt = {2, 1, {0, 0}, {255, 0}, 0}; // ;byte 4 is the endpoint to be cleared
usb_error usbtrn_clear_endpoint_halt(const uint8_t endpoint_number, const uint8_t device_address, const uint8_t max_packet_size) {
usb_error usbtrn_clr_ep_halt(const uint8_t endpoint_number, const uint8_t device_address, const uint8_t max_packet_size) {
setup_packet cmd;
cmd = usb_cmd_clear_endpoint_halt;
cmd = usb_cmd_clr_ep_halt;
cmd.bIndex[0] = endpoint_number;
return usb_control_transfer(&cmd, (uint8_t *)0, device_address, max_packet_size);

17
Source/HBIOS/ch376-native/source-doc/base-drv/protocol.h

@ -74,11 +74,11 @@ typedef struct _endpoint_descriptor {
extern usb_error usbtrn_get_descriptor(device_descriptor *const buffer);
extern usb_error usbtrn_get_descriptor2(device_descriptor *const buffer, const uint8_t device_address);
extern usb_error usbtrn_get_config_descriptor(config_descriptor *const buffer,
const uint8_t config_index,
const uint8_t buffer_size,
const uint8_t device_address,
const uint8_t max_packet_size);
extern usb_error usbtrn_get_config_desc(config_descriptor *const buffer,
const uint8_t config_index,
const uint8_t buffer_size,
const uint8_t device_address,
const uint8_t max_packet_size);
extern usb_error usbtrn_gfull_cfg_desc(const uint8_t config_index,
const uint8_t device_address,
@ -86,13 +86,10 @@ extern usb_error usbtrn_gfull_cfg_desc(const uint8_t config_index,
const uint8_t max_buffer_size,
uint8_t *const buffer);
extern usb_error usbtrn_set_configuration(const uint8_t device_address, const uint8_t max_packet_size, const uint8_t configuration);
extern usb_error usbtrn_set_config(const uint8_t device_address, const uint8_t max_packet_size, const uint8_t configuration);
extern usb_error usbtrn_set_address(const uint8_t device_address) __z88dk_fastcall;
extern usb_error
usbtrn_clear_endpoint_halt(const uint8_t endpoint_number, const uint8_t device_address, const uint8_t max_packet_size);
// extern usb_error usb_clear_endpoint_halt(device_config *const storage_device, const usb_endpoint_type endpoint_type);
extern usb_error usbtrn_clr_ep_halt(const uint8_t endpoint_number, const uint8_t device_address, const uint8_t max_packet_size);
#endif

6
Source/HBIOS/ch376-native/source-doc/base-drv/transfers.c

@ -46,7 +46,7 @@ usb_error usb_control_transfer(const setup_packet *const cmd_packet,
ch_write_data((const uint8_t *)cmd_packet, sizeof(setup_packet));
ch_issue_token_setup();
result = ch_short_wait_int_and_get_status();
result = ch_short_get_status();
CHECK(result);
const uint16_t length = cmd_packet->wLength;
@ -61,7 +61,7 @@ usb_error usb_control_transfer(const setup_packet *const cmd_packet,
ch_command(CH_CMD_WR_HOST_DATA);
CH376_DATA_PORT = 0;
ch_issue_token_out_ep0();
result = ch_long_wait_int_and_get_status(); /* sometimes we get STALL here - seems to be ok to ignore */
result = ch_long_get_status(); /* sometimes we get STALL here - seems to be ok to ignore */
if (result == USB_ERR_OK || result == USB_ERR_STALL) {
result = USB_ERR_OK;
@ -72,7 +72,7 @@ usb_error usb_control_transfer(const setup_packet *const cmd_packet,
}
ch_issue_token_in_ep0();
result = ch_long_wait_int_and_get_status();
result = ch_long_get_status();
RETURN_CHECK(result);

2
Source/HBIOS/ch376-native/source-doc/base-drv/usb-base-drv.c

@ -48,7 +48,7 @@ uint16_t usb_init(uint8_t state) __z88dk_fastcall {
if (state == 2) {
usb_host_bus_reset();
r = ch_very_short_wait_int_and_get_status();
r = ch_very_short_status();
if (r != USB_INT_CONNECT) {
USB_MODULE_LEDS = 0x00;

1
Source/HBIOS/ch376-native/source-doc/convert-for-uz80as.sh

@ -47,6 +47,7 @@ sed -E \
-e 's/;\t+/; /g' \
-e 's/defc\s+([a-zA-Z0-9_]+)\s*=\s*(0x[0-9A-Fa-f]+)/\1\t.EQU\t\2/' \
-e "s/___str_([0-9]+)/${prefix}_str_\1/g" \
-e 's/\b0x([0-9A-Fa-f]+)\b/\$\1/g' \
"$source_file" > "$destination_file"

12
Source/HBIOS/ch376-native/source-doc/scsi-drv/class_scsi.c

@ -4,7 +4,7 @@
#include <usb_state.h>
#include <z80.h>
_scsi_command_block_wrapper scsi_command_block_wrapper = {{0x55, 0x53, 0x42, 0x43}, {0, 0}, 0, 0, 0, 0};
_scsi_command_block_wrapper scsi_cmd_blk_wrap = {{0x55, 0x53, 0x42, 0x43}, {0, 0}, 0, 0, 0, 0};
uint16_t next_tag = 0;
@ -13,7 +13,7 @@ usb_error do_scsi_cmd(device_config_storage *const dev,
void *const send_receive_buffer,
const bool send) {
usb_error result;
usb_error result;
_scsi_command_status_wrapper csw = {{{0}}};
cbw->dCBWTag[0] = next_tag++;
@ -52,7 +52,7 @@ done:
usb_error scsi_test(device_config_storage *const dev) {
cbw_scsi_test cbw_scsi;
cbw_scsi.cbw = scsi_command_block_wrapper;
cbw_scsi.cbw = scsi_cmd_blk_wrap;
memset(&cbw_scsi.test, 0, sizeof(_scsi_packet_test));
cbw_scsi.cbw.bCBWLUN = 0;
@ -62,12 +62,12 @@ usb_error scsi_test(device_config_storage *const dev) {
return do_scsi_cmd(dev, &cbw_scsi.cbw, 0, false);
}
const _scsi_packet_request_sense scsi_packet_request_sense = {0x03, 0, 0, 0, 18, 0, {0, 0, 0, 0, 0, 0}};
const _scsi_packet_request_sense scsi_pckt_req_sense = {0x03, 0, 0, 0, 18, 0, {0, 0, 0, 0, 0, 0}};
usb_error scsi_request_sense(device_config_storage *const dev, scsi_sense_result *const sens_result) {
cbw_scsi_request_sense cbw_scsi;
cbw_scsi.cbw = scsi_command_block_wrapper;
cbw_scsi.request_sense = scsi_packet_request_sense;
cbw_scsi.cbw = scsi_cmd_blk_wrap;
cbw_scsi.request_sense = scsi_pckt_req_sense;
cbw_scsi.cbw.bCBWLUN = 0;
cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_packet_request_sense);

2
Source/HBIOS/ch376-native/source-doc/scsi-drv/class_scsi.h

@ -182,7 +182,7 @@ typedef struct {
_scsi_packet_read_write scsi_cmd;
} cbw_scsi_read_write;
extern _scsi_command_block_wrapper scsi_command_block_wrapper;
extern _scsi_command_block_wrapper scsi_cmd_blk_wrap;
extern usb_error do_scsi_cmd(device_config_storage *const dev,
_scsi_command_block_wrapper *const cbw,

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

@ -14,8 +14,8 @@ void chscsi_init(void) {
if (t == USB_IS_MASS_STORAGE) {
const uint8_t dev_index = find_storage_dev(); // index == -1 (no more left) should never happen
hbios_usb_storage_devices[dev_index].drive_index = dev_index + 1;
hbios_usb_storage_devices[dev_index].usb_device = index;
hbios_usbstore_devs[dev_index].drive_index = dev_index + 1;
hbios_usbstore_devs[dev_index].usb_device = index;
print_string("\r\nUSB: MASS STORAGE @ $");
print_uint16(index);
@ -23,7 +23,7 @@ void chscsi_init(void) {
print_uint16(dev_index);
print_string(" $");
usb_scsi_init(index);
dio_add_entry(ch_scsi_fntbl, &hbios_usb_storage_devices[dev_index]);
dio_add_entry(ch_scsi_fntbl, &hbios_usbstore_devs[dev_index]);
}
} while (++index != MAX_NUMBER_OF_DEVICES + 1);

14
Source/HBIOS/ch376-native/source-doc/scsi-drv/scsi_driver.c

@ -21,14 +21,14 @@ usb_error usb_scsi_init(const uint16_t dev_index) {
return result;
}
_scsi_read_capacity scsi_packet_read_capacity = {0x25, 0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0}};
_scsi_read_capacity scsi_pkt_read_cap = {0x25, 0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0}};
usb_error usb_scsi_read_capacity(const uint16_t dev_index, scsi_read_capacity_result *cap_result) {
device_config_storage *const dev = (device_config_storage *)get_usb_device_config(dev_index);
cbw_scsi_read_capacity cbw_scsi;
cbw_scsi.cbw = scsi_command_block_wrapper;
cbw_scsi.read_capacity = scsi_packet_read_capacity;
cbw_scsi.cbw = scsi_cmd_blk_wrap;
cbw_scsi.read_capacity = scsi_pkt_read_cap;
cbw_scsi.cbw.bCBWLUN = 0;
cbw_scsi.cbw.bCBWCBLength = sizeof(_scsi_read_capacity);
@ -43,7 +43,7 @@ usb_error usb_scsi_read_capacity(const uint16_t dev_index, scsi_read_capacity_re
// device_config_storage *const dev = (device_config_storage *)get_usb_device_config(dev_index);
// cbw_scsi_inquiry cbw_scsi;
// cbw_scsi.cbw = scsi_command_block_wrapper;
// cbw_scsi.cbw = scsi_cmd_blk_wrap;
// cbw_scsi.inquiry = scsi_packet_inquiry;
// cbw_scsi.cbw.bCBWLUN = 0;
@ -61,7 +61,7 @@ usb_error usb_scsi_read(const uint16_t dev_index, uint8_t *const buffer) {
device_config_storage *const dev = (device_config_storage *)get_usb_device_config(dev_index);
memset(&cbw, 0, sizeof(cbw_scsi_read_write));
cbw.cbw = scsi_command_block_wrapper;
cbw.cbw = scsi_cmd_blk_wrap;
cbw.cbw.bCBWLUN = 0;
cbw.cbw.bCBWCBLength = sizeof(_scsi_packet_read_write);
@ -86,7 +86,7 @@ usb_error usb_scsi_write(const uint16_t dev_index, uint8_t *const buffer) {
device_config_storage *const dev = (device_config_storage *)get_usb_device_config(dev_index);
memset(&cbw, 0, sizeof(cbw_scsi_read_write));
cbw.cbw = scsi_command_block_wrapper;
cbw.cbw = scsi_cmd_blk_wrap;
cbw.cbw.bCBWLUN = 0;
cbw.cbw.bCBWCBLength = sizeof(_scsi_packet_read_write);
@ -108,7 +108,7 @@ usb_error usb_scsi_write(const uint16_t dev_index, uint8_t *const buffer) {
// usb_error scsi_eject(device_config_storage *const dev) {
// cbw_scsi_eject cbw_scsi;
// cbw_scsi.cbw = scsi_command_block_wrapper;
// cbw_scsi.cbw = scsi_cmd_blk_wrap;
// memset(&cbw_scsi.eject, 0, sizeof(_scsi_packet_eject));

14
Source/HBIOS/ch376-native/source-doc/ufi-drv/class_ufi.c

@ -5,11 +5,11 @@
#include <string.h>
#include <z80.h>
const ufi_request_sense_command _ufi_cmd_request_sense = {0x03, 0, 0, 0, 18, {0, 0, 0, 0, 0, 0, 0}};
const ufi_read_format_capacities_command _ufi_cmd_read_format_capacities = {0x23, 0, {0, 0, 0, 0, 0}, {0, 12}, {0, 0, 0}};
const ufi_inquiry_command _ufi_cmd_inquiry = {0x12, 0, 0, 0, 0x24, {0, 0, 0, 0, 0, 0, 0}};
const ufi_format_command _ufi_cmd_format = {0x04, 7 | 1 << 4, 0, {0, 0}, {0, 0}, {0, 0}, {0, 0, 0}};
const ufi_send_diagnostic_command _ufi_cmd_send_diagnostic = {0x1D, 1 << 2, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
const ufi_request_sense_command _ufi_cmd_request_sense = {0x03, 0, 0, 0, 18, {0, 0, 0, 0, 0, 0, 0}};
const ufi_read_format_capacities_command _ufi_cmd_rd_fmt_caps = {0x23, 0, {0, 0, 0, 0, 0}, {0, 12}, {0, 0, 0}};
const ufi_inquiry_command _ufi_cmd_inquiry = {0x12, 0, 0, 0, 0x24, {0, 0, 0, 0, 0, 0, 0}};
const ufi_format_command _ufi_cmd_format = {0x04, 7 | 1 << 4, 0, {0, 0}, {0, 0}, {0, 0}, {0, 0, 0}};
const ufi_send_diagnostic_command _ufi_cmd_send_diag = {0x1D, 1 << 2, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
uint8_t wait_for_device_ready(device_config *const storage_device, uint8_t timeout_counter) {
usb_error result;
@ -62,7 +62,7 @@ usb_error ufi_read_frmt_caps(device_config *const storage_device, ufi_format_cap
usb_error result;
ufi_read_format_capacities_command ufi_cmd_read_format_capacities;
ufi_cmd_read_format_capacities = _ufi_cmd_read_format_capacities;
ufi_cmd_read_format_capacities = _ufi_cmd_rd_fmt_caps;
result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_read_format_capacities, false, 12, (uint8_t *)response, NULL);
TRACE_USB_ERROR(result);
@ -160,7 +160,7 @@ done:
usb_error ufi_send_diagnostics(device_config *const storage_device) {
ufi_send_diagnostic_command ufi_cmd_send_diagnostic;
ufi_cmd_send_diagnostic = _ufi_cmd_send_diagnostic;
ufi_cmd_send_diagnostic = _ufi_cmd_send_diag;
return usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_send_diagnostic, true, 0, NULL, NULL);
}

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

@ -14,15 +14,15 @@ void chufi_init(void) {
if (t == USB_IS_FLOPPY) {
const uint8_t dev_index = find_storage_dev(); // dev_index == -1 (no more left) should never happen
hbios_usb_storage_devices[dev_index].drive_index = dev_index + 1;
hbios_usb_storage_devices[dev_index].usb_device = index;
hbios_usbstore_devs[dev_index].drive_index = dev_index + 1;
hbios_usbstore_devs[dev_index].usb_device = index;
print_string("\r\nUSB: FLOPPY @ $");
print_uint16(index);
print_string(":$");
print_uint16(dev_index);
print_string(" $");
dio_add_entry(ch_ufi_fntbl, &hbios_usb_storage_devices[dev_index]);
dio_add_entry(ch_ufi_fntbl, &hbios_usbstore_devs[dev_index]);
}
} while (++index != MAX_NUMBER_OF_DEVICES + 1);

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

@ -62,7 +62,7 @@ l_wait_for_device_ready_00105:
;source-doc/ufi-drv/class_ufi.c:19: memset(&sense, 0, sizeof(sense));
ld hl,0
add hl, sp
ld b,0x09
ld b,$09
l_wait_for_device_ready_00132:
xor a
ld (hl), a
@ -88,7 +88,7 @@ l_wait_for_device_ready_00132:
or a
jr NZ,l_wait_for_device_ready_00104
ld a,(ix-16)
and 0x0f
and $0f
jr Z,l_wait_for_device_ready_00107
l_wait_for_device_ready_00104:
ld a, c
@ -104,7 +104,7 @@ l_wait_for_device_ready_00104:
l_wait_for_device_ready_00107:
;source-doc/ufi-drv/class_ufi.c:29: return result | (sense.sense_key & 15);
ld a,(ix-16)
and 0x0f
and $0f
or b
ld l, a
;source-doc/ufi-drv/class_ufi.c:30: }
@ -112,70 +112,70 @@ l_wait_for_device_ready_00107:
pop ix
ret
__ufi_cmd_request_sense:
DEFB +0x03
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x12
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
__ufi_cmd_read_format_capacitie:
DEFB +0x23
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x0c
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +$03
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$12
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
__ufi_cmd_rd_fmt_caps:
DEFB +$23
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$0c
DEFB +$00
DEFB +$00
DEFB +$00
__ufi_cmd_inquiry:
DEFB +0x12
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x24
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +$12
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$24
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
__ufi_cmd_format:
DEFB +0x04
DEFB +0x17
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
__ufi_cmd_send_diagnostic:
DEFB +0x1d
DEFB +0x04
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +$04
DEFB +$17
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
__ufi_cmd_send_diag:
DEFB +$1d
DEFB +$04
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$00
;source-doc/ufi-drv/class_ufi.c:32: usb_error ufi_test_unit_ready(device_config *const storage_device, ufi_request_sense_response const *response) {
; ---------------------------------
; Function ufi_test_unit_ready
@ -190,7 +190,7 @@ _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));
ld hl,0
add hl, sp
ld b,0x06
ld b,$06
l_ufi_test_unit_ready_00104:
xor a
ld (hl), a
@ -199,7 +199,7 @@ l_ufi_test_unit_ready_00104:
inc hl
djnz l_ufi_test_unit_ready_00104
;source-doc/ufi-drv/class_ufi.c:37: usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_request_test_unit_ready, false, 0, NULL, NULL);
ld hl,0x0000
ld hl,$0000
push hl
push hl
push hl
@ -220,17 +220,17 @@ l_ufi_test_unit_ready_00104:
ld hl,12
add hl, sp
ex de, hl
ld bc,0x000c
ld bc,$000c
ld hl,__ufi_cmd_request_sense
ldir
;source-doc/ufi-drv/class_ufi.c:43: (uint8_t *)response, NULL);
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),
ld hl,0x0000
ld hl,$0000
push hl
push bc
ld l,0x12
ld l,$12
push hl
xor a
push af
@ -262,16 +262,16 @@ _ufi_request_sense:
ld hl,0
add hl, sp
ex de, hl
ld bc,0x000c
ld bc,$000c
ld hl,__ufi_cmd_request_sense
ldir
;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 c,(ix+6)
ld b,(ix+7)
ld hl,0x0000
ld hl,$0000
push hl
push bc
ld l,0x12
ld l,$12
push hl
xor a
push af
@ -299,21 +299,21 @@ _ufi_read_frmt_caps:
ld hl, -24
add hl, sp
ld sp, hl
;source-doc/ufi-drv/class_ufi.c:65: ufi_cmd_read_format_capacities = _ufi_cmd_read_format_capacities;
;source-doc/ufi-drv/class_ufi.c:65: ufi_cmd_read_format_capacities = _ufi_cmd_rd_fmt_caps;
ld hl,0
add hl, sp
ex de, hl
ld bc,0x000c
ld hl,__ufi_cmd_read_format_capacitie
ld bc,$000c
ld hl,__ufi_cmd_rd_fmt_caps
ldir
;source-doc/ufi-drv/class_ufi.c:66: result = usb_execute_cbi(storage_device, (uint8_t *)&ufi_cmd_read_format_capacities, false, 12, (uint8_t *)response, NULL);
ld c,(ix+6)
ld b,(ix+7)
push bc
ld hl,0x0000
ld hl,$0000
push hl
push bc
ld l,0x0c
ld l,$0c
push hl
xor a
push af
@ -345,9 +345,9 @@ _ufi_read_frmt_caps:
inc hl
ld a, (hl)
;source-doc/ufi-drv/class_ufi.c:73: const uint8_t max_length =
cp 0x25
cp $25
jr C,l_ufi_read_frmt_caps_00106
ld e,0x24
ld e,$24
jr l_ufi_read_frmt_caps_00107
l_ufi_read_frmt_caps_00106:
ld e, a
@ -360,14 +360,14 @@ l_ufi_read_frmt_caps_00107:
ex de, hl
ld hl,4
add hl, sp
ld bc,0x000c
ld bc,$000c
ldir
pop bc
pop de
;source-doc/ufi-drv/class_ufi.c:78: cmd.allocation_length[1] = max_length;
ld (ix-4),e
;source-doc/ufi-drv/class_ufi.c:80: result = usb_execute_cbi(storage_device, (uint8_t *)&cmd, false, max_length, (uint8_t *)response, NULL);
ld hl,0x0000
ld hl,$0000
ld d,l
push hl
push bc
@ -410,16 +410,16 @@ _ufi_inquiry:
ld hl,0
add hl, sp
ex de, hl
ld bc,0x000c
ld bc,$000c
ld hl,__ufi_cmd_inquiry
ldir
;source-doc/ufi-drv/class_ufi.c:92: usb_error result =
ld c,(ix+6)
ld b,(ix+7)
ld hl,0x0000
ld hl,$0000
push hl
push bc
ld l,0x24
ld l,$24
push hl
xor a
push af
@ -450,7 +450,7 @@ _ufi_read_write_sector:
;source-doc/ufi-drv/class_ufi.c:107: memset(&cmd, 0, sizeof(cmd));
ld hl,0
add hl, sp
ld b,0x06
ld b,$06
l_ufi_read_write_sector_00113:
xor a
ld (hl), a
@ -458,19 +458,19 @@ l_ufi_read_write_sector_00113:
ld (hl), a
inc hl
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 ? $2A : $28;
bit 0,(ix+6)
jr Z,l_ufi_read_write_sector_00104
ld a,0x2a
ld a,$2a
jr l_ufi_read_write_sector_00105
l_ufi_read_write_sector_00104:
ld a,0x28
ld a,$28
l_ufi_read_write_sector_00105:
ld (ix-12),a
;source-doc/ufi-drv/class_ufi.c:109: cmd.lba[2] = sector_number >> 8;
ld a,(ix+8)
ld (ix-8),a
;source-doc/ufi-drv/class_ufi.c:110: cmd.lba[3] = sector_number & 0xFF;
;source-doc/ufi-drv/class_ufi.c:110: cmd.lba[3] = sector_number & $FF;
ld a,(ix+7)
ld (ix-7),a
;source-doc/ufi-drv/class_ufi.c:111: cmd.transfer_length[1] = sector_count;
@ -479,7 +479,7 @@ l_ufi_read_write_sector_00105:
ld (ix-4),a
add a, a
ld b, a
ld c,0x00
ld c,$00
ld l,(ix+12)
ld h,(ix+13)
push hl
@ -516,7 +516,7 @@ _ufi_format:
;source-doc/ufi-drv/class_ufi.c:130: const ufi_format_capacity_descriptor *const format) {
ld hl,2
add hl, sp
ld b,0x06
ld b,$06
l_ufi_format_00104:
xor a
ld (hl), a
@ -528,33 +528,33 @@ l_ufi_format_00104:
ld hl,14
add hl, sp
ex de, hl
ld bc,0x000c
ld bc,$000c
ld hl,__ufi_cmd_format
ldir
;source-doc/ufi-drv/class_ufi.c:136: ufi_format_command cmd;
ld a,(ix+7)
ld (ix-10),a
;source-doc/ufi-drv/class_ufi.c:137: cmd = _ufi_cmd_format;
ld (ix-8),0x00
ld (ix-8),$00
;source-doc/ufi-drv/class_ufi.c:138: // memcpy(&cmd, &_ufi_cmd_format, sizeof(cmd));
ld (ix-4),0x0c
ld (ix-4),$0c
;source-doc/ufi-drv/class_ufi.c:140: cmd.track_number = track_number;
;source-doc/ufi-drv/class_ufi.c:141: cmd.interleave[1] = 0;
ld a,(ix+6)
and 0x01
or 0xb0
and $01
or $b0
ld (ix-23),a
;source-doc/ufi-drv/class_ufi.c:142: cmd.parameter_list_length[1] = sizeof(parameter_list);
ld (ix-22),0x00
ld (ix-22),$00
;source-doc/ufi-drv/class_ufi.c:143:
ld (ix-21),0x08
ld (ix-21),$08
;source-doc/ufi-drv/class_ufi.c:144: parameter_list.defect_list_header.status =
ld hl,6
add hl, sp
ex de, hl
ld l,(ix+8)
ld h,(ix+9)
ld bc,0x0008
ld bc,$0008
ldir
;source-doc/ufi-drv/class_ufi.c:146: parameter_list.defect_list_header.defect_list_length_msb = 0;
ld hl,0
@ -563,9 +563,9 @@ l_ufi_format_00104:
ld hl,4
add hl, sp
push hl
ld hl,0x000c
ld hl,$000c
push hl
ld a,0x01
ld a,$01
push af
inc sp
ld hl,21
@ -595,15 +595,15 @@ _ufi_send_diagnostics:
ld hl,0
add hl, sp
ex de, hl
ld bc,0x000c
ld hl,__ufi_cmd_send_diagnostic
ld bc,$000c
ld hl,__ufi_cmd_send_diag
ldir
;source-doc/ufi-drv/class_ufi.c:161: ufi_send_diagnostic_command ufi_cmd_send_diagnostic;
ld hl,0x0000
ld hl,$0000
push hl
push hl
push hl
ld a,0x01
ld a,$01
push af
inc sp
ld hl,7

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

@ -55,11 +55,11 @@ _chufi_init:
add ix,sp
push af
;source-doc/ufi-drv/ufi-init.c:11: do {
ld (ix-1),0x01
ld (ix-1),$01
l_chufi_init_00103:
;source-doc/ufi-drv/ufi-init.c:12: usb_device_type t = usb_get_device_type(index);
ld e,(ix-1)
ld d,0x00
ld d,$00
push de
push de
call _usb_get_device_type
@ -73,16 +73,16 @@ l_chufi_init_00103:
call _find_storage_dev
ld (ix-2),l
pop de
;source-doc/ufi-drv/ufi-init.c:17: hbios_usb_storage_devices[dev_index].drive_index = dev_index + 1;
;source-doc/ufi-drv/ufi-init.c:17: hbios_usbstore_devs[dev_index].drive_index = dev_index + 1;
ld l,(ix-2)
ld h,0x00
ld h,$00
add hl, hl
ld bc,_hbios_usb_storage_devices
ld bc,_hbios_usbstore_devs
add hl, bc
ld a,(ix-2)
inc a
ld (hl),a
;source-doc/ufi-drv/ufi-init.c:18: hbios_usb_storage_devices[dev_index].usb_device = index;
;source-doc/ufi-drv/ufi-init.c:18: hbios_usbstore_devs[dev_index].usb_device = index;
inc hl
ld a,(ix-1)
ld (hl),a
@ -104,7 +104,7 @@ l_chufi_init_00103:
pop hl
;source-doc/ufi-drv/ufi-init.c:23: print_uint16(dev_index);
ld e,(ix-2)
ld d,0x00
ld d,$00
push hl
ex de, hl
call _print_uint16
@ -112,7 +112,7 @@ l_chufi_init_00103:
ld hl,ufi_init_str_2
call _print_string
pop hl
;source-doc/ufi-drv/ufi-init.c:25: dio_add_entry(ch_ufi_fntbl, &hbios_usb_storage_devices[dev_index]);
;source-doc/ufi-drv/ufi-init.c:25: dio_add_entry(ch_ufi_fntbl, &hbios_usbstore_devs[dev_index]);
ex de, hl
ld hl,_ch_ufi_fntbl
call _dio_add_entry
@ -120,20 +120,20 @@ l_chufi_init_00104:
;source-doc/ufi-drv/ufi-init.c:28: } while (++index != MAX_NUMBER_OF_DEVICES + 1);
inc (ix-1)
ld a,(ix-1)
sub 0x07
sub $07
jr NZ,l_chufi_init_00103
;source-doc/ufi-drv/ufi-init.c:29: }
ld sp, ix
pop ix
ret
ufi_init_str_0:
DEFB 0x0d
DEFB 0x0a
DEFB $0d
DEFB $0a
DEFM "USB: FLOPPY @ $"
DEFB 0x00
DEFB $00
ufi_init_str_1:
DEFM ":$"
DEFB 0x00
DEFB $00
ufi_init_str_2:
DEFM " $"
DEFB 0x00
DEFB $00

46
Source/HBIOS/ch376-native/ufi-drv/ufi_driver.c.s

@ -62,7 +62,7 @@ _usb_ufi_get_cap:
;source-doc/ufi-drv/ufi_driver.c:10: memset(&response, 0, sizeof(ufi_format_capacities_response));
ld hl,0
add hl, sp
ld b,0x12
ld b,$12
l_usb_ufi_get_cap_00112:
xor a
ld (hl), a
@ -72,7 +72,7 @@ l_usb_ufi_get_cap_00112:
djnz l_usb_ufi_get_cap_00112
;source-doc/ufi-drv/ufi_driver.c:12: wait_for_device_ready(dev, 25);
push de
ld a,0x19
ld a,$19
push af
inc sp
push de
@ -92,7 +92,7 @@ l_usb_ufi_get_cap_00112:
pop de
;source-doc/ufi-drv/ufi_driver.c:18: wait_for_device_ready(dev, 15);
push de
ld a,0x0f
ld a,$0f
push af
inc sp
push de
@ -113,7 +113,7 @@ l_usb_ufi_get_cap_00112:
or a
jr Z,l_usb_ufi_get_cap_00102
;source-doc/ufi-drv/ufi_driver.c:22: return 0;
ld hl,0x0000
ld hl,$0000
ld e, l
ld d, l
jr l_usb_ufi_get_cap_00103
@ -148,7 +148,7 @@ _usb_ufi_read:
ld c,e
ld b,d
push de
ld a,0x14
ld a,$14
push af
inc sp
push bc
@ -161,7 +161,7 @@ _usb_ufi_read:
or a
jr Z,l_usb_ufi_read_00102
;source-doc/ufi-drv/ufi_driver.c:31: return -1; // Not READY!
ld l,0xff
ld l,$ff
jr l_usb_ufi_read_00109
l_usb_ufi_read_00102:
;source-doc/ufi-drv/ufi_driver.c:36: memset(&sense_codes, 0, sizeof(sense_codes));
@ -184,7 +184,7 @@ l_usb_ufi_read_00102:
ld l,(ix+6)
ld h,(ix+7)
push hl
ld a,0x01
ld a,$01
push af
inc sp
push de
@ -203,14 +203,14 @@ l_usb_ufi_read_00102:
or a
jr Z,l_usb_ufi_read_00104
;source-doc/ufi-drv/ufi_driver.c:39: return -1; // general error
ld l,0xff
ld l,$ff
jr l_usb_ufi_read_00109
l_usb_ufi_read_00104:
;source-doc/ufi-drv/ufi_driver.c:42: memset(&response, 0, sizeof(response));
push bc
ld hl,4
add hl, sp
ld b,0x09
ld b,$09
l_usb_ufi_read_00139:
xor a
ld (hl), a
@ -231,20 +231,20 @@ l_usb_ufi_read_00139:
or a
jr Z,l_usb_ufi_read_00106
;source-doc/ufi-drv/ufi_driver.c:45: return -1; // error
ld l,0xff
ld l,$ff
jr l_usb_ufi_read_00109
l_usb_ufi_read_00106:
;source-doc/ufi-drv/ufi_driver.c:49: const uint8_t sense_key = response.sense_key & 15;
ld a,(ix-16)
and 0x0f
and $0f
jr Z,l_usb_ufi_read_00108
;source-doc/ufi-drv/ufi_driver.c:51: if (sense_key != 0)
;source-doc/ufi-drv/ufi_driver.c:52: return -1;
ld l,0xff
ld l,$ff
jr l_usb_ufi_read_00109
l_usb_ufi_read_00108:
;source-doc/ufi-drv/ufi_driver.c:54: return USB_ERR_OK;
ld l,0x00
ld l,$00
l_usb_ufi_read_00109:
;source-doc/ufi-drv/ufi_driver.c:55: }
ld sp, ix
@ -269,7 +269,7 @@ _usb_ufi_write:
ld c,e
ld b,d
push de
ld a,0x14
ld a,$14
push af
inc sp
push bc
@ -282,7 +282,7 @@ _usb_ufi_write:
or a
jr Z,l_usb_ufi_write_00102
;source-doc/ufi-drv/ufi_driver.c:61: return -1; // Not READY!
ld l,0xff
ld l,$ff
jr l_usb_ufi_write_00109
l_usb_ufi_write_00102:
;source-doc/ufi-drv/ufi_driver.c:65: memset(&sense_codes, 0, sizeof(sense_codes));
@ -305,11 +305,11 @@ l_usb_ufi_write_00102:
ld l,(ix+6)
ld h,(ix+7)
push hl
ld a,0x01
ld a,$01
push af
inc sp
push de
ld a,0x01
ld a,$01
push af
inc sp
push bc
@ -324,14 +324,14 @@ l_usb_ufi_write_00102:
or a
jr Z,l_usb_ufi_write_00104
;source-doc/ufi-drv/ufi_driver.c:67: return -1;
ld l,0xff
ld l,$ff
jr l_usb_ufi_write_00109
l_usb_ufi_write_00104:
;source-doc/ufi-drv/ufi_driver.c:71: memset(&response, 0, sizeof(response));
push bc
ld hl,4
add hl, sp
ld b,0x09
ld b,$09
l_usb_ufi_write_00139:
xor a
ld (hl), a
@ -352,20 +352,20 @@ l_usb_ufi_write_00139:
or a
jr Z,l_usb_ufi_write_00106
;source-doc/ufi-drv/ufi_driver.c:74: return -1;
ld l,0xff
ld l,$ff
jr l_usb_ufi_write_00109
l_usb_ufi_write_00106:
;source-doc/ufi-drv/ufi_driver.c:79: const uint8_t sense_key = response.sense_key & 15;
ld a,(ix-16)
and 0x0f
and $0f
jr Z,l_usb_ufi_write_00108
;source-doc/ufi-drv/ufi_driver.c:81: if (sense_key != 0)
;source-doc/ufi-drv/ufi_driver.c:82: return -1;
ld l,0xff
ld l,$ff
jr l_usb_ufi_write_00109
l_usb_ufi_write_00108:
;source-doc/ufi-drv/ufi_driver.c:84: return USB_ERR_OK;
ld l,0x00
ld l,$00
l_usb_ufi_write_00109:
;source-doc/ufi-drv/ufi_driver.c:85: }
ld sp, ix

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

@ -72,7 +72,7 @@ _usb_execute_cbi:
ld hl,4
add hl, sp
ex de, hl
ld bc,0x0008
ld bc,$0008
ld hl,_cbi2_adsc
ldir
pop bc
@ -97,17 +97,17 @@ _usb_execute_cbi:
pop af
;source-doc/ufi-drv/usb_cbi.c:27: if (result == USB_ERR_STALL) {
ld a, l
sub 0x02
sub $02
jr NZ,l_usb_execute_cbi_00104
;source-doc/ufi-drv/usb_cbi.c:28: if (sense_codes != NULL)
ld a,(ix+14)
or (ix+13)
jr Z,l_usb_execute_cbi_00102
;source-doc/ufi-drv/usb_cbi.c:29: usbdev_dat_in_trnsfer(storage_device, sense_codes, 2, ENDPOINT_INTERRUPT_IN);
ld a,0x02
ld a,$02
push af
inc sp
ld hl,0x0002
ld hl,$0002
push hl
ld l,(ix+13)
ld h,(ix+14)
@ -121,7 +121,7 @@ _usb_execute_cbi:
ld sp, hl
l_usb_execute_cbi_00102:
;source-doc/ufi-drv/usb_cbi.c:31: result = USB_ERR_STALL;
ld l,0x02
ld l,$02
;source-doc/ufi-drv/usb_cbi.c:32: goto done;
jr l_usb_execute_cbi_00116
l_usb_execute_cbi_00104:
@ -154,7 +154,7 @@ l_usb_execute_cbi_00104:
jr l_usb_execute_cbi_00116
l_usb_execute_cbi_00112:
;source-doc/ufi-drv/usb_cbi.c:48: result = usbdev_dat_in_trnsfer(storage_device, buffer, buffer_size, ENDPOINT_BULK_IN);
ld a,0x01
ld a,$01
push af
inc sp
ld l,(ix+9)
@ -182,10 +182,10 @@ l_usb_execute_cbi_00113:
or (ix+13)
jr Z,l_usb_execute_cbi_00116
;source-doc/ufi-drv/usb_cbi.c:57: result = usbdev_dat_in_trnsfer(storage_device, sense_codes, 2, ENDPOINT_INTERRUPT_IN);
ld a,0x02
ld a,$02
push af
inc sp
ld hl,0x0002
ld hl,$0002
push hl
ld l,(ix+13)
ld h,(ix+14)
@ -210,10 +210,10 @@ l_usb_execute_cbi_00116:
pop ix
ret
_cbi2_adsc:
DEFB +0x21
DEFB +0x00
DEFB +0x00
DEFB +0x00
DEFB +0xff
DEFB +0x00
DEFW +0x000c
DEFB +$21
DEFB +$00
DEFB +$00
DEFB +$00
DEFB +$ff
DEFB +$00
DEFW +$000c

Loading…
Cancel
Save