Add files via upload

This commit is contained in:
alyosha-tas 2016-05-15 20:43:21 -04:00
parent 70fdbba229
commit 0551099ac7
3 changed files with 120 additions and 144 deletions

View File

@ -550,6 +550,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
if (_hsyncCnt <= 0)
{
_core.Cpu.RDY = true;
_player0.Draw_Main = true;
_player1.Draw_Main = true;
_player0.Missile.Draw_Main = true;
_player1.Missile.Draw_Main = true;
}
// Assume we're on the left side of the screen for now
@ -1233,86 +1238,66 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
}
else if (maskedAddr == 0x10) // RESP0
{
_player0.Draw_Main = false;
// Resp depends on HMOVE
if (!_hmove.LateHBlankReset)
{
if (_hsyncCnt < 68)
{
_player0.HPosCnt = 0;
_player0.ResetCnt = 2;
_player0.Reset = true;
_player0.HPosCnt = (byte)(_hsyncCnt < 68 ? 160 - 2 : 160 - 4);
if (_hsyncCnt == 67) _player0.HPosCnt = 160 - 3;
}
else
{
_player0.ResetCnt = 0;
}
}
else
{
if (_hsyncCnt < 76)
{
_player0.HPosCnt = 0;
_player0.ResetCnt = 1;
_player0.Reset = true;
}
else
{
_player0.ResetCnt = 0;
}
_player0.HPosCnt = (byte)(_hsyncCnt < 76 ? 160 - 2 : 160 - 4);
if (_hsyncCnt == 75) _player0.HPosCnt = 160 - 3;
}
}
else if (maskedAddr == 0x11) // RESP1
{
_player1.Draw_Main = false;
// RESP depends on HMOVE
if (!_hmove.LateHBlankReset)
{
if (_hsyncCnt < 68)
{
_player1.HPosCnt = 0;
_player1.ResetCnt = 2;
_player1.Reset = true;
_player1.HPosCnt = (byte)(_hsyncCnt < 68 ? 160 - 2 : 160 - 4);
if (_hsyncCnt == 67) _player1.HPosCnt = 160 - 3;
}
else
{
_player1.ResetCnt = 0;
}
}
else
{
if (_hsyncCnt < 76)
{
_player1.HPosCnt = 0;
_player1.ResetCnt = 1;
_player1.Reset = true;
}
else
{
_player1.ResetCnt = 0;
}
_player1.HPosCnt = (byte)(_hsyncCnt < 76 ? 160 - 2 : 160 - 4);
if (_hsyncCnt == 75) _player1.HPosCnt = 160 - 3;
}
}
else if (maskedAddr == 0x12) // RESM0
{
_player0.Missile.Draw_Main = false;
if (!_hmove.LateHBlankReset)
{
_player0.Missile.HPosCnt = (byte)(_hsyncCnt < 68 ? 160 - 2 : 160 - 4);
if (_hsyncCnt == 67) _player0.Missile.HPosCnt = 160 - 3;
}
else
{
_player0.Missile.HPosCnt = (byte)(_hsyncCnt < 76 ? 160 - 2 : 160 - 4);
if (_hsyncCnt == 75) _player0.Missile.HPosCnt = 160 - 3;
}
}
else if (maskedAddr == 0x13) // RESM1
{
_player1.Missile.Draw_Main = false;
if (!_hmove.LateHBlankReset)
{
_player1.Missile.HPosCnt = (byte)(_hsyncCnt < 68 ? 160 - 2 : 160 - 4);
if (_hsyncCnt == 67) _player1.Missile.HPosCnt = 160 - 3;
}
else
{
_player1.Missile.HPosCnt = (byte)(_hsyncCnt < 76 ? 160 - 2 : 160 - 4);
if (_hsyncCnt == 75) _player1.Missile.HPosCnt = 160 - 3;
}
}
else if (maskedAddr == 0x14) // RESBL
@ -1320,10 +1305,12 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
if (!_hmove.LateHBlankReset)
{
_ball.HPosCnt = (byte)(_hsyncCnt < 68 ? 160 - 2 : 160 - 4);
if (_hsyncCnt == 67) _ball.HPosCnt = 160 - 3;
}
else
{
_ball.HPosCnt = (byte)(_hsyncCnt < 76 ? 160 - 3 : 160 - 4);
_ball.HPosCnt = (byte)(_hsyncCnt < 76 ? 160 - 2 : 160 - 4);
if (_hsyncCnt == 75) _ball.HPosCnt = 160 - 3;
}
}

View File

@ -14,12 +14,15 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public byte Hm;
public byte Collisions;
// Resp commands do not trugger start signals for main copies. We need to model this
public bool Draw_Main;
public bool Tick()
{
var result = false;
// At hPosCnt == 0, start drawing the missile, if enabled
if (HPosCnt < (1 << Size))
if (HPosCnt < (1 << Size) && Draw_Main == true)
{
if (Enabled && !ResetToPlayer)
{
@ -83,6 +86,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
ser.Sync("number", ref Number);
ser.Sync("HM", ref Hm);
ser.Sync("collisions", ref Collisions);
ser.Sync("draw_main", ref Draw_Main);
ser.EndSection();
}
}

View File

@ -18,10 +18,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public bool Reflect;
public bool Delay;
public byte Nusiz;
public bool Reset;
public byte ResetCnt;
public byte Collisions;
// Resp commands do not trugger start signals for main copies. We need to model this
public bool Draw_Main;
public bool Tick()
{
var result = false;
@ -112,7 +113,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
// At counter position 0 we should initalize the scan counter.
// Note that for double and quad sized players that the scan counter is not started immediately.
if (HPosCnt == 0 && !Reset)
if (HPosCnt == 0 && Draw_Main==true)
{
ScanCnt = 0;
if ((Nusiz & 0x07) == 0x05)
@ -144,27 +145,12 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
ScanCnt = 0;
}
// Reset is no longer in effect
Reset = false;
// Increment the counter
HPosCnt++;
// Counter loops at 160
HPosCnt %= 160;
if (ResetCnt < 4)
{
ResetCnt++;
}
if (ResetCnt == 4)
{
HPosCnt = 0;
Reset = true;
ResetCnt++;
}
return result;
}
@ -181,9 +167,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
ser.Sync("reflect", ref Reflect);
ser.Sync("delay", ref Delay);
ser.Sync("nusiz", ref Nusiz);
ser.Sync("reset", ref Reset);
ser.Sync("resetCnt", ref ResetCnt);
ser.Sync("collisions", ref Collisions);
ser.Sync("draw_main", ref Draw_Main);
}
}
}