From 40bc562d1e4e9f2bddb6be2d56078ee796e418ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Milanovi=C4=87?= Date: Mon, 22 Jan 2024 17:59:28 +0100 Subject: bus/rc2014: Use virtual member functions for bus signals. (#11947) Fixes handlers not being called after e9c1f4a42a6758a6fb75403e28c7dc6cf869081c (GitHub PR #11333). --- src/devices/bus/rc2014/micro.cpp | 21 ++--- src/devices/bus/rc2014/ram.cpp | 20 +++-- src/devices/bus/rc2014/rc2014.cpp | 159 ++++++++++++++++++++++++++++--------- src/devices/bus/rc2014/rc2014.h | 134 +++++++++++++++---------------- src/devices/bus/rc2014/serial.cpp | 44 +++++----- src/devices/bus/rc2014/z180cpu.cpp | 20 ++--- src/devices/bus/rc2014/z80cpu.cpp | 21 ++--- 7 files changed, 253 insertions(+), 166 deletions(-) diff --git a/src/devices/bus/rc2014/micro.cpp b/src/devices/bus/rc2014/micro.cpp index 1c61b97f725..80f89ce56b0 100644 --- a/src/devices/bus/rc2014/micro.cpp +++ b/src/devices/bus/rc2014/micro.cpp @@ -8,13 +8,15 @@ #include "emu.h" #include "micro.h" + #include "modules.h" +#include "bus/ata/ataintf.h" +#include "bus/rs232/rs232.h" #include "cpu/z80/z80.h" #include "machine/6850acia.h" #include "machine/clock.h" -#include "bus/ata/ataintf.h" -#include "bus/rs232/rs232.h" + namespace { @@ -30,7 +32,7 @@ public: rc2014_micro(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); private: - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_reset() override; virtual void device_resolve_objects() override; @@ -38,6 +40,9 @@ private: virtual ioport_constructor device_input_ports() const override; virtual const tiny_rom_entry *device_rom_region() const override; + virtual void card_int_w(int state) override { m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); } + virtual void card_rx_w(int state) override { m_acia->write_rxd(state); } + void clk_w(int state) { m_bus->clk_w(state); } void tx_w(int state) { m_bus->tx_w(state); } @@ -96,10 +101,6 @@ void rc2014_micro::device_resolve_objects() // Setup CPU m_bus->assign_installer(AS_PROGRAM, &m_maincpu->space(AS_PROGRAM)); m_bus->assign_installer(AS_IO, &m_maincpu->space(AS_IO)); - m_bus->int_callback().append_inputline(m_maincpu, INPUT_LINE_IRQ0); - - // Setup ACIA - m_bus->rx_callback().append(m_acia, FUNC(acia6850_device::write_rxd)); } static DEVICE_INPUT_DEFAULTS_START( terminal ) @@ -178,7 +179,7 @@ public: rc2014_mini_cpm(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_reset() override; virtual void device_post_load() override { update_banks(); } @@ -291,7 +292,9 @@ const tiny_rom_entry *rc2014_mini_cpm::device_rom_region() const return ROM_NAME( rc2014_mini_cpm ); } -} +} // anonymous namespace + + //************************************************************************** // DEVICE DEFINITIONS //************************************************************************** diff --git a/src/devices/bus/rc2014/ram.cpp b/src/devices/bus/rc2014/ram.cpp index b71184cf45a..588e606a12f 100644 --- a/src/devices/bus/rc2014/ram.cpp +++ b/src/devices/bus/rc2014/ram.cpp @@ -23,7 +23,7 @@ public: ram_32k_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; private: @@ -61,7 +61,7 @@ protected: // construction/destruction ram_64k_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_reset() override; virtual void device_post_load() override { update_banks(); } @@ -131,12 +131,13 @@ public: ram_64k_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - // device-level overrides + // device_t implementation virtual void device_reset() override; - virtual void device_resolve_objects() override; // base-class overrides void update_banks() override; + + virtual void card_page_w(int state) override { page_w(state); } }; ram_64k_device::ram_64k_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) @@ -154,11 +155,6 @@ void ram_64k_device::device_reset() m_bus->installer(AS_PROGRAM)->install_ram(m_start_addr->read() * 0x1000, 0xffff, m_ram.get() + m_start_addr->read() * 0x1000); } -void ram_64k_device::device_resolve_objects() -{ - m_bus->page_callback().append(*this, FUNC(ram_64k_device::page_w)); -} - void ram_64k_device::update_banks() { if (m_paged->read() == 0) return; // If not paged skip @@ -180,7 +176,7 @@ public: ram_64k_device_40pin(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - // device-level overrides + // device_t implementation virtual void device_reset() override; // base-class overrides @@ -208,7 +204,9 @@ void ram_64k_device_40pin::device_reset() } } -} +} // anonymous namespace + + //************************************************************************** // DEVICE DEFINITIONS //************************************************************************** diff --git a/src/devices/bus/rc2014/rc2014.cpp b/src/devices/bus/rc2014/rc2014.cpp index e23af856311..baee04e8e37 100644 --- a/src/devices/bus/rc2014/rc2014.cpp +++ b/src/devices/bus/rc2014/rc2014.cpp @@ -20,14 +20,6 @@ rc2014_bus_device::rc2014_bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) , m_installer{} - , m_clk(*this) - , m_int(*this) - , m_tx(*this) - , m_rx(*this) - , m_user1(*this) - , m_user2(*this) - , m_user3(*this) - , m_user4(*this) , m_daisy_chain{} { } @@ -54,6 +46,12 @@ void rc2014_bus_device::device_reset() installer(AS_IO)->unmap_readwrite(0, (1 << installer(AS_IO)->space_config().addr_width()) - 1); } +void rc2014_bus_device::add_card(device_rc2014_card_interface &card) +{ + card.m_bus = this; + m_device_list.emplace_back(card); +} + void rc2014_bus_device::set_bus_clock(u32 clock) { set_clock(clock); @@ -87,6 +85,54 @@ const z80_daisy_config* rc2014_bus_device::get_daisy_chain() return (const z80_daisy_config*)m_daisy_chain; } +void rc2014_bus_device::clk_w(int state) +{ + for (device_rc2014_card_interface &entry : m_device_list) + entry.card_clk_w(state); +} + +void rc2014_bus_device::int_w(int state) +{ + for (device_rc2014_card_interface &entry : m_device_list) + entry.card_int_w(state); +} + +void rc2014_bus_device::tx_w(int state) +{ + for (device_rc2014_card_interface &entry : m_device_list) + entry.card_tx_w(state); +} + +void rc2014_bus_device::rx_w(int state) +{ + for (device_rc2014_card_interface &entry : m_device_list) + entry.card_rx_w(state); +} + +void rc2014_bus_device::user1_w(int state) +{ + for (device_rc2014_card_interface &entry : m_device_list) + entry.card_user1_w(state); +} + +void rc2014_bus_device::user2_w(int state) +{ + for (device_rc2014_card_interface &entry : m_device_list) + entry.card_user2_w(state); +} + +void rc2014_bus_device::user3_w(int state) +{ + for (device_rc2014_card_interface &entry : m_device_list) + entry.card_user3_w(state); +} + +void rc2014_bus_device::user4_w(int state) +{ + for (device_rc2014_card_interface &entry : m_device_list) + entry.card_user4_w(state); +} + //------------------------------------------------- // device_rc2014_card_interface //------------------------------------------------- @@ -97,11 +143,6 @@ device_rc2014_card_interface::device_rc2014_card_interface(const machine_config { } -void device_rc2014_card_interface::set_bus_device(rc2014_bus_device *bus_device) -{ - m_bus = bus_device; -} - //------------------------------------------------- // rc2014_slot_device //------------------------------------------------- @@ -127,7 +168,7 @@ void rc2014_slot_device::device_resolve_objects() device_rc2014_card_interface *const card(dynamic_cast(get_card_device())); if (card) - card->set_bus_device(m_bus); + m_bus->add_card(*card); } //************************************************************************** @@ -145,18 +186,15 @@ rc2014_ext_bus_device::rc2014_ext_bus_device(const machine_config &mconfig, cons rc2014_ext_bus_device::rc2014_ext_bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : rc2014_bus_device(mconfig, type, tag, owner, clock) - , m_clk2(*this) - , m_page(*this) - , m_nmi(*this) - , m_tx2(*this) - , m_rx2(*this) - , m_user5(*this) - , m_user6(*this) - , m_user7(*this) - , m_user8(*this) { } +void rc2014_ext_bus_device::add_card(device_rc2014_ext_card_interface &card) +{ + card.m_bus = this; + m_device_list.emplace_back(card); +} + //------------------------------------------------- // device_rc2014_ext_card_interface //------------------------------------------------- @@ -166,12 +204,6 @@ device_rc2014_ext_card_interface::device_rc2014_ext_card_interface(const machine , m_bus(nullptr) { } - -void device_rc2014_ext_card_interface::set_bus_device(rc2014_ext_bus_device *bus_device) -{ - m_bus = bus_device; -} - //------------------------------------------------- // rc2014_ext_slot_device //------------------------------------------------- @@ -190,13 +222,67 @@ void rc2014_ext_slot_device::device_start() { } +void rc2014_ext_bus_device::clk2_w(int state) +{ + for (device_rc2014_ext_card_interface &entry : m_device_list) + entry.card_clk2_w(state); +} + +void rc2014_ext_bus_device::page_w(int state) +{ + for (device_rc2014_ext_card_interface &entry : m_device_list) + entry.card_page_w(state); +} + +void rc2014_ext_bus_device::nmi_w(int state) +{ + for (device_rc2014_ext_card_interface &entry : m_device_list) + entry.card_nmi_w(state); +} + +void rc2014_ext_bus_device::tx2_w(int state) +{ + for (device_rc2014_ext_card_interface &entry : m_device_list) + entry.card_tx2_w(state); +} + +void rc2014_ext_bus_device::rx2_w(int state) +{ + for (device_rc2014_ext_card_interface &entry : m_device_list) + entry.card_rx2_w(state); +} + +void rc2014_ext_bus_device::user5_w(int state) +{ + for (device_rc2014_ext_card_interface &entry : m_device_list) + entry.card_user5_w(state); +} + +void rc2014_ext_bus_device::user6_w(int state) +{ + for (device_rc2014_ext_card_interface &entry : m_device_list) + entry.card_user6_w(state); +} + +void rc2014_ext_bus_device::user7_w(int state) +{ + for (device_rc2014_ext_card_interface &entry : m_device_list) + entry.card_user7_w(state); +} + +void rc2014_ext_bus_device::user8_w(int state) +{ + for (device_rc2014_ext_card_interface &entry : m_device_list) + entry.card_user8_w(state); +} + void rc2014_ext_slot_device::device_resolve_objects() { rc2014_slot_device::device_resolve_objects(); device_rc2014_ext_card_interface *const card(dynamic_cast(get_card_device())); if (card) - card->set_bus_device(dynamic_cast(m_bus.target())); + ((rc2014_ext_bus_device*)m_bus.lookup())->add_card(*card); } //************************************************************************** @@ -223,6 +309,12 @@ void rc2014_rc80_bus_device::device_start() rc2014_ext_bus_device::device_start(); } +void rc2014_rc80_bus_device::add_card(device_rc2014_rc80_card_interface &card) +{ + card.m_bus = this; + m_device_list.emplace_back(card); +} + //------------------------------------------------- // device_rc2014_rc80_card_interface //------------------------------------------------- @@ -233,11 +325,6 @@ device_rc2014_rc80_card_interface::device_rc2014_rc80_card_interface(const machi { } -void device_rc2014_rc80_card_interface::set_bus_device(rc2014_rc80_bus_device *bus_device) -{ - m_bus = bus_device; -} - //------------------------------------------------- // rc2014_rc80_slot_device //------------------------------------------------- @@ -257,7 +344,7 @@ void rc2014_rc80_slot_device::device_resolve_objects() device_rc2014_rc80_card_interface *const card(dynamic_cast(get_card_device())); if (card) - card->set_bus_device(dynamic_cast(m_bus.target())); + ((rc2014_rc80_bus_device*)m_bus.lookup())->add_card(*card); } //************************************************************************** diff --git a/src/devices/bus/rc2014/rc2014.h b/src/devices/bus/rc2014/rc2014.h index 1a689a2cc9f..225ea087ea5 100644 --- a/src/devices/bus/rc2014/rc2014.h +++ b/src/devices/bus/rc2014/rc2014.h @@ -60,6 +60,10 @@ #include "machine/z80daisy.h" +#include +#include + + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -69,6 +73,7 @@ //************************************************************************** // ======================> rc2014_bus_device +class device_rc2014_card_interface; class rc2014_bus_device : public device_t { @@ -77,23 +82,14 @@ public: rc2014_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~rc2014_bus_device(); - auto clk_callback() { return m_clk.bind(); } - auto int_callback() { return m_int.bind(); } - auto tx_callback() { return m_tx.bind(); } - auto rx_callback() { return m_rx.bind(); } - auto user1_callback() { return m_user1.bind(); } - auto user2_callback() { return m_user2.bind(); } - auto user3_callback() { return m_user3.bind(); } - auto user4_callback() { return m_user4.bind(); } - - void clk_w(int state) { m_clk(state); } - void int_w(int state) { m_int(state); } - void tx_w(int state) { m_tx(state); } - void rx_w(int state) { m_rx(state); } - void user1_w(int state) { m_user1(state); } - void user2_w(int state) { m_user2(state); } - void user3_w(int state) { m_user3(state); } - void user4_w(int state) { m_user4(state); } + void clk_w(int state); + void int_w(int state); + void tx_w(int state); + void rx_w(int state); + void user1_w(int state); + void user2_w(int state); + void user3_w(int state); + void user4_w(int state); void set_bus_clock(u32 clock); void set_bus_clock(const XTAL &xtal) { set_bus_clock(xtal.value()); } @@ -102,6 +98,7 @@ public: void add_to_daisy_chain(std::string tag) { m_daisy.push_back(tag); } const z80_daisy_config* get_daisy_chain(); + void add_card(device_rc2014_card_interface &card); protected: rc2014_bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); @@ -110,17 +107,12 @@ protected: virtual void device_reset() override; private: + using card_vector = std::vector >; + address_space_installer *m_installer[4]; - devcb_write_line m_clk; - devcb_write_line m_int; - devcb_write_line m_tx; - devcb_write_line m_rx; - devcb_write_line m_user1; - devcb_write_line m_user2; - devcb_write_line m_user3; - devcb_write_line m_user4; std::vector m_daisy; char **m_daisy_chain; + card_vector m_device_list; }; // ======================> device_rc2014_card_interface @@ -130,13 +122,22 @@ class rc2014_slot_device; class device_rc2014_card_interface : public device_interface { friend class rc2014_slot_device; + friend class rc2014_bus_device; public: // construction/destruction device_rc2014_card_interface(const machine_config &mconfig, device_t &device); -protected: - void set_bus_device(rc2014_bus_device *bus_device); + virtual void card_clk_w(int state) { } + virtual void card_int_w(int state) { } + virtual void card_tx_w(int state) { } + virtual void card_rx_w(int state) { } + virtual void card_user1_w(int state) { } + virtual void card_user2_w(int state) { } + virtual void card_user3_w(int state) { } + virtual void card_user4_w(int state) { } + +protected: rc2014_bus_device *m_bus; }; @@ -173,6 +174,7 @@ protected: //************************************************************************** // ======================> rc2014_ext_bus_device +class device_rc2014_ext_card_interface; class rc2014_ext_bus_device : public rc2014_bus_device { @@ -180,55 +182,48 @@ public: // construction/destruction rc2014_ext_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - auto clk2_callback() { return m_clk2.bind(); } - auto page_callback() { return m_page.bind(); } - auto nmi_callback() { return m_nmi.bind(); } - auto tx2_callback() { return m_tx2.bind(); } - auto rx2_callback() { return m_rx2.bind(); } - auto user5_callback() { return m_user5.bind(); } - auto user6_callback() { return m_user6.bind(); } - auto user7_callback() { return m_user7.bind(); } - auto user8_callback() { return m_user8.bind(); } - - void clk2_w(int state) { m_clk2(state); } - void page_w(int state) { m_page(state); } - void nmi_w(int state) { m_nmi(state); } - void tx2_w(int state) { m_tx2(state); } - void rx2_w(int state) { m_rx2(state); } - void user5_w(int state) { m_user5(state); } - void user6_w(int state) { m_user6(state); } - void user7_w(int state) { m_user7(state); } - void user8_w(int state) { m_user8(state); } + void clk2_w(int state); + void page_w(int state); + void nmi_w(int state); + void tx2_w(int state); + void rx2_w(int state); + void user5_w(int state); + void user6_w(int state); + void user7_w(int state); + void user8_w(int state); + + void add_card(device_rc2014_ext_card_interface &card); protected: rc2014_ext_bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); private: - devcb_write_line m_clk2; - devcb_write_line m_page; - devcb_write_line m_nmi; - devcb_write_line m_tx2; - devcb_write_line m_rx2; - devcb_write_line m_user5; - devcb_write_line m_user6; - devcb_write_line m_user7; - devcb_write_line m_user8; + using card_vector = std::vector >; + card_vector m_device_list; }; // ======================> device_rc2014_ext_card_interface -class rc2014_ext_slot_device; - class device_rc2014_ext_card_interface : public device_rc2014_card_interface { - friend class rc2014_ext_slot_device; + friend class rc2014_ext_bus_device; protected: // construction/destruction device_rc2014_ext_card_interface(const machine_config &mconfig, device_t &device); - void set_bus_device(rc2014_ext_bus_device *bus_device); +public: + virtual void card_clk2_w(int state) { } + virtual void card_page_w(int state) { } + virtual void card_nmi_w(int state) { } + virtual void card_tx2_w(int state) { } + virtual void card_rx2_w(int state) { } + virtual void card_user5_w(int state) { } + virtual void card_user6_w(int state) { } + virtual void card_user7_w(int state) { } + virtual void card_user8_w(int state) { } +protected: rc2014_ext_bus_device *m_bus; }; @@ -263,6 +258,7 @@ protected: //************************************************************************** // ======================> rc2014_rc80_bus_device +class device_rc2014_rc80_card_interface; class rc2014_rc80_bus_device : public rc2014_ext_bus_device { @@ -270,26 +266,29 @@ public: // construction/destruction rc2014_rc80_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + void add_card(device_rc2014_rc80_card_interface &card); + protected: rc2014_rc80_bus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides + + // device_t implementation virtual void device_start() override; + +private: + using card_vector = std::vector >; + card_vector m_device_list; }; // ======================> device_rc2014_rc80_card_interface -class rc2014_rc80_slot_device; - class device_rc2014_rc80_card_interface : public device_rc2014_ext_card_interface { - friend class rc2014_rc80_slot_device; + friend class rc2014_rc80_bus_device; protected: // construction/destruction device_rc2014_rc80_card_interface(const machine_config &mconfig, device_t &device); - void set_bus_device(rc2014_rc80_bus_device *bus_device); - rc2014_rc80_bus_device *m_bus; }; @@ -312,12 +311,13 @@ public: } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_resolve_objects() override; }; -// device type definition + +// device type declarations DECLARE_DEVICE_TYPE(RC2014_BUS, rc2014_bus_device) DECLARE_DEVICE_TYPE(RC2014_SLOT, rc2014_slot_device) diff --git a/src/devices/bus/rc2014/serial.cpp b/src/devices/bus/rc2014/serial.cpp index faf8a831714..f62841666fe 100644 --- a/src/devices/bus/rc2014/serial.cpp +++ b/src/devices/bus/rc2014/serial.cpp @@ -8,9 +8,11 @@ #include "emu.h" #include "serial.h" + +#include "bus/rs232/rs232.h" #include "machine/6850acia.h" #include "machine/z80sio.h" -#include "bus/rs232/rs232.h" + namespace { @@ -26,14 +28,17 @@ public: serial_io_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_reset() override; - virtual void device_resolve_objects() override; virtual void device_add_mconfig(machine_config &config) override; void irq_w(int state) { m_bus->int_w(state); } void tx_w(int state) { m_bus->tx_w(state); } + + virtual void card_clk_w(int state) override { m_acia->write_txc(state); m_acia->write_rxc(state); } + virtual void card_rx_w(int state) override { m_acia->write_rxd(state); } + private: required_device m_acia; }; @@ -55,13 +60,6 @@ void serial_io_device::device_reset() m_bus->installer(AS_IO)->install_readwrite_handler(0x80, 0x81, 0, 0xff3e, 0, read8sm_delegate(*m_acia, FUNC(acia6850_device::read)), write8sm_delegate(*m_acia, FUNC(acia6850_device::write))); } -void serial_io_device::device_resolve_objects() -{ - m_bus->clk_callback().append(m_acia, FUNC(acia6850_device::write_txc)); - m_bus->clk_callback().append(m_acia, FUNC(acia6850_device::write_rxc)); - - m_bus->rx_callback().append(m_acia, FUNC(acia6850_device::write_rxd)); -} // JP1 is used to enable power from USB-to-Serial cable @@ -191,6 +189,11 @@ protected: void irq_w(int state) override { m_bus->int_w(state); } void tx_w(int state) override { m_bus->tx_w(state); } void tx2_w(int state) override { m_bus->tx2_w(state); } + + virtual void card_clk_w(int state) override { m_sio->txca_w(state); m_sio->rxca_w(state); clk1_w(state); } + virtual void card_clk2_w(int state) override { clk2_w(state); } + virtual void card_rx_w(int state) override { m_sio->rxa_w(state); } + virtual void card_rx2_w(int state) override { m_sio->rxb_w(state); } }; dual_serial_device::dual_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) @@ -211,14 +214,6 @@ void dual_serial_device::device_reset() void dual_serial_device::device_resolve_objects() { - m_bus->clk_callback().append(m_sio, FUNC(z80sio_device::txca_w)); - m_bus->clk_callback().append(m_sio, FUNC(z80sio_device::rxca_w)); - m_bus->clk_callback().append(*this, FUNC(dual_serial_device::clk1_w)); - m_bus->clk2_callback().append(*this, FUNC(dual_serial_device::clk2_w)); - - m_bus->rx_callback().append(m_sio, FUNC(z80sio_device::rxa_w)); - m_bus->rx2_callback().append(m_sio, FUNC(z80sio_device::rxb_w)); - m_bus->add_to_daisy_chain(m_sio->tag()); } @@ -241,6 +236,9 @@ protected: void irq_w(int state) override { m_bus->int_w(state); } void tx_w(int state) override { m_bus->tx_w(state); } void tx2_w(int state) override { } + + virtual void card_clk_w(int state) override { m_sio->txca_w(state); m_sio->rxca_w(state); clk1_w(state); } + virtual void card_rx_w(int state) override { m_sio->rxa_w(state); } }; dual_serial_device_40pin::dual_serial_device_40pin(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) @@ -261,16 +259,12 @@ void dual_serial_device_40pin::device_reset() void dual_serial_device_40pin::device_resolve_objects() { - m_bus->clk_callback().append(m_sio, FUNC(z80sio_device::txca_w)); - m_bus->clk_callback().append(m_sio, FUNC(z80sio_device::rxca_w)); - m_bus->clk_callback().append(*this, FUNC(dual_serial_device_40pin::clk1_w)); - - m_bus->rx_callback().append(m_sio, FUNC(z80sio_device::rxa_w)); - m_bus->add_to_daisy_chain(m_sio->tag()); } -} +} // anonymous namespace + + //************************************************************************** // DEVICE DEFINITIONS //************************************************************************** diff --git a/src/devices/bus/rc2014/z180cpu.cpp b/src/devices/bus/rc2014/z180cpu.cpp index 64f0eb27318..53128c585ba 100644 --- a/src/devices/bus/rc2014/z180cpu.cpp +++ b/src/devices/bus/rc2014/z180cpu.cpp @@ -9,9 +9,10 @@ #include "emu.h" #include "z180cpu.h" +#include "bus/rs232/rs232.h" #include "cpu/z180/z180.h" #include "machine/clock.h" -#include "bus/rs232/rs232.h" + namespace { @@ -25,7 +26,7 @@ protected: // construction/destruction z180cpu_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_resolve_objects() override; virtual void device_add_mconfig(machine_config &config) override; @@ -37,6 +38,10 @@ protected: void tx_w(int state) { m_bus->tx_w(state); } void tx2_w(int state) { m_bus->tx2_w(state); } + virtual void card_int_w(int state) override { m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); } + virtual void card_rx_w(int state) override { m_maincpu->rxa0_w(state); } + virtual void card_rx2_w(int state) override { m_maincpu->rxa1_w(state); } + // object finders required_device m_maincpu; @@ -60,11 +65,6 @@ void z180cpu_base::device_resolve_objects() { m_bus->assign_installer(AS_PROGRAM, &m_maincpu->space(AS_PROGRAM)); m_bus->assign_installer(AS_IO, &m_maincpu->space(AS_IO)); - - m_bus->int_callback().append_inputline(m_maincpu, INPUT_LINE_IRQ0); - - m_bus->rx_callback().append(m_maincpu, FUNC(z180_device::rxa0_w)); - m_bus->rx2_callback().append(m_maincpu, FUNC(z180_device::rxa1_w)); } // This is here only to configure our terminal for interactive use @@ -112,7 +112,7 @@ public: sc111_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; }; @@ -125,7 +125,9 @@ void sc111_device::device_start() { } -} +} // anonymous namespace + + //************************************************************************** // DEVICE DEFINITIONS //************************************************************************** diff --git a/src/devices/bus/rc2014/z80cpu.cpp b/src/devices/bus/rc2014/z80cpu.cpp index 9723c947e2e..b14f0342229 100644 --- a/src/devices/bus/rc2014/z80cpu.cpp +++ b/src/devices/bus/rc2014/z80cpu.cpp @@ -23,7 +23,7 @@ protected: // construction/destruction z80cpu_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_add_mconfig(machine_config &config) override; @@ -63,9 +63,11 @@ public: z80cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_resolve_objects() override; + + virtual void card_int_w(int state) override { m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); } }; z80cpu_device::z80cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) @@ -83,8 +85,6 @@ void z80cpu_device::device_resolve_objects() { m_bus->assign_installer(AS_PROGRAM, &m_maincpu->space(AS_PROGRAM)); m_bus->assign_installer(AS_IO, &m_maincpu->space(AS_IO)); - - m_bus->int_callback().append_inputline(m_maincpu, INPUT_LINE_IRQ0); } //************************************************************************** @@ -97,10 +97,14 @@ class z80cpu21_device : public z80cpu_base, public device_rc2014_ext_card_interf public: // construction/destruction z80cpu21_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + protected: - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_resolve_objects() override; + + virtual void card_int_w(int state) override { m_maincpu->set_input_line(INPUT_LINE_IRQ0, state); } + virtual void card_nmi_w(int state) override { m_maincpu->set_input_line(INPUT_LINE_NMI, state); } }; z80cpu21_device::z80cpu21_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) @@ -118,12 +122,11 @@ void z80cpu21_device::device_resolve_objects() { m_bus->assign_installer(AS_PROGRAM, &m_maincpu->space(AS_PROGRAM)); m_bus->assign_installer(AS_IO, &m_maincpu->space(AS_IO)); - - m_bus->int_callback().append_inputline(m_maincpu, INPUT_LINE_IRQ0); - m_bus->nmi_callback().append_inputline(m_maincpu, INPUT_LINE_NMI); } -} +} // anonymous namespace + + //************************************************************************** // DEVICE DEFINITIONS //************************************************************************** -- cgit v1.2.3