Bird Computer - Virtual Keycodes

2004 Bird Computer


This document describes the Bird Computer Virtual Keycode system. The virtual keycode system's purpose is to support keyboard and other input devices. It is desirable to use Unicode characters to represent the incoming character stream from the keyboard or other device, however Unicode was not really meant for that purpose; it's not a sufficient code to support keyboard input, and is meant more as an enabler for document storage and display. Supporting keyboard input is really outside of the intent of Unicode.

While Unicode does support almost every character imaginable, programs need more than just raw characters from a keyboard; programs also need things like cursor, edit controls, shift and pause indicators. When dealing with a keyboard there is also a need to be able to tell when a key is pressed and when it is released. This is useful for instance in marking text for a block copy operation by holding the shift key down while moving the cursor keys.

Unfortunately Unicode contains more than 65536 characters (or more characters than will fit into a sixteen bit value.) While in theory there is no limit to the number of characters that Unicode can support it is probably practically limited. Currently it can be represented by an 18 bit value. This system allows 24 bits just in case. This virtual keycode definition uses 32 bit keycodes. Some of the bits in the definition are not used. The most significant bit is used to indicate whether the key is being pressed or released. The low order 24 bits of the keycode are directly mapped to the Unicode standard character. The next couple of bits are used to select between a normal Unicode character and the Bird Computer extended keycodes. The remaining bits are unused.

Virtual Keycode Format:

31 30          26 25   24 23                               0
u/d - sel Unicode Character

u/d -  0 = key pressed down, 1 = key released

sel - 0 = Unicode character, 1 = extended input character, 2,3 = unused

Extended Keycodes


Edit controls group

  01 cursor up
  02 cursor right
  03 cursor down
  04 cursor left
  05 home
  06 end
  07 page up
  08 page down
  09 insert
  0A delete
  0B backspace
  0D carriage return
Function Keys
  11 F1 / Help
  12 F2
  13 F3
  14 F4
  15 F5
  16 F6
  17 F7
  18 F8
  19 F9
  1A F10
  1B F11
  1C F12
Mouse Controls
  21 left button
  22 middle button
  23 right button
  31 shift
  32 control
  33 alt
  34 caps lock
  38 print screen
  39 scroll lock
  3A pause