mirror of https://github.com/snes9xgit/snes9x.git
Change NextTimer to NextIRQTimer. Don't subtract a dot in interlaced mode.
This commit is contained in:
parent
3553650469
commit
f1cab4ab17
2
cpu.cpp
2
cpu.cpp
|
@ -266,7 +266,7 @@ static void S9xSoftResetCPU (void)
|
||||||
Timings.H_Max = Timings.H_Max_Master;
|
Timings.H_Max = Timings.H_Max_Master;
|
||||||
Timings.V_Max = Timings.V_Max_Master;
|
Timings.V_Max = Timings.V_Max_Master;
|
||||||
Timings.NMITriggerPos = 0xffff;
|
Timings.NMITriggerPos = 0xffff;
|
||||||
Timings.NextTimer = 0xffff;
|
Timings.NextIRQTimer = 0xffff;
|
||||||
if (Model->_5A22 == 2)
|
if (Model->_5A22 == 2)
|
||||||
Timings.WRAMRefreshPos = SNES_WRAM_REFRESH_HC_v2;
|
Timings.WRAMRefreshPos = SNES_WRAM_REFRESH_HC_v2;
|
||||||
else
|
else
|
||||||
|
|
|
@ -229,7 +229,7 @@ void S9xMainLoop (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CPU.Cycles >= Timings.NextTimer || CPU.IRQExternal)
|
if (CPU.Cycles >= Timings.NextIRQTimer || CPU.IRQExternal)
|
||||||
{
|
{
|
||||||
if (CPU.IRQPending)
|
if (CPU.IRQPending)
|
||||||
CPU.IRQPending--;
|
CPU.IRQPending--;
|
||||||
|
@ -417,8 +417,8 @@ void S9xDoHEventProcessing (void)
|
||||||
CPU.Cycles -= Timings.H_Max;
|
CPU.Cycles -= Timings.H_Max;
|
||||||
if (Timings.NMITriggerPos != 0xffff)
|
if (Timings.NMITriggerPos != 0xffff)
|
||||||
Timings.NMITriggerPos -= Timings.H_Max;
|
Timings.NMITriggerPos -= Timings.H_Max;
|
||||||
if (Timings.NextTimer != 0xffff)
|
if (Timings.NextIRQTimer != 0xffff)
|
||||||
Timings.NextTimer -= Timings.H_Max;
|
Timings.NextIRQTimer -= Timings.H_Max;
|
||||||
S9xAPUSetReferenceTime(CPU.Cycles);
|
S9xAPUSetReferenceTime(CPU.Cycles);
|
||||||
|
|
||||||
CPU.V_Counter++;
|
CPU.V_Counter++;
|
||||||
|
|
10
ppu.cpp
10
ppu.cpp
|
@ -288,17 +288,17 @@ static int CyclesUntilNext (int hc, int vc)
|
||||||
// Add number of lines
|
// Add number of lines
|
||||||
total += (vc - vpos) * Timings.H_Max;
|
total += (vc - vpos) * Timings.H_Max;
|
||||||
// If line 240 is in there and we're odd, subtract a dot
|
// If line 240 is in there and we're odd, subtract a dot
|
||||||
if (vpos <= 240 && vc > 240 && Timings.InterlaceField)
|
if (vpos <= 240 && vc > 240 && Timings.InterlaceField & !IPPU.Interlace)
|
||||||
total -= ONE_DOT_CYCLE;
|
total -= ONE_DOT_CYCLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
total += (Timings.V_Max - vpos) * Timings.H_Max;
|
total += (Timings.V_Max - vpos) * Timings.H_Max;
|
||||||
if (vpos <= 240 && Timings.InterlaceField)
|
if (vpos <= 240 && Timings.InterlaceField && !IPPU.Interlace)
|
||||||
total -= ONE_DOT_CYCLE;
|
total -= ONE_DOT_CYCLE;
|
||||||
|
|
||||||
total += (vc) * Timings.H_Max;
|
total += (vc) * Timings.H_Max;
|
||||||
if (vc > 240 && !Timings.InterlaceField)
|
if (vc > 240 && !Timings.InterlaceField && !IPPU.Interlace)
|
||||||
total -= ONE_DOT_CYCLE;
|
total -= ONE_DOT_CYCLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,11 +329,11 @@ void S9xUpdateIRQPositions (void)
|
||||||
|
|
||||||
if (!PPU.HTimerEnabled && !PPU.VTimerEnabled)
|
if (!PPU.HTimerEnabled && !PPU.VTimerEnabled)
|
||||||
{
|
{
|
||||||
Timings.NextTimer = 0xffff;
|
Timings.NextIRQTimer = 0xffff;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Timings.NextTimer =
|
Timings.NextIRQTimer =
|
||||||
CyclesUntilNext (PPU.HTimerEnabled ? PPU.HTimerPosition : 0,
|
CyclesUntilNext (PPU.HTimerEnabled ? PPU.HTimerPosition : 0,
|
||||||
PPU.VTimerEnabled ? PPU.VTimerPosition : 0);
|
PPU.VTimerEnabled ? PPU.VTimerPosition : 0);
|
||||||
}
|
}
|
||||||
|
|
2
snes9x.h
2
snes9x.h
|
@ -346,7 +346,7 @@ struct STimings
|
||||||
int32 HDMAInit;
|
int32 HDMAInit;
|
||||||
int32 HDMAStart;
|
int32 HDMAStart;
|
||||||
int32 NMITriggerPos;
|
int32 NMITriggerPos;
|
||||||
int32 NextTimer;
|
int32 NextIRQTimer;
|
||||||
int32 IRQTriggerCycles;
|
int32 IRQTriggerCycles;
|
||||||
int32 WRAMRefreshPos;
|
int32 WRAMRefreshPos;
|
||||||
int32 RenderPos;
|
int32 RenderPos;
|
||||||
|
|
Loading…
Reference in New Issue