Argh, sorry about the forgotten files.

This commit is contained in:
Olivier Galibert 2023-10-30 00:42:32 +01:00
parent f923597fed
commit 556de9bd1e
12 changed files with 1012 additions and 824 deletions

View File

@ -3370,20 +3370,20 @@ if opt_tool(CPUS, "HPC") then
end
--------------------------------------------------
-- Yamaha Multiple Effects Generator
--@src/devices/sound/meg.h,CPUS["MEG"] = true
-- Yamaha SWP30
--@src/devices/sound/swp30.h,CPUS["SWP30"] = true
--------------------------------------------------
if CPUS["MEG"] then
if CPUS["SWP30"] then
files {
MAME_DIR .. "src/devices/sound/meg.cpp",
MAME_DIR .. "src/devices/sound/meg.h",
MAME_DIR .. "src/devices/sound/swp30.cpp",
MAME_DIR .. "src/devices/sound/swp30.h",
}
end
if opt_tool(CPUS, "MEG") then
table.insert(disasm_files , MAME_DIR .. "src/devices/sound/megd.cpp")
table.insert(disasm_files , MAME_DIR .. "src/devices/sound/megd.h")
if opt_tool(CPUS, "SWP30") then
table.insert(disasm_files , MAME_DIR .. "src/devices/sound/swp30d.cpp")
table.insert(disasm_files , MAME_DIR .. "src/devices/sound/swp30d.h")
end
--------------------------------------------------

View File

@ -1526,13 +1526,13 @@ end
---------------------------------------------------
--
--@src/devices/sound/swp30.h,SOUNDS["SWP30"] = true
--@src/devices/sound/meg.h,SOUNDS["MEG"] = true
---------------------------------------------------
if (SOUNDS["SWP30"]~=null) then
if (SOUNDS["MEG"]~=null) then
files {
MAME_DIR .. "src/devices/sound/swp30.cpp",
MAME_DIR .. "src/devices/sound/swp30.h",
MAME_DIR .. "src/devices/sound/meg.cpp",
MAME_DIR .. "src/devices/sound/meg.h",
}
end

View File

@ -6,178 +6,22 @@
// Audio dsp dedicated to effects generation
#include "emu.h"
#include "debugger.h"
#include "meg.h"
DEFINE_DEVICE_TYPE(MEG, meg_device, "meg", "Multiple Effects Generator (HD62098 / XM309A00)")
DEFINE_DEVICE_TYPE(MEGEMB, meg_embedded_device, "megemb", "Multiple Effects Generator (embedded)")
void meg_base_device::prg_map(address_map &map)
{
map(0, m_prg_size - 1).ram();
}
void meg_base_device::fp_map(address_map &map)
{
map(0, m_prg_size - 1).ram();
}
void meg_base_device::offsets_map(address_map &map)
{
map(0, 0x7f).ram();
}
meg_base_device::meg_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u32 prg_size) :
cpu_device(mconfig, type, tag, owner, clock),
m_program_config("program", ENDIANNESS_BIG, 64, prg_size > 256 ? 9 : 8, -3, address_map_constructor(FUNC(meg_base_device::prg_map), this)),
m_fp_config("fp", ENDIANNESS_BIG, 16, prg_size > 256 ? 9 : 8, -1, address_map_constructor(FUNC(meg_base_device::fp_map), this)),
m_offsets_config("offsets", ENDIANNESS_BIG, 16, prg_size > 256 ? 7 : 7, -1, address_map_constructor(FUNC(meg_base_device::offsets_map), this)),
m_prg_size(prg_size)
{
}
void meg_base_device::prg_w(u16 address, u64 opcode)
{
m_program->write_qword(address, opcode);
}
void meg_base_device::fp_w(u16 address, u16 value)
{
m_fp->write_word(address, value);
}
void meg_base_device::offset_w(u16 address, u16 value)
{
m_offsets->write_word(address, value);
}
void meg_base_device::lfo_w(u8 reg, u16 value)
{
m_lfo[reg] = value;
static const int dt[8] = { 0, 32, 64, 128, 256, 512, 1024, 2048 };
static const int sh[8] = { 0, 0, 1, 2, 3, 4, 5, 6 };
int scale = (value >> 5) & 7;
int step = ((value & 31) << sh[scale]) + dt[scale];
logerror("lfo_w %02x freq=%5.2f phase=%6.4f\n", reg, step * 44100.0/4194304, (value >> 8)/256.0);
}
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
{
return m_program->read_qword(address);
}
u16 meg_base_device::fp_r(u16 address) const
{
return m_fp->read_word(address);
}
u16 meg_base_device::offset_r(u16 address) const
{
return m_offsets->read_word(address);
}
u16 meg_base_device::lfo_r(u8 reg) const
{
return m_lfo[reg];
}
u16 meg_base_device::map_r(u8 reg) const
{
return m_map[reg];
}
void meg_base_device::device_start()
{
m_program = &space(AS_PROGRAM);
m_fp = &space(AS_FP);
m_offsets = &space(AS_OFFSETS);
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_lfo));
save_item(NAME(m_map));
save_item(NAME(m_pc));
}
void meg_base_device::device_reset()
{
memset(m_lfo, 0, sizeof(m_lfo));
memset(m_map, 0, sizeof(m_map));
m_pc = 0;
}
uint32_t meg_base_device::execute_min_cycles() const noexcept
{
return 1;
}
uint32_t meg_base_device::execute_max_cycles() const noexcept
{
return 1;
}
uint32_t meg_base_device::execute_input_lines() const noexcept
{
return 0;
}
void meg_base_device::execute_run()
{
if(machine().debug_flags & DEBUG_FLAG_ENABLED)
debugger_instruction_hook(m_pc);
m_icount = 0;
}
device_memory_interface::space_config_vector meg_base_device::memory_space_config() const
{
return space_config_vector {
std::make_pair(AS_PROGRAM, &m_program_config),
std::make_pair(AS_FP, &m_fp_config),
std::make_pair(AS_OFFSETS, &m_offsets_config)
};
}
void meg_base_device::state_import(const device_state_entry &entry)
{
}
void meg_base_device::state_export(const device_state_entry &entry)
{
}
void meg_base_device::state_string_export(const device_state_entry &entry, std::string &str) const
{
}
std::unique_ptr<util::disasm_interface> meg_base_device::create_disassembler()
{
return std::make_unique<meg_disassembler>(this);
}
meg_embedded_device::meg_embedded_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
meg_base_device(mconfig, MEGEMB, tag, owner, clock, 384)
{
}
meg_device::meg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
meg_base_device(mconfig, MEG, tag, owner, clock, 256)
device_t(mconfig, MEG, tag, owner, clock)
{
}
void meg_device::device_start()
{
}
void meg_device::device_reset()
{
}
// vl70:
// 6d1e: write 1, r0l
@ -213,8 +57,8 @@ void meg_device::map(address_map &map)
map(0x08, 0x08).w(FUNC(meg_device::s8_w));
map(0x09, 0x09).w(FUNC(meg_device::s9_w));
map(0x0a, 0x0a).w(FUNC(meg_device::sa_w));
map(0x0c, 0x0c).w(FUNC(meg_device::fph_w));
map(0x0d, 0x0d).w(FUNC(meg_device::fpl_w));
map(0x0c, 0x0c).w(FUNC(meg_device::consth_w));
map(0x0d, 0x0d).w(FUNC(meg_device::constl_w));
map(0x0e, 0x0e).w(FUNC(meg_device::se_w));
map(0x0f, 0x0f).w(FUNC(meg_device::sf_w));
map(0x10, 0x10).r(FUNC(meg_device::s10_r));
@ -297,15 +141,15 @@ void meg_device::sa_w(u8 data)
logerror("ra %02x %s\n", data, machine().describe_context());
}
void meg_device::fph_w(u8 data)
void meg_device::consth_w(u8 data)
{
fp_w(m_reg, (fp_r(m_reg) & 0x00ff) | (data << 8));
m_const[m_reg] = (m_const[m_reg] & 0x00ff) | (data << 8);
}
void meg_device::fpl_w(u8 data)
void meg_device::constl_w(u8 data)
{
fp_w(m_reg, (fp_r(m_reg) & 0xff00) | data);
m_const[m_reg] = (m_const[m_reg] & 0xff00) | data;
}
void meg_device::se_w(u8 data)
@ -339,12 +183,12 @@ u8 meg_device::s11_r()
void meg_device::offseth_w(u8 data)
{
offset_w(m_reg, (offset_r(m_reg) & 0x00ff) | (data << 8));
m_offset[m_reg] = (m_offset[m_reg] & 0x00ff) | (data << 8);
}
void meg_device::offsetl_w(u8 data)
{
offset_w(m_reg, (offset_r(m_reg) & 0xff00) | data);
m_offset[m_reg] = (m_offset[m_reg] & 0xff00) | data;
}
void meg_device::s14_w(u8 data)

View File

@ -3,76 +3,23 @@
// Yamaha MEG - Multiple effects generator
//
// Audio dsp dedicated to effects generation
// Audio dsp dedicated to effects generation, part of the SWP20 lineup
#ifndef DEVICES_SOUND_MEG_H
#define DEVICES_SOUND_MEG_H
#pragma once
#include "megd.h"
class meg_base_device : public cpu_device, public meg_disassembler::info
{
public:
enum {
AS_FP = 1,
AS_OFFSETS = 2
};
meg_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, u32 prg_size);
void prg_w(u16 address, u64 opcode);
void fp_w(u16 address, u16 value);
void offset_w(u16 address, u16 value);
void lfo_w(u8 reg, u16 value);
void map_w(u8 reg, u16 value);
u64 prg_r(u16 address) const;
virtual u16 fp_r(u16 address) const override;
virtual u16 offset_r(u16 address) const override;
u16 lfo_r(u8 reg) const;
u16 map_r(u8 reg) const;
protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual uint32_t execute_min_cycles() const noexcept override;
virtual uint32_t execute_max_cycles() const noexcept override;
virtual uint32_t execute_input_lines() const noexcept 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;
private:
address_space_config m_program_config, m_fp_config, m_offsets_config;
address_space *m_program, *m_fp, *m_offsets;
u32 m_prg_size, m_pc;
int m_icount;
u16 m_lfo[0x18], m_map[8];
void prg_map(address_map &map);
void fp_map(address_map &map);
void offsets_map(address_map &map);
};
class meg_embedded_device : public meg_base_device
{
public:
meg_embedded_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 44100*384);
};
class meg_device : public meg_base_device
class meg_device : public device_t
{
public:
meg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 44100*256);
void map(address_map &map);
protected:
virtual void device_start() override;
virtual void device_reset() override;
private:
u8 m_r4[256];
u8 m_r5[256];
@ -87,6 +34,10 @@ private:
u8 m_r17[256];
u8 m_r18[256];
u8 m_reg;
std::array<s16, 0xc0> m_const;
std::array<s16, 0x40> m_offset;
u8 s2_r();
u8 s10_r();
u8 s11_r();
@ -100,8 +51,8 @@ private:
void s8_w(u8 data);
void s9_w(u8 data);
void sa_w(u8 data);
void fph_w(u8 data);
void fpl_w(u8 data);
void consth_w(u8 data);
void constl_w(u8 data);
void se_w(u8 data);
void sf_w(u8 data);
void s10_w(u8 data);
@ -115,8 +66,6 @@ private:
void s18_w(u8 data);
};
DECLARE_DEVICE_TYPE(MEG, meg_device)
DECLARE_DEVICE_TYPE(MEGEMB, meg_embedded_device)
#endif

View File

@ -1,118 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
// Yamaha MEG - Multiple effects generator
//
// Audio dsp dedicated to effects generation
//
// Disassembler
#include "emu.h"
#include "megd.h"
meg_disassembler::meg_disassembler(info *inf) : m_info(inf)
{
}
u32 meg_disassembler::opcode_alignment() const
{
return 1;
}
std::string meg_disassembler::gfp(offs_t address) const
{
if(!m_info)
return util::string_format("fp%03x", address);
s16 fp = m_info->fp_r(address);
return util::string_format("%g", fp / 16384.0);
}
std::string meg_disassembler::goffset(offs_t address) const
{
return m_info ? util::string_format("%x", m_info->offset_r(address)) : util::string_format("of%02x", address);
}
u32 meg_disassembler::b(u64 opc, u32 start, u32 count)
{
return (opc >> start) & ((1 << count) - 1);
}
void meg_disassembler::append(std::string &r, const std::string &e)
{
if(r != "")
r += " ; ";
r += e;
}
// 33333333 33333333 22222222 22222222 11111111 11111111 00000000 00000000
// fedcba98 76543210 fedcba98 76543210 fedcba98 76543210 fedcba98 76543210
// 66665555 55555544 44444444 33333333 33222222 22221111 11111100 00000000
// 32109876 54321098 76543210 98765432 10987654 32109876 54321098 76543210
// XLB----- -rrrrrrr r--mmmmm m-MM---- -P-----* -----Arr rrrrrrmm mmmm----
// m = low is read port, high is write port, memory register
// r = low is read port, high is high port, rotating register
// X = used for lo-fi variation only
// L = lfo read
// * = compute mul
// A = mul input = m or r
// P = P sent for register write
// B = register write to mbuf
// M = memory mode, none/read/write/read+1
offs_t meg_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
{
u64 opc = opcodes.r64(pc);
std::string r;
r = util::string_format("[m%02x]", b(opc, 39, 6));
if(b(opc, 62, 1))
append(r, "lfo");
if(b(opc, 23, 1))
switch(b(opc, 24, 2)) {
case 0:
if(b(opc, 18, 1))
append(r, util::string_format("p += %s*m%02x", gfp(pc), b(opc, 4, 6)));
else
append(r, util::string_format("p += %s*r%02x", gfp(pc), b(opc, 10, 8)));
break;
case 1:
append(r, util::string_format("p = %s*(r%02x+m%02x)", gfp(pc), b(opc, 10, 8), b(opc, 4, 6)));
break;
case 2:
append(r, util::string_format("p ?= %s*(r%02x+m%02x)", gfp(pc), b(opc, 10, 8), b(opc, 4, 6)));
break;
case 3:
if(b(opc, 18, 1))
append(r, util::string_format("p = %s*m%02x", gfp(pc), b(opc, 4, 6)));
else
append(r, util::string_format("p = %s*r%02x", gfp(pc), b(opc, 10, 8)));
break;
}
if(b(opc, 30, 1)) {
if(b(opc, 61, 1))
append(r, "mb = p");
else if(b(opc, 46, 1) == 1)
append(r, util::string_format("m%02x = p", b(opc, 39, 6)));
else
append(r, util::string_format("r%02x = p", b(opc, 47, 8)));
}
u32 memmode = b(opc, 36, 2);
if(memmode) {
static const char *modes[4] = { nullptr, "w", "r", "rw" };
append(r, util::string_format("mem_%s %x +%s", modes[memmode], b(opc, 33, 3), goffset(pc/3)));
r += util::string_format("-> m%02x", b(opcodes.r64(pc+2), 39, 6));
}
stream << r;
return 1 | SUPPORTED;
}

View File

@ -720,7 +720,7 @@ void swp00_device::attack_speed_w(offs_t offset, u8 data)
return;
m_stream->update();
m_attack_speed[chan] = data;
// logerror("attack_speed[%02x] = %02x\n", chan, m_attack_speed[chan]);
logerror("attack_speed[%02x] = %02x\n", chan, m_attack_speed[chan]);
}
u8 swp00_device::attack_speed_r(offs_t offset)
@ -736,7 +736,7 @@ void swp00_device::attack_level_w(offs_t offset, u8 data)
return;
m_stream->update();
m_attack_level[chan] = data;
// logerror("attack_level[%02x] = %02x\n", chan, m_attack_level[chan]);
logerror("attack_level[%02x] = %02x\n", chan, m_attack_level[chan]);
}
u8 swp00_device::attack_level_r(offs_t offset)
@ -757,7 +757,7 @@ void swp00_device::decay_speed_w(offs_t offset, u8 data)
if(data & 0x80)
m_decay[chan] = true;
// logerror("decay_speed[%02x] = %02x\n", chan, m_decay_speed[chan]);
logerror("decay_speed[%02x] = %02x\n", chan, m_decay_speed[chan]);
}
u8 swp00_device::decay_speed_r(offs_t offset)
@ -773,7 +773,7 @@ void swp00_device::decay_level_w(offs_t offset, u8 data)
return;
m_stream->update();
m_decay_level[chan] = data;
// logerror("decay_level[%02x] = %02x\n", chan, m_decay_level[chan]);
logerror("decay_level[%02x] = %02x\n", chan, m_decay_level[chan]);
}
u8 swp00_device::decay_level_r(offs_t offset)
@ -900,7 +900,7 @@ u8 swp00_device::lfo_pmod_depth_r(offs_t offset)
void swp00_device::keyon(int chan)
{
m_stream->update();
// logerror("keyon %02x a=%02x/%02x d=%02x/%02x\n", chan, m_attack_speed[chan], m_attack_level[chan], m_decay_speed[chan], m_decay_level[chan]);
logerror("keyon %02x a=%02x/%02x d=%02x/%02x glo=%02x pan=%02x [%x %x %x %x]\n", chan, m_attack_speed[chan], m_attack_level[chan], m_decay_speed[chan], m_decay_level[chan], m_glo_level[chan], m_panning[chan], m_sample_start[chan], m_sample_end[chan], m_sample_address[chan], m_sample_dec_and_format[chan]);
m_lfo_phase[chan] = 0;
m_sample_pos[chan] = -m_sample_start[chan] << 15;
@ -1249,6 +1249,11 @@ s32 swp00_device::saturate(s32 value)
return value;
}
double v2f2(s32 value)
{
return (1.0 - (value & 0xffffff) / 33554432.0) / (1 << (value >> 24));
}
void swp00_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
const delay_block brev(this, m_rev_buffer);

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,9 @@
#pragma once
#include "meg.h"
#include "dirom.h"
#include "swp30d.h"
class swp30_device : public device_t, public device_sound_interface, public device_rom_interface<25+2, 2, 0, ENDIANNESS_LITTLE>
class swp30_device : public cpu_device, public device_sound_interface, public swp30_disassembler::info
{
public:
swp30_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 33868800);
@ -22,51 +21,81 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual uint32_t execute_min_cycles() const noexcept override;
virtual uint32_t execute_max_cycles() const noexcept override;
virtual uint32_t execute_input_lines() const noexcept 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;
private:
enum {
IDLE,
ATTACK,
DECAY,
SUSTAIN,
DECAY1,
DECAY2,
RELEASE
};
required_device<meg_embedded_device> m_meg;
address_space_config m_program_config, m_rom_config;
address_space *m_program, *m_rom;
memory_access<25, 2, -2, ENDIANNESS_LITTLE>::cache m_rom_cache;
sound_stream *m_stream;
s32 m_sample_increment[0x4000];
s32 m_linear_attenuation[0x100];
s16 m_sample_log8[0x100];
static const std::array<s32, 0x80> attack_linear_step;
static const std::array<s32, 0x20> decay_linear_step;
static const std::array<s32, 16> panmap;
std::array<s32, 0x80> m_global_step;
std::array<s16, 0x100> m_sample_log8;
u64 m_program[0x180];
u64 m_keyon_mask;
u32 m_pre_size[0x40], m_post_size[0x40], m_address[0x40];
std::array<s32, 0x40> m_sample_start;
std::array<s32, 0x40> m_sample_end;
std::array<u32, 0x40> m_sample_address;
std::array<u16, 0x40> m_pitch;
std::array<u16, 0x40> m_attack;
std::array<u16, 0x40> m_decay1;
std::array<u16, 0x40> m_decay2;
std::array<u16, 0x40> m_release_glo;
std::array<u16, 0x40> m_pan;
std::array<u16, 0x40> m_dry_rev;
std::array<u16, 0x40> m_cho_var;
std::array<s32, 0x40> m_sample_pos;
std::array<s32, 0x40> m_envelope_level;
std::array<s32, 0x40> m_envelope_timer;
std::array<bool, 0x40> m_envelope_on_timer;
std::array<bool, 0x40> m_decay2_done;
std::array<u8, 0x40> m_envelope_mode;
std::array<s32, 0x40> m_glo_level_cur;
std::array<s32, 0x40> m_pan_l;
std::array<s32, 0x40> m_pan_r;
std::array<u64, 0x180> m_meg_program;
std::array<s16, 0x180> m_meg_const;
std::array<u16, 0x80> m_meg_offset;
std::array<u16, 0x18> m_meg_lfo;
std::array<u16, 8> m_meg_map;
s32 m_sample_pos[0x40];
s32 m_sample_history[0x40][2][2];
u32 m_current_volume[0x40], m_target_volume[0x40];
s32 m_step_volume[0x40];
u32 m_waverom_adr, m_waverom_mode, m_waverom_val;
u16 m_waverom_access;
u16 m_program_pfp[0x180], m_program_pint[0x80], m_program_plfo[0x80];
u16 m_base_volume[0x40], m_freq[0x40], m_pan[0x40], m_dry_rev[0x40], m_cho_var[0x40];
u16 m_attack[0x40], m_decay[0x40], m_release[0x40];
u16 m_lpf_cutoff[0x40], m_lpf_cutoff_inc[0x40], m_lpf_reso[0x40], m_hpf_cutoff[0x40];
s16 m_eq_filter[0x40][6];
u16 m_routing[0x40][3];
u16 m_map[8];
u64 m_keyon_mask;
u16 m_internal_adr;
u16 m_program_address;
u8 m_mode[0x40];
u16 m_meg_program_address;
u16 m_meg_pc;
int m_icount;
// AWM2 per-channel registers
u16 lpf_cutoff_r(offs_t offset);
@ -79,34 +108,37 @@ private:
void lpf_reso_w(offs_t offset, u16 data);
u16 attack_r(offs_t offset);
void attack_w(offs_t offset, u16 data);
u16 decay_r(offs_t offset);
void decay_w(offs_t offset, u16 data);
u16 release_r(offs_t offset);
void release_w(offs_t offset, u16 data);
u16 decay1_r(offs_t offset);
void decay1_w(offs_t offset, u16 data);
u16 decay2_r(offs_t offset);
void decay2_w(offs_t offset, u16 data);
u16 release_glo_r(offs_t offset);
void release_glo_w(offs_t offset, u16 data);
template<int coef> u16 eq_filter_r(offs_t offset);
template<int coef> void eq_filter_w(offs_t offset, u16 data);
u16 base_volume_r(offs_t offset);
void base_volume_w(offs_t offset, u16 data);
u16 freq_r(offs_t offset);
void freq_w(offs_t offset, u16 data);
u16 pre_size_h_r(offs_t offset);
u16 pre_size_l_r(offs_t offset);
void pre_size_h_w(offs_t offset, u16 data);
void pre_size_l_w(offs_t offset, u16 data);
u16 post_size_h_r(offs_t offset);
u16 post_size_l_r(offs_t offset);
void post_size_h_w(offs_t offset, u16 data);
void post_size_l_w(offs_t offset, u16 data);
u16 address_h_r(offs_t offset);
u16 address_l_r(offs_t offset);
void address_h_w(offs_t offset, u16 data);
void address_l_w(offs_t offset, u16 data);
u16 sample_start_h_r(offs_t offset);
u16 sample_start_l_r(offs_t offset);
void sample_start_h_w(offs_t offset, u16 data);
void sample_start_l_w(offs_t offset, u16 data);
u16 sample_end_h_r(offs_t offset);
u16 sample_end_l_r(offs_t offset);
void sample_end_h_w(offs_t offset, u16 data);
void sample_end_l_w(offs_t offset, u16 data);
u16 sample_address_h_r(offs_t offset);
u16 sample_address_l_r(offs_t offset);
void sample_address_h_w(offs_t offset, u16 data);
void sample_address_l_w(offs_t offset, u16 data);
u16 pitch_r(offs_t offset);
void pitch_w(offs_t offset, u16 data);
u16 pan_r(offs_t offset);
void pan_w(offs_t offset, u16 data);
u16 dry_rev_r(offs_t offset);
void dry_rev_w(offs_t offset, u16 data);
u16 cho_var_r(offs_t offset);
void cho_var_w(offs_t offset, u16 data);
u16 internal_adr_r();
void internal_adr_w(u16 data);
u16 internal_r();
@ -114,19 +146,26 @@ private:
template<int sel> void routing_w(offs_t offset, u16 data);
// Envelope control
void change_mode(int channel, u8 mode);
void change_mode_attack_decay1(int chan);
void change_mode_decay1_decay2(int chan);
static bool istep(s32 &value, s32 limit, s32 step);
static bool fpstep(s32 &value, s32 limit, s32 step);
static s32 fpadd(s32 value, s32 step);
static s32 fpsub(s32 value, s32 step);
static s32 fpapply(s32 value, s32 sample);
static s32 lpffpapply(s32 value, s32 sample);
// Control registers
template<int sel> u16 keyon_mask_r();
template<int sel> void keyon_mask_w(u16 data);
u16 keyon_r();
void keyon_w(u16);
u16 prg_address_r();
void prg_address_w(u16 data);
template<int sel> u16 prg_r();
template<int sel> void prg_w(u16 data);
template<int sel> u16 map_r();
template<int sel> void map_w(u16 data);
u16 meg_prg_address_r();
void meg_prg_address_w(u16 data);
template<int sel> u16 meg_prg_r();
template<int sel> void meg_prg_w(u16 data);
template<int sel> u16 meg_map_r();
template<int sel> void meg_map_w(u16 data);
template<int sel> void waverom_adr_w(u16 data);
template<int sel> u16 waverom_adr_r();
template<int sel> void waverom_mode_w(u16 data);
@ -137,13 +176,18 @@ private:
template<int sel> u16 waverom_val_r();
// MEG registers
template<int sel> u16 prg_fp_r(offs_t offset);
template<int sel> void prg_fp_w(offs_t offset, u16 data);
template<int sel> u16 prg_off_r(offs_t offset);
template<int sel> void prg_off_w(offs_t offset, u16 data);
template<int sel> u16 prg_lfo_r(offs_t offset);
template<int sel> void prg_lfo_w(offs_t offset, u16 data);
template<int sel> u16 meg_const_r(offs_t offset);
template<int sel> void meg_const_w(offs_t offset, u16 data);
template<int sel> u16 meg_offset_r(offs_t offset);
template<int sel> void meg_offset_w(offs_t offset, u16 data);
template<int sel> u16 meg_lfo_r(offs_t offset);
template<int sel> void meg_lfo_w(offs_t offset, u16 data);
void meg_prg_map(address_map &map);
u64 meg_prg_map_r(offs_t address);
virtual u16 swp30d_const_r(u16 address) const override;
virtual u16 swp30d_offset_r(u16 address) const override;
// Generic catch-all
u16 snd_r(offs_t offset);

View File

@ -0,0 +1,124 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
// Yamaha SWP30 - Multiple effects generator subpart
//
// Audio dsp dedicated to effects generation
//
// Disassembler
#include "emu.h"
#include "swp30d.h"
swp30_disassembler::swp30_disassembler(info *inf) : m_info(inf)
{
}
u32 swp30_disassembler::opcode_alignment() const
{
return 1;
}
std::string swp30_disassembler::gconst(offs_t address) const
{
if(!m_info)
return util::string_format("c%03x", address);
s16 value = m_info->swp30d_const_r(address);
return util::string_format("%g", value / 16384.0);
}
std::string swp30_disassembler::goffset(offs_t address) const
{
return m_info ? util::string_format("%x", m_info->swp30d_offset_r(address)) : util::string_format("of%02x", address);
}
u32 swp30_disassembler::b(u64 opc, u32 start, u32 count)
{
return (opc >> start) & ((1 << count) - 1);
}
void swp30_disassembler::append(std::string &r, const std::string &e)
{
if(r != "")
r += " ; ";
r += e;
}
// 33333333 33333333 22222222 22222222 11111111 11111111 00000000 00000000
// fedcba98 76543210 fedcba98 76543210 fedcba98 76543210 fedcba98 76543210
// 66665555 55555544 44444444 33333333 33222222 22221111 11111100 00000000
// 32109876 54321098 76543210 98765432 10987654 32109876 54321098 76543210
// XLB----- -rrrrrrr rxlmmmmm m-MM---- -P-----* -----Arr rrrrrrmm mmmm----
// m = low is read port, high is write port, memory register
// r = low is read port, high is high port, rotating register
// X = used for lo-fi variation only
// L = lfo read for memory offset
// * = compute mul
// A = mul input = m or r
// P = P sent for register write
// B = register write to mbuf
// M = memory mode, none/read/write/read+1
// x = 0 register write to memory, 1 to rotating
// l = 0 = lfo sent for register write
offs_t swp30_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params)
{
u64 opc = opcodes.r64(pc);
std::string r;
if(b(opc, 62, 1))
append(r, util::string_format("lfo.%02x", pc >> 4));
if(b(opc, 23, 1))
switch(b(opc, 24, 2)) {
case 0:
if(b(opc, 18, 1))
append(r, util::string_format("p += %s*m%02x", gconst(pc), b(opc, 4, 6)));
else
append(r, util::string_format("p += %s*r%02x", gconst(pc), b(opc, 10, 8)));
break;
case 1:
append(r, util::string_format("p = %s*(r%02x+m%02x)", gconst(pc), b(opc, 10, 8), b(opc, 4, 6)));
break;
case 2:
append(r, util::string_format("p ?= %s*(r%02x+m%02x)", gconst(pc), b(opc, 10, 8), b(opc, 4, 6)));
break;
case 3:
if(b(opc, 18, 1))
append(r, util::string_format("p = %s*m%02x", gconst(pc), b(opc, 4, 6)));
else
append(r, util::string_format("p = %s*r%02x", gconst(pc), b(opc, 10, 8)));
break;
}
std::string source;
if(b(opc, 30, 1))
source = "p";
else if(!b(opc, 45, 1))
source = util::string_format("lfo.%02x", pc >> 4);
if(!source.empty()) {
if(b(opc, 61, 1))
append(r, util::string_format("mb = %s", source));
else if(b(opc, 46, 1) == 1)
append(r, util::string_format("m%02x = %s", b(opc, 39, 6), source));
else
append(r, util::string_format("r%02x = %s", b(opc, 47, 8), source));
}
u32 memmode = b(opc, 36, 2);
if(memmode) {
static const char *modes[4] = { nullptr, "w", "r", "rr" };
append(r, util::string_format("mem_%s %x +%s", modes[memmode], b(opc, 33, 3), goffset(pc/3)));
r += util::string_format("-> m%02x", b(opcodes.r64(pc+2), 39, 6));
}
stream << r;
return 1 | SUPPORTED;
}

View File

@ -1,27 +1,27 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
// Yamaha MEG - Multiple effects generator
// Yamaha SWP30 - Multiple effects generator subpart
//
// Audio dsp dedicated to effects generation
//
// Disassembler
#ifndef DEVICES_SOUND_MEGD_H
#define DEVICES_SOUND_MEGD_H
#ifndef DEVICES_SOUND_SWP30D_H
#define DEVICES_SOUND_SWP30D_H
#pragma once
class meg_disassembler : public util::disasm_interface
class swp30_disassembler : public util::disasm_interface
{
public:
class info {
public:
virtual u16 fp_r(u16 address) const = 0;
virtual u16 offset_r(u16 address) const = 0;
virtual u16 swp30d_const_r(u16 address) const = 0;
virtual u16 swp30d_offset_r(u16 address) const = 0;
};
meg_disassembler(info *inf = nullptr);
swp30_disassembler(info *inf = nullptr);
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;
@ -29,7 +29,7 @@ public:
private:
info *m_info;
std::string gfp(offs_t address) const;
std::string gconst(offs_t address) const;
std::string goffset(offs_t address) const;
static inline u32 b(u64 opc, u32 start, u32 count);

View File

@ -65,15 +65,15 @@ void xt446_device::xt446_map(address_map &map)
void xt446_device::swp30_map(address_map &map)
{
map(0x000000*4, 0x200000*4-1).rom().region("swp30", 0).mirror(4*0x200000);
map(0x400000*4, 0x500000*4-1).rom().region("swp30", 0x800000).mirror(4*0x300000);
map(0x800000*4, 0xa00000*4-1).rom().region("swp30", 0x1000000).mirror(4*0x200000);
map(0x000000, 0x1fffff).rom().region("swp30", 0).mirror(0x200000);
map(0x400000, 0x4fffff).rom().region("swp30", 0x800000).mirror(0x300000);
map(0x800000, 0x9fffff).rom().region("swp30", 0x1000000).mirror(0x200000);
}
void xt446_device::device_add_mconfig(machine_config &config)
{
H8S2655(config, m_maincpu, 16_MHz_XTAL);
m_maincpu->set_addrmap(AS_PROGRAM, &xt446_device::xt446_map);
m_maincpu->set_addrmap(AS_DATA, &xt446_device::xt446_map);
m_maincpu->read_adc<0>().set_constant(0);
m_maincpu->read_adc<1>().set_constant(0);
m_maincpu->read_adc<2>().set_constant(0);

View File

@ -670,9 +670,9 @@ void mu100_state::pg_w(u16 data)
void mu100_state::swp30_map(address_map &map)
{
map(0x000000*4, 0x200000*4-1).rom().region("swp30", 0).mirror(4*0x200000);
map(0x400000*4, 0x500000*4-1).rom().region("swp30", 0x800000).mirror(4*0x300000);
map(0x800000*4, 0xa00000*4-1).rom().region("swp30", 0x1000000).mirror(4*0x200000);
map(0x000000, 0x1fffff).rom().region("swp30", 0).mirror(0x200000);
map(0x400000, 0x4fffff).rom().region("swp30", 0x800000).mirror(0x300000);
map(0x800000, 0x9fffff).rom().region("swp30", 0x1000000).mirror(0x200000);
}
void mu100_state::mu100(machine_config &config)
@ -705,7 +705,7 @@ void mu100_state::mu100(machine_config &config)
SPEAKER(config, "rspeaker").front_right();
SWP30(config, m_swp30);
m_swp30->set_addrmap(0, &mu100_state::swp30_map);
m_swp30->set_addrmap(AS_DATA, &mu100_state::swp30_map);
m_swp30->add_route(0, "lspeaker", 1.0);
m_swp30->add_route(1, "rspeaker", 1.0);
@ -734,7 +734,7 @@ ROM_START( mu100 )
ROM_SYSTEM_BIOS( 2, "bios2", "xt714e0 (v1.03, Jul. 25, 1997)" )
ROM_LOAD16_WORD_SWAP_BIOS( 2, "xt714e0.ic11", 0x000000, 0x200000, CRC(2d8cf9fc) SHA1(a81f988a315efe92106f1e7d407cd3626c4f843f) )
ROM_REGION( 0x1800000, "swp30", ROMREGION_ERASE00 )
ROM_REGION32_LE( 0x1800000, "swp30", ROMREGION_ERASE00 )
ROM_LOAD32_WORD( "sx518b0.ic34", 0x0000000, 0x400000, CRC(2550d44f) SHA1(fd3cce228c7d389a2fde25c808a5b26080588cba) )
ROM_LOAD32_WORD( "sx743b0.ic35", 0x0000002, 0x400000, CRC(a9109a6c) SHA1(a67bb49378a38a2d809bd717d286e18bc6496db0) )
ROM_LOAD32_WORD( "xt445a0-828.ic36", 0x0800000, 0x200000, CRC(225c2280) SHA1(23b5e046fd2e2ac01af3e6dc6357c5c6547b286b) )
@ -753,7 +753,7 @@ ROM_START( mu100r )
ROM_SYSTEM_BIOS( 2, "bios2", "xt714e0 (v1.03, Jul. 25, 1997)" )
ROM_LOAD16_WORD_SWAP_BIOS( 2, "xt714e0.ic11", 0x000000, 0x200000, CRC(2d8cf9fc) SHA1(a81f988a315efe92106f1e7d407cd3626c4f843f) )
ROM_REGION( 0x1800000, "swp30", ROMREGION_ERASE00 )
ROM_REGION32_LE( 0x1800000, "swp30", ROMREGION_ERASE00 )
ROM_LOAD32_WORD( "sx518b0.ic34", 0x000000, 0x400000, CRC(2550d44f) SHA1(fd3cce228c7d389a2fde25c808a5b26080588cba) )
ROM_LOAD32_WORD( "sx743b0.ic35", 0x000002, 0x400000, CRC(a9109a6c) SHA1(a67bb49378a38a2d809bd717d286e18bc6496db0) )
ROM_LOAD32_WORD( "xt445a0-828.ic36", 0x800000, 0x200000, CRC(225c2280) SHA1(23b5e046fd2e2ac01af3e6dc6357c5c6547b286b) )
@ -767,7 +767,7 @@ ROM_START( mu100b )
// MU-100B v1.08 (Nov. 28, 1997)
ROM_LOAD16_WORD_SWAP( "xu50710-m27c160.bin", 0x000000, 0x200000, CRC(4b10bd27) SHA1(12d7c6e1bce7974b34916e1bfa5057ab55867476) )
ROM_REGION( 0x1800000, "swp30", ROMREGION_ERASE00 )
ROM_REGION32_LE( 0x1800000, "swp30", ROMREGION_ERASE00 )
ROM_LOAD32_WORD( "sx518b0.ic34", 0x0000000, 0x400000, CRC(2550d44f) SHA1(fd3cce228c7d389a2fde25c808a5b26080588cba) )
ROM_LOAD32_WORD( "sx743b0.ic35", 0x0000002, 0x400000, CRC(a9109a6c) SHA1(a67bb49378a38a2d809bd717d286e18bc6496db0) )
ROM_LOAD32_WORD( "xt445a0-828.ic36", 0x0800000, 0x200000, CRC(225c2280) SHA1(23b5e046fd2e2ac01af3e6dc6357c5c6547b286b) )