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/konami | |
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/konami')
-rw-r--r-- | src/emu/cpu/konami/konami.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/emu/cpu/konami/konami.c b/src/emu/cpu/konami/konami.c index a9107848c7d..0cfc44946cc 100644 --- a/src/emu/cpu/konami/konami.c +++ b/src/emu/cpu/konami/konami.c @@ -55,7 +55,8 @@ typedef struct UINT8 ireg; /* first opcode */ UINT8 irq_state[2]; int extra_cycles; /* cycles used up by interrupts */ - int (*irq_callback)(int irqline); + cpu_irq_callback irq_callback; + const device_config *device; UINT8 int_state; /* SYNC and CWAI flags */ UINT8 nmi_state; void (*setlines_callback)( int lines ); /* callback called when A16-A23 are set */ @@ -131,7 +132,7 @@ static PAIR ea; /* effective address */ CC |= CC_IF | CC_II; /* inhibit FIRQ and IRQ */ \ PCD = RM16(0xfff6); \ change_pc(PC); /* TS 971002 */ \ - (void)(*konami.irq_callback)(KONAMI_FIRQ_LINE); \ + (void)(*konami.irq_callback)(konami.device, KONAMI_FIRQ_LINE); \ } \ else \ if( konami.irq_state[KONAMI_IRQ_LINE]!=CLEAR_LINE && !(CC & CC_II) )\ @@ -159,7 +160,7 @@ static PAIR ea; /* effective address */ CC |= CC_II; /* inhibit IRQ */ \ PCD = RM16(0xfff8); \ change_pc(PC); /* TS 971002 */ \ - (void)(*konami.irq_callback)(KONAMI_IRQ_LINE); \ + (void)(*konami.irq_callback)(konami.device, KONAMI_IRQ_LINE); \ } /* public globals */ @@ -388,9 +389,10 @@ static void konami_set_context(void *src) /****************************************************************************/ /* Reset registers to their initial values */ /****************************************************************************/ -static void konami_init(int index, int clock, const void *config, int (*irqcallback)(int)) +static CPU_INIT( konami ) { konami.irq_callback = irqcallback; + konami.device = device; state_save_register_item("KONAMI", index, PC); state_save_register_item("KONAMI", index, U); @@ -406,7 +408,7 @@ static void konami_init(int index, int clock, const void *config, int (*irqcallb state_save_register_item("KONAMI", index, konami.irq_state[1]); } -static void konami_reset(void) +static CPU_RESET( konami ) { konami.int_state = 0; konami.nmi_state = CLEAR_LINE; @@ -422,7 +424,7 @@ static void konami_reset(void) change_pc(PC); /* TS 971002 */ } -static void konami_exit(void) +static CPU_EXIT( konami ) { } @@ -482,7 +484,7 @@ static void set_irq_line(int irqline, int state) #include "konamops.c" /* execute instructions on this CPU until icount expires */ -static int konami_execute(int cycles) +static CPU_EXECUTE( konami ) { konami_ICount = cycles - konami.extra_cycles; konami.extra_cycles = 0; @@ -600,10 +602,10 @@ void konami_get_info(UINT32 state, cpuinfo *info) case CPUINFO_PTR_SET_INFO: info->setinfo = konami_set_info; break; case CPUINFO_PTR_GET_CONTEXT: info->getcontext = konami_get_context; break; case CPUINFO_PTR_SET_CONTEXT: info->setcontext = konami_set_context; break; - case CPUINFO_PTR_INIT: info->init = konami_init; break; - case CPUINFO_PTR_RESET: info->reset = konami_reset; break; - case CPUINFO_PTR_EXIT: info->exit = konami_exit; break; - case CPUINFO_PTR_EXECUTE: info->execute = konami_execute; break; + case CPUINFO_PTR_INIT: info->init = CPU_INIT_NAME(konami); break; + case CPUINFO_PTR_RESET: info->reset = CPU_RESET_NAME(konami); break; + case CPUINFO_PTR_EXIT: info->exit = CPU_EXIT_NAME(konami); break; + case CPUINFO_PTR_EXECUTE: info->execute = CPU_EXECUTE_NAME(konami); break; case CPUINFO_PTR_BURN: info->burn = NULL; break; case CPUINFO_PTR_DISASSEMBLE: info->disassemble = konami_dasm; break; case CPUINFO_PTR_INSTRUCTION_COUNTER: info->icount = &konami_ICount; break; |