X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fm68000%2Fm68kinterface.c;h=8dab55d7690610964ab1e6efaeaa5ab04b2548fc;hb=0d7e70c5e34e691b15365901951700f43242065f;hp=528d7e7ae1f66a54c7c6da34d1cb44e1b5487df7;hpb=f7b2692b338aaf37470be0a1d0e5ae42c82e0c65;p=virtualjaguar diff --git a/src/m68000/m68kinterface.c b/src/m68000/m68kinterface.c index 528d7e7..8dab55d 100644 --- a/src/m68000/m68kinterface.c +++ b/src/m68000/m68kinterface.c @@ -127,6 +127,18 @@ void DumpRegisters(void) #endif +void M68KDebugHalt(void) +{ + regs.spcflags |= SPCFLAG_DEBUGGER; +} + + +void M68KDebugResume(void) +{ + regs.spcflags &= ~SPCFLAG_DEBUGGER; +} + + void m68k_set_cpu_type(unsigned int type) { } @@ -187,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; @@ -203,17 +216,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 +223,6 @@ int m68k_execute(int num_cycles) return num_cycles; } -#endif #if 0 /* Set our pool of clock cycles available */ @@ -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) */ @@ -364,6 +376,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; @@ -470,12 +489,14 @@ void m68ki_exception_interrupt(uint32_t intLevel) CPU_INT_LEVEL = 0; #endif /* M68K_EMULATE_INT_ACK */ #else - // Turn off the stopped state + // Turn off the stopped state (N.B.: normal 68K behavior!) 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!)