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
|
// license:GPL-2.0+
// copyright-holders:Dirk Best
/***************************************************************************
Thomson EF9369
Single Chip Color Palette
___ ___
VSS 1 |* u | 28 HP
VDDC 2 | | 27 P3
SMI 3 | | 26 P2
CC 4 | | 25 P1
CA 5 | | 24 P0
CB 6 | | 23 BLK
M 7 | | 22 AS
AD0 8 | | 21 R/W
VCC 9 | | 20 DS
RESET 10 | | 19 CS0
AD1 11 | | 18 /CS
AD2 12 | | 17 AD7
AD3 13 | | 16 AD6
AD4 14 |_______| 15 AD5
***************************************************************************/
#pragma once
#ifndef __EF9369_H__
#define __EF9369_H__
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_EF9369_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, EF9369, 0) \
#define MCFG_EF9369_COLOR_UPDATE_CB(_class, _method) \
ef9369_device::set_color_update_callback(*device, ef9369_color_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
typedef device_delegate<void (int entry, bool m, uint8_t ca, uint8_t cb, uint8_t cc)> ef9369_color_update_delegate;
#define EF9369_COLOR_UPDATE(name) void name(int entry, bool m, uint8_t ca, uint8_t cb, uint8_t cc)
// ======================> ef9369_device
class ef9369_device : public device_t
{
public:
// construction/destruction
ef9369_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration
static void set_color_update_callback(device_t &device, ef9369_color_update_delegate callback) { downcast<ef9369_device &>(device).m_color_update_cb = callback; }
DECLARE_READ8_MEMBER(data_r);
DECLARE_WRITE8_MEMBER(data_w);
DECLARE_WRITE8_MEMBER(address_w);
static const int NUMCOLORS = 16;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
private:
ef9369_color_update_delegate m_color_update_cb;
// state
uint8_t m_ca[NUMCOLORS], m_cb[NUMCOLORS], m_cc[NUMCOLORS]; // actually 4-bit
bool m_m[NUMCOLORS];
int m_address;
};
// device type definition
extern const device_type EF9369;
#endif // __EF9369_H__
|