1 // license:BSD-3-Clause
2 // copyright-holders:Brad Oliver,Stephane Humbert
3 #ifndef MAME_INCLUDES_ARKANOID_H
4 #define MAME_INCLUDES_ARKANOID_H
5 
6 #pragma once
7 
8 #include "machine/taito68705interface.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 /* This it the best way to allow game specific kludges until the system is fully understood */
13 enum {
14 	ARKUNK = 0,  /* unknown bootlegs for inclusion of possible new sets */
15 	ARKANGC,
16 	ARKANGC2,
17 	BLOCK2,
18 	ARKBLOCK,
19 	ARKBLOC2,
20 	ARKGCBL,
21 	PADDLE2
22 };
23 
24 class arkanoid_state : public driver_device
25 {
26 public:
arkanoid_state(const machine_config & mconfig,device_type type,const char * tag)27 	arkanoid_state(const machine_config &mconfig, device_type type, const char *tag)
28 		: driver_device(mconfig, type, tag)
29 		, m_videoram(*this, "videoram")
30 		, m_spriteram(*this, "spriteram")
31 		, m_protram(*this, "protram")
32 		, m_muxports(*this, "P%u", 1)
33 		, m_maincpu(*this, "maincpu")
34 		, m_mcuintf(*this, "mcu")
35 		, m_gfxdecode(*this, "gfxdecode")
36 		, m_palette(*this, "palette")
37 	{
38 	}
39 
40 	/* memory pointers */
41 	required_shared_ptr<uint8_t> m_videoram;
42 	optional_shared_ptr<uint8_t> m_spriteram;
43 	optional_shared_ptr<uint8_t> m_protram;
44 
45 	/* video-related */
46 	tilemap_t  *m_bg_tilemap;
47 	uint8_t    m_gfxbank;
48 	uint8_t    m_palettebank;
49 
50 	/* input-related */
51 	uint8_t    m_paddle_select;   // selected by d008 bit 2
52 
53 	/* bootleg related */
54 	int      m_bootleg_id;
55 	uint8_t    m_bootleg_cmd;
56 
57 	/* hexaa */
58 	uint8_t m_hexaa_from_main;
59 	uint8_t m_hexaa_from_sub;
60 
61 	/* devices */
62 	optional_ioport_array<2> m_muxports;
63 	required_device<cpu_device> m_maincpu;
64 	optional_device<arkanoid_mcu_device_base> m_mcuintf;
65 	required_device<gfxdecode_device> m_gfxdecode;
66 	required_device<palette_device> m_palette;
67 
68 
69 	uint8_t arkanoid_bootleg_f000_r();
70 	uint8_t arkanoid_bootleg_f002_r();
71 	void arkanoid_bootleg_d018_w(uint8_t data);
72 	uint8_t arkanoid_bootleg_d008_r();
73 	void arkanoid_videoram_w(offs_t offset, uint8_t data);
74 	void arkanoid_d008_w(uint8_t data);
75 	void tetrsark_d008_w(uint8_t data);
76 	void brixian_d008_w(uint8_t data);
77 	void hexa_d008_w(uint8_t data);
78 	uint8_t hexaa_f000_r();
79 	void hexaa_f000_w(uint8_t data);
80 	void hexaa_sub_80_w(uint8_t data);
81 	uint8_t hexaa_sub_90_r();
82 	DECLARE_CUSTOM_INPUT_MEMBER(arkanoid_semaphore_input_r);
83 	uint8_t input_mux_r();
84 	void init_block2();
85 	void init_arkblock();
86 	void init_hexa();
87 	void init_hexaa();
88 	void init_paddle2();
89 	void init_tetrsark();
90 	void init_tetrsark2();
91 	void init_arkgcbl();
92 	void init_arkangc2();
93 	void init_arkbloc2();
94 	void init_arkangc();
95 	void init_brixian();
96 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
97 	virtual void machine_start() override;
98 	virtual void machine_reset() override;
99 	virtual void video_start() override;
100 	uint32_t screen_update_arkanoid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
101 	uint32_t screen_update_hexa(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
102 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
103 	void arkanoid_bootleg_init(  );
104 
105 	void bootleg(machine_config &config);
106 	void p3mcuay(machine_config &config);
107 	void aysnd(machine_config &config);
108 	void hexa(machine_config &config);
109 	void brixian(machine_config &config);
110 	void hexaa(machine_config &config);
111 	void p3mcu(machine_config &config);
112 	void arkanoid(machine_config &config);
113 	void arkanoid_map(address_map &map);
114 	void bootleg_map(address_map &map);
115 	void brixian_map(address_map &map);
116 	void hexa_map(address_map &map);
117 	void hexaa_map(address_map &map);
118 	void hexaa_sub_iomap(address_map &map);
119 	void hexaa_sub_map(address_map &map);
120 };
121 
122 #endif // MAME_INCLUDES_ARKANOID_H
123