summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/audio/dsbz80.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/audio/dsbz80.c')
-rw-r--r--src/mame/audio/dsbz80.c77
1 files changed, 38 insertions, 39 deletions
diff --git a/src/mame/audio/dsbz80.c b/src/mame/audio/dsbz80.c
index ec0ecf72cd9..58130ca9c2d 100644
--- a/src/mame/audio/dsbz80.c
+++ b/src/mame/audio/dsbz80.c
@@ -10,29 +10,29 @@
#include "emu.h"
#include "audio/dsbz80.h"
-#define Z80_TAG "mpegcpu"
-#define YMZ770_TAG "ymz770"
+#define Z80_TAG "mpegcpu"
+#define YMZ770_TAG "ymz770"
static ADDRESS_MAP_START( dsbz80_map, AS_PROGRAM, 8, dsbz80_device )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION(":mpegcpu", 0)
- AM_RANGE(0x8000, 0xffff) AM_RAM
+ AM_RANGE(0x8000, 0xffff) AM_RAM
ADDRESS_MAP_END
static ADDRESS_MAP_START( dsbz80io_map, AS_IO, 8, dsbz80_device )
- AM_RANGE(0xe0, 0xe0) AM_MIRROR(0xff00) AM_WRITE(mpeg_trigger_w)
- AM_RANGE(0xe2, 0xe4) AM_MIRROR(0xff00) AM_READWRITE(mpeg_pos_r, mpeg_start_w)
- AM_RANGE(0xe5, 0xe7) AM_MIRROR(0xff00) AM_WRITE(mpeg_end_w)
- AM_RANGE(0xe8, 0xe8) AM_MIRROR(0xff00) AM_WRITE(mpeg_volume_w)
- AM_RANGE(0xe9, 0xe9) AM_MIRROR(0xff00) AM_WRITE(mpeg_stereo_w)
- AM_RANGE(0xf0, 0xf0) AM_MIRROR(0xff00) AM_READ(latch_r)
- AM_RANGE(0xf1, 0xf1) AM_MIRROR(0xff00) AM_READ(status_r)
+ AM_RANGE(0xe0, 0xe0) AM_MIRROR(0xff00) AM_WRITE(mpeg_trigger_w)
+ AM_RANGE(0xe2, 0xe4) AM_MIRROR(0xff00) AM_READWRITE(mpeg_pos_r, mpeg_start_w)
+ AM_RANGE(0xe5, 0xe7) AM_MIRROR(0xff00) AM_WRITE(mpeg_end_w)
+ AM_RANGE(0xe8, 0xe8) AM_MIRROR(0xff00) AM_WRITE(mpeg_volume_w)
+ AM_RANGE(0xe9, 0xe9) AM_MIRROR(0xff00) AM_WRITE(mpeg_stereo_w)
+ AM_RANGE(0xf0, 0xf0) AM_MIRROR(0xff00) AM_READ(latch_r)
+ AM_RANGE(0xf1, 0xf1) AM_MIRROR(0xff00) AM_READ(status_r)
ADDRESS_MAP_END
MACHINE_CONFIG_FRAGMENT( dsbz80 )
- MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) /* unknown clock, but probably pretty slow considering the z80 does like nothing */
+ MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) /* unknown clock, but probably pretty slow considering the z80 does like nothing */
MCFG_CPU_PROGRAM_MAP(dsbz80_map)
- MCFG_CPU_IO_MAP(dsbz80io_map)
+ MCFG_CPU_IO_MAP(dsbz80io_map)
MACHINE_CONFIG_END
//**************************************************************************
@@ -61,7 +61,7 @@ machine_config_constructor dsbz80_device::device_mconfig_additions() const
//-------------------------------------------------
dsbz80_device::dsbz80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
- device_t(mconfig, DSBZ80, "Sega Z80-based Digital Sound Board", tag, owner, clock),
+ device_t(mconfig, DSBZ80, "Sega Z80-based Digital Sound Board", tag, owner, clock),
device_sound_interface(mconfig, *this),
m_ourcpu(*this, Z80_TAG)
{
@@ -86,7 +86,7 @@ void dsbz80_device::device_reset()
{
m_dsb_latch = 0;
status = 1;
- start = end = 0;
+ start = end = 0;
audio_pos = audio_avail = 0;
memset(audio_buf, 0, sizeof(audio_buf));
mp_state = 0;
@@ -95,33 +95,33 @@ void dsbz80_device::device_reset()
WRITE8_MEMBER(dsbz80_device::latch_w)
{
m_ourcpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
- m_dsb_latch = data;
- status |= 2;
-// printf("%02x to DSB latch\n", data);
+ m_dsb_latch = data;
+ status |= 2;
+// printf("%02x to DSB latch\n", data);
}
READ8_MEMBER(dsbz80_device::latch_r)
{
m_ourcpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
-// printf("DSB Z80 read %02x\n", m_dsb_latch);
+// printf("DSB Z80 read %02x\n", m_dsb_latch);
status &= ~2;
- return m_dsb_latch;
+ return m_dsb_latch;
}
WRITE8_MEMBER(dsbz80_device::mpeg_trigger_w)
{
mp_state = data;
- if (data == 0) // stop
+ if (data == 0) // stop
{
mp_state = 0;
audio_pos = audio_avail = 0;
}
- else if (data == 1) // play without loop
+ else if (data == 1) // play without loop
{
mp_pos = mp_start*8;
}
- else if (data == 2) // play with loop
+ else if (data == 2) // play with loop
{
mp_pos = mp_start*8;
}
@@ -148,7 +148,7 @@ READ8_MEMBER(dsbz80_device::mpeg_pos_r)
get latched. When the current stream ends, the MPEG hardware starts playing
immediately from the latched start and end position. In this way, the Z80
enforces looping where appropriate and multi-part songs in other cases
- (song #16 is a good example)
+ (song #16 is a good example)
*/
WRITE8_MEMBER(dsbz80_device::mpeg_start_w)
@@ -177,11 +177,11 @@ WRITE8_MEMBER(dsbz80_device::mpeg_start_w)
// SWA: if loop end is zero, it means "keep previous end marker"
if (lp_end == 0)
{
-// MPEG_Set_Loop(ROM + lp_start, mp_end-lp_start);
+// MPEG_Set_Loop(ROM + lp_start, mp_end-lp_start);
}
else
{
-// MPEG_Set_Loop(ROM + lp_start, lp_end-lp_start);
+// MPEG_Set_Loop(ROM + lp_start, lp_end-lp_start);
}
}
break;
@@ -211,7 +211,7 @@ WRITE8_MEMBER(dsbz80_device::mpeg_end_w)
else
{
lp_end = end;
-// MPEG_Set_Loop(ROM + lp_start, lp_end-lp_start);
+// MPEG_Set_Loop(ROM + lp_start, lp_end-lp_start);
}
break;
}
@@ -224,7 +224,7 @@ WRITE8_MEMBER(dsbz80_device::mpeg_volume_w)
WRITE8_MEMBER(dsbz80_device::mpeg_stereo_w)
{
- mp_pan = data & 3; // 0 = stereo, 1 = left on both channels, 2 = right on both channels
+ mp_pan = data & 3; // 0 = stereo, 1 = left on both channels, 2 = right on both channels
}
READ8_MEMBER(dsbz80_device::status_r)
@@ -247,17 +247,17 @@ void dsbz80_device::sound_stream_update(sound_stream &stream, stream_sample_t **
{
switch (mp_pan)
{
- case 0: // stereo
+ case 0: // stereo
*out_l++ = audio_buf[audio_pos*2];
*out_r++ = audio_buf[audio_pos*2+1];
break;
- case 1: // left only
+ case 1: // left only
*out_l++ = audio_buf[audio_pos*2];
*out_r++ = audio_buf[audio_pos*2];
break;
- case 2: // right only
+ case 2: // right only
*out_l++ = audio_buf[audio_pos*2+1];
*out_r++ = audio_buf[audio_pos*2+1];
break;
@@ -280,21 +280,21 @@ void dsbz80_device::sound_stream_update(sound_stream &stream, stream_sample_t **
}
break;
- }
- else
+ }
+ else
{
int sample_rate, channel_count;
bool ok = decoder->decode_buffer(mp_pos, mp_end*8, audio_buf, audio_avail, sample_rate, channel_count);
- if (ok)
+ if (ok)
{
audio_pos = 0;
- }
- else
+ }
+ else
{
- if(mp_state == 2)
+ if(mp_state == 2)
{
- if (mp_pos == lp_start*8)
+ if (mp_pos == lp_start*8)
{
// We're looping on un-decodable crap, abort abort abort
mp_state = 0;
@@ -305,7 +305,7 @@ void dsbz80_device::sound_stream_update(sound_stream &stream, stream_sample_t **
{
mp_end = lp_end;
}
- }
+ }
else
{
mp_state = 0;
@@ -314,4 +314,3 @@ void dsbz80_device::sound_stream_update(sound_stream &stream, stream_sample_t **
}
}
}
-