detect and fix incorect format args
[cyclone68000.git] / Main.cpp
index 9ef8a2b..b6f49c3 100644 (file)
--- a/Main.cpp
+++ b/Main.cpp
@@ -169,13 +169,14 @@ static void AddressErrorWrapper(char rw, const char *dataprg, int iw)
 }\r
 #endif\r
 \r
-void FlushPC(void)\r
+void FlushPC(int force)\r
 {\r
 #if MEMHANDLERS_NEED_PC\r
-  if (pc_dirty)\r
-    ot("  str r4,[r7,#0x40] ;@ Save PC\n");\r
-#endif\r
+  force |= pc_dirty;\r
   pc_dirty = 0;\r
+#endif\r
+  if (force)\r
+    ot("  str r4,[r7,#0x40] ;@ Save PC\n");\r
 }\r
 \r
 static void PrintFramework()\r
@@ -306,7 +307,12 @@ static void PrintFramework()
   ot("  bx lr\n");\r
   ltorg();\r
 #else\r
-  ot(";@ do nothing\n");\r
+  ot(";@ fix final jumptable entries\n");\r
+  ot("  ldr r12,=CycloneJumpTab\n");\r
+  ot("  add r12,r12,#0x10000*4\n");\r
+  ot("  ldr r0,[r12,#-3*4]\n");\r
+  ot("  str r0,[r12,#-2*4]\n");\r
+  ot("  str r0,[r12,#-1*4]\n");\r
   ot("  bx lr\n");\r
 #endif\r
   ot("\n");\r