# Special Keyboard Keys

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Pi-cromite ArmiteL4 Armite F4 ArmiteH7 picomite CMM2

MMBasic generates a single unique character for the function keys and other special keys on the keyboard.
These are shown in this table as hexadecimal and decimal numbers:

Keyboard Key | Key Code (Hex) | Key Code (Decimal)
Up Arrow | 80 | 128
Down Arrow | 81 | 129
Left Arrow | 82 | 130
Right Arrow | 83 | 131
Insert | 84 | 132
Home | 86 | 134
End | 87 | 135
Page Up | 88 | 136
Page Down | 89 | 137
Alt | 8B | 139
F1 | 91 | 145
F2 | 92 | 146
F3 | 93 | 147
F4 | 94 | 148
F5 | 95 | 149
F6 | 96 | 150
F7 | 97 | 151
F8 | 98 | 152
F9 | 99 | 153
F10 | 9A | 154
F11 | 9B | 155
F12 | 9C | 156
Print Screen (CMM2 KB only) | 9D | 157
Pause (CMM2 KB only) | 9E | 158

If the shift key is simultaneously pressed then &h40 is added to the code (this is the equivalent of setting bit 6). For example Shift-F10 will generate DA (hex).
The shift modifier only works with the function keys F1 to F12; it is ignored for the other keys.
The F1 and F2 keys translate to F11 and F12 (155 and 156) when Shifted.
MMBasic will translate most VT100 escape codes generated by terminal emulators such as TeraTerm and Putty to these codes (excluding the shift and control modifiers).
This means that a terminal emulator operating over a USB or a serial port opened as console will generate the same key codes as a directly attached keyboard.

A simple test program is advisable to test the keyboard output under your setup.

' inkey test
PRINT "enter X to end"
DO
k$ = INKEY$
IF k$ <> "" THEN PRINT k$;" "; ASC(k$)
IF k$ = "X" OR k$ = "x" THEN EXIT DO
LOOP
END

Last edited: 21 August, 2022