NES PPU clean up
This commit is contained in:
parent
ca2fa6c95e
commit
0960ca8a89
|
@ -218,6 +218,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
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("race_2006", ref race_2006);
|
||||
|
||||
ser.Sync("ppu_open_bus", ref ppu_open_bus);
|
||||
ser.Sync("double_2007_read", ref double_2007_read);
|
||||
|
@ -287,6 +288,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
if (install_2006==0)
|
||||
{
|
||||
ppur.install_latches();
|
||||
|
||||
//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
|
||||
//apparently this shoves it on the address bus, too, or else blargg's mmc3 tests dont pass
|
||||
//ONLY if the ppu is not rendering
|
||||
if (ppur.status.sl == 241 || (!reg_2001.show_obj && !reg_2001.show_bg))
|
||||
nes.Board.AddressPPU(ppur.get_2007access());
|
||||
|
||||
race_2006 = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -479,10 +479,7 @@ 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;
|
||||
|
@ -502,14 +499,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
// 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
|
||||
//apparently this shoves it on the address bus, too, or else blargg's mmc3 tests dont pass
|
||||
//ONLY if the ppu is not rendering
|
||||
if (ppur.status.sl == 241 || (!reg_2001.show_obj && !reg_2001.show_bg))
|
||||
nes.Board.AddressPPU(ppur.get_2007access());
|
||||
}
|
||||
|
||||
vtoggle ^= true;
|
||||
|
|
|
@ -39,10 +39,11 @@ 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, ppu_was_on;
|
||||
public bool ppu_was_on;
|
||||
|
||||
// installing vram address is delayed after second write to 2006, set this up here
|
||||
public int install_2006;
|
||||
public bool race_2006;
|
||||
|
||||
struct TempOAM
|
||||
{
|
||||
|
@ -134,14 +135,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
break;
|
||||
case 7:
|
||||
|
||||
race_2006 = false;
|
||||
runppu(1);
|
||||
|
||||
//horizontal scroll clocked at cycle 3 and then
|
||||
//vertical scroll at 256
|
||||
if (ppu_was_on)
|
||||
{
|
||||
ppur.increment_hsc();
|
||||
if (ppur.status.cycle == 256 && !conflict_2006)
|
||||
if (ppur.status.cycle == 256 && !race_2006)
|
||||
ppur.increment_vs();
|
||||
}
|
||||
ppu_was_on = false;
|
||||
|
@ -734,7 +736,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
else
|
||||
runppu(1);
|
||||
|
||||
conflict_2006 = false;
|
||||
race_2006 = false;
|
||||
} // scanline loop
|
||||
|
||||
ppur.status.sl = 241;
|
||||
|
|
Loading…
Reference in New Issue