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:
- 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.
- 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!
- 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.
Comments
Post a Comment