From aaba27a5f6a24f0124e0f1759985cb43aa1220a1 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 19 Jul 2020 18:42:27 -0400 Subject: [PATCH] mist: can beat the game! --- mist/octagon_fireplace.s | 52 +++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/mist/octagon_fireplace.s b/mist/octagon_fireplace.s index a9114721..891fc0b1 100644 --- a/mist/octagon_fireplace.s +++ b/mist/octagon_fireplace.s @@ -32,24 +32,58 @@ in_fireplace: ; it's the button -; lda animate_direction -; bpl animate_back + ; check if pattern is right + ; it not, open door + ; if so, animate there + + lda FIREPLACE_GRID0 + cmp #$c0 + bne wrong_combination + lda FIREPLACE_GRID1 + cmp #$68 + bne wrong_combination + lda FIREPLACE_GRID2 + cmp #$a0 + bne wrong_combination + lda FIREPLACE_GRID3 + cmp #$90 + bne wrong_combination + lda FIREPLACE_GRID4 + cmp #$cc + bne wrong_combination + lda FIREPLACE_GRID5 + cmp #$f8 + bne wrong_combination animate_there: lda #1 sta ANIMATE_FRAME sta animate_direction -; bne done_in_fireplace - - - -done_in_fireplace: - lda #0 ; reset frame count sta FRAMEL +done_in_fireplace: rts +clear_fireplace: + + ; clear it out + lda #$0 + sta FIREPLACE_GRID0 + sta FIREPLACE_GRID1 + sta FIREPLACE_GRID2 + sta FIREPLACE_GRID3 + sta FIREPLACE_GRID4 + sta FIREPLACE_GRID5 + + rts + +wrong_combination: + + jsr clear_fireplace + jmp exit_fireplace + + animate_direction: .byte $ff @@ -111,6 +145,8 @@ at_shelf: lda #DIRECTION_E sta DIRECTION + jsr clear_fireplace + jmp change_location ;============================