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/bus/sg1000_exp | |
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/bus/sg1000_exp')
-rw-r--r-- | src/devices/bus/sg1000_exp/fm_unit.cpp | 4 | ||||
-rw-r--r-- | src/devices/bus/sg1000_exp/fm_unit.h | 11 | ||||
-rw-r--r-- | src/devices/bus/sg1000_exp/sg1000exp.cpp | 8 | ||||
-rw-r--r-- | src/devices/bus/sg1000_exp/sg1000exp.h | 24 | ||||
-rw-r--r-- | src/devices/bus/sg1000_exp/sk1100.cpp | 4 | ||||
-rw-r--r-- | src/devices/bus/sg1000_exp/sk1100.h | 10 |
6 files changed, 31 insertions, 30 deletions
diff --git a/src/devices/bus/sg1000_exp/fm_unit.cpp b/src/devices/bus/sg1000_exp/fm_unit.cpp index d4798944d58..d305fd281ca 100644 --- a/src/devices/bus/sg1000_exp/fm_unit.cpp +++ b/src/devices/bus/sg1000_exp/fm_unit.cpp @@ -47,7 +47,7 @@ SMS version is not playing PSG sound on his Mark III with the FM unit. // DEVICE DEFINITIONS //************************************************************************** -const device_type SEGA_FM_UNIT = device_creator<sega_fm_unit_device>; +DEFINE_DEVICE_TYPE(SEGA_FM_UNIT, sega_fm_unit_device, "sega_fm_unit", "SG-1000 FM Sound Unit") static MACHINE_CONFIG_FRAGMENT( fm_config ) @@ -74,7 +74,7 @@ machine_config_constructor sega_fm_unit_device::device_mconfig_additions() const //------------------------------------------------- sega_fm_unit_device::sega_fm_unit_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, SEGA_FM_UNIT, "Sega FM Sound Unit", tag, owner, clock, "sega_fm_unit", __FILE__), + device_t(mconfig, SEGA_FM_UNIT, tag, owner, clock), device_sg1000_expansion_slot_interface(mconfig, *this), m_ym(*this, "ym2413"), m_psg(*this, ":segapsg"), diff --git a/src/devices/bus/sg1000_exp/fm_unit.h b/src/devices/bus/sg1000_exp/fm_unit.h index 17dadf0d142..4206462da87 100644 --- a/src/devices/bus/sg1000_exp/fm_unit.h +++ b/src/devices/bus/sg1000_exp/fm_unit.h @@ -6,10 +6,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_SG1000_EXP_FM_UNIT_H +#define MAME_BUS_SG1000_EXP_FM_UNIT_H -#ifndef __SEGA_FM_UNIT__ -#define __SEGA_FM_UNIT__ +#pragma once #include "sound/ym2413.h" @@ -52,7 +52,6 @@ private: // device type definition -extern const device_type SEGA_FM_UNIT; - +DECLARE_DEVICE_TYPE(SEGA_FM_UNIT, sega_fm_unit_device) -#endif +#endif // MAME_BUS_SG1000_EXP_FM_UNIT_H diff --git a/src/devices/bus/sg1000_exp/sg1000exp.cpp b/src/devices/bus/sg1000_exp/sg1000exp.cpp index d926a4b7a3a..8c8bc53f6a4 100644 --- a/src/devices/bus/sg1000_exp/sg1000exp.cpp +++ b/src/devices/bus/sg1000_exp/sg1000exp.cpp @@ -8,6 +8,7 @@ #include "emu.h" #include "sg1000exp.h" + // slot devices #include "sk1100.h" #include "fm_unit.h" @@ -18,7 +19,7 @@ // GLOBAL VARIABLES //************************************************************************** -const device_type SG1000_EXPANSION_SLOT = device_creator<sg1000_expansion_slot_device>; +DEFINE_DEVICE_TYPE(SG1000_EXPANSION_SLOT, sg1000_expansion_slot_device, "sg1000_expansion_slot", "Sega SG-1000 expansion slot") @@ -55,8 +56,9 @@ device_sg1000_expansion_slot_interface::~device_sg1000_expansion_slot_interface( //------------------------------------------------- sg1000_expansion_slot_device::sg1000_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, SG1000_EXPANSION_SLOT, "Sega SG-1000 expansion slot", tag, owner, clock, "sg1000_expansion_slot", __FILE__), - device_slot_interface(mconfig, *this), m_device(nullptr) + device_t(mconfig, SG1000_EXPANSION_SLOT, tag, owner, clock), + device_slot_interface(mconfig, *this), + m_device(nullptr) { } diff --git a/src/devices/bus/sg1000_exp/sg1000exp.h b/src/devices/bus/sg1000_exp/sg1000exp.h index 328f12e269c..ce8ae982980 100644 --- a/src/devices/bus/sg1000_exp/sg1000exp.h +++ b/src/devices/bus/sg1000_exp/sg1000exp.h @@ -9,10 +9,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_SG1000_EXP_SG1000EXP_H +#define MAME_BUS_SG1000_EXP_SG1000EXP_H -#ifndef __SG1000_EXPANSION_SLOT__ -#define __SG1000_EXPANSION_SLOT__ +#pragma once @@ -37,8 +37,7 @@ class device_sg1000_expansion_slot_interface; -class sg1000_expansion_slot_device : public device_t, - public device_slot_interface +class sg1000_expansion_slot_device : public device_t, public device_slot_interface { public: // construction/destruction @@ -66,25 +65,26 @@ class device_sg1000_expansion_slot_interface : public device_slot_card_interface { public: // construction/destruction - device_sg1000_expansion_slot_interface(const machine_config &mconfig, device_t &device); virtual ~device_sg1000_expansion_slot_interface(); - virtual DECLARE_READ8_MEMBER(peripheral_r) { return 0xff; }; - virtual DECLARE_WRITE8_MEMBER(peripheral_w) { }; + virtual DECLARE_READ8_MEMBER(peripheral_r) { return 0xff; } + virtual DECLARE_WRITE8_MEMBER(peripheral_w) { } - virtual bool is_readable(uint8_t offset) { return true; }; - virtual bool is_writeable(uint8_t offset) { return true; }; + virtual bool is_readable(uint8_t offset) { return true; } + virtual bool is_writeable(uint8_t offset) { return true; } protected: + device_sg1000_expansion_slot_interface(const machine_config &mconfig, device_t &device); + sg1000_expansion_slot_device *m_port; }; // device type definition -extern const device_type SG1000_EXPANSION_SLOT; +DECLARE_DEVICE_TYPE(SG1000_EXPANSION_SLOT, sg1000_expansion_slot_device) SLOT_INTERFACE_EXTERN( sg1000_expansion_devices ); -#endif +#endif // MAME_BUS_SG1000_EXP_SG1000EXP_H diff --git a/src/devices/bus/sg1000_exp/sk1100.cpp b/src/devices/bus/sg1000_exp/sk1100.cpp index 10df8f00ee1..3ae5a6ac7c1 100644 --- a/src/devices/bus/sg1000_exp/sk1100.cpp +++ b/src/devices/bus/sg1000_exp/sk1100.cpp @@ -27,7 +27,7 @@ TODO: // DEVICE DEFINITIONS //************************************************************************** -const device_type SEGA_SK1100 = device_creator<sega_sk1100_device>; +DEFINE_DEVICE_TYPE(SEGA_SK1100, sega_sk1100_device, "sega_sk1100", "Sega SK-1100 Keyboard") /*------------------------------------------------- @@ -188,7 +188,7 @@ machine_config_constructor sega_sk1100_device::device_mconfig_additions() const //------------------------------------------------- sega_sk1100_device::sega_sk1100_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, SEGA_SK1100, "Sega SK-1100 Keyboard", tag, owner, clock, "sega_sk1100", __FILE__), + device_t(mconfig, SEGA_SK1100, tag, owner, clock), device_sg1000_expansion_slot_interface(mconfig, *this), m_cassette(*this, "cassette"), m_ppi(*this, UPD9255_0_TAG), diff --git a/src/devices/bus/sg1000_exp/sk1100.h b/src/devices/bus/sg1000_exp/sk1100.h index 29aa91c3074..1679e5aea27 100644 --- a/src/devices/bus/sg1000_exp/sk1100.h +++ b/src/devices/bus/sg1000_exp/sk1100.h @@ -6,10 +6,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_SG1000_EXP_SK1100_H +#define MAME_BUS_SG1000_EXP_SK1100_H -#ifndef __SEGA_SK1100__ -#define __SEGA_SK1100__ +#pragma once #include "sg1000exp.h" @@ -64,7 +64,7 @@ private: // device type definition -extern const device_type SEGA_SK1100; +DECLARE_DEVICE_TYPE(SEGA_SK1100, sega_sk1100_device) -#endif +#endif // MAME_BUS_SG1000_EXP_SK1100_H |