summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/video/crt.h
blob: 22bce59a3995e5ed160b7ac8d7a71eb4295b8b69 (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
/*************************************************************************

    video/crt.h

    CRT video emulation for TX-0 and PDP-1

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

#ifndef CRT_H_
#define CRT_H_


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

#define MCFG_CRT_ADD(_tag, _interface) \
	MCFG_DEVICE_ADD(_tag, CRT, 0) \
	MCFG_DEVICE_CONFIG(_interface)


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

struct crt_interface
{
	int num_levels;
	int offset_x, offset_y;
	int width, height;
};


struct crt_point
{
	crt_point() :
		intensity(0),
		next(0) {}

	int intensity;      /* current intensity of the pixel */
						/* a node is not in the list when (intensity == -1) */
	int next;           /* index of next pixel in list */
};

// ======================> crt_device

class crt_device : public device_t
{
public:
	crt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	~crt_device() { }

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

public:
	void plot(int x, int y);
	void eof();
	void update(bitmap_ind16 &bitmap);

private:
	crt_point *m_list; /* array of (crt_window_width*crt_window_height) point */
	int *m_list_head;  /* head of the list of lit pixels (index in the array) */
						/* keep a separate list for each display line (makes the video code slightly faster) */

	int m_decay_counter;  /* incremented each frame (tells for how many frames the CRT has decayed between two screen refresh) */

	/* CRT window */
	int m_num_intensity_levels;
	int m_window_offset_x;
	int m_window_offset_y;
	int m_window_width;
	int m_window_height;
};

extern const device_type CRT;



#endif /* CRT_H_ */