TRS-80 Miscellaneous Utilities

TRS-80 File Format Converters

Utility Name
Date
Author
Home Site

trld reads one or more TRS-80 programs in .rom, .cmd, .cas, .wav, .hex or .bas format and saves them as a single .cmd, .cas or .hex file. As input it supports 250, 500 and 1500 baud .cas cassette image files as well as tokenized and ASCII .bas BASIC program files. Output can be in .cmd, .cas, .hex or .wav (audio file) format.

It takes a list of files. The last one is the output file, the rest are loaded in sequence and combined together to form the output. The format of the input files is determined automatically. The output format is chosen depending on the file suffix. For example, to convert a cassette file to a .cmd (disk executable format) you would type:

trld original.cas original.cmd

With multiple input files the program start address is taken from the last file. For “.cas” output the name of the SYSTEM file is based on the first 6 letters of the output file name. With

trld file.cmd ..\converted\out.cas

The “..\converted\out.cas” file will be called “OUT” and that’s the name you must pass to the SYSTEM command.

Option Reference:

-c
Clean – don’t pad .cas tail with zero bits.
-i
Ignore checksum errors.
-t
250 baud output (if output is a .cas or .wav file).
-l
500 baud output (if output is a .cas or .wav file).
-h
1500 baud output (if output is a .cas or .wav file).
-n
Put file name in .cmd output.
-s N
Stop at stage N of relocation and/or cassette loading. “-s 1” to do nothing, “-s 0” to keep trying indefinitely. “-s 2” to do one stage of relocation/loading.
-v
Output extra information for debugging purposes.
-d {file}
Dumps load records from one or more files. If this option is used there is no output file.
-inf {file}
Prints file type information for one or more files. If this option is used there is no output file.

Output Format Selection:

.cmd
TRS-DOS program data.
.hex
Intel HEX record data.
.cas
Cassette format at input’s baud rate or 1500 if unspecified.
.tcas .250.cas
250 baud cassette Level I CLOAD data.
.lcas .500.cas
500 baud cassette SYSTEM data.
.hcas .1500.cas
1500 baud cassette SYSTEM data.
.wav
Cassette audio at input’s baud rate or 1500 if unspecified.
.250.wav
250 baud cassette SYSTEM audio.
.500.wav
500 baud cassette SYSTEM audio.
.1500.wav
1500 baud cassette Level I CLOAD audio.

Program Relocation:

The “-s” option detects relocation code and cassette loaders, runs them and puts the results into the output file. For example, many disk executables (.cmd) start with a short block of code that copies the entire program to a different spot in memory and jumps to it. Similarly, a few games had their own custom cassette loaders. The first program on the cassette was a short loader program that would load the rest of the tape in some custom format.

When “-s” detects these it runs them and puts their results in the output file. In fact, it works by running the program for a few thousand steps to see if the program ends up jumping into a place where it wrote data. With a few little tricks to distinguish between a bulk copy operation and run-of-the-mill self-modifying code.

This is mostly useful when disassembling programs. By detecting these loads and relocations you get a proper disassembly of the game itself rather than one where most of the absolute addresses are offset or where there’s no game code at all but just a cassette loader.

The number given to “-s” indicates the number of times it will look for these. For example, “Time Trek” for Level 2 BASIC starts with a small loader program which auto-runs, copies itself to lower memory, loads the game from cassette and jumps to it. With “-s 1” the output will be the loader before relocation. With “-s 2” the output will be the relocated loader. With “-s 3” (or “-s 0”) the output is the game itself.

Input and output files can be named “.rom” indicating they are binary dumps starting at address 0. Thus trld can convert a “.rom” file into the various output formats and also convert the various input formats into a “.rom” file. For “.rom” output the file is padded with zeros for any areas of memory not loaded into by the source file.

Recommendation:

You can use trld to remove LMOFFSETed code by entering:

trld -s 2 rand-lmoffset.cmd rand.cmd


Compilers/Decompilers (for Windows Only)

Utility Name
Date
Author
Home Site
September 2021
George Phillips

ZMAC is a Z-80 macro cross-assembler. It assembles the specified input file (with a ‘.z’ extension if there is no pre-existing extension and the file as given doesn’t exist) and produces program output in many different formats. It also produces a nicely-formatted listing of the machine code and cycle counts alongside the source in a “.lst” file. ZMAC strives to be a powerful assembler with expressions familiar to C programmers while providing good backward compatibility with original assemblers such as Edtasm, MRAS and Macro-80.


Features Include:

  • Cycle-counting with sett, setocf pseudo-ops and t, tilo, tihi and ocf operators.
  • Flexible label format and new pseudo-ops making it compatible with MRAS and MACRO-80.
  • Outputs .hex, .cmd, .cas, .wav, .rel, .cim and .ams files.
  • $ and 0x prefixes for hex constants.
  • 8080 mnemonics supported.
  • Undocumented Z-80 instructions
    • sl1 r
    • in (c)
    • out (c),0
    • bit/set/res n,(ix+d),r
    • rlc/rrc/rl/rr/sla/sl1/sra/srl (iy+d),r
    • inc/dec/add/adc/sub/sbc/and/xor/or/cp ixylh
    • ld a/b/c/d/e,ixylh
    • ld ixylh,a/b/c/d/e
    • pfix
    • pfiy)
  • JR promotion.
  • Full C expressions and parenthesis allowed.
  • Include data files directly (incbin).
  • 32 bit constants (defd).
  • -I to specify include directories.
  • rept, irp and irpc in-line macros.
  • Ever improving compatibility with MAC, MACRO-80 and MRAS.

Utility Name
Date
Author
Home Site
April 25, 2013
Matthew Reed

Z80Asm assembles TRS-80 assembly language programs and creates /CMD files that will run on a real or emulated TRS-80, but it runs on the command line of your Windows PC. That means you can use your favorite Windows text editor to create and edit your assembly language source files and that your source files will be stored on your Windows hard drive (and can easily be backed up onto CD’s, DVD’s, thumb drives, and so on). Z80Asm is the modern, easy way to do assembly language development for your TRS-80 Models I, III, and 4.

The unregistered version has the following restrictions:

  • Generates only CMD files, not HEX, core image, or COM files
  • Does not generate an equate listing
  • Does not allow reading from or writing to TRS-80 virtual disk files

Visit the official Z80Asm Page for registration information.


Utility Name
Date
Author
Home Site

DASM80 is a freeware command-line Z80 disassembler for Windows. It is a symbolic labeling disassembler that supports all Z80 instructions and can read either TRS-80 CMD files or Intel HEX files. It supports using screening files, EQUate files, and MAP files as options.


Utility Name
Date
Author
Home Site
March 24, 2010
Matthew Reed

Z80Disasm is a freeware command-line Z80 disassembler for Windows. It is a symbolic labeling disassembler that supports all Z80 instructions and can read either TRS-80 CMD files or Intel HEX files.


TRS-80 BASIC Converters (MSDOS Only)

Utility Name
Date
Author

Apr 25, 1998
Dave McCoy (v2.0)
Bruce Goldman (v3.0)

IBM DOS program to reformat TRS-80 Basic Code.

3 thoughts to “TRS-80 Miscellaneous Utilities”

  1. copying an OS install onto anethor computer will probably not work as there will be too many differences in terms or hardware, but if you want to try this use an application such as norton ghost, setup the hard drive as a slave boot from the norton cd and ghost the old hard drive onto the new put into your new computer and see what happens, if it fails to boot try running a repair from the windows cd over the installation. –

  2. George, THANKS for the BASLIST.EXE it works well on Linux running DOSBox
    to convert some Tokenized Files to ASCII.

    Larry

Leave a Reply to Darin Walker Cancel reply

Your email address will not be published. Required fields are marked *