Changed 68000 interrupts to only trigger during execution. This

means that multiple changes without any execution will be seen as
atomic. It also means that PULSE_LINE no longer works for signalling
IRQs.

Added checks in the debug build to catch people who try to use
PULSE_LINE for non-NMI and non-RESET input lines on CPUs that no
longer support direct interrupt generation. Over time expect this
list to increase.
This commit is contained in:
Aaron Giles 2008-10-01 17:09:11 +00:00
parent 34cd80a8e5
commit ce465cb509
3 changed files with 62 additions and 4 deletions

View File

@ -790,6 +790,8 @@ int m68k_execute(int num_cycles)
SET_CYCLES(num_cycles); SET_CYCLES(num_cycles);
m68ki_initial_cycles = num_cycles; m68ki_initial_cycles = num_cycles;
m68ki_check_interrupts();
/* ASG: update cycles */ /* ASG: update cycles */
USE_CYCLES(CPU_INT_CYCLES); USE_CYCLES(CPU_INT_CYCLES);
CPU_INT_CYCLES = 0; CPU_INT_CYCLES = 0;
@ -877,9 +879,7 @@ void m68k_set_irq(unsigned int int_level)
/* A transition from < 7 to 7 always interrupts (NMI) */ /* A transition from < 7 to 7 always interrupts (NMI) */
/* Note: Level 7 can also level trigger like a normal IRQ */ /* Note: Level 7 can also level trigger like a normal IRQ */
if(old_level != 0x0700 && CPU_INT_LEVEL == 0x0700) if(old_level != 0x0700 && CPU_INT_LEVEL == 0x0700)
m68ki_exception_interrupt(7); /* Edge triggered level 7 (NMI) */ m68ki_cpu.nmi_pending = TRUE;
else
m68ki_check_interrupts(); /* Level triggered (IRQ) */
} }
void m68k_set_virq(unsigned int level, unsigned int active) void m68k_set_virq(unsigned int level, unsigned int active)

View File

@ -899,6 +899,7 @@ struct _m68ki_cpu_core
/* Virtual IRQ lines state */ /* Virtual IRQ lines state */
uint virq_state; uint virq_state;
uint nmi_pending;
const uint8* cyc_instruction; const uint8* cyc_instruction;
const uint8* cyc_exception; const uint8* cyc_exception;
@ -2038,7 +2039,12 @@ void m68ki_exception_interrupt(uint int_level)
/* ASG: Check for interrupts */ /* ASG: Check for interrupts */
INLINE void m68ki_check_interrupts(void) INLINE void m68ki_check_interrupts(void)
{ {
if(CPU_INT_LEVEL > FLAG_INT_MASK) if(m68ki_cpu.nmi_pending)
{
m68ki_cpu.nmi_pending = FALSE;
m68ki_exception_interrupt(7);
}
else if(CPU_INT_LEVEL > FLAG_INT_MASK)
m68ki_exception_interrupt(CPU_INT_LEVEL>>8); m68ki_exception_interrupt(CPU_INT_LEVEL>>8);
} }

View File

@ -283,6 +283,58 @@ void cpunum_set_input_line_vector(int cpunum, int line, int vector)
void cpunum_set_input_line_and_vector(running_machine *machine, int cpunum, int line, int state, int vector) void cpunum_set_input_line_and_vector(running_machine *machine, int cpunum, int line, int state, int vector)
{ {
#ifdef MAME_DEBUG
/* catch errors where people use PULSE_LINE for CPUs that don't support it */
if (state == PULSE_LINE && line != INPUT_LINE_NMI && line != INPUT_LINE_RESET)
{
switch (machine->config->cpu[cpunum].type)
{
case CPU_Z80:
case CPU_Z180:
case CPU_M68000:
case CPU_M68008:
case CPU_M68010:
case CPU_M68EC020:
case CPU_M68020:
case CPU_M68040:
case CPU_R4600BE:
case CPU_R4600LE:
case CPU_R4650BE:
case CPU_R4650LE:
case CPU_R4700BE:
case CPU_R4700LE:
case CPU_R5000BE:
case CPU_R5000LE:
case CPU_QED5271BE:
case CPU_QED5271LE:
case CPU_RM7000BE:
case CPU_RM7000LE:
case CPU_PPC403GA:
case CPU_PPC403GCX:
case CPU_PPC601:
case CPU_PPC602:
case CPU_PPC603:
case CPU_PPC603E:
case CPU_PPC603R:
case CPU_PPC604:
case CPU_I8035:
case CPU_I8041:
case CPU_I8048:
case CPU_I8648:
case CPU_I8748:
case CPU_MB8884:
case CPU_N7751:
case CPU_TMS34010:
case CPU_TMS34020:
case CPU_TMS32010:
case CPU_TMS32025:
case CPU_TMS32026:
fatalerror("CPU %s: PULSE_LINE used with level-detected IRQ %d\n", machine->config->cpu[cpunum].tag, line);
break;
}
}
#endif
if (line >= 0 && line < MAX_INPUT_LINES) if (line >= 0 && line < MAX_INPUT_LINES)
{ {
INT32 input_event = (state & 0xff) | (vector << 8); INT32 input_event = (state & 0xff) | (vector << 8);