SxROM: 1% speedup
This commit is contained in:
parent
03b5cd4cc4
commit
5bf33b54a6
|
@ -207,25 +207,19 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
//configuration
|
//configuration
|
||||||
protected int prg_mask, chr_mask;
|
protected int prg_mask, chr_mask;
|
||||||
protected int vram_mask;
|
protected int vram_mask;
|
||||||
const int pputimeout = 4; // i don't know if this is right, but anything lower will not boot Bill & Ted
|
|
||||||
bool disablemirror = false; // mapper 171: mmc1 without mirroring control
|
bool disablemirror = false; // mapper 171: mmc1 without mirroring control
|
||||||
|
|
||||||
//state
|
//state
|
||||||
public MMC1 mmc1;
|
public MMC1 mmc1;
|
||||||
/// <summary>number of cycles since last WritePRG()</summary>
|
/// <summary>cpu cyle when the last MMC1 serial write occured</summary>
|
||||||
uint ppuclock;
|
int lastwritecycle;
|
||||||
|
|
||||||
public override void ClockPPU()
|
|
||||||
{
|
|
||||||
ppuclock++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WritePRG(int addr, byte value)
|
public override void WritePRG(int addr, byte value)
|
||||||
{
|
{
|
||||||
// mmc1 ignores subsequent writes that are very close together
|
// mmc1 ignores subsequent writes that are very close together
|
||||||
if (ppuclock >= pputimeout)
|
if (NES.cpu.TotalExecutedCycles - lastwritecycle != 1)
|
||||||
{
|
{
|
||||||
ppuclock = 0;
|
lastwritecycle = NES.cpu.TotalExecutedCycles;
|
||||||
mmc1.Write(addr, value);
|
mmc1.Write(addr, value);
|
||||||
if (!disablemirror)
|
if (!disablemirror)
|
||||||
SetMirrorType(mmc1.mirror); //often redundant, but gets the job done
|
SetMirrorType(mmc1.mirror); //often redundant, but gets the job done
|
||||||
|
@ -271,7 +265,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
{
|
{
|
||||||
base.SyncState(ser);
|
base.SyncState(ser);
|
||||||
mmc1.SyncState(ser);
|
mmc1.SyncState(ser);
|
||||||
ser.Sync("ppuclock", ref ppuclock);
|
ser.Sync("lastwritecycle", ref lastwritecycle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Configure(NES.EDetectionOrigin origin)
|
public override bool Configure(NES.EDetectionOrigin origin)
|
||||||
|
@ -365,7 +359,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
chr_mask = (Cart.chr_size / 8 * 2) - 1;
|
chr_mask = (Cart.chr_size / 8 * 2) - 1;
|
||||||
if (!disablemirror)
|
if (!disablemirror)
|
||||||
SetMirrorType(mmc1.mirror);
|
SetMirrorType(mmc1.mirror);
|
||||||
ppuclock = pputimeout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //class SxROM
|
} //class SxROM
|
||||||
|
|
Loading…
Reference in New Issue