Multi Function Utilities

TRS-80 Tool

Introduction:

What started off as a utility which could rescue deficient WAV files and convert them to workable images has grown by leaps and bounds to cover all types of conversion and analysis functions. This used to live on the cassette utilities page, but with its expansion, it needs to be moved so its other functions are not ignored.

OS: 
Windows 10+ / Mac (Intel and Apple Silicon) / Linux
Version: 
4.2.0
Last Update: 
October 15, 2026

Important Note:

  • On Linux and macOS you’ll need to make the file executable:
    % chmod +x trs80-tool
  • On macOS you’ll additionally have to remove the quarantine:
    % xattr -d -r com.apple.quarantine trs80-tool

Major Functionality:

  • File identification and archive inventory — info identifies program types, embedded filenames, and disk formats; info --verbose adds details such as floppy geometry, while info --json exposes structured metadata. dir lists files inside cassette and floppy images, optionally including system files. This makes it useful for cataloging collections whose filenames and extensions are unreliable or uninformative.
  • Broad floppy-image and operating-system support — Reads JV1, JV3, DMK, SCP raw-flux images, HFE version 1 (HxC and Gotek), and ImageDisk (IMD); .DSK is treated as a generic extension whose underlying format needs identification. The documented filesystem coverage includes TRSDOS (Model I, III, and 4, including 2.7DD/2.8), TRSDOS 6 and LS-DOS 6.3, LDOS, NEWDOS and NEWDOS/80, DOSPLUS, MultiDOS, VTOS, UltraDOS, Percom DoubleDOS and MicroDOS, and RAPIDOS, in single, double, or mixed density and single- or double-sided. As of v4.2.0 it also reads Model II disks (TRSDOS 1.x and 2.0, TRSDOS-II, DOSPLUS II, and Xenix disks that hold a tar archive), FMG's UCSD Pascal disks for the Model I, and a wide range of CP/M formats (Lifeboat, Montezuma Micro, Holmes Engineering, Digital Research CP/M Plus, and the Model II's standard 8-inch, Aton, and Pickles & Trout formats). info names the DOS and its version from what the disk says about itself. The important distinction is that it understands filesystems, not merely disk-image containers, so it can extract individual files rather than just inspect raw sectors. Reading of damaged and copy-protected images is much more robust than in earlier versions.
  • File conversion — convert handles conversions such as disk-format machine-language programs (.CMD) to cassette-format programs (.3BN), tokenized BASIC to text, and WAV cassette recordings to CAS images. It can also combine multiple programs, or the contents of a whole floppy or cassette, into a single cassette image or audio file. This is its central bridge between archival formats, emulator inputs, and cassette-loading workflows. It is not a universal disk-image writer; the tool can only read floppy disks, not write them.
  • File extraction — extract (new in v4.0.0; this used to be part of convert) writes every file inside a floppy image, CAS file, or cassette WAV into a directory. Files on damaged floppies are written anyway, with unreadable sectors filled with zeros and the problem reported; --mark-damaged also tags their names with [DAMAGED]. CP/M text files are clipped at their Ctrl-Z, UCSD Pascal text files are converted to plain text, Xenix tar disks keep their directory structure, and files whose names differ only in case are not overwritten.
  • BASIC listing recovery and interchange — Reads both tokenized and plain-text BASIC, writes tokenized .BAS, and uses .ASC for non-tokenized text output. For example, trs80-tool convert in.bas out.asc produces a readable listing. That provides a practical route for examining, editing, searching, or version-controlling BASIC programs without first loading them into a TRS-80. The changelog also documents EDTASM-to-text conversion support.
  • Cassette decoding and audio generation — Accepts WAV recordings at arbitrary sampling rates, with 8- or 16-bit samples and mono or stereo audio. It can decode recordings into program files, generate WAV/CAS output, preserve a detected cassette baud rate, or override it with --baud. Level I 250-baud files are also supported. This functionality supports both recovering programs from recordings and creating cassette audio from existing digital files.
  • Disk-condition analysis and binary inspection — sectors maps tracks and sectors, distinguishing single/double density, deleted sectors, missing sectors, and CRC errors. sectors --bad goes further by identifying which files, if any, occupy damaged sectors; --contents displays their data. The annotated hexdump command complements this with byte-level inspection. The file-to-bad-sector mapping is particularly valuable for deciding whether a damaged image affects an important program or only unused space.
  • Z80 assembly and program generation — asm assembles source into .CMD, .3BN, .CAS, .WAV, .BIN, or Intel HEX, with optional listing files. That covers ordinary program development, cassette distribution, and ROM/EPROM-oriented output. The documented assembler includes expression support and various zmac-compatibility improvements, although the page does not claim complete zmac compatibility.
  • Disassembly and reverse engineering — disasm understands load addresses in program files, accepts explicit origins for raw ROM/BIN files, and attempts to separate code from data by following execution paths. Additional entry points help with relocated programs; --full forces sequential disassembly. Output options include labels, known ROM references, ASCII comments, and formatted listings. It also handles certain system-file overlays and raw boot-sector dumps. Its main caveat is that automatic code/data classification remains heuristic and may need manual guidance.
  • Terminal-based TRS-80 emulation — run emulates Models I, III, and 4, supports BASIC-level selection, launches programs or boot disks, and mounts cassettes and multiple floppy images. This offers a quick execution check within a command-line workflow, but the author labels it experimental, unsuitable for some games, and potentially nonfunctional in a Windows shell. Mounted floppy changes can be written back to the image unless --write-protected is used.
  • Interactive Z80 experimentation — repl lets you enter assembly instructions, assemble and execute them, and inspect their effects on registers and flags. Unlike run, this is a bare Z80 environment without TRS-80 ROM or peripherals. It is therefore better suited to testing instruction behavior and small code fragments than to running complete TRS-80 software.
  • AI-controlled emulation through MCP — mcp exposes a persistent emulator to compatible AI clients, including a documented Claude Code setup. An assistant can boot a machine, load BASIC or binary programs, mount disks, type or hold keys, inspect memory and registers, single-step, and run until a specified address, screen message, or memory value appears. This is substantially more capable than asking an AI to reason about a listing alone: it supplies an execution environment in which the assistant can test its conclusions.
  • Performance measurement and visual capture — The MCP interface supports program-counter profiling, routine calls with chosen register values, and cycle-based timing. Memory-triggered waits provide precise timing boundaries, while screen-text waits are described as approximate. It can also save PNG screenshots and record MP4 video at intervals based on emulated time; video recording requires ffmpeg. Together, these features support optimization work and reproducible demonstrations of program behavior.

Supported Formats:

TRS80-TOOL supports the following formats:

3BN 
A machine language program as stored on a cassette. The name comes from "Model 3 BiNary". This is typically not used, and instead these files are stored within .CAS files.
ASC 
Basic program, but always in text (non-tokenized) format. The extension is mostly useful when writing a Basic file, because it tells the converter to use the non-tokenized format.
ASM 
An assembly language file, generated by disassembling a .CMD, .SYS, or .3BN file using the disasm command.
BAS 
Basic program. It’s typically tokenized (token words like PRINT are stored as a single byte), but the tool supports reading Basic programs that are in text (non-tokenized) format. When writing a file with a .BAS extension, the file is always tokenized.
BIN 
A file of unknown type, but sometimes synonymous with .ROM.
CAS 
A cassette stored in a compact form where each bit on the cassette is stored as a bit in the file. It includes synchronization headers and bytes, as well as start bits (for high-speed cassettes). This is a decent archival format for cassettes.
CMD 
A machine language program as stored on a floppy disk.
DMK 
Another floppy disk format, capturing more information from the floppy, such as some bits between sectors. Named after David M. Keil.
DSK 
Generic file extension for floppy disk—could be a .JV1, .JV3, or .DMK file. Use the info command to find out.
HEX 
Intel HEX file, a text file for burning EPROMs. Can be generated by the assembler when developing a ROM.
HFE 
HxC Floppy Emulator floppy disk format, also used by Gotek drives. Version 1 only, read-only.
IMD 
ImageDisk floppy disk format, from Dave Dunfield’s ImageDisk program. Common for Model II and other 8-inch disks. Read-only.
JV1 
A floppy disk format for the Model I. It’s very simple, capturing the basic sector data. It does not capture enough information for copy-protected floppies. It’s named after Jeff Vavasour.
JV3 
A floppy disk format for the Model III. It’s very simple, capturing the basic sector data and IDAM structure. It does not capture enough information for copy-protected floppies. It’s slightly more capable than .JV1 because it can encode a mix of FM and MFM signals on the same track.
L1 
A 250-baud file written by a Level 1 machine (Model 1 or 3). It can contain a system file or a Basic program.
LST 
An assembly language listing file, generated by the asm or disasm commands’ --listing flag.
ROM 
A raw machine language file, often used as the contents of ROM.
SCP 
SuperCard Pro raw flux floppy disk format.
SYS 
The same format as .CMD, but is meant to store system code in a disk operating system. Can also store the boot sector, in which case it’s not in .CMD format, it’s just the raw bytes.
WAV 
A cassette’s audio stream. It can be at any sampling rate, either 8 or 16 bits per sample, and either mono or stereo.

Command Line Options:

Command line options are as follows:

Usage: trs80-tool COMMAND args ...

Options:

FLAGS

--version
Show the tool's version number
--help
Show the usage message
--color=COLOR
Force color mode (off, 16, 256, 16m, or auto).
--no-pager
Don’t send output to a pager.
--trace=MODULE
show trace logs for module (base, emulator, floppy). These log lines can reveal how the module makes various decisions, and can help debugging. This flag is mostly intended for the developer, but can help explain why (for example) a specific floppy isn’t being recognized. The “base” module deals with TRS-80 file formats; the “emulator” module is the TRS-80 emulator itself; and the “floppy” module is for floppy-related messages. Repeat the option to enable tracing for multiple modules.

The tool detects the terminal's color capabilities automatically and honors the NO_COLOR and FORCE_COLOR environment variables. The dir, info, sectors, hexdump, and disasm commands send their output to a pager when it's going to the terminal. The pager is TRS80_TOOL_PAGER if set, then PAGER, then less (Windows only pages if one of those variables is set). Set it to cat or use --no-pager to turn paging off.

ARGUMENTS

dir
Show the contents of an archive file: cassettes (WAV or CAS) and floppies (JV1, JV3, DMK, SCP, HFE, or IMD). Cassettes show baud rates; floppies show creation date and file type. CP/M floppies show file attributes (and user numbers); Percom MicroDOS shows file type and remark; Model II TRSDOS and TRSDOS-II show file type and protection; UCSD Pascal shows date and kind; Xenix tar shows Unix mode, owner, and path. --system shows system files, and --cpm-records shows CP/M file sizes in whole 128-byte records. Output is colored using the LS_COLORS and EZA_COLORS environment variables.
info
Displays a one-line description of the contents of the file, such as its type (system program, Basic program); if known, the embedded filename; the DOS and version of a floppy; and the starting address (or its best guess for one) for SYSTEM tapes. --verbose adds details such as floppy geometry and WAV metadata. --json dumps (almost) everything known about the file in JSON format.
extract
Writes the files inside a floppy image, CAS file, or cassette WAV file to an existing directory.

trs80-tool extract ...

in.dmk outdir

Extract the files from a DMK file to a directory

in.cas outdir

Extract the files from a CAS file to a directory

in.wav outdir

Extract the files from a WAV file to a directory

--system in.dsk outdir

Include system files from the floppy

--mark-damaged in.dmk outdir

Damaged files are always written (unreadable sectors filled with zeros); this also adds [DAMAGED] to their names

--lowercase in.dsk outdir

Write the files with lowercase names

--cpm-records in.dsk outdir

Keep CP/M text files' whole 128-byte records instead of stopping at the Ctrl-Z

--ucsd-pascal-raw in.dsk outdir

Write UCSD Pascal text files as they are on the disk instead of converting them to plain text

hexdump
Displays a hex dump of the input file, with annotations. By default the command will collapse consecutive identical lines (turn off with --no-collapse). The --color flag will force coloring on or off.
sectors
Displays a table of the sectors in a floppy disk. The columns are the sectors and the rows are the tracks. For each sector a character is displayed: - no sector, S single-density, D double-density, X deleted, C CRC error (ID or data), ? missing. The --contents flag will show the contents of each sector. The --bad flag lists all sectors that are missing or that have a CRC error, as well as which file (if any) is on each bad sector.
repl
Start an interactive session for exploring the Z80. You can type an assembly language instruction (such as "ld a,5") to assemble it, write it to memory, explain it, execute it, and show its effects on flags and registers. This virtual machine is not in a TRS-80 context (it has no ROM or peripherals).
mcp
Runs an MCP server on stdin/stdout, which lets an AI assistant drive a TRS-80 directly. The assistant can boot a ROM, type at it, run it for an exact number of clock cycles, and inspect the screen, memory, and registers. The machine stays running between requests, so the assistant can explore interactively instead of guessing. You don’t run this command yourself. Your AI tool starts it for you, so what you do is tell that tool about it. With Claude Code: claude mcp add --scope user trs80 -- trs80-tool mcp (trs80-tool must be on your PATH, or use the full path).

Tools the assistant gets: boot, load_program, mount_disk, reset, load_basic, type, key, run, step, run_until_pc, run_until_screen, run_until_memory, screen, read_memory, write_memory, registers, search_memory, disassemble, profile_pc, call_routine, screenshot (PNG), and record_start/record_stop (MP4, needs ffmpeg). Timings are reported in Z80 clock cycles (t-states), so they're exact and repeatable.
asm
Assembles the specified assembly language source code.

trs80-tool asm ...

program.asm program.cmd

Assembles program.asm into program.cmd. Output can be .CMD, .3BN, .CAS, .WAV, .BIN, or .HEX

--baud 1500 program.asm program.cas

Assembles program.asm into a 1500 baud CAS file.

--listing program.lst program.asm program.cmd

Assembles program.asm into a program.cmd with a listing file of program.lst.

disasm
Disassembles the specified program. .CMD, .SYS, and .3BN files (detected by contents, so FLT, DVR, and OV? files work too) are loaded at their correct addresses; .ROM and .BIN files load at 0000H unless --org is given. CAS and WAV files can be disassembled directly (first program only). Other flags: --entry (extra entry points; include 0x0000 again if needed), --full (disassemble continuously, no code/data guessing), --data-comment (ASCII comment on each instruction), --no-labels, --no-known (no known ROM addresses), --hex-format (c for 0x12, dollar for $12, or h for 12h), --listing, --no-binary (no opcode bytes in the listing), and --upper.

trs80-tool disasm ...

saucer.cmd

Disassembles saucer.cmd

--org 0x8000 file.bin

Disassembles a raw file.bin with an ORG of 8000H

--entry 0x0000,0x3799,0x377B model3.rom

Disassembles a ROM, also following the listed entry points

--data-comment --upper --full --no-labels --listing --no-known --hex-format h boot.sys

Disassembles boot.sys to look like a TRS-80 disassembled it

run
Run a TRS-80 emulator in the shell.

trs80-tool run ...

--model 1 --level 1

Starts a Model I Level 1 Emulator. Choices are Model I, III, and 4, Level 1 and Level II.

tdos13a.dsk

Runs an emulator and boots tdos13a.dsk

frogger.cmd

Runs an emulator and loads and runs frogger.cmd

--mount in.cas in1.dmk in2.dmk

Mounts a cassette, and floppies in consecutive drives starting at 0. Changes made to a floppy are written back to the image file.

--write-protected --mount in1.dmk

Mounts all floppies as write-protected

--xray

Starts a web server for the X-ray debugger instead of showing the machine in the shell (experimental, undocumented)

convert
Converts a list of input files to an output file. (To write the contents of an archive to a directory, use extract; convert no longer does this as of v4.0.0.)

The convert option is quite powerful and has arguments of its own: --baud, --entry, --start, --system (include system files from floppies), and --cpm-records (keep whole CP/M records). Here are SOME examples:

trs80-tool convert ...

--system in.dmk out.wav

Diskette to WAV, including the system files

in.cmd out.3bn

CMD file (Diskette) to SYSTEM format (Cassette)

--start 17408 in.rom out.cmd

Raw Image file to CMD format, with a load address of 17408

in.bin out.3bn

Raw Image file to SYSTEM format

in.bas out.asc

Detokenize file

in1.bas in2.3bn in3.cmd out.wav

3 files into a WAV file (including converting CMD to SYSTEM)

in.dmk out.wav

Diskette to WAV

in1.cas in2.cas in3.cas out.wav

3 CAS files into a single WAV file

in1.bas in2.3bn out.wav

BAS file and SYSTEM file into a single WAV file

in.cmd out.lst

Disassemble CMD file

in.3bn out.lst

Disassemble SYSTEM file

in.wav out.wav

Clean and radically shrink the size of a WAV file

trs80-tool convert --baud ...

1500 in1.bas in2.3bn out.wav

BAS file and SYSTEM file into a 1,500 Baud WAV file

trs80-tool convert --start ...

17408 in.cas out.cas

Set the start address to /17408

auto in.cas out.cas

Set the start address to its best guess

trs80-tool convert --entry ...

0x7059,0x7064,0x71B9,0x7263 lower.cas lower.lst

Disassemble the cassette file LOWER.CAS to LOWER.LST but treat locations 7059H 7064H 71B9H and 7263H as entry points. This will stop the disassembler from wrongly assuming relocated code is actually an ascii string.

help
Shows more specific information about another command, for example trs80-tool help convert.