public int executeCycle(int ticksToRun, int tickSteps) { int ticksExecuted = 0; while (ticksExecuted < ticksToRun) { var singleTicks = cpu.steps(tickSteps); ticksExecuted += singleTicks; ticksIrq += singleTicks; if (ticksIrq >= Timing.CALL_IRQ_AFTER_TICKS) { ticksIrq -= Timing.CALL_IRQ_AFTER_TICKS; // TODO isPeriodicIrqEnabled setting is from freeWpc project, unknown if the "real" WPC system implements this too // some games needs a manual irq trigger if this is implemented (like indiana jones) //if (this.asic.periodicIRQTimerEnabled) { cpu.irq(); //} } displayBoard.executeCycle(singleTicks); asic.executeCycle(singleTicks); } Debug.Print("CPUSTATE ticks: {0}, irqExecuted: {1}, irqMissed: {2}, firqExecuted: {3}, firqMissed: {4}", cpu.tickCount, cpu.irqCount, cpu.missedIRQ, cpu.firqCount, cpu.missedFIRQ); return(ticksExecuted); }
public void FlagsCorrectAfterIRQ_InitFlags_0x00() { TestContext.WriteLine("flags should be correct after calling irq(), init flags to 0x00"); cpu.set("flags", 0x00); cpu.irq(); cpu.fetch = () => { return(0x12); }; cpu.steps(); Assert.That("EfhInzvc", Is.EqualTo(cpu.flagsToString())); Assert.That(readMemoryAddress[2], Is.EqualTo(0xFFF8)); Assert.That(readMemoryAddress[3], Is.EqualTo(0xFFF9)); }