summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/st0020.h
blob: 9dccf6a3c846934f5c954185b1c80690edf45892 (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
// license:BSD-3-Clause
// copyright-holders:Luca Elia,David Haywood
#ifndef MAME_VIDEO_ST0020_H
#define MAME_VIDEO_ST0020_H

#pragma once


class st0020_device : public device_t, public device_gfx_interface
{
public:
	st0020_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	// configuration
	void set_is_st0032(int is_st0032);
	void set_is_jclub2(int is_jclub2);

	void update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, bool update_visible_area);

	DECLARE_READ16_MEMBER(gfxram_r);
	DECLARE_WRITE16_MEMBER(gfxram_w);

	DECLARE_READ16_MEMBER(regs_r);
	DECLARE_WRITE16_MEMBER(regs_w);

	DECLARE_READ16_MEMBER(sprram_r);
	DECLARE_WRITE16_MEMBER(sprram_w);

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

private:
	// see if we can handle the difference between this and the st0032 in here, or if we need another device
	int m_is_st0032;

	// per-game hack
	int m_is_jclub2;

	// RAM
	std::unique_ptr<uint16_t[]> m_gfxram;
	std::unique_ptr<uint16_t[]> m_spriteram;
	std::unique_ptr<uint16_t[]> m_regs;

	DECLARE_WRITE16_MEMBER(regs_st0020_w);
	DECLARE_WRITE16_MEMBER(regs_st0032_w);

	int m_gfxram_bank;
	DECLARE_WRITE16_MEMBER(gfxram_bank_w);

	// blitter
	uint8_t *m_rom_ptr;
	size_t m_rom_size;
	DECLARE_WRITE16_MEMBER(do_blit_w);

	// tilemaps
	tilemap_t *m_tmap[4];
	void get_tile_info_i(int i, tilemap_t &tilemap, tile_data &tileinfo, tilemap_memory_index tile_index);

	TILE_GET_INFO_MEMBER(get_tile_info_0);
	TILE_GET_INFO_MEMBER(get_tile_info_1);
	TILE_GET_INFO_MEMBER(get_tile_info_2);
	TILE_GET_INFO_MEMBER(get_tile_info_3);

	int tmap_offset(int i);
	int tmap_priority(int i);
	int tmap_is_enabled(int i);
	DECLARE_WRITE16_MEMBER(tmap_st0020_w);
	DECLARE_WRITE16_MEMBER(tmap_st0032_w);

	// sprites
	void draw_zooming_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
};

DECLARE_DEVICE_TYPE(ST0020_SPRITES, st0020_device)

#define MCFG_ST0020_SPRITES_PALETTE(_palette_tag) \
	MCFG_GFX_PALETTE(_palette_tag)

#define MCFG_ST0020_IS_ST0032(_st0032) \
	downcast<st0020_device &>(*device).set_is_st0032(_st0032)

#define MCFG_ST0020_IS_JCLUB2(_jclub2) \
	downcast<st0020_device &>(*device).set_is_jclub2(_jclub2)

#endif // MAME_VIDEO_ST0020_H