UM80(1)

NAME
um80 - Microsoft MACRO-80 compatible assembler for 8080/Z80

SYNOPSIS
um80 [-v] [-o output.rel] [-l listing.prn] [-g] [-D SYMBOL[=VALUE]]... [-I PATH]... input.mac

DESCRIPTION
um80 is a Microsoft MACRO-80 compatible assembler that translates 8080/Z80 assembly source files (.MAC) into relocatable object files (.REL). The output is compatible with the ul80(1) linker.

The assembler supports both Intel 8080 and Zilog Z80 instruction sets, macros, conditional assembly, and the full set of MACRO-80 directives.

OPTIONS

-v, --version
    Display version information and exit.

-o output.rel
    Specify the output file name. Default is the input file name with a .rel extension.

-l listing.prn
    Generate an assembly listing file showing source, generated code, and symbol table.

-g, --globals
    Export all defined symbols as PUBLIC. This is useful for generating complete symbol files for debugging. The linker can then output all symbols with their final relocated addresses using the -S option.

-D SYMBOL[=VALUE]
    Define a symbol before assembly begins. If no value is given, the symbol is defined with value 1. Can be specified multiple times.

-I PATH
    Add a directory to the include file search path. Can be specified multiple times.

SOURCE FORMAT
Assembly source files consist of lines containing:

•   Labels (optional) followed by a colon

•   Instructions or directives

•   Comments starting with semicolon (;)

Example:

            ORG     0100H
    START:  MVI     A,0         ; Initialize A
            LXI     H,BUFFER    ; Point to buffer
            CALL    INIT
            JMP     START
    BUFFER: DS      100
            END     START

DIRECTIVES

  Assembly Control

ORG address
    Set the location counter to address.

END [address]
    End of source. Optional address specifies the entry point.

  Data Definition

DB value[,value]...
    Define bytes. Values can be numbers or quoted strings.

DW value[,value]...
    Define 16-bit words (low byte first).

DS count
    Define storage (reserve count bytes).

  Symbol Definition

EQU value
    Define a constant symbol (cannot be redefined).

SET value
    Define a variable symbol (can be redefined with SET or DEFL).

DEFL value
    Same as SET.

  Segments

CSEG
    Select code segment (program-relative).

DSEG
    Select data segment (data-relative).

ASEG
    Select absolute segment.

COMMON /name/
    Select or define a COMMON block.

  External Linkage

PUBLIC symbol[,symbol]...
    Make symbols available to other modules.

EXTRN symbol[,symbol]...
    Declare symbols defined in other modules.

  Macros

name MACRO [param[,param]...]
    Begin macro definition.

ENDM
    End macro definition.

LOCAL symbol[,symbol]...
    Declare local symbols within a macro.

EXITM
    Exit macro expansion early.

  Repeat Blocks

REPT count
    Repeat block count times.

IRP param,<value[,value]...>
    Repeat block for each value.

IRPC param,string
    Repeat block for each character in string.

  Conditional Assembly

IF expression
    Assemble following code if expression is non-zero.

ELSE
    Assemble following code if IF was false.

ENDIF
    End conditional block.

IFDEF symbol
    Assemble if symbol is defined.

IFNDEF symbol
    Assemble if symbol is not defined.

  Listing Control

TITLE text
    Set listing title.

PAGE
    Start new listing page.

.LIST
    Enable listing output.

.XLIST
    Disable listing output.

  Processor Mode

.Z80
    Enable Z80 instruction set.

.8080
    Restrict to 8080 instruction set (default).

  Include Files

INCLUDE filename
    Include another source file.

EXPRESSIONS
Expressions can include:

•   Decimal numbers (default)

•   Hexadecimal numbers (suffix H or prefix 0x)

•   Octal numbers (suffix O or Q)

•   Binary numbers (suffix B)

•   ASCII characters in quotes ('A')

•   Symbols

•   Current location counter ($)

Operators: + - * / MOD AND OR XOR NOT SHL SHR HIGH LOW

EXAMPLES

Assemble with default output:
    um80 program.mac

Specify output file:
    um80 -o code.rel program.mac

Generate listing:
    um80 -l program.prn program.mac

Define symbol:
    um80 -D DEBUG=1 program.mac

Add include path:
    um80 -I /usr/share/include program.mac

Export all symbols for debugging:
    um80 -g program.mac

EXIT STATUS

0   Successful assembly (may include warnings).

1   Assembly failed due to errors.

FILES

input.mac
    Assembly source file.

output.rel
    Relocatable object file.

output.prn
    Assembly listing (if requested).

SEE ALSO
ul80(1), ulib80(1), ucref80(1), ud80(1)

The original Microsoft MACRO-80 manual is available at docs/external/m80.pdf

COMPATIBILITY
um80 is compatible with Microsoft MACRO-80 (M80) with the following notes:

•   Source files can use Unix (LF) or DOS (CR/LF) line endings.

•   Symbol names are converted to uppercase.

•   The .REL file format is binary-compatible with the original.

AUTHOR
um80 project contributors.