From f19bcc05e8059669596256bd55c728b34f74b308 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Fri, 5 May 2023 04:05:15 +0200 Subject: mc68000: Serial support --- src/mame/mc/mc68000.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/mame/mc/mc68000.cpp b/src/mame/mc/mc68000.cpp index 2d5422bfa40..07c7f472e36 100644 --- a/src/mame/mc/mc68000.cpp +++ b/src/mame/mc/mc68000.cpp @@ -18,7 +18,6 @@ - Color/brightness levels - Sound - Joysticks - - Serial Notes: - This computer was described in the "mc" magazine by Franzis Verlag. @@ -32,6 +31,7 @@ #include "emu.h" #include "bus/centronics/ctronics.h" #include "bus/mc68000/sysbus.h" +#include "bus/rs232/rs232.h" #include "cpu/m68000/m68000.h" #include "machine/6522via.h" #include "machine/input_merger.h" @@ -70,6 +70,7 @@ public: m_centronics_latch(*this, "centronics_latch"), m_centronics_error(*this, "centronics_error"), m_centronics(*this, "centronics"), + m_serial(*this, "serial"), m_apm_view(*this, "apm"), m_eprom(*this, "eprom%u", 0U), m_switches(*this, "switches") @@ -91,6 +92,7 @@ private: required_device m_centronics_latch; required_device m_centronics_error; required_device m_centronics; + required_device m_serial; memory_view m_apm_view; required_memory_region_array<2> m_eprom; required_ioport m_switches; @@ -112,6 +114,7 @@ private: MC6845_UPDATE_ROW(crtc_update_row); + void lvia_porta_w(uint8_t data); void uvia_porta_w(uint8_t data); void addr_decode_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); }; @@ -381,6 +384,21 @@ MC6845_UPDATE_ROW( mc68000_state::crtc_update_row ) // MACHINE EMULATION //************************************************************************** +void mc68000_state::lvia_porta_w(uint8_t data) +{ + // 7------- serial cts (read) + // -6------ 40/80 char mode + // --5----- serial tx + // ---4---- serial dtr + // ----3--- ibm/pc keyboard (read) + // -----2-- serial rx (read) + // ------1- cassette write + // -------0 cassette read (read) + + m_serial->write_dtr(BIT(data, 4)); + m_serial->write_txd(BIT(~data, 5)); +} + void mc68000_state::uvia_porta_w(uint8_t data) { // 7------- centronics error (read) @@ -450,14 +468,15 @@ void mc68000_state::mc68000(machine_config &config) m_crtc->set_update_row_callback(FUNC(mc68000_state::crtc_update_row)); m_crtc->out_vsync_callback().set(m_via[1], FUNC(via6522_device::write_ca1)); - MOS6522(config, m_via[0], 16_MHz_XTAL / 16); // ic55 + MOS6522(config, m_via[0], 16_MHz_XTAL / 2 / 10); // ic55 m_via[0]->irq_handler().set(m_irq3, FUNC(input_merger_device::in_w<0>)); + m_via[0]->writepa_handler().set(FUNC(mc68000_state::lvia_porta_w)); - MOS6522(config, m_via[1], 16_MHz_XTAL / 16); // ic56 + MOS6522(config, m_via[1], 16_MHz_XTAL / 2 / 10); // ic56 m_via[1]->irq_handler().set(m_irq3, FUNC(input_merger_device::in_w<1>)); m_via[1]->writepa_handler().set(FUNC(mc68000_state::uvia_porta_w)); - MC68000_SYSBUS(config, m_sysbus, 0); + MC68000_SYSBUS(config, m_sysbus, 16_MHz_XTAL); m_sysbus->irq1_cb().set_inputline(m_maincpu, INPUT_LINE_IRQ1); m_sysbus->irq2_cb().set_inputline(m_maincpu, INPUT_LINE_IRQ2); m_sysbus->irq3_cb().set(m_irq3, FUNC(input_merger_device::in_w<2>)); @@ -485,6 +504,11 @@ void mc68000_state::mc68000(machine_config &config) m_centronics->fault_handler().set(m_centronics_error, FUNC(input_merger_device::in_w<0>)); m_centronics->perror_handler().set(m_centronics_error, FUNC(input_merger_device::in_w<1>)).invert(); + RS232_PORT(config, m_serial, default_rs232_devices, nullptr); + m_serial->rxd_handler().set(m_via[0], FUNC(via6522_device::write_ca1)); + m_serial->rxd_handler().append(m_via[0], FUNC(via6522_device::write_pa2)); + m_serial->cts_handler().set(m_via[0], FUNC(via6522_device::write_pa7)); + generic_keyboard_device &kbd(GENERIC_KEYBOARD(config, "kbd", 0)); kbd.set_keyboard_callback(FUNC(mc68000_state::kbd_put)); } -- cgit v1.2.3