aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-07 23:27:28 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-08 16:50:06 +0100
commit220c80b987ba54d709180e3d95e9e0d82af4249c (patch)
tree2b84b016d70650ad57a2acb8ad6ca7c28ff8629d
parente8f39dc4a7cc19fb97e24ec0819ccd964cbd325f (diff)
downloadjetpac.nes-220c80b987ba54d709180e3d95e9e0d82af4249c.tar.gz
jetpac.nes-220c80b987ba54d709180e3d95e9e0d82af4249c.zip
Define the bitmap for multiplayer support
Also give it a dummy value on start and initialize it properly after the player's selection on the title screen. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
-rw-r--r--.nasm/memory.txt3
-rw-r--r--.nasm/segments.txt2
-rw-r--r--include/globals.s9
-rw-r--r--src/jetpac.s1
-rw-r--r--src/title.s11
5 files changed, 23 insertions, 3 deletions
diff --git a/.nasm/memory.txt b/.nasm/memory.txt
index 66efcb4..dcdef5e 100644
--- a/.nasm/memory.txt
+++ b/.nasm/memory.txt
@@ -21,6 +21,7 @@ $22: zp_buttons1
$23: zp_buttons2
$24: zp_level
$25: zp_level_kind
+$26: zp_multiplayer
$30: zp_title_timer
$32: zp_pause_timer
$33: zp_next_bullet_cycle
@@ -69,4 +70,4 @@ $4016: m_joypad1
$4017: m_frame_counter
--- Summary (in bytes) ---
-- Internal RAM: 390/2048 (19.04%)
+- Internal RAM: 391/2048 (19.09%)
diff --git a/.nasm/segments.txt b/.nasm/segments.txt
index 191f81e..ae19530 100644
--- a/.nasm/segments.txt
+++ b/.nasm/segments.txt
@@ -1,4 +1,4 @@
- HEADER: 16/16 (100%)
-- ROM0: 6544/32762 (19.97%)
+- ROM0: 6559/32762 (20.02%)
- ROMV: 6/6 (100%)
- ROM2: 8192/8192 (100%)
diff --git a/include/globals.s b/include/globals.s
index ca85d33..f6021b4 100644
--- a/include/globals.s
+++ b/include/globals.s
@@ -45,4 +45,13 @@
;; "kind" repeats every 8 waves. Hence, this is just a cached version of
;; masking `zp_level`.
zp_level_kind = $25
+
+ ;; | Bit | Short name | Meaning |
+ ;; |-----+------------------+--------------------------|
+ ;; | 7 | enabled | Multiplayer enabled. |
+ ;; | 6-3 | - | Unused. |
+ ;; | 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
.endscope
diff --git a/src/jetpac.s b/src/jetpac.s
index 52ec1f7..e8d6543 100644
--- a/src/jetpac.s
+++ b/src/jetpac.s
@@ -124,6 +124,7 @@
;; have zero as their initial values. Note that it's important to have these
;; variables defined before
sta Globals::zp_flags
+ sta Globals::zp_multiplayer
sta Joypad::zp_buttons1
sta Joypad::zp_buttons2
sta Player::zp_state
diff --git a/src/title.s b/src/title.s
index e3a2086..06ca1cb 100644
--- a/src/title.s
+++ b/src/title.s
@@ -89,9 +89,18 @@
rts
.endproc
- ;; Save the selection from the menu (TODO), hide all elements from the title
+ ;; Save the selection from the menu, hide all elements from the title
;; screen, and return always 1.
.proc start
+ ;; Select whether player 2 is to be alive or not.
+ lda #%00000010
+ ldx OAM::m_sprites
+ cpx #SPRITE_Y_POSITION1
+ bne @set_multi
+ ora #%10000100
+ @set_multi:
+ sta Globals::zp_multiplayer
+
;; Hide the sprite from the menu.
lda #$EF
sta OAM::m_sprites