Keyboard Map

Keyboard Values – Model I

Address
1
2
4
8
16
32
64
128
14337
@
A
B
C
D
E
F
G
14338
H
I
J
K
L
M
N
O
14340
P
Q
R
S
T
U
V
W
14344
X
Y
Z
 
 
 
 
 
14352
0
1
2
3
4
5
6
7
14368
8
9
:
;
,
.
/
14400
ENTER
CLEAR
BREAK
SPACE
14464
SHIFT
 
 
 
 
 
 
 

Notes on the table:

  1. Blank areas of the table are not used on the standard TRS-80.
  2. The control key at location 14464 is used by the ELECTRIC PENCIL.
  3. The break key can not be used in BASIC programs, but can be checked in machine language programs.
  4. In BASIC use – variable = PEEK(address)
    ie: IF PEEK(14400)=8 THEN SET(X+1,Y) ‘ up arrow key was pressed
  5. In machine language you can use- LD A,(3840H) ;08H = up arrow
  6. If two or more keys are pressed at the same time you will get the sum of the keys.
  7. You can also combine more than one address. Note the right-hand column of numbers. If you total this number with other row numbers you want to address, and add 14436, you will get the final decimal address to PEEK.
  8. In BASIC a better way to use this table, than described in 4 above, might be to PEEK(address) AND (value to check) – This will recognize a key as being pressed even when other keys are being held down.

Keyboard Values – Model III/4

Address
1
2
4
8
16
32
64
128
14337
@
A
B
C
D
E
F
G
14338
H
I
J
K
L
M
N
O
14340
P
Q
R
S
T
U
V
W
14344
X
Y
Z
 
 
 
 
 
14352
0
1
2
3
4
5
6
7
14368
8
9
:
;
,
.
/
14400
ENTER
CLEAR
BREAK
SPACE
14464
SHIFT
SHIFT
CONTROL
CAPS
F1
F2
F3
 

Notes on the table:

The shift key processing differs between the Model I and the Model III:

  • On a Model I, both shift keys return a 1 for 14464 for either shift key.
  • On a Model III and 4, the location 14464 would be decimal 1 for the left shift key and decimal 2 for the right shift key.

Demonstration Program

Try running this small program and hold down more than one ARROW key at the same time.

5 DEFINT A
10 A = PEEK(14400)
20 IF (A AND 8 ) THEN PRINT "UP ":
30 IF (A AND 16) THEN PRINT "DOWN ";
40 IF (A AND 32) THEN PRINT "LEFT ";
50 IF (A AND 64) THEN PRINT "RIGHT ";
60 IF (A AND 255)THEN PRINT
70 GOTO 10