summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes/karastudio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/nes/karastudio.cpp')
-rw-r--r--src/devices/bus/nes/karastudio.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/devices/bus/nes/karastudio.cpp b/src/devices/bus/nes/karastudio.cpp
index fc98a658213..0cca5acbe11 100644
--- a/src/devices/bus/nes/karastudio.cpp
+++ b/src/devices/bus/nes/karastudio.cpp
@@ -32,12 +32,11 @@
#include "karastudio.h"
#ifdef NES_PCB_DEBUG
-#define VERBOSE 1
+#define VERBOSE (LOG_GENERAL)
#else
#define VERBOSE 0
#endif
-
-#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0)
+#include "logmacro.h"
//-----------------------------------------
@@ -51,7 +50,7 @@
//-------------------------------------------------
kstudio_cart_interface::kstudio_cart_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig, device)
+ : device_interface(device, "kstudiocart")
, m_rom(nullptr), m_bank(0)
{
}
@@ -73,8 +72,8 @@ DEFINE_DEVICE_TYPE(NES_KSEXPANSION_SLOT, nes_kstudio_slot_device, "nes_ks_slot",
nes_kstudio_slot_device::nes_kstudio_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, NES_KSEXPANSION_SLOT, tag, owner, clock)
- , device_image_interface(mconfig, *this)
- , device_slot_interface(mconfig, *this)
+ , device_cartrom_image_interface(mconfig, *this)
+ , device_single_card_slot_interface<kstudio_cart_interface>(mconfig, *this)
, m_cart(nullptr)
{
}
@@ -86,44 +85,43 @@ nes_kstudio_slot_device::~nes_kstudio_slot_device()
void nes_kstudio_slot_device::device_start()
{
- m_cart = dynamic_cast<kstudio_cart_interface *>(get_card_device());
+ m_cart = get_card_device();
}
uint8_t nes_kstudio_slot_device::read(offs_t offset)
{
if (m_cart)
return m_cart->read(offset);
-
- return 0xff;
+ else
+ return 0xff;
}
-image_init_result nes_kstudio_slot_device::call_load()
+std::pair<std::error_condition, std::string> nes_kstudio_slot_device::call_load()
{
if (m_cart)
{
- uint8_t *ROM = m_cart->get_cart_base();
-
+ uint8_t *const ROM = m_cart->get_cart_base();
if (!ROM)
- return image_init_result::FAIL;
+ return std::make_pair(image_error::INTERNAL, std::string());
// Existing expansion carts are all 128K, so we only load files of this size
if (!loaded_through_softlist())
{
if (length() != 0x20000)
- return image_init_result::FAIL;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 128K)");
- fread(&ROM, 0x20000);
+ fread(ROM, 0x20000);
}
else
{
if (get_software_region_length("rom") != 0x20000)
- return image_init_result::FAIL;
+ return std::make_pair(image_error::INVALIDLENGTH, "Unsupported cartridge size (must be 128K)");
memcpy(ROM, get_software_region("rom"), 0x20000);
}
}
- return image_init_result::PASS;
+ return std::make_pair(std::error_condition(), std::string());
}
@@ -199,7 +197,6 @@ void nes_karaokestudio_device::device_start()
void nes_karaokestudio_device::pcb_reset()
{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg16_89ab(0);
prg16_cdef((m_prg_chunks - 1) ^ 0x08);
chr8(0, m_chr_source);
@@ -227,13 +224,13 @@ void nes_karaokestudio_device::pcb_reset()
uint8_t nes_karaokestudio_device::read_m(offs_t offset)
{
- LOG_MMC(("karaoke studio read_m, offset: %04x\n", offset));
+ LOG("karaoke studio read_m, offset: %04x\n", offset);
return m_mic_ipt->read();
}
uint8_t nes_karaokestudio_device::read_h(offs_t offset)
{
- LOG_MMC(("karaoke studio read_h, offset: %04x\n", offset));
+ LOG("karaoke studio read_h, offset: %04x\n", offset);
// this shall be the proper code, but it's a bit slower, so we access directly the subcart below
//return m_subslot->read(offset);
@@ -249,7 +246,7 @@ uint8_t nes_karaokestudio_device::read_h(offs_t offset)
void nes_karaokestudio_device::write_h(offs_t offset, uint8_t data)
{
- LOG_MMC(("karaoke studio write_h, offset: %04x, data: %02x\n", offset, data));
+ LOG("karaoke studio write_h, offset: %04x, data: %02x\n", offset, data);
// bit3 1 = M ROM (main unit), 0=E ROM (expansion)
// HACK(?): currently it is not clear how the unit acknowledges the presence of the expansion
// cart (when expansion is present, code keeps switching both from the expansion rom and from