static void t11_set_context(void *src) { if (src) t11 = *(t11_Regs *)src; change_pc(PC); t11_check_irqs(); }
static CPU_EXECUTE( t11 ) { t11_state *cpustate = get_safe_token(device); t11_check_irqs(cpustate); if (cpustate->wait_state) { cpustate->icount = 0; goto getout; } do { UINT16 op; cpustate->ppc = cpustate->reg[7]; /* copy PC to previous PC */ debugger_instruction_hook(device, cpustate->PCD); op = ROPCODE(cpustate); (*opcode_table[op >> 3])(cpustate, op); } while (cpustate->icount > 0); getout: ; }
static void set_irq_line(int irqline, int state) { /* set the appropriate bit */ if (state == CLEAR_LINE) t11.irq_state &= ~(1 << irqline); else t11.irq_state |= 1 << irqline; /* recheck for interrupts */ t11_check_irqs(); }
static void t11_check_irqs(void) { const struct irq_table_entry *irq = &irq_table[t11.irq_state & 15]; int priority = PSW & 0xe0; /* compare the priority of the interrupt to the PSW */ if (irq->priority > priority) { int vector = irq->vector; int new_pc, new_psw; /* call the callback; if we don't get -1 back, use the return value as our vector */ if (t11.irq_callback != NULL) { int new_vector = (*t11.irq_callback)(t11.irq_state & 15); if (new_vector != -1) vector = new_vector; } /* fetch the new PC and PSW from that vector */ assert((vector & 3) == 0); new_pc = RWORD(vector); new_psw = RWORD(vector + 2); /* push the old state, set the new one */ PUSH(PSW); PUSH(PC); PCD = new_pc; PSW = new_psw; change_pc(PC); t11_check_irqs(); /* count cycles and clear the WAIT flag */ t11.interrupt_cycles += 114; t11.wait_state = 0; } }
static void t11_check_irqs(t11_state *cpustate) { const struct irq_table_entry *irq = &irq_table[cpustate->irq_state & 15]; int priority = cpustate->PSW & 0xe0; /* compare the priority of the interrupt to the PSW */ if (irq->priority > priority) { int vector = irq->vector; int new_pc, new_psw; /* call the callback; if we don't get -1 back, use the return value as our vector */ if (cpustate->irq_callback != NULL) { int new_vector = (*cpustate->irq_callback)(cpustate->device, cpustate->irq_state & 15); if (new_vector != -1) vector = new_vector; } /* fetch the new PC and PSW from that vector */ assert((vector & 3) == 0); new_pc = RWORD(cpustate, vector); new_psw = RWORD(cpustate, vector + 2); /* push the old state, set the new one */ PUSH(cpustate, cpustate->PSW); PUSH(cpustate, cpustate->PC); cpustate->PCD = new_pc; cpustate->PSW = new_psw; t11_check_irqs(cpustate); /* count cycles and clear the WAIT flag */ cpustate->icount -= 114; cpustate->wait_state = 0; } }