optimizations, bugfixes, uae works (but with timing glitches?)
[picodrive.git] / cpu / Cyclone / OpBranch.cpp
index d1c2391..320b898 100644 (file)
@@ -4,7 +4,7 @@
 static void CheckPc(int reg)\r
 {\r
 #if USE_CHECKPC_CALLBACK\r
-  ot(";@ Check Memory Base+pc (r4)\n");\r
+  ot(";@ Check Memory Base+pc (r%i)\n",reg);\r
   if (reg != 0)\r
     ot("  mov r0,r%i\n", reg);\r
   ot("  mov lr,pc\n");\r
@@ -173,14 +173,12 @@ int Op4E70(int op)
     return 0;\r
 \r
     case 3: // rte\r
-    OpStart(op,0x10); Cycles=20;\r
-    SuperCheck(op);\r
+    OpStart(op,0x10,0,0,1); Cycles=20;\r
     PopSr(1);\r
     ot("  ldr r10,[r7,#0x60] ;@ Get Memory base\n");\r
     PopPc();\r
     SuperChange(op);\r
-    CheckInterrupt(op);\r
-    OpEnd(0x10);\r
+    OpEnd(0x10,0,0,1);\r
     return 0;\r
 \r
     case 5: // rts\r
@@ -191,12 +189,12 @@ int Op4E70(int op)
     return 0;\r
 \r
     case 6: // trapv\r
-    OpStart(op,0x10); Cycles=4;\r
+    OpStart(op,0x10,0,1); Cycles=4;\r
     ot("  tst r9,#0x10000000\n");\r
     ot("  subne r5,r5,#%i\n",34);\r
     ot("  movne r0,#0x1c ;@ TRAPV exception\n");\r
     ot("  blne Exception\n");\r
-    OpEnd(0x10);\r
+    OpEnd(0x10,0,1);\r
     return 0;\r
 \r
     case 7: // rtr\r
@@ -233,27 +231,19 @@ int OpJsr(int op)
   ot("\n");\r
   EaCalc(11,0x003f,sea,0);\r
 \r
-  ot(";@ Jump - Get new PC from r0\n");\r
-  if (op&0x40)\r
-  {\r
-    // Jmp - Get new PC from r11\r
-    ot("  add r0,r11,r10 ;@ Memory Base + New PC\n");\r
-    ot("\n");\r
-  }\r
-  else\r
+  if (!(op&0x40))\r
   {\r
     ot(";@ Jsr - Push old PC first\n");\r
     ot("  ldr r0,[r7,#0x3c]\n");\r
     ot("  sub r1,r4,r10 ;@ r1 = Old PC\n");\r
-//    ot("  mov r1,r1,lsl #8\n");\r
-//    ot("  mov r1,r1,asr #8\n");\r
     ot(";@ Push r1 onto stack\n");\r
     ot("  sub r0,r0,#4 ;@ Predecrement A7\n");\r
     ot("  str r0,[r7,#0x3c] ;@ Save A7\n");\r
     MemHandler(1,2);\r
-    ot("  add r0,r11,r10 ;@ Memory Base + New PC\n");\r
-    ot("\n");\r
   }\r
+  ot(";@ Jump - Get new PC from r11\n");\r
+  ot("  add r0,r11,r10 ;@ Memory Base + New PC\n");\r
+  ot("\n");\r
 \r
   CheckPc(0);\r
 \r
@@ -441,8 +431,6 @@ int OpBranch(int op)
     ot("  ldr r2,[r7,#0x3c]\n");\r
     ot("  sub r1,r4,r10 ;@ r1 = Old PC\n");\r
     if (size) ot("  add r1,r1,#%d\n",1<<size);\r
-//    ot("  mov r1,r1, lsl #8\n");\r
-//    ot("  mov r1,r1, asr #8\n");\r
     ot("\n");\r
     ot(";@ Push r1 onto stack\n");\r
     ot("  sub r0,r2,#4 ;@ Predecrement A7\n");\r