Merge pull request #614 from alyosha-tas/master

AtariHawk bug fixes pull request
This commit is contained in:
hegyak 2016-04-18 08:06:15 -07:00
commit 643e475ccc
3 changed files with 2252 additions and 411 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,89 +2,89 @@
namespace BizHawk.Emulation.Cores.Atari.Atari2600 namespace BizHawk.Emulation.Cores.Atari.Atari2600
{ {
public partial class TIA public partial class TIA
{ {
private struct MissileData private struct MissileData
{ {
public bool Enabled; public bool Enabled;
public bool ResetToPlayer; public bool ResetToPlayer;
public byte HPosCnt; public byte HPosCnt;
public byte Size; public byte Size;
public byte Number; public byte Number;
public byte Hm; public byte Hm;
public byte Collisions; public byte Collisions;
public bool Tick() public bool Tick()
{ {
var result = false; var result = false;
// At hPosCnt == 0, start drawing the missile, if enabled // At hPosCnt == 0, start drawing the missile, if enabled
if (HPosCnt < (1 << Size)) if (HPosCnt < (1 << Size))
{ {
if (Enabled && !ResetToPlayer) if (Enabled && !ResetToPlayer)
{ {
// Draw the missile // Draw the missile
result = true; result = true;
} }
} }
if ((Number & 0x07) == 0x01 || ((Number & 0x07) == 0x03)) if ((Number & 0x07) == 0x01 || ((Number & 0x07) == 0x03))
{ {
if (HPosCnt >= 16 && HPosCnt <= (16 + (1 << Size) - 1)) if (HPosCnt >= 16 && HPosCnt <= (16 + (1 << Size) - 1))
{ {
if (Enabled && !ResetToPlayer) if (Enabled && !ResetToPlayer)
{ {
// Draw the missile // Draw the missile
result = true; result = true;
} }
} }
} }
if ((Number & 0x07) == 0x02 || ((Number & 0x07) == 0x03) || ((Number & 0x07) == 0x06)) if ((Number & 0x07) == 0x02 || ((Number & 0x07) == 0x03) || ((Number & 0x07) == 0x06))
{ {
if (HPosCnt >= 32 && HPosCnt <= (32 + (1 << Size) - 1)) if (HPosCnt >= 32 && HPosCnt <= (32 + (1 << Size) - 1))
{ {
if (Enabled && !ResetToPlayer) if (Enabled && !ResetToPlayer)
{ {
// Draw the missile // Draw the missile
result = true; result = true;
} }
} }
} }
if ((Number & 0x07) == 0x04 || (Number & 0x07) == 0x06) if ((Number & 0x07) == 0x04 || (Number & 0x07) == 0x06)
{ {
if (HPosCnt >= 64 && HPosCnt <= (64 + (1 << Size) - 1)) if (HPosCnt >= 64 && HPosCnt <= (64 + (1 << Size) - 1))
{ {
if (Enabled && !ResetToPlayer) if (Enabled && !ResetToPlayer)
{ {
// Draw the missile // Draw the missile
result = true; result = true;
} }
} }
} }
// Increment the counter // Increment the counter
HPosCnt++; HPosCnt++;
// Counter loops at 160 // Counter loops at 160
HPosCnt %= 160; HPosCnt %= 160;
return result; return result;
} }
public void SyncState(Serializer ser) public void SyncState(Serializer ser)
{ {
ser.BeginSection("Missile"); ser.BeginSection("Missile");
ser.Sync("enabled", ref Enabled); ser.Sync("enabled", ref Enabled);
ser.Sync("resetToPlayer", ref ResetToPlayer); ser.Sync("resetToPlayer", ref ResetToPlayer);
ser.Sync("hPosCnt", ref HPosCnt); ser.Sync("hPosCnt", ref HPosCnt);
ser.Sync("size", ref Size); ser.Sync("size", ref Size);
ser.Sync("number", ref Number); ser.Sync("number", ref Number);
ser.Sync("HM", ref Hm); ser.Sync("HM", ref Hm);
ser.Sync("collisions", ref Collisions); ser.Sync("collisions", ref Collisions);
ser.EndSection(); ser.EndSection();
} }
} }
} }
} }

1535
TIA.cs Normal file

File diff suppressed because it is too large Load Diff