]> Shamusworld >> Repos - thunder/blobdiff - src/v6809.cpp
Added old email from Lee Saito to notes, various attempts at fixes
[thunder] / src / v6809.cpp
index 9c2160f48170d046f6961f2f3c8e5f3ffa1f2e61..c8e081a7a72ff419acbb7aa328fef2a09370756e 100755 (executable)
@@ -19,7 +19,7 @@
 
 #include "v6809.h"
 
-//#define __DEBUG__
+#define __DEBUG__
 #ifdef __DEBUG__
 #include "dis6809.h"   // Temporary...
 #include "log.h"               // Temporary...
@@ -3058,6 +3058,11 @@ uint8 backTrace[256];
 V6809REGS btRegs[256];
 bool tripped = false;
 #endif
+#ifdef __DEBUG__
+//Here so this can be externally linked
+bool disasm = false;
+//bool disasm = true;
+#endif
 void Execute6809(V6809REGS * context, uint32 cycles)
 {
        // If this is not in place, the clockOverrun calculations can cause the V6809 to get
@@ -3105,8 +3110,6 @@ if (!tripped)
 #endif
 #ifdef __DEBUG__
 //Decode6809(regs.pc);
-//static bool disasm = false;
-static bool disasm = true;
 if (disasm) Decode6809(regs);
 /*//if (regs.pc == 0x15BA)     disasm = true;
 //if (regs.pc == 0xFE76)       disasm = true;
@@ -3215,22 +3218,29 @@ if (disasm) WriteLog("       IRQ taken...\n");
                                regs.clock += 19;
 // Apparently, not done here!
 // Need to put IRQ handling in somewhere... It shouldn't be cleared here!
-                               context->cpuFlags &= ~V6809_ASSERT_LINE_IRQ;    // Reset the asserted line (IRQ)...
-                               regs.cpuFlags &= ~V6809_ASSERT_LINE_IRQ;        // Reset the asserted line (IRQ)...
+//                             context->cpuFlags &= ~V6809_ASSERT_LINE_IRQ;    // Reset the asserted line (IRQ)...
+//                             regs.cpuFlags &= ~V6809_ASSERT_LINE_IRQ;        // Reset the asserted line (IRQ)...
                        }
                }
 #ifdef __DEBUG__
-if (disasm) WriteLog("\tA=%02X B=%02X CC=%02X DP=%02X X=%04X Y=%04X S=%04X U=%04X PC=%04X\n",
-       regs.a, regs.b, regs.cc, regs.dp, regs.x, regs.y, regs.s, regs.u, regs.pc);//*/
+if (disasm) WriteLog("\tCC=%s%s%s%s%s%s%s%s A=%02X B=%02X DP=%02X X=%04X Y=%04X S=%04X U=%04X PC=%04X\n",
+       (regs.cc & FLAG_E ? "E" : "-"), (regs.cc & FLAG_F ? "F" : "-"), (regs.cc & FLAG_H ? "H" : "-"),
+       (regs.cc & FLAG_I ? "I" : "-"), (regs.cc & FLAG_N ? "N" : "-"), (regs.cc & FLAG_Z ? "Z" : "-"),
+       (regs.cc & FLAG_V ? "V" : "-"), (regs.cc & FLAG_C ? "C" : "-"),
+       regs.a, regs.b, regs.dp, regs.x, regs.y, regs.s, regs.u, regs.pc);//*/
 /*WriteLog("\tA=%02X B=%02X CC=%02X DP=%02X X=%04X Y=%04X S=%04X U=%04X PC=%04X\n",
        regs.a, regs.b, regs.cc, regs.dp, regs.x, regs.y, regs.s, regs.u, regs.pc);//*/
 #endif
        }
-
        // Keep track of how much we overran so we can adjust on the next run...
        regs.clockOverrun = (uint32)(regs.clock - endCycles);
 
        myMemcpy(context, &regs, sizeof(V6809REGS));
+
+#ifdef __DEBUG__
+       if (disasm)
+               WriteLog("\n*** CONTEXT SWITCH ***\n\n");
+#endif
 }
 
 //
@@ -3250,13 +3260,13 @@ uint16 GetCurrentV6809PC(void)
 }
 
 // Set a line of the currently executing CPU
-void SetLine(uint32 line)
+void SetLineOfCurrentV6809(uint32 line)
 {
        regs.cpuFlags |= line;
 }
 
 // Clear a line of the currently executing CPU
-void ClearLine(uint32 line)
+void ClearLineOfCurrentV6809(uint32 line)
 {
        regs.cpuFlags &= ~line;
 }