6809 Assembly Language Part 4

So, as you might not know, I’ve been following along with a tutorials by George Janssen on YouTube. USER: GBJanssen 6809
Using his examples as a staring point, I’ve been getting my feet wet in coding for the COCO3.
For example:

;------------------------------------------------------------------
; Program name: HIRESTEST.ASM
; Author:  Pete Willard
; Date:   March 29, 2024
; Description: 	tests using the Color Computer 3
;------------------------------------------------------------------
; Register usage: 6809 (6309 HAS MORE REGISTERS)
; A - Accumulator
; B - Accumulator
; D - Accumulator (A&B)
; X - Index register
; Y - Index register
; U - Stack pointer
; S - Status register
; PC - Program counter
; DP - Direct Page register
;------------------------------------------------------------------
;------------------------------------------------------------------
; GENERAL CONSTANTS
;------------------------------------------------------------------
BS 	EQU	$08	;BACKSPACE
CR	EQU	$0D	;ENTER KEY
ESC	EQU	$1B	;ESCAPE CODE
LF	EQU	$0A	;LINE FEED
FORMF	EQU	$0C	;FORM FEED
SPACE	EQU	$20	;SPACE (BLANK)
NULL	EQU	$00	;NULL, END OF STRING INDICATOR
TRUE	EQU	$FF	;TRUE VALUE
FALSE	EQU	$00	;FALSE VALUE
BREAK	EQU	$03	;BREAK KEY

;------------------------------------------------------------------
; MACROS
;------------------------------------------------------------------
; 6309 has a `clrd` instruction, but it is not supported by the
; 6809 CPU.  This macro is used to clear the D register for the 6809
; COMMENT OUT AND UNCOMMENT AS NEEDED IF USING A 6309 OR 6809 CPU
;CLEARD	    MACRO	; Clears D Data Register
;            clra        ; by clearing the A register
;            clrb        ; then clearing the B register
;            ENDM
;-----------------------------------------------------------------
; ROM ROUTINES
;-----------------------------------------------------------------
GETCHR		equ	$A000		; GET 1 Char jsr[GETCHR]
GETLIN		equ	$A390		; GET A LINE - in BUFBEG
DELAY		equ	$A7D3		; DELAY ROUTINE
PUTCR		equ	$B958		; PUT A Carriage Return $0D
PUTSP		equ	$B9AC		; PUT A SPACE to screen
PUTLIN		equ	$B99C		; PUT A LINE	Msg in X-1
RGB_PAL		equ	$E5FA		; RGB Palette reset
CMP_PAL		equ	$E606		; CMP Palette reset
COL32		equ	$F652		; Switch to 32 char screen
COL40		equ	$F65C		; Switch to 40 char screen
COL80		equ	$F679		; Switch to 80 char screen
CLRHI		equ	$F6E0		; Clear Hi-Res "TEXT" Screen 
LOCATE		equ	$F8F3		; HI-Res locate cursor   A=COL B=ROW
SLOW		equ	$FFD8		; Clear cpu rate (0.89 MHz)
FAST		equ	$FFD9		; Set cpu rate (1.78 MHz)
;-----------------------------------------------------------------
SETUP:
    org $1000
START:
;-------------------------------------------------------------------
    	jsr RGB_PAL		; rgb palette reset
    	jsr COL40		; width 80
    	jsr CLRHI		; clear hires screen 
;-------------------------------------------------------------------
; setup complete
;-------------------------------------------------------------------
COLUMN		equ	7
ROW		equ	2
ROW_SPACE 	equ 	2

;------------------------------------------------------------------
MAIN:
;------------------------------------------------------------------
	lda #COLUMN 	; set column
	ldb #ROW	; set row
	jsr LOCATE	; set cursor
    	ldx #message1-1	; load message address
	jsr PUTLIN
DONE: 
	rts		; back to basic 
message1:
	fcn "abcdefghijklmnopqrstuvwxyz"
messsage2:
	fcn "abcdefghijklmnopqrstuvwxyz"
    end START

Next, using the following commands, I can test things out with XROAR emulator.

lwasm -9bl -o test1.bin test1.asm
decb copy -2 test1.bin hires.dsk,TEST1.BIN -r
xroar.exe -machine coco3 -tv-input rgb -machine-cpu 6809 -kbd-translate

and then loading the “hires.dsk” into XROAR and using ‘LOADM “TEST1.BIN”‘ to run it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.