bcd conversion

This commit is contained in:
Samuel Walker 2025-03-20 19:39:06 -06:00
parent 5278f39516
commit bd9edb1309
Signed by: piwalker
GPG Key ID: 616B1928705EA4C9

71
main.s
View File

@ -5,7 +5,7 @@
.byte $01, $00 ; mapper 0, vertical mirroring .byte $01, $00 ; mapper 0, vertical mirroring
.segment "VECTORS" .segment "VECTORS"
.addr 0 ; nmi interrupt .addr nmi ; nmi interrupt
.addr reset ; reset interrupt .addr reset ; reset interrupt
.addr 0 ; external interrupt .addr 0 ; external interrupt
@ -13,12 +13,65 @@
.segment "CODE" .segment "CODE"
reset: check:
ldx #3 cmp #5
inx bcc skip
inx clc
dex adc #3
skip:
rts
ldy #7 reset:
dey lda #173
rts sta $00
lda #0
sta $01
sta $02
dabble:
; check first digit
lda $01
and #$F
jsr check
sta $03
lda #$F0
and $01
ora $03
sta $01
; check second digit
lda $01
and #$F0
lsr
lsr
lsr
lsr
jsr check
asl
asl
asl
asl
sta $03
lda #$F
and $01
ora $03
sta $01
; check third digit
lda $02
and #$F
jsr check
sta $03
lda #$F0
and $02
ora $03
sta $02
; Shift
clc
rol $00
rol $01
rol $02
lda $00
cmp #0
bne dabble
rts
nmi:
rti