diff --git a/src/emu/devcpu.h b/src/emu/devcpu.h index d361127bb40..fd15e54d485 100644 --- a/src/emu/devcpu.h +++ b/src/emu/devcpu.h @@ -189,12 +189,16 @@ enum #define MCFG_CPU_DATA_MAP MCFG_DEVICE_DATA_MAP #define MCFG_CPU_IO_MAP MCFG_DEVICE_IO_MAP +// legacy #define MCFG_CPU_VBLANK_INT MCFG_DEVICE_VBLANK_INT #define MCFG_CPU_PERIODIC_INT MCFG_DEVICE_PERIODIC_INT #define MCFG_CPU_VBLANK_INT_DRIVER MCFG_DEVICE_VBLANK_INT_DRIVER #define MCFG_CPU_PERIODIC_INT_DRIVER MCFG_DEVICE_PERIODIC_INT_DRIVER +#define MCFG_CPU_VBLANK_INT_REMOVE MCFG_DEVICE_VBLANK_INT_REMOVE +#define MCFG_CPU_PERIODIC_INT_REMOVE MCFG_DEVICE_PERIODIC_INT_REMOVE + //************************************************************************** // MACROS diff --git a/src/emu/diexec.c b/src/emu/diexec.c index ed0321d0465..480a0096b2d 100644 --- a/src/emu/diexec.c +++ b/src/emu/diexec.c @@ -151,6 +151,20 @@ void device_execute_interface::static_set_vblank_int(device_t &device, device_in exec->m_vblank_interrupt_screen = tag; } +//------------------------------------------------- +// static_remove_vblank_int - configuration helper +// to remove VBLANK interrupts from the device +//------------------------------------------------- + +void device_execute_interface::static_remove_vblank_int(device_t &device) +{ + device_execute_interface *exec; + if (!device.interface(exec)) + throw emu_fatalerror("MCFG_DEVICE_VBLANK_INT_REMOVE called on device '%s' with no execute interface", device.tag()); + exec->m_vblank_interrupt = device_interrupt_delegate(); + exec->m_vblank_interrupt_legacy = NULL; + exec->m_vblank_interrupt_screen = NULL; +} //------------------------------------------------- // static_set_periodic_int - configuration helper @@ -176,6 +190,21 @@ void device_execute_interface::static_set_periodic_int(device_t &device, device_ exec->m_timed_interrupt_period = rate; } +//------------------------------------------------- +// static_remove_periodic_int - configuration helper +// to remove periodic interrupts from the device +//------------------------------------------------- + +void device_execute_interface::static_remove_periodic_int(device_t &device) +{ + device_execute_interface *exec; + if (!device.interface(exec)) + throw emu_fatalerror("MCFG_DEVICE_PERIODIC_INT_REMOVE called on device '%s' with no execute interface", device.tag()); + exec->m_timed_interrupt = device_interrupt_delegate(); + exec->m_timed_interrupt_legacy = NULL; + exec->m_timed_interrupt_period = attotime(); +} + //------------------------------------------------- // executing - return true if this device is diff --git a/src/emu/diexec.h b/src/emu/diexec.h index ee4d425c80a..5c851f21e7a 100644 --- a/src/emu/diexec.h +++ b/src/emu/diexec.h @@ -116,18 +116,24 @@ enum #define MCFG_DEVICE_DISABLE() \ device_execute_interface::static_set_disable(*device); +// legacy #define MCFG_DEVICE_VBLANK_INT(_tag, _func) \ device_execute_interface::static_set_vblank_int(*device, _func, _tag); #define MCFG_DEVICE_VBLANK_INT_DRIVER(_tag, _class, _func) \ device_execute_interface::static_set_vblank_int(*device, device_interrupt_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)0), _tag); #define MCFG_DEVICE_VBLANK_INT_DEVICE(_tag, _devtag, _class, _func) \ device_execute_interface::static_set_vblank_int(*device, device_interrupt_delegate(&_class::_func, #_class "::" #_func, _devtag, (_class *)0), _tag); +#define MCFG_DEVICE_VBLANK_INT_REMOVE() \ + device_execute_interface::static_remove_vblank_int(*device); +// legacy #define MCFG_DEVICE_PERIODIC_INT(_func, _rate) \ device_execute_interface::static_set_periodic_int(*device, _func, attotime::from_hz(_rate)); #define MCFG_DEVICE_PERIODIC_INT_DRIVER(_class, _func, _rate) \ device_execute_interface::static_set_periodic_int(*device, device_interrupt_delegate(&_class::_func, #_class "::" #_func, DEVICE_SELF, (_class *)0), attotime::from_hz(_rate)); #define MCFG_DEVICE_PERIODIC_INT_DEVICE(_devtag, _class, _func, _rate) \ device_execute_interface::static_set_periodic_int(*device, device_interrupt_delegate(&_class::_func, #_class "::" #_func, _devtag, (_class *)0), attotime::from_hz(_rate)); +#define MCFG_DEVICE_PERIODIC_INT_REMOVE() \ + device_execute_interface::static_remove_periodic_int(*device); //************************************************************************** @@ -176,8 +182,10 @@ public: static void static_set_disable(device_t &device); static void static_set_vblank_int(device_t &device, device_interrupt_func function, const char *tag, int rate = 0); // legacy static void static_set_vblank_int(device_t &device, device_interrupt_delegate function, const char *tag, int rate = 0); + static void static_remove_vblank_int(device_t &device); static void static_set_periodic_int(device_t &device, device_interrupt_func function, attotime rate); // legacy static void static_set_periodic_int(device_t &device, device_interrupt_delegate function, attotime rate); + static void static_remove_periodic_int(device_t &device); // execution management bool executing() const; diff --git a/src/mame/drivers/dacholer.c b/src/mame/drivers/dacholer.c index 315bfe8780d..6d4afbd2a66 100644 --- a/src/mame/drivers/dacholer.c +++ b/src/mame/drivers/dacholer.c @@ -696,7 +696,7 @@ static MACHINE_CONFIG_DERIVED( itaten, dacholer ) MCFG_CPU_MODIFY("audiocpu") MCFG_CPU_PROGRAM_MAP(itaten_snd_map) MCFG_CPU_IO_MAP(itaten_snd_io_map) - MCFG_CPU_VBLANK_INT(NULL,NULL) + MCFG_CPU_VBLANK_INT_REMOVE() MCFG_GFXDECODE(itaten) diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c index 0f519f9e653..1080cca20de 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -1303,7 +1303,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( system18_fd1094_i8751, system18_fd1094 ) MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_VBLANK_INT(NULL, NULL) + MCFG_CPU_VBLANK_INT_REMOVE() MCFG_CPU_ADD("mcu", I8751, 8000000) MCFG_CPU_IO_MAP(mcu_io_map) diff --git a/src/mame/drivers/system1.c b/src/mame/drivers/system1.c index 8fc9fe5ea5a..f865618fb50 100644 --- a/src/mame/drivers/system1.c +++ b/src/mame/drivers/system1.c @@ -2156,7 +2156,7 @@ static MACHINE_CONFIG_START( sys1ppi, system1_state ) MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK) /* not really, see notes above */ MCFG_CPU_PROGRAM_MAP(system1_map) MCFG_CPU_IO_MAP(system1_ppi_io_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", system1_state, irq0_line_hold) + MCFG_CPU_VBLANK_INT_DRIVER("screen", system1_state, irq0_line_hold) MCFG_CPU_ADD("soundcpu", Z80, SOUND_CLOCK/2) MCFG_CPU_PROGRAM_MAP(sound_map) @@ -2225,11 +2225,11 @@ static MACHINE_CONFIG_FRAGMENT( mcu ) /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_VBLANK_INT(NULL, NULL) + MCFG_CPU_VBLANK_INT_REMOVE() MCFG_CPU_ADD("mcu", I8751, SOUND_CLOCK) MCFG_CPU_IO_MAP(mcu_io_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", system1_state, mcu_irq_assert) + MCFG_CPU_VBLANK_INT_DRIVER("screen", system1_state, mcu_irq_assert) MCFG_TIMER_DRIVER_ADD_PERIODIC("mcu_t0", system1_state, mcu_t0_callback, attotime::from_usec(2500)) MACHINE_CONFIG_END