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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
// 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
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_SAA5050_D_CALLBACK(_read) \
devcb = &saa5050_device::set_d_rd_callback(*device, DEVCB_##_read);
#define MCFG_SAA5050_SCREEN_SIZE(_cols, _rows, _size) \
saa5050_device::static_set_screen_size(*device, _cols, _rows, _size);
//**************************************************************************
// 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, uint32_t clock);
static void static_set_screen_size(device_t &device, int cols, int rows, int size) { downcast<saa5050_device &>(device).m_cols = cols; downcast<saa5050_device &>(device).m_rows = rows; downcast<saa5050_device &>(device).m_size = size; }
template <class Object> static devcb_base &set_d_rd_callback(device_t &device, Object &&cb) { return downcast<saa5050_device &>(device).m_read_d.set_callback(std::forward<Object>(cb)); }
// 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 );
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, uint32_t 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, uint32_t 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, uint32_t 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, uint32_t 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, uint32_t 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, uint32_t 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, uint32_t 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, uint32_t 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
|