Hardware manual

3.4.3. Keyboard Streams
There is a single keyboard stream in which characters are buffered. The stream is always open, and may be
accessed through the system scalar "keys." The only non-null operations are Gets; Endofs, which is true if
no characters are waiting; and Resets, which clears the input buffer.
The keyboard handler periodically copies the mouse coordinates into the cursor coordinates, truncating at
the screen boundary. This function is governed by the value of a cell referenced by @ lvCursorLink; if it is
zero, the function is disabled.
Low-level keyboard functions. Although the standard keyboard handler contains no facilities for detecting
transitions of keyset or mouse keys, a user function may be provided that will be called 60 times a second
and can extract relevant information from a table passed to it. The call SetKeyboardProc(uKbProc, stack,
stackLength) will install uKbProc as the user procedure; stack is a vector that will be used for stack space
when uKbProc is run (you must provide enough!). SetKeyboardProc() will reset the keyboard handler,
and cease calling uKbProc. (Note: If the program has used the Junta procedure, the user keyboard
procedure must be deactivated during a CounterJunta or finish unless all its state lies below
OsFinishSafeAdr.) If active, every 16 milliseconds, the keyboard handler will execute uKbProc(tab), where
tab points to a data structure defined by the KBTRANS structure (see the file SysDefs.d). The Transition
word is non-zero if a key transition has been detected; GoingUp or GoingDown tell which sort of
transition has occurred; and KeyIndex gives the key number. KeyState is a 5-word table giving the state of
the keys
after the transition has occurred: if a key with KeyIndex=i is presently down, bit (i rem 16) of
word (i div 16) will be 1. The entries CursorX and CursorY give the current location of the cursor.
The value returned by uKbProc determines subsequent processing. If true is returned, the operating
system treats the key transition (if any) according to normal conventions. If false is returned, the operating
system assumes that uKbProc has performed whatever processing is intended, and the interrupt is simply
dismissed.
KeyIndex values are tabulated below. Keys are normally given by their lower-case marking on the key
top; those with more than one character on their tops are specified by <name>. <X> are unused bits;
<blank-top> is the key to the right of the <bs> key; <blank-middle> to the right of <return>; and <blank-
bottom> to the right of <shift-right>.
Values Keys
0-15 5 4 6 e 7 d u v 0 k - p / \ <lf> <bs>
16-31 3 2 w q s a 9 i x o l , ’ ] <blank-middle> <blank-top>
32-45 1 <esc> <tab> f <ctrl> c j b z <shift-left> . ; <return> _ <del> <X>
48-63 r t g y h 8 n m <lock> <space> [ = <shift-right> <blank-bottom> <X> <X>
64-71 unused
72-76 Keyset keys in order, left=72; right=76
77 RED (or left or top) mouse button
78 BLUE (or right or bottom) mouse button
79 YELLOW (or middle) mouse button
As an aid to interpreting KeyIndex values, the system scalar kbTransitionTable points to a table, indexed
by KeyIndex, that gives a KBKEY structure for the key; if it is zero, the operating system has no standard
interpretation of the key.
3.4.4. Fast Streams to Memory
The operating system also contains procedures that allow very efficient stream I/O to memory blocks.
These functions, described in the Streams package documentation, allow one for example to use much
more memory buffering for disk transfers than normally allocated by the disk stream mechanism.
Alto Operating System May 5, 1980 8
For Xerox Internal Use Only -- December 15, 1980