1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
Mullard SAA5050 Teletext Character Generator emulation
**********************************************************************
_____ _____
Vss 1 |* \_/ | 28 DE
_SI 2 | | 27 PO
_DATA 3 | | 26 LOSE
D1 4 | SAA5050 | 25 BLAN
D2 5 | SAA5051 | 24 R
D3 6 | SAA5052 | 23 G
D4 7 | SAA5053 | 22 B
D5 8 | SAA5054 | 21 Y
D6 9 | SAA5055 | 20 F1
D7 10 | SAA5056 | 19 TR6
DLIM 11 | SAA5057 | 18 Vdd
_GLR 12 | | 17 N/C
DEW 13 | | 16 _TLC
CRS 14 |_____________| 15 _BCS
**********************************************************************/
#ifndef MAME_VIDEO_SAA5050_H
#define MAME_VIDEO_SAA5050_H
#pragma once
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> saa5050_device
class saa5050_device : public device_t
{
public:
// construction/destruction
saa5050_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);
void set_screen_size(int cols, int rows, int size) { m_cols = cols; m_rows = rows; m_size = size; }
auto d_cb() { return m_read_d.bind(); }
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
DECLARE_WRITE_LINE_MEMBER( crs_w );
DECLARE_WRITE_LINE_MEMBER( dew_w );
DECLARE_WRITE_LINE_MEMBER( lose_w );
DECLARE_READ_LINE_MEMBER( tlc_r );
void write(uint8_t data);
DECLARE_WRITE_LINE_MEMBER( f1_w );
DECLARE_WRITE_LINE_MEMBER( tr6_w );
int get_rgb();
// NOTE: the following are provided for convenience only, SAA5050 is not a display controller
// this emulates the common setup where bit 7 of data inverts the display, and the
// bottom half of a double height row gets the same character data as the top half
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
protected:
saa5050_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, const XTAL &clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
private:
enum
{
NUL = 0,
ALPHA_RED,
ALPHA_GREEN,
ALPHA_YELLOW,
ALPHA_BLUE,
ALPHA_MAGENTA,
ALPHA_CYAN,
ALPHA_WHITE,
FLASH,
STEADY,
END_BOX,
START_BOX,
NORMAL_HEIGHT,
DOUBLE_HEIGHT,
S0,
S1,
DLE,
GRAPHICS_RED,
GRAPHICS_GREEN,
GRAPHICS_YELLOW,
GRAPHICS_BLUE,
GRAPHICS_MAGENTA,
GRAPHICS_CYAN,
GRAPHICS_WHITE,
CONCEAL_DISPLAY,
CONTIGUOUS_GFX,
SEPARATED_GFX,
ESC,
BLACK_BACKGROUND,
NEW_BACKGROUND,
HOLD_GRAPHICS,
RELEASE_GRAPHICS
};
void process_control_character(uint8_t data);
void set_next_chartype();
uint16_t get_gfx_data(uint8_t data, offs_t row, bool separated);
uint16_t get_rom_data(uint8_t data, offs_t row);
uint16_t character_rounding(uint16_t a, uint16_t b);
void get_character_data(uint8_t data);
required_region_ptr<uint8_t> m_char_rom;
devcb_read8 m_read_d;
uint8_t m_code;
uint8_t m_held_char;
uint8_t m_next_chartype;
uint8_t m_curr_chartype;
uint8_t m_held_chartype;
uint16_t m_char_data;
int m_bit;
rgb_t m_color;
int m_crs;
int m_ra;
int m_bg;
int m_fg;
int m_prev_col;
bool m_graphics;
bool m_separated;
bool m_flash;
bool m_boxed;
bool m_double_height;
bool m_double_height_old;
bool m_double_height_bottom_row;
bool m_double_height_prev_row;
bool m_hold_char;
bool m_hold_clear;
bool m_hold_off;
int m_frame_count;
int m_cols;
int m_rows;
int m_size;
};
// ======================> saa5051_device
class saa5051_device : public saa5050_device
{
public:
// construction/destruction
saa5051_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
};
// ======================> saa5052_device
class saa5052_device : public saa5050_device
{
public:
// construction/destruction
saa5052_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
};
// ======================> saa5053_device
class saa5053_device : public saa5050_device
{
public:
// construction/destruction
saa5053_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
};
// ======================> saa5054_device
class saa5054_device : public saa5050_device
{
public:
// construction/destruction
saa5054_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
};
// ======================> saa5055_device
class saa5055_device : public saa5050_device
{
public:
// construction/destruction
saa5055_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
};
// ======================> saa5056_device
class saa5056_device : public saa5050_device
{
public:
// construction/destruction
saa5056_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
};
// ======================> saa5057_device
class saa5057_device : public saa5050_device
{
public:
// construction/destruction
saa5057_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);
// optional information overrides
virtual const tiny_rom_entry *device_rom_region() const override;
};
// device type definition
DECLARE_DEVICE_TYPE(SAA5050, saa5050_device) // English
DECLARE_DEVICE_TYPE(SAA5051, saa5051_device) // German
DECLARE_DEVICE_TYPE(SAA5052, saa5052_device) // Swedish/Finnish
DECLARE_DEVICE_TYPE(SAA5053, saa5053_device) // Italian
DECLARE_DEVICE_TYPE(SAA5054, saa5054_device) // Belgian
DECLARE_DEVICE_TYPE(SAA5055, saa5055_device) // US ASCII
DECLARE_DEVICE_TYPE(SAA5056, saa5056_device) // Hebrew
DECLARE_DEVICE_TYPE(SAA5057, saa5057_device) // Cyrillic
#endif // MAME_VIDEO_SAA5050_H
|