summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Sandro Ronco <sandro.ronco@gmx.com>2014-11-22 19:53:39 +0100
committer Sandro Ronco <sandro.ronco@gmx.com>2014-11-22 19:53:39 +0100
commit69f497576cf2bf784133cefb24b35dc3a86ac334 (patch)
treea7f927c5ceb21d910add8b0df853eac474d2f980
parentb87a286a4dc9a4a611a247a0616eeb7c8a8f3b1f (diff)
(MESS) dmv: add support for K210 and K801 modules. (nw)
-rw-r--r--src/emu/bus/bus.mak2
-rw-r--r--src/emu/bus/dmv/k210.c166
-rw-r--r--src/emu/bus/dmv/k210.h71
-rw-r--r--src/emu/bus/dmv/k220.c4
-rw-r--r--src/emu/bus/dmv/k801.c280
-rw-r--r--src/emu/bus/dmv/k801.h106
-rw-r--r--src/mess/drivers/dmv.c61
7 files changed, 688 insertions, 2 deletions
diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak
index c9bf3b24006..7cb303b6204 100644
--- a/src/emu/bus/bus.mak
+++ b/src/emu/bus/bus.mak
@@ -330,9 +330,11 @@ endif
ifneq ($(filter DMV,$(BUSES)),)
OBJDIRS += $(BUSOBJ)/dmv
BUSOBJS += $(BUSOBJ)/dmv/dmvbus.o
+BUSOBJS += $(BUSOBJ)/dmv/k210.o
BUSOBJS += $(BUSOBJ)/dmv/k220.o
BUSOBJS += $(BUSOBJ)/dmv/k230.o
BUSOBJS += $(BUSOBJ)/dmv/k233.o
+BUSOBJS += $(BUSOBJ)/dmv/k801.o
BUSOBJS += $(BUSOBJ)/dmv/k803.o
BUSOBJS += $(BUSOBJ)/dmv/k806.o
BUSOBJS += $(BUSOBJ)/dmv/ram.o
diff --git a/src/emu/bus/dmv/k210.c b/src/emu/bus/dmv/k210.c
new file mode 100644
index 00000000000..0b0e86fb27a
--- /dev/null
+++ b/src/emu/bus/dmv/k210.c
@@ -0,0 +1,166 @@
+// license:BSD-3-Clause
+// copyright-holders:Sandro Ronco
+/***************************************************************************
+
+ K210 Centronics module
+
+***************************************************************************/
+
+#include "emu.h"
+#include "k210.h"
+
+/***************************************************************************
+ IMPLEMENTATION
+***************************************************************************/
+
+
+static MACHINE_CONFIG_FRAGMENT( dmv_k210 )
+ MCFG_DEVICE_ADD("ppi8255", I8255, 0)
+ MCFG_I8255_IN_PORTA_CB(READ8(dmv_k210_device, porta_r))
+ MCFG_I8255_IN_PORTB_CB(READ8(dmv_k210_device, portb_r))
+ MCFG_I8255_IN_PORTC_CB(READ8(dmv_k210_device, portc_r))
+ MCFG_I8255_OUT_PORTA_CB(WRITE8(dmv_k210_device, porta_w))
+ MCFG_I8255_OUT_PORTB_CB(WRITE8(dmv_k210_device, portb_w))
+ MCFG_I8255_OUT_PORTC_CB(WRITE8(dmv_k210_device, portc_w))
+
+ MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer")
+ MCFG_CENTRONICS_DATA_INPUT_BUFFER("cent_data_in")
+ MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(dmv_k210_device, cent_ack_w))
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(dmv_k210_device, cent_busy_w))
+ MCFG_CENTRONICS_SELECT_IN_HANDLER(WRITELINE(dmv_k210_device, cent_slct_w))
+ MCFG_CENTRONICS_PERROR_HANDLER(WRITELINE(dmv_k210_device, cent_pe_w))
+ MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(dmv_k210_device, cent_fault_w))
+ MCFG_CENTRONICS_AUTOFD_HANDLER(WRITELINE(dmv_k210_device, cent_autofd_w))
+ MCFG_CENTRONICS_INIT_HANDLER(WRITELINE(dmv_k210_device, cent_init_w))
+
+ MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0)
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
+MACHINE_CONFIG_END
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type DMV_K210 = &device_creator<dmv_k210_device>;
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// dmv_k210_device - constructor
+//-------------------------------------------------
+
+dmv_k210_device::dmv_k210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, DMV_K210, "K210 Centronics", tag, owner, clock, "dmv_k210", __FILE__),
+ device_dmvslot_interface( mconfig, *this ),
+ m_ppi(*this, "ppi8255"),
+ m_centronics(*this, "centronics"),
+ m_cent_data_in(*this, "cent_data_in"),
+ m_cent_data_out(*this, "cent_data_out")
+{
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void dmv_k210_device::device_start()
+{
+ m_clk1_timer = timer_alloc(0, NULL);
+ m_bus = static_cast<dmvcart_slot_device*>(owner());
+}
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void dmv_k210_device::device_reset()
+{
+ m_clk1_timer->adjust(attotime::never);
+ m_portb = 0x00;
+ m_portc = 0x00;
+}
+
+//-------------------------------------------------
+// device_timer - handler timer events
+//-------------------------------------------------
+
+void dmv_k210_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
+{
+ m_centronics->write_strobe(CLEAR_LINE);
+}
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor dmv_k210_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( dmv_k210 );
+}
+
+void dmv_k210_device::io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data)
+{
+ if (ifsel == 0)
+ data = m_ppi->read(space, offset & 0x03);
+}
+
+void dmv_k210_device::io_write(address_space &space, int ifsel, offs_t offset, UINT8 data)
+{
+ if (ifsel == 0)
+ m_ppi->write(space, offset & 0x03, data);
+}
+
+READ8_MEMBER( dmv_k210_device::porta_r )
+{
+ return m_cent_data_in->read();
+}
+
+READ8_MEMBER( dmv_k210_device::portb_r )
+{
+ return m_portb;
+}
+
+READ8_MEMBER( dmv_k210_device::portc_r )
+{
+ return m_portc;
+}
+
+WRITE8_MEMBER( dmv_k210_device::porta_w )
+{
+ m_cent_data_out->write(data);
+}
+
+WRITE8_MEMBER( dmv_k210_device::portb_w )
+{
+ m_centronics->write_ack(BIT(data, 2));
+ m_centronics->write_select(BIT(data, 4));
+ m_centronics->write_busy(BIT(data, 5));
+ m_centronics->write_perror(BIT(data, 6));
+ m_centronics->write_fault(BIT(data, 7));
+}
+
+WRITE8_MEMBER( dmv_k210_device::portc_w )
+{
+ if (!(data & 0x80))
+ {
+ m_centronics->write_strobe(ASSERT_LINE);
+ m_clk1_timer->adjust(attotime::from_hz(XTAL_1MHz));
+ }
+
+ m_centronics->write_init(!BIT(data, 1));
+ m_centronics->write_autofd(!BIT(data, 2));
+ m_centronics->write_ack(BIT(data, 6));
+ m_bus->m_out_irq_cb(BIT(data, 3));
+}
+
+WRITE_LINE_MEMBER( dmv_k210_device::cent_ack_w ) { if (state) m_portb |= 0x04; else m_portb &= ~0x04; m_ppi->pc6_w(state); }
+WRITE_LINE_MEMBER( dmv_k210_device::cent_slct_w ) { if (state) m_portb |= 0x10; else m_portb &= ~0x10; }
+WRITE_LINE_MEMBER( dmv_k210_device::cent_busy_w ) { if (state) m_portb |= 0x20; else m_portb &= ~0x20; }
+WRITE_LINE_MEMBER( dmv_k210_device::cent_pe_w ) { if (state) m_portb |= 0x40; else m_portb &= ~0x40; }
+WRITE_LINE_MEMBER( dmv_k210_device::cent_fault_w ) { if (state) m_portb |= 0x80; else m_portb &= ~0x80; }
+
+WRITE_LINE_MEMBER( dmv_k210_device::cent_autofd_w ) { if (state) m_portc |= 0x02; else m_portc &= ~0x02; }
+WRITE_LINE_MEMBER( dmv_k210_device::cent_init_w ) { if (state) m_portc |= 0x04; else m_portc &= ~0x04; }
diff --git a/src/emu/bus/dmv/k210.h b/src/emu/bus/dmv/k210.h
new file mode 100644
index 00000000000..705e1afe978
--- /dev/null
+++ b/src/emu/bus/dmv/k210.h
@@ -0,0 +1,71 @@
+// license:BSD-3-Clause
+// copyright-holders:Sandro Ronco
+#pragma once
+
+#ifndef __DMV_K210_H__
+#define __DMV_K210_H__
+
+#include "emu.h"
+#include "dmvbus.h"
+#include "machine/i8255.h"
+#include "bus/centronics/ctronics.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> dmv_k210_device
+
+class dmv_k210_device :
+ public device_t,
+ public device_dmvslot_interface
+{
+public:
+ // construction/destruction
+ dmv_k210_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ DECLARE_READ8_MEMBER(porta_r);
+ DECLARE_READ8_MEMBER(portb_r);
+ DECLARE_READ8_MEMBER(portc_r);
+ DECLARE_WRITE8_MEMBER(porta_w);
+ DECLARE_WRITE8_MEMBER(portb_w);
+ DECLARE_WRITE8_MEMBER(portc_w);
+
+ DECLARE_WRITE_LINE_MEMBER(cent_ack_w);
+ DECLARE_WRITE_LINE_MEMBER(cent_busy_w);
+ DECLARE_WRITE_LINE_MEMBER(cent_slct_w);
+ DECLARE_WRITE_LINE_MEMBER(cent_pe_w);
+ DECLARE_WRITE_LINE_MEMBER(cent_fault_w);
+ DECLARE_WRITE_LINE_MEMBER(cent_autofd_w);
+ DECLARE_WRITE_LINE_MEMBER(cent_init_w);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+ void device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr);
+
+ // dmvcart_interface overrides
+ virtual void io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data);
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, UINT8 data);
+
+private:
+ required_device<i8255_device> m_ppi;
+ required_device<centronics_device> m_centronics;
+ required_device<input_buffer_device> m_cent_data_in;
+ required_device<output_latch_device> m_cent_data_out;
+ dmvcart_slot_device * m_bus;
+
+ emu_timer * m_clk1_timer;
+ UINT8 m_portb;
+ UINT8 m_portc;
+};
+
+
+// device type definition
+extern const device_type DMV_K210;
+
+#endif /* __DMV_K210_H__ */
diff --git a/src/emu/bus/dmv/k220.c b/src/emu/bus/dmv/k220.c
index 487b87e37ae..d3cc4be9971 100644
--- a/src/emu/bus/dmv/k220.c
+++ b/src/emu/bus/dmv/k220.c
@@ -233,7 +233,7 @@ WRITE8_MEMBER( dmv_k220_device::porta_w )
output_set_digit_value(0, bcd2hex[(data >> 4) & 0x0f]);
output_set_digit_value(1, bcd2hex[data & 0x0f]);
-};
+}
WRITE8_MEMBER( dmv_k220_device::portc_w )
@@ -250,7 +250,7 @@ WRITE8_MEMBER( dmv_k220_device::portc_w )
m_pit->write_gate2(BIT(data, 3));
m_portc = data;
-};
+}
WRITE_LINE_MEMBER( dmv_k220_device::write_out0 )
diff --git a/src/emu/bus/dmv/k801.c b/src/emu/bus/dmv/k801.c
new file mode 100644
index 00000000000..b091d117088
--- /dev/null
+++ b/src/emu/bus/dmv/k801.c
@@ -0,0 +1,280 @@
+// license:BSD-3-Clause
+// copyright-holders:Sandro Ronco
+/***************************************************************************
+
+ K801 RS-232 Switchable Interface
+ K211 RS-232 Communications Interface
+ K212 RS-232 Printer Interface
+ K213 RS-232 Plotter Interface
+
+ K211, K212 and K213 have same board, but different cables.
+ K801 uses a 2661 instead of the 2651 and has 4 switches for
+ select the IFSEL.
+
+***************************************************************************/
+
+#include "emu.h"
+#include "k801.h"
+
+/***************************************************************************
+ IMPLEMENTATION
+***************************************************************************/
+
+
+static MACHINE_CONFIG_FRAGMENT( dmv_k801 )
+ MCFG_DEVICE_ADD("epci", MC2661, XTAL_5_0688MHz)
+ MCFG_MC2661_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd))
+ MCFG_MC2661_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts))
+ MCFG_MC2661_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr))
+ MCFG_MC2661_RXRDY_HANDLER(WRITELINE(dmv_k801_device, epci_irq_w))
+ MCFG_MC2661_TXRDY_HANDLER(WRITELINE(dmv_k801_device, epci_irq_w))
+
+ MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "printer")
+ MCFG_RS232_RXD_HANDLER(DEVWRITELINE("epci", mc2661_device, rx_w))
+ MCFG_RS232_DCD_HANDLER(DEVWRITELINE("epci", mc2661_device, dcd_w))
+ MCFG_RS232_DSR_HANDLER(DEVWRITELINE("epci", mc2661_device, dsr_w))
+ MCFG_RS232_CTS_HANDLER(DEVWRITELINE("epci", mc2661_device, cts_w))
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_FRAGMENT( dmv_k211 )
+ MCFG_FRAGMENT_ADD( dmv_k801 )
+
+ MCFG_DEVICE_MODIFY("rs232")
+ MCFG_SLOT_DEFAULT_OPTION("null_modem")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_FRAGMENT( dmv_k212 )
+ MCFG_FRAGMENT_ADD( dmv_k801 )
+
+ MCFG_DEVICE_MODIFY("rs232")
+ MCFG_SLOT_DEFAULT_OPTION("printer")
+MACHINE_CONFIG_END
+
+static MACHINE_CONFIG_FRAGMENT( dmv_k213 )
+ MCFG_FRAGMENT_ADD( dmv_k801 )
+
+ MCFG_DEVICE_MODIFY("rs232")
+ MCFG_SLOT_DEFAULT_OPTION(NULL)
+MACHINE_CONFIG_END
+
+static INPUT_PORTS_START( dmv_k801 )
+ PORT_START("DSW")
+ PORT_DIPNAME( 0x0f, 0x00, "K801 IFSEL" ) PORT_DIPLOCATION("S:!4,S:!3,S:!2,S:!1")
+ PORT_DIPSETTING( 0x00, "0A" )
+ PORT_DIPSETTING( 0x01, "0B" )
+ PORT_DIPSETTING( 0x02, "1A" )
+ PORT_DIPSETTING( 0x03, "1B" )
+ PORT_DIPSETTING( 0x04, "2A" )
+ PORT_DIPSETTING( 0x05, "2B" )
+ PORT_DIPSETTING( 0x06, "3A" )
+ PORT_DIPSETTING( 0x07, "3B" )
+ PORT_DIPSETTING( 0x08, "4A" )
+ PORT_DIPSETTING( 0x09, "4B" )
+INPUT_PORTS_END
+
+static INPUT_PORTS_START( dmv_k211 )
+ PORT_START("DSW")
+ PORT_DIPNAME( 0x03, 0x02, "K211 Jumpers" ) PORT_DIPLOCATION("J:1,J:2")
+ PORT_DIPSETTING( 0x01, "IFSEL 0" )
+ PORT_DIPSETTING( 0x02, "IFSEL 1" )
+INPUT_PORTS_END
+
+static INPUT_PORTS_START( dmv_k212 )
+ PORT_START("DSW")
+ PORT_DIPNAME( 0x03, 0x01, "K212 Jumpers" ) PORT_DIPLOCATION("J:1,J:2")
+ PORT_DIPSETTING( 0x01, "IFSEL 0" )
+ PORT_DIPSETTING( 0x02, "IFSEL 1" )
+INPUT_PORTS_END
+
+static INPUT_PORTS_START( dmv_k213 )
+ PORT_START("DSW")
+ PORT_DIPNAME( 0x03, 0x01, "K213 Jumpers" ) PORT_DIPLOCATION("J:1,J:2")
+ PORT_DIPSETTING( 0x01, "IFSEL 0" )
+ PORT_DIPSETTING( 0x02, "IFSEL 1" )
+INPUT_PORTS_END
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type DMV_K801 = &device_creator<dmv_k801_device>;
+const device_type DMV_K211 = &device_creator<dmv_k211_device>;
+const device_type DMV_K212 = &device_creator<dmv_k212_device>;
+const device_type DMV_K213 = &device_creator<dmv_k213_device>;
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// dmv_k801_device - constructor
+//-------------------------------------------------
+
+dmv_k801_device::dmv_k801_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, DMV_K801, "K801 RS-232 Switchable Interface", tag, owner, clock, "dmv_k801", __FILE__),
+ device_dmvslot_interface( mconfig, *this ),
+ m_epci(*this, "epci"),
+ m_dsw(*this, "DSW")
+{
+}
+
+dmv_k801_device::dmv_k801_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
+ : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
+ device_dmvslot_interface( mconfig, *this ),
+ m_epci(*this, "epci"),
+ m_dsw(*this, "DSW")
+{
+}
+
+//-------------------------------------------------
+// dmv_k211_device - constructor
+//-------------------------------------------------
+
+dmv_k211_device::dmv_k211_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : dmv_k801_device(mconfig, DMV_K211, "K211 RS-232 Communications Interface", tag, owner, clock, "dmv_k211", __FILE__)
+{
+}
+
+
+dmv_k211_device::dmv_k211_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
+ : dmv_k801_device(mconfig, type, name, tag, owner, clock, shortname, source)
+{
+}
+
+//-------------------------------------------------
+// dmv_k212_device - constructor
+//-------------------------------------------------
+
+dmv_k212_device::dmv_k212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : dmv_k211_device(mconfig, DMV_K212, "K212 RS-232 Printer Interface", tag, owner, clock, "dmv_k212", __FILE__)
+{
+}
+
+//-------------------------------------------------
+// dmv_k213_device - constructor
+//-------------------------------------------------
+
+dmv_k213_device::dmv_k213_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : dmv_k211_device(mconfig, DMV_K213, "K213 RS-232 Plotter Interface", tag, owner, clock, "dmv_k213", __FILE__)
+{
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void dmv_k801_device::device_start()
+{
+ m_bus = static_cast<dmvcart_slot_device*>(owner());
+}
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void dmv_k801_device::device_reset()
+{
+}
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor dmv_k801_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( dmv_k801 );
+}
+
+machine_config_constructor dmv_k211_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( dmv_k211 );
+}
+
+machine_config_constructor dmv_k212_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( dmv_k212 );
+}
+
+machine_config_constructor dmv_k213_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( dmv_k213 );
+}
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor dmv_k801_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( dmv_k801 );
+}
+
+ioport_constructor dmv_k211_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( dmv_k211 );
+}
+
+ioport_constructor dmv_k212_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( dmv_k212 );
+}
+
+ioport_constructor dmv_k213_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( dmv_k213 );
+}
+
+WRITE_LINE_MEMBER(dmv_k801_device::epci_irq_w)
+{
+ m_bus->m_out_irq_cb(state);
+}
+
+void dmv_k801_device::io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data)
+{
+ UINT8 dsw = m_dsw->read() & 0x0f;
+ if ((dsw >> 1) == ifsel && BIT(offset, 3) == BIT(dsw, 0))
+ {
+ if (offset & 0x04)
+ m_epci->write(space, offset & 0x03, data);
+ else
+ data = m_epci->read(space, offset & 0x03);
+ }
+}
+
+void dmv_k801_device::io_write(address_space &space, int ifsel, offs_t offset, UINT8 data)
+{
+ UINT8 dsw = m_dsw->read() & 0x0f;
+ if ((dsw >> 1) == ifsel && BIT(offset, 3) == BIT(dsw, 0))
+ {
+ if (offset & 0x04)
+ m_epci->write(space, offset & 0x03, data);
+ else
+ data = m_epci->read(space, offset & 0x03);
+ }
+}
+
+void dmv_k211_device::io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data)
+{
+ UINT8 jumpers = m_dsw->read() & 0x03;
+ if ((BIT(jumpers, 0) && ifsel == 0) || (BIT(jumpers, 1) && ifsel == 1))
+ {
+ if (offset & 0x04)
+ m_epci->write(space, offset & 0x03, data);
+ else
+ data = m_epci->read(space, offset & 0x03);
+ }
+}
+
+void dmv_k211_device::io_write(address_space &space, int ifsel, offs_t offset, UINT8 data)
+{
+ UINT8 jumpers = m_dsw->read() & 0x03;
+ if ((BIT(jumpers, 0) && ifsel == 0) || (BIT(jumpers, 1) && ifsel == 1))
+ {
+ if (offset & 0x04)
+ m_epci->write(space, offset & 0x03, data);
+ else
+ data = m_epci->read(space, offset & 0x03);
+ }
+}
diff --git a/src/emu/bus/dmv/k801.h b/src/emu/bus/dmv/k801.h
new file mode 100644
index 00000000000..9ad8489a4c2
--- /dev/null
+++ b/src/emu/bus/dmv/k801.h
@@ -0,0 +1,106 @@
+// license:BSD-3-Clause
+// copyright-holders:Sandro Ronco
+#pragma once
+
+#ifndef __DMV_K801_H__
+#define __DMV_K801_H__
+
+#include "emu.h"
+#include "dmvbus.h"
+#include "machine/mc2661.h"
+#include "bus/rs232/rs232.h"
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> dmv_k801_device
+
+class dmv_k801_device :
+ public device_t,
+ public device_dmvslot_interface
+{
+public:
+ // construction/destruction
+ dmv_k801_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ dmv_k801_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ DECLARE_WRITE_LINE_MEMBER(epci_irq_w);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // dmvcart_interface overrides
+ virtual void io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data);
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, UINT8 data);
+
+protected:
+ required_device<mc2661_device> m_epci;
+ required_ioport m_dsw;
+ dmvcart_slot_device * m_bus;
+};
+
+
+// ======================> dmv_k211_device
+
+class dmv_k211_device :
+ public dmv_k801_device
+{
+public:
+ // construction/destruction
+ dmv_k211_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ dmv_k211_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // dmvcart_interface overrides
+ virtual void io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data);
+ virtual void io_write(address_space &space, int ifsel, offs_t offset, UINT8 data);
+};
+
+// ======================> dmv_k212_device
+
+class dmv_k212_device :
+ public dmv_k211_device
+{
+public:
+ // construction/destruction
+ dmv_k212_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+};
+
+// ======================> dmv_k213_device
+
+class dmv_k213_device :
+ public dmv_k211_device
+{
+public:
+ // construction/destruction
+ dmv_k213_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+};
+
+
+// device type definition
+extern const device_type DMV_K801;
+extern const device_type DMV_K211;
+extern const device_type DMV_K212;
+extern const device_type DMV_K213;
+
+#endif /* __DMV_K801_H__ */
diff --git a/src/mess/drivers/dmv.c b/src/mess/drivers/dmv.c
index a2da0033da1..9d64ca8f894 100644
--- a/src/mess/drivers/dmv.c
+++ b/src/mess/drivers/dmv.c
@@ -22,9 +22,11 @@
// expansion slots
#include "bus/dmv/dmvbus.h"
+#include "bus/dmv/k210.h"
#include "bus/dmv/k220.h"
#include "bus/dmv/k230.h"
#include "bus/dmv/k233.h"
+#include "bus/dmv/k801.h"
#include "bus/dmv/k803.h"
#include "bus/dmv/k806.h"
#include "bus/dmv/ram.h"
@@ -126,6 +128,16 @@ public:
DECLARE_WRITE_LINE_MEMBER(busint7_w) { update_busint(6, state); }
DECLARE_WRITE_LINE_MEMBER(busint7a_w) { update_busint(7, state); }
+ void update_irqs(int slot, int state);
+ DECLARE_WRITE_LINE_MEMBER(irq2_w) { update_irqs(0, state); }
+ DECLARE_WRITE_LINE_MEMBER(irq2a_w) { update_irqs(1, state); }
+ DECLARE_WRITE_LINE_MEMBER(irq3_w) { update_irqs(2, state); }
+ DECLARE_WRITE_LINE_MEMBER(irq4_w) { update_irqs(3, state); }
+ DECLARE_WRITE_LINE_MEMBER(irq5_w) { update_irqs(4, state); }
+ DECLARE_WRITE_LINE_MEMBER(irq6_w) { update_irqs(5, state); }
+ DECLARE_WRITE_LINE_MEMBER(irq7_w) { update_irqs(6, state); }
+ DECLARE_WRITE_LINE_MEMBER(irq7a_w) { update_irqs(7, state); }
+
DECLARE_FLOPPY_FORMATS( floppy_formats );
UINT8 program_read(address_space &space, int cas, offs_t offset);
@@ -158,6 +170,7 @@ public:
int m_sd_poll_state;
int m_floppy_motor;
int m_busint[8];
+ int m_irqs[8];
};
WRITE8_MEMBER(dmv_state::tc_set_w)
@@ -256,6 +269,15 @@ READ8_MEMBER(dmv_state::sys_status_r)
if (m_fdc->get_irq())
data |= 0x08;
+ if (m_irqs[3])
+ data |= 0x10; // IRQ 4
+
+ if (m_irqs[2])
+ data |= 0x20; // IRQ 3
+
+ if (m_irqs[0])
+ data |= 0x40; // IRQ 2
+
return data;
}
@@ -405,6 +427,31 @@ void dmv_state::update_busint(int slot, int state)
m_maincpu->set_input_line(0, new_state);
}
+void dmv_state::update_irqs(int slot, int state)
+{
+ m_irqs[slot] = state;
+
+ switch(slot)
+ {
+ case 1: // slot 2a
+ m_slot7->irq5_w(state);
+ m_slot7a->irq5_w(state);
+ break;
+ case 2: // slot 3
+ m_slot7->irq3_w(state);
+ m_slot7a->irq3_w(state);
+ break;
+ case 3: // slot 4
+ m_slot7->irq4_w(state);
+ m_slot7a->irq4_w(state);
+ break;
+ case 4: // slot 5
+ m_slot7->irq7_w(state);
+ m_slot7a->irq7_w(state);
+ break;
+ }
+}
+
void dmv_state::program_write(address_space &space, int cas, offs_t offset, UINT8 data)
{
bool tramd = false;
@@ -530,6 +577,7 @@ void dmv_state::machine_reset()
m_thold7 = 0;
m_dma_hrq = 0;
memset(m_busint, 0, sizeof(m_busint));
+ memset(m_irqs, 0, sizeof(m_irqs));
update_halt_line();
}
@@ -630,7 +678,12 @@ static SLOT_INTERFACE_START(dmv_slot1)
SLOT_INTERFACE_END
static SLOT_INTERFACE_START(dmv_slot2_6)
+ SLOT_INTERFACE("k210", DMV_K210) // K210 Centronics
+ SLOT_INTERFACE("k211", DMV_K211) // K211 RS-232 Communications Interface
+ SLOT_INTERFACE("k212", DMV_K212) // K212 RS-232 Printer Interface
+ SLOT_INTERFACE("k213", DMV_K213) // K213 RS-232 Plotter Interface
SLOT_INTERFACE("k233", DMV_K233) // K233 16K Shared RAM
+ SLOT_INTERFACE("k801", DMV_K801) // K801 RS-232 Switchable Interface
SLOT_INTERFACE("k803", DMV_K803) // K803 RTC module
SLOT_INTERFACE("k806", DMV_K806) // K806 Mouse module
SLOT_INTERFACE_END
@@ -719,32 +772,40 @@ static MACHINE_CONFIG_START( dmv, dmv_state )
MCFG_DEVICE_ADD("slot2", DMVCART_SLOT, 0)
MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false)
MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint2_w))
+ MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq2_w))
MCFG_DEVICE_ADD("slot2a", DMVCART_SLOT, 0)
MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2a, NULL, false)
MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint2a_w))
+ MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq2a_w))
MCFG_DEVICE_ADD("slot3", DMVCART_SLOT, 0)
MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false)
MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint3_w))
+ MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq3_w))
MCFG_DEVICE_ADD("slot4", DMVCART_SLOT, 0)
MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false)
MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint4_w))
+ MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq4_w))
MCFG_DEVICE_ADD("slot5", DMVCART_SLOT, 0)
MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false)
MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint5_w))
+ MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq5_w))
MCFG_DEVICE_ADD("slot6", DMVCART_SLOT, 0)
MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false)
MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint6_w))
+ MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq6_w))
MCFG_DEVICE_ADD("slot7", DMVCART_SLOT, 0)
MCFG_DEVICE_SLOT_INTERFACE(dmv_slot7, NULL, false)
MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(READ8(dmv_state, exp_program_r), WRITE8(dmv_state, exp_program_w))
MCFG_DMVCART_SLOT_OUT_THOLD_CB(WRITELINE(dmv_state, thold7_w))
MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint7_w))
+ MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq7_w))
MCFG_DEVICE_ADD("slot7a", DMVCART_SLOT, 0)
MCFG_DEVICE_SLOT_INTERFACE(dmv_slot7a, "k230", false)
MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(READ8(dmv_state, exp_program_r), WRITE8(dmv_state, exp_program_w))
MCFG_DMVCART_SLOT_OUT_THOLD_CB(WRITELINE(dmv_state, thold7_w))
MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint7a_w))
+ MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, irq7a_w))
MCFG_SOFTWARE_LIST_ADD("flop_list", "dmv")