James L. Brunn
If only one key is pressed, you can use these values: (PEEK(53279)):7 = no key, 6 = START, 5 = SELECT, and 3 = OPTION.
The colored console switches to the right of the typewriter keyboard are just the ticket for programs with special features. The names seem to indicate just the kind of things one might wish to do in a program. OPTION - What better key to step through a choice of options. SELECT - After stepping through the options, this key could be used to select the current option. START - This key might be used to transfer control back to the beginning of a sequence or to start the program over again.
The problem is, how does one read these keys? Well, read on: here is a method that works well for me. First, we note the memory location 53279 is used to indicate the condition of all three switches. It's done like this. If we just PEEK (53279) with no switches pressed, we find a seven. Holding down one or more of the keys while doing our PEEK returns a different number. The table below summarizes the values returned when a console key is pressed. X means that the key or keys are pressed.
Now let's use this knowledge in a program.
Listing: Show which console keys are pressed
Of course the subroutines here are very simple, but this method can easily be expanded to fit your needs.
Return to Table of Contents | Previous Section | Next Section