Directives

The Astrum assembler supports a range of assembler directives. These let you control various aspects of assembling. Some directives put bytes into the output file others are for controlling various options. They are:

DB, DEFB, DEFM, DM

These all do the same and put data into the output. You can either list byte values individually or as a string. For example:

MSG    DEFM "Hello World",13,0

DW, DEFW

Similar to DB except that the values are 16-bit. For example:

LENS   DEFW $23de, 244*3+8

DEFI, DEFC

This takes a string and when it is inserted into the output the last byte of each string has bit 7 set. This is a useful way of spotting the end of a string without a formal end-of-string byte like a 0. The Spectrum ROM uses this technique quite a bit.

DEFZ, DZ

This takes a string and adds a 0 byte at the end of the string

DEFS, DS

This takes a number and inserts that many bytes into the output. The bytes will all be zero unless there is a second byte value. For example this will insert 32 plus symbols:

   DEFS 32,"+"

IF, IFDEF, IFNDEF, ELSE, ENDIF

View this topic to read about: Conditional assembly

INCLUDE

The include directive allows you to assemble the contents of the given file and then continue. Includes are often used for common definitions and symbols. An include file can also contain other includes. For example:

         include mydefs.asm

INCBIN

INCBIN will copy the contents of the file given directly into the assembled file. For example:

      incbin sprites.bin

LIST

Controls the production of a .lis text file showing the machine code that has been produced. There are a couple of additional options:

UNUSED This will list unused labels after the main listing. This can be very useful for spotting code that is no longer used.
UNUSEDEQU This will list any unused symbols including those defined with the EQU directive.

MACRO

View this topic to read about: Macros

OPTION

The options directive lets you control aspects of assembly. You can specify multiple options in one directive by separating them with a space. The options are:

ERRJPJR If Astrum spots a JP instruction which could be coded as a JR it will display an error message. Every byte counts!
NONEXT This disables Z80N instructions like MUL and PIXELAD. Using them will generate an error
NOSPECT This disables CSpect instructions like BREAK. Using them will generate an error
ASTRUM+ The original Astrum+ allowed many pseudo instructions. These are disabled by default but using this option will turn on the pseudo instructions available in the Microdrive version.
NOHEADERDo not generate a file header when writing a file.

ORG

This sets base address for assembly. If your code is going to run starting at, for example, address 34000 then you should start the source with:

         org 34000

OUTPUT

Sets the filename for the assembled code. Normally the code will go to a file with a .bin file extension. So abc.asm will assemble to abc.bin. However, if you have the following line it will assemble to mycode

         output mycode