bus/a2bus/a2eauxslot: Sanitize configuration (nw)

This commit is contained in:
AJR 2019-02-25 21:58:23 -05:00
parent 3041d13692
commit e5b288a158
6 changed files with 15 additions and 28 deletions

View File

@ -33,20 +33,16 @@ a2eauxslot_slot_device::a2eauxslot_slot_device(const machine_config &mconfig, co
a2eauxslot_slot_device::a2eauxslot_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_slot_interface(mconfig, *this)
, m_a2eauxslot_tag(nullptr)
, m_a2eauxslot_slottag(nullptr)
, m_a2eauxslot(*this, finder_base::DUMMY_TAG)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void a2eauxslot_slot_device::device_start()
void a2eauxslot_slot_device::device_resolve_objects()
{
device_a2eauxslot_card_interface *dev = dynamic_cast<device_a2eauxslot_card_interface *>(get_card_device());
if (dev) dev->set_a2eauxslot_tag(m_a2eauxslot_tag, m_a2eauxslot_slottag);
if (dev)
dev->set_a2eauxslot_device(m_a2eauxslot.target());
}
//**************************************************************************
@ -139,7 +135,7 @@ WRITE_LINE_MEMBER( a2eauxslot_device::nmi_w ) { m_out_nmi_cb(state); }
device_a2eauxslot_card_interface::device_a2eauxslot_card_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device),
m_a2eauxslot(nullptr),
m_a2eauxslot_tag(nullptr), m_a2eauxslot_slottag(nullptr), m_slot(0), m_next(nullptr)
m_slot(0), m_next(nullptr)
{
}
@ -152,8 +148,8 @@ device_a2eauxslot_card_interface::~device_a2eauxslot_card_interface()
{
}
void device_a2eauxslot_card_interface::set_a2eauxslot_device()
void device_a2eauxslot_card_interface::set_a2eauxslot_device(a2eauxslot_device *a2eauxslot)
{
m_a2eauxslot = dynamic_cast<a2eauxslot_device *>(device().machine().device(m_a2eauxslot_tag));
m_a2eauxslot = a2eauxslot;
m_a2eauxslot->add_a2eauxslot_card(this);
}

View File

@ -27,30 +27,28 @@ class a2eauxslot_slot_device : public device_t,
{
public:
// construction/destruction
template <typename T>
a2eauxslot_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, char const *slottag)
template <typename T, typename U>
a2eauxslot_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slottag, U &&opts, char const *dflt)
: a2eauxslot_slot_device(mconfig, tag, owner, 0)
{
option_reset();
opts(*this);
set_default_option(dflt);
set_fixed(false);
set_a2eauxslot_slot(slottag, tag);
m_a2eauxslot.set_tag(std::forward<T>(slottag));
}
a2eauxslot_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
// device-level overrides
virtual void device_start() override;
// inline configuration
void set_a2eauxslot_slot(const char *tag, const char *slottag) { m_a2eauxslot_tag = tag; m_a2eauxslot_slottag = slottag; }
virtual void device_resolve_objects() override;
virtual void device_start() override { }
protected:
a2eauxslot_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// configuration
const char *m_a2eauxslot_tag, *m_a2eauxslot_slottag;
required_device<a2eauxslot_device> m_a2eauxslot;
};
// device type definition
@ -119,21 +117,17 @@ public:
device_a2eauxslot_card_interface *next() const { return m_next; }
void set_a2eauxslot_device();
void set_a2eauxslot_device(a2eauxslot_device *a2eauxslot);
void raise_slot_irq() { m_a2eauxslot->set_irq_line(ASSERT_LINE); }
void lower_slot_irq() { m_a2eauxslot->set_irq_line(CLEAR_LINE); }
void raise_slot_nmi() { m_a2eauxslot->set_nmi_line(ASSERT_LINE); }
void lower_slot_nmi() { m_a2eauxslot->set_nmi_line(CLEAR_LINE); }
// inline configuration
void set_a2eauxslot_tag(const char *tag, const char *slottag) { m_a2eauxslot_tag = tag; m_a2eauxslot_slottag = slottag; }
protected:
device_a2eauxslot_card_interface(const machine_config &mconfig, device_t &device);
a2eauxslot_device *m_a2eauxslot;
const char *m_a2eauxslot_tag, *m_a2eauxslot_slottag;
int m_slot;
device_a2eauxslot_card_interface *m_next;
};

View File

@ -43,7 +43,6 @@ a2eaux_ext80col_device::a2eaux_ext80col_device(const machine_config &mconfig, de
void a2eaux_ext80col_device::device_start()
{
set_a2eauxslot_device();
memset(m_ram, 0, sizeof(m_ram));
save_item(NAME(m_ram));
}

View File

@ -45,7 +45,6 @@ a2eaux_ramworks3_device::a2eaux_ramworks3_device(const machine_config &mconfig,
void a2eaux_ramworks3_device::device_start()
{
set_a2eauxslot_device();
save_item(NAME(m_ram));
save_item(NAME(m_bank));
}

View File

@ -43,7 +43,6 @@ a2eaux_std80col_device::a2eaux_std80col_device(const machine_config &mconfig, de
void a2eaux_std80col_device::device_start()
{
set_a2eauxslot_device();
save_item(NAME(m_ram));
}

View File

@ -4090,7 +4090,7 @@ void apple2e_state::apple2e(machine_config &config)
m_a2eauxslot->set_space(m_maincpu, AS_PROGRAM);
m_a2eauxslot->out_irq_callback().set(FUNC(apple2e_state::a2bus_irq_w));
m_a2eauxslot->out_nmi_callback().set(FUNC(apple2e_state::a2bus_nmi_w));
A2EAUXSLOT_SLOT(config, "aux", apple2eaux_cards, "ext80", A2_AUXSLOT_TAG);
A2EAUXSLOT_SLOT(config, "aux", m_a2eauxslot, apple2eaux_cards, "ext80");
/* softlist config for baseline A2E
By default, filter lists where possible to compatible disks for A2E */