src/mess/devices/cococart.h
| r8365 | r8366 | |
| 10 | 10 | #define __COCOCART_H__ |
| 11 | 11 | |
| 12 | 12 | #include "image.h" |
| 13 | #include "cartslot.h" |
| 13 | 14 | |
| 14 | | |
| 15 | 15 | /*************************************************************************** |
| 16 | 16 | CONSTANTS |
| 17 | 17 | ***************************************************************************/ |
| 18 | 18 | |
| 19 | | DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE, coco_cartridge); |
| 20 | | DECLARE_LEGACY_DEVICE(DRAGON_CARTRIDGE, dragon_cartridge); |
| 19 | DECLARE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE, coco_cartridge); |
| 20 | DECLARE_LEGACY_CART_SLOT_DEVICE(DRAGON_CARTRIDGE, dragon_cartridge); |
| 21 | 21 | |
| 22 | | DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_FDC_COCO, coco_cartridge_pcb_fdc_coco); |
| 23 | | DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_FDC_DRAGON, coco_cartridge_pcb_fdc_dragon); |
| 22 | DECLARE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE_PCB_FDC_COCO, coco_cartridge_pcb_fdc_coco); |
| 23 | DECLARE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE_PCB_FDC_DRAGON, coco_cartridge_pcb_fdc_dragon); |
| 24 | 24 | DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_PAK, coco_cartridge_pcb_pak); |
| 25 | 25 | DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_PAK_BANKED16K, coco_cartridge_pcb_pak_banked16k); |
| 26 | 26 | DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_ORCH90, coco_cartridge_pcb_orch90); |
src/mess/devices/ti99cart.c
| r8365 | r8366 | |
| 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) 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); |
| 581 | pcb_def->read = (read16_device_func)downcast<const legacy_cart_slot_device_config_base *>(&pcb->baseconfig())->get_config_fct(TI99CARTINFO_FCT_6000_R); |
| 582 | pcb_def->write = (write16_device_func)downcast<const legacy_cart_slot_device_config_base *>(&pcb->baseconfig())->get_config_fct(TI99CARTINFO_FCT_6000_W); |
| 583 | pcb_def->read8 = (read8_device_func)downcast<const legacy_cart_slot_device_config_base *>(&pcb->baseconfig())->get_config_fct(TI99CARTINFO_FCT_6000_R8); |
| 584 | pcb_def->write8 = (write8_device_func)downcast<const legacy_cart_slot_device_config_base *>(&pcb->baseconfig())->get_config_fct(TI99CARTINFO_FCT_6000_W8); |
| 585 | pcb_def->cruread = (read8_device_func)downcast<const legacy_cart_slot_device_config_base *>(&pcb->baseconfig())->get_config_fct(TI99CARTINFO_FCT_CRU_R); |
| 586 | pcb_def->cruwrite = (write8_device_func)downcast<const legacy_cart_slot_device_config_base *>(&pcb->baseconfig())->get_config_fct(TI99CARTINFO_FCT_CRU_W); |
| 587 | 587 | |
| 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); |
| 588 | pcb_def->assemble = (assmfct *)downcast<const legacy_cart_slot_device_config_base *>(&pcb->baseconfig())->get_config_fct(TI99CART_FCT_ASSM); |
| 589 | pcb_def->disassemble = (assmfct *)downcast<const legacy_cart_slot_device_config_base *>(&pcb->baseconfig())->get_config_fct(TI99CART_FCT_DISASSM); |
| 590 | 590 | |
| 591 | 591 | pcb_def->cartridge = &cartslots->cartridge[index]; |
| 592 | 592 | pcb_def->cartridge->pcb = pcb; |
| r8365 | r8366 | |
| 3442 | 3442 | #define DEVTEMPLATE_FAMILY "Multi-cartridge system" |
| 3443 | 3443 | #include "devtempl.h" |
| 3444 | 3444 | |
| 3445 | | DEFINE_LEGACY_DEVICE(TI99_MULTICART, ti99_multicart); |
| 3445 | DEFINE_LEGACY_CART_SLOT_DEVICE(TI99_MULTICART, ti99_multicart); |
src/mess/devices/cartslot.c
| r8365 | r8366 | |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | DEFINE_LEGACY_IMAGE_DEVICE(CARTSLOT, cartslot); |
| 491 | |
| 492 | |
| 493 | //************************************************************************** |
| 494 | // DEVICE CONFIG CARTSLOT INTERFACE |
| 495 | //************************************************************************** |
| 496 | |
| 497 | //------------------------------------------------- |
| 498 | // device_config_cart_slot_interface - constructor |
| 499 | //------------------------------------------------- |
| 500 | |
| 501 | device_config_cart_slot_interface::device_config_cart_slot_interface(const machine_config &mconfig, device_config &devconfig) |
| 502 | : device_config_interface(mconfig, devconfig) |
| 503 | { |
| 504 | } |
| 505 | |
| 506 | |
| 507 | //------------------------------------------------- |
| 508 | // ~device_config_cart_slot_interface - destructor |
| 509 | //------------------------------------------------- |
| 510 | |
| 511 | device_config_cart_slot_interface::~device_config_cart_slot_interface() |
| 512 | { |
| 513 | } |
| 514 | |
| 515 | |
| 516 | |
| 517 | //************************************************************************** |
| 518 | // DEVICE CARTSLOT INTERFACE |
| 519 | //************************************************************************** |
| 520 | |
| 521 | //------------------------------------------------- |
| 522 | // device_cart_slot_interface - constructor |
| 523 | //------------------------------------------------- |
| 524 | |
| 525 | device_cart_slot_interface::device_cart_slot_interface(running_machine &machine, const device_config &config, device_t &device) |
| 526 | : device_interface(machine, config, device), |
| 527 | m_cart_slot_config(dynamic_cast<const device_config_cart_slot_interface &>(config)) |
| 528 | { |
| 529 | } |
| 530 | |
| 531 | |
| 532 | //------------------------------------------------- |
| 533 | // ~device_cart_slot_interface - destructor |
| 534 | //------------------------------------------------- |
| 535 | |
| 536 | device_cart_slot_interface::~device_cart_slot_interface() |
| 537 | { |
| 538 | } |
| 539 | |
| 540 | //************************************************************************** |
| 541 | // LEGACY cart_slot DEVICE CONFIGURATION |
| 542 | //************************************************************************** |
| 543 | |
| 544 | //------------------------------------------------- |
| 545 | // legacy_cart_slot_device_config_base - constructor |
| 546 | //------------------------------------------------- |
| 547 | |
| 548 | legacy_cart_slot_device_config_base::legacy_cart_slot_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config) |
| 549 | : legacy_device_config_base(mconfig, type, tag, owner, clock, get_config), |
| 550 | device_config_cart_slot_interface(mconfig, *this) |
| 551 | { |
| 552 | } |
| 553 | |
| 554 | |
| 555 | //************************************************************************** |
| 556 | // LIVE LEGACY cart_slot DEVICE |
| 557 | //************************************************************************** |
| 558 | |
| 559 | //------------------------------------------------- |
| 560 | // legacy_cart_slot_device_base - constructor |
| 561 | //------------------------------------------------- |
| 562 | |
| 563 | legacy_cart_slot_device_base::legacy_cart_slot_device_base(running_machine &machine, const device_config &config) |
| 564 | : legacy_device_base(machine, config), |
| 565 | device_cart_slot_interface(machine, config, *this) |
| 566 | { |
| 567 | } |
src/mess/devices/coco_fdc.c
| r8365 | r8366 | |
| 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 *)downcast<legacy_device_base *>(device)->get_config_ptr(FDCINFO_PTR_HWTYPE); |
| 231 | const fdc_hardware_type *hwtype = (const fdc_hardware_type *)downcast<const legacy_cart_slot_device_config_base *>(&device->baseconfig())->get_config_ptr(FDCINFO_PTR_HWTYPE); |
| 232 | 232 | |
| 233 | 233 | /* initialize variables */ |
| 234 | 234 | memset(fdc, 0, sizeof(*fdc)); |
| r8365 | r8366 | |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | |
| 653 | | DEFINE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_FDC_COCO, coco_cartridge_pcb_fdc_coco); |
| 654 | | DEFINE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_FDC_DRAGON, coco_cartridge_pcb_fdc_dragon); |
| 653 | DEFINE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE_PCB_FDC_COCO, coco_cartridge_pcb_fdc_coco); |
| 654 | DEFINE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE_PCB_FDC_DRAGON, coco_cartridge_pcb_fdc_dragon); |
src/mess/devices/cartslot.h
| r8365 | r8366 | |
| 115 | 115 | #define MDRV_CARTSLOT_INTERFACE(_interface) \ |
| 116 | 116 | MDRV_DEVICE_CONFIG_DATAPTR(cartslot_config, interface, _interface ) |
| 117 | 117 | |
| 118 | #define DECLARE_LEGACY_CART_SLOT_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_cart_slot_device_config_base, legacy_cart_slot_device_base) |
| 119 | #define DEFINE_LEGACY_CART_SLOT_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device_config, basename##_device, legacy_cart_slot_device_config_base, legacy_cart_slot_device_base) |
| 118 | 120 | |
| 119 | | #endif /* __CARTSLOT_H__ */ |
| 121 | // ======================> device_config_cart_slot_interface |
| 122 | |
| 123 | // class representing interface-specific configuration cart_slot |
| 124 | class device_config_cart_slot_interface : public device_config_interface |
| 125 | { |
| 126 | public: |
| 127 | // construction/destruction |
| 128 | device_config_cart_slot_interface(const machine_config &mconfig, device_config &device); |
| 129 | virtual ~device_config_cart_slot_interface(); |
| 130 | }; |
| 131 | |
| 132 | |
| 133 | |
| 134 | // ======================> device_cart_slot_interface |
| 135 | |
| 136 | // class representing interface-specific live cart_slot |
| 137 | class device_cart_slot_interface : public device_interface |
| 138 | { |
| 139 | public: |
| 140 | // construction/destruction |
| 141 | device_cart_slot_interface(running_machine &machine, const device_config &config, device_t &device); |
| 142 | virtual ~device_cart_slot_interface(); |
| 143 | |
| 144 | // configuration access |
| 145 | const device_config_cart_slot_interface &cart_slot_config() const { return m_cart_slot_config; } |
| 146 | protected: |
| 147 | |
| 148 | // configuration |
| 149 | const device_config_cart_slot_interface &m_cart_slot_config; // reference to our device_config_execute_interface |
| 150 | }; |
| 151 | // ======================> legacy_cart_slot_device_config |
| 152 | |
| 153 | // legacy_cart_slot_device_config is a device_config with a cart_slot interface |
| 154 | class legacy_cart_slot_device_config_base : public legacy_device_config_base, |
| 155 | public device_config_cart_slot_interface |
| 156 | { |
| 157 | protected: |
| 158 | // construction/destruction |
| 159 | legacy_cart_slot_device_config_base(const machine_config &mconfig, device_type type, const char *tag, const device_config *owner, UINT32 clock, device_get_config_func get_config); |
| 160 | public: |
| 161 | INT64 get_config_int(UINT32 state) const { return get_legacy_config_int(state); } |
| 162 | genf *get_config_fct(UINT32 state) const { return get_legacy_config_fct(state); } |
| 163 | void *get_config_ptr(UINT32 state) const { return get_legacy_config_ptr(state); } |
| 164 | }; |
| 165 | |
| 166 | |
| 167 | |
| 168 | // ======================> legacy_cart_slot_device |
| 169 | |
| 170 | // legacy_cart_slot_device is a legacy_device_base with a cart_slot interface |
| 171 | class legacy_cart_slot_device_base : public legacy_device_base, |
| 172 | public device_cart_slot_interface |
| 173 | { |
| 174 | protected: |
| 175 | // construction/destruction |
| 176 | legacy_cart_slot_device_base(running_machine &machine, const device_config &config); |
| 177 | |
| 178 | // device_cart_slot_interface overrides |
| 179 | }; |
| 180 | #endif /* __cart_slot_H__ */ |
src/mess/devices/aescart.c
| r8365 | r8366 | |
| 221 | 221 | aes_multicart_t *cartslots = (aes_multicart_t *)downcast<legacy_device_base *>(cartsys)->token(); |
| 222 | 222 | aes_pcb_t *pcb_def = (aes_pcb_t *)downcast<legacy_device_base *>(pcb)->token(); |
| 223 | 223 | |
| 224 | | pcb_def->assemble = (assmfct *)downcast<legacy_device_base *>(pcb)->get_config_fct(AESCART_FCT_ASSM); |
| 225 | | pcb_def->disassemble = (assmfct *)downcast<legacy_device_base *>(pcb)->get_config_fct(AESCART_FCT_DISASSM); |
| 224 | pcb_def->assemble = (assmfct *)downcast<const legacy_cart_slot_device_config_base *>(&pcb->baseconfig())->get_config_fct(AESCART_FCT_ASSM); |
| 225 | pcb_def->disassemble = (assmfct *)downcast<const legacy_cart_slot_device_config_base *>(&pcb->baseconfig())->get_config_fct(AESCART_FCT_DISASSM); |
| 226 | 226 | |
| 227 | 227 | pcb_def->cartridge = &cartslots->cartridge[index]; |
| 228 | 228 | pcb_def->cartridge->pcb = pcb; |
| r8365 | r8366 | |
| 714 | 714 | } |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | | DEFINE_LEGACY_DEVICE(AES_MULTICART, aes_multicart); |
| 717 | DEFINE_LEGACY_CART_SLOT_DEVICE(AES_MULTICART, aes_multicart); |
| 718 | 718 | DEFINE_LEGACY_DEVICE(AES_CARTRIDGE_PCB_NONE, aes_cartridge_pcb_none); |
| 719 | 719 | DEFINE_LEGACY_DEVICE(AES_CARTRIDGE_PCB_STD, aes_cartridge_pcb_std); |
src/mess/devices/cococart.c
| r8365 | r8366 | |
| 98 | 98 | throw device_missing_dependencies(); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | | cococart->pcb_r = (read8_device_func) downcast<legacy_device_base *>(cococart->pcb)->get_config_fct(COCOCARTINFO_FCT_FF40_R); |
| 102 | | cococart->pcb_w = (write8_device_func) downcast<legacy_device_base *>(cococart->pcb)->get_config_fct(COCOCARTINFO_FCT_FF40_W); |
| 101 | cococart->pcb_r = (read8_device_func)downcast<const legacy_cart_slot_device_config_base *>(&cococart->pcb->baseconfig())->get_config_fct(COCOCARTINFO_FCT_FF40_R); |
| 102 | cococart->pcb_w = (write8_device_func)downcast<const legacy_cart_slot_device_config_base *>(&cococart->pcb->baseconfig())->get_config_fct(COCOCARTINFO_FCT_FF40_W); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /* finish setup */ |
| r8365 | r8366 | |
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | | DEFINE_LEGACY_DEVICE(COCO_CARTRIDGE, coco_cartridge); |
| 408 | | DEFINE_LEGACY_DEVICE(DRAGON_CARTRIDGE, dragon_cartridge); |
| 407 | DEFINE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE, coco_cartridge); |
| 408 | DEFINE_LEGACY_CART_SLOT_DEVICE(DRAGON_CARTRIDGE, dragon_cartridge); |