h8: correct interrupt timing after software standby

This commit is contained in:
hap 2024-02-24 01:48:34 +01:00
parent 4996c8d2e2
commit d37771ec53
5 changed files with 24 additions and 20 deletions

View File

@ -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)
{
// wake up from software standby with an external interrupt
if(standby() && irq_level >= 0) {
resume(SUSPEND_REASON_CLOCK);
m_standby_cb(0);
}
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() && m_irq_vector) {
resume(SUSPEND_REASON_CLOCK);
m_standby_cb(0);
take_interrupt();
}
}
void h8_device::internal(int cycles)

View File

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

View File

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

View File

@ -55,7 +55,6 @@ private:
int vol_l;
int output_r;
int output_l;
};
channel_t m_channels[16];

View File

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