summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2018-12-14 19:27:41 +0100
committer Ivan Vangelista <mesgnet@yahoo.it>2018-12-14 19:27:41 +0100
commit35f75213860599ca6d526c1b43d0525c0416efa6 (patch)
tree5d4a92eda645d8bd4dbfca3ea8f63c9cbd803a32
parent79cbb70a11cfedb37dfdefa40fe5a267270a5e72 (diff)
src/mame: a few less MCFG macros (nw)
-rw-r--r--src/devices/machine/jvsdev.cpp7
-rw-r--r--src/devices/machine/jvsdev.h12
-rw-r--r--src/mame/drivers/chihiro.cpp14
-rw-r--r--src/mame/drivers/cobra.cpp27
-rw-r--r--src/mame/drivers/naomi.cpp16
-rw-r--r--src/mame/machine/jvs13551.cpp13
-rw-r--r--src/mame/machine/jvs13551.h28
7 files changed, 61 insertions, 56 deletions
diff --git a/src/devices/machine/jvsdev.cpp b/src/devices/machine/jvsdev.cpp
index 20c3e538c5a..f55a836cd01 100644
--- a/src/devices/machine/jvsdev.cpp
+++ b/src/devices/machine/jvsdev.cpp
@@ -2,12 +2,10 @@
// copyright-holders:Olivier Galibert
#include "emu.h"
#include "jvsdev.h"
-#include "jvshost.h"
jvs_device::jvs_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, type, tag, owner, clock), jvs_outputs(0), jvs_address(0), jvs_reset_counter(0)
+ : device_t(mconfig, type, tag, owner, clock), jvs_outputs(0), host(*this, finder_base::DUMMY_TAG), jvs_address(0), jvs_reset_counter(0)
{
- jvs_host_tag = nullptr;
next_device = nullptr;
}
@@ -188,9 +186,6 @@ bool jvs_device::get_address_set_line()
void jvs_device::device_start()
{
- jvs_host *host = machine().device<jvs_host>(jvs_host_tag);
- if(!host)
- fatalerror("JVS device %s could not find JVS host %s\n", tag(), jvs_host_tag);
host->add_device(this);
save_item(NAME(jvs_address));
diff --git a/src/devices/machine/jvsdev.h b/src/devices/machine/jvsdev.h
index 5002d807252..7a93b3ead04 100644
--- a/src/devices/machine/jvsdev.h
+++ b/src/devices/machine/jvsdev.h
@@ -5,18 +5,11 @@
#pragma once
-
-#define MCFG_JVS_DEVICE_ADD(_tag, _type, _host) \
- MCFG_DEVICE_ADD(_tag, _type, 0) \
- downcast<jvs_device &>(*device).set_jvs_host_tag(_host);
-
-class jvs_host;
+#include "jvshost.h"
class jvs_device : public device_t
{
public:
- void set_jvs_host_tag(const char *host_tag) { jvs_host_tag = host_tag; }
-
void chain(jvs_device *dev);
void message(uint8_t dest, const uint8_t *send_buffer, uint32_t send_size, uint8_t *recv_buffer, uint32_t &recv_size);
bool get_address_set_line();
@@ -45,8 +38,9 @@ protected:
virtual bool swoutputs(uint8_t count, const uint8_t *vals);
virtual bool swoutputs(uint8_t id, uint8_t val);
+ required_device<jvs_host> host;
+
private:
- const char *jvs_host_tag;
jvs_device *next_device;
uint8_t jvs_address;
uint32_t jvs_reset_counter;
diff --git a/src/mame/drivers/chihiro.cpp b/src/mame/drivers/chihiro.cpp
index d8ec1a30ca5..e3f1052e2ae 100644
--- a/src/mame/drivers/chihiro.cpp
+++ b/src/mame/drivers/chihiro.cpp
@@ -1873,7 +1873,19 @@ MACHINE_CONFIG_START(chihiro_state::chihiro_base)
OHCI_USB_CONNECTOR(config, ":pci:02.0:port4", usb_baseboard, nullptr, false);
MCFG_DEVICE_ADD("jvs_master", JVS_MASTER, 0)
- MCFG_SEGA_837_13551_DEVICE_ADD("837_13551", "jvs_master", ":TILT", ":P1", ":P2", ":A0", ":A1", ":A2", ":A3", ":A4", ":A5", ":A6", ":A7", ":OUTPUT")
+ sega_837_13551_device &sega837(SEGA_837_13551(config, "837_13551", 0, "jvs_master"));
+ sega837.set_port_tag<0>("TILT");
+ sega837.set_port_tag<1>("P1");
+ sega837.set_port_tag<2>("P2");
+ sega837.set_port_tag<3>("A0");
+ sega837.set_port_tag<4>("A1");
+ sega837.set_port_tag<5>("A2");
+ sega837.set_port_tag<6>("A3");
+ sega837.set_port_tag<7>("A4");
+ sega837.set_port_tag<8>("A5");
+ sega837.set_port_tag<9>("A6");
+ sega837.set_port_tag<10>("A7");
+ sega837.set_port_tag<11>("OUTPUT");
MACHINE_CONFIG_END
void chihiro_state::chihirogd(machine_config &config)
diff --git a/src/mame/drivers/cobra.cpp b/src/mame/drivers/cobra.cpp
index 44e2e5c605b..5a17fa083a3 100644
--- a/src/mame/drivers/cobra.cpp
+++ b/src/mame/drivers/cobra.cpp
@@ -494,11 +494,19 @@ private:
class cobra_jvs : public jvs_device
{
public:
+ template <typename T>
+ cobra_jvs(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&jvs_host_tag, bool enable)
+ : cobra_jvs(mconfig, tag, owner, clock)
+ {
+ host.set_tag(std::forward<T>(jvs_host_tag));
+ set_main_board(enable);
+ }
+
cobra_jvs(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
//DECLARE_WRITE_LINE_MEMBER(coin_1_w);
//DECLARE_WRITE_LINE_MEMBER(coin_2_w);
- static void static_set_main_board(device_t &device, bool enable);
+ void set_main_board(bool enable) { is_main_board = enable; }
void increase_coin_counter(uint8_t which);
protected:
@@ -524,12 +532,6 @@ cobra_jvs::cobra_jvs(const machine_config &mconfig, const char *tag, device_t *o
m_coin_counter[1] = 0;
}
-void cobra_jvs::static_set_main_board(device_t &device, bool enable)
-{
- cobra_jvs &jvsdev = downcast<cobra_jvs &>(device);
- jvsdev.is_main_board = enable;
-}
-
#if 0
WRITE_LINE_MEMBER(cobra_jvs::coin_1_w)
{
@@ -3333,13 +3335,10 @@ MACHINE_CONFIG_START(cobra_state::cobra)
m_k001604->set_roz_mem_offset(0); // correct?
m_k001604->set_palette(m_palette);
- MCFG_DEVICE_ADD(m_jvs_host, COBRA_JVS_HOST, 4000000)
- MCFG_JVS_DEVICE_ADD(m_jvs1, COBRA_JVS, "cobra_jvs_host")
- cobra_jvs::static_set_main_board(*device, true);
- MCFG_JVS_DEVICE_ADD(m_jvs2, COBRA_JVS, "cobra_jvs_host")
- cobra_jvs::static_set_main_board(*device, true);
- MCFG_JVS_DEVICE_ADD(m_jvs3, COBRA_JVS, "cobra_jvs_host")
- cobra_jvs::static_set_main_board(*device, true);
+ COBRA_JVS_HOST(config, m_jvs_host, 4000000);
+ COBRA_JVS(config, m_jvs1, 0, m_jvs_host, true);
+ COBRA_JVS(config, m_jvs2, 0, m_jvs_host, true);
+ COBRA_JVS(config, m_jvs3, 0, m_jvs_host, true);
MACHINE_CONFIG_END
/*****************************************************************************/
diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp
index 5168aed6a24..0e4753f86e5 100644
--- a/src/mame/drivers/naomi.cpp
+++ b/src/mame/drivers/naomi.cpp
@@ -2955,7 +2955,21 @@ MACHINE_CONFIG_START(naomi_state::naomi_base)
// - unrolled NOPs then GPIO toggle - 12.76MHz (or 3.19M NOP instructions per second)
// for now we use higher clock, otherwise earlier NAOMI BIOS revisions will not boot (see MT#06552).
MCFG_MIE_ADD("mie", 16000000, "maple_dc", 0, nullptr, nullptr, nullptr, ":MIE.3", nullptr, ":MIE.5", nullptr, nullptr)
- MCFG_SEGA_837_13551_DEVICE_ADD("837_13551", "mie", ":TILT", ":P1", ":P2", ":A0", ":A1", ":A2", ":A3", ":A4", ":A5", ":A6", ":A7", ":OUTPUT")
+
+ sega_837_13551_device &sega837(SEGA_837_13551(config, "837_13551", 0, "mie"));
+ sega837.set_port_tag<0>("TILT");
+ sega837.set_port_tag<1>("P1");
+ sega837.set_port_tag<2>("P2");
+ sega837.set_port_tag<3>("A0");
+ sega837.set_port_tag<4>("A1");
+ sega837.set_port_tag<5>("A2");
+ sega837.set_port_tag<6>("A3");
+ sega837.set_port_tag<7>("A4");
+ sega837.set_port_tag<8>("A5");
+ sega837.set_port_tag<9>("A6");
+ sega837.set_port_tag<10>("A7");
+ sega837.set_port_tag<11>("OUTPUT");
+
EEPROM_93C46_8BIT(config, "mie_eeprom");
X76F100(config, "naomibd_eeprom");
diff --git a/src/mame/machine/jvs13551.cpp b/src/mame/machine/jvs13551.cpp
index 98464554036..877ccd6302f 100644
--- a/src/mame/machine/jvs13551.cpp
+++ b/src/mame/machine/jvs13551.cpp
@@ -43,9 +43,10 @@ const tiny_rom_entry *sega_837_13551_device::device_rom_region() const
return ROM_NAME(jvs13551);
}
-MACHINE_CONFIG_START(sega_837_13551_device::device_add_mconfig)
- MCFG_DEVICE_ADD("iomcu", TMP90PH44, 10000000) // unknown clock
-MACHINE_CONFIG_END
+void sega_837_13551_device::device_add_mconfig(machine_config &config)
+{
+ TMP90PH44(config, "iomcu", 10000000); // unknown clock
+}
ioport_constructor sega_837_13551_device::device_input_ports() const
{
@@ -53,8 +54,8 @@ ioport_constructor sega_837_13551_device::device_input_ports() const
}
sega_837_13551_device::sega_837_13551_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : jvs_device(mconfig, SEGA_837_13551, tag, owner, clock)
+, port(*this, {finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG, finder_base::DUMMY_TAG})
{
- memset(port_tag, 0, sizeof(port_tag));
}
const char *sega_837_13551_device::device_id()
@@ -80,10 +81,6 @@ uint8_t sega_837_13551_device::comm_method_version()
void sega_837_13551_device::device_start()
{
jvs_device::device_start();
- for (int i = 0; i < ARRAY_LENGTH(port_tag); i++)
- {
- port[i] = ioport(port_tag[i]);
- }
save_item(NAME(coin_counter));
}
diff --git a/src/mame/machine/jvs13551.h b/src/mame/machine/jvs13551.h
index 279937612c9..193877cdb16 100644
--- a/src/mame/machine/jvs13551.h
+++ b/src/mame/machine/jvs13551.h
@@ -7,28 +7,23 @@
#include "machine/jvsdev.h"
-#define MCFG_SEGA_837_13551_DEVICE_ADD(_tag, _host, tilt, d0, d1, a0, a1, a2, a3, a4, a5, a6, a7, out) \
- MCFG_JVS_DEVICE_ADD(_tag, SEGA_837_13551, _host) \
- downcast<sega_837_13551_device &>(*device).set_port_tag(0, tilt); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(1, d0); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(2, d1); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(3, a0); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(4, a1); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(5, a2); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(6, a3); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(7, a4); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(8, a5); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(9, a6); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(10, a7); \
- downcast<sega_837_13551_device &>(*device).set_port_tag(11, out);
class jvs_host;
class sega_837_13551_device : public jvs_device
{
public:
+ template <typename T>
+ sega_837_13551_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&jvs_host_tag)
+ : sega_837_13551_device(mconfig, tag, owner, clock)
+ {
+ host.set_tag(std::forward<T>(jvs_host_tag));
+ }
+
sega_837_13551_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- void set_port_tag(int port, const char *tag) { port_tag[port] = tag; }
+
+ template <uint8_t Which, typename T>
+ void set_port_tag(T &&port_tag) { port[Which].set_tag(std::forward<T>(port_tag)); }
virtual const tiny_rom_entry *device_rom_region() const override;
@@ -57,8 +52,7 @@ protected:
virtual bool swoutputs(uint8_t id, uint8_t val) override;
private:
- const char *port_tag[12];
- ioport_port *port[12];
+ optional_ioport_array<12> port;
uint16_t coin_counter[2];
};