diff options
author | 2017-05-07 23:18:47 +1000 | |
---|---|---|
committer | 2017-05-14 21:44:11 +1000 | |
commit | 0f0d39ef81562c75e79176dd3bebb1e491ca39d5 (patch) | |
tree | 201cee7fdf55ee800f83859a92efd2cfe66cf2b3 /src/devices/cpu/tlcs90 | |
parent | e6c4be2b4d71c7a6c95be0bae111eb416ff0f9e7 (diff) |
Move static data out of devices into the device types. This is a significant change, so please pay attention.
The core changes are:
* Short name, full name and source file are no longer members of device_t, they are part of the device type
* MACHINE_COFIG_START no longer needs a driver class
* MACHINE_CONFIG_DERIVED_CLASS is no longer necessary
* Specify the state class you want in the GAME/COMP/CONS line
* The compiler will work out the base class where the driver init member is declared
* There is one static device type object per driver rather than one per machine configuration
Use DECLARE_DEVICE_TYPE or DECLARE_DEVICE_TYPE_NS to declare device type.
* DECLARE_DEVICE_TYPE forward-declares teh device type and class, and declares extern object finders.
* DECLARE_DEVICE_TYPE_NS is for devices classes in namespaces - it doesn't forward-declare the device type.
Use DEFINE_DEVICE_TYPE or DEFINE_DEVICE_TYPE_NS to define device types.
* These macros declare storage for the static data, and instantiate the device type and device finder templates.
The rest of the changes are mostly just moving stuff out of headers that shouldn't be there, renaming stuff for consistency, and scoping stuff down where appropriate.
Things I've actually messed with substantially:
* More descriptive names for a lot of devices
* Untangled the fantasy sound from the driver state, which necessitates breaking up sound/flip writes
* Changed DECO BSMT2000 ready callback into a device delegate
* Untangled Microprose 3D noise from driver state
* Used object finders for CoCo multipak, KC85 D002, and Irem sound subdevices
* Started to get TI-99 stuff out of the TI-990 directory and arrange bus devices properly
* Started to break out common parts of Samsung ARM SoC devices
* Turned some of FM, SID, SCSP DSP, EPIC12 and Voodoo cores into something resmbling C++
* Tried to make Z180 table allocation/setup a bit safer
* Converted generic keyboard/terminal to not use WRITE8 - space/offset aren't relevant
* Dynamically allocate generic terminal buffer so derived devices (e.g. teleprinter) can specify size
* Imporved encapsulation of Z80DART channels
* Refactored the SPC7110 bit table generator loop to make it more readable
* Added wrappers for SNES PPU operations so members can be made protected
* Factored out some boilerplate for YM chips with PSG
* toaplan2 gfx
* stic/intv resolution
* Video System video
* Out Run/Y-board sprite alignment
* GIC video hookup
* Amstrad CPC ROM box members
* IQ151 ROM cart region
* MSX cart IRQ callback resolution time
* SMS passthrough control devices starting subslots
I've smoke-tested several drivers, but I've probably missed something. Things I've missed will likely blow up spectacularly with failure to bind errors and the like. Let me know if there's more subtle breakage (could have happened in FM or Voodoo).
And can everyone please, please try to keep stuff clean. In particular, please stop polluting the global namespace. Keep things out of headers that don't need to be there, and use things that can be scoped down rather than macros.
It feels like an uphill battle trying to get this stuff under control while more of it's added.
Diffstat (limited to 'src/devices/cpu/tlcs90')
-rw-r--r-- | src/devices/cpu/tlcs90/tlcs90.cpp | 28 | ||||
-rw-r--r-- | src/devices/cpu/tlcs90/tlcs90.h | 26 |
2 files changed, 27 insertions, 27 deletions
diff --git a/src/devices/cpu/tlcs90/tlcs90.cpp b/src/devices/cpu/tlcs90/tlcs90.cpp index fa66e90025c..0fbbeaa2eb9 100644 --- a/src/devices/cpu/tlcs90/tlcs90.cpp +++ b/src/devices/cpu/tlcs90/tlcs90.cpp @@ -21,12 +21,12 @@ static const char *const op_names[] = { "??", "nop", "ex", "exx", ALLOW_SAVE_TYPE(tlcs90_device::e_mode); // allow save_item on a non-fundamental type -const device_type TMP90840 = device_creator<tmp90840_device>; -const device_type TMP90841 = device_creator<tmp90841_device>; -const device_type TMP90845 = device_creator<tmp90845_device>; -const device_type TMP91640 = device_creator<tmp91640_device>; -const device_type TMP91641 = device_creator<tmp91641_device>; -const device_type TMP90PH44 = device_creator<tmp90ph44_device>; +DEFINE_DEVICE_TYPE(TMP90840, tmp90840_device, "tmp90840", "TMP90840") +DEFINE_DEVICE_TYPE(TMP90841, tmp90841_device, "tmp90841", "TMP90841") +DEFINE_DEVICE_TYPE(TMP90845, tmp90845_device, "tmp90845", "TMP90845") +DEFINE_DEVICE_TYPE(TMP91640, tmp91640_device, "tmp91640", "TMP91640") +DEFINE_DEVICE_TYPE(TMP91641, tmp91641_device, "tmp91641", "TMP91641") +DEFINE_DEVICE_TYPE(TMP90PH44, tmp90ph44_device, "tmp90ph44", "TMP90PH44") static ADDRESS_MAP_START(tmp90840_mem, AS_PROGRAM, 8, tlcs90_device) @@ -60,8 +60,8 @@ static ADDRESS_MAP_START(tmp90ph44_mem, AS_PROGRAM, 8, tlcs90_device ) ADDRESS_MAP_END -tlcs90_device::tlcs90_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source, address_map_constructor program_map) - : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) +tlcs90_device::tlcs90_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor program_map) + : cpu_device(mconfig, type, tag, owner, clock) , m_program_config("program", ENDIANNESS_LITTLE, 8, 20, 0, program_map) , m_io_config("io", ENDIANNESS_LITTLE, 8, 16, 0) { @@ -69,36 +69,36 @@ tlcs90_device::tlcs90_device(const machine_config &mconfig, device_type type, co tmp90840_device::tmp90840_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : tlcs90_device(mconfig, TMP90840, "TMP90840", tag, owner, clock, "tmp90840", __FILE__, ADDRESS_MAP_NAME(tmp90840_mem)) + : tlcs90_device(mconfig, TMP90840, tag, owner, clock, ADDRESS_MAP_NAME(tmp90840_mem)) { } tmp90841_device::tmp90841_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : tlcs90_device(mconfig, TMP90841, "TMP90841", tag, owner, clock, "tmp90841", __FILE__, ADDRESS_MAP_NAME(tmp90841_mem)) + : tlcs90_device(mconfig, TMP90841, tag, owner, clock, ADDRESS_MAP_NAME(tmp90841_mem)) { } tmp90845_device::tmp90845_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : tlcs90_device(mconfig, TMP90845, "TMP90845", tag, owner, clock, "tmp90845", __FILE__, ADDRESS_MAP_NAME(tmp90841_mem)) + : tlcs90_device(mconfig, TMP90845, tag, owner, clock, ADDRESS_MAP_NAME(tmp90841_mem)) { } tmp91640_device::tmp91640_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : tlcs90_device(mconfig, TMP91640, "TMP91640", tag, owner, clock, "tmp91640", __FILE__, ADDRESS_MAP_NAME(tmp91640_mem)) + : tlcs90_device(mconfig, TMP91640, tag, owner, clock, ADDRESS_MAP_NAME(tmp91640_mem)) { } tmp91641_device::tmp91641_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : tlcs90_device(mconfig, TMP91641, "TMP91641", tag, owner, clock, "tmp91641", __FILE__, ADDRESS_MAP_NAME(tmp91641_mem)) + : tlcs90_device(mconfig, TMP91641, tag, owner, clock, ADDRESS_MAP_NAME(tmp91641_mem)) { } tmp90ph44_device::tmp90ph44_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : tlcs90_device(mconfig, TMP90PH44, "TMP90PH44", tag, owner, clock, "tmp90ph44", __FILE__, ADDRESS_MAP_NAME(tmp90ph44_mem)) + : tlcs90_device(mconfig, TMP90PH44, tag, owner, clock, ADDRESS_MAP_NAME(tmp90ph44_mem)) { } diff --git a/src/devices/cpu/tlcs90/tlcs90.h b/src/devices/cpu/tlcs90/tlcs90.h index 286ea9ee305..9131e60003c 100644 --- a/src/devices/cpu/tlcs90/tlcs90.h +++ b/src/devices/cpu/tlcs90/tlcs90.h @@ -1,9 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Luca Elia -#pragma once +#ifndef MAME_CPU_TLCS90_TLCS90_H +#define MAME_CPU_TLCS90_TLCS90_H -#ifndef __TLCS90_H__ -#define __TLCS90_H__ +#pragma once #define T90_IOBASE 0xffc0 @@ -24,9 +24,6 @@ DECLARE_ENUM_OPERATORS(tlcs90_e_irq) class tlcs90_device : public cpu_device { public: - // construction/destruction - tlcs90_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source, address_map_constructor program_map); - DECLARE_READ8_MEMBER( t90_internal_registers_r ); DECLARE_WRITE8_MEMBER( t90_internal_registers_w ); @@ -36,6 +33,9 @@ public: protected: enum _e_op { UNKNOWN, NOP, EX, EXX, LD, LDW, LDA, LDI, LDIR, LDD, LDDR, CPI, CPIR, CPD, CPDR, PUSH, POP, JP, JR, CALL, CALLR, RET, RETI, HALT, DI, EI, SWI, DAA, CPL, NEG, LDAR, RCF, SCF, CCF, TSET, BIT, SET, RES, INC, DEC, INCX, DECX, INCW, DECW, ADD, ADC, SUB, SBC, AND, XOR, OR, CP, RLC, RRC, RL, RR, SLA, SRA, SLL, SRL, RLD, RRD, DJNZ, MUL, DIV }; + // construction/destruction + tlcs90_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor program_map); + // device-level overrides virtual void device_start() override; virtual void device_reset() override; @@ -191,11 +191,11 @@ public: }; -extern const device_type TMP90840; -extern const device_type TMP90841; -extern const device_type TMP90845; -extern const device_type TMP91640; -extern const device_type TMP91641; -extern const device_type TMP90PH44; +DECLARE_DEVICE_TYPE(TMP90840, tmp90840_device) +DECLARE_DEVICE_TYPE(TMP90841, tmp90841_device) +DECLARE_DEVICE_TYPE(TMP90845, tmp90845_device) +DECLARE_DEVICE_TYPE(TMP91640, tmp91640_device) +DECLARE_DEVICE_TYPE(TMP91641, tmp91641_device) +DECLARE_DEVICE_TYPE(TMP90PH44, tmp90ph44_device) -#endif /* __TLCS90_H__ */ +#endif // MAME_CPU_TLCS90_TLCS90_H |