summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2021-03-02 09:35:41 -0800
committer Aaron Giles <aaron@aarongiles.com>2021-03-02 09:35:41 -0800
commit43374004e7ac73976c7609ce5ce25fa69554a82b (patch)
tree3f6c0fa6afabb9cbbb94703078e843180d770d27 /src/devices
parentce02c7d478c9739f6670ffc592adbbe55de076c2 (diff)
Schedule all interrupt changes via timers to ensure proper ordering. Fixes the seibu sound issue in a more generic fashion.
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/sound/ymfm.cpp20
-rw-r--r--src/devices/sound/ymfm.h9
2 files changed, 25 insertions, 4 deletions
diff --git a/src/devices/sound/ymfm.cpp b/src/devices/sound/ymfm.cpp
index 55282f3c18b..c57986856b3 100644
--- a/src/devices/sound/ymfm.cpp
+++ b/src/devices/sound/ymfm.cpp
@@ -1619,12 +1619,30 @@ TIMER_CALLBACK_MEMBER(ymfm_engine_base<RegisterType>::timer_handler)
//-------------------------------------------------
+// schedule_check_interrupts - schedule an
+// interrupt check via timer
+//-------------------------------------------------
+
+template<class RegisterType>
+void ymfm_engine_base<RegisterType>::schedule_check_interrupts()
+{
+ // if we're currently executing a CPU, schedule the interrupt check;
+ // otherwise, do it directly
+ auto &scheduler = m_device.machine().scheduler();
+ if (scheduler.currently_executing())
+ scheduler.synchronize(timer_expired_delegate(FUNC(ymfm_engine_base<RegisterType>::check_interrupts), this), 0);
+ else
+ check_interrupts(nullptr, 0);
+}
+
+
+//-------------------------------------------------
// check_interrupts - check the interrupt sources
// for interrupts
//-------------------------------------------------
template<class RegisterType>
-void ymfm_engine_base<RegisterType>::check_interrupts()
+TIMER_CALLBACK_MEMBER(ymfm_engine_base<RegisterType>::check_interrupts)
{
// update the state
u8 old_state = m_irq_state;
diff --git a/src/devices/sound/ymfm.h b/src/devices/sound/ymfm.h
index be9959a2ef5..8cf7e854f7d 100644
--- a/src/devices/sound/ymfm.h
+++ b/src/devices/sound/ymfm.h
@@ -745,10 +745,10 @@ public:
u8 status() const;
// set/reset bits in the status register, updating the IRQ status
- void set_reset_status(u8 set, u8 reset) { m_status = (m_status | set) & ~reset; check_interrupts(); }
+ void set_reset_status(u8 set, u8 reset) { m_status = (m_status | set) & ~reset; schedule_check_interrupts(); }
// set the IRQ mask
- void set_irq_mask(u8 mask) { m_irq_mask = mask; check_interrupts(); }
+ void set_irq_mask(u8 mask) { m_irq_mask = mask; schedule_check_interrupts(); }
// helper to compute the busy duration
attotime compute_busy_duration(u32 cycles = 32)
@@ -784,8 +784,11 @@ private:
// timer callback
TIMER_CALLBACK_MEMBER(timer_handler);
+ // schedule an interrupt check
+ void schedule_check_interrupts();
+
// check interrupts
- void check_interrupts();
+ TIMER_CALLBACK_MEMBER(check_interrupts);
// internal state
device_t &m_device; // reference to the owning device