TRACKERS MOONBLASTER EN 08

From MSX MUSIC WIKI
Jump to: navigation, search

8.USE IN OWN PROGRAM

Use in BASIC

In order to use the MoonBIaster music in BASIC, it is essential that the BASIC driver is loaded first. This driver is on the Music disk under the name MBDRV.BIN. It is started with the command BLOAD MBDRV.BIN, R. Because the driver uses the storage area above & HDAOO, the command CLEAR 200C & HD9FF must be given to start up the driver to ensure that the BASIC program does not exceed this limit. If this has happened you have some extra BASIC commands at your disposal. Below an overview

CALL MBKLOAD ("sample kit name")

This command causes a sample kit to be loaded and put into the MSX-AUDIO RAM. Note: this command uses the memory bank with the song as a buffer, so the contents will be erased

CALL MBMLOAD ("song name")

This allows you to load a MoonBIaster song. This song is loaded at the set address in the set memory bank. Note that only USER files will be loaded and played correctly.

CALL MBCHIP (chipnumber)

Sets the desired sound chip where the music should be played on:

0 MSX AUDIO
1 MSX-MUSIC
2 or higher STEREO (MSX-AUDIO and MSX-MUSIC)
CALL MBBANK (bank number)

Sets the memory bank of the memory mapper that contains the song to be played back, or in which a song is to be loaded. Only works if no music is playing. A memory bank of the memory mapper is 16 kB. Usually the value 3 will be taken for bank number. The maximum bank number depends on the amount of memory in your computer.

CALL MBADDR (address)

Sets the memory address where the song is or to which a song is to be loaded. Make sure the entire song is between the addresses & H8000 and & HC000. Only works if no music is playing.

CALL MBPLAY

Plays a song on the set sound chip. The location of the song in the memory is determined with the above commands.

CALL MBSTOP

Stops playing a song.

CALL MBCONT

Continues to play a song after a pause. Only works correctly after an MBHALT command.

CALL MBHALT

Pauses a song. This is useful, for example, when loading. Give a _MBHALT before loading, and when the loading is finished you can continue the music with a _MBCONT.

CALL MBVER

Displays the current version number of the BASIC driver on the screen. In addition, various memory addresses can also be read by the BASIC programmer:

PEEK (& HDA00) = Set sound chip with MBCHIP command.

PEEK (& HDA01) = Status: 0 = does not play, 255 = does play.

PEEK (& HDA02) = Set memory bank with MBBANK command.

PEEK (& HDA03) + 256 * PEEK (& HDA04> = Set memory address with MBADDR command.

To ensure that the commands are working properly, there is a sample program on the Music Disk under the name "BASIC.BAS." In this program, all commands will be used with the exception of the MBVER command.

8.2Use in machine language

There are two source codes for the machine language programmers on the Music disk. These are MBPLAY.SRC and MBLOADER.SRC. The first of the two is the actual play routine and the second is a program to load the MoonBIaster songs and drum kits and to see which sound chips are present in the computer and to initialise them if necessary. The sources are written for the DevPac-80 assembler (GEN80), but can also be easily loaded into other assemblers. Some labels are used in all sources. Here, of course, the same memory address, so when merging these must be removed. Some brief remarks that are of interest to ML programmers:

- The song can remain stored in memory. Decrunching occurs during playback.
- The start address of the song and the memory mapper bank can be set. The play routine itself ensures that the switching of banks is correct.
- If PSG drums are used, only PSG channel A will be used for this. It is clearly indicated where the PSG is controlled so that this can easily be changed.
- The play routine works under both Z80 and R800 modes, but it should not be switched during processor play! The STRMUS routine checks which processor is active at that moment and, if necessary, automatically adjusts the play routine.

Other explanations are stated in the sources themselves.