a micro Z80 macro assembler

256 hits
eXTReMe Tracker


UZ80 is a freeware Z80 assembler that aims to be both small and fast while still providing valuable services such as macro instructions and conditional assembly. Internally, it departs from full two-pass methods and relies instead on assembling as much code as possible during the first pass and writing down the lines making references to still unseen symbols; these lines will be assembled when all symbols are known.

How to use

UZ80 relies on the standard C library, it doesn't need other libraries to run. Its command line syntax is as follows:

The assembly syntax itself is as follows: Indenting is important: labels must begin on the first character of each line and instructions start later in the line even when there are no labels. Instructions are either those belonging to the Z80, or the following pseudo instructions: Expressions are similar to those used in C and in other assemblers: integers (either decimal, hexadecimal formatted as $1234, #1234, 1234h or 0x1234, or binary formatted as %01010101 or 01010101b) and symbol values (case-insensitive; "$" stands for the current address) can endure addition ('+'), substraction ('-'), multiplication ('*'), division ('/'), modulo ('%'), logical NOT ('!'), bitwise NOT ('~'), bitwise AND ('&'), bitwise OR ('|'), bitwise XOR ('^'), left shift ('<<'), right shift ('>>') and several types of comparison ('<', '<=', '='/'==', '<>'/'!=', '>=', '>'); by default, these operations follow basic precedence rules such as additions and substractions happening after multiplications and divisions, but before comparisons, unless parentheses are used to prioritise some operations over others. Notice that "equ" and "macro" must include labels and thus need to begin on the first character of the line. An example of a macro with parameters is as follows:
Using it with "memcpy buffer,string,10" generates the following code:
Originally undocumented instructions such as SLL (Shift Left Logical) and OUT (C),0 and parameters such as the high and low halves of IX and IY (XH, XL, YH and YL respectively) are supported, as well as synonyms:
The pseudoinstructions "if" and "include" can be recursively nested; however, too much nesting will cause a fatal error. Exit codes are either 0 (success) or 1 (fatal error); errors will show a short message stating the type of error and its location in the source.

History log

20180321-2040: first public release. Succesfully compiles FROGALOT, HIREHARE, BASKETCS and the CHIPNSFX player demo.

20180322-1930: second public release. Added instructions OUTD and OUTI (synonyms of OTD and OTI) and fixed inconsistencies when using a macro with fewer parameters than defined.

Download the current release (5 hits)
Download the 20180321-2040 release (11 hits)
Send a comment
Return to index