TRS-80 File Format Converters
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.
Output Format Selection:
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.
You can use trld to remove LMOFFSETed code by entering:
trld -s 2 rand-lmoffset.cmd rand.cmd
Compilers/Decompilers (for Windows Only)
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.
- 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
- 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.
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.
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.
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)
Bruce Goldman (v3.0)
IBM DOS program to reformat TRS-80 Basic Code.