Esempio n. 1
0
        public void adjust(attotime start_delay, int param, attotime period)  //void adjust(attotime start_delay, s32 param = 0, const attotime &periodicity = attotime::never);
        {
            // if this is the callback timer, mark it modified
            device_scheduler scheduler = machine().scheduler();

            if (scheduler.callback_timer() == this)
            {
                scheduler.callback_timer_modified_set(true);
            }

            // compute the time of the next firing and insert into the list
            m_param   = param;
            m_enabled = true;

            // clamp negative times to 0
            if (start_delay.seconds() < 0)
            {
                start_delay = attotime.zero;
            }

            // set the start and expire times
            m_start  = scheduler.time();
            m_expire = m_start + start_delay;
            m_period = period;

            // remove and re-insert the timer in its new order
            scheduler.timer_list_remove(this);
            scheduler.timer_list_insert(this);

            // if this was inserted as the head, abort the current timeslice and resync
            if (this == scheduler.first_timer())
            {
                scheduler.abort_timeslice();
            }
        }
Esempio n. 2
0
        public void Dispose()
        {
            if (m_scheduler != null)
            {
                m_scheduler.Dispose();
            }
            m_scheduler = null;

            if (m_debugger != null)
            {
                m_debugger.Dispose();
            }
            m_debugger = null;

            if (m_tilemap != null)
            {
                m_tilemap.Dispose();
            }
            m_tilemap = null;

            if (m_render != null)
            {
                m_render.Dispose();
            }
            m_render = null;

            m_isDisposed = true;
        }
Esempio n. 3
0
        //-------------------------------------------------
        //  schedule_next_period - schedule the next
        //  period
        //-------------------------------------------------
        public void schedule_next_period()
        {
            // advance by one period
            m_start   = m_expire;
            m_expire += m_period;

            // remove and re-insert us
            device_scheduler scheduler = machine().scheduler();

            scheduler.timer_list_remove(this);
            scheduler.timer_list_insert(this);
        }
Esempio n. 4
0
        string m_string_buffer;  //mutable util::ovectorstream m_string_buffer;


        // construction/destruction

        //-------------------------------------------------
        //  running_machine - constructor
        //-------------------------------------------------
        public running_machine(machine_config _config, machine_manager manager)
        {
            m_side_effects_disabled = 0;
            debug_flags             = 0;
            m_config                 = _config;
            m_system                 = _config.gamedrv();
            m_manager                = manager;
            m_current_phase          = machine_phase.PREINIT;
            m_paused                 = false;
            m_hard_reset_pending     = false;
            m_exit_pending           = false;
            m_soft_reset_timer       = null;
            m_rand_seed              = 0x9d14abd7;
            m_ui_active              = _config.options().ui_active();
            m_basename               = _config.gamedrv().name;
            m_sample_rate            = _config.options().sample_rate();
            m_saveload_schedule      = saveload_schedule.NONE;
            m_saveload_schedule_time = attotime.zero;
            m_saveload_searchpath    = null;

            m_save      = new save_manager(this);
            m_memory    = new memory_manager(this);
            m_ioport    = new ioport_manager(this);
            m_scheduler = new device_scheduler(this);
            m_scheduler.device_scheduler_after_ctor(this);


            for (int i = 0; i < m_notifier_list.Length; i++)
            {
                m_notifier_list[i] = new std.list <notifier_callback_item>();
            }

            m_base_time = 0;

            // set the machine on all devices
            device_enumerator iter = new device_enumerator(root_device());

            foreach (device_t device in iter)
            {
                device.set_machine(this);
            }

            // fetch core options
            if (options().debug())
            {
                debug_flags = (DEBUG_FLAG_ENABLED | DEBUG_FLAG_CALL_HOOK) | (DEBUG_FLAG_OSD_ENABLED);
            }
        }
Esempio n. 5
0
 public void data_w(offs_t offset, u8 data)
 {
     if (BIT(offset, 0) != 0)
     {
         // ZINTRQ
         // if jumpered this way, the Z80 write strobe pulses the MCU interrupt line
         // should be PULSE_LINE because it's edge sensitive, but diexec only allows PULSE_LINE on reset and NMI
         if (int_mode.WRITE == m_int_mode)
         {
             m_mcu.op0.set_input_line(M68705_IRQ_LINE, HOLD_LINE);
         }
     }
     else
     {
         // ZLWRITE
         device_scheduler sched = machine().scheduler();
         sched.synchronize(do_host_write, data);
         sched.boost_interleave(attotime.zero, attotime.from_usec(10));
     }
 }
Esempio n. 6
0
        //-------------------------------------------------
        //  interface_pre_start - work to be done prior to
        //  actually starting a device
        //-------------------------------------------------
        public override void interface_pre_start()
        {
            m_scheduler = device().machine().scheduler();

            // bind delegates
            //m_vblank_interrupt.resolve();
            //m_timed_interrupt.resolve();
            //m_driver_irq.resolve();

            // fill in the initial states
            int index = new device_enumerator(device().machine().root_device()).indexof(device());

            m_suspend    = SUSPEND_REASON_RESET;
            m_profiler   = (profile_type)(index + profile_type.PROFILER_DEVICE_FIRST);
            m_inttrigger = index + TRIGGER_INT;

            // allocate timers if we need them
            if (m_timed_interrupt_period != attotime.zero)
            {
                m_timedint_timer = m_scheduler.timer_alloc(trigger_periodic_interrupt, this);
            }
        }
Esempio n. 7
0
        public attoseconds_t m_attoseconds_per_cycle; // attoseconds per adjusted clock cycle


        // construction/destruction

        //-------------------------------------------------
        //  device_execute_interface - constructor
        //-------------------------------------------------
        public device_execute_interface(machine_config mconfig, device_t device)
            : base(device, "execute")
        {
            m_scheduler               = null;
            m_disabled                = false;
            m_vblank_interrupt        = null;
            m_vblank_interrupt_screen = null;
            m_timed_interrupt         = null;
            m_timed_interrupt_period  = attotime.zero;
            m_nextexec                = null;
            m_driver_irq              = null;
            m_timedint_timer          = null;
            m_profiler                = profile_type.PROFILER_IDLE;
            m_icountptr               = null;
            m_cycles_running          = 0;
            m_cycles_stolen           = 0;
            m_suspend               = 0;
            m_nextsuspend           = 0;
            m_eatcycles             = 0;
            m_nexteatcycles         = 0;
            m_trigger               = 0;
            m_inttrigger            = 0;
            m_totalcycles           = 0;
            m_divisor               = 0;
            m_divshift              = 0;
            m_cycles_per_second     = 0;
            m_attoseconds_per_cycle = 0;


            for (int line = 0; line < m_input.Length; line++)
            {
                m_input[line] = new device_input();
            }


            // configure the fast accessor
            assert(device.interfaces().m_execute == null);
            device.interfaces().m_execute = this;
        }