Updated on 1/5/2018 with more details on getting the XRoar emulator going (ROMs, xroar.conf file).
In 1980, programming on a then-new Radio Shack TRS-80 Color Computer (“CoCo”) initially meant using Microsoft COLOR BASIC 1.0 with a glorious 4K of memory.
More advanced programmers might have chosen to learn 6809 assembly language. With a CoCo expanded to 16K of RAM, the EDTASM+ cartridge could be used to compile assembly language in to binary executables.
In both cases, development was self-hosted. You wrote the code on the actual system that would run the code. You would save your program off to tape or disk on the same system. Everything was done locally.
Even if you no longer have (or never had) a CoCo, you can do this today via emulators such as XRoar (a Dragon/CoCo 1/2 emulator), MAME (formerly MESS) or VCC. You can even play with CoCo coding from a web browser using the JS Mocha CoCo emulator.
If you want to do something a bit more substantial than Hello World, you can take advantage of the speed, power, and storage of your modern Mac OS X, Linux or Windows computer. With some free tools, you can write code on your PC and then run it on a CoCo emulator (or real hardware).
This article series will describe some simple ways to write BASIC or assembly language code on a modern computer and run it on a CoCo (virtual or otherwise).
The Virtual CoCo
Regardless of how you choose to develop, you will need a target system to run your code on. I have chosen to use the XRoar emulator. It is simple, free, and available for Mac OS X, Windows and Linux:
I like XRoar because it is very easy to set up. On Windows, you can basically have a folder that contains the xroar.exe executable and some .rom files and be set. Here are links to the needed ROM files:
For the Mac, the process is similar, except the ROMs go in ~/Library/XRoar/roms/ (which is a directory in your Mac home folder). For Linux and more details, please see the xroar.pdf manual or the XRoar website manual.
You can also make a text file called “xroar.conf” and put in a few defaults so you don’t have to change menu options every time you run. Here is the one I use:
default-machine cocous kbd-translate disk-write-back
Save that file (as “xroar.conf” in to the same folder where XRoar and the ROMs are. Now when you start up, it will default to a US CoCo 2, with keyboard translation on (so the PC keyboard maps to the CoCo keys), and write-enabled on any virtual floppy disks you might mount. (This is much easier than having to select all these things from the pulldown menus each time you boot.)
You will notice that I chose to include the DISK BASIC ROM (disk11.rom). Since we are dealing with a virtual CoCo, we might as well use a virtual disk drive, too.
We could have gotten by with just COLOR BASIC (bas13.rom) and used a virtual cassette, but, disk or no disk, we really want to add EXTENDED COLOR BASIC (extbas11.rom). It adds more commands, such as high resolution graphics.
Doing without disk might be your only option if developing on real hardware and you don’t have an old floppy drive or new CoCoSDC (floppy/hard drive to SD card) interface.
Once you get XRoar running, you can try your very first cross development with a simple BASIC program.
Hello, Cross-Hosted World!
One of the nice features of XRoar is its support for loading in a text file as if it were saved to tape in ASCII. This means that, instead of dealing with virtual cassette or disk images and utilites to copy files to and from them, all you have to do is type up a BASIC program as a text file and then use XRoar’s load command to attach it. Then, typing “CLOAD” (cassette load) will load it in as if from tape.
Create a plain text file (using Notepad or similar raw-text editor) that looks like this:
10 PRINT "PROGRAMMING IS FUN!"
MAKE SURE YOU HAVE A CARRIAGE RETURN AFTER THE LAST LINE, or the program won’t load!
Save that file with an extension of “.asc” (for ASCII). That is the extension XRoar uses to recognize a text file as a program saved in ASCII.
From XRoar, booted to BASIC, select “File -> Load” and browse to your saved file (“helloworld.asc”, or whatever you called it).
Nothing will happen, yet. XRoar now has that text file ready to be loaded in to memory by BASIC. We do this with the cassette load command “CLOAD”:
XRoar will quickly go through the cassette load sequence, showing in the top left corner of the screen that it is “S”earching for a file, then “F”inding it by name. When loading text files this way, they show up as if they were a named “BASIC”.
You can then LIST the newly loaded text file, and/or RUN it.
Keep in mind, as CLOAD loads, it reads the ASCII file and processes it as if you were typing in the program. While it will gladly load lines with typos, like:
10 PRUNT "SPELLING IS HARD!"
…you won’t know about the error until you try to run it and receive a Syntax Error (?SN ERROR IN 10).
Also, if it doesn’t see a line number, you will see the Direct Statement in File error (?DS ERROR):
10 PRINT "PROGRAMMING IS FUN!" I FORGOT A LINE NUMBER HERE 30 GOTO 10
Congratulations! You have now used 21st century technology to write a program for a 20th century computer.
The advantage of this approach is you get to use a modern full screen editor to write BASIC, and don’t have to deal with cassettes or floppy disks for storage.
The downside is you no longer have any BASIC typo checking. BASIC has certain limits to line length, for instance (I think it is 250 characters), so you could have a line too long in the text file and it would not be processed, while if you were typing on the CoCo, the editor would halt when that limit was reached and prevent you from typing any more. You also lose the ability to RENUMber your program if needed, so there may be cases where you want to do some work on the CoCo (renumbering, quickly fixing a small error, etc.) and get that program back to your development computer.
In upcoming installments, we will look at how to move files in both directions, as well as how to start cross-compiling 6809 assembly.
Be sure to check out my site, www.SubEthaSoftware.com, for other rambling multi-part articles, including:
…or wait until I have those all finished, and rewrite more concise versions here.