sh2 interpreter, minor improvement for irq handling
authorkub <derkub@gmail.com>
Wed, 19 May 2021 17:18:36 +0000 (19:18 +0200)
committerkub <derkub@gmail.com>
Wed, 19 May 2021 17:18:36 +0000 (19:18 +0200)
cpu/sh2/mame/sh2pico.c

index b8a1a36..f4ae85c 100644 (file)
@@ -167,14 +167,16 @@ int sh2_execute_interpreter(SH2 *sh2, int cycles)
 
                sh2->icount--;
 
-               if (sh2->test_irq && !sh2->delay && sh2->pending_level > ((sh2->sr >> 4) & 0x0f))
+               if (sh2->test_irq && !sh2->delay)
                {
                        int level = sh2->pending_level;
-                       int vector = sh2->irq_callback(sh2, level);
-                       sh2_do_irq(sh2, level, vector);
+                       if (level > ((sh2->sr >> 4) & 0x0f))
+                       {
+                               int vector = sh2->irq_callback(sh2, level);
+                               sh2_do_irq(sh2, level, vector);
+                       }
                        sh2->test_irq = 0;
                }
-
        }
        while (sh2->icount > 0 || sh2->delay);  /* can't interrupt before delay */