Created Variables in ZeroPage to reference addresses
This commit is contained in:
parent
01943c4c8c
commit
48a2749fd7
58
main.s
58
main.s
@ -11,6 +11,11 @@
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
.segment "ZEROPAGE"
|
||||
InNum: .res 1
|
||||
BCD: .res 2
|
||||
TMP: .res 1
|
||||
NUM: .res 1
|
||||
.segment "CHARS"
|
||||
.incbin "./CHR-ROM.bin"
|
||||
|
||||
@ -20,21 +25,21 @@ 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
|
||||
sta BCD
|
||||
sta BCD+1
|
||||
ldx #8
|
||||
dabble:
|
||||
; check first digit
|
||||
lda $01
|
||||
lda BCD
|
||||
and #$F
|
||||
jsr check
|
||||
sta $03
|
||||
sta TMP
|
||||
lda #$F0
|
||||
and $01
|
||||
ora $03
|
||||
sta $01
|
||||
and BCD
|
||||
ora TMP
|
||||
sta BCD
|
||||
; check second digit
|
||||
lda $01
|
||||
lda BCD
|
||||
and #$F0
|
||||
lsr
|
||||
lsr
|
||||
@ -45,26 +50,25 @@ dabble:
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta $03
|
||||
sta TMP
|
||||
lda #$F
|
||||
and $01
|
||||
ora $03
|
||||
sta $01
|
||||
and BCD
|
||||
ora TMP
|
||||
sta BCD
|
||||
; check third digit
|
||||
lda $02
|
||||
lda BCD+1
|
||||
and #$F
|
||||
jsr check
|
||||
sta $03
|
||||
sta TMP
|
||||
lda #$F0
|
||||
and $02
|
||||
ora $03
|
||||
sta $02
|
||||
and BCD+1
|
||||
ora TMP
|
||||
sta BCD+1
|
||||
; Shift
|
||||
clc
|
||||
rol $00
|
||||
rol $01
|
||||
rol $02
|
||||
lda $00
|
||||
rol InNum
|
||||
rol BCD
|
||||
rol BCD+1
|
||||
dex
|
||||
bne dabble
|
||||
rts
|
||||
@ -129,22 +133,22 @@ forever:
|
||||
jmp forever
|
||||
|
||||
nmi:
|
||||
inc $05
|
||||
lda $05
|
||||
sta $00
|
||||
inc NUM
|
||||
lda NUM
|
||||
sta InNum
|
||||
jsr double_dabble
|
||||
lda $2002
|
||||
lda #$20
|
||||
sta $2006
|
||||
lda #$20
|
||||
sta $2006
|
||||
lda $02
|
||||
lda BCD+1
|
||||
and #$F
|
||||
cmp #0
|
||||
bne :+
|
||||
lda #10
|
||||
: sta $2007
|
||||
lda $01
|
||||
lda BCD
|
||||
and #$F0
|
||||
lsr
|
||||
lsr
|
||||
@ -154,7 +158,7 @@ nmi:
|
||||
bne :+
|
||||
lda #10
|
||||
: sta $2007
|
||||
lda $01
|
||||
lda BCD
|
||||
and #$F
|
||||
cmp #0
|
||||
bne :+
|
||||
|
Loading…
Reference in New Issue
Block a user