summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-10-02 05:31:24 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-10-02 05:31:24 +0000
commitcf63e2baa806398d22df4171e0f683c047a64204 (patch)
treefaab28439c1d839a3cada0b50096d467ce5ce7da
parent18c6cfb56a49c47936dd756d8215aeabe869a9c6 (diff)
Fixed handling of interrupts when the CPU was in the STOP state.
-rw-r--r--src/emu/cpu/m68000/m68kcpu.c34
-rw-r--r--src/emu/cpu/m68000/m68kcpu.h5
2 files changed, 12 insertions, 27 deletions
diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c
index 183e2b389cd..190f19a4065 100644
--- a/src/emu/cpu/m68000/m68kcpu.c
+++ b/src/emu/cpu/m68000/m68kcpu.c
@@ -783,19 +783,16 @@ void m68k_set_cpu_type(unsigned int cpu_type)
/* ASG: removed per-instruction interrupt checks */
int m68k_execute(int num_cycles)
{
+ /* Set our pool of clock cycles available */
+ SET_CYCLES(num_cycles);
+ m68ki_initial_cycles = num_cycles;
+
+ /* See if interrupts came in */
+ m68ki_check_interrupts();
+
/* Make sure we're not stopped */
if(!CPU_STOPPED)
{
- /* Set our pool of clock cycles available */
- SET_CYCLES(num_cycles);
- m68ki_initial_cycles = num_cycles;
-
- m68ki_check_interrupts();
-
- /* ASG: update cycles */
- USE_CYCLES(CPU_INT_CYCLES);
- CPU_INT_CYCLES = 0;
-
/* Return point if we had an address error */
m68ki_set_address_error_trap(); /* auto-disable (see m68kcpu.h) */
@@ -825,20 +822,12 @@ int m68k_execute(int num_cycles)
/* set previous PC to current PC for the next entry into the loop */
REG_PPC = REG_PC;
-
- /* ASG: update cycles */
- USE_CYCLES(CPU_INT_CYCLES);
- CPU_INT_CYCLES = 0;
-
- /* return how many clocks we used */
- return m68ki_initial_cycles - GET_CYCLES();
}
+ else
+ SET_CYCLES(0);
- /* We get here if the CPU is stopped or halted */
- SET_CYCLES(0);
- CPU_INT_CYCLES = 0;
-
- return num_cycles;
+ /* return how many clocks we used */
+ return m68ki_initial_cycles - GET_CYCLES();
}
@@ -1034,7 +1023,6 @@ void m68k_state_register(const char *type, int index)
state_save_register_item(type, index, REG_CAAR);
state_save_register_item(type, index, m68k_substate.sr);
state_save_register_item(type, index, CPU_INT_LEVEL);
- state_save_register_item(type, index, CPU_INT_CYCLES);
state_save_register_item(type, index, m68k_substate.stopped);
state_save_register_item(type, index, m68k_substate.halted);
state_save_register_item(type, index, CPU_PREF_ADDR);
diff --git a/src/emu/cpu/m68000/m68kcpu.h b/src/emu/cpu/m68000/m68kcpu.h
index eb70ddf7ac3..0679be6715e 100644
--- a/src/emu/cpu/m68000/m68kcpu.h
+++ b/src/emu/cpu/m68000/m68kcpu.h
@@ -333,7 +333,6 @@
#define FLAG_INT_MASK m68ki_cpu.int_mask
#define CPU_INT_LEVEL m68ki_cpu.int_level /* ASG: changed from CPU_INTS_PENDING */
-#define CPU_INT_CYCLES m68ki_cpu.int_cycles /* ASG */
#define CPU_STOPPED m68ki_cpu.stopped
#define CPU_PREF_ADDR m68ki_cpu.pref_addr
#define CPU_PREF_DATA m68ki_cpu.pref_data
@@ -562,7 +561,6 @@
if(CPU_STOPPED) \
{ \
SET_CYCLES(0); \
- CPU_INT_CYCLES = 0; \
return m68ki_initial_cycles; \
} \
}
@@ -877,7 +875,6 @@ struct _m68ki_cpu_core
uint c_flag; /* Carry */
uint int_mask; /* I0-I2 */
uint int_level; /* State of interrupt pins IPL0-IPL2 -- ASG: changed from ints_pending */
- uint int_cycles; /* ASG: extra cycles from generated interrupts */
uint stopped; /* Stopped state */
uint pref_addr; /* Last prefetch address */
uint pref_data; /* Data in the prefetch queue */
@@ -2027,7 +2024,7 @@ void m68ki_exception_interrupt(uint int_level)
m68ki_jump(new_pc);
/* Defer cycle counting until later */
- CPU_INT_CYCLES += CYC_EXCEPTION[vector];
+ USE_CYCLES(CYC_EXCEPTION[vector]);
#if !M68K_EMULATE_INT_ACK
/* Automatically clear IRQ if we are not using an acknowledge scheme */