diff options
Diffstat (limited to 'src/devices/video/dl1416.cpp')
-rw-r--r-- | src/devices/video/dl1416.cpp | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/src/devices/video/dl1416.cpp b/src/devices/video/dl1416.cpp index a1ebf53c6a1..ca5ef344f38 100644 --- a/src/devices/video/dl1416.cpp +++ b/src/devices/video/dl1416.cpp @@ -1,4 +1,4 @@ -// license:GPL-2.0+ +// license:BSD-3-Clause // copyright-holders:Dirk Best, Vas Crabb /***************************************************************************** * @@ -185,15 +185,12 @@ dl1414_device::dl1414_device( device_t *owner, u32 clock) : device_t(mconfig, type, tag, owner, clock) - , m_update_cb(*this) - , m_digit_ram{ 0x00, 0x00, 0x00, 0x00 } - , m_cursor_state{ false, false, false, false } , m_wr_in(true) - , m_ce_in(true) - , m_ce_latch(true) , m_addr_in(0x00) - , m_addr_latch(0x00) , m_data_in(0x00) + , m_update_cb(*this) + , m_digit_ram{ 0x00, 0x00, 0x00, 0x00 } + , m_cursor_state{ false, false, false, false } { } @@ -204,7 +201,10 @@ dl1416_device::dl1416_device( device_t *owner, u32 clock) : dl1414_device(mconfig, type, tag, owner, clock) + , m_ce_in(true) + , m_ce_latch(true) , m_cu_in(true) + , m_addr_latch(0x00) { } @@ -214,34 +214,17 @@ dl1416_device::dl1416_device( void dl1414_device::device_start() { - m_update_cb.resolve_safe(); - // register for state saving save_item(NAME(m_digit_ram)); save_item(NAME(m_cursor_state)); save_item(NAME(m_wr_in)); - save_item(NAME(m_ce_in)); - save_item(NAME(m_ce_latch)); save_item(NAME(m_addr_in)); - save_item(NAME(m_addr_latch)); save_item(NAME(m_data_in)); // set initial state for input lines m_wr_in = true; - m_ce_in = true; - m_ce_latch = true; m_addr_in = 0x00; - m_addr_latch = 0x00; m_data_in = 0x00; - - // randomise internal RAM - for (unsigned i = 0; 4 > i; ++i) - { - m_digit_ram[i] = machine().rand() & 0x3f; - // TODO: only enable the following line if the device actually has a cursor (DL1416T and DL1416B), if DL1414 then cursor is always 0! - //m_cursor_state[i] = bool(BIT(device->machine().rand(), 7)); - m_cursor_state[i] = false; - } } void dl1416_device::device_start() @@ -249,10 +232,16 @@ void dl1416_device::device_start() dl1414_device::device_start(); // register for state saving + save_item(NAME(m_ce_in)); + save_item(NAME(m_ce_latch)); save_item(NAME(m_cu_in)); + save_item(NAME(m_addr_latch)); // set initial state for input lines + m_ce_in = true; + m_ce_latch = true; m_cu_in = true; + m_addr_latch = 0x00; } //------------------------------------------------- @@ -263,7 +252,7 @@ void dl1414_device::device_reset() { // push initial display state for (unsigned i = 0; 4 > i; ++i) - m_update_cb(i, translate(m_digit_ram[i], m_cursor_state[i]), 0xffff); + do_update(i); } @@ -271,7 +260,17 @@ void dl1414_device::device_reset() IMPLEMENTATION *****************************************************************************/ -WRITE_LINE_MEMBER( dl1414_device::wr_w ) +void dl1414_device::wr_w(int state) +{ + if (bool(state) != m_wr_in) + { + m_wr_in = bool(state); + if (m_wr_in) + bus_w(m_addr_in, m_data_in); + } +} + +void dl1416_device::wr_w(int state) { if (bool(state) != m_wr_in) { @@ -289,12 +288,12 @@ WRITE_LINE_MEMBER( dl1414_device::wr_w ) } } -WRITE_LINE_MEMBER( dl1414_device::ce_w ) +void dl1416_device::ce_w(int state) { m_ce_in = bool(state); } -WRITE_LINE_MEMBER( dl1416_device::cu_w ) +void dl1416_device::cu_w(int state) { m_cu_in = bool(state); } @@ -317,7 +316,7 @@ void dl1414_device::bus_w(offs_t offset, u8 data) if (m_digit_ram[offset] != data) { m_digit_ram[offset] = data; - m_update_cb(offset, translate(m_digit_ram[offset], m_cursor_state[offset]), 0xffff); + do_update(offset); } } @@ -328,6 +327,11 @@ void dl1414_device::set_cursor_state(offs_t offset, bool state) if (state != m_cursor_state[offset]) { m_cursor_state[offset] = state; - m_update_cb(offset, translate(m_digit_ram[offset], m_cursor_state[offset]), 0xffff); + do_update(offset); } } + +void dl1414_device::do_update(offs_t offset) +{ + m_update_cb(offset, translate(m_digit_ram[offset], m_cursor_state[offset]), 0xffff); +} |