NES Dual Port RAM Interface
NES memory replacement that allows live modification of RAM at runtime.
Written in AVR C/assembly.
I've been writing a game recently and was looking for a way to live debug on real hardware. The original solution was to fire variable information out the second controller port to serial every NMI but I decided to to take a shot at a new PCB for the console I've been dreaming about for a while.
The board routes the left port of the dual port RAM (Cypress CY7C136) to the DIP footprint on the NES and the right port to an AVR (ATMEGA164), this allows me to read and write any location at runtime without bus conflicts. Control is provided through the UART and two additional pins are soldered directly to the 2A03 to control /NMI and /RESET. I took a console and desoldered the 2KB RAM and replaced it with a socket. I'd like to permanently solder this in now that they work but having them removable for debugging was a huge help. AVR control code was written mainly in C with some assembly sprinkled across for the memory control portions.
The AVR sits and wait for serial commands and can perform several functions including :
I had pretty great results with using 250000 baud with the Genesis flasher project which is plenty fast for what I'm trying to do here. Cautionary tale about using this dual port RAM part, be sure to operate the other side normally even though it appears to be decoupled. As far as I can tell from the datasheet leaving CE low shouldn't have an effect on the opposite port but it most certainly does. Next revision could definitely use a few pullups on the AVR side, other than that I'm pretty happy with the layout.
- Read / write of any memory location
- Quick dump of an entire 256-byte page
- Freezing of memory addresses (rewriting a single value constantly in the busy loop)
- Single frame stepping by controlling the NMI
- Remote reset of console
- Applying auto increment to tables to a single variable (fun for sine waves on x/y positions!)