Previous 15994 Revisions Next

r8366 Thursday 1st July, 2010 at 14:51:09 UTC by Miodrag Milanović
Removed need for some changes in devlegcy.h
[src/emu]devlegcy.h
[src/mess/devices]aescart.c aescart.h cartslot.c cartslot.h coco_fdc.c cococart.c cococart.h ti99cart.c ti99cart.h

src/emu/devlegcy.h
r8365r8366
468468public:
469469   // access to legacy token
470470   void *token() const { return m_token; }
471   
472   INT64 get_config_int(UINT32 state) const { return m_config.get_legacy_config_int(state); }
473   genf *get_config_fct(UINT32 state) const { return m_config.get_legacy_config_fct(state); }
474   void *get_config_ptr(UINT32 state) const { return m_config.get_legacy_config_ptr(state); }
475471protected:
476472   // device-level overrides
477473   virtual void device_start();
src/mess/devices/cococart.h
r8365r8366
1010#define __COCOCART_H__
1111
1212#include "image.h"
13#include "cartslot.h"
1314
14
1515/***************************************************************************
1616    CONSTANTS
1717***************************************************************************/
1818
19DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE, coco_cartridge);
20DECLARE_LEGACY_DEVICE(DRAGON_CARTRIDGE, dragon_cartridge);
19DECLARE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE, coco_cartridge);
20DECLARE_LEGACY_CART_SLOT_DEVICE(DRAGON_CARTRIDGE, dragon_cartridge);
2121
22DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_FDC_COCO, coco_cartridge_pcb_fdc_coco);
23DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_FDC_DRAGON, coco_cartridge_pcb_fdc_dragon);
22DECLARE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE_PCB_FDC_COCO, coco_cartridge_pcb_fdc_coco);
23DECLARE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE_PCB_FDC_DRAGON, coco_cartridge_pcb_fdc_dragon);
2424DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_PAK, coco_cartridge_pcb_pak);
2525DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_PAK_BANKED16K, coco_cartridge_pcb_pak_banked16k);
2626DECLARE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_ORCH90, coco_cartridge_pcb_orch90);
src/mess/devices/ti99cart.c
r8365r8366
578578   ti99_multicart_state *cartslots = (ti99_multicart_state *)downcast<legacy_device_base *>(cartsys)->token();
579579   ti99_pcb_t *pcb_def = (ti99_pcb_t *)downcast<legacy_device_base *>(pcb)->token();
580580
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);
587587
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);
590590
591591   pcb_def->cartridge = &cartslots->cartridge[index];
592592   pcb_def->cartridge->pcb = pcb;
r8365r8366
34423442#define DEVTEMPLATE_FAMILY              "Multi-cartridge system"
34433443#include "devtempl.h"
34443444
3445DEFINE_LEGACY_DEVICE(TI99_MULTICART, ti99_multicart);
3445DEFINE_LEGACY_CART_SLOT_DEVICE(TI99_MULTICART, ti99_multicart);
src/mess/devices/ti99cart.h
r8365r8366
99#ifndef __TI99CART_H__
1010#define __TI99CART_H__
1111
12DECLARE_LEGACY_DEVICE(TI99_MULTICART, ti99_multicart);
12#include "cartslot.h"
1313
14DECLARE_LEGACY_CART_SLOT_DEVICE(TI99_MULTICART, ti99_multicart);
15
1416/* We set the number of slots to 8, although we may have up to 16. From a
1517   logical point of view we could have 256, but the operating system only checks
1618   the first 16 banks. */
src/mess/devices/cartslot.c
r8365r8366
488488}
489489
490490DEFINE_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
501device_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
511device_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
525device_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
536device_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
548legacy_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
563legacy_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
r8365r8366
228228static DEVICE_START(fdc)
229229{
230230   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);   
232232
233233   /* initialize variables */
234234   memset(fdc, 0, sizeof(*fdc));
r8365r8366
650650}
651651
652652
653DEFINE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_FDC_COCO, coco_cartridge_pcb_fdc_coco);
654DEFINE_LEGACY_DEVICE(COCO_CARTRIDGE_PCB_FDC_DRAGON, coco_cartridge_pcb_fdc_dragon);
653DEFINE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE_PCB_FDC_COCO, coco_cartridge_pcb_fdc_coco);
654DEFINE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE_PCB_FDC_DRAGON, coco_cartridge_pcb_fdc_dragon);
src/mess/devices/cartslot.h
r8365r8366
115115#define MDRV_CARTSLOT_INTERFACE(_interface)                     \
116116   MDRV_DEVICE_CONFIG_DATAPTR(cartslot_config, interface, _interface )
117117
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)
118120
119#endif /* __CARTSLOT_H__ */
121// ======================> device_config_cart_slot_interface
122
123// class representing interface-specific configuration cart_slot
124class device_config_cart_slot_interface : public device_config_interface
125{
126public:
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
137class device_cart_slot_interface : public device_interface
138{
139public:
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; }
146protected:
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
154class legacy_cart_slot_device_config_base :    public legacy_device_config_base,
155                                 public device_config_cart_slot_interface
156{
157protected:
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);
160public:
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
171class legacy_cart_slot_device_base :   public legacy_device_base,
172                           public device_cart_slot_interface
173{
174protected:
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
r8365r8366
221221   aes_multicart_t *cartslots = (aes_multicart_t *)downcast<legacy_device_base *>(cartsys)->token();
222222   aes_pcb_t *pcb_def = (aes_pcb_t *)downcast<legacy_device_base *>(pcb)->token();
223223
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);
226226
227227   pcb_def->cartridge = &cartslots->cartridge[index];
228228   pcb_def->cartridge->pcb = pcb;
r8365r8366
714714   }
715715}
716716
717DEFINE_LEGACY_DEVICE(AES_MULTICART, aes_multicart);
717DEFINE_LEGACY_CART_SLOT_DEVICE(AES_MULTICART, aes_multicart);
718718DEFINE_LEGACY_DEVICE(AES_CARTRIDGE_PCB_NONE, aes_cartridge_pcb_none);
719719DEFINE_LEGACY_DEVICE(AES_CARTRIDGE_PCB_STD, aes_cartridge_pcb_std);
src/mess/devices/aescart.h
r8365r8366
1010#define __AESCART_H__
1111
1212#include "image.h"
13#include "cartslot.h"
1314
14DECLARE_LEGACY_DEVICE(AES_MULTICART, aes_multicart);
15DECLARE_LEGACY_CART_SLOT_DEVICE(AES_MULTICART, aes_multicart);
1516DECLARE_LEGACY_DEVICE(AES_CARTRIDGE_PCB_NONE, aes_cartridge_pcb_none);
1617DECLARE_LEGACY_DEVICE(AES_CARTRIDGE_PCB_STD, aes_cartridge_pcb_std);
1718
src/mess/devices/cococart.c
r8365r8366
9898         throw device_missing_dependencies();
9999      }
100100
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);
103103   }
104104
105105   /* finish setup */
r8365r8366
404404   }
405405}
406406
407DEFINE_LEGACY_DEVICE(COCO_CARTRIDGE, coco_cartridge);
408DEFINE_LEGACY_DEVICE(DRAGON_CARTRIDGE, dragon_cartridge);
407DEFINE_LEGACY_CART_SLOT_DEVICE(COCO_CARTRIDGE, coco_cartridge);
408DEFINE_LEGACY_CART_SLOT_DEVICE(DRAGON_CARTRIDGE, dragon_cartridge);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team