From 53d47454792ae0de01738099470db85c80bd5daa Mon Sep 17 00:00:00 2001 From: thrust26 Date: Thu, 12 Oct 2017 21:08:24 +0200 Subject: [PATCH] pseudo-op "_scycles" (cycles into current scanline) added --- src/debugger/Debugger.cxx | 1 + src/debugger/Debugger.hxx | 2 +- src/debugger/TIADebug.cxx | 6 ++++++ src/debugger/TIADebug.hxx | 1 + src/yacc/YaccParser.cxx | 2 ++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index ce7a8755e..bb9cb726b 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -732,6 +732,7 @@ Debugger::PseudoRegister Debugger::ourPseudoRegisters[NUM_PSEUDO_REGS] = { { "_cyclesHi", "Higher 32 bits of number of cycles since emulation started"}, { "_rwport", "Address at which a read from a write port occurred" }, { "_scan", "Current scanline count" }, + { "_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)" } // CPU address access functions: diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 45f891bf2..bcc3c03f5 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -322,7 +322,7 @@ class Debugger : public DialogContainer string name, help; }; static const uInt32 NUM_BUILTIN_FUNCS = 18; - static const uInt32 NUM_PSEUDO_REGS = 10; + static const uInt32 NUM_PSEUDO_REGS = 11; static BuiltinFunction ourBuiltinFunctions[NUM_BUILTIN_FUNCS]; static PseudoRegister ourPseudoRegisters[NUM_PSEUDO_REGS]; diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index 4d2615972..cefffdcb6 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -730,6 +730,12 @@ int TIADebug::clocksThisLine() const return myTIA.clocksThisLine(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int TIADebug::cyclesThisLine() const +{ + return myTIA.clocksThisLine()/3; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool TIADebug::vsync() const { diff --git a/src/debugger/TIADebug.hxx b/src/debugger/TIADebug.hxx index 3830d75f1..ecf28eee2 100644 --- a/src/debugger/TIADebug.hxx +++ b/src/debugger/TIADebug.hxx @@ -163,6 +163,7 @@ class TIADebug : public DebuggerSystem int cyclesLo() const; int cyclesHi() const; int clocksThisLine() const; + int cyclesThisLine() const; bool vsync() const; bool vblank() const; int vsyncAsInt() const { return int(vsync()); } // so we can use _vsync pseudo-register diff --git a/src/yacc/YaccParser.cxx b/src/yacc/YaccParser.cxx index e194d8ed4..80bc01551 100644 --- a/src/yacc/YaccParser.cxx +++ b/src/yacc/YaccParser.cxx @@ -229,6 +229,8 @@ TiaMethod getTiaSpecial(char* ch) { if(BSPF::equalsIgnoreCase(ch, "_scan")) return &TIADebug::scanlines; + if(BSPF::equalsIgnoreCase(ch, "_scycles")) + return &TIADebug::cyclesThisLine; else if(BSPF::equalsIgnoreCase(ch, "_fcount")) return &TIADebug::frameCount; else if(BSPF::equalsIgnoreCase(ch, "_fcycles"))