Close
0%
0%

SNES controller implementation on the Neo Geo

A lagless implementation of a SNES controller for use on the Neo Geo, using the ATTINY2313

Public Chat
Similar projects worth following
167 views
0 followers
SNES controllers can be used as a substitute for the original Neo Geo controller. It maintains all the buttons, and probably anybody interested in a consolized Neo Geo is fanatical enough that they are almost certainly going to own a Super Nintendo, so they won’t have to shell out any more dollars.

The beautiful thing about this implementation is that it is LAGLESS. Even though the serial data from the SNES must be converted to parallel, an entire polling loop takes .098875mS, while a 60fps frame draw means a new frame every 16.67mS (so, ~168 polls per frame!).

For the latest bleeding edge details, please also check out my personal page in the links.

I’ve programmed the below in BASCOM-AVR and tested with an ATTINY2313. Potentially there are cheaper/smaller AVRs that will suffice, but the IC is already pretty cheap and plentiful. This code is also quite long (not complex, but repetitive) so it takes up more program space than usual. You can program the BASCOM code easily onto a ATTINY2313 with the cheap, yet powerful, TL866II Plus.

There is only three data wires on the controller to be concerned with; you can of course change what pins you want to use but in my actual PCB design these pins are most convenient for routing.

  • Latch (connect to A0)
  • Clock (connect to A1)
  • Serial (connect to D5)
SNES Pinout

All the parallelized data will be put on Pins B0 through B7 and D0 through D3. Again, you can of course change this easily, I just chose those for routing purposes.

The basic operation of the SNES controller is that it awaits for a latch pulse (12uS wide, issued by the ATTINY) and then the controller transmits back the state of the buttons (pressed or not) via shift registers over serial - 16 such data points (first 12 only matter though, last 4 are dummy points). The clock pulses issued from the ATTINY to the controller are what ‘setup’ and ‘shift’ these values over serial such that you then sample theses serial pulses with the ATTINY and dump them out in parallel.

It’s also worth noting, I use the term parallel, but it’s really pseudo-parallel… the output pins are set in sequence, but this happens so fast the data is “staged” well in advance of when the Neo Geo will ask for it, thus it appears as parallel from the Neo Geo perspective.

Code below is released under MIT licence!

I have mapped the SNES controller buttons to match that of the newer Neo Geo mini controller, which many people are saying is a better layout than the original controller. It makes sense, if you look at an MVS cabinet, A&B and C&D are next to eachother, which are usually pushed simultaneously for specific moves. The mini controller layout makes it easier to press those buttons at the same time with your thumb, whereas the traditional controller layout made it difficult.

MVS Cabinet: MVS Cabinet

Controller comparison (base photo credit @metaljesusrocks): Controller compare

AVR Snes Controller Parallel.bas

Bascom BASIC file - Latest copy always on GitHub

bas - 15.60 kB - 05/01/2020 at 02:43

Download

AVR Snes Controller Parallel.hex

Compiled HEX file - Latest copy always on GitHub

hex - 1.64 kB - 05/01/2020 at 02:43

Download

  • 1 × ATTINY2313-20PU IC MCU 8BIT 2KB FLASH 20DIP

  • 1
    Step 1

    Download source files below:

    GitHub Source Code

    or you can just directly download the Bas file or Hex file. Of course with the hex file you’ll have to be sure to wire everything as I have.

    You can program the compiled BASCOM code (.hex) easily onto a ATTINY2313 with the cheap, yet powerful, TL866II Plus.

  • 2
    Step 2

    When programming the board be sure to remember to upload as INTEL HEX and set fuse settings in the Xgpro software used by the TL866II.

    Select INTEL HEX when you open the .hex file you compiled in BASCOM-AVR

    Hex Settings

    For fuse settings, the ATTINY2313 datasheet on page 27 has the settings layed out for using an internal 8Mhz clock…

    Crystal Settings 1

    The relevant settings are on the config tab in the software. As we are using a 8MHz internal clock we want CKSEL to be 0100 and SUT as 10, which is a low fuse setting of 0x64

    Fuse Settings

    It is important the fuse settings are correct! You can brick your AVR if set incorrectly, and that’s not fun!

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates