I posted about this on OCAU, here's a copy paste:
I'm lacking a joystick for my Amiga so I dug up an old 3 button sega megadrive controller.
These use the same 9 pin interface that Commodore/Atari joysticks used. However since its actually got a couple of extra buttons and the interface normally only supports 2 buttons, these gamepads had an extra chip inside to multiplex the signals.
This chip's select line is connected to the +5V line of the joystick port. There's a dedicated +5V line in the controller, but in a commodore/atari this isn't connected, everything is powered through the select line. Normally it will work with most games, but some games get confused and won't activate the second button.
The fix is quite easy - cut the select line, and wire the +5V line on the controller into the +5V line from the joystick port. The select line has a pullup resistor connected to +5V which will pull its logic state high, even if the wire is cut, so you can still use the d-pad and the B and C buttons.
Since button A is unused, I cut its output line and wired it to UP on the d-pad. This is because a lot of older games required you to hold UP on the joystick to jump or accelerate - most joysticks of the time only had a single button, used for other purposes. So now I have a jump button plus two fire/action buttons
If you are squeamish, don't prod the beach rubble.