1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail, David Haywood
3 /*************************************************************************
4 
5     Diet Go Go
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_DIETGO_H
9 #define MAME_INCLUDES_DIETGO_H
10 
11 #pragma once
12 
13 #include "cpu/h6280/h6280.h"
14 #include "video/decospr.h"
15 #include "video/deco16ic.h"
16 #include "machine/deco104.h"
17 
18 class dietgo_state : public driver_device
19 {
20 public:
dietgo_state(const machine_config & mconfig,device_type type,const char * tag)21 	dietgo_state(const machine_config &mconfig, device_type type, const char *tag)
22 		: driver_device(mconfig, type, tag)
23 		, m_deco104(*this, "ioprot104")
24 		, m_pf_rowscroll(*this, "pf%u_rowscroll", 1)
25 		, m_spriteram(*this, "spriteram")
26 		, m_sprgen(*this, "spritegen")
27 		, m_maincpu(*this, "maincpu")
28 		, m_audiocpu(*this, "audiocpu")
29 		, m_deco_tilegen(*this, "tilegen")
30 		, m_decrypted_opcodes(*this, "decrypted_opcodes")
31 	{ }
32 
33 	void dietgo(machine_config &config);
34 
35 	void init_dietgo();
36 
37 private:
38 	optional_device<deco104_device> m_deco104;
39 	/* memory pointers */
40 	required_shared_ptr_array<uint16_t, 2> m_pf_rowscroll;
41 	required_shared_ptr<uint16_t> m_spriteram;
42 	optional_device<decospr_device> m_sprgen;
43 
44 	/* devices */
45 	required_device<cpu_device> m_maincpu;
46 	required_device<h6280_device> m_audiocpu;
47 	required_device<deco16ic_device> m_deco_tilegen;
48 	required_shared_ptr<uint16_t> m_decrypted_opcodes;
49 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
50 	DECO16IC_BANK_CB_MEMBER(bank_callback);
51 
52 	uint16_t dietgo_protection_region_0_104_r(offs_t offset);
53 	void dietgo_protection_region_0_104_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
54 	void decrypted_opcodes_map(address_map &map);
55 	void dietgo_map(address_map &map);
56 	void sound_map(address_map &map);
57 };
58 
59 #endif // MAME_INCLUDES_DIETGO_H
60