NES - implement address poking on the system bus domain. Anything in the EXP, WRAM, PRG regions is done via the built in cheat system due to being handled by the mappers. This may not be the ideal way to do this but it seems to work well, and I don't know of a more logical way to handle this.

This commit is contained in:
adelikat 2012-09-01 18:34:31 +00:00
parent dd41cb6365
commit 35ec42073f
2 changed files with 20 additions and 1 deletions

View File

@ -238,6 +238,25 @@ namespace BizHawk.Emulation.Consoles.Nintendo
public byte DummyReadMemory(ushort addr) { return 0; }
private void ApplySystemBusPoke(int addr, byte value)
{
if (addr < 0x2000)
{
ram[(addr & 0x7FF)] = value;
}
else if (addr < 0x4000)
{
ppu.WriteReg((addr & 0x07), value);
}
else if (addr < 0x4020)
{
WriteReg(addr, value);
}
else
{
ApplyGameGenie(addr, value, null); //Apply a cheat to the remaining regions since they have no direct access, this may not be the best way to handle this situation
}
}
public byte ReadMemory(ushort addr)
{

View File

@ -325,7 +325,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
var RAM = new MemoryDomain("RAM", 0x800, Endian.Little,
addr => ram[addr & 0x07FF], (addr, value) => ram[addr & 0x07FF] = value);
var SystemBus = new MemoryDomain("System Bus", 0x10000, Endian.Little,
addr => ReadMemory((ushort)addr), (addr, value) => WriteMemory((ushort)addr, value));
addr => ReadMemory((ushort)addr), (addr, value) => ApplySystemBusPoke(addr, value)); //WriteMemory((ushort)addr, value));
var PPUBus = new MemoryDomain("PPU Bus", 0x4000, Endian.Little,
addr => ppu.ppubus_peek(addr), (addr, value) => ppu.ppubus_write(addr, value));
var CIRAMdomain = new MemoryDomain("CIRAM (nametables)", 0x800, Endian.Little,