aboutsummaryrefslogtreecommitdiff
path: root/src/interrupts.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-04 23:44:47 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-04 23:44:47 +0100
commitdbcbd43287a28bf087e20e660edd5ba40b5c27ec (patch)
treeae69b710c3b06bae58c18273af105855b3071ded /src/interrupts.s
parent0c5af85cc0cb9bb39a3a72548e735b92daf0a28f (diff)
downloadjetpac.nes-dbcbd43287a28bf087e20e660edd5ba40b5c27ec.tar.gz
jetpac.nes-dbcbd43287a28bf087e20e660edd5ba40b5c27ec.zip
Update lifes left for player 1
The whole handling of player 2 will come whenever I set to implement multi-player for this game. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'src/interrupts.s')
-rw-r--r--src/interrupts.s22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/interrupts.s b/src/interrupts.s
index 8c53af7..b5120b4 100644
--- a/src/interrupts.s
+++ b/src/interrupts.s
@@ -34,6 +34,28 @@
jsr Driver::pal_handler
.endif
+ ;; Do we need to update the lifes from players on the HUD?
+ lda Player::zp_state
+ and #%00001000
+ beq @global_flags
+
+ ;; Yeah! TODO: this is only done for player 1.
+ bit PPU::m_status
+ lda #$28
+ sta PPU::m_address
+ lda #$4B
+ sta PPU::m_address
+ lda Player::zp_lifes
+ clc
+ adc #$10
+ sta PPU::m_data
+
+ ;; And unset the 'life' flag from the player.
+ lda Player::zp_state
+ and #%11110111
+ sta Player::zp_state
+
+@global_flags:
;; TODO: some actions here will depend on the status of the game...
lda Globals::zp_flags
and #%00000001