summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2021-12-11 16:57:03 +0100
committer hap <happppp@users.noreply.github.com>2021-12-11 16:57:51 +0100
commit0ed664f5e830f000af19ffd3e927f4bd1763acbd (patch)
treedefec0cae72a13d3bf36d7cb808cfd9bc6e7d4b4
parent18ac15ba9e037d37220dc945c1b8d73d7db88b97 (diff)
input_merger: remove awkward initial_state setter, add notes
-rw-r--r--src/devices/machine/input_merger.cpp11
-rw-r--r--src/devices/machine/input_merger.h3
-rw-r--r--src/mame/drivers/saitek_leonardo.cpp2
-rw-r--r--src/mame/drivers/saitek_renaissance.cpp2
4 files changed, 12 insertions, 6 deletions
diff --git a/src/devices/machine/input_merger.cpp b/src/devices/machine/input_merger.cpp
index 3e0570d82b0..7424bd6e8fa 100644
--- a/src/devices/machine/input_merger.cpp
+++ b/src/devices/machine/input_merger.cpp
@@ -14,8 +14,15 @@ Default initial input pin(s) state:
- ALL_LOW: 0
TODO:
-- call output handler at reset? eg. a NAND gate whose inputs are low at
- power-on should output 1.
+- Change the strange initial input state, eg. right now it's all 1 for an AND
+ gate. All 0 for all devices would be more intuitive, but that would need a
+ config handler for setting the number of input pins since otherwise it can't
+ know if the state is active or not.
+- Call m_output_handler at reset, eg. a NOR gate whose inputs are low at power-on
+ should output 1 (to avoid surprises, this should be done after machine_reset).
+- Related to currently not calling m_output_handler at reset, if the hardware
+ 1st value written equals the initial state, m_output_handler is not called,
+ eg. writing 1 to an AND gate pin when the default initial state is 1.
***************************************************************************/
diff --git a/src/devices/machine/input_merger.h b/src/devices/machine/input_merger.h
index 744b342796d..aacffeab4ee 100644
--- a/src/devices/machine/input_merger.h
+++ b/src/devices/machine/input_merger.h
@@ -21,7 +21,6 @@ class input_merger_device : public device_t
public:
// configuration
auto output_handler() { return m_output_handler.bind(); }
- auto &initial_state(u32 val) { m_initval = val; return *this; } // initial input pin(s) state, be wary about the unused pins
// input lines
template <unsigned Bit> DECLARE_WRITE_LINE_MEMBER(in_w) { static_assert(Bit < 32, "invalid bit"); machine().scheduler().synchronize(timer_expired_delegate(FUNC(input_merger_device::update_state), this), (Bit << 1) | (state ? 1U : 0U)); }
@@ -48,7 +47,7 @@ protected:
devcb_write_line m_output_handler;
- u32 m_initval;
+ u32 const m_initval;
u32 const m_xorval;
int const m_active;
u32 m_state;
diff --git a/src/mame/drivers/saitek_leonardo.cpp b/src/mame/drivers/saitek_leonardo.cpp
index 075e89411a4..8037784733f 100644
--- a/src/mame/drivers/saitek_leonardo.cpp
+++ b/src/mame/drivers/saitek_leonardo.cpp
@@ -372,7 +372,7 @@ void leo_state::leonardo(machine_config &config)
m_maincpu->in_p6_cb().set(FUNC(leo_state::p6_r));
m_maincpu->out_p6_cb().set(FUNC(leo_state::p6_w));
- INPUT_MERGER_ANY_LOW(config, m_stb).initial_state(~u32(3));
+ INPUT_MERGER_ANY_LOW(config, m_stb);
m_stb->output_handler().set_inputline(m_maincpu, M6801_IS_LINE);
config.set_maximum_quantum(attotime::from_hz(6000));
diff --git a/src/mame/drivers/saitek_renaissance.cpp b/src/mame/drivers/saitek_renaissance.cpp
index ae947d99028..c0677e38b07 100644
--- a/src/mame/drivers/saitek_renaissance.cpp
+++ b/src/mame/drivers/saitek_renaissance.cpp
@@ -361,7 +361,7 @@ void ren_state::ren(machine_config &config)
m_maincpu->in_p6_cb().set(FUNC(ren_state::p6_r));
m_maincpu->out_p6_cb().set(FUNC(ren_state::p6_w));
- INPUT_MERGER_ANY_LOW(config, m_stb).initial_state(~u32(3));
+ INPUT_MERGER_ANY_LOW(config, m_stb);
m_stb->output_handler().set_inputline(m_maincpu, M6801_IS_LINE);
config.set_maximum_quantum(attotime::from_hz(6000));