Moonblaster Wave for Moonsound

After R.Schrijvers more or less quite the MSX scene round 1997 he passed me (Marcel Delorme) the source files of MBWAVE and MBFM, and I decided to continue the development of MBWAVE. All releases starting from version 1.05 where made by M. Delorme. Back in 1997 I was still part of NWO and MBWAVE was always downloadable from the NWO website. However, Ziggo has cancelled their website services so I decided, with the consent of Jorito, to move some of the programs to the Teambomba website.

The final release version is 1.17.

TNI has started developing a new version of Moonblaster. Merging MBFM and MBWAVE as a starting point. Check their website for more information.

Revision history

Version 1.17 (release date 28/12/2005)

Improvements / other modifications

Version 1.16 (release date 29/05/2004)

Improvements / other modifications


Version 1.15 (release date 26/04/2001)

Improvements / other modifications


Version 1.14 (release date 28/01/2001)

Improvements / other modifications

Version 1.13 (release date 24/04/1999)

Improvements / other modifications


Version 1.12 (release date 19/09/1998)

Improvements / other modifications


Version 1.11 (release date 03/08/1998)

Improvements / other modifications


Version 1.1 (release date 29/06/1998)

Improvements / other modifications


Version 1.08 (release date 08/06/1998)

Improvements / other modifications

Version 1.07 (release date 25/04/1998)

Improvements / other modifications

Version 1.06 (release date 12/01/1998)

Improvements / other modifications


Version 1.05 (release date 28/10/1997)

Improvements / other modifications


Releases made by R. Schrijvers

Version 1.04


Version 1.03A (release date 11/12/95)


Version 1.03 (release date 28/11/95)

Improvements / other modifications


Version 1.02 (release date 01/10/95)

Improvements / other modifications


Version 1.01 (release date 27/09/95)


Version 1.00 (release date 23/09/95)

Improvements / other modifications


Version 0.92 (release date 20/07/95)

Improvements / other modifications


I would like to thank the following persons for their USEFUL bug reports and some for routines or ideas:

Moonblaster wavedriver TSR for DOS 2.XX.

System requirements: OPL4, DOS2.XX with atleast 2 free segements.

Supports: MBWAVE 1.14 MWM files. Also files bigger than 16KB can be played. Try to start some games while playing a MWM file and you will see that the music playes on. (Works for example with Be-Bop-Bout)

The driver automatically loads the correct kernel for either the Z80 or the R800 mode.

More info is in the driver itself.

How to use the MBWAVE BASIC driver 1.14

This BASIC driver is spread as a binary file for BASIC programmers and as a source file for ML programmers. The first part of this text will explain how to use this driver for BASIC programmers. The second part is meant for ML programmers.

The driver supports:

For 7MHz Users there is a special version available (WAVDRV7.BIN). This version is much faster because (for 7Mhz that is) the wait for the Turbo R is:

		POP  BC  (This is a total of 21 cycles for the Z80)

In the 7Mhz version this is replaced by:

		NOP (only 4 Cycles)

This means 17 cycles faster by almost each OUT or IN. And there are a lot of those.

Basic calls

To load the driver type BLOAD"WAVEDRVx.BIN",R and then protect the upper memory from BASIC with CLEAR 200,&HDA00. Below is a short overview of all new BASIC commands:

	Displays version number

	It is very important that this call is done first! This will initialise the mapper routines and allocate the first 4 mapper banks.

	_MBADDR(load address)
	This sets the current load/play address.

	These routines set the current load/play mapper bank. In theory a Wave song can be slightly larger than 32KB. Therefore 3 mapper banks may be neccessary. However, in practice songs abover 16K will be very rare and it will suffice to set only _MBBANK1. Note that with songs > 16K MBBANK1 is always used as the first bank to fill and only when the song is too big to fit MBBANK2 and 3 will be used.

	In theory you can use 64K after a MBINIT command (bank 0-3). But unfortunately you cannot use bank 0 (system page), 2 (replayer page) and you can only use bank 1 if you move the BASIC start address to &HC000. So only bank 3 is available most of the time unless you use the MBALLOC command.

	This will load a wavekit with name "filename". It uses MBBANK1 as a
	buffer to move the data to Sample RAM. Do not forget to load a wavekit before playing a song. The replayer may crash if you try to play a song that uses a wavekit when no wavekit was loaded!

	This will load a wave song with name "filename" in the current bank at the current address.

	Starts playing of a song using current address and current bank.

	Stops playing.

	Pauses music.

	Continues music after MBHALT.

	The music will fade out at the given speed.

	_MBALLOC(extra banks)
	If you need more than the first 64K (see MBBANK) use this command. Note that the driver will NOT check if enough free memory is available. The programmer needs to do that himself! You can only use MBALLOC once. If you need more, use MBFREE first and then MBALLOC again. MBALLOC will only allocate *extra* segments. E.g. with MBALLOC(4) you will have 4 + 4 = 8 banks (128K) available.

	This will free all segments that were allocated with MBALLOC. Especially  for DOS2 usage it is VERY important that this is always done before you return to the system. If you forget this the allocated segments will be wasted until the computer is restarted!!

	_Z80, _R800
	Turbo-R users can use these commands to change the current CPU. Great care must be taken however because it is impossible to use the Z80 version of the replayer in R800 speed and vice versa!

The BASIC programmer can read several variables with the PEEK command from the following table:

	&HDA00  0 = not playing, 255 = playing
	&HDA01  1st mapperbank with song data
	&HDA02  2nd mapperbank with song data
	&HDA03  3rd mapperbank with song data
	&HDA04  address of song data
	&HDA06  current position
	&HDA07  current step
	&HDA08  3 status bytes (0 = off)
	&HDA0B  song data that will be played the next interrupt
	&HDA26  Available free segments. This is only valid in DOS2! It can be used to check if enough memory is available for the MBALLOC command. Note that it is not updated after an MBALLOC command.

Do not POKE in this table, this may give unexpected results!

Usaage in assembler

ML programmers will find most of the explanation they need in the BASIC text above and in the source. Some additional notes are given here.

The source uses a lot of conditional assembly. You can select the following:

  1. Assemble it for R800 or Z80
  2. Include the FADE
  3. Include a speed test
  4. Disable RAM headers for extra speed (try to avoid this!)

The replayer is using routines called selbank_FE and curbank_FE to select or to read the current mapper bank from 08000h - 0BFFFh. You may wish to replace these with your own routines.

- Read the comment at the MWM loading routine. It is possible to simplify this routine, but take care doing so!

The MWK loading routine needs several variables in the replayer bank. It may be convenient to place the loader in the same bank as the replayer but do not forget that the FCB cannot be in the page 04000h-07FFFh unless you are in MSX-DOS!!! Some MSX computers can handle this, but most of them cannot!

Note that the R800 version will not crash in Z80 mode on a MSX2 but it is strongly advised to use the Z80 version! Using the R800 version on Z80 will slow the replayer down incredibly and it will crash on a Turbo-R in Z80 mode! In addition the Z80 version will tend to crash systems with a higher clock speed than 3.54Mhz.

The replayer is now on the Hook #FD9A, because it uses the OPL4 interrupt now. (So no difference between 50/60Hz anymore!)

Warning: The replayer doesn't perform a page select (it only performs a slot-select), so if you integrate the replayer in your own program: Take care that the right ram page is selected!!!


Some MoonBlaster Wave screenshots

Editor Editor playing a song Wave selector Wave selector Wave editor Wave editor Tone editor Tone editor Stereo presets Stereo presests


The following wavekits have been made using WAV2MTN. It converts Windows WAV files to MTN. It supports 8 and 16 bits mono WAVs inclusing loop addressing. 16 bit samples can be upto 128KB.

Name Bits Size Firm
Electric Piano 16 76.463 -
Real Drum kit 16 116.503 Misc
Tr707 Drum kit 16 106.613 Roland
Tr808 Drum kit 16 106.649 Roland
Tr909 Drum kit 8 57.167 Roland
Tr909 Drum kit 16 120.831 Roland
Tr909 Drum kit 2 16 105.085 Roland
CompuRhythm CR-8000 16 127.295 Roland
Sound canvas Drum kit 16 101.179 Roland
Dr550 drum kit 16 185.541 Korg
KR55 drum kit 16 109.657 Korg