Learning Assembly Language on the TRS-80/Tandy Color Computer - AI in VS Code, Program 4

Introduction

I continued my learning with Program 4 from the Inman book...

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

Printing out the book

To make working through this book easier and more enjoyable, I printed out the full PDF on letter size paper, double-sided.  I three-hole punched it and put it into a binder.  This gives me a larger print version than the original paper book and the binder lets me keep the book open to the page I'm working on and easily refer to it while I'm typing in a listing on my computer.

Using the PDF on a second monitor in portrait orientation would also work well, but I don't have a second display with my iMac just yet.

Coding with VS Code

I hope sharing my code listings here will help remove some of the barriers for other aspiring CoCo assembly programmers to work through this book.  You should be able to simply copy-paste the code listings into your VS Code editor and save the time of typing it all in, if that would hold some of you back.  That being said, I do find typing in the listings forces me to pour over the code and think about what each line does.  I want to add useful comments to most lines of code and to do that I need to know what the line does and its purpose.  VS Code has AI abilities that predict what the next line or even bunch of lines of code are going to be and also puts in a code comment for you.  This is an awesome feature!  Yes, sometimes it guesses wrong, but often it's exactly correct which still amazes me.  This feature alone has convinced me that I'm not going back to Notepad++ as my code editor, even on my PC where I've used it for years.

Old Editor/Assembler Tools Contrast

Chapter 4 begins with an introduction to a different editor and assembler than the first 3 chapters used -- SDS80C (Software Development System) from The Micro Works.  I’m not using any of these old editor/assembler tools, so I just skimmed that first section for interest sake only.

It was a nice reminder of how much easier it is to write and debug code with our newer tools!

I just wrote the Invert program (Program 4) using VS Code, assembled in lwasm and tested it in MAME.

Program 4 - Invert

This program starts at memory location $0767 in the book, but I chose to start my version at $0E00 instead.  I later came back and tested with ORG $0767 instead, and that seemed to work fine as well in my MAME setup.

;********************************************
;* Assembly Language Graphics for the TRS-80 Color Computer *
;* by Don and Kurt Inman, 1983 *
;* Program 4 - INVERT. *
;* 6809 assembly language for Tandy CoCo *
;* David Kroeker, 06-Dec-2025 *
;* Invert all characters on the screen. *
;********************************************


ORG $0E00
Start LDX #$400 ; Load screen address into index register X
Loop LDA ,X ; Load character from screen into A
EORA #$40 ; Invert colour
STA ,X+ ; Save inverted character back to screen, move to next character
CMPX #$600 ; Are we at end of screen?
BLO Loop ; Repeat for entire screen

#SWI ; Software interrupt to call ABUG, but we are not using ABUG, so I commented this line out.

BRA Start ; Do it again
END Start

Graphics programs are coming up next!
David
14-Dec-2025

Comments