/* Pulse the RESET line on the CPU */ void m68k_pulse_reset(m68ki_cpu_core *m68k) { /* Clear all stop levels and eat up all remaining cycles */ m68k->stopped = 0; if (m68k->remaining_cycles > 0) m68k->remaining_cycles = 0; #if M68K_EMULATE_ADDRESS_ERROR m68k->run_mode = RUN_MODE_BERR_AERR_RESET; #endif /* Turn off tracing */ m68k->t1_flag = m68k->t0_flag = 0; m68ki_clear_trace(); /* Interrupt mask to level 7 */ m68k->int_mask = 0x0700; m68k->int_level = 0; m68k->virq_state = 0; /* Reset VBR */ m68k->vbr = 0; /* Go to supervisor mode */ m68ki_set_sm_flag(m68k, SFLAG_SET | MFLAG_CLEAR); /* Invalidate the prefetch queue */ /* Set to arbitrary number since our first fetch is from 0 */ #if M68K_EMULATE_PREFETCH m68k->pref_addr = 0x1000; #endif /* Read the initial stack pointer and program counter */ m68ki_jump(m68k, 0); REG_SP = m68ki_read_imm_32(m68k); REG_PC = m68ki_read_imm_32(m68k); m68ki_jump(m68k, REG_PC); #if M68K_EMULATE_ADDRESS_ERROR m68k->run_mode = RUN_MODE_NORMAL; #endif m68k->reset_cycles = m68k->cyc_exception[EXCEPTION_RESET]; }
// Pulse the RESET line on the CPU void m68k_pulse_reset(void) { static uint32_t emulation_initialized = 0; // The first call to this function initializes the opcode handler jump table if (!emulation_initialized) { #if 0 m68ki_build_opcode_table(); m68k_set_int_ack_callback(NULL); m68k_set_bkpt_ack_callback(NULL); m68k_set_reset_instr_callback(NULL); m68k_set_pc_changed_callback(NULL); m68k_set_fc_callback(NULL); m68k_set_instr_hook_callback(NULL); #else // Build opcode handler table here... read_table68k(); do_merges(); BuildCPUFunctionTable(); #endif emulation_initialized = 1; } // if (CPU_TYPE == 0) /* KW 990319 */ // m68k_set_cpu_type(M68K_CPU_TYPE_68000); #if 0 /* Clear all stop levels and eat up all remaining cycles */ CPU_STOPPED = 0; SET_CYCLES(0); /* Turn off tracing */ FLAG_T1 = FLAG_T0 = 0; m68ki_clear_trace(); /* Interrupt mask to level 7 */ FLAG_INT_MASK = 0x0700; /* Reset VBR */ REG_VBR = 0; /* Go to supervisor mode */ m68ki_set_sm_flag(SFLAG_SET | MFLAG_CLEAR); /* Invalidate the prefetch queue */ #if M68K_EMULATE_PREFETCH /* Set to arbitrary number since our first fetch is from 0 */ CPU_PREF_ADDR = 0x1000; #endif /* M68K_EMULATE_PREFETCH */ /* Read the initial stack pointer and program counter */ m68ki_jump(0); REG_SP = m68ki_read_imm_32(); REG_PC = m68ki_read_imm_32(); m68ki_jump(REG_PC); #else regs.spcflags = 0; regs.stopped = 0; regs.remainingCycles = 0; regs.intmask = 0x07; regs.s = 1; // Supervisor mode ON // Read initial SP and PC m68k_areg(regs, 7) = m68k_read_memory_32(0); m68k_setpc(m68k_read_memory_32(4)); refill_prefetch(m68k_getpc(), 0); #endif }