From 3cfc5224583f219ce5539708f78816d63f21c965 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Fri, 14 May 2021 18:33:49 -0700 Subject: ymfm: Refactor new FM engine into a 3rdparty library (#8046) ymfm: refactor the code into a separate 3rdparty library * Moved ymfm core implementation to 3rdparty/ymfm * Split out each family (OPM/OPN/OPL/etc) into its own source file * Added preliminary OPQ and OPZ support, still WIP * Put all 3rdparty code into its own namespace ymfm * Fixed various bugs reported in #8042 * Created interface class for communication between the 3rdparty engine and the emulator * Standardized MAME implementation of all Yamaha devices based on a template class * Created standard base class ym_generic that can be used when multiple YM chips are swapped in * Changed YM2203/2608/2610 to embed a YM2149 as a subdevice instead of deriving from ay8910_device * Also provided compile-time option to use a simplified built-in SSG rather than using MAME's at all (currently off) * Consolidated MAME header files from one-per-chip (ym2151.h, ym2203.h, etc) to one-per-family (ymopm.h, ymopn.h, etc) --- src/devices/sound/ymopm.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/devices/sound/ymopm.cpp (limited to 'src/devices/sound/ymopm.cpp') diff --git a/src/devices/sound/ymopm.cpp b/src/devices/sound/ymopm.cpp new file mode 100644 index 00000000000..a75da72b449 --- /dev/null +++ b/src/devices/sound/ymopm.cpp @@ -0,0 +1,81 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles + +#include "emu.h" +#include "ymopm.h" + + +//********************************************************* +// YM2151 DEVICE +//********************************************************* + +DEFINE_DEVICE_TYPE(YM2151, ym2151_device, "ym2151", "YM2151 OPM") + +//------------------------------------------------- +// ym2151_device - constructor +//------------------------------------------------- + +ym2151_device::ym2151_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + ymfm_device_base(mconfig, tag, owner, clock, YM2151), + m_reset_state(1) +{ +} + + +//------------------------------------------------- +// write/register_w/data_w - write access +//------------------------------------------------- + +void ym2151_device::write(offs_t offset, u8 data) +{ + if (m_reset_state == 0) + return; + parent::write(offset, data); +} + +void ym2151_device::address_w(u8 data) +{ + if (m_reset_state == 0) + return; + parent::address_w(data); +} + +void ym2151_device::data_w(u8 data) +{ + if (m_reset_state == 0) + return; + parent::data_w(data); +} + + +//------------------------------------------------- +// reset_w - reset line, active LOW +//------------------------------------------------- + +WRITE_LINE_MEMBER(ym2151_device::reset_w) +{ + if (state != m_reset_state) + { + m_stream->update(); + m_reset_state = state; + if (state != 0) + m_chip.reset(); + } +} + + + +//********************************************************* +// YM2164 DEVICE +//********************************************************* + +DEFINE_DEVICE_TYPE(YM2164, ym2164_device, "ym2164", "YM2164 OPP") + +//------------------------------------------------- +// ym2164_device - constructor +//------------------------------------------------- + +ym2164_device::ym2164_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + ymfm_device_base(mconfig, tag, owner, clock, YM2164) +{ +} -- cgit v1.2.3-70-g09d2