NES: disconnect some bitrotted code for an alternate 6502 core

This commit is contained in:
goyuken 2014-07-30 16:33:48 +00:00
parent 8bad959f84
commit 9609bf1601
3 changed files with 10 additions and 21 deletions

View File

@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
{ {
public sealed partial class MOS6502X public sealed partial class MOS6502X
{ {
public MOS6502X(Action<System.Runtime.InteropServices.GCHandle> DisposeBuilder = null) public MOS6502X()
{ {
InitOpcodeHandlers(); InitOpcodeHandlers();
Reset(); Reset();
@ -188,8 +188,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
Func<ushort, byte> ReadMemory, Func<ushort, byte> ReadMemory,
Func<ushort, byte> DummyReadMemory, Func<ushort, byte> DummyReadMemory,
Func<ushort, byte> PeekMemory, Func<ushort, byte> PeekMemory,
Action<ushort, byte> WriteMemory, Action<ushort, byte> WriteMemory
Action<System.Runtime.InteropServices.GCHandle> DisposeBuilder
) )
{ {
this.ReadMemory = ReadMemory; this.ReadMemory = ReadMemory;

View File

@ -10,12 +10,13 @@ namespace BizHawk.Emulation.Cores.Components.M6502
/// maintains a managed 6502X and an unmanaged 6502X, running them alongside and ensuring consistency /// maintains a managed 6502X and an unmanaged 6502X, running them alongside and ensuring consistency
/// by taking savestates every cycle (!). slow. /// by taking savestates every cycle (!). slow.
/// </summary> /// </summary>
/*
public class MOS6502XDouble public class MOS6502XDouble
{ {
readonly MOS6502X m; readonly MOS6502X m;
readonly MOS6502X_CPP n; readonly MOS6502X_CPP n;
public MOS6502XDouble(Action<System.Runtime.InteropServices.GCHandle> DisposeBuilder) public MOS6502XDouble()
{ {
m = new MOS6502X(DisposeBuilder); m = new MOS6502X(DisposeBuilder);
n = new MOS6502X_CPP(DisposeBuilder); n = new MOS6502X_CPP(DisposeBuilder);
@ -43,7 +44,7 @@ namespace BizHawk.Emulation.Cores.Components.M6502
{ {
writes.Enqueue(value); writes.Enqueue(value);
WriteMemory(addr, value); WriteMemory(addr, value);
}, DisposeBuilder); });
n.SetCallbacks( n.SetCallbacks(
delegate(ushort addr) delegate(ushort addr)
{ {
@ -237,4 +238,5 @@ namespace BizHawk.Emulation.Cores.Components.M6502
public string Disassemble(ushort pc, out int bytesToAdvance) { bytesToAdvance = 1; return "FOOBAR"; } public string Disassemble(ushort pc, out int bytesToAdvance) { bytesToAdvance = 1; return "FOOBAR"; }
} }
*/
} }

View File

@ -13,12 +13,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public partial class NES : IEmulator public partial class NES : IEmulator
{ {
//hardware/state //hardware/state
// any of the 3 cpus are drop in replacements
public MOS6502X cpu; public MOS6502X cpu;
//public MOS6502X_CPP cpu;
//public MOS6502XDouble cpu;
// dispose list as the native core can't keep track of its own stuff
List<System.Runtime.InteropServices.GCHandle> DisposeList = new List<System.Runtime.InteropServices.GCHandle>();
int cpu_accumulate; //cpu timekeeper int cpu_accumulate; //cpu timekeeper
public PPU ppu; public PPU ppu;
public APU apu; public APU apu;
@ -75,14 +70,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public void Dispose() public void Dispose()
{ {
if (magicSoundProvider != null) magicSoundProvider.Dispose(); if (magicSoundProvider != null)
magicSoundProvider.Dispose();
magicSoundProvider = null; magicSoundProvider = null;
if (DisposeList != null)
{
foreach (var h in DisposeList)
h.Free();
DisposeList = null;
}
} }
class MagicSoundProvider : ISoundProvider, ISyncSoundProvider, IDisposable class MagicSoundProvider : ISoundProvider, ISyncSoundProvider, IDisposable
@ -169,10 +159,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public void HardReset() public void HardReset()
{ {
cpu = new MOS6502X((h) => DisposeList.Add(h)); cpu = new MOS6502X();
//cpu = new MOS6502X_CPP((h) => DisposeList.Add(h)); cpu.SetCallbacks(ReadMemory, ReadMemory, PeekMemory, WriteMemory);
//cpu = new MOS6502XDouble((h) => DisposeList.Add(h));
cpu.SetCallbacks(ReadMemory, ReadMemory, PeekMemory, WriteMemory, (h) => DisposeList.Add(h));
cpu.BCD_Enabled = false; cpu.BCD_Enabled = false;
cpu.OnExecFetch = ExecFetch; cpu.OnExecFetch = ExecFetch;