diff options
author | Ivan Vangelista <mesgnet@yahoo.it> | 2019-01-31 18:02:11 +0100 |
---|---|---|
committer | Ivan Vangelista <mesgnet@yahoo.it> | 2019-01-31 18:02:11 +0100 |
commit | 49109286af145d9695fac40d836058eac2d97fb5 (patch) | |
tree | 245b70e36993f7e3c7d95d30f93f53b547b856c4 /src/devices | |
parent | 3add98785790f4d4b3585c714f55767f1149817b (diff) |
devices\bus: some MCFG macros removal (nw)
Diffstat (limited to 'src/devices')
38 files changed, 333 insertions, 590 deletions
diff --git a/src/devices/bus/cbmiec/cbmiec.h b/src/devices/bus/cbmiec/cbmiec.h index 6636dba45a2..ceb03d44948 100644 --- a/src/devices/bus/cbmiec/cbmiec.h +++ b/src/devices/bus/cbmiec/cbmiec.h @@ -21,30 +21,6 @@ #define CBM_IEC_TAG "iec_bus" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_CBM_IEC_BUS_ADD() \ - MCFG_DEVICE_ADD(CBM_IEC_TAG, CBM_IEC, 0) - - -#define MCFG_CBM_IEC_SLOT_ADD(_tag, _address, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, CBM_IEC_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ - downcast<cbm_iec_slot_device *>(device)->set_address(_address); - - -#define MCFG_CBM_IEC_ADD(_default_drive) \ - MCFG_CBM_IEC_SLOT_ADD("iec4", 4, cbm_iec_devices, nullptr) \ - MCFG_CBM_IEC_SLOT_ADD("iec8", 8, cbm_iec_devices, _default_drive) \ - MCFG_CBM_IEC_SLOT_ADD("iec9", 9, cbm_iec_devices, nullptr) \ - MCFG_CBM_IEC_SLOT_ADD("iec10", 10, cbm_iec_devices, nullptr) \ - MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, nullptr) \ - MCFG_CBM_IEC_BUS_ADD() - - void cbm_iec_devices(device_slot_interface &device); //************************************************************************** diff --git a/src/devices/bus/gamegear/smsctrladp.cpp b/src/devices/bus/gamegear/smsctrladp.cpp index 7a5eee4ba4b..0b380cba8a0 100644 --- a/src/devices/bus/gamegear/smsctrladp.cpp +++ b/src/devices/bus/gamegear/smsctrladp.cpp @@ -80,9 +80,10 @@ READ32_MEMBER( sms_ctrl_adaptor_device::pixel_r ) // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(sms_ctrl_adaptor_device::device_add_mconfig) - MCFG_SMS_CONTROL_PORT_ADD("ctrl", sms_control_port_devices, "joypad") - MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(*this, sms_ctrl_adaptor_device, th_pin_w)) - MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_ctrl_adaptor_device, pixel_r)) -MACHINE_CONFIG_END +void sms_ctrl_adaptor_device::device_add_mconfig(machine_config &config) +{ + SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad"); + m_subctrl_port->th_input_handler().set(FUNC(sms_ctrl_adaptor_device::th_pin_w)); + m_subctrl_port->pixel_handler().set(FUNC(sms_ctrl_adaptor_device::pixel_r)); +} diff --git a/src/devices/bus/ieee488/c2040fdc.h b/src/devices/bus/ieee488/c2040fdc.h index c73e9826fbf..64239991222 100644 --- a/src/devices/bus/ieee488/c2040fdc.h +++ b/src/devices/bus/ieee488/c2040fdc.h @@ -18,22 +18,6 @@ #include "imagedev/floppy.h" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_C2040_SYNC_CALLBACK(_write) \ - downcast<c2040_fdc_device &>(*device).set_sync_wr_callback(DEVCB_##_write); - -#define MCFG_C2040_READY_CALLBACK(_write) \ - downcast<c2040_fdc_device &>(*device).set_ready_wr_callback(DEVCB_##_write); - -#define MCFG_C2040_ERROR_CALLBACK(_write) \ - downcast<c2040_fdc_device &>(*device).set_error_wr_callback(DEVCB_##_write); - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -46,9 +30,6 @@ public: // construction/destruction c2040_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template <class Object> devcb_base &set_sync_wr_callback(Object &&cb) { return m_write_sync.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ready_wr_callback(Object &&cb) { return m_write_ready.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_error_wr_callback(Object &&cb) { return m_write_error.set_callback(std::forward<Object>(cb)); } auto sync_wr_callback() { return m_write_sync.bind(); } auto ready_wr_callback() { return m_write_ready.bind(); } auto error_wr_callback() { return m_write_error.bind(); } diff --git a/src/devices/bus/macpds/macpds.h b/src/devices/bus/macpds/macpds.h index a12b2a0bcb0..2354549afd5 100644 --- a/src/devices/bus/macpds/macpds.h +++ b/src/devices/bus/macpds/macpds.h @@ -14,17 +14,6 @@ #pragma once - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_MACPDS_ONBOARD_ADD(_nbtag, _tag, _dev_type, _def_inp) \ - MCFG_DEVICE_ADD(_tag, _dev_type, 0) \ - MCFG_DEVICE_INPUT_DEFAULTS(_def_inp) \ - downcast<device_macpds_card_interface &>(*device).set_macpds_tag(_nbtag, _tag); - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** diff --git a/src/devices/bus/nubus/nubus.h b/src/devices/bus/nubus/nubus.h index da7c784a6a7..2d42a4edd26 100644 --- a/src/devices/bus/nubus/nubus.h +++ b/src/devices/bus/nubus/nubus.h @@ -14,42 +14,6 @@ #pragma once - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_NUBUS_CPU(_cputag) \ - downcast<nubus_device &>(*device).set_cputag(_cputag); - -#define MCFG_NUBUS_OUT_IRQ9_CB(_devcb) \ - downcast<nubus_device &>(*device).set_out_irq9_callback(DEVCB_##_devcb); - -#define MCFG_NUBUS_OUT_IRQA_CB(_devcb) \ - downcast<nubus_device &>(*device).set_out_irqa_callback(DEVCB_##_devcb); - -#define MCFG_NUBUS_OUT_IRQB_CB(_devcb) \ - downcast<nubus_device &>(*device).set_out_irqb_callback(DEVCB_##_devcb); - -#define MCFG_NUBUS_OUT_IRQC_CB(_devcb) \ - downcast<nubus_device &>(*device).set_out_irqc_callback(DEVCB_##_devcb); - -#define MCFG_NUBUS_OUT_IRQD_CB(_devcb) \ - downcast<nubus_device &>(*device).set_out_irqd_callback(DEVCB_##_devcb); - -#define MCFG_NUBUS_OUT_IRQE_CB(_devcb) \ - downcast<nubus_device &>(*device).set_out_irqe_callback(DEVCB_##_devcb); - -#define MCFG_NUBUS_SLOT_ADD(_nbtag, _tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, NUBUS_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ - downcast<nubus_slot_device &>(*device).set_nubus_slot(_nbtag, _tag); - -#define MCFG_NUBUS_ONBOARD_ADD(_nbtag, _tag, _dev_type, _def_inp) \ - MCFG_DEVICE_ADD(_tag, _dev_type, 0) \ - MCFG_DEVICE_INPUT_DEFAULTS(_def_inp) \ - downcast<device_nubus_card_interface &>(*device).set_nubus_tag(_nbtag, _tag); - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -99,12 +63,6 @@ public: // inline configuration void set_cputag(const char *tag) { m_cputag = tag; } - template <class Object> devcb_base &set_out_irq9_callback(Object &&cb) { return m_out_irq9_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_out_irqa_callback(Object &&cb) { return m_out_irqa_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_out_irqb_callback(Object &&cb) { return m_out_irqb_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_out_irqc_callback(Object &&cb) { return m_out_irqc_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_out_irqd_callback(Object &&cb) { return m_out_irqd_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_out_irqe_callback(Object &&cb) { return m_out_irqe_cb.set_callback(std::forward<Object>(cb)); } auto out_irq9_callback() { return m_out_irq9_cb.bind(); } auto out_irqa_callback() { return m_out_irqa_cb.bind(); } auto out_irqb_callback() { return m_out_irqb_cb.bind(); } diff --git a/src/devices/bus/plus4/sid.cpp b/src/devices/bus/plus4/sid.cpp index f97deec6310..c5c0f3421e0 100644 --- a/src/devices/bus/plus4/sid.cpp +++ b/src/devices/bus/plus4/sid.cpp @@ -64,13 +64,13 @@ const tiny_rom_entry *plus4_sid_cartridge_device::device_rom_region() const // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(plus4_sid_cartridge_device::device_add_mconfig) +void plus4_sid_cartridge_device::device_add_mconfig(machine_config &config) +{ SPEAKER(config, "speaker").front_center(); - MCFG_DEVICE_ADD(MOS8580_TAG, MOS8580, XTAL(17'734'470)/20) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0) + MOS8580(config, m_sid, XTAL(17'734'470)/20).add_route(ALL_OUTPUTS, "speaker", 1.0); - MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, nullptr) -MACHINE_CONFIG_END + VCS_CONTROL_PORT(config, m_joy, vcs_control_port_devices, nullptr); +} diff --git a/src/devices/bus/psx/ctlrport.cpp b/src/devices/bus/psx/ctlrport.cpp index b3c34f8b2b5..05aae5c5b72 100644 --- a/src/devices/bus/psx/ctlrport.cpp +++ b/src/devices/bus/psx/ctlrport.cpp @@ -25,9 +25,10 @@ void psx_controller_port_device::device_config_complete() m_dev = dynamic_cast<device_psx_controller_interface *>(get_card_device()); } -MACHINE_CONFIG_START(psx_controller_port_device::device_add_mconfig) - MCFG_PSXCARD_ADD("card") -MACHINE_CONFIG_END +void psx_controller_port_device::device_add_mconfig(machine_config &config) +{ + PSXCARD(config, m_card, 0); +} void psx_controller_port_device::disable_card(bool state) { diff --git a/src/devices/bus/psx/ctlrport.h b/src/devices/bus/psx/ctlrport.h index 718ac8fb35d..2058cf4868c 100644 --- a/src/devices/bus/psx/ctlrport.h +++ b/src/devices/bus/psx/ctlrport.h @@ -77,11 +77,6 @@ private: required_ioport m_pad1; }; -#define MCFG_PSX_CONTROLLER_PORTS_DSR_HANDLER(_devcb) \ - downcast<psxcontrollerports_device &>(*device).set_dsr_handler(DEVCB_##_devcb); - -#define MCFG_PSX_CONTROLLER_PORTS_RXD_HANDLER(_devcb) \ - downcast<psxcontrollerports_device &>(*device).set_rxd_handler(DEVCB_##_devcb); class psxcontrollerports_device : public device_t { diff --git a/src/devices/bus/psx/memcard.h b/src/devices/bus/psx/memcard.h index 51ac4f044ba..e292d89e589 100644 --- a/src/devices/bus/psx/memcard.h +++ b/src/devices/bus/psx/memcard.h @@ -8,8 +8,6 @@ class psx_controller_port_device; -#define MCFG_PSXCARD_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, PSXCARD, 0) class psxcard_device : public device_t, public device_image_interface diff --git a/src/devices/bus/saturn/sat_slot.h b/src/devices/bus/saturn/sat_slot.h index 4d94ea472d6..63a9ae0dbca 100644 --- a/src/devices/bus/saturn/sat_slot.h +++ b/src/devices/bus/saturn/sat_slot.h @@ -67,7 +67,16 @@ class sat_cart_slot_device : public device_t, { public: // construction/destruction - sat_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + sat_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : sat_cart_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + sat_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~sat_cart_slot_device(); // image-level overrides @@ -117,9 +126,4 @@ DECLARE_DEVICE_TYPE(SATURN_CART_SLOT, sat_cart_slot_device) #define SATSLOT_ROM_REGION_TAG ":cart:rom" -#define MCFG_SATURN_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ - MCFG_DEVICE_ADD(_tag, SATURN_CART_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - - #endif // MAME_BUS_SATURN_SAT_SLOT_H diff --git a/src/devices/bus/scv/slot.h b/src/devices/bus/scv/slot.h index 5dc3ec6e5b7..357c593c404 100644 --- a/src/devices/bus/scv/slot.h +++ b/src/devices/bus/scv/slot.h @@ -66,7 +66,17 @@ class scv_cart_slot_device : public device_t, { public: // construction/destruction - scv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + scv_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : scv_cart_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + + scv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~scv_cart_slot_device(); // image-level overrides @@ -116,8 +126,4 @@ DECLARE_DEVICE_TYPE(SCV_CART_SLOT, scv_cart_slot_device) #define SCVSLOT_ROM_REGION_TAG ":cart:rom" -#define MCFG_SCV_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ - MCFG_DEVICE_ADD(_tag, SCV_CART_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - #endif // MAME_BUS_SCV_SLOT_H diff --git a/src/devices/bus/sg1000_exp/sg1000exp.h b/src/devices/bus/sg1000_exp/sg1000exp.h index 9a21c263407..c132b48d9dd 100644 --- a/src/devices/bus/sg1000_exp/sg1000exp.h +++ b/src/devices/bus/sg1000_exp/sg1000exp.h @@ -15,20 +15,6 @@ #pragma once - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_SG1000_EXPANSION_ADD(_tag, _slot_intf, _def_slot, _fixed) \ - MCFG_DEVICE_ADD(_tag, SG1000_EXPANSION_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed) -#define MCFG_SG1000_EXPANSION_MODIFY(_tag) \ - MCFG_DEVICE_MODIFY(_tag) - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -41,7 +27,17 @@ class sg1000_expansion_slot_device : public device_t, public device_slot_interfa { public: // construction/destruction - sg1000_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + sg1000_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, bool const fixed) + : sg1000_expansion_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(fixed); + } + + sg1000_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~sg1000_expansion_slot_device(); DECLARE_READ8_MEMBER(read); diff --git a/src/devices/bus/sms_ctrl/multitap.cpp b/src/devices/bus/sms_ctrl/multitap.cpp index 56e7144cbd5..88dbe01acf4 100644 --- a/src/devices/bus/sms_ctrl/multitap.cpp +++ b/src/devices/bus/sms_ctrl/multitap.cpp @@ -129,15 +129,16 @@ READ32_MEMBER( sms_multitap_device::pixel_r ) } -MACHINE_CONFIG_START(sms_multitap_device::device_add_mconfig) +void sms_multitap_device::device_add_mconfig(machine_config &config) +{ // Controller subports setup, without the TH callback declaration, // because the circuit scheme shows TH of subports without connection. - MCFG_SMS_CONTROL_PORT_ADD("ctrl1", sms_control_port_devices, "joypad") - MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_multitap_device, pixel_r)) - MCFG_SMS_CONTROL_PORT_ADD("ctrl2", sms_control_port_devices, "joypad") - MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_multitap_device, pixel_r)) - MCFG_SMS_CONTROL_PORT_ADD("ctrl3", sms_control_port_devices, "joypad") - MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_multitap_device, pixel_r)) - MCFG_SMS_CONTROL_PORT_ADD("ctrl4", sms_control_port_devices, "joypad") - MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_multitap_device, pixel_r)) -MACHINE_CONFIG_END + SMS_CONTROL_PORT(config, m_subctrl1_port, sms_control_port_devices, "joypad"); + m_subctrl1_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r)); + SMS_CONTROL_PORT(config, m_subctrl2_port, sms_control_port_devices, "joypad"); + m_subctrl2_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r)); + SMS_CONTROL_PORT(config, m_subctrl3_port, sms_control_port_devices, "joypad"); + m_subctrl3_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r)); + SMS_CONTROL_PORT(config, m_subctrl4_port, sms_control_port_devices, "joypad"); + m_subctrl4_port->pixel_handler().set(FUNC(sms_multitap_device::pixel_r)); +} diff --git a/src/devices/bus/sms_ctrl/rfu.cpp b/src/devices/bus/sms_ctrl/rfu.cpp index 7b51da5983a..36a081abcd1 100644 --- a/src/devices/bus/sms_ctrl/rfu.cpp +++ b/src/devices/bus/sms_ctrl/rfu.cpp @@ -138,8 +138,9 @@ READ32_MEMBER( sms_rapid_fire_device::pixel_r ) } -MACHINE_CONFIG_START(sms_rapid_fire_device::device_add_mconfig) - MCFG_SMS_CONTROL_PORT_ADD("ctrl", sms_control_port_devices, "joypad") - MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(WRITELINE(*this, sms_rapid_fire_device, th_pin_w)) - MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(READ32(*this, sms_rapid_fire_device, pixel_r)) -MACHINE_CONFIG_END +void sms_rapid_fire_device::device_add_mconfig(machine_config &config) +{ + SMS_CONTROL_PORT(config, m_subctrl_port, sms_control_port_devices, "joypad"); + m_subctrl_port->th_input_handler().set(FUNC(sms_rapid_fire_device::th_pin_w)); + m_subctrl_port->pixel_handler().set(FUNC(sms_rapid_fire_device::pixel_r)); +} diff --git a/src/devices/bus/sms_ctrl/smsctrl.h b/src/devices/bus/sms_ctrl/smsctrl.h index d116f2c769d..3d11b4e60bd 100644 --- a/src/devices/bus/sms_ctrl/smsctrl.h +++ b/src/devices/bus/sms_ctrl/smsctrl.h @@ -16,26 +16,6 @@ //************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_SMS_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, SMS_CONTROL_PORT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) -#define MCFG_SMS_CONTROL_PORT_MODIFY(_tag) \ - MCFG_DEVICE_MODIFY(_tag) - - -#define MCFG_SMS_CONTROL_PORT_TH_INPUT_HANDLER(_devcb) \ - downcast<sms_control_port_device &>(*device).set_th_input_handler(DEVCB_##_devcb); - - -#define MCFG_SMS_CONTROL_PORT_PIXEL_HANDLER(_devcb) \ - downcast<sms_control_port_device &>(*device).set_pixel_handler(DEVCB_##_devcb); - - - -//************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -48,13 +28,23 @@ class sms_control_port_device : public device_t, { public: // construction/destruction + template <typename T> + sms_control_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : sms_control_port_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + sms_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~sms_control_port_device(); // static configuration helpers - template <class Object> devcb_base &set_th_input_handler(Object &&cb) { return m_th_pin_handler.set_callback(std::forward<Object>(cb)); } + auto th_input_handler() { return m_th_pin_handler.bind(); } - template <class Object> devcb_base &set_pixel_handler(Object &&cb) { return m_pixel_handler.set_callback(std::forward<Object>(cb)); } + auto pixel_handler() { return m_pixel_handler.bind(); } // Physical DE-9 connector interface diff --git a/src/devices/bus/sms_exp/smsexp.h b/src/devices/bus/sms_exp/smsexp.h index b53027af51e..6933b9a9df8 100644 --- a/src/devices/bus/sms_exp/smsexp.h +++ b/src/devices/bus/sms_exp/smsexp.h @@ -15,18 +15,6 @@ #pragma once - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_SMS_EXPANSION_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, SMS_EXPANSION_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -61,7 +49,16 @@ class sms_expansion_slot_device : public device_t, { public: // construction/destruction - sms_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + sms_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : sms_expansion_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + sms_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~sms_expansion_slot_device(); // reading and writing diff --git a/src/devices/bus/snes_ctrl/ctrl.h b/src/devices/bus/snes_ctrl/ctrl.h index 686db2f29e2..37db69537cc 100644 --- a/src/devices/bus/snes_ctrl/ctrl.h +++ b/src/devices/bus/snes_ctrl/ctrl.h @@ -51,7 +51,7 @@ public: // construction/destruction template <typename T> snes_control_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) - : snes_control_port_device(mconfig, tag, owner, (uint32_t)0) + : snes_control_port_device(mconfig, tag, owner, 0) { option_reset(); opts(*this); @@ -61,8 +61,8 @@ public: snes_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~snes_control_port_device(); - template <typename Object> void set_onscreen_callback(Object &&cb) { m_onscreen_cb = std::forward<Object>(cb); } - template <typename Object> void set_gunlatch_callback(Object &&cb) { m_gunlatch_cb = std::forward<Object>(cb); } + template <typename... T> void set_onscreen_callback(T &&... args) { m_onscreen_cb = snesctrl_onscreen_delegate(std::forward<T>(args)...); } + template <typename... T> void set_gunlatch_callback(T &&... args) { m_gunlatch_cb = snesctrl_gunlatch_delegate(std::forward<T>(args)...); } uint8_t read_pin4(); uint8_t read_pin5(); @@ -87,22 +87,6 @@ protected: // device type definition DECLARE_DEVICE_TYPE(SNES_CONTROL_PORT, snes_control_port_device) - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_SNES_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, SNES_CONTROL_PORT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - -#define MCFG_SNESCTRL_ONSCREEN_CB(_class, _method) \ - downcast<snes_control_port_device &>(*device).set_onscreen_callback(snesctrl_onscreen_delegate(&_class::_method, #_class "::" #_method, this)); - -#define MCFG_SNESCTRL_GUNLATCH_CB(_class, _method) \ - downcast<snes_control_port_device &>(*device).set_gunlatch_callback(snesctrl_gunlatch_delegate(&_class::_method, #_class "::" #_method, this)); - - void snes_control_port_devices(device_slot_interface &device); diff --git a/src/devices/bus/snes_ctrl/multitap.cpp b/src/devices/bus/snes_ctrl/multitap.cpp index 262ef56fd26..ef630439276 100644 --- a/src/devices/bus/snes_ctrl/multitap.cpp +++ b/src/devices/bus/snes_ctrl/multitap.cpp @@ -47,12 +47,13 @@ static void snes_multitap(device_slot_interface &device) // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(snes_multitap_device::device_add_mconfig) - MCFG_SNES_CONTROL_PORT_ADD("port1", snes_multitap, "joypad") - MCFG_SNES_CONTROL_PORT_ADD("port2", snes_multitap, "joypad") - MCFG_SNES_CONTROL_PORT_ADD("port3", snes_multitap, "joypad") - MCFG_SNES_CONTROL_PORT_ADD("port4", snes_multitap, "joypad") -MACHINE_CONFIG_END +void snes_multitap_device::device_add_mconfig(machine_config &config) +{ + SNES_CONTROL_PORT(config, m_port1, snes_multitap, "joypad"); + SNES_CONTROL_PORT(config, m_port2, snes_multitap, "joypad"); + SNES_CONTROL_PORT(config, m_port3, snes_multitap, "joypad"); + SNES_CONTROL_PORT(config, m_port4, snes_multitap, "joypad"); +} //************************************************************************** diff --git a/src/devices/bus/ss50/interface.h b/src/devices/bus/ss50/interface.h index 1865eda6324..ff195c1bc7e 100644 --- a/src/devices/bus/ss50/interface.h +++ b/src/devices/bus/ss50/interface.h @@ -11,19 +11,6 @@ #ifndef MAME_DEVICES_BUS_SS50_INTERFACE_H #define MAME_DEVICES_BUS_SS50_INTERFACE_H -//************************************************************************** -// CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_SS50_INTERFACE_PORT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, SS50_INTERFACE, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(ss50_##_slot_intf, _def_slot, false) - -#define MCFG_SS50_INTERFACE_IRQ_CALLBACK(_devcb) \ - downcast<ss50_interface_port_device &>(*device).set_irq_cb(DEVCB_##_devcb); - -#define MCFG_SS50_INTERFACE_FIRQ_CALLBACK(_devcb) \ - downcast<ss50_interface_port_device &>(*device).set_firq_cb(DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS @@ -40,11 +27,21 @@ class ss50_interface_port_device : public device_t, public device_slot_interface public: // construction/destruction - ss50_interface_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + template <typename T> + ss50_interface_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : ss50_interface_port_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + + ss50_interface_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); // static configuration - template<class Object> devcb_base &set_irq_cb(Object &&object) { return m_irq_cb.set_callback(std::forward<Object>(object)); } - template<class Object> devcb_base &set_firq_cb(Object &&object) { return m_firq_cb.set_callback(std::forward<Object>(object)); } + auto irq_cb() { return m_irq_cb.bind(); } + auto firq_cb() { return m_firq_cb.bind(); } // memory accesses DECLARE_READ8_MEMBER(read); diff --git a/src/devices/bus/svi3x8/expander/expander.h b/src/devices/bus/svi3x8/expander/expander.h index 549a17c5970..b832fece8dd 100644 --- a/src/devices/bus/svi3x8/expander/expander.h +++ b/src/devices/bus/svi3x8/expander/expander.h @@ -40,36 +40,6 @@ #pragma once - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_SVI_EXPANDER_BUS_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, SVI_EXPANDER, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(svi_expander_modules, nullptr, false) -#define MCFG_SVI_EXPANDER_INT_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_int_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_ROMDIS_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_romdis_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_RAMDIS_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_ramdis_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_CTRL1_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_ctrl1_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_CTRL2_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_ctrl2_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_EXCSR_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_excsr_handler(DEVCB_##_devcb); - -#define MCFG_SVI_EXPANDER_EXCSW_HANDLER(_devcb) \ - downcast<svi_expander_device &>(*device).set_excsw_handler(DEVCB_##_devcb); - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -82,17 +52,27 @@ class svi_expander_device : public device_t, public device_slot_interface { public: // construction/destruction + template <typename T> + svi_expander_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts) + : svi_expander_device(mconfig, tag, owner, uint32_t(0)) + { + option_reset(); + opts(*this); + set_default_option(nullptr); + set_fixed(false); + } + svi_expander_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~svi_expander_device(); // callbacks - template <class Object> devcb_base &set_int_handler(Object &&cb) { return m_int_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_romdis_handler(Object &&cb) { return m_romdis_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ramdis_handler(Object &&cb) { return m_ramdis_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ctrl1_handler(Object &&cb) { return m_ctrl1_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ctrl2_handler(Object &&cb) { return m_ctrl2_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_excsr_handler(Object &&cb) { return m_excsr_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_excsw_handler(Object &&cb) { return m_excsw_handler.set_callback(std::forward<Object>(cb)); } + auto int_handler() { return m_int_handler.bind(); } + auto romdis_handler() { return m_romdis_handler.bind(); } + auto ramdis_handler() { return m_ramdis_handler.bind(); } + auto ctrl1_handler() { return m_ctrl1_handler.bind(); } + auto ctrl2_handler() { return m_ctrl2_handler.bind(); } + auto excsr_handler() { return m_excsr_handler.bind(); } + auto excsw_handler() { return m_excsw_handler.bind(); } // called from cart device DECLARE_WRITE_LINE_MEMBER( int_w ) { m_int_handler(state); } diff --git a/src/devices/bus/svi3x8/expander/sv601.cpp b/src/devices/bus/svi3x8/expander/sv601.cpp index 51a51241897..cf112d800dc 100644 --- a/src/devices/bus/svi3x8/expander/sv601.cpp +++ b/src/devices/bus/svi3x8/expander/sv601.cpp @@ -20,19 +20,20 @@ DEFINE_DEVICE_TYPE(SV601, sv601_device, "sv601", "SV-601 Super Expander") // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(sv601_device::device_add_mconfig) - MCFG_SVI_SLOT_BUS_ADD - MCFG_SVI_SLOT_INT_HANDLER(WRITELINE(*this, sv601_device, int_w)) - MCFG_SVI_SLOT_ROMDIS_HANDLER(WRITELINE(*this, sv601_device, romdis_w)) - MCFG_SVI_SLOT_RAMDIS_HANDLER(WRITELINE(*this, sv601_device, ramdis_w)) - MCFG_SVI_SLOT_ADD("0", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("1", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("2", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("3", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("4", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("5", svi_slot_cards, nullptr) - MCFG_SVI_SLOT_ADD("6", svi_slot_cards, nullptr) -MACHINE_CONFIG_END +void sv601_device::device_add_mconfig(machine_config &config) +{ + SVI_SLOT_BUS(config, m_slotbus, 0); + m_slotbus->int_handler().set(FUNC(sv601_device::int_w)); + m_slotbus->romdis_handler().set(FUNC(sv601_device::romdis_w)); + m_slotbus->ramdis_handler().set(FUNC(sv601_device::ramdis_w)); + SVI_SLOT(config, "0", svi_slot_cards, nullptr); + SVI_SLOT(config, "1", svi_slot_cards, nullptr); + SVI_SLOT(config, "2", svi_slot_cards, nullptr); + SVI_SLOT(config, "3", svi_slot_cards, nullptr); + SVI_SLOT(config, "4", svi_slot_cards, nullptr); + SVI_SLOT(config, "5", svi_slot_cards, nullptr); + SVI_SLOT(config, "6", svi_slot_cards, nullptr); +} //************************************************************************** diff --git a/src/devices/bus/svi3x8/expander/sv602.cpp b/src/devices/bus/svi3x8/expander/sv602.cpp index b7c657bddce..d4d288437bf 100644 --- a/src/devices/bus/svi3x8/expander/sv602.cpp +++ b/src/devices/bus/svi3x8/expander/sv602.cpp @@ -20,13 +20,14 @@ DEFINE_DEVICE_TYPE(SV602, sv602_device, "sv602", "SV-602 Single Slot Expander") // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(sv602_device::device_add_mconfig) - MCFG_SVI_SLOT_BUS_ADD - MCFG_SVI_SLOT_INT_HANDLER(WRITELINE(*this, sv602_device, int_w)) - MCFG_SVI_SLOT_ROMDIS_HANDLER(WRITELINE(*this, sv602_device, romdis_w)) - MCFG_SVI_SLOT_RAMDIS_HANDLER(WRITELINE(*this, sv602_device, ramdis_w)) - MCFG_SVI_SLOT_ADD("0", sv602_slot_cards, nullptr) -MACHINE_CONFIG_END +void sv602_device::device_add_mconfig(machine_config &config) +{ + SVI_SLOT_BUS(config, m_slotbus, 0); + m_slotbus->int_handler().set(FUNC(sv602_device::int_w)); + m_slotbus->romdis_handler().set(FUNC(sv602_device::romdis_w)); + m_slotbus->ramdis_handler().set(FUNC(sv602_device::ramdis_w)); + SVI_SLOT(config, "0", sv602_slot_cards, nullptr); +} //************************************************************************** diff --git a/src/devices/bus/svi3x8/slot/slot.h b/src/devices/bus/svi3x8/slot/slot.h index 702c005b770..3975624eb5a 100644 --- a/src/devices/bus/svi3x8/slot/slot.h +++ b/src/devices/bus/svi3x8/slot/slot.h @@ -40,29 +40,6 @@ #pragma once - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_SVI_SLOT_BUS_ADD \ - MCFG_DEVICE_ADD("slotbus", SVI_SLOT_BUS, 0) - -#define MCFG_SVI_SLOT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, SVI_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ - downcast<svi_slot_device &>(*device).set_bus(this, "slotbus"); - -#define MCFG_SVI_SLOT_INT_HANDLER(_devcb) \ - downcast<svi_slot_bus_device &>(*device).set_int_handler(DEVCB_##_devcb); - -#define MCFG_SVI_SLOT_ROMDIS_HANDLER(_devcb) \ - downcast<svi_slot_bus_device &>(*device).set_romdis_handler(DEVCB_##_devcb); - -#define MCFG_SVI_SLOT_RAMDIS_HANDLER(_devcb) \ - downcast<svi_slot_bus_device &>(*device).set_ramdis_handler(DEVCB_##_devcb); - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -79,9 +56,9 @@ public: virtual ~svi_slot_bus_device(); // callbacks - template <class Object> devcb_base &set_int_handler(Object &&cb) { return m_int_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_romdis_handler(Object &&cb) { return m_romdis_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ramdis_handler(Object &&cb) { return m_ramdis_handler.set_callback(std::forward<Object>(cb)); } + auto int_handler() { return m_int_handler.bind(); } + auto romdis_handler() { return m_romdis_handler.bind(); } + auto ramdis_handler() { return m_ramdis_handler.bind(); } void add_card(device_svi_slot_interface *card); @@ -122,6 +99,17 @@ class svi_slot_device : public device_t, public device_slot_interface { public: // construction/destruction + template <typename T> + svi_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : svi_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + set_bus(this, "slot_bus"); + } + svi_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // inline configuration diff --git a/src/devices/bus/ti8x/teeconn.cpp b/src/devices/bus/ti8x/teeconn.cpp index a251ee1ca4b..7277d4af93e 100644 --- a/src/devices/bus/ti8x/teeconn.cpp +++ b/src/devices/bus/ti8x/teeconn.cpp @@ -61,15 +61,16 @@ WRITE_LINE_MEMBER(tee_connector_device::ring_b_w) } -MACHINE_CONFIG_START(tee_connector_device::device_add_mconfig) - MCFG_DEVICE_ADD(m_port_a, TI8X_LINK_PORT, default_ti8x_link_devices, nullptr) - MCFG_TI8X_LINK_TIP_HANDLER(WRITELINE(*this, tee_connector_device, tip_a_w)) - MCFG_TI8X_LINK_RING_HANDLER(WRITELINE(*this, tee_connector_device, ring_a_w)) - - MCFG_DEVICE_ADD(m_port_b, TI8X_LINK_PORT, default_ti8x_link_devices, nullptr) - MCFG_TI8X_LINK_TIP_HANDLER(WRITELINE(*this, tee_connector_device, tip_b_w)) - MCFG_TI8X_LINK_RING_HANDLER(WRITELINE(*this, tee_connector_device, ring_b_w)) -MACHINE_CONFIG_END +void tee_connector_device::device_add_mconfig(machine_config &config) +{ + TI8X_LINK_PORT(config, m_port_a, default_ti8x_link_devices, nullptr); + m_port_a->tip_handler().set(FUNC(tee_connector_device::tip_a_w)); + m_port_a->ring_handler().set(FUNC(tee_connector_device::ring_a_w)); + + TI8X_LINK_PORT(config, m_port_b, default_ti8x_link_devices, nullptr); + m_port_b->tip_handler().set(FUNC(tee_connector_device::tip_b_w)); + m_port_b->ring_handler().set(FUNC(tee_connector_device::ring_b_w)); +} void tee_connector_device::device_start() diff --git a/src/devices/bus/ti8x/ti8x.h b/src/devices/bus/ti8x/ti8x.h index 1a01aeda2e3..e81a4fc5a9e 100644 --- a/src/devices/bus/ti8x/ti8x.h +++ b/src/devices/bus/ti8x/ti8x.h @@ -42,13 +42,6 @@ DECLARE_DEVICE_TYPE(TI8X_LINK_PORT, ti8x_link_port_device) -#define MCFG_TI8X_LINK_TIP_HANDLER(cb) \ - downcast<ti8x_link_port_device &>(*device).set_tip_handler(DEVCB_##cb); - -#define MCFG_TI8X_LINK_RING_HANDLER(cb) \ - downcast<ti8x_link_port_device &>(*device).set_ring_handler(DEVCB_##cb); - - class device_ti8x_link_port_interface; @@ -67,8 +60,8 @@ public: ti8x_link_port_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0); // static configuration helpers - template <class Object> devcb_base &set_tip_handler(Object &&cb) { return m_tip_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ring_handler(Object &&cb) { return m_ring_handler.set_callback(std::forward<Object>(cb)); } + auto tip_handler() { return m_tip_handler.bind(); } + auto ring_handler() { return m_ring_handler.bind(); } DECLARE_WRITE_LINE_MEMBER(tip_w); DECLARE_WRITE_LINE_MEMBER(ring_w); diff --git a/src/devices/bus/tiki100/exp.h b/src/devices/bus/tiki100/exp.h index fb82a62fdce..a36e0ac3419 100644 --- a/src/devices/bus/tiki100/exp.h +++ b/src/devices/bus/tiki100/exp.h @@ -25,36 +25,6 @@ #define TIKI100_BUS_TAG "tiki100bus" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_TIKI100_BUS_ADD() \ - MCFG_DEVICE_ADD(TIKI100_BUS_TAG, TIKI100_BUS, 0) - -#define MCFG_TIKI100_BUS_SLOT_ADD(_tag, _def_slot) \ - MCFG_DEVICE_ADD(_tag, TIKI100_BUS_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(tiki100_cards, _def_slot, false) - - -#define MCFG_TIKI100_BUS_IRQ_CALLBACK(_write) \ - downcast<tiki100_bus_device &>(*device).set_irq_wr_callback(DEVCB_##_write); - -#define MCFG_TIKI100_BUS_NMI_CALLBACK(_write) \ - downcast<tiki100_bus_device &>(*device).set_nmi_wr_callback(DEVCB_##_write); - -#define MCFG_TIKI100_BUS_BUSRQ_CALLBACK(_write) \ - downcast<tiki100_bus_device &>(*device).set_busrq_wr_callback(DEVCB_##_write); - -#define MCFG_TIKI100_BUS_IN_MREQ_CALLBACK(_read) \ - downcast<tiki100_bus_device &>(*device).set_mrq_rd_callback(DEVCB_##_read); - -#define MCFG_TIKI100_BUS_OUT_MREQ_CALLBACK(_write) \ - downcast<tiki100_bus_device &>(*device).set_mrq_wr_callback(DEVCB_##_write); - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -111,7 +81,17 @@ class tiki100_bus_slot_device : public device_t, { public: // construction/destruction - tiki100_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + tiki100_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt) + : tiki100_bus_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + + tiki100_bus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); // device-level overrides virtual void device_start() override; @@ -142,11 +122,11 @@ public: tiki100_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ~tiki100_bus_device() { m_device_list.detach_all(); } - template <class Object> devcb_base &set_irq_wr_callback(Object &&cb) { return m_irq_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_nmi_wr_callback(Object &&cb) { return m_nmi_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_busrq_wr_callback(Object &&cb) { return m_busrq_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_mrq_rd_callback(Object &&cb) { return m_in_mrq_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_mrq_wr_callback(Object &&cb) { return m_out_mrq_cb.set_callback(std::forward<Object>(cb)); } + auto irq_wr_callback() { return m_irq_cb.bind(); } + auto nmi_wr_callback() { return m_nmi_cb.bind(); } + auto busrq_wr_callback() { return m_busrq_cb.bind(); } + auto mrq_rd_callback() { return m_in_mrq_cb.bind(); } + auto mrq_wr_callback() { return m_out_mrq_cb.bind(); } void add_card(device_tiki100bus_card_interface *card); diff --git a/src/devices/bus/tmc600/euro.h b/src/devices/bus/tmc600/euro.h index 7fe8c3c0ff6..51a4e435f2f 100644 --- a/src/devices/bus/tmc600/euro.h +++ b/src/devices/bus/tmc600/euro.h @@ -56,17 +56,6 @@ #define TMC600_EURO_BUS_TAG "bus" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_TMC600_EURO_BUS_SLOT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, TMC600_EURO_BUS_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -96,7 +85,17 @@ class tmc600_euro_bus_slot_t : public device_t, { public: // construction/destruction - tmc600_euro_bus_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + tmc600_euro_bus_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt) + : tmc600_euro_bus_slot_t(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + + tmc600_euro_bus_slot_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); protected: // device-level overrides diff --git a/src/devices/bus/tvc/tvc.h b/src/devices/bus/tvc/tvc.h index 584e121f428..09ba7b35ffd 100644 --- a/src/devices/bus/tvc/tvc.h +++ b/src/devices/bus/tvc/tvc.h @@ -91,11 +91,21 @@ class tvcexp_slot_device : public device_t, { public: // construction/destruction - tvcexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + tvcexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt) + : tvcexp_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + + tvcexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~tvcexp_slot_device(); - template <class Object> devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward<Object>(cb)); } + auto out_irq_callback() { return m_out_irq_cb.bind(); } + auto out_nmi_callback() { return m_out_nmi_cb.bind(); } // reading and writing virtual uint8_t id_r(); @@ -120,14 +130,4 @@ protected: DECLARE_DEVICE_TYPE(TVCEXP_SLOT, tvcexp_slot_device) -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_TVCEXP_SLOT_OUT_IRQ_CB(_devcb) \ - downcast<tvcexp_slot_device &>(*device).set_out_irq_callback(DEVCB_##_devcb); - -#define MCFG_TVCEXP_SLOT_OUT_NMI_CB(_devcb) \ - downcast<tvcexp_slot_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb); - #endif // MAME_BUS_TVC_TVC_H diff --git a/src/devices/bus/vboy/slot.h b/src/devices/bus/vboy/slot.h index a81efa07519..547f09b8523 100644 --- a/src/devices/bus/vboy/slot.h +++ b/src/devices/bus/vboy/slot.h @@ -62,7 +62,16 @@ class vboy_cart_slot_device : public device_t, { public: // construction/destruction - vboy_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + vboy_cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : vboy_cart_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + vboy_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~vboy_cart_slot_device(); // image-level overrides @@ -110,8 +119,4 @@ DECLARE_DEVICE_TYPE(VBOY_CART_SLOT, vboy_cart_slot_device) #define VBOYSLOT_ROM_REGION_TAG ":cart:rom" -#define MCFG_VBOY_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ - MCFG_DEVICE_ADD(_tag, VBOY_CART_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - #endif // MAME_BUS_VBOY_SLOT_H diff --git a/src/devices/bus/vcs_ctrl/ctrl.h b/src/devices/bus/vcs_ctrl/ctrl.h index 31f371d2fa8..574a7dc3ae8 100644 --- a/src/devices/bus/vcs_ctrl/ctrl.h +++ b/src/devices/bus/vcs_ctrl/ctrl.h @@ -15,22 +15,6 @@ #pragma once - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_VCS_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, VCS_CONTROL_PORT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - - -#define MCFG_VCS_CONTROL_PORT_TRIGGER_CALLBACK(_write) \ - downcast<vcs_control_port_device &>(*device).set_trigger_wr_callback(DEVCB_##_write); - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -79,7 +63,6 @@ public: vcs_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); // static configuration helpers - template <class Object> devcb_base &set_trigger_wr_callback(Object &&cb) { return m_write_trigger.set_callback(std::forward<Object>(cb)); } auto trigger_wr_callback() { return m_write_trigger.bind(); } // computer interface diff --git a/src/devices/bus/vectrex/slot.h b/src/devices/bus/vectrex/slot.h index 605e273875f..f779bf5d514 100644 --- a/src/devices/bus/vectrex/slot.h +++ b/src/devices/bus/vectrex/slot.h @@ -112,8 +112,4 @@ DECLARE_DEVICE_TYPE(VECTREX_CART_SLOT, vectrex_cart_slot_device) #define VECSLOT_ROM_REGION_TAG ":cart:rom" -#define MCFG_VECTREX_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ - MCFG_DEVICE_ADD(_tag, VECTREX_CART_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - #endif // MAME_BUS_VECTREX_SLOT_H diff --git a/src/devices/bus/vidbrain/exp.h b/src/devices/bus/vidbrain/exp.h index fdb4b6a6ac7..37c58300030 100644 --- a/src/devices/bus/vidbrain/exp.h +++ b/src/devices/bus/vidbrain/exp.h @@ -49,21 +49,6 @@ #define VIDEOBRAIN_EXPANSION_SLOT_TAG "exp" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_VIDEOBRAIN_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, VIDEOBRAIN_EXPANSION_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - - -#define MCFG_VIDEOBRAIN_EXPANSION_SLOT_EXTRES_CALLBACK(_write) \ - downcast<videobrain_expansion_slot_device &>(*device).set_extres_wr_callback(DEVCB_##_write); - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -110,9 +95,18 @@ class videobrain_expansion_slot_device : public device_t, { public: // construction/destruction - videobrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - template <class Object> devcb_base &set_extres_wr_callback(Object &&cb) { return m_write_extres.set_callback(std::forward<Object>(cb)); } + template <typename T> + videobrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, char const* dflt) + : videobrain_expansion_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + videobrain_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + auto extres_wr_callback() { return m_write_extres.bind(); } // computer interface uint8_t bo_r(address_space &space, offs_t offset, int cs1, int cs2); diff --git a/src/devices/bus/vip/byteio.h b/src/devices/bus/vip/byteio.h index d2190214a2d..f2b12ca49f2 100644 --- a/src/devices/bus/vip/byteio.h +++ b/src/devices/bus/vip/byteio.h @@ -45,18 +45,6 @@ #define VIP_BYTEIO_PORT_TAG "byteio" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_VIP_BYTEIO_PORT_ADD(_tag, _slot_intf, _def_slot, _inst) \ - MCFG_DEVICE_ADD(_tag, VIP_BYTEIO_PORT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ - downcast<vip_byteio_port_device *>(device)->set_inst_callback(DEVCB_##_inst); - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -70,9 +58,19 @@ class vip_byteio_port_device : public device_t, { public: // construction/destruction - vip_byteio_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - template <class Object> void set_inst_callback(Object &&inst) { m_write_inst.set_callback(std::forward<Object>(inst)); } + template <typename T> + vip_byteio_port_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, const char *dflt) + : vip_byteio_port_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + + vip_byteio_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + auto inst_callback() { return m_write_inst.bind(); } // computer interface uint8_t in_r(); diff --git a/src/devices/bus/vip/exp.h b/src/devices/bus/vip/exp.h index dfca23fc038..82e131fbe09 100644 --- a/src/devices/bus/vip/exp.h +++ b/src/devices/bus/vip/exp.h @@ -46,27 +46,6 @@ #define VIP_EXPANSION_SLOT_TAG "exp" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_VIP_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, VIP_EXPANSION_SLOT, _clock) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - - -#define MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(_write) \ - downcast<vip_expansion_slot_device &>(*device).set_int_wr_callback(DEVCB_##_write); - -#define MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(_write) \ - downcast<vip_expansion_slot_device &>(*device).set_dma_out_wr_callback(DEVCB_##_write); - -#define MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(_write) \ - downcast<vip_expansion_slot_device &>(*device).set_dma_in_wr_callback(DEVCB_##_write); - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -80,11 +59,20 @@ class vip_expansion_slot_device : public device_t, { public: // construction/destruction + template <typename T> + vip_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock, T &&opts, char const *dflt) + : vip_expansion_slot_device(mconfig, tag, owner, clock) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } vip_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template <class Object> devcb_base &set_int_wr_callback(Object &&cb) { return m_write_int.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_dma_out_wr_callback(Object &&cb) { return m_write_dma_out.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_dma_in_wr_callback(Object &&cb) { return m_write_dma_in.set_callback(std::forward<Object>(cb)); } + auto int_wr_callback() { return m_write_int.bind(); } + auto dma_out_wr_callback() { return m_write_dma_out.bind(); } + auto dma_in_wr_callback() { return m_write_dma_in.bind(); } // computer interface uint8_t program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh); diff --git a/src/devices/bus/vip/vp575.cpp b/src/devices/bus/vip/vp575.cpp index c69ccc5bade..7dbfabf0981 100644 --- a/src/devices/bus/vip/vp575.cpp +++ b/src/devices/bus/vip/vp575.cpp @@ -45,32 +45,33 @@ void vp575_device::update_interrupts() // MACHINE_CONFIG_START( vp575 ) //------------------------------------------------- -MACHINE_CONFIG_START(vp575_device::device_add_mconfig) - MCFG_VIP_EXPANSION_SLOT_ADD("exp1", XTAL(3'521'280)/2, vip_expansion_cards, nullptr) - MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(*this, vp575_device, exp1_int_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(*this, vp575_device, exp1_dma_out_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(*this, vp575_device, exp1_dma_in_w)) - - MCFG_VIP_EXPANSION_SLOT_ADD("exp2", XTAL(3'521'280)/2, vip_expansion_cards, nullptr) - MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(*this, vp575_device, exp2_int_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(*this, vp575_device, exp2_dma_out_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(*this, vp575_device, exp2_dma_in_w)) - - MCFG_VIP_EXPANSION_SLOT_ADD("exp3", XTAL(3'521'280)/2, vip_expansion_cards, nullptr) - MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(*this, vp575_device, exp3_int_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(*this, vp575_device, exp3_dma_out_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(*this, vp575_device, exp3_dma_in_w)) - - MCFG_VIP_EXPANSION_SLOT_ADD("exp4", XTAL(3'521'280)/2, vip_expansion_cards, nullptr) - MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(*this, vp575_device, exp4_int_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(*this, vp575_device, exp4_dma_out_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(*this, vp575_device, exp4_dma_in_w)) - - MCFG_VIP_EXPANSION_SLOT_ADD("exp5", XTAL(3'521'280)/2, vip_expansion_cards, nullptr) - MCFG_VIP_EXPANSION_SLOT_INT_CALLBACK(WRITELINE(*this, vp575_device, exp5_int_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_OUT_CALLBACK(WRITELINE(*this, vp575_device, exp5_dma_out_w)) - MCFG_VIP_EXPANSION_SLOT_DMA_IN_CALLBACK(WRITELINE(*this, vp575_device, exp5_dma_in_w)) -MACHINE_CONFIG_END +void vp575_device::device_add_mconfig(machine_config &config) +{ + VIP_EXPANSION_SLOT(config, m_expansion_slot[0], XTAL(3'521'280)/2, vip_expansion_cards, nullptr); + m_expansion_slot[0]->int_wr_callback().set(FUNC(vp575_device::exp1_int_w)); + m_expansion_slot[0]->dma_out_wr_callback().set(FUNC(vp575_device::exp1_dma_out_w)); + m_expansion_slot[0]->dma_in_wr_callback().set(FUNC(vp575_device::exp1_dma_in_w)); + + VIP_EXPANSION_SLOT(config, m_expansion_slot[1], XTAL(3'521'280)/2, vip_expansion_cards, nullptr); + m_expansion_slot[1]->int_wr_callback().set(FUNC(vp575_device::exp2_int_w)); + m_expansion_slot[1]->dma_out_wr_callback().set(FUNC(vp575_device::exp2_dma_out_w)); + m_expansion_slot[1]->dma_in_wr_callback().set(FUNC(vp575_device::exp2_dma_in_w)); + + VIP_EXPANSION_SLOT(config, m_expansion_slot[2], XTAL(3'521'280)/2, vip_expansion_cards, nullptr); + m_expansion_slot[2]->int_wr_callback().set(FUNC(vp575_device::exp3_int_w)); + m_expansion_slot[2]->dma_out_wr_callback().set(FUNC(vp575_device::exp3_dma_out_w)); + m_expansion_slot[2]->dma_in_wr_callback().set(FUNC(vp575_device::exp3_dma_in_w)); + + VIP_EXPANSION_SLOT(config, m_expansion_slot[3], XTAL(3'521'280)/2, vip_expansion_cards, nullptr); + m_expansion_slot[3]->int_wr_callback().set(FUNC(vp575_device::exp4_int_w)); + m_expansion_slot[3]->dma_out_wr_callback().set(FUNC(vp575_device::exp4_dma_out_w)); + m_expansion_slot[3]->dma_in_wr_callback().set(FUNC(vp575_device::exp4_dma_in_w)); + + VIP_EXPANSION_SLOT(config, m_expansion_slot[4], XTAL(3'521'280)/2, vip_expansion_cards, nullptr); + m_expansion_slot[4]->int_wr_callback().set(FUNC(vp575_device::exp5_int_w)); + m_expansion_slot[4]->dma_out_wr_callback().set(FUNC(vp575_device::exp5_dma_out_w)); + m_expansion_slot[4]->dma_in_wr_callback().set(FUNC(vp575_device::exp5_dma_in_w)); +} diff --git a/src/devices/bus/wangpc/wangpc.h b/src/devices/bus/wangpc/wangpc.h index 1f10892f7fc..2b3a7860fc1 100644 --- a/src/devices/bus/wangpc/wangpc.h +++ b/src/devices/bus/wangpc/wangpc.h @@ -24,51 +24,6 @@ #define WANGPC_BUS_TAG "wangpcbus" - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_WANGPC_BUS_ADD() \ - MCFG_DEVICE_ADD(WANGPC_BUS_TAG, WANGPC_BUS, 0) - -#define MCFG_WANGPC_BUS_SLOT_ADD(_tag, _sid, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, WANGPC_BUS_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \ - downcast<wangpcbus_slot_device &>(*device).set_wangpcbus_slot(_sid); - - -#define MCFG_WANGPC_BUS_IRQ2_CALLBACK(_write) \ - downcast<wangpcbus_device &>(*device).set_irq2_wr_callback(DEVCB_##_write); - -#define MCFG_WANGPC_BUS_IRQ3_CALLBACK(_write) \ - downcast<wangpcbus_device &>(*device).set_irq3_wr_callback(DEVCB_##_write); - -#define MCFG_WANGPC_BUS_IRQ4_CALLBACK(_write) \ - downcast<wangpcbus_device &>(*device).set_irq4_wr_callback(DEVCB_##_write); - -#define MCFG_WANGPC_BUS_IRQ5_CALLBACK(_write) \ - downcast<wangpcbus_device &>(*device).set_irq5_wr_callback(DEVCB_##_write); - -#define MCFG_WANGPC_BUS_IRQ6_CALLBACK(_write) \ - downcast<wangpcbus_device &>(*device).set_irq6_wr_callback(DEVCB_##_write); - -#define MCFG_WANGPC_BUS_IRQ7_CALLBACK(_write) \ - downcast<wangpcbus_device &>(*device).set_irq7_wr_callback(DEVCB_##_write); - -#define MCFG_WANGPC_BUS_DRQ1_CALLBACK(_write) \ - downcast<wangpcbus_device &>(*device).set_drq1_wr_callback(DEVCB_##_write); - -#define MCFG_WANGPC_BUS_DRQ2_CALLBACK(_write) \ - downcast<wangpcbus_device &>(*device).set_drq2_wr_callback(DEVCB_##_write); - -#define MCFG_WANGPC_BUS_DRQ3_CALLBACK(_write) \ - downcast<wangpcbus_device &>(*device).set_drq3_wr_callback(DEVCB_##_write); - -#define MCFG_WANGPC_BUS_IOERROR_CALLBACK(_write) \ - downcast<wangpcbus_device &>(*device).set_ioerror_wr_callback(DEVCB_##_write); - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -81,7 +36,17 @@ class wangpcbus_slot_device : public device_t, public device_slot_interface { public: // construction/destruction - wangpcbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + wangpcbus_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, int sid) + : wangpcbus_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + set_wangpcbus_slot(sid); + } + wangpcbus_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); // inline configuration void set_wangpcbus_slot(int sid) { m_sid = sid; } @@ -113,16 +78,16 @@ public: wangpcbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); ~wangpcbus_device() { m_device_list.detach_all(); } - template <class Object> devcb_base &set_irq2_wr_callback(Object &&cb) { return m_write_irq2.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_irq3_wr_callback(Object &&cb) { return m_write_irq3.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_irq4_wr_callback(Object &&cb) { return m_write_irq4.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_irq5_wr_callback(Object &&cb) { return m_write_irq5.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_irq6_wr_callback(Object &&cb) { return m_write_irq6.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_irq7_wr_callback(Object &&cb) { return m_write_irq7.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_drq1_wr_callback(Object &&cb) { return m_write_drq1.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_drq2_wr_callback(Object &&cb) { return m_write_drq2.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_drq3_wr_callback(Object &&cb) { return m_write_drq3.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ioerror_wr_callback(Object &&cb) { return m_write_ioerror.set_callback(std::forward<Object>(cb)); } + auto irq2_wr_callback() { return m_write_irq2.bind(); } + auto irq3_wr_callback() { return m_write_irq3.bind(); } + auto irq4_wr_callback() { return m_write_irq4.bind(); } + auto irq5_wr_callback() { return m_write_irq5.bind(); } + auto irq6_wr_callback() { return m_write_irq6.bind(); } + auto irq7_wr_callback() { return m_write_irq7.bind(); } + auto drq1_wr_callback() { return m_write_drq1.bind(); } + auto drq2_wr_callback() { return m_write_drq2.bind(); } + auto drq3_wr_callback() { return m_write_drq3.bind(); } + auto ioerror_wr_callback() { return m_write_ioerror.bind(); } void add_card(device_wangpcbus_card_interface *card, int sid); diff --git a/src/devices/bus/x68k/x68kexp.h b/src/devices/bus/x68k/x68kexp.h index 56f9feea8a5..5130fb668d8 100644 --- a/src/devices/bus/x68k/x68kexp.h +++ b/src/devices/bus/x68k/x68kexp.h @@ -73,22 +73,6 @@ #define X68K_EXP_SLOT_TAG "x68kexp" -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_X68K_EXPANSION_SLOT_OUT_IRQ2_CB(_devcb) \ - downcast<x68k_expansion_slot_device &>(*device).set_out_irq2_callback(DEVCB_##_devcb); - -#define MCFG_X68K_EXPANSION_SLOT_OUT_IRQ4_CB(_devcb) \ - downcast<x68k_expansion_slot_device &>(*device).set_out_irq4_callback(DEVCB_##_devcb); - -#define MCFG_X68K_EXPANSION_SLOT_OUT_NMI_CB(_devcb) \ - downcast<x68k_expansion_slot_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb); - -#define MCFG_X68K_EXPANSION_SLOT_OUT_RESET_CB(_devcb) \ - downcast<x68k_expansion_slot_device &>(*device).set_out_reset_callback(DEVCB_##_devcb); - //************************************************************************** // TYPE DEFINITIONS @@ -123,13 +107,22 @@ class x68k_expansion_slot_device : public device_t, public device_slot_interface { public: // construction/destruction - x68k_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + template <typename T> + x68k_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : x68k_expansion_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } + x68k_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~x68k_expansion_slot_device(); - template <class Object> devcb_base &set_out_irq2_callback(Object &&cb) { return m_out_irq2_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_out_irq4_callback(Object &&cb) { return m_out_irq4_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_out_reset_callback(Object &&cb) { return m_out_reset_cb.set_callback(std::forward<Object>(cb)); } + auto out_irq2_callback() { return m_out_irq2_cb.bind(); } + auto out_irq4_callback() { return m_out_irq4_cb.bind(); } + auto out_nmi_callback() { return m_out_nmi_cb.bind(); } + auto out_reset_callback() { return m_out_reset_cb.bind(); } DECLARE_WRITE_LINE_MEMBER( irq2_w ); diff --git a/src/devices/bus/z88/z88.h b/src/devices/bus/z88/z88.h index de8ecdc883f..444eeb3c111 100644 --- a/src/devices/bus/z88/z88.h +++ b/src/devices/bus/z88/z88.h @@ -90,9 +90,18 @@ class z88cart_slot_device : public device_t, { public: // construction/destruction + template <typename T> + z88cart_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : z88cart_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } z88cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); - template <class Object> devcb_base &set_out_flp_callback(Object &&cb) { return m_out_flp_cb.set_callback(std::forward<Object>(cb)); } + auto out_flp_callback() { return m_out_flp_cb.bind(); } // image-level overrides virtual image_init_result call_load() override; @@ -133,12 +142,4 @@ private: // device type definition DECLARE_DEVICE_TYPE(Z88CART_SLOT, z88cart_slot_device) - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_Z88CART_SLOT_OUT_FLP_CB(_devcb) \ - downcast<z88cart_slot_device &>(*device).set_out_flp_callback(DEVCB_##_devcb); - #endif // MAME_BUS_Z88_Z88_H |