From a2a60395dc69a56d7eadd2cbac93400cc798c1ad Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sat, 26 Oct 2024 18:00:28 +0200 Subject: psr540: Add the mks3 --- src/mame/yamaha/ympsr540.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mame/yamaha/ympsr540.cpp b/src/mame/yamaha/ympsr540.cpp index 127e384454f..7a99f4e6836 100644 --- a/src/mame/yamaha/ympsr540.cpp +++ b/src/mame/yamaha/ympsr540.cpp @@ -3,6 +3,7 @@ #include "emu.h" +#include "mks3.h" #include "bus/midi/midiinport.h" #include "bus/midi/midioutport.h" #include "cpu/sh/sh7042.h" @@ -28,6 +29,7 @@ public: m_floppy(*this, "fdc:0"), m_fdc(*this, "fdc"), m_nvram(*this, "ram"), + m_mks3(*this, "mks3"), m_inputs(*this, "B%u", 1U), m_outputs(*this, "%02d.%x.%x", 0U, 0U, 0U), m_sustain(*this, "SUSTAIN"), @@ -43,6 +45,7 @@ private: required_device m_floppy; required_device m_fdc; required_device m_nvram; + required_device m_mks3; required_ioport_array<8> m_inputs; output_finder<80, 8, 5> m_outputs; required_ioport m_sustain; @@ -58,6 +61,7 @@ private: u16 adc_midisw_r(); u16 adc_battery_r(); + void pa_w(u16 data); u16 pe_r(); void pe_w(u16 data); u8 pf_r(); @@ -125,6 +129,7 @@ void psr540_state::psr540(machine_config &config) m_maincpu->read_adc<3>().set_constant(0); m_maincpu->read_adc<4>().set_ioport(m_pitch_bend); m_maincpu->read_adc<5>().set_constant(0); // Actually used as pf5 + m_maincpu->write_porta().set(FUNC(psr540_state::pa_w)); m_maincpu->read_porte().set(FUNC(psr540_state::pe_r)); m_maincpu->write_porte().set(FUNC(psr540_state::pe_w)); m_maincpu->read_portf().set(FUNC(psr540_state::pf_r)); @@ -133,6 +138,10 @@ void psr540_state::psr540(machine_config &config) m_swx00->add_route(0, "lspeaker", 1.0); m_swx00->add_route(1, "rspeaker", 1.0); + MKS3(config, m_mks3); + m_mks3->write_da().set(m_maincpu, FUNC(sh7042_device::sci_rx_w<1>)); + m_mks3->write_clk().set(m_maincpu, FUNC(sh7042_device::sci_clk_w<1>)); + KS0066(config, m_lcdc, 270000); // OSC = 91K resistor, TODO: actually KS0066U-10B m_lcdc->set_default_bios_tag("f00"); m_lcdc->set_lcd_size(2, 40); @@ -200,11 +209,17 @@ void psr540_state::pe_w(u16 data) m_lcdc->rs_w(BIT(m_pe, 11)); m_lcdc->e_w(BIT(m_pe, 9)); m_fdc->rate_w(!BIT(m_pe, 8)); + m_mks3->ic_w(BIT(m_pe, 4)); if(BIT(m_pe, 4)) m_scan = m_led & 7; } +void psr540_state::pa_w(u16 data) +{ + m_mks3->req_w(BIT(data, 4)); +} + void psr540_state::lcd_data_w(u8 data) { m_lcdc->db_w(data); @@ -250,7 +265,7 @@ static INPUT_PORTS_START( psr540 ) PORT_BIT(0x3ff, 0x200, IPT_PADDLE) PORT_NAME("Pitch Bend") PORT_SENSITIVITY(30) PORT_START("B1") - PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Exit") PORT_CODE(KEYCODE_BACKSPACE) PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Utility") PORT_CODE(KEYCODE_Q) PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Save") PORT_CODE(KEYCODE_W) -- cgit v1.2.3