aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.nasm/segments.txt2
-rw-r--r--src/driver.s10
-rw-r--r--src/jetpac.s7
3 files changed, 16 insertions, 3 deletions
diff --git a/.nasm/segments.txt b/.nasm/segments.txt
index f09170c..191f81e 100644
--- a/.nasm/segments.txt
+++ b/.nasm/segments.txt
@@ -1,4 +1,4 @@
- HEADER: 16/16 (100%)
-- ROM0: 6538/32762 (19.96%)
+- ROM0: 6544/32762 (19.97%)
- ROMV: 6/6 (100%)
- ROM2: 8192/8192 (100%)
diff --git a/src/driver.s b/src/driver.s
index 1449de5..1ac5718 100644
--- a/src/driver.s
+++ b/src/driver.s
@@ -49,6 +49,15 @@
;; this, but we have plenty of RAM left.
zp_pause_toggle = $39
+ ;; Initialization routine that is to be called before enabling NMIs back for
+ ;; the first time.
+ .proc init_before_nmi
+ lda #0
+ sta Driver::zp_pause_toggle
+
+ rts
+ .endproc
+
;; Switch from the title screen to the main screen. Note that this function
;; is to be called with the PPU disabled. If that's not the case, then it
;; will set the proper values to disable it on the next `nmi` call and set
@@ -157,7 +166,6 @@
lda #0
sta zp_pause_timer
sta Driver::zp_moved_out
- sta Driver::zp_pause_toggle
;; Initialize variables for sprite cycling.
sta zp_next_bullet_cycle
diff --git a/src/jetpac.s b/src/jetpac.s
index 5c1c099..52ec1f7 100644
--- a/src/jetpac.s
+++ b/src/jetpac.s
@@ -121,7 +121,8 @@
sta PPU::zp_control
;; Initialize other global variables which the rest of the game assume to
- ;; have zero as their initial values.
+ ;; have zero as their initial values. Note that it's important to have these
+ ;; variables defined before
sta Globals::zp_flags
sta Joypad::zp_buttons1
sta Joypad::zp_buttons2
@@ -146,6 +147,10 @@
;; Initialize some variables from the "Game Over" side of the game.
jsr Over::init
+ ;; Initialize variables from the game's driver that need to be set before
+ ;; NMIs start ticking.
+ jsr Driver::init_before_nmi
+
;; Initialize some PAL-specific constants.
.ifdef PAL
lda #0