speed up c# 6502 and enable it instead of cpp one

This commit is contained in:
zeromus 2012-10-31 01:55:26 +00:00
parent 4ed68e0c9a
commit 59664959f1
4 changed files with 1963 additions and 1102 deletions

View File

@ -100,4 +100,20 @@ namespace BizHawk
#endif
}
}
public class ShortBuffer : CBuffer<short>
{
public ShortBuffer(int amt) : base(amt, 2) { }
public ShortBuffer(short[] arr) : base(arr, 2) { }
public short this[int index]
{
#if DEBUG
get { return arr[index]; }
set { arr[index] = value; }
#else
set { Write32(index << 1, (uint)value); }
get { return (short)Read16(index << 1); }
#endif
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@ namespace BizHawk.Emulation.CPUs.M6502
{
public MOS6502X(Action<System.Runtime.InteropServices.GCHandle> DisposeBuilder = null)
{
InitOpcodeHandlers();
Reset();
}

View File

@ -12,8 +12,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
//hardware/state
// any of the 3 cpus are drop in replacements
//public MOS6502X cpu;
public MOS6502X_CPP 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>();
@ -114,8 +114,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
public void HardReset()
{
//cpu = new MOS6502X((h) => DisposeList.Add(h));
cpu = new MOS6502X_CPP((h) => DisposeList.Add(h));
cpu = new MOS6502X((h) => DisposeList.Add(h));
//cpu = new MOS6502X_CPP((h) => DisposeList.Add(h));
//cpu = new MOS6502XDouble((h) => DisposeList.Add(h));
cpu.SetCallbacks(ReadMemory, ReadMemory, WriteMemory, (h) => DisposeList.Add(h));
cpu.BCD_Enabled = false;