mrun = sh2_irl_irq(&msh2, mlvl, msh2.state & SH2_STATE_RUN);
if (mrun) {
p32x_sh2_poll_event(&msh2, SH2_IDLE_STATES & ~SH2_STATE_SLEEP, m68k_cycles);
- if (msh2.state & SH2_STATE_RUN)
- sh2_end_run(&msh2, 0);
+ p32x_sync_other_sh2(&msh2, m68k_cycles);
}
srun = sh2_irl_irq(&ssh2, slvl, ssh2.state & SH2_STATE_RUN);
if (srun) {
p32x_sh2_poll_event(&ssh2, SH2_IDLE_STATES & ~SH2_STATE_SLEEP, m68k_cycles);
- if (ssh2.state & SH2_STATE_RUN)
- sh2_end_run(&ssh2, 0);
+ p32x_sync_other_sh2(&ssh2, m68k_cycles);
}
elprintf(EL_32X, "update_irls: m %d/%d, s %d/%d", mlvl, mrun, slvl, srun);
Pico32xSwapDRAM(Pico32x.pending_fb ^ 1);
}
- p32x_trigger_irq(NULL, SekCyclesDone(), P32XI_VINT);
- p32x_sh2_poll_event(&msh2, SH2_STATE_VPOLL, SekCyclesDone());
- p32x_sh2_poll_event(&ssh2, SH2_STATE_VPOLL, SekCyclesDone());
+ p32x_trigger_irq(NULL, Pico.t.m68c_aim, P32XI_VINT);
+ p32x_sh2_poll_event(&msh2, SH2_STATE_VPOLL, Pico.t.m68c_aim);
+ p32x_sh2_poll_event(&ssh2, SH2_STATE_VPOLL, Pico.t.m68c_aim);
}
static void p32x_end_blank(void)
if (!(Pico32x.sh2_regs[0] & 0x80))
p32x_schedule_hint(NULL, SekCyclesDone());
- p32x_sh2_poll_event(&msh2, SH2_STATE_VPOLL, SekCyclesDone());
- p32x_sh2_poll_event(&ssh2, SH2_STATE_VPOLL, SekCyclesDone());
+ p32x_sh2_poll_event(&msh2, SH2_STATE_VPOLL, Pico.t.m68c_aim);
+ p32x_sh2_poll_event(&ssh2, SH2_STATE_VPOLL, Pico.t.m68c_aim);
}
void p32x_schedule_hint(SH2 *sh2, unsigned int m68k_cycles)
pwm.irq_reload = pwm.irq_timer;
pwm.irq_state = pwm_irq_opt ? PWM_IRQ_STOPPED: PWM_IRQ_LOCKED;
- if (Pico32x.pwm_irq_cnt == 0)
+ if (Pico32x.pwm_irq_cnt <= 0)
Pico32x.pwm_irq_cnt = pwm.irq_reload;
}
static void do_pwm_irq(SH2 *sh2, unsigned int m68k_cycles)
{
- p32x_trigger_irq(sh2, m68k_cycles, P32XI_PWM);
+ p32x_trigger_irq(NULL, m68k_cycles, P32XI_PWM);
if (Pico32x.regs[0x30 / 2] & P32XP_RTP) {
p32x_event_schedule(m68k_cycles, P32X_EVENT_PWM, pwm.cycles / 3 + 1);
mem->pwm[pwm.ptr * 2 + 1] = pwm.current[1];
pwm.ptr = (pwm.ptr + 1) & (PWM_BUFF_LEN - 1);
- if (--Pico32x.pwm_irq_cnt == 0) {
+ if (--Pico32x.pwm_irq_cnt <= 0) {
Pico32x.pwm_irq_cnt = pwm.irq_reload;
do_pwm_irq(sh2, m68k_cycles);
} else if (Pico32x.pwm_p[1] == 0 && pwm.irq_state >= PWM_IRQ_LOW) {