mirror of
https://github.com/holub/mame
synced 2025-05-23 22:20:01 +03:00
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]
This commit is contained in:
parent
00e1352854
commit
4e92657190
86
src/emu/video/tea1002.c
Normal file
86
src/emu/video/tea1002.c
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
TEA1002
|
||||||
|
|
||||||
|
license: MAME, GPL-2.0+
|
||||||
|
copyright-holders: Dirk Best
|
||||||
|
|
||||||
|
PAL colour encoder and video summer
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "tea1002.h"
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// CONSTANTS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
const float tea1002_device::m_luminance[] =
|
||||||
|
{
|
||||||
|
0, 22.5, 44, 66.5, 8.5, 31, 52.5, 100, // INV = 0
|
||||||
|
75, 52.5, 31, 8.5, 66.5, 44, 22.5, 0 // INV = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
const int tea1002_device::m_phase[] =
|
||||||
|
{
|
||||||
|
0, 103, 241, 167, 347, 61, 283, 0, // INV = 0
|
||||||
|
0, 283, 61, 347, 167, 241, 103, 0 // INV = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
const int tea1002_device::m_amplitute[] =
|
||||||
|
{
|
||||||
|
0, 48, 44, 33, 33, 44, 48, 0, // INV = 0
|
||||||
|
0, 24, 22, 17, 17, 22, 24, 0 // INV = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// DEVICE DEFINITIONS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
const device_type TEA1002 = &device_creator<tea1002_device>;
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// LIVE DEVICE
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// paula_device - constructor
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
tea1002_device::tea1002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||||
|
device_t(mconfig, TEA1002, "TEA1002 PAL colour encoder", tag, owner, clock, "tea1002", __FILE__)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_start - device-specific startup
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void tea1002_device::device_start()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// IMPLEMENTATION
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
// this could be done in device_start() and cached, but it's only
|
||||||
|
// accessed once at PALETTE_INIT anyway
|
||||||
|
rgb_t tea1002_device::color(int index)
|
||||||
|
{
|
||||||
|
// calculate yuv
|
||||||
|
double y = m_luminance[index] / 100;
|
||||||
|
double u = cos((m_phase[index] + m_tint) * M_PI / 180) * m_amplitute[index] / 100;
|
||||||
|
double v = sin((m_phase[index] + m_tint) * M_PI / 180) * m_amplitute[index] / 100;
|
||||||
|
|
||||||
|
// and convert to rgb
|
||||||
|
double r = y + v * 1.14;
|
||||||
|
double g = y - u * 0.395 - v * 0.581;
|
||||||
|
double b = y + u * 2.032;
|
||||||
|
|
||||||
|
return rgb_t(rgb_t::clamp(r * 255), rgb_t::clamp(g * 255), rgb_t::clamp(b * 255));
|
||||||
|
}
|
67
src/emu/video/tea1002.h
Normal file
67
src/emu/video/tea1002.h
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
TEA1002
|
||||||
|
|
||||||
|
license: MAME, GPL-2.0+
|
||||||
|
copyright-holders: Dirk Best
|
||||||
|
|
||||||
|
PAL colour encoder and video summer
|
||||||
|
|
||||||
|
_____ _____
|
||||||
|
INV 1 |* \_/ | 18 CBLNK
|
||||||
|
R 2 | | 17 3,54 MHz
|
||||||
|
G 3 | | 16 GND
|
||||||
|
B 4 | | 15 CBF
|
||||||
|
_CSYNC 5 | TEA1002 | 14 8,86 MHz
|
||||||
|
lum. delay line 6 | | 13 8,86 MHz
|
||||||
|
lum. delay line 7 | | 12 PAL switch
|
||||||
|
comp. video to mod. 8 | | 11 chroma band limiting
|
||||||
|
d.c. adj. / colour bar 9 |_____________| 10 Vp
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __TEA1002_H__
|
||||||
|
#define __TEA1002_H__
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// INTERFACE CONFIGURATION MACROS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
#define MCFG_TEA1002_ADD(_tag, _clock) \
|
||||||
|
MCFG_DEVICE_ADD(_tag, TEA1002, _clock)
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// TYPE DEFINITIONS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
// ======================> tea1002_device
|
||||||
|
|
||||||
|
class tea1002_device : public device_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// construction/destruction
|
||||||
|
tea1002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||||
|
|
||||||
|
rgb_t color(int index);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// device_t overrides
|
||||||
|
virtual void device_start();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const int m_tint = -6; // what is this based on?
|
||||||
|
static const float m_luminance[16];
|
||||||
|
static const int m_phase[16];
|
||||||
|
static const int m_amplitute[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
// device type definition
|
||||||
|
extern const device_type TEA1002;
|
||||||
|
|
||||||
|
#endif // __TEA1002_H__
|
@ -481,6 +481,15 @@ ifneq ($(filter T6A04,$(VIDEOS)),)
|
|||||||
VIDEOOBJS+= $(VIDEOOBJ)/t6a04.o
|
VIDEOOBJS+= $(VIDEOOBJ)/t6a04.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
#@src/emu/video/tea1002.h,VIDEOS += TEA1002
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
ifneq ($(filter TEA1002,$(VIDEOS)),)
|
||||||
|
VIDEOOBJS += $(VIDEOOBJ)/tea1002.o
|
||||||
|
endif
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#
|
#
|
||||||
#@src/emu/video/tlc34076.h,VIDEOS += TLC34076
|
#@src/emu/video/tlc34076.h,VIDEOS += TLC34076
|
||||||
|
@ -357,6 +357,7 @@ static MACHINE_CONFIG_START( aquarius, aquarius_state )
|
|||||||
MCFG_SCREEN_PALETTE("palette")
|
MCFG_SCREEN_PALETTE("palette")
|
||||||
|
|
||||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", aquarius )
|
MCFG_GFXDECODE_ADD("gfxdecode", "palette", aquarius )
|
||||||
|
MCFG_TEA1002_ADD("encoder", XTAL_8_867238MHz)
|
||||||
MCFG_PALETTE_ADD("palette", 512)
|
MCFG_PALETTE_ADD("palette", 512)
|
||||||
MCFG_PALETTE_INDIRECT_ENTRIES(16)
|
MCFG_PALETTE_INDIRECT_ENTRIES(16)
|
||||||
MCFG_PALETTE_INIT_OWNER(aquarius_state, aquarius)
|
MCFG_PALETTE_INIT_OWNER(aquarius_state, aquarius)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "cpu/z80/z80.h"
|
#include "cpu/z80/z80.h"
|
||||||
|
#include "video/tea1002.h"
|
||||||
#include "imagedev/cassette.h"
|
#include "imagedev/cassette.h"
|
||||||
#include "machine/ram.h"
|
#include "machine/ram.h"
|
||||||
#include "sound/ay8910.h"
|
#include "sound/ay8910.h"
|
||||||
@ -38,6 +39,7 @@ public:
|
|||||||
m_y7(*this, "Y7"),
|
m_y7(*this, "Y7"),
|
||||||
m_gfxdecode(*this, "gfxdecode"),
|
m_gfxdecode(*this, "gfxdecode"),
|
||||||
m_screen(*this, "screen"),
|
m_screen(*this, "screen"),
|
||||||
|
m_tea1002(*this, "encoder"),
|
||||||
m_palette(*this, "palette")
|
m_palette(*this, "palette")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -58,6 +60,7 @@ public:
|
|||||||
required_ioport m_y7;
|
required_ioport m_y7;
|
||||||
required_device<gfxdecode_device> m_gfxdecode;
|
required_device<gfxdecode_device> m_gfxdecode;
|
||||||
required_device<screen_device> m_screen;
|
required_device<screen_device> m_screen;
|
||||||
|
required_device<tea1002_device> m_tea1002;
|
||||||
required_device<palette_device> m_palette;
|
required_device<palette_device> m_palette;
|
||||||
|
|
||||||
UINT8 m_scrambler;
|
UINT8 m_scrambler;
|
||||||
|
@ -313,6 +313,7 @@ VIDEOS += SED1520
|
|||||||
VIDEOS += SNES_PPU
|
VIDEOS += SNES_PPU
|
||||||
VIDEOS += STVVDP
|
VIDEOS += STVVDP
|
||||||
VIDEOS += T6A04
|
VIDEOS += T6A04
|
||||||
|
VIDEOS += TEA1002
|
||||||
#VIDEOS += TLC34076
|
#VIDEOS += TLC34076
|
||||||
#VIDEOS += TMS34061
|
#VIDEOS += TMS34061
|
||||||
VIDEOS += TMS3556
|
VIDEOS += TMS3556
|
||||||
|
@ -10,27 +10,6 @@
|
|||||||
#include "includes/aquarius.h"
|
#include "includes/aquarius.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const rgb_t aquarius_colors[] =
|
|
||||||
{
|
|
||||||
rgb_t::black, /* Black */
|
|
||||||
rgb_t(0xff, 0x00, 0x00), /* Red */
|
|
||||||
rgb_t(0x00, 0xff, 0x00), /* Green */
|
|
||||||
rgb_t(0xff, 0xff, 0x00), /* Yellow */
|
|
||||||
rgb_t(0x00, 0x00, 0xff), /* Blue */
|
|
||||||
rgb_t(0x7f, 0x00, 0x7f), /* Violet */
|
|
||||||
rgb_t(0x7f, 0xff, 0xff), /* Light Blue-Green */
|
|
||||||
rgb_t::white, /* White */
|
|
||||||
rgb_t(0xc0, 0xc0, 0xc0), /* Light Gray */
|
|
||||||
rgb_t(0x00, 0xff, 0xff), /* Blue-Green */
|
|
||||||
rgb_t(0xff, 0x00, 0xff), /* Magenta */
|
|
||||||
rgb_t(0x00, 0x00, 0x7f), /* Dark Blue */
|
|
||||||
rgb_t(0xff, 0xff, 0x7f), /* Light Yellow */
|
|
||||||
rgb_t(0x7f, 0xff, 0x7f), /* Light Green */
|
|
||||||
rgb_t(0xff, 0x7f, 0x00), /* Orange */
|
|
||||||
rgb_t(0x7f, 0x7f, 0x7f) /* Dark Gray */
|
|
||||||
};
|
|
||||||
|
|
||||||
static const unsigned short aquarius_palette[] =
|
static const unsigned short aquarius_palette[] =
|
||||||
{
|
{
|
||||||
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,
|
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,
|
||||||
@ -56,7 +35,7 @@ PALETTE_INIT_MEMBER(aquarius_state, aquarius)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
m_palette->set_indirect_color(i, aquarius_colors[i]);
|
m_palette->set_indirect_color(i, m_tea1002->color(i));
|
||||||
|
|
||||||
for (i = 0; i < 512; i++)
|
for (i = 0; i < 512; i++)
|
||||||
m_palette->set_pen_indirect(i, aquarius_palette[i]);
|
m_palette->set_pen_indirect(i, aquarius_palette[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user