Saturday, January 30, 2021

"Boot" From (V)HD in the trs80gp Emulator?

Recently I discovered a fantastic TRS-80 emulator from George and Peter Phillips. I've been playing with it, while trying my hand at BASIC after about, I dunno, 40ish years? Anyway, it's much easier to write code on an emulator - particularly since you can use a modern editor like Atom to work with longer code (i.e. anything over 10-20 lines), and then import the files directly into the emulator using Phillips' clever adaptation of the FreHD IMPORT/CMD and EXPORT/CMD utilities.

Initially, I ran into a blocker while using EnhancedCompiler BASIC from Misosys. It insists on compiling on the :0 drive, which is also the floppy boot drive by default. The compiler would fail because there was no space left on the diskette. Besides, who wants to compile on their boot root anyway? (by the way, I heard from another community member that this also happens with Misosys C compiler, so maybe it's a Misosys thing?)

Since I couldn't change the behavior of the compiler, I figured, with my modern ways of thinking, why not boot from a hard drive?

 What I learned from those much wiser, is that the older machines didn't have capability in the boot ROM to boot from hard disk because the boot sector would be a moving target. With a floppy, one can always count on the boot sector being at track 40. Makes sense, given the state of the tech at the time.

RSHARD to the Rescue

So, how do you boot from a hard disk image in trs80gp? As stated above, you do not. You can, however, make your hard drive the "system" disk. And, for the use case above, that's all I needed.

While searching for a solution I took a look at the user manual for the RSHARD hard disk driver package from Misosys (hosted at Tim Mann's fantastic site on all things Misosys). A section titled "Using the Hard Drive as a System Drive" caught my eye and it gave the exact steps I needed to make this happen. Let's step through the process:

First, grab the RSHARD driver from Tim Mann's site. I don't want to provide a direct link to the file because I haven't asked Tim for permission and I kind of want you to dig around and see all the other cool stuff he's got there. You can find it in the Operating System section a little more than half-way down. 

Extract the rshard.dsk image and remember where you put it.

First, start up trs80gp in Model III mode with the LDOS 5.31 floppy image in drive :0, the rshard.dsk image in drive :1 and an unformatted .hdv in hard drive :4 - you can do this via the graphical menu, or just run:

trs80gp -m3 -ld -d1 "path to the rshard.dsk" -h:hdv 

For example, I downloaded and extracted rshard.dsk to my c:\temp directory:

You'll be presented with a prompt to save the .hdv.  Any hard disk images loaded in the trs80gp emulator are saved to disk on the host. This is in contrast to floppy images, which are stored in memory and only (optionally) saved to disk on dismount.

At this point you have the basic ingredients. I have two floppies mounted (the LDOS boot disk and the RSHARD driver disk) and a hard drive that isn't yet usable by LDOS.

Let's simplify things and copy the driver and format utility from the RSHARD image to the boot floppy.

BACKUP RS$$$$5:1 :0

You can now eject the RSHARD image from the emulator. By the way, I realize there are other ways to move files between floppy images using TRSTools, IMPORT2, EXPORT2, etc. Doesn't matter how you do it, just make sure those files are available on the boot floppy before proceeding.

From here you'll need to invoke the driver to be able to access the hard disk. Loading the driver uses the format:


Where "d" is the logical drive number and "x" is the "RSHARD" driver for the corresponding LDOS version.

In this case, we'll use the following:


From this point the driver asks for some inputs before loading.

You can accept the default for most of these, and they are fully explained in the RSHARD documentation, but let's point out some key bits you will need to enter.

The number of tracks per surface is 153 for the blank image provided with trs80gp. Also, the number of heads is 2. We will just go ahead and use the entire disk instead of partitioning, so input 2 for the partition's heads and accept the default for 153 tracks/cylinders.

As you can see, the drive is not formatted, and that is the next step. The RSHARD package includes a format utility to make that easy. 


Answer some simple questions and you're ready to go.

You can avoid the name and password prompts by using:


with the values of your chosing.

Now we have a hard drive ready. Next the drive needs the system files. This is done by making a backup of the boot floppy to the hard drive.


Here's where you do the "magic" and make the hard drive the "system" drive. 


Notice that the drive numbers are now swapped. To make this a permanent swap, you need to SYSGEN the floppy.

Let's look at something first - run DEVICES to see how the drives are currently configured.

Notice that the hard drive is :0 and the boot floppy is :4. When you SYSGEN you will want to use :4 as the target.


You can do a warm restart (CTRL-ALT-F5) to test everything out. Run FREE to validate that the drives are arranged as desired.

All good! Something to understand about trs80gp is that hard drive changes are saved on write. But floppies are stored in RAM, so you will be prompted to save any changes to floppy if you close the emulator. This is good, since it allows you to save the new SYSGEN'd floppy and keep the original pristine.

Exiting the emulator you'll get a prompt like this:

I saved mine as devboot.dmk. 

Now, you have a hard drive with system files, and a modified boot floppy. Next time you start your emulator, just replace "-ld" with "-d0 <path to your boot floppy>"

In my case launching the emulator looks like this:

./trs80gp -m3 -d0 "Z:\classic computers\tandy\DMKs\Dev\devboot.dmk" -h "Z:\classic computers\tandy\HDVs\newdrive.hdv"

There you go, plenty of room on drive :0 for compiling my programs!

No comments:

Post a Comment