From 60702917691e82472d465a514c162077adbb2db0 Mon Sep 17 00:00:00 2001 From: Christian Speckner Date: Sat, 21 Jan 2017 00:45:00 +0100 Subject: [PATCH] Slight improvement of the description of NUSIZ during draw. --- src/emucore/tia/Player.cxx | 13 ++++++++++--- src/emucore/tia/Player.hxx | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/emucore/tia/Player.cxx b/src/emucore/tia/Player.cxx index b34c5c3b4..581e64322 100644 --- a/src/emucore/tia/Player.cxx +++ b/src/emucore/tia/Player.cxx @@ -40,6 +40,7 @@ void Player::reset() myCounter = 0; myIsMoving = false; myWidth = 8; + myEffectiveWidth = 8; myIsRendering = false; myRenderCounter = 0; myPatternOld = 0; @@ -83,8 +84,13 @@ void Player::nusiz(uInt8 value) myDecodes = DrawCounterDecodes::get().playerDecodes()[masked]; - if (myIsRendering && myRenderCounter >= myWidth) - myIsRendering = false; + // This is an incomplete description of the effects seen in issues #87 and #82. More investigation + // is required for a complete description (#63) + if (myIsRendering && myRenderCounter >= (8 - myWidth - 2) && oldWidth == 8 && myWidth != oldWidth) { + myEffectiveWidth = 8; + } else { + myEffectiveWidth = oldWidth; + } // NUSIZ during decode seems to affect the decoding logic. The rods in Meltdown // are highly sensitive to this effect, and this seems to model it adequately. @@ -201,8 +207,9 @@ void Player::tick() { if (myDecodes[myCounter]) { myIsRendering = true; + myEffectiveWidth = myWidth; myRenderCounter = myWidth > 8 ? Count::renderCounterOffsetWide : Count::renderCounterOffset; - } else if (myIsRendering && ++myRenderCounter >= myWidth) { + } else if (myIsRendering && ++myRenderCounter >= myEffectiveWidth) { myIsRendering = false; } diff --git a/src/emucore/tia/Player.hxx b/src/emucore/tia/Player.hxx index 122d3dd6d..f5b009fb8 100644 --- a/src/emucore/tia/Player.hxx +++ b/src/emucore/tia/Player.hxx @@ -103,6 +103,7 @@ class Player : public Serializable uInt8 myCounter; bool myIsMoving; uInt8 myWidth; + uInt8 myEffectiveWidth; bool myIsRendering; Int8 myRenderCounter;