void uae_ppc_emulate(void) { if (using_pearpc()) { ppc_interrupt(intlev()); if (ppc_state == PPC_STATE_ACTIVE || ppc_state == PPC_STATE_SLEEP) impl.run_single(10); } }
/* Do 'n' instructions. return ERR_NONE if successful, a negative value if an error occured, a positive value if a breakpoint has been encountered. */ int hw_m68k_run(int n) { #if 1 int i; GList *l; static FILE *flog; for(i=0; i<n; i++) { UWORD opcode; if(flog != NULL) { //fprintf(flog, "0x%06lx\n", m68k_getpc()); } else flog = fopen("C:\\tiemu.log", "wt"); if(bkpts.pc_log_size > 1) bkpts.pc_log[bkpts.pc_wr_ptr++ % bkpts.pc_log_size] = m68k_getpc(); opcode = nextiword(); (*cpufunctbl[opcode])(opcode); do_cycles(); if((l = bkpts.code) != NULL) { bkpts.id = 0; while(l) { if(GPOINTER_TO_INT(l->data) == (int)regs.pc) { bkpts.type = BK_TYPE_CODE; specialflags |= SPCFLAG_BRK; } bkpts.id++; l = g_list_next(l); } } /* Debug purposes */ #if 0 if (bInstructionsDisplay) { disasm(getPcRegister(), inst); printf("disasm: %s\n", inst); } #endif /* Flag management */ if(specialflags) { if(specialflags & SPCFLAG_ADRERR) { Exception(3); specialflags &= ~SPCFLAG_ADRERR; } if (specialflags & SPCFLAG_DOTRACE) { Exception(9); } while (specialflags & SPCFLAG_STOP) { do_cycles(); if (specialflags & (SPCFLAG_INT | SPCFLAG_DOINT)) { int intr = intlev(); specialflags &= ~(SPCFLAG_INT | SPCFLAG_DOINT); if (intr != -1 && intr > regs.intmask) { Interrupt(intr); regs.stopped = 0; specialflags &= ~SPCFLAG_STOP; } } } if (specialflags & SPCFLAG_TRACE) { specialflags &= ~SPCFLAG_TRACE; specialflags |= SPCFLAG_DOTRACE; } if (specialflags & SPCFLAG_DOINT) { int intr = intlev(); specialflags &= ~(SPCFLAG_INT | SPCFLAG_DOINT); if (intr != -1 && intr > regs.intmask) { Interrupt(intr); regs.stopped = 0; } } if (specialflags & SPCFLAG_INT) { specialflags &= ~SPCFLAG_INT; specialflags |= SPCFLAG_DOINT; } if (specialflags & SPCFLAG_BRK) { specialflags &= ~SPCFLAG_BRK; return 1; // DBG_BREAK } if(specialflags & SPCFLAG_DBTRACE) { specialflags &= ~SPCFLAG_DBTRACE; return 2; // DBG_TRACE } } } #endif return 0; }
static int do_specialties (int cycles) { if (mispcflags & SPCFLAG_COPPER) { #ifdef DEBUG_M68K dbg("do_specialties -> do_copper"); #endif do_copper (); } /*n_spcinsns++;*/ while ((mispcflags & SPCFLAG_BLTNASTY) && cycles > 0) { int c = blitnasty(); if (!c) { cycles -= 2 * CYCLE_UNIT; if (cycles < CYCLE_UNIT) cycles = 0; c = 1; } #ifdef DEBUG_M68K dbgf("do_specialties -> do_cycles BLTNASTY %i\n",c); #endif do_cycles(c * CYCLE_UNIT); if (mispcflags & SPCFLAG_COPPER) { #ifdef DEBUG_M68K dbg("do_specialties -> do_copper BLTNASTY"); #endif do_copper (); } } #ifdef DEBUG_M68K while (M68KCONTEXT.execinfo & 0x0080) { if (mispcflags & SPCFLAG_BRK) break; else if (M68KCONTEXT.execinfo & 0x0080) { int intr = intlev (); if (intr != -1 && intr > _68k_intmask) { M68KCONTEXT.execinfo &= 0xFF7F; break; } } dbg("CPU STOPPED !"); do_cycles(4 * CYCLE_UNIT); if (mispcflags & SPCFLAG_COPPER) { dbg("do_specialties -> do_copper STOPPED"); do_copper (); } } unset_special (SPCFLAG_STOP); #endif #if 0 // !defined(FAME_INTERRUPTS_SECURE_PATCH) && defined(FAME_INTERRUPTS_PATCH) if (uae4all_go_interrupt) { /*if (verb)*/ printf("uae4all_go_interrupt (s): %02x\n", uae4all_go_interrupt); M68KCONTEXT.interrupts[0]=uae4all_go_interrupt; M68KCONTEXT.execinfo&=0xFF67; uae4all_go_interrupt=0; m68k_irq_update(0); } #endif #ifdef SPECIAL_DEBUG_INTERRUPTS if ((mispcflags & SPCFLAG_DOINT)&&(!(mispcflags & SPCFLAG_INT))) { int intr = intlev (); #ifdef DEBUG_INTERRUPTS_EXTRA dbgf("DOINT : intr = %i, intmask=%i\n", intr, _68k_intmask); #endif unset_special (SPCFLAG_DOINT); if (intr != -1 && intr > _68k_intmask) { M68KCONTEXT.execinfo&=0xFF6F; m68k_raise_irq(intr,M68K_AUTOVECTORED_IRQ); // m68k_emulate(0); } } if (mispcflags & SPCFLAG_INT) { #ifdef DEBUG_INTERRUPTS_EXTRA dbg("ESTAMOS EN INT -> PASAMOS A DOINT"); #endif unset_special (SPCFLAG_INT); set_special (SPCFLAG_DOINT); } #endif if (mispcflags & SPCFLAG_BRK) { unset_special (SPCFLAG_BRK); return 1; } return 0; }