While writing a game for his old-school NES console, Andrew Reitano realized that live debugging on real hardware would definitely be a step up from the usual software-based fare.
The original solution? Firing variable information out the second controller port to serial every NMI. However, Reitano ultimately decided to take a shot at designing a new Atmel-powered PCB to interface with the console.
“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 MCU), this allows me to read and write any location at runtime without bus conflicts,” Reitano explained in a recent blog post.
“Control is provided through the UART and two additional pins are soldered directly to the 2A03 to control /NMI and /RESET. AVR control code was written mainly in C with some assembly sprinkled across for the memory control portions.”
The ATmega164 – tasked with “waiting” for serial commands – performs a number of functions including:
- 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)
“[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,” he added. “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.”
Interested in learning more? You can check out the project’s official page here.