UZ80 -- a small Z80 macro assembler

1434 hits
eXTReMe Tracker

Foreword

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 formatted as 1234 or 1234d, hexadecimal as #1234, $1234, 1234h or 0x1234, octal as 1234o or binary as %10110111 or 10110111b) and symbols (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 ('<', '<=', '='/'==', '<>'/'!=', '>=', '>'); operation precedence follows common rules such as additions and substractions taking place 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:
The special symbols "\1", "\2", "\3"... stand for the first, second, third... parameters in the macro; the special symbol "\0" stands for the number of parameters. Local labels within a macro can be defined by appending the special symbol "\?" to the label name: "labelname\?".

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.

Version log


[ cpcrulez.fr ]
Download the current release (6 hits)
20181104-1105 (18) 20181025-1445 (21) 20180822-1850 (30) 20180822-1850 (16)
20180808-0946 (23) 20180528-2020 (29) 20180510-1255 (25) 20180506-1230 (27)
20180505-1200 (22) 20180426-1030 (33) 20180417-1920 (23) 20180414-1140 (28)
20180408-1440 (29) 20180326-1155 (28) 20180322-1930 (32) 20180321-2040 (37)
Send a comment
Return to index