1 // license:BSD-3-Clause
2 // copyright-holders:Roberto Fresca
3 #ifndef MAME_INCLUDES_LUCKY74_H
4 #define MAME_INCLUDES_LUCKY74_H
5 
6 #pragma once
7 
8 #include "sound/msm5205.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class lucky74_state : public driver_device
13 {
14 public:
lucky74_state(const machine_config & mconfig,device_type type,const char * tag)15 	lucky74_state(const machine_config &mconfig, device_type type, const char *tag) :
16 		driver_device(mconfig, type, tag),
17 		m_fg_videoram(*this, "fg_videoram"),
18 		m_fg_colorram(*this, "fg_colorram"),
19 		m_bg_videoram(*this, "bg_videoram"),
20 		m_bg_colorram(*this, "bg_colorram"),
21 		m_maincpu(*this, "maincpu"),
22 		m_msm(*this, "msm"),
23 		m_gfxdecode(*this, "gfxdecode"),
24 		m_lamps(*this, "lamp%u", 0U)
25 	{ }
26 
27 	void lucky74(machine_config &config);
28 
29 protected:
30 	virtual void machine_start() override;
31 	virtual void video_start() override;
32 	virtual void machine_reset() override;
33 	virtual void sound_start() override;
34 
35 private:
36 	uint8_t custom_09R81P_port_r(offs_t offset);
37 	void custom_09R81P_port_w(offs_t offset, uint8_t data);
38 	uint8_t usart_8251_r();
39 	void usart_8251_w(uint8_t data);
40 	uint8_t copro_sm7831_r();
41 	void copro_sm7831_w(uint8_t data);
42 	void fg_videoram_w(offs_t offset, uint8_t data);
43 	void fg_colorram_w(offs_t offset, uint8_t data);
44 	void bg_videoram_w(offs_t offset, uint8_t data);
45 	void bg_colorram_w(offs_t offset, uint8_t data);
46 	void ym2149_portb_w(uint8_t data);
47 	void lamps_a_w(uint8_t data);
48 	void lamps_b_w(uint8_t data);
49 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
50 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
51 	void palette(palette_device &palette) const;
52 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
53 	INTERRUPT_GEN_MEMBER(nmi_interrupt);
54 	DECLARE_WRITE_LINE_MEMBER(adpcm_int);
55 	void prg_map(address_map &map);
56 	void portmap(address_map &map);
57 
58 	uint8_t m_ym2149_portb;
59 	uint8_t m_usart_8251;
60 	uint8_t m_copro_sm7831;
61 	int m_adpcm_pos;
62 	int m_adpcm_end;
63 	int m_adpcm_data;
64 	uint8_t m_adpcm_reg[6];
65 	uint8_t m_adpcm_busy_line;
66 	required_shared_ptr<uint8_t> m_fg_videoram;
67 	required_shared_ptr<uint8_t> m_fg_colorram;
68 	required_shared_ptr<uint8_t> m_bg_videoram;
69 	required_shared_ptr<uint8_t> m_bg_colorram;
70 	tilemap_t *m_fg_tilemap;
71 	tilemap_t *m_bg_tilemap;
72 	required_device<cpu_device> m_maincpu;
73 	required_device<msm5205_device> m_msm;
74 	required_device<gfxdecode_device> m_gfxdecode;
75 	output_finder<12> m_lamps;
76 };
77 
78 #endif // MAME_INCLUDES_LUCKY74_H
79