1
0
mirror of https://github.com/fumiama/c64-snake.git synced 2026-06-12 14:10:25 +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/c64_0.oph"
.require "platform/c64kernal.oph" .require "platform/c64kernal.oph"
.alias cblk $bf .alias cblk $a6
.alias go_u $55 ; 上 .alias go_u $55 ; 上
.alias go_d $5f ; 下 .alias go_d $5f ; 下
@@ -30,9 +30,9 @@ main:
.macro init .macro init
lda #147 ;清屏 lda #147 ;清屏
jsr chrout jsr chrout
lda #$aa lda #$a8
; sta s sta s
sta s + 1 ;sta s + 1
jsr printscore jsr printscore
.macend .macend

View File

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

View File

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

View File

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

BIN
snake.prg

Binary file not shown.