summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus
diff options
context:
space:
mode:
author 68bit <53298758+68bit@users.noreply.github.com>2019-10-30 13:02:31 +1100
committer Vas Crabb <cuavas@users.noreply.github.com>2019-10-30 13:02:31 +1100
commit7aa1490a7e920be58d73344e20af67f36f7a9a2f (patch)
tree104cc37a5b6d78ce942d230b070bf0681d4b9aa6 /src/devices/bus
parentfff889b165b607c2d1bf2b77727d0a2fc35239b4 (diff)
swtpc8212: get it running, and on the rs232 bus (#5729)
This patch gets it running, and splits it into two front ends, one being a rs232 bus slot so that is can be used as a terminal option. It adds the MCM66750 character generator, and implements the MC6845 row update function. Most of the I/O has been worked out with help from the CT-82 user manual. The various screen formats and the graphics modes appear to be working and plausible. Printer support has been added, and a beeper.
Diffstat (limited to 'src/devices/bus')
-rw-r--r--src/devices/bus/rs232/swtpc8212.cpp87
-rw-r--r--src/devices/bus/rs232/swtpc8212.h40
-rw-r--r--src/devices/bus/ss50/mps.cpp47
-rw-r--r--src/devices/bus/ss50/mps2.cpp3
4 files changed, 163 insertions, 14 deletions
diff --git a/src/devices/bus/rs232/swtpc8212.cpp b/src/devices/bus/rs232/swtpc8212.cpp
new file mode 100644
index 00000000000..ea48a2cecf8
--- /dev/null
+++ b/src/devices/bus/rs232/swtpc8212.cpp
@@ -0,0 +1,87 @@
+// license:BSD-3-Clause
+// copyright-holders:68bit
+
+#include "emu.h"
+#include "swtpc8212.h"
+
+swtpc8212_terminal_device::swtpc8212_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, SERIAL_TERMINAL_SWTPC8212, tag, owner, clock)
+ , device_rs232_port_interface(mconfig, *this)
+ , m_swtpc8212(*this, "swtpc8212")
+ , m_flow_control(*this, "FLOW_CONTROL")
+{
+}
+
+void swtpc8212_terminal_device::device_add_mconfig(machine_config &config)
+{
+ SWTPC8212(config, m_swtpc8212, 0);
+ m_swtpc8212->rs232_conn_txd_handler().set(FUNC(swtpc8212_terminal_device::output_rxd));
+ m_swtpc8212->rs232_conn_rts_handler().set(FUNC(swtpc8212_terminal_device::route_term_rts));
+ m_swtpc8212->rs232_conn_dtr_handler().set(FUNC(swtpc8212_terminal_device::route_term_dtr));
+}
+
+INPUT_PORTS_START(swtpc8212_terminal)
+
+ PORT_START("FLOW_CONTROL")
+ PORT_CONFNAME(0x1, 1, "Flow control")
+ PORT_CONFSETTING(0x00, "None") PORT_CHANGED_MEMBER(DEVICE_SELF, swtpc8212_terminal_device, flow_control, 0)
+ PORT_CONFSETTING(0x01, "Terminal DTR to remote CTS") PORT_CHANGED_MEMBER(DEVICE_SELF, swtpc8212_terminal_device, flow_control, 0)
+
+INPUT_PORTS_END
+
+ioport_constructor swtpc8212_terminal_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME(swtpc8212_terminal);
+}
+
+WRITE_LINE_MEMBER(swtpc8212_terminal_device::input_txd)
+{
+ m_swtpc8212->rs232_conn_rxd_w(state);
+}
+
+WRITE_LINE_MEMBER(swtpc8212_terminal_device::route_term_rts)
+{
+ // Loop the terminal RTS output to the terminal CTS input.
+ m_swtpc8212->rs232_conn_cts_w(state);
+}
+
+// This terminal uses DTR for hardware flow control.
+WRITE_LINE_MEMBER(swtpc8212_terminal_device::route_term_dtr)
+{
+ if (m_flow_control->read())
+ {
+ // Connect the terminal DTR output to CTS at the other end.
+ output_cts(state);
+ }
+
+ // Cache the state, in case the ioport setting changes.
+ m_dtr = state;
+}
+
+INPUT_CHANGED_MEMBER(swtpc8212_terminal_device::flow_control)
+{
+ if (newval)
+ output_cts(m_dtr);
+ else
+ output_cts(0);
+}
+
+void swtpc8212_terminal_device::device_start()
+{
+ save_item(NAME(m_dtr));
+}
+
+void swtpc8212_terminal_device::device_reset()
+{
+ // To the terminal
+ m_swtpc8212->rs232_conn_cts_w(0);
+
+ // To the computer
+ output_rxd(1);
+ output_dcd(0);
+ output_dsr(0);
+ if (!m_flow_control->read())
+ output_cts(0);
+}
+
+DEFINE_DEVICE_TYPE(SERIAL_TERMINAL_SWTPC8212, swtpc8212_terminal_device, "swtpc8212_terminal", "SWTPC8212 Terminal")
diff --git a/src/devices/bus/rs232/swtpc8212.h b/src/devices/bus/rs232/swtpc8212.h
new file mode 100644
index 00000000000..2af82fa3215
--- /dev/null
+++ b/src/devices/bus/rs232/swtpc8212.h
@@ -0,0 +1,40 @@
+// license:BSD-3-Clause
+// copyright-holders:68bit
+
+#ifndef MAME_BUS_RS232_SWTPC8212_H
+#define MAME_BUS_RS232_SWTPC8212_H
+
+#pragma once
+
+#include "rs232.h"
+#include "machine/swtpc8212.h"
+
+
+class swtpc8212_terminal_device : public device_t, public device_rs232_port_interface
+{
+public:
+ swtpc8212_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ virtual DECLARE_WRITE_LINE_MEMBER(input_txd) override;
+
+ DECLARE_INPUT_CHANGED_MEMBER(flow_control);
+
+protected:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+ virtual void device_add_mconfig(machine_config &config) override;
+ virtual ioport_constructor device_input_ports() const override;
+
+private:
+ required_device<swtpc8212_device> m_swtpc8212;
+ required_ioport m_flow_control;
+
+ DECLARE_WRITE_LINE_MEMBER(route_term_rts);
+ DECLARE_WRITE_LINE_MEMBER(route_term_dtr);
+
+ int m_dtr;
+};
+
+DECLARE_DEVICE_TYPE(SERIAL_TERMINAL_SWTPC8212, swtpc8212_terminal_device)
+
+#endif // MAME_BUS_RS232_SWTPC8212_H
diff --git a/src/devices/bus/ss50/mps.cpp b/src/devices/bus/ss50/mps.cpp
index 15d7d160e31..30e2a534615 100644
--- a/src/devices/bus/ss50/mps.cpp
+++ b/src/devices/bus/ss50/mps.cpp
@@ -10,6 +10,7 @@
#include "mps.h"
#include "bus/rs232/rs232.h"
+#include "bus/rs232/swtpc8212.h"
#include "machine/6850acia.h"
//**************************************************************************
@@ -23,11 +24,12 @@ class ss50_mps_device : public device_t, public ss50_card_interface
public:
// construction/destruction
ss50_mps_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
- : device_t(mconfig, SS50_MPS, tag, owner, clock),
- ss50_card_interface(mconfig, *this),
- m_acia(*this, "acia"),
- m_irq_jumper(*this, "IRQ"),
- m_rate_jumper(*this, "BAUD")
+ : device_t(mconfig, SS50_MPS, tag, owner, clock)
+ , ss50_card_interface(mconfig, *this)
+ , m_acia(*this, "acia")
+ , m_irq_jumper(*this, "IRQ")
+ , m_rate_jumper(*this, "BAUD")
+ , m_cts_route(*this, "CTS_ROUTE")
{
}
@@ -48,26 +50,34 @@ protected:
private:
DECLARE_WRITE_LINE_MEMBER(acia_irq_w);
+ DECLARE_WRITE_LINE_MEMBER(route_cts_r);
required_device<acia6850_device> m_acia;
required_ioport m_irq_jumper;
required_ioport m_rate_jumper;
+ required_ioport m_cts_route;
};
static INPUT_PORTS_START( mps )
PORT_START("IRQ")
- PORT_DIPNAME(1, 0, "IRQ")
- PORT_DIPSETTING(1, DEF_STR(Off))
- PORT_DIPSETTING(0, DEF_STR(On))
+ PORT_CONFNAME(1, 0, "IRQ")
+ PORT_CONFSETTING(1, DEF_STR(Off))
+ PORT_CONFSETTING(0, DEF_STR(On))
PORT_START("BAUD")
- PORT_DIPNAME(0x1f, 0x1d, "Baud Rate")
- PORT_DIPSETTING(0x1e, "110")
- PORT_DIPSETTING(0x1d, "150 / 9600")
- PORT_DIPSETTING(0x1b, "300")
- PORT_DIPSETTING(0x17, "600")
- PORT_DIPSETTING(0x0f, "1200")
+ PORT_CONFNAME(0x1f, 0x1d, "Baud Rate")
+ PORT_CONFSETTING(0x1e, "110")
+ PORT_CONFSETTING(0x1d, "150 / 9600")
+ PORT_CONFSETTING(0x1b, "300")
+ PORT_CONFSETTING(0x17, "600")
+ PORT_CONFSETTING(0x0f, "1200")
+
+ PORT_START("CTS_ROUTE")
+ PORT_CONFNAME(1, 0, "CTS route")
+ PORT_CONFSETTING(0, "Wired low (standard)")
+ PORT_CONFSETTING(1, "Connected through (modified)")
+
INPUT_PORTS_END
@@ -105,6 +115,8 @@ void ss50_mps_device::device_add_mconfig(machine_config &config)
rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal"));
rs232.rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd));
+ rs232.cts_handler().set(FUNC(ss50_mps_device::route_cts_r));
+ rs232.option_add("swtpc8212", SERIAL_TERMINAL_SWTPC8212);
rs232.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal));
}
@@ -178,6 +190,13 @@ WRITE_LINE_MEMBER(ss50_mps_device::acia_irq_w)
write_irq(state);
}
+WRITE_LINE_MEMBER(ss50_mps_device::route_cts_r)
+{
+ if (m_cts_route->read())
+ {
+ m_acia->write_cts(state);
+ }
+}
// device type definition
DEFINE_DEVICE_TYPE_PRIVATE(SS50_MPS, ss50_card_interface, ss50_mps_device, "ss50_mps", "MP-S Serial Interface")
diff --git a/src/devices/bus/ss50/mps2.cpp b/src/devices/bus/ss50/mps2.cpp
index 30bdd9e5a64..f2c6c8c1f77 100644
--- a/src/devices/bus/ss50/mps2.cpp
+++ b/src/devices/bus/ss50/mps2.cpp
@@ -11,6 +11,7 @@
#include "mps2.h"
#include "bus/rs232/rs232.h"
+#include "bus/rs232/swtpc8212.h"
#include "machine/6850acia.h"
#include "machine/input_merger.h"
@@ -141,6 +142,7 @@ void ss50_mps2_device::device_add_mconfig(machine_config &config)
rs232_upper.rxd_handler().set(m_acia_upper, FUNC(acia6850_device::write_rxd));
rs232_upper.cts_handler().set(m_acia_upper, FUNC(acia6850_device::write_cts));
rs232_upper.dcd_handler().set(m_acia_upper, FUNC(acia6850_device::write_dcd));
+ rs232_upper.option_add("swtpc8212", SERIAL_TERMINAL_SWTPC8212);
rs232_upper.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal_upper));
ACIA6850(config, m_acia_lower, 0);
@@ -152,6 +154,7 @@ void ss50_mps2_device::device_add_mconfig(machine_config &config)
rs232_lower.rxd_handler().set(m_acia_lower, FUNC(acia6850_device::write_rxd));
rs232_lower.cts_handler().set(m_acia_lower, FUNC(acia6850_device::write_cts));
rs232_lower.dcd_handler().set(m_acia_lower, FUNC(acia6850_device::write_dcd));
+ rs232_lower.option_add("swtpc8212", SERIAL_TERMINAL_SWTPC8212);
rs232_lower.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal_lower));
INPUT_MERGER_ANY_HIGH(config, "irq").output_handler().set(FUNC(ss50_mps2_device::write_irq));