Keyboard
Overview
The Keyboard is the standard NCS/e text input peripheral.
Unlike most peripherals, the Keyboard does not provide its own NCL verbs. The Keyboard sends key events directly to the kernel, which stores them in an input buffer. Other compatible input devices may also generate key events for this buffer.
Programs access buffered keyboard input using the SYS.KEY and SYS.AKEY system verbs.
Keys are buffered in the order they are received. Reading a key removes the oldest key from the buffer.
This buffering model is specific to keyboard input. Other input peripherals, such as joysticks, may be accessed directly through their own EXT interfaces.
Input buffer
Keyboard input is buffered by the kernel until it is read by a program.
Programs may read the buffer in one of two ways:
SYS.KEYreads the oldest available key without waiting.SYS.AKEYreads the oldest available key, waiting if necessary.
Both verbs consume the same input buffer.
If several keys have already been entered, repeated reads return them in the order they were received.
Reading keys
SYS.KEY — Read Key
SYS.KEY <dst>
Removes the oldest key from the keyboard input buffer and stores it in the destination register.
If the buffer is empty, an empty string is returned immediately.
Operands
| Position | Name | Type | Description |
|---|---|---|---|
| 1 | dst |
String register | Destination for the key. |
Modified registers
| Register | Description |
|---|---|
dst |
Oldest buffered key, or "" if no key is available. |
Examples
-- Read the next available key.
SYS.KEY s0
The empty string may be used to determine whether input was available:
SYS.KEY s0
BSEQ $noInput s0 ""
-- Process the key here.
$noInput
Notes
SYS.KEYnever waits for input.- Reading a key removes it from the input buffer.
- If the buffer is empty,
""is returned. - Buffered keys are consumed in the order they were received.
SYS.AKEY — Await Key
SYS.AKEY <dst>
Removes the oldest key from the keyboard input buffer and stores it in the destination register.
If the buffer is empty, program execution waits until a key becomes available.
Operands
| Position | Name | Type | Description |
|---|---|---|---|
| 1 | dst |
String register | Destination for the key. |
Modified registers
| Register | Description |
|---|---|
dst |
Oldest buffered key. |
Examples
-- Wait for the next key.
SYS.AKEY s0
A program may use SYS.AKEY when it cannot continue until the user provides input:
D.TXT "Press any key..."
D.BLT
SYS.AKEY s0
It may also be used for a simple interactive input loop:
$input
SYS.AKEY s0
D.TXT s0
D.BLT
JUMP $input
Notes
- If a key is already buffered, it is returned immediately.
- If the buffer is empty, execution waits until a key is received.
- Reading a key removes it from the input buffer.
- Buffered keys are consumed in the order they were received.
Polling and awaiting input
SYS.KEY and SYS.AKEY differ only in their behavior when no input is available.
| Verb | Key available | Buffer empty |
|---|---|---|
SYS.KEY |
Returns the oldest key. | Returns "" immediately. |
SYS.AKEY |
Returns the oldest key. | Waits until a key is available. |
SYS.KEY is useful when a program needs to check for input while continuing to perform other work:
SYS.KEY s0
BSEQ $continue s0 ""
-- Handle input.
$continue
SYS.AKEY is useful when the program cannot proceed until input is received:
D.TXT "CONTINUE? [Y/N]"
D.BLT
SYS.AKEY s0
Because both verbs operate on the same kernel buffer, they may also be mixed within a program as needed.
Keyboard layouts
The standard Keyboard translates physical key presses into string values according to its keyboard layout and active modifiers.
Printable keys normally produce characters, while special keys may produce named values such as LEFT, HOME, or F1.
The modifier keys have the following roles:
| Modifier | Purpose |
|---|---|
| Shift | Selects the shifted key value. |
| Alt | Selects the alternate character or AltGr value. |
| Shift+Alt | Selects the shifted alternate value. |
| Ctrl | Selects the key's function value, where defined. |
The labels Alt and Ctrl are used by the standard Keyboard hardware. Functionally, Alt behaves as an AltGr modifier, while Ctrl selects additional function-key mappings.
Caps toggles alphabetic capitalization. While Caps is active, unshifted letters produce uppercase characters and Shift produces lowercase characters. Caps does not affect numbers or symbols and remains active until pressed again.
Special keyboard behavior
Compatible keyboards may perform processing before sending input to the kernel. This behavior depends on the keyboard and its active layout.
Dead keys may wait for another key before producing a value. For example, a dead accent key followed by a letter may produce a single accented character rather than two separate key events.
Macros may generate a sequence of key values from a single key press. These values are added to the input buffer in order and are read normally using SYS.KEY or SYS.AKEY.
System controls
The standard Keyboard provides dedicated ABORT and RESET controls. These controls act directly on the system and do not produce values in the keyboard input buffer.
| Control | Effect |
|---|---|
ABORT |
Immediately aborts the currently running program and returns control to the shell. |
RESET |
Power-cycles the NCS/e, equivalent to switching the computer off and back on. |
Ctrl+C |
Invokes the same ABORT function as the dedicated ABORT control. |
Standard layouts
The standard Keyboard is available with several keyboard layouts. Each layout defines the complete mapping of physical keys, including modifier combinations, function keys, navigation keys, and the numeric keypad.
Expand a layout below to view its complete key map.
A value marked dead is a dead key. Dead keys modify the following character instead of being entered immediately. Dead-key combinations are shared by all layouts and are listed under Dead key combinations.
US English
Layout
| Key | Normal | Shift | Alt | Alt+Shift | Ctrl |
|---|---|---|---|---|---|
| Esc | ESC |
ESC |
ESC |
ESC |
ESC |
| F1 | F1 |
F1 |
F1 |
F1 |
F1 |
| F2 | F2 |
F2 |
F2 |
F2 |
F2 |
| F3 | F3 |
F3 |
F3 |
F3 |
F3 |
| F4 | F4 |
F4 |
F4 |
F4 |
F4 |
| F5 | F5 |
F5 |
F5 |
F5 |
F5 |
| F6 | F6 |
F6 |
F6 |
F6 |
F6 |
| F7 | F7 |
F7 |
F7 |
F7 |
F7 |
| F8 | F8 |
F8 |
F8 |
F8 |
F8 |
| F9 | F9 |
F9 |
F9 |
F9 |
F9 |
| F10 | F10 |
F10 |
F10 |
F10 |
F10 |
| F11 | F11 |
F11 |
F11 |
F11 |
F11 |
| F12 | F12 |
F12 |
F12 |
F12 |
F12 |
| ` | ` |
~ |
— | — | ESC |
| Enter | ENTER |
ENTER |
LF |
RI |
CR |
| 1 | 1 |
! |
— | — | F1 |
| 2 | 2 |
@ |
— | — | F2 |
| 3 | 3 |
# |
— | — | F3 |
| 4 | 4 |
$ |
— | — | F4 |
| 5 | 5 |
% |
— | — | F5 |
| 6 | 6 |
^ |
— | — | F6 |
| 7 | 7 |
& |
— | — | F7 |
| 8 | 8 |
* |
— | — | F8 |
| 9 | 9 |
( |
— | — | F9 |
| 0 | 0 |
) |
— | — | F10 |
| - | - |
_ |
— | — | F11 |
| = | = |
+ |
— | — | F12 |
| Backspace | BS |
BS |
BS |
BS |
DEL |
| A | a |
A |
— | — | — |
| B | b |
B |
— | — | — |
| C | c |
C |
— | — | ABORT |
| D | d |
D |
— | — | — |
| E | e |
E |
— | — | — |
| F | f |
F |
— | — | — |
| G | g |
G |
— | — | BEL |
| H | h |
H |
— | — | BS |
| I | i |
I |
— | — | TAB |
| J | j |
J |
— | — | LF |
| K | k |
K |
— | — | VT |
| L | l |
L |
— | — | FF |
| M | m |
M |
— | — | CR |
| N | n |
N |
— | — | — |
| O | o |
O |
— | — | — |
| P | p |
P |
— | — | — |
| Q | q |
Q |
— | — | — |
| R | r |
R |
— | — | — |
| S | s |
S |
— | — | — |
| T | t |
T |
— | — | — |
| U | u |
U |
— | — | — |
| V | v |
V |
— | — | — |
| W | w |
W |
— | — | — |
| X | x |
X |
— | — | — |
| Y | y |
Y |
— | — | — |
| Z | z |
Z |
— | — | — |
| Space | |
|
|
|
— |
| [ | [ |
{ |
— | — | — |
| ] | ] |
} |
— | — | — |
| ; | ; |
: |
— | — | — |
| ' | ' |
" |
— | — | — |
| \ | \ |
| |
— | — | — |
| , | , |
< |
— | — | — |
| . | . |
> |
— | — | — |
| / | / |
? |
— | — | — |
| Tab | TAB |
BACKTAB |
TAB |
BACKTAB |
— |
| Numpad 1 | 1 |
1 |
1 |
1 |
END |
| Numpad 2 | 2 |
2 |
2 |
2 |
DOWN |
| Numpad 3 | 3 |
3 |
3 |
3 |
PGDN |
| Numpad 4 | 4 |
4 |
4 |
4 |
LEFT |
| Numpad 5 | 5 |
5 |
5 |
5 |
— |
| Numpad 6 | 6 |
6 |
6 |
6 |
RIGHT |
| Numpad 7 | 7 |
7 |
7 |
7 |
HOME |
| Numpad 8 | 8 |
8 |
8 |
8 |
UP |
| Numpad 9 | 9 |
9 |
9 |
9 |
PGUP |
| Numpad 0 | 0 |
0 |
0 |
0 |
— |
| Numpad . | . |
. |
. |
. |
DEL |
| Numpad / | / |
/ |
/ |
/ |
— |
| Numpad * | * |
* |
* |
* |
— |
| Numpad - | - |
- |
- |
- |
— |
| Numpad + | + |
+ |
+ |
+ |
— |
| Numpad Enter | ENTER |
ENTER |
LF |
RI |
CR |
| Left | LEFT |
LEFT |
LEFT |
LEFT |
HOME |
| Down | DOWN |
DOWN |
DOWN |
DOWN |
PGDN |
| Up | UP |
UP |
UP |
UP |
PGUP |
| Right | RIGHT |
RIGHT |
RIGHT |
RIGHT |
END |
| Home | HOME |
HOME |
HOME |
HOME |
— |
| End | END |
END |
END |
END |
— |
| Page Up | PGUP |
PGUP |
PGUP |
PGUP |
— |
| Page Down | PGDN |
PGDN |
PGDN |
PGDN |
— |
Canadian French
Layout
| Key | Normal | Shift | Alt | Alt+Shift | Ctrl |
|---|---|---|---|---|---|
| Esc | ESC |
ESC |
ESC |
ESC |
ESC |
| F1 | F1 |
F1 |
F1 |
F1 |
F1 |
| F2 | F2 |
F2 |
F2 |
F2 |
F2 |
| F3 | F3 |
F3 |
F3 |
F3 |
F3 |
| F4 | F4 |
F4 |
F4 |
F4 |
F4 |
| F5 | F5 |
F5 |
F5 |
F5 |
F5 |
| F6 | F6 |
F6 |
F6 |
F6 |
F6 |
| F7 | F7 |
F7 |
F7 |
F7 |
F7 |
| F8 | F8 |
F8 |
F8 |
F8 |
F8 |
| F9 | F9 |
F9 |
F9 |
F9 |
F9 |
| F10 | F10 |
F10 |
F10 |
F10 |
F10 |
| F11 | F11 |
F11 |
F11 |
F11 |
F11 |
| F12 | F12 |
F12 |
F12 |
F12 |
F12 |
| # | # |
| |
\ |
— | ESC |
| Enter | ENTER |
ENTER |
LF |
RI |
CR |
| 1 | 1 |
! |
± |
— | F1 |
| 2 | 2 |
" |
@ |
— | F2 |
| 3 | 3 |
/ |
£ |
— | F3 |
| 4 | 4 |
$ |
¢ |
— | F4 |
| 5 | 5 |
% |
¤ |
— | F5 |
| 6 | 6 |
? |
¬ |
— | F6 |
| 7 | 7 |
& |
¦ |
— | F7 |
| 8 | 8 |
* |
² |
— | F8 |
| 9 | 9 |
( |
³ |
— | F9 |
| 0 | 0 |
) |
¼ |
— | F10 |
| - | - |
_ |
½ |
— | F11 |
| = | = |
+ |
¾ |
— | F12 |
| Backspace | BS |
BS |
BS |
BS |
DEL |
| A | a |
A |
— | — | — |
| B | b |
B |
— | — | — |
| C | c |
C |
— | — | ABORT |
| D | d |
D |
— | — | — |
| E | e |
E |
€ |
— | — |
| F | f |
F |
— | — | — |
| G | g |
G |
— | — | BEL |
| H | h |
H |
— | — | BS |
| I | i |
I |
— | — | TAB |
| J | j |
J |
— | — | LF |
| K | k |
K |
— | — | VT |
| L | l |
L |
— | — | FF |
| M | m |
M |
µ |
— | CR |
| N | n |
N |
— | — | — |
| O | o |
O |
§ |
— | — |
| P | p |
P |
¶ |
— | — |
| Q | q |
Q |
— | — | — |
| R | r |
R |
— | — | — |
| S | s |
S |
— | — | — |
| T | t |
T |
— | — | — |
| U | u |
U |
— | — | — |
| V | v |
V |
— | — | — |
| W | w |
W |
— | — | — |
| X | x |
X |
— | — | — |
| Y | y |
Y |
— | — | — |
| Z | z |
Z |
— | — | — |
| Space | |
|
|
|
— |
| ^ | ^ (dead) |
^ (dead) |
[ |
— | — |
| ¸ | ¸ (dead) |
¨ (dead) |
] |
— | — |
| ; | ; |
: |
~ |
— | — |
| ` | ` (dead) |
` (dead) |
{ |
— | — |
| < | < |
> |
} |
— | — |
| , | , |
' |
¯ |
— | — |
| . | . |
. |
|
— | — |
| é | é |
É |
´ (dead) |
— | — |
| « | « |
» |
° |
— | — |
| Tab | TAB |
BACKTAB |
TAB |
BACKTAB |
— |
| Numpad 1 | 1 |
1 |
1 |
1 |
END |
| Numpad 2 | 2 |
2 |
2 |
2 |
DOWN |
| Numpad 3 | 3 |
3 |
3 |
3 |
PGDN |
| Numpad 4 | 4 |
4 |
4 |
4 |
LEFT |
| Numpad 5 | 5 |
5 |
5 |
5 |
— |
| Numpad 6 | 6 |
6 |
6 |
6 |
RIGHT |
| Numpad 7 | 7 |
7 |
7 |
7 |
HOME |
| Numpad 8 | 8 |
8 |
8 |
8 |
UP |
| Numpad 9 | 9 |
9 |
9 |
9 |
PGUP |
| Numpad 0 | 0 |
0 |
0 |
0 |
— |
| Numpad . | . |
. |
. |
. |
DEL |
| Numpad / | / |
/ |
/ |
/ |
— |
| Numpad * | * |
* |
* |
* |
— |
| Numpad - | - |
- |
- |
- |
— |
| Numpad + | + |
+ |
+ |
+ |
— |
| Numpad Enter | ENTER |
ENTER |
LF |
RI |
CR |
| Left | LEFT |
LEFT |
LEFT |
LEFT |
HOME |
| Down | DOWN |
DOWN |
DOWN |
DOWN |
PGDN |
| Up | UP |
UP |
UP |
UP |
PGUP |
| Right | RIGHT |
RIGHT |
RIGHT |
RIGHT |
END |
| Home | HOME |
HOME |
HOME |
HOME |
— |
| End | END |
END |
END |
END |
— |
| Page Up | PGUP |
PGUP |
PGUP |
PGUP |
— |
| Page Down | PGDN |
PGDN |
PGDN |
PGDN |
— |
French
Layout
...
Dead key combinations
Dead keys combine with the following character to produce an accented or modified character. Dead-key processing is independent of the selected keyboard layout: any layout capable of producing a supported dead key can use the combinations below.
Combinations
| Dead key | Characters | Results |
|---|---|---|
Grave ` |
A E I O U |
À È Ì Ò Ù |
a e i o u |
à è ì ò ù |
|
Acute ´ |
A E I O U Y |
Á É Í Ó Ú Ý |
a e i o u y |
á é í ó ú ý |
|
Circumflex ^ |
A E I O U |
Â Ê Î Ô Û |
a e i o u |
â ê î ô û |
|
Tilde ~ |
A N O |
Ã Ñ Õ |
a n o |
ã ñ õ |
|
Diaeresis ¨ |
A E I O U Y |
Ä Ë Ï Ö Ü Ÿ |
a e i o u y |
ä ë ï ö ü ÿ |
|
Ring ° |
A U |
Å Ů |
a u |
å ů |
|
Macron ¯ |
A E I O U |
Ā Ē Ī Ō Ū |
a e i o u |
ā ē ī ō ū |
|
Cedilla ¸ |
C |
Ç |
c |
ç |
|
Caron ˇ |
C D E N R S T Z |
Č Ď Ě Ň Ř Š Ť Ž |
c d e n r s t z |
č ď ě ň ř š ť ž |
|
Breve ˘ |
A E G I O U |
Ă Ĕ Ğ Ĭ Ŏ Ŭ |
a e g i o u |
ă ĕ ğ ĭ ŏ ŭ |
|
Ogonek ˛ |
A E I O U |
Ą Ę Į Ǫ Ų |
a e i o u |
ą ę į ǫ ų |
|
Dot above ˙ |
B C E G I M Z |
Ḃ Ċ Ė Ġ İ Ṁ Ż |
b c e g i m z |
ḃ ċ ė ġ i ṁ ż |
|
Double acute ˝ |
O U |
Ő Ű |
o u |
ő ű |