summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emu/sound/l7a1045_l6028_dsp_a.c217
-rw-r--r--src/emu/sound/l7a1045_l6028_dsp_a.h67
-rw-r--r--src/mame/audio/hng64.c81
-rw-r--r--src/mame/includes/hng64.h15
4 files changed, 291 insertions, 89 deletions
diff --git a/src/emu/sound/l7a1045_l6028_dsp_a.c b/src/emu/sound/l7a1045_l6028_dsp_a.c
new file mode 100644
index 00000000000..1178132cb98
--- /dev/null
+++ b/src/emu/sound/l7a1045_l6028_dsp_a.c
@@ -0,0 +1,217 @@
+/***************************************************************************
+
+ L7A1045 L6028 DSP-A
+ (QFP120 package)
+
+ this is the audio chip used on the following
+ SNK Hyper NeoGeo 64 (arcade platform)
+ AKAI MPC3000 (synth)
+
+ both are driven by a V53, the MPC3000 isn't dumped.
+
+ appears to write a register number and channel/voice using
+ l7a1045_sound_select_w (offset 0)
+ format:
+
+ ---- rrrr ---c cccc
+ r = register, c = channel
+
+ the channel select appears to address 32 different voices (5-bits)
+ the register select appears to use 4-bits with 0x0 to 0xa being valid
+
+ the registers data is written / read using offsets 1,2,3 after
+ setting the register + channel, this gives 3 16-bit values for
+ each register.
+
+ register format:
+
+ offset 3 offset 2 offset 1
+ fedcba9876543210 | fedcba9876543210 | fedcba9876543210
+
+ 0 ---------------- ---------------- ----------------
+
+ 1 ---------------- ---------------- ----------------
+
+ 2 ---------------- ---------------- ----------------
+
+ 3 ---------------- ---------------- ----------------
+
+ 4 ---------------- ---------------- ----------------
+
+ 5 ---------------- ---------------- ----------------
+
+ 6 ---------------- ---------------- ----------------
+
+ 7 ---------------- ---------------- ----------------
+
+ 8 ---------------- ---------------- ---------------- (read only?)
+
+ 9 ---------------- ---------------- ---------------- (read only?)
+
+ a ---------------- ---------------- ----------------
+
+ Registers are not yet understood.
+
+ Some of the other ports on the HNG64 sound CPU may also be tied
+ to this chip, this isn't yet clear.
+
+ Sample data format TBA
+
+***************************************************************************/
+
+#include "emu.h"
+#include "l7a1045_l6028_dsp_a.h"
+
+
+// device type definition
+const device_type L7A1045 = &device_creator<l7a1045_sound_device>;
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// l7a1045_sound_device - constructor
+//-------------------------------------------------
+
+l7a1045_sound_device::l7a1045_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, L7A1045, "L7A1045 L6028 DSP-A", tag, owner, clock, "l7a1045_custom", __FILE__),
+ device_sound_interface(mconfig, *this),
+ m_stream(NULL)
+ /*m_key(0),
+ m_base(NULL)*/
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void l7a1045_sound_device::device_start()
+{
+ /* Allocate the stream */
+ m_stream = stream_alloc(0, 2, clock() / 384);
+}
+
+
+//-------------------------------------------------
+// sound_stream_update - handle a stream update
+//-------------------------------------------------
+
+void l7a1045_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+{
+ /* Clear the buffers */
+ memset(outputs[0], 0, samples*sizeof(*outputs[0]));
+ memset(outputs[1], 0, samples*sizeof(*outputs[1]));
+}
+
+
+WRITE16_MEMBER( l7a1045_sound_device::l7a1045_sound_w )
+{
+ m_stream->update();
+
+ switch (offset)
+ {
+ case 0x00:l7a1045_sound_select_w(space, offset, data, mem_mask); break;
+ case 0x01:l7a1045_sound_data_02_w(space, offset, data, mem_mask); break;
+ case 0x02:l7a1045_sound_data_04_w(space, offset, data, mem_mask); break;
+ case 0x03:l7a1045_sound_data_06_w(space, offset, data, mem_mask); break;
+ }
+
+}
+
+
+READ16_MEMBER( l7a1045_sound_device::l7a1045_sound_r )
+{
+ m_stream->update();
+
+ switch (offset)
+ {
+ case 0x00:
+ case 0x01:
+ printf("%08x: l7a1045_sound_r unknown offset %02x\n", space.device().safe_pc(), offset * 2);
+ return 0x0000;
+
+ case 0x02: return l7a1045_sound_port_0004_r(space, offset, mem_mask);
+ case 0x03: return l7a1045_sound_port_0006_r(space, offset, mem_mask);
+ }
+ return 0x000;
+}
+
+
+WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_select_w)
+{
+ // I'm guessing these addresses are the sound chip / DSP?
+
+ // ---- ---- 000c cccc
+ // c = channel
+
+ if (data & 0x00e0) printf("%08x: l7a1045_sound_select_w unknown channel %02x\n", space.device().safe_pc(), data & 0x00ff);
+
+ UINT8 command = data >> 8;
+
+ switch (command)
+ {
+ case 0x00:
+ case 0x01:
+ case 0x02:
+ case 0x03: // 00003fffffff (startup only?)
+ case 0x04: // doesn't use 6
+ case 0x05: // 00003fffffff (mostly, often)
+ case 0x06: // 00007ff0ffff mostly
+ case 0x07: // 0000000f0708 etc. (low values)
+ case 0x08: // doesn't write to 2/4/6 with this set??
+ case 0x09: // doesn't write to 2/4/6 with this set??
+ case 0x0a: // random looking values
+
+ break;
+
+ default:
+ printf("%08x: l7a1045_sound_select_w unrecognized command %02x\n", space.device().safe_pc(), command);
+ break;
+ }
+
+ COMBINE_DATA(&m_audiochannel);
+}
+
+WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_data_02_w)
+{
+ m_audiodat[m_audiochannel].dat[2] = data;
+
+// if ((m_audiochannel & 0xff00) == 0x0a00)
+// printf("%08x: write port 0x0002 chansel %04x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audiochannel, data, m_audiodat[m_audiochannel].dat[0], m_audiodat[m_audiochannel].dat[1], m_audiodat[m_audiochannel].dat[2]);
+}
+
+WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_data_04_w)
+{
+ m_audiodat[m_audiochannel].dat[1] = data;
+
+// if ((m_audiochannel & 0xff00) == 0x0a00)
+// printf("%08x: write port 0x0004 chansel %04x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audiochannel, data, m_audiodat[m_audiochannel].dat[0], m_audiodat[m_audiochannel].dat[1], m_audiodat[m_audiochannel].dat[2]);
+}
+WRITE16_MEMBER(l7a1045_sound_device::l7a1045_sound_data_06_w)
+{
+ m_audiodat[m_audiochannel].dat[0] = data;
+
+// if ((m_audiochannel & 0xff00) == 0x0a00)
+// printf("%08x: write port 0x0006 chansel %04x data %04x (%04x%04x%04x)\n", space.device().safe_pc(), m_audiochannel, data, m_audiodat[m_audiochannel].dat[0], m_audiodat[m_audiochannel].dat[1], m_audiodat[m_audiochannel].dat[2]);
+}
+
+
+READ16_MEMBER(l7a1045_sound_device::l7a1045_sound_port_0004_r)
+{
+ // it writes the channel select before reading this.. so either it works on channels, or the command..
+ // read in irq5
+ printf("%08x: l7a1045_sound_port_0004_r mask (%04x) chn %04x\n", space.device().safe_pc(), mem_mask, m_audiochannel);
+ return rand();
+}
+
+READ16_MEMBER(l7a1045_sound_device::l7a1045_sound_port_0006_r)
+{
+ // it writes the channel select before reading this.. so either it works on channels, or the command..
+ // read in irq5
+ printf("%08x: l7a1045_sound_port_0006_r mask (%04x) chn %04x\n", space.device().safe_pc(), mem_mask, m_audiochannel);
+ return rand();
+}
diff --git a/src/emu/sound/l7a1045_l6028_dsp_a.h b/src/emu/sound/l7a1045_l6028_dsp_a.h
new file mode 100644
index 00000000000..f2dabc5bc95
--- /dev/null
+++ b/src/emu/sound/l7a1045_l6028_dsp_a.h
@@ -0,0 +1,67 @@
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+struct l7a1045_voice
+{
+ /*
+ l7a1045_voice() :
+ pos(0),
+ frac(0)
+ {
+ memset(regs, 0, sizeof(UINT32)*8);
+ }
+
+ UINT32 regs[8];
+ UINT32 pos;
+ UINT32 frac;
+ */
+};
+
+// ======================> l7a1045_sound_device
+
+class l7a1045_sound_device : public device_t,
+ public device_sound_interface
+{
+public:
+ l7a1045_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ ~l7a1045_sound_device() { }
+
+// void set_base(INT8* base) { m_base = base; }
+
+ DECLARE_WRITE16_MEMBER( l7a1045_sound_w );
+ DECLARE_READ16_MEMBER( l7a1045_sound_r );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // sound stream update overrides
+ virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
+
+private:
+ sound_stream *m_stream;
+// l7a1045_voice m_voice[32];
+// UINT16 m_key;
+// INT8* m_base;
+
+ UINT16 m_audiochannel;
+
+ struct l7a1045_48bit_data {
+ UINT16 dat[3];
+ };
+
+ l7a1045_48bit_data m_audiodat[0x10000];
+
+ DECLARE_WRITE16_MEMBER(l7a1045_sound_select_w);
+ DECLARE_WRITE16_MEMBER(l7a1045_sound_data_02_w);
+ DECLARE_WRITE16_MEMBER(l7a1045_sound_data_04_w);
+ DECLARE_WRITE16_MEMBER(l7a1045_sound_data_06_w);
+
+ DECLARE_READ16_MEMBER(l7a1045_sound_port_0004_r);
+ DECLARE_READ16_MEMBER(l7a1045_sound_port_0006_r);
+
+
+};
+
+extern const device_type L7A1045;
diff --git a/src/mame/audio/hng64.c b/src/mame/audio/hng64.c
index ed44a57893e..40ec0810572 100644
--- a/src/mame/audio/hng64.c
+++ b/src/mame/audio/hng64.c
@@ -200,21 +200,6 @@ WRITE16_MEMBER(hng64_state::hng64_sound_port_0008_w)
}
-READ16_MEMBER(hng64_state::hng64_sound_port_0004_r)
-{
- // it writes the channel select before reading this.. so either it works on channels, or the command..
- // read in irq5
- printf("%08x: hng64_sound_port_0004_r mask (%04x) chn %04x\n", space.device().safe_pc(), mem_mask, m_audiochannel);
- return rand();
-}
-
-READ16_MEMBER(hng64_state::hng64_sound_port_0006_r)
-{
- // it writes the channel select before reading this.. so either it works on channels, or the command..
- // read in irq5
- printf("%08x: hng64_sound_port_0006_r mask (%04x) chn %04x\n", space.device().safe_pc(), mem_mask, m_audiochannel);
- return rand();
-}
READ16_MEMBER(hng64_state::hng64_sound_port_0008_r)
{
@@ -223,63 +208,7 @@ READ16_MEMBER(hng64_state::hng64_sound_port_0008_r)
return rand();
}
-WRITE16_MEMBER(hng64_state::hng64_sound_select_w)
-{
- // I'm guessing these addresses are the sound chip / DSP?
-
- // ---- ---- 000c cccc
- // c = channel
-
- if (data & 0x00e0) printf("hng64_sound_select_w unknown channel %02x\n", data & 0x00ff);
-
- UINT8 command = data >> 8;
-
- switch (command)
- {
- case 0x00:
- case 0x01:
- case 0x02:
- case 0x03: // 00003fffffff (startup only?)
- case 0x04: // doesn't use 6
- case 0x05: // 00003fffffff (mostly, often)
- case 0x06: // 00007ff0ffff mostly
- case 0x07: // 0000000f0708 etc. (low values)
- case 0x08: // doesn't write to 2/4/6 with this set??
- case 0x09: // doesn't write to 2/4/6 with this set??
- case 0x0a: // random looking values
-
- break;
-
- default:
- printf("hng64_sound_select_w unrecognized command %02x\n", command);
- break;
- }
-
- COMBINE_DATA(&m_audiochannel);
-}
-
-WRITE16_MEMBER(hng64_state::hng64_sound_data_02_w)
-{
- m_audiodat[m_audiochannel].dat[2] = data;
-
-// if ((m_audiochannel & 0xff00) == 0x0a00)
-// printf("write port 0x0002 chansel %04x data %04x (%04x%04x%04x)\n", m_audiochannel, data, m_audiodat[m_audiochannel].dat[0], m_audiodat[m_audiochannel].dat[1], m_audiodat[m_audiochannel].dat[2]);
-}
-WRITE16_MEMBER(hng64_state::hng64_sound_data_04_w)
-{
- m_audiodat[m_audiochannel].dat[1] = data;
-
-// if ((m_audiochannel & 0xff00) == 0x0a00)
-// printf("write port 0x0004 chansel %04x data %04x (%04x%04x%04x)\n", m_audiochannel, data, m_audiodat[m_audiochannel].dat[0], m_audiodat[m_audiochannel].dat[1], m_audiodat[m_audiochannel].dat[2]);
-}
-WRITE16_MEMBER(hng64_state::hng64_sound_data_06_w)
-{
- m_audiodat[m_audiochannel].dat[0] = data;
-
-// if ((m_audiochannel & 0xff00) == 0x0a00)
-// printf("write port 0x0006 chansel %04x data %04x (%04x%04x%04x)\n", m_audiochannel, data, m_audiodat[m_audiochannel].dat[0], m_audiodat[m_audiochannel].dat[1], m_audiodat[m_audiochannel].dat[2]);
-}
// but why not just use the V33/V53 XA mode??
WRITE16_MEMBER(hng64_state::hng64_sound_bank_w)
@@ -366,10 +295,8 @@ READ16_MEMBER(hng64_state::hng64_sound_port_0104_r)
}
static ADDRESS_MAP_START( hng_sound_io, AS_IO, 16, hng64_state )
- AM_RANGE(0x0000, 0x0001) AM_WRITE( hng64_sound_select_w )
- AM_RANGE(0x0002, 0x0003) AM_WRITE( hng64_sound_data_02_w )
- AM_RANGE(0x0004, 0x0005) AM_READWRITE( hng64_sound_port_0004_r, hng64_sound_data_04_w )
- AM_RANGE(0x0006, 0x0007) AM_READWRITE( hng64_sound_port_0006_r, hng64_sound_data_06_w )
+ AM_RANGE(0x0000, 0x0007) AM_DEVREADWRITE("l7a1045", l7a1045_sound_device, l7a1045_sound_r, l7a1045_sound_w )
+
AM_RANGE(0x0008, 0x0009) AM_READWRITE( hng64_sound_port_0008_r, hng64_sound_port_0008_w )
AM_RANGE(0x000a, 0x000b) AM_WRITE( hng64_sound_port_000a_w )
AM_RANGE(0x000c, 0x000d) AM_WRITE( hng64_sound_port_000c_w )
@@ -444,4 +371,8 @@ MACHINE_CONFIG_FRAGMENT( hng64_audio )
MCFG_V53_TCU_OUT1_HANDLER(WRITELINE(hng64_state, tcu_tm1_cb))
MCFG_V53_TCU_OUT2_HANDLER(WRITELINE(hng64_state, tcu_tm2_cb))
+ MCFG_SOUND_ADD("l7a1045", L7A1045, 16000000 ) // ??
+ MCFG_SOUND_ROUTE(1, "lspeaker", 1.0)
+ MCFG_SOUND_ROUTE(0, "rspeaker", 1.0)
+
MACHINE_CONFIG_END
diff --git a/src/mame/includes/hng64.h b/src/mame/includes/hng64.h
index b2e03d86cb9..9970a7b3fc5 100644
--- a/src/mame/includes/hng64.h
+++ b/src/mame/includes/hng64.h
@@ -1,6 +1,7 @@
#include "machine/msm6242.h"
#include "cpu/mips/mips3.h"
#include "cpu/nec/v53.h"
+#include "sound/l7a1045_l6028_dsp_a.h"
enum
{
@@ -362,21 +363,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(tcu_tm1_cb);
DECLARE_WRITE_LINE_MEMBER(tcu_tm2_cb);
- UINT16 m_audiochannel;
- struct hng64_48bit_data {
- UINT16 dat[3];
- };
-
- hng64_48bit_data m_audiodat[0x10000];
-
- DECLARE_WRITE16_MEMBER(hng64_sound_select_w);
- DECLARE_WRITE16_MEMBER(hng64_sound_data_02_w);
- DECLARE_WRITE16_MEMBER(hng64_sound_data_04_w);
- DECLARE_WRITE16_MEMBER(hng64_sound_data_06_w);
-
- DECLARE_READ16_MEMBER(hng64_sound_port_0004_r);
- DECLARE_READ16_MEMBER(hng64_sound_port_0006_r);
DECLARE_READ16_MEMBER(hng64_sound_port_0008_r);
DECLARE_WRITE16_MEMBER(hng64_sound_port_0008_w);