While you need to download an assembler to use it, FMX is designed so you only need to change tables to get results out of it. You don't need to do any coding!
You will need:
- The FMX driver
- A copy of the DASM assembler. Any version should do, here's a link to a Windows version from Lasse's page.
- A Sid player so we can get some info. Personally I use VSID that comes with the Vice emulator , but most of them have an info page in there somewhere. Another example is Sidplay/w for Windows.
- Some way to hear the music (obviously), if you don't have a cart for your c64 the Vice emulator has it built-in. (Settings / Cartridge/IO settings/SFX Sound Expander settings and tick the enable box)
OK let's set up the basics:
- Unpack FMX (with it's sub-folders) into a folder on your computer.
- Move into the src sub-folder and unpack DASM into here. We'll be doing our main work in this src folder from now on.
- To test DASM is working, run fmx.bat to build the player. A file called fmx.prg should appear which you can test on your machine, it will play a small test loop on the fm chip as in this screenshot:
Now we want to set up FMX so it's ready to play a single SID tune with an optimal setup.
- Move into the configs sub-folder and then into the one called config-1song_only_fm, select & copy all the files in here.
- Move back into the src folder and paste the files we just copied here. It'll overwrite some existing files but this is normal.
- Now run fmx.bat again and the built fmx.prg file will play a different tune and the screen text should have changed:
Step 3 : Getting info on our chosen song
Now those first two steps are out of the way we don't need to revisit them again in future.
Unless you have some sid tunes already the best place to find them is in the High Voltage SIDS collection. If you're looking for particular tracks there's a search engine for it at the Exotica game music site.
So, we have some songs and now we need to load them into the Sidplayer to find some info on them. What we're looking for is the player's info window. I've put up screenshots below showing the info we need in Sidplay/w and VSID. VSID has it on the main display whereas Sidplay/w shows it when you go to File/Properties.
Sidplay/w's info window with the info we need in red
VSID's main window showing the info we need in red
- The Player Type has to be a 'vblank' type to work with FMX. This is listed variously as VICII, VBI or simply VBLANK.
- The Load Address is where in memory the music is stored. By default FMX has the space between $1000-$6fff or $a100-$cfff free, so make sure it fits between one of those two areas.
- The Init Address is the piece of code called when the song starts to play. This usually sets up the music player and resets it to the beginning.
- The Play Address is called every time the screen refreshes to keep the music playing.
Optionally we can also jot down which sub-song we want to play if there's more than one track in there. As we're only playing single sid songs we want to avoid any with _2SID or _3SID on the end of the filename. (that's for another article, or read the docs to see how it's done)
Step 4 : Playing our song (the last step!)
Yes, now it's time to try playing back the SID file on your FM chip.
- Copy your SID file into the src folder where we've been working, I'm using the track 'Modern Loves Classics Intro' from the screenshots in this example.
- Now we need to open up the file fmx-song.asm to put in the info we've collected. Any text editor will do, even notepad. This may look daunting if you don't code but don't worry, we're only changing some names and numbers around.
Change the org address to the Load address we jotted down earlier, and put -$7e on the end to skip the SID file header. Change the filename after the .incbin label to the name of your sid file. In my case the loading address ($1000) was the same as the demo track but you may have something different. (eg: if your load address is $4000 change it to org $4000-$7e)
Now find the player_patchsid label as in this screenshot, we want to change the first number in this table to the first two digits of the load address. (so if the load address is $4000 change it to $40)
Finally if you want to play a different sub-tune to the default look for the player_song label as in the screenshot below, and change the first value to your new song name. FMX counts songs from zero, most Sidplayer displays start from one so you'll need to subtract one from your value.
Now run fmx.bat and it will hopefully build a new fmx.prg with your song in it. (I've already changed the text in this screenshot so ignore that)
Extra features, changing text etc.
I'll leave the more advanced options (like changing the default instruments) for another article, but one other thing you can do easily is have the song also play on the SID chip at the same time. This can create some interesting effects. To do this look for the player_output label in fmx-song.asm and change the hi value to point at $d4 and the low value to $00 as in this screenshot:
The final thing we can do now is tidy up the display. Firstly you can change the displayed text by finding the label songname and changing the text lines below. (the space between the quotes is how much text can be displayed, it'll automatically crop any remainder)
And we can switch from the default Debug mode to one where we can change the colours of the screen. This involves loading up two other .asm files, firstly fmx-build.asm to change the line DEBUGMODE = 1 to DEBUGMODE = 0 , and then fmx-globals.asm to change the colours as in this screenshot:
So now if we run fmx.bat again the built executable should look a bit nicer: