{Begin SubSec Keyboard Interpretation} {Title Keyboard Interpretation} {Text {index *PRIMARY* Keyboard} For each key on the keyboard and mouse there is a corresponding bit in memory that the hardware turns on and off as the key moves up and down. System-level routines decode the meaning of key transitions according to a table of "key actions", which may be to put particular character codes in the sysbuffer, cause interrupts, change the internal shift/control status, or create events to be placed in the mouse buffer. {FnDef {Name KEYDOWNP} {Args KEYNAME} {Text Used to read the instantaneous state of any key, independent of any buffering or pre-assigned key action. Returns {lisp T} if the key named {arg KEYNAME} is down at the moment the function is executed. {index *PRIMARY* Key names} Most keys are named by the characters on the key-top. Therefore, {lisp (KEYDOWNP 'a)} or {lisp (KEYDOWNP 'A)} returns {lisp T} if the "{lisp A}" key is down. There are a number of keys that do not have standard names printed on them. These can be accessed by special names as follows: {Begin Labeledlist key names} {Label Space} {Text {lisp SPACE}} {Label Carriage return} {Text {lisp CR}} {Label Line-feed} {Text {lisp LF}} {Label Backspace} {Text {lisp BS}} {Label Tab} {Text {lisp TAB}} {Label Blank keys on 1132} {Text The 1132 keyboard has three unmarked keys on the right of the normal keyboard. These can be accessed by {lisp BLANK-BOTTOM}, {lisp BLANK-MIDDLE}, and {lisp BLANK-TOP}.} {Label Escape} {Text {lisp ESCAPE}} {Label Shift keys} {Text {lisp LSHIFT} for the left shift key, {lisp RSHIFT} for the right shift key.} {Label Shift lock key} {Text {lisp LOCK}} {Label Control key} {Text {lisp CTRL}} {Label Mouse buttons} {Text The state of the mouse buttons can be accessed using {lisp LEFT}, {lisp MIDDLE}, and {lisp RIGHT}.} {End Labeledlist key names} {Begin comment keyset de-documented} Paddles on the keyset (not generally available) are named {lisp PAD1} through {lisp PAD5}. {End comment keyset de-documented} }} {FnDef {Name SHIFTDOWNP} {Args SHIFT} {Text Returns {arg T} if the internal "shift" flag specified by {arg SHIFT} is on; {lisp NIL} otherwise. If {arg SHIFT} = {lisp 1SHIFT}, {lisp 2SHIFT}, {lisp LOCK}, {lisp META}, or {lisp CTRL}, {fn SHIFTDOWNP} returns the state of the left shift, right shift, shift lock, control, and meta flags, respectively. If {arg SHIFT} = {lisp SHIFT}, {fn SHIFTDOWNP} returns {lisp T} if either the left or right shift flag is on. If {arg SHIFT} = {lisp USERMODE1}, {lisp USERMODE2}, or {lisp USERMODE3}, {fn SHIFTDOWNP} returns the state of one of three user-settable flags that have no other effect on key interpretation. These flags can be set or cleared on character transitions by using {fn KEYACTION} (below). }} {FnDef {Name KEYACTION} {Args KEYNAME ACTIONS {anonarg}} {Text Changes the internal tables that define the action to be taken when a key transition is detected by the system keyboard handler. {arg KEYNAME} is specified as for {fn KEYDOWNP}. {arg ACTIONS} is a dotted pair of the form {lisp ({arg DOWN-ACTION} . {arg UP-ACTION})}, where the acceptable transition actions and their interpretations are: {Begin LabeledList KEYACTION transition actions} {Name {lisp NIL}} {Name {lisp IGNORE}} {Text Take no action on this transition (the default for up-transitions on all ordinary characters). } {Name {lisp ({arg CHAR} {arg SHIFTEDCHAR} {arg LOCKFLAG})}} {Text If a transition action is a three-element list, {arg CHAR} and {arg SHIFTEDCHAR} are either character codes or (non-numeric) single-character litatoms standing for their character codes. Note that {arg CHAR} and {arg SHIFTEDCHAR} can be full sixteen-bit {index NS Characters}NS characters (see {PageRef Term NS Characters}). When the transition occurs, {arg CHAR} or {arg SHIFTEDCHAR} is transmitted to the system buffer, depending on whether either of the two shift keys are down. {arg LOCKFLAG} is optional, and may be {lisp LOCKSHIFT} or {lisp NOLOCKSHIFT}. If {arg LOCKFLAG} is {lisp LOCKSHIFT}, then {arg SHIFTEDCHAR} will also be transmitted when the {lisp LOCK} shift is down (the alphabetic keys initially specify {lisp LOCKSHIFT}, but the digit keys specify {lisp NOLOCKSHIFT}). For example, {lisp (a A LOCKSHIFT)} and {lisp (61Q ! NOLOCKSHIFT)} are the initial settings for the down transitions of the "{lisp a}" and "{lisp 1}" keys respectively. } {Name {lisp 1SHIFTUP}, {lisp 1SHIFTDOWN}} {Name {lisp 2SHIFTUP}, {lisp 2SHIFTDOWN}} {Name {lisp CTRLUP}, {lisp CTRLDOWN}} {Name {lisp METAUP}, {lisp METADOWN}} {Text Change the status of the internal "shift" flags for the left shift, right shift, control, and meta keys, respectively. These shifts affect the interpretation of ordinary key actions. If either of the shifts is down, then {arg SHIFTEDCHAR}s are transmitted. If the control flag is on, then the the seventh bit of the character code is cleared as characters are transmitted. If the meta flag is on, the the eighth bit of the character code is set (normally cleared) as characters are transmitted. For example, the initial keyactions for the left shift key is {lisp (1SHIFTDOWN . 1SHIFTUP)}. } {Name {lisp LOCKUP}, {lisp LOCKDOWN}, {lisp LOCKTOGGLE}} {Text Change the status of the internal "shift" flags for the shift lock key. If the lock flag is down, then {arg SHIFTEDCHAR}s are transmitted if the key action specified {lisp LOCKSHIFT}. {lisp LOCKUP} and {lisp LOCKDOWN} clear and set the shift lock flag, respectively. {lisp LOCKTOGGLE} complements the flag (turning it off if the flag is on; on if the flag is off). } {Name {lisp USERMODE1UP}, {lisp USERMODE1DOWN}, {lisp USERMODE1TOGGLE}} {Name {lisp USERMODE2UP}, {lisp USERMODE2DOWN}, {lisp USERMODE2TOGGLE}} {Name {lisp USERMODE3UP}, {lisp USERMODE3DOWN}, {lisp USERMODE3TOGGLE}} {Name } {Text Change the status of the three user flags {lisp USERMODE1}, {lisp USERMODE2}, and {lisp USERMODE3}, whose status can be determined by calling {fn SHIFTDOWNP} (above). These flags have no other effect on key interpretation. } {Name {lisp EVENT}} {Text An encoding of the current state of the mouse and selected keys is placed in the mouse-event buffer when this transition is detected. } {End LabeledList KEYACTION transition actions} {fn KEYACTION} returns the previous setting for {arg KEYNAME}. If {arg ACTIONS} is {lisp NIL}, returns the previous setting without changing the tables. }} {FnDef {Name MODIFY.KEYACTIONS} {Args KEYACTIONS SAVECURRENT?} {Text {arg KEYACTIONS} is a list of key actions to be set, each of the form {lisp ({arg KEYNAME} . {arg ACTIONS})}. The effect of {fn MODIFY.KEYACTIONS} is as if {lisp (KEYACTION {arg KEYNAME} {arg ACTIONS})} were performed for each item on {arg KEYACTIONS}. If {arg SAVECURRENT?} is non-{lisp NIL}, then {fn MODIFY.KEYACTIONS} returns a list of all the results from {fn KEYACTION}, otherwise it returns {lisp NIL}. This can be used with a {fn MODIFY.KEYACTIONS} that appears in a {fn RESETFORM}, so that the list is built at "entry", but not upon "exit". }} {FnDef {Name METASHIFT} {Args FLG} {Type NOSPREAD} {Text If {arg FLG} is {lisp T}, changes the keyboard handler (via {fn KEYACTION}) so as to interpret the "stop" key on the 1108 as a metashift: if a key is struck while the meta is down, it is read with the 200Q bit set. For CHAT users this is a way of getting an "Edit" key on your simulated Datamedia. If {arg FLG} is other than {lisp NIL} or {lisp T}, it is passed as the {arg ACTIONS} argument to {fn KEYACTION}. The reason for this is that if someone has set the "STOP" key to some random behavior, then {lisp (RESETFORM (METASHIFT T) --)} will correctly restore that random behavior. {note actually, is NOSPREAD that changes nothing if given no args. Unfortunately, returns ((195 195 NOLOCKSHIFT) . IGNORE) if current state is NIL.} }} {note New RAID interrupt for emergency use: Holding down control-shift-delete will usually get you into RAID (under the 'keyboard' context) as long as the mouse is tracking.} }{End SubSec Keyboard Interpretation} ?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8)) GACHA ?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8)) Q   .¶zº