Skip to content

Releases: oisee/minz

v0.20.1 — Profiler: Stack Tracking + Memory Snapshots

04 Mar 23:31

Choose a tag to compare

What's New in v0.20.1

Profiler: Stack Push/Pop Heatmaps

  • Per-byte stack tracking via SP-delta detection after each instruction
  • stack_push / stack_pop counters show exactly which addresses are used as stack
  • stack_depth meta field: lowest SP seen (deepest stack usage)
  • Signed int16 delta handles uint16 wraparound; ignores LD SP,nn re-initialization

Profiler: Memory Snapshot at Export

  • Captures full 64KB memory state when profile is exported
  • mem_snapshot field: byte values at all hot addresses (exec/read/write/stack)
  • Correlate "most-read address" with "what's actually there" in one JSON

Example profile output

{
  "meta": {"total_instrs": 33, "stack_depth": "FFFE"},
  "exec": {"0100": 1, "0103": 1, ...},
  "read": {"0100": 5, "FFFE": 2, ...},
  "stack_push": {"FFFE": 1, "FFFF": 1},
  "stack_pop": {"FFFE": 1, "FFFF": 1},
  "mem_snapshot": {"0100": "3E", "FFFE": "00", ...}
}

Changes

  • Both MZE and MZX profilers updated
  • Memory() accessor on RemogattoZ80 for snapshot capture
  • MZX: stack tracking in both RunFrame() and RunFrameFast() paths

Full diff: v0.20.0...v0.20.1

v0.20.0 — MIR Backend Tests, VSCode Tooling, Stderr Port

04 Mar 23:19

Choose a tag to compare

What's New in v0.20.0

Emulator: Stderr Port & Exit Codes

  • Stderr port $25: OUT ($25), A sends bytes to host stderr (when --console-io active)
  • DI+HALT exit code: A register value becomes the process exit code
  • Port $23 (stdin/stdout) unchanged; $25 is write-only, odd (safe from ZX ULA conflicts)

MIR Backend Test Suite

  • 11 handcrafted .mir programs exercising arithmetic, logic, branches, loops, variables, strings
  • Go test harness: parse → codegen → assemble → emulate → verify output
  • 9/11 passing (2 known backend bugs: loop_while, accumulator)
  • T-state benchmarking support

VSCode Extension v0.6.0

  • MIR syntax highlighting — TextMate grammar for .mir files (functions, registers, instructions, labels)
  • Compile & Run works for both .minz and .mir files
  • Target selection — choose cpm/zxspectrum/msx/cpc from Quick Pick
  • LSP server (mzlsp), SLD debugging, DeZog integration

Register Allocator Overhaul

  • 7.8x iterator speedup (207T → 26T per element)
  • Physical register allocation for iterator hot paths

Iterator Chain Fusion

  • Fusion optimizer inlines ≤8-instruction callbacks into DJNZ loops
  • 11/11 E2E tests pass (hex-verified)
  • BareDJNZ hint + peephole rule 48

Documentation

  • Honest assessment report (#025) with code-verified numbers
  • MIR language compatibility analysis (53 portable opcodes, PL/M 9/10 compatibility)
  • Comprehensive ecosystem status review (#024)

Full changelog

39 commits since v0.19.3 — see compare

v0.19.1 — MZA Bracket Syntax, Beeper Fixes

26 Feb 22:13

Choose a tag to compare

What's New

MZA Assembler: Bracket Indirection Syntax

  • [addr] accepted alongside (addr) for all indirection forms
  • Register indirect: LD A, [HL], LD [BC], A
  • Memory indirect: LD HL, [$8000], LD [$9000], A
  • Indexed: LD A, [IX+5], LD [IY+3], B
  • I/O: IN A, [C], OUT [C], B
  • Mismatched brackets ([HL), (HL]) are correctly rejected
  • Follows sjasmplus --syntax=abf convention, always enabled — no flag needed
  • 28 new test cases covering all forms + mismatch rejection

MZX Beeper Audio Fixes

  • Fix beeper silence bug — BEEP command now produces sound
  • Fix 50Hz click — fade out at active→silent transitions
  • Fix periodic click — always produce samples in silent frames

Binaries

All platforms include: mz (compiler), mza (assembler), mze (emulator), mzd (disassembler), mzr (REPL), mzrun (DZRP runner), mzv (VM), mztap (TAP loader).

macOS builds also include mzx (ZX Spectrum graphical emulator). Linux/Windows mzx requires building from source with CGO.

Full Changelog: v0.19.0...v0.19.1

v0.19.0 — MZX Emulator, Covox, PSG Capture, All Platforms

25 Feb 17:47

Choose a tag to compare

What's New

MZX ZX Spectrum Emulator

  • T-state accurate ULA with proper border rendering
  • AY-3-8912 sound with ring buffer for jitter-free playback
  • Covox Speech Thing (DAC on port $FB) with per-T-state recording
  • AY PSG auto-capture--psg file.psg / --psg file.psg2 (compact bitmask format)
  • 128K SNA snapshots, .TAP and .TRD/.SCL disk loading
  • TR-DOS simulation with full dispatch table
  • Pentagon 128K model with corrected border timing
  • Screenshots (F5 or --screenshot), frame dumps (--dump-frames)
  • BASIC automation: --type, --exec for scripted testing
  • --load/--set/--run flags for raw binary loading and CPU state control
  • --trd-run flag to run BASIC programs from TR-DOS disk images

Toolchain Improvements

  • Z80 emulator: 1335/1335 FUSE tests pass (100% instruction coverage)
  • Table-driven assembler: All Z80 instructions via pattern matching
  • IDA-like disassembler: Analysis engine with cross-references
  • ABI file format: Load/export for ROM integration
  • Execution profiler and trace output

Bug Fixes

  • AY data write port mask corrected ($BFFD instead of $7FFD)
  • Default model changed to 128K
  • 48K protected from accidental paging port writes
  • Beeper clicking and keyboard mapping fixes

Binaries — MZX on ALL platforms!

Platform Tools
macOS arm64 minzc, mza, mzd, mze, mztap, mzx
macOS x86-64 minzc, mza, mzd, mze, mztap, mzx
Linux x86-64 minzc, mza, mzd, mze, mztap, mzx
Linux arm64 (RPi) minzc, mza, mzd, mze, mztap, mzx
Windows x86-64 minzc, mza, mzd, mze, mztap, mzx
Windows arm64 minzc, mza, mzd, mze, mztap, mzx

Checksums

See SHA256SUMS.txt in the release assets.

v0.18.0 - MZX Spectrum Emulator, Profiler & Full Toolchain

25 Feb 12:46

Choose a tag to compare

Highlights

MZX: T-State Accurate ZX Spectrum Emulator (NEW)

A complete ZX Spectrum emulator built into the MinZ toolchain, featuring:

  • T-state accurate ULA with proper border rendering and contention
  • AY-3-8912 sound chip emulation
  • 128K / Pentagon models with bank switching
  • .tap / .trd / .scl format loading (tape and TR-DOS disk)
  • .sna snapshot load/save (48K and 128K)
  • BASIC tokenizer and console capture (--exec, --type, --console)
  • Frame dump system (--dump-frames, --dump-keyframes, --screenshot)
  • Raw binary loading (--load FILE@ADDR, --set PC=8000,SP=FFFF,DI)
  • Headless mode for automated testing and CI
  • Beeper + AY audio with per-channel enable/disable
  • ZX Spectrum 48K ROM included (Amstrad free distribution)

Execution Profiler & Trace

  • --profile FILE.json — execution/memory/IO heatmaps (sparse JSON)
  • --trace FILE.jsonl — basic-block execution trace (JSONL)
  • --trace-frames START:END — frame range filtering
  • Zero overhead when disabled (nil pointer check)

DI+HALT Detection

  • --warn-on-halt — warns when CPU executes HALT with interrupts disabled

MZD: IDA-Like Disassembler (NEW)

  • Recursive descent analysis engine
  • Cross-reference tracking, code vs data classification

MZA: Table-Driven Assembler Rewrite

  • Old encoder fully removed, replaced with instruction_table.go + pattern_matcher.go
  • 1335/1335 FUSE Z80 test suite passes

Participle Parser

  • Tree-sitter replaced with pure Go Participle-based parser
  • Eliminates OOM issues on large files

Language Features

  • Operator overloading (+, ==, * with type dispatch)
  • UFCS method syntax (obj.method())
  • Auto-derivation for comparison operators
  • Multi-parameter loop reroll optimization
  • String intent detection in peephole optimizer

Build System

  • make all builds 9 tools: mz, mza, mze, mzv, mzr, mzrun, mztap, mzd, mzx
  • make install-user installs to ~/.local/bin/
  • Linux/WSL build fixes

Full Changelog

v0.16.4...v0.18.0

v0.16.4 - GLSL Shader Library: Shaders on Z80!

05 Jan 23:21

Choose a tag to compare

MinZ v0.16.4 - GLSL Shader Library

Codename: "Shaders on Z80"

What's New

Complete GLSL-style shader library bringing modern graphics programming to vintage Z80 hardware!

New Library: stdlib/glsl/

Module Purpose
fp.minz 8.8 Fixed-point math with Z80 assembly
trig.minz Trigonometry with 65-entry lookup tables
vec.minz vec2/vec3/vec4 GLSL-style vectors
sdf.minz Signed Distance Functions
raymarch.minz Raymarching framework
dither.minz Floyd-Steinberg & Bayer dithering

Working Demo: glsl_sphere_demo.minz

A 410-line raymarched sphere demo that compiles to 4,384 lines of optimized Z80 assembly!

Features:

  • 15-step raymarching with DJNZ optimization
  • Fixed-point lighting and fog
  • Bayer 4x4 dithering
  • Surface normal calculation

Compilation Stats

Metric Value
Source lines 410
MIR instructions 986
Z80 assembly lines 4,384
DJNZ loops 4
True SMC calls 30
Inlined functions 95

Inspiration

Massive thanks to DeanTheCoder and the ZXSpeculator project for proving sophisticated 3D graphics are possible on Z80. The OneSmallStep lunar raymarcher directly inspired this library.


"Shaders on Z80 - because we can."

v0.16.3 - DZRP Toolchain & Shader Vision

05 Jan 01:16

Choose a tag to compare

Instant Load Revolution

This release introduces a complete DZRP toolchain that transforms ZX Spectrum development.

New: mztap - Instant TAP Loader

Load TAP files 500x faster by bypassing tape emulation entirely!

mztap game.tap        # 19KB loads in ~100ms instead of 55 seconds!
mztap --list demo.tap # Inspect TAP structure

Unified DZRP Configuration

Configure once, use everywhere:

export DZRP_HOST=192.168.1.100
export DZRP_PORT=11000

mzrun game.minz   # Uses DZRP_HOST:DZRP_PORT
mztap game.tap    # Uses DZRP_HOST:DZRP_PORT

Flexible Address Formats

Both tools support Z80-style addresses:

  • 0x8000 or $8000 (hex)
  • 32768 (decimal)
  • 0100000 (octal)

Future Vision: Shader Graphics

Inspired by ZXSpeculator's experiments, we're exploring GLSL-style vector math for Z80:

import glsl;
fun sdSphere(p: vec3, r: i16) -> i16 {
    return v3_length(p) - r;
}

Full Changelog

  • mztap: New instant TAP loader
  • mzrun: Address formats + DZRP_* env vars
  • Unified config: DZRP_HOST, DZRP_PORT, DZRP_SOCKET
  • WebSocket prep: --socket flag for future ws:// support
  • Docs: ZXSpeculator integration recommendations

Full Changelog: v0.16.2...v0.16.3

v0.16.2 - Smart Print Optimization + DZRP Celebration

04 Jan 15:21

Choose a tag to compare

🎉 v0.16.2: Smart Print Optimization + DZRP Celebration

Highlights

  • Smart @print optimization saves 9+ bytes per program
  • Stateful print tracking reuses print_string helper
  • Explicit loop halt intent: loop { asm { EI; HALT } }
  • ZXSpeculator screenshot in README!

Print Optimization

  • Tracks print_string usage across module
  • Lowers inline threshold from 8 to 3 chars once helper exists
  • "Answer: " (8 chars): 24 bytes inline → 15 bytes via helper
  • Code size analysis documented in source

DZRP Integration

  • mzrun: compile → assemble → upload → run in ONE command
  • ZXSpeculator recommended emulator
  • Full step debugging, breakpoints, memory inspection
  • Hot reload workflow for rapid development

Screenshot Proof

MinZ on ZXSpeculator

  • hello_print.minz running on ZXSpeculator
  • Shows "HELLO WORLD!", "This is MinZ!", "Answer: 42"
  • Register panel visible with IFF flags enabled

Recommended emulator: https://github.com/oisee/ZXSpeculator

v0.16.1 - DZRP Live Testing + Infinite Loop Support

04 Jan 15:21

Choose a tag to compare

🎉 v0.16.1: DZRP Live Testing + Infinite Loop Support

Highlights

  • DZRP (DeZog Remote Protocol) integration via mzrun
  • Proper loop { } syntax with ZX Spectrum-friendly halt
  • EI; HALT; JR pattern keeps interrupts enabled
  • Updated README with celebration and documentation

New Features

  • InfiniteLoopStmt AST node for infinite loops
  • Empty loops generate EI;HALT;JR (ZX Spectrum friendly)
  • Non-empty loops generate standard jump-back
  • mzrun tool for live emulator testing

Toolchain

  • mzrun: Compile, assemble, upload, run in one command
  • Works with ZXSpeculator and other DZRP emulators
  • --reset flag for clean execution

Recommended Emulator

ZXSpeculator - https://github.com/oisee/ZXSpeculator

  • Beautiful shaders
  • Native DZRP support
  • Instant feedback!

v0.16.0 - DAP Debugger + Z80N Vision

04 Jan 15:21

Choose a tag to compare

🎉 v0.16.0: DAP Debugger + Z80N Vision

Highlights

  • DAP (Debug Adapter Protocol) server for VS Code debugging
  • Z80N/eZ80 roadmap for ZX Spectrum Next and Agon Light
  • 92% compilation success rate
  • Complete toolchain documentation

DAP Debugger

  • Step debugging with breakpoints
  • Register and memory inspection
  • Variable watch
  • Call stack visualization

Z80N Vision

  • ZX Spectrum Next support planned
  • Extended instruction set
  • DMA and copper coprocessor integration

Toolchain Improvements

  • mze debug - DAP server mode
  • Enhanced error messages
  • Better optimization pipeline

Statistics

  • 92% compilation success (up from 81%)
  • 72/72 core examples passing
  • 280+ documentation files