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/pofo | |
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/pofo')
-rw-r--r-- | src/devices/bus/pofo/ccm.cpp | 16 | ||||
-rw-r--r-- | src/devices/bus/pofo/ccm.h | 33 | ||||
-rw-r--r-- | src/devices/bus/pofo/exp.cpp | 22 | ||||
-rw-r--r-- | src/devices/bus/pofo/exp.h | 48 | ||||
-rw-r--r-- | src/devices/bus/pofo/hpc101.cpp | 18 | ||||
-rw-r--r-- | src/devices/bus/pofo/hpc101.h | 19 | ||||
-rw-r--r-- | src/devices/bus/pofo/hpc102.cpp | 20 | ||||
-rw-r--r-- | src/devices/bus/pofo/hpc102.h | 23 | ||||
-rw-r--r-- | src/devices/bus/pofo/hpc104.cpp | 48 | ||||
-rw-r--r-- | src/devices/bus/pofo/hpc104.h | 33 | ||||
-rw-r--r-- | src/devices/bus/pofo/ram.cpp | 14 | ||||
-rw-r--r-- | src/devices/bus/pofo/ram.h | 18 | ||||
-rw-r--r-- | src/devices/bus/pofo/rom.cpp | 12 | ||||
-rw-r--r-- | src/devices/bus/pofo/rom.h | 18 |
14 files changed, 159 insertions, 183 deletions
diff --git a/src/devices/bus/pofo/ccm.cpp b/src/devices/bus/pofo/ccm.cpp index e31a1eefc97..9619be68712 100644 --- a/src/devices/bus/pofo/ccm.cpp +++ b/src/devices/bus/pofo/ccm.cpp @@ -15,7 +15,7 @@ // GLOBAL VARIABLES //************************************************************************** -const device_type PORTFOLIO_MEMORY_CARD_SLOT = device_creator<portfolio_memory_card_slot_t>; +DEFINE_DEVICE_TYPE(PORTFOLIO_MEMORY_CARD_SLOT, portfolio_memory_card_slot_device, "portfolio_ccm_slot", "Atari Portfolio memory card port") @@ -32,7 +32,7 @@ device_portfolio_memory_card_slot_interface::device_portfolio_memory_card_slot_i m_rom(*this, "rom"), m_nvram(*this, "nvram") { - m_slot = dynamic_cast<portfolio_memory_card_slot_t *>(device.owner()); + m_slot = dynamic_cast<portfolio_memory_card_slot_device *>(device.owner()); } @@ -42,11 +42,11 @@ device_portfolio_memory_card_slot_interface::device_portfolio_memory_card_slot_i //************************************************************************** //------------------------------------------------- -// portfolio_memory_card_slot_t - constructor +// portfolio_memory_card_slot_device - constructor //------------------------------------------------- -portfolio_memory_card_slot_t::portfolio_memory_card_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, PORTFOLIO_MEMORY_CARD_SLOT, "Atari Portfolio memory card port", tag, owner, clock, "portfolio_ccm_slot", __FILE__), +portfolio_memory_card_slot_device::portfolio_memory_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, PORTFOLIO_MEMORY_CARD_SLOT, tag, owner, clock), device_slot_interface(mconfig, *this), device_image_interface(mconfig, *this), m_card(nullptr) @@ -58,7 +58,7 @@ portfolio_memory_card_slot_t::portfolio_memory_card_slot_t(const machine_config // device_start - device-specific startup //------------------------------------------------- -void portfolio_memory_card_slot_t::device_start() +void portfolio_memory_card_slot_device::device_start() { m_card = dynamic_cast<device_portfolio_memory_card_slot_interface *>(get_card_device()); } @@ -68,7 +68,7 @@ void portfolio_memory_card_slot_t::device_start() // call_load - //------------------------------------------------- -image_init_result portfolio_memory_card_slot_t::call_load() +image_init_result portfolio_memory_card_slot_device::call_load() { if (m_card) { @@ -90,7 +90,7 @@ image_init_result portfolio_memory_card_slot_t::call_load() // get_default_card_software - //------------------------------------------------- -std::string portfolio_memory_card_slot_t::get_default_card_software(get_default_card_software_hook &hook) const +std::string portfolio_memory_card_slot_device::get_default_card_software(get_default_card_software_hook &hook) const { return software_get_default_slot("rom"); } diff --git a/src/devices/bus/pofo/ccm.h b/src/devices/bus/pofo/ccm.h index c960b8eed98..ac57eb143c7 100644 --- a/src/devices/bus/pofo/ccm.h +++ b/src/devices/bus/pofo/ccm.h @@ -43,10 +43,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_POFO_CCM_H +#define MAME_BUS_POFO_CCM_H -#ifndef __PORTFOLIO_MEMORY_CARD_SLOT__ -#define __PORTFOLIO_MEMORY_CARD_SLOT__ +#pragma once #include "softlist_dev.h" @@ -77,40 +77,38 @@ // ======================> device_portfolio_memory_card_slot_interface -class portfolio_memory_card_slot_t; +class portfolio_memory_card_slot_device; class device_portfolio_memory_card_slot_interface : public device_slot_card_interface { - friend class portfolio_memory_card_slot_t; + friend class portfolio_memory_card_slot_device; public: - // construction/destruction - device_portfolio_memory_card_slot_interface(const machine_config &mconfig, device_t &device); - virtual ~device_portfolio_memory_card_slot_interface() { } - virtual bool cdet() { return 1; } - virtual uint8_t nrdi_r(address_space &space, offs_t offset) { return 0xff; }; - virtual void nwri_w(address_space &space, offs_t offset, uint8_t data) { }; + virtual uint8_t nrdi_r(address_space &space, offs_t offset) { return 0xff; } + virtual void nwri_w(address_space &space, offs_t offset, uint8_t data) { } protected: + // construction/destruction + device_portfolio_memory_card_slot_interface(const machine_config &mconfig, device_t &device); + optional_shared_ptr<uint8_t> m_rom; optional_shared_ptr<uint8_t> m_nvram; - portfolio_memory_card_slot_t *m_slot; + portfolio_memory_card_slot_device *m_slot; }; -// ======================> portfolio_memory_card_slot_t +// ======================> portfolio_memory_card_slot_device -class portfolio_memory_card_slot_t : public device_t, +class portfolio_memory_card_slot_device : public device_t, public device_slot_interface, public device_image_interface { public: // construction/destruction - portfolio_memory_card_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual ~portfolio_memory_card_slot_t() { } + portfolio_memory_card_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // computer interface bool cdet_r() { return (m_card != nullptr) ? m_card->cdet() : 1; } @@ -145,10 +143,11 @@ protected: // device type definition extern const device_type PORTFOLIO_MEMORY_CARD_SLOT; +DECLARE_DEVICE_TYPE(PORTFOLIO_MEMORY_CARD_SLOT, portfolio_memory_card_slot_device) SLOT_INTERFACE_EXTERN( portfolio_memory_cards ); -#endif +#endif // MAME_BUS_POFO_CCM_H diff --git a/src/devices/bus/pofo/exp.cpp b/src/devices/bus/pofo/exp.cpp index c8f5733fe2c..37991dd8989 100644 --- a/src/devices/bus/pofo/exp.cpp +++ b/src/devices/bus/pofo/exp.cpp @@ -15,7 +15,7 @@ // GLOBAL VARIABLES //************************************************************************** -const device_type PORTFOLIO_EXPANSION_SLOT = device_creator<portfolio_expansion_slot_t>; +DEFINE_DEVICE_TYPE(PORTFOLIO_EXPANSION_SLOT, portfolio_expansion_slot_device, "portfolio_expansion_slot", "Atari Portfolio expansion port") @@ -30,7 +30,7 @@ const device_type PORTFOLIO_EXPANSION_SLOT = device_creator<portfolio_expansion_ device_portfolio_expansion_slot_interface::device_portfolio_expansion_slot_interface(const machine_config &mconfig, device_t &device) : device_slot_card_interface(mconfig,device) { - m_slot = dynamic_cast<portfolio_expansion_slot_t *>(device.owner()); + m_slot = dynamic_cast<portfolio_expansion_slot_device *>(device.owner()); } WRITE_LINE_MEMBER( device_portfolio_expansion_slot_interface::eint_w ) { m_slot->eint_w(state); } @@ -44,11 +44,11 @@ WRITE_LINE_MEMBER( device_portfolio_expansion_slot_interface::wake_w ) { m_slot- //************************************************************************** //------------------------------------------------- -// portfolio_expansion_slot_t - constructor +// portfolio_expansion_slot_device - constructor //------------------------------------------------- -portfolio_expansion_slot_t::portfolio_expansion_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, PORTFOLIO_EXPANSION_SLOT, "Atari Portfolio expansion port", tag, owner, clock, "portfolio_expansion_slot", __FILE__), +portfolio_expansion_slot_device::portfolio_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, PORTFOLIO_EXPANSION_SLOT, tag, owner, clock), device_slot_interface(mconfig, *this), m_write_eint(*this), m_write_nmio(*this), @@ -62,7 +62,7 @@ portfolio_expansion_slot_t::portfolio_expansion_slot_t(const machine_config &mco // device_start - device-specific startup //------------------------------------------------- -void portfolio_expansion_slot_t::device_start() +void portfolio_expansion_slot_device::device_start() { m_card = dynamic_cast<device_portfolio_expansion_slot_interface *>(get_card_device()); @@ -77,7 +77,7 @@ void portfolio_expansion_slot_t::device_start() // device_reset - device-specific reset //------------------------------------------------- -void portfolio_expansion_slot_t::device_reset() +void portfolio_expansion_slot_device::device_reset() { if (m_card != nullptr) { @@ -97,8 +97,8 @@ void portfolio_expansion_slot_t::device_reset() #include "hpc104.h" SLOT_INTERFACE_START( portfolio_expansion_cards ) - SLOT_INTERFACE("lpt", HPC101) - SLOT_INTERFACE("uart", HPC102) - SLOT_INTERFACE("ram", HPC104) - SLOT_INTERFACE("ram2", HPC104_2) + SLOT_INTERFACE("lpt", POFO_HPC101) + SLOT_INTERFACE("uart", POFO_HPC102) + SLOT_INTERFACE("ram", POFO_HPC104) + SLOT_INTERFACE("ram2", POFO_HPC104_2) SLOT_INTERFACE_END diff --git a/src/devices/bus/pofo/exp.h b/src/devices/bus/pofo/exp.h index 51bb16c71f4..27f882d2603 100644 --- a/src/devices/bus/pofo/exp.h +++ b/src/devices/bus/pofo/exp.h @@ -39,10 +39,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_POFO_EXP_H +#define MAME_BUS_POFO_EXP_H -#ifndef __PORTFOLIO_EXPANSION_SLOT__ -#define __PORTFOLIO_EXPANSION_SLOT__ +#pragma once @@ -64,13 +64,13 @@ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) #define MCFG_PORTFOLIO_EXPANSION_SLOT_EINT_CALLBACK(_write) \ - devcb = &portfolio_expansion_slot_t::set_eint_wr_callback(*device, DEVCB_##_write); + devcb = &portfolio_expansion_slot_device::set_eint_wr_callback(*device, DEVCB_##_write); #define MCFG_PORTFOLIO_EXPANSION_SLOT_NMIO_CALLBACK(_write) \ - devcb = &portfolio_expansion_slot_t::set_nmio_wr_callback(*device, DEVCB_##_write); + devcb = &portfolio_expansion_slot_device::set_nmio_wr_callback(*device, DEVCB_##_write); #define MCFG_PORTFOLIO_EXPANSION_SLOT_WAKE_CALLBACK(_write) \ - devcb = &portfolio_expansion_slot_t::set_wake_wr_callback(*device, DEVCB_##_write); + devcb = &portfolio_expansion_slot_device::set_wake_wr_callback(*device, DEVCB_##_write); @@ -80,15 +80,11 @@ // ======================> device_portfolio_expansion_slot_interface -class portfolio_expansion_slot_t; +class portfolio_expansion_slot_device; class device_portfolio_expansion_slot_interface : public device_slot_card_interface { public: - // construction/destruction - device_portfolio_expansion_slot_interface(const machine_config &mconfig, device_t &device); - virtual ~device_portfolio_expansion_slot_interface() { } - virtual bool nmd1() { return 1; } virtual bool pdet() { return 0; } virtual bool cdet() { return 1; } @@ -96,33 +92,34 @@ public: virtual uint8_t iack_r() { return 0xff; } virtual uint8_t eack_r() { return 0xff; } - virtual uint8_t nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { return data; }; - virtual void nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { }; + virtual uint8_t nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { return data; } + virtual void nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { } - virtual WRITE_LINE_MEMBER( iint_w ) { }; + virtual WRITE_LINE_MEMBER( iint_w ) { } DECLARE_WRITE_LINE_MEMBER( eint_w ); DECLARE_WRITE_LINE_MEMBER( nmio_w ); DECLARE_WRITE_LINE_MEMBER( wake_w ); protected: - portfolio_expansion_slot_t *m_slot; + // construction/destruction + device_portfolio_expansion_slot_interface(const machine_config &mconfig, device_t &device); + + portfolio_expansion_slot_device *m_slot; }; -// ======================> portfolio_expansion_slot_t +// ======================> portfolio_expansion_slot_device -class portfolio_expansion_slot_t : public device_t, - public device_slot_interface +class portfolio_expansion_slot_device : public device_t, public device_slot_interface { public: // construction/destruction - portfolio_expansion_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - virtual ~portfolio_expansion_slot_t() { } + portfolio_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template<class _Object> static devcb_base &set_eint_wr_callback(device_t &device, _Object object) { return downcast<portfolio_expansion_slot_t &>(device).m_write_eint.set_callback(object); } - template<class _Object> static devcb_base &set_nmio_wr_callback(device_t &device, _Object object) { return downcast<portfolio_expansion_slot_t &>(device).m_write_nmio.set_callback(object); } - template<class _Object> static devcb_base &set_wake_wr_callback(device_t &device, _Object object) { return downcast<portfolio_expansion_slot_t &>(device).m_write_wake.set_callback(object); } + template <class Object> static devcb_base &set_eint_wr_callback(device_t &device, Object &&cb) { return downcast<portfolio_expansion_slot_device &>(device).m_write_eint.set_callback(std::forward<Object>(cb)); } + template <class Object> static devcb_base &set_nmio_wr_callback(device_t &device, Object &&cb) { return downcast<portfolio_expansion_slot_device &>(device).m_write_nmio.set_callback(std::forward<Object>(cb)); } + template <class Object> static devcb_base &set_wake_wr_callback(device_t &device, Object &&cb) { return downcast<portfolio_expansion_slot_device &>(device).m_write_wake.set_callback(std::forward<Object>(cb)); } // computer interface bool nmd1_r() { return (m_card != nullptr) ? m_card->nmd1() : 1; } @@ -157,10 +154,9 @@ protected: // device type definition extern const device_type PORTFOLIO_EXPANSION_SLOT; +DECLARE_DEVICE_TYPE(PORTFOLIO_EXPANSION_SLOT, portfolio_expansion_slot_device) SLOT_INTERFACE_EXTERN( portfolio_expansion_cards ); - - -#endif +#endif // MAME_BUS_POFO_EXP_H diff --git a/src/devices/bus/pofo/hpc101.cpp b/src/devices/bus/pofo/hpc101.cpp index 8d106f00a37..f5511c3963b 100644 --- a/src/devices/bus/pofo/hpc101.cpp +++ b/src/devices/bus/pofo/hpc101.cpp @@ -26,7 +26,7 @@ // DEVICE DEFINITIONS //************************************************************************** -const device_type HPC101 = device_creator<hpc101_t>; +DEFINE_DEVICE_TYPE(POFO_HPC101, pofo_hpc101_device, "pofo_hpc101", "Atari Portfolio HPC-101") //------------------------------------------------- @@ -62,7 +62,7 @@ MACHINE_CONFIG_END // machine configurations //------------------------------------------------- -machine_config_constructor hpc101_t::device_mconfig_additions() const +machine_config_constructor pofo_hpc101_device::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( hpc101 ); } @@ -73,11 +73,11 @@ machine_config_constructor hpc101_t::device_mconfig_additions() const //************************************************************************** //------------------------------------------------- -// hpc101_t - constructor +// pofo_hpc101_device - constructor //------------------------------------------------- -hpc101_t::hpc101_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, HPC101, "Atari Portfolio HPC-101", tag, owner, clock, "hpc101", __FILE__), +pofo_hpc101_device::pofo_hpc101_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, POFO_HPC101, tag, owner, clock), device_portfolio_expansion_slot_interface(mconfig, *this), m_ppi(*this, M82C55A_TAG) { @@ -88,7 +88,7 @@ hpc101_t::hpc101_t(const machine_config &mconfig, const char *tag, device_t *own // device_start - device-specific startup //------------------------------------------------- -void hpc101_t::device_start() +void pofo_hpc101_device::device_start() { } @@ -97,7 +97,7 @@ void hpc101_t::device_start() // device_reset - device-specific reset //------------------------------------------------- -void hpc101_t::device_reset() +void pofo_hpc101_device::device_reset() { m_ppi->reset(); } @@ -107,7 +107,7 @@ void hpc101_t::device_reset() // nrdi_r - read //------------------------------------------------- -uint8_t hpc101_t::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) +uint8_t pofo_hpc101_device::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { if (!bcom) { @@ -130,7 +130,7 @@ uint8_t hpc101_t::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool // nwri_w - write //------------------------------------------------- -void hpc101_t::nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) +void pofo_hpc101_device::nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { if (!bcom) { diff --git a/src/devices/bus/pofo/hpc101.h b/src/devices/bus/pofo/hpc101.h index 9a700be92b9..f5cc803b5bb 100644 --- a/src/devices/bus/pofo/hpc101.h +++ b/src/devices/bus/pofo/hpc101.h @@ -6,10 +6,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_POFO_HPC101_H +#define MAME_BUS_POFO_HPC101_H -#ifndef __HPC101__ -#define __HPC101__ +#pragma once #include "exp.h" #include "bus/centronics/ctronics.h" @@ -21,14 +21,13 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> hpc101_t +// ======================> pofo_hpc101_device -class hpc101_t : public device_t, - public device_portfolio_expansion_slot_interface +class pofo_hpc101_device : public device_t, public device_portfolio_expansion_slot_interface { public: // construction/destruction - hpc101_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + pofo_hpc101_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // optional information overrides virtual machine_config_constructor device_mconfig_additions() const override; @@ -50,8 +49,6 @@ private: // device type definition -extern const device_type HPC101; - - +DECLARE_DEVICE_TYPE(POFO_HPC101, pofo_hpc101_device) -#endif +#endif // MAME_BUS_POFO_HPC101_H diff --git a/src/devices/bus/pofo/hpc102.cpp b/src/devices/bus/pofo/hpc102.cpp index 72c886b32d3..45dfb9e3c13 100644 --- a/src/devices/bus/pofo/hpc102.cpp +++ b/src/devices/bus/pofo/hpc102.cpp @@ -26,7 +26,7 @@ // DEVICE DEFINITIONS //************************************************************************** -const device_type HPC102 = device_creator<hpc102_t>; +DEFINE_DEVICE_TYPE(POFO_HPC102, pofo_hpc102_device, "pofo_hpc102", "Atari Portfolio HPC-102") //------------------------------------------------- @@ -54,7 +54,7 @@ MACHINE_CONFIG_END // machine configurations //------------------------------------------------- -machine_config_constructor hpc102_t::device_mconfig_additions() const +machine_config_constructor pofo_hpc102_device::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( hpc102 ); } @@ -65,11 +65,11 @@ machine_config_constructor hpc102_t::device_mconfig_additions() const //************************************************************************** //------------------------------------------------- -// hpc102_t - constructor +// pofo_hpc102_device - constructor //------------------------------------------------- -hpc102_t::hpc102_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, HPC102, "Atari Portfolio HPC-102", tag, owner, clock, "hpc102", __FILE__), +pofo_hpc102_device::pofo_hpc102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, POFO_HPC102, tag, owner, clock), device_portfolio_expansion_slot_interface(mconfig, *this), m_uart(*this, M82C50A_TAG) { @@ -80,7 +80,7 @@ hpc102_t::hpc102_t(const machine_config &mconfig, const char *tag, device_t *own // device_start - device-specific startup //------------------------------------------------- -void hpc102_t::device_start() +void pofo_hpc102_device::device_start() { } @@ -89,7 +89,7 @@ void hpc102_t::device_start() // device_reset - device-specific reset //------------------------------------------------- -void hpc102_t::device_reset() +void pofo_hpc102_device::device_reset() { m_uart->reset(); } @@ -99,7 +99,7 @@ void hpc102_t::device_reset() // eack_r - external interrupt acknowledge //------------------------------------------------- -uint8_t hpc102_t::eack_r() +uint8_t pofo_hpc102_device::eack_r() { return m_vector; } @@ -109,7 +109,7 @@ uint8_t hpc102_t::eack_r() // nrdi_r - read //------------------------------------------------- -uint8_t hpc102_t::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) +uint8_t pofo_hpc102_device::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { if (!bcom) { @@ -132,7 +132,7 @@ uint8_t hpc102_t::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool // nwri_w - write //------------------------------------------------- -void hpc102_t::nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) +void pofo_hpc102_device::nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { if (!bcom) { diff --git a/src/devices/bus/pofo/hpc102.h b/src/devices/bus/pofo/hpc102.h index e492e6cdc38..e0ba50074e4 100644 --- a/src/devices/bus/pofo/hpc102.h +++ b/src/devices/bus/pofo/hpc102.h @@ -6,10 +6,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_POFO_HPC102_H +#define MAME_BUS_POFO_HPC102_H -#ifndef __HPC102__ -#define __HPC102__ +#pragma once #include "exp.h" #include "bus/rs232/rs232.h" @@ -21,14 +21,13 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> hpc102_t +// ======================> pofo_hpc102_device -class hpc102_t : public device_t, - public device_portfolio_expansion_slot_interface +class pofo_hpc102_device : public device_t, public device_portfolio_expansion_slot_interface { public: // construction/destruction - hpc102_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + pofo_hpc102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // optional information overrides virtual machine_config_constructor device_mconfig_additions() const override; @@ -54,12 +53,6 @@ private: // device type definition -extern const device_type HPC102; - - - -#endif -/* - +DECLARE_DEVICE_TYPE(POFO_HPC102, pofo_hpc102_device) -*/ +#endif // MAME_BUS_POFO_HPC102_H diff --git a/src/devices/bus/pofo/hpc104.cpp b/src/devices/bus/pofo/hpc104.cpp index 050fdc2bb6c..7c22c9b6625 100644 --- a/src/devices/bus/pofo/hpc104.cpp +++ b/src/devices/bus/pofo/hpc104.cpp @@ -23,8 +23,8 @@ // DEVICE DEFINITIONS //************************************************************************** -const device_type HPC104 = device_creator<hpc104_t>; -const device_type HPC104_2 = device_creator<hpc104_2_t>; +DEFINE_DEVICE_TYPE(POFO_HPC104, pofo_hpc104_device, "pofo_hpc104", "Atari Portfolio HPC-104") +DEFINE_DEVICE_TYPE(POFO_HPC104_2, pofo_hpc104_2_device, "pofo_hpc104_2", "Atari Portfolio HPC-104 (Unit 2)") //------------------------------------------------- @@ -35,9 +35,9 @@ static MACHINE_CONFIG_FRAGMENT( hpc104 ) MCFG_PORTFOLIO_MEMORY_CARD_SLOT_ADD(PORTFOLIO_MEMORY_CARD_SLOT_B_TAG, portfolio_memory_cards, nullptr) MCFG_PORTFOLIO_EXPANSION_SLOT_ADD(PORTFOLIO_EXPANSION_SLOT_TAG, XTAL_4_9152MHz, portfolio_expansion_cards, nullptr) - MCFG_PORTFOLIO_EXPANSION_SLOT_EINT_CALLBACK(DEVWRITELINE(DEVICE_SELF_OWNER, portfolio_expansion_slot_t, eint_w)) - MCFG_PORTFOLIO_EXPANSION_SLOT_NMIO_CALLBACK(DEVWRITELINE(DEVICE_SELF_OWNER, portfolio_expansion_slot_t, nmio_w)) - MCFG_PORTFOLIO_EXPANSION_SLOT_WAKE_CALLBACK(DEVWRITELINE(DEVICE_SELF_OWNER, portfolio_expansion_slot_t, wake_w)) + MCFG_PORTFOLIO_EXPANSION_SLOT_EINT_CALLBACK(DEVWRITELINE(DEVICE_SELF_OWNER, portfolio_expansion_slot_device, eint_w)) + MCFG_PORTFOLIO_EXPANSION_SLOT_NMIO_CALLBACK(DEVWRITELINE(DEVICE_SELF_OWNER, portfolio_expansion_slot_device, nmio_w)) + MCFG_PORTFOLIO_EXPANSION_SLOT_WAKE_CALLBACK(DEVWRITELINE(DEVICE_SELF_OWNER, portfolio_expansion_slot_device, wake_w)) MACHINE_CONFIG_END @@ -46,7 +46,7 @@ MACHINE_CONFIG_END // machine configurations //------------------------------------------------- -machine_config_constructor hpc104_t::device_mconfig_additions() const +machine_config_constructor pofo_hpc104_device::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( hpc104 ); } @@ -68,7 +68,7 @@ INPUT_PORTS_END // input_ports - device-specific input ports //------------------------------------------------- -ioport_constructor hpc104_t::device_input_ports() const +ioport_constructor pofo_hpc104_device::device_input_ports() const { return INPUT_PORTS_NAME( hpc104 ); } @@ -90,7 +90,7 @@ INPUT_PORTS_END // input_ports - device-specific input ports //------------------------------------------------- -ioport_constructor hpc104_2_t::device_input_ports() const +ioport_constructor pofo_hpc104_2_device::device_input_ports() const { return INPUT_PORTS_NAME( hpc104_2 ); } @@ -102,11 +102,11 @@ ioport_constructor hpc104_2_t::device_input_ports() const //************************************************************************** //------------------------------------------------- -// hpc104_t - constructor +// pofo_hpc104_device - constructor //------------------------------------------------- -hpc104_t::hpc104_t(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) : - device_t(mconfig, type, name, tag, owner, clock, shortname, source), +pofo_hpc104_device::pofo_hpc104_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, type, tag, owner, clock), device_portfolio_expansion_slot_interface(mconfig, *this), device_nvram_interface(mconfig, *this), m_ccm(*this, PORTFOLIO_MEMORY_CARD_SLOT_B_TAG), @@ -116,31 +116,27 @@ hpc104_t::hpc104_t(const machine_config &mconfig, device_type type, const char * { } -hpc104_t::hpc104_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, HPC104, "Atari Portfolio HPC-104", tag, owner, clock, "hpc104", __FILE__), - device_portfolio_expansion_slot_interface(mconfig, *this), - device_nvram_interface(mconfig, *this), - m_ccm(*this, PORTFOLIO_MEMORY_CARD_SLOT_B_TAG), - m_exp(*this, PORTFOLIO_EXPANSION_SLOT_TAG), - m_nvram(*this, "nvram"), - m_io_sw1(*this, "SW1") +pofo_hpc104_device::pofo_hpc104_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + pofo_hpc104_device(mconfig, POFO_HPC104, tag, owner, clock) { } //------------------------------------------------- -// hpc104_2_t - constructor +// pofo_hpc104_2_device - constructor //------------------------------------------------- -hpc104_2_t::hpc104_2_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - hpc104_t(mconfig, HPC104_2, "Atari Portfolio HPC-104 (Unit 2)", tag, owner, clock, "hpc104_2", __FILE__) { } +pofo_hpc104_2_device::pofo_hpc104_2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + pofo_hpc104_device(mconfig, POFO_HPC104_2, tag, owner, clock) +{ +} //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- -void hpc104_t::device_start() +void pofo_hpc104_device::device_start() { // allocate memory m_nvram.allocate(0x40000); @@ -151,7 +147,7 @@ void hpc104_t::device_start() // device_reset - device-specific reset //------------------------------------------------- -void hpc104_t::device_reset() +void pofo_hpc104_device::device_reset() { m_sw1 = BIT(m_io_sw1->read(), 0); } @@ -161,7 +157,7 @@ void hpc104_t::device_reset() // nrdi_r - read //------------------------------------------------- -uint8_t hpc104_t::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) +uint8_t pofo_hpc104_device::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { data = m_exp->nrdi_r(space, offset, data, iom, bcom, m_ncc1_out || ncc1); @@ -198,7 +194,7 @@ uint8_t hpc104_t::nrdi_r(address_space &space, offs_t offset, uint8_t data, bool // nwri_w - write //------------------------------------------------- -void hpc104_t::nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) +void pofo_hpc104_device::nwri_w(address_space &space, offs_t offset, uint8_t data, bool iom, bool bcom, bool ncc1) { m_exp->nwri_w(space, offset, data, iom, bcom, m_ncc1_out || ncc1); diff --git a/src/devices/bus/pofo/hpc104.h b/src/devices/bus/pofo/hpc104.h index 38337f5ed35..50350490785 100644 --- a/src/devices/bus/pofo/hpc104.h +++ b/src/devices/bus/pofo/hpc104.h @@ -6,10 +6,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_POFO_HPC104_H +#define MAME_BUS_POFO_HPC104_H -#ifndef __HPC104__ -#define __HPC104__ +#pragma once #include "exp.h" #include "bus/pofo/ccm.h" @@ -21,22 +21,23 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> hpc104_t +// ======================> pofo_hpc104_device -class hpc104_t : public device_t, +class pofo_hpc104_device : public device_t, public device_portfolio_expansion_slot_interface, public device_nvram_interface { public: // construction/destruction - hpc104_t(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); - hpc104_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + pofo_hpc104_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // optional information overrides virtual machine_config_constructor device_mconfig_additions() const override; virtual ioport_constructor device_input_ports() const override; protected: + pofo_hpc104_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + // device-level overrides virtual void device_start() override; virtual void device_reset() override; @@ -55,8 +56,8 @@ protected: virtual WRITE_LINE_MEMBER( iint_w ) override { m_exp->iint_w(state); } private: - required_device<portfolio_memory_card_slot_t> m_ccm; - required_device<portfolio_expansion_slot_t> m_exp; + required_device<portfolio_memory_card_slot_device> m_ccm; + required_device<portfolio_expansion_slot_device> m_exp; optional_shared_ptr<uint8_t> m_nvram; required_ioport m_io_sw1; @@ -65,13 +66,13 @@ private: }; -// ======================> hpc104_2_t +// ======================> pofo_hpc104_2_device -class hpc104_2_t : public hpc104_t +class pofo_hpc104_2_device : public pofo_hpc104_device { public: // construction/destruction - hpc104_2_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + pofo_hpc104_2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // optional information overrides virtual ioport_constructor device_input_ports() const override; @@ -79,9 +80,7 @@ public: // device type definition -extern const device_type HPC104; -extern const device_type HPC104_2; - - +DECLARE_DEVICE_TYPE(POFO_HPC104, pofo_hpc104_device) +DECLARE_DEVICE_TYPE(POFO_HPC104_2, pofo_hpc104_2_device) -#endif +#endif // MAME_BUS_POFO_HPC104_H diff --git a/src/devices/bus/pofo/ram.cpp b/src/devices/bus/pofo/ram.cpp index 79d2a87ad0e..6ef861a0b5d 100644 --- a/src/devices/bus/pofo/ram.cpp +++ b/src/devices/bus/pofo/ram.cpp @@ -15,7 +15,7 @@ // DEVICE DEFINITIONS //************************************************************************** -const device_type PORTFOLIO_RAM_CARD = device_creator<portfolio_ram_card_t>; +DEFINE_DEVICE_TYPE(PORTFOLIO_RAM_CARD, portfolio_ram_card_device, "portfolio_ram_card", "Atari Portfolio RAM card") //************************************************************************** @@ -23,11 +23,11 @@ const device_type PORTFOLIO_RAM_CARD = device_creator<portfolio_ram_card_t>; //************************************************************************** //------------------------------------------------- -// portfolio_ram_card_t - constructor +// portfolio_ram_card_device - constructor //------------------------------------------------- -portfolio_ram_card_t::portfolio_ram_card_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, PORTFOLIO_RAM_CARD, "Atari Portfolio RAM card", tag, owner, clock, "portfolio_ram_card", __FILE__), +portfolio_ram_card_device::portfolio_ram_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, PORTFOLIO_RAM_CARD, tag, owner, clock), device_portfolio_memory_card_slot_interface(mconfig, *this), device_nvram_interface(mconfig, *this) { @@ -38,7 +38,7 @@ portfolio_ram_card_t::portfolio_ram_card_t(const machine_config &mconfig, const // device_start - device-specific startup //------------------------------------------------- -void portfolio_ram_card_t::device_start() +void portfolio_ram_card_device::device_start() { m_nvram.allocate(0x20000); } @@ -48,7 +48,7 @@ void portfolio_ram_card_t::device_start() // nrdi_r - read //------------------------------------------------- -uint8_t portfolio_ram_card_t::nrdi_r(address_space &space, offs_t offset) +uint8_t portfolio_ram_card_device::nrdi_r(address_space &space, offs_t offset) { return m_nvram[offset]; } @@ -58,7 +58,7 @@ uint8_t portfolio_ram_card_t::nrdi_r(address_space &space, offs_t offset) // nwri_w - write //------------------------------------------------- -void portfolio_ram_card_t::nwri_w(address_space &space, offs_t offset, uint8_t data) +void portfolio_ram_card_device::nwri_w(address_space &space, offs_t offset, uint8_t data) { m_nvram[offset] = data; } diff --git a/src/devices/bus/pofo/ram.h b/src/devices/bus/pofo/ram.h index 25ee7f837f9..9d126b51a2c 100644 --- a/src/devices/bus/pofo/ram.h +++ b/src/devices/bus/pofo/ram.h @@ -6,10 +6,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_POFO_RAM_H +#define MAME_BUS_POFO_RAM_H -#ifndef __PORTFOLIO_RAM_CARD__ -#define __PORTFOLIO_RAM_CARD__ +#pragma once #include "ccm.h" #include "machine/nvram.h" @@ -20,15 +20,15 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> portfolio_ram_card_t +// ======================> portfolio_ram_card_device -class portfolio_ram_card_t : public device_t, +class portfolio_ram_card_device : public device_t, public device_portfolio_memory_card_slot_interface, public device_nvram_interface { public: // construction/destruction - portfolio_ram_card_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + portfolio_ram_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: // device-level overrides @@ -48,8 +48,6 @@ protected: // device type definition -extern const device_type PORTFOLIO_RAM_CARD; - - +DECLARE_DEVICE_TYPE(PORTFOLIO_RAM_CARD, portfolio_ram_card_device) -#endif +#endif // MAME_BUS_POFO_RAM_H diff --git a/src/devices/bus/pofo/rom.cpp b/src/devices/bus/pofo/rom.cpp index b3862b15753..8155444783a 100644 --- a/src/devices/bus/pofo/rom.cpp +++ b/src/devices/bus/pofo/rom.cpp @@ -15,7 +15,7 @@ // DEVICE DEFINITIONS //************************************************************************** -const device_type PORTFOLIO_ROM_CARD = device_creator<portfolio_rom_card_t>; +DEFINE_DEVICE_TYPE(PORTFOLIO_ROM_CARD, portfolio_rom_card_device, "portfolio_rom_card", "Atari Portfolio ROM card") //************************************************************************** @@ -23,11 +23,11 @@ const device_type PORTFOLIO_ROM_CARD = device_creator<portfolio_rom_card_t>; //************************************************************************** //------------------------------------------------- -// portfolio_rom_card_t - constructor +// portfolio_rom_card_device - constructor //------------------------------------------------- -portfolio_rom_card_t::portfolio_rom_card_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, PORTFOLIO_ROM_CARD, "Atari Portfolio ROM card", tag, owner, clock, "portfolio_rom_card", __FILE__), +portfolio_rom_card_device::portfolio_rom_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, PORTFOLIO_ROM_CARD, tag, owner, clock), device_portfolio_memory_card_slot_interface(mconfig, *this) { } @@ -37,7 +37,7 @@ portfolio_rom_card_t::portfolio_rom_card_t(const machine_config &mconfig, const // device_start - device-specific startup //------------------------------------------------- -void portfolio_rom_card_t::device_start() +void portfolio_rom_card_device::device_start() { } @@ -46,7 +46,7 @@ void portfolio_rom_card_t::device_start() // nrdi_r - read //------------------------------------------------- -uint8_t portfolio_rom_card_t::nrdi_r(address_space &space, offs_t offset) +uint8_t portfolio_rom_card_device::nrdi_r(address_space &space, offs_t offset) { return m_rom[offset]; } diff --git a/src/devices/bus/pofo/rom.h b/src/devices/bus/pofo/rom.h index f8b7841f0cd..eab0ff1fde4 100644 --- a/src/devices/bus/pofo/rom.h +++ b/src/devices/bus/pofo/rom.h @@ -6,10 +6,10 @@ **********************************************************************/ -#pragma once +#ifndef MAME_BUS_POFO_ROM_H +#define MAME_BUS_POFO_ROM_H -#ifndef __PORTFOLIO_ROM_CARD__ -#define __PORTFOLIO_ROM_CARD__ +#pragma once #include "ccm.h" @@ -19,14 +19,14 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> portfolio_rom_card_t +// ======================> portfolio_rom_card_device -class portfolio_rom_card_t : public device_t, +class portfolio_rom_card_device : public device_t, public device_portfolio_memory_card_slot_interface { public: // construction/destruction - portfolio_rom_card_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + portfolio_rom_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: // device-level overrides @@ -40,8 +40,6 @@ protected: // device type definition -extern const device_type PORTFOLIO_ROM_CARD; - - +DECLARE_DEVICE_TYPE(PORTFOLIO_ROM_CARD, portfolio_rom_card_device) -#endif +#endif // MAME_BUS_POFO_ROM_H |