1 // license:BSD-3-Clause
2 // copyright-holders:David Graves
3 /*************************************************************************
4 
5     Taito Triple Screen Games
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_NINJAW_H
9 #define MAME_INCLUDES_NINJAW_H
10 
11 #pragma once
12 
13 #include "audio/taitosnd.h"
14 #include "machine/taitoio.h"
15 #include "sound/flt_vol.h"
16 #include "video/tc0100scn.h"
17 #include "video/tc0110pcr.h"
18 #include "emupal.h"
19 
20 
21 class ninjaw_state : public driver_device
22 {
23 public:
ninjaw_state(const machine_config & mconfig,device_type type,const char * tag)24 	ninjaw_state(const machine_config &mconfig, device_type type, const char *tag) :
25 		driver_device(mconfig, type, tag),
26 		m_maincpu(*this, "maincpu"),
27 		m_subcpu(*this, "sub"),
28 		m_tc0140syt(*this, "tc0140syt"),
29 		m_tc0100scn(*this, "tc0100scn_%u", 1),
30 		m_tc0110pcr(*this, "tc0110pcr_%u", 1),
31 		m_2610_l(*this, "2610.%u.l", 1),
32 		m_2610_r(*this, "2610.%u.r", 1),
33 		m_gfxdecode(*this, "gfxdecode_%u", 1),
34 		m_spriteram(*this, "spriteram"),
35 		m_z80bank(*this, "z80bank")
36 	{ }
37 
38 	void darius2(machine_config &config);
39 	void ninjaw(machine_config &config);
40 
41 protected:
42 	virtual void device_post_load() override;
43 	virtual void machine_start() override;
44 	virtual void machine_reset() override;
45 
46 private:
47 	/* devices */
48 	required_device<cpu_device> m_maincpu;
49 	required_device<cpu_device> m_subcpu;
50 	required_device<tc0140syt_device> m_tc0140syt;
51 	required_device_array<tc0100scn_device, 3> m_tc0100scn;
52 	required_device_array<tc0110pcr_device, 3> m_tc0110pcr;
53 	required_device_array<filter_volume_device, 2> m_2610_l;
54 	required_device_array<filter_volume_device, 2> m_2610_r;
55 	required_device_array<gfxdecode_device, 3> m_gfxdecode;
56 
57 	/* memory pointers */
58 	required_shared_ptr<u16> m_spriteram;
59 
60 	/* memory regions */
61 	required_memory_bank m_z80bank;
62 
63 	/* misc */
64 	u16     m_cpua_ctrl;
65 	int        m_pandata[4];
66 
67 	void coin_control_w(u8 data);
68 	void cpua_ctrl_w(u16 data);
69 	void sound_bankswitch_w(u8 data);
70 	void pancontrol_w(offs_t offset, u8 data);
71 	void tc0100scn_triple_screen_w(offs_t offset, u16 data, u16 mem_mask = ~0);
72 
73 	u32 screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
74 	u32 screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
75 	u32 screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
76 	void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip);
77 	void parse_control();
78 	u32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip);
79 	void darius2_master_map(address_map &map);
80 	void darius2_slave_map(address_map &map);
81 	void ninjaw_master_map(address_map &map);
82 	void ninjaw_slave_map(address_map &map);
83 	void sound_map(address_map &map);
84 };
85 
86 #endif // MAME_INCLUDES_NINJAW_H
87