Core emulation: simplify NMI & IRQ handling

This commit is contained in:
tomcw 2021-10-18 21:45:45 +01:00
parent 18f5fafb30
commit fa18382757
3 changed files with 8 additions and 21 deletions

View File

@ -446,7 +446,6 @@ static __forceinline bool IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn,
(g_bmIRQ & 8) ? "MOUSE" : "UNKNOWN";
LogOutput("IRQ (%08X) (%s)\n", (UINT)g_nCycleIrqStart, pSrc);
#endif
CheckSynchronousInterruptSources(7, uExecutedCycles);
g_interruptInLastExecutionBatch = true;
irqTaken = true;
}

View File

@ -50,18 +50,12 @@ static DWORD Cpu6502(DWORD uTotalCycles, const bool bVideoUpdate)
{
const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles)
}
else if (NMI(uExecutedCycles, flagc, flagn, flagv, flagz) || IRQ(uExecutedCycles, flagc, flagn, flagv, flagz))
{
// Allow AppleWin debugger's single-stepping to just step the pending IRQ
}
else
{
if (IRQ(uExecutedCycles, flagc, flagn, flagv, flagz) || NMI(uExecutedCycles, flagc, flagn, flagv, flagz))
{
if (bVideoUpdate)
{
ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles;
NTSC_VideoUpdateCycles(uElapsedCycles);
}
continue; // Allow AppleWin debugger's single-stepping to just step the pending IRQ
}
HEATMAP_X( regs.pc );
Fetch(iOpcode, uExecutedCycles);

View File

@ -50,18 +50,12 @@ static DWORD Cpu65C02(DWORD uTotalCycles, const bool bVideoUpdate)
{
const UINT uZ80Cycles = z80_mainloop(uTotalCycles, uExecutedCycles); CYC(uZ80Cycles)
}
else if (NMI(uExecutedCycles, flagc, flagn, flagv, flagz) || IRQ(uExecutedCycles, flagc, flagn, flagv, flagz))
{
// Allow AppleWin debugger's single-stepping to just step the pending IRQ
}
else
{
if (IRQ(uExecutedCycles, flagc, flagn, flagv, flagz) || NMI(uExecutedCycles, flagc, flagn, flagv, flagz))
{
if (bVideoUpdate)
{
ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles;
NTSC_VideoUpdateCycles(uElapsedCycles);
}
continue; // Allow AppleWin debugger's single-stepping to just step the pending IRQ
}
HEATMAP_X( regs.pc );
Fetch(iOpcode, uExecutedCycles);