diff --git a/src/emu/bus/z88/z88.c b/src/emu/bus/z88/z88.c index 1e3645114bb..460d4d7a6f7 100644 --- a/src/emu/bus/z88/z88.c +++ b/src/emu/bus/z88/z88.c @@ -59,7 +59,8 @@ device_z88cart_interface::~device_z88cart_interface() z88cart_slot_device::z88cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, Z88CART_SLOT, "Z88 Cartridge Slot", tag, owner, clock, "z88cart_slot", __FILE__), device_image_interface(mconfig, *this), - device_slot_interface(mconfig, *this) + device_slot_interface(mconfig, *this), + m_out_flp_cb(*this) { } @@ -80,7 +81,7 @@ void z88cart_slot_device::device_start() m_cart = dynamic_cast(get_card_device()); // resolve callbacks - m_out_flp_func.resolve(m_out_flp_cb, *this); + m_out_flp_cb.resolve_safe(); m_flp_timer = timer_alloc(TIMER_FLP_CLEAR); m_flp_timer->reset(); @@ -94,19 +95,6 @@ void z88cart_slot_device::device_start() void z88cart_slot_device::device_config_complete() { - // inherit a copy of the static data - const z88cart_interface *intf = reinterpret_cast(static_config()); - if (intf != NULL) - { - *static_cast(this) = *intf; - } - - // or initialize to defaults if none provided - else - { - memset(&m_out_flp_cb, 0, sizeof(m_out_flp_cb)); - } - // set brief and instance name update_names(); } @@ -121,7 +109,7 @@ void z88cart_slot_device::device_timer(emu_timer &timer, device_timer_id id, int if (id == TIMER_FLP_CLEAR) { // close the flap - m_out_flp_func(CLEAR_LINE); + m_out_flp_cb(CLEAR_LINE); } } @@ -154,7 +142,7 @@ bool z88cart_slot_device::call_load() } // open the flap - m_out_flp_func(ASSERT_LINE); + m_out_flp_cb(ASSERT_LINE); // setup the timer for close the flap m_flp_timer->adjust(CLOSE_FLAP_TIME); @@ -173,7 +161,7 @@ void z88cart_slot_device::call_unload() memset(m_cart->get_cart_base(), 0xff, m_cart->get_cart_size()); // open the flap - m_out_flp_func(ASSERT_LINE); + m_out_flp_cb(ASSERT_LINE); // setup the timer for close the flap m_flp_timer->adjust(CLOSE_FLAP_TIME); diff --git a/src/emu/bus/z88/z88.h b/src/emu/bus/z88/z88.h index 754aa0a824f..0be76989c89 100644 --- a/src/emu/bus/z88/z88.h +++ b/src/emu/bus/z88/z88.h @@ -58,14 +58,6 @@ TYPE DEFINITIONS ***************************************************************************/ -// ======================> z88cart_interface - -struct z88cart_interface -{ - devcb_write_line m_out_flp_cb; -}; - - // ======================> device_z88cart_interface class device_z88cart_interface : public device_slot_card_interface @@ -86,7 +78,6 @@ public: // ======================> z88cart_slot_device class z88cart_slot_device : public device_t, - public z88cart_interface, public device_image_interface, public device_slot_interface { @@ -94,6 +85,8 @@ public: // construction/destruction z88cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~z88cart_slot_device(); + + template static devcb2_base &set_out_flp_callback(device_t &device, _Object object) { return downcast(device).m_out_flp_cb.set_callback(object); } // device-level overrides virtual void device_start(); @@ -125,7 +118,7 @@ public: private: static const device_timer_id TIMER_FLP_CLEAR = 0; - devcb_resolved_write_line m_out_flp_func; + devcb2_write_line m_out_flp_cb; device_z88cart_interface* m_cart; emu_timer * m_flp_timer; }; @@ -139,9 +132,7 @@ extern const device_type Z88CART_SLOT; DEVICE CONFIGURATION MACROS ***************************************************************************/ -#define MCFG_Z88_CARTRIDGE_ADD(_tag,_config,_slot_intf,_def_slot) \ - MCFG_DEVICE_ADD(_tag, Z88CART_SLOT, 0) \ - MCFG_DEVICE_CONFIG(_config) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - +#define MCFG_Z88CART_SLOT_OUT_FLP_CB(_devcb) \ + devcb = &z88cart_slot_device::set_out_flp_callback(*device, DEVCB2_##_devcb); + #endif /* __Z88CART_H__ */ diff --git a/src/mess/drivers/z88.c b/src/mess/drivers/z88.c index 197f9768591..41cf8c673be 100644 --- a/src/mess/drivers/z88.c +++ b/src/mess/drivers/z88.c @@ -605,11 +605,6 @@ READ8_MEMBER(z88_state::kb_r) return data; } -static const z88cart_interface z88_cart_interface = -{ - DEVCB_DEVICE_LINE_MEMBER("blink", upd65031_device, flp_w) -}; - static SLOT_INTERFACE_START(z88_cart) SLOT_INTERFACE("32krom", Z88_32K_ROM) // 32KB ROM cart SLOT_INTERFACE("128krom", Z88_128K_ROM) // 128KB ROM cart @@ -660,9 +655,15 @@ static MACHINE_CONFIG_START( z88, z88_state ) MCFG_RAM_EXTRA_OPTIONS("32K,64K,256K,512k") // cartridges - MCFG_Z88_CARTRIDGE_ADD("slot1", z88_cart_interface, z88_cart, NULL) - MCFG_Z88_CARTRIDGE_ADD("slot2", z88_cart_interface, z88_cart, NULL) - MCFG_Z88_CARTRIDGE_ADD("slot3", z88_cart_interface, z88_cart, NULL) + MCFG_DEVICE_ADD("slot1", Z88CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(z88_cart, NULL, false) + MCFG_Z88CART_SLOT_OUT_FLP_CB(DEVWRITELINE("blink", upd65031_device, flp_w)) + MCFG_DEVICE_ADD("slot2", Z88CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(z88_cart, NULL, false) + MCFG_Z88CART_SLOT_OUT_FLP_CB(DEVWRITELINE("blink", upd65031_device, flp_w)) + MCFG_DEVICE_ADD("slot3", Z88CART_SLOT, 0) + MCFG_DEVICE_SLOT_INTERFACE(z88_cart, NULL, false) + MCFG_Z88CART_SLOT_OUT_FLP_CB(DEVWRITELINE("blink", upd65031_device, flp_w)) MACHINE_CONFIG_END