From 3302f760f1461bc4582c99ee2e4ed0ccc1d5b186 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 6 Mar 2026 16:14:17 +0100 Subject: Don't toggle pause from a holded button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If you just holded the Select or Start buttons, it would be forever toggling pause/unpause, which is an unexpected behavior. Fix this by saving which value from the joypad was previously read. With this, whenever the pause timer reaches zero, we can check whether either button is still pressed, and avoid toggling if that is the case. Signed-off-by: Miquel Sabaté Solà --- include/joypad.s | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/joypad.s') diff --git a/include/joypad.s b/include/joypad.s index f7268e8..cc15d02 100644 --- a/include/joypad.s +++ b/include/joypad.s @@ -13,6 +13,9 @@ m_joypad1 = $4016 ;; m_joypad2 = $4017 + ;; The previous reading from the latest read controller. + zp_prev = $21 + ;; After running a `read_*` function these two variables will contain the ;; given result. zp_buttons1 = $22 @@ -68,5 +71,7 @@ ;; Shortcut for reading the joypad from the first player safely. .macro READ_JOYPAD1 ldx #$00 + lda Joypad::zp_buttons1 + sta Joypad::zp_prev jsr Joypad::read_x .endmacro -- cgit v1.2.3