src/emu/mconfig.c
| r8333 | r8334 | |
| 26 | 26 | ***************************************************************************/ |
| 27 | 27 | |
| 28 | 28 | /*------------------------------------------------- |
| 29 | | machine_config_alloc - allocate a new |
| 29 | machine_config_alloc_owner - allocate a new |
| 30 | 30 | machine configuration and populate it using |
| 31 | | the supplied constructor |
| 31 | the supplied constructor, and assign owner |
| 32 | 32 | -------------------------------------------------*/ |
| 33 | 33 | |
| 34 | | machine_config *machine_config_alloc(const machine_config_token *tokens) |
| 34 | machine_config *machine_config_alloc_owner(const machine_config_token *tokens, const device_config *owner) |
| 35 | 35 | { |
| 36 | 36 | machine_config *config; |
| 37 | 37 | |
| r8333 | r8334 | |
| 39 | 39 | config = global_alloc_clear(machine_config); |
| 40 | 40 | |
| 41 | 41 | /* parse tokens into the config */ |
| 42 | | machine_config_detokenize(config, tokens, NULL); |
| 42 | machine_config_detokenize(config, tokens, owner); |
| 43 | 43 | |
| 44 | 44 | /* process any device-specific machine configurations */ |
| 45 | 45 | for (const device_config *device = config->devicelist.first(); device != NULL; device = device->next()) |
| r8333 | r8334 | |
| 56 | 56 | return config; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | /*------------------------------------------------- |
| 60 | machine_config_alloc - allocate a new |
| 61 | machine configuration and populate it using |
| 62 | the supplied constructor |
| 63 | -------------------------------------------------*/ |
| 64 | machine_config *machine_config_alloc(const machine_config_token *tokens) |
| 65 | { |
| 66 | return machine_config_alloc_owner(tokens,NULL); |
| 67 | } |
| 59 | 68 | |
| 60 | 69 | /*------------------------------------------------- |
| 61 | 70 | machine_config_free - release memory allocated |
src/mess/devices/ti99cart.c
| r8333 | r8334 | |
| 578 | 578 | ti99_multicart_state *cartslots = (ti99_multicart_state *)downcast<legacy_device_base *>(cartsys)->token(); |
| 579 | 579 | ti99_pcb_t *pcb_def = (ti99_pcb_t *)downcast<legacy_device_base *>(pcb)->token(); |
| 580 | 580 | |
| 581 | | // pcb_def->read = (read16_device_func) pcb->get_config_fct(TI99CARTINFO_FCT_6000_R); |
| 582 | | // pcb_def->write = (write16_device_func) pcb->get_config_fct(TI99CARTINFO_FCT_6000_W); |
| 583 | | // pcb_def->read8 = (read8_device_func) pcb->get_config_fct(TI99CARTINFO_FCT_6000_R8); |
| 584 | | // pcb_def->write8 = (write8_device_func) pcb->get_config_fct(TI99CARTINFO_FCT_6000_W8); |
| 585 | | // pcb_def->cruread = (read8_device_func) pcb->get_config_fct(TI99CARTINFO_FCT_CRU_R); |
| 586 | | // pcb_def->cruwrite = (write8_device_func) pcb->get_config_fct(TI99CARTINFO_FCT_CRU_W); |
| 581 | pcb_def->read = (read16_device_func) downcast<legacy_device_base *>(pcb)->get_config_fct(TI99CARTINFO_FCT_6000_R); |
| 582 | pcb_def->write = (write16_device_func) downcast<legacy_device_base *>(pcb)->get_config_fct(TI99CARTINFO_FCT_6000_W); |
| 583 | pcb_def->read8 = (read8_device_func) downcast<legacy_device_base *>(pcb)->get_config_fct(TI99CARTINFO_FCT_6000_R8); |
| 584 | pcb_def->write8 = (write8_device_func) downcast<legacy_device_base *>(pcb)->get_config_fct(TI99CARTINFO_FCT_6000_W8); |
| 585 | pcb_def->cruread = (read8_device_func) downcast<legacy_device_base *>(pcb)->get_config_fct(TI99CARTINFO_FCT_CRU_R); |
| 586 | pcb_def->cruwrite = (write8_device_func) downcast<legacy_device_base *>(pcb)->get_config_fct(TI99CARTINFO_FCT_CRU_W); |
| 587 | 587 | |
| 588 | | // pcb_def->assemble = (assmfct *)pcb->get_config_fct(TI99CART_FCT_ASSM); |
| 589 | | // pcb_def->disassemble = (assmfct *)pcb->get_config_fct(TI99CART_FCT_DISASSM); |
| 588 | pcb_def->assemble = (assmfct *)downcast<legacy_device_base *>(pcb)->get_config_fct(TI99CART_FCT_ASSM); |
| 589 | pcb_def->disassemble = (assmfct *)downcast<legacy_device_base *>(pcb)->get_config_fct(TI99CART_FCT_DISASSM); |
| 590 | 590 | |
| 591 | 591 | pcb_def->cartridge = &cartslots->cartridge[index]; |
| 592 | 592 | pcb_def->cartridge->pcb = pcb; |
src/mess/devices/cartslot.c
| r8333 | r8334 | |
| 383 | 383 | return pcb_type; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | static machine_config *device_cfg = NULL; |
| 386 | 387 | |
| 388 | static void memory_exit(running_machine *machine) |
| 389 | { |
| 390 | machine_config_free(device_cfg); |
| 391 | } |
| 392 | |
| 387 | 393 | /*------------------------------------------------- |
| 388 | 394 | DEVICE_IMAGE_GET_DEVICES(cartslot) |
| 389 | 395 | -------------------------------------------------*/ |
| 390 | | static void add_device_with_subdevices(const running_device *_owner, device_type _type, const char *_tag, UINT32 _clock) |
| 396 | static void add_device_with_subdevices(device_t *_owner, device_type _type, const char *_tag, UINT32 _clock) |
| 391 | 397 | { |
| 392 | | /* astring tempstring; |
| 393 | | device_list *devlist = &_owner->machine->devicelist; |
| 394 | | const device_config *cfg = new device_config(&_owner->baseconfig(), _type, _tag, _clock); |
| 395 | | running_device *dev = devlist->append(_owner->subtag(tempstring,_tag), new running_device(*_owner->machine, *cfg)); |
| 396 | | |
| 397 | | const machine_config_token *tokens = (const machine_config_token *)dev->get_config_ptr(DEVINFO_PTR_MACHINE_CONFIG); |
| 398 | | machine_config *config; |
| 399 | | const device_config *config_dev; |
| 400 | | running_device *new_dev = NULL; |
| 401 | | if (tokens != NULL) |
| 402 | | { |
| 403 | | config = machine_config_alloc(tokens); |
| 404 | | for (config_dev = config->devicelist.first(); config_dev != NULL; config_dev = config_dev->next) |
| 398 | astring tempstring; |
| 399 | device_list *devlist = &_owner->machine->devicelist; |
| 400 | const machine_config *config = _owner->machine->config; |
| 401 | |
| 402 | device_config *devconfig = _type(*config, _owner->subtag(tempstring,_tag), &_owner->baseconfig(), _clock); |
| 403 | |
| 404 | running_device *dev = devlist->append(_owner->subtag(tempstring,_tag), devconfig->alloc_device(*_owner->machine)); |
| 405 | const machine_config_token *tokens = dev->machine_config_tokens(); |
| 406 | if (tokens != NULL) |
| 407 | { |
| 408 | device_cfg = machine_config_alloc_owner(tokens,&dev->baseconfig()); |
| 409 | for (const device_config *config_dev = device_cfg->devicelist.first(); config_dev != NULL; config_dev = config_dev->next()) |
| 405 | 410 | { |
| 406 | | device_config *new_cfg = new device_config(cfg, config_dev->type, config_dev->tag(), config_dev->clock); |
| 407 | | new_cfg->static_config = config_dev->static_config; |
| 408 | | memcpy( |
| 409 | | new_cfg->inline_config, |
| 410 | | config_dev->inline_config, |
| 411 | | new_cfg->get_config_int(DEVINFO_INT_INLINE_CONFIG_BYTES)); |
| 412 | | new_dev = devlist->append(dev->subtag(tempstring,config_dev->tag()), new running_device(*_owner->machine, *new_cfg)); |
| 413 | | new_dev->owner = dev; |
| 411 | devlist->append(config_dev->tag(), config_dev->alloc_device(*_owner->machine)); |
| 414 | 412 | } |
| 415 | | machine_config_free(config); |
| 416 | | }*/ |
| 413 | add_exit_callback(_owner->machine, memory_exit); |
| 414 | } |
| 417 | 415 | } |
| 418 | 416 | |
| 419 | 417 | static DEVICE_IMAGE_GET_DEVICES(cartslot) |
src/mess/devices/coco_fdc.c
| r8333 | r8334 | |
| 228 | 228 | static DEVICE_START(fdc) |
| 229 | 229 | { |
| 230 | 230 | fdc_t *fdc = get_token(device); |
| 231 | | // const fdc_hardware_type *hwtype = (const fdc_hardware_type *)device->get_config_ptr(FDCINFO_PTR_HWTYPE); |
| 231 | const fdc_hardware_type *hwtype = (const fdc_hardware_type *)downcast<legacy_device_base *>(device)->get_config_ptr(FDCINFO_PTR_HWTYPE); |
| 232 | 232 | |
| 233 | 233 | /* initialize variables */ |
| 234 | 234 | memset(fdc, 0, sizeof(*fdc)); |
| 235 | | // fdc->hwtype = hwtype; |
| 236 | | // fdc->drq = hwtype->initial_drq; |
| 235 | fdc->hwtype = hwtype; |
| 236 | fdc->drq = hwtype->initial_drq; |
| 237 | 237 | fdc->cococart = device->owner()->owner(); |
| 238 | 238 | fdc->disto_msm6242 = device->subdevice(DISTO_TAG); |
| 239 | 239 | fdc->ds1315 = device->subdevice(CLOUD9_TAG); |