1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria
3 /*************************************************************************
4 
5     Zero Hour / Red Clash
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_REDCLASH_H
9 #define MAME_INCLUDES_REDCLASH_H
10 
11 #pragma once
12 
13 #include "video/ladybug.h"
14 #include "emupal.h"
15 #include "tilemap.h"
16 
17 
18 // redclash/zerohour
19 class redclash_state : public driver_device
20 {
21 public:
redclash_state(const machine_config & mconfig,device_type type,const char * tag)22 	redclash_state(const machine_config &mconfig, device_type type, const char *tag)
23 		: driver_device(mconfig, type, tag)
24 		, m_videoram(*this, "videoram")
25 		, m_spriteram(*this, "spriteram")
26 		, m_maincpu(*this, "maincpu")
27 		, m_palette(*this, "palette")
28 		, m_gfxdecode(*this, "gfxdecode")
29 		, m_stars(*this, "stars")
30 	{ }
31 
32 	void redclash(machine_config &config);
33 	void zerohour(machine_config &config);
34 
35 	void init_redclash();
36 
37 	DECLARE_INPUT_CHANGED_MEMBER(left_coin_inserted);
38 	DECLARE_INPUT_CHANGED_MEMBER(right_coin_inserted);
39 
40 protected:
41 	virtual void machine_start() override;
42 	virtual void machine_reset() override;
43 	virtual void video_start() override;
44 
45 private:
46 	DECLARE_WRITE_LINE_MEMBER(screen_vblank);
47 	void videoram_w(offs_t offset, uint8_t data);
48 	void gfxbank_w(uint8_t data);
49 	void flipscreen_w(uint8_t data);
50 	void irqack_w(uint8_t data);
51 	void star_reset_w(uint8_t data);
52 	template <unsigned B> void star_w(uint8_t data);
53 	void palette(palette_device &palette) const;
54 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
55 
56 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
57 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
58 	void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
59 
60 	void redclash_map(address_map &map);
61 	void zerohour_map(address_map &map);
62 
63 	required_shared_ptr<uint8_t> m_videoram;
64 	required_shared_ptr<uint8_t> m_spriteram;
65 	required_device<cpu_device> m_maincpu;
66 	required_device<palette_device> m_palette;
67 	required_device<gfxdecode_device> m_gfxdecode;
68 	required_device<zerohour_stars_device> m_stars;
69 
70 	tilemap_t   *m_fg_tilemap;
71 	int         m_gfxbank;   // redclash only
72 };
73 
74 #endif // MAME_INCLUDES_REDCLASH_H
75