mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
ymmu100: Start adding the MEG [O. Galibert]
This commit is contained in:
parent
57cb0af3f0
commit
b445d10135
@ -2818,3 +2818,20 @@ if (CPUS["HPC"]~=null or _OPTIONS["with-tools"]) then
|
||||
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/hpc/hpcdasm.cpp")
|
||||
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/hpc/hpcdasm.h")
|
||||
end
|
||||
|
||||
--------------------------------------------------
|
||||
-- Yamaha Multiple Effects Generator
|
||||
--@src/devices/sound/meg.h,CPUS["MEG"] = true
|
||||
--------------------------------------------------
|
||||
|
||||
if (CPUS["MEG"]~=null) then
|
||||
files {
|
||||
MAME_DIR .. "src/devices/sound/meg.cpp",
|
||||
MAME_DIR .. "src/devices/sound/meg.h",
|
||||
}
|
||||
end
|
||||
|
||||
if (CPUS["MEG"]~=null or _OPTIONS["with-tools"]) then
|
||||
table.insert(disasm_files , MAME_DIR .. "src/devices/sound/megd.cpp")
|
||||
table.insert(disasm_files , MAME_DIR .. "src/devices/sound/megd.h")
|
||||
end
|
||||
|
@ -139,6 +139,7 @@ CPUS["CAPRICORN"] = true
|
||||
CPUS["ALPHA"] = true
|
||||
--CPUS["DSPP"] = true
|
||||
CPUS["HPC"] = true
|
||||
CPUS["MEG"] = true
|
||||
|
||||
--------------------------------------------------
|
||||
-- specify available sound cores; some of these are
|
||||
|
384
src/devices/sound/meg.cpp
Normal file
384
src/devices/sound/meg.cpp
Normal file
@ -0,0 +1,384 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// Yamaha MEG - Multiple effects generator
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t meg_base_device::execute_max_cycles() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t meg_base_device::execute_input_lines() const
|
||||
{
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// vl70:
|
||||
// 6d1e: write 1, r0l
|
||||
// 6d26: write 2, r0l
|
||||
// 6d2e: read 2
|
||||
// 6d36: write 3, r0l
|
||||
// 6d3e: write reg 4:r0h, r0l
|
||||
// 6d52: write reg 5:r0h, r0l-1
|
||||
// 6d68: write 7, r0l
|
||||
// 6d70: write reg 8:r0h, r0l
|
||||
// 6d84: write reg 9:r0h, r0l
|
||||
// 6dac: write a, r0l
|
||||
// 6db4: write reg cd:r1l, r0
|
||||
// 6dd4: write reg e:r0h, r0l
|
||||
// 6dee: write reg f:r0h, r0l
|
||||
// 6e08: read 10,11
|
||||
// 6e1c: write reg 1213:r1l, r0
|
||||
// 6e3c: write reg 14:r0h, r0l
|
||||
// 6e50: write 15, r0l
|
||||
// 6e58: write reg 16:r0h, r0l
|
||||
// 6e6c: write reg 17:r0h, r0l
|
||||
// 6e80: write reg 18:e0h, e0l
|
||||
|
||||
void meg_device::map(address_map &map)
|
||||
{
|
||||
map(0x00, 0x00).w(FUNC(meg_device::select_w));
|
||||
map(0x01, 0x01).w(FUNC(meg_device::s1_w));
|
||||
map(0x02, 0x02).rw(FUNC(meg_device::s2_r), FUNC(meg_device::s2_w));
|
||||
map(0x03, 0x03).w(FUNC(meg_device::s3_w));
|
||||
map(0x04, 0x04).w(FUNC(meg_device::s4_w));
|
||||
map(0x05, 0x05).w(FUNC(meg_device::s5_w));
|
||||
map(0x07, 0x07).w(FUNC(meg_device::s7_w));
|
||||
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(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));
|
||||
map(0x11, 0x11).r(FUNC(meg_device::s11_r));
|
||||
map(0x12, 0x12).w(FUNC(meg_device::offseth_w));
|
||||
map(0x13, 0x13).w(FUNC(meg_device::offsetl_w));
|
||||
map(0x14, 0x14).w(FUNC(meg_device::s14_w));
|
||||
map(0x15, 0x15).w(FUNC(meg_device::s15_w));
|
||||
map(0x16, 0x16).w(FUNC(meg_device::s16_w));
|
||||
map(0x17, 0x17).w(FUNC(meg_device::s17_w));
|
||||
map(0x18, 0x18).w(FUNC(meg_device::s18_w));
|
||||
}
|
||||
|
||||
u8 meg_device::s2_r()
|
||||
{
|
||||
logerror("read r2 %s\n", machine().describe_context());
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
void meg_device::select_w(u8 data)
|
||||
{
|
||||
m_reg = data;
|
||||
}
|
||||
|
||||
void meg_device::s1_w(u8 data)
|
||||
{
|
||||
logerror("r1 %02x %s\n", data, machine().describe_context());
|
||||
}
|
||||
|
||||
void meg_device::s2_w(u8 data)
|
||||
{
|
||||
logerror("r2 %02x %s\n", data, machine().describe_context());
|
||||
}
|
||||
|
||||
void meg_device::s3_w(u8 data)
|
||||
{
|
||||
logerror("r3 %02x %s\n", data, machine().describe_context());
|
||||
}
|
||||
|
||||
void meg_device::s4_w(u8 data)
|
||||
{
|
||||
if(m_r4[m_reg] != data) {
|
||||
m_r4[m_reg] = data;
|
||||
logerror("r4[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
|
||||
}
|
||||
}
|
||||
|
||||
void meg_device::s5_w(u8 data)
|
||||
{
|
||||
if(m_r5[m_reg] != data) {
|
||||
m_r5[m_reg] = data;
|
||||
logerror("r5[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
|
||||
}
|
||||
}
|
||||
|
||||
void meg_device::s7_w(u8 data)
|
||||
{
|
||||
logerror("r7 %02x %s\n", data, machine().describe_context());
|
||||
}
|
||||
|
||||
void meg_device::s8_w(u8 data)
|
||||
{
|
||||
if(m_r8[m_reg] != data) {
|
||||
m_r8[m_reg] = data;
|
||||
logerror("r8[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void meg_device::s9_w(u8 data)
|
||||
{
|
||||
if(m_r9[m_reg] != data) {
|
||||
m_r9[m_reg] = data;
|
||||
logerror("r9[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
|
||||
}
|
||||
}
|
||||
|
||||
void meg_device::sa_w(u8 data)
|
||||
{
|
||||
logerror("ra %02x %s\n", data, machine().describe_context());
|
||||
}
|
||||
|
||||
void meg_device::fph_w(u8 data)
|
||||
{
|
||||
fp_w(m_reg, (fp_r(m_reg) & 0x00ff) | (data << 8));
|
||||
}
|
||||
|
||||
|
||||
void meg_device::fpl_w(u8 data)
|
||||
{
|
||||
fp_w(m_reg, (fp_r(m_reg) & 0xff00) | data);
|
||||
}
|
||||
|
||||
void meg_device::se_w(u8 data)
|
||||
{
|
||||
if(m_re[m_reg] != data) {
|
||||
m_re[m_reg] = data;
|
||||
logerror("re[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void meg_device::sf_w(u8 data)
|
||||
{
|
||||
if(m_rf[m_reg] != data) {
|
||||
m_rf[m_reg] = data;
|
||||
logerror("rf[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
|
||||
}
|
||||
}
|
||||
|
||||
u8 meg_device::s10_r()
|
||||
{
|
||||
logerror("read r10 %s\n", machine().describe_context());
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
u8 meg_device::s11_r()
|
||||
{
|
||||
logerror("read r11 %s\n", machine().describe_context());
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
void meg_device::offseth_w(u8 data)
|
||||
{
|
||||
offset_w(m_reg, (offset_r(m_reg) & 0x00ff) | (data << 8));
|
||||
}
|
||||
|
||||
void meg_device::offsetl_w(u8 data)
|
||||
{
|
||||
offset_w(m_reg, (offset_r(m_reg) & 0xff00) | data);
|
||||
}
|
||||
|
||||
void meg_device::s14_w(u8 data)
|
||||
{
|
||||
if(m_r14[m_reg] != data) {
|
||||
m_r14[m_reg] = data;
|
||||
logerror("r14[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
|
||||
}
|
||||
}
|
||||
|
||||
void meg_device::s15_w(u8 data)
|
||||
{
|
||||
logerror("r15 %02x %s\n", data, machine().describe_context());
|
||||
}
|
||||
|
||||
void meg_device::s16_w(u8 data)
|
||||
{
|
||||
if(m_r16[m_reg] != data) {
|
||||
m_r16[m_reg] = data;
|
||||
logerror("r16[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
|
||||
}
|
||||
}
|
||||
|
||||
void meg_device::s17_w(u8 data)
|
||||
{
|
||||
if(m_r17[m_reg] != data) {
|
||||
m_r17[m_reg] = data;
|
||||
logerror("r17[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
|
||||
}
|
||||
}
|
||||
|
||||
void meg_device::s18_w(u8 data)
|
||||
{
|
||||
if(m_r18[m_reg] != data) {
|
||||
m_r18[m_reg] = data;
|
||||
logerror("r18[%02x] = %02x %s\n", m_reg, data, machine().describe_context());
|
||||
}
|
||||
}
|
122
src/devices/sound/meg.h
Normal file
122
src/devices/sound/meg.h
Normal file
@ -0,0 +1,122 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// Yamaha MEG - Multiple effects generator
|
||||
//
|
||||
// Audio dsp dedicated to effects generation
|
||||
|
||||
#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 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;
|
||||
|
||||
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
|
||||
{
|
||||
public:
|
||||
meg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 44100*256);
|
||||
void map(address_map &map);
|
||||
|
||||
private:
|
||||
u8 m_r4[256];
|
||||
u8 m_r5[256];
|
||||
u8 m_r8[256];
|
||||
u8 m_r9[256];
|
||||
u8 m_re[256];
|
||||
u8 m_rf[256];
|
||||
u8 m_r12[256];
|
||||
u8 m_r13[256];
|
||||
u8 m_r14[256];
|
||||
u8 m_r16[256];
|
||||
u8 m_r17[256];
|
||||
u8 m_r18[256];
|
||||
u8 m_reg;
|
||||
u8 s2_r();
|
||||
u8 s10_r();
|
||||
u8 s11_r();
|
||||
void select_w(u8 reg);
|
||||
void s1_w(u8 data);
|
||||
void s2_w(u8 data);
|
||||
void s3_w(u8 data);
|
||||
void s4_w(u8 data);
|
||||
void s5_w(u8 data);
|
||||
void s7_w(u8 data);
|
||||
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 se_w(u8 data);
|
||||
void sf_w(u8 data);
|
||||
void s10_w(u8 data);
|
||||
void s11_w(u8 data);
|
||||
void offseth_w(u8 data);
|
||||
void offsetl_w(u8 data);
|
||||
void s14_w(u8 data);
|
||||
void s15_w(u8 data);
|
||||
void s16_w(u8 data);
|
||||
void s17_w(u8 data);
|
||||
void s18_w(u8 data);
|
||||
};
|
||||
|
||||
|
||||
DECLARE_DEVICE_TYPE(MEG, meg_device)
|
||||
DECLARE_DEVICE_TYPE(MEGEMB, meg_embedded_device)
|
||||
|
||||
#endif
|
118
src/devices/sound/megd.cpp
Normal file
118
src/devices/sound/megd.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
// 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, 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 ¶ms)
|
||||
{
|
||||
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;
|
||||
}
|
39
src/devices/sound/megd.h
Normal file
39
src/devices/sound/megd.h
Normal file
@ -0,0 +1,39 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// Yamaha MEG - Multiple effects generator
|
||||
//
|
||||
// Audio dsp dedicated to effects generation
|
||||
//
|
||||
// Disassembler
|
||||
|
||||
#ifndef DEVICES_SOUND_MEGD_H
|
||||
#define DEVICES_SOUND_MEGD_H
|
||||
|
||||
#pragma once
|
||||
|
||||
class meg_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;
|
||||
};
|
||||
|
||||
meg_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 ¶ms) override;
|
||||
|
||||
private:
|
||||
info *m_info;
|
||||
|
||||
std::string gfp(offs_t address) const;
|
||||
std::string goffset(offs_t address) const;
|
||||
|
||||
static inline u32 b(u64 opc, u32 start, u32 count);
|
||||
static inline void append(std::string &r, std::string e);
|
||||
};
|
||||
|
||||
#endif
|
@ -150,17 +150,23 @@ DEFINE_DEVICE_TYPE(SWP30, swp30_device, "swp30", "Yamaha SWP30 sound chip")
|
||||
swp30_device::swp30_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, SWP30, tag, owner, clock),
|
||||
device_sound_interface(mconfig, *this),
|
||||
device_rom_interface(mconfig, *this, 25+2, ENDIANNESS_LITTLE, 32)
|
||||
device_rom_interface(mconfig, *this, 25+2, ENDIANNESS_LITTLE, 32),
|
||||
m_meg(*this, "meg")
|
||||
{
|
||||
}
|
||||
|
||||
void swp30_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
MEGEMB(config, m_meg);
|
||||
}
|
||||
|
||||
void swp30_device::device_start()
|
||||
{
|
||||
m_stream = stream_alloc(0, 2, 44100);
|
||||
|
||||
// Attenuantion for panning is 4.4 floating point. That means 0
|
||||
// to -96.3dB. Since it's a nice range, we assume it's the same
|
||||
// for other attenuation values. Computed value is is 1.16
|
||||
// for other attenuation values. Computed value is 1.16
|
||||
// format, to avoid overflow
|
||||
|
||||
for(int i=0; i<256; i++)
|
||||
@ -328,8 +334,8 @@ void swp30_device::map(address_map &map)
|
||||
rchan(map, 0x27).rw(FUNC(swp30_device::prg_fp_r<3>), FUNC(swp30_device::prg_fp_w<3>));
|
||||
rchan(map, 0x29).rw(FUNC(swp30_device::prg_fp_r<4>), FUNC(swp30_device::prg_fp_w<4>));
|
||||
rchan(map, 0x2b).rw(FUNC(swp30_device::prg_fp_r<5>), FUNC(swp30_device::prg_fp_w<5>));
|
||||
rchan(map, 0x30).rw(FUNC(swp30_device::prg_int_r<0>), FUNC(swp30_device::prg_int_w<0>));
|
||||
rchan(map, 0x31).rw(FUNC(swp30_device::prg_int_r<1>), FUNC(swp30_device::prg_int_w<1>));
|
||||
rchan(map, 0x30).rw(FUNC(swp30_device::prg_off_r<0>), FUNC(swp30_device::prg_off_w<0>));
|
||||
rchan(map, 0x31).rw(FUNC(swp30_device::prg_off_r<1>), FUNC(swp30_device::prg_off_w<1>));
|
||||
rchan(map, 0x3e).rw(FUNC(swp30_device::prg_lfo_r<0>), FUNC(swp30_device::prg_lfo_w<0>));
|
||||
rchan(map, 0x3f).rw(FUNC(swp30_device::prg_lfo_r<1>), FUNC(swp30_device::prg_lfo_w<1>));
|
||||
}
|
||||
@ -381,14 +387,14 @@ void swp30_device::prg_address_w(u16 data)
|
||||
template<int sel> u16 swp30_device::prg_r()
|
||||
{
|
||||
constexpr offs_t shift = 48-16*sel;
|
||||
return m_program[m_program_address] >> shift;
|
||||
return m_meg->prg_r(m_program_address) >> shift;
|
||||
}
|
||||
|
||||
template<int sel> void swp30_device::prg_w(u16 data)
|
||||
{
|
||||
constexpr offs_t shift = 48-16*sel;
|
||||
constexpr u64 mask = ~(u64(0xffff) << shift);
|
||||
m_program[m_program_address] = (m_program[m_program_address] & mask) | (u64(data) << shift);
|
||||
m_meg->prg_w(m_program_address, (m_meg->prg_r(m_program_address) & mask) | (u64(data) << shift));
|
||||
|
||||
if(sel == 3) {
|
||||
if(0)
|
||||
@ -402,14 +408,12 @@ template<int sel> void swp30_device::prg_w(u16 data)
|
||||
|
||||
template<int sel> u16 swp30_device::map_r()
|
||||
{
|
||||
return m_map[sel];
|
||||
return m_meg->map_r(sel);
|
||||
}
|
||||
|
||||
template<int sel> void swp30_device::map_w(u16 data)
|
||||
{
|
||||
m_map[sel] = data;
|
||||
if(0)
|
||||
logerror("map %d: type=%02x offset=%05x size=%05x\n", sel, data >> 11, (data & 0xff) << 10, 0x400 << ((data >> 8) & 7));
|
||||
m_meg->map_w(sel, data);
|
||||
}
|
||||
|
||||
|
||||
@ -656,54 +660,36 @@ void swp30_device::address_l_w(offs_t offset, u16 data)
|
||||
}
|
||||
|
||||
|
||||
// MEG registers (Multiple Effects Generator)
|
||||
// MEG registers forwarding
|
||||
|
||||
template<int sel> u16 swp30_device::prg_fp_r(offs_t offset)
|
||||
{
|
||||
offs_t adr = (offset >> 6)*6 + sel;
|
||||
return m_program_pfp[adr];
|
||||
return m_meg->fp_r((offset >> 6)*6 + sel);
|
||||
}
|
||||
|
||||
template<int sel> void swp30_device::prg_fp_w(offs_t offset, u16 data)
|
||||
{
|
||||
offs_t adr = (offset >> 6)*6 + sel;
|
||||
m_program_pfp[adr] = data;
|
||||
if(0)
|
||||
logerror("prg_fp_w %03x, %04x\n", adr, data);
|
||||
m_meg->fp_w((offset >> 6)*6 + sel, data);
|
||||
}
|
||||
|
||||
template<int sel> u16 swp30_device::prg_int_r(offs_t offset)
|
||||
template<int sel> u16 swp30_device::prg_off_r(offs_t offset)
|
||||
{
|
||||
offs_t adr = (offset >> 6)*2 + sel;
|
||||
return m_program_pint[adr];
|
||||
return m_meg->offset_r((offset >> 6)*2 + sel);
|
||||
}
|
||||
|
||||
template<int sel> void swp30_device::prg_int_w(offs_t offset, u16 data)
|
||||
template<int sel> void swp30_device::prg_off_w(offs_t offset, u16 data)
|
||||
{
|
||||
offs_t adr = (offset >> 6)*2 + sel;
|
||||
m_program_pint[adr] = data;
|
||||
if(0)
|
||||
logerror("prg_int_w %02x, %04x\n", adr, data);
|
||||
m_meg->offset_w((offset >> 6)*2 + sel, data);
|
||||
}
|
||||
|
||||
template<int sel> u16 swp30_device::prg_lfo_r(offs_t offset)
|
||||
{
|
||||
offs_t adr = (offset >> 6)*2 + sel;
|
||||
return m_program_plfo[adr];
|
||||
return m_meg->lfo_r((offset >> 6)*2 + sel);
|
||||
}
|
||||
|
||||
template<int sel> void swp30_device::prg_lfo_w(offs_t offset, u16 data)
|
||||
{
|
||||
offs_t adr = (offset >> 6)*2 + sel;
|
||||
m_program_plfo[adr] = data;
|
||||
|
||||
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 = (data >> 5) & 7;
|
||||
int step = ((data & 31) << sh[scale]) + dt[scale];
|
||||
if(0)
|
||||
logerror("prg_lfo_w %02x freq=%5.2f phase=%6.4f\n", adr, step * 44100.0/4194304, (data >> 8)/256.0);
|
||||
m_meg->lfo_w((offset >> 6)*2 + sel, data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "meg.h"
|
||||
|
||||
class swp30_device : public device_t, public device_sound_interface, public device_rom_interface
|
||||
{
|
||||
public:
|
||||
@ -20,8 +22,11 @@ protected:
|
||||
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;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
private:
|
||||
required_device<meg_embedded_device> m_meg;
|
||||
|
||||
sound_stream *m_stream;
|
||||
|
||||
s32 m_sample_increment[0x4000];
|
||||
@ -99,8 +104,8 @@ private:
|
||||
// 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_int_r(offs_t offset);
|
||||
template<int sel> void prg_int_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);
|
||||
|
||||
|
@ -136,6 +136,7 @@
|
||||
#include "cpu/h8/h8s2655.h"
|
||||
#include "video/hd44780.h"
|
||||
#include "sound/swp30.h"
|
||||
#include "sound/meg.h"
|
||||
|
||||
#include "debugger.h"
|
||||
#include "screen.h"
|
||||
@ -199,6 +200,7 @@ public:
|
||||
, m_mu80cpu(*this, "mu80cpu")
|
||||
, m_vl70cpu(*this, "vl70cpu")
|
||||
, m_swp30(*this, "swp30")
|
||||
, m_meg(*this, "meg")
|
||||
, m_lcd(*this, "lcd")
|
||||
, m_ioport_p7(*this, "P7")
|
||||
, m_ioport_p8(*this, "P8")
|
||||
@ -316,6 +318,7 @@ private:
|
||||
optional_device<h83002_device> m_mu80cpu;
|
||||
optional_device<h83003_device> m_vl70cpu;
|
||||
optional_device<swp30_device> m_swp30;
|
||||
optional_device<meg_device> m_meg;
|
||||
required_device<hd44780_device> m_lcd;
|
||||
optional_ioport m_ioport_p7;
|
||||
optional_ioport m_ioport_p8;
|
||||
@ -597,12 +600,14 @@ void mu100_state::mu80_map(address_map &map)
|
||||
{
|
||||
map(0x000000, 0x07ffff).rom().region("mu80cpu", 0);
|
||||
map(0x200000, 0x20ffff).ram(); // 64K work RAM
|
||||
map(0x440000, 0x44001f).m(m_meg, FUNC(meg_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(0x600000, 0x60001f).m(m_meg, FUNC(meg_device::map));
|
||||
}
|
||||
|
||||
void mu100_state::mu100_map(address_map &map)
|
||||
@ -991,6 +996,8 @@ void mu100_state::mu80(machine_config &config)
|
||||
m_swp30->add_route(0, "lspeaker", 1.0);
|
||||
m_swp30->add_route(1, "rspeaker", 1.0);
|
||||
|
||||
MEG(config, m_meg);
|
||||
|
||||
auto &mdin_a(MIDI_PORT(config, "mdin_a"));
|
||||
midiin_slot(mdin_a);
|
||||
mdin_a.rxd_handler().set("mu80cpu:sci1", FUNC(h8_sci_device::rx_w));
|
||||
@ -1023,6 +1030,8 @@ void mu100_state::vl70(machine_config &config)
|
||||
SPEAKER(config, "lspeaker").front_left();
|
||||
SPEAKER(config, "rspeaker").front_right();
|
||||
|
||||
MEG(config, m_meg);
|
||||
|
||||
auto &mdin_a(MIDI_PORT(config, "mdin_a"));
|
||||
midiin_slot(mdin_a);
|
||||
mdin_a.rxd_handler().set("vl70cpu:sci1", FUNC(h8_sci_device::rx_w));
|
||||
|
Loading…
Reference in New Issue
Block a user