summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2018-02-13 15:39:12 -0500
committer GitHub <noreply@github.com>2018-02-13 15:39:12 -0500
commit77aff96456d7fef60ac280f0cdc6522806468db4 (patch)
treed2129f22dd7b1f826fe4dbff03a8e3e2d07a796d
parent0d07a64a7ad59770a1894908897ee7fc543821e5 (diff)
parent8fef96dbd98b79ab491175a56c8b10c44433d434 (diff)
Merge pull request #3200 from shattered/_52dde1d
agat7: add serial/parallel interface card, hardcoded into Agat-Author configuration for now.
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/a2bus/agat7ports.cpp194
-rw-r--r--src/devices/bus/a2bus/agat7ports.h64
-rw-r--r--src/mame/drivers/agat.cpp5
4 files changed, 263 insertions, 2 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index b9864626a51..34938cbe34d 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -1830,6 +1830,8 @@ if (BUSES["A2BUS"]~=null) then
MAME_DIR .. "src/devices/bus/a2bus/pc_xporter.h",
MAME_DIR .. "src/devices/bus/a2bus/agat7langcard.cpp",
MAME_DIR .. "src/devices/bus/a2bus/agat7langcard.h",
+ MAME_DIR .. "src/devices/bus/a2bus/agat7ports.cpp",
+ MAME_DIR .. "src/devices/bus/a2bus/agat7ports.h",
MAME_DIR .. "src/devices/bus/a2bus/agat7ram.cpp",
MAME_DIR .. "src/devices/bus/a2bus/agat7ram.h",
MAME_DIR .. "src/devices/bus/a2bus/agat840k_hle.cpp",
diff --git a/src/devices/bus/a2bus/agat7ports.cpp b/src/devices/bus/a2bus/agat7ports.cpp
new file mode 100644
index 00000000000..242fd619783
--- /dev/null
+++ b/src/devices/bus/a2bus/agat7ports.cpp
@@ -0,0 +1,194 @@
+// license:BSD-3-Clause
+// copyright-holders:Sergey Svishchev
+/*********************************************************************
+
+ agat7_ports.c
+
+ Implementation of the Agat-7 ports card (part number 3.089.106),
+ configured as a printer port for Agat-Author text editor.
+
+ To do: other configurations, if any.
+
+ References:
+ http://agatcomp.ru/Reading/ebooks-IKP-KPON/KPON.9/V1/AGAWT/SPT:prilojenie2.shtml
+
+*********************************************************************/
+
+#include "agat7ports.h"
+
+//#define VERBOSE 1
+#include "logmacro.h"
+
+/***************************************************************************
+ PARAMETERS
+***************************************************************************/
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+DEFINE_DEVICE_TYPE(A2BUS_AGAT7_PORTS, a2bus_agat7_ports_device, "a7ports", "Agat-7 Ports Card")
+
+static INPUT_PORTS_START( agat_author )
+ PORT_START("PRINTER_CFG")
+ PORT_BIT( 0xd9, 0x00, IPT_UNUSED )
+ PORT_DIPNAME( 0x02, 0x00, "Printer command set")
+ PORT_DIPSETTING( 0x00, "CPA-80/FX-85/Gemini" )
+ PORT_DIPSETTING( 0x02, "Mera D100" )
+ PORT_DIPNAME( 0x24, 0x00, "Printer character set")
+ PORT_DIPSETTING( 0x00, "KOI-8" )
+ PORT_DIPSETTING( 0x04, "GOST" )
+ PORT_DIPSETTING( 0x20, "CPA-80" )
+ PORT_DIPSETTING( 0x24, "FX-85" )
+INPUT_PORTS_END
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+//-------------------------------------------------
+// device_add_mconfig - add device configuration
+//-------------------------------------------------
+
+MACHINE_CONFIG_START(a2bus_agat7_ports_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("d9", I8255, 0)
+ MCFG_I8255_OUT_PORTA_CB(DEVWRITE8("cent_data_out", output_latch_device, write))
+ MCFG_I8255_OUT_PORTB_CB(WRITE8(a2bus_agat7_ports_device, write_portb))
+ MCFG_I8255_IN_PORTC_CB(READ8(a2bus_agat7_ports_device, read_portc))
+
+ MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer")
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(a2bus_agat7_ports_device, write_centronics_busy))
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
+
+ MCFG_DEVICE_ADD("d10", I8251, 0)
+MACHINE_CONFIG_END
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor a2bus_agat7_ports_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME(agat_author);
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+a2bus_agat7_ports_device::a2bus_agat7_ports_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, type, tag, owner, clock)
+ , device_a2bus_card_interface(mconfig, *this)
+ , m_d9(*this, "d9")
+ , m_d10(*this, "d10")
+ , m_centronics(*this, "centronics")
+{
+}
+
+a2bus_agat7_ports_device::a2bus_agat7_ports_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ a2bus_agat7_ports_device(mconfig, A2BUS_AGAT7_PORTS, tag, owner, clock)
+{
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void a2bus_agat7_ports_device::device_start()
+{
+ save_item(NAME(m_centronics_busy));
+}
+
+void a2bus_agat7_ports_device::device_reset()
+{
+ m_centronics_busy = false;
+}
+
+/*-------------------------------------------------
+ read_c0nx - called for reads from this card's c0nx space
+-------------------------------------------------*/
+
+uint8_t a2bus_agat7_ports_device::read_c0nx(uint8_t offset)
+{
+ u8 data = 0xff;
+
+ switch (offset & 8)
+ {
+ case 0:
+ data = m_d9->read(machine().dummy_space(), offset & 3);
+ break;
+
+ case 8:
+ if (offset & 1)
+ {
+ data = m_d10->status_r(machine().dummy_space(), 0);
+ }
+ else
+ {
+ data = m_d10->data_r(machine().dummy_space(), 0);
+ }
+ break;
+ }
+
+ return data;
+}
+
+
+/*-------------------------------------------------
+ write_c0nx - called for writes to this card's c0nx space
+-------------------------------------------------*/
+
+void a2bus_agat7_ports_device::write_c0nx(uint8_t offset, uint8_t data)
+{
+ switch (offset & 8)
+ {
+ case 0:
+ m_d9->write(machine().dummy_space(), offset & 3, data);
+ break;
+
+ case 8:
+ if (offset & 1)
+ {
+ m_d10->control_w(machine().dummy_space(), 0, data);
+ }
+ else
+ {
+ m_d10->data_w(machine().dummy_space(), 0, data);
+ }
+ break;
+ }
+}
+
+/*
+ * 0 ODD
+ * 1 EVEN
+ * 4 INIT
+ * 5 STROBE
+ * 6 /INIT
+ * 7 /STROBE
+ */
+WRITE8_MEMBER(a2bus_agat7_ports_device::write_portb)
+{
+ m_centronics->write_strobe(BIT(data, 5));
+ m_centronics->write_init(BIT(data, 4));
+}
+
+/*
+ * 1 dip CNTRLESC (0: CPA-80, FX-85, Gemini. 1: D100)
+ * 2 dip ALF0
+ * 3 dip A/BR (0: level, BUSY/READY. 1: edge, ACK)
+ * 4 dip INVD (1: data are sent inverted)
+ * 5 dip ALF1 (00: KOI-8, 01: GOST, 10: CPA-80, 11: FX-85)
+ * 6 dip ABRLEV (0: BUSY, /ACK. 1: READY, ACK)
+ * 7 ready signal from device
+ */
+READ8_MEMBER(a2bus_agat7_ports_device::read_portc)
+{
+ return (m_centronics_busy << 7) | ioport("PRINTER_CFG")->read();
+}
+
+WRITE_LINE_MEMBER(a2bus_agat7_ports_device::write_centronics_busy)
+{
+ m_centronics_busy = state;
+}
diff --git a/src/devices/bus/a2bus/agat7ports.h b/src/devices/bus/a2bus/agat7ports.h
new file mode 100644
index 00000000000..1988b1df524
--- /dev/null
+++ b/src/devices/bus/a2bus/agat7ports.h
@@ -0,0 +1,64 @@
+// license:BSD-3-Clause
+// copyright-holders:Sergey Svishchev
+/*********************************************************************
+
+ agat7_ports.h
+
+ Implementation of the Agat-7 ports card (decimal 3.089.106)
+
+*********************************************************************/
+
+#ifndef MAME_BUS_A2BUS_AGAT7_PORTS_H
+#define MAME_BUS_A2BUS_AGAT7_PORTS_H
+
+#pragma once
+
+#include "emu.h"
+#include "a2bus.h"
+
+#include "bus/centronics/ctronics.h"
+#include "bus/rs232/rs232.h"
+#include "machine/i8251.h"
+#include "machine/i8255.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class a2bus_agat7_ports_device:
+ public device_t,
+ public device_a2bus_card_interface
+{
+public:
+ // construction/destruction
+ a2bus_agat7_ports_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ a2bus_agat7_ports_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
+ 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;
+
+ // overrides of standard a2bus slot functions
+ virtual uint8_t read_c0nx(uint8_t offset) override;
+ virtual void write_c0nx(uint8_t offset, uint8_t data) override;
+
+ required_device<i8255_device> m_d9;
+ required_device<i8251_device> m_d10;
+ required_device<centronics_device> m_centronics;
+
+ DECLARE_WRITE8_MEMBER(write_portb);
+ DECLARE_READ8_MEMBER(read_portc);
+ DECLARE_WRITE_LINE_MEMBER(write_centronics_busy);
+
+private:
+ bool m_centronics_busy;
+};
+
+// device type definition
+extern const device_type A2BUS_AGAT7_PORTS;
+DECLARE_DEVICE_TYPE(A2BUS_AGAT7_PORTS, a2bus_agat7_ports_device)
+
+#endif // MAME_BUS_A2BUS_AGAT7_PORTS_H
diff --git a/src/mame/drivers/agat.cpp b/src/mame/drivers/agat.cpp
index ac1576c3b59..e86bbaf13c9 100644
--- a/src/mame/drivers/agat.cpp
+++ b/src/mame/drivers/agat.cpp
@@ -59,6 +59,7 @@
#include "bus/a2bus/a2diskii.h"
#include "bus/a2bus/agat7langcard.h"
+#include "bus/a2bus/agat7ports.h"
#include "bus/a2bus/agat7ram.h"
#include "bus/a2bus/agat840k_hle.h"
@@ -1060,7 +1061,7 @@ static SLOT_INTERFACE_START(agat7_cards)
SLOT_INTERFACE("a7ram", A2BUS_AGAT7RAM) // Agat-7 32K RAM Card -- decimal 3.089.119-01, KR565RU6D chips
SLOT_INTERFACE("a7fdc", A2BUS_AGAT7_FDC) // Disk II clone -- decimal 3.089.105
SLOT_INTERFACE("a7fdc840", A2BUS_AGAT840K_HLE) // 840K floppy controller -- decimal 7.104.351 or 3.089.023?
- // Serial-parallel card -- decimal 3.089.106
+ SLOT_INTERFACE("a7ports", A2BUS_AGAT7_PORTS) // Serial-parallel card -- decimal 3.089.106
// Printer card (agat9) -- decimal 3.089.174
// 3rd party cards
@@ -1128,7 +1129,7 @@ MACHINE_CONFIG_START(agat7_state::agat7)
MCFG_A2BUS_OUT_INH_CB(WRITELINE(agat7_state, a2bus_inh_w))
MCFG_A2BUS_SLOT_ADD(A7_BUS_TAG, "sl2", agat7_cards, "a7lang")
MCFG_A2BUS_SLOT_ADD(A7_BUS_TAG, "sl3", agat7_cards, "a7fdc")
- MCFG_A2BUS_SLOT_ADD(A7_BUS_TAG, "sl4", agat7_cards, nullptr)
+ MCFG_A2BUS_SLOT_ADD(A7_BUS_TAG, "sl4", agat7_cards, "a7ports")
MCFG_A2BUS_SLOT_ADD(A7_BUS_TAG, "sl5", agat7_cards, nullptr)
MCFG_A2BUS_SLOT_ADD(A7_BUS_TAG, "sl6", agat7_cards, "a7ram")