From 6e274fb5025108bbf7cbe8173ce00f444a5f4445 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 15 May 2025 06:41:32 +0200 Subject: partial: Account for frame drops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define tracing variables when PARTIAL=1, which is only on a development environment. This way we can detect whether we are dropping frames or not. Signed-off-by: Miquel Sabaté Solà --- src/vectors.s | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/vectors.s b/src/vectors.s index 8928aaf..75de30a 100644 --- a/src/vectors.s +++ b/src/vectors.s @@ -3,6 +3,12 @@ .segment "CODE" +;; Debug utilities. +.scope Debug + ;; Counter for frame drops. + zp_frame_drops = $90 +.endscope + ;; Pretty standard reset function, nothing crazy. .proc reset ;; Disable interrupts and decimal mode. @@ -29,6 +35,12 @@ bit PPU::STATUS bpl @vblankwait1 + ;; Initialize the counter for frame drops before any NMIs can come in. + .ifdef PARTIAL + lda #0 + sta Debug::zp_frame_drops + .endif + ;; Reset all sprites by simply moving the Y coordinate out of screen. lda #$EF ldx #0 @@ -60,7 +72,13 @@ .proc nmi ;; Should we skip it? bit Globals::zp_flags - bpl @end + + ;; If we are on a dev environment, account for any frame drops. + .ifdef PARTIAL + bpl @account_for_frame_drop + .else + bpl @end + .endif ;; Save registers. pha @@ -131,6 +149,9 @@ @end: rti +@account_for_frame_drop: + inc Debug::zp_frame_drops + rti .endproc ;; Unused. -- cgit v1.2.3