From a379ad4c1aed147a3dd33e2fc8c613dda8695aca Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Mon, 4 May 2020 14:19:02 -0230
Subject: [PATCH] Added '_scanend' pseudo-register to track scanlines at end of
last frame. Fixes #624.
---
Changes.txt | 3 +++
docs/debugger.html | 1 +
src/debugger/Debugger.cxx | 5 +++--
src/debugger/Debugger.hxx | 2 +-
src/yacc/YaccParser.cxx | 4 +++-
5 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/Changes.txt b/Changes.txt
index 2fe5ad2b5..2fb02da2b 100644
--- a/Changes.txt
+++ b/Changes.txt
@@ -40,6 +40,9 @@
* Removed unused CV+ and DASH bank switching types.
+ * Added debugger pseudo-register '_scanend', which gives the number of
+ scanlines at the end of the last frame.
+
-Have fun!
diff --git a/docs/debugger.html b/docs/debugger.html
index 4f0c1cf6f..91e71bd47 100644
--- a/docs/debugger.html
+++ b/docs/debugger.html
@@ -755,6 +755,7 @@ that holds 'number of scanlines' on an actual console).
_fcycles | Number of cycles since frame started |
_icycles | Number of cycles of last instruction |
_scan | Current scanline count |
+ _scanend | Scanline count at end of last frame |
_scycles | Number of cycles in current scanline |
_vblank | Whether vertical blank is enabled (1 or 0) |
_vsync | Whether vertical sync is enabled (1 or 0) |
diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx
index 6f5078228..b46570a6a 100644
--- a/src/debugger/Debugger.cxx
+++ b/src/debugger/Debugger.cxx
@@ -875,7 +875,7 @@ std::array Debugger::ourBuiltinFunctions = { {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Names are defined here, but processed in YaccParser
-std::array Debugger::ourPseudoRegisters = { {
+std::array Debugger::ourPseudoRegisters = { {
// Debugger::PseudoRegister Debugger::ourPseudoRegisters[NUM_PSEUDO_REGS] = {
{ "_bank", "Currently selected bank" },
{ "_cclocks", "Color clocks on current scanline" },
@@ -883,8 +883,9 @@ std::array Debugger::ourPseudoRegisters = { {
{ "_cycleslo", "Lower 32 bits of number of cycles since emulation started" },
{ "_fcount", "Number of frames since emulation started" },
{ "_fcycles", "Number of cycles since frame started" },
- { "_icycles", "Number of cycles of last instruction" },
+ { "_icycles", "Number of cycles of last instruction" },
{ "_scan", "Current scanline count" },
+ { "_scanend", "Scanline count at end of last frame" },
{ "_scycles", "Number of cycles in current scanline" },
{ "_vblank", "Whether vertical blank is enabled (1 or 0)" },
{ "_vsync", "Whether vertical sync is enabled (1 or 0)" }
diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx
index 2b0ce6c1c..d063f2e90 100644
--- a/src/debugger/Debugger.hxx
+++ b/src/debugger/Debugger.hxx
@@ -363,7 +363,7 @@ class Debugger : public DialogContainer
string name, help;
};
static std::array ourBuiltinFunctions;
- static std::array ourPseudoRegisters;
+ static std::array ourPseudoRegisters;
private:
// rewind/unwind n states
diff --git a/src/yacc/YaccParser.cxx b/src/yacc/YaccParser.cxx
index 82163c433..8bc728ca0 100644
--- a/src/yacc/YaccParser.cxx
+++ b/src/yacc/YaccParser.cxx
@@ -234,7 +234,9 @@ TiaMethod getTiaSpecial(char* ch)
{
if(BSPF::equalsIgnoreCase(ch, "_scan"))
return &TIADebug::scanlines;
- if(BSPF::equalsIgnoreCase(ch, "_scycles"))
+ else if(BSPF::equalsIgnoreCase(ch, "_scanend"))
+ return &TIADebug::scanlinesLastFrame;
+ else if(BSPF::equalsIgnoreCase(ch, "_scycles"))
return &TIADebug::cyclesThisLine;
else if(BSPF::equalsIgnoreCase(ch, "_fcount"))
return &TIADebug::frameCount;