summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/kaneko_grap2.h
blob: 280eab40a1e2c36b80272cbee96230551d554ba8 (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
#define GRAP2_AREA( _BASE, name ) \
	AM_RANGE(_BASE+0x000000, _BASE+0x0003ff) AM_DEVREADWRITE(name,kaneko_grap2_device,unk1_r, unk1_w ) \
	AM_RANGE(_BASE+0x000400, _BASE+0x000401) AM_DEVWRITE(name,kaneko_grap2_device, galpani3_framebuffer1_scrollx_w) \
	AM_RANGE(_BASE+0x000800, _BASE+0x000bff) AM_DEVREADWRITE(name,kaneko_grap2_device,  unk2_r, unk2_w ) \
	AM_RANGE(_BASE+0x000c00, _BASE+0x000c01) AM_DEVWRITE(name,kaneko_grap2_device, galpani3_framebuffer1_scrolly_w) \
	AM_RANGE(_BASE+0x000c02, _BASE+0x000c03) AM_DEVWRITE(name,kaneko_grap2_device,galpani3_framebuffer1_enable_w) \
	AM_RANGE(_BASE+0x000c06, _BASE+0x000c07) AM_DEVWRITE(name,kaneko_grap2_device,galpani3_framebuffer1_bgcol_w) \
	AM_RANGE(_BASE+0x000c10, _BASE+0x000c11) AM_DEVREADWRITE(name,kaneko_grap2_device, galpani3_framebuffer1_fbbright1_r, galpani3_framebuffer1_fbbright1_w ) \
	AM_RANGE(_BASE+0x000c12, _BASE+0x000c13) AM_DEVREADWRITE(name,kaneko_grap2_device, galpani3_framebuffer1_fbbright2_r, galpani3_framebuffer1_fbbright2_w ) \
	AM_RANGE(_BASE+0x000c18, _BASE+0x000c1b) AM_DEVWRITE(name,kaneko_grap2_device,galpani3_regs1_address_w) \
	AM_RANGE(_BASE+0x000c1e, _BASE+0x000c1f) AM_DEVWRITE(name,kaneko_grap2_device,galpani3_regs1_go_w) \
	AM_RANGE(_BASE+0x000c00, _BASE+0x000c1f) AM_DEVREAD(name,kaneko_grap2_device,galpani3_regs1_r) \
	AM_RANGE(_BASE+0x080000, _BASE+0x0801ff) AM_DEVREADWRITE(name,kaneko_grap2_device, pal_r, galpani3_framebuffer1_palette_w ) \
	AM_RANGE(_BASE+0x100000, _BASE+0x17ffff) AM_DEVREADWRITE(name,kaneko_grap2_device, framebuffer_r, framebuffer_w ) \



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

	int m_chipnum; // used to decide where we write the palette

	static void set_chipnum(device_t &device, int chipnum);


	DECLARE_READ16_MEMBER(galpani3_regs1_r);
	DECLARE_WRITE16_MEMBER(galpani3_regs1_go_w);


	void gp3_do_rle(UINT32 address, UINT16*framebuffer, UINT8* rledata);
	void set_color_555_gp3(running_machine &machine, pen_t color, int rshift, int gshift, int bshift, UINT16 data);

	UINT16 m_framebuffer_bgcol;
	UINT16 m_framebuffer_scrolly;
	UINT16 m_framebuffer_scrollx;
	UINT16 m_framebuffer_enable;
	int m_regs1_i;
	
	UINT16 m_framebuffer_bright1;
	UINT16 m_framebuffer_bright2;

	UINT16 m_regs1_address_regs[0x2];
	
	DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_enable_w) { m_framebuffer_enable = data; }

	DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_scrolly_w) { m_framebuffer_scrolly = data; }
	DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_scrollx_w) { m_framebuffer_scrollx = data; }


	DECLARE_READ16_MEMBER(galpani3_framebuffer1_fbbright1_r) { return m_framebuffer_bright1; }
	DECLARE_READ16_MEMBER(galpani3_framebuffer1_fbbright2_r) { return m_framebuffer_bright2; }


	DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_fbbright1_w) { COMBINE_DATA(&m_framebuffer_bright1); }
	DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_fbbright2_w) { COMBINE_DATA(&m_framebuffer_bright2); }

	DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_bgcol_w);

	DECLARE_WRITE16_MEMBER(galpani3_regs1_address_w) { COMBINE_DATA(&m_regs1_address_regs[offset]); }

	DECLARE_READ16_MEMBER(  framebuffer_r ) { return m_framebuffer[offset]; }
	DECLARE_WRITE16_MEMBER( framebuffer_w ) { COMBINE_DATA(&m_framebuffer[offset]); }
	DECLARE_READ16_MEMBER(  pal_r ) { return m_framebuffer_palette[offset]; }
	DECLARE_WRITE16_MEMBER(galpani3_framebuffer1_palette_w);
	DECLARE_READ16_MEMBER(  unk1_r ) { return m_framebuffer_unk1[offset]; }
	DECLARE_WRITE16_MEMBER( unk1_w ) { COMBINE_DATA(&m_framebuffer_unk1[offset]); }
	DECLARE_READ16_MEMBER(  unk2_r ) { return m_framebuffer_unk2[offset]; }
	DECLARE_WRITE16_MEMBER( unk2_w ) { COMBINE_DATA(&m_framebuffer_unk2[offset]); }

	UINT16* m_framebuffer;
	UINT16* m_framebuffer_palette;
	UINT16* m_framebuffer_unk1;
	UINT16* m_framebuffer_unk2;




protected:
	virtual void device_start();
	virtual void device_reset();

private:


};


extern const device_type KANEKO_GRAP2;