Added pause feature
This commit is contained in:
parent
23343d93f3
commit
f528c5f22a
17
snake.asm
17
snake.asm
@ -26,6 +26,7 @@ irqn:
|
|||||||
BYTE
|
BYTE
|
||||||
|
|
||||||
; Direction of the snake (2,4,6,8 as down,left,right,up)
|
; Direction of the snake (2,4,6,8 as down,left,right,up)
|
||||||
|
; 5 means `pause`
|
||||||
direction:
|
direction:
|
||||||
BYTE
|
BYTE
|
||||||
|
|
||||||
@ -225,13 +226,19 @@ keybCheckD:
|
|||||||
jmp keybEndCheck
|
jmp keybEndCheck
|
||||||
keybCheckW:
|
keybCheckW:
|
||||||
cmp #$57
|
cmp #$57
|
||||||
bne keybEndCheck
|
bne keybCheckP
|
||||||
lda direction
|
lda direction
|
||||||
cmp #2
|
cmp #2
|
||||||
beq keybEndCheck
|
beq keybEndCheck
|
||||||
lda #8
|
lda #8
|
||||||
sta direction
|
sta direction
|
||||||
jmp keybEndCheck
|
jmp keybEndCheck
|
||||||
|
keybCheckP:
|
||||||
|
cmp #$50
|
||||||
|
bne keybEndCheck
|
||||||
|
lda #5
|
||||||
|
sta direction
|
||||||
|
jmp keybEndCheck
|
||||||
keybEndCheck:
|
keybEndCheck:
|
||||||
|
|
||||||
; Get direction and move head accordingly
|
; Get direction and move head accordingly
|
||||||
@ -256,10 +263,14 @@ dirCheck6:
|
|||||||
stx snakeX
|
stx snakeX
|
||||||
dirCheck8:
|
dirCheck8:
|
||||||
cmp #8
|
cmp #8
|
||||||
bne dirEndCheck
|
bne dirCheck5
|
||||||
ldy snakeY
|
ldy snakeY
|
||||||
dey
|
dey
|
||||||
sty snakeY
|
sty snakeY
|
||||||
|
dirCheck5:
|
||||||
|
cmp #5
|
||||||
|
bne dirEndCheck
|
||||||
|
jmp skipPauseTests
|
||||||
dirEndCheck:
|
dirEndCheck:
|
||||||
|
|
||||||
; Check screen boundaries overflow
|
; Check screen boundaries overflow
|
||||||
@ -386,6 +397,8 @@ checkEndSelfEat:
|
|||||||
lda #$20 ; just put a space to erase snake tail tile
|
lda #$20 ; just put a space to erase snake tail tile
|
||||||
sta (tileMem),y
|
sta (tileMem),y
|
||||||
|
|
||||||
|
skipPauseTests:
|
||||||
|
|
||||||
irqalways:
|
irqalways:
|
||||||
; Things that must be done every interrupt (50Hz)
|
; Things that must be done every interrupt (50Hz)
|
||||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Loading…
Reference in New Issue
Block a user