I started working on some music for my game. In this video, I am using the sound card that I built for my 6502 system. All sound is being generated by the sound card, controlled by the 6502. I ran out of ROM storage, so I'll need to connect an SPI EEPROM, SD Card, or some other storage to continue building out 8-bit music. :)
Postscript
I've had some requests for design/code files. You can find a full list of source links at the bottom of this post. For easy access:
Sound card PCB. This is an EasyEDA project.
The files I used for the 6502 Assembly (ROM) for the above video are posted here.
I am approaching sound in a couple of ways.
I am using the sound card's ROM to store basic sound effects, like those in Dots connected... Retro gaming started. This ROM is a small 28C16 ROM. In my first design of the sound card, I included a pair of these ROMs, but I'm only using eight address lines (so I'm not even getting the full address space of the small ROM). I had added these ROMs so that I could experiment using the AY-3-8910 PSGs to retrieve data with their I/O ports. If I was to spin a new version of this PCB, I would drop the two small ROMs, find the largest parallel ROM I could find, and use one PSG to set the ROM address and another PSG to retrieve the data from the ROM. This would allow significantly more storage on the sound card itself. With four PSGs, you could add two large ROMs with the appropriate changes in address and data lines.
I create sound effect data by using my Dynamic Sound Editor and burning this data to the sound card ROM. See 6502 Audio PCB Complete!.
For the video above, I am using the 6502 ROM (28C256) to store the code for the music. My approach for the music is rather verbose at this point, as I am experimenting with what I can do with the 12 channels from the four PSGs. I will need to refactor my approach to be more efficient.
In the 6502 code, I have support for reading a sequence of data from a ROM and playing that sequence. In g12.asm, see the "Sound" section and within it, look for "PlayFromROM."
For the music, I included a separate file, music.asm. At the bottom of this file are the definitions of the different notes (and associated playback channels). Above that is the sequencing to play the song, measure by measure. All music data is included in the assembly pulled from the main 6502 ROM (not the sound card ROM). Again, this approach was used for prototyping, and a more dynamic and efficient storage and playback mechanism is needed. I plan to work on this in the coming weeks.
To help with converting notes to frequencies, I put together an Excel file to convert notes to course and fine PSG values.
Comments