Even more accurate RESMx.

This commit is contained in:
Christian Speckner 2017-01-26 01:02:33 +01:00
parent 990fac5895
commit 94292bbbd1
3 changed files with 17 additions and 9 deletions

View File

@ -67,7 +67,7 @@ void Missile::hmm(uInt8 value)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Missile::resm(uInt8 counter)
void Missile::resm(uInt8 counter, uInt32 hctr)
{
myCounter = counter;
@ -76,26 +76,34 @@ void Missile::resm(uInt8 counter)
myRenderCounter = Count::renderCounterOffset + (counter - 157);
} else {
// The following is an effective description of the behavior of missile width after a
// RESMx during draw. It would be much simpler without the HBLANK cases :)
uInt8 delta = 0;
bool hblank = counter != 157;
if (hblank) {
if (hctr > 72) delta = 0;
else if (hctr > 66) delta = 1;
else delta = 2;
}
switch (myWidth) {
case 8:
myRenderCounter = (counter - 157) + ((myRenderCounter >= 4) ? 5 : 0);
myRenderCounter = delta + ((myRenderCounter >= 4) ? 5 : 0);
break;
case 4:
myRenderCounter = counter - 157;
myRenderCounter = delta;
break;
case 2:
if (counter != 157) myIsRendering = myRenderCounter > 1;
if (hblank) myIsRendering = myRenderCounter > 1;
else if (myRenderCounter == 0) myRenderCounter++;
break;
default:
if (counter != 157) myIsRendering = myRenderCounter > 0;
if (hblank) myIsRendering = myRenderCounter > 0;
break;
}

View File

@ -37,7 +37,7 @@ class Missile : public Serializable
void hmm(uInt8 value);
uInt32 hmm() const { return myHmmClocks; }
void resm(uInt8 counter);
void resm(uInt8 counter, uInt32 hctr);
void resmp(uInt8 value, const Player& player);
bool resmp() const { return bool(myResmp); }

View File

@ -459,12 +459,12 @@ bool TIA::poke(uInt16 address, uInt8 value)
case RESM0:
myLinesSinceChange = 0;
myMissile0.resm(resxCounter());
myMissile0.resm(resxCounter(), myHctr);
break;
case RESM1:
myLinesSinceChange = 0;
myMissile1.resm(resxCounter());
myMissile1.resm(resxCounter(), myHctr);
break;
case RESMP0: