diff options
Diffstat (limited to 'src/mame/audio/jedi.cpp')
-rw-r--r-- | src/mame/audio/jedi.cpp | 99 |
1 files changed, 15 insertions, 84 deletions
diff --git a/src/mame/audio/jedi.cpp b/src/mame/audio/jedi.cpp index f13e0e5ffc3..31d2d6dc4db 100644 --- a/src/mame/audio/jedi.cpp +++ b/src/mame/audio/jedi.cpp @@ -18,40 +18,6 @@ /************************************* * - * Start - * - *************************************/ - -void jedi_state::sound_start() -{ - /* set up save state */ - save_item(NAME(m_audio_latch)); - save_item(NAME(m_audio_ack_latch)); - save_item(NAME(m_speech_strobe_state)); -} - - - -/************************************* - * - * Reset - * - *************************************/ - -void jedi_state::sound_reset() -{ - /* init globals */ - m_audio_latch = 0; - m_audio_ack_latch = 0; - *m_audio_comm_stat = 0; - *m_speech_data = 0; - m_speech_strobe_state = 0; -} - - - -/************************************* - * * Interrupt handling * *************************************/ @@ -72,53 +38,20 @@ WRITE8_MEMBER(jedi_state::irq_ack_w) WRITE_LINE_MEMBER(jedi_state::audio_reset_w) { m_audiocpu->set_input_line(INPUT_LINE_RESET, state ? CLEAR_LINE : ASSERT_LINE); + if (!state) + m_tms->set_output_gain(ALL_OUTPUTS, 0.0); } -TIMER_CALLBACK_MEMBER(jedi_state::delayed_audio_latch_w) -{ - m_audio_latch = param; - *m_audio_comm_stat |= 0x80; -} - - -WRITE8_MEMBER(jedi_state::jedi_audio_latch_w) -{ - machine().scheduler().synchronize(timer_expired_delegate(FUNC(jedi_state::delayed_audio_latch_w), this), data); -} - - -READ8_MEMBER(jedi_state::audio_latch_r) +READ8_MEMBER(jedi_state::audio_comm_stat_r) { - *m_audio_comm_stat &= ~0x80; - return m_audio_latch; + return (m_soundlatch->pending_r() << 7) | (m_sacklatch->pending_r() << 6); } CUSTOM_INPUT_MEMBER(jedi_state::jedi_audio_comm_stat_r) { - return *m_audio_comm_stat >> 6; -} - - - -/************************************* - * - * Sound CPU -> Main CPU communications - * - *************************************/ - -READ8_MEMBER(jedi_state::jedi_audio_ack_latch_r) -{ - *m_audio_comm_stat &= ~0x40; - return m_audio_ack_latch; -} - - -WRITE8_MEMBER(jedi_state::audio_ack_latch_w) -{ - m_audio_ack_latch = data; - *m_audio_comm_stat |= 0x40; + return (m_soundlatch->pending_r() << 1) | m_sacklatch->pending_r(); } @@ -131,13 +64,7 @@ WRITE8_MEMBER(jedi_state::audio_ack_latch_w) WRITE8_MEMBER(jedi_state::speech_strobe_w) { - int new_speech_strobe_state = (~offset >> 8) & 1; - - if ((new_speech_strobe_state != m_speech_strobe_state) && new_speech_strobe_state) - { - m_tms->data_w(space, 0, *m_speech_data); - } - m_speech_strobe_state = new_speech_strobe_state; + m_tms->wsq_w(BIT(offset, 8)); } @@ -149,7 +76,8 @@ READ8_MEMBER(jedi_state::speech_ready_r) WRITE8_MEMBER(jedi_state::speech_reset_w) { - /* not supported by the TMS5220 emulator */ + // Flip-flop at 8C controls the power supply to the TMS5220 (through transistors Q6 and Q7) + m_tms->set_output_gain(ALL_OUTPUTS, BIT(data, 0) ? 1.0 : 0.0); } @@ -168,14 +96,14 @@ void jedi_state::audio_map(address_map &map) map(0x0820, 0x082f).mirror(0x07c0).rw("pokey3", FUNC(pokey_device::read), FUNC(pokey_device::write)); map(0x0830, 0x083f).mirror(0x07c0).rw("pokey4", FUNC(pokey_device::read), FUNC(pokey_device::write)); map(0x1000, 0x1000).mirror(0x00ff).nopr().w(FUNC(jedi_state::irq_ack_w)); - map(0x1100, 0x1100).mirror(0x00ff).nopr().writeonly().share("speech_data"); + map(0x1100, 0x1100).mirror(0x00ff).nopr().w("tms", FUNC(tms5220_device::data_w)); map(0x1200, 0x13ff).nopr().w(FUNC(jedi_state::speech_strobe_w)); - map(0x1400, 0x1400).mirror(0x00ff).nopr().w(FUNC(jedi_state::audio_ack_latch_w)); + map(0x1400, 0x1400).mirror(0x00ff).nopr().w("sacklatch", FUNC(generic_latch_8_device::write)); map(0x1500, 0x1500).mirror(0x00ff).nopr().w(FUNC(jedi_state::speech_reset_w)); map(0x1600, 0x17ff).noprw(); - map(0x1800, 0x1800).mirror(0x03ff).r(FUNC(jedi_state::audio_latch_r)).nopw(); + map(0x1800, 0x1800).mirror(0x03ff).r("soundlatch", FUNC(generic_latch_8_device::read)).nopw(); map(0x1c00, 0x1c00).mirror(0x03fe).r(FUNC(jedi_state::speech_ready_r)).nopw(); - map(0x1c01, 0x1c01).mirror(0x03fe).readonly().nopw().share("audio_comm_stat"); + map(0x1c01, 0x1c01).mirror(0x03fe).r(FUNC(jedi_state::audio_comm_stat_r)).nopw(); map(0x2000, 0x7fff).noprw(); map(0x8000, 0xffff).rom(); } @@ -217,4 +145,7 @@ MACHINE_CONFIG_START(jedi_state::jedi_audio) MCFG_DEVICE_ADD("tms", TMS5220, JEDI_TMS5220_CLOCK) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") // 5E (LS374) + 3E (LS279) pins 13-15 + MCFG_GENERIC_LATCH_8_ADD("sacklatch") // 4E (LS374) + 3E (LS279) pins 1-4 MACHINE_CONFIG_END |