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. VollmerThe 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:
Key | Bit | PEEK(211) Value |
---|---|---|
SHIFT | 0 | 1 |
Commodore | 1 | 2 |
CONTROL | 2 | 4 |
ALT | 3 | 8 |
CAPS LOCK | 4 | 16 |
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.