Keyboard Protocols

This is a preview of upcoming Admiral Shark's Keyboards content. This page is considered work-in-progress and should be treated as such.

Contents

IBM PC Mode 1

This is the line protocol for the original IBM Personal Computer series (5150, 5155 and 5160) keyboard interface introduced in 1981. Due to its use with the aforementioned IBM 5160 (Personal Computer XT), this protocol may be nicknamed the "XT protocol". It originally wasn't named "Mode 1", but it assumed that name after the introduction of Mode 2 and the distinction between them for IBM PS/2 Enhanced Keyboards. It's a serial protocol with a 9-bit data stream size.

Logic

Data stream

BitFunction
0Start bit (always 1)[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
1Data bit 0 (least-significant)[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
2Data bit 1[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
3Data bit 2[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
4Data bit 3[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
5Data bit 4[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
6Data bit 5[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
7Data bit 6[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
8Data bit 7 (most-significant)[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].

Scancodes

Commands

System-to-keyboard

HexFunctionDescription
FFResetAsks the keyboard to reset itself

Auto-sense accessing (for IBM PS/2 Enhanced Keyboards)

IBM PC Mode 2

This is the line protocol for the IBM Display Station (315X, 316X, 3179, 3180, 319X, 347X and 348X), IBM Personal Computer AT (5170) and IBM Personal System/2 family keyboard interface. It was originally introduced with the IBM 3270 Personal Computer in October 1983, an IBM 3270 terminal emulation PC based around an IBM PC/XT that normally supports only Mode 1 keyboards but has an ISA-based Keyboard/Timer Adapter card that interfaces the Mode 2 based IBM 3270 Personal Computer Converged Keyboard with the system. It became PC industry's primary keyboard interface soon after, only surpassed by the rise of USB HID. It's a serial protocol with a 11-bit data stream size. There were three variants with differing levels of scancode and command implementation:

Logic

Data stream

BitFunction
0Start bit (always 0)[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
1Data bit 0 (least-significant)[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
2Data bit 1[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
3Data bit 2[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
4Data bit 3[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
5Data bit 4[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
6Data bit 5[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
7Data bit 6[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
8Data bit 7 (most-significant)[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
9Parity bit (odd)[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
10Stop bit (always 1)[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].

Scancodes

Commands

System-to-keyboard

HexFunctionApplicable variant(s)Description
EDSet/Reset Mode IndicatorsAT, EnhancedAsks the keyboard to change the status (on/off) for a lock-light LED[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
EEEchoAllAsks the keyboard to send an EE response code as a diagnostic aid[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
F0Select Alternate Scan CodesEnhancedAsk the keyboard to send its current scancode get or set itself to different one[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
F2Read IDAllAsks the keyboard to send its keyboard's ID value[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
F3Set Typematic Rate/DelayAllAsks the keyboard to change typematic rate and delay values[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
F4EnableAllAsks the keyboard to clear its output buffer and starts scanning for keys[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
F5Default DisableAllAsks the keyboard to reset all conditions to the power-on default state and disables scanning[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
F6Set DefaultAllAsks the keyboard to reset all conditions to the power-on default state[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
F7All Keys TypematicTerminal, Enhanced (only set 3)Asks the keyboard to enable typematic and turn off break codes[2][2]
Andries Brouwer - 12. Keyboard commands [accessed 2024-09-17].
F8All Keys Make/BreakTerminal, Enhanced (only set 3)Asks the keyboard to disable typematic and turn on break codes[2][2]
Andries Brouwer - 12. Keyboard commands [accessed 2024-09-17].
F9All Keys Only MakeTerminal, Enhanced (only set 3)Asks the keyboard to disable typematic and turn off break codes[2][2]
Andries Brouwer - 12. Keyboard commands [accessed 2024-09-17].
FEResendAllAsks the keyboard to resend its last (non-resend) output when an error is detected[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
FFResetAllAsks the keyboard to reset itself[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].

EF and F1 are noted in the some documentation but as "invalid commands"[1][1]
IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
.

Known commands

Select Alternate Scan Codes (IBM PC Mode 2)

For "Enhanced" variant of IBM PC Mode 2 only

This system-to-keyboard command (F0) is used to get or set the keyboard's current IBM scancode set (1, 2 or 3).

Getting sequence

TODO.

Setting sequence

Set/Reset Mode Indicators (IBM PC Mode 2)

For "AT" and "Enhanced" variants of IBM PC Mode 2 only

This system-to-keyboard command (ED) is used to set or reset mode indicators (lock-light LEDs; Num Lock, Caps Lock and Scroll Lock).

Setting sequence

Further reading & resources

External

Sources

  1. IBM - IBM 7531/7532 Industrial Computer Technical Reference System Unit (#6523261) [accessed 2024-09-17].
  2. Andries Brouwer - 12. Keyboard commands [accessed 2024-09-17].