ganley.org -> Software by Joe Ganley -> TRS-80 Emulator Applet

TRS-80 Model 1 BASIC Interpreter

by Joe Ganley

The applet above is an interpreter for TRS-80 Model 1 Level 2 BASIC. Note that it is a BASIC interpreter, not a TRS-80 emulator; thus, the hardware-specific commands (PEEK, POKE, etc.) do not work (they parse, but have no effect).

The interpreter is incomplete; I started writing it to learn Java, but I soon reached a point where further development would not have taught me anything further about Java, and more pressing tasks called. Aside from the hardware-specific commands, the following commands and functions are not yet implemented: the error codes within error handling (ERR), user input (INPUT and INKEY$), some development commands (AUTO and EDIT), CLOAD and CSAVE, arrays (DIM), and formatted output (PRINT USING). Other than these commands, this is a complete and faithful interpreter of the entire TRS-80 Model 1 Level 2 BASIC language.

In addition, the worst bug is that the screen does not update while a program is running, due to the way repaint calls are queued and executed during otherwise-idle time.

The choice to write a BASIC interpreter rather than a Z-80 emulator was made for a number of reasons. For example, it is unclear (to me, anyway) whether the current copyright situation on the TRS-80 BASIC ROM, which would be necessary in order to faithfully emulate the machine, will allow it to be distributed over the web. However, the bottom line is that I was more interested in writing a BASIC interpreter than a Z-80 emulator. Probably an emulator would be more useful (if either can really be called "useful"), but anyway...


Source code: trs80.tar.

Warning: This was the first major program I wrote in Java, so in many places the code isn't pretty.


"TRS-80" is a trademark of the Tandy Corporation.