static DEVICE_START(x2212) { x2212_state *c = get_safe_token(device); const x2212_config *config; /* validate some basic stuff */ assert(device != NULL); // assert(device->static_config != NULL); assert(device->inline_config == NULL); assert(device->machine != NULL); assert(device->machine->config != NULL); c->sram = auto_alloc_array( device->machine, UINT8, SIZE_DATA ); c->e2prom = auto_alloc_array( device->machine, UINT8, SIZE_DATA ); c->store = 1; c->array_recall = 1; config = (const x2212_config *)device->static_config; if( config != NULL && config->data != NULL ) { c->default_data = memory_region( device->machine, config->data ); } state_save_register_device_item_pointer( device, 0, c->sram, SIZE_DATA ); state_save_register_device_item_pointer( device, 0, c->e2prom, SIZE_DATA ); state_save_register_device_item( device, 0, c->store ); state_save_register_device_item( device, 0, c->array_recall ); }
static DEVICE_START(at28c16) { at28c16_state *c = get_safe_token(device); const at28c16_config *config; /* validate some basic stuff */ assert(device != NULL); // assert(device->baseconfig().static_config != NULL); // assert(device->baseconfig().inline_config == NULL); assert(device->machine != NULL); assert(device->machine->config != NULL); c->data = auto_alloc_array( device->machine, UINT8, SIZE_DATA ); c->id = auto_alloc_array( device->machine, UINT8, SIZE_ID ); c->a9_12v = 0; c->oe_12v = 0; c->last_write = -1; c->write_timer = timer_alloc(device->machine, write_finished, c ); c->default_data = *device->region; config = (const at28c16_config *)device->baseconfig().inline_config; if (config->id != NULL) c->default_id = memory_region( device->machine, config->id ); /* create the name for save states */ state_save_register_device_item_pointer( device, 0, c->data, SIZE_DATA ); state_save_register_device_item_pointer( device, 0, c->id, SIZE_ID ); state_save_register_device_item( device, 0, c->a9_12v ); state_save_register_device_item( device, 0, c->oe_12v ); state_save_register_device_item( device, 0, c->last_write ); }
static DEVICE_START( snkwave ) { snkwave_state *chip = get_safe_token(device); assert(device->baseconfig().static_config == 0); /* adjust internal clock */ chip->external_clock = device->clock; /* adjust output clock */ chip->sample_rate = chip->external_clock >> CLOCK_SHIFT; /* get stream channels */ chip->stream = stream_create(device, 0, 1, chip->sample_rate, chip, snkwave_update); /* reset all the voices */ chip->frequency = 0; chip->counter = 0; chip->waveform_position = 0; /* register with the save state system */ state_save_register_device_item(device, 0, chip->frequency); state_save_register_device_item(device, 0, chip->counter); state_save_register_device_item(device, 0, chip->waveform_position); state_save_register_device_item_pointer(device, 0, chip->waveform, WAVEFORM_LENGTH); }
static DEVICE_START( cdp1852 ) { cdp1852_t *cdp1852 = get_safe_token(device); const cdp1852_interface *intf = get_interface(device); /* resolve callbacks */ devcb_resolve_read8(&cdp1852->in_data_func, &intf->in_data_func, device); devcb_resolve_write8(&cdp1852->out_data_func, &intf->out_data_func, device); devcb_resolve_write_line(&cdp1852->out_sr_func, &intf->out_sr_func, device); /* set initial values */ cdp1852->mode = (cdp1852_mode)intf->mode; if (device->clock > 0) { /* create the scan timer */ cdp1852->scan_timer = timer_alloc(device->machine, cdp1852_scan_tick, (void *)device); timer_adjust_periodic(cdp1852->scan_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock)); } /* register for state saving */ state_save_register_device_item(device, 0, cdp1852->new_data); state_save_register_device_item(device, 0, cdp1852->data); state_save_register_device_item(device, 0, cdp1852->next_data); state_save_register_device_item(device, 0, cdp1852->sr); state_save_register_device_item(device, 0, cdp1852->next_sr); }
static DEVICE_START( mb14241 ) { mb14241_state *mb14241 = get_safe_token(device); state_save_register_device_item(device, 0, mb14241->shift_data); state_save_register_device_item(device, 0, mb14241->shift_count); }
void at28c16_device::device_start() { m_write_timer = timer_alloc( &m_machine, write_finished, this ); state_save_register_device_item( this, 0, m_a9_12v ); state_save_register_device_item( this, 0, m_oe_12v ); state_save_register_device_item( this, 0, m_last_write ); }
void intelfsh_device::device_start() { m_timer = device_timer_alloc(*this); state_save_register_device_item( this, 0, m_status ); state_save_register_device_item( this, 0, m_flash_mode ); state_save_register_device_item( this, 0, m_flash_master_lock ); }
static DEVICE_START( iremga20 ) { ga20_state *chip = get_safe_token(device); int i; /* Initialize our chip structure */ chip->rom = *device->region; chip->rom_size = device->region->bytes(); iremga20_reset(chip); for ( i = 0; i < 0x40; i++ ) chip->regs[i] = 0; chip->stream = stream_create( device, 0, 2, device->clock/4, chip, IremGA20_update ); state_save_register_device_item_array(device, 0, chip->regs); for (i = 0; i < 4; i++) { state_save_register_device_item(device, i, chip->channel[i].rate); state_save_register_device_item(device, i, chip->channel[i].size); state_save_register_device_item(device, i, chip->channel[i].start); state_save_register_device_item(device, i, chip->channel[i].pos); state_save_register_device_item(device, i, chip->channel[i].end); state_save_register_device_item(device, i, chip->channel[i].volume); state_save_register_device_item(device, i, chip->channel[i].pan); state_save_register_device_item(device, i, chip->channel[i].effect); state_save_register_device_item(device, i, chip->channel[i].play); } }
static DEVICE_START( ic_315_5250 ) { ic_315_5250_state *ic_315_5250 = _315_5250_get_safe_token(device); const ic_315_5250_interface *intf = _315_5250_get_interface(device); ic_315_5250->sound_w = intf->sound_write_callback; ic_315_5250->timer_ack = intf->timer_ack_callback; state_save_register_device_item(device, 0, ic_315_5250->counter); state_save_register_device_item(device, 0, ic_315_5250->bit); state_save_register_device_item_array(device, 0, ic_315_5250->regs); }
static CPU_INIT( arm ) { ARM_REGS *cpustate = get_safe_token(device); cpustate->irq_callback = irqcallback; cpustate->device = device; cpustate->program = device->space(AS_PROGRAM); state_save_register_device_item_array(device, 0, cpustate->sArmRegister); state_save_register_device_item_array(device, 0, cpustate->coproRegister); state_save_register_device_item(device, 0, cpustate->pendingIrq); state_save_register_device_item(device, 0, cpustate->pendingFiq); }
static CPU_INIT( arm ) { ARM_REGS *cpustate = get_safe_token(device); cpustate->irq_callback = irqcallback; cpustate->device = device; cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); state_save_register_device_item_array(device, 0, cpustate->sArmRegister); state_save_register_device_item_array(device, 0, cpustate->coproRegister); state_save_register_device_item(device, 0, cpustate->pendingIrq); state_save_register_device_item(device, 0, cpustate->pendingFiq); }
void ttl74123_device::device_start() { m_timer = timer_alloc(&m_machine, clear_callback, (void *)this); /* start with the defaults */ m_a = m_config.m_a; m_b = m_config.m_b; m_clear = m_config.m_clear; /* register for state saving */ state_save_register_device_item(this, 0, m_a); state_save_register_device_item(this, 0, m_b); state_save_register_device_item(this, 0, m_clear); }
static DEVICE_START( msm5205 ) { msm5205_state *voice = get_safe_token(device); /* save a global pointer to our interface */ voice->intf = (const msm5205_interface *)device->baseconfig().static_config(); voice->device = device; voice->clock = device->clock(); /* compute the difference tables */ ComputeTables (voice); /* stream system initialize */ voice->stream = stream_create(device,0,1,device->clock(),voice,MSM5205_update); voice->timer = timer_alloc(device->machine, MSM5205_vclk_callback, voice); /* initialize */ DEVICE_RESET_CALL(msm5205); /* register for save states */ state_save_register_device_item(device, 0, voice->clock); state_save_register_device_item(device, 0, voice->data); state_save_register_device_item(device, 0, voice->vclk); state_save_register_device_item(device, 0, voice->reset); state_save_register_device_item(device, 0, voice->prescaler); state_save_register_device_item(device, 0, voice->bitwidth); state_save_register_device_item(device, 0, voice->signal); state_save_register_device_item(device, 0, voice->step); }
static DEVICE_START( rp5h01 ) { rp5h01_state *rp5h01 = get_safe_token(device); const rp5h01_interface *intf = get_interface(device); rp5h01->data = &(memory_region(device->machine, intf->region)[intf->offset]); /* register for state saving */ state_save_register_device_item(device, 0, rp5h01->counter); state_save_register_device_item(device, 0, rp5h01->counter_mode); state_save_register_device_item(device, 0, rp5h01->enabled); state_save_register_device_item(device, 0, rp5h01->old_reset); state_save_register_device_item(device, 0, rp5h01->old_clock); }
ROM_END /*------------------------------------------------- device start callback -------------------------------------------------*/ static DEVICE_START( namco_53xx ) { const namco_53xx_interface *config = (const namco_53xx_interface *)device->baseconfig().static_config; namco_53xx_state *state = get_safe_token(device); astring tempstring; assert(config != NULL); /* find our CPU */ state->cpu = device->subdevice("mcu"); assert(state->cpu != NULL); /* resolve our read/write callbacks */ devcb_resolve_read8(&state->k, &config->k, device); devcb_resolve_read8(&state->in[0], &config->in[0], device); devcb_resolve_read8(&state->in[1], &config->in[1], device); devcb_resolve_read8(&state->in[2], &config->in[2], device); devcb_resolve_read8(&state->in[3], &config->in[3], device); devcb_resolve_write8(&state->p, &config->p, device); state_save_register_device_item(device, 0, state->portO); }
void eeprom_device::device_start() { state_save_register_device_item_pointer(this, 0, m_serial_buffer, SERIAL_BUFFER_LENGTH); state_save_register_device_item(this, 0, m_clock_line); state_save_register_device_item(this, 0, m_reset_line); state_save_register_device_item(this, 0, m_locked); state_save_register_device_item(this, 0, m_serial_count); state_save_register_device_item(this, 0, m_latch); state_save_register_device_item(this, 0, m_reset_delay); state_save_register_device_item(this, 0, m_clock_count); state_save_register_device_item(this, 0, m_data_bits); state_save_register_device_item(this, 0, m_read_address); }
static DEVICE_START( f3853 ) { f3853_t *f3853 = get_safe_token( device ); UINT8 reg=0xfe; int i; f3853->config = (const f3853_config *)device->baseconfig().static_config; for (i=254/*known to get 0xfe after 255 cycles*/; i>=0; i--) { int o7 = ( reg & 0x80 ) ? TRUE : FALSE; int o5 = ( reg & 0x20 ) ? TRUE : FALSE; int o4 = ( reg & 0x10 ) ? TRUE : FALSE; int o3 = ( reg & 8 ) ? TRUE : FALSE; f3853_value_to_cycle[reg]=i; reg<<=1; if (!((o7!=o5)!=(o4!=o3))) reg|=1; } f3853->timer = timer_alloc( device->machine, f3853_timer_callback, (void *)device ); state_save_register_device_item( device, 0, f3853->high ); state_save_register_device_item( device, 0, f3853->low ); state_save_register_device_item( device, 0, f3853->external_enable ); state_save_register_device_item( device, 0, f3853->timer_enable ); state_save_register_device_item( device, 0, f3853->request_flipflop ); state_save_register_device_item( device, 0, f3853->priority_line ); state_save_register_device_item( device, 0, f3853->external_interrupt_line ); }
static DEVICE_START( namco_06xx ) { const namco_06xx_config *config = (const namco_06xx_config *)device->baseconfig().inline_config; namco_06xx_state *state = get_safe_token(device); int devnum; assert(config != NULL); /* resolve our CPU */ state->nmicpu = devtag_get_device(device->machine, config->nmicpu); assert(state->nmicpu != NULL); /* resolve our devices */ state->device[0] = (config->chip0 != NULL) ? devtag_get_device(device->machine, config->chip0) : NULL; assert(state->device[0] != NULL || config->chip0 == NULL); state->device[1] = (config->chip1 != NULL) ? devtag_get_device(device->machine, config->chip1) : NULL; assert(state->device[1] != NULL || config->chip1 == NULL); state->device[2] = (config->chip2 != NULL) ? devtag_get_device(device->machine, config->chip2) : NULL; assert(state->device[2] != NULL || config->chip2 == NULL); state->device[3] = (config->chip3 != NULL) ? devtag_get_device(device->machine, config->chip3) : NULL; assert(state->device[3] != NULL || config->chip3 == NULL); /* loop over devices and set their read/write handlers */ for (devnum = 0; devnum < 4; devnum++) if (state->device[devnum] != NULL) { device_type type = state->device[devnum]->type; if (type == NAMCO_50XX) { state->read[devnum] = namco_50xx_read; state->readreq[devnum] = namco_50xx_read_request; state->write[devnum] = namco_50xx_write; } else if (type == NAMCO_51XX) { state->read[devnum] = namco_51xx_read; state->write[devnum] = namco_51xx_write; } else if (type == NAMCO_52XX) state->write[devnum] = namco_52xx_write; else if (type == NAMCO_53XX) { state->read[devnum] = namco_53xx_read; state->readreq[devnum] = namco_53xx_read_request; } else if (type == NAMCO_54XX) state->write[devnum] = namco_54xx_write; else fatalerror("Unknown device type %s connected to Namco 06xx", state->device[devnum]->name()); } /* allocate a timer */ state->nmi_timer = timer_alloc(device->machine, nmi_generate, (void *)device); state_save_register_device_item(device, 0, state->control); }
static void register_for_save_states(tms6100_state *tms) { state_save_register_device_item(tms->device, 0, tms->addr_bits); state_save_register_device_item(tms->device, 0, tms->address); state_save_register_device_item(tms->device, 0, tms->address_latch); state_save_register_device_item(tms->device, 0, tms->data); state_save_register_device_item(tms->device, 0, tms->loadptr); state_save_register_device_item(tms->device, 0, tms->m0); state_save_register_device_item(tms->device, 0, tms->m1); state_save_register_device_item(tms->device, 0, tms->state); }
static DEVICE_START(timekeeper) { timekeeper_state *c = get_safe_token(device); emu_timer *timer; attotime duration; mame_system_time systime; /* validate some basic stuff */ assert(device != NULL); // assert(device->static_config != NULL); assert(device->inline_config == NULL); assert(device->machine != NULL); assert(device->machine->config != NULL); mame_get_base_datetime(device->machine, &systime); c->device = device; c->control = 0; c->seconds = make_bcd( systime.local_time.second ); c->minutes = make_bcd( systime.local_time.minute ); c->hours = make_bcd( systime.local_time.hour ); c->day = make_bcd( systime.local_time.weekday + 1 ); c->date = make_bcd( systime.local_time.mday ); c->month = make_bcd( systime.local_time.month + 1 ); c->year = make_bcd( systime.local_time.year % 100 ); c->century = make_bcd( systime.local_time.year / 100 ); c->data = auto_alloc_array( device->machine, UINT8, c->size ); c->default_data = device->region; if (c->default_data != NULL) { assert( device->regionbytes == c->size ); } state_save_register_device_item( device, 0, c->control ); state_save_register_device_item( device, 0, c->seconds ); state_save_register_device_item( device, 0, c->minutes ); state_save_register_device_item( device, 0, c->hours ); state_save_register_device_item( device, 0, c->day ); state_save_register_device_item( device, 0, c->date ); state_save_register_device_item( device, 0, c->month ); state_save_register_device_item( device, 0, c->year ); state_save_register_device_item( device, 0, c->century ); state_save_register_device_item_pointer( device, 0, c->data, c->size ); timer = timer_alloc( device->machine, timekeeper_tick, c ); duration = ATTOTIME_IN_SEC(1); timer_adjust_periodic( timer, duration, 0, duration ); }
void ttl7474_device::device_start() { state_save_register_device_item(this, 0, m_clear); state_save_register_device_item(this, 0, m_preset); state_save_register_device_item(this, 0, m_clk); state_save_register_device_item(this, 0, m_d); state_save_register_device_item(this, 0, m_output); state_save_register_device_item(this, 0, m_output_comp); state_save_register_device_item(this, 0, m_last_clock); state_save_register_device_item(this, 0, m_last_output); state_save_register_device_item(this, 0, m_last_output_comp); devcb_resolve_write_line(&m_output_cb, &m_config.m_output_cb, this); devcb_resolve_write_line(&m_comp_output_cb, &m_config.m_comp_output_cb, this); }
static DEVICE_START( ttl7474 ) { ttl7474_config *config = (ttl7474_config *)device->baseconfig().inline_config; ttl7474_state *state = get_safe_token(device); state->output_cb = config->output_cb; state_save_register_device_item(device, 0, state->clear); state_save_register_device_item(device, 0, state->preset); state_save_register_device_item(device, 0, state->clock); state_save_register_device_item(device, 0, state->d); state_save_register_device_item(device, 0, state->output); state_save_register_device_item(device, 0, state->output_comp); state_save_register_device_item(device, 0, state->last_clock); state_save_register_device_item(device, 0, state->last_output); state_save_register_device_item(device, 0, state->last_output_comp); }
static DEVICE_START( dac ) { dac_state *info = get_safe_token(device); DAC_build_voltable(info); info->channel = stream_create(device,0,1,device->clock() ? device->clock() : DEFAULT_SAMPLE_RATE,info,DAC_update); info->output = 0; state_save_register_device_item(device, 0, info->output); }
static DEVICE_START( mb3773 ) { mb3773_state *mb3773 = get_safe_token(device); /* create the timer */ mb3773->watchdog_timer = timer_alloc(device->machine, watchdog_timeout, NULL); reset_timer(device); /* register for state saving */ state_save_register_device_item(device, 0, mb3773->ck); }
static DEVICE_START( dmadac ) { dmadac_state *info = get_safe_token(device); /* allocate a clear a buffer */ info->buffer = auto_alloc_array_clear(device->machine, INT16, BUFFER_SIZE); /* reset the state */ info->volume = 0x100; /* allocate a stream channel */ info->channel = stream_create(device, 0, 1, DEFAULT_SAMPLE_RATE, info, dmadac_update); /* register with the save state system */ state_save_register_device_item(device, 0, info->bufin); state_save_register_device_item(device, 0, info->bufout); state_save_register_device_item(device, 0, info->volume); state_save_register_device_item(device, 0, info->enabled); state_save_register_device_item(device, 0, info->frequency); state_save_register_device_item_pointer(device, 0, info->buffer, BUFFER_SIZE); }
void timer_device::device_start() { // fetch the screen if (m_config.m_screen != NULL) m_screen = downcast<screen_device *>(machine->device(m_config.m_screen)); // allocate the timer m_timer = timer_alloc(machine, (m_config.m_type == timer_device_config::TIMER_TYPE_SCANLINE) ? static_scanline_timer_callback : static_periodic_timer_callback, (void *)this); // register for save states state_save_register_device_item(this, 0, m_first_time); }
/* device interface */ static DEVICE_START( tms9927 ) { tms9927_state *tms = get_safe_token(device); /* validate arguments */ assert(device != NULL); assert(device->tag != NULL); tms->intf = (const tms9927_interface *)device->static_config; if (tms->intf != NULL) { assert(device->clock > 0); assert(tms->intf->hpixels_per_column > 0); /* copy the initial parameters */ tms->clock = device->clock; tms->hpixels_per_column = tms->intf->hpixels_per_column; /* get the screen device */ tms->screen = devtag_get_device(device->machine, tms->intf->screen_tag); assert(tms->screen != NULL); /* get the self-load PROM */ if (tms->intf->selfload_region != NULL) { tms->selfload = memory_region(device->machine, tms->intf->selfload_region); assert(tms->selfload != NULL); } } /* register for state saving */ state_save_register_postload(device->machine, tms9927_state_save_postload, tms); state_save_register_device_item(device, 0, tms->clock); state_save_register_device_item_array(device, 0, tms->reg); state_save_register_device_item(device, 0, tms->start_datarow); state_save_register_device_item(device, 0, tms->reset); state_save_register_device_item(device, 0, tms->hpixels_per_column); }
void okim6295_device::device_start() { // create the stream int divisor = m_config.m_pin7 ? 132 : 165; m_stream = stream_create(this, 0, 1, clock() / divisor, this, static_stream_generate); state_save_register_device_item(this, 0, m_command); state_save_register_device_item(this, 0, m_bank_offs); for (int voicenum = 0; voicenum < OKIM6295_VOICES; voicenum++) { state_save_register_device_item(this, voicenum, m_voice[voicenum].m_playing); state_save_register_device_item(this, voicenum, m_voice[voicenum].m_sample); state_save_register_device_item(this, voicenum, m_voice[voicenum].m_count); state_save_register_device_item(this, voicenum, m_voice[voicenum].m_adpcm.m_signal); state_save_register_device_item(this, voicenum, m_voice[voicenum].m_adpcm.m_step); state_save_register_device_item(this, voicenum, m_voice[voicenum].m_volume); state_save_register_device_item(this, voicenum, m_voice[voicenum].m_base_offset); } }
static DEVICE_START( tc0220ioc ) { tc0220ioc_state *tc0220ioc = tc0220ioc_get_safe_token(device); const tc0220ioc_interface *intf = tc0220ioc_get_interface(device); devcb_resolve_read8(&tc0220ioc->read_0, &intf->read_0, device); devcb_resolve_read8(&tc0220ioc->read_1, &intf->read_1, device); devcb_resolve_read8(&tc0220ioc->read_2, &intf->read_2, device); devcb_resolve_read8(&tc0220ioc->read_3, &intf->read_3, device); devcb_resolve_read8(&tc0220ioc->read_7, &intf->read_7, device); state_save_register_device_item_array(device, 0, tc0220ioc->regs); state_save_register_device_item(device, 0, tc0220ioc->port); }
static DEVICE_START( ttl74123 ) { ttl74123_t *chip = get_safe_token(device); /* validate arguments */ chip->intf = (ttl74123_config *)device->static_config; assert_always(chip->intf, "No interface specified"); assert_always((chip->intf->connection_type != TTL74123_GROUNDED) || (chip->intf->cap >= CAP_U(0.01)), "Only capacitors >= 0.01uF supported for GROUNDED type"); assert_always(chip->intf->cap >= CAP_P(1000), "Only capacitors >= 1000pF supported "); chip->timer = timer_alloc(device->machine, clear_callback, (void *) device); /* start with the defaults */ chip->a = chip->intf->a; chip->b = chip->intf->b; chip->clear = chip->intf->clear; /* register for state saving */ state_save_register_device_item(device, 0, chip->a); state_save_register_device_item(device, 0, chip->b); state_save_register_device_item(device, 0, chip->clear); }