byte counter
This commit is contained in:
parent
c245c5848a
commit
01943c4c8c
165
main.s
165
main.s
@ -18,6 +18,56 @@
|
||||
|
||||
bg_pallets:
|
||||
.byte $0F, $30, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
||||
double_dabble:
|
||||
lda #0
|
||||
sta $01
|
||||
sta $02
|
||||
ldx #8
|
||||
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
|
||||
dex
|
||||
bne dabble
|
||||
rts
|
||||
|
||||
check:
|
||||
cmp #5
|
||||
@ -71,93 +121,46 @@ loop:
|
||||
bne loop
|
||||
lda #54
|
||||
sta $00
|
||||
lda #0
|
||||
sta $01
|
||||
sta $02
|
||||
ldx #8
|
||||
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
|
||||
dex
|
||||
bne dabble
|
||||
|
||||
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:
|
||||
inc $05
|
||||
lda $05
|
||||
sta $00
|
||||
jsr double_dabble
|
||||
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 #0
|
||||
sta $2005
|
||||
sta $2005
|
||||
rti
|
Loading…
Reference in New Issue
Block a user