From 379243808b30e78a94576d82f17b07ee43ed2a3d Mon Sep 17 00:00:00 2001 From: cam900 Date: Fri, 27 Sep 2019 13:56:55 +0900 Subject: ay8910.cpp : Device-fied sunsoft 5B sound hardware - it has Yamaha volume parameter, single sound output and internal divider. - Developed by Yamaha --- src/devices/bus/nes/sunsoft.cpp | 2 +- src/devices/sound/ay8910.cpp | 10 +++++++++- src/devices/sound/ay8910.h | 13 +++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/devices/bus/nes/sunsoft.cpp b/src/devices/bus/nes/sunsoft.cpp index be90e36e535..926b1933c91 100644 --- a/src/devices/bus/nes/sunsoft.cpp +++ b/src/devices/bus/nes/sunsoft.cpp @@ -616,5 +616,5 @@ void nes_sunsoft_5_device::device_add_mconfig(machine_config &config) // TODO: this is not how Sunsoft 5B clock signaling works! // The board uses the CLK pin in reality, not hardcoded NTSC values! - YM2149(config, m_ym2149, (XTAL(21'477'272)/12)/2).add_route(ALL_OUTPUTS, "addon", 0.50); // divide by 2 for the internal divider + SUNSOFT_5B_SOUND(config, m_ym2149, XTAL(21'477'272)/12).add_route(ALL_OUTPUTS, "addon", 0.50); } diff --git a/src/devices/sound/ay8910.cpp b/src/devices/sound/ay8910.cpp index 6ae9518c29e..82d32585290 100644 --- a/src/devices/sound/ay8910.cpp +++ b/src/devices/sound/ay8910.cpp @@ -1405,7 +1405,7 @@ void ay8910_device::set_volume(int channel,int volume) void ay8910_device::ay_set_clock(int clock) { // FIXME: this doesn't belong here, it should be an input pin exposed via devcb - if ((m_feature & PSG_PIN26_IS_CLKSEL) && (m_flags & YM2149_PIN26_LOW)) + if (((m_feature & PSG_PIN26_IS_CLKSEL) && (m_flags & YM2149_PIN26_LOW)) || (m_feature & PSG_HAS_INTERNAL_DIVIDER)) m_channel->set_sample_rate((m_feature & PSG_HAS_EXPANDED_MODE) ? clock : clock / 16); else m_channel->set_sample_rate((m_feature & PSG_HAS_EXPANDED_MODE) ? clock * 2 : clock / 8); @@ -1742,3 +1742,11 @@ ymz294_device::ymz294_device(const machine_config &mconfig, const char *tag, dev : ay8910_device(mconfig, YMZ294, tag, owner, clock, PSG_TYPE_YM, 1, 0) { } + + +DEFINE_DEVICE_TYPE(SUNSOFT_5B_SOUND, sunsoft_5b_sound_device, "sunsoft_5b_sound", "Sunsoft/Yamaha 5B 6630B (Sound)") + +sunsoft_5b_sound_device::sunsoft_5b_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : ay8910_device(mconfig, SUNSOFT_5B_SOUND, tag, owner, clock, PSG_TYPE_YM, 1, 0, PSG_HAS_INTERNAL_DIVIDER) +{ +} diff --git a/src/devices/sound/ay8910.h b/src/devices/sound/ay8910.h index 146c1926522..d9af1b6b86f 100644 --- a/src/devices/sound/ay8910.h +++ b/src/devices/sound/ay8910.h @@ -66,8 +66,9 @@ public: { PSG_DEFAULT = 0x0, PSG_PIN26_IS_CLKSEL = 0x1, - PSG_EXTENDED_ENVELOPE = 0x2, - PSG_HAS_EXPANDED_MODE = 0x4 + PSG_HAS_INTERNAL_DIVIDER = 0x2, + PSG_EXTENDED_ENVELOPE = 0x4, + PSG_HAS_EXPANDED_MODE = 0x8 }; // construction/destruction @@ -389,5 +390,13 @@ public: DECLARE_DEVICE_TYPE(YMZ294, ymz294_device) +class sunsoft_5b_sound_device : public ay8910_device +{ +public: + sunsoft_5b_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + +DECLARE_DEVICE_TYPE(SUNSOFT_5B_SOUND, sunsoft_5b_sound_device) + #endif // MAME_DEVICES_SOUND_AY8910_H -- cgit v1.2.3-70-g09d2