Add call to resetCycles.

This commit is contained in:
Christian Speckner 2016-12-12 22:51:42 +01:00
parent a35f378d87
commit b28dfaa31f
2 changed files with 10 additions and 10 deletions

View File

@ -78,6 +78,7 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
},
[this] () {
mySystem->m6502().stop();
mySystem->resetCycles();
}
);
@ -146,6 +147,7 @@ void TIA::systemCyclesReset()
const uInt32 cycles = mySystem->cycles();
myLastCycle -= cycles;
mySound.adjustCycleCounter(-1 * cycles);
}
@ -897,15 +899,17 @@ void TIA::updateScanlineByTrace(int target)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::updateEmulation()
{
const uInt32 cycles = mySystem->cycles();
const uInt32 systemCycles = mySystem->cycles();
if (mySubClock > 2)
throw runtime_error("subclock exceeds range");
cycle(3 * (cycles - myLastCycle) + mySubClock);
const uInt32 cyclesToRun = 3 * (systemCycles - myLastCycle) + mySubClock;
mySubClock = 0;
myLastCycle = cycles;
myLastCycle = systemCycles;
cycle(cyclesToRun);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -383,10 +383,6 @@ class TIA : public Device
void nextLine();
void onFrameComplete();
void onFrameStart();
void delayedWrite(uInt8 address, uInt8 value);
void updatePaddle(uInt8 idx);
@ -421,7 +417,7 @@ class TIA : public Device
uInt8 myCtrlPF; // needed for the debugger
uInt8 mySubClock;
uInt32 myLastCycle;
Int32 myLastCycle;
uInt8 mySpriteEnabledBits;
uInt8 myCollisionsEnabledBits;