Joypad D1

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Joypad D1

Post by Bregalad »

I noted in *ALL* licenced games I checked that the games reads both D0 and D1 from the joypads (reading $4016 and $4017), and OR those two bits to have the actual joypad data. Still, *ALL* homebrew stuff I checkded does only read D0. If D0 is the joypad value, then what is D1 ?
Useless, lumbering half-wits don't scare us.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust »

D1 is used on the Famicom only in order to check controllers connected to the expansion port; many games released in the USA simply did not have this logic removed (since it did not cause any problems).

This is the same reason why most licensed Zapper/PowerPad games only allow said peripheral to be connected to the second controller port - on the Famicom they were connected to the expansion port, which connected them to the bits in $4017 only.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg »

many games released in the USA simply did not have this logic removed (since it did not cause any problems).
Better to leave the benign code in rather than remove it and possibly cause problems.

Along the lines of curious joypad behavior, I recently noticed that Zelda 2 and Super Mario Bros. 3 (and probably others) check the joypad twice in succession and repeat back as long as the two readings differ. My only guess was that this is compensation for bad joypads (maybe another Famicom-only issue?).
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »

Thanks, I understand it better now. The famicom had two hardwired joypads (that's $4016.0 and $4017.0) and one expension port where the extended thing like Zapper or another revised controller could be connected. But then, is it $4016.1 or $4017.1, or both ? If $4016.1 is the extension data, then is $4017.1 the 2nd pad's microphone data (1=Some someone is crying in the microphone, 0=there is total silent in the room) ?

Blagg : Yeah, once I noted CV3 to do this. I think it is effectively to avoid bad contacts in the joypad's case ?

I also noted that most licenced games that are only playable trough the first controller still reads the segond one, even if it's not used in the game. Is that because of the expension port ? Or is that a library stuff ?
Useless, lumbering half-wits don't scare us.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

blargg wrote:Along the lines of curious joypad behavior, I recently noticed that Zelda 2 and Super Mario Bros. 3 (and probably others) check the joypad twice in succession and repeat back as long as the two readings differ. My only guess was that this is compensation for bad joypads (maybe another Famicom-only issue?).
Could be to reject the use of the turbo function on unlicensed controllers that used the strobe bit rather than an internal 50 Hz or 60 Hz clock to invert buttons.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust »

Bregalad wrote:But then, is it $4016.1 or $4017.1, or both ? If $4016.1 is the extension data, then is $4017.1 the 2nd pad's microphone data (1=Some someone is crying in the microphone, 0=there is total silent in the room) ?
The microphone on Famicom's controller #2 is connected to $4016 bit 2 (yes, the register for controller #1).

The reason games check D1 on both $4016 *and* $4017 is because there apparently exist Famicom expansion port modules that include TWO controllers, either to replace both of the hardwired controllers or to allow 4 player games. (note that the NES's 4-player hardware is incompatible with this).
I also noted that most licenced games that are only playable trough the first controller still reads the segond one, even if it's not used in the game. Is that because of the expension port ? Or is that a library stuff ?
It's probably a generic library function for reading both controllers and automatically calculating the necessary delta information so they can easily handle on-press events (jumping, shooting, pausing) as well as on-hold events (walking, running, charging weapons).
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »

Wow, so the famicom has 2 hardwired controllers and 1 or 2 (depending of the version) ports for extra stuff, right ?
So a japaneese guy could use the hardwired controller ($4016.0) as well than another custom controller ($4016.1), and all games would work well.
On the american and european NES, none of the controller is hardwired, and the data available for standard controller is $4016.0, $4016.1 will always be zero, right ?
Useless, lumbering half-wits don't scare us.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

On the NES, $4016.1 and $4017.1 have data if you have connected an adapter to the expansion port. In fact, this could be used as an adapter to make up to 8 players: one Four Score connected to $4016.0 and $4017.0 and one Four Score connected to $4016.1 and $4017.1.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »

What is the expension port on a NES ? Is that the connector bottom the NES unit ? Does any games uses this ?
Useless, lumbering half-wits don't scare us.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Bregalad wrote:What is the expension port on a NES ? Is that the connector bottom the NES unit ?
Yes. There's a pinout in this document.
Does any games uses this ?
No widely distributed U.S. games.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »

Well, I'm pretty stupid, that connector is simply not accessible to the user on both NES I have. I had one accessible on the bottom of my SNES, so I probably confused it. However if my remembering is right, there is still a connector below the NES, even it it's not accessible.
What in the would could be only a little usefull a connector unaccecible to the user ? Were Nintendo that bored ?
Useless, lumbering half-wits don't scare us.
User avatar
teaguecl
Posts: 211
Joined: Thu Oct 21, 2004 4:02 pm
Location: San Diego

Post by teaguecl »

Bregalad wrote:that connector is simply not accessible to the user on both NES I have. However if my remembering is right, there is still a connector below the NES, even it it's not accessible.
What in the would could be only a little usefull a connector unaccecible to the user ? Were Nintendo that bored ?
I'm not sure I agree with what you are saying. The expansion connector on the bottom of the NES (NTSC toaster) is accessible to the user. It is under a small plastic cover, but it is removed similar to the battery cover on a TV remote. This does not damage the unit in any way. Do you have an NES which does not have this cover? I've never seen such a thing.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Post by koitsu »

teaguecl,

The original NES expansion port (on the bottom of the unit) is enclosed under two pieces of plastic. The first piece of plastic is a user-removable shell (removed by applying pressure to the two "tabs" on the left and right). The second piece of plastic is actually attached to the shell of the NES itself; to access the actual port underneathe by (if I remember right) 6 little plastic tabs -- you'd need to break off this cover for you to gain access to the expansion port. In doing so, you'd probably void the warranty on your NES.

Nintendo removed the expansion port from the top-loading NES when that model was released. AFAIK, there are absolutely no games / applications which use this port.
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers »

User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »

I'm sure that the connector *can* be acceded by using a knife and remove several small plasic holders. as teaguelc said, but this opperation is not reversible so the user seems not be supposed to know that this connector exists.
Oh my god. Was that device made to gamble for *real* with your *real* money ? If so, that's horrible. Interesting, but horrible.
I think this was a 100% unlicensed project, because Nintendo wouldn't allow such things, especially when thinking that they censored the cruch in FF1 to replace them with clinics, and FF2 wasn't released in the US because the hero had to pray to a statue to rescue the wounds. Castlevania 3 also was censored a lot.
Useless, lumbering half-wits don't scare us.
Post Reply