1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles, Couriersud
3 /***************************************************************************
4 
5     Galaxian hardware family
6 
7 ***************************************************************************/
8 #ifndef MAME_INCLUDES_GALAXIAN_H
9 #define MAME_INCLUDES_GALAXIAN_H
10 
11 #pragma once
12 
13 #include "machine/gen_latch.h"
14 #include "machine/i8255.h"
15 #include "machine/timer.h"
16 #include "sound/ay8910.h"
17 #include "sound/dac.h"
18 #include "sound/digitalk.h"
19 #include "machine/netlist.h"
20 #include "emupal.h"
21 #include "screen.h"
22 #include "tilemap.h"
23 
24 namespace {
25 
26 /* master clocks */
27 static constexpr XTAL GALAXIAN_MASTER_CLOCK(18.432_MHz_XTAL);
28 static constexpr XTAL KONAMI_SOUND_CLOCK(14.318181_MHz_XTAL);
29 static constexpr XTAL SIDAM_MASTER_CLOCK(12_MHz_XTAL);
30 
31 /* we scale horizontally by 3 to render stars correctly */
32 static constexpr int GALAXIAN_XSCALE = 3;
33 /* the Sidam bootlegs have a 12 MHz XTAL instead */
34 static constexpr int SIDAM_XSCALE    = 2;
35 
36 static constexpr XTAL GALAXIAN_PIXEL_CLOCK(GALAXIAN_XSCALE*GALAXIAN_MASTER_CLOCK / 3);
37 static constexpr XTAL SIDAM_PIXEL_CLOCK(SIDAM_XSCALE*SIDAM_MASTER_CLOCK / 2);
38 
39 /* H counts from 128->511, HBLANK starts at 130 and ends at 250 */
40 /* we normalize this here so that we count 0->383 with HBLANK */
41 /* from 264-383 */
42 static constexpr int GALAXIAN_HTOTAL  = (384 * GALAXIAN_XSCALE);
43 static constexpr int GALAXIAN_HBEND   = (0 * GALAXIAN_XSCALE);
44 //static constexpr int GALAXIAN_H0START = (6*GALAXIAN_XSCALE)
45 //static constexpr int GALAXIAN_HBSTART = (264*GALAXIAN_XSCALE)
46 static constexpr int GALAXIAN_H0START = (0 * GALAXIAN_XSCALE);
47 static constexpr int GALAXIAN_HBSTART = (256 * GALAXIAN_XSCALE);
48 
49 static constexpr int GALAXIAN_VTOTAL  = (264);
50 static constexpr int GALAXIAN_VBEND   = (16);
51 static constexpr int GALAXIAN_VBSTART = (224 + 16);
52 
53 static constexpr int SIDAM_HTOTAL     = (384 * SIDAM_XSCALE);
54 static constexpr int SIDAM_HBEND      = (0 * SIDAM_XSCALE);
55 static constexpr int SIDAM_H0START    = (0 * SIDAM_XSCALE);
56 static constexpr int SIDAM_HBSTART    = (256 * SIDAM_XSCALE);
57 
58 } // anonymous namespace
59 
60 class galaxian_state : public driver_device
61 {
62 public:
galaxian_state(const machine_config & mconfig,device_type type,const char * tag)63 	galaxian_state(const machine_config &mconfig, device_type type, const char *tag)
64 		: driver_device(mconfig, type, tag)
65 		, m_maincpu(*this, "maincpu")
66 		, m_audiocpu(*this, "audiocpu")
67 		, m_audio2(*this, "audio2")
68 		, m_dac(*this, "dac")
69 		, m_ay8910(*this, "8910.%u", 0)
70 		, m_ay8910_cclimber(*this, "cclimber_audio:aysnd")
71 		, m_digitalker(*this, "digitalker")
72 		, m_ppi8255(*this, "ppi8255_%u", 0)
73 		, m_gfxdecode(*this, "gfxdecode")
74 		, m_screen(*this, "screen")
75 		, m_palette(*this, "palette")
76 		, m_soundlatch(*this, "soundlatch")
77 		, m_netlist(*this, "konami")
78 		, m_filter_ctl(*this, "konami:ctl%u", 0)
79 		, m_fake_select(*this, "FAKE_SELECT")
80 		, m_tenspot_game_dsw(*this, {"IN2_GAME0", "IN2_GAME1", "IN2_GAME2", "IN2_GAME3", "IN2_GAME4", "IN2_GAME5", "IN2_GAME6", "IN2_GAME7", "IN2_GAME8", "IN2_GAME9"})
81 		, m_spriteram(*this, "spriteram")
82 		, m_videoram(*this, "videoram")
83 		, m_decrypted_opcodes(*this, "decrypted_opcodes")
84 		, m_lamps(*this, "lamp%u", 0U)
85 	{ }
86 
87 	/* video extension callbacks */
88 	typedef void (galaxian_state::*galaxian_extend_tile_info_func)(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
89 	typedef void (galaxian_state::*galaxian_extend_sprite_info_func)(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
90 	typedef void (galaxian_state::*galaxian_draw_bullet_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
91 	typedef void (galaxian_state::*galaxian_draw_background_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect);
92 
93 	void galaxian_videoram_w(offs_t offset, uint8_t data);
94 	void galaxian_objram_w(offs_t offset, uint8_t data);
95 	void galaxian_flip_screen_x_w(uint8_t data);
96 	void galaxian_flip_screen_y_w(uint8_t data);
97 	void galaxian_flip_screen_xy_w(uint8_t data);
98 	void galaxian_stars_enable_w(uint8_t data);
99 	void scramble_background_enable_w(uint8_t data);
100 	void scramble_background_red_w(uint8_t data);
101 	void scramble_background_green_w(uint8_t data);
102 	void scramble_background_blue_w(uint8_t data);
103 	void galaxian_gfxbank_w(offs_t offset, uint8_t data);
104 	template <int N> DECLARE_READ_LINE_MEMBER(azurian_port_r);
105 	DECLARE_READ_LINE_MEMBER(kingball_muxbit_r);
106 	DECLARE_READ_LINE_MEMBER(kingball_noise_r);
107 	DECLARE_CUSTOM_INPUT_MEMBER(moonwar_dial_r);
108 	void irq_enable_w(uint8_t data);
109 	void start_lamp_w(offs_t offset, uint8_t data);
110 	void coin_lock_w(uint8_t data);
111 	void coin_count_0_w(uint8_t data);
112 	void coin_count_1_w(uint8_t data);
113 	uint8_t konami_ay8910_r(offs_t offset);
114 	void konami_ay8910_w(offs_t offset, uint8_t data);
115 	void konami_sound_filter_w(offs_t offset, uint8_t data);
116 	uint8_t theend_ppi8255_r(offs_t offset);
117 	void theend_ppi8255_w(offs_t offset, uint8_t data);
118 	void theend_protection_w(uint8_t data);
119 	uint8_t theend_protection_r();
120 	template <int N> DECLARE_READ_LINE_MEMBER(theend_protection_alt_r);
121 	void explorer_sound_control_w(uint8_t data);
122 	uint8_t sfx_sample_io_r(offs_t offset);
123 	void sfx_sample_io_w(offs_t offset, uint8_t data);
124 	uint8_t monsterz_protection_r();
125 	uint8_t frogger_ppi8255_r(offs_t offset);
126 	void frogger_ppi8255_w(offs_t offset, uint8_t data);
127 	uint8_t frogger_ay8910_r(offs_t offset);
128 	void frogger_ay8910_w(offs_t offset, uint8_t data);
129 	IRQ_CALLBACK_MEMBER(froggermc_audiocpu_irq_ack);
130 	void froggermc_sound_control_w(uint8_t data);
131 	uint8_t frogf_ppi8255_r(offs_t offset);
132 	void frogf_ppi8255_w(offs_t offset, uint8_t data);
133 	uint8_t turtles_ppi8255_0_r(offs_t offset);
134 	uint8_t turtles_ppi8255_1_r(offs_t offset);
135 	void turtles_ppi8255_0_w(offs_t offset, uint8_t data);
136 	void turtles_ppi8255_1_w(offs_t offset, uint8_t data);
137 	uint8_t scorpion_ay8910_r(offs_t offset);
138 	void scorpion_ay8910_w(offs_t offset, uint8_t data);
139 	uint8_t scorpion_digitalker_intr_r();
140 	void zigzag_bankswap_w(uint8_t data);
141 	void zigzag_ay8910_w(offs_t offset, uint8_t data);
142 	void kingball_speech_dip_w(uint8_t data);
143 	void kingball_sound1_w(uint8_t data);
144 	void kingball_sound2_w(uint8_t data);
145 	void mshuttle_ay8910_cs_w(uint8_t data);
146 	void mshuttle_ay8910_control_w(uint8_t data);
147 	void mshuttle_ay8910_data_w(uint8_t data);
148 	uint8_t mshuttle_ay8910_data_r();
149 	uint8_t jumpbug_protection_r(offs_t offset);
150 	void checkman_sound_command_w(uint8_t data);
151 	uint8_t checkmaj_protection_r();
152 	uint8_t dingo_3000_r();
153 	uint8_t dingo_3035_r();
154 	uint8_t dingoe_3001_r();
155 	void tenspot_unk_6000_w(uint8_t data);
156 	void tenspot_unk_8000_w(uint8_t data);
157 	void tenspot_unk_e000_w(uint8_t data);
158 	uint8_t froggeram_ppi8255_r(offs_t offset);
159 	void froggeram_ppi8255_w(offs_t offset, uint8_t data);
160 	void artic_gfxbank_w(uint8_t data);
161 	uint8_t tenspot_dsw_read();
162 	void konami_sound_control_w(uint8_t data);
163 	uint8_t konami_sound_timer_r();
164 	void konami_portc_0_w(uint8_t data);
165 	void konami_portc_1_w(uint8_t data);
166 	void theend_coin_counter_w(uint8_t data);
167 	uint8_t explorer_sound_latch_r();
168 	void sfx_sample_control_w(uint8_t data);
169 	void monsterz_porta_1_w(uint8_t data);
170 	void monsterz_portb_1_w(uint8_t data);
171 	void monsterz_portc_1_w(uint8_t data);
172 	uint8_t frogger_sound_timer_r();
173 	uint8_t scorpion_protection_r();
174 	void scorpion_protection_w(uint8_t data);
175 	void scorpion_digitalker_control_w(uint8_t data);
176 	void kingball_dac_w(uint8_t data);
177 	void moonwar_port_select_w(uint8_t data);
178 	void init_fourplay();
179 	void init_videight();
180 	void init_galaxian();
181 	void init_nolock();
182 	void init_azurian();
183 	void init_pisces();
184 	void init_batman2();
185 	void init_highroll();
186 	void init_frogg();
187 	void init_mooncrst();
188 	void init_mooncrsu();
189 	void init_mooncrgx();
190 	void init_moonqsr();
191 	void init_pacmanbl();
192 	void init_tenspot();
193 	void init_devilfsg();
194 	void init_zigzag();
195 	void init_jumpbug();
196 	void init_checkman();
197 	void init_checkmaj();
198 	void init_dingo();
199 	void init_dingoe();
200 	void init_skybase();
201 	void init_kong();
202 	void init_mshuttle();
203 	void init_mshuttlj();
204 	void init_fantastc();
205 	void init_timefgtr();
206 	void init_kingball();
207 	void init_scorpnmc();
208 	void init_theend();
209 	void init_scramble();
210 	void init_sidam();
211 	void init_explorer();
212 	void init_amigo2();
213 	void init_mandinga();
214 	void init_mandingaeg();
215 	void init_sfx();
216 	void init_atlantis();
217 	void init_scobra();
218 	void init_scobrae();
219 	void init_losttomb();
220 	void init_frogger();
221 	void init_froggermc();
222 	void init_froggers();
223 	void init_quaak();
224 	void init_turtles();
225 	void init_scorpion();
226 	void init_anteater();
227 	void init_anteateruk();
228 	void init_superbon();
229 	void init_calipso();
230 	void init_moonwar();
231 	void init_ghostmun();
232 	void init_froggrs();
233 	void init_warofbugg();
234 	void init_jungsub();
235 	void init_victoryc();
236 	TILE_GET_INFO_MEMBER(bg_get_tile_info);
237 	void galaxian_palette(palette_device &palette);
238 	void moonwar_palette(palette_device &palette);
239 	void eagle_palette(palette_device &palette);
240 	void tenspot_set_game_bank(int bank, int from_game);
241 	uint32_t screen_update_galaxian(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
242 	DECLARE_WRITE_LINE_MEMBER(vblank_interrupt_w);
243 	DECLARE_INPUT_CHANGED_MEMBER(tenspot_fake);
244 	TIMER_DEVICE_CALLBACK_MEMBER(checkmaj_irq0_gen);
245 	TIMER_DEVICE_CALLBACK_MEMBER(scramble_stars_blink_timer);
246 	TIMER_DEVICE_CALLBACK_MEMBER(timefgtr_scanline);
247 	void state_save_register();
248 	void sprites_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const uint8_t *spritebase);
249 	void bullets_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const uint8_t *base);
250 	void stars_init();
251 	void stars_update_origin();
252 	void stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint32_t star_offs, uint8_t starmask);
253 	void null_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
254 	void galaxian_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
255 	void background_draw_colorsplit(bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped);
256 	void scramble_draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx);
257 	void scramble_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
258 	void anteater_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
259 	void jumpbug_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
260 	void turtles_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
261 	void sfx_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
262 	void frogger_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
263 	inline void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color);
264 	void galaxian_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
265 	void mshuttle_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
266 	void scramble_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
267 	void theend_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
268 	void upper_extend_tile_info(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
269 	void upper_extend_sprite_info(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
270 	void frogger_extend_tile_info(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
271 	void frogger_extend_sprite_info(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
272 	void gmgalax_extend_tile_info(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
273 	void gmgalax_extend_sprite_info(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
274 	void pisces_extend_tile_info(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
275 	void pisces_extend_sprite_info(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
276 	void batman2_extend_tile_info(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
277 	void mooncrst_extend_tile_info(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
278 	void mooncrst_extend_sprite_info(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
279 	void moonqsr_extend_tile_info(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
280 	void moonqsr_extend_sprite_info(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
281 	void mshuttle_extend_tile_info(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
282 	void mshuttle_extend_sprite_info(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
283 	void calipso_extend_sprite_info(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
284 	void jumpbug_extend_tile_info(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
285 	void jumpbug_extend_sprite_info(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
286 	void monsterz_set_latch();
287 	void decode_mooncrst(int length, uint8_t *dest);
288 	void decode_checkman();
289 	void decode_dingoe();
290 	void decode_frogger_sound();
291 	void decode_froggermc_sound();
292 	void decode_frogger_gfx();
293 	void decode_anteater_gfx();
294 	void decode_losttomb_gfx();
295 	void decode_superbon();
296 	void decode_victoryc();
297 	void mshuttle_decode(const uint8_t convtable[8][16]);
298 	void common_init(galaxian_draw_bullet_func draw_bullet,galaxian_draw_background_func draw_background,
299 					 galaxian_extend_tile_info_func extend_tile_info,galaxian_extend_sprite_info_func extend_sprite_info);
300 	void galaxian_base(machine_config &config);
301 	void sidam_bootleg_base(machine_config &config);
302 	void konami_base(machine_config &config);
303 	void konami_sound_1x_ay8910(machine_config &config);
304 	void konami_sound_2x_ay8910(machine_config &config);
305 	void scramble_base(machine_config &config);
306 	void timefgtr(machine_config &config);
307 	void moonqsr(machine_config &config);
308 	void frogger(machine_config &config);
309 	void anteatergg(machine_config &config);
310 	void theend(machine_config &config);
311 	void turtles(machine_config &config);
312 	void fantastc(machine_config &config);
313 	void jumpbug(machine_config &config);
314 	void checkmaj(machine_config &config);
315 	void pacmanbl(machine_config &config);
316 	void quaak(machine_config &config);
317 	void galaxian(machine_config &config);
318 	void highroll(machine_config &config);
319 	void tenspot(machine_config &config);
320 	void froggers(machine_config &config);
321 	void froggervd(machine_config &config);
322 	void mshuttle(machine_config &config);
323 	void anteateruk(machine_config &config);
324 	void monsterz(machine_config &config);
325 	void kingball(machine_config &config);
326 	void anteaterg(machine_config &config);
327 	void anteater(machine_config &config);
328 	void moonwar(machine_config &config);
329 	void turpins(machine_config &config);
330 	void explorer(machine_config &config);
331 	void scramble(machine_config &config);
332 	void scobra(machine_config &config);
333 	void froggermc(machine_config &config);
334 	void froggeram(machine_config &config);
335 	void spactrai(machine_config &config);
336 	void takeoff(machine_config &config);
337 	void sfx(machine_config &config);
338 	void mooncrst(machine_config &config);
339 	void eagle(machine_config &config);
340 	void scorpion(machine_config &config);
341 	void frogf(machine_config &config);
342 	void amigo2(machine_config &config);
343 	void zigzag(machine_config &config);
344 	void checkman(machine_config &config);
345 	void jungsub(machine_config &config);
346 	void victoryc(machine_config &config);
347 	void frogg(machine_config &config);
348 	void mandingarf(machine_config &config);
349 	void thepitm(machine_config &config);
350 	void skybase(machine_config &config);
351 	void kong(machine_config &config);
352 	void scorpnmc(machine_config &config);
353 	void fourplay(machine_config &config);
354 	void videight(machine_config &config);
355 
356 protected:
357 	void amigo2_map(address_map &map);
358 	void anteaterg_map(address_map &map);
359 	void anteatergg_map(address_map &map);
360 	void anteateruk_map(address_map &map);
361 	void checkmaj_sound_map(address_map &map);
362 	void checkman_sound_map(address_map &map);
363 	void checkman_sound_portmap(address_map &map);
364 	void explorer_map(address_map &map);
365 	void fantastc_map(address_map &map);
366 	void frogf_map(address_map &map);
367 	void frogg_map(address_map &map);
368 	void frogger_map(address_map &map);
369 	void froggervd_map(address_map &map);
370 	void frogger_sound_map(address_map &map);
371 	void frogger_sound_portmap(address_map &map);
372 	void froggeram_map(address_map &map);
373 	void froggermc_map(address_map &map);
374 	void galaxian_map(address_map &map);
375 	void galaxian_map_base(address_map &map);
376 	void galaxian_map_discrete(address_map &map);
377 	void highroll_map(address_map &map);
378 	void jumpbug_map(address_map &map);
379 	void jungsub_map(address_map &map);
380 	void jungsub_io_map(address_map &map);
381 	void kingball_sound_map(address_map &map);
382 	void kingball_sound_portmap(address_map &map);
383 	void konami_sound_map(address_map &map);
384 	void konami_sound_portmap(address_map &map);
385 	void kong_map(address_map &map);
386 	void mandingarf_map(address_map &map);
387 	void monsterz_map(address_map &map);
388 	void mooncrst_map(address_map &map);
389 	void mooncrst_map_base(address_map &map);
390 	void mooncrst_map_discrete(address_map &map);
391 	void moonqsr_decrypted_opcodes_map(address_map &map);
392 	void mshuttle_decrypted_opcodes_map(address_map &map);
393 	void mshuttle_map(address_map &map);
394 	void mshuttle_portmap(address_map &map);
395 	void scobra_map(address_map &map);
396 	void scorpion_map(address_map &map);
397 	void scorpion_sound_map(address_map &map);
398 	void scorpion_sound_portmap(address_map &map);
399 	void scorpnmc_map(address_map &map);
400 	void sfx_map(address_map &map);
401 	void sfx_sample_map(address_map &map);
402 	void sfx_sample_portmap(address_map &map);
403 	void skybase_map(address_map &map);
404 	void spactrai_map(address_map &map);
405 	void takeoff_sound_map(address_map &map);
406 	void takeoff_sound_portmap(address_map &map);
407 	void tenspot_select_map(address_map &map);
408 	void theend_map(address_map &map);
409 	void thepitm_map(address_map &map);
410 	void turpins_map(address_map &map);
411 	void turpins_sound_map(address_map &map);
412 	void turtles_map(address_map &map);
413 	void victoryc_map(address_map &map);
414 	void zigzag_map(address_map &map);
415 
machine_start()416 	virtual void machine_start() override { m_lamps.resolve(); }
417 	virtual void video_start() override;
418 
419 	required_device<cpu_device> m_maincpu;
420 	optional_device<cpu_device> m_audiocpu;
421 	optional_device<cpu_device> m_audio2;
422 	optional_device<dac_byte_interface> m_dac;
423 	optional_device_array<ay8910_device, 3> m_ay8910;
424 	optional_device<ay8910_device> m_ay8910_cclimber;
425 	optional_device<digitalker_device> m_digitalker;
426 	optional_device_array<i8255_device, 3> m_ppi8255;
427 	required_device<gfxdecode_device> m_gfxdecode;
428 	required_device<screen_device> m_screen;
429 	required_device<palette_device> m_palette;
430 	optional_device<generic_latch_8_device> m_soundlatch;
431 	optional_device<netlist_mame_sound_device> m_netlist;
432 	optional_device_array<netlist_mame_logic_input_device, 12> m_filter_ctl;
433 	optional_ioport m_fake_select;
434 	optional_ioport_array<10> m_tenspot_game_dsw;
435 
436 	required_shared_ptr<uint8_t> m_spriteram;
437 	required_shared_ptr<uint8_t> m_videoram;
438 	optional_shared_ptr<uint8_t> m_decrypted_opcodes;
439 	output_finder<2> m_lamps;
440 
441 	int m_bullets_base;
442 	int m_sprites_base;
443 	int m_numspritegens;
444 	int m_counter_74ls161[2];
445 	int m_direction[2];
446 	uint8_t m_zigzag_ay8910_latch;
447 	uint8_t m_kingball_speech_dip;
448 	uint8_t m_kingball_sound;
449 	uint8_t m_mshuttle_ay8910_cs;
450 	uint16_t m_protection_state;
451 	uint8_t m_protection_result;
452 	uint8_t m_konami_sound_control;
453 	uint8_t m_sfx_sample_control;
454 	uint8_t m_moonwar_port_select;
455 	uint8_t m_irq_enabled;
456 	int m_irq_line;
457 	int m_tenspot_current_game;
458 	uint8_t m_frogger_adjust;
459 	uint8_t m_x_scale;
460 	uint8_t m_h0_start;
461 	uint8_t m_sfx_tilemap;
462 
463 	galaxian_extend_tile_info_func m_extend_tile_info_ptr;
464 	galaxian_extend_sprite_info_func m_extend_sprite_info_ptr;
465 	galaxian_draw_bullet_func m_draw_bullet_ptr;
466 	galaxian_draw_background_func m_draw_background_ptr;
467 
468 	tilemap_t *m_bg_tilemap;
469 	uint8_t m_flipscreen_x;
470 	uint8_t m_flipscreen_y;
471 	uint8_t m_background_enable;
472 	uint8_t m_background_red;
473 	uint8_t m_background_green;
474 	uint8_t m_background_blue;
475 	uint32_t m_star_rng_origin;
476 	uint32_t m_star_rng_origin_frame;
477 	rgb_t m_star_color[64];
478 	std::unique_ptr<uint8_t[]> m_stars;
479 	uint8_t m_stars_enabled;
480 	uint8_t m_stars_blink_state;
481 	rgb_t m_bullet_color[8];
482 	uint8_t m_gfxbank[5];
483 
484 	void fourplay_rombank_w(offs_t offset, uint8_t data);
485 	void videight_rombank_w(offs_t offset, uint8_t data);
486 	void videight_gfxbank_w(offs_t offset, uint8_t data);
487 	void videight_extend_tile_info(uint16_t *code, uint8_t *color, uint8_t attrib, uint8_t x);
488 	void videight_extend_sprite_info(const uint8_t *base, uint8_t *sx, uint8_t *sy, uint8_t *flipx, uint8_t *flipy, uint16_t *code, uint8_t *color);
489 	void fourplay_map(address_map &map);
490 	void videight_map(address_map &map);
491 };
492 
493 class gmgalax_state : public galaxian_state
494 {
495 public:
gmgalax_state(const machine_config & mconfig,device_type type,const char * tag)496 	gmgalax_state(const machine_config &mconfig, device_type type, const char *tag)
497 		: galaxian_state(mconfig, type, tag)
498 		, m_glin(*this, "GLIN%u", 0U)
499 		, m_gmin(*this, "GMIN%u", 0U)
500 	{ }
501 
502 	void gmgalax(machine_config &config);
503 
504 	DECLARE_INPUT_CHANGED_MEMBER(game_changed);
505 	template <int N> DECLARE_CUSTOM_INPUT_MEMBER(port_r);
506 
507 	void init_gmgalax();
508 
509 private:
510 	uint8_t m_selected_game;
511 	required_ioport_array<3> m_glin;
512 	required_ioport_array<3> m_gmin;
513 };
514 
515 #endif // MAME_INCLUDES_GALAXIAN_H
516