Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Sound driver for Sega Mega Drive

License

NotificationsYou must be signed in to change notification settings

superctr/MDSDRV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A sound driver for Sega Mega Drive/Genesis.

Features

  • 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 usingctrmml
  • 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

Upcoming features

  • System C2 support is currently in the experimentalc2 branch.

How to use

Feel free to join theDiscord serverif you have any questions or feedback.

Composing sound data

mmlgui provides an easy wayto compose music and sound effects using Music Macro Language (MML).

For information on the MML dialect, seehere.

Compiling sound data

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.

Building MDSDRV

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 theMakefileto 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"

Using MDSDRV

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.

File listing

  • 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.

SGDK test project

If the SGDK environment variables are set, callingbuild.bat ormake sgdk-demo should automatically build the SGDK test program.

Interfaces

Sound data reference

Precautions when using DMA

The Z80 code has a protection mechanism against reading ROMduring DMA transfers. Please readdma.md for informationhow to use it.

Copyright

© 2019-2022 Ian Karlsson.

MDSDRV is licensed under the terms of thezlib license.

Other programs included in this repository

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.

Special thanks

  • 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.

[8]ページ先頭

©2009-2025 Movatter.jp