diff options
Diffstat (limited to 'src/mame/audio/segasnd.cpp')
-rw-r--r-- | src/mame/audio/segasnd.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/mame/audio/segasnd.cpp b/src/mame/audio/segasnd.cpp index fd29e227f9d..f284fa50502 100644 --- a/src/mame/audio/segasnd.cpp +++ b/src/mame/audio/segasnd.cpp @@ -70,14 +70,17 @@ inline double usb_sound_device::g80_filter_state::step_cr(double input) DEFINE_DEVICE_TYPE(SEGASPEECH, speech_sound_device, "sega_speech_sound", "Sega Speech Sound Board") +#define SEGASPEECH_REGION "speech" + speech_sound_device::speech_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, SEGASPEECH, tag, owner, clock), device_sound_interface(mconfig, *this), + m_int_cb(*this), + m_speech(*this, SEGASPEECH_REGION), m_drq(0), m_latch(0), m_t0(0), - m_p2(0), - m_speech(nullptr) + m_p2(0) { } @@ -87,7 +90,7 @@ speech_sound_device::speech_sound_device(const machine_config &mconfig, const ch void speech_sound_device::device_start() { - m_speech = machine().root_device().memregion("speech")->base(); + m_int_cb.resolve(); save_item(NAME(m_latch)); save_item(NAME(m_t0)); @@ -121,7 +124,7 @@ READ8_MEMBER( speech_sound_device::p1_r ) READ8_MEMBER( speech_sound_device::rom_r ) { - return m_speech[0x100 * (m_p2 & 0x3f) + offset]; + return m_speech->base()[0x100 * (m_p2 & 0x3f) + offset]; } WRITE8_MEMBER( speech_sound_device::p1_w ) @@ -165,7 +168,7 @@ TIMER_CALLBACK_MEMBER( speech_sound_device::delayed_speech_w ) m_latch = data; /* the high bit goes directly to the INT line */ - machine().device("audiocpu")->execute().set_input_line(0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE); + m_int_cb((data & 0x80) ? CLEAR_LINE : ASSERT_LINE); /* a clock on the high bit clocks a 1 into T0 */ if (!(old & 0x80) && (data & 0x80)) @@ -193,6 +196,16 @@ void speech_sound_device::sound_stream_update(sound_stream &stream, stream_sampl { } +/************************************* + * + * Speech board functions + * + *************************************/ + +WRITE_LINE_MEMBER(segag80snd_common::segaspeech_int_w) +{ + m_audiocpu->set_input_line(0, state); +} /************************************* * @@ -233,6 +246,7 @@ MACHINE_CONFIG_START(segag80snd_common::sega_speech_board) /* sound hardware */ MCFG_DEVICE_ADD("segaspeech", SEGASPEECH, 0) + MCFG_SEGASPEECH_INT_CALLBACK(WRITELINE(*this, segag80snd_common, segaspeech_int_w)) MCFG_DEVICE_ADD("speech", SP0250, SPEECH_MASTER_CLOCK) MCFG_SP0250_DRQ_CALLBACK(WRITELINE("segaspeech", speech_sound_device, drq_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0) @@ -250,6 +264,7 @@ usb_sound_device::usb_sound_device(const machine_config &mconfig, device_type ty : device_t(mconfig, type, tag, owner, clock), device_sound_interface(mconfig, *this), m_ourcpu(*this, "ourcpu"), + m_maincpu(*this, finder_base::DUMMY_TAG), m_stream(nullptr), m_in_latch(0), m_out_latch(0), @@ -276,13 +291,6 @@ usb_sound_device::usb_sound_device(const machine_config &mconfig, const char *ta void usb_sound_device::device_start() { - g80_filter_state temp; - int tchan, tgroup; - - /* find the CPU we are associated with */ - m_maincpu = machine().device("maincpu"); - assert(m_maincpu != nullptr); - /* create a sound stream */ m_stream = machine().sound().stream_alloc(*this, 0, 1, SAMPLE_RATE); @@ -297,6 +305,7 @@ void usb_sound_device::device_start() g.gate2.configure(2 * 100e3, 0.01e-6); } + g80_filter_state temp; temp.configure(100e3, 0.01e-6); m_gate_rc1_exp[0] = temp.exponent; temp.configure(1e3, 0.01e-6); @@ -321,10 +330,10 @@ void usb_sound_device::device_start() save_item(NAME(m_work_ram_bank)); save_item(NAME(m_t1_clock)); - for (tgroup = 0; tgroup < 3; tgroup++) + for (int tgroup = 0; tgroup < 3; tgroup++) { timer8253 *group = &m_timer_group[tgroup]; - for (tchan = 0; tchan < 3; tchan++) + for (int tchan = 0; tchan < 3; tchan++) { timer8253::channel *channel = &group->chan[tchan]; save_item(NAME(channel->holding), tgroup * 3 + tchan); @@ -395,7 +404,7 @@ READ8_MEMBER( usb_sound_device::status_r ) { LOG("%s:usb_data_r = %02X\n", machine().describe_context(), (m_out_latch & 0x81) | (m_in_latch & 0x7e)); - m_maincpu->execute().adjust_icount(-200); + m_maincpu->adjust_icount(-200); /* only bits 0 and 7 are controlled by the I8035; the remaining */ /* bits 1-6 reflect the current input latch values */ |