1
0
mirror of https://github.com/fumiama/c64-snake.git synced 2026-06-11 05:30:25 +08:00

分数打印完成

This commit is contained in:
fumiama
2021-04-03 14:29:01 +08:00
parent 6585c635d0
commit caaead7be0
3 changed files with 9 additions and 16 deletions

View File

@@ -30,9 +30,9 @@ main:
.macro init .macro init
lda #147 ;清屏 lda #147 ;清屏
jsr chrout jsr chrout
lda #$cd lda #$ff
sta s sta s
lda #$ab lda #$ff
sta s + 1 sta s + 1
jsr printscore jsr printscore
.macend .macend

View File

@@ -14,7 +14,7 @@ print16:
lda #0 lda #0
ldx #6 ldx #6
* sta _num_dec, x * sta _num_dec-1, x
dex dex
bne - bne -
@@ -129,31 +129,24 @@ _skip:
jsr mod_3 jsr mod_3
jsr mod_2 jsr mod_2
jsr mod_1 ; 此时结果中有些位可能大于10需要进行进位处理 jsr mod_1 ; 此时结果中有些位可能大于10需要进行进位处理
jsr chrin
ldx #5 ldx #5
_loop: _loop:
ldy #0 ; y记录进位数 ldy #0 ; y记录进位数
lda _num_dec, x txa
lda _num_dec-1, x
cmp #10 cmp #10
bcc _skip ; 小于10不进位 bcc _skip ; 小于10不进位
jsr printbyte
pha pha
and #$f0 and #$f0
lsr lsr
lsr lsr
lsr lsr
lsr lsr
tay adc _num_dec-2, x
sta _num_dec-2, x
pla pla
and #$0f and #$0f
jsr printbyte sta _num_dec-1, x
adc _num_dec, x
sta _num_dec, x
jsr chrin
tya
adc _num_dec - 1, x
sta _num_dec - 1, x
jsr chrin
_skip: _skip:
dex dex
bne _loop bne _loop
@@ -171,4 +164,4 @@ _up:
tay tay
.macend .macend
.require "printbyte.asm" ; .require "printbyte.asm"

BIN
snake.prg

Binary file not shown.