26

In my answer here I infer that the unusual scancode for the Pause/Break key emulates the user pressing and then releasing CtrlNumLock. Obviously that key combination did something specific, back when this key was introduced to PC keyboards.

What did CtrlNumLock do on the early IBM PC or in common software around that time?

3 Answers 3

28

In the IBM PC 5150, CtrlNumLock paused the system until another key (not NumLock) was pressed. As described in page 5-21 of the relevant Technical Reference:

The combination of the Ctrl and Num Lock keys will cause the keyboard interrupt routine to loop, waiting for any key except the Num Lock key to be pressed. This provides a system- or application-transparent method of temporarily suspending list, print, and so on, and then resuming the operation. The “unpause” key is thrown away. Pause is handled within the keyboard routine.

When the Pause key was introduced, with the 101/102-key keyboard, handling was similar. As described in page 4-72 of the relevant Technical Reference:

The Pause key causes the keyboard interrupt routine to loop, waiting for any character or function key to be pressed. This provides a method of temporarily suspending an operation, such as listing or printing, and then resuming the operation. The method is not apparent to either the system or the application program. The key stroke used to resume operation is discarded. Pause is handled internal to the keyboard routine.

2
  • 2
    Did this effectively pause the system's processing (since you mention the loop), or did it just pause output with a blocking call similar to Ctrl-S? I suppose in a single-tasking environment like the 5150 this is one-in-the-same, so more curious if it affected CPU and interrupt processing or just "CHROUT call doesn't return until un-paused"
    – bjb
    Mar 3 at 16:53
  • 6
    @bjb it pauses the system’s processing, see the loop starting at line 2219 in the BIOS source code (but interrupts are enabled, so anything interrupt-driven will still happen). Mar 3 at 17:14
12

CTRL+NUMLOCK was Pause, CTRL+SCROLLOCK was Break.

It was not until later that the keyboard was updated with new buttons for newer machines, and got a separate key for Pause/Break, which then still needs to send the same combination of scan codes to simulate CTRL+NUMLOCK and CTRL+SCROLLOCK.

So a more modern Enhanced Keyboard with Pause/Break key sends Pause key as events for pushing Left Ctrl and NumLock, but prefixed with E1, and immediately sends events for releasing Left Ctrl and NumLock, prefixed with E1 to indicate a two key extended sequence. A program ignoring E1 will just see Left Ctrl and NumLock.

And that's why Break is invoked by pushing Ctrl and Pause/Break keys, because it already forces you to manually send Ctrl down event and then the Pause/Break key just needs to send key down event for Scroll Lock, immediately followed by release event for Scroll Lock. The Scroll Lock press and release events in this case are prefixed with E0 to mark them as extended keys, but a program ignoring E0 will see just Scroll Lock with Ctrl held down.

Please note that these scancodes are the original scancodes used by BIOS, not scancodes communicated on keyboard wire, as the later keyboards use different scancodes that are translated to original scancodes by the motherboard keyboard controller.

3
  • So this is where the Ctrl+Scroll+Scroll combo in Windows originates!
    – Ruslan
    Mar 4 at 17:01
  • Unlikely. Why do you think they are related? It's just a key combo to do something in a system. It has likely nothing to do what that combo did on a IBM 5150, and how a later keyboard has a single button to emulate sending that combo instead of the user.
    – Justme
    Mar 4 at 17:09
  • I just thought it might be the source of inspiration of those who came up with this combo when developing Windows. But yeah, now that I read more about it, indeed this appears unlikely.
    – Ruslan
    Mar 4 at 21:11
-6

In my answer here I infer that the unusual scancode for the Pause/Break key emulates the user pressing and then releasing Ctrl+NumLock.

No it does not.

  • Left CTRL is 1D
  • Right CTRL is E0 1D
  • Pause/Break is E1 14 77
  • 14 is the alpha key T
  • E0 14 is not a legal escape code.
  • Left CTRL + NumLock is 1D 77
  • Right CTRL + NumLock is E0 1D 77

E1 is a special escape code only for keys that will send the break code right away. So far that is no other than the Pause/Break. E1 does not work like the standard E0 code. It wei always be followed by the appropriate break code.

8
  • 5
    But it does. Normally the keyboard controller translates the scancodes, so no matter what the keyboard sends, the BIOS and user programs get the translated scan codes matcing the original keyboard, and that sequence is E1 1D 45 E1 9D C5. Only if you request the keyboard controller to not translate, you get what the keyboard actually sends on wire. Scan code sets are not compatible.
    – Justme
    Mar 3 at 11:59
  • 1
    I do not know why the Raffzahn answer got so many downvotes; is it untruthful? Mar 3 at 15:18
  • 12
    The answer's being downvoted because it doesn't answer the question ("What did Ctrl+Numlock do?") but instead wrongly argues against its premise. In Chromatix's answer on the page the question links to, the scancode sequence under discussion (E1 14 77 E1 F0 14 F0 77) was explicitly stated to be using Set 2 scancodes.This answer is treating them as Set 1 scancodes (in which 14 is T) rather than Set 2 (in which 14 is Ctrl).
    – john_e
    Mar 3 at 16:26
  • 5
    I did reread the linked answer and changed my comment accordingly - the linked answer doesn't mention set 2 itself, but it begins "As Chromatix wrote" and Chromatix's answer begins "In scancode set 2".
    – john_e
    Mar 3 at 17:55
  • 4
    @Героямслава downvoted, because it compares set 1 (T = 14, Ctrl = 1D) keycodes to a set 2 (Pause = E1 14 77) keycode, which makes no sense. Furthermore, it claims that Pause is not emulating Ctrl+NumLock, although the whole point of the strange Pause key code to just do that. While it is true that E1 1D 45 (Pause in set 1) is not equal to 1D 45 (LCtrl+NumLock) nor E0 1D 45 (RCtrl+NumLock), XT keyboard drivers just ignore both E0 and E1 as invalid unknown scan codes, so Pause, LCtrl+NumLock, RCtrl+NumLock all look the same: 1D 45 (This comment ignores that Pause includes release codes) Mar 4 at 21:28

You must log in to answer this question.

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