diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-03-05 18:47:08 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-03-05 18:47:08 +0100 |
| commit | 11847f52aed5bda1966b7d28e009430dc58d2561 (patch) | |
| tree | 49012edd92bcf40add6b784c3aa66ac1ae1a9bf3 /src/jetpac.s | |
| parent | dbcbd43287a28bf087e20e660edd5ba40b5c27ec (diff) | |
| download | jetpac.nes-11847f52aed5bda1966b7d28e009430dc58d2561.tar.gz jetpac.nes-11847f52aed5bda1966b7d28e009430dc58d2561.zip | |
Add the Game Over screen
This is still missing the support for player 2, but I've left traces
about it.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'src/jetpac.s')
| -rw-r--r-- | src/jetpac.s | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/jetpac.s b/src/jetpac.s index 2e55771..5c1c099 100644 --- a/src/jetpac.s +++ b/src/jetpac.s @@ -46,6 +46,7 @@ .include "enemies.s" .include "bullets.s" .include "title.s" +.include "over.s" .include "driver.s" .include "interrupts.s" @@ -109,8 +110,10 @@ __fallthrough__ main .endproc - .proc main + ;; TODO: score initialization has to happen here. + +@init: ;; Disable the PPU and zero out variables which shadow PPU registers. lda #0 sta PPU::m_mask @@ -140,6 +143,9 @@ ;; Initialize the assets for the game. jsr Assets::init + ;; Initialize some variables from the "Game Over" side of the game. + jsr Over::init + ;; Initialize some PAL-specific constants. .ifdef PAL lda #0 @@ -209,8 +215,28 @@ jmp @main_game_loop @over: - ;; TODO: allow to start over, reset flags, control register, etc. - jmp @over + ;; Display the "Game over" screen if it hasn't been displayed yet. After + ;; that, if we detect that the user wants to go back to the title screen we + ;; go back to @init to initialize everything again except for the score + ;; which should be preserved. Otherwise we go back to the main game loop, + ;; which effectively means to just sit and wait until for the right player + ;; input. + jsr Over::handle + sta Globals::zp_tmp0 + + ;; Wait for the PPU to render the screen. +@set_flags_over: + lda #%10000000 + ora Globals::zp_flags + sta Globals::zp_flags +@wait_for_render_over: + bit Globals::zp_flags + bmi @wait_for_render_over + + ;; Did the user want to start over? + lda Globals::zp_tmp0 + beq @main_game_loop + jmp @init .endproc .segment "VECTORS" |
