Skip to content

oldcompcz/MASM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MASM Z-80 TM 1.05 for the ZX Spectrum

This repository preserves the original tape image and provides a readable, fully named and heavily commented reconstruction of the resident MASM Z-80 assembler and programming environment.

The reconstructed source covers the complete resident image loaded at decimal address 25000 ($61A8): 13,872 bytes through $97D7. Building the source reproduces both the resident CODE block and the complete supplied TAP image byte for byte.

Original authors: Petr Adámek, Richard Lukeš.

This source code is not based on the original source code. It is a decompiled version of the program's binary.

At a glance

Field Value
Program MASM Z-80 TM 1.05
Platform ZX Spectrum 48K
Type Resident Z80 assembler and full-screen source editor
Entry/load address 25000 ($61A8)
Resident image 13,872 bytes ($61A8-$97D7)
Editor 80-character logical lines through a 64-column viewport
Assembler Two pass, with macros, local blocks and cross-references
Storage Cassette and ZX Interface 1/Microdrive support
Preserved media Ten-block TAP with loader, MASM and three examples
Documentation Original Czech manual scan and corrected Microdown edition

The surviving manual presents MASM Z-80 as one member of a three-assembler family (Masm 8080, Masm Z-80, Masm 8048). It emphasizes Gens source compatibility while adding parameterized macros, local blocks, cross-references and support for undocumented Z80 forms. An external catalogue view is available at Spectrum Computing. Spectrum Computing is backed by the open ZXDB catalogue; this repository uses that page as an external historical reference, while binary and behavioral claims below are verified from the preserved tape, manual and reconstruction.

Program overview

MASM combines an editor, assembler and storage environment in one resident program. The preserved version includes:

  • a full-screen editor with horizontal scrolling over 80-character source lines;
  • automatic structural tabulation for labels, mnemonics, operands and comments;
  • a two-pass Z80 assembler with forward-reference resolution;
  • global, selected and local labels;
  • macros with up to 16 parameter values;
  • conditional assembly and LOC/ENDL local blocks;
  • standard and undocumented Z80 instruction forms, including IX/IY halves;
  • tape and Interface 1/Microdrive source operations and include streams;
  • listing, symbol, cross-reference and generated EQU-source output;
  • three example source programs stored after the assembler on the tape.

The source is written as a literate reconstruction: subsystem introductions, routine contracts, pseudocode, data-layout descriptions, worked examples and selective instruction comments are kept next to the exact assembly they explain. For a subsystem-by-subsystem reading guide, see src/README.md.

Repository layout

documentation/
    Masm-CS-original.pdf   original Czech manual scan
    Masm-CS.md             corrected Microdown transcription
    README.md              documentation provenance
original/
    Masm.tap               preserved original tape image
src/
    README.md              detailed architecture and code-reading guide
    masm.asm               authoritative complete source
tools/
    assembler.py           two-pass source assembler
    rebuild_tap.py         replaces the resident CODE block in the TAP
    build.py               complete build driver
    verify.py              source-build and byte-identity verification
    verify_preservation.py dependency-free input and TAP-tool verification
Makefile                   convenience build targets
requirements.txt           pinned Python dependency

Requirements

  • Python 3.10 or newer;
  • SkoolKit 10.0.

Install the Python dependency in a virtual environment:

python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt

On Windows PowerShell, activate the environment with:

.venv\Scripts\Activate.ps1

Build

The portable build command is:

python tools/build.py

Or, on systems with make:

make build

The build creates:

build/masm-code-25000.bin
build/Masm.tap
build/symbols.tsv

build/Masm.tap retains the original BASIC loader and the three example source blocks. Only the resident CODE block named c is regenerated from src/masm.asm.

Verify the reconstruction

The full verification assembles the source and therefore requires the installed SkoolKit dependency:

python tools/verify.py

or:

make verify

A successful full verification proves:

  • the source assembles at 25000 to exactly 13,872 bytes;
  • the resident image has SHA-256 03a13d255d5ad95049a9199a4107380fcf71afb0c069df11367410001e08ca4a;
  • the regenerated complete TAP is byte-for-byte identical to original/Masm.tap;
  • the complete TAP has SHA-256 43b8e86eb071bdb154cd3f54152ceeeece22aea65f718aee72bf969780a00d48.

A dependency-free preservation check is also available:

python tools/verify_preservation.py
# or: make preservation-check

It checks the source, supplied manual PDF and original TAP fingerprints, validates all TAP checksums and structure, extracts the resident CODE block, and round-trips that block through the TAP-rewrite tool. It deliberately does not claim to assemble the source; use the full verification above for that proof.

Running MASM

Load original/Masm.tap or build/Masm.tap in a ZX Spectrum emulator or on real hardware. The BASIC loader loads the resident program and enters MASM at address 25000. The remaining tape blocks contain the snake2, Snake2+ and SCAN example source files for MASM's source-loading commands.

See documentation/Masm-CS.md for the editor, assembler language, commands, options, pseudoinstructions and memory map. See src/README.md for the internal editor, display, storage and compiler architecture.

Preservation and rights

The original binary and documentation are included for software-preservation and research purposes. Rights in the original program and manual remain with their respective authors or rightsholders. No ownership of the original work is claimed here. The reconstructed comments, labels and build tooling document the preserved binary and should not be read as a claim that the historical source code was recovered from the authors.

About

Historical assembler for ZX Spectrum

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors