- Notifications
You must be signed in to change notification settings - Fork4
Sound driver for Sega Mega Drive
License
superctr/MDSDRV
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A sound driver for Sega Mega Drive/Genesis.
- Runs on the 68000 with the Z80 controlling PCM playback.
- 16 monophonic tracks that can be used for BGM or sound effects.Each track can be assigned to a channel with 4 levels of priority.
- Can use any combination of FM, PSG and PCM sound sources.
- FM3 special mode:
- Can assign each or a pair of FM3 operators to one or moreseparate tracks with volume control.
- PCM playback modes:
- 2 channel PCM playback at ~17.5 kHz with volume control
- 3 channel PCM playback at ~13.3 kHz with volume control
- Samples can play at 8 different sampling rates independent ofthe mixing rate
- Compact sequence format
- Sound data can be compiled from MML files using
ctrmml
- Sound data can be compiled from MML files using
- Various effects supported:
- PSG volume envelopes
- Pitch envelopes
- Portamento
- Fade in/out
- Song volume and tempo control
- Macro tables
- Allows for channel parameters and registers to be modifiedautomatically as a note is playing.
- Equal temperament scale with 256 steps per semitone, allowing foreasy detune or pitch slide effects.
- Unencumbered source code
- Fully position-independent code - supports any assembler or toolchainby including the binary blob.
- Uses approximately 1 kb (1024 bytes) of RAM.
- Integration with SGDK
- System C2 support is currently in the experimental
c2
branch.
Feel free to join theDiscord serverif you have any questions or feedback.
mmlgui provides an easy wayto compose music and sound effects using Music Macro Language (MML).
For information on the MML dialect, seehere.
Themdslink
tool ofctrmmlis capable of building the sound data files (mdsseq.bin
andmdspcm.bin
).
# creates 'mdsseq.bin' and 'mdspcm.bin'mdslink -o mdsseq.bin mdspcm.bin mymusic.mml ...
Sound data files can be in MML (Music Macro Language) or MDS formats.For information on the MDS binary format, seemdsseq.md.
All required tools for building are already in the repository, you justneed to runbuild.bat
. These are Windows executables, so for otheroperating systems,wine
is required.
# creates `main.bin` (test ROM) and `mdsdrv.bin` (sound driver blob)wine /c build.bat
Alternatively, if you use a Unix-like system andsjasmplus
,salvador
,andmdslink
are installed to yourPATH
, you can use theMakefile
to build MDSDRV. Note that you still needwine
to runasm68k.exe
.
# creates `mdsdrv.bin` (sound driver blob)make mdsdrv# creates `main.bin` (test ROM)make demo
To quickly generate a ROM (in Windows) with a single song, you can dragand drop a .MDS or .MML file into "quickrom.bat"
Once compiled, using MDSDRV should be as easy as including the binaryfiles (mdsdrv.bin
,mdsseq.bin
,mdspcm.bin
) in your project, andcalling the correct addresses inside themdsdrv.bin
blob.
main.bin
is the sound test ROM. It is built frommain.68k
.out/mdsdrv.bin
is the sound driver binary. It is built fromblob.68k
.out/mdsseq.bin
is the compiled sequence data. It is built frommusic and sound effect files usingmdslink
.out/mdspcm.bin
contains PCM sample data. It is also built usingmdslink
.
- Seesample/sgdk.
If the SGDK environment variables are set, callingbuild.bat
ormake sgdk-demo
should automatically build the SGDK test program.
- Seeapi.md
- Seemdsseq.md
- Seedma.md
The Z80 code has a protection mechanism against reading ROMduring DMA transfers. Please readdma.md for informationhow to use it.
© 2019-2022 Ian Karlsson.
MDSDRV is licensed under the terms of thezlib license.
mdslink
is part ofctrmml andis licensed under the terms of the GPLv2. But all code is written by meand I give myself permission to use it here :).
asm68k
is owned by SN Systems and is non-free. However it was lastreleased 25 years ago. I hope to move away from using it soon. The codedoes however currently still use a lot of specific directives, and Iprefer its listing outputs for debugging... Please bear with me as Itry to find a good replacement.
sjasmplus
is licensed under the zlib license. The version included inthis repository has been downloaded from theGithub repository.
salvador
is released under the zlib license. The version included inthis repository has been compiled from the source code in theGithub repository.
- Sik: for making suggestions and giving inspiration for the Z80 driver.
- Yuzo Koshiro: For creating the MUCOM88 driver which was aninspiration to this project.
- All beta testers.
About
Sound driver for Sega Mega Drive