public void SetCallbacks (Func <ushort, byte> ReadMemory, Func <ushort, byte> DummyReadMemory, Action <ushort, byte> WriteMemory, Action <GCHandle> DisposeBuilder) { var d1 = new MOS6502X_DLL.ReadMemoryD(ReadMemory); var h1 = GCHandle.Alloc(d1); var d2 = new MOS6502X_DLL.ReadMemoryD(DummyReadMemory); var h2 = GCHandle.Alloc(d2); var d3 = new MOS6502X_DLL.WriteMemoryD(WriteMemory); var h3 = GCHandle.Alloc(d3); MOS6502X_DLL.SetTrampolines(pthis, d1, d2, d3); DisposeBuilder(h1); DisposeBuilder(h2); DisposeBuilder(h3); }
public MOS6502X_CPP(Action <GCHandle> DisposeBuilder) { // this bit of foolery is only needed if you actually need to run the native-side constructor //IntPtr native = MOS6502X_DLL.Create(); //if (native == null) // throw new Exception("Native constructor returned null!"); var h = GCHandle.Alloc(this, GCHandleType.Pinned); pthis = h.AddrOfPinnedObject(); // bad - use memcpy instead //Marshal.PtrToStructure(native, this); //MOS6502X_DLL.Destroy(native); BCD_Enabled = true; MOS6502X_DLL.Reset(pthis); DisposeBuilder(h); }
public void ExecuteOne() { MOS6502X_DLL.ExecuteOne(pthis); }
public void NESSoftReset() { MOS6502X_DLL.NESSoftReset(pthis); }
public void Reset() { MOS6502X_DLL.Reset(pthis); }