static CPU_EXECUTE( m65ce02 ) { m65ce02_Regs *cpustate = get_safe_token(device); cpustate->icount = cycles; do { UINT8 op; PPC = PCD; debugger_instruction_hook(device, PCD); /* if an irq is pending, take it now */ if( cpustate->pending_irq ) m65ce02_take_irq(cpustate); op = RDOP(); (*insn65ce02[op])(cpustate); /* check if the I flag was just reset (interrupts enabled) */ if( cpustate->after_cli ) { LOG(("M65ce02 '%s' after_cli was >0", cpustate->device->tag)); cpustate->after_cli = 0; if (cpustate->irq_state != CLEAR_LINE) { LOG((": irq line is asserted: set pending IRQ\n")); cpustate->pending_irq = 1; } else { LOG((": irq line is clear\n")); } } else if( cpustate->pending_irq ) m65ce02_take_irq(cpustate); } while (cpustate->icount > 0); return cycles - cpustate->icount; }
int m65ce02_execute(int cycles) { m65ce02_ICount = cycles; change_pc(PCD); do { UINT8 op; PPC = PCD; CALL_MAME_DEBUG; /* if an irq is pending, take it now */ if( m65ce02.pending_irq ) m65ce02_take_irq(); op = RDOP(); (*insn65ce02[op])(); /* check if the I flag was just reset (interrupts enabled) */ if( m65ce02.after_cli ) { LOG(("M65ce02#%d after_cli was >0", cpu_getactivecpu())); m65ce02.after_cli = 0; if (m65ce02.irq_state != CLEAR_LINE) { LOG((": irq line is asserted: set pending IRQ\n")); m65ce02.pending_irq = 1; } else { LOG((": irq line is clear\n")); } } else if( m65ce02.pending_irq ) m65ce02_take_irq(); } while (m65ce02_ICount > 0); return cycles - m65ce02_ICount; }