1 /***************************************************************************
2 
3 Gyruss memory map (preliminary)
4 
5 Main processor memory map.
6 0000-5fff ROM (6000-7fff diagnostics)
7 8000-83ff Color RAM
8 8400-87ff Video RAM
9 9000-a7ff RAM
10 a000-a17f \ sprites
11 a200-a27f /
12 
13 memory mapped ports:
14 
15 read:
16 c080      IN0
17 c0a0      IN1
18 c0c0      IN2
19 c0e0      DSW0
20 c000      DSW1
21 c100      DSW2
22 
23 write:
24 a000-a1ff  Odd frame spriteram
25 a200-a3ff  Even frame spriteram
26 a700       Frame odd or even?
27 a701       Semaphore system:  tells 6809 to draw queued sprites
28 a702       Semaphore system:  tells 6809 to queue sprites
29 c000       watchdog reset
30 c080       trigger interrupt on audio CPU
31 c100       command for the audio CPU
32 c180       interrupt enable
33 c185       flip screen
34 
35 interrupts:
36 standard NMI at 0x66
37 
38 
39 SOUND BOARD:
40 0000-3fff  Audio ROM (4000-5fff diagnostics)
41 6000-63ff  Audio RAM
42 8000       Read Sound Command
43 
44 I/O:
45 
46 Gyruss has 5 PSGs:
47 1)  Control: 0x00    Read: 0x01    Write: 0x02
48 2)  Control: 0x04    Read: 0x05    Write: 0x06
49 3)  Control: 0x08    Read: 0x09    Write: 0x0a
50 4)  Control: 0x0c    Read: 0x0d    Write: 0x0e
51 5)  Control: 0x10    Read: 0x11    Write: 0x12
52 
53 and 1 SFX channel controlled by an 8039:
54 1)  SoundOn: 0x14    SoundData: 0x18
55 
56 ***************************************************************************/
57 
58 #include "driver.h"
59 #include "vidhrdw/generic.h"
60 #include "cpu/i8039/i8039.h"
61 
62 
63 void konami1_decode_cpu2(void);
64 
65 WRITE_HANDLER( gyruss_flipscreen_w );
66 READ_HANDLER( gyruss_scanline_r );
67 VIDEO_START( gyruss );
68 PALETTE_INIT( gyruss );
69 VIDEO_UPDATE( gyruss );
70 INTERRUPT_GEN( gyruss_6809_interrupt );
71 
72 
73 READ_HANDLER( gyruss_portA_r );
74 WRITE_HANDLER( gyruss_filter0_w );
75 WRITE_HANDLER( gyruss_filter1_w );
76 WRITE_HANDLER( gyruss_sh_irqtrigger_w );
77 WRITE_HANDLER( gyruss_i8039_irq_w );
78 
79 
80 unsigned char *gyruss_sharedram;
81 
READ_HANDLER(gyruss_sharedram_r)82 READ_HANDLER( gyruss_sharedram_r )
83 {
84 	return gyruss_sharedram[offset];
85 }
86 
WRITE_HANDLER(gyruss_sharedram_w)87 WRITE_HANDLER( gyruss_sharedram_w )
88 {
89 	gyruss_sharedram[offset] = data;
90 }
91 
92 
93 
MEMORY_READ_START(readmem)94 static MEMORY_READ_START( readmem )
95 	{ 0x0000, 0x7fff, MRA_ROM },
96 	{ 0x8000, 0x87ff, MRA_RAM },
97 	{ 0x9000, 0x9fff, MRA_RAM },
98 	{ 0xa000, 0xa7ff, gyruss_sharedram_r },
99 	{ 0xc000, 0xc000, input_port_4_r },	/* DSW1 */
100 	{ 0xc080, 0xc080, input_port_0_r },	/* IN0 */
101 	{ 0xc0a0, 0xc0a0, input_port_1_r },	/* IN1 */
102 	{ 0xc0c0, 0xc0c0, input_port_2_r },	/* IN2 */
103 	{ 0xc0e0, 0xc0e0, input_port_3_r },	/* DSW0 */
104 	{ 0xc100, 0xc100, input_port_5_r },	/* DSW2 */
105 MEMORY_END
106 
107 static MEMORY_WRITE_START( writemem )
108 	{ 0x0000, 0x7fff, MWA_ROM },                 /* rom space+1        */
109 	{ 0x8000, 0x83ff, colorram_w, &colorram },
110 	{ 0x8400, 0x87ff, videoram_w, &videoram, &videoram_size },
111 	{ 0x9000, 0x9fff, MWA_RAM },
112 	{ 0xa000, 0xa7ff, gyruss_sharedram_w, &gyruss_sharedram },
113 	{ 0xc000, 0xc000, MWA_NOP },	/* watchdog reset */
114 	{ 0xc080, 0xc080, gyruss_sh_irqtrigger_w },
115 	{ 0xc100, 0xc100, soundlatch_w },         /* command to soundb  */
116 	{ 0xc180, 0xc180, interrupt_enable_w },      /* NMI enable         */
117 	{ 0xc185, 0xc185, gyruss_flipscreen_w },
118 MEMORY_END
119 
120 static MEMORY_READ_START( m6809_readmem )
121 	{ 0x0000, 0x0000, gyruss_scanline_r },
122 	{ 0x4000, 0x47ff, MRA_RAM },
123 	{ 0x6000, 0x67ff, gyruss_sharedram_r },
124 	{ 0xe000, 0xffff, MRA_ROM },
125 MEMORY_END
126 
127 static MEMORY_WRITE_START( m6809_writemem )
128 	{ 0x2000, 0x2000, interrupt_enable_w },
129 	{ 0x4000, 0x47ff, MWA_RAM },
130 	{ 0x4040, 0x40ff, MWA_RAM, &spriteram, &spriteram_size },
131 	{ 0x6000, 0x67ff, gyruss_sharedram_w },
132 	{ 0xe000, 0xffff, MWA_ROM },
133 MEMORY_END
134 
135 static MEMORY_READ_START( sound_readmem )
136 	{ 0x0000, 0x5fff, MRA_ROM },                 /* rom soundboard     */
137 	{ 0x6000, 0x63ff, MRA_RAM },                 /* ram soundboard     */
138 	{ 0x8000, 0x8000, soundlatch_r },
139 MEMORY_END
140 
141 static MEMORY_WRITE_START( sound_writemem )
142 	{ 0x0000, 0x5fff, MWA_ROM },                 /* rom soundboard     */
143 	{ 0x6000, 0x63ff, MWA_RAM },                 /* ram soundboard     */
144 MEMORY_END
145 
146 static PORT_READ_START( sound_readport )
147 	{ 0x01, 0x01, AY8910_read_port_0_r },
148   	{ 0x05, 0x05, AY8910_read_port_1_r },
149 	{ 0x09, 0x09, AY8910_read_port_2_r },
150   	{ 0x0d, 0x0d, AY8910_read_port_3_r },
151   	{ 0x11, 0x11, AY8910_read_port_4_r },
152 PORT_END
153 
154 static PORT_WRITE_START( sound_writeport )
155 	{ 0x00, 0x00, AY8910_control_port_0_w },
156 	{ 0x02, 0x02, AY8910_write_port_0_w },
157 	{ 0x04, 0x04, AY8910_control_port_1_w },
158 	{ 0x06, 0x06, AY8910_write_port_1_w },
159 	{ 0x08, 0x08, AY8910_control_port_2_w },
160 	{ 0x0a, 0x0a, AY8910_write_port_2_w },
161 	{ 0x0c, 0x0c, AY8910_control_port_3_w },
162 	{ 0x0e, 0x0e, AY8910_write_port_3_w },
163 	{ 0x10, 0x10, AY8910_control_port_4_w },
164 	{ 0x12, 0x12, AY8910_write_port_4_w },
165 	{ 0x14, 0x14, gyruss_i8039_irq_w },
166 	{ 0x18, 0x18, soundlatch2_w },
167 PORT_END
168 
169 static MEMORY_READ_START( i8039_readmem )
170 	{ 0x0000, 0x0fff, MRA_ROM },
171 MEMORY_END
172 
173 static MEMORY_WRITE_START( i8039_writemem )
174 	{ 0x0000, 0x0fff, MWA_ROM },
175 MEMORY_END
176 
177 static PORT_READ_START( i8039_readport )
178 	{ 0x00, 0xff, soundlatch2_r },
179 PORT_END
180 
181 static PORT_WRITE_START( i8039_writeport )
182 	{ I8039_p1, I8039_p1, DAC_0_data_w },
183 	{ I8039_p2, I8039_p2, IOWP_NOP },
184 PORT_END
185 
186 
187 
188 INPUT_PORTS_START( gyruss )
189 	PORT_START	/* IN0 */
190 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
191 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
192 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
193 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
194 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
195 	PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
196 
197 	PORT_START	/* IN1 */
198 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
199 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
200 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY )
201 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY )
202 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
203 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* 1p shoot 2 - unused */
204 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* 2p shoot 3 - unused */
205 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
206 
207 	PORT_START	/* IN2 */
208 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
209 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
210 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY | IPF_COCKTAIL )
211 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY | IPF_COCKTAIL )
212 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
213 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* 2p shoot 2 - unused */
214 	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
215 
216 	PORT_START	/* DSW0 */
217 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
218 	PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
219 	PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
220 	PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
221 	PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
222 	PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
223 	PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
224 	PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
225 	PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
226 	PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
227 	PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
228 	PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
229 	PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
230 	PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
231 	PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
232 	PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
233 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
234 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
235 	PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
236 	PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
237 	PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
238 	PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
239 	PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
240 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
241 	PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
242 	PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
243 	PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
244 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
245 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
246 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
247 	PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
248 	PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
249 	PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
250 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
251 
252 	PORT_START	/* DSW1 */
253 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
254 	PORT_DIPSETTING(    0x03, "3" )
255 	PORT_DIPSETTING(    0x02, "4" )
256 	PORT_DIPSETTING(    0x01, "5" )
257 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "255", IP_KEY_NONE, IP_JOY_NONE )
258 	PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
259 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
260 	PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
261 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) )
262 	PORT_DIPSETTING(    0x08, "30000 60000" )
263 	PORT_DIPSETTING(    0x00, "40000 70000" )
264 	PORT_DIPNAME( 0x70, 0x70, DEF_STR( Difficulty ) )
265 	PORT_DIPSETTING(    0x70, "1 (Easiest)" )
266 	PORT_DIPSETTING(    0x60, "2" )
267 	PORT_DIPSETTING(    0x50, "3" )
268 	PORT_DIPSETTING(    0x40, "4" )
269 	PORT_DIPSETTING(    0x30, "5 (Average)" )
270 	PORT_DIPSETTING(    0x20, "6" )
271 	PORT_DIPSETTING(    0x10, "7" )
272 	PORT_DIPSETTING(    0x00, "8 (Hardest)" )
273 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
274 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
275 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
276 
277 	PORT_START	/* DSW2 */
278 	PORT_DIPNAME( 0x01, 0x00, "Demo Music" )
279 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
280 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
281 	/* other bits probably unused */
282 INPUT_PORTS_END
283 
284 /* This is identical to gyruss except for the bonus that has different
285    values */
286 INPUT_PORTS_START( gyrussce )
287 	PORT_START	/* IN0 */
288 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
289 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
290 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
291 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
292 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
293 	PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
294 
295 	PORT_START	/* IN1 */
296 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
297 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
298 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY )
299 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY )
300 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
301 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* 1p shoot 2 - unused */
302 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* 2p shoot 3 - unused */
303 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
304 
305 	PORT_START	/* IN2 */
306 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
307 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
308 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY | IPF_COCKTAIL )
309 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY | IPF_COCKTAIL )
310 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
311 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* 2p shoot 2 - unused */
312 	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
313 
314 	PORT_START	/* DSW0 */
315 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
316 	PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
317 	PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
318 	PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
319 	PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
320 	PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
321 	PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
322 	PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
323 	PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
324 	PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
325 	PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
326 	PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
327 	PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
328 	PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
329 	PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
330 	PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
331 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
332 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
333 	PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
334 	PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
335 	PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
336 	PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
337 	PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
338 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
339 	PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
340 	PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
341 	PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
342 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
343 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
344 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
345 	PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
346 	PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
347 	PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
348 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
349 
350 	PORT_START	/* DSW1 */
351 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
352 	PORT_DIPSETTING(    0x03, "3" )
353 	PORT_DIPSETTING(    0x02, "4" )
354 	PORT_DIPSETTING(    0x01, "5" )
355 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "255", IP_KEY_NONE, IP_JOY_NONE )
356 	PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
357 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
358 	PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
359 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) )
360 	PORT_DIPSETTING(    0x08, "50000 70000" )
361 	PORT_DIPSETTING(    0x00, "60000 80000" )
362 	PORT_DIPNAME( 0x70, 0x70, DEF_STR( Difficulty ) )
363 	PORT_DIPSETTING(    0x70, "1 (Easiest)" )
364 	PORT_DIPSETTING(    0x60, "2" )
365 	PORT_DIPSETTING(    0x50, "3" )
366 	PORT_DIPSETTING(    0x40, "4" )
367 	PORT_DIPSETTING(    0x30, "5 (Average)" )
368 	PORT_DIPSETTING(    0x20, "6" )
369 	PORT_DIPSETTING(    0x10, "7" )
370 	PORT_DIPSETTING(    0x00, "8 (Hardest)" )
371 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
372 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
373 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
374 
375 	PORT_START	/* DSW2 */
376 	PORT_DIPNAME( 0x01, 0x00, "Demo Music" )
377 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
378 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
379 	/* other bits probably unused */
380 INPUT_PORTS_END
381 
382 
383 static struct GfxLayout charlayout =
384 {
385 	8,8,	/* 8*8 characters */
386 	512,	/* 512 characters */
387 	2,	/* 2 bits per pixel */
388 	{ 4, 0 },
389 	{ 0, 1, 2, 3, 8*8+0,8*8+1,8*8+2,8*8+3 },
390 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
391 	16*8	/* every char takes 16 consecutive bytes */
392 };
393 static struct GfxLayout spritelayout =
394 {
395 	8,16,	/* 8*16 sprites */
396 	256,	/* 256 sprites */
397 	4,	/* 4 bits per pixel */
398 	{ 0x4000*8+4, 0x4000*8+0, 4, 0  },
399 	{ 0, 1, 2, 3,  8*8, 8*8+1, 8*8+2, 8*8+3 },
400 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
401 			32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
402 	64*8	/* every sprite takes 64 consecutive bytes */
403 };
404 
405 
406 
407 static struct GfxDecodeInfo gfxdecodeinfo[] =
408 {
409 	{ REGION_GFX1, 0x0000, &charlayout,      0, 16 },
410 	{ REGION_GFX2, 0x0000, &spritelayout, 16*4, 16 },	/* upper half */
411 	{ REGION_GFX2, 0x0010, &spritelayout, 16*4, 16 },	/* lower half */
412 	{ -1 } /* end of array */
413 };
414 
415 
416 
417 static struct AY8910interface ay8910_interface =
418 {
419 	5,	/* 5 chips */
420 	14318180/8,	/* 1.789772727 MHz */
421 	{ MIXERG(10,MIXER_GAIN_4x,MIXER_PAN_RIGHT), MIXERG(10,MIXER_GAIN_4x,MIXER_PAN_LEFT),
422 			MIXERG(20,MIXER_GAIN_4x,MIXER_PAN_RIGHT), MIXERG(20,MIXER_GAIN_4x,MIXER_PAN_RIGHT), MIXERG(20,MIXER_GAIN_4x,MIXER_PAN_LEFT) },
423 	/*  R       L   |   R       R       L */
424 	/*   effects    |         music       */
425 	{ 0, 0, gyruss_portA_r },
426 	{ 0 },
427 	{ 0 },
428 	{ gyruss_filter0_w, gyruss_filter1_w }
429 };
430 
431 static struct DACinterface dac_interface =
432 {
433 	1,
434 	{ MIXER(50,MIXER_PAN_LEFT) }
435 };
436 
437 
438 
439 static MACHINE_DRIVER_START( gyruss )
440 
441 	/* basic machine hardware */
442 	MDRV_CPU_ADD(Z80, 3072000)	/* 3.072 MHz (?) */
MDRV_CPU_MEMORY(readmem,writemem)443 	MDRV_CPU_MEMORY(readmem,writemem)
444 	MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
445 
446 	MDRV_CPU_ADD(M6809, 2000000)        /* 2 MHz ??? */
447 	MDRV_CPU_MEMORY(m6809_readmem,m6809_writemem)
448 	MDRV_CPU_VBLANK_INT(gyruss_6809_interrupt,256)
449 
450 	MDRV_CPU_ADD(Z80,14318180/4)
451 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)	/* 3.579545 MHz */
452 	MDRV_CPU_MEMORY(sound_readmem,sound_writemem)
453 	MDRV_CPU_PORTS(sound_readport,sound_writeport)
454 
455 	MDRV_CPU_ADD(I8039,8000000/15)
456 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)	/* 8MHz crystal */
457 	MDRV_CPU_MEMORY(i8039_readmem,i8039_writemem)
458 	MDRV_CPU_PORTS(i8039_readport,i8039_writeport)
459 
460 	MDRV_FRAMES_PER_SECOND(60)
461 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
462 
463 	/* video hardware */
464 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
465 	MDRV_SCREEN_SIZE(32*8, 32*8)
466 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
467 	MDRV_GFXDECODE(gfxdecodeinfo)
468 	MDRV_PALETTE_LENGTH(32)
469 	MDRV_COLORTABLE_LENGTH(16*4+16*16)
470 
471 	MDRV_PALETTE_INIT(gyruss)
472 	MDRV_VIDEO_START(gyruss)
473 	MDRV_VIDEO_UPDATE(gyruss)
474 
475 	/* sound hardware */
476 	MDRV_SOUND_ATTRIBUTES(SOUND_SUPPORTS_STEREO)
477 	MDRV_SOUND_ADD(AY8910, ay8910_interface)
478 	MDRV_SOUND_ADD(DAC, dac_interface)
479 MACHINE_DRIVER_END
480 
481 
482 
483 /***************************************************************************
484 
485   Game driver(s)
486 
487 ***************************************************************************/
488 
489 ROM_START( gyruss )
490 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
491 	ROM_LOAD( "gyrussk.1",    0x0000, 0x2000, CRC(c673b43d) SHA1(7c464fb154bac35dd6e2f547e157addeb8798194) )
492 	ROM_LOAD( "gyrussk.2",    0x2000, 0x2000, CRC(a4ec03e4) SHA1(08c33ad7fcc2ad5e5787a1050284e3f8164f4618) )
493 	ROM_LOAD( "gyrussk.3",    0x4000, 0x2000, CRC(27454a98) SHA1(030c7df225652ee20d5ef64d005eb011dc89a27d) )
494 	/* the diagnostics ROM would go here */
495 
496 	ROM_REGION( 2*0x10000, REGION_CPU2, 0 )	/* 64k for code + 64k for the decrypted opcodes */
497 	ROM_LOAD( "gyrussk.9",    0xe000, 0x2000, CRC(822bf27e) SHA1(36d5bea2392a7d3476dd797dc05602705cfa23ef) )
498 
499 	ROM_REGION( 0x10000, REGION_CPU3, 0 )	/* 64k for the audio CPU */
500 	ROM_LOAD( "gyrussk.1a",   0x0000, 0x2000, CRC(f4ae1c17) SHA1(ae568c96a31d910afe30d2b7eeb9ed1ed07290e3) )
501 	ROM_LOAD( "gyrussk.2a",   0x2000, 0x2000, CRC(ba498115) SHA1(9cd1f42898cc590f39ba7cb3c975b0b3d3062eba) )
502 	/* the diagnostics ROM would go here */
503 
504 	ROM_REGION( 0x1000, REGION_CPU4, 0 )	/* 8039 */
505 	ROM_LOAD( "gyrussk.3a",   0x0000, 0x1000, CRC(3f9b5dea) SHA1(6e807da02c2885b18e8cc2199f12f6be9040bf75) )
506 
507 	ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
508 	ROM_LOAD( "gyrussk.4",    0x0000, 0x2000, CRC(27d8329b) SHA1(564ff945465a23d93a93137ad277298770dfa06a) )
509 
510 	ROM_REGION( 0x8000, REGION_GFX2, ROMREGION_DISPOSE )
511 	ROM_LOAD( "gyrussk.6",    0x0000, 0x2000, CRC(c949db10) SHA1(fcb8bcbd2bdd751fecb322a33c8a92fb6f07a7ab) )
512 	ROM_LOAD( "gyrussk.5",    0x2000, 0x2000, CRC(4f22411a) SHA1(763bcd039f8c1838a0d7da7d4dadc14a26e25596) )
513 	ROM_LOAD( "gyrussk.8",    0x4000, 0x2000, CRC(47cd1fbc) SHA1(8203c4ff0b1cd7b4dbc708e300bfeac1e7366e09) )
514 	ROM_LOAD( "gyrussk.7",    0x6000, 0x2000, CRC(8e8d388c) SHA1(8f2928d71c02aba977d67575d6e34d69bda2b9d4) )
515 
516 	ROM_REGION( 0x0220, REGION_PROMS, 0 )
517 	ROM_LOAD( "gyrussk.pr3",  0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) )	/* palette */
518 	ROM_LOAD( "gyrussk.pr1",  0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) )	/* sprite lookup table */
519 	ROM_LOAD( "gyrussk.pr2",  0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) )	/* character lookup table */
520 ROM_END
521 
522 ROM_START( gyrussce )
523 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
524 	ROM_LOAD( "gya-1.bin",    0x0000, 0x2000, CRC(85f8b7c2) SHA1(5dde696b53efedee671d500feae1d314e95b1c96) )
525 	ROM_LOAD( "gya-2.bin",    0x2000, 0x2000, CRC(1e1a970f) SHA1(5a2e391489608f7571bbb4f85549a79795e2177e) )
526 	ROM_LOAD( "gya-3.bin",    0x4000, 0x2000, CRC(f6dbb33b) SHA1(19cab8e7f2f2358b6271ab402f132654e8be95d4) )
527 	/* the diagnostics ROM would go here */
528 
529 	ROM_REGION( 2*0x10000, REGION_CPU2, 0 )	/* 64k for code + 64k for the decrypted opcodes */
530 	ROM_LOAD( "gyrussk.9",    0xe000, 0x2000, CRC(822bf27e) SHA1(36d5bea2392a7d3476dd797dc05602705cfa23ef) )
531 
532 	ROM_REGION( 0x10000, REGION_CPU3, 0 )	/* 64k for the audio CPU */
533 	ROM_LOAD( "gyrussk.1a",   0x0000, 0x2000, CRC(f4ae1c17) SHA1(ae568c96a31d910afe30d2b7eeb9ed1ed07290e3) )
534 	ROM_LOAD( "gyrussk.2a",   0x2000, 0x2000, CRC(ba498115) SHA1(9cd1f42898cc590f39ba7cb3c975b0b3d3062eba) )
535 	/* the diagnostics ROM would go here */
536 
537 	ROM_REGION( 0x1000, REGION_CPU4, 0 )	/* 8039 */
538 	ROM_LOAD( "gyrussk.3a",   0x0000, 0x1000, CRC(3f9b5dea) SHA1(6e807da02c2885b18e8cc2199f12f6be9040bf75) )
539 
540 	ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
541 	ROM_LOAD( "gyrussk.4",    0x0000, 0x2000, CRC(27d8329b) SHA1(564ff945465a23d93a93137ad277298770dfa06a) )
542 
543 	ROM_REGION( 0x8000, REGION_GFX2, ROMREGION_DISPOSE )
544 	ROM_LOAD( "gyrussk.6",    0x0000, 0x2000, CRC(c949db10) SHA1(fcb8bcbd2bdd751fecb322a33c8a92fb6f07a7ab) )
545 	ROM_LOAD( "gyrussk.5",    0x2000, 0x2000, CRC(4f22411a) SHA1(763bcd039f8c1838a0d7da7d4dadc14a26e25596) )
546 	ROM_LOAD( "gyrussk.8",    0x4000, 0x2000, CRC(47cd1fbc) SHA1(8203c4ff0b1cd7b4dbc708e300bfeac1e7366e09) )
547 	ROM_LOAD( "gyrussk.7",    0x6000, 0x2000, CRC(8e8d388c) SHA1(8f2928d71c02aba977d67575d6e34d69bda2b9d4) )
548 
549 	ROM_REGION( 0x0220, REGION_PROMS, 0 )
550 	ROM_LOAD( "gyrussk.pr3",  0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) )	/* palette */
551 	ROM_LOAD( "gyrussk.pr1",  0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) )	/* sprite lookup table */
552 	ROM_LOAD( "gyrussk.pr2",  0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) )	/* character lookup table */
553 ROM_END
554 
555 ROM_START( venus )
556 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
557 	ROM_LOAD( "r1",           0x0000, 0x2000, CRC(d030abb1) SHA1(14a70e15f5df9ef957779771d8915203d3828532) )
558 	ROM_LOAD( "r2",           0x2000, 0x2000, CRC(dbf65d4d) SHA1(a0ad0dc3420442f06691bda2115fadd961ce86a7) )
559 	ROM_LOAD( "r3",           0x4000, 0x2000, CRC(db246fcd) SHA1(c0228b35591c9e1c778370a2abd3739c441f14aa) )
560 	/* the diagnostics ROM would go here */
561 
562 	ROM_REGION( 2*0x10000, REGION_CPU2, 0 )	/* 64k for code + 64k for the decrypted opcodes */
563 	ROM_LOAD( "gyrussk.9",    0xe000, 0x2000, CRC(822bf27e) SHA1(36d5bea2392a7d3476dd797dc05602705cfa23ef) )
564 
565 	ROM_REGION( 0x10000, REGION_CPU3, 0 )	/* 64k for the audio CPU */
566 	ROM_LOAD( "gyrussk.1a",   0x0000, 0x2000, CRC(f4ae1c17) SHA1(ae568c96a31d910afe30d2b7eeb9ed1ed07290e3) )
567 	ROM_LOAD( "gyrussk.2a",   0x2000, 0x2000, CRC(ba498115) SHA1(9cd1f42898cc590f39ba7cb3c975b0b3d3062eba) )
568 	/* the diagnostics ROM would go here */
569 
570 	ROM_REGION( 0x1000, REGION_CPU4, 0 )	/* 8039 */
571 	ROM_LOAD( "gyrussk.3a",   0x0000, 0x1000, CRC(3f9b5dea) SHA1(6e807da02c2885b18e8cc2199f12f6be9040bf75) )
572 
573 	ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
574 	ROM_LOAD( "gyrussk.4",    0x0000, 0x2000, CRC(27d8329b) SHA1(564ff945465a23d93a93137ad277298770dfa06a) )
575 
576 	ROM_REGION( 0x8000, REGION_GFX2, ROMREGION_DISPOSE )
577 	ROM_LOAD( "gyrussk.6",    0x0000, 0x2000, CRC(c949db10) SHA1(fcb8bcbd2bdd751fecb322a33c8a92fb6f07a7ab) )
578 	ROM_LOAD( "gyrussk.5",    0x2000, 0x2000, CRC(4f22411a) SHA1(763bcd039f8c1838a0d7da7d4dadc14a26e25596) )
579 	ROM_LOAD( "gyrussk.8",    0x4000, 0x2000, CRC(47cd1fbc) SHA1(8203c4ff0b1cd7b4dbc708e300bfeac1e7366e09) )
580 	ROM_LOAD( "gyrussk.7",    0x6000, 0x2000, CRC(8e8d388c) SHA1(8f2928d71c02aba977d67575d6e34d69bda2b9d4) )
581 
582 	ROM_REGION( 0x0220, REGION_PROMS, 0 )
583 	ROM_LOAD( "gyrussk.pr3",  0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) )	/* palette */
584 	ROM_LOAD( "gyrussk.pr1",  0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) )	/* sprite lookup table */
585 	ROM_LOAD( "gyrussk.pr2",  0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) )	/* character lookup table */
586 ROM_END
587 
588 
589 static DRIVER_INIT( gyruss )
590 {
591 	konami1_decode_cpu2();
592 }
593 
594 
595 GAME( 1983, gyruss,   0,      gyruss, gyruss,   gyruss, ROT90, "Konami", "Gyruss (Konami)" )
596 GAME( 1983, gyrussce, gyruss, gyruss, gyrussce, gyruss, ROT90, "Konami (Centuri license)", "Gyruss (Centuri)" )
597 GAME( 1983, venus,    gyruss, gyruss, gyrussce, gyruss, ROT90, "bootleg", "Venus" )
598