First post, by polpo
Hi all, I've been experimenting with a hardware/software project to create an ISA card that can emulate a Gravis Ultrasound using a Raspberry Pi 3 (or similar/faster, such as the Pi Zero 2 W and Pi 4). Since I've gotten to a pretty good point and people on Twitter liked it, I thought I'd post here. I'm calling it PiGUS. The project is open source – I used RPiISA (https://github.com/eigenco/RPiISA) as a starting point for the hardware and am using DOSBox's GUS emulation code on the Pi. Code and hardware design are on GitHub: https://github.com/polpo/pigus
Also of note: as is, this is a fairly general-purpose ISA to Raspberry Pi adapter! My first proof of concept with this hardware was AdLib emulation, and code for that is in the GitHub repo.
The hardware is a pretty basic 8-bit ISA card that brings address, data, port IO, IRQ, and DMA signals to the Pi's GPIO connector. I am using TI TXS0108E auto direction sensing level shifters for the bus interface to translate between 3.3V and 5V and that seems to be working well. Real translating bus transceivers would be ideal, but I am basically out of GPIOs in the current design for an input/output direction signal. The lack of GPIOs is also the reason for only using an 8-bit ISA card – there aren't enough GPIOs for the lines necessary for 16-bit DMA, etc.
Here's the board. I originally designed it so the Pi could plug right into it but got the orientation of the connector wrong. With this design the Pi is connected via a ribbon cable. Inspired by the GUS, there is a pin header with all ISA lines present, which helps with connecting a logic analyzer or adding any bodges (which I've been lucky to not need so far).
And here it is plugged into an ISA slot on a Pentium 133MMX board. The wires connected to the ISA pin header are going to my logic analyzer.
The software on the Raspberry Pi is running bare metal, using the Circle bare-metal environment (Circle is also used by MT-32pi, Pi1541, and other projects). Different cores on the Pi are responsible for IO handling and GUS emulation and sound output. Port IO reads/writes are handled by the IO routines and passed over to the GUS emulator. I am using the GUS emulation code from DOSBox, but I have also looked at PCem and MAME's GUS emulation. Currently all bus handling is done with polling in its own thread – IRQs on the Pi are not fast enough to meet ISA bus timing. There is fast IRQ (FIQ) on the Pi that is fast enough, but it can only be used on one GPIO pin.
Let's see and hear this thing running!!
Check out this Twitter thread with videos of various module files being played through the PiGUS, highlighting current strengths and deficiencies: https://twitter.com/ianpolpo/status/1535715886190866432
- Port IO implemented. This limits what programs can actually play audio. I've been using CapaMOD as it can be forced to use system timers instead of the GUS's and also be forced to use port IO for sample uploading.
- Sound output over the Pi's analog headphone jack using PWM
- Resampling for channel counts >14 voices
Still to be implemented:
- Better resampling
- IRQs (timers, etc.)
- DMA (sample upload)
- I2S sound output (this will bring higher quality audio and also enable sound output on Pis without analog sound like the Zero 2 W and CM4)
I'm envisioning a final version of the board with the following features:
- Red PCB (this is a must!!)
- Direct attachment GPIO header for Pi 3, Pi Zero 2 W, Pi 4
- Low-profile connectors for Pi CM4
- I2S pins routed and placed for the commonly available generic PCM5102-based module (https://github.com/dwhinham/mt32-pi/wiki/GY-P … 5102-DAC-module)
- Address decoding in hardware, perhaps using a PAL. This will free up a lot of GPIO pins!
- Proper directional bus transceivers for better bus signal integrity
- General purpose FIQ pin with OR of all bus signals we need to react quickly to (IOR, IOW, TC) in case polling is problematic
My time to work on this is relatively limited given that I have a family and a full-time day job as a software engineer, but I've made pretty steady progress on things so far. If anyone is wanting to help out and contribute to this project, I'd greatly appreciate it. It's my intention that this is an open project!