GBA -add new "Combined WRAM" memory domain, which is the 256KB EWRAM immediately followed by the 32KB IWRAM

This commit is contained in:
goyuken 2013-09-29 15:43:49 +00:00
parent 665ceac228
commit e33396a548
1 changed files with 33 additions and 10 deletions

View File

@ -254,6 +254,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
// even if the rom is less than 32MB, the whole is still valid in meteor // even if the rom is less than 32MB, the whole is still valid in meteor
AddMemoryDomain(LibMeteor.MemoryArea.rom, 32 * 1024 * 1024, "ROM"); AddMemoryDomain(LibMeteor.MemoryArea.rom, 32 * 1024 * 1024, "ROM");
// special domain for system bus // special domain for system bus
{
MemoryDomain sb = new MemoryDomain("BUS", 1 << 28, Endian.Little, MemoryDomain sb = new MemoryDomain("BUS", 1 << 28, Endian.Little,
delegate(int addr) delegate(int addr)
{ {
@ -265,6 +266,28 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
}); });
_MemoryDomains.Add(sb); _MemoryDomains.Add(sb);
} }
// special combined ram memory domain
{
var ew = _MemoryDomains[1];
var iw = _MemoryDomains[0];
MemoryDomain cr = new MemoryDomain("Combined WRAM", (256 + 32) * 1024, Endian.Little,
delegate(int addr)
{
if (addr >= 256 * 1024)
return iw.PeekByte(addr & 32767);
else
return ew.PeekByte(addr);
},
delegate(int addr, byte val)
{
if (addr >= 256 * 1024)
iw.PokeByte(addr & 32767, val);
else
ew.PokeByte(addr, val);
});
_MemoryDomains.Add(cr);
}
}
public void GetGPUMemoryAreas(out IntPtr vram, out IntPtr palram, out IntPtr oam, out IntPtr mmio) public void GetGPUMemoryAreas(out IntPtr vram, out IntPtr palram, out IntPtr oam, out IntPtr mmio)
{ {