emu/diexec.cpp: Deal with the annoyances of the timer state machine

This commit is contained in:
Vas Crabb 2025-04-09 05:06:47 +10:00
parent 98b18d69f7
commit 08875eebfa

View File

@ -584,13 +584,14 @@ TIMER_CALLBACK_MEMBER(device_execute_interface::trigger_periodic_interrupt)
void device_execute_interface::pulse_input_line(int irqline, const attotime &duration)
{
// treat instantaneous pulses as ASSERT+CLEAR
const attotime expiry = m_pulse_end_timers[irqline]->expire();
if (duration == attotime::zero)
{
// treat instantaneous pulses as ASSERT+CLEAR
if (irqline != INPUT_LINE_RESET && !input_edge_triggered(irqline))
throw emu_fatalerror("device '%s': zero-width pulse is not allowed for input line %d\n", device().tag(), irqline);
if (m_pulse_end_timers[irqline]->remaining() == attotime::zero)
if (expiry.is_never() || (expiry <= m_scheduler->time()))
{
set_input_line(irqline, ASSERT_LINE);
set_input_line(irqline, CLEAR_LINE);
@ -599,7 +600,7 @@ void device_execute_interface::pulse_input_line(int irqline, const attotime &dur
else
{
const attotime target_time = local_time() + duration;
if (target_time > m_pulse_end_timers[irqline]->expire())
if (expiry.is_never() || (target_time > expiry))
{
set_input_line(irqline, ASSERT_LINE);