From c5b838bc2c15f509273470d9abc732023a2f705f Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Mon, 6 Apr 2020 13:36:13 +0200 Subject: [PATCH] Add octal registered transceiver 74543 --- scripts/src/machine.lua | 12 ++++ src/devices/machine/74543.cpp | 120 ++++++++++++++++++++++++++++++++ src/devices/machine/74543.h | 124 ++++++++++++++++++++++++++++++++++ 3 files changed, 256 insertions(+) create mode 100644 src/devices/machine/74543.cpp create mode 100644 src/devices/machine/74543.h diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua index 4e7352c3e41..29cb6c48970 100644 --- a/scripts/src/machine.lua +++ b/scripts/src/machine.lua @@ -523,6 +523,18 @@ if (MACHINES["TTL74381"]~=null) then } end +--------------------------------------------------- +-- +--@src/devices/machine/74543.h,MACHINES["TTL74543"] = true +--------------------------------------------------- + +if (MACHINES["TTL74543"]~=null) then + files { + MAME_DIR .. "src/devices/machine/74543.cpp", + MAME_DIR .. "src/devices/machine/74543.h", + } +end + --------------------------------------------------- -- --@src/devices/machine/7474.h,MACHINES["TTL7474"] = true diff --git a/src/devices/machine/74543.cpp b/src/devices/machine/74543.cpp new file mode 100644 index 00000000000..2abba597941 --- /dev/null +++ b/src/devices/machine/74543.cpp @@ -0,0 +1,120 @@ +// license:BSD-3-Clause +// copyright-holders:Michael Zapf +/***************************************************************************** + + 74543: Octal Registered Transceiver + (typically 74F543) + +*****************************************************************************/ + +#include "emu.h" +#include "74543.h" + +DEFINE_DEVICE_TYPE(TTL74543, ttl74543_device, "ttl74543", "Octal Registered Transceiver") + +ttl74543_device::ttl74543_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, TTL74543, tag, owner, clock), + m_output_a(*this), + m_output_b(*this), + m_ceabpre(false), + m_leabpre(false), + m_oeabpre(false), + m_cebapre(false), + m_lebapre(false), + m_oebapre(false) +{ +} + +void ttl74543_device::device_start() +{ + save_item(NAME(m_ceab)); + save_item(NAME(m_leab)); + save_item(NAME(m_oeab)); + save_item(NAME(m_ceba)); + save_item(NAME(m_leba)); + save_item(NAME(m_oeba)); + + save_item(NAME(m_latch)); + + m_output_a.resolve_safe(); + m_output_b.resolve_safe(); +} + +void ttl74543_device::device_reset() +{ + m_ceab = m_ceabpre; + m_leab = m_leabpre; + m_oeab = m_oeabpre; + m_ceba = m_cebapre; + m_leba = m_lebapre; + m_oeba = m_oebapre; +} + +/* + Data I/O control table: + + Inputs Latch Output + CEAB* LEAB* OEAB* Status Buffers + ----------------------------------------- + H X X Latched High Z A->B flow shown + X H X Latched - B->A flow control is the same + L L X Transparent - except using CEBA*, LEBA*, OEBA* + X X H - High Z + L X L - Driving + + X = immaterial +*/ + +void ttl74543_device::a_w(uint8_t a) +{ + if (m_ceab && m_leab) m_latch = a; +} + +void ttl74543_device::b_w(uint8_t b) +{ + if (m_ceba && m_leba) m_latch = b; +} + +void ttl74543_device::outputb_rz(uint8_t& value) +{ + if (m_ceab && m_oeab) value = m_latch; +} + +void ttl74543_device::outputa_rz(uint8_t& value) +{ + if (m_ceba && m_oeba) value = m_latch; +} + +WRITE_LINE_MEMBER( ttl74543_device::ceab_w ) +{ + m_ceab = (state == 0); + if (m_ceab && m_oeab) m_output_b(m_latch); +} + +WRITE_LINE_MEMBER( ttl74543_device::leab_w ) +{ + m_leab = (state == 0); +} + +WRITE_LINE_MEMBER( ttl74543_device::oeab_w ) +{ + m_oeab = (state == 0); + if (m_ceab && m_oeab) m_output_b(m_latch); +} + +WRITE_LINE_MEMBER( ttl74543_device::ceba_w ) +{ + m_ceba = (state == 0); + if (m_ceba && m_oeba) m_output_a(m_latch); +} + +WRITE_LINE_MEMBER( ttl74543_device::leba_w ) +{ + m_leba = (state == 0); +} + +WRITE_LINE_MEMBER( ttl74543_device::oeba_w ) +{ + m_oeba = (state == 0); + if (m_ceba && m_oeba) m_output_a(m_latch); +} diff --git a/src/devices/machine/74543.h b/src/devices/machine/74543.h new file mode 100644 index 00000000000..ab2c7a561d2 --- /dev/null +++ b/src/devices/machine/74543.h @@ -0,0 +1,124 @@ +// license:BSD-3-Clause +// copyright-holders:Michael Zapf +/***************************************************************************** + + 74543: Octal Registered Transceiver + (typically 74F543) + +*********************************************************************** + + Connection Diagram: + _________ + LEBA* 1 | | | | 24 Vcc + OEBA* 2 | --- | 23 CEBA* + A0 3 | | 22 B0 + A1 4 | | 21 B1 + A2 5 | | 20 B2 + A3 6 | | 19 B3 + A4 7 | | 18 B4 + A5 8 | | 17 B5 + A6 9 | | 16 B6 + A7 10 | | 15 B7 + CEAB* 11 | | 14 LEAB* + GND 12 |_________| 13 OEAB* + + + Logic Symbol: + | | + ____|______|____ + | | + | A0 ... A7 | + | | + --O| OEAB | + --O| OEBA | + --O| CEAB | + --O| CEBA | + --O| LEAB | + --O| LEBA | + | | + | B0 ... B7 | + |________________| + | | + | | + + +*********************************************************************** + + Data I/O control table: + + Inputs Latch Output + CEAB* LEAB* OEAB* Status Buffers + ----------------------------------------- + H X X Latched High Z A->B flow shown + X H X Latched - B->A flow control is the same + L L X Transparent - except using CEBA*, LEBA*, OEBA* + X X H - High Z + L X L - Driving + + X = immaterial +**********************************************************************/ + +#ifndef MAME_MACHINE_74543_H +#define MAME_MACHINE_74543_H + +#pragma once + +class ttl74543_device : public device_t +{ +public: + ttl74543_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); + auto outputa_cb() { return m_output_a.bind(); } + auto outputb_cb() { return m_output_b.bind(); } + + // public interfaces + DECLARE_WRITE_LINE_MEMBER(ceab_w); + DECLARE_WRITE_LINE_MEMBER(leab_w); + DECLARE_WRITE_LINE_MEMBER(oeab_w); + DECLARE_WRITE_LINE_MEMBER(ceba_w); + DECLARE_WRITE_LINE_MEMBER(leba_w); + DECLARE_WRITE_LINE_MEMBER(oeba_w); + + void a_w(uint8_t a); + void b_w(uint8_t a); + void outputa_rz(uint8_t& value); + void outputb_rz(uint8_t& value); + + // Preset values + // for lines tied to H or L + void set_ceab_pin_value(int value) { m_ceabpre = (value==0); } + void set_leab_pin_value(int value) { m_leabpre = (value==0); } + void set_oeab_pin_value(int value) { m_oeabpre = (value==0); } + void set_ceba_pin_value(int value) { m_cebapre = (value==0); } + void set_leba_pin_value(int value) { m_lebapre = (value==0); } + void set_oeba_pin_value(int value) { m_oebapre = (value==0); } + +protected: + // device-level overrides + void device_start() override; + void device_reset() override; + +private: + devcb_write8 m_output_a; + devcb_write8 m_output_b; + + bool m_ceab; + bool m_leab; + bool m_oeab; + bool m_ceba; + bool m_leba; + bool m_oeba; + + bool m_ceabpre; + bool m_leabpre; + bool m_oeabpre; + bool m_cebapre; + bool m_lebapre; + bool m_oebapre; + + uint8_t m_latch; +}; + +// device type definition +DECLARE_DEVICE_TYPE(TTL74543, ttl74543_device) + +#endif // MAME_MACHINE_74161_H