This is a modified version of BlastEm that streams real-time audio register writes to Genesis Engine hardware for authentic audio playback through real YM2612 and SN76489 chips.
BlastEm emulates the Genesis/Mega Drive with cycle-accurate timing. When the emulated CPU writes to the YM2612 (FM synthesizer) or SN76489 (PSG), we intercept those writes and stream them over serial using VGM-style timing commands to a microcontroller connected to real audio chips.
BlastEm (emulation) Serial (1Mbaud) Genesis Engine Board
┌─────────────────┐ ┌──────────────────┐
│ YM2612 write │ ──── [wait] 0x52 reg val ───────>│ Real YM2612 chip │
│ PSG write │ ──── [wait] 0x50 val ───────────>│ Real SN76489 PSG │
└─────────────────┘ └──────────────────┘
│
└── VGM-style wait commands encode timing at 44.1kHz sample resolution
- GCC or compatible C compiler
- SDL2 development libraries
- GLEW development libraries (unless building with
NO_GL=1)
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-glewsudo apt install build-essential libsdl2-dev libglew-devbrew install sdl2 glewcd blastem
# Standard build
make
# Windows cross-compile (from Linux)
make OS=Windows
# Without OpenGL (simpler build)
make NO_GL=1Pre-built binaries are available from the Releases page.
All required DLLs (SDL2.dll, glew32.dll) are included. Just extract and run.
Install runtime libraries:
sudo apt install libsdl2-2.0-0 libglew2.2Install runtime libraries:
brew install sdl2 glew-
Upload the
EmulatorBridgesketch to your Genesis Engine board:- Located at:
GenesisEngine/examples/EmulatorBridge/EmulatorBridge.ino - Requires the GenesisBoard library
- Located at:
-
Connect the board via USB
Hardware audio is automatically detected on startup:
- Connect your Genesis Engine board via USB
- Start BlastEm:
./blastem game.bin - If detected, you'll see: "Genesis Engine audio board found, using hardware audio"
- If not detected: "Genesis Engine audio board not found. Check connection and restart BlastEm"
When hardware audio is connected, software audio is automatically disabled - all audio comes from the real chips.
The bridge uses VGM-compatible command bytes with timing:
| Command | Format | Description |
|---|---|---|
0x50 |
0x50 <value> |
Write to PSG |
0x52 |
0x52 <reg> <value> |
Write to YM2612 Port 0 |
0x53 |
0x53 <reg> <value> |
Write to YM2612 Port 1 |
| Command | Format | Description |
|---|---|---|
0x61 |
0x61 <lo> <hi> |
Wait N samples (16-bit little-endian, 44.1kHz) |
0x62 |
0x62 |
Wait 735 samples (1/60 sec) |
0x63 |
0x63 |
Wait 882 samples (1/50 sec) |
0x70-0x7F |
single byte | Wait 1-16 samples (0x70=1, 0x7F=16) |
| Command | Format | Description |
|---|---|---|
0xAA |
0xAA |
PING (connection test) |
0x66 |
0x66 |
End stream / reset hardware |
The board responds to PING with: 0x0F <board_type> 0x06 (ACK + type + READY)
From the original BlastEm source:
serial_bridge.c/serial_bridge.h- NEW: Serial communication and VGM-style timingym2612.c- Addedserial_bridge_ym2612_write()callspsg.c- Addedserial_bridge_psg_write()callgenesis.c- Added cycle adjustment sync, silence on pause/menublastem.c- Added auto-connect on startuprender_sdl.c- Added disconnect on application closerender_audio.c- Mute software audio when hardware connectedMakefile- Addedserial_bridge.oto AUDIOOBJS
- Check USB cable and board power
- Verify the EmulatorBridge sketch is uploaded
- On Linux, add user to
dialoutgroup:sudo usermod -a -G dialout $USER - Check available ports:
ls /dev/ttyUSB* /dev/ttyACM*(Linux) or Device Manager (Windows)
- Ensure BlastEm is running at normal speed (not turbo/fast-forward)
- Try a different USB port (avoid USB hubs)
- Check for other programs using the serial port
- Notes are automatically silenced when entering menus or pausing
- Closing the application sends a reset command to silence hardware
BlastEm is licensed under the GNU GPL v3. This modification is provided under the same license.
- BlastEm by Mike Pavone
- Genesis Engine hardware and library by the FM-90s project