2600: support SECAM as an alternate colour mode when in PAL mode. SECAM has its own rather unique color modulation system, and the atari engineers were too lazy to make a proper color encoder for it, so.....

This commit is contained in:
goyuken 2014-05-26 20:16:44 +00:00
parent ab74f31d41
commit 7fdceb6158
3 changed files with 106 additions and 7 deletions

View File

@ -291,7 +291,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_pal = DetectPal(_game, Rom);
}
_tia = new TIA(this, _pal);
_tia = new TIA(this, _pal, Settings.SECAMColors);
_tia.GetFrameRate(out CoreComm.VsyncNum, out CoreComm.VsyncDen);
// dcfilter coefficent is from real observed hardware behavior: a latched "1" will fully decay by ~170 or so tia sound cycles

View File

@ -19,7 +19,14 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public bool PutSettings(object o)
{
Settings = (A2600Settings)o;
A2600Settings newSettings = (A2600Settings)o;
if (Settings == null || Settings.SECAMColors != newSettings.SECAMColors)
{
if (_tia != null)
_tia.SetSECAM(newSettings.SECAMColors);
}
Settings = newSettings;
return false;
}
@ -64,6 +71,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
[Description("Sets whether or not the Playfield layer will be displayed")]
public bool ShowPlayfield { get; set; }
[Description("If true, PAL mode will show with SECAM (French) colors.")]
public bool SECAMColors { get; set; }
public int NTSCTopLine
{
get { return this._ntscTopLine; }
@ -106,7 +116,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
ShowMissle2 = true,
ShowBall = true,
ShowPlayfield = true,
BackgroundColor = Color.Black
BackgroundColor = Color.Black,
SECAMColors = false
};
}
}

View File

@ -142,6 +142,89 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
0xbb9f47, 0, 0xd2b656, 0, 0xe8cc63, 0, 0xfce070, 0
};
private static readonly int[] SECAMPalette =
{
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
0x000000,0x000000,0x2121FF,0x2121FF,
0xF03C79,0xF03C79,0xFF50FF,0xFF50FF,
0x7FFF00,0x7FFF00,0x7FFFFF,0x7FFFFF,
0xFFFF3F,0xFFFF3F,0xffffff,0xffffff,
};
#endregion
// in all cases, the TIA has 228 clocks per scanline
@ -180,7 +263,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private readonly Atari2600 _core;
private int[] _scanlinebuffer = new int[ScreenWidth * MaxScreenHeight];
private readonly int[] _palette;
private int[] _palette;
private byte _hsyncCnt;
private int _capChargeStart;
@ -198,13 +281,18 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public Audio[] AUD = { new Audio(), new Audio() };
public TIA(Atari2600 core, bool pal)
public TIA(Atari2600 core, bool pal, bool secam)
{
_core = core;
_player0.ScanCnt = 8;
_player1.ScanCnt = 8;
_pal = pal;
_palette = _pal ? PALPalette : NTSCPalette;
SetSECAM(secam);
}
public void SetSECAM(bool secam)
{
_palette = _pal ? secam ? SECAMPalette : PALPalette : NTSCPalette;
}
public int CurrentScanLine
@ -245,7 +333,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
}
return 275; // 275 comes from NTSC specs and the actual pixel clock of a 2600 TIA
}
}
}
public int VirtualHeight