1 // license:BSD-3-Clause
2 // copyright-holders:Steve Ellenoff, Brad Oliver
3 #ifndef MAME_INCLUDES_TAGTEAM_H
4 #define MAME_INCLUDES_TAGTEAM_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class tagteam_state : public driver_device
13 {
14 public:
tagteam_state(const machine_config & mconfig,device_type type,const char * tag)15 	tagteam_state(const machine_config &mconfig, device_type type, const char *tag) :
16 		driver_device(mconfig, type, tag),
17 		m_maincpu(*this, "maincpu"),
18 		m_audiocpu(*this, "audiocpu"),
19 		m_gfxdecode(*this, "gfxdecode"),
20 		m_palette(*this, "palette"),
21 		m_soundlatch(*this, "soundlatch"),
22 		m_videoram(*this, "videoram"),
23 		m_colorram(*this, "colorram")
24 	{ }
25 
26 	void tagteam(machine_config &config);
27 
28 	DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
29 
30 protected:
31 	virtual void machine_start() override;
32 	virtual void video_start() override;
33 
34 private:
35 	required_device<cpu_device> m_maincpu;
36 	required_device<cpu_device> m_audiocpu;
37 	required_device<gfxdecode_device> m_gfxdecode;
38 	required_device<palette_device> m_palette;
39 	required_device<generic_latch_8_device> m_soundlatch;
40 
41 	required_shared_ptr<uint8_t> m_videoram;
42 	required_shared_ptr<uint8_t> m_colorram;
43 
44 	int m_palettebank;
45 	tilemap_t *m_bg_tilemap;
46 	uint8_t m_sound_nmi_mask;
47 
48 	void irq_clear_w(uint8_t data);
49 	void sound_nmi_mask_w(uint8_t data);
50 	void videoram_w(offs_t offset, uint8_t data);
51 	void colorram_w(offs_t offset, uint8_t data);
52 	uint8_t mirrorvideoram_r(offs_t offset);
53 	uint8_t mirrorcolorram_r(offs_t offset);
54 	void mirrorvideoram_w(offs_t offset, uint8_t data);
55 	void mirrorcolorram_w(offs_t offset, uint8_t data);
56 	void control_w(uint8_t data);
57 	void flipscreen_w(uint8_t data);
58 
59 	INTERRUPT_GEN_MEMBER(sound_timer_irq);
60 
61 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
62 
63 	void tagteam_palette(palette_device &palette) const;
64 
65 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
66 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
67 	void main_map(address_map &map);
68 	void sound_map(address_map &map);
69 };
70 
71 #endif // MAME_INCLUDES_TAGTEAM_H
72