aboutsummaryrefslogtreecommitdiff
path: root/src/vectors.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-05-15 06:41:32 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-05-15 06:41:32 +0200
commit6e274fb5025108bbf7cbe8173ce00f444a5f4445 (patch)
tree0733c534ed659896d231796b7136e70210f1348a /src/vectors.s
parent1b4058982e297a0c80750b9411f8be4d89ad2d3d (diff)
downloadjetpac.nes-6e274fb5025108bbf7cbe8173ce00f444a5f4445.tar.gz
jetpac.nes-6e274fb5025108bbf7cbe8173ce00f444a5f4445.zip
partial: Account for frame drops
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à <mikisabate@gmail.com>
Diffstat (limited to 'src/vectors.s')
-rw-r--r--src/vectors.s23
1 files changed, 22 insertions, 1 deletions
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.