aboutsummaryrefslogtreecommitdiff
path: root/src/jetpac.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-25 01:03:17 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-25 01:03:17 +0100
commitccf320971efe9b11f7b7722b2ee2642a10303203 (patch)
tree9ad50e8ffda2194256a9945de0af44a6fad119a2 /src/jetpac.s
parentfcc4a0c30ee01719451596d579abf4cbe1e9b8a1 (diff)
downloadjetpac.nes-ccf320971efe9b11f7b7722b2ee2642a10303203.tar.gz
jetpac.nes-ccf320971efe9b11f7b7722b2ee2642a10303203.zip
Add support for adding scores
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'src/jetpac.s')
-rw-r--r--src/jetpac.s14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/jetpac.s b/src/jetpac.s
index 3cf8f0a..b356192 100644
--- a/src/jetpac.s
+++ b/src/jetpac.s
@@ -42,6 +42,7 @@
.include "background.s"
.include "prng.s"
.include "explosions.s"
+.include "score.s"
.include "items.s"
.include "player.s"
.include "enemies.s"
@@ -112,7 +113,14 @@
.endproc
.proc main
- ;; TODO: high score initialization has to happen here.
+ ;; Initialize the high score.
+ lda #0
+ sta Score::m_hi
+ sta Score::m_hi + 1
+ sta Score::m_hi + 2
+ sta Score::m_hi + 3
+ sta Score::m_hi + 4
+ sta Score::m_hi + 5
@init:
;; Disable the PPU and zero out variables which shadow PPU registers.
@@ -156,6 +164,10 @@
;; Initialize some variables from the "Game Over" side of the game.
jsr Over::init
+ ;; Initialize the score for both players. Note that initializing the high
+ ;; score is the first thing we do in main().
+ jsr Score::init_players_scores
+
;; Initialize variables from the game's driver that need to be set before
;; NMIs start ticking.
jsr Driver::init_before_nmi