1 #include "../machine/galaga.c"
2 #include "../vidhrdw/galaga.c"
3 
4 /***************************************************************************
5 
6 Galaga memory map (preliminary)
7 
8 CPU #1:
9 0000-3fff ROM
10 CPU #2:
11 0000-1fff ROM
12 CPU #3:
13 0000-1fff ROM
14 ALL CPUS:
15 8000-83ff Video RAM
16 8400-87ff Color RAM
17 8b80-8bff sprite code/color
18 9380-93ff sprite position
19 9b80-9bff sprite control
20 8800-9fff RAM
21 
22 read:
23 6800-6807 dip switches (only bits 0 and 1 are used - bit 0 is DSW1, bit 1 is DSW2)
24 	  dsw1:
25 	    bit 6-7 lives
26 	    bit 3-5 bonus
27 	    bit 0-2 coins per play
28 		  dsw2: (bootleg version, the original version is slightly different)
29 		    bit 7 cocktail/upright (1 = upright)
30 	    bit 6 ?
31 	    bit 5 RACK TEST
32 	    bit 4 pause (0 = paused, 1 = not paused)
33 	    bit 3 ?
34 	    bit 2 ?
35 	    bit 0-1 difficulty
36 7000-     custom IO chip return values
37 7100      custom IO chip status ($10 = command executed)
38 
39 write:
40 6805      sound voice 1 waveform (nibble)
41 6811-6813 sound voice 1 frequency (nibble)
42 6815      sound voice 1 volume (nibble)
43 680a      sound voice 2 waveform (nibble)
44 6816-6818 sound voice 2 frequency (nibble)
45 681a      sound voice 2 volume (nibble)
46 680f      sound voice 3 waveform (nibble)
47 681b-681d sound voice 3 frequency (nibble)
48 681f      sound voice 3 volume (nibble)
49 6820      cpu #1 irq acknowledge/enable
50 6821      cpu #2 irq acknowledge/enable
51 6822      cpu #3 nmi acknowledge/enable
52 6823      if 0, halt CPU #2 and #3
53 6830      Watchdog reset?
54 7000-     custom IO chip parameters
55 7100      custom IO chip command (see machine/galaga.c for more details)
56 a000-a001 starfield scroll speed (only bit 0 is significant)
57 a002      starfield scroll direction (0 = backwards) (only bit 0 is significant)
58 a003-a004 starfield blink
59 a005      starfield enable
60 a007      flip screen
61 
62 Interrupts:
63 CPU #1 IRQ mode 1
64        NMI is triggered by the custom IO chip to signal the CPU to read/write
65 	       parameters
66 CPU #2 IRQ mode 1
67 CPU #3 NMI (@120Hz)
68 
69 ***************************************************************************/
70 
71 #include "driver.h"
72 #include "vidhrdw/generic.h"
73 
74 
75 
76 extern unsigned char *galaga_sharedram;
77 READ_HANDLER( galaga_hiscore_print_r );
78 READ_HANDLER( galaga_sharedram_r );
79 WRITE_HANDLER( galaga_sharedram_w );
80 READ_HANDLER( galaga_dsw_r );
81 WRITE_HANDLER( galaga_interrupt_enable_1_w );
82 WRITE_HANDLER( galaga_interrupt_enable_2_w );
83 WRITE_HANDLER( galaga_interrupt_enable_3_w );
84 READ_HANDLER( galaga_customio_r );
85 READ_HANDLER( galaga_customio_data_r );
86 WRITE_HANDLER( galaga_customio_w );
87 WRITE_HANDLER( galaga_customio_data_w );
88 WRITE_HANDLER( galaga_halt_w );
89 int galaga_interrupt_1(void);
90 int galaga_interrupt_2(void);
91 int galaga_interrupt_3(void);
92 void galaga_init_machine(void);
93 
94 
95 extern unsigned char *galaga_starcontrol;
96 int galaga_vh_start(void);
97 void galaga_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
98 void galaga_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
99 
100 WRITE_HANDLER( pengo_sound_w );
101 extern unsigned char *pengo_soundregs;
102 
103 
104 
105 static struct MemoryReadAddress readmem_cpu1[] =
106 {
107 	{ 0x8000, 0x9fff, galaga_sharedram_r },
108 	{ 0x6800, 0x6807, galaga_dsw_r },
109 	{ 0x7000, 0x700f, galaga_customio_data_r },
110 	{ 0x7100, 0x7100, galaga_customio_r },
111 	{ 0x0000, 0x3fff, MRA_ROM },
112 	{ -1 }  /* end of table */
113 };
114 
115 static struct MemoryReadAddress readmem_cpu2[] =
116 {
117 	{ 0x8000, 0x9fff, galaga_sharedram_r },
118 	{ 0x6800, 0x6807, galaga_dsw_r },
119 	{ 0x0000, 0x1fff, MRA_ROM },
120 	{ -1 }  /* end of table */
121 };
122 
123 static struct MemoryReadAddress readmem_cpu3[] =
124 {
125 	{ 0x8000, 0x9fff, galaga_sharedram_r },
126 	{ 0x6800, 0x6807, galaga_dsw_r },
127 	{ 0x0000, 0x1fff, MRA_ROM },
128 	{ -1 }  /* end of table */
129 };
130 
131 static struct MemoryWriteAddress writemem_cpu1[] =
132 {
133 	{ 0x8000, 0x9fff, galaga_sharedram_w, &galaga_sharedram },
134 	{ 0x6830, 0x6830, MWA_NOP },
135 	{ 0x7000, 0x700f, galaga_customio_data_w },
136 	{ 0x7100, 0x7100, galaga_customio_w },
137 	{ 0xa000, 0xa005, MWA_RAM, &galaga_starcontrol },
138 	{ 0x6820, 0x6820, galaga_interrupt_enable_1_w },
139 	{ 0x6822, 0x6822, galaga_interrupt_enable_3_w },
140 	{ 0x6823, 0x6823, galaga_halt_w },
141 	{ 0xa007, 0xa007, flip_screen_w },
142 	{ 0x0000, 0x3fff, MWA_ROM },
143 	{ 0x8b80, 0x8bff, MWA_RAM, &spriteram, &spriteram_size },       /* these three are here just to initialize */
144 	{ 0x9380, 0x93ff, MWA_RAM, &spriteram_2 },      /* the pointers. The actual writes are */
145 	{ 0x9b80, 0x9bff, MWA_RAM, &spriteram_3 },      /* handled by galaga_sharedram_w() */
146 	{ 0x8000, 0x83ff, MWA_RAM, &videoram, &videoram_size }, /* dirtybuffer[] handling is not needed because */
147 	{ 0x8400, 0x87ff, MWA_RAM, &colorram }, /* characters are redrawn every frame */
148 	{ -1 }  /* end of table */
149 };
150 
151 static struct MemoryWriteAddress writemem_cpu2[] =
152 {
153 	{ 0x8000, 0x9fff, galaga_sharedram_w },
154 	{ 0x6821, 0x6821, galaga_interrupt_enable_2_w },
155 	{ 0x0000, 0x1fff, MWA_ROM },
156 	{ -1 }  /* end of table */
157 };
158 
159 static struct MemoryWriteAddress writemem_cpu3[] =
160 {
161 	{ 0x8000, 0x9fff, galaga_sharedram_w },
162 	{ 0x6800, 0x681f, pengo_sound_w, &pengo_soundregs },
163 	{ 0x6822, 0x6822, galaga_interrupt_enable_3_w },
164 	{ 0x0000, 0x1fff, MWA_ROM },
165 	{ -1 }  /* end of table */
166 };
167 
168 
169 
170 INPUT_PORTS_START( galaga )
171 	PORT_START      /* DSW0 */
172 	PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
173 	PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
174 	PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
175 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
176 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
177 	PORT_DIPSETTING(    0x01, DEF_STR( 2C_3C ) )
178 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
179 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
180 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
181 	/* TODO: bonus scores are different for 5 lives */
182 	PORT_DIPNAME( 0x38, 0x10, DEF_STR( Bonus_Life ) )
183 	PORT_DIPSETTING(    0x20, "20K 60K 60K" )
184 	PORT_DIPSETTING(    0x18, "20K 60K" )
185 	PORT_DIPSETTING(    0x10, "20K 70K 70K" )
186 	PORT_DIPSETTING(    0x30, "20K 80K 80K" )
187 	PORT_DIPSETTING(    0x38, "30K 80K" )
188 	PORT_DIPSETTING(    0x08, "30K 100K 100K" )
189 	PORT_DIPSETTING(    0x28, "30K 120K 120K" )
190 	PORT_DIPSETTING(    0x00, "None" )
191 	PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Lives ) )
192 	PORT_DIPSETTING(    0x00, "2" )
193 	PORT_DIPSETTING(    0x80, "3" )
194 	PORT_DIPSETTING(    0x40, "4" )
195 	PORT_DIPSETTING(    0xc0, "5" )
196 
197 	PORT_START      /* DSW1 */
198 	PORT_DIPNAME( 0x01, 0x01, "2 Credits Game" )
199 	PORT_DIPSETTING(    0x00, "1 Player" )
200 	PORT_DIPSETTING(    0x01, "2 Players" )
201 	PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
202 	PORT_DIPSETTING(    0x06, "Easy" )
203 	PORT_DIPSETTING(    0x00, "Medium" )
204 	PORT_DIPSETTING(    0x02, "Hard" )
205 	PORT_DIPSETTING(    0x04, "Hardest" )
206 	PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
207 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
208 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
209 	PORT_DIPNAME( 0x10, 0x10, "Freeze" )
210 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
211 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
212 	PORT_BITX(    0x20, 0x20, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", KEYCODE_F1, IP_JOY_NONE )
213 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
214 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
215 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
216 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
217 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
218 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
219 	PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
220 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
221 
222 	PORT_START      /* FAKE */
223 	/* The player inputs are not memory mapped, they are handled by an I/O chip. */
224 	/* These fake input ports are read by galaga_customio_data_r() */
225 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
226 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
227 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
228 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
229 	PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1, 1 )
230 	PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
231 	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
232 
233 	PORT_START      /* FAKE */
234 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
235 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
236 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
237 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
238 	PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 1 )
239 	PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
240 	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
241 
242 	PORT_START      /* FAKE */
243 	/* the button here is used to trigger the sound in the test screen */
244 	PORT_BITX(0x03, IP_ACTIVE_LOW, IPT_BUTTON1,     0, IP_KEY_DEFAULT, IP_JOY_DEFAULT )
245 	PORT_BIT_IMPULSE( 0x04, IP_ACTIVE_LOW, IPT_START1, 1 )
246 	PORT_BIT_IMPULSE( 0x08, IP_ACTIVE_LOW, IPT_START2, 1 )
247 	PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_COIN1, 1 )
248 	PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_LOW, IPT_COIN2, 1 )
249 	PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN3, 1 )
250 	PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
251 INPUT_PORTS_END
252 
253 /* same as galaga, dip switches are slightly different */
254 INPUT_PORTS_START( galaganm )
255 	PORT_START      /* DSW0 */
256 	PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
257 	PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
258 	PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
259 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
260 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
261 	PORT_DIPSETTING(    0x01, DEF_STR( 2C_3C ) )
262 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
263 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
264 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
265 	/* TODO: bonus scores are different for 5 lives */
266 	PORT_DIPNAME( 0x38, 0x10, DEF_STR( Bonus_Life ) )
267 	PORT_DIPSETTING(    0x20, "20K 60K 60K" )
268 	PORT_DIPSETTING(    0x18, "20K 60K" )
269 	PORT_DIPSETTING(    0x10, "20K 70K 70K" )
270 	PORT_DIPSETTING(    0x30, "20K 80K 80K" )
271 	PORT_DIPSETTING(    0x38, "30K 80K" )
272 	PORT_DIPSETTING(    0x08, "30K 100K 100K" )
273 	PORT_DIPSETTING(    0x28, "30K 120K 120K" )
274 	PORT_DIPSETTING(    0x00, "None" )
275 	PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Lives ) )
276 	PORT_DIPSETTING(    0x00, "2" )
277 	PORT_DIPSETTING(    0x80, "3" )
278 	PORT_DIPSETTING(    0x40, "4" )
279 	PORT_DIPSETTING(    0xc0, "5" )
280 
281 	PORT_START      /* DSW1 */
282 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
283 	PORT_DIPSETTING(    0x03, "Easy" )
284 	PORT_DIPSETTING(    0x00, "Medium" )
285 	PORT_DIPSETTING(    0x01, "Hard" )
286 	PORT_DIPSETTING(    0x02, "Hardest" )
287 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
288 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
289 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
290 	PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
291 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
292 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
293 	PORT_DIPNAME( 0x10, 0x10, "Freeze" )
294 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
295 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
296 	PORT_BITX(    0x20, 0x20, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", KEYCODE_F1, IP_JOY_NONE )
297 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
298 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
299 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
300 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
301 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
302 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
303 	PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
304 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
305 
306 	PORT_START      /* FAKE */
307 	/* The player inputs are not memory mapped, they are handled by an I/O chip. */
308 	/* These fake input ports are read by galaga_customio_data_r() */
309 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
310 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
311 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
312 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
313 	PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1, 1 )
314 	PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
315 	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
316 
317 	PORT_START      /* FAKE */
318 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
319 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
320 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
321 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
322 	PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 1 )
323 	PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
324 	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
325 
326 	PORT_START      /* FAKE */
327 	/* the button here is used to trigger the sound in the test screen */
328 	PORT_BITX(0x03, IP_ACTIVE_LOW, IPT_BUTTON1,     0, IP_KEY_DEFAULT, IP_JOY_DEFAULT )
329 	PORT_BIT_IMPULSE( 0x04, IP_ACTIVE_LOW, IPT_START1, 1 )
330 	PORT_BIT_IMPULSE( 0x08, IP_ACTIVE_LOW, IPT_START2, 1 )
331 	PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_COIN1, 1 )
332 	PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_LOW, IPT_COIN2, 1 )
333 	PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN3, 1 )
334 	PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
335 INPUT_PORTS_END
336 
337 
338 
339 static struct GfxLayout charlayout =
340 {
341 	8,8,           /* 8*8 characters */
342 	128,           /* 128 characters */
343 	2,             /* 2 bits per pixel */
344 	{ 0, 4 },       /* the two bitplanes for 4 pixels are packed into one byte */
345 	{ 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 },   /* bits are packed in groups of four */
346 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },   /* characters are rotated 90 degrees */
347 	16*8           /* every char takes 16 bytes */
348 };
349 
350 static struct GfxLayout spritelayout =
351 {
352 	16,16,          /* 16*16 sprites */
353 	128,            /* 128 sprites */
354 	2,              /* 2 bits per pixel */
355 	{ 0, 4 },       /* the two bitplanes for 4 pixels are packed into one byte */
356 	{ 0, 1, 2, 3, 8*8, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3,
357 			24*8+0, 24*8+1, 24*8+2, 24*8+3 },
358 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
359 			32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
360 	64*8    /* every sprite takes 64 bytes */
361 };
362 
363 
364 
365 static struct GfxDecodeInfo gfxdecodeinfo[] =
366 {
367 	{ REGION_GFX1, 0, &charlayout,       0, 32 },
368 	{ REGION_GFX2, 0, &spritelayout,  32*4, 32 },
369 	{ -1 } /* end of array */
370 };
371 
372 
373 
374 static struct namco_interface namco_interface =
375 {
376 	3072000/32,	/* sample rate */
377 	3,			/* number of voices */
378 	100,		/* playback volume */
379 	REGION_SOUND1	/* memory region */
380 };
381 
382 static const char *galaga_sample_names[] =
383 {
384 	"*galaga",
385 	"bang.wav",
386 	0       /* end of array */
387 };
388 
389 static struct Samplesinterface samples_interface =
390 {
391 	1,	/* one channel */
392 	80,	/* volume */
393 	galaga_sample_names
394 };
395 
396 
397 static struct MachineDriver machine_driver_galaga =
398 {
399 	/* basic machine hardware */
400 	{
401 		{
402 			CPU_Z80,
403 			3125000,        /* 3.125 Mhz */
404 			readmem_cpu1,writemem_cpu1,0,0,
405 			galaga_interrupt_1,1
406 		},
407 		{
408 			CPU_Z80,
409 			3125000,        /* 3.125 Mhz */
410 			readmem_cpu2,writemem_cpu2,0,0,
411 			galaga_interrupt_2,1
412 		},
413 		{
414 			CPU_Z80,
415 			3125000,        /* 3.125 Mhz */
416 			readmem_cpu3,writemem_cpu3,0,0,
417 			galaga_interrupt_3,2
418 		}
419 	},
420 	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
421 	99,	/* 99 CPU slices per frame - with 100, galagab2 hangs on coin insertion */
422 	galaga_init_machine,
423 
424 	/* video hardware */
425 	36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },
426 	gfxdecodeinfo,
427 	32+64,64*4,     /* 32 for the characters, 64 for the stars */
428 	galaga_vh_convert_color_prom,
429 
430 	VIDEO_TYPE_RASTER,
431 	0,
432 	galaga_vh_start,
433 	generic_vh_stop,
434 	galaga_vh_screenrefresh,
435 
436 	/* sound hardware */
437 	0,0,0,0,
438 	{
439 		{
440 			SOUND_NAMCO,
441 			&namco_interface
442 		},
443 		{
444 			SOUND_SAMPLES,
445 			&samples_interface
446 		}
447 	}
448 };
449 
450 
451 
452 /***************************************************************************
453 
454   Game driver(s)
455 
456 ***************************************************************************/
457 
458 ROM_START( galaga )
459 	ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
460 	ROM_LOAD( "04m_g01.bin",  0x0000, 0x1000, 0xa3a0f743 )
461 	ROM_LOAD( "04k_g02.bin",  0x1000, 0x1000, 0x43bb0d5c )
462 	ROM_LOAD( "04j_g03.bin",  0x2000, 0x1000, 0x753ce503 )
463 	ROM_LOAD( "04h_g04.bin",  0x3000, 0x1000, 0x83874442 )
464 
465 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
466 	ROM_LOAD( "04e_g05.bin",  0x0000, 0x1000, 0x3102fccd )
467 
468 	ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
469 	ROM_LOAD( "04d_g06.bin",  0x0000, 0x1000, 0x8995088d )
470 
471 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
472 	ROM_LOAD( "07m_g08.bin",  0x0000, 0x1000, 0x58b2f47c )
473 
474 	ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
475 	ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
476 	ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
477 
478 	ROM_REGION( 0x0320, REGION_PROMS )
479 	ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )	/* palette */
480 	ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )	/* char lookup table */
481 	ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )	/* sprite lookup table */
482 	ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )	/* unknown */
483 
484 	ROM_REGION( 0x0100, REGION_SOUND1 )	/* sound prom */
485 	ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
486 ROM_END
487 
488 ROM_START( galagamw )
489 	ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
490 	ROM_LOAD( "3200a.bin",    0x0000, 0x1000, 0x3ef0b053 )
491 	ROM_LOAD( "3300b.bin",    0x1000, 0x1000, 0x1b280831 )
492 	ROM_LOAD( "3400c.bin",    0x2000, 0x1000, 0x16233d33 )
493 	ROM_LOAD( "3500d.bin",    0x3000, 0x1000, 0x0aaf5c23 )
494 
495 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
496 	ROM_LOAD( "3600e.bin",    0x0000, 0x1000, 0xbc556e76 )
497 
498 	ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
499 	ROM_LOAD( "3700g.bin",    0x0000, 0x1000, 0xb07f0aa4 )
500 
501 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
502 	ROM_LOAD( "07m_g08.bin",  0x0000, 0x1000, 0x58b2f47c )
503 
504 	ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
505 	ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
506 	ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
507 
508 	ROM_REGION( 0x0320, REGION_PROMS )
509 	ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )	/* palette */
510 	ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )	/* char lookup table */
511 	ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )	/* sprite lookup table */
512 	ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )	/* unknown */
513 
514 	ROM_REGION( 0x0100, REGION_SOUND1 )	/* sound prom */
515 	ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
516 ROM_END
517 
518 ROM_START( galagads )
519 	ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
520 	ROM_LOAD( "3200a.bin",    0x0000, 0x1000, 0x3ef0b053 )
521 	ROM_LOAD( "3300b.bin",    0x1000, 0x1000, 0x1b280831 )
522 	ROM_LOAD( "3400c.bin",    0x2000, 0x1000, 0x16233d33 )
523 	ROM_LOAD( "3500d.bin",    0x3000, 0x1000, 0x0aaf5c23 )
524 
525 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
526 	ROM_LOAD( "3600fast.bin", 0x0000, 0x1000, 0x23d586e5 )
527 
528 	ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
529 	ROM_LOAD( "3700g.bin",    0x0000, 0x1000, 0xb07f0aa4 )
530 
531 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
532 	ROM_LOAD( "07m_g08.bin",  0x0000, 0x1000, 0x58b2f47c )
533 
534 	ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
535 	ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
536 	ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
537 
538 	ROM_REGION( 0x0320, REGION_PROMS )
539 	ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )	/* palette */
540 	ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )	/* char lookup table */
541 	ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )	/* sprite lookup table */
542 	ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )	/* unknown */
543 
544 	ROM_REGION( 0x0100, REGION_SOUND1 )	/* sound prom */
545 	ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
546 ROM_END
547 
548 ROM_START( gallag )
549 	ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
550 	ROM_LOAD( "04m_g01.bin",  0x0000, 0x1000, 0xa3a0f743 )
551 	ROM_LOAD( "gallag.2",     0x1000, 0x1000, 0x5eda60a7 )
552 	ROM_LOAD( "04j_g03.bin",  0x2000, 0x1000, 0x753ce503 )
553 	ROM_LOAD( "04h_g04.bin",  0x3000, 0x1000, 0x83874442 )
554 
555 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
556 	ROM_LOAD( "04e_g05.bin",  0x0000, 0x1000, 0x3102fccd )
557 
558 	ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
559 	ROM_LOAD( "04d_g06.bin",  0x0000, 0x1000, 0x8995088d )
560 
561 	ROM_REGION( 0x10000, REGION_CPU4 )	/* 64k for a Z80 which emulates the custom I/O chip (not used) */
562 	ROM_LOAD( "gallag.6",     0x0000, 0x1000, 0x001b70bc )
563 
564 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
565 	ROM_LOAD( "gallag.8",     0x0000, 0x1000, 0x169a98a4 )
566 
567 	ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
568 	ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
569 	ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
570 
571 	ROM_REGION( 0x0320, REGION_PROMS )
572 	ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )	/* palette */
573 	ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )	/* char lookup table */
574 	ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )	/* sprite lookup table */
575 	ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )	/* unknown */
576 
577 	ROM_REGION( 0x0100, REGION_SOUND1 )	/* sound prom */
578 	ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
579 ROM_END
580 
581 ROM_START( galagab2 )
582 	ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
583 	ROM_LOAD( "g1",           0x0000, 0x1000, 0xab036c9f )
584 	ROM_LOAD( "g2",           0x1000, 0x1000, 0xd9232240 )
585 	ROM_LOAD( "04j_g03.bin",  0x2000, 0x1000, 0x753ce503 )
586 	ROM_LOAD( "g4",           0x3000, 0x1000, 0x499fcc76 )
587 
588 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
589 	ROM_LOAD( "04e_g05.bin",  0x0000, 0x1000, 0x3102fccd )
590 
591 	ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
592 	ROM_LOAD( "04d_g06.bin",  0x0000, 0x1000, 0x8995088d )
593 
594 	ROM_REGION( 0x10000, REGION_CPU4 )	/* 64k for a Z80 which emulates the custom I/O chip (not used) */
595 	ROM_LOAD( "10h_g07.bin",  0x0000, 0x1000, 0x035e300c )
596 
597 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
598 	ROM_LOAD( "gallag.8",     0x0000, 0x1000, 0x169a98a4 )
599 
600 	ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
601 	ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
602 	ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
603 
604 	ROM_REGION( 0x0320, REGION_PROMS )
605 	ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )	/* palette */
606 	ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )	/* char lookup table */
607 	ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )	/* sprite lookup table */
608 	ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )	/* unknown */
609 
610 	ROM_REGION( 0x0100, REGION_SOUND1 )	/* sound prom */
611 	ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
612 ROM_END
613 
614 ROM_START( galaga84 )
615 	ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
616 	ROM_LOAD( "g1",           0x0000, 0x1000, 0xab036c9f )
617 	ROM_LOAD( "gal84_u2",     0x1000, 0x1000, 0x4d832a30 )
618 	ROM_LOAD( "04j_g03.bin",  0x2000, 0x1000, 0x753ce503 )
619 	ROM_LOAD( "g4",           0x3000, 0x1000, 0x499fcc76 )
620 
621 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
622 	ROM_LOAD( "gal84_u5",     0x0000, 0x1000, 0xbb5caae3 )
623 
624 	ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
625 	ROM_LOAD( "04d_g06.bin",  0x0000, 0x1000, 0x8995088d )
626 
627 	ROM_REGION( 0x10000, REGION_CPU4 )	/* 64k for a Z80 which emulates the custom I/O chip (not used) */
628 	ROM_LOAD( "10h_g07.bin",  0x0000, 0x1000, 0x035e300c )
629 
630 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
631 	ROM_LOAD( "07m_g08.bin",  0x0000, 0x1000, 0x58b2f47c )
632 
633 	ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
634 	ROM_LOAD( "gal84u4d",     0x0000, 0x1000, 0x22e339d5 )
635 	ROM_LOAD( "gal84u4e",     0x1000, 0x1000, 0x60dcf940 )
636 
637 	ROM_REGION( 0x0320, REGION_PROMS )
638 	ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )	/* palette */
639 	ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )	/* char lookup table */
640 	ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )	/* sprite lookup table */
641 	ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )	/* unknown */
642 
643 	ROM_REGION( 0x0100, REGION_SOUND1 )	/* sound prom */
644 	ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
645 ROM_END
646 
647 ROM_START( nebulbee )
648 	ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
649 	ROM_LOAD( "nebulbee.01",  0x0000, 0x1000, 0xf405f2c4 )
650 	ROM_LOAD( "nebulbee.02",  0x1000, 0x1000, 0x31022b60 )
651 	ROM_LOAD( "04j_g03.bin",  0x2000, 0x1000, 0x753ce503 )
652 	ROM_LOAD( "nebulbee.04",  0x3000, 0x1000, 0xd76788a5 )
653 
654 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
655 	ROM_LOAD( "04e_g05.bin",  0x0000, 0x1000, 0x3102fccd )
656 
657 	ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
658 	ROM_LOAD( "04d_g06.bin",  0x0000, 0x1000, 0x8995088d )
659 
660 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
661 	ROM_LOAD( "07m_g08.bin",  0x0000, 0x1000, 0x58b2f47c )
662 
663 	ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
664 	ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
665 	ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
666 
667 	ROM_REGION( 0x0320, REGION_PROMS )
668 	ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )	/* palette */
669 	ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )	/* char lookup table */
670 	ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )	/* sprite lookup table */
671 	ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )	/* unknown */
672 
673 	ROM_REGION( 0x0100, REGION_SOUND1 )	/* sound prom */
674 	ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
675 ROM_END
676 
677 
678 
679 GAME( 1981, galaga,   0,      galaga, galaganm, 0, ROT90, "Namco", "Galaga (Namco)" )
680 GAME( 1981, galagamw, galaga, galaga, galaga,   0, ROT90, "[Namco] (Midway license)", "Galaga (Midway)" )
681 GAME( 1981, galagads, galaga, galaga, galaga,   0, ROT90, "hack", "Galaga (fast shoot)" )
682 GAME( 1982, gallag,   galaga, galaga, galaganm, 0, ROT90, "bootleg", "Gallag" )
683 GAME( 1981, galagab2, galaga, galaga, galaganm, 0, ROT90, "bootleg", "Galaga (bootleg)" )
684 GAME( 1984, galaga84, galaga, galaga, galaganm, 0, ROT90, "hack", "Galaga '84" )
685 GAME( 1984, nebulbee, galaga, galaga, galaganm, 0, ROT90, "hack", "Nebulous Bee" )
686