ti99: Removed casts and fixed a bug in the multi-cartridge connector.

This commit is contained in:
Michael Zapf 2024-03-29 20:12:34 +01:00
parent a17efb048e
commit de91658241
6 changed files with 9 additions and 14 deletions

View file

@ -127,7 +127,7 @@ namespace bus::ti99::gromport {
gromport_device::gromport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TI99_GROMPORT, tag, owner, clock),
device_slot_interface(mconfig, *this),
device_single_card_slot_interface<cartridge_connector_device>(mconfig, *this),
m_connector(nullptr),
m_reset_on_insert(true),
m_console_ready(*this),
@ -244,12 +244,7 @@ bool gromport_device::is_grom_idle()
void gromport_device::device_config_complete()
{
if (subdevices().first() != nullptr)
{
m_connector = dynamic_cast<cartridge_connector_device*>(subdevices().first());
if (m_connector == nullptr)
throw emu_fatalerror("gromport_device: cartridge connector not found");
}
m_connector = get_card_device();
}
INPUT_PORTS_START(gromport)

View file

@ -25,7 +25,7 @@ struct pcb_type
class ti99_cartridge_device;
class cartridge_connector_device;
class gromport_device : public device_t, public device_slot_interface
class gromport_device : public device_t, public device_single_card_slot_interface<cartridge_connector_device>
{
public:
template <typename U>

View file

@ -45,7 +45,7 @@
#define LOG_WARN (1U << 1)
#define LOG_CHANGE (1U << 2)
#define VERBOSE (LOG_WARN)
#define VERBOSE (LOG_GENERAL | LOG_WARN)
#include "logmacro.h"
@ -252,7 +252,7 @@ void ti99_multi_cart_conn_device::crureadz(offs_t offset, uint8_t *value)
void ti99_multi_cart_conn_device::cruwrite(offs_t offset, uint8_t data)
{
int slot = get_active_slot(true, offset);
int slot = get_active_slot(false, offset);
/* Sanity check. Higher slots are always empty. */
if (slot >= NUMBER_OF_CARTRIDGE_SLOTS)

View file

@ -86,7 +86,7 @@ namespace bus::ti99::internal {
ioport_device::ioport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TI99_IOPORT, tag, owner, clock),
device_slot_interface(mconfig, *this),
device_single_card_slot_interface<ioport_attached_device>(mconfig, *this),
m_console_extint(*this),
m_console_ready(*this),
m_connected(nullptr)
@ -155,7 +155,7 @@ void ioport_device::device_start()
void ioport_device::device_config_complete()
{
m_connected = static_cast<ioport_attached_device*>(subdevices().first());
m_connected = get_card_device();
}

View file

@ -53,7 +53,7 @@ private:
I/O port
********************************************************************/
class ioport_device : public device_t, public device_slot_interface
class ioport_device : public device_t, public device_single_card_slot_interface<ioport_attached_device>
{
friend class ioport_attached_device;

View file

@ -98,7 +98,7 @@ void joyport_device::device_start()
void joyport_device::device_config_complete()
{
m_connected = dynamic_cast<device_ti99_joyport_interface*>(subdevices().first());
m_connected = get_card_device();
}
/*****************************************************************************/