quicknes: add "System Bus". note that this System Bus will not resolve any MMIO stuff at all
This commit is contained in:
parent
86024d2347
commit
45e5f4b286
|
@ -192,6 +192,22 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DllImport(dllname, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(dllname, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool qn_get_memory_area(IntPtr e, int which, ref IntPtr data, ref int size, ref bool writable, ref IntPtr name);
|
public static extern bool qn_get_memory_area(IntPtr e, int which, ref IntPtr data, ref int size, ref bool writable, ref IntPtr name);
|
||||||
|
/// <summary>
|
||||||
|
/// peek the system bus
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">Context</param>
|
||||||
|
/// <param name="addr">0000:ffff, but non-ram/rom addresses won't work</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[DllImport(dllname, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern byte qn_peek_prgbus(IntPtr e, int addr);
|
||||||
|
/// <summary>
|
||||||
|
/// poke the system bus
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">Context</param>
|
||||||
|
/// <param name="addr">0000:ffff, but non-ram/rom addresses won't work</param>
|
||||||
|
/// <param name="val"></param>
|
||||||
|
[DllImport(dllname, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void qn_poke_prgbus(IntPtr e, int addr, byte val);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// handle "string error" as returned by some quicknes functions
|
/// handle "string error" as returned by some quicknes functions
|
||||||
|
|
|
@ -308,9 +308,29 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
if (addr < 0 || addr >= size)
|
if (addr < 0 || addr >= size)
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
p[addr] = val;
|
p[addr] = val;
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// add system bus
|
||||||
|
mm.Add(new MemoryDomain
|
||||||
|
(
|
||||||
|
"System Bus",
|
||||||
|
0x10000,
|
||||||
|
MemoryDomain.Endian.Unknown,
|
||||||
|
delegate(int addr)
|
||||||
|
{
|
||||||
|
if (addr < 0 || addr >= 0x10000)
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
return LibQuickNES.qn_peek_prgbus(Context, addr);
|
||||||
|
},
|
||||||
|
delegate(int addr, byte val)
|
||||||
|
{
|
||||||
|
if (addr < 0 || addr >= 0x10000)
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
LibQuickNES.qn_poke_prgbus(Context, addr, val);
|
||||||
|
}
|
||||||
|
));
|
||||||
MemoryDomains = new MemoryDomainList(mm, 0);
|
MemoryDomains = new MemoryDomainList(mm, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -228,3 +228,13 @@ EXPORT int qn_get_memory_area(Nes_Emu *e, int which, const void **data, int *siz
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EXPORT unsigned char qn_peek_prgbus(Nes_Emu *e, int addr)
|
||||||
|
{
|
||||||
|
return e->peek_prg(addr & 0xffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPORT void qn_poke_prgbus(Nes_Emu *e, int addr, unsigned char val)
|
||||||
|
{
|
||||||
|
e->poke_prg(addr & 0xffff, val);
|
||||||
|
}
|
||||||
|
|
|
@ -198,6 +198,11 @@ public:
|
||||||
enum { high_mem_size = 0x2000 };
|
enum { high_mem_size = 0x2000 };
|
||||||
byte* high_mem() { return emu.impl->sram; }
|
byte* high_mem() { return emu.impl->sram; }
|
||||||
|
|
||||||
|
// Prg peek/poke for debuggin
|
||||||
|
byte peek_prg(nes_addr_t addr) const { return *static_cast<Nes_Cpu>(emu).get_code(addr); }
|
||||||
|
void poke_prg(nes_addr_t addr, byte value) { *static_cast<Nes_Cpu>(emu).get_code(addr) = value; }
|
||||||
|
|
||||||
|
|
||||||
// End of public interface
|
// End of public interface
|
||||||
public:
|
public:
|
||||||
blargg_err_t set_sample_rate( long rate, class Nes_Buffer* );
|
blargg_err_t set_sample_rate( long rate, class Nes_Buffer* );
|
||||||
|
|
Loading…
Reference in New Issue