diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/bus/tvc/tvc.c | 32 | ||||
-rw-r--r-- | src/emu/bus/tvc/tvc.h | 30 | ||||
-rw-r--r-- | src/mess/drivers/tvc.c | 26 |
3 files changed, 34 insertions, 54 deletions
diff --git a/src/emu/bus/tvc/tvc.c b/src/emu/bus/tvc/tvc.c index 141dd93fee7..54ea47c9149 100644 --- a/src/emu/bus/tvc/tvc.c +++ b/src/emu/bus/tvc/tvc.c @@ -54,7 +54,9 @@ device_tvcexp_interface::~device_tvcexp_interface() //------------------------------------------------- tvcexp_slot_device::tvcexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, TVCEXP_SLOT, "TVC64 Expansion Slot", tag, owner, clock, "tvcexp_slot", __FILE__), - device_slot_interface(mconfig, *this) + device_slot_interface(mconfig, *this), + m_out_irq_cb(*this), + m_out_nmi_cb(*this) { } @@ -75,34 +77,10 @@ void tvcexp_slot_device::device_start() m_cart = dynamic_cast<device_tvcexp_interface *>(get_card_device()); // 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(); } -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void tvcexp_slot_device::device_config_complete() -{ - // inherit a copy of the static data - const tvcexp_interface *intf = reinterpret_cast<const tvcexp_interface *>(static_config()); - if (intf != NULL) - { - *static_cast<tvcexp_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)); - } -} - - /*------------------------------------------------- module id read -------------------------------------------------*/ diff --git a/src/emu/bus/tvc/tvc.h b/src/emu/bus/tvc/tvc.h index 8759b345d6a..28e992d55ea 100644 --- a/src/emu/bus/tvc/tvc.h +++ b/src/emu/bus/tvc/tvc.h @@ -61,15 +61,6 @@ TYPE DEFINITIONS ***************************************************************************/ -// ======================> tvcexp_interface - -struct tvcexp_interface -{ - devcb_write_line m_out_irq_cb; - devcb_write_line m_out_nmi_cb; -}; - - // ======================> device_tvcexp_interface class device_tvcexp_interface : public device_slot_card_interface @@ -92,17 +83,18 @@ public: // ======================> tvcexp_slot_device class tvcexp_slot_device : public device_t, - public tvcexp_interface, public device_slot_interface { public: // construction/destruction tvcexp_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~tvcexp_slot_device(); + + template<class _Object> static devcb2_base &set_out_irq_callback(device_t &device, _Object object) { return downcast<tvcexp_slot_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<tvcexp_slot_device &>(device).m_out_nmi_cb.set_callback(object); } // device-level overrides virtual void device_start(); - virtual void device_config_complete(); // reading and writing virtual UINT8 id_r(); @@ -113,8 +105,8 @@ public: virtual DECLARE_READ8_MEMBER(io_read); virtual DECLARE_WRITE8_MEMBER(io_write); - 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_tvcexp_interface* m_cart; }; @@ -127,8 +119,12 @@ extern const device_type TVCEXP_SLOT; DEVICE CONFIGURATION MACROS ***************************************************************************/ -#define MCFG_TVC64_EXPANSION_ADD(_tag,_config,_slot_intf,_def_slot) \ - MCFG_DEVICE_ADD(_tag, TVCEXP_SLOT, 0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) +// MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) + +#define MCFG_TVCEXP_SLOT_OUT_IRQ_CB(_devcb) \ + devcb = &tvcexp_slot_device::set_out_irq_callback(*device, DEVCB2_##_devcb); + +#define MCFG_TVCEXP_SLOT_OUT_NMI_CB(_devcb) \ + devcb = &tvcexp_slot_device::set_out_nmi_callback(*device, DEVCB2_##_devcb); + #endif /* __TVCEXP_H__ */ diff --git a/src/mess/drivers/tvc.c b/src/mess/drivers/tvc.c index a044fdb3b8b..1e069f30cdb 100644 --- a/src/mess/drivers/tvc.c +++ b/src/mess/drivers/tvc.c @@ -657,12 +657,6 @@ static const cassette_interface tvc_cassette_interface = NULL }; -static const tvcexp_interface tvc_exp_interface = -{ - DEVCB_CPU_INPUT_LINE("maincpu", 0), - DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI), -}; - extern SLOT_INTERFACE_START(tvc_exp) SLOT_INTERFACE("hbf", TVC_HBF) // Videoton HBF floppy interface SLOT_INTERFACE_END @@ -710,10 +704,22 @@ static MACHINE_CONFIG_START( tvc, tvc_state ) MCFG_CARTSLOT_INTERFACE("tvc_cart") /* expansion interface */ - MCFG_TVC64_EXPANSION_ADD("exp1", tvc_exp_interface, tvc_exp , NULL) - MCFG_TVC64_EXPANSION_ADD("exp2", tvc_exp_interface, tvc_exp , NULL) - MCFG_TVC64_EXPANSION_ADD("exp3", tvc_exp_interface, tvc_exp , NULL) - MCFG_TVC64_EXPANSION_ADD("exp4", tvc_exp_interface, tvc_exp , NULL) + MCFG_DEVICE_ADD("exp1", TVCEXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) + MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_DEVICE_ADD("exp2", TVCEXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) + MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_DEVICE_ADD("exp3", TVCEXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) + MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) + MCFG_DEVICE_ADD("exp4", TVCEXP_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(tvc_exp , NULL, false) + MCFG_TVCEXP_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0)) + MCFG_TVCEXP_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) /* cassette */ MCFG_CASSETTE_ADD( "cassette", tvc_cassette_interface ) |