2022-03-14 06:22:12 -04:00
|
|
|
/*
|
|
|
|
|
License: BSD-3-Clause
|
2022-08-03 08:56:22 -04:00
|
|
|
see https://gitlab.com/cam900/vgsound_emu/-/blob/V1/LICENSE for more details
|
2022-03-14 06:22:12 -04:00
|
|
|
|
|
|
|
|
Copyright holder(s): cam900
|
2022-05-31 01:06:16 -04:00
|
|
|
Modifiers and Contributors for Furnace: cam900
|
2022-03-14 06:22:12 -04:00
|
|
|
Konami K005289 emulation core
|
|
|
|
|
|
|
|
|
|
This chip is used at infamous Konami Bubble System, for part of Wavetable sound generator.
|
|
|
|
|
But seriously, It is just to 2 internal 12 bit timer and address generators, rather than sound generator.
|
|
|
|
|
|
|
|
|
|
Everything except for internal counter and address are done by external logic, the chip is only has external address, frequency registers and its update pins.
|
|
|
|
|
|
|
|
|
|
Frequency calculation: Input clock / (4096 - Pitch input)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "k005289.hpp"
|
|
|
|
|
|
|
|
|
|
void k005289_core::tick()
|
|
|
|
|
{
|
|
|
|
|
for (auto & elem : m_voice)
|
|
|
|
|
elem.tick();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void k005289_core::reset()
|
|
|
|
|
{
|
|
|
|
|
for (auto & elem : m_voice)
|
|
|
|
|
elem.reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void k005289_core::voice_t::tick()
|
|
|
|
|
{
|
|
|
|
|
if (bitfield(++counter, 0, 12) == 0)
|
|
|
|
|
{
|
|
|
|
|
addr = bitfield(addr + 1, 0, 5);
|
|
|
|
|
counter = freq;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void k005289_core::voice_t::reset()
|
|
|
|
|
{
|
|
|
|
|
addr = 0;
|
|
|
|
|
pitch = 0;
|
|
|
|
|
freq = 0;
|
|
|
|
|
counter = 0;
|
|
|
|
|
}
|