Rainbow : a WiFi cart / mapper for the NES !

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

Moderators: B00daW, Moderators

User avatar
Broke Studio
Formerly glutock
Posts: 176
Joined: Sat Aug 15, 2015 3:42 pm
Location: France
Contact:

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by Broke Studio » Wed Mar 18, 2020 4:11 am

Bandwidth between the NES and the ESP is:

- 4 cycles when writing a byte

Code: Select all

sta|x|y $5000
- 6 cycles when reading a byte:

Code: Select all

lda|x|y $5000
nop
NOTE: nop may be removed in the future
My first game : Twin Dragons available at Broke Studio.

User avatar
RogerBidon
Posts: 44
Joined: Wed Dec 28, 2016 7:16 am

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by RogerBidon » Wed Mar 18, 2020 4:35 am

Both implementations work. InlFirmware is the implementation of the mapper nesNET, being developped by INL, while BrokeStudioFirmware is the implementation of RAINBOW mapper from BrokeStudio.

I originally made two branches, expecting to separate them, but finally having an emulator handling both is handy (at least for me)

Both mappers are under heavy development, on hardware side as on emulator side. Rainbow is more stable though (most hardware choices seem already fixed.)

As for code quality of the branch. Sorry for that. I focus only on getting things to work as reactively as possible, ignoring any coding style or "should be done that way" if I can save some dev time or stay in my comfort zone. That's why you can see a trashy one-file web server implementation that starts without user explicit consent, no save-state support or bad compatibility with the old PPU. The plan is to have something that helps our work as rapidly as possible, and to wait some stability to clean/discuss design choices and propose to merge upstream.

calima
Posts: 1219
Joined: Tue Oct 06, 2015 10:16 am

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by calima » Wed Mar 18, 2020 6:45 am

I mean batch bandwidth. If the NES does nothing but read or write, can the ESP keep up? Do buffers fill up and it has to wait? How fast is the transfer then?

User avatar
Broke Studio
Formerly glutock
Posts: 176
Joined: Sat Aug 15, 2015 3:42 pm
Location: France
Contact:

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by Broke Studio » Wed Mar 18, 2020 7:00 am

You mean if the NES floods the ESP ?

Communication ESP => NES is not an issue.

But NES => ESP can be tricky indeed. For now I didn't have any issue with it, but I should make a test rom that really floods the ESP with various commands, some easy to process (log some debug data) and some more complex (handle files, connect to a server,...).
My first game : Twin Dragons available at Broke Studio.

User avatar
Broke Studio
Formerly glutock
Posts: 176
Joined: Sat Aug 15, 2015 3:42 pm
Location: France
Contact:

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by Broke Studio » Wed Jul 15, 2020 10:24 am

2020-07 update

Time to update this topic since a lot of stuff happened since last time.

Prototype

I'm now using a new prototype with a bigger CPLD and have created a brand new mapper (named Rainbow mapper) to be used with it.
Here's a pic of the board:

Image

Mapper

Here's an overview on what the mapper has to offer:
  • WiFi capabilities to allow online gaming, cartridge update, downloadable content... (optional)
  • 2 PRG ROM banking modes
  • 4 CHR ROM banking modes
  • Up to 32KB of WRAM, mappable at $6000-$7FFF but also within $8000-$DFFF
  • Scanline IRQ (identical to the one used in the MMC3 mapper)
  • Three extra sound channels (2 pulse channels and 1 sawtooth channel, identical to those in the VRC6 mapper)
  • Self-flashable PRG-ROM / CHR-ROM
  • Possibility to use CHR-ROM for pattern tables and CHR-RAM for name/attribute tables
  • 4 mirroring modes: vertical, horizontal, 1-screen, 4-screen
  • Up to 4 independent nametables when using 1-screen mirroring (CHR-RAM only)
  • Up to 4 sets of 4 nametables when using 4-screen mirroring (CHR-RAM only)
For more information on the mapper, the WiFi protocol etc, please check this github page: https://github.com/BrokeStudio/rainbow-lib.

Wanna try?

For those of you who are interested in playing with it, you can use this custom version of FCEUX with Rainbow mapper support: https://github.com/BrokeStudio/fceux.
If you don't want to compile it yourself, you can download the latest build for Windows here: http://brokestudio.fr/rainbow/fceux/

Also you can find chat example project here: https://github.com/BrokeStudio/rainbow-chat.
It provides a NodeJS server/webapp and a NES source code.

Real world, real time project

I work a lot with RogerBidon, Super Tilt Bro. developer.
He has adapted his versus game to use Rainbow capabilities, and it is now playable online! You can even try it online on its itch.io page directly from your browser.

I sent him a proto board, and we even played it between two NES!
Video here: https://twitter.com/Broke_Studio/status ... 01517?s=20

What's next?

The project is starting to get more and more stable, that's why I feel comfortable sharing the FCEUX custom build and demo project now.
RogerBidon's Super Tilt Bro. game is also a great way to showcase how far we can push the limits of online gaming on the NES, and it's pretty awesome!

We'll continue to add features and test everything as much as we can, and int the meantime, feel free to let me know if you have any questions, if you have trouble setting everything up to try it by yourself, or if you have any suggestions, I'd be happy to help :)
My first game : Twin Dragons available at Broke Studio.

Icelvlan
Posts: 9
Joined: Wed Sep 04, 2013 3:11 pm

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by Icelvlan » Sun Jul 19, 2020 9:17 am

Cool project, are you going to be release Gerber files? I'd want to play around with this and build my own

User avatar
Broke Studio
Formerly glutock
Posts: 176
Joined: Sat Aug 15, 2015 3:42 pm
Location: France
Contact:

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by Broke Studio » Sun Jul 19, 2020 10:31 am

No I won't release gerber files but I'll sell boards some day.
My first game : Twin Dragons available at Broke Studio.

User avatar
Ben Boldt
Posts: 612
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by Ben Boldt » Mon Jul 20, 2020 2:58 pm

Can I ask what level shifter chips you're using? Is there just 2 or do you have more on the back of the board? Any issues with them (data direction, latency, etc.)?

User avatar
Broke Studio
Formerly glutock
Posts: 176
Joined: Sat Aug 15, 2015 3:42 pm
Location: France
Contact:

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by Broke Studio » Tue Jul 21, 2020 12:33 am

I use 2 level shifters.
One 16 bit from the NES to the CPLD (74LVC16245) and one bidir 8 bit NES <=>CPLD (74LVC245).
No issue with them as of now!
My first game : Twin Dragons available at Broke Studio.

User avatar
dougeff
Posts: 2764
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by dougeff » Fri Sep 04, 2020 3:36 pm

If I wanted to make a game that could have new levels added later, how would I do that? I understand that the game ROM should read from the wifi port and copy to SRAM, and the game would then load from the SRAM to play from it.

But the other end I don't understand. Would I need to write an app that could send a file to the wifi chip, or is this something that could be easily done with off the shelf file transfer apps?
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
norill
Posts: 25
Joined: Wed Dec 07, 2016 12:05 am
Location: PAL

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by norill » Fri Sep 04, 2020 4:50 pm

i'm super hyped for this and would love to develop something on it. i am wondering how does it handle connecting to wifi. how does it know the SSID and password?

User avatar
Broke Studio
Formerly glutock
Posts: 176
Joined: Sat Aug 15, 2015 3:42 pm
Location: France
Contact:

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by Broke Studio » Sat Sep 05, 2020 12:10 am

norill wrote:
Fri Sep 04, 2020 4:50 pm
i'm super hyped for this and would love to develop something on it. i am wondering how does it handle connecting to wifi. how does it know the SSID and password?
The WiFi chip on board (the ESP) also acts as a WiFi access point. You connect to it and access to a web page that allows you to set up your WiFi network.
dougeff wrote:
Fri Sep 04, 2020 3:36 pm
If I wanted to make a game that could have new levels added later, how would I do that? I understand that the game ROM should read from the wifi port and copy to SRAM, and the game would then load from the SRAM to play from it.

But the other end I don't understand. Would I need to write an app that could send a file to the wifi chip, or is this something that could be easily done with off the shelf file transfer apps?
Two possibilities here.
Either you set up a sort of game server that allows your game to download content and then use it, or the user can upload files using the ESP webpage (see answer above), and then you can use it from the ROM.

You can load the data in RAM/WRAM, or you can self-flash the PRG flash chip with the new data.

This upload/file transfer functionality can be used/tested with the custom version of FCEUX, but I'm not sure I shared the webapp yet.

Hope it helps, let me know if it's not clear or if you need more information, I'd be happy to help :)
My first game : Twin Dragons available at Broke Studio.

User avatar
dougeff
Posts: 2764
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by dougeff » Sat Sep 05, 2020 10:36 am

So let me see if I got this straight. If I set up a local server , and it can have a local ip address, and have a file on the server then the Wi-Fi cartridge can be instructed to access this server and this file?

And, when I play the cartridge, and select the "download new levels" option, I would then input the x.x.x.x IP address, and the file name, and then it would transfer the file to the cartridge?

Something like that?
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
Broke Studio
Formerly glutock
Posts: 176
Joined: Sat Aug 15, 2015 3:42 pm
Location: France
Contact:

Re: Rainbow : a WiFi cart / mapper for the NES !

Post by Broke Studio » Sat Sep 05, 2020 11:47 am

dougeff wrote:
Sat Sep 05, 2020 10:36 am
So let me see if I got this straight. If I set up a local server , and it can have a local ip address, and have a file on the server then the Wi-Fi cartridge can be instructed to access this server and this file?
Exactly!

You can then use the SET_SERVER_PROTOCOL command to set the protocol (WebSocket or UDP), and SET_SERVER_SETTINGS command to set server ip/port. There's also a way to set it directly from the webapp so you don't have to set it each time.

Then, you use the CONNECT_SERVER command to connect to your server (WS) or start listening (UDP), and finally you can use SEND_MSG_TO_SERVER command to send messages to your server and ask for a specific file for example.

Note that due to the messages size limit (256 bytes), you'll need to split your file into multiple messages. So maybe multiple requests from the NES and multiple responses from the server.
dougeff wrote:
Sat Sep 05, 2020 10:36 am
And, when I play the cartridge, and select the "download new levels" option, I would then input the x.x.x.x IP address, and the file name, and then it would transfer the file to the cartridge?

Something like that?
The method I described allows you to get data from your server to the NES.

If you want to download a file from your server and store it in the ESP flash memory to use it later, that's something that would need to be added. Actually, it's on my to-do list, if you specifically need it, just let me know. It would also greatly simplify the multiple requests/responses issue

Otherwise, the first method works fine.
My first game : Twin Dragons available at Broke Studio.

Post Reply