Skip to content

Commit

Permalink
eliminated cycles() method in TIA.hxx
Browse files Browse the repository at this point in the history
  • Loading branch information
thrust26 committed Dec 29, 2024
1 parent 9b1a72a commit 42dda2b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/common/RewindManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool RewindManager::addState(string_view message, bool timeMachine)
interval = interval * scanlines / 262;
}

if(myOSystem.console().tia().cycles() - lastState.cycles < interval)
if(myOSystem.console().system().cycles() - lastState.cycles < interval)
return false;
}

Expand All @@ -135,7 +135,7 @@ bool RewindManager::addState(string_view message, bool timeMachine)
if(myStateManager.saveState(s) && myOSystem.console().tia().saveDisplay(s))
{
state.message = message;
state.cycles = myOSystem.console().tia().cycles();
state.cycles = myOSystem.console().system().cycles();
myLastTimeMachineAdd = timeMachine;
return true;
}
Expand All @@ -145,7 +145,7 @@ bool RewindManager::addState(string_view message, bool timeMachine)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 RewindManager::rewindStates(uInt32 numStates)
{
const uInt64 startCycles = myOSystem.console().tia().cycles();
const uInt64 startCycles = myOSystem.console().system().cycles();
uInt32 i{0};
string message;

Expand Down Expand Up @@ -185,7 +185,7 @@ uInt32 RewindManager::rewindStates(uInt32 numStates)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 RewindManager::unwindStates(uInt32 numStates)
{
const uInt64 startCycles = myOSystem.console().tia().cycles();
const uInt64 startCycles = myOSystem.console().system().cycles();
uInt32 i{0};
string message;

Expand Down
4 changes: 2 additions & 2 deletions src/debugger/Debugger.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,9 @@ uInt16 Debugger::windStates(uInt16 numStates, bool unwind, string& message)

unlockSystem();

const uInt64 startCycles = myOSystem.console().tia().cycles();
const uInt64 startCycles = myOSystem.console().system().cycles();
const uInt16 winds = r.windStates(numStates, unwind);
message = r.getUnitString(myOSystem.console().tia().cycles() - startCycles);
message = r.getUnitString(myOSystem.console().system().cycles() - startCycles);

lockSystem();

Expand Down
4 changes: 2 additions & 2 deletions src/debugger/TIADebug.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -927,13 +927,13 @@ int TIADebug::frameWsyncCycles() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int TIADebug::cyclesLo() const
{
return static_cast<int>(myTIA.cycles());
return static_cast<int>(mySystem.cycles());
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int TIADebug::cyclesHi() const
{
return static_cast<int>(myTIA.cycles() >> 32);
return static_cast<int>(mySystem.cycles() >> 32);
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
4 changes: 2 additions & 2 deletions src/emucore/tia/TIA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ bool TIA::poke(uInt16 address, uInt8 value)
break;

case VSYNC:
myFrameManager->setVsync(value & 0x02, mySystem->cycles());
myFrameManager->setVsync(value & 0x02, myTimestamp / 3);
myShadowRegisters[address] = value;
break;

Expand Down Expand Up @@ -1935,7 +1935,7 @@ void TIA::delayedWrite(uInt8 address, uInt8 value)
{
case VBLANK:
flushLineCache();
myFrameManager->setVblank(value & 0x02, mySystem->cycles());
myFrameManager->setVblank(value & 0x02, myTimestamp / 3);
break;

case HMOVE:
Expand Down
5 changes: 0 additions & 5 deletions src/emucore/tia/TIA.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,6 @@ class TIA : public Device
*/
uInt32 frameBufferScanlinesLastFrame() const { return myFrameBufferScanlines; }

/**
Answers the total system cycles from the start of the emulation.
*/
uInt64 cycles() const { return mySystem->cycles(); }

#ifdef DEBUGGER_SUPPORT
/**
Answers the frame count from the start of the emulation.
Expand Down
2 changes: 1 addition & 1 deletion src/gui/TimeMachineDialog.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ void TimeMachineDialog::handleWinds(Int32 numWinds)
if(numWinds < 0) r.rewindStates(-numWinds);
else if(numWinds > 0) r.unwindStates(numWinds);

const uInt64 elapsed = instance().console().tia().cycles() - startCycles;
const uInt64 elapsed = instance().console().system().cycles() - startCycles;
if(elapsed > 0)
{
const string message = r.getUnitString(elapsed);
Expand Down

0 comments on commit 42dda2b

Please sign in to comment.