now my code looks like this
processor f8
org $800
;------------;
; BIOS Calls ;
;------------;
clrscrn = $00d0 ; uses r31
delay = $008f ; parameter in r5, uses r6
pushk = $0107 ; uses r7, allows more subroutine stack space
popk = $011e ; uses r7
game_size = 32
CartridgeStart:
.byte $55, $FB
clr
outs 0
outs 1
outs 4
; ins 5
; ni %11000000 ; Keep audio bits as is (no click)
outs 5
CartridgeEntry:
dci colordata
lm
xdc ; Store data counter for color in DC1
clearagain:
lr 3, A
pi clrscrn
dci sample_buffer ; set data pointer to buffer
clr
com
lr 0, A ;output_state = 0
outer_loop:
clr ; 1 cycle
am ; 2.5 cycles
bz end_sample
lr 1, A ; 1 cycle Sample counter stores data
lr A, 0 ; 1 cycle Fetch output state
com ; 1 cycle Invert output state
; ni %11000000 ; 2.5 cycles Only keep the two sound bits
lr 0, A ; 1 cycle Store for next data invert
outs 5 ; 4 cycles Put output state on port
lr A, 1 ; 1c
outs 1 ; 2c Color
outs 4 ; 4c Column
li %11100001 ; Set top two bits to 1
ns 0 ; And with r0 to set any 0 in top two
outs 5 ; 4c Row
lis 6 ; 1c
sl 4 ; 1c
outs 0 ; 2c
sl 1 ; 1c
outs 0 ; 2c
inner_loop:
; nop ; 1 cycle
; nop ; 1 cycle
nop ; 1 cycle
nop ; 1 cycle
nop ; 1 cycle
nop ; 1 cycle
ds 1 ; 1.5 cycles Decrease sample counter
bnz inner_loop ; 3.5 cycles branch, 3 cycles no branch
br outer_loop ; 3.5 cycles
end_sample:
li %00000000
outs 5
xdc ; back to color
clr
am ; Add ram data to set flags
xdc ; Change back
bnz clearagain ; Restart if not 0
br CartridgeEntry ; Start over
colordata:
.byte $d6 ; grey
.byte $c0 ; green
.byte $21 ; b/w
.byte $93 ; blue
.byte 0
.byte 0
; jmp CartridgeEntry
sample_buffer:
.byte $12,$02,$02,$07,$08,$03,$03,$02,$02,$07,$02,$03,$03,$03,$03,$03
.byte $03,$0C,$02,$03,$02,$03,$03,$03,$02,$03,$0D,$02,$03,$03,$01,$0C
.byte $07,$02,$03,$03,$02,$04,$02,$03,$04,$02,$03,$01,$06,$02,$03,$02
.byte $03,$03,$02,$03,$0A,$06,$09,$02,$01,$05,$08,$02,$0A,$03,$04,$04
.byte $08,$03,$02,$02,$01,$06,$06,$04,$02,$03,$02,$04,$02,$03,$02,$03
.byte $02,$03,$02,$0B,$02,$0A,$03,$07,$01,$08,$08,$07,$05,$09,$02,$07
.byte $07,$03,$03,$0A,$03,$0C,$04,$02,$15,$04,$04,$02,$03,$03,$01,$06
.byte $03,$0A,$04,$03,$09,$03,$0A,$04,$04,$07,$02,$03,$03,$09,$08,$07
.byte $01,$07,$02,$02,$01,$09,$04,$02,$03,$03,$03,$01,$0C,$04,$02,$04
.byte $02,$02,$05,$0C,$03,$03,$01,$03,$07,$02,$08,$01,$06,$03,$02,$1A
.byte $02,$03,$06,$03,$02,$01,$05,$08,$02,$04,$02,$03,$05,$04,$03,$05
.byte $03,$02,$03,$01,$03,$02,$02,$02,$07,$03,$02,$01,$02,$03,$03,$01
.byte $03,$04,$08,$03,$02,$05,$03,$02,$08,$04,$04,$04,$02,$03,$11,$03
.byte $6B,$CA,$C8,$CA,$D2,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
.byte 0
;===========================================================================
; Signature
;===========================================================================
; signature
org [$800 + [game_size * $400] -$10]
;signature:
.byte "- e5frog - 2020 "
is this good enough or am i missing something