static int tms_execute(int num_cycles) { tms_icount = num_cycles; while(tms_icount > 0) { UINT16 ppc; // handle block repeat if (tms.pmst.braf) { if (tms.pc == tms.paer) { if (tms.brcr > 0) { CHANGE_PC(tms.pasr); } tms.brcr--; if (tms.brcr <= 0) { tms.pmst.braf = 0; } } } ppc = tms.pc; CALL_DEBUGGER(tms.pc); tms.op = ROPCODE(); tms32051_opcode_table[tms.op >> 8](); // handle single repeat if (tms.rptc > 0) { if (ppc == tms.rpt_end) { CHANGE_PC(tms.rpt_start); tms.rptc--; } } else { tms.rptc = 0; } tms.timer.psc--; if (tms.timer.psc <= 0) { tms.timer.psc = tms.timer.tddr; tms.timer.tim--; if (tms.timer.tim <= 0) { // reset timer tms.timer.tim = tms.timer.prd; tms_interrupt(INTERRUPT_TINT); } } } return num_cycles - tms_icount; }
static CPU_EXECUTE( tms ) { tms32051_state *cpustate = get_safe_token(device); while(cpustate->icount > 0) { UINT16 ppc; // handle block repeat if (cpustate->pmst.braf) { if (cpustate->pc == cpustate->paer) { if (cpustate->brcr > 0) { CHANGE_PC(cpustate, cpustate->pasr); } cpustate->brcr--; if (cpustate->brcr <= 0) { cpustate->pmst.braf = 0; } } } ppc = cpustate->pc; debugger_instruction_hook(device, cpustate->pc); cpustate->op = ROPCODE(cpustate); tms32051_opcode_table[cpustate->op >> 8](cpustate); // handle single repeat if (cpustate->rptc > 0) { if (ppc == cpustate->rpt_end) { CHANGE_PC(cpustate, cpustate->rpt_start); cpustate->rptc--; } } else { cpustate->rptc = 0; } cpustate->timer.psc--; if (cpustate->timer.psc <= 0) { cpustate->timer.psc = cpustate->timer.tddr; cpustate->timer.tim--; if (cpustate->timer.tim <= 0) { // reset timer cpustate->timer.tim = cpustate->timer.prd; tms_interrupt(cpustate, INTERRUPT_TINT); } } } }