]> Shamusworld >> Repos - virtualjaguar/commitdiff
Fixed 68K STOP instruction never resuming.
authorShamus Hammons <jlhamm@acm.org>
Sat, 7 Dec 2013 17:00:37 +0000 (11:00 -0600)
committerShamus Hammons <jlhamm@acm.org>
Sat, 7 Dec 2013 17:00:37 +0000 (11:00 -0600)
src/jaguar.cpp
src/m68000/m68kinterface.c
src/m68000/m68kinterface.h

index cfbf3ef134ae8861070b4fc0f88895407108b331..c717431a88b546cf332acc4863a87c3c4b0e5843 100644 (file)
@@ -1026,7 +1026,7 @@ unsigned int m68k_read_memory_8(unsigned int address)
 #ifdef ALPINE_FUNCTIONS
        // Check if breakpoint on memory is active, and deal with it
        if (bpmActive && address == bpmAddress1)
-               M68KSetHalt();
+               M68KDebugHalt();
 #endif
 
        // Musashi does this automagically for you, UAE core does not :-P
@@ -1085,7 +1085,7 @@ unsigned int m68k_read_memory_16(unsigned int address)
 #ifdef ALPINE_FUNCTIONS
        // Check if breakpoint on memory is active, and deal with it
        if (bpmActive && address == bpmAddress1)
-               M68KSetHalt();
+               M68KDebugHalt();
 #endif
 
        // Musashi does this automagically for you, UAE core does not :-P
@@ -1193,7 +1193,7 @@ unsigned int m68k_read_memory_32(unsigned int address)
 #ifdef ALPINE_FUNCTIONS
        // Check if breakpoint on memory is active, and deal with it
        if (bpmActive && address == bpmAddress1)
-               M68KSetHalt();
+               M68KDebugHalt();
 #endif
 
        // Musashi does this automagically for you, UAE core does not :-P
@@ -1216,7 +1216,7 @@ void m68k_write_memory_8(unsigned int address, unsigned int value)
 #ifdef ALPINE_FUNCTIONS
        // Check if breakpoint on memory is active, and deal with it
        if (bpmActive && address == bpmAddress1)
-               M68KSetHalt();
+               M68KDebugHalt();
 #endif
 
        // Musashi does this automagically for you, UAE core does not :-P
@@ -1273,7 +1273,7 @@ void m68k_write_memory_16(unsigned int address, unsigned int value)
 #ifdef ALPINE_FUNCTIONS
        // Check if breakpoint on memory is active, and deal with it
        if (bpmActive && address == bpmAddress1)
-               M68KSetHalt();
+               M68KDebugHalt();
 #endif
 
        // Musashi does this automagically for you, UAE core does not :-P
@@ -1368,7 +1368,7 @@ void m68k_write_memory_32(unsigned int address, unsigned int value)
 #ifdef ALPINE_FUNCTIONS
        // Check if breakpoint on memory is active, and deal with it
        if (bpmActive && address == bpmAddress1)
-               M68KSetHalt();
+               M68KDebugHalt();
 #endif
 
        // Musashi does this automagically for you, UAE core does not :-P
index 13015d0558bf72d70d449c70d1a702c9b1f73ce1..8dab55d7690610964ab1e6efaeaa5ab04b2548fc 100644 (file)
@@ -127,15 +127,15 @@ void DumpRegisters(void)
 #endif
 
 
-void M68KSetHalt(void)
+void M68KDebugHalt(void)
 {
-       regs.stopped = 1;
+       regs.spcflags |= SPCFLAG_DEBUGGER;
 }
 
 
-void M68KClearHalt(void)
+void M68KDebugResume(void)
 {
-       regs.stopped = 0;
+       regs.spcflags &= ~SPCFLAG_DEBUGGER;
 }
 
 
@@ -199,6 +199,7 @@ void m68k_pulse_reset(void)
        REG_PC = m68ki_read_imm_32();
        m68ki_jump(REG_PC);
 #else
+       regs.spcflags = 0;
        regs.stopped = 0;
        regs.remainingCycles = 0;
        
@@ -245,6 +246,17 @@ int m68k_execute(int num_cycles)
        /* Main loop.  Keep going until we run out of clock cycles */
        do
        {
+               // This is so our debugging code can break in on a dime.
+               // Otherwise, this is just extra slow down :-P
+               if (regs.spcflags & SPCFLAG_DEBUGGER)
+               {
+                       // Not sure this is correct... :-P
+                       num_cycles = initialCycles - regs.remainingCycles;
+                       regs.remainingCycles = 0;       // int32_t
+                       regs.interruptCycles = 0;       // uint32_t
+
+                       return num_cycles;
+               }
 #if 0
                /* Set tracing accodring to T1. (T0 is done inside instruction) */
                m68ki_trace_t1(); /* auto-disable (see m68kcpu.h) */
@@ -339,16 +351,6 @@ 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);
 
@@ -487,9 +489,8 @@ void m68ki_exception_interrupt(uint32_t intLevel)
        CPU_INT_LEVEL = 0;
 #endif /* M68K_EMULATE_INT_ACK */
 #else
-       // Turn off the stopped state
-// Needed?
-//     regs.stopped = 0;
+       // Turn off the stopped state (N.B.: normal 68K behavior!)
+       regs.stopped = 0;
 
 //JLH: need to add halt state?
 // prolly, for debugging/alpine mode... :-/
index a3c6e3c73262abd691379a1055b5a6d93b917095..84c87af9f3d290d379b1877d47e297a7b66b7338 100644 (file)
@@ -98,8 +98,8 @@ void M68KInstructionHook(void);
 #endif
 
 // Functions to allow debugging
-void M68KSetHalt(void);
-void M68KClearHalt(void);
+void M68KDebugHalt(void);
+void M68KDebugResume(void);
 
 /* Peek at the internals of a CPU context.  This can either be a context
  * retrieved using m68k_get_context() or the currently running context.