void CPU::enter() { while(true) { if(scheduler.sync == Scheduler::SynchronizeMode::CPU) { scheduler.sync = Scheduler::SynchronizeMode::All; scheduler.exit(Scheduler::ExitReason::SynchronizeEvent); } if(status.interrupt_pending) { status.interrupt_pending = false; if(status.nmi_pending) { status.nmi_pending = false; status.interrupt_vector = (regs.e == false ? 0xffea : 0xfffa); op_irq(); } else if(status.irq_pending) { status.irq_pending = false; status.interrupt_vector = (regs.e == false ? 0xffee : 0xfffe); op_irq(); } else if(status.reset_pending) { status.reset_pending = false; add_clocks(186); regs.pc.l = bus.read(0xfffc); regs.pc.h = bus.read(0xfffd); } } op_step(); } }
void CPU::enter() { while(true) { if(scheduler.sync == Scheduler::SynchronizeMode::CPU) { // we can only stop if there's enough time for at least one more event // on both the PPU and the SMP if (smp.clock < 0 && ppu.clock < 0) { scheduler.sync = Scheduler::SynchronizeMode::All; scheduler.exit(Scheduler::ExitReason::SynchronizeEvent); } } if(status.interrupt_pending) { status.interrupt_pending = false; if(status.nmi_pending) { status.nmi_pending = false; regs.vector = (regs.e == false ? 0xffea : 0xfffa); op_irq(); debugger.op_nmi(); } else if(status.irq_pending) { status.irq_pending = false; regs.vector = (regs.e == false ? 0xffee : 0xfffe); op_irq(); debugger.op_irq(); } else if(status.reset_pending) { status.reset_pending = false; add_clocks(186); regs.pc.l = bus.read(0xfffc); regs.pc.h = bus.read(0xfffd); } } op_step(); } }
void CPU::enter() { while(true) { if(scheduler.sync == Scheduler::SynchronizeMode::CPU) { scheduler.sync = Scheduler::SynchronizeMode::All; scheduler.exit(Scheduler::ExitReason::SynchronizeEvent); } if(status.nmi_pending) { status.nmi_pending = false; op_irq(regs.e == false ? 0xffea : 0xfffa); } if(status.irq_pending) { status.irq_pending = false; op_irq(regs.e == false ? 0xffee : 0xfffe); } op_step(); } }