Page 1 of 1

NES joypad interface question

Posted: Tue Oct 06, 2009 8:42 pm
by jwdonal
Hey guys! I'm still working on my hardware implementation of the NES (FPGA-based). At the moment I'm trying to figure out a weird joypad bug that I'm only experiencing with Super Mario Bros. For whatever reason the game won't recognize any of my button presses. I can't even start the game with the Start button. The game runs through it's short little demo just fine but I can't do a thing.

I've tried running 22 other games with my hardware (only ones that don't use any mapper since I have yet to implement any mappers) and none of them have this issue. Is there something special about how Super Mario Bros reads data from the joypads that I don't know about? I mean, I don't see how you could make the process any different than:

write 1 to $4016
write 0 to $4016
read from $4016 (A)
read from $4016 (B)
... etc

Are there some games that do weird things with the joypads that I don't know about?

ANY ideas whatsoever might help me with this. I've been working on this for a _while_ now and I've just about given up! :P

Posted: Wed Oct 07, 2009 6:15 am
by tepples

Code: Select all

7654 3210  Inputs ($4016, $4017)
|||| ||||
|||| |||+- Data from controller 1
|||| ||+-- Data from controller 3 (Famicom) or 0 (NES)
|||| |+--- Expansion controller D2 (Famicom) or 0 (NES)
|||| +---- Expansion controller D3 (e.g. Zapper)
|||+------ Expansion controller D4 (e.g. Zapper)
+++------- D7-D5 of last value on data bus
           (usually 010, from upper bits of $4016)
The Famicom treats controllers 3 and 4 (in the expansion port) differently from controllers 1 and 2 (hard-wired). But a lot of games that are released in Japan will treat presses on Famicom controllers 3 and 4 like presses on controllers 1 and 2. Super Mario Bros. is one of them. So what is your FPGA NES returning in D1 of $4016? What do any "controller test" ROMs do?

VERY INTERESTING!!

Posted: Wed Oct 07, 2009 9:19 am
by jwdonal
VERY INTERESTING!! I will need to check this!! That would be awesome if that was the problem!

Actually I forgot to ask if there were any controller test ROMs out there. Can you point me to some?? Pleeeeeeeease.

THANKS tepples!! :-D

Controller test ROMs?

Posted: Wed Oct 07, 2009 11:03 pm
by jwdonal
So are there no controller test ROMs out there? I've searched and can't seem to find any. But something tells me that there must be....

SOLVED!

Posted: Tue Oct 27, 2009 6:55 pm
by jwdonal
It turned out to be that my joypad #2 inputs were floating whenever the second joypad wasn't attached!!!! I forgot to add internal pullup resistors on those pins of the FPGA. LOL. That was a good bug! :-P