1
0
mirror of https://github.com/fumiama/c64-snake.git synced 2026-06-12 14:10:25 +08:00

main框架基本完成

This commit is contained in:
fumiama
2021-04-03 16:46:56 +08:00
parent caaead7be0
commit c21a2a1efb
4 changed files with 76 additions and 21 deletions

42
printfield.asm Normal file
View File

@@ -0,0 +1,42 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; printfield 打印蛇,包括边框
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
printfield:
.scope
.data zp
.space _ptr 2
.text
ldx #23 ; i代表行数不含边框
lda #<field ; 取地址低8位
sta _ptr
lda #>field ; 取地址高8位
sta _ptr + 1
ldy #0
* lda #cblk
sta (_ptr), y ; 打印左边框
lda #39
jsr _addptr
lda #cblk
sta (_ptr), y ; 打印右边框
lda #1
jsr _addptr
dex
bne -
lda #cblk
ldy #40
dec _ptr
* sta (_ptr), y ; 打印底边
dey
bne -
ldx #0
jsr plot
rts
_addptr:
clc
adc _ptr
bcc +
inc _ptr + 1
* sta _ptr
rts
.scend