stella-emu / stella

A multi-platform Atari 2600 Emulator
https://stella-emu.github.io
GNU General Public License v2.0
589 stars 111 forks source link

Genesis controller issue #317

Closed ale-79 closed 6 years ago

ale-79 commented 6 years ago

The test roms in this thread on AA behave differently than real hardware. The genesis pad should be detected as paddle but it isn't in Stella because only the paddle line on pin 9 (INPT1/INPT3 depending on the port) is pulled high, while on real hardware both paddle lines (pins 5 and 9) are.

thrust26 commented 6 years ago

How should the test program behave correctly? PaddleTest.zip (red = paddle auto-detected, blue = joystick auto-detected, green = joystick forced)

ale-79 commented 6 years ago

The bar corresponding to a port (left/right) where a genesis pad is plugged in should be red

thrust26 commented 6 years ago

Is there some e.g. button connected to pin 9? If not, why is the controller doing that?

ale-79 commented 6 years ago

There's no button connected to that pin, as, on a Genesis/Mega Drive console, that's the power (+5V) pin. https://gamesx.com/wiki/doku.php?id=controls:megadrive_genesis_controller_3

thrust26 commented 6 years ago

Hmm... Can this be used to auto detect a Genesis?

thrust26 commented 6 years ago

I just committed a fix, which works for the test program.

Do you know anything I can use as regression test?

sa666666 commented 6 years ago

Hmm, if there's no connection, wouldn't that imply max resistance (ie, an open circuit)??

thrust26 commented 6 years ago

Well, the test program only works with minimum resistance.

ale-79 commented 6 years ago

The pin is connected to pin 16 of the multiplexer IC inside the controller and to the resitor array. It's not completely clear to me why the controller still works on the 2600 even if power is applied to the wrong pin. I guess pin 1 of the 74157 IC (which is connected to pin 7 of the controller port, which in turn is power on the Atari) has an internal pullup resistor which allows the controller to be powered from that. I don't think the pad can be distinguished from a set of paddles by an autodetection routine just by testing the paddle lines.

ale-79 commented 6 years ago

Do you know anything I can use as regression test?

I tried Scramble and Stay Frosty 2 (see issue #206): both show no regression and correctly detect the genesis pad. Also the "Testcart" now correctly shows both paddle lines with minimum resistance (as on real hardware).

thrust26 commented 6 years ago

Thanks for testing.

sa666666 commented 6 years ago

@ale-79, can you point me to the specific Scamble and Stay Frosty 2 ROMs you used for testing? I want to have them locally to test this functionality in the future, in case something breaks again :smiling_imp:

ale-79 commented 6 years ago

The roms I used are from my local romset. I'm not sure they're the latest versions: roms.zip