summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/spectrum/exp.h
diff options
context:
space:
mode:
author Nigel Barnes <Pernod70@users.noreply.github.com>2018-09-22 14:32:54 +0100
committer Nigel Barnes <Pernod70@users.noreply.github.com>2018-09-22 14:43:26 +0100
commitbd1fc3d9dc55d640e0512be02868089deb0a5d92 (patch)
treea3d80e7e68fa22a61a6434a1a46a29b61317bc7b /src/devices/bus/spectrum/exp.h
parent63f29019c4e069c331f85e2c661935a57de036a9 (diff)
spectrum: Removed machine().device from expansion devices (nw)
Diffstat (limited to 'src/devices/bus/spectrum/exp.h')
-rw-r--r--src/devices/bus/spectrum/exp.h52
1 files changed, 19 insertions, 33 deletions
diff --git a/src/devices/bus/spectrum/exp.h b/src/devices/bus/spectrum/exp.h
index f795fc05ad8..1d8eb5f21f2 100644
--- a/src/devices/bus/spectrum/exp.h
+++ b/src/devices/bus/spectrum/exp.h
@@ -46,33 +46,6 @@
//**************************************************************************
-// CONSTANTS
-//**************************************************************************
-
-#define SPECTRUM_EXPANSION_SLOT_TAG "exp"
-
-
-//**************************************************************************
-// INTERFACE CONFIGURATION MACROS
-//**************************************************************************
-
-#define MCFG_SPECTRUM_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \
- MCFG_DEVICE_ADD(_tag, SPECTRUM_EXPANSION_SLOT, 0) \
- MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
-
-#define MCFG_SPECTRUM_PASSTHRU_EXPANSION_SLOT_ADD() \
- MCFG_SPECTRUM_EXPANSION_SLOT_ADD(SPECTRUM_EXPANSION_SLOT_TAG, spectrum_expansion_devices, nullptr) \
- MCFG_SPECTRUM_EXPANSION_SLOT_IRQ_HANDLER(WRITELINE(DEVICE_SELF_OWNER, spectrum_expansion_slot_device, irq_w)) \
- MCFG_SPECTRUM_EXPANSION_SLOT_NMI_HANDLER(WRITELINE(DEVICE_SELF_OWNER, spectrum_expansion_slot_device, nmi_w))
-
-#define MCFG_SPECTRUM_EXPANSION_SLOT_IRQ_HANDLER(_devcb) \
- downcast<spectrum_expansion_slot_device &>(*device).set_irq_handler(DEVCB_##_devcb);
-
-#define MCFG_SPECTRUM_EXPANSION_SLOT_NMI_HANDLER(_devcb) \
- downcast<spectrum_expansion_slot_device &>(*device).set_nmi_handler(DEVCB_##_devcb);
-
-
-//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -84,12 +57,23 @@ class spectrum_expansion_slot_device : public device_t, public device_slot_inter
{
public:
// construction/destruction
- spectrum_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- virtual ~spectrum_expansion_slot_device();
+ template <typename T>
+ spectrum_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, const char *default_option)
+ : spectrum_expansion_slot_device(mconfig, tag, owner)
+ {
+ option_reset();
+ slot_options(*this);
+ set_default_option(default_option);
+ set_fixed(false);
+ }
+
+ spectrum_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0);
+
+ void set_io_space(address_space *io);
// callbacks
- template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_nmi_handler(Object &&cb) { return m_nmi_handler.set_callback(std::forward<Object>(cb)); }
+ auto irq_handler() { return m_irq_handler.bind(); }
+ auto nmi_handler() { return m_nmi_handler.bind(); }
DECLARE_READ8_MEMBER( mreq_r );
DECLARE_WRITE8_MEMBER( mreq_w );
@@ -99,6 +83,8 @@ public:
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); }
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); }
+ address_space *m_io;
+
protected:
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const override;
@@ -119,7 +105,7 @@ class device_spectrum_expansion_interface : public device_slot_card_interface
{
public:
// construction/destruction
- virtual ~device_spectrum_expansion_interface();
+ device_spectrum_expansion_interface(const machine_config &mconfig, device_t &device);
// reading and writing
virtual DECLARE_READ8_MEMBER(mreq_r) { return 0xff; }
@@ -128,7 +114,7 @@ public:
virtual DECLARE_READ_LINE_MEMBER(romcs) { return 0; }
protected:
- device_spectrum_expansion_interface(const machine_config &mconfig, device_t &device);
+ address_space &io_space() { return *m_slot->m_io; }
spectrum_expansion_slot_device *m_slot;
};