Quote:
Originally Posted by witchmaster
So is a "normal" CD32 gamepad read routine something along these lines:?
1. PotX (pin 5) is set low to enable shift mode of the LS165.
2. PotY (pin 9) is read?
3. Button1 (pin 6) is set HIGH and then LOW (clock pulse for the LS165)
4. Small wait then Amiga is reading PotY (the wait varies between games)
5. Repeat 3 and 4 until all data shifted.
6. PotX (pin 5) is set HIGH to enable load mode of the LS165.
|
Pretty much. Pin 6 is already high when the routine enters the main loop for the first time, and it's explicity set to output mode before the loop starts. And there's a final step, returning pin 6 to input mode and setting it high again.
Incidentally, remember that you're imitating an eight bit shift register, so when you've shifted out your seven buttons, shift out an extra '1' bit. Some routines use this extra bit to detect the presence of a CD32 pad.