drc: lots of new debug code
[picodrive.git] / cpu / sh2 / mame / sh2.c
index 158d42c..44cd7ea 100644 (file)
@@ -349,11 +349,13 @@ INLINE void BF(sh2_state *sh2, UINT32 d)
  */\r
 INLINE void BFS(sh2_state *sh2, UINT32 d)\r
 {\r
+       sh2->delay = sh2->pc;\r
+       sh2->pc += 2;\r
+\r
        if ((sh2->sr & T) == 0)\r
        {\r
                INT32 disp = ((INT32)d << 24) >> 24;\r
-               sh2->delay = sh2->pc;\r
-               sh2->pc = sh2->ea = sh2->pc + disp * 2 + 2;\r
+               sh2->pc = sh2->ea = sh2->pc + disp * 2;\r
                sh2->icount--;\r
        }\r
 }\r
@@ -439,11 +441,13 @@ INLINE void BT(sh2_state *sh2, UINT32 d)
  */\r
 INLINE void BTS(sh2_state *sh2, UINT32 d)\r
 {\r
+       sh2->delay = sh2->pc;\r
+       sh2->pc += 2;\r
+\r
        if ((sh2->sr & T) != 0)\r
        {\r
                INT32 disp = ((INT32)d << 24) >> 24;\r
-               sh2->delay = sh2->pc;\r
-               sh2->pc = sh2->ea = sh2->pc + disp * 2 + 2;\r
+               sh2->pc = sh2->ea = sh2->pc + disp * 2;\r
                sh2->icount--;\r
        }\r
 }\r
@@ -859,6 +863,7 @@ INLINE void JMP(sh2_state *sh2, UINT32 m)
 {\r
        sh2->delay = sh2->pc;\r
        sh2->pc = sh2->ea = sh2->r[m];\r
+       sh2->icount--;\r
 }\r
 \r
 /*  JSR     @Rm */\r
@@ -1422,7 +1427,6 @@ INLINE void OR(sh2_state *sh2, UINT32 m, UINT32 n)
 INLINE void ORI(sh2_state *sh2, UINT32 i)\r
 {\r
        sh2->r[0] |= i;\r
-       sh2->icount -= 2;\r
 }\r
 \r
 /*  OR.B    #imm,@(R0,GBR) */\r
@@ -1434,6 +1438,7 @@ INLINE void ORM(sh2_state *sh2, UINT32 i)
        temp = RB( sh2, sh2->ea );\r
        temp |= i;\r
        WB( sh2, sh2->ea, temp );\r
+       sh2->icount -= 2;\r
 }\r
 \r
 /*  ROTCL   Rn */\r