SNES port question.

Chat about anything CX16 related that doesn't fit elsewhere
Post Reply
integer_basic
Posts: 8
Joined: Mon Feb 08, 2021 3:10 am

SNES port question.

Post by integer_basic »


Interesting choice on the SNES port.  IIRC, SNES games poll the shift register in the controller several times per second to get the state of the D-Pad and the buttons. The NES worked the same way.   The programmers of NES\SNES games actually had to put this code in their games, as the console does nothing in this regard.

 

So, will we have to poll the shift register as well in our code, or will this be handled automatically and invisibly with the JOY command?

SlithyMatt
Posts: 913
Joined: Tue Apr 28, 2020 2:45 am

SNES port question.

Post by SlithyMatt »


It's handled by the Kernal joystick_scan and joystick_get Subroutines, which the BASIC JOY command uses

integer_basic
Posts: 8
Joined: Mon Feb 08, 2021 3:10 am

SNES port question.

Post by integer_basic »



1 minute ago, SlithyMatt said:




It's handled by the Kernal joystick_scan and joystick_get Subroutines, which the BASIC JOY command uses



Interesting.  It's a big change from the Atari way of doing things.  Atari Joysticks didn't use shift registers.  Lots of behind the scene changes then to make JOY work with a Nintendo controller.

integer_basic
Posts: 8
Joined: Mon Feb 08, 2021 3:10 am

SNES port question.

Post by integer_basic »


Not to mention having 6 buttons instead of 1.

User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

SNES port question.

Post by StephenHorn »


Well, they have the kernal code, and they're making the modifications necessary.

Also, if I remember correctly, SNES games were not required to poll the shift registers, the console could be set to do that for them on a periodic basis.

But NES games might've had to do their own polling.

Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
integer_basic
Posts: 8
Joined: Mon Feb 08, 2021 3:10 am

SNES port question.

Post by integer_basic »



6 hours ago, StephenHorn said:




Well, they have the kernal code, and they're making the modifications necessary.



Also, if I remember correctly, SNES games were not required to poll the shift registers, the console could be set to do that for them on a periodic basis.



But NES games might've had to do their own polling.



There definitely is some differences in how each SNES game works with the controller.  For instance, if you have a wired adapter to let you use NES controllers on the SNES, some games work correctly, and some display a wide variety of odd behavior with the NES controller.  Please note, I am NOT talking about the button mapping.  Using only games that work with B & Y (What A & B map to when you use these wired adapters) you will still find games that work 100%, and other that have major issues.

 

If the SNES console itself was handling 100% of the polling, my feeling is the result would be standard on a NES controller playing a SNES game.  This is not the case, so the something must be different from game to game in regards to how it works with the controller. 

 

 

User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

SNES port question.

Post by StephenHorn »


I swear I'm trying to avoid becoming Retro Game Mechanics Explained personal marketing rep, but this is what I was referring to...





In particular, note time index 6:25 (software polling), 7:48 (NES wire compatibility), and 8:36 (SNES auto-joypad read).

As for games that behave badly, I guess I'd need more specific citations than "you will still find games that work 100%, and others that have major issues". But since the controllers returned low 1s, and low voltage was the shift register's output once it ran out of bits, NES controllers would show A, X, L, and R as being "pressed", so unless games checked the controller signatures, they could potentially interpret the controller data incorrectly for NES controllers.

Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
integer_basic
Posts: 8
Joined: Mon Feb 08, 2021 3:10 am

SNES port question.

Post by integer_basic »


Actually, after further examination, all the games I've been testing have issues.  Some were just more obvious than others.

 

For instance, Turtles IV and Castlevania IV will not let you use B&Y (A&B on the NES pad) when you're moving with the D-Pad.  On Super Adventure Island, it's the opposite.

Some space shooting games just fire constantly.

Another video I watched about this recently mentioned that lots of games won't work with the NES controller (he wasn't talking about mapping issues), but he had better luck with earlier SNES games.

 

Post Reply