diff options
author | 2008-11-06 18:42:37 +0000 | |
---|---|---|
committer | 2008-11-06 18:42:37 +0000 | |
commit | b44da3b748d0ef6fa95e1c39f556e5e3cff5169b (patch) | |
tree | 2a7acc4cfab418620bfc99ec6f460f32475bb934 /src/emu/cpu/sh4 | |
parent | 1228d0ad9ea3fa2fb7a3b88357ba286247fc8826 (diff) |
WARNING: This is a significant change. If you are risk-averse and
working on something, hold off syncing.
Defined macros for core CPU functions: CPU_INIT, CPU_RESET, CPU_EXIT,
CPU_EXECUTE, along with macros for the name and for calling, in the
spirit of the devintrf.h macros. More will come later.
Changed init, reset, exit, and execute interfaces to be passed a
const device_config * object. This is a fake object for the moment,
but encapsulates the machine pointer and token. Eventually this will
be a real device.
Changed the CPU IRQ callbacks to a proper type, and added a device
parameter to them.
Updated all CPU cores to the new macros and parameters.
Note that this changes the way we "pointer"-ify cores. I'll send an
update shortly.
Diffstat (limited to 'src/emu/cpu/sh4')
-rw-r--r-- | src/emu/cpu/sh4/sh4.c | 18 | ||||
-rw-r--r-- | src/emu/cpu/sh4/sh4comn.c | 6 | ||||
-rw-r--r-- | src/emu/cpu/sh4/sh4comn.h | 3 |
3 files changed, 16 insertions, 11 deletions
diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index cda9e8b2a86..fd9c4afa106 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -3237,7 +3237,7 @@ INLINE void op1111(UINT16 opcode) * MAME CPU INTERFACE *****************************************************************************/ -static void sh4_reset(void) +static CPU_RESET( sh4 ) { void *tsaved[4]; emu_timer *tsave[5]; @@ -3247,7 +3247,8 @@ static void sh4_reset(void) int savecpu_clock, savebus_clock, savepm_clock; void (*f)(UINT32 data); - int (*save_irqcallback)(int); + cpu_irq_callback save_irqcallback; + const device_config *save_device; cpunum = sh4.cpu_number; m = sh4.m; @@ -3263,6 +3264,7 @@ static void sh4_reset(void) f = sh4.ftcsr_read_callback; save_irqcallback = sh4.irq_callback; + save_device = sh4.device; save_is_slave = sh4.is_slave; savecpu_clock = sh4.cpu_clock; savebus_clock = sh4.bus_clock; @@ -3274,6 +3276,7 @@ static void sh4_reset(void) sh4.pm_clock = savepm_clock; sh4.ftcsr_read_callback = f; sh4.irq_callback = save_irqcallback; + sh4.device = save_device; sh4.dma_timer[0] = tsaved[0]; sh4.dma_timer[1] = tsaved[1]; @@ -3314,7 +3317,7 @@ static void sh4_reset(void) } /* Execute cycles - returns number of cycles actually run */ -static int sh4_execute(int cycles) +static CPU_EXECUTE( sh4 ) { sh4.sh4_icount = cycles; @@ -3389,7 +3392,7 @@ static offs_t sh4_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 return DasmSH4( buffer, pc, (oprom[1] << 8) | oprom[0] ); } -static void sh4_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static CPU_INIT( sh4 ) { const struct sh4_config *conf = config; @@ -3399,6 +3402,7 @@ static void sh4_init(int index, int clock, const void *config, int (*irqcallback sh4.cpu_number = index; sh4.irq_callback = irqcallback; + sh4.device = device; sh4_default_exception_priorities(); sh4.irln = 15; sh4.test_irq = 0; @@ -3704,9 +3708,9 @@ void sh4_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_SET_INFO: info->setinfo = sh4_set_info; break; case CPUINFO_PTR_GET_CONTEXT: info->getcontext = sh4_get_context; break; case CPUINFO_PTR_SET_CONTEXT: info->setcontext = sh4_set_context; break; - case CPUINFO_PTR_INIT: info->init = sh4_init; break; - case CPUINFO_PTR_RESET: info->reset = sh4_reset; break; - case CPUINFO_PTR_EXECUTE: info->execute = sh4_execute; break; + case CPUINFO_PTR_INIT: info->init = CPU_INIT_NAME(sh4); break; + case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(sh4); break; + case CPUINFO_PTR_EXECUTE: info->execute = CPU_EXECUTE_NAME(sh4); break; case CPUINFO_PTR_BURN: info->burn = NULL; break; case CPUINFO_PTR_DISASSEMBLE: info->disassemble = sh4_dasm; break; case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &sh4.sh4_icount; break; diff --git a/src/emu/cpu/sh4/sh4comn.c b/src/emu/cpu/sh4/sh4comn.c index 1fca0152af0..6d03bbdd5f2 100644 --- a/src/emu/cpu/sh4/sh4comn.c +++ b/src/emu/cpu/sh4/sh4comn.c @@ -171,7 +171,7 @@ void sh4_exception(const char *message, int exception) // handle exception sh4.m[ICR] &= ~0x200; sh4.m[INTEVT] = 0x1c0; vector = 0x600; - sh4.irq_callback(INPUT_LINE_NMI); + sh4.irq_callback(sh4.device, INPUT_LINE_NMI); LOG(("SH-4 #%d nmi exception after [%s]\n", cpu_getactivecpu(), message)); } else { // if ((sh4.m[ICR] & 0x4000) && (sh4.nmi_line_state == ASSERT_LINE)) @@ -183,9 +183,9 @@ void sh4_exception(const char *message, int exception) // handle exception sh4.m[INTEVT] = exception_codes[exception]; vector = 0x600; if ((exception >= SH4_INTC_IRL0) && (exception <= SH4_INTC_IRL3)) - sh4.irq_callback(SH4_INTC_IRL0-exception+SH4_IRL0); + sh4.irq_callback(sh4.device, SH4_INTC_IRL0-exception+SH4_IRL0); else - sh4.irq_callback(SH4_IRL3+1); + sh4.irq_callback(sh4.device, SH4_IRL3+1); LOG(("SH-4 #%d interrupt exception #%d after [%s]\n", cpu_getactivecpu(), exception, message)); } sh4_exception_checkunrequest(exception); diff --git a/src/emu/cpu/sh4/sh4comn.h b/src/emu/cpu/sh4/sh4comn.h index 80950c894d6..b486907d1f3 100644 --- a/src/emu/cpu/sh4/sh4comn.h +++ b/src/emu/cpu/sh4/sh4comn.h @@ -60,7 +60,8 @@ typedef struct int exception_requesting[128]; INT8 irq_line_state[17]; - int (*irq_callback)(int irqline); + cpu_irq_callback irq_callback; + const device_config *device; UINT32 *m; INT8 nmi_line_state; |