1 /***************************************************************************
2 
3 Irem Red Alert Driver
4 
5 Everything in this driver is guesswork and speculation.  If something
6 seems wrong, it probably is.
7 
8 If you have any questions about how this driver works, don't hesitate to
9 ask.  - Mike Balfour (mab22@po.cwru.edu)
10 ***************************************************************************/
11 
12 #include "driver.h"
13 #include "vidhrdw/generic.h"
14 #include "machine/6821pia.h"
15 
16 /* vidhrdw/redalert.c */
17 extern unsigned char *redalert_backram;
18 extern unsigned char *redalert_spriteram1;
19 extern unsigned char *redalert_spriteram2;
20 extern unsigned char *redalert_spriteram3;
21 extern unsigned char *redalert_characterram;
22 extern unsigned char *redalert_characterram2;
23 WRITE_HANDLER( redalert_backram_w );
24 WRITE_HANDLER( redalert_spriteram1_w );
25 WRITE_HANDLER( redalert_spriteram2_w );
26 WRITE_HANDLER( redalert_spriteram3_w );
27 WRITE_HANDLER( redalert_spriteram4_w );
28 WRITE_HANDLER( redalert_characterram_w );
29 WRITE_HANDLER( redalert_characterram2_w );
30 extern VIDEO_UPDATE( redalert );
31 WRITE_HANDLER( redalert_c040_w );
32 WRITE_HANDLER( demoneye_c040_w );
33 WRITE_HANDLER( redalert_backcolor_w );
34 
35 
36 /* sndhrdw/redalert.c */
37 WRITE_HANDLER( redalert_c030_w );
38 READ_HANDLER( redalert_voicecommand_r );
39 WRITE_HANDLER( redalert_soundlatch_w );
40 READ_HANDLER( redalert_AY8910_A_r );
41 WRITE_HANDLER( redalert_AY8910_B_w );
42 WRITE_HANDLER( redalert_AY8910_w );
43 READ_HANDLER( redalert_sound_register_IC1_r );
44 WRITE_HANDLER( redalert_sound_register_IC2_w );
45 
46 
MEMORY_READ_START(redalert_readmem)47 static MEMORY_READ_START( redalert_readmem )
48 	{ 0x0000, 0x01ff, MRA_RAM }, /* Zero page / stack */
49 	{ 0x0200, 0x0fff, MRA_RAM }, /* ? */
50 	{ 0x1000, 0x1fff, MRA_RAM }, /* Scratchpad video RAM */
51 	{ 0x2000, 0x4fff, MRA_RAM }, /* Video RAM */
52 	{ 0x5000, 0xbfff, MRA_ROM },
53 	{ 0xc100, 0xc100, input_port_0_r },
54 	{ 0xc110, 0xc110, input_port_1_r },
55 	{ 0xc120, 0xc120, input_port_2_r },
56 	{ 0xc170, 0xc170, watchdog_reset_r },
57 	{ 0xf000, 0xffff, MRA_ROM }, /* remapped ROM for 6502 vectors */
58 MEMORY_END
59 
60 static MEMORY_WRITE_START( redalert_writemem )
61 	{ 0x0000, 0x01ff, MWA_RAM },
62 	{ 0x0200, 0x0fff, MWA_RAM }, /* ? */
63 	{ 0x1000, 0x1fff, MWA_RAM }, /* Scratchpad video RAM */
64 	{ 0x2000, 0x3fff, redalert_backram_w, &redalert_backram },
65 	{ 0x4000, 0x43ff, videoram_w, &videoram, &videoram_size },
66 	{ 0x4400, 0x47ff, redalert_spriteram1_w, &redalert_spriteram1 },
67 	{ 0x4800, 0x4bff, redalert_characterram_w, &redalert_characterram },
68 	{ 0x4c00, 0x4fff, redalert_spriteram2_w, &redalert_spriteram2 },
69 	{ 0x5000, 0xbfff, MWA_ROM },
70 	{ 0xc130, 0xc130, redalert_c030_w },
71 	{ 0xc140, 0xc140, redalert_c040_w },
72 	{ 0xc150, 0xc150, redalert_backcolor_w },
73 	{ 0xc160, 0xc160, redalert_soundlatch_w },
74 	{ 0xf000, 0xffff, MWA_ROM },
75 MEMORY_END
76 
77 static MEMORY_READ_START( redalert_sound_readmem )
78 	{ 0x0000, 0x03ff, MRA_RAM },
79 	{ 0x7800, 0x7fff, MRA_ROM },
80 	{ 0xf800, 0xffff, MRA_ROM },
81 	{ 0x1001, 0x1001, redalert_sound_register_IC1_r },
82 MEMORY_END
83 
84 static MEMORY_WRITE_START( redalert_sound_writemem )
85 	{ 0x0000, 0x03ff, MWA_RAM },
86 	{ 0x7800, 0x7fff, MWA_ROM },
87 	{ 0xf800, 0xffff, MWA_ROM },
88 	{ 0x1000, 0x1000, redalert_AY8910_w },
89 	{ 0x1001, 0x1001, redalert_sound_register_IC2_w },
90 MEMORY_END
91 
92 static MEMORY_READ_START( redalert_voice_readmem )
93 	{ 0x0000, 0x3fff, MRA_ROM },
94 	{ 0x8000, 0x83ff, MRA_RAM },
95 	{ 0xc000, 0xc000, redalert_voicecommand_r }, /* reads command from D0-D5? */
96 MEMORY_END
97 
98 static MEMORY_WRITE_START( redalert_voice_writemem )
99 	{ 0x0000, 0x3fff, MWA_ROM },
100 	{ 0x8000, 0x83ff, MWA_RAM },
101 MEMORY_END
102 
103 
104 static MEMORY_READ_START( demoneye_readmem )
105 	{ 0x0000, 0x01ff, MRA_RAM }, /* Zero page / stack */
106 	{ 0x0200, 0x0fff, MRA_RAM }, /* ? */
107 	{ 0x1000, 0x1fff, MRA_RAM }, /* Scratchpad video RAM */
108 	{ 0x2000, 0x4fff, MRA_RAM }, /* Video RAM */
109 	{ 0x5000, 0x5fff, MRA_RAM },
110 	{ 0x6000, 0xbfff, MRA_ROM },
111 	{ 0xc100, 0xc100, input_port_0_r },
112 	{ 0xc110, 0xc110, input_port_1_r },
113 	{ 0xc120, 0xc120, input_port_2_r },
114 	{ 0xf000, 0xffff, MRA_ROM }, /* remapped ROM for 6502 vectors */
115 MEMORY_END
116 
117 static MEMORY_WRITE_START( demoneye_writemem )
118 	{ 0x0000, 0x01ff, MWA_RAM },
119 	{ 0x0200, 0x0fff, MWA_RAM }, /* ? */
120 	{ 0x1000, 0x1fff, MWA_RAM }, /* Scratchpad video RAM */
121 	{ 0x2000, 0x3fff, redalert_backram_w, &redalert_backram },
122 	{ 0x4000, 0x43ff, redalert_characterram_w, &redalert_characterram },
123 	{ 0x4400, 0x47ff, redalert_spriteram1_w, &redalert_spriteram1 },
124 	{ 0x4800, 0x4bff, redalert_characterram2_w, &redalert_characterram2 },
125 	{ 0x4c00, 0x4fff, redalert_spriteram2_w, &redalert_spriteram2 },
126 	{ 0x5000, 0x53ff, videoram_w, &videoram, &videoram_size },
127 	{ 0x5400, 0x57ff, redalert_spriteram3_w, &redalert_spriteram3 },
128 	{ 0x5800, 0x5bff, MWA_RAM }, /*???*/
129 	{ 0x5c00, 0x5fff, MWA_RAM }, /*???*/
130 	{ 0x6000, 0xbfff, MWA_ROM },
131 	{ 0xc130, 0xc130, MWA_NOP },
132 	{ 0xc140, 0xc140, demoneye_c040_w },
133 	{ 0xc150, 0xc150, redalert_backcolor_w },
134 	{ 0xc160, 0xc160, MWA_NOP },
135 	{ 0xc161, 0xc161, MWA_NOP },
136 	{ 0xc162, 0xc162, watchdog_reset_w },
137 	{ 0xc163, 0xc163, MWA_NOP },
138 	{ 0xc170, 0xc170, MWA_NOP },
139 	{ 0xf000, 0xffff, MWA_ROM },
140 MEMORY_END
141 
142 static MEMORY_READ_START( demoneye_sound_readmem )
143 	{ 0x0000, 0x007f, MRA_RAM },
144 	{ 0x0500, 0x0503, pia_0_r },
145 	{ 0x2000, 0x2fff, MRA_ROM },
146 	{ 0xf000, 0xffff, MRA_ROM },
147 MEMORY_END
148 
149 static MEMORY_WRITE_START( demoneye_sound_writemem )
150 	{ 0x0000, 0x007f, MWA_RAM },
151 	{ 0x0500, 0x0503, pia_0_w },
152 	{ 0x2000, 0x2fff, MWA_ROM },
153 	{ 0xf000, 0xffff, MWA_ROM },
154 MEMORY_END
155 
156 
157 INPUT_PORTS_START( redalert )
158 	PORT_START			   /* DIP Switches */
159 	PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
160 	PORT_DIPSETTING(    0x00, "3" )
161 	PORT_DIPSETTING(    0x01, "4" )
162 	PORT_DIPSETTING(    0x02, "5" )
163 	PORT_DIPSETTING(    0x03, "6" )
164 	PORT_DIPNAME( 0x04, 0x00, "Cabinet in Service Mode" )
165 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
166 	PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
167 	PORT_DIPNAME( 0x08, 0x00, DEF_STR( Bonus_Life ) )
168 	PORT_DIPSETTING(    0x00, "5000" )
169 	PORT_DIPSETTING(    0x08, "7000" )
170 	PORT_DIPNAME( 0x30, 0x10, DEF_STR( Coinage ) )
171 	PORT_DIPSETTING(    0x30, DEF_STR( 2C_1C ) )
172 	PORT_DIPSETTING(    0x10, DEF_STR( 1C_1C ) )
173 	PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
174 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
175 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
176 	PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
177 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
178 	PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
179 
180 	PORT_START			   /* IN1 */
181 	PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
182 	PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
183 	PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
184 	PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
185 	PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
186 	PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
187 	PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
188 	PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */
189 
190 	PORT_START			   /* IN2  */
191 	PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
192 	PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */
193 	PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
194 	PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
195 	PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
196 	PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_COCKTAIL )
197 	PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_COCKTAIL )
198 	PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */
199 
200 	PORT_START			   /* Fake input for coins */
201 	PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1)
202 INPUT_PORTS_END
203 
204 
205 INPUT_PORTS_START( demoneye )
206 	PORT_START			   /* DIP Switches */
207 	PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
208 	PORT_DIPSETTING(    0x00, "3" )
209 	PORT_DIPSETTING(    0x01, "4" )
210 	PORT_DIPSETTING(    0x02, "5" )
211 	PORT_DIPSETTING(    0x03, "6" )
212 	PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
213 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
214 	PORT_DIPSETTING(    0x04, DEF_STR( On ) )
215 	PORT_DIPNAME( 0x08, 0x00, DEF_STR( Bonus_Life ) )
216 	PORT_DIPSETTING(    0x00, "5000" )
217 	PORT_DIPSETTING(    0x08, "7000" )
218 	PORT_DIPNAME( 0x30, 0x10, DEF_STR( Coinage ) )
219 	PORT_DIPSETTING(    0x30, DEF_STR( 2C_1C ) )
220 	PORT_DIPSETTING(    0x10, DEF_STR( 1C_1C ) )
221 	PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
222 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
223 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
224 	PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
225 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
226 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
227 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
228 	PORT_DIPSETTING(    0x80, DEF_STR( On ) )
229 
230 	PORT_START			   /* IN1 */
231 	PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
232 	PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
233 	PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
234 	PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
235 	PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
236 	PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
237 	PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
238 	PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */
239 
240 	PORT_START			   /* IN2  */
241 	PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
242 	PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */
243 	PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
244 	PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
245 	PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
246 	PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_COCKTAIL )
247 	PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_COCKTAIL )
248 	PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */
249 
250 	PORT_START			   /* Fake input for coins */
251 	PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1)
252 INPUT_PORTS_END
253 
254 
255 static struct GfxLayout backlayout =
256 {
257 	8,8,	/* 8*8 characters */
258 	0x400,	  /* 1024 characters */
259 	1,	/* 1 bits per pixel */
260 	{ 0 }, /* No info needed for bit offsets */
261 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
262 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
263 	8*8 /* every char takes 8 consecutive bytes */
264 };
265 
266 static struct GfxLayout charlayout =
267 {
268 	8,8,	/* 8*8 characters */
269 	128,	/* 128 characters */
270 	1,	/* 1 bits per pixel */
271 	{ 0 }, /* No info needed for bit offsets */
272 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
273 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
274 	8*8 /* every char takes 8 consecutive bytes */
275 };
276 
277 static struct GfxLayout spritelayout =
278 {
279 	8,8,	/* 8*8 characters */
280 	128,	/* 128 characters */
281 	2,		/* 2 bits per pixel */
282 	{ 0, 0x800*8 }, /* No info needed for bit offsets */
283 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
284 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
285 	8*8 /* every char takes 8 consecutive bytes */
286 };
287 
288 static struct GfxDecodeInfo redalert_gfxdecodeinfo[] =
289 {
290 	{ 0, 0x3000, &backlayout,	0, 8 }, 	/* the game dynamically modifies this */
291 	{ 0, 0x4800, &charlayout,	0, 8 }, 	/* the game dynamically modifies this */
292 	{ 0, 0x4400, &spritelayout,16, 4 }, 	/* the game dynamically modifies this */
293 	{ -1 } /* end of array */
294 };
295 
296 static struct GfxDecodeInfo demoneye_gfxdecodeinfo[] =
297 {
298 	{ 0, 0x3000, &backlayout,	0, 8 }, 	/* the game dynamically modifies this */
299 	{ 0, 0x4800, &spritelayout,16, 4 }, 	/* the game dynamically modifies this */
300 	{ 0, 0x4400, &spritelayout,16, 4 }, 	/* the game dynamically modifies this */
301 	{ 0, 0x5400, &spritelayout,16, 4 }, 	/* the game dynamically modifies this */
302 	{ -1 } /* end of array */
303 };
304 
305 /* Arbitrary colortable */
306 static unsigned short colortable_source[] =
307 {
308 	0,7,
309 	0,6,
310 	0,2,
311 	0,4,
312 	0,3,
313 	0,6,
314 	0,1,
315 	0,8,
316 
317 	0,8,8,8,
318 	0,6,4,7,
319 	0,6,4,1,
320 	0,8,5,1,
321 };
322 
PALETTE_INIT(redalert)323 static PALETTE_INIT( redalert )
324 {
325 	/* Arbitrary colors */
326 	palette_set_color(0,0x40,0x80,0xff);	/* Background */
327 	palette_set_color(1,0x00,0x00,0xff);	/* Blue */
328 	palette_set_color(2,0xff,0x00,0xff);	/* Magenta */
329 	palette_set_color(3,0x00,0xff,0xff);	/* Cyan */
330 	palette_set_color(4,0xff,0x00,0x00);	/* Red */
331 	palette_set_color(5,0xff,0x80,0x00);	/* Orange */
332 	palette_set_color(6,0xff,0xff,0x00);	/* Yellow */
333 	palette_set_color(7,0xff,0xff,0xff);	/* White */
334 	palette_set_color(8,0x00,0x00,0x00);	/* Black */
335 
336 	memcpy(colortable,colortable_source,sizeof(colortable_source));
337 }
338 
INTERRUPT_GEN(redalert_interrupt)339 static INTERRUPT_GEN( redalert_interrupt )
340 {
341 	if( readinputport(3) )
342 	{
343 		cpu_set_irq_line(0, IRQ_LINE_NMI, PULSE_LINE);
344 	}
345 	else
346 	{
347 		cpu_set_irq_line(0, 0, HOLD_LINE);
348 	}
349 }
350 
351 static struct AY8910interface redalert_ay8910_interface =
352 {
353 	1,			/* 1 chip */
354 	2000000,	/* 2 MHz */
355 	{ 50 },		/* Volume */
356 	{ redalert_AY8910_A_r },		/* Port A Read */
357 	{ 0 },		/* Port B Read */
358 	{ 0 },		/* Port A Write */
359 	{ redalert_AY8910_B_w }		/* Port B Write */
360 };
361 
362 static MACHINE_DRIVER_START( redalert )
363 
364 	/* basic machine hardware */
365 	MDRV_CPU_ADD(M6502, 1000000)	   /* ???? */
366 	MDRV_CPU_MEMORY(redalert_readmem,redalert_writemem)
367 	MDRV_CPU_VBLANK_INT(redalert_interrupt,1)
368 
369 	MDRV_CPU_ADD(M6502, 1000000)
370 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)	   /* 1 MHz */
371 	MDRV_CPU_MEMORY(redalert_sound_readmem,redalert_sound_writemem)
372 			/* IRQ is hooked to a 555 timer, whose freq is 1150 Hz */
373 	MDRV_CPU_PERIODIC_INT(irq0_line_hold,1150)
374 
375 	MDRV_CPU_ADD(8085A, 1000000)
376 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)	   /* 1 MHz? */
377 	MDRV_CPU_MEMORY(redalert_voice_readmem,redalert_voice_writemem)
378 
379 	MDRV_FRAMES_PER_SECOND(60)
380 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
381 
382 	/* video hardware */
383 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
384 	MDRV_SCREEN_SIZE(32*8, 32*8)
385 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
386 	MDRV_GFXDECODE(redalert_gfxdecodeinfo)
387 	MDRV_PALETTE_LENGTH(9)
388 	MDRV_COLORTABLE_LENGTH(sizeof(colortable_source) / sizeof(colortable_source[0]))
389 
390 	MDRV_PALETTE_INIT(redalert)
391 	MDRV_VIDEO_START(generic)
392 	MDRV_VIDEO_UPDATE(redalert)
393 
394 	/* sound hardware */
395 	MDRV_SOUND_ADD(AY8910, redalert_ay8910_interface)
396 MACHINE_DRIVER_END
397 
398 
399 /* PIA 0, sound CPU */
400 static struct pia6821_interface pia_0_intf =
401 {
402 	/*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0,
403 	/*outputs: A/B,CA/B2       */ 0, 0, 0, 0,
404 	/*irqs   : A/B             */ 0, 0
405 };
406 
407 static struct AY8910interface demoneye_ay8910_interface =
408 {
409 	2,			/* 2 chip */
410 	3579545,	/* 3 MHz ? */
411 	{ 50, 50 },		/* Volume */
412 	{ 0, 0 },		/* Port A Read */
413 	{ 0, 0 },		/* Port B Read */
414 	{ 0, 0 },		/* Port A Write */
415 	{ 0, 0 }		/* Port B Write */
416 };
417 
MACHINE_INIT(demoneye)418 MACHINE_INIT( demoneye )
419 {
420 	pia_unconfig();
421 	pia_config(0, PIA_STANDARD_ORDERING, &pia_0_intf);
422 	pia_reset();
423 }
424 
425 static MACHINE_DRIVER_START( demoneye )
426 
427 	/* basic machine hardware */
428 	MDRV_CPU_ADD(M6502, 11730000/2)	/* 11.73MHz */
429 	MDRV_CPU_MEMORY(demoneye_readmem,demoneye_writemem)
430 	MDRV_CPU_VBLANK_INT(redalert_interrupt,1)
431 
432 	MDRV_CPU_ADD(M6802, 3579545)	/* 3.579545 MHz */
433 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)
434 	MDRV_CPU_MEMORY(demoneye_sound_readmem,demoneye_sound_writemem)
435 
436 	MDRV_FRAMES_PER_SECOND(60)
437 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
438 
439 	MDRV_MACHINE_INIT(demoneye)
440 
441 	/* video hardware */
442 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
443 	MDRV_SCREEN_SIZE(32*8, 32*8)
444 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
445 	MDRV_GFXDECODE(demoneye_gfxdecodeinfo)
446 	MDRV_PALETTE_LENGTH(9)
447 	MDRV_COLORTABLE_LENGTH(sizeof(colortable_source) / sizeof(colortable_source[0]))
448 
449 	MDRV_PALETTE_INIT(redalert)
450 	MDRV_VIDEO_START(generic)
451 	MDRV_VIDEO_UPDATE(redalert)
452 
453 	/* sound hardware */
454 	MDRV_SOUND_ADD(AY8910, demoneye_ay8910_interface)
455 MACHINE_DRIVER_END
456 
457 /***************************************************************************
458 
459   Game ROMs
460 
461 ***************************************************************************/
462 
463 ROM_START( redalert )
464 	ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code */
465 	ROM_LOAD( "rag5",         	0x5000, 0x1000, CRC(d7c9cdd6) SHA1(5ff5cdceaa00083b745cf5c74b096f7edfadf737) )
466 	ROM_LOAD( "rag6",         	0x6000, 0x1000, CRC(cb2a308c) SHA1(9f3bc22bad31165e080e81d4a3fb0ec2aad235fe) )
467 	ROM_LOAD( "rag7n",        	0x7000, 0x1000, CRC(82ab2dae) SHA1(f8328b048384afac245f1c16a2d0864ffe0b4741) )
468 	ROM_LOAD( "rag8n",        	0x8000, 0x1000, CRC(b80eece9) SHA1(d986449bdb1d94832187c7f953f01330391ef4c9) )
469 	ROM_RELOAD(                 0xf000, 0x1000 )
470 	ROM_LOAD( "rag9",         	0x9000, 0x1000, CRC(2b7d1295) SHA1(1498af0c55bd38fe79b91afc38921085102ebbc3) )
471 	ROM_LOAD( "ragab",        	0xa000, 0x1000, CRC(ab99f5ed) SHA1(a93713bb03d61cce64adc89b874b67adea7c53cd) )
472 	ROM_LOAD( "ragb",         	0xb000, 0x1000, CRC(8e0d1661) SHA1(bff4ddca761ddd70113490f50777e62c66813685) )
473 
474 	ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for code */
475 	ROM_LOAD( "w3s1",         	0x7800, 0x0800, CRC(4af956a5) SHA1(25368a40d7ebc60316fd2d78ec4c686e701b96dc) )
476 	ROM_RELOAD(                0xf800, 0x0800 )
477 
478 	ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* 64k for code */
479 	ROM_LOAD( "ras1b",        	0x0000, 0x1000, CRC(ec690845) SHA1(26a84738bd45ed21dac6c8383ebd9c3b9831024a) )
480 	ROM_LOAD( "ras2",         	0x1000, 0x1000, CRC(fae94cfc) SHA1(2fd798706bb3afda3fb55bc877e597cc4e5d0c15) )
481 	ROM_LOAD( "ras3",         	0x2000, 0x1000, CRC(20d56f3e) SHA1(5c32ee3365407e6d3f7ab5662e9ecbac437ed4cb) )
482 	ROM_LOAD( "ras4",         	0x3000, 0x1000, CRC(130e66db) SHA1(385b8f889fee08fddbb2f75a691af569109eacd1) )
483 
484 	ROM_REGION( 0x0200, REGION_PROMS, 0 ) /* unknow */
485 	ROM_LOAD( "m-257sc.1a",		0x0000, 0x0200, CRC(b1aca792) SHA1(db37f99b9880cc3c434e2a55a0bbb017d9a72aa3) )
486 ROM_END
487 
488 
489 /********************************************************************
490 IREM 'DEMONEYE-X' proto 1981
491 
492 proto sound board
493 
494 8910
495 6821   8910
496 6802  sound6 sound7
497     3.579545MHz
498 
499  main board M-27M-C
500 
501   11.73MHz              6502            x x x xx
502                                          x x x  on
503                   4116            8
504                   4116            -
505                   4116            9
506                   4116            6
507                   4116            A
508                   4116            7
509                   4116            B
510                   4116
511 
512  sub board 1 M-27Sb
513 
514   1a2
515 
516   2114
517   2114
518               2114 <- two parts piggy-backed
519               2114 <- two parts piggy-backed
520               2114 2114
521               2114 2114
522 
523 sub board 2 M-42-S
524 
525   1a       clr(missing)
526 
527                   2114
528                   2114
529                   2114
530                   2114
531                   2114
532                   2114
533 
534 *********************************************************************/
535 
536 ROM_START( demoneye )
537 	ROM_REGION( 0x10000, REGION_CPU1, 0 )
538 	ROM_LOAD( "demoneye.6",  0x6000, 0x1000, CRC(b03ee3a9) SHA1(66b6115fbb4e8097152702022c59c464e8211e5a) )
539 	ROM_LOAD( "demoneye.7",  0x7000, 0x1000, CRC(667a5de7) SHA1(c3ce7fbbc6c98250e9d5f85854e6887017ca5ff9) )
540 	ROM_LOAD( "demoneye.8",  0x8000, 0x1000, CRC(257484d7) SHA1(3937cce546462a471adbdc1da63ddfc20cfc7b79) )
541 	ROM_RELOAD(              0xf000, 0x1000 )
542 	ROM_LOAD( "demoneye.9",  0x9000, 0x1000, CRC(bd8d79a8) SHA1(68c1443ef78b545eb9e612573b86515c3ad7f103) )
543 	ROM_LOAD( "demoneye.a",  0xa000, 0x1000, CRC(a27d08aa) SHA1(659ad22778e852fc58f3951d62bc01151c973d36) )
544 	ROM_LOAD( "demoneye.b",  0xb000, 0x1000, CRC(1fd3585b) SHA1(b1697b7b21b739499fda1e155530dbfab89f3358) )
545 
546 	ROM_REGION( 0x10000, REGION_CPU2, 0 )
547 	ROM_LOAD( "demoneye.7s", 0x2000, 0x1000, CRC(8fdc9364) SHA1(3fccb5b22f08d6a0cde85863c1ce5399c84f233e) )
548 	ROM_LOAD( "demoneye.6s", 0xf000, 0x1000, CRC(0a23def9) SHA1(b52f52be312ec7810e3c9cbd3913e887f983b1ee) )
549 
550 	ROM_REGION( 0x0400, REGION_USER1, 0 ) /* unknow */
551 	ROM_LOAD( "demoneye.1a",  0x0000, 0x0200, CRC(d03488ea) SHA1(11027f502ad2a9255b2e5611ab2eee16ede1d704) )
552 	ROM_LOAD( "demoneye.1a2", 0x0200, 0x0200, CRC(eaf5a66e) SHA1(d8ebe05ba5d75fbf6ad45f710e5bd27b6afad44b) )
553 ROM_END
554 
555 GAMEX( 1981, redalert, 0, redalert, redalert, 0, ROT270, "Irem + GDI",	"Red Alert",  GAME_WRONG_COLORS | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
556 GAMEX( 1981, demoneye, 0, demoneye, demoneye, 0, ROT270, "Irem",		"Demoneye-X", GAME_WRONG_COLORS | GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND )
557