#include "v6809.h"
-//#define __DEBUG__
+#define __DEBUG__
#ifdef __DEBUG__
#include "dis6809.h" // Temporary...
#include "log.h" // Temporary...
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
#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;
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, ®s, sizeof(V6809REGS));
+
+#ifdef __DEBUG__
+ if (disasm)
+ WriteLog("\n*** CONTEXT SWITCH ***\n\n");
+#endif
}
//
}
// 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;
}