]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/m68000/m68kinterface.c
Added breakpoint on memory access to Alpine mode.
[virtualjaguar] / src / m68000 / m68kinterface.c
index 528d7e7ae1f66a54c7c6da34d1cb44e1b5487df7..13015d0558bf72d70d449c70d1a702c9b1f73ce1 100644 (file)
@@ -127,6 +127,18 @@ void DumpRegisters(void)
 #endif
 
 
+void M68KSetHalt(void)
+{
+       regs.stopped = 1;
+}
+
+
+void M68KClearHalt(void)
+{
+       regs.stopped = 0;
+}
+
+
 void m68k_set_cpu_type(unsigned int type)
 {
 }
@@ -203,17 +215,6 @@ void m68k_pulse_reset(void)
 
 int m68k_execute(int num_cycles)
 {
-#if 0
-       /* Make sure we're not stopped */
-       if (CPU_STOPPED)
-       {
-               /* We get here if the CPU is stopped or halted */
-               SET_CYCLES(0);
-               CPU_INT_CYCLES = 0;
-
-               return num_cycles;
-       }
-#else
        if (regs.stopped)
        {
                regs.remainingCycles = 0;       // int32_t
@@ -221,7 +222,6 @@ int m68k_execute(int num_cycles)
 
                return num_cycles;
        }
-#endif
 
 #if 0
        /* Set our pool of clock cycles available */
@@ -339,6 +339,16 @@ if (inRoutine)
 
 //printf("Executed opcode $%04X (%i cycles)...\n", opcode, cycles);
 #endif
+               // This is so our debugging code can break in on a dime.
+               // Otherwise, this is just extra slow down :-P
+               if (regs.stopped)
+               {
+                       num_cycles = initialCycles - regs.remainingCycles;
+                       regs.remainingCycles = 0;       // int32_t
+                       regs.interruptCycles = 0;       // uint32_t
+
+                       return num_cycles;
+               }
        }
        while (regs.remainingCycles > 0);
 
@@ -364,6 +374,13 @@ if (inRoutine)
 
 void m68k_set_irq(unsigned int intLevel)
 {
+       // We need to check for stopped state as well...
+       if (regs.stopped)
+       {
+               m68k_set_irq2(intLevel);
+               return;
+       }
+
        // Since this can be called asynchronously, we need to fix it so that it
        // doesn't fuck up the main execution loop.
        IRQLevelToHandle = intLevel;
@@ -471,11 +488,14 @@ void m68ki_exception_interrupt(uint32_t intLevel)
 #endif /* M68K_EMULATE_INT_ACK */
 #else
        // Turn off the stopped state
-       regs.stopped = 0;
+// Needed?
+//     regs.stopped = 0;
 
 //JLH: need to add halt state?
+// prolly, for debugging/alpine mode... :-/
+// but then again, this should be handled already by the main execution loop :-P
        // If we are halted, don't do anything
-//     if (CPU_STOPPED)
+//     if (regs.stopped)
 //             return;
 
        // Acknowledge the interrupt (NOTE: This is a user supplied function!)