1 // license:BSD-3-Clause
2 // copyright-holders:James Wallace
3 /**********************************************************************
4 
5     Rockwell 10937/10957 interface and similar chips
6     Emulation by J.Wallace
7     OKI MSC1937 is a clone of this chip, with many others.
8 
9 **********************************************************************/
10 #ifndef MAME_MACHINE_ROC10937_H
11 #define MAME_MACHINE_ROC10937_H
12 
13 #pragma once
14 
15 class rocvfd_device : public device_t
16 {
17 public:
18 	// inline configuration helpers
set_port_value(uint8_t val)19 	void set_port_value(uint8_t val) { m_port_val = val; }
20 
21 	virtual void update_display();
22 	void shift_clock(int data);
23 	void write_char(int data);
24 	DECLARE_WRITE_LINE_MEMBER( sclk );
25 	DECLARE_WRITE_LINE_MEMBER( data );
26 	DECLARE_WRITE_LINE_MEMBER( por );
27 
28 
29 protected:
30 	rocvfd_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
31 
32 	std::unique_ptr<output_finder<16> > m_outputs;
33 
34 	int m_cursor_pos;
35 	int m_window_size;
36 	int m_shift_count;
37 	int m_shift_data;
38 	int m_pcursor_pos;
39 	int m_brightness;
40 	int m_count;
41 	int m_data;
42 	int m_duty;
43 	int m_disp;
44 	int m_sclk;
45 	uint8_t m_cursor;
46 	uint32_t m_chars[16];
47 
48 	virtual void device_start() override;
49 	virtual void device_reset() override;
50 	virtual void device_post_load() override;
51 
52 private:
53 	static uint32_t set_display(uint32_t segin);
54 
55 	uint8_t m_port_val;
56 };
57 
58 
59 class roc10937_device : public rocvfd_device {
60 public:
61 	roc10937_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 60);
62 };
63 
64 class msc1937_device : public rocvfd_device {
65 public:
66 	msc1937_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 60);
67 };
68 
69 class mic10937_device : public rocvfd_device {
70 public:
71 	mic10937_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 60);
72 };
73 
74 class roc10957_device : public rocvfd_device {
75 public:
76 	roc10957_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 60);
77 
78 	void write_char(int data);
79 };
80 
81 class s16lf01_device : public rocvfd_device {
82 public:
83 	s16lf01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 60);
84 };
85 
86 
87 DECLARE_DEVICE_TYPE(ROC10937, roc10937_device)
88 DECLARE_DEVICE_TYPE(MSC1937,  msc1937_device)
89 DECLARE_DEVICE_TYPE(MIC10937, mic10937_device)
90 DECLARE_DEVICE_TYPE(ROC10957, roc10957_device)
91 DECLARE_DEVICE_TYPE(S16LF01,  s16lf01_device)
92 
93 #endif // MAME_MACHINE_ROC10937_H
94