83Plus:Software:usb8x/BASIC Interface/KBDGetKey

From WikiTI
Revision as of 17:28, 27 January 2007 by Dr. D'nar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Name: KBDGetKey

Function Number: 11

Minimum usb8x version: 0.something

Gets keypress information from the USB KBD driver.




Each value in the list is the decimal value of the contents of the registers {A,B,C,D,E,H,L}.

  • 1: Number of keys remaining in keyboard buffer
  • 2: Raw key press modifiers
  • 3: Raw key press keycode
  • 4: Converted TIOS keyextend code
  • 5: Converted TIOS _GetKey code (NOT the same as the BASIC getkey codes. . . pester someone to add a conversion)
  • 6: nonsense
  • 7: nonsense (mostly--whatever Dan left in H&L)


It'd be nice to get a normal BASIC getKey-style return code. Perhaps the KBD driver wrapper could overwrite H (element 6, which is usually zero anyway) with that before returing.

The raw key-press modifiers byte looks like this:

Bit  7  6  5  4  | 3  2  1  0
key  Su Al Sh Cn | Su Al Sh Cn
side    Right    |    left
Su=Super; Al=Alt; Sh=Shift; Cn=Control

Here's a loop to convert a byte into a list:

If X-B^2>0

Then, to access bit 2 you would look at element 3 and so on. Note that if you Disp the list, it will show the bits in reverse order.

See Also

  • [[../KBDInit|KBDInit]] - Initialize the keyboard driver.