IBM PS/2 Keyboard

PS/2 Keyboards
Programming the PS/2 keyboards

The reference document http://www.mcamafia.de/pdf/ibm_hitrc11.pdf which is one of a number at http://www.mcamafia.de/pdf/pdfref.htm describes the programming interface to the keyboards in PS/2 systems but it is a graphic and not searchable. Below is a text-based version of the same information.

The pagination of the PDF has been retained for easy cross-reference. Pages are delimited by a horizontal line. Page numbers appear at the bottom of each page as they do in the PDF.


Keyboards (101- and 102-Key)

Description 1
Keyboard Layouts 1
101-Key Keyboard 2
102-Key Keyboard 3
Belgian Keyboard 4
Canadian French Keyboard 5
Danish Keyboard 6
Dutch Keyboard 7
French Keyboard 8
German Keyboard 9
Italian Keyboard 10
Latin American Keyboard 11
Norwegian Keyboard 12
Portuguese Keyboard 13
Spanish Keyboard 14
Swedish Keyboard 15
Swiss Keyboard 16
U.K. English Keyboard 17
U.S. English Keyboard 18
Sequential Key-Code Scanning 19
Buffer 19
Keys 19
Power-On Routine 20
Power-On Reset (POR) 20
Basic Assurance Test 20
Commands from the System 21
Commands to the System 26
Scan Codes 27
Set 1 Scan-Code Tables 27
Set 2 Scan-Code Tables 30
Set 3 Scan Code Tables 34
Clock and Data Signals 37
Data Stream 37
Data Output 38
Data input 39
Encode and Usage 40
Extended Functions 43
Shift States 45
Special Handling 47
System Reset 47
Break 47
Pause 47

I


© Copyright IBM Corp. 1990
Print Screen 47
System Request 48
Other Characteristics 48
Cables and Connectors 49
Specifications 50

II Keyboards (101- and 102-Key) - October 1990


Figures

1. Keyboard Commands from the System 21
2. Set All Keys Commands 23
3. Set Key Type Commands 23
4. Set/Reset Status Indicators 24
5. Typematic Rate 25
6. Keyboard Commands to the System 26
7. Keyboard Scan Codes, Set 1 28
8. Keyboard Scan Codes, Set 1 29
9. Keyboard Scan Codes, Set 1 30
10. Keyboard Scan Codes, Set 1 30
11. Keyboard Scan Codes, Set 1 30
12. Keyboard Scan Codes, Set 2 31
13. Keyboard Scan Codes, Set 2 32
14. Keyboard Scan Codes, Set 2 33
15. Keyboard Scan Codes, Set 2 33
16. Keyboard Scan Codes, Set 2 33
17. Keyboard Scan Codes, Set 3 34
18. Keyboard Data Stream Bit Definitions 38
19. Character Codes 41
20. Special Character Codes 43
21. Keyboard Extended Functions 44
22. Keyboard Connectors Signal and Voltage Assignments 49

III


© Copyright IBM Corp. 1990

Notes:

IV Keyboards (101- and 102-Key) - October 1990


Description

The keyboard has 102 keys (101 in the U.S.). At system power-on, the keyboard monitors the signals on the 'clock' and 'data' lines and establishes its line protocol. A bidirectional serial interface in the keyboard converts the 'clock' and 'data' signals and sends this information to and from the keyboard through the keyboard cable.

Keyboard Layouts

Keyboard layouts are in alphabetic order on the following pages. Nomenclature is on both the top and front face of the keybuttons.

  • Belgian
  • Canadian French
  • Danish
  • Dutch
  • French
  • German
  • Italian
  • Latin American
  • Norwegian
  • Portuguese
  • Spanish
  • Swedish
  • Swiss
  • U.K. English
  • U.S. English.

Keyboards (101- and 102-Key) - October 1990 1


101-Key Keyboard

See PDF for 101-key keyboard layout

2 Keyboards (101- and 102-Key) - October 1990


102-Key Keyboard

See PDF for 102-key keyboard layout

Keyboards (101- and 102-Key) - October 1990 3


Belgian Keyboard

See PDF for Belgian keyboard layout

4 Keyboards (101- and 102-Key) - October 1990


Canadian French Keyboard

See PDF for Canadian French keyboard layout

Keyboards (101- and 102-Key) - October 1990 5


Danish Keyboard

See PDF for Danish keyboard layout

6 Keyboards (101- and 102-Key) - October 1990


Dutch Keyboard

See PDF for Dutch keyboard layout

Keyboards (101- and 102-Key) - October 1990 7


French Keyboard

See PDF for French keyboard layout

8 Keyboards (101- and 102-Key) - October 1990


German Keyboard

See PDF for German keyboard layout

Keyboards (101- and 102-Key) - October 1990 9


Italian Keyboard

See PDF for Italian keyboard layout

10 Keyboards (101- and 102-Key) - October 1990


Latin American Keyboard

See PDF for Latin American keyboard layout

Keyboards (101- and 102-Key) - October 1990 11


Norwegian Keyboard

See PDF for Norwegian keyboard layout

12 Keyboards (101- and 102-Key) - October 1990


Portuguese Keyboard

See PDF for Portuguese keyboard layout

Keyboards (101- and 102-key) - October 1990 13


Spanish Keyboard

See PDF for Spanish keyboard layout

14 Keyboards (101- and 102-Key) - October 1990


Swedish Keyboard

See PDF for Swedish keyboard layout

Keyboards (101- and 102-key) - October 1990 15


Swiss Keyboard

See PDF for Swiss keyboard layout

16 Keyboards (101- and 102-Key) - October 1990


U.K. English Keyboard

See PDF for U.K. English keyboard layout

Keyboards (101- and 102-Key) - October 1990 17


U.S. English Keyboard

See PDF for U.S. English keyboard layout

18 Keyboards (101- and 102-Key) - October 1990


Sequential Key-Code Scanning

The keyboard detects all keys pressed and sends each scan code in the correct sequence. When not being serviced by the system, the keyboard stores the scan codes in its buffer.

Buffer

A 16-byte first-in-first-out (FIFO) butter in the keyboard stores the scan codes until the system is ready to receive them. A buffer-overrun condition occurs when more than 16 bytes are placed in the keyboard buffer. An overrun code replaces the 17th byte. If more keys are pressed before the system allows keyboard output, the additional data is lost.

When the keyboard is allowed to send data, the bytes in the buffer are sent as in normal operation, and new data entered is detected and sent. Response codes do not occupy a buffer position. If keystrokes generate a multiple-byte sequence, the entire sequence must fit into the available butter space, or the keystroke is discarded and a buffer-overrun condition occurs.

Keys

Except for the Pause key, all keys are make/break. The make scan code of a key is sent to the keyboard controller when the key is pressed. When the key is released, its break scan code is sent.

Also, except for the Pause key, all keys are typematic. When a key is pressed and held down, the keyboard sends the make code for that key, delays 500 milliseconds +/- 20%, and begins sending a make code for that key at a rate of 10.9 characters per second +/- 20%. The typematic rate and delay can be modified (see "Set Typematic Rate/Delay (Hex F3)" on page 24).

If two or more keys are held down, only the last key pressed repeats at the typematic rate. Typematic operation stops when the last key pressed is released, even if other keys are still held down. If a key is pressed and held down while keyboard transmission is inhibited, only the first make code is stored in the buffer. This prevents buffer overflow caused by typematic action.

Keyboards (101- and 102-Key) - October 1990 19


Note: Scan-code set 3 allows key types to be changed by the system. See "Set 3 Scan Code Tables" on page 34 for the default settings.

Power-On Routine

The following activities take place when power is first applied to the
keyboard:

Power-On Reset (POR)

The keyboard logic generates a 'power-on reset' signal when power is first applied to the keyboard. A POR takes a minimum of 150 milliseconds and a maximum of 2.0 seconds from the time power is first applied to the keyboard.

Basic Assurance Test

The basic assurance test (BAT) consists of a keyboard processor test, a checksum of the read-only memory (ROM), and a random-access memory (RAM) test. During the BAT, activity on the 'clock' and 'data' lines is ignored. The LEDs are turned on at the beginning and off at the end of the BAT. The BAT takes a minimum of 300 milliseconds and a maximum of 500 milliseconds. This is in addition to the time required by the POR.

On satisfactory completion of the BAT, a completion code (hex AA) is sent to the system, and keyboard scanning begins. If a BAT failure occurs, the keyboard sends an error code to the system. The keyboard is then disabled pending command input. Completion codes are sent between 450 milliseconds and 2.5 seconds after the POR, and between 300 and 500 milliseconds after a Reset command
is acknowledged.

Immediately following a POR, the keyboard monitors the signals on the keyboard 'clock' and 'data' lines and sets the line protocol.

20 Keyboards (101- and 102-Key) - October 1990


Commands from the System

The following figure shows the commands that the system may send
and their hexadecimal values.

Command Hex Value
Set/Reset Status indicators ED
Echo EE
Invalid Command EF
Select Alternate Scan Codes F0
Invalid Command F1
Read ID F2
Set Typematic Rate/Delay F3
Enable F4
Default Disable F5
Set Default F6
Set All Keys - Typematic F7
- Make/Break F8
- Make F9
- Typematic/Make/Break FA
Set Key Type - Typematic FB
- Make/Break FC
- Make FD
Resend FE
Reset FF

Figure 1. Keyboard Commands from the System

These commands can be sent to the keyboard at any time. The keyboard responds within 20 milliseconds, except when performing the BAT or executing a Reset command.

Note: Mode 1 accepts only the Reset command.

The following commands are in alphabetic order. They have different meanings when issued by the keyboard (see "Commands to the System" on page 26).

Default Disable (Hex F5): The Default Disable command resets all conditions to the power-on default state. The keyboard responds with ACK, clears its output buffer, sets the default key types (scan-code set 3 operation only) and typematic rate/delay, and clears the last typematic key. The keyboard stops scanning and awaits further
instructions.

Echo (Hex EE): Echo is a diagnostic aid. When the keyboard receives this command, it issues a hex EE response. If previously enabled, it continues scanning.

Keyboards (101- and 102-Key) - October 1990 21


Enable (Hex F4): On receipt of this command, the keyboard responds with ACK, clears its output buffer, clears the last typematic key, and starts scanning.

Invalid Command (Hex EF and F1): Hex EF and hex F1 are invalid commands and are not supported. If one of these is sent, the keyboard does not acknowledge the command but returns a Resend command and continues in its prior scanning state. No other activities occur.

Read ID (Hex F2): This command requests identification information from the keyboard. The keyboard responds with ACK, stops scanning. and sends the two keyboard ID bytes. The second byte must follow completion of the first by no more than 500 microseconds. After the output of the second ID byte, the keyboard resumes scanning.

Resend (Hex FE): The system sends this command when it detects an error in any transmission from the keyboard. It is sent only after a keyboard transmission and before the system allows the next keyboard output. When a Resend command is received, the keyboard sends the previous output again (unless the previous output was the Resend command, in which case the keyboard sends the last byte before the Resend command).

Reset (Hex FF): The system issues a Reset command to start a program reset and a keyboard internal self-test. The keyboard acknowledges the command with an ACK and ensures the system accepts ACK before executing the command. The system signals acceptance of ACK by raising the 'clock' and 'data' lines for a minimum of 500 microseconds. The keyboard is disabled from the time it receives the Reset command until ACK is accepted, or until another command is sent that overrides the previous command.

Following acceptance of ACK, the keyboard is reinitialized and performs the BAT. After returning the completion code, the keyboard defaults to scan-code set 2.

Select Alternate Scan Codes (Hex F0): This command instructs the keyboard to select one of three sets of scan codes. The keyboard acknowledges receipt of this command with ACK and clears both the output buffer and the typematic key (if one is active). The system then sends the option byte and the keyboard responds with another ACK. An option byte value of hex 01 selects scan code set 1, hex 02 selects scan code set 2, and hex 03 selects scan code set 3.

22 Keyboards (101- and 102-Key) - October 1990


An option byte value of hex 00 causes the keyboard to acknowledge with an ACK and send a byte telling the system which scan code set is currently in use. To prevent the controller from translating this byte, disable the keyboard-controller translate mode.

After establishing the new scan code set, the keyboard returns to the scanning state it was in before receiving the Select Alternate Scan Codes command.

Set All Keys (Hex F7, F8, F9, FA)

These commands instruct the keyboard to set all keys to a condition listed in the following figure.

Hex Value Command
F7 Set All Keys - Typematic
F8 Set All Keys - Make/Break
F9 Set All Keys - Make
FA Set All Keys - Typematic/Make/Break

Figure 2. Set All Keys Commands

The keyboard responds with ACK, clears its output buffer, sets all keys to the condition indicated by the command, and continues scanning (if it was previously enabled). Although these commands can be sent using any scan-code set, they affect only the operation of scan-code set 3.

Set Default (Hex F6): The Set Default command resets all conditions to the power-on default state. The keyboard responds with ACK, clears its output buffer, sets the default key types (scan-code set 3 operation only) and typematic rate/delay, clears the last typematic key, and continues scanning.

Set Key Type (Hex FB, FC, FD): These commands instruct the keyboard to set individual keys to a condition listed in the following figure.

Hex Value Command
FB Set Key Type - Typematic
FC Set Key Type - Make/Break
FD Set Key Type - Make

Figure 3. Set Key Type Commands

The keyboard responds with ACK, clears its output buffer, and prepares to receive key identification. The system identifies each key

Keyboards (101- and 102-Key) - October 1990 23


by its scan-code value, as defined in scan-code set 3. Only scan code set 3 values are valid for key identification. The type of each identified key is set to the value indicated by the command.

These commands can be sent using any scan code set, but affect only the operation of scan code set 3.

Set/Reset Status Indicators (Hex ED): Three status indicators on the keyboard - Num Lock, Caps Lock, and Scroll Lock - are accessible by the system. The keyboard activates or deactivates these indicators when it receives a valid command-code sequence from the system. The command sequence begins with the command byte (hex ED). The keyboard responds with ACK, stops scanning, and waits for the option byte from the system. The bit assignments for this option byte are as follows.

Bit Function
7 - 3 Reserved (must be 0's)
2 Caps Lock Indicator
1 Num Lock Indicator
0 Scroll Lock indicator

Figure 4. Set/Reset Status Indicators

If a bit for an indicator is set to 1, the indicator is turned on. If a bit is set to 0, the indicator is turned off.

The keyboard responds to the option byte with ACK, sets the indicators and, if the keyboard was previously enabled, continues scanning. The state of the Indicators reflects the bits in the option byte and can be activated or deactivated in any combination. If another command is received in place of the option byte, execution of the Set/Reset Mode Indicators command is stopped, with no change to the indicator states, and the new command is processed.

Immediately after power-on, the lights default to the Off state. If the Set Default and Default Disable commands are received, the lamps remain in the state they were in before the command was received.

Set Typematic Rate/Delay (Hex F3): The system issues this command to change the typematic rate and delay. The keyboard responds to the command with ACK, stops scanning, and waits for the system to issue the rate/delay value byte. The keyboard responds to the rate/delay value byte with another ACK, sets the rate and delay to the values indicated, and continues scanning (if it was previously enabled). Bits 6 and 5 indicate the delay, and bits 4, 3, 2, 1, and 0 (the

24 Keyboards (101- and 102-Key) - October 1990


least-significant bit) indicate the rate. Bit 7, the most-significant bit, is always 0. The delay is determined by the following equation:

Delay = (1 + A) x 250 milliseconds +/- 20%.
where:
A = binary value of bits 5 and 6

The period (interval from one typematic output to the next) is determined by the following equation:

Period = (8 + A) x (2 ** B) x 0.00417 seconds +/- 20%
where:
A = binary value of bits 2, 1, and 0
B = binary value of bits 4 and 3

The typematic rate (make codes per second) is 1 for each period.

Bit Typematic Rate +/- 20% Bit Typematic Rate +/- 20%**
00000 30.0 10000 7.5
00001 26.7 10001 0.7
00010 24.0 10010 0.0
00011 21.8 10011 5.5
00100 20.0 10100 5.0
00101 18.5 10101 4.5
00110 17.1 10110 4.0
00111 18.0 10111 4.0
01000 15.0 11000 3.7
01001 13.3 11001 3.3
01010 12.0 11010 3.0
01011 10.9 11011 2.7
01100 10.0 11100 2.5
01101 9.2 11101 2.3
01110 8.6 11110 2.1
01111 8.0 11111 2.0

Figure 5. Typematic Rate

The default values for the system keyboard are as follows:
Typematic rate = 10.9 characters per second +/- 20%
Delay = 500 milliseconds +/- 20%.

The execution of this command stops without change to the existing rate if another command is received instead of the rate/delay value byte.

Keyboards (101- and 102-Key) - October 1990 25


Commands to the System

The following figure shows the commands that the keyboard can send to the system, and their hexadecimal values.

Command Hex Value
Key Detection Error/Overrun 00 (Code Sets 2 and 3)
Keyboard ID 83AB
BAT Completion Code AA
BAT Failure Code FC
Echo EE
Acknowledge (ACK) FA
Resend FE
Key Detection Error/Overrun FF (Code Set 1)

Figure 6. Keyboard Commands to the System

The commands the keyboard sends to the system are described in alphabetic order. They have different meanings when issued by the system.

Acknowledge (Hex FA): The keyboard issues ACK to any valid input other than an Echo, or Resend command. If the keyboard is interrupted while sending ACK, it discards ACK and accepts and responds to the new command.

BAT Completion Code (Hex AA): Following satisfactory completion of the BAT, the keyboard sends hex AA. Any other code indicates a failure of the keyboard.

BAT Failure Code (Hex FC): If a BAT failure occurs, the keyboard sends this code, stops scanning, and waits for a system response or reset.

Echo (Hex EE): The keyboard sends this code in response to an Echo command.

Keyboard ID (Hex 83AB): The keyboard ID consists of two bytes, hex 83AB. The keyboard responds to the Read ID command with ACK, stops scanning, and sends the two ID bytes. The low byte is sent first followed by the high byte. Following the output of the keyboard ID, the keyboard begins scanning. Because of keyboard controller translation, the keyboard ID might not be returned to the system as hex 83AB.

26 Keyboards (101- and 102-Key) - October 1990


Key Detection Error (Hex 00 or FF): The keyboard sends a key detection error character if conditions in the keyboard make it impossible to identify a switch closure. If the keyboard is using scan-code set 1. the code is hex FF. For sets 2 and 3, the code is hex 00.

Overrun (Hex 00 or FF): An overrun character is placed in the keyboard buffer and replaces the last code when the buffer capacity has been exceeded. The code is sent to the system when it reaches the top of the buffer queue. If the keyboard is using scan code set 1, the code is hex FF. For sets 2 and 3, the code is hex 00.

Resend (Hex FE): The keyboard issues a Resend command following receipt of an invalid input, or any input with incorrect parity. If the system sends nothing to the keyboard, no response is required.

Scan Codes

The following figures list the key numbers of the three scan code sets and their hexadecimal values. The system defaults to scan set 2, but can be switched to set 1 or set 3 (see "Select Alternate Scan Codes (Hex F0)" on page 22).

Set 1 Scan-Code Tables

In scan-code set 1, each key is assigned a base scan code and, sometimes, extra codes to generate artificial shift states in the system. The typematic scan codes are identical to the base scan code for each key.

The following figure shows the codes sent for the keys, regardless of any shift states in the keyboard or system. Refer to "Keyboard Layouts" beginning on page 1 to determine the character associated with each key number.

Keyboards (101- and 102-Key) - October 1990 27


Key Number Make Code Break Code Key Number Make Code Break Code
1 29 A9 47 2D AD
2 02 82 48 2E AE
3 03 83 49 2F AF
4 04 84 50 30 B0
5 05 85 51 31 B1
6 06 88 52 32 B2
7 07 87 53 33 B3
8 08 88 54 34 B4
9 09 89 55 35 B5
10 0A 8A 57 38 B6
11 08 8B 58 1D 9D
12 0C BC 60 38 B8
13 0D 8D 61 39 B9
15 0E 8E 62 E0 38 E0 B8
16 0F BF 84 E0 1D E0 9D
17 10 90 90 45 C5
18 11 91 91 47 C7
19 12 92 92 4B CB
20 13 93 93 4F CF
21 14 94 98 48 C8
22 15 95 97 4C CC
23 16 96 98 50 D0
24 17 97 99 52 D2
25 18 98 100 37 B7
28 19 99 101 49 C9
27 1A 9A 102 4D CD
28 1B 9B 103 51 D1
* 29 2B AB 104 53 D3
30 3A BA 105 4A CA
31 1E 9E 106 4E CE
32 1F 9F 108 E0 1C E0 9C
33 20 A0 110 01 01
34 21 A1 112 3B BB
35 22 A2 113 3C BC
38 23 A3 114 3D BD
37 24 A4 115 3E BE
38 25 A5 116 3F BF
39 28 A6 117 40 C0
40 27 A7 118 41 C1
41 2B A8 119 42 C2
** 42 2B AB 120 43 C3
43 1C 9C 121 44 C4
44 2A AA 122 57 D7
** 45 56 D8 123 58 D8
48 2C AG 125 48 C6
Note: * 101-key keyboard only, ** 102-key keyboard only.

Figure 7. Keyboard Scan Codes, Set 1

28 Keyboards (101- and 102-key) - October 1990


The remaining keys send a series of codes that are dependent on the states of the various shift keys (Ctrl, Alt, and Shift), and the state of Num Lock (On or Off). Because the base scan code is identical to another key, an extra code (hex E0) has been added to the base code to make it unique.

Key No. Base Case, or Shift + Num Lock Make/Break Shift Case Make/Break * Num Lock on Make/Break
75 E0 52
/E0 D2
E0 AA E0 52
/E0 D2 E0 2A
E0 2A E0 52
/E0 D2 E0 AA
76 E0 53
/E0 D3
E0 AA E0 53
/E0 D3 E0 2A
E0 2A E0 AA
/E0 D3 E0 AA
79 E0 4B
/E0 CB
E0 AA E0 4B
/E0 CB E0 2A
E0 2A E0 4B
/E0 CB E0 AA
80 E0 47
/E0 C7
E0 AA E0 47
/E0 C7 E0 2A
E0 2A E0 47
/E0 C7 E0 AA
81 E0 4F
/E0 CF
E0 AA E0 4F
/E0 CF E0 2A
E0 2A E0 4F
/E0 CF E0 AA
83 E0 48
/E0 C8
E0 AA E0 48
/E0 C8 E0 2A
E0 2A E0 48
/E0 C8 E0 AA
84 E0 50
/E0 D0
E0 AA E0 50
/E0 D0 E0 2A
E0 2A E0 50
/E0 D0 E0 AA
85 E0 49
/E0 C9
E0 AA E0 49
/E0 C9 E0 2A
E0 2A E0 49
/E0 C9 E0 AA
86 E0 51
/E0 D1
E0 AA E0 51
/E0 D1 E0 2A
E0 2A E0 AA
/E0 D1 E0 AA
89 E0 4D
/E0 CD
E0 AA E0 4D
/E0 CD E0 2A
E0 2A E0 4D
/E0 CD E0 AA
Note: * If the left Shift key is held down. the AA/2A shift make and break are sent with the other scan codes. If the right Shift key is held down. B6/36 ls sent. If both Shift keys are down. both sets of codes are sent with the other scan code.

Figure 8. Keyboard Scan Codes, Set 1

Keyboards (101- and 102-key) - October 1990 29


Key No. Scan Code Make/Break Shift Case Make/Break *
95 E0 35/E0 B5 E0 AA E0 35/E0 B5 E0 2A
Note: * If the left Shift key is held down, the AA/2A shift make and break are sent with the other scan codes. If the right Shift key Is held down. B6/36 is sent. If both Shift keys are down, both sets of codes are sent with the other scan code.

Figure 9. Keyboard Scan Codes, Set 1

Key No. Scan Code Make/Break Ctrl Case, Shift Case Make/Break** Alt Case Make/Break
124 E0 2A E0 37
/E0 B7 E0 AA
E0 37/E0 B7 54/D4

Figure 10. Keyboard Scan Codes, Set 1

Key No. Make Code Ctrl Key Pressed
126 E1 1D 45 E1 9D C5 E0 46 E0 C6
Note: * This key is not typematic. All associated scan codes occur on the make of the key.

Figure 11. Keyboard Scan Codes, Set 1

Set 2 Scan-Code Tables

In scan-code set 2, each key is assigned a unique 8-bit make scan code, which is sent when the key is pressed. Each key also sends a break code when the key is released. The break code consists of 2 bytes, the first of which is the break code prefix, hex F0; the second byte is the same as the make scan code for that key. The typematic scan code for a key is the same as the key's make code.

The following figure shows the codes sent for the keys, regardless of any shift states in the keyboard or system. Refer to "Keyboard Layouts" beginning on page 1 to determine the character associated with each key number.

30 Keyboards (101- and 102-Key) - October 1990


Key Number Make Code Break Code Key Number Make Code Break Code
1 0E F0 0E 47 22 F0 22
2 16 F0 16 48 21 F0 21
3 1E F0 1E 49 2A F0 2A
4 26 F0 26 50 32 F0 32
5 25 F0 25 51 31 F0 31
6 2E F0 2E 52 3A F0 3A
7 36 F0 36 53 41 F0 41
8 3D F0 3D 54 49 F0 49
9 3E F0 3E 55 4A F0 4A
10 46 F0 46 57 59 F0 59
11 45 F0 45 58 14 F0 14
12 4E F0 4E 60 11 F0 11
13 55 F0 55 61 29 F0 29
15 66 F0 56 62 E0 11 E0 F0 11
16 0D F0 0D 64 E0 14 E0 F0 14
17 15 F0 15 90 77 F0 77
18 1D F0 1D 91 6C F0 6C
19 24 F0 24 92 EB F0 6B
20 2D F0 2D 93 69 F0 69
21 2C F0 2C 96 75 F0 75
22 35 F0 35 97 73 F0 73
23 3C FD 3C 98 72 F0 72
24 43 F0 43 99 70 F0 70
25 44 F0 44 100 7C F0 7C
26 4D F0 4D 101 7D F0 7D
27 54 F0 54 102 74 FD 74
28 5B F0 5B 103 7A F0 7A
* 29 5D F0 5D 104 71 F0 71
30 58 F0 58 105 7B F0 7B
31 1C F0 1C 106 79 F0 79
32 1B F0 1B 108 E0 5A E0 F0 5A
33 23 F0 23 110 76 F0 76
34 2B F0 2B 112 05 F0 05
35 34 F0 34 113 06 F0 06
36 33 F0 33 114 04 F0 04
37 3B F0 3B 115 0C FD 0C
38 42 F0 42 116 03 F0 03
39 4B F0 4B 117 0B F0 DB
40 4C F0 4C 118 B3 F0 B3
41 52 F0 52 119 0A F0 0A
** 42 5D F0 5D 120 01 F0 D1
43 5A F0 5A 121 09 F0 09
44 12 F0 12 122 78 F0 78
** 45 61 F0 61 123 07 F0 07
46 1A F0 1A 125 7E F0 7E
Note: * 101-key keyboard only, ** 102-key keyboard only.

Figure 12. Keyboard Scan Codes, Set 2

Keyboards (101- and 102-key) - October 1990 31


The remaining keys send a series of codes that are dependent on the state of the shift keys (Ctrl, Alt, and Shift), and the state of Num Lock (On or Off). Because the base scan code is Identical to another key, an extra code (hex E0) is added to the base code to make it unique.

Key No. Base Case, or Shift + Num Lock Make/Break Shift Case Make/Break * Num Lock on Make/Break
75 E0 70
/E0 F0 70
E0 F0 12 E0 70
/E0 F0 70 E0 12
E0 12 E0 70
/E0 F0 70 E0 F0 12
76 E0 71
/E0 F0 71
E0 F0 12 E0 71
/E0 F0 71 E0 12
E0 12 E0 71
/E0 F0 71 E0 F0 12
79 E0 6B
/E0 F0 6B
E0 F0 12 E0 6B
/E0 F0 6B E0 12
E0 12 E0 6B
/E0 F0 6B E0 F0 12
80 E0 6C
/E0 F0 6C
E0 F0 12 E0 6C
/E0 F0 6C E0 12
E0 12 E0 6C
/E0 F0 6C E0 F0 12
81 E0 69
E0 F0 69
E0 F0 12 E0 69
/E0 F0 69 E0 12
E0 12 E0 69
/E0 F0 69 E0 F0 12
83 E0 75
/E0 F0 75
E0 F0 12 E0 75
/E0 F0 75 E0 12
E0 12 E0 75
/E0 F0 75 E0 F0 12
84 E0 72
/E0 F0 72
E0 F0 12 E0 72
/E0 F0 72 E0 12
E0 12 E0 72
/E0 F0 72 E0 F0 12
85 E0 7D
/E0 F0 7D
E0 F0 12 E0 7D
/E0 F0 7D E0 12
E0 12 E0 7D
/E0 F0 7D E0 F0 12
86 E0 7A
/E0 F0 7A
E0 F0 12 E0 7A
/E0 F0 7A E0 12
E0 12 E0 7A
/E0 F0 7A E0 F0 12
89 E0 74
/E0 F0 74
E0 F0 12 E0 74
/E0 F0 74 E0 12
E0 12 E0 74
/E0 F0 74 E0 F0 12
Note: * If the left Shift key is held down, the F0 12/12 shift make and break are sent with the other scan codes. It the right Shift key is held down, F0/59/59 is sent. If both Shift keys are down, both sets of codes are sent with the other scan code.

Figure 13. Keyboard Scan Codes, Set 2

32 Keyboards (101- and 102-key) - October 1990


Key No. Scan Code Make/Break Shift Case Make/Break *
95 E0 4A/E0 F0 4A E0 F0 12 E0 4A/E0 F0 4A E0 12
Note: * If the left Shift key is held down. the F0 12/12 shift make and break are sent with the other scan codes. If the right Shift key is held down, F0 59/59 is sent. If both Shift keys are down, both sets of codes are sent with the other scan code.

Figure 14. Keyboard Scan Codes, Set 2

Key No. Scan Code Make/Break Ctrl Case, Shift Case Make/Break Alt Case Make/Break
124 E0 12 E0 7C
/E0 F0 7C E0 F0 12
E0 7C/E0 F0 7C 84/F0 84

Figure 15. Keyboard Scan Codes, Set 2

Key No. Make Code Ctrl Key Pressed
126 * E1 14 77 E1 F0 14 F0 77 E0 7E E0 F0 7E
Note: * This key is not typematic. All associated scan codes occur on the make of the key.

Figure 16. Keyboard Scan Codes, Set 2

Keyboards (101- and 102-key) - October 1990 33


Set 3 Scan Code Tables

In scan-code set 3, each key is assigned a unique 8-bit make scan code, which is sent when the key is pressed. Each key also sends a break code when the key is released. The break code consists of two bytes, the first of which is the break-code prefix, hex F0; the second byte is the same as the make scan code for that key. The typematic scan code for a key is the same as the key's make code. With this scan-code set, each key sends only one scan code, and no keys are affected by the state of any other keys.

The following figure shows the codes sent for the keys, regardless of any shift states in the keyboard or system. Refer to "Keyboard Layouts" beginning on page 1 to determine the character associated with each key number.

Key Number Make Code Break Code Default Key State
1 0E F0 0E Typematic
2 16 F0 16 Typematic
3 1E F0 1E Typematic
4 26 F0 26 Typematic
5 25 F0 25 Typematic
6 2E F0 2E Typematic
7 36 F0 36 Typematic
8 3D F0 3D Typematic
9 3E F0 3E Typematic
10 46 F0 46 Typematic
11 45 F0 45 Typematic
12 4E F0 4E Typematic
13 55 F0 55 Typematic
15 66 F0 66 Typematic
16 0D F0 0D Typematic
17 15 F0 15 Typematic
18 1D F0 1D Typematic
19 24 F0 24 Typematic
20 2D F0 2D Typematic
21 2C F0 2C Typematic
22 35 F0 35 Typematic
23 3C F0 3C Typematic
24 43 F0 43 Typematic
25 44 F0 44 Typematic
26 4D F0 4D Typematic
27 54 F0 54 Typematic
28 5B F0 5B Typematic
* 29 5C F0 5C Typematic
30 14 F0 14 Make/Break
Note: * 101-key keyboard only and ** 102-key keyboard only.

Figure 17 (Part 1 of 3). Keyboard Scan Codes, Set 3

34 Keyboards (101- and 102-Key) - October 1990


Key Number Make Code Break Code Default Key State
31 1C F0 1C Typematic
32 1B F0 1B Typematic
33 23 F0 23 Typematic
34 2B F0 2B Typematic
35 34 F0 34 Typematic
36 33 F0 33 Typematic
37 3B F0 3B Typematic
35 42 F0 42 Typematic
39 4B F0 4B Typematic
40 4C F0 4C Typematic
41 52 F0 52 Typematic
** 42 53 F0 53 Typematic
43 5A F0 5A Typematic
44 12 F0 12 Make/Break
** 45 13 F0 13 Typematic
46 1A F0 1A Typematic
47 22 F0 22 Typematic
48 21 FD 21 Typematic
49 2A F0 2A Typematic
50 32 F0 32 Typematic
51 31 F0 31 Typematic
52 3A F0 3A Typematic
53 41 FD 41 Typematic
54 49 F0 49 Typematic
55 4A F0 4A Typematic
57 59 F0 59 Make/Break
58 11 F0 11 Make/Break
60 19 F0 19 Make/Break
61 29 F0 29 Typematic
62 39 F0 39 Make only
64 58 F0 58 Make only
75 67 F0 57 Make only
76 64 F0 64 Typematic
79 B1 F0 61 Typematic
80 6E F0 6E Make only
81 65 F0 65 Make only
83 63 F0 63 Typematic
84 60 F0 60 Typematic
85 6F F0 6F Make only
86 6D F0 6D Make only
89 6A F0 BA Typematic
90 76 F0 76 Make only
91 6C F0 6C Make only
92 6B F0 BB Make only
93 69 FD 59 Make only
95 77 F0 77 Make only
96 75 F0 75 Make only
97 73 F0 73 Make only
98 72 F0 72 Make only
99 70 F0 70 Make only
100 7E F0 7E Make only
Note: * 101-key keyboard only and ** 102-key keyboard only.

Figure 17 (Part 2 of 3). Keyboard Scan Codes, Set 3

Keyboards (101- and 102-Key) - October 1990 35


Key Number Make Code Break Code Default Key State
101 7D F0 7D Make only
102 74 F0 74 Make only
103 7A F0 1A Make only
104 71 F0 71 Make only
105 94 F0 84 Make only
106 1C F0 7C Typematic
108 19 F0 19 Make only
110 08 F0 00 Make only
112 01 F0 07 Make only
113 0F F0 0F Make only
114 17 F0 17 Make only
115 1F F0 1F Make only
116 27 F0 21 Make only
117 2F F0 2F Make only
118 37 F0 31 Make only
119 3F F0 3F Make only
120 47 F0 41 Make only
121 4F F0 4F Make only
122 56 F0 56 Make only
123 5E F0 5E Make only
124 57 F0 51 Make only
125 5F F0 5F Make only
128 62 F0 62 Make only
Note: * 101-key keyboard only and ** 102-key keyboard only.

Figure 17 (Part 3 of 3). Keyboard Scan Codes, Set 3

36 Keyboards (101- and 102-Key) - October 1990


Clock and Data Signals

The keyboard and system communicate over the 'clock' and 'data' lines. The source of each of these lines is an open-collector device on the keyboard that allows either the keyboard or system to force a line to an inactive (low) level. When no communication is occurring, the 'clock' line is at an active (high) level. The state of the 'data' line is held active (high) by the keyboard.

When the system sends data to the keyboard, it forces the 'data' line to an inactive level and allows the 'clock' line to go to an active level.

An inactive signal has a value of at least 0 volts. but not more than +0.7 volts. A signal at the inactive level ls a logical 0. An active signal has a value of at least +2.4 volts, but not more than +5.5 volts. A signal at the active level is a logical 1. Voltages are measured between a signal source and the dc network ground.

When the keyboard sends data to, or receives data from the system, it generates the 'clock' signal to time the data. The system can prevent the keyboard from sending data by forcing the 'clock' line to an inactive level; the 'data' line can be active or inactive during this time.

During the BAT, the keyboard allows the 'clock' and 'data' lines to go to an active level.

Data Stream

Data transmissions to and from the keyboard consist of an 11-bit data stream (Mode 2) sent serially over the 'data' line, The following figure shows the functions of the bits.

Keyboards (101- and 102-Key) - October 1990 37


Bit Function
11 Stop bit (always 1)
10 Parity bit (odd parity)
9 Data bit 7 (most-significant)
8 Data bit 6
7 Data bit 5
6 Data bit 4
5 Data bit 3
4 Data bit 2
3 Data bit 1
2 Data bit 0 (least-significant)
1 Start bit (always 0)

Figure 18. Keyboard Data Stream Bit Definitions

The parity bit is either 1 or 0, and the 8 data bits, plus the parity bit, always have an odd number of 1's.

Note: Mode 1 is a 9-bit data stream that does not have a parity bit or stop bit, and the start bit is always 1.

Data Output

When the keyboard is ready to send data, it first checks for a keyboard-inhibit or system request-to-send status on the 'clock' and 'data' lines. If the 'clock' line is inactive (low), data is stored in the keyboard buffer. If the 'clock' line is active (high) and the 'data' line is inactive (request-to-send), data is stored in the keyboard buffer, and the keyboard receives system data.

If the 'clock' and 'data' lines are both active, the keyboard sends the 0 start bit, 8 data bits, the parity bit, and the stop bit. Data is valid before the trailing edge and beyond the leading edge of the clock pulse. During transmission, the keyboard checks the 'clock' line for an active level at least every 60 milliseconds. If the system lowers the 'clock' line from an active level after the keyboard starts sending data, a condition known as line contention occurs, and the keyboard stops sending data. If line contention occurs before the leading edge of the 10th clock signal (parity bit), the keyboard buffer returns the 'clock' and 'data' lines to an active level. If contention does not occur by the 10th clock signal, the keyboard completes the transmission. Following line contention, the system may or may not request the keyboard to resend the data.

Following a transmission, the system can inhibit the keyboard until the system processes the input, or until it requests that a response be sent.

38 Keyboards (101- and 102-Key) - October 1990


Data Input

When the system is ready to send data to the keyboard, it first checks to see if the keyboard is sending data. if the keyboard is sending, but has not reached the 10th 'clock' signal, the system can override the keyboard output by forcing the keyboard 'clock' line to an inactive (low) level. If the keyboard transmission is beyond the 10th 'clock' signal, the system must receive the transmission.

If the keyboard is not sending, or if the system elects to override the keyboard's output, the system forces the keyboard 'clock' line to an inactive level for more than 60 microseconds while preparing to send data. When the system is ready to send the start bit (the 'data' line will be inactive), it allows the 'clock' line to go to an active (high) level.

The keyboard checks the state of the 'clock' line at intervals of no more than 10 milliseconds. If a system request-to-send signal (RTS) is detected, the keyboard counts 11 bits. After the 10th bit, the keyboard checks for an active level on the 'data' line, and if the line is active, forces it inactive and counts one more bit. This action signals the system that the keyboard has received its data. On receipt of this signal, the system returns to a ready state, in which it can accept keyboard output. or goes to the inhibited state until it is ready.

If the keyboard 'data' line is found at an inactive level following the 10th bit, a framing error has occurred, and the keyboard continues to count until the 'data' line becomes active. The keyboard then makes the 'data' line inactive and sends a Resend command.

Each system command or data transmission to the keyboard requires a response from the keyboard before the system can send its next output. The keyboard will respond within 20 milliseconds unless the system prevents keyboard output. If the keyboard response is invalid or has a parity error, the system sends the command or data again. However, two-byte commands require special handling. If hex F3 (Set Typematic Rate/Delay), hex F0 (Select Alternate Scan Codes), or hex ED (Set/Reset Mode Indicators) have been sent and acknowledged, and the value byte has been sent but the response is invalid or has a parity error, the system resends both the command and the value byte.

Keyboards (101- and 102-key) - October 1990 39


Encode and Usage

The keyboard routine, provided in the ROM BIOS, is responsible for converting the keyboard scan codes into what is called Extended ASCII. The extended ASCII codes returned by the ROM routine are mapped to the U.S. English keyboard layout. Some operating systems might make provisions for alternate keyboard layouts by providing an interrupt replacement routine, which resides in the read/write memory. This section discusses only the ROM routine.

Extended ASCII encompasses one-byte character codes with possible values of 0 to 255, an extended code for certain extended keyboard functions, and functions handled within the keyboard routine or through interrupts.

40 Keyboards (101- and 102-Key) - October 1990


The character codes are passed through the BIOS keyboard routine to the system or application program. In the following figure "-1" means the combination is suppressed in the keyboard routine. The codes are returned in the AL register.

Key Base Case Uppercase Ctrl Alt
1 ` ~ -1 (*)
2 1 ! -1 (*)
3 2 @ Null(000) (*) (*)
4 3 # -1 (*)
5 4 $ -1 (*)
6 5 % -1 (*)
7 6 ^ RS(030) (*)
8 7 & -1 (*)
9 8 * -1 (*)
10 9 ( -1 (*)
11 0 ) -1 (*)
12 - _ -1 (*)
13 = + -1 (*)
15 Backspace (008) Backspace (008) Del (127) (*)
16 tab (009) reverse tab (*) (*) (*)
17 q Q DC1(017) (*)
18 w W ETB(023) (*)
19 e E ENQ(005) (*)
20 r R DC2(018) (*)
21 t T DC4(020) (*)
22 y Y EM(025) (*)
23 u U NAK(021) (*)
24 i I HT(009) (*)
25 o 0 SI(015) (*)
26 p P DLE(0l8) (*)
27 [ { Esc(027) (*)
28 ] } GS(029) (*)
29 \ | FS(028) (*)
30 Caps Lock -1 -1 -1 -1
31 a A SOH(001) (*)
32 s S DC3(019) (*)
33 d D EOT(004) (*)
34 f F ACK(006) (*)
35 g G BEL(007) (*)
36 h H BS(008) (*)
37 j J LF(010) (*)
38 k K VT(011) (*)
39 l L FF(012) (*)
40 ; : -1 (*)
Note: (*) Refer to "Extended Functions" on page 43. (**) Refer to "Special Handling" on page 47.

Figure 19 (Part 1 of 2). Character Codes

Keyboards (101- and 102-Key) - October 1990 41


Key Base Case Uppercase Ctrl Alt
41 ' " -1 (*)
43 CR(013) CR(013) LF(010) (*)
44 Shift (Left) -1 -1 -1 -1
46 z Z SUB(026) (*)
47 x X CAN(024) (*)
48 c C ETX(006) (*)
49 v V SYN(022) (*)
50 b B STX(002) (*)
51 n N SO(014) (*)
52 m M CR(013) (*)
53 , < -1 (*)
54 . > -1 (*)
55 / ? -1 (*)
57 Shift (Right) -1 -1 -1 -1
58 Ctrl (Left) -1 -1 -1 -1
60 Alt (Left) -1 -1 -1 -1
61 Space Space Space Space
62 Alt (Right) -1 -1 -1 -1
64 Ctrl (Right) -1 -1 -1 -1
90 Num Lock -1 -1 -1 -1
95 / / (*) (*)
100 * * (*) (*)
105 - - (*) (*)
106 + + (*) (*)
108 Enter Enter LF(010) (*)
110 Esc Esc Esc (*)
112 Null (*) Null (*) Null (*) Null (*)
113 Null (*) Null (*) Null (*) Null (*)
114 Null (*) Null (*) Null (*) Null (*)
115 Null (*) Null (*) Null (*) Null (*)
116 Null (*) Null (*) Null (*) Null (*)
117 Null (*) Null (*) Null (*) Null (*)
118 Null (*) Null (*) Null (*) Null (*)
119 Null (*) Null (*) Null (*) Null (*)
120 Null (*) Null (*) Null (*) Null (*)
121 Null (*) Null (*) Null (*) Null (*)
122 Null (*) Null (*) Null (*) Null (*)
123 Null (*) Null (*) Null (*) Null (*)
125 Scroll Lock -1 -1 -1 -1
126 Pause(**) Pause(**) Pause(**) Pause(**)
Note: (*) Refer to "Extended Functions" on page 43. (**) Refer to "Special Handling" on page 47.

Figure 19 (Part 2 of 2). Character Codes

42 Keyboards (101- and 102-Key) - October 1990


The following figure is a list of keys that have meaning only in Num Lock, Shift, or Ctrl states.

The Shift key temporarily reverses the current Num Lock state.

Key Num Lock* Base Case Alt Ctrl
91 7 Home (*) -1 Clear Screen
92 4 cursor left (*) -1 Reverse Word(*)
93 1 End (*) -1 Erase to EOL(*)
96 8 cursor up (*) -1 (*)
97 5 (*) -1 (*)
98 2 cursor down (*) -1 (*)
99 0 Ins -1 (*)
101 9 Page Up (*) -1 Top of Text and Home
102 6 cursor right (*) -1 Advance Word (*)
103 3 Page Down (*) -1 Erase to EOS (*)
104 . Delete (*,**) (**) (**)
105 - Sys Request -1 -1
106 + + (*) -1 -1
Note: (*) Refer to "Extended Functions." (**) Refer to "Special Handling" on page 47.

Figure 20. Special Character Codes

Extended Functions

For certain functions that cannot be represented by a standard ASCII code, an extended code is used. A character code of 000 (null) is returned in AL. This indicates that the system or application program should examine a second code, which indicates the actual function. Usually, but not always, this second code is the scan code of the primary key that was pressed. This code is returned in AH.

Keyboards (101- and 102-Key) - October 1990 43


The following figure is a list of the extended codes and their functions.

Second Code Function
1 Alt Esc
8 Null Character
14 Alt Backspace
15  (Back-tab)
16-25 Alt Q, W, E, R, T, Y, U, I, O, P
26-28 Alt [ ] CR (Carriage Return)
30-38 Alt A, S, D, F, G, H, J, K, L
39-41 Alt ; ' '
43 Alt \
44-50 Alt Z, X, C, V, B, N, M
51-53 Alt , . /
55 Alt Keypad *
59-68 F1 to F10 Function Keys (Base Case)
71 Home
72 (Cursor Up)
73 Page Up
74 Alt Keypad -
75 (Cursor Left)
76 Center Cursor
77 (Cursor Right)
78 Alt Keypad +
79 End
80 (Cursor Down)
81 Page Down
82 Ins (Insert)
83 Del (Delete)
84-93 Shift F1 to F10
94-103 Ctrl F1 to F10
104-113 Alt F1 to F10
114 Ctrl PrtSc (Start/Stop Echo to Printer)
115 Ctrl left (Reverse Word)
116 Ctrl right (Advance Word)
117 Ctrl End (Erase to End of Line-EOL)
118 Ctrl PgDn (Erase to End of Screen-EOS)
119 Ctrl Home (Clear Screen and Home)
120-131 Alt 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, = keys 2-13
132 Ctrl PgUp (Top 25 Lines of Text and Cursor Home)
133-134 F11, F12
135-136 Shift F11, F12
137-138 Ctrl F11, F12
139-140 Alt F11, F12

Figure 21 (Part 1 of 2). Keyboard Extended Functions

44 Keyboards (101- and 102-Key) - October 1990


Second Code Function
141 Ctrl Up/8
142 Ctrl Keypad -
143 Ctrl Keypad 5
144 Ctrl Keypad +
145 Ctrl Down/2
146 Ctrl Ins/0
147 Ctrl Del/.
148 Ctrl Tab
149 Ctrl Keypad /
150 Ctrl Keypad *
151 Alt Home
152 Alt Up
153 Alt Page Up
155 Alt Left
157 Alt Right
159 Alt End
160 Alt Down
161 Alt Page Down
162 Alt Insert
163 Alt Delete
164 Alt Keypad /
165 Alt Tab
166 Alt Enter

Figure 21 (Part 2 of 2}. Keyboard Extended Functions

Shift States

Most shift states are handled within the keyboard routine and are not apparent to the system or application program. In any case, the current status of active shift states is available by calling an entry point in the BIOS keyboard routine. The following keys result in altered shift states:

Shift: This key temporarily shifts keys 1 through 13, 16 through 29, 31 through 41, and 46 through 55 to uppercase (base case if in Caps Lock state). Also, the Shift key temporarily reverses the Num Lock or non-Num Lock state of keys 91 through 93, 96, 98, 99, and 101 through 104.

Ctrl: This key temporarily shifts keys 3, 7, 12, 15 through 29, 31
through 39, 43, 46 through 52, 75 through 89, 91 through 93, 95 through 108, 112 through 124, and 126 to the Ctrl state. The Ctrl key is also used with the Alt and Del keys to initiate the system-reset function, with the Scroll Lock key to initiate the break function, and with the Num Lock key to initiate the pause function. The system-reset, break, and pause functions are described under "Special Handling" on page 47.

Keyboards (101- and 102-key) - October 1990 45


Alt: This key temporarily shifts keys 1 through 29, 31 through 43, 46 through 55, 75 through 89, 95, 100, and 105 through 124 to the Alt state. The Alt key is also used with the Ctrl and Del keys to cause a system reset.

The Alt key also allows the user to enter any character code from 1 to 255. The user holds down the Alt key and types the decimal value of the characters desired on the numeric keypad (keys 91 through 93, 96 through 99, and 101 through 103). The Alt key is then released. If the number is greater than 255, a modulo-256 value is used. This value is interpreted as a character code and is sent through the keyboard routine to the system or application program. Alt is handled internally in the keyboard routine.

Caps Lock: This key shifts keys 17 through 26, 31 through 39, and 46 through 52 to uppercase. When Caps Lock is pressed again, it reverses the action. Caps Lock is handled internally in the keyboard routine. When Caps Lock is pressed, it changes the Caps Lock mode indicator. If the indicator was on, it goes off; if it was off, it goes on.

Scroll Lock: When interpreted by appropriate application programs, this key indicates that the cursor-control keys will cause windowing over the text rather than moving the cursor. When the Scroll Lock key is pressed again, it reverses the action. The keyboard routine simply records the current shift state of the Scroll Lock key. It is the responsibility of the application program to perform the function. When Scroll Lock is pressed, it changes the Scroll Lock mode indicator. If the indicator was on, it goes off; if it was off, it goes on.

Num Lock: This key shifts keys 91 through 93, 96 through 99, and 101 through 104 to uppercase. When Num Lock is pressed again, it reverses the action. Num Lock is handled internally in the keyboard routine. When Num Lock is pressed, it changes the Num Lock mode indicator. If the indicator was on, it goes off; if it was off, it goes on.

Shift Key Priorities and Combinations: If combinations of the Alt, Ctrl, and Shift keys are pressed and only one is valid, the priority is: Alt key first, Ctrl key second, and Shift key third. The only valid combination is Alt and Ctrl, which is used in the system-reset function.

46 Keyboards (101- and 102-Key) - October 1990


Special Handling

System Reset

The combination of Alt, Ctrl, and Del keys results in the keyboard routine that starts a system reset or restart. System reset is handled by system BIOS.

Break

The combination of the Ctrl and Pause/Break keys results in the keyboard buffer being cleared. The keyboard routine then signals interrupt 1B, and the extended characters AL = hex 00, and AH = hex 00 are stored in the buffer.

Pause

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 internally in the keyboard routine.

Print Screen

The Print Screen key results in an interrupt invoking the print-screen routine. This routine works in the alphanumeric or graphics mode, with unrecognizable characters causing blanks.

Keyboards (101- and 102-Key) - October 1990 47


System Request

When the System Request (Alt and Print Screen) key is pressed, a hex 8500 is placed in AX, and an interrupt hex 15 is executed. When the System Request key is released, a hex 8501 is placed in AX, and
another interrupt hex 15 is executed. If an application is to use System Request, the following rules must be observed:
Save the previous address.
Overlay interrupt vector hex 15.
Check AH for a value of hex 85:
If yes, process may begin.
If no, go to previous address.

The application program must preserve the value in all registers, except AX, on return. System Request is handled internally in the keyboard routine.

Other Characteristics

The keyboard routine does its own buffering, and the keyboard buffer is large enough to support entries by a fast typist. However, If a key is pressed when the buffer is full, the key is ignored and the alarm sounds.

The keyboard routine also suppresses the typematic action of the following keys: Ctrl, Shift, Alt, Num Lock, Scroll Lock, Caps Lock, and Ins.

During each interrupt hex 09 from the keyboard, an interrupt hex 15, function (AH) = hex 4F is generated by the BIOS after the scan code is read from the keyboard adapter. The scan code is passed in the AL register with the carry flag set. This allows an operating system to intercept each scan code before it is handled by the interrupt hex 09 routine and change or act on the scan code. If the carry flag is changed to 0 on return from interrupt hex 15, the scan code is ignored by the interrupt handler.

48 Keyboards (101- and 102-key) - October 1990


Cables and Connectors

The keyboard cable connects to the system with a 6-pin miniature DIN connector and to the keyboard with a 6-position connector. The following figures show the pin configuration and signal assignments.

See PDF for diagrams of the system and keyboard connectors

DIN Connector Pins Signal Name Keyboard Connector Pins
1 +KBD DATA B
2 Reserved F
3 Ground C
4 + 5.0 Vdc E
5 + KBD CLK D
6 Reserved A
Shield Frame Ground Shield

Figure 22. Keyboard Connectors Signal and Voltage Assignments

Keyboards (101- and 102-Key) - October 1990 49


Specifications

Specifications for the keyboard are as follows:

Power Requirements

  • +5 Vdc +/- 10%
  • 275 mA.

Size

  • Length: 492 millimeters (19.4 inches)
  • Depth: 210 millimeters (8.3 inches)
  • Height: 58 millimeters (2.3 inches), legs extended.

Weight

  • 2.25 kilograms (5.0 pounds).

50 Keyboards (101- and 102-Key) - October 1990

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License