diff options
Diffstat (limited to 'src/emu/machine/7474.c')
-rw-r--r-- | src/emu/machine/7474.c | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/emu/machine/7474.c b/src/emu/machine/7474.c index c66b92c8ede..180dd2c6b79 100644 --- a/src/emu/machine/7474.c +++ b/src/emu/machine/7474.c @@ -54,11 +54,11 @@ const device_type MACHINE_TTL7474 = &device_creator<ttl7474_device>; //------------------------------------------------- ttl7474_device::ttl7474_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, MACHINE_TTL7474, "7474", tag, owner, clock), - m_output_func(*this), - m_comp_output_func(*this) + : device_t(mconfig, MACHINE_TTL7474, "7474", tag, owner, clock), + m_output_func(*this), + m_comp_output_func(*this) { - init(); + init(); } //------------------------------------------------- @@ -67,15 +67,15 @@ ttl7474_device::ttl7474_device(const machine_config &mconfig, const char *tag, d void ttl7474_device::device_start() { - save_item(NAME(m_clear)); - save_item(NAME(m_preset)); - save_item(NAME(m_clk)); - save_item(NAME(m_d)); - save_item(NAME(m_output)); - save_item(NAME(m_output_comp)); - save_item(NAME(m_last_clock)); - save_item(NAME(m_last_output)); - save_item(NAME(m_last_output_comp)); + save_item(NAME(m_clear)); + save_item(NAME(m_preset)); + save_item(NAME(m_clk)); + save_item(NAME(m_d)); + save_item(NAME(m_output)); + save_item(NAME(m_output_comp)); + save_item(NAME(m_last_clock)); + save_item(NAME(m_last_output)); + save_item(NAME(m_last_output_comp)); m_output_func.resolve_safe(); m_comp_output_func.resolve_safe(); @@ -88,7 +88,7 @@ void ttl7474_device::device_start() void ttl7474_device::device_reset() { - init(); + init(); } @@ -98,40 +98,40 @@ void ttl7474_device::device_reset() void ttl7474_device::update() { - if (!m_preset && m_clear) // line 1 in truth table + if (!m_preset && m_clear) // line 1 in truth table { - m_output = 1; - m_output_comp = 0; + m_output = 1; + m_output_comp = 0; } - else if (m_preset && !m_clear) // line 2 in truth table + else if (m_preset && !m_clear) // line 2 in truth table { - m_output = 0; - m_output_comp = 1; + m_output = 0; + m_output_comp = 1; } - else if (!m_preset && !m_clear) // line 3 in truth table + else if (!m_preset && !m_clear) // line 3 in truth table { - m_output = 1; - m_output_comp = 1; + m_output = 1; + m_output_comp = 1; } - else if (!m_last_clock && m_clk) // line 4 in truth table + else if (!m_last_clock && m_clk) // line 4 in truth table { - m_output = m_d; - m_output_comp = !m_d; + m_output = m_d; + m_output_comp = !m_d; } - m_last_clock = m_clk; + m_last_clock = m_clk; // call callback if any of the outputs changed - if (m_output != m_last_output) + if (m_output != m_last_output) { - m_last_output = m_output; + m_last_output = m_output; m_output_func(m_output); } // call callback if any of the outputs changed - if (m_output_comp != m_last_output_comp) + if (m_output_comp != m_last_output_comp) { - m_last_output_comp = m_output_comp; + m_last_output_comp = m_output_comp; m_comp_output_func(m_output_comp); } } @@ -143,7 +143,7 @@ void ttl7474_device::update() WRITE_LINE_MEMBER( ttl7474_device::clear_w ) { - m_clear = state & 1; + m_clear = state & 1; update(); } @@ -154,7 +154,7 @@ WRITE_LINE_MEMBER( ttl7474_device::clear_w ) WRITE_LINE_MEMBER( ttl7474_device::preset_w ) { - m_preset = state & 1; + m_preset = state & 1; update(); } @@ -165,7 +165,7 @@ WRITE_LINE_MEMBER( ttl7474_device::preset_w ) WRITE_LINE_MEMBER( ttl7474_device::clock_w ) { - m_clk = state & 1; + m_clk = state & 1; update(); } @@ -176,7 +176,7 @@ WRITE_LINE_MEMBER( ttl7474_device::clock_w ) WRITE_LINE_MEMBER( ttl7474_device::d_w ) { - m_d = state & 1; + m_d = state & 1; update(); } @@ -187,7 +187,7 @@ WRITE_LINE_MEMBER( ttl7474_device::d_w ) READ_LINE_MEMBER( ttl7474_device::output_r ) { - return m_output; + return m_output; } @@ -197,18 +197,18 @@ READ_LINE_MEMBER( ttl7474_device::output_r ) READ_LINE_MEMBER( ttl7474_device::output_comp_r ) { - return m_output_comp; + return m_output_comp; } void ttl7474_device::init() { - m_clear = 1; - m_preset = 1; - m_clk = 1; - m_d = 1; - - m_output = -1; - m_last_clock = 1; - m_last_output = -1; - m_last_output_comp = -1; + m_clear = 1; + m_preset = 1; + m_clk = 1; + m_d = 1; + + m_output = -1; + m_last_clock = 1; + m_last_output = -1; + m_last_output_comp = -1; } |