Z80 directives

What directives are

Directives are not executed by the CPU: they tell the assembler where to put the code, what data to emit, which names stand for which values, and when to expand a macro. Most of them have several accepted spellings, so sources written for other Z80 assemblers usually assemble unchanged.

.title

Set the title of the program, as a string.

error

Force an error.

defb

db, .db, .byte, defm, dm, .dm, .text, .ascii, .asciz

Define a sequence of bytes, text, or strings.

defw

dw, .dw, .word

Define a sequence of 16-bit words.

.long

Define a sequence of 32-bit longs.

equ

.equ, defl, =

Assign a value to a symbol.

org

.org, .loc

Specify address of next instruction.

align

.align

Add fill bytes until address is multiple of specified value.

defs

ds, .ds, .block, .blkb, data, dc

Fill memory with repeated bytes.

macro

.macro

Start a macro definition.

endm

.endm

End a macro definition.

if

cond

If conditional.

else

Else conditional.

endif

endc

End of if conditional.

end

End of file, optionally followed by entry address or label.

#target

Specify whether targeting bin or rom.

#code

Start a new code segment.

#include

Include an assembly file or library directory.

#local

Start a local scope.

#endlocal

End a local scope.

#insert

Insert a binary file.