X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=cpu%2Fsh2%2Fmame%2Fsh2pico.c;h=bdab22b2bf3d32c5e26dba1e4eb1632c2c8627ed;hb=bcf65fd674528896fe1bc233c8bab617f6b2c86e;hp=fe5b7d7f559f621a7c4b40c2e10d425dfa091f35;hpb=679af8a3f466a2a4a20f58e4181a231fb73e9836;p=picodrive.git diff --git a/cpu/sh2/mame/sh2pico.c b/cpu/sh2/mame/sh2pico.c index fe5b7d7..bdab22b 100644 --- a/cpu/sh2/mame/sh2pico.c +++ b/cpu/sh2/mame/sh2pico.c @@ -8,12 +8,12 @@ typedef unsigned int UINT32; typedef unsigned short UINT16; typedef unsigned char UINT8; -#define RB(a) p32x_sh2_read8(a,sh2->is_slave) -#define RW(a) p32x_sh2_read16(a,sh2->is_slave) -#define RL(a) p32x_sh2_read32(a,sh2->is_slave) -#define WB(a,d) p32x_sh2_write8(a,d,sh2->is_slave) -#define WW(a,d) p32x_sh2_write16(a,d,sh2->is_slave) -#define WL(a,d) p32x_sh2_write32(a,d,sh2->is_slave) +#define RB(a) p32x_sh2_read8(a,sh2) +#define RW(a) p32x_sh2_read16(a,sh2) +#define RL(a) p32x_sh2_read32(a,sh2) +#define WB(a,d) p32x_sh2_write8(a,d,sh2) +#define WW(a,d) p32x_sh2_write16(a,d,sh2) +#define WL(a,d) p32x_sh2_write32(a,d,sh2) // some stuff from sh2comn.h #define T 0x00000001 @@ -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 */ @@ -125,15 +129,6 @@ void __attribute__((regparm(2))) sh2_do_op(SH2 *sh2_, int opcode) case 14<<12: op1110(opcode); break; default: op1111(opcode); break; } - - if (sh2->test_irq) - { - 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; - } } #endif