From 06e1dd7ab2d220b8e0ffdbefb1fac2ec2db68a00 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 21 Aug 2017 13:50:55 -0400 Subject: [PATCH] dec8.cpp: Sound IRQ timing from schematics; eliminate timer_set (nw) --- src/mame/drivers/dec8.cpp | 13 +++++++++++-- src/mame/includes/dec8.h | 6 +++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/dec8.cpp b/src/mame/drivers/dec8.cpp index 8005b3f888f..6305631504b 100644 --- a/src/mame/drivers/dec8.cpp +++ b/src/mame/drivers/dec8.cpp @@ -145,6 +145,11 @@ void dec8_state::device_timer(emu_timer &timer, device_timer_id id, int param, v // clear the IRQ request. The MCU does not clear it itself. m_mcu->set_input_line(MCS51_INT1_LINE, CLEAR_LINE); break; + case TIMER_DEC8_M6502: + // Gondomania schematics show a LS194 for the sound IRQ, sharing the 6502 clock + // S1=H, S0=L, LSI=H, and QA is the only output connected (to NMI) + m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + break; default: assert_always(false, "Unknown id in dec8_state::device_timer"); } @@ -157,7 +162,7 @@ WRITE8_MEMBER(dec8_state::dec8_i8751_w) case 0: /* High byte - SECIRQ is trigged on activating this latch */ m_i8751_value = (m_i8751_value & 0xff) | (data << 8); m_mcu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE); - timer_set(m_mcu->clocks_to_attotime(64), TIMER_DEC8_I8751); // 64 clocks not confirmed + m_i8751_timer->adjust(m_mcu->clocks_to_attotime(64)); // 64 clocks not confirmed break; case 1: /* Low byte */ m_i8751_value = (m_i8751_value & 0xff00) | data; @@ -378,7 +383,8 @@ WRITE8_MEMBER(dec8_state::csilver_control_w) WRITE8_MEMBER(dec8_state::dec8_sound_w) { m_soundlatch->write(space, 0, data); - m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + m_m6502_timer->adjust(m_audiocpu->cycles_to_attotime(3)); } WRITE_LINE_MEMBER(dec8_state::csilver_adpcm_int) @@ -1896,6 +1902,9 @@ INTERRUPT_GEN_MEMBER(dec8_state::oscar_interrupt) void dec8_state::machine_start() { + m_i8751_timer = timer_alloc(TIMER_DEC8_I8751); + m_m6502_timer = timer_alloc(TIMER_DEC8_M6502); + save_item(NAME(m_latch)); save_item(NAME(m_nmi_enable)); save_item(NAME(m_i8751_port0)); diff --git a/src/mame/includes/dec8.h b/src/mame/includes/dec8.h index 6a432912692..23bde469f27 100644 --- a/src/mame/includes/dec8.h +++ b/src/mame/includes/dec8.h @@ -13,7 +13,8 @@ class dec8_state : public driver_device public: enum { - TIMER_DEC8_I8751 + TIMER_DEC8_I8751, + TIMER_DEC8_M6502 }; dec8_state(const machine_config &mconfig, device_type type, const char *tag) @@ -87,6 +88,9 @@ public: int m_msm5205next; int m_toggle; + emu_timer *m_i8751_timer; + emu_timer *m_m6502_timer; + DECLARE_WRITE8_MEMBER(dec8_mxc06_karn_buffer_spriteram_w); DECLARE_READ8_MEMBER(i8751_h_r); DECLARE_READ8_MEMBER(i8751_l_r);