summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/i8212.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/i8212.cpp')
-rw-r--r--src/devices/machine/i8212.cpp129
1 files changed, 100 insertions, 29 deletions
diff --git a/src/devices/machine/i8212.cpp b/src/devices/machine/i8212.cpp
index c08ee3ad6e0..4c7cd115c75 100644
--- a/src/devices/machine/i8212.cpp
+++ b/src/devices/machine/i8212.cpp
@@ -1,8 +1,40 @@
// license:BSD-3-Clause
-// copyright-holders:Curt Coder
+// copyright-holders:Curt Coder,AJR
/**********************************************************************
- Intel 8212 8-Bit Input/Output Port emulation
+ Intel 8212/3212 8-Bit Input/Output Port (Multi-Mode Latch Buffer)
+
+ The Intel 8212 was one of the first in a line of bipolar Schottky
+ peripherals released early on for the 8080. Many of these were
+ assigned alternate part numbers in the 3200 series to identify
+ them with Intel's 3001/3002 bipolar bit-slice processing elements.
+
+ The 8212's MD pin is typically tied to either GND or Vcc to fix
+ the chip in one of its two operating modes. In the input mode
+ (MD = L), data is latched on the falling edge of STB, and the
+ three-state outputs are enabled by a combination of two chip
+ select inputs of opposite polarities. In the output mode (MD = H),
+ data is latched on the falling edge of chip selection, and outputs
+ are always enabled. The service request flip-flop is clocked on
+ the falling edge of STB to produce the INT output, and is reset by
+ either chip selection or the active-low CLR input, the latter
+ also resetting the latched data to zero.
+
+ The 8212 in output mode was often used with the 8080 to latch the
+ status word and with the 8085 to latch the lower address bits.
+
+ RCA's CDP1852 is an almost pin-for-pin CMOS counterpart to the
+ 8212. The control lines of the CDP1852, however, work slightly
+ differently, especially in output mode.
+
+ When TI second-sourced the 8080A, they cloned the 8212 as the
+ SN74S412 (and numbered their versions of the 8224, 8228 and 8338
+ similarly). While simpler octal latches from the 7400 series such
+ as 74LS273, 74LS373 and 74LS374 became far more common and widely
+ used, even when a separate service request flip-flop needed to be
+ coupled, the Fairchild Advanced Schottky TTL (FAST) evolution of
+ the 7400 series had both inverting (74F432) and non-inverting
+ (74F412) versions of this device.
**********************************************************************/
@@ -19,7 +51,7 @@
//**************************************************************************
// device type definition
-DEFINE_DEVICE_TYPE(I8212, i8212_device, "i8212", "Intel 8212 I/O")
+DEFINE_DEVICE_TYPE(I8212, i8212_device, "i8212", "Intel 8212 I/O Port")
//-------------------------------------------------
// i8212_device - constructor
@@ -30,8 +62,8 @@ i8212_device::i8212_device(const machine_config &mconfig, const char *tag, devic
m_write_int(*this),
m_read_di(*this),
m_write_do(*this),
- m_md(MODE_INPUT),
- m_stb(0), m_data(0)
+ m_read_md(*this),
+ m_stb(1), m_data(0)
{
}
@@ -46,23 +78,37 @@ void i8212_device::device_start()
m_write_int.resolve_safe();
m_read_di.resolve_safe(0);
m_write_do.resolve_safe();
+ m_read_md.resolve_safe(0);
// register for state saving
- save_item(NAME(m_md));
save_item(NAME(m_stb));
save_item(NAME(m_data));
}
//-------------------------------------------------
+// get_mode - resolve device mode
+//-------------------------------------------------
+
+i8212_device::mode i8212_device::get_mode()
+{
+ return m_read_md() ? mode::OUTPUT : mode::INPUT;
+}
+
+
+//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void i8212_device::device_reset()
{
+ // clear interrupt line
+ m_write_int(CLEAR_LINE);
+
+ // clear latched data
m_data = 0;
- if (m_md == MODE_OUTPUT)
+ if (get_mode() == mode::OUTPUT)
{
// output data
m_write_do((offs_t)0, m_data);
@@ -74,13 +120,28 @@ void i8212_device::device_reset()
// read - data latch read
//-------------------------------------------------
-READ8_MEMBER( i8212_device::read )
+READ8_MEMBER(i8212_device::read)
+{
+ if (!machine().side_effect_disabled())
+ {
+ // clear interrupt line
+ m_write_int(CLEAR_LINE);
+ }
+
+ return m_data;
+}
+
+
+//-------------------------------------------------
+// inta_cb - data latch read (INTA triggered)
+//-------------------------------------------------
+
+IRQ_CALLBACK_MEMBER(i8212_device::inta_cb)
{
// clear interrupt line
m_write_int(CLEAR_LINE);
- LOG("I8212 INT: %u\n", CLEAR_LINE);
-
+ // read latched data as interrupt vector
return m_data;
}
@@ -89,25 +150,37 @@ READ8_MEMBER( i8212_device::read )
// write - data latch write
//-------------------------------------------------
-WRITE8_MEMBER( i8212_device::write )
+WRITE8_MEMBER(i8212_device::write)
{
- // latch data
- m_data = data;
+ // clear interrupt line
+ m_write_int(CLEAR_LINE);
+
+ if (get_mode() == mode::OUTPUT)
+ {
+ // latch data
+ m_data = data;
+ LOG("I8212: Writing %02X into latch (output mode)\n", data);
- // output data
- m_write_do((offs_t)0, m_data);
+ // output data
+ m_write_do((offs_t)0, m_data);
+ }
}
//-------------------------------------------------
-// md_w - mode write
+// strobe - data input strobe
//-------------------------------------------------
-WRITE_LINE_MEMBER( i8212_device::md_w )
+WRITE8_MEMBER(i8212_device::strobe)
{
- LOG("I8212 Mode: %s\n", state ? "output" : "input");
+ if (get_mode() == mode::INPUT)
+ {
+ m_data = data;
+ LOG("I8212: Writing %02X into latch (input mode)\n", data);
+ }
- m_md = state;
+ // assert interrupt line
+ m_write_int(ASSERT_LINE);
}
@@ -115,22 +188,20 @@ WRITE_LINE_MEMBER( i8212_device::md_w )
// stb_w - data strobe write
//-------------------------------------------------
-WRITE_LINE_MEMBER( i8212_device::stb_w )
+WRITE_LINE_MEMBER(i8212_device::stb_w)
{
- LOG("I8212 STB: %u\n", state);
-
- if (m_md == MODE_INPUT)
+ // active on falling edge
+ if (m_stb && !state)
{
- if (m_stb && !state)
+ if (get_mode() == mode::INPUT)
{
// input data
m_data = m_read_di(0);
-
- // assert interrupt line
- m_write_int(ASSERT_LINE);
-
- LOG("I8212 INT: %u\n", ASSERT_LINE);
+ LOG("I8212: Reading %02X into latch (input mode)\n", m_data);
}
+
+ // assert interrupt line
+ m_write_int(ASSERT_LINE);
}
m_stb = state;