From 0909ab8305c595b60cd401f9fa1aeeba09c2508c Mon Sep 17 00:00:00 2001 From: mahlemiut Date: Thu, 31 Jan 2013 01:50:53 +0000 Subject: [PATCH] isa_gus: Enabled 6850 MIDI interface with a hopefully accurate clock, and fixed a silly error with MIDI IRQs, and passes the MIDI transmit IRQ test. [Barry Rodewald] Out of whatsnew: It still slows the drivers down a bit, but now only by about 20-25%, might be a bit more manageable now. Also, is there any way to tell if the 6850 triggers an IRQ on recieve or transmit, as the GUS has separate flags for each case. Otherwise, it can't pass the MIDI recieve IRQ test. --- src/mess/machine/isa_gus.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/mess/machine/isa_gus.c b/src/mess/machine/isa_gus.c index 410e14c546a..5083eeb3be4 100644 --- a/src/mess/machine/isa_gus.c +++ b/src/mess/machine/isa_gus.c @@ -489,7 +489,7 @@ READ8_MEMBER(gf1_device::global_reg_data_r) * bit 6 - 1 if addresses are decreasing, can change when looping is enabled * bit 7 - 1 if Wavetable IRQ is pending */ if(offset == 1) - return m_voice[m_current_voice].voice_ctrl; + return m_voice[m_current_voice].voice_ctrl & 0xff; case 0x81: // Frequency Control ret = m_voice[m_current_voice].freq_ctrl; if(offset == 0) @@ -591,12 +591,10 @@ WRITE8_MEMBER(gf1_device::global_reg_data_w) * bit 5 - set to 1 to enable wavetable IRQ when end address is reached */ if(offset == 1) { - m_voice[m_current_voice].voice_ctrl = data & 0x7f; + m_voice[m_current_voice].voice_ctrl = data & 0xff; m_voice[m_current_voice].rollover = false; if(data & 0x02) - { m_voice[m_current_voice].voice_ctrl |= 0x01; - } } logerror("GUS: Ch%i Voice control write %02x\n", m_current_voice,data); break; @@ -1129,6 +1127,7 @@ void gf1_device::set_irq(UINT8 source, UINT8 voice) m_wave_irq_func(1); m_voice_irq_fifo[m_voice_irq_ptr % 32] = m_irq_source; m_voice_irq_ptr++; + m_voice[voice].voice_ctrl |= 0x80; } if(source & IRQ_VOLUME_RAMP) { @@ -1199,8 +1198,8 @@ void gf1_device::eop_w(int state) static const acia6850_interface gus_midi_interface = { - GF1_CLOCK, - GF1_CLOCK, // a guess for now + 31250 * 16, + 31250 * 16, DEVCB_NULL, DEVCB_NULL, @@ -1209,8 +1208,7 @@ static const acia6850_interface gus_midi_interface = DEVCB_NULL, DEVCB_NULL, - DEVCB_NULL - //DEVCB_LINE_MEMBER(isa16_gus_device,midi_irq) + DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER,isa16_gus_device,midi_irq) }; static const gf1_interface gus_gf1_config = @@ -1232,7 +1230,7 @@ static MACHINE_CONFIG_FRAGMENT( gus_config ) MCFG_SOUND_CONFIG(gus_gf1_config) MCFG_SOUND_ROUTE(0,"lspeaker",0.50) MCFG_SOUND_ROUTE(1,"rspeaker",0.50) -// MCFG_ACIA6850_ADD("midi",gus_midi_interface) + MCFG_ACIA6850_ADD("midi",gus_midi_interface) MACHINE_CONFIG_END static INPUT_PORTS_START( gus_joy ) @@ -1275,7 +1273,7 @@ isa16_gus_device::isa16_gus_device(const machine_config &mconfig, const char *ta void isa16_gus_device::device_start() { m_gf1 = subdevice("gf1"); - //m_midi = subdevice("midi"); + m_midi = subdevice("midi"); set_isa_device(); m_isa->install_device(0x0200, 0x0201, 0, 0, read8_delegate(FUNC(isa16_gus_device::joy_r),this), write8_delegate(FUNC(isa16_gus_device::joy_w),this) ); m_isa->install_device(0x0220, 0x022f, 0, 0, read8_delegate(FUNC(isa16_gus_device::board_r),this), write8_delegate(FUNC(isa16_gus_device::board_w),this) ); @@ -1355,6 +1353,7 @@ WRITE8_MEMBER(isa16_gus_device::board_w) break; case 0x0f: m_gf1->stat_w(space,offset-15,data); + break; default: logerror("GUS: Invalid or unimplemented register write %02x of port 0x2X%01x\n",data,offset); } @@ -1364,10 +1363,10 @@ READ8_MEMBER(isa16_gus_device::synth_r) { switch(offset) { -// case 0x00: -// return m_midi->status_read(space,0); -// case 0x01: -// return m_midi->data_read(space,0); + case 0x00: + return m_midi->status_read(space,0); + case 0x01: + return m_midi->data_read(space,0); case 0x02: case 0x03: return m_gf1->global_reg_select_r(space,offset-2); @@ -1389,10 +1388,10 @@ WRITE8_MEMBER(isa16_gus_device::synth_w) switch(offset) { case 0x00: -// m_midi->control_write(space,0,data); + m_midi->control_write(space,0,data); break; case 0x01: -// m_midi->data_write(space,0,data); + m_midi->data_write(space,0,data); break; case 0x02: case 0x03: @@ -1674,9 +1673,9 @@ void isa16_gus_device::reset_midi_irq(UINT8 source) WRITE_LINE_MEMBER( isa16_gus_device::midi_irq ) { if(state) - set_irq(IRQ_MIDI_TRANSMIT); + set_midi_irq(IRQ_MIDI_TRANSMIT); else - reset_irq(IRQ_MIDI_TRANSMIT); + reset_midi_irq(IRQ_MIDI_TRANSMIT); } WRITE_LINE_MEMBER( isa16_gus_device::nmi_w)