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