summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/crvision
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2017-05-07 23:18:47 +1000
committer Vas Crabb <vas@vastheman.com>2017-05-14 21:44:11 +1000
commit0f0d39ef81562c75e79176dd3bebb1e491ca39d5 (patch)
tree201cee7fdf55ee800f83859a92efd2cfe66cf2b3 /src/devices/bus/crvision
parente6c4be2b4d71c7a6c95be0bae111eb416ff0f9e7 (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/crvision')
-rw-r--r--src/devices/bus/crvision/rom.cpp35
-rw-r--r--src/devices/bus/crvision/rom.h35
-rw-r--r--src/devices/bus/crvision/slot.cpp10
-rw-r--r--src/devices/bus/crvision/slot.h13
4 files changed, 49 insertions, 44 deletions
diff --git a/src/devices/bus/crvision/rom.cpp b/src/devices/bus/crvision/rom.cpp
index 773eb00472b..fad177683b0 100644
--- a/src/devices/bus/crvision/rom.cpp
+++ b/src/devices/bus/crvision/rom.cpp
@@ -17,54 +17,53 @@
// crvision_rom_device - constructor
//-------------------------------------------------
-const device_type CRVISION_ROM_4K = device_creator<crvision_rom_device>;
-const device_type CRVISION_ROM_6K = device_creator<crvision_rom6k_device>;
-const device_type CRVISION_ROM_8K = device_creator<crvision_rom8k_device>;
-const device_type CRVISION_ROM_10K = device_creator<crvision_rom10k_device>;
-const device_type CRVISION_ROM_12K = device_creator<crvision_rom12k_device>;
-const device_type CRVISION_ROM_16K = device_creator<crvision_rom16k_device>;
-const device_type CRVISION_ROM_18K = device_creator<crvision_rom18k_device>;
+DEFINE_DEVICE_TYPE(CRVISION_ROM_4K, crvision_rom_device, "crvision_4k", "CreatiVision 4K Carts")
+DEFINE_DEVICE_TYPE(CRVISION_ROM_6K, crvision_rom6k_device, "crvision_6k", "CreatiVision 6K Carts")
+DEFINE_DEVICE_TYPE(CRVISION_ROM_8K, crvision_rom8k_device, "crvision_8k", "CreatiVision 8K Carts")
+DEFINE_DEVICE_TYPE(CRVISION_ROM_10K, crvision_rom10k_device, "crvision_10k", "CreatiVision 10K Carts")
+DEFINE_DEVICE_TYPE(CRVISION_ROM_12K, crvision_rom12k_device, "crvision_12k", "CreatiVision 12K Carts")
+DEFINE_DEVICE_TYPE(CRVISION_ROM_16K, crvision_rom16k_device, "crvision_16k", "CreatiVision 16K Carts")
+DEFINE_DEVICE_TYPE(CRVISION_ROM_18K, crvision_rom18k_device, "crvision_18k", "CreatiVision 18K Carts")
-crvision_rom_device::crvision_rom_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)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- device_crvision_cart_interface(mconfig, *this)
+crvision_rom_device::crvision_rom_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_crvision_cart_interface(mconfig, *this)
{
}
crvision_rom_device::crvision_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, CRVISION_ROM_4K, "CreatiVision 4K Carts", tag, owner, clock, "crvision_4k", __FILE__),
- device_crvision_cart_interface(mconfig, *this)
+ : crvision_rom_device(mconfig, CRVISION_ROM_4K, tag, owner, clock)
{
}
crvision_rom6k_device::crvision_rom6k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : crvision_rom_device(mconfig, CRVISION_ROM_6K, "CreatiVision 6K Carts", tag, owner, clock, "crvision_6k", __FILE__)
+ : crvision_rom_device(mconfig, CRVISION_ROM_6K, tag, owner, clock)
{
}
crvision_rom8k_device::crvision_rom8k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : crvision_rom_device(mconfig, CRVISION_ROM_8K, "CreatiVision 8K Carts", tag, owner, clock, "crvision_8k", __FILE__)
+ : crvision_rom_device(mconfig, CRVISION_ROM_8K, tag, owner, clock)
{
}
crvision_rom10k_device::crvision_rom10k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : crvision_rom_device(mconfig, CRVISION_ROM_10K, "CreatiVision 10K Carts", tag, owner, clock, "crvision_10k", __FILE__)
+ : crvision_rom_device(mconfig, CRVISION_ROM_10K, tag, owner, clock)
{
}
crvision_rom12k_device::crvision_rom12k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : crvision_rom_device(mconfig, CRVISION_ROM_12K, "CreatiVision 12K Carts", tag, owner, clock, "crvision_12k", __FILE__)
+ : crvision_rom_device(mconfig, CRVISION_ROM_12K, tag, owner, clock)
{
}
crvision_rom16k_device::crvision_rom16k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : crvision_rom_device(mconfig, CRVISION_ROM_16K, "CreatiVision 16K Carts", tag, owner, clock, "crvision_16k", __FILE__)
+ : crvision_rom_device(mconfig, CRVISION_ROM_16K, tag, owner, clock)
{
}
crvision_rom18k_device::crvision_rom18k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : crvision_rom_device(mconfig, CRVISION_ROM_18K, "CreatiVision 18K Carts", tag, owner, clock, "crvision_18k", __FILE__)
+ : crvision_rom_device(mconfig, CRVISION_ROM_18K, tag, owner, clock)
{
}
diff --git a/src/devices/bus/crvision/rom.h b/src/devices/bus/crvision/rom.h
index c557389ec97..cf15b1e4e2a 100644
--- a/src/devices/bus/crvision/rom.h
+++ b/src/devices/bus/crvision/rom.h
@@ -1,7 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
-#ifndef __CRVISION_ROM_H
-#define __CRVISION_ROM_H
+#ifndef MAME_BUS_CPC_CRVISION_ROM_H
+#define MAME_BUS_CPC_CRVISION_ROM_H
+
+#pragma once
#include "slot.h"
@@ -13,15 +15,17 @@ class crvision_rom_device : public device_t,
{
public:
// construction/destruction
- crvision_rom_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);
crvision_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ // reading and writing
+ virtual DECLARE_READ8_MEMBER(read_rom80) override;
+
+protected:
+ crvision_rom_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 {}
-
- // reading and writing
- virtual DECLARE_READ8_MEMBER(read_rom80) override;
};
// ======================> crvision_rom6k_device
@@ -100,17 +104,14 @@ public:
};
-
-
-
// device type definition
-extern const device_type CRVISION_ROM_4K;
-extern const device_type CRVISION_ROM_6K;
-extern const device_type CRVISION_ROM_8K;
-extern const device_type CRVISION_ROM_10K;
-extern const device_type CRVISION_ROM_12K;
-extern const device_type CRVISION_ROM_16K;
-extern const device_type CRVISION_ROM_18K;
+DECLARE_DEVICE_TYPE(CRVISION_ROM_4K, crvision_rom_device)
+DECLARE_DEVICE_TYPE(CRVISION_ROM_6K, crvision_rom6k_device)
+DECLARE_DEVICE_TYPE(CRVISION_ROM_8K, crvision_rom8k_device)
+DECLARE_DEVICE_TYPE(CRVISION_ROM_10K, crvision_rom10k_device)
+DECLARE_DEVICE_TYPE(CRVISION_ROM_12K, crvision_rom12k_device)
+DECLARE_DEVICE_TYPE(CRVISION_ROM_16K, crvision_rom16k_device)
+DECLARE_DEVICE_TYPE(CRVISION_ROM_18K, crvision_rom18k_device)
-#endif
+#endif // MAME_BUS_CPC_CRVISION_ROM_H
diff --git a/src/devices/bus/crvision/slot.cpp b/src/devices/bus/crvision/slot.cpp
index 48e0fd719ea..a0398840f00 100644
--- a/src/devices/bus/crvision/slot.cpp
+++ b/src/devices/bus/crvision/slot.cpp
@@ -15,7 +15,7 @@
// GLOBAL VARIABLES
//**************************************************************************
-const device_type CRVISION_CART_SLOT = device_creator<crvision_cart_slot_device>;
+DEFINE_DEVICE_TYPE(CRVISION_CART_SLOT, crvision_cart_slot_device, "crvision_cart_slot", "CreatiVision Cartridge Slot")
//**************************************************************************
// CreatiVision Cartridges Interface
@@ -63,10 +63,10 @@ void device_crvision_cart_interface::rom_alloc(uint32_t size, const char *tag)
// crvision_cart_slot_device - constructor
//-------------------------------------------------
crvision_cart_slot_device::crvision_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, CRVISION_CART_SLOT, "CreatiVision Cartridge Slot", tag, owner, clock, "crvision_cart_slot", __FILE__),
- device_image_interface(mconfig, *this),
- device_slot_interface(mconfig, *this),
- m_type(CRV_4K), m_cart(nullptr)
+ device_t(mconfig, CRVISION_CART_SLOT, tag, owner, clock),
+ device_image_interface(mconfig, *this),
+ device_slot_interface(mconfig, *this),
+ m_type(CRV_4K), m_cart(nullptr)
{
}
diff --git a/src/devices/bus/crvision/slot.h b/src/devices/bus/crvision/slot.h
index c705d016d1b..bcf841ecfdd 100644
--- a/src/devices/bus/crvision/slot.h
+++ b/src/devices/bus/crvision/slot.h
@@ -1,7 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
-#ifndef __CRVISION_SLOT_H
-#define __CRVISION_SLOT_H
+#ifndef MAME_BUS_CRVISION_SLOT_H
+#define MAME_BUS_CRVISION_SLOT_H
+
+#pragma once
#include "softlist_dev.h"
@@ -30,7 +32,6 @@ class device_crvision_cart_interface : public device_slot_card_interface
{
public:
// construction/destruction
- device_crvision_cart_interface(const machine_config &mconfig, device_t &device);
virtual ~device_crvision_cart_interface();
// reading and writing
@@ -42,6 +43,8 @@ public:
uint32_t get_rom_size() { return m_rom_size; }
protected:
+ device_crvision_cart_interface(const machine_config &mconfig, device_t &device);
+
// internal state
uint8_t *m_rom;
uint32_t m_rom_size;
@@ -95,6 +98,7 @@ protected:
// device type definition
extern const device_type CRVISION_CART_SLOT;
+DECLARE_DEVICE_TYPE(CRVISION_CART_SLOT, crvision_cart_slot_device)
/***************************************************************************
@@ -106,4 +110,5 @@ extern const device_type CRVISION_CART_SLOT;
#define MCFG_CRVISION_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
MCFG_DEVICE_ADD(_tag, CRVISION_CART_SLOT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
-#endif
+
+#endif // MAME_BUS_CRVISION_SLOT_H