summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/a2bus
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2014-04-17 05:17:58 +0000
committer Ivan Vangelista <mesgnet@yahoo.it>2014-04-17 05:17:58 +0000
commit7030ff593e2dc3d071b0f1df7d3d9085516cf414 (patch)
tree5d869cc567622035d2cc4b9e40164e6862e5edff /src/emu/bus/a2bus
parent98d70c64a687f6b3b5ea5398f3ea954b6c20b84d (diff)
a2bus_device and a2eauxslot_device: converted to devcb2 (nw)
Diffstat (limited to 'src/emu/bus/a2bus')
-rw-r--r--src/emu/bus/a2bus/a2bus.c50
-rw-r--r--src/emu/bus/a2bus/a2bus.h41
-rw-r--r--src/emu/bus/a2bus/a2eauxslot.c43
-rw-r--r--src/emu/bus/a2bus/a2eauxslot.h35
4 files changed, 64 insertions, 105 deletions
diff --git a/src/emu/bus/a2bus/a2bus.c b/src/emu/bus/a2bus/a2bus.c
index d57bef36dff..1d8e6f668e7 100644
--- a/src/emu/bus/a2bus/a2bus.c
+++ b/src/emu/bus/a2bus/a2bus.c
@@ -128,30 +128,6 @@ void a2bus_device::static_set_cputag(device_t &device, const char *tag)
a2bus.m_cputag = tag;
}
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void a2bus_device::device_config_complete()
-{
- // inherit a copy of the static data
- const a2bus_interface *intf = reinterpret_cast<const a2bus_interface *>(static_config());
- if (intf != NULL)
- {
- *static_cast<a2bus_interface *>(this) = *intf;
- }
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
- memset(&m_out_nmi_cb, 0, sizeof(m_out_nmi_cb));
- memset(&m_out_inh_cb, 0, sizeof(m_out_inh_cb));
- }
-}
-
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@@ -161,12 +137,18 @@ void a2bus_device::device_config_complete()
//-------------------------------------------------
a2bus_device::a2bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
- device_t(mconfig, A2BUS, "Apple II Bus", tag, owner, clock, "a2bus", __FILE__)
+ device_t(mconfig, A2BUS, "Apple II Bus", tag, owner, clock, "a2bus", __FILE__),
+ m_out_irq_cb(*this),
+ m_out_nmi_cb(*this),
+ m_out_inh_cb(*this)
{
}
a2bus_device::a2bus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+ device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ m_out_irq_cb(*this),
+ m_out_nmi_cb(*this),
+ m_out_inh_cb(*this)
{
}
//-------------------------------------------------
@@ -178,9 +160,9 @@ void a2bus_device::device_start()
m_maincpu = machine().device<cpu_device>(m_cputag);
// resolve callbacks
- m_out_irq_func.resolve(m_out_irq_cb, *this);
- m_out_nmi_func.resolve(m_out_nmi_cb, *this);
- m_out_inh_func.resolve(m_out_inh_cb, *this);
+ m_out_irq_cb.resolve_safe();
+ m_out_nmi_cb.resolve_safe();
+ m_out_inh_cb.resolve_safe();
// clear slots
for (int i = 0; i < 8; i++)
@@ -219,22 +201,22 @@ void a2bus_device::add_a2bus_card(int slot, device_a2bus_card_interface *card)
void a2bus_device::set_irq_line(int state)
{
- m_out_irq_func(state);
+ m_out_irq_cb(state);
}
void a2bus_device::set_nmi_line(int state)
{
- m_out_nmi_func(state);
+ m_out_nmi_cb(state);
}
void a2bus_device::set_inh_slotnum(int slot)
{
- m_out_inh_func(slot);
+ m_out_inh_cb(slot);
}
// interrupt request from a2bus card
-WRITE_LINE_MEMBER( a2bus_device::irq_w ) { m_out_irq_func(state); }
-WRITE_LINE_MEMBER( a2bus_device::nmi_w ) { m_out_nmi_func(state); }
+WRITE_LINE_MEMBER( a2bus_device::irq_w ) { m_out_irq_cb(state); }
+WRITE_LINE_MEMBER( a2bus_device::nmi_w ) { m_out_nmi_cb(state); }
//**************************************************************************
// DEVICE CONFIG A2BUS CARD INTERFACE
diff --git a/src/emu/bus/a2bus/a2bus.h b/src/emu/bus/a2bus/a2bus.h
index d08fffdc6e5..4291ddd13ec 100644
--- a/src/emu/bus/a2bus/a2bus.h
+++ b/src/emu/bus/a2bus/a2bus.h
@@ -19,10 +19,18 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_A2BUS_BUS_ADD(_tag, _cputag, _config) \
- MCFG_DEVICE_ADD(_tag, A2BUS, 0) \
- MCFG_DEVICE_CONFIG(_config) \
+#define MCFG_A2BUS_CPU(_cputag) \
a2bus_device::static_set_cputag(*device, _cputag);
+
+#define MCFG_A2BUS_OUT_IRQ_CB(_devcb) \
+ devcb = &a2bus_device::set_out_irq_callback(*device, DEVCB2_##_devcb);
+
+#define MCFG_A2BUS_OUT_NMI_CB(_devcb) \
+ devcb = &a2bus_device::set_out_nmi_callback(*device, DEVCB2_##_devcb);
+
+#define MCFG_A2BUS_OUT_INH_CB(_devcb) \
+ devcb = &a2bus_device::set_out_inh_callback(*device, DEVCB2_##_devcb);
+
#define MCFG_A2BUS_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \
MCFG_DEVICE_ADD(_tag, A2BUS_SLOT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
@@ -35,9 +43,6 @@
MCFG_DEVICE_INPUT_DEFAULTS(_def_inp) \
device_a2bus_card_interface::static_set_a2bus_tag(*device, _nbtag, _tag);
-#define MCFG_A2BUS_BUS_REMOVE(_tag) \
- MCFG_DEVICE_REMOVE(_tag)
-
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -65,26 +70,21 @@ protected:
// device type definition
extern const device_type A2BUS_SLOT;
-// ======================> a2bus_interface
-
-struct a2bus_interface
-{
- devcb_write_line m_out_irq_cb;
- devcb_write_line m_out_nmi_cb;
- devcb_write_line m_out_inh_cb;
-};
class device_a2bus_card_interface;
// ======================> a2bus_device
-class a2bus_device : public device_t,
- public a2bus_interface
+class a2bus_device : public device_t
{
public:
// construction/destruction
a2bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
a2bus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+
// inline configuration
static void static_set_cputag(device_t &device, const char *tag);
+ template<class _Object> static devcb2_base &set_out_irq_callback(device_t &device, _Object object) { return downcast<a2bus_device &>(device).m_out_irq_cb.set_callback(object); }
+ template<class _Object> static devcb2_base &set_out_nmi_callback(device_t &device, _Object object) { return downcast<a2bus_device &>(device).m_out_nmi_cb.set_callback(object); }
+ template<class _Object> static devcb2_base &set_out_inh_callback(device_t &device, _Object object) { return downcast<a2bus_device &>(device).m_out_inh_cb.set_callback(object); }
void add_a2bus_card(int slot, device_a2bus_card_interface *card);
device_a2bus_card_interface *get_a2bus_card(int slot);
@@ -100,14 +100,13 @@ protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
- virtual void device_config_complete();
-
+
// internal state
cpu_device *m_maincpu;
- devcb_resolved_write_line m_out_irq_func;
- devcb_resolved_write_line m_out_nmi_func;
- devcb_resolved_write_line m_out_inh_func;
+ devcb2_write_line m_out_irq_cb;
+ devcb2_write_line m_out_nmi_cb;
+ devcb2_write_line m_out_inh_cb;
device_a2bus_card_interface *m_device_list[8];
const char *m_cputag;
diff --git a/src/emu/bus/a2bus/a2eauxslot.c b/src/emu/bus/a2bus/a2eauxslot.c
index c712d1d2814..a40f9be6454 100644
--- a/src/emu/bus/a2bus/a2eauxslot.c
+++ b/src/emu/bus/a2bus/a2eauxslot.c
@@ -66,29 +66,6 @@ void a2eauxslot_device::static_set_cputag(device_t &device, const char *tag)
a2eauxslot.m_cputag = tag;
}
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void a2eauxslot_device::device_config_complete()
-{
- // inherit a copy of the static data
- const a2eauxslot_interface *intf = reinterpret_cast<const a2eauxslot_interface *>(static_config());
- if (intf != NULL)
- {
- *static_cast<a2eauxslot_interface *>(this) = *intf;
- }
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
- memset(&m_out_nmi_cb, 0, sizeof(m_out_nmi_cb));
- }
-}
-
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@@ -98,12 +75,16 @@ void a2eauxslot_device::device_config_complete()
//-------------------------------------------------
a2eauxslot_device::a2eauxslot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
- device_t(mconfig, A2EAUXSLOT, "Apple IIe AUX Bus", tag, owner, clock, "a2eauxslot", __FILE__)
+ device_t(mconfig, A2EAUXSLOT, "Apple IIe AUX Bus", tag, owner, clock, "a2eauxslot", __FILE__),
+ m_out_irq_cb(*this),
+ m_out_nmi_cb(*this)
{
}
a2eauxslot_device::a2eauxslot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
- device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+ device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ m_out_irq_cb(*this),
+ m_out_nmi_cb(*this)
{
}
//-------------------------------------------------
@@ -115,8 +96,8 @@ void a2eauxslot_device::device_start()
m_maincpu = machine().device<cpu_device>(m_cputag);
// resolve callbacks
- m_out_irq_func.resolve(m_out_irq_cb, *this);
- m_out_nmi_func.resolve(m_out_nmi_cb, *this);
+ m_out_irq_cb.resolve_safe();
+ m_out_nmi_cb.resolve_safe();
// clear slot
m_device = NULL;
@@ -142,17 +123,17 @@ void a2eauxslot_device::add_a2eauxslot_card(device_a2eauxslot_card_interface *ca
void a2eauxslot_device::set_irq_line(int state)
{
- m_out_irq_func(state);
+ m_out_irq_cb(state);
}
void a2eauxslot_device::set_nmi_line(int state)
{
- m_out_nmi_func(state);
+ m_out_nmi_cb(state);
}
// interrupt request from a2eauxslot card
-WRITE_LINE_MEMBER( a2eauxslot_device::irq_w ) { m_out_irq_func(state); }
-WRITE_LINE_MEMBER( a2eauxslot_device::nmi_w ) { m_out_nmi_func(state); }
+WRITE_LINE_MEMBER( a2eauxslot_device::irq_w ) { m_out_irq_cb(state); }
+WRITE_LINE_MEMBER( a2eauxslot_device::nmi_w ) { m_out_nmi_cb(state); }
//**************************************************************************
// DEVICE CONFIG A2EAUXSLOT CARD INTERFACE
diff --git a/src/emu/bus/a2bus/a2eauxslot.h b/src/emu/bus/a2bus/a2eauxslot.h
index a33b2654255..ff527694687 100644
--- a/src/emu/bus/a2bus/a2eauxslot.h
+++ b/src/emu/bus/a2bus/a2eauxslot.h
@@ -18,10 +18,15 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define MCFG_A2EAUXSLOT_BUS_ADD(_tag, _cputag, _config) \
- MCFG_DEVICE_ADD(_tag, A2EAUXSLOT, 0) \
- MCFG_DEVICE_CONFIG(_config) \
+#define MCFG_A2EAUXSLOT_CPU(_cputag) \
a2eauxslot_device::static_set_cputag(*device, _cputag);
+
+#define MCFG_A2EAUXSLOT_OUT_IRQ_CB(_devcb) \
+ devcb = &a2eauxslot_device::set_out_irq_callback(*device, DEVCB2_##_devcb);
+
+#define MCFG_A2EAUXSLOT_OUT_NMI_CB(_devcb) \
+ devcb = &a2eauxslot_device::set_out_nmi_callback(*device, DEVCB2_##_devcb);
+
#define MCFG_A2EAUXSLOT_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \
MCFG_DEVICE_ADD(_tag, A2EAUXSLOT_SLOT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
@@ -29,9 +34,6 @@
#define MCFG_A2EAUXSLOT_SLOT_REMOVE(_tag) \
MCFG_DEVICE_REMOVE(_tag)
-#define MCFG_A2EAUXSLOT_BUS_REMOVE(_tag) \
- MCFG_DEVICE_REMOVE(_tag)
-
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -59,26 +61,22 @@ protected:
// device type definition
extern const device_type A2EAUXSLOT_SLOT;
-// ======================> a2eauxslot_interface
-
-struct a2eauxslot_interface
-{
- devcb_write_line m_out_irq_cb;
- devcb_write_line m_out_nmi_cb;
-};
class device_a2eauxslot_card_interface;
+
// ======================> a2eauxslot_device
-class a2eauxslot_device : public device_t,
- public a2eauxslot_interface
+class a2eauxslot_device : public device_t
{
public:
// construction/destruction
a2eauxslot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
a2eauxslot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+
// inline configuration
static void static_set_cputag(device_t &device, const char *tag);
-
+ template<class _Object> static devcb2_base &set_out_irq_callback(device_t &device, _Object object) { return downcast<a2eauxslot_device &>(device).m_out_irq_cb.set_callback(object); }
+ template<class _Object> static devcb2_base &set_out_nmi_callback(device_t &device, _Object object) { return downcast<a2eauxslot_device &>(device).m_out_nmi_cb.set_callback(object); }
+
void add_a2eauxslot_card(device_a2eauxslot_card_interface *card);
device_a2eauxslot_card_interface *get_a2eauxslot_card();
@@ -92,13 +90,12 @@ protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
- virtual void device_config_complete();
// internal state
cpu_device *m_maincpu;
- devcb_resolved_write_line m_out_irq_func;
- devcb_resolved_write_line m_out_nmi_func;
+ devcb2_write_line m_out_irq_cb;
+ devcb2_write_line m_out_nmi_cb;
device_a2eauxslot_card_interface *m_device;
const char *m_cputag;