Changing the Keyboard Encoder
A 2316-B ROM contains program codes and the keyboard encoding table. Caution: pins 20 and 21 (unlike 2716's) are positive chip-select: you need to have them at a high level in order to read the ROM. Exchanging the ROM for a 2716 EPROM requires changing the jumper settings at J-18 and J-19.
The KTM uses two input lines to check the status of the SHIFT and CONTROL keys, and an 8 x 8 matrix for checking the other keys. This lay-out requires 2 * 64 = 128 bytes of storage for decoding the keys in lower-case and upper-case mode. Not all of the 64 cross-points of the matrix are used (the KTM has 51 keys apart from SHIFT and CONTROL). These cross points are decoded by a null code. The KTM control functions ALPHA and BREAK are identified by a dedicated bit (bit 7 = 1, - 0 for all other characters). Bits 6 to 0 contain the ASCII code in reversed  order! For instance, the key `8` (ASCII $38) thus encodes to $0E. The keyboard encoding table shown below starts from address $723 up to $7A2 for the KTM-2/80 and $6FA up to $779 for the KTM-2. Standard KTM lay-out is (only lower-case is shown):
U2 (6522) PA 0 1 2 3 4 5 6   7 ROM addr.
--------------------/---------------------------------------------------------------------
U2 (6522) PB 0 / 8 7 6 5 4 3 2 1 $ 723-72A
U2 (6522) PB 1 / TAB - + 0 9 $ 72B-732
U2 (6522) PB 2 / u y t r e w q ESC $ 733-73A
U2 (6522) PB 3 /     RET LF = p o i $ 73B-742
U2 (6522) PB 4 / j h g f d s a   $ 743-74A
U2 (6522) PB 5 / ALPHA DEL   : ; l   k $ 74B-752
U2 (6522) PB 6 / m n b v c x z $ 753-75A
U1 (6522) PB 5 /     SPACE /   . , $ 75B-762
Creating an original KTM-2 boot ROM mapping table
If you are upgrading a stock KTM-2 to a /80, use the following procedure or just
download the original binaries and burn them.
1. Copy your original boot ROM and note what memory address you saved it at. For this example, we will use $6000.
2. Load the binaries here and save these at $5000. This will be a 4K file which includes both KTM files. The
lower half ($5000 to $57FF) for the KTM and the upper half ($5800 to $5FFF) KTM-2/80.
3. Copy the table from $66FA to $6779 and paste it into location $5F23 and $56FA. This will now contain your map
and will work for both terminals. Using the SYM, type: .B 5F23,66FA,6779 (cr),
which will block move everything from $66FA to $6779 to memory location $5F23.
Repeat the block move except move to $56FA.
4. Burn the EPROM.
The information given should suffice to change the keyboard according to any desired lay-out. My keyboard now
reads and displays the added keys on my new keyboard.