1 // license:BSD-3-Clause
2 // copyright-holders:Tomasz Slanina
3 #ifndef MAME_INCLUDES_NYCAPTOR_H
4 #define MAME_INCLUDES_NYCAPTOR_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "machine/input_merger.h"
10 #include "sound/msm5232.h"
11 #include "machine/taito68705interface.h"
12 #include "emupal.h"
13 #include "tilemap.h"
14 
15 class nycaptor_state : public driver_device
16 {
17 public:
nycaptor_state(const machine_config & mconfig,device_type type,const char * tag)18 	nycaptor_state(const machine_config &mconfig, device_type type, const char *tag) :
19 		driver_device(mconfig, type, tag),
20 		m_videoram(*this, "videoram"),
21 		m_scrlram(*this, "scrlram"),
22 		m_sharedram(*this, "sharedram"),
23 		m_spriteram(*this, "spriteram"),
24 		m_maincpu(*this, "maincpu"),
25 		m_audiocpu(*this, "audiocpu"),
26 		m_subcpu(*this, "sub"),
27 		m_bmcu(*this, "bmcu"),
28 		m_msm(*this, "msm"),
29 		m_gfxdecode(*this, "gfxdecode"),
30 		m_palette(*this, "palette"),
31 		m_soundlatch(*this, "soundlatch"),
32 		m_soundlatch2(*this, "soundlatch2"),
33 		m_soundnmi(*this, "soundnmi")
34 	{ }
35 
36 	void nycaptor(machine_config &config);
37 	void cyclshtg(machine_config &config);
38 	void bronx(machine_config &config);
39 
40 	void init_cyclshtg();
41 	void init_colt();
42 	void init_bronx();
43 	void init_nycaptor();
44 
45 protected:
46 	virtual void machine_start() override;
47 	virtual void machine_reset() override;
48 	virtual void video_start() override;
49 
50 private:
51 	/* memory pointers */
52 	required_shared_ptr<uint8_t> m_videoram;
53 	required_shared_ptr<uint8_t> m_scrlram;
54 	required_shared_ptr<uint8_t> m_sharedram;
55 	required_shared_ptr<uint8_t> m_spriteram;
56 
57 	/* video-related */
58 	tilemap_t *m_bg_tilemap;
59 	std::vector<uint8_t> m_paletteram;
60 	std::vector<uint8_t> m_paletteram_ext;
61 	uint8_t m_gfxctrl;
62 	uint8_t m_char_bank;
63 	uint8_t m_palette_bank;
64 
65 	/* misc */
66 	int m_generic_control_reg;
67 	int m_gametype;
68 	int m_mask;
69 
70 	/* devices */
71 	required_device<cpu_device> m_maincpu;
72 	required_device<cpu_device> m_audiocpu;
73 	required_device<cpu_device> m_subcpu;
74 	optional_device<taito68705_mcu_device> m_bmcu;
75 	required_device<msm5232_device> m_msm;
76 	required_device<gfxdecode_device> m_gfxdecode;
77 	required_device<palette_device> m_palette;
78 	required_device<generic_latch_8_device> m_soundlatch;
79 	required_device<generic_latch_8_device> m_soundlatch2;
80 	required_device<input_merger_device> m_soundnmi;
81 
82 	void sub_cpu_halt_w(uint8_t data);
83 	uint8_t nycaptor_b_r();
84 	uint8_t nycaptor_by_r();
85 	uint8_t nycaptor_bx_r();
86 	void sound_cpu_reset_w(uint8_t data);
87 	void nmi_disable_w(uint8_t data);
88 	void nmi_enable_w(uint8_t data);
89 	uint8_t nycaptor_generic_control_r();
90 	void nycaptor_generic_control_w(uint8_t data);
91 	uint8_t cyclshtg_mcu_status_r();
92 	uint8_t cyclshtg_mcu_r();
93 	void cyclshtg_mcu_w(uint8_t data);
94 	uint8_t cyclshtg_mcu_status_r1();
95 	void cyclshtg_generic_control_w(uint8_t data);
96 	uint8_t unk_r();
97 
98 	uint8_t nycaptor_mcu_status_r1();
99 	uint8_t nycaptor_mcu_status_r2();
100 	uint8_t sound_status_r();
101 	void nycaptor_videoram_w(offs_t offset, uint8_t data);
102 	void nycaptor_palette_w(offs_t offset, uint8_t data);
103 	uint8_t nycaptor_palette_r(offs_t offset);
104 	void nycaptor_gfxctrl_w(uint8_t data);
105 	uint8_t nycaptor_gfxctrl_r();
106 	void nycaptor_scrlram_w(offs_t offset, uint8_t data);
107 	void unk_w(uint8_t data);
108 	TILE_GET_INFO_MEMBER(get_tile_info);
109 	uint32_t screen_update_nycaptor(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
110 	int nycaptor_spot();
111 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri);
112 	void bronx_master_map(address_map &map);
113 	void bronx_slave_io_map(address_map &map);
114 	void bronx_slave_map(address_map &map);
115 	void cyclshtg_master_map(address_map &map);
116 	void cyclshtg_slave_map(address_map &map);
117 	void nycaptor_master_map(address_map &map);
118 	void nycaptor_slave_map(address_map &map);
119 	void sound_map(address_map &map);
120 };
121 
122 #endif // MAME_INCLUDES_NYCAPTOR_H
123