summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Scott Stone <tafoid@users.noreply.github.com>2013-07-23 02:05:54 +0000
committer Scott Stone <tafoid@users.noreply.github.com>2013-07-23 02:05:54 +0000
commit8e4b11a87eb0fd04945a36955c6fb005eb639125 (patch)
treeb1decc64b0458065b7c7083b3a0aa73d6cd7277a
parent94c417325ee14c898a1b5fc1c2e7838527fa6322 (diff)
Modernized hc55516 sound chip. [Osso]
-rw-r--r--src/emu/sound/hc55516.c422
-rw-r--r--src/emu/sound/hc55516.h54
-rw-r--r--src/mame/audio/exidy.c8
-rw-r--r--src/mame/audio/redalert.c5
-rw-r--r--src/mame/audio/williams.c12
-rw-r--r--src/mame/drivers/jangou.c11
-rw-r--r--src/mame/drivers/s11.c4
-rw-r--r--src/mame/drivers/s11b.c6
-rw-r--r--src/mame/drivers/s6.c4
-rw-r--r--src/mame/drivers/s6a.c4
-rw-r--r--src/mame/drivers/s7.c4
-rw-r--r--src/mame/drivers/s9.c4
-rw-r--r--src/mame/includes/redalert.h13
-rw-r--r--src/mame/machine/williams.c2
-rw-r--r--src/mess/drivers/victor9k.c2
15 files changed, 251 insertions, 304 deletions
diff --git a/src/emu/sound/hc55516.c b/src/emu/sound/hc55516.c
index f5a201e45ce..d45cbb72b0a 100644
--- a/src/emu/sound/hc55516.c
+++ b/src/emu/sound/hc55516.c
@@ -8,7 +8,6 @@
#include "emu.h"
#include "hc55516.h"
-#include "devlegcy.h"
/* 4x oversampling */
@@ -22,320 +21,234 @@
#define SAMPLE_GAIN 10000.0
-struct hc55516_state
-{
- sound_stream *channel;
- int clock; /* 0 = software driven, non-0 = oscillator */
- int active_clock_hi;
- UINT8 shiftreg_mask;
-
- UINT8 last_clock_state;
- UINT8 digit;
- UINT8 new_digit;
- UINT8 shiftreg;
-
- INT16 curr_sample;
- INT16 next_sample;
-
- UINT32 update_count;
- double filter;
- double integrator;
-};
+const device_type HC55516 = &device_creator<hc55516_device>;
-static double charge, decay, leak;
-
+hc55516_device::hc55516_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, HC55516, "HC-55516", tag, owner, clock, "hc55516", __FILE__),
+ device_sound_interface(mconfig, *this)
+{
+}
+hc55516_device::hc55516_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
+ : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ device_sound_interface(mconfig, *this),
+ m_channel(NULL),
+ m_active_clock_hi(0),
+ m_shiftreg_mask(0),
+ m_last_clock_state(0),
+ m_digit(0),
+ m_new_digit(0),
+ m_shiftreg(0),
+ m_curr_sample(0),
+ m_next_sample(0),
+ m_update_count(0),
+ m_filter(0),
+ m_integrator(0),
+ m_charge(0),
+ m_decay(0),
+ m_leak(0)
+{
+}
-static STREAM_UPDATE( hc55516_update );
+//-------------------------------------------------
+// device_config_complete - perform any
+// operations now that the configuration is
+// complete
+//-------------------------------------------------
+void hc55516_device::device_config_complete()
+{
+}
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
-INLINE hc55516_state *get_safe_token(device_t *device)
+void hc55516_device::device_start()
{
- assert(device != NULL);
- assert(device->type() == HC55516 ||
- device->type() == MC3417 ||
- device->type() == MC3418);
- return (hc55516_state *)downcast<hc55516_device *>(device)->token();
+ start_common(0x07, TRUE);
}
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
-static void start_common(device_t *device, UINT8 _shiftreg_mask, int _active_clock_hi)
+void hc55516_device::device_reset()
{
- hc55516_state *chip = get_safe_token(device);
-
- /* compute the fixed charge, decay, and leak time constants */
- charge = pow(exp(-1.0), 1.0 / (FILTER_CHARGE_TC * 16000.0));
- decay = pow(exp(-1.0), 1.0 / (FILTER_DECAY_TC * 16000.0));
- leak = pow(exp(-1.0), 1.0 / (INTEGRATOR_LEAK_TC * 16000.0));
+ m_last_clock_state = 0;
+}
- chip->clock = device->clock();
- chip->shiftreg_mask = _shiftreg_mask;
- chip->active_clock_hi = _active_clock_hi;
- chip->last_clock_state = 0;
+const device_type MC3417 = &device_creator<mc3417_device>;
- /* create the stream */
- chip->channel = device->machine().sound().stream_alloc(*device, 0, 1, SAMPLE_RATE, chip, hc55516_update);
-
- device->save_item(NAME(chip->last_clock_state));
- device->save_item(NAME(chip->digit));
- device->save_item(NAME(chip->new_digit));
- device->save_item(NAME(chip->shiftreg));
- device->save_item(NAME(chip->curr_sample));
- device->save_item(NAME(chip->next_sample));
- device->save_item(NAME(chip->update_count));
- device->save_item(NAME(chip->filter));
- device->save_item(NAME(chip->integrator));
+mc3417_device::mc3417_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : hc55516_device(mconfig, MC3417, "MC3417", tag, owner, clock, "mc3417", __FILE__)
+{
}
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
-static DEVICE_START( hc55516 )
+void mc3417_device::device_start()
{
- start_common(device, 0x07, TRUE);
+ start_common(0x07, FALSE);
}
-static DEVICE_START( mc3417 )
+const device_type MC3418 = &device_creator<mc3418_device>;
+
+mc3418_device::mc3418_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : hc55516_device(mconfig, MC3418, "MC3418", tag, owner, clock, "mc3418", __FILE__)
{
- start_common(device, 0x07, FALSE);
}
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
-static DEVICE_START( mc3418 )
+void mc3418_device::device_start()
{
- start_common(device, 0x0f, FALSE);
+ start_common(0x0f, FALSE);
}
-
-static DEVICE_RESET( hc55516 )
+void hc55516_device::start_common(UINT8 _shiftreg_mask, int _active_clock_hi)
{
- hc55516_state *chip = get_safe_token(device);
- chip->last_clock_state = 0;
-}
+ /* compute the fixed charge, decay, and leak time constants */
+ m_charge = pow(exp(-1.0), 1.0 / (FILTER_CHARGE_TC * 16000.0));
+ m_decay = pow(exp(-1.0), 1.0 / (FILTER_DECAY_TC * 16000.0));
+ m_leak = pow(exp(-1.0), 1.0 / (INTEGRATOR_LEAK_TC * 16000.0));
+ m_shiftreg_mask = _shiftreg_mask;
+ m_active_clock_hi = _active_clock_hi;
+ m_last_clock_state = 0;
+ /* create the stream */
+ m_channel = machine().sound().stream_alloc(*this, 0, 1, SAMPLE_RATE, this);
+
+ save_item(NAME(m_last_clock_state));
+ save_item(NAME(m_digit));
+ save_item(NAME(m_new_digit));
+ save_item(NAME(m_shiftreg));
+ save_item(NAME(m_curr_sample));
+ save_item(NAME(m_next_sample));
+ save_item(NAME(m_update_count));
+ save_item(NAME(m_filter));
+ save_item(NAME(m_integrator));
+}
-INLINE int is_external_osciallator(hc55516_state *chip)
+inline int hc55516_device::is_external_oscillator()
{
- return chip->clock != 0;
+ return clock() != 0;
}
-INLINE int is_active_clock_transition(hc55516_state *chip, int clock_state)
+inline int hc55516_device::is_active_clock_transition(int clock_state)
{
- return (( chip->active_clock_hi && !chip->last_clock_state && clock_state) ||
- (!chip->active_clock_hi && chip->last_clock_state && !clock_state));
+ return (( m_active_clock_hi && !m_last_clock_state && clock_state) ||
+ (!m_active_clock_hi && m_last_clock_state && !clock_state));
}
-INLINE int current_clock_state(hc55516_state *chip)
+inline int hc55516_device::current_clock_state()
{
- return ((UINT64)chip->update_count * chip->clock * 2 / SAMPLE_RATE) & 0x01;
+ return ((UINT64)m_update_count * clock() * 2 / SAMPLE_RATE) & 0x01;
}
-static void process_digit(hc55516_state *chip)
+void hc55516_device::process_digit()
{
- double integrator = chip->integrator, temp;
+ double integrator = m_integrator, temp;
/* shift the bit into the shift register */
- chip->shiftreg = (chip->shiftreg << 1) | chip->digit;
+ m_shiftreg = (m_shiftreg << 1) | m_digit;
/* move the estimator up or down a step based on the bit */
- if (chip->digit)
- integrator += chip->filter;
+ if (m_digit)
+ integrator += m_filter;
else
- integrator -= chip->filter;
+ integrator -= m_filter;
/* simulate leakage */
- integrator *= leak;
+ integrator *= m_leak;
/* if we got all 0's or all 1's in the last n bits, bump the step up */
- if (((chip->shiftreg & chip->shiftreg_mask) == 0) ||
- ((chip->shiftreg & chip->shiftreg_mask) == chip->shiftreg_mask))
+ if (((m_shiftreg & m_shiftreg_mask) == 0) ||
+ ((m_shiftreg & m_shiftreg_mask) == m_shiftreg_mask))
{
- chip->filter = FILTER_MAX - ((FILTER_MAX - chip->filter) * charge);
+ m_filter = FILTER_MAX - ((FILTER_MAX - m_filter) * m_charge);
- if (chip->filter > FILTER_MAX)
- chip->filter = FILTER_MAX;
+ if (m_filter > FILTER_MAX)
+ m_filter = FILTER_MAX;
}
/* simulate decay */
else
{
- chip->filter *= decay;
+ m_filter *= m_decay;
- if (chip->filter < FILTER_MIN)
- chip->filter = FILTER_MIN;
+ if (m_filter < FILTER_MIN)
+ m_filter = FILTER_MIN;
}
/* compute the sample as a 32-bit word */
temp = integrator * SAMPLE_GAIN;
- chip->integrator = integrator;
+ m_integrator = integrator;
/* compress the sample range to fit better in a 16-bit word */
if (temp < 0)
- chip->next_sample = (int)(temp / (-temp * (1.0 / 32768.0) + 1.0));
- else
- chip->next_sample = (int)(temp / (temp * (1.0 / 32768.0) + 1.0));
-}
-
-
-static STREAM_UPDATE( hc55516_update )
-{
- hc55516_state *chip = (hc55516_state *)param;
- stream_sample_t *buffer = outputs[0];
- int i;
- INT32 sample, slope;
-
- /* zero-length? bail */
- if (samples == 0)
- return;
-
- if (!is_external_osciallator(chip))
- {
- /* track how many samples we've updated without a clock */
- chip->update_count += samples;
- if (chip->update_count > SAMPLE_RATE / 32)
- {
- chip->update_count = SAMPLE_RATE;
- chip->next_sample = 0;
- }
- }
-
- /* compute the interpolation slope */
- sample = chip->curr_sample;
- slope = ((INT32)chip->next_sample - sample) / samples;
- chip->curr_sample = chip->next_sample;
-
- if (is_external_osciallator(chip))
- {
- /* external oscillator */
- for (i = 0; i < samples; i++, sample += slope)
- {
- UINT8 clock_state;
-
- *buffer++ = sample;
-
- chip->update_count++;
-
- clock_state = current_clock_state(chip);
-
- /* pull in next digit on the appropriate edge of the clock */
- if (is_active_clock_transition(chip, clock_state))
- {
- chip->digit = chip->new_digit;
-
- process_digit(chip);
- }
-
- chip->last_clock_state = clock_state;
- }
- }
-
- /* software driven clock */
+ m_next_sample = (int)(temp / (-temp * (1.0 / 32768.0) + 1.0));
else
- for (i = 0; i < samples; i++, sample += slope)
- *buffer++ = sample;
+ m_next_sample = (int)(temp / (temp * (1.0 / 32768.0) + 1.0));
}
-
-void hc55516_clock_w(device_t *device, int state)
+void hc55516_device::clock_w(int state)
{
- hc55516_state *chip = get_safe_token(device);
UINT8 clock_state = state ? TRUE : FALSE;
/* only makes sense for setups with a software driven clock */
- assert(!is_external_osciallator(chip));
+ assert(!is_external_oscillator());
/* speech clock changing? */
- if (is_active_clock_transition(chip, clock_state))
+ if (is_active_clock_transition(clock_state))
{
/* update the output buffer before changing the registers */
- chip->channel->update();
+ m_channel->update();
/* clear the update count */
- chip->update_count = 0;
+ m_update_count = 0;
- process_digit(chip);
+ process_digit();
}
/* update the clock */
- chip->last_clock_state = clock_state;
+ m_last_clock_state = clock_state;
}
-void hc55516_digit_w(device_t *device, int digit)
+void hc55516_device::digit_w(int digit)
{
- hc55516_state *chip = get_safe_token(device);
-
- if (is_external_osciallator(chip))
+ if (is_external_oscillator())
{
- chip->channel->update();
- chip->new_digit = digit & 1;
+ m_channel->update();
+ m_new_digit = digit & 1;
}
else
- chip->digit = digit & 1;
+ m_digit = digit & 1;
}
-int hc55516_clock_state_r(device_t *device)
+int hc55516_device::clock_state_r()
{
- hc55516_state *chip = get_safe_token(device);
-
/* only makes sense for setups with an external oscillator */
- assert(is_external_osciallator(chip));
-
- chip->channel->update();
-
- return current_clock_state(chip);
-}
-
-
-const device_type HC55516 = &device_creator<hc55516_device>;
-
-hc55516_device::hc55516_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, HC55516, "HC-55516", tag, owner, clock, "hc55516", __FILE__),
- device_sound_interface(mconfig, *this)
-{
- m_token = global_alloc_clear(hc55516_state);
-}
-hc55516_device::hc55516_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- device_sound_interface(mconfig, *this)
-{
- m_token = global_alloc_clear(hc55516_state);
-}
-
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void hc55516_device::device_config_complete()
-{
-}
+ assert(is_external_oscillator());
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
+ m_channel->update();
-void hc55516_device::device_start()
-{
- DEVICE_START_NAME( hc55516 )(this);
+ return current_clock_state();
}
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-
-void hc55516_device::device_reset()
-{
- DEVICE_RESET_NAME( hc55516 )(this);
-}
//-------------------------------------------------
// sound_stream_update - handle a stream update
@@ -343,60 +256,67 @@ void hc55516_device::device_reset()
void hc55516_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
{
- // should never get here
- fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
-}
+ stream_sample_t *buffer = outputs[0];
+ int i;
+ INT32 sample, slope;
+ /* zero-length? bail */
+ if (samples == 0)
+ return;
-const device_type MC3417 = &device_creator<mc3417_device>;
+ if (!is_external_oscillator())
+ {
+ /* track how many samples we've updated without a clock */
+ m_update_count += samples;
+ if (m_update_count > SAMPLE_RATE / 32)
+ {
+ m_update_count = SAMPLE_RATE;
+ m_next_sample = 0;
+ }
+ }
-mc3417_device::mc3417_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : hc55516_device(mconfig, MC3417, "MC3417", tag, owner, clock, "mc3417", __FILE__)
-{
-}
+ /* compute the interpolation slope */
+ sample = m_curr_sample;
+ slope = ((INT32)m_next_sample - sample) / samples;
+ m_curr_sample = m_next_sample;
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
+ if (is_external_oscillator())
+ {
+ /* external oscillator */
+ for (i = 0; i < samples; i++, sample += slope)
+ {
+ UINT8 clock_state;
-void mc3417_device::device_start()
-{
- DEVICE_START_NAME( mc3417 )(this);
-}
+ *buffer++ = sample;
-//-------------------------------------------------
-// sound_stream_update - handle a stream update
-//-------------------------------------------------
+ m_update_count++;
-void mc3417_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
-{
- // should never get here
- fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
-}
+ clock_state = current_clock_state();
+ /* pull in next digit on the appropriate edge of the clock */
+ if (is_active_clock_transition(clock_state))
+ {
+ m_digit = m_new_digit;
-const device_type MC3418 = &device_creator<mc3418_device>;
+ process_digit();
+ }
-mc3418_device::mc3418_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : hc55516_device(mconfig, MC3418, "MC3418", tag, owner, clock, "mc3418", __FILE__)
-{
-}
+ m_last_clock_state = clock_state;
+ }
+ }
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
+ /* software driven clock */
+ else
+ for (i = 0; i < samples; i++, sample += slope)
+ *buffer++ = sample;
+}
-void mc3418_device::device_start()
+void mc3417_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
{
- DEVICE_START_NAME( mc3418 )(this);
+ hc55516_device::sound_stream_update(stream, inputs, outputs, samples);
}
-//-------------------------------------------------
-// sound_stream_update - handle a stream update
-//-------------------------------------------------
-
void mc3418_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
{
- // should never get here
- fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
+ hc55516_device::sound_stream_update(stream, inputs, outputs, samples);
}
diff --git a/src/emu/sound/hc55516.h b/src/emu/sound/hc55516.h
index e747e34a214..9d3ff155a67 100644
--- a/src/emu/sound/hc55516.h
+++ b/src/emu/sound/hc55516.h
@@ -3,27 +3,23 @@
#ifndef __HC55516_H__
#define __HC55516_H__
-
-
-/* sets the digit (0 or 1) */
-void hc55516_digit_w(device_t *device, int digit);
-
-/* sets the clock state (0 or 1, clocked on the rising edge) */
-void hc55516_clock_w(device_t *device, int state);
-
-/* returns whether the clock is currently LO or HI */
-int hc55516_clock_state_r(device_t *device);
-
class hc55516_device : public device_t,
public device_sound_interface
{
public:
hc55516_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
hc55516_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
- ~hc55516_device() { global_free(m_token); }
+ ~hc55516_device() {}
+
+ /* sets the digit (0 or 1) */
+ void digit_w(int digit);
+
+ /* sets the clock state (0 or 1, clocked on the rising edge) */
+ void clock_w(int state);
- // access to legacy token
- void *token() const { assert(m_token != NULL); return m_token; }
+ /* returns whether the clock is currently LO or HI */
+ int clock_state_r();
+
protected:
// device-level overrides
virtual void device_config_complete();
@@ -32,9 +28,35 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
-private:
+
+ void start_common(UINT8 _shiftreg_mask, int _active_clock_hi);
+
// internal state
- void *m_token;
+ sound_stream *m_channel;
+ int m_active_clock_hi;
+ UINT8 m_shiftreg_mask;
+
+ UINT8 m_last_clock_state;
+ UINT8 m_digit;
+ UINT8 m_new_digit;
+ UINT8 m_shiftreg;
+
+ INT16 m_curr_sample;
+ INT16 m_next_sample;
+
+ UINT32 m_update_count;
+
+ double m_filter;
+ double m_integrator;
+
+ double m_charge;
+ double m_decay;
+ double m_leak;
+
+ inline int is_external_oscillator();
+ inline int is_active_clock_transition(int clock_state);
+ inline int current_clock_state();
+ void process_digit();
};
extern const device_type HC55516;
diff --git a/src/mame/audio/exidy.c b/src/mame/audio/exidy.c
index 556cea34cdb..6ccba15c370 100644
--- a/src/mame/audio/exidy.c
+++ b/src/mame/audio/exidy.c
@@ -103,7 +103,7 @@ struct exidy_sound_state
int m_has_sh8253;
/* 5220/CVSD variables */
- device_t *m_cvsd;
+ hc55516_device *m_cvsd;
tms5220_device *m_tms;
pia6821_device *m_pia1;
@@ -851,7 +851,7 @@ static DEVICE_START( venture_common_sh_start )
state->m_pia1 = device->machine().device<pia6821_device>("pia1");
/* determine which sound hardware is installed */
- state->m_cvsd = device->machine().device("cvsd");
+ state->m_cvsd = device->machine().device<hc55516_device>("cvsd");
/* 8253 */
state->m_freq_to_step = (double)(1 << 24) / (double)SH8253_CLOCK;
@@ -975,7 +975,7 @@ static WRITE8_DEVICE_HANDLER( mtrap_voiceio_w )
exidy_sound_state *state = get_safe_token(device);
if (!(offset & 0x10))
- hc55516_digit_w(state->m_cvsd, data & 1);
+ state->m_cvsd->digit_w(data & 1);
if (!(offset & 0x20))
state->m_riot->portb_in_set(data & 1, 0xff);
@@ -996,7 +996,7 @@ static READ8_DEVICE_HANDLER( mtrap_voiceio_r )
}
if (!(offset & 0x40))
- return hc55516_clock_state_r(state->m_cvsd) << 7;
+ return state->m_cvsd->clock_state_r() << 7;
return 0;
}
diff --git a/src/mame/audio/redalert.c b/src/mame/audio/redalert.c
index 57945dc20a8..48f64da74b5 100644
--- a/src/mame/audio/redalert.c
+++ b/src/mame/audio/redalert.c
@@ -14,7 +14,6 @@
#include "cpu/i8085/i8085.h"
#include "machine/6821pia.h"
#include "sound/ay8910.h"
-#include "sound/hc55516.h"
#include "includes/redalert.h"
#include "drivlgcy.h"
@@ -162,13 +161,13 @@ WRITE8_MEMBER(redalert_state::redalert_voice_command_w)
WRITE_LINE_MEMBER(redalert_state::sod_callback)
{
- hc55516_digit_w(machine().device("cvsd"), state);
+ m_cvsd->digit_w(state);
}
READ_LINE_MEMBER(redalert_state::sid_callback)
{
- return hc55516_clock_state_r(machine().device("cvsd"));
+ return m_cvsd->clock_state_r();
}
diff --git a/src/mame/audio/williams.c b/src/mame/audio/williams.c
index e24e33ffbd8..335cb8d7d9b 100644
--- a/src/mame/audio/williams.c
+++ b/src/mame/audio/williams.c
@@ -168,8 +168,8 @@ WRITE8_MEMBER(williams_cvsd_sound_device::talkback_w)
WRITE8_MEMBER(williams_cvsd_sound_device::cvsd_digit_clock_clear_w)
{
- hc55516_digit_w(m_hc55516, data);
- hc55516_clock_w(m_hc55516, 0);
+ m_hc55516->digit_w(data);
+ m_hc55516->clock_w(0);
}
@@ -179,7 +179,7 @@ WRITE8_MEMBER(williams_cvsd_sound_device::cvsd_digit_clock_clear_w)
WRITE8_MEMBER(williams_cvsd_sound_device::cvsd_clock_set_w)
{
- hc55516_clock_w(m_hc55516, 1);
+ m_hc55516->clock_w(1);
}
@@ -524,8 +524,8 @@ WRITE8_MEMBER(williams_narc_sound_device::slave_sync_w)
WRITE8_MEMBER(williams_narc_sound_device::cvsd_digit_clock_clear_w)
{
- hc55516_digit_w(m_hc55516, data);
- hc55516_clock_w(m_hc55516, 0);
+ m_hc55516->digit_w(data);
+ m_hc55516->clock_w(0);
}
@@ -535,7 +535,7 @@ WRITE8_MEMBER(williams_narc_sound_device::cvsd_digit_clock_clear_w)
WRITE8_MEMBER(williams_narc_sound_device::cvsd_clock_set_w)
{
- hc55516_clock_w(m_hc55516, 1);
+ m_hc55516->clock_w(1);
}
diff --git a/src/mame/drivers/jangou.c b/src/mame/drivers/jangou.c
index a02b43db1d0..50625843538 100644
--- a/src/mame/drivers/jangou.c
+++ b/src/mame/drivers/jangou.c
@@ -43,7 +43,8 @@ public:
m_cpu_0(*this, "cpu0"),
m_cpu_1(*this, "cpu1"),
m_nsc(*this, "nsc"),
- m_msm(*this, "msm") { }
+ m_msm(*this, "msm"),
+ m_cvsd(*this, "cvsd") { }
/* sound-related */
// Jangou CVSD Sound
@@ -62,8 +63,9 @@ public:
/* devices */
required_device<cpu_device> m_cpu_0;
optional_device<cpu_device> m_cpu_1;
- device_t *m_cvsd;
optional_device<cpu_device> m_nsc;
+ optional_device<msm5205_device> m_msm;
+ optional_device<hc55516_device> m_cvsd;
/* video-related */
UINT8 m_pen_data[0x10];
@@ -99,7 +101,6 @@ public:
UINT8 jangou_gfx_nibble( UINT16 niboffset );
void plot_jangou_gfx_pixel( UINT8 pix, int x, int y );
DECLARE_WRITE_LINE_MEMBER(jngolady_vclk_cb);
- optional_device<msm5205_device> m_msm;
};
@@ -338,7 +339,7 @@ WRITE8_MEMBER(jangou_state::cvsd_w)
TIMER_CALLBACK_MEMBER(jangou_state::cvsd_bit_timer_callback)
{
/* Data is shifted out at the MSB */
- hc55516_digit_w(m_cvsd, (m_cvsd_shiftreg >> 7) & 1);
+ m_cvsd->digit_w((m_cvsd_shiftreg >> 7) & 1);
m_cvsd_shiftreg <<= 1;
/* Trigger an IRQ for every 8 shifted bits */
@@ -922,8 +923,6 @@ static SOUND_START( jangou )
MACHINE_START_MEMBER(jangou_state,common)
{
- m_cvsd = machine().device("cvsd");
-
save_item(NAME(m_pen_data));
save_item(NAME(m_blit_data));
save_item(NAME(m_mux_data));
diff --git a/src/mame/drivers/s11.c b/src/mame/drivers/s11.c
index 7340b595997..3c4eb708d6d 100644
--- a/src/mame/drivers/s11.c
+++ b/src/mame/drivers/s11.c
@@ -424,14 +424,14 @@ WRITE_LINE_MEMBER( s11_state::pias_ca2_w )
{
// speech clock
if(m_hc55516)
- hc55516_clock_w(m_hc55516, state);
+ m_hc55516->clock_w(state);
}
WRITE_LINE_MEMBER( s11_state::pias_cb2_w )
{
// speech data
if(m_hc55516)
- hc55516_digit_w(m_hc55516, state);
+ m_hc55516->digit_w(state);
}
READ8_MEMBER( s11_state::dac_r )
diff --git a/src/mame/drivers/s11b.c b/src/mame/drivers/s11b.c
index 0d7346dd343..3de7cbbe961 100644
--- a/src/mame/drivers/s11b.c
+++ b/src/mame/drivers/s11b.c
@@ -152,13 +152,13 @@ MACHINE_RESET_MEMBER( s11b_state, s11b )
WRITE8_MEMBER( s11b_state::bg_speech_clock_w )
{
// pulses clock input?
- hc55516_clock_w(m_bg_hc55516, 1);
- hc55516_clock_w(m_bg_hc55516, 0);
+ m_bg_hc55516->clock_w(1);
+ m_bg_hc55516->clock_w(0);
}
WRITE8_MEMBER( s11b_state::bg_speech_digit_w )
{
- hc55516_digit_w(m_bg_hc55516, data);
+ m_bg_hc55516->digit_w(data);
}
static const pia6821_interface pia21_intf =
diff --git a/src/mame/drivers/s6.c b/src/mame/drivers/s6.c
index 77e4c29d92c..cb71cbc3df8 100644
--- a/src/mame/drivers/s6.c
+++ b/src/mame/drivers/s6.c
@@ -429,13 +429,13 @@ READ_LINE_MEMBER( s6_state::pias_cb1_r )
WRITE_LINE_MEMBER( s6_state::pias_cb2_w )
{
// speech clock
- hc55516_clock_w(m_hc55516, state);
+ m_hc55516->clock_w(state);
}
WRITE_LINE_MEMBER( s6_state::pias_ca2_w )
{
// speech data
- hc55516_digit_w(m_hc55516, state);
+ m_hc55516->digit_w(state);
}
READ8_MEMBER( s6_state::dac_r )
diff --git a/src/mame/drivers/s6a.c b/src/mame/drivers/s6a.c
index f7199727325..350c4cd81c8 100644
--- a/src/mame/drivers/s6a.c
+++ b/src/mame/drivers/s6a.c
@@ -432,13 +432,13 @@ READ_LINE_MEMBER( s6a_state::pias_cb1_r )
WRITE_LINE_MEMBER( s6a_state::pias_cb2_w )
{
// speech clock
- hc55516_clock_w(m_hc55516, state);
+ m_hc55516->clock_w(state);
}
WRITE_LINE_MEMBER( s6a_state::pias_ca2_w )
{
// speech data
- hc55516_digit_w(m_hc55516, state);
+ m_hc55516->digit_w(state);
}
READ8_MEMBER( s6a_state::dac_r )
diff --git a/src/mame/drivers/s7.c b/src/mame/drivers/s7.c
index d83162e0d33..81b1cdac2e5 100644
--- a/src/mame/drivers/s7.c
+++ b/src/mame/drivers/s7.c
@@ -426,13 +426,13 @@ static const pia6821_interface pia30_intf =
WRITE_LINE_MEMBER( s7_state::pias_cb2_w )
{
// speech clock
- hc55516_clock_w(m_hc55516, state);
+ m_hc55516->clock_w(state);
}
WRITE_LINE_MEMBER( s7_state::pias_ca2_w )
{
// speech data
- hc55516_digit_w(m_hc55516, state);
+ m_hc55516->digit_w(state);
}
READ8_MEMBER( s7_state::dac_r )
diff --git a/src/mame/drivers/s9.c b/src/mame/drivers/s9.c
index aba514824a6..84770106541 100644
--- a/src/mame/drivers/s9.c
+++ b/src/mame/drivers/s9.c
@@ -344,13 +344,13 @@ READ_LINE_MEMBER( s9_state::pias_ca1_r )
WRITE_LINE_MEMBER( s9_state::pias_ca2_w )
{
// speech clock
- hc55516_clock_w(m_hc55516, state);
+ m_hc55516->clock_w(state);
}
WRITE_LINE_MEMBER( s9_state::pias_cb2_w )
{
// speech data
- hc55516_digit_w(m_hc55516, state);
+ m_hc55516->digit_w(state);
}
READ8_MEMBER( s9_state::dac_r )
diff --git a/src/mame/includes/redalert.h b/src/mame/includes/redalert.h
index c79e9c4a811..767518edeb8 100644
--- a/src/mame/includes/redalert.h
+++ b/src/mame/includes/redalert.h
@@ -7,6 +7,8 @@
****************************************************************************/
+#include "sound/hc55516.h"
+
class redalert_state : public driver_device
{
public:
@@ -17,14 +19,21 @@ public:
m_video_control(*this, "video_control"),
m_bitmap_color(*this, "bitmap_color"),
m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu") { }
+ m_audiocpu(*this, "audiocpu"),
+ m_cvsd(*this, "cvsd") { }
UINT8 m_ay8910_latch_1;
UINT8 m_ay8910_latch_2;
+
required_shared_ptr<UINT8> m_bitmap_videoram;
required_shared_ptr<UINT8> m_charmap_videoram;
required_shared_ptr<UINT8> m_video_control;
required_shared_ptr<UINT8> m_bitmap_color;
+
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ optional_device<hc55516_device> m_cvsd;
+
UINT8 *m_bitmap_colorram;
UINT8 m_control_xor;
DECLARE_READ8_MEMBER(redalert_interrupt_clear_r);
@@ -52,8 +61,6 @@ public:
DECLARE_WRITE8_MEMBER(demoneye_ay8910_data_w);
void get_pens(pen_t *pens);
void get_panther_pens(pen_t *pens);
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
};
/*----------- defined in audio/redalert.c -----------*/
diff --git a/src/mame/machine/williams.c b/src/mame/machine/williams.c
index c1a5389cbff..ad241d253dc 100644
--- a/src/mame/machine/williams.c
+++ b/src/mame/machine/williams.c
@@ -96,7 +96,7 @@ const pia6821_interface lottofun_pia_0_intf =
const pia6821_interface sinistar_snd_pia_intf =
{
/*inputs : A/B,CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
- /*outputs: A/B,CA/B2 */ DEVCB_DEVICE_MEMBER("wmsdac", dac_device, write_unsigned8), DEVCB_NULL, DEVCB_DEVICE_LINE("cvsd", hc55516_digit_w), DEVCB_DEVICE_LINE("cvsd", hc55516_clock_w),
+ /*outputs: A/B,CA/B2 */ DEVCB_DEVICE_MEMBER("wmsdac", dac_device, write_unsigned8), DEVCB_NULL, DEVCB_DEVICE_LINE_MEMBER("cvsd", hc55516_device, digit_w), DEVCB_DEVICE_LINE_MEMBER("cvsd", hc55516_device, clock_w),
/*irqs : A/B */ DEVCB_DRIVER_LINE_MEMBER(williams_state,williams_snd_irq), DEVCB_DRIVER_LINE_MEMBER(williams_state,williams_snd_irq)
};
diff --git a/src/mess/drivers/victor9k.c b/src/mess/drivers/victor9k.c
index 696fb137aa6..43b728e3c12 100644
--- a/src/mess/drivers/victor9k.c
+++ b/src/mess/drivers/victor9k.c
@@ -417,7 +417,7 @@ static MC6852_INTERFACE( ssda_intf )
0,
0,
DEVCB_NULL,
- DEVCB_DEVICE_LINE(HC55516_TAG, hc55516_digit_w),
+ DEVCB_DEVICE_LINE_MEMBER(HC55516_TAG, hc55516_device, digit_w),
DEVCB_DRIVER_LINE_MEMBER(victor9k_state, ssda_irq_w),
DEVCB_NULL,
DEVCB_NULL,