Tie state transitions directly to hctr in order to avoid edge cases during RSYNC.

This commit is contained in:
Christian Speckner 2017-06-22 00:16:24 +02:00
parent 881dc86ab7
commit ccafbf2bbd
2 changed files with 14 additions and 11 deletions

View File

@ -110,7 +110,6 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::reset()
{
myHblankCtr = 0;
myHctr = 0;
myMovementInProgress = false;
myExtendedHblank = false;
@ -229,7 +228,6 @@ bool TIA::save(Serializer& out) const
out.putInt(int(myHstate));
out.putInt(myHblankCtr);
out.putInt(myHctr);
out.putInt(myXDelta);
out.putInt(myXAtRenderingStart);
@ -299,7 +297,6 @@ bool TIA::load(Serializer& in)
myHstate = HState(in.getInt());
myHblankCtr = in.getInt();
myHctr = in.getInt();
myXDelta = in.getInt();
myXAtRenderingStart = in.getInt();
@ -1105,11 +1102,19 @@ void TIA::tickMovement()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::tickHblank()
{
if (myHctr == 0) {
myHblankCtr = 0;
}
switch (myHctr) {
case 0:
myExtendedHblank = false;
break;
if (++myHblankCtr >= 68) myHstate = HState::frame;
case 67:
if (!myExtendedHblank) myHstate = HState::frame;
break;
case 75:
if (myExtendedHblank) myHstate = HState::frame;
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1155,7 +1160,6 @@ void TIA::nextLine()
if (!myMovementInProgress && myLinesSinceChange < 2) myLinesSinceChange++;
myHstate = HState::blank;
myExtendedHblank = false;
myXDelta = 0;
myFrameManager.nextLine();
@ -1289,7 +1293,6 @@ void TIA::delayedWrite(uInt8 address, uInt8 value)
myMovementInProgress = true;
if (!myExtendedHblank) {
myHblankCtr -= 8;
clearHmoveComb();
myExtendedHblank = true;
}

View File

@ -476,8 +476,8 @@ class TIA : public Device
HState myHstate;
Int32 myHblankCtr;
Int32 myHctr;
uInt8 myHctr;
uInt32 myXDelta;
uInt32 myXAtRenderingStart;