Monday, May 5, 2014

NES Dual Port RAM Interface

UPDATE : Thanks for the great response - I'll be posting more videos throughout the week @batslyadams - I'd love to hear your ideas for ways to enhance games! Looking to livestream some development / testing this Thursday, 5/6/14.


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 :
* 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. 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.

Before wiring up the additional control lines :



Pretty excited to finally use this guy - your usual USB FTDI cable except with a 3.5mm jack. Routed the UART to a standard panel mount TRS on the back of the console.

It has been a blast playing with this thing - stuff I've done so far :

Debug Information
The original intention of this was be able to manipulate values in real time on a console for a game I've been developing, FCEUX is pretty incredible for emulation but I try to do a lot of testing on real hardware.





Scoreboards
Blades of Steel used to be my favorite, but I'm starting to come around on Ice Hockey. Heavily using the read function to pull any relevant data from a game then deciding what to do with it.
Would probably be great for automatic splits for speedruns.



Relay Control
Contra has a particular way of allocating shots, there are five slots for one player that a bullet can accommodate. I didn't want to cheap out and just trigger on a button press so all five values are pulled and checked for a new rising edge.



Hex editor
Wrote a live hex editor inspired by FCEUX, lots of fun goofing with variables on the fly. Great fun to have a "co-pilot" looking for ways to help you cheat, like a manual game genie.




Single Frame Step
The /NMI pin is the 60hz interrupt generated from the PPU, this is one of the trickiest parts of the NES since this is the only safe window in which to make writes to VRAM. Due to the limited video bandwidth, the game is typically laid out the following way :

Busy loop / Wait for NMI
Falling edge of NMI / Perform VRAM updates then set flag that NMI has occured
Return from NMI / Perform logic updates / queue VRAM updates
(repeat)

On a "step" command sent from the host the AVR waits until the natural falling edge /NMI then asserts low until it receives the command for another step. This safely inhibits the interrupt and keeps everything in sync. Could also set up a frame level breakpoint here!


 


Enhanced Rules / Displays
Every game needs a place to store the controller reads after a $4016/$4017 fetch. Typically these routines will still run in a pause menu (so you'll know when to exit). The idea is that the host can read that we are in a pause state AND the controller data you can control a menu offscreen.

Remote Reset
I provided two pins for the NMI and RESET on the console, these are jumpered from the 2A03 directly to GPIO on the AVR. Both of these inputs to the CPU are open drain.

The /RESET pin allows you to command a console reset the host so you wouldn't have to fuss with the console. You can provide an argument for a short reset (10ms) to jump to reset vector within the game and a long reset (~1s) which will bring you back to the powerpak menu.



Glitch Roulette
This was a lot of fun. The idea that every time the player jumps (memory location / method of determining jumping will vary from game to game) the host will write a random value to a random location. The sound engine is usually the first to go since they typically require a good amount of RAM and are overwriting is fairly harmless. A hit on an indirect memory address/stack is usually catastrophic.

Biggest ups to Todd Bailey for the help with assembling these things and Adam Stankiewicz and Nick Gargiulo for tirelessly testing blades of steel.

Saturday, December 28, 2013

NOTE! - COLOR MECHANICA - Sega CD Release

It's finally out! NOTE! - COLOR MECHANICA for SEGA CD

Seven KILLER tracks by the amazing NOTE! with an interactive ROM I've programmed for each. Hidden content, FMVs, and a high quality digital copy (MP3) on the disc! Tested extensively on real hardware / Kega Fusion.

 Technical junk: I was able to leverage a lot of the routines I've written for the Genesis but the Sega CD is a different beast entirely. Looking to do a writeup of my findings with the hardware. Been wrestling with the damned thing with only a handful of poorly scanned technical documents but it was worth it. Eat it SUB-CPU. 

Grab a copy / check the album here! http://note.monoanimal.com/album/color-mechanica

Thursday, December 19, 2013

Genny Light - 8Mbit devcarts


Genny Light PCBs: 8Mbit Genesis flashcarts for a (soon to be released) project.




Creepin.

Monday, November 4, 2013

Thursday, May 2, 2013

Codename VEC9 - Early demos

The VEC9 is a vector generator system I've been working on with Todd Bailey and Adam Stankiewicz for an original arcade game using an electrohome g05 (asteroids) monitor.

I've been writing the vector generator in VHDL for a spartan3e on a nexys2 board. The x/y/z are controlled by (hastily put together) R2R DACs. It's an actual processor, fetching opcodes out of dual port RAM that can be modified via USB.

Early test of a raster to check draw speed of the monitor.



Wrote some custom software to use it for visuals at 8static. Hooked it up to a Tenma oscilloscope (great color trace and lighter than the tek!), pointed a VHS camera at it and ran the composite feed to a V4 - worked out really well! Mirroring effects look really neat and the camera sensor picks up the beam in a great way, used the Genesis to overlay some of my effects.


Sunday, December 2, 2012

SNES <-> Ethernet Adapter + LA Gamespace tracker


Finally finished! I've been working on an example project for the SNES-ethernet adapter. Using it to receive information from Kickstarter to track the progress of the LA Gamespace project! Sorry that it's a bit quiet - I had to turn off the music or I would have went crazy.

Wiznet adapter connected to an ATMEGA644 via SPI. The MCU buffers incoming packet data and converts it to a format the SNES can understand (connected to controller port 2).
Powered from the SNES via 5V - the only other connection is ethernet. Still needs more work but it's getting there!

SNES side written in 65816 assembly - using a super powerpak development cartridge.

(in case you haven't already checked it out - please go to http://www.lagamespace.com/ - the rewards are amazing and there are countless amounts of talented people involved!)

 Greets to my console dudes+ - 68KREW - AGA - TMB - NO CARRIER - ENSO - ALEX MAUER - BIT SHIFTER - NOTE! - ANIMAL-STYLE - ZABUTOM - KeFF - PT!H! - L!W! - NERD NITE AUSTIN - DOOLS - DANIMAL CANNON

Wednesday, November 14, 2012

Blip Tokyo 2012 - SNES ROM Flyer




SNES ROM invite for Blip Tokyo 2012. Tested on real hardware.
http://tokyo.blipfestival.org

Try the ROM in your favorite emulator : It looks/sounds much better in there I promise!
https://dl.dropbox.com/u/21912138/BlipFestivalTokyo2012.sfc

Code : Batsly Adams
http://www.batslyadams.com

Gfx : KeFF
http://konttine.tumblr.com/

Music : Zabutom
https://www.facebook.com/zabutom

Spent more time than I'd like to admit getting this thing going! Lots of video tricks - the SNES hardware is pretty sweet (HDMA) but mode7 is tough! I have a pretty good development setup now.

GREETS TO 68KREW! - AGA - TMB - NO CARRIER - CTRIX - MONODEER - 2 PLAYER PRODUCTIONS - SOUNDBYTES CREW - HEXAWE - BLEO - HERRPROF - HEOSPHOROS - LIKELUKE - PT!H! - 8STATIC - KRIS KEYSER - EMI - MATTHECHT - DUSTMOP - ROCHESTER CHIP - ABRASIVE - FUNKYSAUCE - SECNARF - DAURAGON - LUMAR - DOOLS - KRUGS - ANIMAL-STYLE - CHEAPSHOT

Show Me That Finger Waggle

EL wire sign made for George & Jonathan for Blip Festival 2012.



Had an idea to make some kind of LED lit sign for G&J when I found out they were playing. Started toying with the idea of an EL wire sign, then things got out of hand.

Ordered some triacs to switch the power for the animation (first time I've ever switched AC without a relay), ended up picking the wrong part number. Damn. I used a relay module I had on hand due to time constraints but it turned out just fine - not as elegant but I like the clicking. I ended up adding a handheld trigger button so I could waggle manually with the music. Code is simple, when the button is released it shimmies to the left, and when it's held, it moves to the right. Wrote a timeout after 2 seconds to return to a middle position.

Animation driver (microprocessor/relays) powered by a 9V battery through a standard 7805, EL wire powered by two separate 2xAA inverters.

Thank you to:
Kathy who laid out the design / stapled all of the EL wire (perfectly - it looked incredible).
Chris helped me mount everything to a stick so I could hold it way above the crowd without it falling to bits.






A couple of GIFs from WTSNACKS...



Video of it coming out at 5:50- seriously so much fun to walk through the crowd with this thing.


Check out those synced animated LED headbands too - James is a genius.

Thursday, June 7, 2012

Monodeer Vector

Monodeer logo on a HP1740A in X-Y mode.
Design / line segments generated in a little windows tool I wrote and relayed through a propeller board with a couple of SPI DACs.

Plotting.


Mark tuning up the brightness/focus.

Vanity Shot



Wednesday, April 25, 2012

Capcom Q25

Snagged a Capcom Q25! Almost done restoring/converting it - details soon.


Tuesday, April 3, 2012

Lab 2.0


Almost done! Added some new shelves / reorganized projects into separate bins.

I've been working on a digital vector generator using an AVR and a couple of SPI DACs. Top scope has the values in the time domain, bottom is showing the x-y plot. All shapes are closed for now - now to add a Z / brightness!

Saturday, January 28, 2012

Genesis Spectrum Analyzer

Built a custom interface using an ATMEGA328, an MSGEQ7 (7-band spectrum analyzer chip) and a genesis cable plugged into port 2. Sends all 7 bands with an 8-bit resolution with a 4-bit ID to make sure things are always in sync. Running the genesis side ROM on an everdrive.

Really wanted to try my hand at having an audio assisted visual set. Tried an amplitude based one but it wasn't exactly what I was looking for. The chip works really nicely, and once you adjust the threshold it finds the beat very reliably.


Debug / POC ROM - ran a frequency sweep through, works perfectly!


Actual implementation into a new ROM I've been working on. A set of lines are drawn every frame into a tilemap in RAM then DMA'd over right after vsync. Rather than overwriting the tiles under it each line has a defined weight that is added to the array. The sum corresponds to a palette entry, so the longer the effect stays on the more intense the color becomes (black->blue->purple).

Only using the 63hz band here, very effective! You can see around 1:15 where there is a constant tone the effect will play out.

Music by the amazing Danimal Cannon!


Now to (tastefully) work it into some new effects! Should have it in time for Blip Festival Australia.