mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
dl1416: Simplify bus_w handlers and type names (nw)
This commit is contained in:
parent
f9bcdcbbc9
commit
af1155ef0b
@ -50,13 +50,13 @@ namespace {
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
constexpr uint16_t SEG_BLANK = 0x0000;
|
||||
constexpr uint16_t SEG_UNDEF = SEG_BLANK;
|
||||
constexpr uint16_t SEG_CURSOR = 0xffff;
|
||||
constexpr u16 SEG_BLANK = 0x0000;
|
||||
constexpr u16 SEG_UNDEF = SEG_BLANK;
|
||||
constexpr u16 SEG_CURSOR = 0xffff;
|
||||
|
||||
|
||||
/* character set DL1416T */
|
||||
uint16_t const dl1416t_segments[128] = {
|
||||
u16 const dl1416t_segments[128] = {
|
||||
SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
||||
SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
||||
SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */
|
||||
@ -95,13 +95,13 @@ uint16_t const dl1416t_segments[128] = {
|
||||
class dl1414t_device : public dl1414_device
|
||||
{
|
||||
public:
|
||||
dl1414t_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
|
||||
dl1414t_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
|
||||
: dl1414_device(mconfig, DL1414T, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual uint16_t translate(uint8_t digit, bool cursor) const override
|
||||
virtual u16 translate(u8 digit, bool cursor) const override
|
||||
{
|
||||
return dl1416t_segments[digit & 0x7f];
|
||||
}
|
||||
@ -111,21 +111,21 @@ protected:
|
||||
class dl1416b_device : public dl1416_device
|
||||
{
|
||||
public:
|
||||
dl1416b_device(machine_config const &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
dl1416b_device(machine_config const &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: dl1416_device(mconfig, DL1416B, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
virtual DECLARE_WRITE8_MEMBER(bus_w) override
|
||||
virtual void bus_w(offs_t offset, u8 data) override
|
||||
{
|
||||
if (!cu_in())
|
||||
set_cursor_state(offset, BIT(data, 0));
|
||||
else
|
||||
dl1416_device::bus_w(space, offset, data, mem_mask);
|
||||
dl1416_device::bus_w(offset, data);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual uint16_t translate(uint8_t digit, bool cursor) const override
|
||||
virtual u16 translate(u8 digit, bool cursor) const override
|
||||
{
|
||||
return cursor ? SEG_CURSOR : dl1416t_segments[digit & 0x7f];
|
||||
}
|
||||
@ -135,21 +135,21 @@ protected:
|
||||
class dl1416t_device : public dl1416_device
|
||||
{
|
||||
public:
|
||||
dl1416t_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
dl1416t_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: dl1416_device(mconfig, DL1416T, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
virtual DECLARE_WRITE8_MEMBER(bus_w) override
|
||||
virtual void bus_w(offs_t offset, u8 data) override
|
||||
{
|
||||
if (!cu_in())
|
||||
for (unsigned i = 0; 4 > i; ++i) set_cursor_state(i, BIT(data, i));
|
||||
else
|
||||
dl1416_device::bus_w(space, offset, data, mem_mask);
|
||||
dl1416_device::bus_w(offset, data);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual uint16_t translate(uint8_t digit, bool cursor) const override
|
||||
virtual u16 translate(u8 digit, bool cursor) const override
|
||||
{
|
||||
digit &= 0x7f;
|
||||
return (cursor && (0x20 <= digit) && (0x5f >= digit)) ? SEG_CURSOR : dl1416t_segments[digit];
|
||||
@ -183,7 +183,7 @@ dl1414_device::dl1414_device(
|
||||
device_type type,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
uint32_t clock)
|
||||
u32 clock)
|
||||
: device_t(mconfig, type, tag, owner, clock)
|
||||
, m_update_cb(*this)
|
||||
, m_digit_ram{ 0x00, 0x00, 0x00, 0x00 }
|
||||
@ -202,7 +202,7 @@ dl1416_device::dl1416_device(
|
||||
device_type type,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
uint32_t clock)
|
||||
u32 clock)
|
||||
: dl1414_device(mconfig, type, tag, owner, clock)
|
||||
, m_cu_in(true)
|
||||
{
|
||||
@ -279,7 +279,7 @@ WRITE_LINE_MEMBER( dl1414_device::wr_w )
|
||||
if (m_wr_in)
|
||||
{
|
||||
if (!m_ce_latch)
|
||||
bus_w(machine().dummy_space(), m_addr_latch, m_data_in, 0x7f);
|
||||
bus_w(m_addr_latch, m_data_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -309,7 +309,7 @@ void dl1414_device::data_w(u8 state)
|
||||
m_data_in = state & 0x7f;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( dl1414_device::bus_w )
|
||||
void dl1414_device::bus_w(offs_t offset, u8 data)
|
||||
{
|
||||
offset &= 0x03; // A0-A1
|
||||
data &= 0x7f; // D0-D6
|
||||
|
@ -38,11 +38,11 @@ public:
|
||||
// signal-level interface
|
||||
DECLARE_WRITE_LINE_MEMBER(wr_w); // write strobe (rising edge)
|
||||
DECLARE_WRITE_LINE_MEMBER(ce_w); // chip enable (active low)
|
||||
void addr_w(uint8_t state);
|
||||
void data_w(uint8_t state);
|
||||
void addr_w(u8 state);
|
||||
void data_w(u8 state);
|
||||
|
||||
// bus interface - still requires cu_w to set cursor enable state
|
||||
virtual DECLARE_WRITE8_MEMBER(bus_w);
|
||||
virtual void bus_w(offs_t offset, u8 data);
|
||||
|
||||
protected:
|
||||
dl1414_device(
|
||||
@ -50,27 +50,27 @@ protected:
|
||||
device_type type,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
uint32_t clock);
|
||||
u32 clock);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
void set_cursor_state(offs_t offset, bool state);
|
||||
virtual uint16_t translate(u8 digit, bool cursor) const = 0;
|
||||
virtual u16 translate(u8 digit, bool cursor) const = 0;
|
||||
|
||||
private:
|
||||
devcb_write16 m_update_cb;
|
||||
|
||||
// internal state
|
||||
uint8_t m_digit_ram[4]; // holds the digit code for each position
|
||||
u8 m_digit_ram[4]; // holds the digit code for each position
|
||||
bool m_cursor_state[4]; // holds the cursor state for each position
|
||||
|
||||
// input line state
|
||||
bool m_wr_in;
|
||||
bool m_ce_in, m_ce_latch;
|
||||
uint8_t m_addr_in, m_addr_latch;
|
||||
uint8_t m_data_in;
|
||||
u8 m_addr_in, m_addr_latch;
|
||||
u8 m_data_in;
|
||||
};
|
||||
|
||||
class dl1416_device : public dl1414_device
|
||||
@ -84,7 +84,7 @@ protected:
|
||||
device_type type,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
uint32_t clock);
|
||||
u32 clock);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
|
Loading…
Reference in New Issue
Block a user