NES: Fix PPU timing and Race condition

This commit is contained in:
alyosha-tas 2017-02-04 09:14:55 -05:00 committed by GitHub
parent 51f21691fd
commit 3c8a6a4e19
2 changed files with 15 additions and 9 deletions

View File

@ -479,6 +479,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//VRAM address register (write)
void write_2006(byte value)
{
if (ppur.status.cycle==256)
{
conflict_2006 = true;
}
if (!vtoggle)
{
ppur._vt &= 0x07;

View File

@ -39,6 +39,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public int spriteHeight;
public byte[] soam = new byte[512]; // in a real nes, this would only be 32, but we wish to allow more then 8 sprites per scanline
public bool reg_2001_color_disable_latch; // the value used here is taken
public bool conflict_2006;
struct TempOAM
{
@ -124,19 +125,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
bgdata.pt_1 = ppubus_read(ppu_addr_temp, true, true);
runppu(1);
//horizontal scroll clocked at cycle 3 and then
//vertical scroll at 255
if (reg_2001.PPUON)
{
ppur.increment_hsc();
if (ppur.status.cycle == 255)
ppur.increment_vs();
}
break;
case 7:
runppu(1);
//horizontal scroll clocked at cycle 3 and then
//vertical scroll at 256
if (reg_2001.PPUON)
{
ppur.increment_hsc();
if (ppur.status.cycle == 256 && !conflict_2006)
ppur.increment_vs();
}
conflict_2006 = false;
break;
} //switch(cycle)
}