1 // license:BSD-3-Clause
2 // copyright-holders:Ernesto Corvi, Phil Stroffolino, Bryan McPhail
3 #ifndef MAME_INCLUDES_SHOOTOUT_H
4 #define MAME_INCLUDES_SHOOTOUT_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class shootout_state : public driver_device
13 {
14 public:
shootout_state(const machine_config & mconfig,device_type type,const char * tag)15 	shootout_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_spriteram(*this, "spriteram"),
23 		m_textram(*this, "textram"),
24 		m_videoram(*this, "videoram")
25 	{ }
26 
27 	void shootouj(machine_config &config);
28 	void shootouk(machine_config &config);
29 	void shootout(machine_config &config);
30 
31 	void init_shootout();
32 
33 	DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
34 
35 private:
36 	required_device<cpu_device> m_maincpu;
37 	optional_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 	required_shared_ptr<uint8_t> m_spriteram;
43 	required_shared_ptr<uint8_t> m_textram;
44 	required_shared_ptr<uint8_t> m_videoram;
45 
46 	tilemap_t *m_background;
47 	tilemap_t *m_foreground;
48 
49 	int m_ccnt_old_val;
50 
51 	void bankswitch_w(uint8_t data);
52 	uint8_t sound_cpu_command_r();
53 	void sound_cpu_command_w(uint8_t data);
54 	void flipscreen_w(uint8_t data);
55 	void coincounter_w(uint8_t data);
56 	void videoram_w(offs_t offset, uint8_t data);
57 	void textram_w(offs_t offset, uint8_t data);
58 
59 	virtual void machine_reset() override;
60 	virtual void video_start() override;
61 
62 	void shootout_palette(palette_device &palette) const;
63 
64 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
65 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
66 
67 	uint32_t screen_update_shootout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
68 	uint32_t screen_update_shootouj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
69 	void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_bits );
70 
71 	void shootouj_map(address_map &map);
72 	void shootout_map(address_map &map);
73 	void shootout_sound_map(address_map &map);
74 };
75 
76 #endif // MAME_INCLUDES_SHOOTOUT_H
77