summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/video/tlc34076.h
blob: a2aac64aec9b9becdc21e6af09f5a7283f3e3848 (plain) (blame)
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
/***************************************************************************

    tlc34076.h

    Basic implementation of the TLC34076 palette chip and similar
    compatible chips.

***************************************************************************/

#pragma once

#ifndef __TLC34076_H__
#define __TLC34076_H__


/***************************************************************************
    CONSTANTS
***************************************************************************/

enum tlc34076_bits
{
	TLC34076_6_BIT = 6,
	TLC34076_8_BIT = 8
};


/***************************************************************************
    TYPE DEFINITIONS
***************************************************************************/

class tlc34076_device : public device_t
{
public:
	// construction/destruction
	tlc34076_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

	// static configuration helpers
	static void static_set_bits(device_t &device, tlc34076_bits bits);

	// public interface
	const pen_t *get_pens();
	DECLARE_READ8_MEMBER(read);
	DECLARE_WRITE8_MEMBER(write);

protected:
	// device-level overrides
	virtual void device_start();
	virtual void device_reset();

private:
	// internal state
	UINT8 m_local_paletteram[0x300];
	UINT8 m_regs[0x10];
	UINT8 m_palettedata[3];
	UINT8 m_writeindex;
	UINT8 m_readindex;
	UINT8 m_dacbits;
	rgb_t m_pens[0x100];
};


/***************************************************************************
    DEVICE CONFIGURATION MACROS
***************************************************************************/

#define MCFG_TLC34076_ADD(_tag, _bits) \
	MCFG_DEVICE_ADD(_tag, TLC34076, 0) \
	tlc34076_device::static_set_bits(*device, _bits);


extern const device_type TLC34076;


#endif /* __TLC34076_H__ */