1
0
mirror of https://github.com/fumiama/c64-snake.git synced 2026-06-30 08:50:34 +08:00
This commit is contained in:
fumiama
2021-04-01 23:28:51 +08:00
parent e127bff706
commit 90d98208e6
3 changed files with 22 additions and 20 deletions

View File

@@ -30,9 +30,10 @@ main:
.macro init .macro init
lda #147 ;清屏 lda #147 ;清屏
jsr chrout jsr chrout
lda #$a8 lda #$ac
sta s sta s
;sta s + 1 lda #0
sta s + 1
jsr printscore jsr printscore
.macend .macend

View File

@@ -6,6 +6,7 @@ print16:
.scope .scope
.data zp .data zp
.space _num 6 .space _num 6
.space _num_dec 6
.text .text
pha pha
txa txa
@@ -15,12 +16,13 @@ print16:
ldx #6 ldx #6
* dex * dex
sta _num, x sta _num, x
sta _num_dec, x
bne - bne -
`splitbyte s, 4 `splitbyte s, 4
`splitbyte s + 1, 2 `splitbyte s + 1, 2
`carry `carry
`print _num `print _num_dec
pla pla
tax tax
@@ -29,23 +31,22 @@ print16:
mod10: mod10:
lda _num, y lda _num, y
ldx #$ff cmp #10 ; 4位的数只有大于/小于10两种情况
clc bmi + ; 小于等于10
* inx adc #$25 ; 此时c=0
;jsr printbyte sta _num_dec, y
sbc #9 jsr printbyte
;jsr printbyte
;dey
;rts
bcc -
clc
adc #$3a
sta _num, y
txa
dey dey
adc _num, y lda #1
sta _num, y adc _num_dec, y
rts sta _num_dec, y
jsr printbyte
iny
jmp ++
* adc #$2f ; 此时c=1
adc _num_dec, y
sta _num_dec, y
* rts
.scend .scend
.macro splitbyte .macro splitbyte
@@ -70,7 +71,7 @@ mod10:
ldy #4 ldy #4
* jsr mod10 * jsr mod10
; dey dey
bne - bne -
lda #$30 lda #$30
clc clc

BIN
snake.prg

Binary file not shown.