TRS-80 Text Adventures

The page contains notes gathered while expanding my text-adventure system to export for the TRS-80 line of computers. The games consist of a shell which is supplemented with program generated code to store the game's data tables. As you can see, it works!

Tools
Notepad++ for writing code
Z80Asm for assembling code
MAME and trs80l2.rom ROM for testing/debugging
TRS-32 for more testing
An actual TRS-80 Model 1!
TRS-Toolsfor attaching the cmd file to a disk image
A FreHD for deploying files to the TRS-80 via SD Cards

CMD File Header/Program Origin
Assemblers needs an ORG directive set the set address for the code. You can use TRS-Tools to open up cmd files on the disk images to see what addresses they start at. In my case, I set the ORG to 5200H. Most programs seemed to use this.
The START and END address shown in the TRS-Tools menu should be the same.

A major reason to use Z80Asm is because it can generate the cmd header for you.

Debugging in MAME
Run Z80Asm -nh main.asm. Then use the "Quickload" menu option and pick the command file.
I couldn't figure out how to use MAME to emulate a TRS-80 disk system.


Major Hurdle
It turns out you can't use the BASIC OUTLIN and READKB routines when running on a DISK based system. You have to implement your own using CRTBYTE and KEYIN. This isn't hard, but figuring this out was a pain because I had no debugger for a disk system.

Resources
Earles L. McCaul - TRS-80 Assembly Language Made Easy (Book)
Rodnay Zaks - Programming the Z80 (Book)
TRS-80 CMD File header info
LDOS OS Calls