From d37771ec5381e53dfdb8d384173c62ab6fb8e933 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 24 Feb 2024 01:48:34 +0100 Subject: h8: correct interrupt timing after software standby --- src/devices/cpu/h8/h8.cpp | 26 ++++++++++++++++---------- src/devices/cpu/h8/h8.h | 1 + src/devices/cpu/h8/h8.lst | 9 +++++---- src/devices/sound/i5000.h | 1 - src/mame/miltonbradley/microvsn.cpp | 5 +---- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/devices/cpu/h8/h8.cpp b/src/devices/cpu/h8/h8.cpp index 6b0c004e2f6..9f30efc8991 100644 --- a/src/devices/cpu/h8/h8.cpp +++ b/src/devices/cpu/h8/h8.cpp @@ -527,6 +527,13 @@ bool h8_device::exr_in_stack() const return false; } +void h8_device::take_interrupt() +{ + m_inst_state = STATE_IRQ; + m_taken_irq_vector = m_irq_vector; + m_taken_irq_level = m_irq_level; +} + void h8_device::prefetch_done() { if(m_requested_state != -1) { @@ -536,11 +543,9 @@ void h8_device::prefetch_done() m_inst_state = STATE_DMA; else if(m_current_dtc) m_inst_state = STATE_DTC; - else if(m_irq_vector) { - m_inst_state = STATE_IRQ; - m_taken_irq_vector = m_irq_vector; - m_taken_irq_level = m_irq_level; - } else if(m_has_trace && (m_EXR & EXR_T) && exr_in_stack()) + else if(m_irq_vector) + take_interrupt(); + else if(m_has_trace && (m_EXR & EXR_T) && exr_in_stack()) m_inst_state = STATE_TRACE; else m_inst_state = m_IR[0] = m_PIR; @@ -568,15 +573,16 @@ void h8_device::prefetch_done_noirq_notrace() void h8_device::set_irq(int irq_vector, int irq_level, bool irq_nmi) { + m_irq_vector = irq_vector; + m_irq_level = irq_level; + m_irq_nmi = irq_nmi; + // wake up from software standby with an external interrupt - if(standby() && irq_level >= 0) { + if(standby() && m_irq_vector) { resume(SUSPEND_REASON_CLOCK); m_standby_cb(0); + take_interrupt(); } - - m_irq_vector = irq_vector; - m_irq_level = irq_level; - m_irq_nmi = irq_nmi; } void h8_device::internal(int cycles) diff --git a/src/devices/cpu/h8/h8.h b/src/devices/cpu/h8/h8.h index 885ca100c80..9cce7631d9d 100644 --- a/src/devices/cpu/h8/h8.h +++ b/src/devices/cpu/h8/h8.h @@ -202,6 +202,7 @@ protected: void prefetch_done_noirq(); void prefetch_done_notrace(); void prefetch_done_noirq_notrace(); + void take_interrupt(); void illegal(); u16 adc_default(int adc); u8 port_default_r(int port); diff --git a/src/devices/cpu/h8/h8.lst b/src/devices/cpu/h8/h8.lst index c9625b369cb..92a9e03caca 100644 --- a/src/devices/cpu/h8/h8.lst +++ b/src/devices/cpu/h8/h8.lst @@ -744,11 +744,12 @@ macro jsr32 %opc %spreg if(m_standby_pending) { suspend(SUSPEND_REASON_CLOCK, true); m_standby_cb(1); + } else { + while(!m_irq_vector) { + eat-all-cycles; + } + prefetch_done(); } - else while(!m_irq_vector) { - eat-all-cycles; - } - prefetch_done(); 01a0 ffff 0 clrmac - - s26 prefetch_start diff --git a/src/devices/sound/i5000.h b/src/devices/sound/i5000.h index abd84f5ac43..cb3e45382e9 100644 --- a/src/devices/sound/i5000.h +++ b/src/devices/sound/i5000.h @@ -55,7 +55,6 @@ private: int vol_l; int output_r; int output_l; - }; channel_t m_channels[16]; diff --git a/src/mame/miltonbradley/microvsn.cpp b/src/mame/miltonbradley/microvsn.cpp index 4a935bba780..94ae4ff2fc4 100644 --- a/src/mame/miltonbradley/microvsn.cpp +++ b/src/mame/miltonbradley/microvsn.cpp @@ -392,10 +392,7 @@ int microvision_state::i8021_t1_r() { // T1: paddle capacitor (active low) if (m_paddle_on) - { - bool active = (m_p2 & 0xc) || m_paddle_delay > machine().time(); - return active ? 1 : 0; - } + return (m_p2 & 0xc || m_paddle_delay > machine().time()) ? 1 : 0; else return 1; } -- cgit v1.2.3