1 // license:BSD-3-Clause
2 // copyright-holders: ElSemi, Roberto Fresca.
3 #ifndef MAME_INCLUDES_EFDT_H
4 #define MAME_INCLUDES_EFDT_H
5 
6 #pragma once
7 
8 #include "machine/74259.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 
13 class efdt_state : public driver_device
14 {
15 public:
efdt_state(const machine_config & mconfig,device_type type,const char * tag)16 	efdt_state(const machine_config &mconfig, device_type type, const char *tag) :
17 		driver_device(mconfig, type, tag),
18 		m_maincpu(*this, "maincpu"),
19 		m_gfxdecode(*this, "gfxdecode"),
20 		m_palette(*this, "palette"),
21 		m_audiocpu(*this, "audiocpu"),
22 		m_vlatch(*this, "vlatch%u", 1U),
23 		m_videoram(*this, "videoram", 8)
24 	{ }
25 
26 	void efdt(machine_config &config);
27 
28 protected:
29 	virtual void machine_start() override;
30 	virtual void machine_reset() override;
31 	virtual void video_start() override;
32 
33 private:
34 	required_device<cpu_device> m_maincpu;
35 	required_device<gfxdecode_device> m_gfxdecode;
36 	required_device<palette_device> m_palette;
37 	optional_device<cpu_device> m_audiocpu;
38 	required_device_array<ls259_device, 2> m_vlatch;
39 
40 	/* memory pointers */
41 	required_shared_ptr<uint8_t> m_videoram;
42 	uint8_t m_soundlatch[4];
43 	uint8_t m_soundCommand;
44 	uint8_t m_soundControl;
45 
46 
47 	/* video-related */
48 	tilemap_t      *m_tilemap[2];
49 	int             m_tilebank;
50 
51 	TILE_GET_INFO_MEMBER(get_tile_info_0);
52 	TILE_GET_INFO_MEMBER(get_tile_info_1);
53 
54 	void efdt_palette(palette_device &palette) const;
55 
56 	DECLARE_WRITE_LINE_MEMBER(vblank_nmi_w);
57 	DECLARE_WRITE_LINE_MEMBER(nmi_clear_w);
58 
59 	uint8_t main_soundlatch_r(offs_t offset);
60 	void main_soundlatch_w(offs_t offset, uint8_t data);
61 
62 	uint8_t soundlatch_0_r();
63 	uint8_t soundlatch_1_r();
64 	uint8_t soundlatch_2_r();
65 	uint8_t soundlatch_3_r();
66 
67 	void soundlatch_0_w(uint8_t data);
68 	void soundlatch_1_w(uint8_t data);
69 	void soundlatch_2_w(uint8_t data);
70 	void soundlatch_3_w(uint8_t data);
71 
72 	uint32_t screen_update_efdt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
73 
74 	void efdt_map(address_map &map);
75 	void efdt_snd_map(address_map &map);
76 };
77 
78 #endif // MAME_INCLUDES_EFDT_H
79