Sound Card 2.0 for 65816 PC (maybe a little overboard, but I'm OK with that)
Updated: May 30, 2022
I'm getting close to having my 65816 PC updated with rev 1.1 PCBs (for the motherboard and video memory card). I have a plan for a USB mouse already. While I have the sound card from my 6502 build (see Audio), I thought I would try to step up the challenge level for myself and design a 2.0 version.
My general goals:
Add two additional programmable sound generators (PSGs) to the design of my 1.0 sound card, for a total of six PSGs. I found four PSG were just shy of playing more elaborate music but were sufficient. However, this did not leave any channels for simultaneous sound effects.
I would like to play music in the background (e.g., of a game) and not impact my PC's 65816. I'm thinking I will essentially include a mini-6502 (processor, ROM, RAM) to offload all music and sound effects from the 65816.
To facilitate handoff of audio commands and data from the 65816, I will bridge the 65816 and 6502 with dual-port SRAM.
My previous design had the SD card separate from the sound card. I plan to include the SD card (and related SPI communication components, such as hardware shift registers) on the sound card itself. I know I can just use a VIA for the SPI, but my previous SPI work is based on a pair of shift registers, and I plan to keep this design relatively intact.
In addition to the sound card, I am including a large ROM for audio assets. This ROM will be accessed by the I/O ports on a pair of the PSGs.
While my 1.0 card had bar graphs for sound levels and built-in analog amplification, I'm going without these. I didn't find the amplified output to be overly useful, since I used a lower power line out instead.
Onboard joystick ports (qty. 2).
ISA card physical format to connect to my 65816 motherboard.
For the oscillator, I think I'll run a 4 MHz oscillator, driving the 6502 and the PSGs. The YM2149 supports a 4 MHz clock and can internally halve it. This will let me keep all my code based on a 2 MHz clock for the audio, and I can run the 6502 at 4 MHz. Or, I'll add a second oscillator to give me more flexibility.
I'm laughing a bit as I look at the list above, but I figure, "why not?!". My goal is to learn, and this will force me to step things up a bit. I have a pretty good handle on my 1.0 SPI, SD card, and Sound Card. The communication between the 65816 and 6502 may be the trickiest part, but my VGA 2.0 work will help me here.
Given the above, here's what I have for a quick PCB design (just so I could see how big and ugly this card will be):
Ongoing Design Work
As I work on the design, I'll post updates below.
For the 6502 core of the sound card, I plan to use the following decode logic.
Schematic & PCB 85% Complete
I have much of the schematic wired up. Next: breadboard version for testing.
The above board is fully connected and routed. No breadboard testing has been done yet. The PCB cost per board is $11 USD.
I'm looking to build out the sound card, or at least a significant portion of it, on a breadboard. This will help me validate the design prior to ordering PCBs. This might be a pretty big breadboard project, with an even larger 65816 & 6502 assembly coding effort. Lots of wire will be needed.
See Sound Card 2.0: Breadboard Build (running post).
I've decided to go with a 65816 for the sound card co-processor. The primary reason is so that I can use 16-bit registers where it's helpful.
I probably should add some form of debug headers, maybe even a connection for LCD or serial output, on the sound card PCB.
I chose to remove the joystick ports and related 4068 ICs. Instead, I am going to build a separate I/O card that includes serial, SPI, and maybe USB (?).
Latest PCB Design
I changed the layout of the PCB, trying to keep the 65816-related ICs together, the PSGs together, oscillators close to the clock destinations, and moving from digital on the left of the PCB to analog on the right.
I am working on a method to communicate between the system 65816 and the sound card 65816 -- through the dual-port SRAM. At this point, my thought is to use the dual-port RAM as a command FIFO buffer, where the system 65816 submits commands and associated data for processing by the sound card. Along with submitting a command, the system will update a most-recently-written-location value. The system 65816 will trigger an interrupt on the sound card 65816 after new commands have been placed in the FIFO buffer. The sound card will then retrieve and process the commands, starting at a most-recently-read-location value, proceeding through the most-recently-written-location value. This is similar to how I integrated an FPGA for video output on my 6502 system. This same approach can be reversed, allowing the sound card to submit requests back to the system. The graphics below show the basic process, how I plan to use the 2Kx8 of dual-port SRAM, and example commands that I plan to implement initially.
For the sound effect and song numbers, I will likely maintain some form of a lookup table on the asset storage ROM. Initially, I will store all sound effects and songs on the asset storage ROM. Later, I will shift all larger content to the SD Card (e.g., music). The asset storage ROM can track what content is where, and when a command is submitted to play a sound effect or song, the lookup can be used.
I do not have any initial plans for communication from the sound card back to the system, but the above architecture should support such communication. I could even use the sound card's 65816 as a secondary processor, submitting processor-intensive tasks (not necessarily sound-related) from the system to the sound card processor, and allow the system's primary processor to do other things.
PCB Build Complete
PSG / VIA Design Overview & Sound Card Emulator
65816 Sound Card: First Song Playback from Media ROM
65816 Sound Card: First Song Playback from SD Card (SPI) & Updated Output Schematic
Creating New Music for My 65816 Sound Card (rehsdonline.com)
System to Sound Card Communication
Substantially-complete - Installed in System
65816 Sound Card Substantially Complete!
Schematic & PCB Design
The schematic and PCB design files for the sound card in the above video have been posted to my GitHub. See PC-65816/Designs for Initial PCB orders --PRIOR TO FIXES at main · rehsd/PC-65816 (github.com).
Updated schematic and PCB design files available here: PC-65816/Schematics and PCB Design Files/Sound Card 1.1 at main · rehsd/PC-65816 (github.com).