summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/video/huc6260.h
blob: 1f2ce0cdaaa7789849f0dc18c0d2c0d4604da198 (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
/**********************************************************************

    Hudson/NEC HuC6260 interface and definitions

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


#ifndef __HUC6260_H_
#define __HUC6260_H_

#include "emu.h"
#include "machine/devhelpr.h"


#define HUC6260_PALETTE_SIZE	1024

/* Screen timing stuff */
#define HUC6260_WPF			1365	/* width of a line in frame including blanking areas */
#define HUC6260_LPF			263		/* max number of lines in a single frame */


PALETTE_INIT( huc6260 );


#define MCFG_HUC6260_ADD( _tag, clock, _intrf )	\
	MCFG_DEVICE_ADD( _tag, HUC6260, clock )		\
	MCFG_DEVICE_CONFIG( _intrf )


typedef struct _huc6260_interface huc6260_interface;
struct _huc6260_interface
{
	/* Tag for the screen we will be drawing on */
	const char *screen_tag;

	/* Callback function to retrieve pixel data */
	devcb_read16					get_next_pixel_data;

	/* TODO: Choose proper types */
	/* Callback function to get time until next event */
	devcb_read16					get_time_til_next_event;

	/* Callback function which gets called when vsync changes */
	devcb_write_line				vsync_changed;

	/* Callback function which gets called when hsync changes */
	devcb_write_line				hsync_changed;
};


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

	void video_update(bitmap_ind16 &bitmap, const rectangle &cliprect);
	DECLARE_READ8_MEMBER( read );
	DECLARE_WRITE8_MEMBER( write );

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

private:
	screen_device *m_screen;
	int		m_last_h;
	int		m_last_v;
	int		m_height;

	/* callbacks */
	devcb_resolved_read16		m_get_next_pixel_data;
	devcb_resolved_read16		m_get_time_til_next_event;
	devcb_resolved_write_line	m_hsync_changed;
	devcb_resolved_write_line	m_vsync_changed;

	UINT16	m_palette[512];
	UINT16	m_address;
	UINT8	m_greyscales;		/* Should the HuC6260 output grey or color graphics */
	UINT8	m_blur;				/* Should the edges of graphics be blurred/Select screen height 0=262, 1=263 */
	UINT8	m_pixels_per_clock;	/* Number of pixels to output per colour clock */
	UINT16	m_pixel_data;
	UINT8	m_pixel_clock;

	emu_timer	*m_timer;
	bitmap_ind16	*m_bmp;
};


extern const device_type HUC6260;


#endif