NES - Fix Mapper 50

This commit is contained in:
adelikat 2012-08-05 19:20:54 +00:00
parent a19b76e6cc
commit 77da639dc6
1 changed files with 12 additions and 14 deletions

View File

@ -14,6 +14,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
bool irq_enable; bool irq_enable;
ushort irq_counter = 0; ushort irq_counter = 0;
bool irq_ready = false; bool irq_ready = false;
int ppu_cyclecount = 0;
public override bool Configure(NES.EDetectionOrigin origin) public override bool Configure(NES.EDetectionOrigin origin)
{ {
//analyze board type //analyze board type
@ -32,6 +33,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
public override void SyncState(Serializer ser) public override void SyncState(Serializer ser)
{ {
ser.Sync("ppu_cyclecount", ref ppu_cyclecount);
ser.Sync("prg_bank", ref prg_bank); ser.Sync("prg_bank", ref prg_bank);
ser.Sync("irq_enable", ref irq_enable); ser.Sync("irq_enable", ref irq_enable);
ser.Sync("irq_counter", ref irq_counter); ser.Sync("irq_counter", ref irq_counter);
@ -92,25 +94,21 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{ {
if (irq_enable) if (irq_enable)
{ {
if (irq_counter < 0x0FFF) irq_counter += 1;
{ if (irq_counter == 0x1000)
irq_counter += 1; SyncIRQ(true);
irq_ready = false;
}
else
{
irq_counter = 0;
irq_ready = true;
IRQ_Ready();
}
} }
} }
public override void ClockPPU() public override void ClockPPU()
{ {
IRQ_Tick(); ppu_cyclecount++;
base.ClockPPU(); if (ppu_cyclecount >= 3)
{
ppu_cyclecount = 0;
IRQ_Tick();
base.ClockPPU();
}
} }
} }
} }