EOS Game Controller Input
by Dr. Solomon Swift
The game controllers are read through any of the double port pairs starting at number 224. These same ports are used by the sound chip for output. Thus, it is not possible to send a value OUT to a PDL. The values are read in conjunction with the strobe port. When the strobe port is reset (OUT $C0 or OUT 128), the right trigger, keypad, and the two lower super action triggers can be read. The returned keypad values need to be converted from the pin codes to binary values. In addition to all of this, you need to compliment the read value and then mask out certain bits to get the correct input values.
To avoid these complexities, you may utilize the EOS "read game controllers" routine. It is the 91st vector in the EOS jump table. The jump table address is 64830 (64, 253). And, the actual routine is at address 57939 (83, 226).
Before using either CALL option, the accumulator and IX must be set up. The index register should contain a pointer to your 10 byte decoded input buffer. Load the accumulator with one of the following values:
There is also an option to read the spinner with this routine, but it doesn't work correctly. In fact, this routine actually resets the spinner's EOS buffer values. We'll discuss this in a later issue and how to correct the bug.
The user input buffer is formatted as follows:
After CALLing the EOS routine, you can check the appropriate address in the buffer for a particular input.
Next month we'll continue our study of this routine and correct another minor bug with it (in decoding the keypad inputs). For further study, you might want to examine last month's MoreKeys program and the disassembled routines for it.