There's so many of them and they're so rare and it would be impossible to drive and like, you'd have Bitchin' Fast 3D but VGM style.
This is my attempt to support as many sound chips as I can get my hands on while learning about VGM files and the RP2040. My goal is to make an extremely modular player that gives you the freedom to cobble something together quick and dirty with whatever parts your heart desires, aside from the microcontroller of course.
Please be aware that this currently is a proof of concept! It lacks a lot of essential functionality at the moment! I am incredibly inexperienced with the RP2040 platform as a whole and it certainly shows here. I think I at least tried to somewhat explain my thought process through comments. Pull requests and issues are welcomed and encouraged! If you can clean up this mess or have ideas on what I should change, do not hesitate to share them!
As of right now, it only supports playing uncompressed VGM files that are on the root of the SD card and named song.vgm
.
Scroll down to see GPIO mappings!
Various circuits and code snippets are adapted from:
- (OPL3 subsystem) Throwback Operator by @AidanHockey5
- (SAA1099 subsystem) Snark Barker and Sound Blaster 1.0 by @schlae and Creative Labs
- (YM2151 subsystem and VGP file code) Arcade Classic 2 by @AidanHockey5
- Yamaha YMF262 (OPL3) - single
- Philips SAA1099 - dual, experimental!
- Yamaha YM2151 (OPM) - single, experimental!
- Make a complete schematic
- Get something that resembles a user interface
- Code better error handling that doesn't involve giving up once an error has been encountered
- Change the clock speed of the relevant chips based on what's set in the file header
- Refuse to play files that call for unsupported chips
- VGP file support ported from the Arcade Classic 2 to deal with digital sample chips paired with the YM2151
- (done)
Switch to C++ and move stuff into classes to make code more readable and clean - (Future) VGZ support
- (Future) RetroWave OPL3 support
- (Future) Allow users to pick and choose which chips they have without needing to recompile the firmware
- (Future) YM2612 support
- (Future) Dual SN76489 support
- (Future) OPLL playback by translating OPLL data to OPL3 data (or through a real OPLL if translation is not possible)
- (Future) Pico W support with some way to remotely control playback and manage files on the SD card
- (Future) An actual PCB that integrates the RP2040 directly onto it for skilled solderers who want to save space and have a better voltage regulator
- VGM File Format Specification
- Throwback Operator Source Code
- Throwback Operator Schematic
- Tube Time - Sound Blaster 1.0 Principles of Operation
- Snark Barker Github
- Snark Barker Schematic
- Arcade Classic 2 Github
- Arcade Classic 2 Schematic
The VGM tick clock needs GPIO0 and GPIO1 connected. This is a temporary hack because I don't know what I'm doing. The RP2040 has bizarre timers.
Pin | Description |
---|---|
GPIO0 | VGM tick input. Connect to 44.1 KHz clock or else songs won't play! |
GPIO1 | 44.1 KHz clock generator output (connected to GPIO0) |
GPIO2 | SPI SCK |
GPIO3 | SPI MOSI |
GPIO4 | SPI MISO |
GPIO5 | SD card chip select |
GPIO6 | SAA1099 clock |
GPIO7 | SAA1099 A0 |
GPIO8 | SAA1099 WR |
GPIO9 | SAA1099 #2 chip select |
GPIO10 | SAA1099 #1 chip select |
GPIO11 | OPL3 WR |
GPIO12 | OPL3 A0 |
GPIO13 | OPL3 A1 |
GPIO14 | OPL3 chip select |
GPIO15 | OPL3 IC (reset pin) |
GPIO16 | Data bus bit 0 |
GPIO17 | Data bus bit 1 |
GPIO18 | Data bus bit 2 |
GPIO19 | Data bus bit 3 |
GPIO20 | Data bus bit 4 |
GPIO22 | Data bus bit 5 |
GPIO26 | Data bus bit 6 |
GPIO27 | Data bus bit 7 |