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>
|
||||
[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);
|
||||
/// <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>
|
||||
/// handle "string error" as returned by some quicknes functions
|
||||
|
|
|
@ -292,25 +292,45 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
|
||||
mm.Add(new MemoryDomain
|
||||
(
|
||||
Marshal.PtrToStringAnsi(name),
|
||||
size,
|
||||
MemoryDomain.Endian.Unknown,
|
||||
delegate(int addr)
|
||||
{
|
||||
if (addr < 0 || addr >= size)
|
||||
throw new ArgumentOutOfRangeException();
|
||||
return p[addr];
|
||||
},
|
||||
delegate(int addr, byte val)
|
||||
{
|
||||
if (!writable)
|
||||
return;
|
||||
if (addr < 0 || addr >= size)
|
||||
throw new ArgumentOutOfRangeException();
|
||||
p[addr] = val;
|
||||
}));
|
||||
Marshal.PtrToStringAnsi(name),
|
||||
size,
|
||||
MemoryDomain.Endian.Unknown,
|
||||
delegate(int addr)
|
||||
{
|
||||
if (addr < 0 || addr >= size)
|
||||
throw new ArgumentOutOfRangeException();
|
||||
return p[addr];
|
||||
},
|
||||
delegate(int addr, byte val)
|
||||
{
|
||||
if (!writable)
|
||||
return;
|
||||
if (addr < 0 || addr >= size)
|
||||
throw new ArgumentOutOfRangeException();
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
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;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -197,7 +197,12 @@ public:
|
|||
// Optional 8K memory
|
||||
enum { high_mem_size = 0x2000 };
|
||||
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
|
||||
public:
|
||||
blargg_err_t set_sample_rate( long rate, class Nes_Buffer* );
|
||||
|
|
Loading…
Reference in New Issue