summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/video/crt9021.h
blob: 20ff301f914ce3190b0592ba20a2341c7745328f (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
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
/**********************************************************************

    SMC CRT9021 Video Attributes Controller (VAC) emulation

    Copyright MESS Team.
    Visit http://mamedev.org for licensing and usage restrictions.

**********************************************************************
                            _____   _____
                    D0   1 |*    \_/     | 28  D1
                   MS0   2 |             | 27  D2
                   MS1   3 |             | 26  D3
                 REVID   4 |             | 25  D4
                 CHABL   5 |             | 24  D5
                 BLINK   6 |             | 23  D6
                 INTIN   7 |   CRT9021   | 22  D7
                   +5V   8 |             | 21  _VSYNC
                 ATTEN   9 |             | 20  GND
                INTOUT  10 |             | 19  SL0/SLD
                CURSOR  11 |             | 18  SL1/_SLG
                 RETBL  12 |             | 17  SL2/BLC
                _LD/SH  13 |             | 16  SL3/BKC
                 VIDEO  14 |_____________| 15  VDC

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

#pragma once

#ifndef __CRT9021__
#define __CRT9021__

#include "emu.h"



//**************************************************************************
//  MACROS / CONSTANTS
//**************************************************************************




//**************************************************************************
//  INTERFACE CONFIGURATION MACROS
//**************************************************************************

#define MCFG_CRT9021_ADD(_tag, _clock, _config) \
	MCFG_DEVICE_ADD(_tag, CRT9021, _clock) \
	MCFG_DEVICE_CONFIG(_config)


#define CRT9021_INTERFACE(name) \
	const crt9021_interface (name) =



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


// ======================> crt9021_interface

struct crt9021_interface
{
	const char *screen_tag;		/* screen we are acting on */

	devcb_read8				in_data_func;
	devcb_read8				in_attr_func;

	devcb_read_line			in_atten_func;
};



// ======================> crt9021_device_config

class crt9021_device_config :   public device_config,
                                public crt9021_interface
{
    friend class crt9021_device;

    // construction/destruction
    crt9021_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);

public:
    // allocators
    static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
    virtual device_t *alloc_device(running_machine &machine) const;

protected:
	// device_config overrides
	virtual void device_config_complete();
};



// ======================> crt9021_device

class crt9021_device :	public device_t
{
    friend class crt9021_device_config;

    // construction/destruction
    crt9021_device(running_machine &_machine, const crt9021_device_config &_config);

public:
	DECLARE_WRITE_LINE_MEMBER( slg_w );
	DECLARE_WRITE_LINE_MEMBER( sld_w );
	DECLARE_WRITE_LINE_MEMBER( cursor_w );
	DECLARE_WRITE_LINE_MEMBER( retbl_w );
	DECLARE_WRITE_LINE_MEMBER( vsync_w );

	void update_screen(bitmap_t *bitmap, const rectangle *cliprect);

protected:
    // device-level overrides
    virtual void device_start();
	virtual void device_clock_changed();
	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);

private:
	devcb_resolved_read8			m_in_data_func;
	devcb_resolved_read8			m_in_attr_func;
	devcb_resolved_read_line		m_in_atten_func;

	screen_device *m_screen;

	int m_slg;
	int m_sld;
	int m_cursor;
	int m_retbl;
	int m_vsync;

	const crt9021_device_config &m_config;
};


// device type definition
extern const device_type CRT9021;



#endif