32x: change irq hadling, make it more drc friendly

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@816 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-10-14 14:46:38 +00:00
parent a8b03e2d4d
commit 6add7875b5
5 changed files with 46 additions and 25 deletions

View file

@ -48,6 +48,18 @@ void sh2_execute(SH2 *sh2_, int cycles)
{
UINT32 opcode;
if (sh2->test_irq && !sh2->delay && sh2->pending_level > ((sh2->sr >> 4) & 0x0f))
{
if (sh2->pending_irl > sh2->pending_int_irq)
sh2_do_irq(sh2, sh2->pending_irl, 64 + sh2->pending_irl/2);
else {
sh2_do_irq(sh2, sh2->pending_int_irq, sh2->pending_int_vector);
sh2->pending_int_irq = 0; // auto-clear
sh2->pending_level = sh2->pending_irl;
}
sh2->test_irq = 0;
}
if (sh2->delay)
{
sh2->ppc = sh2->delay;
@ -83,14 +95,6 @@ void sh2_execute(SH2 *sh2_, int cycles)
default: op1111(opcode); break;
}
if (sh2->test_irq && !sh2->delay)
{
if (sh2->pending_irl > sh2->pending_int_irq)
sh2_irl_irq(sh2, sh2->pending_irl);
else
sh2_internal_irq(sh2, sh2->pending_int_irq, sh2->pending_int_vector);
sh2->test_irq = 0;
}
sh2->icount--;
}
while (sh2->icount > 0 || sh2->delay); /* can't interrupt before delay */