1 // license:BSD-3-Clause
2 // copyright-holders:Luca Elia
3 #ifndef MAME_INCLUDES_THEDEEP_H
4 #define MAME_INCLUDES_THEDEEP_H
5 
6 #pragma once
7 
8 #include "cpu/mcs51/mcs51.h"
9 #include "machine/gen_latch.h"
10 #include "machine/timer.h"
11 #include "video/decbac06.h"
12 #include "video/decmxc06.h"
13 #include "emupal.h"
14 #include "tilemap.h"
15 
16 
17 class thedeep_state : public driver_device
18 {
19 public:
thedeep_state(const machine_config & mconfig,device_type type,const char * tag)20 	thedeep_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_mcu(*this, "mcu"),
25 		m_gfxdecode(*this, "gfxdecode"),
26 		m_palette(*this, "palette"),
27 		m_tilegen(*this, "tilegen"),
28 		m_spritegen(*this, "spritegen"),
29 		m_soundlatch(*this, "soundlatch"),
30 		m_coins(*this, "COINS"),
31 		m_spriteram(*this, "spriteram"),
32 		m_textram(*this, "textram")
33 	{ }
34 
35 	void thedeep(machine_config &config);
36 
37 protected:
38 	virtual void machine_start() override;
39 	virtual void video_start() override;
40 
41 private:
42 	required_device<cpu_device> m_maincpu;
43 	required_device<cpu_device> m_audiocpu;
44 	required_device<i8751_device> m_mcu;
45 	required_device<gfxdecode_device> m_gfxdecode;
46 	required_device<palette_device> m_palette;
47 	required_device<deco_bac06_device> m_tilegen;
48 	required_device<deco_mxc06_device> m_spritegen;
49 	required_device<generic_latch_8_device> m_soundlatch;
50 	required_ioport m_coins;
51 
52 	required_shared_ptr<uint8_t> m_spriteram;
53 	required_shared_ptr<uint8_t> m_textram;
54 
55 	int m_nmi_enable;
56 	tilemap_t *m_text_tilemap;
57 
58 	// protection mcu
59 	uint8_t mcu_p0_r();
60 	void mcu_p1_w(uint8_t data);
61 	uint8_t mcu_p2_r();
62 	void mcu_p2_w(uint8_t data);
63 	void mcu_p3_w(uint8_t data);
64 
65 	uint8_t m_maincpu_to_mcu;
66 	uint8_t m_mcu_to_maincpu;
67 	uint8_t m_mcu_p2;
68 	uint8_t m_mcu_p3;
69 	int m_coin_result;
70 
71 	uint8_t protection_r();
72 	void protection_w(uint8_t data);
73 	uint8_t e004_r();
74 	void nmi_w(uint8_t data);
75 	void e100_w(uint8_t data);
76 
77 	void textram_w(offs_t offset, uint8_t data);
78 
79 	TILE_GET_INFO_MEMBER(get_tile_info);
80 
81 	void thedeep_palette(palette_device &palette) const;
82 
83 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
84 
85 	TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
86 
87 	void audio_map(address_map &map);
88 	void main_map(address_map &map);
89 };
90 
91 #endif // MAME_INCLUDES_THEDEEP_H
92