Skip to content

Messy Keys (Caps Scroll Num)Lock, Print, Pause, Esc

cajhin edited this page Jan 31, 2021 · 2 revisions

I call those the "messy keys" because they come with extra issues.

In the dark ages of DOS 1.0, there were a couple of very special NumPad key combos to control program execution (Pause, Break etc.)
Some of these combos were later put on dedicated keys (SysRq a.k.a. Print, Pause, ScrLock).

Protecting the Capsicain console

Some of those key combos have the nasty habit of pausing or stopping capsicain, when it is the foreground console (well, stopping console programs is their raison d'être).
When Capsicain is in the foreground, it drops these pause/exit codes.

If you don't need protection or want to mess with those keys in detail, define
GLOBAL DontProtectConsole

Shifting scancodes

When keys have double/triple functions, I map them to a single keycode to make life easier.
You can use PAUSE in your config without knowing it's intricate details.

IF you have a special need to deal with the original, unmapped scancodes, define
GLOBAL DontTranslateMessyKeys

ESC

Is used for Capsicain commands, which makes it a bit tricky in code.

Notable for the user is that the ESC commands cannot be rewired. You can rewire the usual ESC function, but not e.g. ESC+D for debug.

All keys with LEDs

When those keys are used with GLOBAL capsicainOnOff, the state of the LED is controlled by the capsicain "ON" state.

Print

ALT+PRINT actually sends a unique "ALTPRINT" key scancode.

To make life easier, I map that scancode to the regular PRINT code. ALT+PRINT still does a screenshot.

Print -> e0 2a e0 37 when no modifier key is down (E0-LShf PRINT)
Shf/Ctrl down + Print -> e0 37 (E0-NP* = PRINT)
Alt down + Print -> 54 (ALTPRINT)

ScrollLock

Ctrl+ScrLock sends Console EXIT signal
Ctrl+Pause generates E0-SCRLOCK

NumLock

Ctrl+NumLock = Console Pause signal
E1 Ctrl+Numlock generated by Pause key
With NumLock ON, Left generates EO-LSHF LEFT instead of LEFT

Pause

My very 'favorite' key...

Some details: https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html

Plain key -> e1 1d 45 e1 9d c5 when pressed without modifier (E1 LCTRL + NUMLOCK)
Plain key = Console Pause signal
AnyCtrl + Pause = SC_BREAK -> e0 46 e0 c6 -> Exit console signal
(Opposed to win.tue.nl, my Cherry DOES send the break codes for Pause sequences. When in doubt, I side with Cherry...)