output double-dabble result to screen

This commit is contained in:
Samuel Walker 2025-03-21 11:58:49 -06:00
parent f668e96974
commit c245c5848a
2 changed files with 74 additions and 5 deletions

Binary file not shown.

79
main.s
View File

@ -17,7 +17,7 @@
.segment "CODE"
bg_pallets:
.byte 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
.byte $0F, $30, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
check:
cmp #5
@ -28,7 +28,37 @@ skip:
rts
reset:
sei
cld
ldx #$40
stx $4017
ldx #$ff
txs
inx
stx $2000
stx $2001
stx $4010
vblankwait1:
bit $2002
bpl vblankwait1
clear_memory:
lda #$00
sta $0000, x
sta $0100, x
sta $0200, x
sta $0300, x
sta $0400, x
sta $0500, x
sta $0600, x
sta $0700, x
inx
bne clear_memory
ldx #0
vblankwait2:
bit $2002
bpl vblankwait2
main:
lda $2002
lda #$3F
sta $2006
lda #$00
@ -37,13 +67,14 @@ loop:
lda bg_pallets, x
sta $2007
inx
cpx #16
cpx #2
bne loop
lda #173
lda #54
sta $00
lda #0
sta $01
sta $02
ldx #8
dabble:
; check first digit
lda $01
@ -86,9 +117,47 @@ dabble:
rol $01
rol $02
lda $00
cmp #0
dex
bne dabble
rts
lda $2002
lda #$20
sta $2006
lda #$20
sta $2006
lda $02
and #$F
cmp #0
bne :+
lda #10
: sta $2007
lda $01
and #$F0
lsr
lsr
lsr
lsr
cmp #0
bne :+
lda #10
: sta $2007
lda $01
and #$F
cmp #0
bne :+
lda #10
: sta $2007
lda #%10000000
sta $2000
lda #%00001010
sta $2001
lda $2002
lda #0
sta $2005
sta $2005
forever:
jmp forever
nmi:
rti