diff --git a/src/emucore/tia/Player.cxx b/src/emucore/tia/Player.cxx index d8b0ce5e3..d2936fe92 100644 --- a/src/emucore/tia/Player.cxx +++ b/src/emucore/tia/Player.cxx @@ -72,7 +72,7 @@ void Player::hmp(uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Player::nusiz(uInt8 value) +void Player::nusiz(uInt8 value, bool hblank) { const uInt8 masked = value & 0x07; @@ -121,20 +121,20 @@ void Player::nusiz(uInt8 value) case 0x21: case 0x41: - if ((myRenderCounter - Count::renderCounterOffset) < 3) { + if ((myRenderCounter - Count::renderCounterOffset) < (hblank ? 4 : 3)) { setDivider(myDividerPending); - } else if ((myRenderCounter - Count::renderCounterOffset) < 5) { + } else if ((myRenderCounter - Count::renderCounterOffset) < (hblank ? 6 : 5)) { setDivider(myDividerPending); myRenderCounter--; } else { - myDividerChangeCounter = 1; + myDividerChangeCounter = (hblank ? 0 : 1); } break; case 0x42: case 0x24: - if (myRenderCounter < 1) + if (myRenderCounter < 1 || (hblank && (myRenderCounter % myDivider == 1))) setDivider(myDividerPending); else myDividerChangeCounter = (myDivider - (myRenderCounter - 1) % myDivider); diff --git a/src/emucore/tia/Player.hxx b/src/emucore/tia/Player.hxx index 4f6a76dc9..fb7091b6e 100644 --- a/src/emucore/tia/Player.hxx +++ b/src/emucore/tia/Player.hxx @@ -36,7 +36,7 @@ class Player : public Serializable void hmp(uInt8 value); uInt8 hmp() const { return myHmmClocks; } - void nusiz(uInt8 value); + void nusiz(uInt8 value, bool hblank); void resp(uInt8 counter); diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index fb85c041e..cfa96c936 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -507,13 +507,13 @@ bool TIA::poke(uInt16 address, uInt8 value) case NUSIZ0: myLinesSinceChange = 0; myMissile0.nusiz(value); - myPlayer0.nusiz(value); + myPlayer0.nusiz(value, myHstate == HState::blank); break; case NUSIZ1: myLinesSinceChange = 0; myMissile1.nusiz(value); - myPlayer1.nusiz(value); + myPlayer1.nusiz(value, myHstate == HState::blank); break; case HMM0: