Пример #1
0
 // debugging
 //-------------------------------------------------
 //  dump_timers - dump the current timer state
 //-------------------------------------------------
 void dump_timers()
 {
     machine().logerror("=============================================\n");
     machine().logerror("Timer Dump: Time = {0}\n", time().as_string());
     for (emu_timer timer = first_timer(); timer != null; timer = timer.next())
     {
         timer.dump();
     }
     machine().logerror("=============================================\n");
 }
Пример #2
0
        // timer helpers

        //-------------------------------------------------
        //  timer_list_insert - insert a new timer into
        //  the list at the appropriate location
        //-------------------------------------------------
        public emu_timer timer_list_insert(emu_timer timer)
        {
            // disabled timers sort to the end
            attotime expire = timer.enabled() ? timer.expire() : attotime.never;

            // loop over the timer list
            emu_timer prevtimer = null;

            for (emu_timer curtimer = m_timer_list; curtimer != null; prevtimer = curtimer, curtimer = curtimer.next())
            {
                // if the current list entry expires after us, we should be inserted before it
                if (curtimer.expire() > expire)
                {
                    // link the new guy in before the current list entry
                    timer.m_prev = prevtimer;
                    timer.m_next = curtimer;

                    if (prevtimer != null)
                    {
                        prevtimer.m_next = timer;
                    }
                    else
                    {
                        m_timer_list = timer;
                    }

                    curtimer.m_prev = timer;

                    return(timer);
                }
            }

            // need to insert after the last one
            if (prevtimer != null)
            {
                prevtimer.m_next = timer;
            }
            else
            {
                m_timer_list = timer;
            }

            timer.m_prev = prevtimer;
            timer.m_next = null;

            return(timer);
        }