Improve player NUSIZ during hblank.

This commit is contained in:
Christian Speckner 2017-03-08 00:01:19 +01:00
parent 12526783f8
commit e02166092d
3 changed files with 8 additions and 8 deletions

View File

@ -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; const uInt8 masked = value & 0x07;
@ -121,20 +121,20 @@ void Player::nusiz(uInt8 value)
case 0x21: case 0x21:
case 0x41: case 0x41:
if ((myRenderCounter - Count::renderCounterOffset) < 3) { if ((myRenderCounter - Count::renderCounterOffset) < (hblank ? 4 : 3)) {
setDivider(myDividerPending); setDivider(myDividerPending);
} else if ((myRenderCounter - Count::renderCounterOffset) < 5) { } else if ((myRenderCounter - Count::renderCounterOffset) < (hblank ? 6 : 5)) {
setDivider(myDividerPending); setDivider(myDividerPending);
myRenderCounter--; myRenderCounter--;
} else { } else {
myDividerChangeCounter = 1; myDividerChangeCounter = (hblank ? 0 : 1);
} }
break; break;
case 0x42: case 0x42:
case 0x24: case 0x24:
if (myRenderCounter < 1) if (myRenderCounter < 1 || (hblank && (myRenderCounter % myDivider == 1)))
setDivider(myDividerPending); setDivider(myDividerPending);
else else
myDividerChangeCounter = (myDivider - (myRenderCounter - 1) % myDivider); myDividerChangeCounter = (myDivider - (myRenderCounter - 1) % myDivider);

View File

@ -36,7 +36,7 @@ class Player : public Serializable
void hmp(uInt8 value); void hmp(uInt8 value);
uInt8 hmp() const { return myHmmClocks; } uInt8 hmp() const { return myHmmClocks; }
void nusiz(uInt8 value); void nusiz(uInt8 value, bool hblank);
void resp(uInt8 counter); void resp(uInt8 counter);

View File

@ -507,13 +507,13 @@ bool TIA::poke(uInt16 address, uInt8 value)
case NUSIZ0: case NUSIZ0:
myLinesSinceChange = 0; myLinesSinceChange = 0;
myMissile0.nusiz(value); myMissile0.nusiz(value);
myPlayer0.nusiz(value); myPlayer0.nusiz(value, myHstate == HState::blank);
break; break;
case NUSIZ1: case NUSIZ1:
myLinesSinceChange = 0; myLinesSinceChange = 0;
myMissile1.nusiz(value); myMissile1.nusiz(value);
myPlayer1.nusiz(value); myPlayer1.nusiz(value, myHstate == HState::blank);
break; break;
case HMM0: case HMM0: