1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail, David Haywood
3 /*************************************************************************
4 
5     Boogie Wings
6 
7 *************************************************************************/
8 
9 #include "cpu/h6280/h6280.h"
10 #include "sound/okim6295.h"
11 #include "video/deco16ic.h"
12 #include "video/deco_ace.h"
13 #include "video/bufsprite.h"
14 #include "video/decospr.h"
15 #include "machine/deco104.h"
16 #include "screen.h"
17 
18 class boogwing_state : public driver_device
19 {
20 public:
boogwing_state(const machine_config & mconfig,device_type type,const char * tag)21 	boogwing_state(const machine_config &mconfig, device_type type, const char *tag)
22 		: driver_device(mconfig, type, tag)
23 		, m_maincpu(*this, "maincpu")
24 		, m_audiocpu(*this, "audiocpu")
25 		, m_deco104(*this, "ioprot")
26 		, m_deco_ace(*this, "deco_ace")
27 		, m_screen(*this, "screen")
28 		, m_deco_tilegen(*this, "tilegen%u", 1)
29 		, m_oki(*this, "oki%u", 1)
30 		, m_sprgen(*this, "spritegen%u", 1)
31 		, m_spriteram(*this, "spriteram%u", 1)
32 		, m_pf_rowscroll(*this, "pf%u_rowscroll", 1)
33 		, m_decrypted_opcodes(*this, "decrypted_opcodes")
34 	{ }
35 
36 	/* devices */
37 	required_device<cpu_device> m_maincpu;
38 	required_device<h6280_device> m_audiocpu;
39 	required_device<deco104_device> m_deco104;
40 	required_device<deco_ace_device> m_deco_ace;
41 	required_device<screen_device> m_screen;
42 	required_device_array<deco16ic_device, 2> m_deco_tilegen;
43 	required_device_array<okim6295_device, 2> m_oki;
44 	required_device_array<decospr_device, 2> m_sprgen;
45 	required_device_array<buffered_spriteram16_device, 2> m_spriteram;
46 	/* memory pointers */
47 	required_shared_ptr_array<uint16_t, 4> m_pf_rowscroll;
48 	required_shared_ptr<uint16_t> m_decrypted_opcodes;
49 
50 	uint16_t m_priority;
51 	bitmap_ind16 m_temp_bitmap;
52 	bitmap_ind16 m_alpha_tmap_bitmap;
53 
54 	void sound_bankswitch_w(uint8_t data);
55 	void priority_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
56 	void init_boogwing();
57 	virtual void machine_reset() override;
58 	virtual void video_start() override;
59 	uint32_t screen_update_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
60 	void mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
61 	uint16_t boogwing_protection_region_0_104_r(offs_t offset);
62 	void boogwing_protection_region_0_104_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
63 
64 	DECO16IC_BANK_CB_MEMBER(bank_callback);
65 	DECO16IC_BANK_CB_MEMBER(bank_callback2);
66 	void boogwing(machine_config &config);
67 	void audio_map(address_map &map);
68 	void boogwing_map(address_map &map);
69 	void decrypted_opcodes_map(address_map &map);
70 };
71