summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/ladybug.h
blob: 72ad9f0c30f4bf4fabe5488774b2931190381051 (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
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria
#ifndef MAME_VIDEO_LADYBUG_H
#define MAME_VIDEO_LADYBUG_H

#pragma once

#include "screen.h"


#define MCFG_LADYBUG_VIDEO_GFXDECODE(tag) \
	downcast<ladybug_video_device &>(*device).set_gfxdecode_tag(tag);


// used by ladybug and sraider
class ladybug_video_device : public device_t
{
public:
	ladybug_video_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);

	void set_gfxdecode_tag(char const *tag) { m_gfxdecode.set_tag(tag); }

	DECLARE_READ8_MEMBER(spr_r) { return m_spr_ram[offset & 0x03ff]; }
	DECLARE_WRITE8_MEMBER(spr_w) { m_spr_ram[offset & 0x03ff] = data; }
	DECLARE_READ8_MEMBER(bg_r) { return m_bg_ram[offset & 0x07ff]; }
	DECLARE_WRITE8_MEMBER(bg_w);

	void draw(screen_device &screen, bitmap_ind16 &bitmap, rectangle const &cliprect, bool flip);

protected:
	virtual void device_start() override;

	TILE_GET_INFO_MEMBER(get_bg_tile_info);

private:
	required_device<gfxdecode_device>   m_gfxdecode;
	std::unique_ptr<u8 []>              m_spr_ram;
	std::unique_ptr<u8 []>              m_bg_ram;
	tilemap_t                           *m_bg_tilemap;
};


// used by zerohour, redclash and sraider
class zerohour_stars_device : public device_t
{
public:
	zerohour_stars_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);

	void set_enable(bool on);
	void update_state();
	void set_speed(u8 speed, u8 mask);
	void draw(bitmap_ind16 &bitmap, rectangle const &cliprect, u8 pal_offs, bool has_va, u8 firstx, u8 lastx);

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

private:
	u8  m_enable;
	u8  m_speed;
	u32 m_state;
	u16 m_offset;
	u8  m_count;
};


DECLARE_DEVICE_TYPE(LADYBUG_VIDEO, ladybug_video_device)
DECLARE_DEVICE_TYPE(ZEROHOUR_STARS, zerohour_stars_device)

#endif // MAME_VIDEO_LADYBUG_H