} else {
// Last 6 cycles of E-clock
// IPL fetch that got delayed by CIA access?
- if (cia_now_evt == regs.ipl_evt) {
+ if (cia_now_evt == regs.ipl_evt && currprefs.cpu_model <= 68010) {
int phase = cia_cycles((e_clock_end - 2) * E_CYCLE_UNIT, 4, value, 1);
regs.ipl[0] = regs.ipl_pin;
cia_cycles(2 * E_CYCLE_UNIT, phase, value, 1);
static int dma_cycle(uaecptr addr, uae_u32 value, int *mode, int *ipl)
{
int hpos_next, hpos_old;
+ int ws = 0;
blt_info.nasty_cnt = 1;
blt_info.wait_nasty = 0;
- *ipl = regs.ipl_pin;
if (cpu_tracer < 0) {
return current_hpos_safe();
}
if (blt_info.nasty_cnt > 0) {
blt_info.nasty_cnt++;
}
- *ipl = regs.ipl_pin;
+ if (!ws) {
+ *ipl = regs.ipl_pin;
+ ws = 1;
+ }
do_cycles(1 * CYCLE_UNIT);
/* bus was allocated to dma channel, wait for next cycle.. */
}
uae_u32 wait_cpu_cycle_read(uaecptr addr, int mode)
{
uae_u32 v = 0;
- int hpos, ipl;
+ int hpos;
+ int ipl = regs.ipl_pin;
evt_t now = get_cycles();
sync_cycles();
// if IPL fetch was pending and CPU had wait states
// Use ipl_pin value from previous cycle
- if (now == regs.ipl_evt && regs.ipl_pin_change_evt > now + cpuipldelay2) {
+ if (now == regs.ipl_evt) {
regs.ipl[0] = ipl;
}
void wait_cpu_cycle_write(uaecptr addr, int mode, uae_u32 v)
{
- int hpos, ipl;
+ int hpos;
+ int ipl = regs.ipl_pin;
evt_t now = get_cycles();
sync_cycles();
// if IPL fetch was pending and CPU had wait states:
// Use ipl_pin value from previous cycle
- if (now == regs.ipl_evt && regs.ipl_pin_change_evt > now + cpuipldelay2) {
+ if (now == regs.ipl_evt) {
regs.ipl[0] = ipl;
}
}
{
if (using_ce) {
pre_ipl = 1;
- out("ipl_fetch_pre();\n");
+ out("ipl_fetch_next_pre();\n");
} else if (using_prefetch) {
pre_ipl = 1;
//out("ipl_fetch_prefetch(%d);\n", get_current_cycles() + 2);
out("{\n");
out("int cycles = %d;\n", c);
out("cycles += 2 * ccnt;\n");
- addcycles000_3(false);
+ addcycles000_3(true);
out("}\n");
}
next_level_020_to_010();
if (curi->size == sz_byte) {
// MOVE TO CCR
addcycles000(4);
- set_ipl();
out("MakeSR();\nregs.sr &= 0xFF00;\nregs.sr |= src & 0xFF;\n");
makefromsr();
+ set_ipl();
} else {
// MOVE TO SR
check_trace();
extern void intlev_load(void);
extern void ipl_fetch_now_pre(void);
extern void ipl_fetch_next_pre(void);
-extern void ipl_fetch_pre(void);
extern void ipl_fetch_now(void);
extern void ipl_fetch_next(void);
extern void dump_counts (void);
// non-autovectored
// this is basically normal memory access and takes 4 cycles (without wait states).
vector = x_get_byte(0x00fffff1 | ((nr - 24) << 1));
+ x_do_cycles(4 * cpucycleunit);
} else {
// autovectored
- x_do_cycles(4 * cpucycleunit);
}
return vector;
}
x_put_word (m68k_areg (regs, 7) + 4, currpc); // write low address
if (interrupt) {
vector_nr = iack_cycle(nr);
- x_do_cycles(4 * cpucycleunit);
}
x_put_word (m68k_areg (regs, 7) + 0, regs.sr); // write SR
x_put_word (m68k_areg (regs, 7) + 2, currpc >> 16); // write high address
x_put_word (m68k_areg (regs, 7) + 4, currpc); // write low address
if (interrupt) {
vector_nr = iack_cycle(nr);
- x_do_cycles(4 * cpucycleunit);
}
x_put_word (m68k_areg (regs, 7) + 0, regs.sr); // write SR
x_put_word (m68k_areg (regs, 7) + 2, currpc >> 16); // write high address
}
// ipl check mid next memory cycle
-void ipl_fetch_pre(void)
+void ipl_fetch_next_pre(void)
{
- ipl_fetch_next();
regs.ipl_evt_pre = get_cycles();
regs.ipl_evt_pre_mode = 1;
}
void ipl_fetch_now_pre(void)
{
+ regs.ipl[1] = regs.ipl_pin;
regs.ipl_evt_pre = get_cycles();
regs.ipl_evt_pre_mode = 0;
}
// ipl check was early enough, interrupt possible after current instruction
void ipl_fetch_now(void)
{
- regs.ipl_evt = get_cycles();
+ evt_t c = get_cycles();
+ regs.ipl_evt = c;
regs.ipl[0] = regs.ipl_pin;
regs.ipl[1] = 0;
}
// if not early enough: interrupt starts after following instruction.
void ipl_fetch_next(void)
{
- if (get_cycles() - regs.ipl_pin_change_evt >= cpuipldelay4) {
+ evt_t c = get_cycles();
+ if (c - regs.ipl_pin_change_evt >= cpuipldelay4) {
regs.ipl[0] = regs.ipl_pin;
regs.ipl[1] = 0;
} else {
if (ipl) {
unset_special(SPCFLAG_INT);
do_interrupt(ipl);
- } else {
- regs.ipl[0] = regs.ipl[1];
- regs.ipl[1] = 0;
}
} else {
if (regs.spcflags & SPCFLAG_INT) {