1 /*************************************************************************
2 
3 	Driver for Atari/Midway Seattle hardware games
4 
5 	driver by Aaron Giles
6 
7 	Games supported:
8 		* Bio Freaks [Midway]
9 		* CarnEvil [Midway, 150MHz]
10 		* NFL Blitz [Midway, 150MHz]
11 		* NFL Blitz 99 [Midway, 150MHz]
12 		* NFL Blitz 2000 [Midway, 150MHz]
13 		* California Speed [Atari, 150MHz]
14 		* Mace: The Dark Age [Atari, 200MHz]
15 		* San Francisco Rush [Atari]
16 		* Wayne Gretzky's 3d Hockey [Atari]
17 
18 	Potentially to be added:
19 		* Hyperdrive [Midway, 200MHz]
20 		* Vapor TRX [Atari, 200MHz]
21 		* San Francisco Rush Alcatraz Edition [Atari]
22 
23 	Known bugs:
24 		* general: Atari games timing is not quite right
25 		* CarnEvil: lets you set the flash brightness; need to emulate that
26 		* Blitz99: random black frames
27 		* Blitz99/2k: crash when running full powerup tests
28 		* Blitz99/2k: sounds play at the wrong frequency unless we use 12MHz
29 		* Wayne Gretzky: loses sound occasionally and has to reset it
30 		* SF Rush: hangs when trying to start a game (security?)
31 
32 **************************************************************************/
33 
34 #include "driver.h"
35 #include "cpu/adsp2100/adsp2100.h"
36 #include "cpu/mips/mips3.h"
37 #include "sndhrdw/dcs.h"
38 #include "sndhrdw/cage.h"
39 #include "machine/idectrl.h"
40 #include "machine/midwayic.h"
41 #include "vidhrdw/voodoo.h"
42 #include "bootstrap.h"
43 #include "inptport.h"
44 
45 
46 #define TIMER_CLOCK			TIME_IN_HZ(50000000)
47 #define DMA_SECS_PER_BYTE	TIME_IN_HZ(50000000)
48 
49 
50 #define LOG_TIMERS			(0)
51 #define LOG_DMA				(0)
52 #define LOG_GALILEO			(0)
53 
54 
55 static data32_t *rambase;
56 static data32_t *rombase;
57 static data32_t *galileo_regs;
58 
59 static data32_t pci_bridge_regs[0x40];
60 static data32_t pci_3dfx_regs[0x40];
61 
62 static void *timer[4];
63 static UINT32 timer_count[4];
64 static UINT8 timer_active[4];
65 
66 static UINT8 vblank_signalled;
67 static UINT8 vblank_irq;
68 static data32_t *vblank_config;
69 static data32_t *vblank_enable;
70 
71 static data32_t *asic_reset;
72 
73 static data8_t pending_analog_read;
74 
75 static data32_t *generic_speedup;
76 static data32_t *generic_speedup2;
77 
78 
79 static void timer_callback(int param);
80 
81 
82 
83 /*************************************
84  *
85  *	Machine init
86  *
87  *************************************/
88 
MACHINE_INIT(seattle)89 static MACHINE_INIT( seattle )
90 {
91 	cpu_setbank(1, rambase);
92 	cpu_setbank(2, rambase);
93 	cpu_setbank(3, rombase);
94 
95 	if (mame_find_cpu_index("dcs2") != -1)
96 	{
97 		dcs_reset_w(0);
98 		dcs_reset_w(1);
99 	}
100 	else if (mame_find_cpu_index("cage") != -1)
101 	{
102 		cage_control_w(0);
103 		cage_control_w(3);
104 	}
105 
106 	ide_controller_reset(0);
107 
108 	timer[0] = timer_alloc(timer_callback);
109 	timer[1] = timer_alloc(timer_callback);
110 	timer[2] = timer_alloc(timer_callback);
111 	timer[3] = timer_alloc(timer_callback);
112 
113 	vblank_irq = 0;
114 
115 	voodoo_reset();
116 }
117 
118 
119 
120 /*************************************
121  *
122  *	IDE interrupts
123  *
124  *************************************/
125 
ide_interrupt(int state)126 static void ide_interrupt(int state)
127 {
128 	cpu_set_irq_line(0, 2, state);
129 }
130 
131 static struct ide_interface ide_intf =
132 {
133 	ide_interrupt
134 };
135 
136 
137 
138 /*************************************
139  *
140  *	I/O ASIC interrupts
141  *
142  *************************************/
143 
ioasic_irq(int state)144 static void ioasic_irq(int state)
145 {
146 	cpu_set_irq_line(0, 1, state);
147 }
148 
149 
150 
151 /*************************************
152  *
153  *	VBLANK interrupts
154  *
155  *************************************/
156 
clear_vblank(int param)157 static void clear_vblank(int param)
158 {
159 	logerror("Clearing vblank_irq\n");
160 	if (vblank_irq)
161 		cpu_set_irq_line(0, vblank_irq, CLEAR_LINE);
162 	vblank_signalled = 0;
163 }
164 
165 
READ32_HANDLER(vblank_signalled_r)166 static READ32_HANDLER( vblank_signalled_r )
167 {
168 	logerror("%06X:vblank_signalled_r\n", activecpu_get_pc());
169 	return vblank_signalled ? 0x80 : 0x00;
170 }
171 
172 
WRITE32_HANDLER(vblank_enable_w)173 static WRITE32_HANDLER( vblank_enable_w )
174 {
175 	logerror("%06X:vblank_enable_w = %08X\n", activecpu_get_pc(), data);
176 	COMBINE_DATA(vblank_enable);
177 }
178 
179 
WRITE32_HANDLER(vblank_config_w)180 static WRITE32_HANDLER( vblank_config_w )
181 {
182 	logerror("%06X:vblank_config_w = %08X\n", activecpu_get_pc(), data);
183 	COMBINE_DATA(vblank_config);
184 	if (vblank_irq)
185 		cpu_set_irq_line(0, vblank_irq, CLEAR_LINE);
186 	vblank_irq = 2 + ((*vblank_config >> 14) & 3);
187 }
188 
189 
WRITE32_HANDLER(vblank_clear_w)190 static WRITE32_HANDLER( vblank_clear_w )
191 {
192 	logerror("%06X:vblank_clear_w = %08X\n", activecpu_get_pc(), data);
193 	if (vblank_irq)
194 		cpu_set_irq_line(0, vblank_irq, CLEAR_LINE);
195 	vblank_signalled = 0;
196 }
197 
198 
INTERRUPT_GEN(assert_vblank)199 static INTERRUPT_GEN( assert_vblank )
200 {
201 	logerror("Setting IRQ3\n");
202 	if (*vblank_enable & 0x80)
203 	{
204 		if (vblank_irq)
205 			cpu_set_irq_line(0, vblank_irq, ASSERT_LINE);
206 		vblank_signalled = 1;
207 		timer_set(cpu_getscanlinetime(cpu_getscanline() + 1), 0, clear_vblank);
208 	}
209 }
210 
211 
212 
213 /*************************************
214  *
215  *	CMOS access
216  *
217  *************************************/
218 
WRITE32_HANDLER(cmos_w)219 static WRITE32_HANDLER( cmos_w )
220 {
221 	data32_t *cmos_base = (data32_t *)generic_nvram;
222 	COMBINE_DATA(&cmos_base[offset]);
223 }
224 
225 
READ32_HANDLER(cmos_r)226 static READ32_HANDLER( cmos_r )
227 {
228 	data32_t *cmos_base = (data32_t *)generic_nvram;
229 	return cmos_base[offset];
230 }
231 
232 
233 
234 /*************************************
235  *
236  *	PCI bus writes
237  *
238  *************************************/
239 
pci_bridge_w(UINT8 reg,UINT8 type,data32_t data)240 static void pci_bridge_w(UINT8 reg, UINT8 type, data32_t data)
241 {
242 	pci_bridge_regs[reg] = data;
243 	logerror("%06X:PCI bridge write: reg %d type %d = %08X\n", activecpu_get_pc(), reg, type, data);
244 }
245 
246 
pci_3dfx_w(UINT8 reg,UINT8 type,data32_t data)247 static void pci_3dfx_w(UINT8 reg, UINT8 type, data32_t data)
248 {
249 	pci_3dfx_regs[reg] = data;
250 
251 	switch (reg)
252 	{
253 		case 0x04:		/* address register */
254 			pci_3dfx_regs[reg] &= 0xff000000;
255 			if (data != 0x08000000)
256 				logerror("3dfx not mapped where we expect it!\n");
257 			break;
258 
259 		case 0x10:		/* initEnable register */
260 			voodoo_set_init_enable(data);
261 			break;
262 	}
263 	logerror("%06X:PCI 3dfx write: reg %d type %d = %08X\n", activecpu_get_pc(), reg, type, data);
264 }
265 
266 
267 
268 /*************************************
269  *
270  *	PCI bus reads
271  *
272  *************************************/
273 
pci_bridge_r(UINT8 reg,UINT8 type)274 static data32_t pci_bridge_r(UINT8 reg, UINT8 type)
275 {
276 	data32_t result = pci_bridge_regs[reg];
277 
278 	logerror("%06X:PCI bridge read: reg %d type %d = %08X\n", activecpu_get_pc(), reg, type, result);
279 
280 	return result;
281 }
282 
283 
pci_3dfx_r(UINT8 reg,UINT8 type)284 static data32_t pci_3dfx_r(UINT8 reg, UINT8 type)
285 {
286 	data32_t result = pci_3dfx_regs[reg];
287 
288 	switch (reg)
289 	{
290 		case 0:		/* ID register: 0x0001 = SST-1, 0x121a = 3dfx */
291 			result = 0x0001121a;
292 			break;
293 	}
294 
295 	logerror("%06X:PCI 3dfx read: reg %d type %d = %08X\n", activecpu_get_pc(), reg, type, result);
296 
297 	return result;
298 }
299 
300 
301 
302 /*************************************
303  *
304  *	Galileo timers & interrupts
305  *
306  *************************************/
307 
update_galileo_irqs(void)308 static void update_galileo_irqs(void)
309 {
310 	if (galileo_regs[0xc18/4] & galileo_regs[0xc1c/4])
311 	{
312 		if (LOG_GALILEO)
313 			logerror("Galileo IRQ asserted\n");
314 		cpu_set_irq_line(0, 0, ASSERT_LINE);
315 	}
316 	else
317 	{
318 		if (LOG_GALILEO)
319 			logerror("Galileo IRQ cleared\n");
320 		cpu_set_irq_line(0, 0, CLEAR_LINE);
321 	}
322 }
323 
324 
timer_callback(int which)325 static void timer_callback(int which)
326 {
327 	if (LOG_GALILEO)
328 		logerror("timer %d fired\n", which);
329 
330 	/* copy the start value from the registers */
331 	timer_count[which] = galileo_regs[0x850/4 + which];
332 	if (which != 0)
333 		timer_count[which] &= 0xffffff;
334 
335 	/* if we're a timer, adjust the timer to fire again */
336 	if (galileo_regs[0x864/4] & (2 << (2 * which)))
337 		timer_adjust(timer[which], TIMER_CLOCK * timer_count[which], which, 0);
338 	else
339 		timer_active[which] = timer_count[which] = 0;
340 
341 	/* trigger the interrupt */
342 	galileo_regs[0xc18/4] |= 0x100 << which;
343 	update_galileo_irqs();
344 }
345 
346 
347 
348 /*************************************
349  *
350  *	Galileo DMA handler
351  *
352  *************************************/
353 
dma_fetch_next(int which)354 static int dma_fetch_next(int which)
355 {
356 	offs_t address = 0;
357 	data32_t data;
358 
359 	/* no-op for unchained mode */
360 	if (!(galileo_regs[0x840/4 + which] & 0x200))
361 		address = galileo_regs[0x830/4 + which];
362 
363 	/* if we hit the end address, signal an interrupt */
364 	if (address == 0)
365 	{
366 		if (galileo_regs[0x840/4 + which] & 0x400)
367 		{
368 			galileo_regs[0xc18/4] |= 0x10 << which;
369 			update_galileo_irqs();
370 		}
371 		return 0;
372 	}
373 
374 	/* fetch the byte count */
375 	data = cpunum_read_byte(0, address++);
376 	data |= cpunum_read_byte(0, address++) << 8;
377 	data |= cpunum_read_byte(0, address++) << 16;
378 	data |= cpunum_read_byte(0, address++) << 24;
379 	galileo_regs[0x800/4 + which] = data;
380 
381 	/* fetch the source address */
382 	data = cpunum_read_byte(0, address++);
383 	data |= cpunum_read_byte(0, address++) << 8;
384 	data |= cpunum_read_byte(0, address++) << 16;
385 	data |= cpunum_read_byte(0, address++) << 24;
386 	galileo_regs[0x810/4 + which] = data;
387 
388 	/* fetch the dest address */
389 	data = cpunum_read_byte(0, address++);
390 	data |= cpunum_read_byte(0, address++) << 8;
391 	data |= cpunum_read_byte(0, address++) << 16;
392 	data |= cpunum_read_byte(0, address++) << 24;
393 	galileo_regs[0x820/4 + which] = data;
394 
395 	/* fetch the next record address */
396 	data = cpunum_read_byte(0, address++);
397 	data |= cpunum_read_byte(0, address++) << 8;
398 	data |= cpunum_read_byte(0, address++) << 16;
399 	data |= cpunum_read_byte(0, address++) << 24;
400 	galileo_regs[0x830/4 + which] = data;
401 
402 //	logerror("DMA Fetch Record: bytes=%08X src=%08X dst=%08X nextrec=%08X\n",
403 //		galileo_regs[0x800/4 + which],
404 //		galileo_regs[0x810/4 + which],
405 //		galileo_regs[0x820/4 + which],
406 //		galileo_regs[0x830/4 + which]);
407 	return 1;
408 }
409 
410 static void perform_dma(int which);
411 
dma_finished_callback(int which)412 static void dma_finished_callback(int which)
413 {
414 //	logerror("DMA%d finished\n", which);
415 	galileo_regs[0x840/4 + which] &= ~0x4000;
416 	galileo_regs[0x840/4 + which] &= ~0x1000;
417 
418 	/* interrupt? */
419 	if (!(galileo_regs[0x840/4 + which] & 0x400))
420 	{
421 		galileo_regs[0xc18/4] |= 0x10 << which;
422 		update_galileo_irqs();
423 	}
424 
425 	/* chain? */
426 	if (dma_fetch_next(which))
427 		perform_dma(which);
428 }
429 
430 
perform_dma(int which)431 static void perform_dma(int which)
432 {
433 	offs_t srcaddr = galileo_regs[0x810/4 + which];
434 	offs_t dstaddr = galileo_regs[0x820/4 + which];
435 	data32_t bytesleft = galileo_regs[0x800/4 + which] & 0xffff;
436 	int srcinc, dstinc, i;
437 
438 	/* determine src/dst inc */
439 	switch ((galileo_regs[0x840/4 + which] >> 2) & 3)
440 	{
441 		default:
442 		case 0:		srcinc = 1;		break;
443 		case 1:		srcinc = -1;	break;
444 		case 2:		srcinc = 0;		break;
445 	}
446 	switch ((galileo_regs[0x840/4 + which] >> 4) & 3)
447 	{
448 		default:
449 		case 0:		dstinc = 1;		break;
450 		case 1:		dstinc = -1;	break;
451 		case 2:		dstinc = 0;		break;
452 	}
453 
454 	if (LOG_DMA)
455 		logerror("Performing DMA%d: src=%08X dst=%08X bytes=%04X sinc=%d dinc=%d\n", which, srcaddr, dstaddr, bytesleft, srcinc, dstinc);
456 
457 	/* special case: transfer ram to voodoo */
458 	if (bytesleft % 4 == 0 && srcaddr % 4 == 0 && srcaddr < 0x007fffff && dstaddr >= 0x08000000 && dstaddr < 0x09000000)
459 	{
460 		data32_t *src = &rambase[srcaddr/4];
461 		bytesleft /= 4;
462 
463 		/* transfer to registers */
464 		if (dstaddr < 0x8400000)
465 		{
466 			dstaddr = (dstaddr & 0x3fffff) / 4;
467 			for (i = 0; i < bytesleft; i++)
468 			{
469 				voodoo_regs_w(dstaddr, *src, 0);
470 				src += srcinc;
471 				dstaddr += dstinc;
472 			}
473 		}
474 
475 		/* transfer to framebuf */
476 		else if (dstaddr < 0x8800000)
477 		{
478 			dstaddr = (dstaddr & 0x3fffff) / 4;
479 			for (i = 0; i < bytesleft; i++)
480 			{
481 				voodoo_framebuf_w(dstaddr, *src, 0);
482 				src += srcinc;
483 				dstaddr += dstinc;
484 			}
485 		}
486 
487 		/* transfer to textureram */
488 		else
489 		{
490 			dstaddr = (dstaddr & 0x7fffff) / 4;
491 			for (i = 0; i < bytesleft; i++)
492 			{
493 				voodoo_textureram_w(dstaddr, *src, 0);
494 				src += srcinc;
495 				dstaddr += dstinc;
496 			}
497 		}
498 	}
499 
500 	/* standard transfer */
501 	else
502 	{
503 		for (i = 0; i < bytesleft; i++)
504 		{
505 			cpunum_write_byte(0, dstaddr, cpunum_read_byte(0, srcaddr));
506 			srcaddr += srcinc;
507 			dstaddr += dstinc;
508 		}
509 	}
510 
511 	/* set a timer for the end */
512 	galileo_regs[0x840/4 + which] |= 0x4000;
513 	if (bytesleft > 0x100)
514 		timer_set(DMA_SECS_PER_BYTE * bytesleft, which, dma_finished_callback);
515 	else
516 		dma_finished_callback(which);
517 }
518 
519 
520 
521 /*************************************
522  *
523  *	Galileo system controller
524  *
525  *************************************/
526 
527 /*
528 	0x000 = CPU interface configuration
529 
530 	0x008 = RAS[1:0] low decode address
531 	0x010 = RAS[1:0] high decode address
532 	0x018 = RAS[3:2] low decode address
533 	0x020 = RAS[3:2] high decode address
534 	0x028 = CS[2:0] low decode address
535 	0x030 = CS[2:0] high decode address
536 	0x038 = CS[3] & boot CS low decode address
537 	0x040 = CS[3] & boot CS high decode address
538 	0x048 = PCI I/O low decode address
539 	0x050 = PCI I/O high decode address
540 	0x058 = PCI memory low decode address
541 	0x060 = PCI memory high decode address
542 	0x068 = internal space decode
543 	0x070 = bus error address low processor
544 	0x078 = bus error address high processor
545 
546 	0x400 = RAS[0] low decode address
547 	0x404 = RAS[0] high decode address
548 	0x408 = RAS[1] low decode address
549 	0x40c = RAS[1] high decode address
550 	0x410 = RAS[2] low decode address
551 	0x414 = RAS[2] high decode address
552 	0x418 = RAS[3] low decode address
553 	0x41c = RAS[3] high decode address
554 	0x420 = CS[0] low decode address
555 	0x424 = CS[0] high decode address
556 	0x428 = CS[1] low decode address
557 	0x42c = CS[1] high decode address
558 	0x430 = CS[2] low decode address
559 	0x434 = CS[2] high decode address
560 	0x438 = CS[3] low decode address
561 	0x43c = CS[3] high decode address
562 	0x440 = boot CS low decode address
563 	0x444 = boot CS high decode address
564 	0x448 = DRAM configuration
565 	0x44c = DRAM bank 0 parameters
566 	0x450 = DRAM bank 1 parameters
567 	0x454 = DRAM bank 2 parameters
568 	0x458 = DRAM bank 3 parameters
569 	0x45c = device bank 0 parameters
570 	0x460 = device bank 1 parameters
571 	0x464 = device bank 2 parameters
572 	0x468 = device bank 3 parameters
573 	0x46c = device boot bank parameters
574 	0x470 = address decode error
575 
576 	0x800 = channel 0 DMA byte count
577 	0x804 = channel 1 DMA byte count
578 	0x808 = channel 2 DMA byte count
579 	0x80c = channel 3 DMA byte count
580 	0x810 = channel 0 DMA source address
581 	0x814 = channel 1 DMA source address
582 	0x818 = channel 2 DMA source address
583 	0x81c = channel 3 DMA source address
584 	0x820 = channel 0 DMA destination address
585 	0x824 = channel 1 DMA destination address
586 	0x828 = channel 2 DMA destination address
587 	0x82c = channel 3 DMA destination address
588 	0x830 = channel 0 next record pointer
589 	0x834 = channel 1 next record pointer
590 	0x838 = channel 2 next record pointer
591 	0x83c = channel 3 next record pointer
592 	0x840 = channel 0 control
593 	0x844 = channel 1 control
594 	0x848 = channel 2 control
595 	0x84c = channel 3 control
596 	0x850 = timer/counter 0
597 	0x854 = timer/counter 1
598 	0x858 = timer/counter 2
599 	0x85c = timer/counter 3
600 	0x860 = DMA arbiter control
601 	0x864 = timer/counter control
602 
603 	0xc00 = PCI internal command
604 	0xc04 = PCI internal time out & retry
605 	0xc08 = PCI internal RAS[1:0] bank size
606 	0xc0c = PCI internal RAS[3:2] bank size
607 	0xc10 = PCI internal CS[2:0] bank size
608 	0xc14 = PCI internal CS[3] & boot CS bank size
609 	0xc18 = interrupt cause
610 	0xc1c = CPU interrupt mask
611 	0xc24 = PCI interrupt mask
612 	0xc28 = SErr mask
613 	0xc34 = interrupt acknowledge
614 	0xcf8 = configuration address
615 	0xcfc = configuration data
616 */
617 
READ32_HANDLER(galileo_r)618 static READ32_HANDLER( galileo_r )
619 {
620 	data32_t result = galileo_regs[offset];
621 
622 	/* switch off the offset for special cases */
623 	switch (offset)
624 	{
625 		case 0x850/4:		/* timer/counter 0 count */
626 		case 0x854/4:		/* timer/counter 1 count */
627 		case 0x858/4:		/* timer/counter 2 count */
628 		case 0x85c/4:		/* timer/counter 3 count */
629 		{
630 			int which = offset % 4;
631 
632 			result = timer_count[which];
633 			if (timer_active[which])
634 			{
635 				UINT32 elapsed = (UINT32)(timer_timeelapsed(timer[which]) / TIMER_CLOCK);
636 				result = (result > elapsed) ? (result - elapsed) : 0;
637 			}
638 
639 			/* eat some time for those which poll this register */
640 			activecpu_eat_cycles(100);
641 
642 			if (LOG_TIMERS)
643 				logerror("%06X:hires_timer_r = %08X\n", activecpu_get_pc(), result);
644 			break;
645 		}
646 
647 		case 0xc00/4:		/* PCI internal command */
648 			// code at 40188 loops until this returns non-zero in bit 0
649 			result = 0x0001;
650 			break;
651 
652 		case 0xc18/4:		/* interrupt cause */
653 			if (LOG_GALILEO)
654 				logerror("%06X:Galileo read from offset %03X = %08X\n", activecpu_get_pc(), offset*4, result);
655 			break;
656 
657 		case 0xcfc/4:		/* configuration data */
658 		{
659 			int bus = (galileo_regs[0xcf8/4] >> 16) & 0xff;
660 			int unit = (galileo_regs[0xcf8/4] >> 11) & 0x1f;
661 			int func = (galileo_regs[0xcf8/4] >> 8) & 7;
662 			int reg = (galileo_regs[0xcf8/4] >> 2) & 0x3f;
663 			int type = galileo_regs[0xcf8/4] & 3;
664 
665 			/* unit 0 is the PCI bridge */
666 			if (unit == 0 && func == 0)
667 				result = pci_bridge_r(reg >> 2, type);
668 
669 			/* unit 6 is the 3dfx card */
670 			else if (unit == 6 && func == 0)
671 				result = pci_3dfx_r(reg, type);
672 
673 			/* anything else, just log */
674 			else
675 				logerror("%06X:PCIBus read: bus %d unit %d func %d reg %d type %d = %08X\n", activecpu_get_pc(), bus, unit, func, reg, type, result);
676 			break;
677 		}
678 
679 		case 0x864/4:		/* timer/counter control */
680 			break;
681 
682 		default:
683 			logerror("%06X:Galileo read from offset %03X = %08X\n", activecpu_get_pc(), offset*4, result);
684 			break;
685 	}
686 
687 	return result;
688 }
689 
690 
WRITE32_HANDLER(galileo_w)691 static WRITE32_HANDLER( galileo_w )
692 {
693 	UINT32 oldata = galileo_regs[offset];
694 	COMBINE_DATA(&galileo_regs[offset]);
695 
696 	/* switch off the offset for special cases */
697 	switch (offset)
698 	{
699 		case 0x840/4:		/* DMA channel 0 control */
700 		case 0x844/4:		/* DMA channel 1 control */
701 		case 0x848/4:		/* DMA channel 2 control */
702 		case 0x84c/4:		/* DMA channel 3 control */
703 		{
704 			int which = offset % 4;
705 
706 			/* keep the read only activity bit */
707 			galileo_regs[offset] &= ~0x4000;
708 			galileo_regs[offset] |= (oldata & 0x4000);
709 
710 			/* fetch next record */
711 			if (data & 0x2000)
712 				dma_fetch_next(which);
713 			galileo_regs[offset] &= ~0x2000;
714 
715 			/* if enabling, start the DMA */
716 			if (!(oldata & 0x1000) && (data & 0x1000))
717 				perform_dma(which);
718 			break;
719 		}
720 
721 		case 0x850/4:		/* timer/counter 0 reset value */
722 		case 0x854/4:		/* timer/counter 1 reset value */
723 		case 0x858/4:		/* timer/counter 2 reset value */
724 		case 0x85c/4:		/* timer/counter 3 reset value */
725 		{
726 			int which = offset % 4;
727 
728 			if (which != 0)
729 				data &= 0xffffff;
730 			if (!timer_active[which])
731 				timer_count[which] = data;
732 			if (LOG_TIMERS)
733 				logerror("%06X:timer/counter %d count = %08X [start=%08X]\n", activecpu_get_pc(), offset % 4, data, timer_count[which]);
734 			break;
735 		}
736 
737 		case 0x864/4:		/* timer/counter control */
738 		{
739 			int which, mask;
740 
741 			if (LOG_TIMERS)
742 				logerror("%06X:timer/counter control = %08X\n", activecpu_get_pc(), data);
743 			for (which = 0, mask = 0x01; which < 4; which++, mask <<= 2)
744 			{
745 				if (!timer_active[which] && (data & mask))
746 				{
747 					timer_active[which] = 1;
748 					if (timer_count[which] == 0)
749 					{
750 						timer_count[which] = galileo_regs[0x850/4 + which];
751 						if (which != 0)
752 							timer_count[which] &= 0xffffff;
753 					}
754 					timer_adjust(timer[which], TIMER_CLOCK * timer_count[which], which, 0);
755 					if (LOG_TIMERS)
756 						logerror("Adjusted timer to fire in %f secs\n", TIMER_CLOCK * timer_count[which]);
757 				}
758 				else if (timer_active[which] && !(data & mask))
759 				{
760 					UINT32 elapsed = (UINT32)(timer_timeelapsed(timer[which]) / TIMER_CLOCK);
761 					timer_active[which] = 0;
762 					timer_count[which] = (timer_count[which] > elapsed) ? (timer_count[which] - elapsed) : 0;
763 					timer_adjust(timer[which], TIME_NEVER, which, 0);
764 					if (LOG_TIMERS)
765 						logerror("Disabled timer\n");
766 				}
767 			}
768 			break;
769 		}
770 
771 		case 0xc18/4:		/* IRQ clear */
772 			if (LOG_GALILEO)
773 				logerror("%06X:Galileo write to IRQ clear = %08X & %08X\n", offset*4, data, ~mem_mask);
774 			galileo_regs[offset] = oldata & data;
775 			update_galileo_irqs();
776 			break;
777 
778 		case 0xcf8/4:		/* configuration address */
779 			break;
780 
781 		case 0xcfc/4:		/* configuration data */
782 		{
783 			int bus = (galileo_regs[0xcf8/4] >> 16) & 0xff;
784 			int unit = (galileo_regs[0xcf8/4] >> 11) & 0x1f;
785 			int func = (galileo_regs[0xcf8/4] >> 8) & 7;
786 			int reg = (galileo_regs[0xcf8/4] >> 2) & 0x3f;
787 			int type = galileo_regs[0xcf8/4] & 3;
788 
789 			/* unit 0 is the PCI bridge */
790 			if (unit == 0 && func == 0)
791 				pci_bridge_w(reg >> 2, type, data);
792 
793 			/* unit 6 is the 3dfx card */
794 			else if (unit == 6 && func == 0)
795 				pci_3dfx_w(reg, type, data);
796 
797 			/* anything else, just log */
798 			else
799 				logerror("%06X:PCIBus write: bus %d unit %d func %d reg %d type %d = %08X\n", activecpu_get_pc(), bus, unit, func, reg, type, data);
800 			break;
801 		}
802 
803 		default:
804 			logerror("%06X:Galileo write to offset %03X = %08X & %08X\n", activecpu_get_pc(), offset*4, data, ~mem_mask);
805 			break;
806 	}
807 }
808 
809 
810 
811 /*************************************
812  *
813  *	Misc accesses
814  *
815  *************************************/
816 
WRITE32_HANDLER(seattle_watchdog_w)817 static WRITE32_HANDLER( seattle_watchdog_w )
818 {
819 	activecpu_eat_cycles(100);
820 }
821 
822 
WRITE32_HANDLER(asic_reset_w)823 static WRITE32_HANDLER( asic_reset_w )
824 {
825 	COMBINE_DATA(asic_reset);
826 	if (!(*asic_reset & 0x0002))
827 		midway_ioasic_reset();
828 }
829 
830 
WRITE32_HANDLER(asic_fifo_w)831 static WRITE32_HANDLER( asic_fifo_w )
832 {
833 	midway_ioasic_fifo_w(data);
834 }
835 
836 
837 
838 /*************************************
839  *
840  *	Misc unknown accesses
841  *
842  *************************************/
843 
READ32_HANDLER(unknown1_r)844 static READ32_HANDLER( unknown1_r )
845 {
846 logerror("%06X:unknown1_r\n", activecpu_get_pc());
847 	// code at 1FC10248 loops until this returns non-zero in bit 6
848 	return 0x0040;
849 }
850 
851 
852 
853 /*************************************
854  *
855  *	Analog input handling
856  *
857  *************************************/
858 
READ32_HANDLER(analog_port_r)859 static READ32_HANDLER( analog_port_r )
860 {
861 	return pending_analog_read;
862 }
863 
864 
WRITE32_HANDLER(analog_port_w)865 static WRITE32_HANDLER( analog_port_w )
866 {
867 	if (data < 8 || data > 15)
868 		logerror("%08X:Unexpected analog port select = %08X\n", activecpu_get_pc(), data);
869 	pending_analog_read = readinputport(4 + (data & 7));
870 }
871 
872 
873 
874 /*************************************
875  *
876  *	CarnEvil gun handling
877  *
878  *************************************/
879 
get_crosshair_xy(int player,int * x,int * y)880 static INLINE void get_crosshair_xy(int player, int *x, int *y)
881 {
882 	*x = (((readinputport(4 + player * 2) & 0xff) << 4) * Machine->visible_area.max_x) / 0xfff;
883 	*y = (((readinputport(5 + player * 2) & 0xff) << 2) * Machine->visible_area.max_y) / 0x3ff;
884 }
885 
886 
VIDEO_UPDATE(carnevil)887 static VIDEO_UPDATE( carnevil )
888 {
889 	int beamx, beamy;
890 
891 	/* first do common video update */
892 	video_update_voodoo(bitmap, cliprect);
893 
894 	/* now draw the crosshairs */
895 	get_crosshair_xy(0, &beamx, &beamy);
896 	draw_crosshair(bitmap, beamx, beamy, cliprect);
897 	get_crosshair_xy(1, &beamx, &beamy);
898 	draw_crosshair(bitmap, beamx, beamy, cliprect);
899 }
900 
901 
READ32_HANDLER(carnevil_gun_r)902 static READ32_HANDLER( carnevil_gun_r )
903 {
904 	data32_t result = 0;
905 
906 	switch (offset)
907 	{
908 		case 0:		/* low 8 bits of X */
909 			result = (readinputport(4) << 4) & 0xff;
910 			break;
911 
912 		case 1:		/* upper 4 bits of X */
913 			result = (readinputport(4) >> 4) & 0x0f;
914 			result |= (readinputport(8) & 0x03) << 4;
915 			result |= 0x40;
916 			break;
917 
918 		case 2:		/* low 8 bits of Y */
919 			result = (readinputport(5) << 2) & 0xff;
920 			break;
921 
922 		case 3:		/* upper 4 bits of Y */
923 			result = (readinputport(5) >> 6) & 0x03;
924 			break;
925 
926 		case 4:		/* low 8 bits of X */
927 			result = (readinputport(6) << 4) & 0xff;
928 			break;
929 
930 		case 5:		/* upper 4 bits of X */
931 			result = (readinputport(6) >> 4) & 0x0f;
932 			result |= (readinputport(8) & 0x30);
933 			result |= 0x40;
934 			break;
935 
936 		case 6:		/* low 8 bits of Y */
937 			result = (readinputport(7) << 2) & 0xff;
938 			break;
939 
940 		case 7:		/* upper 4 bits of Y */
941 			result = (readinputport(7) >> 6) & 0x03;
942 			break;
943 	}
944 	return result;
945 }
946 
947 
WRITE32_HANDLER(carnevil_gun_w)948 static WRITE32_HANDLER( carnevil_gun_w )
949 {
950 	logerror("carnevil_gun_w(%d) = %02X\n", offset, data);
951 }
952 
953 
954 
955 /*************************************
956  *
957  *	Speedups
958  *
959  *************************************/
960 
READ32_HANDLER(generic_speedup_r)961 static READ32_HANDLER( generic_speedup_r )
962 {
963 	activecpu_eat_cycles(100);
964 	return *generic_speedup;
965 }
966 
967 
WRITE32_HANDLER(generic_speedup_w)968 static WRITE32_HANDLER( generic_speedup_w )
969 {
970 	activecpu_eat_cycles(100);
971 	COMBINE_DATA(generic_speedup);
972 }
973 
974 
READ32_HANDLER(generic_speedup2_r)975 static READ32_HANDLER( generic_speedup2_r )
976 {
977 	activecpu_eat_cycles(100);
978 	return *generic_speedup2;
979 }
980 
981 
982 
983 /*************************************
984  *
985  *	Memory maps
986  *
987  *************************************/
988 
MEMORY_READ32_START(seattle_readmem)989 static MEMORY_READ32_START( seattle_readmem )
990 	{ 0x00000000, 0x007fffff, MRA32_BANK1 },
991 	{ 0x80000000, 0x807fffff, MRA32_BANK2 },
992 	{ 0x88000000, 0x883fffff, voodoo_regs_r },
993 	{ 0x88400000, 0x887fffff, voodoo_framebuf_r },
994 	{ 0x9fc00000, 0x9fc7ffff, MRA32_BANK3 },
995 	{ 0xa0000000, 0xa07fffff, MRA32_RAM },			// wg3dh only has 4MB; sfrush, blitz99 8MB
996 	{ 0xa8000000, 0xa83fffff, voodoo_regs_r },
997 	{ 0xa8400000, 0xa87fffff, voodoo_framebuf_r },
998 	{ 0xaa000000, 0xaa0003ff, ide_controller32_0_r },
999 	{ 0xaa00040c, 0xaa00040f, MRA32_NOP },			// IDE-related, but annoying
1000 	{ 0xaa000f00, 0xaa000f07, ide_bus_master32_0_r },
1001 	{ 0xac000000, 0xac000fff, galileo_r },
1002 	{ 0xb6000000, 0xb600003f, midway_ioasic_r },
1003 	{ 0xb6100000, 0xb611ffff, cmos_r },
1004 	{ 0xb7300000, 0xb7300003, MRA32_RAM },
1005 	{ 0xb7400000, 0xb7400003, MRA32_RAM },
1006 	{ 0xb7500000, 0xb7500003, vblank_signalled_r },
1007 	{ 0xb7600000, 0xb7600003, unknown1_r },
1008 	{ 0xb7900000, 0xb7900003, MRA32_NOP },			// very noisy -- status LEDs?
1009 	{ 0xb7f00000, 0xb7f00003, MRA32_RAM },
1010 	{ 0xbfc00000, 0xbfc7ffff, MRA32_ROM },
1011 MEMORY_END
1012 
1013 
1014 static MEMORY_WRITE32_START( seattle_writemem )
1015 	{ 0x00000000, 0x007fffff, MWA32_BANK1 },
1016 	{ 0x80000000, 0x807fffff, MWA32_BANK2 },
1017 	{ 0x88000000, 0x883fffff, voodoo_regs_w },
1018 	{ 0x88400000, 0x887fffff, voodoo_framebuf_w },
1019 	{ 0x88800000, 0x88ffffff, voodoo_textureram_w },
1020 	{ 0x9fc00000, 0x9fc7ffff, MWA32_ROM },
1021 	{ 0xa0000000, 0xa07fffff, MWA32_RAM, &rambase },			// wg3dh only has 4MB
1022 	{ 0xa8000000, 0xa83fffff, voodoo_regs_w, &voodoo_regs },
1023 	{ 0xa8400000, 0xa87fffff, voodoo_framebuf_w },
1024 	{ 0xa8800000, 0xa8ffffff, voodoo_textureram_w },
1025 	{ 0xaa000000, 0xaa0003ff, ide_controller32_0_w },
1026 	{ 0xaa000f00, 0xaa000f07, ide_bus_master32_0_w },
1027 	{ 0xac000000, 0xac000fff, galileo_w, &galileo_regs },
1028 	{ 0xb3000000, 0xb3000003, asic_fifo_w },
1029 	{ 0xb6000000, 0xb600003f, midway_ioasic_w },
1030 	{ 0xb6100000, 0xb611ffff, cmos_w, (data32_t **)&generic_nvram, &generic_nvram_size },
1031 	{ 0xb7100000, 0xb7100003, seattle_watchdog_w },
1032 	{ 0xb7300000, 0xb7300003, vblank_enable_w, &vblank_enable },
1033 	{ 0xb7400000, 0xb7400003, vblank_config_w, &vblank_config },
1034 	{ 0xb7700000, 0xb7700003, vblank_clear_w },
1035 	{ 0xb7800000, 0xb7800003, MWA32_NOP },						// unknown
1036 	{ 0xb7900000, 0xb7900003, MWA32_NOP },						// very noisy -- status LEDs?
1037 	{ 0xb7f00000, 0xb7f00003, asic_reset_w, &asic_reset },
1038 	{ 0xbfc00000, 0xbfc7ffff, MWA32_ROM, &rombase },
1039 MEMORY_END
1040 
1041 
1042 
1043 /*************************************
1044  *
1045  *	Input ports
1046  *
1047  *************************************/
1048 
1049 INPUT_PORTS_START( wg3dh )
1050 	PORT_START	    /* DIPs */
1051 	PORT_DIPNAME( 0x0001, 0x0001, "Unknown0001" )
1052 	PORT_DIPSETTING(      0x0001, DEF_STR( Off ))
1053 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1054 	PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
1055 	PORT_DIPNAME( 0x0004, 0x0004, "Unknown0004" )
1056 	PORT_DIPSETTING(      0x0004, DEF_STR( Off ))
1057 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1058 	PORT_DIPNAME( 0x0008, 0x0008, "Unknown0008" )
1059 	PORT_DIPSETTING(      0x0008, DEF_STR( Off ))
1060 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1061 	PORT_DIPNAME( 0x0010, 0x0010, "Unknown0010" )
1062 	PORT_DIPSETTING(      0x0010, DEF_STR( Off ))
1063 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1064 	PORT_DIPNAME( 0x0020, 0x0020, "Unknown0020" )
1065 	PORT_DIPSETTING(      0x0020, DEF_STR( Off ))
1066 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1067 	PORT_DIPNAME( 0x0040, 0x0040, "Unknown0040" )
1068 	PORT_DIPSETTING(      0x0040, DEF_STR( Off ))
1069 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1070 	PORT_DIPNAME( 0x0080, 0x0080, "Unknown0080" )
1071 	PORT_DIPSETTING(      0x0080, DEF_STR( Off ))
1072 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1073 	PORT_DIPNAME( 0x0100, 0x0100, "Unknown0100" )
1074 	PORT_DIPSETTING(      0x0100, DEF_STR( Off ))
1075 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1076 	PORT_DIPNAME( 0x0200, 0x0200, "Unknown0200" )
1077 	PORT_DIPSETTING(      0x0200, DEF_STR( Off ))
1078 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1079 	PORT_DIPNAME( 0x0400, 0x0400, "Unknown0400" )
1080 	PORT_DIPSETTING(      0x0400, DEF_STR( Off ))
1081 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1082 	PORT_DIPNAME( 0x0800, 0x0800, "Unknown0800" )
1083 	PORT_DIPSETTING(      0x0800, DEF_STR( Off ))
1084 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1085 	PORT_DIPNAME( 0x1000, 0x1000, "Unknown1000" )
1086 	PORT_DIPSETTING(      0x1000, DEF_STR( Off ))
1087 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1088 	PORT_DIPNAME( 0x2000, 0x2000, "Unknown2000" )
1089 	PORT_DIPSETTING(      0x2000, DEF_STR( Off ))
1090 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1091 	PORT_DIPNAME( 0x4000, 0x4000, "Unknown4000" )
1092 	PORT_DIPSETTING(      0x4000, DEF_STR( Off ))
1093 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1094 	PORT_DIPNAME( 0x8000, 0x8000, "Unknown8000" )
1095 	PORT_DIPSETTING(      0x8000, DEF_STR( Off ))
1096 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1097 
1098 	PORT_START
1099 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
1100 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
1101 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
1102 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */
1103 	PORT_BITX(0x0010, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE ) /* Test switch */
1104 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
1105 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
1106 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )
1107 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN4 )
1108 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START3 )
1109 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START4 )
1110 	PORT_BITX(0x0800, IP_ACTIVE_LOW, 0, "Volume Down", KEYCODE_MINUS, IP_JOY_NONE )
1111 	PORT_BITX(0x1000, IP_ACTIVE_LOW, 0, "Volume Up", KEYCODE_EQUALS, IP_JOY_NONE )
1112 	PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED )
1113 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )	/* Bill */
1114 
1115 	PORT_START
1116 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 | IPF_8WAY )
1117 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 | IPF_8WAY )
1118 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 | IPF_8WAY )
1119 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
1120 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
1121 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
1122 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
1123 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1 )	/* 3d cam */
1124 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_8WAY )
1125 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_8WAY )
1126 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_8WAY )
1127 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
1128 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
1129 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
1130 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
1131 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1132 
1133 	PORT_START
1134 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER3 | IPF_8WAY )
1135 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER3 | IPF_8WAY )
1136 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER3 | IPF_8WAY )
1137 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 | IPF_8WAY )
1138 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
1139 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
1140 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
1141 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
1142 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER4 | IPF_8WAY )
1143 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER4 | IPF_8WAY )
1144 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER4 | IPF_8WAY )
1145 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER4 | IPF_8WAY )
1146 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
1147 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 )
1148 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
1149 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1150 INPUT_PORTS_END
1151 
1152 
1153 INPUT_PORTS_START( mace )
1154 	PORT_START	    /* DIPs */
1155 	PORT_DIPNAME( 0x0001, 0x0001, "Unknown0001" )
1156 	PORT_DIPSETTING(      0x0001, DEF_STR( Off ))
1157 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1158 	PORT_DIPNAME( 0x0002, 0x0002, "Unknown0002" )
1159 	PORT_DIPSETTING(      0x0002, DEF_STR( Off ))
1160 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1161 	PORT_DIPNAME( 0x0004, 0x0004, "Unknown0004" )
1162 	PORT_DIPSETTING(      0x0004, DEF_STR( Off ))
1163 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1164 	PORT_DIPNAME( 0x0008, 0x0008, "Unknown0008" )
1165 	PORT_DIPSETTING(      0x0008, DEF_STR( Off ))
1166 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1167 	PORT_DIPNAME( 0x0010, 0x0010, "Unknown0010" )
1168 	PORT_DIPSETTING(      0x0010, DEF_STR( Off ))
1169 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1170 	PORT_DIPNAME( 0x0020, 0x0020, "Unknown0020" )
1171 	PORT_DIPSETTING(      0x0020, DEF_STR( Off ))
1172 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1173 	PORT_SERVICE( 0x0040, IP_ACTIVE_LOW )
1174 	PORT_DIPNAME( 0x0080, 0x0080, "Unknown0080" )
1175 	PORT_DIPSETTING(      0x0080, DEF_STR( Off ))
1176 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1177 	PORT_DIPNAME( 0x0100, 0x0100, "Unknown0100" )
1178 	PORT_DIPSETTING(      0x0100, DEF_STR( Off ))
1179 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1180 	PORT_DIPNAME( 0x0200, 0x0200, "Unknown0200" )
1181 	PORT_DIPSETTING(      0x0200, DEF_STR( Off ))
1182 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1183 	PORT_DIPNAME( 0x0400, 0x0400, "Unknown0400" )
1184 	PORT_DIPSETTING(      0x0400, DEF_STR( Off ))
1185 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1186 	PORT_DIPNAME( 0x0800, 0x0800, "Unknown0800" )
1187 	PORT_DIPSETTING(      0x0800, DEF_STR( Off ))
1188 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1189 	PORT_DIPNAME( 0x1000, 0x1000, "Unknown1000" )
1190 	PORT_DIPSETTING(      0x1000, DEF_STR( Off ))
1191 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1192 	PORT_DIPNAME( 0x2000, 0x2000, "Unknown2000" )
1193 	PORT_DIPSETTING(      0x2000, DEF_STR( Off ))
1194 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1195 	PORT_DIPNAME( 0x4000, 0x4000, "Unknown4000" )
1196 	PORT_DIPSETTING(      0x4000, DEF_STR( Off ))
1197 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1198 	PORT_DIPNAME( 0x8000, 0x0000, "Resolution" )
1199 	PORT_DIPSETTING(      0x8000, "Low" )
1200 	PORT_DIPSETTING(      0x0000, "Medium" )
1201 
1202 	PORT_START
1203 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
1204 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
1205 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
1206 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */
1207 	PORT_BITX(0x0010, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE ) /* Test switch */
1208 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
1209 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
1210 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )
1211 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN4 )
1212 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START3 )
1213 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START4 )
1214 	PORT_BITX(0x0800, IP_ACTIVE_LOW, 0, "Volume Down", KEYCODE_MINUS, IP_JOY_NONE )
1215 	PORT_BITX(0x1000, IP_ACTIVE_LOW, 0, "Volume Up", KEYCODE_EQUALS, IP_JOY_NONE )
1216 	PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED )
1217 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )	/* Bill */
1218 
1219 	PORT_START
1220 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 | IPF_8WAY )
1221 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 | IPF_8WAY )
1222 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 | IPF_8WAY )
1223 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
1224 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
1225 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
1226 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
1227 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1 )	/* 3d cam */
1228 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_8WAY )
1229 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_8WAY )
1230 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_8WAY )
1231 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
1232 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
1233 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
1234 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
1235 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1236 
1237 	PORT_START
1238 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER3 | IPF_8WAY )
1239 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER3 | IPF_8WAY )
1240 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER3 | IPF_8WAY )
1241 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 | IPF_8WAY )
1242 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
1243 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
1244 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
1245 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
1246 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER4 | IPF_8WAY )
1247 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER4 | IPF_8WAY )
1248 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER4 | IPF_8WAY )
1249 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER4 | IPF_8WAY )
1250 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
1251 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 )
1252 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
1253 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1254 INPUT_PORTS_END
1255 
1256 
1257 INPUT_PORTS_START( sfrush )
1258 	PORT_START	    /* DIPs */
1259 	PORT_BITX(0x0001, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE ) /* Test switch */
1260 	PORT_DIPNAME( 0x0002, 0x0002, "Boot ROM Test" )
1261 	PORT_DIPSETTING(      0x0002, DEF_STR( Off ))
1262 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1263 	PORT_DIPNAME( 0x0004, 0x0004, "Unknown0004" )
1264 	PORT_DIPSETTING(      0x0004, DEF_STR( Off ))
1265 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1266 	PORT_DIPNAME( 0x0008, 0x0008, "Unknown0008" )
1267 	PORT_DIPSETTING(      0x0008, DEF_STR( Off ))
1268 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1269 	PORT_DIPNAME( 0x0010, 0x0010, "Unknown0010" )
1270 	PORT_DIPSETTING(      0x0010, DEF_STR( Off ))
1271 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1272 	PORT_DIPNAME( 0x0020, 0x0020, "Unknown0020" )
1273 	PORT_DIPSETTING(      0x0020, DEF_STR( Off ))
1274 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1275 	PORT_DIPNAME( 0x0040, 0x0040, "Unknown0040" )
1276 	PORT_DIPSETTING(      0x0040, DEF_STR( Off ))
1277 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1278 	PORT_DIPNAME( 0x0080, 0x0080, "Unknown0080" )
1279 	PORT_DIPSETTING(      0x0080, DEF_STR( Off ))
1280 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1281 	PORT_DIPNAME( 0x0100, 0x0100, "Unknown0100" )
1282 	PORT_DIPSETTING(      0x0100, DEF_STR( Off ))
1283 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1284 	PORT_DIPNAME( 0x0200, 0x0200, "Unknown0200" )
1285 	PORT_DIPSETTING(      0x0200, DEF_STR( Off ))
1286 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1287 	PORT_DIPNAME( 0x0400, 0x0400, "Unknown0400" )
1288 	PORT_DIPSETTING(      0x0400, DEF_STR( Off ))
1289 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1290 	PORT_DIPNAME( 0x0800, 0x0800, "Unknown0800" )
1291 	PORT_DIPSETTING(      0x0800, DEF_STR( Off ))
1292 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1293 	PORT_DIPNAME( 0x1000, 0x1000, "Unknown1000" )
1294 	PORT_DIPSETTING(      0x1000, DEF_STR( Off ))
1295 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1296 	PORT_DIPNAME( 0x2000, 0x2000, "Unknown2000" )
1297 	PORT_DIPSETTING(      0x2000, DEF_STR( Off ))
1298 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1299 	PORT_DIPNAME( 0x4000, 0x4000, "Unknown4000" )
1300 	PORT_DIPSETTING(      0x4000, DEF_STR( Off ))
1301 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1302 	PORT_DIPNAME( 0x8000, 0x8000, "Unknown8000" )
1303 	PORT_DIPSETTING(      0x8000, DEF_STR( Off ))
1304 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1305 
1306 	PORT_START
1307 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )	/* coin 1 */
1308 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )	/* coin 2 */
1309 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )	/* abort */
1310 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) 	/* tilt */
1311 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE2 )	/* test */
1312 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON6 | IPF_PLAYER1 )	/* reverse */
1313 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )	/* service coin */
1314 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )	/* coin 3 */
1315 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN4 )	/* coin 4 */
1316 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
1317 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START3 )
1318 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_START4 )
1319 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED )
1320 	PORT_BIT( 0xe000, IP_ACTIVE_LOW, IPT_UNUSED )
1321 
1322 	PORT_START
1323 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )	/* view 1 */
1324 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )	/* view 2 */
1325 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2 )	/* view 3 */
1326 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER2 )	/* music */
1327 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )	/* track 1 */
1328 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )	/* track 2 */
1329 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER3 )	/* track 3 */
1330 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER3 )	/* track 4 */
1331 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )	/* 1st gear */
1332 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )	/* 2nd gear */
1333 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1 )	/* 3rd gear */
1334 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER1 )	/* 4th gear */
1335 	PORT_BITX(0x1000, IP_ACTIVE_LOW, 0, "Volume Up", KEYCODE_EQUALS, IP_JOY_NONE )
1336 	PORT_BITX(0x2000, IP_ACTIVE_LOW, 0, "Volume Down", KEYCODE_MINUS, IP_JOY_NONE )
1337 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
1338 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1339 
1340 	PORT_START
1341 	PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
1342 
1343 	PORT_START
1344 	PORT_BIT( 0xff, 0x80, IPT_SPECIAL )
1345 
1346 	PORT_START
1347 	PORT_BIT( 0xff, 0x80, IPT_SPECIAL )
1348 
1349 	PORT_START
1350 	PORT_BIT( 0xff, 0x80, IPT_SPECIAL )
1351 
1352 	PORT_START
1353 	PORT_BIT( 0xff, 0x80, IPT_SPECIAL )
1354 
1355 	PORT_START
1356 	PORT_ANALOG( 0xff, 0x00, IPT_PEDAL | IPF_PLAYER1, 25, 20, 0x00, 0xff )
1357 
1358 	PORT_START
1359 	PORT_ANALOG( 0xff, 0x00, IPT_PEDAL | IPF_PLAYER2, 25, 100, 0x00, 0xff )
1360 
1361 	PORT_START
1362 	PORT_ANALOG( 0xff, 0x00, IPT_PEDAL | IPF_PLAYER3, 25, 100, 0x00, 0xff )
1363 
1364 	PORT_START
1365 	PORT_ANALOG( 0xff, 0x80, IPT_PADDLE, 25, 5, 0x10, 0xf0 )
1366 INPUT_PORTS_END
1367 
1368 
1369 INPUT_PORTS_START( calspeed )
1370 	PORT_START	    /* DIPs */
1371 	PORT_DIPNAME( 0x0001, 0x0001, "Unknown0001" )
1372 	PORT_DIPSETTING(      0x0001, DEF_STR( Off ))
1373 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1374 	PORT_DIPNAME( 0x0002, 0x0002, "Unknown0002" )
1375 	PORT_DIPSETTING(      0x0002, DEF_STR( Off ))
1376 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1377 	PORT_DIPNAME( 0x0004, 0x0004, "Unknown0004" )
1378 	PORT_DIPSETTING(      0x0004, DEF_STR( Off ))
1379 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1380 	PORT_DIPNAME( 0x0008, 0x0008, "Unknown0008" )
1381 	PORT_DIPSETTING(      0x0008, DEF_STR( Off ))
1382 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1383 	PORT_DIPNAME( 0x0010, 0x0010, "Unknown0010" )
1384 	PORT_DIPSETTING(      0x0010, DEF_STR( Off ))
1385 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1386 	PORT_DIPNAME( 0x0020, 0x0020, "Unknown0020" )
1387 	PORT_DIPSETTING(      0x0020, DEF_STR( Off ))
1388 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1389 	PORT_DIPNAME( 0x0040, 0x0040, "Boot ROM Test" )
1390 	PORT_DIPSETTING(      0x0040, DEF_STR( Off ))
1391 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1392 	PORT_BITX(0x0080, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE ) /* Test switch */
1393 	PORT_DIPNAME( 0x0100, 0x0100, "Unknown0100" )
1394 	PORT_DIPSETTING(      0x0100, DEF_STR( Off ))
1395 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1396 	PORT_DIPNAME( 0x0200, 0x0200, "Unknown0200" )
1397 	PORT_DIPSETTING(      0x0200, DEF_STR( Off ))
1398 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1399 	PORT_DIPNAME( 0x0400, 0x0400, "Unknown0400" )
1400 	PORT_DIPSETTING(      0x0400, DEF_STR( Off ))
1401 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1402 	PORT_DIPNAME( 0x0800, 0x0800, "Unknown0800" )
1403 	PORT_DIPSETTING(      0x0800, DEF_STR( Off ))
1404 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1405 	PORT_DIPNAME( 0x1000, 0x1000, "Unknown1000" )
1406 	PORT_DIPSETTING(      0x1000, DEF_STR( Off ))
1407 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1408 	PORT_DIPNAME( 0x2000, 0x2000, "Unknown2000" )
1409 	PORT_DIPSETTING(      0x2000, DEF_STR( Off ))
1410 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1411 	PORT_DIPNAME( 0x4000, 0x4000, "Unknown4000" )
1412 	PORT_DIPSETTING(      0x4000, DEF_STR( Off ))
1413 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1414 	PORT_DIPNAME( 0x8000, 0x8000, "Unknown8000" )
1415 	PORT_DIPSETTING(      0x8000, DEF_STR( Off ))
1416 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1417 
1418 	PORT_START
1419 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )	/* coin 1 */
1420 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )	/* coin 2 */
1421 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )	/* start */
1422 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) 	/* tilt */
1423 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE2 )	/* test */
1424 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED )
1425 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )	/* service coin */
1426 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )	/* coin 3 */
1427 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN4 )	/* coin 4 */
1428 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
1429 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START3 )
1430 	PORT_BITX(0x0800, IP_ACTIVE_LOW, 0, "Volume Down", KEYCODE_MINUS, IP_JOY_NONE )
1431 	PORT_BITX(0x1000, IP_ACTIVE_LOW, 0, "Volume Up", KEYCODE_EQUALS, IP_JOY_NONE )
1432 	PORT_BIT( 0xe000, IP_ACTIVE_LOW, IPT_UNUSED )
1433 
1434 	PORT_START
1435 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
1436 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER2 )	/* radio */
1437 	PORT_BIT( 0x000c, IP_ACTIVE_LOW, IPT_UNUSED )
1438 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )	/* road cam */
1439 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )	/* tailgate cam */
1440 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2 )	/* sky cam */
1441 	PORT_BIT( 0x0f80, IP_ACTIVE_LOW, IPT_UNUSED )
1442 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )	/* 1st gear */
1443 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )	/* 2nd gear */
1444 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1 )	/* 3rd gear */
1445 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER1 )	/* 4th gear */
1446 
1447 	PORT_START
1448 	PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
1449 
1450 	PORT_START
1451 	PORT_ANALOG( 0xff, 0x80, IPT_PADDLE, 25, 5, 0x10, 0xf0 )
1452 
1453 	PORT_START
1454 	PORT_ANALOG( 0xff, 0x00, IPT_PEDAL | IPF_PLAYER1, 25, 20, 0x00, 0xff )
1455 
1456 	PORT_START
1457 	PORT_ANALOG( 0xff, 0x00, IPT_PEDAL | IPF_PLAYER2, 25, 100, 0x00, 0xff )
1458 
1459 	PORT_START
1460 	PORT_BIT( 0xff, 0x80, IPT_SPECIAL )
1461 
1462 	PORT_START
1463 	PORT_BIT( 0xff, 0x80, IPT_SPECIAL )
1464 
1465 	PORT_START
1466 	PORT_BIT( 0xff, 0x80, IPT_SPECIAL )
1467 
1468 	PORT_START
1469 	PORT_BIT( 0xff, 0x80, IPT_SPECIAL )
1470 
1471 	PORT_START
1472 	PORT_BIT( 0xff, 0x80, IPT_SPECIAL )
1473 INPUT_PORTS_END
1474 
1475 
1476 INPUT_PORTS_START( biofreak )
1477 	PORT_START	    /* DIPs */
1478 	PORT_DIPNAME( 0x0001, 0x0001, "Unknown0001" )
1479 	PORT_DIPSETTING(      0x0001, DEF_STR( Off ))
1480 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1481 	PORT_DIPNAME( 0x0002, 0x0002, "Unknown0002" )
1482 	PORT_DIPSETTING(      0x0002, DEF_STR( Off ))
1483 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1484 	PORT_DIPNAME( 0x0004, 0x0004, "Unknown0004" )
1485 	PORT_DIPSETTING(      0x0004, DEF_STR( Off ))
1486 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1487 	PORT_DIPNAME( 0x0008, 0x0008, "Unknown0008" )
1488 	PORT_DIPSETTING(      0x0008, DEF_STR( Off ))
1489 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1490 	PORT_DIPNAME( 0x0010, 0x0010, "Unknown0010" )
1491 	PORT_DIPSETTING(      0x0010, DEF_STR( Off ))
1492 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1493 	PORT_DIPNAME( 0x0020, 0x0020, "Unknown0020" )
1494 	PORT_DIPSETTING(      0x0020, DEF_STR( Off ))
1495 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1496 	PORT_DIPNAME( 0x0040, 0x0040, "Unknown0040" )
1497 	PORT_DIPSETTING(      0x0040, DEF_STR( Off ))
1498 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1499 	PORT_DIPNAME( 0x0080, 0x0080, "Unknown0080" )
1500 	PORT_DIPSETTING(      0x0080, DEF_STR( Off ))
1501 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1502 	PORT_DIPNAME( 0x0100, 0x0100, "Unknown0100" )
1503 	PORT_DIPSETTING(      0x0100, DEF_STR( Off ))
1504 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1505 	PORT_DIPNAME( 0x0200, 0x0200, "Unknown0200" )
1506 	PORT_DIPSETTING(      0x0200, DEF_STR( Off ))
1507 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1508 	PORT_DIPNAME( 0x0400, 0x0400, "Unknown0400" )
1509 	PORT_DIPSETTING(      0x0400, DEF_STR( Off ))
1510 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1511 	PORT_DIPNAME( 0x0800, 0x0800, "Unknown0800" )
1512 	PORT_DIPSETTING(      0x0800, DEF_STR( Off ))
1513 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1514 	PORT_DIPNAME( 0x1000, 0x1000, "Unknown1000" )
1515 	PORT_DIPSETTING(      0x1000, DEF_STR( Off ))
1516 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1517 	PORT_DIPNAME( 0x2000, 0x2000, "Unknown2000" )
1518 	PORT_DIPSETTING(      0x2000, DEF_STR( Off ))
1519 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1520 	PORT_DIPNAME( 0x4000, 0x4000, "Unknown4000" )
1521 	PORT_DIPSETTING(      0x4000, DEF_STR( Off ))
1522 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1523 	PORT_DIPNAME( 0x8000, 0x8000, "Unknown8000" )
1524 	PORT_DIPSETTING(      0x8000, DEF_STR( Off ))
1525 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1526 
1527 	PORT_START
1528 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
1529 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
1530 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
1531 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */
1532 	PORT_BITX(0x0010, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE ) /* Test switch */
1533 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
1534 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
1535 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )
1536 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN4 )
1537 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START3 )
1538 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START4 )
1539 	PORT_BITX(0x0800, IP_ACTIVE_LOW, 0, "Volume Down", KEYCODE_MINUS, IP_JOY_NONE )
1540 	PORT_BITX(0x1000, IP_ACTIVE_LOW, 0, "Volume Up", KEYCODE_EQUALS, IP_JOY_NONE )
1541 	PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED )
1542 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )	/* Bill */
1543 
1544 	PORT_START
1545 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 | IPF_8WAY )
1546 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 | IPF_8WAY )
1547 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 | IPF_8WAY )
1548 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
1549 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
1550 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
1551 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
1552 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
1553 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_8WAY )
1554 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_8WAY )
1555 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_8WAY )
1556 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
1557 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
1558 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
1559 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
1560 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1561 
1562 	PORT_START
1563 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER3 | IPF_8WAY )
1564 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER3 | IPF_8WAY )
1565 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER3 | IPF_8WAY )
1566 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 | IPF_8WAY )
1567 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
1568 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
1569 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
1570 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
1571 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER4 | IPF_8WAY )
1572 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER4 | IPF_8WAY )
1573 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER4 | IPF_8WAY )
1574 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER4 | IPF_8WAY )
1575 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
1576 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 )
1577 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
1578 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1579 INPUT_PORTS_END
1580 
1581 
1582 INPUT_PORTS_START( blitz )
1583 	PORT_START	    /* DIPs */
1584 	PORT_DIPNAME( 0x0001, 0x0000, "Coinage Source" )
1585 	PORT_DIPSETTING(      0x0001, "Dipswitch" )
1586 	PORT_DIPSETTING(      0x0000, "CMOS" )
1587 	PORT_DIPNAME( 0x000e, 0x000e, DEF_STR( Coinage ))
1588 	PORT_DIPSETTING(      0x000e, "Mode 1" )
1589 	PORT_DIPSETTING(      0x0008, "Mode 2" )
1590 	PORT_DIPSETTING(      0x0009, "Mode 3" )
1591 	PORT_DIPSETTING(      0x0002, "Mode 4" )
1592 	PORT_DIPSETTING(      0x000c, "Mode ECA" )
1593 //	PORT_DIPSETTING(      0x0004, "Not Used 1" )		/* Marked as Unused in the manual */
1594 //	PORT_DIPSETTING(      0x0008, "Not Used 2" )		/* Marked as Unused in the manual */
1595 	PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ))
1596 	PORT_DIPNAME( 0x0030, 0x0030, "Curency Type" )
1597 	PORT_DIPSETTING(      0x0030, "USA" )
1598 	PORT_DIPSETTING(      0x0020, "French" )
1599 	PORT_DIPSETTING(      0x0010, "German" )
1600 //	PORT_DIPSETTING(      0x0000, "Not Used" )		/* Marked as Unused in the manual */
1601 	PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ))
1602 	PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Unknown ))	/* Marked as Unused in the manual */
1603 	PORT_DIPSETTING(      0x0040, "0" )
1604 	PORT_DIPSETTING(      0x0000, "1" )
1605 	PORT_DIPNAME( 0x0080, 0x0080, "Power Up Test Loop" )
1606 	PORT_DIPSETTING(      0x0080, "One Time" )
1607 	PORT_DIPSETTING(      0x0000, "Continuous" )
1608 	PORT_DIPNAME( 0x0100, 0x0100, "Joysticks" )
1609 	PORT_DIPSETTING(      0x0100, "8-Way" )
1610 	PORT_DIPSETTING(      0x0000, "49-Way" )
1611 	PORT_DIPNAME( 0x0600, 0x0200, "Graphics Mode" )
1612 	PORT_DIPSETTING(      0x0200, "512x385 @ 25KHz" )
1613 	PORT_DIPSETTING(      0x0400, "512x256 @ 15KHz" )
1614 //	PORT_DIPSETTING(      0x0600, "0" )			/* Marked as Unused in the manual */
1615 //	PORT_DIPSETTING(      0x0000, "3" )			/* Marked as Unused in the manual */
1616 	PORT_DIPNAME( 0x1800, 0x1800, "Graphics Speed" )
1617 	PORT_DIPSETTING(      0x0000, "45 MHz" )
1618 	PORT_DIPSETTING(      0x0800, "47 MHz" )
1619 	PORT_DIPSETTING(      0x1000, "49 MHz" )
1620 	PORT_DIPSETTING(      0x1800, "51 MHz" )
1621 	PORT_DIPNAME( 0x2000, 0x0000, "Bill Validator" )
1622 	PORT_DIPSETTING(      0x2000, "None" )
1623 	PORT_DIPSETTING(      0x0000, "One" )
1624 	PORT_DIPNAME( 0x4000, 0x0000, "Power On Self Test" )
1625 	PORT_DIPSETTING(      0x0000, DEF_STR( No ))
1626 	PORT_DIPSETTING(      0x4000, DEF_STR( Yes ))
1627 	PORT_DIPNAME( 0x8000, 0x8000, "Test Switch" )
1628 	PORT_DIPSETTING(      0x8000, DEF_STR( Off ))
1629 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1630 
1631 	PORT_START
1632 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
1633 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
1634 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
1635 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */
1636 	PORT_BITX(0x0010, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE ) /* Test switch */
1637 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
1638 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
1639 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )
1640 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN4 )
1641 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START3 )
1642 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START4 )
1643 	PORT_BITX(0x0800, IP_ACTIVE_LOW, 0, "Volume Down", KEYCODE_MINUS, IP_JOY_NONE )
1644 	PORT_BITX(0x1000, IP_ACTIVE_LOW, 0, "Volume Up", KEYCODE_EQUALS, IP_JOY_NONE )
1645 	PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED )
1646 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )	/* Bill */
1647 
1648 	PORT_START
1649 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 | IPF_8WAY )
1650 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 | IPF_8WAY )
1651 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 | IPF_8WAY )
1652 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
1653 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
1654 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
1655 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
1656 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
1657 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_8WAY )
1658 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_8WAY )
1659 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_8WAY )
1660 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
1661 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
1662 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
1663 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
1664 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1665 
1666 	PORT_START
1667 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER3 | IPF_8WAY )
1668 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER3 | IPF_8WAY )
1669 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER3 | IPF_8WAY )
1670 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 | IPF_8WAY )
1671 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
1672 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
1673 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
1674 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
1675 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER4 | IPF_8WAY )
1676 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER4 | IPF_8WAY )
1677 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER4 | IPF_8WAY )
1678 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER4 | IPF_8WAY )
1679 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
1680 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 )
1681 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
1682 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1683 INPUT_PORTS_END
1684 
1685 
1686 INPUT_PORTS_START( blitz99 )
1687 	PORT_START	    /* DIPs */
1688 	PORT_DIPNAME( 0x0001, 0x0000, "Coinage Source" )
1689 	PORT_DIPSETTING(      0x0001, "Dipswitch" )
1690 	PORT_DIPSETTING(      0x0000, "CMOS" )
1691 	PORT_DIPNAME( 0x003e, 0x003e, DEF_STR( Coinage ))
1692 	PORT_DIPSETTING(      0x003e, "USA 1" )
1693 	PORT_DIPSETTING(      0x003c, "USA 2" )
1694 	PORT_DIPSETTING(      0x003a, "USA 3" )
1695 	PORT_DIPSETTING(      0x0038, "USA 4" )
1696 	PORT_DIPSETTING(      0x0036, "USA 5" )
1697 	PORT_DIPSETTING(      0x0034, "USA 6" )
1698 	PORT_DIPSETTING(      0x0032, "USA 7" )
1699 	PORT_DIPSETTING(      0x0030, "USA ECA" )
1700 	PORT_DIPSETTING(      0x002e, "France 1" )
1701 	PORT_DIPSETTING(      0x002c, "France 2" )
1702 	PORT_DIPSETTING(      0x002a, "France 3" )
1703 	PORT_DIPSETTING(      0x0028, "France 4" )
1704 	PORT_DIPSETTING(      0x0026, "France 5" )
1705 	PORT_DIPSETTING(      0x0024, "France 6" )
1706 	PORT_DIPSETTING(      0x0022, "France 7" )
1707 	PORT_DIPSETTING(      0x0020, "France ECA" )
1708 	PORT_DIPSETTING(      0x001e, "German 1" )
1709 	PORT_DIPSETTING(      0x001c, "German 2" )
1710 	PORT_DIPSETTING(      0x001a, "German 3" )
1711 	PORT_DIPSETTING(      0x0018, "German 4" )
1712 	PORT_DIPSETTING(      0x0016, "German 5" )
1713 //	PORT_DIPSETTING(      0x0014, "German 5" )
1714 //	PORT_DIPSETTING(      0x0012, "German 5" )
1715 	PORT_DIPSETTING(      0x0010, "German ECA" )
1716 	PORT_DIPSETTING(      0x000e, "U.K. 1 ECA" )
1717 	PORT_DIPSETTING(      0x000c, "U.K. 2 ECA" )
1718 	PORT_DIPSETTING(      0x000a, "U.K. 3 ECA" )
1719 	PORT_DIPSETTING(      0x0008, "U.K. 4" )
1720 	PORT_DIPSETTING(      0x0006, "U.K. 5" )
1721 	PORT_DIPSETTING(      0x0004, "U.K. 6 ECA" )
1722 	PORT_DIPSETTING(      0x0002, "U.K. 7 ECA" )
1723 	PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ))
1724 	PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Unknown ))
1725 	PORT_DIPSETTING(      0x0040, "0" )
1726 	PORT_DIPSETTING(      0x0000, "1" )
1727 	PORT_DIPNAME( 0x0080, 0x0080, "Power Up Test Loop" )
1728 	PORT_DIPSETTING(      0x0080, DEF_STR( No ))
1729 	PORT_DIPSETTING(      0x0000, DEF_STR( Yes ))
1730 	PORT_DIPNAME( 0x0100, 0x0100, "Joysticks" )
1731 	PORT_DIPSETTING(      0x0100, "8-Way" )
1732 	PORT_DIPSETTING(      0x0000, "49-Way" )
1733 	PORT_DIPNAME( 0x0600, 0x0200, "Graphics Mode" )
1734 	PORT_DIPSETTING(      0x0200, "512x385 @ 25KHz" )
1735 	PORT_DIPSETTING(      0x0400, "512x256 @ 15KHz" )
1736 //	PORT_DIPSETTING(      0x0600, "0" )			/* Marked as Unused in the manual */
1737 //	PORT_DIPSETTING(      0x0000, "3" )			/* Marked as Unused in the manual */
1738 	PORT_DIPNAME( 0x1800, 0x1800, "Graphics Speed" )
1739 	PORT_DIPSETTING(      0x0000, "45 MHz" )
1740 	PORT_DIPSETTING(      0x0800, "47 MHz" )
1741 	PORT_DIPSETTING(      0x1000, "49 MHz" )
1742 	PORT_DIPSETTING(      0x1800, "51 MHz" )
1743 	PORT_DIPNAME( 0x2000, 0x0000, "Players" )
1744 	PORT_DIPSETTING(      0x2000, "2" )
1745 	PORT_DIPSETTING(      0x0000, "4" )
1746 	PORT_DIPNAME( 0x4000, 0x0000, "Power On Self Test" )
1747 	PORT_DIPSETTING(      0x0000, DEF_STR( No ))
1748 	PORT_DIPSETTING(      0x4000, DEF_STR( Yes ))
1749 	PORT_DIPNAME( 0x8000, 0x8000, "Test Switch" )
1750 	PORT_DIPSETTING(      0x8000, DEF_STR( Off ))
1751 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1752 
1753 	PORT_START
1754 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
1755 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
1756 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
1757 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */
1758 	PORT_BITX(0x0010, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE ) /* Test switch */
1759 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
1760 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
1761 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN3 )
1762 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN4 )
1763 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START3 )
1764 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START4 )
1765 	PORT_BITX(0x0800, IP_ACTIVE_LOW, 0, "Volume Down", KEYCODE_MINUS, IP_JOY_NONE )
1766 	PORT_BITX(0x1000, IP_ACTIVE_LOW, 0, "Volume Up", KEYCODE_EQUALS, IP_JOY_NONE )
1767 	PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED )
1768 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )	/* Bill */
1769 
1770 	PORT_START
1771 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 | IPF_8WAY )
1772 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 | IPF_8WAY )
1773 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 | IPF_8WAY )
1774 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
1775 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
1776 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
1777 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
1778 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
1779 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_8WAY )
1780 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_8WAY )
1781 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_8WAY )
1782 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
1783 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
1784 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
1785 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
1786 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1787 
1788 	PORT_START
1789 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER3 | IPF_8WAY )
1790 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER3 | IPF_8WAY )
1791 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER3 | IPF_8WAY )
1792 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 | IPF_8WAY )
1793 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
1794 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
1795 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
1796 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
1797 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER4 | IPF_8WAY )
1798 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER4 | IPF_8WAY )
1799 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER4 | IPF_8WAY )
1800 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER4 | IPF_8WAY )
1801 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
1802 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 )
1803 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
1804 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
1805 INPUT_PORTS_END
1806 
1807 
1808 INPUT_PORTS_START( carnevil )
1809 	PORT_START	    /* DIPs */
1810 	PORT_DIPNAME( 0x0001, 0x0000, "Coinage Source" )
1811 	PORT_DIPSETTING(      0x0001, "Dipswitch" )
1812 	PORT_DIPSETTING(      0x0000, "CMOS" )
1813 	PORT_DIPNAME( 0x003e, 0x003e, DEF_STR( Coinage ))
1814 	PORT_DIPSETTING(      0x003e, "USA 1" )
1815 	PORT_DIPSETTING(      0x003c, "USA 2" )
1816 	PORT_DIPSETTING(      0x003a, "USA 3" )
1817 	PORT_DIPSETTING(      0x0038, "USA 4" )
1818 	PORT_DIPSETTING(      0x0036, "USA 5" )
1819 	PORT_DIPSETTING(      0x0034, "USA 6" )
1820 	PORT_DIPSETTING(      0x0032, "USA 7" )
1821 	PORT_DIPSETTING(      0x0030, "USA ECA" )
1822 	PORT_DIPSETTING(      0x002e, "France 1" )
1823 	PORT_DIPSETTING(      0x002c, "France 2" )
1824 	PORT_DIPSETTING(      0x002a, "France 3" )
1825 	PORT_DIPSETTING(      0x0028, "France 4" )
1826 	PORT_DIPSETTING(      0x0026, "France 5" )
1827 	PORT_DIPSETTING(      0x0024, "France 6" )
1828 	PORT_DIPSETTING(      0x0022, "France 7" )
1829 	PORT_DIPSETTING(      0x0020, "France ECA" )
1830 	PORT_DIPSETTING(      0x001e, "German 1" )
1831 	PORT_DIPSETTING(      0x001c, "German 2" )
1832 	PORT_DIPSETTING(      0x001a, "German 3" )
1833 	PORT_DIPSETTING(      0x0018, "German 4" )
1834 	PORT_DIPSETTING(      0x0016, "German 5" )
1835 //	PORT_DIPSETTING(      0x0014, "German 5" )
1836 //	PORT_DIPSETTING(      0x0012, "German 5" )
1837 	PORT_DIPSETTING(      0x0010, "German ECA" )
1838 	PORT_DIPSETTING(      0x000e, "U.K. 1" )
1839 	PORT_DIPSETTING(      0x000c, "U.K. 2" )
1840 	PORT_DIPSETTING(      0x000a, "U.K. 3" )
1841 	PORT_DIPSETTING(      0x0008, "U.K. 4" )
1842 	PORT_DIPSETTING(      0x0006, "U.K. 5" )
1843 	PORT_DIPSETTING(      0x0004, "U.K. 6" )
1844 	PORT_DIPSETTING(      0x0002, "U.K. 7 ECA" )
1845 	PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ))
1846 	PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Unknown ))
1847 	PORT_DIPSETTING(      0x0040, "0" )
1848 	PORT_DIPSETTING(      0x0000, "1" )
1849 	PORT_DIPNAME( 0x0080, 0x0080, "Power Up Test Loop" )
1850 	PORT_DIPSETTING(      0x0080, DEF_STR( No ))
1851 	PORT_DIPSETTING(      0x0000, DEF_STR( Yes ))
1852 	PORT_DIPNAME( 0x0100, 0x0000, DEF_STR( Unknown ))
1853 	PORT_DIPSETTING(      0x0100, "0" )
1854 	PORT_DIPSETTING(      0x0000, "1" )
1855 	PORT_DIPNAME( 0x0600, 0x0400, "Resolution" )
1856 //	PORT_DIPSETTING(      0x0600, "0" )
1857 //	PORT_DIPSETTING(      0x0200, "Medium" )
1858 	PORT_DIPSETTING(      0x0400, "Low" )
1859 //	PORT_DIPSETTING(      0x0000, "3" )
1860 	PORT_DIPNAME( 0x1800, 0x1800, "Graphics Speed" )
1861 	PORT_DIPSETTING(      0x0000, "45 MHz" )
1862 	PORT_DIPSETTING(      0x0800, "47 MHz" )
1863 	PORT_DIPSETTING(      0x1000, "49 MHz" )
1864 	PORT_DIPSETTING(      0x1800, "51 MHz" )
1865 	PORT_DIPNAME( 0x2000, 0x0000, DEF_STR( Unknown ))
1866 	PORT_DIPSETTING(      0x2000, "0" )
1867 	PORT_DIPSETTING(      0x0000, "1" )
1868 	PORT_DIPNAME( 0x4000, 0x0000, "Power On Self Test" )
1869 	PORT_DIPSETTING(      0x0000, DEF_STR( No ))
1870 	PORT_DIPSETTING(      0x4000, DEF_STR( Yes ))
1871 	PORT_DIPNAME( 0x8000, 0x8000, "Test Switch" )
1872 	PORT_DIPSETTING(      0x8000, DEF_STR( Off ))
1873 	PORT_DIPSETTING(      0x0000, DEF_STR( On ))
1874 
1875 	PORT_START
1876 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
1877 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
1878 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
1879 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */
1880 	PORT_BITX(0x0010, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE ) /* Test switch */
1881 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
1882 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 )
1883 	PORT_BIT( 0x0780, IP_ACTIVE_LOW, IPT_UNUSED )
1884 	PORT_BITX(0x0800, IP_ACTIVE_LOW, 0, "Volume Down", KEYCODE_MINUS, IP_JOY_NONE )
1885 	PORT_BITX(0x1000, IP_ACTIVE_LOW, 0, "Volume Up", KEYCODE_EQUALS, IP_JOY_NONE )
1886 	PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED )
1887 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )	/* Bill */
1888 
1889 	PORT_START
1890 	PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
1891 
1892 	PORT_START
1893 	PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
1894 
1895 	PORT_START				/* fake analog X */
1896 	PORT_ANALOG( 0xff, 0x80, IPT_LIGHTGUN_X, 50, 10, 0, 255 )
1897 
1898 	PORT_START				/* fake analog Y */
1899 	PORT_ANALOG( 0xff, 0x80, IPT_LIGHTGUN_Y, 70, 10, 0, 255 )
1900 
1901 	PORT_START				/* fake analog X */
1902 	PORT_ANALOG( 0xff, 0x80, IPT_LIGHTGUN_X | IPF_PLAYER2, 50, 10, 0, 255 )
1903 
1904 	PORT_START				/* fake analog Y */
1905 	PORT_ANALOG( 0xff, 0x80, IPT_LIGHTGUN_Y | IPF_PLAYER2, 70, 10, 0, 255 )
1906 
1907 	PORT_START				/* fake switches */
1908 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER1 )
1909 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_PLAYER1 )
1910 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
1911 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_PLAYER2 )
1912 INPUT_PORTS_END
1913 
1914 
1915 
1916 /*************************************
1917  *
1918  *	Machine drivers
1919  *
1920  *************************************/
1921 
1922 static struct mips3_config config =
1923 {
1924 	16384,	/* code cache size */
1925 	16384	/* data cache size */
1926 };
1927 
1928 MACHINE_DRIVER_START( seattle_flagstaff_common )
1929 
1930 	/* basic machine hardware */
1931 	MDRV_CPU_ADD_TAG("main", R5000LE, 50000000*3)
MDRV_CPU_CONFIG(config)1932 	MDRV_CPU_CONFIG(config)
1933 	MDRV_CPU_MEMORY(seattle_readmem,seattle_writemem)
1934 	MDRV_CPU_VBLANK_INT(assert_vblank,1)
1935 
1936 	MDRV_FRAMES_PER_SECOND(57)
1937 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
1938 
1939 	MDRV_MACHINE_INIT(seattle)
1940 	MDRV_NVRAM_HANDLER(generic_1fill)
1941 
1942 	/* video hardware */
1943 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
1944 	MDRV_SCREEN_SIZE(512, 400)
1945 	MDRV_VISIBLE_AREA(0, 511, 0, 399)
1946 	MDRV_PALETTE_LENGTH(65536)
1947 
1948 	MDRV_VIDEO_START(voodoo_1x4mb)
1949 	MDRV_VIDEO_STOP(voodoo)
1950 	MDRV_VIDEO_UPDATE(voodoo)
1951 
1952 	/* sound hardware */
1953 MACHINE_DRIVER_END
1954 
1955 
1956 MACHINE_DRIVER_START( seattle150 )
1957 	MDRV_IMPORT_FROM(seattle_flagstaff_common)
1958 
1959 	/* sound hardware */
1960 	MDRV_IMPORT_FROM(dcs2_audio)
1961 MACHINE_DRIVER_END
1962 
1963 
1964 MACHINE_DRIVER_START( seattle200 )
1965 	MDRV_IMPORT_FROM(seattle150)
1966 	MDRV_CPU_REPLACE("main", R5000LE, 50000000*4)
1967 MACHINE_DRIVER_END
1968 
1969 
1970 MACHINE_DRIVER_START( carnevil )
1971 	MDRV_IMPORT_FROM(seattle150)
1972 	MDRV_FRAMES_PER_SECOND(54)
1973 	MDRV_VIDEO_UPDATE(carnevil)
1974 MACHINE_DRIVER_END
1975 
1976 
1977 MACHINE_DRIVER_START( flagstaff )
1978 	MDRV_IMPORT_FROM(seattle_flagstaff_common)
1979 	MDRV_CPU_REPLACE("main", R5000LE, 50000000*4)
1980 
1981 	/* video hardware */
1982 	MDRV_VIDEO_START(voodoo_2x4mb)
1983 
1984 	/* sound hardware */
1985 	MDRV_IMPORT_FROM(cage_seattle)
1986 MACHINE_DRIVER_END
1987 
1988 
1989 
1990 /*************************************
1991  *
1992  *	ROM definitions
1993  *
1994  *************************************/
1995 
1996 ROM_START( wg3dh )
1997 	ROM_REGION( 0x400000, REGION_CPU1, 0 )		/* dummy R5000 region */
1998 
1999 	ROM_REGION( ADSP2100_SIZE + 0x408000, REGION_CPU2, 0 )	/* ADSP-2115 data Version L1.1 */
2000 	ROM_LOAD( "soundl11.u95", ADSP2100_SIZE + 0x000000, 0x8000, CRC(c589458c) SHA1(0cf970a35910a74cdcf3bd8119bfc0c693e19b00) )
2001 
2002 	ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )	/* Boot Code Version L1.2 */
2003 	ROM_LOAD( "wg3dh_12.u32", 0x000000, 0x80000, CRC(15e4cea2) SHA1(72c0db7dc53ce645ba27a5311b5ce803ad39f131) )
2004 
2005 	DISK_REGION( REGION_DISKS )
2006 	DISK_IMAGE( "wg3dh.chd", 0, MD5(424dbda376e8c45ec873b79194bdb924) SHA1(c12875036487a9324734012e601d1f234d2e783e) )
2007 ROM_END
2008 
2009 
2010 ROM_START( mace )
2011 	ROM_REGION( 0x400000, REGION_CPU1, 0 )		/* dummy R5000 region */
2012 
2013 	ROM_REGION( ADSP2100_SIZE + 0x408000, REGION_CPU2, 0 )	/* ADSP-2115 data Version L1.1 */
2014 	ROM_LOAD( "soundl11.u95", ADSP2100_SIZE + 0x000000, 0x8000, CRC(c589458c) SHA1(0cf970a35910a74cdcf3bd8119bfc0c693e19b00) )
2015 
2016 	ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
2017 	ROM_LOAD( "maceboot.u32", 0x000000, 0x80000, CRC(effe3ebc) SHA1(7af3ca3580d6276ffa7ab8b4c57274e15ee6bcbb) )
2018 
2019 	DISK_REGION( REGION_DISKS )
2020 	DISK_IMAGE( "mace.chd", 0, BAD_DUMP MD5(276577faa5632eb23dc5a97c11c0a1b1) SHA1(e2cce4ff2e15267b7008422252bdf62b188cf743) )
2021 ROM_END
2022 
2023 
2024 ROM_START( sfrush )
2025 	ROM_REGION( 0x800000, REGION_CPU1, 0 )		/* dummy R5000 region */
2026 
2027 	ROM_REGION( 0x040000, REGION_CPU2, 0 )		/* RAM for TMS320C31 */
2028 
2029 	ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )	/* Boot Code Version L1.0 */
2030 	ROM_LOAD( "hdboot.u32", 0x000000, 0x80000, CRC(39a35f1b) SHA1(c46d83448399205d38e6e41dd56abbc362254254) )
2031 
2032 	ROM_REGION32_LE( 0x200000, REGION_USER2, 0 )	/* TMS320C31 boot ROM  Version L1.0 */
2033 	ROM_LOAD32_BYTE( "sndboot.u69", 0x000000, 0x080000, CRC(7e52cdc7) SHA1(f735063e19d2ca672cef6d761a2a47df272e8c59) )
2034 
2035 	ROM_REGION32_LE( 0x1000000, REGION_USER3, 0 )	/* TMS320C31 sound ROMs */
2036 	ROM_LOAD32_WORD( "sfrush.u62",  0x400000, 0x200000, CRC(5d66490e) SHA1(bd39ea3b45d44cae6ca5890f365653326bbecd2d) )
2037 	ROM_LOAD32_WORD( "sfrush.u61",  0x400002, 0x200000, CRC(f3a00ee8) SHA1(c1ac780efc32b2e30522d7cc3e6d92e7daaadddd) )
2038 	ROM_LOAD32_WORD( "sfrush.u53",  0x800000, 0x200000, CRC(71f8ddb0) SHA1(c24bef801f43bae68fda043c4356e8cf1298ca97) )
2039 	ROM_LOAD32_WORD( "sfrush.u49",  0x800002, 0x200000, CRC(dfb0a54c) SHA1(ed34f9485f7a7e5bb73bf5c6428b27548e12db12) )
2040 
2041 	DISK_REGION( REGION_DISKS )	/* Hard Drive Version L1.06 */
2042 	DISK_IMAGE( "sfrush.chd", 0, MD5(7a77addb141fc11fd5ca63850382e0d1) SHA1(0e5805e255e91f08c9802a04b42056d61ba5eb41) )
2043 ROM_END
2044 
2045 
2046 ROM_START( calspeed )
2047 	ROM_REGION( 0x800000, REGION_CPU1, 0 )		/* dummy R5000 region */
2048 
2049 	ROM_REGION( ADSP2100_SIZE + 0x408000, REGION_CPU2, 0 )	/* ADSP-2115 data Version 1.02 */
2050 	ROM_LOAD( "sound102.u95", ADSP2100_SIZE + 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) )
2051 
2052 	ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
2053 	ROM_LOAD( "caspd1_2.u32", 0x000000, 0x80000, CRC(0a235e4e) SHA1(b352f10fad786260b58bd344b5002b6ea7aaf76d) )
2054 
2055 	DISK_REGION( REGION_DISKS )
2056 	DISK_IMAGE( "calspeed.chd", 0, MD5(dc8c919af86a1ab88a0b05ea2b6c74b3) SHA1(e6cbc8290af2df9704838a925cb43b6972b80d95) )
2057 ROM_END
2058 
2059 
2060 ROM_START( biofreak )
2061 	ROM_REGION( 0x800000, REGION_CPU1, 0 )		/* dummy R5000 region */
2062 
2063 	ROM_REGION( ADSP2100_SIZE + 0x408000, REGION_CPU2, 0 )	/* ADSP-2115 data Version 1.02 */
2064 	ROM_LOAD( "sound102.u95", ADSP2100_SIZE + 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) )
2065 
2066 	ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
2067 	ROM_LOAD( "biofreak.u32", 0x000000, 0x80000, CRC(cefa00bb) SHA1(7e171610ede1e8a448fb8d175f9cb9e7d549de28) )
2068 
2069 	DISK_REGION( REGION_DISKS )
2070 	DISK_IMAGE( "biofreak.chd", 0, MD5(f4663a3fd0ceed436756710b97d283e4) SHA1(88b87cb651b97eac117c9342127938e30dc8c138) )
2071 ROM_END
2072 
2073 
2074 ROM_START( blitz )
2075 	ROM_REGION( 0x800000, REGION_CPU1, 0 )		/* dummy R5000 region */
2076 
2077 	ROM_REGION( ADSP2100_SIZE + 0x408000, REGION_CPU2, 0 )	/* ADSP-2115 data Version 1.02 */
2078 	ROM_LOAD( "sound102.u95", ADSP2100_SIZE + 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) )
2079 
2080 	ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )	/* Boot Code Version 1.2 */
2081 	ROM_LOAD( "blitz1_2.u32", 0x000000, 0x80000, CRC(38dbecf5) SHA1(7dd5a5b3baf83a7f8f877ff4cd3f5e8b5201b36f) )
2082 
2083 	DISK_REGION( REGION_DISKS )	/* Hard Drive Version 1.21 */
2084 	DISK_IMAGE( "blitz.chd", 0, MD5(9cec59456c4d239ba05c7802082489e4) SHA1(0f001488b3709d40cee5e278603df2bbae1116b8) )
2085 ROM_END
2086 
2087 
2088 ROM_START( blitz99 )
2089 	ROM_REGION( 0x800000, REGION_CPU1, 0 )		/* dummy R5000 region */
2090 
2091 	ROM_REGION( ADSP2100_SIZE + 0x408000, REGION_CPU2, 0 )	/* ADSP-2115 data Version 1.02 */
2092 	ROM_LOAD( "sound102.u95", ADSP2100_SIZE + 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) )
2093 
2094 	ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
2095 	ROM_LOAD( "blitz99.u32", 0x000000, 0x80000, CRC(777119b2) SHA1(40d255181c2f3a787919c339e83593fd506779a5) )
2096 
2097 	DISK_REGION( REGION_DISKS )	/* Hard Drive Version 1.30 */
2098 	DISK_IMAGE( "blitz99.chd", 0, MD5(4bb6caf8f985e90d99989eede5504188) SHA1(4675751875943b756c8db6997fd288938a7999bb) )
2099 ROM_END
2100 
2101 
2102 ROM_START( blitz2k )
2103 	ROM_REGION( 0x800000, REGION_CPU1, 0 )		/* dummy R5000 region */
2104 
2105 	ROM_REGION( ADSP2100_SIZE + 0x408000, REGION_CPU2, 0 )	/* ADSP-2115 data Version 1.02 */
2106 	ROM_LOAD( "sound102.u95", ADSP2100_SIZE + 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) )
2107 
2108 	ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )	/* Boot Code Version 1.4 */
2109 	ROM_LOAD( "bltz2k14.u32", 0x000000, 0x80000, CRC(ac4f0051) SHA1(b8125c17370db7bfd9b783230b4ef3d5b22a2025) )
2110 
2111 	DISK_REGION( REGION_DISKS )	/* Hard Drive Version 1.5 */
2112 	DISK_IMAGE( "blitz2k.chd", 0, MD5(7778a82f35c05ed797b315439843246c) SHA1(153a7df368833cd5f5a52c3fe17045c5549a0c17) )
2113 ROM_END
2114 
2115 
2116 ROM_START( carnevil )
2117 	ROM_REGION( 0x800000, REGION_CPU1, 0 )		/* dummy R5000 region */
2118 
2119 	ROM_REGION( ADSP2100_SIZE + 0x408000, REGION_CPU2, 0 )	/* ADSP-2115 data Version 1.02 */
2120 	ROM_LOAD( "sound102.u95", ADSP2100_SIZE + 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) )
2121 
2122 	ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
2123 	ROM_LOAD( "boot.u32", 0x000000, 0x80000, CRC(82c07f2e) SHA1(fa51c58022ce251c53bad12fc6ffadb35adb8162) )
2124 
2125 	DISK_REGION( REGION_DISKS )
2126 	DISK_IMAGE( "carnevil.chd", 0, BAD_DUMP MD5(6eafae86091c0a915cf8cfdc3d73adc2) SHA1(5e6524d4b97de141c38e301a17e8af15661cb5d6) )
2127 ROM_END
2128 
2129 
2130 
2131 /*************************************
2132  *
2133  *	Driver init
2134  *
2135  *************************************/
2136 
2137 static void init_common(int ioasic, int serialnum, int yearoffs)
2138 {
2139 	/* initialize the subsystems */
2140 	ide_controller_init(0, &ide_intf);
2141 	midway_ioasic_init(ioasic, serialnum, yearoffs, ioasic_irq);
2142 
2143 	/* copy the boot ROM into its home location */
2144 	memcpy(rombase, memory_region(REGION_USER1), memory_region_length(REGION_USER1));
2145 
2146 	/* set the fastest DRC options, but strict verification */
2147 	mips3drc_set_options(0, MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY);
2148 }
2149 
2150 
DRIVER_INIT(wg3dh)2151 static DRIVER_INIT( wg3dh )
2152 {
2153 	dcs2_init(0x3839);
2154 	init_common(MIDWAY_IOASIC_STANDARD, 310/* others? */, 80);
2155 
2156 	/* speedups */
2157 	install_mem_read32_handler(0, 0x80115e00, 0x80115e03, generic_speedup_r);
2158 	generic_speedup = &rambase[0x115e00/4];
2159 }
2160 
2161 
DRIVER_INIT(mace)2162 static DRIVER_INIT( mace )
2163 {
2164 	dcs2_init(0x3839);
2165 	init_common(MIDWAY_IOASIC_MACE, 450/* unknown */, 80);
2166 
2167 	/* no obvious speedups */
2168 }
2169 
2170 
DRIVER_INIT(sfrush)2171 static DRIVER_INIT( sfrush )
2172 {
2173 	cage_init(REGION_USER2, 0x5236);
2174 	init_common(MIDWAY_IOASIC_STANDARD, 315/* no alternates */, 100);
2175 
2176 	/* set up the analog inputs */
2177 	install_mem_read32_handler(0, 0xb4000000, 0xb4000003, analog_port_r);
2178 	install_mem_write32_handler(0, 0xb4000000, 0xb4000003, analog_port_w);
2179 
2180 	/* speedups */
2181 	install_mem_read32_handler(0, 0x8012498c, 0x8012498f, generic_speedup_r);
2182 	generic_speedup = &rambase[0x12498c/4];
2183 	install_mem_read32_handler(0, 0x80120000, 0x80120003, generic_speedup2_r);
2184 	generic_speedup2 = &rambase[0x120000/4];
2185 }
2186 
2187 
DRIVER_INIT(calspeed)2188 static DRIVER_INIT( calspeed )
2189 {
2190 	dcs2_init(0x39c0);
2191 	init_common(MIDWAY_IOASIC_CALSPEED, 450/* unknown */, 100);
2192 	midway_ioasic_set_auto_ack(1);
2193 
2194 	/* set up the analog inputs */
2195 	install_mem_read32_handler(0, 0xb6c00010, 0xb6c00013, analog_port_r);
2196 	install_mem_write32_handler(0, 0xb6c00010, 0xb6c00013, analog_port_w);
2197 	install_mem_write32_handler(0, 0xb6c0000c, 0xb6c0000f, MWA32_NOP);
2198 
2199 	/* speedups */
2200 	install_mem_read32_handler(0, 0x802e6480, 0x802e6483, generic_speedup_r);
2201 	generic_speedup = &rambase[0x2e6480/4];
2202 }
2203 
2204 
DRIVER_INIT(biofreak)2205 static DRIVER_INIT( biofreak )
2206 {
2207 	dcs2_init(0x3835);
2208 	init_common(MIDWAY_IOASIC_STANDARD, 231/* no alternates */, 80);
2209 
2210 	/* speedups */
2211 //	install_mem_write32_handler(0, 0x802502bc, 0x802502bf, generic_speedup_w);
2212 //	generic_speedup = &rambase[0x2502bc/4];
2213 }
2214 
2215 
DRIVER_INIT(blitz)2216 static DRIVER_INIT( blitz )
2217 {
2218 	dcs2_init(0x39c2);
2219 	init_common(MIDWAY_IOASIC_BLITZ99, 528/* or 444 */, 80);
2220 
2221 	/* for some reason, the code in the ROM appears buggy; this is a small patch to fix it */
2222 	rombase[0x934/4] += 4;
2223 
2224 	/* speedups */
2225 	install_mem_write32_handler(0, 0x80243d58, 0x80243d5b, generic_speedup_w);
2226 	generic_speedup = &rambase[0x243d58/4];
2227 }
2228 
2229 
DRIVER_INIT(blitz99)2230 static DRIVER_INIT( blitz99 )
2231 {
2232 	dcs2_init(0x0afb);
2233 	init_common(MIDWAY_IOASIC_BLITZ99, 520/* or 481 or 484 */, 80);
2234 
2235 	/* speedups */
2236 	install_mem_write32_handler(0, 0x802502bc, 0x802502bf, generic_speedup_w);
2237 	generic_speedup = &rambase[0x2502bc/4];
2238 }
2239 
2240 
DRIVER_INIT(blitz2k)2241 static DRIVER_INIT( blitz2k )
2242 {
2243 	dcs2_init(0x0b5d);
2244 	init_common(MIDWAY_IOASIC_BLITZ99, 498/* or 494 */, 80);
2245 
2246 	/* speedups */
2247 	install_mem_write32_handler(0, 0x8024e8d8, 0x8024e8db, generic_speedup_w);
2248 	generic_speedup = &rambase[0x24e8d8/4];
2249 }
2250 
2251 
DRIVER_INIT(carnevil)2252 static DRIVER_INIT( carnevil )
2253 {
2254 	dcs2_init(0x0af7);
2255 	init_common(MIDWAY_IOASIC_CARNEVIL, 528/* or 469 or 486 */, 80);
2256 
2257 	/* set up the gun */
2258 	install_mem_read32_handler(0, 0xb6800000, 0xb680001f, carnevil_gun_r);
2259 	install_mem_write32_handler(0, 0xb6800000, 0xb680001f, carnevil_gun_w);
2260 
2261 	/* speedups */
2262 	install_mem_write32_handler(0, 0x801a2bac, 0x801a2baf, generic_speedup_w);
2263 	generic_speedup = &rambase[0x1a2bac/4];
2264 }
2265 
2266 
2267 
2268 /*************************************
2269  *
2270  *	Game drivers
2271  *
2272  *************************************/
2273 
2274 /* Atari */
2275 GAME ( 1996, wg3dh,    0,        seattle150, wg3dh,    wg3dh,    ROT0, "Atari Games",  "Wayne Gretzky's 3D Hockey" )
2276 GAME ( 1996, mace,     0,        seattle200, mace,     mace,     ROT0, "Atari Games",  "Mace: The Dark Age" )
2277 GAMEX( 1996, sfrush,   0,        flagstaff,  sfrush,   sfrush,   ROT0, "Atari Games",  "San Francisco Rush", GAME_NOT_WORKING )
2278 GAME ( 1998, calspeed, 0,        seattle150, calspeed, calspeed, ROT0, "Atari Games",  "California Speed" )
2279 
2280 /* Midway */
2281 GAME ( 1997, biofreak, 0,        seattle150, biofreak, biofreak, ROT0, "Midway Games", "BioFreaks (prototype)" )
2282 GAME ( 1997, blitz,    0,        seattle150, blitz,    blitz,    ROT0, "Midway Games", "NFL Blitz" )
2283 GAME ( 1998, blitz99,  0,        seattle150, blitz99,  blitz99,  ROT0, "Midway Games", "NFL Blitz '99" )
2284 GAME ( 1999, blitz2k,  0,        seattle150, blitz99,  blitz2k,  ROT0, "Midway Games", "NFL Blitz 2000" )
2285 GAMEC( 1998, carnevil, 0,        carnevil,   carnevil, carnevil, ROT0, "Midway Games", "CarnEvil", &carnevil_ctrl, &carnevil_bootstrap )
2286