aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-04-02 14:40:12 +0200
committerMiquel Sabaté Solà <mssola@mssola.com>2026-04-02 14:40:12 +0200
commitcb1111055f7b03989daac63675d27bfd156a4e21 (patch)
treea3038f24c830b053dc7b63e7935f63e0bd50f7b3
parentba2711cb490c26e05c1b8f6cd3e1d081309d15fd (diff)
downloadjetpac.nes-cb1111055f7b03989daac63675d27bfd156a4e21.tar.gz
jetpac.nes-cb1111055f7b03989daac63675d27bfd156a4e21.zip
Cycle the kind of shuttle to be used
In preparation to having multiple kinds of shuttles as in the original game, introduce the 'Globals::zp_shuttle_kind' variable, which is just a helper value by masking out the 'Globals::zp_level' variable. This in turn will be the index for selecting which tile IDs for each shuttle part. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
-rw-r--r--.nasm/memory.txt7
-rw-r--r--.nasm/segments.txt2
-rw-r--r--include/globals.s8
-rw-r--r--src/driver.s5
-rw-r--r--src/jetpac.s6
5 files changed, 22 insertions, 6 deletions
diff --git a/.nasm/memory.txt b/.nasm/memory.txt
index b7a16bc..35133c5 100644
--- a/.nasm/memory.txt
+++ b/.nasm/memory.txt
@@ -22,8 +22,9 @@ $21: zp_prev
$22: zp_buttons
$24: zp_level
$25: zp_level_kind
-$26: zp_multiplayer
-$27: zp_extra_flags
+$26: zp_shuttle_kind
+$27: zp_multiplayer
+$28: zp_extra_flags
$2E: zp_blink_status
$2F: zp_blink_timer
$30: zp_title_timer
@@ -84,4 +85,4 @@ $4016: m_joypad
$4017: m_frame_counter
--- Summary (in bytes) ---
-- Internal RAM: 438/2048 (21.39%)
+- Internal RAM: 439/2048 (21.44%)
diff --git a/.nasm/segments.txt b/.nasm/segments.txt
index a741401..229318f 100644
--- a/.nasm/segments.txt
+++ b/.nasm/segments.txt
@@ -1,4 +1,4 @@
- HEADER: 16/16 (100%)
-- ROM0: 9120/32762 (27.84%)
+- ROM0: 9136/32762 (27.89%)
- ROMV: 6/6 (100%)
- ROM2: 8192/8192 (100%)
diff --git a/include/globals.s b/include/globals.s
index a958778..515d5d4 100644
--- a/include/globals.s
+++ b/include/globals.s
@@ -48,6 +48,10 @@
;; masking `zp_level`.
zp_level_kind = $25
+ ;; The kind of shuttle to be used. As with 'zp_level_kind', this is just a
+ ;; cached version of masking 'zp_level'.
+ zp_shuttle_kind = $26
+
;; | Bit | Short name | Meaning |
;; |-----+------------------+--------------------------|
;; | 7 | enabled | Multiplayer enabled. |
@@ -55,7 +59,7 @@
;; | 2 | player's 2 state | 0: over; 1: alive |
;; | 1 | player's 1 state | 0: over; 1: alive |
;; | 0 | active | 0: player 1; 1: player 2 |
- zp_multiplayer = $26
+ zp_multiplayer = $27
;; Extra bitmap that was needed beyond the ones that we already have. Yeah,
;; I know, bad planning from my side, but now it's a bit complex to untangle
@@ -66,5 +70,5 @@
;; | 7 | score | The score has been updated. |
;; | 6 | high | The high score has been updated. |
;; | 5-0 | - | Unused. |
- zp_extra_flags = $27
+ zp_extra_flags = $28
.endscope
diff --git a/src/driver.s b/src/driver.s
index b367c63..9d31604 100644
--- a/src/driver.s
+++ b/src/driver.s
@@ -885,6 +885,11 @@
lda Globals::zp_level
and #%00000111
sta Globals::zp_level_kind
+ lda Globals::zp_level
+ and #%00001100
+ lsr
+ lsr
+ sta Globals::zp_shuttle_kind
;; Just like we did in Drivers::switch(), we re-initialize some things
;; like timers and the items. Note that re-setting the timers will force
diff --git a/src/jetpac.s b/src/jetpac.s
index 5716be8..b9e6311 100644
--- a/src/jetpac.s
+++ b/src/jetpac.s
@@ -153,9 +153,15 @@
sta Globals::zp_level
and #%00000111
sta Globals::zp_level_kind
+ lda #LEVEL
+ and #%00001100
+ lsr
+ lsr
+ sta Globals::zp_shuttle_kind
.else
sta Globals::zp_level
sta Globals::zp_level_kind
+ sta Globals::zp_shuttle_kind
.endif
;; Initialize the assets for the game. If the first sprite is not