From be1c1f57f5c141a5ae5c7f6ab86d2a3507b6f9d8 Mon Sep 17 00:00:00 2001 From: giomba Date: Wed, 27 Dec 2017 18:01:37 +0100 Subject: [PATCH] Added outro delay --- snake.asm | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/snake.asm b/snake.asm index 796f4a3..1b56766 100644 --- a/snake.asm +++ b/snake.asm @@ -61,7 +61,12 @@ length: random: BYTE -; Status (0 fist time intro playing, 1 init (title) screen, 2 game running) +; Status +; 0 fist time intro playing +; 1 init (title) screen +; 2 game running +; 3 outro +; 4 end status: BYTE @@ -75,6 +80,10 @@ introX: introXinc: BYTE #$1 +; Outro delay +outroDelay + BYTE #$ff + ; Costants ; ---------------------------------------------------------------------- @@ -189,7 +198,7 @@ intro0end: endless: ; Loop waiting for gameover lda status - cmp #3 ; is status equal to 3 (gameover) ? + cmp #4 ; is status equal to 4 (gameover) ? bne endless ; if not, just wait looping here, else... jsr introreset ; reset variables for intro @@ -323,7 +332,8 @@ irq: ; 0 intro running ; 1 for future use ; 2 actual game running - ; 3 gameover + ; 3 after-game outro + ; 4 gameover lda status cmp #0 bne checkStatus1 @@ -336,9 +346,14 @@ checkStatus1: jmp checkEndStatus checkStatus2 cmp #2 - bne checkEndStatus + bne checkStatus3 jsr status2 jmp checkEndStatus +checkStatus3 + cmp #3 + bne checkEndStatus + jsr status3 + jmp checkEndStatus checkEndStatus: ; Play music @@ -707,11 +722,25 @@ gameover: ; Set gameover status ; this way, the loop out of this interrupt, will know that we ; finished, and play the intro again + lda #$ff + sta outroDelay lda #3 sta status rts -; TODO : must be added a delay to let the player see her/his final score -; before clearing the screen and starting with the intro again + +; Decrement outroDelay, just to let player see her/his end screen +; with score +status3: + ldy outroDelay ; load outroDelay and decrement + dey + sty outroDelay + cpy #0 + beq status3end + rts +status3end: + lda #4 ; go to end status + sta status + rts ; Subroutines ; ----------------------------------------------------------------------