Learning Assembly Language on the TRS-80/Tandy Color Computer

Introduction

It's been a dream of mine to learn how to write assembly language programs ever since I bought my first computer back in about 1987 - a Tandy Color Computer 3 (CoCo3).  I learned how to write BASIC programs on that computer, working my way through the many example programs in the excellent user manual it came with.  But, I knew to really take advantage of the computer I'd need to learn to program in assembly language.  All of the best games on the CoCo3 were written in assembly language, which provided better speed, smoother scrolling, digital audio clips and more.  But, I really never had the resources back then to get started.  I didn't know anyone else who had learned this, didn't know what books to find or where to start research.  All I knew was that EDTASM+ was a well-known assembler cartridge, but that it was created for the earlier CoCo1 and CoCo2 models and thus didn't take advantage of any of the graphics improvements on the CoCo3.

A Modern Retro Development Environment

Today, nearly 40 (!) years later, there are so many more resources readily and freely available to help learn this skill.

There are instructions for setting up a development environment on a modern computer, making coding much easier and convenient than ever before:

Long Branch Never YouTube Channel - Setting up Your Development Environment

This video focuses on setting up a development environment on a Windows computer.  It uses Virtual Color Computer (VCC) as a CoCo emulator, lwasm as assembler, Notepad++ as a code editor and ToolShed for creating and manipulating virtual CoCo disk files.  Today, I'd recommend Visual Studio Code with Blair Leduc's 6x09 Assembly extension instead of Notepad++.

Long Branch Never is the YouTube channel of well-known CoCo programmer and hacker Paul Fiscarelli.  He has several followup videos showing how he uses this development environment to create some example assembly language programs using the CoCo text screen.  I found myself believing I was truly beginning to realize my dream as I followed these videos and experimented with altering the programs.  But, I found myself wanting more to build on this when I finished the content Paul shared.

I recently restored an older iMac, putting in an SSD and more RAM, and setup a development environment on it as well.  I could use many of the same tools as I was using on my Windows machine, I think even VCC can be installed on macOS or Linux, but I have not tried this yet.  I recently met Glen Hewlett, creator of several excellent arcade game transcodes for the CoCo3.  Glen encouraged me to continue my learning quest and shared his blog entry with me on his development environment on his Mac:

CoCo 6809 Assembly on a Modern Computer

Glen uses MAME as a CoCo emulator, which is available on either Windows, Mac or Linux.  He also uses lwasm for an assembler and Visual Studio Code with Blair Leduc's 6x09 Assembly extension.

Glen uses imgtool for working with virtual CoCo disk files, which is supposed to be included with MAME, but I had troubles getting it setup, so I chose to also use ToolShed here for this.

ToolShed and the lwasm assembler are available at lwtools.ca.

I now had a nice environment ready to write code!  But, what would I write?  I now have all 3 of the major models of CoCo represented in my collection, so I decided to not just concentrate on the CoCo3.  I wanted to start with learning to write assembly language that would work on the CoCo1, CoCo2 or CoCo3.  I chose this book and am working my way through it.

Assembly Language Graphics for the TRS-80 Color Computer - by Don Inman and Kurt Inman with Dymax

I quickly learned a few things as I worked on creating the first few programs:

  1. The book uses really old tools, like CBUG, so you'll need to adapt what you're reading to work in your new and much better coding environment.
  2. CBUG doesn't allow the use of labels for branches, but uses calculated memory offsets to determine where to branch to.  I wanted to use labels instead and converting a memory offset to a label was trickier than I expected.  I sometimes didn't understand the code enough at first to just quickly know where it was supposed to branch to.  Sometimes I put the destination label in the wrong place at first and ended up with a program that didn't work correctly.  Using a debugger in your CoCo emulator of choice is invaluable for figuring out these problems!
  3. The book was written before floppy disks became popular on the CoCo and so the first few programs are all written to start at address $700.  However, almost everyone uses a disk drive or disk emulator in their CoCo setup now.  This part of the address space is thus taken up with a floppy disk controller.  I had quite a bit of trouble with program #3 in the book because of this and needed Glen's help to figure out what was going on.
After my first attempt at writing program #1 from this book, I was discouraged, as I got no sound at all from my new code.  I needed to carefully review the code and make changes to resolve the above issues before I could finally hear the expected laser sounds.  You'll notice the date on the code listing below is more than 2 years before I wrote this blog post, so it took me a while to finally come back to this code and conquer it.  I hope to make using this book a bit easier for other aspiring assembly developers by sharing my updated versions of these programs that will work on modern assemblers and emulators.

Here's my version of program #1 from Assembly Language Graphics for the TRS-80 Color Computer (by Inman & Inman):
;********************************************
;* Assembly Language Graphics for the TRS-80 Color Computer *
;* by Don and Kurt Inman, 1983 *
;* Program 1 - repeating laser sound *
;* 6809 assembly language for Tandy CoCo *
;* David Kroeker, 24-Aug-2023 *
;* Plays laser sound. Reset to exit *
;********************************************

ORG $0E00 ; $700 is taken up by disk controllers, use $0E00 instead.

Start LDA #$3F ; Load $3F into register A
STA $FF23 ; Store register A in memory location $FF23. FF23 is associated with the output device used to send sound to the TV. The data sent to $FF23 turns on the audio of the TV.
LoopA TFR A,B ; Transfer register A to register B
LoopB STB $FF20 ; Store register B in memory location $FF20. FF20 controls the tone of the sound. The data in register B is the tone loaded.
NOP ; Do nothing
NOP ; Do nothing
NOP ; Do nothing
INCB ; Increment register B
BNE LoopB ; Branch to LoopB if B is not equal to 0 (repeat loopB until B is 0)
INCA ; Increment register A
BPL Repeat ; Branch to Repeat if A is positive (repeat until A is >=0)
CLRA ; Clear register A
Repeat BRA LoopA ; Always branch to LoopA

END Start

I hope I'll inspire a few other CoCo enthusiasts to join me on this learning quest and make their path just a bit easier with these blog posts!

Happy coding!
David
30-Nov-2025

Comments