static void start_pulse(const device_config *device) { ttl74123_t *chip = get_safe_token(device); attotime duration = compute_duration(chip); if (timer_running(chip)) { /* retriggering, but not if we are called to quickly */ attotime delay_time = attotime_make(0, ATTOSECONDS_PER_SECOND * chip->intf->cap * 220); if (attotime_compare(timer_timeelapsed(chip->timer), delay_time) >= 0) { timer_adjust_oneshot(chip->timer, duration, 0); if (LOG) logerror("74123 %s: Retriggering pulse. Duration: %f\n", device->tag, attotime_to_double(duration)); } else { if (LOG) logerror("74123 %s: Retriggering failed.\n", device->tag); } } else { /* starting */ timer_adjust_oneshot(chip->timer, duration, 0); set_output(device); if (LOG) logerror("74123 %s: Starting pulse. Duration: %f\n", device->tag, attotime_to_double(duration)); } }
void osd_update(running_machine *machine, int skip_redraw){ nitroinput_update(); const render_primitive_list *primlist; int minwidth, minheight; // get the minimum width/height for the current layout render_target_get_minimum_size(our_target, &minwidth, &minheight); if(our_target){ // make that the size of our target render_target_set_bounds(our_target, minwidth, minheight, 0); // get the list of primitives for the target at the current size primlist = render_target_get_primitives(our_target); // lock them, and then render them osd_lock_acquire(primlist->lock); // do the drawing here osd_lock_release(primlist->lock); } // after 5 seconds, exit if (attotime_compare(timer_get_time(machine), attotime_make(5, 0)) > 0) mame_schedule_exit(machine); }
void ttl74123_device::start_pulse() { attotime duration = compute_duration(); if(timer_running()) { /* retriggering, but not if we are called to quickly */ attotime delay_time = attotime_make(0, ATTOSECONDS_PER_SECOND * m_config.m_cap * 220); if(attotime_compare(timer_timeelapsed(m_timer), delay_time) >= 0) { timer_adjust_oneshot(m_timer, duration, 0); if (LOG) logerror("74123 %s: Retriggering pulse. Duration: %f\n", tag(), attotime_to_double(duration)); } else { if (LOG) logerror("74123 %s: Retriggering failed.\n", tag()); } } else { /* starting */ timer_adjust_oneshot(m_timer, duration, 0); set_output(); if (LOG) logerror("74123 %s: Starting pulse. Duration: %f\n", tag(), attotime_to_double(duration)); } }
ROM_END /*------------------------------------------------- device start callback -------------------------------------------------*/ static DEVICE_START( namco_52xx ) { namco_52xx_interface *intf = (namco_52xx_interface *)device->baseconfig().static_config; namco_52xx_state *state = get_safe_token(device); astring tempstring; /* find our CPU */ state->cpu = device->subdevice("mcu"); assert(state->cpu != NULL); /* find the attached discrete sound device */ assert(intf->discrete != NULL); state->discrete = devtag_get_device(device->machine, intf->discrete); assert(state->discrete != NULL); state->basenode = intf->firstnode; /* resolve our read/write callbacks */ devcb_resolve_read8(&state->romread, &intf->romread, device); devcb_resolve_read8(&state->si, &intf->si, device); /* start the external clock */ if (intf->extclock != 0) timer_pulse(device->machine, attotime_make(0, intf->extclock), (void *)device, 0, external_clock_pulse); }
static void start_pulse(TTL74123_state *chip) { attotime duration = compute_duration(chip); if (timer_running(chip)) { /* retriggering, but not if we are called to quickly */ attotime delay_time = attotime_make(0, ATTOSECONDS_PER_SECOND * chip->intf->cap * 220); if (attotime_compare(timer_timeelapsed(chip->timer), delay_time) >= 0) { timer_adjust(chip->timer, duration, 0, attotime_never); if (LOG) logerror("74123 #%d: Retriggering pulse. Duration: %f\n", chip->which, attotime_to_double(duration)); } else { if (LOG) logerror("74123 #%d: Retriggering failed.\n", chip->which); } } else { /* starting */ timer_adjust(chip->timer, duration, 0, attotime_never); set_output(chip); if (LOG) logerror("74123 #%d: Starting pulse. Duration: %f\n", chip->which, attotime_to_double(duration)); } }
attotime attotime_mul(attotime _time1, UINT32 factor) { UINT32 attolo, attohi, reslo, reshi; UINT64 temp; /* if one of the items is attotime_never, return attotime_never */ if (_time1.seconds >= ATTOTIME_MAX_SECONDS) return attotime_never; /* 0 times anything is zero */ if (factor == 0) return attotime_zero; /* split attoseconds into upper and lower halves which fit into 32 bits */ attohi = divu_64x32_rem(_time1.attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); /* scale the lower half, then split into high/low parts */ temp = mulu_32x32(attolo, factor); temp = divu_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reslo); /* scale the upper half, then split into high/low parts */ temp += mulu_32x32(attohi, factor); temp = divu_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reshi); /* scale the seconds */ temp += mulu_32x32(_time1.seconds, factor); if (temp >= ATTOTIME_MAX_SECONDS) return attotime_never; /* build the result */ return attotime_make(temp, (attoseconds_t)reslo + mul_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT)); }
/* Called via stream_update(stream). * This can be triggered by the core (based on emulated time) or via speaker_level_w(). */ static STREAM_UPDATE( speaker_sound_update ) { speaker_state *sp = (speaker_state *) param; stream_sample_t *buffer = outputs[0]; int volume = sp->levels[sp->level]; double filtered_volume; attotime sampled_time = attotime_zero; if (samples > 0) { /* Prepare to update time state */ sampled_time = attotime_make(0, sp->channel_sample_period); if (samples > 1) sampled_time = attotime_mul(sampled_time, samples); /* Note: since the stream is in the process of being updated, * stream_get_time() will return the time before the update! (MAME 0.130) * Avoid using it here in order to avoid a subtle dependence on the stream implementation. */ } if (samples-- > 0) { /* Note that first interm. sample may be composed... */ filtered_volume = update_interm_samples_get_filtered_volume(sp, volume); /* Composite volume is now quantized to the stream resolution */ *buffer++ = (stream_sample_t)filtered_volume; /* Any additional samples will be homogeneous, however may need filtering across samples: */ while (samples-- > 0) { filtered_volume = update_interm_samples_get_filtered_volume(sp, volume); *buffer++ = (stream_sample_t)filtered_volume; } /* Update the time state */ sp->channel_last_sample_time = attotime_add(sp->channel_last_sample_time, sampled_time); sp->channel_next_sample_time = attotime_add_attoseconds(sp->channel_last_sample_time, sp->channel_sample_period); sp->next_interm_sample_time = attotime_add_attoseconds(sp->channel_last_sample_time, sp->interm_sample_period); sp->last_update_time = sp->channel_last_sample_time; } } /* speaker_sound_update */
INLINE void count_states(int states) { attotime state_time = attotime_make(0, attotime_to_attoseconds(MICRO_STATE_CLOCK_PERIOD) * states); if (!micro.timer) { timer_adjust_oneshot(micro.timer, attotime_never, 0); micro.timer_active = 1; micro.endtime = state_time; } else if (attotime_compare(timer_timeelapsed(micro.timer), micro.endtime) > 0) { timer_adjust_oneshot(micro.timer, attotime_never, 0); micro.timer_active = 1; micro.endtime = state_time; } else micro.endtime = attotime_add(micro.endtime, state_time); }
void mini_osd_interface::update(bool skip_redraw) { // get the minimum width/height for the current layout int minwidth, minheight; our_target->compute_minimum_size(minwidth, minheight); // make that the size of our target our_target->set_bounds(minwidth, minheight); // get the list of primitives for the target at the current size render_primitive_list &primlist = our_target->get_primitives(); // lock them, and then render them primlist.acquire_lock(); // do the drawing here primlist.release_lock(); // after 5 seconds, exit if (attotime_compare(timer_get_time(&machine()), attotime_make(5, 0)) > 0) machine().schedule_exit(); }
static TIMER_CALLBACK( schaser_effect_555_cb ) { mw8080bw_state *state = machine->driver_data<mw8080bw_state>(); int effect = param; attotime new_time; /* Toggle 555 output */ state->schaser_effect_555_is_low = !state->schaser_effect_555_is_low; state->schaser_effect_555_time_remain = attotime_zero; state->schaser_effect_555_time_remain_savable = attotime_to_double(state->schaser_effect_555_time_remain); if (state->schaser_effect_555_is_low) new_time = attotime_div(PERIOD_OF_555_ASTABLE(0, RES_K(20), CAP_U(1)), 2); else { if (effect) new_time = attotime_make(0, ATTOSECONDS_PER_SECOND * .8873 * schaser_effect_rc[effect]); else new_time = attotime_never; } timer_adjust_oneshot(state->schaser_effect_555_timer, new_time, effect); sn76477_enable_w(state->sn, !(state->schaser_effect_555_is_low || state->schaser_explosion)); sn76477_one_shot_cap_voltage_w(state->sn, !(state->schaser_effect_555_is_low || state->schaser_explosion) ? 0 : SN76477_EXTERNAL_VOLTAGE_DISCONNECT); }