← Back to Modules
module
38

Appendix V - The Keyboard Matrix

Every key on the Einstein sits at one crossing point of an 8 x 8 electrical grid: eight rows your program selects one at a time, and eight columns it reads back as one byte per row. S25 covers how to do the reading; this appendix is the map it reads from.

How to read this table

  • Select row n by writing the byte in the select column to AY register 14 - it is 255 with bit n taken away.
  • Read AY register 15. Each key in that row owns one bit of the answer.
  • The matrix is active-low, both directions: the select byte has one 0 bit, and a held key reads as a 0 in its column bit. A row with nothing held reads 255.

Keys with two legends are shown unshifted first: 2 " is the 2 key, which shifts to ".

Rowbit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0select
0ESCSPACEENTERCAPSF7F0-BREAK254
10 @½ ‖DOWN- £LEFTPOI253
2F59 )TABRIGHT: *; +LK251
3F4UP= -DELETE8 (/ ?. >, <247
4F31 !2 "3 #4 $5 %6 &7 '239
5F2QWERTYU223
6F1ASDFGHJ191
7F6ZXCVBNM127

Row 0 bit 1 is empty - no key lives there.

Reading a key from the table

W is row 5, bit 5. So:

        LD A,14         ; the row-select register
        OUT (2),A
        LD A,223        ; row 5's select byte
        OUT (3),A
        LD A,15         ; the column register
        OUT (2),A
        IN A,(2)
        BIT 5,A         ; W's bit
        JR Z,pressed    ; zero means held

The letter rows repay a look: row 5 is the keyboard's QWERTY row, bit 6 to bit 0 reading Q W E R T Y U left to right, and rows 6 and 7 are the rows beneath it. The grid is the physical keyboard, wired.

Cursor keys and the rest

The table uses MAME's names for the keys, and five of them need translating. The Einstein has two grey cursor keys at the right-hand end of the QWERTY row: the horizontal one, which MAME calls TAB (row 2, bit 5), and the vertical one, which MAME calls DOWN (row 1, bit 5). Each moves one way on its own and the other way with SHIFT. The keys MAME calls LEFT (row 1), RIGHT (row 2) and UP (row 3) are the [, ] and ^ character keys, whose keycaps carry ← → ↑ because the Einstein draws those characters as arrows. In MAME the three sit on your Left, Right and Up arrows, and the cursor keys on Tab and the Down arrow.

All five are ordinary matrix keys, so a game can use them exactly like letters, and a two-player game can put one player on WASD and the other on the three arrow-marked keys and the vertical cursor key, with nothing but different rows in the scan.

The keycaps and the two cursor keys are as Tatung's manual draws them, and MAME's Einstein agrees. The matrix positions were checked in MAME, not on a real Einstein: if yours reads differently, let us know and this page will be corrected.

SHIFT, CTRL and GRPH are not in the matrix. They are wired separately, and this table cannot see them - prefer ordinary keys for game controls.

Notes for old listings

Other references print this table with its columns numbered the opposite way - column 0 on the left meaning bit 7. If a map you find seems to contradict this one, read its column n as bit 7 - n and the two will agree. When in doubt, trust the bit your own scan shows you: hold the key and look.

Get the Newsletter

New guides, disk images and community finds, roughly once a quarter. No spam, we promise, this isn't Tatung's marketing department.
Your subscription could not be saved. Please try again.
Your subscription has been successful.

Newsletter

Subscribe to our newsletter and stay updated.

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.