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

部分修复score

This commit is contained in:
fumiama
2021-04-01 00:35:09 +08:00
parent 52ac9f147b
commit e127bff706
5 changed files with 29 additions and 14 deletions

View File

@@ -2,7 +2,7 @@
.require "platform/c64_0.oph"
.require "platform/c64kernal.oph"
.alias cblk $bf
.alias cblk $a6
.alias go_u $55 ; 上
.alias go_d $5f ; 下
@@ -30,9 +30,9 @@ main:
.macro init
lda #147 ;清屏
jsr chrout
lda #$aa
; sta s
sta s + 1
lda #$a8
sta s
;sta s + 1
jsr printscore
.macend

View File

@@ -2,7 +2,8 @@
; print16 从内存打印16位int(十进制5位),空位补0
; 以BE方式存储以便打印
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.macro print16
print16:
.scope
.data zp
.space _num 6
.text
@@ -16,8 +17,8 @@
sta _num, x
bne -
`splitbyte _1, 4
`splitbyte _1 + 1, 2
`splitbyte s, 4
`splitbyte s + 1, 2
`carry
`print _num
@@ -29,9 +30,13 @@
mod10:
lda _num, y
ldx #$ff
* inx
clc
sbc #10
* inx
;jsr printbyte
sbc #9
;jsr printbyte
;dey
;rts
bcc -
clc
adc #$3a
@@ -41,20 +46,22 @@ mod10:
adc _num, y
sta _num, y
rts
.macend
.scend
.macro splitbyte
lda _1
jsr printbyte
sta _num + _2
;jsr printbyte
lsr
lsr
lsr
lsr
sta _num + _2 - 1
;jsr printbyte
lda #$0f
ora _num + _2
and _num + _2
sta _num + _2
;jsr printbyte
.macend
.macro carry
@@ -65,9 +72,13 @@ mod10:
* jsr mod10
; dey
bne -
lda #$30
clc
adc _num
sta _num
pla
tay
.macend
.require "printbyte.asm"
.require "printbyte.asm"

View File

@@ -2,6 +2,7 @@
.space _na 1 ; a的临时存放处
.text
printbyte:
pha
sta _na
txa
pha
@@ -12,6 +13,9 @@ printbyte:
jsr chrout ; putchar(a)
dex ; x--
bne - ; if(x != 0) goto 上个星号
lda #$20
jsr chrout
pla
tax
pla
rts

View File

@@ -9,7 +9,7 @@ printscore:
dex
bne -
`print score_str
`print16 s
jsr print16
ldx #15
* jsr chrout
dex

BIN
snake.prg

Binary file not shown.