summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2019-03-30 10:32:00 +0100
committer Olivier Galibert <galibert@pobox.com>2019-04-09 08:53:40 +0200
commitadc473b74dac2cee67b65014e0099b1918b2ee1c (patch)
tree5c33b3068b8117671cac187c2e1458004d2ea8e6
parent31ff9e8cea38027c00f807b91974c30a5fe57286 (diff)
swp20, dspv: Skeletons [O. Galibert]
-rw-r--r--scripts/src/cpu.lua17
-rw-r--r--scripts/src/sound.lua12
-rw-r--r--scripts/target/mame/mess.lua2
-rw-r--r--src/devices/sound/dspv.cpp169
-rw-r--r--src/devices/sound/dspv.h68
-rw-r--r--src/devices/sound/dspvd.cpp29
-rw-r--r--src/devices/sound/dspvd.h24
-rw-r--r--src/devices/sound/meg.cpp1
-rw-r--r--src/devices/sound/swp20.cpp75
-rw-r--r--src/devices/sound/swp20.h38
-rw-r--r--src/mame/drivers/ymmu100.cpp35
11 files changed, 462 insertions, 8 deletions
diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua
index 8c461e0ce16..5bbd4cd55cc 100644
--- a/scripts/src/cpu.lua
+++ b/scripts/src/cpu.lua
@@ -2837,6 +2837,23 @@ if (CPUS["MEG"]~=null or _OPTIONS["with-tools"]) then
end
--------------------------------------------------
+-- Yamaha DSPV
+--@src/devices/sound/dspv.h,CPUS["DSPV"] = true
+--------------------------------------------------
+
+if (CPUS["DSPV"]~=null) then
+ files {
+ MAME_DIR .. "src/devices/sound/dspv.cpp",
+ MAME_DIR .. "src/devices/sound/dspv.h",
+ }
+end
+
+if (CPUS["DSPV"]~=null or _OPTIONS["with-tools"]) then
+ table.insert(disasm_files , MAME_DIR .. "src/devices/sound/dspvd.cpp")
+ table.insert(disasm_files , MAME_DIR .. "src/devices/sound/dspvd.h")
+end
+
+--------------------------------------------------
-- National Semiconductor NS32000 series
--@src/devices/cpu/ns32000/ns32000.h,CPUS["NS32000"] = true
--------------------------------------------------
diff --git a/scripts/src/sound.lua b/scripts/src/sound.lua
index 73c6a852e44..cc24f2ba57f 100644
--- a/scripts/src/sound.lua
+++ b/scripts/src/sound.lua
@@ -1508,6 +1508,18 @@ end
---------------------------------------------------
--
+--@src/devices/sound/swp20.h,SOUNDS["SWP20"] = true
+---------------------------------------------------
+
+if (SOUNDS["SWP20"]~=null) then
+ files {
+ MAME_DIR .. "src/devices/sound/swp20.cpp",
+ MAME_DIR .. "src/devices/sound/swp20.h",
+ }
+end
+
+---------------------------------------------------
+--
--@src/devices/sound/swp30.h,SOUNDS["SWP30"] = true
---------------------------------------------------
diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua
index 036b63c330b..a69109a3540 100644
--- a/scripts/target/mame/mess.lua
+++ b/scripts/target/mame/mess.lua
@@ -141,6 +141,7 @@ CPUS["NS32000"] = true
--CPUS["DSPP"] = true
CPUS["HPC"] = true
CPUS["MEG"] = true
+CPUS["DSPV"] = true
--------------------------------------------------
-- specify available sound cores; some of these are
@@ -284,6 +285,7 @@ SOUNDS["DAVE"] = true
--SOUNDS["LC7535"] = true
SOUNDS["UPD934G"] = true
SOUNDS["IOPSPU"] = true
+SOUNDS["SWP20"] = true
SOUNDS["SWP30"] = true
--------------------------------------------------
diff --git a/src/devices/sound/dspv.cpp b/src/devices/sound/dspv.cpp
new file mode 100644
index 00000000000..86a1437fb85
--- /dev/null
+++ b/src/devices/sound/dspv.cpp
@@ -0,0 +1,169 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+// Yamaha DSPV, dsp used for acoustic simulation
+
+#include "emu.h"
+#include "dspv.h"
+
+DEFINE_DEVICE_TYPE(DSPV, dspv_device, "dspv", "Yamaha DSPV audio simulation DSP (YSS217-F/")
+
+dspv_device::dspv_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : cpu_device(mconfig, DSPV, tag, owner, clock),
+ device_sound_interface(mconfig, *this),
+ m_program_config("program", ENDIANNESS_BIG, 16, 16, -1, address_map_constructor(FUNC(dspv_device::prg_map), this)),
+ m_data_config("data", ENDIANNESS_BIG, 16, 14, -1, address_map_constructor(FUNC(dspv_device::data_map), this))
+{
+}
+
+void dspv_device::map(address_map &map)
+{
+ map(0x00, 0x7f).rw(FUNC(dspv_device::snd_r), FUNC(dspv_device::snd_w));
+
+ map(0x02, 0x03).r(FUNC(dspv_device::status_r));
+ map(0x06, 0x07).w(FUNC(dspv_device::prg_adr_w));
+ map(0x20, 0x21).w(FUNC(dspv_device::table_adrh_w));
+ map(0x22, 0x23).w(FUNC(dspv_device::table_adrl_w));
+ map(0x24, 0x25).w(FUNC(dspv_device::table_data_w));
+ map(0x26, 0x27).w(FUNC(dspv_device::table_zero_w));
+ map(0x40, 0x7f).w(FUNC(dspv_device::prg_data_w));
+}
+
+void dspv_device::prg_map(address_map &map)
+{
+ map(0x0000, 0xffff).ram();
+}
+
+void dspv_device::data_map(address_map &map)
+{
+ map(0x0000, 0x3fff).ram();
+}
+
+void dspv_device::table_adrh_w(u16 data)
+{
+ m_table_adr = (m_table_adr & 0x0000ffff) | (data << 16);
+}
+
+void dspv_device::table_adrl_w(u16 data)
+{
+ m_table_adr = (m_table_adr & 0xffff0000) | data;
+}
+
+void dspv_device::table_data_w(u16 data)
+{
+ if(m_table_adr >= 0x4000)
+ logerror("table_adr overflow!\n");
+ m_data->write_word(m_table_adr, data);
+ m_table_adr++;
+}
+
+void dspv_device::table_zero_w(u16 data)
+{
+ if(data)
+ logerror("table_zero_w %04x\n", data);
+}
+
+void dspv_device::prg_adr_w(u16 data)
+{
+ m_prg_adr = data;
+}
+
+void dspv_device::prg_data_w(offs_t offset, u16 data)
+{
+ u16 adr = m_prg_adr + offset;
+ adr = (adr << 3) | (adr >> 13);
+ m_program->write_word(adr, data);
+}
+
+u16 dspv_device::status_r()
+{
+ if(!machine().side_effects_disabled())
+ m_status ^= 0xffff;
+ return m_status;
+}
+
+u16 dspv_device::snd_r(offs_t offset)
+{
+ logerror("r %04x %s\n", offset, machine().describe_context());
+ return 0;
+}
+
+void dspv_device::snd_w(offs_t offset, u16 data)
+{
+ logerror("w %02x, %04x %s\n", offset, data, machine().describe_context());
+}
+
+void dspv_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+{
+}
+
+void dspv_device::device_start()
+{
+ m_program = &space(AS_PROGRAM);
+ m_data = &space(AS_DATA);
+ state_add(STATE_GENPC, "GENPC", m_pc).noshow();
+ state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
+ state_add(0, "PC", m_pc);
+
+ set_icountptr(m_icount);
+
+ save_item(NAME(m_pc));
+ save_item(NAME(m_status));
+ save_item(NAME(m_table_adr));
+ save_item(NAME(m_prg_adr));
+}
+
+void dspv_device::device_reset()
+{
+ m_pc = 0;
+ m_status = 0;
+ m_table_adr = 0;
+ m_prg_adr = 0;
+}
+
+uint32_t dspv_device::execute_min_cycles() const
+{
+ return 1;
+}
+
+uint32_t dspv_device::execute_max_cycles() const
+{
+ return 1;
+}
+
+uint32_t dspv_device::execute_input_lines() const
+{
+ return 0;
+}
+
+void dspv_device::execute_run()
+{
+ if(machine().debug_flags & DEBUG_FLAG_ENABLED)
+ debugger_instruction_hook(m_pc);
+ m_icount = 0;
+}
+
+device_memory_interface::space_config_vector dspv_device::memory_space_config() const
+{
+ return space_config_vector {
+ std::make_pair(AS_PROGRAM, &m_program_config),
+ std::make_pair(AS_DATA, &m_data_config)
+ };
+}
+
+void dspv_device::state_import(const device_state_entry &entry)
+{
+}
+
+void dspv_device::state_export(const device_state_entry &entry)
+{
+}
+
+void dspv_device::state_string_export(const device_state_entry &entry, std::string &str) const
+{
+}
+
+std::unique_ptr<util::disasm_interface> dspv_device::create_disassembler()
+{
+ return std::make_unique<dspv_disassembler>();
+}
diff --git a/src/devices/sound/dspv.h b/src/devices/sound/dspv.h
new file mode 100644
index 00000000000..b52f29e1448
--- /dev/null
+++ b/src/devices/sound/dspv.h
@@ -0,0 +1,68 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+// Yamaha DSPV, dsp used for acoustic simulation
+
+#ifndef DEVICES_SOUND_DSPV_H
+#define DEVICES_SOUND_DSPV_H
+
+#pragma once
+
+#include "dspvd.h"
+
+class dspv_device : public cpu_device, public device_sound_interface
+{
+public:
+ dspv_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 22579200);
+
+ void map(address_map &map);
+
+protected:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual uint32_t execute_min_cycles() const override;
+ virtual uint32_t execute_max_cycles() const override;
+ virtual uint32_t execute_input_lines() const override;
+ virtual void execute_run() override;
+ virtual space_config_vector memory_space_config() const override;
+ virtual void state_import(const device_state_entry &entry) override;
+ virtual void state_export(const device_state_entry &entry) override;
+ virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
+ virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
+ virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+
+private:
+ address_space_config m_program_config, m_data_config;
+ address_space *m_program, *m_data;
+
+ u32 m_pc;
+ int m_icount;
+
+ u32 m_table_adr;
+ u16 m_prg_adr;
+ u16 m_status;
+
+ // Table ram access
+ void table_adrh_w(u16 data);
+ void table_adrl_w(u16 data);
+ void table_data_w(u16 data);
+ void table_zero_w(u16 data);
+
+ // Program ram access
+ void prg_adr_w(u16 data);
+ void prg_data_w(offs_t offset, u16 data);
+
+ // Registers
+ u16 status_r();
+
+ // Generic catch-all
+ u16 snd_r(offs_t offset);
+ void snd_w(offs_t offset, u16 data);
+
+ void prg_map(address_map &map);
+ void data_map(address_map &map);
+};
+
+DECLARE_DEVICE_TYPE(DSPV, dspv_device)
+
+#endif
diff --git a/src/devices/sound/dspvd.cpp b/src/devices/sound/dspvd.cpp
new file mode 100644
index 00000000000..3a2fd254cf6
--- /dev/null
+++ b/src/devices/sound/dspvd.cpp
@@ -0,0 +1,29 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+// Yamaha DSPV
+//
+// Audio dsp dedicated to acoustic simulation
+//
+// Disassembler, placeholder
+
+#include "emu.h"
+#include "dspvd.h"
+
+dspv_disassembler::dspv_disassembler()
+{
+}
+
+u32 dspv_disassembler::opcode_alignment() const
+{
+ return 1;
+}
+
+offs_t dspv_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
+{
+ u16 opc = opcodes.r16(pc);
+
+ util::stream_format(stream, "dc.w %04x", opc);
+
+ return 1 | SUPPORTED;
+}
diff --git a/src/devices/sound/dspvd.h b/src/devices/sound/dspvd.h
new file mode 100644
index 00000000000..32f7cb35497
--- /dev/null
+++ b/src/devices/sound/dspvd.h
@@ -0,0 +1,24 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+// Yamaha DSPV
+//
+// Audio dsp dedicated to acoustic simulation
+//
+// Disassembler
+
+#ifndef DEVICES_SOUND_DSPVD_H
+#define DEVICES_SOUND_DSPVD_H
+
+#pragma once
+
+class dspv_disassembler : public util::disasm_interface
+{
+public:
+ dspv_disassembler();
+
+ virtual u32 opcode_alignment() const override;
+ virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) override;
+};
+
+#endif
diff --git a/src/devices/sound/meg.cpp b/src/devices/sound/meg.cpp
index a1f9d67b293..54bdc88902d 100644
--- a/src/devices/sound/meg.cpp
+++ b/src/devices/sound/meg.cpp
@@ -67,6 +67,7 @@ void meg_base_device::lfo_w(u8 reg, u16 value)
void meg_base_device::map_w(u8 reg, u16 value)
{
m_map[reg] = value;
+ logerror("map %d: start = %06x size = %06x extra = %x\n", reg, (value & 0xff) << 10, 1 << (10 + ((value & 0x0700) >> 8)), (value & 0xf800) >> 11);
}
u64 meg_base_device::prg_r(u16 address) const
diff --git a/src/devices/sound/swp20.cpp b/src/devices/sound/swp20.cpp
new file mode 100644
index 00000000000..aa4bddaad7d
--- /dev/null
+++ b/src/devices/sound/swp20.cpp
@@ -0,0 +1,75 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+// Yamaha SWP20, rompler
+
+#include "emu.h"
+#include "swp20.h"
+
+DEFINE_DEVICE_TYPE(SWP20, swp20_device, "swp20", "Yamaha SWP20 sound chip")
+
+swp20_device::swp20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, SWP20, tag, owner, clock),
+ device_sound_interface(mconfig, *this),
+ device_rom_interface(mconfig, *this, 23+2, ENDIANNESS_LITTLE, 16)
+{
+}
+
+void swp20_device::device_start()
+{
+}
+
+void swp20_device::device_reset()
+{
+ m_p3c_port = 0x00;
+ m_p3c_address = true;
+}
+
+void swp20_device::rom_bank_updated()
+{
+}
+
+void swp20_device::map(address_map &map)
+{
+ map(0x00, 0x3f).rw(FUNC(swp20_device::snd_r), FUNC(swp20_device::snd_w));
+
+ map(0x3c, 0x3c).w(FUNC(swp20_device::p3c_w));
+}
+
+// init mu80:
+// 48394: <- 47aea
+// write 04.7f 00.14 01.90 to +3c
+// write 01.90 80-ff, 473ea++
+// write 01.94 80-ff, 4746a++
+// write 01.98 80-ff, 474ea++
+// write 01.9c 80-ff, 4756a++
+
+// write 01.a0
+// write 40-5f.data
+// etc
+
+void swp20_device::p3c_w(u8 data)
+{
+ if(m_p3c_address)
+ m_p3c_port = data;
+ else
+ logerror("p3c %02x = %02x\n", m_p3c_port, data);
+
+ m_p3c_address = !m_p3c_address;
+}
+
+u8 swp20_device::snd_r(offs_t offset)
+{
+ logerror("r %02x %s\n", offset, machine().describe_context());
+ return 0;
+}
+
+void swp20_device::snd_w(offs_t offset, u8 data)
+{
+ logerror("w %02x, %02x %s\n", offset, data, machine().describe_context());
+}
+
+void swp20_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+{
+}
+
diff --git a/src/devices/sound/swp20.h b/src/devices/sound/swp20.h
new file mode 100644
index 00000000000..fa1c2e1de9f
--- /dev/null
+++ b/src/devices/sound/swp20.h
@@ -0,0 +1,38 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+// Yamaha SWP20, rompler
+
+#ifndef DEVICES_SOUND_SWP20_H
+#define DEVICES_SOUND_SWP20_H
+
+#pragma once
+
+class swp20_device : public device_t, public device_sound_interface, public device_rom_interface
+{
+public:
+ swp20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 11289600);
+
+ void map(address_map &map);
+
+protected:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+ virtual void rom_bank_updated() override;
+
+private:
+ u8 m_p3c_port;
+ bool m_p3c_address;
+
+ // Generic upload port
+ void p3c_w(u8 data);
+
+ // Generic catch-all
+ u8 snd_r(offs_t offset);
+ void snd_w(offs_t offset, u8 data);
+};
+
+DECLARE_DEVICE_TYPE(SWP20, swp20_device)
+
+#endif
diff --git a/src/mame/drivers/ymmu100.cpp b/src/mame/drivers/ymmu100.cpp
index 86a2de6af84..add129e1490 100644
--- a/src/mame/drivers/ymmu100.cpp
+++ b/src/mame/drivers/ymmu100.cpp
@@ -135,8 +135,10 @@
#include "cpu/h8/h83003.h"
#include "cpu/h8/h8s2655.h"
#include "video/hd44780.h"
+#include "sound/swp20.h"
#include "sound/swp30.h"
#include "sound/meg.h"
+#include "sound/dspv.h"
#include "debugger.h"
#include "screen.h"
@@ -200,6 +202,9 @@ public:
, m_mu80cpu(*this, "mu80cpu")
, m_vl70cpu(*this, "vl70cpu")
, m_swp30(*this, "swp30")
+ , m_swp20_0(*this, "swp20_0")
+ , m_swp20_1(*this, "swp20_1")
+ , m_dspv(*this, "dspv")
, m_meg(*this, "meg")
, m_lcd(*this, "lcd")
, m_ioport_p7(*this, "P7")
@@ -319,6 +324,9 @@ private:
optional_device<h83002_device> m_mu80cpu;
optional_device<h83003_device> m_vl70cpu;
optional_device<swp30_device> m_swp30;
+ optional_device<swp20_device> m_swp20_0;
+ optional_device<swp20_device> m_swp20_1;
+ optional_device<dspv_device> m_dspv;
optional_device<meg_device> m_meg;
required_device<hd44780_device> m_lcd;
optional_ioport m_ioport_p7;
@@ -379,6 +387,7 @@ private:
void mu80_iomap(address_map &map);
void mu80_map(address_map &map);
void mu50_iomap(address_map &map);
+ void mu50_map(address_map &map);
void vl70_iomap(address_map &map);
void vl70_map(address_map &map);
void swp30_map(address_map &map);
@@ -606,17 +615,26 @@ u32 mu100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, cons
return 0;
}
+void mu100_state::mu50_map(address_map &map)
+{
+ map(0x000000, 0x07ffff).rom().region("mu80cpu", 0);
+ map(0x200000, 0x20ffff).ram(); // 64K work RAM
+}
+
void mu100_state::mu80_map(address_map &map)
{
map(0x000000, 0x07ffff).rom().region("mu80cpu", 0);
map(0x200000, 0x20ffff).ram(); // 64K work RAM
+ map(0x400000, 0x40003f).m(m_swp20_0, FUNC(swp20_device::map));
map(0x440000, 0x44001f).m(m_meg, FUNC(meg_device::map));
+ map(0x460000, 0x46003f).m(m_swp20_1, FUNC(swp20_device::map));
}
void mu100_state::vl70_map(address_map &map)
{
map(0x000000, 0x1fffff).rom().region("vl70cpu", 0);
map(0x200000, 0x20ffff).ram(); // 64K work RAM
+ map(0x400000, 0x60007f).m(m_dspv, FUNC(dspv_device::map));
map(0x600000, 0x60001f).m(m_meg, FUNC(meg_device::map));
}
@@ -1080,11 +1098,11 @@ void mu100_state::mu80(machine_config &config)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- // In truth, dual swp-20
- SWP30(config, m_swp30);
- m_swp30->set_addrmap(0, &mu100_state::swp30_map);
- m_swp30->add_route(0, "lspeaker", 1.0);
- m_swp30->add_route(1, "rspeaker", 1.0);
+ SWP20(config, m_swp20_0);
+ m_swp20_0->set_device_rom_tag("swp20");
+
+ SWP20(config, m_swp20_1);
+ m_swp20_1->set_device_rom_tag("swp20");
MEG(config, m_meg);
@@ -1104,7 +1122,7 @@ void mu100_state::mu80(machine_config &config)
void mu100_state::mu50(machine_config &config)
{
H83002(config, m_mu80cpu, 16_MHz_XTAL);
- m_mu80cpu->set_addrmap(AS_PROGRAM, &mu100_state::mu80_map);
+ m_mu80cpu->set_addrmap(AS_PROGRAM, &mu100_state::mu50_map);
m_mu80cpu->set_addrmap(AS_IO, &mu100_state::mu50_iomap);
HD44780(config, m_lcd);
@@ -1120,7 +1138,7 @@ void mu100_state::mu50(machine_config &config)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- // In truth, dual swp-20
+ // In truth, swp00
SWP30(config, m_swp30);
m_swp30->set_addrmap(0, &mu100_state::swp30_map);
m_swp30->add_route(0, "lspeaker", 1.0);
@@ -1160,6 +1178,7 @@ void mu100_state::vl70(machine_config &config)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
+ DSPV(config, m_dspv);
MEG(config, m_meg);
auto &mdin_a(MIDI_PORT(config, "mdin_a"));
@@ -1223,7 +1242,7 @@ ROM_START( mu80 )
ROM_REGION( 0x80000, "mu80cpu", 0 )
ROM_LOAD16_WORD_SWAP( "yamaha_mu80.bin", 0x000000, 0x080000, CRC(c31074c0) SHA1(a11bd4523cd8ff1e1744078c3b4c18112b73c61e) )
- ROM_REGION( 0x1800000, "swp30", ROMREGION_ERASE00 )
+ ROM_REGION( 0x800000, "swp20", ROMREGION_ERASE00 )
ROM_REGION( 0x1000, "lcd", 0)
// Hand made, 3 characters unused