28

On IBM keyboards, scan code sets 1 and 2 have a long make code and lack a break code for the Pause/Break key. Moreover, when Ctrl is pressed, the make code is different, although break code still doesn't exist.*

In scan code set 3 there does appear the break code, but this set isn't used much.

What was the reason for Pause/Break to be treated so specially to not even have a break code?


*See detailed tables in e.g. this spec for EM83053DH keyboard encoder. I've checked experimentally that description for Pause/Break is correct at least with set 2 active.

3 Answers 3

37

In scancode set 2, the "break" scancodes consist of the "make" scancodes prefixed by F0. This is consistent across nearly all the keys. Some keys include a modifier prefix in the Ex range as well, and this is repeated in the "break" sequence. Additionally some keys behave as if two keys are pressed at once, and thus include multiple F0 codes to ensure that both virtual keys are seen as released by the host PC.

The "make" scancode for the Pause/Break key, however, is E1 14 77 E1 F0 14 F0 77. Examining this closely, this is actually a combined "make" then "break" sequence for a composite scancode: E1 14 77, then E1 F0 14 F0 77. So when you press that key, it is seen as pressed only momentarily by the host PC, even if you hold it down.

Yes, this is a hopeless mess. I think it resulted from the gradual evolution of the PC keyboard through its early history. The USB-HID scancode set is completely different, this obviously being seen as an opportunity to discard the cruft.

3
  • 25
    It seems this is related to the fact that the 84-key AT keyboard didn't have a Pause key, but used Ctrl + Num Lock for the pause function. Codes 14 and 77 correspond to (left) Ctrl and Num Lock, respectively. So I bet this is some attempt at fooling old BIOSes into working with the Pause key.
    – hobbs
    Sep 7, 2019 at 8:39
  • Possibly it was done to simplify the controller firmware; if the make and break codes for Pause were separate events, the controller might have to keep track of whether the real state of keys 14 and 77 had changed between the make and the break.
    – john_e
    Sep 25, 2019 at 8:34
  • 2
    77 is numlock and E1 14 is an otherwise unused code - but E0 14 is right ctrl and 14 is left ctrl. It's obviously intended to simulate Ctrl+NumLock but without messing with the state of right or left Ctrl.
    – user253751
    Mar 2, 2023 at 16:49
10

A minor (and late) addition to Chromatix otherwise complete answer:

Pause as well as Break are intended to work as 'interrupt' keys. This implies a few differences from any other key:

  • Any press is supposed to be reported (*1) right away
  • Any press should be responded to (*2) as soon as possible
  • They should not be repeated under any circumstances.

Reporting of a key can happen, depending on keyboard driver strategy on key press or key release, sending both at once will make sure it gets reported no matter what strategy is used.

Responding can happen, depending on driver/OS/User strategy on key press or key release, sending both at once will make sure it gets handled ASAP no matter what strategy is used.

Eventually even more important, by sending the release right after press, no typematic (key repeating) functionality gets a chance to multiply its 'interrupt message' if a user presses either key for a prolonged time. Just imagine how a program, using Pause to stop and restart scrolling, would start to act...

Bottom line: This is all about 'hacking' the keyboard driver strategy from 'below'


*1 - To User/OS level, i.e. past any driver

*2 - By User/OS level, i.e. past any driver

2
  • 1
    Excellent points!
    – user21618
    May 15, 2022 at 11:56
  • 2
    “Just imagine how a program, using Pause to stop and restart scrolling, would start to act” — like a Turbo button on off-brand game console controllers! Nov 26, 2022 at 15:00
4

As Chromatix wrote, the code indicates: press E1 14, press 77, release E1 14, release 77. So which keys are these?

77 is NumLock. E1 14 is unused.

But E0 14 is right Ctrl, and 14 is left Ctrl. This E0 pattern is also followed for all the other keys that have two copies.

So we can infer that the Pause key simulates pressing Ctrl+NumLock, probably because that combination was recognized by the PC BIOS when this key was introduced. But not right or left Ctrl, possibly to avoid messing things up if the user was already holding down the Ctrl key, or to allow sufficiently advanced operating systems to distinguish this from actual Ctrl+NumLock.

Why is there no break code? Probably because it's not clear what it would mean to hold down a fake key combination like this. What should happen if you are holding down Pause and then you press NumLock? Releasing NumLock should release Pause but act as if Ctrl is still held down? Should all your other keypresses be interpreted as if you are holding Ctrl?

7
  • This does not make sense. 14 is the letter T. Left CTRL is 1D. E0 14 is not a legal escape code.
    – Raffzahn
    Mar 3, 2023 at 11:49
  • 1
    @Raffzahn see win.tue.nl/~aeb/linux/kbd/scancodes-10.html
    – user253751
    Mar 3, 2023 at 11:52
  • Those are enhanced keyboard scan codes that are sent on wire. The keyboard controller on motherboard will translate it to original scan codes used by BIOS, so BIOS and user programs will get E1 1D 45 E1 9D C5. They will not get 14 or 77.
    – Justme
    Mar 3, 2023 at 12:04
  • 1
    @Justme the other answer used the 14 77 code, so that is what I also used. Clearly this code is present in the computer, and you write down different codes depending on whether you choose to look at the BIOS or the keyboard. Either way the logic is the same, just with different numbers. It is still Ctrl+NumLock.
    – user253751
    Mar 3, 2023 at 12:06
  • 1
    @user253751 Correct, 14 and 77 are LCRTL and NUMLOCK in the non-translated set communicated by an AT keyboard to the motherboard keyboard controller. But if you use the computer normally with BIOS and DOS, you will never see these codes or need to know these codes exist.
    – Justme
    Mar 3, 2023 at 12:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .