mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
32x, improve sh2 scheduling
This commit is contained in:
parent
fe8f2d963e
commit
7b02a2c3e3
2 changed files with 10 additions and 12 deletions
|
@ -55,15 +55,13 @@ void p32x_update_irls(SH2 *active_sh2, unsigned int m68k_cycles)
|
|||
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);
|
||||
|
@ -256,9 +254,9 @@ static void p32x_start_blank(void)
|
|||
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)
|
||||
|
@ -270,8 +268,8 @@ 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)
|
||||
|
|
|
@ -41,13 +41,13 @@ void p32x_pwm_ctl_changed(void)
|
|||
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);
|
||||
|
@ -110,7 +110,7 @@ static void consume_fifo_do(SH2 *sh2, unsigned int m68k_cycles,
|
|||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue