From fc5fc6d4c2a2b84fc7f2e29378d62815d78eb256 Mon Sep 17 00:00:00 2001 From: "therealmogminer@gmail.com" Date: Fri, 28 Oct 2016 20:07:56 +0200 Subject: [PATCH] New devices added ----------------- 7400 Quad 2-Input NAND Gate [Ryan Holtz] 7404 Hex Inverter [Ryan Holtz] 82S126/82S129 256x4-bit PROM [Ryan Holtz] --- scripts/src/machine.lua | 36 +++++++ scripts/target/mame/arcade.lua | 3 + scripts/target/mame/mess.lua | 23 +---- src/devices/machine/7400.cpp | 113 ++++++++++++++++++++++ src/devices/machine/7400.h | 111 ++++++++++++++++++++++ src/devices/machine/7404.cpp | 106 +++++++++++++++++++++ src/devices/machine/7404.h | 146 ++++++++++++++++++++++++++++ src/devices/machine/74161.cpp | 53 +++++------ src/devices/machine/74161.h | 5 - src/devices/machine/74175.cpp | 63 +++++------- src/devices/machine/74175.h | 6 -- src/devices/machine/82s129.cpp | 153 +++++++++++++++++++++++++++++ src/devices/machine/82s129.h | 169 +++++++++++++++++++++++++++++++++ src/devices/machine/dm9334.cpp | 80 ++++++++++++---- src/devices/machine/dm9334.h | 19 ++-- src/mame/drivers/hazeltin.cpp | 98 +++++++++++++------ 16 files changed, 1028 insertions(+), 156 deletions(-) create mode 100644 src/devices/machine/7400.cpp create mode 100644 src/devices/machine/7400.h create mode 100644 src/devices/machine/7404.cpp create mode 100644 src/devices/machine/7404.h create mode 100644 src/devices/machine/82s129.cpp create mode 100644 src/devices/machine/82s129.h diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua index 81b5ab23907..63bec113de8 100644 --- a/scripts/src/machine.lua +++ b/scripts/src/machine.lua @@ -282,6 +282,30 @@ if (MACHINES["7200FIFO"]~=null) then } end +--------------------------------------------------- +-- +--@src/devices/machine/7400.h,MACHINES["TTL7400"] = true +--------------------------------------------------- + +if (MACHINES["TTL7400"]~=null) then + files { + MAME_DIR .. "src/devices/machine/7400.cpp", + MAME_DIR .. "src/devices/machine/7400.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/7404.h,MACHINES["TTL7404"] = true +--------------------------------------------------- + +if (MACHINES["TTL7404"]~=null) then + files { + MAME_DIR .. "src/devices/machine/7404.cpp", + MAME_DIR .. "src/devices/machine/7404.h", + } +end + --------------------------------------------------- -- --@src/devices/machine/74123.h,MACHINES["TTL74123"] = true @@ -379,6 +403,18 @@ if (MACHINES["TTL7474"]~=null) then } end +--------------------------------------------------- +-- +--@src/devices/machine/82s129.h,MACHINES["PROM82S129"] = true +--------------------------------------------------- + +if (MACHINES["PROM82S129"]~=null) then + files { + MAME_DIR .. "src/devices/machine/82s129.cpp", + MAME_DIR .. "src/devices/machine/82s129.h", + } +end + --------------------------------------------------- -- --@src/devices/machine/8042kbdc.h,MACHINES["KBDC8042"] = true diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index f571ce8a1e6..6b515e2d399 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -353,6 +353,8 @@ MACHINES["ACIA6850"] = true MACHINES["68681"] = true MACHINES["7200FIFO"] = true --MACHINES["8530SCC"] = true +--MACHINES["TTL7400"] = true +--MACHINES["TTL7404"] = true MACHINES["TTL74123"] = true MACHINES["TTL74145"] = true MACHINES["TTL74148"] = true @@ -502,6 +504,7 @@ MACHINES["PIC8259"] = true MACHINES["PIT8253"] = true MACHINES["PLA"] = true --MACHINES["PROFILE"] = true +--MACHINES["PROM82S129"] = true MACHINES["R10696"] = true MACHINES["R10788"] = true MACHINES["RA17XX"] = true diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 1188e1fa589..0344b1e004e 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -347,28 +347,13 @@ MACHINES["AUTOCONFIG"] = true MACHINES["CR511B"] = true MACHINES["DMAC"] = true MACHINES["GAYLE"] = true ---MACHINES["NCR53C7XX"] = true ---MACHINES["LSI53C810"] = true MACHINES["6522VIA"] = true ---MACHINES["TPI6525"] = true ---MACHINES["RIOT6532"] = true MACHINES["6821PIA"] = true MACHINES["6840PTM"] = true MACHINES["68561MPCC"] = true ---MACHINES["ACIA6850"] = true MACHINES["68681"] = true MACHINES["7200FIFO"] = true MACHINES["8530SCC"] = true ---MACHINES["TTL74123"] = true ---MACHINES["TTL74145"] = true ---MACHINES["TTL74148"] = true ---MACHINES["TTL74153"] = true ---MACHINES["TTL74161"] = true ---MACHINES["TTL74175"] = true ---MACHINES["TTL74181"] = true ---MACHINES["TTL7474"] = true ---MACHINES["KBDC8042"] = true ---MACHINES["I8257"] = true MACHINES["AAKARTDEV"] = true MACHINES["ACIA6850"] = true MACHINES["ADC0808"] = true @@ -468,8 +453,6 @@ MACHINES["MC6854"] = true MACHINES["MC68328"] = true MACHINES["MC68901"] = true MACHINES["MCCS1850"] = true ---MACHINES["M68307"] = true ---MACHINES["M68340"] = true MACHINES["MCF5206E"] = true MACHINES["MICROTOUCH"] = true MACHINES["MIOT6530"] = true @@ -478,7 +461,6 @@ MACHINES["MM58274C"] = true MACHINES["MM74C922"] = true MACHINES["MOS6526"] = true MACHINES["MOS6529"] = true ---MACHINES["MIOT6530"] = true MACHINES["MOS6551"] = true MACHINES["MOS6702"] = true MACHINES["MOS8706"] = true @@ -510,6 +492,7 @@ MACHINES["PIT68230"] = true MACHINES["PIT8253"] = true MACHINES["PLA"] = true --MACHINES["PROFILE"] = true +MACHINES["PROM82S129"] = true MACHINES["R64H156"] = true MACHINES["RF5C296"] = true MACHINES["RIOT6532"] = true @@ -544,6 +527,8 @@ MACHINES["TMS6100"] = true MACHINES["TMS9901"] = true MACHINES["TMS9902"] = true MACHINES["TPI6525"] = true +MACHINES["TTL7400"] = true +MACHINES["TTL7404"] = true MACHINES["TTL74123"] = true MACHINES["TTL74145"] = true MACHINES["TTL74148"] = true @@ -577,8 +562,6 @@ MACHINES["Z80DMA"] = true MACHINES["Z80PIO"] = true MACHINES["Z80STI"] = true MACHINES["Z8536"] = true ---MACHINES["SECFLASH"] = true ---MACHINES["PCCARD"] = true MACHINES["SMC92X4"] = true MACHINES["HDC9234"] = true MACHINES["TI99_HD"] = true diff --git a/src/devices/machine/7400.cpp b/src/devices/machine/7400.cpp new file mode 100644 index 00000000000..ad1024e1f01 --- /dev/null +++ b/src/devices/machine/7400.cpp @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/***************************************************************************** + + 7400 Quad 2-Input NAND Gate + +*****************************************************************************/ + +#include "emu.h" +#include "7400.h" + +const device_type TTL7400 = &device_creator; + +ttl7400_device::ttl7400_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, TTL7400, "7400 Quad 2-Input NAND Gate", tag, owner, clock, "7400", __FILE__) + , m_y1_func(*this) + , m_y2_func(*this) + , m_y3_func(*this) + , m_y4_func(*this) + , m_a(0) + , m_b(0) + , m_y(0) +{ +} + +void ttl7400_device::device_start() +{ + init(); + + save_item(NAME(m_a)); + save_item(NAME(m_b)); + save_item(NAME(m_y)); + + m_y1_func.resolve_safe(); + m_y2_func.resolve_safe(); + m_y3_func.resolve_safe(); + m_y4_func.resolve_safe(); +} + +void ttl7400_device::device_reset() +{ + init(); +} + +void ttl7400_device::init() +{ + m_a = 0; + m_b = 0; + m_y = 0; +} + +void ttl7400_device::update() +{ + uint8_t last_y = m_y; + + m_y = (m_a & m_b) & 0xf; + + if (m_y != last_y) + { + for (int bit = 0; bit < 4; bit++) + { + if (BIT(m_y, bit) == BIT(last_y, bit)) + continue; + + switch(bit) + { + case 0: m_y1_func(BIT(m_y, bit)); break; + case 1: m_y2_func(BIT(m_y, bit)); break; + case 2: m_y3_func(BIT(m_y, bit)); break; + case 3: m_y4_func(BIT(m_y, bit)); break; + } + } + } +} + +void ttl7400_device::a_w(uint8_t line, uint8_t state) +{ + uint8_t old_a = m_a; + m_a &= ~(1 << line); + m_a |= (state << line); + if (old_a != m_a) + update(); +} + +void ttl7400_device::b_w(uint8_t line, uint8_t state) +{ + uint8_t old_b = m_b; + m_b &= ~(1 << line); + m_b |= (state << line); + if (old_b != m_b) + update(); +} + +uint8_t ttl7400_device::y_r(uint8_t line) +{ + return (m_y >> line) & 1; +} + + +WRITE_LINE_MEMBER( ttl7400_device::a1_w ) { a_w(0, state); } +WRITE_LINE_MEMBER( ttl7400_device::a2_w ) { a_w(1, state); } +WRITE_LINE_MEMBER( ttl7400_device::a3_w ) { a_w(2, state); } +WRITE_LINE_MEMBER( ttl7400_device::a4_w ) { a_w(3, state); } + +WRITE_LINE_MEMBER( ttl7400_device::b1_w ) { b_w(0, state); } +WRITE_LINE_MEMBER( ttl7400_device::b2_w ) { b_w(1, state); } +WRITE_LINE_MEMBER( ttl7400_device::b3_w ) { b_w(2, state); } +WRITE_LINE_MEMBER( ttl7400_device::b4_w ) { b_w(3, state); } + +READ_LINE_MEMBER( ttl7400_device::y1_r ) { return y_r(0); } +READ_LINE_MEMBER( ttl7400_device::y2_r ) { return y_r(1); } +READ_LINE_MEMBER( ttl7400_device::y3_r ) { return y_r(2); } +READ_LINE_MEMBER( ttl7400_device::y4_r ) { return y_r(3); } diff --git a/src/devices/machine/7400.h b/src/devices/machine/7400.h new file mode 100644 index 00000000000..0ea10e0149f --- /dev/null +++ b/src/devices/machine/7400.h @@ -0,0 +1,111 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/***************************************************************************** + + 7400 Quad 2-Input NAND Gate + +*********************************************************************** + + Connection Diagram: + ___ ___ + 1A 1 |* u | 14 Vcc + 1B 2 | | 13 4B + 1Y 3 | | 12 4A + 2A 4 | | 11 4Y + 2B 5 | | 10 3B + 2Y 6 | | 9 3A + GND 7 |_______| 8 3Y + + Truth Table: + ___________ + | A | B | Y | + |---|---|---| + | 0 | 0 | 0 | + | 0 | 1 | 0 | + | 1 | 0 | 0 | + | 1 | 1 | 1 | + |___|___|___| + +**********************************************************************/ + +#pragma once + +#ifndef TTL7400_H +#define TTL7400_H + +#include "emu.h" + +#define MCFG_7400_Y1_CB(_devcb) \ + devcb = &ttl7400_device::set_y1_cb(*device, DEVCB_##_devcb); + +#define MCFG_7400_Y2_CB(_devcb) \ + devcb = &ttl7400_device::set_y2_cb(*device, DEVCB_##_devcb); + +#define MCFG_7400_Y3_CB(_devcb) \ + devcb = &ttl7400_device::set_y3_cb(*device, DEVCB_##_devcb); + +#define MCFG_7400_Y4_CB(_devcb) \ + devcb = &ttl7400_device::set_y4_cb(*device, DEVCB_##_devcb); + +#define MCFG_7400_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, TTL7400, 0) + +class ttl7400_device : public device_t +{ +public: + // construction/destruction + ttl7400_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // static configuration helpers + template static devcb_base &set_y1_cb(device_t &device, _Object object) { return downcast(device).m_y1_func.set_callback(object); } + template static devcb_base &set_y2_cb(device_t &device, _Object object) { return downcast(device).m_y2_func.set_callback(object); } + template static devcb_base &set_y3_cb(device_t &device, _Object object) { return downcast(device).m_y3_func.set_callback(object); } + template static devcb_base &set_y4_cb(device_t &device, _Object object) { return downcast(device).m_y4_func.set_callback(object); } + + // public interfaces + DECLARE_WRITE_LINE_MEMBER( a1_w ); + DECLARE_WRITE_LINE_MEMBER( a2_w ); + DECLARE_WRITE_LINE_MEMBER( a3_w ); + DECLARE_WRITE_LINE_MEMBER( a4_w ); + DECLARE_WRITE_LINE_MEMBER( b1_w ); + DECLARE_WRITE_LINE_MEMBER( b2_w ); + DECLARE_WRITE_LINE_MEMBER( b3_w ); + DECLARE_WRITE_LINE_MEMBER( b4_w ); + + DECLARE_READ_LINE_MEMBER( y1_r ); + DECLARE_READ_LINE_MEMBER( y2_r ); + DECLARE_READ_LINE_MEMBER( y3_r ); + DECLARE_READ_LINE_MEMBER( y4_r ); + +protected: + void a_w(uint8_t line, uint8_t state); + void b_w(uint8_t line, uint8_t state); + uint8_t y_r(uint8_t line); + + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + +private: + void init(); + void update(); + + // callbacks + devcb_write_line m_y1_func; + devcb_write_line m_y2_func; + devcb_write_line m_y3_func; + devcb_write_line m_y4_func; + + // inputs + uint8_t m_a; // pins 1,4,9,12 + uint8_t m_b; // pins 2,5,10,13 + + // outputs + uint8_t m_y; // pins 3,6,8,11 +}; + +// device type definition +extern const device_type TTL7400; + + +#endif /* TTL7400_H */ diff --git a/src/devices/machine/7404.cpp b/src/devices/machine/7404.cpp new file mode 100644 index 00000000000..030950d40e9 --- /dev/null +++ b/src/devices/machine/7404.cpp @@ -0,0 +1,106 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/***************************************************************************** + + 5/7404 Hex Inverters + +*****************************************************************************/ + +#include "emu.h" +#include "7404.h" + +const device_type TTL7404 = &device_creator; + +ttl7404_device::ttl7404_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, TTL7404, "5/7404 Hex Inverters", tag, owner, clock, "7404", __FILE__) + , m_y1_func(*this) + , m_y2_func(*this) + , m_y3_func(*this) + , m_y4_func(*this) + , m_y5_func(*this) + , m_y6_func(*this) + , m_a(0) + , m_y(0x3f) +{ +} + +void ttl7404_device::device_start() +{ + init(); + + save_item(NAME(m_a)); + save_item(NAME(m_y)); + + m_y1_func.resolve_safe(); + m_y2_func.resolve_safe(); + m_y3_func.resolve_safe(); + m_y4_func.resolve_safe(); + m_y5_func.resolve_safe(); + m_y6_func.resolve_safe(); +} + +void ttl7404_device::device_reset() +{ + init(); +} + +void ttl7404_device::init() +{ + m_a = 0; + m_y = 0x3f; +} + +void ttl7404_device::update() +{ + uint8_t last_y = m_y; + + m_y = (~m_a) & 0x3f; + + if (m_y != last_y) + { + for (int bit = 0; bit < 6; bit++) + { + if (BIT(m_y, bit) == BIT(last_y, bit)) + continue; + + switch(bit) + { + case 0: m_y1_func(BIT(m_y, bit)); break; + case 1: m_y2_func(BIT(m_y, bit)); break; + case 2: m_y3_func(BIT(m_y, bit)); break; + case 3: m_y4_func(BIT(m_y, bit)); break; + case 4: m_y5_func(BIT(m_y, bit)); break; + case 5: m_y6_func(BIT(m_y, bit)); break; + } + } + } +} + +void ttl7404_device::a_w(uint8_t line, uint8_t state) +{ + uint8_t old_a = m_a; + m_a &= ~(1 << line); + m_a |= (state << line); + if (old_a != m_a) + update(); +} + +uint8_t ttl7404_device::y_r(uint8_t line) +{ + return (m_y >> line) & 1; +} + + +WRITE_LINE_MEMBER( ttl7404_device::a1_w ) { a_w(0, state); } +WRITE_LINE_MEMBER( ttl7404_device::a2_w ) { a_w(1, state); } +WRITE_LINE_MEMBER( ttl7404_device::a3_w ) { a_w(2, state); } +WRITE_LINE_MEMBER( ttl7404_device::a4_w ) { a_w(3, state); } +WRITE_LINE_MEMBER( ttl7404_device::a5_w ) { a_w(4, state); } +WRITE_LINE_MEMBER( ttl7404_device::a6_w ) { a_w(5, state); } + +READ_LINE_MEMBER( ttl7404_device::y1_r ) { return y_r(0); } +READ_LINE_MEMBER( ttl7404_device::y2_r ) { return y_r(1); } +READ_LINE_MEMBER( ttl7404_device::y3_r ) { return y_r(2); } +READ_LINE_MEMBER( ttl7404_device::y4_r ) { return y_r(3); } +READ_LINE_MEMBER( ttl7404_device::y5_r ) { return y_r(4); } +READ_LINE_MEMBER( ttl7404_device::y6_r ) { return y_r(5); } diff --git a/src/devices/machine/7404.h b/src/devices/machine/7404.h new file mode 100644 index 00000000000..57043c1b93e --- /dev/null +++ b/src/devices/machine/7404.h @@ -0,0 +1,146 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/***************************************************************************** + + 5/7404 Hex Inverters + +*********************************************************************** + + Connection Diagram: + + SN5404 J Package + SN54LS04, SN54S04 J or W Package + SN7404 D, DB, N or NS Package + SN74S04 D or N Package + ___ ___ + 1A 1 |* u | 14 Vcc + 1Y 2 | | 13 6A + 2A 3 | | 12 6Y + 2Y 4 | | 11 5A + 3A 5 | | 10 5Y + 3Y 6 | | 9 4A + GND 7 |_______| 8 4Y + + + SN5404 W Package + ___ ___ + 1A 1 |* u | 14 1Y + 2Y 2 | | 13 6A + 2A 3 | | 12 6Y + Vcc 4 | | 11 GND + 3A 5 | | 10 5Y + 3Y 6 | | 9 5A + 4A 7 |_______| 8 4Y + + + SN54LS04, SN54S04 FK Package + + 1Y 1A NC Vcc 6A + _______________________ + / |_| |_| |_| |_| |_| | + |_ 3 2 1 20 19 _| + 2A |_| 18|_| 6Y + |_ _| + NC |_| 17|_| NC + |_ _| + 2Y |_| 16|_| 5A + |_ _| + NC |_| 15|_| NC + |_ _| + 3A |_| 14|_| 5Y + | 9 10 11 12 13 | + |__|=|_|=|_|=|_|=|_|=|__| + + 3Y GND NC 4Y 4A + +**********************************************************************/ + +#pragma once + +#ifndef TTL7404_H +#define TTL7404_H + +#include "emu.h" + +#define MCFG_7404_Y1_CB(_devcb) \ + devcb = &ttl7404_device::set_y1_cb(*device, DEVCB_##_devcb); + +#define MCFG_7404_Y2_CB(_devcb) \ + devcb = &ttl7404_device::set_y2_cb(*device, DEVCB_##_devcb); + +#define MCFG_7404_Y3_CB(_devcb) \ + devcb = &ttl7404_device::set_y3_cb(*device, DEVCB_##_devcb); + +#define MCFG_7404_Y4_CB(_devcb) \ + devcb = &ttl7404_device::set_y4_cb(*device, DEVCB_##_devcb); + +#define MCFG_7404_Y5_CB(_devcb) \ + devcb = &ttl7404_device::set_y5_cb(*device, DEVCB_##_devcb); + +#define MCFG_7404_Y6_CB(_devcb) \ + devcb = &ttl7404_device::set_y6_cb(*device, DEVCB_##_devcb); + +#define MCFG_7404_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, TTL7404, 0) + +class ttl7404_device : public device_t +{ +public: + // construction/destruction + ttl7404_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // static configuration helpers + template static devcb_base &set_y1_cb(device_t &device, _Object object) { return downcast(device).m_y1_func.set_callback(object); } + template static devcb_base &set_y2_cb(device_t &device, _Object object) { return downcast(device).m_y2_func.set_callback(object); } + template static devcb_base &set_y3_cb(device_t &device, _Object object) { return downcast(device).m_y3_func.set_callback(object); } + template static devcb_base &set_y4_cb(device_t &device, _Object object) { return downcast(device).m_y4_func.set_callback(object); } + template static devcb_base &set_y5_cb(device_t &device, _Object object) { return downcast(device).m_y5_func.set_callback(object); } + template static devcb_base &set_y6_cb(device_t &device, _Object object) { return downcast(device).m_y6_func.set_callback(object); } + + // public interfaces + DECLARE_WRITE_LINE_MEMBER( a1_w ); + DECLARE_WRITE_LINE_MEMBER( a2_w ); + DECLARE_WRITE_LINE_MEMBER( a3_w ); + DECLARE_WRITE_LINE_MEMBER( a4_w ); + DECLARE_WRITE_LINE_MEMBER( a5_w ); + DECLARE_WRITE_LINE_MEMBER( a6_w ); + + DECLARE_READ_LINE_MEMBER( y1_r ); + DECLARE_READ_LINE_MEMBER( y2_r ); + DECLARE_READ_LINE_MEMBER( y3_r ); + DECLARE_READ_LINE_MEMBER( y4_r ); + DECLARE_READ_LINE_MEMBER( y5_r ); + DECLARE_READ_LINE_MEMBER( y6_r ); + +protected: + void a_w(uint8_t line, uint8_t state); + uint8_t y_r(uint8_t line); + + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + +private: + void init(); + void update(); + + // callbacks + devcb_write_line m_y1_func; + devcb_write_line m_y2_func; + devcb_write_line m_y3_func; + devcb_write_line m_y4_func; + devcb_write_line m_y5_func; + devcb_write_line m_y6_func; + + // inputs + uint8_t m_a; // pins 1,3,5,9,11,13 + + // outputs + uint8_t m_y; // pins 2,4,6,8,10,12 +}; + +// device type definition +extern const device_type TTL7404; + + +#endif /* TTL7404_H */ diff --git a/src/devices/machine/74161.cpp b/src/devices/machine/74161.cpp index 23f1a27942c..cc746aae092 100644 --- a/src/devices/machine/74161.cpp +++ b/src/devices/machine/74161.cpp @@ -30,9 +30,6 @@ ttl7416x_device::ttl7416x_device(const machine_config &mconfig, device_type type , m_p(0) , m_out(0) , m_tc(0) - , m_last_clock(0) - , m_last_out(0) - , m_last_tc(0) , m_synchronous_reset(synchronous_reset) , m_limit(limit) { @@ -68,9 +65,6 @@ void ttl7416x_device::device_start() save_item(NAME(m_p)); save_item(NAME(m_out)); save_item(NAME(m_tc)); - save_item(NAME(m_last_clock)); - save_item(NAME(m_last_out)); - save_item(NAME(m_last_tc)); m_output_func.resolve_safe(); m_tc_func.resolve_safe(); @@ -81,6 +75,21 @@ void ttl7416x_device::device_reset() init(); } +void ttl7416x_device::init() +{ + m_clear = 0; + m_pe = 1; + m_cet = 0; + m_cep = 0; + m_clock = 0; + m_p = 0; + + m_out = 0; + m_tc = 0; + + m_tc = 0; +} + void ttl7416x_device::tick() { if (m_synchronous_reset && m_clear) @@ -89,8 +98,8 @@ void ttl7416x_device::tick() return; } - m_last_out = m_out; - m_last_tc = m_tc; + uint8_t last_out = m_out; + uint8_t last_tc = m_tc; if (m_pe) { @@ -104,15 +113,13 @@ void ttl7416x_device::tick() } } - if (m_out != m_last_out) + if (m_out != last_out) { - m_last_out = m_out; m_output_func(m_out); } - if (m_tc != m_last_tc) + if (m_tc != last_tc) { - m_last_tc = m_tc; m_tc_func(m_tc); } } @@ -137,7 +144,7 @@ WRITE_LINE_MEMBER( ttl7416x_device::clear_w ) WRITE_LINE_MEMBER( ttl7416x_device::pe_w ) { - m_pe = state; + m_pe = state ^ 1; } WRITE_LINE_MEMBER( ttl7416x_device::cet_w ) @@ -152,9 +159,9 @@ WRITE_LINE_MEMBER( ttl7416x_device::cep_w ) WRITE_LINE_MEMBER( ttl7416x_device::clock_w ) { - m_last_clock = m_clock; + uint8_t last_clock = m_clock; m_clock = state; - if (m_clock != m_last_clock && m_clock != 0) + if (m_clock != last_clock && m_clock != 0) { tick(); } @@ -198,19 +205,3 @@ READ_LINE_MEMBER( ttl7416x_device::tc_r ) { return m_tc; } - -void ttl7416x_device::init() -{ - m_clear = 0; - m_pe = 1; - m_cet = 0; - m_cep = 0; - m_clock = 0; - m_p = 0; - - m_out = 0; - m_tc = 0; - - m_last_out = 0; - m_tc = 0; -} diff --git a/src/devices/machine/74161.h b/src/devices/machine/74161.h index e6856073655..ad514a4280d 100644 --- a/src/devices/machine/74161.h +++ b/src/devices/machine/74161.h @@ -148,11 +148,6 @@ private: uint8_t m_out; // pins 14-11 from LSB to MSB uint8_t m_tc; // pin 15 - // old state - uint8_t m_last_clock; - uint8_t m_last_out; - uint8_t m_last_tc; - const bool m_synchronous_reset; const uint8_t m_limit; }; diff --git a/src/devices/machine/74175.cpp b/src/devices/machine/74175.cpp index 99e52201cfe..a96ffb57dd0 100644 --- a/src/devices/machine/74175.cpp +++ b/src/devices/machine/74175.cpp @@ -28,11 +28,6 @@ ttl741745_device::ttl741745_device(const machine_config &mconfig, device_type ty , m_q2(0) , m_q3(0) , m_q4(0) - , m_last_q1(0) - , m_last_q2(0) - , m_last_q3(0) - , m_last_q4(0) - , m_last_clock(0) { } @@ -44,8 +39,6 @@ ttl74174_device::ttl74174_device(const machine_config &mconfig, const char *tag, , m_d6(0) , m_q5(0) , m_q6(0) - , m_last_q5(0) - , m_last_q6(0) { } @@ -68,10 +61,6 @@ void ttl741745_device::device_start() save_item(NAME(m_q2)); save_item(NAME(m_q3)); save_item(NAME(m_q4)); - save_item(NAME(m_last_q1)); - save_item(NAME(m_last_q2)); - save_item(NAME(m_last_q3)); - save_item(NAME(m_last_q4)); m_q1_func.resolve_safe(); m_q2_func.resolve_safe(); @@ -92,8 +81,6 @@ void ttl74174_device::device_start() save_item(NAME(m_d6)); save_item(NAME(m_q5)); save_item(NAME(m_q6)); - save_item(NAME(m_last_q5)); - save_item(NAME(m_last_q6)); m_q5_func.resolve_safe(); m_q6_func.resolve_safe(); @@ -126,20 +113,14 @@ void ttl741745_device::init() m_q2 = 0; m_q3 = 0; m_q4 = 0; - - m_last_q1 = 0; - m_last_q2 = 0; - m_last_q3 = 0; - m_last_q4 = 0; - m_last_clock = 0; } void ttl741745_device::tick() { - m_last_q1 = m_q1; - m_last_q2 = m_q2; - m_last_q3 = m_q3; - m_last_q4 = m_q4; + uint8_t last_q1 = m_q1; + uint8_t last_q2 = m_q2; + uint8_t last_q3 = m_q3; + uint8_t last_q4 = m_q4; int q1 = m_d1; int q2 = m_d2; @@ -158,13 +139,13 @@ void ttl741745_device::tick() m_q3 = q3; m_q4 = q4; - if (m_last_q1 != m_q1) + if (last_q1 != m_q1) m_q1_func(m_q1); - if (m_last_q2 != m_q2) + if (last_q2 != m_q2) m_q2_func(m_q2); - if (m_last_q3 != m_q3) + if (last_q3 != m_q3) m_q3_func(m_q3); - if (m_last_q4 != m_q4) + if (last_q4 != m_q4) m_q4_func(m_q4); } @@ -175,9 +156,9 @@ WRITE_LINE_MEMBER( ttl741745_device::clear_w ) WRITE_LINE_MEMBER( ttl741745_device::clock_w ) { - m_last_clock = m_clock; + uint8_t last_clock = m_clock; m_clock = state; - if (m_clock != m_last_clock && m_clock != 0) + if (m_clock != last_clock && m_clock != 0) { tick(); } @@ -221,17 +202,14 @@ void ttl74174_device::init() m_q5 = 0; m_q6 = 0; - - m_last_q5 = 0; - m_last_q6 = 0; } void ttl74174_device::tick() { ttl741745_device::tick(); - m_last_q5 = m_q5; - m_last_q6 = m_q6; + uint8_t last_q5 = m_q5; + uint8_t last_q6 = m_q6; int q5 = m_d5; int q6 = m_d6; @@ -244,22 +222,27 @@ void ttl74174_device::tick() m_q5 = q5; m_q6 = q6; - if (m_last_q5 != m_q5) + if (last_q5 != m_q5) m_q5_func(m_q5); - if (m_last_q6 != m_q6) + if (last_q6 != m_q6) m_q6_func(m_q6); } void ttl74175_device::tick() { + uint8_t last_q1 = m_q1; + uint8_t last_q2 = m_q2; + uint8_t last_q3 = m_q3; + uint8_t last_q4 = m_q4; + ttl741745_device::tick(); - if (m_last_q1 != m_q1) + if (last_q1 != m_q1) m_not_q1_func(m_q1 ^ 1); - if (m_last_q2 != m_q1) + if (last_q2 != m_q1) m_not_q2_func(m_q2 ^ 1); - if (m_last_q3 != m_q1) + if (last_q3 != m_q1) m_not_q3_func(m_q3 ^ 1); - if (m_last_q4 != m_q1) + if (last_q4 != m_q1) m_not_q4_func(m_q4 ^ 1); } \ No newline at end of file diff --git a/src/devices/machine/74175.h b/src/devices/machine/74175.h index bb621f926e9..a0b1714eb93 100644 --- a/src/devices/machine/74175.h +++ b/src/devices/machine/74175.h @@ -140,12 +140,6 @@ protected: uint8_t m_q2; uint8_t m_q3; uint8_t m_q4; - - uint8_t m_last_q1; - uint8_t m_last_q2; - uint8_t m_last_q3; - uint8_t m_last_q4; - uint8_t m_last_clock; }; class ttl74174_device : public ttl741745_device diff --git a/src/devices/machine/82s129.cpp b/src/devices/machine/82s129.cpp new file mode 100644 index 00000000000..d701c14c45d --- /dev/null +++ b/src/devices/machine/82s129.cpp @@ -0,0 +1,153 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/***************************************************************************** + + (DM)9334 8-Bit Addressable Latch + +*****************************************************************************/ + +#include "emu.h" +#include "82s129.h" + +const uint32_t prom82s129_base_device::PROM_SIZE = 256; + +const device_type PROM82S126 = &device_creator; +const device_type PROM82S129 = &device_creator; + +prom82s129_base_device::prom82s129_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname) + : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__) + , m_region(*this, DEVICE_SELF) + , m_out_func(*this) + , m_o1_func(*this) + , m_o2_func(*this) + , m_o3_func(*this) + , m_o4_func(*this) + , m_ce1(0) + , m_ce2(0) + , m_a(0) + , m_out(0) +{ +} + +prom82s126_device::prom82s126_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : prom82s129_base_device(mconfig, PROM82S126, "82S126 1K-bit TTL bipolar PROM", tag, owner, clock, "82s126") +{ +} + +prom82s129_device::prom82s129_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : prom82s129_base_device(mconfig, PROM82S126, "82S129 1K-bit TTL bipolar PROM", tag, owner, clock, "82s129") +{ +} + +void prom82s129_base_device::device_start() +{ + init(); + + m_data = std::make_unique(PROM_SIZE); + memcpy(&m_data[0], m_region->base(), PROM_SIZE); + + save_item(NAME(m_ce1)); + save_item(NAME(m_ce2)); + save_item(NAME(m_a)); + save_item(NAME(m_out)); + + m_out_func.resolve_safe(); + m_o1_func.resolve_safe(); + m_o2_func.resolve_safe(); + m_o3_func.resolve_safe(); + m_o4_func.resolve_safe(); +} + +void prom82s129_base_device::device_reset() +{ + init(); +} + +void prom82s129_base_device::init() +{ + m_ce1 = 0; + m_ce2 = 0; + m_a = 0; + m_out = 0; +} + +void prom82s129_base_device::update() +{ + uint8_t last_out = m_out; + + if (m_ce1 == 0 && m_ce2 == 0) + m_out = m_data[m_a]; + else + m_out = 0; + + if (m_out != last_out) + { + m_out_func(m_out); + + for (int bit = 0; bit < 4; bit++) + { + if (BIT(m_out, bit) == BIT(last_out, bit)) + continue; + + switch(bit) + { + case 0: m_o1_func(BIT(m_out, bit)); break; + case 1: m_o2_func(BIT(m_out, bit)); break; + case 2: m_o3_func(BIT(m_out, bit)); break; + case 3: m_o4_func(BIT(m_out, bit)); break; + } + } + } +} + +WRITE_LINE_MEMBER( prom82s129_base_device::ce1_w ) +{ + uint8_t last_ce1 = m_ce1; + m_ce1 = state; + if (last_ce1 != m_ce1) + update(); +} + +WRITE_LINE_MEMBER( prom82s129_base_device::ce2_w ) +{ + uint8_t last_ce2 = m_ce2; + m_ce2 = state; + if (last_ce2 != m_ce2) + update(); +} + +WRITE8_MEMBER( prom82s129_base_device::a_w ) +{ + uint8_t last_a = m_a; + m_a = data; + if (last_a != m_a) + update(); +} + +void prom82s129_base_device::write_line(uint8_t line, uint8_t state) +{ + uint8_t last_a = m_a; + m_a &= ~(1 << line); + m_a |= (state << line); + if (last_a != m_a) + update(); +} + +WRITE_LINE_MEMBER( prom82s129_base_device::a0_w ) { write_line(0, state); } +WRITE_LINE_MEMBER( prom82s129_base_device::a1_w ) { write_line(1, state); } +WRITE_LINE_MEMBER( prom82s129_base_device::a2_w ) { write_line(2, state); } +WRITE_LINE_MEMBER( prom82s129_base_device::a3_w ) { write_line(3, state); } +WRITE_LINE_MEMBER( prom82s129_base_device::a4_w ) { write_line(4, state); } +WRITE_LINE_MEMBER( prom82s129_base_device::a5_w ) { write_line(5, state); } +WRITE_LINE_MEMBER( prom82s129_base_device::a6_w ) { write_line(6, state); } +WRITE_LINE_MEMBER( prom82s129_base_device::a7_w ) { write_line(7, state); } + +READ8_MEMBER( prom82s129_base_device::output_r ) +{ + return m_out; +} + +READ_LINE_MEMBER( prom82s129_base_device::o1_r ) { return BIT(m_out, 0); } +READ_LINE_MEMBER( prom82s129_base_device::o2_r ) { return BIT(m_out, 1); } +READ_LINE_MEMBER( prom82s129_base_device::o3_r ) { return BIT(m_out, 2); } +READ_LINE_MEMBER( prom82s129_base_device::o4_r ) { return BIT(m_out, 3); } diff --git a/src/devices/machine/82s129.h b/src/devices/machine/82s129.h new file mode 100644 index 00000000000..cc13839efd5 --- /dev/null +++ b/src/devices/machine/82s129.h @@ -0,0 +1,169 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +/***************************************************************************** + + 82S129/6 1K-bit TTL bipolar PROM + +****************************************************************************** + + Connection Diagrams: + + N Package + ___ ___ + A6 1 |* u | 16 Vcc + A5 2 | | 15 A7 + A4 3 | | 14 /CE2 + A3 4 | | 13 /CE1 + A0 5 | | 12 O1 + A1 6 | | 11 O2 + A2 7 | | 10 O3 + GND 8 |_______| 9 O4 + + + A Package + + 3 2 1 20 19 + | | | | | + /---------------------| + | A5 A6 NC Vcc A7 | + | | + 4 -| A4 /CE2 |- 18 + 5 -| A3 /CE1 |- 17 + 6 -| A0 O1 |- 16 + 7 -| A1 NC |- 15 + 8 -| A2 O2 |- 14 + | | + | NC GND NC O4 O3 | + |_____________________| + | | | | | + 9 10 11 12 13 + +**********************************************************************/ + +#pragma once + +#ifndef PROM82S129_H +#define PROM82S129_H + +#include "emu.h" + +#define MCFG_82S126_OUTPUT_CB(_devcb) \ + devcb = &prom82s129_base_device::set_out_cb(*device, DEVCB_##_devcb); + +#define MCFG_82S126_O1_CB(_devcb) \ + devcb = &prom82s129_base_device::set_o1_cb(*device, DEVCB_##_devcb); + +#define MCFG_82S126_O2_CB(_devcb) \ + devcb = &prom82s129_base_device::set_o2_cb(*device, DEVCB_##_devcb); + +#define MCFG_82S126_O3_CB(_devcb) \ + devcb = &prom82s129_base_device::set_o3_cb(*device, DEVCB_##_devcb); + +#define MCFG_82S126_O4_CB(_devcb) \ + devcb = &prom82s129_base_device::set_o4_cb(*device, DEVCB_##_devcb); + +#define MCFG_82S129_OUTPUT_CB(_devcb) \ + devcb = &prom82s129_base_device::set_out_cb(*device, DEVCB_##_devcb); + +#define MCFG_82S129_O1_CB(_devcb) \ + devcb = &prom82s129_base_device::set_o1_cb(*device, DEVCB_##_devcb); + +#define MCFG_82S129_O2_CB(_devcb) \ + devcb = &prom82s129_base_device::set_o2_cb(*device, DEVCB_##_devcb); + +#define MCFG_82S129_O3_CB(_devcb) \ + devcb = &prom82s129_base_device::set_o3_cb(*device, DEVCB_##_devcb); + +#define MCFG_82S129_O4_CB(_devcb) \ + devcb = &prom82s129_base_device::set_o4_cb(*device, DEVCB_##_devcb); + +#define MCFG_82S129_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, PROM82S129, 0) + +#define MCFG_82S126_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, PROM82S126, 0) + +class prom82s129_base_device : public device_t +{ +public: + // construction/destruction + prom82s129_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname); + + // static configuration helpers + template static devcb_base &set_out_cb(device_t &device, _Object object) { return downcast(device).m_out_func.set_callback(object); } + template static devcb_base &set_o1_cb(device_t &device, _Object object) { return downcast(device).m_o1_func.set_callback(object); } + template static devcb_base &set_o2_cb(device_t &device, _Object object) { return downcast(device).m_o2_func.set_callback(object); } + template static devcb_base &set_o3_cb(device_t &device, _Object object) { return downcast(device).m_o3_func.set_callback(object); } + template static devcb_base &set_o4_cb(device_t &device, _Object object) { return downcast(device).m_o4_func.set_callback(object); } + + DECLARE_WRITE_LINE_MEMBER( ce1_w ); + DECLARE_WRITE_LINE_MEMBER( ce2_w ); + + DECLARE_WRITE8_MEMBER( a_w ); + DECLARE_WRITE_LINE_MEMBER( a0_w ); + DECLARE_WRITE_LINE_MEMBER( a1_w ); + DECLARE_WRITE_LINE_MEMBER( a2_w ); + DECLARE_WRITE_LINE_MEMBER( a3_w ); + DECLARE_WRITE_LINE_MEMBER( a4_w ); + DECLARE_WRITE_LINE_MEMBER( a5_w ); + DECLARE_WRITE_LINE_MEMBER( a6_w ); + DECLARE_WRITE_LINE_MEMBER( a7_w ); + + DECLARE_READ8_MEMBER( output_r ); + DECLARE_READ_LINE_MEMBER( o1_r ); + DECLARE_READ_LINE_MEMBER( o2_r ); + DECLARE_READ_LINE_MEMBER( o3_r ); + DECLARE_READ_LINE_MEMBER( o4_r ); + + uint8_t get_output() const { return m_out; } + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + +private: + void write_line(uint8_t line, uint8_t state); + void init(); + void update(); + + required_memory_region m_region; + + // callbacks + devcb_write_line m_out_func; + devcb_write_line m_o1_func; + devcb_write_line m_o2_func; + devcb_write_line m_o3_func; + devcb_write_line m_o4_func; + + // inputs + uint8_t m_ce1; // pin 13 + uint8_t m_ce2; // pin 14 + uint8_t m_a; // pins 5,6,7,4,3,2,1,15 from LSB to MSB + + // outputs + uint8_t m_out; // pins 12-9 from LSB to MSB + + // data + std::unique_ptr m_data; + + static const uint32_t PROM_SIZE; +}; + +class prom82s126_device : public prom82s129_base_device +{ +public: + prom82s126_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + +class prom82s129_device : public prom82s129_base_device +{ +public: + prom82s129_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + +// device type definition +extern const device_type PROM82S126; +extern const device_type PROM82S129; + +#endif /* PROM82S129_H */ diff --git a/src/devices/machine/dm9334.cpp b/src/devices/machine/dm9334.cpp index d90f9f6aa4c..7c52bc193bf 100644 --- a/src/devices/machine/dm9334.cpp +++ b/src/devices/machine/dm9334.cpp @@ -27,16 +27,12 @@ dm9334_device::dm9334_device(const machine_config &mconfig, const char *tag, dev , m_d(0) , m_a(0) , m_out(0) - , m_last_out(0) { } void dm9334_device::device_start() { - m_e = 0; - m_c = 0; - m_d = 0; - m_a = 0; + init(); save_item(NAME(m_e)); save_item(NAME(m_c)); @@ -67,19 +63,40 @@ void dm9334_device::init() m_d = 0; m_a = 0; m_out = 0; - m_last_out = 0; } + void dm9334_device::tick() { - // TODO - if (m_out != m_last_out) + uint8_t last_out = m_out; + + mode_t mode = static_cast((m_e << 1) | m_c); + switch(mode) + { + case mode_t::CLEAR: + m_out = 0; + break; + + case mode_t::DEMUX: + m_out = (m_d << m_a); + break; + + case mode_t::MEMORY: + // Preserve previous state + break; + + case mode_t::LATCH: + m_out &= ~(1 << m_a); + m_out |= (m_d << m_a); + break; + } + + if (m_out != last_out) { - m_last_out = m_out; m_out_func(m_out); for (int bit = 0; bit < 8; bit++) { - if (BIT(m_out, bit) == BIT(m_last_out, bit)) + if (BIT(m_out, bit) == BIT(last_out, bit)) continue; switch(bit) @@ -99,40 +116,61 @@ void dm9334_device::tick() WRITE_LINE_MEMBER( dm9334_device::e_w ) { - m_e = state; - tick(); + uint8_t last_e = m_e; + m_e = state & 1; + if (last_e != m_e) + tick(); } WRITE_LINE_MEMBER( dm9334_device::c_w ) { - m_c = state; - tick(); + uint8_t last_c = m_c; + m_c = state & 1; + if (last_c != m_c) + tick(); } WRITE_LINE_MEMBER( dm9334_device::d_w ) { - m_d = state; + uint8_t last_d = m_d; + m_d = state & 1; + if (last_d != m_d) + tick(); } WRITE_LINE_MEMBER( dm9334_device::a0_w ) { + uint8_t last_a = m_a; m_a &= ~(1 << 0); - m_a |= state << 0; - tick(); + m_a |= (state & 1) << 0; + if (last_a != m_a) + tick(); } WRITE_LINE_MEMBER( dm9334_device::a1_w ) { + uint8_t last_a = m_a; m_a &= ~(1 << 1); - m_a |= state << 1; - tick(); + m_a |= (state & 1) << 1; + if (last_a != m_a) + tick(); } WRITE_LINE_MEMBER( dm9334_device::a2_w ) { + uint8_t last_a = m_a; m_a &= ~(1 << 2); - m_a |= state << 2; - tick(); + m_a |= (state & 1) << 2; + if (last_a != m_a) + tick(); +} + +WRITE8_MEMBER( dm9334_device::a_w ) +{ + uint8_t last_a = m_a; + m_a = data & 0x7; + if (last_a != m_a) + tick(); } READ8_MEMBER( dm9334_device::output_r ) diff --git a/src/devices/machine/dm9334.h b/src/devices/machine/dm9334.h index 1699f47f5d8..df0cd9150ba 100644 --- a/src/devices/machine/dm9334.h +++ b/src/devices/machine/dm9334.h @@ -137,12 +137,22 @@ public: DECLARE_READ_LINE_MEMBER( q6_r ); DECLARE_READ_LINE_MEMBER( q7_r ); + uint8_t get_output() const { return m_out; } + protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; private: + enum class mode_t + { + DEMUX = 0x00, + LATCH = 0x01, + CLEAR = 0x02, + MEMORY = 0x03 + }; + void init(); void tick(); @@ -158,16 +168,13 @@ private: devcb_write_line m_q7_func; // inputs - uint8_t m_e; - uint8_t m_c; - uint8_t m_d; + uint8_t m_e; // pin 14 + uint8_t m_c; // pin 15 + uint8_t m_d; // pin 13 uint8_t m_a; // pins 1-3 from LSB to MSB // outputs uint8_t m_out; // pins 4-7 and 9-12 from LSB to MSB - - // old state - uint8_t m_last_out; }; // device type definition diff --git a/src/mame/drivers/hazeltin.cpp b/src/mame/drivers/hazeltin.cpp index 0fe504d4b15..79fe88ba13d 100644 --- a/src/mame/drivers/hazeltin.cpp +++ b/src/mame/drivers/hazeltin.cpp @@ -17,8 +17,12 @@ References: #include "emu.h" #include "cpu/i8085/i8085.h" +#include "machine/7400.h" +#include "machine/7404.h" +#include "machine/7474.h" #include "machine/74161.h" #include "machine/74175.h" +#include "machine/82s129.h" #include "machine/am2847.h" #include "machine/ay31015.h" #include "machine/clock.h" @@ -39,14 +43,23 @@ References: #define TMS3409A_TAG "u67" #define TMS3409B_TAG "u57" #define DOTCLK_TAG "dotclk" +#define DOTCLK_DISP_TAG "dotclk_dispatch" +#define CHAR_CTR_CLK_TAG "ch_bucket_ctr_clk" #define U58_TAG "u58" +#define U59_TAG "u59" +#define VID_PROM_ADDR_RESET_TAG "u59_y5" +#define U61_TAG "u61" #define U68_TAG "u68" #define U69_PROMMSB_TAG "u69" #define U70_PROMLSB_TAG "u70" +#define U70_TC_LINE_TAG "u70_tc" #define U71_PROM_TAG "u71" #define U72_PROMDEC_TAG "u72" #define U81_TAG "u81" +#define U83_TAG "u83" #define U84_DIV11_TAG "u84" +#define U85_VERT_DR_UB_TAG "u85" +#define U87_TAG "u87" #define U88_DIV9_TAG "u88" #define U90_DIV14_TAG "u90" #define BAUD_PROM_TAG "u39" @@ -96,12 +109,14 @@ public: , m_kbd_misc_keys(*this, MISCKEYS_TAG) , m_char_ram(*this, CHARRAM_TAG) , m_char_rom(*this, CHARROM_TAG) - , m_u71_prom(*this, U71_PROM_TAG) , m_line_buffer_lsb(*this, TMS3409A_TAG) , m_line_buffer_msb(*this, TMS3409B_TAG) , m_dotclk(*this, DOTCLK_TAG) , m_vid_prom_msb(*this, U69_PROMMSB_TAG) , m_vid_prom_lsb(*this, U70_PROMLSB_TAG) + , m_vid_prom(*this, U71_PROM_TAG) + , m_u59(*this, U59_TAG) + , m_u83(*this, U83_TAG) , m_char_y(*this, U84_DIV11_TAG) , m_char_x(*this, U88_DIV9_TAG) , m_vid_div14(*this, U90_DIV14_TAG) @@ -109,6 +124,8 @@ public: , m_u58(*this, U58_TAG) , m_u68(*this, U68_TAG) , m_u81(*this, U81_TAG) + , m_u87(*this, U87_TAG) + , m_u61(*this, U61_TAG) , m_screen(*this, SCREEN_TAG) , m_hblank_timer(nullptr) , m_scanline_timer(nullptr) @@ -144,9 +161,6 @@ public: DECLARE_READ_LINE_MEMBER(ay3600_control_r); DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); - DECLARE_WRITE_LINE_MEMBER(dotclk_w); - DECLARE_WRITE_LINE_MEMBER(ch_bucket_ctr_clk_w); - DECLARE_WRITE_LINE_MEMBER(u70_tc_w); DECLARE_WRITE8_MEMBER(refresh_address_w); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; @@ -169,12 +183,14 @@ private: required_shared_ptr m_char_ram; required_region_ptr m_char_rom; - required_region_ptr m_u71_prom; required_device m_line_buffer_lsb; required_device m_line_buffer_msb; required_device m_dotclk; required_device m_vid_prom_msb; required_device m_vid_prom_lsb; + required_device m_vid_prom; + required_device m_u59; + required_device m_u83; required_device m_char_y; required_device m_char_x; required_device m_vid_div14; @@ -182,6 +198,8 @@ private: required_device m_u58; required_device m_u68; required_device m_u81; + required_device m_u87; + required_device m_u61; required_device m_screen; @@ -349,24 +367,6 @@ void hazl1500_state::device_timer(emu_timer &timer, device_timer_id id, int para } } -WRITE_LINE_MEMBER(hazl1500_state::dotclk_w) -{ - m_u81->clock_w(state); - m_char_x->clock_w(state); -} - -WRITE_LINE_MEMBER(hazl1500_state::ch_bucket_ctr_clk_w) -{ - m_vid_prom_lsb->clock_w(state); - m_vid_prom_msb->clock_w(state); -} - -WRITE_LINE_MEMBER(hazl1500_state::u70_tc_w) -{ - m_vid_prom_msb->cet_w(state); - m_vid_prom_msb->cep_w(state); -} - WRITE8_MEMBER(hazl1500_state::refresh_address_w) { m_refresh_address = data; @@ -697,11 +697,35 @@ static MACHINE_CONFIG_START( hazl1500, hazl1500_state ) MCFG_TMS3409_ADD(TMS3409B_TAG) MCFG_CLOCK_ADD(DOTCLK_TAG, XTAL_33_264MHz/2) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(hazl1500_state, dotclk_w)) + MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE(DOTCLK_DISP_TAG, devcb_line_dispatch_device<2>, in_w)) + + MCFG_LINE_DISPATCH_ADD(DOTCLK_DISP_TAG, 2) + MCFG_LINE_DISPATCH_FWD_CB(0, 2, DEVWRITELINE(U81_TAG, ttl74175_device, clock_w)) + MCFG_LINE_DISPATCH_FWD_CB(1, 2, DEVWRITELINE(U88_DIV9_TAG, ttl74161_device, clock_w)) + + MCFG_74161_ADD(U70_PROMLSB_TAG) + MCFG_7416x_QA_CB(DEVWRITELINE(U71_PROM_TAG, prom82s129_device, a0_w)) + MCFG_7416x_QB_CB(DEVWRITELINE(U71_PROM_TAG, prom82s129_device, a1_w)) + MCFG_7416x_QC_CB(DEVWRITELINE(U71_PROM_TAG, prom82s129_device, a2_w)) + MCFG_7416x_QD_CB(DEVWRITELINE(U71_PROM_TAG, prom82s129_device, a3_w)) + MCFG_7416x_TC_CB(DEVWRITELINE(U70_TC_LINE_TAG, devcb_line_dispatch_device<2>, in_w)) + + MCFG_LINE_DISPATCH_ADD(U70_TC_LINE_TAG, 2) + MCFG_LINE_DISPATCH_FWD_CB(0, 2, DEVWRITELINE(U69_PROMMSB_TAG, ttl74161_device, cet_w)) + MCFG_LINE_DISPATCH_FWD_CB(1, 2, DEVWRITELINE(U69_PROMMSB_TAG, ttl74161_device, cep_w)) MCFG_74161_ADD(U69_PROMMSB_TAG) - MCFG_74161_ADD(U70_PROMLSB_TAG) - MCFG_7416x_TC_CB(WRITELINE(hazl1500_state, u70_tc_w)) + MCFG_7416x_QA_CB(DEVWRITELINE(U71_PROM_TAG, prom82s129_device, a4_w)) + MCFG_7416x_QB_CB(DEVWRITELINE(U71_PROM_TAG, prom82s129_device, a5_w)) + MCFG_7416x_QC_CB(DEVWRITELINE(U71_PROM_TAG, prom82s129_device, a6_w)) + + //MCFG_LINE_DISPATCH_ADD(CHAR_LINE_CNT_CLK_TAG, 3) + //MCFG_LINE_DISPATCH_FWD_CB(0, 3, DEVWRITELINE(U85_VERT_DR_UB_TAG, ttl7473_device, clk1_w)) + //MCFG_LINE_DISPATCH_FWD_CB(1, 3, DEVWRITELINE(U85_VERT_DR_UB_TAG, ttl7473_device, clk2_w)) + //MCFG_LINE_DISPATCH_FWD_CB(2, 3, DEVWRITELINE(U84_DIV11_TAG, ttl74161_device, clock_w)) + + MCFG_7400_ADD(U83_TAG) + //MCFG_7400_Y1_CB(DEVWRITELINE(CHAR_LINE_CNT_CLK_TAG, devcb_line_dispatch_device<4>, in_w)) MCFG_74161_ADD(U84_DIV11_TAG) MCFG_74161_ADD(U90_DIV14_TAG) @@ -710,13 +734,33 @@ static MACHINE_CONFIG_START( hazl1500, hazl1500_state ) MCFG_7416x_QC_CB(DEVWRITELINE(U81_TAG, ttl74175_device, d4_w)) MCFG_7416x_TC_CB(DEVWRITELINE(U81_TAG, ttl74175_device, d1_w)) + MCFG_LINE_DISPATCH_ADD(CHAR_CTR_CLK_TAG, 2) + MCFG_LINE_DISPATCH_FWD_CB(0, 2, DEVWRITELINE(U70_PROMLSB_TAG, ttl74161_device, clock_w)) + MCFG_LINE_DISPATCH_FWD_CB(1, 2, DEVWRITELINE(U69_PROMMSB_TAG, ttl74161_device, clock_w)) + MCFG_74175_ADD(U58_TAG) MCFG_74175_ADD(U68_TAG) MCFG_74175_ADD(U81_TAG) MCFG_74175_Q1_CB(DEVWRITELINE(U81_TAG, ttl74175_device, d2_w)) - MCFG_74175_NOT_Q2_CB(WRITELINE(hazl1500_state, ch_bucket_ctr_clk_w)) + MCFG_74175_NOT_Q2_CB(DEVWRITELINE(CHAR_CTR_CLK_TAG, devcb_line_dispatch_device<2>, in_w)) MCFG_DM9334_ADD(U72_PROMDEC_TAG) + MCFG_DM9334_Q4_CB(DEVWRITELINE(U83_TAG, ttl7400_device, b1_w)) + + MCFG_82S129_ADD(U71_PROM_TAG) + MCFG_82S129_O1_CB(DEVWRITELINE(U72_PROMDEC_TAG, dm9334_device, a0_w)) + MCFG_82S129_O2_CB(DEVWRITELINE(U72_PROMDEC_TAG, dm9334_device, a1_w)) + MCFG_82S129_O3_CB(DEVWRITELINE(U72_PROMDEC_TAG, dm9334_device, a2_w)) + MCFG_82S129_O4_CB(DEVWRITELINE(U72_PROMDEC_TAG, dm9334_device, d_w)) + + MCFG_7404_ADD(U61_TAG) + MCFG_7404_ADD(U87_TAG) + MCFG_7404_ADD(U59_TAG) + MCFG_7404_Y5_CB(DEVWRITELINE(VID_PROM_ADDR_RESET_TAG, devcb_line_dispatch_device<2>, in_w)) + + MCFG_LINE_DISPATCH_ADD(VID_PROM_ADDR_RESET_TAG, 2) + MCFG_LINE_DISPATCH_FWD_CB(0, 2, DEVWRITELINE(U70_PROMLSB_TAG, ttl74161_device, pe_w)) + MCFG_LINE_DISPATCH_FWD_CB(1, 2, DEVWRITELINE(U69_PROMMSB_TAG, ttl74161_device, pe_w)) /* keyboard controller */ MCFG_DEVICE_ADD(KBDC_TAG, AY3600, 0)