Fix TIA info in debugger after RSYNC.

This commit is contained in:
Christian Speckner 2017-06-22 01:07:58 +02:00
parent ccafbf2bbd
commit b30ca12731
2 changed files with 16 additions and 12 deletions

View File

@ -124,7 +124,7 @@ void TIA::reset()
myColorHBlank = 0;
myLastCycle = 0;
mySubClock = 0;
myXDelta = 0;
myHctrDelta = 0;
myXAtRenderingStart = 0;
memset(myShadowRegisters, 0, 64);
@ -229,7 +229,7 @@ bool TIA::save(Serializer& out) const
out.putInt(int(myHstate));
out.putInt(myHctr);
out.putInt(myXDelta);
out.putInt(myHctrDelta);
out.putInt(myXAtRenderingStart);
out.putBool(myCollisionUpdateRequired);
@ -298,7 +298,7 @@ bool TIA::load(Serializer& in)
myHstate = HState(in.getInt());
myHctr = in.getInt();
myXDelta = in.getInt();
myHctrDelta = in.getInt();
myXAtRenderingStart = in.getInt();
myCollisionUpdateRequired = in.getBool();
@ -778,7 +778,7 @@ bool TIA::electronBeamPos(uInt32& x, uInt32& y) const
{
uInt8 clocks = clocksThisLine();
x = clocks < 68 ? 0 : clocks - 68;
x = (clocks < 68) ? 0 : clocks - 68;
y = myFrameManager.getY();
return isRendering();
@ -1121,7 +1121,7 @@ void TIA::tickHblank()
void TIA::tickHframe()
{
const uInt32 y = myFrameManager.getY();
const uInt32 x = myHctr - 68 - myXDelta;
const uInt32 x = myHctr - 68 - myHctrDelta;
myCollisionUpdateRequired = true;
@ -1141,7 +1141,7 @@ void TIA::applyRsync()
{
const uInt32 x = myHctr > 68 ? myHctr - 68 : 0;
myXDelta = 157 - x;
myHctrDelta = 225 - myHctr;
if (myFrameManager.isRendering())
memset(myFramebuffer.get() + myFrameManager.getY() * 160 + x, 0, 160 - x);
@ -1160,7 +1160,7 @@ void TIA::nextLine()
if (!myMovementInProgress && myLinesSinceChange < 2) myLinesSinceChange++;
myHstate = HState::blank;
myXDelta = 0;
myHctrDelta = 0;
myFrameManager.nextLine();

View File

@ -214,7 +214,7 @@ class TIA : public Device
@return The current color clock
*/
uInt32 clocksThisLine() const { return myHctr - myXDelta; }
uInt32 clocksThisLine() const { return myHctr - myHctrDelta; }
/**
Answers the total number of scanlines the TIA generated in producing
@ -331,7 +331,9 @@ class TIA : public Device
Get the current x value.
*/
uInt8 getPosition() const {
return (myHctr < 68) ? 0 : (myHctr - 68 - myXDelta);
uInt8 realHctr = myHctr - myHctrDelta;
return (realHctr < 68) ? 0 : (realHctr - 68);
}
/**
@ -476,10 +478,12 @@ class TIA : public Device
HState myHstate;
// Master line counter
uInt8 myHctr;
uInt32 myXDelta;
uInt32 myXAtRenderingStart;
// Delta between master line counter and actual color clock. Nonzero after RSYNC (before the scanline terminates)
Int32 myHctrDelta;
// Electron beam x at rendering start (used for blanking out any pixels from the last frame that are not overwritten)
uInt8 myXAtRenderingStart;
bool myCollisionUpdateRequired;
uInt32 myCollisionMask;