diff options
Diffstat (limited to 'src/devices/sound/k053260.cpp')
| -rw-r--r-- | src/devices/sound/k053260.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp index 4e7e1d54123..463cf84ae5d 100644 --- a/src/devices/sound/k053260.cpp +++ b/src/devices/sound/k053260.cpp @@ -95,11 +95,13 @@ k053260_device::k053260_device(const machine_config &mconfig, const char *tag, d , device_rom_interface(mconfig, *this) , m_sh1_cb(*this) , m_sh2_cb(*this) + , m_tim2_cb(*this) , m_stream(nullptr) , m_timer(nullptr) , m_keyon(0) , m_mode(0) , m_timer_state(0) + , m_tim2(0) , m_voice{ { *this }, { *this }, { *this }, { *this } } { std::fill(std::begin(m_portdata), std::end(m_portdata), 0); @@ -119,6 +121,7 @@ void k053260_device::device_start() save_item(NAME(m_keyon)); save_item(NAME(m_mode)); save_item(NAME(m_timer_state)); + save_item(NAME(m_tim2)); for (int i = 0; i < 4; i++) m_voice[i].voice_start(i); @@ -169,13 +172,33 @@ TIMER_CALLBACK_MEMBER(k053260_device::update_state_outputs) switch (m_timer_state) { case 0: m_sh1_cb(ASSERT_LINE); break; - case 1: m_sh1_cb(CLEAR_LINE); break; + case 1: m_sh1_cb(CLEAR_LINE); tim2_count(); break; case 2: m_sh2_cb(ASSERT_LINE); break; case 3: m_sh2_cb(CLEAR_LINE); break; } m_timer_state = (m_timer_state+1) & 3; } +// TIM2 is implemented on the original chip as two counters in series, where the +// first one may be bypassed with a test bit, which is not used by glfgreat at +// least. These counters together produce a count that is 112 times slower than +// the SH1 pin, taking it down from 56kHz to 500Hz. The period of 500Hz is 2ms, +// hence the pin name TIM2 and also the signal name 2MS seen in glfgreat schematics. +void k053260_device::tim2_count() +{ + bool over = m_tim2 >= 111; + if (over) + { + m_tim2 = 0; + m_tim2_cb(ASSERT_LINE); + } + else + { + m_tim2++; + m_tim2_cb(CLEAR_LINE); + } +} + u8 k053260_device::main_read(offs_t offset) { // sub-to-main ports |
