mirror of https://github.com/stella-emu/stella.git
Introduce shadow registers, start refactoring TIADebug to use them.
This commit is contained in:
parent
eb209ee1dd
commit
b3bfc86ccc
|
@ -185,7 +185,7 @@ bool TIADebug::vdelP0(int newVal)
|
|||
if(newVal > -1)
|
||||
mySystem.poke(VDELP0, bool(newVal));
|
||||
|
||||
return myTIA.myPlayer0.vdelp();
|
||||
return (myTIA.valueLastWrittenToRegister(VDELP0) & 0x01) > 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -194,7 +194,7 @@ bool TIADebug::vdelP1(int newVal)
|
|||
if(newVal > -1)
|
||||
mySystem.poke(VDELP1, bool(newVal));
|
||||
|
||||
return myTIA.myPlayer1.vdelp();
|
||||
return (myTIA.valueLastWrittenToRegister(VDELP1) & 0x01) > 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -44,7 +44,6 @@ class Player : public Serializable
|
|||
bool refp() const { return myIsReflected; }
|
||||
|
||||
void vdelp(uInt8 value);
|
||||
bool vdelp() const { return myIsDelaying; }
|
||||
|
||||
void toggleEnabled(bool enabled);
|
||||
|
||||
|
|
|
@ -118,6 +118,8 @@ void TIA::reset()
|
|||
mySubClock = 0;
|
||||
myXDelta = 0;
|
||||
|
||||
memset(myShadowRegisters, 0, 64);
|
||||
|
||||
myBackground.reset();
|
||||
myPlayfield.reset();
|
||||
myMissile0.reset();
|
||||
|
@ -432,6 +434,7 @@ bool TIA::poke(uInt16 address, uInt8 value)
|
|||
updateEmulation();
|
||||
|
||||
address &= 0x3F;
|
||||
myShadowRegisters[address] = value;
|
||||
|
||||
switch (address)
|
||||
{
|
||||
|
@ -923,6 +926,12 @@ void TIA::updateScanlineByTrace(int target)
|
|||
updateScanlineByStep();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIA::valueLastWrittenToRegister(uInt8 reg) const
|
||||
{
|
||||
return reg < 64 ? myShadowRegisters[reg] : 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIA::updateEmulation()
|
||||
{
|
||||
|
|
|
@ -308,6 +308,9 @@ class TIA : public Device
|
|||
*/
|
||||
void updateScanlineByTrace(int target);
|
||||
|
||||
// Retrieve the last value written to a certain register
|
||||
uInt8 valueLastWrittenToRegister(uInt8 reg) const;
|
||||
|
||||
/**
|
||||
Save the current state of this device to the given Serializer.
|
||||
|
||||
|
@ -459,6 +462,8 @@ class TIA : public Device
|
|||
|
||||
double myTimestamp;
|
||||
|
||||
uInt8 myShadowRegisters[64];
|
||||
|
||||
// Automatic framerate correction based on number of scanlines
|
||||
bool myAutoFrameEnabled;
|
||||
|
||||
|
|
Loading…
Reference in New Issue