From c1b0bf352bf01586eac6f4fb5afcf8afc839a156 Mon Sep 17 00:00:00 2001 From: wilbertpol Date: Fri, 10 Mar 2023 18:33:19 +0000 Subject: bus/msx: Added Yamaha UCN-01 cartridge-to-module slot adapter. (#10972) --- scripts/src/bus.lua | 2 + src/devices/bus/msx/cart/cartridge.cpp | 2 + src/devices/bus/msx/cart/yamaha_ucn01.cpp | 64 +++++++++++++++++++++++++++++++ src/devices/bus/msx/cart/yamaha_ucn01.h | 12 ++++++ 4 files changed, 80 insertions(+) create mode 100644 src/devices/bus/msx/cart/yamaha_ucn01.cpp create mode 100644 src/devices/bus/msx/cart/yamaha_ucn01.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index b026cf16ba2..7dbc96e79c1 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1947,6 +1947,8 @@ if (BUSES["MSX_SLOT"]~=null) then MAME_DIR .. "src/devices/bus/msx/cart/super_swangi.h", MAME_DIR .. "src/devices/bus/msx/cart/yamaha.cpp", MAME_DIR .. "src/devices/bus/msx/cart/yamaha.h", + MAME_DIR .. "src/devices/bus/msx/cart/yamaha_ucn01.cpp", + MAME_DIR .. "src/devices/bus/msx/cart/yamaha_ucn01.h", MAME_DIR .. "src/devices/bus/msx/softcard/softcard.cpp", MAME_DIR .. "src/devices/bus/msx/softcard/softcard.h", } diff --git a/src/devices/bus/msx/cart/cartridge.cpp b/src/devices/bus/msx/cart/cartridge.cpp index 1ac5d458371..da745073fa9 100644 --- a/src/devices/bus/msx/cart/cartridge.cpp +++ b/src/devices/bus/msx/cart/cartridge.cpp @@ -32,6 +32,7 @@ #include "superloderunner.h" #include "super_swangi.h" #include "yamaha.h" +#include "yamaha_ucn01.h" #include "bus/msx/slot/cartridge.h" @@ -80,6 +81,7 @@ void msx_cart(device_slot_interface &device, bool is_in_subslot) device.option_add("beepack", MSX_CART_BEEPACK); device.option_add("bm_012", MSX_CART_BM_012); device.option_add("moonsound", MSX_CART_MOONSOUND); + device.option_add("ucn01", MSX_CART_UCN01); if (!is_in_subslot) { device.option_add("slotexp", MSX_CART_SLOTEXPANDER); diff --git a/src/devices/bus/msx/cart/yamaha_ucn01.cpp b/src/devices/bus/msx/cart/yamaha_ucn01.cpp new file mode 100644 index 00000000000..39aa35a9e46 --- /dev/null +++ b/src/devices/bus/msx/cart/yamaha_ucn01.cpp @@ -0,0 +1,64 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "yamaha_ucn01.h" + +/* +Emulation of Yamaha UCN-01. + +Converts a regular MSX cartridge slot into a Yamaha module slot. + +The extra pins are not connected so modules that make use of the +video out or sound out pins would not work. This limitation is +currently not emulated. + +*/ + +namespace { + +class msx_cart_ucn01_device : public device_t, public msx_cart_interface +{ +public: + msx_cart_ucn01_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, MSX_CART_UCN01, tag, owner, clock) + , msx_cart_interface(mconfig, *this) + , m_module(*this, "module") + { } + +protected: + virtual void device_start() override { } + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_resolve_objects() override; + virtual void device_config_complete() override; + +private: + required_device m_module; +}; + +void msx_cart_ucn01_device::device_add_mconfig(machine_config &mconfig) +{ + MSX_SLOT_YAMAHA_EXPANSION(mconfig, m_module, 0); + m_module->option_reset(); + msx_yamaha_60pin(*m_module, false); + m_module->set_default_option(nullptr); + m_module->set_fixed(false); + m_module->irq_handler().set(*this, FUNC(msx_cart_ucn01_device::irq_out)); +} + +void msx_cart_ucn01_device::device_config_complete() +{ + if (parent_slot()) + { + auto target = m_module.finder_target(); + parent_slot()->configure_subslot(*target.first.subdevice(target.second)); + } +} + +void msx_cart_ucn01_device::device_resolve_objects() +{ + m_module->install(page(0), page(1), page(2), page(3)); +} + +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(MSX_CART_UCN01, msx_cart_interface, msx_cart_ucn01_device, "msx_cart_ucn01", "Yamaha UCN-01") diff --git a/src/devices/bus/msx/cart/yamaha_ucn01.h b/src/devices/bus/msx/cart/yamaha_ucn01.h new file mode 100644 index 00000000000..469f4a7eb8f --- /dev/null +++ b/src/devices/bus/msx/cart/yamaha_ucn01.h @@ -0,0 +1,12 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef MAME_BUS_MSX_CART_YAMAHA_UCN01_H +#define MAME_BUS_MSX_CART_YAMAHA_UCN01_H + +#pragma once + +#include "bus/msx/slot/cartridge.h" + +DECLARE_DEVICE_TYPE(MSX_CART_UCN01, msx_cart_interface) + +#endif // MAME_BUS_MSX_CART_YAMAHA_UCN01_H -- cgit v1.2.3