diff --git a/scorch.asm b/scorch.asm index fc56e0e..b6d444a 100644 --- a/scorch.asm +++ b/scorch.asm @@ -556,8 +556,50 @@ MakeDarkScreen rts .endp +;-------------------------------------------------- +.proc CheckExitKeys +;-------------------------------------------------- +; Checks keyboard and sets appropriate flags for exit procedures +; If START+OPTION is pressed - exit to GameOver screen +; If 'O' key is pressed - displays "Are you sure?" and - exit to GameOver screen +; If 'Esc' key is pressed - displays "Are you sure?" and - exit to Menu screen +; Just setting the right flags!!! + + ; Select and Option + lda CONSOL + and #%00000101 ; Start + Option + beq QuitToGameover + lda SKSTAT + cmp #$ff + jeq nokeys + cmp #$f7 ; SHIFT + jeq nokeys + + lda kbcode + and #%10111111 ; SHIFT elimination + + cmp #@kbcode._O ; $08 ; O + bne CheckEsc + jsr AreYouSure + bit escFlag + bpl nokeys + ;---O pressed-quit game to game over screen--- +QuitToGameover + mva #$40 escFlag + rts +CheckEsc + cmp #@kbcode._esc ; 28 ; ESC + bne nokeys +DisplayAreYouSure + jsr AreYouSure + ;---esc pressed-quit game--- +nokeys + rts +; +.endp ;-------------------------------------------------- .proc ShellDelay +;-------------------------------------------------- lda CONSOL and #%00000101 ; Start + Option bne @+ diff --git a/scorch.bin b/scorch.bin index bba74c1..6360dbb 100644 Binary files a/scorch.bin and b/scorch.bin differ diff --git a/scorch.xex b/scorch.xex index 29cc84d..c2c5d46 100644 Binary files a/scorch.xex and b/scorch.xex differ diff --git a/scorchC64.asm b/scorchC64.asm index 48fb4db..2ecd979 100644 --- a/scorchC64.asm +++ b/scorchC64.asm @@ -317,6 +317,18 @@ MakeDarkScreen rts .endp +;-------------------------------------------------- +.proc CheckExitKeys +;-------------------------------------------------- +; Checks keyboard and sets appropriate flags for exit procedures +; If START+OPTION is pressed - exit to GameOver screen +; If 'O' key is pressed - displays "Are you sure?" and - exit to GameOver screen +; If 'Esc' key is pressed - displays "Are you sure?" and - exit to Menu screen +; Just setting the right flags!!! + + rts +; +.endp ;-------------------------------------------------- .proc ShellDelay ldx flyDelay diff --git a/weapons.asm b/weapons.asm index a86f328..8be7345 100644 --- a/weapons.asm +++ b/weapons.asm @@ -1098,13 +1098,17 @@ ContinueToCheckMaxForce2 ; $f3 - shift+key notpressed - ldx TankNr ; for optimize + jsr CheckExitKeys ; Check for O, Esc or Start+Option keys + bit escFlag + bmi EscPressed + bvc OnotPressed +EscPressed + rts ; exit if pressed 'Exit keys' +OnotPressed + ldx TankNr ; for optimize ; Select and Option lda CONSOL tay - and #%00000101 ; Start + Option - beq QuitToGameover - tya and #%00000100 beq callActivation ; Option key tya @@ -1119,24 +1123,6 @@ notpressed lda kbcode and #%10111111 ; SHIFT elimination - cmp #@kbcode._O ; $08 ; O - bne @+ - jsr AreYouSure - bit escFlag - bpl notpressed - ;---O pressed-quit game to game over screen--- -QuitToGameover - mva #$40 escFlag - rts -@ - cmp #@kbcode._esc ; 28 ; ESC - bne @+ - jsr AreYouSure - bit escFlag - bpl notpressed - ;---esc pressed-quit game--- - rts -@ cmp #@kbcode._A ; $3f ; A bne @+ callActivation @@ -1779,7 +1765,16 @@ nolaserwait bne nowait ; funky bomb explotes fast ( tracerflag in real is funkyflag :) ) nonowait jsr shellDelay - + ; + jsr CheckExitKeys ; Check for O, Esc or Start+Option keys + bit escFlag + bmi EscPressed + bvc OnotPressed +EscPressed + rts ; exit if pressed 'Exit keys' +OnotPressed + ldx TankNr + ; nowait lda HitFlag bne Hit @@ -2113,6 +2108,18 @@ mrLoopi sta vy+3 jsr ShellDelay + ; + phx + jsr CheckExitKeys ; Check for O, Esc or Start+Option keys + bit escFlag + bmi EscPressed + bvc OnotPressed +EscPressed + plx + rts ; exit if pressed 'Exit keys' +OnotPressed + plx + ; MIRVdoNotChangeY