1
0
mirror of https://github.com/fumiama/c64-snake.git synced 2026-06-28 16:00:34 +08:00
This commit is contained in:
fumiama
2021-04-03 13:41:09 +08:00
parent 82e23f60a9
commit 6585c635d0
2 changed files with 16 additions and 14 deletions

View File

@@ -14,7 +14,7 @@ print16:
lda #0 lda #0
ldx #6 ldx #6
* sta _num_dec - 1, x * sta _num_dec, x
dex dex
bne - bne -
@@ -95,6 +95,7 @@ mod_1: ; 低字节低4位的值相当于个位加6十位加9百位加
bcc _skip bcc _skip
pha pha
lda #$10 ; 进位相当于100 lda #$10 ; 进位相当于100
clc
adc _num_dec + _1 - 1 adc _num_dec + _1 - 1
sta _num_dec + _1 - 1 sta _num_dec + _1 - 1
pla pla
@@ -129,39 +130,40 @@ _skip:
jsr mod_2 jsr mod_2
jsr mod_1 ; 此时结果中有些位可能大于10需要进行进位处理 jsr mod_1 ; 此时结果中有些位可能大于10需要进行进位处理
jsr chrin jsr chrin
ldx #6 ldx #5
_loop: _loop:
lda _num_dec - 1, x
ldy #0 ; y记录进位数 ldy #0 ; y记录进位数
lda _num_dec, x
cmp #10 cmp #10
bcc _skip ; 小于10不进位 bcc _skip ; 小于10不进位
jsr printbyte
pha pha
and #$f0 and #$f0
ror lsr
ror lsr
ror lsr
ror lsr
tay tay
pla pla
and #$0f and #$0f
adc _num_dec - 1, x jsr printbyte
sta _num_dec - 1, x adc _num_dec, x
sta _num_dec, x
jsr chrin
tya tya
dex
adc _num_dec - 1, x adc _num_dec - 1, x
sta _num_dec - 1, x sta _num_dec - 1, x
inx jsr chrin
_skip: _skip:
dex dex
bne _loop bne _loop
cld ; 退出bcd模式 cld ; 退出bcd模式
lda #$30 ; 转化为可显示字符
ldx #5 ldx #5
_up: _up:
adc _num_dec - 1, x lda _num_dec - 1, x
ora #$30 ; 转化为可显示字符
sta _num_dec - 1, x sta _num_dec - 1, x
jsr chrin
dex dex
bne _up bne _up

BIN
snake.prg

Binary file not shown.