snes: Add "BUS" memory domain. Like GB, caveat that it could possibly maybe affect sync, maybe... doubly so because I can't penetrate byuu code so well.

This commit is contained in:
goyuken 2012-10-03 14:54:32 +00:00
parent 7c3551b918
commit e509b0cd9b
4 changed files with 20 additions and 0 deletions

View File

@ -110,6 +110,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
[DllImport("libsneshawk.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr snes_get_memory_data(SNES_MEMORY id);
[DllImport("libsneshawk.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern byte bus_read(uint addr);
[DllImport("libsneshawk.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void bus_write(uint addr, byte val);
[DllImport("libsneshawk.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int snes_serialize_size();
@ -835,6 +840,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
MakeMemoryDomain("OAM", LibsnesDll.SNES_MEMORY.OAM, Endian.Little);
MakeMemoryDomain("CGRAM", LibsnesDll.SNES_MEMORY.CGRAM, Endian.Little);
MakeMemoryDomain("APURAM", LibsnesDll.SNES_MEMORY.APURAM, Endian.Little);
MemoryDomains.Add(new MemoryDomain("BUS", 0x1000000, Endian.Little,
(addr) => LibsnesDll.bus_read((uint)addr),
(addr, val) => LibsnesDll.bus_write((uint)addr, val)));
}
public IList<MemoryDomain> MemoryDomains { get; private set; }
public MemoryDomain MainMemory { get; private set; }

View File

@ -529,6 +529,13 @@ unsigned snes_get_memory_size(unsigned id) {
return size;
}
uint8_t bus_read(unsigned addr) {
return SNES::bus.read(addr);
}
void bus_write(unsigned addr, uint8_t val) {
SNES::bus.write(addr, val);
}
int snes_poll_message()
{
if(interface.messages.size() == 0) return -1;

View File

@ -142,6 +142,10 @@ void snes_dequeue_message(char* buffer);
typedef const char* (*snes_path_request_t)(int slot, const char* hint);
void snes_set_path_request(snes_path_request_t path_request);
// system bus implementation
uint8_t bus_read(unsigned addr);
void bus_write(unsigned addr, uint8_t val);
//$2105
#define SNES_REG_BG_MODE 0
#define SNES_REG_BG3_PRIORITY 1