bus/msx: Added Yamaha UCN-01 cartridge-to-module slot adapter. (#10972)

This commit is contained in:
wilbertpol 2023-03-10 18:33:19 +00:00 committed by GitHub
parent 5d7d18a9c6
commit c1b0bf352b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 80 additions and 0 deletions

View File

@ -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",
}

View File

@ -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);

View File

@ -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<msx_slot_yamaha_expansion_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<msx_slot_yamaha_expansion_device>(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")

View File

@ -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