1 // license:BSD-3-Clause
2 // copyright-holders:Brad Oliver
3 /*************************************************************************
4 
5     Zero Zone
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_ZEROZONE_H
9 #define MAME_INCLUDES_ZEROZONE_H
10 
11 #pragma once
12 
13 #include "machine/gen_latch.h"
14 #include "cpu/z80/z80.h"
15 #include "tilemap.h"
16 
17 class zerozone_state : public driver_device
18 {
19 public:
zerozone_state(const machine_config & mconfig,device_type type,const char * tag)20 	zerozone_state(const machine_config &mconfig, device_type type, const char *tag)
21 		: driver_device(mconfig, type, tag)
22 		, m_maincpu(*this, "maincpu")
23 		, m_audiocpu(*this, "audiocpu")
24 		, m_soundlatch(*this, "soundlatch")
25 		, m_vram(*this, "videoram")
26 		, m_gfxdecode(*this, "gfxdecode")
27 	{ }
28 
29 	void zerozone(machine_config &config);
30 
31 protected:
32 	// driver_device overrides
33 	virtual void machine_start() override;
34 	virtual void machine_reset() override;
35 	virtual void video_start() override;
36 
37 private:
38 	// in drivers/zerozone.cpp
39 	void sound_w(uint8_t data);
40 	DECLARE_WRITE_LINE_MEMBER(vblank_w);
41 
42 	// in video/zerozone.cpp
43 	void tilemap_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
44 	void tilebank_w(uint8_t data);
45 
46 	// devices
47 	required_device<cpu_device> m_maincpu;
48 	required_device<z80_device> m_audiocpu;
49 	required_device<generic_latch_8_device> m_soundlatch;
50 
51 	// shared pointers
52 	required_shared_ptr<uint16_t> m_vram;
53 	// currently this driver uses generic palette handling
54 
55 	required_device<gfxdecode_device> m_gfxdecode;
56 
57 	// video-related
58 	uint8_t m_tilebank;
59 	tilemap_t *m_zz_tilemap;
60 
61 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
62 
63 	void main_map(address_map &map);
64 	void sound_map(address_map &map);
65 
66 	TILE_GET_INFO_MEMBER(get_zerozone_tile_info);
67 };
68 
69 #endif // MAME_INCLUDES_ZEROZONE_H
70