mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-02-08 08:30:46 +00:00
Check interrupt sources after every opcode when in normal speed. (#651)
This commit is contained in:
parent
941ef46e9a
commit
3a41061f83
@ -132,10 +132,11 @@ unsigned __int64 g_nCumulativeCycles = 0;
|
|||||||
static ULONG g_nCyclesExecuted; // # of cycles executed up to last IO access
|
static ULONG g_nCyclesExecuted; // # of cycles executed up to last IO access
|
||||||
|
|
||||||
//static signed long g_uInternalExecutedCycles;
|
//static signed long g_uInternalExecutedCycles;
|
||||||
// TODO: Use IRQ_CHECK_TIMEOUT=128 when running at full-speed else with IRQ_CHECK_TIMEOUT=1
|
// Use IRQ_CHECK_TIMEOUT=128 when running at full-speed; else use IRQ_CHECK_TIMEOUT=1 (GH#651)
|
||||||
// - What about when running benchmark?
|
// - What about when running benchmark?
|
||||||
static const int IRQ_CHECK_TIMEOUT = 128;
|
static const int IRQ_CHECK_TIMEOUT_FULL_SPEED = 128;
|
||||||
static signed int g_nIrqCheckTimeout = IRQ_CHECK_TIMEOUT;
|
static const int IRQ_CHECK_TIMEOUT_NORMAL_SPEED = 1;
|
||||||
|
static signed int g_nIrqCheckTimeout = IRQ_CHECK_TIMEOUT_NORMAL_SPEED;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -417,20 +418,20 @@ static __forceinline void IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __forceinline void CheckInterruptSources(ULONG uExecutedCycles)
|
static __forceinline void CheckInterruptSources(ULONG uExecutedCycles, const bool bVideoUpdate)
|
||||||
{
|
{
|
||||||
if (g_nIrqCheckTimeout < 0)
|
if (g_nIrqCheckTimeout < 0)
|
||||||
{
|
{
|
||||||
MB_UpdateCycles(uExecutedCycles);
|
MB_UpdateCycles(uExecutedCycles);
|
||||||
sg_Mouse.SetVBlank( !VideoGetVblBar(uExecutedCycles) );
|
sg_Mouse.SetVBlank( !VideoGetVblBar(uExecutedCycles) );
|
||||||
g_nIrqCheckTimeout = IRQ_CHECK_TIMEOUT;
|
g_nIrqCheckTimeout = bVideoUpdate ? IRQ_CHECK_TIMEOUT_NORMAL_SPEED : IRQ_CHECK_TIMEOUT_FULL_SPEED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GH#608: IRQ needs to occur within 17 cycles (6 opcodes) of configuring the timer interrupt
|
// GH#608: IRQ needs to occur within 17 cycles (6 opcodes) of configuring the timer interrupt
|
||||||
void CpuAdjustIrqCheck(UINT uCyclesUntilInterrupt)
|
void CpuAdjustIrqCheck(UINT uCyclesUntilInterrupt)
|
||||||
{
|
{
|
||||||
if (uCyclesUntilInterrupt < IRQ_CHECK_TIMEOUT)
|
if (g_bFullSpeed && uCyclesUntilInterrupt < IRQ_CHECK_TIMEOUT_FULL_SPEED)
|
||||||
g_nIrqCheckTimeout = uCyclesUntilInterrupt;
|
g_nIrqCheckTimeout = uCyclesUntilInterrupt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ static DWORD Cpu6502(DWORD uTotalCycles, const bool bVideoUpdate)
|
|||||||
#undef $
|
#undef $
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckInterruptSources(uExecutedCycles);
|
CheckInterruptSources(uExecutedCycles, bVideoUpdate);
|
||||||
NMI(uExecutedCycles, flagc, flagn, flagv, flagz);
|
NMI(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||||
IRQ(uExecutedCycles, flagc, flagn, flagv, flagz);
|
IRQ(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ static DWORD Cpu65C02(DWORD uTotalCycles, const bool bVideoUpdate)
|
|||||||
#undef $
|
#undef $
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckInterruptSources(uExecutedCycles);
|
CheckInterruptSources(uExecutedCycles, bVideoUpdate);
|
||||||
NMI(uExecutedCycles, flagc, flagn, flagv, flagz);
|
NMI(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||||
IRQ(uExecutedCycles, flagc, flagn, flagv, flagz);
|
IRQ(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ static DWORD Cpu65D02(DWORD uTotalCycles, const bool bVideoUpdate)
|
|||||||
}
|
}
|
||||||
#undef $
|
#undef $
|
||||||
|
|
||||||
CheckInterruptSources(uExecutedCycles);
|
CheckInterruptSources(uExecutedCycles, bVideoUpdate);
|
||||||
NMI(uExecutedCycles, flagc, flagn, flagv, flagz);
|
NMI(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||||
IRQ(uExecutedCycles, flagc, flagn, flagv, flagz);
|
IRQ(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ static __forceinline void DoIrqProfiling(DWORD uCycles)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static __forceinline void CheckInterruptSources(ULONG uExecutedCycles)
|
static __forceinline void CheckInterruptSources(ULONG uExecutedCycles, const bool bVideoUpdate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user