Controlling program ROM with a RPi or Arduino

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

Moderators: B00daW, Moderators

Post Reply
Milesy303
Posts: 9
Joined: Thu Jun 14, 2018 2:50 pm

Controlling program ROM with a RPi or Arduino

Post by Milesy303 » Thu Jun 14, 2018 2:59 pm

So I have desoldered the program ROM from a UNROM pcb and put jumper headers in its place.

All I want to do in this first experiment is see if I can load the data from the controller rather than EPROM. File I/O is likely slow so I'll load the data into a byte array.

Firstly is there likely to be any issues here with actually doing this? Clock issues?

Secondly what's the best way to get just the program data from the UNROM NES file?

Many thanks

Chris

lidnariq
Posts: 8786
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Controlling program ROM with a RPi or Arduino

Post by lidnariq » Thu Jun 14, 2018 3:10 pm

The device that you are attempting to make is called a "ROM emulator".

A Raspberry Pi or an arduino are completely unsuitable for this task; they simply lack the ability to respond dynamically to the 2A03 with low enough delay.

The Atari 2600 has a device (the "Harmony Cart") that uses a microcontroller as a ROM emulator, but it's using one with drastically lower latency than the RPi / most other ARM cores, and the 2600's CPU is 2/3 the speed of the NES's CPU.

Milesy303
Posts: 9
Joined: Thu Jun 14, 2018 2:50 pm

Re: Controlling program ROM with a RPi or Arduino

Post by Milesy303 » Thu Jun 14, 2018 3:27 pm

Thanks for the response, I thought that was maybe going to be the answer. Yes the Pi is slow, experience there but I thought the atmega chip at least had some sort of capable speed? The Arduino is reasonably low level compared to the Pi.

What sort of chips and circuitry are the likes of the NES ever drive using to get that sort of speed?

Perhaps an alternative solution would be using the Arduino to program a chip on the fly, but that sounds not much different to just programming the chip manually on a donor.

lidnariq
Posts: 8786
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Controlling program ROM with a RPi or Arduino

Post by lidnariq » Thu Jun 14, 2018 3:40 pm

Milesy303 wrote:Thanks for the response, I thought that was maybe going to be the answer. Yes the Pi is slow, experience there but I thought the atmega chip at least had some sort of capable speed? The Arduino is reasonably low level compared to the Pi.
Yeah, still no.

It turns out that usually when you get a microcontroller that's fast enough to serve as a ROM emulator, it also grows enough complexity that it can't manage the latency.
What sort of chips and circuitry are the likes of the NES ever drive using to get that sort of speed?
RAMs and an FPGA to emulate mapper hardware.
Perhaps an alternative solution would be using the Arduino to program a chip on the fly, but that sounds not much different to just programming the chip manually on a donor.
It's true, but not having to physically unplug things and replug things does make it more convenient.

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

Re: Controlling program ROM with a RPi or Arduino

Post by Memblers » Thu Jun 14, 2018 8:49 pm

A while back I traced out and drew an (incomplete) schematic of the ROM emulator I used to always use. Wasn't something I built, it was designed in '93 and I bought a used one in '99. Connected to target board with an IDC to DIP adapter, you'd just plug that into an EPROM socket. On the other end, it connected to a PC's parallel port through an RJ6 cable, the "in" connector on the schematic. The "out" connector is so you could chain several of the boards together to emulate multiple EPROMs. Pretty sure there are buffers on the other side of the RAM chip that I didn't trace out and put in the schematic.
edit: also, those "reset" outputs are used to reset the CPU on the target board

That's pretty much the type of circuit you'd need to control the ROM with an MCU. Obviously could be done differently and better with an MCU instead of a few pins from a parallel port. If it's not helpful, I hope it's at least interesting.

Here's a currently available product that does this. At $175 + $12 it's kinda spendy, but it is very niche.
https://www.moates.net/ostrich-20-the-n ... p-169.html
http://www.moates.net/emuc3206-emulatio ... l?cPath=32
Attachments
TurboROM schematic.PDF
(64.77 KiB) Downloaded 162 times

krzysiobal
Posts: 589
Joined: Sun Jun 12, 2011 12:06 pm
Location: Poland

Re: Controlling program ROM with a RPi or Arduino

Post by krzysiobal » Sun Jun 17, 2018 4:33 pm

Then you can put Atmega16/32, USB, RAM (628512 - 4 MBit), battery backup and you got perfect EPROM emulator, you can project the PCB to make the EPROM pinout like for DIL28 NES Mask Roms or any DIP32.
Atmega has 32 pins, 2 for controlling USB and 30 for controlling RAM (A0-A18, D0-D7, /CE, /OE, /WE).
Atmega has 3 state outputs so it will perfectly act in this role (put all memory-pins in three state mode at powerup and set them to outputs only when receiving command from USB)

With V-USB you can have 7kB/s real transfer rate so filling whole memory would take around minute.

Building cost should not exceed 5$.

Milesy303
Posts: 9
Joined: Thu Jun 14, 2018 2:50 pm

Re: Controlling program ROM with a RPi or Arduino

Post by Milesy303 » Mon Jun 18, 2018 1:43 am

lidnariq wrote:
Milesy303 wrote:Thanks for the response, I thought that was maybe going to be the answer. Yes the Pi is slow, experience there but I thought the atmega chip at least had some sort of capable speed? The Arduino is reasonably low level compared to the Pi.
Yeah, still no.

It turns out that usually when you get a microcontroller that's fast enough to serve as a ROM emulator, it also grows enough complexity that it can't manage the latency.
What sort of chips and circuitry are the likes of the NES ever drive using to get that sort of speed?
RAMs and an FPGA to emulate mapper hardware.
Perhaps an alternative solution would be using the Arduino to program a chip on the fly, but that sounds not much different to just programming the chip manually on a donor.
It's true, but not having to physically unplug things and replug things does make it more convenient.
Thank you. I might just write something to play games on my C64 instead haha.

Milesy303
Posts: 9
Joined: Thu Jun 14, 2018 2:50 pm

Re: Controlling program ROM with a RPi or Arduino

Post by Milesy303 » Mon Jun 18, 2018 1:46 am

Memblers wrote:A while back I traced out and drew an (incomplete) schematic of the ROM emulator I used to always use. Wasn't something I built, it was designed in '93 and I bought a used one in '99. Connected to target board with an IDC to DIP adapter, you'd just plug that into an EPROM socket. On the other end, it connected to a PC's parallel port through an RJ6 cable, the "in" connector on the schematic. The "out" connector is so you could chain several of the boards together to emulate multiple EPROMs. Pretty sure there are buffers on the other side of the RAM chip that I didn't trace out and put in the schematic.
edit: also, those "reset" outputs are used to reset the CPU on the target board

That's pretty much the type of circuit you'd need to control the ROM with an MCU. Obviously could be done differently and better with an MCU instead of a few pins from a parallel port. If it's not helpful, I hope it's at least interesting.

Here's a currently available product that does this. At $175 + $12 it's kinda spendy, but it is very niche.
https://www.moates.net/ostrich-20-the-n ... p-169.html
http://www.moates.net/emuc3206-emulatio ... l?cPath=32
Thank you I will look into this option.

Milesy303
Posts: 9
Joined: Thu Jun 14, 2018 2:50 pm

Re: Controlling program ROM with a RPi or Arduino

Post by Milesy303 » Mon Jun 18, 2018 1:48 am

krzysiobal wrote:Then you can put Atmega16/32, USB, RAM (628512 - 4 MBit), battery backup and you got perfect EPROM emulator, you can project the PCB to make the EPROM pinout like for DIL28 NES Mask Roms or any DIP32.
Atmega has 32 pins, 2 for controlling USB and 30 for controlling RAM (A0-A18, D0-D7, /CE, /OE, /WE).
Atmega has 3 state outputs so it will perfectly act in this role (put all memory-pins in three state mode at powerup and set them to outputs only when receiving command from USB)

With V-USB you can have 7kB/s real transfer rate so filling whole memory would take around minute.

Building cost should not exceed 5$.
I had considered using a couple of shift registers to reduce the number of pins needed. Thanks.

Milesy303
Posts: 9
Joined: Thu Jun 14, 2018 2:50 pm

Re: Controlling program ROM with a RPi or Arduino

Post by Milesy303 » Mon Jun 18, 2018 2:33 pm

Could you do something with PFGA fast enough?

Milesy303
Posts: 9
Joined: Thu Jun 14, 2018 2:50 pm

Re: Controlling program ROM with a RPi or Arduino

Post by Milesy303 » Thu Jun 21, 2018 4:59 pm

Can anyone recommend a FPGA dev board that would be suitable for this project?

I see the everdrive N8 only uses a Cyclone II chip so should be cheaper than the IV to do something similar with that.

What about the cheaper Chinese boards?

lidnariq
Posts: 8786
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Controlling program ROM with a RPi or Arduino

Post by lidnariq » Thu Jun 21, 2018 5:10 pm

All preëxisting current FPGA dev boards are strictly 3V only; the NES is 5V. You can't directly connect the two without damaging one or both.

You might be able to find a historical one? I don't know.

The PowerPak contains an (by now very) old XC2S30 ("Spartan-2"), two 512 KiB SRAMs, a 32 KiB SRAM, and a 64 KiB chunk of flash. Nowadays the cheap iCE40 FPGAs are comparable in ability, but will need voltage translation.

Milesy303
Posts: 9
Joined: Thu Jun 14, 2018 2:50 pm

Re: Controlling program ROM with a RPi or Arduino

Post by Milesy303 » Fri Jun 22, 2018 1:42 am

This one takes 7.5 input. Can't see much about levels within though.

https://www.digikey.co.uk/product-detai ... gK2PfD_BwE

lidnariq
Posts: 8786
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Controlling program ROM with a RPi or Arduino

Post by lidnariq » Fri Jun 22, 2018 10:16 am

Sadly, even as old as that IC is, it's still not 5V tolerant.

( https://www.altera.com/products/fpga/cy ... pport.html § Cyclone II Device Handbook (All Sections) ; chapter 5 "DC Characteristics and Timing Specifications" says it supports a maximum voltage of 4.6V and makes no mention of tolerance of higher voltage (so it isn't).

Post Reply