[NES] ppu timing tweak

This commit is contained in:
zeromus 2011-06-07 20:41:49 +00:00
parent d05b81238e
commit bc1d255ac3
2 changed files with 29 additions and 35 deletions

View File

@ -16,7 +16,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
static readonly bool USE_DATABASE = true;
//Game issues:
//3-D World Runner - UNROM - weird lines in gameplay (scanlines off?)
//JJ - Tobidase Daisakusen Part 2 (J) - same as 3-D World Runner
//Castlevania II (U) - Black screen only
//Zelda II (U) - Black screen only
@ -24,7 +23,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
//Dragon Warrior (SAROM) - Black screen only
//Family Feud - Fails to get past intro screen
//Air Wolf - Black screen
//Boyo and His Blob - Hangs on intro screen
//Goal = graphics garble (looks identical to Zelda 2 problem)
//Nobunaga's Ambition - black screen
//Knight Rider - very glitchy and seems to be a good timing case!
@ -34,6 +32,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
//Indiana Jones Temple of Doom - Puase menu flickering (in FCEUX as well, haven't tested other emulators)
//Tecmo superbowl - wobbly "NFL" logo at the end of a game (even skipped game)
//High Speed - garbled graphics
//Game issues for tester to check off
//3-D World Runner - UNROM - weird lines in gameplay (OK i think - should be similar to other emulators now)
public NES()
{
BootGodDB.Initialize();

View File

@ -283,22 +283,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
}
oamcounts[scanslot] = oamcount;
//FV is clocked by the PPU's horizontal blanking impulse, and therefore will increment every scanline.
//well, according to (which?) tests, maybe at the end of hblank.
//but, according to what it took to get crystalis working, it is at the beginning of hblank.
//this is done at cycle 251
//rendering scanline, it doesn't need to be scanline 0,
//because on the first scanline when the increment is 0, the vs_scroll is reloaded.
//if(PPUON && sl != 0)
// ppur.increment_vs();
//todo - think about clearing oams to a predefined value to force deterministic behavior
//so.. this is the end of hblank. latch horizontal scroll values
//do it cycle at 251
if (reg_2001.PPUON && sl != 0)
ppur.install_h_latches();
ppuphase = PPUPHASE.OBJ;
@ -354,30 +339,33 @@ namespace BizHawk.Emulation.Consoles.Nintendo
//so we just need the line offset for the second pattern
patternAddress += line & 7;
//garbage nametable fetches
//reset the scroll counter, happens at cycle 304
//TODO - compact this logic
if (realSprite)
//garbage nametable fetches + scroll resets
int garbage_todo = 2;
if (reg_2001.PPUON)
{
if ((sl == 0) && reg_2001.PPUON)
if (sl == 0 && ppur.status.cycle == 304)
{
if (ppur.status.cycle == 304)
{
runppu(1);
ppur.install_latches();
runppu(1);
}
else
runppu(kFetchTime);
runppu(1);
ppur.install_latches();
runppu(1);
garbage_todo = 0;
}
if ((sl != 0) && ppur.status.cycle == 256)
{
runppu(1);
//at 257: 3d world runner is ugly if we do this at 256
ppur.install_h_latches();
runppu(1);
garbage_todo = 0;
}
else
runppu(kFetchTime);
}
//..etc.. hacks about dragon's lair, MMC3, crystalis and SMB3. this should be implemented through the board
if (realSprite) runppu(garbage_todo);
if (realSprite) runppu(kFetchTime);
//TODO - fake sprites should not come through ppubus_read but rather peek it
//(at least, they should not probe it with AddressPPU. maybe the difference between peek and read is not necessary)
//pattern table fetches
int addr = patternAddress;
oam->patterns[0] = ppubus_read(addr, true);
@ -399,6 +387,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo
ppuphase = PPUPHASE.BG;
//so.. this is the end of hblank. latch horizontal scroll values
//do it cycle at 251
if (reg_2001.PPUON && sl != 0)
ppur.install_h_latches();
//I'm unclear of the reason why this particular access to memory is made.
//The nametable address that is accessed 2 times in a row here, is also the
//same nametable address that points to the 3rd tile to be rendered on the