Casio PV-1000/Controller
The Casio PV-1000 Joystick is a 2-axis, 4-button joystick. Pictures are available here: https://commons.wikimedia.org/wiki/Category:Casio_PV-1000_accessories
Reading its status is much like one how one reads the buttons on a Game Boy.
Input (port $FD write)
7 bit 0 ---- ---- xxxx ABCD |||| |||+-- 1: include information about joysticks' "Attack" buttons ||+--- 1: include information about joysticks' up and left directions |+---- 1: include information about joysticks' down and right directions +----- 1: include information about joysticks' start and select buttons
Output (port $FD read)
7 bit 0 ---- ---- xxxx ABCD |||| |||+-- 1: if Player 1 "Attack", left, down, or select was pressed, depending on above ||+--- 1: if Player 1 "Attack", up, right, or start was pressed |+---- 1: if Player 2 "Attack", left, down, or select +----- 1: if Player 2 "Attack", up, right, or start
A 2-position-2-pole switch on the controller lets each player swap the two "Attack" buttons, so there is no consistent mapping of "button at tip of joystick" vs "button above start and select buttons" to which bit above.
Hardware
The values written to port $FD appear on the pins of the ASIC. The voltages are then current-limited by four 10kΩ resistors, where they go to the joystick ports, through diodes in the joystick, and if the relevant button is pressed, back to the joystick port to a 330pF capacitor and then back to the ASIC.
However if a button is not pressed, the 330pF capacitor is instead discharged by a 56kΩ resistor on the mainboard.
ASIC----10kΩ----jack----|>|----button----jack----+----+----10kΩ----ASIC 330pF 56kΩ | | gnd gnd
Experimental measurements have established that it takes 0-41 T states after a row is selected before a button press can be detected, and 126-147 T states after a row is cleared before a lack of button press can be detected.