1 // license:BSD-3-Clause
2 // copyright-holders:Tomasz Slanina, Roberto Fresca
3 /*************************************************************************
4 
5     IDSA 4 En Raya
6 
7 *************************************************************************/
8 
9 #ifndef MAME_INCLUDES_4ENRAYA_H
10 #define MAME_INCLUDES_4ENRAYA_H
11 
12 #pragma once
13 
14 #include "sound/ay8910.h"
15 #include "emupal.h"
16 #include "tilemap.h"
17 
18 class _4enraya_state : public driver_device
19 {
20 public:
_4enraya_state(const machine_config & mconfig,device_type type,const char * tag)21 	_4enraya_state(const machine_config &mconfig, device_type type, const char *tag)
22 		: driver_device(mconfig, type, tag)
23 		, m_maincpu(*this, "maincpu")
24 		, m_ay(*this, "aysnd")
25 		, m_gfxdecode(*this, "gfxdecode")
26 		, m_palette(*this, "palette")
27 		, m_prom(*this, "pal_prom")
28 		, m_rom(*this, "maincpu")
29 	{
30 	}
31 
32 	void _4enraya(machine_config &config);
33 
34 	void fenraya_videoram_w(offs_t offset, uint8_t data);
35 
36 protected:
37 	void sound_data_w(uint8_t data);
38 	uint8_t fenraya_custom_map_r(offs_t offset);
39 	void fenraya_custom_map_w(offs_t offset, uint8_t data);
40 	void sound_control_w(uint8_t data);
41 	TILE_GET_INFO_MEMBER(get_tile_info);
42 	uint32_t screen_update_4enraya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
43 
44 	void main_map(address_map &map);
45 	void main_portmap(address_map &map);
46 
47 	virtual void machine_start() override;
48 	virtual void machine_reset() override;
49 	virtual void video_start() override;
50 
51 	required_device<cpu_device> m_maincpu;
52 	required_device<ay8910_device> m_ay;
53 	required_device<gfxdecode_device> m_gfxdecode;
54 	required_device<palette_device> m_palette;
55 
56 	/* memory pointers */
57 	uint8_t m_videoram[0x1000];
58 	uint8_t m_workram[0x1000];
59 
60 	optional_region_ptr<uint8_t> m_prom;
61 	optional_region_ptr<uint8_t> m_rom;
62 
63 	/* video-related */
64 	tilemap_t *m_bg_tilemap;
65 
66 	/* sound-related */
67 	uint8_t m_soundlatch;
68 };
69 
70 class unk_gambl_state : public _4enraya_state
71 {
72 public:
unk_gambl_state(const machine_config & mconfig,device_type type,const char * tag)73 	unk_gambl_state(const machine_config &mconfig, device_type type, const char *tag)
74 		: _4enraya_state(mconfig, type, tag)
75 	{
76 	}
77 
78 	void unkpacg(machine_config &config);
79 
80 private:
81 	void unkpacg_main_map(address_map &map);
82 	void unkpacg_main_portmap(address_map &map);
83 
84 	void driver_init() override;
85 };
86 
87 #endif // MAME_INCLUDES_4ENRAYA_H
88