mirror of
https://github.com/holub/mame
synced 2025-07-01 08:18:59 +03:00
emu/diexec.cpp: Deal with the annoyances of the timer state machine
This commit is contained in:
parent
98b18d69f7
commit
08875eebfa
@ -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)
|
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)
|
if (duration == attotime::zero)
|
||||||
{
|
{
|
||||||
|
// treat instantaneous pulses as ASSERT+CLEAR
|
||||||
if (irqline != INPUT_LINE_RESET && !input_edge_triggered(irqline))
|
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);
|
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, ASSERT_LINE);
|
||||||
set_input_line(irqline, CLEAR_LINE);
|
set_input_line(irqline, CLEAR_LINE);
|
||||||
@ -599,7 +600,7 @@ void device_execute_interface::pulse_input_line(int irqline, const attotime &dur
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const attotime target_time = local_time() + duration;
|
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);
|
set_input_line(irqline, ASSERT_LINE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user