summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/segaic24.h
blob: 44c1933dd4ca9e13db160c40f80e39312a22a7d3 (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
#ifndef __SEGAIC24_H
#define __SEGAIC24_H

#define MCFG_S24TILE_DEVICE_ADD(_tag, tile_mask) \
	MCFG_DEVICE_ADD(_tag, S24TILE, 0) \
	segas24_tile::static_set_tile_mask(*device, tile_mask);

#define MCFG_S24SPRITE_DEVICE_ADD(_tag) \
	MCFG_DEVICE_ADD(_tag, S24SPRITE, 0)

#define MCFG_S24MIXER_DEVICE_ADD(_tag) \
	MCFG_DEVICE_ADD(_tag, S24MIXER, 0)

class segas24_tile : public device_t
{
	friend class segas24_tile_config;

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

	static void static_set_tile_mask(device_t &device, UINT16 tile_mask);

	DECLARE_READ16_MEMBER(tile_r);
	DECLARE_WRITE16_MEMBER(tile_w);
	DECLARE_READ16_MEMBER(char_r);
	DECLARE_WRITE16_MEMBER(char_w);

	DECLARE_READ32_MEMBER(tile32_r);
	DECLARE_WRITE32_MEMBER(tile32_w);
	DECLARE_READ32_MEMBER(char32_r);
	DECLARE_WRITE32_MEMBER(char32_w);

	void draw(bitmap_t *bitmap, const rectangle *cliprect, int layer, int pri, int flags);

protected:
	virtual void device_start();

private:
	enum {
		SYS24_TILES = 0x4000
	};

	UINT16 *char_ram, *tile_ram;
	int char_gfx_index;
	tilemap_t *tile_layer[4];
	UINT16 tile_mask;

	static const gfx_layout char_layout;

	void tile_info(int offset, tile_data *tileinfo, tilemap_memory_index tile_index);
	static TILE_GET_INFO_DEVICE(tile_info_0s);
	static TILE_GET_INFO_DEVICE(tile_info_0w);
	static TILE_GET_INFO_DEVICE(tile_info_1s);
	static TILE_GET_INFO_DEVICE(tile_info_1w);

	void draw_rect(bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
				   UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2);
	void draw_rect_rgb(bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
					   UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2);

};

class segas24_sprite : public device_t
{
	friend class segas24_sprite_config;

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

	DECLARE_READ16_MEMBER(read);
	DECLARE_WRITE16_MEMBER(write);

	void draw(bitmap_t *bitmap, const rectangle *cliprect, const int *spri);

protected:
	virtual void device_start();

private:
	UINT16 *sprite_ram;
};


class segas24_mixer : public device_t
{
	friend class segas24_mixer_config;

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

	DECLARE_READ16_MEMBER(read);
	DECLARE_WRITE16_MEMBER(write);

	UINT16 get_reg(int reg);

protected:
	virtual void device_start();

private:
	UINT16 mixer_reg[16];
};

extern const device_type S24TILE;
extern const device_type S24SPRITE;
extern const device_type S24MIXER;

#endif