Avoid side effects if the divider is unchanged by a NUSIZ write.

This commit is contained in:
Christian Speckner 2017-02-06 21:12:41 +01:00
parent 1a7ac60232
commit cef5fb4da0
1 changed files with 14 additions and 3 deletions

View File

@ -84,6 +84,13 @@ void Player::nusiz(uInt8 value)
break; break;
} }
myDecodes = DrawCounterDecodes::get().playerDecodes()[masked];
if (myDividerPending == myDivider) return;
// The following is an effective description of the effects of NUSIZ during
// decode and rendering.
if (myIsRendering) { if (myIsRendering) {
switch ((myDivider << 4) | myDividerPending) { switch ((myDivider << 4) | myDividerPending) {
@ -108,19 +115,23 @@ void Player::nusiz(uInt8 value)
break; break;
default: case 0x42:
case 0x24:
if (myRenderCounter < 1) if (myRenderCounter < 1)
myDivider = myDividerPending; myDivider = myDividerPending;
else else
myDividerChangeCounter = (myDivider - (myRenderCounter - 1) % myDivider); myDividerChangeCounter = (myDivider - (myRenderCounter - 1) % myDivider);
break; break;
default:
// should never happen
myDivider = myDividerPending;
break;
} }
} else { } else {
myDivider = myDividerPending; myDivider = myDividerPending;
} }
myDecodes = DrawCounterDecodes::get().playerDecodes()[masked];
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -