About Disark

Disark is a Z80 disassembler by Julien Névo a.k.a. Targhan/Arkos. But it is more than that: it can be used to convert sources from an assembler to another. Read on…

Main features

  • Cross-platform (Windows, Linux and MacOsx).
  • Can read symbol files, and use them to produce a comprehensible code.
  • All-assembler friendly:
    • Undocumented instructions can be replaced by DBs.
    • The generated source is customizable (hex symbol, etc.).
  • Manages regions (code, byte, word, pointers) from labels.

Why another disassembler?

A few disassemblers exist. Disark is meant to replace most of them, but was mainly created to fill a need none of these disassemblers fulfilled:

Disark can create “universal” Z80 source from a binary, allowing you to convert any of your Z80 source into a source that can be understood by a target assembler.

Source converter??

Yes, that’s the selling point. If you provide a symbol file, you can recreate a simple source for any assembler. Example: this is the original source file, with a lot of macros and complicated stuff:

        org #1000
        MyConstant = 1
        REPEAT 5,counter         ;Ooh, many assemblers don't understand that!
MyLabel{counter}                 ;Wow, generated labels on the fly!
                ld hl,MyLabel{counter}           ;... and a reference to them!
        REND
        
        IFDEF MyConstant
                counter = 0             ;Ouch, variable declaration.
                while counter < 3        ;Arg, a lot of assemblers don't know this.
                        add hl,bc
                        
                        counter = counter + 1
                wend
        ENDIF
        
        ret

And lo and behold, this is the source regenerated by Disark from the assembled source + symbol file:

    org #1000
MYLABEL1 ld hl,MYLABEL1   ;No more complicated macros!!
MYLABEL2 ld hl,MYLABEL2
MYLABEL3 ld hl,MYLABEL3
MYLABEL4 ld hl,MYLABEL4
MYLABEL5 ld hl,MYLABEL5
     add hl,bc
     add hl,bc
     add hl,bc
     ret 

Isn’t that magic? And now, you can use this source in any assembler (an output profile can be set to fit any assembler!).

An abstract example:

  • You use specific features of an “A” assembler.
  • You publish your sources, but no one wants to switch to your “A” assembler! They may try to adapt your sources to their “B” assembler, but they may end up giving up! It may be a lot of work.
  • The solution is here: Disark allows you to rebuild a simple source for any “B”/”C” or whatever assembler to understand.

An example from real life:

Disark is a side-project to the music software Arkos Tracker, used to compose music and sound effects for retro computers such as Amstrad CPC, Atari ST, ZX Spectrum, MSX, Vectrex and Sharp MZ-700.

  • The Z80 players I created are meant to be used by as many people as possible. I use Rasm as an assembler. It has some very powerful features, such as macros and real math operations.
  • On CPC, most people work with Winape or Orgams. On other machines, they use SDCC, VAsm, SJasmPlus… These assemblers don’t understand the Rasm macros.
  • Using Disark, they can convert the player and music binary, “flat” code, into a source their assembler understand.

How does it work?

Disark’s power relies on label semantics: labels inside the Z80 source can indicate Disark various things:

  • The start/end of a region of code, byte, word, pointers.
  • Force the use of a reference, or non-reference in one or several of instructions.

You only add labels in your code once, and people can convert your code at will into a flat source their assembler will understand.

Is Disark open-source?

Not yet. But it will be one day!

Suggestions? Remarks? Bug report?

Please don’t hesitate to contact me: disark at julien-nevo dot com. Feedback is greatly wanted!