mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
a2bus: Replace CPU finder with address space finder; make DMA line an explicitly configured callback; remove MCFG_ macros (nw)
This commit is contained in:
parent
24f33f3cf4
commit
3de63dc884
@ -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)
|
||||
|
@ -25,22 +25,6 @@
|
||||
#define INH_READ 0x01
|
||||
#define INH_WRITE 0x02
|
||||
|
||||
//**************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_A2BUS_CPU(_cputag) \
|
||||
downcast<a2bus_device &>(*device).set_cputag(_cputag);
|
||||
|
||||
#define MCFG_A2BUS_OUT_IRQ_CB(_devcb) \
|
||||
downcast<a2bus_device &>(*device).set_out_irq_callback(DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_A2BUS_OUT_NMI_CB(_devcb) \
|
||||
downcast<a2bus_device &>(*device).set_out_nmi_callback(DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_A2BUS_OUT_INH_CB(_devcb) \
|
||||
downcast<a2bus_device &>(*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 <typename T> void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); }
|
||||
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)); }
|
||||
template <class Object> devcb_base &set_out_inh_callback(Object &&cb) { return m_out_inh_cb.set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
// devcb3
|
||||
template <typename T> void set_space(T &&tag, int spacenum) { m_maincpu_space.set_tag(std::forward<T>(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<cpu_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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user