How does YM2017 work?
If you keep up with my other thing, Catskull Electronics, you’ll know that we’ve been putting together a Sega Genesis/Megadrive compilation album-on-cart named “YM2017”. Basically, we had musicians from all over the world contribute songs. Due to size restrictions, we were only able to accept 9 tracks. Let me tell you, they’re the 9 best Sega Genesis tracks I’ve ever heard! Preorders are happening right now, and won’t continue beyond the end of this month. If you want a cart, the only way to get one is to preorder! Once preorders end, they’re gone forever.
As you might be able to tell, there’s an 8x8 LED dot matrix display on the cart. It’s used as a real-time music visualizer, and can also display other graphics. I like to think of it as a 16-bit VMU (if you had a Dreamcast, you know what I’m talking about!). As far as I know, nothing like this has ever been done on any console. A lot of people wonder how this is even possible, so this post will offer an explanation.
The hardware-side of YM2017 is a twist on an ordinary ROM/RAM cartridge with an LED matrix mapped to the typical RAM address space which begins at the 2MB mark. Using a common Dual 2-line to 4-line Decoder (74LS139) the ROM and RAM address spaces are properly separated and this allows for each device, or sub-circuit, to be enabled separately when requested in software. There are two enable output pins coming from the 74LS139 mapper and while the lowest enable pin goes to the enable pin of the ROM, the next enable pin goes to a set of 3-state Octal Buffers/line drivers. These are used for two purposes, 1. To isolate all current activity from the shared data/address bus and 2. To enable/disable the full LED sub-circuit as though it were a fully integrated device such as the ROM. We certainly cannot have the Data and Address pins shorting together if too much current was sourced or sank through the LEDs and we also cannot have the LEDs responding to every single read or write on the bus.
The way that the LEDs are activated within the RAM address space is by tying each column of LEDs to a data bit on the bus and each row to an address bit; the lowest 8 bits on each bus were chosen for simplicity but this adds a complexity in and of itself. Displaying a legible picture on the display is not quite as simple as writing a sprite or sound register data to the address space above 2MB. First of all, each row of LEDs is tied to a single address bit, meaning only one can be activated at a time or multiple rows would light up with the same data. To work around this, each address bit must be activated one-by-one while the appropriate data is written to that address in series quickly enough to fool the human eye into thinking it is a solid picture. For this, there is a dynamically updated 8 by 8 sprite in system RAM that is copied and written line by line. The Sprite itself is updated with precisely timed data stored in a table which represents the level of each sound channel at the correct time.
Once the software routines were created; however, automating the LED matrix is pretty self explanatory. It simply performs the above-mentioned actions repeatedly with the ever-updating sprite data. At this point, it just runs forgotten in the background.
Aside from vertical lines, the LED matrix can easily be controlled to display scrolling text, picture animations or even varying brightness on individual LED “pixels,” granted the programmer invests enough time.
We are planning on releasing the ROM source code after the cartridge ships. The hope is to inspire “copycats”. My dream is to make it that much easier for artists and others to make their own Sega Genesis cartridge albums. For more updates and other cool news, like Catskull Electronics on Facebook.