Previous 15994 Revisions Next

r14330 Friday 3rd February, 2012 at 13:32:25 UTC by Miodrag Milanović
Sync with MAME r15274 (nw)
[src/emu]devlegcy.c devlegcy.h devtempl.h

src/emu/devtempl.h
r14329r14330
5454#define DT_HAS_RESET         0x0002
5555#define DT_HAS_STOP            0x0004
5656#define DT_HAS_EXECUTE         0x0008
57#define DT_HAS_NVRAM         0x0010
5857#define DT_HAS_CUSTOM_CONFIG   0x0040
5958#define DT_HAS_ROM_REGION      0x0080
6059#define DT_HAS_MACHINE_CONFIG   0x0100
r14329r14330
123122#if ((DEVTEMPLATE_FEATURES) & DT_HAS_EXECUTE)
124123static DEVICE_EXECUTE( DEVTEMPLATE_ID(,) );
125124#endif
126#if ((DEVTEMPLATE_FEATURES) & DT_HAS_NVRAM)
127static DEVICE_NVRAM( DEVTEMPLATE_ID(,) );
128#endif
129125#if ((DEVTEMPLATE_FEATURES) & DT_HAS_CUSTOM_CONFIG)
130126static DEVICE_CUSTOM_CONFIG( DEVTEMPLATE_ID(,) );
131127#endif
r14329r14330
211207#if ((DEVTEMPLATE_FEATURES) & DT_HAS_EXECUTE)
212208      case DEVINFO_FCT_EXECUTE:            info->execute = DEVTEMPLATE_ID1(DEVICE_EXECUTE_NAME());             break;
213209#endif
214#if ((DEVTEMPLATE_FEATURES) & DT_HAS_NVRAM)
215      case DEVINFO_FCT_NVRAM:               info->nvram = DEVTEMPLATE_ID1(DEVICE_NVRAM_NAME());                break;
216#endif
217
218210      /* --- the following bits of info are returned as NULL-terminated strings --- */
219211      case DEVINFO_STR_NAME:               strcpy(info->s, DEVTEMPLATE_NAME);                        break;
220212#ifdef DEVTEMPLATE_SHORTNAME
r14329r14330
240232#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_EXECUTE)
241233static DEVICE_EXECUTE( DEVTEMPLATE_DERIVED_ID(,) );
242234#endif
243#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_NVRAM)
244static DEVICE_NVRAM( DEVTEMPLATE_DERIVED_ID(,) );
245#endif
246235#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_CUSTOM_CONFIG)
247236static DEVICE_CUSTOM_CONFIG( DEVTEMPLATE_DERIVED_ID(,) );
248237#endif
r14329r14330
296285#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_EXECUTE)
297286      case DEVINFO_FCT_EXECUTE:            info->execute = DEVTEMPLATE_DERIVED_ID1(DEVICE_EXECUTE_NAME());             break;
298287#endif
299#if ((DEVTEMPLATE_DERIVED_FEATURES) & DT_HAS_NVRAM)
300      case DEVINFO_FCT_NVRAM:               info->nvram = DEVTEMPLATE_DERIVED_ID1(DEVICE_NVRAM_NAME());                break;
301#endif
302288
303289      /* --- the following bits of info are returned as NULL-terminated strings --- */
304290      case DEVINFO_STR_NAME:               strcpy(info->s, DEVTEMPLATE_DERIVED_NAME);                        break;
r14329r14330
313299#undef DT_HAS_RESET
314300#undef DT_HAS_STOP
315301#undef DT_HAS_EXECUTE
316#undef DT_HAS_NVRAM
317302#undef DT_HAS_CUSTOM_CONFIG
318303#undef DT_HAS_ROM_REGION
319304#undef DT_HAS_MACHINE_CONFIG
src/emu/devlegcy.c
r14329r14330
271271   // should never get here
272272   fatalerror("legacy_sound_device_base::sound_stream_update called; not applicable to legacy sound devices\n");
273273}
274
275
276
277//**************************************************************************
278//  LEGACY MEMORY DEVICE
279//**************************************************************************
280
281//-------------------------------------------------
282//  legacy_memory_device_base - constructor
283//-------------------------------------------------
284
285legacy_memory_device_base::legacy_memory_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config)
286   : legacy_device_base(mconfig, type, tag, owner, clock, get_config),
287     device_memory_interface(mconfig, *this)
288{
289   memset(&m_space_config, 0, sizeof(m_space_config));
290}
291
292
293//-------------------------------------------------
294//  device_config_complete - update configuration
295//  based on completed device setup
296//-------------------------------------------------
297
298void legacy_memory_device_base::device_config_complete()
299{
300   m_space_config.m_name = "memory";
301   m_space_config.m_endianness = static_cast<endianness_t>(get_legacy_int(DEVINFO_INT_ENDIANNESS));
302   m_space_config.m_databus_width = get_legacy_int(DEVINFO_INT_DATABUS_WIDTH);
303   m_space_config.m_addrbus_width = get_legacy_int(DEVINFO_INT_ADDRBUS_WIDTH);
304   m_space_config.m_addrbus_shift = get_legacy_int(DEVINFO_INT_ADDRBUS_SHIFT);
305   m_space_config.m_logaddr_width = m_space_config.m_addrbus_width;
306   m_space_config.m_page_shift = 0;
307   m_space_config.m_internal_map = reinterpret_cast<address_map_constructor>(get_legacy_fct(DEVINFO_PTR_INTERNAL_MEMORY_MAP));
308   m_space_config.m_default_map = reinterpret_cast<address_map_constructor>(get_legacy_fct(DEVINFO_PTR_DEFAULT_MEMORY_MAP));
309}
310
311
312
313//**************************************************************************
314//  LEGACY NVRAM DEVICE
315//**************************************************************************
316
317//-------------------------------------------------
318//  legacy_nvram_device_base - constructor
319//-------------------------------------------------
320
321legacy_nvram_device_base::legacy_nvram_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config)
322   : legacy_device_base(mconfig, type, tag, owner, clock, get_config),
323     device_nvram_interface(mconfig, *this)
324{
325}
326
327
328//-------------------------------------------------
329//  nvram_default - generate the default NVRAM
330//-------------------------------------------------
331
332void legacy_nvram_device_base::nvram_default()
333{
334   device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(get_legacy_fct(DEVINFO_FCT_NVRAM));
335   (*nvram_func)(this, NULL, FALSE);
336}
337
338
339//-------------------------------------------------
340//  nvram_read - read NVRAM from the given file
341//-------------------------------------------------
342
343void legacy_nvram_device_base::nvram_read(emu_file &file)
344{
345   device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(get_legacy_fct(DEVINFO_FCT_NVRAM));
346   (*nvram_func)(this, &file, FALSE);
347}
348
349
350//-------------------------------------------------
351//  nvram_write - write NVRAM to the given file
352//-------------------------------------------------
353
354void legacy_nvram_device_base::nvram_write(emu_file &file)
355{
356   device_nvram_func nvram_func = reinterpret_cast<device_nvram_func>(get_legacy_fct(DEVINFO_FCT_NVRAM));
357   (*nvram_func)(this, &file, TRUE);
358}
src/emu/devlegcy.h
r14329r14330
215215// reduced macros that are easier to use, and map to the above two macros
216216#define DECLARE_LEGACY_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_device_base)
217217#define DECLARE_LEGACY_SOUND_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_sound_device_base)
218#define DECLARE_LEGACY_MEMORY_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_memory_device_base)
219#define DECLARE_LEGACY_NVRAM_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_nvram_device_base)
220218#define DECLARE_LEGACY_IMAGE_DEVICE(name, basename) _DECLARE_LEGACY_DEVICE(name, basename, basename##_device, legacy_image_device_base)
221219
222220#define DEFINE_LEGACY_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_device_base)
223221#define DEFINE_LEGACY_SOUND_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_sound_device_base)
224#define DEFINE_LEGACY_MEMORY_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_memory_device_base)
225#define DEFINE_LEGACY_NVRAM_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_nvram_device_base)
226222#define DEFINE_LEGACY_IMAGE_DEVICE(name, basename) _DEFINE_LEGACY_DEVICE(name, basename, basename##_device, legacy_image_device_base)
227223
228224
r14329r14330
251247#define DEVICE_EXECUTE(name)      INT32 DEVICE_EXECUTE_NAME(name)(device_t *device, INT32 clocks)
252248#define DEVICE_EXECUTE_CALL(name)   DEVICE_EXECUTE_NAME(name)(device, clocks)
253249
254#define DEVICE_NVRAM_NAME(name)      device_nvram_##name
255#define DEVICE_NVRAM(name)         void DEVICE_NVRAM_NAME(name)(device_t *device, emu_file *file, int read_or_write)
256#define DEVICE_NVRAM_CALL(name)      DEVICE_NVRAM_NAME(name)(device, file, read_or_write)
257250
258
259
260251//**************************************************************************
261252//  DEVICE_CONFIGURATION_MACROS
262253//**************************************************************************
r14329r14330
466457
467458
468459
469// ======================> legacy_memory_device_base
470
471// legacy_memory_device is a legacy_device_base with a memory interface
472class legacy_memory_device_base :   public legacy_device_base,
473                           public device_memory_interface
474{
475protected:
476   // construction/destruction
477   legacy_memory_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config);
478
479   // device overrides
480   virtual void device_config_complete();
481
482   // device_memory_interface overrides
483   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == 0) ? &m_space_config : NULL; }
484
485   // internal state
486   address_space_config m_space_config;
487};
488
489
490
491// ======================> legacy_nvram_device
492
493// legacy_nvram_device is a legacy_device_base with a nvram interface
494class legacy_nvram_device_base :   public legacy_device_base,
495                           public device_nvram_interface
496{
497protected:
498   // construction/destruction
499   legacy_nvram_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, device_get_config_func get_config);
500
501   // device_nvram_interface overrides
502   virtual void nvram_default();
503   virtual void nvram_read(emu_file &file);
504   virtual void nvram_write(emu_file &file);
505};
506
507
508
509460// ======================> legacy_image_device
510461
511462// legacy_image_device is a legacy_device_base with a image interface

Previous 15994 Revisions Next


© 1998-2018 The MESS Team