aboutsummaryrefslogtreecommitdiff
path: root/src/driver.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-03-19 17:28:36 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-03-19 17:28:36 +0100
commit4c8ed456d990ee99884e9dcd245f665ccb894b50 (patch)
tree7305788a45bffa1ed291c2f65af2dea1f7b8db29 /src/driver.s
parentd38a958f446aac1a6faa79277c140ab8a0ff03f4 (diff)
downloadjetpac.nes-4c8ed456d990ee99884e9dcd245f665ccb894b50.tar.gz
jetpac.nes-4c8ed456d990ee99884e9dcd245f665ccb894b50.zip
Disable the PPU between the title to main screens
During other transitions like game over and such it might also be needed to have something similar, but for now this should cut it. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'src/driver.s')
-rw-r--r--src/driver.s26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/driver.s b/src/driver.s
index 8b7f8ce..bb0303f 100644
--- a/src/driver.s
+++ b/src/driver.s
@@ -9,7 +9,25 @@
zp_player_timer = $30
PLAYER_TIMER_VALUE = HZ * 2
+ ;; Switch from the title screen to the main street. 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
+ ;; the `title over` flag. With that, call again this function so the
+ ;; switching is actually performed.
.proc switch
+ ;; Some things from here require the PPU to be disabled. Hence, if
+ ;; that's not the case, disable it now. The `ppu` and the `title over`
+ ;; flags are set as well.
+ lda PPU::zp_mask
+ beq @do_switch
+ lda #%01000100
+ ora Globals::zp_flags
+ sta Globals::zp_flags
+ lda #$00
+ sta PPU::zp_mask
+ rts
+
+ @do_switch:
;; Get the assets ready for the main screen. That is, make sure that the
;; palettes and such are as desired since the title screen needed
;; another setup.
@@ -19,6 +37,10 @@
lda #%10001010
sta PPU::zp_control
+ ;; Enable back the PPU.
+ lda #%00011110
+ sta PPU::zp_mask
+
;; Setup the player timer.
.ifdef PARTIAL
lda #1
@@ -28,10 +50,10 @@
sta zp_player_timer
;; Mark the state of the game as "game". That is, the player has
- ;; started. Also set the `ppu` flag so the PPU control update takes
- ;; place.
+ ;; started. Also set the `ppu` flag and unset the `title over` one.
lda #%01000001
ora Globals::zp_flags
+ and #%11111011
sta Globals::zp_flags
rts