bus/coco: Minor cleanup of base cartridge class. (#10647)

Moved a member initialization to constructor, use resolve_safe() for callbacks to remove some checks.
This commit is contained in:
tim lindner 2022-12-11 07:02:59 -08:00 committed by GitHub
parent 85f8cb10e7
commit 61d270cf4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -153,7 +153,7 @@ void cococart_slot_device::device_start()
m_cart_line.value = line_value::CLEAR;
m_cart_line.line = 0;
m_cart_line.q_count = 0;
m_cart_callback.resolve();
m_cart_callback.resolve_safe();
m_cart_line.callback = &m_cart_callback;
m_nmi_line.timer_index = 0;
@ -161,7 +161,7 @@ void cococart_slot_device::device_start()
m_nmi_line.value = line_value::CLEAR;
m_nmi_line.line = 0;
m_nmi_line.q_count = 0;
m_nmi_callback.resolve();
m_nmi_callback.resolve_safe();
m_nmi_line.callback = &m_nmi_callback;
m_halt_line.timer_index = 0;
@ -169,7 +169,7 @@ void cococart_slot_device::device_start()
m_halt_line.value = line_value::CLEAR;
m_halt_line.line = 0;
m_halt_line.q_count = 0;
m_halt_callback.resolve();
m_halt_callback.resolve_safe();
m_halt_line.callback = &m_halt_callback;
m_cart = get_card_device();
@ -346,9 +346,8 @@ void cococart_slot_device::set_line(line ln, coco_cartridge_line &line, cococart
break;
}
/* invoke the callback, if present */
if (!(*line.callback).isnull())
(*line.callback)(line.line);
/* invoke the callback */
(*line.callback)(line.line);
}
}
@ -657,7 +656,7 @@ template class device_finder<device_cococart_interface, true>;
device_cococart_interface::device_cococart_interface(const machine_config &mconfig, device_t &device)
: device_interface(device, "cococart")
, m_owning_slot(nullptr)
, m_owning_slot(dynamic_cast<cococart_slot_device *>(device.owner()))
, m_host(nullptr)
{
}
@ -678,7 +677,6 @@ device_cococart_interface::~device_cococart_interface()
void device_cococart_interface::interface_config_complete()
{
m_owning_slot = dynamic_cast<cococart_slot_device *>(device().owner());
m_host = m_owning_slot
? dynamic_cast<device_cococart_host_interface *>(m_owning_slot->owner())
: nullptr;

View File

@ -221,7 +221,7 @@ protected:
private:
cococart_base_update_delegate m_update;
cococart_slot_device * m_owning_slot;
cococart_slot_device * const m_owning_slot;
device_cococart_host_interface * m_host;
};