* SPDX-License-Identifier: GPL-3.0-or-later * Original MC6809 diagnostic; LWASM DECB output. No CMOC or private ROM bytes. org $2000 start pshs cc,d,dp,x,y,u sts oldstack orcc #$50 lds #$0dff * GIME video/INIT registers are write-only on a standard CoCo. Start this * diagnostic from ordinary 32-column BASIC; return to that documented mode. ldx #$ffa2 ldu #oldmmu ldb #4 savem lda ,x+ sta ,u+ decb bne savem lda #2 ldx #$ffa2 mapram sta ,x+ inca cmpa #6 bne mapram lda #$4c * Native graphics, MMU, internal 32 KiB ROM sta $ff90 clr $ff9a clr $ff9c clr $ff9f lda #8 sta $ff9d clr $ff9e lda #$80 sta $ff98 lda #$1f * HRES7, CRES3 = 160 x 192, one byte/pixel sta $ff99 clr phase clr animate clr page clr lastkey jsr palette jsr draw keys jsr readkey * Direct matrix scan; no BASIC ROM hook dependency tsta beq release cmpa lastkey beq idle sta lastkey cmpa #'Q lbeq quit cmpa #'q lbeq quit cmpa #'A beq toggle cmpa #'a beq toggle cmpa #32 beq next idle tst animate beq keys ldx #2000 delay leax -1,x bne delay inc phase jsr palette bra keys release clr lastkey bra idle toggle com animate bra keys next inc page lda page cmpa #3 blo redraw clr page redraw jsr draw bra keys readkey lda #$fd * Column 1: A is row0, Q is row2 sta $ff02 lda $ff00 bita #4 bne checka lda #'Q rts checka bita #1 bne checks lda #'A rts checks lda #$7f * Column 7, row3: SPACE sta $ff02 lda $ff00 bita #8 bne nokey lda #32 rts nokey clra rts palette ldu #colours ldy #256 ldb phase pal lda ,u+ sta $ffb0 * Upper and lower six bits lda ,u+ ora #$80 * Preserve upper six bits, replace lower sta $ffb0 tst phase beq commit tstb beq skippal cmpb #255 beq skippal commit stb $ff7e * Index, not RGB data skippal incb leay -1,y bne pal rts draw ldx #$4000 ldu #banner rle ldb ,u+ beq body lda ,u+ run sta ,x+ decb bne run bra rle body lda page beq gallery cmpa #1 beq ramp ldy #160 stripe clra ldb #160 strpx eora #$ff sta ,x+ decb bne strpx leay -1,y bne stripe rts ramp ldy #160 clra ramprow ldb #160 ramppx sta ,x+ inca decb bne ramppx leay -1,y bne ramprow rts gallery clr rowbase lda #16 sta rows cellrow lda #10 sta lines gridrow lda rowbase ldb #16 cell ldu #10 cellpx sta ,x+ leau -1,u cmpu #0 * LEAU does not update Z on a 6809 bne cellpx inca decb bne cell dec lines bne gridrow lda rowbase adda #16 sta rowbase dec rows bne cellrow rts quit ldx #$ffa2 ldu #oldmmu ldb #4 restm lda ,u+ sta ,x+ decb bne restm lda #$cc * Standard BASIC text, internal 32 KiB ROM sta $ff90 ldx #$ff98 ldu #oldvideo ldb #8 restv lda ,u+ sta ,x+ decb bne restv lds oldstack lda #$ff sta $ff02 puls cc,d,dp,x,y,u,pc oldstack rmb 2 oldvideo fcb 0,0,0,0,$0f,$e0,0,0 oldmmu rmb 4 phase rmb 1 animate rmb 1 page rmb 1 rowbase rmb 1 rows rmb 1 lines rmb 1 lastkey rmb 1 include "generated.inc" end start