Skip to content

Commit

Permalink
vl1: Add a lot of stuff. Need to find where the MIDI data error is co…
Browse files Browse the repository at this point in the history
…ming from though
  • Loading branch information
galibert committed Feb 19, 2024
1 parent 4db4b80 commit 2f69fdf
Show file tree
Hide file tree
Showing 6 changed files with 264 additions and 65 deletions.
4 changes: 2 additions & 2 deletions src/devices/cpu/m68000/tmp68301.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ void tmp68301_device::pmr_w(u8 data)

u16 tmp68301_device::pdr_r()
{
if(m_parallel_mode == 0) {
if(m_parallel_mode == 0 || m_parallel_mode == 1) {
if(m_pdir == 0xffff)
return m_pdr;
return (m_pdr & m_pdir) | (m_parallel_r_cb() & ~m_pdir);
Expand All @@ -704,7 +704,7 @@ void tmp68301_device::pdr_w(offs_t, u16 data, u16 mem_mask)
if(m_pdr == old)
return;
// logerror("parallel data %04x\n", m_pdr);
if(m_parallel_mode == 0) {
if(m_parallel_mode == 0 || m_parallel_mode == 1) {
if(m_pdir == 0x0000)
return;
m_parallel_w_cb(m_pdr & m_pdir);
Expand Down
9 changes: 8 additions & 1 deletion src/devices/cpu/sh/sh7042.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,14 @@ void sh7042_device::adcsr_w(u8 data)

void sh7042_device::adcr_w(u8 data)
{
logerror("adcr_w %02x\n", data);
static const char *const tg_modes[4] = { "soft", "mtu", "?", "external" };
static const char *const buf_modes[4] = { "normal", "a->b", "a,b->c,d", "a->b->c->d" };
logerror("adcr_w speed=%d trigger=%s mode=%s sampling=%s buffering=%s\n",
BIT(data, 6) ? "high" : "low",
tg_modes[(data >> 4) & 3],
BIT(data, 3) ? "scan" : "single",
BIT(data, 2) ? "simultaneous" : "normal",
buf_modes[data & 3]);
m_adcr = data;
}

Expand Down
86 changes: 53 additions & 33 deletions src/devices/sound/dspv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
#include "emu.h"
#include "dspv.h"

DEFINE_DEVICE_TYPE(DSPV, dspv_device, "dspv", "Yamaha DSPV audio simulation DSP (YSS217-F/")
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))
m_prg1_config("prg1", ENDIANNESS_BIG, 64, 8, -3, address_map_constructor(FUNC(dspv_device::prg1_map), this)),
m_prg2_config("prg2", ENDIANNESS_BIG, 64, 8, -3, address_map_constructor(FUNC(dspv_device::prg2_map), this)),
m_data_config("data", ENDIANNESS_BIG, 16, 32, -1, address_map_constructor(FUNC(dspv_device::data_map), this)),
m_prg1(*this, "prg1"),
m_prg2(*this, "prg2")
{
}

Expand All @@ -22,57 +25,74 @@ void dspv_device::map(address_map &map)

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));
map(0x12, 0x13).lw16(NAME([](u16 data) { }));
map(0x20, 0x21).w(FUNC(dspv_device::data_adrh_w));
map(0x22, 0x23).w(FUNC(dspv_device::data_adrl_w));
map(0x24, 0x25).w(FUNC(dspv_device::data_data_w));
map(0x26, 0x27).w(FUNC(dspv_device::data_zero_w));
map(0x38, 0x39).lr16(NAME([]() -> u16 { return 0; }));
map(0x40, 0x7f).rw(FUNC(dspv_device::prg_data_r), FUNC(dspv_device::prg_data_w));
}

void dspv_device::prg_map(address_map &map)
void dspv_device::prg1_map(address_map &map)
{
map(0x0000, 0xffff).ram();
map(0x00, 0xff).ram().share(m_prg1);
}

void dspv_device::prg2_map(address_map &map)
{
map(0x00, 0xff).ram().share(m_prg2);
}

void dspv_device::data_map(address_map &map)
{
map(0x0000, 0x3fff).ram();
map(0x00000, 0x03fff).ram();
map(0x1c000, 0x1dfff).ram();
}

void dspv_device::table_adrh_w(u16 data)
void dspv_device::data_adrh_w(u16 data)
{
m_table_adr = (m_table_adr & 0x0000ffff) | (data << 16);
m_data_adr = (m_data_adr & 0x0000ffff) | (data << 16);
}

void dspv_device::table_adrl_w(u16 data)
void dspv_device::data_adrl_w(u16 data)
{
m_table_adr = (m_table_adr & 0xffff0000) | data;
m_data_adr = (m_data_adr & 0xffff0000) | data;
}

void dspv_device::table_data_w(u16 data)
void dspv_device::data_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++;
m_data->write_word(m_data_adr, data);
m_data_adr++;
}

void dspv_device::table_zero_w(u16 data)
void dspv_device::data_zero_w(u16 data)
{
if(data)
logerror("table_zero_w %04x\n", data);
logerror("data_zero_w %04x\n", data);
}

void dspv_device::prg_adr_w(u16 data)
{
m_prg_adr = data;
u32 slot = BIT(data, 13, 3);
u32 len = BIT(data, 8, 5);
u32 address = BIT(data, 0, 8);
if(len == 0)
len = 0x20;
auto &prg = slot >= 4 ? m_prg2 : m_prg1;
u32 shift = (slot & 3)*16;
u64 mask = ~(u64(0xffff) << shift);
for(u32 i=0; i != len; i++)
prg[(i + address) & 0xff] = (prg[(i + address) & 0xff] & mask) | (u64(m_buffer[i]) << shift);
}

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);
m_buffer[offset] = data;
}

u16 dspv_device::prg_data_r(offs_t offset)
{
return m_buffer[offset];
}

u16 dspv_device::status_r()
Expand Down Expand Up @@ -100,7 +120,6 @@ void dspv_device::sound_stream_update(sound_stream &stream, std::vector<read_str

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();
Expand All @@ -110,16 +129,16 @@ void dspv_device::device_start()

save_item(NAME(m_pc));
save_item(NAME(m_status));
save_item(NAME(m_table_adr));
save_item(NAME(m_prg_adr));
save_item(NAME(m_data_adr));
save_item(NAME(m_buffer));
}

void dspv_device::device_reset()
{
m_pc = 0;
m_status = 0;
m_table_adr = 0;
m_prg_adr = 0;
m_data_adr = 0;
std::fill(m_buffer.begin(), m_buffer.end(), 0);
}

uint32_t dspv_device::execute_min_cycles() const noexcept
Expand Down Expand Up @@ -147,7 +166,8 @@ void dspv_device::execute_run()
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_OPCODES, &m_prg1_config),
std::make_pair(AS_PROGRAM, &m_prg2_config),
std::make_pair(AS_DATA, &m_data_config)
};
}
Expand Down
25 changes: 15 additions & 10 deletions src/devices/sound/dspv.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,29 @@ class dspv_device : public cpu_device, public device_sound_interface
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;

private:
address_space_config m_program_config, m_data_config;
address_space *m_program, *m_data;
address_space_config m_prg1_config, m_prg2_config, m_data_config;
address_space *m_data;

required_shared_ptr<u64> m_prg1, m_prg2;

std::array<u16, 0x20> m_buffer;

u32 m_pc;
int m_icount;

u32 m_table_adr;
u16 m_prg_adr;
u32 m_data_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);
// Data ram access
void data_adrh_w(u16 data);
void data_adrl_w(u16 data);
void data_data_w(u16 data);
void data_zero_w(u16 data);

// Program ram access
void prg_adr_w(u16 data);
void prg_data_w(offs_t offset, u16 data);
u16 prg_data_r(offs_t offset);

// Registers
u16 status_r();
Expand All @@ -59,7 +63,8 @@ class dspv_device : public cpu_device, public device_sound_interface
u16 snd_r(offs_t offset);
void snd_w(offs_t offset, u16 data);

void prg_map(address_map &map);
void prg1_map(address_map &map);
void prg2_map(address_map &map);
void data_map(address_map &map);
};

Expand Down
6 changes: 3 additions & 3 deletions src/devices/sound/dspvd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ u32 dspv_disassembler::opcode_alignment() const

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);
u64 opc = opcodes.r64(pc);
u64 mode = (params.r64(pc) >> 32) & 7;
util::stream_format(stream, "%x%016x", mode, opc);

return 1 | SUPPORTED;
}
Loading

0 comments on commit 2f69fdf

Please sign in to comment.