mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
32x, minor poll detection fix
This commit is contained in:
parent
b074a2b5b6
commit
c9d5f41b0a
2 changed files with 15 additions and 13 deletions
|
@ -54,14 +54,14 @@ void p32x_update_irls(SH2 *active_sh2, unsigned int m68k_cycles)
|
||||||
|
|
||||||
mrun = sh2_irl_irq(&msh2, mlvl, msh2.state & SH2_STATE_RUN);
|
mrun = sh2_irl_irq(&msh2, mlvl, msh2.state & SH2_STATE_RUN);
|
||||||
if (mrun) {
|
if (mrun) {
|
||||||
p32x_sh2_poll_event(&msh2, SH2_IDLE_STATES, m68k_cycles);
|
p32x_sh2_poll_event(&msh2, SH2_IDLE_STATES & ~SH2_STATE_SLEEP, m68k_cycles);
|
||||||
if (msh2.state & SH2_STATE_RUN)
|
if (msh2.state & SH2_STATE_RUN)
|
||||||
sh2_end_run(&msh2, 0);
|
sh2_end_run(&msh2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
srun = sh2_irl_irq(&ssh2, slvl, ssh2.state & SH2_STATE_RUN);
|
srun = sh2_irl_irq(&ssh2, slvl, ssh2.state & SH2_STATE_RUN);
|
||||||
if (srun) {
|
if (srun) {
|
||||||
p32x_sh2_poll_event(&ssh2, SH2_IDLE_STATES, m68k_cycles);
|
p32x_sh2_poll_event(&ssh2, SH2_IDLE_STATES & ~SH2_STATE_SLEEP, m68k_cycles);
|
||||||
if (ssh2.state & SH2_STATE_RUN)
|
if (ssh2.state & SH2_STATE_RUN)
|
||||||
sh2_end_run(&ssh2, 0);
|
sh2_end_run(&ssh2, 0);
|
||||||
}
|
}
|
||||||
|
@ -268,6 +268,9 @@ static void p32x_end_blank(void)
|
||||||
Pico32x.vdp_regs[0x0a/2] &= ~P32XV_PEN; // no palette access
|
Pico32x.vdp_regs[0x0a/2] &= ~P32XV_PEN; // no palette access
|
||||||
if (!(Pico32x.sh2_regs[0] & 0x80))
|
if (!(Pico32x.sh2_regs[0] & 0x80))
|
||||||
p32x_schedule_hint(NULL, SekCyclesDone());
|
p32x_schedule_hint(NULL, SekCyclesDone());
|
||||||
|
|
||||||
|
p32x_sh2_poll_event(&msh2, SH2_STATE_VPOLL, SekCyclesDone());
|
||||||
|
p32x_sh2_poll_event(&ssh2, SH2_STATE_VPOLL, SekCyclesDone());
|
||||||
}
|
}
|
||||||
|
|
||||||
void p32x_schedule_hint(SH2 *sh2, unsigned int m68k_cycles)
|
void p32x_schedule_hint(SH2 *sh2, unsigned int m68k_cycles)
|
||||||
|
@ -577,12 +580,10 @@ void sync_sh2s_lockstep(unsigned int m68k_target)
|
||||||
|
|
||||||
void PicoFrame32x(void)
|
void PicoFrame32x(void)
|
||||||
{
|
{
|
||||||
|
// XXX this is somehow misplaced here
|
||||||
sh2_execute_prepare(&msh2, PicoIn.opt & POPT_EN_DRC);
|
sh2_execute_prepare(&msh2, PicoIn.opt & POPT_EN_DRC);
|
||||||
sh2_execute_prepare(&ssh2, PicoIn.opt & POPT_EN_DRC);
|
sh2_execute_prepare(&ssh2, PicoIn.opt & POPT_EN_DRC);
|
||||||
|
|
||||||
p32x_sh2_poll_event(&msh2, SH2_STATE_VPOLL, SekCyclesDone());
|
|
||||||
p32x_sh2_poll_event(&ssh2, SH2_STATE_VPOLL, SekCyclesDone());
|
|
||||||
|
|
||||||
if (PicoIn.AHW & PAHW_MCD)
|
if (PicoIn.AHW & PAHW_MCD)
|
||||||
pcd_prepare_frame();
|
pcd_prepare_frame();
|
||||||
|
|
||||||
|
|
|
@ -162,9 +162,6 @@ static int PicoFrameHints(void)
|
||||||
|
|
||||||
SyncCPUs(Pico.t.m68c_aim);
|
SyncCPUs(Pico.t.m68c_aim);
|
||||||
|
|
||||||
// === VBLANK, 1st line ===
|
|
||||||
pv->status &= ~PVS_ACTIVE;
|
|
||||||
|
|
||||||
if (!skip)
|
if (!skip)
|
||||||
{
|
{
|
||||||
if (Pico.est.DrawScanline < y)
|
if (Pico.est.DrawScanline < y)
|
||||||
|
@ -177,6 +174,9 @@ static int PicoFrameHints(void)
|
||||||
p32x_render_frame();
|
p32x_render_frame();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// === VBLANK, 1st line ===
|
||||||
|
pv->status &= ~PVS_ACTIVE;
|
||||||
|
|
||||||
memcpy(PicoIn.padInt, PicoIn.pad, sizeof(PicoIn.padInt));
|
memcpy(PicoIn.padInt, PicoIn.pad, sizeof(PicoIn.padInt));
|
||||||
PAD_DELAY();
|
PAD_DELAY();
|
||||||
|
|
||||||
|
@ -188,6 +188,9 @@ static int PicoFrameHints(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
pv->status |= SR_VB | PVS_VB2; // go into vblank
|
pv->status |= SR_VB | PVS_VB2; // go into vblank
|
||||||
|
#ifdef PICO_32X
|
||||||
|
p32x_start_blank();
|
||||||
|
#endif
|
||||||
|
|
||||||
// the following SekRun is there for several reasons:
|
// the following SekRun is there for several reasons:
|
||||||
// there must be a delay after vblank bit is set and irq is asserted (Mazin Saga)
|
// there must be a delay after vblank bit is set and irq is asserted (Mazin Saga)
|
||||||
|
@ -198,8 +201,11 @@ static int PicoFrameHints(void)
|
||||||
do_timing_hacks_start(pv);
|
do_timing_hacks_start(pv);
|
||||||
CPUS_RUN(CYCLES_M68K_VINT_LAG);
|
CPUS_RUN(CYCLES_M68K_VINT_LAG);
|
||||||
|
|
||||||
|
SyncCPUs(Pico.t.m68c_aim);
|
||||||
|
|
||||||
pv->status |= SR_F;
|
pv->status |= SR_F;
|
||||||
pv->pending_ints |= 0x20;
|
pv->pending_ints |= 0x20;
|
||||||
|
|
||||||
if (pv->reg[1] & 0x20) {
|
if (pv->reg[1] & 0x20) {
|
||||||
if (Pico.t.m68c_cnt - Pico.t.m68c_aim < 60) // CPU blocked?
|
if (Pico.t.m68c_cnt - Pico.t.m68c_aim < 60) // CPU blocked?
|
||||||
SekExecM68k(11); // HACK
|
SekExecM68k(11); // HACK
|
||||||
|
@ -208,15 +214,10 @@ static int PicoFrameHints(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80)) {
|
if (Pico.m.z80Run && !Pico.m.z80_reset && (PicoIn.opt&POPT_EN_Z80)) {
|
||||||
PicoSyncZ80(Pico.t.m68c_aim);
|
|
||||||
elprintf(EL_INTS, "zint");
|
elprintf(EL_INTS, "zint");
|
||||||
z80_int();
|
z80_int();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PICO_32X
|
|
||||||
p32x_start_blank();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Run scanline:
|
// Run scanline:
|
||||||
CPUS_RUN(CYCLES_M68K_LINE - CYCLES_M68K_VINT_LAG);
|
CPUS_RUN(CYCLES_M68K_LINE - CYCLES_M68K_VINT_LAG);
|
||||||
do_timing_hacks_end(pv);
|
do_timing_hacks_end(pv);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue