Theo Verelst TRS-80 Retro Page

It seems a bit rediculuos, or at least a bit overly retro to care too much about microprocessor systems that were marketed 15 years ago. On second look, the simple conclusion is that modern programmers can learn quite a lot from the efficiency, clairity and to the pointness of these systems. And, 'modern' microcontrollers like the 8051 are not that much more advanced than the Z80 used in the trs80, a chip you can now buy for 3$ or so in cmos version, running up to 40 MHz (!).

Check the bottom of the page, and find out that it is not at all that strange to develop z80 apps with this simulator and some of the widely available devtools.

Overview

Some self explanatory pictures. Everything seems to work fine, didn't how sensible Ldos actually was. In 48 KILO bytes of main memory...

Dos with an auto start file to install the virtual harddisk:

SCARFMAN: whoever thought packman was first?

A (for my norms in those days) basic oneliner:

One of the motivations: a macro assembler development (no 2K limits, very to the point operation, C compiler exists, too):

Let's do business

I've collected my most relevant trs80 files in an zip archive , mainly because I'm often forced to change machines. In this archive all files are contained to have a completely functional Z80 development (assembler, that is) environment, a complete basic and LDOS simulation, and the means to inport and export (core and ascii) files from and to this system. I'm quite sure that some of the stuf in the archive at least had COPYRIGHT on them, but for the sake of development I'll assume that after 15 years nobody is going to have a real problem with that, but in case anybody does, please let me know, and I'l remove any such materials. The simulator has the original files (including credits and readme) with it. I'm not sure this archive will work on just any installation, but I moved it around and it seemed to be fine.

The system can simply be started by double clicking the trs.exe program, and at that point only needs the proper discs to be installed. The only thing realy needed is to install the system drive, which is called ld1-531.dsk, by pressing F-8, then 0 and typing this name followed by two returns. In fact, I've included the cnf file, so it should start with Ldos right away, fill in the date as mm-dd-yy, pass the clock by pressing enter, and it will autoboot with reading the time from dos and installing the harddisk with my files on it.

Some examples

From that point on, Ldos rules. Type 'basic' to redo the example graphically presented above. Pressing shift-F9 reboots the whole system (without the need for setting date or time), when something goes wrong.

To develop in Z80 assembly language, type 'edas' to load the assembler, load an example by typing l try2/asc:4. You can list the contents of the currently loaded assembly code by the p command. Use p# to print the first line, now use p to go over the source page wise. Assemble the code into memory by using a -im -we (including waiting for errors). Now start the program by typing a b followed by the entry address at the bottom of the assembler output.

The program should present the character set somewhere on top of the middle of the screen.

Assemble into a file by using a try2/cmd:4 to create a executable program. You may want to go back to LDOS by typing a b to try to run it by simply typing its name try2 if no other file like it exists somewhere on the file system.

Note that this has created a complete executable, and that it is perfectly possible to 'ORG' it at any address, including zero, and that a simple assembler directive can also produce a core image, i.e. strip off the LDOS executable file info to produce code that can immedeately be loaded in a RAM, ((E)EP)ROM or simulated core memory.

Source code examples

Inspect contains a hex conversion for the data from address 40003, as loaded in HL, and presents it on the right middle side of the screen. It can easily be made to efficiently show rows of hex values taken from consequtive memory locations:
;inspect.asm
	ORG	39000
ENTRY	LD	HL,40003
	LD	A,(HL)
	AND	0F0H
	SRA	A
	SRA	A
	SRA	A
	SRA	A
	CALL	TOASC
	LD	(15998),A
	LD	A,(HL)
	AND	0FH
	CALL	TOASC
	LD	(15999),A
	RET		;END OF PROG
TOASC	CP	10
	JP	M,TO9
	ADD	A,7
TO9	ADD	A,48
	RET
	END	ENTRY
Table is an example of having a fixed address table included in the program, with the purpose of letting it continue to live as semi shared memory, it remains resident as long as not overwritten when the program exists. Incidently, it is also not cleared when the program is loaded again, so LDOS may be used to call table to increment all values in the allotted table with one without destroying its contents. The code is also resident, and can be re-entered by simply calling 40000 (decimal).
;table.asm
	ORG	40000
ENTRY	JP	BEGIN
TABLE	DEFS	1024
BEGIN	LD	HL,TABLE
	LD	DE,1024
LOOP	INC	(HL)
	INC	HL
	DEC	DE
	XOR	A
	XOR	D
	XOR	E
	JP	NZ,LOOP
	LD	A,(TABLE)
	LD	(15997),A
	RET
	END	ENTRY
When the two programs are available for LDOS, call table first, followed by inspect to see the values increment for each new invokation of table.

Importing and exporting files from the emulated system

There are a set of files with names starting with a V that take care of this. First create a disk to use as IO disk, by formatting it. Than either use VWRITE to include files on it, or load it in the simulator, use the LDOS COPY command (obvious syntax) to put data on it, take it from the disk slot again, and use VREAD to extract the files to windows. When a disk is ejected from the trs80 slot, check its contents by VDIR.