diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index be7670c2d..ef8119ee6 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -99,6 +99,8 @@ static const char* const pseudo_registers[][2] = { { "_cclocks", "Color clocks on current scanline" }, { "_fcount", "Number of frames since emulation started" }, { "_fcycles", "Number of cycles since frame started" }, + { "_cyclesLo", "Lower 32 bits of number of cycles since emulation started"}, + { "_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" }, { "_vblank", "Whether vertical blank is enabled (1 or 0)" }, diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index 86aae9bcf..84fae67ec 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -700,6 +700,18 @@ int TIADebug::frameCycles() const return myTIA.frameCycles(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int TIADebug::cyclesLo() const +{ + return (int)myTIA.cycles(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int TIADebug::cyclesHi() const +{ + return (int)(myTIA.cycles() >> 32); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int TIADebug::scanlines() const { diff --git a/src/debugger/TIADebug.hxx b/src/debugger/TIADebug.hxx index cdebc0878..3830d75f1 100644 --- a/src/debugger/TIADebug.hxx +++ b/src/debugger/TIADebug.hxx @@ -160,6 +160,8 @@ class TIADebug : public DebuggerSystem int scanlinesLastFrame() const; int frameCount() const; int frameCycles() const; + int cyclesLo() const; + int cyclesHi() const; int clocksThisLine() const; bool vsync() const; bool vblank() const; diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 4d8ecf2b0..d1e925b2f 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -819,6 +819,12 @@ uInt32 TIA::frameCycles() const return uInt32(mySystem->cycles() - myCyclesAtFrameStart); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt64 TIA::cycles() const +{ + return uInt64(mySystem->cycles()); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool TIA::electronBeamPos(uInt32& x, uInt32& y) const { diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index 657006557..538aebaf2 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -263,6 +263,11 @@ class TIA : public Device */ uInt32 frameCycles() const; + /** + Answers the total system cycles from the start of the current ROM's emulation. + */ + uInt64 cycles() const; + /** Answers whether the TIA is currently in being rendered (we're in between the start and end of drawing a frame). diff --git a/src/yacc/YaccParser.cxx b/src/yacc/YaccParser.cxx index 6f950d8d1..6a010b720 100644 --- a/src/yacc/YaccParser.cxx +++ b/src/yacc/YaccParser.cxx @@ -219,6 +219,10 @@ TiaMethod getTiaSpecial(char* ch) return &TIADebug::frameCount; else if(BSPF::equalsIgnoreCase(ch, "_fcycles")) return &TIADebug::frameCycles; + else if(BSPF::equalsIgnoreCase(ch, "_cyclesLo")) + return &TIADebug::cyclesLo; + else if(BSPF::equalsIgnoreCase(ch, "_cyclesHi")) + return &TIADebug::cyclesHi; else if(BSPF::equalsIgnoreCase(ch, "_cclocks")) return &TIADebug::clocksThisLine; else if(BSPF::equalsIgnoreCase(ch, "_vsync"))