Classic Computer Magazine Archive COMPUTE! ISSUE 74 / JULY 1986 / PAGE 10

Readers Feedback

The Editors and Readers of COMPUTE!

If you have any questions, comments, or suggestions you would like to see addressed in this column, write to "Readers' Feedback," COMPUTE!, P.O. Box 5406, Greensboro, NC 27403. Due to the volume of mail we receive, we regret that we cannot provide personal answers to technical questions.

Scanning The 128's ALT Key

Please tell me how to read the ALT key on the Commodore 128.

J. C. Vollmer

The 128's ALT key cannot be polled like the other keys. Instead, your program must PEEK location 211, where the system stores information about five special keys; SHIFT, CONTROL, ALT, CAPS LOCK, and the Commodore key. When you press one of these keys, it sets a certain bit in this location:

KeyBitPEEK(211) Value
SHIFT01
Commodore12
CONTROL24
ALT38
CAPS LOCK416

Thus, if PEEK(211) equals 8, you know the ALT key is pressed. Since each key has its own signal bit, the values from location 211 are additive. If PEEK(211) equals 9, for instance, both SHIFT and ALT are pressed. When SHIFT and CONTROL are pressed, location 211 holds 5, and so forth.