Пример #1
0
/*
 * run the cpu
 */
void cpu_run(void)
{
    byte i;
    const Instr *pi;

    cpu_reset();

    do {
        /* check for pending interrupts */
        if (!get_int_disable_flag() && (pending_interrupt & HANDLE_IRQ))
            DO_INTERRUPT();

        if (pending_interrupt & HANDLE_NMI) {
            pending_interrupt &= ~HANDLE_NMI;
            DO_NMI();
        }

        /* fetch the next instruction */
        i = fetch_byte(cpu.pc);

        pi = instructions[i];
        if (NULL == pi) {
            warning("unrecognized instruction \"$%.2x\" at $%.4hx.\n",
                    i, cpu.pc);
            break;
        }

        /* execute the instruction */
        (*pi->fnc)();
    } while (!err);
}
Пример #2
0
static void set_irq_line(int irqline, int state)
{
	if (irqline == INPUT_LINE_NMI)
	{
		if (h6280.nmi_state == state) return;
		h6280.nmi_state = state;
		if (state != CLEAR_LINE)
	    {
			DO_INTERRUPT(H6280_NMI_VEC);
		}
	}
	else if (irqline < 3)
	{
	    h6280.irq_state[irqline] = state;

		/* If line is cleared, just exit */
		if (state == CLEAR_LINE) return;

		/* Check if interrupts are enabled and the IRQ mask is clear */
		CHECK_IRQ_LINES;
	}
}