From 21f7f35c19747e542c364b87988c45165d963511 Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 20 Dec 2022 05:22:31 +1100 Subject: yamaha/ymdx9.cpp: Resolved issues with incoming MIDI. (#10702) * Added divider on 500 kHz midi serial clock. * Added missing MIDI data read handler. --- src/mame/yamaha/ymdx9.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mame/yamaha/ymdx9.cpp b/src/mame/yamaha/ymdx9.cpp index 676501cd833..1ec7239283c 100644 --- a/src/mame/yamaha/ymdx9.cpp +++ b/src/mame/yamaha/ymdx9.cpp @@ -159,6 +159,14 @@ private: * @return uint8_t The value read from the port. */ uint8_t p1_r(offs_t offset); + + /** + * @brief Handle a read from the synth's IO Port 2. + * This function is used to handle incoming serial data. + * @param offset The offset into the memory mapped region being read. + * @return uint8_t The value read from the port. + */ + uint8_t p2_r(offs_t offset); }; @@ -242,6 +250,7 @@ void yamaha_dx9_state::dx9(machine_config &config) // Unlike the DX7 only IO port 1 is used. // The direction flags of other ports are set, however they are never read, or written. m_maincpu->in_p1_cb().set(FUNC(yamaha_dx9_state::p1_r)); + m_maincpu->in_p2_cb().set(FUNC(yamaha_dx9_state::p2_r)); m_maincpu->out_p1_cb().set(FUNC(yamaha_dx9_state::p1_w)); NVRAM(config, "ram1", nvram_device::DEFAULT_ALL_0); @@ -255,7 +264,7 @@ void yamaha_dx9_state::dx9(machine_config &config) m_adc->in_callback<4>().set_constant(0x80); // Configure MIDI. - auto &midiclock(CLOCK(config, "midiclock", 500_kHz_XTAL)); + auto &midiclock(CLOCK(config, "midiclock", 500_kHz_XTAL / 2)); midiclock.signal_handler().set(FUNC(yamaha_dx9_state::midiclock_w)); MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(FUNC(yamaha_dx9_state::midi_r)); @@ -323,7 +332,16 @@ uint8_t yamaha_dx9_state::p1_r(offs_t offset) return m_adc->eoc_r() << 4; } + +/** + * yamaha_dx9_state::p2_r + */ +uint8_t yamaha_dx9_state::p2_r(offs_t offset) +{ + return m_rx_data << 3; +} + /** * yamaha_dx9_state::p1_w */ -- cgit v1.2.3