From 3de63dc88426f44098df5798459593b2d7f9d601 Mon Sep 17 00:00:00 2001 From: AJR Date: Tue, 22 Jan 2019 13:09:17 -0500 Subject: a2bus: Replace CPU finder with address space finder; make DMA line an explicitly configured callback; remove MCFG_ macros (nw) --- src/devices/bus/a2bus/a2bus.cpp | 14 ++++++++------ src/devices/bus/a2bus/a2bus.h | 33 +++++++-------------------------- src/devices/bus/a2bus/a2softcard.cpp | 4 ++-- src/devices/bus/a2bus/transwarp.cpp | 2 +- src/mame/drivers/agat.cpp | 11 ++++++----- src/mame/drivers/apple2.cpp | 3 ++- src/mame/drivers/apple2e.cpp | 3 ++- src/mame/drivers/apple2gs.cpp | 3 ++- src/mame/drivers/apple3.cpp | 3 ++- src/mame/drivers/concept.cpp | 2 +- 10 files changed, 33 insertions(+), 45 deletions(-) diff --git a/src/devices/bus/a2bus/a2bus.cpp b/src/devices/bus/a2bus/a2bus.cpp index bc0b7c295d3..7adcaf368a7 100644 --- a/src/devices/bus/a2bus/a2bus.cpp +++ b/src/devices/bus/a2bus/a2bus.cpp @@ -145,8 +145,11 @@ a2bus_device::a2bus_device(const machine_config &mconfig, const char *tag, devic a2bus_device::a2bus_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_maincpu(*this, finder_base::DUMMY_TAG), m_maincpu_space(nullptr) - , m_out_irq_cb(*this) , m_out_nmi_cb(*this), m_out_inh_cb(*this) + , m_maincpu_space(*this, finder_base::DUMMY_TAG, -1) + , m_out_irq_cb(*this) + , m_out_nmi_cb(*this) + , m_out_inh_cb(*this) + , m_out_dma_cb(*this) , m_slot_irq_mask(0), m_slot_nmi_mask(0) { } @@ -157,12 +160,11 @@ a2bus_device::a2bus_device(const machine_config &mconfig, device_type type, cons void a2bus_device::device_resolve_objects() { - m_maincpu_space = &m_maincpu->space(AS_PROGRAM); - // resolve callbacks m_out_irq_cb.resolve_safe(); m_out_nmi_cb.resolve_safe(); m_out_inh_cb.resolve_safe(); + m_out_dma_cb.resolve_safe(); } void a2bus_device::device_start() @@ -239,9 +241,9 @@ void a2bus_device::set_nmi_line(int state, int slot) } } -void a2bus_device::set_maincpu_halt(int state) +void a2bus_device::set_dma_line(int state) { - m_maincpu->set_input_line(INPUT_LINE_HALT, state); + m_out_dma_cb(state); } uint8_t a2bus_device::dma_r(uint16_t offset) diff --git a/src/devices/bus/a2bus/a2bus.h b/src/devices/bus/a2bus/a2bus.h index f22d9f7b870..502ff72e854 100644 --- a/src/devices/bus/a2bus/a2bus.h +++ b/src/devices/bus/a2bus/a2bus.h @@ -25,22 +25,6 @@ #define INH_READ 0x01 #define INH_WRITE 0x02 -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_A2BUS_CPU(_cputag) \ - downcast(*device).set_cputag(_cputag); - -#define MCFG_A2BUS_OUT_IRQ_CB(_devcb) \ - downcast(*device).set_out_irq_callback(DEVCB_##_devcb); - -#define MCFG_A2BUS_OUT_NMI_CB(_devcb) \ - downcast(*device).set_out_nmi_callback(DEVCB_##_devcb); - -#define MCFG_A2BUS_OUT_INH_CB(_devcb) \ - downcast(*device).set_out_inh_callback(DEVCB_##_devcb); - // 7M = XTAL(14'318'181) / 2 or XTAL(28'636'363) / 4 (for IIgs) static constexpr uint32_t A2BUS_7M_CLOCK = 7159090; @@ -99,15 +83,11 @@ public: a2bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // inline configuration - template void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward(tag)); } - template devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_nmi_callback(Object &&cb) { return m_out_nmi_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_inh_callback(Object &&cb) { return m_out_inh_cb.set_callback(std::forward(cb)); } - - // devcb3 + template void set_space(T &&tag, int spacenum) { m_maincpu_space.set_tag(std::forward(tag), spacenum); } auto irq_w() { return m_out_irq_cb.bind(); } auto nmi_w() { return m_out_nmi_cb.bind(); } auto inh_w() { return m_out_inh_cb.bind(); } + auto dma_w() { return m_out_dma_cb.bind(); } void add_a2bus_card(int slot, device_a2bus_card_interface *card); device_a2bus_card_interface *get_a2bus_card(int slot); @@ -116,7 +96,7 @@ public: void set_irq_line(int state, int slot); void set_nmi_line(int state, int slot); - void set_maincpu_halt(int state); + void set_dma_line(int state); void recalc_inh(int slot); uint8_t dma_r(uint16_t offset); void dma_w(uint16_t offset, uint8_t data); @@ -133,12 +113,12 @@ protected: virtual void device_reset() override; // internal state - required_device m_maincpu; - address_space *m_maincpu_space; + required_address_space m_maincpu_space; devcb_write_line m_out_irq_cb; devcb_write_line m_out_nmi_cb; devcb_write8 m_out_inh_cb; + devcb_write_line m_out_dma_cb; device_a2bus_card_interface *m_device_list[8]; @@ -191,7 +171,8 @@ protected: void raise_slot_nmi() { m_a2bus->set_nmi_line(ASSERT_LINE, m_slot); } void lower_slot_nmi() { m_a2bus->set_nmi_line(CLEAR_LINE, m_slot); } void recalc_slot_inh() { m_a2bus->recalc_inh(m_slot); } - void set_maincpu_halt(int state) { m_a2bus->set_maincpu_halt(state); } + void raise_slot_dma() { m_a2bus->set_dma_line(ASSERT_LINE); } + void lower_slot_dma() { m_a2bus->set_dma_line(CLEAR_LINE); } device_a2bus_card_interface(const machine_config &mconfig, device_t &device); diff --git a/src/devices/bus/a2bus/a2softcard.cpp b/src/devices/bus/a2bus/a2softcard.cpp index be10dc26eb4..d41c84b9425 100644 --- a/src/devices/bus/a2bus/a2softcard.cpp +++ b/src/devices/bus/a2bus/a2softcard.cpp @@ -82,7 +82,7 @@ void a2bus_softcard_device::write_cnxx(uint8_t offset, uint8_t data) if (!m_bEnabled) { m_z80->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - set_maincpu_halt(ASSERT_LINE); + raise_slot_dma(); if (m_FirstZ80Boot) { @@ -95,7 +95,7 @@ void a2bus_softcard_device::write_cnxx(uint8_t offset, uint8_t data) else { m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - set_maincpu_halt(CLEAR_LINE); + lower_slot_dma(); m_bEnabled = false; } } diff --git a/src/devices/bus/a2bus/transwarp.cpp b/src/devices/bus/a2bus/transwarp.cpp index c4799bc07a6..bb4e4fea616 100644 --- a/src/devices/bus/a2bus/transwarp.cpp +++ b/src/devices/bus/a2bus/transwarp.cpp @@ -161,7 +161,7 @@ void a2bus_transwarp_device::device_reset() { m_bEnabled = true; m_bReadA2ROM = false; - set_maincpu_halt(ASSERT_LINE); + raise_slot_dma(); if (!(m_dsw2->read() & 0x80)) { if (m_dsw1->read() & 0x80) diff --git a/src/mame/drivers/agat.cpp b/src/mame/drivers/agat.cpp index 91e957d3267..ae9d8b1613d 100644 --- a/src/mame/drivers/agat.cpp +++ b/src/mame/drivers/agat.cpp @@ -1118,11 +1118,12 @@ MACHINE_CONFIG_START(agat7_state::agat7) * slot 0 is reserved for SECAM encoder or Apple II compat card. * slot 1 always holds the CPU card. */ - MCFG_DEVICE_ADD(m_a2bus, A2BUS, 0) - MCFG_A2BUS_CPU(A7_CPU_TAG) - MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(*this, agat7_state, a2bus_irq_w)) - MCFG_A2BUS_OUT_NMI_CB(WRITELINE(*this, agat7_state, a2bus_nmi_w)) - MCFG_A2BUS_OUT_INH_CB(WRITELINE(*this, agat7_state, a2bus_inh_w)) + A2BUS(config, m_a2bus, 0); + m_a2bus->set_space(m_maincpu, AS_PROGRAM); + m_a2bus->irq_w().set(FUNC(agat7_state::a2bus_irq_w)); + m_a2bus->nmi_w().set(FUNC(agat7_state::a2bus_nmi_w)); + m_a2bus->inh_w().set(FUNC(agat7_state::a2bus_inh_w)); + m_a2bus->dma_w().set_inputline(m_maincpu, INPUT_LINE_HALT); A2BUS_SLOT(config, "sl2", m_a2bus, agat7_cards, "a7lang"); A2BUS_SLOT(config, "sl3", m_a2bus, agat7_cards, "a7fdc"); A2BUS_SLOT(config, "sl4", m_a2bus, agat7_cards, "a7ports"); diff --git a/src/mame/drivers/apple2.cpp b/src/mame/drivers/apple2.cpp index 383e075d359..845daa5ad1a 100644 --- a/src/mame/drivers/apple2.cpp +++ b/src/mame/drivers/apple2.cpp @@ -1424,10 +1424,11 @@ MACHINE_CONFIG_START(apple2_state::apple2_common) /* slot devices */ A2BUS(config, m_a2bus, 0); - m_a2bus->set_cputag("maincpu"); + m_a2bus->set_space(m_maincpu, AS_PROGRAM); m_a2bus->irq_w().set(FUNC(apple2_state::a2bus_irq_w)); m_a2bus->nmi_w().set(FUNC(apple2_state::a2bus_nmi_w)); m_a2bus->inh_w().set(FUNC(apple2_state::a2bus_inh_w)); + m_a2bus->dma_w().set_inputline(m_maincpu, INPUT_LINE_HALT); A2BUS_SLOT(config, "sl0", m_a2bus, apple2_slot0_cards, "lang"); A2BUS_SLOT(config, "sl1", m_a2bus, apple2_cards, nullptr); A2BUS_SLOT(config, "sl2", m_a2bus, apple2_cards, nullptr); diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 6d19fe49f41..23944445982 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -4039,10 +4039,11 @@ MACHINE_CONFIG_START(apple2e_state::apple2e) /* slot devices */ A2BUS(config, m_a2bus, 0); - m_a2bus->set_cputag("maincpu"); + m_a2bus->set_space(m_maincpu, AS_PROGRAM); m_a2bus->irq_w().set(FUNC(apple2e_state::a2bus_irq_w)); m_a2bus->nmi_w().set(FUNC(apple2e_state::a2bus_nmi_w)); m_a2bus->inh_w().set(FUNC(apple2e_state::a2bus_inh_w)); + m_a2bus->dma_w().set_inputline(m_maincpu, INPUT_LINE_HALT); A2BUS_SLOT(config, "sl1", m_a2bus, apple2_cards, nullptr); A2BUS_SLOT(config, "sl2", m_a2bus, apple2_cards, nullptr); A2BUS_SLOT(config, "sl3", m_a2bus, apple2_cards, nullptr); diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp index ff4ddad6f56..70759a3d874 100644 --- a/src/mame/drivers/apple2gs.cpp +++ b/src/mame/drivers/apple2gs.cpp @@ -4683,10 +4683,11 @@ void apple2gs_state::apple2gs(machine_config &config) /* slot devices */ A2BUS(config, m_a2bus, 0); - m_a2bus->set_cputag("maincpu"); + m_a2bus->set_space(m_maincpu, AS_PROGRAM); m_a2bus->irq_w().set(FUNC(apple2gs_state::a2bus_irq_w)); m_a2bus->nmi_w().set(FUNC(apple2gs_state::a2bus_nmi_w)); m_a2bus->inh_w().set(FUNC(apple2gs_state::a2bus_inh_w)); + m_a2bus->dma_w().set_inputline(m_maincpu, INPUT_LINE_HALT); A2BUS_SLOT(config, "sl1", m_a2bus, apple2_cards, nullptr); A2BUS_SLOT(config, "sl2", m_a2bus, apple2_cards, nullptr); A2BUS_SLOT(config, "sl3", m_a2bus, apple2_cards, nullptr); diff --git a/src/mame/drivers/apple3.cpp b/src/mame/drivers/apple3.cpp index 48557d211f9..52fb6b8c8fd 100644 --- a/src/mame/drivers/apple3.cpp +++ b/src/mame/drivers/apple3.cpp @@ -96,10 +96,11 @@ void apple3_state::apple3(machine_config &config) /* slot bus */ A2BUS(config, m_a2bus, 0); - m_a2bus->set_cputag("maincpu"); + m_a2bus->set_space(m_maincpu, AS_PROGRAM); m_a2bus->irq_w().set(FUNC(apple3_state::a2bus_irq_w)); m_a2bus->nmi_w().set(FUNC(apple3_state::a2bus_nmi_w)); //m_a2bus->inh_w().set(FUNC(apple3_state::a2bus_inh_w)); + m_a2bus->dma_w().set_inputline(m_maincpu, INPUT_LINE_HALT); A2BUS_SLOT(config, "sl1", m_a2bus, apple3_cards, nullptr); A2BUS_SLOT(config, "sl2", m_a2bus, apple3_cards, nullptr); A2BUS_SLOT(config, "sl3", m_a2bus, apple3_cards, nullptr); diff --git a/src/mame/drivers/concept.cpp b/src/mame/drivers/concept.cpp index 4251ecd123c..4ead16faab6 100644 --- a/src/mame/drivers/concept.cpp +++ b/src/mame/drivers/concept.cpp @@ -258,7 +258,7 @@ void concept_state::concept(machine_config &config) m_kbdacia->set_xtal(XTAL(1'843'200)); /* Apple II bus */ - A2BUS(config, m_a2bus, 0).set_cputag(m_maincpu); + A2BUS(config, m_a2bus, 0).set_space(m_maincpu, AS_PROGRAM); A2BUS_SLOT(config, "sl1", m_a2bus, concept_a2_cards, nullptr); A2BUS_SLOT(config, "sl2", m_a2bus, concept_a2_cards, nullptr); A2BUS_SLOT(config, "sl3", m_a2bus, concept_a2_cards, nullptr); -- cgit v1.2.3