1 // license:BSD-3-Clause
2 // copyright-holders:Dirk Best, Vas Crabb
3 /*****************************************************************************
4  *
5  *  DL1416
6  *
7  * 4-Digit 16-Segment Alphanumeric Intelligent Display
8  * with Memory/Decoder/Driver
9  *
10  * See video/dl1416.c for more info
11  *
12  ****************************************************************************/
13 
14 #ifndef MAME_VIDEO_DL1416_H
15 #define MAME_VIDEO_DL1416_H
16 
17 #pragma once
18 
19 
20 /***************************************************************************
21     DEVICE TYPES
22 ***************************************************************************/
23 
DECLARE_DEVICE_TYPE(DL1414T,dl1414_device)24 DECLARE_DEVICE_TYPE(DL1414T, dl1414_device)
25 DECLARE_DEVICE_TYPE(DL1416B, dl1416_device)
26 DECLARE_DEVICE_TYPE(DL1416T, dl1416_device)
27 
28 
29 /***************************************************************************
30     TYPE DECLARATIONS
31 ***************************************************************************/
32 
33 class dl1414_device : public device_t
34 {
35 public:
36 	auto update() { return m_update_cb.bind(); }
37 
38 	// signal-level interface
39 	DECLARE_WRITE_LINE_MEMBER(wr_w); // write strobe (rising edge)
40 	DECLARE_WRITE_LINE_MEMBER(ce_w); // chip enable (active low)
41 	void addr_w(u8 state);
42 	void data_w(u8 state);
43 
44 	// bus interface - still requires cu_w to set cursor enable state
45 	virtual void bus_w(offs_t offset, u8 data);
46 
47 protected:
48 	dl1414_device(
49 			machine_config const &mconfig,
50 			device_type type,
51 			char const *tag,
52 			device_t *owner,
53 			u32 clock);
54 
55 	// device-level overrides
56 	virtual void device_start() override;
57 	virtual void device_reset() override;
58 
59 	void set_cursor_state(offs_t offset, bool state);
60 	virtual u16 translate(u8 digit, bool cursor) const = 0;
61 
62 private:
63 	devcb_write16 m_update_cb;
64 
65 	// internal state
66 	u8 m_digit_ram[4]; // holds the digit code for each position
67 	bool m_cursor_state[4]; // holds the cursor state for each position
68 
69 	// input line state
70 	bool m_wr_in;
71 	bool m_ce_in, m_ce_latch;
72 	u8 m_addr_in, m_addr_latch;
73 	u8 m_data_in;
74 };
75 
76 class dl1416_device : public dl1414_device
77 {
78 public:
79 	DECLARE_WRITE_LINE_MEMBER(cu_w); // cursor enable (active low)
80 
81 protected:
82 	dl1416_device(
83 			machine_config const &mconfig,
84 			device_type type,
85 			char const *tag,
86 			device_t *owner,
87 			u32 clock);
88 
89 	// device-level overrides
90 	virtual void device_start() override;
91 
cu_in()92 	bool cu_in() const { return m_cu_in; }
93 
94 private:
95 	// input line state
96 	bool m_cu_in;
97 };
98 
99 #endif // MAME_VIDEO_DL1416_H
100