summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/kc/kc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/kc/kc.cpp')
-rw-r--r--src/devices/bus/kc/kc.cpp52
1 files changed, 28 insertions, 24 deletions
diff --git a/src/devices/bus/kc/kc.cpp b/src/devices/bus/kc/kc.cpp
index aa9e75e1951..feed0c8995e 100644
--- a/src/devices/bus/kc/kc.cpp
+++ b/src/devices/bus/kc/kc.cpp
@@ -38,7 +38,7 @@
VCC 28 57 NC
NC 29 58 NC
- Slots are organized into a chain (MEI -> MEO) , the first module that
+ Slots are organized into a chain (MEI -> MEO), the first module that
decode the address on bus, clear the MEO line for disable other modules
with less priority.
@@ -107,7 +107,8 @@
#include "emu.h"
#include "kc.h"
-#define LOG 0
+//#define VERBOSE 1
+#include "logmacro.h"
/***************************************************************************
@@ -131,7 +132,7 @@ DEFINE_DEVICE_TYPE(KCCART_SLOT, kccart_slot_device, "kccart_slot", "KC85 Cartrid
//-------------------------------------------------
device_kcexp_interface::device_kcexp_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device)
+ : device_interface(device, "kcexp")
{
}
@@ -159,11 +160,12 @@ kcexp_slot_device::kcexp_slot_device(const machine_config &mconfig, const char *
kcexp_slot_device::kcexp_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),
+ device_single_card_slot_interface<device_kcexp_interface>(mconfig, *this),
m_out_irq_cb(*this),
m_out_nmi_cb(*this),
m_out_halt_cb(*this),
- m_cart(nullptr), m_next_slot_tag(nullptr), m_next_slot(nullptr)
+ m_cart(nullptr),
+ m_next_slot(*this, finder_base::DUMMY_TAG)
{
}
@@ -175,19 +177,22 @@ kcexp_slot_device::~kcexp_slot_device()
{
}
+
+void kcexp_slot_device::device_validity_check(validity_checker &valid) const
+{
+ std::pair<device_t &, char const *> const next_target(m_next_slot.finder_target());
+ if ((next_target.second != finder_base::DUMMY_TAG) && !m_next_slot)
+ osd_printf_error("Next slot device %s relative to %s not found", next_target.second, next_target.first.tag());
+}
+
+
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void kcexp_slot_device::device_start()
{
- m_cart = dynamic_cast<device_kcexp_interface *>(get_card_device());
- m_next_slot = m_next_slot_tag ? owner()->subdevice<kcexp_slot_device>(m_next_slot_tag) : nullptr;
-
- // resolve callbacks
- m_out_irq_cb.resolve_safe();
- m_out_nmi_cb.resolve_safe();
- m_out_halt_cb.resolve_safe();
+ m_cart = get_card_device();
}
@@ -260,9 +265,9 @@ void kcexp_slot_device::io_write(offs_t offset, uint8_t data)
MEI line write
-------------------------------------------------*/
-WRITE_LINE_MEMBER( kcexp_slot_device::mei_w )
+void kcexp_slot_device::mei_w(int state)
{
- if (LOG) logerror("KCEXP '%s': %s MEI line\n", tag(), state != CLEAR_LINE ? "ASSERT": "CLEAR");
+ LOG("KCEXP: %s MEI line\n", state != CLEAR_LINE ? "ASSERT": "CLEAR");
if (m_cart)
m_cart->mei_w(state);
@@ -272,9 +277,9 @@ WRITE_LINE_MEMBER( kcexp_slot_device::mei_w )
MEO line write
-------------------------------------------------*/
-WRITE_LINE_MEMBER( kcexp_slot_device::meo_w )
+void kcexp_slot_device::meo_w(int state)
{
- if (LOG) logerror("KCEXP '%s': %s MEO line\n", tag(), state != CLEAR_LINE ? "ASSERT": "CLEAR");
+ LOG("KCEXP: %s MEO line\n", state != CLEAR_LINE ? "ASSERT": "CLEAR");
if (m_next_slot)
m_next_slot->mei_w(state);
@@ -290,7 +295,7 @@ WRITE_LINE_MEMBER( kcexp_slot_device::meo_w )
//-------------------------------------------------
kccart_slot_device::kccart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
kcexp_slot_device(mconfig, KCCART_SLOT, tag, owner, clock),
- device_image_interface(mconfig, *this)
+ device_cartrom_image_interface(mconfig, *this)
{
}
@@ -306,15 +311,14 @@ kccart_slot_device::~kccart_slot_device()
call load
-------------------------------------------------*/
-image_init_result kccart_slot_device::call_load()
+std::pair<std::error_condition, std::string> kccart_slot_device::call_load()
{
if (m_cart)
{
- offs_t read_length;
- uint8_t *cart_base = m_cart->get_cart_base();
-
- if (cart_base != nullptr)
+ uint8_t *const cart_base = m_cart->get_cart_base();
+ if (cart_base)
{
+ offs_t read_length;
if (!loaded_through_softlist())
{
read_length = length();
@@ -327,10 +331,10 @@ image_init_result kccart_slot_device::call_load()
}
}
else
- return image_init_result::FAIL;
+ return std::make_pair(image_error::INTERNAL, std::string());
}
- return image_init_result::PASS;
+ return std::make_pair(std::error_condition(), std::string());
}
/*-------------------------------------------------