summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/ss50/interface.cpp4
-rw-r--r--src/devices/bus/ss50/mpc.cpp216
-rw-r--r--src/devices/bus/ss50/mpc.h14
-rw-r--r--src/mame/drivers/swtpc.cpp7
5 files changed, 237 insertions, 6 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 85b772ba345..4dbf4fe0ad0 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -1400,6 +1400,8 @@ if (BUSES["SS50"]~=null) then
files {
MAME_DIR .. "src/devices/bus/ss50/interface.cpp",
MAME_DIR .. "src/devices/bus/ss50/interface.h",
+ MAME_DIR .. "src/devices/bus/ss50/mpc.cpp",
+ MAME_DIR .. "src/devices/bus/ss50/mpc.h",
MAME_DIR .. "src/devices/bus/ss50/mps.cpp",
MAME_DIR .. "src/devices/bus/ss50/mps.h",
}
diff --git a/src/devices/bus/ss50/interface.cpp b/src/devices/bus/ss50/interface.cpp
index e5f2620b0a8..3d51f76ba53 100644
--- a/src/devices/bus/ss50/interface.cpp
+++ b/src/devices/bus/ss50/interface.cpp
@@ -79,7 +79,7 @@
#include "emu.h"
#include "bus/ss50/interface.h"
-//#include "bus/ss50/mpc.h"
+#include "bus/ss50/mpc.h"
//#include "bus/ss50/mpl.h"
//#include "bus/ss50/mpr.h"
#include "bus/ss50/mps.h"
@@ -214,7 +214,7 @@ ss50_card_interface::ss50_card_interface(const machine_config &mconfig, device_t
}
SLOT_INTERFACE_START(ss50_default_2rs_devices)
- //SLOT_INTERFACE("mpc", SS50_MPC)
+ SLOT_INTERFACE("mpc", SS50_MPC)
//SLOT_INTERFACE("mpl", SS50_MPL)
//SLOT_INTERFACE("mpn", SS50_MPN)
SLOT_INTERFACE("mps", SS50_MPS)
diff --git a/src/devices/bus/ss50/mpc.cpp b/src/devices/bus/ss50/mpc.cpp
new file mode 100644
index 00000000000..7f587d6bb62
--- /dev/null
+++ b/src/devices/bus/ss50/mpc.cpp
@@ -0,0 +1,216 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+/**********************************************************************
+
+ SWTPC MP-C Serial Control Interface
+
+**********************************************************************/
+
+#include "emu.h"
+#include "bus/ss50/mpc.h"
+#include "bus/ss50/interface.h"
+
+#include "bus/rs232/rs232.h"
+#include "machine/6821pia.h"
+#include "machine/input_merger.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> ss50_mpc_device
+
+class ss50_mpc_device : public device_t, public ss50_card_interface
+{
+public:
+ // construction/destruction
+ ss50_mpc_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : device_t(mconfig, SS50_MPC, tag, owner, clock),
+ ss50_card_interface(mconfig, *this),
+ m_pia(*this, "pia"),
+ m_loopback(*this, "loopback"),
+ m_baud_jumper(*this, "BAUD"),
+ m_cd4024ae_count(0),
+ m_cd4024ae_clock(false),
+ m_cd4024ae_reset(true),
+ m_count_select(false)
+ {
+ }
+
+protected:
+ // device-specific overrides
+ virtual ioport_constructor device_input_ports() const override;
+ virtual void device_add_mconfig(machine_config &config) override;
+ virtual void device_start() override;
+
+ // interface-specific overrides
+ virtual DECLARE_READ8_MEMBER(register_read) override;
+ virtual DECLARE_WRITE8_MEMBER(register_write) override;
+ virtual DECLARE_WRITE_LINE_MEMBER(f110_w) override;
+ virtual DECLARE_WRITE_LINE_MEMBER(f300_w) override;
+
+private:
+ DECLARE_WRITE_LINE_MEMBER(serial_input_w);
+ DECLARE_WRITE_LINE_MEMBER(reader_control_w);
+ DECLARE_READ_LINE_MEMBER(count_r);
+ DECLARE_WRITE_LINE_MEMBER(count_reset_w);
+ DECLARE_WRITE_LINE_MEMBER(count_select_w);
+ DECLARE_WRITE_LINE_MEMBER(clock_input_w);
+
+ required_device<pia6821_device> m_pia;
+ required_device<input_merger_device> m_loopback;
+ required_ioport m_baud_jumper;
+
+ u8 m_cd4024ae_count;
+ bool m_cd4024ae_clock;
+ bool m_cd4024ae_reset;
+ bool m_count_select;
+};
+
+
+static INPUT_PORTS_START( mpc )
+ PORT_START("BAUD")
+ PORT_DIPNAME(1, 0, "Baud Rate")
+ PORT_DIPSETTING(1, "110")
+ PORT_DIPSETTING(0, "300")
+
+ PORT_START("STOP")
+ PORT_DIPNAME(1, 0, "Stop Bits")
+ PORT_DIPSETTING(0, "1")
+ PORT_DIPSETTING(1, "2")
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor ss50_mpc_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME(mpc);
+}
+
+
+static DEVICE_INPUT_DEFAULTS_START( terminal )
+ DEVICE_INPUT_DEFAULTS("RS232_RXBAUD", 0xff, RS232_BAUD_300)
+ DEVICE_INPUT_DEFAULTS("RS232_TXBAUD", 0xff, RS232_BAUD_300)
+ DEVICE_INPUT_DEFAULTS("RS232_STARTBITS", 0xff, RS232_STARTBITS_1)
+ DEVICE_INPUT_DEFAULTS("RS232_DATABITS", 0xff, RS232_DATABITS_8)
+ DEVICE_INPUT_DEFAULTS("RS232_PARITY", 0xff, RS232_PARITY_NONE)
+ DEVICE_INPUT_DEFAULTS("RS232_STOPBITS", 0xff, RS232_STOPBITS_1)
+DEVICE_INPUT_DEFAULTS_END
+
+
+//-------------------------------------------------
+// device_add_mconfig - add device-specific
+// machine configuration
+//-------------------------------------------------
+
+MACHINE_CONFIG_MEMBER(ss50_mpc_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("pia", PIA6821, 0) // actually MC6820
+ MCFG_PIA_WRITEPA_HANDLER(DEVWRITELINE("outgate", input_merger_device, in_w<0>)) MCFG_DEVCB_BIT(0)
+ MCFG_PIA_CB2_HANDLER(WRITELINE(ss50_mpc_device, reader_control_w))
+ MCFG_PIA_READPB_HANDLER(IOPORT("STOP")) MCFG_DEVCB_BIT(6)
+ MCFG_DEVCB_CHAIN_INPUT(READLINE(ss50_mpc_device, count_r)) MCFG_DEVCB_BIT(7)
+ MCFG_PIA_WRITEPB_HANDLER(WRITELINE(ss50_mpc_device, count_select_w)) MCFG_DEVCB_BIT(2)
+ MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(ss50_mpc_device, count_reset_w)) MCFG_DEVCB_BIT(0)
+ //MCFG_PIA_IRQA_HANDLER(WRITELINE(ss50_mpc_device, pia_irq_w))
+ //MCFG_PIA_IRQB_HANDLER(WRITELINE(ss50_mpc_device, pia_irq_w))
+
+ MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal")
+ MCFG_RS232_RXD_HANDLER(WRITELINE(ss50_mpc_device, serial_input_w))
+ MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal)
+
+ MCFG_INPUT_MERGER_ALL_HIGH("outgate")
+ MCFG_INPUT_MERGER_OUTPUT_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd))
+
+ MCFG_INPUT_MERGER_ANY_HIGH("loopback")
+ MCFG_INPUT_MERGER_OUTPUT_HANDLER(DEVWRITELINE("outgate", input_merger_device, in_w<1>))
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void ss50_mpc_device::device_start()
+{
+ save_item(NAME(m_cd4024ae_count));
+ save_item(NAME(m_cd4024ae_clock));
+ save_item(NAME(m_cd4024ae_reset));
+ save_item(NAME(m_count_select));
+}
+
+WRITE_LINE_MEMBER(ss50_mpc_device::serial_input_w)
+{
+ m_pia->set_a_input(state << 7, 0x7f);
+ m_loopback->in_w<0>(state);
+}
+
+
+WRITE_LINE_MEMBER(ss50_mpc_device::reader_control_w)
+{
+ m_loopback->in_w<1>(state);
+}
+
+READ_LINE_MEMBER(ss50_mpc_device::count_r)
+{
+ return BIT(m_cd4024ae_count, m_count_select ? 4 : 3);
+}
+
+WRITE_LINE_MEMBER(ss50_mpc_device::count_reset_w)
+{
+ m_cd4024ae_reset = bool(state);
+ if (state)
+ m_cd4024ae_count = 0;
+}
+
+WRITE_LINE_MEMBER(ss50_mpc_device::count_select_w)
+{
+ m_count_select = bool(state);
+}
+
+WRITE_LINE_MEMBER(ss50_mpc_device::clock_input_w)
+{
+ if (m_cd4024ae_clock != bool(state))
+ {
+ m_cd4024ae_clock = bool(state);
+ if (!state && !m_cd4024ae_reset)
+ m_cd4024ae_count++;
+ }
+}
+
+
+//-------------------------------------------------
+// register_read - read from a port register
+//-------------------------------------------------
+
+READ8_MEMBER(ss50_mpc_device::register_read)
+{
+ return m_pia->read(space, offset & 3, 0);
+}
+
+//-------------------------------------------------
+// register_write - write to a port register
+//-------------------------------------------------
+
+WRITE8_MEMBER(ss50_mpc_device::register_write)
+{
+ m_pia->write(space, offset & 3, data);
+}
+
+WRITE_LINE_MEMBER(ss50_mpc_device::f110_w)
+{
+ if (m_baud_jumper->read())
+ clock_input_w(state);
+}
+
+WRITE_LINE_MEMBER(ss50_mpc_device::f300_w)
+{
+ if (!m_baud_jumper->read())
+ clock_input_w(state);
+}
+
+
+// device type definition
+DEFINE_DEVICE_TYPE(SS50_MPC, ss50_mpc_device, "ss50_mpc", "MP-C Serial Control Interface")
diff --git a/src/devices/bus/ss50/mpc.h b/src/devices/bus/ss50/mpc.h
new file mode 100644
index 00000000000..2e769932b0c
--- /dev/null
+++ b/src/devices/bus/ss50/mpc.h
@@ -0,0 +1,14 @@
+// license:BSD-3-Clause
+// copyright-holders:AJR
+/**********************************************************************
+
+ SWTPC MP-C Serial Control Interface
+
+**********************************************************************/
+
+#ifndef MAME_DEVICE_BUS_SS50_MPC_H
+#define MAME_DEVICE_BUS_SS50_MPC_H
+
+extern const device_type SS50_MPC;
+
+#endif // MAME_DEVICE_BUS_SS50_MPC_H
diff --git a/src/mame/drivers/swtpc.cpp b/src/mame/drivers/swtpc.cpp
index b5626475ebc..cd7acfc2461 100644
--- a/src/mame/drivers/swtpc.cpp
+++ b/src/mame/drivers/swtpc.cpp
@@ -16,8 +16,7 @@
Note: All commands must be in uppercase. See the SWTBUG manual.
ToDo:
- - Add more SS-50 interface slot options (in particular, MIKBUG
- needs MP-C for I/O slot #1)
+ - Add more SS-50 interface slot options
- Emulate MP-A2 revision of CPU board, with four 2716 ROM sockets
and allowance for extra RAM boards at A000-BFFF and C000-DFFF
@@ -182,7 +181,7 @@ static MACHINE_CONFIG_DERIVED( swtpcm, swtpc )
MCFG_DEVICE_CLOCK(XTAL_1_7971MHz)
MCFG_DEVICE_MODIFY("io1")
- //MCFG_SLOT_DEFAULT_OPTION("mpc")
+ MCFG_SLOT_DEFAULT_OPTION("mpc")
MACHINE_CONFIG_END
/* ROM definition */
@@ -200,4 +199,4 @@ ROM_END
// YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS
COMP( 1977, swtpc, 0, 0, swtpc, swtpc, swtpc_state, 0, "Southwest Technical Products Corporation", "SWTPC 6800 Computer System (with SWTBUG)", MACHINE_NO_SOUND_HW )
-COMP( 1975, swtpcm, swtpc, 0, swtpcm, swtpc, swtpc_state, 0, "Southwest Technical Products Corporation", "SWTPC 6800 Computer System (with MIKBUG)", MACHINE_NO_SOUND_HW | MACHINE_NOT_WORKING )
+COMP( 1975, swtpcm, swtpc, 0, swtpcm, swtpc, swtpc_state, 0, "Southwest Technical Products Corporation", "SWTPC 6800 Computer System (with MIKBUG)", MACHINE_NO_SOUND_HW )