From 35ca35294a08dff39c3f4cca9eb0e8c31436b6a3 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 20 Mar 2026 15:29:15 +0100 Subject: Don't rely on the 'y' register in Over::handle() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the functions being called from within will in fact tamper with this value. Hence, use the free 'Globals::zp_arg3' variable. Signed-off-by: Miquel Sabaté Solà --- .nasm/segments.txt | 2 +- src/over.s | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.nasm/segments.txt b/.nasm/segments.txt index 8a0f57c..53bf262 100644 --- a/.nasm/segments.txt +++ b/.nasm/segments.txt @@ -1,4 +1,4 @@ - HEADER: 16/16 (100%) -- ROM0: 8240/32762 (25.15%) +- ROM0: 8244/32762 (25.16%) - ROMV: 6/6 (100%) - ROM2: 8192/8192 (100%) diff --git a/src/over.s b/src/over.s index cca59ae..6fb1db1 100644 --- a/src/over.s +++ b/src/over.s @@ -27,7 +27,8 @@ ;; It will set 1 to the 'a' register if the timer has run out, signaling ;; that the game can start over. Otherwise it sets 0 to the 'a' register. .proc handle - ldy #0 + lda #0 + sta Globals::zp_arg3 ;; Has the "Game over" screen been displayed? If not do it now. lda Over::zp_displayed @@ -38,13 +39,13 @@ @do_handle: lda Over::zp_timer bne @dec_timer - iny + inc Globals::zp_arg3 beq @end @dec_timer: dec Over::zp_timer @end: - tya + lda Globals::zp_arg3 rts .endproc -- cgit v1.2.3