Add files via upload
This commit is contained in:
parent
70fdbba229
commit
0551099ac7
|
@ -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
|
||||
|
@ -735,12 +740,12 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Handle HMOVE
|
||||
if (_hmove.HMoveEnabled)
|
||||
{
|
||||
|
||||
|
||||
if (_hmove.DecCntEnabled)
|
||||
{
|
||||
|
||||
|
@ -827,7 +832,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
_hmove.HMoveCnt++;
|
||||
_hmove.HMoveCnt %= 4;
|
||||
|
||||
if (p0_stuff==true && _hsyncCnt%4==0)
|
||||
if (p0_stuff == true && _hsyncCnt % 4 == 0)
|
||||
{
|
||||
p0_stuff = false;
|
||||
// "Clock-Stuffing"
|
||||
|
@ -966,7 +971,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Increment the hsync counter
|
||||
|
@ -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;
|
||||
}
|
||||
else
|
||||
{
|
||||
_player0.ResetCnt = 0;
|
||||
}
|
||||
_player0.HPosCnt = (byte)(_hsyncCnt < 68 ? 160 - 2 : 160 - 4);
|
||||
if (_hsyncCnt == 67) _player0.HPosCnt = 160 - 3;
|
||||
}
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
_player1.ResetCnt = 0;
|
||||
}
|
||||
_player1.HPosCnt = (byte)(_hsyncCnt < 68 ? 160 - 2 : 160 - 4);
|
||||
if (_hsyncCnt == 67) _player1.HPosCnt = 160 - 3;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1576,4 +1563,4 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
ser.EndSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,89 +2,93 @@
|
|||
|
||||
namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||
{
|
||||
public partial class TIA
|
||||
{
|
||||
private struct MissileData
|
||||
{
|
||||
public bool Enabled;
|
||||
public bool ResetToPlayer;
|
||||
public byte HPosCnt;
|
||||
public byte Size;
|
||||
public byte Number;
|
||||
public byte Hm;
|
||||
public byte Collisions;
|
||||
public partial class TIA
|
||||
{
|
||||
private struct MissileData
|
||||
{
|
||||
public bool Enabled;
|
||||
public bool ResetToPlayer;
|
||||
public byte HPosCnt;
|
||||
public byte Size;
|
||||
public byte Number;
|
||||
public byte Hm;
|
||||
public byte Collisions;
|
||||
|
||||
public bool Tick()
|
||||
{
|
||||
var result = false;
|
||||
// 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 (Enabled && !ResetToPlayer)
|
||||
{
|
||||
// Draw the missile
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
if (HPosCnt < (1 << Size) && Draw_Main == true)
|
||||
{
|
||||
if (Enabled && !ResetToPlayer)
|
||||
{
|
||||
// Draw the missile
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((Number & 0x07) == 0x01 || ((Number & 0x07) == 0x03))
|
||||
{
|
||||
if (HPosCnt >= 16 && HPosCnt <= (16 + (1 << Size) - 1))
|
||||
{
|
||||
if (Enabled && !ResetToPlayer)
|
||||
{
|
||||
// Draw the missile
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((Number & 0x07) == 0x01 || ((Number & 0x07) == 0x03))
|
||||
{
|
||||
if (HPosCnt >= 16 && HPosCnt <= (16 + (1 << Size) - 1))
|
||||
{
|
||||
if (Enabled && !ResetToPlayer)
|
||||
{
|
||||
// Draw the missile
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Number & 0x07) == 0x02 || ((Number & 0x07) == 0x03) || ((Number & 0x07) == 0x06))
|
||||
{
|
||||
if (HPosCnt >= 32 && HPosCnt <= (32 + (1 << Size) - 1))
|
||||
{
|
||||
if (Enabled && !ResetToPlayer)
|
||||
{
|
||||
// Draw the missile
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((Number & 0x07) == 0x02 || ((Number & 0x07) == 0x03) || ((Number & 0x07) == 0x06))
|
||||
{
|
||||
if (HPosCnt >= 32 && HPosCnt <= (32 + (1 << Size) - 1))
|
||||
{
|
||||
if (Enabled && !ResetToPlayer)
|
||||
{
|
||||
// Draw the missile
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Number & 0x07) == 0x04 || (Number & 0x07) == 0x06)
|
||||
{
|
||||
if (HPosCnt >= 64 && HPosCnt <= (64 + (1 << Size) - 1))
|
||||
{
|
||||
if (Enabled && !ResetToPlayer)
|
||||
{
|
||||
// Draw the missile
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((Number & 0x07) == 0x04 || (Number & 0x07) == 0x06)
|
||||
{
|
||||
if (HPosCnt >= 64 && HPosCnt <= (64 + (1 << Size) - 1))
|
||||
{
|
||||
if (Enabled && !ResetToPlayer)
|
||||
{
|
||||
// Draw the missile
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Increment the counter
|
||||
HPosCnt++;
|
||||
// Increment the counter
|
||||
HPosCnt++;
|
||||
|
||||
// Counter loops at 160
|
||||
HPosCnt %= 160;
|
||||
// Counter loops at 160
|
||||
HPosCnt %= 160;
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void SyncState(Serializer ser)
|
||||
{
|
||||
ser.BeginSection("Missile");
|
||||
ser.Sync("enabled", ref Enabled);
|
||||
ser.Sync("resetToPlayer", ref ResetToPlayer);
|
||||
ser.Sync("hPosCnt", ref HPosCnt);
|
||||
ser.Sync("size", ref Size);
|
||||
ser.Sync("number", ref Number);
|
||||
ser.Sync("HM", ref Hm);
|
||||
ser.Sync("collisions", ref Collisions);
|
||||
ser.EndSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SyncState(Serializer ser)
|
||||
{
|
||||
ser.BeginSection("Missile");
|
||||
ser.Sync("enabled", ref Enabled);
|
||||
ser.Sync("resetToPlayer", ref ResetToPlayer);
|
||||
ser.Sync("hPosCnt", ref HPosCnt);
|
||||
ser.Sync("size", ref Size);
|
||||
ser.Sync("number", ref Number);
|
||||
ser.Sync("HM", ref Hm);
|
||||
ser.Sync("collisions", ref Collisions);
|
||||
ser.Sync("draw_main", ref Draw_Main);
|
||||
ser.EndSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,11 +18,12 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
public bool Reflect;
|
||||
public bool Delay;
|
||||
public byte Nusiz;
|
||||
public bool Reset;
|
||||
public byte ResetCnt;
|
||||
public byte Collisions;
|
||||
|
||||
public bool Tick()
|
||||
// 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;
|
||||
if (ScanCnt < 8)
|
||||
|
@ -112,8 +113,8 @@ 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,10 +167,9 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue