Browse Source

ch376-native: UKY_STAT extended to also return current USB key report

pull/592/head
Dean Netherton 10 months ago
parent
commit
7e9c08993d
  1. 37
      Source/HBIOS/ch376kyb.asm

37
Source/HBIOS/ch376kyb.asm

@ -84,6 +84,8 @@ VEC_CHUKB_TICK:
;
; Outputs:
; A: Status / Codes Pending
; A': Current Modifier Key State
; B, C, D, E, H, L: Up to 6 active key codes
;
; Return a count of the number of key Codes Pending (A) in the keyboard buffer.
; If it is not possible to determine the actual number in the buffer, it is
@ -94,13 +96,34 @@ VEC_CHUKB_TICK:
; (error) code. Otherwise, the return value represents the number of key codes
; pending.
;
; USB Extension
; Returns the most current USB Key Report
; (See https://wiki.osdev.org/USB_Human_Interface_Devices).
; The report indicates the current keyboard state, irrespective of the
; character queue.
; The A' register contains the current modifier key state
; The B, C, D, E, H, L contain the 0 to 6 USB scancodes.
;
UKY_STAT:
JP _keyboard_buf_size
HB_DI
call _keyboard_buf_size
HB_EI
ld iy, _report
ex af, af'
ld a, (iy)
ex af, af'
ld b, (iy+2)
ld c, (iy+3)
ld d, (iy+4)
ld e, (iy+5)
ld h, (iy+6)
ld l, (iy+7)
ret
; ### Function 0x4D -- Video Keyboard Flush (VDAKFL)
;
; Inputs:
; C: Video Unit
; None
;
; Outputs:
; A: standard HBIOS result code
@ -108,7 +131,9 @@ UKY_STAT:
; Purged and all contents discarded. The Status (A) is a standard HBIOS result code.
;
UKY_FLUSH:
HB_DI
CALL _keyboard_buf_flush
HB_EI
XOR A
RET
;
@ -124,16 +149,16 @@ UKY_FLUSH:
; E: Keycode
;
; Read the next key data from the keyboard. If a buffer is used, return the next key code in the buffer.
; If no key data is available, this function will wait indefinitely for a keypress. The Status (A) is a
; If no key data is available, this function will wait indefinitely for a key press. The Status (A) is a
; standard HBIOS result code.
;
; The Scancode (C) value is the raw scancode from the keyboard for the keypress. Scancodes are from
; the PS/2 scancode set 2 standard.
; The Scancode (C) value is the raw scan code from the keyboard for the key press. Scan codes are standard
; usb scan codes
;
; The Keystate (D) is a bitmap representing the value of all modifier keys and shift states as they
; existed at the time of the keystroke. The bitmap is defined as:
;
; Bit Keystate Indication
; Bit Key state Indication
; 7 Key pressed was from the num pad
; 6 Caps Lock was active
; 5 Num Lock was active

Loading…
Cancel
Save