1 // license:BSD-3-Clause
2 // copyright-holders:Carlos A. Lozano
3 #ifndef MAME_INCLUDES_BLOODBRO_H
4 #define MAME_INCLUDES_BLOODBRO_H
5 
6 #pragma once
7 
8 #include "audio/seibu.h"
9 #include "sound/3812intf.h"
10 #include "emupal.h"
11 #include "screen.h"
12 #include "tilemap.h"
13 
14 class bloodbro_state : public driver_device, public seibu_sound_common
15 {
16 public:
bloodbro_state(const machine_config & mconfig,device_type type,const char * tag)17 	bloodbro_state(const machine_config &mconfig, device_type type, const char *tag) :
18 		driver_device(mconfig, type, tag),
19 		m_maincpu(*this, "maincpu"),
20 		m_gfxdecode(*this, "gfxdecode"),
21 		m_screen(*this, "screen"),
22 		m_palette(*this, "palette"),
23 		m_audiocpu(*this, "audiocpu"),
24 		m_seibu_sound(*this, "seibu_sound"),
25 		m_ymsnd(*this, "ymsnd"),
26 		m_spriteram(*this, "spriteram"),
27 		m_bgvideoram(*this, "bgvideoram"),
28 		m_fgvideoram(*this, "fgvideoram"),
29 		m_txvideoram(*this, "txvideoram")
30 	{ }
31 
32 	void init_weststry();
33 
34 	void bloodbro(machine_config &config);
35 	void skysmash(machine_config &config);
36 	void weststry(machine_config &config);
37 
38 protected:
39 	virtual void video_start() override;
40 
41 private:
42 	required_device<cpu_device> m_maincpu;
43 	required_device<gfxdecode_device> m_gfxdecode;
44 	required_device<screen_device> m_screen;
45 	required_device<palette_device> m_palette;
46 	required_device<cpu_device> m_audiocpu;
47 	required_device<seibu_sound_device> m_seibu_sound;
48 	required_device<ym3812_device> m_ymsnd;
49 
50 	required_shared_ptr<uint16_t> m_spriteram;
51 	required_shared_ptr<uint16_t> m_bgvideoram;
52 	required_shared_ptr<uint16_t> m_fgvideoram;
53 	required_shared_ptr<uint16_t> m_txvideoram;
54 
55 	uint16_t m_scrollram[6];
56 	uint16_t m_layer_en;
57 
58 	tilemap_t *m_bg_tilemap;
59 	tilemap_t *m_fg_tilemap;
60 	tilemap_t *m_tx_tilemap;
61 
62 	bool m_weststry_opl_irq;
63 	bool m_weststry_soundnmi_mask;
64 
65 	void bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
66 	void fgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
67 	void txvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
68 	void layer_en_w(uint16_t data);
69 	void layer_scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
70 	void weststry_layer_scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
71 	void weststry_soundlatch_w(offs_t offset, u8 data);
72 	DECLARE_WRITE_LINE_MEMBER(weststry_opl_irq_w);
73 	void weststry_opl_w(offs_t offset, uint8_t data);
74 	void weststry_soundnmi_ack_w(uint8_t data);
75 	void weststry_soundnmi_update();
76 
77 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
78 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
79 	TILE_GET_INFO_MEMBER(get_tx_tile_info);
80 
81 	uint32_t screen_update_bloodbro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
82 	uint32_t screen_update_weststry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
83 	uint32_t screen_update_skysmash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
84 	void bloodbro_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
85 	void weststry_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
86 
87 	void bloodbro_map(address_map &map);
88 	void common_map(address_map &map);
89 	void skysmash_map(address_map &map);
90 	void weststry_map(address_map &map);
91 	void weststry_sound_map(address_map &map);
92 };
93 
94 #endif // MAME_INCLUDES_BLOODBRO_H
95