Skip to content

Including this in your game boy ASM project

Daniel Chu edited this page Mar 16, 2022 · 7 revisions

Including this in your game boy ASM project

Start by ensuring you have downloaded the latest release. To add this player to your RGBDS game boy assembly ROM you will need to use the -bin option in the converter (DeflemaskGBVGMConverter.exe).

You will need to include the exported music data like this:

SECTION "SoundData0",ROMX,BANK[1]
incbin "ExampleData/gyrus/gyrus0.bin"
....
....
SECTION "SoundData9",ROMX,BANK[3]
incbin "ExampleData/gyrus/gyrus2.bin"

To initialize the song call DMEngineInit. You need to make this call every time you start a new song.

To start your song, load the value 1 into [SoundStatus], then at the rate of your module call DMEngineUpdate.

Start song example:

startSong:
    call DMEngineInit; need to initialize every time you call start song
    ld a, 1; 1 = song is playing
    ld [SoundStatus],a

To stop the song, call stopMusic

looping

If your song uses looping you will need to update soundEngineSongParams.asm to reflect this. Currently, for the '-b' export option there is no automated calculation for these values. I will add an option to automate these in the future. If your song loops to the beginning you can leave the default loop values alone and it will work.

Hacky temporary solution

You can get the calculated values for soundEngineSongParams.asm by generating a rom from the converter. You can also get custom timer interrupt values from here. You can then copy the values from the following addresses:

label name address in ROM (for 0.6)
tmaMod 0x3FFA
tmaTac 0x3FFB
loopAddress 0x3FFC
loopBank 0x3FFE

I will automate the looping values here in the future update.

Changing the start bank for song data

Since the player is .vgm based your music will likely take more than one ROM bank. The default settings assume that your song data starts in bank 1. If you want to use a custom starting bank for your song data, you will need to change DMVGM_START_BANK in soundEngineConstants.asm