mirror of
https://github.com/fumiama/c64-snake.git
synced 2026-06-27 15:30:33 +08:00
更改判断、移动顺序,增加head
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
; DELAY routine. Takes values from the Accumulator and pauses
|
||||
; for that many jiffies (1/60th of a second).
|
||||
.scope
|
||||
.data
|
||||
.data zp
|
||||
.space _tmp 1
|
||||
.space _target 1
|
||||
.text
|
||||
|
||||
3
head.asm
3
head.asm
@@ -19,11 +19,12 @@
|
||||
.space c 1 ; 🐍长度 最大255 最小0
|
||||
.space s 2 ; 得分 小端序
|
||||
.space _ptr 2 ; 通用指针
|
||||
.space eat 1 ; 吃到食物标记
|
||||
.space shead 2 ; 蛇头指针
|
||||
|
||||
.alias title $0400
|
||||
.alias field $0428 ; 蛇所在屏幕内存区
|
||||
|
||||
.data
|
||||
.org $c000
|
||||
.space eat 1
|
||||
.text
|
||||
7
main.asm
7
main.asm
@@ -8,8 +8,7 @@ main:
|
||||
`init
|
||||
jsr getchar ; 等待输入任意字符开始游戏
|
||||
jsr erasehint ; 游戏开始,清空提示
|
||||
* jsr move ; 蛇移动一格
|
||||
clc
|
||||
* clc
|
||||
jsr judgeout ; 判断是否出界
|
||||
bcc +
|
||||
jsr printfail
|
||||
@@ -24,7 +23,8 @@ main:
|
||||
lda #1
|
||||
sta eat
|
||||
jsr addfood
|
||||
* jsr calcscore ; 计算得分
|
||||
* jsr move ; 蛇移动一格
|
||||
jsr calcscore ; 计算得分
|
||||
jsr printscore ; 打印分数
|
||||
lda #32
|
||||
jsr delay ; 延时期间最后一个按键位于d
|
||||
@@ -54,6 +54,7 @@ main:
|
||||
lda #go_d ; 初始化方向为下
|
||||
sta d
|
||||
jsr srand ; 初始化随机数种子
|
||||
jsr addfood ; 增加食物
|
||||
.macend
|
||||
|
||||
.require "printscore.asm"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
print16:
|
||||
.scope
|
||||
.data
|
||||
.data zp
|
||||
.space _num 4
|
||||
.space _num_dec 6
|
||||
.text
|
||||
|
||||
Reference in New Issue
Block a user