Previous 199869 Revisions Next

r34093 Sunday 28th December, 2014 at 16:26:25 UTC by Dirk Best
Add a TEA1002 color encoder device and use it for the Aquarius. It might
make sense to make this a direct descendent of the palette_device
instead.

Color information based on TEA1002 datasheet.  [Dirk Best, nitrofurano,
Bruce Abbott]
[src/emu/video]tea1002.c* tea1002.h* video.mak
[src/mess]mess.mak
[src/mess/drivers]aquarius.c
[src/mess/includes]aquarius.h
[src/mess/video]aquarius.c

trunk/src/emu/video/tea1002.c
r0r242605
1/***************************************************************************
2
3    TEA1002
4
5    license: MAME, GPL-2.0+
6    copyright-holders: Dirk Best
7
8    PAL colour encoder and video summer
9
10***************************************************************************/
11
12#include "tea1002.h"
13
14
15//**************************************************************************
16//  CONSTANTS
17//**************************************************************************
18
19const float tea1002_device::m_luminance[] =
20{
21    0, 22.5, 44, 66.5,  8.5, 31, 52.5, 100, // INV = 0
22   75, 52.5, 31,  8.5, 66.5, 44, 22.5, 0    // INV = 1
23};
24
25const int tea1002_device::m_phase[] =
26{
27   0, 103, 241, 167, 347,  61, 283, 0, // INV = 0
28   0, 283,  61, 347, 167, 241, 103, 0  // INV = 1
29};
30
31const int tea1002_device::m_amplitute[] =
32{
33   0, 48, 44, 33, 33, 44, 48, 0, // INV = 0
34   0, 24, 22, 17, 17, 22, 24, 0  // INV = 1
35};
36
37
38//**************************************************************************
39//  DEVICE DEFINITIONS
40//**************************************************************************
41
42const device_type TEA1002 = &device_creator<tea1002_device>;
43
44
45//**************************************************************************
46//  LIVE DEVICE
47//**************************************************************************
48
49//-------------------------------------------------
50//  paula_device - constructor
51//-------------------------------------------------
52
53tea1002_device::tea1002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
54   device_t(mconfig, TEA1002, "TEA1002 PAL colour encoder", tag, owner, clock, "tea1002", __FILE__)
55{
56}
57
58//-------------------------------------------------
59//  device_start - device-specific startup
60//-------------------------------------------------
61
62void tea1002_device::device_start()
63{
64}
65
66
67//**************************************************************************
68//  IMPLEMENTATION
69//**************************************************************************
70
71// this could be done in device_start() and cached, but it's only
72// accessed once at PALETTE_INIT anyway
73rgb_t tea1002_device::color(int index)
74{
75   // calculate yuv
76   double y = m_luminance[index] / 100;
77   double u = cos((m_phase[index] + m_tint) * M_PI / 180) * m_amplitute[index] / 100;
78   double v = sin((m_phase[index] + m_tint) * M_PI / 180) * m_amplitute[index] / 100;
79
80   // and convert to rgb
81   double r = y + v * 1.14;
82   double g = y - u * 0.395 - v * 0.581;
83   double b = y + u * 2.032;
84
85   return rgb_t(rgb_t::clamp(r * 255), rgb_t::clamp(g * 255), rgb_t::clamp(b * 255));
86}
trunk/src/emu/video/tea1002.h
r0r242605
1/***************************************************************************
2
3    TEA1002
4
5    license: MAME, GPL-2.0+
6    copyright-holders: Dirk Best
7
8    PAL colour encoder and video summer
9
10                            _____   _____
11                   INV   1 |*    \_/     | 18  CBLNK
12                     R   2 |             | 17  3,54 MHz
13                     G   3 |             | 16  GND
14                     B   4 |             | 15  CBF
15                _CSYNC   5 |   TEA1002   | 14  8,86 MHz
16       lum. delay line   6 |             | 13  8,86 MHz
17       lum. delay line   7 |             | 12  PAL switch
18   comp. video to mod.   8 |             | 11  chroma band limiting
19 d.c. adj. / colour bar  9 |_____________| 10  Vp
20
21***************************************************************************/
22
23#pragma once
24
25#ifndef __TEA1002_H__
26#define __TEA1002_H__
27
28#include "emu.h"
29
30
31//**************************************************************************
32//  INTERFACE CONFIGURATION MACROS
33//**************************************************************************
34
35#define MCFG_TEA1002_ADD(_tag, _clock) \
36   MCFG_DEVICE_ADD(_tag, TEA1002, _clock)
37
38
39//**************************************************************************
40//  TYPE DEFINITIONS
41//**************************************************************************
42
43// ======================> tea1002_device
44
45class tea1002_device : public device_t
46{
47public:
48   // construction/destruction
49   tea1002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
50
51   rgb_t color(int index);
52
53protected:
54   // device_t overrides
55   virtual void device_start();
56
57private:
58   static const int m_tint = -6; // what is this based on?
59   static const float m_luminance[16];
60   static const int m_phase[16];
61   static const int m_amplitute[16];
62};
63
64// device type definition
65extern const device_type TEA1002;
66
67#endif // __TEA1002_H__
trunk/src/emu/video/video.mak
r242604r242605
483483
484484#-------------------------------------------------
485485#
486#@src/emu/video/tea1002.h,VIDEOS += TEA1002
487#-------------------------------------------------
488
489ifneq ($(filter TEA1002,$(VIDEOS)),)
490VIDEOOBJS += $(VIDEOOBJ)/tea1002.o
491endif
492
493#-------------------------------------------------
494#
486495#@src/emu/video/tlc34076.h,VIDEOS += TLC34076
487496#-------------------------------------------------
488497
trunk/src/mess/drivers/aquarius.c
r242604r242605
357357   MCFG_SCREEN_PALETTE("palette")
358358
359359   MCFG_GFXDECODE_ADD("gfxdecode", "palette", aquarius )
360   MCFG_TEA1002_ADD("encoder", XTAL_8_867238MHz)
360361   MCFG_PALETTE_ADD("palette", 512)
361362   MCFG_PALETTE_INDIRECT_ENTRIES(16)
362363   MCFG_PALETTE_INIT_OWNER(aquarius_state, aquarius)
trunk/src/mess/includes/aquarius.h
r242604r242605
99
1010#include "emu.h"
1111#include "cpu/z80/z80.h"
12#include "video/tea1002.h"
1213#include "imagedev/cassette.h"
1314#include "machine/ram.h"
1415#include "sound/ay8910.h"
r242604r242605
3839         m_y7(*this, "Y7"),
3940         m_gfxdecode(*this, "gfxdecode"),
4041         m_screen(*this, "screen"),
42         m_tea1002(*this, "encoder"),
4143         m_palette(*this, "palette")
4244   { }
4345
r242604r242605
5860   required_ioport m_y7;
5961   required_device<gfxdecode_device> m_gfxdecode;
6062   required_device<screen_device> m_screen;
63   required_device<tea1002_device> m_tea1002;
6164   required_device<palette_device> m_palette;
6265
6366   UINT8 m_scrambler;
trunk/src/mess/mess.mak
r242604r242605
313313VIDEOS += SNES_PPU
314314VIDEOS += STVVDP
315315VIDEOS += T6A04
316VIDEOS += TEA1002
316317#VIDEOS += TLC34076
317318#VIDEOS += TMS34061
318319VIDEOS += TMS3556
trunk/src/mess/video/aquarius.c
r242604r242605
1010#include "includes/aquarius.h"
1111
1212
13
14static const rgb_t aquarius_colors[] =
15{
16   rgb_t::black,                  /* Black */
17   rgb_t(0xff, 0x00, 0x00), /* Red */
18   rgb_t(0x00, 0xff, 0x00), /* Green */
19   rgb_t(0xff, 0xff, 0x00), /* Yellow */
20   rgb_t(0x00, 0x00, 0xff), /* Blue */
21   rgb_t(0x7f, 0x00, 0x7f), /* Violet */
22   rgb_t(0x7f, 0xff, 0xff), /* Light Blue-Green */
23   rgb_t::white,                  /* White */
24   rgb_t(0xc0, 0xc0, 0xc0), /* Light Gray */
25   rgb_t(0x00, 0xff, 0xff), /* Blue-Green */
26   rgb_t(0xff, 0x00, 0xff), /* Magenta */
27   rgb_t(0x00, 0x00, 0x7f), /* Dark Blue */
28   rgb_t(0xff, 0xff, 0x7f), /* Light Yellow */
29   rgb_t(0x7f, 0xff, 0x7f), /* Light Green */
30   rgb_t(0xff, 0x7f, 0x00), /* Orange */
31   rgb_t(0x7f, 0x7f, 0x7f)  /* Dark Gray */
32};
33
3413static const unsigned short aquarius_palette[] =
3514{
3615   0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0,10, 0,11, 0,12, 0,13, 0,14, 0,15, 0,
r242604r242605
5635   int i;
5736
5837   for (i = 0; i < 16; i++)
59      m_palette->set_indirect_color(i, aquarius_colors[i]);
38      m_palette->set_indirect_color(i, m_tea1002->color(i));
6039
6140   for (i = 0; i < 512; i++)
6241      m_palette->set_pen_indirect(i, aquarius_palette[i]);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team