added MCFG_{CPU|DEVICE}_VBLANK_INT_REMOVE and MCFG_{CPU|DEVICE}_PERIODIC_INT_REMOVE to properly remove non-legacy VBLANK interrupts - the current code only reset the legacy interrupt which wasn't set anyways

This commit is contained in:
Oliver Stöneberg 2013-08-20 12:33:35 +00:00
parent 9a0bce9f91
commit 5980642169
6 changed files with 46 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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)

View File

@ -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