AM_RANGE( 0x00, 0x7f ) AM_RAM ADDRESS_MAP_END static void cpu_init_tms_common( const device_config *device, const UINT32* decode_table, UINT16 o_mask, UINT16 r_mask, UINT8 pc_size, UINT8 byte_size ) { tms0980_state *cpustate = get_safe_token( device ); cpustate->config = (const tms0980_config *) device->static_config; assert( cpustate->config != NULL ); cpustate->decode_table = decode_table; cpustate->o_mask = o_mask; cpustate->r_mask = r_mask; cpustate->pc_size = pc_size; cpustate->byte_size = byte_size; cpustate->program = memory_find_address_space( device, ADDRESS_SPACE_PROGRAM ); cpustate->data = memory_find_address_space( device, ADDRESS_SPACE_DATA ); state_save_register_device_item( device, 0, cpustate->prev_pc ); state_save_register_device_item( device, 0, cpustate->prev_pa ); state_save_register_device_item( device, 0, cpustate->pc ); state_save_register_device_item( device, 0, cpustate->pa ); state_save_register_device_item( device, 0, cpustate->sr ); state_save_register_device_item( device, 0, cpustate->pb ); state_save_register_device_item( device, 0, cpustate->a ); state_save_register_device_item( device, 0, cpustate->x ); state_save_register_device_item( device, 0, cpustate->y ); state_save_register_device_item( device, 0, cpustate->dam ); state_save_register_device_item( device, 0, cpustate->ca ); state_save_register_device_item( device, 0, cpustate->cb ); state_save_register_device_item( device, 0, cpustate->cs ); state_save_register_device_item( device, 0, cpustate->r ); state_save_register_device_item( device, 0, cpustate->o ); state_save_register_device_item( device, 0, cpustate->cki_bus ); state_save_register_device_item( device, 0, cpustate->p ); state_save_register_device_item( device, 0, cpustate->n ); state_save_register_device_item( device, 0, cpustate->adder_result ); state_save_register_device_item( device, 0, cpustate->carry_in ); state_save_register_device_item( device, 0, cpustate->status ); state_save_register_device_item( device, 0, cpustate->status_latch ); state_save_register_device_item( device, 0, cpustate->special_status ); state_save_register_device_item( device, 0, cpustate->call_latch ); state_save_register_device_item( device, 0, cpustate->add_latch ); state_save_register_device_item( device, 0, cpustate->branch_latch ); state_save_register_device_item( device, 0, cpustate->subcycle ); state_save_register_device_item( device, 0, cpustate->ram_address ); state_save_register_device_item( device, 0, cpustate->ram_data ); state_save_register_device_item( device, 0, cpustate->rom_address ); state_save_register_device_item( device, 0, cpustate->opcode ); state_save_register_device_item( device, 0, cpustate->decode ); }
static CPU_INIT( m6809 ) { /* default configuration */ static const m6809_config default_config = { 0 }; const m6809_config *configdata = device->static_config ? (const m6809_config *)device->static_config : &default_config; m68_state_t *m68_state = get_safe_token(device); m68_state->config = configdata; m68_state->irq_callback = irqcallback; m68_state->device = device; m68_state->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); /* setup regtable */ state_save_register_device_item(device, 0, PC); state_save_register_device_item(device, 0, PPC); state_save_register_device_item(device, 0, D); state_save_register_device_item(device, 0, DP); state_save_register_device_item(device, 0, U); state_save_register_device_item(device, 0, S); state_save_register_device_item(device, 0, X); state_save_register_device_item(device, 0, Y); state_save_register_device_item(device, 0, CC); state_save_register_device_item_array(device, 0, m68_state->irq_state); state_save_register_device_item(device, 0, m68_state->int_state); state_save_register_device_item(device, 0, m68_state->nmi_state); }
static CPU_INIT( m4510 ) { m4510_Regs *cpustate = get_safe_token(device); const m6502_interface *intf = (const m6502_interface *)device->static_config; cpustate->interrupt_inhibit = 0; cpustate->rdmem_id = default_rdmem_id; cpustate->wrmem_id = default_wrmem_id; cpustate->port_read = NULL; cpustate->port_write = NULL; cpustate->irq_callback = irqcallback; cpustate->device = device; cpustate->space = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); if ( intf ) { if ( intf->read_indexed_func ) cpustate->rdmem_id = intf->read_indexed_func; if ( intf->write_indexed_func ) cpustate->wrmem_id = intf->write_indexed_func; if ( intf->port_read_func ) cpustate->port_read = intf->port_read_func; if ( intf->port_write_func ) cpustate->port_write = intf->port_write_func; } }
static CPU_INIT( sc61860 ) { sc61860_state *cpustate = get_safe_token(device); cpustate->config = (sc61860_cpu_core *) device->static_config; timer_pulse(device->machine, ATTOTIME_IN_HZ(500), cpustate, 0, sc61860_2ms_tick); cpustate->device = device; cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); }
static CPU_INIT( mb88 ) { mb88_state *cpustate = get_safe_token(device); if ( device->static_config ) { const mb88_cpu_core *_config = (const mb88_cpu_core*)device->static_config; cpustate->PLA = _config->PLA_config; } cpustate->irqcallback = irqcallback; cpustate->device = device; cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA); cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO); cpustate->serial = timer_alloc(device->machine, serial_timer, (void *)device); state_save_register_device_item(device, 0, cpustate->PC); state_save_register_device_item(device, 0, cpustate->PA); state_save_register_device_item(device, 0, cpustate->SP[0]); state_save_register_device_item(device, 0, cpustate->SP[1]); state_save_register_device_item(device, 0, cpustate->SP[2]); state_save_register_device_item(device, 0, cpustate->SP[3]); state_save_register_device_item(device, 0, cpustate->SI); state_save_register_device_item(device, 0, cpustate->A); state_save_register_device_item(device, 0, cpustate->X); state_save_register_device_item(device, 0, cpustate->Y); state_save_register_device_item(device, 0, cpustate->st); state_save_register_device_item(device, 0, cpustate->zf); state_save_register_device_item(device, 0, cpustate->cf); state_save_register_device_item(device, 0, cpustate->vf); state_save_register_device_item(device, 0, cpustate->sf); state_save_register_device_item(device, 0, cpustate->nf); state_save_register_device_item(device, 0, cpustate->pio); state_save_register_device_item(device, 0, cpustate->TH); state_save_register_device_item(device, 0, cpustate->TL); state_save_register_device_item(device, 0, cpustate->TP); state_save_register_device_item(device, 0, cpustate->ctr); state_save_register_device_item(device, 0, cpustate->SB); state_save_register_device_item(device, 0, cpustate->SBcount); state_save_register_device_item(device, 0, cpustate->pending_interrupt); }
static CPU_INIT( dsp32c ) { const dsp32_config *configdata = (const dsp32_config *)device->static_config; dsp32_state *cpustate = get_safe_token(device); /* copy in config data */ if (configdata != NULL) cpustate->output_pins_changed = configdata->output_pins_changed; cpustate->device = device; cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); }
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); }
static CPU_RESET( arm ) { ARM_REGS *cpustate = get_safe_token(device); cpu_irq_callback save_irqcallback = cpustate->irq_callback; memset(cpustate, 0, sizeof(ARM_REGS)); cpustate->irq_callback = save_irqcallback; cpustate->device = device; cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); /* start up in SVC mode with interrupts disabled. */ R15 = eARM_MODE_SVC|I_MASK|F_MASK; }
void devcb_resolve_read8(devcb_resolved_read8 *resolved, const devcb_read8 *config, const device_config *device) { /* reset the resolved structure */ memset(resolved, 0, sizeof(*resolved)); /* input port handlers */ if (config->type == DEVCB_TYPE_INPUT) { resolved->target = input_port_by_tag(device->machine->portconfig, config->tag); if (resolved->target == NULL) fatalerror("devcb_resolve_read8: unable to find input port '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag); resolved->read = trampoline_read_port_to_read8; } /* address space handlers */ else if (config->type >= DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->readspace != NULL) { FPTR space = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM); const device_config *cpu = cputag_get_cpu(device->machine, config->tag); if (cpu == NULL) fatalerror("devcb_resolve_read8: unable to find CPU '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag); resolved->target = memory_find_address_space(cpu, space); if (resolved->target == NULL) fatalerror("devcb_resolve_read8: unable to find CPU '%s' %s space (requested by %s '%s')", config->tag, address_space_names[space], device_get_name(device), device->tag); resolved->read = (read8_device_func)config->readspace; } /* device handlers */ else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF) && (config->readline != NULL || config->readdevice != NULL)) { resolved->target = (config->type == DEVCB_TYPE_SELF) ? device : devtag_get_device(device->machine, config->tag); if (resolved->target == NULL) fatalerror("devcb_resolve_read8: unable to find device '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag); /* read8 to read8 is direct */ if (config->readdevice != NULL) resolved->read = config->readdevice; /* read8 to read_line goes through a trampoline */ else { resolved->realtarget = resolved->target; resolved->real.readline = config->readline; resolved->target = resolved; resolved->read = trampoline_read_line_to_read8; } } }
static CPU_INIT( konami ) { konami_state *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(device, 0, PC); state_save_register_device_item(device, 0, U); state_save_register_device_item(device, 0, S); state_save_register_device_item(device, 0, X); state_save_register_device_item(device, 0, Y); state_save_register_device_item(device, 0, D); state_save_register_device_item(device, 0, DP); state_save_register_device_item(device, 0, CC); state_save_register_device_item(device, 0, cpustate->int_state); state_save_register_device_item(device, 0, cpustate->nmi_state); state_save_register_device_item(device, 0, cpustate->nmi_pending); state_save_register_device_item(device, 0, cpustate->irq_state[0]); state_save_register_device_item(device, 0, cpustate->irq_state[1]); }
void devcb_resolve_write_line(devcb_resolved_write_line *resolved, const devcb_write_line *config, const device_config *device) { /* reset the resolved structure */ memset(resolved, 0, sizeof(*resolved)); /* address space handlers */ if (config->type >= DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM) && config->type < DEVCB_TYPE_MEMORY(ADDRESS_SPACES) && config->writespace != NULL) { FPTR space = (FPTR)config->type - (FPTR)DEVCB_TYPE_MEMORY(ADDRESS_SPACE_PROGRAM); const device_config *cpu; if (device->owner != NULL) cpu = device_find_child_by_tag(device->owner, config->tag); else cpu = cputag_get_cpu(device->machine, config->tag); if (cpu == NULL) fatalerror("devcb_resolve_write_line: unable to find CPU '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag); resolved->target = resolved; resolved->write = trampoline_write8_to_write_line; resolved->realtarget = memory_find_address_space(cpu, space); if (resolved->realtarget == NULL) fatalerror("devcb_resolve_write_line: unable to find CPU '%s' %s space (requested by %s '%s')", config->tag, address_space_names[space], device_get_name(device), device->tag); resolved->real.writespace = config->writespace; } /* cpu line handlers */ else if (config->type >= DEVCB_TYPE_CPU_LINE(0) && config->type < DEVCB_TYPE_CPU_LINE(MAX_INPUT_LINES)) { FPTR line = (FPTR)config->type - (FPTR)DEVCB_TYPE_CPU_LINE(0); const device_config *cpu; if (device->owner != NULL) cpu = device_find_child_by_tag(device->owner, config->tag); else cpu = cputag_get_cpu(device->machine, config->tag); if (cpu == NULL) fatalerror("devcb_resolve_write_line: unable to find CPU '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag); resolved->target = resolved; resolved->write = trampoline_writecpu_to_write_line; resolved->realtarget = cpu; resolved->real.writeline = (int) line; } /* device handlers */ else if ((config->type == DEVCB_TYPE_DEVICE || config->type == DEVCB_TYPE_SELF) && (config->writeline != NULL || config->writedevice != NULL)) { /* locate the device */ if (config->type == DEVCB_TYPE_SELF) resolved->target = device; else if (device->owner != NULL) resolved->target = device_find_child_by_tag(device->owner, config->tag); else resolved->target = devtag_get_device(device->machine, config->tag); if (resolved->target == NULL) fatalerror("devcb_resolve_write_line: unable to find device '%s' (requested by %s '%s')", config->tag, device_get_name(device), device->tag); /* write_line to write_line is direct */ if (config->writeline != NULL) resolved->write = config->writeline; /* write_line to handler goes through a trampoline */ else { resolved->realtarget = resolved->target; resolved->real.writedevice = config->writedevice; resolved->target = resolved; resolved->write = trampoline_write8_to_write_line; } } }