Skip to content

Repository files navigation

TPZASM

TPZASM (pronounceable as ‘Topaz Assembler’) is a portable cross‑assembler intended to be fully interchangeable (and in most cases bug‑for‑bug compatible) with the TDL ZASM 2.21, PSA PASM 1.02, and PSA PASM 2.00G assemblers, targeting the Intel 8080, Zilog Z80, and other equivalent processors.

An enhanced clone of HEXCOM 3.00, the DRI Intel HEX to binary conversion tool, is also included.

Precompiled binaries for many systems are available for download.


Overview

TPZASM is ~99.8% complete relative to TDL ZASM 2.21 and PSA PASM 1.02.

  • TPZASM is a faithful reimplementation of the original assemblers (including their quirks and bugs) and can assemble many substantial historic codebases (which also serve as test cases), including:

    Codebase Size
    Plu*Perfect High-BIOS for Advent Kaypro Turbo ROM ~900 SLOC
    Zapple 1K Monitor 2.0 ~1,000 SLOC
    TAPELIB ~1,500 SLOC
    Zapple 2K Monitor 2.1R ~1,900 SLOC
    Burke Z80 Disassembler ~2,200 SLOC
    Zapple 2K Monitor 1.11 ~2,500 SLOC
    Alloy Engineering Utilities ~2,800 SLOC
    SARGON ~3,500 SLOC
    DMS/3 & DMS/4 HiNet CP/M BIOS ~10,000 SLOC
    VEDIT‑PLUS ~30,000 SLOC
  • In every case, TPZASM produces identical listings and byte‑for‑byte identical object output when compared to the reference TDL ZASM / PSA PASM assemblers. The only differences are when processing certain deliberately malformed or specially crafted inputs (that cause the reference assemblers to abort or crash).

  • TPZASM can write the assembled output as a raw binary image, or as a TDL Object Module in relocatable (.PREL) or absolute Intel HEX module (.PABS) formats, serialized either as raw binary (using the -R flag, i.e., .PBIN) or as ASCII‑hex text (using the -X flag, i.e., .PHEX), all of which is byte‑for‑byte identical to the object output of the reference software.

The emulation of the PSA PASM 2.00G assembler is still a work‑in‑progress and is approximately 85% complete, with some functionality not yet implemented or not yet fully conforming to the behavior of the original assembler.

HEXCOM is 100% complete and produces byte‑for‑byte identical output to the original reference tool, with matching messages and identical error‑handling semantics, plus user‑configurable control of output padding.

Usage

TPZASM - TDL ZASM / PSA PASM compatible 8080 / Z80 assembler (Linux/x86_64)
Release 0.98 (Built Jul 14 2026) https://github.com/johnsonjh/tpzasm
Copyright (c) 2026 Jeffrey H. Johnson <johnsonjh.dev@gmail.com>

Usage: asm [options] <source[.asm]>

  Options:
    -z, --zasm            Emulate TDL ZASM 2.21 behavior [default]
    -p, --pasm            Emulate PSA PASM 1.02 behavior
    -g, --pasm2           Emulate PSA PASM 2.00G behavior (WIP)
    -o, --out <file>      Write the assembled binary image to <file>
    -P, --pad             Pad output to full CP/M record boundary
    -l, --list <file>     Write the listing to <file> [default: stderr]
    -R, --pbin <file>     Write the object module as binary TDL REL to <file>
    -X, --phex <file>     Write the object module as ASCII-hex REL to <file>
    -L, --long            Allow long (>6 character, non-standard) symbol names
    -r, --read <file>     Answer assembly-time prompts from <file>
    -i, --include <file>  Include <file> before processing <source[.asm]>
    -a, --prefix <expr>   Evaluate <expr> before processing <source[.asm]>
    -e, --expr <expr>     Evaluate only expression <expr> and exit
    -v, --version         Display version information and exit
    -h, --help            Display this help text and exit

The default emulation can be changed by renaming the executable (or creating a symbolic link). Invoke the assembler as zasm to select TDL ZASM 2.21, pasm to select PSA PASM 1.02, and pasm2 to select PSA PASM 2.00G.

Downloads

File Size Platform
TPZASM86.ZIP 200 KiB MS‑DOS (80386 DPMI)
TPZASMST.LZH 320 KiB Atari ST (TOS/MINT)
TPZASMAM.LHA 160 KiB AmigaOS (68000)
TPZASMO2.ZIP 68 KiB OS/2 (32‑bit i386)
TPZASM32.ZIP 76 KiB Windows (32‑bit MSVCRT)
TPZASM64.ZIP 76 KiB Windows (64‑bit UCRT)
tpzasm-linuxarm32.tar.gz 96 KiB Linux (32‑bit ARMv5)
tpzasm-linuxarm64.tar.gz 112 KiB Linux (64‑bit ARMv8)
tpzasm-linux32.tar.gz 64 KiB Linux (32‑bit i386)
tpzasm-linux64.tar.gz 124 KiB Linux (64‑bit x86‑64)

If you need an Atari ST TOS/MINT LHA/LZH utility, LHarc is available.

Building from source

TPZASM needs only an ANSI C89 compiler to build on any UNIX‑like platform (with a few more features available on POSIX‑conforming systems):

  • To build a native binary, just run make (or gmake):

    make
  • You can also explicitly set CC, CFLAGS, LDFLAGS, etc. For example, to build an optimized 64‑bit binary on IBM AIX using the IBM XL C/C++ compiler and AIX make:

    make CC=xlc CFLAGS="-O3 -q64" LDFLAGS="-Wl,-b64"
  • To build a native binary on Windows using the Microsoft Visual Studio C/C++ compiler, from a Developer Command Prompt for Visual Studio window, run:

    msvcbuild.bat

Portability

TPZASM should compile cleanly on almost any system with an ANSI C89 compiler.

  • Linux, AIX, OS/400, Solaris, illumos, FreeBSD, NetBSD, OpenBSD, DragonFly BSD, Haiku, MS‑DOS, OS/2, Atari ST, AmigaOS, and Windows are known to work without modification.

  • The SoftIntegration Ch interpreter, and the GNU GCC, LLVM Clang, PCC, NVIDIA HPC SDK C/C++, Oracle Studio C/C++, DMD ImportC, CompCert C, Open64, PathScale EKOPath, IBM XL C/C++, DJGPP, Vbcc, Ack, Microsoft Visual C/C++, IBM Open XL C/C++, Open Watcom V2, and МЦСТ LCC compilers are regularly tested.

Make targets

The following make targets are available:

Make Target Description
all Builds the complete project
asm Builds only the TPZASM assembler
hexcom Builds only the HEXCOM utility

The following make targets will likely only be of interest to developers:

Make Target Description
test Runs the quick test suite (no emulator required)
longtest Runs the comprehensive test suite (requires the tnylpo emulator)
lint Source‑code quality checks (linting and static analysis)
dmd Builds the project using the DMD ImportC compiler
tags Builds source code tags (etagsctagsgtagscscope)
amalgamation Creates a single tpzasm.c source file

Notes

TPZASM is not related to the similarly named Cromemco ZASM or Megatokio ZASM assemblers.

Developer notes

  • make lint needs only a POSIX shell to run (plus whichever linters and static analysis tools it invokes). You’ll be informed of any missing prerequisites as well as any optional tools when you invoke make lint.

  • make longtest requires Georg Brein’s tnylpo emulator available in your PATH.

  • If you would like to contribute to TPZASM development, it is extremely important that you have all of the optional linters, static analysis tools, emulators, and cross‑toolchains installed, and that make lint, make test, and make longtest all pass completely clean, as this is a prerequisite for any change. Every linter has, at some point, caught real bugs in the code.

  • Usage of AI (artificial intelligence) tools by contributors is permitted, subject to the same terms and conditions as the LLVM AI Tool Use Policy.

Future plans

In 1979, after the closure of TDL/Xitan, Neil J. Colvin formed Phoenix Software Associates (PSA), and Carl Galletti and Roger Amidon formed Computer Design Labs (CDL), with both companies offering TDL‑derived development tools for several years.

CDL MACRO emulation

  • The CDL MACRO assemblers are in the same family, with three variants of the following three assemblers definitively known from examination of various listing outputs (E12011-0311, C12012-0312, and C12012-414X i.e., versions 3.11, 3.12, and 4.14X).

    • MACRO I is described as ‟a macro assembler which will generate relocatable or absolute code for the 8080 or Z80 using standard Intel mnemonics plus TDL/Z80 extensions. Functions include 14 conditionals, 16 listing controls, 54 pseudo‑ops, 11 arithmetic/logical operations, local and global symbols, chaining files, linking capability with optional linker, and recursive/reiterative macros”,
    • MACRO II is described as ‟expanding upon MACRO I’s linking capabilities and offering more listing options”, and,
    • MACRO III is described as ‟an enhanced version of MACRO II; internal buffers have been increased to achieve a significant improvement in speed of assembly; additional features include line numbers, cross‑reference compressed PRN files, form feeds, page parity, additional pseudo‑ops, internal setting of time and date, and expanded assembly‑time data entry”. At least one new pseudo‑op, .SETWID, has been definitively identified by reviewing listings.

    Unfortunately, no copies of these CDL assemblers are known to be archived, but TPZASM successfully assembles several program sources written for CDL MACRO without modification. If these assemblers could be found and analyzed, their bugs, quirks, and listing styles could be emulated in a future TPZASM release.

PSA PASM 2.00G emulation

  • Another PSA PASM variant, PSA PASM 2.00G (C12011-0200G, likely a beta release), is also known, though no documentation for it seems to have survived.

    Its assembly output seems to be byte‑for‑byte identical to PSA PASM 1.02 (with the same instruction encoding and the same relocatable object output) for all our TDL‑style test inputs. This release completely overhauls the listing format and adds some completely new modes, activated by the .EPOP and .ZOP pseudo‑ops, allowing the use of MACRO‑80‑style pseudo‑ops and Zilog mnemonics. Unfortunately, it also exhibits several behaviors that are clearly bugs, such as sometimes omitting the symbol table from listings when certain macros are defined.

    Note that the .ZOP mode of TPZASM has been lightly extended with support for the undocumented Zilog XH/XL/YH/YL (and IXH/IXL/IYH/IYL) instructions that access the high and low bytes of IX and IY. These and similar extensions may be gated behind a command‑line option in a future release.

    Complete emulation of this assembler is currently a work‑in‑progress.

  • An optional extended error checking mode may be added in a future release, enabling new features such as classifying errors or warnings by severity, and emitting new diagnostics the originals never supported, for example, warning when symbols longer than six characters would be silently truncated.

Reference

Original binaries

  • The orig/ directory contains the original CP/M‑80 executables.

Original documentation

  • The docs/ directory contains PDF‑format documentation for the assemblers (directly applicable to TPZASM), the book “Z‑80 assembly language under TurboDOS” by R. Roger Breton (an excellent TDL assembly resource), and some reverse engineering notes.

Security

SAST and linters

The following static analysis and dynamic verification tools are used as part of the comprehensive TPZASM testing process (with many invoked automatically via the .lint.sh script):

Tool Usage
PVS‑Studio Static analysis tool for C, C++, C#, and Java code
Clang AnalyzerSanitizers Static and dynamic analysis tools for C, C++, and Objective‑C code
Cppcheck Static analysis tool for C and C++ code
Dr. Memory Memory debugging tool for Windows, Linux, macOS, and Android
DUMA Detect Unintended Memory Access, a memory debugger
Flawfinder Scans C and C++ source code for potential security weaknesses
Funcheck A tool for checking function call return protections
GCC Static Analyzer Coverage‑guided symbolic execution static analyzer for C code
GNU Global Source code indexing and tagging system
GNU Cppi C preprocessor directive linting, indenting, and regularization
IBM AIX lint Checks C and C++ language programs for potential problems
NetBSD lint(1) A C (C90/C99/C11/C17/C23) program verifier
Oracle Developer Studio Performance, security, and thread analysis tools for C, C++, and FORTRAN
PurifyPlus Run‑time analysis tools for application reliability and performance
REUSE Verifies compliance with the REUSE software licensing guidelines
Semgrep A fast, open-source, static analysis engine for many languages
ShellCheck A static analysis tool for Unix shell scripts
Smatch Smatch (Source Matcher) is a static analysis tool for C code
SoftIntegration Ch C/C++ interpreter and interactive platform for scientific computing
Valgrind Tools for memory debugging, memory leak detection, and profiling
Visual Studio Code Analyzer Tools to analyze and improve C/C++ source code quality

Code statistics

Code statistics (table excludes tests) 📈 generated by scc:

Language Files Lines Blank Comment Code Complexity Bytes Uloc
C 11 14410 2451 2081 9878 3176 394256 6908
Shell 9 2415 377 335 1703 321 70055 1113
C Header 5 830 141 207 482 28 26516 349
Makefile 3 707 113 160 434 91 22970 341
Batch 1 20 3 13 4 0 702 18
Total 29 18382 3085 2796 12501 3616 514499 8675

License

The TPZASM software is distributed under the terms of the permissive MIT No Attribution (MIT‑0) License.

Third‑party materials

The following third‑party materials are provided under their own licenses:

About

TPZASM: TDL ZASM / PSA PASM compatible Z80 assembler

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages