1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria
3 #ifndef MAME_INCLUDES_ZACCARIA_H
4 #define MAME_INCLUDES_ZACCARIA_H
5 
6 #pragma once
7 
8 #include "audio/zaccaria.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class zaccaria_state : public driver_device
13 {
14 public:
zaccaria_state(const machine_config & mconfig,device_type type,const char * tag)15 	zaccaria_state(const machine_config &mconfig, device_type type, const char *tag)
16 		: driver_device(mconfig, type, tag)
17 		, m_maincpu(*this, "maincpu")
18 		, m_gfxdecode(*this, "gfxdecode")
19 		, m_palette(*this, "palette")
20 		, m_audiopcb(*this, "audiopcb")
21 		, m_videoram(*this, "videoram")
22 		, m_attributesram(*this, "attributesram")
23 		, m_spriteram(*this, "spriteram")
24 		, m_spriteram2(*this, "spriteram2")
25 		, m_dsw_port(*this, "DSW.%u", 0)
26 	{ }
27 
28 	void zaccaria(machine_config &config);
29 
30 protected:
31 	virtual void machine_start() override;
32 	virtual void machine_reset() override;
33 	virtual void video_start() override;
34 
35 private:
36 	uint8_t dsw_r();
37 	uint8_t prot1_r(offs_t offset);
38 	uint8_t prot2_r(offs_t offset);
39 	DECLARE_WRITE_LINE_MEMBER(coin_w);
40 	DECLARE_WRITE_LINE_MEMBER(nmi_mask_w);
41 	void videoram_w(offs_t offset, uint8_t data);
42 	void attributes_w(offs_t offset, uint8_t data);
43 	DECLARE_WRITE_LINE_MEMBER(flip_screen_x_w);
44 	DECLARE_WRITE_LINE_MEMBER(flip_screen_y_w);
45 	void dsw_sel_w(uint8_t data);
46 	TILE_GET_INFO_MEMBER(get_tile_info);
47 	void zaccaria_palette(palette_device &palette) const;
48 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
49 	DECLARE_WRITE_LINE_MEMBER(vblank_irq);
50 	void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,uint8_t *spriteram,int color,int section);
51 
52 	void main_map(address_map &map);
53 
54 	required_device<cpu_device>                 m_maincpu;
55 	required_device<gfxdecode_device>           m_gfxdecode;
56 	required_device<palette_device>             m_palette;
57 	required_device<zac1b11142_audio_device>    m_audiopcb;
58 
59 	required_shared_ptr<uint8_t> m_videoram;
60 	required_shared_ptr<uint8_t> m_attributesram;
61 	required_shared_ptr<uint8_t> m_spriteram;
62 	required_shared_ptr<uint8_t> m_spriteram2;
63 
64 	required_ioport_array<3> m_dsw_port;
65 
66 	int m_dsw_sel;
67 	tilemap_t *m_bg_tilemap;
68 	uint8_t m_nmi_mask;
69 };
70 
71 #endif // MAME_INCLUDES_ZACCARIA_H
72