Fix a bug in OAM regs

passes oam_stress
This commit is contained in:
alyosha-tas 2016-06-18 12:07:53 -04:00 committed by GitHub
parent 55feae8bf6
commit bc17e6519c
2 changed files with 28 additions and 19 deletions

View File

@ -397,25 +397,34 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
byte read_2004()
{
if (ppur.status.sl < 241)
// behaviour depends on whether things are being rendered or not
if (reg_2001.show_bg || reg_2001.show_obj)
{
if (ppur.status.cycle < 64)
if (ppur.status.sl < 241)
{
return 0xFF; // during this time all reads return FF
}
else if (ppur.status.cycle < 256)
{
return read_value;
}
else if (ppur.status.cycle < 320)
{
return read_value;
if (ppur.status.cycle < 64)
{
return 0xFF; // during this time all reads return FF
}
else if (ppur.status.cycle < 256)
{
return read_value;
}
else if (ppur.status.cycle < 320)
{
return read_value;
}
else
{
return soam[0];
}
}
else
{
return soam[0];
return OAM[reg_2003];
}
} else
}
else
{
return OAM[reg_2003];
}

View File

@ -136,13 +136,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ppuphase = PPUPHASE.VBL;
ppur.status.sl = 241;
//Not sure if this is correct. According to Matt Conte and my own tests, it is. Timing is probably off, though.
//NOTE: Not having this here breaks a Super Donkey Kong game.
reg_2003 = 0;
//Not sure if this is correct. According to Matt Conte and my own tests, it is. Timing is probably off, though.
//NOTE: Not having this here breaks a Super Donkey Kong game.
if (reg_2001.show_obj || reg_2001.show_bg) reg_2003 = 0;
//this was repeatedly finetuned from the fceux days thrugh the old cpu core and into the new one to pass 05-nmi_timing.nes
//note that there is still some leniency. for instance, 4,2 will pass in addition to 3,3
const int delay = 6;
//this was repeatedly finetuned from the fceux days thrugh the old cpu core and into the new one to pass 05-nmi_timing.nes
//note that there is still some leniency. for instance, 4,2 will pass in addition to 3,3
const int delay = 6;
runppu(3);
bool nmi_destiny = reg_2000.vblank_nmi_gen && Reg2002_vblank_active;
runppu(3);