1 // license:BSD-3-Clause
2 // copyright-holders:Paul Priest, David Haywood
3 #ifndef MAME_INCLUDES_MCATADV_H
4 #define MAME_INCLUDES_MCATADV_H
5 
6 #pragma once
7 
8 #include "machine/watchdog.h"
9 #include "video/tmap038.h"
10 #include "emupal.h"
11 #include "tilemap.h"
12 
13 class mcatadv_state : public driver_device
14 {
15 public:
mcatadv_state(const machine_config & mconfig,device_type type,const char * tag)16 	mcatadv_state(const machine_config &mconfig, device_type type, const char *tag)
17 		: driver_device(mconfig, type, tag)
18 		, m_spriteram(*this, "spriteram")
19 		, m_vidregs(*this, "vidregs")
20 		, m_sprdata(*this, "sprdata")
21 		, m_soundbank(*this, "soundbank")
22 		, m_maincpu(*this, "maincpu")
23 		, m_soundcpu(*this, "soundcpu")
24 		, m_watchdog(*this, "watchdog")
25 		, m_gfxdecode(*this, "gfxdecode")
26 		, m_palette(*this, "palette")
27 		, m_tilemap(*this, "tilemap_%u", 0U)
28 	{ }
29 
30 	void nost(machine_config &config);
31 	void mcatadv(machine_config &config);
32 
33 private:
34 	/* memory pointers */
35 	required_shared_ptr<u16> m_spriteram;
36 	std::unique_ptr<u16[]>   m_spriteram_old;
37 	required_shared_ptr<u16> m_vidregs;
38 	std::unique_ptr<u16[]>   m_vidregs_old;
39 
40 	required_region_ptr<u8> m_sprdata;
41 	required_memory_bank m_soundbank;
42 
43 	/* video-related */
44 	int m_palette_bank[2];
45 
46 	/* devices */
47 	required_device<cpu_device> m_maincpu;
48 	required_device<cpu_device> m_soundcpu;
49 	required_device<watchdog_timer_device> m_watchdog;
50 	required_device<gfxdecode_device> m_gfxdecode;
51 	required_device<palette_device> m_palette;
52 	optional_device_array<tilemap038_device, 2> m_tilemap;
53 
54 	u16 mcat_wd_r();
55 	void mcatadv_sound_bw_w(u8 data);
56 	template<int Chip> void get_banked_color(bool tiledim, u32 &color, u32 &pri, u32 &code);
57 	virtual void machine_start() override;
58 	virtual void video_start() override;
59 	u32 screen_update_mcatadv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
60 	DECLARE_WRITE_LINE_MEMBER(screen_vblank_mcatadv);
61 	void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
62 	void mcatadv_draw_tilemap_part( screen_device &screen, int layer, int i, bitmap_ind16 &bitmap, const rectangle &cliprect );
63 	void mcatadv_map(address_map &map);
64 	void mcatadv_sound_io_map(address_map &map);
65 	void mcatadv_sound_map(address_map &map);
66 	void nost_sound_io_map(address_map &map);
67 	void nost_sound_map(address_map &map);
68 };
69 
70 #endif // MAME_INCLUDES_MCATADV_H
71