NES PPU2006 write delay

See NESDEV discussion:

http://forums.nesdev.com/viewtopic.php?f=3&t=15484
This commit is contained in:
alyosha-tas 2017-03-03 14:57:38 -05:00 committed by GitHub
parent 685de44861
commit ca2fa6c95e
3 changed files with 19 additions and 1 deletions

View File

@ -217,6 +217,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ser.Sync("Spr_zero_in_Range", ref sprite_zero_in_range);
ser.Sync("Is_even_cycle", ref is_even_cycle);
ser.Sync("soam_index", ref soam_index);
ser.Sync("install_2006", ref install_2006);
ser.Sync("ppu_open_bus", ref ppu_open_bus);
ser.Sync("double_2007_read", ref double_2007_read);
@ -280,6 +281,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//run one ppu cycle at a time so we can interact with the ppu and clockPPU at high granularity
for (int i = 0; i < x; i++)
{
if (install_2006>0)
{
install_2006--;
if (install_2006==0)
{
ppur.install_latches();
}
}
ppur.status.cycle++;
is_even_cycle = !is_even_cycle;
//might not actually run a cpu cycle if there are none to be run right now

View File

@ -497,7 +497,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ppur._vt &= 0x18;
ppur._vt |= (value >> 5);
ppur._ht = value & 31;
ppur.install_latches();
// testing indicates that this operation is delayed by 3 pixels
// ppur.install_latches();
install_2006 = 3;
//nes.LogLine("addr wrote vt = {0}, ht = {1}", ppur._vt, ppur._ht);
//normally the address isnt observed by the board till it gets clocked by a read or write.
//but maybe thats just because a ppu read/write shoves it on the address bus

View File

@ -41,6 +41,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public bool reg_2001_color_disable_latch; // the value used here is taken
public bool conflict_2006, ppu_was_on;
// installing vram address is delayed after second write to 2006, set this up here
public int install_2006;
struct TempOAM
{
public byte oam_y;