TRS-80 Model I/III/4 software archeology

This file describes a number of file formats used for the Tandy Radio Shack TRS-80 line of computers. The intention is to make files stored in archives more accessible outside the realm of emulators or the real hardware. Whenever possible scripts are included to convert to ASCII or plain binary format, usable for disassemblers.

Tokenized BASIC files

A BASIC file consists if an one byte header, line data and a one byte terminator. Lines consists of a two byte line-address, a two byte line number and a list of tokens and ASCII characters. Lines are terminated by a NULL byte.

header:
  0xFF

per line:
  <AddrLSB> <AddMSBr> <lineNoLSB> <lineNoMSB> <lineChar> [<lineChar>] .... 0x00
    (A line consists of ASCII (0x20 - 0x7E) and tokens (0x80 - 0xFF)

end:
  0x0A 
 

The python script: basicTokenDecode.py, the token table from fileformats.archiveteam.org. The script may be usable for other tokenized BASIC dialects.

Radio Shack Editor/Assembler files

This assembler file format is also described at www.trs-80.com.

per line:
	five bytes for the line number, one decimal digit per byte in the lower nibble. 
	  the upper nibble has the pattern 1011b. Most significant digit first.
	.... ASCII characters
	0x0D or carriage return
	
end of file:
	0x1F or Ctrl-Z
 

The python script: edtasmDecode.py

?? Assembler files

This assembler file is created by a yet unknown assembler.

header:
	'-c' or 0x2D 0x63

per line:
	<lsn> byte
	<msn> byte
	<linelen> byte
	.... ASCII characters
	
end of file:
	0xFF 0xFF
 

The python script: asmDecode.py

CMD file format

This format is described in some Radio Shack and Misosys documentation and also here: Model 4 Serial Loader. A typical file contains one or more 01 records and one final 02 record. There is a record type 05 for the program name, so probably also a 03 and 04. As long as all use a single byte length directly following the first record type byte, all applications can parse the files.

The format is called "TRS-DOS Load Module Format" (LMF), and is a binary format. This file format with all its record types is also described at www.trs-80.com, Jim's Place and LDOSQ1-4.PDF. It is used for programs (/CMD) in TRSDOS and all compatible DOSses.

01 record (for data transfer):
  01LLAAAANNNNNNNN...NN
  | | |   |
  | | |   data bytes
  | | two address bytes (lsb first)
  | length byte, (2 address bytes + the number of data bytes).
  |  the values 0, 1 and 2 are interpreted as (0, 1 or 2) + 256
  record type

02 record (for control transfer):
  02AAAA
  | | 
  | |    end of line characters
  | two address bytes (lsb first)
  record type
  
05 program name:
 05LLNNNN....
 | | |
 | | program name in ASCII
 | name length
 record type
 

ToDo: debug the Python script. (Incomplete testing version)


Last update: 2025-05-06

email: fjkraan@electrickery.nl

Valid HTML 4.01 Transitional