I implemented a Forth interpreter or the TRS-80 Color Computer (M6809) way back in the 1980s, and I've been trying to figure out how to get it loaded into an emulator to test some parts of the interpreter that I may not have gotten right.

(My old hardware lies across an ocean these days.)

I recently found the xRoar emulator,


which I was able to compile and get running, bringing it up to a BASIC prompt. I was even able to get the disk editor/assembler program I used to come up and show a prompt and take some basic instructions. (Tried to sign up for the forum, but got no answer.)

I can't figure out how to set the thing up so that, when it's running the editor/assembler, I can get it to read my source code. I also tried using a cross compiler mentioned on the xRoar pages to compile my source code, but I haven't yet figured out how to attach or load the binary output.

Clarification -- the source code files are text files that I extracted some twenty-four years ago. I do not have images of the disks in question, only the files. Which means, I think, that I need a tool to format a disk image and copy a text file into it, giving it a name and proper directory item allocation.

Further clarification -- I do not use MSWindows. But I do write code on occasion, so a description of the format might get me somewhere.

Or, it seems like I might be able to supply the text file as if it were a text file, but I was not able to get that to work.

Can anyone give me some pointers?

  • 2
    Unless your problem is that your source is on Color Computer format disks, then you probably want to copy your source code (or compiled binary) into a disk image and then mount that image in the emulator. See 6809.org.uk/xroar/doc/xroar.shtml#Files and trs-80.com/wordpress/dsk-and-dmk-image-utilities – Ross Ridge Jul 10 '17 at 2:54
  • I have reasons for not wanting to install Wine on this machine, but maybe I can install a DOS emulator to get those utilities to work. I've tried to use the functions for loading tape files, but this is assembler source, not BASIC. Anyway, they just throw errors. I'll have to see if there are some clues in the source. – Joel Rees Jul 11 '17 at 4:53

You can manage CoCo disk images quite easily with MAME's imgtool. I've assumed you want to use RS-DOS on a CoCo 2, launching xroar via:

xroar -default-machine coco2bus

To make a blank, single-sided disk image, enter

imgtool create coco_jvc_rsdos new.dsk

The file will be 161280 bytes long: 35 tracks × 9 sectors × 512 bytes per sector.

I'm assuming your assembler accepts ASCII in the same format that CoCo BASIC expects, with CR (0x0d / \r) as line endings. To convert a text file to this format:

tr '\n' '\r' < infile > OUT.TXT

To copy the file across to the image:

imgtool put coco_jvc_rsdos new.dsk OUT.TXT OUT.TXT --ftype=data --ascii=ascii

Similarly for an assembler file:

imgtool put coco_jvc_rsdos new.dsk TEST.ASM TEST.ASM --ftype=assembler --ascii=ascii

I'm not sure how much difference --ftype makes to the result, but --ascii clearly sets a text flag. You can copy a binary across with:

imgtool put coco_jvc_rsdos new.dsk RANDOM.BIN RANDOM.BIN --ftype=binary

To see what's on the disk image:

imgtool dir coco_jvc_rsdos new.dsk

Contents of new.dsk:
------------------------------ -------- --------------- ------------------
OUT.TXT                              43             0 A                   
TEST.ASM                            145             0 A                   
RANDOM.BIN                        17313             0 B                   
------------------------------ -------- --------------- ------------------
       3 File(s)           17501 bytes                          133632 bytes free

The image, when attached to xroar, seems to work as expected: CoCo disk contents in xroar

(If you wanted to use OS9, I hadn't tried that, but it looks like you can substitute coco_jvc_os9 for coco_jvc_rsdos in the imgtool command line. The NitrOS-9 community might be of more help.)

Some additional links that look as if they'd be useful in your quest for working binaries:

  • LWTOOLS — a set of cross-development tools for the Motorola 6809 and Hitachi 6309 microprocessors

  • ToolShed — another CoCo cross-development system which includes disk image management

  • CoCo (6809) Assembly on a modern computer — article on CoCo cross development on a Mac, debugging via MAME

  • Disk Basic Summary — just in case you've forgotten (or, as in my case, never knew) CoCo disk BASIC commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.