From e754e4358699b1ef7f37bb54f1ce63fa832dd5b5 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Fri, 7 Dec 2018 14:20:29 +0100 Subject: mu100: complete the midi ports, remove the gross hacks (nw) --- src/devices/cpu/h8/h8_sci.h | 2 -- src/devices/sound/swp30.cpp | 50 +++++++++++++++++++++++++------------------- src/mame/drivers/ymmu100.cpp | 43 +++++++------------------------------ 3 files changed, 36 insertions(+), 59 deletions(-) diff --git a/src/devices/cpu/h8/h8_sci.h b/src/devices/cpu/h8/h8_sci.h index 9ce95a17f05..065c5e4b305 100644 --- a/src/devices/cpu/h8/h8_sci.h +++ b/src/devices/cpu/h8/h8_sci.h @@ -37,8 +37,6 @@ public: void set_info(const char *intc, int eri, int rxi, int txi, int tei); void set_external_clock_period(const attotime &_period); - void force(u8 data) { rdr = data; intc->internal_interrupt(rxi_int); } - DECLARE_WRITE8_MEMBER(smr_w); DECLARE_READ8_MEMBER(smr_r); DECLARE_WRITE8_MEMBER(brr_w); diff --git a/src/devices/sound/swp30.cpp b/src/devices/sound/swp30.cpp index 39e4fc07188..0bcb43cda0e 100644 --- a/src/devices/sound/swp30.cpp +++ b/src/devices/sound/swp30.cpp @@ -357,7 +357,8 @@ void swp30_device::keyon_w(u16) u64 mask = u64(1) << i; if((m_keyon_mask & mask) && !(m_active_mask & mask) && !(m_volume[i] & 0x8000)) { m_sample_pos[i] = -s32(m_pre_size[i] << 8); - logerror("keyon %02x %08x %08x %08x vol %04x pan %04x\n", i, m_pre_size[i], m_post_size[i], m_address[i], m_volume[i], m_pan[i]); + if(0) + logerror("keyon %02x %08x %08x %08x vol %04x pan %04x\n", i, m_pre_size[i], m_post_size[i], m_address[i], m_volume[i], m_pan[i]); m_active_mask |= mask; } } @@ -390,7 +391,8 @@ template void swp30_device::prg_w(u16 data) m_program[m_program_address] = (m_program[m_program_address] & mask) | (u64(data) << shift); if(sel == 3) { - logerror("program %03x %016x\n", m_program_address, m_program[m_program_address]); + if(0) + logerror("program %03x %016x\n", m_program_address, m_program[m_program_address]); m_program_address ++; if(m_program_address == 0x180) m_program_address = 0; @@ -406,7 +408,8 @@ template u16 swp30_device::map_r() template void swp30_device::map_w(u16 data) { m_map[sel] = data; - logerror("map %d: type=%02x offset=%05x size=%05x\n", sel, data >> 11, (data & 0xff) << 10, 0x400 << ((data >> 8) & 7)); + if(0) + logerror("map %d: type=%02x offset=%05x size=%05x\n", sel, data >> 11, (data & 0xff) << 10, 0x400 << ((data >> 8) & 7)); } @@ -420,7 +423,7 @@ void swp30_device::lpf_cutoff_w(offs_t offset, u16 data) { m_stream->update(); u8 chan = offset >> 6; - if(m_lpf_cutoff[chan] != data && 0) + if(0 && m_lpf_cutoff[chan] != data) logerror("chan %02x lpf cutoff %04x\n", chan, data); m_lpf_cutoff[chan] = data; } @@ -434,7 +437,7 @@ void swp30_device::lpf_cutoff_inc_w(offs_t offset, u16 data) { m_stream->update(); u8 chan = offset >> 6; - if(m_lpf_cutoff_inc[chan] != data && 0) + if(0 && m_lpf_cutoff_inc[chan] != data) logerror("chan %02x lpf cutoff increment %04x\n", chan, data); m_lpf_cutoff_inc[chan] = data; } @@ -448,7 +451,7 @@ void swp30_device::hpf_cutoff_w(offs_t offset, u16 data) { m_stream->update(); u8 chan = offset >> 6; - if(m_hpf_cutoff[chan] != data) + if(0 && m_hpf_cutoff[chan] != data) logerror("chan %02x hpf cutoff %04x\n", chan, data); m_hpf_cutoff[chan] = data; } @@ -462,7 +465,7 @@ void swp30_device::lpf_reso_w(offs_t offset, u16 data) { m_stream->update(); u8 chan = offset >> 6; - if(m_lpf_reso[chan] != data) + if(0 && m_lpf_reso[chan] != data) logerror("chan %02x lpf resonance %04x\n", chan, data); m_lpf_reso[chan] = data; } @@ -499,7 +502,7 @@ void swp30_device::volume_w(offs_t offset, u16 data) { m_stream->update(); u8 chan = offset >> 6; - if(m_volume[chan] != data) + if(0 && m_volume[chan] != data) logerror("snd chan %02x volume %02x %02x\n", chan, data >> 8, data & 0xff); m_volume[chan] = data; if(data & 0x8000) { @@ -519,7 +522,7 @@ u16 swp30_device::pan_r(offs_t offset) void swp30_device::pan_w(offs_t offset, u16 data) { u8 chan = offset >> 6; - if(m_pan[chan] != data) + if(0 && m_pan[chan] != data) logerror("snd chan %02x pan l %02x r %02x\n", chan, data >> 8, data & 0xff); m_pan[chan] = data; } @@ -532,7 +535,7 @@ u16 swp30_device::dry_rev_r(offs_t offset) void swp30_device::dry_rev_w(offs_t offset, u16 data) { u8 chan = offset >> 6; - if(m_dry_rev[chan] != data) + if(0 && m_dry_rev[chan] != data) logerror("snd chan %02x dry %02x rev %02x\n", chan, data >> 8, data & 0xff); m_dry_rev[chan] = data; } @@ -545,7 +548,7 @@ u16 swp30_device::cho_var_r(offs_t offset) void swp30_device::cho_var_w(offs_t offset, u16 data) { u8 chan = offset >> 6; - if(m_cho_var[chan] != data) + if(0 && m_cho_var[chan] != data) logerror("snd chan %02x cho %02x var %02x\n", chan, data >> 8, data & 0xff); m_cho_var[chan] = data; } @@ -560,7 +563,7 @@ void swp30_device::freq_w(offs_t offset, u16 data) u8 chan = offset >> 6; // delta is 4*256 per octave, positive means higher freq, e.g 4.10 format. s16 v = data & 0x2000 ? data | 0xc000 : data; - if(m_freq[chan] != data) + if(0 && m_freq[chan] != data) logerror("snd chan %02x freq %c%c %d.%03x\n", chan, data & 0x8000 ? '#' : '.', data & 0x4000 ? '#' : '.', v / 1024, (v < 0 ? -v : v) & 0x3ff); m_freq[chan] = data; } @@ -575,7 +578,7 @@ template void swp30_device::envelope_w(offs_t offset, u16 data) u8 chan = offset >> 6; bool ch = m_envelope[chan][sel] != data; m_envelope[chan][sel] = data; - if(ch) + if(0 && ch) logerror("snd chan %02x envelopes %04x %04x %04x\n", chan, m_envelope[chan][0], m_envelope[chan][1], m_envelope[chan][2]); } @@ -599,7 +602,8 @@ void swp30_device::pre_size_l_w(offs_t offset, u16 data) { u8 chan = offset >> 6; m_pre_size[chan] = (m_pre_size[chan] & 0xffff0000) | data; - logerror("snd chan %02x pre-size %02x %06x\n", chan, m_pre_size[chan] >> 24, m_pre_size[chan] & 0xffffff); + if(0) + logerror("snd chan %02x pre-size %02x %06x\n", chan, m_pre_size[chan] >> 24, m_pre_size[chan] & 0xffffff); } u16 swp30_device::post_size_h_r(offs_t offset) @@ -622,7 +626,8 @@ void swp30_device::post_size_l_w(offs_t offset, u16 data) { u8 chan = offset >> 6; m_post_size[chan] = (m_post_size[chan] & 0xffff0000) | data; - logerror("snd chan %02x post-size %02x %06x\n", chan, m_post_size[chan] >> 24, m_post_size[chan] & 0xffffff); + if(0) + logerror("snd chan %02x post-size %02x %06x\n", chan, m_post_size[chan] >> 24, m_post_size[chan] & 0xffffff); } u16 swp30_device::address_h_r(offs_t offset) @@ -644,10 +649,10 @@ void swp30_device::address_h_w(offs_t offset, u16 data) void swp30_device::address_l_w(offs_t offset, u16 data) { u8 chan = offset >> 6; - // The address probably is 25 bits static const char *const formats[4] = { "l16", "l12", "l8", "x8" }; m_address[chan] = (m_address[chan] & 0xffff0000) | data; - logerror("snd chan %02x format %s flags %02x address %06x\n", chan, formats[m_address[chan] >> 30], (m_address[chan] >> 24) & 0x3f, m_address[chan] & 0xffffff); + if(0) + logerror("snd chan %02x format %s flags %02x address %06x\n", chan, formats[m_address[chan] >> 30], (m_address[chan] >> 24) & 0x3f, m_address[chan] & 0xffffff); } @@ -663,7 +668,8 @@ template void swp30_device::prg_fp_w(offs_t offset, u16 data) { offs_t adr = (offset >> 6)*6 + sel; m_program_pfp[adr] = data; - logerror("prg_fp_w %03x, %04x\n", adr, data); + if(0) + logerror("prg_fp_w %03x, %04x\n", adr, data); } template u16 swp30_device::prg_int_r(offs_t offset) @@ -676,7 +682,8 @@ template void swp30_device::prg_int_w(offs_t offset, u16 data) { offs_t adr = (offset >> 6)*2 + sel; m_program_pint[adr] = data; - logerror("prg_int_w %02x, %04x\n", adr, data); + if(0) + logerror("prg_int_w %02x, %04x\n", adr, data); } template u16 swp30_device::prg_lfo_r(offs_t offset) @@ -695,7 +702,8 @@ template void swp30_device::prg_lfo_w(offs_t offset, u16 data) int scale = (data >> 5) & 7; int step = ((data & 31) << sh[scale]) + dt[scale]; - logerror("prg_lfo_w %02x freq=%5.2f phase=%6.4f\n", adr, step * 44100.0/4194304, (data >> 8)/256.0); + if(0) + logerror("prg_lfo_w %02x freq=%5.2f phase=%6.4f\n", adr, step * 44100.0/4194304, (data >> 8)/256.0); } @@ -706,7 +714,7 @@ static u16 rr[0x40*0x40]; u16 swp30_device::snd_r(offs_t offset) { - if(1) { + if(0) { int chan = (offset >> 6) & 0x3f; int slot = offset & 0x3f; std::string preg = "-"; diff --git a/src/mame/drivers/ymmu100.cpp b/src/mame/drivers/ymmu100.cpp index 0f565f567b2..24cd390da1d 100644 --- a/src/mame/drivers/ymmu100.cpp +++ b/src/mame/drivers/ymmu100.cpp @@ -163,9 +163,6 @@ public: void mu100(machine_config &config); - int seq; - bool act; - void regs_s1_write_tap(offs_t address, u16 data, u16 mem_mask); void regs_s2_write_tap(offs_t address, u16 data, u16 mem_mask); void regs_s3_write_tap(offs_t address, u16 data, u16 mem_mask); @@ -183,9 +180,6 @@ public: void prg_write_tap(offs_t address, u16 data, u16 mem_mask); virtual void machine_reset() override { - timer_alloc()->adjust(attotime::from_double(5)); - seq = 0; - act = false; if(0) m_maincpu->space(0).install_write_tap(0x214cb8, 0x214cbf, "prg select", [this](offs_t offset, u16 &data, u16 mem_mask) { prg_write_tap(offset, data, mem_mask); @@ -248,28 +242,6 @@ public: }); } - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override { - static u8 xnote[8] = { 60, 62, 64, 65, 67, 69, 71, 72 }; - static int note = 0; - act = true; - if(1) { seq = 42; return; } - - switch(seq) { - case 0: push(0x90); logerror("swp30 midi keyon %d\n", note); timer.adjust(attotime::from_double(0.0005)); if(0) machine().debug_break(); break; - case 1: push(xnote[note]); timer.adjust(attotime::from_double(0.0005)); break; - case 2: push(0x25); timer.adjust(attotime::from_double(1.0)); break; - case 3: push(0x80); logerror("swp30 midi keyoff\n"); timer.adjust(attotime::from_double(0.0005)); if(0) machine().debug_break(); break; - case 4: push(xnote[note]); timer.adjust(attotime::from_double(0.0005)); ; if(note == 8) note = 0; break; - case 5: push(0x01); timer.adjust(attotime::from_double(0.05)); seq=0; return; - } - seq ++; - } - - void push(u8 val) { - logerror("push %02x\n", val); - machine().root_device().subdevice("maincpu:sci0")->force(val); - } - protected: virtual u16 adc7_r(); @@ -430,8 +402,6 @@ void mu100_state::regs_int_write_tap(offs_t address, u16 data, u16 mem_mask) void mu100_state::voice_write_tap(offs_t address, u16 data, u16 mem_mask) { offs_t pc = m_maincpu->pc(); - if(!act) - return; offs_t off = address - 0x20f03e; int voice = off / 0x92; int slot = off % 0x92; @@ -449,8 +419,6 @@ void mu100_state::voice_write_tap(offs_t address, u16 data, u16 mem_mask) void mu100_state::chan_write_tap(offs_t address, u16 data, u16 mem_mask) { offs_t pc = m_maincpu->pc(); - if(!act) - return; offs_t off = address - 0x20cb10; int voice = off / 0x112; int slot = off % 0x112; @@ -724,13 +692,16 @@ void mu100_state::mu100(machine_config &config) m_swp30->add_route(0, "lspeaker", 1.0); m_swp30->add_route(1, "rspeaker", 1.0); - auto &mdin(MIDI_PORT(config, "mdin")); - midiin_slot(mdin); - mdin.rxd_handler().set("maincpu:sci0", FUNC(h8_sci_device::rx_w)); + auto &mdin_a(MIDI_PORT(config, "mdin_a")); + midiin_slot(mdin_a); + mdin_a.rxd_handler().set("maincpu:sci1", FUNC(h8_sci_device::rx_w)); + + auto &mdin_b(MIDI_PORT(config, "mdin_b")); + midiin_slot(mdin_b); + mdin_b.rxd_handler().set("maincpu:sci0", FUNC(h8_sci_device::rx_w)); auto &mdout(MIDI_PORT(config, "mdout")); midiout_slot(mdout); - m_maincpu->subdevice("sci0")->tx_handler().set(mdout, FUNC(midi_port_device::write_txd)); } -- cgit v1.2.3