7

I'm trying out TRS-80 model I/III emulators. I know there was Level 1 and Level 2. I think this refers both to the ROM and the BASIC on the model I. Level 2 ROMs were a common upgrade to the model I and I think were standard on the model III.

The information I can find for loading software from cassette tape on the Model 1 is to use the CLOAD command to load BASIC programs and the SYSTEM command to load machine code programs.

But the SYSTEM command is not recognized in Level 1. Does this mean there was no way to load machine code software and that you could only use BASIC software on an original Model 1 Level 1?

Or is there another way to load them that I haven't found?

2 Answers 2

13

It is possible to load and run machine language programs on a Level I TRS-80 Model I. This was done by various programs, including the monitor program T-BUG, the editor/assembler program EDTASM, and the subLOGIC T80-FS1 flight simulator:

T80-FS1 advertisement

The way to do this was with the CLOAD command, as explained in the T-BUG manual, the EDTASM manual, and the T80-FS1 manual. EDTASM had a special SYSTEM tape that, under Level I, was loaded first and then read in the editor/assembler tape (this preloader strategy was also used by T80-FS1).

How was this implemented? Looking at the disassembled Level I BASIC ROM, CLOAD simply loads a block of bytes into memory, starting and ending at specified addresses. Loading and running machine-language programs is then possible by reading a block of bytes which overwrites the return address which was stored on the stack (at address 41FE—see [1], [2], p. 9) when the cassette-loading routine was called, so that returning from the routine executes the just-loaded machine code.

4
  • 1
    Wow fascinating! Sounds partly like a disk boot block and partly like a dirty hack (-: Sep 19, 2022 at 5:58
  • 2
    Years ago, I was also playing with a TRS-80 Model I emulator: I managed to write a machine code program with a level-I TRS-80. The trick: The "Basic" program that I CSAVEd contained some bit pattern that was recognized by CLOAD as "start of the program"; the following characters in the "Basic" program represented machine code. When CLOADing the program, I did not wind the tape back to the start but to the time that represented the first Basic line... Sep 19, 2022 at 15:05
  • If memory serves, I think this was not only "possible", but was common for programs for the TRS-80 that loaded from tape.
    – Brian H
    Sep 19, 2022 at 18:10
  • 1
    For anyone looking to write Z-80 code for Level 1 machines, my version of the zmac assembler will output .250.cas and .250.wav files in the CLOAD machine language format. 48k.ca/zmac.html Sep 20, 2022 at 18:09
7

No, Level 1 BASIC is a Tiny-BASIC enhanced to support the block graphics and loading from/saving to tape. Tape support was rather limited, as programs were literally memory dumps, no management or further organization. It even seems as if the existing primitive functions for tape files have only been added as afterthought.

Unlike next to any Tiny BASIC, Level 1 BASIC does not feature functionality to interact with machine language, no PEEK, no POKE, not even a basic USR() function which was almost mandated by Tiny BASIC to extend it's usability. So even if there would have been some way to load a machine program, it would not have any means to execute it.

8
  • Would it be possible for a suitably-written pattern of bits on the tape to trick the BASIC interpreter into transferring control to the loaded memory image? For example, if the stack was placed at the top of memory, loading started at e.g. address 0x0400, and the desired entry point of 0x0505, could one write a tape image which, after the useful portion of the code, ends with a long enough sequence of "05" bytes to clobber the stack?
    – supercat
    Sep 19, 2022 at 20:42
  • @supercat exactly that is what David Moves Answer describes as being used for various tools and programs. The issue is that anything but BASIC (and data files) can not be produced with on board tools.
    – Raffzahn
    Sep 19, 2022 at 20:53
  • If one were to write a data record containing a bunch of bytes which didn't contain any bit sequence 1010, followed by a CHR$(165) and some data bytes, and started loading in the middle of that record, I would think the CHR$(165) and the bytes after it might be interpreted a data block header, which might be a means of creating a bootable tape from within BASIC.
    – supercat
    Sep 19, 2022 at 21:15
  • @supercat sure, but Level 1 BASIC does not have a CHR$ function - even less a way to write certain bit images.
    – Raffzahn
    Sep 19, 2022 at 21:43
  • By my quick reading of the loader code, if text is stored as ASCII, the sequence 3333J would be interpreted as an A5 start byte followed by a zero bit, and some other bit patterns could also be used to skew things by other numbers of bits. So starting loading in the middle of some suitably-crafted text might still be able to bootstrap a nicer tape-generation process.
    – supercat
    Sep 19, 2022 at 21:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .