Alternative Version

March 1, 2021


School Project

I looked at my old backups and I found this old music tracker that I did for my computer science school project in 2000.

The tracker was not my main project. I wanted to do a 3d game in pure assembly and the first step I did was to create this tracker as a tool. I used this one to do the music for my game and I cherry-picked the music player part and integrated it inside the game.

The video above is the in-game music done with this tracker called "FM-Trackers". It should be "FM-Tracker" and I called the game: "Kubic Quest".

Most of my classmates did their project in Visual Basic and Microsoft Access for the database. I’m not a big fan of Visual Basic. I like more C++ / C / Asm and my target was to work for a game company. It will happen 5 years after when a game company opened a studio in Québec city (May 2005).
The useless fact is I still remember my computer name: "que-wks-aa001".

I might add more information about the game ("Kubic Quest") or random facts later but this blog post will target and talk more about this tracker.

What is a Tracker?

"A music tracker (short version tracker) is a type of music sequencer software for creating music. The music is represented as discrete musical notes positioned in several channels at discrete chronological positions on a vertical timeline. A music tracker's user interface is usually number based. Notes, parameter changes, effects and other commands are entered with the keyboard into a grid of fixed time slots as codes consisting of letters, numbers and hexadecimal digits. Separate patterns have independent timelines; a complete song consists of a master list of repeated patterns."

It was really popular in 1980, 1990, 2000 and mostly used for games and demoscene.

Trackers are split in 2 categories:
- Frequency Modulation synthesis also called FM synthesis will produce a waveform based on multiple parameters like attack, decay, sustain, release and other variables. It uses less memory (a couple of bytes) and it produces a decent but limited sound. This is how FM-Tracker works. 4 examples will be provided in the next part followed by the FM-Tracker part.
- The second option is waveform mode where the tracker uses a sample as an instrument (e.g. small digital sound file). Scream Tracker 3, FastTracker 2, Impulse Tracker, Renoise and other trackers work like that. It uses more memory/space but produces high quality and unlimited sounds.
Examples below:


Below, it's 4 DOS games that use FM synthesis as music.


Here is the main interface of FM-Tracker. It’s pretty similar to other trackers.

 - 255 patterns. A pattern contains 16 tracks
 - Up to 16 tracks (8 left, 8 right)
 - Each track contains 64 lines
 - Each track line could contain any note, instrument or volume
 - 256 instruments

The main part is the pattern editor and it’s controlled with the keyboard (e.g. arrow, tab)
Each track is compacted with this info:
 - "##" is the line number
 - "Not" is for note
 - "In" for instrument
 - "Vl" for volume (0..FF)
Depending of the current octave that you selected, if you press Z on your keyboard, it will emit a "do" (e.g. C-3), X is "re", C is "mi", V is "fa", B is "sol", N is "la", M is "si"...

The top-right part (green) is to set up patterns. A same pattern number could be used multiple times to avoid copy.
 - 00, 01, 02
 - 00, 00, 02, 01
 - 00, 01, 00, 02
FF pattern number means it’s the end of the song and it will restart at the beginning. This sequence of numbers: "00, 01, FF" will play pattern 00 followed by pattern 01 and it will restart and play pattern 00...

At the bottom-left is the instrument section. 76 instruments pre-generated by default.

Remain area is for global controllers: play, stop, switch instruments/octaves, load, save, quit…

If you press F7, it will switch to the instrument editor. Up to 28 Parameters can be customized for each instrument.

Sega Genesis

"Sound Blaster 16" was a popular sound card especially at the DOS time. This sound card includes Yamaha YMF262 (a.k.a OPL3) sound chip to create the FM synthesis.

The Sega Genesis console contains a similar sound chip: Yamaha YM2612.

[Source]  [Source]

FM-Tracker uses OPL3 FM synthesis.

Does it sound similar?

Under the hood

Above is the song I used for my game Kubic Quest as a winning and intro song.

Before this post, I tried to run FM-Tracker on DosBox and it didn’t work. It seems that DosBox doesn’t support the unreal/flat mode which is the memory model that FM-Tracker uses.

The trick to enable the unreal/flat mode was to switch from real mode to protected mode and come back to real mode which will enable this special mode (unreal/flat). It was useful to avoid managing memory XMS/EMS with paging/segment and other issues like that.

More info about this mode: [Source]
"On the other hand, when unreal mode can be used, it is very useful. HIMEM.SYS uses unreal mode to speed up extended memory access, and perhaps more importantly, preserve normal interrupt latency. Firmware can and does use unreal mode for accessing memory beyond 1 MB during initialization; it avoids switching between real and protected mode, and in firmware there is no danger of segment limits being reset.
Basic unreal mode (data segments with up to 4G limits, as well as data segments with non-standard base) has become a standard part of the x86 architecture."

The next try was to download a virtual machine application called VirtualBox with an image of DOS 6.22. It works. I can run FM-Tracker but with no sounds. I installed sbbasic.exe and ctcmbbs.exe which are tools for Sound Blaster Card with drivers. I configured autoexec.bat and config.sys. No luck!

I still have Turbo Assembler (TASM) so I went back to DosBox, updated the FM-Tracker code source by disabling the flat mode, compile and it works :D

All features work. I can load, compose and save music. I uploaded all code/data/info need on GitHub: GitHub

The repository contains the source code which is about 5000 lines of code in assembly language. 2 executable versions, one for DosBox and one for real hardware. I also included 3 test songs and some guidance about how to compile the code.

Thanks for reading,