diff options
author | Olivier Galibert <galibert@pobox.com> | 2020-03-15 11:04:00 +0100 |
---|---|---|
committer | Olivier Galibert <galibert@pobox.com> | 2020-03-15 11:04:15 +0100 |
commit | f3e48214a9dbab6ccdc7867dcdd897b653aab0ce (patch) | |
tree | c470e240c6a9208309c6343fb8906a9eadba67cd | |
parent | b2e2405c7c6e462f04cccf476e71e0f2757c1c9c (diff) |
ks0164: Add timer at a random frequency (nw)
-rw-r--r-- | src/devices/sound/ks0164.cpp | 21 | ||||
-rw-r--r-- | src/devices/sound/ks0164.h | 3 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/devices/sound/ks0164.cpp b/src/devices/sound/ks0164.cpp index 56e116c5c21..05a26f2852c 100644 --- a/src/devices/sound/ks0164.cpp +++ b/src/devices/sound/ks0164.cpp @@ -52,6 +52,7 @@ void ks0164_device::device_start() m_stream = stream_alloc(0, 2, 44100); m_mem_cache = space().cache<1, 0, ENDIANNESS_BIG>(); + m_timer = timer_alloc(0); } void ks0164_device::device_reset() @@ -65,6 +66,16 @@ void ks0164_device::device_reset() m_voice_select = 0; m_irqen_76 = 0; m_irqen_77 = 0; + m_timer_interrupt = false; + + m_timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); +} + +void ks0164_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_timer_interrupt = true; + if(m_irqen_76 & 0x40) + m_cpu->set_input_line(14, ASSERT_LINE); } u16 ks0164_device::vec_r(offs_t offset, u16 mem_mask) @@ -138,7 +149,15 @@ u8 ks0164_device::irqen_76_r() void ks0164_device::irqen_76_w(u8 data) { m_irqen_76 = data; - logerror("irqen_76 = %02x (%04x)\n", m_irqen_76, m_cpu->pc()); + if(m_irqen_76 & 0x40) + m_cpu->set_input_line(14, m_timer_interrupt ? ASSERT_LINE : CLEAR_LINE); + + else { + m_timer_interrupt = false; + m_cpu->set_input_line(14, CLEAR_LINE); + } + + // logerror("irqen_76 = %02x (%04x)\n", m_irqen_76, m_cpu->pc()); } u8 ks0164_device::irqen_77_r() diff --git a/src/devices/sound/ks0164.h b/src/devices/sound/ks0164.h index a1367df125e..f93bc45e1a6 100644 --- a/src/devices/sound/ks0164.h +++ b/src/devices/sound/ks0164.h @@ -26,12 +26,14 @@ protected: virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; virtual void device_add_mconfig(machine_config &config) override; virtual space_config_vector memory_space_config() const override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: optional_memory_region m_mem_region; required_device<ks0164_cpu_device> m_cpu; address_space_config m_mem_config; sound_stream *m_stream; + emu_timer *m_timer; memory_access_cache<1, 0, ENDIANNESS_BIG> *m_mem_cache; u32 m_bank1_base, m_bank2_base; @@ -42,6 +44,7 @@ private: u8 m_unk60; u8 m_voice_select; u8 m_irqen_76, m_irqen_77; + bool m_timer_interrupt; void cpu_map(address_map &map); |