From 4c8ed456d990ee99884e9dcd245f665ccb894b50 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 19 Mar 2025 17:28:36 +0100 Subject: Disable the PPU between the title to main screens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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à --- src/driver.s | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/driver.s') 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 -- cgit v1.2.3