MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / NMI

Function NMI

source/CPU.cpp:401–441  ·  view source on GitHub ↗

define ENABLE_NMI_SUPPORT // Not used - so don't enable

Source from the content-addressed store, hash-verified

399
400//#define ENABLE_NMI_SUPPORT // Not used - so don't enable
401static __forceinline bool NMI(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, BOOL& flagv, BOOL& flagz)
402{
403#ifdef ENABLE_NMI_SUPPORT
404 if (!g_bNmiFlank)
405 return false;
406
407 // NMI signals are only serviced once
408 g_bNmiFlank = FALSE;
409#ifdef _DEBUG
410 g_nCycleIrqStart = g_nCumulativeCycles + uExecutedCycles;
411#endif
412 if (GetIsMemCacheValid())
413 {
414 _PUSH(regs.pc >> 8)
415 _PUSH(regs.pc & 0xFF)
416 EF_TO_AF
417 _PUSH(regs.ps & ~AF_BREAK)
418 regs.ps |= AF_INTERRUPT;
419 if (GetMainCpu() == CPU_65C02) // GH#1099
420 regs.ps &= ~AF_DECIMAL;
421 regs.pc = *(WORD*)(mem + _6502_NMI_VECTOR);
422 }
423 else
424 {
425 _PUSH_ALT(regs.pc >> 8)
426 _PUSH_ALT(regs.pc & 0xFF)
427 EF_TO_AF
428 _PUSH_ALT(regs.ps & ~AF_BREAK)
429 regs.ps |= AF_INTERRUPT;
430 if (GetMainCpu() == CPU_65C02) // GH#1099
431 regs.ps &= ~AF_DECIMAL;
432 regs.pc = READ_WORD_ALT(_6502_NMI_VECTOR);
433 }
434 UINT uExtraCycles = 0; // Needed for CYC(a) macro
435 CYC(7);
436 g_interruptInLastExecutionBatch = true;
437 return true;
438#else
439 return false;
440#endif
441}
442
443static __forceinline void CheckSynchronousInterruptSources(UINT cycles, ULONG uExecutedCycles)
444{

Callers 2

Cpu6502Function · 0.50
Cpu65C02Function · 0.50

Calls 2

GetIsMemCacheValidFunction · 0.70
GetMainCpuFunction · 0.70

Tested by

no test coverage detected