From f528c5f22afe9e5161681002f5dadf70a197ca93 Mon Sep 17 00:00:00 2001 From: giomba Date: Thu, 21 Dec 2017 17:28:20 +0100 Subject: [PATCH] Added pause feature --- snake.asm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/snake.asm b/snake.asm index 6b5243c..625f5f1 100644 --- a/snake.asm +++ b/snake.asm @@ -26,6 +26,7 @@ irqn: BYTE ; Direction of the snake (2,4,6,8 as down,left,right,up) +; 5 means `pause` direction: BYTE @@ -225,13 +226,19 @@ keybCheckD: jmp keybEndCheck keybCheckW: cmp #$57 - bne keybEndCheck + bne keybCheckP lda direction cmp #2 beq keybEndCheck lda #8 sta direction jmp keybEndCheck +keybCheckP: + cmp #$50 + bne keybEndCheck + lda #5 + sta direction + jmp keybEndCheck keybEndCheck: ; Get direction and move head accordingly @@ -256,10 +263,14 @@ dirCheck6: stx snakeX dirCheck8: cmp #8 - bne dirEndCheck + bne dirCheck5 ldy snakeY dey sty snakeY +dirCheck5: + cmp #5 + bne dirEndCheck + jmp skipPauseTests dirEndCheck: ; Check screen boundaries overflow @@ -386,6 +397,8 @@ checkEndSelfEat: lda #$20 ; just put a space to erase snake tail tile sta (tileMem),y +skipPauseTests: + irqalways: ; Things that must be done every interrupt (50Hz) ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -