Vintage PC pages
Home -> Vintage PCs -> Key Tronic KB 3270 Plus Keyboard

Key Tronic KB 3270 Plus Keyboard

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

The KB 3270 Plus is a 122-key keyboard, for use (like the IBM 1397000) as a terminal emulation keyboard on the PC. Judging by comments in the published source code, it appears that this, or a similar model of keyboard, was the one used when support for function keys F13-F24 was added to Windows NT 3.5.

Unlike the IBM keyboard, the KB 3270 Plus supports both AT and XT communication protocols. It also has three different layouts. Both layout and protocol are selected using DIP switches.

The three layouts are:

A number of alternative keycaps are provided for the three layouts. This image shows it with the 'Enhanced 101' keycaps.

In addition to the standard layouts, the keyboard can also have a custom layout; it is supplied with two utilities, SE to edit a set of scancodes, and SL to load them into the keyboard. I believe that this ability is what distinguishes the KB 3270 Plus from the vanilla KB 3270.

The keyboard has a 5-pin XT / AT style connector. Mine was also supplied with a passive converter allowing it to be connected to a PS/2 socket.

Hardware

The keyswitches, as usual for a Key Tronic keyboard, are capacitative foam-on-foil, and will doubtless succumb in time to perished foam.

The controller is an 8051. Other components on the board include an 8k ROM containing the firmware, 8k of static RAM, a beeper, and a chip marked C5145B connected to the key matrix, which I presume handles the capacitative sensing.

Unlike on an IBM / Unicomp keyboard, there are no 'hidden' key positions without keys above them.

LEDs

The keyboard has the usual three LEDs. These are set in the keys they apply to, rather than in a separate panel.

DIP switches

The keyboard has eight DIP switches:

Switch 1
Switch on to use XT protocol, off for AT.
Switch 2
Switch on to select IRMA scancodes.
Switch 3
Switch on to select Enhanced 101 / 102 mode.

Switches 4 and 5 alter behaviour in the Enhanced 101 / 102 mode:

Switch 4
Switch on to filter out E0 xx scancodes.
Switch 5
Switch on for international layout (Enhanced 102), off for US layout (Enhanced 101).
Switches 6, 7
Unused.
Switch 8
Switch on to enable key click.

Keycaps

The KB 3270 Plus is supplied with enough keycaps to set up three different layouts, corresponding to the three supported sets of scancodes. The first layout is the 'Native' layout:

The 'IRMA' layout replaces the keys highlighted in blue and cyan. The ten keys on the left become F1-F10, PA3 becomes PrtSc, and the bottom row of the main area becomes Alt / Ctrl / Space / Reset [Dev Cncl] / Enter:

The 'Enhanced 101 / 102' layouts replace the keys highlighted in green and cyan. The bottom row of the main area becomes Ctrl / Alt / Space / Alt / Ctrl, and the six keys above the arrows become Insert / Home / PgUp and Delete / End / PgDn:

Identity

In the 'Enhanced 101 / 102' mode, the keyboard will respond to an identify command (0xF2). It returns the byte sequence 0xAB 0x83 (which may be translated to 0xAB 0x41). In other words, it identifies as a 102-key keyboard, not a 122-key.

If it is in 'Native' or 'IRMA' mode, the keyboard will respond with a NAK (0FEh).

Scancodes

Internally, the keyboard firmware uses a number from 1-9 to select which layout is in use:

  1. Enhanced 101 / 102: Set 1
  2. Enhanced 101 / 102: Set 2
  3. Enhanced 101 / 102: Set 3
  4. Native: Set 1
  5. Native: Set 2
  6. IRMA: Set 1
  7. IRMA: Set 2
  8. Undefined: Set 2 (See the DA 41 xx command below for more details)
  9. Undefined: Set 1

For a given layout, the keyboard will default to using scancode set 1 if the protocol is set to XT, or set 2 if it's set to AT.

If the computer sends a PS/2-type command (F0 xx) to the keyboard to select scancode set 1-3, this will, by the same token, put it in enhanced 101 / 102 mode. Native or IRMA mode cannot be selected by this method — see command DA 41 xx below.

The controller ROM contains nine scancode tables, but there is not a 1:1 match between these and the internal mode numbers. The nine internal tables are:

  1. Enhanced 101: Set 1
  2. Enhanced 101: Set 2
  3. Enhanced 101 / 102: Set 3
  4. Native: Set 1
  5. Native: Set 2
  6. IRMA: Set 1
  7. IRMA: Set 2
  8. Enhanced 102: Set 1
  9. Enhanced 102: Set 2

Throughout this section, keys highlighted orange return different scancodes from the ones in that position on a true blue IBM terminal emulation keyboard. Frequently (particularly with the top row of function keys) this takes the form of a key returning its Set 3 scancode even in Set 2.

XT Protocol / Set 1

Native mode

IRMA mode

Enhanced 101 mode (Switch 5 off: US)

Notes:

Enhanced 102 mode (Switch 5 on: International)

Notes:

AT Protocol / Set 2

In the AT protocol, the keyboard returns the following scancodes. If the keyboard controller in the host PC has translation turned on, then they will be translated to the 'XT' / 'Set 1' scancodes listed above.

Native mode

IRMA mode

Enhanced 101 mode (Switch 5 off: US)

Notes:

Enhanced 101 mode (Switch 5 on: International)

Set 3

In "Enhanced 101" and "Enhanced 102" modes, the keyboard supports Scancode Set 3. The scancodes are identical in both modes:

Only the keys shaded in grey return key-up scancodes.

Two keys differ from the behaviour of a real IBM terminal keyboard, or an IBM terminal emulator keyboard in set 3:

If the keyboard controller has translation turned on, these come out as:

Scancodes as a spreadsheet

All scancodes, listed in spreadsheet format.

User Defined Scancodes

It is possible to program the keyboard with user-defined scancodes. When setting these up, the keys are referred to using a numbering scheme that doesn't correspond to any particular scancode set:

The numbering is not contiguous; the gaps tend to correspond to spaces under double-sized keys, or gaps where an extra key could be inserted.

Commands

In addition to the usual PS/2 commands, the keyboard also accepts KB3270-specific commands. All of them begin with the hex byte 0DAh.

When the keyboard is using the PS/2 protocol, each command byte will be acknowledged with the standard 0FAh, as with other PS/2 commands.

CommandDescription
DA 41 nn Select scancode set. nn should be one of:
01: Native
02: IRMA
04: Undefined mode
08: Enhanced 101, set 1
10: Enhanced 101, set 2
20: Enhanced 101, set 3
40: User-defined set loaded with DA 43 command(s).

As far as I can make out from the keyboard's microcontroller ROM and from experimentation, switching to what I've called 'undefined mode' sets an internal variable in the keyboard firmware, but doesn't select a new scancode set. The existing one appears to continue in use, but I suspect further undefined behaviour may creep in if a subsequent operation happens to change the controller's "dptr" register.

It may be that this mode was avoided because when queried using the DA 44 command below, it would return 84h, one of the two values above 80h which is translated (to 54h) by the keyboard controller.

DA 42 xx Set the delay in milliseconds between each scancode in a multi-scancode macro. Followed by a single byte, giving the delay.
DA 43 keynum flags count scancodes

Define the scancode returned by a key.

keynum is the key number to define, using the numbering given above.

flags give the shift state and other information:

Bits 0-1: Shift state
		0=Unshifted
		1=Shift
		2=Alt
		3=Ctrl
Bit 2: Set if key repeats

count is the number of scancodes that follow.

scancodes are the scancodes the key should return when pressed.

DA 44 Return identity and current scancode set. This is used by the supplied software to detect a KB3270 keyboard. It returns three bytes:
DA xx yy

xx appears to be a fixed keyboard ID or firmware version. On my KB3270 it is 48h; if the keyboard controller is translating scancodes, this is translated to 6Ch.

yy gives the current scancode set:

Bit 0: Native
Bit 1: IRMA
Bit 2: Undefined mode
Bit 3: Enhanced 101 mode, set 1
Bit 4: Enhanced 101 mode, set 2
Bit 5: Enhanced 101 mode, set 3
Bit 6: User-defined scancode set
Bit 7: Always set (so the value returned is in the range 80h-0FFh. This
       means that unless it's 83h or 84h, it will not be translated by
       the keyboard controller).
DA 45 Clear any user-defined scancodes, reverting to the native layout.

The following IBM-compatible commands are also handled:

CommandDescription
ED xx Set LEDs.
EEDiagnostic echo.
F0 xxGet/set scancode set. F0 00 (get scancode set) can return the following values:
Code   Translated  Meaning
01     43          ENH101 mode, set 1
02     41          ENH101 mode, set 2
03     3F          ENH101 mode, set 3
04     3D          Native mode, set 1
05     3B          Native mode, set 2
06     3C          IRMA mode, set 1
07     58          IRMA mode, set 2
08     64          Undefined mode, set 2
09     44          Undefined mode, set 1
F0 01 - F0 03 will switch into ENH101 mode and select the requested set. To select other modes, see DA 41 xx above.
F2Read keyboard ID (only works in Enhanced mode).
F3 xxSet repeat rate and delay.
F4Enable keyboard (clear errors).
F5Disable keyboard.
F6Set defaults.
F7Set all keys to repeat. No keys will send break codes.
F8Set all keys to give make/break codes. No keys will repeat.
F9Set all keys to give make codes only. No keys will repeat or send break codes.
FASet all keys to repeat and give make/break codes.
FBSet specified key(s) to repeat. They will not send break codes. Followed by a list of scancodes, which should be terminated by F4.
FCSet specified key(s) to give make/break codes. They will not repeat. Followed by a list of scancodes, which should be terminated by F4.
FDSet specified key(s) to give make codes only. They will not repeat or send break codes. Followed by a list of scancodes, which should be terminated by F4.
FEResend last scancode.
FFReset. The keyboard will respond with 0AAh (self-test passed)

SCS Files

The keyboard is supplied with DOS software to load scancode files in the .SCS format into the keyboard RAM. The .SCS file format is a series of null-terminated strings; under UNIX, it's easiest to read their contents with a command like tr '\0' '\n' < file | less

The file begins with four fixed strings:

Mode
A single character: '0' for native mode, '1' for IRMA mode, '2' for enhanced mode.
Description
At most 20 characters: A description of the file contents.
Number of keys
Number of definitions in this file, 1-532.
Delay
In milliseconds: The delay in milliseconds between each scancode of a multi-scancode macro.

The rest of the file contains key definitions. Each one consists of four strings:

Key number
Key number to define (using the system described above), 1 to 133.
Repeat?
Y if the key repeats when held down, else N.
Map
0-3: Which shift state is being defined?
	0: Unshifted
	1: Shift pressed
	2: Alt pressed
	3: Ctrl pressed
Scancode(s)
The scancode(s) this key should send when pressed. Up to 80 bytes. Note that the .SCS file contains the scancode stream as raw bytes, rather than any sort of hex representation.

Windows support

The standard Windows keyboard layouts from Windows NT 3.5 onward appear to have been designed to support a KB 3270 in 'Native', 'Enhanced 101' or 'Enhanced 102' modes. I'm not aware of any drivers to support the extra features such as switchable modes or user-defined scancodes, though I admit I haven't looked particularly hard for them.

Windows NT 3.5 supports the Clear, ErEOF and F13-F24 keys. The other keys return scancodes but not VK_ virtual keycodes.

Windows NT 4 and later also support the WsCtrl, Finish, Jump and Auto keys — and in native mode, PA1, PA3, Reset, Zoom (F11) and Help (F12).


John Elliott 15 November 2013.