New approach to the fabled NES ethernet adapter

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderators: B00daW, Moderators

Post Reply
User avatar
Wookie
Posts: 76
Joined: Sat Mar 01, 2008 5:06 pm
Location: Seattle, WA
Contact:

New approach to the fabled NES ethernet adapter

Post by Wookie » Sat Apr 25, 2009 11:36 am

So I noticed that microchip now has the PIC18F66J60 microcontroller that has a built-in 10base-t mac/phy. There is also a reference implementation for a full TCP/IP stack that runs on the chip that is available for free. I think this presents the best opportunity for getting the NES connected to ethernet via the expansion bus.

If pin 4 on the expansion but really is the R/W signal line from the 2A03, then it would be trivial to interface the 2A03 with the PIC. Since the only address line available on the expansion port is A15, that means the I/O register could be anywhere in the memory range $8000 - $FFFF. The entire data bus is on the expansion port so talking to the PIC microcontroller is as simple as reading and writing to whatever memory address you pick for the I/O register.

Since the mappers typically use memory mapped I/O in the upper memory ranges for controlling bank switching, I think it would be wise to come up with a scheme for turning on/off the ethernet adapter. That way, when power is turned on, the PIC would ignore any reads/writes to the any memory in $8000-$FFFF. To turn it on, the external device output pins (#37 and #38 on the CPU -> #44 and #45 on the expansion port) could be used to trigger an a wakeup IRQ in the PIC which would turn it on.

Since there is only one address line, there would only be one I/O register. That means a simple serial like command/response protocol needs to be used to talk to the PIC. The 2A03 would write a command and parameters to the register, the PIC would clock them in, decode it, then pull on the 2A03's /IRQ line when the response is ready. The 2A03 would then read from the register, clocking the response bytes back from the PIC. Once this whole thing is working, then pretty much any command/response could be implemented.

On top of the that protocol, a routine for detecting the ethernet device and a simple network library could be built. Commands for creating a socket, configuring it, connecting, disconnecting, writing data, reading data, etc.

User avatar
Memblers
Site Admin
Posts: 3786
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers » Sun Apr 26, 2009 11:28 am

The idea sounds good to me, and inexpensive. Nearly ideal use of the expansion port.

I hate to say it though, but the expansion port itself is the big hurdle. The main issue is that it's custom, I was never able to find a connector suitable for it (admittedly it's been years since I looked but I'm doubtful anything changed). The 2nd more minor issue is that it's only available on the original NES, not the NES2, Famicom, A/V Famicom, or multitude of clones.

It makes a lot of sense to have something like this as an expansion rather than a dedicated cart. So I still think the most viable options are a cart or controller port adapter. The obvious disadvantage to the controller port is the lack of an IRQ. I suppose a cart that needed it could have an IRQ pass-through connector on it (or use the exp connector), but any wiring or expensive custom parts seem to make it less useful for people besides developers and hackers.

Of course the circuit could be pretty easily adapted to fit on a cart too, if the cart has something cool enough. :)

I'd really like to see something like this work.

So far, my main idea for network access on NES is over USB/RS232 to PC. It helps that I already have that link, so anything else I can do with it is pretty much "free".

User avatar
B00daW
Posts: 584
Joined: Thu Jan 03, 2008 1:48 pm

Post by B00daW » Sun Apr 26, 2009 2:36 pm

As for some practical reasons, it might be pretty cool to have PC clients and servers that share and init games when when opponents are ready the incumbent can start the game. You could probably even chat via a same computer on the LAN instead of messing around with adding extra hardware support to the NES.

Above all, being a sound engineer, would be cool to sync different NESes to play music together.

What about remotely controlling the NES and launching code via ethernet with a dummy receiver ROM?

What sort of other applications would you all be thinking about?

User avatar
Wookie
Posts: 76
Joined: Sat Mar 01, 2008 5:06 pm
Location: Seattle, WA
Contact:

Post by Wookie » Sun Apr 26, 2009 9:39 pm

What sort of other applications would you all be thinking about?

8-bit MMORPG

frantik
Posts: 318
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik » Sun Apr 26, 2009 11:30 pm

a NES-based BBS system or web server would be baddass, as would a lynx type text based web browser

custom/expanding level data pulled from a server or networked games would be fun as well
Above all, being a sound engineer, would be cool to sync different NESes to play music together.
i'd like to figure out a way to implement midi-in via a controller port without a special mapper.. the miracle keyboard game used a controller port as a midi port i believe. Then it would be eas(ier) to sync a couple neses to play together. i want to make a nes sampler so midi support would be major

User avatar
Wookie
Posts: 76
Joined: Sat Mar 01, 2008 5:06 pm
Location: Seattle, WA
Contact:

Post by Wookie » Mon Apr 27, 2009 3:41 pm

bad news. pin 4 on the expansion port is connected to /NMI on the CPU, not R/W. That means, there is no way for an expansion port device to map to a specific hardware address.

If R/W were on the expansion port, then the combination of R/W, A15, and D0-D7 would make it trivial for a device to map to any address between $8000-$FFFF. A15 would be the chip select signal and the R/W would be the signal for a read or a write.

But, since there isn't the R/W signal, I've got to figure out something else.

User avatar
Memblers
Site Admin
Posts: 3786
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers » Mon Apr 27, 2009 4:10 pm

There's always the expansion pins on cart, I can't see any major disadvantage to using one to pass the R/W signal to the exp port.

User avatar
Wookie
Posts: 76
Joined: Sat Mar 01, 2008 5:06 pm
Location: Seattle, WA
Contact:

Post by Wookie » Mon Apr 27, 2009 5:01 pm

That is a possibility and probably what the Nintendo engineers intended to do. That would mean that they could control which carts can access expansion devices. Only carts with the R/W pass-through would work.

That is the path of least resistance. I'll just do that.

BTW, I was able to find card edge connectors with the right number of pins but the opening was too skinny. The fat card edge in the expansion port is too thick. My solution was to use a hacksaw blade to carefully slice the card edge socket into two pieces that fit snugly on each side of the expansion connector. It works for a one-off prototype, but won't work for anything production. I'm still looking around for a connector that will work as-is.

User avatar
Wookie
Posts: 76
Joined: Sat Mar 01, 2008 5:06 pm
Location: Seattle, WA
Contact:

Post by Wookie » Mon Apr 27, 2009 5:47 pm

Awesome. I found a place that can make NES expansion port connectors: http://www.sullinscorp.com/

User avatar
Super-Hampster
Posts: 182
Joined: Fri May 12, 2006 4:40 pm

Post by Super-Hampster » Mon Apr 27, 2009 6:29 pm

Wookie wrote:Awesome. I found a place that can make NES expansion port connectors: http://www.sullinscorp.com/

Awesome, I want one!

User avatar
B00daW
Posts: 584
Joined: Thu Jan 03, 2008 1:48 pm

Post by B00daW » Mon Apr 27, 2009 7:55 pm

When you can get an estimate how much those female connectors are let us know. That's set back a lot of development and innovation so far.

User avatar
Banshaku
Posts: 2329
Joined: Tue Jun 24, 2008 8:38 pm
Location: Fukuoka, Japan
Contact:

Post by Banshaku » Mon Apr 27, 2009 8:00 pm

I know that I'm going off topic a little bit but if you would be able to get one of those connector, would it allow you do to the NES mod for famicom sound without the need to open your NES? I don't own a nes, I'm just curious since if I understand well, the pins for the sound are located there, aren't they?

User avatar
Super-Hampster
Posts: 182
Joined: Fri May 12, 2006 4:40 pm

Post by Super-Hampster » Mon Apr 27, 2009 8:27 pm

yes, yes it would. I already have one NES modded for sound, but I DO NOT modify my original NES I've had since the 4th grade. I could use the connector to add sound to it without opening it.

User avatar
Wookie
Posts: 76
Joined: Sat Mar 01, 2008 5:06 pm
Location: Seattle, WA
Contact:

Post by Wookie » Mon Apr 27, 2009 9:33 pm

I'm pretty sure Sullins part number EBC24DN will work. I just ordered a couple of samples so I'll be able to test it out in a few days.

To answer your questions, yes this would allow for you to easily create a plug in device that would route the audio in/out pins in the expansion port to some of the cart pins.

My ethernet adapter design includes the following details:
1. the audio in (exp. port pin 3) is routed to a cart pin for games to provide their own sound. (does anybody dare put a SID chip in a cart for some rockin' retro sound?)
2. any cart that uses the ethernet device needs to connect the R/W, and a couple additional address lines from the CPU bus to the expansion port pins to facilitate memory mapped I/O. I haven't decided which ones yet.

Well, consider this. There are 10 pins in the cart port that connect to the expansion bus. If the ethernet adapter routes the audio in pin to the cart, and the cart routes the R/W to the expansion port, that leaves 8 left over. With 8 pins, I think routing A12, A13, and A14 along with A0, A1, A2, A3, and A4 to the expansion port would make the most sense. That means the memory mapped I/O region could land at the following addresses: $8000, $9000, $A000, $B000, $C000, $D000, $E000, $F000. And with the 5 least significant address lines there would be 32 available registers. This would put the memory mapped I/O registers up in the program ROM area, which is fine.

Also, since the chip in the ethernet adapter is a regular PIC microcontroller, there is also the possibility of adding new features to the code on the PIC as long as the TCP/IP stack and NES bus interfacing code isn't changed. Floating point anybody?

User avatar
Super-Hampster
Posts: 182
Joined: Fri May 12, 2006 4:40 pm

Post by Super-Hampster » Mon Apr 27, 2009 10:26 pm

I wasn't able to find a EBC24DN in a search.

Post Reply