1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail
3 /*************************************************************************
4 
5     Crude Buster
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_CBUSTER_H
9 #define MAME_INCLUDES_CBUSTER_H
10 
11 #pragma once
12 
13 #include "machine/gen_latch.h"
14 #include "cpu/h6280/h6280.h"
15 #include "video/bufsprite.h"
16 #include "video/decospr.h"
17 #include "video/deco16ic.h"
18 #include "emupal.h"
19 
20 class cbuster_state : public driver_device
21 {
22 public:
cbuster_state(const machine_config & mconfig,device_type type,const char * tag)23 	cbuster_state(const machine_config &mconfig, device_type type, const char *tag)
24 		: driver_device(mconfig, type, tag)
25 		, m_maincpu(*this, "maincpu")
26 		, m_audiocpu(*this, "audiocpu")
27 		, m_deco_tilegen(*this, "tilegen%u", 1U)
28 		, m_palette(*this, "palette")
29 		, m_spriteram(*this, "spriteram")
30 		, m_soundlatch(*this, "soundlatch")
31 		, m_sprgen(*this, "spritegen")
32 		, m_pf_rowscroll(*this, "pf%u_rowscroll", 1U)
33 	{ }
34 
35 	void init_twocrude();
36 
37 	void twocrude(machine_config &config);
38 
39 protected:
40 	virtual void machine_start() override;
41 	virtual void machine_reset() override;
42 	virtual void video_start() override;
43 
44 private:
45 	/* devices */
46 	required_device<cpu_device> m_maincpu;
47 	required_device<h6280_device> m_audiocpu;
48 	required_device_array<deco16ic_device, 2> m_deco_tilegen;
49 	required_device<palette_device> m_palette;
50 	required_device<buffered_spriteram16_device> m_spriteram;
51 	required_device<generic_latch_8_device> m_soundlatch;
52 	required_device<decospr_device> m_sprgen;
53 
54 	/* memory pointers */
55 	required_shared_ptr_array<u16, 4> m_pf_rowscroll;
56 
57 	/* misc */
58 	u16    m_prot;
59 	int    m_pri;
60 
61 	void prot_w(offs_t offset, u16 data, u16 mem_mask = ~0);
62 	u16 prot_r();
63 	u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
64 	DECO16IC_BANK_CB_MEMBER(bank_callback);
65 	static rgb_t cbuster_XBGR_888(u32 raw);
66 	void main_map(address_map &map);
67 	void sound_map(address_map &map);
68 };
69 
70 #endif // MAME_INCLUDES_CBUSTER_H
71