Source conversion with Disark

This is available since alpha5.

You don’t use Rasm because you already have an assembler you like, but your assembler does not understand Rasm mnemonics and macros. One possibility is to convert the player and music sources manually… But they have become very complicated since alpha5, as many macros/conditions are used. So are you stuck in including a non-relocatable binary of the player and music?

Well, no! A new command line tool has appeared: Disark. You can check its web-page if you want, or just use it directly now (it is located in the tools folder of the Arkos Tracker 2 package).

Disark is a disassembler, but can be used to convert sources. You can convert any source into your assembler, such as:

  • SDCC / SDASZ80
  • Winape / Maxam
  • Pasmo
  • Vasm
  • Orgams
  • Or use the default profile, which should work for many assemblers.
  • If you want something specific, simply ask!

Once you have chosen your player and the music is ready, you only need to make the conversion once.

This is a 2-step process:

Assemble the sources with Rasm

  • Download the Rasm for Windows, Linux and MacOsX here. The minimum version must be at least 0.113!
  • Create a small source to include the player and the music. For example:
;No need to put a ORG or anything.

;Declare the hardware (check the player source for the flag to declare.
;CPC'ers don't need to add anything, CPC is default).
PLY_AKG_HARDWARE_MSX = 1   ;MSX is used here, for example.

;If sound effects, declares the SFX flag. Once again,
;check the player source to know what flag to declare.
PLY_AKG_MANAGE_SOUND_EFFECTS = 1     ;Remove the line if no SFX!

include "PlayerAkg.asm"        ;This is the AKG player.
include "MySuperSong.asm"      ;This is the music.
include "SoundEffects.asm"     ;SFX, if you have some.

Note (1): if you use the Player Configuration feature, you must include the configuration file(s) before the player.

Note (2): if you use the ROM players, the ROM flag/buffer location must be included too (check the player once again to know the flags).

  • Assemble this source with Rasm like this:
rasm PlayerAndMusic.asm -o PlayerAndMusic -s -sl

PlayerAndMusic.asm is the source above. The “-o PlayerAndMusic” indicates the base filename for the generated files (PlayerAndMusic.bin and PlayerAndMusic.sym (the symbol file)).

The “-s -sl” options are very important, they ask to generate a .sym (symbol file) that Disark can use to recreate a faithful source.

Generate a source for your assembler, from the binary

Let the magic happen. Use Disark (in the tools folder) to convert the binary+symbol file into a new source file your assembler will like!

Disark.exe PlayerAndMusic.bin Final.asm --symbolFile PlayerAndMusic.sym --sourceProfile sdcc

That’s it! A Final.asm source has been generated for SDCC. You can include it directly in your SDCC sources, it compiles and is relocatable!

Of course the “source profile” parameter accept other values:

  • winape, maxam, pasmo, vasm, sdcc, orgams.

You can also omit the sourceProfile, in which case Disark produces a source with no specificity at all, which is fine for many many assemblers.

Notes

  • SDCC external labels are generated for the init/stop/play labels (if you use SDCC profile of course).
  • One thing you should not do is mess with the generated source: for example, if you want to split the music and player into two sources, do not split the “disarked” source file: one part may reference the other (This is only a re-generated source after all). If you want to do that, do it right from the start, using two sources instead of one (one source will have the player, the other the music, and you will Disark them separately).
  • Disark is a generic-purpose disassembler/source converter, so check out its web-page if you want to have your sources to be Disarkable (this is a new word I have just invented).