1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 
4 #include "machine/gen_latch.h"
5 #include "emupal.h"
6 #include "tilemap.h"
7 
8 class mugsmash_state : public driver_device
9 {
10 public:
mugsmash_state(const machine_config & mconfig,device_type type,const char * tag)11 	mugsmash_state(const machine_config &mconfig, device_type type, const char *tag)
12 		: driver_device(mconfig, type, tag),
13 		m_videoram1(*this, "videoram1"),
14 		m_videoram2(*this, "videoram2"),
15 		m_regs1(*this, "regs1"),
16 		m_regs2(*this, "regs2"),
17 		m_spriteram(*this, "spriteram"),
18 		m_maincpu(*this, "maincpu"),
19 		m_audiocpu(*this, "audiocpu"),
20 		m_gfxdecode(*this, "gfxdecode"),
21 		m_palette(*this, "palette"),
22 		m_soundlatch(*this, "soundlatch") { }
23 
24 	void mugsmash(machine_config &config);
25 
26 private:
27 	required_shared_ptr<uint16_t> m_videoram1;
28 	required_shared_ptr<uint16_t> m_videoram2;
29 	required_shared_ptr<uint16_t> m_regs1;
30 	required_shared_ptr<uint16_t> m_regs2;
31 	required_shared_ptr<uint16_t> m_spriteram;
32 
33 	tilemap_t *m_tilemap1;
34 	tilemap_t *m_tilemap2;
35 
36 	required_device<cpu_device> m_maincpu;
37 	required_device<cpu_device> m_audiocpu;
38 	required_device<gfxdecode_device> m_gfxdecode;
39 	required_device<palette_device> m_palette;
40 	required_device<generic_latch_8_device> m_soundlatch;
41 
42 	void mugsmash_reg2_w(offs_t offset, uint16_t data);
43 	void mugsmash_videoram1_w(offs_t offset, uint16_t data);
44 	void mugsmash_videoram2_w(offs_t offset, uint16_t data);
45 	void mugsmash_reg_w(offs_t offset, uint16_t data);
46 	TILE_GET_INFO_MEMBER(get_mugsmash_tile_info1);
47 	TILE_GET_INFO_MEMBER(get_mugsmash_tile_info2);
48 	virtual void machine_start() override;
49 	virtual void video_start() override;
50 	uint32_t screen_update_mugsmash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
51 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
52 	void mugsmash_map(address_map &map);
53 	void mugsmash_sound_map(address_map &map);
54 };
55