[Coco] PEEK for detecting CoCo arrow keys, etc.?

Rogelio Perea os9dude at gmail.com
Fri Dec 19 21:09:01 EST 2014


On Fri Dec 19 2014, Arthur Flexser wrote:

To determine which peek values correspond to which arrow keys, run the
> following:
>
> 10 FOR I=&H152 TO &H159
> 20 PRINT PEEK(I);:NEXT:GOTO 10
>
> Then press each arrow key to see which byte changes, and what value it
> changes to, for that key.
>

Did a minor revamp of the program to make it run on a 4k Color Basic 1.0
machine:

100 CLS
110 PRINT at 128,;
120 FOR I=338 TO 345
130 PRINT I;PEEK(I)
140 NEXT I:GOTO 110

Color Basic 1.0 likes decimal values hence the change on the FOR NEXT loop
:-)

You'll get a steady display of the CoCo's keyboard roll over table. All the
locations contain decimal 255 with no keys pressed, pressing any will cause
its given byte to change - in the case of the arrow keys:

UP arrow address dec 341 goes from 255 to 247 on key press
DOWN arrow address dec 342, value from 255 to 247
LEFT arrow address dec 343, 255/247
RIGHT arrow address dec 344, 255/247

BTW, my 4K CoCo 1 is suffering from a severe case of keybounce ALL over the
place, lack of use. Have to fix that!


-- RP


More information about the Coco mailing list