Fixed indentation and TODOs
This commit is contained in:
parent
1e9564a337
commit
f7c15bfd0f
|
@ -9,13 +9,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
{
|
||||
public string Cpu
|
||||
{
|
||||
get
|
||||
{
|
||||
return "6510";
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
get { return "6510"; }
|
||||
}
|
||||
|
||||
public string PCRegisterName
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
|
||||
private C64 _c64;
|
||||
|
||||
public Motherboard(C64 c64, Region initRegion)
|
||||
public Motherboard(C64 c64, DisplayType initRegion)
|
||||
{
|
||||
// note: roms need to be added on their own externally
|
||||
_c64 = c64;
|
||||
|
@ -59,8 +59,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
sid = MOS6581.Create(44100, initRegion);
|
||||
switch (initRegion)
|
||||
{
|
||||
case Region.NTSC: vic = MOS6567.Create(); break;
|
||||
case Region.PAL: vic = MOS6569.Create(); break;
|
||||
case DisplayType.NTSC: vic = MOS6567.Create(); break;
|
||||
case DisplayType.PAL: vic = MOS6569.Create(); break;
|
||||
}
|
||||
userPort = new UserPortDevice();
|
||||
}
|
||||
|
|
|
@ -8,21 +8,14 @@ using System.Windows.Forms;
|
|||
|
||||
namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
||||
{
|
||||
// TODO: use the EMulation.Common Region enum
|
||||
public enum Region
|
||||
{
|
||||
NTSC,
|
||||
PAL
|
||||
}
|
||||
|
||||
[CoreAttributes(
|
||||
"C64Hawk",
|
||||
"SaxxonPIke",
|
||||
isPorted: false,
|
||||
isReleased: false
|
||||
)]
|
||||
[ServiceNotApplicable(typeof(IRegionable), typeof(ISettable<,>))]
|
||||
sealed public partial class C64 : IEmulator, IStatable, IInputPollable, IDriveLight, IDebuggable, IDisassemblable
|
||||
[ServiceNotApplicable(typeof(ISettable<,>))]
|
||||
sealed public partial class C64 : IEmulator, IStatable, IInputPollable, IDriveLight, IDebuggable, IDisassemblable, IRegionable
|
||||
{
|
||||
// framework
|
||||
public C64(CoreComm comm, GameInfo game, byte[] rom, string romextension)
|
||||
|
@ -34,12 +27,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
inputFileInfo.Data = rom;
|
||||
inputFileInfo.Extension = romextension;
|
||||
CoreComm = comm;
|
||||
Nullable<Region> region = queryUserForRegion();
|
||||
if (region == null)
|
||||
{
|
||||
throw new Exception("Can't construct new C64 because you didn't choose anything");
|
||||
}
|
||||
Init(region.Value);
|
||||
Region = queryUserForRegion();
|
||||
Init(Region);
|
||||
cyclesPerFrame = board.vic.CyclesPerFrame;
|
||||
SetupMemoryDomains();
|
||||
MemoryCallbacks = new MemoryCallbackSystem();
|
||||
|
@ -49,7 +38,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
}
|
||||
|
||||
|
||||
private Nullable<Region> queryUserForRegion()
|
||||
private DisplayType queryUserForRegion()
|
||||
{
|
||||
Form prompt = new Form() { Width = 160, Height = 120, FormBorderStyle = FormBorderStyle.FixedDialog, Text = "Region selector", StartPosition = FormStartPosition.CenterScreen };
|
||||
Label textLabel = new Label() { Left = 10, Top = 10, Width = 260, Text = "Please choose a region:" };
|
||||
|
@ -63,7 +52,11 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
prompt.Controls.Add(confirmation);
|
||||
prompt.AcceptButton = confirmation;
|
||||
|
||||
return prompt.ShowDialog() == DialogResult.OK ? palButton.Checked ? new Nullable<Region>(Region.PAL) : ntscButton.Checked ? new Nullable<Region>(Region.NTSC) : null : null;
|
||||
if (prompt.ShowDialog() != DialogResult.OK || !palButton.Checked && !ntscButton.Checked)
|
||||
{
|
||||
throw new Exception("Can't construct new C64 because you didn't choose anything");
|
||||
}
|
||||
return palButton.Checked ? DisplayType.PAL : DisplayType.NTSC;
|
||||
}
|
||||
|
||||
// internal variables
|
||||
|
@ -118,6 +111,12 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
public DisplayType Region
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (board.sid != null)
|
||||
|
@ -129,6 +128,16 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
|
||||
int frameCycles;
|
||||
|
||||
// process frame
|
||||
public void FrameAdvance(bool render, bool rendersound)
|
||||
{
|
||||
do
|
||||
{
|
||||
DoCycle();
|
||||
}
|
||||
while (frameCycles != 0);
|
||||
}
|
||||
|
||||
private void DoCycle()
|
||||
{
|
||||
if (frameCycles == 0) {
|
||||
|
@ -179,16 +188,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
}
|
||||
}
|
||||
|
||||
// process frame
|
||||
public void FrameAdvance(bool render, bool rendersound)
|
||||
{
|
||||
do
|
||||
{
|
||||
DoCycle();
|
||||
}
|
||||
while (frameCycles != 0);
|
||||
}
|
||||
|
||||
private void HandleFirmwareError(string file)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("the C64 core is referencing a firmware file which could not be found. Please make sure it's in your configured C64 firmwares folder. The referenced filename is: " + file);
|
||||
|
@ -206,7 +205,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
return result;
|
||||
}
|
||||
|
||||
private void Init(Region initRegion)
|
||||
private void Init(DisplayType initRegion)
|
||||
{
|
||||
board = new Motherboard(this, initRegion);
|
||||
InitRoms();
|
||||
|
|
|
@ -233,7 +233,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
LatchedPort portA;
|
||||
LatchedPort portB;
|
||||
|
||||
public MOS6526_2(Region region)
|
||||
public MOS6526_2(Common.DisplayType region)
|
||||
{
|
||||
a = new CiaTimer(serialPortA, underFlowA);
|
||||
b = new CiaTimer(serialPortB, underFlowB);
|
||||
|
@ -241,10 +241,10 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
portB = new LatchedPort();
|
||||
switch (region)
|
||||
{
|
||||
case Region.NTSC:
|
||||
case Common.DisplayType.NTSC:
|
||||
tod_period = 14318181 / 140;
|
||||
break;
|
||||
case Region.PAL:
|
||||
case Common.DisplayType.PAL:
|
||||
tod_period = 17734472 / 180;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
// ------------------------------------
|
||||
|
||||
bool alarmSelect;
|
||||
Region chipRegion;
|
||||
Common.DisplayType chipRegion;
|
||||
bool cntPos;
|
||||
bool enableIntAlarm;
|
||||
bool enableIntFlag;
|
||||
|
@ -83,7 +83,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
bool oldFlag;
|
||||
// ------------------------------------
|
||||
|
||||
public MOS6526(Region region)
|
||||
public MOS6526(Common.DisplayType region)
|
||||
{
|
||||
chipRegion = region;
|
||||
enableIntTimer = new bool[2];
|
||||
|
@ -208,22 +208,22 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
todAlarm[2] = 0;
|
||||
todAlarm[3] = 0;
|
||||
todCounter = todCounterLatch;
|
||||
todIn = (chipRegion == Region.PAL);
|
||||
todIn = (chipRegion == Common.DisplayType.PAL);
|
||||
todPM = false;
|
||||
|
||||
pinCnt = false;
|
||||
pinPC = true;
|
||||
}
|
||||
|
||||
private void SetTodIn(Region region)
|
||||
private void SetTodIn(Common.DisplayType region)
|
||||
{
|
||||
switch (region)
|
||||
{
|
||||
case Region.NTSC:
|
||||
case Common.DisplayType.NTSC:
|
||||
todCounterLatch = 14318181 / 140;
|
||||
todIn = false;
|
||||
break;
|
||||
case Region.PAL:
|
||||
case Common.DisplayType.PAL:
|
||||
todCounterLatch = 17734472 / 180;
|
||||
todIn = true;
|
||||
break;
|
||||
|
|
|
@ -4119,7 +4119,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
static public Sid Create(int newSampleRate, Region newRegion)
|
||||
static public Sid Create(int newSampleRate, Common.DisplayType newRegion)
|
||||
{
|
||||
return new Sid(waveTable, newSampleRate, newRegion);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
public Func<byte> ReadPotX;
|
||||
public Func<byte> ReadPotY;
|
||||
|
||||
public Sid(int[][] newWaveformTable, int newSampleRate, Region newRegion)
|
||||
public Sid(int[][] newWaveformTable, int newSampleRate, Common.DisplayType newRegion)
|
||||
{
|
||||
uint cyclesPerSec = 0;
|
||||
uint cyclesNum;
|
||||
|
@ -51,8 +51,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
|
||||
switch (newRegion)
|
||||
{
|
||||
case Region.NTSC: cyclesNum = 14318181; cyclesDen = 14; break;
|
||||
case Region.PAL: cyclesNum = 17734472; cyclesDen = 18; break;
|
||||
case Common.DisplayType.NTSC: cyclesNum = 14318181; cyclesDen = 14; break;
|
||||
case Common.DisplayType.PAL: cyclesNum = 17734472; cyclesDen = 18; break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue