NES - implement freeze system on PPU bus

This commit is contained in:
andres.delikat 2011-03-28 16:43:15 +00:00
parent 8601a863d8
commit bfae7804f2
2 changed files with 11 additions and 2 deletions

View File

@ -259,6 +259,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
RAM.GetFreeze = addr => sysbus_freeze[addr & 0x07FF]; RAM.GetFreeze = addr => sysbus_freeze[addr & 0x07FF];
RAM.SetFreeze = (addr, value) => sysbus_freeze[addr & 0x07FF] = value; RAM.SetFreeze = (addr, value) => sysbus_freeze[addr & 0x07FF] = value;
PPUBus.GetFreeze = addr => ppu.ppubus_freeze[addr];
PPUBus.SetFreeze = (addr, value) => ppu.ppubus_freeze[addr] = value;
//demo a game genie code //demo a game genie code
GetWatch(NESWatch.EDomain.Sysbus, 0xB424).SetGameGenie(-1, 0x10); GetWatch(NESWatch.EDomain.Sysbus, 0xB424).SetGameGenie(-1, 0x10);
GetWatch(NESWatch.EDomain.Sysbus, 0xB424).RemoveGameGenie(); GetWatch(NESWatch.EDomain.Sysbus, 0xB424).RemoveGameGenie();

View File

@ -13,7 +13,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{ {
public partial class PPU public partial class PPU
{ {
//when the ppu issues a write it goes through here and into the game board public MemoryDomain.FreezeData[] ppubus_freeze = new MemoryDomain.FreezeData[16384];
//when the ppu issues a write it goes through here and into the game board
public void ppubus_write(int addr, byte value) public void ppubus_write(int addr, byte value)
{ {
nes.board.WritePPU(addr, value); nes.board.WritePPU(addr, value);
@ -22,7 +24,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo
//when the ppu issues a read it goes through here and into the game board //when the ppu issues a read it goes through here and into the game board
public byte ppubus_read(int addr) public byte ppubus_read(int addr)
{ {
return nes.board.ReadPPU(addr); //apply freeze
if (ppubus_freeze[addr].IsFrozen)
return ppubus_freeze[addr].value;
else
return nes.board.ReadPPU(addr);
} }
//debug tools peek into the ppu through this //debug tools peek into the ppu through this