Vintage PC pages
Home -> Vintage PCs -> IBM 1397000 Keyboard

The IBM 1397000 Keyboard

Note: You need a browser capable of displaying SVG images to see the keyboard layouts.

The IBM 1397000 keyboard (described on the box as the "IBM Personal System/2 Host Connected Keyboard") is a 122-key Model M terminal emulator keyboard.

This particular model uses the US layout and has a detachable SDL cable.

Some serial numbers associated with this keyboard are:

1397000
The keyboard part number
1397050
The keyboard FRU number
1396400
The part number for the complete package (keyboard plus driver floppy)
1396063
Controller PCB
1396064
6805 Microcontroller

Identity

When sent an identify command (0xF2), the keyboard returns the byte sequence 0xAB 0x86.

Scancodes

The keys on the 1397000 are laid out like this:

The keyboard supports all three IBM scancode sets. The scancodes it returns are:

Set 1

Notes:

Set 1 is not intended to be translated by the keyboard controller. If you do turn translation on, you get these codes:

Notes:

Set 2

Notes:

These scancodes are expected to be translated by the keyboard controller, producing the same output that you'd get from (untranslated) Set 1:

Set 3

Set 3 uses the same position-based coding as the 122-key terminal keyboards and the 84-key AT keyboard. It is the only set to distinguish between the key position above Return (where Backslash is on a 101-key keyboard) and the one to the left of Return (where Hash is on a 102-key keyboard).

Notes:

After translation by the keyboard controller, these codes become:

So, here's my grand unified list of Set 3 scancodes, sorted by number.

Set 3 code Translated Set 3 code 122-key 101 / 102-key
Key position Set 2 code Set 1 code Key position Set 2 code Set 1 code
0143F9 (left function key block) 5C75
02--Not assigned (why?) ----
033FF5 (left function key block) 5374
043DF3 (left function key block) 3972
053BF1 (left function key block) 19 / 8471 / 54
063CF2 (left function key block) 5F76
0758F1 (top function key block) 053B same053B
0864F13 (top function key block) 1F5B Esc7601
0944F10 (left function key block) 486C
0A42F8 (left function key block) 6F6F
0B40F6 (left function key block) 506D
0C3EF4 (left function key block) 77 / E17745 / E145
0D0FTab 0D0F same0D0F
0E29Key to the left of 1 0E29 same0E29
0F59F2 (top function key block) 063C same063C
1065F14 (top function key block) 275C
1138Left Ctrl 141D same141D
122ALeft Shift 122A same122A
1370\ (if adjacent to left Shift) 6156 same6156
141DCaps Lock 583A same583A
1510Q 1510 same1510
16021 1602 same1602
175AF3 (top function key block) 043D same043D
1866F15 (top function key block) 5E5D
1971Left Alt 1138 same1138
1A2CZ 1A2C same1A2C
1B1FS 1B1F same1B1F
1C1EA 1C1E same1C1E
1D11W 1D11 same1D11
1E032 1E03 same1E03
1F5BF4 (top function key block) 0C3E same0C3E
2067F16 (top function key block) 5E63
212EC 212E same212E
222DX 222D same222D
2320D 2320 same2320
2412E 2412 same2412
25054 2505 same2505
26043 2604 same2604
275CF5 (top function key block) 033F same033F
2868F17 (top function key block) 0864
2939Spacebar 2939 same2939
2A2FV 2A2F same2A2F
2B21F 2B21 same2B21
2C14T 2C14 same2C14
2D13R 2D13 same2D13
2E065 2E06 same2E06
2F5DF6 (top function key block) 0B40 same0B40
3069F18 (top function key block) 1065
3131N 3131 same3131
3230B 3230 same3230
3323H 3323 same3323
3422G 3422 same3422
3515Y 3515 same3515
36076 3607 same3607
375EF7 (top function key block) 8341 same8341
386AF19 (top function key block) 1866
3972Right Alt E011E038 sameE011E038
3A32M 3A32 same3A32
3B24J 3B24 same3B24
3C16U 3C16 same3C
3D087 3D08 same3D08
3E098 3E09 same3E09
3F5FF8 (top function key block) 0A42 same0A42
406BF20 (top function key block) 2067
4133< 4133 same4133
4225K 4225 same4225
4317I 4317 same4317
4418O 4418 same4418
450B0 450B same450B
460A9 460A same460A
4760F9 (top function key block) 0143 same0143
486CF21 (top function key block) 2868
4934> 4934 same4934
4A35? 4A35 same4A35
4B26L 4B26 same4B26
4C27: 4C27 same4C27
4D19P 4D19 same4D19
4E0C- 4E0C same4E0C
4F61F10 (top function key block) 0944 same0944
506DF22 (top function key block) 3069
5173Unused position under right Shift 5173 same5173
5228@ 5228 same5228
5374\ (if adjacent to Enter) 5D2B same5D2B
541A[ 541A same541A
550D+ 550D same550D
5662F11 (top function key block) 7857 same7857
576EF23 (top function key block) 406A Print Screen / SysRQE07C / 84 E037 / 54
583ARight Ctrl E014E01D sameE014E01D
5936Right Shift 5936 same5936
5A1CEnter 5A1C same5A1C
5B1B] 5B1B same5B1B
5C75\ (if above Enter) 5D2B same5D2B
5D2B\ (if adjacent to Backspace) 6A7D same6A7D
5E63F12 (top function key block) 0758 same0758
5F76F24 (top function key block) 406B Scroll Lock7E46
6055Cursor down E072E050 sameE072E050
6156Cursor left E06BE04B sameE06BE04B
6277Key between cursor keys E06CE047 Pause / Break77 / E07E45 / E046
6378Cursor up E075E048 sameE075E048
64793x2 block, lower row, left column (End) E069E04F (Delete)E071E053
657A3x2 block, lower row, middle column (Insert) E070E052 (End)E069E04F
660EBackspace 660E same660E
677B3x2 block, upper row, left column (PA1) 175A (Insert)E070E052
687CUnused position under keypad 0 687C same687C
694FKeypad 1 694F same694F
6A7DCursor right E074E04D sameE074E04D
6B4BKeypad 4 6B4B same6B4B
6C47Keypad 7 6C47 same6C47
6D7E3x2 block, lower row, right column (Delete) E071E053 (PgDn)E07AE051
6E7F3x2 block, upper row, middle column (PgUp) E07DE049 (Home)E06CE047
6F6F3x2 block, upper row, right column (PgDn) E07AE051 (PgUp)E07DE049
7052Keypad 0 7052 same7052
7153Keypad . 7153 same7153
7250Keypad 2 7250 same7250
734CKeypad 5 734C same734C
744DKeypad 6 744D same744D
7548Keypad 8 7548 same7548
7601Keypad top left corner (Esc) 7601 (Num Lock)7746
7745Keypad top row, second column (NumLk / ScrLk) 7E / 7746 / 45 (Keypad /)E04AE035
7857Unused position under keypad Enter 6378 same6378
794EKeypad Enter E05AE01C sameE05AE01C
7A51Keypad 3 7A51 same7A51
7B4AKeypad - 7B4A Unused position under Keypad + 6D7E
7C37Keypad + 794E same794E
7D49Keypad 9 7D49 same7D49
7E46Keypad top row, third column (*) 7C37 same7C37
8341F7 (left function key block) E07CE037
8454Keypad top right hand corner (/) E04A / E07EE035 / E046 (keypad -)7B4A
And the following six aren't present on the 122-key board, but are included for completeness:
8B8B Left WindowsE01FE05B
8C8C Right WindowsE027E05C
8D8D MenuE02FE05D
nonenone WakeE05EE063
nonenone SleepE03FE05F
nonenone PowerE037E05E

A minor oddity: A 122-key IBM board in set 3 can return 127 scancodes. These are all in a nice consecutive 7-bit range, except for two. The key that (from diagrams) you'd expect to send 02h, sends 83h. And the 7Fh key sends 84h. If the microcontroller on the motherboard is translating scancodes, it treats these pairs as identical: both 02h and 83h get mapped to 41h, and both 7Fh and 84h get mapped to 54h.

Possibly these two keys had some special meaning on the 3270-series terminals where set 3 scancodes seem to have originated.

Under Windows 3.0

The keyboard is supplied with a driver for Windows 3.0, which must be installed by editing SYSTEM.INI. The driver makes scancodes from the extra keys on the keyboard register as Windows virtual keys.

Oddly, the VK codes returned by function keys F17-F24 do not match the ones defined in <windows.h>. This appears to be because VK_F17 and VK_F18 have different definitions in the Windows SDK and DDK, and VK_F19 and up just aren't there. The same mismatch on VK_F17 and VK_F18 is still present in the Windows 98 DDK. There is a brief mention in the DDK documentation that the 'wrong' F17 and F18 are specific to the Olivetti M24 102-key keyboard, but that still doesn't explain why the same symbols were used for different keycodes, or why the DDK is missing VK_F19 to VK_F24.

KeyVK_ code in Windows 3.1 SDKDriver returns
F170x800xE0 (Olivetti F17)
F180x810xE1 (Olivetti F18)
F190x820x8A
F200x830x8B
F210x840x8C
F220x850x8D
F230x860x8E
F240x870x8F

Driver Internals

Internally, the driver is very similar to the one that comes with Windows 3.0. The points of difference are:

Under Windows NT / 2000 / XP

The extra keys (F13-F24 and so on) return scancodes under Windows NT 3.5 and later. However, the VK_ codes they use do not match the keycaps. This can be corrected with replacement layout DLLs. Suitable US/UK files are available here, with instructions how to generate your own in other languages.

Under Linux

The following scripts allow the extra keys to be used under Linux (tested on Ubuntu 9.10, in X11):

  1. keycodes_1227t: Assigns Linux keycodes to the extra keys. Put this in (say) /usr/local/sbin:
    sudo install -m 755 keycodes_1227t /usr/local/sbin
    and then add a line to /etc/rc.local to call it, just before the "exit 0":
    # By default this script does nothing.

    /usr/local/sbin/keycodes_1227t
    exit 0
  2. xmodmap should be saved in your home directory and renamed to .Xmodmap, with a leading dot and a capital X. The next time you log in, you should be asked whether to load the file. Highlight the ".Xmodmap" file and click "Load".
  3. You will probably also need to add the option atkbd.softraw=0 to the kernel command line. Edit /boot/grub/menu.lst and add it to the end of the line that starts kernel.

If this worked, you should be able to run xev and see keypresses on the extra keys being detected.


John Elliott 21 July 2011.