From 8e7642c070561bd39535b692703d6e911328c2c5 Mon Sep 17 00:00:00 2001 From: angelosa Date: Sun, 8 Sep 2024 19:18:44 +0200 Subject: [PATCH] funtech/acan: rename to umc6619_sound.cpp/.h, add minor notes --- src/mame/funtech/supracan.cpp | 12 +++--- .../funtech/{acan.cpp => umc6619_sound.cpp} | 37 ++++++++++++------- src/mame/funtech/{acan.h => umc6619_sound.h} | 12 +++--- 3 files changed, 37 insertions(+), 24 deletions(-) rename src/mame/funtech/{acan.cpp => umc6619_sound.cpp} (86%) rename src/mame/funtech/{acan.h => umc6619_sound.h} (81%) diff --git a/src/mame/funtech/supracan.cpp b/src/mame/funtech/supracan.cpp index a789b8f6de6..66e229f12e8 100644 --- a/src/mame/funtech/supracan.cpp +++ b/src/mame/funtech/supracan.cpp @@ -64,16 +64,18 @@ STATUS: **************************************************************************************************/ #include "emu.h" -#include "cpu/m68000/m68000.h" -#include "cpu/m6502/m65c02.h" + #include "bus/generic/slot.h" #include "bus/generic/carts.h" -#include "acan.h" +#include "cpu/m68000/m68000.h" +#include "cpu/m6502/m65c02.h" + #include "emupal.h" #include "screen.h" #include "softlist_dev.h" #include "speaker.h" #include "tilemap.h" +#include "umc6619_sound.h" #include "umc6650.h" #define LOG_UNKNOWNS (1U << 1) @@ -185,7 +187,7 @@ private: required_shared_ptr m_vram; required_shared_ptr m_soundram; - required_device m_sound; + required_device m_sound; required_device m_gfxdecode; required_device m_screen; @@ -2255,7 +2257,7 @@ void supracan_state::supracan(machine_config &config) SPEAKER(config, "rspeaker").front_right(); // TODO: derive and verify from U13_CLOCK - ACANSND(config, m_sound, XTAL(3'579'545)); + UMC6619_SOUND(config, m_sound, XTAL(3'579'545)); m_sound->ram_read().set(FUNC(supracan_state::sound_ram_read)); m_sound->timer_irq_handler().set(FUNC(supracan_state::sound_timer_irq)); m_sound->dma_irq_handler().set(FUNC(supracan_state::sound_dma_irq)); diff --git a/src/mame/funtech/acan.cpp b/src/mame/funtech/umc6619_sound.cpp similarity index 86% rename from src/mame/funtech/acan.cpp rename to src/mame/funtech/umc6619_sound.cpp index e92928695bc..bf847eb12c7 100644 --- a/src/mame/funtech/acan.cpp +++ b/src/mame/funtech/umc6619_sound.cpp @@ -2,23 +2,23 @@ // copyright-holders:Ryan Holtz, superctr /*************************************************************************** - Super A'Can sound driver + Super A'Can UMC 6619 sound driver Currently has a number of unknown registers and functionality. ****************************************************************************/ #include "emu.h" -#include "acan.h" +#include "umc6619_sound.h" #define VERBOSE (0) #include "logmacro.h" // device type definition -DEFINE_DEVICE_TYPE(ACANSND, acan_sound_device, "acansound", "Super A'Can Audio") +DEFINE_DEVICE_TYPE(UMC6619_SOUND, umc6619_sound_device, "umc6619_sound", "UMC UM6619 Sound Engine") -acan_sound_device::acan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ACANSND, tag, owner, clock) +umc6619_sound_device::umc6619_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, UMC6619_SOUND, tag, owner, clock) , device_sound_interface(mconfig, *this) , m_stream(nullptr) , m_timer(nullptr) @@ -31,11 +31,11 @@ acan_sound_device::acan_sound_device(const machine_config &mconfig, const char * } -void acan_sound_device::device_start() +void umc6619_sound_device::device_start() { m_stream = stream_alloc(0, 2, clock() / 16 / 5); m_mix = std::make_unique((clock() / 16 / 5) * 2); - m_timer = timer_alloc(FUNC(acan_sound_device::channel_irq), this); + m_timer = timer_alloc(FUNC(umc6619_sound_device::channel_irq), this); // register for savestates save_item(NAME(m_active_channels)); @@ -56,18 +56,23 @@ void acan_sound_device::device_start() save_item(NAME(m_regs)); } -void acan_sound_device::device_reset() +void umc6619_sound_device::device_reset() { m_active_channels = 0; m_dma_channels = 0; std::fill(std::begin(m_regs), std::end(m_regs), 0); + for (auto &channel : m_channels) + { + channel.register9 = 0; + } + m_timer->reset(); m_timer_irq_handler(0); m_dma_irq_handler(0); } -TIMER_CALLBACK_MEMBER(acan_sound_device::channel_irq) +TIMER_CALLBACK_MEMBER(umc6619_sound_device::channel_irq) { if (m_regs[0x14] & 0x40) { @@ -79,7 +84,7 @@ TIMER_CALLBACK_MEMBER(acan_sound_device::channel_irq) } } -void acan_sound_device::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) +void umc6619_sound_device::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) { std::fill_n(&m_mix[0], outputs[0].samples() * 2, 0); @@ -130,7 +135,7 @@ void acan_sound_device::sound_stream_update(sound_stream &stream, std::vector> 4) & 0x0f; const uint8_t lower = offset & 0x0f; + m_stream->update(); m_regs[offset] = data; switch (upper) @@ -285,6 +292,10 @@ void acan_sound_device::write(offs_t offset, uint8_t data) break; } + // case 4: + // Normally 0x03 for keyon channels, 0x01 for streaming DMAs + // (staiwbbl, formduel, sangofgt) + default: LOG("Unknown sound register: %02x = %02x\n", offset, data); break; diff --git a/src/mame/funtech/acan.h b/src/mame/funtech/umc6619_sound.h similarity index 81% rename from src/mame/funtech/acan.h rename to src/mame/funtech/umc6619_sound.h index 8828768219e..d607735c7c9 100644 --- a/src/mame/funtech/acan.h +++ b/src/mame/funtech/umc6619_sound.h @@ -6,15 +6,15 @@ **********************************************************************/ -#ifndef MAME_FUNTECH_ACAN_H -#define MAME_FUNTECH_ACAN_H +#ifndef MAME_FUNTECH_UM6619_SOUND_H +#define MAME_FUNTECH_UM6619_SOUND_H #pragma once -class acan_sound_device : public device_t, public device_sound_interface +class umc6619_sound_device : public device_t, public device_sound_interface { public: - acan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + umc6619_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); auto ram_read() { return m_ram_read.bind(); } auto timer_irq_handler() { return m_timer_irq_handler.bind(); } @@ -65,6 +65,6 @@ private: std::unique_ptr m_mix; }; -DECLARE_DEVICE_TYPE(ACANSND, acan_sound_device) +DECLARE_DEVICE_TYPE(UMC6619_SOUND, umc6619_sound_device) -#endif // MAME_FUNTECH_ACAN_H +#endif // MAME_FUNTECH_UM6619_SOUND_H